diff --git a/dist/index.js b/dist/index.js index f2ce9a7..a7dc07c 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1,4 +1,4 @@ -import{createRequire as t}from"module";var n={1695:(t,n,i)=>{var a;const{awsEndpointFunctions:A,emitWarningIfUnsupportedVersion:c,createDefaultUserAgentProvider:l,NODE_APP_ID_CONFIG_OPTIONS:d,getAwsRegionExtensionConfiguration:h,resolveAwsRegionExtensionConfiguration:f,resolveUserAgentConfig:g,resolveHostHeaderConfig:p,getUserAgentPlugin:m,getHostHeaderPlugin:E,getLoggerPlugin:C,getRecursionDetectionPlugin:I,setCredentialFeature:y,stsRegionDefaultResolver:B}=i(5152);const{NoAuthSigner:Q,getHttpAuthSchemeEndpointRuleSetPlugin:w,DefaultIdentityProviderConfig:S,getHttpSigningPlugin:b}=i(402);const{normalizeProvider:R,getSmithyContext:v,ServiceException:k,NoOpLogger:D,emitWarningIfUnsupportedVersion:T,loadConfigsForDefaultMode:N,getDefaultExtensionConfiguration:M,resolveDefaultRuntimeConfig:F,Client:x,Command:U,createAggregatedClient:P}=i(2658);a=U;a=x;const{resolveDefaultsModeConfig:L,loadConfig:O,NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS:H,NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS:$,NODE_REGION_CONFIG_OPTIONS:G,NODE_REGION_CONFIG_FILE_OPTIONS:V,resolveRegionConfig:Y}=i(7291);const{BinaryDecisionDiagram:J,EndpointCache:W,decideEndpoint:q,customEndpointFunctions:j,resolveParams:z,resolveEndpointConfig:K,getEndpointPlugin:Z}=i(2085);const{parseUrl:X,getHttpHandlerExtensionConfiguration:ee,resolveHttpHandlerRuntimeConfig:te,getContentLengthPlugin:re}=i(3422);const{DEFAULT_RETRY_MODE:ne,NODE_RETRY_MODE_CONFIG_OPTIONS:se,NODE_MAX_ATTEMPT_CONFIG_OPTIONS:oe,resolveRetryConfig:ie,getRetryPlugin:ae}=i(3609);const{TypeRegistry:Ae,getSchemaSerdePlugin:ce}=i(6890);const{resolveAwsSdkSigV4Config:le,resolveAwsSdkSigV4AConfig:ue,AwsSdkSigV4Signer:de,AwsSdkSigV4ASigner:he,NODE_SIGV4A_CONFIG_OPTIONS:fe,NODE_AUTH_SCHEME_PREFERENCE_OPTIONS:ge}=i(7523);const{SignatureV4MultiRegion:pe}=i(5785);const{defaultProvider:me}=i(5861);const{toUtf8:Ee,fromUtf8:Ce,toBase64:Ie,fromBase64:ye,calculateBodyLength:Be}=i(2430);const{streamCollector:Qe,NodeHttpHandler:we}=i(1279);const{AwsQueryProtocol:Se}=i(7288);const{Sha256:be}=i(9542);const Re="ref";const ve=-1,ke=true,De="isSet",Te="PartitionResult",Ne="booleanEquals",Me="stringEquals",Fe="getAttr",xe="us-east-1",Ue="sigv4",Pe="sts",Le="https://sts.{Region}.{PartitionResult#dnsSuffix}",_e={[Re]:"Endpoint"},Oe={[Re]:"Region"},He={[Re]:Te},$e={},Ge=[Oe];const Ve={conditions:[[De,[_e]],[De,Ge],["aws.partition",Ge,Te],[Ne,[{[Re]:"UseFIPS"},ke]],[Ne,[{[Re]:"UseDualStack"},ke]],[Me,[Oe,"aws-global"]],[Ne,[{[Re]:"UseGlobalEndpoint"},ke]],[Me,[Oe,"eu-central-1"]],[Ne,[{fn:Fe,argv:[He,"supportsDualStack"]},ke]],[Ne,[{fn:Fe,argv:[He,"supportsFIPS"]},ke]],[Me,[Oe,"ap-south-1"]],[Me,[Oe,"eu-north-1"]],[Me,[Oe,"eu-west-1"]],[Me,[Oe,"eu-west-2"]],[Me,[Oe,"eu-west-3"]],[Me,[Oe,"sa-east-1"]],[Me,[Oe,xe]],[Me,[Oe,"us-east-2"]],[Me,[Oe,"us-west-2"]],[Me,[Oe,"us-west-1"]],[Me,[Oe,"ca-central-1"]],[Me,[Oe,"ap-southeast-1"]],[Me,[Oe,"ap-northeast-1"]],[Me,[Oe,"ap-southeast-2"]],[Me,[{fn:Fe,argv:[He,"name"]},"aws-us-gov"]]],results:[[ve],["https://sts.amazonaws.com",{authSchemes:[{name:Ue,signingName:Pe,signingRegion:xe}]}],[Le,{authSchemes:[{name:Ue,signingName:Pe,signingRegion:"{Region}"}]}],[ve,"Invalid Configuration: FIPS and custom endpoint are not supported"],[ve,"Invalid Configuration: Dualstack and custom endpoint are not supported"],[_e,$e],["https://sts-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",$e],[ve,"FIPS and DualStack are enabled, but this partition does not support one or both"],["https://sts.{Region}.amazonaws.com",$e],["https://sts-fips.{Region}.{PartitionResult#dnsSuffix}",$e],[ve,"FIPS is enabled but this partition does not support FIPS"],["https://sts.{Region}.{PartitionResult#dualStackDnsSuffix}",$e],[ve,"DualStack is enabled but this partition does not support DualStack"],[Le,$e],[ve,"Invalid Configuration: Missing Region"]]};const Ye=2;const Je=1e8;const We=new Int32Array([-1,1,-1,0,30,3,1,4,Je+14,2,5,Je+14,3,25,6,4,24,7,5,Je+1,8,6,9,Je+13,7,Je+1,10,10,Je+1,11,11,Je+1,12,12,Je+1,13,13,Je+1,14,14,Je+1,15,15,Je+1,16,16,Je+1,17,17,Je+1,18,18,Je+1,19,19,Je+1,20,20,Je+1,21,21,Je+1,22,22,Je+1,23,23,Je+1,Je+2,8,Je+11,Je+12,4,28,26,9,27,Je+10,24,Je+8,Je+9,8,29,Je+7,9,Je+6,Je+7,3,Je+3,31,4,Je+4,Je+5]);const qe=J.from(We,Ye,Ve.conditions,Ve.results);const je=new W({size:50,params:["Endpoint","Region","UseDualStack","UseFIPS","UseGlobalEndpoint"]});const defaultEndpointResolver=(t,n={})=>je.get(t,()=>q(qe,{endpointParams:t,logger:n.logger}));j.aws=A;const createEndpointRuleSetHttpAuthSchemeParametersProvider=t=>async(n,i,a)=>{if(!a){throw new Error("Could not find `input` for `defaultEndpointRuleSetHttpAuthSchemeParametersProvider`")}const A=await t(n,i,a);const c=v(i)?.commandInstance?.constructor?.getEndpointParameterInstructions;if(!c){throw new Error(`getEndpointParameterInstructions() is not defined on '${i.commandName}'`)}const l=await z(a,{getEndpointParameterInstructions:c},n);return Object.assign(A,l)};const _defaultSTSHttpAuthSchemeParametersProvider=async(t,n,i)=>({operation:v(n).operation,region:await R(t.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});const ze=createEndpointRuleSetHttpAuthSchemeParametersProvider(_defaultSTSHttpAuthSchemeParametersProvider);function createAwsAuthSigv4HttpAuthOption(t){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"sts",region:t.region},propertiesExtractor:(t,n)=>({signingProperties:{config:t,context:n}})}}function createAwsAuthSigv4aHttpAuthOption(t){return{schemeId:"aws.auth#sigv4a",signingProperties:{name:"sts",region:t.region},propertiesExtractor:(t,n)=>({signingProperties:{config:t,context:n}})}}function createSmithyApiNoAuthHttpAuthOption(t){return{schemeId:"smithy.api#noAuth"}}const createEndpointRuleSetHttpAuthSchemeProvider=(t,n,i)=>{const endpointRuleSetHttpAuthSchemeProvider=a=>{const A=t(a);const c=A.properties?.authSchemes;if(!c){return n(a)}const l=[];for(const t of c){const{name:n,properties:A={},...d}=t;const h=n.toLowerCase();if(n!==h){console.warn(`HttpAuthScheme has been normalized with lowercasing: '${n}' to '${h}'`)}let f;if(h==="sigv4a"){f="aws.auth#sigv4a";const t=c.find(t=>{const n=t.name.toLowerCase();return n!=="sigv4a"&&n.startsWith("sigv4")});if(pe.sigv4aDependency()==="none"&&t){continue}}else if(h.startsWith("sigv4")){f="aws.auth#sigv4"}else{throw new Error(`Unknown HttpAuthScheme found in '@smithy.rules#endpointRuleSet': '${h}'`)}const g=i[f];if(!g){throw new Error(`Could not find HttpAuthOption create function for '${f}'`)}const p=g(a);p.schemeId=f;p.signingProperties={...p.signingProperties||{},...d,...A};l.push(p)}return l};return endpointRuleSetHttpAuthSchemeProvider};const _defaultSTSHttpAuthSchemeProvider=t=>{const n=[];switch(t.operation){case"AssumeRoleWithSAML":{n.push(createSmithyApiNoAuthHttpAuthOption());n.push(createAwsAuthSigv4aHttpAuthOption(t));break}case"AssumeRoleWithWebIdentity":{n.push(createSmithyApiNoAuthHttpAuthOption());n.push(createAwsAuthSigv4aHttpAuthOption(t));break}default:{n.push(createAwsAuthSigv4HttpAuthOption(t));n.push(createAwsAuthSigv4aHttpAuthOption(t))}}return n};const Ke=createEndpointRuleSetHttpAuthSchemeProvider(defaultEndpointResolver,_defaultSTSHttpAuthSchemeProvider,{"aws.auth#sigv4":createAwsAuthSigv4HttpAuthOption,"aws.auth#sigv4a":createAwsAuthSigv4aHttpAuthOption,"smithy.api#noAuth":createSmithyApiNoAuthHttpAuthOption});const resolveHttpAuthSchemeConfig=t=>{const n=le(t);const i=ue(n);return Object.assign(i,{authSchemePreference:R(t.authSchemePreference??[])})};const resolveClientEndpointParameters=t=>Object.assign(t,{useDualstackEndpoint:t.useDualstackEndpoint??false,useFipsEndpoint:t.useFipsEndpoint??false,useGlobalEndpoint:t.useGlobalEndpoint??false,defaultSigningName:"sts"});const Ze={UseGlobalEndpoint:{type:"builtInParams",name:"useGlobalEndpoint"},UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}};var Xe="3.1076.0";var et={version:Xe};class STSServiceException extends k{constructor(t){super(t);Object.setPrototypeOf(this,STSServiceException.prototype)}}class ExpiredTokenException extends STSServiceException{name="ExpiredTokenException";$fault="client";constructor(t){super({name:"ExpiredTokenException",$fault:"client",...t});Object.setPrototypeOf(this,ExpiredTokenException.prototype)}}class MalformedPolicyDocumentException extends STSServiceException{name="MalformedPolicyDocumentException";$fault="client";constructor(t){super({name:"MalformedPolicyDocumentException",$fault:"client",...t});Object.setPrototypeOf(this,MalformedPolicyDocumentException.prototype)}}class PackedPolicyTooLargeException extends STSServiceException{name="PackedPolicyTooLargeException";$fault="client";constructor(t){super({name:"PackedPolicyTooLargeException",$fault:"client",...t});Object.setPrototypeOf(this,PackedPolicyTooLargeException.prototype)}}class RegionDisabledException extends STSServiceException{name="RegionDisabledException";$fault="client";constructor(t){super({name:"RegionDisabledException",$fault:"client",...t});Object.setPrototypeOf(this,RegionDisabledException.prototype)}}class IDPRejectedClaimException extends STSServiceException{name="IDPRejectedClaimException";$fault="client";constructor(t){super({name:"IDPRejectedClaimException",$fault:"client",...t});Object.setPrototypeOf(this,IDPRejectedClaimException.prototype)}}class InvalidIdentityTokenException extends STSServiceException{name="InvalidIdentityTokenException";$fault="client";constructor(t){super({name:"InvalidIdentityTokenException",$fault:"client",...t});Object.setPrototypeOf(this,InvalidIdentityTokenException.prototype)}}class IDPCommunicationErrorException extends STSServiceException{name="IDPCommunicationErrorException";$fault="client";$retryable={};constructor(t){super({name:"IDPCommunicationErrorException",$fault:"client",...t});Object.setPrototypeOf(this,IDPCommunicationErrorException.prototype)}}class InvalidAuthorizationMessageException extends STSServiceException{name="InvalidAuthorizationMessageException";$fault="client";constructor(t){super({name:"InvalidAuthorizationMessageException",$fault:"client",...t});Object.setPrototypeOf(this,InvalidAuthorizationMessageException.prototype)}}class ExpiredTradeInTokenException extends STSServiceException{name="ExpiredTradeInTokenException";$fault="client";constructor(t){super({name:"ExpiredTradeInTokenException",$fault:"client",...t});Object.setPrototypeOf(this,ExpiredTradeInTokenException.prototype)}}class JWTPayloadSizeExceededException extends STSServiceException{name="JWTPayloadSizeExceededException";$fault="client";constructor(t){super({name:"JWTPayloadSizeExceededException",$fault:"client",...t});Object.setPrototypeOf(this,JWTPayloadSizeExceededException.prototype)}}class OutboundWebIdentityFederationDisabledException extends STSServiceException{name="OutboundWebIdentityFederationDisabledException";$fault="client";constructor(t){super({name:"OutboundWebIdentityFederationDisabledException",$fault:"client",...t});Object.setPrototypeOf(this,OutboundWebIdentityFederationDisabledException.prototype)}}class SessionDurationEscalationException extends STSServiceException{name="SessionDurationEscalationException";$fault="client";constructor(t){super({name:"SessionDurationEscalationException",$fault:"client",...t});Object.setPrototypeOf(this,SessionDurationEscalationException.prototype)}}const tt="Arn";const rt="AccessKeyId";const nt="AssumedPrincipal";const st="AssumeRole";const ot="AssumedRoleId";const it="AssumeRoleRequest";const at="AssumeRoleResponse";const At="AssumeRootRequest";const ct="AssumeRootResponse";const lt="AssumedRoleUser";const ut="AssumeRoleWithSAML";const dt="AssumeRoleWithSAMLRequest";const ht="AssumeRoleWithSAMLResponse";const ft="AssumeRoleWithWebIdentity";const gt="AssumeRoleWithWebIdentityRequest";const pt="AssumeRoleWithWebIdentityResponse";const mt="AssumeRoot";const Et="Account";const Ct="Audience";const It="Credentials";const yt="ContextAssertion";const Bt="DecodeAuthorizationMessage";const Qt="DecodeAuthorizationMessageRequest";const wt="DecodeAuthorizationMessageResponse";const St="DecodedMessage";const bt="DurationSeconds";const Rt="Expiration";const vt="ExternalId";const kt="EncodedMessage";const Dt="ExpiredTokenException";const Tt="ExpiredTradeInTokenException";const Nt="FederatedUser";const Mt="FederatedUserId";const Ft="GetAccessKeyInfo";const xt="GetAccessKeyInfoRequest";const Ut="GetAccessKeyInfoResponse";const Pt="GetCallerIdentity";const Lt="GetCallerIdentityRequest";const _t="GetCallerIdentityResponse";const Ot="GetDelegatedAccessToken";const Ht="GetDelegatedAccessTokenRequest";const $t="GetDelegatedAccessTokenResponse";const Gt="GetFederationToken";const Vt="GetFederationTokenRequest";const Yt="GetFederationTokenResponse";const Jt="GetSessionToken";const Wt="GetSessionTokenRequest";const qt="GetSessionTokenResponse";const jt="GetWebIdentityToken";const zt="GetWebIdentityTokenRequest";const Kt="GetWebIdentityTokenResponse";const Zt="Issuer";const Xt="InvalidAuthorizationMessageException";const er="IDPCommunicationErrorException";const tr="IDPRejectedClaimException";const rr="InvalidIdentityTokenException";const nr="JWTPayloadSizeExceededException";const sr="Key";const ir="MalformedPolicyDocumentException";const ar="Name";const Ar="NameQualifier";const cr="OutboundWebIdentityFederationDisabledException";const lr="Policy";const ur="PolicyArns";const dr="PrincipalArn";const hr="ProviderArn";const fr="ProvidedContexts";const gr="ProvidedContextsListType";const pr="ProvidedContext";const mr="PolicyDescriptorType";const Er="ProviderId";const Cr="PackedPolicySize";const Ir="PackedPolicyTooLargeException";const yr="Provider";const Br="RoleArn";const Qr="RegionDisabledException";const wr="RoleSessionName";const Sr="Subject";const br="SigningAlgorithm";const Rr="SecretAccessKey";const vr="SAMLAssertion";const kr="SAMLAssertionType";const Dr="SessionDurationEscalationException";const Tr="SubjectFromWebIdentityToken";const Nr="SourceIdentity";const Mr="SerialNumber";const Fr="SubjectType";const xr="SessionToken";const Ur="Tags";const Pr="TokenCode";const Lr="TradeInToken";const _r="TargetPrincipal";const Or="TaskPolicyArn";const Hr="TransitiveTagKeys";const $r="Tag";const Gr="UserId";const Vr="Value";const Yr="WebIdentityToken";const Jr="arn";const Wr="accessKeySecretType";const qr="awsQueryError";const jr="client";const zr="clientTokenType";const Kr="error";const Zr="httpError";const Xr="message";const en="policyDescriptorListType";const tn="smithy.ts.sdk.synthetic.com.amazonaws.sts";const rn="tradeInTokenType";const nn="tagListType";const sn="webIdentityTokenType";const on="com.amazonaws.sts";const an=Ae.for(tn);var An=[-3,tn,"STSServiceException",0,[],[]];an.registerError(An,STSServiceException);const cn=Ae.for(on);var ln=[-3,on,Dt,{[qr]:[`ExpiredTokenException`,400],[Kr]:jr,[Zr]:400},[Xr],[0]];cn.registerError(ln,ExpiredTokenException);var un=[-3,on,Tt,{[qr]:[`ExpiredTradeInTokenException`,400],[Kr]:jr,[Zr]:400},[Xr],[0]];cn.registerError(un,ExpiredTradeInTokenException);var dn=[-3,on,er,{[qr]:[`IDPCommunicationError`,400],[Kr]:jr,[Zr]:400},[Xr],[0]];cn.registerError(dn,IDPCommunicationErrorException);var hn=[-3,on,tr,{[qr]:[`IDPRejectedClaim`,403],[Kr]:jr,[Zr]:403},[Xr],[0]];cn.registerError(hn,IDPRejectedClaimException);var gn=[-3,on,Xt,{[qr]:[`InvalidAuthorizationMessageException`,400],[Kr]:jr,[Zr]:400},[Xr],[0]];cn.registerError(gn,InvalidAuthorizationMessageException);var pn=[-3,on,rr,{[qr]:[`InvalidIdentityToken`,400],[Kr]:jr,[Zr]:400},[Xr],[0]];cn.registerError(pn,InvalidIdentityTokenException);var mn=[-3,on,nr,{[qr]:[`JWTPayloadSizeExceededException`,400],[Kr]:jr,[Zr]:400},[Xr],[0]];cn.registerError(mn,JWTPayloadSizeExceededException);var En=[-3,on,ir,{[qr]:[`MalformedPolicyDocument`,400],[Kr]:jr,[Zr]:400},[Xr],[0]];cn.registerError(En,MalformedPolicyDocumentException);var Cn=[-3,on,cr,{[qr]:[`OutboundWebIdentityFederationDisabledException`,403],[Kr]:jr,[Zr]:403},[Xr],[0]];cn.registerError(Cn,OutboundWebIdentityFederationDisabledException);var In=[-3,on,Ir,{[qr]:[`PackedPolicyTooLarge`,400],[Kr]:jr,[Zr]:400},[Xr],[0]];cn.registerError(In,PackedPolicyTooLargeException);var yn=[-3,on,Qr,{[qr]:[`RegionDisabledException`,403],[Kr]:jr,[Zr]:403},[Xr],[0]];cn.registerError(yn,RegionDisabledException);var Bn=[-3,on,Dr,{[qr]:[`SessionDurationEscalationException`,403],[Kr]:jr,[Zr]:403},[Xr],[0]];cn.registerError(Bn,SessionDurationEscalationException);const Qn=[an,cn];var wn=[0,on,Wr,8,0];var Sn=[0,on,zr,8,0];var bn=[0,on,kr,8,0];var Rn=[0,on,rn,8,0];var vn=[0,on,sn,8,0];var kn=[3,on,lt,0,[ot,tt],[0,0],2];var Dn=[3,on,it,0,[Br,wr,ur,lr,bt,Ur,Hr,vt,Mr,Pr,Nr,fr],[0,0,()=>ns,0,1,()=>os,64|0,0,0,0,0,()=>ss],2];var Tn=[3,on,at,0,[It,lt,Cr,Nr],[[()=>Ln,0],()=>kn,1,0]];var Nn=[3,on,dt,0,[Br,dr,vr,ur,lr,bt],[0,0,[()=>bn,0],()=>ns,0,1],3];var Mn=[3,on,ht,0,[It,lt,Cr,Sr,Fr,Zt,Ct,Ar,Nr],[[()=>Ln,0],()=>kn,1,0,0,0,0,0,0]];var Fn=[3,on,gt,0,[Br,wr,Yr,Er,ur,lr,bt],[0,0,[()=>Sn,0],0,()=>ns,0,1],3];var xn=[3,on,pt,0,[It,Tr,lt,Cr,yr,Ct,Nr],[[()=>Ln,0],0,()=>kn,1,0,0,0]];var Un=[3,on,At,0,[_r,Or,bt],[0,()=>es,1],2];var Pn=[3,on,ct,0,[It,Nr],[[()=>Ln,0],0]];var Ln=[3,on,It,0,[rt,Rr,xr,Rt],[0,[()=>wn,0],0,4],4];var _n=[3,on,Qt,0,[kt],[0],1];var On=[3,on,wt,0,[St],[0]];var Hn=[3,on,Nt,0,[Mt,tt],[0,0],2];var $n=[3,on,xt,0,[rt],[0],1];var Gn=[3,on,Ut,0,[Et],[0]];var Vn=[3,on,Lt,0,[],[]];var Yn=[3,on,_t,0,[Gr,Et,tt],[0,0,0]];var Jn=[3,on,Ht,0,[Lr],[[()=>Rn,0]],1];var Wn=[3,on,$t,0,[It,Cr,nt],[[()=>Ln,0],1,0]];var qn=[3,on,Vt,0,[ar,lr,ur,bt,Ur],[0,0,()=>ns,1,()=>os],1];var jn=[3,on,Yt,0,[It,Nt,Cr],[[()=>Ln,0],()=>Hn,1]];var zn=[3,on,Wt,0,[bt,Mr,Pr],[1,0,0]];var Kn=[3,on,qt,0,[It],[[()=>Ln,0]]];var Zn=[3,on,zt,0,[Ct,br,bt,Ur],[64|0,0,1,()=>os],2];var Xn=[3,on,Kt,0,[Yr,Rt],[[()=>vn,0],4]];var es=[3,on,mr,0,[Jr],[0]];var ts=[3,on,pr,0,[hr,yt],[0,0]];var rs=[3,on,$r,0,[sr,Vr],[0,0],2];var ns=[1,on,en,0,()=>es];var ss=[1,on,gr,0,()=>ts];var os=[1,on,nn,0,()=>rs];var is=[9,on,st,0,()=>Dn,()=>Tn];var as=[9,on,ut,0,()=>Nn,()=>Mn];var As=[9,on,ft,0,()=>Fn,()=>xn];var cs=[9,on,mt,0,()=>Un,()=>Pn];var ls=[9,on,Bt,0,()=>_n,()=>On];var us=[9,on,Ft,0,()=>$n,()=>Gn];var ds=[9,on,Pt,0,()=>Vn,()=>Yn];var hs=[9,on,Ot,0,()=>Jn,()=>Wn];var fs=[9,on,Gt,0,()=>qn,()=>jn];var gs=[9,on,Jt,0,()=>zn,()=>Kn];var ps=[9,on,jt,0,()=>Zn,()=>Xn];const getRuntimeConfig$1=t=>({apiVersion:"2011-06-15",base64Decoder:t?.base64Decoder??ye,base64Encoder:t?.base64Encoder??Ie,disableHostPrefix:t?.disableHostPrefix??false,endpointProvider:t?.endpointProvider??defaultEndpointResolver,extensions:t?.extensions??[],httpAuthSchemeProvider:t?.httpAuthSchemeProvider??Ke,httpAuthSchemes:t?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:t=>t.getIdentityProvider("aws.auth#sigv4"),signer:new de},{schemeId:"aws.auth#sigv4a",identityProvider:t=>t.getIdentityProvider("aws.auth#sigv4a"),signer:new he},{schemeId:"smithy.api#noAuth",identityProvider:t=>t.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new Q}],logger:t?.logger??new D,protocol:t?.protocol??Se,protocolSettings:t?.protocolSettings??{defaultNamespace:"com.amazonaws.sts",errorTypeRegistries:Qn,xmlNamespace:"https://sts.amazonaws.com/doc/2011-06-15/",version:"2011-06-15",serviceTarget:"AWSSecurityTokenServiceV20110615"},serviceId:t?.serviceId??"STS",sha256:t?.sha256??be,signerConstructor:t?.signerConstructor??pe,urlParser:t?.urlParser??X,utf8Decoder:t?.utf8Decoder??Ce,utf8Encoder:t?.utf8Encoder??Ee});const getRuntimeConfig=t=>{T(process.version);const n=L(t);const defaultConfigProvider=()=>n().then(N);const i=getRuntimeConfig$1(t);c(process.version);const a={profile:t?.profile,logger:i.logger};return{...i,...t,runtime:"node",defaultsMode:n,authSchemePreference:t?.authSchemePreference??O(ge,a),bodyLengthChecker:t?.bodyLengthChecker??Be,credentialDefaultProvider:t?.credentialDefaultProvider??me,defaultUserAgentProvider:t?.defaultUserAgentProvider??l({serviceId:i.serviceId,clientVersion:et.version}),httpAuthSchemes:t?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:t=>t.getIdentityProvider("aws.auth#sigv4")||(async t=>await me(t?.__config||{})()),signer:new de},{schemeId:"aws.auth#sigv4a",identityProvider:t=>t.getIdentityProvider("aws.auth#sigv4a"),signer:new he},{schemeId:"smithy.api#noAuth",identityProvider:t=>t.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new Q}],maxAttempts:t?.maxAttempts??O(oe,t),region:t?.region??O(G,{...V,...a}),requestHandler:we.create(t?.requestHandler??defaultConfigProvider),retryMode:t?.retryMode??O({...se,default:async()=>(await defaultConfigProvider()).retryMode||ne},t),sigv4aSigningRegionSet:t?.sigv4aSigningRegionSet??O(fe,a),streamCollector:t?.streamCollector??Qe,useDualstackEndpoint:t?.useDualstackEndpoint??O($,a),useFipsEndpoint:t?.useFipsEndpoint??O(H,a),userAgentAppId:t?.userAgentAppId??O(d,a)}};const getHttpAuthExtensionConfiguration=t=>{const n=t.httpAuthSchemes;let i=t.httpAuthSchemeProvider;let a=t.credentials;return{setHttpAuthScheme(t){const i=n.findIndex(n=>n.schemeId===t.schemeId);if(i===-1){n.push(t)}else{n.splice(i,1,t)}},httpAuthSchemes(){return n},setHttpAuthSchemeProvider(t){i=t},httpAuthSchemeProvider(){return i},setCredentials(t){a=t},credentials(){return a}}};const resolveHttpAuthRuntimeConfig=t=>({httpAuthSchemes:t.httpAuthSchemes(),httpAuthSchemeProvider:t.httpAuthSchemeProvider(),credentials:t.credentials()});const resolveRuntimeExtensions=(t,n)=>{const i=Object.assign(h(t),M(t),ee(t),getHttpAuthExtensionConfiguration(t));n.forEach(t=>t.configure(i));return Object.assign(t,f(i),F(i),te(i),resolveHttpAuthRuntimeConfig(i))};class STSClient extends x{config;constructor(...[t]){const n=getRuntimeConfig(t||{});super(n);this.initConfig=n;const i=resolveClientEndpointParameters(n);const a=g(i);const A=ie(a);const c=Y(A);const l=p(c);const d=K(l);const h=resolveHttpAuthSchemeConfig(d);const f=resolveRuntimeExtensions(h,t?.extensions||[]);this.config=f;this.middlewareStack.use(ce(this.config));this.middlewareStack.use(m(this.config));this.middlewareStack.use(ae(this.config));this.middlewareStack.use(re(this.config));this.middlewareStack.use(E(this.config));this.middlewareStack.use(C(this.config));this.middlewareStack.use(I(this.config));this.middlewareStack.use(w(this.config,{httpAuthSchemeParametersProvider:ze,identityProviderConfigProvider:async t=>new S({"aws.auth#sigv4":t.credentials,"aws.auth#sigv4a":t.credentials})}));this.middlewareStack.use(b(this.config))}destroy(){super.destroy()}}class AssumeRoleCommand extends(U.classBuilder().ep(Ze).m(function(t,n,i,a){return[Z(i,t.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","AssumeRole",{}).n("STSClient","AssumeRoleCommand").sc(is).build()){}class AssumeRoleWithSAMLCommand extends(U.classBuilder().ep(Ze).m(function(t,n,i,a){return[Z(i,t.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","AssumeRoleWithSAML",{}).n("STSClient","AssumeRoleWithSAMLCommand").sc(as).build()){}class AssumeRoleWithWebIdentityCommand extends(U.classBuilder().ep(Ze).m(function(t,n,i,a){return[Z(i,t.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","AssumeRoleWithWebIdentity",{}).n("STSClient","AssumeRoleWithWebIdentityCommand").sc(As).build()){}class AssumeRootCommand extends(U.classBuilder().ep(Ze).m(function(t,n,i,a){return[Z(i,t.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","AssumeRoot",{}).n("STSClient","AssumeRootCommand").sc(cs).build()){}class DecodeAuthorizationMessageCommand extends(U.classBuilder().ep(Ze).m(function(t,n,i,a){return[Z(i,t.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","DecodeAuthorizationMessage",{}).n("STSClient","DecodeAuthorizationMessageCommand").sc(ls).build()){}class GetAccessKeyInfoCommand extends(U.classBuilder().ep(Ze).m(function(t,n,i,a){return[Z(i,t.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","GetAccessKeyInfo",{}).n("STSClient","GetAccessKeyInfoCommand").sc(us).build()){}class GetCallerIdentityCommand extends(U.classBuilder().ep(Ze).m(function(t,n,i,a){return[Z(i,t.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","GetCallerIdentity",{}).n("STSClient","GetCallerIdentityCommand").sc(ds).build()){}class GetDelegatedAccessTokenCommand extends(U.classBuilder().ep(Ze).m(function(t,n,i,a){return[Z(i,t.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","GetDelegatedAccessToken",{}).n("STSClient","GetDelegatedAccessTokenCommand").sc(hs).build()){}class GetFederationTokenCommand extends(U.classBuilder().ep(Ze).m(function(t,n,i,a){return[Z(i,t.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","GetFederationToken",{}).n("STSClient","GetFederationTokenCommand").sc(fs).build()){}class GetSessionTokenCommand extends(U.classBuilder().ep(Ze).m(function(t,n,i,a){return[Z(i,t.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","GetSessionToken",{}).n("STSClient","GetSessionTokenCommand").sc(gs).build()){}class GetWebIdentityTokenCommand extends(U.classBuilder().ep(Ze).m(function(t,n,i,a){return[Z(i,t.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","GetWebIdentityToken",{}).n("STSClient","GetWebIdentityTokenCommand").sc(ps).build()){}const ms={AssumeRoleCommand:AssumeRoleCommand,AssumeRoleWithSAMLCommand:AssumeRoleWithSAMLCommand,AssumeRoleWithWebIdentityCommand:AssumeRoleWithWebIdentityCommand,AssumeRootCommand:AssumeRootCommand,DecodeAuthorizationMessageCommand:DecodeAuthorizationMessageCommand,GetAccessKeyInfoCommand:GetAccessKeyInfoCommand,GetCallerIdentityCommand:GetCallerIdentityCommand,GetDelegatedAccessTokenCommand:GetDelegatedAccessTokenCommand,GetFederationTokenCommand:GetFederationTokenCommand,GetSessionTokenCommand:GetSessionTokenCommand,GetWebIdentityTokenCommand:GetWebIdentityTokenCommand};class STS extends STSClient{}P(ms,STS);const getAccountIdFromAssumedRoleUser=t=>{if(typeof t?.Arn==="string"){const n=t.Arn.split(":");if(n.length>4&&n[4]!==""){return n[4]}}return undefined};const resolveRegion=async(t,n,i,a={})=>{const A=typeof t==="function"?await t():t;const c=typeof n==="function"?await n():n;let l="";const d=A??c??(l=await B(a)());i?.debug?.("@aws-sdk/client-sts::resolveRegion","accepting first of:",`${A} (credential provider clientConfig)`,`${c} (contextual client)`,`${l} (STS default: AWS_REGION, profile region, or us-east-1)`);return d};const getDefaultRoleAssumer$1=(t,n)=>{let i;let a;return async(A,c)=>{a=A;if(!i){const{logger:A=t?.parentClientConfig?.logger,profile:c=t?.parentClientConfig?.profile,region:l,requestHandler:d=t?.parentClientConfig?.requestHandler,credentialProviderLogger:h,userAgentAppId:f=t?.parentClientConfig?.userAgentAppId}=t;const g=await resolveRegion(l,t?.parentClientConfig?.region,h,{logger:A,profile:c});const p=!isH2(d);i=new n({...t,userAgentAppId:f,profile:c,credentialDefaultProvider:()=>async()=>a,region:g,requestHandler:p?d:undefined,logger:A})}const{Credentials:l,AssumedRoleUser:d}=await i.send(new AssumeRoleCommand(c));if(!l||!l.AccessKeyId||!l.SecretAccessKey){throw new Error(`Invalid response from STS.assumeRole call with role ${c.RoleArn}`)}const h=getAccountIdFromAssumedRoleUser(d);const f={accessKeyId:l.AccessKeyId,secretAccessKey:l.SecretAccessKey,sessionToken:l.SessionToken,expiration:l.Expiration,...l.CredentialScope&&{credentialScope:l.CredentialScope},...h&&{accountId:h}};y(f,"CREDENTIALS_STS_ASSUME_ROLE","i");return f}};const getDefaultRoleAssumerWithWebIdentity$1=(t,n)=>{let i;return async a=>{if(!i){const{logger:a=t?.parentClientConfig?.logger,profile:A=t?.parentClientConfig?.profile,region:c,requestHandler:l=t?.parentClientConfig?.requestHandler,credentialProviderLogger:d,userAgentAppId:h=t?.parentClientConfig?.userAgentAppId}=t;const f=await resolveRegion(c,t?.parentClientConfig?.region,d,{logger:a,profile:A});const g=!isH2(l);i=new n({...t,userAgentAppId:h,profile:A,region:f,requestHandler:g?l:undefined,logger:a})}const{Credentials:A,AssumedRoleUser:c}=await i.send(new AssumeRoleWithWebIdentityCommand(a));if(!A||!A.AccessKeyId||!A.SecretAccessKey){throw new Error(`Invalid response from STS.assumeRoleWithWebIdentity call with role ${a.RoleArn}`)}const l=getAccountIdFromAssumedRoleUser(c);const d={accessKeyId:A.AccessKeyId,secretAccessKey:A.SecretAccessKey,sessionToken:A.SessionToken,expiration:A.Expiration,...A.CredentialScope&&{credentialScope:A.CredentialScope},...l&&{accountId:l}};if(l){y(d,"RESOLVED_ACCOUNT_ID","T")}y(d,"CREDENTIALS_STS_ASSUME_ROLE_WEB_ID","k");return d}};const isH2=t=>t?.metadata?.handlerProtocol==="h2";const getCustomizableStsClientCtor=(t,n)=>{if(!n)return t;else return class CustomizableSTSClient extends t{constructor(t){super(t);for(const t of n){this.middlewareStack.use(t)}}}};const getDefaultRoleAssumer=(t={},n)=>getDefaultRoleAssumer$1(t,getCustomizableStsClientCtor(STSClient,n));const getDefaultRoleAssumerWithWebIdentity=(t={},n)=>getDefaultRoleAssumerWithWebIdentity$1(t,getCustomizableStsClientCtor(STSClient,n));const decorateDefaultCredentialProvider=t=>n=>t({roleAssumer:getDefaultRoleAssumer(n),roleAssumerWithWebIdentity:getDefaultRoleAssumerWithWebIdentity(n),...n});a=is;n.QL=AssumeRoleCommand;a=Dn;a=Tn;a=as;a=AssumeRoleWithSAMLCommand;a=Nn;a=Mn;a=As;a=AssumeRoleWithWebIdentityCommand;a=Fn;a=xn;a=cs;a=AssumeRootCommand;a=Un;a=Pn;a=kn;a=Ln;a=ls;a=DecodeAuthorizationMessageCommand;a=_n;a=On;a=ExpiredTokenException;a=ln;a=ExpiredTradeInTokenException;a=un;a=Hn;a=us;a=GetAccessKeyInfoCommand;a=$n;a=Gn;a=ds;a=GetCallerIdentityCommand;a=Vn;a=Yn;a=hs;a=GetDelegatedAccessTokenCommand;a=Jn;a=Wn;a=fs;a=GetFederationTokenCommand;a=qn;a=jn;a=gs;a=GetSessionTokenCommand;a=zn;a=Kn;a=ps;a=GetWebIdentityTokenCommand;a=Zn;a=Xn;a=IDPCommunicationErrorException;a=dn;a=IDPRejectedClaimException;a=hn;a=InvalidAuthorizationMessageException;a=gn;a=InvalidIdentityTokenException;a=pn;a=JWTPayloadSizeExceededException;a=mn;a=MalformedPolicyDocumentException;a=En;a=OutboundWebIdentityFederationDisabledException;a=Cn;a=PackedPolicyTooLargeException;a=In;a=es;a=ts;a=RegionDisabledException;a=yn;a=STS;n.iM=STSClient;a=STSServiceException;a=An;a=SessionDurationEscalationException;a=Bn;a=rs;a=decorateDefaultCredentialProvider;a=Qn;a=getDefaultRoleAssumer;a=getDefaultRoleAssumerWithWebIdentity},4316:(t,n,i)=>{var a;const{awsEndpointFunctions:A,emitWarningIfUnsupportedVersion:c,createDefaultUserAgentProvider:l,NODE_APP_ID_CONFIG_OPTIONS:d,getAwsRegionExtensionConfiguration:h,resolveAwsRegionExtensionConfiguration:f,resolveUserAgentConfig:g,resolveHostHeaderConfig:p,getUserAgentPlugin:m,getHostHeaderPlugin:E,getLoggerPlugin:C,getRecursionDetectionPlugin:I}=i(5152);const{NODE_ENDPOINT_DISCOVERY_CONFIG_OPTIONS:y,resolveEndpointDiscoveryConfig:B,getEndpointDiscoveryPlugin:Q}=i(3688);const{getHttpAuthSchemeEndpointRuleSetPlugin:w,DefaultIdentityProviderConfig:S,getHttpSigningPlugin:b,createPaginator:R}=i(402);const{normalizeProvider:v,getSmithyContext:k,ServiceException:D,Command:T,NoOpLogger:N,emitWarningIfUnsupportedVersion:M,loadConfigsForDefaultMode:F,getDefaultExtensionConfiguration:x,resolveDefaultRuntimeConfig:U,Client:P,createAggregatedClient:L}=i(2658);a=T;a=P;const{resolveDefaultsModeConfig:O,loadConfig:H,NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS:$,NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS:G,NODE_REGION_CONFIG_OPTIONS:V,NODE_REGION_CONFIG_FILE_OPTIONS:Y,resolveRegionConfig:J}=i(7291);const{getEndpointPlugin:W,BinaryDecisionDiagram:q,EndpointCache:j,decideEndpoint:z,customEndpointFunctions:K,resolveEndpointConfig:Z}=i(2085);const{parseUrl:X,getHttpHandlerExtensionConfiguration:ee,resolveHttpHandlerRuntimeConfig:te,getContentLengthPlugin:re}=i(3422);const{DEFAULT_RETRY_MODE:ne,NODE_RETRY_MODE_CONFIG_OPTIONS:se,NODE_MAX_ATTEMPT_CONFIG_OPTIONS:oe,resolveRetryConfig:ie,getRetryPlugin:ae}=i(3609);const{TypeRegistry:Ae,getSchemaSerdePlugin:ce}=i(6890);const{resolveAwsSdkSigV4Config:le,AwsSdkSigV4Signer:ue,NODE_AUTH_SCHEME_PREFERENCE_OPTIONS:de}=i(7523);const{defaultProvider:he}=i(5861);const{toUtf8:fe,fromUtf8:ge,toBase64:pe,fromBase64:me,calculateBodyLength:Ee}=i(2430);const{streamCollector:Ce,NodeHttpHandler:Ie}=i(1279);const{AwsJson1_0Protocol:ye}=i(7288);const{Sha256:Be}=i(9542);const defaultTimestreamWriteHttpAuthSchemeParametersProvider=async(t,n,i)=>({operation:k(n).operation,region:await v(t.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});function createAwsAuthSigv4HttpAuthOption(t){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"timestream",region:t.region},propertiesExtractor:(t,n)=>({signingProperties:{config:t,context:n}})}}const defaultTimestreamWriteHttpAuthSchemeProvider=t=>{const n=[];switch(t.operation){default:{n.push(createAwsAuthSigv4HttpAuthOption(t))}}return n};const resolveHttpAuthSchemeConfig=t=>{const n=le(t);return Object.assign(n,{authSchemePreference:v(t.authSchemePreference??[])})};const resolveClientEndpointParameters=t=>Object.assign(t,{useDualstackEndpoint:t.useDualstackEndpoint??false,useFipsEndpoint:t.useFipsEndpoint??false,defaultSigningName:"timestream"});const Qe={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}};class TimestreamWriteServiceException extends D{constructor(t){super(t);Object.setPrototypeOf(this,TimestreamWriteServiceException.prototype)}}class AccessDeniedException extends TimestreamWriteServiceException{name="AccessDeniedException";$fault="client";Message;constructor(t){super({name:"AccessDeniedException",$fault:"client",...t});Object.setPrototypeOf(this,AccessDeniedException.prototype);this.Message=t.Message}}class ConflictException extends TimestreamWriteServiceException{name="ConflictException";$fault="client";Message;constructor(t){super({name:"ConflictException",$fault:"client",...t});Object.setPrototypeOf(this,ConflictException.prototype);this.Message=t.Message}}class InternalServerException extends TimestreamWriteServiceException{name="InternalServerException";$fault="server";Message;constructor(t){super({name:"InternalServerException",$fault:"server",...t});Object.setPrototypeOf(this,InternalServerException.prototype);this.Message=t.Message}}class InvalidEndpointException extends TimestreamWriteServiceException{name="InvalidEndpointException";$fault="client";Message;constructor(t){super({name:"InvalidEndpointException",$fault:"client",...t});Object.setPrototypeOf(this,InvalidEndpointException.prototype);this.Message=t.Message}}class ResourceNotFoundException extends TimestreamWriteServiceException{name="ResourceNotFoundException";$fault="client";Message;constructor(t){super({name:"ResourceNotFoundException",$fault:"client",...t});Object.setPrototypeOf(this,ResourceNotFoundException.prototype);this.Message=t.Message}}class ServiceQuotaExceededException extends TimestreamWriteServiceException{name="ServiceQuotaExceededException";$fault="client";Message;constructor(t){super({name:"ServiceQuotaExceededException",$fault:"client",...t});Object.setPrototypeOf(this,ServiceQuotaExceededException.prototype);this.Message=t.Message}}class ThrottlingException extends TimestreamWriteServiceException{name="ThrottlingException";$fault="client";Message;constructor(t){super({name:"ThrottlingException",$fault:"client",...t});Object.setPrototypeOf(this,ThrottlingException.prototype);this.Message=t.Message}}class ValidationException extends TimestreamWriteServiceException{name="ValidationException";$fault="client";Message;constructor(t){super({name:"ValidationException",$fault:"client",...t});Object.setPrototypeOf(this,ValidationException.prototype);this.Message=t.Message}}class RejectedRecordsException extends TimestreamWriteServiceException{name="RejectedRecordsException";$fault="client";Message;RejectedRecords;constructor(t){super({name:"RejectedRecordsException",$fault:"client",...t});Object.setPrototypeOf(this,RejectedRecordsException.prototype);this.Message=t.Message;this.RejectedRecords=t.RejectedRecords}}const we="Arn";const Se="AccessDeniedException";const be="Address";const Re="BatchLoadProgressReport";const ve="BatchLoadTask";const ke="BatchLoadTaskDescription";const De="BatchLoadTaskList";const Te="BatchLoadTasks";const Ne="BytesMetered";const Me="BucketName";const Fe="CommonAttributes";const xe="CreateBatchLoadTask";const Ue="CreateBatchLoadTaskRequest";const Pe="CreateBatchLoadTaskResponse";const Le="CsvConfiguration";const _e="CreateDatabase";const Oe="CreateDatabaseRequest";const He="CreateDatabaseResponse";const $e="ConflictException";const Ge="CachePeriodInMinutes";const Ve="CompositePartitionKey";const Ye="ClientRequestToken";const Je="ColumnSeparator";const We="CreationTime";const qe="CreateTableRequest";const je="CreateTableResponse";const ze="ClientToken";const Ke="CreateTable";const Ze="Database";const Xe="DescribeBatchLoadTask";const et="DescribeBatchLoadTaskRequest";const tt="DescribeBatchLoadTaskResponse";const rt="DestinationColumn";const nt="DeleteDatabase";const st="DeleteDatabaseRequest";const ot="DescribeDatabaseRequest";const it="DescribeDatabaseResponse";const at="DescribeDatabase";const At="DescribeEndpoints";const ct="DescribeEndpointsRequest";const lt="DescribeEndpointsResponse";const ut="DataFormat";const dt="DatabaseList";const ht="DataModel";const ft="DataModelConfiguration";const gt="DataModelS3Configuration";const pt="DimensionMappings";const mt="DimensionMapping";const Et="DatabaseName";const Ct="DataSourceConfiguration";const It="DataSourceS3Configuration";const yt="DeleteTable";const Bt="DeleteTableRequest";const Qt="DescribeTableRequest";const wt="DescribeTableResponse";const St="DescribeTable";const bt="DimensionValueType";const Rt="Databases";const vt="Dimension";const kt="Dimensions";const Dt="Endpoints";const Tt="EscapeChar";const Nt="EnforcementInRecord";const Mt="ErrorMessage";const Ft="EnableMagneticStoreWrites";const xt="EncryptionOption";const Ut="ExistingVersion";const Pt="Endpoint";const Lt="FileFailures";const _t="InvalidEndpointException";const Ot="InternalServerException";const Ht="Key";const $t="KmsKeyId";const Gt="ListBatchLoadTasks";const Vt="ListBatchLoadTasksRequest";const Yt="ListBatchLoadTasksResponse";const Jt="ListDatabases";const Wt="ListDatabasesRequest";const qt="ListDatabasesResponse";const jt="ListTables";const zt="ListTagsForResource";const Kt="ListTagsForResourceRequest";const Zt="ListTagsForResourceResponse";const Xt="ListTablesRequest";const er="ListTablesResponse";const tr="LastUpdatedTime";const rr="Message";const nr="MultiMeasureAttributeMappings";const sr="MultiMeasureAttributeMappingList";const ir="MultiMeasureAttributeMapping";const ar="MultiMeasureMappings";const Ar="MixedMeasureMappingList";const cr="MixedMeasureMappings";const lr="MixedMeasureMapping";const ur="MeasureName";const dr="MeasureNameColumn";const hr="MaxResults";const fr="MemoryStore";const gr="MagneticStoreRejectedDataLocation";const pr="MagneticStoreRetentionPeriodInDays";const mr="MemoryStoreRetentionPeriodInHours";const Er="MagneticStoreWriteProperties";const Cr="MagneticStore";const Ir="MeasureValue";const yr="MeasureValueType";const Br="MeasureValues";const Qr="Name";const wr="NextToken";const Sr="NullValue";const br="ObjectKey";const Rr="ObjectKeyPrefix";const vr="ParseFailures";const kr="PartitionKey";const Dr="PartitionKeyList";const Tr="ProgressReport";const Nr="QuoteChar";const Mr="Record";const Fr="ResourceARN";const xr="ResumeBatchLoadTask";const Ur="ResumeBatchLoadTaskRequest";const Pr="ResumeBatchLoadTaskResponse";const Lr="ReportConfiguration";const _r="RecordsIngested";const Or="RecordIngestionFailures";const Hr="RecordIndex";const $r="ResourceNotFoundException";const Gr="RecordsProcessed";const Vr="RetentionProperties";const Yr="RejectedRecords";const Jr="RejectedRecordsException";const Wr="RejectedRecord";const qr="ReportS3Configuration";const jr="ResumableUntil";const zr="RecordVersion";const Kr="Reason";const Zr="Records";const Xr="Schema";const en="SourceColumn";const tn="S3Configuration";const rn="ServiceQuotaExceededException";const nn="Tags";const sn="TableCount";const on="TimeColumn";const an="TargetDatabaseName";const An="ThrottlingException";const cn="TaskId";const ln="TagKeys";const un="TableList";const dn="TagList";const hn="TargetMultiMeasureAttributeName";const gn="TargetMultiMeasureName";const pn="TargetMeasureName";const mn="TableName";const En="TagResource";const Cn="TagResourceRequest";const In="TagResourceResponse";const yn="TaskStatus";const Bn="TableStatus";const Qn="TargetTableName";const wn="TimeUnit";const Sn="TrimWhiteSpace";const bn="Table";const Rn="Tables";const vn="Tag";const kn="Time";const Dn="Total";const Tn="Type";const Nn="UpdateDatabase";const Mn="UpdateDatabaseRequest";const Fn="UpdateDatabaseResponse";const xn="UntagResource";const Un="UntagResourceRequest";const Pn="UntagResourceResponse";const Ln="UpdateTable";const _n="UpdateTableRequest";const On="UpdateTableResponse";const Hn="Value";const $n="ValidationException";const Gn="Version";const Vn="WriteRecords";const Yn="WriteRecordsRequest";const Jn="WriteRecordsResponse";const Wn="client";const qn="error";const jn="httpError";const zn="smithy.ts.sdk.synthetic.com.amazonaws.timestreamwrite";const Kn="server";const Zn="com.amazonaws.timestreamwrite";const Xn=Ae.for(zn);var es=[-3,zn,"TimestreamWriteServiceException",0,[],[]];Xn.registerError(es,TimestreamWriteServiceException);const ts=Ae.for(Zn);var rs=[-3,Zn,Se,{[qn]:Wn,[jn]:403},[rr],[0],1];ts.registerError(rs,AccessDeniedException);var ns=[-3,Zn,$e,{[qn]:Wn,[jn]:409},[rr],[0],1];ts.registerError(ns,ConflictException);var ss=[-3,Zn,Ot,{[qn]:Kn,[jn]:500},[rr],[0],1];ts.registerError(ss,InternalServerException);var os=[-3,Zn,_t,{[qn]:Wn,[jn]:421},[rr],[0]];ts.registerError(os,InvalidEndpointException);var is=[-3,Zn,Jr,{[qn]:Wn,[jn]:419},[rr,Yr],[0,()=>Po]];ts.registerError(is,RejectedRecordsException);var as=[-3,Zn,$r,{[qn]:Wn,[jn]:404},[rr],[0]];ts.registerError(as,ResourceNotFoundException);var As=[-3,Zn,rn,{[qn]:Wn,[jn]:402},[rr],[0]];ts.registerError(As,ServiceQuotaExceededException);var cs=[-3,Zn,An,{[qn]:Wn,[jn]:429},[rr],[0],1];ts.registerError(cs,ThrottlingException);var ls=[-3,Zn,$n,{[qn]:Wn,[jn]:400},[rr],[0],1];ts.registerError(ls,ValidationException);const us=[Xn,ts];var ds=[0,Zn,Ye,8,0];var hs=[3,Zn,Re,0,[Gr,_r,vr,Or,Lt,Ne],[1,1,1,1,1,1]];var fs=[3,Zn,ve,0,[cn,yn,Et,mn,We,tr,jr],[0,0,0,0,4,4,4]];var gs=[3,Zn,ke,0,[cn,Mt,Ct,Tr,Lr,ft,an,Qn,yn,zr,We,tr,jr],[0,0,()=>Rs,()=>hs,()=>io,()=>Ss,0,0,0,1,4,4,4]];var ps=[3,Zn,Ue,0,[Ct,Lr,an,Qn,ze,ft,zr],[()=>Rs,()=>io,0,0,[()=>ds,4],()=>Ss,1],4];var ms=[3,Zn,Pe,0,[cn],[0],1];var Es=[3,Zn,Oe,0,[Et,$t,nn],[0,0,()=>_o],1];var Cs=[3,Zn,He,0,[Ze],[()=>Qs]];var Is=[3,Zn,qe,0,[Et,mn,Vr,nn,Er,Xr],[0,0,()=>lo,()=>_o,()=>Ks,()=>ho],2];var ys=[3,Zn,je,0,[bn],[()=>fo]];var Bs=[3,Zn,Le,0,[Je,Tt,Nr,Sr,Sn],[0,0,0,0,2]];var Qs=[3,Zn,Ze,0,[we,Et,sn,$t,We,tr],[0,0,1,0,4,4]];var ws=[3,Zn,ht,0,[pt,on,wn,ar,cr,dr],[()=>ko,0,0,()=>to,()=>Mo,0],1];var Ss=[3,Zn,ft,0,[ht,gt],[()=>ws,()=>bs]];var bs=[3,Zn,gt,0,[Me,br],[0,0]];var Rs=[3,Zn,Ct,0,[It,ut,Le],[()=>vs,0,()=>Bs],2];var vs=[3,Zn,It,0,[Me,Rr],[0,0],1];var ks=[3,Zn,st,0,[Et],[0],1];var Ds=[3,Zn,Bt,0,[Et,mn],[0,0],2];var Ts=[3,Zn,et,0,[cn],[0],1];var Ns=[3,Zn,tt,0,[ke],[()=>gs],1];var Ms=[3,Zn,ot,0,[Et],[0],1];var Fs=[3,Zn,it,0,[Ze],[()=>Qs]];var xs=[3,Zn,ct,0,[],[]];var Us=[3,Zn,lt,0,[Dt],[()=>To],1];var Ps=[3,Zn,Qt,0,[Et,mn],[0,0],2];var Ls=[3,Zn,wt,0,[bn],[()=>fo]];var _s=[3,Zn,vt,0,[Qr,Hn,bt],[0,0,0],2];var Os=[3,Zn,mt,0,[en,rt],[0,0]];var Hs=[3,Zn,Pt,0,[be,Ge],[0,1],2];var $s=[3,Zn,Vt,0,[wr,hr,yn],[0,1,0]];var Gs=[3,Zn,Yt,0,[wr,Te],[0,()=>Ro]];var Vs=[3,Zn,Wt,0,[wr,hr],[0,1]];var Ys=[3,Zn,qt,0,[Rt,wr],[()=>vo,0]];var Js=[3,Zn,Xt,0,[Et,wr,hr],[0,0,1]];var Ws=[3,Zn,er,0,[Rn,wr],[()=>Lo,0]];var qs=[3,Zn,Kt,0,[Fr],[0],1];var js=[3,Zn,Zt,0,[nn],[()=>_o]];var zs=[3,Zn,gr,0,[tn],[()=>uo]];var Ks=[3,Zn,Er,0,[Ft,gr],[2,()=>zs],1];var Zs=[3,Zn,Ir,0,[Qr,Hn,Tn],[0,0,0],3];var Xs=[3,Zn,lr,0,[yr,ur,en,pn,nr],[0,0,0,0,()=>Fo],1];var eo=[3,Zn,ir,0,[en,hn,yr],[0,0,0],1];var to=[3,Zn,ar,0,[nr,gn],[()=>Fo,0],1];var ro=[3,Zn,kr,0,[Tn,Qr,Nt],[0,0,0],1];var no=[3,Zn,Mr,0,[kt,ur,Ir,yr,kn,wn,Gn,Br],[()=>Do,0,0,0,0,0,1,()=>No]];var so=[3,Zn,_r,0,[Dn,fr,Cr],[1,1,1]];var oo=[3,Zn,Wr,0,[Hr,Kr,Ut],[1,0,1]];var io=[3,Zn,Lr,0,[qr],[()=>ao]];var ao=[3,Zn,qr,0,[Me,Rr,xt,$t],[0,0,0,0],1];var Ao=[3,Zn,Ur,0,[cn],[0],1];var co=[3,Zn,Pr,0,[],[]];var lo=[3,Zn,Vr,0,[mr,pr],[1,1],2];var uo=[3,Zn,tn,0,[Me,Rr,xt,$t],[0,0,0,0]];var ho=[3,Zn,Xr,0,[Ve],[()=>xo]];var fo=[3,Zn,bn,0,[we,mn,Et,Bn,Vr,We,tr,Er,Xr],[0,0,0,0,()=>lo,4,4,()=>Ks,()=>ho]];var go=[3,Zn,vn,0,[Ht,Hn],[0,0],2];var po=[3,Zn,Cn,0,[Fr,nn],[0,()=>_o],2];var mo=[3,Zn,In,0,[],[]];var Eo=[3,Zn,Un,0,[Fr,ln],[0,64|0],2];var Co=[3,Zn,Pn,0,[],[]];var Io=[3,Zn,Mn,0,[Et,$t],[0,0],2];var yo=[3,Zn,Fn,0,[Ze],[()=>Qs]];var Bo=[3,Zn,_n,0,[Et,mn,Vr,Er,Xr],[0,0,()=>lo,()=>Ks,()=>ho],2];var Qo=[3,Zn,On,0,[bn],[()=>fo]];var wo=[3,Zn,Yn,0,[Et,mn,Zr,Fe],[0,0,()=>Uo,()=>no],3];var So=[3,Zn,Jn,0,[_r],[()=>so]];var bo="unit";var Ro=[1,Zn,De,0,()=>fs];var vo=[1,Zn,dt,0,()=>Qs];var ko=[1,Zn,pt,0,()=>Os];var Do=[1,Zn,kt,0,()=>_s];var To=[1,Zn,Dt,0,()=>Hs];var No=[1,Zn,Br,0,()=>Zs];var Mo=[1,Zn,Ar,0,()=>Xs];var Fo=[1,Zn,sr,0,()=>eo];var xo=[1,Zn,Dr,0,()=>ro];var Uo=[1,Zn,Zr,0,()=>no];var Po=[1,Zn,Yr,0,()=>oo];var Lo=[1,Zn,un,0,()=>fo];var _o=[1,Zn,dn,0,()=>go];var Oo=[9,Zn,xe,0,()=>ps,()=>ms];var Ho=[9,Zn,_e,0,()=>Es,()=>Cs];var $o=[9,Zn,Ke,0,()=>Is,()=>ys];var Go=[9,Zn,nt,0,()=>ks,()=>bo];var Vo=[9,Zn,yt,0,()=>Ds,()=>bo];var Yo=[9,Zn,Xe,0,()=>Ts,()=>Ns];var Jo=[9,Zn,at,0,()=>Ms,()=>Fs];var Wo=[9,Zn,At,0,()=>xs,()=>Us];var qo=[9,Zn,St,0,()=>Ps,()=>Ls];var jo=[9,Zn,Gt,0,()=>$s,()=>Gs];var zo=[9,Zn,Jt,0,()=>Vs,()=>Ys];var Ko=[9,Zn,jt,0,()=>Js,()=>Ws];var Zo=[9,Zn,zt,0,()=>qs,()=>js];var Xo=[9,Zn,xr,0,()=>Ao,()=>co];var ei=[9,Zn,En,0,()=>po,()=>mo];var ti=[9,Zn,xn,0,()=>Eo,()=>Co];var ri=[9,Zn,Nn,0,()=>Io,()=>yo];var ni=[9,Zn,Ln,0,()=>Bo,()=>Qo];var si=[9,Zn,Vn,0,()=>wo,()=>So];class DescribeEndpointsCommand extends(T.classBuilder().ep(Qe).m(function(t,n,i,a){return[W(i,t.getEndpointParameterInstructions())]}).s("Timestream_20181101","DescribeEndpoints",{}).n("TimestreamWriteClient","DescribeEndpointsCommand").sc(Wo).build()){}var oi="3.1076.0";var ii={version:oi};const ai="ref";const Ai=-1,ci=true,li="isSet",ui="PartitionResult",di="booleanEquals",hi="getAttr",fi="stringEquals",gi={[ai]:"Endpoint"},pi={[ai]:ui},mi={fn:hi,argv:[pi,"name"]},Ei={},Ci=[{[ai]:"Region"}];const Ii={conditions:[[li,[gi]],[li,Ci],["aws.partition",Ci,ui],[di,[{[ai]:"UseFIPS"},ci]],[di,[{[ai]:"UseDualStack"},ci]],[di,[{fn:hi,argv:[pi,"supportsFIPS"]},ci]],[di,[{fn:hi,argv:[pi,"supportsDualStack"]},ci]],[fi,[mi,"aws"]],[fi,[mi,"aws-us-gov"]]],results:[[Ai],[Ai,"Invalid Configuration: FIPS and custom endpoint are not supported"],[Ai,"Invalid Configuration: Dualstack and custom endpoint are not supported"],[gi,Ei],["https://timestream-ingest-fips.{Region}.api.aws",Ei],["https://timestream-ingest.{Region}.api.aws",Ei],["https://ingest.timestream-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",Ei],[Ai,"FIPS and DualStack are enabled, but this partition does not support one or both"],["https://ingest.timestream.{Region}.amazonaws.com",Ei],["https://ingest.timestream-fips.{Region}.{PartitionResult#dnsSuffix}",Ei],[Ai,"FIPS is enabled but this partition does not support FIPS"],["https://ingest.timestream.{Region}.{PartitionResult#dualStackDnsSuffix}",Ei],[Ai,"DualStack is enabled but this partition does not support DualStack"],["https://ingest.timestream.{Region}.{PartitionResult#dnsSuffix}",Ei],[Ai,"Invalid Configuration: Missing Region"]]};const yi=2;const Bi=1e8;const Qi=new Int32Array([-1,1,-1,0,17,3,1,4,Bi+14,2,5,Bi+14,3,10,6,4,7,Bi+13,6,8,Bi+12,7,Bi+5,9,8,Bi+5,Bi+11,4,13,11,5,12,Bi+10,8,Bi+8,Bi+9,5,14,Bi+7,6,15,Bi+7,7,Bi+4,16,8,Bi+5,Bi+6,3,Bi+1,18,4,Bi+2,Bi+3]);const wi=q.from(Qi,yi,Ii.conditions,Ii.results);const Si=new j({size:50,params:["Endpoint","Region","UseDualStack","UseFIPS"]});const defaultEndpointResolver=(t,n={})=>Si.get(t,()=>z(wi,{endpointParams:t,logger:n.logger}));K.aws=A;const getRuntimeConfig$1=t=>({apiVersion:"2018-11-01",base64Decoder:t?.base64Decoder??me,base64Encoder:t?.base64Encoder??pe,disableHostPrefix:t?.disableHostPrefix??false,endpointProvider:t?.endpointProvider??defaultEndpointResolver,extensions:t?.extensions??[],httpAuthSchemeProvider:t?.httpAuthSchemeProvider??defaultTimestreamWriteHttpAuthSchemeProvider,httpAuthSchemes:t?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:t=>t.getIdentityProvider("aws.auth#sigv4"),signer:new ue}],logger:t?.logger??new N,protocol:t?.protocol??ye,protocolSettings:t?.protocolSettings??{defaultNamespace:"com.amazonaws.timestreamwrite",errorTypeRegistries:us,version:"2018-11-01",serviceTarget:"Timestream_20181101"},serviceId:t?.serviceId??"Timestream Write",sha256:t?.sha256??Be,urlParser:t?.urlParser??X,utf8Decoder:t?.utf8Decoder??ge,utf8Encoder:t?.utf8Encoder??fe});const getRuntimeConfig=t=>{M(process.version);const n=O(t);const defaultConfigProvider=()=>n().then(F);const i=getRuntimeConfig$1(t);c(process.version);const a={profile:t?.profile,logger:i.logger};return{...i,...t,runtime:"node",defaultsMode:n,authSchemePreference:t?.authSchemePreference??H(de,a),bodyLengthChecker:t?.bodyLengthChecker??Ee,credentialDefaultProvider:t?.credentialDefaultProvider??he,defaultUserAgentProvider:t?.defaultUserAgentProvider??l({serviceId:i.serviceId,clientVersion:ii.version}),endpointDiscoveryEnabledProvider:t?.endpointDiscoveryEnabledProvider??H(y,a),maxAttempts:t?.maxAttempts??H(oe,t),region:t?.region??H(V,{...Y,...a}),requestHandler:Ie.create(t?.requestHandler??defaultConfigProvider),retryMode:t?.retryMode??H({...se,default:async()=>(await defaultConfigProvider()).retryMode||ne},t),streamCollector:t?.streamCollector??Ce,useDualstackEndpoint:t?.useDualstackEndpoint??H(G,a),useFipsEndpoint:t?.useFipsEndpoint??H($,a),userAgentAppId:t?.userAgentAppId??H(d,a)}};const getHttpAuthExtensionConfiguration=t=>{const n=t.httpAuthSchemes;let i=t.httpAuthSchemeProvider;let a=t.credentials;return{setHttpAuthScheme(t){const i=n.findIndex(n=>n.schemeId===t.schemeId);if(i===-1){n.push(t)}else{n.splice(i,1,t)}},httpAuthSchemes(){return n},setHttpAuthSchemeProvider(t){i=t},httpAuthSchemeProvider(){return i},setCredentials(t){a=t},credentials(){return a}}};const resolveHttpAuthRuntimeConfig=t=>({httpAuthSchemes:t.httpAuthSchemes(),httpAuthSchemeProvider:t.httpAuthSchemeProvider(),credentials:t.credentials()});const resolveRuntimeExtensions=(t,n)=>{const i=Object.assign(h(t),x(t),ee(t),getHttpAuthExtensionConfiguration(t));n.forEach(t=>t.configure(i));return Object.assign(t,f(i),U(i),te(i),resolveHttpAuthRuntimeConfig(i))};class TimestreamWriteClient extends P{config;constructor(...[t]){const n=getRuntimeConfig(t||{});super(n);this.initConfig=n;const i=resolveClientEndpointParameters(n);const a=g(i);const A=ie(a);const c=J(A);const l=p(c);const d=Z(l);const h=resolveHttpAuthSchemeConfig(d);const f=B(h,{endpointDiscoveryCommandCtor:DescribeEndpointsCommand});const y=resolveRuntimeExtensions(f,t?.extensions||[]);this.config=y;this.middlewareStack.use(ce(this.config));this.middlewareStack.use(m(this.config));this.middlewareStack.use(ae(this.config));this.middlewareStack.use(re(this.config));this.middlewareStack.use(E(this.config));this.middlewareStack.use(C(this.config));this.middlewareStack.use(I(this.config));this.middlewareStack.use(w(this.config,{httpAuthSchemeParametersProvider:defaultTimestreamWriteHttpAuthSchemeParametersProvider,identityProviderConfigProvider:async t=>new S({"aws.auth#sigv4":t.credentials})}));this.middlewareStack.use(b(this.config))}destroy(){super.destroy()}}class CreateBatchLoadTaskCommand extends(T.classBuilder().ep(Qe).m(function(t,n,i,a){return[W(i,t.getEndpointParameterInstructions()),Q(i,{clientStack:n,isDiscoveredEndpointRequired:true,options:a})]}).s("Timestream_20181101","CreateBatchLoadTask",{}).n("TimestreamWriteClient","CreateBatchLoadTaskCommand").sc(Oo).build()){}class CreateDatabaseCommand extends(T.classBuilder().ep(Qe).m(function(t,n,i,a){return[W(i,t.getEndpointParameterInstructions()),Q(i,{clientStack:n,isDiscoveredEndpointRequired:true,options:a})]}).s("Timestream_20181101","CreateDatabase",{}).n("TimestreamWriteClient","CreateDatabaseCommand").sc(Ho).build()){}class CreateTableCommand extends(T.classBuilder().ep(Qe).m(function(t,n,i,a){return[W(i,t.getEndpointParameterInstructions()),Q(i,{clientStack:n,isDiscoveredEndpointRequired:true,options:a})]}).s("Timestream_20181101","CreateTable",{}).n("TimestreamWriteClient","CreateTableCommand").sc($o).build()){}class DeleteDatabaseCommand extends(T.classBuilder().ep(Qe).m(function(t,n,i,a){return[W(i,t.getEndpointParameterInstructions()),Q(i,{clientStack:n,isDiscoveredEndpointRequired:true,options:a})]}).s("Timestream_20181101","DeleteDatabase",{}).n("TimestreamWriteClient","DeleteDatabaseCommand").sc(Go).build()){}class DeleteTableCommand extends(T.classBuilder().ep(Qe).m(function(t,n,i,a){return[W(i,t.getEndpointParameterInstructions()),Q(i,{clientStack:n,isDiscoveredEndpointRequired:true,options:a})]}).s("Timestream_20181101","DeleteTable",{}).n("TimestreamWriteClient","DeleteTableCommand").sc(Vo).build()){}class DescribeBatchLoadTaskCommand extends(T.classBuilder().ep(Qe).m(function(t,n,i,a){return[W(i,t.getEndpointParameterInstructions()),Q(i,{clientStack:n,isDiscoveredEndpointRequired:true,options:a})]}).s("Timestream_20181101","DescribeBatchLoadTask",{}).n("TimestreamWriteClient","DescribeBatchLoadTaskCommand").sc(Yo).build()){}class DescribeDatabaseCommand extends(T.classBuilder().ep(Qe).m(function(t,n,i,a){return[W(i,t.getEndpointParameterInstructions()),Q(i,{clientStack:n,isDiscoveredEndpointRequired:true,options:a})]}).s("Timestream_20181101","DescribeDatabase",{}).n("TimestreamWriteClient","DescribeDatabaseCommand").sc(Jo).build()){}class DescribeTableCommand extends(T.classBuilder().ep(Qe).m(function(t,n,i,a){return[W(i,t.getEndpointParameterInstructions()),Q(i,{clientStack:n,isDiscoveredEndpointRequired:true,options:a})]}).s("Timestream_20181101","DescribeTable",{}).n("TimestreamWriteClient","DescribeTableCommand").sc(qo).build()){}class ListBatchLoadTasksCommand extends(T.classBuilder().ep(Qe).m(function(t,n,i,a){return[W(i,t.getEndpointParameterInstructions()),Q(i,{clientStack:n,isDiscoveredEndpointRequired:true,options:a})]}).s("Timestream_20181101","ListBatchLoadTasks",{}).n("TimestreamWriteClient","ListBatchLoadTasksCommand").sc(jo).build()){}class ListDatabasesCommand extends(T.classBuilder().ep(Qe).m(function(t,n,i,a){return[W(i,t.getEndpointParameterInstructions()),Q(i,{clientStack:n,isDiscoveredEndpointRequired:true,options:a})]}).s("Timestream_20181101","ListDatabases",{}).n("TimestreamWriteClient","ListDatabasesCommand").sc(zo).build()){}class ListTablesCommand extends(T.classBuilder().ep(Qe).m(function(t,n,i,a){return[W(i,t.getEndpointParameterInstructions()),Q(i,{clientStack:n,isDiscoveredEndpointRequired:true,options:a})]}).s("Timestream_20181101","ListTables",{}).n("TimestreamWriteClient","ListTablesCommand").sc(Ko).build()){}class ListTagsForResourceCommand extends(T.classBuilder().ep(Qe).m(function(t,n,i,a){return[W(i,t.getEndpointParameterInstructions()),Q(i,{clientStack:n,isDiscoveredEndpointRequired:true,options:a})]}).s("Timestream_20181101","ListTagsForResource",{}).n("TimestreamWriteClient","ListTagsForResourceCommand").sc(Zo).build()){}class ResumeBatchLoadTaskCommand extends(T.classBuilder().ep(Qe).m(function(t,n,i,a){return[W(i,t.getEndpointParameterInstructions()),Q(i,{clientStack:n,isDiscoveredEndpointRequired:true,options:a})]}).s("Timestream_20181101","ResumeBatchLoadTask",{}).n("TimestreamWriteClient","ResumeBatchLoadTaskCommand").sc(Xo).build()){}class TagResourceCommand extends(T.classBuilder().ep(Qe).m(function(t,n,i,a){return[W(i,t.getEndpointParameterInstructions()),Q(i,{clientStack:n,isDiscoveredEndpointRequired:true,options:a})]}).s("Timestream_20181101","TagResource",{}).n("TimestreamWriteClient","TagResourceCommand").sc(ei).build()){}class UntagResourceCommand extends(T.classBuilder().ep(Qe).m(function(t,n,i,a){return[W(i,t.getEndpointParameterInstructions()),Q(i,{clientStack:n,isDiscoveredEndpointRequired:true,options:a})]}).s("Timestream_20181101","UntagResource",{}).n("TimestreamWriteClient","UntagResourceCommand").sc(ti).build()){}class UpdateDatabaseCommand extends(T.classBuilder().ep(Qe).m(function(t,n,i,a){return[W(i,t.getEndpointParameterInstructions()),Q(i,{clientStack:n,isDiscoveredEndpointRequired:true,options:a})]}).s("Timestream_20181101","UpdateDatabase",{}).n("TimestreamWriteClient","UpdateDatabaseCommand").sc(ri).build()){}class UpdateTableCommand extends(T.classBuilder().ep(Qe).m(function(t,n,i,a){return[W(i,t.getEndpointParameterInstructions()),Q(i,{clientStack:n,isDiscoveredEndpointRequired:true,options:a})]}).s("Timestream_20181101","UpdateTable",{}).n("TimestreamWriteClient","UpdateTableCommand").sc(ni).build()){}class WriteRecordsCommand extends(T.classBuilder().ep(Qe).m(function(t,n,i,a){return[W(i,t.getEndpointParameterInstructions()),Q(i,{clientStack:n,isDiscoveredEndpointRequired:true,options:a})]}).s("Timestream_20181101","WriteRecords",{}).n("TimestreamWriteClient","WriteRecordsCommand").sc(si).build()){}const bi=R(TimestreamWriteClient,ListBatchLoadTasksCommand,"NextToken","NextToken","MaxResults");const Ri=R(TimestreamWriteClient,ListDatabasesCommand,"NextToken","NextToken","MaxResults");const vi=R(TimestreamWriteClient,ListTablesCommand,"NextToken","NextToken","MaxResults");const ki={CreateBatchLoadTaskCommand:CreateBatchLoadTaskCommand,CreateDatabaseCommand:CreateDatabaseCommand,CreateTableCommand:CreateTableCommand,DeleteDatabaseCommand:DeleteDatabaseCommand,DeleteTableCommand:DeleteTableCommand,DescribeBatchLoadTaskCommand:DescribeBatchLoadTaskCommand,DescribeDatabaseCommand:DescribeDatabaseCommand,DescribeEndpointsCommand:DescribeEndpointsCommand,DescribeTableCommand:DescribeTableCommand,ListBatchLoadTasksCommand:ListBatchLoadTasksCommand,ListDatabasesCommand:ListDatabasesCommand,ListTablesCommand:ListTablesCommand,ListTagsForResourceCommand:ListTagsForResourceCommand,ResumeBatchLoadTaskCommand:ResumeBatchLoadTaskCommand,TagResourceCommand:TagResourceCommand,UntagResourceCommand:UntagResourceCommand,UpdateDatabaseCommand:UpdateDatabaseCommand,UpdateTableCommand:UpdateTableCommand,WriteRecordsCommand:WriteRecordsCommand};const Di={paginateListBatchLoadTasks:bi,paginateListDatabases:Ri,paginateListTables:vi};class TimestreamWrite extends TimestreamWriteClient{}L(ki,TimestreamWrite,{paginators:Di});const Ti={CSV:"CSV"};const Ni={CREATED:"CREATED",FAILED:"FAILED",IN_PROGRESS:"IN_PROGRESS",PENDING_RESUME:"PENDING_RESUME",PROGRESS_STOPPED:"PROGRESS_STOPPED",SUCCEEDED:"SUCCEEDED"};const Mi={BIGINT:"BIGINT",BOOLEAN:"BOOLEAN",DOUBLE:"DOUBLE",MULTI:"MULTI",TIMESTAMP:"TIMESTAMP",VARCHAR:"VARCHAR"};const Fi={BIGINT:"BIGINT",BOOLEAN:"BOOLEAN",DOUBLE:"DOUBLE",TIMESTAMP:"TIMESTAMP",VARCHAR:"VARCHAR"};const xi={MICROSECONDS:"MICROSECONDS",MILLISECONDS:"MILLISECONDS",NANOSECONDS:"NANOSECONDS",SECONDS:"SECONDS"};const Ui={SSE_KMS:"SSE_KMS",SSE_S3:"SSE_S3"};const Pi={OPTIONAL:"OPTIONAL",REQUIRED:"REQUIRED"};const Li={DIMENSION:"DIMENSION",MEASURE:"MEASURE"};const _i={ACTIVE:"ACTIVE",DELETING:"DELETING",RESTORING:"RESTORING"};const Oi={VARCHAR:"VARCHAR"};a=AccessDeniedException;a=rs;a=Ti;a=hs;a=Ni;a=fs;a=gs;a=ConflictException;a=ns;a=Oo;a=CreateBatchLoadTaskCommand;a=ps;a=ms;a=Ho;a=CreateDatabaseCommand;a=Es;a=Cs;a=$o;a=CreateTableCommand;a=Is;a=ys;a=Bs;a=ws;a=Ss;a=bs;a=Rs;a=vs;a=Qs;a=Go;a=DeleteDatabaseCommand;a=ks;a=Vo;a=DeleteTableCommand;a=Ds;a=Yo;a=DescribeBatchLoadTaskCommand;a=Ts;a=Ns;a=Jo;a=DescribeDatabaseCommand;a=Ms;a=Fs;a=Wo;a=DescribeEndpointsCommand;a=xs;a=Us;a=qo;a=DescribeTableCommand;a=Ps;a=Ls;a=_s;a=Os;a=Oi;a=Hs;a=InternalServerException;a=ss;a=InvalidEndpointException;a=os;a=jo;a=ListBatchLoadTasksCommand;a=$s;a=Gs;a=zo;a=ListDatabasesCommand;a=Vs;a=Ys;a=Ko;a=ListTablesCommand;a=Js;a=Ws;a=Zo;a=ListTagsForResourceCommand;a=qs;a=js;a=zs;a=Ks;a=Zs;n.Q3=Mi;a=Xs;a=eo;a=to;a=ro;a=Pi;a=Li;a=so;a=oo;a=RejectedRecordsException;a=is;a=io;a=ao;a=ResourceNotFoundException;a=as;a=Xo;a=ResumeBatchLoadTaskCommand;a=Ao;a=co;a=lo;a=uo;a=Ui;a=Fi;a=ho;a=ServiceQuotaExceededException;a=As;a=fo;a=_i;a=go;a=ei;a=TagResourceCommand;a=po;a=mo;a=ThrottlingException;a=cs;n.yr=xi;a=TimestreamWrite;n.Go=TimestreamWriteClient;a=TimestreamWriteServiceException;a=es;a=ti;a=UntagResourceCommand;a=Eo;a=Co;a=ri;a=UpdateDatabaseCommand;a=Io;a=yo;a=ni;a=UpdateTableCommand;a=Bo;a=Qo;a=ValidationException;a=ls;a=si;n.Nj=WriteRecordsCommand;a=wo;a=So;a=no;a=us;a=bi;a=Ri;a=vi},5152:(t,n,i)=>{const{Retry:a,RETRY_MODES:A}=i(3609);const{HttpRequest:c,parseUrl:l}=i(3422);const{InvokeStore:d}=i(9320);const{normalizeProvider:h}=i(402);const{platform:f,release:g}=i(8161);const{versions:p,env:m}=i(1708);const{booleanSelector:E,SelectorType:C,loadConfig:I,NODE_REGION_CONFIG_OPTIONS:y,NODE_REGION_CONFIG_FILE_OPTIONS:B}=i(7291);const{REGION_ENV_NAME:Q,REGION_INI_NAME:w,resolveRegionConfig:S}=i(7291);n.NODE_REGION_CONFIG_FILE_OPTIONS=B;n.NODE_REGION_CONFIG_OPTIONS=y;n.REGION_ENV_NAME=Q;n.REGION_INI_NAME=w;n.resolveRegionConfig=S;const{readFile:b}=i(1455);const{normalize:R,sep:v,join:k}=i(6760);const{isValidHostLabel:D,isIpAddress:T,customEndpointFunctions:N}=i(2085);const{EndpointError:M,resolveEndpoint:F}=i(2085);n.EndpointError=M;n.isIpAddress=T;n.resolveEndpoint=F;const x={warningEmitted:false};const emitWarningIfUnsupportedVersion=t=>{if(t&&!x.warningEmitted){if(process.env.AWS_SDK_JS_NODE_VERSION_SUPPORT_WARNING_DISABLED==="true"){x.warningEmitted=true;return}const n=parseInt(t.substring(1,t.indexOf(".")));const i=22;if(n=${i}. You are running node ${t}.\n\nTo continue receiving updates to AWS services, bug fixes,\nand security updates please upgrade to node >=${i}.\n\nMore information can be found at: https://a.co/c895JFp`)}}};const longPollMiddleware=()=>(t,n)=>async i=>{n.__retryLongPoll=true;return t(i)};const U={name:"longPollMiddleware",tags:["RETRY"],step:"initialize",override:true};const getLongPollPlugin=t=>({applyToStack:t=>{t.add(longPollMiddleware(),U)}});function setCredentialFeature(t,n,i){if(!t.$source){t.$source={}}t.$source[n]=i;return t}a.v2026||=typeof process==="object"&&process.env?.AWS_NEW_RETRIES_2026==="true";function setFeature(t,n,i){if(!t.__aws_sdk_context){t.__aws_sdk_context={features:{}}}else if(!t.__aws_sdk_context.features){t.__aws_sdk_context.features={}}t.__aws_sdk_context.features[n]=i}function setTokenFeature(t,n,i){if(!t.$source){t.$source={}}t.$source[n]=i;return t}function resolveHostHeaderConfig(t){return t}const hostHeaderMiddleware=t=>n=>async i=>{if(!c.isInstance(i.request))return n(i);const{request:a}=i;const{handlerProtocol:A=""}=t.requestHandler.metadata||{};if(A.indexOf("h2")>=0&&!a.headers[":authority"]){delete a.headers["host"];a.headers[":authority"]=a.hostname+(a.port?":"+a.port:"")}else if(!a.headers["host"]){let t=a.hostname;if(a.port!=null)t+=`:${a.port}`;a.headers["host"]=t}return n(i)};const P={name:"hostHeaderMiddleware",step:"build",priority:"low",tags:["HOST"],override:true};const getHostHeaderPlugin=t=>({applyToStack:n=>{n.add(hostHeaderMiddleware(t),P)}});const loggerMiddleware=()=>(t,n)=>async i=>{try{const a=await t(i);const{clientName:A,commandName:c,logger:l,dynamoDbDocumentClientOptions:d={}}=n;const{overrideInputFilterSensitiveLog:h,overrideOutputFilterSensitiveLog:f}=d;const g=h??n.inputFilterSensitiveLog;const p=f??n.outputFilterSensitiveLog;const{$metadata:m,...E}=a.output;l?.info?.({clientName:A,commandName:c,input:g(i.input),output:p(E),metadata:m});return a}catch(t){const{clientName:a,commandName:A,logger:c,dynamoDbDocumentClientOptions:l={}}=n;const{overrideInputFilterSensitiveLog:d}=l;const h=d??n.inputFilterSensitiveLog;c?.error?.({clientName:a,commandName:A,input:h(i.input),error:t,metadata:t.$metadata});throw t}};const L={name:"loggerMiddleware",tags:["LOGGER"],step:"initialize",override:true};const getLoggerPlugin=t=>({applyToStack:t=>{t.add(loggerMiddleware(),L)}});const O={step:"build",tags:["RECURSION_DETECTION"],name:"recursionDetectionMiddleware",override:true,priority:"low"};const H="X-Amzn-Trace-Id";const $="AWS_LAMBDA_FUNCTION_NAME";const G="_X_AMZN_TRACE_ID";const recursionDetectionMiddleware=()=>t=>async n=>{const{request:i}=n;if(!c.isInstance(i)){return t(n)}const a=Object.keys(i.headers??{}).find(t=>t.toLowerCase()===H.toLowerCase())??H;if(i.headers.hasOwnProperty(a)){return t(n)}const A=process.env[$];const l=process.env[G];const h=await d.getInstanceAsync();const f=h?.getXRayTraceId();const g=f??l;const nonEmptyString=t=>typeof t==="string"&&t.length>0;if(nonEmptyString(A)&&nonEmptyString(g)){i.headers[H]=g}return t({...n,request:i})};const getRecursionDetectionPlugin=t=>({applyToStack:t=>{t.add(recursionDetectionMiddleware(),O)}});const V=undefined;function isValidUserAgentAppId(t){if(t===undefined){return true}return typeof t==="string"&&t.length<=50}function resolveUserAgentConfig(t){const n=h(t.userAgentAppId??V);const{customUserAgent:i}=t;return Object.assign(t,{customUserAgent:typeof i==="string"?[[i]]:i,userAgentAppId:async()=>{const i=await n();if(!isValidUserAgentAppId(i)){const n=t.logger?.constructor?.name==="NoOpLogger"||!t.logger?console:t.logger;if(typeof i!=="string"){n?.warn("userAgentAppId must be a string or undefined.")}else if(i.length>50){n?.warn("The provided userAgentAppId exceeds the maximum length of 50 characters.")}}return i}})}const Y={partitions:[{id:"aws",outputs:{dnsSuffix:"amazonaws.com",dualStackDnsSuffix:"api.aws",implicitGlobalRegion:"us-east-1",name:"aws",supportsDualStack:true,supportsFIPS:true},regionRegex:"^(us|eu|ap|sa|ca|me|af|il|mx)\\-\\w+\\-\\d+$",regions:{"af-south-1":{description:"Africa (Cape Town)"},"ap-east-1":{description:"Asia Pacific (Hong Kong)"},"ap-east-2":{description:"Asia Pacific (Taipei)"},"ap-northeast-1":{description:"Asia Pacific (Tokyo)"},"ap-northeast-2":{description:"Asia Pacific (Seoul)"},"ap-northeast-3":{description:"Asia Pacific (Osaka)"},"ap-south-1":{description:"Asia Pacific (Mumbai)"},"ap-south-2":{description:"Asia Pacific (Hyderabad)"},"ap-southeast-1":{description:"Asia Pacific (Singapore)"},"ap-southeast-2":{description:"Asia Pacific (Sydney)"},"ap-southeast-3":{description:"Asia Pacific (Jakarta)"},"ap-southeast-4":{description:"Asia Pacific (Melbourne)"},"ap-southeast-5":{description:"Asia Pacific (Malaysia)"},"ap-southeast-6":{description:"Asia Pacific (New Zealand)"},"ap-southeast-7":{description:"Asia Pacific (Thailand)"},"aws-global":{description:"aws global region"},"ca-central-1":{description:"Canada (Central)"},"ca-west-1":{description:"Canada West (Calgary)"},"eu-central-1":{description:"Europe (Frankfurt)"},"eu-central-2":{description:"Europe (Zurich)"},"eu-north-1":{description:"Europe (Stockholm)"},"eu-south-1":{description:"Europe (Milan)"},"eu-south-2":{description:"Europe (Spain)"},"eu-west-1":{description:"Europe (Ireland)"},"eu-west-2":{description:"Europe (London)"},"eu-west-3":{description:"Europe (Paris)"},"il-central-1":{description:"Israel (Tel Aviv)"},"me-central-1":{description:"Middle East (UAE)"},"me-south-1":{description:"Middle East (Bahrain)"},"mx-central-1":{description:"Mexico (Central)"},"sa-east-1":{description:"South America (Sao Paulo)"},"us-east-1":{description:"US East (N. Virginia)"},"us-east-2":{description:"US East (Ohio)"},"us-west-1":{description:"US West (N. California)"},"us-west-2":{description:"US West (Oregon)"}}},{id:"aws-cn",outputs:{dnsSuffix:"amazonaws.com.cn",dualStackDnsSuffix:"api.amazonwebservices.com.cn",implicitGlobalRegion:"cn-northwest-1",name:"aws-cn",supportsDualStack:true,supportsFIPS:true},regionRegex:"^cn\\-\\w+\\-\\d+$",regions:{"aws-cn-global":{description:"aws-cn global region"},"cn-north-1":{description:"China (Beijing)"},"cn-northwest-1":{description:"China (Ningxia)"}}},{id:"aws-eusc",outputs:{dnsSuffix:"amazonaws.eu",dualStackDnsSuffix:"api.amazonwebservices.eu",implicitGlobalRegion:"eusc-de-east-1",name:"aws-eusc",supportsDualStack:true,supportsFIPS:true},regionRegex:"^eusc\\-(de)\\-\\w+\\-\\d+$",regions:{"eusc-de-east-1":{description:"AWS European Sovereign Cloud (Germany)"}}},{id:"aws-iso",outputs:{dnsSuffix:"c2s.ic.gov",dualStackDnsSuffix:"api.aws.ic.gov",implicitGlobalRegion:"us-iso-east-1",name:"aws-iso",supportsDualStack:true,supportsFIPS:true},regionRegex:"^us\\-iso\\-\\w+\\-\\d+$",regions:{"aws-iso-global":{description:"aws-iso global region"},"us-iso-east-1":{description:"US ISO East"},"us-iso-west-1":{description:"US ISO WEST"}}},{id:"aws-iso-b",outputs:{dnsSuffix:"sc2s.sgov.gov",dualStackDnsSuffix:"api.aws.scloud",implicitGlobalRegion:"us-isob-east-1",name:"aws-iso-b",supportsDualStack:true,supportsFIPS:true},regionRegex:"^us\\-isob\\-\\w+\\-\\d+$",regions:{"aws-iso-b-global":{description:"aws-iso-b global region"},"us-isob-east-1":{description:"US ISOB East (Ohio)"},"us-isob-west-1":{description:"US ISOB West"}}},{id:"aws-iso-e",outputs:{dnsSuffix:"cloud.adc-e.uk",dualStackDnsSuffix:"api.cloud-aws.adc-e.uk",implicitGlobalRegion:"eu-isoe-west-1",name:"aws-iso-e",supportsDualStack:true,supportsFIPS:true},regionRegex:"^eu\\-isoe\\-\\w+\\-\\d+$",regions:{"aws-iso-e-global":{description:"aws-iso-e global region"},"eu-isoe-west-1":{description:"EU ISOE West"}}},{id:"aws-iso-f",outputs:{dnsSuffix:"csp.hci.ic.gov",dualStackDnsSuffix:"api.aws.hci.ic.gov",implicitGlobalRegion:"us-isof-south-1",name:"aws-iso-f",supportsDualStack:true,supportsFIPS:true},regionRegex:"^us\\-isof\\-\\w+\\-\\d+$",regions:{"aws-iso-f-global":{description:"aws-iso-f global region"},"us-isof-east-1":{description:"US ISOF EAST"},"us-isof-south-1":{description:"US ISOF SOUTH"}}},{id:"aws-us-gov",outputs:{dnsSuffix:"amazonaws.com",dualStackDnsSuffix:"api.aws",implicitGlobalRegion:"us-gov-west-1",name:"aws-us-gov",supportsDualStack:true,supportsFIPS:true},regionRegex:"^us\\-gov\\-\\w+\\-\\d+$",regions:{"aws-us-gov-global":{description:"aws-us-gov global region"},"us-gov-east-1":{description:"AWS GovCloud (US-East)"},"us-gov-west-1":{description:"AWS GovCloud (US-West)"}}}],version:"1.1"};let J=Y;let W="";const partition=t=>{const{partitions:n}=J;for(const i of n){const{regions:n,outputs:a}=i;for(const[i,A]of Object.entries(n)){if(i===t){return{...a,...A}}}}for(const i of n){const{regionRegex:n,outputs:a}=i;if(new RegExp(n).test(t)){return{...a}}}const i=n.find(t=>t.id==="aws");if(!i){throw new Error("Provided region was not found in the partition array or regex,"+" and default partition with id 'aws' doesn't exist.")}return{...i.outputs}};const setPartitionInfo=(t,n="")=>{J=t;W=n};const useDefaultPartitionInfo=()=>{setPartitionInfo(Y,"")};const getUserAgentPrefix=()=>W;const q=/\d{12}\.ddb/;async function checkFeatures(t,n,i){const a=i.request;if(a?.headers?.["smithy-protocol"]==="rpc-v2-cbor"){setFeature(t,"PROTOCOL_RPC_V2_CBOR","M")}if(typeof n.retryStrategy==="function"){const i=await n.retryStrategy();if(typeof i.mode==="string"){switch(i.mode){case A.ADAPTIVE:setFeature(t,"RETRY_MODE_ADAPTIVE","F");break;case A.STANDARD:setFeature(t,"RETRY_MODE_STANDARD","E");break}}}if(typeof n.accountIdEndpointMode==="function"){const i=t.endpointV2;if(String(i?.url?.hostname).match(q)){setFeature(t,"ACCOUNT_ID_ENDPOINT","O")}switch(await(n.accountIdEndpointMode?.())){case"disabled":setFeature(t,"ACCOUNT_ID_MODE_DISABLED","Q");break;case"preferred":setFeature(t,"ACCOUNT_ID_MODE_PREFERRED","P");break;case"required":setFeature(t,"ACCOUNT_ID_MODE_REQUIRED","R");break}}const c=t.__smithy_context?.selectedHttpAuthScheme?.identity;if(c?.$source){const n=c;if(n.accountId){setFeature(t,"RESOLVED_ACCOUNT_ID","T")}for(const[i,a]of Object.entries(n.$source??{})){setFeature(t,i,a)}}}const j="user-agent";const z="x-amz-user-agent";const K=" ";const Z="/";const X=/[^!$%&'*+\-.^_`|~\w]/g;const ee=/[^!$%&'*+\-.^_`|~\w#]/g;const te="-";const re=1024;function encodeFeatures(t){let n="";for(const i in t){const a=t[i];if(n.length+a.length+1<=re){if(n.length){n+=","+a}else{n+=a}continue}break}return n}const userAgentMiddleware=t=>(n,i)=>async a=>{const{request:A}=a;if(!c.isInstance(A)){return n(a)}const{headers:l}=A;const d=i?.userAgent?.map(escapeUserAgent)||[];const h=(await t.defaultUserAgentProvider()).map(escapeUserAgent);await checkFeatures(i,t,a);const f=i;h.push(`m/${encodeFeatures(Object.assign({},i.__smithy_context?.features,f.__aws_sdk_context?.features))}`);const g=t?.customUserAgent?.map(escapeUserAgent)||[];const p=await t.userAgentAppId();if(p){h.push(escapeUserAgent([`app`,`${p}`]))}const m=getUserAgentPrefix();const E=(m?[m]:[]).concat([...h,...d,...g]).join(K);const C=[...h.filter(t=>t.startsWith("aws-sdk-")),...g].join(K);if(t.runtime!=="browser"){if(C){l[z]=l[z]?`${l[j]} ${C}`:C}l[j]=E}else{l[z]=E}return n({...a,request:A})};const escapeUserAgent=t=>{const n=t[0].split(Z).map(t=>t.replace(X,te)).join(Z);const i=t[1]?.replace(ee,te);const a=n.indexOf(Z);const A=n.substring(0,a);let c=n.substring(a+1);if(A==="api"){c=c.toLowerCase()}return[A,c,i].filter(t=>t&&t.length>0).reduce((t,n,i)=>{switch(i){case 0:return n;case 1:return`${t}/${n}`;default:return`${t}#${n}`}},"")};const ne={name:"getUserAgentMiddleware",step:"build",priority:"low",tags:["SET_USER_AGENT","USER_AGENT"],override:true};const getUserAgentPlugin=t=>({applyToStack:n=>{n.add(userAgentMiddleware(t),ne)}});const getRuntimeUserAgentPair=()=>{const t=["deno","bun","llrt"];for(const n of t){if(p[n]){return[`md/${n}`,p[n]]}}return["md/nodejs",p.node]};const getNodeModulesParentDirs=t=>{const n=process.cwd();if(!t){return[n]}const i=R(t);const a=i.split(v);const A=a.indexOf("node_modules");const c=A!==-1?a.slice(0,A).join(v):i;if(n===c){return[n]}return[c,n]};const se=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*)?$/;const getSanitizedTypeScriptVersion=(t="")=>{const n=t.match(se);if(!n){return undefined}const[i,a,A,c]=[n[1],n[2],n[3],n[4]];return c?`${i}.${a}.${A}-${c}`:`${i}.${a}.${A}`};const oe=["^","~",">=","<=",">","<"];const ie=["latest","beta","dev","rc","insiders","next"];const getSanitizedDevTypeScriptVersion=(t="")=>{if(ie.includes(t)){return t}const n=oe.find(n=>t.startsWith(n))??"";const i=getSanitizedTypeScriptVersion(t.slice(n.length));if(!i){return undefined}return`${n}${i}`};let ae;const Ae=k("node_modules","typescript","package.json");const getTypeScriptUserAgentPair=async()=>{if(ae===null){return undefined}else if(typeof ae==="string"){return["md/tsc",ae]}let t=false;try{t=E(process.env,"AWS_SDK_JS_TYPESCRIPT_DETECTION_DISABLED",C.ENV)||false}catch{}if(t){ae=null;return undefined}const n=typeof __dirname!=="undefined"?__dirname:undefined;const i=getNodeModulesParentDirs(n);let a;for(const t of i){try{const n=k(t,"package.json");const i=await b(n,"utf-8");const{dependencies:A,devDependencies:c}=JSON.parse(i);const l=c?.typescript??A?.typescript;if(typeof l!=="string"){continue}a=l;break}catch{}}if(!a){ae=null;return undefined}let A;for(const t of i){try{const n=k(t,Ae);const i=await b(n,"utf-8");const{version:a}=JSON.parse(i);const c=getSanitizedTypeScriptVersion(a);if(typeof c!=="string"){continue}A=c;break}catch{}}if(A){ae=A;return["md/tsc",ae]}const c=getSanitizedDevTypeScriptVersion(a);if(typeof c!=="string"){ae=null;return undefined}ae=`dev_${c}`;return["md/tsc",ae]};const ce={isCrtAvailable:false};const isCrtAvailable=()=>{if(ce.isCrtAvailable){return["md/crt-avail"]}return null};const createDefaultUserAgentProvider=({serviceId:t,clientVersion:n})=>{const i=getRuntimeUserAgentPair();return async a=>{const A=[["aws-sdk-js",n],["ua","2.1"],[`os/${f()}`,g()],["lang/js"],i];const c=await getTypeScriptUserAgentPair();if(c){A.push(c)}const l=isCrtAvailable();if(l){A.push(l)}if(t){A.push([`api/${t}`,n])}if(m.AWS_EXECUTION_ENV){A.push([`exec-env/${m.AWS_EXECUTION_ENV}`])}const d=await(a?.userAgentAppId?.());const h=d?[...A,[`app/${d}`]]:[...A];return h}};const le=createDefaultUserAgentProvider;const ue="AWS_SDK_UA_APP_ID";const de="sdk_ua_app_id";const he="sdk-ua-app-id";const fe={environmentVariableSelector:t=>t[ue],configFileSelector:t=>t[de]??t[he],default:V};const createUserAgentStringParsingProvider=({serviceId:t,clientVersion:n})=>async a=>{const A=i(9449);const c=A.parse??A.default.parse??(()=>"");const l=typeof window!=="undefined"&&window?.navigator?.userAgent?c(window.navigator.userAgent):undefined;const d=[["aws-sdk-js",n],["ua","2.1"],[`os/${l?.os?.name||"other"}`,l?.os?.version],["lang/js"],["md/browser",`${l?.browser?.name??"unknown"}_${l?.browser?.version??"unknown"}`]];if(t){d.push([`api/${t}`,n])}const h=await(a?.userAgentAppId?.());if(h){d.push([`app/${h}`])}return d};const ge={os(t){if(/iPhone|iPad|iPod/.test(t))return"iOS";if(/Macintosh|Mac OS X/.test(t))return"macOS";if(/Windows NT/.test(t))return"Windows";if(/Android/.test(t))return"Android";if(/Linux/.test(t))return"Linux";return undefined},browser(t){if(/EdgiOS|EdgA|Edg\//.test(t))return"Microsoft Edge";if(/Firefox\//.test(t))return"Firefox";if(/Chrome\//.test(t))return"Chrome";if(/Safari\//.test(t))return"Safari";return undefined}};const isVirtualHostableS3Bucket=(t,n=false)=>{if(n){for(const n of t.split(".")){if(!isVirtualHostableS3Bucket(n)){return false}}return true}if(!D(t)){return false}if(t.length<3||t.length>63){return false}if(t!==t.toLowerCase()){return false}if(T(t)){return false}return true};const pe=":";const me="/";const parseArn=t=>{const n=t.split(pe);if(n.length<6)return null;const[i,a,A,c,l,...d]=n;if(i!=="arn"||a===""||A===""||d.join(pe)==="")return null;const h=d.map(t=>t.split(me)).flat();return{partition:a,service:A,region:c,accountId:l,resourceId:h}};const Ee={isVirtualHostableS3Bucket:isVirtualHostableS3Bucket,parseArn:parseArn,partition:partition};N.aws=Ee;const resolveDefaultAwsRegionalEndpointsConfig=t=>{if(typeof t.endpointProvider!=="function"){throw new Error("@aws-sdk/util-endpoint - endpointProvider and endpoint missing in config for this client.")}const{endpoint:n}=t;if(n===undefined){t.endpoint=async()=>toEndpointV1(t.endpointProvider({Region:typeof t.region==="function"?await t.region():t.region,UseDualStack:typeof t.useDualstackEndpoint==="function"?await t.useDualstackEndpoint():t.useDualstackEndpoint,UseFIPS:typeof t.useFipsEndpoint==="function"?await t.useFipsEndpoint():t.useFipsEndpoint,Endpoint:undefined},{logger:t.logger}))}return t};const toEndpointV1=t=>l(t.url);function stsRegionDefaultResolver(t={}){return I({...y,async default(){if(!Ce.silence){console.warn("@aws-sdk - WARN - default STS region of us-east-1 used. See @aws-sdk/credential-providers README and set a region explicitly.")}return"us-east-1"}},{...B,...t})}const Ce={silence:false};const getAwsRegionExtensionConfiguration=t=>({setRegion(n){t.region=n},region(){return t.region}});const resolveAwsRegionExtensionConfiguration=t=>({region:t.region()});n.DEFAULT_UA_APP_ID=V;n.NODE_APP_ID_CONFIG_OPTIONS=fe;n.UA_APP_ID_ENV_NAME=ue;n.UA_APP_ID_INI_NAME=de;n.awsEndpointFunctions=Ee;n.createDefaultUserAgentProvider=createDefaultUserAgentProvider;n.createUserAgentStringParsingProvider=createUserAgentStringParsingProvider;n.crtAvailability=ce;n.defaultUserAgent=le;n.emitWarningIfUnsupportedVersion=emitWarningIfUnsupportedVersion;n.fallback=ge;n.getAwsRegionExtensionConfiguration=getAwsRegionExtensionConfiguration;n.getHostHeaderPlugin=getHostHeaderPlugin;n.getLoggerPlugin=getLoggerPlugin;n.getLongPollPlugin=getLongPollPlugin;n.getRecursionDetectionPlugin=getRecursionDetectionPlugin;n.getUserAgentMiddlewareOptions=ne;n.getUserAgentPlugin=getUserAgentPlugin;n.getUserAgentPrefix=getUserAgentPrefix;n.hostHeaderMiddleware=hostHeaderMiddleware;n.hostHeaderMiddlewareOptions=P;n.isVirtualHostableS3Bucket=isVirtualHostableS3Bucket;n.loggerMiddleware=loggerMiddleware;n.loggerMiddlewareOptions=L;n.parseArn=parseArn;n.partition=partition;n.recursionDetectionMiddleware=recursionDetectionMiddleware;n.recursionDetectionMiddlewareOptions=O;n.resolveAwsRegionExtensionConfiguration=resolveAwsRegionExtensionConfiguration;n.resolveDefaultAwsRegionalEndpointsConfig=resolveDefaultAwsRegionalEndpointsConfig;n.resolveHostHeaderConfig=resolveHostHeaderConfig;n.resolveUserAgentConfig=resolveUserAgentConfig;n.setCredentialFeature=setCredentialFeature;n.setFeature=setFeature;n.setPartitionInfo=setPartitionInfo;n.setTokenFeature=setTokenFeature;n.state=x;n.stsRegionDefaultResolver=stsRegionDefaultResolver;n.stsRegionWarning=Ce;n.toEndpointV1=toEndpointV1;n.useDefaultPartitionInfo=useDefaultPartitionInfo;n.userAgentMiddleware=userAgentMiddleware},7523:(t,n,i)=>{const{HttpResponse:a,HttpRequest:A}=i(3422);const{normalizeProvider:c,memoizeIdentityProvider:l,isIdentityExpired:d,doesIdentityRequireRefresh:h}=i(402);const{ProviderError:f}=i(7291);const{setCredentialFeature:g}=i(5152);const{SignatureV4:p}=i(5118);const getDateHeader=t=>a.isInstance(t)?t.headers?.date??t.headers?.Date:undefined;const getSkewCorrectedDate=t=>new Date(Date.now()+t);const isClockSkewed=(t,n)=>Math.abs(getSkewCorrectedDate(n).getTime()-t)>=3e5;const getUpdatedSystemClockOffset=(t,n)=>{const i=Date.parse(t);if(isClockSkewed(i,n)){return i-Date.now()}return n};const throwSigningPropertyError=(t,n)=>{if(!n){throw new Error(`Property \`${t}\` is not resolved for AWS SDK SigV4Auth`)}return n};const validateSigningProperties=async t=>{const n=throwSigningPropertyError("context",t.context);const i=throwSigningPropertyError("config",t.config);const a=n.endpointV2?.properties?.authSchemes?.[0];const A=throwSigningPropertyError("signer",i.signer);const c=await A(a);const l=t?.signingRegion;const d=t?.signingRegionSet;const h=t?.signingName;return{config:i,signer:c,signingRegion:l,signingRegionSet:d,signingName:h}};class AwsSdkSigV4Signer{async sign(t,n,i){if(!A.isInstance(t)){throw new Error("The request is not an instance of `HttpRequest` and cannot be signed")}const a=await validateSigningProperties(i);const{config:c,signer:l}=a;let{signingRegion:d,signingName:h}=a;const f=i.context;if(f?.authSchemes?.length??0>1){const[t,n]=f.authSchemes;if(t?.name==="sigv4a"&&n?.name==="sigv4"){d=n?.signingRegion??d;h=n?.signingName??h}}i._preRequestSystemClockOffset=c.systemClockOffset;const g=await l.sign(t,{signingDate:getSkewCorrectedDate(c.systemClockOffset),signingRegion:d,signingService:h});return g}errorHandler(t){return n=>{const i=n;const a=i.ServerTime??getDateHeader(i.$response);if(a){const n=throwSigningPropertyError("config",t.config);const A=t._preRequestSystemClockOffset;const c=getUpdatedSystemClockOffset(a,n.systemClockOffset);const l=c!==n.systemClockOffset;const d=A!==undefined&&A!==c;const h=l||d;if(h&&i.$metadata){n.systemClockOffset=c;i.$metadata.clockSkewCorrected=true}}throw n}}successHandler(t,n){const i=getDateHeader(t);if(i){const t=throwSigningPropertyError("config",n.config);t.systemClockOffset=getUpdatedSystemClockOffset(i,t.systemClockOffset)}}}const m=AwsSdkSigV4Signer;class AwsSdkSigV4ASigner extends AwsSdkSigV4Signer{async sign(t,n,i){if(!A.isInstance(t)){throw new Error("The request is not an instance of `HttpRequest` and cannot be signed")}const{config:a,signer:c,signingRegion:l,signingRegionSet:d,signingName:h}=await validateSigningProperties(i);const f=await(a.sigv4aSigningRegionSet?.());const g=(f??d??[l]).join(",");i._preRequestSystemClockOffset=a.systemClockOffset;const p=await c.sign(t,{signingDate:getSkewCorrectedDate(a.systemClockOffset),signingRegion:g,signingService:h});return p}}const getArrayForCommaSeparatedString=t=>typeof t==="string"&&t.length>0?t.split(",").map(t=>t.trim()):[];const getBearerTokenEnvKey=t=>`AWS_BEARER_TOKEN_${t.replace(/[\s-]/g,"_").toUpperCase()}`;const E="AWS_AUTH_SCHEME_PREFERENCE";const C="auth_scheme_preference";const I={environmentVariableSelector:(t,n)=>{if(n?.signingName){const i=getBearerTokenEnvKey(n.signingName);if(i in t)return["httpBearerAuth"]}if(!(E in t))return undefined;return getArrayForCommaSeparatedString(t[E])},configFileSelector:t=>{if(!(C in t))return undefined;return getArrayForCommaSeparatedString(t[C])},default:[]};const resolveAwsSdkSigV4AConfig=t=>{t.sigv4aSigningRegionSet=c(t.sigv4aSigningRegionSet);return t};const y={environmentVariableSelector(t){if(t.AWS_SIGV4A_SIGNING_REGION_SET){return t.AWS_SIGV4A_SIGNING_REGION_SET.split(",").map(t=>t.trim())}throw new f("AWS_SIGV4A_SIGNING_REGION_SET not set in env.",{tryNextLink:true})},configFileSelector(t){if(t.sigv4a_signing_region_set){return(t.sigv4a_signing_region_set??"").split(",").map(t=>t.trim())}throw new f("sigv4a_signing_region_set not set in profile.",{tryNextLink:true})},default:undefined};const resolveAwsSdkSigV4Config=t=>{let n=t.credentials;let i=!!t.credentials;let a=undefined;Object.defineProperty(t,"credentials",{set(A){if(A&&A!==n&&A!==a){i=true}n=A;const c=normalizeCredentialProvider(t,{credentials:n,credentialDefaultProvider:t.credentialDefaultProvider});const l=bindCallerConfig(t,c);if(i&&!l.attributed){const t=typeof n==="object"&&n!==null;a=async n=>{const i=await l(n);const a=i;if(t&&(!a.$source||Object.keys(a.$source).length===0)){return g(a,"CREDENTIALS_CODE","e")}return a};a.memoized=l.memoized;a.configBound=l.configBound;a.attributed=true}else{a=l}},get(){return a},enumerable:true,configurable:true});t.credentials=n;const{signingEscapePath:A=true,systemClockOffset:l=t.systemClockOffset||0,sha256:d}=t;let h;if(t.signer){h=c(t.signer)}else if(t.regionInfoProvider){h=()=>c(t.region)().then(async n=>[await t.regionInfoProvider(n,{useFipsEndpoint:await t.useFipsEndpoint(),useDualstackEndpoint:await t.useDualstackEndpoint()})||{},n]).then(([n,i])=>{const{signingRegion:a,signingService:c}=n;t.signingRegion=t.signingRegion||a||i;t.signingName=t.signingName||c||t.serviceId;const l={...t,credentials:t.credentials,region:t.signingRegion,service:t.signingName,sha256:d,uriEscapePath:A};const h=t.signerConstructor||p;return new h(l)})}else{h=async n=>{n=Object.assign({},{name:"sigv4",signingName:t.signingName||t.defaultSigningName,signingRegion:await c(t.region)(),properties:{}},n);const i=n.signingRegion;const a=n.signingName;t.signingRegion=t.signingRegion||i;t.signingName=t.signingName||a||t.serviceId;const l={...t,credentials:t.credentials,region:t.signingRegion,service:t.signingName,sha256:d,uriEscapePath:A};const h=t.signerConstructor||p;return new h(l)}}const f=Object.assign(t,{systemClockOffset:l,signingEscapePath:A,signer:h});return f};const B=resolveAwsSdkSigV4Config;function normalizeCredentialProvider(t,{credentials:n,credentialDefaultProvider:i}){let a;if(n){if(!n?.memoized){a=l(n,d,h)}else{a=n}}else{if(i){a=c(i(Object.assign({},t,{parentClientConfig:t})))}else{a=async()=>{throw new Error("@aws-sdk/core::resolveAwsSdkSigV4Config - `credentials` not provided and no credentialDefaultProvider was configured.")}}}a.memoized=true;return a}function bindCallerConfig(t,n){if(n.configBound){return n}const fn=async i=>n({...i,callerClientConfig:t});fn.memoized=n.memoized;fn.configBound=true;return fn}n.AWSSDKSigV4Signer=m;n.AwsSdkSigV4ASigner=AwsSdkSigV4ASigner;n.AwsSdkSigV4Signer=AwsSdkSigV4Signer;n.NODE_AUTH_SCHEME_PREFERENCE_OPTIONS=I;n.NODE_SIGV4A_CONFIG_OPTIONS=y;n.getBearerTokenEnvKey=getBearerTokenEnvKey;n.resolveAWSSDKSigV4Config=B;n.resolveAwsSdkSigV4AConfig=resolveAwsSdkSigV4AConfig;n.resolveAwsSdkSigV4Config=resolveAwsSdkSigV4Config;n.validateSigningProperties=validateSigningProperties},7288:(t,n,i)=>{const{SmithyRpcV2CborProtocol:a,loadSmithyRpcV2CborErrorCode:A}=i(4645);const{TypeRegistry:c,NormalizedSchema:l,deref:d}=i(6890);const{decorateServiceException:h,getValueFromTextNode:f}=i(2658);const{collectBody:g,determineTimestampFormat:p,RpcProtocol:m,HttpBindingProtocol:E,HttpInterceptingShapeSerializer:C,HttpInterceptingShapeDeserializer:I,FromStringShapeDeserializer:y,extendedEncodeURIComponent:B}=i(3422);const{NumericValue:Q,toUtf8:w,fromBase64:S,LazyJsonString:b,parseEpochTimestamp:R,parseRfc7231DateTime:v,parseRfc3339DateTimeWithOffset:k,toBase64:D,dateToUtcString:T,generateIdempotencyToken:N,expectUnion:M}=i(2430);const{parseXML:F,XmlNode:x,XmlText:U}=i(4274);class ProtocolLib{queryCompat;errorRegistry;constructor(t=false){this.queryCompat=t}resolveRestContentType(t,n){const i=n.getMemberSchemas();const a=Object.values(i).find(t=>!!t.getMergedTraits().httpPayload);if(a){const n=a.getMergedTraits().mediaType;if(n){return n}else if(a.isStringSchema()){return"text/plain"}else if(a.isBlobSchema()){return"application/octet-stream"}else{return t}}else if(!n.isUnitSchema()){const n=Object.values(i).find(t=>{const{httpQuery:n,httpQueryParams:i,httpHeader:a,httpLabel:A,httpPrefixHeaders:c}=t.getMergedTraits();const l=c===void 0;return!n&&!i&&!a&&!A&&l});if(n){return t}}}async getErrorSchemaOrThrowBaseException(t,n,i,a,A,c){let l=t;if(t.includes("#")){[,l]=t.split("#")}const d={$metadata:A,$fault:i.statusCode<500?"client":"server"};if(!this.errorRegistry){throw new Error("@aws-sdk/core/protocols - error handler not initialized.")}try{const n=c?.(this.errorRegistry,l)??this.errorRegistry.getSchema(t);return{errorSchema:n,errorMetadata:d}}catch(t){a.message=a.message??a.Message??"UnknownError";const n=this.errorRegistry;const i=n.getBaseException();if(i){const t=n.getErrorCtor(i)??Error;throw this.decorateServiceException(Object.assign(new t({name:l}),d),a)}const A=a;const c=A?.message??A?.Message??A?.Error?.Message??A?.Error?.message;throw this.decorateServiceException(Object.assign(new Error(c),{name:l},d),a)}}compose(t,n,i){let a=i;if(n.includes("#")){[a]=n.split("#")}const A=c.for(a);const l=c.for("smithy.ts.sdk.synthetic."+i);t.copyFrom(A);t.copyFrom(l);this.errorRegistry=t}decorateServiceException(t,n={}){if(this.queryCompat){const i=t.Message??n.Message;const a=h(t,n);if(i){a.message=i}const A=a.Error??{};A.Type=a.Error?.Type;A.Code=a.Error?.Code;A.Message=a.Error?.message??a.Error?.Message??i;a.Error=A;const c=a.$metadata.requestId;if(c){a.RequestId=c}return a}return h(t,n)}setQueryCompatError(t,n){const i=n.headers?.["x-amzn-query-error"];if(t!==undefined&&i!=null){const[n,a]=i.split(";");const A=Object.keys(t);const c={Code:n,Type:a};t.Code=n;t.Type=a;for(let n=0;nl.of(t).getMergedTraits().awsQueryError?.[0]===n)}}}class AwsSmithyRpcV2CborProtocol extends a{awsQueryCompatible;mixin;constructor({defaultNamespace:t,errorTypeRegistries:n,awsQueryCompatible:i}){super({defaultNamespace:t,errorTypeRegistries:n});this.awsQueryCompatible=!!i;this.mixin=new ProtocolLib(this.awsQueryCompatible)}async serializeRequest(t,n,i){const a=await super.serializeRequest(t,n,i);if(this.awsQueryCompatible){a.headers["x-amzn-query-mode"]="true"}return a}async handleError(t,n,i,a,c){if(this.awsQueryCompatible){this.mixin.setQueryCompatError(a,i)}const d=(()=>{const t=i.headers["x-amzn-query-error"];if(t&&this.awsQueryCompatible){return t.split(";")[0]}return A(i,a)??"Unknown"})();this.mixin.compose(this.compositeErrorRegistry,d,this.options.defaultNamespace);const{errorSchema:h,errorMetadata:f}=await this.mixin.getErrorSchemaOrThrowBaseException(d,this.options.defaultNamespace,i,a,c,this.awsQueryCompatible?this.mixin.findQueryCompatibleError:undefined);const g=l.of(h);const p=a.message??a.Message??"UnknownError";const m=this.compositeErrorRegistry.getErrorCtor(h)??Error;const E=new m({});const C={};for(const[t,n]of g.structIterator()){if(a[t]!=null){C[t]=this.deserializer.readValue(n,a[t])}}if(this.awsQueryCompatible){this.mixin.queryCompatOutput(a,C)}throw this.mixin.decorateServiceException(Object.assign(E,f,{$fault:g.getMergedTraits().error,message:p},C),a)}}const _toStr=t=>{if(t==null){return t}if(typeof t==="number"||typeof t==="bigint"){const n=new Error(`Received number ${t} where a string was expected.`);n.name="Warning";console.warn(n);return String(t)}if(typeof t==="boolean"){const n=new Error(`Received boolean ${t} where a string was expected.`);n.name="Warning";console.warn(n);return String(t)}return t};const _toBool=t=>{if(t==null){return t}if(typeof t==="string"){const n=t.toLowerCase();if(t!==""&&n!=="false"&&n!=="true"){const n=new Error(`Received string "${t}" where a boolean was expected.`);n.name="Warning";console.warn(n)}return t!==""&&n!=="false"}return t};const _toNum=t=>{if(t==null){return t}if(typeof t==="string"){const n=Number(t);if(n.toString()!==t){const n=new Error(`Received string "${t}" where a number was expected.`);n.name="Warning";console.warn(n);return t}return n}return t};class SerdeContextConfig{serdeContext;setSerdeContext(t){this.serdeContext=t}}class UnionSerde{from;to;keys;constructor(t,n){this.from=t;this.to=n;const i=Object.keys(this.from);const a=new Set(i);a.delete("__type");this.keys=a}mark(t){this.keys.delete(t)}hasUnknown(){return this.keys.size===1&&Object.keys(this.to).length===0}writeUnknown(){if(this.hasUnknown()){const t=this.keys.values().next().value;const n=this.from[t];this.to.$unknown=[t,n]}}}function jsonReviver(t,n,i){if(i?.source){const t=i.source;if(typeof n==="number"){if(n>Number.MAX_SAFE_INTEGER||ng(t,n).then(t=>(n?.utf8Encoder??w)(t));const parseJsonBody=(t,n)=>collectBodyString(t,n).then(t=>{if(t.length){try{return JSON.parse(t)}catch(n){if(n?.name==="SyntaxError"){Object.defineProperty(n,"$responseBodyText",{value:t})}throw n}}return{}});const parseJsonErrorBody=async(t,n)=>{const i=await parseJsonBody(t,n);i.message=i.message??i.Message;return i};const findKey=(t,n)=>Object.keys(t).find(t=>t.toLowerCase()===n.toLowerCase());const sanitizeErrorCode=t=>{let n=t;if(typeof n==="number"){n=n.toString()}if(n.indexOf(",")>=0){n=n.split(",")[0]}if(n.indexOf(":")>=0){n=n.split(":")[0]}if(n.indexOf("#")>=0){n=n.split("#")[1]}return n};const loadRestJsonErrorCode=(t,n)=>loadErrorCode(t,n,["header","code","type"]);const loadJsonRpcErrorCode=(t,n,i=false)=>loadErrorCode(t,n,i?["code","header","type"]:["type","code","header"]);const loadErrorCode=({headers:t},n,i)=>{while(i.length>0){const a=i.shift();switch(a){case"header":const i=findKey(t??{},"x-amzn-errortype");if(i!==undefined){return sanitizeErrorCode(t[i])}break;case"code":const a=findKey(n??{},"code");if(a&&n[a]!==undefined){return sanitizeErrorCode(n[a])}break;case"type":if(n?.__type!==undefined){return sanitizeErrorCode(n.__type)}break}}};class JsonShapeDeserializer extends SerdeContextConfig{settings;constructor(t){super();this.settings=t}async read(t,n){return this._read(t,typeof n==="string"?JSON.parse(n,jsonReviver):await parseJsonBody(n,this.serdeContext))}readObject(t,n){return this._read(t,n)}_read(t,n){const i=n!==null&&typeof n==="object";const a=l.of(t);if(i){if(a.isStructSchema()){const t=n;const i=a.isUnionSchema();const A={};let c=void 0;const{jsonName:l}=this.settings;if(l){c={}}let d;if(i){d=new UnionSerde(t,A)}for(const[n,h]of a.structIterator()){let a=n;if(l){a=h.getMergedTraits().jsonName??a;c[a]=n}if(i){d.mark(a)}if(t[a]!=null){A[n]=this._read(h,t[a])}}if(i){d.writeUnknown()}else if(typeof t.__type==="string"){for(const n in t){const i=t[n];const a=l?c[n]??n:n;if(!(a in A)){A[a]=i}}}return A}if(Array.isArray(n)&&a.isListSchema()){const t=a.getValueSchema();const i=[];for(const a of n){i.push(this._read(t,a))}return i}if(a.isMapSchema()){const t=a.getValueSchema();const i={};for(const a in n){i[a]=this._read(t,n[a])}return i}}if(a.isBlobSchema()&&typeof n==="string"){return S(n)}const A=a.getMergedTraits().mediaType;if(a.isStringSchema()&&typeof n==="string"&&A){const t=A==="application/json"||A.endsWith("+json");if(t){return b.from(n)}return n}if(a.isTimestampSchema()&&n!=null){const t=p(a,this.settings);switch(t){case 5:return k(n);case 6:return v(n);case 7:return R(n);default:console.warn("Missing timestamp format, parsing value with Date constructor:",n);return new Date(n)}}if(a.isBigIntegerSchema()&&(typeof n==="number"||typeof n==="string")){return BigInt(n)}if(a.isBigDecimalSchema()&&n!=undefined){if(n instanceof Q){return n}const t=n;if(t.type==="bigDecimal"&&"string"in t){return new Q(t.string,t.type)}return new Q(String(n),"bigDecimal")}if(a.isNumericSchema()&&typeof n==="string"){switch(n){case"Infinity":return Infinity;case"-Infinity":return-Infinity;case"NaN":return NaN}return n}if(a.isDocumentSchema()){if(i){const t=Array.isArray(n)?[]:{};for(const i in n){const A=n[i];if(A instanceof Q){t[i]=A}else{t[i]=this._read(a,A)}}return t}else{return structuredClone(n)}}return n}}const P=String.fromCharCode(925);class JsonReplacer{values=new Map;counter=0;stage=0;createReplacer(){if(this.stage===1){throw new Error("@aws-sdk/core/protocols - JsonReplacer already created.")}if(this.stage===2){throw new Error("@aws-sdk/core/protocols - JsonReplacer exhausted.")}this.stage=1;return(t,n)=>{if(n instanceof Q){const t=`${P+"nv"+this.counter++}_`+n.string;this.values.set(`"${t}"`,n.string);return t}if(typeof n==="bigint"){const t=n.toString();const i=`${P+"b"+this.counter++}_`+t;this.values.set(`"${i}"`,t);return i}return n}}replaceInJson(t){if(this.stage===0){throw new Error("@aws-sdk/core/protocols - JsonReplacer not created yet.")}if(this.stage===2){throw new Error("@aws-sdk/core/protocols - JsonReplacer exhausted.")}this.stage=2;if(this.counter===0){return t}for(const[n,i]of this.values){t=t.replace(n,i)}return t}}class JsonShapeSerializer extends SerdeContextConfig{settings;buffer;useReplacer=false;rootSchema;constructor(t){super();this.settings=t}write(t,n){this.rootSchema=l.of(t);this.buffer=this._write(this.rootSchema,n)}flush(){const{rootSchema:t,useReplacer:n}=this;this.rootSchema=undefined;this.useReplacer=false;if(t?.isStructSchema()||t?.isDocumentSchema()){if(!n){return JSON.stringify(this.buffer)}const t=new JsonReplacer;return t.replaceInJson(JSON.stringify(this.buffer,t.createReplacer(),0))}return this.buffer}writeDiscriminatedDocument(t,n){this.write(t,n);if(typeof this.buffer==="object"){this.buffer.__type=l.of(t).getName(true)}}_write(t,n,i){const a=n!==null&&typeof n==="object";const A=l.of(t);if(a){if(A.isStructSchema()){const t=n;const i={};const{jsonName:a}=this.settings;let c=void 0;if(a){c={}}let l=0;for(const[n,d]of A.structIterator()){const h=this._write(d,t[n],A);if(h!==undefined){let t=n;if(a){t=d.getMergedTraits().jsonName??n;c[n]=t}i[t]=h;l++}}if(A.isUnionSchema()&&l===0){const{$unknown:n}=t;if(Array.isArray(n)){const[t,a]=n;i[t]=this._write(15,a)}}else if(typeof t.__type==="string"){for(const n in t){const A=t[n];const l=a?c[n]??n:n;if(!(l in i)){i[l]=this._write(15,A)}}}return i}if(Array.isArray(n)&&A.isListSchema()){const t=A.getValueSchema();const i=[];const a=!!A.getMergedTraits().sparse;for(const A of n){if(a||A!=null){i.push(this._write(t,A))}}return i}if(A.isMapSchema()){const t=A.getValueSchema();const i={};const a=!!A.getMergedTraits().sparse;for(const A in n){const c=n[A];if(a||c!=null){i[A]=this._write(t,c)}}return i}if(n instanceof Uint8Array&&(A.isBlobSchema()||A.isDocumentSchema())){if(A===this.rootSchema){return n}return(this.serdeContext?.base64Encoder??D)(n)}if(n instanceof Date&&(A.isTimestampSchema()||A.isDocumentSchema())){const t=p(A,this.settings);switch(t){case 5:return n.toISOString().replace(".000Z","Z");case 6:return T(n);case 7:return n.getTime()/1e3;default:console.warn("Missing timestamp format, using epoch seconds",n);return n.getTime()/1e3}}if(n instanceof Q){this.useReplacer=true}}if(n===null&&i?.isStructSchema()){return void 0}if(A.isStringSchema()){if(typeof n==="undefined"&&A.isIdempotencyToken()){return N()}const t=A.getMergedTraits().mediaType;if(n!=null&&t){const i=t==="application/json"||t.endsWith("+json");if(i){return b.from(n)}}return n}if(typeof n==="number"&&A.isNumericSchema()){if(Math.abs(n)===Infinity||isNaN(n)){return String(n)}return n}if(typeof n==="string"&&A.isBlobSchema()){if(A===this.rootSchema){return n}return(this.serdeContext?.base64Encoder??D)(n)}if(typeof n==="bigint"){this.useReplacer=true}if(A.isDocumentSchema()){if(a){const t=Array.isArray(n)?[]:{};for(const i in n){const a=n[i];if(a instanceof Q){this.useReplacer=true;t[i]=a}else{t[i]=this._write(A,a)}}return t}else{return structuredClone(n)}}return n}}class JsonCodec extends SerdeContextConfig{settings;constructor(t){super();this.settings=t}createSerializer(){const t=new JsonShapeSerializer(this.settings);t.setSerdeContext(this.serdeContext);return t}createDeserializer(){const t=new JsonShapeDeserializer(this.settings);t.setSerdeContext(this.serdeContext);return t}}class AwsJsonRpcProtocol extends m{serializer;deserializer;serviceTarget;codec;mixin;awsQueryCompatible;constructor({defaultNamespace:t,errorTypeRegistries:n,serviceTarget:i,awsQueryCompatible:a,jsonCodec:A}){super({defaultNamespace:t,errorTypeRegistries:n});this.serviceTarget=i;this.codec=A??new JsonCodec({timestampFormat:{useTrait:true,default:7},jsonName:false});this.serializer=this.codec.createSerializer();this.deserializer=this.codec.createDeserializer();this.awsQueryCompatible=!!a;this.mixin=new ProtocolLib(this.awsQueryCompatible)}async serializeRequest(t,n,i){const a=await super.serializeRequest(t,n,i);if(!a.path.endsWith("/")){a.path+="/"}a.headers["content-type"]=`application/x-amz-json-${this.getJsonRpcVersion()}`;a.headers["x-amz-target"]=`${this.serviceTarget}.${t.name}`;if(this.awsQueryCompatible){a.headers["x-amzn-query-mode"]="true"}if(d(t.input)==="unit"||!a.body){a.body="{}"}return a}getPayloadCodec(){return this.codec}async handleError(t,n,i,a,A){const{awsQueryCompatible:c}=this;if(c){this.mixin.setQueryCompatError(a,i)}const d=loadJsonRpcErrorCode(i,a,c)??"Unknown";this.mixin.compose(this.compositeErrorRegistry,d,this.options.defaultNamespace);const{errorSchema:h,errorMetadata:f}=await this.mixin.getErrorSchemaOrThrowBaseException(d,this.options.defaultNamespace,i,a,A,c?this.mixin.findQueryCompatibleError:undefined);const g=l.of(h);const p=a.message??a.Message??"UnknownError";const m=this.compositeErrorRegistry.getErrorCtor(h)??Error;const E=new m({});const C={};const I=this.codec.createDeserializer();for(const[t,n]of g.structIterator()){if(a[t]!=null){C[t]=I.readObject(n,a[t])}}if(c){this.mixin.queryCompatOutput(a,C)}throw this.mixin.decorateServiceException(Object.assign(E,f,{$fault:g.getMergedTraits().error,message:p},C),a)}}class AwsJson1_0Protocol extends AwsJsonRpcProtocol{constructor({defaultNamespace:t,errorTypeRegistries:n,serviceTarget:i,awsQueryCompatible:a,jsonCodec:A}){super({defaultNamespace:t,errorTypeRegistries:n,serviceTarget:i,awsQueryCompatible:a,jsonCodec:A})}getShapeId(){return"aws.protocols#awsJson1_0"}getJsonRpcVersion(){return"1.0"}getDefaultContentType(){return"application/x-amz-json-1.0"}}class AwsJson1_1Protocol extends AwsJsonRpcProtocol{constructor({defaultNamespace:t,errorTypeRegistries:n,serviceTarget:i,awsQueryCompatible:a,jsonCodec:A}){super({defaultNamespace:t,errorTypeRegistries:n,serviceTarget:i,awsQueryCompatible:a,jsonCodec:A})}getShapeId(){return"aws.protocols#awsJson1_1"}getJsonRpcVersion(){return"1.1"}getDefaultContentType(){return"application/x-amz-json-1.1"}}class AwsRestJsonProtocol extends E{serializer;deserializer;codec;mixin=new ProtocolLib;constructor({defaultNamespace:t,errorTypeRegistries:n}){super({defaultNamespace:t,errorTypeRegistries:n});const i={timestampFormat:{useTrait:true,default:7},httpBindings:true,jsonName:true};this.codec=new JsonCodec(i);this.serializer=new C(this.codec.createSerializer(),i);this.deserializer=new I(this.codec.createDeserializer(),i)}getShapeId(){return"aws.protocols#restJson1"}getPayloadCodec(){return this.codec}setSerdeContext(t){this.codec.setSerdeContext(t);super.setSerdeContext(t)}async serializeRequest(t,n,i){const a=await super.serializeRequest(t,n,i);const A=l.of(t.input);if(!a.headers["content-type"]){const t=this.mixin.resolveRestContentType(this.getDefaultContentType(),A);if(t){a.headers["content-type"]=t}}if(a.body==null&&a.headers["content-type"]===this.getDefaultContentType()){a.body="{}"}return a}async deserializeResponse(t,n,i){const a=await super.deserializeResponse(t,n,i);const A=l.of(t.output);for(const[t,n]of A.structIterator()){if(n.getMemberTraits().httpPayload&&!(t in a)){a[t]=null}}return a}async handleError(t,n,i,a,A){const c=loadRestJsonErrorCode(i,a)??"Unknown";this.mixin.compose(this.compositeErrorRegistry,c,this.options.defaultNamespace);const{errorSchema:d,errorMetadata:h}=await this.mixin.getErrorSchemaOrThrowBaseException(c,this.options.defaultNamespace,i,a,A);const f=l.of(d);const g=a.message??a.Message??"UnknownError";const p=this.compositeErrorRegistry.getErrorCtor(d)??Error;const m=new p({});await this.deserializeHttpMessage(d,n,i,a);const E={};const C=this.codec.createDeserializer();for(const[t,n]of f.structIterator()){const i=n.getMergedTraits().jsonName??t;E[t]=C.readObject(n,a[i])}throw this.mixin.decorateServiceException(Object.assign(m,h,{$fault:f.getMergedTraits().error,message:g},E),a)}getDefaultContentType(){return"application/json"}}const awsExpectUnion=t=>{if(t==null){return undefined}if(typeof t==="object"&&"__type"in t){delete t.__type}return M(t)};class XmlShapeDeserializer extends SerdeContextConfig{settings;stringDeserializer;constructor(t){super();this.settings=t;this.stringDeserializer=new y(t)}setSerdeContext(t){this.serdeContext=t;this.stringDeserializer.setSerdeContext(t)}read(t,n,i){const a=l.of(t);const A=a.getMemberSchemas();const c=a.isStructSchema()&&a.isMemberSchema()&&!!Object.values(A).find(t=>!!t.getMemberTraits().eventPayload);if(c){const t={};const i=Object.keys(A)[0];const a=A[i];if(a.isBlobSchema()){t[i]=n}else{t[i]=this.read(A[i],n)}return t}const d=(this.serdeContext?.utf8Encoder??w)(n);const h=this.parseXml(d);return this.readSchema(t,i?h[i]:h)}readSchema(t,n){const i=l.of(t);if(i.isUnitSchema()){return}const a=i.getMergedTraits();if(i.isListSchema()&&!Array.isArray(n)){return this.readSchema(i,[n])}if(n==null){return n}if(typeof n==="object"){const t=!!a.xmlFlattened;if(i.isListSchema()){const a=i.getValueSchema();const A=[];const c=a.getMergedTraits().xmlName??"member";const l=t?n:(n[0]??n)[c];if(l==null){return A}const d=Array.isArray(l)?l:[l];for(const t of d){A.push(this.readSchema(a,t))}return A}const A={};if(i.isMapSchema()){const a=i.getKeySchema();const c=i.getValueSchema();let l;if(t){l=Array.isArray(n)?n:[n]}else{l=Array.isArray(n.entry)?n.entry:[n.entry]}const d=a.getMergedTraits().xmlName??"key";const h=c.getMergedTraits().xmlName??"value";for(const t of l){const n=t[d];const i=t[h];A[n]=this.readSchema(c,i)}return A}if(i.isStructSchema()){const t=i.isUnionSchema();let a;if(t){a=new UnionSerde(n,A)}for(const[c,l]of i.structIterator()){const i=l.getMergedTraits();const d=!i.httpPayload?l.getMemberTraits().xmlName??c:i.xmlName??l.getName();if(t){a.mark(d)}if(n[d]!=null){A[c]=this.readSchema(l,n[d])}}if(t){a.writeUnknown()}return A}if(i.isDocumentSchema()){return n}throw new Error(`@aws-sdk/core/protocols - xml deserializer unhandled schema type for ${i.getName(true)}`)}if(i.isListSchema()){return[]}if(i.isMapSchema()||i.isStructSchema()){return{}}return this.stringDeserializer.read(i,n)}parseXml(t){if(t.length){let n;try{n=F(t)}catch(n){if(n&&typeof n==="object"){Object.defineProperty(n,"$responseBodyText",{value:t})}throw n}const i="#text";const a=Object.keys(n)[0];const A=n[a];if(A[i]){A[a]=A[i];delete A[i]}return f(A)}return{}}}class QueryShapeSerializer extends SerdeContextConfig{settings;buffer;constructor(t){super();this.settings=t}write(t,n,i=""){if(this.buffer===undefined){this.buffer=""}const a=l.of(t);if(i&&!i.endsWith(".")){i+="."}if(a.isBlobSchema()){if(typeof n==="string"||n instanceof Uint8Array){this.writeKey(i);this.writeValue((this.serdeContext?.base64Encoder??D)(n))}}else if(a.isBooleanSchema()||a.isNumericSchema()||a.isStringSchema()){if(n!=null){this.writeKey(i);this.writeValue(String(n))}else if(a.isIdempotencyToken()){this.writeKey(i);this.writeValue(N())}}else if(a.isBigIntegerSchema()){if(n!=null){this.writeKey(i);this.writeValue(String(n))}}else if(a.isBigDecimalSchema()){if(n!=null){this.writeKey(i);this.writeValue(n instanceof Q?n.string:String(n))}}else if(a.isTimestampSchema()){if(n instanceof Date){this.writeKey(i);const t=p(a,this.settings);switch(t){case 5:this.writeValue(n.toISOString().replace(".000Z","Z"));break;case 6:this.writeValue(T(n));break;case 7:this.writeValue(String(n.getTime()/1e3));break}}}else if(a.isDocumentSchema()){if(Array.isArray(n)){this.write(64|15,n,i)}else if(n instanceof Date){this.write(4,n,i)}else if(n instanceof Uint8Array){this.write(21,n,i)}else if(n&&typeof n==="object"){this.write(128|15,n,i)}else{this.writeKey(i);this.writeValue(String(n))}}else if(a.isListSchema()){if(Array.isArray(n)){if(n.length===0){if(this.settings.serializeEmptyLists){this.writeKey(i);this.writeValue("")}}else{const t=a.getValueSchema();const A=this.settings.flattenLists||a.getMergedTraits().xmlFlattened;let c=1;for(const a of n){if(a==null){continue}const n=t.getMergedTraits();const l=this.getKey("member",n.xmlName,n.ec2QueryName);const d=A?`${i}${c}`:`${i}${l}.${c}`;this.write(t,a,d);++c}}}}else if(a.isMapSchema()){if(n&&typeof n==="object"){const t=a.getKeySchema();const A=a.getValueSchema();const c=a.getMergedTraits().xmlFlattened;let l=1;for(const a in n){const d=n[a];if(d==null){continue}const h=t.getMergedTraits();const f=this.getKey("key",h.xmlName,h.ec2QueryName);const g=c?`${i}${l}.${f}`:`${i}entry.${l}.${f}`;const p=A.getMergedTraits();const m=this.getKey("value",p.xmlName,p.ec2QueryName);const E=c?`${i}${l}.${m}`:`${i}entry.${l}.${m}`;this.write(t,a,g);this.write(A,d,E);++l}}}else if(a.isStructSchema()){if(n&&typeof n==="object"){let t=false;for(const[A,c]of a.structIterator()){if(n[A]==null&&!c.isIdempotencyToken()){continue}const a=c.getMergedTraits();const l=this.getKey(A,a.xmlName,a.ec2QueryName,"struct");const d=`${i}${l}`;this.write(c,n[A],d);t=true}if(!t&&a.isUnionSchema()){const{$unknown:t}=n;if(Array.isArray(t)){const[n,a]=t;const A=`${i}${n}`;this.write(15,a,A)}}}}else if(a.isUnitSchema());else{throw new Error(`@aws-sdk/core/protocols - QuerySerializer unrecognized schema type ${a.getName(true)}`)}}flush(){if(this.buffer===undefined){throw new Error("@aws-sdk/core/protocols - QuerySerializer cannot flush with nothing written to buffer.")}const t=this.buffer;delete this.buffer;return t}getKey(t,n,i,a){const{ec2:A,capitalizeKeys:c}=this.settings;if(A&&i){return i}const l=n??t;if(c&&a==="struct"){return l[0].toUpperCase()+l.slice(1)}return l}writeKey(t){if(t.endsWith(".")){t=t.slice(0,t.length-1)}this.buffer+=`&${B(t)}=`}writeValue(t){this.buffer+=B(t)}}class AwsQueryProtocol extends m{options;serializer;deserializer;mixin=new ProtocolLib;constructor(t){super({defaultNamespace:t.defaultNamespace,errorTypeRegistries:t.errorTypeRegistries});this.options=t;const n={timestampFormat:{useTrait:true,default:5},httpBindings:false,xmlNamespace:t.xmlNamespace,serviceNamespace:t.defaultNamespace,serializeEmptyLists:true};this.serializer=new QueryShapeSerializer(n);this.deserializer=new XmlShapeDeserializer(n)}getShapeId(){return"aws.protocols#awsQuery"}setSerdeContext(t){this.serializer.setSerdeContext(t);this.deserializer.setSerdeContext(t)}getPayloadCodec(){throw new Error("AWSQuery protocol has no payload codec.")}async serializeRequest(t,n,i){const a=await super.serializeRequest(t,n,i);if(!a.path.endsWith("/")){a.path+="/"}a.headers["content-type"]="application/x-www-form-urlencoded";if(d(t.input)==="unit"||!a.body){a.body=""}const A=t.name.split("#")[1]??t.name;a.body=`Action=${A}&Version=${this.options.version}`+a.body;if(a.body.endsWith("&")){a.body=a.body.slice(-1)}return a}async deserializeResponse(t,n,i){const a=this.deserializer;const A=l.of(t.output);const c={};if(i.statusCode>=300){const A=await g(i.body,n);if(A.byteLength>0){Object.assign(c,await a.read(15,A))}await this.handleError(t,n,i,c,this.deserializeMetadata(i))}for(const t in i.headers){const n=i.headers[t];delete i.headers[t];i.headers[t.toLowerCase()]=n}const d=t.name.split("#")[1]??t.name;const h=A.isStructSchema()&&this.useNestedResult()?d+"Result":undefined;const f=await g(i.body,n);if(f.byteLength>0){Object.assign(c,await a.read(A,f,h))}c.$metadata=this.deserializeMetadata(i);return c}useNestedResult(){return true}async handleError(t,n,i,a,A){const c=this.loadQueryErrorCode(i,a)??"Unknown";this.mixin.compose(this.compositeErrorRegistry,c,this.options.defaultNamespace);const d=this.loadQueryError(a)??{};const h=this.loadQueryErrorMessage(a);d.message=h;d.Error={Type:d.Type,Code:d.Code,Message:h};const{errorSchema:f,errorMetadata:g}=await this.mixin.getErrorSchemaOrThrowBaseException(c,this.options.defaultNamespace,i,d,A,this.mixin.findQueryCompatibleError);const p=l.of(f);const m=this.compositeErrorRegistry.getErrorCtor(f)??Error;const E=new m({});const C={Type:d.Error.Type,Code:d.Error.Code,Error:d.Error};for(const[t,n]of p.structIterator()){const i=n.getMergedTraits().xmlName??t;const A=d[i]??a[i];C[t]=this.deserializer.readSchema(n,A)}throw this.mixin.decorateServiceException(Object.assign(E,g,{$fault:p.getMergedTraits().error,message:h},C),a)}loadQueryErrorCode(t,n){const i=(n.Errors?.[0]?.Error??n.Errors?.Error??n.Error)?.Code;if(i!==undefined){return i}if(t.statusCode==404){return"NotFound"}}loadQueryError(t){return t.Errors?.[0]?.Error??t.Errors?.Error??t.Error}loadQueryErrorMessage(t){const n=this.loadQueryError(t);return n?.message??n?.Message??t.message??t.Message??"Unknown"}getDefaultContentType(){return"application/x-www-form-urlencoded"}}class AwsEc2QueryProtocol extends AwsQueryProtocol{options;constructor(t){super(t);this.options=t;const n={capitalizeKeys:true,flattenLists:true,serializeEmptyLists:false,ec2:true};Object.assign(this.serializer.settings,n)}getShapeId(){return"aws.protocols#ec2Query"}useNestedResult(){return false}}const parseXmlBody=(t,n)=>collectBodyString(t,n).then(t=>{if(t.length){let n;try{n=F(t)}catch(n){if(n&&typeof n==="object"){Object.defineProperty(n,"$responseBodyText",{value:t})}throw n}const i="#text";const a=Object.keys(n)[0];const A=n[a];if(A[i]){A[a]=A[i];delete A[i]}return f(A)}return{}});const parseXmlErrorBody=async(t,n)=>{const i=await parseXmlBody(t,n);if(i.Error){i.Error.message=i.Error.message??i.Error.Message}return i};const loadRestXmlErrorCode=(t,n)=>{if(n?.Error?.Code!==undefined){return n.Error.Code}if(n?.Code!==undefined){return n.Code}if(t.statusCode==404){return"NotFound"}};class XmlShapeSerializer extends SerdeContextConfig{settings;stringBuffer;byteBuffer;buffer;constructor(t){super();this.settings=t}write(t,n){const i=l.of(t);if(i.isStringSchema()&&typeof n==="string"){this.stringBuffer=n}else if(i.isBlobSchema()){this.byteBuffer="byteLength"in n?n:(this.serdeContext?.base64Decoder??S)(n)}else{this.buffer=this.writeStruct(i,n,undefined);const t=i.getMergedTraits();if(t.httpPayload&&!t.xmlName){this.buffer.withName(i.getName())}}}flush(){if(this.byteBuffer!==undefined){const t=this.byteBuffer;delete this.byteBuffer;return t}if(this.stringBuffer!==undefined){const t=this.stringBuffer;delete this.stringBuffer;return t}const t=this.buffer;if(this.settings.xmlNamespace){if(!t?.attributes?.["xmlns"]){t.addAttribute("xmlns",this.settings.xmlNamespace)}}delete this.buffer;return t.toString()}writeStruct(t,n,i){const a=t.getMergedTraits();const A=t.isMemberSchema()&&!a.httpPayload?t.getMemberTraits().xmlName??t.getMemberName():a.xmlName??t.getName();if(!A||!t.isStructSchema()){throw new Error(`@aws-sdk/core/protocols - xml serializer, cannot write struct with empty name or non-struct, schema=${t.getName(true)}.`)}const c=x.of(A);const[l,d]=this.getXmlnsAttribute(t,i);for(const[i,a]of t.structIterator()){const t=n[i];if(t!=null||a.isIdempotencyToken()){if(a.getMergedTraits().xmlAttribute){c.addAttribute(a.getMergedTraits().xmlName??i,this.writeSimple(a,t));continue}if(a.isListSchema()){this.writeList(a,t,c,d)}else if(a.isMapSchema()){this.writeMap(a,t,c,d)}else if(a.isStructSchema()){c.addChildNode(this.writeStruct(a,t,d))}else{const n=x.of(a.getMergedTraits().xmlName??a.getMemberName());this.writeSimpleInto(a,t,n,d);c.addChildNode(n)}}}const{$unknown:h}=n;if(h&&t.isUnionSchema()&&Array.isArray(h)&&Object.keys(n).length===1){const[t,i]=h;const a=x.of(t);if(typeof i!=="string"){if(n instanceof x||n instanceof U){c.addChildNode(n)}else{throw new Error(`@aws-sdk - $unknown union member in XML requires `+`value of type string, @aws-sdk/xml-builder::XmlNode or XmlText.`)}}this.writeSimpleInto(0,i,a,d);c.addChildNode(a)}if(d){c.addAttribute(l,d)}return c}writeList(t,n,i,a){if(!t.isMemberSchema()){throw new Error(`@aws-sdk/core/protocols - xml serializer, cannot write non-member list: ${t.getName(true)}`)}const A=t.getMergedTraits();const c=t.getValueSchema();const l=c.getMergedTraits();const d=!!l.sparse;const h=!!A.xmlFlattened;const[f,g]=this.getXmlnsAttribute(t,a);const writeItem=(n,i)=>{if(c.isListSchema()){this.writeList(c,Array.isArray(i)?i:[i],n,g)}else if(c.isMapSchema()){this.writeMap(c,i,n,g)}else if(c.isStructSchema()){const a=this.writeStruct(c,i,g);n.addChildNode(a.withName(h?A.xmlName??t.getMemberName():l.xmlName??"member"))}else{const a=x.of(h?A.xmlName??t.getMemberName():l.xmlName??"member");this.writeSimpleInto(c,i,a,g);n.addChildNode(a)}};if(h){for(const t of n){if(d||t!=null){writeItem(i,t)}}}else{const a=x.of(A.xmlName??t.getMemberName());if(g){a.addAttribute(f,g)}for(const t of n){if(d||t!=null){writeItem(a,t)}}i.addChildNode(a)}}writeMap(t,n,i,a,A=false){if(!t.isMemberSchema()){throw new Error(`@aws-sdk/core/protocols - xml serializer, cannot write non-member map: ${t.getName(true)}`)}const c=t.getMergedTraits();const l=t.getKeySchema();const d=l.getMergedTraits();const h=d.xmlName??"key";const f=t.getValueSchema();const g=f.getMergedTraits();const p=g.xmlName??"value";const m=!!g.sparse;const E=!!c.xmlFlattened;const[C,I]=this.getXmlnsAttribute(t,a);const addKeyValue=(t,n,i)=>{const a=x.of(h,n);const[A,c]=this.getXmlnsAttribute(l,I);if(c){a.addAttribute(A,c)}t.addChildNode(a);let d=x.of(p);if(f.isListSchema()){this.writeList(f,i,d,I)}else if(f.isMapSchema()){this.writeMap(f,i,d,I,true)}else if(f.isStructSchema()){d=this.writeStruct(f,i,I)}else{this.writeSimpleInto(f,i,d,I)}t.addChildNode(d)};if(E){for(const a in n){const A=n[a];if(m||A!=null){const n=x.of(c.xmlName??t.getMemberName());addKeyValue(n,a,A);i.addChildNode(n)}}}else{let a;if(!A){a=x.of(c.xmlName??t.getMemberName());if(I){a.addAttribute(C,I)}i.addChildNode(a)}for(const t in n){const c=n[t];if(m||c!=null){const n=x.of("entry");addKeyValue(n,t,c);(A?i:a).addChildNode(n)}}}}writeSimple(t,n){if(null===n){throw new Error("@aws-sdk/core/protocols - (XML serializer) cannot write null value.")}const i=l.of(t);let a=null;if(n&&typeof n==="object"){if(i.isBlobSchema()){a=(this.serdeContext?.base64Encoder??D)(n)}else if(i.isTimestampSchema()&&n instanceof Date){const t=p(i,this.settings);switch(t){case 5:a=n.toISOString().replace(".000Z","Z");break;case 6:a=T(n);break;case 7:a=String(n.getTime()/1e3);break;default:console.warn("Missing timestamp format, using http date",n);a=T(n);break}}else if(i.isBigDecimalSchema()&&n){if(n instanceof Q){return n.string}return String(n)}else if(i.isMapSchema()||i.isListSchema()){throw new Error("@aws-sdk/core/protocols - xml serializer, cannot call _write() on List/Map schema, call writeList or writeMap() instead.")}else{throw new Error(`@aws-sdk/core/protocols - xml serializer, unhandled schema type for object value and schema: ${i.getName(true)}`)}}if(i.isBooleanSchema()||i.isNumericSchema()||i.isBigIntegerSchema()||i.isBigDecimalSchema()){a=String(n)}if(i.isStringSchema()){if(n===undefined&&i.isIdempotencyToken()){a=N()}else{a=String(n)}}if(a===null){throw new Error(`Unhandled schema-value pair ${i.getName(true)}=${n}`)}return a}writeSimpleInto(t,n,i,a){const A=this.writeSimple(t,n);const c=l.of(t);const d=new U(A);const[h,f]=this.getXmlnsAttribute(c,a);if(f){i.addAttribute(h,f)}i.addChildNode(d)}getXmlnsAttribute(t,n){const i=t.getMergedTraits();const[a,A]=i.xmlNamespace??[];if(A&&A!==n){return[a?`xmlns:${a}`:"xmlns",A]}return[void 0,void 0]}}class XmlCodec extends SerdeContextConfig{settings;constructor(t){super();this.settings=t}createSerializer(){const t=new XmlShapeSerializer(this.settings);t.setSerdeContext(this.serdeContext);return t}createDeserializer(){const t=new XmlShapeDeserializer(this.settings);t.setSerdeContext(this.serdeContext);return t}}class AwsRestXmlProtocol extends E{codec;serializer;deserializer;mixin=new ProtocolLib;constructor(t){super(t);const n={timestampFormat:{useTrait:true,default:5},httpBindings:true,xmlNamespace:t.xmlNamespace,serviceNamespace:t.defaultNamespace};this.codec=new XmlCodec(n);this.serializer=new C(this.codec.createSerializer(),n);this.deserializer=new I(this.codec.createDeserializer(),n)}getPayloadCodec(){return this.codec}getShapeId(){return"aws.protocols#restXml"}async serializeRequest(t,n,i){const a=await super.serializeRequest(t,n,i);const A=l.of(t.input);if(!a.headers["content-type"]){const t=this.mixin.resolveRestContentType(this.getDefaultContentType(),A);if(t){a.headers["content-type"]=t}}if(typeof a.body==="string"&&a.headers["content-type"]===this.getDefaultContentType()&&!a.body.startsWith("'+a.body}return a}async deserializeResponse(t,n,i){return super.deserializeResponse(t,n,i)}async handleError(t,n,i,a,A){const c=loadRestXmlErrorCode(i,a)??"Unknown";this.mixin.compose(this.compositeErrorRegistry,c,this.options.defaultNamespace);if(a.Error&&typeof a.Error==="object"){for(const t of Object.keys(a.Error)){a[t]=a.Error[t];if(t.toLowerCase()==="message"){a.message=a.Error[t]}}}if(a.RequestId&&!A.requestId){A.requestId=a.RequestId}const{errorSchema:d,errorMetadata:h}=await this.mixin.getErrorSchemaOrThrowBaseException(c,this.options.defaultNamespace,i,a,A);const f=l.of(d);const g=a.Error?.message??a.Error?.Message??a.message??a.Message??"UnknownError";const p=this.compositeErrorRegistry.getErrorCtor(d)??Error;const m=new p({});await this.deserializeHttpMessage(d,n,i,a);const E={};const C=this.codec.createDeserializer();for(const[t,n]of f.structIterator()){const i=n.getMergedTraits().xmlName??t;const A=a.Error?.[i]??a[i];E[t]=C.readSchema(n,A)}throw this.mixin.decorateServiceException(Object.assign(m,h,{$fault:f.getMergedTraits().error,message:g},E),a)}getDefaultContentType(){return"application/xml"}hasUnstructuredPayloadBinding(t){for(const[,n]of t.structIterator()){if(n.getMergedTraits().httpPayload){return!(n.isStructSchema()||n.isMapSchema()||n.isListSchema())}}return false}}n.AwsEc2QueryProtocol=AwsEc2QueryProtocol;n.AwsJson1_0Protocol=AwsJson1_0Protocol;n.AwsJson1_1Protocol=AwsJson1_1Protocol;n.AwsJsonRpcProtocol=AwsJsonRpcProtocol;n.AwsQueryProtocol=AwsQueryProtocol;n.AwsRestJsonProtocol=AwsRestJsonProtocol;n.AwsRestXmlProtocol=AwsRestXmlProtocol;n.AwsSmithyRpcV2CborProtocol=AwsSmithyRpcV2CborProtocol;n.JsonCodec=JsonCodec;n.JsonShapeDeserializer=JsonShapeDeserializer;n.JsonShapeSerializer=JsonShapeSerializer;n.QueryShapeSerializer=QueryShapeSerializer;n.XmlCodec=XmlCodec;n.XmlShapeDeserializer=XmlShapeDeserializer;n.XmlShapeSerializer=XmlShapeSerializer;n._toBool=_toBool;n._toNum=_toNum;n._toStr=_toStr;n.awsExpectUnion=awsExpectUnion;n.loadJsonRpcErrorCode=loadJsonRpcErrorCode;n.loadRestJsonErrorCode=loadRestJsonErrorCode;n.loadRestXmlErrorCode=loadRestXmlErrorCode;n.parseJsonBody=parseJsonBody;n.parseJsonErrorBody=parseJsonErrorBody;n.parseXmlBody=parseXmlBody;n.parseXmlErrorBody=parseXmlErrorBody},5606:(t,n,i)=>{const{setCredentialFeature:a}=i(5152);const{CredentialsProviderError:A}=i(7291);const c="AWS_ACCESS_KEY_ID";const l="AWS_SECRET_ACCESS_KEY";const d="AWS_SESSION_TOKEN";const h="AWS_CREDENTIAL_EXPIRATION";const f="AWS_CREDENTIAL_SCOPE";const g="AWS_ACCOUNT_ID";const fromEnv=t=>async()=>{t?.logger?.debug("@aws-sdk/credential-provider-env - fromEnv");const n=process.env[c];const i=process.env[l];const p=process.env[d];const m=process.env[h];const E=process.env[f];const C=process.env[g];if(n&&i){const t={accessKeyId:n,secretAccessKey:i,...p&&{sessionToken:p},...m&&{expiration:new Date(m)},...E&&{credentialScope:E},...C&&{accountId:C}};a(t,"CREDENTIALS_ENV_VARS","g");return t}throw new A("Unable to find environment variable credentials.",{logger:t?.logger})};n.ENV_ACCOUNT_ID=g;n.ENV_CREDENTIAL_SCOPE=f;n.ENV_EXPIRATION=h;n.ENV_KEY=c;n.ENV_SECRET=l;n.ENV_SESSION=d;n.fromEnv=fromEnv},8605:(t,n,i)=>{const{setCredentialFeature:a}=i(5152);const{CredentialsProviderError:A}=i(7291);const{NodeHttpHandler:c}=i(1279);const l=i(1455);const{HttpRequest:d}=i(3422);const{sdkStreamMixin:h,parseRfc3339DateTime:f}=i(2430);const g="169.254.170.2";const p="169.254.170.23";const m="[fd00:ec2::23]";const checkUrl=(t,n)=>{if(t.protocol==="https:"){return}if(t.hostname===g||t.hostname===p||t.hostname===m){return}if(t.hostname.includes("[")){if(t.hostname==="[::1]"||t.hostname==="[0000:0000:0000:0000:0000:0000:0000:0001]"){return}}else{if(t.hostname==="localhost"){return}const n=t.hostname.split(".");const inRange=t=>{const n=parseInt(t,10);return 0<=n&&n<=255};if(n[0]==="127"&&inRange(n[1])&&inRange(n[2])&&inRange(n[3])&&n.length===4){return}}throw new A(`URL not accepted. It must either be HTTPS or match one of the following:\n - loopback CIDR 127.0.0.0/8 or [::1/128]\n - ECS container host 169.254.170.2\n - EKS container host 169.254.170.23 or [fd00:ec2::23]`,{logger:n})};function createGetRequest(t){return new d({protocol:t.protocol,hostname:t.hostname,port:Number(t.port),path:t.pathname,query:Array.from(t.searchParams.entries()).reduce((t,[n,i])=>{t[n]=i;return t},{}),fragment:t.hash})}async function getCredentials(t,n){const i=h(t.body);const a=await i.transformToString();if(t.statusCode===200){const t=JSON.parse(a);if(typeof t.AccessKeyId!=="string"||typeof t.SecretAccessKey!=="string"||typeof t.Token!=="string"||typeof t.Expiration!=="string"){throw new A("HTTP credential provider response not of the required format, an object matching: "+"{ AccessKeyId: string, SecretAccessKey: string, Token: string, Expiration: string(rfc3339) }",{logger:n})}return{accessKeyId:t.AccessKeyId,secretAccessKey:t.SecretAccessKey,sessionToken:t.Token,expiration:f(t.Expiration)}}if(t.statusCode>=400&&t.statusCode<500){let i={};try{i=JSON.parse(a)}catch(t){}throw Object.assign(new A(`Server responded with status: ${t.statusCode}`,{logger:n}),{Code:i.Code,Message:i.Message})}throw new A(`Server responded with status: ${t.statusCode}`,{logger:n})}const retryWrapper=(t,n,i)=>async()=>{for(let a=0;asetTimeout(t,i))}}return await t()};const E="AWS_CONTAINER_CREDENTIALS_RELATIVE_URI";const C="http://169.254.170.2";const I="AWS_CONTAINER_CREDENTIALS_FULL_URI";const y="AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE";const B="AWS_CONTAINER_AUTHORIZATION_TOKEN";const fromHttp=(t={})=>{t.logger?.debug("@aws-sdk/credential-provider-http - fromHttp");let n;const i=t.awsContainerCredentialsRelativeUri??process.env[E];const d=t.awsContainerCredentialsFullUri??process.env[I];const h=t.awsContainerAuthorizationToken??process.env[B];const f=t.awsContainerAuthorizationTokenFile??process.env[y];const g=t.logger?.constructor?.name==="NoOpLogger"||!t.logger?.warn?console.warn:t.logger.warn.bind(t.logger);if(i&&d){g("@aws-sdk/credential-provider-http: "+"you have set both awsContainerCredentialsRelativeUri and awsContainerCredentialsFullUri.");g("awsContainerCredentialsFullUri will take precedence.")}if(h&&f){g("@aws-sdk/credential-provider-http: "+"you have set both awsContainerAuthorizationToken and awsContainerAuthorizationTokenFile.");g("awsContainerAuthorizationToken will take precedence.")}if(d){n=d}else if(i){n=`${C}${i}`}else{throw new A(`No HTTP credential provider host provided.\nSet AWS_CONTAINER_CREDENTIALS_FULL_URI or AWS_CONTAINER_CREDENTIALS_RELATIVE_URI.`,{logger:t.logger})}const p=new URL(n);checkUrl(p,t.logger);const m=c.create({connectionTimeout:t.timeout??1e3});const Q=t.timeout??1e3;const w=retryWrapper(async()=>{const n=createGetRequest(p);if(h){n.headers.Authorization=h}else if(f){n.headers.Authorization=(await l.readFile(f)).toString()}try{const t=await m.handle(n,{requestTimeout:Q});return getCredentials(t.response).then(t=>a(t,"CREDENTIALS_HTTP","z"))}catch(n){throw new A(String(n),{logger:t.logger})}},t.maxRetries??3,t.timeout??1e3);return async()=>{try{return await w()}finally{m.destroy?.()}}};n.fromHttp=fromHttp},5869:(t,n,i)=>{const{CredentialsProviderError:a,chain:A,getProfileName:c,parseKnownFiles:l}=i(7291);const{setCredentialFeature:d}=i(5152);const{fromLoginCredentials:h}=i(4072);const resolveCredentialSource=(t,n,c)=>{const l={EcsContainer:async t=>{const{fromHttp:n}=i(8605);const{fromContainerMetadata:a}=i(566);c?.debug("@aws-sdk/credential-provider-ini - credential_source is EcsContainer");return async()=>A(n(t??{}),a(t))().then(setNamedProvider)},Ec2InstanceMetadata:async t=>{c?.debug("@aws-sdk/credential-provider-ini - credential_source is Ec2InstanceMetadata");const{fromInstanceMetadata:n}=i(566);return async()=>n(t)().then(setNamedProvider)},Environment:async t=>{c?.debug("@aws-sdk/credential-provider-ini - credential_source is Environment");const{fromEnv:n}=i(5606);return async()=>n(t)().then(setNamedProvider)}};if(t in l){return l[t]}else{throw new a(`Unsupported credential source in profile ${n}. Got ${t}, `+`expected EcsContainer or Ec2InstanceMetadata or Environment.`,{logger:c})}};const setNamedProvider=t=>d(t,"CREDENTIALS_PROFILE_NAMED_PROVIDER","p");const isAssumeRoleProfile=(t,{profile:n="default",logger:i}={})=>Boolean(t)&&typeof t==="object"&&typeof t.role_arn==="string"&&["undefined","string"].indexOf(typeof t.role_session_name)>-1&&["undefined","string"].indexOf(typeof t.external_id)>-1&&["undefined","string"].indexOf(typeof t.mfa_serial)>-1&&(isAssumeRoleWithSourceProfile(t,{profile:n,logger:i})||isCredentialSourceProfile(t,{profile:n,logger:i}));const isAssumeRoleWithSourceProfile=(t,{profile:n,logger:i})=>{const a=typeof t.source_profile==="string"&&typeof t.credential_source==="undefined";if(a){i?.debug?.(` ${n} isAssumeRoleWithSourceProfile source_profile=${t.source_profile}`)}return a};const isCredentialSourceProfile=(t,{profile:n,logger:i})=>{const a=typeof t.credential_source==="string"&&typeof t.source_profile==="undefined";if(a){i?.debug?.(` ${n} isCredentialSourceProfile credential_source=${t.credential_source}`)}return a};const resolveAssumeRoleCredentials=async(t,n,A,l,h={},f)=>{A.logger?.debug("@aws-sdk/credential-provider-ini - resolveAssumeRoleCredentials (STS)");const g=n[t];const{source_profile:p,region:m}=g;if(!A.roleAssumer){const{getDefaultRoleAssumer:t}=i(1136);A.roleAssumer=t({...A.clientConfig,credentialProviderLogger:A.logger,parentClientConfig:{...l,...A?.parentClientConfig,region:m??A?.parentClientConfig?.region??l?.region}},A.clientPlugins)}if(p&&p in h){throw new a(`Detected a cycle attempting to resolve credentials for profile`+` ${c(A)}. Profiles visited: `+Object.keys(h).join(", "),{logger:A.logger})}A.logger?.debug(`@aws-sdk/credential-provider-ini - finding credential resolver using ${p?`source_profile=[${p}]`:`profile=[${t}]`}`);const E=p?f(p,n,A,l,{...h,[p]:true},isCredentialSourceWithoutRoleArn(n[p]??{})):(await resolveCredentialSource(g.credential_source,t,A.logger)(A))();if(isCredentialSourceWithoutRoleArn(g)){return E.then(t=>d(t,"CREDENTIALS_PROFILE_SOURCE_PROFILE","o"))}else{const n={RoleArn:g.role_arn,RoleSessionName:g.role_session_name||`aws-sdk-js-${Date.now()}`,ExternalId:g.external_id,DurationSeconds:parseInt(g.duration_seconds||"3600",10)};const{mfa_serial:i}=g;if(i){if(!A.mfaCodeProvider){throw new a(`Profile ${t} requires multi-factor authentication, but no MFA code callback was provided.`,{logger:A.logger,tryNextLink:false})}n.SerialNumber=i;n.TokenCode=await A.mfaCodeProvider(i)}const c=await E;return A.roleAssumer(c,n).then(t=>d(t,"CREDENTIALS_PROFILE_SOURCE_PROFILE","o"))}};const isCredentialSourceWithoutRoleArn=t=>!t.role_arn&&!!t.credential_source;const isLoginProfile=t=>Boolean(t&&t.login_session);const resolveLoginCredentials=async(t,n,i)=>{const a=await h({...n,profile:t})({callerClientConfig:i});return d(a,"CREDENTIALS_PROFILE_LOGIN","AC")};const isProcessProfile=t=>Boolean(t)&&typeof t==="object"&&typeof t.credential_process==="string";const resolveProcessCredentials=async(t,n)=>{const{fromProcess:a}=i(5360);const A=await a({...t,profile:n})();return d(A,"CREDENTIALS_PROFILE_PROCESS","v")};const resolveSsoCredentials=async(t,n,a={},A)=>{const{fromSSO:c}=i(998);return c({profile:t,logger:a.logger,parentClientConfig:a.parentClientConfig,clientConfig:a.clientConfig})({callerClientConfig:A}).then(t=>{if(n.sso_session){return d(t,"CREDENTIALS_PROFILE_SSO","r")}else{return d(t,"CREDENTIALS_PROFILE_SSO_LEGACY","t")}})};const isSsoProfile=t=>t&&(typeof t.sso_start_url==="string"||typeof t.sso_account_id==="string"||typeof t.sso_session==="string"||typeof t.sso_region==="string"||typeof t.sso_role_name==="string");const isStaticCredsProfile=t=>Boolean(t)&&typeof t==="object"&&typeof t.aws_access_key_id==="string"&&typeof t.aws_secret_access_key==="string"&&["undefined","string"].indexOf(typeof t.aws_session_token)>-1&&["undefined","string"].indexOf(typeof t.aws_account_id)>-1;const resolveStaticCredentials=async(t,n)=>{n?.logger?.debug("@aws-sdk/credential-provider-ini - resolveStaticCredentials");const i={accessKeyId:t.aws_access_key_id,secretAccessKey:t.aws_secret_access_key,sessionToken:t.aws_session_token,...t.aws_credential_scope&&{credentialScope:t.aws_credential_scope},...t.aws_account_id&&{accountId:t.aws_account_id}};return d(i,"CREDENTIALS_PROFILE","n")};const isWebIdentityProfile=t=>Boolean(t)&&typeof t==="object"&&typeof t.web_identity_token_file==="string"&&typeof t.role_arn==="string"&&["undefined","string"].indexOf(typeof t.role_session_name)>-1;const resolveWebIdentityCredentials=async(t,n,a)=>{const{fromTokenFile:A}=i(9956);const c=await A({webIdentityTokenFile:t.web_identity_token_file,roleArn:t.role_arn,roleSessionName:t.role_session_name,roleAssumerWithWebIdentity:n.roleAssumerWithWebIdentity,logger:n.logger,parentClientConfig:n.parentClientConfig})({callerClientConfig:a});return d(c,"CREDENTIALS_PROFILE_STS_WEB_ID_TOKEN","q")};const resolveProfileData=async(t,n,i,A,c={},l=false)=>{const d=n[t];if(Object.keys(c).length>0&&isStaticCredsProfile(d)){return resolveStaticCredentials(d,i)}if(l||isAssumeRoleProfile(d,{profile:t,logger:i.logger})){return resolveAssumeRoleCredentials(t,n,i,A,c,resolveProfileData)}if(isStaticCredsProfile(d)){return resolveStaticCredentials(d,i)}if(isWebIdentityProfile(d)){return resolveWebIdentityCredentials(d,i,A)}if(isProcessProfile(d)){return resolveProcessCredentials(i,t)}if(isSsoProfile(d)){return await resolveSsoCredentials(t,d,i,A)}if(isLoginProfile(d)){return resolveLoginCredentials(t,i,A)}throw new a(`Could not resolve credentials using profile: [${t}] in configuration/credentials file(s).`,{logger:i.logger})};const fromIni=(t={})=>async({callerClientConfig:n}={})=>{t.logger?.debug("@aws-sdk/credential-provider-ini - fromIni");const i=await l(t);return resolveProfileData(c({profile:t.profile??n?.profile}),i,t,n)};n.fromIni=fromIni},4072:(t,n,i)=>{const{setCredentialFeature:a}=i(5152);const{CredentialsProviderError:A,readFile:c,parseKnownFiles:l,getProfileName:d}=i(7291);const{HttpRequest:h}=i(3422);const{createHash:f,createPrivateKey:g,createPublicKey:p,sign:m}=i(7598);const{promises:E}=i(3024);const{homedir:C}=i(8161);const{dirname:I,join:y}=i(6760);class LoginCredentialsFetcher{profileData;init;callerClientConfig;static REFRESH_THRESHOLD=5*60*1e3;constructor(t,n,i){this.profileData=t;this.init=n;this.callerClientConfig=i}async loadCredentials(){const t=await this.loadToken();if(!t){throw new A(`Failed to load a token for session ${this.loginSession}, please re-authenticate using aws login`,{tryNextLink:false,logger:this.logger})}const n=t.accessToken;const i=Date.now();const a=new Date(n.expiresAt).getTime();const c=a-i;if(c<=LoginCredentialsFetcher.REFRESH_THRESHOLD){return this.refresh(t)}return{accessKeyId:n.accessKeyId,secretAccessKey:n.secretAccessKey,sessionToken:n.sessionToken,accountId:n.accountId,expiration:new Date(n.expiresAt)}}get logger(){return this.init?.logger}get loginSession(){return this.profileData.login_session}async refresh(t){const{SigninClient:n,CreateOAuth2TokenCommand:a}=i(9762);const{logger:c,userAgentAppId:l}=this.callerClientConfig??{};const isH2=t=>t?.metadata?.handlerProtocol==="h2";const d=isH2(this.callerClientConfig?.requestHandler)?undefined:this.callerClientConfig?.requestHandler;const h=this.profileData.region??await(this.callerClientConfig?.region?.())??process.env.AWS_REGION;const f=new n({credentials:{accessKeyId:"",secretAccessKey:""},region:h,requestHandler:d,logger:c,userAgentAppId:l,...this.init?.clientConfig});this.createDPoPInterceptor(f.middlewareStack);const g={tokenInput:{clientId:t.clientId,refreshToken:t.refreshToken,grantType:"refresh_token"}};try{const n=await f.send(new a(g));const{accessKeyId:i,secretAccessKey:c,sessionToken:l}=n.tokenOutput?.accessToken??{};const{refreshToken:d,expiresIn:h}=n.tokenOutput??{};if(!i||!c||!l||!d){throw new A("Token refresh response missing required fields",{logger:this.logger,tryNextLink:false})}const p=(h??900)*1e3;const m=new Date(Date.now()+p);const E={...t,accessToken:{...t.accessToken,accessKeyId:i,secretAccessKey:c,sessionToken:l,expiresAt:m.toISOString()},refreshToken:d};await this.saveToken(E);const C=E.accessToken;return{accessKeyId:C.accessKeyId,secretAccessKey:C.secretAccessKey,sessionToken:C.sessionToken,accountId:C.accountId,expiration:m}}catch(t){if(t.name==="AccessDeniedException"){const n=t.error;let i;switch(n){case"TOKEN_EXPIRED":i="Your session has expired. Please reauthenticate.";break;case"USER_CREDENTIALS_CHANGED":i="Unable to refresh credentials because of a change in your password. Please reauthenticate with your new password.";break;case"INSUFFICIENT_PERMISSIONS":i="Unable to refresh credentials due to insufficient permissions. You may be missing permission for the 'CreateOAuth2Token' action.";break;default:i=`Failed to refresh token: ${String(t)}. Please re-authenticate using \`aws login\``}throw new A(i,{logger:this.logger,tryNextLink:false})}throw new A(`Failed to refresh token: ${String(t)}. Please re-authenticate using aws login`,{logger:this.logger})}}async loadToken(){const t=this.getTokenFilePath();try{let n;try{n=await c(t,{ignoreCache:this.init?.ignoreCache})}catch{n=await E.readFile(t,"utf8")}const i=JSON.parse(n);const a=["accessToken","clientId","refreshToken","dpopKey"].filter(t=>!i[t]);if(!i.accessToken?.accountId){a.push("accountId")}if(a.length>0){throw new A(`Token validation failed, missing fields: ${a.join(", ")}`,{logger:this.logger,tryNextLink:false})}return i}catch(n){throw new A(`Failed to load token from ${t}: ${String(n)}`,{logger:this.logger,tryNextLink:false})}}async saveToken(t){const n=this.getTokenFilePath();const i=I(n);try{await E.mkdir(i,{recursive:true})}catch(t){}await E.writeFile(n,JSON.stringify(t,null,2),"utf8")}getTokenFilePath(){const t=process.env.AWS_LOGIN_CACHE_DIRECTORY??y(C(),".aws","login","cache");const n=Buffer.from(this.loginSession,"utf8");const i=f("sha256").update(n).digest("hex");return y(t,`${i}.json`)}derToRawSignature(t){let n=2;if(t[n]!==2){throw new Error("Invalid DER signature")}n++;const i=t[n++];let a=t.subarray(n,n+i);n+=i;if(t[n]!==2){throw new Error("Invalid DER signature")}n++;const A=t[n++];let c=t.subarray(n,n+A);a=a[0]===0?a.subarray(1):a;c=c[0]===0?c.subarray(1):c;const l=Buffer.concat([Buffer.alloc(32-a.length),a]);const d=Buffer.concat([Buffer.alloc(32-c.length),c]);return Buffer.concat([l,d])}createDPoPInterceptor(t){t.add(t=>async n=>{if(h.isInstance(n.request)){const t=n.request;const i=`${t.protocol}//${t.hostname}${t.port?`:${t.port}`:""}${t.path}`;const a=await this.generateDpop(t.method,i);t.headers={...t.headers,DPoP:a}}return t(n)},{step:"finalizeRequest",name:"dpopInterceptor",override:true})}async generateDpop(t="POST",n){const i=await this.loadToken();try{const a=g({key:i.dpopKey,format:"pem",type:"sec1"});const A=p(a);const c=A.export({format:"der",type:"spki"});let l=-1;for(let t=0;tasync({callerClientConfig:n}={})=>{t?.logger?.debug?.("@aws-sdk/credential-providers - fromLoginCredentials");const i=await l(t||{});const c=d({profile:t?.profile??n?.profile});const h=i[c];if(!h?.login_session){throw new A(`Profile ${c} does not contain login_session.`,{tryNextLink:true,logger:t?.logger})}const f=new LoginCredentialsFetcher(h,t,n);const g=await f.loadCredentials();return a(g,"CREDENTIALS_LOGIN","AD")};n.fromLoginCredentials=fromLoginCredentials},5861:(t,n,i)=>{const{ENV_KEY:a,ENV_SECRET:A,fromEnv:c}=i(5606);const{chain:l,CredentialsProviderError:d,ENV_PROFILE:h}=i(7291);const f="AWS_EC2_METADATA_DISABLED";const remoteProvider=async t=>{const{ENV_CMDS_FULL_URI:n,ENV_CMDS_RELATIVE_URI:a,fromContainerMetadata:A,fromInstanceMetadata:c}=i(566);if(process.env[a]||process.env[n]){t.logger?.debug("@aws-sdk/credential-provider-node - remoteProvider::fromHttp/fromContainerMetadata");const{fromHttp:n}=i(8605);return l(n(t),A(t))}if(process.env[f]&&process.env[f]!=="false"){return async()=>{throw new d("EC2 Instance Metadata Service access disabled",{logger:t.logger})}}t.logger?.debug("@aws-sdk/credential-provider-node - remoteProvider::fromInstanceMetadata");return c(t)};function memoizeChain(t,n){const i=internalCreateChain(t);let a;let A;let c;let l;const provider=async t=>{if(t?.forceRefresh){if(!l){l=i(t).then(t=>{c=t}).finally(()=>{l=undefined})}await l;return c}if(c?.expiration){if(c?.expiration?.getTime(){c=t}).finally(()=>{A=undefined})}}else{a=i(t).then(t=>{c=t}).finally(()=>{a=undefined});return provider(t)}}return c};return provider}const internalCreateChain=t=>async n=>{let i;for(const a of t){try{return await a(n)}catch(t){i=t;if(t?.tryNextLink){continue}throw t}}throw i};let g=false;const defaultProvider=(t={})=>memoizeChain([async()=>{const n=t.profile??process.env[h];if(n){const n=process.env[a]&&process.env[A];if(n){if(!g){const n=t.logger?.warn&&t.logger?.constructor?.name!=="NoOpLogger"?t.logger.warn.bind(t.logger):console.warn;n(`@aws-sdk/credential-provider-node - defaultProvider::fromEnv WARNING:\n Multiple credential sources detected: \n Both AWS_PROFILE and the pair AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY static credentials are set.\n This SDK will proceed with the AWS_PROFILE value.\n \n However, a future version may change this behavior to prefer the ENV static credentials.\n Please ensure that your environment only sets either the AWS_PROFILE or the\n AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY pair.\n`);g=true}}throw new d("AWS_PROFILE is set, skipping fromEnv provider.",{logger:t.logger,tryNextLink:true})}t.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromEnv");return c(t)()},async n=>{t.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromSSO");const{ssoStartUrl:a,ssoAccountId:A,ssoRegion:c,ssoRoleName:l,ssoSession:h}=t;if(!a&&!A&&!c&&!l&&!h){throw new d("Skipping SSO provider in default chain (inputs do not include SSO fields).",{logger:t.logger})}const{fromSSO:f}=i(998);return f(t)(n)},async n=>{t.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromIni");const{fromIni:a}=i(5869);return a(t)(n)},async n=>{t.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromProcess");const{fromProcess:a}=i(5360);return a(t)(n)},async n=>{t.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromTokenFile");const{fromTokenFile:a}=i(9956);return a(t)(n)},async()=>{t.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::remoteProvider");return(await remoteProvider(t))()},async()=>{throw new d("Could not load credentials from any providers",{tryNextLink:false,logger:t.logger})}],credentialsTreatedAsExpired);const credentialsWillNeedRefresh=t=>t?.expiration!==undefined;const credentialsTreatedAsExpired=t=>t?.expiration!==undefined&&t.expiration.getTime()-Date.now()<3e5;n.credentialsTreatedAsExpired=credentialsTreatedAsExpired;n.credentialsWillNeedRefresh=credentialsWillNeedRefresh;n.defaultProvider=defaultProvider},5360:(t,n,i)=>{const{externalDataInterceptor:a,CredentialsProviderError:A,parseKnownFiles:c,getProfileName:l}=i(7291);const{exec:d}=i(1421);const{promisify:h}=i(7975);const{setCredentialFeature:f}=i(5152);const getValidatedProcessCredentials=(t,n,i)=>{if(n.Version!==1){throw Error(`Profile ${t} credential_process did not return Version 1.`)}if(n.AccessKeyId===undefined||n.SecretAccessKey===undefined){throw Error(`Profile ${t} credential_process returned invalid credentials.`)}if(n.Expiration){const i=new Date;const a=new Date(n.Expiration);if(a{const c=n[t];if(n[t]){const l=c["credential_process"];if(l!==undefined){const c=h(a?.getTokenRecord?.().exec??d);try{const{stdout:i}=await c(l);let a;try{a=JSON.parse(i.trim())}catch{throw Error(`Profile ${t} credential_process returned invalid JSON.`)}return getValidatedProcessCredentials(t,a,n)}catch(t){throw new A(t.message,{logger:i})}}else{throw new A(`Profile ${t} did not contain credential_process.`,{logger:i})}}else{throw new A(`Profile ${t} could not be found in shared credentials file.`,{logger:i})}};const fromProcess=(t={})=>async({callerClientConfig:n}={})=>{t.logger?.debug("@aws-sdk/credential-provider-process - fromProcess");const i=await c(t);return resolveProcessCredentials(l({profile:t.profile??n?.profile}),i,t.logger)};n.fromProcess=fromProcess},998:(t,n,i)=>{const{CredentialsProviderError:a,getSSOTokenFromFile:A,getProfileName:c,parseKnownFiles:l,loadSsoSessionData:d}=i(7291);const{setCredentialFeature:h}=i(5152);const{fromSso:f}=i(5433);const isSsoProfile=t=>t&&(typeof t.sso_start_url==="string"||typeof t.sso_account_id==="string"||typeof t.sso_session==="string"||typeof t.sso_region==="string"||typeof t.sso_role_name==="string");const g=false;const resolveSSOCredentials=async({ssoStartUrl:t,ssoSession:n,ssoAccountId:c,ssoRegion:l,ssoRoleName:d,ssoClient:p,clientConfig:m,parentClientConfig:E,callerClientConfig:C,profile:I,filepath:y,configFilepath:B,ignoreCache:Q,logger:w})=>{let S;const b=`To refresh this SSO session run aws sso login with the corresponding profile.`;if(n){try{const t=await f({profile:I,filepath:y,configFilepath:B,ignoreCache:Q,clientConfig:m,parentClientConfig:E,logger:w})({callerClientConfig:C});S={accessToken:t.token,expiresAt:new Date(t.expiration).toISOString()}}catch(t){throw new a(t.message,{tryNextLink:g,logger:w})}}else{try{S=await A(t)}catch(t){throw new a(`The SSO session associated with this profile is invalid. ${b}`,{tryNextLink:g,logger:w})}}if(new Date(S.expiresAt).getTime()-Date.now()<=0){throw new a(`The SSO session associated with this profile has expired. ${b}`,{tryNextLink:g,logger:w})}const{accessToken:R}=S;const{SSOClient:v,GetRoleCredentialsCommand:k}=i(3707);const D=p||new v(Object.assign({},m??{},{logger:m?.logger??C?.logger??E?.logger,region:m?.region??l,userAgentAppId:m?.userAgentAppId??C?.userAgentAppId??E?.userAgentAppId}));let T;try{T=await D.send(new k({accountId:c,roleName:d,accessToken:R}))}catch(t){throw new a(t,{tryNextLink:g,logger:w})}const{roleCredentials:{accessKeyId:N,secretAccessKey:M,sessionToken:F,expiration:x,credentialScope:U,accountId:P}={}}=T;if(!N||!M||!F||!x){throw new a("SSO returns an invalid temporary credential.",{tryNextLink:g,logger:w})}const L={accessKeyId:N,secretAccessKey:M,sessionToken:F,expiration:new Date(x),...U&&{credentialScope:U},...P&&{accountId:P}};if(n){h(L,"CREDENTIALS_SSO","s")}else{h(L,"CREDENTIALS_SSO_LEGACY","u")}return L};const validateSsoProfile=(t,n)=>{const{sso_start_url:i,sso_account_id:A,sso_region:c,sso_role_name:l}=t;if(!i||!A||!c||!l){throw new a(`Profile is configured with invalid SSO credentials. Required parameters "sso_account_id", `+`"sso_region", "sso_role_name", "sso_start_url". Got ${Object.keys(t).join(", ")}\nReference: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sso.html`,{tryNextLink:false,logger:n})}return t};const fromSSO=(t={})=>async({callerClientConfig:n}={})=>{t.logger?.debug("@aws-sdk/credential-provider-sso - fromSSO");const{ssoStartUrl:i,ssoAccountId:A,ssoRegion:h,ssoRoleName:f,ssoSession:g}=t;const{ssoClient:p}=t;const m=c({profile:t.profile??n?.profile});if(!i&&!A&&!h&&!f&&!g){const n=await l(t);const A=n[m];if(!A){throw new a(`Profile ${m} was not found.`,{logger:t.logger})}if(!isSsoProfile(A)){throw new a(`Profile ${m} is not configured with SSO credentials.`,{logger:t.logger})}if(A?.sso_session){const n=await d(t);const c=n[A.sso_session];const l=` configurations in profile ${m} and sso-session ${A.sso_session}`;if(h&&h!==c.sso_region){throw new a(`Conflicting SSO region`+l,{tryNextLink:false,logger:t.logger})}if(i&&i!==c.sso_start_url){throw new a(`Conflicting SSO start_url`+l,{tryNextLink:false,logger:t.logger})}A.sso_region=c.sso_region;A.sso_start_url=c.sso_start_url}const{sso_start_url:c,sso_account_id:f,sso_region:g,sso_role_name:E,sso_session:C}=validateSsoProfile(A,t.logger);return resolveSSOCredentials({ssoStartUrl:c,ssoSession:C,ssoAccountId:f,ssoRegion:g,ssoRoleName:E,ssoClient:p,clientConfig:t.clientConfig,parentClientConfig:t.parentClientConfig,callerClientConfig:t.callerClientConfig,profile:m,filepath:t.filepath,configFilepath:t.configFilepath,ignoreCache:t.ignoreCache,logger:t.logger})}else if(!i||!A||!h||!f){throw new a("Incomplete configuration. The fromSSO() argument hash must include "+'"ssoStartUrl", "ssoAccountId", "ssoRegion", "ssoRoleName"',{tryNextLink:false,logger:t.logger})}else{return resolveSSOCredentials({ssoStartUrl:i,ssoSession:g,ssoAccountId:A,ssoRegion:h,ssoRoleName:f,ssoClient:p,clientConfig:t.clientConfig,parentClientConfig:t.parentClientConfig,callerClientConfig:t.callerClientConfig,profile:m,filepath:t.filepath,configFilepath:t.configFilepath,ignoreCache:t.ignoreCache,logger:t.logger})}};n.fromSSO=fromSSO;n.isSsoProfile=isSsoProfile;n.validateSsoProfile=validateSsoProfile},3707:(t,n,i)=>{const{GetRoleCredentialsCommand:a,SSOClient:A}=i(2579);n.GetRoleCredentialsCommand=a;n.SSOClient=A},9956:(t,n,i)=>{const{setCredentialFeature:a}=i(5152);const{CredentialsProviderError:A,externalDataInterceptor:c}=i(7291);const{readFileSync:l}=i(3024);const fromWebToken=t=>async n=>{t.logger?.debug("@aws-sdk/credential-provider-web-identity - fromWebToken");const{roleArn:a,roleSessionName:A,webIdentityToken:c,providerId:l,policyArns:d,policy:h,durationSeconds:f}=t;let{roleAssumerWithWebIdentity:g}=t;if(!g){const{getDefaultRoleAssumerWithWebIdentity:a}=i(1136);g=a({...t.clientConfig,credentialProviderLogger:t.logger,parentClientConfig:{...n?.callerClientConfig,...t.parentClientConfig}},t.clientPlugins)}return g({RoleArn:a,RoleSessionName:A??`aws-sdk-js-session-${Date.now()}`,WebIdentityToken:c,ProviderId:l,PolicyArns:d,Policy:h,DurationSeconds:f})};const d="AWS_WEB_IDENTITY_TOKEN_FILE";const h="AWS_ROLE_ARN";const f="AWS_ROLE_SESSION_NAME";const fromTokenFile=(t={})=>async n=>{t.logger?.debug("@aws-sdk/credential-provider-web-identity - fromTokenFile");const i=t?.webIdentityTokenFile??process.env[d];const g=t?.roleArn??process.env[h];const p=t?.roleSessionName??process.env[f];if(!i||!g){throw new A("Web identity configuration not specified",{logger:t.logger})}const m=await fromWebToken({...t,webIdentityToken:c?.getTokenRecord?.()[i]??l(i,{encoding:"ascii"}),roleArn:g,roleSessionName:p})(n);if(i===process.env[d]){a(m,"CREDENTIALS_ENV_VARS_STS_WEB_ID_TOKEN","h")}return m};n.fromTokenFile=fromTokenFile;n.fromWebToken=fromWebToken},4431:(t,n,i)=>{const a=i(9214);class EndpointCache{cache;constructor(t){this.cache=new a(t)}getEndpoint(t){const n=this.get(t);if(!n||n.length===0){return undefined}const i=n.map(t=>t.Address);return i[Math.floor(Math.random()*i.length)]}get(t){if(!this.has(t)){return}const n=this.cache.get(t);if(!n){return}const i=Date.now();const a=n.filter(t=>i({Address:t,Expires:i+n*60*1e3})))}delete(t){this.cache.set(t,[])}has(t){if(!this.cache.has(t)){return false}const n=this.cache.peek(t);if(!n){return false}return n.length>0}clear(){this.cache.clear()}}n.EndpointCache=EndpointCache},3688:(t,n,i)=>{const{HttpRequest:a}=i(3422);const{EndpointCache:A}=i(4431);const c=["AWS_ENABLE_ENDPOINT_DISCOVERY","AWS_ENDPOINT_DISCOVERY_ENABLED"];const l="endpoint_discovery_enabled";const isFalsy=t=>["false","0"].indexOf(t)>=0;const d={environmentVariableSelector:t=>{for(let n=0;n{if(l in t){const n=t[l];if(n===undefined){throw Error(`Shared config entry ${l} can't be undefined, got "${n}"`)}return!isFalsy(n)}},default:undefined};const getCacheKey=async(t,n,i)=>{const{accessKeyId:a}=await n.credentials();const{identifiers:A}=i;return JSON.stringify({...a&&{accessKeyId:a},...A&&{commandName:t,identifiers:Object.entries(A).sort().reduce((t,[n,i])=>({...t,[n]:i}),{})}})};const h={};const updateDiscoveredEndpointInCache=async(t,n)=>new Promise((i,a)=>{const{endpointCache:A}=t;const{cacheKey:c,commandName:l,identifiers:d}=n;const f=A.get(c);if(f&&f.length===1&&f[0].Address===""){if(n.isDiscoveredEndpointRequired){if(!h[c])h[c]=[];h[c].push({resolve:i,reject:a})}else{i()}}else if(f&&f.length>0){i()}else{const f=[{Address:"",CachePeriodInMinutes:1}];A.set(c,f);const g=new n.endpointDiscoveryCommandCtor({Operation:l.slice(0,-7),Identifiers:d});const p=g.resolveMiddleware(n.clientStack,t,n.options);p(g).then(t=>{A.set(c,t.output.Endpoints);if(h[c]){h[c].forEach(({resolve:t})=>{t()});delete h[c]}i()}).catch(t=>{A.delete(c);const l=Object.assign(new Error(`The operation to discover endpoint failed.`+` Please retry, or provide a custom endpoint and disable endpoint discovery to proceed.`),{reason:t});if(h[c]){h[c].forEach(({reject:t})=>{t(l)});delete h[c]}if(n.isDiscoveredEndpointRequired){a(l)}else{A.set(c,f);i()}})}});const endpointDiscoveryMiddleware=(t,n)=>(i,A)=>async c=>{if(t.isCustomEndpoint){if(t.isClientEndpointDiscoveryEnabled){throw new Error(`Custom endpoint is supplied; endpointDiscoveryEnabled must not be true.`)}return i(c)}const{endpointDiscoveryCommandCtor:l}=t;const{isDiscoveredEndpointRequired:d,identifiers:h}=n;const f=A.clientName;const g=A.commandName;const p=await t.endpointDiscoveryEnabled();const m=await getCacheKey(g,t,{identifiers:h});if(d){if(p===false){throw new Error(`Endpoint Discovery is disabled but ${g} on ${f} requires it.`+` Please check your configurations.`)}await updateDiscoveredEndpointInCache(t,{...n,commandName:g,cacheKey:m,endpointDiscoveryCommandCtor:l})}else if(p){updateDiscoveredEndpointInCache(t,{...n,commandName:g,cacheKey:m,endpointDiscoveryCommandCtor:l})}const{request:E}=c;if(m&&a.isInstance(E)){const n=t.endpointCache.getEndpoint(m);if(n){E.hostname=n}}return i(c)};const f={name:"endpointDiscoveryMiddleware",step:"build",tags:["ENDPOINT_DISCOVERY"],override:true};const getEndpointDiscoveryPlugin=(t,n)=>({applyToStack:i=>{i.add(endpointDiscoveryMiddleware(t,n),f)}});const getEndpointDiscoveryRequiredPlugin=(t,n)=>({applyToStack:i=>{i.add(endpointDiscoveryMiddleware(t,{...n,isDiscoveredEndpointRequired:true}),f)}});const getEndpointDiscoveryOptionalPlugin=(t,n)=>({applyToStack:i=>{i.add(endpointDiscoveryMiddleware(t,{...n,isDiscoveredEndpointRequired:false}),f)}});const resolveEndpointDiscoveryConfig=(t,{endpointDiscoveryCommandCtor:n})=>{const{endpointCacheSize:i,endpointDiscoveryEnabled:a,endpointDiscoveryEnabledProvider:c}=t;return Object.assign(t,{endpointDiscoveryCommandCtor:n,endpointCache:new A(i??1e3),endpointDiscoveryEnabled:a!==undefined?()=>Promise.resolve(a):c,isClientEndpointDiscoveryEnabled:a!==undefined})};n.NODE_ENDPOINT_DISCOVERY_CONFIG_OPTIONS=d;n.endpointDiscoveryMiddlewareOptions=f;n.getEndpointDiscoveryOptionalPlugin=getEndpointDiscoveryOptionalPlugin;n.getEndpointDiscoveryPlugin=getEndpointDiscoveryPlugin;n.getEndpointDiscoveryRequiredPlugin=getEndpointDiscoveryRequiredPlugin;n.resolveEndpointDiscoveryConfig=resolveEndpointDiscoveryConfig},9762:(t,n,i)=>{const{awsEndpointFunctions:a,emitWarningIfUnsupportedVersion:A,createDefaultUserAgentProvider:c,NODE_APP_ID_CONFIG_OPTIONS:l,getAwsRegionExtensionConfiguration:d,resolveAwsRegionExtensionConfiguration:h,resolveUserAgentConfig:f,resolveHostHeaderConfig:g,getUserAgentPlugin:p,getHostHeaderPlugin:m,getLoggerPlugin:E,getRecursionDetectionPlugin:C}=i(5152);const{NoAuthSigner:I,getHttpAuthSchemeEndpointRuleSetPlugin:y,DefaultIdentityProviderConfig:B,getHttpSigningPlugin:Q}=i(402);const{normalizeProvider:w,getSmithyContext:S,ServiceException:b,NoOpLogger:R,emitWarningIfUnsupportedVersion:v,loadConfigsForDefaultMode:k,getDefaultExtensionConfiguration:D,resolveDefaultRuntimeConfig:T,Client:N,Command:M,createAggregatedClient:F}=i(2658);n.$Command=M;n.__Client=N;const{resolveDefaultsModeConfig:x,loadConfig:U,NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS:P,NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS:L,NODE_REGION_CONFIG_OPTIONS:O,NODE_REGION_CONFIG_FILE_OPTIONS:H,resolveRegionConfig:$}=i(7291);const{BinaryDecisionDiagram:G,EndpointCache:V,decideEndpoint:Y,customEndpointFunctions:J,resolveEndpointConfig:W,getEndpointPlugin:q}=i(2085);const{parseUrl:j,getHttpHandlerExtensionConfiguration:z,resolveHttpHandlerRuntimeConfig:K,getContentLengthPlugin:Z}=i(3422);const{DEFAULT_RETRY_MODE:X,NODE_RETRY_MODE_CONFIG_OPTIONS:ee,NODE_MAX_ATTEMPT_CONFIG_OPTIONS:te,resolveRetryConfig:re,getRetryPlugin:ne}=i(3609);const{TypeRegistry:se,getSchemaSerdePlugin:oe}=i(6890);const{resolveAwsSdkSigV4Config:ie,AwsSdkSigV4Signer:ae,NODE_AUTH_SCHEME_PREFERENCE_OPTIONS:Ae}=i(7523);const{toUtf8:ce,fromUtf8:le,toBase64:ue,fromBase64:de,calculateBodyLength:he}=i(2430);const{streamCollector:fe,NodeHttpHandler:ge}=i(1279);const{AwsRestJsonProtocol:pe}=i(7288);const{Sha256:me}=i(9542);const defaultSigninHttpAuthSchemeParametersProvider=async(t,n,i)=>({operation:S(n).operation,region:await w(t.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});function createAwsAuthSigv4HttpAuthOption(t){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"signin",region:t.region},propertiesExtractor:(t,n)=>({signingProperties:{config:t,context:n}})}}function createSmithyApiNoAuthHttpAuthOption(t){return{schemeId:"smithy.api#noAuth"}}const defaultSigninHttpAuthSchemeProvider=t=>{const n=[];switch(t.operation){case"CreateOAuth2Token":{n.push(createSmithyApiNoAuthHttpAuthOption());break}default:{n.push(createAwsAuthSigv4HttpAuthOption(t))}}return n};const resolveHttpAuthSchemeConfig=t=>{const n=ie(t);return Object.assign(n,{authSchemePreference:w(t.authSchemePreference??[])})};const resolveClientEndpointParameters=t=>Object.assign(t,{useDualstackEndpoint:t.useDualstackEndpoint??false,useFipsEndpoint:t.useFipsEndpoint??false,defaultSigningName:"signin"});const Ee={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}};var Ce="3.997.24";var Ie={version:Ce};const ye="ref";const Be=-1,Qe=true,we="isSet",Se="booleanEquals",be="PartitionResult",Re="stringEquals",ve="getAttr",ke="https://signin.{Region}.{PartitionResult#dualStackDnsSuffix}",De={[ye]:"Endpoint"},Te={fn:ve,argv:[{[ye]:be},"name"]},Ne={[ye]:be},Me={[ye]:"Region"},Fe={authSchemes:[{name:"sigv4",signingName:"signin",signingRegion:"{Region}"}]},xe={},Ue=[Me];const Pe={conditions:[[we,Ue],[Se,[{fn:"coalesce",argv:[{[ye]:"IsControlPlane"},false]},Qe]],[we,[De]],["aws.partition",Ue,be],[Se,[{[ye]:"UseFIPS"},Qe]],[Se,[{[ye]:"UseDualStack"},Qe]],[Re,[Te,"aws"]],[Re,[Te,"aws-cn"]],[Se,[{fn:ve,argv:[Ne,"supportsDualStack"]},Qe]],[Re,[Me,"us-gov-west-1"]],[Re,[Te,"aws-us-gov"]],[Se,[{fn:ve,argv:[Ne,"supportsFIPS"]},Qe]],[Re,[Te,"aws-iso"]],[Re,[Te,"aws-iso-b"]],[Re,[Te,"aws-iso-f"]],[Re,[Te,"aws-iso-e"]],[Re,[Te,"aws-eusc"]]],results:[[Be],["https://signin.{Region}.api.aws",Fe],["https://signin.{Region}.api.amazonwebservices.com.cn",Fe],[ke,Fe],["https://{Region}.signin.aws.amazon.com",xe],["https://{Region}.signin.amazonaws.cn",xe],["https://{Region}.signin.amazonaws-us-gov.com",xe],["https://{Region}.signin.c2shome.ic.gov",xe],["https://{Region}.signin.sc2shome.sgov.gov",xe],["https://{Region}.signin.csphome.hci.ic.gov",xe],["https://{Region}.signin.csphome.adc-e.uk",xe],["https://{Region}.signin.amazonaws-eusc.eu",xe],["https://signin-fips.amazonaws-us-gov.com",xe],["https://{Region}.signin-fips.amazonaws-us-gov.com",xe],["https://{Region}.signin.{PartitionResult#dnsSuffix}",xe],[Be,"Invalid Configuration: FIPS and custom endpoint are not supported"],[Be,"Invalid Configuration: Dualstack and custom endpoint are not supported"],[De,xe],["https://signin-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",xe],[Be,"FIPS and DualStack are enabled, but this partition does not support one or both"],["https://signin-fips.{Region}.{PartitionResult#dnsSuffix}",xe],[Be,"FIPS is enabled but this partition does not support FIPS"],[ke,xe],[Be,"DualStack is enabled but this partition does not support DualStack"],["https://signin.{Region}.{PartitionResult#dnsSuffix}",xe],[Be,"Invalid Configuration: Missing Region"]]};const Le=2;const _e=1e8;const Oe=new Int32Array([-1,1,-1,0,4,3,2,30,_e+25,1,24,5,2,30,6,3,7,26,4,18,8,5,17,9,6,_e+4,10,7,_e+5,11,10,_e+6,12,12,_e+7,13,13,_e+8,14,14,_e+9,15,15,_e+10,16,16,_e+11,_e+14,8,_e+22,_e+23,5,22,19,9,_e+12,20,10,_e+13,21,11,_e+20,_e+21,8,23,_e+19,11,_e+18,_e+19,2,29,25,3,32,26,4,27,_e+25,5,_e+25,28,9,_e+12,_e+25,3,32,30,4,_e+15,31,5,_e+16,_e+17,6,_e+1,33,7,_e+2,_e+3]);const He=G.from(Oe,Le,Pe.conditions,Pe.results);const $e=new V({size:50,params:["Endpoint","IsControlPlane","Region","UseDualStack","UseFIPS"]});const defaultEndpointResolver=(t,n={})=>$e.get(t,()=>Y(He,{endpointParams:t,logger:n.logger}));J.aws=a;class SigninServiceException extends b{constructor(t){super(t);Object.setPrototypeOf(this,SigninServiceException.prototype)}}class AccessDeniedException extends SigninServiceException{name="AccessDeniedException";$fault="client";error;constructor(t){super({name:"AccessDeniedException",$fault:"client",...t});Object.setPrototypeOf(this,AccessDeniedException.prototype);this.error=t.error}}class InternalServerException extends SigninServiceException{name="InternalServerException";$fault="server";error;constructor(t){super({name:"InternalServerException",$fault:"server",...t});Object.setPrototypeOf(this,InternalServerException.prototype);this.error=t.error}}class TooManyRequestsError extends SigninServiceException{name="TooManyRequestsError";$fault="client";error;constructor(t){super({name:"TooManyRequestsError",$fault:"client",...t});Object.setPrototypeOf(this,TooManyRequestsError.prototype);this.error=t.error}}class ValidationException extends SigninServiceException{name="ValidationException";$fault="client";error;constructor(t){super({name:"ValidationException",$fault:"client",...t});Object.setPrototypeOf(this,ValidationException.prototype);this.error=t.error}}const Ge="AccessDeniedException";const Ve="AccessToken";const Ye="CreateOAuth2Token";const Je="CreateOAuth2TokenRequest";const We="CreateOAuth2TokenRequestBody";const qe="CreateOAuth2TokenResponseBody";const je="CreateOAuth2TokenResponse";const ze="InternalServerException";const Ke="RefreshToken";const Ze="TooManyRequestsError";const Xe="ValidationException";const et="accessKeyId";const tt="accessToken";const rt="client";const nt="clientId";const st="codeVerifier";const ot="code";const it="error";const at="expiresIn";const At="grantType";const ct="http";const lt="httpError";const ut="idToken";const dt="jsonName";const ht="message";const ft="refreshToken";const gt="redirectUri";const pt="smithy.ts.sdk.synthetic.com.amazonaws.signin";const mt="secretAccessKey";const Et="sessionToken";const Ct="server";const It="tokenInput";const yt="tokenOutput";const Bt="tokenType";const Qt="com.amazonaws.signin";const wt=se.for(pt);var St=[-3,pt,"SigninServiceException",0,[],[]];wt.registerError(St,SigninServiceException);const bt=se.for(Qt);var Rt=[-3,Qt,Ge,{[it]:rt},[it,ht],[0,0],2];bt.registerError(Rt,AccessDeniedException);var vt=[-3,Qt,ze,{[it]:Ct,[lt]:500},[it,ht],[0,0],2];bt.registerError(vt,InternalServerException);var kt=[-3,Qt,Ze,{[it]:rt,[lt]:429},[it,ht],[0,0],2];bt.registerError(kt,TooManyRequestsError);var Dt=[-3,Qt,Xe,{[it]:rt,[lt]:400},[it,ht],[0,0],2];bt.registerError(Dt,ValidationException);const Tt=[wt,bt];var Nt=[0,Qt,Ke,8,0];var Mt=[3,Qt,Ve,8,[et,mt,Et],[[0,{[dt]:et}],[0,{[dt]:mt}],[0,{[dt]:Et}]],3];var Ft=[3,Qt,Je,0,[It],[[()=>xt,16]],1];var xt=[3,Qt,We,0,[nt,At,ot,gt,st,ft],[[0,{[dt]:nt}],[0,{[dt]:At}],0,[0,{[dt]:gt}],[0,{[dt]:st}],[()=>Nt,{[dt]:ft}]],2];var Ut=[3,Qt,je,0,[yt],[[()=>Pt,16]],1];var Pt=[3,Qt,qe,0,[tt,Bt,at,ft,ut],[[()=>Mt,{[dt]:tt}],[0,{[dt]:Bt}],[1,{[dt]:at}],[()=>Nt,{[dt]:ft}],[0,{[dt]:ut}]],4];var Lt=[9,Qt,Ye,{[ct]:["POST","/v1/token",200]},()=>Ft,()=>Ut];const getRuntimeConfig$1=t=>({apiVersion:"2023-01-01",base64Decoder:t?.base64Decoder??de,base64Encoder:t?.base64Encoder??ue,disableHostPrefix:t?.disableHostPrefix??false,endpointProvider:t?.endpointProvider??defaultEndpointResolver,extensions:t?.extensions??[],httpAuthSchemeProvider:t?.httpAuthSchemeProvider??defaultSigninHttpAuthSchemeProvider,httpAuthSchemes:t?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:t=>t.getIdentityProvider("aws.auth#sigv4"),signer:new ae},{schemeId:"smithy.api#noAuth",identityProvider:t=>t.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new I}],logger:t?.logger??new R,protocol:t?.protocol??pe,protocolSettings:t?.protocolSettings??{defaultNamespace:"com.amazonaws.signin",errorTypeRegistries:Tt,version:"2023-01-01",serviceTarget:"Signin"},serviceId:t?.serviceId??"Signin",sha256:t?.sha256??me,urlParser:t?.urlParser??j,utf8Decoder:t?.utf8Decoder??le,utf8Encoder:t?.utf8Encoder??ce});const getRuntimeConfig=t=>{v(process.version);const n=x(t);const defaultConfigProvider=()=>n().then(k);const i=getRuntimeConfig$1(t);A(process.version);const a={profile:t?.profile,logger:i.logger};return{...i,...t,runtime:"node",defaultsMode:n,authSchemePreference:t?.authSchemePreference??U(Ae,a),bodyLengthChecker:t?.bodyLengthChecker??he,defaultUserAgentProvider:t?.defaultUserAgentProvider??c({serviceId:i.serviceId,clientVersion:Ie.version}),maxAttempts:t?.maxAttempts??U(te,t),region:t?.region??U(O,{...H,...a}),requestHandler:ge.create(t?.requestHandler??defaultConfigProvider),retryMode:t?.retryMode??U({...ee,default:async()=>(await defaultConfigProvider()).retryMode||X},t),streamCollector:t?.streamCollector??fe,useDualstackEndpoint:t?.useDualstackEndpoint??U(L,a),useFipsEndpoint:t?.useFipsEndpoint??U(P,a),userAgentAppId:t?.userAgentAppId??U(l,a)}};const getHttpAuthExtensionConfiguration=t=>{const n=t.httpAuthSchemes;let i=t.httpAuthSchemeProvider;let a=t.credentials;return{setHttpAuthScheme(t){const i=n.findIndex(n=>n.schemeId===t.schemeId);if(i===-1){n.push(t)}else{n.splice(i,1,t)}},httpAuthSchemes(){return n},setHttpAuthSchemeProvider(t){i=t},httpAuthSchemeProvider(){return i},setCredentials(t){a=t},credentials(){return a}}};const resolveHttpAuthRuntimeConfig=t=>({httpAuthSchemes:t.httpAuthSchemes(),httpAuthSchemeProvider:t.httpAuthSchemeProvider(),credentials:t.credentials()});const resolveRuntimeExtensions=(t,n)=>{const i=Object.assign(d(t),D(t),z(t),getHttpAuthExtensionConfiguration(t));n.forEach(t=>t.configure(i));return Object.assign(t,h(i),T(i),K(i),resolveHttpAuthRuntimeConfig(i))};class SigninClient extends N{config;constructor(...[t]){const n=getRuntimeConfig(t||{});super(n);this.initConfig=n;const i=resolveClientEndpointParameters(n);const a=f(i);const A=re(a);const c=$(A);const l=g(c);const d=W(l);const h=resolveHttpAuthSchemeConfig(d);const I=resolveRuntimeExtensions(h,t?.extensions||[]);this.config=I;this.middlewareStack.use(oe(this.config));this.middlewareStack.use(p(this.config));this.middlewareStack.use(ne(this.config));this.middlewareStack.use(Z(this.config));this.middlewareStack.use(m(this.config));this.middlewareStack.use(E(this.config));this.middlewareStack.use(C(this.config));this.middlewareStack.use(y(this.config,{httpAuthSchemeParametersProvider:defaultSigninHttpAuthSchemeParametersProvider,identityProviderConfigProvider:async t=>new B({"aws.auth#sigv4":t.credentials})}));this.middlewareStack.use(Q(this.config))}destroy(){super.destroy()}}class CreateOAuth2TokenCommand extends(M.classBuilder().ep({...Ee,IsControlPlane:{type:"staticContextParams",value:false}}).m(function(t,n,i,a){return[q(i,t.getEndpointParameterInstructions())]}).s("Signin","CreateOAuth2Token",{}).n("SigninClient","CreateOAuth2TokenCommand").sc(Lt).build()){}const _t={CreateOAuth2TokenCommand:CreateOAuth2TokenCommand};class Signin extends SigninClient{}F(_t,Signin);const Ot={AUTHCODE_EXPIRED:"AUTHCODE_EXPIRED",CONFLICT:"CONFLICT",INSUFFICIENT_PERMISSIONS:"INSUFFICIENT_PERMISSIONS",INVALID_REQUEST:"INVALID_REQUEST",RESOURCE_NOT_FOUND:"RESOURCE_NOT_FOUND",SERVER_ERROR:"server_error",SERVICE_QUOTA_EXCEEDED:"SERVICE_QUOTA_EXCEEDED",TOKEN_EXPIRED:"TOKEN_EXPIRED",USER_CREDENTIALS_CHANGED:"USER_CREDENTIALS_CHANGED"};n.AccessDeniedException=AccessDeniedException;n.AccessDeniedException$=Rt;n.AccessToken$=Mt;n.CreateOAuth2Token$=Lt;n.CreateOAuth2TokenCommand=CreateOAuth2TokenCommand;n.CreateOAuth2TokenRequest$=Ft;n.CreateOAuth2TokenRequestBody$=xt;n.CreateOAuth2TokenResponse$=Ut;n.CreateOAuth2TokenResponseBody$=Pt;n.InternalServerException=InternalServerException;n.InternalServerException$=vt;n.OAuth2ErrorCode=Ot;n.Signin=Signin;n.SigninClient=SigninClient;n.SigninServiceException=SigninServiceException;n.SigninServiceException$=St;n.TooManyRequestsError=TooManyRequestsError;n.TooManyRequestsError$=kt;n.ValidationException=ValidationException;n.ValidationException$=Dt;n.errorTypeRegistries=Tt},9443:(t,n,i)=>{const{awsEndpointFunctions:a,emitWarningIfUnsupportedVersion:A,createDefaultUserAgentProvider:c,NODE_APP_ID_CONFIG_OPTIONS:l,getAwsRegionExtensionConfiguration:d,resolveAwsRegionExtensionConfiguration:h,resolveUserAgentConfig:f,resolveHostHeaderConfig:g,getUserAgentPlugin:p,getHostHeaderPlugin:m,getLoggerPlugin:E,getRecursionDetectionPlugin:C}=i(5152);const{NoAuthSigner:I,getHttpAuthSchemeEndpointRuleSetPlugin:y,DefaultIdentityProviderConfig:B,getHttpSigningPlugin:Q}=i(402);const{normalizeProvider:w,getSmithyContext:S,ServiceException:b,NoOpLogger:R,emitWarningIfUnsupportedVersion:v,loadConfigsForDefaultMode:k,getDefaultExtensionConfiguration:D,resolveDefaultRuntimeConfig:T,Client:N,Command:M,createAggregatedClient:F}=i(2658);n.$Command=M;n.__Client=N;const{resolveDefaultsModeConfig:x,loadConfig:U,NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS:P,NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS:L,NODE_REGION_CONFIG_OPTIONS:O,NODE_REGION_CONFIG_FILE_OPTIONS:H,resolveRegionConfig:$}=i(7291);const{BinaryDecisionDiagram:G,EndpointCache:V,decideEndpoint:Y,customEndpointFunctions:J,resolveEndpointConfig:W,getEndpointPlugin:q}=i(2085);const{parseUrl:j,getHttpHandlerExtensionConfiguration:z,resolveHttpHandlerRuntimeConfig:K,getContentLengthPlugin:Z}=i(3422);const{DEFAULT_RETRY_MODE:X,NODE_RETRY_MODE_CONFIG_OPTIONS:ee,NODE_MAX_ATTEMPT_CONFIG_OPTIONS:te,resolveRetryConfig:re,getRetryPlugin:ne}=i(3609);const{TypeRegistry:se,getSchemaSerdePlugin:oe}=i(6890);const{resolveAwsSdkSigV4Config:ie,AwsSdkSigV4Signer:ae,NODE_AUTH_SCHEME_PREFERENCE_OPTIONS:Ae}=i(7523);const{toUtf8:ce,fromUtf8:le,toBase64:ue,fromBase64:de,calculateBodyLength:he}=i(2430);const{streamCollector:fe,NodeHttpHandler:ge}=i(1279);const{AwsRestJsonProtocol:pe}=i(7288);const{Sha256:me}=i(9542);const defaultSSOOIDCHttpAuthSchemeParametersProvider=async(t,n,i)=>({operation:S(n).operation,region:await w(t.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});function createAwsAuthSigv4HttpAuthOption(t){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"sso-oauth",region:t.region},propertiesExtractor:(t,n)=>({signingProperties:{config:t,context:n}})}}function createSmithyApiNoAuthHttpAuthOption(t){return{schemeId:"smithy.api#noAuth"}}const defaultSSOOIDCHttpAuthSchemeProvider=t=>{const n=[];switch(t.operation){case"CreateToken":{n.push(createSmithyApiNoAuthHttpAuthOption());break}default:{n.push(createAwsAuthSigv4HttpAuthOption(t))}}return n};const resolveHttpAuthSchemeConfig=t=>{const n=ie(t);return Object.assign(n,{authSchemePreference:w(t.authSchemePreference??[])})};const resolveClientEndpointParameters=t=>Object.assign(t,{useDualstackEndpoint:t.useDualstackEndpoint??false,useFipsEndpoint:t.useFipsEndpoint??false,defaultSigningName:"sso-oauth"});const Ee={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}};var Ce="3.997.24";var Ie={version:Ce};const ye="ref";const Be=-1,Qe=true,we="isSet",Se="PartitionResult",be="booleanEquals",Re="getAttr",ve={[ye]:"Endpoint"},ke={[ye]:Se},De={},Te=[{[ye]:"Region"}];const Ne={conditions:[[we,[ve]],[we,Te],["aws.partition",Te,Se],[be,[{[ye]:"UseFIPS"},Qe]],[be,[{[ye]:"UseDualStack"},Qe]],[be,[{fn:Re,argv:[ke,"supportsDualStack"]},Qe]],[be,[{fn:Re,argv:[ke,"supportsFIPS"]},Qe]],["stringEquals",[{fn:Re,argv:[ke,"name"]},"aws-us-gov"]]],results:[[Be],[Be,"Invalid Configuration: FIPS and custom endpoint are not supported"],[Be,"Invalid Configuration: Dualstack and custom endpoint are not supported"],[ve,De],["https://oidc-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",De],[Be,"FIPS and DualStack are enabled, but this partition does not support one or both"],["https://oidc.{Region}.amazonaws.com",De],["https://oidc-fips.{Region}.{PartitionResult#dnsSuffix}",De],[Be,"FIPS is enabled but this partition does not support FIPS"],["https://oidc.{Region}.{PartitionResult#dualStackDnsSuffix}",De],[Be,"DualStack is enabled but this partition does not support DualStack"],["https://oidc.{Region}.{PartitionResult#dnsSuffix}",De],[Be,"Invalid Configuration: Missing Region"]]};const Me=2;const Fe=1e8;const xe=new Int32Array([-1,1,-1,0,13,3,1,4,Fe+12,2,5,Fe+12,3,8,6,4,7,Fe+11,5,Fe+9,Fe+10,4,11,9,6,10,Fe+8,7,Fe+6,Fe+7,5,12,Fe+5,6,Fe+4,Fe+5,3,Fe+1,14,4,Fe+2,Fe+3]);const Ue=G.from(xe,Me,Ne.conditions,Ne.results);const Pe=new V({size:50,params:["Endpoint","Region","UseDualStack","UseFIPS"]});const defaultEndpointResolver=(t,n={})=>Pe.get(t,()=>Y(Ue,{endpointParams:t,logger:n.logger}));J.aws=a;class SSOOIDCServiceException extends b{constructor(t){super(t);Object.setPrototypeOf(this,SSOOIDCServiceException.prototype)}}class AccessDeniedException extends SSOOIDCServiceException{name="AccessDeniedException";$fault="client";error;reason;error_description;constructor(t){super({name:"AccessDeniedException",$fault:"client",...t});Object.setPrototypeOf(this,AccessDeniedException.prototype);this.error=t.error;this.reason=t.reason;this.error_description=t.error_description}}class AuthorizationPendingException extends SSOOIDCServiceException{name="AuthorizationPendingException";$fault="client";error;error_description;constructor(t){super({name:"AuthorizationPendingException",$fault:"client",...t});Object.setPrototypeOf(this,AuthorizationPendingException.prototype);this.error=t.error;this.error_description=t.error_description}}class ExpiredTokenException extends SSOOIDCServiceException{name="ExpiredTokenException";$fault="client";error;error_description;constructor(t){super({name:"ExpiredTokenException",$fault:"client",...t});Object.setPrototypeOf(this,ExpiredTokenException.prototype);this.error=t.error;this.error_description=t.error_description}}class InternalServerException extends SSOOIDCServiceException{name="InternalServerException";$fault="server";error;error_description;constructor(t){super({name:"InternalServerException",$fault:"server",...t});Object.setPrototypeOf(this,InternalServerException.prototype);this.error=t.error;this.error_description=t.error_description}}class InvalidClientException extends SSOOIDCServiceException{name="InvalidClientException";$fault="client";error;error_description;constructor(t){super({name:"InvalidClientException",$fault:"client",...t});Object.setPrototypeOf(this,InvalidClientException.prototype);this.error=t.error;this.error_description=t.error_description}}class InvalidGrantException extends SSOOIDCServiceException{name="InvalidGrantException";$fault="client";error;error_description;constructor(t){super({name:"InvalidGrantException",$fault:"client",...t});Object.setPrototypeOf(this,InvalidGrantException.prototype);this.error=t.error;this.error_description=t.error_description}}class InvalidRequestException extends SSOOIDCServiceException{name="InvalidRequestException";$fault="client";error;reason;error_description;constructor(t){super({name:"InvalidRequestException",$fault:"client",...t});Object.setPrototypeOf(this,InvalidRequestException.prototype);this.error=t.error;this.reason=t.reason;this.error_description=t.error_description}}class InvalidScopeException extends SSOOIDCServiceException{name="InvalidScopeException";$fault="client";error;error_description;constructor(t){super({name:"InvalidScopeException",$fault:"client",...t});Object.setPrototypeOf(this,InvalidScopeException.prototype);this.error=t.error;this.error_description=t.error_description}}class SlowDownException extends SSOOIDCServiceException{name="SlowDownException";$fault="client";error;error_description;constructor(t){super({name:"SlowDownException",$fault:"client",...t});Object.setPrototypeOf(this,SlowDownException.prototype);this.error=t.error;this.error_description=t.error_description}}class UnauthorizedClientException extends SSOOIDCServiceException{name="UnauthorizedClientException";$fault="client";error;error_description;constructor(t){super({name:"UnauthorizedClientException",$fault:"client",...t});Object.setPrototypeOf(this,UnauthorizedClientException.prototype);this.error=t.error;this.error_description=t.error_description}}class UnsupportedGrantTypeException extends SSOOIDCServiceException{name="UnsupportedGrantTypeException";$fault="client";error;error_description;constructor(t){super({name:"UnsupportedGrantTypeException",$fault:"client",...t});Object.setPrototypeOf(this,UnsupportedGrantTypeException.prototype);this.error=t.error;this.error_description=t.error_description}}const Le="AccessDeniedException";const _e="AuthorizationPendingException";const Oe="AccessToken";const He="ClientSecret";const $e="CreateToken";const Ge="CreateTokenRequest";const Ve="CreateTokenResponse";const Ye="CodeVerifier";const Je="ExpiredTokenException";const We="InvalidClientException";const qe="InvalidGrantException";const je="InvalidRequestException";const ze="InternalServerException";const Ke="InvalidScopeException";const Ze="IdToken";const Xe="RefreshToken";const et="SlowDownException";const tt="UnauthorizedClientException";const rt="UnsupportedGrantTypeException";const nt="accessToken";const st="client";const ot="clientId";const it="clientSecret";const at="codeVerifier";const At="code";const ct="deviceCode";const lt="error";const ut="expiresIn";const dt="error_description";const ht="grantType";const ft="http";const gt="httpError";const pt="idToken";const mt="reason";const Et="refreshToken";const Ct="redirectUri";const It="smithy.ts.sdk.synthetic.com.amazonaws.ssooidc";const yt="scope";const Bt="server";const Qt="tokenType";const wt="com.amazonaws.ssooidc";const St=se.for(It);var bt=[-3,It,"SSOOIDCServiceException",0,[],[]];St.registerError(bt,SSOOIDCServiceException);const Rt=se.for(wt);var vt=[-3,wt,Le,{[lt]:st,[gt]:400},[lt,mt,dt],[0,0,0]];Rt.registerError(vt,AccessDeniedException);var kt=[-3,wt,_e,{[lt]:st,[gt]:400},[lt,dt],[0,0]];Rt.registerError(kt,AuthorizationPendingException);var Dt=[-3,wt,Je,{[lt]:st,[gt]:400},[lt,dt],[0,0]];Rt.registerError(Dt,ExpiredTokenException);var Tt=[-3,wt,ze,{[lt]:Bt,[gt]:500},[lt,dt],[0,0]];Rt.registerError(Tt,InternalServerException);var Nt=[-3,wt,We,{[lt]:st,[gt]:401},[lt,dt],[0,0]];Rt.registerError(Nt,InvalidClientException);var Mt=[-3,wt,qe,{[lt]:st,[gt]:400},[lt,dt],[0,0]];Rt.registerError(Mt,InvalidGrantException);var Ft=[-3,wt,je,{[lt]:st,[gt]:400},[lt,mt,dt],[0,0,0]];Rt.registerError(Ft,InvalidRequestException);var xt=[-3,wt,Ke,{[lt]:st,[gt]:400},[lt,dt],[0,0]];Rt.registerError(xt,InvalidScopeException);var Ut=[-3,wt,et,{[lt]:st,[gt]:400},[lt,dt],[0,0]];Rt.registerError(Ut,SlowDownException);var Pt=[-3,wt,tt,{[lt]:st,[gt]:400},[lt,dt],[0,0]];Rt.registerError(Pt,UnauthorizedClientException);var Lt=[-3,wt,rt,{[lt]:st,[gt]:400},[lt,dt],[0,0]];Rt.registerError(Lt,UnsupportedGrantTypeException);const _t=[St,Rt];var Ot=[0,wt,Oe,8,0];var Ht=[0,wt,He,8,0];var $t=[0,wt,Ye,8,0];var Gt=[0,wt,Ze,8,0];var Vt=[0,wt,Xe,8,0];var Yt=[3,wt,Ge,0,[ot,it,ht,ct,At,Et,yt,Ct,at],[0,[()=>Ht,0],0,0,0,[()=>Vt,0],64|0,0,[()=>$t,0]],3];var Jt=[3,wt,Ve,0,[nt,Qt,ut,Et,pt],[[()=>Ot,0],0,1,[()=>Vt,0],[()=>Gt,0]]];var Wt=[9,wt,$e,{[ft]:["POST","/token",200]},()=>Yt,()=>Jt];const getRuntimeConfig$1=t=>({apiVersion:"2019-06-10",base64Decoder:t?.base64Decoder??de,base64Encoder:t?.base64Encoder??ue,disableHostPrefix:t?.disableHostPrefix??false,endpointProvider:t?.endpointProvider??defaultEndpointResolver,extensions:t?.extensions??[],httpAuthSchemeProvider:t?.httpAuthSchemeProvider??defaultSSOOIDCHttpAuthSchemeProvider,httpAuthSchemes:t?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:t=>t.getIdentityProvider("aws.auth#sigv4"),signer:new ae},{schemeId:"smithy.api#noAuth",identityProvider:t=>t.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new I}],logger:t?.logger??new R,protocol:t?.protocol??pe,protocolSettings:t?.protocolSettings??{defaultNamespace:"com.amazonaws.ssooidc",errorTypeRegistries:_t,version:"2019-06-10",serviceTarget:"AWSSSOOIDCService"},serviceId:t?.serviceId??"SSO OIDC",sha256:t?.sha256??me,urlParser:t?.urlParser??j,utf8Decoder:t?.utf8Decoder??le,utf8Encoder:t?.utf8Encoder??ce});const getRuntimeConfig=t=>{v(process.version);const n=x(t);const defaultConfigProvider=()=>n().then(k);const i=getRuntimeConfig$1(t);A(process.version);const a={profile:t?.profile,logger:i.logger};return{...i,...t,runtime:"node",defaultsMode:n,authSchemePreference:t?.authSchemePreference??U(Ae,a),bodyLengthChecker:t?.bodyLengthChecker??he,defaultUserAgentProvider:t?.defaultUserAgentProvider??c({serviceId:i.serviceId,clientVersion:Ie.version}),maxAttempts:t?.maxAttempts??U(te,t),region:t?.region??U(O,{...H,...a}),requestHandler:ge.create(t?.requestHandler??defaultConfigProvider),retryMode:t?.retryMode??U({...ee,default:async()=>(await defaultConfigProvider()).retryMode||X},t),streamCollector:t?.streamCollector??fe,useDualstackEndpoint:t?.useDualstackEndpoint??U(L,a),useFipsEndpoint:t?.useFipsEndpoint??U(P,a),userAgentAppId:t?.userAgentAppId??U(l,a)}};const getHttpAuthExtensionConfiguration=t=>{const n=t.httpAuthSchemes;let i=t.httpAuthSchemeProvider;let a=t.credentials;return{setHttpAuthScheme(t){const i=n.findIndex(n=>n.schemeId===t.schemeId);if(i===-1){n.push(t)}else{n.splice(i,1,t)}},httpAuthSchemes(){return n},setHttpAuthSchemeProvider(t){i=t},httpAuthSchemeProvider(){return i},setCredentials(t){a=t},credentials(){return a}}};const resolveHttpAuthRuntimeConfig=t=>({httpAuthSchemes:t.httpAuthSchemes(),httpAuthSchemeProvider:t.httpAuthSchemeProvider(),credentials:t.credentials()});const resolveRuntimeExtensions=(t,n)=>{const i=Object.assign(d(t),D(t),z(t),getHttpAuthExtensionConfiguration(t));n.forEach(t=>t.configure(i));return Object.assign(t,h(i),T(i),K(i),resolveHttpAuthRuntimeConfig(i))};class SSOOIDCClient extends N{config;constructor(...[t]){const n=getRuntimeConfig(t||{});super(n);this.initConfig=n;const i=resolveClientEndpointParameters(n);const a=f(i);const A=re(a);const c=$(A);const l=g(c);const d=W(l);const h=resolveHttpAuthSchemeConfig(d);const I=resolveRuntimeExtensions(h,t?.extensions||[]);this.config=I;this.middlewareStack.use(oe(this.config));this.middlewareStack.use(p(this.config));this.middlewareStack.use(ne(this.config));this.middlewareStack.use(Z(this.config));this.middlewareStack.use(m(this.config));this.middlewareStack.use(E(this.config));this.middlewareStack.use(C(this.config));this.middlewareStack.use(y(this.config,{httpAuthSchemeParametersProvider:defaultSSOOIDCHttpAuthSchemeParametersProvider,identityProviderConfigProvider:async t=>new B({"aws.auth#sigv4":t.credentials})}));this.middlewareStack.use(Q(this.config))}destroy(){super.destroy()}}class CreateTokenCommand extends(M.classBuilder().ep(Ee).m(function(t,n,i,a){return[q(i,t.getEndpointParameterInstructions())]}).s("AWSSSOOIDCService","CreateToken",{}).n("SSOOIDCClient","CreateTokenCommand").sc(Wt).build()){}const qt={CreateTokenCommand:CreateTokenCommand};class SSOOIDC extends SSOOIDCClient{}F(qt,SSOOIDC);const jt={KMS_ACCESS_DENIED:"KMS_AccessDeniedException"};const zt={KMS_DISABLED_KEY:"KMS_DisabledException",KMS_INVALID_KEY_USAGE:"KMS_InvalidKeyUsageException",KMS_INVALID_STATE:"KMS_InvalidStateException",KMS_KEY_NOT_FOUND:"KMS_NotFoundException"};n.AccessDeniedException=AccessDeniedException;n.AccessDeniedException$=vt;n.AccessDeniedExceptionReason=jt;n.AuthorizationPendingException=AuthorizationPendingException;n.AuthorizationPendingException$=kt;n.CreateToken$=Wt;n.CreateTokenCommand=CreateTokenCommand;n.CreateTokenRequest$=Yt;n.CreateTokenResponse$=Jt;n.ExpiredTokenException=ExpiredTokenException;n.ExpiredTokenException$=Dt;n.InternalServerException=InternalServerException;n.InternalServerException$=Tt;n.InvalidClientException=InvalidClientException;n.InvalidClientException$=Nt;n.InvalidGrantException=InvalidGrantException;n.InvalidGrantException$=Mt;n.InvalidRequestException=InvalidRequestException;n.InvalidRequestException$=Ft;n.InvalidRequestExceptionReason=zt;n.InvalidScopeException=InvalidScopeException;n.InvalidScopeException$=xt;n.SSOOIDC=SSOOIDC;n.SSOOIDCClient=SSOOIDCClient;n.SSOOIDCServiceException=SSOOIDCServiceException;n.SSOOIDCServiceException$=bt;n.SlowDownException=SlowDownException;n.SlowDownException$=Ut;n.UnauthorizedClientException=UnauthorizedClientException;n.UnauthorizedClientException$=Pt;n.UnsupportedGrantTypeException=UnsupportedGrantTypeException;n.UnsupportedGrantTypeException$=Lt;n.errorTypeRegistries=_t},2579:(t,n,i)=>{const{awsEndpointFunctions:a,emitWarningIfUnsupportedVersion:A,createDefaultUserAgentProvider:c,NODE_APP_ID_CONFIG_OPTIONS:l,getAwsRegionExtensionConfiguration:d,resolveAwsRegionExtensionConfiguration:h,resolveUserAgentConfig:f,resolveHostHeaderConfig:g,getUserAgentPlugin:p,getHostHeaderPlugin:m,getLoggerPlugin:E,getRecursionDetectionPlugin:C}=i(5152);const{NoAuthSigner:I,getHttpAuthSchemeEndpointRuleSetPlugin:y,DefaultIdentityProviderConfig:B,getHttpSigningPlugin:Q}=i(402);const{normalizeProvider:w,getSmithyContext:S,ServiceException:b,NoOpLogger:R,emitWarningIfUnsupportedVersion:v,loadConfigsForDefaultMode:k,getDefaultExtensionConfiguration:D,resolveDefaultRuntimeConfig:T,Client:N,Command:M,createAggregatedClient:F}=i(2658);n.$Command=M;n.__Client=N;const{resolveDefaultsModeConfig:x,loadConfig:U,NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS:P,NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS:L,NODE_REGION_CONFIG_OPTIONS:O,NODE_REGION_CONFIG_FILE_OPTIONS:H,resolveRegionConfig:$}=i(7291);const{BinaryDecisionDiagram:G,EndpointCache:V,decideEndpoint:Y,customEndpointFunctions:J,resolveEndpointConfig:W,getEndpointPlugin:q}=i(2085);const{parseUrl:j,getHttpHandlerExtensionConfiguration:z,resolveHttpHandlerRuntimeConfig:K,getContentLengthPlugin:Z}=i(3422);const{DEFAULT_RETRY_MODE:X,NODE_RETRY_MODE_CONFIG_OPTIONS:ee,NODE_MAX_ATTEMPT_CONFIG_OPTIONS:te,resolveRetryConfig:re,getRetryPlugin:ne}=i(3609);const{TypeRegistry:se,getSchemaSerdePlugin:oe}=i(6890);const{resolveAwsSdkSigV4Config:ie,AwsSdkSigV4Signer:ae,NODE_AUTH_SCHEME_PREFERENCE_OPTIONS:Ae}=i(7523);const{toUtf8:ce,fromUtf8:le,toBase64:ue,fromBase64:de,calculateBodyLength:he}=i(2430);const{streamCollector:fe,NodeHttpHandler:ge}=i(1279);const{AwsRestJsonProtocol:pe}=i(7288);const{Sha256:me}=i(9542);const defaultSSOHttpAuthSchemeParametersProvider=async(t,n,i)=>({operation:S(n).operation,region:await w(t.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});function createAwsAuthSigv4HttpAuthOption(t){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"awsssoportal",region:t.region},propertiesExtractor:(t,n)=>({signingProperties:{config:t,context:n}})}}function createSmithyApiNoAuthHttpAuthOption(t){return{schemeId:"smithy.api#noAuth"}}const defaultSSOHttpAuthSchemeProvider=t=>{const n=[];switch(t.operation){case"GetRoleCredentials":{n.push(createSmithyApiNoAuthHttpAuthOption());break}default:{n.push(createAwsAuthSigv4HttpAuthOption(t))}}return n};const resolveHttpAuthSchemeConfig=t=>{const n=ie(t);return Object.assign(n,{authSchemePreference:w(t.authSchemePreference??[])})};const resolveClientEndpointParameters=t=>Object.assign(t,{useDualstackEndpoint:t.useDualstackEndpoint??false,useFipsEndpoint:t.useFipsEndpoint??false,defaultSigningName:"awsssoportal"});const Ee={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}};var Ce="3.997.24";var Ie={version:Ce};const ye="ref";const Be=-1,Qe=true,we="isSet",Se="PartitionResult",be="booleanEquals",Re="getAttr",ve={[ye]:"Endpoint"},ke={[ye]:Se},De={},Te=[{[ye]:"Region"}];const Ne={conditions:[[we,[ve]],[we,Te],["aws.partition",Te,Se],[be,[{[ye]:"UseFIPS"},Qe]],[be,[{[ye]:"UseDualStack"},Qe]],[be,[{fn:Re,argv:[ke,"supportsDualStack"]},Qe]],[be,[{fn:Re,argv:[ke,"supportsFIPS"]},Qe]],["stringEquals",[{fn:Re,argv:[ke,"name"]},"aws-us-gov"]]],results:[[Be],[Be,"Invalid Configuration: FIPS and custom endpoint are not supported"],[Be,"Invalid Configuration: Dualstack and custom endpoint are not supported"],[ve,De],["https://portal.sso-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",De],[Be,"FIPS and DualStack are enabled, but this partition does not support one or both"],["https://portal.sso.{Region}.amazonaws.com",De],["https://portal.sso-fips.{Region}.{PartitionResult#dnsSuffix}",De],[Be,"FIPS is enabled but this partition does not support FIPS"],["https://portal.sso.{Region}.{PartitionResult#dualStackDnsSuffix}",De],[Be,"DualStack is enabled but this partition does not support DualStack"],["https://portal.sso.{Region}.{PartitionResult#dnsSuffix}",De],[Be,"Invalid Configuration: Missing Region"]]};const Me=2;const Fe=1e8;const xe=new Int32Array([-1,1,-1,0,13,3,1,4,Fe+12,2,5,Fe+12,3,8,6,4,7,Fe+11,5,Fe+9,Fe+10,4,11,9,6,10,Fe+8,7,Fe+6,Fe+7,5,12,Fe+5,6,Fe+4,Fe+5,3,Fe+1,14,4,Fe+2,Fe+3]);const Ue=G.from(xe,Me,Ne.conditions,Ne.results);const Pe=new V({size:50,params:["Endpoint","Region","UseDualStack","UseFIPS"]});const defaultEndpointResolver=(t,n={})=>Pe.get(t,()=>Y(Ue,{endpointParams:t,logger:n.logger}));J.aws=a;class SSOServiceException extends b{constructor(t){super(t);Object.setPrototypeOf(this,SSOServiceException.prototype)}}class InvalidRequestException extends SSOServiceException{name="InvalidRequestException";$fault="client";constructor(t){super({name:"InvalidRequestException",$fault:"client",...t});Object.setPrototypeOf(this,InvalidRequestException.prototype)}}class ResourceNotFoundException extends SSOServiceException{name="ResourceNotFoundException";$fault="client";constructor(t){super({name:"ResourceNotFoundException",$fault:"client",...t});Object.setPrototypeOf(this,ResourceNotFoundException.prototype)}}class TooManyRequestsException extends SSOServiceException{name="TooManyRequestsException";$fault="client";constructor(t){super({name:"TooManyRequestsException",$fault:"client",...t});Object.setPrototypeOf(this,TooManyRequestsException.prototype)}}class UnauthorizedException extends SSOServiceException{name="UnauthorizedException";$fault="client";constructor(t){super({name:"UnauthorizedException",$fault:"client",...t});Object.setPrototypeOf(this,UnauthorizedException.prototype)}}const Le="AccessTokenType";const _e="GetRoleCredentials";const Oe="GetRoleCredentialsRequest";const He="GetRoleCredentialsResponse";const $e="InvalidRequestException";const Ge="RoleCredentials";const Ve="ResourceNotFoundException";const Ye="SecretAccessKeyType";const Je="SessionTokenType";const We="TooManyRequestsException";const qe="UnauthorizedException";const je="accountId";const ze="accessKeyId";const Ke="accessToken";const Ze="account_id";const Xe="client";const et="error";const tt="expiration";const rt="http";const nt="httpError";const st="httpHeader";const ot="httpQuery";const it="message";const at="roleCredentials";const At="roleName";const ct="role_name";const lt="smithy.ts.sdk.synthetic.com.amazonaws.sso";const ut="secretAccessKey";const dt="sessionToken";const ht="x-amz-sso_bearer_token";const ft="com.amazonaws.sso";const gt=se.for(lt);var pt=[-3,lt,"SSOServiceException",0,[],[]];gt.registerError(pt,SSOServiceException);const mt=se.for(ft);var Et=[-3,ft,$e,{[et]:Xe,[nt]:400},[it],[0]];mt.registerError(Et,InvalidRequestException);var Ct=[-3,ft,Ve,{[et]:Xe,[nt]:404},[it],[0]];mt.registerError(Ct,ResourceNotFoundException);var It=[-3,ft,We,{[et]:Xe,[nt]:429},[it],[0]];mt.registerError(It,TooManyRequestsException);var yt=[-3,ft,qe,{[et]:Xe,[nt]:401},[it],[0]];mt.registerError(yt,UnauthorizedException);const Bt=[gt,mt];var Qt=[0,ft,Le,8,0];var wt=[0,ft,Ye,8,0];var St=[0,ft,Je,8,0];var bt=[3,ft,Oe,0,[At,je,Ke],[[0,{[ot]:ct}],[0,{[ot]:Ze}],[()=>Qt,{[st]:ht}]],3];var Rt=[3,ft,He,0,[at],[[()=>vt,0]]];var vt=[3,ft,Ge,0,[ze,ut,dt,tt],[0,[()=>wt,0],[()=>St,0],1]];var kt=[9,ft,_e,{[rt]:["GET","/federation/credentials",200]},()=>bt,()=>Rt];const getRuntimeConfig$1=t=>({apiVersion:"2019-06-10",base64Decoder:t?.base64Decoder??de,base64Encoder:t?.base64Encoder??ue,disableHostPrefix:t?.disableHostPrefix??false,endpointProvider:t?.endpointProvider??defaultEndpointResolver,extensions:t?.extensions??[],httpAuthSchemeProvider:t?.httpAuthSchemeProvider??defaultSSOHttpAuthSchemeProvider,httpAuthSchemes:t?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:t=>t.getIdentityProvider("aws.auth#sigv4"),signer:new ae},{schemeId:"smithy.api#noAuth",identityProvider:t=>t.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new I}],logger:t?.logger??new R,protocol:t?.protocol??pe,protocolSettings:t?.protocolSettings??{defaultNamespace:"com.amazonaws.sso",errorTypeRegistries:Bt,version:"2019-06-10",serviceTarget:"SWBPortalService"},serviceId:t?.serviceId??"SSO",sha256:t?.sha256??me,urlParser:t?.urlParser??j,utf8Decoder:t?.utf8Decoder??le,utf8Encoder:t?.utf8Encoder??ce});const getRuntimeConfig=t=>{v(process.version);const n=x(t);const defaultConfigProvider=()=>n().then(k);const i=getRuntimeConfig$1(t);A(process.version);const a={profile:t?.profile,logger:i.logger};return{...i,...t,runtime:"node",defaultsMode:n,authSchemePreference:t?.authSchemePreference??U(Ae,a),bodyLengthChecker:t?.bodyLengthChecker??he,defaultUserAgentProvider:t?.defaultUserAgentProvider??c({serviceId:i.serviceId,clientVersion:Ie.version}),maxAttempts:t?.maxAttempts??U(te,t),region:t?.region??U(O,{...H,...a}),requestHandler:ge.create(t?.requestHandler??defaultConfigProvider),retryMode:t?.retryMode??U({...ee,default:async()=>(await defaultConfigProvider()).retryMode||X},t),streamCollector:t?.streamCollector??fe,useDualstackEndpoint:t?.useDualstackEndpoint??U(L,a),useFipsEndpoint:t?.useFipsEndpoint??U(P,a),userAgentAppId:t?.userAgentAppId??U(l,a)}};const getHttpAuthExtensionConfiguration=t=>{const n=t.httpAuthSchemes;let i=t.httpAuthSchemeProvider;let a=t.credentials;return{setHttpAuthScheme(t){const i=n.findIndex(n=>n.schemeId===t.schemeId);if(i===-1){n.push(t)}else{n.splice(i,1,t)}},httpAuthSchemes(){return n},setHttpAuthSchemeProvider(t){i=t},httpAuthSchemeProvider(){return i},setCredentials(t){a=t},credentials(){return a}}};const resolveHttpAuthRuntimeConfig=t=>({httpAuthSchemes:t.httpAuthSchemes(),httpAuthSchemeProvider:t.httpAuthSchemeProvider(),credentials:t.credentials()});const resolveRuntimeExtensions=(t,n)=>{const i=Object.assign(d(t),D(t),z(t),getHttpAuthExtensionConfiguration(t));n.forEach(t=>t.configure(i));return Object.assign(t,h(i),T(i),K(i),resolveHttpAuthRuntimeConfig(i))};class SSOClient extends N{config;constructor(...[t]){const n=getRuntimeConfig(t||{});super(n);this.initConfig=n;const i=resolveClientEndpointParameters(n);const a=f(i);const A=re(a);const c=$(A);const l=g(c);const d=W(l);const h=resolveHttpAuthSchemeConfig(d);const I=resolveRuntimeExtensions(h,t?.extensions||[]);this.config=I;this.middlewareStack.use(oe(this.config));this.middlewareStack.use(p(this.config));this.middlewareStack.use(ne(this.config));this.middlewareStack.use(Z(this.config));this.middlewareStack.use(m(this.config));this.middlewareStack.use(E(this.config));this.middlewareStack.use(C(this.config));this.middlewareStack.use(y(this.config,{httpAuthSchemeParametersProvider:defaultSSOHttpAuthSchemeParametersProvider,identityProviderConfigProvider:async t=>new B({"aws.auth#sigv4":t.credentials})}));this.middlewareStack.use(Q(this.config))}destroy(){super.destroy()}}class GetRoleCredentialsCommand extends(M.classBuilder().ep(Ee).m(function(t,n,i,a){return[q(i,t.getEndpointParameterInstructions())]}).s("SWBPortalService","GetRoleCredentials",{}).n("SSOClient","GetRoleCredentialsCommand").sc(kt).build()){}const Dt={GetRoleCredentialsCommand:GetRoleCredentialsCommand};class SSO extends SSOClient{}F(Dt,SSO);n.GetRoleCredentials$=kt;n.GetRoleCredentialsCommand=GetRoleCredentialsCommand;n.GetRoleCredentialsRequest$=bt;n.GetRoleCredentialsResponse$=Rt;n.InvalidRequestException=InvalidRequestException;n.InvalidRequestException$=Et;n.ResourceNotFoundException=ResourceNotFoundException;n.ResourceNotFoundException$=Ct;n.RoleCredentials$=vt;n.SSO=SSO;n.SSOClient=SSOClient;n.SSOServiceException=SSOServiceException;n.SSOServiceException$=pt;n.TooManyRequestsException=TooManyRequestsException;n.TooManyRequestsException$=It;n.UnauthorizedException=UnauthorizedException;n.UnauthorizedException$=yt;n.errorTypeRegistries=Bt},1136:(t,n,i)=>{const{awsEndpointFunctions:a,emitWarningIfUnsupportedVersion:A,createDefaultUserAgentProvider:c,NODE_APP_ID_CONFIG_OPTIONS:l,getAwsRegionExtensionConfiguration:d,resolveAwsRegionExtensionConfiguration:h,resolveUserAgentConfig:f,resolveHostHeaderConfig:g,getUserAgentPlugin:p,getHostHeaderPlugin:m,getLoggerPlugin:E,getRecursionDetectionPlugin:C,setCredentialFeature:I,stsRegionDefaultResolver:y}=i(5152);const{NoAuthSigner:B,getHttpAuthSchemeEndpointRuleSetPlugin:Q,DefaultIdentityProviderConfig:w,getHttpSigningPlugin:S}=i(402);const{normalizeProvider:b,getSmithyContext:R,ServiceException:v,NoOpLogger:k,emitWarningIfUnsupportedVersion:D,loadConfigsForDefaultMode:T,getDefaultExtensionConfiguration:N,resolveDefaultRuntimeConfig:M,Client:F,Command:x,createAggregatedClient:U}=i(2658);n.$Command=x;n.__Client=F;const{resolveDefaultsModeConfig:P,loadConfig:L,NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS:O,NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS:H,NODE_REGION_CONFIG_OPTIONS:$,NODE_REGION_CONFIG_FILE_OPTIONS:G,resolveRegionConfig:V}=i(7291);const{BinaryDecisionDiagram:Y,EndpointCache:J,decideEndpoint:W,customEndpointFunctions:q,resolveParams:j,resolveEndpointConfig:z,getEndpointPlugin:K}=i(2085);const{parseUrl:Z,getHttpHandlerExtensionConfiguration:X,resolveHttpHandlerRuntimeConfig:ee,getContentLengthPlugin:te}=i(3422);const{DEFAULT_RETRY_MODE:re,NODE_RETRY_MODE_CONFIG_OPTIONS:ne,NODE_MAX_ATTEMPT_CONFIG_OPTIONS:se,resolveRetryConfig:oe,getRetryPlugin:ie}=i(3609);const{TypeRegistry:ae,getSchemaSerdePlugin:Ae}=i(6890);const{resolveAwsSdkSigV4Config:ce,resolveAwsSdkSigV4AConfig:le,AwsSdkSigV4Signer:ue,AwsSdkSigV4ASigner:de,NODE_SIGV4A_CONFIG_OPTIONS:he,NODE_AUTH_SCHEME_PREFERENCE_OPTIONS:fe}=i(7523);const{SignatureV4MultiRegion:ge}=i(5785);const{toUtf8:pe,fromUtf8:me,toBase64:Ee,fromBase64:Ce,calculateBodyLength:Ie}=i(2430);const{streamCollector:ye,NodeHttpHandler:Be}=i(1279);const{AwsQueryProtocol:Qe}=i(7288);const{Sha256:we}=i(9542);const Se="ref";const be=-1,Re=true,ve="isSet",ke="PartitionResult",De="booleanEquals",Te="stringEquals",Ne="getAttr",Me="us-east-1",Fe="sigv4",xe="sts",Ue="https://sts.{Region}.{PartitionResult#dnsSuffix}",Pe={[Se]:"Endpoint"},Le={[Se]:"Region"},_e={[Se]:ke},Oe={},He=[Le];const $e={conditions:[[ve,[Pe]],[ve,He],["aws.partition",He,ke],[De,[{[Se]:"UseFIPS"},Re]],[De,[{[Se]:"UseDualStack"},Re]],[Te,[Le,"aws-global"]],[De,[{[Se]:"UseGlobalEndpoint"},Re]],[Te,[Le,"eu-central-1"]],[De,[{fn:Ne,argv:[_e,"supportsDualStack"]},Re]],[De,[{fn:Ne,argv:[_e,"supportsFIPS"]},Re]],[Te,[Le,"ap-south-1"]],[Te,[Le,"eu-north-1"]],[Te,[Le,"eu-west-1"]],[Te,[Le,"eu-west-2"]],[Te,[Le,"eu-west-3"]],[Te,[Le,"sa-east-1"]],[Te,[Le,Me]],[Te,[Le,"us-east-2"]],[Te,[Le,"us-west-2"]],[Te,[Le,"us-west-1"]],[Te,[Le,"ca-central-1"]],[Te,[Le,"ap-southeast-1"]],[Te,[Le,"ap-northeast-1"]],[Te,[Le,"ap-southeast-2"]],[Te,[{fn:Ne,argv:[_e,"name"]},"aws-us-gov"]]],results:[[be],["https://sts.amazonaws.com",{authSchemes:[{name:Fe,signingName:xe,signingRegion:Me}]}],[Ue,{authSchemes:[{name:Fe,signingName:xe,signingRegion:"{Region}"}]}],[be,"Invalid Configuration: FIPS and custom endpoint are not supported"],[be,"Invalid Configuration: Dualstack and custom endpoint are not supported"],[Pe,Oe],["https://sts-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",Oe],[be,"FIPS and DualStack are enabled, but this partition does not support one or both"],["https://sts.{Region}.amazonaws.com",Oe],["https://sts-fips.{Region}.{PartitionResult#dnsSuffix}",Oe],[be,"FIPS is enabled but this partition does not support FIPS"],["https://sts.{Region}.{PartitionResult#dualStackDnsSuffix}",Oe],[be,"DualStack is enabled but this partition does not support DualStack"],[Ue,Oe],[be,"Invalid Configuration: Missing Region"]]};const Ge=2;const Ve=1e8;const Ye=new Int32Array([-1,1,-1,0,30,3,1,4,Ve+14,2,5,Ve+14,3,25,6,4,24,7,5,Ve+1,8,6,9,Ve+13,7,Ve+1,10,10,Ve+1,11,11,Ve+1,12,12,Ve+1,13,13,Ve+1,14,14,Ve+1,15,15,Ve+1,16,16,Ve+1,17,17,Ve+1,18,18,Ve+1,19,19,Ve+1,20,20,Ve+1,21,21,Ve+1,22,22,Ve+1,23,23,Ve+1,Ve+2,8,Ve+11,Ve+12,4,28,26,9,27,Ve+10,24,Ve+8,Ve+9,8,29,Ve+7,9,Ve+6,Ve+7,3,Ve+3,31,4,Ve+4,Ve+5]);const Je=Y.from(Ye,Ge,$e.conditions,$e.results);const We=new J({size:50,params:["Endpoint","Region","UseDualStack","UseFIPS","UseGlobalEndpoint"]});const defaultEndpointResolver=(t,n={})=>We.get(t,()=>W(Je,{endpointParams:t,logger:n.logger}));q.aws=a;const createEndpointRuleSetHttpAuthSchemeParametersProvider=t=>async(n,i,a)=>{if(!a){throw new Error("Could not find `input` for `defaultEndpointRuleSetHttpAuthSchemeParametersProvider`")}const A=await t(n,i,a);const c=R(i)?.commandInstance?.constructor?.getEndpointParameterInstructions;if(!c){throw new Error(`getEndpointParameterInstructions() is not defined on '${i.commandName}'`)}const l=await j(a,{getEndpointParameterInstructions:c},n);return Object.assign(A,l)};const _defaultSTSHttpAuthSchemeParametersProvider=async(t,n,i)=>({operation:R(n).operation,region:await b(t.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});const qe=createEndpointRuleSetHttpAuthSchemeParametersProvider(_defaultSTSHttpAuthSchemeParametersProvider);function createAwsAuthSigv4HttpAuthOption(t){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"sts",region:t.region},propertiesExtractor:(t,n)=>({signingProperties:{config:t,context:n}})}}function createAwsAuthSigv4aHttpAuthOption(t){return{schemeId:"aws.auth#sigv4a",signingProperties:{name:"sts",region:t.region},propertiesExtractor:(t,n)=>({signingProperties:{config:t,context:n}})}}function createSmithyApiNoAuthHttpAuthOption(t){return{schemeId:"smithy.api#noAuth"}}const createEndpointRuleSetHttpAuthSchemeProvider=(t,n,i)=>{const endpointRuleSetHttpAuthSchemeProvider=a=>{const A=t(a);const c=A.properties?.authSchemes;if(!c){return n(a)}const l=[];for(const t of c){const{name:n,properties:A={},...d}=t;const h=n.toLowerCase();if(n!==h){console.warn(`HttpAuthScheme has been normalized with lowercasing: '${n}' to '${h}'`)}let f;if(h==="sigv4a"){f="aws.auth#sigv4a";const t=c.find(t=>{const n=t.name.toLowerCase();return n!=="sigv4a"&&n.startsWith("sigv4")});if(ge.sigv4aDependency()==="none"&&t){continue}}else if(h.startsWith("sigv4")){f="aws.auth#sigv4"}else{throw new Error(`Unknown HttpAuthScheme found in '@smithy.rules#endpointRuleSet': '${h}'`)}const g=i[f];if(!g){throw new Error(`Could not find HttpAuthOption create function for '${f}'`)}const p=g(a);p.schemeId=f;p.signingProperties={...p.signingProperties||{},...d,...A};l.push(p)}return l};return endpointRuleSetHttpAuthSchemeProvider};const _defaultSTSHttpAuthSchemeProvider=t=>{const n=[];switch(t.operation){case"AssumeRoleWithWebIdentity":{n.push(createSmithyApiNoAuthHttpAuthOption());n.push(createAwsAuthSigv4aHttpAuthOption(t));break}default:{n.push(createAwsAuthSigv4HttpAuthOption(t));n.push(createAwsAuthSigv4aHttpAuthOption(t))}}return n};const je=createEndpointRuleSetHttpAuthSchemeProvider(defaultEndpointResolver,_defaultSTSHttpAuthSchemeProvider,{"aws.auth#sigv4":createAwsAuthSigv4HttpAuthOption,"aws.auth#sigv4a":createAwsAuthSigv4aHttpAuthOption,"smithy.api#noAuth":createSmithyApiNoAuthHttpAuthOption});const resolveHttpAuthSchemeConfig=t=>{const n=ce(t);const i=le(n);return Object.assign(i,{authSchemePreference:b(t.authSchemePreference??[])})};const resolveClientEndpointParameters=t=>Object.assign(t,{useDualstackEndpoint:t.useDualstackEndpoint??false,useFipsEndpoint:t.useFipsEndpoint??false,useGlobalEndpoint:t.useGlobalEndpoint??false,defaultSigningName:"sts"});const ze={UseGlobalEndpoint:{type:"builtInParams",name:"useGlobalEndpoint"},UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}};var Ke="3.997.24";var Ze={version:Ke};class STSServiceException extends v{constructor(t){super(t);Object.setPrototypeOf(this,STSServiceException.prototype)}}class ExpiredTokenException extends STSServiceException{name="ExpiredTokenException";$fault="client";constructor(t){super({name:"ExpiredTokenException",$fault:"client",...t});Object.setPrototypeOf(this,ExpiredTokenException.prototype)}}class MalformedPolicyDocumentException extends STSServiceException{name="MalformedPolicyDocumentException";$fault="client";constructor(t){super({name:"MalformedPolicyDocumentException",$fault:"client",...t});Object.setPrototypeOf(this,MalformedPolicyDocumentException.prototype)}}class PackedPolicyTooLargeException extends STSServiceException{name="PackedPolicyTooLargeException";$fault="client";constructor(t){super({name:"PackedPolicyTooLargeException",$fault:"client",...t});Object.setPrototypeOf(this,PackedPolicyTooLargeException.prototype)}}class RegionDisabledException extends STSServiceException{name="RegionDisabledException";$fault="client";constructor(t){super({name:"RegionDisabledException",$fault:"client",...t});Object.setPrototypeOf(this,RegionDisabledException.prototype)}}class IDPRejectedClaimException extends STSServiceException{name="IDPRejectedClaimException";$fault="client";constructor(t){super({name:"IDPRejectedClaimException",$fault:"client",...t});Object.setPrototypeOf(this,IDPRejectedClaimException.prototype)}}class InvalidIdentityTokenException extends STSServiceException{name="InvalidIdentityTokenException";$fault="client";constructor(t){super({name:"InvalidIdentityTokenException",$fault:"client",...t});Object.setPrototypeOf(this,InvalidIdentityTokenException.prototype)}}class IDPCommunicationErrorException extends STSServiceException{name="IDPCommunicationErrorException";$fault="client";$retryable={};constructor(t){super({name:"IDPCommunicationErrorException",$fault:"client",...t});Object.setPrototypeOf(this,IDPCommunicationErrorException.prototype)}}const Xe="Arn";const et="AccessKeyId";const tt="AssumeRole";const rt="AssumedRoleId";const nt="AssumeRoleRequest";const st="AssumeRoleResponse";const ot="AssumedRoleUser";const it="AssumeRoleWithWebIdentity";const at="AssumeRoleWithWebIdentityRequest";const At="AssumeRoleWithWebIdentityResponse";const ct="Audience";const lt="Credentials";const ut="ContextAssertion";const dt="DurationSeconds";const ht="Expiration";const ft="ExternalId";const gt="ExpiredTokenException";const pt="IDPCommunicationErrorException";const mt="IDPRejectedClaimException";const Et="InvalidIdentityTokenException";const Ct="Key";const It="MalformedPolicyDocumentException";const yt="Policy";const Bt="PolicyArns";const Qt="ProviderArn";const wt="ProvidedContexts";const St="ProvidedContextsListType";const bt="ProvidedContext";const Rt="PolicyDescriptorType";const vt="ProviderId";const kt="PackedPolicySize";const Dt="PackedPolicyTooLargeException";const Tt="Provider";const Nt="RoleArn";const Mt="RegionDisabledException";const Ft="RoleSessionName";const xt="SecretAccessKey";const Ut="SubjectFromWebIdentityToken";const Pt="SourceIdentity";const Lt="SerialNumber";const _t="SessionToken";const Ot="Tags";const Ht="TokenCode";const $t="TransitiveTagKeys";const Gt="Tag";const Vt="Value";const Yt="WebIdentityToken";const Jt="arn";const Wt="accessKeySecretType";const qt="awsQueryError";const jt="client";const zt="clientTokenType";const Kt="error";const Zt="httpError";const Xt="message";const er="policyDescriptorListType";const tr="smithy.ts.sdk.synthetic.com.amazonaws.sts";const rr="tagListType";const nr="com.amazonaws.sts";const sr=ae.for(tr);var ir=[-3,tr,"STSServiceException",0,[],[]];sr.registerError(ir,STSServiceException);const ar=ae.for(nr);var Ar=[-3,nr,gt,{[qt]:[`ExpiredTokenException`,400],[Kt]:jt,[Zt]:400},[Xt],[0]];ar.registerError(Ar,ExpiredTokenException);var cr=[-3,nr,pt,{[qt]:[`IDPCommunicationError`,400],[Kt]:jt,[Zt]:400},[Xt],[0]];ar.registerError(cr,IDPCommunicationErrorException);var lr=[-3,nr,mt,{[qt]:[`IDPRejectedClaim`,403],[Kt]:jt,[Zt]:403},[Xt],[0]];ar.registerError(lr,IDPRejectedClaimException);var ur=[-3,nr,Et,{[qt]:[`InvalidIdentityToken`,400],[Kt]:jt,[Zt]:400},[Xt],[0]];ar.registerError(ur,InvalidIdentityTokenException);var dr=[-3,nr,It,{[qt]:[`MalformedPolicyDocument`,400],[Kt]:jt,[Zt]:400},[Xt],[0]];ar.registerError(dr,MalformedPolicyDocumentException);var hr=[-3,nr,Dt,{[qt]:[`PackedPolicyTooLarge`,400],[Kt]:jt,[Zt]:400},[Xt],[0]];ar.registerError(hr,PackedPolicyTooLargeException);var fr=[-3,nr,Mt,{[qt]:[`RegionDisabledException`,403],[Kt]:jt,[Zt]:403},[Xt],[0]];ar.registerError(fr,RegionDisabledException);const gr=[sr,ar];var pr=[0,nr,Wt,8,0];var mr=[0,nr,zt,8,0];var Er=[3,nr,ot,0,[rt,Xe],[0,0],2];var Cr=[3,nr,nt,0,[Nt,Ft,Bt,yt,dt,Ot,$t,ft,Lt,Ht,Pt,wt],[0,0,()=>Rr,0,1,()=>kr,64|0,0,0,0,0,()=>vr],2];var Ir=[3,nr,st,0,[lt,ot,kt,Pt],[[()=>Qr,0],()=>Er,1,0]];var yr=[3,nr,at,0,[Nt,Ft,Yt,vt,Bt,yt,dt],[0,0,[()=>mr,0],0,()=>Rr,0,1],3];var Br=[3,nr,At,0,[lt,Ut,ot,kt,Tt,ct,Pt],[[()=>Qr,0],0,()=>Er,1,0,0,0]];var Qr=[3,nr,lt,0,[et,xt,_t,ht],[0,[()=>pr,0],0,4],4];var wr=[3,nr,Rt,0,[Jt],[0]];var Sr=[3,nr,bt,0,[Qt,ut],[0,0]];var br=[3,nr,Gt,0,[Ct,Vt],[0,0],2];var Rr=[1,nr,er,0,()=>wr];var vr=[1,nr,St,0,()=>Sr];var kr=[1,nr,rr,0,()=>br];var Dr=[9,nr,tt,0,()=>Cr,()=>Ir];var Tr=[9,nr,it,0,()=>yr,()=>Br];const getRuntimeConfig$1=t=>({apiVersion:"2011-06-15",base64Decoder:t?.base64Decoder??Ce,base64Encoder:t?.base64Encoder??Ee,disableHostPrefix:t?.disableHostPrefix??false,endpointProvider:t?.endpointProvider??defaultEndpointResolver,extensions:t?.extensions??[],httpAuthSchemeProvider:t?.httpAuthSchemeProvider??je,httpAuthSchemes:t?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:t=>t.getIdentityProvider("aws.auth#sigv4"),signer:new ue},{schemeId:"aws.auth#sigv4a",identityProvider:t=>t.getIdentityProvider("aws.auth#sigv4a"),signer:new de},{schemeId:"smithy.api#noAuth",identityProvider:t=>t.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new B}],logger:t?.logger??new k,protocol:t?.protocol??Qe,protocolSettings:t?.protocolSettings??{defaultNamespace:"com.amazonaws.sts",errorTypeRegistries:gr,xmlNamespace:"https://sts.amazonaws.com/doc/2011-06-15/",version:"2011-06-15",serviceTarget:"AWSSecurityTokenServiceV20110615"},serviceId:t?.serviceId??"STS",sha256:t?.sha256??we,signerConstructor:t?.signerConstructor??ge,urlParser:t?.urlParser??Z,utf8Decoder:t?.utf8Decoder??me,utf8Encoder:t?.utf8Encoder??pe});const getRuntimeConfig=t=>{D(process.version);const n=P(t);const defaultConfigProvider=()=>n().then(T);const i=getRuntimeConfig$1(t);A(process.version);const a={profile:t?.profile,logger:i.logger};return{...i,...t,runtime:"node",defaultsMode:n,authSchemePreference:t?.authSchemePreference??L(fe,a),bodyLengthChecker:t?.bodyLengthChecker??Ie,defaultUserAgentProvider:t?.defaultUserAgentProvider??c({serviceId:i.serviceId,clientVersion:Ze.version}),httpAuthSchemes:t?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:n=>n.getIdentityProvider("aws.auth#sigv4")||(async n=>await t.credentialDefaultProvider(n?.__config||{})()),signer:new ue},{schemeId:"aws.auth#sigv4a",identityProvider:t=>t.getIdentityProvider("aws.auth#sigv4a"),signer:new de},{schemeId:"smithy.api#noAuth",identityProvider:t=>t.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new B}],maxAttempts:t?.maxAttempts??L(se,t),region:t?.region??L($,{...G,...a}),requestHandler:Be.create(t?.requestHandler??defaultConfigProvider),retryMode:t?.retryMode??L({...ne,default:async()=>(await defaultConfigProvider()).retryMode||re},t),sigv4aSigningRegionSet:t?.sigv4aSigningRegionSet??L(he,a),streamCollector:t?.streamCollector??ye,useDualstackEndpoint:t?.useDualstackEndpoint??L(H,a),useFipsEndpoint:t?.useFipsEndpoint??L(O,a),userAgentAppId:t?.userAgentAppId??L(l,a)}};const getHttpAuthExtensionConfiguration=t=>{const n=t.httpAuthSchemes;let i=t.httpAuthSchemeProvider;let a=t.credentials;return{setHttpAuthScheme(t){const i=n.findIndex(n=>n.schemeId===t.schemeId);if(i===-1){n.push(t)}else{n.splice(i,1,t)}},httpAuthSchemes(){return n},setHttpAuthSchemeProvider(t){i=t},httpAuthSchemeProvider(){return i},setCredentials(t){a=t},credentials(){return a}}};const resolveHttpAuthRuntimeConfig=t=>({httpAuthSchemes:t.httpAuthSchemes(),httpAuthSchemeProvider:t.httpAuthSchemeProvider(),credentials:t.credentials()});const resolveRuntimeExtensions=(t,n)=>{const i=Object.assign(d(t),N(t),X(t),getHttpAuthExtensionConfiguration(t));n.forEach(t=>t.configure(i));return Object.assign(t,h(i),M(i),ee(i),resolveHttpAuthRuntimeConfig(i))};class STSClient extends F{config;constructor(...[t]){const n=getRuntimeConfig(t||{});super(n);this.initConfig=n;const i=resolveClientEndpointParameters(n);const a=f(i);const A=oe(a);const c=V(A);const l=g(c);const d=z(l);const h=resolveHttpAuthSchemeConfig(d);const I=resolveRuntimeExtensions(h,t?.extensions||[]);this.config=I;this.middlewareStack.use(Ae(this.config));this.middlewareStack.use(p(this.config));this.middlewareStack.use(ie(this.config));this.middlewareStack.use(te(this.config));this.middlewareStack.use(m(this.config));this.middlewareStack.use(E(this.config));this.middlewareStack.use(C(this.config));this.middlewareStack.use(Q(this.config,{httpAuthSchemeParametersProvider:qe,identityProviderConfigProvider:async t=>new w({"aws.auth#sigv4":t.credentials,"aws.auth#sigv4a":t.credentials})}));this.middlewareStack.use(S(this.config))}destroy(){super.destroy()}}class AssumeRoleCommand extends(x.classBuilder().ep(ze).m(function(t,n,i,a){return[K(i,t.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","AssumeRole",{}).n("STSClient","AssumeRoleCommand").sc(Dr).build()){}class AssumeRoleWithWebIdentityCommand extends(x.classBuilder().ep(ze).m(function(t,n,i,a){return[K(i,t.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","AssumeRoleWithWebIdentity",{}).n("STSClient","AssumeRoleWithWebIdentityCommand").sc(Tr).build()){}const Nr={AssumeRoleCommand:AssumeRoleCommand,AssumeRoleWithWebIdentityCommand:AssumeRoleWithWebIdentityCommand};class STS extends STSClient{}U(Nr,STS);const getAccountIdFromAssumedRoleUser=t=>{if(typeof t?.Arn==="string"){const n=t.Arn.split(":");if(n.length>4&&n[4]!==""){return n[4]}}return undefined};const resolveRegion=async(t,n,i,a={})=>{const A=typeof t==="function"?await t():t;const c=typeof n==="function"?await n():n;let l="";const d=A??c??(l=await y(a)());i?.debug?.("@aws-sdk/client-sts::resolveRegion","accepting first of:",`${A} (credential provider clientConfig)`,`${c} (contextual client)`,`${l} (STS default: AWS_REGION, profile region, or us-east-1)`);return d};const getDefaultRoleAssumer$1=(t,n)=>{let i;let a;return async(A,c)=>{a=A;if(!i){const{logger:A=t?.parentClientConfig?.logger,profile:c=t?.parentClientConfig?.profile,region:l,requestHandler:d=t?.parentClientConfig?.requestHandler,credentialProviderLogger:h,userAgentAppId:f=t?.parentClientConfig?.userAgentAppId}=t;const g=await resolveRegion(l,t?.parentClientConfig?.region,h,{logger:A,profile:c});const p=!isH2(d);i=new n({...t,userAgentAppId:f,profile:c,credentialDefaultProvider:()=>async()=>a,region:g,requestHandler:p?d:undefined,logger:A})}const{Credentials:l,AssumedRoleUser:d}=await i.send(new AssumeRoleCommand(c));if(!l||!l.AccessKeyId||!l.SecretAccessKey){throw new Error(`Invalid response from STS.assumeRole call with role ${c.RoleArn}`)}const h=getAccountIdFromAssumedRoleUser(d);const f={accessKeyId:l.AccessKeyId,secretAccessKey:l.SecretAccessKey,sessionToken:l.SessionToken,expiration:l.Expiration,...l.CredentialScope&&{credentialScope:l.CredentialScope},...h&&{accountId:h}};I(f,"CREDENTIALS_STS_ASSUME_ROLE","i");return f}};const getDefaultRoleAssumerWithWebIdentity$1=(t,n)=>{let i;return async a=>{if(!i){const{logger:a=t?.parentClientConfig?.logger,profile:A=t?.parentClientConfig?.profile,region:c,requestHandler:l=t?.parentClientConfig?.requestHandler,credentialProviderLogger:d,userAgentAppId:h=t?.parentClientConfig?.userAgentAppId}=t;const f=await resolveRegion(c,t?.parentClientConfig?.region,d,{logger:a,profile:A});const g=!isH2(l);i=new n({...t,userAgentAppId:h,profile:A,region:f,requestHandler:g?l:undefined,logger:a})}const{Credentials:A,AssumedRoleUser:c}=await i.send(new AssumeRoleWithWebIdentityCommand(a));if(!A||!A.AccessKeyId||!A.SecretAccessKey){throw new Error(`Invalid response from STS.assumeRoleWithWebIdentity call with role ${a.RoleArn}`)}const l=getAccountIdFromAssumedRoleUser(c);const d={accessKeyId:A.AccessKeyId,secretAccessKey:A.SecretAccessKey,sessionToken:A.SessionToken,expiration:A.Expiration,...A.CredentialScope&&{credentialScope:A.CredentialScope},...l&&{accountId:l}};if(l){I(d,"RESOLVED_ACCOUNT_ID","T")}I(d,"CREDENTIALS_STS_ASSUME_ROLE_WEB_ID","k");return d}};const isH2=t=>t?.metadata?.handlerProtocol==="h2";const getCustomizableStsClientCtor=(t,n)=>{if(!n)return t;else return class CustomizableSTSClient extends t{constructor(t){super(t);for(const t of n){this.middlewareStack.use(t)}}}};const getDefaultRoleAssumer=(t={},n)=>getDefaultRoleAssumer$1(t,getCustomizableStsClientCtor(STSClient,n));const getDefaultRoleAssumerWithWebIdentity=(t={},n)=>getDefaultRoleAssumerWithWebIdentity$1(t,getCustomizableStsClientCtor(STSClient,n));const decorateDefaultCredentialProvider=t=>n=>t({roleAssumer:getDefaultRoleAssumer(n),roleAssumerWithWebIdentity:getDefaultRoleAssumerWithWebIdentity(n),...n});n.AssumeRole$=Dr;n.AssumeRoleCommand=AssumeRoleCommand;n.AssumeRoleRequest$=Cr;n.AssumeRoleResponse$=Ir;n.AssumeRoleWithWebIdentity$=Tr;n.AssumeRoleWithWebIdentityCommand=AssumeRoleWithWebIdentityCommand;n.AssumeRoleWithWebIdentityRequest$=yr;n.AssumeRoleWithWebIdentityResponse$=Br;n.AssumedRoleUser$=Er;n.Credentials$=Qr;n.ExpiredTokenException=ExpiredTokenException;n.ExpiredTokenException$=Ar;n.IDPCommunicationErrorException=IDPCommunicationErrorException;n.IDPCommunicationErrorException$=cr;n.IDPRejectedClaimException=IDPRejectedClaimException;n.IDPRejectedClaimException$=lr;n.InvalidIdentityTokenException=InvalidIdentityTokenException;n.InvalidIdentityTokenException$=ur;n.MalformedPolicyDocumentException=MalformedPolicyDocumentException;n.MalformedPolicyDocumentException$=dr;n.PackedPolicyTooLargeException=PackedPolicyTooLargeException;n.PackedPolicyTooLargeException$=hr;n.PolicyDescriptorType$=wr;n.ProvidedContext$=Sr;n.RegionDisabledException=RegionDisabledException;n.RegionDisabledException$=fr;n.STS=STS;n.STSClient=STSClient;n.STSServiceException=STSServiceException;n.STSServiceException$=ir;n.Tag$=br;n.decorateDefaultCredentialProvider=decorateDefaultCredentialProvider;n.errorTypeRegistries=gr;n.getDefaultRoleAssumer=getDefaultRoleAssumer;n.getDefaultRoleAssumerWithWebIdentity=getDefaultRoleAssumerWithWebIdentity},5785:(t,n,i)=>{const{SignatureV4:a,signatureV4aContainer:A}=i(5118);const c={CrtSignerV4:null};const l="X-Amz-S3session-Token";const d=l.toLowerCase();class SignatureV4SignWithCredentials extends a{async signWithCredentials(t,n,i){const a=getCredentialsWithoutSessionToken(n);t.headers[d]=n.sessionToken;const A=this;setSingleOverride(A,a);return A.signRequest(t,i??{})}async presignWithCredentials(t,n,i){const a=getCredentialsWithoutSessionToken(n);delete t.headers[d];t.headers[l]=n.sessionToken;t.query=t.query??{};t.query[l]=n.sessionToken;const A=this;setSingleOverride(A,a);return this.presign(t,i)}}function getCredentialsWithoutSessionToken(t){return{accessKeyId:t.accessKeyId,secretAccessKey:t.secretAccessKey,expiration:t.expiration}}function setSingleOverride(t,n){const i=t.credentialProvider;t.credentialProvider=()=>{t.credentialProvider=i;return Promise.resolve(n)}}class SignatureV4MultiRegion{sigv4aSigner;sigv4Signer;signerOptions;static sigv4aDependency(){if(typeof c.CrtSignerV4==="function"){return"crt"}else if(typeof A.SignatureV4a==="function"){return"js"}return"none"}constructor(t){this.sigv4Signer=new SignatureV4SignWithCredentials(t);this.signerOptions=t}async sign(t,n={}){if(n.signingRegion==="*"){return this.getSigv4aSigner().sign(t,n)}return this.sigv4Signer.sign(t,n)}async signWithCredentials(t,n,i={}){if(i.signingRegion==="*"){const a=this.getSigv4aSigner();const A=c.CrtSignerV4;if(A&&a instanceof A){return a.signWithCredentials(t,n,i)}else{throw new Error(`signWithCredentials with signingRegion '*' is only supported when using the CRT dependency @aws-sdk/signature-v4-crt. `+`Please check whether you have installed the "@aws-sdk/signature-v4-crt" package explicitly. `+`You must also register the package by calling [require("@aws-sdk/signature-v4-crt");] `+`or an ESM equivalent such as [import "@aws-sdk/signature-v4-crt";]. `+`For more information please go to https://github.com/aws/aws-sdk-js-v3#functionality-requiring-aws-common-runtime-crt`)}}return this.sigv4Signer.signWithCredentials(t,n,i)}async presign(t,n={}){if(n.signingRegion==="*"){const i=this.getSigv4aSigner();const a=c.CrtSignerV4;if(a&&i instanceof a){return i.presign(t,n)}else{throw new Error(`presign with signingRegion '*' is only supported when using the CRT dependency @aws-sdk/signature-v4-crt. `+`Please check whether you have installed the "@aws-sdk/signature-v4-crt" package explicitly. `+`You must also register the package by calling [require("@aws-sdk/signature-v4-crt");] `+`or an ESM equivalent such as [import "@aws-sdk/signature-v4-crt";]. `+`For more information please go to https://github.com/aws/aws-sdk-js-v3#functionality-requiring-aws-common-runtime-crt`)}}return this.sigv4Signer.presign(t,n)}async presignWithCredentials(t,n,i={}){if(i.signingRegion==="*"){throw new Error("Method presignWithCredentials is not supported for [signingRegion=*].")}return this.sigv4Signer.presignWithCredentials(t,n,i)}getSigv4aSigner(){if(!this.sigv4aSigner){const t=c.CrtSignerV4;const n=A.SignatureV4a;if(this.signerOptions.runtime==="node"){if(!t&&!n){throw new Error("Neither CRT nor JS SigV4a implementation is available. "+"Please load either @aws-sdk/signature-v4-crt or @aws-sdk/signature-v4a. "+"For more information please go to "+"https://github.com/aws/aws-sdk-js-v3#functionality-requiring-aws-common-runtime-crt")}if(t&&typeof t==="function"){this.sigv4aSigner=new t({...this.signerOptions,signingAlgorithm:1})}else if(n&&typeof n==="function"){this.sigv4aSigner=new n({...this.signerOptions})}else{throw new Error("Available SigV4a implementation is not a valid constructor. "+"Please ensure you've properly imported @aws-sdk/signature-v4-crt or @aws-sdk/signature-v4a."+"For more information please go to "+"https://github.com/aws/aws-sdk-js-v3#functionality-requiring-aws-common-runtime-crt")}}else{if(!n||typeof n!=="function"){throw new Error("JS SigV4a implementation is not available or not a valid constructor. "+"Please check whether you have installed the @aws-sdk/signature-v4a package explicitly. The CRT implementation is not available for browsers. "+"You must also register the package by calling [require('@aws-sdk/signature-v4a');] "+"or an ESM equivalent such as [import '@aws-sdk/signature-v4a';]. "+"For more information please go to "+"https://github.com/aws/aws-sdk-js-v3#using-javascript-non-crt-implementation-of-sigv4a")}this.sigv4aSigner=new n({...this.signerOptions})}}return this.sigv4aSigner}}n.SignatureV4MultiRegion=SignatureV4MultiRegion;n.SignatureV4SignWithCredentials=SignatureV4SignWithCredentials;n.signatureV4CrtContainer=c},5433:(t,n,i)=>{const{setTokenFeature:a}=i(5152);const{getBearerTokenEnvKey:A}=i(7523);const{TokenProviderError:c,getSSOTokenFilepath:l,parseKnownFiles:d,getProfileName:h,loadSsoSessionData:f,getSSOTokenFromFile:g,memoize:p,chain:m}=i(7291);const{promises:E}=i(3024);const fromEnvSigningName=({logger:t,signingName:n}={})=>async()=>{t?.debug?.("@aws-sdk/token-providers - fromEnvSigningName");if(!n){throw new c("Please pass 'signingName' to compute environment variable key",{logger:t})}const i=A(n);if(!(i in process.env)){throw new c(`Token not present in '${i}' environment variable`,{logger:t})}const l={token:process.env[i]};a(l,"BEARER_SERVICE_ENV_VARS","3");return l};const C=5*60*1e3;const I=`To refresh this SSO session run 'aws sso login' with the corresponding profile.`;const getSsoOidcClient=async(t,n={},a)=>{const{SSOOIDCClient:A}=i(9443);const coalesce=t=>n.clientConfig?.[t]??n.parentClientConfig?.[t]??a?.[t];const c=new A(Object.assign({},n.clientConfig??{},{region:t??n.clientConfig?.region,logger:coalesce("logger"),userAgentAppId:coalesce("userAgentAppId")}));return c};const getNewSsoOidcToken=async(t,n,a={},A)=>{const{CreateTokenCommand:c}=i(9443);const l=await getSsoOidcClient(n,a,A);return l.send(new c({clientId:t.clientId,clientSecret:t.clientSecret,refreshToken:t.refreshToken,grantType:"refresh_token"}))};const validateTokenExpiry=t=>{if(t.expiration&&t.expiration.getTime(){if(typeof n==="undefined"){throw new c(`Value not present for '${t}' in SSO Token${i?". Cannot refresh":""}. ${I}`,false)}};const{writeFile:y}=E;const writeSSOTokenToFile=(t,n)=>{const i=l(t);const a=JSON.stringify(n,null,2);return y(i,a)};const B=new Date(0);const fromSso=(t={})=>async({callerClientConfig:n}={})=>{t.logger?.debug("@aws-sdk/token-providers - fromSso");const i=await d(t);const a=h({profile:t.profile??n?.profile});const A=i[a];if(!A){throw new c(`Profile '${a}' could not be found in shared credentials file.`,false)}else if(!A["sso_session"]){throw new c(`Profile '${a}' is missing required property 'sso_session'.`)}const l=A["sso_session"];const p=await f(t);const m=p[l];if(!m){throw new c(`Sso session '${l}' could not be found in shared credentials file.`,false)}for(const t of["sso_start_url","sso_region"]){if(!m[t]){throw new c(`Sso session '${l}' is missing required property '${t}'.`,false)}}m["sso_start_url"];const E=m["sso_region"];let y;try{y=await g(l)}catch(t){throw new c(`The SSO session token associated with profile=${a} was not found or is invalid. ${I}`,false)}validateTokenKey("accessToken",y.accessToken);validateTokenKey("expiresAt",y.expiresAt);const{accessToken:Q,expiresAt:w}=y;const S={token:Q,expiration:new Date(w)};if(S.expiration.getTime()-Date.now()>C){return S}if(Date.now()-B.getTime()<30*1e3){validateTokenExpiry(S);return S}validateTokenKey("clientId",y.clientId,true);validateTokenKey("clientSecret",y.clientSecret,true);validateTokenKey("refreshToken",y.refreshToken,true);try{B.setTime(Date.now());const i=await getNewSsoOidcToken(y,E,t,n);validateTokenKey("accessToken",i.accessToken);validateTokenKey("expiresIn",i.expiresIn);const a=new Date(Date.now()+i.expiresIn*1e3);try{await writeSSOTokenToFile(l,{...y,accessToken:i.accessToken,expiresAt:a.toISOString(),refreshToken:i.refreshToken})}catch(t){}return{token:i.accessToken,expiration:a}}catch(t){validateTokenExpiry(S);return S}};const fromStatic=({token:t,logger:n})=>async()=>{n?.debug("@aws-sdk/token-providers - fromStatic");if(!t||!t.token){throw new c(`Please pass a valid token to fromStatic`,false)}return t};const nodeProvider=(t={})=>p(m(fromSso(t),async()=>{throw new c("Could not load token from any providers",false)}),t=>t.expiration!==undefined&&t.expiration.getTime()-Date.now()<3e5,t=>t.expiration!==undefined);n.fromEnvSigningName=fromEnvSigningName;n.fromSso=fromSso;n.fromStatic=fromStatic;n.nodeProvider=nodeProvider},4274:(t,n)=>{const i=/[&<>"]/g;const a={"&":"&","<":"<",">":">",'"':"""};function escapeAttribute(t){return t.replace(i,t=>a[t])}const A=/[&"'<>\r\n\u0085\u2028]/g;const c={"&":"&",'"':""","'":"'","<":"<",">":">","\r":" ","\n":" ","Â…":"…","\u2028":"
"};function escapeElement(t){return t.replace(A,t=>c[t])}class XmlText{value;constructor(t){this.value=t}toString(){return escapeElement(""+this.value)}}class XmlNode{name;children;attributes={};static of(t,n,i){const a=new XmlNode(t);if(n!==undefined){a.addChildNode(new XmlText(n))}if(i!==undefined){a.withName(i)}return a}constructor(t,n=[]){this.name=t;this.children=n}withName(t){this.name=t;return this}addAttribute(t,n){this.attributes[t]=n;return this}addChildNode(t){this.children.push(t);return this}removeAttribute(t){delete this.attributes[t];return this}n(t){this.name=t;return this}c(t){this.children.push(t);return this}a(t,n){if(n!=null){this.attributes[t]=n}return this}cc(t,n,i=n){if(t[n]!=null){const a=XmlNode.of(n,t[n]).withName(i);this.c(a)}}l(t,n,i,a){if(t[n]!=null){const t=a();t.map(t=>{t.withName(i);this.c(t)})}}lc(t,n,i,a){if(t[n]!=null){const t=a();const n=new XmlNode(i);t.map(t=>{n.c(t)});this.c(n)}}toString(){const t=Boolean(this.children.length);let n=`<${this.name}`;const i=this.attributes;for(const t of Object.keys(i)){const a=i[t];if(a!=null){n+=` ${t}="${escapeAttribute(""+a)}"`}}return n+=!t?"/>":`>${this.children.map(t=>t.toString()).join("")}`}}function parseXML(t){const n=new AwsXmlParser(t);return n.parse()}class AwsXmlParser{x;i=0;z;constructor(t){this.x=t;this.x=t.replace(/\r\n?/g,"\n");this.z=this.x.length}parse(){const t=this;const{z:n}=t;while(t.i=n){break}if(t.isNext("");t.trim()}else if(t.isNext("\x3c!--")){t.readTo("--\x3e");t.trim()}else if(t.isNext("/".includes(t.x[t.i])){n+=t.x[t.i++]}let i=false;const a=Object.create(null);while(t.i/".includes(t.x[t.i])){break}let n="";while(t.i/?".includes(t.x[t.i])){n+=t.x[t.i++]}t.trim();if(t.x[t.i]!=="="){break}++t.i;t.trim();a[n]=t.readAttrValue();i=true}if(t.i>=t.z){throw new Error("@aws-sdk XML parse error: unexpected end of input.")}if(t.x[t.i]==="/"){++t.i;if(t.i>=t.z||t.x[t.i]!==">"){throw new Error("@aws-sdk XML parse error: expected > at the end of self-closing tag.")}++t.i;Object.setPrototypeOf(a,Object.prototype);return{tag:n,value:i?a:""}}if(t.x[t.i]!==">"){throw new Error("@aws-sdk XML parse error: expected > at the end of opening tag.")}++t.i;const A=[];const c=[];let l=false;while(t.i"))}else if(t.isNext("")}else{l=true;c.push(t.parseTag())}}else{let n="";while(t.i.`)}t.i+=2;const d=t.readTo(">").trim();if(d!==n){throw new Error(`@aws-sdk XML parse error: mismatched tags <${n}> and .`)}if(!i&&A.length===0&&!l){return{tag:n,value:""}}if(!i&&!l){const t=A.length===1?A[0]:A.join("");if(t.trim()===""&&t.includes("\n")){return{tag:n,value:""}}return{tag:n,value:t}}const h=Object.create(null);for(const t of A){if(t.trim()===""&&t.includes("\n")){continue}h["#text"]="#text"in h?h["#text"]+t:t}for(const t of c){if(t.tag in h){if(Array.isArray(h[t.tag])){h[t.tag].push(t.value)}else{h[t.tag]=[h[t.tag],t.value]}}else{h[t.tag]=t.value}}for(const[t,n]of Object.entries(a)){h[t]=n}Object.setPrototypeOf(h,Object.prototype);return{tag:n,value:h}}static ENTITIES={amp:"&",lt:"<",gt:">",quot:'"',apos:"'"};skipDoctype(){const t=this;t.i+=9;let n=0;while(t.i"&&n===0){++t.i;return}++t.i}throw new Error("@aws-sdk XML parse error: unclosed DOCTYPE.")}decodeEntities(t){return t.replace(/&(?:#x([0-9a-fA-F]{1,6})|#(\d{1,7})|([a-zA-Z][a-zA-Z0-9]{0,30}));/g,(t,n,i,a)=>{if(n){return String.fromCharCode(parseInt(n,16))}if(i){return String.fromCharCode(parseInt(i,10))}return AwsXmlParser.ENTITIES[a]??""})}}n.XmlNode=XmlNode;n.XmlText=XmlText;n.parseXML=parseXML},9320:(t,n,i)=>{const a={REQUEST_ID:Symbol.for("_AWS_LAMBDA_REQUEST_ID"),X_RAY_TRACE_ID:Symbol.for("_AWS_LAMBDA_X_RAY_TRACE_ID"),TENANT_ID:Symbol.for("_AWS_LAMBDA_TENANT_ID")};const A=["true","1"].includes(process.env?.AWS_LAMBDA_NODEJS_NO_GLOBAL_AWSLAMBDA??"");if(!A){globalThis.awslambda=globalThis.awslambda||{}}class InvokeStoreBase{static PROTECTED_KEYS=a;isProtectedKey(t){return Object.values(a).includes(t)}getRequestId(){return this.get(a.REQUEST_ID)??"-"}getXRayTraceId(){return this.get(a.X_RAY_TRACE_ID)}getTenantId(){return this.get(a.TENANT_ID)}}class InvokeStoreSingle extends InvokeStoreBase{currentContext;getContext(){return this.currentContext}hasContext(){return this.currentContext!==undefined}get(t){return this.currentContext?.[t]}set(t,n){if(this.isProtectedKey(t)){throw new Error(`Cannot modify protected Lambda context field: ${String(t)}`)}this.currentContext=this.currentContext||{};this.currentContext[t]=n}run(t,n){this.currentContext=t;return n()}}class InvokeStoreMulti extends InvokeStoreBase{als;static async create(){const t=new InvokeStoreMulti;const n=await Promise.resolve().then(i.t.bind(i,6698,23));t.als=new n.AsyncLocalStorage;return t}getContext(){return this.als.getStore()}hasContext(){return this.als.getStore()!==undefined}get(t){return this.als.getStore()?.[t]}set(t,n){if(this.isProtectedKey(t)){throw new Error(`Cannot modify protected Lambda context field: ${String(t)}`)}const i=this.als.getStore();if(!i){throw new Error("No context available")}i[t]=n}run(t,n){return this.als.run(t,n)}}n.InvokeStore=void 0;(function(t){let n=null;async function getInstanceAsync(t){if(!n){n=(async()=>{const n=t===true||"AWS_LAMBDA_MAX_CONCURRENCY"in process.env;const i=n?await InvokeStoreMulti.create():new InvokeStoreSingle;if(!A&&globalThis.awslambda?.InvokeStore){return globalThis.awslambda.InvokeStore}else if(!A&&globalThis.awslambda){globalThis.awslambda.InvokeStore=i;return i}else{return i}})()}return n}t.getInstanceAsync=getInstanceAsync;t._testing=process.env.AWS_LAMBDA_BENCHMARK_MODE==="1"?{reset:()=>{n=null;if(globalThis.awslambda?.InvokeStore){delete globalThis.awslambda.InvokeStore}globalThis.awslambda={InvokeStore:undefined}}}:undefined})(n.InvokeStore||(n.InvokeStore={}));n.InvokeStoreBase=InvokeStoreBase},402:(t,n,i)=>{const{getSmithyContext:a}=i(4534);n.getSmithyContext=a;const{HttpRequest:A}=i(3422);const{requestBuilder:c}=i(3422);n.requestBuilder=c;const{HttpApiKeyAuthLocation:l}=i(690);const resolveAuthOptions=(t,n)=>{if(!n||n.length===0){return t}const i=[];for(const a of n){for(const n of t){const t=n.schemeId.split("#")[1];if(t===a){i.push(n)}}}for(const n of t){if(!i.find(({schemeId:t})=>t===n.schemeId)){i.push(n)}}return i};function convertHttpAuthSchemesToMap(t){const n=new Map;for(const i of t){n.set(i.schemeId,i)}return n}const httpAuthSchemeMiddleware=(t,n)=>(i,A)=>async c=>{const l=t.httpAuthSchemeProvider(await n.httpAuthSchemeParametersProvider(t,A,c.input));const d=t.authSchemePreference?await t.authSchemePreference():[];const h=resolveAuthOptions(l,d);const f=convertHttpAuthSchemesToMap(t.httpAuthSchemes);const g=a(A);const p=[];for(const i of h){const a=f.get(i.schemeId);if(!a){p.push(`HttpAuthScheme \`${i.schemeId}\` was not enabled for this service.`);continue}const c=a.identityProvider(await n.identityProviderConfigProvider(t));if(!c){p.push(`HttpAuthScheme \`${i.schemeId}\` did not have an IdentityProvider configured.`);continue}const{identityProperties:l={},signingProperties:d={}}=i.propertiesExtractor?.(t,A)||{};i.identityProperties=Object.assign(i.identityProperties||{},l);i.signingProperties=Object.assign(i.signingProperties||{},d);g.selectedHttpAuthScheme={httpAuthOption:i,identity:await c(i.identityProperties),signer:a.signer};break}if(!g.selectedHttpAuthScheme){throw new Error(p.join("\n"))}return i(c)};const d={step:"serialize",tags:["HTTP_AUTH_SCHEME"],name:"httpAuthSchemeMiddleware",override:true,relation:"before",toMiddleware:"endpointV2Middleware"};const getHttpAuthSchemeEndpointRuleSetPlugin=(t,{httpAuthSchemeParametersProvider:n,identityProviderConfigProvider:i})=>({applyToStack:a=>{a.addRelativeTo(httpAuthSchemeMiddleware(t,{httpAuthSchemeParametersProvider:n,identityProviderConfigProvider:i}),d)}});const h={step:"serialize",tags:["HTTP_AUTH_SCHEME"],name:"httpAuthSchemeMiddleware",override:true,relation:"before",toMiddleware:"serializerMiddleware"};const getHttpAuthSchemePlugin=(t,{httpAuthSchemeParametersProvider:n,identityProviderConfigProvider:i})=>({applyToStack:a=>{a.addRelativeTo(httpAuthSchemeMiddleware(t,{httpAuthSchemeParametersProvider:n,identityProviderConfigProvider:i}),h)}});const defaultErrorHandler=t=>t=>{throw t};const defaultSuccessHandler=(t,n)=>{};const httpSigningMiddleware=t=>(t,n)=>async i=>{if(!A.isInstance(i.request)){return t(i)}const c=a(n);const l=c.selectedHttpAuthScheme;if(!l){throw new Error(`No HttpAuthScheme was selected: unable to sign request`)}const{httpAuthOption:{signingProperties:d={}},identity:h,signer:f}=l;const g=await t({...i,request:await f.sign(i.request,h,d)}).catch((f.errorHandler||defaultErrorHandler)(d));(f.successHandler||defaultSuccessHandler)(g.response,d);return g};const f={step:"finalizeRequest",tags:["HTTP_SIGNING"],name:"httpSigningMiddleware",aliases:["apiKeyMiddleware","tokenMiddleware","awsAuthMiddleware"],override:true,relation:"after",toMiddleware:"retryMiddleware"};const getHttpSigningPlugin=t=>({applyToStack:t=>{t.addRelativeTo(httpSigningMiddleware(),f)}});const normalizeProvider=t=>{if(typeof t==="function")return t;const n=Promise.resolve(t);return()=>n};const makePagedClientRequest=async(t,n,i,a=t=>t,...A)=>{let c=new t(i);c=a(c)??c;return await n.send(c,...A)};function createPaginator(t,n,i,a,A){return async function*paginateOperation(c,l,...d){const h=l;let f=c.startingToken??h[i];let g=true;let p;while(g){h[i]=f;if(A){h[A]=h[A]??c.pageSize}if(c.client instanceof t){p=await makePagedClientRequest(n,c.client,l,c.withCommand,...d)}else{throw new Error(`Invalid client, expected instance of ${t.name}`)}yield p;const m=f;f=get(p,a);g=!!(f&&(!c.stopOnSameToken||f!==m))}return undefined}}const get=(t,n)=>{let i=t;const a=n.split(".");for(const t of a){if(!i||typeof i!=="object"){return undefined}i=i[t]}return i};function setFeature(t,n,i){if(!t.__smithy_context){t.__smithy_context={features:{}}}else if(!t.__smithy_context.features){t.__smithy_context.features={}}t.__smithy_context.features[n]=i}class DefaultIdentityProviderConfig{authSchemes=new Map;constructor(t){for(const n in t){const i=t[n];if(i!==undefined){this.authSchemes.set(n,i)}}}getIdentityProvider(t){return this.authSchemes.get(t)}}class HttpApiKeyAuthSigner{async sign(t,n,i){if(!i){throw new Error("request could not be signed with `apiKey` since the `name` and `in` signer properties are missing")}if(!i.name){throw new Error("request could not be signed with `apiKey` since the `name` signer property is missing")}if(!i.in){throw new Error("request could not be signed with `apiKey` since the `in` signer property is missing")}if(!n.apiKey){throw new Error("request could not be signed with `apiKey` since the `apiKey` is not defined")}const a=A.clone(t);if(i.in===l.QUERY){a.query[i.name]=n.apiKey}else if(i.in===l.HEADER){a.headers[i.name]=i.scheme?`${i.scheme} ${n.apiKey}`:n.apiKey}else{throw new Error("request can only be signed with `apiKey` locations `query` or `header`, "+"but found: `"+i.in+"`")}return a}}class HttpBearerAuthSigner{async sign(t,n,i){const a=A.clone(t);if(!n.token){throw new Error("request could not be signed with `token` since the `token` is not defined")}a.headers["Authorization"]=`Bearer ${n.token}`;return a}}class NoAuthSigner{async sign(t,n,i){return t}}const createIsIdentityExpiredFunction=t=>function isIdentityExpired(n){return doesIdentityRequireRefresh(n)&&n.expiration.getTime()-Date.now()t.expiration!==undefined;const memoizeIdentityProvider=(t,n,i)=>{if(t===undefined){return undefined}const a=typeof t!=="function"?async()=>Promise.resolve(t):t;let A;let c;let l;let d=false;const coalesceProvider=async t=>{if(!c){c=a(t)}try{A=await c;l=true;d=false}finally{c=undefined}return A};if(n===undefined){return async t=>{if(!l||t?.forceRefresh){A=await coalesceProvider(t)}return A}}return async t=>{if(!l||t?.forceRefresh){A=await coalesceProvider(t)}if(d){return A}if(!i(A)){d=true;return A}if(n(A)){await coalesceProvider(t);return A}return A}};n.DefaultIdentityProviderConfig=DefaultIdentityProviderConfig;n.EXPIRATION_MS=g;n.HttpApiKeyAuthSigner=HttpApiKeyAuthSigner;n.HttpBearerAuthSigner=HttpBearerAuthSigner;n.NoAuthSigner=NoAuthSigner;n.createIsIdentityExpiredFunction=createIsIdentityExpiredFunction;n.createPaginator=createPaginator;n.doesIdentityRequireRefresh=doesIdentityRequireRefresh;n.getHttpAuthSchemeEndpointRuleSetPlugin=getHttpAuthSchemeEndpointRuleSetPlugin;n.getHttpAuthSchemePlugin=getHttpAuthSchemePlugin;n.getHttpSigningPlugin=getHttpSigningPlugin;n.httpAuthSchemeEndpointRuleSetMiddlewareOptions=d;n.httpAuthSchemeMiddleware=httpAuthSchemeMiddleware;n.httpAuthSchemeMiddlewareOptions=h;n.httpSigningMiddleware=httpSigningMiddleware;n.httpSigningMiddlewareOptions=f;n.isIdentityExpired=p;n.memoizeIdentityProvider=memoizeIdentityProvider;n.normalizeProvider=normalizeProvider;n.setFeature=setFeature},4645:(t,n,i)=>{const{nv:a,NumericValue:A,calculateBodyLength:c,_parseEpochTimestamp:l,fromBase64:d,generateIdempotencyToken:h}=i(2430);const{HttpRequest:f,collectBody:g,SerdeContext:p,RpcProtocol:m}=i(3422);const{NormalizedSchema:E,deref:C,TypeRegistry:I}=i(6890);const{getSmithyContext:y}=i(4534);const B=0;const Q=1;const w=2;const S=3;const b=4;const R=5;const v=6;const k=7;const D=20;const T=21;const N=22;const M=23;const F=24;const x=25;const U=26;const P=27;const L=31;function alloc(t){return typeof Buffer!=="undefined"?Buffer.alloc(t):new Uint8Array(t)}const O=Symbol("@smithy/core/cbor::tagSymbol");function tag(t){t[O]=true;return t}const H=typeof Buffer!=="undefined";const $=new TextDecoder;let G=alloc(0);let V=false;let Y=new DataView(G.buffer,G.byteOffset,G.byteLength);let J=0;function setPayload(t){G=t;V=H&&G instanceof Buffer;Y=new DataView(G.buffer,G.byteOffset,G.byteLength)}function decode(t,n){if(t>=n){throw new Error("unexpected end of (decode) payload.")}const i=(G[t]&224)>>5;const a=G[t]&31;if(a===L&&2<=i&&i<=5){return decodeIndefinite(t,n)}switch(i){case B:case Q:case v:{let A;let c;if(a<24){A=a;c=1}else{switch(a){case F:if(n-t<2){overflow(1)}A=G[t+1];c=2;break;case x:if(n-t<3){overflow(2)}A=Y.getUint16(t+1);c=3;break;case U:if(n-t<5){overflow(4)}A=Y.getUint32(t+1);c=5;break;case P:if(n-t<9){overflow(8)}{const n=Y.getUint32(t+1);if(n<2097152){A=n*4294967296+Y.getUint32(t+5)}else{A=Y.getBigUint64(t+1)}}c=9;break;default:unexpectedMinor(a)}}if(i===B){J=c;return castBigInt(A)}else if(i===Q){let t;if(typeof A==="bigint"){t=BigInt(-1)-A}else{t=-1-A}J=c;return castBigInt(t)}else{return decodeTagValue(t,n,a,A,c)}}case S:return decodeUtf8String(t,n);case R:return decodeMap(t,n);case b:return decodeList(t,n);case w:return decodeUnstructuredByteString(t,n);default:return decodeSpecial(t,n)}}function decodeIndefinite(t,n){const i=(G[t]&224)>>5;const a=G[t]&31;if(a===L){switch(i){case S:return decodeUtf8StringIndefinite(t,n);case R:return decodeMapIndefinite(t,n);case b:return decodeListIndefinite(t,n);case w:return decodeUnstructuredByteStringIndefinite(t,n)}}}function bytesToFloat16(t,n){const i=t>>7;const a=(t&124)>>2;const A=(t&3)<<8|n;const c=i===0?1:-1;if(a===0){if(A===0){return 0}return c*(Math.pow(2,1-15)*(A/1024))}else if(a===31){if(A===0){return c*Infinity}return NaN}return c*(Math.pow(2,a-15)*(1+A/1024))}function decodeMap(t,n){const i=decodeCount(t,n);if(i<15){return decodeMapSmall(t,n,i)}return decodeMapLarge(t,n,i)}function decodeMapLarge(t,n,i){const a=J;t+=a;const A=t;const c=Object.create(null);for(let a=0;a>5;if(a===S){c[i]=decodeUtf8String(t,n)}else{c[i]=decode(t,n)}t+=J}J=a+(t-A);Object.setPrototypeOf(c,Object.prototype);return c}function decodeMapSmall(t,n,i){const a=J;t+=a;const A=t;const c={};for(let a=0;a>>0&2047;const A=W[a];if(A!==undefined){if(A.length===n){let i=true;for(let a=0;a>5;const c=G[t]&31;if(A!==S){unexpectedMajorInIndefiniteString(A)}if(c===L){throw new Error("nested indefinite string.")}const l=decodeUnstructuredByteString(t,n);const d=J;t+=d;for(let t=0;t>5;const c=G[t]&31;if(A!==w){unexpectedMajorInIndefiniteString(A)}if(c===L){throw new Error("nested indefinite string.")}const l=decodeUnstructuredByteString(t,n);const d=J;t+=d;for(let t=0;t23){encodeHeader(S,Buffer.byteLength(t));ne+=te.write(t,ne)}else{encodeStringCached(t)}}else{const i=n*3;ensureSpace(i+9);const a=ne;const A=(new TextEncoder).encodeInto(t,te.subarray(ne+9));const c=A.written;let l;if(c<24){l=1}else if(c<256){l=2}else if(c<65536){l=3}else if(c<4294967296){l=5}else{l=9}if(l<9){te.copyWithin(a+l,a+9,a+9+c)}ne=a;encodeInteger(S,c);ne+=c}continue}if(te.byteLength-ne<9){ensureSpace(64)}if(typeof t==="number"){if(Number.isInteger(t)){const n=t>=0;const i=n?B:Q;const a=n?t:-t-1;if(a<24){te[ne++]=i<<5|a}else if(a<256){te[ne++]=i<<5|24;te[ne++]=a}else if(a<65536){te[ne++]=i<<5|x;te[ne++]=a>>8;te[ne++]=a&255}else if(a<4294967296){te[ne++]=i<<5|U;re.setUint32(ne,a);ne+=4}else{te[ne++]=i<<5|P;const t=a/4294967296|0;const n=a-t*4294967296|0;re.setUint32(ne,t);re.setUint32(ne+4,n);ne+=8}continue}te[ne++]=k<<5|P;re.setFloat64(ne,t);ne+=8;continue}else if(typeof t==="bigint"){const n=t>=0;const i=n?B:Q;const a=n?t:-t-BigInt(1);if(a=0){i[i.byteLength-c]=Number(A&BigInt(255));A>>=BigInt(8)}ensureSpace(i.byteLength*2+16);te[ne++]=n?194:195;encodeHeader(w,i.byteLength);te.set(i,ne);ne+=i.byteLength}continue}else if(t===null){te[ne++]=k<<5|N;continue}else if(typeof t==="boolean"){te[ne++]=k<<5|(t?T:D);continue}else if(typeof t==="undefined"){throw new Error("@smithy/core/cbor: client may not serialize undefined value.")}else if(Array.isArray(t)){encodeInteger(b,t.length);ensureSpace(t.length*9+64);for(let i=t.length-1;i>=0;--i){n.push(t[i])}continue}else if(typeof t.byteLength==="number"){ensureSpace(t.length*2+9);encodeInteger(w,t.length);te.set(t,ne);ne+=t.byteLength;continue}else if(typeof t==="object"){if(t instanceof A){const i=t.string.indexOf(".");const a=i===-1?0:i-t.string.length+1;const A=BigInt(t.string.replace(".",""));te[ne++]=196;encodeInteger(b,2);n.push(A);n.push(a);continue}if(t[O]){if("tag"in t&&"value"in t){n.push(t.value);encodeHeader(v,t.tag);continue}else{throw new Error("tag encountered with missing fields, need 'tag' and 'value', found: "+JSON.stringify(t))}}const i=Object.keys(t);const a=i.length;encodeInteger(R,a);for(let A=a-1;A>=0;--A){n.push(t[i[A]]);n.push(i[A])}continue}throw new Error(`data type ${t?.constructor?.name??typeof t} not compatible for encoding.`)}}function advanceEncodingEpoch(){Z=Z+1&65535;X=false}function toUint8Array(){const t=alloc(ne);t.set(te.subarray(0,ne),0);ne=0;return t}function resize(t){const n=te;te=alloc(t);if(n){if(n.copy){n.copy(te,0,0,n.byteLength)}else{te.set(n,0)}}re=new DataView(te.buffer,te.byteOffset,te.byteLength)}function encodeStringCached(t){const n=K.get(t);if(n!==undefined){te.set(n.bytes,ne);ne+=n.bytes.length;n.epoch=Z;return}const i=ne;const a=Buffer.byteLength(t);encodeInteger(S,a);ne+=te.write(t,ne);const A=Uint8Array.prototype.slice.call(te,i,ne);if(K.size>=2048){if(X){return}let t=0;for(const[n,i]of K){if(t>=1024){break}if(i.epoch!==Z){K.delete(n);t++}}if(t===0){X=true;return}}if(K.size<2048){K.set(t,{epoch:Z,bytes:A})}}function ensureSpace(t){const n=te.byteLength-ne;if(n>8;te[ne++]=n&255}else if(n<4294967296){te[ne++]=t<<5|U;re.setUint32(ne,n);ne+=4}else{te[ne++]=t<<5|P;const i=n/4294967296|0;const a=n-i*4294967296|0;re.setUint32(ne,i);re.setUint32(ne+4,a);ne+=8}}const se={deserialize(t){advanceDecodingEpoch();setPayload(t);return decode(0,t.length)},serialize(t){advanceEncodingEpoch();try{encode(t);return toUint8Array()}catch(t){toUint8Array();throw t}},resizeEncodingBuffer(t){resize(t)}};const parseCborBody=(t,n)=>g(t,n).then(async t=>{if(t.length){try{return se.deserialize(t)}catch(i){Object.defineProperty(i,"$responseBodyText",{value:n.utf8Encoder(t)});throw i}}return{}});const dateToTag=t=>tag({tag:1,value:t.getTime()/1e3});const parseCborErrorBody=async(t,n)=>{const i=await parseCborBody(t,n);i.message=i.message??i.Message;return i};const loadSmithyRpcV2CborErrorCode=(t,n)=>{const sanitizeErrorCode=t=>{let n=t;if(typeof n==="number"){n=n.toString()}if(n.indexOf(",")>=0){n=n.split(",")[0]}if(n.indexOf(":")>=0){n=n.split(":")[0]}if(n.indexOf("#")>=0){n=n.split("#")[1]}return n};if(n["__type"]!==undefined){return sanitizeErrorCode(n["__type"])}let i;for(const t in n){if(t.toLowerCase()==="code"){i=t;break}}if(i&&n[i]!==undefined){return sanitizeErrorCode(n[i])}};const checkCborResponse=t=>{if(String(t.headers["smithy-protocol"]).toLowerCase()!=="rpc-v2-cbor"){throw new Error("Malformed RPCv2 CBOR response, status: "+t.statusCode)}};const buildHttpRpcRequest=async(t,n,i,a,A)=>{const l=await t.endpoint();const{hostname:d,protocol:h="https",port:g,path:p}=l;const m={protocol:h,hostname:d,port:g,method:"POST",path:p.endsWith("/")?p.slice(0,-1)+i:p+i,headers:{...n}};if(a!==undefined){m.hostname=a}if(l.headers){for(const t in l.headers){m.headers[t]=l.headers[t]}}if(A!==undefined){m.body=A;try{m.headers["content-length"]=String(c(A))}catch(t){}}return new f(m)};class CborCodec extends p{createSerializer(){const t=new CborShapeSerializer;t.setSerdeContext(this.serdeContext);return t}createDeserializer(){const t=new CborShapeDeserializer;t.setSerdeContext(this.serdeContext);return t}}class CborShapeSerializer extends p{value;write(t,n){this.value=this.serialize(t,n)}serialize(t,n){const i=E.of(t);if(n==null){if(i.isIdempotencyToken()){return h()}return n}if(i.isBlobSchema()){if(typeof n==="string"){return(this.serdeContext?.base64Decoder??d)(n)}return n}if(i.isTimestampSchema()){if(typeof n==="number"||typeof n==="bigint"){return dateToTag(new Date(Number(n)/1e3|0))}return dateToTag(n)}if(typeof n==="function"||typeof n==="object"){const t=n;if(i.isListSchema()&&Array.isArray(t)){const n=!!i.getMergedTraits().sparse;const a=[];let A=0;for(const c of t){const t=this.serialize(i.getValueSchema(),c);if(t!=null||n){a[A++]=t}}return a}if(t instanceof Date){return dateToTag(t)}const a={};if(i.isMapSchema()){const n=!!i.getMergedTraits().sparse;for(const A in t){const c=this.serialize(i.getValueSchema(),t[A]);if(c!=null||n){a[A]=c}}}else if(i.isStructSchema()){for(const[n,A]of i.structIterator()){const i=this.serialize(A,t[n]);if(i!=null){a[n]=i}}const n=i.isUnionSchema();if(n&&Array.isArray(t.$unknown)){const[n,i]=t.$unknown;a[n]=i}else if(typeof t.__type==="string"){for(const n in t){if(!(n in a)){a[n]=this.serialize(15,t[n])}}}}else if(i.isDocumentSchema()){for(const n in t){a[n]=this.serialize(i.getValueSchema(),t[n])}}else if(i.isBigDecimalSchema()){return t}return a}return n}flush(){const t=se.serialize(this.value);this.value=undefined;return t}}class CborShapeDeserializer extends p{read(t,n){const i=se.deserialize(n);return this.readValue(t,i)}readValue(t,n){const i=E.of(t);if(i.isTimestampSchema()){if(typeof n==="number"){return l(n)}if(typeof n==="object"){if(n.tag===1&&"value"in n){return l(n.value)}}}if(i.isBlobSchema()){if(typeof n==="string"){return(this.serdeContext?.base64Decoder??d)(n)}return n}if(typeof n==="undefined"||typeof n==="boolean"||typeof n==="number"||typeof n==="string"||typeof n==="bigint"||typeof n==="symbol"){return n}else if(typeof n==="object"){if(n===null){return null}if("byteLength"in n){return n}if(n instanceof Date){return n}if(i.isDocumentSchema()){return n}if(i.isListSchema()){const t=[];const a=i.getValueSchema();for(const i of n){const n=this.readValue(a,i);t.push(n)}return t}const t={};if(i.isMapSchema()){const a=i.getValueSchema();for(const i in n){const A=this.readValue(a,n[i]);t[i]=A}}else if(i.isStructSchema()){const a=i.isUnionSchema();let A;if(a){A=new Set;for(const t in n){if(t!=="__type"){A.add(t)}}}for(const[c,l]of i.structIterator()){if(a){A.delete(c)}if(n[c]!=null){t[c]=this.readValue(l,n[c])}}if(a&&A?.size===1){let i=true;for(const n in t){i=false;break}if(i){const i=A.values().next().value;t.$unknown=[i,n[i]]}}else if(typeof n.__type==="string"){for(const i in n){if(!(i in t)){t[i]=n[i]}}}}else if(n instanceof A){return n}return t}else{return n}}}class SmithyRpcV2CborProtocol extends m{codec=new CborCodec;serializer=this.codec.createSerializer();deserializer=this.codec.createDeserializer();constructor({defaultNamespace:t,errorTypeRegistries:n}){super({defaultNamespace:t,errorTypeRegistries:n})}getShapeId(){return"smithy.protocols#rpcv2Cbor"}getPayloadCodec(){return this.codec}async serializeRequest(t,n,i){const a=await super.serializeRequest(t,n,i);Object.assign(a.headers,{"content-type":this.getDefaultContentType(),"smithy-protocol":"rpc-v2-cbor",accept:this.getDefaultContentType()});if(C(t.input)==="unit"){delete a.body;delete a.headers["content-type"]}else{if(!a.body){this.serializer.write(15,{});a.body=this.serializer.flush()}try{a.headers["content-length"]=String(a.body.byteLength)}catch(t){}}const{service:A,operation:c}=y(i);const l=`/service/${A}/operation/${c}`;if(a.path.endsWith("/")){a.path+=l.slice(1)}else{a.path+=l}return a}async deserializeResponse(t,n,i){return super.deserializeResponse(t,n,i)}async handleError(t,n,i,a,A){const c=loadSmithyRpcV2CborErrorCode(i,a)??"Unknown";const l={$metadata:A,$fault:i.statusCode<=500?"client":"server"};let d=this.options.defaultNamespace;if(c.includes("#")){[d]=c.split("#")}const h=this.compositeErrorRegistry;const f=I.for(d);h.copyFrom(f);let g;try{g=h.getSchema(c)}catch(t){if(a.Message){a.message=a.Message}const n=I.for("smithy.ts.sdk.synthetic."+d);h.copyFrom(n);const i=h.getBaseException();if(i){const t=h.getErrorCtor(i);throw Object.assign(new t({name:c}),l,a)}throw Object.assign(new Error(c),l,a)}const p=E.of(g);const m=h.getErrorCtor(g);const C=a.message??a.Message??"Unknown";const y=new m({});const B={};for(const[t,n]of p.structIterator()){B[t]=this.deserializer.readValue(n,a[t])}throw Object.assign(y,l,{$fault:p.getMergedTraits().error,message:C},B)}getDefaultContentType(){return"application/cbor"}}n.CborCodec=CborCodec;n.CborShapeDeserializer=CborShapeDeserializer;n.CborShapeSerializer=CborShapeSerializer;n.SmithyRpcV2CborProtocol=SmithyRpcV2CborProtocol;n.buildHttpRpcRequest=buildHttpRpcRequest;n.cbor=se;n.checkCborResponse=checkCborResponse;n.dateToTag=dateToTag;n.loadSmithyRpcV2CborErrorCode=loadSmithyRpcV2CborErrorCode;n.parseCborBody=parseCborBody;n.parseCborErrorBody=parseCborErrorBody;n.tag=tag;n.tagSymbol=O},9542:(t,n,i)=>{const{createReadStream:a}=i(3024);const{Writable:A}=i(7075);const{toUint8Array:c,concatBytes:l}=i(2430);const{createHash:d,createHmac:h}=i(7598);const f=i(8522);async function blobReader(t,n,i=1024*1024){const a=t.size;let A=0;while(A{i.update(t)});return i.digest()};class HashCalculator extends A{hash;constructor(t,n){super(n);this.hash=t}_write(t,n,i){try{this.hash.update(c(t))}catch(t){return i(t)}i()}}const fileStreamHasher=(t,n)=>new Promise((i,A)=>{if(!isReadStream(n)){A(new Error("Unable to calculate hash for non-file streams."));return}const c=a(n.path,{start:n.start,end:n.end});const l=new t;const d=new HashCalculator(l);c.pipe(d);c.on("error",t=>{d.end();A(t)});d.on("error",A);d.on("finish",function(){l.digest().then(i).catch(A)})});const isReadStream=t=>typeof t.path==="string";const readableStreamHasher=(t,n)=>{if(n.readableFlowing!==null){throw new Error("Unable to calculate hash for flowing readable stream")}const i=new t;const a=new HashCalculator(i);n.pipe(a);return new Promise((t,A)=>{n.on("error",t=>{a.end();A(t)});a.on("error",A);a.on("finish",()=>{i.digest().then(t).catch(A)})})};class Md5Js{digestLength=16;state=Uint32Array.from(p);writeBuffer=new DataView(new ArrayBuffer(64));bufferLength=0;bytesHashed=0;update(t){const n=c(t);let i=0;let a=n.byteLength;this.bytesHashed+=a;while(a>0){this.writeBuffer.setUint8(this.bufferLength++,n[i++]);--a;if(this.bufferLength===64){compress(this.state,this.writeBuffer);this.bufferLength=0}}}async digest(){const t=Uint32Array.from(this.state);const n=new DataView(this.writeBuffer.buffer.slice(0));let i=this.bufferLength;const a=this.bytesHashed*8;n.setUint8(i++,128);if(this.bufferLength%64>=56){for(let t=i;t<64;++t){n.setUint8(t,0)}compress(t,n);i=0}for(let t=i;t<56;++t){n.setUint8(t,0)}n.setUint32(56,a>>>0,true);n.setUint32(60,Math.floor(a/2**32),true);compress(t,n);const A=new Uint8Array(16);const c=new DataView(A.buffer);for(let n=0;n<4;++n){c.setUint32(n*4,t[n],true)}return A}reset(){this.state.set(p);this.writeBuffer=new DataView(new ArrayBuffer(64));this.bufferLength=0;this.bytesHashed=0}}const p=[1732584193,4023233417,2562383102,271733878];const m=4294967295;const E=Uint8Array.of(7,12,17,22,5,9,14,20,4,11,16,23,6,10,15,21);const C=Array.from({length:64},(t,n)=>Math.abs(Math.sin(n+1))*2**32>>>0);function compress(t,n){let i=t[0],a=t[1],A=t[2],c=t[3];for(let t=0;t<64;++t){let l,d;if(t<16){l=a&A|~a&c;d=t}else if(t<32){l=c&a|A&~c;d=(5*t+1)%16}else if(t<48){l=a^A^c;d=(3*t+5)%16}else{l=A^(a|~c);d=7*t%16}const h=n.getUint32(d*4,true);const f=c;c=A;A=a;const g=E[(t>>4)*4+(t&3)];const p=(i+l&m)+(h+C[t]&m)&m;a=a+((p<>>32-g)>>>0)&m;i=f}t[0]=t[0]+i&m;t[1]=t[1]+a&m;t[2]=t[2]+A&m;t[3]=t[3]+c&m}const I=(()=>{try{d("md5");return true}catch{return false}})();const y=I?buildNativeClass$2():Md5Js;function buildNativeClass$2(){return class Md5Node{digestLength=16;hash=d("md5");update(t){this.hash.update(c(t))}async digest(){const t=this.hash.copy().digest();return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}reset(){this.hash=d("md5")}}}const B=new Uint32Array(256);for(let t=0;t<256;++t){let n=t;for(let t=0;t<8;++t){n=n&1?3988292384^n>>>1:n>>>1}B[t]=n>>>0}const Q=4294967295;class Crc32Js{digestLength=4;checksum=Q;update(t){for(let n=0;n>>8^B[(this.checksum^t[n])&255]}}digestSync(){return(this.checksum^Q)>>>0}async digest(){const t=this.digestSync();const n=new Uint8Array(4);new DataView(n.buffer).setUint32(0,t,false);return n}reset(){this.checksum=Q}}const w=typeof f.crc32==="function"?f.crc32:undefined;const S=w?buildNativeClass$1(w):Crc32Js;function buildNativeClass$1(t){return class Crc32Node{digestLength=4;value=0;update(n){this.value=t(n,this.value)}digestSync(){return this.value>>>0}async digest(){const t=new Uint8Array(4);new DataView(t.buffer).setUint32(0,this.digestSync(),false);return t}reset(){this.value=0}}}const b=64;const R=32;const v=2**53-1;class Sha256Js{digestLength=R;state=Int32Array.from(k);w;buffer=new Uint8Array(64);bufferLength=0;bytesHashed=0;finished=false;inner;outer;constructor(t){if(t){const n=Sha256Js.normalizeKey(t);this.inner=new Sha256Js;this.outer=new Sha256Js;const{inner:i,outer:a}=this;const A=new Uint8Array(b*2);for(let t=0;tv){throw new Error("Cannot hash more than 2^53 - 1 bits")}while(a>0){this.buffer[this.bufferLength++]=n[i++];a--;if(this.bufferLength===b){this.hashBuffer();this.bufferLength=0}}}async digest(){const{inner:t,outer:n}=this;if(t&&n){if(this.finished){throw new Error("Attempted to digest an already finished HMAC.")}this.finished=true;const i=t.digestSync();n.update(i);return n.digestSync()}return this.digestSync()}reset(){this.state=Int32Array.from(k);this.buffer=new Uint8Array(64);this.bufferLength=0;this.bytesHashed=0}digestSync(){const t=this.state.slice();const n=this.buffer.slice();let i=this.bufferLength;const a=this.bytesHashed*8;const A=new DataView(n.buffer,n.byteOffset,n.byteLength);A.setUint8(i++,128);if((i-1)%b>=b-8){for(let t=i;t>>24&255;c[n*4+1]=t[n]>>>16&255;c[n*4+2]=t[n]>>>8&255;c[n*4+3]=t[n]>>>0&255}return c}static normalizeKey(t){const n=c(t);if(n.byteLength>b){const t=new Sha256Js;t.update(n);const i=t.digestSync();const a=new Uint8Array(b);a.set(i);return a}if(n.byteLength>>17|n<<15)^(n>>>19|n<<13)^n>>>10;n=i[t-15];const A=(n>>>7|n<<25)^(n>>>18|n<<14)^n>>>3;i[t]=(a+i[t-7]|0)+(A+i[t-16]|0)}const p=(((d>>>6|d<<26)^(d>>>11|d<<21)^(d>>>25|d<<7))+(d&h^~d&f)|0)+(g+(D[t]+i[t]|0)|0)|0;const m=((a>>>2|a<<30)^(a>>>13|a<<19)^(a>>>22|a<<10))+(a&A^a&c^A&c)|0;g=f;f=h;h=d;d=l+p|0;l=c;c=A;A=a;a=p+m|0}t[0]+=a;t[1]+=A;t[2]+=c;t[3]+=l;t[4]+=d;t[5]+=h;t[6]+=f;t[7]+=g}}const k=new Int32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);const D=new Int32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);const T=(()=>{try{d("sha256");return true}catch{return false}})();const N=T?buildNativeClass():Sha256Js;function buildNativeClass(){return class Sha256Node{digestLength=32;secret;hash;isHmac;finished=false;constructor(t){this.secret=t;this.isHmac=!!t;this.hash=this.createHash()}update(t){if(this.finished){throw new Error("Attempted to update an already finished hash.")}this.hash.update(t)}async digest(){let t;if(this.isHmac){this.finished=true;t=this.hash.digest()}else{t=this.hash.copy().digest()}return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}reset(){this.hash=this.createHash();this.finished=false}createHash(){return this.secret?h("sha256",toBuffer(this.secret)):d("sha256")}}}function toBuffer(t){if(typeof t==="string"){return t}if(ArrayBuffer.isView(t)){return Buffer.from(t.buffer,t.byteOffset,t.byteLength)}return Buffer.from(t)}const{digest:M,sign:F,importKey:x}=globalThis?.crypto?.subtle??{};const U=typeof M==="function"&&typeof F==="function"&&typeof x==="function"?globalThis.crypto.subtle:undefined;const P=8*1024*1024;class Sha256WebCrypto{digestLength=32;secret;pending=[];pendingBytes=0;fallback;finished=false;constructor(t){if(t){this.secret=c(t)}}update(t){if(this.finished){throw new Error("Attempted to update an already finished HMAC.")}if(this.fallback){this.fallback.update(t);return}this.pending.push(t.slice());this.pendingBytes+=t.byteLength;if(this.pendingBytes>=P){this.switchToFallback()}}async digest(){if(this.fallback){return this.fallback.digest()}if(this.secret&&this.finished){throw new Error("Attempted to digest an already finished HMAC.")}const t=l(this.pending);if(U){if(this.secret){this.finished=true;const n=await U.importKey("raw",this.secret,{name:"HMAC",hash:"SHA-256"},false,["sign"]);const i=await U.sign("HMAC",n,t);return new Uint8Array(i)}const n=await U.digest("SHA-256",t);return new Uint8Array(n)}const n=new Sha256Js(this.secret);n.update(t);return n.digest()}reset(){this.pending=[];this.pendingBytes=0;this.fallback=undefined;this.finished=false}switchToFallback(){const t=new Sha256Js(this.secret);for(const n of this.pending){t.update(n)}this.fallback=t;this.pending=[];this.pendingBytes=0}}n.Crc32=S;n.Crc32Js=Crc32Js;n.Crc32Node=S;n.Md5=y;n.Md5Js=Md5Js;n.Md5Node=y;n.Sha256=N;n.Sha256Js=Sha256Js;n.Sha256Node=N;n.Sha256WebCrypto=Sha256WebCrypto;n.blobHasher=g;n.blobReader=blobReader;n.fileStreamHasher=fileStreamHasher;n.readableStreamHasher=readableStreamHasher},2658:(t,n,i)=>{const{getSmithyContext:a,normalizeProvider:A}=i(4534);n.getSmithyContext=a;n.normalizeProvider=A;const{SMITHY_CONTEXT_KEY:c,AlgorithmId:l}=i(690);n.AlgorithmId=l;const{NormalizedSchema:d}=i(6890);const getAllAliases=(t,n)=>{const i=[];if(t){i.push(t)}if(n){for(const t of n){i.push(t)}}return i};const getMiddlewareNameWithAliases=(t,n)=>`${t||"anonymous"}${n&&n.length>0?` (a.k.a. ${n.join(",")})`:""}`;const constructStack=()=>{let t=[];let n=[];let i=false;const a=new Set;const sort=t=>t.sort((t,n)=>h[n.step]-h[t.step]||f[n.priority||"normal"]-f[t.priority||"normal"]);const removeByName=i=>{let A=false;const filterCb=t=>{const n=getAllAliases(t.name,t.aliases);if(n.includes(i)){A=true;for(const t of n){a.delete(t)}return false}return true};t=t.filter(filterCb);n=n.filter(filterCb);return A};const removeByReference=i=>{let A=false;const filterCb=t=>{if(t.middleware===i){A=true;for(const n of getAllAliases(t.name,t.aliases)){a.delete(n)}return false}return true};t=t.filter(filterCb);n=n.filter(filterCb);return A};const cloneTo=i=>{t.forEach(t=>{i.add(t.middleware,{...t})});n.forEach(t=>{i.addRelativeTo(t.middleware,{...t})});i.identifyOnResolve?.(A.identifyOnResolve());return i};const expandRelativeMiddlewareList=t=>{const n=[];t.before.forEach(t=>{if(t.before.length===0&&t.after.length===0){n.push(t)}else{n.push(...expandRelativeMiddlewareList(t))}});n.push(t);t.after.reverse().forEach(t=>{if(t.before.length===0&&t.after.length===0){n.push(t)}else{n.push(...expandRelativeMiddlewareList(t))}});return n};const getMiddlewareList=(i=false)=>{const a=[];const A=[];const c={};t.forEach(t=>{const n={...t,before:[],after:[]};for(const t of getAllAliases(n.name,n.aliases)){c[t]=n}a.push(n)});n.forEach(t=>{const n={...t,before:[],after:[]};for(const t of getAllAliases(n.name,n.aliases)){c[t]=n}A.push(n)});A.forEach(t=>{if(t.toMiddleware){const n=c[t.toMiddleware];if(n===undefined){if(i){return}throw new Error(`${t.toMiddleware} is not found when adding `+`${getMiddlewareNameWithAliases(t.name,t.aliases)} `+`middleware ${t.relation} ${t.toMiddleware}`)}if(t.relation==="after"){n.after.push(t)}if(t.relation==="before"){n.before.push(t)}}});const l=sort(a).map(expandRelativeMiddlewareList).reduce((t,n)=>{t.push(...n);return t},[]);return l};const A={add:(n,i={})=>{const{name:A,override:c,aliases:l}=i;const d={step:"initialize",priority:"normal",middleware:n,...i};const h=getAllAliases(A,l);if(h.length>0){if(h.some(t=>a.has(t))){if(!c)throw new Error(`Duplicate middleware name '${getMiddlewareNameWithAliases(A,l)}'`);for(const n of h){const i=t.findIndex(t=>t.name===n||t.aliases?.some(t=>t===n));if(i===-1){continue}const a=t[i];if(a.step!==d.step||d.priority!==a.priority){throw new Error(`"${getMiddlewareNameWithAliases(a.name,a.aliases)}" middleware with `+`${a.priority} priority in ${a.step} step cannot `+`be overridden by "${getMiddlewareNameWithAliases(A,l)}" middleware with `+`${d.priority} priority in ${d.step} step.`)}t.splice(i,1)}}for(const t of h){a.add(t)}}t.push(d)},addRelativeTo:(t,i)=>{const{name:A,override:c,aliases:l}=i;const d={middleware:t,...i};const h=getAllAliases(A,l);if(h.length>0){if(h.some(t=>a.has(t))){if(!c)throw new Error(`Duplicate middleware name '${getMiddlewareNameWithAliases(A,l)}'`);for(const t of h){const i=n.findIndex(n=>n.name===t||n.aliases?.some(n=>n===t));if(i===-1){continue}const a=n[i];if(a.toMiddleware!==d.toMiddleware||a.relation!==d.relation){throw new Error(`"${getMiddlewareNameWithAliases(a.name,a.aliases)}" middleware `+`${a.relation} "${a.toMiddleware}" middleware cannot be overridden `+`by "${getMiddlewareNameWithAliases(A,l)}" middleware ${d.relation} `+`"${d.toMiddleware}" middleware.`)}n.splice(i,1)}}for(const t of h){a.add(t)}}n.push(d)},clone:()=>cloneTo(constructStack()),use:t=>{t.applyToStack(A)},remove:t=>{if(typeof t==="string")return removeByName(t);else return removeByReference(t)},removeByTag:i=>{let A=false;const filterCb=t=>{const{tags:n,name:c,aliases:l}=t;if(n&&n.includes(i)){const t=getAllAliases(c,l);for(const n of t){a.delete(n)}A=true;return false}return true};t=t.filter(filterCb);n=n.filter(filterCb);return A},concat:t=>{const n=cloneTo(constructStack());n.use(t);n.identifyOnResolve(i||n.identifyOnResolve()||(t.identifyOnResolve?.()??false));return n},applyToStack:cloneTo,identify:()=>getMiddlewareList(true).map(t=>{const n=t.step??t.relation+" "+t.toMiddleware;return getMiddlewareNameWithAliases(t.name,t.aliases)+" - "+n}),identifyOnResolve(t){if(typeof t==="boolean")i=t;return i},resolve:(t,n)=>{for(const i of getMiddlewareList().map(t=>t.middleware).reverse()){t=i(t,n)}if(i){console.log(A.identify())}return t}};return A};const h={initialize:5,serialize:4,build:3,finalizeRequest:2,deserialize:1};const f={high:3,normal:2,low:1};const invalidFunction=t=>()=>{throw new Error(t)};const invalidProvider=t=>()=>Promise.reject(t);const getCircularReplacer=()=>{const t=new WeakSet;return(n,i)=>{if(typeof i==="object"&&i!==null){if(t.has(i)){return"[Circular]"}t.add(i)}return i}};const sleep=t=>new Promise(n=>setTimeout(n,t*1e3));const g={minDelay:2,maxDelay:120};var p;(function(t){t["ABORTED"]="ABORTED";t["FAILURE"]="FAILURE";t["SUCCESS"]="SUCCESS";t["RETRY"]="RETRY";t["TIMEOUT"]="TIMEOUT"})(p||(p={}));const checkExceptions=t=>{if(t.state===p.ABORTED){const n=new Error(`${JSON.stringify({...t,reason:"Request was aborted"},getCircularReplacer())}`);n.name="AbortError";throw n}else if(t.state===p.TIMEOUT){const n=new Error(`${JSON.stringify({...t,reason:"Waiter has timed out"},getCircularReplacer())}`);n.name="TimeoutError";throw n}else if(t.state!==p.SUCCESS){throw new Error(`${JSON.stringify(t,getCircularReplacer())}`)}return t};const runPolling=async({minDelay:t,maxDelay:n,maxWaitTime:i,abortController:a,client:A,abortSignal:c},l,d)=>{const h={};const[f,g]=[t*1e3,n*1e3];let m=0;const E=Date.now()+i*1e3;const C=Date.now()+6e4;let I=false;while(true){if(m>0){const t=exponentialBackoffWithJitter(f,g,m,E);if(a?.signal?.aborted||c?.aborted){const t="AbortController signal aborted.";h[t]|=0;h[t]+=1;return{state:p.ABORTED,observedResponses:h}}if(Date.now()+t>E){return{state:p.TIMEOUT,observedResponses:h}}await sleep(t/1e3)}const{state:t,reason:n}=await d(A,l);if(n){const t=createMessageFromResponse(n);h[t]|=0;h[t]+=1}if(t!==p.RETRY){return{state:t,reason:n,final:n,observedResponses:h}}m+=1;if(!I&&Date.now()>=C){checkWarn403(h,A);I=true}}};const checkWarn403=(t={},n)=>{const i=Object.keys(t);let a=0;for(const n of i){const i=t[n]|0;if(n.startsWith("403:")){a+=i}}const A=n?.config?.logger;const c=typeof A?.warn==="function"&&!A.constructor?.name?.includes?.("NoOpLogger")?A:console;if(a>=3||i[i.length-1]?.startsWith("403:")){c.warn(`@smithy/util-waiter WARN - 403 status code encountered during waiter polling.`)}};const createMessageFromResponse=t=>{const n=t?.$response?.statusCode??t?.$metadata?.httpStatusCode;if(t?.$responseBodyText){return`${n?n+": ":""}Deserialization error for body: ${t.$responseBodyText}`}if(n){if(t?.$response||t?.message){return`${n??"Unknown"}: ${t?.message}`}return`${n}: OK`}return String(t?.message??JSON.stringify(t,getCircularReplacer())??"Unknown")};const exponentialBackoffWithJitter=(t,n,i,a)=>{const A=Math.log(n/t)/Math.log(2)+1;if(i>A){return n}const c=t*2**(i-1);const l=Math.min(c,n);const d=randomInRange(t,l);if(Date.now()+d>a){const t=a-Date.now();return Math.max(0,t-500)}return d};const randomInRange=(t,n)=>t+Math.random()*(n-t);const validateWaiterOptions=t=>{if(t.maxWaitTime<=0){throw new Error(`WaiterConfiguration.maxWaitTime must be greater than 0`)}else if(t.minDelay<=0){throw new Error(`WaiterConfiguration.minDelay must be greater than 0`)}else if(t.maxDelay<=0){throw new Error(`WaiterConfiguration.maxDelay must be greater than 0`)}else if(t.maxWaitTime<=t.minDelay){throw new Error(`WaiterConfiguration.maxWaitTime [${t.maxWaitTime}] must be greater than WaiterConfiguration.minDelay [${t.minDelay}] for this waiter`)}else if(t.maxDelay{let n;const i=new Promise(i=>{n=()=>i({state:p.ABORTED});if(typeof t.addEventListener==="function"){t.addEventListener("abort",n)}else{t.onabort=n}});return{clearListener(){if(typeof t.removeEventListener==="function"){t.removeEventListener("abort",n)}},aborted:i}};const createWaiter=async(t,n,i)=>{const a={...g,...t};validateWaiterOptions(a);const A=[runPolling(a,n,i)];const c=[];if(t.abortSignal){const{aborted:n,clearListener:i}=abortTimeout(t.abortSignal);c.push(i);A.push(n)}if(t.abortController?.signal){const{aborted:n,clearListener:i}=abortTimeout(t.abortController.signal);c.push(i);A.push(n)}return Promise.race(A).then(t=>{for(const t of c){t()}return t})};class Client{config;middlewareStack=constructStack();initConfig;handlers;constructor(t){this.config=t;const{protocol:n,protocolSettings:i}=t;if(i){if(typeof n==="function"){t.protocol=new n(i)}}}send(t,n,i){const a=typeof n!=="function"?n:undefined;const A=typeof n==="function"?n:i;const c=a===undefined&&this.config.cacheMiddleware===true;let l;if(c){if(!this.handlers){this.handlers=new WeakMap}const n=this.handlers;if(n.has(t.constructor)){l=n.get(t.constructor)}else{l=t.resolveMiddleware(this.middlewareStack,this.config,a);n.set(t.constructor,l)}}else{delete this.handlers;l=t.resolveMiddleware(this.middlewareStack,this.config,a)}if(A){l(t).then(t=>A(null,t.output),t=>A(t)).catch(()=>{})}else{return l(t).then(t=>t.output)}}destroy(){this.config?.requestHandler?.destroy?.();delete this.handlers}}const m="***SensitiveInformation***";function schemaLogFilter(t,n){if(n==null){return n}const i=d.of(t);if(i.getMergedTraits().sensitive){return m}if(i.isListSchema()){const t=!!i.getValueSchema().getMergedTraits().sensitive;if(t){return m}}else if(i.isMapSchema()){const t=!!i.getKeySchema().getMergedTraits().sensitive||!!i.getValueSchema().getMergedTraits().sensitive;if(t){return m}}else if(i.isStructSchema()&&typeof n==="object"){const t=n;const a={};for(const[n,A]of i.structIterator()){if(t[n]!=null){a[n]=schemaLogFilter(A,t[n])}}return a}return n}class Command{middlewareStack=constructStack();schema;static classBuilder(){return new ClassBuilder}resolveMiddlewareWithContext(t,n,i,{middlewareFn:a,clientName:A,commandName:l,inputFilterSensitiveLog:d,outputFilterSensitiveLog:h,smithyContext:f,additionalContext:g,CommandCtor:p}){for(const A of a.bind(this)(p,t,n,i)){this.middlewareStack.use(A)}const m=t.concat(this.middlewareStack);const{logger:E}=n;const C={logger:E,clientName:A,commandName:l,inputFilterSensitiveLog:d,outputFilterSensitiveLog:h,[c]:{commandInstance:this,...f},...g};const{requestHandler:I}=n;let y=i??{};if(f.eventStream){y={isEventStream:true,...y}}return m.resolve(t=>I.handle(t.request,y),C)}}class ClassBuilder{_init=()=>{};_ep={};_middlewareFn=()=>[];_commandName="";_clientName="";_additionalContext={};_smithyContext={};_inputFilterSensitiveLog=undefined;_outputFilterSensitiveLog=undefined;_serializer=null;_deserializer=null;_operationSchema;init(t){this._init=t}ep(t){this._ep=t;return this}m(t){this._middlewareFn=t;return this}s(t,n,i={}){this._smithyContext={service:t,operation:n,...i};return this}c(t={}){this._additionalContext=t;return this}n(t,n){this._clientName=t;this._commandName=n;return this}f(t=t=>t,n=t=>t){this._inputFilterSensitiveLog=t;this._outputFilterSensitiveLog=n;return this}ser(t){this._serializer=t;return this}de(t){this._deserializer=t;return this}sc(t){this._operationSchema=t;this._smithyContext.operationSchema=t;return this}build(){const t=this;let n;return n=class extends Command{input;static getEndpointParameterInstructions(){return t._ep}constructor(...[n]){super();this.input=n??{};t._init(this);this.schema=t._operationSchema}resolveMiddleware(i,a,A){const c=t._operationSchema;const l=c?.[4]??c?.input;const d=c?.[5]??c?.output;return this.resolveMiddlewareWithContext(i,a,A,{CommandCtor:n,middlewareFn:t._middlewareFn,clientName:t._clientName,commandName:t._commandName,inputFilterSensitiveLog:t._inputFilterSensitiveLog??(c?schemaLogFilter.bind(null,l):t=>t),outputFilterSensitiveLog:t._outputFilterSensitiveLog??(c?schemaLogFilter.bind(null,d):t=>t),smithyContext:t._smithyContext,additionalContext:t._additionalContext})}serialize=t._serializer;deserialize=t._deserializer}}}const E="***SensitiveInformation***";const createAggregatedClient=(t,n,i)=>{for(const[i,a]of Object.entries(t)){const methodImpl=async function(t,n,i){const A=new a(t);if(typeof n==="function"){this.send(A,n)}else if(typeof i==="function"){if(typeof n!=="object")throw new Error(`Expected http options but got ${typeof n}`);this.send(A,n||{},i)}else{return this.send(A,n)}};const t=(i[0].toLowerCase()+i.slice(1)).replace(/Command$/,"");n.prototype[t]=methodImpl}const{paginators:a={},waiters:A={}}=i??{};for(const[t,i]of Object.entries(a)){if(n.prototype[t]===void 0){n.prototype[t]=function(t={},n,...a){return i({...n,client:this},t,...a)}}}for(const[t,i]of Object.entries(A)){if(n.prototype[t]===void 0){n.prototype[t]=async function(t={},n,...a){let A=n;if(typeof n==="number"){A={maxWaitTime:n}}return i({...A,client:this},t,...a)}}}};class ServiceException extends Error{$fault;$response;$retryable;$metadata;constructor(t){super(t.message);Object.setPrototypeOf(this,Object.getPrototypeOf(this).constructor.prototype);this.name=t.name;this.$fault=t.$fault;this.$metadata=t.$metadata}static isInstance(t){if(!t)return false;const n=t;return ServiceException.prototype.isPrototypeOf(n)||Boolean(n.$fault)&&Boolean(n.$metadata)&&(n.$fault==="client"||n.$fault==="server")}static[Symbol.hasInstance](t){if(!t)return false;const n=t;if(this===ServiceException){return ServiceException.isInstance(t)}if(ServiceException.isInstance(t)){if(n.name&&this.name){return this.prototype.isPrototypeOf(t)||n.name===this.name}return this.prototype.isPrototypeOf(t)}return false}}const decorateServiceException=(t,n={})=>{Object.entries(n).filter(([,t])=>t!==undefined).forEach(([n,i])=>{if(t[n]==undefined||t[n]===""){t[n]=i}});const i=t.message||t.Message||"UnknownError";t.message=i;delete t.Message;return t};const throwDefaultError=({output:t,parsedBody:n,exceptionCtor:i,errorCode:a})=>{const A=deserializeMetadata(t);const c=A.httpStatusCode?A.httpStatusCode+"":undefined;const l=new i({name:n?.code||n?.Code||a||c||"UnknownError",$fault:"client",$metadata:A});throw decorateServiceException(l,n)};const withBaseException=t=>({output:n,parsedBody:i,errorCode:a})=>{throwDefaultError({output:n,parsedBody:i,exceptionCtor:t,errorCode:a})};const deserializeMetadata=t=>({httpStatusCode:t.statusCode,requestId:t.headers["x-amzn-requestid"]??t.headers["x-amzn-request-id"]??t.headers["x-amz-request-id"],extendedRequestId:t.headers["x-amz-id-2"],cfId:t.headers["x-amz-cf-id"]});const loadConfigsForDefaultMode=t=>{switch(t){case"standard":return{retryMode:"standard",connectionTimeout:3100};case"in-region":return{retryMode:"standard",connectionTimeout:1100};case"cross-region":return{retryMode:"standard",connectionTimeout:3100};case"mobile":return{retryMode:"standard",connectionTimeout:3e4};default:return{}}};let C=false;const emitWarningIfUnsupportedVersion=t=>{if(t&&!C&&parseInt(t.substring(1,t.indexOf(".")))<16){C=true}};const I=Object.values(l);const getChecksumConfiguration=t=>{const n=[];for(const i in l){const a=l[i];if(t[a]===undefined){continue}n.push({algorithmId:()=>a,checksumConstructor:()=>t[a]})}for(const[i,a]of Object.entries(t.checksumAlgorithms??{})){n.push({algorithmId:()=>i,checksumConstructor:()=>a})}return{addChecksumAlgorithm(i){t.checksumAlgorithms=t.checksumAlgorithms??{};const a=i.algorithmId();const A=i.checksumConstructor();if(I.includes(a)){t.checksumAlgorithms[a.toUpperCase()]=A}else{t.checksumAlgorithms[a]=A}n.push(i)},checksumAlgorithms(){return n}}};const resolveChecksumRuntimeConfig=t=>{const n={};t.checksumAlgorithms().forEach(t=>{const i=t.algorithmId();if(I.includes(i)){n[i]=t.checksumConstructor()}});return n};const getRetryConfiguration=t=>({setRetryStrategy(n){t.retryStrategy=n},retryStrategy(){return t.retryStrategy}});const resolveRetryRuntimeConfig=t=>{const n={};n.retryStrategy=t.retryStrategy();return n};const getDefaultExtensionConfiguration=t=>Object.assign(getChecksumConfiguration(t),getRetryConfiguration(t));const y=getDefaultExtensionConfiguration;const resolveDefaultRuntimeConfig=t=>Object.assign(resolveChecksumRuntimeConfig(t),resolveRetryRuntimeConfig(t));const getArrayIfSingleItem=t=>Array.isArray(t)?t:[t];const getValueFromTextNode=t=>{const n="#text";for(const i in t){if(Object.prototype.hasOwnProperty.call(t,i)&&t[i][n]!==undefined){t[i]=t[i][n]}else if(typeof t[i]==="object"&&t[i]!==null){t[i]=getValueFromTextNode(t[i])}}return t};const isSerializableHeaderValue=t=>t!=null;class NoOpLogger{trace(){}debug(){}info(){}warn(){}error(){}}function map(t,n,i){let a;let A;let c;if(typeof n==="undefined"&&typeof i==="undefined"){a={};c=t}else{a=t;if(typeof n==="function"){A=n;c=i;return mapWithFilter(a,A,c)}else{c=n}}for(const t of Object.keys(c)){if(!Array.isArray(c[t])){a[t]=c[t];continue}applyInstruction(a,null,c,t)}return a}const convertMap=t=>{const n={};for(const[i,a]of Object.entries(t||{})){n[i]=[,a]}return n};const take=(t,n)=>{const i={};for(const a in n){applyInstruction(i,t,n,a)}return i};const mapWithFilter=(t,n,i)=>map(t,Object.entries(i).reduce((t,[i,a])=>{if(Array.isArray(a)){t[i]=a}else{if(typeof a==="function"){t[i]=[n,a()]}else{t[i]=[n,a]}}return t},{}));const applyInstruction=(t,n,i,a)=>{if(n!==null){let A=i[a];if(typeof A==="function"){A=[,A]}const[c=nonNullish,l=pass,d=a]=A;if(typeof c==="function"&&c(n[d])||typeof c!=="function"&&!!c){t[a]=l(n[d])}return}let[A,c]=i[a];if(typeof c==="function"){let n;const i=A===undefined&&(n=c())!=null;const l=typeof A==="function"&&!!A(void 0)||typeof A!=="function"&&!!A;if(i){t[a]=n}else if(l){t[a]=c()}}else{const n=A===undefined&&c!=null;const i=typeof A==="function"&&!!A(c)||typeof A!=="function"&&!!A;if(n||i){t[a]=c}}};const nonNullish=t=>t!=null;const pass=t=>t;const serializeFloat=t=>{if(t!==t){return"NaN"}switch(t){case Infinity:return"Infinity";case-Infinity:return"-Infinity";default:return t}};const serializeDateTime=t=>t.toISOString().replace(".000Z","Z");const _json=t=>{if(t==null){return{}}if(Array.isArray(t)){return t.filter(t=>t!=null).map(_json)}if(typeof t==="object"){const n={};for(const i of Object.keys(t)){if(t[i]==null){continue}n[i]=_json(t[i])}return n}return t};n.Client=Client;n.Command=Command;n.NoOpLogger=NoOpLogger;n.SENSITIVE_STRING=E;n.ServiceException=ServiceException;n.WaiterState=p;n._json=_json;n.checkExceptions=checkExceptions;n.constructStack=constructStack;n.convertMap=convertMap;n.createAggregatedClient=createAggregatedClient;n.createWaiter=createWaiter;n.decorateServiceException=decorateServiceException;n.emitWarningIfUnsupportedVersion=emitWarningIfUnsupportedVersion;n.getArrayIfSingleItem=getArrayIfSingleItem;n.getChecksumConfiguration=getChecksumConfiguration;n.getDefaultClientConfiguration=y;n.getDefaultExtensionConfiguration=getDefaultExtensionConfiguration;n.getRetryConfiguration=getRetryConfiguration;n.getValueFromTextNode=getValueFromTextNode;n.invalidFunction=invalidFunction;n.invalidProvider=invalidProvider;n.isSerializableHeaderValue=isSerializableHeaderValue;n.loadConfigsForDefaultMode=loadConfigsForDefaultMode;n.map=map;n.resolveChecksumRuntimeConfig=resolveChecksumRuntimeConfig;n.resolveDefaultRuntimeConfig=resolveDefaultRuntimeConfig;n.resolveRetryRuntimeConfig=resolveRetryRuntimeConfig;n.schemaLogFilter=schemaLogFilter;n.serializeDateTime=serializeDateTime;n.serializeFloat=serializeFloat;n.take=take;n.throwDefaultError=throwDefaultError;n.waiterServiceDefaults=g;n.withBaseException=withBaseException},7291:(t,n,i)=>{const{homedir:a}=i(8161);const{sep:A,join:c}=i(6760);const{createHash:l}=i(7598);const{readFile:d}=i(1455);const{IniSectionType:h}=i(690);const{normalizeProvider:f}=i(2658);const{isValidHostLabel:g}=i(4534);class ProviderError extends Error{name="ProviderError";tryNextLink;constructor(t,n=true){let i;let a=true;if(typeof n==="boolean"){i=undefined;a=n}else if(n!=null&&typeof n==="object"){i=n.logger;a=n.tryNextLink??true}super(t);this.tryNextLink=a;Object.setPrototypeOf(this,ProviderError.prototype);i?.debug?.(`@smithy/property-provider ${a?"->":"(!)"} ${t}`)}static from(t,n=true){return Object.assign(new this(t.message,n),t)}}class CredentialsProviderError extends ProviderError{name="CredentialsProviderError";constructor(t,n=true){super(t,n);Object.setPrototypeOf(this,CredentialsProviderError.prototype)}}class TokenProviderError extends ProviderError{name="TokenProviderError";constructor(t,n=true){super(t,n);Object.setPrototypeOf(this,TokenProviderError.prototype)}}const chain=(...t)=>async()=>{if(t.length===0){throw new ProviderError("No providers in chain")}let n;for(const i of t){try{const t=await i();return t}catch(t){n=t;if(t?.tryNextLink){continue}throw t}}throw n};const fromValue=t=>()=>Promise.resolve(t);const memoize=(t,n,i)=>{let a;let A;let c;let l=false;const coalesceProvider=async()=>{if(!A){A=t()}try{a=await A;c=true;l=false}finally{A=undefined}return a};if(n===undefined){return async t=>{if(!c||t?.forceRefresh){a=await coalesceProvider()}return a}}return async t=>{if(!c||t?.forceRefresh){a=await coalesceProvider()}if(l){return a}if(i&&!i(a)){l=true;return a}if(n(a)){await coalesceProvider();return a}return a}};const booleanSelector=(t,n,i)=>{if(!(n in t))return undefined;if(t[n]==="true")return true;if(t[n]==="false")return false;throw new Error(`Cannot load ${i} "${n}". Expected "true" or "false", got ${t[n]}.`)};const numberSelector=(t,n,i)=>{if(!(n in t))return undefined;const a=parseInt(t[n],10);if(Number.isNaN(a)){throw new TypeError(`Cannot load ${i} '${n}'. Expected number, got '${t[n]}'.`)}return a};var p;(function(t){t["ENV"]="env";t["CONFIG"]="shared config entry"})(p||(p={}));const m={};const getHomeDirCacheKey=()=>{if(process&&process.geteuid){return`${process.geteuid()}`}return"DEFAULT"};const getHomeDir=()=>{const{HOME:t,USERPROFILE:n,HOMEPATH:i,HOMEDRIVE:c=`C:${A}`}=process.env;if(t)return t;if(n)return n;if(i)return`${c}${i}`;const l=getHomeDirCacheKey();if(!m[l])m[l]=a();return m[l]};const E="AWS_PROFILE";const C="default";const getProfileName=t=>t.profile||process.env[E]||C;const getSSOTokenFilepath=t=>{const n=l("sha1");const i=n.update(t).digest("hex");return c(getHomeDir(),".aws","sso","cache",`${i}.json`)};const I={};const getSSOTokenFromFile=async t=>{if(I[t]){return I[t]}const n=getSSOTokenFilepath(t);const i=await d(n,"utf8");return JSON.parse(i)};const y=".";const getConfigData=t=>Object.entries(t).filter(([t])=>{const n=t.indexOf(y);if(n===-1){return false}return Object.values(h).includes(t.substring(0,n))}).reduce((t,[n,i])=>{const a=n.indexOf(y);const A=n.substring(0,a)===h.PROFILE?n.substring(a+1):n;t[A]=i;return t},{...t.default&&{default:t.default}});const B="AWS_CONFIG_FILE";const getConfigFilepath=()=>process.env[B]||c(getHomeDir(),".aws","config");const Q="AWS_SHARED_CREDENTIALS_FILE";const getCredentialsFilepath=()=>process.env[Q]||c(getHomeDir(),".aws","credentials");const w=/^([\w-]+)\s(["'])?([\w-@\+\.%:/]+)\2$/;const S=["__proto__","profile __proto__"];const parseIni=t=>{const n={};let i;let a;for(const A of t.split(/\r?\n/)){const t=A.split(/(^|\s)[;#]/)[0].trim();const c=t[0]==="["&&t[t.length-1]==="]";if(c){i=undefined;a=undefined;const n=t.substring(1,t.length-1);const A=w.exec(n);if(A){const[,t,,n]=A;if(Object.values(h).includes(t)){i=[t,n].join(y)}}else{i=n}if(S.includes(n)){throw new Error(`Found invalid profile name "${n}"`)}}else if(i){const c=t.indexOf("=");if(![0,-1].includes(c)){const[l,d]=[t.substring(0,c).trim(),t.substring(c+1).trim()];if(d===""){a=l}else{if(a&&A.trimStart()===A){a=undefined}n[i]=n[i]||{};const t=a?[a,l].join(y):l;n[i][t]=d}}}}return n};const b={};const R={};const readFile=(t,n)=>{if(R[t]!==undefined){return R[t]}if(!b[t]||n?.ignoreCache){b[t]=d(t,"utf8")}return b[t]};const swallowError$1=()=>({});const loadSharedConfigFiles=async(t={})=>{const{filepath:n=getCredentialsFilepath(),configFilepath:i=getConfigFilepath()}=t;const a=getHomeDir();const A="~/";let l=n;if(n.startsWith(A)){l=c(a,n.slice(2))}let d=i;if(i.startsWith(A)){d=c(a,i.slice(2))}const h=await Promise.all([readFile(d,{ignoreCache:t.ignoreCache}).then(parseIni).then(getConfigData).catch(swallowError$1),readFile(l,{ignoreCache:t.ignoreCache}).then(parseIni).catch(swallowError$1)]);return{configFile:h[0],credentialsFile:h[1]}};const getSsoSessionData=t=>Object.entries(t).filter(([t])=>t.startsWith(h.SSO_SESSION+y)).reduce((t,[n,i])=>({...t,[n.substring(n.indexOf(y)+1)]:i}),{});const swallowError=()=>({});const loadSsoSessionData=async(t={})=>readFile(t.configFilepath??getConfigFilepath()).then(parseIni).then(getSsoSessionData).catch(swallowError);const mergeConfigFiles=(...t)=>{const n={};for(const i of t){for(const[t,a]of Object.entries(i)){if(n[t]!==undefined){Object.assign(n[t],a)}else{n[t]=a}}}return n};const parseKnownFiles=async t=>{const n=await loadSharedConfigFiles(t);return mergeConfigFiles(n.configFile,n.credentialsFile)};const v={getFileRecord(){return R},interceptFile(t,n){R[t]=Promise.resolve(n)},getTokenRecord(){return I},interceptToken(t,n){I[t]=n}};function getSelectorName(t){try{const n=new Set(Array.from(t.match(/([A-Z_]){3,}/g)??[]));n.delete("CONFIG");n.delete("CONFIG_PREFIX_SEPARATOR");n.delete("ENV");return[...n].join(", ")}catch(n){return t}}const fromEnv=(t,n)=>async()=>{try{const i=t(process.env,n);if(i===undefined){throw new Error}return i}catch(i){throw new CredentialsProviderError(i.message||`Not found in ENV: ${getSelectorName(t.toString())}`,{logger:n?.logger})}};const fromSharedConfigFiles=(t,{preferredFile:n="config",...i}={})=>async()=>{const a=getProfileName(i);const{configFile:A,credentialsFile:c}=await loadSharedConfigFiles(i);const l=c[a]||{};const d=A[a]||{};const h=n==="config"?{...l,...d}:{...d,...l};try{const i=n==="config"?A:c;const a=t(h,i);if(a===undefined){throw new Error}return a}catch(n){throw new CredentialsProviderError(n.message||`Not found in config files w/ profile [${a}]: ${getSelectorName(t.toString())}`,{logger:i.logger})}};const isFunction=t=>typeof t==="function";const fromStatic=t=>isFunction(t)?async()=>await t():fromValue(t);const loadConfig=({environmentVariableSelector:t,configFileSelector:n,default:i},a={})=>{const{signingName:A,logger:c}=a;const l={signingName:A,logger:c};return memoize(chain(fromEnv(t,l),fromSharedConfigFiles(n,a),fromStatic(i)))};const k="AWS_USE_DUALSTACK_ENDPOINT";const D="use_dualstack_endpoint";const T=false;const N={environmentVariableSelector:t=>booleanSelector(t,k,p.ENV),configFileSelector:t=>booleanSelector(t,D,p.CONFIG),default:false};const M={environmentVariableSelector:t=>booleanSelector(t,k,p.ENV),configFileSelector:t=>booleanSelector(t,D,p.CONFIG),default:undefined};const F="AWS_USE_FIPS_ENDPOINT";const x="use_fips_endpoint";const U=false;const P={environmentVariableSelector:t=>booleanSelector(t,F,p.ENV),configFileSelector:t=>booleanSelector(t,x,p.CONFIG),default:false};const L={environmentVariableSelector:t=>booleanSelector(t,F,p.ENV),configFileSelector:t=>booleanSelector(t,x,p.CONFIG),default:undefined};const resolveCustomEndpointsConfig=t=>{const{tls:n,endpoint:i,urlParser:a,useDualstackEndpoint:A}=t;return Object.assign(t,{tls:n??true,endpoint:f(typeof i==="string"?a(i):i),isCustomEndpoint:true,useDualstackEndpoint:f(A??false)})};const getEndpointFromRegion=async t=>{const{tls:n=true}=t;const i=await t.region();const a=new RegExp(/^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9])$/);if(!a.test(i)){throw new Error("Invalid region in client config")}const A=await t.useDualstackEndpoint();const c=await t.useFipsEndpoint();const{hostname:l}=await t.regionInfoProvider(i,{useDualstackEndpoint:A,useFipsEndpoint:c})??{};if(!l){throw new Error("Cannot resolve hostname from client config")}return t.urlParser(`${n?"https:":"http:"}//${l}`)};const resolveEndpointsConfig=t=>{const n=f(t.useDualstackEndpoint??false);const{endpoint:i,useFipsEndpoint:a,urlParser:A,tls:c}=t;return Object.assign(t,{tls:c??true,endpoint:i?f(typeof i==="string"?A(i):i):()=>getEndpointFromRegion({...t,useDualstackEndpoint:n,useFipsEndpoint:a}),isCustomEndpoint:!!i,useDualstackEndpoint:n})};const O="AWS_EXECUTION_ENV";const H="AWS_REGION";const $="AWS_DEFAULT_REGION";const G="AWS_EC2_METADATA_DISABLED";const V=["in-region","cross-region","mobile","standard","legacy"];const Y="/latest/meta-data/placement/region";const J="/latest/api/token";const W="x-aws-ec2-metadata-token";const q="x-aws-ec2-metadata-token-ttl-seconds";const j=1e3;const z=6e4;let K=0;const getInstanceMetadataRegion=async()=>{if(process.env[G]){return undefined}if(Date.now(){K=Date.now()+z;return undefined};const resolveImdsEndpoint=()=>{const t=process.env.AWS_EC2_METADATA_SERVICE_ENDPOINT;if(t){const n=new URL(t);return{hostname:n.hostname.replace(/^\[(.+)]$/,"$1"),port:n.port?Number(n.port):undefined}}if(process.env.AWS_EC2_METADATA_SERVICE_ENDPOINT_MODE==="IPv6"){return{hostname:"fd00:ec2::254"}}return{hostname:"169.254.169.254"}};const imdsRequest=async t=>{const{request:n}=i(7067);return new Promise((i,a)=>{const A=n({hostname:t.hostname,port:t.port,path:t.path,method:t.method,headers:t.headers,timeout:j,signal:AbortSignal.timeout(j)});A.on("error",t=>{a(t);A.destroy()});A.on("timeout",()=>{a(new Error("TimeoutError from instance metadata service"));A.destroy()});A.on("response",t=>{const{statusCode:n=400}=t;if(n<200||n>=300){a(Object.assign(new Error("Error response received from instance metadata service"),{statusCode:n}));A.destroy();return}const c=[];t.on("data",t=>c.push(t));t.on("end",()=>{i(Buffer.concat(c));A.destroy()})});A.end()})};const Z="AWS_REGION";const X="region";const ee={environmentVariableSelector:t=>t[Z],configFileSelector:t=>t[X],default:async()=>{const t=await getInstanceMetadataRegion();if(t){return t}throw new Error("Region is missing")}};const te={preferredFile:"credentials"};const re=new Set;const checkRegion=(t,n=g)=>{if(!re.has(t)&&!n(t)){if(t==="*"){console.warn(`@smithy/config-resolver WARN - Please use the caller region instead of "*". See "sigv4a" in https://github.com/aws/aws-sdk-js-v3/blob/main/supplemental-docs/CLIENTS.md.`)}else{throw new Error(`Region not accepted: region="${t}" is not a valid hostname component.`)}}else{re.add(t)}};const isFipsRegion=t=>typeof t==="string"&&(t.startsWith("fips-")||t.endsWith("-fips"));const getRealRegion=t=>isFipsRegion(t)?["fips-aws-global","aws-fips"].includes(t)?"us-east-1":t.replace(/fips-(dkr-|prod-)?|-fips/,""):t;const resolveRegionConfig=t=>{const{region:n,useFipsEndpoint:i}=t;if(!n){throw new Error("Region is missing")}return Object.assign(t,{region:async()=>{const t=typeof n==="function"?await n():n;const i=getRealRegion(t);checkRegion(i);return i},useFipsEndpoint:async()=>{const t=typeof n==="string"?n:await n();if(isFipsRegion(t)){return true}return typeof i!=="function"?Promise.resolve(!!i):i()}})};const getHostnameFromVariants=(t=[],{useFipsEndpoint:n,useDualstackEndpoint:i})=>t.find(({tags:t})=>n===t.includes("fips")&&i===t.includes("dualstack"))?.hostname;const getResolvedHostname=(t,{regionHostname:n,partitionHostname:i})=>n?n:i?i.replace("{region}",t):undefined;const getResolvedPartition=(t,{partitionHash:n})=>Object.keys(n||{}).find(i=>n[i].regions.includes(t))??"aws";const getResolvedSigningRegion=(t,{signingRegion:n,regionRegex:i,useFipsEndpoint:a})=>{if(n){return n}else if(a){const n=i.replace("\\\\","\\").replace(/^\^/g,"\\.").replace(/\$$/g,"\\.");const a=t.match(n);if(a){return a[0].slice(1,-1)}}};const getRegionInfo=(t,{useFipsEndpoint:n=false,useDualstackEndpoint:i=false,signingService:a,regionHash:A,partitionHash:c})=>{const l=getResolvedPartition(t,{partitionHash:c});const d=t in A?t:c[l]?.endpoint??t;const h={useFipsEndpoint:n,useDualstackEndpoint:i};const f=getHostnameFromVariants(A[d]?.variants,h);const g=getHostnameFromVariants(c[l]?.variants,h);const p=getResolvedHostname(d,{regionHostname:f,partitionHostname:g});if(p===undefined){throw new Error(`Endpoint resolution failed for: ${{resolvedRegion:d,useFipsEndpoint:n,useDualstackEndpoint:i}}`)}const m=getResolvedSigningRegion(p,{signingRegion:A[d]?.signingRegion,regionRegex:c[l].regionRegex,useFipsEndpoint:n});return{partition:l,signingService:a,hostname:p,...m&&{signingRegion:m},...A[d]?.signingService&&{signingService:A[d].signingService}}};const ne="AWS_DEFAULTS_MODE";const se="defaults_mode";const oe={environmentVariableSelector:t=>t[ne],configFileSelector:t=>t[se],default:"legacy"};const resolveDefaultsModeConfig=({region:t=loadConfig(ee),defaultsMode:n=loadConfig(oe)}={})=>memoize(async()=>{const i=typeof n==="function"?await n():n;switch(i?.toLowerCase()){case"auto":return resolveNodeDefaultsModeAuto(t);case"in-region":case"cross-region":case"mobile":case"standard":case"legacy":return Promise.resolve(i?.toLocaleLowerCase());case undefined:return Promise.resolve("legacy");default:throw new Error(`Invalid parameter for "defaultsMode", expect ${V.join(", ")}, got ${i}`)}});const resolveNodeDefaultsModeAuto=async t=>{if(t){const n=typeof t==="function"?await t():t;const i=await inferPhysicalRegion();if(!i){return"standard"}if(n===i){return"in-region"}else{return"cross-region"}}return"standard"};const inferPhysicalRegion=async()=>{if(process.env[O]&&(process.env[H]||process.env[$])){return process.env[H]??process.env[$]}return getInstanceMetadataRegion()};n.CONFIG_PREFIX_SEPARATOR=y;n.CONFIG_USE_DUALSTACK_ENDPOINT=D;n.CONFIG_USE_FIPS_ENDPOINT=x;n.CredentialsProviderError=CredentialsProviderError;n.DEFAULT_PROFILE=C;n.DEFAULT_USE_DUALSTACK_ENDPOINT=T;n.DEFAULT_USE_FIPS_ENDPOINT=U;n.ENV_PROFILE=E;n.ENV_USE_DUALSTACK_ENDPOINT=k;n.ENV_USE_FIPS_ENDPOINT=F;n.NODE_REGION_CONFIG_FILE_OPTIONS=te;n.NODE_REGION_CONFIG_OPTIONS=ee;n.NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS=N;n.NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS=P;n.ProviderError=ProviderError;n.REGION_ENV_NAME=Z;n.REGION_INI_NAME=X;n.SelectorType=p;n.TokenProviderError=TokenProviderError;n.booleanSelector=booleanSelector;n.chain=chain;n.externalDataInterceptor=v;n.fromStatic=fromStatic;n.fromValue=fromValue;n.getHomeDir=getHomeDir;n.getProfileName=getProfileName;n.getRegionInfo=getRegionInfo;n.getSSOTokenFilepath=getSSOTokenFilepath;n.getSSOTokenFromFile=getSSOTokenFromFile;n.loadConfig=loadConfig;n.loadSharedConfigFiles=loadSharedConfigFiles;n.loadSsoSessionData=loadSsoSessionData;n.memoize=memoize;n.nodeDualstackConfigSelectors=M;n.nodeFipsConfigSelectors=L;n.numberSelector=numberSelector;n.parseKnownFiles=parseKnownFiles;n.readFile=readFile;n.resolveCustomEndpointsConfig=resolveCustomEndpointsConfig;n.resolveDefaultsModeConfig=resolveDefaultsModeConfig;n.resolveEndpointsConfig=resolveEndpointsConfig;n.resolveRegionConfig=resolveRegionConfig},2085:(t,n,i)=>{const{CONFIG_PREFIX_SEPARATOR:a,loadConfig:A}=i(7291);const{toEndpointV1:c,getSmithyContext:l,normalizeProvider:d,isValidHostLabel:h}=i(4534);n.isValidHostLabel=h;n.middlewareEndpointToEndpointV1=c;n.toEndpointV1=c;const{EndpointURLScheme:f}=i(690);const g="AWS_ENDPOINT_URL";const p="endpoint_url";const getEndpointUrlConfig=t=>({environmentVariableSelector:n=>{const i=t.split(" ").map(t=>t.toUpperCase());const a=n[[g,...i].join("_")];if(a)return a;const A=n[g];if(A)return A;return undefined},configFileSelector:(n,i)=>{if(i&&n.services){const A=i[["services",n.services].join(a)];if(A){const n=t.split(" ").map(t=>t.toLowerCase());const i=A[[n.join("_"),p].join(a)];if(i)return i}}const A=n[p];if(A)return A;return undefined},default:undefined});const getEndpointFromConfig=async t=>A(getEndpointUrlConfig(t??""))();const resolveParamsForS3=async t=>{const n=t?.Bucket||"";if(typeof t.Bucket==="string"){t.Bucket=n.replace(/#/g,encodeURIComponent("#")).replace(/\?/g,encodeURIComponent("?"))}if(isArnBucketName(n)){if(t.ForcePathStyle===true){throw new Error("Path-style addressing cannot be used with ARN buckets")}}else if(!isDnsCompatibleBucketName(n)||n.indexOf(".")!==-1&&!String(t.Endpoint).startsWith("http:")||n.toLowerCase()!==n||n.length<3){t.ForcePathStyle=true}if(t.DisableMultiRegionAccessPoints){t.disableMultiRegionAccessPoints=true;t.DisableMRAP=true}return t};const m=/^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/;const E=/(\d+\.){3}\d+/;const C=/\.\./;const isDnsCompatibleBucketName=t=>m.test(t)&&!E.test(t)&&!C.test(t);const isArnBucketName=t=>{const[n,i,a,,,A]=t.split(":");const c=n==="arn"&&t.split(":").length>=6;const l=Boolean(c&&i&&a&&A);if(c&&!l){throw new Error(`Invalid ARN: ${t} was an invalid ARN.`)}return l};const createConfigValueProvider=(t,n,i,a=false)=>{const configProvider=async()=>{let A;if(a){const a=i.clientContextParams;const c=a?.[t];A=c??i[t]??i[n]}else{A=i[t]??i[n]}if(typeof A==="function"){return A()}return A};if(t==="credentialScope"||n==="CredentialScope"){return async()=>{const t=typeof i.credentials==="function"?await i.credentials():i.credentials;const n=t?.credentialScope??t?.CredentialScope;return n}}if(t==="accountId"||n==="AccountId"){return async()=>{const t=typeof i.credentials==="function"?await i.credentials():i.credentials;const n=t?.accountId??t?.AccountId;return n}}if(t==="endpoint"||n==="endpoint"){return async()=>{if(i.isCustomEndpoint===false){return undefined}const t=await configProvider();if(t&&typeof t==="object"){if("url"in t){return t.url.href}if("hostname"in t){const{protocol:n,hostname:i,port:a,path:A}=t;return`${n}//${i}${a?":"+a:""}${A}`}}return t}}return configProvider};function bindGetEndpointFromInstructions(t){return async(n,i,a,A)=>{if(!a.isCustomEndpoint){let n;if(a.serviceConfiguredEndpoint){n=await a.serviceConfiguredEndpoint()}else{n=await t(a.serviceId)}if(n){a.endpoint=()=>Promise.resolve(c(n));a.isCustomEndpoint=true}}const l=await resolveParams(n,i,a);if(typeof a.endpointProvider!=="function"){throw new Error("config.endpointProvider is not set.")}const d=a.endpointProvider(l,A);if(a.isCustomEndpoint&&a.endpoint){const t=await a.endpoint();if(t?.headers){d.headers??={};for(const[n,i]of Object.entries(t.headers)){d.headers[n]=Array.isArray(i)?i:[i]}}}return d}}const resolveParams=async(t,n,i)=>{const a={};const A=n?.getEndpointParameterInstructions?.()||{};for(const[n,c]of Object.entries(A)){switch(c.type){case"staticContextParams":a[n]=c.value;break;case"contextParams":a[n]=t[c.name];break;case"clientContextParams":case"builtInParams":a[n]=await createConfigValueProvider(c.name,n,i,c.type!=="builtInParams")();break;case"operationContextParams":a[n]=c.get(t);break;default:throw new Error("Unrecognized endpoint parameter instruction: "+JSON.stringify(c))}}if(Object.keys(A).length===0){Object.assign(a,i)}if(String(i.serviceId).toLowerCase()==="s3"){await resolveParamsForS3(a)}return a};function setFeature(t,n,i){if(!t.__smithy_context){t.__smithy_context={features:{}}}else if(!t.__smithy_context.features){t.__smithy_context.features={}}t.__smithy_context.features[n]=i}function bindEndpointMiddleware(t){const n=bindGetEndpointFromInstructions(t);return({config:t,instructions:i})=>(a,A)=>async c=>{if(t.isCustomEndpoint){setFeature(A,"ENDPOINT_OVERRIDE","N")}const d=await n(c.input,{getEndpointParameterInstructions(){return i}},{...t},A);A.endpointV2=d;A.authSchemes=d.properties?.authSchemes;const h=A.authSchemes?.[0];if(h){A["signing_region"]=h.signingRegion;A["signing_service"]=h.signingName;const t=l(A);const n=t?.selectedHttpAuthScheme?.httpAuthOption;if(n){n.signingProperties=Object.assign(n.signingProperties||{},{signing_region:h.signingRegion,signingRegion:h.signingRegion,signing_service:h.signingName,signingName:h.signingName,signingRegionSet:h.signingRegionSet},h.properties)}}return a({...c})}}const I={name:"serializerMiddleware"};const y={step:"serialize",tags:["ENDPOINT_PARAMETERS","ENDPOINT_V2","ENDPOINT"],name:"endpointV2Middleware",override:true,relation:"before",toMiddleware:I.name};function bindGetEndpointPlugin(t){const n=bindEndpointMiddleware(t);return(t,i)=>({applyToStack:a=>{a.addRelativeTo(n({config:t,instructions:i}),y)}})}function bindResolveEndpointConfig(t){return n=>{const i=n.tls??true;const{endpoint:a,useDualstackEndpoint:A,useFipsEndpoint:l}=n;const h=a!=null?async()=>c(await d(a)()):undefined;const f=!!a;const g=Object.assign(n,{endpoint:h,tls:i,isCustomEndpoint:f,useDualstackEndpoint:d(A??false),useFipsEndpoint:d(l??false)});let p=undefined;g.serviceConfiguredEndpoint=async()=>{if(n.serviceId&&!p){p=t(n.serviceId)}return p};return g}}class BinaryDecisionDiagram{nodes;root;conditions;results;constructor(t,n,i,a){this.nodes=t;this.root=n;this.conditions=i;this.results=a}static from(t,n,i,a){return new BinaryDecisionDiagram(t,n,i,a)}}class EndpointCache{capacity;data=new Map;parameters=[];constructor({size:t,params:n}){this.capacity=t??50;if(n){this.parameters=n}}get(t,n){const i=this.hash(t);if(i===false){return n()}if(!this.data.has(i)){if(this.data.size>this.capacity+10){const t=this.data.keys();let n=0;while(true){const{value:i,done:a}=t.next();this.data.delete(i);if(a||++n>10){break}}}this.data.set(i,n())}return this.data.get(i)}size(){return this.data.size}hash(t){let n="";const{parameters:i}=this;if(i.length===0){return false}for(const a of i){const i=String(t[a]??"");if(i.includes("|;")){return false}n+=i+"|;"}return n}}class EndpointError extends Error{constructor(t){super(t);this.name="EndpointError"}}const B="endpoints";function toDebugString(t){if(typeof t!=="object"||t==null){return t}if("ref"in t){return`$${toDebugString(t.ref)}`}if("fn"in t){return`${t.fn}(${(t.argv||[]).map(toDebugString).join(", ")})`}return JSON.stringify(t,null,2)}const Q={};const booleanEquals=(t,n)=>t===n;function coalesce(...t){for(const n of t){if(n!=null){return n}}return undefined}const getAttrPathList=t=>{const n=t.split(".");const i=[];for(const a of n){const n=a.indexOf("[");if(n!==-1){if(a.indexOf("]")!==a.length-1){throw new EndpointError(`Path: '${t}' does not end with ']'`)}const A=a.slice(n+1,-1);if(Number.isNaN(parseInt(A))){throw new EndpointError(`Invalid array index: '${A}' in path: '${t}'`)}if(n!==0){i.push(a.slice(0,n))}i.push(A)}else{i.push(a)}}return i};const getAttr=(t,n)=>getAttrPathList(n).reduce((i,a)=>{if(typeof i!=="object"){throw new EndpointError(`Index '${a}' in '${n}' not found in '${JSON.stringify(t)}'`)}else if(Array.isArray(i)){const t=parseInt(a);return i[t<0?i.length+t:t]}return i[a]},t);const isSet=t=>t!=null;function ite(t,n,i){return t?n:i}const not=t=>!t;const w=new RegExp(`^(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}$`);const isIpAddress=t=>w.test(t)||t.startsWith("[")&&t.endsWith("]");const S={[f.HTTP]:80,[f.HTTPS]:443};const parseURL=t=>{const n=(()=>{try{if(t instanceof URL){return t}if(typeof t==="object"&&"hostname"in t){const{hostname:n,port:i,protocol:a="",path:A="",query:c={}}=t;const l=new URL(`${a}//${n}${i?`:${i}`:""}${A}`);l.search=Object.entries(c).map(([t,n])=>`${t}=${n}`).join("&");return l}return new URL(t)}catch(t){return null}})();if(!n){console.error(`Unable to parse ${JSON.stringify(t)} as a whatwg URL.`);return null}const i=n.href;const{host:a,hostname:A,pathname:c,protocol:l,search:d}=n;if(d){return null}const h=l.slice(0,-1);if(!Object.values(f).includes(h)){return null}const g=isIpAddress(A);const p=i.includes(`${a}:${S[h]}`)||typeof t==="string"&&t.includes(`${a}:${S[h]}`);const m=`${a}${p?`:${S[h]}`:``}`;return{scheme:h,authority:m,path:c,normalizedPath:c.endsWith("/")?c:`${c}/`,isIp:g}};function split(t,n,i){if(i===1){return[t]}if(t===""){return[""]}const a=t.split(n);if(i===0){return a}return a.slice(0,i-1).concat(a.slice(1).join(n))}const stringEquals=(t,n)=>t===n;const substring=(t,n,i,a)=>{if(t==null||n>=i||t.lengthencodeURIComponent(t).replace(/[!*'()]/g,t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`);const b={booleanEquals:booleanEquals,coalesce:coalesce,getAttr:getAttr,isSet:isSet,isValidHostLabel:h,ite:ite,not:not,parseURL:parseURL,split:split,stringEquals:stringEquals,substring:substring,uriEncode:uriEncode};const evaluateTemplate=(t,n)=>{const i=[];const{referenceRecord:a,endpointParams:A}=n;let c=0;while(cn.referenceRecord[t]??n.endpointParams[t];const evaluateExpression=(t,n,i)=>{if(typeof t==="string"){return evaluateTemplate(t,i)}else if(t["fn"]){return R.callFunction(t,i)}else if(t["ref"]){return getReferenceValue(t,i)}throw new EndpointError(`'${n}': ${String(t)} is not a string, function or reference.`)};const callFunction=({fn:t,argv:n},i)=>{const a=Array(n.length);for(let t=0;t{const{assign:i}=t;if(i&&i in n.referenceRecord){throw new EndpointError(`'${i}' is already defined in Reference Record.`)}const a=callFunction(t,n);n.logger?.debug?.(`${B} evaluateCondition: ${toDebugString(t)} = ${toDebugString(a)}`);const A=a===""?true:!!a;if(i!=null){return{result:A,toAssign:{name:i,value:a}}}return{result:A}};const getEndpointHeaders=(t,n)=>Object.entries(t??{}).reduce((t,[i,a])=>{t[i]=a.map(t=>{const a=evaluateExpression(t,"Header value entry",n);if(typeof a!=="string"){throw new EndpointError(`Header '${i}' value '${a}' is not a string`)}return a});return t},{});const getEndpointProperties=(t,n)=>Object.entries(t).reduce((t,[i,a])=>{t[i]=v.getEndpointProperty(a,n);return t},{});const getEndpointProperty=(t,n)=>{if(Array.isArray(t)){return t.map(t=>getEndpointProperty(t,n))}switch(typeof t){case"string":return evaluateTemplate(t,n);case"object":if(t===null){throw new EndpointError(`Unexpected endpoint property: ${t}`)}return v.getEndpointProperties(t,n);case"boolean":return t;default:throw new EndpointError(`Unexpected endpoint property type: ${typeof t}`)}};const v={getEndpointProperty:getEndpointProperty,getEndpointProperties:getEndpointProperties};const getEndpointUrl=(t,n)=>{const i=evaluateExpression(t,"Endpoint URL",n);if(typeof i==="string"){try{return new URL(i)}catch(t){console.error(`Failed to construct URL with ${i}`,t);throw t}}throw new EndpointError(`Endpoint URL must be a string, got ${typeof i}`)};const k=1e8;const decideEndpoint=(t,n)=>{const{nodes:i,root:a,results:A,conditions:c}=t;let l=a;const d={};const h={referenceRecord:d,endpointParams:n.endpointParams,logger:n.logger};while(l!==1&&l!==-1&&l=0===m.result?a:A}if(l>=k){const t=A[l-k];if(t[0]===-1){const[,n]=t;throw new EndpointError(evaluateExpression(n,"Error",h))}const[n,i,a]=t;return{url:getEndpointUrl(n,h),properties:getEndpointProperties(i,h),headers:getEndpointHeaders(a??{},h)}}throw new EndpointError(`No matching endpoint.`)};const evaluateConditions=(t=[],n)=>{const i={};const a={...n,referenceRecord:{...n.referenceRecord}};let A=false;for(const c of t){const{result:t,toAssign:l}=evaluateCondition(c,a);if(!t){return{result:t}}if(l){A=true;i[l.name]=l.value;a.referenceRecord[l.name]=l.value;n.logger?.debug?.(`${B} assign: ${l.name} := ${toDebugString(l.value)}`)}}if(A){return{result:true,referenceRecord:i}}return{result:true}};const evaluateEndpointRule=(t,n)=>{const{conditions:i,endpoint:a}=t;const{result:A,referenceRecord:c}=evaluateConditions(i,n);if(!A){return}const l=c?{...n,referenceRecord:{...n.referenceRecord,...c}}:n;const{url:d,properties:h,headers:f}=a;n.logger?.debug?.(`${B} Resolving endpoint from template: ${toDebugString(a)}`);const g={url:getEndpointUrl(d,l)};if(f!=null){g.headers=getEndpointHeaders(f,l)}if(h!=null){g.properties=getEndpointProperties(h,l)}return g};const evaluateErrorRule=(t,n)=>{const{conditions:i,error:a}=t;const{result:A,referenceRecord:c}=evaluateConditions(i,n);if(!A){return}const l=c?{...n,referenceRecord:{...n.referenceRecord,...c}}:n;throw new EndpointError(evaluateExpression(a,"Error",l))};const evaluateRules=(t,n)=>{for(const i of t){if(i.type==="endpoint"){const t=evaluateEndpointRule(i,n);if(t){return t}}else if(i.type==="error"){evaluateErrorRule(i,n)}else if(i.type==="tree"){const t=D.evaluateTreeRule(i,n);if(t){return t}}else{throw new EndpointError(`Unknown endpoint rule: ${i}`)}}throw new EndpointError(`Rules evaluation failed`)};const evaluateTreeRule=(t,n)=>{const{conditions:i,rules:a}=t;const{result:A,referenceRecord:c}=evaluateConditions(i,n);if(!A){return}const l=c?{...n,referenceRecord:{...n.referenceRecord,...c}}:n;return D.evaluateRules(a,l)};const D={evaluateRules:evaluateRules,evaluateTreeRule:evaluateTreeRule};const resolveEndpoint=(t,n)=>{const{endpointParams:i,logger:a}=n;const{parameters:A,rules:c}=t;n.logger?.debug?.(`${B} Initial EndpointParams: ${toDebugString(i)}`);for(const t in A){const n=A[t];const a=i[t];if(a==null&&n.default!=null){i[t]=n.default;continue}if(n.required&&a==null){throw new EndpointError(`Missing required parameter: '${t}'`)}}const l=evaluateRules(c,{endpointParams:i,logger:a,referenceRecord:{}});n.logger?.debug?.(`${B} Resolved endpoint: ${toDebugString(l)}`);return l};const resolveEndpointRequiredConfig=t=>{const{endpoint:n}=t;if(n===undefined){t.endpoint=async()=>{throw new Error("@smithy/middleware-endpoint: (default endpointRuleSet) endpoint is not set - you must configure an endpoint.")}}return t};const T=bindGetEndpointFromInstructions(getEndpointFromConfig);const N=bindResolveEndpointConfig(getEndpointFromConfig);const M=bindEndpointMiddleware(getEndpointFromConfig);const F=bindGetEndpointPlugin(getEndpointFromConfig);n.BinaryDecisionDiagram=BinaryDecisionDiagram;n.EndpointCache=EndpointCache;n.EndpointError=EndpointError;n.customEndpointFunctions=Q;n.decideEndpoint=decideEndpoint;n.endpointMiddleware=M;n.endpointMiddlewareOptions=y;n.getEndpointFromInstructions=T;n.getEndpointPlugin=F;n.isIpAddress=isIpAddress;n.resolveEndpoint=resolveEndpoint;n.resolveEndpointConfig=N;n.resolveEndpointRequiredConfig=resolveEndpointRequiredConfig;n.resolveParams=resolveParams},6579:(t,n,i)=>{const{Crc32:a}=i(9542);const{toHex:A,fromHex:c,toUtf8:l,fromUtf8:d}=i(2430);const{Readable:h}=i(7075);class Int64{bytes;constructor(t){this.bytes=t;if(t.byteLength!==8){throw new Error("Int64 buffers must be exactly 8 bytes")}}static fromNumber(t){if(t>0x8000000000000000||t<-0x8000000000000000){throw new Error(`${t} is too large (or, if negative, too small) to represent as an Int64`)}const n=new Uint8Array(8);for(let i=7,a=Math.abs(Math.round(t));i>-1&&a>0;i--,a/=256){n[i]=a}if(t<0){negate(n)}return new Int64(n)}valueOf(){const t=this.bytes.slice(0);const n=t[0]&128;if(n){negate(t)}return parseInt(A(t),16)*(n?-1:1)}toString(){return String(this.valueOf())}}function negate(t){for(let n=0;n<8;n++){t[n]^=255}for(let n=7;n>-1;n--){t[n]++;if(t[n]!==0)break}}class HeaderMarshaller{toUtf8;fromUtf8;constructor(t,n){this.toUtf8=t;this.fromUtf8=n}format(t){const n=[];for(const i of Object.keys(t)){const a=this.fromUtf8(i);n.push(Uint8Array.from([a.byteLength]),a,this.formatHeaderValue(t[i]))}const i=new Uint8Array(n.reduce((t,n)=>t+n.byteLength,0));let a=0;for(const t of n){i.set(t,a);a+=t.byteLength}return i}formatHeaderValue(t){switch(t.type){case"boolean":return Uint8Array.from([t.value?0:1]);case"byte":return Uint8Array.from([2,t.value]);case"short":const n=new DataView(new ArrayBuffer(3));n.setUint8(0,3);n.setInt16(1,t.value,false);return new Uint8Array(n.buffer);case"integer":const i=new DataView(new ArrayBuffer(5));i.setUint8(0,4);i.setInt32(1,t.value,false);return new Uint8Array(i.buffer);case"long":const a=new Uint8Array(9);a[0]=5;a.set(t.value.bytes,1);return a;case"binary":const A=new DataView(new ArrayBuffer(3+t.value.byteLength));A.setUint8(0,6);A.setUint16(1,t.value.byteLength,false);const l=new Uint8Array(A.buffer);l.set(t.value,3);return l;case"string":const d=this.fromUtf8(t.value);const h=new DataView(new ArrayBuffer(3+d.byteLength));h.setUint8(0,7);h.setUint16(1,d.byteLength,false);const f=new Uint8Array(h.buffer);f.set(d,3);return f;case"timestamp":const g=new Uint8Array(9);g[0]=8;g.set(Int64.fromNumber(t.value.valueOf()).bytes,1);return g;case"uuid":if(!w.test(t.value)){throw new Error(`Invalid UUID received: ${t.value}`)}const p=new Uint8Array(17);p[0]=9;p.set(c(t.value.replace(/\-/g,"")),1);return p}}parse(t){const n={};let i=0;while(i{if(typeof t!=="number"){throw new Error("Attempted to allocate an event message where size was not a number: "+t)}n=t;i=4;a=new Uint8Array(t);const A=new DataView(a.buffer);A.setUint32(0,t,false)};const iterator=async function*(){const c=t[Symbol.asyncIterator]();while(true){const{value:t,done:l}=await c.next();if(l){if(!n){return}else if(n===i){yield a}else{throw new Error("Truncated event message received.")}return}const d=t.length;let h=0;while(hnew k(t);class EventStreamMarshaller{universalMarshaller;constructor({utf8Encoder:t,utf8Decoder:n}){this.universalMarshaller=new k({utf8Decoder:n,utf8Encoder:t})}deserialize(t,n){const i=typeof t[Symbol.asyncIterator]==="function"?t:readableToIterable(t);return this.universalMarshaller.deserialize(i,n)}serialize(t,n){return h.from(this.universalMarshaller.serialize(t,n))}}const eventStreamSerdeProvider=t=>new EventStreamMarshaller(t);async function*readableToIterable(t){let n=false;let i=false;const a=new Array;t.on("error",t=>{if(!n){n=true}if(t){throw t}});t.on("data",t=>{a.push(t)});t.on("end",()=>{n=true});while(!i){const t=await new Promise(t=>setTimeout(()=>t(a.shift()),0));if(t){yield t}i=n&&a.length===0}}const readableStreamToIterable=t=>({[Symbol.asyncIterator]:async function*(){const n=t.getReader();try{while(true){const{done:t,value:i}=await n.read();if(t)return;yield i}}finally{n.releaseLock()}}});const iterableToReadableStream=t=>{const n=t[Symbol.asyncIterator]();return new ReadableStream({async pull(t){const{done:i,value:a}=await n.next();if(i){return t.close()}t.enqueue(a)}})};const resolveEventStreamSerdeConfig=t=>Object.assign(t,{eventStreamMarshaller:t.eventStreamSerdeProvider(t)});class EventStreamSerde{marshaller;serializer;deserializer;serdeContext;defaultContentType;constructor({marshaller:t,serializer:n,deserializer:i,serdeContext:a,defaultContentType:A}){this.marshaller=t;this.serializer=n;this.deserializer=i;this.serdeContext=a;this.defaultContentType=A}async serializeEventStream({eventStream:t,requestSchema:n,initialRequest:i}){const a=this.marshaller;const A=n.getEventStreamMember();const c=n.getMemberSchema(A);const l=this.serializer;const d=this.defaultContentType;const h=Symbol("initialRequestMarker");const f={async*[Symbol.asyncIterator](){if(i){const t={":event-type":{type:"string",value:"initial-request"},":message-type":{type:"string",value:"event"},":content-type":{type:"string",value:d}};l.write(n,i);const a=l.flush();yield{[h]:true,headers:t,body:a}}for await(const n of t){yield n}}};return a.serialize(f,t=>{if(t[h]){return{headers:t.headers,body:t.body}}let n="";for(const i in t){if(i!=="__type"){n=i;break}}const{additionalHeaders:i,body:a,eventType:A,explicitPayloadContentType:l}=this.writeEventBody(n,c,t);const f={":event-type":{type:"string",value:A},":message-type":{type:"string",value:"event"},":content-type":{type:"string",value:l??d},...i};return{headers:f,body:a}})}async deserializeEventStream({response:t,responseSchema:n,initialResponseContainer:i}){const a=this.marshaller;const A=n.getEventStreamMember();const c=n.getMemberSchema(A);const d=c.getMemberSchemas();const h=Symbol("initialResponseMarker");const f=a.deserialize(t.body,async t=>{let i="";for(const n in t){if(n!=="__type"){i=n;break}}const a=t[i].body;if(i==="initial-response"){const t=await this.deserializer.read(n,a);delete t[A];return{[h]:true,...t}}else if(i in d){const n=d[i];if(n.isStructSchema()){const A={};let c=false;for(const[d,h]of n.structIterator()){const{eventHeader:n,eventPayload:f}=h.getMergedTraits();c=c||Boolean(n||f);if(f){if(h.isBlobSchema()){A[d]=a}else if(h.isStringSchema()){A[d]=(this.serdeContext?.utf8Encoder??l)(a)}else if(h.isStructSchema()){A[d]=await this.deserializer.read(h,a)}}else if(n){const n=t[i].headers[d]?.value;if(n!=null){if(h.isNumericSchema()){if(n&&typeof n==="object"&&"bytes"in n){A[d]=BigInt(n.toString())}else{A[d]=Number(n)}}else{A[d]=n}}}}if(c){return{[i]:A}}if(a.byteLength===0){return{[i]:{}}}}return{[i]:await this.deserializer.read(n,a)}}else{return{$unknown:t}}});const g=f[Symbol.asyncIterator]();const p=await g.next();if(p.done){return f}if(p.value?.[h]){if(!n){throw new Error("@smithy::core/protocols - initial-response event encountered in event stream but no response schema given.")}for(const t in p.value){i[t]=p.value[t]}}return{async*[Symbol.asyncIterator](){if(!p?.value?.[h]){yield p.value}while(true){const{done:t,value:n}=await g.next();if(t){break}yield n}}}}writeEventBody(t,n,i){const a=this.serializer;let A=t;let c=null;let l;const h=(()=>{const i=n.getSchema();return i[4].includes(t)})();const f={};if(!h){const[n,c]=i[t];A=n;a.write(15,c)}else{const A=n.getMemberSchema(t);if(A.isStructSchema()){for(const[n,a]of A.structIterator()){const{eventHeader:A,eventPayload:l}=a.getMergedTraits();if(l){c=n}else if(A){const A=i[t][n];let c="binary";if(a.isNumericSchema()){if((-2)**31<=A&&A<=2**31-1){c="integer"}else{c="long"}}else if(a.isTimestampSchema()){c="timestamp"}else if(a.isStringSchema()){c="string"}else if(a.isBooleanSchema()){c="boolean"}if(A!=null){f[n]={type:c,value:A};delete i[t][n]}}}if(c!==null){const n=A.getMemberSchema(c);if(n.isBlobSchema()){l="application/octet-stream"}else if(n.isStringSchema()){l="text/plain"}a.write(n,i[t][c])}else{a.write(A,i[t])}}else if(A.isUnitSchema()){a.write(A,{})}else{throw new Error("@smithy/core/event-streams - non-struct member not supported in event stream union.")}}const g=a.flush()??new Uint8Array;const p=typeof g==="string"?(this.serdeContext?.utf8Decoder??d)(g):g;return{body:p,eventType:A,explicitPayloadContentType:l,additionalHeaders:f}}}n.EventStreamCodec=EventStreamCodec;n.EventStreamMarshaller=EventStreamMarshaller;n.EventStreamSerde=EventStreamSerde;n.HeaderMarshaller=HeaderMarshaller;n.Int64=Int64;n.MessageDecoderStream=MessageDecoderStream;n.MessageEncoderStream=MessageEncoderStream;n.SmithyMessageDecoderStream=SmithyMessageDecoderStream;n.SmithyMessageEncoderStream=SmithyMessageEncoderStream;n.UniversalEventStreamMarshaller=k;n.eventStreamSerdeProvider=eventStreamSerdeProvider;n.getChunkedStream=getChunkedStream;n.getMessageUnmarshaller=getMessageUnmarshaller;n.getUnmarshalledStream=getUnmarshalledStream;n.iterableToReadableStream=iterableToReadableStream;n.readableStreamToIterable=readableStreamToIterable;n.resolveEventStreamSerdeConfig=resolveEventStreamSerdeConfig;n.universalEventStreamSerdeProvider=eventStreamSerdeProvider$1},3422:(t,n,i)=>{const{Uint8ArrayBlobAdapter:a,sdkStreamMixin:A,splitEvery:c,splitHeader:l,fromBase64:d,_parseEpochTimestamp:h,_parseRfc7231DateTime:f,_parseRfc3339DateTimeWithOffset:g,LazyJsonString:p,NumericValue:m,toUtf8:E,fromUtf8:C,generateIdempotencyToken:I,toBase64:y,dateToUtcString:B,quoteHeader:Q}=i(2430);const{TypeRegistry:w,NormalizedSchema:S,translateTraits:b}=i(6890);const{HttpRequest:R,HttpResponse:v,isValidHostname:k}=i(4534);const{parseQueryString:D,parseUrl:T}=i(4534);n.HttpRequest=R;n.HttpResponse=v;n.isValidHostname=k;n.parseQueryString=D;n.parseUrl=T;const{FieldPosition:N}=i(690);const collectBody=async(t=new Uint8Array,n)=>{if(t instanceof Uint8Array){return a.mutate(t)}if(!t){return a.mutate(new Uint8Array)}const i=n.streamCollector(t);return a.mutate(await i)};function extendedEncodeURIComponent(t){return encodeURIComponent(t).replace(/[!'()*]/g,function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()})}class SerdeContext{serdeContext;setSerdeContext(t){this.serdeContext=t}}class HttpProtocol extends SerdeContext{options;compositeErrorRegistry;constructor(t){super();this.options=t;this.compositeErrorRegistry=w.for(t.defaultNamespace);for(const n of t.errorTypeRegistries??[]){this.compositeErrorRegistry.copyFrom(n)}}getRequestType(){return R}getResponseType(){return v}setSerdeContext(t){this.serdeContext=t;this.serializer.setSerdeContext(t);this.deserializer.setSerdeContext(t);if(this.getPayloadCodec()){this.getPayloadCodec().setSerdeContext(t)}}updateServiceEndpoint(t,n){if("url"in n){t.protocol=n.url.protocol;t.hostname=n.url.hostname;t.port=n.url.port?Number(n.url.port):undefined;t.path=n.url.pathname;t.fragment=n.url.hash||void 0;t.username=n.url.username||void 0;t.password=n.url.password||void 0;if(!t.query){t.query={}}for(const[i,a]of n.url.searchParams.entries()){t.query[i]=a}if(n.headers){for(const i in n.headers){t.headers[i]=n.headers[i].join(", ")}}return t}else{t.protocol=n.protocol;t.hostname=n.hostname;t.port=n.port?Number(n.port):undefined;t.path=n.path;t.query={...n.query};if(n.headers){for(const i in n.headers){t.headers[i]=n.headers[i]}}return t}}setHostPrefix(t,n,i){if(this.serdeContext?.disableHostPrefix){return}const a=S.of(n.input);const A=b(n.traits??{});if(A.endpoint){let n=A.endpoint?.[0];if(typeof n==="string"){for(const[t,A]of a.structIterator()){if(!A.getMergedTraits().hostLabel){continue}const a=i[t];if(typeof a!=="string"){throw new Error(`@smithy/core/schema - ${t} in input must be a string as hostLabel.`)}n=n.replace(`{${t}}`,a)}t.hostname=n+t.hostname;if(!k(t.hostname)){throw new Error(`[${t.hostname}] is not a valid hostname.`)}}}}deserializeMetadata(t){return{httpStatusCode:t.statusCode,requestId:t.headers["x-amzn-requestid"]??t.headers["x-amzn-request-id"]??t.headers["x-amz-request-id"],extendedRequestId:t.headers["x-amz-id-2"],cfId:t.headers["x-amz-cf-id"]}}async serializeEventStream({eventStream:t,requestSchema:n,initialRequest:i}){const a=await this.loadEventStreamCapability();return a.serializeEventStream({eventStream:t,requestSchema:n,initialRequest:i})}async deserializeEventStream({response:t,responseSchema:n,initialResponseContainer:i}){const a=await this.loadEventStreamCapability();return a.deserializeEventStream({response:t,responseSchema:n,initialResponseContainer:i})}async loadEventStreamCapability(){const{EventStreamSerde:t,eventStreamSerdeProvider:n}=i(6579);const a=this.resolveEventStreamMarshaller(n);return new t({marshaller:a,serializer:this.serializer,deserializer:this.deserializer,serdeContext:this.serdeContext,defaultContentType:this.getDefaultContentType()})}resolveEventStreamMarshaller(t){const n=this.serdeContext;if(n.eventStreamMarshaller){return n.eventStreamMarshaller}return t(this.serdeContext)}getDefaultContentType(){throw new Error(`@smithy/core/protocols - ${this.constructor.name} getDefaultContentType() implementation missing.`)}async deserializeHttpMessage(t,n,i,a,A){return[]}getEventStreamMarshaller(){const t=this.serdeContext;if(!t.eventStreamMarshaller){throw new Error("@smithy/core - HttpProtocol: eventStreamMarshaller missing in serdeContext.")}return t.eventStreamMarshaller}}class HttpBindingProtocol extends HttpProtocol{async serializeRequest(t,n,i){const a=n&&typeof n==="object"?n:{};const A=this.serializer;const c={};const l={};const d=await i.endpoint();const h=S.of(t?.input);const f=[];const g=[];let p=false;let m;const E=new R({protocol:"",hostname:"",port:undefined,path:"",fragment:undefined,query:c,headers:l,body:undefined});if(d){this.updateServiceEndpoint(E,d);this.setHostPrefix(E,t,a);const n=b(t.traits);if(n.http){E.method=n.http[0];const[t,i]=n.http[1].split("?");if(E.path=="/"){E.path=t}else{E.path+=t}const a=new URLSearchParams(i??"");for(const[t,n]of a){c[t]=n}}}for(const[t,n]of h.structIterator()){const i=n.getMergedTraits()??{};const d=a[t];if(d==null&&!n.isIdempotencyToken()){if(i.httpLabel){if(E.path.includes(`{${t}+}`)||E.path.includes(`{${t}}`)){throw new Error(`No value provided for input HTTP label: ${t}.`)}}continue}if(i.httpPayload){const i=n.isStreaming();if(i){const i=n.isStructSchema();if(i){if(a[t]){m=await this.serializeEventStream({eventStream:a[t],requestSchema:h})}}else{m=d}}else{A.write(n,d);m=A.flush()}}else if(i.httpLabel){A.write(n,d);const i=A.flush();if(E.path.includes(`{${t}+}`)){E.path=E.path.replace(`{${t}+}`,i.split("/").map(extendedEncodeURIComponent).join("/"))}else if(E.path.includes(`{${t}}`)){E.path=E.path.replace(`{${t}}`,extendedEncodeURIComponent(i))}}else if(i.httpHeader){A.write(n,d);l[i.httpHeader.toLowerCase()]=String(A.flush())}else if(typeof i.httpPrefixHeaders==="string"){for(const t in d){const a=d[t];const c=i.httpPrefixHeaders+t;A.write([n.getValueSchema(),{httpHeader:c}],a);l[c.toLowerCase()]=A.flush()}}else if(i.httpQuery||i.httpQueryParams){this.serializeQuery(n,d,c)}else{p=true;f.push(t);g.push(n)}}if(p&&a){const[t,n]=(h.getName(true)??"#Unknown").split("#");const i=h.getSchema()[6];const c=[3,t,n,h.getMergedTraits(),f,g,undefined];if(i){c[6]=i}else{c.pop()}A.write(c,a);m=A.flush()}E.headers=l;E.query=c;E.body=m;return E}serializeQuery(t,n,i){const a=this.serializer;const A=t.getMergedTraits();if(A.httpQueryParams){for(const a in n){if(!(a in i)){const c=n[a];const l=t.getValueSchema();Object.assign(l.getMergedTraits(),{...A,httpQuery:a,httpQueryParams:undefined});this.serializeQuery(l,c,i)}}return}if(t.isListSchema()){const c=!!t.getMergedTraits().sparse;const l=[];for(const i of n){a.write([t.getValueSchema(),A],i);const n=a.flush();if(c||n!==undefined){l.push(n)}}i[A.httpQuery]=l}else{a.write([t,A],n);i[A.httpQuery]=a.flush()}}async deserializeResponse(t,n,i){const a=this.deserializer;const A=S.of(t.output);const c={};if(i.statusCode>=300){const A=await collectBody(i.body,n);if(A.byteLength>0){Object.assign(c,await a.read(15,A))}await this.handleError(t,n,i,c,this.deserializeMetadata(i));throw new Error("@smithy/core/protocols - HTTP Protocol error handler failed to throw.")}for(const t in i.headers){const n=i.headers[t];delete i.headers[t];i.headers[t.toLowerCase()]=n}const l=await this.deserializeHttpMessage(A,n,i,c);if(l.length){const t=await collectBody(i.body,n);if(t.byteLength>0){const n=await a.read(A,t);for(const t of l){if(n[t]!=null){c[t]=n[t]}}}}else if(l.discardResponseBody){await collectBody(i.body,n)}c.$metadata=this.deserializeMetadata(i);return c}async deserializeHttpMessage(t,n,i,a,d){let h;if(a instanceof Set){h=d}else{h=a}let f=true;const g=this.deserializer;const p=S.of(t);const m=[];for(const[t,a]of p.structIterator()){const d=a.getMemberTraits();if(d.httpPayload){f=false;const c=a.isStreaming();if(c){const n=a.isStructSchema();if(n){h[t]=await this.deserializeEventStream({response:i,responseSchema:p})}else{h[t]=A(i.body)}}else if(i.body){const A=await collectBody(i.body,n);if(A.byteLength>0){h[t]=await g.read(a,A)}}}else if(d.httpHeader){const n=String(d.httpHeader).toLowerCase();const A=i.headers[n];if(null!=A){if(a.isListSchema()){const i=a.getValueSchema();i.getMergedTraits().httpHeader=n;let d;if(i.isTimestampSchema()&&i.getSchema()===4){d=c(A,",",2)}else{d=l(A)}const f=[];for(const t of d){f.push(await g.read(i,t.trim()))}h[t]=f}else{h[t]=await g.read(a,A)}}}else if(d.httpPrefixHeaders!==undefined){h[t]={};for(const n in i.headers){if(n.startsWith(d.httpPrefixHeaders)){const A=i.headers[n];const c=a.getValueSchema();c.getMergedTraits().httpHeader=n;h[t][n.slice(d.httpPrefixHeaders.length)]=await g.read(c,A)}}}else if(d.httpResponseCode){h[t]=i.statusCode}else{m.push(t)}}m.discardResponseBody=f;return m}}class RpcProtocol extends HttpProtocol{async serializeRequest(t,n,i){const a=this.serializer;const A={};const c={};const l=await i.endpoint();const d=S.of(t?.input);const h=d.getSchema();let f;const g=n&&typeof n==="object"?n:{};const p=new R({protocol:"",hostname:"",port:undefined,path:"/",fragment:undefined,query:A,headers:c,body:undefined});if(l){this.updateServiceEndpoint(p,l);this.setHostPrefix(p,t,g)}if(g){const t=d.getEventStreamMember();if(t){if(g[t]){const n={};for(const[i,A]of d.structIterator()){if(i!==t&&g[i]){a.write(A,g[i]);n[i]=a.flush()}}f=await this.serializeEventStream({eventStream:g[t],requestSchema:d,initialRequest:n})}}else{a.write(h,g);f=a.flush()}}p.headers=Object.assign(p.headers,c);p.query=A;p.body=f;p.method="POST";return p}async deserializeResponse(t,n,i){const a=this.deserializer;const A=S.of(t.output);const c={};if(i.statusCode>=300){const A=await collectBody(i.body,n);if(A.byteLength>0){Object.assign(c,await a.read(15,A))}await this.handleError(t,n,i,c,this.deserializeMetadata(i));throw new Error("@smithy/core/protocols - RPC Protocol error handler failed to throw.")}for(const t in i.headers){const n=i.headers[t];delete i.headers[t];i.headers[t.toLowerCase()]=n}const l=A.getEventStreamMember();if(l){c[l]=await this.deserializeEventStream({response:i,responseSchema:A,initialResponseContainer:c})}else{const t=await collectBody(i.body,n);if(t.byteLength>0){Object.assign(c,await a.read(A,t))}}c.$metadata=this.deserializeMetadata(i);return c}}const resolvedPath=(t,n,i,a,A,c)=>{if(n!=null&&n[i]!==undefined){const n=a();if(n==null||n.length<=0){throw new Error("Empty value provided for input HTTP label: "+i+".")}t=t.replace(A,c?n.split("/").map(t=>extendedEncodeURIComponent(t)).join("/"):extendedEncodeURIComponent(n))}else{throw new Error("No value provided for input HTTP label: "+i+".")}return t};function requestBuilder(t,n){return new RequestBuilder(t,n)}class RequestBuilder{input;context;query={};method="";headers={};path="";body=null;hostname="";resolvePathStack=[];constructor(t,n){this.input=t;this.context=n}async build(){const{hostname:t,protocol:n="https",port:i,path:a}=await this.context.endpoint();this.path=a;for(const t of this.resolvePathStack){t(this.path)}return new R({protocol:n,hostname:this.hostname||t,port:i,method:this.method,path:this.path,query:this.query,body:this.body,headers:this.headers})}hn(t){this.hostname=t;return this}bp(t){this.resolvePathStack.push(n=>{this.path=`${n?.endsWith("/")?n.slice(0,-1):n||""}`+t});return this}p(t,n,i,a){this.resolvePathStack.push(A=>{this.path=resolvedPath(A,this.input,t,n,i,a)});return this}h(t){this.headers=t;return this}q(t){this.query=t;return this}b(t){this.body=t;return this}m(t){this.method=t;return this}}function determineTimestampFormat(t,n){if(n.timestampFormat.useTrait){if(t.isTimestampSchema()&&(t.getSchema()===5||t.getSchema()===6||t.getSchema()===7)){return t.getSchema()}}const{httpLabel:i,httpPrefixHeaders:a,httpHeader:A,httpQuery:c}=t.getMergedTraits();const l=n.httpBindings?typeof a==="string"||Boolean(A)?6:Boolean(c)||Boolean(i)?5:undefined:undefined;return l??n.timestampFormat.default}class FromStringShapeDeserializer extends SerdeContext{settings;constructor(t){super();this.settings=t}read(t,n){const i=S.of(t);if(i.isListSchema()){return l(n).map(t=>this.read(i.getValueSchema(),t))}if(i.isBlobSchema()){return(this.serdeContext?.base64Decoder??d)(n)}if(i.isTimestampSchema()){const t=determineTimestampFormat(i,this.settings);switch(t){case 5:return g(n);case 6:return f(n);case 7:return h(n);default:console.warn("Missing timestamp format, parsing value with Date constructor:",n);return new Date(n)}}if(i.isStringSchema()){const t=i.getMergedTraits().mediaType;let a=n;if(t){if(i.getMergedTraits().httpHeader){a=this.base64ToUtf8(a)}const n=t==="application/json"||t.endsWith("+json");if(n){a=p.from(a)}return a}}if(i.isNumericSchema()){return Number(n)}if(i.isBigIntegerSchema()){return BigInt(n)}if(i.isBigDecimalSchema()){return new m(n,"bigDecimal")}if(i.isBooleanSchema()){return String(n).toLowerCase()==="true"}return n}base64ToUtf8(t){return(this.serdeContext?.utf8Encoder??E)((this.serdeContext?.base64Decoder??d)(t))}}class HttpInterceptingShapeDeserializer extends SerdeContext{codecDeserializer;stringDeserializer;constructor(t,n){super();this.codecDeserializer=t;this.stringDeserializer=new FromStringShapeDeserializer(n)}setSerdeContext(t){this.stringDeserializer.setSerdeContext(t);this.codecDeserializer.setSerdeContext(t);this.serdeContext=t}read(t,n){const i=S.of(t);const a=i.getMergedTraits();const A=this.serdeContext?.utf8Encoder??E;if(a.httpHeader||a.httpResponseCode){return this.stringDeserializer.read(i,A(n))}if(a.httpPayload){if(i.isBlobSchema()){const t=this.serdeContext?.utf8Decoder??C;if(typeof n==="string"){return t(n)}return n}else if(i.isStringSchema()){if("byteLength"in n){return A(n)}return n}}return this.codecDeserializer.read(i,n)}}class ToStringShapeSerializer extends SerdeContext{settings;stringBuffer="";constructor(t){super();this.settings=t}write(t,n){const i=S.of(t);switch(typeof n){case"object":if(n===null){this.stringBuffer="null";return}if(i.isTimestampSchema()){if(!(n instanceof Date)){throw new Error(`@smithy/core/protocols - received non-Date value ${n} when schema expected Date in ${i.getName(true)}`)}const t=determineTimestampFormat(i,this.settings);switch(t){case 5:this.stringBuffer=n.toISOString().replace(".000Z","Z");break;case 6:this.stringBuffer=B(n);break;case 7:this.stringBuffer=String(n.getTime()/1e3);break;default:console.warn("Missing timestamp format, using epoch seconds",n);this.stringBuffer=String(n.getTime()/1e3)}return}if(i.isBlobSchema()&&"byteLength"in n){this.stringBuffer=(this.serdeContext?.base64Encoder??y)(n);return}if(i.isListSchema()&&Array.isArray(n)){let t="";for(const a of n){this.write([i.getValueSchema(),i.getMergedTraits()],a);const n=this.flush();const A=i.getValueSchema().isTimestampSchema()?n:Q(n);if(t!==""){t+=", "}t+=A}this.stringBuffer=t;return}this.stringBuffer=JSON.stringify(n,null,2);break;case"string":const t=i.getMergedTraits().mediaType;let a=n;if(t){const n=t==="application/json"||t.endsWith("+json");if(n){a=p.from(a)}if(i.getMergedTraits().httpHeader){this.stringBuffer=(this.serdeContext?.base64Encoder??y)(a.toString());return}}this.stringBuffer=n;break;default:if(i.isIdempotencyToken()){this.stringBuffer=I()}else{this.stringBuffer=String(n)}}}flush(){const t=this.stringBuffer;this.stringBuffer="";return t}}class HttpInterceptingShapeSerializer{codecSerializer;stringSerializer;buffer;constructor(t,n,i=new ToStringShapeSerializer(n)){this.codecSerializer=t;this.stringSerializer=i}setSerdeContext(t){this.codecSerializer.setSerdeContext(t);this.stringSerializer.setSerdeContext(t)}write(t,n){const i=S.of(t);const a=i.getMergedTraits();if(a.httpHeader||a.httpLabel||a.httpQuery){this.stringSerializer.write(i,n);this.buffer=this.stringSerializer.flush();return}return this.codecSerializer.write(i,n)}flush(){if(this.buffer!==undefined){const t=this.buffer;this.buffer=undefined;return t}return this.codecSerializer.flush()}}class Field{name;kind;values;constructor({name:t,kind:n=N.HEADER,values:i=[]}){this.name=t;this.kind=n;this.values=i}add(t){this.values.push(t)}set(t){this.values=t}remove(t){this.values=this.values.filter(n=>n!==t)}toString(){return this.values.map(t=>t.includes(",")||t.includes(" ")?`"${t}"`:t).join(", ")}get(){return this.values}}class Fields{entries={};encoding;constructor({fields:t=[],encoding:n="utf-8"}){t.forEach(this.setField.bind(this));this.encoding=n}setField(t){this.entries[t.name.toLowerCase()]=t}getField(t){return this.entries[t.toLowerCase()]}removeField(t){delete this.entries[t.toLowerCase()]}getByType(t){return Object.values(this.entries).filter(n=>n.kind===t)}}const getHttpHandlerExtensionConfiguration=t=>({setHttpHandler(n){t.httpHandler=n},httpHandler(){return t.httpHandler},updateHttpClientConfig(n,i){t.httpHandler?.updateHttpClientConfig(n,i)},httpHandlerConfigs(){return t.httpHandler.httpHandlerConfigs()}});const resolveHttpHandlerRuntimeConfig=t=>({httpHandler:t.httpHandler()});const M="content-length";function contentLengthMiddleware(t){return n=>async i=>{const a=i.request;if(R.isInstance(a)){const{body:n,headers:i}=a;if(n&&Object.keys(i).map(t=>t.toLowerCase()).indexOf(M)===-1){try{const i=t(n);a.headers={...a.headers,[M]:String(i)}}catch(t){}}}return n({...i,request:a})}}const F={step:"build",tags:["SET_CONTENT_LENGTH","CONTENT_LENGTH"],name:"contentLengthMiddleware",override:true};const getContentLengthPlugin=t=>({applyToStack:n=>{n.add(contentLengthMiddleware(t.bodyLengthChecker),F)}});const escapeUri=t=>encodeURIComponent(t).replace(/[!'()*]/g,hexEncode);const hexEncode=t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`;const escapeUriPath=t=>t.split("/").map(escapeUri).join("/");function buildQueryString(t){const n=[];for(let i of Object.keys(t).sort()){const a=t[i];i=escapeUri(i);if(Array.isArray(a)){for(let t=0,A=a.length;t{const{Readable:a}=i(7075);const{NoOpLogger:A,normalizeProvider:c}=i(2658);const{HttpResponse:l,HttpRequest:d}=i(3422);const{parseRfc7231DateTime:h,v4:f}=i(2430);const isStreamingPayload=t=>t?.body instanceof a||typeof ReadableStream!=="undefined"&&t?.body instanceof ReadableStream;const g=["AuthFailure","InvalidSignatureException","RequestExpired","RequestInTheFuture","RequestTimeTooSkewed","SignatureDoesNotMatch"];const p=["BandwidthLimitExceeded","EC2ThrottledException","LimitExceededException","PriorRequestNotComplete","ProvisionedThroughputExceededException","RequestLimitExceeded","RequestThrottled","RequestThrottledException","SlowDown","ThrottledException","Throttling","ThrottlingException","TooManyRequestsException","TransactionInProgressException"];const m=["TimeoutError","RequestTimeout","RequestTimeoutException"];const E=[500,502,503,504];const C=["ECONNRESET","ECONNREFUSED","EPIPE","ETIMEDOUT"];const I=["EHOSTUNREACH","ENETUNREACH","ENOTFOUND","EAI_AGAIN"];const isRetryableByTrait=t=>t?.$retryable!==undefined;const isClockSkewError=t=>g.includes(t.name);const isClockSkewCorrectedError=t=>t.$metadata?.clockSkewCorrected;const isBrowserNetworkError=t=>{const n=new Set(["Failed to fetch","NetworkError when attempting to fetch resource","The Internet connection appears to be offline","Load failed","Network request failed"]);const i=t&&t instanceof TypeError;if(!i){return false}return n.has(t.message)};const isThrottlingError=t=>t.$metadata?.httpStatusCode===429||p.includes(t.name)||t.$retryable?.throttling==true;const isTransientError=(t,n=0)=>isRetryableByTrait(t)||isClockSkewCorrectedError(t)||t.name==="InvalidSignatureException"&&t.message?.includes("Signature expired")||m.includes(t.name)||C.includes(t?.code||"")||I.includes(t?.code||"")||E.includes(t.$metadata?.httpStatusCode||0)||isBrowserNetworkError(t)||isNodeJsHttp2TransientError(t)||t.cause!==undefined&&n<=10&&isTransientError(t.cause,n+1);const isServerError=t=>{if(t.$metadata?.httpStatusCode!==undefined){const n=t.$metadata.httpStatusCode;if(500<=n&&n<=599&&!isTransientError(t)){return true}return false}return false};function isNodeJsHttp2TransientError(t){return t.code==="ERR_HTTP2_STREAM_ERROR"&&t.message.includes("NGHTTP2_REFUSED_STREAM")}const y=100;const B=20*1e3;const Q=500;const w=500;const S=5;const b=10;const R=1;const v="amz-sdk-invocation-id";const k="amz-sdk-request";function parseRetryAfterHeader(t,n){if(!l.isInstance(t)){return}for(const i of Object.keys(t.headers)){const a=i.toLowerCase();if(a==="retry-after"){const a=t.headers[i];let A=NaN;if(a.endsWith("GMT")){try{const t=h(a);A=(t.getTime()-Date.now())/1e3}catch(t){n?.trace?.("Failed to parse retry-after header");n?.trace?.(t)}}else if(a.match(/ GMT, ((\d+)|(\d+\.\d+))$/)){A=Number(a.match(/ GMT, ([\d.]+)$/)?.[1])}else if(a.match(/^((\d+)|(\d+\.\d+))$/)){A=Number(a)}else if(Date.parse(a)>=Date.now()){A=(Date.parse(a)-Date.now())/1e3}if(isNaN(A)){return}return new Date(Date.now()+A*1e3)}else if(a==="x-amz-retry-after"){const a=t.headers[i];const A=Number(a);if(isNaN(A)){n?.trace?.(`Failed to parse x-amz-retry-after=${a}`);return}return new Date(Date.now()+A)}}}function getRetryAfterHint(t,n){return parseRetryAfterHeader(t,n)}const asSdkError=t=>{if(t instanceof Error)return t;if(t instanceof Object)return Object.assign(new Error,t);if(typeof t==="string")return new Error(t);return new Error(`AWS SDK error wrapper for ${t}`)};function bindRetryMiddleware(t){return n=>(i,a)=>async c=>{let l=await n.retryStrategy();const h=await n.maxAttempts();if(isRetryStrategyV2(l)){l=l;let g=await l.acquireInitialRetryToken((a["partition_id"]??"")+(a.__retryLongPoll?":longpoll":""));let p=new Error;let m=0;let E=0;const{request:C}=c;const I=d.isInstance(C);if(I){C.headers[v]=f()}while(true){try{if(I){C.headers[k]=`attempt=${m+1}; max=${h}`}const{response:t,output:n}=await i(c);l.recordSuccess(g);n.$metadata.attempts=m+1;n.$metadata.totalRetryDelay=E;return{response:t,output:n}}catch(i){const c=getRetryErrorInfo(i,n.logger);p=asSdkError(i);if(I&&t(C)){(a.logger instanceof A?console:a.logger)?.warn("An error was encountered in a non-retryable streaming request.");throw p}try{g=await l.refreshRetryTokenForRetry(g,c)}catch(t){if(!p.$metadata){p.$metadata={}}p.$metadata.attempts=m+1;p.$metadata.totalRetryDelay=E;throw p}m=g.getRetryCount();const d=g.getRetryDelay();E+=(g?.$retryLog?.acquisitionDelay??0)+d;if(d>0){await cooldown(d)}}}}else{l=l;if(l?.mode){a.userAgent=[...a.userAgent||[],["cfg/retry-mode",l.mode]]}return l.retry(i,c)}}}const cooldown=t=>new Promise(n=>setTimeout(n,t));const isRetryStrategyV2=t=>typeof t.acquireInitialRetryToken!=="undefined"&&typeof t.refreshRetryTokenForRetry!=="undefined"&&typeof t.recordSuccess!=="undefined";const getRetryErrorInfo=(t,n)=>{const i={error:t,errorType:getRetryErrorType(t)};const a=parseRetryAfterHeader(t.$response,n);if(a){i.retryAfterHint=a}return i};const getRetryErrorType=t=>{if(isThrottlingError(t))return"THROTTLING";if(isTransientError(t))return"TRANSIENT";if(isServerError(t))return"SERVER_ERROR";return"CLIENT_ERROR"};const D={name:"retryMiddleware",tags:["RETRY"],step:"finalizeRequest",priority:"high",override:true};function bindGetRetryPlugin(t){const n=bindRetryMiddleware(t);return t=>({applyToStack:i=>{i.add(n(t),D)}})}class DefaultRateLimiter{static setTimeoutFn=(t,n)=>setTimeout(t,n);beta;minCapacity;minFillRate;scaleConstant;smooth;enabled=false;availableTokens=0;lastMaxRate=0;measuredTxRate=0;requestCount=0;fillRate;lastThrottleTime;lastTimestamp=0;lastTxRateBucket;maxCapacity;timeWindow=0;constructor(t){this.beta=t?.beta??.7;this.minCapacity=t?.minCapacity??1;this.minFillRate=t?.minFillRate??.5;this.scaleConstant=t?.scaleConstant??.4;this.smooth=t?.smooth??.8;this.lastThrottleTime=this.getCurrentTimeInSeconds();this.lastTxRateBucket=Math.floor(this.getCurrentTimeInSeconds());this.fillRate=this.minFillRate;this.maxCapacity=this.minCapacity}async getSendToken(){return this.acquireTokenBucket(1)}updateClientSendingRate(t){let n;this.updateMeasuredRate();const i=t;const a=i?.errorType==="THROTTLING"||isThrottlingError(i?.error??t);if(a){const t=!this.enabled?this.measuredTxRate:Math.min(this.measuredTxRate,this.fillRate);this.lastMaxRate=t;this.calculateTimeWindow();this.lastThrottleTime=this.getCurrentTimeInSeconds();n=this.cubicThrottle(t);this.enableTokenBucket()}else{this.calculateTimeWindow();n=this.cubicSuccess(this.getCurrentTimeInSeconds())}const A=Math.min(n,2*this.measuredTxRate);this.updateTokenBucketRate(A)}getCurrentTimeInSeconds(){return Date.now()/1e3}async acquireTokenBucket(t){if(!this.enabled){return}this.refillTokenBucket();while(t>this.availableTokens){const n=(t-this.availableTokens)/this.fillRate*1e3;await new Promise(t=>DefaultRateLimiter.setTimeoutFn(t,n));this.refillTokenBucket()}this.availableTokens=this.availableTokens-t}refillTokenBucket(){const t=this.getCurrentTimeInSeconds();if(!this.lastTimestamp){this.lastTimestamp=t;return}const n=(t-this.lastTimestamp)*this.fillRate;this.availableTokens=Math.min(this.maxCapacity,this.availableTokens+n);this.lastTimestamp=t}calculateTimeWindow(){this.timeWindow=this.getPrecise(Math.pow(this.lastMaxRate*(1-this.beta)/this.scaleConstant,1/3))}cubicThrottle(t){return this.getPrecise(t*this.beta)}cubicSuccess(t){return this.getPrecise(this.scaleConstant*Math.pow(t-this.lastThrottleTime-this.timeWindow,3)+this.lastMaxRate)}enableTokenBucket(){this.enabled=true}updateTokenBucketRate(t){this.refillTokenBucket();this.fillRate=Math.max(t,this.minFillRate);this.maxCapacity=Math.max(t,this.minCapacity);this.availableTokens=Math.min(this.availableTokens,this.maxCapacity)}updateMeasuredRate(){const t=this.getCurrentTimeInSeconds();const n=Math.floor(t*2)/2;this.requestCount++;if(n>this.lastTxRateBucket){const t=this.requestCount/(n-this.lastTxRateBucket);this.measuredTxRate=this.getPrecise(t*this.smooth+this.measuredTxRate*(1-this.smooth));this.requestCount=0;this.lastTxRateBucket=n}}getPrecise(t){return parseFloat(t.toFixed(8))}}class Retry{static v2026=typeof process!=="undefined"&&process.env?.SMITHY_NEW_RETRIES_2026==="true";static delay(){return Retry.v2026?50:100}static throttlingDelay(){return Retry.v2026?1e3:500}static cost(){return Retry.v2026?14:5}static throttlingCost(){return Retry.v2026?5:10}static modifiedCostType(){return Retry.v2026?"THROTTLING":"TRANSIENT"}}class DefaultRetryBackoffStrategy{x=Retry.delay();computeNextBackoffDelay(t){const n=Math.random();const i=2;const a=n*Math.min(this.x*i**t,B);return Math.floor(a)}setDelayBase(t){this.x=t}}class DefaultRetryToken{delay;count;cost;longPoll;$retryLog={acquisitionDelay:0};constructor(t,n,i,a){this.delay=t;this.count=n;this.cost=i;this.longPoll=a}getRetryCount(){return this.count}getRetryDelay(){return Math.min(B,this.delay)}getRetryCost(){return this.cost}isLongPoll(){return this.longPoll}}var T;(function(t){t["STANDARD"]="standard";t["ADAPTIVE"]="adaptive"})(T||(T={}));const N=3;const M=T.STANDARD;const F={incompatible:1,attempts:2,capacity:3};let x=class StandardRetryStrategy{mode=T.STANDARD;retryBackoffStrategy;capacity=w;maxAttemptsProvider;baseDelay;constructor(t){if(typeof t==="number"){this.maxAttemptsProvider=async()=>t}else if(typeof t==="function"){this.maxAttemptsProvider=t}else if(t&&typeof t==="object"){this.maxAttemptsProvider=async()=>t.maxAttempts;this.baseDelay=t.baseDelay;this.retryBackoffStrategy=t.backoff}this.maxAttemptsProvider??=async()=>N;this.baseDelay??=Retry.delay();this.retryBackoffStrategy??=new DefaultRetryBackoffStrategy}async acquireInitialRetryToken(t){return new DefaultRetryToken(Retry.delay(),0,undefined,Retry.v2026&&t.includes(":longpoll"))}async refreshRetryTokenForRetry(t,n){const i=await this.getMaxAttempts();const a=this.retryCode(t,n,i);const A=a===0;const c=t.isLongPoll?.();if(A||c){const i=n.errorType;this.retryBackoffStrategy.setDelayBase(i==="THROTTLING"?Retry.throttlingDelay():this.baseDelay);const l=this.retryBackoffStrategy.computeNextBackoffDelay(t.getRetryCount());let d=l;if(n.retryAfterHint instanceof Date){d=Math.max(l,Math.min(n.retryAfterHint.getTime()-Date.now(),l+5e3))}if(!A){const t=Retry.v2026&&a===F.capacity&&c?d:0;if(t>0){await new Promise(n=>setTimeout(n,t))}}else{const n=this.getCapacityCost(i);this.capacity-=n;const a=new DefaultRetryToken(0,t.getRetryCount()+1,n,t.isLongPoll?.()??false);await new Promise(t=>setTimeout(t,d));a.$retryLog.acquisitionDelay=d;return a}}throw new Error("No retry token available")}recordSuccess(t){this.capacity=Math.min(w,this.capacity+(t.getRetryCost()??R))}getCapacity(){return this.capacity}async maxAttempts(){return this.maxAttemptsProvider()}async getMaxAttempts(){try{return await this.maxAttemptsProvider()}catch(t){console.warn(`Max attempts provider could not resolve. Using default of ${N}`);return N}}retryCode(t,n,i){const a=t.getRetryCount()+1;const A=this.isRetryableError(n.errorType)?0:F.incompatible;const c=a=this.getCapacityCost(n.errorType)?0:F.capacity;return A||c||l}getCapacityCost(t){return t===Retry.modifiedCostType()?Retry.throttlingCost():Retry.cost()}isRetryableError(t){return t==="THROTTLING"||t==="TRANSIENT"}};let U=class AdaptiveRetryStrategy{mode=T.ADAPTIVE;rateLimiter;standardRetryStrategy;constructor(t,n){const{rateLimiter:i}=n??{};this.rateLimiter=i??new DefaultRateLimiter;this.standardRetryStrategy=n?new x({maxAttempts:typeof t==="number"?t:3,...n}):new x(t)}async acquireInitialRetryToken(t){const n=await this.standardRetryStrategy.acquireInitialRetryToken(t);await this.rateLimiter.getSendToken();return n}async refreshRetryTokenForRetry(t,n){this.rateLimiter.updateClientSendingRate(n);const i=await this.standardRetryStrategy.refreshRetryTokenForRetry(t,n);await this.rateLimiter.getSendToken();return i}recordSuccess(t){this.rateLimiter.updateClientSendingRate({});this.standardRetryStrategy.recordSuccess(t)}async maxAttemptsProvider(){return this.standardRetryStrategy.maxAttempts()}};class ConfiguredRetryStrategy extends x{computeNextBackoffDelay;constructor(t,n=Retry.delay()){super(typeof t==="function"?t:async()=>t);if(typeof n==="number"){this.computeNextBackoffDelay=()=>n}else{this.computeNextBackoffDelay=n}this.retryBackoffStrategy.computeNextBackoffDelay=t=>{const n=t+1;return this.computeNextBackoffDelay(n)}}}const getDefaultRetryQuota=(t,n)=>{const i=t;const a=R;const A=S;const c=b;let l=t;const getCapacityAmount=t=>t.name==="TimeoutError"?c:A;const hasRetryTokens=t=>getCapacityAmount(t)<=l;const retrieveRetryTokens=t=>{if(!hasRetryTokens(t)){throw new Error("No retry token available")}const n=getCapacityAmount(t);l-=n;return n};const releaseRetryTokens=t=>{l+=t??a;l=Math.min(l,i)};return Object.freeze({hasRetryTokens:hasRetryTokens,retrieveRetryTokens:retrieveRetryTokens,releaseRetryTokens:releaseRetryTokens})};const defaultDelayDecider=(t,n)=>Math.floor(Math.min(B,Math.random()*2**n*t));const defaultRetryDecider=t=>{if(!t){return false}return isRetryableByTrait(t)||isClockSkewError(t)||isThrottlingError(t)||isTransientError(t)};class StandardRetryStrategy{maxAttemptsProvider;retryDecider;delayDecider;retryQuota;mode=T.STANDARD;constructor(t,n){this.maxAttemptsProvider=t;this.retryDecider=n?.retryDecider??defaultRetryDecider;this.delayDecider=n?.delayDecider??defaultDelayDecider;this.retryQuota=n?.retryQuota??getDefaultRetryQuota(w)}shouldRetry(t,n,i){return nsetTimeout(t,l));continue}if(!n.$metadata){n.$metadata={}}n.$metadata.attempts=A;n.$metadata.totalRetryDelay=c;throw n}}}}const getDelayFromRetryAfterHeader=t=>{if(!l.isInstance(t))return;const n=Object.keys(t.headers).find(t=>t.toLowerCase()==="retry-after");if(!n)return;const i=t.headers[n];const a=Number(i);if(!Number.isNaN(a))return Math.min(a*1e3,2e4);const A=new Date(i);return Math.min(A.getTime()-Date.now(),2e4)};class AdaptiveRetryStrategy extends StandardRetryStrategy{rateLimiter;constructor(t,n){const{rateLimiter:i,...a}=n??{};super(t,a);this.rateLimiter=i??new DefaultRateLimiter;this.mode=T.ADAPTIVE}async retry(t,n){return super.retry(t,n,{beforeRequest:async()=>this.rateLimiter.getSendToken(),afterRequest:t=>{this.rateLimiter.updateClientSendingRate(t)}})}}const P="AWS_MAX_ATTEMPTS";const L="max_attempts";const O={environmentVariableSelector:t=>{const n=t[P];if(!n)return undefined;const i=parseInt(n);if(Number.isNaN(i)){throw new Error(`Environment variable ${P} mast be a number, got "${n}"`)}return i},configFileSelector:t=>{const n=t[L];if(!n)return undefined;const i=parseInt(n);if(Number.isNaN(i)){throw new Error(`Shared config file entry ${L} mast be a number, got "${n}"`)}return i},default:N};const resolveRetryConfig=(t,n)=>{const{retryStrategy:i,retryMode:a}=t;const{defaultMaxAttempts:A=N,defaultBaseDelay:l=Retry.delay()}=n??{};const d=c(t.maxAttempts??A);let h=i?Promise.resolve(i):undefined;const getDefault=async()=>{const t=await d();const n=await c(a)()===T.ADAPTIVE;if(n){return new U(d,{maxAttempts:t,baseDelay:l})}return new x({maxAttempts:t,baseDelay:l})};return Object.assign(t,{maxAttempts:d,retryStrategy:()=>h??=getDefault()})};const H="AWS_RETRY_MODE";const $="retry_mode";const G={environmentVariableSelector:t=>t[H],configFileSelector:t=>t[$],default:M};const omitRetryHeadersMiddleware=()=>t=>async n=>{const{request:i}=n;if(d.isInstance(i)){delete i.headers[v];delete i.headers[k]}return t(n)};const V={name:"omitRetryHeadersMiddleware",tags:["RETRY","HEADERS","OMIT_RETRY_HEADERS"],relation:"before",toMiddleware:"awsAuthMiddleware",override:true};const getOmitRetryHeadersPlugin=t=>({applyToStack:t=>{t.addRelativeTo(omitRetryHeadersMiddleware(),V)}});const Y=bindRetryMiddleware(isStreamingPayload);const J=bindGetRetryPlugin(isStreamingPayload);n.AdaptiveRetryStrategy=U;n.CONFIG_MAX_ATTEMPTS=L;n.CONFIG_RETRY_MODE=$;n.ConfiguredRetryStrategy=ConfiguredRetryStrategy;n.DEFAULT_MAX_ATTEMPTS=N;n.DEFAULT_RETRY_DELAY_BASE=y;n.DEFAULT_RETRY_MODE=M;n.DefaultRateLimiter=DefaultRateLimiter;n.DeprecatedAdaptiveRetryStrategy=AdaptiveRetryStrategy;n.DeprecatedStandardRetryStrategy=StandardRetryStrategy;n.ENV_MAX_ATTEMPTS=P;n.ENV_RETRY_MODE=H;n.INITIAL_RETRY_TOKENS=w;n.INVOCATION_ID_HEADER=v;n.MAXIMUM_RETRY_DELAY=B;n.NODE_MAX_ATTEMPT_CONFIG_OPTIONS=O;n.NODE_RETRY_MODE_CONFIG_OPTIONS=G;n.NO_RETRY_INCREMENT=R;n.REQUEST_HEADER=k;n.RETRY_COST=S;n.RETRY_MODES=T;n.Retry=Retry;n.StandardRetryStrategy=x;n.THROTTLING_RETRY_DELAY_BASE=Q;n.TIMEOUT_RETRY_COST=b;n.defaultDelayDecider=defaultDelayDecider;n.defaultRetryDecider=defaultRetryDecider;n.getOmitRetryHeadersPlugin=getOmitRetryHeadersPlugin;n.getRetryAfterHint=getRetryAfterHint;n.getRetryPlugin=J;n.isBrowserNetworkError=isBrowserNetworkError;n.isClockSkewCorrectedError=isClockSkewCorrectedError;n.isClockSkewError=isClockSkewError;n.isNodeJsHttp2TransientError=isNodeJsHttp2TransientError;n.isRetryableByTrait=isRetryableByTrait;n.isServerError=isServerError;n.isThrottlingError=isThrottlingError;n.isTransientError=isTransientError;n.omitRetryHeadersMiddleware=omitRetryHeadersMiddleware;n.omitRetryHeadersMiddlewareOptions=V;n.resolveRetryConfig=resolveRetryConfig;n.retryMiddleware=Y;n.retryMiddlewareOptions=D},6890:(t,n,i)=>{const{getSmithyContext:a,HttpResponse:A,toEndpointV1:c}=i(4534);const deref=t=>{if(typeof t==="function"){return t()}return t};const operation=(t,n,i,a,A)=>({name:n,namespace:t,traits:i,input:a,output:A});const schemaDeserializationMiddleware=t=>(n,i)=>async c=>{const{response:l}=await n(c);const{operationSchema:d}=a(i);const[,h,f,g,p,m]=d??[];try{const n=await t.protocol.deserializeResponse(operation(h,f,g,p,m),{...t,...i},l);return{response:l,output:n}}catch(t){Object.defineProperty(t,"$response",{value:l,enumerable:false,writable:false,configurable:false});if(!("$metadata"in t)){const n=`Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.`;try{t.message+="\n "+n}catch(t){if(!i.logger||i.logger?.constructor?.name==="NoOpLogger"){console.warn(n)}else{i.logger?.warn?.(n)}}if(typeof t.$responseBodyText!=="undefined"){if(t.$response){t.$response.body=t.$responseBodyText}}try{if(A.isInstance(l)){const{headers:n={},statusCode:i}=l;const a=Object.entries(n);t.$metadata={httpStatusCode:i,requestId:findHeader(/^x-[\w-]+-request-?id$/,a),extendedRequestId:findHeader(/^x-[\w-]+-id-2$/,a),cfId:findHeader(/^x-[\w-]+-cf-id$/,a)}}}catch(t){}}throw t}};const findHeader=(t,n)=>(n.find(([n])=>n.match(t))||[void 0,void 0])[1];const schemaSerializationMiddleware=t=>(n,i)=>async A=>{const{operationSchema:l}=a(i);const[,d,h,f,g,p]=l??[];const m=i.endpointV2?async()=>c(i.endpointV2):t.endpoint;const E=await t.protocol.serializeRequest(operation(d,h,f,g,p),A.input,{...t,...i,endpoint:m});return n({...A,request:E})};const l={name:"deserializerMiddleware",step:"deserialize",tags:["DESERIALIZER"],override:true};const d={name:"serializerMiddleware",step:"serialize",tags:["SERIALIZER"],override:true};function getSchemaSerdePlugin(t){return{applyToStack:n=>{n.add(schemaSerializationMiddleware(t),d);n.add(schemaDeserializationMiddleware(t),l);t.protocol.setSerdeContext(t)}}}class Schema{name;namespace;traits;static assign(t,n){const i=Object.assign(t,n);return i}static[Symbol.hasInstance](t){const n=this.prototype.isPrototypeOf(t);if(!n&&typeof t==="object"&&t!==null){const n=t;return n.symbol===this.symbol}return n}getName(){return this.namespace+"#"+this.name}}class ListSchema extends Schema{static symbol=Symbol.for("@smithy/lis");name;traits;valueSchema;symbol=ListSchema.symbol}const list=(t,n,i,a)=>Schema.assign(new ListSchema,{name:n,namespace:t,traits:i,valueSchema:a});class MapSchema extends Schema{static symbol=Symbol.for("@smithy/map");name;traits;keySchema;valueSchema;symbol=MapSchema.symbol}const map=(t,n,i,a,A)=>Schema.assign(new MapSchema,{name:n,namespace:t,traits:i,keySchema:a,valueSchema:A});class OperationSchema extends Schema{static symbol=Symbol.for("@smithy/ope");name;traits;input;output;symbol=OperationSchema.symbol}const op=(t,n,i,a,A)=>Schema.assign(new OperationSchema,{name:n,namespace:t,traits:i,input:a,output:A});class StructureSchema extends Schema{static symbol=Symbol.for("@smithy/str");name;traits;memberNames;memberList;symbol=StructureSchema.symbol}const struct=(t,n,i,a,A)=>Schema.assign(new StructureSchema,{name:n,namespace:t,traits:i,memberNames:a,memberList:A});class ErrorSchema extends StructureSchema{static symbol=Symbol.for("@smithy/err");ctor;symbol=ErrorSchema.symbol}const error=(t,n,i,a,A,c)=>Schema.assign(new ErrorSchema,{name:n,namespace:t,traits:i,memberNames:a,memberList:A,ctor:null});const h=[];function translateTraits(t){if(typeof t==="object"){return t}t=t|0;if(h[t]){return h[t]}const n={};let i=0;for(const a of["httpLabel","idempotent","idempotencyToken","sensitive","httpPayload","httpResponseCode","httpQueryParams"]){if((t>>i++&1)===1){n[a]=1}}return h[t]=n}const f={it:Symbol.for("@smithy/nor-struct-it"),ns:Symbol.for("@smithy/ns")};const g=[];const p={};class NormalizedSchema{ref;memberName;static symbol=Symbol.for("@smithy/nor");symbol=NormalizedSchema.symbol;name;schema;_isMemberSchema;traits;memberTraits;normalizedTraits;constructor(t,n){this.ref=t;this.memberName=n;const i=[];let a=t;let A=t;this._isMemberSchema=false;while(isMemberSchema(a)){i.push(a[1]);a=a[0];A=deref(a);this._isMemberSchema=true}if(i.length>0){this.memberTraits={};for(let t=i.length-1;t>=0;--t){const n=i[t];Object.assign(this.memberTraits,translateTraits(n))}}else{this.memberTraits=0}if(A instanceof NormalizedSchema){const t=this.memberTraits;Object.assign(this,A);this.memberTraits=Object.assign({},t,A.getMemberTraits(),this.getMemberTraits());this.normalizedTraits=void 0;this.memberName=n??A.memberName;return}this.schema=deref(A);if(isStaticSchema(this.schema)){this.name=`${this.schema[1]}#${this.schema[2]}`;this.traits=this.schema[3]}else{this.name=this.memberName??String(A);this.traits=0}if(this._isMemberSchema&&!n){throw new Error(`@smithy/core/schema - NormalizedSchema member init ${this.getName(true)} missing member name.`)}}static[Symbol.hasInstance](t){const n=this.prototype.isPrototypeOf(t);if(!n&&typeof t==="object"&&t!==null){const n=t;return n.symbol===this.symbol}return n}static of(t){const n=typeof t==="function"||typeof t==="object"&&t!==null;if(typeof t==="number"){if(g[t]){return g[t]}}else if(typeof t==="string"){if(p[t]){return p[t]}}else if(n){if(t[f.ns]){return t[f.ns]}}const i=deref(t);if(i instanceof NormalizedSchema){return i}if(isMemberSchema(i)){const[n,a]=i;if(n instanceof NormalizedSchema){Object.assign(n.getMergedTraits(),translateTraits(a));return n}throw new Error(`@smithy/core/schema - may not init unwrapped member schema=${JSON.stringify(t,null,2)}.`)}const a=new NormalizedSchema(i);if(n){return t[f.ns]=a}if(typeof i==="string"){return p[i]=a}if(typeof i==="number"){return g[i]=a}return a}getSchema(){const t=this.schema;if(Array.isArray(t)&&t[0]===0){return t[4]}return t}getName(t=false){const{name:n}=this;const i=!t&&n&&n.includes("#");return i?n.split("#")[1]:n||undefined}getMemberName(){return this.memberName}isMemberSchema(){return this._isMemberSchema}isListSchema(){const t=this.getSchema();return typeof t==="number"?t>=64&&t<128:t[0]===1}isMapSchema(){const t=this.getSchema();return typeof t==="number"?t>=128&&t<=255:t[0]===2}isStructSchema(){const t=this.getSchema();if(typeof t!=="object"){return false}const n=t[0];return n===3||n===-3||n===4}isUnionSchema(){const t=this.getSchema();if(typeof t!=="object"){return false}return t[0]===4}isBlobSchema(){const t=this.getSchema();return t===21||t===42}isTimestampSchema(){const t=this.getSchema();return typeof t==="number"&&t>=4&&t<=7}isUnitSchema(){return this.getSchema()==="unit"}isDocumentSchema(){return this.getSchema()===15}isStringSchema(){return this.getSchema()===0}isBooleanSchema(){return this.getSchema()===2}isNumericSchema(){return this.getSchema()===1}isBigIntegerSchema(){return this.getSchema()===17}isBigDecimalSchema(){return this.getSchema()===19}isStreaming(){const{streaming:t}=this.getMergedTraits();return!!t||this.getSchema()===42}isIdempotencyToken(){return!!this.getMergedTraits().idempotencyToken}getMergedTraits(){return this.normalizedTraits??(this.normalizedTraits={...this.getOwnTraits(),...this.getMemberTraits()})}getMemberTraits(){return translateTraits(this.memberTraits)}getOwnTraits(){return translateTraits(this.traits)}getKeySchema(){const[t,n]=[this.isDocumentSchema(),this.isMapSchema()];if(!t&&!n){throw new Error(`@smithy/core/schema - cannot get key for non-map: ${this.getName(true)}`)}const i=this.getSchema();const a=t?15:i[4]??0;return member([a,0],"key")}getValueSchema(){const t=this.getSchema();const[n,i,a]=[this.isDocumentSchema(),this.isMapSchema(),this.isListSchema()];const A=typeof t==="number"?63&t:t&&typeof t==="object"&&(i||a)?t[3+t[0]]:n?15:void 0;if(A!=null){return member([A,0],i?"value":"member")}throw new Error(`@smithy/core/schema - ${this.getName(true)} has no value member.`)}getMemberSchema(t){const n=this.getSchema();if(this.isStructSchema()&&n[4].includes(t)){const i=n[4].indexOf(t);const a=n[5][i];return member(isMemberSchema(a)?a:[a,0],t)}if(this.isDocumentSchema()){return member([15,0],t)}throw new Error(`@smithy/core/schema - ${this.getName(true)} has no member=${t}.`)}getMemberSchemas(){const t={};try{for(const[n,i]of this.structIterator()){t[n]=i}}catch(t){}return t}getEventStreamMember(){if(this.isStructSchema()){for(const[t,n]of this.structIterator()){if(n.isStreaming()&&n.isStructSchema()){return t}}}return""}*structIterator(){if(this.isUnitSchema()){return}if(!this.isStructSchema()){throw new Error("@smithy/core/schema - cannot iterate non-struct schema.")}const t=this.getSchema();const n=t[4].length;let i=t[f.it];if(i&&n===i.length){yield*i;return}i=Array(n);for(let a=0;aArray.isArray(t)&&t.length===2;const isStaticSchema=t=>Array.isArray(t)&&t.length>=5;class SimpleSchema extends Schema{static symbol=Symbol.for("@smithy/sim");name;schemaRef;traits;symbol=SimpleSchema.symbol}const sim=(t,n,i,a)=>Schema.assign(new SimpleSchema,{name:n,namespace:t,traits:a,schemaRef:i});const simAdapter=(t,n,i,a)=>Schema.assign(new SimpleSchema,{name:n,namespace:t,traits:i,schemaRef:a});const m={BLOB:21,STREAMING_BLOB:42,BOOLEAN:2,STRING:0,NUMERIC:1,BIG_INTEGER:17,BIG_DECIMAL:19,DOCUMENT:15,TIMESTAMP_DEFAULT:4,TIMESTAMP_DATE_TIME:5,TIMESTAMP_HTTP_DATE:6,TIMESTAMP_EPOCH_SECONDS:7,LIST_MODIFIER:64,MAP_MODIFIER:128};class TypeRegistry{namespace;schemas;exceptions;static registries=new Map;constructor(t,n=new Map,i=new Map){this.namespace=t;this.schemas=n;this.exceptions=i}static for(t){if(!TypeRegistry.registries.has(t)){TypeRegistry.registries.set(t,new TypeRegistry(t))}return TypeRegistry.registries.get(t)}copyFrom(t){const{schemas:n,exceptions:i}=this;for(const[i,a]of t.schemas){if(!n.has(i)){n.set(i,a)}}for(const[n,a]of t.exceptions){if(!i.has(n)){i.set(n,a)}}}register(t,n){const i=this.normalizeShapeId(t);for(const t of[this,TypeRegistry.for(i.split("#")[0])]){t.schemas.set(i,n)}}getSchema(t){const n=this.normalizeShapeId(t);if(!this.schemas.has(n)){if(!t.includes("#")){const n="#"+t;const i=[];for(const[t,a]of this.schemas.entries()){if(t.endsWith(n)){i.push(a)}}if(i.length===1){return i[0]}}throw new Error(`@smithy/core/schema - schema not found for ${n}`)}return this.schemas.get(n)}registerError(t,n){const i=t;const a=i[1];for(const t of[this,TypeRegistry.for(a)]){t.schemas.set(a+"#"+i[2],i);t.exceptions.set(i,n)}}getErrorCtor(t){const n=t;if(this.exceptions.has(n)){return this.exceptions.get(n)}const i=TypeRegistry.for(n[1]);return i.exceptions.get(n)}getBaseException(){for(const t of this.exceptions.keys()){if(Array.isArray(t)){const[,n,i]=t;const a=n+"#"+i;if(a.startsWith("smithy.ts.sdk.synthetic.")&&a.endsWith("ServiceException")){return t}}}return undefined}find(t){for(const n of this.schemas.values()){if(t(n)){return n}}return undefined}clear(){this.schemas.clear();this.exceptions.clear()}normalizeShapeId(t){if(t.includes("#")){return t}return this.namespace+"#"+t}}n.ErrorSchema=ErrorSchema;n.ListSchema=ListSchema;n.MapSchema=MapSchema;n.NormalizedSchema=NormalizedSchema;n.OperationSchema=OperationSchema;n.SCHEMA=m;n.Schema=Schema;n.SimpleSchema=SimpleSchema;n.StructureSchema=StructureSchema;n.TypeRegistry=TypeRegistry;n.deref=deref;n.deserializerMiddlewareOption=l;n.error=error;n.getSchemaSerdePlugin=getSchemaSerdePlugin;n.isStaticSchema=isStaticSchema;n.list=list;n.map=map;n.op=op;n.operation=operation;n.serializerMiddlewareOption=d;n.sim=sim;n.simAdapter=simAdapter;n.simpleSchemaCacheN=g;n.simpleSchemaCacheS=p;n.struct=struct;n.traitsCache=h;n.translateTraits=translateTraits},2430:(t,n,i)=>{const{createHmac:a,createHash:A,getRandomValues:c}=i(7598);const{ReadStream:l,lstatSync:d,fstatSync:h}=i(3024);const{HttpResponse:f}=i(4534);const{toEndpointV1:g}=i(2085);const{Duplex:p,Readable:m,Writable:E,PassThrough:C}=i(7075);const isArrayBuffer=t=>typeof ArrayBuffer==="function"&&t instanceof ArrayBuffer||Object.prototype.toString.call(t)==="[object ArrayBuffer]";const fromArrayBuffer=(t,n=0,i=t.byteLength-n)=>{if(!isArrayBuffer(t)){throw new TypeError(`The "input" argument must be ArrayBuffer. Received type ${typeof t} (${t})`)}return Buffer.from(t,n,i)};const fromString=(t,n)=>{if(typeof t!=="string"){throw new TypeError(`The "input" argument must be of type string. Received type ${typeof t} (${t})`)}return n?Buffer.from(t,n):Buffer.from(t)};const I=/^[A-Za-z0-9+/]*={0,2}$/;const fromBase64=t=>{if(t.length*3%4!==0){throw new TypeError(`Incorrect padding on base64 string.`)}if(!I.exec(t)){throw new TypeError(`Invalid base64 string.`)}const n=fromString(t,"base64");return new Uint8Array(n.buffer,n.byteOffset,n.byteLength)};const fromUtf8$1=t=>{const n=fromString(t,"utf8");return new Uint8Array(n.buffer,n.byteOffset,n.byteLength/Uint8Array.BYTES_PER_ELEMENT)};const toBase64$1=t=>{let n;if(typeof t==="string"){n=fromUtf8$1(t)}else{n=t}if(typeof n!=="object"||typeof n.byteOffset!=="number"||typeof n.byteLength!=="number"){throw new Error("@smithy/util-base64: toBase64 encoder function only accepts string | Uint8Array.")}return fromArrayBuffer(n.buffer,n.byteOffset,n.byteLength).toString("base64")};function bindUint8ArrayBlobAdapter(t,n,i,a){return class Uint8ArrayBlobAdapter extends Uint8Array{static fromString(t,i="utf-8"){if(typeof t==="string"){if(i==="base64"){return Uint8ArrayBlobAdapter.mutate(a(t))}return Uint8ArrayBlobAdapter.mutate(n(t))}throw new Error(`Unsupported conversion from ${typeof t} to Uint8ArrayBlobAdapter.`)}static mutate(t){Object.setPrototypeOf(t,Uint8ArrayBlobAdapter.prototype);return t}transformToString(n="utf-8"){if(n==="base64"){return i(this)}return t(this)}}}const toUtf8$1=t=>{if(typeof t==="string"){return t}if(typeof t!=="object"||typeof t.byteOffset!=="number"||typeof t.byteLength!=="number"){throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.")}return fromArrayBuffer(t.buffer,t.byteOffset,t.byteLength).toString("utf8")};const y=Array.from({length:256},(t,n)=>n.toString(16).padStart(2,"0"));function bindV4(t){if(typeof crypto!=="undefined"&&typeof crypto.randomUUID==="function"){return()=>crypto.randomUUID()}return()=>{const n=new Uint8Array(16);t(n);n[6]=n[6]&15|64;n[8]=n[8]&63|128;return y[n[0]]+y[n[1]]+y[n[2]]+y[n[3]]+"-"+y[n[4]]+y[n[5]]+"-"+y[n[6]]+y[n[7]]+"-"+y[n[8]]+y[n[9]]+"-"+y[n[10]]+y[n[11]]+y[n[12]]+y[n[13]]+y[n[14]]+y[n[15]]}}const copyDocumentWithTransform=(t,n,i=t=>t)=>t;const parseBoolean=t=>{switch(t){case"true":return true;case"false":return false;default:throw new Error(`Unable to parse boolean value "${t}"`)}};const expectBoolean=t=>{if(t===null||t===undefined){return undefined}if(typeof t==="number"){if(t===0||t===1){k.warn(stackTraceWarning(`Expected boolean, got ${typeof t}: ${t}`))}if(t===0){return false}if(t===1){return true}}if(typeof t==="string"){const n=t.toLowerCase();if(n==="false"||n==="true"){k.warn(stackTraceWarning(`Expected boolean, got ${typeof t}: ${t}`))}if(n==="false"){return false}if(n==="true"){return true}}if(typeof t==="boolean"){return t}throw new TypeError(`Expected boolean, got ${typeof t}: ${t}`)};const expectNumber=t=>{if(t===null||t===undefined){return undefined}if(typeof t==="string"){const n=parseFloat(t);if(!Number.isNaN(n)){if(String(n)!==String(t)){k.warn(stackTraceWarning(`Expected number but observed string: ${t}`))}return n}}if(typeof t==="number"){return t}throw new TypeError(`Expected number, got ${typeof t}: ${t}`)};const B=Math.ceil(2**127*(2-2**-23));const expectFloat32=t=>{const n=expectNumber(t);if(n!==undefined&&!Number.isNaN(n)&&n!==Infinity&&n!==-Infinity){if(Math.abs(n)>B){throw new TypeError(`Expected 32-bit float, got ${t}`)}}return n};const expectLong=t=>{if(t===null||t===undefined){return undefined}if(Number.isInteger(t)&&!Number.isNaN(t)){return t}throw new TypeError(`Expected integer, got ${typeof t}: ${t}`)};const Q=expectLong;const expectInt32=t=>expectSizedInt(t,32);const expectShort=t=>expectSizedInt(t,16);const expectByte=t=>expectSizedInt(t,8);const expectSizedInt=(t,n)=>{const i=expectLong(t);if(i!==undefined&&castInt(i,n)!==i){throw new TypeError(`Expected ${n}-bit integer, got ${t}`)}return i};const castInt=(t,n)=>{switch(n){case 32:return Int32Array.of(t)[0];case 16:return Int16Array.of(t)[0];case 8:return Int8Array.of(t)[0]}};const expectNonNull=(t,n)=>{if(t===null||t===undefined){if(n){throw new TypeError(`Expected a non-null value for ${n}`)}throw new TypeError("Expected a non-null value")}return t};const expectObject=t=>{if(t===null||t===undefined){return undefined}if(typeof t==="object"&&!Array.isArray(t)){return t}const n=Array.isArray(t)?"array":typeof t;throw new TypeError(`Expected object, got ${n}: ${t}`)};const expectString=t=>{if(t===null||t===undefined){return undefined}if(typeof t==="string"){return t}if(["boolean","number","bigint"].includes(typeof t)){k.warn(stackTraceWarning(`Expected string, got ${typeof t}: ${t}`));return String(t)}throw new TypeError(`Expected string, got ${typeof t}: ${t}`)};const expectUnion=t=>{if(t===null||t===undefined){return undefined}const n=expectObject(t);const i=[];for(const t in n){if(n[t]!=null){i.push(t)}}if(i.length===0){throw new TypeError(`Unions must have exactly one non-null member. None were found.`)}if(i.length>1){throw new TypeError(`Unions must have exactly one non-null member. Keys ${i} were not null.`)}return n};const strictParseDouble=t=>{if(typeof t=="string"){return expectNumber(parseNumber(t))}return expectNumber(t)};const w=strictParseDouble;const strictParseFloat32=t=>{if(typeof t=="string"){return expectFloat32(parseNumber(t))}return expectFloat32(t)};const S=/(-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?)|(-?Infinity)|(NaN)/g;const parseNumber=t=>{const n=t.match(S);if(n===null||n[0].length!==t.length){throw new TypeError(`Expected real number, got implicit NaN`)}return parseFloat(t)};const limitedParseDouble=t=>{if(typeof t=="string"){return parseFloatString(t)}return expectNumber(t)};const b=limitedParseDouble;const R=limitedParseDouble;const limitedParseFloat32=t=>{if(typeof t=="string"){return parseFloatString(t)}return expectFloat32(t)};const parseFloatString=t=>{switch(t){case"NaN":return NaN;case"Infinity":return Infinity;case"-Infinity":return-Infinity;default:throw new Error(`Unable to parse float value: ${t}`)}};const strictParseLong=t=>{if(typeof t==="string"){return expectLong(parseNumber(t))}return expectLong(t)};const v=strictParseLong;const strictParseInt32=t=>{if(typeof t==="string"){return expectInt32(parseNumber(t))}return expectInt32(t)};const strictParseShort=t=>{if(typeof t==="string"){return expectShort(parseNumber(t))}return expectShort(t)};const strictParseByte=t=>{if(typeof t==="string"){return expectByte(parseNumber(t))}return expectByte(t)};const stackTraceWarning=t=>String(new TypeError(t).stack||t).split("\n").slice(0,5).filter(t=>!t.includes("stackTraceWarning")).join("\n");const k={warn:console.warn};const D=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];const T=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function dateToUtcString(t){const n=t.getUTCFullYear();const i=t.getUTCMonth();const a=t.getUTCDay();const A=t.getUTCDate();const c=t.getUTCHours();const l=t.getUTCMinutes();const d=t.getUTCSeconds();const h=A<10?`0${A}`:`${A}`;const f=c<10?`0${c}`:`${c}`;const g=l<10?`0${l}`:`${l}`;const p=d<10?`0${d}`:`${d}`;return`${D[a]}, ${h} ${T[i]} ${n} ${f}:${g}:${p} GMT`}const N=new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?[zZ]$/);const parseRfc3339DateTime=t=>{if(t===null||t===undefined){return undefined}if(typeof t!=="string"){throw new TypeError("RFC-3339 date-times must be expressed as strings")}const n=N.exec(t);if(!n){throw new TypeError("Invalid RFC-3339 date-time value")}const[i,a,A,c,l,d,h,f]=n;const g=strictParseShort(stripLeadingZeroes(a));const p=parseDateValue(A,"month",1,12);const m=parseDateValue(c,"day",1,31);return buildDate(g,p,m,{hours:l,minutes:d,seconds:h,fractionalMilliseconds:f})};const M=new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(([-+]\d{2}\:\d{2})|[zZ])$/);const parseRfc3339DateTimeWithOffset=t=>{if(t===null||t===undefined){return undefined}if(typeof t!=="string"){throw new TypeError("RFC-3339 date-times must be expressed as strings")}const n=M.exec(t);if(!n){throw new TypeError("Invalid RFC-3339 date-time value")}const[i,a,A,c,l,d,h,f,g]=n;const p=strictParseShort(stripLeadingZeroes(a));const m=parseDateValue(A,"month",1,12);const E=parseDateValue(c,"day",1,31);const C=buildDate(p,m,E,{hours:l,minutes:d,seconds:h,fractionalMilliseconds:f});if(g.toUpperCase()!="Z"){C.setTime(C.getTime()-parseOffsetToMilliseconds(g))}return C};const F=new RegExp(/^(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d{2}) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? GMT$/);const x=new RegExp(/^(?:Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d{2})-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d{2}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? GMT$/);const U=new RegExp(/^(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( [1-9]|\d{2}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? (\d{4})$/);const parseRfc7231DateTime=t=>{if(t===null||t===undefined){return undefined}if(typeof t!=="string"){throw new TypeError("RFC-7231 date-times must be expressed as strings")}let n=F.exec(t);if(n){const[t,i,a,A,c,l,d,h]=n;return buildDate(strictParseShort(stripLeadingZeroes(A)),parseMonthByShortName(a),parseDateValue(i,"day",1,31),{hours:c,minutes:l,seconds:d,fractionalMilliseconds:h})}n=x.exec(t);if(n){const[t,i,a,A,c,l,d,h]=n;return adjustRfc850Year(buildDate(parseTwoDigitYear(A),parseMonthByShortName(a),parseDateValue(i,"day",1,31),{hours:c,minutes:l,seconds:d,fractionalMilliseconds:h}))}n=U.exec(t);if(n){const[t,i,a,A,c,l,d,h]=n;return buildDate(strictParseShort(stripLeadingZeroes(h)),parseMonthByShortName(i),parseDateValue(a.trimLeft(),"day",1,31),{hours:A,minutes:c,seconds:l,fractionalMilliseconds:d})}throw new TypeError("Invalid RFC-7231 date-time value")};const parseEpochTimestamp=t=>{if(t===null||t===undefined){return undefined}let n;if(typeof t==="number"){n=t}else if(typeof t==="string"){n=strictParseDouble(t)}else if(typeof t==="object"&&t.tag===1){n=t.value}else{throw new TypeError("Epoch timestamps must be expressed as floating point numbers or their string representation")}if(Number.isNaN(n)||n===Infinity||n===-Infinity){throw new TypeError("Epoch timestamps must be valid, non-Infinite, non-NaN numerics")}return new Date(Math.round(n*1e3))};const buildDate=(t,n,i,a)=>{const A=n-1;validateDayOfMonth(t,A,i);return new Date(Date.UTC(t,A,i,parseDateValue(a.hours,"hour",0,23),parseDateValue(a.minutes,"minute",0,59),parseDateValue(a.seconds,"seconds",0,60),parseMilliseconds(a.fractionalMilliseconds)))};const parseTwoDigitYear=t=>{const n=(new Date).getUTCFullYear();const i=Math.floor(n/100)*100+strictParseShort(stripLeadingZeroes(t));if(i{if(t.getTime()-(new Date).getTime()>P){return new Date(Date.UTC(t.getUTCFullYear()-100,t.getUTCMonth(),t.getUTCDate(),t.getUTCHours(),t.getUTCMinutes(),t.getUTCSeconds(),t.getUTCMilliseconds()))}return t};const parseMonthByShortName=t=>{const n=T.indexOf(t);if(n<0){throw new TypeError(`Invalid month: ${t}`)}return n+1};const L=[31,28,31,30,31,30,31,31,30,31,30,31];const validateDayOfMonth=(t,n,i)=>{let a=L[n];if(n===1&&isLeapYear(t)){a=29}if(i>a){throw new TypeError(`Invalid day for ${T[n]} in ${t}: ${i}`)}};const isLeapYear=t=>t%4===0&&(t%100!==0||t%400===0);const parseDateValue=(t,n,i,a)=>{const A=strictParseByte(stripLeadingZeroes(t));if(Aa){throw new TypeError(`${n} must be between ${i} and ${a}, inclusive`)}return A};const parseMilliseconds=t=>{if(t===null||t===undefined){return 0}return strictParseFloat32("0."+t)*1e3};const parseOffsetToMilliseconds=t=>{const n=t[0];let i=1;if(n=="+"){i=1}else if(n=="-"){i=-1}else{throw new TypeError(`Offset direction, ${n}, must be "+" or "-"`)}const a=Number(t.substring(1,3));const A=Number(t.substring(4,6));return i*(a*60+A)*60*1e3};const stripLeadingZeroes=t=>{let n=0;while(n{if(t&&typeof t==="object"&&(t instanceof O||"deserializeJSON"in t)){return t}else if(typeof t==="string"||Object.getPrototypeOf(t)===String.prototype){return O(String(t))}return O(JSON.stringify(t))};O.fromObject=O.from;function quoteHeader(t){if(t.includes(",")||t.includes('"')){t=`"${t.replace(/"/g,'\\"')}"`}return t}const H=`(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun)(?:[ne|u?r]?s?day)?`;const $=`(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)`;const G=`(\\d?\\d):(\\d{2}):(\\d{2})(?:\\.(\\d+))?`;const V=`(\\d?\\d)`;const Y=`(\\d{4})`;const J=new RegExp(/^(\d{4})-(\d\d)-(\d\d)[tT](\d\d):(\d\d):(\d\d)(\.(\d+))?(([-+]\d\d:\d\d)|[zZ])$/);const W=new RegExp(`^${H}, ${V} ${$} ${Y} ${G} GMT$`);const q=new RegExp(`^${H}, ${V}-${$}-(\\d\\d) ${G} GMT$`);const j=new RegExp(`^${H} ${$} ( [1-9]|\\d\\d) ${G} ${Y}$`);const z=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];const _parseEpochTimestamp=t=>{if(t==null){return void 0}let n=NaN;if(typeof t==="number"){n=t}else if(typeof t==="string"){if(!/^-?\d*\.?\d+$/.test(t)){throw new TypeError(`parseEpochTimestamp - numeric string invalid.`)}n=Number.parseFloat(t)}else if(typeof t==="object"&&t.tag===1){n=t.value}if(isNaN(n)||Math.abs(n)===Infinity){throw new TypeError("Epoch timestamps must be valid finite numbers.")}return new Date(Math.round(n*1e3))};const _parseRfc3339DateTimeWithOffset=t=>{if(t==null){return void 0}if(typeof t!=="string"){throw new TypeError("RFC3339 timestamps must be strings")}const n=J.exec(t);if(!n){throw new TypeError(`Invalid RFC3339 timestamp format ${t}`)}const[,i,a,A,c,l,d,,h,f]=n;range(a,1,12);range(A,1,31);range(c,0,23);range(l,0,59);range(d,0,60);const g=new Date(Date.UTC(Number(i),Number(a)-1,Number(A),Number(c),Number(l),Number(d),Number(h)?Math.round(parseFloat(`0.${h}`)*1e3):0));g.setUTCFullYear(Number(i));if(f.toUpperCase()!="Z"){const[,t,n,i]=/([+-])(\d\d):(\d\d)/.exec(f)||[void 0,"+",0,0];const a=t==="-"?1:-1;g.setTime(g.getTime()+a*(Number(n)*60*60*1e3+Number(i)*60*1e3))}return g};const _parseRfc7231DateTime=t=>{if(t==null){return void 0}if(typeof t!=="string"){throw new TypeError("RFC7231 timestamps must be strings.")}let n;let i;let a;let A;let c;let l;let d;let h;if(h=W.exec(t)){[,n,i,a,A,c,l,d]=h}else if(h=q.exec(t)){[,n,i,a,A,c,l,d]=h;a=(Number(a)+1900).toString()}else if(h=j.exec(t)){[,i,n,A,c,l,d,a]=h}if(a&&l){const t=Date.UTC(Number(a),z.indexOf(i),Number(n),Number(A),Number(c),Number(l),d?Math.round(parseFloat(`0.${d}`)*1e3):0);range(n,1,31);range(A,0,23);range(c,0,59);range(l,0,60);const h=new Date(t);h.setUTCFullYear(Number(a));return h}throw new TypeError(`Invalid RFC7231 date-time value ${t}.`)};function range(t,n,i){const a=Number(t);if(ai){throw new Error(`Value ${a} out of range [${n}, ${i}]`)}}function splitEvery(t,n,i){if(i<=0||!Number.isInteger(i)){throw new Error("Invalid number of delimiters ("+i+") for splitEvery.")}const a=t.split(n);if(i===1){return a}const A=[];let c="";for(let t=0;t{const n=t.length;const i=[];let a=false;let A=undefined;let c=0;for(let l=0;l{t=t.trim();const n=t.length;if(n<2){return t}if(t[0]===`"`&&t[n-1]===`"`){t=t.slice(1,n-1)}return t.replace(/\\"/g,'"')})};const K=/^-?\d*(\.\d+)?$/;class NumericValue{string;type;constructor(t,n){this.string=t;this.type=n;if(!K.test(t)){throw new Error(`@smithy/core/serde - NumericValue must only contain [0-9], at most one decimal point ".", and an optional negation prefix "-".`)}}toString(){return this.string}static[Symbol.hasInstance](t){if(!t||typeof t!=="object"){return false}const n=t;return NumericValue.prototype.isPrototypeOf(t)||n.type==="bigDecimal"&&K.test(n.string)}}function nv(t){return new NumericValue(String(t),"bigDecimal")}const Z={};const X={};for(let t=0;t<256;t++){let n=t.toString(16).toLowerCase();if(n.length===1){n=`0${n}`}Z[t]=n;X[n]=t}function fromHex(t){if(t.length%2!==0){throw new Error("Hex encoded strings must have an even number length")}const n=new Uint8Array(t.length/2);for(let i=0;i{if(!t){return 0}if(typeof t==="string"){return Buffer.byteLength(t)}else if(typeof t.byteLength==="number"){return t.byteLength}else if(typeof t.size==="number"){return t.size}else if(typeof t.start==="number"&&typeof t.end==="number"){return t.end+1-t.start}else if(t instanceof l){if(t.path!=null){return d(t.path).size}else if(typeof t.fd==="number"){return h(t.fd).size}}throw new Error(`Body Length computation failed for ${t}`)};const toUint8Array=t=>{if(t instanceof Uint8Array){return t}if(typeof t==="string"){return fromUtf8$1(t)}if(ArrayBuffer.isView(t)){return new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT)}return new Uint8Array(t)};function concatBytes(t,n){if(n===undefined){n=0;for(const i of t){n+=i.byteLength}}const i=new Uint8Array(n);let a=0;for(const n of t){i.set(n,a);a+=n.byteLength}return i}const deserializerMiddleware=(t,n)=>(i,a)=>async A=>{const{response:c}=await i(A);try{const i=await n(c,t);return{response:c,output:i}}catch(t){Object.defineProperty(t,"$response",{value:c,enumerable:false,writable:false,configurable:false});if(!("$metadata"in t)){const n=`Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.`;try{t.message+="\n "+n}catch(t){if(!a.logger||a.logger?.constructor?.name==="NoOpLogger"){console.warn(n)}else{a.logger?.warn?.(n)}}if(typeof t.$responseBodyText!=="undefined"){if(t.$response){t.$response.body=t.$responseBodyText}}try{if(f.isInstance(c)){const{headers:n={}}=c;const i=Object.entries(n);t.$metadata={httpStatusCode:c.statusCode,requestId:findHeader(/^x-[\w-]+-request-?id$/,i),extendedRequestId:findHeader(/^x-[\w-]+-id-2$/,i),cfId:findHeader(/^x-[\w-]+-cf-id$/,i)}}}catch(t){}}throw t}};const findHeader=(t,n)=>(n.find(([n])=>n.match(t))||[void 0,void 0])[1];const serializerMiddleware=(t,n)=>(i,a)=>async A=>{const c=t;const l=a.endpointV2?async()=>g(a.endpointV2):c.endpoint;if(!l){throw new Error("No valid endpoint provider available.")}const d=await n(A.input,{...t,endpoint:l});return i({...A,request:d})};const ee={name:"deserializerMiddleware",step:"deserialize",tags:["DESERIALIZER"],override:true};const te={name:"serializerMiddleware",step:"serialize",tags:["SERIALIZER"],override:true};function getSerdePlugin(t,n,i){return{applyToStack:a=>{a.add(deserializerMiddleware(t,i),ee);a.add(serializerMiddleware(t,n),te)}}}class Hash{algorithmIdentifier;secret;hash;constructor(t,n){this.algorithmIdentifier=t;this.secret=n;this.reset()}update(t,n){this.hash.update(toUint8Array(castSourceData(t,n)))}digest(){return Promise.resolve(this.hash.digest())}reset(){this.hash=this.secret?a(this.algorithmIdentifier,castSourceData(this.secret)):A(this.algorithmIdentifier)}}function castSourceData(t,n){if(Buffer.isBuffer(t)){return t}if(typeof t==="string"){return fromString(t,n)}if(ArrayBuffer.isView(t)){return fromArrayBuffer(t.buffer,t.byteOffset,t.byteLength)}return fromArrayBuffer(t)}let re=class ChecksumStream extends p{expectedChecksum;checksumSourceLocation;checksum;source;base64Encoder;pendingCallback=null;constructor({expectedChecksum:t,checksum:n,source:i,checksumSourceLocation:a,base64Encoder:A}){super();if(typeof i.pipe==="function"){this.source=i}else{throw new Error(`@smithy/util-stream: unsupported source type ${i?.constructor?.name??i} in ChecksumStream.`)}this.base64Encoder=A??toBase64$1;this.expectedChecksum=t;this.checksum=n;this.checksumSourceLocation=a;this.source.pipe(this)}_read(t){if(this.pendingCallback){const t=this.pendingCallback;this.pendingCallback=null;t()}}_write(t,n,i){try{this.checksum.update(t);const n=this.push(t);if(!n){this.pendingCallback=i;return}}catch(t){return i(t)}return i()}async _final(t){try{const n=await this.checksum.digest();const i=this.base64Encoder(n);if(this.expectedChecksum!==i){return t(new Error(`Checksum mismatch: expected "${this.expectedChecksum}" but received "${i}"`+` in response header "${this.checksumSourceLocation}".`))}}catch(n){return t(n)}this.push(null);return t()}_destroy(t,n){this.source?.destroy();n(t)}};const isReadableStream=t=>typeof ReadableStream==="function"&&(t?.constructor?.name===ReadableStream.name||t instanceof ReadableStream);const isBlob=t=>typeof Blob==="function"&&(t?.constructor?.name===Blob.name||t instanceof Blob);const fromUtf8=t=>(new TextEncoder).encode(t);const ne=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`;Object.entries(ne).reduce((t,[n,i])=>{t[i]=Number(n);return t},{});const se=ne.split("");const oe=6;const ie=8;const ae=63;function toBase64(t){let n;if(typeof t==="string"){n=fromUtf8(t)}else{n=t}const i=typeof n==="object"&&typeof n.length==="number";const a=typeof n==="object"&&typeof n.byteOffset==="number"&&typeof n.byteLength==="number";if(!i&&!a){throw new Error("@smithy/util-base64: toBase64 encoder function only accepts string | Uint8Array.")}let A="";for(let t=0;t>n]}A+="==".slice(0,4-c)}return A}const Ae=typeof ReadableStream==="function"?ReadableStream:function(){};class ChecksumStream extends Ae{}const createChecksumStream$1=({expectedChecksum:t,checksum:n,source:i,checksumSourceLocation:a,base64Encoder:A})=>{if(!isReadableStream(i)){throw new Error(`@smithy/util-stream: unsupported source type ${i?.constructor?.name??i} in ChecksumStream.`)}const c=A??toBase64;if(typeof TransformStream!=="function"){throw new Error("@smithy/util-stream: unable to instantiate ChecksumStream because API unavailable: ReadableStream/TransformStream.")}const l=new TransformStream({start(){},async transform(t,i){n.update(t);i.enqueue(t)},async flush(i){const A=await n.digest();const l=c(A);if(t!==l){const n=new Error(`Checksum mismatch: expected "${t}" but received "${l}"`+` in response header "${a}".`);i.error(n)}else{i.terminate()}}});i.pipeThrough(l);const d=l.readable;Object.setPrototypeOf(d,ChecksumStream.prototype);return d};function createChecksumStream(t){if(typeof ReadableStream==="function"&&isReadableStream(t.source)){return createChecksumStream$1(t)}return new re(t)}class ByteArrayCollector{allocByteArray;byteLength=0;byteArrays=[];constructor(t){this.allocByteArray=t}push(t){this.byteArrays.push(t);this.byteLength+=t.byteLength}flush(){if(this.byteArrays.length===1){const t=this.byteArrays[0];this.reset();return t}const t=this.allocByteArray(this.byteLength);let n=0;for(let i=0;inew Uint8Array(t))];let d=-1;const pull=async t=>{const{value:h,done:f}=await a.read();const g=h;if(f){if(d!==-1){const n=flush(l,d);if(sizeOf(n)>0){t.enqueue(n)}}t.close()}else{const a=modeOf(g,false);if(d!==a){if(d>=0){t.enqueue(flush(l,d))}d=a}if(d===-1){t.enqueue(g);return}const h=sizeOf(g);c+=h;const f=sizeOf(l[d]);if(h>=n&&f===0){t.enqueue(g)}else{const a=merge(l,d,g);if(!A&&c>n*2){A=true;i?.warn(`@smithy/util-stream - stream chunk size ${h} is below threshold of ${n}, automatically buffering.`)}if(a>=n){t.enqueue(flush(l,d))}else{await pull(t)}}}};return new ReadableStream({pull:pull})}function merge(t,n,i){switch(n){case 0:t[0]+=i;return sizeOf(t[0]);case 1:case 2:t[n].push(i);return sizeOf(t[n])}}function flush(t,n){switch(n){case 0:const i=t[0];t[0]="";return i;case 1:case 2:return t[n].flush()}throw new Error(`@smithy/util-stream - invalid index ${n} given to flush()`)}function sizeOf(t){return t?.byteLength??t?.length??0}function modeOf(t,n=true){if(n&&typeof Buffer!=="undefined"&&t instanceof Buffer){return 2}if(t instanceof Uint8Array){return 1}if(typeof t==="string"){return 0}return-1}function createBufferedReadable(t,n,i){if(isReadableStream(t)){return createBufferedReadableStream(t,n,i)}const a=new m({read(){}});let A=false;let c=0;const l=["",new ByteArrayCollector(t=>new Uint8Array(t)),new ByteArrayCollector(t=>Buffer.from(new Uint8Array(t)))];let d=-1;t.on("data",t=>{const h=modeOf(t,true);if(d!==h){if(d>=0){a.push(flush(l,d))}d=h}if(d===-1){a.push(t);return}const f=sizeOf(t);c+=f;const g=sizeOf(l[d]);if(f>=n&&g===0){a.push(t)}else{const h=merge(l,d,t);if(!A&&c>n*2){A=true;i?.warn(`@smithy/util-stream - stream chunk size ${f} is below threshold of ${n}, automatically buffering.`)}if(h>=n){a.push(flush(l,d))}}});t.on("end",()=>{if(d!==-1){const t=flush(l,d);if(sizeOf(t)>0){a.push(t)}}a.push(null)});return a}const getAwsChunkedEncodingStream$1=(t,n)=>{const{base64Encoder:i,bodyLengthChecker:a,checksumAlgorithmFn:A,checksumLocationName:c,streamHasher:l}=n;const d=i!==undefined&&a!==undefined&&A!==undefined&&c!==undefined&&l!==undefined;const h=d?l(A,t):undefined;const f=t.getReader();return new ReadableStream({async pull(t){const{value:n,done:A}=await f.read();if(A){t.enqueue(`0\r\n`);if(d){const n=i(await h);t.enqueue(`${c}:${n}\r\n`);t.enqueue(`\r\n`)}t.close()}else{t.enqueue(`${(a(n)||0).toString(16)}\r\n${n}\r\n`)}}})};function getAwsChunkedEncodingStream(t,n){const i=t;const a=t;if(isReadableStream(a)){return getAwsChunkedEncodingStream$1(a,n)}const{base64Encoder:A,bodyLengthChecker:c,checksumAlgorithmFn:l,checksumLocationName:d,streamHasher:h}=n;const f=A!==undefined&&l!==undefined&&d!==undefined&&h!==undefined;const g=f?h(l,i):undefined;const p=new m({read:()=>{}});i.on("data",t=>{const n=c(t)||0;if(n===0){return}p.push(`${n.toString(16)}\r\n`);p.push(t);p.push("\r\n")});i.on("end",async()=>{p.push(`0\r\n`);if(f){const t=A(await g);p.push(`${d}:${t}\r\n`);p.push(`\r\n`)}p.push(null)});return p}async function headStream$1(t,n){let i=0;const a=[];const A=t.getReader();let c=false;while(!c){const{done:t,value:l}=await A.read();if(l){a.push(l);i+=l?.byteLength??0}if(i>=n){break}c=t}A.releaseLock();const l=new Uint8Array(Math.min(n,i));let d=0;for(const t of a){if(t.byteLength>l.byteLength-d){l.set(t.subarray(0,l.byteLength-d),d);break}else{l.set(t,d)}d+=t.length}return l}const headStream=(t,n)=>{if(isReadableStream(t)){return headStream$1(t,n)}return new Promise((i,a)=>{const A=new ce;A.limit=n;t.pipe(A);t.on("error",t=>{A.end();a(t)});A.on("error",a);A.on("finish",function(){const t=concatBytes(this.buffers);i(t)})})};let ce=class Collector extends E{buffers=[];limit=Infinity;bytesBuffered=0;_write(t,n,i){this.buffers.push(t);this.bytesBuffered+=t.byteLength??0;if(this.bytesBuffered>=this.limit){const t=this.bytesBuffered-this.limit;const n=this.buffers[this.buffers.length-1];this.buffers[this.buffers.length-1]=n.subarray(0,n.byteLength-t);this.emit("finish")}i()}};const toUtf8=t=>{if(typeof t==="string"){return t}if(typeof t!=="object"||typeof t.byteOffset!=="number"||typeof t.byteLength!=="number"){throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.")}return new TextDecoder("utf-8").decode(t)};const streamCollector$1=async t=>{if(isBlob(t)){return collectBlob(t)}return collectReadableStream(t)};async function collectBlob(t){return t.arrayBuffer().then(t=>new Uint8Array(t))}async function collectReadableStream(t){const n=[];const i=t.getReader();let a=0;while(true){const{done:t,value:A}=await i.read();if(A){n.push(A);a+=A.length}if(t){break}}return concatBytes(n,a)}const le="The stream has already been transformed.";const sdkStreamMixin$1=t=>{if(!isBlobInstance(t)&&!isReadableStream(t)){const n=t?.__proto__?.constructor?.name||t;throw new Error(`Unexpected stream implementation, expect Blob or ReadableStream, got ${n}`)}let n=false;const transformToByteArray=async()=>{if(n){throw new Error(le)}n=true;return await streamCollector$1(t)};const blobToWebStream=t=>{if(typeof t.stream!=="function"){throw new Error("Cannot transform payload Blob to web stream. Please make sure the Blob.stream() is polyfilled.\n"+"If you are using React Native, this API is not yet supported, see: https://react-native.canny.io/feature-requests/p/fetch-streaming-body")}return t.stream()};return Object.assign(t,{transformToByteArray:transformToByteArray,transformToString:async t=>{const n=await transformToByteArray();if(t==="base64"){return toBase64(n)}else if(t==="hex"){return toHex(n)}else if(t===undefined||t==="utf8"||t==="utf-8"){return toUtf8(n)}else if(typeof TextDecoder==="function"){return new TextDecoder(t).decode(n)}else{throw new Error("TextDecoder is not available, please make sure polyfill is provided.")}},transformToWebStream:()=>{if(n){throw new Error(le)}n=true;if(isBlobInstance(t)){return blobToWebStream(t)}else if(isReadableStream(t)){return t}else{throw new Error(`Cannot transform payload to web stream, got ${t}`)}}})};const isBlobInstance=t=>typeof Blob==="function"&&t instanceof Blob;const streamCollector=t=>{if(isBlob(t)){return collectBlob(t)}if(isReadableStream(t)){return collectReadableStream(t)}return new Promise((n,i)=>{const a=new Collector;const A=t;A.pipe(a);A.on("error",t=>{a.end();i(t)});a.on("error",i);a.on("finish",function(){const t=concatBytes(this.bufferedBytes);n(t)})})};class Collector extends E{bufferedBytes=[];_write(t,n,i){this.bufferedBytes.push(t);i()}}const ue="The stream has already been transformed.";const sdkStreamMixin=t=>{if(!(t instanceof m)){try{return sdkStreamMixin$1(t)}catch(n){const i=t?.__proto__?.constructor?.name||t;throw new Error(`Unexpected stream implementation, expect Stream.Readable instance, got ${i}`)}}let n=false;const transformToByteArray=async()=>{if(n){throw new Error(ue)}n=true;return await streamCollector(t)};return Object.assign(t,{transformToByteArray:transformToByteArray,transformToString:async t=>{const n=await transformToByteArray();if(t===undefined||Buffer.isEncoding(t)){return fromArrayBuffer(n.buffer,n.byteOffset,n.byteLength).toString(t)}else{const i=new TextDecoder(t);return i.decode(n)}},transformToWebStream:()=>{if(n){throw new Error(ue)}if(t.readableFlowing!==null){throw new Error("The stream has been consumed by other callbacks.")}if(typeof m.toWeb!=="function"){throw new Error("Readable.toWeb() is not supported. Please ensure a polyfill is available.")}n=true;return m.toWeb(t)}})};async function splitStream$1(t){if(typeof t.stream==="function"){t=t.stream()}const n=t;return n.tee()}async function splitStream(t){if(isReadableStream(t)||isBlob(t)){return splitStream$1(t)}const n=new C;const i=new C;t.pipe(n);t.pipe(i);return[n,i]}class Uint8ArrayBlobAdapter extends(bindUint8ArrayBlobAdapter(toUtf8$1,fromUtf8$1,toBase64$1,fromBase64)){}const de=c;const he=bindV4(de);const fe=he;n.ChecksumStream=re;n.Hash=Hash;n.LazyJsonString=O;n.NumericValue=NumericValue;n.Uint8ArrayBlobAdapter=Uint8ArrayBlobAdapter;n._parseEpochTimestamp=_parseEpochTimestamp;n._parseRfc3339DateTimeWithOffset=_parseRfc3339DateTimeWithOffset;n._parseRfc7231DateTime=_parseRfc7231DateTime;n.calculateBodyLength=calculateBodyLength;n.concatBytes=concatBytes;n.copyDocumentWithTransform=copyDocumentWithTransform;n.createBufferedReadable=createBufferedReadable;n.createChecksumStream=createChecksumStream;n.dateToUtcString=dateToUtcString;n.deserializerMiddleware=deserializerMiddleware;n.deserializerMiddlewareOption=ee;n.expectBoolean=expectBoolean;n.expectByte=expectByte;n.expectFloat32=expectFloat32;n.expectInt=Q;n.expectInt32=expectInt32;n.expectLong=expectLong;n.expectNonNull=expectNonNull;n.expectNumber=expectNumber;n.expectObject=expectObject;n.expectShort=expectShort;n.expectString=expectString;n.expectUnion=expectUnion;n.fromArrayBuffer=fromArrayBuffer;n.fromBase64=fromBase64;n.fromHex=fromHex;n.fromString=fromString;n.fromUtf8=fromUtf8$1;n.generateIdempotencyToken=fe;n.getAwsChunkedEncodingStream=getAwsChunkedEncodingStream;n.getSerdePlugin=getSerdePlugin;n.handleFloat=b;n.headStream=headStream;n.isArrayBuffer=isArrayBuffer;n.isBlob=isBlob;n.isReadableStream=isReadableStream;n.limitedParseDouble=limitedParseDouble;n.limitedParseFloat=R;n.limitedParseFloat32=limitedParseFloat32;n.logger=k;n.nv=nv;n.parseBoolean=parseBoolean;n.parseEpochTimestamp=parseEpochTimestamp;n.parseRfc3339DateTime=parseRfc3339DateTime;n.parseRfc3339DateTimeWithOffset=parseRfc3339DateTimeWithOffset;n.parseRfc7231DateTime=parseRfc7231DateTime;n.quoteHeader=quoteHeader;n.sdkStreamMixin=sdkStreamMixin;n.serializerMiddleware=serializerMiddleware;n.serializerMiddlewareOption=te;n.splitEvery=splitEvery;n.splitHeader=splitHeader;n.splitStream=splitStream;n.streamCollector=streamCollector;n.strictParseByte=strictParseByte;n.strictParseDouble=strictParseDouble;n.strictParseFloat=w;n.strictParseFloat32=strictParseFloat32;n.strictParseInt=v;n.strictParseInt32=strictParseInt32;n.strictParseLong=strictParseLong;n.strictParseShort=strictParseShort;n.toBase64=toBase64$1;n.toHex=toHex;n.toUint8Array=toUint8Array;n.toUtf8=toUtf8$1;n.v4=he},4534:(t,n,i)=>{const{SMITHY_CONTEXT_KEY:a}=i(690);const getSmithyContext=t=>t[a]||(t[a]={});class HttpRequest{method;protocol;hostname;port;path;query;headers;username;password;fragment;body;constructor(t){this.method=t.method||"GET";this.hostname=t.hostname||"localhost";this.port=t.port;this.query=t.query||{};this.headers=t.headers||{};this.body=t.body;this.protocol=t.protocol?t.protocol.slice(-1)!==":"?`${t.protocol}:`:t.protocol:"https:";this.path=t.path?t.path.charAt(0)!=="/"?`/${t.path}`:t.path:"/";this.username=t.username;this.password=t.password;this.fragment=t.fragment}static clone(t){const n=new HttpRequest({...t,headers:{...t.headers}});if(n.query){n.query=cloneQuery(n.query)}return n}static isInstance(t){if(!t){return false}const n=t;return"method"in n&&"protocol"in n&&"hostname"in n&&"path"in n&&typeof n["query"]==="object"&&typeof n["headers"]==="object"}clone(){return HttpRequest.clone(this)}}function cloneQuery(t){return Object.keys(t).reduce((n,i)=>{const a=t[i];return{...n,[i]:Array.isArray(a)?[...a]:a}},{})}class HttpResponse{statusCode;reason;headers;body;constructor(t){this.statusCode=t.statusCode;this.reason=t.reason;this.headers=t.headers||{};this.body=t.body}static isInstance(t){if(!t)return false;const n=t;return typeof n.statusCode==="number"&&typeof n.headers==="object"}}const A=new RegExp(`^(?!.*-$)(?!-)[a-zA-Z0-9-]{1,63}$`);const isValidHostLabel=(t,n=false)=>{if(!n){return A.test(t)}const i=t.split(".");for(const t of i){if(!isValidHostLabel(t)){return false}}return true};function isValidHostname(t){const n=/^[a-z0-9][a-z0-9\.\-]*[a-z0-9]$/;return n.test(t)}const normalizeProvider=t=>{if(typeof t==="function")return t;const n=Promise.resolve(t);return()=>n};function parseQueryString(t){const n={};t=t.replace(/^\?/,"");if(t){for(const i of t.split("&")){let[t,a=null]=i.split("=");t=decodeURIComponent(t);if(a){a=decodeURIComponent(a)}if(!(t in n)){n[t]=a}else if(Array.isArray(n[t])){n[t].push(a)}else{n[t]=[n[t],a]}}}return n}const parseUrl=t=>{if(typeof t==="string"){return parseUrl(new URL(t))}const{hostname:n,pathname:i,port:a,protocol:A,search:c}=t;let l;if(c){l=parseQueryString(c)}return{hostname:n,port:a?parseInt(a):undefined,protocol:A,path:i,query:l}};const toEndpointV1=t=>{if(typeof t==="object"){if("url"in t){const n=parseUrl(t.url);if(t.headers){n.headers={};for(const i in t.headers){n.headers[i.toLowerCase()]=t.headers[i].join(", ")}}return n}return t}return parseUrl(t)};n.HttpRequest=HttpRequest;n.HttpResponse=HttpResponse;n.getSmithyContext=getSmithyContext;n.isValidHostLabel=isValidHostLabel;n.isValidHostname=isValidHostname;n.normalizeProvider=normalizeProvider;n.parseQueryString=parseQueryString;n.parseUrl=parseUrl;n.toEndpointV1=toEndpointV1},566:(t,n,i)=>{const{ProviderError:a,CredentialsProviderError:A,loadConfig:c}=i(7291);const l=i(7067);const{parseUrl:d}=i(3422);const isImdsCredentials=t=>Boolean(t)&&typeof t==="object"&&typeof t.AccessKeyId==="string"&&typeof t.SecretAccessKey==="string"&&typeof t.Token==="string"&&typeof t.Expiration==="string";const fromImdsCredentials=t=>({accessKeyId:t.AccessKeyId,secretAccessKey:t.SecretAccessKey,sessionToken:t.Token,expiration:new Date(t.Expiration),...t.AccountId&&{accountId:t.AccountId}});const h=1e3;const f=0;const providerConfigFromInit=({maxRetries:t=f,timeout:n=h})=>({maxRetries:t,timeout:n});function httpRequest(t){return new Promise((n,i)=>{const A=l.request({method:"GET",...t,hostname:t.hostname?.replace(/^\[(.+)\]$/,"$1")});A.on("error",t=>{i(Object.assign(new a("Unable to connect to instance metadata service"),t));A.destroy()});A.on("timeout",()=>{i(new a("TimeoutError from instance metadata service"));A.destroy()});A.on("response",t=>{const{statusCode:c=400}=t;if(c<200||300<=c){i(Object.assign(new a("Error response received from instance metadata service"),{statusCode:c}));A.destroy()}const l=[];t.on("data",t=>{l.push(t)});t.on("end",()=>{n(Buffer.concat(l));A.destroy()})});A.end()})}const retry=(t,n)=>{let i=t();for(let a=0;a{const{timeout:n,maxRetries:i}=providerConfigFromInit(t);return()=>retry(async()=>{const i=await getCmdsUri({logger:t.logger});const a=JSON.parse(await requestFromEcsImds(n,i));if(!isImdsCredentials(a)){throw new A("Invalid response received from instance metadata service.",{logger:t.logger})}return fromImdsCredentials(a)},i)};const requestFromEcsImds=async(t,n)=>{if(process.env[m]){n.headers={...n.headers,Authorization:process.env[m]}}const i=await httpRequest({...n,timeout:t});return i.toString()};const E="169.254.170.2";const C=new Set(["localhost","127.0.0.1"]);const I=new Set(["http:","https:"]);const getCmdsUri=async({logger:t})=>{if(process.env[p]){return{hostname:E,path:process.env[p]}}if(process.env[g]){let n;try{n=new URL(process.env[g])}catch{throw new A(`${process.env[g]} is not a valid container metadata service URL`,{tryNextLink:false,logger:t})}if(!n.hostname||!C.has(n.hostname)){throw new A(`${n.hostname} is not a valid container metadata service hostname`,{tryNextLink:false,logger:t})}if(!n.protocol||!I.has(n.protocol)){throw new A(`${n.protocol} is not a valid container metadata service protocol`,{tryNextLink:false,logger:t})}return{protocol:n.protocol,hostname:n.hostname,path:n.pathname+n.search,port:n.port?parseInt(n.port,10):undefined}}throw new A("The container metadata credential provider cannot be used unless"+` the ${p} or ${g} environment`+" variable is set",{tryNextLink:false,logger:t})};class InstanceMetadataV1FallbackError extends A{tryNextLink;name="InstanceMetadataV1FallbackError";constructor(t,n=true){super(t,n);this.tryNextLink=n;Object.setPrototypeOf(this,InstanceMetadataV1FallbackError.prototype)}}var y;(function(t){t["IPv4"]="http://169.254.169.254";t["IPv6"]="http://[fd00:ec2::254]"})(y||(y={}));const B="AWS_EC2_METADATA_SERVICE_ENDPOINT";const Q="ec2_metadata_service_endpoint";const w={environmentVariableSelector:t=>t[B],configFileSelector:t=>t[Q],default:undefined};var S;(function(t){t["IPv4"]="IPv4";t["IPv6"]="IPv6"})(S||(S={}));const b="AWS_EC2_METADATA_SERVICE_ENDPOINT_MODE";const R="ec2_metadata_service_endpoint_mode";const v={environmentVariableSelector:t=>t[b],configFileSelector:t=>t[R],default:S.IPv4};const getInstanceMetadataEndpoint=async()=>d(await getFromEndpointConfig()||await getFromEndpointModeConfig());const getFromEndpointConfig=async()=>c(w)();const getFromEndpointModeConfig=async()=>{const t=await c(v)();switch(t){case S.IPv4:return y.IPv4;case S.IPv6:return y.IPv6;default:throw new Error(`Unsupported endpoint mode: ${t}.`+` Select from ${Object.values(S)}`)}};const k=5*60;const D=5*60;const T="https://docs.aws.amazon.com/sdkref/latest/guide/feature-static-credentials.html";const getExtendedInstanceMetadataCredentials=(t,n)=>{const i=k+Math.floor(Math.random()*D);const a=new Date(Date.now()+i*1e3);n.warn("Attempting credential expiration extension due to a credential service availability issue. A refresh of these "+`credentials will be attempted after ${new Date(a)}.\nFor more information, please visit: `+T);const A=t.originalExpiration??t.expiration;return{...t,...A?{originalExpiration:A}:{},expiration:a}};const staticStabilityProvider=(t,n={})=>{const i=n?.logger||console;let a;return async()=>{let n;try{n=await t();if(n.expiration&&n.expiration.getTime()staticStabilityProvider(getInstanceMetadataProvider(t),{logger:t.logger});const getInstanceMetadataProvider=(t={})=>{let n=false;const{logger:i,profile:a}=t;const{timeout:l,maxRetries:d}=providerConfigFromInit(t);const getCredentials=async(i,l)=>{const d=n||l.headers?.[U]==null;if(d){let n=false;let i=false;const l=await c({environmentVariableSelector:n=>{const a=n[F];i=!!a&&a!=="false";if(a===undefined){throw new A(`${F} not set in env, checking config file next.`,{logger:t.logger})}return i},configFileSelector:t=>{const i=t[x];n=!!i&&i!=="false";return n},default:false},{profile:a})();if(t.ec2MetadataV1Disabled||l){const a=[];if(t.ec2MetadataV1Disabled)a.push("credential provider initialization (runtime option ec2MetadataV1Disabled)");if(n)a.push(`config file profile (${x})`);if(i)a.push(`process environment variable (${F})`);throw new InstanceMetadataV1FallbackError(`AWS EC2 Metadata v1 fallback has been blocked by AWS SDK configuration in the following: [${a.join(", ")}].`)}}const h=(await retry(async()=>{let t;try{t=await getProfile(l)}catch(t){if(t.statusCode===401){n=false}throw t}return t},i)).trim();return retry(async()=>{let i;try{i=await getCredentialsFromProfile(h,l,t)}catch(t){if(t.statusCode===401){n=false}throw t}return i},i)};return async()=>{const t=await getInstanceMetadataEndpoint();if(n){i?.debug("AWS SDK Instance Metadata","using v1 fallback (no token fetch)");return getCredentials(d,{...t,timeout:l})}else{let a;try{a=(await getMetadataToken({...t,timeout:l})).toString()}catch(a){if(a?.statusCode===400){throw Object.assign(a,{message:"EC2 Metadata token request returned error"})}else if(a.message==="TimeoutError"||[403,404,405].includes(a.statusCode)){n=true}i?.debug("AWS SDK Instance Metadata","using v1 fallback (initial)");return getCredentials(d,{...t,timeout:l})}return getCredentials(d,{...t,headers:{[U]:a},timeout:l})}}};const getMetadataToken=async t=>httpRequest({...t,path:M,method:"PUT",headers:{"x-aws-ec2-metadata-token-ttl-seconds":"21600"}});const getProfile=async t=>(await httpRequest({...t,path:N})).toString();const getCredentialsFromProfile=async(t,n,i)=>{const a=JSON.parse((await httpRequest({...n,path:N+t})).toString());if(!isImdsCredentials(a)){throw new A("Invalid response received from instance metadata service.",{logger:i.logger})}return fromImdsCredentials(a)};n.DEFAULT_MAX_RETRIES=f;n.DEFAULT_TIMEOUT=h;n.ENV_CMDS_AUTH_TOKEN=m;n.ENV_CMDS_FULL_URI=g;n.ENV_CMDS_RELATIVE_URI=p;n.Endpoint=y;n.fromContainerMetadata=fromContainerMetadata;n.fromInstanceMetadata=fromInstanceMetadata;n.getInstanceMetadataEndpoint=getInstanceMetadataEndpoint;n.httpRequest=httpRequest;n.providerConfigFromInit=providerConfigFromInit},1279:(t,n,i)=>{const{buildQueryString:a,HttpResponse:A}=i(3422);const c=i(4708);const{Readable:l}=i(7075);const d=i(2467);const{streamCollector:h}=i(2430);n.streamCollector=h;function buildAbortError(t){const n=t&&typeof t==="object"&&"reason"in t?t.reason:undefined;if(n){if(n instanceof Error){const t=new Error("Request aborted");t.name="AbortError";t.cause=n;return t}const t=new Error(String(n));t.name="AbortError";return t}const i=new Error("Request aborted");i.name="AbortError";return i}const f=["ECONNRESET","EPIPE","ETIMEDOUT"];const getTransformedHeaders=t=>{const n={};for(const i in t){const a=t[i];n[i]=Array.isArray(a)?a.join(","):a}return n};const g={setTimeout:(t,n)=>setTimeout(t,n),clearTimeout:t=>clearTimeout(t)};const p=1e3;const setConnectionTimeout=(t,n,i=0)=>{if(!i){return-1}const registerTimeout=a=>{const A=g.setTimeout(()=>{t.destroy();n(Object.assign(new Error(`@smithy/node-http-handler - the request socket did not establish a connection with the server within the configured timeout of ${i} ms.`),{name:"TimeoutError"}))},i-a);const doWithSocket=t=>{if(t?.connecting){t.on("connect",()=>{g.clearTimeout(A)})}else{g.clearTimeout(A)}};if(t.socket){doWithSocket(t.socket)}else{t.on("socket",doWithSocket)}};if(i<2e3){registerTimeout(0);return 0}return g.setTimeout(registerTimeout.bind(null,p),p)};const setRequestTimeout=(t,n,i=0,a,A)=>{if(i){return g.setTimeout(()=>{let c=`@smithy/node-http-handler - [${a?"ERROR":"WARN"}] a request has exceeded the configured ${i} ms requestTimeout.`;if(a){const i=Object.assign(new Error(c),{name:"TimeoutError",code:"ETIMEDOUT"});t.destroy(i);n(i)}else{c+=` Init client requestHandler with throwOnRequestTimeout=true to turn this into an error.`;A?.warn?.(c)}},i)}return-1};const m=3e3;const setSocketKeepAlive=(t,{keepAlive:n,keepAliveMsecs:i},a=m)=>{if(n!==true){return-1}const registerListener=()=>{if(t.socket){t.socket.setKeepAlive(n,i||0)}else{t.on("socket",t=>{t.setKeepAlive(n,i||0)})}};if(a===0){registerListener();return 0}return g.setTimeout(registerListener,a)};const E=3e3;const setSocketTimeout=(t,n,i=0)=>{const registerTimeout=a=>{const A=i-a;const onTimeout=()=>{t.destroy();n(Object.assign(new Error(`@smithy/node-http-handler - the request socket timed out after ${i} ms of inactivity (configured by client requestHandler).`),{name:"TimeoutError"}))};if(t.socket){t.socket.setTimeout(A,onTimeout);t.on("close",()=>t.socket?.removeListener("timeout",onTimeout))}else{t.setTimeout(A,onTimeout)}};if(0{l=Number(g.setTimeout(()=>t(true),Math.max(C,i)))}),new Promise(n=>{t.on("continue",()=>{g.clearTimeout(l);n(true)});t.on("response",()=>{g.clearTimeout(l);n(false)});t.on("error",()=>{g.clearTimeout(l);n(false)})})])}if(d){writeBody(t,n.body)}}function writeBody(t,n){if(n instanceof l){n.pipe(t);return}if(n){const i=Buffer.isBuffer(n);const a=typeof n==="string";if(i||a){if(i&&n.byteLength===0){t.end()}else{t.end(n)}return}const A=n;if(typeof A==="object"&&A.buffer&&typeof A.byteOffset==="number"&&typeof A.byteLength==="number"){t.end(Buffer.from(A.buffer,A.byteOffset,A.byteLength));return}t.end(Buffer.from(n));return}t.end()}const I=0;let y=undefined;let B=undefined;class NodeHttpHandler{config;configProvider;socketWarningTimestamp=0;externalAgent=false;metadata={handlerProtocol:"http/1.1"};static create(t){if(typeof t?.handle==="function"){return t}return new NodeHttpHandler(t)}static checkSocketUsage(t,n,i=console){const{sockets:a,requests:A,maxSockets:c}=t;if(typeof c!=="number"||c===Infinity){return n}const l=15e3;if(Date.now()-l=c&&l>=2*c){i?.warn?.(`@smithy/node-http-handler:WARN - socket usage at capacity=${n} and ${l} additional requests are enqueued.\nSee https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/node-configuring-maxsockets.html\nor increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler config.`);return Date.now()}}}return n}constructor(t){this.configProvider=new Promise((n,i)=>{if(typeof t==="function"){t().then(t=>{n(this.resolveDefaultConfig(t))}).catch(i)}else{n(this.resolveDefaultConfig(t))}})}destroy(){this.config?.httpAgent?.destroy();this.config?.httpsAgent?.destroy()}async handle(t,{abortSignal:n,requestTimeout:i}={}){if(!this.config){this.config=await this.configProvider}const l=this.config;const d=t.protocol==="https:";if(!d&&!this.config.httpAgent){this.config.httpAgent=await this.config.httpAgentProvider()}return new Promise((h,p)=>{let m=undefined;let E=-1;let C=-1;let I=-1;let Q=-1;let w=-1;const clearTimeouts=()=>{g.clearTimeout(E);g.clearTimeout(C);g.clearTimeout(I);g.clearTimeout(Q);g.clearTimeout(w)};const resolve=async t=>{await m;clearTimeouts();h(t)};const reject=async t=>{await m;clearTimeouts();p(t)};if(n?.aborted){const t=buildAbortError(n);reject(t);return}const S=t.headers;const b=S?(S.Expect??S.expect)==="100-continue":false;let R=d?l.httpsAgent:l.httpAgent;if(b&&!this.externalAgent){R=new(d?c.Agent:y)({keepAlive:false,maxSockets:Infinity})}E=g.setTimeout(()=>{this.socketWarningTimestamp=NodeHttpHandler.checkSocketUsage(R,this.socketWarningTimestamp,l.logger)},l.socketAcquisitionWarningTimeout??(l.requestTimeout??2e3)+(l.connectionTimeout??1e3));const v=t.query?a(t.query):"";let k=undefined;if(t.username!=null||t.password!=null){const n=t.username??"";const i=t.password??"";k=`${n}:${i}`}let D=t.path;if(v){D+=`?${v}`}if(t.fragment){D+=`#${t.fragment}`}let T=t.hostname??"";if(T[0]==="["&&T.endsWith("]")){T=t.hostname.slice(1,-1)}else{T=t.hostname}const N={headers:t.headers,host:T,method:t.method,path:D,port:t.port,agent:R,auth:k};const M=d?c.request:B;const F=M(N,t=>{const n=new A({statusCode:t.statusCode||-1,reason:t.statusMessage,headers:getTransformedHeaders(t.headers),body:t});resolve({response:n})});F.on("error",t=>{if(f.includes(t.code)){reject(Object.assign(t,{name:"TimeoutError"}))}else{reject(t)}});if(n){const onAbort=()=>{F.destroy();const t=buildAbortError(n);reject(t)};if(typeof n.addEventListener==="function"){const t=n;t.addEventListener("abort",onAbort,{once:true});F.once("close",()=>t.removeEventListener("abort",onAbort))}else{n.onabort=onAbort}}const x=i??l.requestTimeout;C=setConnectionTimeout(F,reject,l.connectionTimeout);I=setRequestTimeout(F,reject,x,l.throwOnRequestTimeout,l.logger??console);Q=setSocketTimeout(F,reject,l.socketTimeout);const U=N.agent;if(typeof U==="object"&&"keepAlive"in U){w=setSocketKeepAlive(F,{keepAlive:U.keepAlive,keepAliveMsecs:U.keepAliveMsecs})}m=writeRequestBody(F,t,x,this.externalAgent).catch(t=>{clearTimeouts();return p(t)})})}updateHttpClientConfig(t,n){this.config=undefined;this.configProvider=this.configProvider.then(i=>({...i,[t]:n}))}httpHandlerConfigs(){return this.config??{}}resolveDefaultConfig(t){const{requestTimeout:n,connectionTimeout:a,socketTimeout:A,socketAcquisitionWarningTimeout:l,httpAgent:d,httpsAgent:h,throwOnRequestTimeout:f,logger:g}=t||{};const p=true;const m=50;return{connectionTimeout:a,requestTimeout:n,socketTimeout:A,socketAcquisitionWarningTimeout:l,throwOnRequestTimeout:f,httpAgentProvider:async()=>{const t=i(7067);const{Agent:n,request:a}=t.default??t;B=a;y=n;if(d instanceof y||typeof d?.destroy==="function"){this.externalAgent=true;return d}return new y({keepAlive:p,maxSockets:m,...d})},httpsAgent:(()=>{if(h instanceof c.Agent||typeof h?.destroy==="function"){this.externalAgent=true;return h}return new c.Agent({keepAlive:p,maxSockets:m,...h})})(),logger:g}}}const Q=new Uint16Array(1);class ClientHttp2SessionRef{id=Q[0]++;total=0;max=0;session;refs=0;constructor(t){t.unref();this.session=t}retain(){if(this.session.destroyed){throw new Error("@smithy/node-http-handler - cannot acquire reference to destroyed session.")}this.refs+=1;this.total+=1;this.max=Math.max(this.refs,this.max);this.session.ref()}free(){if(this.session.destroyed){return}this.refs-=1;if(this.refs===0){this.session.unref()}if(this.refs<0){throw new Error("@smithy/node-http-handler - ClientHttp2Session refcount at zero, cannot decrement.")}}deref(){return this.session}close(){if(!this.session.closed){this.session.close()}}destroy(){this.refs=0;if(!this.session.destroyed){this.session.destroy()}}useCount(){return this.refs}}class NodeHttp2ConnectionPool{sessions=[];maxConcurrency=0;constructor(t){this.sessions=(t??[]).map(t=>new ClientHttp2SessionRef(t))}poll(){let t=false;for(const n of this.sessions){if(n.deref().destroyed){t=true;continue}if(!this.maxConcurrency||n.useCount()-1){this.sessions.splice(n,1)}}[Symbol.iterator](){return this.sessions[Symbol.iterator]()}setMaxConcurrency(t){this.maxConcurrency=t}destroy(t){this.remove(t);t.destroy()}}class NodeHttp2ConnectionManager{config;connectOptions;connectionPools=new Map;constructor(t){this.config=t;if(this.config.maxConcurrency&&this.config.maxConcurrency<=0){throw new RangeError("maxConcurrency must be greater than zero.")}}lease(t,n){const i=this.getUrlString(t);const a=this.getPool(i);if(!this.config.disableConcurrency&&!n.isEventStream){const t=a.poll();if(t){t.retain();return t}}const A=new ClientHttp2SessionRef(this.connect(i));const c=A.deref();if(this.config.maxConcurrency){c.settings({maxConcurrentStreams:this.config.maxConcurrency},n=>{if(n){throw new Error("Fail to set maxConcurrentStreams to "+this.config.maxConcurrency+"when creating new session for "+t.destination.toString())}})}const graceful=()=>{this.removeFromPoolAndClose(i,A)};const ensureDestroyed=()=>{this.removeFromPoolAndCheckedDestroy(i,A)};c.on("goaway",graceful);c.on("error",ensureDestroyed);c.on("frameError",ensureDestroyed);c.on("close",ensureDestroyed);if(n.requestTimeout){c.setTimeout(n.requestTimeout,ensureDestroyed)}a.offerLast(A);A.retain();return A}release(t,n){n.free()}createIsolatedSession(t,n){const i=this.getUrlString(t);const a=new ClientHttp2SessionRef(this.connect(i));const A=a.deref();A.settings({maxConcurrentStreams:1});const ensureDestroyed=()=>{a.destroy()};A.on("error",ensureDestroyed);A.on("frameError",ensureDestroyed);A.on("close",ensureDestroyed);if(n.requestTimeout){A.setTimeout(n.requestTimeout,ensureDestroyed)}a.retain();return a}destroy(){for(const[t,n]of this.connectionPools){for(const t of[...n]){t.destroy()}this.connectionPools.delete(t)}}setMaxConcurrentStreams(t){if(t&&t<=0){throw new RangeError("maxConcurrentStreams must be greater than zero.")}this.config.maxConcurrency=t;for(const n of this.connectionPools.values()){n.setMaxConcurrency(t)}}setDisableConcurrentStreams(t){this.config.disableConcurrency=t}setNodeHttp2ConnectOptions(t){this.connectOptions=t}debug(){const t={};for(const[n,i]of this.connectionPools){const a=[];for(const t of i){a.push({id:t.id,active:t.useCount(),maxConcurrent:t.max,totalRequests:t.total})}t[n]={sessions:a}}return t}removeFromPoolAndClose(t,n){this.connectionPools.get(t)?.remove(n);n.close()}removeFromPoolAndCheckedDestroy(t,n){this.connectionPools.get(t)?.remove(n);n.destroy()}getPool(t){if(!this.connectionPools.has(t)){const n=new NodeHttp2ConnectionPool;if(this.config.maxConcurrency){n.setMaxConcurrency(this.config.maxConcurrency)}this.connectionPools.set(t,n)}return this.connectionPools.get(t)}getUrlString(t){return t.destination.toString()}connect(t){return this.connectOptions===undefined?d.connect(t):d.connect(t,this.connectOptions)}}const{constants:w}=d;class NodeHttp2Handler{config;configProvider;metadata={handlerProtocol:"h2"};connectionManager=new NodeHttp2ConnectionManager({});static create(t){if(typeof t?.handle==="function"){return t}return new NodeHttp2Handler(t)}constructor(t){this.configProvider=new Promise((n,i)=>{if(typeof t==="function"){t().then(t=>{n(t||{})}).catch(i)}else{n(t||{})}})}destroy(){this.connectionManager.destroy()}async handle(t,{abortSignal:n,requestTimeout:i,isEventStream:c}={}){if(!this.config){this.config=await this.configProvider;const{disableConcurrentStreams:t,maxConcurrentStreams:n,nodeHttp2ConnectOptions:i}=this.config;this.connectionManager.setDisableConcurrentStreams(t??false);if(n){this.connectionManager.setMaxConcurrentStreams(n)}if(i){this.connectionManager.setNodeHttp2ConnectOptions(i)}}const{requestTimeout:l,disableConcurrentStreams:d}=this.config;const h=d||c;const f=i??l;return new Promise((i,l)=>{let d=false;let g=undefined;const resolve=async t=>{await g;i(t)};const reject=async t=>{await g;l(t)};if(n?.aborted){d=true;const t=buildAbortError(n);reject(t);return}const{hostname:p,method:m,port:E,protocol:C,query:I}=t;let y="";if(t.username!=null||t.password!=null){const n=t.username??"";const i=t.password??"";y=`${n}:${i}@`}const B=`${C}//${y}${p}${E?`:${E}`:""}`;const Q={destination:new URL(B)};const S={requestTimeout:this.config?.sessionTimeout,isEventStream:c};const b=h?this.connectionManager.createIsolatedSession(Q,S):this.connectionManager.lease(Q,S);const R=b.deref();const rejectWithDestroy=t=>{if(h){b.destroy()}d=true;reject(t)};const v=I?a(I):"";let k=t.path;if(v){k+=`?${v}`}if(t.fragment){k+=`#${t.fragment}`}const D=R.request({...t.headers,[w.HTTP2_HEADER_PATH]:k,[w.HTTP2_HEADER_METHOD]:m});if(f){D.setTimeout(f,()=>{D.close();const t=new Error(`Stream timed out because of no activity for ${f} ms`);t.name="TimeoutError";rejectWithDestroy(t)})}if(n){const onAbort=()=>{D.close();const t=buildAbortError(n);rejectWithDestroy(t)};if(typeof n.addEventListener==="function"){const t=n;t.addEventListener("abort",onAbort,{once:true});D.once("close",()=>t.removeEventListener("abort",onAbort))}else{n.onabort=onAbort}}D.on("frameError",(t,n,i)=>{rejectWithDestroy(new Error(`Frame type id ${t} in stream id ${i} has failed with code ${n}.`))});D.on("error",rejectWithDestroy);D.on("aborted",()=>{rejectWithDestroy(new Error(`HTTP/2 stream is abnormally aborted in mid-communication with result code ${D.rstCode}.`))});D.on("response",t=>{const n=new A({statusCode:t[":status"]??-1,headers:getTransformedHeaders(t),body:D});d=true;resolve({response:n});if(h){R.close()}});D.on("close",()=>{if(h){b.destroy()}else{this.connectionManager.release(Q,b)}if(!d){rejectWithDestroy(new Error("Unexpected error: http2 request did not get a response"))}});g=writeRequestBody(D,t,f)})}updateHttpClientConfig(t,n){this.config=undefined;this.configProvider=this.configProvider.then(i=>({...i,[t]:n}))}httpHandlerConfigs(){return this.config??{}}}n.DEFAULT_REQUEST_TIMEOUT=I;n.NodeHttp2Handler=NodeHttp2Handler;n.NodeHttpHandler=NodeHttpHandler},5118:(t,n,i)=>{const{fromUtf8:a,fromHex:A,toHex:c,toUint8Array:l,isArrayBuffer:d}=i(2430);const{normalizeProvider:h}=i(2658);const{escapeUri:f,HttpRequest:g}=i(3422);class HeaderFormatter{format(t){const n=[];for(const i of Object.keys(t)){const A=a(i);n.push(Uint8Array.from([A.byteLength]),A,this.formatHeaderValue(t[i]))}const i=new Uint8Array(n.reduce((t,n)=>t+n.byteLength,0));let A=0;for(const t of n){i.set(t,A);A+=t.byteLength}return i}formatHeaderValue(t){switch(t.type){case"boolean":return Uint8Array.from([t.value?0:1]);case"byte":return Uint8Array.from([2,t.value]);case"short":const n=new DataView(new ArrayBuffer(3));n.setUint8(0,3);n.setInt16(1,t.value,false);return new Uint8Array(n.buffer);case"integer":const i=new DataView(new ArrayBuffer(5));i.setUint8(0,4);i.setInt32(1,t.value,false);return new Uint8Array(i.buffer);case"long":const c=new Uint8Array(9);c[0]=5;c.set(t.value.bytes,1);return c;case"binary":const l=new DataView(new ArrayBuffer(3+t.value.byteLength));l.setUint8(0,6);l.setUint16(1,t.value.byteLength,false);const d=new Uint8Array(l.buffer);d.set(t.value,3);return d;case"string":const h=a(t.value);const f=new DataView(new ArrayBuffer(3+h.byteLength));f.setUint8(0,7);f.setUint16(1,h.byteLength,false);const g=new Uint8Array(f.buffer);g.set(h,3);return g;case"timestamp":const p=new Uint8Array(9);p[0]=8;p.set(Int64.fromNumber(t.value.valueOf()).bytes,1);return p;case"uuid":if(!m.test(t.value)){throw new Error(`Invalid UUID received: ${t.value}`)}const E=new Uint8Array(17);E[0]=9;E.set(A(t.value.replace(/\-/g,"")),1);return E}}}var p;(function(t){t[t["boolTrue"]=0]="boolTrue";t[t["boolFalse"]=1]="boolFalse";t[t["byte"]=2]="byte";t[t["short"]=3]="short";t[t["integer"]=4]="integer";t[t["long"]=5]="long";t[t["byteArray"]=6]="byteArray";t[t["string"]=7]="string";t[t["timestamp"]=8]="timestamp";t[t["uuid"]=9]="uuid"})(p||(p={}));const m=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;class Int64{bytes;constructor(t){this.bytes=t;if(t.byteLength!==8){throw new Error("Int64 buffers must be exactly 8 bytes")}}static fromNumber(t){if(t>0x8000000000000000||t<-0x8000000000000000){throw new Error(`${t} is too large (or, if negative, too small) to represent as an Int64`)}const n=new Uint8Array(8);for(let i=7,a=Math.abs(Math.round(t));i>-1&&a>0;i--,a/=256){n[i]=a}if(t<0){negate(n)}return new Int64(n)}valueOf(){const t=this.bytes.slice(0);const n=t[0]&128;if(n){negate(t)}return parseInt(c(t),16)*(n?-1:1)}toString(){return String(this.valueOf())}}function negate(t){for(let n=0;n<8;n++){t[n]^=255}for(let n=7;n>-1;n--){t[n]++;if(t[n]!==0)break}}const E="X-Amz-Algorithm";const C="X-Amz-Credential";const I="X-Amz-Date";const y="X-Amz-SignedHeaders";const B="X-Amz-Expires";const Q="X-Amz-Signature";const w="X-Amz-Security-Token";const S="X-Amz-Region-Set";const b="authorization";const R=I.toLowerCase();const v="date";const k=[b,R,v];const D=Q.toLowerCase();const T="x-amz-content-sha256";const N=w.toLowerCase();const M="host";const F={authorization:true,"cache-control":true,connection:true,expect:true,from:true,"keep-alive":true,"max-forwards":true,pragma:true,referer:true,te:true,trailer:true,"transfer-encoding":true,upgrade:true,"user-agent":true,"x-amzn-trace-id":true};const x=/^proxy-/;const U=/^sec-/;const P=[/^proxy-/i,/^sec-/i];const L="AWS4-HMAC-SHA256";const O="AWS4-ECDSA-P256-SHA256";const H="AWS4-HMAC-SHA256-PAYLOAD";const $="UNSIGNED-PAYLOAD";const G=50;const V="aws4_request";const Y=60*60*24*7;const getCanonicalQuery=({query:t={}})=>{const n=[];const i={};for(const a of Object.keys(t)){if(a.toLowerCase()===D){continue}const A=f(a);n.push(A);const c=t[a];if(typeof c==="string"){i[A]=`${A}=${f(c)}`}else if(Array.isArray(c)){i[A]=c.slice(0).reduce((t,n)=>t.concat([`${A}=${f(n)}`]),[]).sort().join("&")}}return n.sort().map(t=>i[t]).filter(t=>t).join("&")};const iso8601=t=>toDate(t).toISOString().replace(/\.\d{3}Z$/,"Z");const toDate=t=>{if(typeof t==="number"){return new Date(t*1e3)}if(typeof t==="string"){if(Number(t)){return new Date(Number(t)*1e3)}return new Date(t)}return t};class SignatureV4Base{service;regionProvider;credentialProvider;sha256;uriEscapePath;applyChecksum;constructor({applyChecksum:t,credentials:n,region:i,service:a,sha256:A,uriEscapePath:c=true}){this.service=a;this.sha256=A;this.uriEscapePath=c;this.applyChecksum=typeof t==="boolean"?t:true;this.regionProvider=h(i);this.credentialProvider=h(n)}createCanonicalRequest(t,n,i){const a=Object.keys(n).sort();return`${t.method}\n${this.getCanonicalPath(t)}\n${getCanonicalQuery(t)}\n${a.map(t=>`${t}:${n[t]}`).join("\n")}\n\n${a.join(";")}\n${i}`}async createStringToSign(t,n,i,a){const A=new this.sha256;A.update(l(i));const d=await A.digest();return`${a}\n${t}\n${n}\n${c(d)}`}getCanonicalPath({path:t}){if(this.uriEscapePath){const n=[];for(const i of t.split("/")){if(i?.length===0)continue;if(i===".")continue;if(i===".."){n.pop()}else{n.push(i)}}const i=`${t?.startsWith("/")?"/":""}${n.join("/")}${n.length>0&&t?.endsWith("/")?"/":""}`;const a=f(i);return a.replace(/%2F/g,"/")}return t}validateResolvedCredentials(t){if(typeof t!=="object"||typeof t.accessKeyId!=="string"||typeof t.secretAccessKey!=="string"){throw new Error("Resolved credential object is not valid")}}formatDate(t){const n=iso8601(t).replace(/[\-:]/g,"");return{longDate:n,shortDate:n.slice(0,8)}}getCanonicalHeaderList(t){return Object.keys(t).sort().join(";")}}const J={};const W=[];const createScope=(t,n,i)=>`${t}/${n}/${i}/${V}`;const getSigningKey=async(t,n,i,a,A)=>{const l=await hmac(t,n.secretAccessKey,n.accessKeyId);const d=`${i}:${a}:${A}:${c(l)}:${n.sessionToken}`;if(d in J){return J[d]}W.push(d);while(W.length>G){delete J[W.shift()]}let h=`AWS4${n.secretAccessKey}`;for(const n of[i,a,A,V]){h=await hmac(t,h,n)}return J[d]=h};const clearCredentialCache=()=>{W.length=0;Object.keys(J).forEach(t=>{delete J[t]})};const hmac=(t,n,i)=>{const a=new t(n);a.update(l(i));return a.digest()};const getCanonicalHeaders=({headers:t},n,i)=>{const a={};for(const A of Object.keys(t).sort()){if(t[A]==undefined){continue}const c=A.toLowerCase();if(c in F||n?.has(c)||x.test(c)||U.test(c)){if(!i||i&&!i.has(c)){continue}}a[c]=t[A].trim().replace(/\s+/g," ")}return a};const getPayloadHash=async({headers:t,body:n},i)=>{for(const n of Object.keys(t)){if(n.toLowerCase()===T){return t[n]}}if(n==undefined){return"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"}else if(typeof n==="string"||ArrayBuffer.isView(n)||d(n)){const t=new i;t.update(l(n));return c(await t.digest())}return $};const hasHeader=(t,n)=>{t=t.toLowerCase();for(const i of Object.keys(n)){if(t===i.toLowerCase()){return true}}return false};const moveHeadersToQuery=(t,n={})=>{const{headers:i,query:a={}}=g.clone(t);for(const t of Object.keys(i)){const A=t.toLowerCase();if(A.slice(0,6)==="x-amz-"&&!n.unhoistableHeaders?.has(A)||n.hoistableHeaders?.has(A)){a[t]=i[t];delete i[t]}}return{...t,headers:i,query:a}};const prepareRequest=t=>{t=g.clone(t);for(const n of Object.keys(t.headers)){if(k.indexOf(n.toLowerCase())>-1){delete t.headers[n]}}return t};class SignatureV4 extends SignatureV4Base{headerFormatter=new HeaderFormatter;constructor({applyChecksum:t,credentials:n,region:i,service:a,sha256:A,uriEscapePath:c=true}){super({applyChecksum:t,credentials:n,region:i,service:a,sha256:A,uriEscapePath:c})}async presign(t,n={}){const{signingDate:i=new Date,expiresIn:a=3600,unsignableHeaders:A,unhoistableHeaders:c,signableHeaders:l,hoistableHeaders:d,signingRegion:h,signingService:f}=n;const g=await this.credentialProvider();this.validateResolvedCredentials(g);const p=h??await this.regionProvider();const{longDate:m,shortDate:S}=this.formatDate(i);if(a>Y){return Promise.reject("Signature version 4 presigned URLs"+" must have an expiration date less than one week in"+" the future")}const b=createScope(S,p,f??this.service);const R=moveHeadersToQuery(prepareRequest(t),{unhoistableHeaders:c,hoistableHeaders:d});if(g.sessionToken){R.query[w]=g.sessionToken}R.query[E]=L;R.query[C]=`${g.accessKeyId}/${b}`;R.query[I]=m;R.query[B]=a.toString(10);const v=getCanonicalHeaders(R,A,l);R.query[y]=this.getCanonicalHeaderList(v);R.query[Q]=await this.getSignature(m,b,this.getSigningKey(g,p,S,f),this.createCanonicalRequest(R,v,await getPayloadHash(t,this.sha256)));return R}async sign(t,n){if(typeof t==="string"){return this.signString(t,n)}else if(t.headers&&t.payload){return this.signEvent(t,n)}else if(t.message){return this.signMessage(t,n)}else{return this.signRequest(t,n)}}async signEvent({headers:t,payload:n},{signingDate:i=new Date,priorSignature:a,signingRegion:A,signingService:l,eventStreamCredentials:d}){const h=A??await this.regionProvider();const{shortDate:f,longDate:g}=this.formatDate(i);const p=createScope(f,h,l??this.service);const m=await getPayloadHash({headers:{},body:n},this.sha256);const E=new this.sha256;E.update(t);const C=c(await E.digest());const I=[H,g,p,a,C,m].join("\n");return this.signString(I,{signingDate:i,signingRegion:h,signingService:l,eventStreamCredentials:d})}async signMessage(t,{signingDate:n=new Date,signingRegion:i,signingService:a,eventStreamCredentials:A}){const c=this.signEvent({headers:this.headerFormatter.format(t.message.headers),payload:t.message.body},{signingDate:n,signingRegion:i,signingService:a,priorSignature:t.priorSignature,eventStreamCredentials:A});return c.then(n=>({message:t.message,signature:n}))}async signString(t,{signingDate:n=new Date,signingRegion:i,signingService:a,eventStreamCredentials:A}={}){const d=A??await this.credentialProvider();this.validateResolvedCredentials(d);const h=i??await this.regionProvider();const{shortDate:f}=this.formatDate(n);const g=new this.sha256(await this.getSigningKey(d,h,f,a));g.update(l(t));return c(await g.digest())}async signRequest(t,{signingDate:n=new Date,signableHeaders:i,unsignableHeaders:a,signingRegion:A,signingService:c}={}){const l=await this.credentialProvider();this.validateResolvedCredentials(l);const d=A??await this.regionProvider();const h=prepareRequest(t);const{longDate:f,shortDate:g}=this.formatDate(n);const p=createScope(g,d,c??this.service);h.headers[R]=f;if(l.sessionToken){h.headers[N]=l.sessionToken}const m=await getPayloadHash(h,this.sha256);if(!hasHeader(T,h.headers)&&this.applyChecksum){h.headers[T]=m}const E=getCanonicalHeaders(h,a,i);const C=await this.getSignature(f,p,this.getSigningKey(l,d,g,c),this.createCanonicalRequest(h,E,m));h.headers[b]=`${L} `+`Credential=${l.accessKeyId}/${p}, `+`SignedHeaders=${this.getCanonicalHeaderList(E)}, `+`Signature=${C}`;return h}async getSignature(t,n,i,a){const A=await this.createStringToSign(t,n,a,L);const d=new this.sha256(await i);d.update(l(A));return c(await d.digest())}getSigningKey(t,n,i,a){return getSigningKey(this.sha256,t,i,n,a||this.service)}}const q={SignatureV4a:null};n.ALGORITHM_IDENTIFIER=L;n.ALGORITHM_IDENTIFIER_V4A=O;n.ALGORITHM_QUERY_PARAM=E;n.ALWAYS_UNSIGNABLE_HEADERS=F;n.AMZ_DATE_HEADER=R;n.AMZ_DATE_QUERY_PARAM=I;n.AUTH_HEADER=b;n.CREDENTIAL_QUERY_PARAM=C;n.DATE_HEADER=v;n.EVENT_ALGORITHM_IDENTIFIER=H;n.EXPIRES_QUERY_PARAM=B;n.GENERATED_HEADERS=k;n.HOST_HEADER=M;n.KEY_TYPE_IDENTIFIER=V;n.MAX_CACHE_SIZE=G;n.MAX_PRESIGNED_TTL=Y;n.PROXY_HEADER_PATTERN=x;n.REGION_SET_PARAM=S;n.SEC_HEADER_PATTERN=U;n.SHA256_HEADER=T;n.SIGNATURE_HEADER=D;n.SIGNATURE_QUERY_PARAM=Q;n.SIGNED_HEADERS_QUERY_PARAM=y;n.SignatureV4=SignatureV4;n.SignatureV4Base=SignatureV4Base;n.TOKEN_HEADER=N;n.TOKEN_QUERY_PARAM=w;n.UNSIGNABLE_PATTERNS=P;n.UNSIGNED_PAYLOAD=$;n.clearCredentialCache=clearCredentialCache;n.createScope=createScope;n.getCanonicalHeaders=getCanonicalHeaders;n.getCanonicalQuery=getCanonicalQuery;n.getPayloadHash=getPayloadHash;n.getSigningKey=getSigningKey;n.hasHeader=hasHeader;n.moveHeadersToQuery=moveHeadersToQuery;n.prepareRequest=prepareRequest;n.signatureV4aContainer=q},690:(t,n)=>{var i;(function(t){t["HEADER"]="header";t["QUERY"]="query"})(i||(i={}));var a;(function(t){t["HEADER"]="header";t["QUERY"]="query"})(a||(a={}));var A;(function(t){t["HTTP"]="http";t["HTTPS"]="https"})(A||(A={}));var c;(function(t){t["MD5"]="md5";t["CRC32"]="crc32";t["CRC32C"]="crc32c";t["SHA1"]="sha1";t["SHA256"]="sha256"})(c||(c={}));const getChecksumConfiguration=t=>{const n=[];if(t.sha256!==undefined){n.push({algorithmId:()=>c.SHA256,checksumConstructor:()=>t.sha256})}if(t.md5!=undefined){n.push({algorithmId:()=>c.MD5,checksumConstructor:()=>t.md5})}return{addChecksumAlgorithm(t){n.push(t)},checksumAlgorithms(){return n}}};const resolveChecksumRuntimeConfig=t=>{const n={};t.checksumAlgorithms().forEach(t=>{n[t.algorithmId()]=t.checksumConstructor()});return n};const getDefaultClientConfiguration=t=>getChecksumConfiguration(t);const resolveDefaultRuntimeConfig=t=>resolveChecksumRuntimeConfig(t);var l;(function(t){t[t["HEADER"]=0]="HEADER";t[t["TRAILER"]=1]="TRAILER"})(l||(l={}));const d="__smithy_context";var h;(function(t){t["PROFILE"]="profile";t["SSO_SESSION"]="sso-session";t["SERVICES"]="services"})(h||(h={}));var f;(function(t){t["HTTP_0_9"]="http/0.9";t["HTTP_1_0"]="http/1.0";t["TDS_8_0"]="tds/8.0"})(f||(f={}));n.AlgorithmId=c;n.EndpointURLScheme=A;n.FieldPosition=l;n.HttpApiKeyAuthLocation=a;n.HttpAuthLocation=i;n.IniSectionType=h;n.RequestHandlerProtocol=f;n.SMITHY_CONTEXT_KEY=d;n.getDefaultClientConfiguration=getDefaultClientConfiguration;n.resolveDefaultRuntimeConfig=resolveDefaultRuntimeConfig},3966:(t,n,i)=>{Object.defineProperty(n,"__esModule",{value:true});const a=i(2463);const A=i(1436);const c=i(567);const l=i(7881);const d=i(1283);const h=i(630);const f="errorMessage";const g=new a.Name("emUsed");const p={required:"missingProperty",dependencies:"property",dependentRequired:"property"};const m=/\$\{[^}]+\}/;const E=/\$\{([^}]+)\}/g;const C=/^""\s*\+\s*|\s*\+\s*""$/g;function errorMessage(t){return{keyword:f,schemaType:["string","object"],post:true,code(n){const{gen:i,data:I,schema:y,schemaValue:B,it:Q}=n;if(Q.createErrors===false)return;const w=y;const S=A.strConcat(h.default.instancePath,Q.errorPath);i.if(a._`${h.default.errors} > 0`,()=>{if(typeof w=="object"){const[t,n]=keywordErrorsConfig(w);if(n)processKeywordErrors(n);if(t)processKeywordPropErrors(t);processChildErrors(childErrorsConfig(w))}const n=typeof w=="string"?w:w._;if(n)processAllErrors(n);if(!t.keepErrors)removeUsedErrors()});function childErrorsConfig({properties:t,items:n}){const i={};if(t){i.props={};for(const n in t)i.props[n]=[]}if(n){i.items={};for(let t=0;ti.if(matchKeywordError(t,c),()=>i.code(a._`${c}[${t}.keyword].push(${t})`).assign(a._`${t}.${g}`,true)));const{singleError:f}=t;if(f){const t=i.let("message",a._`""`);const A=i.let("paramsErrors",a._`[]`);loopErrors(n=>{i.if(t,()=>i.code(a._`${t} += ${typeof f=="string"?f:";"}`));i.code(a._`${t} += ${errMessage(n)}`);i.assign(A,a._`${A}.concat(${c}[${n}])`)});d.reportError(n,{message:t,params:a._`{errors: ${A}}`})}else{loopErrors(t=>d.reportError(n,{message:errMessage(t),params:a._`{errors: ${c}[${t}]}`}))}function loopErrors(t){i.forIn("key",c,n=>i.if(a._`${c}[${n}].length`,()=>t(n)))}function errMessage(t){return a._`${t} in ${l} ? ${l}[${t}]() : ${B}[${t}]`}}function processKeywordPropErrors(t){const A=i.const("emErrors",a.stringify(t));const c=[];for(const n in t){c.push([n,getTemplatesCode(t[n],y[n])])}const l=i.const("templates",i.object(...c));const f=i.scopeValue("obj",{ref:p,code:a.stringify(p)});const m=i.let("emPropParams");const E=i.let("emParamsErrors");i.forOf("err",h.default.vErrors,t=>i.if(matchKeywordError(t,A),()=>{i.assign(m,a._`${f}[${t}.keyword]`);i.assign(E,a._`${A}[${t}.keyword][${t}.params[${m}]]`);i.if(E,()=>i.code(a._`${E}.push(${t})`).assign(a._`${t}.${g}`,true))}));i.forIn("key",A,t=>i.forIn("keyProp",a._`${A}[${t}]`,c=>{i.assign(E,a._`${A}[${t}][${c}]`);i.if(a._`${E}.length`,()=>{const A=i.const("tmpl",a._`${l}[${t}] && ${l}[${t}][${c}]`);d.reportError(n,{message:a._`${A} ? ${A}() : ${B}[${t}][${c}]`,params:a._`{errors: ${E}}`})})}))}function processChildErrors(t){const{props:c,items:l}=t;if(!c&&!l)return;const f=a._`typeof ${I} == "object"`;const p=a._`Array.isArray(${I})`;const m=i.let("emErrors");let E;let C;const Q=i.let("templates");if(c&&l){E=i.let("emChildKwd");i.if(f);i.if(p,()=>{init(l,y.items);i.assign(E,a.str`items`)},()=>{init(c,y.properties);i.assign(E,a.str`properties`)});C=a._`[${E}]`}else if(l){i.if(p);init(l,y.items);C=a._`.items`}else if(c){i.if(A.and(f,A.not(p)));init(c,y.properties);C=a._`.properties`}i.forOf("err",h.default.vErrors,t=>ifMatchesChildError(t,m,n=>i.code(a._`${m}[${n}].push(${t})`).assign(a._`${t}.${g}`,true)));i.forIn("key",m,t=>i.if(a._`${m}[${t}].length`,()=>{d.reportError(n,{message:a._`${t} in ${Q} ? ${Q}[${t}]() : ${B}${C}[${t}]`,params:a._`{errors: ${m}[${t}]}`});i.assign(a._`${h.default.vErrors}[${h.default.errors}-1].instancePath`,a._`${S} + "/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`)}));i.endIf();function init(t,n){i.assign(m,a.stringify(t));i.assign(Q,getTemplatesCode(t,n))}}function processAllErrors(t){const A=i.const("emErrs",a._`[]`);i.forOf("err",h.default.vErrors,t=>i.if(matchAnyError(t),()=>i.code(a._`${A}.push(${t})`).assign(a._`${t}.${g}`,true)));i.if(a._`${A}.length`,()=>d.reportError(n,{message:templateExpr(t),params:a._`{errors: ${A}}`}))}function removeUsedErrors(){const t=i.const("emErrs",a._`[]`);i.forOf("err",h.default.vErrors,n=>i.if(a._`!${n}.${g}`,()=>i.code(a._`${t}.push(${n})`)));i.assign(h.default.vErrors,t).assign(h.default.errors,a._`${t}.length`)}function matchKeywordError(t,n){return A.and(a._`${t}.keyword !== ${f}`,a._`!${t}.${g}`,a._`${t}.instancePath === ${S}`,a._`${t}.keyword in ${n}`,a._`${t}.schemaPath.indexOf(${Q.errSchemaPath}) === 0`,a._`/^\\/[^\\/]*$/.test(${t}.schemaPath.slice(${Q.errSchemaPath.length}))`)}function ifMatchesChildError(t,n,c){i.if(A.and(a._`${t}.keyword !== ${f}`,a._`!${t}.${g}`,a._`${t}.instancePath.indexOf(${S}) === 0`),()=>{const A=i.scopeValue("pattern",{ref:/^\/([^/]*)(?:\/|$)/,code:a._`new RegExp("^\\\/([^/]*)(?:\\\/|$)")`});const l=i.const("emMatches",a._`${A}.exec(${t}.instancePath.slice(${S}.length))`);const d=i.const("emChild",a._`${l} && ${l}[1].replace(/~1/g, "/").replace(/~0/g, "~")`);i.if(a._`${d} !== undefined && ${d} in ${n}`,()=>c(d))})}function matchAnyError(t){return A.and(a._`${t}.keyword !== ${f}`,a._`!${t}.${g}`,A.or(a._`${t}.instancePath === ${S}`,A.and(a._`${t}.instancePath.indexOf(${S}) === 0`,a._`${t}.instancePath[${S}.length] === "/"`)),a._`${t}.schemaPath.indexOf(${Q.errSchemaPath}) === 0`,a._`${t}.schemaPath[${Q.errSchemaPath}.length] === "/"`)}function getTemplatesCode(t,n){const a=[];for(const i in t){const t=n[i];if(m.test(t))a.push([i,templateFunc(t)])}return i.object(...a)}function templateExpr(t){if(!m.test(t))return a.stringify(t);return new c._Code(c.safeStringify(t).replace(E,(t,n)=>`" + JSON.stringify(${l.getData(n,Q)}) + "`).replace(C,""))}function templateFunc(t){return a._`function(){return ${templateExpr(t)}}`}},metaSchema:{anyOf:[{type:"string"},{type:"object",properties:{properties:{$ref:"#/$defs/stringMap"},items:{$ref:"#/$defs/stringList"},required:{$ref:"#/$defs/stringOrMap"},dependencies:{$ref:"#/$defs/stringOrMap"}},additionalProperties:{type:"string"}}],$defs:{stringMap:{type:"object",additionalProperties:{type:"string"}},stringOrMap:{anyOf:[{type:"string"},{$ref:"#/$defs/stringMap"}]},stringList:{type:"array",items:{type:"string"}}}}}}const ajvErrors=(t,n={})=>{if(!t.opts.allErrors)throw new Error("ajv-errors: Ajv option allErrors must be true");if(t.opts.jsPropertySyntax){throw new Error("ajv-errors: ajv option jsPropertySyntax is not supported")}return t.addKeyword(errorMessage(n))};n["default"]=ajvErrors;t.exports=ajvErrors;t.exports["default"]=ajvErrors},779:(t,n)=>{Object.defineProperty(n,"__esModule",{value:true});n.formatNames=n.fastFormats=n.fullFormats=void 0;function fmtDef(t,n){return{validate:t,compare:n}}n.fullFormats={date:fmtDef(date,compareDate),time:fmtDef(getTime(true),compareTime),"date-time":fmtDef(getDateTime(true),compareDateTime),"iso-time":fmtDef(getTime(),compareIsoTime),"iso-date-time":fmtDef(getDateTime(),compareIsoDateTime),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:uri,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:regex,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:byte,int32:{type:"number",validate:validateInt32},int64:{type:"number",validate:validateInt64},float:{type:"number",validate:validateNumber},double:{type:"number",validate:validateNumber},password:true,binary:true};n.fastFormats={...n.fullFormats,date:fmtDef(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,compareDate),time:fmtDef(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,compareTime),"date-time":fmtDef(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,compareDateTime),"iso-time":fmtDef(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,compareIsoTime),"iso-date-time":fmtDef(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,compareIsoDateTime),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i};n.formatNames=Object.keys(n.fullFormats);function isLeapYear(t){return t%4===0&&(t%100!==0||t%400===0)}const i=/^(\d\d\d\d)-(\d\d)-(\d\d)$/;const a=[0,31,28,31,30,31,30,31,31,30,31,30,31];function date(t){const n=i.exec(t);if(!n)return false;const A=+n[1];const c=+n[2];const l=+n[3];return c>=1&&c<=12&&l>=1&&l<=(c===2&&isLeapYear(A)?29:a[c])}function compareDate(t,n){if(!(t&&n))return undefined;if(t>n)return 1;if(t23||g>59||t&&!d)return false;if(a<=23&&c<=59&&l<60)return true;const p=c-g*h;const m=a-f*h-(p<0?1:0);return(m===23||m===-1)&&(p===59||p===-1)&&l<61}}function compareTime(t,n){if(!(t&&n))return undefined;const i=new Date("2020-01-01T"+t).valueOf();const a=new Date("2020-01-01T"+n).valueOf();if(!(i&&a))return undefined;return i-a}function compareIsoTime(t,n){if(!(t&&n))return undefined;const i=A.exec(t);const a=A.exec(n);if(!(i&&a))return undefined;t=i[1]+i[2]+i[3];n=a[1]+a[2]+a[3];if(t>n)return 1;if(t=f}function validateInt64(t){return Number.isInteger(t)}function validateNumber(){return true}const p=/[^\\]\\Z/;function regex(t){if(p.test(t))return false;try{new RegExp(t);return true}catch(t){return false}}},2815:(t,n,i)=>{Object.defineProperty(n,"__esModule",{value:true});const a=i(779);const A=i(1284);const c=i(1436);const l=new c.Name("fullFormats");const d=new c.Name("fastFormats");const formatsPlugin=(t,n={keywords:true})=>{if(Array.isArray(n)){addFormats(t,n,a.fullFormats,l);return t}const[i,c]=n.mode==="fast"?[a.fastFormats,d]:[a.fullFormats,l];const h=n.formats||a.formatNames;addFormats(t,h,i,c);if(n.keywords)(0,A.default)(t);return t};formatsPlugin.get=(t,n="full")=>{const i=n==="fast"?a.fastFormats:a.fullFormats;const A=i[t];if(!A)throw new Error(`Unknown format "${t}"`);return A};function addFormats(t,n,i,a){var A;var l;(A=(l=t.opts.code).formats)!==null&&A!==void 0?A:l.formats=(0,c._)`require("ajv-formats/dist/formats").${a}`;for(const a of n)t.addFormat(a,i[a])}t.exports=n=formatsPlugin;Object.defineProperty(n,"__esModule",{value:true});n["default"]=formatsPlugin},1284:(t,n,i)=>{Object.defineProperty(n,"__esModule",{value:true});n.formatLimitDefinition=void 0;const a=i(2463);const A=i(1436);const c=A.operators;const l={formatMaximum:{okStr:"<=",ok:c.LTE,fail:c.GT},formatMinimum:{okStr:">=",ok:c.GTE,fail:c.LT},formatExclusiveMaximum:{okStr:"<",ok:c.LT,fail:c.GTE},formatExclusiveMinimum:{okStr:">",ok:c.GT,fail:c.LTE}};const d={message:({keyword:t,schemaCode:n})=>(0,A.str)`should be ${l[t].okStr} ${n}`,params:({keyword:t,schemaCode:n})=>(0,A._)`{comparison: ${l[t].okStr}, limit: ${n}}`};n.formatLimitDefinition={keyword:Object.keys(l),type:"string",schemaType:"string",$data:true,error:d,code(t){const{gen:n,data:i,schemaCode:c,keyword:d,it:h}=t;const{opts:f,self:g}=h;if(!f.validateFormats)return;const p=new a.KeywordCxt(h,g.RULES.all.format.definition,"format");if(p.$data)validate$DataFormat();else validateFormat();function validate$DataFormat(){const i=n.scopeValue("formats",{ref:g.formats,code:f.code.formats});const a=n.const("fmt",(0,A._)`${i}[${p.schemaCode}]`);t.fail$data((0,A.or)((0,A._)`typeof ${a} != "object"`,(0,A._)`${a} instanceof RegExp`,(0,A._)`typeof ${a}.compare != "function"`,compareCode(a)))}function validateFormat(){const i=p.schema;const a=g.formats[i];if(!a||a===true)return;if(typeof a!="object"||a instanceof RegExp||typeof a.compare!="function"){throw new Error(`"${d}": format "${i}" does not define "compare" function`)}const c=n.scopeValue("formats",{key:i,ref:a,code:f.code.formats?(0,A._)`${f.code.formats}${(0,A.getProperty)(i)}`:undefined});t.fail$data(compareCode(c))}function compareCode(t){return(0,A._)`${t}.compare(${i}, ${c}) ${l[d].fail} 0`}},dependencies:["format"]};const formatLimitPlugin=t=>{t.addKeyword(n.formatLimitDefinition);return t};n["default"]=formatLimitPlugin},878:(t,n,i)=>{Object.defineProperty(n,"__esModule",{value:true});n.MissingRefError=n.ValidationError=n.CodeGen=n.Name=n.nil=n.stringify=n.str=n._=n.KeywordCxt=n.Ajv2019=void 0;const a=i(3893);const A=i(9941);const c=i(9923);const l=i(7844);const d=i(2010);const h=i(8886);const f=i(5375);const g="https://json-schema.org/draft/2019-09/schema";class Ajv2019 extends a.default{constructor(t={}){super({...t,dynamicRef:true,next:true,unevaluated:true})}_addVocabularies(){super._addVocabularies();this.addVocabulary(c.default);A.default.forEach(t=>this.addVocabulary(t));this.addVocabulary(l.default);this.addVocabulary(d.default);if(this.opts.discriminator)this.addKeyword(h.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();const{$data:t,meta:n}=this.opts;if(!n)return;f.default.call(this,t);this.refs["http://json-schema.org/schema"]=g}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(g)?g:undefined)}}n.Ajv2019=Ajv2019;t.exports=n=Ajv2019;t.exports.Ajv2019=Ajv2019;Object.defineProperty(n,"__esModule",{value:true});n["default"]=Ajv2019;var p=i(7881);Object.defineProperty(n,"KeywordCxt",{enumerable:true,get:function(){return p.KeywordCxt}});var m=i(1436);Object.defineProperty(n,"_",{enumerable:true,get:function(){return m._}});Object.defineProperty(n,"str",{enumerable:true,get:function(){return m.str}});Object.defineProperty(n,"stringify",{enumerable:true,get:function(){return m.stringify}});Object.defineProperty(n,"nil",{enumerable:true,get:function(){return m.nil}});Object.defineProperty(n,"Name",{enumerable:true,get:function(){return m.Name}});Object.defineProperty(n,"CodeGen",{enumerable:true,get:function(){return m.CodeGen}});var E=i(3021);Object.defineProperty(n,"ValidationError",{enumerable:true,get:function(){return E.default}});var C=i(3162);Object.defineProperty(n,"MissingRefError",{enumerable:true,get:function(){return C.default}})},2463:(t,n,i)=>{Object.defineProperty(n,"__esModule",{value:true});n.MissingRefError=n.ValidationError=n.CodeGen=n.Name=n.nil=n.stringify=n.str=n._=n.KeywordCxt=n.Ajv=void 0;const a=i(3893);const A=i(9941);const c=i(8886);const l=i(2079);const d=["/properties"];const h="http://json-schema.org/draft-07/schema";class Ajv extends a.default{_addVocabularies(){super._addVocabularies();A.default.forEach(t=>this.addVocabulary(t));if(this.opts.discriminator)this.addKeyword(c.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();if(!this.opts.meta)return;const t=this.opts.$data?this.$dataMetaSchema(l,d):l;this.addMetaSchema(t,h,false);this.refs["http://json-schema.org/schema"]=h}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(h)?h:undefined)}}n.Ajv=Ajv;t.exports=n=Ajv;t.exports.Ajv=Ajv;Object.defineProperty(n,"__esModule",{value:true});n["default"]=Ajv;var f=i(7881);Object.defineProperty(n,"KeywordCxt",{enumerable:true,get:function(){return f.KeywordCxt}});var g=i(1436);Object.defineProperty(n,"_",{enumerable:true,get:function(){return g._}});Object.defineProperty(n,"str",{enumerable:true,get:function(){return g.str}});Object.defineProperty(n,"stringify",{enumerable:true,get:function(){return g.stringify}});Object.defineProperty(n,"nil",{enumerable:true,get:function(){return g.nil}});Object.defineProperty(n,"Name",{enumerable:true,get:function(){return g.Name}});Object.defineProperty(n,"CodeGen",{enumerable:true,get:function(){return g.CodeGen}});var p=i(3021);Object.defineProperty(n,"ValidationError",{enumerable:true,get:function(){return p.default}});var m=i(3162);Object.defineProperty(n,"MissingRefError",{enumerable:true,get:function(){return m.default}})},567:(t,n)=>{Object.defineProperty(n,"__esModule",{value:true});n.regexpCode=n.getEsmExportName=n.getProperty=n.safeStringify=n.stringify=n.strConcat=n.addCodeArg=n.str=n._=n.nil=n._Code=n.Name=n.IDENTIFIER=n._CodeOrName=void 0;class _CodeOrName{}n._CodeOrName=_CodeOrName;n.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class Name extends _CodeOrName{constructor(t){super();if(!n.IDENTIFIER.test(t))throw new Error("CodeGen: name must be a valid identifier");this.str=t}toString(){return this.str}emptyStr(){return false}get names(){return{[this.str]:1}}}n.Name=Name;class _Code extends _CodeOrName{constructor(t){super();this._items=typeof t==="string"?[t]:t}toString(){return this.str}emptyStr(){if(this._items.length>1)return false;const t=this._items[0];return t===""||t==='""'}get str(){var t;return(t=this._str)!==null&&t!==void 0?t:this._str=this._items.reduce((t,n)=>`${t}${n}`,"")}get names(){var t;return(t=this._names)!==null&&t!==void 0?t:this._names=this._items.reduce((t,n)=>{if(n instanceof Name)t[n.str]=(t[n.str]||0)+1;return t},{})}}n._Code=_Code;n.nil=new _Code("");function _(t,...n){const i=[t[0]];let a=0;while(a{Object.defineProperty(n,"__esModule",{value:true});n.or=n.and=n.not=n.CodeGen=n.operators=n.varKinds=n.ValueScopeName=n.ValueScope=n.Scope=n.Name=n.regexpCode=n.stringify=n.getProperty=n.nil=n.strConcat=n.str=n._=void 0;const a=i(567);const A=i(7788);var c=i(567);Object.defineProperty(n,"_",{enumerable:true,get:function(){return c._}});Object.defineProperty(n,"str",{enumerable:true,get:function(){return c.str}});Object.defineProperty(n,"strConcat",{enumerable:true,get:function(){return c.strConcat}});Object.defineProperty(n,"nil",{enumerable:true,get:function(){return c.nil}});Object.defineProperty(n,"getProperty",{enumerable:true,get:function(){return c.getProperty}});Object.defineProperty(n,"stringify",{enumerable:true,get:function(){return c.stringify}});Object.defineProperty(n,"regexpCode",{enumerable:true,get:function(){return c.regexpCode}});Object.defineProperty(n,"Name",{enumerable:true,get:function(){return c.Name}});var l=i(7788);Object.defineProperty(n,"Scope",{enumerable:true,get:function(){return l.Scope}});Object.defineProperty(n,"ValueScope",{enumerable:true,get:function(){return l.ValueScope}});Object.defineProperty(n,"ValueScopeName",{enumerable:true,get:function(){return l.ValueScopeName}});Object.defineProperty(n,"varKinds",{enumerable:true,get:function(){return l.varKinds}});n.operators={GT:new a._Code(">"),GTE:new a._Code(">="),LT:new a._Code("<"),LTE:new a._Code("<="),EQ:new a._Code("==="),NEQ:new a._Code("!=="),NOT:new a._Code("!"),OR:new a._Code("||"),AND:new a._Code("&&"),ADD:new a._Code("+")};class Node{optimizeNodes(){return this}optimizeNames(t,n){return this}}class Def extends Node{constructor(t,n,i){super();this.varKind=t;this.name=n;this.rhs=i}render({es5:t,_n:n}){const i=t?A.varKinds.var:this.varKind;const a=this.rhs===undefined?"":` = ${this.rhs}`;return`${i} ${this.name}${a};`+n}optimizeNames(t,n){if(!t[this.name.str])return;if(this.rhs)this.rhs=optimizeExpr(this.rhs,t,n);return this}get names(){return this.rhs instanceof a._CodeOrName?this.rhs.names:{}}}class Assign extends Node{constructor(t,n,i){super();this.lhs=t;this.rhs=n;this.sideEffects=i}render({_n:t}){return`${this.lhs} = ${this.rhs};`+t}optimizeNames(t,n){if(this.lhs instanceof a.Name&&!t[this.lhs.str]&&!this.sideEffects)return;this.rhs=optimizeExpr(this.rhs,t,n);return this}get names(){const t=this.lhs instanceof a.Name?{}:{...this.lhs.names};return addExprNames(t,this.rhs)}}class AssignOp extends Assign{constructor(t,n,i,a){super(t,i,a);this.op=n}render({_n:t}){return`${this.lhs} ${this.op}= ${this.rhs};`+t}}class Label extends Node{constructor(t){super();this.label=t;this.names={}}render({_n:t}){return`${this.label}:`+t}}class Break extends Node{constructor(t){super();this.label=t;this.names={}}render({_n:t}){const n=this.label?` ${this.label}`:"";return`break${n};`+t}}class Throw extends Node{constructor(t){super();this.error=t}render({_n:t}){return`throw ${this.error};`+t}get names(){return this.error.names}}class AnyCode extends Node{constructor(t){super();this.code=t}render({_n:t}){return`${this.code};`+t}optimizeNodes(){return`${this.code}`?this:undefined}optimizeNames(t,n){this.code=optimizeExpr(this.code,t,n);return this}get names(){return this.code instanceof a._CodeOrName?this.code.names:{}}}class ParentNode extends Node{constructor(t=[]){super();this.nodes=t}render(t){return this.nodes.reduce((n,i)=>n+i.render(t),"")}optimizeNodes(){const{nodes:t}=this;let n=t.length;while(n--){const i=t[n].optimizeNodes();if(Array.isArray(i))t.splice(n,1,...i);else if(i)t[n]=i;else t.splice(n,1)}return t.length>0?this:undefined}optimizeNames(t,n){const{nodes:i}=this;let a=i.length;while(a--){const A=i[a];if(A.optimizeNames(t,n))continue;subtractNames(t,A.names);i.splice(a,1)}return i.length>0?this:undefined}get names(){return this.nodes.reduce((t,n)=>addNames(t,n.names),{})}}class BlockNode extends ParentNode{render(t){return"{"+t._n+super.render(t)+"}"+t._n}}class Root extends ParentNode{}class Else extends BlockNode{}Else.kind="else";class If extends BlockNode{constructor(t,n){super(n);this.condition=t}render(t){let n=`if(${this.condition})`+super.render(t);if(this.else)n+="else "+this.else.render(t);return n}optimizeNodes(){super.optimizeNodes();const t=this.condition;if(t===true)return this.nodes;let n=this.else;if(n){const t=n.optimizeNodes();n=this.else=Array.isArray(t)?new Else(t):t}if(n){if(t===false)return n instanceof If?n:n.nodes;if(this.nodes.length)return this;return new If(not(t),n instanceof If?[n]:n.nodes)}if(t===false||!this.nodes.length)return undefined;return this}optimizeNames(t,n){var i;this.else=(i=this.else)===null||i===void 0?void 0:i.optimizeNames(t,n);if(!(super.optimizeNames(t,n)||this.else))return;this.condition=optimizeExpr(this.condition,t,n);return this}get names(){const t=super.names;addExprNames(t,this.condition);if(this.else)addNames(t,this.else.names);return t}}If.kind="if";class For extends BlockNode{}For.kind="for";class ForLoop extends For{constructor(t){super();this.iteration=t}render(t){return`for(${this.iteration})`+super.render(t)}optimizeNames(t,n){if(!super.optimizeNames(t,n))return;this.iteration=optimizeExpr(this.iteration,t,n);return this}get names(){return addNames(super.names,this.iteration.names)}}class ForRange extends For{constructor(t,n,i,a){super();this.varKind=t;this.name=n;this.from=i;this.to=a}render(t){const n=t.es5?A.varKinds.var:this.varKind;const{name:i,from:a,to:c}=this;return`for(${n} ${i}=${a}; ${i}<${c}; ${i}++)`+super.render(t)}get names(){const t=addExprNames(super.names,this.from);return addExprNames(t,this.to)}}class ForIter extends For{constructor(t,n,i,a){super();this.loop=t;this.varKind=n;this.name=i;this.iterable=a}render(t){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(t)}optimizeNames(t,n){if(!super.optimizeNames(t,n))return;this.iterable=optimizeExpr(this.iterable,t,n);return this}get names(){return addNames(super.names,this.iterable.names)}}class Func extends BlockNode{constructor(t,n,i){super();this.name=t;this.args=n;this.async=i}render(t){const n=this.async?"async ":"";return`${n}function ${this.name}(${this.args})`+super.render(t)}}Func.kind="func";class Return extends ParentNode{render(t){return"return "+super.render(t)}}Return.kind="return";class Try extends BlockNode{render(t){let n="try"+super.render(t);if(this.catch)n+=this.catch.render(t);if(this.finally)n+=this.finally.render(t);return n}optimizeNodes(){var t,n;super.optimizeNodes();(t=this.catch)===null||t===void 0?void 0:t.optimizeNodes();(n=this.finally)===null||n===void 0?void 0:n.optimizeNodes();return this}optimizeNames(t,n){var i,a;super.optimizeNames(t,n);(i=this.catch)===null||i===void 0?void 0:i.optimizeNames(t,n);(a=this.finally)===null||a===void 0?void 0:a.optimizeNames(t,n);return this}get names(){const t=super.names;if(this.catch)addNames(t,this.catch.names);if(this.finally)addNames(t,this.finally.names);return t}}class Catch extends BlockNode{constructor(t){super();this.error=t}render(t){return`catch(${this.error})`+super.render(t)}}Catch.kind="catch";class Finally extends BlockNode{render(t){return"finally"+super.render(t)}}Finally.kind="finally";class CodeGen{constructor(t,n={}){this._values={};this._blockStarts=[];this._constants={};this.opts={...n,_n:n.lines?"\n":""};this._extScope=t;this._scope=new A.Scope({parent:t});this._nodes=[new Root]}toString(){return this._root.render(this.opts)}name(t){return this._scope.name(t)}scopeName(t){return this._extScope.name(t)}scopeValue(t,n){const i=this._extScope.value(t,n);const a=this._values[i.prefix]||(this._values[i.prefix]=new Set);a.add(i);return i}getScopeValue(t,n){return this._extScope.getValue(t,n)}scopeRefs(t){return this._extScope.scopeRefs(t,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(t,n,i,a){const A=this._scope.toName(n);if(i!==undefined&&a)this._constants[A.str]=i;this._leafNode(new Def(t,A,i));return A}const(t,n,i){return this._def(A.varKinds.const,t,n,i)}let(t,n,i){return this._def(A.varKinds.let,t,n,i)}var(t,n,i){return this._def(A.varKinds.var,t,n,i)}assign(t,n,i){return this._leafNode(new Assign(t,n,i))}add(t,i){return this._leafNode(new AssignOp(t,n.operators.ADD,i))}code(t){if(typeof t=="function")t();else if(t!==a.nil)this._leafNode(new AnyCode(t));return this}object(...t){const n=["{"];for(const[i,A]of t){if(n.length>1)n.push(",");n.push(i);if(i!==A||this.opts.es5){n.push(":");(0,a.addCodeArg)(n,A)}}n.push("}");return new a._Code(n)}if(t,n,i){this._blockNode(new If(t));if(n&&i){this.code(n).else().code(i).endIf()}else if(n){this.code(n).endIf()}else if(i){throw new Error('CodeGen: "else" body without "then" body')}return this}elseIf(t){return this._elseNode(new If(t))}else(){return this._elseNode(new Else)}endIf(){return this._endBlockNode(If,Else)}_for(t,n){this._blockNode(t);if(n)this.code(n).endFor();return this}for(t,n){return this._for(new ForLoop(t),n)}forRange(t,n,i,a,c=(this.opts.es5?A.varKinds.var:A.varKinds.let)){const l=this._scope.toName(t);return this._for(new ForRange(c,l,n,i),()=>a(l))}forOf(t,n,i,c=A.varKinds.const){const l=this._scope.toName(t);if(this.opts.es5){const t=n instanceof a.Name?n:this.var("_arr",n);return this.forRange("_i",0,(0,a._)`${t}.length`,n=>{this.var(l,(0,a._)`${t}[${n}]`);i(l)})}return this._for(new ForIter("of",c,l,n),()=>i(l))}forIn(t,n,i,c=(this.opts.es5?A.varKinds.var:A.varKinds.const)){if(this.opts.ownProperties){return this.forOf(t,(0,a._)`Object.keys(${n})`,i)}const l=this._scope.toName(t);return this._for(new ForIter("in",c,l,n),()=>i(l))}endFor(){return this._endBlockNode(For)}label(t){return this._leafNode(new Label(t))}break(t){return this._leafNode(new Break(t))}return(t){const n=new Return;this._blockNode(n);this.code(t);if(n.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Return)}try(t,n,i){if(!n&&!i)throw new Error('CodeGen: "try" without "catch" and "finally"');const a=new Try;this._blockNode(a);this.code(t);if(n){const t=this.name("e");this._currNode=a.catch=new Catch(t);n(t)}if(i){this._currNode=a.finally=new Finally;this.code(i)}return this._endBlockNode(Catch,Finally)}throw(t){return this._leafNode(new Throw(t))}block(t,n){this._blockStarts.push(this._nodes.length);if(t)this.code(t).endBlock(n);return this}endBlock(t){const n=this._blockStarts.pop();if(n===undefined)throw new Error("CodeGen: not in self-balancing block");const i=this._nodes.length-n;if(i<0||t!==undefined&&i!==t){throw new Error(`CodeGen: wrong number of nodes: ${i} vs ${t} expected`)}this._nodes.length=n;return this}func(t,n=a.nil,i,A){this._blockNode(new Func(t,n,i));if(A)this.code(A).endFunc();return this}endFunc(){return this._endBlockNode(Func)}optimize(t=1){while(t-- >0){this._root.optimizeNodes();this._root.optimizeNames(this._root.names,this._constants)}}_leafNode(t){this._currNode.nodes.push(t);return this}_blockNode(t){this._currNode.nodes.push(t);this._nodes.push(t)}_endBlockNode(t,n){const i=this._currNode;if(i instanceof t||n&&i instanceof n){this._nodes.pop();return this}throw new Error(`CodeGen: not in block "${n?`${t.kind}/${n.kind}`:t.kind}"`)}_elseNode(t){const n=this._currNode;if(!(n instanceof If)){throw new Error('CodeGen: "else" without "if"')}this._currNode=n.else=t;return this}get _root(){return this._nodes[0]}get _currNode(){const t=this._nodes;return t[t.length-1]}set _currNode(t){const n=this._nodes;n[n.length-1]=t}}n.CodeGen=CodeGen;function addNames(t,n){for(const i in n)t[i]=(t[i]||0)+(n[i]||0);return t}function addExprNames(t,n){return n instanceof a._CodeOrName?addNames(t,n.names):t}function optimizeExpr(t,n,i){if(t instanceof a.Name)return replaceName(t);if(!canOptimize(t))return t;return new a._Code(t._items.reduce((t,n)=>{if(n instanceof a.Name)n=replaceName(n);if(n instanceof a._Code)t.push(...n._items);else t.push(n);return t},[]));function replaceName(t){const a=i[t.str];if(a===undefined||n[t.str]!==1)return t;delete n[t.str];return a}function canOptimize(t){return t instanceof a._Code&&t._items.some(t=>t instanceof a.Name&&n[t.str]===1&&i[t.str]!==undefined)}}function subtractNames(t,n){for(const i in n)t[i]=(t[i]||0)-(n[i]||0)}function not(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,a._)`!${par(t)}`}n.not=not;const d=mappend(n.operators.AND);function and(...t){return t.reduce(d)}n.and=and;const h=mappend(n.operators.OR);function or(...t){return t.reduce(h)}n.or=or;function mappend(t){return(n,i)=>n===a.nil?i:i===a.nil?n:(0,a._)`${par(n)} ${t} ${par(i)}`}function par(t){return t instanceof a.Name?t:(0,a._)`(${t})`}},7788:(t,n,i)=>{Object.defineProperty(n,"__esModule",{value:true});n.ValueScope=n.ValueScopeName=n.Scope=n.varKinds=n.UsedValueState=void 0;const a=i(567);class ValueError extends Error{constructor(t){super(`CodeGen: "code" for ${t} not defined`);this.value=t.value}}var A;(function(t){t[t["Started"]=0]="Started";t[t["Completed"]=1]="Completed"})(A||(n.UsedValueState=A={}));n.varKinds={const:new a.Name("const"),let:new a.Name("let"),var:new a.Name("var")};class Scope{constructor({prefixes:t,parent:n}={}){this._names={};this._prefixes=t;this._parent=n}toName(t){return t instanceof a.Name?t:this.name(t)}name(t){return new a.Name(this._newName(t))}_newName(t){const n=this._names[t]||this._nameGroup(t);return`${t}${n.index++}`}_nameGroup(t){var n,i;if(((i=(n=this._parent)===null||n===void 0?void 0:n._prefixes)===null||i===void 0?void 0:i.has(t))||this._prefixes&&!this._prefixes.has(t)){throw new Error(`CodeGen: prefix "${t}" is not allowed in this scope`)}return this._names[t]={prefix:t,index:0}}}n.Scope=Scope;class ValueScopeName extends a.Name{constructor(t,n){super(n);this.prefix=t}setValue(t,{property:n,itemIndex:i}){this.value=t;this.scopePath=(0,a._)`.${new a.Name(n)}[${i}]`}}n.ValueScopeName=ValueScopeName;const c=(0,a._)`\n`;class ValueScope extends Scope{constructor(t){super(t);this._values={};this._scope=t.scope;this.opts={...t,_n:t.lines?c:a.nil}}get(){return this._scope}name(t){return new ValueScopeName(t,this._newName(t))}value(t,n){var i;if(n.ref===undefined)throw new Error("CodeGen: ref must be passed in value");const a=this.toName(t);const{prefix:A}=a;const c=(i=n.key)!==null&&i!==void 0?i:n.ref;let l=this._values[A];if(l){const t=l.get(c);if(t)return t}else{l=this._values[A]=new Map}l.set(c,a);const d=this._scope[A]||(this._scope[A]=[]);const h=d.length;d[h]=n.ref;a.setValue(n,{property:A,itemIndex:h});return a}getValue(t,n){const i=this._values[t];if(!i)return;return i.get(n)}scopeRefs(t,n=this._values){return this._reduceValues(n,n=>{if(n.scopePath===undefined)throw new Error(`CodeGen: name "${n}" has no value`);return(0,a._)`${t}${n.scopePath}`})}scopeCode(t=this._values,n,i){return this._reduceValues(t,t=>{if(t.value===undefined)throw new Error(`CodeGen: name "${t}" has no value`);return t.value.code},n,i)}_reduceValues(t,i,c={},l){let d=a.nil;for(const h in t){const f=t[h];if(!f)continue;const g=c[h]=c[h]||new Map;f.forEach(t=>{if(g.has(t))return;g.set(t,A.Started);let c=i(t);if(c){const i=this.opts.es5?n.varKinds.var:n.varKinds.const;d=(0,a._)`${d}${i} ${t} = ${c};${this.opts._n}`}else if(c=l===null||l===void 0?void 0:l(t)){d=(0,a._)`${d}${c}${this.opts._n}`}else{throw new ValueError(t)}g.set(t,A.Completed)})}return d}}n.ValueScope=ValueScope},1283:(t,n,i)=>{Object.defineProperty(n,"__esModule",{value:true});n.extendErrors=n.resetErrorsCount=n.reportExtraError=n.reportError=n.keyword$DataError=n.keywordError=void 0;const a=i(1436);const A=i(4464);const c=i(630);n.keywordError={message:({keyword:t})=>(0,a.str)`must pass "${t}" keyword validation`};n.keyword$DataError={message:({keyword:t,schemaType:n})=>n?(0,a.str)`"${t}" keyword must be ${n} ($data)`:(0,a.str)`"${t}" keyword is invalid ($data)`};function reportError(t,i=n.keywordError,A,c){const{it:l}=t;const{gen:d,compositeRule:h,allErrors:f}=l;const g=errorObjectCode(t,i,A);if(c!==null&&c!==void 0?c:h||f){addError(d,g)}else{returnErrors(l,(0,a._)`[${g}]`)}}n.reportError=reportError;function reportExtraError(t,i=n.keywordError,a){const{it:A}=t;const{gen:l,compositeRule:d,allErrors:h}=A;const f=errorObjectCode(t,i,a);addError(l,f);if(!(d||h)){returnErrors(A,c.default.vErrors)}}n.reportExtraError=reportExtraError;function resetErrorsCount(t,n){t.assign(c.default.errors,n);t.if((0,a._)`${c.default.vErrors} !== null`,()=>t.if(n,()=>t.assign((0,a._)`${c.default.vErrors}.length`,n),()=>t.assign(c.default.vErrors,null)))}n.resetErrorsCount=resetErrorsCount;function extendErrors({gen:t,keyword:n,schemaValue:i,data:A,errsCount:l,it:d}){if(l===undefined)throw new Error("ajv implementation error");const h=t.name("err");t.forRange("i",l,c.default.errors,l=>{t.const(h,(0,a._)`${c.default.vErrors}[${l}]`);t.if((0,a._)`${h}.instancePath === undefined`,()=>t.assign((0,a._)`${h}.instancePath`,(0,a.strConcat)(c.default.instancePath,d.errorPath)));t.assign((0,a._)`${h}.schemaPath`,(0,a.str)`${d.errSchemaPath}/${n}`);if(d.opts.verbose){t.assign((0,a._)`${h}.schema`,i);t.assign((0,a._)`${h}.data`,A)}})}n.extendErrors=extendErrors;function addError(t,n){const i=t.const("err",n);t.if((0,a._)`${c.default.vErrors} === null`,()=>t.assign(c.default.vErrors,(0,a._)`[${i}]`),(0,a._)`${c.default.vErrors}.push(${i})`);t.code((0,a._)`${c.default.errors}++`)}function returnErrors(t,n){const{gen:i,validateName:A,schemaEnv:c}=t;if(c.$async){i.throw((0,a._)`new ${t.ValidationError}(${n})`)}else{i.assign((0,a._)`${A}.errors`,n);i.return(false)}}const l={keyword:new a.Name("keyword"),schemaPath:new a.Name("schemaPath"),params:new a.Name("params"),propertyName:new a.Name("propertyName"),message:new a.Name("message"),schema:new a.Name("schema"),parentSchema:new a.Name("parentSchema")};function errorObjectCode(t,n,i){const{createErrors:A}=t.it;if(A===false)return(0,a._)`{}`;return errorObject(t,n,i)}function errorObject(t,n,i={}){const{gen:a,it:A}=t;const c=[errorInstancePath(A,i),errorSchemaPath(t,i)];extraErrorProps(t,n,c);return a.object(...c)}function errorInstancePath({errorPath:t},{instancePath:n}){const i=n?(0,a.str)`${t}${(0,A.getErrorPath)(n,A.Type.Str)}`:t;return[c.default.instancePath,(0,a.strConcat)(c.default.instancePath,i)]}function errorSchemaPath({keyword:t,it:{errSchemaPath:n}},{schemaPath:i,parentSchema:c}){let d=c?n:(0,a.str)`${n}/${t}`;if(i){d=(0,a.str)`${d}${(0,A.getErrorPath)(i,A.Type.Str)}`}return[l.schemaPath,d]}function extraErrorProps(t,{params:n,message:i},A){const{keyword:d,data:h,schemaValue:f,it:g}=t;const{opts:p,propertyName:m,topSchemaRef:E,schemaPath:C}=g;A.push([l.keyword,d],[l.params,typeof n=="function"?n(t):n||(0,a._)`{}`]);if(p.messages){A.push([l.message,typeof i=="function"?i(t):i])}if(p.verbose){A.push([l.schema,f],[l.parentSchema,(0,a._)`${E}${C}`],[c.default.data,h])}if(m)A.push([l.propertyName,m])}},2718:(t,n,i)=>{Object.defineProperty(n,"__esModule",{value:true});n.resolveSchema=n.getCompilingSchema=n.resolveRef=n.compileSchema=n.SchemaEnv=void 0;const a=i(1436);const A=i(3021);const c=i(630);const l=i(4090);const d=i(4464);const h=i(7881);class SchemaEnv{constructor(t){var n;this.refs={};this.dynamicAnchors={};let i;if(typeof t.schema=="object")i=t.schema;this.schema=t.schema;this.schemaId=t.schemaId;this.root=t.root||this;this.baseId=(n=t.baseId)!==null&&n!==void 0?n:(0,l.normalizeId)(i===null||i===void 0?void 0:i[t.schemaId||"$id"]);this.schemaPath=t.schemaPath;this.localRefs=t.localRefs;this.meta=t.meta;this.$async=i===null||i===void 0?void 0:i.$async;this.refs={}}}n.SchemaEnv=SchemaEnv;function compileSchema(t){const n=getCompilingSchema.call(this,t);if(n)return n;const i=(0,l.getFullPath)(this.opts.uriResolver,t.root.baseId);const{es5:d,lines:f}=this.opts.code;const{ownProperties:g}=this.opts;const p=new a.CodeGen(this.scope,{es5:d,lines:f,ownProperties:g});let m;if(t.$async){m=p.scopeValue("Error",{ref:A.default,code:(0,a._)`require("ajv/dist/runtime/validation_error").default`})}const E=p.scopeName("validate");t.validateName=E;const C={gen:p,allErrors:this.opts.allErrors,data:c.default.data,parentData:c.default.parentData,parentDataProperty:c.default.parentDataProperty,dataNames:[c.default.data],dataPathArr:[a.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:p.scopeValue("schema",this.opts.code.source===true?{ref:t.schema,code:(0,a.stringify)(t.schema)}:{ref:t.schema}),validateName:E,ValidationError:m,schema:t.schema,schemaEnv:t,rootId:i,baseId:t.baseId||i,schemaPath:a.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,a._)`""`,opts:this.opts,self:this};let I;try{this._compilations.add(t);(0,h.validateFunctionCode)(C);p.optimize(this.opts.code.optimize);const n=p.toString();I=`${p.scopeRefs(c.default.scope)}return ${n}`;if(this.opts.code.process)I=this.opts.code.process(I,t);const i=new Function(`${c.default.self}`,`${c.default.scope}`,I);const A=i(this,this.scope.get());this.scope.value(E,{ref:A});A.errors=null;A.schema=t.schema;A.schemaEnv=t;if(t.$async)A.$async=true;if(this.opts.code.source===true){A.source={validateName:E,validateCode:n,scopeValues:p._values}}if(this.opts.unevaluated){const{props:t,items:n}=C;A.evaluated={props:t instanceof a.Name?undefined:t,items:n instanceof a.Name?undefined:n,dynamicProps:t instanceof a.Name,dynamicItems:n instanceof a.Name};if(A.source)A.source.evaluated=(0,a.stringify)(A.evaluated)}t.validate=A;return t}catch(n){delete t.validate;delete t.validateName;if(I)this.logger.error("Error compiling schema, function code:",I);throw n}finally{this._compilations.delete(t)}}n.compileSchema=compileSchema;function resolveRef(t,n,i){var a;i=(0,l.resolveUrl)(this.opts.uriResolver,n,i);const A=t.refs[i];if(A)return A;let c=resolve.call(this,t,i);if(c===undefined){const A=(a=t.localRefs)===null||a===void 0?void 0:a[i];const{schemaId:l}=this.opts;if(A)c=new SchemaEnv({schema:A,schemaId:l,root:t,baseId:n})}if(c===undefined)return;return t.refs[i]=inlineOrCompile.call(this,c)}n.resolveRef=resolveRef;function inlineOrCompile(t){if((0,l.inlineRef)(t.schema,this.opts.inlineRefs))return t.schema;return t.validate?t:compileSchema.call(this,t)}function getCompilingSchema(t){for(const n of this._compilations){if(sameSchemaEnv(n,t))return n}}n.getCompilingSchema=getCompilingSchema;function sameSchemaEnv(t,n){return t.schema===n.schema&&t.root===n.root&&t.baseId===n.baseId}function resolve(t,n){let i;while(typeof(i=this.refs[n])=="string")n=i;return i||this.schemas[n]||resolveSchema.call(this,t,n)}function resolveSchema(t,n){const i=this.opts.uriResolver.parse(n);const a=(0,l._getFullPath)(this.opts.uriResolver,i);let A=(0,l.getFullPath)(this.opts.uriResolver,t.baseId,undefined);if(Object.keys(t.schema).length>0&&a===A){return getJsonPointer.call(this,i,t)}const c=(0,l.normalizeId)(a);const d=this.refs[c]||this.schemas[c];if(typeof d=="string"){const n=resolveSchema.call(this,t,d);if(typeof(n===null||n===void 0?void 0:n.schema)!=="object")return;return getJsonPointer.call(this,i,n)}if(typeof(d===null||d===void 0?void 0:d.schema)!=="object")return;if(!d.validate)compileSchema.call(this,d);if(c===(0,l.normalizeId)(n)){const{schema:n}=d;const{schemaId:i}=this.opts;const a=n[i];if(a)A=(0,l.resolveUrl)(this.opts.uriResolver,A,a);return new SchemaEnv({schema:n,schemaId:i,root:t,baseId:A})}return getJsonPointer.call(this,i,d)}n.resolveSchema=resolveSchema;const f=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function getJsonPointer(t,{baseId:n,schema:i,root:a}){var A;if(((A=t.fragment)===null||A===void 0?void 0:A[0])!=="/")return;for(const a of t.fragment.slice(1).split("/")){if(typeof i==="boolean")return;const t=i[(0,d.unescapeFragment)(a)];if(t===undefined)return;i=t;const A=typeof i==="object"&&i[this.opts.schemaId];if(!f.has(a)&&A){n=(0,l.resolveUrl)(this.opts.uriResolver,n,A)}}let c;if(typeof i!="boolean"&&i.$ref&&!(0,d.schemaHasRulesButRef)(i,this.RULES)){const t=(0,l.resolveUrl)(this.opts.uriResolver,n,i.$ref);c=resolveSchema.call(this,a,t)}const{schemaId:h}=this.opts;c=c||new SchemaEnv({schema:i,schemaId:h,root:a,baseId:n});if(c.schema!==c.root.schema)return c;return undefined}},630:(t,n,i)=>{Object.defineProperty(n,"__esModule",{value:true});const a=i(1436);const A={data:new a.Name("data"),valCxt:new a.Name("valCxt"),instancePath:new a.Name("instancePath"),parentData:new a.Name("parentData"),parentDataProperty:new a.Name("parentDataProperty"),rootData:new a.Name("rootData"),dynamicAnchors:new a.Name("dynamicAnchors"),vErrors:new a.Name("vErrors"),errors:new a.Name("errors"),this:new a.Name("this"),self:new a.Name("self"),scope:new a.Name("scope"),json:new a.Name("json"),jsonPos:new a.Name("jsonPos"),jsonLen:new a.Name("jsonLen"),jsonPart:new a.Name("jsonPart")};n["default"]=A},3162:(t,n,i)=>{Object.defineProperty(n,"__esModule",{value:true});const a=i(4090);class MissingRefError extends Error{constructor(t,n,i,A){super(A||`can't resolve reference ${i} from id ${n}`);this.missingRef=(0,a.resolveUrl)(t,n,i);this.missingSchema=(0,a.normalizeId)((0,a.getFullPath)(t,this.missingRef))}}n["default"]=MissingRefError},4090:(t,n,i)=>{Object.defineProperty(n,"__esModule",{value:true});n.getSchemaRefs=n.resolveUrl=n.normalizeId=n._getFullPath=n.getFullPath=n.inlineRef=void 0;const a=i(4464);const A=i(3430);const c=i(1167);const l=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function inlineRef(t,n=true){if(typeof t=="boolean")return true;if(n===true)return!hasRef(t);if(!n)return false;return countKeys(t)<=n}n.inlineRef=inlineRef;const d=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function hasRef(t){for(const n in t){if(d.has(n))return true;const i=t[n];if(Array.isArray(i)&&i.some(hasRef))return true;if(typeof i=="object"&&hasRef(i))return true}return false}function countKeys(t){let n=0;for(const i in t){if(i==="$ref")return Infinity;n++;if(l.has(i))continue;if(typeof t[i]=="object"){(0,a.eachItem)(t[i],t=>n+=countKeys(t))}if(n===Infinity)return Infinity}return n}function getFullPath(t,n="",i){if(i!==false)n=normalizeId(n);const a=t.parse(n);return _getFullPath(t,a)}n.getFullPath=getFullPath;function _getFullPath(t,n){const i=t.serialize(n);return i.split("#")[0]+"#"}n._getFullPath=_getFullPath;const h=/#\/?$/;function normalizeId(t){return t?t.replace(h,""):""}n.normalizeId=normalizeId;function resolveUrl(t,n,i){i=normalizeId(i);return t.resolve(n,i)}n.resolveUrl=resolveUrl;const f=/^[a-z_][-a-z0-9._]*$/i;function getSchemaRefs(t,n){if(typeof t=="boolean")return{};const{schemaId:i,uriResolver:a}=this.opts;const l=normalizeId(t[i]||n);const d={"":l};const h=getFullPath(a,l,false);const g={};const p=new Set;c(t,{allKeys:true},(t,n,a,A)=>{if(A===undefined)return;const c=h+n;let l=d[A];if(typeof t[i]=="string")l=addRef.call(this,t[i]);addAnchor.call(this,t.$anchor);addAnchor.call(this,t.$dynamicAnchor);d[n]=l;function addRef(n){const i=this.opts.uriResolver.resolve;n=normalizeId(l?i(l,n):n);if(p.has(n))throw ambiguos(n);p.add(n);let a=this.refs[n];if(typeof a=="string")a=this.refs[a];if(typeof a=="object"){checkAmbiguosRef(t,a.schema,n)}else if(n!==normalizeId(c)){if(n[0]==="#"){checkAmbiguosRef(t,g[n],n);g[n]=t}else{this.refs[n]=c}}return n}function addAnchor(t){if(typeof t=="string"){if(!f.test(t))throw new Error(`invalid anchor "${t}"`);addRef.call(this,`#${t}`)}}});return g;function checkAmbiguosRef(t,n,i){if(n!==undefined&&!A(t,n))throw ambiguos(i)}function ambiguos(t){return new Error(`reference "${t}" resolves to more than one schema`)}}n.getSchemaRefs=getSchemaRefs},7353:(t,n)=>{Object.defineProperty(n,"__esModule",{value:true});n.getRules=n.isJSONType=void 0;const i=["string","number","integer","boolean","null","object","array"];const a=new Set(i);function isJSONType(t){return typeof t=="string"&&a.has(t)}n.isJSONType=isJSONType;function getRules(){const t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:true,boolean:true,null:true},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}n.getRules=getRules},4464:(t,n,i)=>{Object.defineProperty(n,"__esModule",{value:true});n.checkStrictMode=n.getErrorPath=n.Type=n.useFunc=n.setEvaluated=n.evaluatedPropsToName=n.mergeEvaluated=n.eachItem=n.unescapeJsonPointer=n.escapeJsonPointer=n.escapeFragment=n.unescapeFragment=n.schemaRefOrVal=n.schemaHasRulesButRef=n.schemaHasRules=n.checkUnknownRules=n.alwaysValidSchema=n.toHash=void 0;const a=i(1436);const A=i(567);function toHash(t){const n={};for(const i of t)n[i]=true;return n}n.toHash=toHash;function alwaysValidSchema(t,n){if(typeof n=="boolean")return n;if(Object.keys(n).length===0)return true;checkUnknownRules(t,n);return!schemaHasRules(n,t.self.RULES.all)}n.alwaysValidSchema=alwaysValidSchema;function checkUnknownRules(t,n=t.schema){const{opts:i,self:a}=t;if(!i.strictSchema)return;if(typeof n==="boolean")return;const A=a.RULES.keywords;for(const i in n){if(!A[i])checkStrictMode(t,`unknown keyword: "${i}"`)}}n.checkUnknownRules=checkUnknownRules;function schemaHasRules(t,n){if(typeof t=="boolean")return!t;for(const i in t)if(n[i])return true;return false}n.schemaHasRules=schemaHasRules;function schemaHasRulesButRef(t,n){if(typeof t=="boolean")return!t;for(const i in t)if(i!=="$ref"&&n.all[i])return true;return false}n.schemaHasRulesButRef=schemaHasRulesButRef;function schemaRefOrVal({topSchemaRef:t,schemaPath:n},i,A,c){if(!c){if(typeof i=="number"||typeof i=="boolean")return i;if(typeof i=="string")return(0,a._)`${i}`}return(0,a._)`${t}${n}${(0,a.getProperty)(A)}`}n.schemaRefOrVal=schemaRefOrVal;function unescapeFragment(t){return unescapeJsonPointer(decodeURIComponent(t))}n.unescapeFragment=unescapeFragment;function escapeFragment(t){return encodeURIComponent(escapeJsonPointer(t))}n.escapeFragment=escapeFragment;function escapeJsonPointer(t){if(typeof t=="number")return`${t}`;return t.replace(/~/g,"~0").replace(/\//g,"~1")}n.escapeJsonPointer=escapeJsonPointer;function unescapeJsonPointer(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}n.unescapeJsonPointer=unescapeJsonPointer;function eachItem(t,n){if(Array.isArray(t)){for(const i of t)n(i)}else{n(t)}}n.eachItem=eachItem;function makeMergeEvaluated({mergeNames:t,mergeToName:n,mergeValues:i,resultToName:A}){return(c,l,d,h)=>{const f=d===undefined?l:d instanceof a.Name?(l instanceof a.Name?t(c,l,d):n(c,l,d),d):l instanceof a.Name?(n(c,d,l),l):i(l,d);return h===a.Name&&!(f instanceof a.Name)?A(c,f):f}}n.mergeEvaluated={props:makeMergeEvaluated({mergeNames:(t,n,i)=>t.if((0,a._)`${i} !== true && ${n} !== undefined`,()=>{t.if((0,a._)`${n} === true`,()=>t.assign(i,true),()=>t.assign(i,(0,a._)`${i} || {}`).code((0,a._)`Object.assign(${i}, ${n})`))}),mergeToName:(t,n,i)=>t.if((0,a._)`${i} !== true`,()=>{if(n===true){t.assign(i,true)}else{t.assign(i,(0,a._)`${i} || {}`);setEvaluated(t,i,n)}}),mergeValues:(t,n)=>t===true?true:{...t,...n},resultToName:evaluatedPropsToName}),items:makeMergeEvaluated({mergeNames:(t,n,i)=>t.if((0,a._)`${i} !== true && ${n} !== undefined`,()=>t.assign(i,(0,a._)`${n} === true ? true : ${i} > ${n} ? ${i} : ${n}`)),mergeToName:(t,n,i)=>t.if((0,a._)`${i} !== true`,()=>t.assign(i,n===true?true:(0,a._)`${i} > ${n} ? ${i} : ${n}`)),mergeValues:(t,n)=>t===true?true:Math.max(t,n),resultToName:(t,n)=>t.var("items",n)})};function evaluatedPropsToName(t,n){if(n===true)return t.var("props",true);const i=t.var("props",(0,a._)`{}`);if(n!==undefined)setEvaluated(t,i,n);return i}n.evaluatedPropsToName=evaluatedPropsToName;function setEvaluated(t,n,i){Object.keys(i).forEach(i=>t.assign((0,a._)`${n}${(0,a.getProperty)(i)}`,true))}n.setEvaluated=setEvaluated;const c={};function useFunc(t,n){return t.scopeValue("func",{ref:n,code:c[n.code]||(c[n.code]=new A._Code(n.code))})}n.useFunc=useFunc;var l;(function(t){t[t["Num"]=0]="Num";t[t["Str"]=1]="Str"})(l||(n.Type=l={}));function getErrorPath(t,n,i){if(t instanceof a.Name){const A=n===l.Num;return i?A?(0,a._)`"[" + ${t} + "]"`:(0,a._)`"['" + ${t} + "']"`:A?(0,a._)`"/" + ${t}`:(0,a._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return i?(0,a.getProperty)(t).toString():"/"+escapeJsonPointer(t)}n.getErrorPath=getErrorPath;function checkStrictMode(t,n,i=t.opts.strictSchema){if(!i)return;n=`strict mode: ${n}`;if(i===true)throw new Error(n);t.self.logger.warn(n)}n.checkStrictMode=checkStrictMode},7692:(t,n)=>{Object.defineProperty(n,"__esModule",{value:true});n.shouldUseRule=n.shouldUseGroup=n.schemaHasRulesForType=void 0;function schemaHasRulesForType({schema:t,self:n},i){const a=n.RULES.types[i];return a&&a!==true&&shouldUseGroup(t,a)}n.schemaHasRulesForType=schemaHasRulesForType;function shouldUseGroup(t,n){return n.rules.some(n=>shouldUseRule(t,n))}n.shouldUseGroup=shouldUseGroup;function shouldUseRule(t,n){var i;return t[n.keyword]!==undefined||((i=n.definition.implements)===null||i===void 0?void 0:i.some(n=>t[n]!==undefined))}n.shouldUseRule=shouldUseRule},5346:(t,n,i)=>{Object.defineProperty(n,"__esModule",{value:true});n.boolOrEmptySchema=n.topBoolOrEmptySchema=void 0;const a=i(1283);const A=i(1436);const c=i(630);const l={message:"boolean schema is false"};function topBoolOrEmptySchema(t){const{gen:n,schema:i,validateName:a}=t;if(i===false){falseSchemaError(t,false)}else if(typeof i=="object"&&i.$async===true){n.return(c.default.data)}else{n.assign((0,A._)`${a}.errors`,null);n.return(true)}}n.topBoolOrEmptySchema=topBoolOrEmptySchema;function boolOrEmptySchema(t,n){const{gen:i,schema:a}=t;if(a===false){i.var(n,false);falseSchemaError(t)}else{i.var(n,true)}}n.boolOrEmptySchema=boolOrEmptySchema;function falseSchemaError(t,n){const{gen:i,data:A}=t;const c={gen:i,keyword:"false schema",data:A,schema:false,schemaCode:false,schemaValue:false,params:{},it:t};(0,a.reportError)(c,l,undefined,n)}},6685:(t,n,i)=>{Object.defineProperty(n,"__esModule",{value:true});n.reportTypeError=n.checkDataTypes=n.checkDataType=n.coerceAndCheckDataType=n.getJSONTypes=n.getSchemaTypes=n.DataType=void 0;const a=i(7353);const A=i(7692);const c=i(1283);const l=i(1436);const d=i(4464);var h;(function(t){t[t["Correct"]=0]="Correct";t[t["Wrong"]=1]="Wrong"})(h||(n.DataType=h={}));function getSchemaTypes(t){const n=getJSONTypes(t.type);const i=n.includes("null");if(i){if(t.nullable===false)throw new Error("type: null contradicts nullable: false")}else{if(!n.length&&t.nullable!==undefined){throw new Error('"nullable" cannot be used without "type"')}if(t.nullable===true)n.push("null")}return n}n.getSchemaTypes=getSchemaTypes;function getJSONTypes(t){const n=Array.isArray(t)?t:t?[t]:[];if(n.every(a.isJSONType))return n;throw new Error("type must be JSONType or JSONType[]: "+n.join(","))}n.getJSONTypes=getJSONTypes;function coerceAndCheckDataType(t,n){const{gen:i,data:a,opts:c}=t;const l=coerceToTypes(n,c.coerceTypes);const d=n.length>0&&!(l.length===0&&n.length===1&&(0,A.schemaHasRulesForType)(t,n[0]));if(d){const A=checkDataTypes(n,a,c.strictNumbers,h.Wrong);i.if(A,()=>{if(l.length)coerceData(t,n,l);else reportTypeError(t)})}return d}n.coerceAndCheckDataType=coerceAndCheckDataType;const f=new Set(["string","number","integer","boolean","null"]);function coerceToTypes(t,n){return n?t.filter(t=>f.has(t)||n==="array"&&t==="array"):[]}function coerceData(t,n,i){const{gen:a,data:A,opts:c}=t;const d=a.let("dataType",(0,l._)`typeof ${A}`);const h=a.let("coerced",(0,l._)`undefined`);if(c.coerceTypes==="array"){a.if((0,l._)`${d} == 'object' && Array.isArray(${A}) && ${A}.length == 1`,()=>a.assign(A,(0,l._)`${A}[0]`).assign(d,(0,l._)`typeof ${A}`).if(checkDataTypes(n,A,c.strictNumbers),()=>a.assign(h,A)))}a.if((0,l._)`${h} !== undefined`);for(const t of i){if(f.has(t)||t==="array"&&c.coerceTypes==="array"){coerceSpecificType(t)}}a.else();reportTypeError(t);a.endIf();a.if((0,l._)`${h} !== undefined`,()=>{a.assign(A,h);assignParentData(t,h)});function coerceSpecificType(t){switch(t){case"string":a.elseIf((0,l._)`${d} == "number" || ${d} == "boolean"`).assign(h,(0,l._)`"" + ${A}`).elseIf((0,l._)`${A} === null`).assign(h,(0,l._)`""`);return;case"number":a.elseIf((0,l._)`${d} == "boolean" || ${A} === null +import{createRequire as t}from"module";var n={1695:(t,n,i)=>{var a;const{awsEndpointFunctions:A,emitWarningIfUnsupportedVersion:c,createDefaultUserAgentProvider:l,NODE_APP_ID_CONFIG_OPTIONS:d,getAwsRegionExtensionConfiguration:h,resolveAwsRegionExtensionConfiguration:f,resolveUserAgentConfig:g,resolveHostHeaderConfig:p,getUserAgentPlugin:m,getHostHeaderPlugin:E,getLoggerPlugin:C,getRecursionDetectionPlugin:I,setCredentialFeature:y,stsRegionDefaultResolver:B}=i(5152);const{NoAuthSigner:Q,getHttpAuthSchemeEndpointRuleSetPlugin:w,DefaultIdentityProviderConfig:S,getHttpSigningPlugin:b}=i(402);const{normalizeProvider:R,getSmithyContext:v,ServiceException:k,NoOpLogger:D,emitWarningIfUnsupportedVersion:T,loadConfigsForDefaultMode:N,getDefaultExtensionConfiguration:M,resolveDefaultRuntimeConfig:F,Client:x,makeBuilder:U,createAggregatedClient:P}=i(2658);const{Command:L}=i(2658);a=L;a=x;const{resolveDefaultsModeConfig:O,loadConfig:H,NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS:$,NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS:G,NODE_REGION_CONFIG_OPTIONS:V,NODE_REGION_CONFIG_FILE_OPTIONS:Y,resolveRegionConfig:J}=i(7291);const{BinaryDecisionDiagram:W,EndpointCache:q,decideEndpoint:j,customEndpointFunctions:z,resolveParams:K,resolveEndpointConfig:Z,getEndpointPlugin:X}=i(2085);const{parseUrl:ee,getHttpHandlerExtensionConfiguration:te,resolveHttpHandlerRuntimeConfig:re,getContentLengthPlugin:ne}=i(3422);const{DEFAULT_RETRY_MODE:se,NODE_RETRY_MODE_CONFIG_OPTIONS:oe,NODE_MAX_ATTEMPT_CONFIG_OPTIONS:ie,resolveRetryConfig:ae,getRetryPlugin:Ae}=i(3609);const{TypeRegistry:ce,getSchemaSerdePlugin:le}=i(6890);const{resolveAwsSdkSigV4Config:ue,resolveAwsSdkSigV4AConfig:de,AwsSdkSigV4Signer:he,AwsSdkSigV4ASigner:fe,NODE_SIGV4A_CONFIG_OPTIONS:ge,NODE_AUTH_SCHEME_PREFERENCE_OPTIONS:pe}=i(7523);const{SignatureV4MultiRegion:me}=i(5785);const{defaultProvider:Ee}=i(5861);const{toUtf8:Ce,fromUtf8:Ie,toBase64:ye,fromBase64:Be,calculateBodyLength:Qe}=i(2430);const{streamCollector:we,NodeHttpHandler:Se}=i(1279);const{AwsQueryProtocol:be}=i(7288);const{Sha256:Re}=i(9542);const ve="ref";const ke=-1,De=true,Te="isSet",Ne="PartitionResult",Me="booleanEquals",Fe="stringEquals",xe="getAttr",Ue="us-east-1",Pe="sigv4",Le="sts",_e="https://sts.{Region}.{PartitionResult#dnsSuffix}",Oe={[ve]:"Endpoint"},He={[ve]:"Region"},$e={[ve]:Ne},Ge={},Ve=[He];const Ye={conditions:[[Te,[Oe]],[Te,Ve],["aws.partition",Ve,Ne],[Me,[{[ve]:"UseFIPS"},De]],[Me,[{[ve]:"UseDualStack"},De]],[Fe,[He,"aws-global"]],[Me,[{[ve]:"UseGlobalEndpoint"},De]],[Fe,[He,"eu-central-1"]],[Me,[{fn:xe,argv:[$e,"supportsDualStack"]},De]],[Me,[{fn:xe,argv:[$e,"supportsFIPS"]},De]],[Fe,[He,"ap-south-1"]],[Fe,[He,"eu-north-1"]],[Fe,[He,"eu-west-1"]],[Fe,[He,"eu-west-2"]],[Fe,[He,"eu-west-3"]],[Fe,[He,"sa-east-1"]],[Fe,[He,Ue]],[Fe,[He,"us-east-2"]],[Fe,[He,"us-west-2"]],[Fe,[He,"us-west-1"]],[Fe,[He,"ca-central-1"]],[Fe,[He,"ap-southeast-1"]],[Fe,[He,"ap-northeast-1"]],[Fe,[He,"ap-southeast-2"]],[Fe,[{fn:xe,argv:[$e,"name"]},"aws-us-gov"]]],results:[[ke],["https://sts.amazonaws.com",{authSchemes:[{name:Pe,signingName:Le,signingRegion:Ue}]}],[_e,{authSchemes:[{name:Pe,signingName:Le,signingRegion:"{Region}"}]}],[ke,"Invalid Configuration: FIPS and custom endpoint are not supported"],[ke,"Invalid Configuration: Dualstack and custom endpoint are not supported"],[Oe,Ge],["https://sts-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",Ge],[ke,"FIPS and DualStack are enabled, but this partition does not support one or both"],["https://sts.{Region}.amazonaws.com",Ge],["https://sts-fips.{Region}.{PartitionResult#dnsSuffix}",Ge],[ke,"FIPS is enabled but this partition does not support FIPS"],["https://sts.{Region}.{PartitionResult#dualStackDnsSuffix}",Ge],[ke,"DualStack is enabled but this partition does not support DualStack"],[_e,Ge],[ke,"Invalid Configuration: Missing Region"]]};const Je=2;const We=1e8;const qe=new Int32Array([-1,1,-1,0,30,3,1,4,We+14,2,5,We+14,3,25,6,4,24,7,5,We+1,8,6,9,We+13,7,We+1,10,10,We+1,11,11,We+1,12,12,We+1,13,13,We+1,14,14,We+1,15,15,We+1,16,16,We+1,17,17,We+1,18,18,We+1,19,19,We+1,20,20,We+1,21,21,We+1,22,22,We+1,23,23,We+1,We+2,8,We+11,We+12,4,28,26,9,27,We+10,24,We+8,We+9,8,29,We+7,9,We+6,We+7,3,We+3,31,4,We+4,We+5]);const je=W.from(qe,Je,Ye.conditions,Ye.results);const ze=new q({size:50,params:["Endpoint","Region","UseDualStack","UseFIPS","UseGlobalEndpoint"]});const defaultEndpointResolver=(t,n={})=>ze.get(t,()=>j(je,{endpointParams:t,logger:n.logger}));z.aws=A;const createEndpointRuleSetHttpAuthSchemeParametersProvider=t=>async(n,i,a)=>{if(!a){throw new Error("Could not find `input` for `defaultEndpointRuleSetHttpAuthSchemeParametersProvider`")}const A=await t(n,i,a);const c=v(i)?.commandInstance?.constructor?.getEndpointParameterInstructions;if(!c){throw new Error(`getEndpointParameterInstructions() is not defined on '${i.commandName}'`)}const l=await K(a,{getEndpointParameterInstructions:c},n);return Object.assign(A,l)};const _defaultSTSHttpAuthSchemeParametersProvider=async(t,n,i)=>({operation:v(n).operation,region:await R(t.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});const Ke=createEndpointRuleSetHttpAuthSchemeParametersProvider(_defaultSTSHttpAuthSchemeParametersProvider);function createAwsAuthSigv4HttpAuthOption(t){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"sts",region:t.region},propertiesExtractor:(t,n)=>({signingProperties:{config:t,context:n}})}}function createAwsAuthSigv4aHttpAuthOption(t){return{schemeId:"aws.auth#sigv4a",signingProperties:{name:"sts",region:t.region},propertiesExtractor:(t,n)=>({signingProperties:{config:t,context:n}})}}function createSmithyApiNoAuthHttpAuthOption(t){return{schemeId:"smithy.api#noAuth"}}const createEndpointRuleSetHttpAuthSchemeProvider=(t,n,i)=>{const endpointRuleSetHttpAuthSchemeProvider=a=>{const A=t(a);const c=A.properties?.authSchemes;if(!c){return n(a)}const l=[];for(const t of c){const{name:n,properties:A={},...d}=t;const h=n.toLowerCase();if(n!==h){console.warn(`HttpAuthScheme has been normalized with lowercasing: '${n}' to '${h}'`)}let f;if(h==="sigv4a"){f="aws.auth#sigv4a";const t=c.find(t=>{const n=t.name.toLowerCase();return n!=="sigv4a"&&n.startsWith("sigv4")});if(me.sigv4aDependency()==="none"&&t){continue}}else if(h.startsWith("sigv4")){f="aws.auth#sigv4"}else{throw new Error(`Unknown HttpAuthScheme found in '@smithy.rules#endpointRuleSet': '${h}'`)}const g=i[f];if(!g){throw new Error(`Could not find HttpAuthOption create function for '${f}'`)}const p=g(a);p.schemeId=f;p.signingProperties={...p.signingProperties||{},...d,...A};l.push(p)}return l};return endpointRuleSetHttpAuthSchemeProvider};const _defaultSTSHttpAuthSchemeProvider=t=>{const n=[];switch(t.operation){case"AssumeRoleWithSAML":{n.push(createSmithyApiNoAuthHttpAuthOption());n.push(createAwsAuthSigv4aHttpAuthOption(t));break}case"AssumeRoleWithWebIdentity":{n.push(createSmithyApiNoAuthHttpAuthOption());n.push(createAwsAuthSigv4aHttpAuthOption(t));break}default:{n.push(createAwsAuthSigv4HttpAuthOption(t));n.push(createAwsAuthSigv4aHttpAuthOption(t))}}return n};const Ze=createEndpointRuleSetHttpAuthSchemeProvider(defaultEndpointResolver,_defaultSTSHttpAuthSchemeProvider,{"aws.auth#sigv4":createAwsAuthSigv4HttpAuthOption,"aws.auth#sigv4a":createAwsAuthSigv4aHttpAuthOption,"smithy.api#noAuth":createSmithyApiNoAuthHttpAuthOption});const resolveHttpAuthSchemeConfig=t=>{const n=ue(t);const i=de(n);return Object.assign(i,{authSchemePreference:R(t.authSchemePreference??[])})};const resolveClientEndpointParameters=t=>Object.assign(t,{useDualstackEndpoint:t.useDualstackEndpoint??false,useFipsEndpoint:t.useFipsEndpoint??false,useGlobalEndpoint:t.useGlobalEndpoint??false,defaultSigningName:"sts"});const Xe={UseGlobalEndpoint:{type:"builtInParams",name:"useGlobalEndpoint"},UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}};var et="3.1077.0";var tt={version:et};class STSServiceException extends k{constructor(t){super(t);Object.setPrototypeOf(this,STSServiceException.prototype)}}class ExpiredTokenException extends STSServiceException{name="ExpiredTokenException";$fault="client";constructor(t){super({name:"ExpiredTokenException",$fault:"client",...t});Object.setPrototypeOf(this,ExpiredTokenException.prototype)}}class MalformedPolicyDocumentException extends STSServiceException{name="MalformedPolicyDocumentException";$fault="client";constructor(t){super({name:"MalformedPolicyDocumentException",$fault:"client",...t});Object.setPrototypeOf(this,MalformedPolicyDocumentException.prototype)}}class PackedPolicyTooLargeException extends STSServiceException{name="PackedPolicyTooLargeException";$fault="client";constructor(t){super({name:"PackedPolicyTooLargeException",$fault:"client",...t});Object.setPrototypeOf(this,PackedPolicyTooLargeException.prototype)}}class RegionDisabledException extends STSServiceException{name="RegionDisabledException";$fault="client";constructor(t){super({name:"RegionDisabledException",$fault:"client",...t});Object.setPrototypeOf(this,RegionDisabledException.prototype)}}class IDPRejectedClaimException extends STSServiceException{name="IDPRejectedClaimException";$fault="client";constructor(t){super({name:"IDPRejectedClaimException",$fault:"client",...t});Object.setPrototypeOf(this,IDPRejectedClaimException.prototype)}}class InvalidIdentityTokenException extends STSServiceException{name="InvalidIdentityTokenException";$fault="client";constructor(t){super({name:"InvalidIdentityTokenException",$fault:"client",...t});Object.setPrototypeOf(this,InvalidIdentityTokenException.prototype)}}class IDPCommunicationErrorException extends STSServiceException{name="IDPCommunicationErrorException";$fault="client";$retryable={};constructor(t){super({name:"IDPCommunicationErrorException",$fault:"client",...t});Object.setPrototypeOf(this,IDPCommunicationErrorException.prototype)}}class InvalidAuthorizationMessageException extends STSServiceException{name="InvalidAuthorizationMessageException";$fault="client";constructor(t){super({name:"InvalidAuthorizationMessageException",$fault:"client",...t});Object.setPrototypeOf(this,InvalidAuthorizationMessageException.prototype)}}class ExpiredTradeInTokenException extends STSServiceException{name="ExpiredTradeInTokenException";$fault="client";constructor(t){super({name:"ExpiredTradeInTokenException",$fault:"client",...t});Object.setPrototypeOf(this,ExpiredTradeInTokenException.prototype)}}class JWTPayloadSizeExceededException extends STSServiceException{name="JWTPayloadSizeExceededException";$fault="client";constructor(t){super({name:"JWTPayloadSizeExceededException",$fault:"client",...t});Object.setPrototypeOf(this,JWTPayloadSizeExceededException.prototype)}}class OutboundWebIdentityFederationDisabledException extends STSServiceException{name="OutboundWebIdentityFederationDisabledException";$fault="client";constructor(t){super({name:"OutboundWebIdentityFederationDisabledException",$fault:"client",...t});Object.setPrototypeOf(this,OutboundWebIdentityFederationDisabledException.prototype)}}class SessionDurationEscalationException extends STSServiceException{name="SessionDurationEscalationException";$fault="client";constructor(t){super({name:"SessionDurationEscalationException",$fault:"client",...t});Object.setPrototypeOf(this,SessionDurationEscalationException.prototype)}}const rt="Arn";const nt="AccessKeyId";const st="AssumedPrincipal";const ot="AssumeRole";const it="AssumedRoleId";const at="AssumeRoleRequest";const At="AssumeRoleResponse";const ct="AssumeRootRequest";const lt="AssumeRootResponse";const ut="AssumedRoleUser";const dt="AssumeRoleWithSAML";const ht="AssumeRoleWithSAMLRequest";const ft="AssumeRoleWithSAMLResponse";const gt="AssumeRoleWithWebIdentity";const pt="AssumeRoleWithWebIdentityRequest";const mt="AssumeRoleWithWebIdentityResponse";const Et="AssumeRoot";const Ct="Account";const It="Audience";const yt="Credentials";const Bt="ContextAssertion";const Qt="DecodeAuthorizationMessage";const wt="DecodeAuthorizationMessageRequest";const St="DecodeAuthorizationMessageResponse";const bt="DecodedMessage";const Rt="DurationSeconds";const vt="Expiration";const kt="ExternalId";const Dt="EncodedMessage";const Tt="ExpiredTokenException";const Nt="ExpiredTradeInTokenException";const Mt="FederatedUser";const Ft="FederatedUserId";const xt="GetAccessKeyInfo";const Ut="GetAccessKeyInfoRequest";const Pt="GetAccessKeyInfoResponse";const Lt="GetCallerIdentity";const _t="GetCallerIdentityRequest";const Ot="GetCallerIdentityResponse";const Ht="GetDelegatedAccessToken";const $t="GetDelegatedAccessTokenRequest";const Gt="GetDelegatedAccessTokenResponse";const Vt="GetFederationToken";const Yt="GetFederationTokenRequest";const Jt="GetFederationTokenResponse";const Wt="GetSessionToken";const qt="GetSessionTokenRequest";const jt="GetSessionTokenResponse";const zt="GetWebIdentityToken";const Kt="GetWebIdentityTokenRequest";const Zt="GetWebIdentityTokenResponse";const Xt="Issuer";const er="InvalidAuthorizationMessageException";const tr="IDPCommunicationErrorException";const rr="IDPRejectedClaimException";const nr="InvalidIdentityTokenException";const sr="JWTPayloadSizeExceededException";const ir="Key";const ar="MalformedPolicyDocumentException";const Ar="Name";const cr="NameQualifier";const lr="OutboundWebIdentityFederationDisabledException";const ur="Policy";const dr="PolicyArns";const hr="PrincipalArn";const fr="ProviderArn";const gr="ProvidedContexts";const pr="ProvidedContextsListType";const mr="ProvidedContext";const Er="PolicyDescriptorType";const Cr="ProviderId";const Ir="PackedPolicySize";const yr="PackedPolicyTooLargeException";const Br="Provider";const Qr="RoleArn";const wr="RegionDisabledException";const Sr="RoleSessionName";const br="Subject";const Rr="SigningAlgorithm";const vr="SecretAccessKey";const kr="SAMLAssertion";const Dr="SAMLAssertionType";const Tr="SessionDurationEscalationException";const Nr="SubjectFromWebIdentityToken";const Mr="SourceIdentity";const Fr="SerialNumber";const xr="SubjectType";const Ur="SessionToken";const Pr="Tags";const Lr="TokenCode";const _r="TradeInToken";const Or="TargetPrincipal";const Hr="TaskPolicyArn";const $r="TransitiveTagKeys";const Gr="Tag";const Vr="UserId";const Yr="Value";const Jr="WebIdentityToken";const Wr="arn";const qr="accessKeySecretType";const jr="awsQueryError";const zr="client";const Kr="clientTokenType";const Zr="error";const Xr="httpError";const en="message";const tn="policyDescriptorListType";const rn="smithy.ts.sdk.synthetic.com.amazonaws.sts";const nn="tradeInTokenType";const sn="tagListType";const on="webIdentityTokenType";const an="com.amazonaws.sts";const An=ce.for(rn);var cn=[-3,rn,"STSServiceException",0,[],[]];An.registerError(cn,STSServiceException);const ln=ce.for(an);var un=[-3,an,Tt,{[jr]:[`ExpiredTokenException`,400],[Zr]:zr,[Xr]:400},[en],[0]];ln.registerError(un,ExpiredTokenException);var dn=[-3,an,Nt,{[jr]:[`ExpiredTradeInTokenException`,400],[Zr]:zr,[Xr]:400},[en],[0]];ln.registerError(dn,ExpiredTradeInTokenException);var hn=[-3,an,tr,{[jr]:[`IDPCommunicationError`,400],[Zr]:zr,[Xr]:400},[en],[0]];ln.registerError(hn,IDPCommunicationErrorException);var gn=[-3,an,rr,{[jr]:[`IDPRejectedClaim`,403],[Zr]:zr,[Xr]:403},[en],[0]];ln.registerError(gn,IDPRejectedClaimException);var pn=[-3,an,er,{[jr]:[`InvalidAuthorizationMessageException`,400],[Zr]:zr,[Xr]:400},[en],[0]];ln.registerError(pn,InvalidAuthorizationMessageException);var mn=[-3,an,nr,{[jr]:[`InvalidIdentityToken`,400],[Zr]:zr,[Xr]:400},[en],[0]];ln.registerError(mn,InvalidIdentityTokenException);var En=[-3,an,sr,{[jr]:[`JWTPayloadSizeExceededException`,400],[Zr]:zr,[Xr]:400},[en],[0]];ln.registerError(En,JWTPayloadSizeExceededException);var Cn=[-3,an,ar,{[jr]:[`MalformedPolicyDocument`,400],[Zr]:zr,[Xr]:400},[en],[0]];ln.registerError(Cn,MalformedPolicyDocumentException);var In=[-3,an,lr,{[jr]:[`OutboundWebIdentityFederationDisabledException`,403],[Zr]:zr,[Xr]:403},[en],[0]];ln.registerError(In,OutboundWebIdentityFederationDisabledException);var yn=[-3,an,yr,{[jr]:[`PackedPolicyTooLarge`,400],[Zr]:zr,[Xr]:400},[en],[0]];ln.registerError(yn,PackedPolicyTooLargeException);var Bn=[-3,an,wr,{[jr]:[`RegionDisabledException`,403],[Zr]:zr,[Xr]:403},[en],[0]];ln.registerError(Bn,RegionDisabledException);var Qn=[-3,an,Tr,{[jr]:[`SessionDurationEscalationException`,403],[Zr]:zr,[Xr]:403},[en],[0]];ln.registerError(Qn,SessionDurationEscalationException);const wn=[An,ln];var Sn=[0,an,qr,8,0];var bn=[0,an,Kr,8,0];var Rn=[0,an,Dr,8,0];var vn=[0,an,nn,8,0];var kn=[0,an,on,8,0];var Dn=[3,an,ut,0,[it,rt],[0,0],2];var Tn=[3,an,at,0,[Qr,Sr,dr,ur,Rt,Pr,$r,kt,Fr,Lr,Mr,gr],[0,0,()=>ss,0,1,()=>is,64|0,0,0,0,0,()=>os],2];var Nn=[3,an,At,0,[yt,ut,Ir,Mr],[[()=>_n,0],()=>Dn,1,0]];var Mn=[3,an,ht,0,[Qr,hr,kr,dr,ur,Rt],[0,0,[()=>Rn,0],()=>ss,0,1],3];var Fn=[3,an,ft,0,[yt,ut,Ir,br,xr,Xt,It,cr,Mr],[[()=>_n,0],()=>Dn,1,0,0,0,0,0,0]];var xn=[3,an,pt,0,[Qr,Sr,Jr,Cr,dr,ur,Rt],[0,0,[()=>bn,0],0,()=>ss,0,1],3];var Un=[3,an,mt,0,[yt,Nr,ut,Ir,Br,It,Mr],[[()=>_n,0],0,()=>Dn,1,0,0,0]];var Pn=[3,an,ct,0,[Or,Hr,Rt],[0,()=>ts,1],2];var Ln=[3,an,lt,0,[yt,Mr],[[()=>_n,0],0]];var _n=[3,an,yt,0,[nt,vr,Ur,vt],[0,[()=>Sn,0],0,4],4];var On=[3,an,wt,0,[Dt],[0],1];var Hn=[3,an,St,0,[bt],[0]];var $n=[3,an,Mt,0,[Ft,rt],[0,0],2];var Gn=[3,an,Ut,0,[nt],[0],1];var Vn=[3,an,Pt,0,[Ct],[0]];var Yn=[3,an,_t,0,[],[]];var Jn=[3,an,Ot,0,[Vr,Ct,rt],[0,0,0]];var Wn=[3,an,$t,0,[_r],[[()=>vn,0]],1];var qn=[3,an,Gt,0,[yt,Ir,st],[[()=>_n,0],1,0]];var jn=[3,an,Yt,0,[Ar,ur,dr,Rt,Pr],[0,0,()=>ss,1,()=>is],1];var zn=[3,an,Jt,0,[yt,Mt,Ir],[[()=>_n,0],()=>$n,1]];var Kn=[3,an,qt,0,[Rt,Fr,Lr],[1,0,0]];var Zn=[3,an,jt,0,[yt],[[()=>_n,0]]];var Xn=[3,an,Kt,0,[It,Rr,Rt,Pr],[64|0,0,1,()=>is],2];var es=[3,an,Zt,0,[Jr,vt],[[()=>kn,0],4]];var ts=[3,an,Er,0,[Wr],[0]];var rs=[3,an,mr,0,[fr,Bt],[0,0]];var ns=[3,an,Gr,0,[ir,Yr],[0,0],2];var ss=[1,an,tn,0,()=>ts];var os=[1,an,pr,0,()=>rs];var is=[1,an,sn,0,()=>ns];var as=[9,an,ot,0,()=>Tn,()=>Nn];var As=[9,an,dt,0,()=>Mn,()=>Fn];var cs=[9,an,gt,0,()=>xn,()=>Un];var ls=[9,an,Et,0,()=>Pn,()=>Ln];var us=[9,an,Qt,0,()=>On,()=>Hn];var ds=[9,an,xt,0,()=>Gn,()=>Vn];var hs=[9,an,Lt,0,()=>Yn,()=>Jn];var fs=[9,an,Ht,0,()=>Wn,()=>qn];var gs=[9,an,Vt,0,()=>jn,()=>zn];var ps=[9,an,Wt,0,()=>Kn,()=>Zn];var ms=[9,an,zt,0,()=>Xn,()=>es];const getRuntimeConfig$1=t=>({apiVersion:"2011-06-15",base64Decoder:t?.base64Decoder??Be,base64Encoder:t?.base64Encoder??ye,disableHostPrefix:t?.disableHostPrefix??false,endpointProvider:t?.endpointProvider??defaultEndpointResolver,extensions:t?.extensions??[],httpAuthSchemeProvider:t?.httpAuthSchemeProvider??Ze,httpAuthSchemes:t?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:t=>t.getIdentityProvider("aws.auth#sigv4"),signer:new he},{schemeId:"aws.auth#sigv4a",identityProvider:t=>t.getIdentityProvider("aws.auth#sigv4a"),signer:new fe},{schemeId:"smithy.api#noAuth",identityProvider:t=>t.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new Q}],logger:t?.logger??new D,protocol:t?.protocol??be,protocolSettings:t?.protocolSettings??{defaultNamespace:"com.amazonaws.sts",errorTypeRegistries:wn,xmlNamespace:"https://sts.amazonaws.com/doc/2011-06-15/",version:"2011-06-15",serviceTarget:"AWSSecurityTokenServiceV20110615"},serviceId:t?.serviceId??"STS",sha256:t?.sha256??Re,signerConstructor:t?.signerConstructor??me,urlParser:t?.urlParser??ee,utf8Decoder:t?.utf8Decoder??Ie,utf8Encoder:t?.utf8Encoder??Ce});const getRuntimeConfig=t=>{T(process.version);const n=O(t);const defaultConfigProvider=()=>n().then(N);const i=getRuntimeConfig$1(t);c(process.version);const a={profile:t?.profile,logger:i.logger};return{...i,...t,runtime:"node",defaultsMode:n,authSchemePreference:t?.authSchemePreference??H(pe,a),bodyLengthChecker:t?.bodyLengthChecker??Qe,credentialDefaultProvider:t?.credentialDefaultProvider??Ee,defaultUserAgentProvider:t?.defaultUserAgentProvider??l({serviceId:i.serviceId,clientVersion:tt.version}),httpAuthSchemes:t?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:t=>t.getIdentityProvider("aws.auth#sigv4")||(async t=>await Ee(t?.__config||{})()),signer:new he},{schemeId:"aws.auth#sigv4a",identityProvider:t=>t.getIdentityProvider("aws.auth#sigv4a"),signer:new fe},{schemeId:"smithy.api#noAuth",identityProvider:t=>t.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new Q}],maxAttempts:t?.maxAttempts??H(ie,t),region:t?.region??H(V,{...Y,...a}),requestHandler:Se.create(t?.requestHandler??defaultConfigProvider),retryMode:t?.retryMode??H({...oe,default:async()=>(await defaultConfigProvider()).retryMode||se},t),sigv4aSigningRegionSet:t?.sigv4aSigningRegionSet??H(ge,a),streamCollector:t?.streamCollector??we,useDualstackEndpoint:t?.useDualstackEndpoint??H(G,a),useFipsEndpoint:t?.useFipsEndpoint??H($,a),userAgentAppId:t?.userAgentAppId??H(d,a)}};const getHttpAuthExtensionConfiguration=t=>{const n=t.httpAuthSchemes;let i=t.httpAuthSchemeProvider;let a=t.credentials;return{setHttpAuthScheme(t){const i=n.findIndex(n=>n.schemeId===t.schemeId);if(i===-1){n.push(t)}else{n.splice(i,1,t)}},httpAuthSchemes(){return n},setHttpAuthSchemeProvider(t){i=t},httpAuthSchemeProvider(){return i},setCredentials(t){a=t},credentials(){return a}}};const resolveHttpAuthRuntimeConfig=t=>({httpAuthSchemes:t.httpAuthSchemes(),httpAuthSchemeProvider:t.httpAuthSchemeProvider(),credentials:t.credentials()});const resolveRuntimeExtensions=(t,n)=>{const i=Object.assign(h(t),M(t),te(t),getHttpAuthExtensionConfiguration(t));n.forEach(t=>t.configure(i));return Object.assign(t,f(i),F(i),re(i),resolveHttpAuthRuntimeConfig(i))};class STSClient extends x{config;constructor(...[t]){const n=getRuntimeConfig(t||{});super(n);this.initConfig=n;const i=resolveClientEndpointParameters(n);const a=g(i);const A=ae(a);const c=J(A);const l=p(c);const d=Z(l);const h=resolveHttpAuthSchemeConfig(d);const f=resolveRuntimeExtensions(h,t?.extensions||[]);this.config=f;this.middlewareStack.use(le(this.config));this.middlewareStack.use(m(this.config));this.middlewareStack.use(Ae(this.config));this.middlewareStack.use(ne(this.config));this.middlewareStack.use(E(this.config));this.middlewareStack.use(C(this.config));this.middlewareStack.use(I(this.config));this.middlewareStack.use(w(this.config,{httpAuthSchemeParametersProvider:Ke,identityProviderConfigProvider:async t=>new S({"aws.auth#sigv4":t.credentials,"aws.auth#sigv4a":t.credentials})}));this.middlewareStack.use(b(this.config))}destroy(){super.destroy()}}const Es=U(Xe,"AWSSecurityTokenServiceV20110615","STSClient",X);const Cs={};const _mw0=(t,n,i,a)=>[];class AssumeRoleCommand extends(Es(Cs,_mw0,"AssumeRole",as)){}class AssumeRoleWithSAMLCommand extends(Es(Cs,_mw0,"AssumeRoleWithSAML",As)){}class AssumeRoleWithWebIdentityCommand extends(Es(Cs,_mw0,"AssumeRoleWithWebIdentity",cs)){}class AssumeRootCommand extends(Es(Cs,_mw0,"AssumeRoot",ls)){}class DecodeAuthorizationMessageCommand extends(Es(Cs,_mw0,"DecodeAuthorizationMessage",us)){}class GetAccessKeyInfoCommand extends(Es(Cs,_mw0,"GetAccessKeyInfo",ds)){}class GetCallerIdentityCommand extends(Es(Cs,_mw0,"GetCallerIdentity",hs)){}class GetDelegatedAccessTokenCommand extends(Es(Cs,_mw0,"GetDelegatedAccessToken",fs)){}class GetFederationTokenCommand extends(Es(Cs,_mw0,"GetFederationToken",gs)){}class GetSessionTokenCommand extends(Es(Cs,_mw0,"GetSessionToken",ps)){}class GetWebIdentityTokenCommand extends(Es(Cs,_mw0,"GetWebIdentityToken",ms)){}const Is={AssumeRoleCommand:AssumeRoleCommand,AssumeRoleWithSAMLCommand:AssumeRoleWithSAMLCommand,AssumeRoleWithWebIdentityCommand:AssumeRoleWithWebIdentityCommand,AssumeRootCommand:AssumeRootCommand,DecodeAuthorizationMessageCommand:DecodeAuthorizationMessageCommand,GetAccessKeyInfoCommand:GetAccessKeyInfoCommand,GetCallerIdentityCommand:GetCallerIdentityCommand,GetDelegatedAccessTokenCommand:GetDelegatedAccessTokenCommand,GetFederationTokenCommand:GetFederationTokenCommand,GetSessionTokenCommand:GetSessionTokenCommand,GetWebIdentityTokenCommand:GetWebIdentityTokenCommand};class STS extends STSClient{}P(Is,STS);const getAccountIdFromAssumedRoleUser=t=>{if(typeof t?.Arn==="string"){const n=t.Arn.split(":");if(n.length>4&&n[4]!==""){return n[4]}}return undefined};const resolveRegion=async(t,n,i,a={})=>{const A=typeof t==="function"?await t():t;const c=typeof n==="function"?await n():n;let l="";const d=A??c??(l=await B(a)());i?.debug?.("@aws-sdk/client-sts::resolveRegion","accepting first of:",`${A} (credential provider clientConfig)`,`${c} (contextual client)`,`${l} (STS default: AWS_REGION, profile region, or us-east-1)`);return d};const getDefaultRoleAssumer$1=(t,n)=>{let i;let a;return async(A,c)=>{a=A;if(!i){const{logger:A=t?.parentClientConfig?.logger,profile:c=t?.parentClientConfig?.profile,region:l,requestHandler:d=t?.parentClientConfig?.requestHandler,credentialProviderLogger:h,userAgentAppId:f=t?.parentClientConfig?.userAgentAppId}=t;const g=await resolveRegion(l,t?.parentClientConfig?.region,h,{logger:A,profile:c});const p=!isH2(d);i=new n({...t,userAgentAppId:f,profile:c,credentialDefaultProvider:()=>async()=>a,region:g,requestHandler:p?d:undefined,logger:A})}const{Credentials:l,AssumedRoleUser:d}=await i.send(new AssumeRoleCommand(c));if(!l||!l.AccessKeyId||!l.SecretAccessKey){throw new Error(`Invalid response from STS.assumeRole call with role ${c.RoleArn}`)}const h=getAccountIdFromAssumedRoleUser(d);const f={accessKeyId:l.AccessKeyId,secretAccessKey:l.SecretAccessKey,sessionToken:l.SessionToken,expiration:l.Expiration,...l.CredentialScope&&{credentialScope:l.CredentialScope},...h&&{accountId:h}};y(f,"CREDENTIALS_STS_ASSUME_ROLE","i");return f}};const getDefaultRoleAssumerWithWebIdentity$1=(t,n)=>{let i;return async a=>{if(!i){const{logger:a=t?.parentClientConfig?.logger,profile:A=t?.parentClientConfig?.profile,region:c,requestHandler:l=t?.parentClientConfig?.requestHandler,credentialProviderLogger:d,userAgentAppId:h=t?.parentClientConfig?.userAgentAppId}=t;const f=await resolveRegion(c,t?.parentClientConfig?.region,d,{logger:a,profile:A});const g=!isH2(l);i=new n({...t,userAgentAppId:h,profile:A,region:f,requestHandler:g?l:undefined,logger:a})}const{Credentials:A,AssumedRoleUser:c}=await i.send(new AssumeRoleWithWebIdentityCommand(a));if(!A||!A.AccessKeyId||!A.SecretAccessKey){throw new Error(`Invalid response from STS.assumeRoleWithWebIdentity call with role ${a.RoleArn}`)}const l=getAccountIdFromAssumedRoleUser(c);const d={accessKeyId:A.AccessKeyId,secretAccessKey:A.SecretAccessKey,sessionToken:A.SessionToken,expiration:A.Expiration,...A.CredentialScope&&{credentialScope:A.CredentialScope},...l&&{accountId:l}};if(l){y(d,"RESOLVED_ACCOUNT_ID","T")}y(d,"CREDENTIALS_STS_ASSUME_ROLE_WEB_ID","k");return d}};const isH2=t=>t?.metadata?.handlerProtocol==="h2";const getCustomizableStsClientCtor=(t,n)=>{if(!n)return t;else return class CustomizableSTSClient extends t{constructor(t){super(t);for(const t of n){this.middlewareStack.use(t)}}}};const getDefaultRoleAssumer=(t={},n)=>getDefaultRoleAssumer$1(t,getCustomizableStsClientCtor(STSClient,n));const getDefaultRoleAssumerWithWebIdentity=(t={},n)=>getDefaultRoleAssumerWithWebIdentity$1(t,getCustomizableStsClientCtor(STSClient,n));const decorateDefaultCredentialProvider=t=>n=>t({roleAssumer:getDefaultRoleAssumer(n),roleAssumerWithWebIdentity:getDefaultRoleAssumerWithWebIdentity(n),...n});a=as;n.QL=AssumeRoleCommand;a=Tn;a=Nn;a=As;a=AssumeRoleWithSAMLCommand;a=Mn;a=Fn;a=cs;a=AssumeRoleWithWebIdentityCommand;a=xn;a=Un;a=ls;a=AssumeRootCommand;a=Pn;a=Ln;a=Dn;a=_n;a=us;a=DecodeAuthorizationMessageCommand;a=On;a=Hn;a=ExpiredTokenException;a=un;a=ExpiredTradeInTokenException;a=dn;a=$n;a=ds;a=GetAccessKeyInfoCommand;a=Gn;a=Vn;a=hs;a=GetCallerIdentityCommand;a=Yn;a=Jn;a=fs;a=GetDelegatedAccessTokenCommand;a=Wn;a=qn;a=gs;a=GetFederationTokenCommand;a=jn;a=zn;a=ps;a=GetSessionTokenCommand;a=Kn;a=Zn;a=ms;a=GetWebIdentityTokenCommand;a=Xn;a=es;a=IDPCommunicationErrorException;a=hn;a=IDPRejectedClaimException;a=gn;a=InvalidAuthorizationMessageException;a=pn;a=InvalidIdentityTokenException;a=mn;a=JWTPayloadSizeExceededException;a=En;a=MalformedPolicyDocumentException;a=Cn;a=OutboundWebIdentityFederationDisabledException;a=In;a=PackedPolicyTooLargeException;a=yn;a=ts;a=rs;a=RegionDisabledException;a=Bn;a=STS;n.iM=STSClient;a=STSServiceException;a=cn;a=SessionDurationEscalationException;a=Qn;a=ns;a=decorateDefaultCredentialProvider;a=wn;a=getDefaultRoleAssumer;a=getDefaultRoleAssumerWithWebIdentity},4316:(t,n,i)=>{var a;const{awsEndpointFunctions:A,emitWarningIfUnsupportedVersion:c,createDefaultUserAgentProvider:l,NODE_APP_ID_CONFIG_OPTIONS:d,getAwsRegionExtensionConfiguration:h,resolveAwsRegionExtensionConfiguration:f,resolveUserAgentConfig:g,resolveHostHeaderConfig:p,getUserAgentPlugin:m,getHostHeaderPlugin:E,getLoggerPlugin:C,getRecursionDetectionPlugin:I}=i(5152);const{getEndpointDiscoveryPlugin:y,NODE_ENDPOINT_DISCOVERY_CONFIG_OPTIONS:B,resolveEndpointDiscoveryConfig:Q}=i(3688);const{getHttpAuthSchemeEndpointRuleSetPlugin:w,DefaultIdentityProviderConfig:S,getHttpSigningPlugin:b,createPaginator:R}=i(402);const{normalizeProvider:v,getSmithyContext:k,makeBuilder:D,ServiceException:T,NoOpLogger:N,emitWarningIfUnsupportedVersion:M,loadConfigsForDefaultMode:F,getDefaultExtensionConfiguration:x,resolveDefaultRuntimeConfig:U,Client:P,createAggregatedClient:L}=i(2658);const{Command:O}=i(2658);a=O;a=P;const{resolveDefaultsModeConfig:H,loadConfig:$,NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS:G,NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS:V,NODE_REGION_CONFIG_OPTIONS:Y,NODE_REGION_CONFIG_FILE_OPTIONS:J,resolveRegionConfig:W}=i(7291);const{getEndpointPlugin:q,BinaryDecisionDiagram:j,EndpointCache:z,decideEndpoint:K,customEndpointFunctions:Z,resolveEndpointConfig:X}=i(2085);const{parseUrl:ee,getHttpHandlerExtensionConfiguration:te,resolveHttpHandlerRuntimeConfig:re,getContentLengthPlugin:ne}=i(3422);const{DEFAULT_RETRY_MODE:se,NODE_RETRY_MODE_CONFIG_OPTIONS:oe,NODE_MAX_ATTEMPT_CONFIG_OPTIONS:ie,resolveRetryConfig:ae,getRetryPlugin:Ae}=i(3609);const{TypeRegistry:ce,getSchemaSerdePlugin:le}=i(6890);const{resolveAwsSdkSigV4Config:ue,AwsSdkSigV4Signer:de,NODE_AUTH_SCHEME_PREFERENCE_OPTIONS:he}=i(7523);const{defaultProvider:fe}=i(5861);const{toUtf8:ge,fromUtf8:pe,toBase64:me,fromBase64:Ee,calculateBodyLength:Ce}=i(2430);const{streamCollector:Ie,NodeHttpHandler:ye}=i(1279);const{AwsJson1_0Protocol:Be}=i(7288);const{Sha256:Qe}=i(9542);const defaultTimestreamWriteHttpAuthSchemeParametersProvider=async(t,n,i)=>({operation:k(n).operation,region:await v(t.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});function createAwsAuthSigv4HttpAuthOption(t){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"timestream",region:t.region},propertiesExtractor:(t,n)=>({signingProperties:{config:t,context:n}})}}const defaultTimestreamWriteHttpAuthSchemeProvider=t=>{const n=[];switch(t.operation){default:{n.push(createAwsAuthSigv4HttpAuthOption(t))}}return n};const resolveHttpAuthSchemeConfig=t=>{const n=ue(t);return Object.assign(n,{authSchemePreference:v(t.authSchemePreference??[])})};const resolveClientEndpointParameters=t=>Object.assign(t,{useDualstackEndpoint:t.useDualstackEndpoint??false,useFipsEndpoint:t.useFipsEndpoint??false,defaultSigningName:"timestream"});const we={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}};const Se=D(we,"Timestream_20181101","TimestreamWriteClient",q);const be={};const _mw0=(t,n,i,a)=>[y(i,{clientStack:n,options:a,isDiscoveredEndpointRequired:true})];const _mw1=(t,n,i,a)=>[];class TimestreamWriteServiceException extends T{constructor(t){super(t);Object.setPrototypeOf(this,TimestreamWriteServiceException.prototype)}}class AccessDeniedException extends TimestreamWriteServiceException{name="AccessDeniedException";$fault="client";Message;constructor(t){super({name:"AccessDeniedException",$fault:"client",...t});Object.setPrototypeOf(this,AccessDeniedException.prototype);this.Message=t.Message}}class ConflictException extends TimestreamWriteServiceException{name="ConflictException";$fault="client";Message;constructor(t){super({name:"ConflictException",$fault:"client",...t});Object.setPrototypeOf(this,ConflictException.prototype);this.Message=t.Message}}class InternalServerException extends TimestreamWriteServiceException{name="InternalServerException";$fault="server";Message;constructor(t){super({name:"InternalServerException",$fault:"server",...t});Object.setPrototypeOf(this,InternalServerException.prototype);this.Message=t.Message}}class InvalidEndpointException extends TimestreamWriteServiceException{name="InvalidEndpointException";$fault="client";Message;constructor(t){super({name:"InvalidEndpointException",$fault:"client",...t});Object.setPrototypeOf(this,InvalidEndpointException.prototype);this.Message=t.Message}}class ResourceNotFoundException extends TimestreamWriteServiceException{name="ResourceNotFoundException";$fault="client";Message;constructor(t){super({name:"ResourceNotFoundException",$fault:"client",...t});Object.setPrototypeOf(this,ResourceNotFoundException.prototype);this.Message=t.Message}}class ServiceQuotaExceededException extends TimestreamWriteServiceException{name="ServiceQuotaExceededException";$fault="client";Message;constructor(t){super({name:"ServiceQuotaExceededException",$fault:"client",...t});Object.setPrototypeOf(this,ServiceQuotaExceededException.prototype);this.Message=t.Message}}class ThrottlingException extends TimestreamWriteServiceException{name="ThrottlingException";$fault="client";Message;constructor(t){super({name:"ThrottlingException",$fault:"client",...t});Object.setPrototypeOf(this,ThrottlingException.prototype);this.Message=t.Message}}class ValidationException extends TimestreamWriteServiceException{name="ValidationException";$fault="client";Message;constructor(t){super({name:"ValidationException",$fault:"client",...t});Object.setPrototypeOf(this,ValidationException.prototype);this.Message=t.Message}}class RejectedRecordsException extends TimestreamWriteServiceException{name="RejectedRecordsException";$fault="client";Message;RejectedRecords;constructor(t){super({name:"RejectedRecordsException",$fault:"client",...t});Object.setPrototypeOf(this,RejectedRecordsException.prototype);this.Message=t.Message;this.RejectedRecords=t.RejectedRecords}}const Re="Arn";const ve="AccessDeniedException";const ke="Address";const De="BatchLoadProgressReport";const Te="BatchLoadTask";const Ne="BatchLoadTaskDescription";const Me="BatchLoadTaskList";const Fe="BatchLoadTasks";const xe="BytesMetered";const Ue="BucketName";const Pe="CommonAttributes";const Le="CreateBatchLoadTask";const _e="CreateBatchLoadTaskRequest";const Oe="CreateBatchLoadTaskResponse";const He="CsvConfiguration";const $e="CreateDatabase";const Ge="CreateDatabaseRequest";const Ve="CreateDatabaseResponse";const Ye="ConflictException";const Je="CachePeriodInMinutes";const We="CompositePartitionKey";const qe="ClientRequestToken";const je="ColumnSeparator";const ze="CreationTime";const Ke="CreateTableRequest";const Ze="CreateTableResponse";const Xe="ClientToken";const et="CreateTable";const tt="Database";const rt="DescribeBatchLoadTask";const nt="DescribeBatchLoadTaskRequest";const st="DescribeBatchLoadTaskResponse";const ot="DestinationColumn";const it="DeleteDatabase";const at="DeleteDatabaseRequest";const At="DescribeDatabaseRequest";const ct="DescribeDatabaseResponse";const lt="DescribeDatabase";const ut="DescribeEndpoints";const dt="DescribeEndpointsRequest";const ht="DescribeEndpointsResponse";const ft="DataFormat";const gt="DatabaseList";const pt="DataModel";const mt="DataModelConfiguration";const Et="DataModelS3Configuration";const Ct="DimensionMappings";const It="DimensionMapping";const yt="DatabaseName";const Bt="DataSourceConfiguration";const Qt="DataSourceS3Configuration";const wt="DeleteTable";const St="DeleteTableRequest";const bt="DescribeTableRequest";const Rt="DescribeTableResponse";const vt="DescribeTable";const kt="DimensionValueType";const Dt="Databases";const Tt="Dimension";const Nt="Dimensions";const Mt="Endpoints";const Ft="EscapeChar";const xt="EnforcementInRecord";const Ut="ErrorMessage";const Pt="EnableMagneticStoreWrites";const Lt="EncryptionOption";const _t="ExistingVersion";const Ot="Endpoint";const Ht="FileFailures";const $t="InvalidEndpointException";const Gt="InternalServerException";const Vt="Key";const Yt="KmsKeyId";const Jt="ListBatchLoadTasks";const Wt="ListBatchLoadTasksRequest";const qt="ListBatchLoadTasksResponse";const jt="ListDatabases";const zt="ListDatabasesRequest";const Kt="ListDatabasesResponse";const Zt="ListTables";const Xt="ListTagsForResource";const er="ListTagsForResourceRequest";const tr="ListTagsForResourceResponse";const rr="ListTablesRequest";const nr="ListTablesResponse";const sr="LastUpdatedTime";const ir="Message";const ar="MultiMeasureAttributeMappings";const Ar="MultiMeasureAttributeMappingList";const cr="MultiMeasureAttributeMapping";const lr="MultiMeasureMappings";const ur="MixedMeasureMappingList";const dr="MixedMeasureMappings";const hr="MixedMeasureMapping";const fr="MeasureName";const gr="MeasureNameColumn";const pr="MaxResults";const mr="MemoryStore";const Er="MagneticStoreRejectedDataLocation";const Cr="MagneticStoreRetentionPeriodInDays";const Ir="MemoryStoreRetentionPeriodInHours";const yr="MagneticStoreWriteProperties";const Br="MagneticStore";const Qr="MeasureValue";const wr="MeasureValueType";const Sr="MeasureValues";const br="Name";const Rr="NextToken";const vr="NullValue";const kr="ObjectKey";const Dr="ObjectKeyPrefix";const Tr="ParseFailures";const Nr="PartitionKey";const Mr="PartitionKeyList";const Fr="ProgressReport";const xr="QuoteChar";const Ur="Record";const Pr="ResourceARN";const Lr="ResumeBatchLoadTask";const _r="ResumeBatchLoadTaskRequest";const Or="ResumeBatchLoadTaskResponse";const Hr="ReportConfiguration";const $r="RecordsIngested";const Gr="RecordIngestionFailures";const Vr="RecordIndex";const Yr="ResourceNotFoundException";const Jr="RecordsProcessed";const Wr="RetentionProperties";const qr="RejectedRecords";const jr="RejectedRecordsException";const zr="RejectedRecord";const Kr="ReportS3Configuration";const Zr="ResumableUntil";const Xr="RecordVersion";const en="Reason";const tn="Records";const rn="Schema";const nn="SourceColumn";const sn="S3Configuration";const on="ServiceQuotaExceededException";const an="Tags";const An="TableCount";const cn="TimeColumn";const ln="TargetDatabaseName";const un="ThrottlingException";const dn="TaskId";const hn="TagKeys";const gn="TableList";const pn="TagList";const mn="TargetMultiMeasureAttributeName";const En="TargetMultiMeasureName";const Cn="TargetMeasureName";const In="TableName";const yn="TagResource";const Bn="TagResourceRequest";const Qn="TagResourceResponse";const wn="TaskStatus";const Sn="TableStatus";const bn="TargetTableName";const Rn="TimeUnit";const vn="TrimWhiteSpace";const kn="Table";const Dn="Tables";const Tn="Tag";const Nn="Time";const Mn="Total";const Fn="Type";const xn="UpdateDatabase";const Un="UpdateDatabaseRequest";const Pn="UpdateDatabaseResponse";const Ln="UntagResource";const _n="UntagResourceRequest";const On="UntagResourceResponse";const Hn="UpdateTable";const $n="UpdateTableRequest";const Gn="UpdateTableResponse";const Vn="Value";const Yn="ValidationException";const Jn="Version";const Wn="WriteRecords";const qn="WriteRecordsRequest";const jn="WriteRecordsResponse";const zn="client";const Kn="error";const Zn="httpError";const Xn="smithy.ts.sdk.synthetic.com.amazonaws.timestreamwrite";const es="server";const ts="com.amazonaws.timestreamwrite";const rs=ce.for(Xn);var ns=[-3,Xn,"TimestreamWriteServiceException",0,[],[]];rs.registerError(ns,TimestreamWriteServiceException);const ss=ce.for(ts);var os=[-3,ts,ve,{[Kn]:zn,[Zn]:403},[ir],[0],1];ss.registerError(os,AccessDeniedException);var is=[-3,ts,Ye,{[Kn]:zn,[Zn]:409},[ir],[0],1];ss.registerError(is,ConflictException);var as=[-3,ts,Gt,{[Kn]:es,[Zn]:500},[ir],[0],1];ss.registerError(as,InternalServerException);var As=[-3,ts,$t,{[Kn]:zn,[Zn]:421},[ir],[0]];ss.registerError(As,InvalidEndpointException);var cs=[-3,ts,jr,{[Kn]:zn,[Zn]:419},[ir,qr],[0,()=>Oo]];ss.registerError(cs,RejectedRecordsException);var ls=[-3,ts,Yr,{[Kn]:zn,[Zn]:404},[ir],[0]];ss.registerError(ls,ResourceNotFoundException);var us=[-3,ts,on,{[Kn]:zn,[Zn]:402},[ir],[0]];ss.registerError(us,ServiceQuotaExceededException);var ds=[-3,ts,un,{[Kn]:zn,[Zn]:429},[ir],[0],1];ss.registerError(ds,ThrottlingException);var hs=[-3,ts,Yn,{[Kn]:zn,[Zn]:400},[ir],[0],1];ss.registerError(hs,ValidationException);const fs=[rs,ss];var gs=[0,ts,qe,8,0];var ps=[3,ts,De,0,[Jr,$r,Tr,Gr,Ht,xe],[1,1,1,1,1,1]];var ms=[3,ts,Te,0,[dn,wn,yt,In,ze,sr,Zr],[0,0,0,0,4,4,4]];var Es=[3,ts,Ne,0,[dn,Ut,Bt,Fr,Hr,mt,ln,bn,wn,Xr,ze,sr,Zr],[0,0,()=>Ds,()=>ps,()=>co,()=>vs,0,0,0,1,4,4,4]];var Cs=[3,ts,_e,0,[Bt,Hr,ln,bn,Xe,mt,Xr],[()=>Ds,()=>co,0,0,[()=>gs,4],()=>vs,1],4];var Is=[3,ts,Oe,0,[dn],[0],1];var ys=[3,ts,Ge,0,[yt,Yt,an],[0,0,()=>$o],1];var Bs=[3,ts,Ve,0,[tt],[()=>bs]];var Qs=[3,ts,Ke,0,[yt,In,Wr,an,yr,rn],[0,0,()=>fo,()=>$o,()=>eo,()=>po],2];var ws=[3,ts,Ze,0,[kn],[()=>mo]];var Ss=[3,ts,He,0,[je,Ft,xr,vr,vn],[0,0,0,0,2]];var bs=[3,ts,tt,0,[Re,yt,An,Yt,ze,sr],[0,0,1,0,4,4]];var Rs=[3,ts,pt,0,[Ct,cn,Rn,lr,dr,gr],[()=>No,0,0,()=>so,()=>Uo,0],1];var vs=[3,ts,mt,0,[pt,Et],[()=>Rs,()=>ks]];var ks=[3,ts,Et,0,[Ue,kr],[0,0]];var Ds=[3,ts,Bt,0,[Qt,ft,He],[()=>Ts,0,()=>Ss],2];var Ts=[3,ts,Qt,0,[Ue,Dr],[0,0],1];var Ns=[3,ts,at,0,[yt],[0],1];var Ms=[3,ts,St,0,[yt,In],[0,0],2];var Fs=[3,ts,nt,0,[dn],[0],1];var xs=[3,ts,st,0,[Ne],[()=>Es],1];var Us=[3,ts,At,0,[yt],[0],1];var Ps=[3,ts,ct,0,[tt],[()=>bs]];var Ls=[3,ts,dt,0,[],[]];var _s=[3,ts,ht,0,[Mt],[()=>Fo],1];var Os=[3,ts,bt,0,[yt,In],[0,0],2];var Hs=[3,ts,Rt,0,[kn],[()=>mo]];var $s=[3,ts,Tt,0,[br,Vn,kt],[0,0,0],2];var Gs=[3,ts,It,0,[nn,ot],[0,0]];var Vs=[3,ts,Ot,0,[ke,Je],[0,1],2];var Ys=[3,ts,Wt,0,[Rr,pr,wn],[0,1,0]];var Js=[3,ts,qt,0,[Rr,Fe],[0,()=>Do]];var Ws=[3,ts,zt,0,[Rr,pr],[0,1]];var qs=[3,ts,Kt,0,[Dt,Rr],[()=>To,0]];var js=[3,ts,rr,0,[yt,Rr,pr],[0,0,1]];var zs=[3,ts,nr,0,[Dn,Rr],[()=>Ho,0]];var Ks=[3,ts,er,0,[Pr],[0],1];var Zs=[3,ts,tr,0,[an],[()=>$o]];var Xs=[3,ts,Er,0,[sn],[()=>go]];var eo=[3,ts,yr,0,[Pt,Er],[2,()=>Xs],1];var to=[3,ts,Qr,0,[br,Vn,Fn],[0,0,0],3];var ro=[3,ts,hr,0,[wr,fr,nn,Cn,ar],[0,0,0,0,()=>Po],1];var no=[3,ts,cr,0,[nn,mn,wr],[0,0,0],1];var so=[3,ts,lr,0,[ar,En],[()=>Po,0],1];var oo=[3,ts,Nr,0,[Fn,br,xt],[0,0,0],1];var io=[3,ts,Ur,0,[Nt,fr,Qr,wr,Nn,Rn,Jn,Sr],[()=>Mo,0,0,0,0,0,1,()=>xo]];var ao=[3,ts,$r,0,[Mn,mr,Br],[1,1,1]];var Ao=[3,ts,zr,0,[Vr,en,_t],[1,0,1]];var co=[3,ts,Hr,0,[Kr],[()=>lo]];var lo=[3,ts,Kr,0,[Ue,Dr,Lt,Yt],[0,0,0,0],1];var uo=[3,ts,_r,0,[dn],[0],1];var ho=[3,ts,Or,0,[],[]];var fo=[3,ts,Wr,0,[Ir,Cr],[1,1],2];var go=[3,ts,sn,0,[Ue,Dr,Lt,Yt],[0,0,0,0]];var po=[3,ts,rn,0,[We],[()=>Lo]];var mo=[3,ts,kn,0,[Re,In,yt,Sn,Wr,ze,sr,yr,rn],[0,0,0,0,()=>fo,4,4,()=>eo,()=>po]];var Eo=[3,ts,Tn,0,[Vt,Vn],[0,0],2];var Co=[3,ts,Bn,0,[Pr,an],[0,()=>$o],2];var Io=[3,ts,Qn,0,[],[]];var yo=[3,ts,_n,0,[Pr,hn],[0,64|0],2];var Bo=[3,ts,On,0,[],[]];var Qo=[3,ts,Un,0,[yt,Yt],[0,0],2];var wo=[3,ts,Pn,0,[tt],[()=>bs]];var So=[3,ts,$n,0,[yt,In,Wr,yr,rn],[0,0,()=>fo,()=>eo,()=>po],2];var bo=[3,ts,Gn,0,[kn],[()=>mo]];var Ro=[3,ts,qn,0,[yt,In,tn,Pe],[0,0,()=>_o,()=>io],3];var vo=[3,ts,jn,0,[$r],[()=>ao]];var ko="unit";var Do=[1,ts,Me,0,()=>ms];var To=[1,ts,gt,0,()=>bs];var No=[1,ts,Ct,0,()=>Gs];var Mo=[1,ts,Nt,0,()=>$s];var Fo=[1,ts,Mt,0,()=>Vs];var xo=[1,ts,Sr,0,()=>to];var Uo=[1,ts,ur,0,()=>ro];var Po=[1,ts,Ar,0,()=>no];var Lo=[1,ts,Mr,0,()=>oo];var _o=[1,ts,tn,0,()=>io];var Oo=[1,ts,qr,0,()=>Ao];var Ho=[1,ts,gn,0,()=>mo];var $o=[1,ts,pn,0,()=>Eo];var Go=[9,ts,Le,0,()=>Cs,()=>Is];var Vo=[9,ts,$e,0,()=>ys,()=>Bs];var Yo=[9,ts,et,0,()=>Qs,()=>ws];var Jo=[9,ts,it,0,()=>Ns,()=>ko];var Wo=[9,ts,wt,0,()=>Ms,()=>ko];var qo=[9,ts,rt,0,()=>Fs,()=>xs];var jo=[9,ts,lt,0,()=>Us,()=>Ps];var zo=[9,ts,ut,0,()=>Ls,()=>_s];var Ko=[9,ts,vt,0,()=>Os,()=>Hs];var Zo=[9,ts,Jt,0,()=>Ys,()=>Js];var Xo=[9,ts,jt,0,()=>Ws,()=>qs];var ei=[9,ts,Zt,0,()=>js,()=>zs];var ti=[9,ts,Xt,0,()=>Ks,()=>Zs];var ri=[9,ts,Lr,0,()=>uo,()=>ho];var ni=[9,ts,yn,0,()=>Co,()=>Io];var si=[9,ts,Ln,0,()=>yo,()=>Bo];var oi=[9,ts,xn,0,()=>Qo,()=>wo];var ii=[9,ts,Hn,0,()=>So,()=>bo];var ai=[9,ts,Wn,0,()=>Ro,()=>vo];class DescribeEndpointsCommand extends(Se(be,_mw1,"DescribeEndpoints",zo)){}var Ai="3.1077.0";var ci={version:Ai};const li="ref";const ui=-1,di=true,hi="isSet",fi="PartitionResult",gi="booleanEquals",pi="getAttr",mi="stringEquals",Ei={[li]:"Endpoint"},Ci={[li]:fi},Ii={fn:pi,argv:[Ci,"name"]},yi={},Bi=[{[li]:"Region"}];const Qi={conditions:[[hi,[Ei]],[hi,Bi],["aws.partition",Bi,fi],[gi,[{[li]:"UseFIPS"},di]],[gi,[{[li]:"UseDualStack"},di]],[gi,[{fn:pi,argv:[Ci,"supportsFIPS"]},di]],[gi,[{fn:pi,argv:[Ci,"supportsDualStack"]},di]],[mi,[Ii,"aws"]],[mi,[Ii,"aws-us-gov"]]],results:[[ui],[ui,"Invalid Configuration: FIPS and custom endpoint are not supported"],[ui,"Invalid Configuration: Dualstack and custom endpoint are not supported"],[Ei,yi],["https://timestream-ingest-fips.{Region}.api.aws",yi],["https://timestream-ingest.{Region}.api.aws",yi],["https://ingest.timestream-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",yi],[ui,"FIPS and DualStack are enabled, but this partition does not support one or both"],["https://ingest.timestream.{Region}.amazonaws.com",yi],["https://ingest.timestream-fips.{Region}.{PartitionResult#dnsSuffix}",yi],[ui,"FIPS is enabled but this partition does not support FIPS"],["https://ingest.timestream.{Region}.{PartitionResult#dualStackDnsSuffix}",yi],[ui,"DualStack is enabled but this partition does not support DualStack"],["https://ingest.timestream.{Region}.{PartitionResult#dnsSuffix}",yi],[ui,"Invalid Configuration: Missing Region"]]};const wi=2;const Si=1e8;const bi=new Int32Array([-1,1,-1,0,17,3,1,4,Si+14,2,5,Si+14,3,10,6,4,7,Si+13,6,8,Si+12,7,Si+5,9,8,Si+5,Si+11,4,13,11,5,12,Si+10,8,Si+8,Si+9,5,14,Si+7,6,15,Si+7,7,Si+4,16,8,Si+5,Si+6,3,Si+1,18,4,Si+2,Si+3]);const Ri=j.from(bi,wi,Qi.conditions,Qi.results);const vi=new z({size:50,params:["Endpoint","Region","UseDualStack","UseFIPS"]});const defaultEndpointResolver=(t,n={})=>vi.get(t,()=>K(Ri,{endpointParams:t,logger:n.logger}));Z.aws=A;const getRuntimeConfig$1=t=>({apiVersion:"2018-11-01",base64Decoder:t?.base64Decoder??Ee,base64Encoder:t?.base64Encoder??me,disableHostPrefix:t?.disableHostPrefix??false,endpointProvider:t?.endpointProvider??defaultEndpointResolver,extensions:t?.extensions??[],httpAuthSchemeProvider:t?.httpAuthSchemeProvider??defaultTimestreamWriteHttpAuthSchemeProvider,httpAuthSchemes:t?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:t=>t.getIdentityProvider("aws.auth#sigv4"),signer:new de}],logger:t?.logger??new N,protocol:t?.protocol??Be,protocolSettings:t?.protocolSettings??{defaultNamespace:"com.amazonaws.timestreamwrite",errorTypeRegistries:fs,version:"2018-11-01",serviceTarget:"Timestream_20181101"},serviceId:t?.serviceId??"Timestream Write",sha256:t?.sha256??Qe,urlParser:t?.urlParser??ee,utf8Decoder:t?.utf8Decoder??pe,utf8Encoder:t?.utf8Encoder??ge});const getRuntimeConfig=t=>{M(process.version);const n=H(t);const defaultConfigProvider=()=>n().then(F);const i=getRuntimeConfig$1(t);c(process.version);const a={profile:t?.profile,logger:i.logger};return{...i,...t,runtime:"node",defaultsMode:n,authSchemePreference:t?.authSchemePreference??$(he,a),bodyLengthChecker:t?.bodyLengthChecker??Ce,credentialDefaultProvider:t?.credentialDefaultProvider??fe,defaultUserAgentProvider:t?.defaultUserAgentProvider??l({serviceId:i.serviceId,clientVersion:ci.version}),endpointDiscoveryEnabledProvider:t?.endpointDiscoveryEnabledProvider??$(B,a),maxAttempts:t?.maxAttempts??$(ie,t),region:t?.region??$(Y,{...J,...a}),requestHandler:ye.create(t?.requestHandler??defaultConfigProvider),retryMode:t?.retryMode??$({...oe,default:async()=>(await defaultConfigProvider()).retryMode||se},t),streamCollector:t?.streamCollector??Ie,useDualstackEndpoint:t?.useDualstackEndpoint??$(V,a),useFipsEndpoint:t?.useFipsEndpoint??$(G,a),userAgentAppId:t?.userAgentAppId??$(d,a)}};const getHttpAuthExtensionConfiguration=t=>{const n=t.httpAuthSchemes;let i=t.httpAuthSchemeProvider;let a=t.credentials;return{setHttpAuthScheme(t){const i=n.findIndex(n=>n.schemeId===t.schemeId);if(i===-1){n.push(t)}else{n.splice(i,1,t)}},httpAuthSchemes(){return n},setHttpAuthSchemeProvider(t){i=t},httpAuthSchemeProvider(){return i},setCredentials(t){a=t},credentials(){return a}}};const resolveHttpAuthRuntimeConfig=t=>({httpAuthSchemes:t.httpAuthSchemes(),httpAuthSchemeProvider:t.httpAuthSchemeProvider(),credentials:t.credentials()});const resolveRuntimeExtensions=(t,n)=>{const i=Object.assign(h(t),x(t),te(t),getHttpAuthExtensionConfiguration(t));n.forEach(t=>t.configure(i));return Object.assign(t,f(i),U(i),re(i),resolveHttpAuthRuntimeConfig(i))};class TimestreamWriteClient extends P{config;constructor(...[t]){const n=getRuntimeConfig(t||{});super(n);this.initConfig=n;const i=resolveClientEndpointParameters(n);const a=g(i);const A=ae(a);const c=W(A);const l=p(c);const d=X(l);const h=resolveHttpAuthSchemeConfig(d);const f=Q(h,{endpointDiscoveryCommandCtor:DescribeEndpointsCommand});const y=resolveRuntimeExtensions(f,t?.extensions||[]);this.config=y;this.middlewareStack.use(le(this.config));this.middlewareStack.use(m(this.config));this.middlewareStack.use(Ae(this.config));this.middlewareStack.use(ne(this.config));this.middlewareStack.use(E(this.config));this.middlewareStack.use(C(this.config));this.middlewareStack.use(I(this.config));this.middlewareStack.use(w(this.config,{httpAuthSchemeParametersProvider:defaultTimestreamWriteHttpAuthSchemeParametersProvider,identityProviderConfigProvider:async t=>new S({"aws.auth#sigv4":t.credentials})}));this.middlewareStack.use(b(this.config))}destroy(){super.destroy()}}class CreateBatchLoadTaskCommand extends(Se(be,_mw0,"CreateBatchLoadTask",Go)){}class CreateDatabaseCommand extends(Se(be,_mw0,"CreateDatabase",Vo)){}class CreateTableCommand extends(Se(be,_mw0,"CreateTable",Yo)){}class DeleteDatabaseCommand extends(Se(be,_mw0,"DeleteDatabase",Jo)){}class DeleteTableCommand extends(Se(be,_mw0,"DeleteTable",Wo)){}class DescribeBatchLoadTaskCommand extends(Se(be,_mw0,"DescribeBatchLoadTask",qo)){}class DescribeDatabaseCommand extends(Se(be,_mw0,"DescribeDatabase",jo)){}class DescribeTableCommand extends(Se(be,_mw0,"DescribeTable",Ko)){}class ListBatchLoadTasksCommand extends(Se(be,_mw0,"ListBatchLoadTasks",Zo)){}class ListDatabasesCommand extends(Se(be,_mw0,"ListDatabases",Xo)){}class ListTablesCommand extends(Se(be,_mw0,"ListTables",ei)){}class ListTagsForResourceCommand extends(Se(be,_mw0,"ListTagsForResource",ti)){}class ResumeBatchLoadTaskCommand extends(Se(be,_mw0,"ResumeBatchLoadTask",ri)){}class TagResourceCommand extends(Se(be,_mw0,"TagResource",ni)){}class UntagResourceCommand extends(Se(be,_mw0,"UntagResource",si)){}class UpdateDatabaseCommand extends(Se(be,_mw0,"UpdateDatabase",oi)){}class UpdateTableCommand extends(Se(be,_mw0,"UpdateTable",ii)){}class WriteRecordsCommand extends(Se(be,_mw0,"WriteRecords",ai)){}const ki=R(TimestreamWriteClient,ListBatchLoadTasksCommand,"NextToken","NextToken","MaxResults");const Di=R(TimestreamWriteClient,ListDatabasesCommand,"NextToken","NextToken","MaxResults");const Ti=R(TimestreamWriteClient,ListTablesCommand,"NextToken","NextToken","MaxResults");const Ni={CreateBatchLoadTaskCommand:CreateBatchLoadTaskCommand,CreateDatabaseCommand:CreateDatabaseCommand,CreateTableCommand:CreateTableCommand,DeleteDatabaseCommand:DeleteDatabaseCommand,DeleteTableCommand:DeleteTableCommand,DescribeBatchLoadTaskCommand:DescribeBatchLoadTaskCommand,DescribeDatabaseCommand:DescribeDatabaseCommand,DescribeEndpointsCommand:DescribeEndpointsCommand,DescribeTableCommand:DescribeTableCommand,ListBatchLoadTasksCommand:ListBatchLoadTasksCommand,ListDatabasesCommand:ListDatabasesCommand,ListTablesCommand:ListTablesCommand,ListTagsForResourceCommand:ListTagsForResourceCommand,ResumeBatchLoadTaskCommand:ResumeBatchLoadTaskCommand,TagResourceCommand:TagResourceCommand,UntagResourceCommand:UntagResourceCommand,UpdateDatabaseCommand:UpdateDatabaseCommand,UpdateTableCommand:UpdateTableCommand,WriteRecordsCommand:WriteRecordsCommand};const Mi={paginateListBatchLoadTasks:ki,paginateListDatabases:Di,paginateListTables:Ti};class TimestreamWrite extends TimestreamWriteClient{}L(Ni,TimestreamWrite,{paginators:Mi});const Fi={CSV:"CSV"};const xi={CREATED:"CREATED",FAILED:"FAILED",IN_PROGRESS:"IN_PROGRESS",PENDING_RESUME:"PENDING_RESUME",PROGRESS_STOPPED:"PROGRESS_STOPPED",SUCCEEDED:"SUCCEEDED"};const Ui={BIGINT:"BIGINT",BOOLEAN:"BOOLEAN",DOUBLE:"DOUBLE",MULTI:"MULTI",TIMESTAMP:"TIMESTAMP",VARCHAR:"VARCHAR"};const Pi={BIGINT:"BIGINT",BOOLEAN:"BOOLEAN",DOUBLE:"DOUBLE",TIMESTAMP:"TIMESTAMP",VARCHAR:"VARCHAR"};const Li={MICROSECONDS:"MICROSECONDS",MILLISECONDS:"MILLISECONDS",NANOSECONDS:"NANOSECONDS",SECONDS:"SECONDS"};const _i={SSE_KMS:"SSE_KMS",SSE_S3:"SSE_S3"};const Oi={OPTIONAL:"OPTIONAL",REQUIRED:"REQUIRED"};const Hi={DIMENSION:"DIMENSION",MEASURE:"MEASURE"};const $i={ACTIVE:"ACTIVE",DELETING:"DELETING",RESTORING:"RESTORING"};const Gi={VARCHAR:"VARCHAR"};a=AccessDeniedException;a=os;a=Fi;a=ps;a=xi;a=ms;a=Es;a=ConflictException;a=is;a=Go;a=CreateBatchLoadTaskCommand;a=Cs;a=Is;a=Vo;a=CreateDatabaseCommand;a=ys;a=Bs;a=Yo;a=CreateTableCommand;a=Qs;a=ws;a=Ss;a=Rs;a=vs;a=ks;a=Ds;a=Ts;a=bs;a=Jo;a=DeleteDatabaseCommand;a=Ns;a=Wo;a=DeleteTableCommand;a=Ms;a=qo;a=DescribeBatchLoadTaskCommand;a=Fs;a=xs;a=jo;a=DescribeDatabaseCommand;a=Us;a=Ps;a=zo;a=DescribeEndpointsCommand;a=Ls;a=_s;a=Ko;a=DescribeTableCommand;a=Os;a=Hs;a=$s;a=Gs;a=Gi;a=Vs;a=InternalServerException;a=as;a=InvalidEndpointException;a=As;a=Zo;a=ListBatchLoadTasksCommand;a=Ys;a=Js;a=Xo;a=ListDatabasesCommand;a=Ws;a=qs;a=ei;a=ListTablesCommand;a=js;a=zs;a=ti;a=ListTagsForResourceCommand;a=Ks;a=Zs;a=Xs;a=eo;a=to;n.Q3=Ui;a=ro;a=no;a=so;a=oo;a=Oi;a=Hi;a=ao;a=Ao;a=RejectedRecordsException;a=cs;a=co;a=lo;a=ResourceNotFoundException;a=ls;a=ri;a=ResumeBatchLoadTaskCommand;a=uo;a=ho;a=fo;a=go;a=_i;a=Pi;a=po;a=ServiceQuotaExceededException;a=us;a=mo;a=$i;a=Eo;a=ni;a=TagResourceCommand;a=Co;a=Io;a=ThrottlingException;a=ds;n.yr=Li;a=TimestreamWrite;n.Go=TimestreamWriteClient;a=TimestreamWriteServiceException;a=ns;a=si;a=UntagResourceCommand;a=yo;a=Bo;a=oi;a=UpdateDatabaseCommand;a=Qo;a=wo;a=ii;a=UpdateTableCommand;a=So;a=bo;a=ValidationException;a=hs;a=ai;n.Nj=WriteRecordsCommand;a=Ro;a=vo;a=io;a=fs;a=ki;a=Di;a=Ti},5152:(t,n,i)=>{const{Retry:a,RETRY_MODES:A}=i(3609);const{HttpRequest:c,parseUrl:l}=i(3422);const{InvokeStore:d}=i(9320);const{normalizeProvider:h}=i(402);const{platform:f,release:g}=i(8161);const{versions:p,env:m}=i(1708);const{booleanSelector:E,SelectorType:C,loadConfig:I,NODE_REGION_CONFIG_OPTIONS:y,NODE_REGION_CONFIG_FILE_OPTIONS:B}=i(7291);const{REGION_ENV_NAME:Q,REGION_INI_NAME:w,resolveRegionConfig:S}=i(7291);n.NODE_REGION_CONFIG_FILE_OPTIONS=B;n.NODE_REGION_CONFIG_OPTIONS=y;n.REGION_ENV_NAME=Q;n.REGION_INI_NAME=w;n.resolveRegionConfig=S;const{readFile:b}=i(1455);const{normalize:R,sep:v,join:k}=i(6760);const{isValidHostLabel:D,isIpAddress:T,customEndpointFunctions:N}=i(2085);const{EndpointError:M,resolveEndpoint:F}=i(2085);n.EndpointError=M;n.isIpAddress=T;n.resolveEndpoint=F;const x={warningEmitted:false};const emitWarningIfUnsupportedVersion=t=>{if(t&&!x.warningEmitted){if(process.env.AWS_SDK_JS_NODE_VERSION_SUPPORT_WARNING_DISABLED==="true"){x.warningEmitted=true;return}const n=parseInt(t.substring(1,t.indexOf(".")));const i=22;if(n=${i}. You are running node ${t}.\n\nTo continue receiving updates to AWS services, bug fixes,\nand security updates please upgrade to node >=${i}.\n\nMore information can be found at: https://a.co/c895JFp`)}}};const longPollMiddleware=()=>(t,n)=>async i=>{n.__retryLongPoll=true;return t(i)};const U={name:"longPollMiddleware",tags:["RETRY"],step:"initialize",override:true};const getLongPollPlugin=t=>({applyToStack:t=>{t.add(longPollMiddleware(),U)}});function setCredentialFeature(t,n,i){if(!t.$source){t.$source={}}t.$source[n]=i;return t}a.v2026||=typeof process==="object"&&process.env?.AWS_NEW_RETRIES_2026==="true";function setFeature(t,n,i){if(!t.__aws_sdk_context){t.__aws_sdk_context={features:{}}}else if(!t.__aws_sdk_context.features){t.__aws_sdk_context.features={}}t.__aws_sdk_context.features[n]=i}function setTokenFeature(t,n,i){if(!t.$source){t.$source={}}t.$source[n]=i;return t}function resolveHostHeaderConfig(t){return t}const hostHeaderMiddleware=t=>n=>async i=>{if(!c.isInstance(i.request))return n(i);const{request:a}=i;const{handlerProtocol:A=""}=t.requestHandler.metadata||{};if(A.indexOf("h2")>=0&&!a.headers[":authority"]){delete a.headers["host"];a.headers[":authority"]=a.hostname+(a.port?":"+a.port:"")}else if(!a.headers["host"]){let t=a.hostname;if(a.port!=null)t+=`:${a.port}`;a.headers["host"]=t}return n(i)};const P={name:"hostHeaderMiddleware",step:"build",priority:"low",tags:["HOST"],override:true};const getHostHeaderPlugin=t=>({applyToStack:n=>{n.add(hostHeaderMiddleware(t),P)}});const loggerMiddleware=()=>(t,n)=>async i=>{try{const a=await t(i);const{clientName:A,commandName:c,logger:l,dynamoDbDocumentClientOptions:d={}}=n;const{overrideInputFilterSensitiveLog:h,overrideOutputFilterSensitiveLog:f}=d;const g=h??n.inputFilterSensitiveLog;const p=f??n.outputFilterSensitiveLog;const{$metadata:m,...E}=a.output;l?.info?.({clientName:A,commandName:c,input:g(i.input),output:p(E),metadata:m});return a}catch(t){const{clientName:a,commandName:A,logger:c,dynamoDbDocumentClientOptions:l={}}=n;const{overrideInputFilterSensitiveLog:d}=l;const h=d??n.inputFilterSensitiveLog;c?.error?.({clientName:a,commandName:A,input:h(i.input),error:t,metadata:t.$metadata});throw t}};const L={name:"loggerMiddleware",tags:["LOGGER"],step:"initialize",override:true};const getLoggerPlugin=t=>({applyToStack:t=>{t.add(loggerMiddleware(),L)}});const O={step:"build",tags:["RECURSION_DETECTION"],name:"recursionDetectionMiddleware",override:true,priority:"low"};const H="X-Amzn-Trace-Id";const $="AWS_LAMBDA_FUNCTION_NAME";const G="_X_AMZN_TRACE_ID";const recursionDetectionMiddleware=()=>t=>async n=>{const{request:i}=n;if(!c.isInstance(i)){return t(n)}const a=Object.keys(i.headers??{}).find(t=>t.toLowerCase()===H.toLowerCase())??H;if(i.headers.hasOwnProperty(a)){return t(n)}const A=process.env[$];const l=process.env[G];const h=await d.getInstanceAsync();const f=h?.getXRayTraceId();const g=f??l;const nonEmptyString=t=>typeof t==="string"&&t.length>0;if(nonEmptyString(A)&&nonEmptyString(g)){i.headers[H]=g}return t({...n,request:i})};const getRecursionDetectionPlugin=t=>({applyToStack:t=>{t.add(recursionDetectionMiddleware(),O)}});const V=undefined;function isValidUserAgentAppId(t){if(t===undefined){return true}return typeof t==="string"&&t.length<=50}function resolveUserAgentConfig(t){const n=h(t.userAgentAppId??V);const{customUserAgent:i}=t;return Object.assign(t,{customUserAgent:typeof i==="string"?[[i]]:i,userAgentAppId:async()=>{const i=await n();if(!isValidUserAgentAppId(i)){const n=t.logger?.constructor?.name==="NoOpLogger"||!t.logger?console:t.logger;if(typeof i!=="string"){n?.warn("userAgentAppId must be a string or undefined.")}else if(i.length>50){n?.warn("The provided userAgentAppId exceeds the maximum length of 50 characters.")}}return i}})}const Y={partitions:[{id:"aws",outputs:{dnsSuffix:"amazonaws.com",dualStackDnsSuffix:"api.aws",implicitGlobalRegion:"us-east-1",name:"aws",supportsDualStack:true,supportsFIPS:true},regionRegex:"^(us|eu|ap|sa|ca|me|af|il|mx)\\-\\w+\\-\\d+$",regions:{"af-south-1":{description:"Africa (Cape Town)"},"ap-east-1":{description:"Asia Pacific (Hong Kong)"},"ap-east-2":{description:"Asia Pacific (Taipei)"},"ap-northeast-1":{description:"Asia Pacific (Tokyo)"},"ap-northeast-2":{description:"Asia Pacific (Seoul)"},"ap-northeast-3":{description:"Asia Pacific (Osaka)"},"ap-south-1":{description:"Asia Pacific (Mumbai)"},"ap-south-2":{description:"Asia Pacific (Hyderabad)"},"ap-southeast-1":{description:"Asia Pacific (Singapore)"},"ap-southeast-2":{description:"Asia Pacific (Sydney)"},"ap-southeast-3":{description:"Asia Pacific (Jakarta)"},"ap-southeast-4":{description:"Asia Pacific (Melbourne)"},"ap-southeast-5":{description:"Asia Pacific (Malaysia)"},"ap-southeast-6":{description:"Asia Pacific (New Zealand)"},"ap-southeast-7":{description:"Asia Pacific (Thailand)"},"aws-global":{description:"aws global region"},"ca-central-1":{description:"Canada (Central)"},"ca-west-1":{description:"Canada West (Calgary)"},"eu-central-1":{description:"Europe (Frankfurt)"},"eu-central-2":{description:"Europe (Zurich)"},"eu-north-1":{description:"Europe (Stockholm)"},"eu-south-1":{description:"Europe (Milan)"},"eu-south-2":{description:"Europe (Spain)"},"eu-west-1":{description:"Europe (Ireland)"},"eu-west-2":{description:"Europe (London)"},"eu-west-3":{description:"Europe (Paris)"},"il-central-1":{description:"Israel (Tel Aviv)"},"me-central-1":{description:"Middle East (UAE)"},"me-south-1":{description:"Middle East (Bahrain)"},"mx-central-1":{description:"Mexico (Central)"},"sa-east-1":{description:"South America (Sao Paulo)"},"us-east-1":{description:"US East (N. Virginia)"},"us-east-2":{description:"US East (Ohio)"},"us-west-1":{description:"US West (N. California)"},"us-west-2":{description:"US West (Oregon)"}}},{id:"aws-cn",outputs:{dnsSuffix:"amazonaws.com.cn",dualStackDnsSuffix:"api.amazonwebservices.com.cn",implicitGlobalRegion:"cn-northwest-1",name:"aws-cn",supportsDualStack:true,supportsFIPS:true},regionRegex:"^cn\\-\\w+\\-\\d+$",regions:{"aws-cn-global":{description:"aws-cn global region"},"cn-north-1":{description:"China (Beijing)"},"cn-northwest-1":{description:"China (Ningxia)"}}},{id:"aws-eusc",outputs:{dnsSuffix:"amazonaws.eu",dualStackDnsSuffix:"api.amazonwebservices.eu",implicitGlobalRegion:"eusc-de-east-1",name:"aws-eusc",supportsDualStack:true,supportsFIPS:true},regionRegex:"^eusc\\-(de)\\-\\w+\\-\\d+$",regions:{"eusc-de-east-1":{description:"AWS European Sovereign Cloud (Germany)"}}},{id:"aws-iso",outputs:{dnsSuffix:"c2s.ic.gov",dualStackDnsSuffix:"api.aws.ic.gov",implicitGlobalRegion:"us-iso-east-1",name:"aws-iso",supportsDualStack:true,supportsFIPS:true},regionRegex:"^us\\-iso\\-\\w+\\-\\d+$",regions:{"aws-iso-global":{description:"aws-iso global region"},"us-iso-east-1":{description:"US ISO East"},"us-iso-west-1":{description:"US ISO WEST"}}},{id:"aws-iso-b",outputs:{dnsSuffix:"sc2s.sgov.gov",dualStackDnsSuffix:"api.aws.scloud",implicitGlobalRegion:"us-isob-east-1",name:"aws-iso-b",supportsDualStack:true,supportsFIPS:true},regionRegex:"^us\\-isob\\-\\w+\\-\\d+$",regions:{"aws-iso-b-global":{description:"aws-iso-b global region"},"us-isob-east-1":{description:"US ISOB East (Ohio)"},"us-isob-west-1":{description:"US ISOB West"}}},{id:"aws-iso-e",outputs:{dnsSuffix:"cloud.adc-e.uk",dualStackDnsSuffix:"api.cloud-aws.adc-e.uk",implicitGlobalRegion:"eu-isoe-west-1",name:"aws-iso-e",supportsDualStack:true,supportsFIPS:true},regionRegex:"^eu\\-isoe\\-\\w+\\-\\d+$",regions:{"aws-iso-e-global":{description:"aws-iso-e global region"},"eu-isoe-west-1":{description:"EU ISOE West"}}},{id:"aws-iso-f",outputs:{dnsSuffix:"csp.hci.ic.gov",dualStackDnsSuffix:"api.aws.hci.ic.gov",implicitGlobalRegion:"us-isof-south-1",name:"aws-iso-f",supportsDualStack:true,supportsFIPS:true},regionRegex:"^us\\-isof\\-\\w+\\-\\d+$",regions:{"aws-iso-f-global":{description:"aws-iso-f global region"},"us-isof-east-1":{description:"US ISOF EAST"},"us-isof-south-1":{description:"US ISOF SOUTH"}}},{id:"aws-us-gov",outputs:{dnsSuffix:"amazonaws.com",dualStackDnsSuffix:"api.aws",implicitGlobalRegion:"us-gov-west-1",name:"aws-us-gov",supportsDualStack:true,supportsFIPS:true},regionRegex:"^us\\-gov\\-\\w+\\-\\d+$",regions:{"aws-us-gov-global":{description:"aws-us-gov global region"},"us-gov-east-1":{description:"AWS GovCloud (US-East)"},"us-gov-west-1":{description:"AWS GovCloud (US-West)"}}}],version:"1.1"};let J=Y;let W="";const partition=t=>{const{partitions:n}=J;for(const i of n){const{regions:n,outputs:a}=i;for(const[i,A]of Object.entries(n)){if(i===t){return{...a,...A}}}}for(const i of n){const{regionRegex:n,outputs:a}=i;if(new RegExp(n).test(t)){return{...a}}}const i=n.find(t=>t.id==="aws");if(!i){throw new Error("Provided region was not found in the partition array or regex,"+" and default partition with id 'aws' doesn't exist.")}return{...i.outputs}};const setPartitionInfo=(t,n="")=>{J=t;W=n};const useDefaultPartitionInfo=()=>{setPartitionInfo(Y,"")};const getUserAgentPrefix=()=>W;const q=/\d{12}\.ddb/;async function checkFeatures(t,n,i){const a=i.request;if(a?.headers?.["smithy-protocol"]==="rpc-v2-cbor"){setFeature(t,"PROTOCOL_RPC_V2_CBOR","M")}if(typeof n.retryStrategy==="function"){const i=await n.retryStrategy();if(typeof i.mode==="string"){switch(i.mode){case A.ADAPTIVE:setFeature(t,"RETRY_MODE_ADAPTIVE","F");break;case A.STANDARD:setFeature(t,"RETRY_MODE_STANDARD","E");break}}}if(typeof n.accountIdEndpointMode==="function"){const i=t.endpointV2;if(String(i?.url?.hostname).match(q)){setFeature(t,"ACCOUNT_ID_ENDPOINT","O")}switch(await(n.accountIdEndpointMode?.())){case"disabled":setFeature(t,"ACCOUNT_ID_MODE_DISABLED","Q");break;case"preferred":setFeature(t,"ACCOUNT_ID_MODE_PREFERRED","P");break;case"required":setFeature(t,"ACCOUNT_ID_MODE_REQUIRED","R");break}}const c=t.__smithy_context?.selectedHttpAuthScheme?.identity;if(c?.$source){const n=c;if(n.accountId){setFeature(t,"RESOLVED_ACCOUNT_ID","T")}for(const[i,a]of Object.entries(n.$source??{})){setFeature(t,i,a)}}}const j="user-agent";const z="x-amz-user-agent";const K=" ";const Z="/";const X=/[^!$%&'*+\-.^_`|~\w]/g;const ee=/[^!$%&'*+\-.^_`|~\w#]/g;const te="-";const re=1024;function encodeFeatures(t){let n="";for(const i in t){const a=t[i];if(n.length+a.length+1<=re){if(n.length){n+=","+a}else{n+=a}continue}break}return n}const userAgentMiddleware=t=>(n,i)=>async a=>{const{request:A}=a;if(!c.isInstance(A)){return n(a)}const{headers:l}=A;const d=i?.userAgent?.map(escapeUserAgent)||[];const h=(await t.defaultUserAgentProvider()).map(escapeUserAgent);await checkFeatures(i,t,a);const f=i;h.push(`m/${encodeFeatures(Object.assign({},i.__smithy_context?.features,f.__aws_sdk_context?.features))}`);const g=t?.customUserAgent?.map(escapeUserAgent)||[];const p=await t.userAgentAppId();if(p){h.push(escapeUserAgent([`app`,`${p}`]))}const m=getUserAgentPrefix();const E=(m?[m]:[]).concat([...h,...d,...g]).join(K);const C=[...h.filter(t=>t.startsWith("aws-sdk-")),...g].join(K);if(t.runtime!=="browser"){if(C){l[z]=l[z]?`${l[j]} ${C}`:C}l[j]=E}else{l[z]=E}return n({...a,request:A})};const escapeUserAgent=t=>{const n=t[0].split(Z).map(t=>t.replace(X,te)).join(Z);const i=t[1]?.replace(ee,te);const a=n.indexOf(Z);const A=n.substring(0,a);let c=n.substring(a+1);if(A==="api"){c=c.toLowerCase()}return[A,c,i].filter(t=>t&&t.length>0).reduce((t,n,i)=>{switch(i){case 0:return n;case 1:return`${t}/${n}`;default:return`${t}#${n}`}},"")};const ne={name:"getUserAgentMiddleware",step:"build",priority:"low",tags:["SET_USER_AGENT","USER_AGENT"],override:true};const getUserAgentPlugin=t=>({applyToStack:n=>{n.add(userAgentMiddleware(t),ne)}});const getRuntimeUserAgentPair=()=>{const t=["deno","bun","llrt"];for(const n of t){if(p[n]){return[`md/${n}`,p[n]]}}return["md/nodejs",p.node]};const getNodeModulesParentDirs=t=>{const n=process.cwd();if(!t){return[n]}const i=R(t);const a=i.split(v);const A=a.indexOf("node_modules");const c=A!==-1?a.slice(0,A).join(v):i;if(n===c){return[n]}return[c,n]};const se=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*)?$/;const getSanitizedTypeScriptVersion=(t="")=>{const n=t.match(se);if(!n){return undefined}const[i,a,A,c]=[n[1],n[2],n[3],n[4]];return c?`${i}.${a}.${A}-${c}`:`${i}.${a}.${A}`};const oe=["^","~",">=","<=",">","<"];const ie=["latest","beta","dev","rc","insiders","next"];const getSanitizedDevTypeScriptVersion=(t="")=>{if(ie.includes(t)){return t}const n=oe.find(n=>t.startsWith(n))??"";const i=getSanitizedTypeScriptVersion(t.slice(n.length));if(!i){return undefined}return`${n}${i}`};let ae;const Ae=k("node_modules","typescript","package.json");const getTypeScriptUserAgentPair=async()=>{if(ae===null){return undefined}else if(typeof ae==="string"){return["md/tsc",ae]}let t=false;try{t=E(process.env,"AWS_SDK_JS_TYPESCRIPT_DETECTION_DISABLED",C.ENV)||false}catch{}if(t){ae=null;return undefined}const n=typeof __dirname!=="undefined"?__dirname:undefined;const i=getNodeModulesParentDirs(n);let a;for(const t of i){try{const n=k(t,"package.json");const i=await b(n,"utf-8");const{dependencies:A,devDependencies:c}=JSON.parse(i);const l=c?.typescript??A?.typescript;if(typeof l!=="string"){continue}a=l;break}catch{}}if(!a){ae=null;return undefined}let A;for(const t of i){try{const n=k(t,Ae);const i=await b(n,"utf-8");const{version:a}=JSON.parse(i);const c=getSanitizedTypeScriptVersion(a);if(typeof c!=="string"){continue}A=c;break}catch{}}if(A){ae=A;return["md/tsc",ae]}const c=getSanitizedDevTypeScriptVersion(a);if(typeof c!=="string"){ae=null;return undefined}ae=`dev_${c}`;return["md/tsc",ae]};const ce={isCrtAvailable:false};const isCrtAvailable=()=>{if(ce.isCrtAvailable){return["md/crt-avail"]}return null};const createDefaultUserAgentProvider=({serviceId:t,clientVersion:n})=>{const i=getRuntimeUserAgentPair();return async a=>{const A=[["aws-sdk-js",n],["ua","2.1"],[`os/${f()}`,g()],["lang/js"],i];const c=await getTypeScriptUserAgentPair();if(c){A.push(c)}const l=isCrtAvailable();if(l){A.push(l)}if(t){A.push([`api/${t}`,n])}if(m.AWS_EXECUTION_ENV){A.push([`exec-env/${m.AWS_EXECUTION_ENV}`])}const d=await(a?.userAgentAppId?.());const h=d?[...A,[`app/${d}`]]:[...A];return h}};const le=createDefaultUserAgentProvider;const ue="AWS_SDK_UA_APP_ID";const de="sdk_ua_app_id";const he="sdk-ua-app-id";const fe={environmentVariableSelector:t=>t[ue],configFileSelector:t=>t[de]??t[he],default:V};const createUserAgentStringParsingProvider=({serviceId:t,clientVersion:n})=>async a=>{const A=i(9449);const c=A.parse??A.default.parse??(()=>"");const l=typeof window!=="undefined"&&window?.navigator?.userAgent?c(window.navigator.userAgent):undefined;const d=[["aws-sdk-js",n],["ua","2.1"],[`os/${l?.os?.name||"other"}`,l?.os?.version],["lang/js"],["md/browser",`${l?.browser?.name??"unknown"}_${l?.browser?.version??"unknown"}`]];if(t){d.push([`api/${t}`,n])}const h=await(a?.userAgentAppId?.());if(h){d.push([`app/${h}`])}return d};const ge={os(t){if(/iPhone|iPad|iPod/.test(t))return"iOS";if(/Macintosh|Mac OS X/.test(t))return"macOS";if(/Windows NT/.test(t))return"Windows";if(/Android/.test(t))return"Android";if(/Linux/.test(t))return"Linux";return undefined},browser(t){if(/EdgiOS|EdgA|Edg\//.test(t))return"Microsoft Edge";if(/Firefox\//.test(t))return"Firefox";if(/Chrome\//.test(t))return"Chrome";if(/Safari\//.test(t))return"Safari";return undefined}};const isVirtualHostableS3Bucket=(t,n=false)=>{if(n){for(const n of t.split(".")){if(!isVirtualHostableS3Bucket(n)){return false}}return true}if(!D(t)){return false}if(t.length<3||t.length>63){return false}if(t!==t.toLowerCase()){return false}if(T(t)){return false}return true};const pe=":";const me="/";const parseArn=t=>{const n=t.split(pe);if(n.length<6)return null;const[i,a,A,c,l,...d]=n;if(i!=="arn"||a===""||A===""||d.join(pe)==="")return null;const h=d.map(t=>t.split(me)).flat();return{partition:a,service:A,region:c,accountId:l,resourceId:h}};const Ee={isVirtualHostableS3Bucket:isVirtualHostableS3Bucket,parseArn:parseArn,partition:partition};N.aws=Ee;const resolveDefaultAwsRegionalEndpointsConfig=t=>{if(typeof t.endpointProvider!=="function"){throw new Error("@aws-sdk/util-endpoint - endpointProvider and endpoint missing in config for this client.")}const{endpoint:n}=t;if(n===undefined){t.endpoint=async()=>toEndpointV1(t.endpointProvider({Region:typeof t.region==="function"?await t.region():t.region,UseDualStack:typeof t.useDualstackEndpoint==="function"?await t.useDualstackEndpoint():t.useDualstackEndpoint,UseFIPS:typeof t.useFipsEndpoint==="function"?await t.useFipsEndpoint():t.useFipsEndpoint,Endpoint:undefined},{logger:t.logger}))}return t};const toEndpointV1=t=>l(t.url);function stsRegionDefaultResolver(t={}){return I({...y,async default(){if(!Ce.silence){console.warn("@aws-sdk - WARN - default STS region of us-east-1 used. See @aws-sdk/credential-providers README and set a region explicitly.")}return"us-east-1"}},{...B,...t})}const Ce={silence:false};const getAwsRegionExtensionConfiguration=t=>({setRegion(n){t.region=n},region(){return t.region}});const resolveAwsRegionExtensionConfiguration=t=>({region:t.region()});n.DEFAULT_UA_APP_ID=V;n.NODE_APP_ID_CONFIG_OPTIONS=fe;n.UA_APP_ID_ENV_NAME=ue;n.UA_APP_ID_INI_NAME=de;n.awsEndpointFunctions=Ee;n.createDefaultUserAgentProvider=createDefaultUserAgentProvider;n.createUserAgentStringParsingProvider=createUserAgentStringParsingProvider;n.crtAvailability=ce;n.defaultUserAgent=le;n.emitWarningIfUnsupportedVersion=emitWarningIfUnsupportedVersion;n.fallback=ge;n.getAwsRegionExtensionConfiguration=getAwsRegionExtensionConfiguration;n.getHostHeaderPlugin=getHostHeaderPlugin;n.getLoggerPlugin=getLoggerPlugin;n.getLongPollPlugin=getLongPollPlugin;n.getRecursionDetectionPlugin=getRecursionDetectionPlugin;n.getUserAgentMiddlewareOptions=ne;n.getUserAgentPlugin=getUserAgentPlugin;n.getUserAgentPrefix=getUserAgentPrefix;n.hostHeaderMiddleware=hostHeaderMiddleware;n.hostHeaderMiddlewareOptions=P;n.isVirtualHostableS3Bucket=isVirtualHostableS3Bucket;n.loggerMiddleware=loggerMiddleware;n.loggerMiddlewareOptions=L;n.parseArn=parseArn;n.partition=partition;n.recursionDetectionMiddleware=recursionDetectionMiddleware;n.recursionDetectionMiddlewareOptions=O;n.resolveAwsRegionExtensionConfiguration=resolveAwsRegionExtensionConfiguration;n.resolveDefaultAwsRegionalEndpointsConfig=resolveDefaultAwsRegionalEndpointsConfig;n.resolveHostHeaderConfig=resolveHostHeaderConfig;n.resolveUserAgentConfig=resolveUserAgentConfig;n.setCredentialFeature=setCredentialFeature;n.setFeature=setFeature;n.setPartitionInfo=setPartitionInfo;n.setTokenFeature=setTokenFeature;n.state=x;n.stsRegionDefaultResolver=stsRegionDefaultResolver;n.stsRegionWarning=Ce;n.toEndpointV1=toEndpointV1;n.useDefaultPartitionInfo=useDefaultPartitionInfo;n.userAgentMiddleware=userAgentMiddleware},7523:(t,n,i)=>{const{HttpResponse:a,HttpRequest:A}=i(3422);const{normalizeProvider:c,memoizeIdentityProvider:l,isIdentityExpired:d,doesIdentityRequireRefresh:h}=i(402);const{ProviderError:f}=i(7291);const{setCredentialFeature:g}=i(5152);const{SignatureV4:p}=i(5118);const getDateHeader=t=>a.isInstance(t)?t.headers?.date??t.headers?.Date:undefined;const getSkewCorrectedDate=t=>new Date(Date.now()+t);const isClockSkewed=(t,n)=>Math.abs(getSkewCorrectedDate(n).getTime()-t)>=3e5;const getUpdatedSystemClockOffset=(t,n)=>{const i=Date.parse(t);if(isClockSkewed(i,n)){return i-Date.now()}return n};const throwSigningPropertyError=(t,n)=>{if(!n){throw new Error(`Property \`${t}\` is not resolved for AWS SDK SigV4Auth`)}return n};const validateSigningProperties=async t=>{const n=throwSigningPropertyError("context",t.context);const i=throwSigningPropertyError("config",t.config);const a=n.endpointV2?.properties?.authSchemes?.[0];const A=throwSigningPropertyError("signer",i.signer);const c=await A(a);const l=t?.signingRegion;const d=t?.signingRegionSet;const h=t?.signingName;return{config:i,signer:c,signingRegion:l,signingRegionSet:d,signingName:h}};class AwsSdkSigV4Signer{async sign(t,n,i){if(!A.isInstance(t)){throw new Error("The request is not an instance of `HttpRequest` and cannot be signed")}const a=await validateSigningProperties(i);const{config:c,signer:l}=a;let{signingRegion:d,signingName:h}=a;const f=i.context;if(f?.authSchemes?.length??0>1){const[t,n]=f.authSchemes;if(t?.name==="sigv4a"&&n?.name==="sigv4"){d=n?.signingRegion??d;h=n?.signingName??h}}i._preRequestSystemClockOffset=c.systemClockOffset;const g=await l.sign(t,{signingDate:getSkewCorrectedDate(c.systemClockOffset),signingRegion:d,signingService:h});return g}errorHandler(t){return n=>{const i=n;const a=i.ServerTime??getDateHeader(i.$response);if(a){const n=throwSigningPropertyError("config",t.config);const A=t._preRequestSystemClockOffset;const c=getUpdatedSystemClockOffset(a,n.systemClockOffset);const l=c!==n.systemClockOffset;const d=A!==undefined&&A!==c;const h=l||d;if(h&&i.$metadata){n.systemClockOffset=c;i.$metadata.clockSkewCorrected=true}}throw n}}successHandler(t,n){const i=getDateHeader(t);if(i){const t=throwSigningPropertyError("config",n.config);t.systemClockOffset=getUpdatedSystemClockOffset(i,t.systemClockOffset)}}}const m=AwsSdkSigV4Signer;class AwsSdkSigV4ASigner extends AwsSdkSigV4Signer{async sign(t,n,i){if(!A.isInstance(t)){throw new Error("The request is not an instance of `HttpRequest` and cannot be signed")}const{config:a,signer:c,signingRegion:l,signingRegionSet:d,signingName:h}=await validateSigningProperties(i);const f=await(a.sigv4aSigningRegionSet?.());const g=(f??d??[l]).join(",");i._preRequestSystemClockOffset=a.systemClockOffset;const p=await c.sign(t,{signingDate:getSkewCorrectedDate(a.systemClockOffset),signingRegion:g,signingService:h});return p}}const getArrayForCommaSeparatedString=t=>typeof t==="string"&&t.length>0?t.split(",").map(t=>t.trim()):[];const getBearerTokenEnvKey=t=>`AWS_BEARER_TOKEN_${t.replace(/[\s-]/g,"_").toUpperCase()}`;const E="AWS_AUTH_SCHEME_PREFERENCE";const C="auth_scheme_preference";const I={environmentVariableSelector:(t,n)=>{if(n?.signingName){const i=getBearerTokenEnvKey(n.signingName);if(i in t)return["httpBearerAuth"]}if(!(E in t))return undefined;return getArrayForCommaSeparatedString(t[E])},configFileSelector:t=>{if(!(C in t))return undefined;return getArrayForCommaSeparatedString(t[C])},default:[]};const resolveAwsSdkSigV4AConfig=t=>{t.sigv4aSigningRegionSet=c(t.sigv4aSigningRegionSet);return t};const y={environmentVariableSelector(t){if(t.AWS_SIGV4A_SIGNING_REGION_SET){return t.AWS_SIGV4A_SIGNING_REGION_SET.split(",").map(t=>t.trim())}throw new f("AWS_SIGV4A_SIGNING_REGION_SET not set in env.",{tryNextLink:true})},configFileSelector(t){if(t.sigv4a_signing_region_set){return(t.sigv4a_signing_region_set??"").split(",").map(t=>t.trim())}throw new f("sigv4a_signing_region_set not set in profile.",{tryNextLink:true})},default:undefined};const resolveAwsSdkSigV4Config=t=>{let n=t.credentials;let i=!!t.credentials;let a=undefined;Object.defineProperty(t,"credentials",{set(A){if(A&&A!==n&&A!==a){i=true}n=A;const c=normalizeCredentialProvider(t,{credentials:n,credentialDefaultProvider:t.credentialDefaultProvider});const l=bindCallerConfig(t,c);if(i&&!l.attributed){const t=typeof n==="object"&&n!==null;a=async n=>{const i=await l(n);const a=i;if(t&&(!a.$source||Object.keys(a.$source).length===0)){return g(a,"CREDENTIALS_CODE","e")}return a};a.memoized=l.memoized;a.configBound=l.configBound;a.attributed=true}else{a=l}},get(){return a},enumerable:true,configurable:true});t.credentials=n;const{signingEscapePath:A=true,systemClockOffset:l=t.systemClockOffset||0,sha256:d}=t;let h;if(t.signer){h=c(t.signer)}else if(t.regionInfoProvider){h=()=>c(t.region)().then(async n=>[await t.regionInfoProvider(n,{useFipsEndpoint:await t.useFipsEndpoint(),useDualstackEndpoint:await t.useDualstackEndpoint()})||{},n]).then(([n,i])=>{const{signingRegion:a,signingService:c}=n;t.signingRegion=t.signingRegion||a||i;t.signingName=t.signingName||c||t.serviceId;const l={...t,credentials:t.credentials,region:t.signingRegion,service:t.signingName,sha256:d,uriEscapePath:A};const h=t.signerConstructor||p;return new h(l)})}else{h=async n=>{n=Object.assign({},{name:"sigv4",signingName:t.signingName||t.defaultSigningName,signingRegion:await c(t.region)(),properties:{}},n);const i=n.signingRegion;const a=n.signingName;t.signingRegion=t.signingRegion||i;t.signingName=t.signingName||a||t.serviceId;const l={...t,credentials:t.credentials,region:t.signingRegion,service:t.signingName,sha256:d,uriEscapePath:A};const h=t.signerConstructor||p;return new h(l)}}const f=Object.assign(t,{systemClockOffset:l,signingEscapePath:A,signer:h});return f};const B=resolveAwsSdkSigV4Config;function normalizeCredentialProvider(t,{credentials:n,credentialDefaultProvider:i}){let a;if(n){if(!n?.memoized){a=l(n,d,h)}else{a=n}}else{if(i){a=c(i(Object.assign({},t,{parentClientConfig:t})))}else{a=async()=>{throw new Error("@aws-sdk/core::resolveAwsSdkSigV4Config - `credentials` not provided and no credentialDefaultProvider was configured.")}}}a.memoized=true;return a}function bindCallerConfig(t,n){if(n.configBound){return n}const fn=async i=>n({...i,callerClientConfig:t});fn.memoized=n.memoized;fn.configBound=true;return fn}n.AWSSDKSigV4Signer=m;n.AwsSdkSigV4ASigner=AwsSdkSigV4ASigner;n.AwsSdkSigV4Signer=AwsSdkSigV4Signer;n.NODE_AUTH_SCHEME_PREFERENCE_OPTIONS=I;n.NODE_SIGV4A_CONFIG_OPTIONS=y;n.getBearerTokenEnvKey=getBearerTokenEnvKey;n.resolveAWSSDKSigV4Config=B;n.resolveAwsSdkSigV4AConfig=resolveAwsSdkSigV4AConfig;n.resolveAwsSdkSigV4Config=resolveAwsSdkSigV4Config;n.validateSigningProperties=validateSigningProperties},7288:(t,n,i)=>{const{SmithyRpcV2CborProtocol:a,loadSmithyRpcV2CborErrorCode:A}=i(4645);const{TypeRegistry:c,NormalizedSchema:l,deref:d}=i(6890);const{decorateServiceException:h,getValueFromTextNode:f}=i(2658);const{collectBody:g,determineTimestampFormat:p,RpcProtocol:m,HttpBindingProtocol:E,HttpInterceptingShapeSerializer:C,HttpInterceptingShapeDeserializer:I,FromStringShapeDeserializer:y,extendedEncodeURIComponent:B}=i(3422);const{NumericValue:Q,toUtf8:w,fromBase64:S,LazyJsonString:b,parseEpochTimestamp:R,parseRfc7231DateTime:v,parseRfc3339DateTimeWithOffset:k,toBase64:D,dateToUtcString:T,generateIdempotencyToken:N,expectUnion:M}=i(2430);const{parseXML:F,XmlNode:x,XmlText:U}=i(4274);class ProtocolLib{queryCompat;errorRegistry;constructor(t=false){this.queryCompat=t}resolveRestContentType(t,n){const i=n.getMemberSchemas();const a=Object.values(i).find(t=>!!t.getMergedTraits().httpPayload);if(a){const n=a.getMergedTraits().mediaType;if(n){return n}else if(a.isStringSchema()){return"text/plain"}else if(a.isBlobSchema()){return"application/octet-stream"}else{return t}}else if(!n.isUnitSchema()){const n=Object.values(i).find(t=>{const{httpQuery:n,httpQueryParams:i,httpHeader:a,httpLabel:A,httpPrefixHeaders:c}=t.getMergedTraits();const l=c===void 0;return!n&&!i&&!a&&!A&&l});if(n){return t}}}async getErrorSchemaOrThrowBaseException(t,n,i,a,A,c){let l=t;if(t.includes("#")){[,l]=t.split("#")}const d={$metadata:A,$fault:i.statusCode<500?"client":"server"};if(!this.errorRegistry){throw new Error("@aws-sdk/core/protocols - error handler not initialized.")}try{const n=c?.(this.errorRegistry,l)??this.errorRegistry.getSchema(t);return{errorSchema:n,errorMetadata:d}}catch(t){a.message=a.message??a.Message??"UnknownError";const n=this.errorRegistry;const i=n.getBaseException();if(i){const t=n.getErrorCtor(i)??Error;throw this.decorateServiceException(Object.assign(new t({name:l}),d),a)}const A=a;const c=A?.message??A?.Message??A?.Error?.Message??A?.Error?.message;throw this.decorateServiceException(Object.assign(new Error(c),{name:l},d),a)}}compose(t,n,i){let a=i;if(n.includes("#")){[a]=n.split("#")}const A=c.for(a);const l=c.for("smithy.ts.sdk.synthetic."+i);t.copyFrom(A);t.copyFrom(l);this.errorRegistry=t}decorateServiceException(t,n={}){if(this.queryCompat){const i=t.Message??n.Message;const a=h(t,n);if(i){a.message=i}const A=a.Error??{};A.Type=a.Error?.Type;A.Code=a.Error?.Code;A.Message=a.Error?.message??a.Error?.Message??i;a.Error=A;const c=a.$metadata.requestId;if(c){a.RequestId=c}return a}return h(t,n)}setQueryCompatError(t,n){const i=n.headers?.["x-amzn-query-error"];if(t!==undefined&&i!=null){const[n,a]=i.split(";");const A=Object.keys(t);const c={Code:n,Type:a};t.Code=n;t.Type=a;for(let n=0;nl.of(t).getMergedTraits().awsQueryError?.[0]===n)}}}class AwsSmithyRpcV2CborProtocol extends a{awsQueryCompatible;mixin;constructor({defaultNamespace:t,errorTypeRegistries:n,awsQueryCompatible:i}){super({defaultNamespace:t,errorTypeRegistries:n});this.awsQueryCompatible=!!i;this.mixin=new ProtocolLib(this.awsQueryCompatible)}async serializeRequest(t,n,i){const a=await super.serializeRequest(t,n,i);if(this.awsQueryCompatible){a.headers["x-amzn-query-mode"]="true"}return a}async handleError(t,n,i,a,c){if(this.awsQueryCompatible){this.mixin.setQueryCompatError(a,i)}const d=(()=>{const t=i.headers["x-amzn-query-error"];if(t&&this.awsQueryCompatible){return t.split(";")[0]}return A(i,a)??"Unknown"})();this.mixin.compose(this.compositeErrorRegistry,d,this.options.defaultNamespace);const{errorSchema:h,errorMetadata:f}=await this.mixin.getErrorSchemaOrThrowBaseException(d,this.options.defaultNamespace,i,a,c,this.awsQueryCompatible?this.mixin.findQueryCompatibleError:undefined);const g=l.of(h);const p=a.message??a.Message??"UnknownError";const m=this.compositeErrorRegistry.getErrorCtor(h)??Error;const E=new m({});const C={};for(const[t,n]of g.structIterator()){if(a[t]!=null){C[t]=this.deserializer.readValue(n,a[t])}}if(this.awsQueryCompatible){this.mixin.queryCompatOutput(a,C)}throw this.mixin.decorateServiceException(Object.assign(E,f,{$fault:g.getMergedTraits().error,message:p},C),a)}}const _toStr=t=>{if(t==null){return t}if(typeof t==="number"||typeof t==="bigint"){const n=new Error(`Received number ${t} where a string was expected.`);n.name="Warning";console.warn(n);return String(t)}if(typeof t==="boolean"){const n=new Error(`Received boolean ${t} where a string was expected.`);n.name="Warning";console.warn(n);return String(t)}return t};const _toBool=t=>{if(t==null){return t}if(typeof t==="string"){const n=t.toLowerCase();if(t!==""&&n!=="false"&&n!=="true"){const n=new Error(`Received string "${t}" where a boolean was expected.`);n.name="Warning";console.warn(n)}return t!==""&&n!=="false"}return t};const _toNum=t=>{if(t==null){return t}if(typeof t==="string"){const n=Number(t);if(n.toString()!==t){const n=new Error(`Received string "${t}" where a number was expected.`);n.name="Warning";console.warn(n);return t}return n}return t};class SerdeContextConfig{serdeContext;setSerdeContext(t){this.serdeContext=t}}class UnionSerde{from;to;keys;constructor(t,n){this.from=t;this.to=n;const i=Object.keys(this.from);const a=new Set(i);a.delete("__type");this.keys=a}mark(t){this.keys.delete(t)}hasUnknown(){return this.keys.size===1&&Object.keys(this.to).length===0}writeUnknown(){if(this.hasUnknown()){const t=this.keys.values().next().value;const n=this.from[t];this.to.$unknown=[t,n]}}}function jsonReviver(t,n,i){if(i?.source){const t=i.source;if(typeof n==="number"){if(n>Number.MAX_SAFE_INTEGER||ng(t,n).then(t=>(n?.utf8Encoder??w)(t));const parseJsonBody=(t,n)=>collectBodyString(t,n).then(t=>{if(t.length){try{return JSON.parse(t)}catch(n){if(n?.name==="SyntaxError"){Object.defineProperty(n,"$responseBodyText",{value:t})}throw n}}return{}});const parseJsonErrorBody=async(t,n)=>{const i=await parseJsonBody(t,n);i.message=i.message??i.Message;return i};const findKey=(t,n)=>Object.keys(t).find(t=>t.toLowerCase()===n.toLowerCase());const sanitizeErrorCode=t=>{let n=t;if(typeof n==="number"){n=n.toString()}if(n.indexOf(",")>=0){n=n.split(",")[0]}if(n.indexOf(":")>=0){n=n.split(":")[0]}if(n.indexOf("#")>=0){n=n.split("#")[1]}return n};const loadRestJsonErrorCode=(t,n)=>loadErrorCode(t,n,["header","code","type"]);const loadJsonRpcErrorCode=(t,n,i=false)=>loadErrorCode(t,n,i?["code","header","type"]:["type","code","header"]);const loadErrorCode=({headers:t},n,i)=>{while(i.length>0){const a=i.shift();switch(a){case"header":const i=findKey(t??{},"x-amzn-errortype");if(i!==undefined){return sanitizeErrorCode(t[i])}break;case"code":const a=findKey(n??{},"code");if(a&&n[a]!==undefined){return sanitizeErrorCode(n[a])}break;case"type":if(n?.__type!==undefined){return sanitizeErrorCode(n.__type)}break}}};class JsonShapeDeserializer extends SerdeContextConfig{settings;constructor(t){super();this.settings=t}async read(t,n){return this._read(t,typeof n==="string"?JSON.parse(n,jsonReviver):await parseJsonBody(n,this.serdeContext))}readObject(t,n){return this._read(t,n)}_read(t,n){const i=n!==null&&typeof n==="object";const a=l.of(t);if(i){if(a.isStructSchema()){const t=n;const i=a.isUnionSchema();const A={};let c=void 0;const{jsonName:l}=this.settings;if(l){c={}}let d;if(i){d=new UnionSerde(t,A)}for(const[n,h]of a.structIterator()){let a=n;if(l){a=h.getMergedTraits().jsonName??a;c[a]=n}if(i){d.mark(a)}if(t[a]!=null){A[n]=this._read(h,t[a])}}if(i){d.writeUnknown()}else if(typeof t.__type==="string"){for(const n in t){const i=t[n];const a=l?c[n]??n:n;if(!(a in A)){A[a]=i}}}return A}if(Array.isArray(n)&&a.isListSchema()){const t=a.getValueSchema();const i=[];for(const a of n){i.push(this._read(t,a))}return i}if(a.isMapSchema()){const t=a.getValueSchema();const i={};for(const a in n){i[a]=this._read(t,n[a])}return i}}if(a.isBlobSchema()&&typeof n==="string"){return S(n)}const A=a.getMergedTraits().mediaType;if(a.isStringSchema()&&typeof n==="string"&&A){const t=A==="application/json"||A.endsWith("+json");if(t){return b.from(n)}return n}if(a.isTimestampSchema()&&n!=null){const t=p(a,this.settings);switch(t){case 5:return k(n);case 6:return v(n);case 7:return R(n);default:console.warn("Missing timestamp format, parsing value with Date constructor:",n);return new Date(n)}}if(a.isBigIntegerSchema()&&(typeof n==="number"||typeof n==="string")){return BigInt(n)}if(a.isBigDecimalSchema()&&n!=undefined){if(n instanceof Q){return n}const t=n;if(t.type==="bigDecimal"&&"string"in t){return new Q(t.string,t.type)}return new Q(String(n),"bigDecimal")}if(a.isNumericSchema()&&typeof n==="string"){switch(n){case"Infinity":return Infinity;case"-Infinity":return-Infinity;case"NaN":return NaN}return n}if(a.isDocumentSchema()){if(i){const t=Array.isArray(n)?[]:{};for(const i in n){const A=n[i];if(A instanceof Q){t[i]=A}else{t[i]=this._read(a,A)}}return t}else{return structuredClone(n)}}return n}}const P=String.fromCharCode(925);class JsonReplacer{values=new Map;counter=0;stage=0;createReplacer(){if(this.stage===1){throw new Error("@aws-sdk/core/protocols - JsonReplacer already created.")}if(this.stage===2){throw new Error("@aws-sdk/core/protocols - JsonReplacer exhausted.")}this.stage=1;return(t,n)=>{if(n instanceof Q){const t=`${P+"nv"+this.counter++}_`+n.string;this.values.set(`"${t}"`,n.string);return t}if(typeof n==="bigint"){const t=n.toString();const i=`${P+"b"+this.counter++}_`+t;this.values.set(`"${i}"`,t);return i}return n}}replaceInJson(t){if(this.stage===0){throw new Error("@aws-sdk/core/protocols - JsonReplacer not created yet.")}if(this.stage===2){throw new Error("@aws-sdk/core/protocols - JsonReplacer exhausted.")}this.stage=2;if(this.counter===0){return t}for(const[n,i]of this.values){t=t.replace(n,i)}return t}}class JsonShapeSerializer extends SerdeContextConfig{settings;buffer;useReplacer=false;rootSchema;constructor(t){super();this.settings=t}write(t,n){this.rootSchema=l.of(t);this.buffer=this._write(this.rootSchema,n)}flush(){const{rootSchema:t,useReplacer:n}=this;this.rootSchema=undefined;this.useReplacer=false;if(t?.isStructSchema()||t?.isDocumentSchema()){if(!n){return JSON.stringify(this.buffer)}const t=new JsonReplacer;return t.replaceInJson(JSON.stringify(this.buffer,t.createReplacer(),0))}return this.buffer}writeDiscriminatedDocument(t,n){this.write(t,n);if(typeof this.buffer==="object"){this.buffer.__type=l.of(t).getName(true)}}_write(t,n,i){const a=n!==null&&typeof n==="object";const A=l.of(t);if(a){if(A.isStructSchema()){const t=n;const i={};const{jsonName:a}=this.settings;let c=void 0;if(a){c={}}let l=0;for(const[n,d]of A.structIterator()){const h=this._write(d,t[n],A);if(h!==undefined){let t=n;if(a){t=d.getMergedTraits().jsonName??n;c[n]=t}i[t]=h;l++}}if(A.isUnionSchema()&&l===0){const{$unknown:n}=t;if(Array.isArray(n)){const[t,a]=n;i[t]=this._write(15,a)}}else if(typeof t.__type==="string"){for(const n in t){const A=t[n];const l=a?c[n]??n:n;if(!(l in i)){i[l]=this._write(15,A)}}}return i}if(Array.isArray(n)&&A.isListSchema()){const t=A.getValueSchema();const i=[];const a=!!A.getMergedTraits().sparse;for(const A of n){if(a||A!=null){i.push(this._write(t,A))}}return i}if(A.isMapSchema()){const t=A.getValueSchema();const i={};const a=!!A.getMergedTraits().sparse;for(const A in n){const c=n[A];if(a||c!=null){i[A]=this._write(t,c)}}return i}if(n instanceof Uint8Array&&(A.isBlobSchema()||A.isDocumentSchema())){if(A===this.rootSchema){return n}return(this.serdeContext?.base64Encoder??D)(n)}if(n instanceof Date&&(A.isTimestampSchema()||A.isDocumentSchema())){const t=p(A,this.settings);switch(t){case 5:return n.toISOString().replace(".000Z","Z");case 6:return T(n);case 7:return n.getTime()/1e3;default:console.warn("Missing timestamp format, using epoch seconds",n);return n.getTime()/1e3}}if(n instanceof Q){this.useReplacer=true}}if(n===null&&i?.isStructSchema()){return void 0}if(A.isStringSchema()){if(typeof n==="undefined"&&A.isIdempotencyToken()){return N()}const t=A.getMergedTraits().mediaType;if(n!=null&&t){const i=t==="application/json"||t.endsWith("+json");if(i){return b.from(n)}}return n}if(typeof n==="number"&&A.isNumericSchema()){if(Math.abs(n)===Infinity||isNaN(n)){return String(n)}return n}if(typeof n==="string"&&A.isBlobSchema()){if(A===this.rootSchema){return n}return(this.serdeContext?.base64Encoder??D)(n)}if(typeof n==="bigint"){this.useReplacer=true}if(A.isDocumentSchema()){if(a){const t=Array.isArray(n)?[]:{};for(const i in n){const a=n[i];if(a instanceof Q){this.useReplacer=true;t[i]=a}else{t[i]=this._write(A,a)}}return t}else{return structuredClone(n)}}return n}}class JsonCodec extends SerdeContextConfig{settings;constructor(t){super();this.settings=t}createSerializer(){const t=new JsonShapeSerializer(this.settings);t.setSerdeContext(this.serdeContext);return t}createDeserializer(){const t=new JsonShapeDeserializer(this.settings);t.setSerdeContext(this.serdeContext);return t}}class AwsJsonRpcProtocol extends m{serializer;deserializer;serviceTarget;codec;mixin;awsQueryCompatible;constructor({defaultNamespace:t,errorTypeRegistries:n,serviceTarget:i,awsQueryCompatible:a,jsonCodec:A}){super({defaultNamespace:t,errorTypeRegistries:n});this.serviceTarget=i;this.codec=A??new JsonCodec({timestampFormat:{useTrait:true,default:7},jsonName:false});this.serializer=this.codec.createSerializer();this.deserializer=this.codec.createDeserializer();this.awsQueryCompatible=!!a;this.mixin=new ProtocolLib(this.awsQueryCompatible)}async serializeRequest(t,n,i){const a=await super.serializeRequest(t,n,i);if(!a.path.endsWith("/")){a.path+="/"}a.headers["content-type"]=`application/x-amz-json-${this.getJsonRpcVersion()}`;a.headers["x-amz-target"]=`${this.serviceTarget}.${t.name}`;if(this.awsQueryCompatible){a.headers["x-amzn-query-mode"]="true"}if(d(t.input)==="unit"||!a.body){a.body="{}"}return a}getPayloadCodec(){return this.codec}async handleError(t,n,i,a,A){const{awsQueryCompatible:c}=this;if(c){this.mixin.setQueryCompatError(a,i)}const d=loadJsonRpcErrorCode(i,a,c)??"Unknown";this.mixin.compose(this.compositeErrorRegistry,d,this.options.defaultNamespace);const{errorSchema:h,errorMetadata:f}=await this.mixin.getErrorSchemaOrThrowBaseException(d,this.options.defaultNamespace,i,a,A,c?this.mixin.findQueryCompatibleError:undefined);const g=l.of(h);const p=a.message??a.Message??"UnknownError";const m=this.compositeErrorRegistry.getErrorCtor(h)??Error;const E=new m({});const C={};const I=this.codec.createDeserializer();for(const[t,n]of g.structIterator()){if(a[t]!=null){C[t]=I.readObject(n,a[t])}}if(c){this.mixin.queryCompatOutput(a,C)}throw this.mixin.decorateServiceException(Object.assign(E,f,{$fault:g.getMergedTraits().error,message:p},C),a)}}class AwsJson1_0Protocol extends AwsJsonRpcProtocol{constructor({defaultNamespace:t,errorTypeRegistries:n,serviceTarget:i,awsQueryCompatible:a,jsonCodec:A}){super({defaultNamespace:t,errorTypeRegistries:n,serviceTarget:i,awsQueryCompatible:a,jsonCodec:A})}getShapeId(){return"aws.protocols#awsJson1_0"}getJsonRpcVersion(){return"1.0"}getDefaultContentType(){return"application/x-amz-json-1.0"}}class AwsJson1_1Protocol extends AwsJsonRpcProtocol{constructor({defaultNamespace:t,errorTypeRegistries:n,serviceTarget:i,awsQueryCompatible:a,jsonCodec:A}){super({defaultNamespace:t,errorTypeRegistries:n,serviceTarget:i,awsQueryCompatible:a,jsonCodec:A})}getShapeId(){return"aws.protocols#awsJson1_1"}getJsonRpcVersion(){return"1.1"}getDefaultContentType(){return"application/x-amz-json-1.1"}}class AwsRestJsonProtocol extends E{serializer;deserializer;codec;mixin=new ProtocolLib;constructor({defaultNamespace:t,errorTypeRegistries:n}){super({defaultNamespace:t,errorTypeRegistries:n});const i={timestampFormat:{useTrait:true,default:7},httpBindings:true,jsonName:true};this.codec=new JsonCodec(i);this.serializer=new C(this.codec.createSerializer(),i);this.deserializer=new I(this.codec.createDeserializer(),i)}getShapeId(){return"aws.protocols#restJson1"}getPayloadCodec(){return this.codec}setSerdeContext(t){this.codec.setSerdeContext(t);super.setSerdeContext(t)}async serializeRequest(t,n,i){const a=await super.serializeRequest(t,n,i);const A=l.of(t.input);if(!a.headers["content-type"]){const t=this.mixin.resolveRestContentType(this.getDefaultContentType(),A);if(t){a.headers["content-type"]=t}}if(a.body==null&&a.headers["content-type"]===this.getDefaultContentType()){a.body="{}"}return a}async deserializeResponse(t,n,i){const a=await super.deserializeResponse(t,n,i);const A=l.of(t.output);for(const[t,n]of A.structIterator()){if(n.getMemberTraits().httpPayload&&!(t in a)){a[t]=null}}return a}async handleError(t,n,i,a,A){const c=loadRestJsonErrorCode(i,a)??"Unknown";this.mixin.compose(this.compositeErrorRegistry,c,this.options.defaultNamespace);const{errorSchema:d,errorMetadata:h}=await this.mixin.getErrorSchemaOrThrowBaseException(c,this.options.defaultNamespace,i,a,A);const f=l.of(d);const g=a.message??a.Message??"UnknownError";const p=this.compositeErrorRegistry.getErrorCtor(d)??Error;const m=new p({});await this.deserializeHttpMessage(d,n,i,a);const E={};const C=this.codec.createDeserializer();for(const[t,n]of f.structIterator()){const i=n.getMergedTraits().jsonName??t;E[t]=C.readObject(n,a[i])}throw this.mixin.decorateServiceException(Object.assign(m,h,{$fault:f.getMergedTraits().error,message:g},E),a)}getDefaultContentType(){return"application/json"}}const awsExpectUnion=t=>{if(t==null){return undefined}if(typeof t==="object"&&"__type"in t){delete t.__type}return M(t)};class XmlShapeDeserializer extends SerdeContextConfig{settings;stringDeserializer;constructor(t){super();this.settings=t;this.stringDeserializer=new y(t)}setSerdeContext(t){this.serdeContext=t;this.stringDeserializer.setSerdeContext(t)}read(t,n,i){const a=l.of(t);const A=a.getMemberSchemas();const c=a.isStructSchema()&&a.isMemberSchema()&&!!Object.values(A).find(t=>!!t.getMemberTraits().eventPayload);if(c){const t={};const i=Object.keys(A)[0];const a=A[i];if(a.isBlobSchema()){t[i]=n}else{t[i]=this.read(A[i],n)}return t}const d=(this.serdeContext?.utf8Encoder??w)(n);const h=this.parseXml(d);return this.readSchema(t,i?h[i]:h)}readSchema(t,n){const i=l.of(t);if(i.isUnitSchema()){return}const a=i.getMergedTraits();if(i.isListSchema()&&!Array.isArray(n)){return this.readSchema(i,[n])}if(n==null){return n}if(typeof n==="object"){const t=!!a.xmlFlattened;if(i.isListSchema()){const a=i.getValueSchema();const A=[];const c=a.getMergedTraits().xmlName??"member";const l=t?n:(n[0]??n)[c];if(l==null){return A}const d=Array.isArray(l)?l:[l];for(const t of d){A.push(this.readSchema(a,t))}return A}const A={};if(i.isMapSchema()){const a=i.getKeySchema();const c=i.getValueSchema();let l;if(t){l=Array.isArray(n)?n:[n]}else{l=Array.isArray(n.entry)?n.entry:[n.entry]}const d=a.getMergedTraits().xmlName??"key";const h=c.getMergedTraits().xmlName??"value";for(const t of l){const n=t[d];const i=t[h];A[n]=this.readSchema(c,i)}return A}if(i.isStructSchema()){const t=i.isUnionSchema();let a;if(t){a=new UnionSerde(n,A)}for(const[c,l]of i.structIterator()){const i=l.getMergedTraits();const d=!i.httpPayload?l.getMemberTraits().xmlName??c:i.xmlName??l.getName();if(t){a.mark(d)}if(n[d]!=null){A[c]=this.readSchema(l,n[d])}}if(t){a.writeUnknown()}return A}if(i.isDocumentSchema()){return n}throw new Error(`@aws-sdk/core/protocols - xml deserializer unhandled schema type for ${i.getName(true)}`)}if(i.isListSchema()){return[]}if(i.isMapSchema()||i.isStructSchema()){return{}}return this.stringDeserializer.read(i,n)}parseXml(t){if(t.length){let n;try{n=F(t)}catch(n){if(n&&typeof n==="object"){Object.defineProperty(n,"$responseBodyText",{value:t})}throw n}const i="#text";const a=Object.keys(n)[0];const A=n[a];if(A[i]){A[a]=A[i];delete A[i]}return f(A)}return{}}}class QueryShapeSerializer extends SerdeContextConfig{settings;buffer;constructor(t){super();this.settings=t}write(t,n,i=""){if(this.buffer===undefined){this.buffer=""}const a=l.of(t);if(i&&!i.endsWith(".")){i+="."}if(a.isBlobSchema()){if(typeof n==="string"||n instanceof Uint8Array){this.writeKey(i);this.writeValue((this.serdeContext?.base64Encoder??D)(n))}}else if(a.isBooleanSchema()||a.isNumericSchema()||a.isStringSchema()){if(n!=null){this.writeKey(i);this.writeValue(String(n))}else if(a.isIdempotencyToken()){this.writeKey(i);this.writeValue(N())}}else if(a.isBigIntegerSchema()){if(n!=null){this.writeKey(i);this.writeValue(String(n))}}else if(a.isBigDecimalSchema()){if(n!=null){this.writeKey(i);this.writeValue(n instanceof Q?n.string:String(n))}}else if(a.isTimestampSchema()){if(n instanceof Date){this.writeKey(i);const t=p(a,this.settings);switch(t){case 5:this.writeValue(n.toISOString().replace(".000Z","Z"));break;case 6:this.writeValue(T(n));break;case 7:this.writeValue(String(n.getTime()/1e3));break}}}else if(a.isDocumentSchema()){if(Array.isArray(n)){this.write(64|15,n,i)}else if(n instanceof Date){this.write(4,n,i)}else if(n instanceof Uint8Array){this.write(21,n,i)}else if(n&&typeof n==="object"){this.write(128|15,n,i)}else{this.writeKey(i);this.writeValue(String(n))}}else if(a.isListSchema()){if(Array.isArray(n)){if(n.length===0){if(this.settings.serializeEmptyLists){this.writeKey(i);this.writeValue("")}}else{const t=a.getValueSchema();const A=this.settings.flattenLists||a.getMergedTraits().xmlFlattened;let c=1;for(const a of n){if(a==null){continue}const n=t.getMergedTraits();const l=this.getKey("member",n.xmlName,n.ec2QueryName);const d=A?`${i}${c}`:`${i}${l}.${c}`;this.write(t,a,d);++c}}}}else if(a.isMapSchema()){if(n&&typeof n==="object"){const t=a.getKeySchema();const A=a.getValueSchema();const c=a.getMergedTraits().xmlFlattened;let l=1;for(const a in n){const d=n[a];if(d==null){continue}const h=t.getMergedTraits();const f=this.getKey("key",h.xmlName,h.ec2QueryName);const g=c?`${i}${l}.${f}`:`${i}entry.${l}.${f}`;const p=A.getMergedTraits();const m=this.getKey("value",p.xmlName,p.ec2QueryName);const E=c?`${i}${l}.${m}`:`${i}entry.${l}.${m}`;this.write(t,a,g);this.write(A,d,E);++l}}}else if(a.isStructSchema()){if(n&&typeof n==="object"){let t=false;for(const[A,c]of a.structIterator()){if(n[A]==null&&!c.isIdempotencyToken()){continue}const a=c.getMergedTraits();const l=this.getKey(A,a.xmlName,a.ec2QueryName,"struct");const d=`${i}${l}`;this.write(c,n[A],d);t=true}if(!t&&a.isUnionSchema()){const{$unknown:t}=n;if(Array.isArray(t)){const[n,a]=t;const A=`${i}${n}`;this.write(15,a,A)}}}}else if(a.isUnitSchema());else{throw new Error(`@aws-sdk/core/protocols - QuerySerializer unrecognized schema type ${a.getName(true)}`)}}flush(){if(this.buffer===undefined){throw new Error("@aws-sdk/core/protocols - QuerySerializer cannot flush with nothing written to buffer.")}const t=this.buffer;delete this.buffer;return t}getKey(t,n,i,a){const{ec2:A,capitalizeKeys:c}=this.settings;if(A&&i){return i}const l=n??t;if(c&&a==="struct"){return l[0].toUpperCase()+l.slice(1)}return l}writeKey(t){if(t.endsWith(".")){t=t.slice(0,t.length-1)}this.buffer+=`&${B(t)}=`}writeValue(t){this.buffer+=B(t)}}class AwsQueryProtocol extends m{options;serializer;deserializer;mixin=new ProtocolLib;constructor(t){super({defaultNamespace:t.defaultNamespace,errorTypeRegistries:t.errorTypeRegistries});this.options=t;const n={timestampFormat:{useTrait:true,default:5},httpBindings:false,xmlNamespace:t.xmlNamespace,serviceNamespace:t.defaultNamespace,serializeEmptyLists:true};this.serializer=new QueryShapeSerializer(n);this.deserializer=new XmlShapeDeserializer(n)}getShapeId(){return"aws.protocols#awsQuery"}setSerdeContext(t){this.serializer.setSerdeContext(t);this.deserializer.setSerdeContext(t)}getPayloadCodec(){throw new Error("AWSQuery protocol has no payload codec.")}async serializeRequest(t,n,i){const a=await super.serializeRequest(t,n,i);if(!a.path.endsWith("/")){a.path+="/"}a.headers["content-type"]="application/x-www-form-urlencoded";if(d(t.input)==="unit"||!a.body){a.body=""}const A=t.name.split("#")[1]??t.name;a.body=`Action=${A}&Version=${this.options.version}`+a.body;if(a.body.endsWith("&")){a.body=a.body.slice(-1)}return a}async deserializeResponse(t,n,i){const a=this.deserializer;const A=l.of(t.output);const c={};if(i.statusCode>=300){const A=await g(i.body,n);if(A.byteLength>0){Object.assign(c,await a.read(15,A))}await this.handleError(t,n,i,c,this.deserializeMetadata(i))}for(const t in i.headers){const n=i.headers[t];delete i.headers[t];i.headers[t.toLowerCase()]=n}const d=t.name.split("#")[1]??t.name;const h=A.isStructSchema()&&this.useNestedResult()?d+"Result":undefined;const f=await g(i.body,n);if(f.byteLength>0){Object.assign(c,await a.read(A,f,h))}c.$metadata=this.deserializeMetadata(i);return c}useNestedResult(){return true}async handleError(t,n,i,a,A){const c=this.loadQueryErrorCode(i,a)??"Unknown";this.mixin.compose(this.compositeErrorRegistry,c,this.options.defaultNamespace);const d=this.loadQueryError(a)??{};const h=this.loadQueryErrorMessage(a);d.message=h;d.Error={Type:d.Type,Code:d.Code,Message:h};const{errorSchema:f,errorMetadata:g}=await this.mixin.getErrorSchemaOrThrowBaseException(c,this.options.defaultNamespace,i,d,A,this.mixin.findQueryCompatibleError);const p=l.of(f);const m=this.compositeErrorRegistry.getErrorCtor(f)??Error;const E=new m({});const C={Type:d.Error.Type,Code:d.Error.Code,Error:d.Error};for(const[t,n]of p.structIterator()){const i=n.getMergedTraits().xmlName??t;const A=d[i]??a[i];C[t]=this.deserializer.readSchema(n,A)}throw this.mixin.decorateServiceException(Object.assign(E,g,{$fault:p.getMergedTraits().error,message:h},C),a)}loadQueryErrorCode(t,n){const i=(n.Errors?.[0]?.Error??n.Errors?.Error??n.Error)?.Code;if(i!==undefined){return i}if(t.statusCode==404){return"NotFound"}}loadQueryError(t){return t.Errors?.[0]?.Error??t.Errors?.Error??t.Error}loadQueryErrorMessage(t){const n=this.loadQueryError(t);return n?.message??n?.Message??t.message??t.Message??"Unknown"}getDefaultContentType(){return"application/x-www-form-urlencoded"}}class AwsEc2QueryProtocol extends AwsQueryProtocol{options;constructor(t){super(t);this.options=t;const n={capitalizeKeys:true,flattenLists:true,serializeEmptyLists:false,ec2:true};Object.assign(this.serializer.settings,n)}getShapeId(){return"aws.protocols#ec2Query"}useNestedResult(){return false}}const parseXmlBody=(t,n)=>collectBodyString(t,n).then(t=>{if(t.length){let n;try{n=F(t)}catch(n){if(n&&typeof n==="object"){Object.defineProperty(n,"$responseBodyText",{value:t})}throw n}const i="#text";const a=Object.keys(n)[0];const A=n[a];if(A[i]){A[a]=A[i];delete A[i]}return f(A)}return{}});const parseXmlErrorBody=async(t,n)=>{const i=await parseXmlBody(t,n);if(i.Error){i.Error.message=i.Error.message??i.Error.Message}return i};const loadRestXmlErrorCode=(t,n)=>{if(n?.Error?.Code!==undefined){return n.Error.Code}if(n?.Code!==undefined){return n.Code}if(t.statusCode==404){return"NotFound"}};class XmlShapeSerializer extends SerdeContextConfig{settings;stringBuffer;byteBuffer;buffer;constructor(t){super();this.settings=t}write(t,n){const i=l.of(t);if(i.isStringSchema()&&typeof n==="string"){this.stringBuffer=n}else if(i.isBlobSchema()){this.byteBuffer="byteLength"in n?n:(this.serdeContext?.base64Decoder??S)(n)}else{this.buffer=this.writeStruct(i,n,undefined);const t=i.getMergedTraits();if(t.httpPayload&&!t.xmlName){this.buffer.withName(i.getName())}}}flush(){if(this.byteBuffer!==undefined){const t=this.byteBuffer;delete this.byteBuffer;return t}if(this.stringBuffer!==undefined){const t=this.stringBuffer;delete this.stringBuffer;return t}const t=this.buffer;if(this.settings.xmlNamespace){if(!t?.attributes?.["xmlns"]){t.addAttribute("xmlns",this.settings.xmlNamespace)}}delete this.buffer;return t.toString()}writeStruct(t,n,i){const a=t.getMergedTraits();const A=t.isMemberSchema()&&!a.httpPayload?t.getMemberTraits().xmlName??t.getMemberName():a.xmlName??t.getName();if(!A||!t.isStructSchema()){throw new Error(`@aws-sdk/core/protocols - xml serializer, cannot write struct with empty name or non-struct, schema=${t.getName(true)}.`)}const c=x.of(A);const[l,d]=this.getXmlnsAttribute(t,i);for(const[i,a]of t.structIterator()){const t=n[i];if(t!=null||a.isIdempotencyToken()){if(a.getMergedTraits().xmlAttribute){c.addAttribute(a.getMergedTraits().xmlName??i,this.writeSimple(a,t));continue}if(a.isListSchema()){this.writeList(a,t,c,d)}else if(a.isMapSchema()){this.writeMap(a,t,c,d)}else if(a.isStructSchema()){c.addChildNode(this.writeStruct(a,t,d))}else{const n=x.of(a.getMergedTraits().xmlName??a.getMemberName());this.writeSimpleInto(a,t,n,d);c.addChildNode(n)}}}const{$unknown:h}=n;if(h&&t.isUnionSchema()&&Array.isArray(h)&&Object.keys(n).length===1){const[t,i]=h;const a=x.of(t);if(typeof i!=="string"){if(n instanceof x||n instanceof U){c.addChildNode(n)}else{throw new Error(`@aws-sdk - $unknown union member in XML requires `+`value of type string, @aws-sdk/xml-builder::XmlNode or XmlText.`)}}this.writeSimpleInto(0,i,a,d);c.addChildNode(a)}if(d){c.addAttribute(l,d)}return c}writeList(t,n,i,a){if(!t.isMemberSchema()){throw new Error(`@aws-sdk/core/protocols - xml serializer, cannot write non-member list: ${t.getName(true)}`)}const A=t.getMergedTraits();const c=t.getValueSchema();const l=c.getMergedTraits();const d=!!l.sparse;const h=!!A.xmlFlattened;const[f,g]=this.getXmlnsAttribute(t,a);const writeItem=(n,i)=>{if(c.isListSchema()){this.writeList(c,Array.isArray(i)?i:[i],n,g)}else if(c.isMapSchema()){this.writeMap(c,i,n,g)}else if(c.isStructSchema()){const a=this.writeStruct(c,i,g);n.addChildNode(a.withName(h?A.xmlName??t.getMemberName():l.xmlName??"member"))}else{const a=x.of(h?A.xmlName??t.getMemberName():l.xmlName??"member");this.writeSimpleInto(c,i,a,g);n.addChildNode(a)}};if(h){for(const t of n){if(d||t!=null){writeItem(i,t)}}}else{const a=x.of(A.xmlName??t.getMemberName());if(g){a.addAttribute(f,g)}for(const t of n){if(d||t!=null){writeItem(a,t)}}i.addChildNode(a)}}writeMap(t,n,i,a,A=false){if(!t.isMemberSchema()){throw new Error(`@aws-sdk/core/protocols - xml serializer, cannot write non-member map: ${t.getName(true)}`)}const c=t.getMergedTraits();const l=t.getKeySchema();const d=l.getMergedTraits();const h=d.xmlName??"key";const f=t.getValueSchema();const g=f.getMergedTraits();const p=g.xmlName??"value";const m=!!g.sparse;const E=!!c.xmlFlattened;const[C,I]=this.getXmlnsAttribute(t,a);const addKeyValue=(t,n,i)=>{const a=x.of(h,n);const[A,c]=this.getXmlnsAttribute(l,I);if(c){a.addAttribute(A,c)}t.addChildNode(a);let d=x.of(p);if(f.isListSchema()){this.writeList(f,i,d,I)}else if(f.isMapSchema()){this.writeMap(f,i,d,I,true)}else if(f.isStructSchema()){d=this.writeStruct(f,i,I)}else{this.writeSimpleInto(f,i,d,I)}t.addChildNode(d)};if(E){for(const a in n){const A=n[a];if(m||A!=null){const n=x.of(c.xmlName??t.getMemberName());addKeyValue(n,a,A);i.addChildNode(n)}}}else{let a;if(!A){a=x.of(c.xmlName??t.getMemberName());if(I){a.addAttribute(C,I)}i.addChildNode(a)}for(const t in n){const c=n[t];if(m||c!=null){const n=x.of("entry");addKeyValue(n,t,c);(A?i:a).addChildNode(n)}}}}writeSimple(t,n){if(null===n){throw new Error("@aws-sdk/core/protocols - (XML serializer) cannot write null value.")}const i=l.of(t);let a=null;if(n&&typeof n==="object"){if(i.isBlobSchema()){a=(this.serdeContext?.base64Encoder??D)(n)}else if(i.isTimestampSchema()&&n instanceof Date){const t=p(i,this.settings);switch(t){case 5:a=n.toISOString().replace(".000Z","Z");break;case 6:a=T(n);break;case 7:a=String(n.getTime()/1e3);break;default:console.warn("Missing timestamp format, using http date",n);a=T(n);break}}else if(i.isBigDecimalSchema()&&n){if(n instanceof Q){return n.string}return String(n)}else if(i.isMapSchema()||i.isListSchema()){throw new Error("@aws-sdk/core/protocols - xml serializer, cannot call _write() on List/Map schema, call writeList or writeMap() instead.")}else{throw new Error(`@aws-sdk/core/protocols - xml serializer, unhandled schema type for object value and schema: ${i.getName(true)}`)}}if(i.isBooleanSchema()||i.isNumericSchema()||i.isBigIntegerSchema()||i.isBigDecimalSchema()){a=String(n)}if(i.isStringSchema()){if(n===undefined&&i.isIdempotencyToken()){a=N()}else{a=String(n)}}if(a===null){throw new Error(`Unhandled schema-value pair ${i.getName(true)}=${n}`)}return a}writeSimpleInto(t,n,i,a){const A=this.writeSimple(t,n);const c=l.of(t);const d=new U(A);const[h,f]=this.getXmlnsAttribute(c,a);if(f){i.addAttribute(h,f)}i.addChildNode(d)}getXmlnsAttribute(t,n){const i=t.getMergedTraits();const[a,A]=i.xmlNamespace??[];if(A&&A!==n){return[a?`xmlns:${a}`:"xmlns",A]}return[void 0,void 0]}}class XmlCodec extends SerdeContextConfig{settings;constructor(t){super();this.settings=t}createSerializer(){const t=new XmlShapeSerializer(this.settings);t.setSerdeContext(this.serdeContext);return t}createDeserializer(){const t=new XmlShapeDeserializer(this.settings);t.setSerdeContext(this.serdeContext);return t}}class AwsRestXmlProtocol extends E{codec;serializer;deserializer;mixin=new ProtocolLib;constructor(t){super(t);const n={timestampFormat:{useTrait:true,default:5},httpBindings:true,xmlNamespace:t.xmlNamespace,serviceNamespace:t.defaultNamespace};this.codec=new XmlCodec(n);this.serializer=new C(this.codec.createSerializer(),n);this.deserializer=new I(this.codec.createDeserializer(),n)}getPayloadCodec(){return this.codec}getShapeId(){return"aws.protocols#restXml"}async serializeRequest(t,n,i){const a=await super.serializeRequest(t,n,i);const A=l.of(t.input);if(!a.headers["content-type"]){const t=this.mixin.resolveRestContentType(this.getDefaultContentType(),A);if(t){a.headers["content-type"]=t}}if(typeof a.body==="string"&&a.headers["content-type"]===this.getDefaultContentType()&&!a.body.startsWith("'+a.body}return a}async deserializeResponse(t,n,i){return super.deserializeResponse(t,n,i)}async handleError(t,n,i,a,A){const c=loadRestXmlErrorCode(i,a)??"Unknown";this.mixin.compose(this.compositeErrorRegistry,c,this.options.defaultNamespace);if(a.Error&&typeof a.Error==="object"){for(const t of Object.keys(a.Error)){a[t]=a.Error[t];if(t.toLowerCase()==="message"){a.message=a.Error[t]}}}if(a.RequestId&&!A.requestId){A.requestId=a.RequestId}const{errorSchema:d,errorMetadata:h}=await this.mixin.getErrorSchemaOrThrowBaseException(c,this.options.defaultNamespace,i,a,A);const f=l.of(d);const g=a.Error?.message??a.Error?.Message??a.message??a.Message??"UnknownError";const p=this.compositeErrorRegistry.getErrorCtor(d)??Error;const m=new p({});await this.deserializeHttpMessage(d,n,i,a);const E={};const C=this.codec.createDeserializer();for(const[t,n]of f.structIterator()){const i=n.getMergedTraits().xmlName??t;const A=a.Error?.[i]??a[i];E[t]=C.readSchema(n,A)}throw this.mixin.decorateServiceException(Object.assign(m,h,{$fault:f.getMergedTraits().error,message:g},E),a)}getDefaultContentType(){return"application/xml"}hasUnstructuredPayloadBinding(t){for(const[,n]of t.structIterator()){if(n.getMergedTraits().httpPayload){return!(n.isStructSchema()||n.isMapSchema()||n.isListSchema())}}return false}}n.AwsEc2QueryProtocol=AwsEc2QueryProtocol;n.AwsJson1_0Protocol=AwsJson1_0Protocol;n.AwsJson1_1Protocol=AwsJson1_1Protocol;n.AwsJsonRpcProtocol=AwsJsonRpcProtocol;n.AwsQueryProtocol=AwsQueryProtocol;n.AwsRestJsonProtocol=AwsRestJsonProtocol;n.AwsRestXmlProtocol=AwsRestXmlProtocol;n.AwsSmithyRpcV2CborProtocol=AwsSmithyRpcV2CborProtocol;n.JsonCodec=JsonCodec;n.JsonShapeDeserializer=JsonShapeDeserializer;n.JsonShapeSerializer=JsonShapeSerializer;n.QueryShapeSerializer=QueryShapeSerializer;n.XmlCodec=XmlCodec;n.XmlShapeDeserializer=XmlShapeDeserializer;n.XmlShapeSerializer=XmlShapeSerializer;n._toBool=_toBool;n._toNum=_toNum;n._toStr=_toStr;n.awsExpectUnion=awsExpectUnion;n.loadJsonRpcErrorCode=loadJsonRpcErrorCode;n.loadRestJsonErrorCode=loadRestJsonErrorCode;n.loadRestXmlErrorCode=loadRestXmlErrorCode;n.parseJsonBody=parseJsonBody;n.parseJsonErrorBody=parseJsonErrorBody;n.parseXmlBody=parseXmlBody;n.parseXmlErrorBody=parseXmlErrorBody},5606:(t,n,i)=>{const{setCredentialFeature:a}=i(5152);const{CredentialsProviderError:A}=i(7291);const c="AWS_ACCESS_KEY_ID";const l="AWS_SECRET_ACCESS_KEY";const d="AWS_SESSION_TOKEN";const h="AWS_CREDENTIAL_EXPIRATION";const f="AWS_CREDENTIAL_SCOPE";const g="AWS_ACCOUNT_ID";const fromEnv=t=>async()=>{t?.logger?.debug("@aws-sdk/credential-provider-env - fromEnv");const n=process.env[c];const i=process.env[l];const p=process.env[d];const m=process.env[h];const E=process.env[f];const C=process.env[g];if(n&&i){const t={accessKeyId:n,secretAccessKey:i,...p&&{sessionToken:p},...m&&{expiration:new Date(m)},...E&&{credentialScope:E},...C&&{accountId:C}};a(t,"CREDENTIALS_ENV_VARS","g");return t}throw new A("Unable to find environment variable credentials.",{logger:t?.logger})};n.ENV_ACCOUNT_ID=g;n.ENV_CREDENTIAL_SCOPE=f;n.ENV_EXPIRATION=h;n.ENV_KEY=c;n.ENV_SECRET=l;n.ENV_SESSION=d;n.fromEnv=fromEnv},8605:(t,n,i)=>{const{setCredentialFeature:a}=i(5152);const{CredentialsProviderError:A}=i(7291);const{NodeHttpHandler:c}=i(1279);const l=i(1455);const{HttpRequest:d}=i(3422);const{sdkStreamMixin:h,parseRfc3339DateTime:f}=i(2430);const g="169.254.170.2";const p="169.254.170.23";const m="[fd00:ec2::23]";const checkUrl=(t,n)=>{if(t.protocol==="https:"){return}if(t.hostname===g||t.hostname===p||t.hostname===m){return}if(t.hostname.includes("[")){if(t.hostname==="[::1]"||t.hostname==="[0000:0000:0000:0000:0000:0000:0000:0001]"){return}}else{if(t.hostname==="localhost"){return}const n=t.hostname.split(".");const inRange=t=>{const n=parseInt(t,10);return 0<=n&&n<=255};if(n[0]==="127"&&inRange(n[1])&&inRange(n[2])&&inRange(n[3])&&n.length===4){return}}throw new A(`URL not accepted. It must either be HTTPS or match one of the following:\n - loopback CIDR 127.0.0.0/8 or [::1/128]\n - ECS container host 169.254.170.2\n - EKS container host 169.254.170.23 or [fd00:ec2::23]`,{logger:n})};function createGetRequest(t){return new d({protocol:t.protocol,hostname:t.hostname,port:Number(t.port),path:t.pathname,query:Array.from(t.searchParams.entries()).reduce((t,[n,i])=>{t[n]=i;return t},{}),fragment:t.hash})}async function getCredentials(t,n){const i=h(t.body);const a=await i.transformToString();if(t.statusCode===200){const t=JSON.parse(a);if(typeof t.AccessKeyId!=="string"||typeof t.SecretAccessKey!=="string"||typeof t.Token!=="string"||typeof t.Expiration!=="string"){throw new A("HTTP credential provider response not of the required format, an object matching: "+"{ AccessKeyId: string, SecretAccessKey: string, Token: string, Expiration: string(rfc3339) }",{logger:n})}return{accessKeyId:t.AccessKeyId,secretAccessKey:t.SecretAccessKey,sessionToken:t.Token,expiration:f(t.Expiration)}}if(t.statusCode>=400&&t.statusCode<500){let i={};try{i=JSON.parse(a)}catch(t){}throw Object.assign(new A(`Server responded with status: ${t.statusCode}`,{logger:n}),{Code:i.Code,Message:i.Message})}throw new A(`Server responded with status: ${t.statusCode}`,{logger:n})}const retryWrapper=(t,n,i)=>async()=>{for(let a=0;asetTimeout(t,i))}}return await t()};const E="AWS_CONTAINER_CREDENTIALS_RELATIVE_URI";const C="http://169.254.170.2";const I="AWS_CONTAINER_CREDENTIALS_FULL_URI";const y="AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE";const B="AWS_CONTAINER_AUTHORIZATION_TOKEN";const fromHttp=(t={})=>{t.logger?.debug("@aws-sdk/credential-provider-http - fromHttp");let n;const i=t.awsContainerCredentialsRelativeUri??process.env[E];const d=t.awsContainerCredentialsFullUri??process.env[I];const h=t.awsContainerAuthorizationToken??process.env[B];const f=t.awsContainerAuthorizationTokenFile??process.env[y];const g=t.logger?.constructor?.name==="NoOpLogger"||!t.logger?.warn?console.warn:t.logger.warn.bind(t.logger);if(i&&d){g("@aws-sdk/credential-provider-http: "+"you have set both awsContainerCredentialsRelativeUri and awsContainerCredentialsFullUri.");g("awsContainerCredentialsFullUri will take precedence.")}if(h&&f){g("@aws-sdk/credential-provider-http: "+"you have set both awsContainerAuthorizationToken and awsContainerAuthorizationTokenFile.");g("awsContainerAuthorizationToken will take precedence.")}if(d){n=d}else if(i){n=`${C}${i}`}else{throw new A(`No HTTP credential provider host provided.\nSet AWS_CONTAINER_CREDENTIALS_FULL_URI or AWS_CONTAINER_CREDENTIALS_RELATIVE_URI.`,{logger:t.logger})}const p=new URL(n);checkUrl(p,t.logger);const m=c.create({connectionTimeout:t.timeout??1e3});const Q=t.timeout??1e3;const w=retryWrapper(async()=>{const n=createGetRequest(p);if(h){n.headers.Authorization=h}else if(f){n.headers.Authorization=(await l.readFile(f)).toString()}try{const t=await m.handle(n,{requestTimeout:Q});return getCredentials(t.response).then(t=>a(t,"CREDENTIALS_HTTP","z"))}catch(n){throw new A(String(n),{logger:t.logger})}},t.maxRetries??3,t.timeout??1e3);return async()=>{try{return await w()}finally{m.destroy?.()}}};n.fromHttp=fromHttp},5869:(t,n,i)=>{const{CredentialsProviderError:a,chain:A,getProfileName:c,parseKnownFiles:l}=i(7291);const{setCredentialFeature:d}=i(5152);const{fromLoginCredentials:h}=i(4072);const resolveCredentialSource=(t,n,c)=>{const l={EcsContainer:async t=>{const{fromHttp:n}=i(8605);const{fromContainerMetadata:a}=i(566);c?.debug("@aws-sdk/credential-provider-ini - credential_source is EcsContainer");return async()=>A(n(t??{}),a(t))().then(setNamedProvider)},Ec2InstanceMetadata:async t=>{c?.debug("@aws-sdk/credential-provider-ini - credential_source is Ec2InstanceMetadata");const{fromInstanceMetadata:n}=i(566);return async()=>n(t)().then(setNamedProvider)},Environment:async t=>{c?.debug("@aws-sdk/credential-provider-ini - credential_source is Environment");const{fromEnv:n}=i(5606);return async()=>n(t)().then(setNamedProvider)}};if(t in l){return l[t]}else{throw new a(`Unsupported credential source in profile ${n}. Got ${t}, `+`expected EcsContainer or Ec2InstanceMetadata or Environment.`,{logger:c})}};const setNamedProvider=t=>d(t,"CREDENTIALS_PROFILE_NAMED_PROVIDER","p");const isAssumeRoleProfile=(t,{profile:n="default",logger:i}={})=>Boolean(t)&&typeof t==="object"&&typeof t.role_arn==="string"&&["undefined","string"].indexOf(typeof t.role_session_name)>-1&&["undefined","string"].indexOf(typeof t.external_id)>-1&&["undefined","string"].indexOf(typeof t.mfa_serial)>-1&&(isAssumeRoleWithSourceProfile(t,{profile:n,logger:i})||isCredentialSourceProfile(t,{profile:n,logger:i}));const isAssumeRoleWithSourceProfile=(t,{profile:n,logger:i})=>{const a=typeof t.source_profile==="string"&&typeof t.credential_source==="undefined";if(a){i?.debug?.(` ${n} isAssumeRoleWithSourceProfile source_profile=${t.source_profile}`)}return a};const isCredentialSourceProfile=(t,{profile:n,logger:i})=>{const a=typeof t.credential_source==="string"&&typeof t.source_profile==="undefined";if(a){i?.debug?.(` ${n} isCredentialSourceProfile credential_source=${t.credential_source}`)}return a};const resolveAssumeRoleCredentials=async(t,n,A,l,h={},f)=>{A.logger?.debug("@aws-sdk/credential-provider-ini - resolveAssumeRoleCredentials (STS)");const g=n[t];const{source_profile:p,region:m}=g;if(!A.roleAssumer){const{getDefaultRoleAssumer:t}=i(1136);A.roleAssumer=t({...A.clientConfig,credentialProviderLogger:A.logger,parentClientConfig:{...l,...A?.parentClientConfig,region:m??A?.parentClientConfig?.region??l?.region}},A.clientPlugins)}if(p&&p in h){throw new a(`Detected a cycle attempting to resolve credentials for profile`+` ${c(A)}. Profiles visited: `+Object.keys(h).join(", "),{logger:A.logger})}A.logger?.debug(`@aws-sdk/credential-provider-ini - finding credential resolver using ${p?`source_profile=[${p}]`:`profile=[${t}]`}`);const E=p?f(p,n,A,l,{...h,[p]:true},isCredentialSourceWithoutRoleArn(n[p]??{})):(await resolveCredentialSource(g.credential_source,t,A.logger)(A))();if(isCredentialSourceWithoutRoleArn(g)){return E.then(t=>d(t,"CREDENTIALS_PROFILE_SOURCE_PROFILE","o"))}else{const n={RoleArn:g.role_arn,RoleSessionName:g.role_session_name||`aws-sdk-js-${Date.now()}`,ExternalId:g.external_id,DurationSeconds:parseInt(g.duration_seconds||"3600",10)};const{mfa_serial:i}=g;if(i){if(!A.mfaCodeProvider){throw new a(`Profile ${t} requires multi-factor authentication, but no MFA code callback was provided.`,{logger:A.logger,tryNextLink:false})}n.SerialNumber=i;n.TokenCode=await A.mfaCodeProvider(i)}const c=await E;return A.roleAssumer(c,n).then(t=>d(t,"CREDENTIALS_PROFILE_SOURCE_PROFILE","o"))}};const isCredentialSourceWithoutRoleArn=t=>!t.role_arn&&!!t.credential_source;const isLoginProfile=t=>Boolean(t&&t.login_session);const resolveLoginCredentials=async(t,n,i)=>{const a=await h({...n,profile:t})({callerClientConfig:i});return d(a,"CREDENTIALS_PROFILE_LOGIN","AC")};const isProcessProfile=t=>Boolean(t)&&typeof t==="object"&&typeof t.credential_process==="string";const resolveProcessCredentials=async(t,n)=>{const{fromProcess:a}=i(5360);const A=await a({...t,profile:n})();return d(A,"CREDENTIALS_PROFILE_PROCESS","v")};const resolveSsoCredentials=async(t,n,a={},A)=>{const{fromSSO:c}=i(998);return c({profile:t,logger:a.logger,parentClientConfig:a.parentClientConfig,clientConfig:a.clientConfig})({callerClientConfig:A}).then(t=>{if(n.sso_session){return d(t,"CREDENTIALS_PROFILE_SSO","r")}else{return d(t,"CREDENTIALS_PROFILE_SSO_LEGACY","t")}})};const isSsoProfile=t=>t&&(typeof t.sso_start_url==="string"||typeof t.sso_account_id==="string"||typeof t.sso_session==="string"||typeof t.sso_region==="string"||typeof t.sso_role_name==="string");const isStaticCredsProfile=t=>Boolean(t)&&typeof t==="object"&&typeof t.aws_access_key_id==="string"&&typeof t.aws_secret_access_key==="string"&&["undefined","string"].indexOf(typeof t.aws_session_token)>-1&&["undefined","string"].indexOf(typeof t.aws_account_id)>-1;const resolveStaticCredentials=async(t,n)=>{n?.logger?.debug("@aws-sdk/credential-provider-ini - resolveStaticCredentials");const i={accessKeyId:t.aws_access_key_id,secretAccessKey:t.aws_secret_access_key,sessionToken:t.aws_session_token,...t.aws_credential_scope&&{credentialScope:t.aws_credential_scope},...t.aws_account_id&&{accountId:t.aws_account_id}};return d(i,"CREDENTIALS_PROFILE","n")};const isWebIdentityProfile=t=>Boolean(t)&&typeof t==="object"&&typeof t.web_identity_token_file==="string"&&typeof t.role_arn==="string"&&["undefined","string"].indexOf(typeof t.role_session_name)>-1;const resolveWebIdentityCredentials=async(t,n,a)=>{const{fromTokenFile:A}=i(9956);const c=await A({webIdentityTokenFile:t.web_identity_token_file,roleArn:t.role_arn,roleSessionName:t.role_session_name,roleAssumerWithWebIdentity:n.roleAssumerWithWebIdentity,logger:n.logger,parentClientConfig:n.parentClientConfig})({callerClientConfig:a});return d(c,"CREDENTIALS_PROFILE_STS_WEB_ID_TOKEN","q")};const resolveProfileData=async(t,n,i,A,c={},l=false)=>{const d=n[t];if(Object.keys(c).length>0&&isStaticCredsProfile(d)){return resolveStaticCredentials(d,i)}if(l||isAssumeRoleProfile(d,{profile:t,logger:i.logger})){return resolveAssumeRoleCredentials(t,n,i,A,c,resolveProfileData)}if(isStaticCredsProfile(d)){return resolveStaticCredentials(d,i)}if(isWebIdentityProfile(d)){return resolveWebIdentityCredentials(d,i,A)}if(isProcessProfile(d)){return resolveProcessCredentials(i,t)}if(isSsoProfile(d)){return await resolveSsoCredentials(t,d,i,A)}if(isLoginProfile(d)){return resolveLoginCredentials(t,i,A)}throw new a(`Could not resolve credentials using profile: [${t}] in configuration/credentials file(s).`,{logger:i.logger})};const fromIni=(t={})=>async({callerClientConfig:n}={})=>{t.logger?.debug("@aws-sdk/credential-provider-ini - fromIni");const i=await l(t);return resolveProfileData(c({profile:t.profile??n?.profile}),i,t,n)};n.fromIni=fromIni},4072:(t,n,i)=>{const{setCredentialFeature:a}=i(5152);const{CredentialsProviderError:A,readFile:c,parseKnownFiles:l,getProfileName:d}=i(7291);const{HttpRequest:h}=i(3422);const{createHash:f,createPrivateKey:g,createPublicKey:p,sign:m}=i(7598);const{promises:E}=i(3024);const{homedir:C}=i(8161);const{dirname:I,join:y}=i(6760);class LoginCredentialsFetcher{profileData;init;callerClientConfig;static REFRESH_THRESHOLD=5*60*1e3;constructor(t,n,i){this.profileData=t;this.init=n;this.callerClientConfig=i}async loadCredentials(){const t=await this.loadToken();if(!t){throw new A(`Failed to load a token for session ${this.loginSession}, please re-authenticate using aws login`,{tryNextLink:false,logger:this.logger})}const n=t.accessToken;const i=Date.now();const a=new Date(n.expiresAt).getTime();const c=a-i;if(c<=LoginCredentialsFetcher.REFRESH_THRESHOLD){return this.refresh(t)}return{accessKeyId:n.accessKeyId,secretAccessKey:n.secretAccessKey,sessionToken:n.sessionToken,accountId:n.accountId,expiration:new Date(n.expiresAt)}}get logger(){return this.init?.logger}get loginSession(){return this.profileData.login_session}async refresh(t){const{SigninClient:n,CreateOAuth2TokenCommand:a}=i(9762);const{logger:c,userAgentAppId:l}=this.callerClientConfig??{};const isH2=t=>t?.metadata?.handlerProtocol==="h2";const d=isH2(this.callerClientConfig?.requestHandler)?undefined:this.callerClientConfig?.requestHandler;const h=this.profileData.region??await(this.callerClientConfig?.region?.())??process.env.AWS_REGION;const f=new n({credentials:{accessKeyId:"",secretAccessKey:""},region:h,requestHandler:d,logger:c,userAgentAppId:l,...this.init?.clientConfig});this.createDPoPInterceptor(f.middlewareStack);const g={tokenInput:{clientId:t.clientId,refreshToken:t.refreshToken,grantType:"refresh_token"}};try{const n=await f.send(new a(g));const{accessKeyId:i,secretAccessKey:c,sessionToken:l}=n.tokenOutput?.accessToken??{};const{refreshToken:d,expiresIn:h}=n.tokenOutput??{};if(!i||!c||!l||!d){throw new A("Token refresh response missing required fields",{logger:this.logger,tryNextLink:false})}const p=(h??900)*1e3;const m=new Date(Date.now()+p);const E={...t,accessToken:{...t.accessToken,accessKeyId:i,secretAccessKey:c,sessionToken:l,expiresAt:m.toISOString()},refreshToken:d};await this.saveToken(E);const C=E.accessToken;return{accessKeyId:C.accessKeyId,secretAccessKey:C.secretAccessKey,sessionToken:C.sessionToken,accountId:C.accountId,expiration:m}}catch(t){if(t.name==="AccessDeniedException"){const n=t.error;let i;switch(n){case"TOKEN_EXPIRED":i="Your session has expired. Please reauthenticate.";break;case"USER_CREDENTIALS_CHANGED":i="Unable to refresh credentials because of a change in your password. Please reauthenticate with your new password.";break;case"INSUFFICIENT_PERMISSIONS":i="Unable to refresh credentials due to insufficient permissions. You may be missing permission for the 'CreateOAuth2Token' action.";break;default:i=`Failed to refresh token: ${String(t)}. Please re-authenticate using \`aws login\``}throw new A(i,{logger:this.logger,tryNextLink:false})}throw new A(`Failed to refresh token: ${String(t)}. Please re-authenticate using aws login`,{logger:this.logger})}}async loadToken(){const t=this.getTokenFilePath();try{let n;try{n=await c(t,{ignoreCache:this.init?.ignoreCache})}catch{n=await E.readFile(t,"utf8")}const i=JSON.parse(n);const a=["accessToken","clientId","refreshToken","dpopKey"].filter(t=>!i[t]);if(!i.accessToken?.accountId){a.push("accountId")}if(a.length>0){throw new A(`Token validation failed, missing fields: ${a.join(", ")}`,{logger:this.logger,tryNextLink:false})}return i}catch(n){throw new A(`Failed to load token from ${t}: ${String(n)}`,{logger:this.logger,tryNextLink:false})}}async saveToken(t){const n=this.getTokenFilePath();const i=I(n);try{await E.mkdir(i,{recursive:true})}catch(t){}await E.writeFile(n,JSON.stringify(t,null,2),"utf8")}getTokenFilePath(){const t=process.env.AWS_LOGIN_CACHE_DIRECTORY??y(C(),".aws","login","cache");const n=Buffer.from(this.loginSession,"utf8");const i=f("sha256").update(n).digest("hex");return y(t,`${i}.json`)}derToRawSignature(t){let n=2;if(t[n]!==2){throw new Error("Invalid DER signature")}n++;const i=t[n++];let a=t.subarray(n,n+i);n+=i;if(t[n]!==2){throw new Error("Invalid DER signature")}n++;const A=t[n++];let c=t.subarray(n,n+A);a=a[0]===0?a.subarray(1):a;c=c[0]===0?c.subarray(1):c;const l=Buffer.concat([Buffer.alloc(32-a.length),a]);const d=Buffer.concat([Buffer.alloc(32-c.length),c]);return Buffer.concat([l,d])}createDPoPInterceptor(t){t.add(t=>async n=>{if(h.isInstance(n.request)){const t=n.request;const i=`${t.protocol}//${t.hostname}${t.port?`:${t.port}`:""}${t.path}`;const a=await this.generateDpop(t.method,i);t.headers={...t.headers,DPoP:a}}return t(n)},{step:"finalizeRequest",name:"dpopInterceptor",override:true})}async generateDpop(t="POST",n){const i=await this.loadToken();try{const a=g({key:i.dpopKey,format:"pem",type:"sec1"});const A=p(a);const c=A.export({format:"der",type:"spki"});let l=-1;for(let t=0;tasync({callerClientConfig:n}={})=>{t?.logger?.debug?.("@aws-sdk/credential-providers - fromLoginCredentials");const i=await l(t||{});const c=d({profile:t?.profile??n?.profile});const h=i[c];if(!h?.login_session){throw new A(`Profile ${c} does not contain login_session.`,{tryNextLink:true,logger:t?.logger})}const f=new LoginCredentialsFetcher(h,t,n);const g=await f.loadCredentials();return a(g,"CREDENTIALS_LOGIN","AD")};n.fromLoginCredentials=fromLoginCredentials},5861:(t,n,i)=>{const{ENV_KEY:a,ENV_SECRET:A,fromEnv:c}=i(5606);const{chain:l,CredentialsProviderError:d,ENV_PROFILE:h}=i(7291);const f="AWS_EC2_METADATA_DISABLED";const remoteProvider=async t=>{const{ENV_CMDS_FULL_URI:n,ENV_CMDS_RELATIVE_URI:a,fromContainerMetadata:A,fromInstanceMetadata:c}=i(566);if(process.env[a]||process.env[n]){t.logger?.debug("@aws-sdk/credential-provider-node - remoteProvider::fromHttp/fromContainerMetadata");const{fromHttp:n}=i(8605);return l(n(t),A(t))}if(process.env[f]&&process.env[f]!=="false"){return async()=>{throw new d("EC2 Instance Metadata Service access disabled",{logger:t.logger})}}t.logger?.debug("@aws-sdk/credential-provider-node - remoteProvider::fromInstanceMetadata");return c(t)};function memoizeChain(t,n){const i=internalCreateChain(t);let a;let A;let c;let l;const provider=async t=>{if(t?.forceRefresh){if(!l){l=i(t).then(t=>{c=t}).finally(()=>{l=undefined})}await l;return c}if(c?.expiration){if(c?.expiration?.getTime(){c=t}).finally(()=>{A=undefined})}}else{a=i(t).then(t=>{c=t}).finally(()=>{a=undefined});return provider(t)}}return c};return provider}const internalCreateChain=t=>async n=>{let i;for(const a of t){try{return await a(n)}catch(t){i=t;if(t?.tryNextLink){continue}throw t}}throw i};let g=false;const defaultProvider=(t={})=>memoizeChain([async()=>{const n=t.profile??process.env[h];if(n){const n=process.env[a]&&process.env[A];if(n){if(!g){const n=t.logger?.warn&&t.logger?.constructor?.name!=="NoOpLogger"?t.logger.warn.bind(t.logger):console.warn;n(`@aws-sdk/credential-provider-node - defaultProvider::fromEnv WARNING:\n Multiple credential sources detected: \n Both AWS_PROFILE and the pair AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY static credentials are set.\n This SDK will proceed with the AWS_PROFILE value.\n \n However, a future version may change this behavior to prefer the ENV static credentials.\n Please ensure that your environment only sets either the AWS_PROFILE or the\n AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY pair.\n`);g=true}}throw new d("AWS_PROFILE is set, skipping fromEnv provider.",{logger:t.logger,tryNextLink:true})}t.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromEnv");return c(t)()},async n=>{t.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromSSO");const{ssoStartUrl:a,ssoAccountId:A,ssoRegion:c,ssoRoleName:l,ssoSession:h}=t;if(!a&&!A&&!c&&!l&&!h){throw new d("Skipping SSO provider in default chain (inputs do not include SSO fields).",{logger:t.logger})}const{fromSSO:f}=i(998);return f(t)(n)},async n=>{t.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromIni");const{fromIni:a}=i(5869);return a(t)(n)},async n=>{t.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromProcess");const{fromProcess:a}=i(5360);return a(t)(n)},async n=>{t.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromTokenFile");const{fromTokenFile:a}=i(9956);return a(t)(n)},async()=>{t.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::remoteProvider");return(await remoteProvider(t))()},async()=>{throw new d("Could not load credentials from any providers",{tryNextLink:false,logger:t.logger})}],credentialsTreatedAsExpired);const credentialsWillNeedRefresh=t=>t?.expiration!==undefined;const credentialsTreatedAsExpired=t=>t?.expiration!==undefined&&t.expiration.getTime()-Date.now()<3e5;n.credentialsTreatedAsExpired=credentialsTreatedAsExpired;n.credentialsWillNeedRefresh=credentialsWillNeedRefresh;n.defaultProvider=defaultProvider},5360:(t,n,i)=>{const{externalDataInterceptor:a,CredentialsProviderError:A,parseKnownFiles:c,getProfileName:l}=i(7291);const{exec:d}=i(1421);const{promisify:h}=i(7975);const{setCredentialFeature:f}=i(5152);const getValidatedProcessCredentials=(t,n,i)=>{if(n.Version!==1){throw Error(`Profile ${t} credential_process did not return Version 1.`)}if(n.AccessKeyId===undefined||n.SecretAccessKey===undefined){throw Error(`Profile ${t} credential_process returned invalid credentials.`)}if(n.Expiration){const i=new Date;const a=new Date(n.Expiration);if(a{const c=n[t];if(n[t]){const l=c["credential_process"];if(l!==undefined){const c=h(a?.getTokenRecord?.().exec??d);try{const{stdout:i}=await c(l);let a;try{a=JSON.parse(i.trim())}catch{throw Error(`Profile ${t} credential_process returned invalid JSON.`)}return getValidatedProcessCredentials(t,a,n)}catch(t){throw new A(t.message,{logger:i})}}else{throw new A(`Profile ${t} did not contain credential_process.`,{logger:i})}}else{throw new A(`Profile ${t} could not be found in shared credentials file.`,{logger:i})}};const fromProcess=(t={})=>async({callerClientConfig:n}={})=>{t.logger?.debug("@aws-sdk/credential-provider-process - fromProcess");const i=await c(t);return resolveProcessCredentials(l({profile:t.profile??n?.profile}),i,t.logger)};n.fromProcess=fromProcess},998:(t,n,i)=>{const{CredentialsProviderError:a,getSSOTokenFromFile:A,getProfileName:c,parseKnownFiles:l,loadSsoSessionData:d}=i(7291);const{setCredentialFeature:h}=i(5152);const{fromSso:f}=i(5433);const isSsoProfile=t=>t&&(typeof t.sso_start_url==="string"||typeof t.sso_account_id==="string"||typeof t.sso_session==="string"||typeof t.sso_region==="string"||typeof t.sso_role_name==="string");const g=false;const resolveSSOCredentials=async({ssoStartUrl:t,ssoSession:n,ssoAccountId:c,ssoRegion:l,ssoRoleName:d,ssoClient:p,clientConfig:m,parentClientConfig:E,callerClientConfig:C,profile:I,filepath:y,configFilepath:B,ignoreCache:Q,logger:w})=>{let S;const b=`To refresh this SSO session run aws sso login with the corresponding profile.`;if(n){try{const t=await f({profile:I,filepath:y,configFilepath:B,ignoreCache:Q,clientConfig:m,parentClientConfig:E,logger:w})({callerClientConfig:C});S={accessToken:t.token,expiresAt:new Date(t.expiration).toISOString()}}catch(t){throw new a(t.message,{tryNextLink:g,logger:w})}}else{try{S=await A(t)}catch(t){throw new a(`The SSO session associated with this profile is invalid. ${b}`,{tryNextLink:g,logger:w})}}if(new Date(S.expiresAt).getTime()-Date.now()<=0){throw new a(`The SSO session associated with this profile has expired. ${b}`,{tryNextLink:g,logger:w})}const{accessToken:R}=S;const{SSOClient:v,GetRoleCredentialsCommand:k}=i(3707);const D=p||new v(Object.assign({},m??{},{logger:m?.logger??C?.logger??E?.logger,region:m?.region??l,userAgentAppId:m?.userAgentAppId??C?.userAgentAppId??E?.userAgentAppId}));let T;try{T=await D.send(new k({accountId:c,roleName:d,accessToken:R}))}catch(t){throw new a(t,{tryNextLink:g,logger:w})}const{roleCredentials:{accessKeyId:N,secretAccessKey:M,sessionToken:F,expiration:x,credentialScope:U,accountId:P}={}}=T;if(!N||!M||!F||!x){throw new a("SSO returns an invalid temporary credential.",{tryNextLink:g,logger:w})}const L={accessKeyId:N,secretAccessKey:M,sessionToken:F,expiration:new Date(x),...U&&{credentialScope:U},...P&&{accountId:P}};if(n){h(L,"CREDENTIALS_SSO","s")}else{h(L,"CREDENTIALS_SSO_LEGACY","u")}return L};const validateSsoProfile=(t,n)=>{const{sso_start_url:i,sso_account_id:A,sso_region:c,sso_role_name:l}=t;if(!i||!A||!c||!l){throw new a(`Profile is configured with invalid SSO credentials. Required parameters "sso_account_id", `+`"sso_region", "sso_role_name", "sso_start_url". Got ${Object.keys(t).join(", ")}\nReference: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sso.html`,{tryNextLink:false,logger:n})}return t};const fromSSO=(t={})=>async({callerClientConfig:n}={})=>{t.logger?.debug("@aws-sdk/credential-provider-sso - fromSSO");const{ssoStartUrl:i,ssoAccountId:A,ssoRegion:h,ssoRoleName:f,ssoSession:g}=t;const{ssoClient:p}=t;const m=c({profile:t.profile??n?.profile});if(!i&&!A&&!h&&!f&&!g){const n=await l(t);const A=n[m];if(!A){throw new a(`Profile ${m} was not found.`,{logger:t.logger})}if(!isSsoProfile(A)){throw new a(`Profile ${m} is not configured with SSO credentials.`,{logger:t.logger})}if(A?.sso_session){const n=await d(t);const c=n[A.sso_session];const l=` configurations in profile ${m} and sso-session ${A.sso_session}`;if(h&&h!==c.sso_region){throw new a(`Conflicting SSO region`+l,{tryNextLink:false,logger:t.logger})}if(i&&i!==c.sso_start_url){throw new a(`Conflicting SSO start_url`+l,{tryNextLink:false,logger:t.logger})}A.sso_region=c.sso_region;A.sso_start_url=c.sso_start_url}const{sso_start_url:c,sso_account_id:f,sso_region:g,sso_role_name:E,sso_session:C}=validateSsoProfile(A,t.logger);return resolveSSOCredentials({ssoStartUrl:c,ssoSession:C,ssoAccountId:f,ssoRegion:g,ssoRoleName:E,ssoClient:p,clientConfig:t.clientConfig,parentClientConfig:t.parentClientConfig,callerClientConfig:t.callerClientConfig,profile:m,filepath:t.filepath,configFilepath:t.configFilepath,ignoreCache:t.ignoreCache,logger:t.logger})}else if(!i||!A||!h||!f){throw new a("Incomplete configuration. The fromSSO() argument hash must include "+'"ssoStartUrl", "ssoAccountId", "ssoRegion", "ssoRoleName"',{tryNextLink:false,logger:t.logger})}else{return resolveSSOCredentials({ssoStartUrl:i,ssoSession:g,ssoAccountId:A,ssoRegion:h,ssoRoleName:f,ssoClient:p,clientConfig:t.clientConfig,parentClientConfig:t.parentClientConfig,callerClientConfig:t.callerClientConfig,profile:m,filepath:t.filepath,configFilepath:t.configFilepath,ignoreCache:t.ignoreCache,logger:t.logger})}};n.fromSSO=fromSSO;n.isSsoProfile=isSsoProfile;n.validateSsoProfile=validateSsoProfile},3707:(t,n,i)=>{const{GetRoleCredentialsCommand:a,SSOClient:A}=i(2579);n.GetRoleCredentialsCommand=a;n.SSOClient=A},9956:(t,n,i)=>{const{setCredentialFeature:a}=i(5152);const{CredentialsProviderError:A,externalDataInterceptor:c}=i(7291);const{readFileSync:l}=i(3024);const fromWebToken=t=>async n=>{t.logger?.debug("@aws-sdk/credential-provider-web-identity - fromWebToken");const{roleArn:a,roleSessionName:A,webIdentityToken:c,providerId:l,policyArns:d,policy:h,durationSeconds:f}=t;let{roleAssumerWithWebIdentity:g}=t;if(!g){const{getDefaultRoleAssumerWithWebIdentity:a}=i(1136);g=a({...t.clientConfig,credentialProviderLogger:t.logger,parentClientConfig:{...n?.callerClientConfig,...t.parentClientConfig}},t.clientPlugins)}return g({RoleArn:a,RoleSessionName:A??`aws-sdk-js-session-${Date.now()}`,WebIdentityToken:c,ProviderId:l,PolicyArns:d,Policy:h,DurationSeconds:f})};const d="AWS_WEB_IDENTITY_TOKEN_FILE";const h="AWS_ROLE_ARN";const f="AWS_ROLE_SESSION_NAME";const fromTokenFile=(t={})=>async n=>{t.logger?.debug("@aws-sdk/credential-provider-web-identity - fromTokenFile");const i=t?.webIdentityTokenFile??process.env[d];const g=t?.roleArn??process.env[h];const p=t?.roleSessionName??process.env[f];if(!i||!g){throw new A("Web identity configuration not specified",{logger:t.logger})}const m=await fromWebToken({...t,webIdentityToken:c?.getTokenRecord?.()[i]??l(i,{encoding:"ascii"}),roleArn:g,roleSessionName:p})(n);if(i===process.env[d]){a(m,"CREDENTIALS_ENV_VARS_STS_WEB_ID_TOKEN","h")}return m};n.fromTokenFile=fromTokenFile;n.fromWebToken=fromWebToken},4431:(t,n,i)=>{const a=i(9214);class EndpointCache{cache;constructor(t){this.cache=new a(t)}getEndpoint(t){const n=this.get(t);if(!n||n.length===0){return undefined}const i=n.map(t=>t.Address);return i[Math.floor(Math.random()*i.length)]}get(t){if(!this.has(t)){return}const n=this.cache.get(t);if(!n){return}const i=Date.now();const a=n.filter(t=>i({Address:t,Expires:i+n*60*1e3})))}delete(t){this.cache.set(t,[])}has(t){if(!this.cache.has(t)){return false}const n=this.cache.peek(t);if(!n){return false}return n.length>0}clear(){this.cache.clear()}}n.EndpointCache=EndpointCache},3688:(t,n,i)=>{const{HttpRequest:a}=i(3422);const{EndpointCache:A}=i(4431);const c=["AWS_ENABLE_ENDPOINT_DISCOVERY","AWS_ENDPOINT_DISCOVERY_ENABLED"];const l="endpoint_discovery_enabled";const isFalsy=t=>["false","0"].indexOf(t)>=0;const d={environmentVariableSelector:t=>{for(let n=0;n{if(l in t){const n=t[l];if(n===undefined){throw Error(`Shared config entry ${l} can't be undefined, got "${n}"`)}return!isFalsy(n)}},default:undefined};const getCacheKey=async(t,n,i)=>{const{accessKeyId:a}=await n.credentials();const{identifiers:A}=i;return JSON.stringify({...a&&{accessKeyId:a},...A&&{commandName:t,identifiers:Object.entries(A).sort().reduce((t,[n,i])=>({...t,[n]:i}),{})}})};const h={};const updateDiscoveredEndpointInCache=async(t,n)=>new Promise((i,a)=>{const{endpointCache:A}=t;const{cacheKey:c,commandName:l,identifiers:d}=n;const f=A.get(c);if(f&&f.length===1&&f[0].Address===""){if(n.isDiscoveredEndpointRequired){if(!h[c])h[c]=[];h[c].push({resolve:i,reject:a})}else{i()}}else if(f&&f.length>0){i()}else{const f=[{Address:"",CachePeriodInMinutes:1}];A.set(c,f);const g=new n.endpointDiscoveryCommandCtor({Operation:l.slice(0,-7),Identifiers:d});const p=g.resolveMiddleware(n.clientStack,t,n.options);p(g).then(t=>{A.set(c,t.output.Endpoints);if(h[c]){h[c].forEach(({resolve:t})=>{t()});delete h[c]}i()}).catch(t=>{A.delete(c);const l=Object.assign(new Error(`The operation to discover endpoint failed.`+` Please retry, or provide a custom endpoint and disable endpoint discovery to proceed.`),{reason:t});if(h[c]){h[c].forEach(({reject:t})=>{t(l)});delete h[c]}if(n.isDiscoveredEndpointRequired){a(l)}else{A.set(c,f);i()}})}});const endpointDiscoveryMiddleware=(t,n)=>(i,A)=>async c=>{if(t.isCustomEndpoint){if(t.isClientEndpointDiscoveryEnabled){throw new Error(`Custom endpoint is supplied; endpointDiscoveryEnabled must not be true.`)}return i(c)}const{endpointDiscoveryCommandCtor:l}=t;const{isDiscoveredEndpointRequired:d,identifiers:h}=n;const f=A.clientName;const g=A.commandName;const p=await t.endpointDiscoveryEnabled();const m=await getCacheKey(g,t,{identifiers:h});if(d){if(p===false){throw new Error(`Endpoint Discovery is disabled but ${g} on ${f} requires it.`+` Please check your configurations.`)}await updateDiscoveredEndpointInCache(t,{...n,commandName:g,cacheKey:m,endpointDiscoveryCommandCtor:l})}else if(p){updateDiscoveredEndpointInCache(t,{...n,commandName:g,cacheKey:m,endpointDiscoveryCommandCtor:l})}const{request:E}=c;if(m&&a.isInstance(E)){const n=t.endpointCache.getEndpoint(m);if(n){E.hostname=n}}return i(c)};const f={name:"endpointDiscoveryMiddleware",step:"build",tags:["ENDPOINT_DISCOVERY"],override:true};const getEndpointDiscoveryPlugin=(t,n)=>({applyToStack:i=>{i.add(endpointDiscoveryMiddleware(t,n),f)}});const getEndpointDiscoveryRequiredPlugin=(t,n)=>({applyToStack:i=>{i.add(endpointDiscoveryMiddleware(t,{...n,isDiscoveredEndpointRequired:true}),f)}});const getEndpointDiscoveryOptionalPlugin=(t,n)=>({applyToStack:i=>{i.add(endpointDiscoveryMiddleware(t,{...n,isDiscoveredEndpointRequired:false}),f)}});const resolveEndpointDiscoveryConfig=(t,{endpointDiscoveryCommandCtor:n})=>{const{endpointCacheSize:i,endpointDiscoveryEnabled:a,endpointDiscoveryEnabledProvider:c}=t;return Object.assign(t,{endpointDiscoveryCommandCtor:n,endpointCache:new A(i??1e3),endpointDiscoveryEnabled:a!==undefined?()=>Promise.resolve(a):c,isClientEndpointDiscoveryEnabled:a!==undefined})};n.NODE_ENDPOINT_DISCOVERY_CONFIG_OPTIONS=d;n.endpointDiscoveryMiddlewareOptions=f;n.getEndpointDiscoveryOptionalPlugin=getEndpointDiscoveryOptionalPlugin;n.getEndpointDiscoveryPlugin=getEndpointDiscoveryPlugin;n.getEndpointDiscoveryRequiredPlugin=getEndpointDiscoveryRequiredPlugin;n.resolveEndpointDiscoveryConfig=resolveEndpointDiscoveryConfig},9762:(t,n,i)=>{const{awsEndpointFunctions:a,emitWarningIfUnsupportedVersion:A,createDefaultUserAgentProvider:c,NODE_APP_ID_CONFIG_OPTIONS:l,getAwsRegionExtensionConfiguration:d,resolveAwsRegionExtensionConfiguration:h,resolveUserAgentConfig:f,resolveHostHeaderConfig:g,getUserAgentPlugin:p,getHostHeaderPlugin:m,getLoggerPlugin:E,getRecursionDetectionPlugin:C}=i(5152);const{NoAuthSigner:I,getHttpAuthSchemeEndpointRuleSetPlugin:y,DefaultIdentityProviderConfig:B,getHttpSigningPlugin:Q}=i(402);const{normalizeProvider:w,getSmithyContext:S,ServiceException:b,NoOpLogger:R,emitWarningIfUnsupportedVersion:v,loadConfigsForDefaultMode:k,getDefaultExtensionConfiguration:D,resolveDefaultRuntimeConfig:T,Client:N,makeBuilder:M,createAggregatedClient:F}=i(2658);const{Command:x}=i(2658);n.$Command=x;n.__Client=N;const{resolveDefaultsModeConfig:U,loadConfig:P,NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS:L,NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS:O,NODE_REGION_CONFIG_OPTIONS:H,NODE_REGION_CONFIG_FILE_OPTIONS:$,resolveRegionConfig:G}=i(7291);const{BinaryDecisionDiagram:V,EndpointCache:Y,decideEndpoint:J,customEndpointFunctions:W,resolveEndpointConfig:q,getEndpointPlugin:j}=i(2085);const{parseUrl:z,getHttpHandlerExtensionConfiguration:K,resolveHttpHandlerRuntimeConfig:Z,getContentLengthPlugin:X}=i(3422);const{DEFAULT_RETRY_MODE:ee,NODE_RETRY_MODE_CONFIG_OPTIONS:te,NODE_MAX_ATTEMPT_CONFIG_OPTIONS:re,resolveRetryConfig:ne,getRetryPlugin:se}=i(3609);const{TypeRegistry:oe,getSchemaSerdePlugin:ie}=i(6890);const{resolveAwsSdkSigV4Config:ae,AwsSdkSigV4Signer:Ae,NODE_AUTH_SCHEME_PREFERENCE_OPTIONS:ce}=i(7523);const{toUtf8:le,fromUtf8:ue,toBase64:de,fromBase64:he,calculateBodyLength:fe}=i(2430);const{streamCollector:ge,NodeHttpHandler:pe}=i(1279);const{AwsRestJsonProtocol:me}=i(7288);const{Sha256:Ee}=i(9542);const defaultSigninHttpAuthSchemeParametersProvider=async(t,n,i)=>({operation:S(n).operation,region:await w(t.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});function createAwsAuthSigv4HttpAuthOption(t){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"signin",region:t.region},propertiesExtractor:(t,n)=>({signingProperties:{config:t,context:n}})}}function createSmithyApiNoAuthHttpAuthOption(t){return{schemeId:"smithy.api#noAuth"}}const defaultSigninHttpAuthSchemeProvider=t=>{const n=[];switch(t.operation){case"CreateOAuth2Token":{n.push(createSmithyApiNoAuthHttpAuthOption());break}default:{n.push(createAwsAuthSigv4HttpAuthOption(t))}}return n};const resolveHttpAuthSchemeConfig=t=>{const n=ae(t);return Object.assign(n,{authSchemePreference:w(t.authSchemePreference??[])})};const resolveClientEndpointParameters=t=>Object.assign(t,{useDualstackEndpoint:t.useDualstackEndpoint??false,useFipsEndpoint:t.useFipsEndpoint??false,defaultSigningName:"signin"});const Ce={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}};var Ie="3.997.25";var ye={version:Ie};const Be="ref";const Qe=-1,we=true,Se="isSet",be="booleanEquals",Re="PartitionResult",ve="stringEquals",ke="getAttr",De="https://signin.{Region}.{PartitionResult#dualStackDnsSuffix}",Te={[Be]:"Endpoint"},Ne={fn:ke,argv:[{[Be]:Re},"name"]},Me={[Be]:Re},Fe={[Be]:"Region"},xe={authSchemes:[{name:"sigv4",signingName:"signin",signingRegion:"{Region}"}]},Ue={},Pe=[Fe];const Le={conditions:[[Se,Pe],[be,[{fn:"coalesce",argv:[{[Be]:"IsControlPlane"},false]},we]],[Se,[Te]],["aws.partition",Pe,Re],[be,[{[Be]:"UseFIPS"},we]],[be,[{[Be]:"UseDualStack"},we]],[ve,[Ne,"aws"]],[ve,[Ne,"aws-cn"]],[be,[{fn:ke,argv:[Me,"supportsDualStack"]},we]],[ve,[Fe,"us-gov-west-1"]],[ve,[Ne,"aws-us-gov"]],[be,[{fn:ke,argv:[Me,"supportsFIPS"]},we]],[ve,[Ne,"aws-iso"]],[ve,[Ne,"aws-iso-b"]],[ve,[Ne,"aws-iso-f"]],[ve,[Ne,"aws-iso-e"]],[ve,[Ne,"aws-eusc"]]],results:[[Qe],["https://signin.{Region}.api.aws",xe],["https://signin.{Region}.api.amazonwebservices.com.cn",xe],[De,xe],["https://{Region}.signin.aws.amazon.com",Ue],["https://{Region}.signin.amazonaws.cn",Ue],["https://{Region}.signin.amazonaws-us-gov.com",Ue],["https://{Region}.signin.c2shome.ic.gov",Ue],["https://{Region}.signin.sc2shome.sgov.gov",Ue],["https://{Region}.signin.csphome.hci.ic.gov",Ue],["https://{Region}.signin.csphome.adc-e.uk",Ue],["https://{Region}.signin.amazonaws-eusc.eu",Ue],["https://signin-fips.amazonaws-us-gov.com",Ue],["https://{Region}.signin-fips.amazonaws-us-gov.com",Ue],["https://{Region}.signin.{PartitionResult#dnsSuffix}",Ue],[Qe,"Invalid Configuration: FIPS and custom endpoint are not supported"],[Qe,"Invalid Configuration: Dualstack and custom endpoint are not supported"],[Te,Ue],["https://signin-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",Ue],[Qe,"FIPS and DualStack are enabled, but this partition does not support one or both"],["https://signin-fips.{Region}.{PartitionResult#dnsSuffix}",Ue],[Qe,"FIPS is enabled but this partition does not support FIPS"],[De,Ue],[Qe,"DualStack is enabled but this partition does not support DualStack"],["https://signin.{Region}.{PartitionResult#dnsSuffix}",Ue],[Qe,"Invalid Configuration: Missing Region"]]};const _e=2;const Oe=1e8;const He=new Int32Array([-1,1,-1,0,4,3,2,30,Oe+25,1,24,5,2,30,6,3,7,26,4,18,8,5,17,9,6,Oe+4,10,7,Oe+5,11,10,Oe+6,12,12,Oe+7,13,13,Oe+8,14,14,Oe+9,15,15,Oe+10,16,16,Oe+11,Oe+14,8,Oe+22,Oe+23,5,22,19,9,Oe+12,20,10,Oe+13,21,11,Oe+20,Oe+21,8,23,Oe+19,11,Oe+18,Oe+19,2,29,25,3,32,26,4,27,Oe+25,5,Oe+25,28,9,Oe+12,Oe+25,3,32,30,4,Oe+15,31,5,Oe+16,Oe+17,6,Oe+1,33,7,Oe+2,Oe+3]);const $e=V.from(He,_e,Le.conditions,Le.results);const Ge=new Y({size:50,params:["Endpoint","IsControlPlane","Region","UseDualStack","UseFIPS"]});const defaultEndpointResolver=(t,n={})=>Ge.get(t,()=>J($e,{endpointParams:t,logger:n.logger}));W.aws=a;class SigninServiceException extends b{constructor(t){super(t);Object.setPrototypeOf(this,SigninServiceException.prototype)}}class AccessDeniedException extends SigninServiceException{name="AccessDeniedException";$fault="client";error;constructor(t){super({name:"AccessDeniedException",$fault:"client",...t});Object.setPrototypeOf(this,AccessDeniedException.prototype);this.error=t.error}}class InternalServerException extends SigninServiceException{name="InternalServerException";$fault="server";error;constructor(t){super({name:"InternalServerException",$fault:"server",...t});Object.setPrototypeOf(this,InternalServerException.prototype);this.error=t.error}}class TooManyRequestsError extends SigninServiceException{name="TooManyRequestsError";$fault="client";error;constructor(t){super({name:"TooManyRequestsError",$fault:"client",...t});Object.setPrototypeOf(this,TooManyRequestsError.prototype);this.error=t.error}}class ValidationException extends SigninServiceException{name="ValidationException";$fault="client";error;constructor(t){super({name:"ValidationException",$fault:"client",...t});Object.setPrototypeOf(this,ValidationException.prototype);this.error=t.error}}const Ve="AccessDeniedException";const Ye="AccessToken";const Je="CreateOAuth2Token";const We="CreateOAuth2TokenRequest";const qe="CreateOAuth2TokenRequestBody";const je="CreateOAuth2TokenResponseBody";const ze="CreateOAuth2TokenResponse";const Ke="InternalServerException";const Ze="RefreshToken";const Xe="TooManyRequestsError";const et="ValidationException";const tt="accessKeyId";const rt="accessToken";const nt="client";const st="clientId";const ot="codeVerifier";const it="code";const at="error";const At="expiresIn";const ct="grantType";const lt="http";const ut="httpError";const dt="idToken";const ht="jsonName";const ft="message";const gt="refreshToken";const pt="redirectUri";const mt="smithy.ts.sdk.synthetic.com.amazonaws.signin";const Et="secretAccessKey";const Ct="sessionToken";const It="server";const yt="tokenInput";const Bt="tokenOutput";const Qt="tokenType";const wt="com.amazonaws.signin";const St=oe.for(mt);var bt=[-3,mt,"SigninServiceException",0,[],[]];St.registerError(bt,SigninServiceException);const Rt=oe.for(wt);var vt=[-3,wt,Ve,{[at]:nt},[at,ft],[0,0],2];Rt.registerError(vt,AccessDeniedException);var kt=[-3,wt,Ke,{[at]:It,[ut]:500},[at,ft],[0,0],2];Rt.registerError(kt,InternalServerException);var Dt=[-3,wt,Xe,{[at]:nt,[ut]:429},[at,ft],[0,0],2];Rt.registerError(Dt,TooManyRequestsError);var Tt=[-3,wt,et,{[at]:nt,[ut]:400},[at,ft],[0,0],2];Rt.registerError(Tt,ValidationException);const Nt=[St,Rt];var Mt=[0,wt,Ze,8,0];var Ft=[3,wt,Ye,8,[tt,Et,Ct],[[0,{[ht]:tt}],[0,{[ht]:Et}],[0,{[ht]:Ct}]],3];var xt=[3,wt,We,0,[yt],[[()=>Ut,16]],1];var Ut=[3,wt,qe,0,[st,ct,it,pt,ot,gt],[[0,{[ht]:st}],[0,{[ht]:ct}],0,[0,{[ht]:pt}],[0,{[ht]:ot}],[()=>Mt,{[ht]:gt}]],2];var Pt=[3,wt,ze,0,[Bt],[[()=>Lt,16]],1];var Lt=[3,wt,je,0,[rt,Qt,At,gt,dt],[[()=>Ft,{[ht]:rt}],[0,{[ht]:Qt}],[1,{[ht]:At}],[()=>Mt,{[ht]:gt}],[0,{[ht]:dt}]],4];var _t=[9,wt,Je,{[lt]:["POST","/v1/token",200]},()=>xt,()=>Pt];const getRuntimeConfig$1=t=>({apiVersion:"2023-01-01",base64Decoder:t?.base64Decoder??he,base64Encoder:t?.base64Encoder??de,disableHostPrefix:t?.disableHostPrefix??false,endpointProvider:t?.endpointProvider??defaultEndpointResolver,extensions:t?.extensions??[],httpAuthSchemeProvider:t?.httpAuthSchemeProvider??defaultSigninHttpAuthSchemeProvider,httpAuthSchemes:t?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:t=>t.getIdentityProvider("aws.auth#sigv4"),signer:new Ae},{schemeId:"smithy.api#noAuth",identityProvider:t=>t.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new I}],logger:t?.logger??new R,protocol:t?.protocol??me,protocolSettings:t?.protocolSettings??{defaultNamespace:"com.amazonaws.signin",errorTypeRegistries:Nt,version:"2023-01-01",serviceTarget:"Signin"},serviceId:t?.serviceId??"Signin",sha256:t?.sha256??Ee,urlParser:t?.urlParser??z,utf8Decoder:t?.utf8Decoder??ue,utf8Encoder:t?.utf8Encoder??le});const getRuntimeConfig=t=>{v(process.version);const n=U(t);const defaultConfigProvider=()=>n().then(k);const i=getRuntimeConfig$1(t);A(process.version);const a={profile:t?.profile,logger:i.logger};return{...i,...t,runtime:"node",defaultsMode:n,authSchemePreference:t?.authSchemePreference??P(ce,a),bodyLengthChecker:t?.bodyLengthChecker??fe,defaultUserAgentProvider:t?.defaultUserAgentProvider??c({serviceId:i.serviceId,clientVersion:ye.version}),maxAttempts:t?.maxAttempts??P(re,t),region:t?.region??P(H,{...$,...a}),requestHandler:pe.create(t?.requestHandler??defaultConfigProvider),retryMode:t?.retryMode??P({...te,default:async()=>(await defaultConfigProvider()).retryMode||ee},t),streamCollector:t?.streamCollector??ge,useDualstackEndpoint:t?.useDualstackEndpoint??P(O,a),useFipsEndpoint:t?.useFipsEndpoint??P(L,a),userAgentAppId:t?.userAgentAppId??P(l,a)}};const getHttpAuthExtensionConfiguration=t=>{const n=t.httpAuthSchemes;let i=t.httpAuthSchemeProvider;let a=t.credentials;return{setHttpAuthScheme(t){const i=n.findIndex(n=>n.schemeId===t.schemeId);if(i===-1){n.push(t)}else{n.splice(i,1,t)}},httpAuthSchemes(){return n},setHttpAuthSchemeProvider(t){i=t},httpAuthSchemeProvider(){return i},setCredentials(t){a=t},credentials(){return a}}};const resolveHttpAuthRuntimeConfig=t=>({httpAuthSchemes:t.httpAuthSchemes(),httpAuthSchemeProvider:t.httpAuthSchemeProvider(),credentials:t.credentials()});const resolveRuntimeExtensions=(t,n)=>{const i=Object.assign(d(t),D(t),K(t),getHttpAuthExtensionConfiguration(t));n.forEach(t=>t.configure(i));return Object.assign(t,h(i),T(i),Z(i),resolveHttpAuthRuntimeConfig(i))};class SigninClient extends N{config;constructor(...[t]){const n=getRuntimeConfig(t||{});super(n);this.initConfig=n;const i=resolveClientEndpointParameters(n);const a=f(i);const A=ne(a);const c=G(A);const l=g(c);const d=q(l);const h=resolveHttpAuthSchemeConfig(d);const I=resolveRuntimeExtensions(h,t?.extensions||[]);this.config=I;this.middlewareStack.use(ie(this.config));this.middlewareStack.use(p(this.config));this.middlewareStack.use(se(this.config));this.middlewareStack.use(X(this.config));this.middlewareStack.use(m(this.config));this.middlewareStack.use(E(this.config));this.middlewareStack.use(C(this.config));this.middlewareStack.use(y(this.config,{httpAuthSchemeParametersProvider:defaultSigninHttpAuthSchemeParametersProvider,identityProviderConfigProvider:async t=>new B({"aws.auth#sigv4":t.credentials})}));this.middlewareStack.use(Q(this.config))}destroy(){super.destroy()}}const Ot=M(Ce,"Signin","SigninClient",j);const Ht={IsControlPlane:{type:"staticContextParams",value:false}};const _mw0=(t,n,i,a)=>[];class CreateOAuth2TokenCommand extends(Ot(Ht,_mw0,"CreateOAuth2Token",_t)){}const $t={CreateOAuth2TokenCommand:CreateOAuth2TokenCommand};class Signin extends SigninClient{}F($t,Signin);const Gt={AUTHCODE_EXPIRED:"AUTHCODE_EXPIRED",CONFLICT:"CONFLICT",INSUFFICIENT_PERMISSIONS:"INSUFFICIENT_PERMISSIONS",INVALID_REQUEST:"INVALID_REQUEST",RESOURCE_NOT_FOUND:"RESOURCE_NOT_FOUND",SERVER_ERROR:"server_error",SERVICE_QUOTA_EXCEEDED:"SERVICE_QUOTA_EXCEEDED",TOKEN_EXPIRED:"TOKEN_EXPIRED",USER_CREDENTIALS_CHANGED:"USER_CREDENTIALS_CHANGED"};n.AccessDeniedException=AccessDeniedException;n.AccessDeniedException$=vt;n.AccessToken$=Ft;n.CreateOAuth2Token$=_t;n.CreateOAuth2TokenCommand=CreateOAuth2TokenCommand;n.CreateOAuth2TokenRequest$=xt;n.CreateOAuth2TokenRequestBody$=Ut;n.CreateOAuth2TokenResponse$=Pt;n.CreateOAuth2TokenResponseBody$=Lt;n.InternalServerException=InternalServerException;n.InternalServerException$=kt;n.OAuth2ErrorCode=Gt;n.Signin=Signin;n.SigninClient=SigninClient;n.SigninServiceException=SigninServiceException;n.SigninServiceException$=bt;n.TooManyRequestsError=TooManyRequestsError;n.TooManyRequestsError$=Dt;n.ValidationException=ValidationException;n.ValidationException$=Tt;n.errorTypeRegistries=Nt},9443:(t,n,i)=>{const{awsEndpointFunctions:a,emitWarningIfUnsupportedVersion:A,createDefaultUserAgentProvider:c,NODE_APP_ID_CONFIG_OPTIONS:l,getAwsRegionExtensionConfiguration:d,resolveAwsRegionExtensionConfiguration:h,resolveUserAgentConfig:f,resolveHostHeaderConfig:g,getUserAgentPlugin:p,getHostHeaderPlugin:m,getLoggerPlugin:E,getRecursionDetectionPlugin:C}=i(5152);const{NoAuthSigner:I,getHttpAuthSchemeEndpointRuleSetPlugin:y,DefaultIdentityProviderConfig:B,getHttpSigningPlugin:Q}=i(402);const{normalizeProvider:w,getSmithyContext:S,ServiceException:b,NoOpLogger:R,emitWarningIfUnsupportedVersion:v,loadConfigsForDefaultMode:k,getDefaultExtensionConfiguration:D,resolveDefaultRuntimeConfig:T,Client:N,makeBuilder:M,createAggregatedClient:F}=i(2658);const{Command:x}=i(2658);n.$Command=x;n.__Client=N;const{resolveDefaultsModeConfig:U,loadConfig:P,NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS:L,NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS:O,NODE_REGION_CONFIG_OPTIONS:H,NODE_REGION_CONFIG_FILE_OPTIONS:$,resolveRegionConfig:G}=i(7291);const{BinaryDecisionDiagram:V,EndpointCache:Y,decideEndpoint:J,customEndpointFunctions:W,resolveEndpointConfig:q,getEndpointPlugin:j}=i(2085);const{parseUrl:z,getHttpHandlerExtensionConfiguration:K,resolveHttpHandlerRuntimeConfig:Z,getContentLengthPlugin:X}=i(3422);const{DEFAULT_RETRY_MODE:ee,NODE_RETRY_MODE_CONFIG_OPTIONS:te,NODE_MAX_ATTEMPT_CONFIG_OPTIONS:re,resolveRetryConfig:ne,getRetryPlugin:se}=i(3609);const{TypeRegistry:oe,getSchemaSerdePlugin:ie}=i(6890);const{resolveAwsSdkSigV4Config:ae,AwsSdkSigV4Signer:Ae,NODE_AUTH_SCHEME_PREFERENCE_OPTIONS:ce}=i(7523);const{toUtf8:le,fromUtf8:ue,toBase64:de,fromBase64:he,calculateBodyLength:fe}=i(2430);const{streamCollector:ge,NodeHttpHandler:pe}=i(1279);const{AwsRestJsonProtocol:me}=i(7288);const{Sha256:Ee}=i(9542);const defaultSSOOIDCHttpAuthSchemeParametersProvider=async(t,n,i)=>({operation:S(n).operation,region:await w(t.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});function createAwsAuthSigv4HttpAuthOption(t){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"sso-oauth",region:t.region},propertiesExtractor:(t,n)=>({signingProperties:{config:t,context:n}})}}function createSmithyApiNoAuthHttpAuthOption(t){return{schemeId:"smithy.api#noAuth"}}const defaultSSOOIDCHttpAuthSchemeProvider=t=>{const n=[];switch(t.operation){case"CreateToken":{n.push(createSmithyApiNoAuthHttpAuthOption());break}default:{n.push(createAwsAuthSigv4HttpAuthOption(t))}}return n};const resolveHttpAuthSchemeConfig=t=>{const n=ae(t);return Object.assign(n,{authSchemePreference:w(t.authSchemePreference??[])})};const resolveClientEndpointParameters=t=>Object.assign(t,{useDualstackEndpoint:t.useDualstackEndpoint??false,useFipsEndpoint:t.useFipsEndpoint??false,defaultSigningName:"sso-oauth"});const Ce={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}};var Ie="3.997.25";var ye={version:Ie};const Be="ref";const Qe=-1,we=true,Se="isSet",be="PartitionResult",Re="booleanEquals",ve="getAttr",ke={[Be]:"Endpoint"},De={[Be]:be},Te={},Ne=[{[Be]:"Region"}];const Me={conditions:[[Se,[ke]],[Se,Ne],["aws.partition",Ne,be],[Re,[{[Be]:"UseFIPS"},we]],[Re,[{[Be]:"UseDualStack"},we]],[Re,[{fn:ve,argv:[De,"supportsDualStack"]},we]],[Re,[{fn:ve,argv:[De,"supportsFIPS"]},we]],["stringEquals",[{fn:ve,argv:[De,"name"]},"aws-us-gov"]]],results:[[Qe],[Qe,"Invalid Configuration: FIPS and custom endpoint are not supported"],[Qe,"Invalid Configuration: Dualstack and custom endpoint are not supported"],[ke,Te],["https://oidc-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",Te],[Qe,"FIPS and DualStack are enabled, but this partition does not support one or both"],["https://oidc.{Region}.amazonaws.com",Te],["https://oidc-fips.{Region}.{PartitionResult#dnsSuffix}",Te],[Qe,"FIPS is enabled but this partition does not support FIPS"],["https://oidc.{Region}.{PartitionResult#dualStackDnsSuffix}",Te],[Qe,"DualStack is enabled but this partition does not support DualStack"],["https://oidc.{Region}.{PartitionResult#dnsSuffix}",Te],[Qe,"Invalid Configuration: Missing Region"]]};const Fe=2;const xe=1e8;const Ue=new Int32Array([-1,1,-1,0,13,3,1,4,xe+12,2,5,xe+12,3,8,6,4,7,xe+11,5,xe+9,xe+10,4,11,9,6,10,xe+8,7,xe+6,xe+7,5,12,xe+5,6,xe+4,xe+5,3,xe+1,14,4,xe+2,xe+3]);const Pe=V.from(Ue,Fe,Me.conditions,Me.results);const Le=new Y({size:50,params:["Endpoint","Region","UseDualStack","UseFIPS"]});const defaultEndpointResolver=(t,n={})=>Le.get(t,()=>J(Pe,{endpointParams:t,logger:n.logger}));W.aws=a;class SSOOIDCServiceException extends b{constructor(t){super(t);Object.setPrototypeOf(this,SSOOIDCServiceException.prototype)}}class AccessDeniedException extends SSOOIDCServiceException{name="AccessDeniedException";$fault="client";error;reason;error_description;constructor(t){super({name:"AccessDeniedException",$fault:"client",...t});Object.setPrototypeOf(this,AccessDeniedException.prototype);this.error=t.error;this.reason=t.reason;this.error_description=t.error_description}}class AuthorizationPendingException extends SSOOIDCServiceException{name="AuthorizationPendingException";$fault="client";error;error_description;constructor(t){super({name:"AuthorizationPendingException",$fault:"client",...t});Object.setPrototypeOf(this,AuthorizationPendingException.prototype);this.error=t.error;this.error_description=t.error_description}}class ExpiredTokenException extends SSOOIDCServiceException{name="ExpiredTokenException";$fault="client";error;error_description;constructor(t){super({name:"ExpiredTokenException",$fault:"client",...t});Object.setPrototypeOf(this,ExpiredTokenException.prototype);this.error=t.error;this.error_description=t.error_description}}class InternalServerException extends SSOOIDCServiceException{name="InternalServerException";$fault="server";error;error_description;constructor(t){super({name:"InternalServerException",$fault:"server",...t});Object.setPrototypeOf(this,InternalServerException.prototype);this.error=t.error;this.error_description=t.error_description}}class InvalidClientException extends SSOOIDCServiceException{name="InvalidClientException";$fault="client";error;error_description;constructor(t){super({name:"InvalidClientException",$fault:"client",...t});Object.setPrototypeOf(this,InvalidClientException.prototype);this.error=t.error;this.error_description=t.error_description}}class InvalidGrantException extends SSOOIDCServiceException{name="InvalidGrantException";$fault="client";error;error_description;constructor(t){super({name:"InvalidGrantException",$fault:"client",...t});Object.setPrototypeOf(this,InvalidGrantException.prototype);this.error=t.error;this.error_description=t.error_description}}class InvalidRequestException extends SSOOIDCServiceException{name="InvalidRequestException";$fault="client";error;reason;error_description;constructor(t){super({name:"InvalidRequestException",$fault:"client",...t});Object.setPrototypeOf(this,InvalidRequestException.prototype);this.error=t.error;this.reason=t.reason;this.error_description=t.error_description}}class InvalidScopeException extends SSOOIDCServiceException{name="InvalidScopeException";$fault="client";error;error_description;constructor(t){super({name:"InvalidScopeException",$fault:"client",...t});Object.setPrototypeOf(this,InvalidScopeException.prototype);this.error=t.error;this.error_description=t.error_description}}class SlowDownException extends SSOOIDCServiceException{name="SlowDownException";$fault="client";error;error_description;constructor(t){super({name:"SlowDownException",$fault:"client",...t});Object.setPrototypeOf(this,SlowDownException.prototype);this.error=t.error;this.error_description=t.error_description}}class UnauthorizedClientException extends SSOOIDCServiceException{name="UnauthorizedClientException";$fault="client";error;error_description;constructor(t){super({name:"UnauthorizedClientException",$fault:"client",...t});Object.setPrototypeOf(this,UnauthorizedClientException.prototype);this.error=t.error;this.error_description=t.error_description}}class UnsupportedGrantTypeException extends SSOOIDCServiceException{name="UnsupportedGrantTypeException";$fault="client";error;error_description;constructor(t){super({name:"UnsupportedGrantTypeException",$fault:"client",...t});Object.setPrototypeOf(this,UnsupportedGrantTypeException.prototype);this.error=t.error;this.error_description=t.error_description}}const _e="AccessDeniedException";const Oe="AuthorizationPendingException";const He="AccessToken";const $e="ClientSecret";const Ge="CreateToken";const Ve="CreateTokenRequest";const Ye="CreateTokenResponse";const Je="CodeVerifier";const We="ExpiredTokenException";const qe="InvalidClientException";const je="InvalidGrantException";const ze="InvalidRequestException";const Ke="InternalServerException";const Ze="InvalidScopeException";const Xe="IdToken";const et="RefreshToken";const tt="SlowDownException";const rt="UnauthorizedClientException";const nt="UnsupportedGrantTypeException";const st="accessToken";const ot="client";const it="clientId";const at="clientSecret";const At="codeVerifier";const ct="code";const lt="deviceCode";const ut="error";const dt="expiresIn";const ht="error_description";const ft="grantType";const gt="http";const pt="httpError";const mt="idToken";const Et="reason";const Ct="refreshToken";const It="redirectUri";const yt="smithy.ts.sdk.synthetic.com.amazonaws.ssooidc";const Bt="scope";const Qt="server";const wt="tokenType";const St="com.amazonaws.ssooidc";const bt=oe.for(yt);var Rt=[-3,yt,"SSOOIDCServiceException",0,[],[]];bt.registerError(Rt,SSOOIDCServiceException);const vt=oe.for(St);var kt=[-3,St,_e,{[ut]:ot,[pt]:400},[ut,Et,ht],[0,0,0]];vt.registerError(kt,AccessDeniedException);var Dt=[-3,St,Oe,{[ut]:ot,[pt]:400},[ut,ht],[0,0]];vt.registerError(Dt,AuthorizationPendingException);var Tt=[-3,St,We,{[ut]:ot,[pt]:400},[ut,ht],[0,0]];vt.registerError(Tt,ExpiredTokenException);var Nt=[-3,St,Ke,{[ut]:Qt,[pt]:500},[ut,ht],[0,0]];vt.registerError(Nt,InternalServerException);var Mt=[-3,St,qe,{[ut]:ot,[pt]:401},[ut,ht],[0,0]];vt.registerError(Mt,InvalidClientException);var Ft=[-3,St,je,{[ut]:ot,[pt]:400},[ut,ht],[0,0]];vt.registerError(Ft,InvalidGrantException);var xt=[-3,St,ze,{[ut]:ot,[pt]:400},[ut,Et,ht],[0,0,0]];vt.registerError(xt,InvalidRequestException);var Ut=[-3,St,Ze,{[ut]:ot,[pt]:400},[ut,ht],[0,0]];vt.registerError(Ut,InvalidScopeException);var Pt=[-3,St,tt,{[ut]:ot,[pt]:400},[ut,ht],[0,0]];vt.registerError(Pt,SlowDownException);var Lt=[-3,St,rt,{[ut]:ot,[pt]:400},[ut,ht],[0,0]];vt.registerError(Lt,UnauthorizedClientException);var _t=[-3,St,nt,{[ut]:ot,[pt]:400},[ut,ht],[0,0]];vt.registerError(_t,UnsupportedGrantTypeException);const Ot=[bt,vt];var Ht=[0,St,He,8,0];var $t=[0,St,$e,8,0];var Gt=[0,St,Je,8,0];var Vt=[0,St,Xe,8,0];var Yt=[0,St,et,8,0];var Jt=[3,St,Ve,0,[it,at,ft,lt,ct,Ct,Bt,It,At],[0,[()=>$t,0],0,0,0,[()=>Yt,0],64|0,0,[()=>Gt,0]],3];var Wt=[3,St,Ye,0,[st,wt,dt,Ct,mt],[[()=>Ht,0],0,1,[()=>Yt,0],[()=>Vt,0]]];var qt=[9,St,Ge,{[gt]:["POST","/token",200]},()=>Jt,()=>Wt];const getRuntimeConfig$1=t=>({apiVersion:"2019-06-10",base64Decoder:t?.base64Decoder??he,base64Encoder:t?.base64Encoder??de,disableHostPrefix:t?.disableHostPrefix??false,endpointProvider:t?.endpointProvider??defaultEndpointResolver,extensions:t?.extensions??[],httpAuthSchemeProvider:t?.httpAuthSchemeProvider??defaultSSOOIDCHttpAuthSchemeProvider,httpAuthSchemes:t?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:t=>t.getIdentityProvider("aws.auth#sigv4"),signer:new Ae},{schemeId:"smithy.api#noAuth",identityProvider:t=>t.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new I}],logger:t?.logger??new R,protocol:t?.protocol??me,protocolSettings:t?.protocolSettings??{defaultNamespace:"com.amazonaws.ssooidc",errorTypeRegistries:Ot,version:"2019-06-10",serviceTarget:"AWSSSOOIDCService"},serviceId:t?.serviceId??"SSO OIDC",sha256:t?.sha256??Ee,urlParser:t?.urlParser??z,utf8Decoder:t?.utf8Decoder??ue,utf8Encoder:t?.utf8Encoder??le});const getRuntimeConfig=t=>{v(process.version);const n=U(t);const defaultConfigProvider=()=>n().then(k);const i=getRuntimeConfig$1(t);A(process.version);const a={profile:t?.profile,logger:i.logger};return{...i,...t,runtime:"node",defaultsMode:n,authSchemePreference:t?.authSchemePreference??P(ce,a),bodyLengthChecker:t?.bodyLengthChecker??fe,defaultUserAgentProvider:t?.defaultUserAgentProvider??c({serviceId:i.serviceId,clientVersion:ye.version}),maxAttempts:t?.maxAttempts??P(re,t),region:t?.region??P(H,{...$,...a}),requestHandler:pe.create(t?.requestHandler??defaultConfigProvider),retryMode:t?.retryMode??P({...te,default:async()=>(await defaultConfigProvider()).retryMode||ee},t),streamCollector:t?.streamCollector??ge,useDualstackEndpoint:t?.useDualstackEndpoint??P(O,a),useFipsEndpoint:t?.useFipsEndpoint??P(L,a),userAgentAppId:t?.userAgentAppId??P(l,a)}};const getHttpAuthExtensionConfiguration=t=>{const n=t.httpAuthSchemes;let i=t.httpAuthSchemeProvider;let a=t.credentials;return{setHttpAuthScheme(t){const i=n.findIndex(n=>n.schemeId===t.schemeId);if(i===-1){n.push(t)}else{n.splice(i,1,t)}},httpAuthSchemes(){return n},setHttpAuthSchemeProvider(t){i=t},httpAuthSchemeProvider(){return i},setCredentials(t){a=t},credentials(){return a}}};const resolveHttpAuthRuntimeConfig=t=>({httpAuthSchemes:t.httpAuthSchemes(),httpAuthSchemeProvider:t.httpAuthSchemeProvider(),credentials:t.credentials()});const resolveRuntimeExtensions=(t,n)=>{const i=Object.assign(d(t),D(t),K(t),getHttpAuthExtensionConfiguration(t));n.forEach(t=>t.configure(i));return Object.assign(t,h(i),T(i),Z(i),resolveHttpAuthRuntimeConfig(i))};class SSOOIDCClient extends N{config;constructor(...[t]){const n=getRuntimeConfig(t||{});super(n);this.initConfig=n;const i=resolveClientEndpointParameters(n);const a=f(i);const A=ne(a);const c=G(A);const l=g(c);const d=q(l);const h=resolveHttpAuthSchemeConfig(d);const I=resolveRuntimeExtensions(h,t?.extensions||[]);this.config=I;this.middlewareStack.use(ie(this.config));this.middlewareStack.use(p(this.config));this.middlewareStack.use(se(this.config));this.middlewareStack.use(X(this.config));this.middlewareStack.use(m(this.config));this.middlewareStack.use(E(this.config));this.middlewareStack.use(C(this.config));this.middlewareStack.use(y(this.config,{httpAuthSchemeParametersProvider:defaultSSOOIDCHttpAuthSchemeParametersProvider,identityProviderConfigProvider:async t=>new B({"aws.auth#sigv4":t.credentials})}));this.middlewareStack.use(Q(this.config))}destroy(){super.destroy()}}const jt=M(Ce,"AWSSSOOIDCService","SSOOIDCClient",j);const zt={};const _mw0=(t,n,i,a)=>[];class CreateTokenCommand extends(jt(zt,_mw0,"CreateToken",qt)){}const Kt={CreateTokenCommand:CreateTokenCommand};class SSOOIDC extends SSOOIDCClient{}F(Kt,SSOOIDC);const Zt={KMS_ACCESS_DENIED:"KMS_AccessDeniedException"};const Xt={KMS_DISABLED_KEY:"KMS_DisabledException",KMS_INVALID_KEY_USAGE:"KMS_InvalidKeyUsageException",KMS_INVALID_STATE:"KMS_InvalidStateException",KMS_KEY_NOT_FOUND:"KMS_NotFoundException"};n.AccessDeniedException=AccessDeniedException;n.AccessDeniedException$=kt;n.AccessDeniedExceptionReason=Zt;n.AuthorizationPendingException=AuthorizationPendingException;n.AuthorizationPendingException$=Dt;n.CreateToken$=qt;n.CreateTokenCommand=CreateTokenCommand;n.CreateTokenRequest$=Jt;n.CreateTokenResponse$=Wt;n.ExpiredTokenException=ExpiredTokenException;n.ExpiredTokenException$=Tt;n.InternalServerException=InternalServerException;n.InternalServerException$=Nt;n.InvalidClientException=InvalidClientException;n.InvalidClientException$=Mt;n.InvalidGrantException=InvalidGrantException;n.InvalidGrantException$=Ft;n.InvalidRequestException=InvalidRequestException;n.InvalidRequestException$=xt;n.InvalidRequestExceptionReason=Xt;n.InvalidScopeException=InvalidScopeException;n.InvalidScopeException$=Ut;n.SSOOIDC=SSOOIDC;n.SSOOIDCClient=SSOOIDCClient;n.SSOOIDCServiceException=SSOOIDCServiceException;n.SSOOIDCServiceException$=Rt;n.SlowDownException=SlowDownException;n.SlowDownException$=Pt;n.UnauthorizedClientException=UnauthorizedClientException;n.UnauthorizedClientException$=Lt;n.UnsupportedGrantTypeException=UnsupportedGrantTypeException;n.UnsupportedGrantTypeException$=_t;n.errorTypeRegistries=Ot},2579:(t,n,i)=>{const{awsEndpointFunctions:a,emitWarningIfUnsupportedVersion:A,createDefaultUserAgentProvider:c,NODE_APP_ID_CONFIG_OPTIONS:l,getAwsRegionExtensionConfiguration:d,resolveAwsRegionExtensionConfiguration:h,resolveUserAgentConfig:f,resolveHostHeaderConfig:g,getUserAgentPlugin:p,getHostHeaderPlugin:m,getLoggerPlugin:E,getRecursionDetectionPlugin:C}=i(5152);const{NoAuthSigner:I,getHttpAuthSchemeEndpointRuleSetPlugin:y,DefaultIdentityProviderConfig:B,getHttpSigningPlugin:Q}=i(402);const{normalizeProvider:w,getSmithyContext:S,ServiceException:b,NoOpLogger:R,emitWarningIfUnsupportedVersion:v,loadConfigsForDefaultMode:k,getDefaultExtensionConfiguration:D,resolveDefaultRuntimeConfig:T,Client:N,makeBuilder:M,createAggregatedClient:F}=i(2658);const{Command:x}=i(2658);n.$Command=x;n.__Client=N;const{resolveDefaultsModeConfig:U,loadConfig:P,NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS:L,NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS:O,NODE_REGION_CONFIG_OPTIONS:H,NODE_REGION_CONFIG_FILE_OPTIONS:$,resolveRegionConfig:G}=i(7291);const{BinaryDecisionDiagram:V,EndpointCache:Y,decideEndpoint:J,customEndpointFunctions:W,resolveEndpointConfig:q,getEndpointPlugin:j}=i(2085);const{parseUrl:z,getHttpHandlerExtensionConfiguration:K,resolveHttpHandlerRuntimeConfig:Z,getContentLengthPlugin:X}=i(3422);const{DEFAULT_RETRY_MODE:ee,NODE_RETRY_MODE_CONFIG_OPTIONS:te,NODE_MAX_ATTEMPT_CONFIG_OPTIONS:re,resolveRetryConfig:ne,getRetryPlugin:se}=i(3609);const{TypeRegistry:oe,getSchemaSerdePlugin:ie}=i(6890);const{resolveAwsSdkSigV4Config:ae,AwsSdkSigV4Signer:Ae,NODE_AUTH_SCHEME_PREFERENCE_OPTIONS:ce}=i(7523);const{toUtf8:le,fromUtf8:ue,toBase64:de,fromBase64:he,calculateBodyLength:fe}=i(2430);const{streamCollector:ge,NodeHttpHandler:pe}=i(1279);const{AwsRestJsonProtocol:me}=i(7288);const{Sha256:Ee}=i(9542);const defaultSSOHttpAuthSchemeParametersProvider=async(t,n,i)=>({operation:S(n).operation,region:await w(t.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});function createAwsAuthSigv4HttpAuthOption(t){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"awsssoportal",region:t.region},propertiesExtractor:(t,n)=>({signingProperties:{config:t,context:n}})}}function createSmithyApiNoAuthHttpAuthOption(t){return{schemeId:"smithy.api#noAuth"}}const defaultSSOHttpAuthSchemeProvider=t=>{const n=[];switch(t.operation){case"GetRoleCredentials":{n.push(createSmithyApiNoAuthHttpAuthOption());break}default:{n.push(createAwsAuthSigv4HttpAuthOption(t))}}return n};const resolveHttpAuthSchemeConfig=t=>{const n=ae(t);return Object.assign(n,{authSchemePreference:w(t.authSchemePreference??[])})};const resolveClientEndpointParameters=t=>Object.assign(t,{useDualstackEndpoint:t.useDualstackEndpoint??false,useFipsEndpoint:t.useFipsEndpoint??false,defaultSigningName:"awsssoportal"});const Ce={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}};var Ie="3.997.25";var ye={version:Ie};const Be="ref";const Qe=-1,we=true,Se="isSet",be="PartitionResult",Re="booleanEquals",ve="getAttr",ke={[Be]:"Endpoint"},De={[Be]:be},Te={},Ne=[{[Be]:"Region"}];const Me={conditions:[[Se,[ke]],[Se,Ne],["aws.partition",Ne,be],[Re,[{[Be]:"UseFIPS"},we]],[Re,[{[Be]:"UseDualStack"},we]],[Re,[{fn:ve,argv:[De,"supportsDualStack"]},we]],[Re,[{fn:ve,argv:[De,"supportsFIPS"]},we]],["stringEquals",[{fn:ve,argv:[De,"name"]},"aws-us-gov"]]],results:[[Qe],[Qe,"Invalid Configuration: FIPS and custom endpoint are not supported"],[Qe,"Invalid Configuration: Dualstack and custom endpoint are not supported"],[ke,Te],["https://portal.sso-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",Te],[Qe,"FIPS and DualStack are enabled, but this partition does not support one or both"],["https://portal.sso.{Region}.amazonaws.com",Te],["https://portal.sso-fips.{Region}.{PartitionResult#dnsSuffix}",Te],[Qe,"FIPS is enabled but this partition does not support FIPS"],["https://portal.sso.{Region}.{PartitionResult#dualStackDnsSuffix}",Te],[Qe,"DualStack is enabled but this partition does not support DualStack"],["https://portal.sso.{Region}.{PartitionResult#dnsSuffix}",Te],[Qe,"Invalid Configuration: Missing Region"]]};const Fe=2;const xe=1e8;const Ue=new Int32Array([-1,1,-1,0,13,3,1,4,xe+12,2,5,xe+12,3,8,6,4,7,xe+11,5,xe+9,xe+10,4,11,9,6,10,xe+8,7,xe+6,xe+7,5,12,xe+5,6,xe+4,xe+5,3,xe+1,14,4,xe+2,xe+3]);const Pe=V.from(Ue,Fe,Me.conditions,Me.results);const Le=new Y({size:50,params:["Endpoint","Region","UseDualStack","UseFIPS"]});const defaultEndpointResolver=(t,n={})=>Le.get(t,()=>J(Pe,{endpointParams:t,logger:n.logger}));W.aws=a;class SSOServiceException extends b{constructor(t){super(t);Object.setPrototypeOf(this,SSOServiceException.prototype)}}class InvalidRequestException extends SSOServiceException{name="InvalidRequestException";$fault="client";constructor(t){super({name:"InvalidRequestException",$fault:"client",...t});Object.setPrototypeOf(this,InvalidRequestException.prototype)}}class ResourceNotFoundException extends SSOServiceException{name="ResourceNotFoundException";$fault="client";constructor(t){super({name:"ResourceNotFoundException",$fault:"client",...t});Object.setPrototypeOf(this,ResourceNotFoundException.prototype)}}class TooManyRequestsException extends SSOServiceException{name="TooManyRequestsException";$fault="client";constructor(t){super({name:"TooManyRequestsException",$fault:"client",...t});Object.setPrototypeOf(this,TooManyRequestsException.prototype)}}class UnauthorizedException extends SSOServiceException{name="UnauthorizedException";$fault="client";constructor(t){super({name:"UnauthorizedException",$fault:"client",...t});Object.setPrototypeOf(this,UnauthorizedException.prototype)}}const _e="AccessTokenType";const Oe="GetRoleCredentials";const He="GetRoleCredentialsRequest";const $e="GetRoleCredentialsResponse";const Ge="InvalidRequestException";const Ve="RoleCredentials";const Ye="ResourceNotFoundException";const Je="SecretAccessKeyType";const We="SessionTokenType";const qe="TooManyRequestsException";const je="UnauthorizedException";const ze="accountId";const Ke="accessKeyId";const Ze="accessToken";const Xe="account_id";const et="client";const tt="error";const rt="expiration";const nt="http";const st="httpError";const ot="httpHeader";const it="httpQuery";const at="message";const At="roleCredentials";const ct="roleName";const lt="role_name";const ut="smithy.ts.sdk.synthetic.com.amazonaws.sso";const dt="secretAccessKey";const ht="sessionToken";const ft="x-amz-sso_bearer_token";const gt="com.amazonaws.sso";const pt=oe.for(ut);var mt=[-3,ut,"SSOServiceException",0,[],[]];pt.registerError(mt,SSOServiceException);const Et=oe.for(gt);var Ct=[-3,gt,Ge,{[tt]:et,[st]:400},[at],[0]];Et.registerError(Ct,InvalidRequestException);var It=[-3,gt,Ye,{[tt]:et,[st]:404},[at],[0]];Et.registerError(It,ResourceNotFoundException);var yt=[-3,gt,qe,{[tt]:et,[st]:429},[at],[0]];Et.registerError(yt,TooManyRequestsException);var Bt=[-3,gt,je,{[tt]:et,[st]:401},[at],[0]];Et.registerError(Bt,UnauthorizedException);const Qt=[pt,Et];var wt=[0,gt,_e,8,0];var St=[0,gt,Je,8,0];var bt=[0,gt,We,8,0];var Rt=[3,gt,He,0,[ct,ze,Ze],[[0,{[it]:lt}],[0,{[it]:Xe}],[()=>wt,{[ot]:ft}]],3];var vt=[3,gt,$e,0,[At],[[()=>kt,0]]];var kt=[3,gt,Ve,0,[Ke,dt,ht,rt],[0,[()=>St,0],[()=>bt,0],1]];var Dt=[9,gt,Oe,{[nt]:["GET","/federation/credentials",200]},()=>Rt,()=>vt];const getRuntimeConfig$1=t=>({apiVersion:"2019-06-10",base64Decoder:t?.base64Decoder??he,base64Encoder:t?.base64Encoder??de,disableHostPrefix:t?.disableHostPrefix??false,endpointProvider:t?.endpointProvider??defaultEndpointResolver,extensions:t?.extensions??[],httpAuthSchemeProvider:t?.httpAuthSchemeProvider??defaultSSOHttpAuthSchemeProvider,httpAuthSchemes:t?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:t=>t.getIdentityProvider("aws.auth#sigv4"),signer:new Ae},{schemeId:"smithy.api#noAuth",identityProvider:t=>t.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new I}],logger:t?.logger??new R,protocol:t?.protocol??me,protocolSettings:t?.protocolSettings??{defaultNamespace:"com.amazonaws.sso",errorTypeRegistries:Qt,version:"2019-06-10",serviceTarget:"SWBPortalService"},serviceId:t?.serviceId??"SSO",sha256:t?.sha256??Ee,urlParser:t?.urlParser??z,utf8Decoder:t?.utf8Decoder??ue,utf8Encoder:t?.utf8Encoder??le});const getRuntimeConfig=t=>{v(process.version);const n=U(t);const defaultConfigProvider=()=>n().then(k);const i=getRuntimeConfig$1(t);A(process.version);const a={profile:t?.profile,logger:i.logger};return{...i,...t,runtime:"node",defaultsMode:n,authSchemePreference:t?.authSchemePreference??P(ce,a),bodyLengthChecker:t?.bodyLengthChecker??fe,defaultUserAgentProvider:t?.defaultUserAgentProvider??c({serviceId:i.serviceId,clientVersion:ye.version}),maxAttempts:t?.maxAttempts??P(re,t),region:t?.region??P(H,{...$,...a}),requestHandler:pe.create(t?.requestHandler??defaultConfigProvider),retryMode:t?.retryMode??P({...te,default:async()=>(await defaultConfigProvider()).retryMode||ee},t),streamCollector:t?.streamCollector??ge,useDualstackEndpoint:t?.useDualstackEndpoint??P(O,a),useFipsEndpoint:t?.useFipsEndpoint??P(L,a),userAgentAppId:t?.userAgentAppId??P(l,a)}};const getHttpAuthExtensionConfiguration=t=>{const n=t.httpAuthSchemes;let i=t.httpAuthSchemeProvider;let a=t.credentials;return{setHttpAuthScheme(t){const i=n.findIndex(n=>n.schemeId===t.schemeId);if(i===-1){n.push(t)}else{n.splice(i,1,t)}},httpAuthSchemes(){return n},setHttpAuthSchemeProvider(t){i=t},httpAuthSchemeProvider(){return i},setCredentials(t){a=t},credentials(){return a}}};const resolveHttpAuthRuntimeConfig=t=>({httpAuthSchemes:t.httpAuthSchemes(),httpAuthSchemeProvider:t.httpAuthSchemeProvider(),credentials:t.credentials()});const resolveRuntimeExtensions=(t,n)=>{const i=Object.assign(d(t),D(t),K(t),getHttpAuthExtensionConfiguration(t));n.forEach(t=>t.configure(i));return Object.assign(t,h(i),T(i),Z(i),resolveHttpAuthRuntimeConfig(i))};class SSOClient extends N{config;constructor(...[t]){const n=getRuntimeConfig(t||{});super(n);this.initConfig=n;const i=resolveClientEndpointParameters(n);const a=f(i);const A=ne(a);const c=G(A);const l=g(c);const d=q(l);const h=resolveHttpAuthSchemeConfig(d);const I=resolveRuntimeExtensions(h,t?.extensions||[]);this.config=I;this.middlewareStack.use(ie(this.config));this.middlewareStack.use(p(this.config));this.middlewareStack.use(se(this.config));this.middlewareStack.use(X(this.config));this.middlewareStack.use(m(this.config));this.middlewareStack.use(E(this.config));this.middlewareStack.use(C(this.config));this.middlewareStack.use(y(this.config,{httpAuthSchemeParametersProvider:defaultSSOHttpAuthSchemeParametersProvider,identityProviderConfigProvider:async t=>new B({"aws.auth#sigv4":t.credentials})}));this.middlewareStack.use(Q(this.config))}destroy(){super.destroy()}}const Tt=M(Ce,"SWBPortalService","SSOClient",j);const Nt={};const _mw0=(t,n,i,a)=>[];class GetRoleCredentialsCommand extends(Tt(Nt,_mw0,"GetRoleCredentials",Dt)){}const Mt={GetRoleCredentialsCommand:GetRoleCredentialsCommand};class SSO extends SSOClient{}F(Mt,SSO);n.GetRoleCredentials$=Dt;n.GetRoleCredentialsCommand=GetRoleCredentialsCommand;n.GetRoleCredentialsRequest$=Rt;n.GetRoleCredentialsResponse$=vt;n.InvalidRequestException=InvalidRequestException;n.InvalidRequestException$=Ct;n.ResourceNotFoundException=ResourceNotFoundException;n.ResourceNotFoundException$=It;n.RoleCredentials$=kt;n.SSO=SSO;n.SSOClient=SSOClient;n.SSOServiceException=SSOServiceException;n.SSOServiceException$=mt;n.TooManyRequestsException=TooManyRequestsException;n.TooManyRequestsException$=yt;n.UnauthorizedException=UnauthorizedException;n.UnauthorizedException$=Bt;n.errorTypeRegistries=Qt},1136:(t,n,i)=>{const{awsEndpointFunctions:a,emitWarningIfUnsupportedVersion:A,createDefaultUserAgentProvider:c,NODE_APP_ID_CONFIG_OPTIONS:l,getAwsRegionExtensionConfiguration:d,resolveAwsRegionExtensionConfiguration:h,resolveUserAgentConfig:f,resolveHostHeaderConfig:g,getUserAgentPlugin:p,getHostHeaderPlugin:m,getLoggerPlugin:E,getRecursionDetectionPlugin:C,setCredentialFeature:I,stsRegionDefaultResolver:y}=i(5152);const{NoAuthSigner:B,getHttpAuthSchemeEndpointRuleSetPlugin:Q,DefaultIdentityProviderConfig:w,getHttpSigningPlugin:S}=i(402);const{normalizeProvider:b,getSmithyContext:R,ServiceException:v,NoOpLogger:k,emitWarningIfUnsupportedVersion:D,loadConfigsForDefaultMode:T,getDefaultExtensionConfiguration:N,resolveDefaultRuntimeConfig:M,Client:F,makeBuilder:x,createAggregatedClient:U}=i(2658);const{Command:P}=i(2658);n.$Command=P;n.__Client=F;const{resolveDefaultsModeConfig:L,loadConfig:O,NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS:H,NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS:$,NODE_REGION_CONFIG_OPTIONS:G,NODE_REGION_CONFIG_FILE_OPTIONS:V,resolveRegionConfig:Y}=i(7291);const{BinaryDecisionDiagram:J,EndpointCache:W,decideEndpoint:q,customEndpointFunctions:j,resolveParams:z,resolveEndpointConfig:K,getEndpointPlugin:Z}=i(2085);const{parseUrl:X,getHttpHandlerExtensionConfiguration:ee,resolveHttpHandlerRuntimeConfig:te,getContentLengthPlugin:re}=i(3422);const{DEFAULT_RETRY_MODE:ne,NODE_RETRY_MODE_CONFIG_OPTIONS:se,NODE_MAX_ATTEMPT_CONFIG_OPTIONS:oe,resolveRetryConfig:ie,getRetryPlugin:ae}=i(3609);const{TypeRegistry:Ae,getSchemaSerdePlugin:ce}=i(6890);const{resolveAwsSdkSigV4Config:le,resolveAwsSdkSigV4AConfig:ue,AwsSdkSigV4Signer:de,AwsSdkSigV4ASigner:he,NODE_SIGV4A_CONFIG_OPTIONS:fe,NODE_AUTH_SCHEME_PREFERENCE_OPTIONS:ge}=i(7523);const{SignatureV4MultiRegion:pe}=i(5785);const{toUtf8:me,fromUtf8:Ee,toBase64:Ce,fromBase64:Ie,calculateBodyLength:ye}=i(2430);const{streamCollector:Be,NodeHttpHandler:Qe}=i(1279);const{AwsQueryProtocol:we}=i(7288);const{Sha256:Se}=i(9542);const be="ref";const Re=-1,ve=true,ke="isSet",De="PartitionResult",Te="booleanEquals",Ne="stringEquals",Me="getAttr",Fe="us-east-1",xe="sigv4",Ue="sts",Pe="https://sts.{Region}.{PartitionResult#dnsSuffix}",Le={[be]:"Endpoint"},_e={[be]:"Region"},Oe={[be]:De},He={},$e=[_e];const Ge={conditions:[[ke,[Le]],[ke,$e],["aws.partition",$e,De],[Te,[{[be]:"UseFIPS"},ve]],[Te,[{[be]:"UseDualStack"},ve]],[Ne,[_e,"aws-global"]],[Te,[{[be]:"UseGlobalEndpoint"},ve]],[Ne,[_e,"eu-central-1"]],[Te,[{fn:Me,argv:[Oe,"supportsDualStack"]},ve]],[Te,[{fn:Me,argv:[Oe,"supportsFIPS"]},ve]],[Ne,[_e,"ap-south-1"]],[Ne,[_e,"eu-north-1"]],[Ne,[_e,"eu-west-1"]],[Ne,[_e,"eu-west-2"]],[Ne,[_e,"eu-west-3"]],[Ne,[_e,"sa-east-1"]],[Ne,[_e,Fe]],[Ne,[_e,"us-east-2"]],[Ne,[_e,"us-west-2"]],[Ne,[_e,"us-west-1"]],[Ne,[_e,"ca-central-1"]],[Ne,[_e,"ap-southeast-1"]],[Ne,[_e,"ap-northeast-1"]],[Ne,[_e,"ap-southeast-2"]],[Ne,[{fn:Me,argv:[Oe,"name"]},"aws-us-gov"]]],results:[[Re],["https://sts.amazonaws.com",{authSchemes:[{name:xe,signingName:Ue,signingRegion:Fe}]}],[Pe,{authSchemes:[{name:xe,signingName:Ue,signingRegion:"{Region}"}]}],[Re,"Invalid Configuration: FIPS and custom endpoint are not supported"],[Re,"Invalid Configuration: Dualstack and custom endpoint are not supported"],[Le,He],["https://sts-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",He],[Re,"FIPS and DualStack are enabled, but this partition does not support one or both"],["https://sts.{Region}.amazonaws.com",He],["https://sts-fips.{Region}.{PartitionResult#dnsSuffix}",He],[Re,"FIPS is enabled but this partition does not support FIPS"],["https://sts.{Region}.{PartitionResult#dualStackDnsSuffix}",He],[Re,"DualStack is enabled but this partition does not support DualStack"],[Pe,He],[Re,"Invalid Configuration: Missing Region"]]};const Ve=2;const Ye=1e8;const Je=new Int32Array([-1,1,-1,0,30,3,1,4,Ye+14,2,5,Ye+14,3,25,6,4,24,7,5,Ye+1,8,6,9,Ye+13,7,Ye+1,10,10,Ye+1,11,11,Ye+1,12,12,Ye+1,13,13,Ye+1,14,14,Ye+1,15,15,Ye+1,16,16,Ye+1,17,17,Ye+1,18,18,Ye+1,19,19,Ye+1,20,20,Ye+1,21,21,Ye+1,22,22,Ye+1,23,23,Ye+1,Ye+2,8,Ye+11,Ye+12,4,28,26,9,27,Ye+10,24,Ye+8,Ye+9,8,29,Ye+7,9,Ye+6,Ye+7,3,Ye+3,31,4,Ye+4,Ye+5]);const We=J.from(Je,Ve,Ge.conditions,Ge.results);const qe=new W({size:50,params:["Endpoint","Region","UseDualStack","UseFIPS","UseGlobalEndpoint"]});const defaultEndpointResolver=(t,n={})=>qe.get(t,()=>q(We,{endpointParams:t,logger:n.logger}));j.aws=a;const createEndpointRuleSetHttpAuthSchemeParametersProvider=t=>async(n,i,a)=>{if(!a){throw new Error("Could not find `input` for `defaultEndpointRuleSetHttpAuthSchemeParametersProvider`")}const A=await t(n,i,a);const c=R(i)?.commandInstance?.constructor?.getEndpointParameterInstructions;if(!c){throw new Error(`getEndpointParameterInstructions() is not defined on '${i.commandName}'`)}const l=await z(a,{getEndpointParameterInstructions:c},n);return Object.assign(A,l)};const _defaultSTSHttpAuthSchemeParametersProvider=async(t,n,i)=>({operation:R(n).operation,region:await b(t.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});const je=createEndpointRuleSetHttpAuthSchemeParametersProvider(_defaultSTSHttpAuthSchemeParametersProvider);function createAwsAuthSigv4HttpAuthOption(t){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"sts",region:t.region},propertiesExtractor:(t,n)=>({signingProperties:{config:t,context:n}})}}function createAwsAuthSigv4aHttpAuthOption(t){return{schemeId:"aws.auth#sigv4a",signingProperties:{name:"sts",region:t.region},propertiesExtractor:(t,n)=>({signingProperties:{config:t,context:n}})}}function createSmithyApiNoAuthHttpAuthOption(t){return{schemeId:"smithy.api#noAuth"}}const createEndpointRuleSetHttpAuthSchemeProvider=(t,n,i)=>{const endpointRuleSetHttpAuthSchemeProvider=a=>{const A=t(a);const c=A.properties?.authSchemes;if(!c){return n(a)}const l=[];for(const t of c){const{name:n,properties:A={},...d}=t;const h=n.toLowerCase();if(n!==h){console.warn(`HttpAuthScheme has been normalized with lowercasing: '${n}' to '${h}'`)}let f;if(h==="sigv4a"){f="aws.auth#sigv4a";const t=c.find(t=>{const n=t.name.toLowerCase();return n!=="sigv4a"&&n.startsWith("sigv4")});if(pe.sigv4aDependency()==="none"&&t){continue}}else if(h.startsWith("sigv4")){f="aws.auth#sigv4"}else{throw new Error(`Unknown HttpAuthScheme found in '@smithy.rules#endpointRuleSet': '${h}'`)}const g=i[f];if(!g){throw new Error(`Could not find HttpAuthOption create function for '${f}'`)}const p=g(a);p.schemeId=f;p.signingProperties={...p.signingProperties||{},...d,...A};l.push(p)}return l};return endpointRuleSetHttpAuthSchemeProvider};const _defaultSTSHttpAuthSchemeProvider=t=>{const n=[];switch(t.operation){case"AssumeRoleWithWebIdentity":{n.push(createSmithyApiNoAuthHttpAuthOption());n.push(createAwsAuthSigv4aHttpAuthOption(t));break}default:{n.push(createAwsAuthSigv4HttpAuthOption(t));n.push(createAwsAuthSigv4aHttpAuthOption(t))}}return n};const ze=createEndpointRuleSetHttpAuthSchemeProvider(defaultEndpointResolver,_defaultSTSHttpAuthSchemeProvider,{"aws.auth#sigv4":createAwsAuthSigv4HttpAuthOption,"aws.auth#sigv4a":createAwsAuthSigv4aHttpAuthOption,"smithy.api#noAuth":createSmithyApiNoAuthHttpAuthOption});const resolveHttpAuthSchemeConfig=t=>{const n=le(t);const i=ue(n);return Object.assign(i,{authSchemePreference:b(t.authSchemePreference??[])})};const resolveClientEndpointParameters=t=>Object.assign(t,{useDualstackEndpoint:t.useDualstackEndpoint??false,useFipsEndpoint:t.useFipsEndpoint??false,useGlobalEndpoint:t.useGlobalEndpoint??false,defaultSigningName:"sts"});const Ke={UseGlobalEndpoint:{type:"builtInParams",name:"useGlobalEndpoint"},UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}};var Ze="3.997.25";var Xe={version:Ze};class STSServiceException extends v{constructor(t){super(t);Object.setPrototypeOf(this,STSServiceException.prototype)}}class ExpiredTokenException extends STSServiceException{name="ExpiredTokenException";$fault="client";constructor(t){super({name:"ExpiredTokenException",$fault:"client",...t});Object.setPrototypeOf(this,ExpiredTokenException.prototype)}}class MalformedPolicyDocumentException extends STSServiceException{name="MalformedPolicyDocumentException";$fault="client";constructor(t){super({name:"MalformedPolicyDocumentException",$fault:"client",...t});Object.setPrototypeOf(this,MalformedPolicyDocumentException.prototype)}}class PackedPolicyTooLargeException extends STSServiceException{name="PackedPolicyTooLargeException";$fault="client";constructor(t){super({name:"PackedPolicyTooLargeException",$fault:"client",...t});Object.setPrototypeOf(this,PackedPolicyTooLargeException.prototype)}}class RegionDisabledException extends STSServiceException{name="RegionDisabledException";$fault="client";constructor(t){super({name:"RegionDisabledException",$fault:"client",...t});Object.setPrototypeOf(this,RegionDisabledException.prototype)}}class IDPRejectedClaimException extends STSServiceException{name="IDPRejectedClaimException";$fault="client";constructor(t){super({name:"IDPRejectedClaimException",$fault:"client",...t});Object.setPrototypeOf(this,IDPRejectedClaimException.prototype)}}class InvalidIdentityTokenException extends STSServiceException{name="InvalidIdentityTokenException";$fault="client";constructor(t){super({name:"InvalidIdentityTokenException",$fault:"client",...t});Object.setPrototypeOf(this,InvalidIdentityTokenException.prototype)}}class IDPCommunicationErrorException extends STSServiceException{name="IDPCommunicationErrorException";$fault="client";$retryable={};constructor(t){super({name:"IDPCommunicationErrorException",$fault:"client",...t});Object.setPrototypeOf(this,IDPCommunicationErrorException.prototype)}}const et="Arn";const tt="AccessKeyId";const rt="AssumeRole";const nt="AssumedRoleId";const st="AssumeRoleRequest";const ot="AssumeRoleResponse";const it="AssumedRoleUser";const at="AssumeRoleWithWebIdentity";const At="AssumeRoleWithWebIdentityRequest";const ct="AssumeRoleWithWebIdentityResponse";const lt="Audience";const ut="Credentials";const dt="ContextAssertion";const ht="DurationSeconds";const ft="Expiration";const gt="ExternalId";const pt="ExpiredTokenException";const mt="IDPCommunicationErrorException";const Et="IDPRejectedClaimException";const Ct="InvalidIdentityTokenException";const It="Key";const yt="MalformedPolicyDocumentException";const Bt="Policy";const Qt="PolicyArns";const wt="ProviderArn";const St="ProvidedContexts";const bt="ProvidedContextsListType";const Rt="ProvidedContext";const vt="PolicyDescriptorType";const kt="ProviderId";const Dt="PackedPolicySize";const Tt="PackedPolicyTooLargeException";const Nt="Provider";const Mt="RoleArn";const Ft="RegionDisabledException";const xt="RoleSessionName";const Ut="SecretAccessKey";const Pt="SubjectFromWebIdentityToken";const Lt="SourceIdentity";const _t="SerialNumber";const Ot="SessionToken";const Ht="Tags";const $t="TokenCode";const Gt="TransitiveTagKeys";const Vt="Tag";const Yt="Value";const Jt="WebIdentityToken";const Wt="arn";const qt="accessKeySecretType";const jt="awsQueryError";const zt="client";const Kt="clientTokenType";const Zt="error";const Xt="httpError";const er="message";const tr="policyDescriptorListType";const rr="smithy.ts.sdk.synthetic.com.amazonaws.sts";const nr="tagListType";const sr="com.amazonaws.sts";const ir=Ae.for(rr);var ar=[-3,rr,"STSServiceException",0,[],[]];ir.registerError(ar,STSServiceException);const Ar=Ae.for(sr);var cr=[-3,sr,pt,{[jt]:[`ExpiredTokenException`,400],[Zt]:zt,[Xt]:400},[er],[0]];Ar.registerError(cr,ExpiredTokenException);var lr=[-3,sr,mt,{[jt]:[`IDPCommunicationError`,400],[Zt]:zt,[Xt]:400},[er],[0]];Ar.registerError(lr,IDPCommunicationErrorException);var ur=[-3,sr,Et,{[jt]:[`IDPRejectedClaim`,403],[Zt]:zt,[Xt]:403},[er],[0]];Ar.registerError(ur,IDPRejectedClaimException);var dr=[-3,sr,Ct,{[jt]:[`InvalidIdentityToken`,400],[Zt]:zt,[Xt]:400},[er],[0]];Ar.registerError(dr,InvalidIdentityTokenException);var hr=[-3,sr,yt,{[jt]:[`MalformedPolicyDocument`,400],[Zt]:zt,[Xt]:400},[er],[0]];Ar.registerError(hr,MalformedPolicyDocumentException);var fr=[-3,sr,Tt,{[jt]:[`PackedPolicyTooLarge`,400],[Zt]:zt,[Xt]:400},[er],[0]];Ar.registerError(fr,PackedPolicyTooLargeException);var gr=[-3,sr,Ft,{[jt]:[`RegionDisabledException`,403],[Zt]:zt,[Xt]:403},[er],[0]];Ar.registerError(gr,RegionDisabledException);const pr=[ir,Ar];var mr=[0,sr,qt,8,0];var Er=[0,sr,Kt,8,0];var Cr=[3,sr,it,0,[nt,et],[0,0],2];var Ir=[3,sr,st,0,[Mt,xt,Qt,Bt,ht,Ht,Gt,gt,_t,$t,Lt,St],[0,0,()=>vr,0,1,()=>Dr,64|0,0,0,0,0,()=>kr],2];var yr=[3,sr,ot,0,[ut,it,Dt,Lt],[[()=>wr,0],()=>Cr,1,0]];var Br=[3,sr,At,0,[Mt,xt,Jt,kt,Qt,Bt,ht],[0,0,[()=>Er,0],0,()=>vr,0,1],3];var Qr=[3,sr,ct,0,[ut,Pt,it,Dt,Nt,lt,Lt],[[()=>wr,0],0,()=>Cr,1,0,0,0]];var wr=[3,sr,ut,0,[tt,Ut,Ot,ft],[0,[()=>mr,0],0,4],4];var Sr=[3,sr,vt,0,[Wt],[0]];var br=[3,sr,Rt,0,[wt,dt],[0,0]];var Rr=[3,sr,Vt,0,[It,Yt],[0,0],2];var vr=[1,sr,tr,0,()=>Sr];var kr=[1,sr,bt,0,()=>br];var Dr=[1,sr,nr,0,()=>Rr];var Tr=[9,sr,rt,0,()=>Ir,()=>yr];var Nr=[9,sr,at,0,()=>Br,()=>Qr];const getRuntimeConfig$1=t=>({apiVersion:"2011-06-15",base64Decoder:t?.base64Decoder??Ie,base64Encoder:t?.base64Encoder??Ce,disableHostPrefix:t?.disableHostPrefix??false,endpointProvider:t?.endpointProvider??defaultEndpointResolver,extensions:t?.extensions??[],httpAuthSchemeProvider:t?.httpAuthSchemeProvider??ze,httpAuthSchemes:t?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:t=>t.getIdentityProvider("aws.auth#sigv4"),signer:new de},{schemeId:"aws.auth#sigv4a",identityProvider:t=>t.getIdentityProvider("aws.auth#sigv4a"),signer:new he},{schemeId:"smithy.api#noAuth",identityProvider:t=>t.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new B}],logger:t?.logger??new k,protocol:t?.protocol??we,protocolSettings:t?.protocolSettings??{defaultNamespace:"com.amazonaws.sts",errorTypeRegistries:pr,xmlNamespace:"https://sts.amazonaws.com/doc/2011-06-15/",version:"2011-06-15",serviceTarget:"AWSSecurityTokenServiceV20110615"},serviceId:t?.serviceId??"STS",sha256:t?.sha256??Se,signerConstructor:t?.signerConstructor??pe,urlParser:t?.urlParser??X,utf8Decoder:t?.utf8Decoder??Ee,utf8Encoder:t?.utf8Encoder??me});const getRuntimeConfig=t=>{D(process.version);const n=L(t);const defaultConfigProvider=()=>n().then(T);const i=getRuntimeConfig$1(t);A(process.version);const a={profile:t?.profile,logger:i.logger};return{...i,...t,runtime:"node",defaultsMode:n,authSchemePreference:t?.authSchemePreference??O(ge,a),bodyLengthChecker:t?.bodyLengthChecker??ye,defaultUserAgentProvider:t?.defaultUserAgentProvider??c({serviceId:i.serviceId,clientVersion:Xe.version}),httpAuthSchemes:t?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:n=>n.getIdentityProvider("aws.auth#sigv4")||(async n=>await t.credentialDefaultProvider(n?.__config||{})()),signer:new de},{schemeId:"aws.auth#sigv4a",identityProvider:t=>t.getIdentityProvider("aws.auth#sigv4a"),signer:new he},{schemeId:"smithy.api#noAuth",identityProvider:t=>t.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new B}],maxAttempts:t?.maxAttempts??O(oe,t),region:t?.region??O(G,{...V,...a}),requestHandler:Qe.create(t?.requestHandler??defaultConfigProvider),retryMode:t?.retryMode??O({...se,default:async()=>(await defaultConfigProvider()).retryMode||ne},t),sigv4aSigningRegionSet:t?.sigv4aSigningRegionSet??O(fe,a),streamCollector:t?.streamCollector??Be,useDualstackEndpoint:t?.useDualstackEndpoint??O($,a),useFipsEndpoint:t?.useFipsEndpoint??O(H,a),userAgentAppId:t?.userAgentAppId??O(l,a)}};const getHttpAuthExtensionConfiguration=t=>{const n=t.httpAuthSchemes;let i=t.httpAuthSchemeProvider;let a=t.credentials;return{setHttpAuthScheme(t){const i=n.findIndex(n=>n.schemeId===t.schemeId);if(i===-1){n.push(t)}else{n.splice(i,1,t)}},httpAuthSchemes(){return n},setHttpAuthSchemeProvider(t){i=t},httpAuthSchemeProvider(){return i},setCredentials(t){a=t},credentials(){return a}}};const resolveHttpAuthRuntimeConfig=t=>({httpAuthSchemes:t.httpAuthSchemes(),httpAuthSchemeProvider:t.httpAuthSchemeProvider(),credentials:t.credentials()});const resolveRuntimeExtensions=(t,n)=>{const i=Object.assign(d(t),N(t),ee(t),getHttpAuthExtensionConfiguration(t));n.forEach(t=>t.configure(i));return Object.assign(t,h(i),M(i),te(i),resolveHttpAuthRuntimeConfig(i))};class STSClient extends F{config;constructor(...[t]){const n=getRuntimeConfig(t||{});super(n);this.initConfig=n;const i=resolveClientEndpointParameters(n);const a=f(i);const A=ie(a);const c=Y(A);const l=g(c);const d=K(l);const h=resolveHttpAuthSchemeConfig(d);const I=resolveRuntimeExtensions(h,t?.extensions||[]);this.config=I;this.middlewareStack.use(ce(this.config));this.middlewareStack.use(p(this.config));this.middlewareStack.use(ae(this.config));this.middlewareStack.use(re(this.config));this.middlewareStack.use(m(this.config));this.middlewareStack.use(E(this.config));this.middlewareStack.use(C(this.config));this.middlewareStack.use(Q(this.config,{httpAuthSchemeParametersProvider:je,identityProviderConfigProvider:async t=>new w({"aws.auth#sigv4":t.credentials,"aws.auth#sigv4a":t.credentials})}));this.middlewareStack.use(S(this.config))}destroy(){super.destroy()}}const Mr=x(Ke,"AWSSecurityTokenServiceV20110615","STSClient",Z);const Fr={};const _mw0=(t,n,i,a)=>[];class AssumeRoleCommand extends(Mr(Fr,_mw0,"AssumeRole",Tr)){}class AssumeRoleWithWebIdentityCommand extends(Mr(Fr,_mw0,"AssumeRoleWithWebIdentity",Nr)){}const xr={AssumeRoleCommand:AssumeRoleCommand,AssumeRoleWithWebIdentityCommand:AssumeRoleWithWebIdentityCommand};class STS extends STSClient{}U(xr,STS);const getAccountIdFromAssumedRoleUser=t=>{if(typeof t?.Arn==="string"){const n=t.Arn.split(":");if(n.length>4&&n[4]!==""){return n[4]}}return undefined};const resolveRegion=async(t,n,i,a={})=>{const A=typeof t==="function"?await t():t;const c=typeof n==="function"?await n():n;let l="";const d=A??c??(l=await y(a)());i?.debug?.("@aws-sdk/client-sts::resolveRegion","accepting first of:",`${A} (credential provider clientConfig)`,`${c} (contextual client)`,`${l} (STS default: AWS_REGION, profile region, or us-east-1)`);return d};const getDefaultRoleAssumer$1=(t,n)=>{let i;let a;return async(A,c)=>{a=A;if(!i){const{logger:A=t?.parentClientConfig?.logger,profile:c=t?.parentClientConfig?.profile,region:l,requestHandler:d=t?.parentClientConfig?.requestHandler,credentialProviderLogger:h,userAgentAppId:f=t?.parentClientConfig?.userAgentAppId}=t;const g=await resolveRegion(l,t?.parentClientConfig?.region,h,{logger:A,profile:c});const p=!isH2(d);i=new n({...t,userAgentAppId:f,profile:c,credentialDefaultProvider:()=>async()=>a,region:g,requestHandler:p?d:undefined,logger:A})}const{Credentials:l,AssumedRoleUser:d}=await i.send(new AssumeRoleCommand(c));if(!l||!l.AccessKeyId||!l.SecretAccessKey){throw new Error(`Invalid response from STS.assumeRole call with role ${c.RoleArn}`)}const h=getAccountIdFromAssumedRoleUser(d);const f={accessKeyId:l.AccessKeyId,secretAccessKey:l.SecretAccessKey,sessionToken:l.SessionToken,expiration:l.Expiration,...l.CredentialScope&&{credentialScope:l.CredentialScope},...h&&{accountId:h}};I(f,"CREDENTIALS_STS_ASSUME_ROLE","i");return f}};const getDefaultRoleAssumerWithWebIdentity$1=(t,n)=>{let i;return async a=>{if(!i){const{logger:a=t?.parentClientConfig?.logger,profile:A=t?.parentClientConfig?.profile,region:c,requestHandler:l=t?.parentClientConfig?.requestHandler,credentialProviderLogger:d,userAgentAppId:h=t?.parentClientConfig?.userAgentAppId}=t;const f=await resolveRegion(c,t?.parentClientConfig?.region,d,{logger:a,profile:A});const g=!isH2(l);i=new n({...t,userAgentAppId:h,profile:A,region:f,requestHandler:g?l:undefined,logger:a})}const{Credentials:A,AssumedRoleUser:c}=await i.send(new AssumeRoleWithWebIdentityCommand(a));if(!A||!A.AccessKeyId||!A.SecretAccessKey){throw new Error(`Invalid response from STS.assumeRoleWithWebIdentity call with role ${a.RoleArn}`)}const l=getAccountIdFromAssumedRoleUser(c);const d={accessKeyId:A.AccessKeyId,secretAccessKey:A.SecretAccessKey,sessionToken:A.SessionToken,expiration:A.Expiration,...A.CredentialScope&&{credentialScope:A.CredentialScope},...l&&{accountId:l}};if(l){I(d,"RESOLVED_ACCOUNT_ID","T")}I(d,"CREDENTIALS_STS_ASSUME_ROLE_WEB_ID","k");return d}};const isH2=t=>t?.metadata?.handlerProtocol==="h2";const getCustomizableStsClientCtor=(t,n)=>{if(!n)return t;else return class CustomizableSTSClient extends t{constructor(t){super(t);for(const t of n){this.middlewareStack.use(t)}}}};const getDefaultRoleAssumer=(t={},n)=>getDefaultRoleAssumer$1(t,getCustomizableStsClientCtor(STSClient,n));const getDefaultRoleAssumerWithWebIdentity=(t={},n)=>getDefaultRoleAssumerWithWebIdentity$1(t,getCustomizableStsClientCtor(STSClient,n));const decorateDefaultCredentialProvider=t=>n=>t({roleAssumer:getDefaultRoleAssumer(n),roleAssumerWithWebIdentity:getDefaultRoleAssumerWithWebIdentity(n),...n});n.AssumeRole$=Tr;n.AssumeRoleCommand=AssumeRoleCommand;n.AssumeRoleRequest$=Ir;n.AssumeRoleResponse$=yr;n.AssumeRoleWithWebIdentity$=Nr;n.AssumeRoleWithWebIdentityCommand=AssumeRoleWithWebIdentityCommand;n.AssumeRoleWithWebIdentityRequest$=Br;n.AssumeRoleWithWebIdentityResponse$=Qr;n.AssumedRoleUser$=Cr;n.Credentials$=wr;n.ExpiredTokenException=ExpiredTokenException;n.ExpiredTokenException$=cr;n.IDPCommunicationErrorException=IDPCommunicationErrorException;n.IDPCommunicationErrorException$=lr;n.IDPRejectedClaimException=IDPRejectedClaimException;n.IDPRejectedClaimException$=ur;n.InvalidIdentityTokenException=InvalidIdentityTokenException;n.InvalidIdentityTokenException$=dr;n.MalformedPolicyDocumentException=MalformedPolicyDocumentException;n.MalformedPolicyDocumentException$=hr;n.PackedPolicyTooLargeException=PackedPolicyTooLargeException;n.PackedPolicyTooLargeException$=fr;n.PolicyDescriptorType$=Sr;n.ProvidedContext$=br;n.RegionDisabledException=RegionDisabledException;n.RegionDisabledException$=gr;n.STS=STS;n.STSClient=STSClient;n.STSServiceException=STSServiceException;n.STSServiceException$=ar;n.Tag$=Rr;n.decorateDefaultCredentialProvider=decorateDefaultCredentialProvider;n.errorTypeRegistries=pr;n.getDefaultRoleAssumer=getDefaultRoleAssumer;n.getDefaultRoleAssumerWithWebIdentity=getDefaultRoleAssumerWithWebIdentity},5785:(t,n,i)=>{const{SignatureV4:a,signatureV4aContainer:A}=i(5118);const c={CrtSignerV4:null};const l="X-Amz-S3session-Token";const d=l.toLowerCase();class SignatureV4SignWithCredentials extends a{async signWithCredentials(t,n,i){const a=getCredentialsWithoutSessionToken(n);t.headers[d]=n.sessionToken;const A=this;setSingleOverride(A,a);return A.signRequest(t,i??{})}async presignWithCredentials(t,n,i){const a=getCredentialsWithoutSessionToken(n);delete t.headers[d];t.headers[l]=n.sessionToken;t.query=t.query??{};t.query[l]=n.sessionToken;const A=this;setSingleOverride(A,a);return this.presign(t,i)}}function getCredentialsWithoutSessionToken(t){return{accessKeyId:t.accessKeyId,secretAccessKey:t.secretAccessKey,expiration:t.expiration}}function setSingleOverride(t,n){const i=t.credentialProvider;t.credentialProvider=()=>{t.credentialProvider=i;return Promise.resolve(n)}}class SignatureV4MultiRegion{sigv4aSigner;sigv4Signer;signerOptions;static sigv4aDependency(){if(typeof c.CrtSignerV4==="function"){return"crt"}else if(typeof A.SignatureV4a==="function"){return"js"}return"none"}constructor(t){this.sigv4Signer=new SignatureV4SignWithCredentials(t);this.signerOptions=t}async sign(t,n={}){if(n.signingRegion==="*"){return this.getSigv4aSigner().sign(t,n)}return this.sigv4Signer.sign(t,n)}async signWithCredentials(t,n,i={}){if(i.signingRegion==="*"){const a=this.getSigv4aSigner();const A=c.CrtSignerV4;if(A&&a instanceof A){return a.signWithCredentials(t,n,i)}else{throw new Error(`signWithCredentials with signingRegion '*' is only supported when using the CRT dependency @aws-sdk/signature-v4-crt. `+`Please check whether you have installed the "@aws-sdk/signature-v4-crt" package explicitly. `+`You must also register the package by calling [require("@aws-sdk/signature-v4-crt");] `+`or an ESM equivalent such as [import "@aws-sdk/signature-v4-crt";]. `+`For more information please go to https://github.com/aws/aws-sdk-js-v3#functionality-requiring-aws-common-runtime-crt`)}}return this.sigv4Signer.signWithCredentials(t,n,i)}async presign(t,n={}){if(n.signingRegion==="*"){const i=this.getSigv4aSigner();const a=c.CrtSignerV4;if(a&&i instanceof a){return i.presign(t,n)}else{throw new Error(`presign with signingRegion '*' is only supported when using the CRT dependency @aws-sdk/signature-v4-crt. `+`Please check whether you have installed the "@aws-sdk/signature-v4-crt" package explicitly. `+`You must also register the package by calling [require("@aws-sdk/signature-v4-crt");] `+`or an ESM equivalent such as [import "@aws-sdk/signature-v4-crt";]. `+`For more information please go to https://github.com/aws/aws-sdk-js-v3#functionality-requiring-aws-common-runtime-crt`)}}return this.sigv4Signer.presign(t,n)}async presignWithCredentials(t,n,i={}){if(i.signingRegion==="*"){throw new Error("Method presignWithCredentials is not supported for [signingRegion=*].")}return this.sigv4Signer.presignWithCredentials(t,n,i)}getSigv4aSigner(){if(!this.sigv4aSigner){const t=c.CrtSignerV4;const n=A.SignatureV4a;if(this.signerOptions.runtime==="node"){if(!t&&!n){throw new Error("Neither CRT nor JS SigV4a implementation is available. "+"Please load either @aws-sdk/signature-v4-crt or @aws-sdk/signature-v4a. "+"For more information please go to "+"https://github.com/aws/aws-sdk-js-v3#functionality-requiring-aws-common-runtime-crt")}if(t&&typeof t==="function"){this.sigv4aSigner=new t({...this.signerOptions,signingAlgorithm:1})}else if(n&&typeof n==="function"){this.sigv4aSigner=new n({...this.signerOptions})}else{throw new Error("Available SigV4a implementation is not a valid constructor. "+"Please ensure you've properly imported @aws-sdk/signature-v4-crt or @aws-sdk/signature-v4a."+"For more information please go to "+"https://github.com/aws/aws-sdk-js-v3#functionality-requiring-aws-common-runtime-crt")}}else{if(!n||typeof n!=="function"){throw new Error("JS SigV4a implementation is not available or not a valid constructor. "+"Please check whether you have installed the @aws-sdk/signature-v4a package explicitly. The CRT implementation is not available for browsers. "+"You must also register the package by calling [require('@aws-sdk/signature-v4a');] "+"or an ESM equivalent such as [import '@aws-sdk/signature-v4a';]. "+"For more information please go to "+"https://github.com/aws/aws-sdk-js-v3#using-javascript-non-crt-implementation-of-sigv4a")}this.sigv4aSigner=new n({...this.signerOptions})}}return this.sigv4aSigner}}n.SignatureV4MultiRegion=SignatureV4MultiRegion;n.SignatureV4SignWithCredentials=SignatureV4SignWithCredentials;n.signatureV4CrtContainer=c},5433:(t,n,i)=>{const{setTokenFeature:a}=i(5152);const{getBearerTokenEnvKey:A}=i(7523);const{TokenProviderError:c,getSSOTokenFilepath:l,parseKnownFiles:d,getProfileName:h,loadSsoSessionData:f,getSSOTokenFromFile:g,memoize:p,chain:m}=i(7291);const{promises:E}=i(3024);const fromEnvSigningName=({logger:t,signingName:n}={})=>async()=>{t?.debug?.("@aws-sdk/token-providers - fromEnvSigningName");if(!n){throw new c("Please pass 'signingName' to compute environment variable key",{logger:t})}const i=A(n);if(!(i in process.env)){throw new c(`Token not present in '${i}' environment variable`,{logger:t})}const l={token:process.env[i]};a(l,"BEARER_SERVICE_ENV_VARS","3");return l};const C=5*60*1e3;const I=`To refresh this SSO session run 'aws sso login' with the corresponding profile.`;const getSsoOidcClient=async(t,n={},a)=>{const{SSOOIDCClient:A}=i(9443);const coalesce=t=>n.clientConfig?.[t]??n.parentClientConfig?.[t]??a?.[t];const c=new A(Object.assign({},n.clientConfig??{},{region:t??n.clientConfig?.region,logger:coalesce("logger"),userAgentAppId:coalesce("userAgentAppId")}));return c};const getNewSsoOidcToken=async(t,n,a={},A)=>{const{CreateTokenCommand:c}=i(9443);const l=await getSsoOidcClient(n,a,A);return l.send(new c({clientId:t.clientId,clientSecret:t.clientSecret,refreshToken:t.refreshToken,grantType:"refresh_token"}))};const validateTokenExpiry=t=>{if(t.expiration&&t.expiration.getTime(){if(typeof n==="undefined"){throw new c(`Value not present for '${t}' in SSO Token${i?". Cannot refresh":""}. ${I}`,false)}};const{writeFile:y}=E;const writeSSOTokenToFile=(t,n)=>{const i=l(t);const a=JSON.stringify(n,null,2);return y(i,a)};const B=new Date(0);const fromSso=(t={})=>async({callerClientConfig:n}={})=>{t.logger?.debug("@aws-sdk/token-providers - fromSso");const i=await d(t);const a=h({profile:t.profile??n?.profile});const A=i[a];if(!A){throw new c(`Profile '${a}' could not be found in shared credentials file.`,false)}else if(!A["sso_session"]){throw new c(`Profile '${a}' is missing required property 'sso_session'.`)}const l=A["sso_session"];const p=await f(t);const m=p[l];if(!m){throw new c(`Sso session '${l}' could not be found in shared credentials file.`,false)}for(const t of["sso_start_url","sso_region"]){if(!m[t]){throw new c(`Sso session '${l}' is missing required property '${t}'.`,false)}}m["sso_start_url"];const E=m["sso_region"];let y;try{y=await g(l)}catch(t){throw new c(`The SSO session token associated with profile=${a} was not found or is invalid. ${I}`,false)}validateTokenKey("accessToken",y.accessToken);validateTokenKey("expiresAt",y.expiresAt);const{accessToken:Q,expiresAt:w}=y;const S={token:Q,expiration:new Date(w)};if(S.expiration.getTime()-Date.now()>C){return S}if(Date.now()-B.getTime()<30*1e3){validateTokenExpiry(S);return S}validateTokenKey("clientId",y.clientId,true);validateTokenKey("clientSecret",y.clientSecret,true);validateTokenKey("refreshToken",y.refreshToken,true);try{B.setTime(Date.now());const i=await getNewSsoOidcToken(y,E,t,n);validateTokenKey("accessToken",i.accessToken);validateTokenKey("expiresIn",i.expiresIn);const a=new Date(Date.now()+i.expiresIn*1e3);try{await writeSSOTokenToFile(l,{...y,accessToken:i.accessToken,expiresAt:a.toISOString(),refreshToken:i.refreshToken})}catch(t){}return{token:i.accessToken,expiration:a}}catch(t){validateTokenExpiry(S);return S}};const fromStatic=({token:t,logger:n})=>async()=>{n?.debug("@aws-sdk/token-providers - fromStatic");if(!t||!t.token){throw new c(`Please pass a valid token to fromStatic`,false)}return t};const nodeProvider=(t={})=>p(m(fromSso(t),async()=>{throw new c("Could not load token from any providers",false)}),t=>t.expiration!==undefined&&t.expiration.getTime()-Date.now()<3e5,t=>t.expiration!==undefined);n.fromEnvSigningName=fromEnvSigningName;n.fromSso=fromSso;n.fromStatic=fromStatic;n.nodeProvider=nodeProvider},4274:(t,n)=>{const i=/[&<>"]/g;const a={"&":"&","<":"<",">":">",'"':"""};function escapeAttribute(t){return t.replace(i,t=>a[t])}const A=/[&"'<>\r\n\u0085\u2028]/g;const c={"&":"&",'"':""","'":"'","<":"<",">":">","\r":" ","\n":" ","Â…":"…","\u2028":"
"};function escapeElement(t){return t.replace(A,t=>c[t])}class XmlText{value;constructor(t){this.value=t}toString(){return escapeElement(""+this.value)}}class XmlNode{name;children;attributes={};static of(t,n,i){const a=new XmlNode(t);if(n!==undefined){a.addChildNode(new XmlText(n))}if(i!==undefined){a.withName(i)}return a}constructor(t,n=[]){this.name=t;this.children=n}withName(t){this.name=t;return this}addAttribute(t,n){this.attributes[t]=n;return this}addChildNode(t){this.children.push(t);return this}removeAttribute(t){delete this.attributes[t];return this}n(t){this.name=t;return this}c(t){this.children.push(t);return this}a(t,n){if(n!=null){this.attributes[t]=n}return this}cc(t,n,i=n){if(t[n]!=null){const a=XmlNode.of(n,t[n]).withName(i);this.c(a)}}l(t,n,i,a){if(t[n]!=null){const t=a();t.map(t=>{t.withName(i);this.c(t)})}}lc(t,n,i,a){if(t[n]!=null){const t=a();const n=new XmlNode(i);t.map(t=>{n.c(t)});this.c(n)}}toString(){const t=Boolean(this.children.length);let n=`<${this.name}`;const i=this.attributes;for(const t of Object.keys(i)){const a=i[t];if(a!=null){n+=` ${t}="${escapeAttribute(""+a)}"`}}return n+=!t?"/>":`>${this.children.map(t=>t.toString()).join("")}`}}function parseXML(t){const n=new AwsXmlParser(t);return n.parse()}class AwsXmlParser{x;i=0;z;constructor(t){this.x=t;this.x=t.replace(/\r\n?/g,"\n");this.z=this.x.length}parse(){const t=this;const{z:n}=t;while(t.i=n){break}if(t.isNext("");t.trim()}else if(t.isNext("\x3c!--")){t.readTo("--\x3e");t.trim()}else if(t.isNext("/".includes(t.x[t.i])){n+=t.x[t.i++]}let i=false;const a=Object.create(null);while(t.i/".includes(t.x[t.i])){break}let n="";while(t.i/?".includes(t.x[t.i])){n+=t.x[t.i++]}t.trim();if(t.x[t.i]!=="="){break}++t.i;t.trim();a[n]=t.readAttrValue();i=true}if(t.i>=t.z){throw new Error("@aws-sdk XML parse error: unexpected end of input.")}if(t.x[t.i]==="/"){++t.i;if(t.i>=t.z||t.x[t.i]!==">"){throw new Error("@aws-sdk XML parse error: expected > at the end of self-closing tag.")}++t.i;Object.setPrototypeOf(a,Object.prototype);return{tag:n,value:i?a:""}}if(t.x[t.i]!==">"){throw new Error("@aws-sdk XML parse error: expected > at the end of opening tag.")}++t.i;const A=[];const c=[];let l=false;while(t.i"))}else if(t.isNext("")}else{l=true;c.push(t.parseTag())}}else{let n="";while(t.i.`)}t.i+=2;const d=t.readTo(">").trim();if(d!==n){throw new Error(`@aws-sdk XML parse error: mismatched tags <${n}> and .`)}if(!i&&A.length===0&&!l){return{tag:n,value:""}}if(!i&&!l){const t=A.length===1?A[0]:A.join("");if(t.trim()===""&&t.includes("\n")){return{tag:n,value:""}}return{tag:n,value:t}}const h=Object.create(null);for(const t of A){if(t.trim()===""&&t.includes("\n")){continue}h["#text"]="#text"in h?h["#text"]+t:t}for(const t of c){if(t.tag in h){if(Array.isArray(h[t.tag])){h[t.tag].push(t.value)}else{h[t.tag]=[h[t.tag],t.value]}}else{h[t.tag]=t.value}}for(const[t,n]of Object.entries(a)){h[t]=n}Object.setPrototypeOf(h,Object.prototype);return{tag:n,value:h}}static ENTITIES={amp:"&",lt:"<",gt:">",quot:'"',apos:"'"};skipDoctype(){const t=this;t.i+=9;let n=0;while(t.i"&&n===0){++t.i;return}++t.i}throw new Error("@aws-sdk XML parse error: unclosed DOCTYPE.")}decodeEntities(t){return t.replace(/&(?:#x([0-9a-fA-F]{1,6})|#(\d{1,7})|([a-zA-Z][a-zA-Z0-9]{0,30}));/g,(t,n,i,a)=>{if(n){return String.fromCharCode(parseInt(n,16))}if(i){return String.fromCharCode(parseInt(i,10))}return AwsXmlParser.ENTITIES[a]??""})}}n.XmlNode=XmlNode;n.XmlText=XmlText;n.parseXML=parseXML},9320:(t,n,i)=>{const a={REQUEST_ID:Symbol.for("_AWS_LAMBDA_REQUEST_ID"),X_RAY_TRACE_ID:Symbol.for("_AWS_LAMBDA_X_RAY_TRACE_ID"),TENANT_ID:Symbol.for("_AWS_LAMBDA_TENANT_ID")};const A=["true","1"].includes(process.env?.AWS_LAMBDA_NODEJS_NO_GLOBAL_AWSLAMBDA??"");if(!A){globalThis.awslambda=globalThis.awslambda||{}}class InvokeStoreBase{static PROTECTED_KEYS=a;isProtectedKey(t){return Object.values(a).includes(t)}getRequestId(){return this.get(a.REQUEST_ID)??"-"}getXRayTraceId(){return this.get(a.X_RAY_TRACE_ID)}getTenantId(){return this.get(a.TENANT_ID)}}class InvokeStoreSingle extends InvokeStoreBase{currentContext;getContext(){return this.currentContext}hasContext(){return this.currentContext!==undefined}get(t){return this.currentContext?.[t]}set(t,n){if(this.isProtectedKey(t)){throw new Error(`Cannot modify protected Lambda context field: ${String(t)}`)}this.currentContext=this.currentContext||{};this.currentContext[t]=n}run(t,n){this.currentContext=t;return n()}}class InvokeStoreMulti extends InvokeStoreBase{als;static async create(){const t=new InvokeStoreMulti;const n=await Promise.resolve().then(i.t.bind(i,6698,23));t.als=new n.AsyncLocalStorage;return t}getContext(){return this.als.getStore()}hasContext(){return this.als.getStore()!==undefined}get(t){return this.als.getStore()?.[t]}set(t,n){if(this.isProtectedKey(t)){throw new Error(`Cannot modify protected Lambda context field: ${String(t)}`)}const i=this.als.getStore();if(!i){throw new Error("No context available")}i[t]=n}run(t,n){return this.als.run(t,n)}}n.InvokeStore=void 0;(function(t){let n=null;async function getInstanceAsync(t){if(!n){n=(async()=>{const n=t===true||"AWS_LAMBDA_MAX_CONCURRENCY"in process.env;const i=n?await InvokeStoreMulti.create():new InvokeStoreSingle;if(!A&&globalThis.awslambda?.InvokeStore){return globalThis.awslambda.InvokeStore}else if(!A&&globalThis.awslambda){globalThis.awslambda.InvokeStore=i;return i}else{return i}})()}return n}t.getInstanceAsync=getInstanceAsync;t._testing=process.env.AWS_LAMBDA_BENCHMARK_MODE==="1"?{reset:()=>{n=null;if(globalThis.awslambda?.InvokeStore){delete globalThis.awslambda.InvokeStore}globalThis.awslambda={InvokeStore:undefined}}}:undefined})(n.InvokeStore||(n.InvokeStore={}));n.InvokeStoreBase=InvokeStoreBase},402:(t,n,i)=>{const{getSmithyContext:a}=i(4534);n.getSmithyContext=a;const{HttpRequest:A}=i(3422);const{requestBuilder:c}=i(3422);n.requestBuilder=c;const{HttpApiKeyAuthLocation:l}=i(690);const resolveAuthOptions=(t,n)=>{if(!n||n.length===0){return t}const i=[];for(const a of n){for(const n of t){const t=n.schemeId.split("#")[1];if(t===a){i.push(n)}}}for(const n of t){if(!i.find(({schemeId:t})=>t===n.schemeId)){i.push(n)}}return i};function convertHttpAuthSchemesToMap(t){const n=new Map;for(const i of t){n.set(i.schemeId,i)}return n}const httpAuthSchemeMiddleware=(t,n)=>(i,A)=>async c=>{const l=t.httpAuthSchemeProvider(await n.httpAuthSchemeParametersProvider(t,A,c.input));const d=t.authSchemePreference?await t.authSchemePreference():[];const h=resolveAuthOptions(l,d);const f=convertHttpAuthSchemesToMap(t.httpAuthSchemes);const g=a(A);const p=[];for(const i of h){const a=f.get(i.schemeId);if(!a){p.push(`HttpAuthScheme \`${i.schemeId}\` was not enabled for this service.`);continue}const c=a.identityProvider(await n.identityProviderConfigProvider(t));if(!c){p.push(`HttpAuthScheme \`${i.schemeId}\` did not have an IdentityProvider configured.`);continue}const{identityProperties:l={},signingProperties:d={}}=i.propertiesExtractor?.(t,A)||{};i.identityProperties=Object.assign(i.identityProperties||{},l);i.signingProperties=Object.assign(i.signingProperties||{},d);g.selectedHttpAuthScheme={httpAuthOption:i,identity:await c(i.identityProperties),signer:a.signer};break}if(!g.selectedHttpAuthScheme){throw new Error(p.join("\n"))}return i(c)};const d={step:"serialize",tags:["HTTP_AUTH_SCHEME"],name:"httpAuthSchemeMiddleware",override:true,relation:"before",toMiddleware:"endpointV2Middleware"};const getHttpAuthSchemeEndpointRuleSetPlugin=(t,{httpAuthSchemeParametersProvider:n,identityProviderConfigProvider:i})=>({applyToStack:a=>{a.addRelativeTo(httpAuthSchemeMiddleware(t,{httpAuthSchemeParametersProvider:n,identityProviderConfigProvider:i}),d)}});const h={step:"serialize",tags:["HTTP_AUTH_SCHEME"],name:"httpAuthSchemeMiddleware",override:true,relation:"before",toMiddleware:"serializerMiddleware"};const getHttpAuthSchemePlugin=(t,{httpAuthSchemeParametersProvider:n,identityProviderConfigProvider:i})=>({applyToStack:a=>{a.addRelativeTo(httpAuthSchemeMiddleware(t,{httpAuthSchemeParametersProvider:n,identityProviderConfigProvider:i}),h)}});const defaultErrorHandler=t=>t=>{throw t};const defaultSuccessHandler=(t,n)=>{};const httpSigningMiddleware=t=>(t,n)=>async i=>{if(!A.isInstance(i.request)){return t(i)}const c=a(n);const l=c.selectedHttpAuthScheme;if(!l){throw new Error(`No HttpAuthScheme was selected: unable to sign request`)}const{httpAuthOption:{signingProperties:d={}},identity:h,signer:f}=l;const g=await t({...i,request:await f.sign(i.request,h,d)}).catch((f.errorHandler||defaultErrorHandler)(d));(f.successHandler||defaultSuccessHandler)(g.response,d);return g};const f={step:"finalizeRequest",tags:["HTTP_SIGNING"],name:"httpSigningMiddleware",aliases:["apiKeyMiddleware","tokenMiddleware","awsAuthMiddleware"],override:true,relation:"after",toMiddleware:"retryMiddleware"};const getHttpSigningPlugin=t=>({applyToStack:t=>{t.addRelativeTo(httpSigningMiddleware(),f)}});const normalizeProvider=t=>{if(typeof t==="function")return t;const n=Promise.resolve(t);return()=>n};const makePagedClientRequest=async(t,n,i,a=t=>t,...A)=>{let c=new t(i);c=a(c)??c;return await n.send(c,...A)};function createPaginator(t,n,i,a,A){return async function*paginateOperation(c,l,...d){const h=l;let f=c.startingToken??h[i];let g=true;let p;while(g){h[i]=f;if(A){h[A]=h[A]??c.pageSize}if(c.client instanceof t){p=await makePagedClientRequest(n,c.client,l,c.withCommand,...d)}else{throw new Error(`Invalid client, expected instance of ${t.name}`)}yield p;const m=f;f=get(p,a);g=!!(f&&(!c.stopOnSameToken||f!==m))}return undefined}}const get=(t,n)=>{let i=t;const a=n.split(".");for(const t of a){if(!i||typeof i!=="object"){return undefined}i=i[t]}return i};function setFeature(t,n,i){if(!t.__smithy_context){t.__smithy_context={features:{}}}else if(!t.__smithy_context.features){t.__smithy_context.features={}}t.__smithy_context.features[n]=i}class DefaultIdentityProviderConfig{authSchemes=new Map;constructor(t){for(const n in t){const i=t[n];if(i!==undefined){this.authSchemes.set(n,i)}}}getIdentityProvider(t){return this.authSchemes.get(t)}}class HttpApiKeyAuthSigner{async sign(t,n,i){if(!i){throw new Error("request could not be signed with `apiKey` since the `name` and `in` signer properties are missing")}if(!i.name){throw new Error("request could not be signed with `apiKey` since the `name` signer property is missing")}if(!i.in){throw new Error("request could not be signed with `apiKey` since the `in` signer property is missing")}if(!n.apiKey){throw new Error("request could not be signed with `apiKey` since the `apiKey` is not defined")}const a=A.clone(t);if(i.in===l.QUERY){a.query[i.name]=n.apiKey}else if(i.in===l.HEADER){a.headers[i.name]=i.scheme?`${i.scheme} ${n.apiKey}`:n.apiKey}else{throw new Error("request can only be signed with `apiKey` locations `query` or `header`, "+"but found: `"+i.in+"`")}return a}}class HttpBearerAuthSigner{async sign(t,n,i){const a=A.clone(t);if(!n.token){throw new Error("request could not be signed with `token` since the `token` is not defined")}a.headers["Authorization"]=`Bearer ${n.token}`;return a}}class NoAuthSigner{async sign(t,n,i){return t}}const createIsIdentityExpiredFunction=t=>function isIdentityExpired(n){return doesIdentityRequireRefresh(n)&&n.expiration.getTime()-Date.now()t.expiration!==undefined;const memoizeIdentityProvider=(t,n,i)=>{if(t===undefined){return undefined}const a=typeof t!=="function"?async()=>Promise.resolve(t):t;let A;let c;let l;let d=false;const coalesceProvider=async t=>{if(!c){c=a(t)}try{A=await c;l=true;d=false}finally{c=undefined}return A};if(n===undefined){return async t=>{if(!l||t?.forceRefresh){A=await coalesceProvider(t)}return A}}return async t=>{if(!l||t?.forceRefresh){A=await coalesceProvider(t)}if(d){return A}if(!i(A)){d=true;return A}if(n(A)){await coalesceProvider(t);return A}return A}};n.DefaultIdentityProviderConfig=DefaultIdentityProviderConfig;n.EXPIRATION_MS=g;n.HttpApiKeyAuthSigner=HttpApiKeyAuthSigner;n.HttpBearerAuthSigner=HttpBearerAuthSigner;n.NoAuthSigner=NoAuthSigner;n.createIsIdentityExpiredFunction=createIsIdentityExpiredFunction;n.createPaginator=createPaginator;n.doesIdentityRequireRefresh=doesIdentityRequireRefresh;n.getHttpAuthSchemeEndpointRuleSetPlugin=getHttpAuthSchemeEndpointRuleSetPlugin;n.getHttpAuthSchemePlugin=getHttpAuthSchemePlugin;n.getHttpSigningPlugin=getHttpSigningPlugin;n.httpAuthSchemeEndpointRuleSetMiddlewareOptions=d;n.httpAuthSchemeMiddleware=httpAuthSchemeMiddleware;n.httpAuthSchemeMiddlewareOptions=h;n.httpSigningMiddleware=httpSigningMiddleware;n.httpSigningMiddlewareOptions=f;n.isIdentityExpired=p;n.memoizeIdentityProvider=memoizeIdentityProvider;n.normalizeProvider=normalizeProvider;n.setFeature=setFeature},4645:(t,n,i)=>{const{nv:a,NumericValue:A,calculateBodyLength:c,_parseEpochTimestamp:l,fromBase64:d,generateIdempotencyToken:h}=i(2430);const{HttpRequest:f,collectBody:g,SerdeContext:p,RpcProtocol:m}=i(3422);const{NormalizedSchema:E,deref:C,TypeRegistry:I}=i(6890);const{getSmithyContext:y}=i(4534);const B=0;const Q=1;const w=2;const S=3;const b=4;const R=5;const v=6;const k=7;const D=20;const T=21;const N=22;const M=23;const F=24;const x=25;const U=26;const P=27;const L=31;function alloc(t){return typeof Buffer!=="undefined"?Buffer.alloc(t):new Uint8Array(t)}const O=Symbol("@smithy/core/cbor::tagSymbol");function tag(t){t[O]=true;return t}const H=typeof Buffer!=="undefined";const $=new TextDecoder;let G=alloc(0);let V=false;let Y=new DataView(G.buffer,G.byteOffset,G.byteLength);let J=0;function setPayload(t){G=t;V=H&&G instanceof Buffer;Y=new DataView(G.buffer,G.byteOffset,G.byteLength)}function decode(t,n){if(t>=n){throw new Error("unexpected end of (decode) payload.")}const i=(G[t]&224)>>5;const a=G[t]&31;if(a===L&&2<=i&&i<=5){return decodeIndefinite(t,n)}switch(i){case B:case Q:case v:{let A;let c;if(a<24){A=a;c=1}else{switch(a){case F:if(n-t<2){overflow(1)}A=G[t+1];c=2;break;case x:if(n-t<3){overflow(2)}A=Y.getUint16(t+1);c=3;break;case U:if(n-t<5){overflow(4)}A=Y.getUint32(t+1);c=5;break;case P:if(n-t<9){overflow(8)}{const n=Y.getUint32(t+1);if(n<2097152){A=n*4294967296+Y.getUint32(t+5)}else{A=Y.getBigUint64(t+1)}}c=9;break;default:unexpectedMinor(a)}}if(i===B){J=c;return castBigInt(A)}else if(i===Q){let t;if(typeof A==="bigint"){t=BigInt(-1)-A}else{t=-1-A}J=c;return castBigInt(t)}else{return decodeTagValue(t,n,a,A,c)}}case S:return decodeUtf8String(t,n);case R:return decodeMap(t,n);case b:return decodeList(t,n);case w:return decodeUnstructuredByteString(t,n);default:return decodeSpecial(t,n)}}function decodeIndefinite(t,n){const i=(G[t]&224)>>5;const a=G[t]&31;if(a===L){switch(i){case S:return decodeUtf8StringIndefinite(t,n);case R:return decodeMapIndefinite(t,n);case b:return decodeListIndefinite(t,n);case w:return decodeUnstructuredByteStringIndefinite(t,n)}}}function bytesToFloat16(t,n){const i=t>>7;const a=(t&124)>>2;const A=(t&3)<<8|n;const c=i===0?1:-1;if(a===0){if(A===0){return 0}return c*(Math.pow(2,1-15)*(A/1024))}else if(a===31){if(A===0){return c*Infinity}return NaN}return c*(Math.pow(2,a-15)*(1+A/1024))}function decodeMap(t,n){const i=decodeCount(t,n);if(i<15){return decodeMapSmall(t,n,i)}return decodeMapLarge(t,n,i)}function decodeMapLarge(t,n,i){const a=J;t+=a;const A=t;const c=Object.create(null);for(let a=0;a>5;if(a===S){c[i]=decodeUtf8String(t,n)}else{c[i]=decode(t,n)}t+=J}J=a+(t-A);Object.setPrototypeOf(c,Object.prototype);return c}function decodeMapSmall(t,n,i){const a=J;t+=a;const A=t;const c={};for(let a=0;a>>0&2047;const A=W[a];if(A!==undefined){if(A.length===n){let i=true;for(let a=0;a>5;const c=G[t]&31;if(A!==S){unexpectedMajorInIndefiniteString(A)}if(c===L){throw new Error("nested indefinite string.")}const l=decodeUnstructuredByteString(t,n);const d=J;t+=d;for(let t=0;t>5;const c=G[t]&31;if(A!==w){unexpectedMajorInIndefiniteString(A)}if(c===L){throw new Error("nested indefinite string.")}const l=decodeUnstructuredByteString(t,n);const d=J;t+=d;for(let t=0;t23){encodeHeader(S,Buffer.byteLength(t));ne+=te.write(t,ne)}else{encodeStringCached(t)}}else{const i=n*3;ensureSpace(i+9);const a=ne;const A=(new TextEncoder).encodeInto(t,te.subarray(ne+9));const c=A.written;let l;if(c<24){l=1}else if(c<256){l=2}else if(c<65536){l=3}else if(c<4294967296){l=5}else{l=9}if(l<9){te.copyWithin(a+l,a+9,a+9+c)}ne=a;encodeInteger(S,c);ne+=c}continue}if(te.byteLength-ne<9){ensureSpace(64)}if(typeof t==="number"){if(Number.isInteger(t)){const n=t>=0;const i=n?B:Q;const a=n?t:-t-1;if(a<24){te[ne++]=i<<5|a}else if(a<256){te[ne++]=i<<5|24;te[ne++]=a}else if(a<65536){te[ne++]=i<<5|x;te[ne++]=a>>8;te[ne++]=a&255}else if(a<4294967296){te[ne++]=i<<5|U;re.setUint32(ne,a);ne+=4}else{te[ne++]=i<<5|P;const t=a/4294967296|0;const n=a-t*4294967296|0;re.setUint32(ne,t);re.setUint32(ne+4,n);ne+=8}continue}te[ne++]=k<<5|P;re.setFloat64(ne,t);ne+=8;continue}else if(typeof t==="bigint"){const n=t>=0;const i=n?B:Q;const a=n?t:-t-BigInt(1);if(a=0){i[i.byteLength-c]=Number(A&BigInt(255));A>>=BigInt(8)}ensureSpace(i.byteLength*2+16);te[ne++]=n?194:195;encodeHeader(w,i.byteLength);te.set(i,ne);ne+=i.byteLength}continue}else if(t===null){te[ne++]=k<<5|N;continue}else if(typeof t==="boolean"){te[ne++]=k<<5|(t?T:D);continue}else if(typeof t==="undefined"){throw new Error("@smithy/core/cbor: client may not serialize undefined value.")}else if(Array.isArray(t)){encodeInteger(b,t.length);ensureSpace(t.length*9+64);for(let i=t.length-1;i>=0;--i){n.push(t[i])}continue}else if(typeof t.byteLength==="number"){ensureSpace(t.length*2+9);encodeInteger(w,t.length);te.set(t,ne);ne+=t.byteLength;continue}else if(typeof t==="object"){if(t instanceof A){const i=t.string.indexOf(".");const a=i===-1?0:i-t.string.length+1;const A=BigInt(t.string.replace(".",""));te[ne++]=196;encodeInteger(b,2);n.push(A);n.push(a);continue}if(t[O]){if("tag"in t&&"value"in t){n.push(t.value);encodeHeader(v,t.tag);continue}else{throw new Error("tag encountered with missing fields, need 'tag' and 'value', found: "+JSON.stringify(t))}}const i=Object.keys(t);const a=i.length;encodeInteger(R,a);for(let A=a-1;A>=0;--A){n.push(t[i[A]]);n.push(i[A])}continue}throw new Error(`data type ${t?.constructor?.name??typeof t} not compatible for encoding.`)}}function advanceEncodingEpoch(){Z=Z+1&65535;X=false}function toUint8Array(){const t=alloc(ne);t.set(te.subarray(0,ne),0);ne=0;return t}function resize(t){const n=te;te=alloc(t);if(n){if(n.copy){n.copy(te,0,0,n.byteLength)}else{te.set(n,0)}}re=new DataView(te.buffer,te.byteOffset,te.byteLength)}function encodeStringCached(t){const n=K.get(t);if(n!==undefined){te.set(n.bytes,ne);ne+=n.bytes.length;n.epoch=Z;return}const i=ne;const a=Buffer.byteLength(t);encodeInteger(S,a);ne+=te.write(t,ne);const A=Uint8Array.prototype.slice.call(te,i,ne);if(K.size>=2048){if(X){return}let t=0;for(const[n,i]of K){if(t>=1024){break}if(i.epoch!==Z){K.delete(n);t++}}if(t===0){X=true;return}}if(K.size<2048){K.set(t,{epoch:Z,bytes:A})}}function ensureSpace(t){const n=te.byteLength-ne;if(n>8;te[ne++]=n&255}else if(n<4294967296){te[ne++]=t<<5|U;re.setUint32(ne,n);ne+=4}else{te[ne++]=t<<5|P;const i=n/4294967296|0;const a=n-i*4294967296|0;re.setUint32(ne,i);re.setUint32(ne+4,a);ne+=8}}const se={deserialize(t){advanceDecodingEpoch();setPayload(t);return decode(0,t.length)},serialize(t){advanceEncodingEpoch();try{encode(t);return toUint8Array()}catch(t){toUint8Array();throw t}},resizeEncodingBuffer(t){resize(t)}};const parseCborBody=(t,n)=>g(t,n).then(async t=>{if(t.length){try{return se.deserialize(t)}catch(i){Object.defineProperty(i,"$responseBodyText",{value:n.utf8Encoder(t)});throw i}}return{}});const dateToTag=t=>tag({tag:1,value:t.getTime()/1e3});const parseCborErrorBody=async(t,n)=>{const i=await parseCborBody(t,n);i.message=i.message??i.Message;return i};const loadSmithyRpcV2CborErrorCode=(t,n)=>{const sanitizeErrorCode=t=>{let n=t;if(typeof n==="number"){n=n.toString()}if(n.indexOf(",")>=0){n=n.split(",")[0]}if(n.indexOf(":")>=0){n=n.split(":")[0]}if(n.indexOf("#")>=0){n=n.split("#")[1]}return n};if(n["__type"]!==undefined){return sanitizeErrorCode(n["__type"])}let i;for(const t in n){if(t.toLowerCase()==="code"){i=t;break}}if(i&&n[i]!==undefined){return sanitizeErrorCode(n[i])}};const checkCborResponse=t=>{if(String(t.headers["smithy-protocol"]).toLowerCase()!=="rpc-v2-cbor"){throw new Error("Malformed RPCv2 CBOR response, status: "+t.statusCode)}};const buildHttpRpcRequest=async(t,n,i,a,A)=>{const l=await t.endpoint();const{hostname:d,protocol:h="https",port:g,path:p}=l;const m={protocol:h,hostname:d,port:g,method:"POST",path:p.endsWith("/")?p.slice(0,-1)+i:p+i,headers:{...n}};if(a!==undefined){m.hostname=a}if(l.headers){for(const t in l.headers){m.headers[t]=l.headers[t]}}if(A!==undefined){m.body=A;try{m.headers["content-length"]=String(c(A))}catch(t){}}return new f(m)};class CborCodec extends p{createSerializer(){const t=new CborShapeSerializer;t.setSerdeContext(this.serdeContext);return t}createDeserializer(){const t=new CborShapeDeserializer;t.setSerdeContext(this.serdeContext);return t}}class CborShapeSerializer extends p{value;write(t,n){this.value=this.serialize(t,n)}serialize(t,n){const i=E.of(t);if(n==null){if(i.isIdempotencyToken()){return h()}return n}if(i.isBlobSchema()){if(typeof n==="string"){return(this.serdeContext?.base64Decoder??d)(n)}return n}if(i.isTimestampSchema()){if(typeof n==="number"||typeof n==="bigint"){return dateToTag(new Date(Number(n)/1e3|0))}return dateToTag(n)}if(typeof n==="function"||typeof n==="object"){const t=n;if(i.isListSchema()&&Array.isArray(t)){const n=!!i.getMergedTraits().sparse;const a=[];let A=0;for(const c of t){const t=this.serialize(i.getValueSchema(),c);if(t!=null||n){a[A++]=t}}return a}if(t instanceof Date){return dateToTag(t)}const a={};if(i.isMapSchema()){const n=!!i.getMergedTraits().sparse;for(const A in t){const c=this.serialize(i.getValueSchema(),t[A]);if(c!=null||n){a[A]=c}}}else if(i.isStructSchema()){for(const[n,A]of i.structIterator()){const i=this.serialize(A,t[n]);if(i!=null){a[n]=i}}const n=i.isUnionSchema();if(n&&Array.isArray(t.$unknown)){const[n,i]=t.$unknown;a[n]=i}else if(typeof t.__type==="string"){for(const n in t){if(!(n in a)){a[n]=this.serialize(15,t[n])}}}}else if(i.isDocumentSchema()){for(const n in t){a[n]=this.serialize(i.getValueSchema(),t[n])}}else if(i.isBigDecimalSchema()){return t}return a}return n}flush(){const t=se.serialize(this.value);this.value=undefined;return t}}class CborShapeDeserializer extends p{read(t,n){const i=se.deserialize(n);return this.readValue(t,i)}readValue(t,n){const i=E.of(t);if(i.isTimestampSchema()){if(typeof n==="number"){return l(n)}if(typeof n==="object"){if(n.tag===1&&"value"in n){return l(n.value)}}}if(i.isBlobSchema()){if(typeof n==="string"){return(this.serdeContext?.base64Decoder??d)(n)}return n}if(typeof n==="undefined"||typeof n==="boolean"||typeof n==="number"||typeof n==="string"||typeof n==="bigint"||typeof n==="symbol"){return n}else if(typeof n==="object"){if(n===null){return null}if("byteLength"in n){return n}if(n instanceof Date){return n}if(i.isDocumentSchema()){return n}if(i.isListSchema()){const t=[];const a=i.getValueSchema();for(const i of n){const n=this.readValue(a,i);t.push(n)}return t}const t={};if(i.isMapSchema()){const a=i.getValueSchema();for(const i in n){const A=this.readValue(a,n[i]);t[i]=A}}else if(i.isStructSchema()){const a=i.isUnionSchema();let A;if(a){A=new Set;for(const t in n){if(t!=="__type"){A.add(t)}}}for(const[c,l]of i.structIterator()){if(a){A.delete(c)}if(n[c]!=null){t[c]=this.readValue(l,n[c])}}if(a&&A?.size===1){let i=true;for(const n in t){i=false;break}if(i){const i=A.values().next().value;t.$unknown=[i,n[i]]}}else if(typeof n.__type==="string"){for(const i in n){if(!(i in t)){t[i]=n[i]}}}}else if(n instanceof A){return n}return t}else{return n}}}class SmithyRpcV2CborProtocol extends m{codec=new CborCodec;serializer=this.codec.createSerializer();deserializer=this.codec.createDeserializer();constructor({defaultNamespace:t,errorTypeRegistries:n}){super({defaultNamespace:t,errorTypeRegistries:n})}getShapeId(){return"smithy.protocols#rpcv2Cbor"}getPayloadCodec(){return this.codec}async serializeRequest(t,n,i){const a=await super.serializeRequest(t,n,i);Object.assign(a.headers,{"content-type":this.getDefaultContentType(),"smithy-protocol":"rpc-v2-cbor",accept:this.getDefaultContentType()});if(C(t.input)==="unit"){delete a.body;delete a.headers["content-type"]}else{if(!a.body){this.serializer.write(15,{});a.body=this.serializer.flush()}try{a.headers["content-length"]=String(a.body.byteLength)}catch(t){}}const{service:A,operation:c}=y(i);const l=`/service/${A}/operation/${c}`;if(a.path.endsWith("/")){a.path+=l.slice(1)}else{a.path+=l}return a}async deserializeResponse(t,n,i){return super.deserializeResponse(t,n,i)}async handleError(t,n,i,a,A){const c=loadSmithyRpcV2CborErrorCode(i,a)??"Unknown";const l={$metadata:A,$fault:i.statusCode<=500?"client":"server"};let d=this.options.defaultNamespace;if(c.includes("#")){[d]=c.split("#")}const h=this.compositeErrorRegistry;const f=I.for(d);h.copyFrom(f);let g;try{g=h.getSchema(c)}catch(t){if(a.Message){a.message=a.Message}const n=I.for("smithy.ts.sdk.synthetic."+d);h.copyFrom(n);const i=h.getBaseException();if(i){const t=h.getErrorCtor(i);throw Object.assign(new t({name:c}),l,a)}throw Object.assign(new Error(c),l,a)}const p=E.of(g);const m=h.getErrorCtor(g);const C=a.message??a.Message??"Unknown";const y=new m({});const B={};for(const[t,n]of p.structIterator()){B[t]=this.deserializer.readValue(n,a[t])}throw Object.assign(y,l,{$fault:p.getMergedTraits().error,message:C},B)}getDefaultContentType(){return"application/cbor"}}n.CborCodec=CborCodec;n.CborShapeDeserializer=CborShapeDeserializer;n.CborShapeSerializer=CborShapeSerializer;n.SmithyRpcV2CborProtocol=SmithyRpcV2CborProtocol;n.buildHttpRpcRequest=buildHttpRpcRequest;n.cbor=se;n.checkCborResponse=checkCborResponse;n.dateToTag=dateToTag;n.loadSmithyRpcV2CborErrorCode=loadSmithyRpcV2CborErrorCode;n.parseCborBody=parseCborBody;n.parseCborErrorBody=parseCborErrorBody;n.tag=tag;n.tagSymbol=O},9542:(t,n,i)=>{const{createReadStream:a}=i(3024);const{Writable:A}=i(7075);const{toUint8Array:c,concatBytes:l}=i(2430);const{createHash:d,createHmac:h}=i(7598);const f=i(8522);async function blobReader(t,n,i=1024*1024){const a=t.size;let A=0;while(A{i.update(t)});return i.digest()};class HashCalculator extends A{hash;constructor(t,n){super(n);this.hash=t}_write(t,n,i){try{this.hash.update(c(t))}catch(t){return i(t)}i()}}const fileStreamHasher=(t,n)=>new Promise((i,A)=>{if(!isReadStream(n)){A(new Error("Unable to calculate hash for non-file streams."));return}const c=a(n.path,{start:n.start,end:n.end});const l=new t;const d=new HashCalculator(l);c.pipe(d);c.on("error",t=>{d.end();A(t)});d.on("error",A);d.on("finish",function(){l.digest().then(i).catch(A)})});const isReadStream=t=>typeof t.path==="string";const readableStreamHasher=(t,n)=>{if(n.readableFlowing!==null){throw new Error("Unable to calculate hash for flowing readable stream")}const i=new t;const a=new HashCalculator(i);n.pipe(a);return new Promise((t,A)=>{n.on("error",t=>{a.end();A(t)});a.on("error",A);a.on("finish",()=>{i.digest().then(t).catch(A)})})};class Md5Js{digestLength=16;state=Uint32Array.from(p);writeBuffer=new DataView(new ArrayBuffer(64));bufferLength=0;bytesHashed=0;update(t){const n=c(t);let i=0;let a=n.byteLength;this.bytesHashed+=a;while(a>0){this.writeBuffer.setUint8(this.bufferLength++,n[i++]);--a;if(this.bufferLength===64){compress(this.state,this.writeBuffer);this.bufferLength=0}}}async digest(){const t=Uint32Array.from(this.state);const n=new DataView(this.writeBuffer.buffer.slice(0));let i=this.bufferLength;const a=this.bytesHashed*8;n.setUint8(i++,128);if(this.bufferLength%64>=56){for(let t=i;t<64;++t){n.setUint8(t,0)}compress(t,n);i=0}for(let t=i;t<56;++t){n.setUint8(t,0)}n.setUint32(56,a>>>0,true);n.setUint32(60,Math.floor(a/2**32),true);compress(t,n);const A=new Uint8Array(16);const c=new DataView(A.buffer);for(let n=0;n<4;++n){c.setUint32(n*4,t[n],true)}return A}reset(){this.state.set(p);this.writeBuffer=new DataView(new ArrayBuffer(64));this.bufferLength=0;this.bytesHashed=0}}const p=[1732584193,4023233417,2562383102,271733878];const m=4294967295;const E=Uint8Array.of(7,12,17,22,5,9,14,20,4,11,16,23,6,10,15,21);const C=Array.from({length:64},(t,n)=>Math.abs(Math.sin(n+1))*2**32>>>0);function compress(t,n){let i=t[0],a=t[1],A=t[2],c=t[3];for(let t=0;t<64;++t){let l,d;if(t<16){l=a&A|~a&c;d=t}else if(t<32){l=c&a|A&~c;d=(5*t+1)%16}else if(t<48){l=a^A^c;d=(3*t+5)%16}else{l=A^(a|~c);d=7*t%16}const h=n.getUint32(d*4,true);const f=c;c=A;A=a;const g=E[(t>>4)*4+(t&3)];const p=(i+l&m)+(h+C[t]&m)&m;a=a+((p<>>32-g)>>>0)&m;i=f}t[0]=t[0]+i&m;t[1]=t[1]+a&m;t[2]=t[2]+A&m;t[3]=t[3]+c&m}const I=(()=>{try{d("md5");return true}catch{return false}})();const y=I?buildNativeClass$2():Md5Js;function buildNativeClass$2(){return class Md5Node{digestLength=16;hash=d("md5");update(t){this.hash.update(c(t))}async digest(){const t=this.hash.copy().digest();return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}reset(){this.hash=d("md5")}}}const B=new Uint32Array(256);for(let t=0;t<256;++t){let n=t;for(let t=0;t<8;++t){n=n&1?3988292384^n>>>1:n>>>1}B[t]=n>>>0}const Q=4294967295;class Crc32Js{digestLength=4;checksum=Q;update(t){for(let n=0;n>>8^B[(this.checksum^t[n])&255]}}digestSync(){return(this.checksum^Q)>>>0}async digest(){const t=this.digestSync();const n=new Uint8Array(4);new DataView(n.buffer).setUint32(0,t,false);return n}reset(){this.checksum=Q}}const w=typeof f.crc32==="function"?f.crc32:undefined;const S=w?buildNativeClass$1(w):Crc32Js;function buildNativeClass$1(t){return class Crc32Node{digestLength=4;value=0;update(n){this.value=t(n,this.value)}digestSync(){return this.value>>>0}async digest(){const t=new Uint8Array(4);new DataView(t.buffer).setUint32(0,this.digestSync(),false);return t}reset(){this.value=0}}}const b=64;const R=32;const v=2**53-1;class Sha256Js{digestLength=R;state=Int32Array.from(k);w;buffer=new Uint8Array(64);bufferLength=0;bytesHashed=0;finished=false;inner;outer;constructor(t){if(t){const n=Sha256Js.normalizeKey(t);this.inner=new Sha256Js;this.outer=new Sha256Js;const{inner:i,outer:a}=this;const A=new Uint8Array(b*2);for(let t=0;tv){throw new Error("Cannot hash more than 2^53 - 1 bits")}while(a>0){this.buffer[this.bufferLength++]=n[i++];a--;if(this.bufferLength===b){this.hashBuffer();this.bufferLength=0}}}async digest(){const{inner:t,outer:n}=this;if(t&&n){if(this.finished){throw new Error("Attempted to digest an already finished HMAC.")}this.finished=true;const i=t.digestSync();n.update(i);return n.digestSync()}return this.digestSync()}reset(){this.state=Int32Array.from(k);this.buffer=new Uint8Array(64);this.bufferLength=0;this.bytesHashed=0}digestSync(){const t=this.state.slice();const n=this.buffer.slice();let i=this.bufferLength;const a=this.bytesHashed*8;const A=new DataView(n.buffer,n.byteOffset,n.byteLength);A.setUint8(i++,128);if((i-1)%b>=b-8){for(let t=i;t>>24&255;c[n*4+1]=t[n]>>>16&255;c[n*4+2]=t[n]>>>8&255;c[n*4+3]=t[n]>>>0&255}return c}static normalizeKey(t){const n=c(t);if(n.byteLength>b){const t=new Sha256Js;t.update(n);const i=t.digestSync();const a=new Uint8Array(b);a.set(i);return a}if(n.byteLength>>17|n<<15)^(n>>>19|n<<13)^n>>>10;n=i[t-15];const A=(n>>>7|n<<25)^(n>>>18|n<<14)^n>>>3;i[t]=(a+i[t-7]|0)+(A+i[t-16]|0)}const p=(((d>>>6|d<<26)^(d>>>11|d<<21)^(d>>>25|d<<7))+(d&h^~d&f)|0)+(g+(D[t]+i[t]|0)|0)|0;const m=((a>>>2|a<<30)^(a>>>13|a<<19)^(a>>>22|a<<10))+(a&A^a&c^A&c)|0;g=f;f=h;h=d;d=l+p|0;l=c;c=A;A=a;a=p+m|0}t[0]+=a;t[1]+=A;t[2]+=c;t[3]+=l;t[4]+=d;t[5]+=h;t[6]+=f;t[7]+=g}}const k=new Int32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);const D=new Int32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);const T=(()=>{try{d("sha256");return true}catch{return false}})();const N=T?buildNativeClass():Sha256Js;function buildNativeClass(){return class Sha256Node{digestLength=32;secret;hash;isHmac;finished=false;constructor(t){this.secret=t;this.isHmac=!!t;this.hash=this.createHash()}update(t){if(this.finished){throw new Error("Attempted to update an already finished hash.")}this.hash.update(t)}async digest(){let t;if(this.isHmac){this.finished=true;t=this.hash.digest()}else{t=this.hash.copy().digest()}return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}reset(){this.hash=this.createHash();this.finished=false}createHash(){return this.secret?h("sha256",toBuffer(this.secret)):d("sha256")}}}function toBuffer(t){if(typeof t==="string"){return t}if(ArrayBuffer.isView(t)){return Buffer.from(t.buffer,t.byteOffset,t.byteLength)}return Buffer.from(t)}const{digest:M,sign:F,importKey:x}=globalThis?.crypto?.subtle??{};const U=typeof M==="function"&&typeof F==="function"&&typeof x==="function"?globalThis.crypto.subtle:undefined;const P=8*1024*1024;class Sha256WebCrypto{digestLength=32;secret;pending=[];pendingBytes=0;fallback;finished=false;constructor(t){if(t){this.secret=c(t)}}update(t){if(this.finished){throw new Error("Attempted to update an already finished HMAC.")}if(this.fallback){this.fallback.update(t);return}this.pending.push(t.slice());this.pendingBytes+=t.byteLength;if(this.pendingBytes>=P){this.switchToFallback()}}async digest(){if(this.fallback){return this.fallback.digest()}if(this.secret&&this.finished){throw new Error("Attempted to digest an already finished HMAC.")}const t=l(this.pending);if(U){if(this.secret){this.finished=true;const n=await U.importKey("raw",this.secret,{name:"HMAC",hash:"SHA-256"},false,["sign"]);const i=await U.sign("HMAC",n,t);return new Uint8Array(i)}const n=await U.digest("SHA-256",t);return new Uint8Array(n)}const n=new Sha256Js(this.secret);n.update(t);return n.digest()}reset(){this.pending=[];this.pendingBytes=0;this.fallback=undefined;this.finished=false}switchToFallback(){const t=new Sha256Js(this.secret);for(const n of this.pending){t.update(n)}this.fallback=t;this.pending=[];this.pendingBytes=0}}n.Crc32=S;n.Crc32Js=Crc32Js;n.Crc32Node=S;n.Md5=y;n.Md5Js=Md5Js;n.Md5Node=y;n.Sha256=N;n.Sha256Js=Sha256Js;n.Sha256Node=N;n.Sha256WebCrypto=Sha256WebCrypto;n.blobHasher=g;n.blobReader=blobReader;n.fileStreamHasher=fileStreamHasher;n.readableStreamHasher=readableStreamHasher},2658:(t,n,i)=>{const{getSmithyContext:a,normalizeProvider:A}=i(4534);n.getSmithyContext=a;n.normalizeProvider=A;const{SMITHY_CONTEXT_KEY:c,AlgorithmId:l}=i(690);n.AlgorithmId=l;const{NormalizedSchema:d}=i(6890);const getAllAliases=(t,n)=>{const i=[];if(t){i.push(t)}if(n){for(const t of n){i.push(t)}}return i};const getMiddlewareNameWithAliases=(t,n)=>`${t||"anonymous"}${n&&n.length>0?` (a.k.a. ${n.join(",")})`:""}`;const constructStack=()=>{let t=[];let n=[];let i=false;const a=new Set;const sort=t=>t.sort((t,n)=>h[n.step]-h[t.step]||f[n.priority||"normal"]-f[t.priority||"normal"]);const removeByName=i=>{let A=false;const filterCb=t=>{const n=getAllAliases(t.name,t.aliases);if(n.includes(i)){A=true;for(const t of n){a.delete(t)}return false}return true};t=t.filter(filterCb);n=n.filter(filterCb);return A};const removeByReference=i=>{let A=false;const filterCb=t=>{if(t.middleware===i){A=true;for(const n of getAllAliases(t.name,t.aliases)){a.delete(n)}return false}return true};t=t.filter(filterCb);n=n.filter(filterCb);return A};const cloneTo=i=>{t.forEach(t=>{i.add(t.middleware,{...t})});n.forEach(t=>{i.addRelativeTo(t.middleware,{...t})});i.identifyOnResolve?.(A.identifyOnResolve());return i};const expandRelativeMiddlewareList=t=>{const n=[];t.before.forEach(t=>{if(t.before.length===0&&t.after.length===0){n.push(t)}else{n.push(...expandRelativeMiddlewareList(t))}});n.push(t);t.after.reverse().forEach(t=>{if(t.before.length===0&&t.after.length===0){n.push(t)}else{n.push(...expandRelativeMiddlewareList(t))}});return n};const getMiddlewareList=(i=false)=>{const a=[];const A=[];const c={};t.forEach(t=>{const n={...t,before:[],after:[]};for(const t of getAllAliases(n.name,n.aliases)){c[t]=n}a.push(n)});n.forEach(t=>{const n={...t,before:[],after:[]};for(const t of getAllAliases(n.name,n.aliases)){c[t]=n}A.push(n)});A.forEach(t=>{if(t.toMiddleware){const n=c[t.toMiddleware];if(n===undefined){if(i){return}throw new Error(`${t.toMiddleware} is not found when adding `+`${getMiddlewareNameWithAliases(t.name,t.aliases)} `+`middleware ${t.relation} ${t.toMiddleware}`)}if(t.relation==="after"){n.after.push(t)}if(t.relation==="before"){n.before.push(t)}}});const l=sort(a).map(expandRelativeMiddlewareList).reduce((t,n)=>{t.push(...n);return t},[]);return l};const A={add:(n,i={})=>{const{name:A,override:c,aliases:l}=i;const d={step:"initialize",priority:"normal",middleware:n,...i};const h=getAllAliases(A,l);if(h.length>0){if(h.some(t=>a.has(t))){if(!c)throw new Error(`Duplicate middleware name '${getMiddlewareNameWithAliases(A,l)}'`);for(const n of h){const i=t.findIndex(t=>t.name===n||t.aliases?.some(t=>t===n));if(i===-1){continue}const a=t[i];if(a.step!==d.step||d.priority!==a.priority){throw new Error(`"${getMiddlewareNameWithAliases(a.name,a.aliases)}" middleware with `+`${a.priority} priority in ${a.step} step cannot `+`be overridden by "${getMiddlewareNameWithAliases(A,l)}" middleware with `+`${d.priority} priority in ${d.step} step.`)}t.splice(i,1)}}for(const t of h){a.add(t)}}t.push(d)},addRelativeTo:(t,i)=>{const{name:A,override:c,aliases:l}=i;const d={middleware:t,...i};const h=getAllAliases(A,l);if(h.length>0){if(h.some(t=>a.has(t))){if(!c)throw new Error(`Duplicate middleware name '${getMiddlewareNameWithAliases(A,l)}'`);for(const t of h){const i=n.findIndex(n=>n.name===t||n.aliases?.some(n=>n===t));if(i===-1){continue}const a=n[i];if(a.toMiddleware!==d.toMiddleware||a.relation!==d.relation){throw new Error(`"${getMiddlewareNameWithAliases(a.name,a.aliases)}" middleware `+`${a.relation} "${a.toMiddleware}" middleware cannot be overridden `+`by "${getMiddlewareNameWithAliases(A,l)}" middleware ${d.relation} `+`"${d.toMiddleware}" middleware.`)}n.splice(i,1)}}for(const t of h){a.add(t)}}n.push(d)},clone:()=>cloneTo(constructStack()),use:t=>{t.applyToStack(A)},remove:t=>{if(typeof t==="string")return removeByName(t);else return removeByReference(t)},removeByTag:i=>{let A=false;const filterCb=t=>{const{tags:n,name:c,aliases:l}=t;if(n&&n.includes(i)){const t=getAllAliases(c,l);for(const n of t){a.delete(n)}A=true;return false}return true};t=t.filter(filterCb);n=n.filter(filterCb);return A},concat:t=>{const n=cloneTo(constructStack());n.use(t);n.identifyOnResolve(i||n.identifyOnResolve()||(t.identifyOnResolve?.()??false));return n},applyToStack:cloneTo,identify:()=>getMiddlewareList(true).map(t=>{const n=t.step??t.relation+" "+t.toMiddleware;return getMiddlewareNameWithAliases(t.name,t.aliases)+" - "+n}),identifyOnResolve(t){if(typeof t==="boolean")i=t;return i},resolve:(t,n)=>{for(const i of getMiddlewareList().map(t=>t.middleware).reverse()){t=i(t,n)}if(i){console.log(A.identify())}return t}};return A};const h={initialize:5,serialize:4,build:3,finalizeRequest:2,deserialize:1};const f={high:3,normal:2,low:1};const invalidFunction=t=>()=>{throw new Error(t)};const invalidProvider=t=>()=>Promise.reject(t);const getCircularReplacer=()=>{const t=new WeakSet;return(n,i)=>{if(typeof i==="object"&&i!==null){if(t.has(i)){return"[Circular]"}t.add(i)}return i}};const sleep=t=>new Promise(n=>setTimeout(n,t*1e3));const g={minDelay:2,maxDelay:120};var p;(function(t){t["ABORTED"]="ABORTED";t["FAILURE"]="FAILURE";t["SUCCESS"]="SUCCESS";t["RETRY"]="RETRY";t["TIMEOUT"]="TIMEOUT"})(p||(p={}));const checkExceptions=t=>{if(t.state===p.ABORTED){const n=new Error(`${JSON.stringify({...t,reason:"Request was aborted"},getCircularReplacer())}`);n.name="AbortError";throw n}else if(t.state===p.TIMEOUT){const n=new Error(`${JSON.stringify({...t,reason:"Waiter has timed out"},getCircularReplacer())}`);n.name="TimeoutError";throw n}else if(t.state!==p.SUCCESS){throw new Error(`${JSON.stringify(t,getCircularReplacer())}`)}return t};const runPolling=async({minDelay:t,maxDelay:n,maxWaitTime:i,abortController:a,client:A,abortSignal:c},l,d)=>{const h={};const[f,g]=[t*1e3,n*1e3];let m=0;const E=Date.now()+i*1e3;const C=Date.now()+6e4;let I=false;while(true){if(m>0){const t=exponentialBackoffWithJitter(f,g,m,E);if(a?.signal?.aborted||c?.aborted){const t="AbortController signal aborted.";h[t]|=0;h[t]+=1;return{state:p.ABORTED,observedResponses:h}}if(Date.now()+t>E){return{state:p.TIMEOUT,observedResponses:h}}await sleep(t/1e3)}const{state:t,reason:n}=await d(A,l);if(n){const t=createMessageFromResponse(n);h[t]|=0;h[t]+=1}if(t!==p.RETRY){return{state:t,reason:n,final:n,observedResponses:h}}m+=1;if(!I&&Date.now()>=C){checkWarn403(h,A);I=true}}};const checkWarn403=(t={},n)=>{const i=Object.keys(t);let a=0;for(const n of i){const i=t[n]|0;if(n.startsWith("403:")){a+=i}}const A=n?.config?.logger;const c=typeof A?.warn==="function"&&!A.constructor?.name?.includes?.("NoOpLogger")?A:console;if(a>=3||i[i.length-1]?.startsWith("403:")){c.warn(`@smithy/util-waiter WARN - 403 status code encountered during waiter polling.`)}};const createMessageFromResponse=t=>{const n=t?.$response?.statusCode??t?.$metadata?.httpStatusCode;if(t?.$responseBodyText){return`${n?n+": ":""}Deserialization error for body: ${t.$responseBodyText}`}if(n){if(t?.$response||t?.message){return`${n??"Unknown"}: ${t?.message}`}return`${n}: OK`}return String(t?.message??JSON.stringify(t,getCircularReplacer())??"Unknown")};const exponentialBackoffWithJitter=(t,n,i,a)=>{const A=Math.log(n/t)/Math.log(2)+1;if(i>A){return n}const c=t*2**(i-1);const l=Math.min(c,n);const d=randomInRange(t,l);if(Date.now()+d>a){const t=a-Date.now();return Math.max(0,t-500)}return d};const randomInRange=(t,n)=>t+Math.random()*(n-t);const validateWaiterOptions=t=>{if(t.maxWaitTime<=0){throw new Error(`WaiterConfiguration.maxWaitTime must be greater than 0`)}else if(t.minDelay<=0){throw new Error(`WaiterConfiguration.minDelay must be greater than 0`)}else if(t.maxDelay<=0){throw new Error(`WaiterConfiguration.maxDelay must be greater than 0`)}else if(t.maxWaitTime<=t.minDelay){throw new Error(`WaiterConfiguration.maxWaitTime [${t.maxWaitTime}] must be greater than WaiterConfiguration.minDelay [${t.minDelay}] for this waiter`)}else if(t.maxDelay{let n;const i=new Promise(i=>{n=()=>i({state:p.ABORTED});if(typeof t.addEventListener==="function"){t.addEventListener("abort",n)}else{t.onabort=n}});return{clearListener(){if(typeof t.removeEventListener==="function"){t.removeEventListener("abort",n)}},aborted:i}};const createWaiter=async(t,n,i)=>{const a={...g,...t};validateWaiterOptions(a);const A=[runPolling(a,n,i)];const c=[];if(t.abortSignal){const{aborted:n,clearListener:i}=abortTimeout(t.abortSignal);c.push(i);A.push(n)}if(t.abortController?.signal){const{aborted:n,clearListener:i}=abortTimeout(t.abortController.signal);c.push(i);A.push(n)}return Promise.race(A).then(t=>{for(const t of c){t()}return t})};class Client{config;middlewareStack=constructStack();initConfig;handlers;constructor(t){this.config=t;const{protocol:n,protocolSettings:i}=t;if(i){if(typeof n==="function"){t.protocol=new n(i)}}}send(t,n,i){const a=typeof n!=="function"?n:undefined;const A=typeof n==="function"?n:i;const c=a===undefined&&this.config.cacheMiddleware===true;let l;if(c){if(!this.handlers){this.handlers=new WeakMap}const n=this.handlers;if(n.has(t.constructor)){l=n.get(t.constructor)}else{l=t.resolveMiddleware(this.middlewareStack,this.config,a);n.set(t.constructor,l)}}else{delete this.handlers;l=t.resolveMiddleware(this.middlewareStack,this.config,a)}if(A){l(t).then(t=>A(null,t.output),t=>A(t)).catch(()=>{})}else{return l(t).then(t=>t.output)}}destroy(){this.config?.requestHandler?.destroy?.();delete this.handlers}}const m="***SensitiveInformation***";function schemaLogFilter(t,n){if(n==null){return n}const i=d.of(t);if(i.getMergedTraits().sensitive){return m}if(i.isListSchema()){const t=!!i.getValueSchema().getMergedTraits().sensitive;if(t){return m}}else if(i.isMapSchema()){const t=!!i.getKeySchema().getMergedTraits().sensitive||!!i.getValueSchema().getMergedTraits().sensitive;if(t){return m}}else if(i.isStructSchema()&&typeof n==="object"){const t=n;const a={};for(const[n,A]of i.structIterator()){if(t[n]!=null){a[n]=schemaLogFilter(A,t[n])}}return a}return n}class Command{middlewareStack=constructStack();schema;static classBuilder(){return new ClassBuilder}resolveMiddlewareWithContext(t,n,i,{middlewareFn:a,clientName:A,commandName:l,inputFilterSensitiveLog:d,outputFilterSensitiveLog:h,smithyContext:f,additionalContext:g,CommandCtor:p}){for(const A of a.bind(this)(p,t,n,i)){this.middlewareStack.use(A)}const m=t.concat(this.middlewareStack);const{logger:E}=n;const C={logger:E,clientName:A,commandName:l,inputFilterSensitiveLog:d,outputFilterSensitiveLog:h,[c]:{commandInstance:this,...f},...g};const{requestHandler:I}=n;let y=i??{};if(f.eventStream){y={isEventStream:true,...y}}return m.resolve(t=>I.handle(t.request,y),C)}}class ClassBuilder{_init=()=>{};_ep={};_middlewareFn=()=>[];_commandName="";_clientName="";_additionalContext={};_smithyContext={};_inputFilterSensitiveLog=undefined;_outputFilterSensitiveLog=undefined;_serializer=null;_deserializer=null;_operationSchema;init(t){this._init=t}ep(t){this._ep=t;return this}m(t){this._middlewareFn=t;return this}s(t,n,i={}){this._smithyContext={service:t,operation:n,...i};return this}c(t={}){this._additionalContext=t;return this}n(t,n){this._clientName=t;this._commandName=n;return this}f(t=t=>t,n=t=>t){this._inputFilterSensitiveLog=t;this._outputFilterSensitiveLog=n;return this}ser(t){this._serializer=t;return this}de(t){this._deserializer=t;return this}sc(t){this._operationSchema=t;this._smithyContext.operationSchema=t;return this}build(){const t=this;let n;return n=class extends Command{input;static getEndpointParameterInstructions(){return t._ep}constructor(...[n]){super();this.input=n??{};t._init(this);this.schema=t._operationSchema}resolveMiddleware(i,a,A){const c=t._operationSchema;const l=c?.[4]??c?.input;const d=c?.[5]??c?.output;return this.resolveMiddlewareWithContext(i,a,A,{CommandCtor:n,middlewareFn:t._middlewareFn,clientName:t._clientName,commandName:t._commandName,inputFilterSensitiveLog:t._inputFilterSensitiveLog??(c?schemaLogFilter.bind(null,l):t=>t),outputFilterSensitiveLog:t._outputFilterSensitiveLog??(c?schemaLogFilter.bind(null,d):t=>t),smithyContext:t._smithyContext,additionalContext:t._additionalContext})}serialize=t._serializer;deserialize=t._deserializer}}}const E="***SensitiveInformation***";const createAggregatedClient=(t,n,i)=>{for(const[i,a]of Object.entries(t)){const methodImpl=async function(t,n,i){const A=new a(t);if(typeof n==="function"){this.send(A,n)}else if(typeof i==="function"){if(typeof n!=="object")throw new Error(`Expected http options but got ${typeof n}`);this.send(A,n||{},i)}else{return this.send(A,n)}};const t=(i[0].toLowerCase()+i.slice(1)).replace(/Command$/,"");n.prototype[t]=methodImpl}const{paginators:a={},waiters:A={}}=i??{};for(const[t,i]of Object.entries(a)){if(n.prototype[t]===void 0){n.prototype[t]=function(t={},n,...a){return i({...n,client:this},t,...a)}}}for(const[t,i]of Object.entries(A)){if(n.prototype[t]===void 0){n.prototype[t]=async function(t={},n,...a){let A=n;if(typeof n==="number"){A={maxWaitTime:n}}return i({...A,client:this},t,...a)}}}};class ServiceException extends Error{$fault;$response;$retryable;$metadata;constructor(t){super(t.message);Object.setPrototypeOf(this,Object.getPrototypeOf(this).constructor.prototype);this.name=t.name;this.$fault=t.$fault;this.$metadata=t.$metadata}static isInstance(t){if(!t)return false;const n=t;return ServiceException.prototype.isPrototypeOf(n)||Boolean(n.$fault)&&Boolean(n.$metadata)&&(n.$fault==="client"||n.$fault==="server")}static[Symbol.hasInstance](t){if(!t)return false;const n=t;if(this===ServiceException){return ServiceException.isInstance(t)}if(ServiceException.isInstance(t)){if(n.name&&this.name){return this.prototype.isPrototypeOf(t)||n.name===this.name}return this.prototype.isPrototypeOf(t)}return false}}const decorateServiceException=(t,n={})=>{Object.entries(n).filter(([,t])=>t!==undefined).forEach(([n,i])=>{if(t[n]==undefined||t[n]===""){t[n]=i}});const i=t.message||t.Message||"UnknownError";t.message=i;delete t.Message;return t};const throwDefaultError=({output:t,parsedBody:n,exceptionCtor:i,errorCode:a})=>{const A=deserializeMetadata(t);const c=A.httpStatusCode?A.httpStatusCode+"":undefined;const l=new i({name:n?.code||n?.Code||a||c||"UnknownError",$fault:"client",$metadata:A});throw decorateServiceException(l,n)};const withBaseException=t=>({output:n,parsedBody:i,errorCode:a})=>{throwDefaultError({output:n,parsedBody:i,exceptionCtor:t,errorCode:a})};const deserializeMetadata=t=>({httpStatusCode:t.statusCode,requestId:t.headers["x-amzn-requestid"]??t.headers["x-amzn-request-id"]??t.headers["x-amz-request-id"],extendedRequestId:t.headers["x-amz-id-2"],cfId:t.headers["x-amz-cf-id"]});const loadConfigsForDefaultMode=t=>{switch(t){case"standard":return{retryMode:"standard",connectionTimeout:3100};case"in-region":return{retryMode:"standard",connectionTimeout:1100};case"cross-region":return{retryMode:"standard",connectionTimeout:3100};case"mobile":return{retryMode:"standard",connectionTimeout:3e4};default:return{}}};let C=false;const emitWarningIfUnsupportedVersion=t=>{if(t&&!C&&parseInt(t.substring(1,t.indexOf(".")))<16){C=true}};const I=Object.values(l);const getChecksumConfiguration=t=>{const n=[];for(const i in l){const a=l[i];if(t[a]===undefined){continue}n.push({algorithmId:()=>a,checksumConstructor:()=>t[a]})}for(const[i,a]of Object.entries(t.checksumAlgorithms??{})){n.push({algorithmId:()=>i,checksumConstructor:()=>a})}return{addChecksumAlgorithm(i){t.checksumAlgorithms=t.checksumAlgorithms??{};const a=i.algorithmId();const A=i.checksumConstructor();if(I.includes(a)){t.checksumAlgorithms[a.toUpperCase()]=A}else{t.checksumAlgorithms[a]=A}n.push(i)},checksumAlgorithms(){return n}}};const resolveChecksumRuntimeConfig=t=>{const n={};t.checksumAlgorithms().forEach(t=>{const i=t.algorithmId();if(I.includes(i)){n[i]=t.checksumConstructor()}});return n};const getRetryConfiguration=t=>({setRetryStrategy(n){t.retryStrategy=n},retryStrategy(){return t.retryStrategy}});const resolveRetryRuntimeConfig=t=>{const n={};n.retryStrategy=t.retryStrategy();return n};const getDefaultExtensionConfiguration=t=>Object.assign(getChecksumConfiguration(t),getRetryConfiguration(t));const y=getDefaultExtensionConfiguration;const resolveDefaultRuntimeConfig=t=>Object.assign(resolveChecksumRuntimeConfig(t),resolveRetryRuntimeConfig(t));const getArrayIfSingleItem=t=>Array.isArray(t)?t:[t];const getValueFromTextNode=t=>{const n="#text";for(const i in t){if(Object.prototype.hasOwnProperty.call(t,i)&&t[i][n]!==undefined){t[i]=t[i][n]}else if(typeof t[i]==="object"&&t[i]!==null){t[i]=getValueFromTextNode(t[i])}}return t};const isSerializableHeaderValue=t=>t!=null;class NoOpLogger{trace(){}debug(){}info(){}warn(){}error(){}}function map(t,n,i){let a;let A;let c;if(typeof n==="undefined"&&typeof i==="undefined"){a={};c=t}else{a=t;if(typeof n==="function"){A=n;c=i;return mapWithFilter(a,A,c)}else{c=n}}for(const t of Object.keys(c)){if(!Array.isArray(c[t])){a[t]=c[t];continue}applyInstruction(a,null,c,t)}return a}const convertMap=t=>{const n={};for(const[i,a]of Object.entries(t||{})){n[i]=[,a]}return n};const take=(t,n)=>{const i={};for(const a in n){applyInstruction(i,t,n,a)}return i};const mapWithFilter=(t,n,i)=>map(t,Object.entries(i).reduce((t,[i,a])=>{if(Array.isArray(a)){t[i]=a}else{if(typeof a==="function"){t[i]=[n,a()]}else{t[i]=[n,a]}}return t},{}));const applyInstruction=(t,n,i,a)=>{if(n!==null){let A=i[a];if(typeof A==="function"){A=[,A]}const[c=nonNullish,l=pass,d=a]=A;if(typeof c==="function"&&c(n[d])||typeof c!=="function"&&!!c){t[a]=l(n[d])}return}let[A,c]=i[a];if(typeof c==="function"){let n;const i=A===undefined&&(n=c())!=null;const l=typeof A==="function"&&!!A(void 0)||typeof A!=="function"&&!!A;if(i){t[a]=n}else if(l){t[a]=c()}}else{const n=A===undefined&&c!=null;const i=typeof A==="function"&&!!A(c)||typeof A!=="function"&&!!A;if(n||i){t[a]=c}}};const nonNullish=t=>t!=null;const pass=t=>t;const serializeFloat=t=>{if(t!==t){return"NaN"}switch(t){case Infinity:return"Infinity";case-Infinity:return"-Infinity";default:return t}};const serializeDateTime=t=>t.toISOString().replace(".000Z","Z");const _json=t=>{if(t==null){return{}}if(Array.isArray(t)){return t.filter(t=>t!=null).map(_json)}if(typeof t==="object"){const n={};for(const i of Object.keys(t)){if(t[i]==null){continue}n[i]=_json(t[i])}return n}return t};function makeBuilder(t,n,i,a){return function makeCommand(A,c,l,d,h={}){const f=Object.assign({},t,A);return Command.classBuilder().ep(f).m(function(t,n,i,A){const l=c.call(this,t,n,i,A);l.unshift(a(i,t.getEndpointParameterInstructions()));return l}).s(n,l,h).n(i,l.charAt(0).toUpperCase()+l.slice(1)+"Command").sc(d).build()}}n.Client=Client;n.Command=Command;n.NoOpLogger=NoOpLogger;n.SENSITIVE_STRING=E;n.ServiceException=ServiceException;n.WaiterState=p;n._json=_json;n.checkExceptions=checkExceptions;n.constructStack=constructStack;n.convertMap=convertMap;n.createAggregatedClient=createAggregatedClient;n.createWaiter=createWaiter;n.decorateServiceException=decorateServiceException;n.emitWarningIfUnsupportedVersion=emitWarningIfUnsupportedVersion;n.getArrayIfSingleItem=getArrayIfSingleItem;n.getChecksumConfiguration=getChecksumConfiguration;n.getDefaultClientConfiguration=y;n.getDefaultExtensionConfiguration=getDefaultExtensionConfiguration;n.getRetryConfiguration=getRetryConfiguration;n.getValueFromTextNode=getValueFromTextNode;n.invalidFunction=invalidFunction;n.invalidProvider=invalidProvider;n.isSerializableHeaderValue=isSerializableHeaderValue;n.loadConfigsForDefaultMode=loadConfigsForDefaultMode;n.makeBuilder=makeBuilder;n.map=map;n.resolveChecksumRuntimeConfig=resolveChecksumRuntimeConfig;n.resolveDefaultRuntimeConfig=resolveDefaultRuntimeConfig;n.resolveRetryRuntimeConfig=resolveRetryRuntimeConfig;n.schemaLogFilter=schemaLogFilter;n.serializeDateTime=serializeDateTime;n.serializeFloat=serializeFloat;n.take=take;n.throwDefaultError=throwDefaultError;n.waiterServiceDefaults=g;n.withBaseException=withBaseException},7291:(t,n,i)=>{const{homedir:a}=i(8161);const{sep:A,join:c}=i(6760);const{createHash:l}=i(7598);const{readFile:d}=i(1455);const{IniSectionType:h}=i(690);const{normalizeProvider:f}=i(2658);const{isValidHostLabel:g}=i(4534);class ProviderError extends Error{name="ProviderError";tryNextLink;constructor(t,n=true){let i;let a=true;if(typeof n==="boolean"){i=undefined;a=n}else if(n!=null&&typeof n==="object"){i=n.logger;a=n.tryNextLink??true}super(t);this.tryNextLink=a;Object.setPrototypeOf(this,ProviderError.prototype);i?.debug?.(`@smithy/property-provider ${a?"->":"(!)"} ${t}`)}static from(t,n=true){return Object.assign(new this(t.message,n),t)}}class CredentialsProviderError extends ProviderError{name="CredentialsProviderError";constructor(t,n=true){super(t,n);Object.setPrototypeOf(this,CredentialsProviderError.prototype)}}class TokenProviderError extends ProviderError{name="TokenProviderError";constructor(t,n=true){super(t,n);Object.setPrototypeOf(this,TokenProviderError.prototype)}}const chain=(...t)=>async()=>{if(t.length===0){throw new ProviderError("No providers in chain")}let n;for(const i of t){try{const t=await i();return t}catch(t){n=t;if(t?.tryNextLink){continue}throw t}}throw n};const fromValue=t=>()=>Promise.resolve(t);const memoize=(t,n,i)=>{let a;let A;let c;let l=false;const coalesceProvider=async()=>{if(!A){A=t()}try{a=await A;c=true;l=false}finally{A=undefined}return a};if(n===undefined){return async t=>{if(!c||t?.forceRefresh){a=await coalesceProvider()}return a}}return async t=>{if(!c||t?.forceRefresh){a=await coalesceProvider()}if(l){return a}if(i&&!i(a)){l=true;return a}if(n(a)){await coalesceProvider();return a}return a}};const booleanSelector=(t,n,i)=>{if(!(n in t))return undefined;if(t[n]==="true")return true;if(t[n]==="false")return false;throw new Error(`Cannot load ${i} "${n}". Expected "true" or "false", got ${t[n]}.`)};const numberSelector=(t,n,i)=>{if(!(n in t))return undefined;const a=parseInt(t[n],10);if(Number.isNaN(a)){throw new TypeError(`Cannot load ${i} '${n}'. Expected number, got '${t[n]}'.`)}return a};var p;(function(t){t["ENV"]="env";t["CONFIG"]="shared config entry"})(p||(p={}));const m={};const getHomeDirCacheKey=()=>{if(process&&process.geteuid){return`${process.geteuid()}`}return"DEFAULT"};const getHomeDir=()=>{const{HOME:t,USERPROFILE:n,HOMEPATH:i,HOMEDRIVE:c=`C:${A}`}=process.env;if(t)return t;if(n)return n;if(i)return`${c}${i}`;const l=getHomeDirCacheKey();if(!m[l])m[l]=a();return m[l]};const E="AWS_PROFILE";const C="default";const getProfileName=t=>t.profile||process.env[E]||C;const getSSOTokenFilepath=t=>{const n=l("sha1");const i=n.update(t).digest("hex");return c(getHomeDir(),".aws","sso","cache",`${i}.json`)};const I={};const getSSOTokenFromFile=async t=>{if(I[t]){return I[t]}const n=getSSOTokenFilepath(t);const i=await d(n,"utf8");return JSON.parse(i)};const y=".";const getConfigData=t=>Object.entries(t).filter(([t])=>{const n=t.indexOf(y);if(n===-1){return false}return Object.values(h).includes(t.substring(0,n))}).reduce((t,[n,i])=>{const a=n.indexOf(y);const A=n.substring(0,a)===h.PROFILE?n.substring(a+1):n;t[A]=i;return t},{...t.default&&{default:t.default}});const B="AWS_CONFIG_FILE";const getConfigFilepath=()=>process.env[B]||c(getHomeDir(),".aws","config");const Q="AWS_SHARED_CREDENTIALS_FILE";const getCredentialsFilepath=()=>process.env[Q]||c(getHomeDir(),".aws","credentials");const w=/^([\w-]+)\s(["'])?([\w-@\+\.%:/]+)\2$/;const S=["__proto__","profile __proto__"];const parseIni=t=>{const n={};let i;let a;for(const A of t.split(/\r?\n/)){const t=A.split(/(^|\s)[;#]/)[0].trim();const c=t[0]==="["&&t[t.length-1]==="]";if(c){i=undefined;a=undefined;const n=t.substring(1,t.length-1);const A=w.exec(n);if(A){const[,t,,n]=A;if(Object.values(h).includes(t)){i=[t,n].join(y)}}else{i=n}if(S.includes(n)){throw new Error(`Found invalid profile name "${n}"`)}}else if(i){const c=t.indexOf("=");if(![0,-1].includes(c)){const[l,d]=[t.substring(0,c).trim(),t.substring(c+1).trim()];if(d===""){a=l}else{if(a&&A.trimStart()===A){a=undefined}n[i]=n[i]||{};const t=a?[a,l].join(y):l;n[i][t]=d}}}}return n};const b={};const R={};const readFile=(t,n)=>{if(R[t]!==undefined){return R[t]}if(!b[t]||n?.ignoreCache){b[t]=d(t,"utf8")}return b[t]};const swallowError$1=()=>({});const loadSharedConfigFiles=async(t={})=>{const{filepath:n=getCredentialsFilepath(),configFilepath:i=getConfigFilepath()}=t;const a=getHomeDir();const A="~/";let l=n;if(n.startsWith(A)){l=c(a,n.slice(2))}let d=i;if(i.startsWith(A)){d=c(a,i.slice(2))}const h=await Promise.all([readFile(d,{ignoreCache:t.ignoreCache}).then(parseIni).then(getConfigData).catch(swallowError$1),readFile(l,{ignoreCache:t.ignoreCache}).then(parseIni).catch(swallowError$1)]);return{configFile:h[0],credentialsFile:h[1]}};const getSsoSessionData=t=>Object.entries(t).filter(([t])=>t.startsWith(h.SSO_SESSION+y)).reduce((t,[n,i])=>({...t,[n.substring(n.indexOf(y)+1)]:i}),{});const swallowError=()=>({});const loadSsoSessionData=async(t={})=>readFile(t.configFilepath??getConfigFilepath()).then(parseIni).then(getSsoSessionData).catch(swallowError);const mergeConfigFiles=(...t)=>{const n={};for(const i of t){for(const[t,a]of Object.entries(i)){if(n[t]!==undefined){Object.assign(n[t],a)}else{n[t]=a}}}return n};const parseKnownFiles=async t=>{const n=await loadSharedConfigFiles(t);return mergeConfigFiles(n.configFile,n.credentialsFile)};const v={getFileRecord(){return R},interceptFile(t,n){R[t]=Promise.resolve(n)},getTokenRecord(){return I},interceptToken(t,n){I[t]=n}};function getSelectorName(t){try{const n=new Set(Array.from(t.match(/([A-Z_]){3,}/g)??[]));n.delete("CONFIG");n.delete("CONFIG_PREFIX_SEPARATOR");n.delete("ENV");return[...n].join(", ")}catch(n){return t}}const fromEnv=(t,n)=>async()=>{try{const i=t(process.env,n);if(i===undefined){throw new Error}return i}catch(i){throw new CredentialsProviderError(i.message||`Not found in ENV: ${getSelectorName(t.toString())}`,{logger:n?.logger})}};const fromSharedConfigFiles=(t,{preferredFile:n="config",...i}={})=>async()=>{const a=getProfileName(i);const{configFile:A,credentialsFile:c}=await loadSharedConfigFiles(i);const l=c[a]||{};const d=A[a]||{};const h=n==="config"?{...l,...d}:{...d,...l};try{const i=n==="config"?A:c;const a=t(h,i);if(a===undefined){throw new Error}return a}catch(n){throw new CredentialsProviderError(n.message||`Not found in config files w/ profile [${a}]: ${getSelectorName(t.toString())}`,{logger:i.logger})}};const isFunction=t=>typeof t==="function";const fromStatic=t=>isFunction(t)?async()=>await t():fromValue(t);const loadConfig=({environmentVariableSelector:t,configFileSelector:n,default:i},a={})=>{const{signingName:A,logger:c}=a;const l={signingName:A,logger:c};return memoize(chain(fromEnv(t,l),fromSharedConfigFiles(n,a),fromStatic(i)))};const k="AWS_USE_DUALSTACK_ENDPOINT";const D="use_dualstack_endpoint";const T=false;const N={environmentVariableSelector:t=>booleanSelector(t,k,p.ENV),configFileSelector:t=>booleanSelector(t,D,p.CONFIG),default:false};const M={environmentVariableSelector:t=>booleanSelector(t,k,p.ENV),configFileSelector:t=>booleanSelector(t,D,p.CONFIG),default:undefined};const F="AWS_USE_FIPS_ENDPOINT";const x="use_fips_endpoint";const U=false;const P={environmentVariableSelector:t=>booleanSelector(t,F,p.ENV),configFileSelector:t=>booleanSelector(t,x,p.CONFIG),default:false};const L={environmentVariableSelector:t=>booleanSelector(t,F,p.ENV),configFileSelector:t=>booleanSelector(t,x,p.CONFIG),default:undefined};const resolveCustomEndpointsConfig=t=>{const{tls:n,endpoint:i,urlParser:a,useDualstackEndpoint:A}=t;return Object.assign(t,{tls:n??true,endpoint:f(typeof i==="string"?a(i):i),isCustomEndpoint:true,useDualstackEndpoint:f(A??false)})};const getEndpointFromRegion=async t=>{const{tls:n=true}=t;const i=await t.region();const a=new RegExp(/^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9])$/);if(!a.test(i)){throw new Error("Invalid region in client config")}const A=await t.useDualstackEndpoint();const c=await t.useFipsEndpoint();const{hostname:l}=await t.regionInfoProvider(i,{useDualstackEndpoint:A,useFipsEndpoint:c})??{};if(!l){throw new Error("Cannot resolve hostname from client config")}return t.urlParser(`${n?"https:":"http:"}//${l}`)};const resolveEndpointsConfig=t=>{const n=f(t.useDualstackEndpoint??false);const{endpoint:i,useFipsEndpoint:a,urlParser:A,tls:c}=t;return Object.assign(t,{tls:c??true,endpoint:i?f(typeof i==="string"?A(i):i):()=>getEndpointFromRegion({...t,useDualstackEndpoint:n,useFipsEndpoint:a}),isCustomEndpoint:!!i,useDualstackEndpoint:n})};const O="AWS_EXECUTION_ENV";const H="AWS_REGION";const $="AWS_DEFAULT_REGION";const G="AWS_EC2_METADATA_DISABLED";const V=["in-region","cross-region","mobile","standard","legacy"];const Y="/latest/meta-data/placement/region";const J="/latest/api/token";const W="x-aws-ec2-metadata-token";const q="x-aws-ec2-metadata-token-ttl-seconds";const j=1e3;const z=6e4;let K=0;const getInstanceMetadataRegion=async()=>{if(process.env[G]){return undefined}if(Date.now(){K=Date.now()+z;return undefined};const resolveImdsEndpoint=()=>{const t=process.env.AWS_EC2_METADATA_SERVICE_ENDPOINT;if(t){const n=new URL(t);return{hostname:n.hostname.replace(/^\[(.+)]$/,"$1"),port:n.port?Number(n.port):undefined}}if(process.env.AWS_EC2_METADATA_SERVICE_ENDPOINT_MODE==="IPv6"){return{hostname:"fd00:ec2::254"}}return{hostname:"169.254.169.254"}};const imdsRequest=async t=>{const{request:n}=i(7067);return new Promise((i,a)=>{const A=n({hostname:t.hostname,port:t.port,path:t.path,method:t.method,headers:t.headers,timeout:j,signal:AbortSignal.timeout(j)});A.on("error",t=>{a(t);A.destroy()});A.on("timeout",()=>{a(new Error("TimeoutError from instance metadata service"));A.destroy()});A.on("response",t=>{const{statusCode:n=400}=t;if(n<200||n>=300){a(Object.assign(new Error("Error response received from instance metadata service"),{statusCode:n}));A.destroy();return}const c=[];t.on("data",t=>c.push(t));t.on("end",()=>{i(Buffer.concat(c));A.destroy()})});A.end()})};const Z="AWS_REGION";const X="region";const ee={environmentVariableSelector:t=>t[Z],configFileSelector:t=>t[X],default:async()=>{const t=await getInstanceMetadataRegion();if(t){return t}throw new Error("Region is missing")}};const te={preferredFile:"credentials"};const re=new Set;const checkRegion=(t,n=g)=>{if(!re.has(t)&&!n(t)){if(t==="*"){console.warn(`@smithy/config-resolver WARN - Please use the caller region instead of "*". See "sigv4a" in https://github.com/aws/aws-sdk-js-v3/blob/main/supplemental-docs/CLIENTS.md.`)}else{throw new Error(`Region not accepted: region="${t}" is not a valid hostname component.`)}}else{re.add(t)}};const isFipsRegion=t=>typeof t==="string"&&(t.startsWith("fips-")||t.endsWith("-fips"));const getRealRegion=t=>isFipsRegion(t)?["fips-aws-global","aws-fips"].includes(t)?"us-east-1":t.replace(/fips-(dkr-|prod-)?|-fips/,""):t;const resolveRegionConfig=t=>{const{region:n,useFipsEndpoint:i}=t;if(!n){throw new Error("Region is missing")}return Object.assign(t,{region:async()=>{const t=typeof n==="function"?await n():n;const i=getRealRegion(t);checkRegion(i);return i},useFipsEndpoint:async()=>{const t=typeof n==="string"?n:await n();if(isFipsRegion(t)){return true}return typeof i!=="function"?Promise.resolve(!!i):i()}})};const getHostnameFromVariants=(t=[],{useFipsEndpoint:n,useDualstackEndpoint:i})=>t.find(({tags:t})=>n===t.includes("fips")&&i===t.includes("dualstack"))?.hostname;const getResolvedHostname=(t,{regionHostname:n,partitionHostname:i})=>n?n:i?i.replace("{region}",t):undefined;const getResolvedPartition=(t,{partitionHash:n})=>Object.keys(n||{}).find(i=>n[i].regions.includes(t))??"aws";const getResolvedSigningRegion=(t,{signingRegion:n,regionRegex:i,useFipsEndpoint:a})=>{if(n){return n}else if(a){const n=i.replace("\\\\","\\").replace(/^\^/g,"\\.").replace(/\$$/g,"\\.");const a=t.match(n);if(a){return a[0].slice(1,-1)}}};const getRegionInfo=(t,{useFipsEndpoint:n=false,useDualstackEndpoint:i=false,signingService:a,regionHash:A,partitionHash:c})=>{const l=getResolvedPartition(t,{partitionHash:c});const d=t in A?t:c[l]?.endpoint??t;const h={useFipsEndpoint:n,useDualstackEndpoint:i};const f=getHostnameFromVariants(A[d]?.variants,h);const g=getHostnameFromVariants(c[l]?.variants,h);const p=getResolvedHostname(d,{regionHostname:f,partitionHostname:g});if(p===undefined){throw new Error(`Endpoint resolution failed for: ${{resolvedRegion:d,useFipsEndpoint:n,useDualstackEndpoint:i}}`)}const m=getResolvedSigningRegion(p,{signingRegion:A[d]?.signingRegion,regionRegex:c[l].regionRegex,useFipsEndpoint:n});return{partition:l,signingService:a,hostname:p,...m&&{signingRegion:m},...A[d]?.signingService&&{signingService:A[d].signingService}}};const ne="AWS_DEFAULTS_MODE";const se="defaults_mode";const oe={environmentVariableSelector:t=>t[ne],configFileSelector:t=>t[se],default:"legacy"};const resolveDefaultsModeConfig=({region:t=loadConfig(ee),defaultsMode:n=loadConfig(oe)}={})=>memoize(async()=>{const i=typeof n==="function"?await n():n;switch(i?.toLowerCase()){case"auto":return resolveNodeDefaultsModeAuto(t);case"in-region":case"cross-region":case"mobile":case"standard":case"legacy":return Promise.resolve(i?.toLocaleLowerCase());case undefined:return Promise.resolve("legacy");default:throw new Error(`Invalid parameter for "defaultsMode", expect ${V.join(", ")}, got ${i}`)}});const resolveNodeDefaultsModeAuto=async t=>{if(t){const n=typeof t==="function"?await t():t;const i=await inferPhysicalRegion();if(!i){return"standard"}if(n===i){return"in-region"}else{return"cross-region"}}return"standard"};const inferPhysicalRegion=async()=>{if(process.env[O]&&(process.env[H]||process.env[$])){return process.env[H]??process.env[$]}return getInstanceMetadataRegion()};n.CONFIG_PREFIX_SEPARATOR=y;n.CONFIG_USE_DUALSTACK_ENDPOINT=D;n.CONFIG_USE_FIPS_ENDPOINT=x;n.CredentialsProviderError=CredentialsProviderError;n.DEFAULT_PROFILE=C;n.DEFAULT_USE_DUALSTACK_ENDPOINT=T;n.DEFAULT_USE_FIPS_ENDPOINT=U;n.ENV_PROFILE=E;n.ENV_USE_DUALSTACK_ENDPOINT=k;n.ENV_USE_FIPS_ENDPOINT=F;n.NODE_REGION_CONFIG_FILE_OPTIONS=te;n.NODE_REGION_CONFIG_OPTIONS=ee;n.NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS=N;n.NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS=P;n.ProviderError=ProviderError;n.REGION_ENV_NAME=Z;n.REGION_INI_NAME=X;n.SelectorType=p;n.TokenProviderError=TokenProviderError;n.booleanSelector=booleanSelector;n.chain=chain;n.externalDataInterceptor=v;n.fromStatic=fromStatic;n.fromValue=fromValue;n.getHomeDir=getHomeDir;n.getProfileName=getProfileName;n.getRegionInfo=getRegionInfo;n.getSSOTokenFilepath=getSSOTokenFilepath;n.getSSOTokenFromFile=getSSOTokenFromFile;n.loadConfig=loadConfig;n.loadSharedConfigFiles=loadSharedConfigFiles;n.loadSsoSessionData=loadSsoSessionData;n.memoize=memoize;n.nodeDualstackConfigSelectors=M;n.nodeFipsConfigSelectors=L;n.numberSelector=numberSelector;n.parseKnownFiles=parseKnownFiles;n.readFile=readFile;n.resolveCustomEndpointsConfig=resolveCustomEndpointsConfig;n.resolveDefaultsModeConfig=resolveDefaultsModeConfig;n.resolveEndpointsConfig=resolveEndpointsConfig;n.resolveRegionConfig=resolveRegionConfig},2085:(t,n,i)=>{const{CONFIG_PREFIX_SEPARATOR:a,loadConfig:A}=i(7291);const{toEndpointV1:c,getSmithyContext:l,normalizeProvider:d,isValidHostLabel:h}=i(4534);n.isValidHostLabel=h;n.middlewareEndpointToEndpointV1=c;n.toEndpointV1=c;const{EndpointURLScheme:f}=i(690);const g="AWS_ENDPOINT_URL";const p="endpoint_url";const getEndpointUrlConfig=t=>({environmentVariableSelector:n=>{const i=t.split(" ").map(t=>t.toUpperCase());const a=n[[g,...i].join("_")];if(a)return a;const A=n[g];if(A)return A;return undefined},configFileSelector:(n,i)=>{if(i&&n.services){const A=i[["services",n.services].join(a)];if(A){const n=t.split(" ").map(t=>t.toLowerCase());const i=A[[n.join("_"),p].join(a)];if(i)return i}}const A=n[p];if(A)return A;return undefined},default:undefined});const getEndpointFromConfig=async t=>A(getEndpointUrlConfig(t??""))();const resolveParamsForS3=async t=>{const n=t?.Bucket||"";if(typeof t.Bucket==="string"){t.Bucket=n.replace(/#/g,encodeURIComponent("#")).replace(/\?/g,encodeURIComponent("?"))}if(isArnBucketName(n)){if(t.ForcePathStyle===true){throw new Error("Path-style addressing cannot be used with ARN buckets")}}else if(!isDnsCompatibleBucketName(n)||n.indexOf(".")!==-1&&!String(t.Endpoint).startsWith("http:")||n.toLowerCase()!==n||n.length<3){t.ForcePathStyle=true}if(t.DisableMultiRegionAccessPoints){t.disableMultiRegionAccessPoints=true;t.DisableMRAP=true}return t};const m=/^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/;const E=/(\d+\.){3}\d+/;const C=/\.\./;const isDnsCompatibleBucketName=t=>m.test(t)&&!E.test(t)&&!C.test(t);const isArnBucketName=t=>{const[n,i,a,,,A]=t.split(":");const c=n==="arn"&&t.split(":").length>=6;const l=Boolean(c&&i&&a&&A);if(c&&!l){throw new Error(`Invalid ARN: ${t} was an invalid ARN.`)}return l};const createConfigValueProvider=(t,n,i,a=false)=>{const configProvider=async()=>{let A;if(a){const a=i.clientContextParams;const c=a?.[t];A=c??i[t]??i[n]}else{A=i[t]??i[n]}if(typeof A==="function"){return A()}return A};if(t==="credentialScope"||n==="CredentialScope"){return async()=>{const t=typeof i.credentials==="function"?await i.credentials():i.credentials;const n=t?.credentialScope??t?.CredentialScope;return n}}if(t==="accountId"||n==="AccountId"){return async()=>{const t=typeof i.credentials==="function"?await i.credentials():i.credentials;const n=t?.accountId??t?.AccountId;return n}}if(t==="endpoint"||n==="endpoint"){return async()=>{if(i.isCustomEndpoint===false){return undefined}const t=await configProvider();if(t&&typeof t==="object"){if("url"in t){return t.url.href}if("hostname"in t){const{protocol:n,hostname:i,port:a,path:A}=t;return`${n}//${i}${a?":"+a:""}${A}`}}return t}}return configProvider};function bindGetEndpointFromInstructions(t){return async(n,i,a,A)=>{if(!a.isCustomEndpoint){let n;if(a.serviceConfiguredEndpoint){n=await a.serviceConfiguredEndpoint()}else{n=await t(a.serviceId)}if(n){a.endpoint=()=>Promise.resolve(c(n));a.isCustomEndpoint=true}}const l=await resolveParams(n,i,a);if(typeof a.endpointProvider!=="function"){throw new Error("config.endpointProvider is not set.")}const d=a.endpointProvider(l,A);if(a.isCustomEndpoint&&a.endpoint){const t=await a.endpoint();if(t?.headers){d.headers??={};for(const[n,i]of Object.entries(t.headers)){d.headers[n]=Array.isArray(i)?i:[i]}}}return d}}const resolveParams=async(t,n,i)=>{const a={};const A=n?.getEndpointParameterInstructions?.()||{};for(const[n,c]of Object.entries(A)){switch(c.type){case"staticContextParams":a[n]=c.value;break;case"contextParams":a[n]=t[c.name];break;case"clientContextParams":case"builtInParams":a[n]=await createConfigValueProvider(c.name,n,i,c.type!=="builtInParams")();break;case"operationContextParams":a[n]=c.get(t);break;default:throw new Error("Unrecognized endpoint parameter instruction: "+JSON.stringify(c))}}if(Object.keys(A).length===0){Object.assign(a,i)}if(String(i.serviceId).toLowerCase()==="s3"){await resolveParamsForS3(a)}return a};function setFeature(t,n,i){if(!t.__smithy_context){t.__smithy_context={features:{}}}else if(!t.__smithy_context.features){t.__smithy_context.features={}}t.__smithy_context.features[n]=i}function bindEndpointMiddleware(t){const n=bindGetEndpointFromInstructions(t);return({config:t,instructions:i})=>(a,A)=>async c=>{if(t.isCustomEndpoint){setFeature(A,"ENDPOINT_OVERRIDE","N")}const d=await n(c.input,{getEndpointParameterInstructions(){return i}},{...t},A);A.endpointV2=d;A.authSchemes=d.properties?.authSchemes;const h=A.authSchemes?.[0];if(h){A["signing_region"]=h.signingRegion;A["signing_service"]=h.signingName;const t=l(A);const n=t?.selectedHttpAuthScheme?.httpAuthOption;if(n){n.signingProperties=Object.assign(n.signingProperties||{},{signing_region:h.signingRegion,signingRegion:h.signingRegion,signing_service:h.signingName,signingName:h.signingName,signingRegionSet:h.signingRegionSet},h.properties)}}return a({...c})}}const I={name:"serializerMiddleware"};const y={step:"serialize",tags:["ENDPOINT_PARAMETERS","ENDPOINT_V2","ENDPOINT"],name:"endpointV2Middleware",override:true,relation:"before",toMiddleware:I.name};function bindGetEndpointPlugin(t){const n=bindEndpointMiddleware(t);return(t,i)=>({applyToStack:a=>{a.addRelativeTo(n({config:t,instructions:i}),y)}})}function bindResolveEndpointConfig(t){return n=>{const i=n.tls??true;const{endpoint:a,useDualstackEndpoint:A,useFipsEndpoint:l}=n;const h=a!=null?async()=>c(await d(a)()):undefined;const f=!!a;const g=Object.assign(n,{endpoint:h,tls:i,isCustomEndpoint:f,useDualstackEndpoint:d(A??false),useFipsEndpoint:d(l??false)});let p=undefined;g.serviceConfiguredEndpoint=async()=>{if(n.serviceId&&!p){p=t(n.serviceId)}return p};return g}}class BinaryDecisionDiagram{nodes;root;conditions;results;constructor(t,n,i,a){this.nodes=t;this.root=n;this.conditions=i;this.results=a}static from(t,n,i,a){return new BinaryDecisionDiagram(t,n,i,a)}}class EndpointCache{capacity;data=new Map;parameters=[];constructor({size:t,params:n}){this.capacity=t??50;if(n){this.parameters=n}}get(t,n){const i=this.hash(t);if(i===false){return n()}if(!this.data.has(i)){if(this.data.size>this.capacity+10){const t=this.data.keys();let n=0;while(true){const{value:i,done:a}=t.next();this.data.delete(i);if(a||++n>10){break}}}this.data.set(i,n())}return this.data.get(i)}size(){return this.data.size}hash(t){let n="";const{parameters:i}=this;if(i.length===0){return false}for(const a of i){const i=String(t[a]??"");if(i.includes("|;")){return false}n+=i+"|;"}return n}}class EndpointError extends Error{constructor(t){super(t);this.name="EndpointError"}}const B="endpoints";function toDebugString(t){if(typeof t!=="object"||t==null){return t}if("ref"in t){return`$${toDebugString(t.ref)}`}if("fn"in t){return`${t.fn}(${(t.argv||[]).map(toDebugString).join(", ")})`}return JSON.stringify(t,null,2)}const Q={};const booleanEquals=(t,n)=>t===n;function coalesce(...t){for(const n of t){if(n!=null){return n}}return undefined}const getAttrPathList=t=>{const n=t.split(".");const i=[];for(const a of n){const n=a.indexOf("[");if(n!==-1){if(a.indexOf("]")!==a.length-1){throw new EndpointError(`Path: '${t}' does not end with ']'`)}const A=a.slice(n+1,-1);if(Number.isNaN(parseInt(A))){throw new EndpointError(`Invalid array index: '${A}' in path: '${t}'`)}if(n!==0){i.push(a.slice(0,n))}i.push(A)}else{i.push(a)}}return i};const getAttr=(t,n)=>getAttrPathList(n).reduce((i,a)=>{if(typeof i!=="object"){throw new EndpointError(`Index '${a}' in '${n}' not found in '${JSON.stringify(t)}'`)}else if(Array.isArray(i)){const t=parseInt(a);return i[t<0?i.length+t:t]}return i[a]},t);const isSet=t=>t!=null;function ite(t,n,i){return t?n:i}const not=t=>!t;const w=new RegExp(`^(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}$`);const isIpAddress=t=>w.test(t)||t.startsWith("[")&&t.endsWith("]");const S={[f.HTTP]:80,[f.HTTPS]:443};const parseURL=t=>{const n=(()=>{try{if(t instanceof URL){return t}if(typeof t==="object"&&"hostname"in t){const{hostname:n,port:i,protocol:a="",path:A="",query:c={}}=t;const l=new URL(`${a}//${n}${i?`:${i}`:""}${A}`);l.search=Object.entries(c).map(([t,n])=>`${t}=${n}`).join("&");return l}return new URL(t)}catch(t){return null}})();if(!n){console.error(`Unable to parse ${JSON.stringify(t)} as a whatwg URL.`);return null}const i=n.href;const{host:a,hostname:A,pathname:c,protocol:l,search:d}=n;if(d){return null}const h=l.slice(0,-1);if(!Object.values(f).includes(h)){return null}const g=isIpAddress(A);const p=i.includes(`${a}:${S[h]}`)||typeof t==="string"&&t.includes(`${a}:${S[h]}`);const m=`${a}${p?`:${S[h]}`:``}`;return{scheme:h,authority:m,path:c,normalizedPath:c.endsWith("/")?c:`${c}/`,isIp:g}};function split(t,n,i){if(i===1){return[t]}if(t===""){return[""]}const a=t.split(n);if(i===0){return a}return a.slice(0,i-1).concat(a.slice(1).join(n))}const stringEquals=(t,n)=>t===n;const substring=(t,n,i,a)=>{if(t==null||n>=i||t.lengthencodeURIComponent(t).replace(/[!*'()]/g,t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`);const b={booleanEquals:booleanEquals,coalesce:coalesce,getAttr:getAttr,isSet:isSet,isValidHostLabel:h,ite:ite,not:not,parseURL:parseURL,split:split,stringEquals:stringEquals,substring:substring,uriEncode:uriEncode};const evaluateTemplate=(t,n)=>{const i=[];const{referenceRecord:a,endpointParams:A}=n;let c=0;while(cn.referenceRecord[t]??n.endpointParams[t];const evaluateExpression=(t,n,i)=>{if(typeof t==="string"){return evaluateTemplate(t,i)}else if(t["fn"]){return R.callFunction(t,i)}else if(t["ref"]){return getReferenceValue(t,i)}throw new EndpointError(`'${n}': ${String(t)} is not a string, function or reference.`)};const callFunction=({fn:t,argv:n},i)=>{const a=Array(n.length);for(let t=0;t{const{assign:i}=t;if(i&&i in n.referenceRecord){throw new EndpointError(`'${i}' is already defined in Reference Record.`)}const a=callFunction(t,n);n.logger?.debug?.(`${B} evaluateCondition: ${toDebugString(t)} = ${toDebugString(a)}`);const A=a===""?true:!!a;if(i!=null){return{result:A,toAssign:{name:i,value:a}}}return{result:A}};const getEndpointHeaders=(t,n)=>Object.entries(t??{}).reduce((t,[i,a])=>{t[i]=a.map(t=>{const a=evaluateExpression(t,"Header value entry",n);if(typeof a!=="string"){throw new EndpointError(`Header '${i}' value '${a}' is not a string`)}return a});return t},{});const getEndpointProperties=(t,n)=>Object.entries(t).reduce((t,[i,a])=>{t[i]=v.getEndpointProperty(a,n);return t},{});const getEndpointProperty=(t,n)=>{if(Array.isArray(t)){return t.map(t=>getEndpointProperty(t,n))}switch(typeof t){case"string":return evaluateTemplate(t,n);case"object":if(t===null){throw new EndpointError(`Unexpected endpoint property: ${t}`)}return v.getEndpointProperties(t,n);case"boolean":return t;default:throw new EndpointError(`Unexpected endpoint property type: ${typeof t}`)}};const v={getEndpointProperty:getEndpointProperty,getEndpointProperties:getEndpointProperties};const getEndpointUrl=(t,n)=>{const i=evaluateExpression(t,"Endpoint URL",n);if(typeof i==="string"){try{return new URL(i)}catch(t){console.error(`Failed to construct URL with ${i}`,t);throw t}}throw new EndpointError(`Endpoint URL must be a string, got ${typeof i}`)};const k=1e8;const decideEndpoint=(t,n)=>{const{nodes:i,root:a,results:A,conditions:c}=t;let l=a;const d={};const h={referenceRecord:d,endpointParams:n.endpointParams,logger:n.logger};while(l!==1&&l!==-1&&l=0===m.result?a:A}if(l>=k){const t=A[l-k];if(t[0]===-1){const[,n]=t;throw new EndpointError(evaluateExpression(n,"Error",h))}const[n,i,a]=t;return{url:getEndpointUrl(n,h),properties:getEndpointProperties(i,h),headers:getEndpointHeaders(a??{},h)}}throw new EndpointError(`No matching endpoint.`)};const evaluateConditions=(t=[],n)=>{const i={};const a={...n,referenceRecord:{...n.referenceRecord}};let A=false;for(const c of t){const{result:t,toAssign:l}=evaluateCondition(c,a);if(!t){return{result:t}}if(l){A=true;i[l.name]=l.value;a.referenceRecord[l.name]=l.value;n.logger?.debug?.(`${B} assign: ${l.name} := ${toDebugString(l.value)}`)}}if(A){return{result:true,referenceRecord:i}}return{result:true}};const evaluateEndpointRule=(t,n)=>{const{conditions:i,endpoint:a}=t;const{result:A,referenceRecord:c}=evaluateConditions(i,n);if(!A){return}const l=c?{...n,referenceRecord:{...n.referenceRecord,...c}}:n;const{url:d,properties:h,headers:f}=a;n.logger?.debug?.(`${B} Resolving endpoint from template: ${toDebugString(a)}`);const g={url:getEndpointUrl(d,l)};if(f!=null){g.headers=getEndpointHeaders(f,l)}if(h!=null){g.properties=getEndpointProperties(h,l)}return g};const evaluateErrorRule=(t,n)=>{const{conditions:i,error:a}=t;const{result:A,referenceRecord:c}=evaluateConditions(i,n);if(!A){return}const l=c?{...n,referenceRecord:{...n.referenceRecord,...c}}:n;throw new EndpointError(evaluateExpression(a,"Error",l))};const evaluateRules=(t,n)=>{for(const i of t){if(i.type==="endpoint"){const t=evaluateEndpointRule(i,n);if(t){return t}}else if(i.type==="error"){evaluateErrorRule(i,n)}else if(i.type==="tree"){const t=D.evaluateTreeRule(i,n);if(t){return t}}else{throw new EndpointError(`Unknown endpoint rule: ${i}`)}}throw new EndpointError(`Rules evaluation failed`)};const evaluateTreeRule=(t,n)=>{const{conditions:i,rules:a}=t;const{result:A,referenceRecord:c}=evaluateConditions(i,n);if(!A){return}const l=c?{...n,referenceRecord:{...n.referenceRecord,...c}}:n;return D.evaluateRules(a,l)};const D={evaluateRules:evaluateRules,evaluateTreeRule:evaluateTreeRule};const resolveEndpoint=(t,n)=>{const{endpointParams:i,logger:a}=n;const{parameters:A,rules:c}=t;n.logger?.debug?.(`${B} Initial EndpointParams: ${toDebugString(i)}`);for(const t in A){const n=A[t];const a=i[t];if(a==null&&n.default!=null){i[t]=n.default;continue}if(n.required&&a==null){throw new EndpointError(`Missing required parameter: '${t}'`)}}const l=evaluateRules(c,{endpointParams:i,logger:a,referenceRecord:{}});n.logger?.debug?.(`${B} Resolved endpoint: ${toDebugString(l)}`);return l};const resolveEndpointRequiredConfig=t=>{const{endpoint:n}=t;if(n===undefined){t.endpoint=async()=>{throw new Error("@smithy/middleware-endpoint: (default endpointRuleSet) endpoint is not set - you must configure an endpoint.")}}return t};const T=bindGetEndpointFromInstructions(getEndpointFromConfig);const N=bindResolveEndpointConfig(getEndpointFromConfig);const M=bindEndpointMiddleware(getEndpointFromConfig);const F=bindGetEndpointPlugin(getEndpointFromConfig);n.BinaryDecisionDiagram=BinaryDecisionDiagram;n.EndpointCache=EndpointCache;n.EndpointError=EndpointError;n.customEndpointFunctions=Q;n.decideEndpoint=decideEndpoint;n.endpointMiddleware=M;n.endpointMiddlewareOptions=y;n.getEndpointFromInstructions=T;n.getEndpointPlugin=F;n.isIpAddress=isIpAddress;n.resolveEndpoint=resolveEndpoint;n.resolveEndpointConfig=N;n.resolveEndpointRequiredConfig=resolveEndpointRequiredConfig;n.resolveParams=resolveParams},6579:(t,n,i)=>{const{Crc32:a}=i(9542);const{toHex:A,fromHex:c,toUtf8:l,fromUtf8:d}=i(2430);const{Readable:h}=i(7075);class Int64{bytes;constructor(t){this.bytes=t;if(t.byteLength!==8){throw new Error("Int64 buffers must be exactly 8 bytes")}}static fromNumber(t){if(t>0x8000000000000000||t<-0x8000000000000000){throw new Error(`${t} is too large (or, if negative, too small) to represent as an Int64`)}const n=new Uint8Array(8);for(let i=7,a=Math.abs(Math.round(t));i>-1&&a>0;i--,a/=256){n[i]=a}if(t<0){negate(n)}return new Int64(n)}valueOf(){const t=this.bytes.slice(0);const n=t[0]&128;if(n){negate(t)}return parseInt(A(t),16)*(n?-1:1)}toString(){return String(this.valueOf())}}function negate(t){for(let n=0;n<8;n++){t[n]^=255}for(let n=7;n>-1;n--){t[n]++;if(t[n]!==0)break}}class HeaderMarshaller{toUtf8;fromUtf8;constructor(t,n){this.toUtf8=t;this.fromUtf8=n}format(t){const n=[];for(const i of Object.keys(t)){const a=this.fromUtf8(i);n.push(Uint8Array.from([a.byteLength]),a,this.formatHeaderValue(t[i]))}const i=new Uint8Array(n.reduce((t,n)=>t+n.byteLength,0));let a=0;for(const t of n){i.set(t,a);a+=t.byteLength}return i}formatHeaderValue(t){switch(t.type){case"boolean":return Uint8Array.from([t.value?0:1]);case"byte":return Uint8Array.from([2,t.value]);case"short":const n=new DataView(new ArrayBuffer(3));n.setUint8(0,3);n.setInt16(1,t.value,false);return new Uint8Array(n.buffer);case"integer":const i=new DataView(new ArrayBuffer(5));i.setUint8(0,4);i.setInt32(1,t.value,false);return new Uint8Array(i.buffer);case"long":const a=new Uint8Array(9);a[0]=5;a.set(t.value.bytes,1);return a;case"binary":const A=new DataView(new ArrayBuffer(3+t.value.byteLength));A.setUint8(0,6);A.setUint16(1,t.value.byteLength,false);const l=new Uint8Array(A.buffer);l.set(t.value,3);return l;case"string":const d=this.fromUtf8(t.value);const h=new DataView(new ArrayBuffer(3+d.byteLength));h.setUint8(0,7);h.setUint16(1,d.byteLength,false);const f=new Uint8Array(h.buffer);f.set(d,3);return f;case"timestamp":const g=new Uint8Array(9);g[0]=8;g.set(Int64.fromNumber(t.value.valueOf()).bytes,1);return g;case"uuid":if(!w.test(t.value)){throw new Error(`Invalid UUID received: ${t.value}`)}const p=new Uint8Array(17);p[0]=9;p.set(c(t.value.replace(/\-/g,"")),1);return p}}parse(t){const n={};let i=0;while(i{if(typeof t!=="number"){throw new Error("Attempted to allocate an event message where size was not a number: "+t)}n=t;i=4;a=new Uint8Array(t);const A=new DataView(a.buffer);A.setUint32(0,t,false)};const iterator=async function*(){const c=t[Symbol.asyncIterator]();while(true){const{value:t,done:l}=await c.next();if(l){if(!n){return}else if(n===i){yield a}else{throw new Error("Truncated event message received.")}return}const d=t.length;let h=0;while(hnew k(t);class EventStreamMarshaller{universalMarshaller;constructor({utf8Encoder:t,utf8Decoder:n}){this.universalMarshaller=new k({utf8Decoder:n,utf8Encoder:t})}deserialize(t,n){const i=typeof t[Symbol.asyncIterator]==="function"?t:readableToIterable(t);return this.universalMarshaller.deserialize(i,n)}serialize(t,n){return h.from(this.universalMarshaller.serialize(t,n))}}const eventStreamSerdeProvider=t=>new EventStreamMarshaller(t);async function*readableToIterable(t){let n=false;let i=false;const a=new Array;t.on("error",t=>{if(!n){n=true}if(t){throw t}});t.on("data",t=>{a.push(t)});t.on("end",()=>{n=true});while(!i){const t=await new Promise(t=>setTimeout(()=>t(a.shift()),0));if(t){yield t}i=n&&a.length===0}}const readableStreamToIterable=t=>({[Symbol.asyncIterator]:async function*(){const n=t.getReader();try{while(true){const{done:t,value:i}=await n.read();if(t)return;yield i}}finally{n.releaseLock()}}});const iterableToReadableStream=t=>{const n=t[Symbol.asyncIterator]();return new ReadableStream({async pull(t){const{done:i,value:a}=await n.next();if(i){return t.close()}t.enqueue(a)}})};const resolveEventStreamSerdeConfig=t=>Object.assign(t,{eventStreamMarshaller:t.eventStreamSerdeProvider(t)});class EventStreamSerde{marshaller;serializer;deserializer;serdeContext;defaultContentType;constructor({marshaller:t,serializer:n,deserializer:i,serdeContext:a,defaultContentType:A}){this.marshaller=t;this.serializer=n;this.deserializer=i;this.serdeContext=a;this.defaultContentType=A}async serializeEventStream({eventStream:t,requestSchema:n,initialRequest:i}){const a=this.marshaller;const A=n.getEventStreamMember();const c=n.getMemberSchema(A);const l=this.serializer;const d=this.defaultContentType;const h=Symbol("initialRequestMarker");const f={async*[Symbol.asyncIterator](){if(i){const t={":event-type":{type:"string",value:"initial-request"},":message-type":{type:"string",value:"event"},":content-type":{type:"string",value:d}};l.write(n,i);const a=l.flush();yield{[h]:true,headers:t,body:a}}for await(const n of t){yield n}}};return a.serialize(f,t=>{if(t[h]){return{headers:t.headers,body:t.body}}let n="";for(const i in t){if(i!=="__type"){n=i;break}}const{additionalHeaders:i,body:a,eventType:A,explicitPayloadContentType:l}=this.writeEventBody(n,c,t);const f={":event-type":{type:"string",value:A},":message-type":{type:"string",value:"event"},":content-type":{type:"string",value:l??d},...i};return{headers:f,body:a}})}async deserializeEventStream({response:t,responseSchema:n,initialResponseContainer:i}){const a=this.marshaller;const A=n.getEventStreamMember();const c=n.getMemberSchema(A);const d=c.getMemberSchemas();const h=Symbol("initialResponseMarker");const f=a.deserialize(t.body,async t=>{let i="";for(const n in t){if(n!=="__type"){i=n;break}}const a=t[i].body;if(i==="initial-response"){const t=await this.deserializer.read(n,a);delete t[A];return{[h]:true,...t}}else if(i in d){const n=d[i];if(n.isStructSchema()){const A={};let c=false;for(const[d,h]of n.structIterator()){const{eventHeader:n,eventPayload:f}=h.getMergedTraits();c=c||Boolean(n||f);if(f){if(h.isBlobSchema()){A[d]=a}else if(h.isStringSchema()){A[d]=(this.serdeContext?.utf8Encoder??l)(a)}else if(h.isStructSchema()){A[d]=await this.deserializer.read(h,a)}}else if(n){const n=t[i].headers[d]?.value;if(n!=null){if(h.isNumericSchema()){if(n&&typeof n==="object"&&"bytes"in n){A[d]=BigInt(n.toString())}else{A[d]=Number(n)}}else{A[d]=n}}}}if(c){return{[i]:A}}if(a.byteLength===0){return{[i]:{}}}}return{[i]:await this.deserializer.read(n,a)}}else{return{$unknown:t}}});const g=f[Symbol.asyncIterator]();const p=await g.next();if(p.done){return f}if(p.value?.[h]){if(!n){throw new Error("@smithy::core/protocols - initial-response event encountered in event stream but no response schema given.")}for(const t in p.value){i[t]=p.value[t]}}return{async*[Symbol.asyncIterator](){if(!p?.value?.[h]){yield p.value}while(true){const{done:t,value:n}=await g.next();if(t){break}yield n}}}}writeEventBody(t,n,i){const a=this.serializer;let A=t;let c=null;let l;const h=(()=>{const i=n.getSchema();return i[4].includes(t)})();const f={};if(!h){const[n,c]=i[t];A=n;a.write(15,c)}else{const A=n.getMemberSchema(t);if(A.isStructSchema()){for(const[n,a]of A.structIterator()){const{eventHeader:A,eventPayload:l}=a.getMergedTraits();if(l){c=n}else if(A){const A=i[t][n];let c="binary";if(a.isNumericSchema()){if((-2)**31<=A&&A<=2**31-1){c="integer"}else{c="long"}}else if(a.isTimestampSchema()){c="timestamp"}else if(a.isStringSchema()){c="string"}else if(a.isBooleanSchema()){c="boolean"}if(A!=null){f[n]={type:c,value:A};delete i[t][n]}}}if(c!==null){const n=A.getMemberSchema(c);if(n.isBlobSchema()){l="application/octet-stream"}else if(n.isStringSchema()){l="text/plain"}a.write(n,i[t][c])}else{a.write(A,i[t])}}else if(A.isUnitSchema()){a.write(A,{})}else{throw new Error("@smithy/core/event-streams - non-struct member not supported in event stream union.")}}const g=a.flush()??new Uint8Array;const p=typeof g==="string"?(this.serdeContext?.utf8Decoder??d)(g):g;return{body:p,eventType:A,explicitPayloadContentType:l,additionalHeaders:f}}}n.EventStreamCodec=EventStreamCodec;n.EventStreamMarshaller=EventStreamMarshaller;n.EventStreamSerde=EventStreamSerde;n.HeaderMarshaller=HeaderMarshaller;n.Int64=Int64;n.MessageDecoderStream=MessageDecoderStream;n.MessageEncoderStream=MessageEncoderStream;n.SmithyMessageDecoderStream=SmithyMessageDecoderStream;n.SmithyMessageEncoderStream=SmithyMessageEncoderStream;n.UniversalEventStreamMarshaller=k;n.eventStreamSerdeProvider=eventStreamSerdeProvider;n.getChunkedStream=getChunkedStream;n.getMessageUnmarshaller=getMessageUnmarshaller;n.getUnmarshalledStream=getUnmarshalledStream;n.iterableToReadableStream=iterableToReadableStream;n.readableStreamToIterable=readableStreamToIterable;n.resolveEventStreamSerdeConfig=resolveEventStreamSerdeConfig;n.universalEventStreamSerdeProvider=eventStreamSerdeProvider$1},3422:(t,n,i)=>{const{Uint8ArrayBlobAdapter:a,sdkStreamMixin:A,splitEvery:c,splitHeader:l,fromBase64:d,_parseEpochTimestamp:h,_parseRfc7231DateTime:f,_parseRfc3339DateTimeWithOffset:g,LazyJsonString:p,NumericValue:m,toUtf8:E,fromUtf8:C,generateIdempotencyToken:I,toBase64:y,dateToUtcString:B,quoteHeader:Q}=i(2430);const{TypeRegistry:w,NormalizedSchema:S,translateTraits:b}=i(6890);const{HttpRequest:R,HttpResponse:v,isValidHostname:k}=i(4534);const{parseQueryString:D,parseUrl:T}=i(4534);n.HttpRequest=R;n.HttpResponse=v;n.isValidHostname=k;n.parseQueryString=D;n.parseUrl=T;const{FieldPosition:N}=i(690);const collectBody=async(t=new Uint8Array,n)=>{if(t instanceof Uint8Array){return a.mutate(t)}if(!t){return a.mutate(new Uint8Array)}const i=n.streamCollector(t);return a.mutate(await i)};function extendedEncodeURIComponent(t){return encodeURIComponent(t).replace(/[!'()*]/g,function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()})}class SerdeContext{serdeContext;setSerdeContext(t){this.serdeContext=t}}class HttpProtocol extends SerdeContext{options;compositeErrorRegistry;constructor(t){super();this.options=t;this.compositeErrorRegistry=w.for(t.defaultNamespace);for(const n of t.errorTypeRegistries??[]){this.compositeErrorRegistry.copyFrom(n)}}getRequestType(){return R}getResponseType(){return v}setSerdeContext(t){this.serdeContext=t;this.serializer.setSerdeContext(t);this.deserializer.setSerdeContext(t);if(this.getPayloadCodec()){this.getPayloadCodec().setSerdeContext(t)}}updateServiceEndpoint(t,n){if("url"in n){t.protocol=n.url.protocol;t.hostname=n.url.hostname;t.port=n.url.port?Number(n.url.port):undefined;t.path=n.url.pathname;t.fragment=n.url.hash||void 0;t.username=n.url.username||void 0;t.password=n.url.password||void 0;if(!t.query){t.query={}}for(const[i,a]of n.url.searchParams.entries()){t.query[i]=a}if(n.headers){for(const i in n.headers){t.headers[i]=n.headers[i].join(", ")}}return t}else{t.protocol=n.protocol;t.hostname=n.hostname;t.port=n.port?Number(n.port):undefined;t.path=n.path;t.query={...n.query};if(n.headers){for(const i in n.headers){t.headers[i]=n.headers[i]}}return t}}setHostPrefix(t,n,i){if(this.serdeContext?.disableHostPrefix){return}const a=S.of(n.input);const A=b(n.traits??{});if(A.endpoint){let n=A.endpoint?.[0];if(typeof n==="string"){for(const[t,A]of a.structIterator()){if(!A.getMergedTraits().hostLabel){continue}const a=i[t];if(typeof a!=="string"){throw new Error(`@smithy/core/schema - ${t} in input must be a string as hostLabel.`)}n=n.replace(`{${t}}`,a)}t.hostname=n+t.hostname;if(!k(t.hostname)){throw new Error(`[${t.hostname}] is not a valid hostname.`)}}}}deserializeMetadata(t){return{httpStatusCode:t.statusCode,requestId:t.headers["x-amzn-requestid"]??t.headers["x-amzn-request-id"]??t.headers["x-amz-request-id"],extendedRequestId:t.headers["x-amz-id-2"],cfId:t.headers["x-amz-cf-id"]}}async serializeEventStream({eventStream:t,requestSchema:n,initialRequest:i}){const a=await this.loadEventStreamCapability();return a.serializeEventStream({eventStream:t,requestSchema:n,initialRequest:i})}async deserializeEventStream({response:t,responseSchema:n,initialResponseContainer:i}){const a=await this.loadEventStreamCapability();return a.deserializeEventStream({response:t,responseSchema:n,initialResponseContainer:i})}async loadEventStreamCapability(){const{EventStreamSerde:t,eventStreamSerdeProvider:n}=i(6579);const a=this.resolveEventStreamMarshaller(n);return new t({marshaller:a,serializer:this.serializer,deserializer:this.deserializer,serdeContext:this.serdeContext,defaultContentType:this.getDefaultContentType()})}resolveEventStreamMarshaller(t){const n=this.serdeContext;if(n.eventStreamMarshaller){return n.eventStreamMarshaller}return t(this.serdeContext)}getDefaultContentType(){throw new Error(`@smithy/core/protocols - ${this.constructor.name} getDefaultContentType() implementation missing.`)}async deserializeHttpMessage(t,n,i,a,A){return[]}getEventStreamMarshaller(){const t=this.serdeContext;if(!t.eventStreamMarshaller){throw new Error("@smithy/core - HttpProtocol: eventStreamMarshaller missing in serdeContext.")}return t.eventStreamMarshaller}}class HttpBindingProtocol extends HttpProtocol{async serializeRequest(t,n,i){const a=n&&typeof n==="object"?n:{};const A=this.serializer;const c={};const l={};const d=await i.endpoint();const h=S.of(t?.input);const f=[];const g=[];let p=false;let m;const E=new R({protocol:"",hostname:"",port:undefined,path:"",fragment:undefined,query:c,headers:l,body:undefined});if(d){this.updateServiceEndpoint(E,d);this.setHostPrefix(E,t,a);const n=b(t.traits);if(n.http){E.method=n.http[0];const[t,i]=n.http[1].split("?");if(E.path=="/"){E.path=t}else{E.path+=t}const a=new URLSearchParams(i??"");for(const[t,n]of a){c[t]=n}}}for(const[t,n]of h.structIterator()){const i=n.getMergedTraits()??{};const d=a[t];if(d==null&&!n.isIdempotencyToken()){if(i.httpLabel){if(E.path.includes(`{${t}+}`)||E.path.includes(`{${t}}`)){throw new Error(`No value provided for input HTTP label: ${t}.`)}}continue}if(i.httpPayload){const i=n.isStreaming();if(i){const i=n.isStructSchema();if(i){if(a[t]){m=await this.serializeEventStream({eventStream:a[t],requestSchema:h})}}else{m=d}}else{A.write(n,d);m=A.flush()}}else if(i.httpLabel){A.write(n,d);const i=A.flush();if(E.path.includes(`{${t}+}`)){E.path=E.path.replace(`{${t}+}`,i.split("/").map(extendedEncodeURIComponent).join("/"))}else if(E.path.includes(`{${t}}`)){E.path=E.path.replace(`{${t}}`,extendedEncodeURIComponent(i))}}else if(i.httpHeader){A.write(n,d);l[i.httpHeader.toLowerCase()]=String(A.flush())}else if(typeof i.httpPrefixHeaders==="string"){for(const t in d){const a=d[t];const c=i.httpPrefixHeaders+t;A.write([n.getValueSchema(),{httpHeader:c}],a);l[c.toLowerCase()]=A.flush()}}else if(i.httpQuery||i.httpQueryParams){this.serializeQuery(n,d,c)}else{p=true;f.push(t);g.push(n)}}if(p&&a){const[t,n]=(h.getName(true)??"#Unknown").split("#");const i=h.getSchema()[6];const c=[3,t,n,h.getMergedTraits(),f,g,undefined];if(i){c[6]=i}else{c.pop()}A.write(c,a);m=A.flush()}E.headers=l;E.query=c;E.body=m;return E}serializeQuery(t,n,i){const a=this.serializer;const A=t.getMergedTraits();if(A.httpQueryParams){for(const a in n){if(!(a in i)){const c=n[a];const l=t.getValueSchema();Object.assign(l.getMergedTraits(),{...A,httpQuery:a,httpQueryParams:undefined});this.serializeQuery(l,c,i)}}return}if(t.isListSchema()){const c=!!t.getMergedTraits().sparse;const l=[];for(const i of n){a.write([t.getValueSchema(),A],i);const n=a.flush();if(c||n!==undefined){l.push(n)}}i[A.httpQuery]=l}else{a.write([t,A],n);i[A.httpQuery]=a.flush()}}async deserializeResponse(t,n,i){const a=this.deserializer;const A=S.of(t.output);const c={};if(i.statusCode>=300){const A=await collectBody(i.body,n);if(A.byteLength>0){Object.assign(c,await a.read(15,A))}await this.handleError(t,n,i,c,this.deserializeMetadata(i));throw new Error("@smithy/core/protocols - HTTP Protocol error handler failed to throw.")}for(const t in i.headers){const n=i.headers[t];delete i.headers[t];i.headers[t.toLowerCase()]=n}const l=await this.deserializeHttpMessage(A,n,i,c);if(l.length){const t=await collectBody(i.body,n);if(t.byteLength>0){const n=await a.read(A,t);for(const t of l){if(n[t]!=null){c[t]=n[t]}}}}else if(l.discardResponseBody){await collectBody(i.body,n)}c.$metadata=this.deserializeMetadata(i);return c}async deserializeHttpMessage(t,n,i,a,d){let h;if(a instanceof Set){h=d}else{h=a}let f=true;const g=this.deserializer;const p=S.of(t);const m=[];for(const[t,a]of p.structIterator()){const d=a.getMemberTraits();if(d.httpPayload){f=false;const c=a.isStreaming();if(c){const n=a.isStructSchema();if(n){h[t]=await this.deserializeEventStream({response:i,responseSchema:p})}else{h[t]=A(i.body)}}else if(i.body){const A=await collectBody(i.body,n);if(A.byteLength>0){h[t]=await g.read(a,A)}}}else if(d.httpHeader){const n=String(d.httpHeader).toLowerCase();const A=i.headers[n];if(null!=A){if(a.isListSchema()){const i=a.getValueSchema();i.getMergedTraits().httpHeader=n;let d;if(i.isTimestampSchema()&&i.getSchema()===4){d=c(A,",",2)}else{d=l(A)}const f=[];for(const t of d){f.push(await g.read(i,t.trim()))}h[t]=f}else{h[t]=await g.read(a,A)}}}else if(d.httpPrefixHeaders!==undefined){h[t]={};for(const n in i.headers){if(n.startsWith(d.httpPrefixHeaders)){const A=i.headers[n];const c=a.getValueSchema();c.getMergedTraits().httpHeader=n;h[t][n.slice(d.httpPrefixHeaders.length)]=await g.read(c,A)}}}else if(d.httpResponseCode){h[t]=i.statusCode}else{m.push(t)}}m.discardResponseBody=f;return m}}class RpcProtocol extends HttpProtocol{async serializeRequest(t,n,i){const a=this.serializer;const A={};const c={};const l=await i.endpoint();const d=S.of(t?.input);const h=d.getSchema();let f;const g=n&&typeof n==="object"?n:{};const p=new R({protocol:"",hostname:"",port:undefined,path:"/",fragment:undefined,query:A,headers:c,body:undefined});if(l){this.updateServiceEndpoint(p,l);this.setHostPrefix(p,t,g)}if(g){const t=d.getEventStreamMember();if(t){if(g[t]){const n={};for(const[i,A]of d.structIterator()){if(i!==t&&g[i]){a.write(A,g[i]);n[i]=a.flush()}}f=await this.serializeEventStream({eventStream:g[t],requestSchema:d,initialRequest:n})}}else{a.write(h,g);f=a.flush()}}p.headers=Object.assign(p.headers,c);p.query=A;p.body=f;p.method="POST";return p}async deserializeResponse(t,n,i){const a=this.deserializer;const A=S.of(t.output);const c={};if(i.statusCode>=300){const A=await collectBody(i.body,n);if(A.byteLength>0){Object.assign(c,await a.read(15,A))}await this.handleError(t,n,i,c,this.deserializeMetadata(i));throw new Error("@smithy/core/protocols - RPC Protocol error handler failed to throw.")}for(const t in i.headers){const n=i.headers[t];delete i.headers[t];i.headers[t.toLowerCase()]=n}const l=A.getEventStreamMember();if(l){c[l]=await this.deserializeEventStream({response:i,responseSchema:A,initialResponseContainer:c})}else{const t=await collectBody(i.body,n);if(t.byteLength>0){Object.assign(c,await a.read(A,t))}}c.$metadata=this.deserializeMetadata(i);return c}}const resolvedPath=(t,n,i,a,A,c)=>{if(n!=null&&n[i]!==undefined){const n=a();if(n==null||n.length<=0){throw new Error("Empty value provided for input HTTP label: "+i+".")}t=t.replace(A,c?n.split("/").map(t=>extendedEncodeURIComponent(t)).join("/"):extendedEncodeURIComponent(n))}else{throw new Error("No value provided for input HTTP label: "+i+".")}return t};function requestBuilder(t,n){return new RequestBuilder(t,n)}class RequestBuilder{input;context;query={};method="";headers={};path="";body=null;hostname="";resolvePathStack=[];constructor(t,n){this.input=t;this.context=n}async build(){const{hostname:t,protocol:n="https",port:i,path:a}=await this.context.endpoint();this.path=a;for(const t of this.resolvePathStack){t(this.path)}return new R({protocol:n,hostname:this.hostname||t,port:i,method:this.method,path:this.path,query:this.query,body:this.body,headers:this.headers})}hn(t){this.hostname=t;return this}bp(t){this.resolvePathStack.push(n=>{this.path=`${n?.endsWith("/")?n.slice(0,-1):n||""}`+t});return this}p(t,n,i,a){this.resolvePathStack.push(A=>{this.path=resolvedPath(A,this.input,t,n,i,a)});return this}h(t){this.headers=t;return this}q(t){this.query=t;return this}b(t){this.body=t;return this}m(t){this.method=t;return this}}function determineTimestampFormat(t,n){if(n.timestampFormat.useTrait){if(t.isTimestampSchema()&&(t.getSchema()===5||t.getSchema()===6||t.getSchema()===7)){return t.getSchema()}}const{httpLabel:i,httpPrefixHeaders:a,httpHeader:A,httpQuery:c}=t.getMergedTraits();const l=n.httpBindings?typeof a==="string"||Boolean(A)?6:Boolean(c)||Boolean(i)?5:undefined:undefined;return l??n.timestampFormat.default}class FromStringShapeDeserializer extends SerdeContext{settings;constructor(t){super();this.settings=t}read(t,n){const i=S.of(t);if(i.isListSchema()){return l(n).map(t=>this.read(i.getValueSchema(),t))}if(i.isBlobSchema()){return(this.serdeContext?.base64Decoder??d)(n)}if(i.isTimestampSchema()){const t=determineTimestampFormat(i,this.settings);switch(t){case 5:return g(n);case 6:return f(n);case 7:return h(n);default:console.warn("Missing timestamp format, parsing value with Date constructor:",n);return new Date(n)}}if(i.isStringSchema()){const t=i.getMergedTraits().mediaType;let a=n;if(t){if(i.getMergedTraits().httpHeader){a=this.base64ToUtf8(a)}const n=t==="application/json"||t.endsWith("+json");if(n){a=p.from(a)}return a}}if(i.isNumericSchema()){return Number(n)}if(i.isBigIntegerSchema()){return BigInt(n)}if(i.isBigDecimalSchema()){return new m(n,"bigDecimal")}if(i.isBooleanSchema()){return String(n).toLowerCase()==="true"}return n}base64ToUtf8(t){return(this.serdeContext?.utf8Encoder??E)((this.serdeContext?.base64Decoder??d)(t))}}class HttpInterceptingShapeDeserializer extends SerdeContext{codecDeserializer;stringDeserializer;constructor(t,n){super();this.codecDeserializer=t;this.stringDeserializer=new FromStringShapeDeserializer(n)}setSerdeContext(t){this.stringDeserializer.setSerdeContext(t);this.codecDeserializer.setSerdeContext(t);this.serdeContext=t}read(t,n){const i=S.of(t);const a=i.getMergedTraits();const A=this.serdeContext?.utf8Encoder??E;if(a.httpHeader||a.httpResponseCode){return this.stringDeserializer.read(i,A(n))}if(a.httpPayload){if(i.isBlobSchema()){const t=this.serdeContext?.utf8Decoder??C;if(typeof n==="string"){return t(n)}return n}else if(i.isStringSchema()){if("byteLength"in n){return A(n)}return n}}return this.codecDeserializer.read(i,n)}}class ToStringShapeSerializer extends SerdeContext{settings;stringBuffer="";constructor(t){super();this.settings=t}write(t,n){const i=S.of(t);switch(typeof n){case"object":if(n===null){this.stringBuffer="null";return}if(i.isTimestampSchema()){if(!(n instanceof Date)){throw new Error(`@smithy/core/protocols - received non-Date value ${n} when schema expected Date in ${i.getName(true)}`)}const t=determineTimestampFormat(i,this.settings);switch(t){case 5:this.stringBuffer=n.toISOString().replace(".000Z","Z");break;case 6:this.stringBuffer=B(n);break;case 7:this.stringBuffer=String(n.getTime()/1e3);break;default:console.warn("Missing timestamp format, using epoch seconds",n);this.stringBuffer=String(n.getTime()/1e3)}return}if(i.isBlobSchema()&&"byteLength"in n){this.stringBuffer=(this.serdeContext?.base64Encoder??y)(n);return}if(i.isListSchema()&&Array.isArray(n)){let t="";for(const a of n){this.write([i.getValueSchema(),i.getMergedTraits()],a);const n=this.flush();const A=i.getValueSchema().isTimestampSchema()?n:Q(n);if(t!==""){t+=", "}t+=A}this.stringBuffer=t;return}this.stringBuffer=JSON.stringify(n,null,2);break;case"string":const t=i.getMergedTraits().mediaType;let a=n;if(t){const n=t==="application/json"||t.endsWith("+json");if(n){a=p.from(a)}if(i.getMergedTraits().httpHeader){this.stringBuffer=(this.serdeContext?.base64Encoder??y)(a.toString());return}}this.stringBuffer=n;break;default:if(i.isIdempotencyToken()){this.stringBuffer=I()}else{this.stringBuffer=String(n)}}}flush(){const t=this.stringBuffer;this.stringBuffer="";return t}}class HttpInterceptingShapeSerializer{codecSerializer;stringSerializer;buffer;constructor(t,n,i=new ToStringShapeSerializer(n)){this.codecSerializer=t;this.stringSerializer=i}setSerdeContext(t){this.codecSerializer.setSerdeContext(t);this.stringSerializer.setSerdeContext(t)}write(t,n){const i=S.of(t);const a=i.getMergedTraits();if(a.httpHeader||a.httpLabel||a.httpQuery){this.stringSerializer.write(i,n);this.buffer=this.stringSerializer.flush();return}return this.codecSerializer.write(i,n)}flush(){if(this.buffer!==undefined){const t=this.buffer;this.buffer=undefined;return t}return this.codecSerializer.flush()}}class Field{name;kind;values;constructor({name:t,kind:n=N.HEADER,values:i=[]}){this.name=t;this.kind=n;this.values=i}add(t){this.values.push(t)}set(t){this.values=t}remove(t){this.values=this.values.filter(n=>n!==t)}toString(){return this.values.map(t=>t.includes(",")||t.includes(" ")?`"${t}"`:t).join(", ")}get(){return this.values}}class Fields{entries={};encoding;constructor({fields:t=[],encoding:n="utf-8"}){t.forEach(this.setField.bind(this));this.encoding=n}setField(t){this.entries[t.name.toLowerCase()]=t}getField(t){return this.entries[t.toLowerCase()]}removeField(t){delete this.entries[t.toLowerCase()]}getByType(t){return Object.values(this.entries).filter(n=>n.kind===t)}}const getHttpHandlerExtensionConfiguration=t=>({setHttpHandler(n){t.httpHandler=n},httpHandler(){return t.httpHandler},updateHttpClientConfig(n,i){t.httpHandler?.updateHttpClientConfig(n,i)},httpHandlerConfigs(){return t.httpHandler.httpHandlerConfigs()}});const resolveHttpHandlerRuntimeConfig=t=>({httpHandler:t.httpHandler()});const M="content-length";function contentLengthMiddleware(t){return n=>async i=>{const a=i.request;if(R.isInstance(a)){const{body:n,headers:i}=a;if(n&&Object.keys(i).map(t=>t.toLowerCase()).indexOf(M)===-1){try{const i=t(n);a.headers={...a.headers,[M]:String(i)}}catch(t){}}}return n({...i,request:a})}}const F={step:"build",tags:["SET_CONTENT_LENGTH","CONTENT_LENGTH"],name:"contentLengthMiddleware",override:true};const getContentLengthPlugin=t=>({applyToStack:n=>{n.add(contentLengthMiddleware(t.bodyLengthChecker),F)}});const escapeUri=t=>encodeURIComponent(t).replace(/[!'()*]/g,hexEncode);const hexEncode=t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`;const escapeUriPath=t=>t.split("/").map(escapeUri).join("/");function buildQueryString(t){const n=[];for(let i of Object.keys(t).sort()){const a=t[i];i=escapeUri(i);if(Array.isArray(a)){for(let t=0,A=a.length;t{const{Readable:a}=i(7075);const{NoOpLogger:A,normalizeProvider:c}=i(2658);const{HttpResponse:l,HttpRequest:d}=i(3422);const{parseRfc7231DateTime:h,v4:f}=i(2430);const isStreamingPayload=t=>t?.body instanceof a||typeof ReadableStream!=="undefined"&&t?.body instanceof ReadableStream;const g=["AuthFailure","InvalidSignatureException","RequestExpired","RequestInTheFuture","RequestTimeTooSkewed","SignatureDoesNotMatch"];const p=["BandwidthLimitExceeded","EC2ThrottledException","LimitExceededException","PriorRequestNotComplete","ProvisionedThroughputExceededException","RequestLimitExceeded","RequestThrottled","RequestThrottledException","SlowDown","ThrottledException","Throttling","ThrottlingException","TooManyRequestsException","TransactionInProgressException"];const m=["TimeoutError","RequestTimeout","RequestTimeoutException"];const E=[500,502,503,504];const C=["ECONNRESET","ECONNREFUSED","EPIPE","ETIMEDOUT"];const I=["EHOSTUNREACH","ENETUNREACH","ENOTFOUND","EAI_AGAIN"];const isRetryableByTrait=t=>t?.$retryable!==undefined;const isClockSkewError=t=>g.includes(t.name);const isClockSkewCorrectedError=t=>t.$metadata?.clockSkewCorrected;const isBrowserNetworkError=t=>{const n=new Set(["Failed to fetch","NetworkError when attempting to fetch resource","The Internet connection appears to be offline","Load failed","Network request failed"]);const i=t&&t instanceof TypeError;if(!i){return false}return n.has(t.message)};const isThrottlingError=t=>t.$metadata?.httpStatusCode===429||p.includes(t.name)||t.$retryable?.throttling==true;const isTransientError=(t,n=0)=>isRetryableByTrait(t)||isClockSkewCorrectedError(t)||t.name==="InvalidSignatureException"&&t.message?.includes("Signature expired")||m.includes(t.name)||C.includes(t?.code||"")||I.includes(t?.code||"")||E.includes(t.$metadata?.httpStatusCode||0)||isBrowserNetworkError(t)||isNodeJsHttp2TransientError(t)||t.cause!==undefined&&n<=10&&isTransientError(t.cause,n+1);const isServerError=t=>{if(t.$metadata?.httpStatusCode!==undefined){const n=t.$metadata.httpStatusCode;if(500<=n&&n<=599&&!isTransientError(t)){return true}return false}return false};function isNodeJsHttp2TransientError(t){return t.code==="ERR_HTTP2_STREAM_ERROR"&&t.message.includes("NGHTTP2_REFUSED_STREAM")}const y=100;const B=20*1e3;const Q=500;const w=500;const S=5;const b=10;const R=1;const v="amz-sdk-invocation-id";const k="amz-sdk-request";function parseRetryAfterHeader(t,n){if(!l.isInstance(t)){return}for(const i of Object.keys(t.headers)){const a=i.toLowerCase();if(a==="retry-after"){const a=t.headers[i];let A=NaN;if(a.endsWith("GMT")){try{const t=h(a);A=(t.getTime()-Date.now())/1e3}catch(t){n?.trace?.("Failed to parse retry-after header");n?.trace?.(t)}}else if(a.match(/ GMT, ((\d+)|(\d+\.\d+))$/)){A=Number(a.match(/ GMT, ([\d.]+)$/)?.[1])}else if(a.match(/^((\d+)|(\d+\.\d+))$/)){A=Number(a)}else if(Date.parse(a)>=Date.now()){A=(Date.parse(a)-Date.now())/1e3}if(isNaN(A)){return}return new Date(Date.now()+A*1e3)}else if(a==="x-amz-retry-after"){const a=t.headers[i];const A=Number(a);if(isNaN(A)){n?.trace?.(`Failed to parse x-amz-retry-after=${a}`);return}return new Date(Date.now()+A)}}}function getRetryAfterHint(t,n){return parseRetryAfterHeader(t,n)}const asSdkError=t=>{if(t instanceof Error)return t;if(t instanceof Object)return Object.assign(new Error,t);if(typeof t==="string")return new Error(t);return new Error(`AWS SDK error wrapper for ${t}`)};function bindRetryMiddleware(t){return n=>(i,a)=>async c=>{let l=await n.retryStrategy();const h=await n.maxAttempts();if(isRetryStrategyV2(l)){l=l;let g=await l.acquireInitialRetryToken((a["partition_id"]??"")+(a.__retryLongPoll?":longpoll":""));let p=new Error;let m=0;let E=0;const{request:C}=c;const I=d.isInstance(C);if(I){C.headers[v]=f()}while(true){try{if(I){C.headers[k]=`attempt=${m+1}; max=${h}`}const{response:t,output:n}=await i(c);l.recordSuccess(g);n.$metadata.attempts=m+1;n.$metadata.totalRetryDelay=E;return{response:t,output:n}}catch(i){const c=getRetryErrorInfo(i,n.logger);p=asSdkError(i);if(I&&t(C)){(a.logger instanceof A?console:a.logger)?.warn("An error was encountered in a non-retryable streaming request.");throw p}try{g=await l.refreshRetryTokenForRetry(g,c)}catch(t){if(!p.$metadata){p.$metadata={}}p.$metadata.attempts=m+1;p.$metadata.totalRetryDelay=E;throw p}m=g.getRetryCount();const d=g.getRetryDelay();E+=(g?.$retryLog?.acquisitionDelay??0)+d;if(d>0){await cooldown(d)}}}}else{l=l;if(l?.mode){a.userAgent=[...a.userAgent||[],["cfg/retry-mode",l.mode]]}return l.retry(i,c)}}}const cooldown=t=>new Promise(n=>setTimeout(n,t));const isRetryStrategyV2=t=>typeof t.acquireInitialRetryToken!=="undefined"&&typeof t.refreshRetryTokenForRetry!=="undefined"&&typeof t.recordSuccess!=="undefined";const getRetryErrorInfo=(t,n)=>{const i={error:t,errorType:getRetryErrorType(t)};const a=parseRetryAfterHeader(t.$response,n);if(a){i.retryAfterHint=a}return i};const getRetryErrorType=t=>{if(isThrottlingError(t))return"THROTTLING";if(isTransientError(t))return"TRANSIENT";if(isServerError(t))return"SERVER_ERROR";return"CLIENT_ERROR"};const D={name:"retryMiddleware",tags:["RETRY"],step:"finalizeRequest",priority:"high",override:true};function bindGetRetryPlugin(t){const n=bindRetryMiddleware(t);return t=>({applyToStack:i=>{i.add(n(t),D)}})}class DefaultRateLimiter{static setTimeoutFn=(t,n)=>setTimeout(t,n);beta;minCapacity;minFillRate;scaleConstant;smooth;enabled=false;availableTokens=0;lastMaxRate=0;measuredTxRate=0;requestCount=0;fillRate;lastThrottleTime;lastTimestamp=0;lastTxRateBucket;maxCapacity;timeWindow=0;constructor(t){this.beta=t?.beta??.7;this.minCapacity=t?.minCapacity??1;this.minFillRate=t?.minFillRate??.5;this.scaleConstant=t?.scaleConstant??.4;this.smooth=t?.smooth??.8;this.lastThrottleTime=this.getCurrentTimeInSeconds();this.lastTxRateBucket=Math.floor(this.getCurrentTimeInSeconds());this.fillRate=this.minFillRate;this.maxCapacity=this.minCapacity}async getSendToken(){return this.acquireTokenBucket(1)}updateClientSendingRate(t){let n;this.updateMeasuredRate();const i=t;const a=i?.errorType==="THROTTLING"||isThrottlingError(i?.error??t);if(a){const t=!this.enabled?this.measuredTxRate:Math.min(this.measuredTxRate,this.fillRate);this.lastMaxRate=t;this.calculateTimeWindow();this.lastThrottleTime=this.getCurrentTimeInSeconds();n=this.cubicThrottle(t);this.enableTokenBucket()}else{this.calculateTimeWindow();n=this.cubicSuccess(this.getCurrentTimeInSeconds())}const A=Math.min(n,2*this.measuredTxRate);this.updateTokenBucketRate(A)}getCurrentTimeInSeconds(){return Date.now()/1e3}async acquireTokenBucket(t){if(!this.enabled){return}this.refillTokenBucket();while(t>this.availableTokens){const n=(t-this.availableTokens)/this.fillRate*1e3;await new Promise(t=>DefaultRateLimiter.setTimeoutFn(t,n));this.refillTokenBucket()}this.availableTokens=this.availableTokens-t}refillTokenBucket(){const t=this.getCurrentTimeInSeconds();if(!this.lastTimestamp){this.lastTimestamp=t;return}const n=(t-this.lastTimestamp)*this.fillRate;this.availableTokens=Math.min(this.maxCapacity,this.availableTokens+n);this.lastTimestamp=t}calculateTimeWindow(){this.timeWindow=this.getPrecise(Math.pow(this.lastMaxRate*(1-this.beta)/this.scaleConstant,1/3))}cubicThrottle(t){return this.getPrecise(t*this.beta)}cubicSuccess(t){return this.getPrecise(this.scaleConstant*Math.pow(t-this.lastThrottleTime-this.timeWindow,3)+this.lastMaxRate)}enableTokenBucket(){this.enabled=true}updateTokenBucketRate(t){this.refillTokenBucket();this.fillRate=Math.max(t,this.minFillRate);this.maxCapacity=Math.max(t,this.minCapacity);this.availableTokens=Math.min(this.availableTokens,this.maxCapacity)}updateMeasuredRate(){const t=this.getCurrentTimeInSeconds();const n=Math.floor(t*2)/2;this.requestCount++;if(n>this.lastTxRateBucket){const t=this.requestCount/(n-this.lastTxRateBucket);this.measuredTxRate=this.getPrecise(t*this.smooth+this.measuredTxRate*(1-this.smooth));this.requestCount=0;this.lastTxRateBucket=n}}getPrecise(t){return parseFloat(t.toFixed(8))}}class Retry{static v2026=typeof process!=="undefined"&&process.env?.SMITHY_NEW_RETRIES_2026==="true";static delay(){return Retry.v2026?50:100}static throttlingDelay(){return Retry.v2026?1e3:500}static cost(){return Retry.v2026?14:5}static throttlingCost(){return Retry.v2026?5:10}static modifiedCostType(){return Retry.v2026?"THROTTLING":"TRANSIENT"}}class DefaultRetryBackoffStrategy{x=Retry.delay();computeNextBackoffDelay(t){const n=Math.random();const i=2;const a=n*Math.min(this.x*i**t,B);return Math.floor(a)}setDelayBase(t){this.x=t}}class DefaultRetryToken{delay;count;cost;longPoll;$retryLog={acquisitionDelay:0};constructor(t,n,i,a){this.delay=t;this.count=n;this.cost=i;this.longPoll=a}getRetryCount(){return this.count}getRetryDelay(){return Math.min(B,this.delay)}getRetryCost(){return this.cost}isLongPoll(){return this.longPoll}}var T;(function(t){t["STANDARD"]="standard";t["ADAPTIVE"]="adaptive"})(T||(T={}));const N=3;const M=T.STANDARD;const F={incompatible:1,attempts:2,capacity:3};let x=class StandardRetryStrategy{mode=T.STANDARD;retryBackoffStrategy;capacity=w;maxAttemptsProvider;baseDelay;constructor(t){if(typeof t==="number"){this.maxAttemptsProvider=async()=>t}else if(typeof t==="function"){this.maxAttemptsProvider=t}else if(t&&typeof t==="object"){this.maxAttemptsProvider=async()=>t.maxAttempts;this.baseDelay=t.baseDelay;this.retryBackoffStrategy=t.backoff}this.maxAttemptsProvider??=async()=>N;this.baseDelay??=Retry.delay();this.retryBackoffStrategy??=new DefaultRetryBackoffStrategy}async acquireInitialRetryToken(t){return new DefaultRetryToken(Retry.delay(),0,undefined,Retry.v2026&&t.includes(":longpoll"))}async refreshRetryTokenForRetry(t,n){const i=await this.getMaxAttempts();const a=this.retryCode(t,n,i);const A=a===0;const c=t.isLongPoll?.();if(A||c){const i=n.errorType;this.retryBackoffStrategy.setDelayBase(i==="THROTTLING"?Retry.throttlingDelay():this.baseDelay);const l=this.retryBackoffStrategy.computeNextBackoffDelay(t.getRetryCount());let d=l;if(n.retryAfterHint instanceof Date){d=Math.max(l,Math.min(n.retryAfterHint.getTime()-Date.now(),l+5e3))}if(!A){const t=Retry.v2026&&a===F.capacity&&c?d:0;if(t>0){await new Promise(n=>setTimeout(n,t))}}else{const n=this.getCapacityCost(i);this.capacity-=n;const a=new DefaultRetryToken(0,t.getRetryCount()+1,n,t.isLongPoll?.()??false);await new Promise(t=>setTimeout(t,d));a.$retryLog.acquisitionDelay=d;return a}}throw new Error("No retry token available")}recordSuccess(t){this.capacity=Math.min(w,this.capacity+(t.getRetryCost()??R))}getCapacity(){return this.capacity}async maxAttempts(){return this.maxAttemptsProvider()}async getMaxAttempts(){try{return await this.maxAttemptsProvider()}catch(t){console.warn(`Max attempts provider could not resolve. Using default of ${N}`);return N}}retryCode(t,n,i){const a=t.getRetryCount()+1;const A=this.isRetryableError(n.errorType)?0:F.incompatible;const c=a=this.getCapacityCost(n.errorType)?0:F.capacity;return A||c||l}getCapacityCost(t){return t===Retry.modifiedCostType()?Retry.throttlingCost():Retry.cost()}isRetryableError(t){return t==="THROTTLING"||t==="TRANSIENT"}};let U=class AdaptiveRetryStrategy{mode=T.ADAPTIVE;rateLimiter;standardRetryStrategy;constructor(t,n){const{rateLimiter:i}=n??{};this.rateLimiter=i??new DefaultRateLimiter;this.standardRetryStrategy=n?new x({maxAttempts:typeof t==="number"?t:3,...n}):new x(t)}async acquireInitialRetryToken(t){const n=await this.standardRetryStrategy.acquireInitialRetryToken(t);await this.rateLimiter.getSendToken();return n}async refreshRetryTokenForRetry(t,n){this.rateLimiter.updateClientSendingRate(n);const i=await this.standardRetryStrategy.refreshRetryTokenForRetry(t,n);await this.rateLimiter.getSendToken();return i}recordSuccess(t){this.rateLimiter.updateClientSendingRate({});this.standardRetryStrategy.recordSuccess(t)}async maxAttemptsProvider(){return this.standardRetryStrategy.maxAttempts()}};class ConfiguredRetryStrategy extends x{computeNextBackoffDelay;constructor(t,n=Retry.delay()){super(typeof t==="function"?t:async()=>t);if(typeof n==="number"){this.computeNextBackoffDelay=()=>n}else{this.computeNextBackoffDelay=n}this.retryBackoffStrategy.computeNextBackoffDelay=t=>{const n=t+1;return this.computeNextBackoffDelay(n)}}}const getDefaultRetryQuota=(t,n)=>{const i=t;const a=R;const A=S;const c=b;let l=t;const getCapacityAmount=t=>t.name==="TimeoutError"?c:A;const hasRetryTokens=t=>getCapacityAmount(t)<=l;const retrieveRetryTokens=t=>{if(!hasRetryTokens(t)){throw new Error("No retry token available")}const n=getCapacityAmount(t);l-=n;return n};const releaseRetryTokens=t=>{l+=t??a;l=Math.min(l,i)};return Object.freeze({hasRetryTokens:hasRetryTokens,retrieveRetryTokens:retrieveRetryTokens,releaseRetryTokens:releaseRetryTokens})};const defaultDelayDecider=(t,n)=>Math.floor(Math.min(B,Math.random()*2**n*t));const defaultRetryDecider=t=>{if(!t){return false}return isRetryableByTrait(t)||isClockSkewError(t)||isThrottlingError(t)||isTransientError(t)};class StandardRetryStrategy{maxAttemptsProvider;retryDecider;delayDecider;retryQuota;mode=T.STANDARD;constructor(t,n){this.maxAttemptsProvider=t;this.retryDecider=n?.retryDecider??defaultRetryDecider;this.delayDecider=n?.delayDecider??defaultDelayDecider;this.retryQuota=n?.retryQuota??getDefaultRetryQuota(w)}shouldRetry(t,n,i){return nsetTimeout(t,l));continue}if(!n.$metadata){n.$metadata={}}n.$metadata.attempts=A;n.$metadata.totalRetryDelay=c;throw n}}}}const getDelayFromRetryAfterHeader=t=>{if(!l.isInstance(t))return;const n=Object.keys(t.headers).find(t=>t.toLowerCase()==="retry-after");if(!n)return;const i=t.headers[n];const a=Number(i);if(!Number.isNaN(a))return Math.min(a*1e3,2e4);const A=new Date(i);return Math.min(A.getTime()-Date.now(),2e4)};class AdaptiveRetryStrategy extends StandardRetryStrategy{rateLimiter;constructor(t,n){const{rateLimiter:i,...a}=n??{};super(t,a);this.rateLimiter=i??new DefaultRateLimiter;this.mode=T.ADAPTIVE}async retry(t,n){return super.retry(t,n,{beforeRequest:async()=>this.rateLimiter.getSendToken(),afterRequest:t=>{this.rateLimiter.updateClientSendingRate(t)}})}}const P="AWS_MAX_ATTEMPTS";const L="max_attempts";const O={environmentVariableSelector:t=>{const n=t[P];if(!n)return undefined;const i=parseInt(n);if(Number.isNaN(i)){throw new Error(`Environment variable ${P} mast be a number, got "${n}"`)}return i},configFileSelector:t=>{const n=t[L];if(!n)return undefined;const i=parseInt(n);if(Number.isNaN(i)){throw new Error(`Shared config file entry ${L} mast be a number, got "${n}"`)}return i},default:N};const resolveRetryConfig=(t,n)=>{const{retryStrategy:i,retryMode:a}=t;const{defaultMaxAttempts:A=N,defaultBaseDelay:l=Retry.delay()}=n??{};const d=c(t.maxAttempts??A);let h=i?Promise.resolve(i):undefined;const getDefault=async()=>{const t=await d();const n=await c(a)()===T.ADAPTIVE;if(n){return new U(d,{maxAttempts:t,baseDelay:l})}return new x({maxAttempts:t,baseDelay:l})};return Object.assign(t,{maxAttempts:d,retryStrategy:()=>h??=getDefault()})};const H="AWS_RETRY_MODE";const $="retry_mode";const G={environmentVariableSelector:t=>t[H],configFileSelector:t=>t[$],default:M};const omitRetryHeadersMiddleware=()=>t=>async n=>{const{request:i}=n;if(d.isInstance(i)){delete i.headers[v];delete i.headers[k]}return t(n)};const V={name:"omitRetryHeadersMiddleware",tags:["RETRY","HEADERS","OMIT_RETRY_HEADERS"],relation:"before",toMiddleware:"awsAuthMiddleware",override:true};const getOmitRetryHeadersPlugin=t=>({applyToStack:t=>{t.addRelativeTo(omitRetryHeadersMiddleware(),V)}});const Y=bindRetryMiddleware(isStreamingPayload);const J=bindGetRetryPlugin(isStreamingPayload);n.AdaptiveRetryStrategy=U;n.CONFIG_MAX_ATTEMPTS=L;n.CONFIG_RETRY_MODE=$;n.ConfiguredRetryStrategy=ConfiguredRetryStrategy;n.DEFAULT_MAX_ATTEMPTS=N;n.DEFAULT_RETRY_DELAY_BASE=y;n.DEFAULT_RETRY_MODE=M;n.DefaultRateLimiter=DefaultRateLimiter;n.DeprecatedAdaptiveRetryStrategy=AdaptiveRetryStrategy;n.DeprecatedStandardRetryStrategy=StandardRetryStrategy;n.ENV_MAX_ATTEMPTS=P;n.ENV_RETRY_MODE=H;n.INITIAL_RETRY_TOKENS=w;n.INVOCATION_ID_HEADER=v;n.MAXIMUM_RETRY_DELAY=B;n.NODE_MAX_ATTEMPT_CONFIG_OPTIONS=O;n.NODE_RETRY_MODE_CONFIG_OPTIONS=G;n.NO_RETRY_INCREMENT=R;n.REQUEST_HEADER=k;n.RETRY_COST=S;n.RETRY_MODES=T;n.Retry=Retry;n.StandardRetryStrategy=x;n.THROTTLING_RETRY_DELAY_BASE=Q;n.TIMEOUT_RETRY_COST=b;n.defaultDelayDecider=defaultDelayDecider;n.defaultRetryDecider=defaultRetryDecider;n.getOmitRetryHeadersPlugin=getOmitRetryHeadersPlugin;n.getRetryAfterHint=getRetryAfterHint;n.getRetryPlugin=J;n.isBrowserNetworkError=isBrowserNetworkError;n.isClockSkewCorrectedError=isClockSkewCorrectedError;n.isClockSkewError=isClockSkewError;n.isNodeJsHttp2TransientError=isNodeJsHttp2TransientError;n.isRetryableByTrait=isRetryableByTrait;n.isServerError=isServerError;n.isThrottlingError=isThrottlingError;n.isTransientError=isTransientError;n.omitRetryHeadersMiddleware=omitRetryHeadersMiddleware;n.omitRetryHeadersMiddlewareOptions=V;n.resolveRetryConfig=resolveRetryConfig;n.retryMiddleware=Y;n.retryMiddlewareOptions=D},6890:(t,n,i)=>{const{getSmithyContext:a,HttpResponse:A,toEndpointV1:c}=i(4534);const deref=t=>{if(typeof t==="function"){return t()}return t};const operation=(t,n,i,a,A)=>({name:n,namespace:t,traits:i,input:a,output:A});const schemaDeserializationMiddleware=t=>(n,i)=>async c=>{const{response:l}=await n(c);const{operationSchema:d}=a(i);const[,h,f,g,p,m]=d??[];try{const n=await t.protocol.deserializeResponse(operation(h,f,g,p,m),{...t,...i},l);return{response:l,output:n}}catch(t){Object.defineProperty(t,"$response",{value:l,enumerable:false,writable:false,configurable:false});if(!("$metadata"in t)){const n=`Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.`;try{t.message+="\n "+n}catch(t){if(!i.logger||i.logger?.constructor?.name==="NoOpLogger"){console.warn(n)}else{i.logger?.warn?.(n)}}if(typeof t.$responseBodyText!=="undefined"){if(t.$response){t.$response.body=t.$responseBodyText}}try{if(A.isInstance(l)){const{headers:n={},statusCode:i}=l;const a=Object.entries(n);t.$metadata={httpStatusCode:i,requestId:findHeader(/^x-[\w-]+-request-?id$/,a),extendedRequestId:findHeader(/^x-[\w-]+-id-2$/,a),cfId:findHeader(/^x-[\w-]+-cf-id$/,a)}}}catch(t){}}throw t}};const findHeader=(t,n)=>(n.find(([n])=>n.match(t))||[void 0,void 0])[1];const schemaSerializationMiddleware=t=>(n,i)=>async A=>{const{operationSchema:l}=a(i);const[,d,h,f,g,p]=l??[];const m=i.endpointV2?async()=>c(i.endpointV2):t.endpoint;const E=await t.protocol.serializeRequest(operation(d,h,f,g,p),A.input,{...t,...i,endpoint:m});return n({...A,request:E})};const l={name:"deserializerMiddleware",step:"deserialize",tags:["DESERIALIZER"],override:true};const d={name:"serializerMiddleware",step:"serialize",tags:["SERIALIZER"],override:true};function getSchemaSerdePlugin(t){return{applyToStack:n=>{n.add(schemaSerializationMiddleware(t),d);n.add(schemaDeserializationMiddleware(t),l);t.protocol.setSerdeContext(t)}}}class Schema{name;namespace;traits;static assign(t,n){const i=Object.assign(t,n);return i}static[Symbol.hasInstance](t){const n=this.prototype.isPrototypeOf(t);if(!n&&typeof t==="object"&&t!==null){const n=t;return n.symbol===this.symbol}return n}getName(){return this.namespace+"#"+this.name}}class ListSchema extends Schema{static symbol=Symbol.for("@smithy/lis");name;traits;valueSchema;symbol=ListSchema.symbol}const list=(t,n,i,a)=>Schema.assign(new ListSchema,{name:n,namespace:t,traits:i,valueSchema:a});class MapSchema extends Schema{static symbol=Symbol.for("@smithy/map");name;traits;keySchema;valueSchema;symbol=MapSchema.symbol}const map=(t,n,i,a,A)=>Schema.assign(new MapSchema,{name:n,namespace:t,traits:i,keySchema:a,valueSchema:A});class OperationSchema extends Schema{static symbol=Symbol.for("@smithy/ope");name;traits;input;output;symbol=OperationSchema.symbol}const op=(t,n,i,a,A)=>Schema.assign(new OperationSchema,{name:n,namespace:t,traits:i,input:a,output:A});class StructureSchema extends Schema{static symbol=Symbol.for("@smithy/str");name;traits;memberNames;memberList;symbol=StructureSchema.symbol}const struct=(t,n,i,a,A)=>Schema.assign(new StructureSchema,{name:n,namespace:t,traits:i,memberNames:a,memberList:A});class ErrorSchema extends StructureSchema{static symbol=Symbol.for("@smithy/err");ctor;symbol=ErrorSchema.symbol}const error=(t,n,i,a,A,c)=>Schema.assign(new ErrorSchema,{name:n,namespace:t,traits:i,memberNames:a,memberList:A,ctor:null});const h=[];function translateTraits(t){if(typeof t==="object"){return t}t=t|0;if(h[t]){return h[t]}const n={};let i=0;for(const a of["httpLabel","idempotent","idempotencyToken","sensitive","httpPayload","httpResponseCode","httpQueryParams"]){if((t>>i++&1)===1){n[a]=1}}return h[t]=n}const f={it:Symbol.for("@smithy/nor-struct-it"),ns:Symbol.for("@smithy/ns")};const g=[];const p={};class NormalizedSchema{ref;memberName;static symbol=Symbol.for("@smithy/nor");symbol=NormalizedSchema.symbol;name;schema;_isMemberSchema;traits;memberTraits;normalizedTraits;constructor(t,n){this.ref=t;this.memberName=n;const i=[];let a=t;let A=t;this._isMemberSchema=false;while(isMemberSchema(a)){i.push(a[1]);a=a[0];A=deref(a);this._isMemberSchema=true}if(i.length>0){this.memberTraits={};for(let t=i.length-1;t>=0;--t){const n=i[t];Object.assign(this.memberTraits,translateTraits(n))}}else{this.memberTraits=0}if(A instanceof NormalizedSchema){const t=this.memberTraits;Object.assign(this,A);this.memberTraits=Object.assign({},t,A.getMemberTraits(),this.getMemberTraits());this.normalizedTraits=void 0;this.memberName=n??A.memberName;return}this.schema=deref(A);if(isStaticSchema(this.schema)){this.name=`${this.schema[1]}#${this.schema[2]}`;this.traits=this.schema[3]}else{this.name=this.memberName??String(A);this.traits=0}if(this._isMemberSchema&&!n){throw new Error(`@smithy/core/schema - NormalizedSchema member init ${this.getName(true)} missing member name.`)}}static[Symbol.hasInstance](t){const n=this.prototype.isPrototypeOf(t);if(!n&&typeof t==="object"&&t!==null){const n=t;return n.symbol===this.symbol}return n}static of(t){const n=typeof t==="function"||typeof t==="object"&&t!==null;if(typeof t==="number"){if(g[t]){return g[t]}}else if(typeof t==="string"){if(p[t]){return p[t]}}else if(n){if(t[f.ns]){return t[f.ns]}}const i=deref(t);if(i instanceof NormalizedSchema){return i}if(isMemberSchema(i)){const[n,a]=i;if(n instanceof NormalizedSchema){Object.assign(n.getMergedTraits(),translateTraits(a));return n}throw new Error(`@smithy/core/schema - may not init unwrapped member schema=${JSON.stringify(t,null,2)}.`)}const a=new NormalizedSchema(i);if(n){return t[f.ns]=a}if(typeof i==="string"){return p[i]=a}if(typeof i==="number"){return g[i]=a}return a}getSchema(){const t=this.schema;if(Array.isArray(t)&&t[0]===0){return t[4]}return t}getName(t=false){const{name:n}=this;const i=!t&&n&&n.includes("#");return i?n.split("#")[1]:n||undefined}getMemberName(){return this.memberName}isMemberSchema(){return this._isMemberSchema}isListSchema(){const t=this.getSchema();return typeof t==="number"?t>=64&&t<128:t[0]===1}isMapSchema(){const t=this.getSchema();return typeof t==="number"?t>=128&&t<=255:t[0]===2}isStructSchema(){const t=this.getSchema();if(typeof t!=="object"){return false}const n=t[0];return n===3||n===-3||n===4}isUnionSchema(){const t=this.getSchema();if(typeof t!=="object"){return false}return t[0]===4}isBlobSchema(){const t=this.getSchema();return t===21||t===42}isTimestampSchema(){const t=this.getSchema();return typeof t==="number"&&t>=4&&t<=7}isUnitSchema(){return this.getSchema()==="unit"}isDocumentSchema(){return this.getSchema()===15}isStringSchema(){return this.getSchema()===0}isBooleanSchema(){return this.getSchema()===2}isNumericSchema(){return this.getSchema()===1}isBigIntegerSchema(){return this.getSchema()===17}isBigDecimalSchema(){return this.getSchema()===19}isStreaming(){const{streaming:t}=this.getMergedTraits();return!!t||this.getSchema()===42}isIdempotencyToken(){return!!this.getMergedTraits().idempotencyToken}getMergedTraits(){return this.normalizedTraits??(this.normalizedTraits={...this.getOwnTraits(),...this.getMemberTraits()})}getMemberTraits(){return translateTraits(this.memberTraits)}getOwnTraits(){return translateTraits(this.traits)}getKeySchema(){const[t,n]=[this.isDocumentSchema(),this.isMapSchema()];if(!t&&!n){throw new Error(`@smithy/core/schema - cannot get key for non-map: ${this.getName(true)}`)}const i=this.getSchema();const a=t?15:i[4]??0;return member([a,0],"key")}getValueSchema(){const t=this.getSchema();const[n,i,a]=[this.isDocumentSchema(),this.isMapSchema(),this.isListSchema()];const A=typeof t==="number"?63&t:t&&typeof t==="object"&&(i||a)?t[3+t[0]]:n?15:void 0;if(A!=null){return member([A,0],i?"value":"member")}throw new Error(`@smithy/core/schema - ${this.getName(true)} has no value member.`)}getMemberSchema(t){const n=this.getSchema();if(this.isStructSchema()&&n[4].includes(t)){const i=n[4].indexOf(t);const a=n[5][i];return member(isMemberSchema(a)?a:[a,0],t)}if(this.isDocumentSchema()){return member([15,0],t)}throw new Error(`@smithy/core/schema - ${this.getName(true)} has no member=${t}.`)}getMemberSchemas(){const t={};try{for(const[n,i]of this.structIterator()){t[n]=i}}catch(t){}return t}getEventStreamMember(){if(this.isStructSchema()){for(const[t,n]of this.structIterator()){if(n.isStreaming()&&n.isStructSchema()){return t}}}return""}*structIterator(){if(this.isUnitSchema()){return}if(!this.isStructSchema()){throw new Error("@smithy/core/schema - cannot iterate non-struct schema.")}const t=this.getSchema();const n=t[4].length;let i=t[f.it];if(i&&n===i.length){yield*i;return}i=Array(n);for(let a=0;aArray.isArray(t)&&t.length===2;const isStaticSchema=t=>Array.isArray(t)&&t.length>=5;class SimpleSchema extends Schema{static symbol=Symbol.for("@smithy/sim");name;schemaRef;traits;symbol=SimpleSchema.symbol}const sim=(t,n,i,a)=>Schema.assign(new SimpleSchema,{name:n,namespace:t,traits:a,schemaRef:i});const simAdapter=(t,n,i,a)=>Schema.assign(new SimpleSchema,{name:n,namespace:t,traits:i,schemaRef:a});const m={BLOB:21,STREAMING_BLOB:42,BOOLEAN:2,STRING:0,NUMERIC:1,BIG_INTEGER:17,BIG_DECIMAL:19,DOCUMENT:15,TIMESTAMP_DEFAULT:4,TIMESTAMP_DATE_TIME:5,TIMESTAMP_HTTP_DATE:6,TIMESTAMP_EPOCH_SECONDS:7,LIST_MODIFIER:64,MAP_MODIFIER:128};class TypeRegistry{namespace;schemas;exceptions;static registries=new Map;constructor(t,n=new Map,i=new Map){this.namespace=t;this.schemas=n;this.exceptions=i}static for(t){if(!TypeRegistry.registries.has(t)){TypeRegistry.registries.set(t,new TypeRegistry(t))}return TypeRegistry.registries.get(t)}copyFrom(t){const{schemas:n,exceptions:i}=this;for(const[i,a]of t.schemas){if(!n.has(i)){n.set(i,a)}}for(const[n,a]of t.exceptions){if(!i.has(n)){i.set(n,a)}}}register(t,n){const i=this.normalizeShapeId(t);for(const t of[this,TypeRegistry.for(i.split("#")[0])]){t.schemas.set(i,n)}}getSchema(t){const n=this.normalizeShapeId(t);if(!this.schemas.has(n)){if(!t.includes("#")){const n="#"+t;const i=[];for(const[t,a]of this.schemas.entries()){if(t.endsWith(n)){i.push(a)}}if(i.length===1){return i[0]}}throw new Error(`@smithy/core/schema - schema not found for ${n}`)}return this.schemas.get(n)}registerError(t,n){const i=t;const a=i[1];for(const t of[this,TypeRegistry.for(a)]){t.schemas.set(a+"#"+i[2],i);t.exceptions.set(i,n)}}getErrorCtor(t){const n=t;if(this.exceptions.has(n)){return this.exceptions.get(n)}const i=TypeRegistry.for(n[1]);return i.exceptions.get(n)}getBaseException(){for(const t of this.exceptions.keys()){if(Array.isArray(t)){const[,n,i]=t;const a=n+"#"+i;if(a.startsWith("smithy.ts.sdk.synthetic.")&&a.endsWith("ServiceException")){return t}}}return undefined}find(t){for(const n of this.schemas.values()){if(t(n)){return n}}return undefined}clear(){this.schemas.clear();this.exceptions.clear()}normalizeShapeId(t){if(t.includes("#")){return t}return this.namespace+"#"+t}}n.ErrorSchema=ErrorSchema;n.ListSchema=ListSchema;n.MapSchema=MapSchema;n.NormalizedSchema=NormalizedSchema;n.OperationSchema=OperationSchema;n.SCHEMA=m;n.Schema=Schema;n.SimpleSchema=SimpleSchema;n.StructureSchema=StructureSchema;n.TypeRegistry=TypeRegistry;n.deref=deref;n.deserializerMiddlewareOption=l;n.error=error;n.getSchemaSerdePlugin=getSchemaSerdePlugin;n.isStaticSchema=isStaticSchema;n.list=list;n.map=map;n.op=op;n.operation=operation;n.serializerMiddlewareOption=d;n.sim=sim;n.simAdapter=simAdapter;n.simpleSchemaCacheN=g;n.simpleSchemaCacheS=p;n.struct=struct;n.traitsCache=h;n.translateTraits=translateTraits},2430:(t,n,i)=>{const{createHmac:a,createHash:A,getRandomValues:c}=i(7598);const{ReadStream:l,lstatSync:d,fstatSync:h}=i(3024);const{HttpResponse:f}=i(4534);const{toEndpointV1:g}=i(2085);const{Duplex:p,Readable:m,Writable:E,PassThrough:C}=i(7075);const isArrayBuffer=t=>typeof ArrayBuffer==="function"&&t instanceof ArrayBuffer||Object.prototype.toString.call(t)==="[object ArrayBuffer]";const fromArrayBuffer=(t,n=0,i=t.byteLength-n)=>{if(!isArrayBuffer(t)){throw new TypeError(`The "input" argument must be ArrayBuffer. Received type ${typeof t} (${t})`)}return Buffer.from(t,n,i)};const fromString=(t,n)=>{if(typeof t!=="string"){throw new TypeError(`The "input" argument must be of type string. Received type ${typeof t} (${t})`)}return n?Buffer.from(t,n):Buffer.from(t)};const I=/^[A-Za-z0-9+/]*={0,2}$/;const fromBase64=t=>{if(t.length*3%4!==0){throw new TypeError(`Incorrect padding on base64 string.`)}if(!I.exec(t)){throw new TypeError(`Invalid base64 string.`)}const n=fromString(t,"base64");return new Uint8Array(n.buffer,n.byteOffset,n.byteLength)};const fromUtf8$1=t=>{const n=fromString(t,"utf8");return new Uint8Array(n.buffer,n.byteOffset,n.byteLength/Uint8Array.BYTES_PER_ELEMENT)};const toBase64$1=t=>{let n;if(typeof t==="string"){n=fromUtf8$1(t)}else{n=t}if(typeof n!=="object"||typeof n.byteOffset!=="number"||typeof n.byteLength!=="number"){throw new Error("@smithy/util-base64: toBase64 encoder function only accepts string | Uint8Array.")}return fromArrayBuffer(n.buffer,n.byteOffset,n.byteLength).toString("base64")};function bindUint8ArrayBlobAdapter(t,n,i,a){return class Uint8ArrayBlobAdapter extends Uint8Array{static fromString(t,i="utf-8"){if(typeof t==="string"){if(i==="base64"){return Uint8ArrayBlobAdapter.mutate(a(t))}return Uint8ArrayBlobAdapter.mutate(n(t))}throw new Error(`Unsupported conversion from ${typeof t} to Uint8ArrayBlobAdapter.`)}static mutate(t){Object.setPrototypeOf(t,Uint8ArrayBlobAdapter.prototype);return t}transformToString(n="utf-8"){if(n==="base64"){return i(this)}return t(this)}}}const toUtf8$1=t=>{if(typeof t==="string"){return t}if(typeof t!=="object"||typeof t.byteOffset!=="number"||typeof t.byteLength!=="number"){throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.")}return fromArrayBuffer(t.buffer,t.byteOffset,t.byteLength).toString("utf8")};const y=Array.from({length:256},(t,n)=>n.toString(16).padStart(2,"0"));function bindV4(t){if(typeof crypto!=="undefined"&&typeof crypto.randomUUID==="function"){return()=>crypto.randomUUID()}return()=>{const n=new Uint8Array(16);t(n);n[6]=n[6]&15|64;n[8]=n[8]&63|128;return y[n[0]]+y[n[1]]+y[n[2]]+y[n[3]]+"-"+y[n[4]]+y[n[5]]+"-"+y[n[6]]+y[n[7]]+"-"+y[n[8]]+y[n[9]]+"-"+y[n[10]]+y[n[11]]+y[n[12]]+y[n[13]]+y[n[14]]+y[n[15]]}}const copyDocumentWithTransform=(t,n,i=t=>t)=>t;const parseBoolean=t=>{switch(t){case"true":return true;case"false":return false;default:throw new Error(`Unable to parse boolean value "${t}"`)}};const expectBoolean=t=>{if(t===null||t===undefined){return undefined}if(typeof t==="number"){if(t===0||t===1){k.warn(stackTraceWarning(`Expected boolean, got ${typeof t}: ${t}`))}if(t===0){return false}if(t===1){return true}}if(typeof t==="string"){const n=t.toLowerCase();if(n==="false"||n==="true"){k.warn(stackTraceWarning(`Expected boolean, got ${typeof t}: ${t}`))}if(n==="false"){return false}if(n==="true"){return true}}if(typeof t==="boolean"){return t}throw new TypeError(`Expected boolean, got ${typeof t}: ${t}`)};const expectNumber=t=>{if(t===null||t===undefined){return undefined}if(typeof t==="string"){const n=parseFloat(t);if(!Number.isNaN(n)){if(String(n)!==String(t)){k.warn(stackTraceWarning(`Expected number but observed string: ${t}`))}return n}}if(typeof t==="number"){return t}throw new TypeError(`Expected number, got ${typeof t}: ${t}`)};const B=Math.ceil(2**127*(2-2**-23));const expectFloat32=t=>{const n=expectNumber(t);if(n!==undefined&&!Number.isNaN(n)&&n!==Infinity&&n!==-Infinity){if(Math.abs(n)>B){throw new TypeError(`Expected 32-bit float, got ${t}`)}}return n};const expectLong=t=>{if(t===null||t===undefined){return undefined}if(Number.isInteger(t)&&!Number.isNaN(t)){return t}throw new TypeError(`Expected integer, got ${typeof t}: ${t}`)};const Q=expectLong;const expectInt32=t=>expectSizedInt(t,32);const expectShort=t=>expectSizedInt(t,16);const expectByte=t=>expectSizedInt(t,8);const expectSizedInt=(t,n)=>{const i=expectLong(t);if(i!==undefined&&castInt(i,n)!==i){throw new TypeError(`Expected ${n}-bit integer, got ${t}`)}return i};const castInt=(t,n)=>{switch(n){case 32:return Int32Array.of(t)[0];case 16:return Int16Array.of(t)[0];case 8:return Int8Array.of(t)[0]}};const expectNonNull=(t,n)=>{if(t===null||t===undefined){if(n){throw new TypeError(`Expected a non-null value for ${n}`)}throw new TypeError("Expected a non-null value")}return t};const expectObject=t=>{if(t===null||t===undefined){return undefined}if(typeof t==="object"&&!Array.isArray(t)){return t}const n=Array.isArray(t)?"array":typeof t;throw new TypeError(`Expected object, got ${n}: ${t}`)};const expectString=t=>{if(t===null||t===undefined){return undefined}if(typeof t==="string"){return t}if(["boolean","number","bigint"].includes(typeof t)){k.warn(stackTraceWarning(`Expected string, got ${typeof t}: ${t}`));return String(t)}throw new TypeError(`Expected string, got ${typeof t}: ${t}`)};const expectUnion=t=>{if(t===null||t===undefined){return undefined}const n=expectObject(t);const i=[];for(const t in n){if(n[t]!=null){i.push(t)}}if(i.length===0){throw new TypeError(`Unions must have exactly one non-null member. None were found.`)}if(i.length>1){throw new TypeError(`Unions must have exactly one non-null member. Keys ${i} were not null.`)}return n};const strictParseDouble=t=>{if(typeof t=="string"){return expectNumber(parseNumber(t))}return expectNumber(t)};const w=strictParseDouble;const strictParseFloat32=t=>{if(typeof t=="string"){return expectFloat32(parseNumber(t))}return expectFloat32(t)};const S=/(-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?)|(-?Infinity)|(NaN)/g;const parseNumber=t=>{const n=t.match(S);if(n===null||n[0].length!==t.length){throw new TypeError(`Expected real number, got implicit NaN`)}return parseFloat(t)};const limitedParseDouble=t=>{if(typeof t=="string"){return parseFloatString(t)}return expectNumber(t)};const b=limitedParseDouble;const R=limitedParseDouble;const limitedParseFloat32=t=>{if(typeof t=="string"){return parseFloatString(t)}return expectFloat32(t)};const parseFloatString=t=>{switch(t){case"NaN":return NaN;case"Infinity":return Infinity;case"-Infinity":return-Infinity;default:throw new Error(`Unable to parse float value: ${t}`)}};const strictParseLong=t=>{if(typeof t==="string"){return expectLong(parseNumber(t))}return expectLong(t)};const v=strictParseLong;const strictParseInt32=t=>{if(typeof t==="string"){return expectInt32(parseNumber(t))}return expectInt32(t)};const strictParseShort=t=>{if(typeof t==="string"){return expectShort(parseNumber(t))}return expectShort(t)};const strictParseByte=t=>{if(typeof t==="string"){return expectByte(parseNumber(t))}return expectByte(t)};const stackTraceWarning=t=>String(new TypeError(t).stack||t).split("\n").slice(0,5).filter(t=>!t.includes("stackTraceWarning")).join("\n");const k={warn:console.warn};const D=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];const T=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function dateToUtcString(t){const n=t.getUTCFullYear();const i=t.getUTCMonth();const a=t.getUTCDay();const A=t.getUTCDate();const c=t.getUTCHours();const l=t.getUTCMinutes();const d=t.getUTCSeconds();const h=A<10?`0${A}`:`${A}`;const f=c<10?`0${c}`:`${c}`;const g=l<10?`0${l}`:`${l}`;const p=d<10?`0${d}`:`${d}`;return`${D[a]}, ${h} ${T[i]} ${n} ${f}:${g}:${p} GMT`}const N=new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?[zZ]$/);const parseRfc3339DateTime=t=>{if(t===null||t===undefined){return undefined}if(typeof t!=="string"){throw new TypeError("RFC-3339 date-times must be expressed as strings")}const n=N.exec(t);if(!n){throw new TypeError("Invalid RFC-3339 date-time value")}const[i,a,A,c,l,d,h,f]=n;const g=strictParseShort(stripLeadingZeroes(a));const p=parseDateValue(A,"month",1,12);const m=parseDateValue(c,"day",1,31);return buildDate(g,p,m,{hours:l,minutes:d,seconds:h,fractionalMilliseconds:f})};const M=new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(([-+]\d{2}\:\d{2})|[zZ])$/);const parseRfc3339DateTimeWithOffset=t=>{if(t===null||t===undefined){return undefined}if(typeof t!=="string"){throw new TypeError("RFC-3339 date-times must be expressed as strings")}const n=M.exec(t);if(!n){throw new TypeError("Invalid RFC-3339 date-time value")}const[i,a,A,c,l,d,h,f,g]=n;const p=strictParseShort(stripLeadingZeroes(a));const m=parseDateValue(A,"month",1,12);const E=parseDateValue(c,"day",1,31);const C=buildDate(p,m,E,{hours:l,minutes:d,seconds:h,fractionalMilliseconds:f});if(g.toUpperCase()!="Z"){C.setTime(C.getTime()-parseOffsetToMilliseconds(g))}return C};const F=new RegExp(/^(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d{2}) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? GMT$/);const x=new RegExp(/^(?:Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d{2})-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d{2}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? GMT$/);const U=new RegExp(/^(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( [1-9]|\d{2}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? (\d{4})$/);const parseRfc7231DateTime=t=>{if(t===null||t===undefined){return undefined}if(typeof t!=="string"){throw new TypeError("RFC-7231 date-times must be expressed as strings")}let n=F.exec(t);if(n){const[t,i,a,A,c,l,d,h]=n;return buildDate(strictParseShort(stripLeadingZeroes(A)),parseMonthByShortName(a),parseDateValue(i,"day",1,31),{hours:c,minutes:l,seconds:d,fractionalMilliseconds:h})}n=x.exec(t);if(n){const[t,i,a,A,c,l,d,h]=n;return adjustRfc850Year(buildDate(parseTwoDigitYear(A),parseMonthByShortName(a),parseDateValue(i,"day",1,31),{hours:c,minutes:l,seconds:d,fractionalMilliseconds:h}))}n=U.exec(t);if(n){const[t,i,a,A,c,l,d,h]=n;return buildDate(strictParseShort(stripLeadingZeroes(h)),parseMonthByShortName(i),parseDateValue(a.trimLeft(),"day",1,31),{hours:A,minutes:c,seconds:l,fractionalMilliseconds:d})}throw new TypeError("Invalid RFC-7231 date-time value")};const parseEpochTimestamp=t=>{if(t===null||t===undefined){return undefined}let n;if(typeof t==="number"){n=t}else if(typeof t==="string"){n=strictParseDouble(t)}else if(typeof t==="object"&&t.tag===1){n=t.value}else{throw new TypeError("Epoch timestamps must be expressed as floating point numbers or their string representation")}if(Number.isNaN(n)||n===Infinity||n===-Infinity){throw new TypeError("Epoch timestamps must be valid, non-Infinite, non-NaN numerics")}return new Date(Math.round(n*1e3))};const buildDate=(t,n,i,a)=>{const A=n-1;validateDayOfMonth(t,A,i);return new Date(Date.UTC(t,A,i,parseDateValue(a.hours,"hour",0,23),parseDateValue(a.minutes,"minute",0,59),parseDateValue(a.seconds,"seconds",0,60),parseMilliseconds(a.fractionalMilliseconds)))};const parseTwoDigitYear=t=>{const n=(new Date).getUTCFullYear();const i=Math.floor(n/100)*100+strictParseShort(stripLeadingZeroes(t));if(i{if(t.getTime()-(new Date).getTime()>P){return new Date(Date.UTC(t.getUTCFullYear()-100,t.getUTCMonth(),t.getUTCDate(),t.getUTCHours(),t.getUTCMinutes(),t.getUTCSeconds(),t.getUTCMilliseconds()))}return t};const parseMonthByShortName=t=>{const n=T.indexOf(t);if(n<0){throw new TypeError(`Invalid month: ${t}`)}return n+1};const L=[31,28,31,30,31,30,31,31,30,31,30,31];const validateDayOfMonth=(t,n,i)=>{let a=L[n];if(n===1&&isLeapYear(t)){a=29}if(i>a){throw new TypeError(`Invalid day for ${T[n]} in ${t}: ${i}`)}};const isLeapYear=t=>t%4===0&&(t%100!==0||t%400===0);const parseDateValue=(t,n,i,a)=>{const A=strictParseByte(stripLeadingZeroes(t));if(Aa){throw new TypeError(`${n} must be between ${i} and ${a}, inclusive`)}return A};const parseMilliseconds=t=>{if(t===null||t===undefined){return 0}return strictParseFloat32("0."+t)*1e3};const parseOffsetToMilliseconds=t=>{const n=t[0];let i=1;if(n=="+"){i=1}else if(n=="-"){i=-1}else{throw new TypeError(`Offset direction, ${n}, must be "+" or "-"`)}const a=Number(t.substring(1,3));const A=Number(t.substring(4,6));return i*(a*60+A)*60*1e3};const stripLeadingZeroes=t=>{let n=0;while(n{if(t&&typeof t==="object"&&(t instanceof O||"deserializeJSON"in t)){return t}else if(typeof t==="string"||Object.getPrototypeOf(t)===String.prototype){return O(String(t))}return O(JSON.stringify(t))};O.fromObject=O.from;function quoteHeader(t){if(t.includes(",")||t.includes('"')){t=`"${t.replace(/"/g,'\\"')}"`}return t}const H=`(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun)(?:[ne|u?r]?s?day)?`;const $=`(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)`;const G=`(\\d?\\d):(\\d{2}):(\\d{2})(?:\\.(\\d+))?`;const V=`(\\d?\\d)`;const Y=`(\\d{4})`;const J=new RegExp(/^(\d{4})-(\d\d)-(\d\d)[tT](\d\d):(\d\d):(\d\d)(\.(\d+))?(([-+]\d\d:\d\d)|[zZ])$/);const W=new RegExp(`^${H}, ${V} ${$} ${Y} ${G} GMT$`);const q=new RegExp(`^${H}, ${V}-${$}-(\\d\\d) ${G} GMT$`);const j=new RegExp(`^${H} ${$} ( [1-9]|\\d\\d) ${G} ${Y}$`);const z=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];const _parseEpochTimestamp=t=>{if(t==null){return void 0}let n=NaN;if(typeof t==="number"){n=t}else if(typeof t==="string"){if(!/^-?\d*\.?\d+$/.test(t)){throw new TypeError(`parseEpochTimestamp - numeric string invalid.`)}n=Number.parseFloat(t)}else if(typeof t==="object"&&t.tag===1){n=t.value}if(isNaN(n)||Math.abs(n)===Infinity){throw new TypeError("Epoch timestamps must be valid finite numbers.")}return new Date(Math.round(n*1e3))};const _parseRfc3339DateTimeWithOffset=t=>{if(t==null){return void 0}if(typeof t!=="string"){throw new TypeError("RFC3339 timestamps must be strings")}const n=J.exec(t);if(!n){throw new TypeError(`Invalid RFC3339 timestamp format ${t}`)}const[,i,a,A,c,l,d,,h,f]=n;range(a,1,12);range(A,1,31);range(c,0,23);range(l,0,59);range(d,0,60);const g=new Date(Date.UTC(Number(i),Number(a)-1,Number(A),Number(c),Number(l),Number(d),Number(h)?Math.round(parseFloat(`0.${h}`)*1e3):0));g.setUTCFullYear(Number(i));if(f.toUpperCase()!="Z"){const[,t,n,i]=/([+-])(\d\d):(\d\d)/.exec(f)||[void 0,"+",0,0];const a=t==="-"?1:-1;g.setTime(g.getTime()+a*(Number(n)*60*60*1e3+Number(i)*60*1e3))}return g};const _parseRfc7231DateTime=t=>{if(t==null){return void 0}if(typeof t!=="string"){throw new TypeError("RFC7231 timestamps must be strings.")}let n;let i;let a;let A;let c;let l;let d;let h;if(h=W.exec(t)){[,n,i,a,A,c,l,d]=h}else if(h=q.exec(t)){[,n,i,a,A,c,l,d]=h;a=(Number(a)+1900).toString()}else if(h=j.exec(t)){[,i,n,A,c,l,d,a]=h}if(a&&l){const t=Date.UTC(Number(a),z.indexOf(i),Number(n),Number(A),Number(c),Number(l),d?Math.round(parseFloat(`0.${d}`)*1e3):0);range(n,1,31);range(A,0,23);range(c,0,59);range(l,0,60);const h=new Date(t);h.setUTCFullYear(Number(a));return h}throw new TypeError(`Invalid RFC7231 date-time value ${t}.`)};function range(t,n,i){const a=Number(t);if(ai){throw new Error(`Value ${a} out of range [${n}, ${i}]`)}}function splitEvery(t,n,i){if(i<=0||!Number.isInteger(i)){throw new Error("Invalid number of delimiters ("+i+") for splitEvery.")}const a=t.split(n);if(i===1){return a}const A=[];let c="";for(let t=0;t{const n=t.length;const i=[];let a=false;let A=undefined;let c=0;for(let l=0;l{t=t.trim();const n=t.length;if(n<2){return t}if(t[0]===`"`&&t[n-1]===`"`){t=t.slice(1,n-1)}return t.replace(/\\"/g,'"')})};const K=/^-?\d*(\.\d+)?$/;class NumericValue{string;type;constructor(t,n){this.string=t;this.type=n;if(!K.test(t)){throw new Error(`@smithy/core/serde - NumericValue must only contain [0-9], at most one decimal point ".", and an optional negation prefix "-".`)}}toString(){return this.string}static[Symbol.hasInstance](t){if(!t||typeof t!=="object"){return false}const n=t;return NumericValue.prototype.isPrototypeOf(t)||n.type==="bigDecimal"&&K.test(n.string)}}function nv(t){return new NumericValue(String(t),"bigDecimal")}const Z={};const X={};for(let t=0;t<256;t++){let n=t.toString(16).toLowerCase();if(n.length===1){n=`0${n}`}Z[t]=n;X[n]=t}function fromHex(t){if(t.length%2!==0){throw new Error("Hex encoded strings must have an even number length")}const n=new Uint8Array(t.length/2);for(let i=0;i{if(!t){return 0}if(typeof t==="string"){return Buffer.byteLength(t)}else if(typeof t.byteLength==="number"){return t.byteLength}else if(typeof t.size==="number"){return t.size}else if(typeof t.start==="number"&&typeof t.end==="number"){return t.end+1-t.start}else if(t instanceof l){if(t.path!=null){return d(t.path).size}else if(typeof t.fd==="number"){return h(t.fd).size}}throw new Error(`Body Length computation failed for ${t}`)};const toUint8Array=t=>{if(t instanceof Uint8Array){return t}if(typeof t==="string"){return fromUtf8$1(t)}if(ArrayBuffer.isView(t)){return new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT)}return new Uint8Array(t)};function concatBytes(t,n){if(n===undefined){n=0;for(const i of t){n+=i.byteLength}}const i=new Uint8Array(n);let a=0;for(const n of t){i.set(n,a);a+=n.byteLength}return i}const deserializerMiddleware=(t,n)=>(i,a)=>async A=>{const{response:c}=await i(A);try{const i=await n(c,t);return{response:c,output:i}}catch(t){Object.defineProperty(t,"$response",{value:c,enumerable:false,writable:false,configurable:false});if(!("$metadata"in t)){const n=`Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.`;try{t.message+="\n "+n}catch(t){if(!a.logger||a.logger?.constructor?.name==="NoOpLogger"){console.warn(n)}else{a.logger?.warn?.(n)}}if(typeof t.$responseBodyText!=="undefined"){if(t.$response){t.$response.body=t.$responseBodyText}}try{if(f.isInstance(c)){const{headers:n={}}=c;const i=Object.entries(n);t.$metadata={httpStatusCode:c.statusCode,requestId:findHeader(/^x-[\w-]+-request-?id$/,i),extendedRequestId:findHeader(/^x-[\w-]+-id-2$/,i),cfId:findHeader(/^x-[\w-]+-cf-id$/,i)}}}catch(t){}}throw t}};const findHeader=(t,n)=>(n.find(([n])=>n.match(t))||[void 0,void 0])[1];const serializerMiddleware=(t,n)=>(i,a)=>async A=>{const c=t;const l=a.endpointV2?async()=>g(a.endpointV2):c.endpoint;if(!l){throw new Error("No valid endpoint provider available.")}const d=await n(A.input,{...t,endpoint:l});return i({...A,request:d})};const ee={name:"deserializerMiddleware",step:"deserialize",tags:["DESERIALIZER"],override:true};const te={name:"serializerMiddleware",step:"serialize",tags:["SERIALIZER"],override:true};function getSerdePlugin(t,n,i){return{applyToStack:a=>{a.add(deserializerMiddleware(t,i),ee);a.add(serializerMiddleware(t,n),te)}}}class Hash{algorithmIdentifier;secret;hash;constructor(t,n){this.algorithmIdentifier=t;this.secret=n;this.reset()}update(t,n){this.hash.update(toUint8Array(castSourceData(t,n)))}digest(){return Promise.resolve(this.hash.digest())}reset(){this.hash=this.secret?a(this.algorithmIdentifier,castSourceData(this.secret)):A(this.algorithmIdentifier)}}function castSourceData(t,n){if(Buffer.isBuffer(t)){return t}if(typeof t==="string"){return fromString(t,n)}if(ArrayBuffer.isView(t)){return fromArrayBuffer(t.buffer,t.byteOffset,t.byteLength)}return fromArrayBuffer(t)}let re=class ChecksumStream extends p{expectedChecksum;checksumSourceLocation;checksum;source;base64Encoder;pendingCallback=null;constructor({expectedChecksum:t,checksum:n,source:i,checksumSourceLocation:a,base64Encoder:A}){super();if(typeof i.pipe==="function"){this.source=i}else{throw new Error(`@smithy/util-stream: unsupported source type ${i?.constructor?.name??i} in ChecksumStream.`)}this.base64Encoder=A??toBase64$1;this.expectedChecksum=t;this.checksum=n;this.checksumSourceLocation=a;this.source.pipe(this)}_read(t){if(this.pendingCallback){const t=this.pendingCallback;this.pendingCallback=null;t()}}_write(t,n,i){try{this.checksum.update(t);const n=this.push(t);if(!n){this.pendingCallback=i;return}}catch(t){return i(t)}return i()}async _final(t){try{const n=await this.checksum.digest();const i=this.base64Encoder(n);if(this.expectedChecksum!==i){return t(new Error(`Checksum mismatch: expected "${this.expectedChecksum}" but received "${i}"`+` in response header "${this.checksumSourceLocation}".`))}}catch(n){return t(n)}this.push(null);return t()}_destroy(t,n){this.source?.destroy();n(t)}};const isReadableStream=t=>typeof ReadableStream==="function"&&(t?.constructor?.name===ReadableStream.name||t instanceof ReadableStream);const isBlob=t=>typeof Blob==="function"&&(t?.constructor?.name===Blob.name||t instanceof Blob);const fromUtf8=t=>(new TextEncoder).encode(t);const ne=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`;Object.entries(ne).reduce((t,[n,i])=>{t[i]=Number(n);return t},{});const se=ne.split("");const oe=6;const ie=8;const ae=63;function toBase64(t){let n;if(typeof t==="string"){n=fromUtf8(t)}else{n=t}const i=typeof n==="object"&&typeof n.length==="number";const a=typeof n==="object"&&typeof n.byteOffset==="number"&&typeof n.byteLength==="number";if(!i&&!a){throw new Error("@smithy/util-base64: toBase64 encoder function only accepts string | Uint8Array.")}let A="";for(let t=0;t>n]}A+="==".slice(0,4-c)}return A}const Ae=typeof ReadableStream==="function"?ReadableStream:function(){};class ChecksumStream extends Ae{}const createChecksumStream$1=({expectedChecksum:t,checksum:n,source:i,checksumSourceLocation:a,base64Encoder:A})=>{if(!isReadableStream(i)){throw new Error(`@smithy/util-stream: unsupported source type ${i?.constructor?.name??i} in ChecksumStream.`)}const c=A??toBase64;if(typeof TransformStream!=="function"){throw new Error("@smithy/util-stream: unable to instantiate ChecksumStream because API unavailable: ReadableStream/TransformStream.")}const l=new TransformStream({start(){},async transform(t,i){n.update(t);i.enqueue(t)},async flush(i){const A=await n.digest();const l=c(A);if(t!==l){const n=new Error(`Checksum mismatch: expected "${t}" but received "${l}"`+` in response header "${a}".`);i.error(n)}else{i.terminate()}}});i.pipeThrough(l);const d=l.readable;Object.setPrototypeOf(d,ChecksumStream.prototype);return d};function createChecksumStream(t){if(typeof ReadableStream==="function"&&isReadableStream(t.source)){return createChecksumStream$1(t)}return new re(t)}class ByteArrayCollector{allocByteArray;byteLength=0;byteArrays=[];constructor(t){this.allocByteArray=t}push(t){this.byteArrays.push(t);this.byteLength+=t.byteLength}flush(){if(this.byteArrays.length===1){const t=this.byteArrays[0];this.reset();return t}const t=this.allocByteArray(this.byteLength);let n=0;for(let i=0;inew Uint8Array(t))];let d=-1;const pull=async t=>{const{value:h,done:f}=await a.read();const g=h;if(f){if(d!==-1){const n=flush(l,d);if(sizeOf(n)>0){t.enqueue(n)}}t.close()}else{const a=modeOf(g,false);if(d!==a){if(d>=0){t.enqueue(flush(l,d))}d=a}if(d===-1){t.enqueue(g);return}const h=sizeOf(g);c+=h;const f=sizeOf(l[d]);if(h>=n&&f===0){t.enqueue(g)}else{const a=merge(l,d,g);if(!A&&c>n*2){A=true;i?.warn(`@smithy/util-stream - stream chunk size ${h} is below threshold of ${n}, automatically buffering.`)}if(a>=n){t.enqueue(flush(l,d))}else{await pull(t)}}}};return new ReadableStream({pull:pull})}function merge(t,n,i){switch(n){case 0:t[0]+=i;return sizeOf(t[0]);case 1:case 2:t[n].push(i);return sizeOf(t[n])}}function flush(t,n){switch(n){case 0:const i=t[0];t[0]="";return i;case 1:case 2:return t[n].flush()}throw new Error(`@smithy/util-stream - invalid index ${n} given to flush()`)}function sizeOf(t){return t?.byteLength??t?.length??0}function modeOf(t,n=true){if(n&&typeof Buffer!=="undefined"&&t instanceof Buffer){return 2}if(t instanceof Uint8Array){return 1}if(typeof t==="string"){return 0}return-1}function createBufferedReadable(t,n,i){if(isReadableStream(t)){return createBufferedReadableStream(t,n,i)}const a=new m({read(){}});let A=false;let c=0;const l=["",new ByteArrayCollector(t=>new Uint8Array(t)),new ByteArrayCollector(t=>Buffer.from(new Uint8Array(t)))];let d=-1;t.on("data",t=>{const h=modeOf(t,true);if(d!==h){if(d>=0){a.push(flush(l,d))}d=h}if(d===-1){a.push(t);return}const f=sizeOf(t);c+=f;const g=sizeOf(l[d]);if(f>=n&&g===0){a.push(t)}else{const h=merge(l,d,t);if(!A&&c>n*2){A=true;i?.warn(`@smithy/util-stream - stream chunk size ${f} is below threshold of ${n}, automatically buffering.`)}if(h>=n){a.push(flush(l,d))}}});t.on("end",()=>{if(d!==-1){const t=flush(l,d);if(sizeOf(t)>0){a.push(t)}}a.push(null)});return a}const getAwsChunkedEncodingStream$1=(t,n)=>{const{base64Encoder:i,bodyLengthChecker:a,checksumAlgorithmFn:A,checksumLocationName:c,streamHasher:l}=n;const d=i!==undefined&&a!==undefined&&A!==undefined&&c!==undefined&&l!==undefined;const h=d?l(A,t):undefined;const f=t.getReader();return new ReadableStream({async pull(t){const{value:n,done:A}=await f.read();if(A){t.enqueue(`0\r\n`);if(d){const n=i(await h);t.enqueue(`${c}:${n}\r\n`);t.enqueue(`\r\n`)}t.close()}else{t.enqueue(`${(a(n)||0).toString(16)}\r\n${n}\r\n`)}}})};function getAwsChunkedEncodingStream(t,n){const i=t;const a=t;if(isReadableStream(a)){return getAwsChunkedEncodingStream$1(a,n)}const{base64Encoder:A,bodyLengthChecker:c,checksumAlgorithmFn:l,checksumLocationName:d,streamHasher:h}=n;const f=A!==undefined&&l!==undefined&&d!==undefined&&h!==undefined;const g=f?h(l,i):undefined;const p=new m({read:()=>{}});i.on("data",t=>{const n=c(t)||0;if(n===0){return}p.push(`${n.toString(16)}\r\n`);p.push(t);p.push("\r\n")});i.on("end",async()=>{p.push(`0\r\n`);if(f){const t=A(await g);p.push(`${d}:${t}\r\n`);p.push(`\r\n`)}p.push(null)});return p}async function headStream$1(t,n){let i=0;const a=[];const A=t.getReader();let c=false;while(!c){const{done:t,value:l}=await A.read();if(l){a.push(l);i+=l?.byteLength??0}if(i>=n){break}c=t}A.releaseLock();const l=new Uint8Array(Math.min(n,i));let d=0;for(const t of a){if(t.byteLength>l.byteLength-d){l.set(t.subarray(0,l.byteLength-d),d);break}else{l.set(t,d)}d+=t.length}return l}const headStream=(t,n)=>{if(isReadableStream(t)){return headStream$1(t,n)}return new Promise((i,a)=>{const A=new ce;A.limit=n;t.pipe(A);t.on("error",t=>{A.end();a(t)});A.on("error",a);A.on("finish",function(){const t=concatBytes(this.buffers);i(t)})})};let ce=class Collector extends E{buffers=[];limit=Infinity;bytesBuffered=0;_write(t,n,i){this.buffers.push(t);this.bytesBuffered+=t.byteLength??0;if(this.bytesBuffered>=this.limit){const t=this.bytesBuffered-this.limit;const n=this.buffers[this.buffers.length-1];this.buffers[this.buffers.length-1]=n.subarray(0,n.byteLength-t);this.emit("finish")}i()}};const toUtf8=t=>{if(typeof t==="string"){return t}if(typeof t!=="object"||typeof t.byteOffset!=="number"||typeof t.byteLength!=="number"){throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.")}return new TextDecoder("utf-8").decode(t)};const streamCollector$1=async t=>{if(isBlob(t)){return collectBlob(t)}return collectReadableStream(t)};async function collectBlob(t){return t.arrayBuffer().then(t=>new Uint8Array(t))}async function collectReadableStream(t){const n=[];const i=t.getReader();let a=0;while(true){const{done:t,value:A}=await i.read();if(A){n.push(A);a+=A.length}if(t){break}}return concatBytes(n,a)}const le="The stream has already been transformed.";const sdkStreamMixin$1=t=>{if(!isBlobInstance(t)&&!isReadableStream(t)){const n=t?.__proto__?.constructor?.name||t;throw new Error(`Unexpected stream implementation, expect Blob or ReadableStream, got ${n}`)}let n=false;const transformToByteArray=async()=>{if(n){throw new Error(le)}n=true;return await streamCollector$1(t)};const blobToWebStream=t=>{if(typeof t.stream!=="function"){throw new Error("Cannot transform payload Blob to web stream. Please make sure the Blob.stream() is polyfilled.\n"+"If you are using React Native, this API is not yet supported, see: https://react-native.canny.io/feature-requests/p/fetch-streaming-body")}return t.stream()};return Object.assign(t,{transformToByteArray:transformToByteArray,transformToString:async t=>{const n=await transformToByteArray();if(t==="base64"){return toBase64(n)}else if(t==="hex"){return toHex(n)}else if(t===undefined||t==="utf8"||t==="utf-8"){return toUtf8(n)}else if(typeof TextDecoder==="function"){return new TextDecoder(t).decode(n)}else{throw new Error("TextDecoder is not available, please make sure polyfill is provided.")}},transformToWebStream:()=>{if(n){throw new Error(le)}n=true;if(isBlobInstance(t)){return blobToWebStream(t)}else if(isReadableStream(t)){return t}else{throw new Error(`Cannot transform payload to web stream, got ${t}`)}}})};const isBlobInstance=t=>typeof Blob==="function"&&t instanceof Blob;const streamCollector=t=>{if(isBlob(t)){return collectBlob(t)}if(isReadableStream(t)){return collectReadableStream(t)}return new Promise((n,i)=>{const a=new Collector;const A=t;A.pipe(a);A.on("error",t=>{a.end();i(t)});a.on("error",i);a.on("finish",function(){const t=concatBytes(this.bufferedBytes);n(t)})})};class Collector extends E{bufferedBytes=[];_write(t,n,i){this.bufferedBytes.push(t);i()}}const ue="The stream has already been transformed.";const sdkStreamMixin=t=>{if(!(t instanceof m)){try{return sdkStreamMixin$1(t)}catch(n){const i=t?.__proto__?.constructor?.name||t;throw new Error(`Unexpected stream implementation, expect Stream.Readable instance, got ${i}`)}}let n=false;const transformToByteArray=async()=>{if(n){throw new Error(ue)}n=true;return await streamCollector(t)};return Object.assign(t,{transformToByteArray:transformToByteArray,transformToString:async t=>{const n=await transformToByteArray();if(t===undefined||Buffer.isEncoding(t)){return fromArrayBuffer(n.buffer,n.byteOffset,n.byteLength).toString(t)}else{const i=new TextDecoder(t);return i.decode(n)}},transformToWebStream:()=>{if(n){throw new Error(ue)}if(t.readableFlowing!==null){throw new Error("The stream has been consumed by other callbacks.")}if(typeof m.toWeb!=="function"){throw new Error("Readable.toWeb() is not supported. Please ensure a polyfill is available.")}n=true;return m.toWeb(t)}})};async function splitStream$1(t){if(typeof t.stream==="function"){t=t.stream()}const n=t;return n.tee()}async function splitStream(t){if(isReadableStream(t)||isBlob(t)){return splitStream$1(t)}const n=new C;const i=new C;t.pipe(n);t.pipe(i);return[n,i]}class Uint8ArrayBlobAdapter extends(bindUint8ArrayBlobAdapter(toUtf8$1,fromUtf8$1,toBase64$1,fromBase64)){}const de=c;const he=bindV4(de);const fe=he;n.ChecksumStream=re;n.Hash=Hash;n.LazyJsonString=O;n.NumericValue=NumericValue;n.Uint8ArrayBlobAdapter=Uint8ArrayBlobAdapter;n._parseEpochTimestamp=_parseEpochTimestamp;n._parseRfc3339DateTimeWithOffset=_parseRfc3339DateTimeWithOffset;n._parseRfc7231DateTime=_parseRfc7231DateTime;n.calculateBodyLength=calculateBodyLength;n.concatBytes=concatBytes;n.copyDocumentWithTransform=copyDocumentWithTransform;n.createBufferedReadable=createBufferedReadable;n.createChecksumStream=createChecksumStream;n.dateToUtcString=dateToUtcString;n.deserializerMiddleware=deserializerMiddleware;n.deserializerMiddlewareOption=ee;n.expectBoolean=expectBoolean;n.expectByte=expectByte;n.expectFloat32=expectFloat32;n.expectInt=Q;n.expectInt32=expectInt32;n.expectLong=expectLong;n.expectNonNull=expectNonNull;n.expectNumber=expectNumber;n.expectObject=expectObject;n.expectShort=expectShort;n.expectString=expectString;n.expectUnion=expectUnion;n.fromArrayBuffer=fromArrayBuffer;n.fromBase64=fromBase64;n.fromHex=fromHex;n.fromString=fromString;n.fromUtf8=fromUtf8$1;n.generateIdempotencyToken=fe;n.getAwsChunkedEncodingStream=getAwsChunkedEncodingStream;n.getSerdePlugin=getSerdePlugin;n.handleFloat=b;n.headStream=headStream;n.isArrayBuffer=isArrayBuffer;n.isBlob=isBlob;n.isReadableStream=isReadableStream;n.limitedParseDouble=limitedParseDouble;n.limitedParseFloat=R;n.limitedParseFloat32=limitedParseFloat32;n.logger=k;n.nv=nv;n.parseBoolean=parseBoolean;n.parseEpochTimestamp=parseEpochTimestamp;n.parseRfc3339DateTime=parseRfc3339DateTime;n.parseRfc3339DateTimeWithOffset=parseRfc3339DateTimeWithOffset;n.parseRfc7231DateTime=parseRfc7231DateTime;n.quoteHeader=quoteHeader;n.sdkStreamMixin=sdkStreamMixin;n.serializerMiddleware=serializerMiddleware;n.serializerMiddlewareOption=te;n.splitEvery=splitEvery;n.splitHeader=splitHeader;n.splitStream=splitStream;n.streamCollector=streamCollector;n.strictParseByte=strictParseByte;n.strictParseDouble=strictParseDouble;n.strictParseFloat=w;n.strictParseFloat32=strictParseFloat32;n.strictParseInt=v;n.strictParseInt32=strictParseInt32;n.strictParseLong=strictParseLong;n.strictParseShort=strictParseShort;n.toBase64=toBase64$1;n.toHex=toHex;n.toUint8Array=toUint8Array;n.toUtf8=toUtf8$1;n.v4=he},4534:(t,n,i)=>{const{SMITHY_CONTEXT_KEY:a}=i(690);const getSmithyContext=t=>t[a]||(t[a]={});class HttpRequest{method;protocol;hostname;port;path;query;headers;username;password;fragment;body;constructor(t){this.method=t.method||"GET";this.hostname=t.hostname||"localhost";this.port=t.port;this.query=t.query||{};this.headers=t.headers||{};this.body=t.body;this.protocol=t.protocol?t.protocol.slice(-1)!==":"?`${t.protocol}:`:t.protocol:"https:";this.path=t.path?t.path.charAt(0)!=="/"?`/${t.path}`:t.path:"/";this.username=t.username;this.password=t.password;this.fragment=t.fragment}static clone(t){const n=new HttpRequest({...t,headers:{...t.headers}});if(n.query){n.query=cloneQuery(n.query)}return n}static isInstance(t){if(!t){return false}const n=t;return"method"in n&&"protocol"in n&&"hostname"in n&&"path"in n&&typeof n["query"]==="object"&&typeof n["headers"]==="object"}clone(){return HttpRequest.clone(this)}}function cloneQuery(t){return Object.keys(t).reduce((n,i)=>{const a=t[i];return{...n,[i]:Array.isArray(a)?[...a]:a}},{})}class HttpResponse{statusCode;reason;headers;body;constructor(t){this.statusCode=t.statusCode;this.reason=t.reason;this.headers=t.headers||{};this.body=t.body}static isInstance(t){if(!t)return false;const n=t;return typeof n.statusCode==="number"&&typeof n.headers==="object"}}const A=new RegExp(`^(?!.*-$)(?!-)[a-zA-Z0-9-]{1,63}$`);const isValidHostLabel=(t,n=false)=>{if(!n){return A.test(t)}const i=t.split(".");for(const t of i){if(!isValidHostLabel(t)){return false}}return true};function isValidHostname(t){const n=/^[a-z0-9][a-z0-9\.\-]*[a-z0-9]$/;return n.test(t)}const normalizeProvider=t=>{if(typeof t==="function")return t;const n=Promise.resolve(t);return()=>n};function parseQueryString(t){const n={};t=t.replace(/^\?/,"");if(t){for(const i of t.split("&")){let[t,a=null]=i.split("=");t=decodeURIComponent(t);if(a){a=decodeURIComponent(a)}if(!(t in n)){n[t]=a}else if(Array.isArray(n[t])){n[t].push(a)}else{n[t]=[n[t],a]}}}return n}const parseUrl=t=>{if(typeof t==="string"){return parseUrl(new URL(t))}const{hostname:n,pathname:i,port:a,protocol:A,search:c}=t;let l;if(c){l=parseQueryString(c)}return{hostname:n,port:a?parseInt(a):undefined,protocol:A,path:i,query:l}};const toEndpointV1=t=>{if(typeof t==="object"){if("url"in t){const n=parseUrl(t.url);if(t.headers){n.headers={};for(const i in t.headers){n.headers[i.toLowerCase()]=t.headers[i].join(", ")}}return n}return t}return parseUrl(t)};n.HttpRequest=HttpRequest;n.HttpResponse=HttpResponse;n.getSmithyContext=getSmithyContext;n.isValidHostLabel=isValidHostLabel;n.isValidHostname=isValidHostname;n.normalizeProvider=normalizeProvider;n.parseQueryString=parseQueryString;n.parseUrl=parseUrl;n.toEndpointV1=toEndpointV1},566:(t,n,i)=>{const{ProviderError:a,CredentialsProviderError:A,loadConfig:c}=i(7291);const l=i(7067);const{parseUrl:d}=i(3422);const isImdsCredentials=t=>Boolean(t)&&typeof t==="object"&&typeof t.AccessKeyId==="string"&&typeof t.SecretAccessKey==="string"&&typeof t.Token==="string"&&typeof t.Expiration==="string";const fromImdsCredentials=t=>({accessKeyId:t.AccessKeyId,secretAccessKey:t.SecretAccessKey,sessionToken:t.Token,expiration:new Date(t.Expiration),...t.AccountId&&{accountId:t.AccountId}});const h=1e3;const f=0;const providerConfigFromInit=({maxRetries:t=f,timeout:n=h})=>({maxRetries:t,timeout:n});function httpRequest(t){return new Promise((n,i)=>{const A=l.request({method:"GET",...t,hostname:t.hostname?.replace(/^\[(.+)\]$/,"$1")});A.on("error",t=>{i(Object.assign(new a("Unable to connect to instance metadata service"),t));A.destroy()});A.on("timeout",()=>{i(new a("TimeoutError from instance metadata service"));A.destroy()});A.on("response",t=>{const{statusCode:c=400}=t;if(c<200||300<=c){i(Object.assign(new a("Error response received from instance metadata service"),{statusCode:c}));A.destroy()}const l=[];t.on("data",t=>{l.push(t)});t.on("end",()=>{n(Buffer.concat(l));A.destroy()})});A.end()})}const retry=(t,n)=>{let i=t();for(let a=0;a{const{timeout:n,maxRetries:i}=providerConfigFromInit(t);return()=>retry(async()=>{const i=await getCmdsUri({logger:t.logger});const a=JSON.parse(await requestFromEcsImds(n,i));if(!isImdsCredentials(a)){throw new A("Invalid response received from instance metadata service.",{logger:t.logger})}return fromImdsCredentials(a)},i)};const requestFromEcsImds=async(t,n)=>{if(process.env[m]){n.headers={...n.headers,Authorization:process.env[m]}}const i=await httpRequest({...n,timeout:t});return i.toString()};const E="169.254.170.2";const C=new Set(["localhost","127.0.0.1"]);const I=new Set(["http:","https:"]);const getCmdsUri=async({logger:t})=>{if(process.env[p]){return{hostname:E,path:process.env[p]}}if(process.env[g]){let n;try{n=new URL(process.env[g])}catch{throw new A(`${process.env[g]} is not a valid container metadata service URL`,{tryNextLink:false,logger:t})}if(!n.hostname||!C.has(n.hostname)){throw new A(`${n.hostname} is not a valid container metadata service hostname`,{tryNextLink:false,logger:t})}if(!n.protocol||!I.has(n.protocol)){throw new A(`${n.protocol} is not a valid container metadata service protocol`,{tryNextLink:false,logger:t})}return{protocol:n.protocol,hostname:n.hostname,path:n.pathname+n.search,port:n.port?parseInt(n.port,10):undefined}}throw new A("The container metadata credential provider cannot be used unless"+` the ${p} or ${g} environment`+" variable is set",{tryNextLink:false,logger:t})};class InstanceMetadataV1FallbackError extends A{tryNextLink;name="InstanceMetadataV1FallbackError";constructor(t,n=true){super(t,n);this.tryNextLink=n;Object.setPrototypeOf(this,InstanceMetadataV1FallbackError.prototype)}}var y;(function(t){t["IPv4"]="http://169.254.169.254";t["IPv6"]="http://[fd00:ec2::254]"})(y||(y={}));const B="AWS_EC2_METADATA_SERVICE_ENDPOINT";const Q="ec2_metadata_service_endpoint";const w={environmentVariableSelector:t=>t[B],configFileSelector:t=>t[Q],default:undefined};var S;(function(t){t["IPv4"]="IPv4";t["IPv6"]="IPv6"})(S||(S={}));const b="AWS_EC2_METADATA_SERVICE_ENDPOINT_MODE";const R="ec2_metadata_service_endpoint_mode";const v={environmentVariableSelector:t=>t[b],configFileSelector:t=>t[R],default:S.IPv4};const getInstanceMetadataEndpoint=async()=>d(await getFromEndpointConfig()||await getFromEndpointModeConfig());const getFromEndpointConfig=async()=>c(w)();const getFromEndpointModeConfig=async()=>{const t=await c(v)();switch(t){case S.IPv4:return y.IPv4;case S.IPv6:return y.IPv6;default:throw new Error(`Unsupported endpoint mode: ${t}.`+` Select from ${Object.values(S)}`)}};const k=5*60;const D=5*60;const T="https://docs.aws.amazon.com/sdkref/latest/guide/feature-static-credentials.html";const getExtendedInstanceMetadataCredentials=(t,n)=>{const i=k+Math.floor(Math.random()*D);const a=new Date(Date.now()+i*1e3);n.warn("Attempting credential expiration extension due to a credential service availability issue. A refresh of these "+`credentials will be attempted after ${new Date(a)}.\nFor more information, please visit: `+T);const A=t.originalExpiration??t.expiration;return{...t,...A?{originalExpiration:A}:{},expiration:a}};const staticStabilityProvider=(t,n={})=>{const i=n?.logger||console;let a;return async()=>{let n;try{n=await t();if(n.expiration&&n.expiration.getTime()staticStabilityProvider(getInstanceMetadataProvider(t),{logger:t.logger});const getInstanceMetadataProvider=(t={})=>{let n=false;const{logger:i,profile:a}=t;const{timeout:l,maxRetries:d}=providerConfigFromInit(t);const getCredentials=async(i,l)=>{const d=n||l.headers?.[U]==null;if(d){let n=false;let i=false;const l=await c({environmentVariableSelector:n=>{const a=n[F];i=!!a&&a!=="false";if(a===undefined){throw new A(`${F} not set in env, checking config file next.`,{logger:t.logger})}return i},configFileSelector:t=>{const i=t[x];n=!!i&&i!=="false";return n},default:false},{profile:a})();if(t.ec2MetadataV1Disabled||l){const a=[];if(t.ec2MetadataV1Disabled)a.push("credential provider initialization (runtime option ec2MetadataV1Disabled)");if(n)a.push(`config file profile (${x})`);if(i)a.push(`process environment variable (${F})`);throw new InstanceMetadataV1FallbackError(`AWS EC2 Metadata v1 fallback has been blocked by AWS SDK configuration in the following: [${a.join(", ")}].`)}}const h=(await retry(async()=>{let t;try{t=await getProfile(l)}catch(t){if(t.statusCode===401){n=false}throw t}return t},i)).trim();return retry(async()=>{let i;try{i=await getCredentialsFromProfile(h,l,t)}catch(t){if(t.statusCode===401){n=false}throw t}return i},i)};return async()=>{const t=await getInstanceMetadataEndpoint();if(n){i?.debug("AWS SDK Instance Metadata","using v1 fallback (no token fetch)");return getCredentials(d,{...t,timeout:l})}else{let a;try{a=(await getMetadataToken({...t,timeout:l})).toString()}catch(a){if(a?.statusCode===400){throw Object.assign(a,{message:"EC2 Metadata token request returned error"})}else if(a.message==="TimeoutError"||[403,404,405].includes(a.statusCode)){n=true}i?.debug("AWS SDK Instance Metadata","using v1 fallback (initial)");return getCredentials(d,{...t,timeout:l})}return getCredentials(d,{...t,headers:{[U]:a},timeout:l})}}};const getMetadataToken=async t=>httpRequest({...t,path:M,method:"PUT",headers:{"x-aws-ec2-metadata-token-ttl-seconds":"21600"}});const getProfile=async t=>(await httpRequest({...t,path:N})).toString();const getCredentialsFromProfile=async(t,n,i)=>{const a=JSON.parse((await httpRequest({...n,path:N+t})).toString());if(!isImdsCredentials(a)){throw new A("Invalid response received from instance metadata service.",{logger:i.logger})}return fromImdsCredentials(a)};n.DEFAULT_MAX_RETRIES=f;n.DEFAULT_TIMEOUT=h;n.ENV_CMDS_AUTH_TOKEN=m;n.ENV_CMDS_FULL_URI=g;n.ENV_CMDS_RELATIVE_URI=p;n.Endpoint=y;n.fromContainerMetadata=fromContainerMetadata;n.fromInstanceMetadata=fromInstanceMetadata;n.getInstanceMetadataEndpoint=getInstanceMetadataEndpoint;n.httpRequest=httpRequest;n.providerConfigFromInit=providerConfigFromInit},1279:(t,n,i)=>{const{buildQueryString:a,HttpResponse:A}=i(3422);const c=i(4708);const{Readable:l}=i(7075);const d=i(2467);const{streamCollector:h}=i(2430);n.streamCollector=h;function buildAbortError(t){const n=t&&typeof t==="object"&&"reason"in t?t.reason:undefined;if(n){if(n instanceof Error){const t=new Error("Request aborted");t.name="AbortError";t.cause=n;return t}const t=new Error(String(n));t.name="AbortError";return t}const i=new Error("Request aborted");i.name="AbortError";return i}const f=["ECONNRESET","EPIPE","ETIMEDOUT"];const getTransformedHeaders=t=>{const n={};for(const i in t){const a=t[i];n[i]=Array.isArray(a)?a.join(","):a}return n};const g={setTimeout:(t,n)=>setTimeout(t,n),clearTimeout:t=>clearTimeout(t)};const p=1e3;const setConnectionTimeout=(t,n,i=0)=>{if(!i){return-1}const registerTimeout=a=>{const A=g.setTimeout(()=>{t.destroy();n(Object.assign(new Error(`@smithy/node-http-handler - the request socket did not establish a connection with the server within the configured timeout of ${i} ms.`),{name:"TimeoutError"}))},i-a);const doWithSocket=t=>{if(t?.connecting){t.on("connect",()=>{g.clearTimeout(A)})}else{g.clearTimeout(A)}};if(t.socket){doWithSocket(t.socket)}else{t.on("socket",doWithSocket)}};if(i<2e3){registerTimeout(0);return 0}return g.setTimeout(registerTimeout.bind(null,p),p)};const setRequestTimeout=(t,n,i=0,a,A)=>{if(i){return g.setTimeout(()=>{let c=`@smithy/node-http-handler - [${a?"ERROR":"WARN"}] a request has exceeded the configured ${i} ms requestTimeout.`;if(a){const i=Object.assign(new Error(c),{name:"TimeoutError",code:"ETIMEDOUT"});t.destroy(i);n(i)}else{c+=` Init client requestHandler with throwOnRequestTimeout=true to turn this into an error.`;A?.warn?.(c)}},i)}return-1};const m=3e3;const setSocketKeepAlive=(t,{keepAlive:n,keepAliveMsecs:i},a=m)=>{if(n!==true){return-1}const registerListener=()=>{if(t.socket){t.socket.setKeepAlive(n,i||0)}else{t.on("socket",t=>{t.setKeepAlive(n,i||0)})}};if(a===0){registerListener();return 0}return g.setTimeout(registerListener,a)};const E=3e3;const setSocketTimeout=(t,n,i=0)=>{const registerTimeout=a=>{const A=i-a;const onTimeout=()=>{t.destroy();n(Object.assign(new Error(`@smithy/node-http-handler - the request socket timed out after ${i} ms of inactivity (configured by client requestHandler).`),{name:"TimeoutError"}))};if(t.socket){t.socket.setTimeout(A,onTimeout);t.on("close",()=>t.socket?.removeListener("timeout",onTimeout))}else{t.setTimeout(A,onTimeout)}};if(0{l=Number(g.setTimeout(()=>t(true),Math.max(C,i)))}),new Promise(n=>{t.on("continue",()=>{g.clearTimeout(l);n(true)});t.on("response",()=>{g.clearTimeout(l);n(false)});t.on("error",()=>{g.clearTimeout(l);n(false)})})])}if(d){writeBody(t,n.body)}}function writeBody(t,n){if(n instanceof l){n.pipe(t);return}if(n){const i=Buffer.isBuffer(n);const a=typeof n==="string";if(i||a){if(i&&n.byteLength===0){t.end()}else{t.end(n)}return}const A=n;if(typeof A==="object"&&A.buffer&&typeof A.byteOffset==="number"&&typeof A.byteLength==="number"){t.end(Buffer.from(A.buffer,A.byteOffset,A.byteLength));return}t.end(Buffer.from(n));return}t.end()}const I=0;let y=undefined;let B=undefined;class NodeHttpHandler{config;configProvider;socketWarningTimestamp=0;externalAgent=false;metadata={handlerProtocol:"http/1.1"};static create(t){if(typeof t?.handle==="function"){return t}return new NodeHttpHandler(t)}static checkSocketUsage(t,n,i=console){const{sockets:a,requests:A,maxSockets:c}=t;if(typeof c!=="number"||c===Infinity){return n}const l=15e3;if(Date.now()-l=c&&l>=2*c){i?.warn?.(`@smithy/node-http-handler:WARN - socket usage at capacity=${n} and ${l} additional requests are enqueued.\nSee https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/node-configuring-maxsockets.html\nor increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler config.`);return Date.now()}}}return n}constructor(t){this.configProvider=new Promise((n,i)=>{if(typeof t==="function"){t().then(t=>{n(this.resolveDefaultConfig(t))}).catch(i)}else{n(this.resolveDefaultConfig(t))}})}destroy(){this.config?.httpAgent?.destroy();this.config?.httpsAgent?.destroy()}async handle(t,{abortSignal:n,requestTimeout:i}={}){if(!this.config){this.config=await this.configProvider}const l=this.config;const d=t.protocol==="https:";if(!d&&!this.config.httpAgent){this.config.httpAgent=await this.config.httpAgentProvider()}return new Promise((h,p)=>{let m=undefined;let E=-1;let C=-1;let I=-1;let Q=-1;let w=-1;const clearTimeouts=()=>{g.clearTimeout(E);g.clearTimeout(C);g.clearTimeout(I);g.clearTimeout(Q);g.clearTimeout(w)};const resolve=async t=>{await m;clearTimeouts();h(t)};const reject=async t=>{await m;clearTimeouts();p(t)};if(n?.aborted){const t=buildAbortError(n);reject(t);return}const S=t.headers;const b=S?(S.Expect??S.expect)==="100-continue":false;let R=d?l.httpsAgent:l.httpAgent;if(b&&!this.externalAgent){R=new(d?c.Agent:y)({keepAlive:false,maxSockets:Infinity})}E=g.setTimeout(()=>{this.socketWarningTimestamp=NodeHttpHandler.checkSocketUsage(R,this.socketWarningTimestamp,l.logger)},l.socketAcquisitionWarningTimeout??(l.requestTimeout??2e3)+(l.connectionTimeout??1e3));const v=t.query?a(t.query):"";let k=undefined;if(t.username!=null||t.password!=null){const n=t.username??"";const i=t.password??"";k=`${n}:${i}`}let D=t.path;if(v){D+=`?${v}`}if(t.fragment){D+=`#${t.fragment}`}let T=t.hostname??"";if(T[0]==="["&&T.endsWith("]")){T=t.hostname.slice(1,-1)}else{T=t.hostname}const N={headers:t.headers,host:T,method:t.method,path:D,port:t.port,agent:R,auth:k};const M=d?c.request:B;const F=M(N,t=>{const n=new A({statusCode:t.statusCode||-1,reason:t.statusMessage,headers:getTransformedHeaders(t.headers),body:t});resolve({response:n})});F.on("error",t=>{if(f.includes(t.code)){reject(Object.assign(t,{name:"TimeoutError"}))}else{reject(t)}});if(n){const onAbort=()=>{F.destroy();const t=buildAbortError(n);reject(t)};if(typeof n.addEventListener==="function"){const t=n;t.addEventListener("abort",onAbort,{once:true});F.once("close",()=>t.removeEventListener("abort",onAbort))}else{n.onabort=onAbort}}const x=i??l.requestTimeout;C=setConnectionTimeout(F,reject,l.connectionTimeout);I=setRequestTimeout(F,reject,x,l.throwOnRequestTimeout,l.logger??console);Q=setSocketTimeout(F,reject,l.socketTimeout);const U=N.agent;if(typeof U==="object"&&"keepAlive"in U){w=setSocketKeepAlive(F,{keepAlive:U.keepAlive,keepAliveMsecs:U.keepAliveMsecs})}m=writeRequestBody(F,t,x,this.externalAgent).catch(t=>{clearTimeouts();return p(t)})})}updateHttpClientConfig(t,n){this.config=undefined;this.configProvider=this.configProvider.then(i=>({...i,[t]:n}))}httpHandlerConfigs(){return this.config??{}}resolveDefaultConfig(t){const{requestTimeout:n,connectionTimeout:a,socketTimeout:A,socketAcquisitionWarningTimeout:l,httpAgent:d,httpsAgent:h,throwOnRequestTimeout:f,logger:g}=t||{};const p=true;const m=50;return{connectionTimeout:a,requestTimeout:n,socketTimeout:A,socketAcquisitionWarningTimeout:l,throwOnRequestTimeout:f,httpAgentProvider:async()=>{const t=i(7067);const{Agent:n,request:a}=t.default??t;B=a;y=n;if(d instanceof y||typeof d?.destroy==="function"){this.externalAgent=true;return d}return new y({keepAlive:p,maxSockets:m,...d})},httpsAgent:(()=>{if(h instanceof c.Agent||typeof h?.destroy==="function"){this.externalAgent=true;return h}return new c.Agent({keepAlive:p,maxSockets:m,...h})})(),logger:g}}}const Q=new Uint16Array(1);class ClientHttp2SessionRef{id=Q[0]++;total=0;max=0;session;refs=0;constructor(t){t.unref();this.session=t}retain(){if(this.session.destroyed){throw new Error("@smithy/node-http-handler - cannot acquire reference to destroyed session.")}this.refs+=1;this.total+=1;this.max=Math.max(this.refs,this.max);this.session.ref()}free(){if(this.session.destroyed){return}this.refs-=1;if(this.refs===0){this.session.unref()}if(this.refs<0){throw new Error("@smithy/node-http-handler - ClientHttp2Session refcount at zero, cannot decrement.")}}deref(){return this.session}close(){if(!this.session.closed){this.session.close()}}destroy(){this.refs=0;if(!this.session.destroyed){this.session.destroy()}}useCount(){return this.refs}}class NodeHttp2ConnectionPool{sessions=[];maxConcurrency=0;constructor(t){this.sessions=(t??[]).map(t=>new ClientHttp2SessionRef(t))}poll(){let t=false;for(const n of this.sessions){if(n.deref().destroyed){t=true;continue}if(!this.maxConcurrency||n.useCount()-1){this.sessions.splice(n,1)}}[Symbol.iterator](){return this.sessions[Symbol.iterator]()}setMaxConcurrency(t){this.maxConcurrency=t}destroy(t){this.remove(t);t.destroy()}}class NodeHttp2ConnectionManager{config;connectOptions;connectionPools=new Map;constructor(t){this.config=t;if(this.config.maxConcurrency&&this.config.maxConcurrency<=0){throw new RangeError("maxConcurrency must be greater than zero.")}}lease(t,n){const i=this.getUrlString(t);const a=this.getPool(i);if(!this.config.disableConcurrency&&!n.isEventStream){const t=a.poll();if(t){t.retain();return t}}const A=new ClientHttp2SessionRef(this.connect(i));const c=A.deref();if(this.config.maxConcurrency){c.settings({maxConcurrentStreams:this.config.maxConcurrency},n=>{if(n){throw new Error("Fail to set maxConcurrentStreams to "+this.config.maxConcurrency+"when creating new session for "+t.destination.toString())}})}const graceful=()=>{this.removeFromPoolAndClose(i,A)};const ensureDestroyed=()=>{this.removeFromPoolAndCheckedDestroy(i,A)};c.on("goaway",graceful);c.on("error",ensureDestroyed);c.on("frameError",ensureDestroyed);c.on("close",ensureDestroyed);if(n.requestTimeout){c.setTimeout(n.requestTimeout,ensureDestroyed)}a.offerLast(A);A.retain();return A}release(t,n){n.free()}createIsolatedSession(t,n){const i=this.getUrlString(t);const a=new ClientHttp2SessionRef(this.connect(i));const A=a.deref();A.settings({maxConcurrentStreams:1});const ensureDestroyed=()=>{a.destroy()};A.on("error",ensureDestroyed);A.on("frameError",ensureDestroyed);A.on("close",ensureDestroyed);if(n.requestTimeout){A.setTimeout(n.requestTimeout,ensureDestroyed)}a.retain();return a}destroy(){for(const[t,n]of this.connectionPools){for(const t of[...n]){t.destroy()}this.connectionPools.delete(t)}}setMaxConcurrentStreams(t){if(t&&t<=0){throw new RangeError("maxConcurrentStreams must be greater than zero.")}this.config.maxConcurrency=t;for(const n of this.connectionPools.values()){n.setMaxConcurrency(t)}}setDisableConcurrentStreams(t){this.config.disableConcurrency=t}setNodeHttp2ConnectOptions(t){this.connectOptions=t}debug(){const t={};for(const[n,i]of this.connectionPools){const a=[];for(const t of i){a.push({id:t.id,active:t.useCount(),maxConcurrent:t.max,totalRequests:t.total})}t[n]={sessions:a}}return t}removeFromPoolAndClose(t,n){this.connectionPools.get(t)?.remove(n);n.close()}removeFromPoolAndCheckedDestroy(t,n){this.connectionPools.get(t)?.remove(n);n.destroy()}getPool(t){if(!this.connectionPools.has(t)){const n=new NodeHttp2ConnectionPool;if(this.config.maxConcurrency){n.setMaxConcurrency(this.config.maxConcurrency)}this.connectionPools.set(t,n)}return this.connectionPools.get(t)}getUrlString(t){return t.destination.toString()}connect(t){return this.connectOptions===undefined?d.connect(t):d.connect(t,this.connectOptions)}}const{constants:w}=d;class NodeHttp2Handler{config;configProvider;metadata={handlerProtocol:"h2"};connectionManager=new NodeHttp2ConnectionManager({});static create(t){if(typeof t?.handle==="function"){return t}return new NodeHttp2Handler(t)}constructor(t){this.configProvider=new Promise((n,i)=>{if(typeof t==="function"){t().then(t=>{n(t||{})}).catch(i)}else{n(t||{})}})}destroy(){this.connectionManager.destroy()}async handle(t,{abortSignal:n,requestTimeout:i,isEventStream:c}={}){if(!this.config){this.config=await this.configProvider;const{disableConcurrentStreams:t,maxConcurrentStreams:n,nodeHttp2ConnectOptions:i}=this.config;this.connectionManager.setDisableConcurrentStreams(t??false);if(n){this.connectionManager.setMaxConcurrentStreams(n)}if(i){this.connectionManager.setNodeHttp2ConnectOptions(i)}}const{requestTimeout:l,disableConcurrentStreams:d}=this.config;const h=d||c;const f=i??l;return new Promise((i,l)=>{let d=false;let g=undefined;const resolve=async t=>{await g;i(t)};const reject=async t=>{await g;l(t)};if(n?.aborted){d=true;const t=buildAbortError(n);reject(t);return}const{hostname:p,method:m,port:E,protocol:C,query:I}=t;let y="";if(t.username!=null||t.password!=null){const n=t.username??"";const i=t.password??"";y=`${n}:${i}@`}const B=`${C}//${y}${p}${E?`:${E}`:""}`;const Q={destination:new URL(B)};const S={requestTimeout:this.config?.sessionTimeout,isEventStream:c};const b=h?this.connectionManager.createIsolatedSession(Q,S):this.connectionManager.lease(Q,S);const R=b.deref();const rejectWithDestroy=t=>{if(h){b.destroy()}d=true;reject(t)};const v=I?a(I):"";let k=t.path;if(v){k+=`?${v}`}if(t.fragment){k+=`#${t.fragment}`}const D=R.request({...t.headers,[w.HTTP2_HEADER_PATH]:k,[w.HTTP2_HEADER_METHOD]:m});if(f){D.setTimeout(f,()=>{D.close();const t=new Error(`Stream timed out because of no activity for ${f} ms`);t.name="TimeoutError";rejectWithDestroy(t)})}if(n){const onAbort=()=>{D.close();const t=buildAbortError(n);rejectWithDestroy(t)};if(typeof n.addEventListener==="function"){const t=n;t.addEventListener("abort",onAbort,{once:true});D.once("close",()=>t.removeEventListener("abort",onAbort))}else{n.onabort=onAbort}}D.on("frameError",(t,n,i)=>{rejectWithDestroy(new Error(`Frame type id ${t} in stream id ${i} has failed with code ${n}.`))});D.on("error",rejectWithDestroy);D.on("aborted",()=>{rejectWithDestroy(new Error(`HTTP/2 stream is abnormally aborted in mid-communication with result code ${D.rstCode}.`))});D.on("response",t=>{const n=new A({statusCode:t[":status"]??-1,headers:getTransformedHeaders(t),body:D});d=true;resolve({response:n});if(h){R.close()}});D.on("close",()=>{if(h){b.destroy()}else{this.connectionManager.release(Q,b)}if(!d){rejectWithDestroy(new Error("Unexpected error: http2 request did not get a response"))}});g=writeRequestBody(D,t,f)})}updateHttpClientConfig(t,n){this.config=undefined;this.configProvider=this.configProvider.then(i=>({...i,[t]:n}))}httpHandlerConfigs(){return this.config??{}}}n.DEFAULT_REQUEST_TIMEOUT=I;n.NodeHttp2Handler=NodeHttp2Handler;n.NodeHttpHandler=NodeHttpHandler},5118:(t,n,i)=>{const{fromUtf8:a,fromHex:A,toHex:c,toUint8Array:l,isArrayBuffer:d}=i(2430);const{normalizeProvider:h}=i(2658);const{escapeUri:f,HttpRequest:g}=i(3422);class HeaderFormatter{format(t){const n=[];for(const i of Object.keys(t)){const A=a(i);n.push(Uint8Array.from([A.byteLength]),A,this.formatHeaderValue(t[i]))}const i=new Uint8Array(n.reduce((t,n)=>t+n.byteLength,0));let A=0;for(const t of n){i.set(t,A);A+=t.byteLength}return i}formatHeaderValue(t){switch(t.type){case"boolean":return Uint8Array.from([t.value?0:1]);case"byte":return Uint8Array.from([2,t.value]);case"short":const n=new DataView(new ArrayBuffer(3));n.setUint8(0,3);n.setInt16(1,t.value,false);return new Uint8Array(n.buffer);case"integer":const i=new DataView(new ArrayBuffer(5));i.setUint8(0,4);i.setInt32(1,t.value,false);return new Uint8Array(i.buffer);case"long":const c=new Uint8Array(9);c[0]=5;c.set(t.value.bytes,1);return c;case"binary":const l=new DataView(new ArrayBuffer(3+t.value.byteLength));l.setUint8(0,6);l.setUint16(1,t.value.byteLength,false);const d=new Uint8Array(l.buffer);d.set(t.value,3);return d;case"string":const h=a(t.value);const f=new DataView(new ArrayBuffer(3+h.byteLength));f.setUint8(0,7);f.setUint16(1,h.byteLength,false);const g=new Uint8Array(f.buffer);g.set(h,3);return g;case"timestamp":const p=new Uint8Array(9);p[0]=8;p.set(Int64.fromNumber(t.value.valueOf()).bytes,1);return p;case"uuid":if(!m.test(t.value)){throw new Error(`Invalid UUID received: ${t.value}`)}const E=new Uint8Array(17);E[0]=9;E.set(A(t.value.replace(/\-/g,"")),1);return E}}}var p;(function(t){t[t["boolTrue"]=0]="boolTrue";t[t["boolFalse"]=1]="boolFalse";t[t["byte"]=2]="byte";t[t["short"]=3]="short";t[t["integer"]=4]="integer";t[t["long"]=5]="long";t[t["byteArray"]=6]="byteArray";t[t["string"]=7]="string";t[t["timestamp"]=8]="timestamp";t[t["uuid"]=9]="uuid"})(p||(p={}));const m=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;class Int64{bytes;constructor(t){this.bytes=t;if(t.byteLength!==8){throw new Error("Int64 buffers must be exactly 8 bytes")}}static fromNumber(t){if(t>0x8000000000000000||t<-0x8000000000000000){throw new Error(`${t} is too large (or, if negative, too small) to represent as an Int64`)}const n=new Uint8Array(8);for(let i=7,a=Math.abs(Math.round(t));i>-1&&a>0;i--,a/=256){n[i]=a}if(t<0){negate(n)}return new Int64(n)}valueOf(){const t=this.bytes.slice(0);const n=t[0]&128;if(n){negate(t)}return parseInt(c(t),16)*(n?-1:1)}toString(){return String(this.valueOf())}}function negate(t){for(let n=0;n<8;n++){t[n]^=255}for(let n=7;n>-1;n--){t[n]++;if(t[n]!==0)break}}const E="X-Amz-Algorithm";const C="X-Amz-Credential";const I="X-Amz-Date";const y="X-Amz-SignedHeaders";const B="X-Amz-Expires";const Q="X-Amz-Signature";const w="X-Amz-Security-Token";const S="X-Amz-Region-Set";const b="authorization";const R=I.toLowerCase();const v="date";const k=[b,R,v];const D=Q.toLowerCase();const T="x-amz-content-sha256";const N=w.toLowerCase();const M="host";const F={authorization:true,"cache-control":true,connection:true,expect:true,from:true,"keep-alive":true,"max-forwards":true,pragma:true,referer:true,te:true,trailer:true,"transfer-encoding":true,upgrade:true,"user-agent":true,"x-amzn-trace-id":true};const x=/^proxy-/;const U=/^sec-/;const P=[/^proxy-/i,/^sec-/i];const L="AWS4-HMAC-SHA256";const O="AWS4-ECDSA-P256-SHA256";const H="AWS4-HMAC-SHA256-PAYLOAD";const $="UNSIGNED-PAYLOAD";const G=50;const V="aws4_request";const Y=60*60*24*7;const getCanonicalQuery=({query:t={}})=>{const n=[];const i={};for(const a of Object.keys(t)){if(a.toLowerCase()===D){continue}const A=f(a);n.push(A);const c=t[a];if(typeof c==="string"){i[A]=`${A}=${f(c)}`}else if(Array.isArray(c)){i[A]=c.slice(0).reduce((t,n)=>t.concat([`${A}=${f(n)}`]),[]).sort().join("&")}}return n.sort().map(t=>i[t]).filter(t=>t).join("&")};const iso8601=t=>toDate(t).toISOString().replace(/\.\d{3}Z$/,"Z");const toDate=t=>{if(typeof t==="number"){return new Date(t*1e3)}if(typeof t==="string"){if(Number(t)){return new Date(Number(t)*1e3)}return new Date(t)}return t};class SignatureV4Base{service;regionProvider;credentialProvider;sha256;uriEscapePath;applyChecksum;constructor({applyChecksum:t,credentials:n,region:i,service:a,sha256:A,uriEscapePath:c=true}){this.service=a;this.sha256=A;this.uriEscapePath=c;this.applyChecksum=typeof t==="boolean"?t:true;this.regionProvider=h(i);this.credentialProvider=h(n)}createCanonicalRequest(t,n,i){const a=Object.keys(n).sort();return`${t.method}\n${this.getCanonicalPath(t)}\n${getCanonicalQuery(t)}\n${a.map(t=>`${t}:${n[t]}`).join("\n")}\n\n${a.join(";")}\n${i}`}async createStringToSign(t,n,i,a){const A=new this.sha256;A.update(l(i));const d=await A.digest();return`${a}\n${t}\n${n}\n${c(d)}`}getCanonicalPath({path:t}){if(this.uriEscapePath){const n=[];for(const i of t.split("/")){if(i?.length===0)continue;if(i===".")continue;if(i===".."){n.pop()}else{n.push(i)}}const i=`${t?.startsWith("/")?"/":""}${n.join("/")}${n.length>0&&t?.endsWith("/")?"/":""}`;const a=f(i);return a.replace(/%2F/g,"/")}return t}validateResolvedCredentials(t){if(typeof t!=="object"||typeof t.accessKeyId!=="string"||typeof t.secretAccessKey!=="string"){throw new Error("Resolved credential object is not valid")}}formatDate(t){const n=iso8601(t).replace(/[\-:]/g,"");return{longDate:n,shortDate:n.slice(0,8)}}getCanonicalHeaderList(t){return Object.keys(t).sort().join(";")}}const J={};const W=[];const createScope=(t,n,i)=>`${t}/${n}/${i}/${V}`;const getSigningKey=async(t,n,i,a,A)=>{const l=await hmac(t,n.secretAccessKey,n.accessKeyId);const d=`${i}:${a}:${A}:${c(l)}:${n.sessionToken}`;if(d in J){return J[d]}W.push(d);while(W.length>G){delete J[W.shift()]}let h=`AWS4${n.secretAccessKey}`;for(const n of[i,a,A,V]){h=await hmac(t,h,n)}return J[d]=h};const clearCredentialCache=()=>{W.length=0;Object.keys(J).forEach(t=>{delete J[t]})};const hmac=(t,n,i)=>{const a=new t(n);a.update(l(i));return a.digest()};const getCanonicalHeaders=({headers:t},n,i)=>{const a={};for(const A of Object.keys(t).sort()){if(t[A]==undefined){continue}const c=A.toLowerCase();if(c in F||n?.has(c)||x.test(c)||U.test(c)){if(!i||i&&!i.has(c)){continue}}a[c]=t[A].trim().replace(/\s+/g," ")}return a};const getPayloadHash=async({headers:t,body:n},i)=>{for(const n of Object.keys(t)){if(n.toLowerCase()===T){return t[n]}}if(n==undefined){return"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"}else if(typeof n==="string"||ArrayBuffer.isView(n)||d(n)){const t=new i;t.update(l(n));return c(await t.digest())}return $};const hasHeader=(t,n)=>{t=t.toLowerCase();for(const i of Object.keys(n)){if(t===i.toLowerCase()){return true}}return false};const moveHeadersToQuery=(t,n={})=>{const{headers:i,query:a={}}=g.clone(t);for(const t of Object.keys(i)){const A=t.toLowerCase();if(A.slice(0,6)==="x-amz-"&&!n.unhoistableHeaders?.has(A)||n.hoistableHeaders?.has(A)){a[t]=i[t];delete i[t]}}return{...t,headers:i,query:a}};const prepareRequest=t=>{t=g.clone(t);for(const n of Object.keys(t.headers)){if(k.indexOf(n.toLowerCase())>-1){delete t.headers[n]}}return t};class SignatureV4 extends SignatureV4Base{headerFormatter=new HeaderFormatter;constructor({applyChecksum:t,credentials:n,region:i,service:a,sha256:A,uriEscapePath:c=true}){super({applyChecksum:t,credentials:n,region:i,service:a,sha256:A,uriEscapePath:c})}async presign(t,n={}){const{signingDate:i=new Date,expiresIn:a=3600,unsignableHeaders:A,unhoistableHeaders:c,signableHeaders:l,hoistableHeaders:d,signingRegion:h,signingService:f}=n;const g=await this.credentialProvider();this.validateResolvedCredentials(g);const p=h??await this.regionProvider();const{longDate:m,shortDate:S}=this.formatDate(i);if(a>Y){return Promise.reject("Signature version 4 presigned URLs"+" must have an expiration date less than one week in"+" the future")}const b=createScope(S,p,f??this.service);const R=moveHeadersToQuery(prepareRequest(t),{unhoistableHeaders:c,hoistableHeaders:d});if(g.sessionToken){R.query[w]=g.sessionToken}R.query[E]=L;R.query[C]=`${g.accessKeyId}/${b}`;R.query[I]=m;R.query[B]=a.toString(10);const v=getCanonicalHeaders(R,A,l);R.query[y]=this.getCanonicalHeaderList(v);R.query[Q]=await this.getSignature(m,b,this.getSigningKey(g,p,S,f),this.createCanonicalRequest(R,v,await getPayloadHash(t,this.sha256)));return R}async sign(t,n){if(typeof t==="string"){return this.signString(t,n)}else if(t.headers&&t.payload){return this.signEvent(t,n)}else if(t.message){return this.signMessage(t,n)}else{return this.signRequest(t,n)}}async signEvent({headers:t,payload:n},{signingDate:i=new Date,priorSignature:a,signingRegion:A,signingService:l,eventStreamCredentials:d}){const h=A??await this.regionProvider();const{shortDate:f,longDate:g}=this.formatDate(i);const p=createScope(f,h,l??this.service);const m=await getPayloadHash({headers:{},body:n},this.sha256);const E=new this.sha256;E.update(t);const C=c(await E.digest());const I=[H,g,p,a,C,m].join("\n");return this.signString(I,{signingDate:i,signingRegion:h,signingService:l,eventStreamCredentials:d})}async signMessage(t,{signingDate:n=new Date,signingRegion:i,signingService:a,eventStreamCredentials:A}){const c=this.signEvent({headers:this.headerFormatter.format(t.message.headers),payload:t.message.body},{signingDate:n,signingRegion:i,signingService:a,priorSignature:t.priorSignature,eventStreamCredentials:A});return c.then(n=>({message:t.message,signature:n}))}async signString(t,{signingDate:n=new Date,signingRegion:i,signingService:a,eventStreamCredentials:A}={}){const d=A??await this.credentialProvider();this.validateResolvedCredentials(d);const h=i??await this.regionProvider();const{shortDate:f}=this.formatDate(n);const g=new this.sha256(await this.getSigningKey(d,h,f,a));g.update(l(t));return c(await g.digest())}async signRequest(t,{signingDate:n=new Date,signableHeaders:i,unsignableHeaders:a,signingRegion:A,signingService:c}={}){const l=await this.credentialProvider();this.validateResolvedCredentials(l);const d=A??await this.regionProvider();const h=prepareRequest(t);const{longDate:f,shortDate:g}=this.formatDate(n);const p=createScope(g,d,c??this.service);h.headers[R]=f;if(l.sessionToken){h.headers[N]=l.sessionToken}const m=await getPayloadHash(h,this.sha256);if(!hasHeader(T,h.headers)&&this.applyChecksum){h.headers[T]=m}const E=getCanonicalHeaders(h,a,i);const C=await this.getSignature(f,p,this.getSigningKey(l,d,g,c),this.createCanonicalRequest(h,E,m));h.headers[b]=`${L} `+`Credential=${l.accessKeyId}/${p}, `+`SignedHeaders=${this.getCanonicalHeaderList(E)}, `+`Signature=${C}`;return h}async getSignature(t,n,i,a){const A=await this.createStringToSign(t,n,a,L);const d=new this.sha256(await i);d.update(l(A));return c(await d.digest())}getSigningKey(t,n,i,a){return getSigningKey(this.sha256,t,i,n,a||this.service)}}const q={SignatureV4a:null};n.ALGORITHM_IDENTIFIER=L;n.ALGORITHM_IDENTIFIER_V4A=O;n.ALGORITHM_QUERY_PARAM=E;n.ALWAYS_UNSIGNABLE_HEADERS=F;n.AMZ_DATE_HEADER=R;n.AMZ_DATE_QUERY_PARAM=I;n.AUTH_HEADER=b;n.CREDENTIAL_QUERY_PARAM=C;n.DATE_HEADER=v;n.EVENT_ALGORITHM_IDENTIFIER=H;n.EXPIRES_QUERY_PARAM=B;n.GENERATED_HEADERS=k;n.HOST_HEADER=M;n.KEY_TYPE_IDENTIFIER=V;n.MAX_CACHE_SIZE=G;n.MAX_PRESIGNED_TTL=Y;n.PROXY_HEADER_PATTERN=x;n.REGION_SET_PARAM=S;n.SEC_HEADER_PATTERN=U;n.SHA256_HEADER=T;n.SIGNATURE_HEADER=D;n.SIGNATURE_QUERY_PARAM=Q;n.SIGNED_HEADERS_QUERY_PARAM=y;n.SignatureV4=SignatureV4;n.SignatureV4Base=SignatureV4Base;n.TOKEN_HEADER=N;n.TOKEN_QUERY_PARAM=w;n.UNSIGNABLE_PATTERNS=P;n.UNSIGNED_PAYLOAD=$;n.clearCredentialCache=clearCredentialCache;n.createScope=createScope;n.getCanonicalHeaders=getCanonicalHeaders;n.getCanonicalQuery=getCanonicalQuery;n.getPayloadHash=getPayloadHash;n.getSigningKey=getSigningKey;n.hasHeader=hasHeader;n.moveHeadersToQuery=moveHeadersToQuery;n.prepareRequest=prepareRequest;n.signatureV4aContainer=q},690:(t,n)=>{var i;(function(t){t["HEADER"]="header";t["QUERY"]="query"})(i||(i={}));var a;(function(t){t["HEADER"]="header";t["QUERY"]="query"})(a||(a={}));var A;(function(t){t["HTTP"]="http";t["HTTPS"]="https"})(A||(A={}));var c;(function(t){t["MD5"]="md5";t["CRC32"]="crc32";t["CRC32C"]="crc32c";t["SHA1"]="sha1";t["SHA256"]="sha256"})(c||(c={}));const getChecksumConfiguration=t=>{const n=[];if(t.sha256!==undefined){n.push({algorithmId:()=>c.SHA256,checksumConstructor:()=>t.sha256})}if(t.md5!=undefined){n.push({algorithmId:()=>c.MD5,checksumConstructor:()=>t.md5})}return{addChecksumAlgorithm(t){n.push(t)},checksumAlgorithms(){return n}}};const resolveChecksumRuntimeConfig=t=>{const n={};t.checksumAlgorithms().forEach(t=>{n[t.algorithmId()]=t.checksumConstructor()});return n};const getDefaultClientConfiguration=t=>getChecksumConfiguration(t);const resolveDefaultRuntimeConfig=t=>resolveChecksumRuntimeConfig(t);var l;(function(t){t[t["HEADER"]=0]="HEADER";t[t["TRAILER"]=1]="TRAILER"})(l||(l={}));const d="__smithy_context";var h;(function(t){t["PROFILE"]="profile";t["SSO_SESSION"]="sso-session";t["SERVICES"]="services"})(h||(h={}));var f;(function(t){t["HTTP_0_9"]="http/0.9";t["HTTP_1_0"]="http/1.0";t["TDS_8_0"]="tds/8.0"})(f||(f={}));n.AlgorithmId=c;n.EndpointURLScheme=A;n.FieldPosition=l;n.HttpApiKeyAuthLocation=a;n.HttpAuthLocation=i;n.IniSectionType=h;n.RequestHandlerProtocol=f;n.SMITHY_CONTEXT_KEY=d;n.getDefaultClientConfiguration=getDefaultClientConfiguration;n.resolveDefaultRuntimeConfig=resolveDefaultRuntimeConfig},3966:(t,n,i)=>{Object.defineProperty(n,"__esModule",{value:true});const a=i(2463);const A=i(1436);const c=i(567);const l=i(7881);const d=i(1283);const h=i(630);const f="errorMessage";const g=new a.Name("emUsed");const p={required:"missingProperty",dependencies:"property",dependentRequired:"property"};const m=/\$\{[^}]+\}/;const E=/\$\{([^}]+)\}/g;const C=/^""\s*\+\s*|\s*\+\s*""$/g;function errorMessage(t){return{keyword:f,schemaType:["string","object"],post:true,code(n){const{gen:i,data:I,schema:y,schemaValue:B,it:Q}=n;if(Q.createErrors===false)return;const w=y;const S=A.strConcat(h.default.instancePath,Q.errorPath);i.if(a._`${h.default.errors} > 0`,()=>{if(typeof w=="object"){const[t,n]=keywordErrorsConfig(w);if(n)processKeywordErrors(n);if(t)processKeywordPropErrors(t);processChildErrors(childErrorsConfig(w))}const n=typeof w=="string"?w:w._;if(n)processAllErrors(n);if(!t.keepErrors)removeUsedErrors()});function childErrorsConfig({properties:t,items:n}){const i={};if(t){i.props={};for(const n in t)i.props[n]=[]}if(n){i.items={};for(let t=0;ti.if(matchKeywordError(t,c),()=>i.code(a._`${c}[${t}.keyword].push(${t})`).assign(a._`${t}.${g}`,true)));const{singleError:f}=t;if(f){const t=i.let("message",a._`""`);const A=i.let("paramsErrors",a._`[]`);loopErrors(n=>{i.if(t,()=>i.code(a._`${t} += ${typeof f=="string"?f:";"}`));i.code(a._`${t} += ${errMessage(n)}`);i.assign(A,a._`${A}.concat(${c}[${n}])`)});d.reportError(n,{message:t,params:a._`{errors: ${A}}`})}else{loopErrors(t=>d.reportError(n,{message:errMessage(t),params:a._`{errors: ${c}[${t}]}`}))}function loopErrors(t){i.forIn("key",c,n=>i.if(a._`${c}[${n}].length`,()=>t(n)))}function errMessage(t){return a._`${t} in ${l} ? ${l}[${t}]() : ${B}[${t}]`}}function processKeywordPropErrors(t){const A=i.const("emErrors",a.stringify(t));const c=[];for(const n in t){c.push([n,getTemplatesCode(t[n],y[n])])}const l=i.const("templates",i.object(...c));const f=i.scopeValue("obj",{ref:p,code:a.stringify(p)});const m=i.let("emPropParams");const E=i.let("emParamsErrors");i.forOf("err",h.default.vErrors,t=>i.if(matchKeywordError(t,A),()=>{i.assign(m,a._`${f}[${t}.keyword]`);i.assign(E,a._`${A}[${t}.keyword][${t}.params[${m}]]`);i.if(E,()=>i.code(a._`${E}.push(${t})`).assign(a._`${t}.${g}`,true))}));i.forIn("key",A,t=>i.forIn("keyProp",a._`${A}[${t}]`,c=>{i.assign(E,a._`${A}[${t}][${c}]`);i.if(a._`${E}.length`,()=>{const A=i.const("tmpl",a._`${l}[${t}] && ${l}[${t}][${c}]`);d.reportError(n,{message:a._`${A} ? ${A}() : ${B}[${t}][${c}]`,params:a._`{errors: ${E}}`})})}))}function processChildErrors(t){const{props:c,items:l}=t;if(!c&&!l)return;const f=a._`typeof ${I} == "object"`;const p=a._`Array.isArray(${I})`;const m=i.let("emErrors");let E;let C;const Q=i.let("templates");if(c&&l){E=i.let("emChildKwd");i.if(f);i.if(p,()=>{init(l,y.items);i.assign(E,a.str`items`)},()=>{init(c,y.properties);i.assign(E,a.str`properties`)});C=a._`[${E}]`}else if(l){i.if(p);init(l,y.items);C=a._`.items`}else if(c){i.if(A.and(f,A.not(p)));init(c,y.properties);C=a._`.properties`}i.forOf("err",h.default.vErrors,t=>ifMatchesChildError(t,m,n=>i.code(a._`${m}[${n}].push(${t})`).assign(a._`${t}.${g}`,true)));i.forIn("key",m,t=>i.if(a._`${m}[${t}].length`,()=>{d.reportError(n,{message:a._`${t} in ${Q} ? ${Q}[${t}]() : ${B}${C}[${t}]`,params:a._`{errors: ${m}[${t}]}`});i.assign(a._`${h.default.vErrors}[${h.default.errors}-1].instancePath`,a._`${S} + "/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`)}));i.endIf();function init(t,n){i.assign(m,a.stringify(t));i.assign(Q,getTemplatesCode(t,n))}}function processAllErrors(t){const A=i.const("emErrs",a._`[]`);i.forOf("err",h.default.vErrors,t=>i.if(matchAnyError(t),()=>i.code(a._`${A}.push(${t})`).assign(a._`${t}.${g}`,true)));i.if(a._`${A}.length`,()=>d.reportError(n,{message:templateExpr(t),params:a._`{errors: ${A}}`}))}function removeUsedErrors(){const t=i.const("emErrs",a._`[]`);i.forOf("err",h.default.vErrors,n=>i.if(a._`!${n}.${g}`,()=>i.code(a._`${t}.push(${n})`)));i.assign(h.default.vErrors,t).assign(h.default.errors,a._`${t}.length`)}function matchKeywordError(t,n){return A.and(a._`${t}.keyword !== ${f}`,a._`!${t}.${g}`,a._`${t}.instancePath === ${S}`,a._`${t}.keyword in ${n}`,a._`${t}.schemaPath.indexOf(${Q.errSchemaPath}) === 0`,a._`/^\\/[^\\/]*$/.test(${t}.schemaPath.slice(${Q.errSchemaPath.length}))`)}function ifMatchesChildError(t,n,c){i.if(A.and(a._`${t}.keyword !== ${f}`,a._`!${t}.${g}`,a._`${t}.instancePath.indexOf(${S}) === 0`),()=>{const A=i.scopeValue("pattern",{ref:/^\/([^/]*)(?:\/|$)/,code:a._`new RegExp("^\\\/([^/]*)(?:\\\/|$)")`});const l=i.const("emMatches",a._`${A}.exec(${t}.instancePath.slice(${S}.length))`);const d=i.const("emChild",a._`${l} && ${l}[1].replace(/~1/g, "/").replace(/~0/g, "~")`);i.if(a._`${d} !== undefined && ${d} in ${n}`,()=>c(d))})}function matchAnyError(t){return A.and(a._`${t}.keyword !== ${f}`,a._`!${t}.${g}`,A.or(a._`${t}.instancePath === ${S}`,A.and(a._`${t}.instancePath.indexOf(${S}) === 0`,a._`${t}.instancePath[${S}.length] === "/"`)),a._`${t}.schemaPath.indexOf(${Q.errSchemaPath}) === 0`,a._`${t}.schemaPath[${Q.errSchemaPath}.length] === "/"`)}function getTemplatesCode(t,n){const a=[];for(const i in t){const t=n[i];if(m.test(t))a.push([i,templateFunc(t)])}return i.object(...a)}function templateExpr(t){if(!m.test(t))return a.stringify(t);return new c._Code(c.safeStringify(t).replace(E,(t,n)=>`" + JSON.stringify(${l.getData(n,Q)}) + "`).replace(C,""))}function templateFunc(t){return a._`function(){return ${templateExpr(t)}}`}},metaSchema:{anyOf:[{type:"string"},{type:"object",properties:{properties:{$ref:"#/$defs/stringMap"},items:{$ref:"#/$defs/stringList"},required:{$ref:"#/$defs/stringOrMap"},dependencies:{$ref:"#/$defs/stringOrMap"}},additionalProperties:{type:"string"}}],$defs:{stringMap:{type:"object",additionalProperties:{type:"string"}},stringOrMap:{anyOf:[{type:"string"},{$ref:"#/$defs/stringMap"}]},stringList:{type:"array",items:{type:"string"}}}}}}const ajvErrors=(t,n={})=>{if(!t.opts.allErrors)throw new Error("ajv-errors: Ajv option allErrors must be true");if(t.opts.jsPropertySyntax){throw new Error("ajv-errors: ajv option jsPropertySyntax is not supported")}return t.addKeyword(errorMessage(n))};n["default"]=ajvErrors;t.exports=ajvErrors;t.exports["default"]=ajvErrors},779:(t,n)=>{Object.defineProperty(n,"__esModule",{value:true});n.formatNames=n.fastFormats=n.fullFormats=void 0;function fmtDef(t,n){return{validate:t,compare:n}}n.fullFormats={date:fmtDef(date,compareDate),time:fmtDef(getTime(true),compareTime),"date-time":fmtDef(getDateTime(true),compareDateTime),"iso-time":fmtDef(getTime(),compareIsoTime),"iso-date-time":fmtDef(getDateTime(),compareIsoDateTime),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:uri,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:regex,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:byte,int32:{type:"number",validate:validateInt32},int64:{type:"number",validate:validateInt64},float:{type:"number",validate:validateNumber},double:{type:"number",validate:validateNumber},password:true,binary:true};n.fastFormats={...n.fullFormats,date:fmtDef(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,compareDate),time:fmtDef(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,compareTime),"date-time":fmtDef(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,compareDateTime),"iso-time":fmtDef(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,compareIsoTime),"iso-date-time":fmtDef(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,compareIsoDateTime),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i};n.formatNames=Object.keys(n.fullFormats);function isLeapYear(t){return t%4===0&&(t%100!==0||t%400===0)}const i=/^(\d\d\d\d)-(\d\d)-(\d\d)$/;const a=[0,31,28,31,30,31,30,31,31,30,31,30,31];function date(t){const n=i.exec(t);if(!n)return false;const A=+n[1];const c=+n[2];const l=+n[3];return c>=1&&c<=12&&l>=1&&l<=(c===2&&isLeapYear(A)?29:a[c])}function compareDate(t,n){if(!(t&&n))return undefined;if(t>n)return 1;if(t23||g>59||t&&!d)return false;if(a<=23&&c<=59&&l<60)return true;const p=c-g*h;const m=a-f*h-(p<0?1:0);return(m===23||m===-1)&&(p===59||p===-1)&&l<61}}function compareTime(t,n){if(!(t&&n))return undefined;const i=new Date("2020-01-01T"+t).valueOf();const a=new Date("2020-01-01T"+n).valueOf();if(!(i&&a))return undefined;return i-a}function compareIsoTime(t,n){if(!(t&&n))return undefined;const i=A.exec(t);const a=A.exec(n);if(!(i&&a))return undefined;t=i[1]+i[2]+i[3];n=a[1]+a[2]+a[3];if(t>n)return 1;if(t=f}function validateInt64(t){return Number.isInteger(t)}function validateNumber(){return true}const p=/[^\\]\\Z/;function regex(t){if(p.test(t))return false;try{new RegExp(t);return true}catch(t){return false}}},2815:(t,n,i)=>{Object.defineProperty(n,"__esModule",{value:true});const a=i(779);const A=i(1284);const c=i(1436);const l=new c.Name("fullFormats");const d=new c.Name("fastFormats");const formatsPlugin=(t,n={keywords:true})=>{if(Array.isArray(n)){addFormats(t,n,a.fullFormats,l);return t}const[i,c]=n.mode==="fast"?[a.fastFormats,d]:[a.fullFormats,l];const h=n.formats||a.formatNames;addFormats(t,h,i,c);if(n.keywords)(0,A.default)(t);return t};formatsPlugin.get=(t,n="full")=>{const i=n==="fast"?a.fastFormats:a.fullFormats;const A=i[t];if(!A)throw new Error(`Unknown format "${t}"`);return A};function addFormats(t,n,i,a){var A;var l;(A=(l=t.opts.code).formats)!==null&&A!==void 0?A:l.formats=(0,c._)`require("ajv-formats/dist/formats").${a}`;for(const a of n)t.addFormat(a,i[a])}t.exports=n=formatsPlugin;Object.defineProperty(n,"__esModule",{value:true});n["default"]=formatsPlugin},1284:(t,n,i)=>{Object.defineProperty(n,"__esModule",{value:true});n.formatLimitDefinition=void 0;const a=i(2463);const A=i(1436);const c=A.operators;const l={formatMaximum:{okStr:"<=",ok:c.LTE,fail:c.GT},formatMinimum:{okStr:">=",ok:c.GTE,fail:c.LT},formatExclusiveMaximum:{okStr:"<",ok:c.LT,fail:c.GTE},formatExclusiveMinimum:{okStr:">",ok:c.GT,fail:c.LTE}};const d={message:({keyword:t,schemaCode:n})=>(0,A.str)`should be ${l[t].okStr} ${n}`,params:({keyword:t,schemaCode:n})=>(0,A._)`{comparison: ${l[t].okStr}, limit: ${n}}`};n.formatLimitDefinition={keyword:Object.keys(l),type:"string",schemaType:"string",$data:true,error:d,code(t){const{gen:n,data:i,schemaCode:c,keyword:d,it:h}=t;const{opts:f,self:g}=h;if(!f.validateFormats)return;const p=new a.KeywordCxt(h,g.RULES.all.format.definition,"format");if(p.$data)validate$DataFormat();else validateFormat();function validate$DataFormat(){const i=n.scopeValue("formats",{ref:g.formats,code:f.code.formats});const a=n.const("fmt",(0,A._)`${i}[${p.schemaCode}]`);t.fail$data((0,A.or)((0,A._)`typeof ${a} != "object"`,(0,A._)`${a} instanceof RegExp`,(0,A._)`typeof ${a}.compare != "function"`,compareCode(a)))}function validateFormat(){const i=p.schema;const a=g.formats[i];if(!a||a===true)return;if(typeof a!="object"||a instanceof RegExp||typeof a.compare!="function"){throw new Error(`"${d}": format "${i}" does not define "compare" function`)}const c=n.scopeValue("formats",{key:i,ref:a,code:f.code.formats?(0,A._)`${f.code.formats}${(0,A.getProperty)(i)}`:undefined});t.fail$data(compareCode(c))}function compareCode(t){return(0,A._)`${t}.compare(${i}, ${c}) ${l[d].fail} 0`}},dependencies:["format"]};const formatLimitPlugin=t=>{t.addKeyword(n.formatLimitDefinition);return t};n["default"]=formatLimitPlugin},878:(t,n,i)=>{Object.defineProperty(n,"__esModule",{value:true});n.MissingRefError=n.ValidationError=n.CodeGen=n.Name=n.nil=n.stringify=n.str=n._=n.KeywordCxt=n.Ajv2019=void 0;const a=i(3893);const A=i(9941);const c=i(9923);const l=i(7844);const d=i(2010);const h=i(8886);const f=i(5375);const g="https://json-schema.org/draft/2019-09/schema";class Ajv2019 extends a.default{constructor(t={}){super({...t,dynamicRef:true,next:true,unevaluated:true})}_addVocabularies(){super._addVocabularies();this.addVocabulary(c.default);A.default.forEach(t=>this.addVocabulary(t));this.addVocabulary(l.default);this.addVocabulary(d.default);if(this.opts.discriminator)this.addKeyword(h.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();const{$data:t,meta:n}=this.opts;if(!n)return;f.default.call(this,t);this.refs["http://json-schema.org/schema"]=g}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(g)?g:undefined)}}n.Ajv2019=Ajv2019;t.exports=n=Ajv2019;t.exports.Ajv2019=Ajv2019;Object.defineProperty(n,"__esModule",{value:true});n["default"]=Ajv2019;var p=i(7881);Object.defineProperty(n,"KeywordCxt",{enumerable:true,get:function(){return p.KeywordCxt}});var m=i(1436);Object.defineProperty(n,"_",{enumerable:true,get:function(){return m._}});Object.defineProperty(n,"str",{enumerable:true,get:function(){return m.str}});Object.defineProperty(n,"stringify",{enumerable:true,get:function(){return m.stringify}});Object.defineProperty(n,"nil",{enumerable:true,get:function(){return m.nil}});Object.defineProperty(n,"Name",{enumerable:true,get:function(){return m.Name}});Object.defineProperty(n,"CodeGen",{enumerable:true,get:function(){return m.CodeGen}});var E=i(3021);Object.defineProperty(n,"ValidationError",{enumerable:true,get:function(){return E.default}});var C=i(3162);Object.defineProperty(n,"MissingRefError",{enumerable:true,get:function(){return C.default}})},2463:(t,n,i)=>{Object.defineProperty(n,"__esModule",{value:true});n.MissingRefError=n.ValidationError=n.CodeGen=n.Name=n.nil=n.stringify=n.str=n._=n.KeywordCxt=n.Ajv=void 0;const a=i(3893);const A=i(9941);const c=i(8886);const l=i(2079);const d=["/properties"];const h="http://json-schema.org/draft-07/schema";class Ajv extends a.default{_addVocabularies(){super._addVocabularies();A.default.forEach(t=>this.addVocabulary(t));if(this.opts.discriminator)this.addKeyword(c.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();if(!this.opts.meta)return;const t=this.opts.$data?this.$dataMetaSchema(l,d):l;this.addMetaSchema(t,h,false);this.refs["http://json-schema.org/schema"]=h}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(h)?h:undefined)}}n.Ajv=Ajv;t.exports=n=Ajv;t.exports.Ajv=Ajv;Object.defineProperty(n,"__esModule",{value:true});n["default"]=Ajv;var f=i(7881);Object.defineProperty(n,"KeywordCxt",{enumerable:true,get:function(){return f.KeywordCxt}});var g=i(1436);Object.defineProperty(n,"_",{enumerable:true,get:function(){return g._}});Object.defineProperty(n,"str",{enumerable:true,get:function(){return g.str}});Object.defineProperty(n,"stringify",{enumerable:true,get:function(){return g.stringify}});Object.defineProperty(n,"nil",{enumerable:true,get:function(){return g.nil}});Object.defineProperty(n,"Name",{enumerable:true,get:function(){return g.Name}});Object.defineProperty(n,"CodeGen",{enumerable:true,get:function(){return g.CodeGen}});var p=i(3021);Object.defineProperty(n,"ValidationError",{enumerable:true,get:function(){return p.default}});var m=i(3162);Object.defineProperty(n,"MissingRefError",{enumerable:true,get:function(){return m.default}})},567:(t,n)=>{Object.defineProperty(n,"__esModule",{value:true});n.regexpCode=n.getEsmExportName=n.getProperty=n.safeStringify=n.stringify=n.strConcat=n.addCodeArg=n.str=n._=n.nil=n._Code=n.Name=n.IDENTIFIER=n._CodeOrName=void 0;class _CodeOrName{}n._CodeOrName=_CodeOrName;n.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class Name extends _CodeOrName{constructor(t){super();if(!n.IDENTIFIER.test(t))throw new Error("CodeGen: name must be a valid identifier");this.str=t}toString(){return this.str}emptyStr(){return false}get names(){return{[this.str]:1}}}n.Name=Name;class _Code extends _CodeOrName{constructor(t){super();this._items=typeof t==="string"?[t]:t}toString(){return this.str}emptyStr(){if(this._items.length>1)return false;const t=this._items[0];return t===""||t==='""'}get str(){var t;return(t=this._str)!==null&&t!==void 0?t:this._str=this._items.reduce((t,n)=>`${t}${n}`,"")}get names(){var t;return(t=this._names)!==null&&t!==void 0?t:this._names=this._items.reduce((t,n)=>{if(n instanceof Name)t[n.str]=(t[n.str]||0)+1;return t},{})}}n._Code=_Code;n.nil=new _Code("");function _(t,...n){const i=[t[0]];let a=0;while(a{Object.defineProperty(n,"__esModule",{value:true});n.or=n.and=n.not=n.CodeGen=n.operators=n.varKinds=n.ValueScopeName=n.ValueScope=n.Scope=n.Name=n.regexpCode=n.stringify=n.getProperty=n.nil=n.strConcat=n.str=n._=void 0;const a=i(567);const A=i(7788);var c=i(567);Object.defineProperty(n,"_",{enumerable:true,get:function(){return c._}});Object.defineProperty(n,"str",{enumerable:true,get:function(){return c.str}});Object.defineProperty(n,"strConcat",{enumerable:true,get:function(){return c.strConcat}});Object.defineProperty(n,"nil",{enumerable:true,get:function(){return c.nil}});Object.defineProperty(n,"getProperty",{enumerable:true,get:function(){return c.getProperty}});Object.defineProperty(n,"stringify",{enumerable:true,get:function(){return c.stringify}});Object.defineProperty(n,"regexpCode",{enumerable:true,get:function(){return c.regexpCode}});Object.defineProperty(n,"Name",{enumerable:true,get:function(){return c.Name}});var l=i(7788);Object.defineProperty(n,"Scope",{enumerable:true,get:function(){return l.Scope}});Object.defineProperty(n,"ValueScope",{enumerable:true,get:function(){return l.ValueScope}});Object.defineProperty(n,"ValueScopeName",{enumerable:true,get:function(){return l.ValueScopeName}});Object.defineProperty(n,"varKinds",{enumerable:true,get:function(){return l.varKinds}});n.operators={GT:new a._Code(">"),GTE:new a._Code(">="),LT:new a._Code("<"),LTE:new a._Code("<="),EQ:new a._Code("==="),NEQ:new a._Code("!=="),NOT:new a._Code("!"),OR:new a._Code("||"),AND:new a._Code("&&"),ADD:new a._Code("+")};class Node{optimizeNodes(){return this}optimizeNames(t,n){return this}}class Def extends Node{constructor(t,n,i){super();this.varKind=t;this.name=n;this.rhs=i}render({es5:t,_n:n}){const i=t?A.varKinds.var:this.varKind;const a=this.rhs===undefined?"":` = ${this.rhs}`;return`${i} ${this.name}${a};`+n}optimizeNames(t,n){if(!t[this.name.str])return;if(this.rhs)this.rhs=optimizeExpr(this.rhs,t,n);return this}get names(){return this.rhs instanceof a._CodeOrName?this.rhs.names:{}}}class Assign extends Node{constructor(t,n,i){super();this.lhs=t;this.rhs=n;this.sideEffects=i}render({_n:t}){return`${this.lhs} = ${this.rhs};`+t}optimizeNames(t,n){if(this.lhs instanceof a.Name&&!t[this.lhs.str]&&!this.sideEffects)return;this.rhs=optimizeExpr(this.rhs,t,n);return this}get names(){const t=this.lhs instanceof a.Name?{}:{...this.lhs.names};return addExprNames(t,this.rhs)}}class AssignOp extends Assign{constructor(t,n,i,a){super(t,i,a);this.op=n}render({_n:t}){return`${this.lhs} ${this.op}= ${this.rhs};`+t}}class Label extends Node{constructor(t){super();this.label=t;this.names={}}render({_n:t}){return`${this.label}:`+t}}class Break extends Node{constructor(t){super();this.label=t;this.names={}}render({_n:t}){const n=this.label?` ${this.label}`:"";return`break${n};`+t}}class Throw extends Node{constructor(t){super();this.error=t}render({_n:t}){return`throw ${this.error};`+t}get names(){return this.error.names}}class AnyCode extends Node{constructor(t){super();this.code=t}render({_n:t}){return`${this.code};`+t}optimizeNodes(){return`${this.code}`?this:undefined}optimizeNames(t,n){this.code=optimizeExpr(this.code,t,n);return this}get names(){return this.code instanceof a._CodeOrName?this.code.names:{}}}class ParentNode extends Node{constructor(t=[]){super();this.nodes=t}render(t){return this.nodes.reduce((n,i)=>n+i.render(t),"")}optimizeNodes(){const{nodes:t}=this;let n=t.length;while(n--){const i=t[n].optimizeNodes();if(Array.isArray(i))t.splice(n,1,...i);else if(i)t[n]=i;else t.splice(n,1)}return t.length>0?this:undefined}optimizeNames(t,n){const{nodes:i}=this;let a=i.length;while(a--){const A=i[a];if(A.optimizeNames(t,n))continue;subtractNames(t,A.names);i.splice(a,1)}return i.length>0?this:undefined}get names(){return this.nodes.reduce((t,n)=>addNames(t,n.names),{})}}class BlockNode extends ParentNode{render(t){return"{"+t._n+super.render(t)+"}"+t._n}}class Root extends ParentNode{}class Else extends BlockNode{}Else.kind="else";class If extends BlockNode{constructor(t,n){super(n);this.condition=t}render(t){let n=`if(${this.condition})`+super.render(t);if(this.else)n+="else "+this.else.render(t);return n}optimizeNodes(){super.optimizeNodes();const t=this.condition;if(t===true)return this.nodes;let n=this.else;if(n){const t=n.optimizeNodes();n=this.else=Array.isArray(t)?new Else(t):t}if(n){if(t===false)return n instanceof If?n:n.nodes;if(this.nodes.length)return this;return new If(not(t),n instanceof If?[n]:n.nodes)}if(t===false||!this.nodes.length)return undefined;return this}optimizeNames(t,n){var i;this.else=(i=this.else)===null||i===void 0?void 0:i.optimizeNames(t,n);if(!(super.optimizeNames(t,n)||this.else))return;this.condition=optimizeExpr(this.condition,t,n);return this}get names(){const t=super.names;addExprNames(t,this.condition);if(this.else)addNames(t,this.else.names);return t}}If.kind="if";class For extends BlockNode{}For.kind="for";class ForLoop extends For{constructor(t){super();this.iteration=t}render(t){return`for(${this.iteration})`+super.render(t)}optimizeNames(t,n){if(!super.optimizeNames(t,n))return;this.iteration=optimizeExpr(this.iteration,t,n);return this}get names(){return addNames(super.names,this.iteration.names)}}class ForRange extends For{constructor(t,n,i,a){super();this.varKind=t;this.name=n;this.from=i;this.to=a}render(t){const n=t.es5?A.varKinds.var:this.varKind;const{name:i,from:a,to:c}=this;return`for(${n} ${i}=${a}; ${i}<${c}; ${i}++)`+super.render(t)}get names(){const t=addExprNames(super.names,this.from);return addExprNames(t,this.to)}}class ForIter extends For{constructor(t,n,i,a){super();this.loop=t;this.varKind=n;this.name=i;this.iterable=a}render(t){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(t)}optimizeNames(t,n){if(!super.optimizeNames(t,n))return;this.iterable=optimizeExpr(this.iterable,t,n);return this}get names(){return addNames(super.names,this.iterable.names)}}class Func extends BlockNode{constructor(t,n,i){super();this.name=t;this.args=n;this.async=i}render(t){const n=this.async?"async ":"";return`${n}function ${this.name}(${this.args})`+super.render(t)}}Func.kind="func";class Return extends ParentNode{render(t){return"return "+super.render(t)}}Return.kind="return";class Try extends BlockNode{render(t){let n="try"+super.render(t);if(this.catch)n+=this.catch.render(t);if(this.finally)n+=this.finally.render(t);return n}optimizeNodes(){var t,n;super.optimizeNodes();(t=this.catch)===null||t===void 0?void 0:t.optimizeNodes();(n=this.finally)===null||n===void 0?void 0:n.optimizeNodes();return this}optimizeNames(t,n){var i,a;super.optimizeNames(t,n);(i=this.catch)===null||i===void 0?void 0:i.optimizeNames(t,n);(a=this.finally)===null||a===void 0?void 0:a.optimizeNames(t,n);return this}get names(){const t=super.names;if(this.catch)addNames(t,this.catch.names);if(this.finally)addNames(t,this.finally.names);return t}}class Catch extends BlockNode{constructor(t){super();this.error=t}render(t){return`catch(${this.error})`+super.render(t)}}Catch.kind="catch";class Finally extends BlockNode{render(t){return"finally"+super.render(t)}}Finally.kind="finally";class CodeGen{constructor(t,n={}){this._values={};this._blockStarts=[];this._constants={};this.opts={...n,_n:n.lines?"\n":""};this._extScope=t;this._scope=new A.Scope({parent:t});this._nodes=[new Root]}toString(){return this._root.render(this.opts)}name(t){return this._scope.name(t)}scopeName(t){return this._extScope.name(t)}scopeValue(t,n){const i=this._extScope.value(t,n);const a=this._values[i.prefix]||(this._values[i.prefix]=new Set);a.add(i);return i}getScopeValue(t,n){return this._extScope.getValue(t,n)}scopeRefs(t){return this._extScope.scopeRefs(t,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(t,n,i,a){const A=this._scope.toName(n);if(i!==undefined&&a)this._constants[A.str]=i;this._leafNode(new Def(t,A,i));return A}const(t,n,i){return this._def(A.varKinds.const,t,n,i)}let(t,n,i){return this._def(A.varKinds.let,t,n,i)}var(t,n,i){return this._def(A.varKinds.var,t,n,i)}assign(t,n,i){return this._leafNode(new Assign(t,n,i))}add(t,i){return this._leafNode(new AssignOp(t,n.operators.ADD,i))}code(t){if(typeof t=="function")t();else if(t!==a.nil)this._leafNode(new AnyCode(t));return this}object(...t){const n=["{"];for(const[i,A]of t){if(n.length>1)n.push(",");n.push(i);if(i!==A||this.opts.es5){n.push(":");(0,a.addCodeArg)(n,A)}}n.push("}");return new a._Code(n)}if(t,n,i){this._blockNode(new If(t));if(n&&i){this.code(n).else().code(i).endIf()}else if(n){this.code(n).endIf()}else if(i){throw new Error('CodeGen: "else" body without "then" body')}return this}elseIf(t){return this._elseNode(new If(t))}else(){return this._elseNode(new Else)}endIf(){return this._endBlockNode(If,Else)}_for(t,n){this._blockNode(t);if(n)this.code(n).endFor();return this}for(t,n){return this._for(new ForLoop(t),n)}forRange(t,n,i,a,c=(this.opts.es5?A.varKinds.var:A.varKinds.let)){const l=this._scope.toName(t);return this._for(new ForRange(c,l,n,i),()=>a(l))}forOf(t,n,i,c=A.varKinds.const){const l=this._scope.toName(t);if(this.opts.es5){const t=n instanceof a.Name?n:this.var("_arr",n);return this.forRange("_i",0,(0,a._)`${t}.length`,n=>{this.var(l,(0,a._)`${t}[${n}]`);i(l)})}return this._for(new ForIter("of",c,l,n),()=>i(l))}forIn(t,n,i,c=(this.opts.es5?A.varKinds.var:A.varKinds.const)){if(this.opts.ownProperties){return this.forOf(t,(0,a._)`Object.keys(${n})`,i)}const l=this._scope.toName(t);return this._for(new ForIter("in",c,l,n),()=>i(l))}endFor(){return this._endBlockNode(For)}label(t){return this._leafNode(new Label(t))}break(t){return this._leafNode(new Break(t))}return(t){const n=new Return;this._blockNode(n);this.code(t);if(n.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Return)}try(t,n,i){if(!n&&!i)throw new Error('CodeGen: "try" without "catch" and "finally"');const a=new Try;this._blockNode(a);this.code(t);if(n){const t=this.name("e");this._currNode=a.catch=new Catch(t);n(t)}if(i){this._currNode=a.finally=new Finally;this.code(i)}return this._endBlockNode(Catch,Finally)}throw(t){return this._leafNode(new Throw(t))}block(t,n){this._blockStarts.push(this._nodes.length);if(t)this.code(t).endBlock(n);return this}endBlock(t){const n=this._blockStarts.pop();if(n===undefined)throw new Error("CodeGen: not in self-balancing block");const i=this._nodes.length-n;if(i<0||t!==undefined&&i!==t){throw new Error(`CodeGen: wrong number of nodes: ${i} vs ${t} expected`)}this._nodes.length=n;return this}func(t,n=a.nil,i,A){this._blockNode(new Func(t,n,i));if(A)this.code(A).endFunc();return this}endFunc(){return this._endBlockNode(Func)}optimize(t=1){while(t-- >0){this._root.optimizeNodes();this._root.optimizeNames(this._root.names,this._constants)}}_leafNode(t){this._currNode.nodes.push(t);return this}_blockNode(t){this._currNode.nodes.push(t);this._nodes.push(t)}_endBlockNode(t,n){const i=this._currNode;if(i instanceof t||n&&i instanceof n){this._nodes.pop();return this}throw new Error(`CodeGen: not in block "${n?`${t.kind}/${n.kind}`:t.kind}"`)}_elseNode(t){const n=this._currNode;if(!(n instanceof If)){throw new Error('CodeGen: "else" without "if"')}this._currNode=n.else=t;return this}get _root(){return this._nodes[0]}get _currNode(){const t=this._nodes;return t[t.length-1]}set _currNode(t){const n=this._nodes;n[n.length-1]=t}}n.CodeGen=CodeGen;function addNames(t,n){for(const i in n)t[i]=(t[i]||0)+(n[i]||0);return t}function addExprNames(t,n){return n instanceof a._CodeOrName?addNames(t,n.names):t}function optimizeExpr(t,n,i){if(t instanceof a.Name)return replaceName(t);if(!canOptimize(t))return t;return new a._Code(t._items.reduce((t,n)=>{if(n instanceof a.Name)n=replaceName(n);if(n instanceof a._Code)t.push(...n._items);else t.push(n);return t},[]));function replaceName(t){const a=i[t.str];if(a===undefined||n[t.str]!==1)return t;delete n[t.str];return a}function canOptimize(t){return t instanceof a._Code&&t._items.some(t=>t instanceof a.Name&&n[t.str]===1&&i[t.str]!==undefined)}}function subtractNames(t,n){for(const i in n)t[i]=(t[i]||0)-(n[i]||0)}function not(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,a._)`!${par(t)}`}n.not=not;const d=mappend(n.operators.AND);function and(...t){return t.reduce(d)}n.and=and;const h=mappend(n.operators.OR);function or(...t){return t.reduce(h)}n.or=or;function mappend(t){return(n,i)=>n===a.nil?i:i===a.nil?n:(0,a._)`${par(n)} ${t} ${par(i)}`}function par(t){return t instanceof a.Name?t:(0,a._)`(${t})`}},7788:(t,n,i)=>{Object.defineProperty(n,"__esModule",{value:true});n.ValueScope=n.ValueScopeName=n.Scope=n.varKinds=n.UsedValueState=void 0;const a=i(567);class ValueError extends Error{constructor(t){super(`CodeGen: "code" for ${t} not defined`);this.value=t.value}}var A;(function(t){t[t["Started"]=0]="Started";t[t["Completed"]=1]="Completed"})(A||(n.UsedValueState=A={}));n.varKinds={const:new a.Name("const"),let:new a.Name("let"),var:new a.Name("var")};class Scope{constructor({prefixes:t,parent:n}={}){this._names={};this._prefixes=t;this._parent=n}toName(t){return t instanceof a.Name?t:this.name(t)}name(t){return new a.Name(this._newName(t))}_newName(t){const n=this._names[t]||this._nameGroup(t);return`${t}${n.index++}`}_nameGroup(t){var n,i;if(((i=(n=this._parent)===null||n===void 0?void 0:n._prefixes)===null||i===void 0?void 0:i.has(t))||this._prefixes&&!this._prefixes.has(t)){throw new Error(`CodeGen: prefix "${t}" is not allowed in this scope`)}return this._names[t]={prefix:t,index:0}}}n.Scope=Scope;class ValueScopeName extends a.Name{constructor(t,n){super(n);this.prefix=t}setValue(t,{property:n,itemIndex:i}){this.value=t;this.scopePath=(0,a._)`.${new a.Name(n)}[${i}]`}}n.ValueScopeName=ValueScopeName;const c=(0,a._)`\n`;class ValueScope extends Scope{constructor(t){super(t);this._values={};this._scope=t.scope;this.opts={...t,_n:t.lines?c:a.nil}}get(){return this._scope}name(t){return new ValueScopeName(t,this._newName(t))}value(t,n){var i;if(n.ref===undefined)throw new Error("CodeGen: ref must be passed in value");const a=this.toName(t);const{prefix:A}=a;const c=(i=n.key)!==null&&i!==void 0?i:n.ref;let l=this._values[A];if(l){const t=l.get(c);if(t)return t}else{l=this._values[A]=new Map}l.set(c,a);const d=this._scope[A]||(this._scope[A]=[]);const h=d.length;d[h]=n.ref;a.setValue(n,{property:A,itemIndex:h});return a}getValue(t,n){const i=this._values[t];if(!i)return;return i.get(n)}scopeRefs(t,n=this._values){return this._reduceValues(n,n=>{if(n.scopePath===undefined)throw new Error(`CodeGen: name "${n}" has no value`);return(0,a._)`${t}${n.scopePath}`})}scopeCode(t=this._values,n,i){return this._reduceValues(t,t=>{if(t.value===undefined)throw new Error(`CodeGen: name "${t}" has no value`);return t.value.code},n,i)}_reduceValues(t,i,c={},l){let d=a.nil;for(const h in t){const f=t[h];if(!f)continue;const g=c[h]=c[h]||new Map;f.forEach(t=>{if(g.has(t))return;g.set(t,A.Started);let c=i(t);if(c){const i=this.opts.es5?n.varKinds.var:n.varKinds.const;d=(0,a._)`${d}${i} ${t} = ${c};${this.opts._n}`}else if(c=l===null||l===void 0?void 0:l(t)){d=(0,a._)`${d}${c}${this.opts._n}`}else{throw new ValueError(t)}g.set(t,A.Completed)})}return d}}n.ValueScope=ValueScope},1283:(t,n,i)=>{Object.defineProperty(n,"__esModule",{value:true});n.extendErrors=n.resetErrorsCount=n.reportExtraError=n.reportError=n.keyword$DataError=n.keywordError=void 0;const a=i(1436);const A=i(4464);const c=i(630);n.keywordError={message:({keyword:t})=>(0,a.str)`must pass "${t}" keyword validation`};n.keyword$DataError={message:({keyword:t,schemaType:n})=>n?(0,a.str)`"${t}" keyword must be ${n} ($data)`:(0,a.str)`"${t}" keyword is invalid ($data)`};function reportError(t,i=n.keywordError,A,c){const{it:l}=t;const{gen:d,compositeRule:h,allErrors:f}=l;const g=errorObjectCode(t,i,A);if(c!==null&&c!==void 0?c:h||f){addError(d,g)}else{returnErrors(l,(0,a._)`[${g}]`)}}n.reportError=reportError;function reportExtraError(t,i=n.keywordError,a){const{it:A}=t;const{gen:l,compositeRule:d,allErrors:h}=A;const f=errorObjectCode(t,i,a);addError(l,f);if(!(d||h)){returnErrors(A,c.default.vErrors)}}n.reportExtraError=reportExtraError;function resetErrorsCount(t,n){t.assign(c.default.errors,n);t.if((0,a._)`${c.default.vErrors} !== null`,()=>t.if(n,()=>t.assign((0,a._)`${c.default.vErrors}.length`,n),()=>t.assign(c.default.vErrors,null)))}n.resetErrorsCount=resetErrorsCount;function extendErrors({gen:t,keyword:n,schemaValue:i,data:A,errsCount:l,it:d}){if(l===undefined)throw new Error("ajv implementation error");const h=t.name("err");t.forRange("i",l,c.default.errors,l=>{t.const(h,(0,a._)`${c.default.vErrors}[${l}]`);t.if((0,a._)`${h}.instancePath === undefined`,()=>t.assign((0,a._)`${h}.instancePath`,(0,a.strConcat)(c.default.instancePath,d.errorPath)));t.assign((0,a._)`${h}.schemaPath`,(0,a.str)`${d.errSchemaPath}/${n}`);if(d.opts.verbose){t.assign((0,a._)`${h}.schema`,i);t.assign((0,a._)`${h}.data`,A)}})}n.extendErrors=extendErrors;function addError(t,n){const i=t.const("err",n);t.if((0,a._)`${c.default.vErrors} === null`,()=>t.assign(c.default.vErrors,(0,a._)`[${i}]`),(0,a._)`${c.default.vErrors}.push(${i})`);t.code((0,a._)`${c.default.errors}++`)}function returnErrors(t,n){const{gen:i,validateName:A,schemaEnv:c}=t;if(c.$async){i.throw((0,a._)`new ${t.ValidationError}(${n})`)}else{i.assign((0,a._)`${A}.errors`,n);i.return(false)}}const l={keyword:new a.Name("keyword"),schemaPath:new a.Name("schemaPath"),params:new a.Name("params"),propertyName:new a.Name("propertyName"),message:new a.Name("message"),schema:new a.Name("schema"),parentSchema:new a.Name("parentSchema")};function errorObjectCode(t,n,i){const{createErrors:A}=t.it;if(A===false)return(0,a._)`{}`;return errorObject(t,n,i)}function errorObject(t,n,i={}){const{gen:a,it:A}=t;const c=[errorInstancePath(A,i),errorSchemaPath(t,i)];extraErrorProps(t,n,c);return a.object(...c)}function errorInstancePath({errorPath:t},{instancePath:n}){const i=n?(0,a.str)`${t}${(0,A.getErrorPath)(n,A.Type.Str)}`:t;return[c.default.instancePath,(0,a.strConcat)(c.default.instancePath,i)]}function errorSchemaPath({keyword:t,it:{errSchemaPath:n}},{schemaPath:i,parentSchema:c}){let d=c?n:(0,a.str)`${n}/${t}`;if(i){d=(0,a.str)`${d}${(0,A.getErrorPath)(i,A.Type.Str)}`}return[l.schemaPath,d]}function extraErrorProps(t,{params:n,message:i},A){const{keyword:d,data:h,schemaValue:f,it:g}=t;const{opts:p,propertyName:m,topSchemaRef:E,schemaPath:C}=g;A.push([l.keyword,d],[l.params,typeof n=="function"?n(t):n||(0,a._)`{}`]);if(p.messages){A.push([l.message,typeof i=="function"?i(t):i])}if(p.verbose){A.push([l.schema,f],[l.parentSchema,(0,a._)`${E}${C}`],[c.default.data,h])}if(m)A.push([l.propertyName,m])}},2718:(t,n,i)=>{Object.defineProperty(n,"__esModule",{value:true});n.resolveSchema=n.getCompilingSchema=n.resolveRef=n.compileSchema=n.SchemaEnv=void 0;const a=i(1436);const A=i(3021);const c=i(630);const l=i(4090);const d=i(4464);const h=i(7881);class SchemaEnv{constructor(t){var n;this.refs={};this.dynamicAnchors={};let i;if(typeof t.schema=="object")i=t.schema;this.schema=t.schema;this.schemaId=t.schemaId;this.root=t.root||this;this.baseId=(n=t.baseId)!==null&&n!==void 0?n:(0,l.normalizeId)(i===null||i===void 0?void 0:i[t.schemaId||"$id"]);this.schemaPath=t.schemaPath;this.localRefs=t.localRefs;this.meta=t.meta;this.$async=i===null||i===void 0?void 0:i.$async;this.refs={}}}n.SchemaEnv=SchemaEnv;function compileSchema(t){const n=getCompilingSchema.call(this,t);if(n)return n;const i=(0,l.getFullPath)(this.opts.uriResolver,t.root.baseId);const{es5:d,lines:f}=this.opts.code;const{ownProperties:g}=this.opts;const p=new a.CodeGen(this.scope,{es5:d,lines:f,ownProperties:g});let m;if(t.$async){m=p.scopeValue("Error",{ref:A.default,code:(0,a._)`require("ajv/dist/runtime/validation_error").default`})}const E=p.scopeName("validate");t.validateName=E;const C={gen:p,allErrors:this.opts.allErrors,data:c.default.data,parentData:c.default.parentData,parentDataProperty:c.default.parentDataProperty,dataNames:[c.default.data],dataPathArr:[a.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:p.scopeValue("schema",this.opts.code.source===true?{ref:t.schema,code:(0,a.stringify)(t.schema)}:{ref:t.schema}),validateName:E,ValidationError:m,schema:t.schema,schemaEnv:t,rootId:i,baseId:t.baseId||i,schemaPath:a.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,a._)`""`,opts:this.opts,self:this};let I;try{this._compilations.add(t);(0,h.validateFunctionCode)(C);p.optimize(this.opts.code.optimize);const n=p.toString();I=`${p.scopeRefs(c.default.scope)}return ${n}`;if(this.opts.code.process)I=this.opts.code.process(I,t);const i=new Function(`${c.default.self}`,`${c.default.scope}`,I);const A=i(this,this.scope.get());this.scope.value(E,{ref:A});A.errors=null;A.schema=t.schema;A.schemaEnv=t;if(t.$async)A.$async=true;if(this.opts.code.source===true){A.source={validateName:E,validateCode:n,scopeValues:p._values}}if(this.opts.unevaluated){const{props:t,items:n}=C;A.evaluated={props:t instanceof a.Name?undefined:t,items:n instanceof a.Name?undefined:n,dynamicProps:t instanceof a.Name,dynamicItems:n instanceof a.Name};if(A.source)A.source.evaluated=(0,a.stringify)(A.evaluated)}t.validate=A;return t}catch(n){delete t.validate;delete t.validateName;if(I)this.logger.error("Error compiling schema, function code:",I);throw n}finally{this._compilations.delete(t)}}n.compileSchema=compileSchema;function resolveRef(t,n,i){var a;i=(0,l.resolveUrl)(this.opts.uriResolver,n,i);const A=t.refs[i];if(A)return A;let c=resolve.call(this,t,i);if(c===undefined){const A=(a=t.localRefs)===null||a===void 0?void 0:a[i];const{schemaId:l}=this.opts;if(A)c=new SchemaEnv({schema:A,schemaId:l,root:t,baseId:n})}if(c===undefined)return;return t.refs[i]=inlineOrCompile.call(this,c)}n.resolveRef=resolveRef;function inlineOrCompile(t){if((0,l.inlineRef)(t.schema,this.opts.inlineRefs))return t.schema;return t.validate?t:compileSchema.call(this,t)}function getCompilingSchema(t){for(const n of this._compilations){if(sameSchemaEnv(n,t))return n}}n.getCompilingSchema=getCompilingSchema;function sameSchemaEnv(t,n){return t.schema===n.schema&&t.root===n.root&&t.baseId===n.baseId}function resolve(t,n){let i;while(typeof(i=this.refs[n])=="string")n=i;return i||this.schemas[n]||resolveSchema.call(this,t,n)}function resolveSchema(t,n){const i=this.opts.uriResolver.parse(n);const a=(0,l._getFullPath)(this.opts.uriResolver,i);let A=(0,l.getFullPath)(this.opts.uriResolver,t.baseId,undefined);if(Object.keys(t.schema).length>0&&a===A){return getJsonPointer.call(this,i,t)}const c=(0,l.normalizeId)(a);const d=this.refs[c]||this.schemas[c];if(typeof d=="string"){const n=resolveSchema.call(this,t,d);if(typeof(n===null||n===void 0?void 0:n.schema)!=="object")return;return getJsonPointer.call(this,i,n)}if(typeof(d===null||d===void 0?void 0:d.schema)!=="object")return;if(!d.validate)compileSchema.call(this,d);if(c===(0,l.normalizeId)(n)){const{schema:n}=d;const{schemaId:i}=this.opts;const a=n[i];if(a)A=(0,l.resolveUrl)(this.opts.uriResolver,A,a);return new SchemaEnv({schema:n,schemaId:i,root:t,baseId:A})}return getJsonPointer.call(this,i,d)}n.resolveSchema=resolveSchema;const f=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function getJsonPointer(t,{baseId:n,schema:i,root:a}){var A;if(((A=t.fragment)===null||A===void 0?void 0:A[0])!=="/")return;for(const a of t.fragment.slice(1).split("/")){if(typeof i==="boolean")return;const t=i[(0,d.unescapeFragment)(a)];if(t===undefined)return;i=t;const A=typeof i==="object"&&i[this.opts.schemaId];if(!f.has(a)&&A){n=(0,l.resolveUrl)(this.opts.uriResolver,n,A)}}let c;if(typeof i!="boolean"&&i.$ref&&!(0,d.schemaHasRulesButRef)(i,this.RULES)){const t=(0,l.resolveUrl)(this.opts.uriResolver,n,i.$ref);c=resolveSchema.call(this,a,t)}const{schemaId:h}=this.opts;c=c||new SchemaEnv({schema:i,schemaId:h,root:a,baseId:n});if(c.schema!==c.root.schema)return c;return undefined}},630:(t,n,i)=>{Object.defineProperty(n,"__esModule",{value:true});const a=i(1436);const A={data:new a.Name("data"),valCxt:new a.Name("valCxt"),instancePath:new a.Name("instancePath"),parentData:new a.Name("parentData"),parentDataProperty:new a.Name("parentDataProperty"),rootData:new a.Name("rootData"),dynamicAnchors:new a.Name("dynamicAnchors"),vErrors:new a.Name("vErrors"),errors:new a.Name("errors"),this:new a.Name("this"),self:new a.Name("self"),scope:new a.Name("scope"),json:new a.Name("json"),jsonPos:new a.Name("jsonPos"),jsonLen:new a.Name("jsonLen"),jsonPart:new a.Name("jsonPart")};n["default"]=A},3162:(t,n,i)=>{Object.defineProperty(n,"__esModule",{value:true});const a=i(4090);class MissingRefError extends Error{constructor(t,n,i,A){super(A||`can't resolve reference ${i} from id ${n}`);this.missingRef=(0,a.resolveUrl)(t,n,i);this.missingSchema=(0,a.normalizeId)((0,a.getFullPath)(t,this.missingRef))}}n["default"]=MissingRefError},4090:(t,n,i)=>{Object.defineProperty(n,"__esModule",{value:true});n.getSchemaRefs=n.resolveUrl=n.normalizeId=n._getFullPath=n.getFullPath=n.inlineRef=void 0;const a=i(4464);const A=i(3430);const c=i(1167);const l=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function inlineRef(t,n=true){if(typeof t=="boolean")return true;if(n===true)return!hasRef(t);if(!n)return false;return countKeys(t)<=n}n.inlineRef=inlineRef;const d=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function hasRef(t){for(const n in t){if(d.has(n))return true;const i=t[n];if(Array.isArray(i)&&i.some(hasRef))return true;if(typeof i=="object"&&hasRef(i))return true}return false}function countKeys(t){let n=0;for(const i in t){if(i==="$ref")return Infinity;n++;if(l.has(i))continue;if(typeof t[i]=="object"){(0,a.eachItem)(t[i],t=>n+=countKeys(t))}if(n===Infinity)return Infinity}return n}function getFullPath(t,n="",i){if(i!==false)n=normalizeId(n);const a=t.parse(n);return _getFullPath(t,a)}n.getFullPath=getFullPath;function _getFullPath(t,n){const i=t.serialize(n);return i.split("#")[0]+"#"}n._getFullPath=_getFullPath;const h=/#\/?$/;function normalizeId(t){return t?t.replace(h,""):""}n.normalizeId=normalizeId;function resolveUrl(t,n,i){i=normalizeId(i);return t.resolve(n,i)}n.resolveUrl=resolveUrl;const f=/^[a-z_][-a-z0-9._]*$/i;function getSchemaRefs(t,n){if(typeof t=="boolean")return{};const{schemaId:i,uriResolver:a}=this.opts;const l=normalizeId(t[i]||n);const d={"":l};const h=getFullPath(a,l,false);const g={};const p=new Set;c(t,{allKeys:true},(t,n,a,A)=>{if(A===undefined)return;const c=h+n;let l=d[A];if(typeof t[i]=="string")l=addRef.call(this,t[i]);addAnchor.call(this,t.$anchor);addAnchor.call(this,t.$dynamicAnchor);d[n]=l;function addRef(n){const i=this.opts.uriResolver.resolve;n=normalizeId(l?i(l,n):n);if(p.has(n))throw ambiguos(n);p.add(n);let a=this.refs[n];if(typeof a=="string")a=this.refs[a];if(typeof a=="object"){checkAmbiguosRef(t,a.schema,n)}else if(n!==normalizeId(c)){if(n[0]==="#"){checkAmbiguosRef(t,g[n],n);g[n]=t}else{this.refs[n]=c}}return n}function addAnchor(t){if(typeof t=="string"){if(!f.test(t))throw new Error(`invalid anchor "${t}"`);addRef.call(this,`#${t}`)}}});return g;function checkAmbiguosRef(t,n,i){if(n!==undefined&&!A(t,n))throw ambiguos(i)}function ambiguos(t){return new Error(`reference "${t}" resolves to more than one schema`)}}n.getSchemaRefs=getSchemaRefs},7353:(t,n)=>{Object.defineProperty(n,"__esModule",{value:true});n.getRules=n.isJSONType=void 0;const i=["string","number","integer","boolean","null","object","array"];const a=new Set(i);function isJSONType(t){return typeof t=="string"&&a.has(t)}n.isJSONType=isJSONType;function getRules(){const t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:true,boolean:true,null:true},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}n.getRules=getRules},4464:(t,n,i)=>{Object.defineProperty(n,"__esModule",{value:true});n.checkStrictMode=n.getErrorPath=n.Type=n.useFunc=n.setEvaluated=n.evaluatedPropsToName=n.mergeEvaluated=n.eachItem=n.unescapeJsonPointer=n.escapeJsonPointer=n.escapeFragment=n.unescapeFragment=n.schemaRefOrVal=n.schemaHasRulesButRef=n.schemaHasRules=n.checkUnknownRules=n.alwaysValidSchema=n.toHash=void 0;const a=i(1436);const A=i(567);function toHash(t){const n={};for(const i of t)n[i]=true;return n}n.toHash=toHash;function alwaysValidSchema(t,n){if(typeof n=="boolean")return n;if(Object.keys(n).length===0)return true;checkUnknownRules(t,n);return!schemaHasRules(n,t.self.RULES.all)}n.alwaysValidSchema=alwaysValidSchema;function checkUnknownRules(t,n=t.schema){const{opts:i,self:a}=t;if(!i.strictSchema)return;if(typeof n==="boolean")return;const A=a.RULES.keywords;for(const i in n){if(!A[i])checkStrictMode(t,`unknown keyword: "${i}"`)}}n.checkUnknownRules=checkUnknownRules;function schemaHasRules(t,n){if(typeof t=="boolean")return!t;for(const i in t)if(n[i])return true;return false}n.schemaHasRules=schemaHasRules;function schemaHasRulesButRef(t,n){if(typeof t=="boolean")return!t;for(const i in t)if(i!=="$ref"&&n.all[i])return true;return false}n.schemaHasRulesButRef=schemaHasRulesButRef;function schemaRefOrVal({topSchemaRef:t,schemaPath:n},i,A,c){if(!c){if(typeof i=="number"||typeof i=="boolean")return i;if(typeof i=="string")return(0,a._)`${i}`}return(0,a._)`${t}${n}${(0,a.getProperty)(A)}`}n.schemaRefOrVal=schemaRefOrVal;function unescapeFragment(t){return unescapeJsonPointer(decodeURIComponent(t))}n.unescapeFragment=unescapeFragment;function escapeFragment(t){return encodeURIComponent(escapeJsonPointer(t))}n.escapeFragment=escapeFragment;function escapeJsonPointer(t){if(typeof t=="number")return`${t}`;return t.replace(/~/g,"~0").replace(/\//g,"~1")}n.escapeJsonPointer=escapeJsonPointer;function unescapeJsonPointer(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}n.unescapeJsonPointer=unescapeJsonPointer;function eachItem(t,n){if(Array.isArray(t)){for(const i of t)n(i)}else{n(t)}}n.eachItem=eachItem;function makeMergeEvaluated({mergeNames:t,mergeToName:n,mergeValues:i,resultToName:A}){return(c,l,d,h)=>{const f=d===undefined?l:d instanceof a.Name?(l instanceof a.Name?t(c,l,d):n(c,l,d),d):l instanceof a.Name?(n(c,d,l),l):i(l,d);return h===a.Name&&!(f instanceof a.Name)?A(c,f):f}}n.mergeEvaluated={props:makeMergeEvaluated({mergeNames:(t,n,i)=>t.if((0,a._)`${i} !== true && ${n} !== undefined`,()=>{t.if((0,a._)`${n} === true`,()=>t.assign(i,true),()=>t.assign(i,(0,a._)`${i} || {}`).code((0,a._)`Object.assign(${i}, ${n})`))}),mergeToName:(t,n,i)=>t.if((0,a._)`${i} !== true`,()=>{if(n===true){t.assign(i,true)}else{t.assign(i,(0,a._)`${i} || {}`);setEvaluated(t,i,n)}}),mergeValues:(t,n)=>t===true?true:{...t,...n},resultToName:evaluatedPropsToName}),items:makeMergeEvaluated({mergeNames:(t,n,i)=>t.if((0,a._)`${i} !== true && ${n} !== undefined`,()=>t.assign(i,(0,a._)`${n} === true ? true : ${i} > ${n} ? ${i} : ${n}`)),mergeToName:(t,n,i)=>t.if((0,a._)`${i} !== true`,()=>t.assign(i,n===true?true:(0,a._)`${i} > ${n} ? ${i} : ${n}`)),mergeValues:(t,n)=>t===true?true:Math.max(t,n),resultToName:(t,n)=>t.var("items",n)})};function evaluatedPropsToName(t,n){if(n===true)return t.var("props",true);const i=t.var("props",(0,a._)`{}`);if(n!==undefined)setEvaluated(t,i,n);return i}n.evaluatedPropsToName=evaluatedPropsToName;function setEvaluated(t,n,i){Object.keys(i).forEach(i=>t.assign((0,a._)`${n}${(0,a.getProperty)(i)}`,true))}n.setEvaluated=setEvaluated;const c={};function useFunc(t,n){return t.scopeValue("func",{ref:n,code:c[n.code]||(c[n.code]=new A._Code(n.code))})}n.useFunc=useFunc;var l;(function(t){t[t["Num"]=0]="Num";t[t["Str"]=1]="Str"})(l||(n.Type=l={}));function getErrorPath(t,n,i){if(t instanceof a.Name){const A=n===l.Num;return i?A?(0,a._)`"[" + ${t} + "]"`:(0,a._)`"['" + ${t} + "']"`:A?(0,a._)`"/" + ${t}`:(0,a._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return i?(0,a.getProperty)(t).toString():"/"+escapeJsonPointer(t)}n.getErrorPath=getErrorPath;function checkStrictMode(t,n,i=t.opts.strictSchema){if(!i)return;n=`strict mode: ${n}`;if(i===true)throw new Error(n);t.self.logger.warn(n)}n.checkStrictMode=checkStrictMode},7692:(t,n)=>{Object.defineProperty(n,"__esModule",{value:true});n.shouldUseRule=n.shouldUseGroup=n.schemaHasRulesForType=void 0;function schemaHasRulesForType({schema:t,self:n},i){const a=n.RULES.types[i];return a&&a!==true&&shouldUseGroup(t,a)}n.schemaHasRulesForType=schemaHasRulesForType;function shouldUseGroup(t,n){return n.rules.some(n=>shouldUseRule(t,n))}n.shouldUseGroup=shouldUseGroup;function shouldUseRule(t,n){var i;return t[n.keyword]!==undefined||((i=n.definition.implements)===null||i===void 0?void 0:i.some(n=>t[n]!==undefined))}n.shouldUseRule=shouldUseRule},5346:(t,n,i)=>{Object.defineProperty(n,"__esModule",{value:true});n.boolOrEmptySchema=n.topBoolOrEmptySchema=void 0;const a=i(1283);const A=i(1436);const c=i(630);const l={message:"boolean schema is false"};function topBoolOrEmptySchema(t){const{gen:n,schema:i,validateName:a}=t;if(i===false){falseSchemaError(t,false)}else if(typeof i=="object"&&i.$async===true){n.return(c.default.data)}else{n.assign((0,A._)`${a}.errors`,null);n.return(true)}}n.topBoolOrEmptySchema=topBoolOrEmptySchema;function boolOrEmptySchema(t,n){const{gen:i,schema:a}=t;if(a===false){i.var(n,false);falseSchemaError(t)}else{i.var(n,true)}}n.boolOrEmptySchema=boolOrEmptySchema;function falseSchemaError(t,n){const{gen:i,data:A}=t;const c={gen:i,keyword:"false schema",data:A,schema:false,schemaCode:false,schemaValue:false,params:{},it:t};(0,a.reportError)(c,l,undefined,n)}},6685:(t,n,i)=>{Object.defineProperty(n,"__esModule",{value:true});n.reportTypeError=n.checkDataTypes=n.checkDataType=n.coerceAndCheckDataType=n.getJSONTypes=n.getSchemaTypes=n.DataType=void 0;const a=i(7353);const A=i(7692);const c=i(1283);const l=i(1436);const d=i(4464);var h;(function(t){t[t["Correct"]=0]="Correct";t[t["Wrong"]=1]="Wrong"})(h||(n.DataType=h={}));function getSchemaTypes(t){const n=getJSONTypes(t.type);const i=n.includes("null");if(i){if(t.nullable===false)throw new Error("type: null contradicts nullable: false")}else{if(!n.length&&t.nullable!==undefined){throw new Error('"nullable" cannot be used without "type"')}if(t.nullable===true)n.push("null")}return n}n.getSchemaTypes=getSchemaTypes;function getJSONTypes(t){const n=Array.isArray(t)?t:t?[t]:[];if(n.every(a.isJSONType))return n;throw new Error("type must be JSONType or JSONType[]: "+n.join(","))}n.getJSONTypes=getJSONTypes;function coerceAndCheckDataType(t,n){const{gen:i,data:a,opts:c}=t;const l=coerceToTypes(n,c.coerceTypes);const d=n.length>0&&!(l.length===0&&n.length===1&&(0,A.schemaHasRulesForType)(t,n[0]));if(d){const A=checkDataTypes(n,a,c.strictNumbers,h.Wrong);i.if(A,()=>{if(l.length)coerceData(t,n,l);else reportTypeError(t)})}return d}n.coerceAndCheckDataType=coerceAndCheckDataType;const f=new Set(["string","number","integer","boolean","null"]);function coerceToTypes(t,n){return n?t.filter(t=>f.has(t)||n==="array"&&t==="array"):[]}function coerceData(t,n,i){const{gen:a,data:A,opts:c}=t;const d=a.let("dataType",(0,l._)`typeof ${A}`);const h=a.let("coerced",(0,l._)`undefined`);if(c.coerceTypes==="array"){a.if((0,l._)`${d} == 'object' && Array.isArray(${A}) && ${A}.length == 1`,()=>a.assign(A,(0,l._)`${A}[0]`).assign(d,(0,l._)`typeof ${A}`).if(checkDataTypes(n,A,c.strictNumbers),()=>a.assign(h,A)))}a.if((0,l._)`${h} !== undefined`);for(const t of i){if(f.has(t)||t==="array"&&c.coerceTypes==="array"){coerceSpecificType(t)}}a.else();reportTypeError(t);a.endIf();a.if((0,l._)`${h} !== undefined`,()=>{a.assign(A,h);assignParentData(t,h)});function coerceSpecificType(t){switch(t){case"string":a.elseIf((0,l._)`${d} == "number" || ${d} == "boolean"`).assign(h,(0,l._)`"" + ${A}`).elseIf((0,l._)`${A} === null`).assign(h,(0,l._)`""`);return;case"number":a.elseIf((0,l._)`${d} == "boolean" || ${A} === null || (${d} == "string" && ${A} && ${A} == +${A})`).assign(h,(0,l._)`+${A}`);return;case"integer":a.elseIf((0,l._)`${d} === "boolean" || ${A} === null || (${d} === "string" && ${A} && ${A} == +${A} && !(${A} % 1))`).assign(h,(0,l._)`+${A}`);return;case"boolean":a.elseIf((0,l._)`${A} === "false" || ${A} === 0 || ${A} === null`).assign(h,false).elseIf((0,l._)`${A} === "true" || ${A} === 1`).assign(h,true);return;case"null":a.elseIf((0,l._)`${A} === "" || ${A} === 0 || ${A} === false`);a.assign(h,null);return;case"array":a.elseIf((0,l._)`${d} === "string" || ${d} === "number" || ${d} === "boolean" || ${A} === null`).assign(h,(0,l._)`[${A}]`)}}}function assignParentData({gen:t,parentData:n,parentDataProperty:i},a){t.if((0,l._)`${n} !== undefined`,()=>t.assign((0,l._)`${n}[${i}]`,a))}function checkDataType(t,n,i,a=h.Correct){const A=a===h.Correct?l.operators.EQ:l.operators.NEQ;let c;switch(t){case"null":return(0,l._)`${n} ${A} null`;case"array":c=(0,l._)`Array.isArray(${n})`;break;case"object":c=(0,l._)`${n} && typeof ${n} == "object" && !Array.isArray(${n})`;break;case"integer":c=numCond((0,l._)`!(${n} % 1) && !isNaN(${n})`);break;case"number":c=numCond();break;default:return(0,l._)`typeof ${n} ${A} ${t}`}return a===h.Correct?c:(0,l.not)(c);function numCond(t=l.nil){return(0,l.and)((0,l._)`typeof ${n} == "number"`,t,i?(0,l._)`isFinite(${n})`:l.nil)}}n.checkDataType=checkDataType;function checkDataTypes(t,n,i,a){if(t.length===1){return checkDataType(t[0],n,i,a)}let A;const c=(0,d.toHash)(t);if(c.array&&c.object){const t=(0,l._)`typeof ${n} != "object"`;A=c.null?t:(0,l._)`!${n} || ${t}`;delete c.null;delete c.array;delete c.object}else{A=l.nil}if(c.number)delete c.integer;for(const t in c)A=(0,l.and)(A,checkDataType(t,n,i,a));return A}n.checkDataTypes=checkDataTypes;const g={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:n})=>typeof t=="string"?(0,l._)`{type: ${t}}`:(0,l._)`{type: ${n}}`};function reportTypeError(t){const n=getTypeErrorContext(t);(0,c.reportError)(n,g)}n.reportTypeError=reportTypeError;function getTypeErrorContext(t){const{gen:n,data:i,schema:a}=t;const A=(0,d.schemaRefOrVal)(t,a,"type");return{gen:n,keyword:"type",data:i,schema:a.type,schemaCode:A,schemaValue:A,parentSchema:a,params:{},it:t}}},1699:(t,n,i)=>{Object.defineProperty(n,"__esModule",{value:true});n.assignDefaults=void 0;const a=i(1436);const A=i(4464);function assignDefaults(t,n){const{properties:i,items:a}=t.schema;if(n==="object"&&i){for(const n in i){assignDefault(t,n,i[n].default)}}else if(n==="array"&&Array.isArray(a)){a.forEach((n,i)=>assignDefault(t,i,n.default))}}n.assignDefaults=assignDefaults;function assignDefault(t,n,i){const{gen:c,compositeRule:l,data:d,opts:h}=t;if(i===undefined)return;const f=(0,a._)`${d}${(0,a.getProperty)(n)}`;if(l){(0,A.checkStrictMode)(t,`default is ignored for: ${f}`);return}let g=(0,a._)`${f} === undefined`;if(h.useDefaults==="empty"){g=(0,a._)`${g} || ${f} === null || ${f} === ""`}c.if(g,(0,a._)`${f} = ${(0,a.stringify)(i)}`)}},7881:(t,n,i)=>{Object.defineProperty(n,"__esModule",{value:true});n.getData=n.KeywordCxt=n.validateFunctionCode=void 0;const a=i(5346);const A=i(6685);const c=i(7692);const l=i(6685);const d=i(1699);const h=i(5202);const f=i(6200);const g=i(1436);const p=i(630);const m=i(4090);const E=i(4464);const C=i(1283);function validateFunctionCode(t){if(isSchemaObj(t)){checkKeywords(t);if(schemaCxtHasRules(t)){topSchemaObjCode(t);return}}validateFunction(t,()=>(0,a.topBoolOrEmptySchema)(t))}n.validateFunctionCode=validateFunctionCode;function validateFunction({gen:t,validateName:n,schema:i,schemaEnv:a,opts:A},c){if(A.code.es5){t.func(n,(0,g._)`${p.default.data}, ${p.default.valCxt}`,a.$async,()=>{t.code((0,g._)`"use strict"; ${funcSourceUrl(i,A)}`);destructureValCxtES5(t,A);t.code(c)})}else{t.func(n,(0,g._)`${p.default.data}, ${destructureValCxt(A)}`,a.$async,()=>t.code(funcSourceUrl(i,A)).code(c))}}function destructureValCxt(t){return(0,g._)`{${p.default.instancePath}="", ${p.default.parentData}, ${p.default.parentDataProperty}, ${p.default.rootData}=${p.default.data}${t.dynamicRef?(0,g._)`, ${p.default.dynamicAnchors}={}`:g.nil}}={}`}function destructureValCxtES5(t,n){t.if(p.default.valCxt,()=>{t.var(p.default.instancePath,(0,g._)`${p.default.valCxt}.${p.default.instancePath}`);t.var(p.default.parentData,(0,g._)`${p.default.valCxt}.${p.default.parentData}`);t.var(p.default.parentDataProperty,(0,g._)`${p.default.valCxt}.${p.default.parentDataProperty}`);t.var(p.default.rootData,(0,g._)`${p.default.valCxt}.${p.default.rootData}`);if(n.dynamicRef)t.var(p.default.dynamicAnchors,(0,g._)`${p.default.valCxt}.${p.default.dynamicAnchors}`)},()=>{t.var(p.default.instancePath,(0,g._)`""`);t.var(p.default.parentData,(0,g._)`undefined`);t.var(p.default.parentDataProperty,(0,g._)`undefined`);t.var(p.default.rootData,p.default.data);if(n.dynamicRef)t.var(p.default.dynamicAnchors,(0,g._)`{}`)})}function topSchemaObjCode(t){const{schema:n,opts:i,gen:a}=t;validateFunction(t,()=>{if(i.$comment&&n.$comment)commentKeyword(t);checkNoDefault(t);a.let(p.default.vErrors,null);a.let(p.default.errors,0);if(i.unevaluated)resetEvaluated(t);typeAndKeywords(t);returnResults(t)});return}function resetEvaluated(t){const{gen:n,validateName:i}=t;t.evaluated=n.const("evaluated",(0,g._)`${i}.evaluated`);n.if((0,g._)`${t.evaluated}.dynamicProps`,()=>n.assign((0,g._)`${t.evaluated}.props`,(0,g._)`undefined`));n.if((0,g._)`${t.evaluated}.dynamicItems`,()=>n.assign((0,g._)`${t.evaluated}.items`,(0,g._)`undefined`))}function funcSourceUrl(t,n){const i=typeof t=="object"&&t[n.schemaId];return i&&(n.code.source||n.code.process)?(0,g._)`/*# sourceURL=${i} */`:g.nil}function subschemaCode(t,n){if(isSchemaObj(t)){checkKeywords(t);if(schemaCxtHasRules(t)){subSchemaObjCode(t,n);return}}(0,a.boolOrEmptySchema)(t,n)}function schemaCxtHasRules({schema:t,self:n}){if(typeof t=="boolean")return!t;for(const i in t)if(n.RULES.all[i])return true;return false}function isSchemaObj(t){return typeof t.schema!="boolean"}function subSchemaObjCode(t,n){const{schema:i,gen:a,opts:A}=t;if(A.$comment&&i.$comment)commentKeyword(t);updateContext(t);checkAsyncSchema(t);const c=a.const("_errs",p.default.errors);typeAndKeywords(t,c);a.var(n,(0,g._)`${c} === ${p.default.errors}`)}function checkKeywords(t){(0,E.checkUnknownRules)(t);checkRefsAndKeywords(t)}function typeAndKeywords(t,n){if(t.opts.jtd)return schemaKeywords(t,[],false,n);const i=(0,A.getSchemaTypes)(t.schema);const a=(0,A.coerceAndCheckDataType)(t,i);schemaKeywords(t,i,!a,n)}function checkRefsAndKeywords(t){const{schema:n,errSchemaPath:i,opts:a,self:A}=t;if(n.$ref&&a.ignoreKeywordsWithRef&&(0,E.schemaHasRulesButRef)(n,A.RULES)){A.logger.warn(`$ref: keywords ignored in schema at path "${i}"`)}}function checkNoDefault(t){const{schema:n,opts:i}=t;if(n.default!==undefined&&i.useDefaults&&i.strictSchema){(0,E.checkStrictMode)(t,"default is ignored in the schema root")}}function updateContext(t){const n=t.schema[t.opts.schemaId];if(n)t.baseId=(0,m.resolveUrl)(t.opts.uriResolver,t.baseId,n)}function checkAsyncSchema(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function commentKeyword({gen:t,schemaEnv:n,schema:i,errSchemaPath:a,opts:A}){const c=i.$comment;if(A.$comment===true){t.code((0,g._)`${p.default.self}.logger.log(${c})`)}else if(typeof A.$comment=="function"){const i=(0,g.str)`${a}/$comment`;const A=t.scopeValue("root",{ref:n.root});t.code((0,g._)`${p.default.self}.opts.$comment(${c}, ${i}, ${A}.schema)`)}}function returnResults(t){const{gen:n,schemaEnv:i,validateName:a,ValidationError:A,opts:c}=t;if(i.$async){n.if((0,g._)`${p.default.errors} === 0`,()=>n.return(p.default.data),()=>n.throw((0,g._)`new ${A}(${p.default.vErrors})`))}else{n.assign((0,g._)`${a}.errors`,p.default.vErrors);if(c.unevaluated)assignEvaluated(t);n.return((0,g._)`${p.default.errors} === 0`)}}function assignEvaluated({gen:t,evaluated:n,props:i,items:a}){if(i instanceof g.Name)t.assign((0,g._)`${n}.props`,i);if(a instanceof g.Name)t.assign((0,g._)`${n}.items`,a)}function schemaKeywords(t,n,i,a){const{gen:A,schema:d,data:h,allErrors:f,opts:m,self:C}=t;const{RULES:I}=C;if(d.$ref&&(m.ignoreKeywordsWithRef||!(0,E.schemaHasRulesButRef)(d,I))){A.block(()=>keywordCode(t,"$ref",I.all.$ref.definition));return}if(!m.jtd)checkStrictTypes(t,n);A.block(()=>{for(const t of I.rules)groupKeywords(t);groupKeywords(I.post)});function groupKeywords(E){if(!(0,c.shouldUseGroup)(d,E))return;if(E.type){A.if((0,l.checkDataType)(E.type,h,m.strictNumbers));iterateKeywords(t,E);if(n.length===1&&n[0]===E.type&&i){A.else();(0,l.reportTypeError)(t)}A.endIf()}else{iterateKeywords(t,E)}if(!f)A.if((0,g._)`${p.default.errors} === ${a||0}`)}}function iterateKeywords(t,n){const{gen:i,schema:a,opts:{useDefaults:A}}=t;if(A)(0,d.assignDefaults)(t,n.type);i.block(()=>{for(const i of n.rules){if((0,c.shouldUseRule)(a,i)){keywordCode(t,i.keyword,i.definition,n.type)}}})}function checkStrictTypes(t,n){if(t.schemaEnv.meta||!t.opts.strictTypes)return;checkContextTypes(t,n);if(!t.opts.allowUnionTypes)checkMultipleTypes(t,n);checkKeywordTypes(t,t.dataTypes)}function checkContextTypes(t,n){if(!n.length)return;if(!t.dataTypes.length){t.dataTypes=n;return}n.forEach(n=>{if(!includesType(t.dataTypes,n)){strictTypesError(t,`type "${n}" not allowed by context "${t.dataTypes.join(",")}"`)}});narrowSchemaTypes(t,n)}function checkMultipleTypes(t,n){if(n.length>1&&!(n.length===2&&n.includes("null"))){strictTypesError(t,"use allowUnionTypes to allow union type keyword")}}function checkKeywordTypes(t,n){const i=t.self.RULES.all;for(const a in i){const A=i[a];if(typeof A=="object"&&(0,c.shouldUseRule)(t.schema,A)){const{type:i}=A.definition;if(i.length&&!i.some(t=>hasApplicableType(n,t))){strictTypesError(t,`missing type "${i.join(",")}" for keyword "${a}"`)}}}}function hasApplicableType(t,n){return t.includes(n)||n==="number"&&t.includes("integer")}function includesType(t,n){return t.includes(n)||n==="integer"&&t.includes("number")}function narrowSchemaTypes(t,n){const i=[];for(const a of t.dataTypes){if(includesType(n,a))i.push(a);else if(n.includes("integer")&&a==="number")i.push("integer")}t.dataTypes=i}function strictTypesError(t,n){const i=t.schemaEnv.baseId+t.errSchemaPath;n+=` at "${i}" (strictTypes)`;(0,E.checkStrictMode)(t,n,t.opts.strictTypes)}class KeywordCxt{constructor(t,n,i){(0,h.validateKeywordUsage)(t,n,i);this.gen=t.gen;this.allErrors=t.allErrors;this.keyword=i;this.data=t.data;this.schema=t.schema[i];this.$data=n.$data&&t.opts.$data&&this.schema&&this.schema.$data;this.schemaValue=(0,E.schemaRefOrVal)(t,this.schema,i,this.$data);this.schemaType=n.schemaType;this.parentSchema=t.schema;this.params={};this.it=t;this.def=n;if(this.$data){this.schemaCode=t.gen.const("vSchema",getData(this.$data,t))}else{this.schemaCode=this.schemaValue;if(!(0,h.validSchemaType)(this.schema,n.schemaType,n.allowUndefined)){throw new Error(`${i} value must be ${JSON.stringify(n.schemaType)}`)}}if("code"in n?n.trackErrors:n.errors!==false){this.errsCount=t.gen.const("_errs",p.default.errors)}}result(t,n,i){this.failResult((0,g.not)(t),n,i)}failResult(t,n,i){this.gen.if(t);if(i)i();else this.error();if(n){this.gen.else();n();if(this.allErrors)this.gen.endIf()}else{if(this.allErrors)this.gen.endIf();else this.gen.else()}}pass(t,n){this.failResult((0,g.not)(t),undefined,n)}fail(t){if(t===undefined){this.error();if(!this.allErrors)this.gen.if(false);return}this.gen.if(t);this.error();if(this.allErrors)this.gen.endIf();else this.gen.else()}fail$data(t){if(!this.$data)return this.fail(t);const{schemaCode:n}=this;this.fail((0,g._)`${n} !== undefined && (${(0,g.or)(this.invalid$data(),t)})`)}error(t,n,i){if(n){this.setParams(n);this._error(t,i);this.setParams({});return}this._error(t,i)}_error(t,n){(t?C.reportExtraError:C.reportError)(this,this.def.error,n)}$dataError(){(0,C.reportError)(this,this.def.$dataError||C.keyword$DataError)}reset(){if(this.errsCount===undefined)throw new Error('add "trackErrors" to keyword definition');(0,C.resetErrorsCount)(this.gen,this.errsCount)}ok(t){if(!this.allErrors)this.gen.if(t)}setParams(t,n){if(n)Object.assign(this.params,t);else this.params=t}block$data(t,n,i=g.nil){this.gen.block(()=>{this.check$data(t,i);n()})}check$data(t=g.nil,n=g.nil){if(!this.$data)return;const{gen:i,schemaCode:a,schemaType:A,def:c}=this;i.if((0,g.or)((0,g._)`${a} === undefined`,n));if(t!==g.nil)i.assign(t,true);if(A.length||c.validateSchema){i.elseIf(this.invalid$data());this.$dataError();if(t!==g.nil)i.assign(t,false)}i.else()}invalid$data(){const{gen:t,schemaCode:n,schemaType:i,def:a,it:A}=this;return(0,g.or)(wrong$DataType(),invalid$DataSchema());function wrong$DataType(){if(i.length){if(!(n instanceof g.Name))throw new Error("ajv implementation error");const t=Array.isArray(i)?i:[i];return(0,g._)`${(0,l.checkDataTypes)(t,n,A.opts.strictNumbers,l.DataType.Wrong)}`}return g.nil}function invalid$DataSchema(){if(a.validateSchema){const i=t.scopeValue("validate$data",{ref:a.validateSchema});return(0,g._)`!${i}(${n})`}return g.nil}}subschema(t,n){const i=(0,f.getSubschema)(this.it,t);(0,f.extendSubschemaData)(i,this.it,t);(0,f.extendSubschemaMode)(i,t);const a={...this.it,...i,items:undefined,props:undefined};subschemaCode(a,n);return a}mergeEvaluated(t,n){const{it:i,gen:a}=this;if(!i.opts.unevaluated)return;if(i.props!==true&&t.props!==undefined){i.props=E.mergeEvaluated.props(a,t.props,i.props,n)}if(i.items!==true&&t.items!==undefined){i.items=E.mergeEvaluated.items(a,t.items,i.items,n)}}mergeValidEvaluated(t,n){const{it:i,gen:a}=this;if(i.opts.unevaluated&&(i.props!==true||i.items!==true)){a.if(n,()=>this.mergeEvaluated(t,g.Name));return true}}}n.KeywordCxt=KeywordCxt;function keywordCode(t,n,i,a){const A=new KeywordCxt(t,i,n);if("code"in i){i.code(A,a)}else if(A.$data&&i.validate){(0,h.funcKeywordCode)(A,i)}else if("macro"in i){(0,h.macroKeywordCode)(A,i)}else if(i.compile||i.validate){(0,h.funcKeywordCode)(A,i)}}const I=/^\/(?:[^~]|~0|~1)*$/;const y=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function getData(t,{dataLevel:n,dataNames:i,dataPathArr:a}){let A;let c;if(t==="")return p.default.rootData;if(t[0]==="/"){if(!I.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);A=t;c=p.default.rootData}else{const l=y.exec(t);if(!l)throw new Error(`Invalid JSON-pointer: ${t}`);const d=+l[1];A=l[2];if(A==="#"){if(d>=n)throw new Error(errorMsg("property/index",d));return a[n-d]}if(d>n)throw new Error(errorMsg("data",d));c=i[n-d];if(!A)return c}let l=c;const d=A.split("/");for(const t of d){if(t){c=(0,g._)`${c}${(0,g.getProperty)((0,E.unescapeJsonPointer)(t))}`;l=(0,g._)`${l} && ${c}`}}return l;function errorMsg(t,i){return`Cannot access ${t} ${i} levels up, current level is ${n}`}}n.getData=getData},5202:(t,n,i)=>{Object.defineProperty(n,"__esModule",{value:true});n.validateKeywordUsage=n.validSchemaType=n.funcKeywordCode=n.macroKeywordCode=void 0;const a=i(1436);const A=i(630);const c=i(8484);const l=i(1283);function macroKeywordCode(t,n){const{gen:i,keyword:A,schema:c,parentSchema:l,it:d}=t;const h=n.macro.call(d.self,c,l,d);const f=useKeyword(i,A,h);if(d.opts.validateSchema!==false)d.self.validateSchema(h,true);const g=i.name("valid");t.subschema({schema:h,schemaPath:a.nil,errSchemaPath:`${d.errSchemaPath}/${A}`,topSchemaRef:f,compositeRule:true},g);t.pass(g,()=>t.error(true))}n.macroKeywordCode=macroKeywordCode;function funcKeywordCode(t,n){var i;const{gen:l,keyword:d,schema:h,parentSchema:f,$data:g,it:p}=t;checkAsyncKeyword(p,n);const m=!g&&n.compile?n.compile.call(p.self,h,f,p):n.validate;const E=useKeyword(l,d,m);const C=l.let("valid");t.block$data(C,validateKeyword);t.ok((i=n.valid)!==null&&i!==void 0?i:C);function validateKeyword(){if(n.errors===false){assignValid();if(n.modifying)modifyData(t);reportErrs(()=>t.error())}else{const i=n.async?validateAsync():validateSync();if(n.modifying)modifyData(t);reportErrs(()=>addErrs(t,i))}}function validateAsync(){const t=l.let("ruleErrs",null);l.try(()=>assignValid((0,a._)`await `),n=>l.assign(C,false).if((0,a._)`${n} instanceof ${p.ValidationError}`,()=>l.assign(t,(0,a._)`${n}.errors`),()=>l.throw(n)));return t}function validateSync(){const t=(0,a._)`${E}.errors`;l.assign(t,null);assignValid(a.nil);return t}function assignValid(i=(n.async?(0,a._)`await `:a.nil)){const d=p.opts.passContext?A.default.this:A.default.self;const h=!("compile"in n&&!g||n.schema===false);l.assign(C,(0,a._)`${i}${(0,c.callValidateCode)(t,E,d,h)}`,n.modifying)}function reportErrs(t){var i;l.if((0,a.not)((i=n.valid)!==null&&i!==void 0?i:C),t)}}n.funcKeywordCode=funcKeywordCode;function modifyData(t){const{gen:n,data:i,it:A}=t;n.if(A.parentData,()=>n.assign(i,(0,a._)`${A.parentData}[${A.parentDataProperty}]`))}function addErrs(t,n){const{gen:i}=t;i.if((0,a._)`Array.isArray(${n})`,()=>{i.assign(A.default.vErrors,(0,a._)`${A.default.vErrors} === null ? ${n} : ${A.default.vErrors}.concat(${n})`).assign(A.default.errors,(0,a._)`${A.default.vErrors}.length`);(0,l.extendErrors)(t)},()=>t.error())}function checkAsyncKeyword({schemaEnv:t},n){if(n.async&&!t.$async)throw new Error("async keyword in sync schema")}function useKeyword(t,n,i){if(i===undefined)throw new Error(`keyword "${n}" failed to compile`);return t.scopeValue("keyword",typeof i=="function"?{ref:i}:{ref:i,code:(0,a.stringify)(i)})}function validSchemaType(t,n,i=false){return!n.length||n.some(n=>n==="array"?Array.isArray(t):n==="object"?t&&typeof t=="object"&&!Array.isArray(t):typeof t==n||i&&typeof t=="undefined")}n.validSchemaType=validSchemaType;function validateKeywordUsage({schema:t,opts:n,self:i,errSchemaPath:a},A,c){if(Array.isArray(A.keyword)?!A.keyword.includes(c):A.keyword!==c){throw new Error("ajv implementation error")}const l=A.dependencies;if(l===null||l===void 0?void 0:l.some(n=>!Object.prototype.hasOwnProperty.call(t,n))){throw new Error(`parent schema must have dependencies of ${c}: ${l.join(",")}`)}if(A.validateSchema){const l=A.validateSchema(t[c]);if(!l){const t=`keyword "${c}" value is invalid at path "${a}": `+i.errorsText(A.validateSchema.errors);if(n.validateSchema==="log")i.logger.error(t);else throw new Error(t)}}}n.validateKeywordUsage=validateKeywordUsage},6200:(t,n,i)=>{Object.defineProperty(n,"__esModule",{value:true});n.extendSubschemaMode=n.extendSubschemaData=n.getSubschema=void 0;const a=i(1436);const A=i(4464);function getSubschema(t,{keyword:n,schemaProp:i,schema:c,schemaPath:l,errSchemaPath:d,topSchemaRef:h}){if(n!==undefined&&c!==undefined){throw new Error('both "keyword" and "schema" passed, only one allowed')}if(n!==undefined){const c=t.schema[n];return i===undefined?{schema:c,schemaPath:(0,a._)`${t.schemaPath}${(0,a.getProperty)(n)}`,errSchemaPath:`${t.errSchemaPath}/${n}`}:{schema:c[i],schemaPath:(0,a._)`${t.schemaPath}${(0,a.getProperty)(n)}${(0,a.getProperty)(i)}`,errSchemaPath:`${t.errSchemaPath}/${n}/${(0,A.escapeFragment)(i)}`}}if(c!==undefined){if(l===undefined||d===undefined||h===undefined){throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"')}return{schema:c,schemaPath:l,topSchemaRef:h,errSchemaPath:d}}throw new Error('either "keyword" or "schema" must be passed')}n.getSubschema=getSubschema;function extendSubschemaData(t,n,{dataProp:i,dataPropType:c,data:l,dataTypes:d,propertyName:h}){if(l!==undefined&&i!==undefined){throw new Error('both "data" and "dataProp" passed, only one allowed')}const{gen:f}=n;if(i!==undefined){const{errorPath:l,dataPathArr:d,opts:h}=n;const g=f.let("data",(0,a._)`${n.data}${(0,a.getProperty)(i)}`,true);dataContextProps(g);t.errorPath=(0,a.str)`${l}${(0,A.getErrorPath)(i,c,h.jsPropertySyntax)}`;t.parentDataProperty=(0,a._)`${i}`;t.dataPathArr=[...d,t.parentDataProperty]}if(l!==undefined){const n=l instanceof a.Name?l:f.let("data",l,true);dataContextProps(n);if(h!==undefined)t.propertyName=h}if(d)t.dataTypes=d;function dataContextProps(i){t.data=i;t.dataLevel=n.dataLevel+1;t.dataTypes=[];n.definedProperties=new Set;t.parentData=n.data;t.dataNames=[...n.dataNames,i]}}n.extendSubschemaData=extendSubschemaData;function extendSubschemaMode(t,{jtdDiscriminator:n,jtdMetadata:i,compositeRule:a,createErrors:A,allErrors:c}){if(a!==undefined)t.compositeRule=a;if(A!==undefined)t.createErrors=A;if(c!==undefined)t.allErrors=c;t.jtdDiscriminator=n;t.jtdMetadata=i}n.extendSubschemaMode=extendSubschemaMode},3893:(t,n,i)=>{Object.defineProperty(n,"__esModule",{value:true});n.CodeGen=n.Name=n.nil=n.stringify=n.str=n._=n.KeywordCxt=void 0;var a=i(7881);Object.defineProperty(n,"KeywordCxt",{enumerable:true,get:function(){return a.KeywordCxt}});var A=i(1436);Object.defineProperty(n,"_",{enumerable:true,get:function(){return A._}});Object.defineProperty(n,"str",{enumerable:true,get:function(){return A.str}});Object.defineProperty(n,"stringify",{enumerable:true,get:function(){return A.stringify}});Object.defineProperty(n,"nil",{enumerable:true,get:function(){return A.nil}});Object.defineProperty(n,"Name",{enumerable:true,get:function(){return A.Name}});Object.defineProperty(n,"CodeGen",{enumerable:true,get:function(){return A.CodeGen}});const c=i(3021);const l=i(3162);const d=i(7353);const h=i(2718);const f=i(1436);const g=i(4090);const p=i(6685);const m=i(4464);const E=i(3837);const C=i(6285);const defaultRegExp=(t,n)=>new RegExp(t,n);defaultRegExp.code="new RegExp";const I=["removeAdditional","useDefaults","coerceTypes"];const y=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]);const B={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."};const Q={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'};const w=200;function requiredOptions(t){var n,i,a,A,c,l,d,h,f,g,p,m,E,I,y,B,Q,S,b,R,v,k,D,T,N;const M=t.strict;const F=(n=t.code)===null||n===void 0?void 0:n.optimize;const x=F===true||F===undefined?1:F||0;const U=(a=(i=t.code)===null||i===void 0?void 0:i.regExp)!==null&&a!==void 0?a:defaultRegExp;const P=(A=t.uriResolver)!==null&&A!==void 0?A:C.default;return{strictSchema:(l=(c=t.strictSchema)!==null&&c!==void 0?c:M)!==null&&l!==void 0?l:true,strictNumbers:(h=(d=t.strictNumbers)!==null&&d!==void 0?d:M)!==null&&h!==void 0?h:true,strictTypes:(g=(f=t.strictTypes)!==null&&f!==void 0?f:M)!==null&&g!==void 0?g:"log",strictTuples:(m=(p=t.strictTuples)!==null&&p!==void 0?p:M)!==null&&m!==void 0?m:"log",strictRequired:(I=(E=t.strictRequired)!==null&&E!==void 0?E:M)!==null&&I!==void 0?I:false,code:t.code?{...t.code,optimize:x,regExp:U}:{optimize:x,regExp:U},loopRequired:(y=t.loopRequired)!==null&&y!==void 0?y:w,loopEnum:(B=t.loopEnum)!==null&&B!==void 0?B:w,meta:(Q=t.meta)!==null&&Q!==void 0?Q:true,messages:(S=t.messages)!==null&&S!==void 0?S:true,inlineRefs:(b=t.inlineRefs)!==null&&b!==void 0?b:true,schemaId:(R=t.schemaId)!==null&&R!==void 0?R:"$id",addUsedSchema:(v=t.addUsedSchema)!==null&&v!==void 0?v:true,validateSchema:(k=t.validateSchema)!==null&&k!==void 0?k:true,validateFormats:(D=t.validateFormats)!==null&&D!==void 0?D:true,unicodeRegExp:(T=t.unicodeRegExp)!==null&&T!==void 0?T:true,int32range:(N=t.int32range)!==null&&N!==void 0?N:true,uriResolver:P}}class Ajv{constructor(t={}){this.schemas={};this.refs={};this.formats=Object.create(null);this._compilations=new Set;this._loading={};this._cache=new Map;t=this.opts={...t,...requiredOptions(t)};const{es5:n,lines:i}=this.opts.code;this.scope=new f.ValueScope({scope:{},prefixes:y,es5:n,lines:i});this.logger=getLogger(t.logger);const a=t.validateFormats;t.validateFormats=false;this.RULES=(0,d.getRules)();checkOptions.call(this,B,t,"NOT SUPPORTED");checkOptions.call(this,Q,t,"DEPRECATED","warn");this._metaOpts=getMetaSchemaOptions.call(this);if(t.formats)addInitialFormats.call(this);this._addVocabularies();this._addDefaultMetaSchema();if(t.keywords)addInitialKeywords.call(this,t.keywords);if(typeof t.meta=="object")this.addMetaSchema(t.meta);addInitialSchemas.call(this);t.validateFormats=a}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:t,meta:n,schemaId:i}=this.opts;let a=E;if(i==="id"){a={...E};a.id=a.$id;delete a.$id}if(n&&t)this.addMetaSchema(a,a[i],false)}defaultMeta(){const{meta:t,schemaId:n}=this.opts;return this.opts.defaultMeta=typeof t=="object"?t[n]||t:undefined}validate(t,n){let i;if(typeof t=="string"){i=this.getSchema(t);if(!i)throw new Error(`no schema with key or ref "${t}"`)}else{i=this.compile(t)}const a=i(n);if(!("$async"in i))this.errors=i.errors;return a}compile(t,n){const i=this._addSchema(t,n);return i.validate||this._compileSchemaEnv(i)}compileAsync(t,n){if(typeof this.opts.loadSchema!="function"){throw new Error("options.loadSchema should be a function")}const{loadSchema:i}=this.opts;return runCompileAsync.call(this,t,n);async function runCompileAsync(t,n){await loadMetaSchema.call(this,t.$schema);const i=this._addSchema(t,n);return i.validate||_compileAsync.call(this,i)}async function loadMetaSchema(t){if(t&&!this.getSchema(t)){await runCompileAsync.call(this,{$ref:t},true)}}async function _compileAsync(t){try{return this._compileSchemaEnv(t)}catch(n){if(!(n instanceof l.default))throw n;checkLoaded.call(this,n);await loadMissingSchema.call(this,n.missingSchema);return _compileAsync.call(this,t)}}function checkLoaded({missingSchema:t,missingRef:n}){if(this.refs[t]){throw new Error(`AnySchema ${t} is loaded but ${n} cannot be resolved`)}}async function loadMissingSchema(t){const i=await _loadSchema.call(this,t);if(!this.refs[t])await loadMetaSchema.call(this,i.$schema);if(!this.refs[t])this.addSchema(i,t,n)}async function _loadSchema(t){const n=this._loading[t];if(n)return n;try{return await(this._loading[t]=i(t))}finally{delete this._loading[t]}}}addSchema(t,n,i,a=this.opts.validateSchema){if(Array.isArray(t)){for(const n of t)this.addSchema(n,undefined,i,a);return this}let A;if(typeof t==="object"){const{schemaId:n}=this.opts;A=t[n];if(A!==undefined&&typeof A!="string"){throw new Error(`schema ${n} must be string`)}}n=(0,g.normalizeId)(n||A);this._checkUnique(n);this.schemas[n]=this._addSchema(t,i,n,a,true);return this}addMetaSchema(t,n,i=this.opts.validateSchema){this.addSchema(t,n,true,i);return this}validateSchema(t,n){if(typeof t=="boolean")return true;let i;i=t.$schema;if(i!==undefined&&typeof i!="string"){throw new Error("$schema must be a string")}i=i||this.opts.defaultMeta||this.defaultMeta();if(!i){this.logger.warn("meta-schema not available");this.errors=null;return true}const a=this.validate(i,t);if(!a&&n){const t="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(t);else throw new Error(t)}return a}getSchema(t){let n;while(typeof(n=getSchEnv.call(this,t))=="string")t=n;if(n===undefined){const{schemaId:i}=this.opts;const a=new h.SchemaEnv({schema:{},schemaId:i});n=h.resolveSchema.call(this,a,t);if(!n)return;this.refs[t]=n}return n.validate||this._compileSchemaEnv(n)}removeSchema(t){if(t instanceof RegExp){this._removeAllSchemas(this.schemas,t);this._removeAllSchemas(this.refs,t);return this}switch(typeof t){case"undefined":this._removeAllSchemas(this.schemas);this._removeAllSchemas(this.refs);this._cache.clear();return this;case"string":{const n=getSchEnv.call(this,t);if(typeof n=="object")this._cache.delete(n.schema);delete this.schemas[t];delete this.refs[t];return this}case"object":{const n=t;this._cache.delete(n);let i=t[this.opts.schemaId];if(i){i=(0,g.normalizeId)(i);delete this.schemas[i];delete this.refs[i]}return this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(t){for(const n of t)this.addKeyword(n);return this}addKeyword(t,n){let i;if(typeof t=="string"){i=t;if(typeof n=="object"){this.logger.warn("these parameters are deprecated, see docs for addKeyword");n.keyword=i}}else if(typeof t=="object"&&n===undefined){n=t;i=n.keyword;if(Array.isArray(i)&&!i.length){throw new Error("addKeywords: keyword must be string or non-empty array")}}else{throw new Error("invalid addKeywords parameters")}checkKeyword.call(this,i,n);if(!n){(0,m.eachItem)(i,t=>addRule.call(this,t));return this}keywordMetaschema.call(this,n);const a={...n,type:(0,p.getJSONTypes)(n.type),schemaType:(0,p.getJSONTypes)(n.schemaType)};(0,m.eachItem)(i,a.type.length===0?t=>addRule.call(this,t,a):t=>a.type.forEach(n=>addRule.call(this,t,a,n)));return this}getKeyword(t){const n=this.RULES.all[t];return typeof n=="object"?n.definition:!!n}removeKeyword(t){const{RULES:n}=this;delete n.keywords[t];delete n.all[t];for(const i of n.rules){const n=i.rules.findIndex(n=>n.keyword===t);if(n>=0)i.rules.splice(n,1)}return this}addFormat(t,n){if(typeof n=="string")n=new RegExp(n);this.formats[t]=n;return this}errorsText(t=this.errors,{separator:n=", ",dataVar:i="data"}={}){if(!t||t.length===0)return"No errors";return t.map(t=>`${i}${t.instancePath} ${t.message}`).reduce((t,i)=>t+n+i)}$dataMetaSchema(t,n){const i=this.RULES.all;t=JSON.parse(JSON.stringify(t));for(const a of n){const n=a.split("/").slice(1);let A=t;for(const t of n)A=A[t];for(const t in i){const n=i[t];if(typeof n!="object")continue;const{$data:a}=n.definition;const c=A[t];if(a&&c)A[t]=schemaOrData(c)}}return t}_removeAllSchemas(t,n){for(const i in t){const a=t[i];if(!n||n.test(i)){if(typeof a=="string"){delete t[i]}else if(a&&!a.meta){this._cache.delete(a.schema);delete t[i]}}}}_addSchema(t,n,i,a=this.opts.validateSchema,A=this.opts.addUsedSchema){let c;const{schemaId:l}=this.opts;if(typeof t=="object"){c=t[l]}else{if(this.opts.jtd)throw new Error("schema must be object");else if(typeof t!="boolean")throw new Error("schema must be object or boolean")}let d=this._cache.get(t);if(d!==undefined)return d;i=(0,g.normalizeId)(c||i);const f=g.getSchemaRefs.call(this,t,i);d=new h.SchemaEnv({schema:t,schemaId:l,meta:n,baseId:i,localRefs:f});this._cache.set(d.schema,d);if(A&&!i.startsWith("#")){if(i)this._checkUnique(i);this.refs[i]=d}if(a)this.validateSchema(t,true);return d}_checkUnique(t){if(this.schemas[t]||this.refs[t]){throw new Error(`schema with key or id "${t}" already exists`)}}_compileSchemaEnv(t){if(t.meta)this._compileMetaSchema(t);else h.compileSchema.call(this,t);if(!t.validate)throw new Error("ajv implementation error");return t.validate}_compileMetaSchema(t){const n=this.opts;this.opts=this._metaOpts;try{h.compileSchema.call(this,t)}finally{this.opts=n}}}Ajv.ValidationError=c.default;Ajv.MissingRefError=l.default;n["default"]=Ajv;function checkOptions(t,n,i,a="error"){for(const A in t){const c=A;if(c in n)this.logger[a](`${i}: option ${A}. ${t[c]}`)}}function getSchEnv(t){t=(0,g.normalizeId)(t);return this.schemas[t]||this.refs[t]}function addInitialSchemas(){const t=this.opts.schemas;if(!t)return;if(Array.isArray(t))this.addSchema(t);else for(const n in t)this.addSchema(t[n],n)}function addInitialFormats(){for(const t in this.opts.formats){const n=this.opts.formats[t];if(n)this.addFormat(t,n)}}function addInitialKeywords(t){if(Array.isArray(t)){this.addVocabulary(t);return}this.logger.warn("keywords option as map is deprecated, pass array");for(const n in t){const i=t[n];if(!i.keyword)i.keyword=n;this.addKeyword(i)}}function getMetaSchemaOptions(){const t={...this.opts};for(const n of I)delete t[n];return t}const S={log(){},warn(){},error(){}};function getLogger(t){if(t===false)return S;if(t===undefined)return console;if(t.log&&t.warn&&t.error)return t;throw new Error("logger must implement log, warn and error methods")}const b=/^[a-z_$][a-z0-9_$:-]*$/i;function checkKeyword(t,n){const{RULES:i}=this;(0,m.eachItem)(t,t=>{if(i.keywords[t])throw new Error(`Keyword ${t} is already defined`);if(!b.test(t))throw new Error(`Keyword ${t} has invalid name`)});if(!n)return;if(n.$data&&!("code"in n||"validate"in n)){throw new Error('$data keyword must have "code" or "validate" function')}}function addRule(t,n,i){var a;const A=n===null||n===void 0?void 0:n.post;if(i&&A)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:c}=this;let l=A?c.post:c.rules.find(({type:t})=>t===i);if(!l){l={type:i,rules:[]};c.rules.push(l)}c.keywords[t]=true;if(!n)return;const d={keyword:t,definition:{...n,type:(0,p.getJSONTypes)(n.type),schemaType:(0,p.getJSONTypes)(n.schemaType)}};if(n.before)addBeforeRule.call(this,l,d,n.before);else l.rules.push(d);c.all[t]=d;(a=n.implements)===null||a===void 0?void 0:a.forEach(t=>this.addKeyword(t))}function addBeforeRule(t,n,i){const a=t.rules.findIndex(t=>t.keyword===i);if(a>=0){t.rules.splice(a,0,n)}else{t.rules.push(n);this.logger.warn(`rule ${i} is not defined`)}}function keywordMetaschema(t){let{metaSchema:n}=t;if(n===undefined)return;if(t.$data&&this.opts.$data)n=schemaOrData(n);t.validateSchema=this.compile(n,true)}const R={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function schemaOrData(t){return{anyOf:[t,R]}}},5375:(t,n,i)=>{Object.defineProperty(n,"__esModule",{value:true});const a=i(8138);const A=i(4908);const c=i(958);const l=i(58);const d=i(6534);const h=i(711);const f=i(8030);const g=["/properties"];function addMetaSchema2019(t){[a,A,c,l,with$data(this,d),h,with$data(this,f)].forEach(t=>this.addMetaSchema(t,undefined,false));return this;function with$data(n,i){return t?n.$dataMetaSchema(i,g):i}}n["default"]=addMetaSchema2019},4951:(t,n,i)=>{Object.defineProperty(n,"__esModule",{value:true});const a=i(3430);a.code='require("ajv/dist/runtime/equal").default';n["default"]=a},6214:(t,n)=>{Object.defineProperty(n,"__esModule",{value:true});function ucs2length(t){const n=t.length;let i=0;let a=0;let A;while(a=55296&&A<=56319&&a{Object.defineProperty(n,"__esModule",{value:true});const a=i(4352);a.code='require("ajv/dist/runtime/uri").default';n["default"]=a},3021:(t,n)=>{Object.defineProperty(n,"__esModule",{value:true});class ValidationError extends Error{constructor(t){super("validation failed");this.errors=t;this.ajv=this.validation=true}}n["default"]=ValidationError},3448:(t,n,i)=>{Object.defineProperty(n,"__esModule",{value:true});n.validateAdditionalItems=void 0;const a=i(1436);const A=i(4464);const c={message:({params:{len:t}})=>(0,a.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,a._)`{limit: ${t}}`};const l={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:c,code(t){const{parentSchema:n,it:i}=t;const{items:a}=n;if(!Array.isArray(a)){(0,A.checkStrictMode)(i,'"additionalItems" is ignored when "items" is not an array of schemas');return}validateAdditionalItems(t,a)}};function validateAdditionalItems(t,n){const{gen:i,schema:c,data:l,keyword:d,it:h}=t;h.items=true;const f=i.const("len",(0,a._)`${l}.length`);if(c===false){t.setParams({len:n.length});t.pass((0,a._)`${f} <= ${n.length}`)}else if(typeof c=="object"&&!(0,A.alwaysValidSchema)(h,c)){const A=i.var("valid",(0,a._)`${f} <= ${n.length}`);i.if((0,a.not)(A),()=>validateItems(A));t.ok(A)}function validateItems(c){i.forRange("i",n.length,f,n=>{t.subschema({keyword:d,dataProp:n,dataPropType:A.Type.Num},c);if(!h.allErrors)i.if((0,a.not)(c),()=>i.break())})}}n.validateAdditionalItems=validateAdditionalItems;n["default"]=l},2431:(t,n,i)=>{Object.defineProperty(n,"__esModule",{value:true});const a=i(8484);const A=i(1436);const c=i(630);const l=i(4464);const d={message:"must NOT have additional properties",params:({params:t})=>(0,A._)`{additionalProperty: ${t.additionalProperty}}`};const h={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:true,trackErrors:true,error:d,code(t){const{gen:n,schema:i,parentSchema:d,data:h,errsCount:f,it:g}=t;if(!f)throw new Error("ajv implementation error");const{allErrors:p,opts:m}=g;g.props=true;if(m.removeAdditional!=="all"&&(0,l.alwaysValidSchema)(g,i))return;const E=(0,a.allSchemaProperties)(d.properties);const C=(0,a.allSchemaProperties)(d.patternProperties);checkAdditionalProperties();t.ok((0,A._)`${f} === ${c.default.errors}`);function checkAdditionalProperties(){n.forIn("key",h,t=>{if(!E.length&&!C.length)additionalPropertyCode(t);else n.if(isAdditional(t),()=>additionalPropertyCode(t))})}function isAdditional(i){let c;if(E.length>8){const t=(0,l.schemaRefOrVal)(g,d.properties,"properties");c=(0,a.isOwnProperty)(n,t,i)}else if(E.length){c=(0,A.or)(...E.map(t=>(0,A._)`${i} === ${t}`))}else{c=A.nil}if(C.length){c=(0,A.or)(c,...C.map(n=>(0,A._)`${(0,a.usePattern)(t,n)}.test(${i})`))}return(0,A.not)(c)}function deleteAdditional(t){n.code((0,A._)`delete ${h}[${t}]`)}function additionalPropertyCode(a){if(m.removeAdditional==="all"||m.removeAdditional&&i===false){deleteAdditional(a);return}if(i===false){t.setParams({additionalProperty:a});t.error();if(!p)n.break();return}if(typeof i=="object"&&!(0,l.alwaysValidSchema)(g,i)){const i=n.name("valid");if(m.removeAdditional==="failing"){applyAdditionalSchema(a,i,false);n.if((0,A.not)(i),()=>{t.reset();deleteAdditional(a)})}else{applyAdditionalSchema(a,i);if(!p)n.if((0,A.not)(i),()=>n.break())}}}function applyAdditionalSchema(n,i,a){const A={keyword:"additionalProperties",dataProp:n,dataPropType:l.Type.Str};if(a===false){Object.assign(A,{compositeRule:true,createErrors:false,allErrors:false})}t.subschema(A,i)}}};n["default"]=h},9205:(t,n,i)=>{Object.defineProperty(n,"__esModule",{value:true});const a=i(4464);const A={keyword:"allOf",schemaType:"array",code(t){const{gen:n,schema:i,it:A}=t;if(!Array.isArray(i))throw new Error("ajv implementation error");const c=n.name("valid");i.forEach((n,i)=>{if((0,a.alwaysValidSchema)(A,n))return;const l=t.subschema({keyword:"allOf",schemaProp:i},c);t.ok(c);t.mergeEvaluated(l)})}};n["default"]=A},9380:(t,n,i)=>{Object.defineProperty(n,"__esModule",{value:true});const a=i(8484);const A={keyword:"anyOf",schemaType:"array",trackErrors:true,code:a.validateUnion,error:{message:"must match a schema in anyOf"}};n["default"]=A},6182:(t,n,i)=>{Object.defineProperty(n,"__esModule",{value:true});const a=i(1436);const A=i(4464);const c={message:({params:{min:t,max:n}})=>n===undefined?(0,a.str)`must contain at least ${t} valid item(s)`:(0,a.str)`must contain at least ${t} and no more than ${n} valid item(s)`,params:({params:{min:t,max:n}})=>n===undefined?(0,a._)`{minContains: ${t}}`:(0,a._)`{minContains: ${t}, maxContains: ${n}}`};const l={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:true,error:c,code(t){const{gen:n,schema:i,parentSchema:c,data:l,it:d}=t;let h;let f;const{minContains:g,maxContains:p}=c;if(d.opts.next){h=g===undefined?1:g;f=p}else{h=1}const m=n.const("len",(0,a._)`${l}.length`);t.setParams({min:h,max:f});if(f===undefined&&h===0){(0,A.checkStrictMode)(d,`"minContains" == 0 without "maxContains": "contains" keyword ignored`);return}if(f!==undefined&&h>f){(0,A.checkStrictMode)(d,`"minContains" > "maxContains" is always invalid`);t.fail();return}if((0,A.alwaysValidSchema)(d,i)){let n=(0,a._)`${m} >= ${h}`;if(f!==undefined)n=(0,a._)`${n} && ${m} <= ${f}`;t.pass(n);return}d.items=true;const E=n.name("valid");if(f===undefined&&h===1){validateItems(E,()=>n.if(E,()=>n.break()))}else if(h===0){n.let(E,true);if(f!==undefined)n.if((0,a._)`${l}.length > 0`,validateItemsWithCount)}else{n.let(E,false);validateItemsWithCount()}t.result(E,()=>t.reset());function validateItemsWithCount(){const t=n.name("_valid");const i=n.let("count",0);validateItems(t,()=>n.if(t,()=>checkLimits(i)))}function validateItems(i,a){n.forRange("i",0,m,n=>{t.subschema({keyword:"contains",dataProp:n,dataPropType:A.Type.Num,compositeRule:true},i);a()})}function checkLimits(t){n.code((0,a._)`${t}++`);if(f===undefined){n.if((0,a._)`${t} >= ${h}`,()=>n.assign(E,true).break())}else{n.if((0,a._)`${t} > ${f}`,()=>n.assign(E,false).break());if(h===1)n.assign(E,true);else n.if((0,a._)`${t} >= ${h}`,()=>n.assign(E,true))}}}};n["default"]=l},5826:(t,n,i)=>{Object.defineProperty(n,"__esModule",{value:true});n.validateSchemaDeps=n.validatePropertyDeps=n.error=void 0;const a=i(1436);const A=i(4464);const c=i(8484);n.error={message:({params:{property:t,depsCount:n,deps:i}})=>{const A=n===1?"property":"properties";return(0,a.str)`must have ${A} ${i} when property ${t} is present`},params:({params:{property:t,depsCount:n,deps:i,missingProperty:A}})=>(0,a._)`{property: ${t},