@thunderclient/cli 1.26.3 → 1.26.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/827.index.js CHANGED
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
- "use strict";exports.id=827,exports.ids=[827],exports.modules={851(t,e,i){i.d(e,{getDefaultRoleAssumer:()=>gs,getDefaultRoleAssumerWithWebIdentity:()=>ms});var s=i(79),n=i(92),r=i(54);const o={silence:!1};var a=i(132),c=i(133);const u={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 l=i(115),d=i(118);class f extends d.T{constructor(t){super(t),Object.setPrototypeOf(this,f.prototype)}}class p extends f{name="ExpiredTokenException";$fault="client";constructor(t){super({name:"ExpiredTokenException",$fault:"client",...t}),Object.setPrototypeOf(this,p.prototype)}}class h extends f{name="MalformedPolicyDocumentException";$fault="client";constructor(t){super({name:"MalformedPolicyDocumentException",$fault:"client",...t}),Object.setPrototypeOf(this,h.prototype)}}class g extends f{name="PackedPolicyTooLargeException";$fault="client";constructor(t){super({name:"PackedPolicyTooLargeException",$fault:"client",...t}),Object.setPrototypeOf(this,g.prototype)}}class m extends f{name="RegionDisabledException";$fault="client";constructor(t){super({name:"RegionDisabledException",$fault:"client",...t}),Object.setPrototypeOf(this,m.prototype)}}class w extends f{name="IDPRejectedClaimException";$fault="client";constructor(t){super({name:"IDPRejectedClaimException",$fault:"client",...t}),Object.setPrototypeOf(this,w.prototype)}}class S extends f{name="InvalidIdentityTokenException";$fault="client";constructor(t){super({name:"InvalidIdentityTokenException",$fault:"client",...t}),Object.setPrototypeOf(this,S.prototype)}}class E extends f{name="IDPCommunicationErrorException";$fault="client";constructor(t){super({name:"IDPCommunicationErrorException",$fault:"client",...t}),Object.setPrototypeOf(this,E.prototype)}}const b="AssumedRoleUser",v="Credentials",y="DurationSeconds",x="Policy",I="PolicyArns",A="PackedPolicySize",T="RoleArn",P="RoleSessionName",$="SourceIdentity",R="awsQueryError",D="client",N="error",k="httpError",C="message",O="smithy.ts.sdk.synthetic.com.amazonaws.sts",F="com.amazonaws.sts",M=l.O.for(O);var U=[-3,O,"STSServiceException",0,[],[]];M.registerError(U,f);const j=l.O.for(F);var _=[-3,F,"ExpiredTokenException",{[R]:["ExpiredTokenException",400],[N]:D,[k]:400},[C],[0]];j.registerError(_,p);var W=[-3,F,"IDPCommunicationErrorException",{[R]:["IDPCommunicationError",400],[N]:D,[k]:400},[C],[0]];j.registerError(W,E);var L=[-3,F,"IDPRejectedClaimException",{[R]:["IDPRejectedClaim",403],[N]:D,[k]:403},[C],[0]];j.registerError(L,w);var z=[-3,F,"InvalidIdentityTokenException",{[R]:["InvalidIdentityToken",400],[N]:D,[k]:400},[C],[0]];j.registerError(z,S);var G=[-3,F,"MalformedPolicyDocumentException",{[R]:["MalformedPolicyDocument",400],[N]:D,[k]:400},[C],[0]];j.registerError(G,h);var V=[-3,F,"PackedPolicyTooLargeException",{[R]:["PackedPolicyTooLarge",400],[N]:D,[k]:400},[C],[0]];j.registerError(V,g);var B=[-3,F,"RegionDisabledException",{[R]:["RegionDisabledException",403],[N]:D,[k]:403},[C],[0]];j.registerError(B,m);const q=[M,j];var K=[0,F,"accessKeySecretType",8,0],Y=[0,F,"clientTokenType",8,0],H=[3,F,b,0,["AssumedRoleId","Arn"],[0,0],2],Q=[3,F,"AssumeRoleRequest",0,[T,P,I,x,y,"Tags","TransitiveTagKeys","ExternalId","SerialNumber","TokenCode",$,"ProvidedContexts"],[0,0,()=>nt,0,1,()=>ot,64,0,0,0,0,()=>rt],2],J=[3,F,"AssumeRoleResponse",0,[v,b,A,$],[[()=>tt,0],()=>H,1,0]],X=[3,F,"AssumeRoleWithWebIdentityRequest",0,[T,P,"WebIdentityToken","ProviderId",I,x,y],[0,0,[()=>Y,0],0,()=>nt,0,1],3],Z=[3,F,"AssumeRoleWithWebIdentityResponse",0,[v,"SubjectFromWebIdentityToken",b,A,"Provider","Audience",$],[[()=>tt,0],0,()=>H,1,0,0,0]],tt=[3,F,v,0,["AccessKeyId","SecretAccessKey","SessionToken","Expiration"],[0,[()=>K,0],0,4],4],et=[3,F,"PolicyDescriptorType",0,["arn"],[0]],it=[3,F,"ProvidedContext",0,["ProviderArn","ContextAssertion"],[0,0]],st=[3,F,"Tag",0,["Key","Value"],[0,0],2],nt=[1,F,"policyDescriptorListType",0,()=>et],rt=[1,F,"ProvidedContextsListType",0,()=>it],ot=[1,F,"tagListType",0,()=>st],at=[9,F,"AssumeRole",0,()=>Q,()=>J],ct=[9,F,"AssumeRoleWithWebIdentity",0,()=>X,()=>Z];class ut extends(c.u.classBuilder().ep(u).m(function(t,e,i,s){return[(0,a.r)(i,t.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","AssumeRole",{}).n("STSClient","AssumeRoleCommand").sc(at).build()){}class lt extends(c.u.classBuilder().ep(u).m(function(t,e,i,s){return[(0,a.r)(i,t.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","AssumeRoleWithWebIdentity",{}).n("STSClient","AssumeRoleWithWebIdentityCommand").sc(ct).build()){}const dt=t=>{if("string"==typeof t?.Arn){const e=t.Arn.split(":");if(e.length>4&&""!==e[4])return e[4]}},ft=async(t,e,i,s={})=>{const a="function"==typeof t?await t():t,c="function"==typeof e?await e():e;let u="";const l=a??c??(u=await function(t={}){return(0,r.Z)({...n.GG,default:async()=>(o.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."),"us-east-1")},{...n.zH,...t})}(s)());return i?.debug?.("@aws-sdk/client-sts::resolveRegion","accepting first of:",`${a} (credential provider clientConfig)`,`${c} (contextual client)`,`${u} (STS default: AWS_REGION, profile region, or us-east-1)`),l},pt=(t,e)=>{let i,n;return async(r,o)=>{if(n=r,!i){const{logger:s=t?.parentClientConfig?.logger,profile:r=t?.parentClientConfig?.profile,region:o,requestHandler:a=t?.parentClientConfig?.requestHandler,credentialProviderLogger:c,userAgentAppId:u=t?.parentClientConfig?.userAgentAppId}=t,l=await ft(o,t?.parentClientConfig?.region,c,{logger:s,profile:r}),d=!gt(a);i=new e({...t,userAgentAppId:u,profile:r,credentialDefaultProvider:()=>async()=>n,region:l,requestHandler:d?a:void 0,logger:s})}const{Credentials:a,AssumedRoleUser:c}=await i.send(new ut(o));if(!a||!a.AccessKeyId||!a.SecretAccessKey)throw new Error(`Invalid response from STS.assumeRole call with role ${o.RoleArn}`);const u=dt(c),l={accessKeyId:a.AccessKeyId,secretAccessKey:a.SecretAccessKey,sessionToken:a.SessionToken,expiration:a.Expiration,...a.CredentialScope&&{credentialScope:a.CredentialScope},...u&&{accountId:u}};return(0,s.g)(l,"CREDENTIALS_STS_ASSUME_ROLE","i"),l}},ht=(t,e)=>{let i;return async n=>{if(!i){const{logger:s=t?.parentClientConfig?.logger,profile:n=t?.parentClientConfig?.profile,region:r,requestHandler:o=t?.parentClientConfig?.requestHandler,credentialProviderLogger:a,userAgentAppId:c=t?.parentClientConfig?.userAgentAppId}=t,u=await ft(r,t?.parentClientConfig?.region,a,{logger:s,profile:n}),l=!gt(o);i=new e({...t,userAgentAppId:c,profile:n,region:u,requestHandler:l?o:void 0,logger:s})}const{Credentials:r,AssumedRoleUser:o}=await i.send(new lt(n));if(!r||!r.AccessKeyId||!r.SecretAccessKey)throw new Error(`Invalid response from STS.assumeRoleWithWebIdentity call with role ${n.RoleArn}`);const a=dt(o),c={accessKeyId:r.AccessKeyId,secretAccessKey:r.SecretAccessKey,sessionToken:r.SessionToken,expiration:r.Expiration,...r.CredentialScope&&{credentialScope:r.CredentialScope},...a&&{accountId:a}};return a&&(0,s.g)(c,"RESOLVED_ACCOUNT_ID","T"),(0,s.g)(c,"CREDENTIALS_STS_ASSUME_ROLE_WEB_ID","k"),c}},gt=t=>"h2"===t?.metadata?.handlerProtocol;var mt=i(32),wt=i(34),St=i(35),Et=i(36),bt=i(38),vt=i(42),yt=i(44),xt=i(43),It=i(47),At=i(48),Tt=i(50),Pt=i(51),$t=i(69),Rt=i(73),Dt=i(76),Nt=i(78),kt=i(45),Ct=i(52);const Ot=async(t,e,i)=>({operation:(0,kt.u)(e).operation,region:await(0,Ct.t)(t.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});const Ft=t=>{const e=[];if("AssumeRoleWithWebIdentity"===t.operation)e.push({schemeId:"smithy.api#noAuth"});else e.push(function(t){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"sts",region:t.region},propertiesExtractor:(t,e)=>({signingProperties:{config:t,context:e}})}}(t));return e},Mt=t=>{const e=(i=t,Object.assign(i,{stsClientCtor:ps}));var i;const s=(0,Nt.h)(e);return Object.assign(s,{authSchemePreference:(0,Ct.t)(t.authSchemePreference??[])})};var Ut=i(849),jt=i(86),_t=i(87),Wt=i(105),Lt=i(89),zt=i(91),Gt=i(93),Vt=i(96),Bt=i(847),qt=i(97),Kt=i(98),Yt=i(99),Ht=i(101),Qt=i(100),Jt=i(102),Xt=i(104),Zt=i(70),te=i(106),ee=i(110),ie=i(108),se=i(107),ne=i(117);const re={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(t,e,i){return t},captureMetaData:!1},oe=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",ae=new RegExp("^"+("["+oe+"]["+(oe+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040")+"]*")+"$");function ce(t,e){const i=[];let s=e.exec(t);for(;s;){const n=[];n.startIndex=e.lastIndex-s[0].length;const r=s.length;for(let t=0;t<r;t++)n.push(s[t]);i.push(n),s=e.exec(t)}return i}const ue=function(t){const e=ae.exec(t);return!(null==e)};let le;le="function"!=typeof Symbol?"@@xmlMetadata":Symbol("XML Node Metadata");class de{constructor(t){this.tagname=t,this.child=[],this[":@"]={}}add(t,e){"__proto__"===t&&(t="#__proto__"),this.child.push({[t]:e})}addChild(t,e){"__proto__"===t.tagname&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child}),void 0!==e&&(this.child[this.child.length-1][le]={startIndex:e})}static getMetaDataSymbol(){return le}}class fe{constructor(t){this.suppressValidationErr=!t}readDocType(t,e){const i={};if("O"!==t[e+3]||"C"!==t[e+4]||"T"!==t[e+5]||"Y"!==t[e+6]||"P"!==t[e+7]||"E"!==t[e+8])throw new Error("Invalid Tag instead of DOCTYPE");{e+=9;let s=1,n=!1,r=!1,o="";for(;e<t.length;e++)if("<"!==t[e]||r)if(">"===t[e]){if(r?"-"===t[e-1]&&"-"===t[e-2]&&(r=!1,s--):s--,0===s)break}else"["===t[e]?n=!0:o+=t[e];else{if(n&&he(t,"!ENTITY",e)){let s,n;e+=7,[s,n,e]=this.readEntityExp(t,e+1,this.suppressValidationErr),-1===n.indexOf("&")&&(i[s]={regx:RegExp(`&${s};`,"g"),val:n})}else if(n&&he(t,"!ELEMENT",e)){e+=8;const{index:i}=this.readElementExp(t,e+1);e=i}else if(n&&he(t,"!ATTLIST",e))e+=8;else if(n&&he(t,"!NOTATION",e)){e+=9;const{index:i}=this.readNotationExp(t,e+1,this.suppressValidationErr);e=i}else{if(!he(t,"!--",e))throw new Error("Invalid DOCTYPE");r=!0}s++,o=""}if(0!==s)throw new Error("Unclosed DOCTYPE")}return{entities:i,i:e}}readEntityExp(t,e){e=pe(t,e);let i="";for(;e<t.length&&!/\s/.test(t[e])&&'"'!==t[e]&&"'"!==t[e];)i+=t[e],e++;if(ge(i),e=pe(t,e),!this.suppressValidationErr){if("SYSTEM"===t.substring(e,e+6).toUpperCase())throw new Error("External entities are not supported");if("%"===t[e])throw new Error("Parameter entities are not supported")}let s="";return[e,s]=this.readIdentifierVal(t,e,"entity"),[i,s,--e]}readNotationExp(t,e){e=pe(t,e);let i="";for(;e<t.length&&!/\s/.test(t[e]);)i+=t[e],e++;!this.suppressValidationErr&&ge(i),e=pe(t,e);const s=t.substring(e,e+6).toUpperCase();if(!this.suppressValidationErr&&"SYSTEM"!==s&&"PUBLIC"!==s)throw new Error(`Expected SYSTEM or PUBLIC, found "${s}"`);e+=s.length,e=pe(t,e);let n=null,r=null;if("PUBLIC"===s)[e,n]=this.readIdentifierVal(t,e,"publicIdentifier"),'"'!==t[e=pe(t,e)]&&"'"!==t[e]||([e,r]=this.readIdentifierVal(t,e,"systemIdentifier"));else if("SYSTEM"===s&&([e,r]=this.readIdentifierVal(t,e,"systemIdentifier"),!this.suppressValidationErr&&!r))throw new Error("Missing mandatory system identifier for SYSTEM notation");return{notationName:i,publicIdentifier:n,systemIdentifier:r,index:--e}}readIdentifierVal(t,e,i){let s="";const n=t[e];if('"'!==n&&"'"!==n)throw new Error(`Expected quoted string, found "${n}"`);for(e++;e<t.length&&t[e]!==n;)s+=t[e],e++;if(t[e]!==n)throw new Error(`Unterminated ${i} value`);return[++e,s]}readElementExp(t,e){e=pe(t,e);let i="";for(;e<t.length&&!/\s/.test(t[e]);)i+=t[e],e++;if(!this.suppressValidationErr&&!ue(i))throw new Error(`Invalid element name: "${i}"`);let s="";if("E"===t[e=pe(t,e)]&&he(t,"MPTY",e))e+=4;else if("A"===t[e]&&he(t,"NY",e))e+=2;else if("("===t[e]){for(e++;e<t.length&&")"!==t[e];)s+=t[e],e++;if(")"!==t[e])throw new Error("Unterminated content model")}else if(!this.suppressValidationErr)throw new Error(`Invalid Element Expression, found "${t[e]}"`);return{elementName:i,contentModel:s.trim(),index:e}}readAttlistExp(t,e){e=pe(t,e);let i="";for(;e<t.length&&!/\s/.test(t[e]);)i+=t[e],e++;ge(i),e=pe(t,e);let s="";for(;e<t.length&&!/\s/.test(t[e]);)s+=t[e],e++;if(!ge(s))throw new Error(`Invalid attribute name: "${s}"`);e=pe(t,e);let n="";if("NOTATION"===t.substring(e,e+8).toUpperCase()){if(n="NOTATION","("!==t[e=pe(t,e+=8)])throw new Error(`Expected '(', found "${t[e]}"`);e++;let i=[];for(;e<t.length&&")"!==t[e];){let s="";for(;e<t.length&&"|"!==t[e]&&")"!==t[e];)s+=t[e],e++;if(s=s.trim(),!ge(s))throw new Error(`Invalid notation name: "${s}"`);i.push(s),"|"===t[e]&&(e++,e=pe(t,e))}if(")"!==t[e])throw new Error("Unterminated list of notations");e++,n+=" ("+i.join("|")+")"}else{for(;e<t.length&&!/\s/.test(t[e]);)n+=t[e],e++;const i=["CDATA","ID","IDREF","IDREFS","ENTITY","ENTITIES","NMTOKEN","NMTOKENS"];if(!this.suppressValidationErr&&!i.includes(n.toUpperCase()))throw new Error(`Invalid attribute type: "${n}"`)}e=pe(t,e);let r="";return"#REQUIRED"===t.substring(e,e+8).toUpperCase()?(r="#REQUIRED",e+=8):"#IMPLIED"===t.substring(e,e+7).toUpperCase()?(r="#IMPLIED",e+=7):[e,r]=this.readIdentifierVal(t,e,"ATTLIST"),{elementName:i,attributeName:s,attributeType:n,defaultValue:r,index:e}}}const pe=(t,e)=>{for(;e<t.length&&/\s/.test(t[e]);)e++;return e};function he(t,e,i){for(let s=0;s<e.length;s++)if(e[s]!==t[i+s+1])return!1;return!0}function ge(t){if(ue(t))return t;throw new Error(`Invalid entity name ${t}`)}const me=/^[-+]?0x[a-fA-F0-9]+$/,we=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,Se={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function Ee(t,e={}){if(e=Object.assign({},Se,e),!t||"string"!=typeof t)return t;let i=t.trim();if(void 0!==e.skipLike&&e.skipLike.test(i))return t;if("0"===t)return 0;if(e.hex&&me.test(i))return function(t,e){if(parseInt)return parseInt(t,e);if(Number.parseInt)return Number.parseInt(t,e);if(window&&window.parseInt)return window.parseInt(t,e);throw new Error("parseInt, Number.parseInt, window.parseInt are not supported")}(i,16);if(i.includes("e")||i.includes("E"))return function(t,e,i){if(!i.eNotation)return t;const s=e.match(be);if(s){let n=s[1]||"";const r=-1===s[3].indexOf("e")?"E":"e",o=s[2],a=n?t[o.length+1]===r:t[o.length]===r;return o.length>1&&a?t:1!==o.length||!s[3].startsWith(`.${r}`)&&s[3][0]!==r?i.leadingZeros&&!a?(e=(s[1]||"")+s[3],Number(e)):t:Number(e)}return t}(t,i,e);{const s=we.exec(i);if(s){const n=s[1]||"",r=s[2];let o=function(t){if(t&&-1!==t.indexOf("."))return"."===(t=t.replace(/0+$/,""))?t="0":"."===t[0]?t="0"+t:"."===t[t.length-1]&&(t=t.substring(0,t.length-1)),t;return t}(s[3]);const a=n?"."===t[r.length+1]:"."===t[r.length];if(!e.leadingZeros&&(r.length>1||1===r.length&&!a))return t;{const s=Number(i),a=String(s);if(0===s)return s;if(-1!==a.search(/[eE]/))return e.eNotation?s:t;if(-1!==i.indexOf("."))return"0"===a||a===o||a===`${n}${o}`?s:t;let c=r?o:i;return r?c===a||n+c===a?s:t:c===a||c===n+a?s:t}}return t}}const be=/^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;class ve{constructor(t){var e;if(this.options=t,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"¢"},pound:{regex:/&(pound|#163);/g,val:"£"},yen:{regex:/&(yen|#165);/g,val:"¥"},euro:{regex:/&(euro|#8364);/g,val:"€"},copyright:{regex:/&(copy|#169);/g,val:"©"},reg:{regex:/&(reg|#174);/g,val:"®"},inr:{regex:/&(inr|#8377);/g,val:"₹"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(t,e)=>Me(e,10,"&#")},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(t,e)=>Me(e,16,"&#x")}},this.addExternalEntities=ye,this.parseXml=Pe,this.parseTextData=xe,this.resolveNameSpace=Ie,this.buildAttributesMap=Te,this.isItStopNode=Ne,this.replaceEntitiesValue=Re,this.readStopNodeData=Oe,this.saveTextToParentTag=De,this.addChild=$e,this.ignoreAttributesFn="function"==typeof(e=this.options.ignoreAttributes)?e:Array.isArray(e)?t=>{for(const i of e){if("string"==typeof i&&t===i)return!0;if(i instanceof RegExp&&i.test(t))return!0}}:()=>!1,this.options.stopNodes&&this.options.stopNodes.length>0){this.stopNodesExact=new Set,this.stopNodesWildcard=new Set;for(let t=0;t<this.options.stopNodes.length;t++){const e=this.options.stopNodes[t];"string"==typeof e&&(e.startsWith("*.")?this.stopNodesWildcard.add(e.substring(2)):this.stopNodesExact.add(e))}}}}function ye(t){const e=Object.keys(t);for(let i=0;i<e.length;i++){const s=e[i];this.lastEntities[s]={regex:new RegExp("&"+s+";","g"),val:t[s]}}}function xe(t,e,i,s,n,r,o){if(void 0!==t&&(this.options.trimValues&&!s&&(t=t.trim()),t.length>0)){o||(t=this.replaceEntitiesValue(t));const s=this.options.tagValueProcessor(e,t,i,n,r);if(null==s)return t;if(typeof s!=typeof t||s!==t)return s;if(this.options.trimValues)return Fe(t,this.options.parseTagValue,this.options.numberParseOptions);return t.trim()===t?Fe(t,this.options.parseTagValue,this.options.numberParseOptions):t}}function Ie(t){if(this.options.removeNSPrefix){const e=t.split(":"),i="/"===t.charAt(0)?"/":"";if("xmlns"===e[0])return"";2===e.length&&(t=i+e[1])}return t}const Ae=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");function Te(t,e){if(!0!==this.options.ignoreAttributes&&"string"==typeof t){const i=ce(t,Ae),s=i.length,n={};for(let t=0;t<s;t++){const s=this.resolveNameSpace(i[t][1]);if(this.ignoreAttributesFn(s,e))continue;let r=i[t][4],o=this.options.attributeNamePrefix+s;if(s.length)if(this.options.transformAttributeName&&(o=this.options.transformAttributeName(o)),"__proto__"===o&&(o="#__proto__"),void 0!==r){this.options.trimValues&&(r=r.trim()),r=this.replaceEntitiesValue(r);const t=this.options.attributeValueProcessor(s,r,e);n[o]=null==t?r:typeof t!=typeof r||t!==r?t:Fe(r,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(n[o]=!0)}if(!Object.keys(n).length)return;if(this.options.attributesGroupName){const t={};return t[this.options.attributesGroupName]=n,t}return n}}const Pe=function(t){t=t.replace(/\r\n?/g,"\n");const e=new de("!xml");let i=e,s="",n="";const r=new fe(this.options.processEntities);for(let o=0;o<t.length;o++){if("<"===t[o])if("/"===t[o+1]){const e=ke(t,">",o,"Closing Tag is not closed.");let r=t.substring(o+2,e).trim();if(this.options.removeNSPrefix){const t=r.indexOf(":");-1!==t&&(r=r.substr(t+1))}this.options.transformTagName&&(r=this.options.transformTagName(r)),i&&(s=this.saveTextToParentTag(s,i,n));const a=n.substring(n.lastIndexOf(".")+1);if(r&&-1!==this.options.unpairedTags.indexOf(r))throw new Error(`Unpaired tag can not be used as closing tag: </${r}>`);let c=0;a&&-1!==this.options.unpairedTags.indexOf(a)?(c=n.lastIndexOf(".",n.lastIndexOf(".")-1),this.tagsNodeStack.pop()):c=n.lastIndexOf("."),n=n.substring(0,c),i=this.tagsNodeStack.pop(),s="",o=e}else if("?"===t[o+1]){let e=Ce(t,o,!1,"?>");if(!e)throw new Error("Pi Tag is not closed.");if(s=this.saveTextToParentTag(s,i,n),this.options.ignoreDeclaration&&"?xml"===e.tagName||this.options.ignorePiTags);else{const t=new de(e.tagName);t.add(this.options.textNodeName,""),e.tagName!==e.tagExp&&e.attrExpPresent&&(t[":@"]=this.buildAttributesMap(e.tagExp,n)),this.addChild(i,t,n,o)}o=e.closeIndex+1}else if("!--"===t.substr(o+1,3)){const e=ke(t,"--\x3e",o+4,"Comment is not closed.");if(this.options.commentPropName){const r=t.substring(o+4,e-2);s=this.saveTextToParentTag(s,i,n),i.add(this.options.commentPropName,[{[this.options.textNodeName]:r}])}o=e}else if("!D"===t.substr(o+1,2)){const e=r.readDocType(t,o);this.docTypeEntities=e.entities,o=e.i}else if("!["===t.substr(o+1,2)){const e=ke(t,"]]>",o,"CDATA is not closed.")-2,r=t.substring(o+9,e);s=this.saveTextToParentTag(s,i,n);let a=this.parseTextData(r,i.tagname,n,!0,!1,!0,!0);null==a&&(a=""),this.options.cdataPropName?i.add(this.options.cdataPropName,[{[this.options.textNodeName]:r}]):i.add(this.options.textNodeName,a),o=e+2}else{let r=Ce(t,o,this.options.removeNSPrefix),a=r.tagName;const c=r.rawTagName;let u=r.tagExp,l=r.attrExpPresent,d=r.closeIndex;if(this.options.transformTagName){const t=this.options.transformTagName(a);u===a&&(u=t),a=t}i&&s&&"!xml"!==i.tagname&&(s=this.saveTextToParentTag(s,i,n,!1));const f=i;f&&-1!==this.options.unpairedTags.indexOf(f.tagname)&&(i=this.tagsNodeStack.pop(),n=n.substring(0,n.lastIndexOf("."))),a!==e.tagname&&(n+=n?"."+a:a);const p=o;if(this.isItStopNode(this.stopNodesExact,this.stopNodesWildcard,n,a)){let e="";if(u.length>0&&u.lastIndexOf("/")===u.length-1)"/"===a[a.length-1]?(a=a.substr(0,a.length-1),n=n.substr(0,n.length-1),u=a):u=u.substr(0,u.length-1),o=r.closeIndex;else if(-1!==this.options.unpairedTags.indexOf(a))o=r.closeIndex;else{const i=this.readStopNodeData(t,c,d+1);if(!i)throw new Error(`Unexpected end of ${c}`);o=i.i,e=i.tagContent}const s=new de(a);a!==u&&l&&(s[":@"]=this.buildAttributesMap(u,n)),e&&(e=this.parseTextData(e,a,n,!0,l,!0,!0)),n=n.substr(0,n.lastIndexOf(".")),s.add(this.options.textNodeName,e),this.addChild(i,s,n,p)}else{if(u.length>0&&u.lastIndexOf("/")===u.length-1){if("/"===a[a.length-1]?(a=a.substr(0,a.length-1),n=n.substr(0,n.length-1),u=a):u=u.substr(0,u.length-1),this.options.transformTagName){const t=this.options.transformTagName(a);u===a&&(u=t),a=t}const t=new de(a);a!==u&&l&&(t[":@"]=this.buildAttributesMap(u,n)),this.addChild(i,t,n,p),n=n.substr(0,n.lastIndexOf("."))}else{const t=new de(a);this.tagsNodeStack.push(i),a!==u&&l&&(t[":@"]=this.buildAttributesMap(u,n)),this.addChild(i,t,n,p),i=t}s="",o=d}}else s+=t[o]}return e.child};function $e(t,e,i,s){this.options.captureMetaData||(s=void 0);const n=this.options.updateTag(e.tagname,i,e[":@"]);!1===n||("string"==typeof n?(e.tagname=n,t.addChild(e,s)):t.addChild(e,s))}const Re=function(t){if(this.options.processEntities){for(let e in this.docTypeEntities){const i=this.docTypeEntities[e];t=t.replace(i.regx,i.val)}for(let e in this.lastEntities){const i=this.lastEntities[e];t=t.replace(i.regex,i.val)}if(this.options.htmlEntities)for(let e in this.htmlEntities){const i=this.htmlEntities[e];t=t.replace(i.regex,i.val)}t=t.replace(this.ampEntity.regex,this.ampEntity.val)}return t};function De(t,e,i,s){return t&&(void 0===s&&(s=0===e.child.length),void 0!==(t=this.parseTextData(t,e.tagname,i,!1,!!e[":@"]&&0!==Object.keys(e[":@"]).length,s))&&""!==t&&e.add(this.options.textNodeName,t),t=""),t}function Ne(t,e,i,s){return!(!e||!e.has(s))||!(!t||!t.has(i))}function ke(t,e,i,s){const n=t.indexOf(e,i);if(-1===n)throw new Error(s);return n+e.length-1}function Ce(t,e,i,s=">"){const n=function(t,e,i=">"){let s,n="";for(let r=e;r<t.length;r++){let e=t[r];if(s)e===s&&(s="");else if('"'===e||"'"===e)s=e;else if(e===i[0]){if(!i[1])return{data:n,index:r};if(t[r+1]===i[1])return{data:n,index:r}}else"\t"===e&&(e=" ");n+=e}}(t,e+1,s);if(!n)return;let r=n.data;const o=n.index,a=r.search(/\s/);let c=r,u=!0;-1!==a&&(c=r.substring(0,a),r=r.substring(a+1).trimStart());const l=c;if(i){const t=c.indexOf(":");-1!==t&&(c=c.substr(t+1),u=c!==n.data.substr(t+1))}return{tagName:c,tagExp:r,closeIndex:o,attrExpPresent:u,rawTagName:l}}function Oe(t,e,i){const s=i;let n=1;for(;i<t.length;i++)if("<"===t[i])if("/"===t[i+1]){const r=ke(t,">",i,`${e} is not closed`);if(t.substring(i+2,r).trim()===e&&(n--,0===n))return{tagContent:t.substring(s,i),i:r};i=r}else if("?"===t[i+1]){i=ke(t,"?>",i+1,"StopNode is not closed.")}else if("!--"===t.substr(i+1,3)){i=ke(t,"--\x3e",i+3,"StopNode is not closed.")}else if("!["===t.substr(i+1,2)){i=ke(t,"]]>",i,"StopNode is not closed.")-2}else{const s=Ce(t,i,">");if(s){(s&&s.tagName)===e&&"/"!==s.tagExp[s.tagExp.length-1]&&n++,i=s.closeIndex}}}function Fe(t,e,i){if(e&&"string"==typeof t){const e=t.trim();return"true"===e||"false"!==e&&Ee(t,i)}return function(t){return void 0!==t}(t)?t:""}function Me(t,e,i){const s=Number.parseInt(t,e);return s>=0&&s<=1114111?String.fromCodePoint(s):i+t+";"}const Ue=de.getMetaDataSymbol();function je(t,e){return _e(t,e)}function _e(t,e,i){let s;const n={};for(let r=0;r<t.length;r++){const o=t[r],a=We(o);let c="";if(c=void 0===i?a:i+"."+a,a===e.textNodeName)void 0===s?s=o[a]:s+=""+o[a];else{if(void 0===a)continue;if(o[a]){let t=_e(o[a],e,c);const i=ze(t,e);void 0!==o[Ue]&&(t[Ue]=o[Ue]),o[":@"]?Le(t,o[":@"],c,e):1!==Object.keys(t).length||void 0===t[e.textNodeName]||e.alwaysCreateTextNode?0===Object.keys(t).length&&(e.alwaysCreateTextNode?t[e.textNodeName]="":t=""):t=t[e.textNodeName],void 0!==n[a]&&n.hasOwnProperty(a)?(Array.isArray(n[a])||(n[a]=[n[a]]),n[a].push(t)):e.isArray(a,c,i)?n[a]=[t]:n[a]=t}}}return"string"==typeof s?s.length>0&&(n[e.textNodeName]=s):void 0!==s&&(n[e.textNodeName]=s),n}function We(t){const e=Object.keys(t);for(let t=0;t<e.length;t++){const i=e[t];if(":@"!==i)return i}}function Le(t,e,i,s){if(e){const n=Object.keys(e),r=n.length;for(let o=0;o<r;o++){const r=n[o];s.isArray(r,i+"."+r,!0,!0)?t[r]=[e[r]]:t[r]=e[r]}}}function ze(t,e){const{textNodeName:i}=e,s=Object.keys(t).length;return 0===s||!(1!==s||!t[i]&&"boolean"!=typeof t[i]&&0!==t[i])}const Ge={allowBooleanAttributes:!1,unpairedTags:[]};function Ve(t){return" "===t||"\t"===t||"\n"===t||"\r"===t}function Be(t,e){const i=e;for(;e<t.length;e++)if("?"==t[e]||" "==t[e]){const s=t.substr(i,e-i);if(e>5&&"xml"===s)return Je("InvalidXml","XML declaration allowed only at the start of the document.",ti(t,e));if("?"==t[e]&&">"==t[e+1]){e++;break}continue}return e}function qe(t,e){if(t.length>e+5&&"-"===t[e+1]&&"-"===t[e+2]){for(e+=3;e<t.length;e++)if("-"===t[e]&&"-"===t[e+1]&&">"===t[e+2]){e+=2;break}}else if(t.length>e+8&&"D"===t[e+1]&&"O"===t[e+2]&&"C"===t[e+3]&&"T"===t[e+4]&&"Y"===t[e+5]&&"P"===t[e+6]&&"E"===t[e+7]){let i=1;for(e+=8;e<t.length;e++)if("<"===t[e])i++;else if(">"===t[e]&&(i--,0===i))break}else if(t.length>e+9&&"["===t[e+1]&&"C"===t[e+2]&&"D"===t[e+3]&&"A"===t[e+4]&&"T"===t[e+5]&&"A"===t[e+6]&&"["===t[e+7])for(e+=8;e<t.length;e++)if("]"===t[e]&&"]"===t[e+1]&&">"===t[e+2]){e+=2;break}return e}function Ke(t,e){let i="",s="",n=!1;for(;e<t.length;e++){if('"'===t[e]||"'"===t[e])""===s?s=t[e]:s!==t[e]||(s="");else if(">"===t[e]&&""===s){n=!0;break}i+=t[e]}return""===s&&{value:i,index:e,tagClosed:n}}const Ye=new RegExp("(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['\"])(([\\s\\S])*?)\\5)?","g");function He(t,e){const i=ce(t,Ye),s={};for(let t=0;t<i.length;t++){if(0===i[t][1].length)return Je("InvalidAttr","Attribute '"+i[t][2]+"' has no space in starting.",ei(i[t]));if(void 0!==i[t][3]&&void 0===i[t][4])return Je("InvalidAttr","Attribute '"+i[t][2]+"' is without value.",ei(i[t]));if(void 0===i[t][3]&&!e.allowBooleanAttributes)return Je("InvalidAttr","boolean attribute '"+i[t][2]+"' is not allowed.",ei(i[t]));const n=i[t][2];if(!Xe(n))return Je("InvalidAttr","Attribute '"+n+"' is an invalid name.",ei(i[t]));if(s.hasOwnProperty(n))return Je("InvalidAttr","Attribute '"+n+"' is repeated.",ei(i[t]));s[n]=1}return!0}function Qe(t,e){if(";"===t[++e])return-1;if("#"===t[e])return function(t,e){let i=/\d/;for("x"===t[e]&&(e++,i=/[\da-fA-F]/);e<t.length;e++){if(";"===t[e])return e;if(!t[e].match(i))break}return-1}(t,++e);let i=0;for(;e<t.length;e++,i++)if(!(t[e].match(/\w/)&&i<20)){if(";"===t[e])break;return-1}return e}function Je(t,e,i){return{err:{code:t,msg:e,line:i.line||i,col:i.col}}}function Xe(t){return ue(t)}function Ze(t){return ue(t)}function ti(t,e){const i=t.substring(0,e).split(/\r?\n/);return{line:i.length,col:i[i.length-1].length+1}}function ei(t){return t.startIndex+t[1].length}const ii=new class{constructor(t){this.externalEntities={},this.options=function(t){return Object.assign({},re,t)}(t)}parse(t,e){if("string"!=typeof t&&t.toString)t=t.toString();else if("string"!=typeof t)throw new Error("XML data is accepted in String or Bytes[] form.");if(e){!0===e&&(e={});const i=function(t,e){e=Object.assign({},Ge,e);const i=[];let s=!1,n=!1;"\ufeff"===t[0]&&(t=t.substr(1));for(let r=0;r<t.length;r++)if("<"===t[r]&&"?"===t[r+1]){if(r+=2,r=Be(t,r),r.err)return r}else{if("<"!==t[r]){if(Ve(t[r]))continue;return Je("InvalidChar","char '"+t[r]+"' is not expected.",ti(t,r))}{let o=r;if(r++,"!"===t[r]){r=qe(t,r);continue}{let a=!1;"/"===t[r]&&(a=!0,r++);let c="";for(;r<t.length&&">"!==t[r]&&" "!==t[r]&&"\t"!==t[r]&&"\n"!==t[r]&&"\r"!==t[r];r++)c+=t[r];if(c=c.trim(),"/"===c[c.length-1]&&(c=c.substring(0,c.length-1),r--),!Ze(c)){let e;return e=0===c.trim().length?"Invalid space after '<'.":"Tag '"+c+"' is an invalid name.",Je("InvalidTag",e,ti(t,r))}const u=Ke(t,r);if(!1===u)return Je("InvalidAttr","Attributes for '"+c+"' have open quote.",ti(t,r));let l=u.value;if(r=u.index,"/"===l[l.length-1]){const i=r-l.length;l=l.substring(0,l.length-1);const n=He(l,e);if(!0!==n)return Je(n.err.code,n.err.msg,ti(t,i+n.err.line));s=!0}else if(a){if(!u.tagClosed)return Je("InvalidTag","Closing tag '"+c+"' doesn't have proper closing.",ti(t,r));if(l.trim().length>0)return Je("InvalidTag","Closing tag '"+c+"' can't have attributes or invalid starting.",ti(t,o));if(0===i.length)return Je("InvalidTag","Closing tag '"+c+"' has not been opened.",ti(t,o));{const e=i.pop();if(c!==e.tagName){let i=ti(t,e.tagStartPos);return Je("InvalidTag","Expected closing tag '"+e.tagName+"' (opened in line "+i.line+", col "+i.col+") instead of closing tag '"+c+"'.",ti(t,o))}0==i.length&&(n=!0)}}else{const a=He(l,e);if(!0!==a)return Je(a.err.code,a.err.msg,ti(t,r-l.length+a.err.line));if(!0===n)return Je("InvalidXml","Multiple possible root nodes found.",ti(t,r));-1!==e.unpairedTags.indexOf(c)||i.push({tagName:c,tagStartPos:o}),s=!0}for(r++;r<t.length;r++)if("<"===t[r]){if("!"===t[r+1]){r++,r=qe(t,r);continue}if("?"!==t[r+1])break;if(r=Be(t,++r),r.err)return r}else if("&"===t[r]){const e=Qe(t,r);if(-1==e)return Je("InvalidChar","char '&' is not expected.",ti(t,r));r=e}else if(!0===n&&!Ve(t[r]))return Je("InvalidXml","Extra text at the end",ti(t,r));"<"===t[r]&&r--}}}return s?1==i.length?Je("InvalidTag","Unclosed tag '"+i[0].tagName+"'.",ti(t,i[0].tagStartPos)):!(i.length>0)||Je("InvalidXml","Invalid '"+JSON.stringify(i.map(t=>t.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1}):Je("InvalidXml","Start tag expected.",1)}(t,e);if(!0!==i)throw Error(`${i.err.msg}:${i.err.line}:${i.err.col}`)}const i=new ve(this.options);i.addExternalEntities(this.externalEntities);const s=i.parseXml(t);return this.options.preserveOrder||void 0===s?s:je(s,this.options)}addEntity(t,e){if(-1!==e.indexOf("&"))throw new Error("Entity value can't have '&'");if(-1!==t.indexOf("&")||-1!==t.indexOf(";"))throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '&#xD;'");if("&"===e)throw new Error("An entity with value '&' is not permitted");this.externalEntities[t]=e}static getMetaDataSymbol(){return de.getMetaDataSymbol()}}({attributeNamePrefix:"",htmlEntities:!0,ignoreAttributes:!1,ignoreDeclaration:!0,parseTagValue:!1,trimValues:!1,tagValueProcessor:(t,e)=>""===e.trim()&&e.includes("\n")?"":void 0});ii.addEntity("#xD","\r"),ii.addEntity("#10","\n");var si=i(846);const ni=t=>{const e="#text";for(const i in t)t.hasOwnProperty(i)&&void 0!==t[i][e]?t[i]=t[i][e]:"object"==typeof t[i]&&null!==t[i]&&(t[i]=ni(t[i]));return t};var ri=i(113),oi=i(120),ai=i(125);class ci extends oi.B{settings;stringDeserializer;constructor(t){super(),this.settings=t,this.stringDeserializer=new si.k(t)}setSerdeContext(t){this.serdeContext=t,this.stringDeserializer.setSerdeContext(t)}read(t,e,i){const s=se.l.of(t),n=s.getMemberSchemas();if(s.isStructSchema()&&s.isMemberSchema()&&!!Object.values(n).find(t=>!!t.getMemberTraits().eventPayload)){const t={},i=Object.keys(n)[0];return n[i].isBlobSchema()?t[i]=e:t[i]=this.read(n[i],e),t}const r=(this.serdeContext?.utf8Encoder??ri.P)(e),o=this.parseXml(r);return this.readSchema(t,i?o[i]:o)}readSchema(t,e){const i=se.l.of(t);if(i.isUnitSchema())return;const s=i.getMergedTraits();if(i.isListSchema()&&!Array.isArray(e))return this.readSchema(i,[e]);if(null==e)return e;if("object"==typeof e){const t=!!s.sparse,n=!!s.xmlFlattened;if(i.isListSchema()){const s=i.getValueSchema(),r=[],o=s.getMergedTraits().xmlName??"member",a=n?e:(e[0]??e)[o],c=Array.isArray(a)?a:[a];for(const e of c)(null!=e||t)&&r.push(this.readSchema(s,e));return r}const r={};if(i.isMapSchema()){const s=i.getKeySchema(),o=i.getValueSchema();let a;a=n?Array.isArray(e)?e:[e]:Array.isArray(e.entry)?e.entry:[e.entry];const c=s.getMergedTraits().xmlName??"key",u=o.getMergedTraits().xmlName??"value";for(const e of a){const i=e[c],s=e[u];(null!=s||t)&&(r[i]=this.readSchema(o,s))}return r}if(i.isStructSchema()){const t=i.isUnionSchema();let s;t&&(s=new ai.F(e,r));for(const[n,o]of i.structIterator()){const i=o.getMergedTraits(),a=i.httpPayload?i.xmlName??o.getName():o.getMemberTraits().xmlName??n;t&&s.mark(a),null!=e[a]&&(r[n]=this.readSchema(o,e[a]))}return t&&s.writeUnknown(),r}if(i.isDocumentSchema())return e;throw new Error(`@aws-sdk/core/protocols - xml deserializer unhandled schema type for ${i.getName(!0)}`)}return i.isListSchema()?[]:i.isMapSchema()||i.isStructSchema()?{}:this.stringDeserializer.read(i,e)}parseXml(t){if(t.length){let i;try{e=t,i=ii.parse(e,!0)}catch(e){throw e&&"object"==typeof e&&Object.defineProperty(e,"$responseBodyText",{value:t}),e}const s="#text",n=Object.keys(i)[0],r=i[n];return r[s]&&(r[n]=r[s],delete r[s]),ni(r)}var e;return{}}}var ui=i(121),li=i(845),di=i(75),fi=i(124),pi=i(122),hi=i(112);class gi extends oi.B{settings;buffer;constructor(t){super(),this.settings=t}write(t,e,i=""){void 0===this.buffer&&(this.buffer="");const s=se.l.of(t);if(i&&!i.endsWith(".")&&(i+="."),s.isBlobSchema())("string"==typeof e||e instanceof Uint8Array)&&(this.writeKey(i),this.writeValue((this.serdeContext?.base64Encoder??hi.n)(e)));else if(s.isBooleanSchema()||s.isNumericSchema()||s.isStringSchema())null!=e?(this.writeKey(i),this.writeValue(String(e))):s.isIdempotencyToken()&&(this.writeKey(i),this.writeValue((0,di.v4)()));else if(s.isBigIntegerSchema())null!=e&&(this.writeKey(i),this.writeValue(String(e)));else if(s.isBigDecimalSchema())null!=e&&(this.writeKey(i),this.writeValue(e instanceof fi.D?e.string:String(e)));else if(s.isTimestampSchema()){if(e instanceof Date){this.writeKey(i);switch((0,ui.V)(s,this.settings)){case 5:this.writeValue(e.toISOString().replace(".000Z","Z"));break;case 6:this.writeValue((0,pi.JV)(e));break;case 7:this.writeValue(String(e.getTime()/1e3))}}}else if(s.isDocumentSchema())Array.isArray(e)?this.write(79,e,i):e instanceof Date?this.write(4,e,i):e instanceof Uint8Array?this.write(21,e,i):e&&"object"==typeof e?this.write(143,e,i):(this.writeKey(i),this.writeValue(String(e)));else if(s.isListSchema()){if(Array.isArray(e))if(0===e.length)this.settings.serializeEmptyLists&&(this.writeKey(i),this.writeValue(""));else{const t=s.getValueSchema(),n=this.settings.flattenLists||s.getMergedTraits().xmlFlattened;let r=1;for(const s of e){if(null==s)continue;const e=t.getMergedTraits(),o=this.getKey("member",e.xmlName,e.ec2QueryName),a=n?`${i}${r}`:`${i}${o}.${r}`;this.write(t,s,a),++r}}}else if(s.isMapSchema()){if(e&&"object"==typeof e){const t=s.getKeySchema(),n=s.getValueSchema(),r=s.getMergedTraits().xmlFlattened;let o=1;for(const[s,a]of Object.entries(e)){if(null==a)continue;const e=t.getMergedTraits(),c=this.getKey("key",e.xmlName,e.ec2QueryName),u=r?`${i}${o}.${c}`:`${i}entry.${o}.${c}`,l=n.getMergedTraits(),d=this.getKey("value",l.xmlName,l.ec2QueryName),f=r?`${i}${o}.${d}`:`${i}entry.${o}.${d}`;this.write(t,s,u),this.write(n,a,f),++o}}}else if(s.isStructSchema()){if(e&&"object"==typeof e){let t=!1;for(const[n,r]of s.structIterator()){if(null==e[n]&&!r.isIdempotencyToken())continue;const s=r.getMergedTraits(),o=`${i}${this.getKey(n,s.xmlName,s.ec2QueryName,"struct")}`;this.write(r,e[n],o),t=!0}if(!t&&s.isUnionSchema()){const{$unknown:t}=e;if(Array.isArray(t)){const[e,s]=t,n=`${i}${e}`;this.write(15,s,n)}}}}else if(!s.isUnitSchema())throw new Error(`@aws-sdk/core/protocols - QuerySerializer unrecognized schema type ${s.getName(!0)}`)}flush(){if(void 0===this.buffer)throw new Error("@aws-sdk/core/protocols - QuerySerializer cannot flush with nothing written to buffer.");const t=this.buffer;return delete this.buffer,t}getKey(t,e,i,s){const{ec2:n,capitalizeKeys:r}=this.settings;if(n&&i)return i;const o=e??t;return r&&"struct"===s?o[0].toUpperCase()+o.slice(1):o}writeKey(t){t.endsWith(".")&&(t=t.slice(0,t.length-1)),this.buffer+=`&${(0,li.$)(t)}=`}writeValue(t){this.buffer+=(0,li.$)(t)}}class mi extends te.M{options;serializer;deserializer;mixin=new ne.U;constructor(t){super({defaultNamespace:t.defaultNamespace}),this.options=t;const e={timestampFormat:{useTrait:!0,default:5},httpBindings:!1,xmlNamespace:t.xmlNamespace,serviceNamespace:t.defaultNamespace,serializeEmptyLists:!0};this.serializer=new gi(e),this.deserializer=new ci(e)}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,e,i){const s=await super.serializeRequest(t,e,i);s.path.endsWith("/")||(s.path+="/"),Object.assign(s.headers,{"content-type":"application/x-www-form-urlencoded"}),"unit"!==(0,ie.L)(t.input)&&s.body||(s.body="");const n=t.name.split("#")[1]??t.name;return s.body=`Action=${n}&Version=${this.options.version}`+s.body,s.body.endsWith("&")&&(s.body=s.body.slice(-1)),s}async deserializeResponse(t,e,i){const s=this.deserializer,n=se.l.of(t.output),r={};if(i.statusCode>=300){const n=await(0,ee.P)(i.body,e);n.byteLength>0&&Object.assign(r,await s.read(15,n)),await this.handleError(t,e,i,r,this.deserializeMetadata(i))}for(const t in i.headers){const e=i.headers[t];delete i.headers[t],i.headers[t.toLowerCase()]=e}const o=t.name.split("#")[1]??t.name,a=n.isStructSchema()&&this.useNestedResult()?o+"Result":void 0,c=await(0,ee.P)(i.body,e);c.byteLength>0&&Object.assign(r,await s.read(n,c,a));return{$metadata:this.deserializeMetadata(i),...r}}useNestedResult(){return!0}async handleError(t,e,i,s,n){const r=this.loadQueryErrorCode(i,s)??"Unknown",o=this.loadQueryError(s),a=this.loadQueryErrorMessage(s);o.message=a,o.Error={Type:o.Type,Code:o.Code,Message:a};const{errorSchema:c,errorMetadata:u}=await this.mixin.getErrorSchemaOrThrowBaseException(r,this.options.defaultNamespace,i,o,n,this.mixin.findQueryCompatibleError),d=se.l.of(c),f=new(l.O.for(c[1]).getErrorCtor(c)??Error)(a),p={Type:o.Error.Type,Code:o.Error.Code,Error:o.Error};for(const[t,e]of d.structIterator()){const i=e.getMergedTraits().xmlName??t,n=o[i]??s[i];p[t]=this.deserializer.readSchema(e,n)}throw this.mixin.decorateServiceException(Object.assign(f,u,{$fault:d.getMergedTraits().error,message:a},p),s)}loadQueryErrorCode(t,e){const i=(e.Errors?.[0]?.Error??e.Errors?.Error??e.Error)?.Code;return void 0!==i?i:404==t.statusCode?"NotFound":void 0}loadQueryError(t){return t.Errors?.[0]?.Error??t.Errors?.Error??t.Error}loadQueryErrorMessage(t){const e=this.loadQueryError(t);return e?.message??e?.Message??t.message??t.Message??"Unknown"}getDefaultContentType(){return"application/x-www-form-urlencoded"}}var wi=i(74),Si=i(68),Ei=i(111),bi=i(82),vi=i(850),yi=i(127),xi=i(128),Ii=i(39);const Ai="required",Ti="type",Pi="fn",$i="argv",Ri="ref",Di=!1,Ni=!0,ki="booleanEquals",Ci="stringEquals",Oi="sigv4",Fi="us-east-1",Mi="endpoint",Ui="https://sts.{Region}.{PartitionResult#dnsSuffix}",ji="tree",_i="error",Wi="getAttr",Li={[Ai]:!1,[Ti]:"string"},zi={[Ai]:!0,default:!1,[Ti]:"boolean"},Gi={[Ri]:"Endpoint"},Vi={[Pi]:"isSet",[$i]:[{[Ri]:"Region"}]},Bi={[Ri]:"Region"},qi={[Pi]:"aws.partition",[$i]:[Bi],assign:"PartitionResult"},Ki={[Ri]:"UseFIPS"},Yi={[Ri]:"UseDualStack"},Hi={url:"https://sts.amazonaws.com",properties:{authSchemes:[{name:Oi,signingName:"sts",signingRegion:Fi}]},headers:{}},Qi={},Ji={conditions:[{[Pi]:Ci,[$i]:[Bi,"aws-global"]}],[Mi]:Hi,[Ti]:Mi},Xi={[Pi]:ki,[$i]:[Ki,!0]},Zi={[Pi]:ki,[$i]:[Yi,!0]},ts={[Pi]:Wi,[$i]:[{[Ri]:"PartitionResult"},"supportsFIPS"]},es={[Ri]:"PartitionResult"},is={[Pi]:ki,[$i]:[!0,{[Pi]:Wi,[$i]:[es,"supportsDualStack"]}]},ss=[{[Pi]:"isSet",[$i]:[Gi]}],ns=[Xi],rs=[Zi],os={version:"1.0",parameters:{Region:Li,UseDualStack:zi,UseFIPS:zi,Endpoint:Li,UseGlobalEndpoint:zi},rules:[{conditions:[{[Pi]:ki,[$i]:[{[Ri]:"UseGlobalEndpoint"},Ni]},{[Pi]:"not",[$i]:ss},Vi,qi,{[Pi]:ki,[$i]:[Ki,Di]},{[Pi]:ki,[$i]:[Yi,Di]}],rules:[{conditions:[{[Pi]:Ci,[$i]:[Bi,"ap-northeast-1"]}],endpoint:Hi,[Ti]:Mi},{conditions:[{[Pi]:Ci,[$i]:[Bi,"ap-south-1"]}],endpoint:Hi,[Ti]:Mi},{conditions:[{[Pi]:Ci,[$i]:[Bi,"ap-southeast-1"]}],endpoint:Hi,[Ti]:Mi},{conditions:[{[Pi]:Ci,[$i]:[Bi,"ap-southeast-2"]}],endpoint:Hi,[Ti]:Mi},Ji,{conditions:[{[Pi]:Ci,[$i]:[Bi,"ca-central-1"]}],endpoint:Hi,[Ti]:Mi},{conditions:[{[Pi]:Ci,[$i]:[Bi,"eu-central-1"]}],endpoint:Hi,[Ti]:Mi},{conditions:[{[Pi]:Ci,[$i]:[Bi,"eu-north-1"]}],endpoint:Hi,[Ti]:Mi},{conditions:[{[Pi]:Ci,[$i]:[Bi,"eu-west-1"]}],endpoint:Hi,[Ti]:Mi},{conditions:[{[Pi]:Ci,[$i]:[Bi,"eu-west-2"]}],endpoint:Hi,[Ti]:Mi},{conditions:[{[Pi]:Ci,[$i]:[Bi,"eu-west-3"]}],endpoint:Hi,[Ti]:Mi},{conditions:[{[Pi]:Ci,[$i]:[Bi,"sa-east-1"]}],endpoint:Hi,[Ti]:Mi},{conditions:[{[Pi]:Ci,[$i]:[Bi,Fi]}],endpoint:Hi,[Ti]:Mi},{conditions:[{[Pi]:Ci,[$i]:[Bi,"us-east-2"]}],endpoint:Hi,[Ti]:Mi},{conditions:[{[Pi]:Ci,[$i]:[Bi,"us-west-1"]}],endpoint:Hi,[Ti]:Mi},{conditions:[{[Pi]:Ci,[$i]:[Bi,"us-west-2"]}],endpoint:Hi,[Ti]:Mi},{endpoint:{url:Ui,properties:{authSchemes:[{name:Oi,signingName:"sts",signingRegion:"{Region}"}]},headers:Qi},[Ti]:Mi}],[Ti]:ji},{conditions:ss,rules:[{conditions:ns,error:"Invalid Configuration: FIPS and custom endpoint are not supported",[Ti]:_i},{conditions:rs,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",[Ti]:_i},{endpoint:{url:Gi,properties:Qi,headers:Qi},[Ti]:Mi}],[Ti]:ji},{conditions:[Vi],rules:[{conditions:[qi],rules:[{conditions:[Xi,Zi],rules:[{conditions:[{[Pi]:ki,[$i]:[Ni,ts]},is],rules:[{endpoint:{url:"https://sts-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:Qi,headers:Qi},[Ti]:Mi}],[Ti]:ji},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",[Ti]:_i}],[Ti]:ji},{conditions:ns,rules:[{conditions:[{[Pi]:ki,[$i]:[ts,Ni]}],rules:[{conditions:[{[Pi]:Ci,[$i]:[{[Pi]:Wi,[$i]:[es,"name"]},"aws-us-gov"]}],endpoint:{url:"https://sts.{Region}.amazonaws.com",properties:Qi,headers:Qi},[Ti]:Mi},{endpoint:{url:"https://sts-fips.{Region}.{PartitionResult#dnsSuffix}",properties:Qi,headers:Qi},[Ti]:Mi}],[Ti]:ji},{error:"FIPS is enabled but this partition does not support FIPS",[Ti]:_i}],[Ti]:ji},{conditions:rs,rules:[{conditions:[is],rules:[{endpoint:{url:"https://sts.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:Qi,headers:Qi},[Ti]:Mi}],[Ti]:ji},{error:"DualStack is enabled but this partition does not support DualStack",[Ti]:_i}],[Ti]:ji},Ji,{endpoint:{url:Ui,properties:Qi,headers:Qi},[Ti]:Mi}],[Ti]:ji}],[Ti]:ji},{error:"Invalid Configuration: Missing Region",[Ti]:_i}]},as=new yi.k({size:50,params:["Endpoint","Region","UseDualStack","UseFIPS","UseGlobalEndpoint"]}),cs=(t,e={})=>as.get(t,()=>(0,xi.s)(os,{endpointParams:t,logger:e.logger}));Ii.m.aws=vi.UF;const us=t=>{(0,Ht.I)(process.version);const e=(0,Xt.I)(t),i=()=>e().then(Qt.l),s=(t=>({apiVersion:"2011-06-15",base64Decoder:t?.base64Decoder??Ei.E,base64Encoder:t?.base64Encoder??hi.n,disableHostPrefix:t?.disableHostPrefix??!1,endpointProvider:t?.endpointProvider??cs,extensions:t?.extensions??[],httpAuthSchemeProvider:t?.httpAuthSchemeProvider??Ft,httpAuthSchemes:t?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:t=>t.getIdentityProvider("aws.auth#sigv4"),signer:new Wt.f2},{schemeId:"smithy.api#noAuth",identityProvider:t=>t.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new Bt.m}],logger:t?.logger??new wi.N,protocol:t?.protocol??mi,protocolSettings:t?.protocolSettings??{defaultNamespace:"com.amazonaws.sts",errorTypeRegistries:q,xmlNamespace:"https://sts.amazonaws.com/doc/2011-06-15/",version:"2011-06-15",serviceTarget:"AWSSecurityTokenServiceV20110615"},serviceId:t?.serviceId??"STS",urlParser:t?.urlParser??Si.D,utf8Decoder:t?.utf8Decoder??bi.a,utf8Encoder:t?.utf8Encoder??ri.P}))(t);(0,jt.I)(process.version);const o={profile:t?.profile,logger:s.logger};return{...s,...t,runtime:"node",defaultsMode:e,authSchemePreference:t?.authSchemePreference??(0,r.Z)(_t.$,o),bodyLengthChecker:t?.bodyLengthChecker??Jt.n,defaultUserAgentProvider:t?.defaultUserAgentProvider??(0,Lt.pf)({serviceId:s.serviceId,clientVersion:Ut.rE}),httpAuthSchemes:t?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4")||(async e=>await t.credentialDefaultProvider(e?.p||{})()),signer:new Wt.f2},{schemeId:"smithy.api#noAuth",identityProvider:t=>t.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new Bt.m}],maxAttempts:t?.maxAttempts??(0,r.Z)($t.qs,t),region:t?.region??(0,r.Z)(n.GG,{...n.zH,...o}),requestHandler:Kt.$.create(t?.requestHandler??i),retryMode:t?.retryMode??(0,r.Z)({...$t.kN,default:async()=>(await i()).retryMode||Zt.L0},t),sha256:t?.sha256??qt.V.bind(null,"sha256"),streamCollector:t?.streamCollector??Yt.k,useDualstackEndpoint:t?.useDualstackEndpoint??(0,r.Z)(Gt.e$,o),useFipsEndpoint:t?.useFipsEndpoint??(0,r.Z)(Vt.Ko,o),userAgentAppId:t?.userAgentAppId??(0,r.Z)(zt.hV,o)}};var ls=i(129),ds=i(130),fs=i(131);class ps extends Dt.K{config;constructor(...[t]){const e=us(t||{});super(e),this.initConfig=e;const i=(s=e,Object.assign(s,{useDualstackEndpoint:s.useDualstackEndpoint??!1,useFipsEndpoint:s.useFipsEndpoint??!1,useGlobalEndpoint:s.useGlobalEndpoint??!1,defaultSigningName:"sts"}));var s;const n=(0,Et.D)(i),r=(0,$t.$z)(n),o=(0,vt.T)(r),a=(0,mt.OV)(o),c=(0,Pt.C)(a),u=((t,e)=>{const i=Object.assign((0,ls.R)(t),(0,fs.xA)(t),(0,ds.e)(t),(t=>{const e=t.httpAuthSchemes;let i=t.httpAuthSchemeProvider,s=t.credentials;return{setHttpAuthScheme(t){const i=e.findIndex(e=>e.schemeId===t.schemeId);-1===i?e.push(t):e.splice(i,1,t)},httpAuthSchemes:()=>e,setHttpAuthSchemeProvider(t){i=t},httpAuthSchemeProvider:()=>i,setCredentials(t){s=t},credentials:()=>s}})(t));return e.forEach(t=>t.configure(i)),Object.assign(t,(0,ls.$)(i),(0,fs.uv)(i),(0,ds.j)(i),{httpAuthSchemes:(s=i).httpAuthSchemes(),httpAuthSchemeProvider:s.httpAuthSchemeProvider(),credentials:s.credentials()});var s})(Mt(c),t?.extensions||[]);this.config=u,this.middlewareStack.use((0,At.wq)(this.config)),this.middlewareStack.use((0,bt.sM)(this.config)),this.middlewareStack.use((0,Rt.ey)(this.config)),this.middlewareStack.use((0,Tt.vK)(this.config)),this.middlewareStack.use((0,mt.TC)(this.config)),this.middlewareStack.use((0,wt.Y7)(this.config)),this.middlewareStack.use((0,St.n)(this.config)),this.middlewareStack.use((0,yt.w)(this.config,{httpAuthSchemeParametersProvider:Ot,identityProviderConfigProvider:async t=>new xt.h({"aws.auth#sigv4":t.credentials})})),this.middlewareStack.use((0,It.l)(this.config))}destroy(){super.destroy()}}const hs=(t,e)=>e?class extends t{constructor(t){super(t);for(const t of e)this.middlewareStack.use(t)}}:t,gs=(t={},e)=>pt(t,hs(ps,e)),ms=(t={},e)=>ht(t,hs(ps,e))},850(t,e,i){i.d(e,{UF:()=>c});var s=i(39),n=i(40),r=i(41);const o=(t,e=!1)=>{if(e){for(const e of t.split("."))if(!o(e))return!1;return!0}return!!(0,n.X)(t)&&(!(t.length<3||t.length>63)&&(t===t.toLowerCase()&&!(0,r.o)(t)))};let a=JSON.parse('{"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"}');const c={isVirtualHostableS3Bucket:o,parseArn:t=>{const e=t.split(":");if(e.length<6)return null;const[i,s,n,r,o,...a]=e;if("arn"!==i||""===s||""===n||""===a.join(":"))return null;return{partition:s,service:n,region:r,accountId:o,resourceId:a.map(t=>t.split("/")).flat()}},partition:t=>{const{partitions:e}=a;for(const i of e){const{regions:e,outputs:s}=i;for(const[i,n]of Object.entries(e))if(i===t)return{...s,...n}}for(const i of e){const{regionRegex:e,outputs:s}=i;if(new RegExp(e).test(t))return{...s}}const i=e.find(t=>"aws"===t.id);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}}};s.m.aws=c},845(t,e,i){function s(t){return encodeURIComponent(t).replace(/[!'()*]/g,function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()})}i.d(e,{$:()=>s})},846(t,e,i){i.d(e,{k:()=>y});var s=i(107),n=i(844);const r="(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun)(?:[ne|u?r]?s?day)?",o="(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)",a="(\\d?\\d):(\\d{2}):(\\d{2})(?:\\.(\\d+))?",c="(\\d?\\d)",u="(\\d{4})",l=new RegExp(/^(\d{4})-(\d\d)-(\d\d)[tT](\d\d):(\d\d):(\d\d)(\.(\d+))?(([-+]\d\d:\d\d)|[zZ])$/),d=new RegExp(`^${r}, ${c} ${o} ${u} ${a} GMT$`),f=new RegExp(`^${r}, ${c}-${o}-(\\d\\d) ${a} GMT$`),p=new RegExp(`^${r} ${o} ( [1-9]|\\d\\d) ${a} ${u}$`),h=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function g(t,e,i){const s=Number(t);if(s<e||s>i)throw new Error(`Value ${s} out of range [${e}, ${i}]`)}var m=i(123),w=i(124),S=i(111),E=i(113),b=i(116),v=i(121);class y extends b.f{settings;constructor(t){super(),this.settings=t}read(t,e){const i=s.l.of(t);if(i.isListSchema())return(0,n.G)(e).map(t=>this.read(i.getValueSchema(),t));if(i.isBlobSchema())return(this.serdeContext?.base64Decoder??S.E)(e);if(i.isTimestampSchema()){switch((0,v.V)(i,this.settings)){case 5:return(t=>{if(null==t)return;if("string"!=typeof t)throw new TypeError("RFC3339 timestamps must be strings");const e=l.exec(t);if(!e)throw new TypeError(`Invalid RFC3339 timestamp format ${t}`);const[,i,s,n,r,o,a,,c,u]=e;g(s,1,12),g(n,1,31),g(r,0,23),g(o,0,59),g(a,0,60);const d=new Date(Date.UTC(Number(i),Number(s)-1,Number(n),Number(r),Number(o),Number(a),Number(c)?Math.round(1e3*parseFloat(`0.${c}`)):0));if(d.setUTCFullYear(Number(i)),"Z"!=u.toUpperCase()){const[,t,e,i]=/([+-])(\d\d):(\d\d)/.exec(u)||[void 0,"+",0,0],s="-"===t?1:-1;d.setTime(d.getTime()+s*(60*Number(e)*60*1e3+60*Number(i)*1e3))}return d})(e);case 6:return(t=>{if(null==t)return;if("string"!=typeof t)throw new TypeError("RFC7231 timestamps must be strings.");let e,i,s,n,r,o,a,c;if((c=d.exec(t))?[,e,i,s,n,r,o,a]=c:(c=f.exec(t))?([,e,i,s,n,r,o,a]=c,s=(Number(s)+1900).toString()):(c=p.exec(t))&&([,i,e,n,r,o,a,s]=c),s&&o){const t=Date.UTC(Number(s),h.indexOf(i),Number(e),Number(n),Number(r),Number(o),a?Math.round(1e3*parseFloat(`0.${a}`)):0);g(e,1,31),g(n,0,23),g(r,0,59),g(o,0,60);const c=new Date(t);return c.setUTCFullYear(Number(s)),c}throw new TypeError(`Invalid RFC7231 date-time value ${t}.`)})(e);case 7:return(t=>{if(null==t)return;let e=NaN;if("number"==typeof t)e=t;else if("string"==typeof t){if(!/^-?\d*\.?\d+$/.test(t))throw new TypeError("parseEpochTimestamp - numeric string invalid.");e=Number.parseFloat(t)}else"object"==typeof t&&1===t.tag&&(e=t.value);if(isNaN(e)||Math.abs(e)===1/0)throw new TypeError("Epoch timestamps must be valid finite numbers.");return new Date(Math.round(1e3*e))})(e);default:return console.warn("Missing timestamp format, parsing value with Date constructor:",e),new Date(e)}}if(i.isStringSchema()){const t=i.getMergedTraits().mediaType;let s=e;if(t){i.getMergedTraits().httpHeader&&(s=this.base64ToUtf8(s));return("application/json"===t||t.endsWith("+json"))&&(s=m.A.from(s)),s}}return i.isNumericSchema()?Number(e):i.isBigIntegerSchema()?BigInt(e):i.isBigDecimalSchema()?new w.D(e,"bigDecimal"):i.isBooleanSchema()?"true"===String(e).toLowerCase():e}base64ToUtf8(t){return(this.serdeContext?.utf8Encoder??E.P)((this.serdeContext?.base64Decoder??S.E)(t))}}},844(t,e,i){i.d(e,{G:()=>s});const s=t=>{const e=t.length,i=[];let s,n=!1,r=0;for(let o=0;o<e;++o){const e=t[o];switch(e){case'"':"\\"!==s&&(n=!n);break;case",":n||(i.push(t.slice(r,o)),r=o+1)}s=e}return i.push(t.slice(r)),i.map(t=>{const e=(t=t.trim()).length;return e<2?t:('"'===t[0]&&'"'===t[e-1]&&(t=t.slice(1,e-1)),t.replace(/\\"/g,'"'))})}},847(t,e,i){i.d(e,{m:()=>s});class s{async sign(t,e,i){return t}}},849(t){t.exports={rE:"3.990.0"}}};
2
+ "use strict";exports.id=827,exports.ids=[827],exports.modules={851(t,e,n){n.d(e,{getDefaultRoleAssumer:()=>Ei,getDefaultRoleAssumerWithWebIdentity:()=>yi});var i=n(80),r=n(93),s=n(55);const o={silence:!1};var a=n(133),c=n(134);const u={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 l=n(116),d=n(119);class f extends d.T{constructor(t){super(t),Object.setPrototypeOf(this,f.prototype)}}class h extends f{name="ExpiredTokenException";$fault="client";constructor(t){super({name:"ExpiredTokenException",$fault:"client",...t}),Object.setPrototypeOf(this,h.prototype)}}class p extends f{name="MalformedPolicyDocumentException";$fault="client";constructor(t){super({name:"MalformedPolicyDocumentException",$fault:"client",...t}),Object.setPrototypeOf(this,p.prototype)}}class m extends f{name="PackedPolicyTooLargeException";$fault="client";constructor(t){super({name:"PackedPolicyTooLargeException",$fault:"client",...t}),Object.setPrototypeOf(this,m.prototype)}}class g extends f{name="RegionDisabledException";$fault="client";constructor(t){super({name:"RegionDisabledException",$fault:"client",...t}),Object.setPrototypeOf(this,g.prototype)}}class w extends f{name="IDPRejectedClaimException";$fault="client";constructor(t){super({name:"IDPRejectedClaimException",$fault:"client",...t}),Object.setPrototypeOf(this,w.prototype)}}class E extends f{name="InvalidIdentityTokenException";$fault="client";constructor(t){super({name:"InvalidIdentityTokenException",$fault:"client",...t}),Object.setPrototypeOf(this,E.prototype)}}class y extends f{name="IDPCommunicationErrorException";$fault="client";constructor(t){super({name:"IDPCommunicationErrorException",$fault:"client",...t}),Object.setPrototypeOf(this,y.prototype)}}const x="AssumedRoleUser",v="Credentials",b="DurationSeconds",S="Policy",I="PolicyArns",T="PackedPolicySize",A="RoleArn",$="RoleSessionName",P="SourceIdentity",N="awsQueryError",D="client",R="error",C="httpError",k="message",O="smithy.ts.sdk.synthetic.com.amazonaws.sts",F="com.amazonaws.sts",j=l.O.for(O);var M=[-3,O,"STSServiceException",0,[],[]];j.registerError(M,f);const _=l.O.for(F);var U=[-3,F,"ExpiredTokenException",{[N]:["ExpiredTokenException",400],[R]:D,[C]:400},[k],[0]];_.registerError(U,h);var L=[-3,F,"IDPCommunicationErrorException",{[N]:["IDPCommunicationError",400],[R]:D,[C]:400},[k],[0]];_.registerError(L,y);var z=[-3,F,"IDPRejectedClaimException",{[N]:["IDPRejectedClaim",403],[R]:D,[C]:403},[k],[0]];_.registerError(z,w);var W=[-3,F,"InvalidIdentityTokenException",{[N]:["InvalidIdentityToken",400],[R]:D,[C]:400},[k],[0]];_.registerError(W,E);var V=[-3,F,"MalformedPolicyDocumentException",{[N]:["MalformedPolicyDocument",400],[R]:D,[C]:400},[k],[0]];_.registerError(V,p);var q=[-3,F,"PackedPolicyTooLargeException",{[N]:["PackedPolicyTooLarge",400],[R]:D,[C]:400},[k],[0]];_.registerError(q,m);var K=[-3,F,"RegionDisabledException",{[N]:["RegionDisabledException",403],[R]:D,[C]:403},[k],[0]];_.registerError(K,g);const Y=[j,_];var B=[0,F,"accessKeySecretType",8,0],G=[0,F,"clientTokenType",8,0],Q=[3,F,x,0,["AssumedRoleId","Arn"],[0,0],2],X=[3,F,"AssumeRoleRequest",0,[A,$,I,S,b,"Tags","TransitiveTagKeys","ExternalId","SerialNumber","TokenCode",P,"ProvidedContexts"],[0,0,()=>rt,0,1,()=>ot,64,0,0,0,0,()=>st],2],H=[3,F,"AssumeRoleResponse",0,[v,x,T,P],[[()=>tt,0],()=>Q,1,0]],J=[3,F,"AssumeRoleWithWebIdentityRequest",0,[A,$,"WebIdentityToken","ProviderId",I,S,b],[0,0,[()=>G,0],0,()=>rt,0,1],3],Z=[3,F,"AssumeRoleWithWebIdentityResponse",0,[v,"SubjectFromWebIdentityToken",x,T,"Provider","Audience",P],[[()=>tt,0],0,()=>Q,1,0,0,0]],tt=[3,F,v,0,["AccessKeyId","SecretAccessKey","SessionToken","Expiration"],[0,[()=>B,0],0,4],4],et=[3,F,"PolicyDescriptorType",0,["arn"],[0]],nt=[3,F,"ProvidedContext",0,["ProviderArn","ContextAssertion"],[0,0]],it=[3,F,"Tag",0,["Key","Value"],[0,0],2],rt=[1,F,"policyDescriptorListType",0,()=>et],st=[1,F,"ProvidedContextsListType",0,()=>nt],ot=[1,F,"tagListType",0,()=>it],at=[9,F,"AssumeRole",0,()=>X,()=>H],ct=[9,F,"AssumeRoleWithWebIdentity",0,()=>J,()=>Z];class ut extends(c.u.classBuilder().ep(u).m(function(t,e,n,i){return[(0,a.r)(n,t.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","AssumeRole",{}).n("STSClient","AssumeRoleCommand").sc(at).build()){}class lt extends(c.u.classBuilder().ep(u).m(function(t,e,n,i){return[(0,a.r)(n,t.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","AssumeRoleWithWebIdentity",{}).n("STSClient","AssumeRoleWithWebIdentityCommand").sc(ct).build()){}const dt=t=>{if("string"==typeof t?.Arn){const e=t.Arn.split(":");if(e.length>4&&""!==e[4])return e[4]}},ft=async(t,e,n,i={})=>{const a="function"==typeof t?await t():t,c="function"==typeof e?await e():e;let u="";const l=a??c??(u=await function(t={}){return(0,s.Z)({...r.GG,default:async()=>(o.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."),"us-east-1")},{...r.zH,...t})}(i)());return n?.debug?.("@aws-sdk/client-sts::resolveRegion","accepting first of:",`${a} (credential provider clientConfig)`,`${c} (contextual client)`,`${u} (STS default: AWS_REGION, profile region, or us-east-1)`),l},ht=(t,e)=>{let n,r;return async(s,o)=>{if(r=s,!n){const{logger:i=t?.parentClientConfig?.logger,profile:s=t?.parentClientConfig?.profile,region:o,requestHandler:a=t?.parentClientConfig?.requestHandler,credentialProviderLogger:c,userAgentAppId:u=t?.parentClientConfig?.userAgentAppId}=t,l=await ft(o,t?.parentClientConfig?.region,c,{logger:i,profile:s}),d=!mt(a);n=new e({...t,userAgentAppId:u,profile:s,credentialDefaultProvider:()=>async()=>r,region:l,requestHandler:d?a:void 0,logger:i})}const{Credentials:a,AssumedRoleUser:c}=await n.send(new ut(o));if(!a||!a.AccessKeyId||!a.SecretAccessKey)throw new Error(`Invalid response from STS.assumeRole call with role ${o.RoleArn}`);const u=dt(c),l={accessKeyId:a.AccessKeyId,secretAccessKey:a.SecretAccessKey,sessionToken:a.SessionToken,expiration:a.Expiration,...a.CredentialScope&&{credentialScope:a.CredentialScope},...u&&{accountId:u}};return(0,i.g)(l,"CREDENTIALS_STS_ASSUME_ROLE","i"),l}},pt=(t,e)=>{let n;return async r=>{if(!n){const{logger:i=t?.parentClientConfig?.logger,profile:r=t?.parentClientConfig?.profile,region:s,requestHandler:o=t?.parentClientConfig?.requestHandler,credentialProviderLogger:a,userAgentAppId:c=t?.parentClientConfig?.userAgentAppId}=t,u=await ft(s,t?.parentClientConfig?.region,a,{logger:i,profile:r}),l=!mt(o);n=new e({...t,userAgentAppId:c,profile:r,region:u,requestHandler:l?o:void 0,logger:i})}const{Credentials:s,AssumedRoleUser:o}=await n.send(new lt(r));if(!s||!s.AccessKeyId||!s.SecretAccessKey)throw new Error(`Invalid response from STS.assumeRoleWithWebIdentity call with role ${r.RoleArn}`);const a=dt(o),c={accessKeyId:s.AccessKeyId,secretAccessKey:s.SecretAccessKey,sessionToken:s.SessionToken,expiration:s.Expiration,...s.CredentialScope&&{credentialScope:s.CredentialScope},...a&&{accountId:a}};return a&&(0,i.g)(c,"RESOLVED_ACCOUNT_ID","T"),(0,i.g)(c,"CREDENTIALS_STS_ASSUME_ROLE_WEB_ID","k"),c}},mt=t=>"h2"===t?.metadata?.handlerProtocol;var gt=n(32),wt=n(34),Et=n(35),yt=n(36),xt=n(38),vt=n(43),bt=n(45),St=n(44),It=n(48),Tt=n(49),At=n(51),$t=n(52),Pt=n(70),Nt=n(74),Dt=n(77),Rt=n(79),Ct=n(46),kt=n(53);const Ot=async(t,e,n)=>({operation:(0,Ct.u)(e).operation,region:await(0,kt.t)(t.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});const Ft=t=>{const e=[];if("AssumeRoleWithWebIdentity"===t.operation)e.push({schemeId:"smithy.api#noAuth"});else e.push(function(t){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"sts",region:t.region},propertiesExtractor:(t,e)=>({signingProperties:{config:t,context:e}})}}(t));return e},jt=t=>{const e=(n=t,Object.assign(n,{stsClientCtor:gi}));var n;const i=(0,Rt.h)(e);return Object.assign(i,{authSchemePreference:(0,kt.t)(t.authSchemePreference??[])})};var Mt=n(850),_t=n(87),Ut=n(88),Lt=n(106),zt=n(90),Wt=n(92),Vt=n(94),qt=n(97),Kt=n(848),Yt=n(98),Bt=n(99),Gt=n(100),Qt=n(102),Xt=n(101),Ht=n(103),Jt=n(105),Zt=n(71),te=n(107),ee=n(111),ne=n(109),ie=n(108),re=n(118);const se={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(t,e,n){return t},captureMetaData:!1};function oe(t){return"boolean"==typeof t?{enabled:t,maxEntitySize:1e4,maxExpansionDepth:10,maxTotalExpansions:1e3,maxExpandedLength:1e5,allowedTags:null,tagFilter:null}:"object"==typeof t&&null!==t?{enabled:!1!==t.enabled,maxEntitySize:t.maxEntitySize??1e4,maxExpansionDepth:t.maxExpansionDepth??10,maxTotalExpansions:t.maxTotalExpansions??1e3,maxExpandedLength:t.maxExpandedLength??1e5,allowedTags:t.allowedTags??null,tagFilter:t.tagFilter??null}:oe(!0)}const ae=function(t){const e=Object.assign({},se,t);return e.processEntities=oe(e.processEntities),e},ce=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",ue=new RegExp("^"+("["+ce+"]["+(ce+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040")+"]*")+"$");function le(t,e){const n=[];let i=e.exec(t);for(;i;){const r=[];r.startIndex=e.lastIndex-i[0].length;const s=i.length;for(let t=0;t<s;t++)r.push(i[t]);n.push(r),i=e.exec(t)}return n}const de=function(t){const e=ue.exec(t);return!(null==e)};let fe;fe="function"!=typeof Symbol?"@@xmlMetadata":Symbol("XML Node Metadata");class he{constructor(t){this.tagname=t,this.child=[],this[":@"]={}}add(t,e){"__proto__"===t&&(t="#__proto__"),this.child.push({[t]:e})}addChild(t,e){"__proto__"===t.tagname&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child}),void 0!==e&&(this.child[this.child.length-1][fe]={startIndex:e})}static getMetaDataSymbol(){return fe}}class pe{constructor(t){this.suppressValidationErr=!t,this.options=t}readDocType(t,e){const n={};if("O"!==t[e+3]||"C"!==t[e+4]||"T"!==t[e+5]||"Y"!==t[e+6]||"P"!==t[e+7]||"E"!==t[e+8])throw new Error("Invalid Tag instead of DOCTYPE");{e+=9;let i=1,r=!1,s=!1,o="";for(;e<t.length;e++)if("<"!==t[e]||s)if(">"===t[e]){if(s?"-"===t[e-1]&&"-"===t[e-2]&&(s=!1,i--):i--,0===i)break}else"["===t[e]?r=!0:o+=t[e];else{if(r&&ge(t,"!ENTITY",e)){let i,r;if(e+=7,[i,r,e]=this.readEntityExp(t,e+1,this.suppressValidationErr),-1===r.indexOf("&")){const t=i.replace(/[.\-+*:]/g,"\\.");n[i]={regx:RegExp(`&${t};`,"g"),val:r}}}else if(r&&ge(t,"!ELEMENT",e)){e+=8;const{index:n}=this.readElementExp(t,e+1);e=n}else if(r&&ge(t,"!ATTLIST",e))e+=8;else if(r&&ge(t,"!NOTATION",e)){e+=9;const{index:n}=this.readNotationExp(t,e+1,this.suppressValidationErr);e=n}else{if(!ge(t,"!--",e))throw new Error("Invalid DOCTYPE");s=!0}i++,o=""}if(0!==i)throw new Error("Unclosed DOCTYPE")}return{entities:n,i:e}}readEntityExp(t,e){e=me(t,e);let n="";for(;e<t.length&&!/\s/.test(t[e])&&'"'!==t[e]&&"'"!==t[e];)n+=t[e],e++;if(we(n),e=me(t,e),!this.suppressValidationErr){if("SYSTEM"===t.substring(e,e+6).toUpperCase())throw new Error("External entities are not supported");if("%"===t[e])throw new Error("Parameter entities are not supported")}let i="";if([e,i]=this.readIdentifierVal(t,e,"entity"),!1!==this.options.enabled&&this.options.maxEntitySize&&i.length>this.options.maxEntitySize)throw new Error(`Entity "${n}" size (${i.length}) exceeds maximum allowed size (${this.options.maxEntitySize})`);return[n,i,--e]}readNotationExp(t,e){e=me(t,e);let n="";for(;e<t.length&&!/\s/.test(t[e]);)n+=t[e],e++;!this.suppressValidationErr&&we(n),e=me(t,e);const i=t.substring(e,e+6).toUpperCase();if(!this.suppressValidationErr&&"SYSTEM"!==i&&"PUBLIC"!==i)throw new Error(`Expected SYSTEM or PUBLIC, found "${i}"`);e+=i.length,e=me(t,e);let r=null,s=null;if("PUBLIC"===i)[e,r]=this.readIdentifierVal(t,e,"publicIdentifier"),'"'!==t[e=me(t,e)]&&"'"!==t[e]||([e,s]=this.readIdentifierVal(t,e,"systemIdentifier"));else if("SYSTEM"===i&&([e,s]=this.readIdentifierVal(t,e,"systemIdentifier"),!this.suppressValidationErr&&!s))throw new Error("Missing mandatory system identifier for SYSTEM notation");return{notationName:n,publicIdentifier:r,systemIdentifier:s,index:--e}}readIdentifierVal(t,e,n){let i="";const r=t[e];if('"'!==r&&"'"!==r)throw new Error(`Expected quoted string, found "${r}"`);for(e++;e<t.length&&t[e]!==r;)i+=t[e],e++;if(t[e]!==r)throw new Error(`Unterminated ${n} value`);return[++e,i]}readElementExp(t,e){e=me(t,e);let n="";for(;e<t.length&&!/\s/.test(t[e]);)n+=t[e],e++;if(!this.suppressValidationErr&&!de(n))throw new Error(`Invalid element name: "${n}"`);let i="";if("E"===t[e=me(t,e)]&&ge(t,"MPTY",e))e+=4;else if("A"===t[e]&&ge(t,"NY",e))e+=2;else if("("===t[e]){for(e++;e<t.length&&")"!==t[e];)i+=t[e],e++;if(")"!==t[e])throw new Error("Unterminated content model")}else if(!this.suppressValidationErr)throw new Error(`Invalid Element Expression, found "${t[e]}"`);return{elementName:n,contentModel:i.trim(),index:e}}readAttlistExp(t,e){e=me(t,e);let n="";for(;e<t.length&&!/\s/.test(t[e]);)n+=t[e],e++;we(n),e=me(t,e);let i="";for(;e<t.length&&!/\s/.test(t[e]);)i+=t[e],e++;if(!we(i))throw new Error(`Invalid attribute name: "${i}"`);e=me(t,e);let r="";if("NOTATION"===t.substring(e,e+8).toUpperCase()){if(r="NOTATION","("!==t[e=me(t,e+=8)])throw new Error(`Expected '(', found "${t[e]}"`);e++;let n=[];for(;e<t.length&&")"!==t[e];){let i="";for(;e<t.length&&"|"!==t[e]&&")"!==t[e];)i+=t[e],e++;if(i=i.trim(),!we(i))throw new Error(`Invalid notation name: "${i}"`);n.push(i),"|"===t[e]&&(e++,e=me(t,e))}if(")"!==t[e])throw new Error("Unterminated list of notations");e++,r+=" ("+n.join("|")+")"}else{for(;e<t.length&&!/\s/.test(t[e]);)r+=t[e],e++;const n=["CDATA","ID","IDREF","IDREFS","ENTITY","ENTITIES","NMTOKEN","NMTOKENS"];if(!this.suppressValidationErr&&!n.includes(r.toUpperCase()))throw new Error(`Invalid attribute type: "${r}"`)}e=me(t,e);let s="";return"#REQUIRED"===t.substring(e,e+8).toUpperCase()?(s="#REQUIRED",e+=8):"#IMPLIED"===t.substring(e,e+7).toUpperCase()?(s="#IMPLIED",e+=7):[e,s]=this.readIdentifierVal(t,e,"ATTLIST"),{elementName:n,attributeName:i,attributeType:r,defaultValue:s,index:e}}}const me=(t,e)=>{for(;e<t.length&&/\s/.test(t[e]);)e++;return e};function ge(t,e,n){for(let i=0;i<e.length;i++)if(e[i]!==t[n+i+1])return!1;return!0}function we(t){if(de(t))return t;throw new Error(`Invalid entity name ${t}`)}const Ee=/^[-+]?0x[a-fA-F0-9]+$/,ye=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,xe={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function ve(t,e={}){if(e=Object.assign({},xe,e),!t||"string"!=typeof t)return t;let n=t.trim();if(void 0!==e.skipLike&&e.skipLike.test(n))return t;if("0"===t)return 0;if(e.hex&&Ee.test(n))return function(t,e){if(parseInt)return parseInt(t,e);if(Number.parseInt)return Number.parseInt(t,e);if(window&&window.parseInt)return window.parseInt(t,e);throw new Error("parseInt, Number.parseInt, window.parseInt are not supported")}(n,16);if(n.includes("e")||n.includes("E"))return function(t,e,n){if(!n.eNotation)return t;const i=e.match(be);if(i){let r=i[1]||"";const s=-1===i[3].indexOf("e")?"E":"e",o=i[2],a=r?t[o.length+1]===s:t[o.length]===s;return o.length>1&&a?t:1!==o.length||!i[3].startsWith(`.${s}`)&&i[3][0]!==s?n.leadingZeros&&!a?(e=(i[1]||"")+i[3],Number(e)):t:Number(e)}return t}(t,n,e);{const i=ye.exec(n);if(i){const r=i[1]||"",s=i[2];let o=function(t){if(t&&-1!==t.indexOf("."))return"."===(t=t.replace(/0+$/,""))?t="0":"."===t[0]?t="0"+t:"."===t[t.length-1]&&(t=t.substring(0,t.length-1)),t;return t}(i[3]);const a=r?"."===t[s.length+1]:"."===t[s.length];if(!e.leadingZeros&&(s.length>1||1===s.length&&!a))return t;{const i=Number(n),a=String(i);if(0===i)return i;if(-1!==a.search(/[eE]/))return e.eNotation?i:t;if(-1!==n.indexOf("."))return"0"===a||a===o||a===`${r}${o}`?i:t;let c=s?o:n;return s?c===a||r+c===a?i:t:c===a||c===r+a?i:t}}return t}}const be=/^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;class Se{constructor(t){var e;if(this.options=t,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"¢"},pound:{regex:/&(pound|#163);/g,val:"£"},yen:{regex:/&(yen|#165);/g,val:"¥"},euro:{regex:/&(euro|#8364);/g,val:"€"},copyright:{regex:/&(copy|#169);/g,val:"©"},reg:{regex:/&(reg|#174);/g,val:"®"},inr:{regex:/&(inr|#8377);/g,val:"₹"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(t,e)=>_e(e,10,"&#")},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(t,e)=>_e(e,16,"&#x")}},this.addExternalEntities=Ie,this.parseXml=Ne,this.parseTextData=Te,this.resolveNameSpace=Ae,this.buildAttributesMap=Pe,this.isItStopNode=ke,this.replaceEntitiesValue=Re,this.readStopNodeData=je,this.saveTextToParentTag=Ce,this.addChild=De,this.ignoreAttributesFn="function"==typeof(e=this.options.ignoreAttributes)?e:Array.isArray(e)?t=>{for(const n of e){if("string"==typeof n&&t===n)return!0;if(n instanceof RegExp&&n.test(t))return!0}}:()=>!1,this.entityExpansionCount=0,this.currentExpandedLength=0,this.options.stopNodes&&this.options.stopNodes.length>0){this.stopNodesExact=new Set,this.stopNodesWildcard=new Set;for(let t=0;t<this.options.stopNodes.length;t++){const e=this.options.stopNodes[t];"string"==typeof e&&(e.startsWith("*.")?this.stopNodesWildcard.add(e.substring(2)):this.stopNodesExact.add(e))}}}}function Ie(t){const e=Object.keys(t);for(let n=0;n<e.length;n++){const i=e[n],r=i.replace(/[.\-+*:]/g,"\\.");this.lastEntities[i]={regex:new RegExp("&"+r+";","g"),val:t[i]}}}function Te(t,e,n,i,r,s,o){if(void 0!==t&&(this.options.trimValues&&!i&&(t=t.trim()),t.length>0)){o||(t=this.replaceEntitiesValue(t,e,n));const i=this.options.tagValueProcessor(e,t,n,r,s);if(null==i)return t;if(typeof i!=typeof t||i!==t)return i;if(this.options.trimValues)return Me(t,this.options.parseTagValue,this.options.numberParseOptions);return t.trim()===t?Me(t,this.options.parseTagValue,this.options.numberParseOptions):t}}function Ae(t){if(this.options.removeNSPrefix){const e=t.split(":"),n="/"===t.charAt(0)?"/":"";if("xmlns"===e[0])return"";2===e.length&&(t=n+e[1])}return t}const $e=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");function Pe(t,e,n){if(!0!==this.options.ignoreAttributes&&"string"==typeof t){const i=le(t,$e),r=i.length,s={};for(let t=0;t<r;t++){const r=this.resolveNameSpace(i[t][1]);if(this.ignoreAttributesFn(r,e))continue;let o=i[t][4],a=this.options.attributeNamePrefix+r;if(r.length)if(this.options.transformAttributeName&&(a=this.options.transformAttributeName(a)),"__proto__"===a&&(a="#__proto__"),void 0!==o){this.options.trimValues&&(o=o.trim()),o=this.replaceEntitiesValue(o,n,e);const t=this.options.attributeValueProcessor(r,o,e);s[a]=null==t?o:typeof t!=typeof o||t!==o?t:Me(o,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(s[a]=!0)}if(!Object.keys(s).length)return;if(this.options.attributesGroupName){const t={};return t[this.options.attributesGroupName]=s,t}return s}}const Ne=function(t){t=t.replace(/\r\n?/g,"\n");const e=new he("!xml");let n=e,i="",r="";this.entityExpansionCount=0,this.currentExpandedLength=0;const s=new pe(this.options.processEntities);for(let o=0;o<t.length;o++){if("<"===t[o])if("/"===t[o+1]){const e=Oe(t,">",o,"Closing Tag is not closed.");let s=t.substring(o+2,e).trim();if(this.options.removeNSPrefix){const t=s.indexOf(":");-1!==t&&(s=s.substr(t+1))}this.options.transformTagName&&(s=this.options.transformTagName(s)),n&&(i=this.saveTextToParentTag(i,n,r));const a=r.substring(r.lastIndexOf(".")+1);if(s&&-1!==this.options.unpairedTags.indexOf(s))throw new Error(`Unpaired tag can not be used as closing tag: </${s}>`);let c=0;a&&-1!==this.options.unpairedTags.indexOf(a)?(c=r.lastIndexOf(".",r.lastIndexOf(".")-1),this.tagsNodeStack.pop()):c=r.lastIndexOf("."),r=r.substring(0,c),n=this.tagsNodeStack.pop(),i="",o=e}else if("?"===t[o+1]){let e=Fe(t,o,!1,"?>");if(!e)throw new Error("Pi Tag is not closed.");if(i=this.saveTextToParentTag(i,n,r),this.options.ignoreDeclaration&&"?xml"===e.tagName||this.options.ignorePiTags);else{const t=new he(e.tagName);t.add(this.options.textNodeName,""),e.tagName!==e.tagExp&&e.attrExpPresent&&(t[":@"]=this.buildAttributesMap(e.tagExp,r,e.tagName)),this.addChild(n,t,r,o)}o=e.closeIndex+1}else if("!--"===t.substr(o+1,3)){const e=Oe(t,"--\x3e",o+4,"Comment is not closed.");if(this.options.commentPropName){const s=t.substring(o+4,e-2);i=this.saveTextToParentTag(i,n,r),n.add(this.options.commentPropName,[{[this.options.textNodeName]:s}])}o=e}else if("!D"===t.substr(o+1,2)){const e=s.readDocType(t,o);this.docTypeEntities=e.entities,o=e.i}else if("!["===t.substr(o+1,2)){const e=Oe(t,"]]>",o,"CDATA is not closed.")-2,s=t.substring(o+9,e);i=this.saveTextToParentTag(i,n,r);let a=this.parseTextData(s,n.tagname,r,!0,!1,!0,!0);null==a&&(a=""),this.options.cdataPropName?n.add(this.options.cdataPropName,[{[this.options.textNodeName]:s}]):n.add(this.options.textNodeName,a),o=e+2}else{let s=Fe(t,o,this.options.removeNSPrefix),a=s.tagName;const c=s.rawTagName;let u=s.tagExp,l=s.attrExpPresent,d=s.closeIndex;if(this.options.transformTagName){const t=this.options.transformTagName(a);u===a&&(u=t),a=t}n&&i&&"!xml"!==n.tagname&&(i=this.saveTextToParentTag(i,n,r,!1));const f=n;f&&-1!==this.options.unpairedTags.indexOf(f.tagname)&&(n=this.tagsNodeStack.pop(),r=r.substring(0,r.lastIndexOf("."))),a!==e.tagname&&(r+=r?"."+a:a);const h=o;if(this.isItStopNode(this.stopNodesExact,this.stopNodesWildcard,r,a)){let e="";if(u.length>0&&u.lastIndexOf("/")===u.length-1)"/"===a[a.length-1]?(a=a.substr(0,a.length-1),r=r.substr(0,r.length-1),u=a):u=u.substr(0,u.length-1),o=s.closeIndex;else if(-1!==this.options.unpairedTags.indexOf(a))o=s.closeIndex;else{const n=this.readStopNodeData(t,c,d+1);if(!n)throw new Error(`Unexpected end of ${c}`);o=n.i,e=n.tagContent}const i=new he(a);a!==u&&l&&(i[":@"]=this.buildAttributesMap(u,r,a)),e&&(e=this.parseTextData(e,a,r,!0,l,!0,!0)),r=r.substr(0,r.lastIndexOf(".")),i.add(this.options.textNodeName,e),this.addChild(n,i,r,h)}else{if(u.length>0&&u.lastIndexOf("/")===u.length-1){if("/"===a[a.length-1]?(a=a.substr(0,a.length-1),r=r.substr(0,r.length-1),u=a):u=u.substr(0,u.length-1),this.options.transformTagName){const t=this.options.transformTagName(a);u===a&&(u=t),a=t}const t=new he(a);a!==u&&l&&(t[":@"]=this.buildAttributesMap(u,r,a)),this.addChild(n,t,r,h),r=r.substr(0,r.lastIndexOf("."))}else{const t=new he(a);this.tagsNodeStack.push(n),a!==u&&l&&(t[":@"]=this.buildAttributesMap(u,r,a)),this.addChild(n,t,r,h),n=t}i="",o=d}}else i+=t[o]}return e.child};function De(t,e,n,i){this.options.captureMetaData||(i=void 0);const r=this.options.updateTag(e.tagname,n,e[":@"]);!1===r||("string"==typeof r?(e.tagname=r,t.addChild(e,i)):t.addChild(e,i))}const Re=function(t,e,n){if(-1===t.indexOf("&"))return t;const i=this.options.processEntities;if(!i.enabled)return t;if(i.allowedTags&&!i.allowedTags.includes(e))return t;if(i.tagFilter&&!i.tagFilter(e,n))return t;for(let e in this.docTypeEntities){const n=this.docTypeEntities[e],r=t.match(n.regx);if(r){if(this.entityExpansionCount+=r.length,i.maxTotalExpansions&&this.entityExpansionCount>i.maxTotalExpansions)throw new Error(`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${i.maxTotalExpansions}`);const e=t.length;if(t=t.replace(n.regx,n.val),i.maxExpandedLength&&(this.currentExpandedLength+=t.length-e,this.currentExpandedLength>i.maxExpandedLength))throw new Error(`Total expanded content size exceeded: ${this.currentExpandedLength} > ${i.maxExpandedLength}`)}}if(-1===t.indexOf("&"))return t;for(let e in this.lastEntities){const n=this.lastEntities[e];t=t.replace(n.regex,n.val)}if(-1===t.indexOf("&"))return t;if(this.options.htmlEntities)for(let e in this.htmlEntities){const n=this.htmlEntities[e];t=t.replace(n.regex,n.val)}return t=t.replace(this.ampEntity.regex,this.ampEntity.val)};function Ce(t,e,n,i){return t&&(void 0===i&&(i=0===e.child.length),void 0!==(t=this.parseTextData(t,e.tagname,n,!1,!!e[":@"]&&0!==Object.keys(e[":@"]).length,i))&&""!==t&&e.add(this.options.textNodeName,t),t=""),t}function ke(t,e,n,i){return!(!e||!e.has(i))||!(!t||!t.has(n))}function Oe(t,e,n,i){const r=t.indexOf(e,n);if(-1===r)throw new Error(i);return r+e.length-1}function Fe(t,e,n,i=">"){const r=function(t,e,n=">"){let i,r="";for(let s=e;s<t.length;s++){let e=t[s];if(i)e===i&&(i="");else if('"'===e||"'"===e)i=e;else if(e===n[0]){if(!n[1])return{data:r,index:s};if(t[s+1]===n[1])return{data:r,index:s}}else"\t"===e&&(e=" ");r+=e}}(t,e+1,i);if(!r)return;let s=r.data;const o=r.index,a=s.search(/\s/);let c=s,u=!0;-1!==a&&(c=s.substring(0,a),s=s.substring(a+1).trimStart());const l=c;if(n){const t=c.indexOf(":");-1!==t&&(c=c.substr(t+1),u=c!==r.data.substr(t+1))}return{tagName:c,tagExp:s,closeIndex:o,attrExpPresent:u,rawTagName:l}}function je(t,e,n){const i=n;let r=1;for(;n<t.length;n++)if("<"===t[n])if("/"===t[n+1]){const s=Oe(t,">",n,`${e} is not closed`);if(t.substring(n+2,s).trim()===e&&(r--,0===r))return{tagContent:t.substring(i,n),i:s};n=s}else if("?"===t[n+1]){n=Oe(t,"?>",n+1,"StopNode is not closed.")}else if("!--"===t.substr(n+1,3)){n=Oe(t,"--\x3e",n+3,"StopNode is not closed.")}else if("!["===t.substr(n+1,2)){n=Oe(t,"]]>",n,"StopNode is not closed.")-2}else{const i=Fe(t,n,">");if(i){(i&&i.tagName)===e&&"/"!==i.tagExp[i.tagExp.length-1]&&r++,n=i.closeIndex}}}function Me(t,e,n){if(e&&"string"==typeof t){const e=t.trim();return"true"===e||"false"!==e&&ve(t,n)}return function(t){return void 0!==t}(t)?t:""}function _e(t,e,n){const i=Number.parseInt(t,e);return i>=0&&i<=1114111?String.fromCodePoint(i):n+t+";"}const Ue=he.getMetaDataSymbol();function Le(t,e){return ze(t,e)}function ze(t,e,n){let i;const r={};for(let s=0;s<t.length;s++){const o=t[s],a=We(o);let c="";if(c=void 0===n?a:n+"."+a,a===e.textNodeName)void 0===i?i=o[a]:i+=""+o[a];else{if(void 0===a)continue;if(o[a]){let t=ze(o[a],e,c);const n=qe(t,e);void 0!==o[Ue]&&(t[Ue]=o[Ue]),o[":@"]?Ve(t,o[":@"],c,e):1!==Object.keys(t).length||void 0===t[e.textNodeName]||e.alwaysCreateTextNode?0===Object.keys(t).length&&(e.alwaysCreateTextNode?t[e.textNodeName]="":t=""):t=t[e.textNodeName],void 0!==r[a]&&r.hasOwnProperty(a)?(Array.isArray(r[a])||(r[a]=[r[a]]),r[a].push(t)):e.isArray(a,c,n)?r[a]=[t]:r[a]=t}}}return"string"==typeof i?i.length>0&&(r[e.textNodeName]=i):void 0!==i&&(r[e.textNodeName]=i),r}function We(t){const e=Object.keys(t);for(let t=0;t<e.length;t++){const n=e[t];if(":@"!==n)return n}}function Ve(t,e,n,i){if(e){const r=Object.keys(e),s=r.length;for(let o=0;o<s;o++){const s=r[o];i.isArray(s,n+"."+s,!0,!0)?t[s]=[e[s]]:t[s]=e[s]}}}function qe(t,e){const{textNodeName:n}=e,i=Object.keys(t).length;return 0===i||!(1!==i||!t[n]&&"boolean"!=typeof t[n]&&0!==t[n])}const Ke={allowBooleanAttributes:!1,unpairedTags:[]};function Ye(t){return" "===t||"\t"===t||"\n"===t||"\r"===t}function Be(t,e){const n=e;for(;e<t.length;e++)if("?"==t[e]||" "==t[e]){const i=t.substr(n,e-n);if(e>5&&"xml"===i)return Ze("InvalidXml","XML declaration allowed only at the start of the document.",nn(t,e));if("?"==t[e]&&">"==t[e+1]){e++;break}continue}return e}function Ge(t,e){if(t.length>e+5&&"-"===t[e+1]&&"-"===t[e+2]){for(e+=3;e<t.length;e++)if("-"===t[e]&&"-"===t[e+1]&&">"===t[e+2]){e+=2;break}}else if(t.length>e+8&&"D"===t[e+1]&&"O"===t[e+2]&&"C"===t[e+3]&&"T"===t[e+4]&&"Y"===t[e+5]&&"P"===t[e+6]&&"E"===t[e+7]){let n=1;for(e+=8;e<t.length;e++)if("<"===t[e])n++;else if(">"===t[e]&&(n--,0===n))break}else if(t.length>e+9&&"["===t[e+1]&&"C"===t[e+2]&&"D"===t[e+3]&&"A"===t[e+4]&&"T"===t[e+5]&&"A"===t[e+6]&&"["===t[e+7])for(e+=8;e<t.length;e++)if("]"===t[e]&&"]"===t[e+1]&&">"===t[e+2]){e+=2;break}return e}function Qe(t,e){let n="",i="",r=!1;for(;e<t.length;e++){if('"'===t[e]||"'"===t[e])""===i?i=t[e]:i!==t[e]||(i="");else if(">"===t[e]&&""===i){r=!0;break}n+=t[e]}return""===i&&{value:n,index:e,tagClosed:r}}const Xe=new RegExp("(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['\"])(([\\s\\S])*?)\\5)?","g");function He(t,e){const n=le(t,Xe),i={};for(let t=0;t<n.length;t++){if(0===n[t][1].length)return Ze("InvalidAttr","Attribute '"+n[t][2]+"' has no space in starting.",rn(n[t]));if(void 0!==n[t][3]&&void 0===n[t][4])return Ze("InvalidAttr","Attribute '"+n[t][2]+"' is without value.",rn(n[t]));if(void 0===n[t][3]&&!e.allowBooleanAttributes)return Ze("InvalidAttr","boolean attribute '"+n[t][2]+"' is not allowed.",rn(n[t]));const r=n[t][2];if(!tn(r))return Ze("InvalidAttr","Attribute '"+r+"' is an invalid name.",rn(n[t]));if(i.hasOwnProperty(r))return Ze("InvalidAttr","Attribute '"+r+"' is repeated.",rn(n[t]));i[r]=1}return!0}function Je(t,e){if(";"===t[++e])return-1;if("#"===t[e])return function(t,e){let n=/\d/;for("x"===t[e]&&(e++,n=/[\da-fA-F]/);e<t.length;e++){if(";"===t[e])return e;if(!t[e].match(n))break}return-1}(t,++e);let n=0;for(;e<t.length;e++,n++)if(!(t[e].match(/\w/)&&n<20)){if(";"===t[e])break;return-1}return e}function Ze(t,e,n){return{err:{code:t,msg:e,line:n.line||n,col:n.col}}}function tn(t){return de(t)}function en(t){return de(t)}function nn(t,e){const n=t.substring(0,e).split(/\r?\n/);return{line:n.length,col:n[n.length-1].length+1}}function rn(t){return t.startIndex+t[1].length}const sn=new class{constructor(t){this.externalEntities={},this.options=ae(t)}parse(t,e){if("string"!=typeof t&&t.toString)t=t.toString();else if("string"!=typeof t)throw new Error("XML data is accepted in String or Bytes[] form.");if(e){!0===e&&(e={});const n=function(t,e){e=Object.assign({},Ke,e);const n=[];let i=!1,r=!1;"\ufeff"===t[0]&&(t=t.substr(1));for(let s=0;s<t.length;s++)if("<"===t[s]&&"?"===t[s+1]){if(s+=2,s=Be(t,s),s.err)return s}else{if("<"!==t[s]){if(Ye(t[s]))continue;return Ze("InvalidChar","char '"+t[s]+"' is not expected.",nn(t,s))}{let o=s;if(s++,"!"===t[s]){s=Ge(t,s);continue}{let a=!1;"/"===t[s]&&(a=!0,s++);let c="";for(;s<t.length&&">"!==t[s]&&" "!==t[s]&&"\t"!==t[s]&&"\n"!==t[s]&&"\r"!==t[s];s++)c+=t[s];if(c=c.trim(),"/"===c[c.length-1]&&(c=c.substring(0,c.length-1),s--),!en(c)){let e;return e=0===c.trim().length?"Invalid space after '<'.":"Tag '"+c+"' is an invalid name.",Ze("InvalidTag",e,nn(t,s))}const u=Qe(t,s);if(!1===u)return Ze("InvalidAttr","Attributes for '"+c+"' have open quote.",nn(t,s));let l=u.value;if(s=u.index,"/"===l[l.length-1]){const n=s-l.length;l=l.substring(0,l.length-1);const r=He(l,e);if(!0!==r)return Ze(r.err.code,r.err.msg,nn(t,n+r.err.line));i=!0}else if(a){if(!u.tagClosed)return Ze("InvalidTag","Closing tag '"+c+"' doesn't have proper closing.",nn(t,s));if(l.trim().length>0)return Ze("InvalidTag","Closing tag '"+c+"' can't have attributes or invalid starting.",nn(t,o));if(0===n.length)return Ze("InvalidTag","Closing tag '"+c+"' has not been opened.",nn(t,o));{const e=n.pop();if(c!==e.tagName){let n=nn(t,e.tagStartPos);return Ze("InvalidTag","Expected closing tag '"+e.tagName+"' (opened in line "+n.line+", col "+n.col+") instead of closing tag '"+c+"'.",nn(t,o))}0==n.length&&(r=!0)}}else{const a=He(l,e);if(!0!==a)return Ze(a.err.code,a.err.msg,nn(t,s-l.length+a.err.line));if(!0===r)return Ze("InvalidXml","Multiple possible root nodes found.",nn(t,s));-1!==e.unpairedTags.indexOf(c)||n.push({tagName:c,tagStartPos:o}),i=!0}for(s++;s<t.length;s++)if("<"===t[s]){if("!"===t[s+1]){s++,s=Ge(t,s);continue}if("?"!==t[s+1])break;if(s=Be(t,++s),s.err)return s}else if("&"===t[s]){const e=Je(t,s);if(-1==e)return Ze("InvalidChar","char '&' is not expected.",nn(t,s));s=e}else if(!0===r&&!Ye(t[s]))return Ze("InvalidXml","Extra text at the end",nn(t,s));"<"===t[s]&&s--}}}return i?1==n.length?Ze("InvalidTag","Unclosed tag '"+n[0].tagName+"'.",nn(t,n[0].tagStartPos)):!(n.length>0)||Ze("InvalidXml","Invalid '"+JSON.stringify(n.map(t=>t.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1}):Ze("InvalidXml","Start tag expected.",1)}(t,e);if(!0!==n)throw Error(`${n.err.msg}:${n.err.line}:${n.err.col}`)}const n=new Se(this.options);n.addExternalEntities(this.externalEntities);const i=n.parseXml(t);return this.options.preserveOrder||void 0===i?i:Le(i,this.options)}addEntity(t,e){if(-1!==e.indexOf("&"))throw new Error("Entity value can't have '&'");if(-1!==t.indexOf("&")||-1!==t.indexOf(";"))throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '&#xD;'");if("&"===e)throw new Error("An entity with value '&' is not permitted");this.externalEntities[t]=e}static getMetaDataSymbol(){return he.getMetaDataSymbol()}}({attributeNamePrefix:"",htmlEntities:!0,ignoreAttributes:!1,ignoreDeclaration:!0,parseTagValue:!1,trimValues:!1,tagValueProcessor:(t,e)=>""===e.trim()&&e.includes("\n")?"":void 0});sn.addEntity("#xD","\r"),sn.addEntity("#10","\n");var on=n(847);const an=t=>{const e="#text";for(const n in t)t.hasOwnProperty(n)&&void 0!==t[n][e]?t[n]=t[n][e]:"object"==typeof t[n]&&null!==t[n]&&(t[n]=an(t[n]));return t};var cn=n(114),un=n(121),ln=n(126);class dn extends un.B{settings;stringDeserializer;constructor(t){super(),this.settings=t,this.stringDeserializer=new on.k(t)}setSerdeContext(t){this.serdeContext=t,this.stringDeserializer.setSerdeContext(t)}read(t,e,n){const i=ie.l.of(t),r=i.getMemberSchemas();if(i.isStructSchema()&&i.isMemberSchema()&&!!Object.values(r).find(t=>!!t.getMemberTraits().eventPayload)){const t={},n=Object.keys(r)[0];return r[n].isBlobSchema()?t[n]=e:t[n]=this.read(r[n],e),t}const s=(this.serdeContext?.utf8Encoder??cn.P)(e),o=this.parseXml(s);return this.readSchema(t,n?o[n]:o)}readSchema(t,e){const n=ie.l.of(t);if(n.isUnitSchema())return;const i=n.getMergedTraits();if(n.isListSchema()&&!Array.isArray(e))return this.readSchema(n,[e]);if(null==e)return e;if("object"==typeof e){const t=!!i.sparse,r=!!i.xmlFlattened;if(n.isListSchema()){const i=n.getValueSchema(),s=[],o=i.getMergedTraits().xmlName??"member",a=r?e:(e[0]??e)[o],c=Array.isArray(a)?a:[a];for(const e of c)(null!=e||t)&&s.push(this.readSchema(i,e));return s}const s={};if(n.isMapSchema()){const i=n.getKeySchema(),o=n.getValueSchema();let a;a=r?Array.isArray(e)?e:[e]:Array.isArray(e.entry)?e.entry:[e.entry];const c=i.getMergedTraits().xmlName??"key",u=o.getMergedTraits().xmlName??"value";for(const e of a){const n=e[c],i=e[u];(null!=i||t)&&(s[n]=this.readSchema(o,i))}return s}if(n.isStructSchema()){const t=n.isUnionSchema();let i;t&&(i=new ln.F(e,s));for(const[r,o]of n.structIterator()){const n=o.getMergedTraits(),a=n.httpPayload?n.xmlName??o.getName():o.getMemberTraits().xmlName??r;t&&i.mark(a),null!=e[a]&&(s[r]=this.readSchema(o,e[a]))}return t&&i.writeUnknown(),s}if(n.isDocumentSchema())return e;throw new Error(`@aws-sdk/core/protocols - xml deserializer unhandled schema type for ${n.getName(!0)}`)}return n.isListSchema()?[]:n.isMapSchema()||n.isStructSchema()?{}:this.stringDeserializer.read(n,e)}parseXml(t){if(t.length){let n;try{e=t,n=sn.parse(e,!0)}catch(e){throw e&&"object"==typeof e&&Object.defineProperty(e,"$responseBodyText",{value:t}),e}const i="#text",r=Object.keys(n)[0],s=n[r];return s[i]&&(s[r]=s[i],delete s[i]),an(s)}var e;return{}}}var fn=n(122),hn=n(846),pn=n(76),mn=n(125),gn=n(123),wn=n(113);class En extends un.B{settings;buffer;constructor(t){super(),this.settings=t}write(t,e,n=""){void 0===this.buffer&&(this.buffer="");const i=ie.l.of(t);if(n&&!n.endsWith(".")&&(n+="."),i.isBlobSchema())("string"==typeof e||e instanceof Uint8Array)&&(this.writeKey(n),this.writeValue((this.serdeContext?.base64Encoder??wn.n)(e)));else if(i.isBooleanSchema()||i.isNumericSchema()||i.isStringSchema())null!=e?(this.writeKey(n),this.writeValue(String(e))):i.isIdempotencyToken()&&(this.writeKey(n),this.writeValue((0,pn.v4)()));else if(i.isBigIntegerSchema())null!=e&&(this.writeKey(n),this.writeValue(String(e)));else if(i.isBigDecimalSchema())null!=e&&(this.writeKey(n),this.writeValue(e instanceof mn.D?e.string:String(e)));else if(i.isTimestampSchema()){if(e instanceof Date){this.writeKey(n);switch((0,fn.V)(i,this.settings)){case 5:this.writeValue(e.toISOString().replace(".000Z","Z"));break;case 6:this.writeValue((0,gn.JV)(e));break;case 7:this.writeValue(String(e.getTime()/1e3))}}}else if(i.isDocumentSchema())Array.isArray(e)?this.write(79,e,n):e instanceof Date?this.write(4,e,n):e instanceof Uint8Array?this.write(21,e,n):e&&"object"==typeof e?this.write(143,e,n):(this.writeKey(n),this.writeValue(String(e)));else if(i.isListSchema()){if(Array.isArray(e))if(0===e.length)this.settings.serializeEmptyLists&&(this.writeKey(n),this.writeValue(""));else{const t=i.getValueSchema(),r=this.settings.flattenLists||i.getMergedTraits().xmlFlattened;let s=1;for(const i of e){if(null==i)continue;const e=t.getMergedTraits(),o=this.getKey("member",e.xmlName,e.ec2QueryName),a=r?`${n}${s}`:`${n}${o}.${s}`;this.write(t,i,a),++s}}}else if(i.isMapSchema()){if(e&&"object"==typeof e){const t=i.getKeySchema(),r=i.getValueSchema(),s=i.getMergedTraits().xmlFlattened;let o=1;for(const[i,a]of Object.entries(e)){if(null==a)continue;const e=t.getMergedTraits(),c=this.getKey("key",e.xmlName,e.ec2QueryName),u=s?`${n}${o}.${c}`:`${n}entry.${o}.${c}`,l=r.getMergedTraits(),d=this.getKey("value",l.xmlName,l.ec2QueryName),f=s?`${n}${o}.${d}`:`${n}entry.${o}.${d}`;this.write(t,i,u),this.write(r,a,f),++o}}}else if(i.isStructSchema()){if(e&&"object"==typeof e){let t=!1;for(const[r,s]of i.structIterator()){if(null==e[r]&&!s.isIdempotencyToken())continue;const i=s.getMergedTraits(),o=`${n}${this.getKey(r,i.xmlName,i.ec2QueryName,"struct")}`;this.write(s,e[r],o),t=!0}if(!t&&i.isUnionSchema()){const{$unknown:t}=e;if(Array.isArray(t)){const[e,i]=t,r=`${n}${e}`;this.write(15,i,r)}}}}else if(!i.isUnitSchema())throw new Error(`@aws-sdk/core/protocols - QuerySerializer unrecognized schema type ${i.getName(!0)}`)}flush(){if(void 0===this.buffer)throw new Error("@aws-sdk/core/protocols - QuerySerializer cannot flush with nothing written to buffer.");const t=this.buffer;return delete this.buffer,t}getKey(t,e,n,i){const{ec2:r,capitalizeKeys:s}=this.settings;if(r&&n)return n;const o=e??t;return s&&"struct"===i?o[0].toUpperCase()+o.slice(1):o}writeKey(t){t.endsWith(".")&&(t=t.slice(0,t.length-1)),this.buffer+=`&${(0,hn.$)(t)}=`}writeValue(t){this.buffer+=(0,hn.$)(t)}}class yn extends te.M{options;serializer;deserializer;mixin=new re.U;constructor(t){super({defaultNamespace:t.defaultNamespace}),this.options=t;const e={timestampFormat:{useTrait:!0,default:5},httpBindings:!1,xmlNamespace:t.xmlNamespace,serviceNamespace:t.defaultNamespace,serializeEmptyLists:!0};this.serializer=new En(e),this.deserializer=new dn(e)}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,e,n){const i=await super.serializeRequest(t,e,n);i.path.endsWith("/")||(i.path+="/"),Object.assign(i.headers,{"content-type":"application/x-www-form-urlencoded"}),"unit"!==(0,ne.L)(t.input)&&i.body||(i.body="");const r=t.name.split("#")[1]??t.name;return i.body=`Action=${r}&Version=${this.options.version}`+i.body,i.body.endsWith("&")&&(i.body=i.body.slice(-1)),i}async deserializeResponse(t,e,n){const i=this.deserializer,r=ie.l.of(t.output),s={};if(n.statusCode>=300){const r=await(0,ee.P)(n.body,e);r.byteLength>0&&Object.assign(s,await i.read(15,r)),await this.handleError(t,e,n,s,this.deserializeMetadata(n))}for(const t in n.headers){const e=n.headers[t];delete n.headers[t],n.headers[t.toLowerCase()]=e}const o=t.name.split("#")[1]??t.name,a=r.isStructSchema()&&this.useNestedResult()?o+"Result":void 0,c=await(0,ee.P)(n.body,e);c.byteLength>0&&Object.assign(s,await i.read(r,c,a));return{$metadata:this.deserializeMetadata(n),...s}}useNestedResult(){return!0}async handleError(t,e,n,i,r){const s=this.loadQueryErrorCode(n,i)??"Unknown",o=this.loadQueryError(i)??{},a=this.loadQueryErrorMessage(i);o.message=a,o.Error={Type:o.Type,Code:o.Code,Message:a};const{errorSchema:c,errorMetadata:u}=await this.mixin.getErrorSchemaOrThrowBaseException(s,this.options.defaultNamespace,n,o,r,this.mixin.findQueryCompatibleError),d=ie.l.of(c),f=new(l.O.for(c[1]).getErrorCtor(c)??Error)(a),h={Type:o.Error.Type,Code:o.Error.Code,Error:o.Error};for(const[t,e]of d.structIterator()){const n=e.getMergedTraits().xmlName??t,r=o[n]??i[n];h[t]=this.deserializer.readSchema(e,r)}throw this.mixin.decorateServiceException(Object.assign(f,u,{$fault:d.getMergedTraits().error,message:a},h),i)}loadQueryErrorCode(t,e){const n=(e.Errors?.[0]?.Error??e.Errors?.Error??e.Error)?.Code;return void 0!==n?n:404==t.statusCode?"NotFound":void 0}loadQueryError(t){return t.Errors?.[0]?.Error??t.Errors?.Error??t.Error}loadQueryErrorMessage(t){const e=this.loadQueryError(t);return e?.message??e?.Message??t.message??t.Message??"Unknown"}getDefaultContentType(){return"application/x-www-form-urlencoded"}}var xn=n(75),vn=n(69),bn=n(112),Sn=n(83),In=n(39),Tn=n(128),An=n(129),$n=n(40);const Pn="required",Nn="type",Dn="fn",Rn="argv",Cn="ref",kn=!1,On=!0,Fn="booleanEquals",jn="stringEquals",Mn="sigv4",_n="us-east-1",Un="endpoint",Ln="https://sts.{Region}.{PartitionResult#dnsSuffix}",zn="tree",Wn="error",Vn="getAttr",qn={[Pn]:!1,[Nn]:"string"},Kn={[Pn]:!0,default:!1,[Nn]:"boolean"},Yn={[Cn]:"Endpoint"},Bn={[Dn]:"isSet",[Rn]:[{[Cn]:"Region"}]},Gn={[Cn]:"Region"},Qn={[Dn]:"aws.partition",[Rn]:[Gn],assign:"PartitionResult"},Xn={[Cn]:"UseFIPS"},Hn={[Cn]:"UseDualStack"},Jn={url:"https://sts.amazonaws.com",properties:{authSchemes:[{name:Mn,signingName:"sts",signingRegion:_n}]},headers:{}},Zn={},ti={conditions:[{[Dn]:jn,[Rn]:[Gn,"aws-global"]}],[Un]:Jn,[Nn]:Un},ei={[Dn]:Fn,[Rn]:[Xn,!0]},ni={[Dn]:Fn,[Rn]:[Hn,!0]},ii={[Dn]:Vn,[Rn]:[{[Cn]:"PartitionResult"},"supportsFIPS"]},ri={[Cn]:"PartitionResult"},si={[Dn]:Fn,[Rn]:[!0,{[Dn]:Vn,[Rn]:[ri,"supportsDualStack"]}]},oi=[{[Dn]:"isSet",[Rn]:[Yn]}],ai=[ei],ci=[ni],ui={version:"1.0",parameters:{Region:qn,UseDualStack:Kn,UseFIPS:Kn,Endpoint:qn,UseGlobalEndpoint:Kn},rules:[{conditions:[{[Dn]:Fn,[Rn]:[{[Cn]:"UseGlobalEndpoint"},On]},{[Dn]:"not",[Rn]:oi},Bn,Qn,{[Dn]:Fn,[Rn]:[Xn,kn]},{[Dn]:Fn,[Rn]:[Hn,kn]}],rules:[{conditions:[{[Dn]:jn,[Rn]:[Gn,"ap-northeast-1"]}],endpoint:Jn,[Nn]:Un},{conditions:[{[Dn]:jn,[Rn]:[Gn,"ap-south-1"]}],endpoint:Jn,[Nn]:Un},{conditions:[{[Dn]:jn,[Rn]:[Gn,"ap-southeast-1"]}],endpoint:Jn,[Nn]:Un},{conditions:[{[Dn]:jn,[Rn]:[Gn,"ap-southeast-2"]}],endpoint:Jn,[Nn]:Un},ti,{conditions:[{[Dn]:jn,[Rn]:[Gn,"ca-central-1"]}],endpoint:Jn,[Nn]:Un},{conditions:[{[Dn]:jn,[Rn]:[Gn,"eu-central-1"]}],endpoint:Jn,[Nn]:Un},{conditions:[{[Dn]:jn,[Rn]:[Gn,"eu-north-1"]}],endpoint:Jn,[Nn]:Un},{conditions:[{[Dn]:jn,[Rn]:[Gn,"eu-west-1"]}],endpoint:Jn,[Nn]:Un},{conditions:[{[Dn]:jn,[Rn]:[Gn,"eu-west-2"]}],endpoint:Jn,[Nn]:Un},{conditions:[{[Dn]:jn,[Rn]:[Gn,"eu-west-3"]}],endpoint:Jn,[Nn]:Un},{conditions:[{[Dn]:jn,[Rn]:[Gn,"sa-east-1"]}],endpoint:Jn,[Nn]:Un},{conditions:[{[Dn]:jn,[Rn]:[Gn,_n]}],endpoint:Jn,[Nn]:Un},{conditions:[{[Dn]:jn,[Rn]:[Gn,"us-east-2"]}],endpoint:Jn,[Nn]:Un},{conditions:[{[Dn]:jn,[Rn]:[Gn,"us-west-1"]}],endpoint:Jn,[Nn]:Un},{conditions:[{[Dn]:jn,[Rn]:[Gn,"us-west-2"]}],endpoint:Jn,[Nn]:Un},{endpoint:{url:Ln,properties:{authSchemes:[{name:Mn,signingName:"sts",signingRegion:"{Region}"}]},headers:Zn},[Nn]:Un}],[Nn]:zn},{conditions:oi,rules:[{conditions:ai,error:"Invalid Configuration: FIPS and custom endpoint are not supported",[Nn]:Wn},{conditions:ci,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",[Nn]:Wn},{endpoint:{url:Yn,properties:Zn,headers:Zn},[Nn]:Un}],[Nn]:zn},{conditions:[Bn],rules:[{conditions:[Qn],rules:[{conditions:[ei,ni],rules:[{conditions:[{[Dn]:Fn,[Rn]:[On,ii]},si],rules:[{endpoint:{url:"https://sts-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:Zn,headers:Zn},[Nn]:Un}],[Nn]:zn},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",[Nn]:Wn}],[Nn]:zn},{conditions:ai,rules:[{conditions:[{[Dn]:Fn,[Rn]:[ii,On]}],rules:[{conditions:[{[Dn]:jn,[Rn]:[{[Dn]:Vn,[Rn]:[ri,"name"]},"aws-us-gov"]}],endpoint:{url:"https://sts.{Region}.amazonaws.com",properties:Zn,headers:Zn},[Nn]:Un},{endpoint:{url:"https://sts-fips.{Region}.{PartitionResult#dnsSuffix}",properties:Zn,headers:Zn},[Nn]:Un}],[Nn]:zn},{error:"FIPS is enabled but this partition does not support FIPS",[Nn]:Wn}],[Nn]:zn},{conditions:ci,rules:[{conditions:[si],rules:[{endpoint:{url:"https://sts.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:Zn,headers:Zn},[Nn]:Un}],[Nn]:zn},{error:"DualStack is enabled but this partition does not support DualStack",[Nn]:Wn}],[Nn]:zn},ti,{endpoint:{url:Ln,properties:Zn,headers:Zn},[Nn]:Un}],[Nn]:zn}],[Nn]:zn},{error:"Invalid Configuration: Missing Region",[Nn]:Wn}]},li=new Tn.k({size:50,params:["Endpoint","Region","UseDualStack","UseFIPS","UseGlobalEndpoint"]}),di=(t,e={})=>li.get(t,()=>(0,An.s)(ui,{endpointParams:t,logger:e.logger}));$n.m.aws=In.UF;const fi=t=>{(0,Qt.I)(process.version);const e=(0,Jt.I)(t),n=()=>e().then(Xt.l),i=(t=>({apiVersion:"2011-06-15",base64Decoder:t?.base64Decoder??bn.E,base64Encoder:t?.base64Encoder??wn.n,disableHostPrefix:t?.disableHostPrefix??!1,endpointProvider:t?.endpointProvider??di,extensions:t?.extensions??[],httpAuthSchemeProvider:t?.httpAuthSchemeProvider??Ft,httpAuthSchemes:t?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:t=>t.getIdentityProvider("aws.auth#sigv4"),signer:new Lt.f2},{schemeId:"smithy.api#noAuth",identityProvider:t=>t.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new Kt.m}],logger:t?.logger??new xn.N,protocol:t?.protocol??yn,protocolSettings:t?.protocolSettings??{defaultNamespace:"com.amazonaws.sts",errorTypeRegistries:Y,xmlNamespace:"https://sts.amazonaws.com/doc/2011-06-15/",version:"2011-06-15",serviceTarget:"AWSSecurityTokenServiceV20110615"},serviceId:t?.serviceId??"STS",urlParser:t?.urlParser??vn.D,utf8Decoder:t?.utf8Decoder??Sn.a,utf8Encoder:t?.utf8Encoder??cn.P}))(t);(0,_t.I)(process.version);const o={profile:t?.profile,logger:i.logger};return{...i,...t,runtime:"node",defaultsMode:e,authSchemePreference:t?.authSchemePreference??(0,s.Z)(Ut.$,o),bodyLengthChecker:t?.bodyLengthChecker??Ht.n,defaultUserAgentProvider:t?.defaultUserAgentProvider??(0,zt.pf)({serviceId:i.serviceId,clientVersion:Mt.rE}),httpAuthSchemes:t?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4")||(async e=>await t.credentialDefaultProvider(e?.o||{})()),signer:new Lt.f2},{schemeId:"smithy.api#noAuth",identityProvider:t=>t.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new Kt.m}],maxAttempts:t?.maxAttempts??(0,s.Z)(Pt.qs,t),region:t?.region??(0,s.Z)(r.GG,{...r.zH,...o}),requestHandler:Bt.$.create(t?.requestHandler??n),retryMode:t?.retryMode??(0,s.Z)({...Pt.kN,default:async()=>(await n()).retryMode||Zt.L0},t),sha256:t?.sha256??Yt.V.bind(null,"sha256"),streamCollector:t?.streamCollector??Gt.k,useDualstackEndpoint:t?.useDualstackEndpoint??(0,s.Z)(Vt.e$,o),useFipsEndpoint:t?.useFipsEndpoint??(0,s.Z)(qt.Ko,o),userAgentAppId:t?.userAgentAppId??(0,s.Z)(Wt.hV,o)}};var hi=n(130),pi=n(131),mi=n(132);class gi extends Dt.K{config;constructor(...[t]){const e=fi(t||{});super(e),this.initConfig=e;const n=(i=e,Object.assign(i,{useDualstackEndpoint:i.useDualstackEndpoint??!1,useFipsEndpoint:i.useFipsEndpoint??!1,useGlobalEndpoint:i.useGlobalEndpoint??!1,defaultSigningName:"sts"}));var i;const r=(0,yt.D)(n),s=(0,Pt.$z)(r),o=(0,vt.T)(s),a=(0,gt.OV)(o),c=(0,$t.C)(a),u=((t,e)=>{const n=Object.assign((0,hi.R)(t),(0,mi.xA)(t),(0,pi.e)(t),(t=>{const e=t.httpAuthSchemes;let n=t.httpAuthSchemeProvider,i=t.credentials;return{setHttpAuthScheme(t){const n=e.findIndex(e=>e.schemeId===t.schemeId);-1===n?e.push(t):e.splice(n,1,t)},httpAuthSchemes:()=>e,setHttpAuthSchemeProvider(t){n=t},httpAuthSchemeProvider:()=>n,setCredentials(t){i=t},credentials:()=>i}})(t));return e.forEach(t=>t.configure(n)),Object.assign(t,(0,hi.$)(n),(0,mi.uv)(n),(0,pi.j)(n),{httpAuthSchemes:(i=n).httpAuthSchemes(),httpAuthSchemeProvider:i.httpAuthSchemeProvider(),credentials:i.credentials()});var i})(jt(c),t?.extensions||[]);this.config=u,this.middlewareStack.use((0,Tt.wq)(this.config)),this.middlewareStack.use((0,xt.sM)(this.config)),this.middlewareStack.use((0,Nt.ey)(this.config)),this.middlewareStack.use((0,At.vK)(this.config)),this.middlewareStack.use((0,gt.TC)(this.config)),this.middlewareStack.use((0,wt.Y7)(this.config)),this.middlewareStack.use((0,Et.n)(this.config)),this.middlewareStack.use((0,bt.w)(this.config,{httpAuthSchemeParametersProvider:Ot,identityProviderConfigProvider:async t=>new St.h({"aws.auth#sigv4":t.credentials})})),this.middlewareStack.use((0,It.l)(this.config))}destroy(){super.destroy()}}const wi=(t,e)=>e?class extends t{constructor(t){super(t);for(const t of e)this.middlewareStack.use(t)}}:t,Ei=(t={},e)=>ht(t,wi(gi,e)),yi=(t={},e)=>pt(t,wi(gi,e))},846(t,e,n){function i(t){return encodeURIComponent(t).replace(/[!'()*]/g,function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()})}n.d(e,{$:()=>i})},847(t,e,n){n.d(e,{k:()=>b});var i=n(108),r=n(845);const s="(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun)(?:[ne|u?r]?s?day)?",o="(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)",a="(\\d?\\d):(\\d{2}):(\\d{2})(?:\\.(\\d+))?",c="(\\d?\\d)",u="(\\d{4})",l=new RegExp(/^(\d{4})-(\d\d)-(\d\d)[tT](\d\d):(\d\d):(\d\d)(\.(\d+))?(([-+]\d\d:\d\d)|[zZ])$/),d=new RegExp(`^${s}, ${c} ${o} ${u} ${a} GMT$`),f=new RegExp(`^${s}, ${c}-${o}-(\\d\\d) ${a} GMT$`),h=new RegExp(`^${s} ${o} ( [1-9]|\\d\\d) ${a} ${u}$`),p=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function m(t,e,n){const i=Number(t);if(i<e||i>n)throw new Error(`Value ${i} out of range [${e}, ${n}]`)}var g=n(124),w=n(125),E=n(112),y=n(114),x=n(117),v=n(122);class b extends x.f{settings;constructor(t){super(),this.settings=t}read(t,e){const n=i.l.of(t);if(n.isListSchema())return(0,r.G)(e).map(t=>this.read(n.getValueSchema(),t));if(n.isBlobSchema())return(this.serdeContext?.base64Decoder??E.E)(e);if(n.isTimestampSchema()){switch((0,v.V)(n,this.settings)){case 5:return(t=>{if(null==t)return;if("string"!=typeof t)throw new TypeError("RFC3339 timestamps must be strings");const e=l.exec(t);if(!e)throw new TypeError(`Invalid RFC3339 timestamp format ${t}`);const[,n,i,r,s,o,a,,c,u]=e;m(i,1,12),m(r,1,31),m(s,0,23),m(o,0,59),m(a,0,60);const d=new Date(Date.UTC(Number(n),Number(i)-1,Number(r),Number(s),Number(o),Number(a),Number(c)?Math.round(1e3*parseFloat(`0.${c}`)):0));if(d.setUTCFullYear(Number(n)),"Z"!=u.toUpperCase()){const[,t,e,n]=/([+-])(\d\d):(\d\d)/.exec(u)||[void 0,"+",0,0],i="-"===t?1:-1;d.setTime(d.getTime()+i*(60*Number(e)*60*1e3+60*Number(n)*1e3))}return d})(e);case 6:return(t=>{if(null==t)return;if("string"!=typeof t)throw new TypeError("RFC7231 timestamps must be strings.");let e,n,i,r,s,o,a,c;if((c=d.exec(t))?[,e,n,i,r,s,o,a]=c:(c=f.exec(t))?([,e,n,i,r,s,o,a]=c,i=(Number(i)+1900).toString()):(c=h.exec(t))&&([,n,e,r,s,o,a,i]=c),i&&o){const t=Date.UTC(Number(i),p.indexOf(n),Number(e),Number(r),Number(s),Number(o),a?Math.round(1e3*parseFloat(`0.${a}`)):0);m(e,1,31),m(r,0,23),m(s,0,59),m(o,0,60);const c=new Date(t);return c.setUTCFullYear(Number(i)),c}throw new TypeError(`Invalid RFC7231 date-time value ${t}.`)})(e);case 7:return(t=>{if(null==t)return;let e=NaN;if("number"==typeof t)e=t;else if("string"==typeof t){if(!/^-?\d*\.?\d+$/.test(t))throw new TypeError("parseEpochTimestamp - numeric string invalid.");e=Number.parseFloat(t)}else"object"==typeof t&&1===t.tag&&(e=t.value);if(isNaN(e)||Math.abs(e)===1/0)throw new TypeError("Epoch timestamps must be valid finite numbers.");return new Date(Math.round(1e3*e))})(e);default:return console.warn("Missing timestamp format, parsing value with Date constructor:",e),new Date(e)}}if(n.isStringSchema()){const t=n.getMergedTraits().mediaType;let i=e;if(t){n.getMergedTraits().httpHeader&&(i=this.base64ToUtf8(i));return("application/json"===t||t.endsWith("+json"))&&(i=g.A.from(i)),i}}return n.isNumericSchema()?Number(e):n.isBigIntegerSchema()?BigInt(e):n.isBigDecimalSchema()?new w.D(e,"bigDecimal"):n.isBooleanSchema()?"true"===String(e).toLowerCase():e}base64ToUtf8(t){return(this.serdeContext?.utf8Encoder??y.P)((this.serdeContext?.base64Decoder??E.E)(t))}}},845(t,e,n){n.d(e,{G:()=>i});const i=t=>{const e=t.length,n=[];let i,r=!1,s=0;for(let o=0;o<e;++o){const e=t[o];switch(e){case'"':"\\"!==i&&(r=!r);break;case",":r||(n.push(t.slice(s,o)),s=o+1)}i=e}return n.push(t.slice(s)),n.map(t=>{const e=(t=t.trim()).length;return e<2?t:('"'===t[0]&&'"'===t[e-1]&&(t=t.slice(1,e-1)),t.replace(/\\"/g,'"'))})}},848(t,e,n){n.d(e,{m:()=>i});class i{async sign(t,e,n){return t}}},850(t){t.exports={rE:"3.996.0"}}};
3
3
  //# sourceMappingURL=827.index.js.map
package/dist/876.index.js CHANGED
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
- "use strict";exports.id=876,exports.ids=[876],exports.modules={835(e,r,t){t.d(r,{fromProcess:()=>f});var o=t(830),n=t(59),s=t(58),c=t(836),i=t(30),a=t(9),d=t(79);const l=async(e,r,t)=>{const o=r[e];if(!r[e])throw new s.C(`Profile ${e} could not be found in shared credentials file.`,{logger:t});{const n=o.credential_process;if(void 0===n)throw new s.C(`Profile ${e} did not contain credential_process.`,{logger:t});{const o=(0,a.promisify)(c.Z?.getTokenRecord?.().exec??i.exec);try{const{stdout:t}=await o(n);let s;try{s=JSON.parse(t.trim())}catch{throw Error(`Profile ${e} credential_process returned invalid JSON.`)}return((e,r,t)=>{if(1!==r.Version)throw Error(`Profile ${e} credential_process did not return Version 1.`);if(void 0===r.AccessKeyId||void 0===r.SecretAccessKey)throw Error(`Profile ${e} credential_process returned invalid credentials.`);if(r.Expiration){const t=new Date;if(new Date(r.Expiration)<t)throw Error(`Profile ${e} credential_process returned expired credentials.`)}let o=r.AccountId;!o&&t?.[e]?.aws_account_id&&(o=t[e].aws_account_id);const n={accessKeyId:r.AccessKeyId,secretAccessKey:r.SecretAccessKey,...r.SessionToken&&{sessionToken:r.SessionToken},...r.Expiration&&{expiration:new Date(r.Expiration)},...r.CredentialScope&&{credentialScope:r.CredentialScope},...o&&{accountId:o}};return(0,d.g)(n,"CREDENTIALS_PROCESS","w"),n})(e,s,r)}catch(e){throw new s.C(e.message,{logger:t})}}}},f=(e={})=>async({callerClientConfig:r}={})=>{e.logger?.debug("@aws-sdk/credential-provider-process - fromProcess");const t=await(0,o.Y)(e);return l((0,n.Bz)({profile:e.profile??r?.profile}),t,e.logger)}},836(e,r,t){t.d(r,{Z:()=>s});var o=t(831),n=t(66);const s={getFileRecord:()=>n.Jj,interceptFile(e,r){n.Jj[e]=Promise.resolve(r)},getTokenRecord:()=>o.a,interceptToken(e,r){o.a[e]=r}}},832(e,r,t){t.d(r,{C:()=>c});var o=t(5),n=t(3),s=t(64);const c=e=>{const r=(0,o.createHash)("sha1").update(e).digest("hex");return(0,n.join)((0,s.R)(),".aws","sso","cache",`${r}.json`)}},831(e,r,t){t.d(r,{a:()=>s,v:()=>c});var o=t(27),n=t(832);const s={},c=async e=>{if(s[e])return s[e];const r=(0,n.C)(e),t=await(0,o.readFile)(r,"utf8");return JSON.parse(t)}}};
2
+ "use strict";exports.id=876,exports.ids=[876],exports.modules={836(e,r,t){t.d(r,{fromProcess:()=>f});var o=t(831),n=t(60),s=t(59),c=t(837),i=t(30),a=t(9),d=t(80);const l=async(e,r,t)=>{const o=r[e];if(!r[e])throw new s.C(`Profile ${e} could not be found in shared credentials file.`,{logger:t});{const n=o.credential_process;if(void 0===n)throw new s.C(`Profile ${e} did not contain credential_process.`,{logger:t});{const o=(0,a.promisify)(c.Z?.getTokenRecord?.().exec??i.exec);try{const{stdout:t}=await o(n);let s;try{s=JSON.parse(t.trim())}catch{throw Error(`Profile ${e} credential_process returned invalid JSON.`)}return((e,r,t)=>{if(1!==r.Version)throw Error(`Profile ${e} credential_process did not return Version 1.`);if(void 0===r.AccessKeyId||void 0===r.SecretAccessKey)throw Error(`Profile ${e} credential_process returned invalid credentials.`);if(r.Expiration){const t=new Date;if(new Date(r.Expiration)<t)throw Error(`Profile ${e} credential_process returned expired credentials.`)}let o=r.AccountId;!o&&t?.[e]?.aws_account_id&&(o=t[e].aws_account_id);const n={accessKeyId:r.AccessKeyId,secretAccessKey:r.SecretAccessKey,...r.SessionToken&&{sessionToken:r.SessionToken},...r.Expiration&&{expiration:new Date(r.Expiration)},...r.CredentialScope&&{credentialScope:r.CredentialScope},...o&&{accountId:o}};return(0,d.g)(n,"CREDENTIALS_PROCESS","w"),n})(e,s,r)}catch(e){throw new s.C(e.message,{logger:t})}}}},f=(e={})=>async({callerClientConfig:r}={})=>{e.logger?.debug("@aws-sdk/credential-provider-process - fromProcess");const t=await(0,o.Y)(e);return l((0,n.Bz)({profile:e.profile??r?.profile}),t,e.logger)}},837(e,r,t){t.d(r,{Z:()=>s});var o=t(832),n=t(67);const s={getFileRecord:()=>n.Jj,interceptFile(e,r){n.Jj[e]=Promise.resolve(r)},getTokenRecord:()=>o.a,interceptToken(e,r){o.a[e]=r}}},833(e,r,t){t.d(r,{C:()=>c});var o=t(5),n=t(3),s=t(65);const c=e=>{const r=(0,o.createHash)("sha1").update(e).digest("hex");return(0,n.join)((0,s.R)(),".aws","sso","cache",`${r}.json`)}},832(e,r,t){t.d(r,{a:()=>s,v:()=>c});var o=t(27),n=t(833);const s={},c=async e=>{if(s[e])return s[e];const r=(0,n.C)(e),t=await(0,o.readFile)(r,"utf8");return JSON.parse(t)}}};
3
3
  //# sourceMappingURL=876.index.js.map
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ "use strict";exports.id=896,exports.ids=[896],exports.modules={843(e,t,s){s.d(t,{GetRoleCredentialsCommand:()=>H,SSOClient:()=>yt});var n=s(133),o=s(134);const r={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}};var i=s(116),a=s(119);class c extends a.T{constructor(e){super(e),Object.setPrototypeOf(this,c.prototype)}}class p extends c{name="InvalidRequestException";$fault="client";constructor(e){super({name:"InvalidRequestException",$fault:"client",...e}),Object.setPrototypeOf(this,p.prototype)}}class u extends c{name="ResourceNotFoundException";$fault="client";constructor(e){super({name:"ResourceNotFoundException",$fault:"client",...e}),Object.setPrototypeOf(this,u.prototype)}}class d extends c{name="TooManyRequestsException";$fault="client";constructor(e){super({name:"TooManyRequestsException",$fault:"client",...e}),Object.setPrototypeOf(this,d.prototype)}}class l extends c{name="UnauthorizedException";$fault="client";constructor(e){super({name:"UnauthorizedException",$fault:"client",...e}),Object.setPrototypeOf(this,l.prototype)}}const h="accountId",m="accessToken",g="account_id",y="client",S="error",v="http",f="httpError",P="httpHeader",R="httpQuery",x="message",E="roleName",b="smithy.ts.sdk.synthetic.com.amazonaws.sso",I="x-amz-sso_bearer_token",w="com.amazonaws.sso",k=i.O.for(b);var A=[-3,b,"SSOServiceException",0,[],[]];k.registerError(A,c);const C=i.O.for(w);var D=[-3,w,"InvalidRequestException",{[S]:y,[f]:400},[x],[0]];C.registerError(D,p);var F=[-3,w,"ResourceNotFoundException",{[S]:y,[f]:404},[x],[0]];C.registerError(F,u);var O=[-3,w,"TooManyRequestsException",{[S]:y,[f]:429},[x],[0]];C.registerError(O,d);var T=[-3,w,"UnauthorizedException",{[S]:y,[f]:401},[x],[0]];C.registerError(T,l);const U=[k,C];var q=[0,w,"AccessTokenType",8,0],j=[0,w,"SecretAccessKeyType",8,0],z=[0,w,"SessionTokenType",8,0],G=[3,w,"GetRoleCredentialsRequest",0,[E,h,m],[[0,{[R]:"role_name"}],[0,{[R]:g}],[()=>q,{[P]:I}]],3],$=[3,w,"GetRoleCredentialsResponse",0,["roleCredentials"],[[()=>M,0]]],M=[3,w,"RoleCredentials",0,["accessKeyId","secretAccessKey","sessionToken","expiration"],[0,[()=>j,0],[()=>z,0],1]],N=[9,w,"GetRoleCredentials",{[v]:["GET","/federation/credentials",200]},()=>G,()=>$];class H extends(o.u.classBuilder().ep(r).m(function(e,t,s,o){return[(0,n.r)(s,e.getEndpointParameterInstructions())]}).s("SWBPortalService","GetRoleCredentials",{}).n("SSOClient","GetRoleCredentialsCommand").sc(N).build()){}var L=s(32),_=s(34),K=s(35),B=s(36),V=s(38),W=s(43),Q=s(45),J=s(44),X=s(48),Y=s(49),Z=s(51),ee=s(52),te=s(70),se=s(74),ne=s(77),oe=s(79),re=s(46),ie=s(53);const ae=async(e,t,s)=>({operation:(0,re.u)(t).operation,region:await(0,ie.t)(e.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});const ce=e=>{const t=[];switch(e.operation){case"GetRoleCredentials":case"ListAccountRoles":case"ListAccounts":case"Logout":t.push({schemeId:"smithy.api#noAuth"});break;default:t.push(function(e){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"awsssoportal",region:e.region},propertiesExtractor:(e,t)=>({signingProperties:{config:e,context:t}})}}(e))}return t},pe="3.996.0";var ue=s(87),de=s(88),le=s(90),he=s(92),me=s(93),ge=s(94),ye=s(97),Se=s(98),ve=s(55),fe=s(99),Pe=s(100),Re=s(102),xe=s(101),Ee=s(103),be=s(105),Ie=s(71),we=s(106),ke=s(844),Ae=s(848),Ce=s(75),De=s(69),Fe=s(112),Oe=s(113),Te=s(83),Ue=s(114),qe=s(39),je=s(128),ze=s(129),Ge=s(40);const $e="required",Me="fn",Ne="argv",He="ref",Le=!0,_e="isSet",Ke="booleanEquals",Be="error",Ve="endpoint",We="tree",Qe="PartitionResult",Je="getAttr",Xe={[$e]:!1,type:"string"},Ye={[$e]:!0,default:!1,type:"boolean"},Ze={[He]:"Endpoint"},et={[Me]:Ke,[Ne]:[{[He]:"UseFIPS"},!0]},tt={[Me]:Ke,[Ne]:[{[He]:"UseDualStack"},!0]},st={},nt={[Me]:Je,[Ne]:[{[He]:Qe},"supportsFIPS"]},ot={[He]:Qe},rt={[Me]:Ke,[Ne]:[!0,{[Me]:Je,[Ne]:[ot,"supportsDualStack"]}]},it=[et],at=[tt],ct=[{[He]:"Region"}],pt={version:"1.0",parameters:{Region:Xe,UseDualStack:Ye,UseFIPS:Ye,Endpoint:Xe},rules:[{conditions:[{[Me]:_e,[Ne]:[Ze]}],rules:[{conditions:it,error:"Invalid Configuration: FIPS and custom endpoint are not supported",type:Be},{conditions:at,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",type:Be},{endpoint:{url:Ze,properties:st,headers:st},type:Ve}],type:We},{conditions:[{[Me]:_e,[Ne]:ct}],rules:[{conditions:[{[Me]:"aws.partition",[Ne]:ct,assign:Qe}],rules:[{conditions:[et,tt],rules:[{conditions:[{[Me]:Ke,[Ne]:[Le,nt]},rt],rules:[{endpoint:{url:"https://portal.sso-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:st,headers:st},type:Ve}],type:We},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",type:Be}],type:We},{conditions:it,rules:[{conditions:[{[Me]:Ke,[Ne]:[nt,Le]}],rules:[{conditions:[{[Me]:"stringEquals",[Ne]:[{[Me]:Je,[Ne]:[ot,"name"]},"aws-us-gov"]}],endpoint:{url:"https://portal.sso.{Region}.amazonaws.com",properties:st,headers:st},type:Ve},{endpoint:{url:"https://portal.sso-fips.{Region}.{PartitionResult#dnsSuffix}",properties:st,headers:st},type:Ve}],type:We},{error:"FIPS is enabled but this partition does not support FIPS",type:Be}],type:We},{conditions:at,rules:[{conditions:[rt],rules:[{endpoint:{url:"https://portal.sso.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:st,headers:st},type:Ve}],type:We},{error:"DualStack is enabled but this partition does not support DualStack",type:Be}],type:We},{endpoint:{url:"https://portal.sso.{Region}.{PartitionResult#dnsSuffix}",properties:st,headers:st},type:Ve}],type:We}],type:We},{error:"Invalid Configuration: Missing Region",type:Be}]},ut=new je.k({size:50,params:["Endpoint","Region","UseDualStack","UseFIPS"]}),dt=(e,t={})=>ut.get(e,()=>(0,ze.s)(pt,{endpointParams:e,logger:t.logger}));Ge.m.aws=qe.UF;const lt=e=>{(0,Re.I)(process.version);const t=(0,be.I)(e),s=()=>t().then(xe.l),n=(e=>({apiVersion:"2019-06-10",base64Decoder:e?.base64Decoder??Fe.E,base64Encoder:e?.base64Encoder??Oe.n,disableHostPrefix:e?.disableHostPrefix??!1,endpointProvider:e?.endpointProvider??dt,extensions:e?.extensions??[],httpAuthSchemeProvider:e?.httpAuthSchemeProvider??ce,httpAuthSchemes:e?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4"),signer:new we.f2},{schemeId:"smithy.api#noAuth",identityProvider:e=>e.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new Ae.m}],logger:e?.logger??new Ce.N,protocol:e?.protocol??ke.Y,protocolSettings:e?.protocolSettings??{defaultNamespace:"com.amazonaws.sso",errorTypeRegistries:U,version:"2019-06-10",serviceTarget:"SWBPortalService"},serviceId:e?.serviceId??"SSO",urlParser:e?.urlParser??De.D,utf8Decoder:e?.utf8Decoder??Te.a,utf8Encoder:e?.utf8Encoder??Ue.P}))(e);(0,ue.I)(process.version);const o={profile:e?.profile,logger:n.logger};return{...n,...e,runtime:"node",defaultsMode:t,authSchemePreference:e?.authSchemePreference??(0,ve.Z)(de.$,o),bodyLengthChecker:e?.bodyLengthChecker??Ee.n,defaultUserAgentProvider:e?.defaultUserAgentProvider??(0,le.pf)({serviceId:n.serviceId,clientVersion:pe}),maxAttempts:e?.maxAttempts??(0,ve.Z)(te.qs,e),region:e?.region??(0,ve.Z)(me.GG,{...me.zH,...o}),requestHandler:fe.$.create(e?.requestHandler??s),retryMode:e?.retryMode??(0,ve.Z)({...te.kN,default:async()=>(await s()).retryMode||Ie.L0},e),sha256:e?.sha256??Se.V.bind(null,"sha256"),streamCollector:e?.streamCollector??Pe.k,useDualstackEndpoint:e?.useDualstackEndpoint??(0,ve.Z)(ge.e$,o),useFipsEndpoint:e?.useFipsEndpoint??(0,ve.Z)(ye.Ko,o),userAgentAppId:e?.userAgentAppId??(0,ve.Z)(he.hV,o)}};var ht=s(130),mt=s(131),gt=s(132);class yt extends ne.K{config;constructor(...[e]){const t=lt(e||{});super(t),this.initConfig=t;const s=(n=t,Object.assign(n,{useDualstackEndpoint:n.useDualstackEndpoint??!1,useFipsEndpoint:n.useFipsEndpoint??!1,defaultSigningName:"awsssoportal"}));var n;const o=(0,B.D)(s),r=(0,te.$z)(o),i=(0,W.T)(r),a=(0,L.OV)(i),c=((e,t)=>{const s=Object.assign((0,ht.R)(e),(0,gt.xA)(e),(0,mt.e)(e),(e=>{const t=e.httpAuthSchemes;let s=e.httpAuthSchemeProvider,n=e.credentials;return{setHttpAuthScheme(e){const s=t.findIndex(t=>t.schemeId===e.schemeId);-1===s?t.push(e):t.splice(s,1,e)},httpAuthSchemes:()=>t,setHttpAuthSchemeProvider(e){s=e},httpAuthSchemeProvider:()=>s,setCredentials(e){n=e},credentials:()=>n}})(e));return t.forEach(e=>e.configure(s)),Object.assign(e,(0,ht.$)(s),(0,gt.uv)(s),(0,mt.j)(s),{httpAuthSchemes:(n=s).httpAuthSchemes(),httpAuthSchemeProvider:n.httpAuthSchemeProvider(),credentials:n.credentials()});var n})((e=>{const t=(0,oe.h)(e);return Object.assign(t,{authSchemePreference:(0,ie.t)(e.authSchemePreference??[])})})((0,ee.C)(a)),e?.extensions||[]);this.config=c,this.middlewareStack.use((0,Y.wq)(this.config)),this.middlewareStack.use((0,V.sM)(this.config)),this.middlewareStack.use((0,se.ey)(this.config)),this.middlewareStack.use((0,Z.vK)(this.config)),this.middlewareStack.use((0,L.TC)(this.config)),this.middlewareStack.use((0,_.Y7)(this.config)),this.middlewareStack.use((0,K.n)(this.config)),this.middlewareStack.use((0,Q.w)(this.config,{httpAuthSchemeParametersProvider:ae,identityProviderConfigProvider:async e=>new J.h({"aws.auth#sigv4":e.credentials})})),this.middlewareStack.use((0,X.l)(this.config))}destroy(){super.destroy()}}}};
3
+ //# sourceMappingURL=896.index.js.map
package/dist/960.index.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- "use strict";exports.id=960,exports.ids=[960],exports.modules={852(r,s,t){t.d(s,{fromEnv:()=>e.sF});var e=t(88)}};
2
+ "use strict";exports.id=960,exports.ids=[960],exports.modules={852(r,s,t){t.d(s,{fromEnv:()=>e.sF});var e=t(89)}};
package/dist/963.index.js CHANGED
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
- "use strict";exports.id=963,exports.ids=[963],exports.modules={839(e,t,r){r.d(t,{fromHttp:()=>w});var o=r(79),n=r(98),a=r(58),s=r(27),i=r.n(s);var c=r(33),f=r(122),l=r(840);const w=(e={})=>{let t;e.logger?.debug("@aws-sdk/credential-provider-http - fromHttp");const r=e.awsContainerCredentialsRelativeUri??process.env.AWS_CONTAINER_CREDENTIALS_RELATIVE_URI,s=e.awsContainerCredentialsFullUri??process.env.AWS_CONTAINER_CREDENTIALS_FULL_URI,w=e.awsContainerAuthorizationToken??process.env.AWS_CONTAINER_AUTHORIZATION_TOKEN,u=e.awsContainerAuthorizationTokenFile??process.env.AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE,d="NoOpLogger"!==e.logger?.constructor?.name&&e.logger?.warn?e.logger.warn.bind(e.logger):console.warn;if(r&&s&&(d("@aws-sdk/credential-provider-http: you have set both awsContainerCredentialsRelativeUri and awsContainerCredentialsFullUri."),d("awsContainerCredentialsFullUri will take precedence.")),w&&u&&(d("@aws-sdk/credential-provider-http: you have set both awsContainerAuthorizationToken and awsContainerAuthorizationTokenFile."),d("awsContainerAuthorizationToken will take precedence.")),s)t=s;else{if(!r)throw new a.C("No HTTP credential provider host provided.\nSet AWS_CONTAINER_CREDENTIALS_FULL_URI or AWS_CONTAINER_CREDENTIALS_RELATIVE_URI.",{logger:e.logger});t=`http://169.254.170.2${r}`}const p=new URL(t);((e,t)=>{if("https:"!==e.protocol&&"169.254.170.2"!==e.hostname&&"169.254.170.23"!==e.hostname&&"[fd00:ec2::23]"!==e.hostname){if(e.hostname.includes("[")){if("[::1]"===e.hostname||"[0000:0000:0000:0000:0000:0000:0000:0001]"===e.hostname)return}else{if("localhost"===e.hostname)return;const t=e.hostname.split("."),r=e=>{const t=parseInt(e,10);return 0<=t&&t<=255};if("127"===t[0]&&r(t[1])&&r(t[2])&&r(t[3])&&4===t.length)return}throw new a.C("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:t})}})(p,e.logger);const h=n.$.create({requestTimeout:e.timeout??1e3,connectionTimeout:e.timeout??1e3});return y=async()=>{const t=function(e){return new c.K({protocol:e.protocol,hostname:e.hostname,port:Number(e.port),path:e.pathname,query:Array.from(e.searchParams.entries()).reduce((e,[t,r])=>(e[t]=r,e),{}),fragment:e.hash})}(p);w?t.headers.Authorization=w:u&&(t.headers.Authorization=(await i().readFile(u)).toString());try{return async function(e,t){const r=(0,l.c)(e.body),o=await r.transformToString();if(200===e.statusCode){const e=JSON.parse(o);if("string"!=typeof e.AccessKeyId||"string"!=typeof e.SecretAccessKey||"string"!=typeof e.Token||"string"!=typeof e.Expiration)throw new a.C("HTTP credential provider response not of the required format, an object matching: { AccessKeyId: string, SecretAccessKey: string, Token: string, Expiration: string(rfc3339) }",{logger:t});return{accessKeyId:e.AccessKeyId,secretAccessKey:e.SecretAccessKey,sessionToken:e.Token,expiration:(0,f.EI)(e.Expiration)}}if(e.statusCode>=400&&e.statusCode<500){let r={};try{r=JSON.parse(o)}catch(e){}throw Object.assign(new a.C(`Server responded with status: ${e.statusCode}`,{logger:t}),{Code:r.Code,Message:r.Message})}throw new a.C(`Server responded with status: ${e.statusCode}`,{logger:t})}((await h.handle(t)).response).then(e=>(0,o.g)(e,"CREDENTIALS_HTTP","z"))}catch(t){throw new a.C(String(t),{logger:e.logger})}},m=e.maxRetries??3,b=e.timeout??1e3,async()=>{for(let e=0;e<m;++e)try{return await y()}catch(e){await new Promise(e=>setTimeout(e,b))}return await y()};var y,m,b}},840(e,t,r){r.d(t,{c:()=>y});var o=r(99),n=r(83),a=r(8),s=r(111);const i=async e=>"function"==typeof Blob&&e instanceof Blob||"Blob"===e.constructor?.name?void 0!==Blob.prototype.arrayBuffer?new Uint8Array(await e.arrayBuffer()):async function(e){const t=await function(e){return new Promise((t,r)=>{const o=new FileReader;o.onloadend=()=>{if(2!==o.readyState)return r(new Error("Reader aborted too early"));const e=o.result??"",n=e.indexOf(","),a=n>-1?n+1:e.length;t(e.substring(a))},o.onabort=()=>r(new Error("Read aborted")),o.onerror=()=>r(o.error),o.readAsDataURL(e)})}(e),r=(0,s.E)(t);return new Uint8Array(r)}(e):async function(e){const t=[],r=e.getReader();let o=!1,n=0;for(;!o;){const{done:e,value:a}=await r.read();a&&(t.push(a),n+=a.length),o=e}const a=new Uint8Array(n);let s=0;for(const e of t)a.set(e,s),s+=e.length;return a}(e);var c=r(112),f=r(80),l=r(113);const w=e=>"function"==typeof ReadableStream&&(e?.constructor?.name===ReadableStream.name||e instanceof ReadableStream),u="The stream has already been transformed.",d=e=>{if(!p(e)&&!w(e)){throw new Error(`Unexpected stream implementation, expect Blob or ReadableStream, got ${e?.__proto__?.constructor?.name||e}`)}let t=!1;const r=async()=>{if(t)throw new Error(u);return t=!0,await i(e)};return Object.assign(e,{transformToByteArray:r,transformToString:async e=>{const t=await r();if("base64"===e)return(0,c.n)(t);if("hex"===e)return(0,f.n)(t);if(void 0===e||"utf8"===e||"utf-8"===e)return(0,l.P)(t);if("function"==typeof TextDecoder)return new TextDecoder(e).decode(t);throw new Error("TextDecoder is not available, please make sure polyfill is provided.")},transformToWebStream:()=>{if(t)throw new Error(u);if(t=!0,p(e))return(e=>{if("function"!=typeof e.stream)throw new Error("Cannot transform payload Blob to web stream. Please make sure the Blob.stream() is polyfilled.\nIf you are using React Native, this API is not yet supported, see: https://react-native.canny.io/feature-requests/p/fetch-streaming-body");return e.stream()})(e);if(w(e))return e;throw new Error(`Cannot transform payload to web stream, got ${e}`)}})},p=e=>"function"==typeof Blob&&e instanceof Blob,h="The stream has already been transformed.",y=e=>{if(!(e instanceof a.Readable))try{return d(e)}catch(t){throw new Error(`Unexpected stream implementation, expect Stream.Readable instance, got ${e?.__proto__?.constructor?.name||e}`)}let t=!1;const r=async()=>{if(t)throw new Error(h);return t=!0,await(0,o.k)(e)};return Object.assign(e,{transformToByteArray:r,transformToString:async e=>{const t=await r();if(void 0===e||Buffer.isEncoding(e))return(0,n.Q)(t.buffer,t.byteOffset,t.byteLength).toString(e);return new TextDecoder(e).decode(t)},transformToWebStream:()=>{if(t)throw new Error(h);if(null!==e.readableFlowing)throw new Error("The stream has been consumed by other callbacks.");if("function"!=typeof a.Readable.toWeb)throw new Error("Readable.toWeb() is not supported. Please ensure a polyfill is available.");return t=!0,a.Readable.toWeb(e)}})}}};
2
+ "use strict";exports.id=963,exports.ids=[963],exports.modules={840(e,t,r){r.d(t,{fromHttp:()=>w});var o=r(80),n=r(99),a=r(59),s=r(27),i=r.n(s);var c=r(33),f=r(123),l=r(841);const w=(e={})=>{let t;e.logger?.debug("@aws-sdk/credential-provider-http - fromHttp");const r=e.awsContainerCredentialsRelativeUri??process.env.AWS_CONTAINER_CREDENTIALS_RELATIVE_URI,s=e.awsContainerCredentialsFullUri??process.env.AWS_CONTAINER_CREDENTIALS_FULL_URI,w=e.awsContainerAuthorizationToken??process.env.AWS_CONTAINER_AUTHORIZATION_TOKEN,u=e.awsContainerAuthorizationTokenFile??process.env.AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE,d="NoOpLogger"!==e.logger?.constructor?.name&&e.logger?.warn?e.logger.warn.bind(e.logger):console.warn;if(r&&s&&(d("@aws-sdk/credential-provider-http: you have set both awsContainerCredentialsRelativeUri and awsContainerCredentialsFullUri."),d("awsContainerCredentialsFullUri will take precedence.")),w&&u&&(d("@aws-sdk/credential-provider-http: you have set both awsContainerAuthorizationToken and awsContainerAuthorizationTokenFile."),d("awsContainerAuthorizationToken will take precedence.")),s)t=s;else{if(!r)throw new a.C("No HTTP credential provider host provided.\nSet AWS_CONTAINER_CREDENTIALS_FULL_URI or AWS_CONTAINER_CREDENTIALS_RELATIVE_URI.",{logger:e.logger});t=`http://169.254.170.2${r}`}const p=new URL(t);((e,t)=>{if("https:"!==e.protocol&&"169.254.170.2"!==e.hostname&&"169.254.170.23"!==e.hostname&&"[fd00:ec2::23]"!==e.hostname){if(e.hostname.includes("[")){if("[::1]"===e.hostname||"[0000:0000:0000:0000:0000:0000:0000:0001]"===e.hostname)return}else{if("localhost"===e.hostname)return;const t=e.hostname.split("."),r=e=>{const t=parseInt(e,10);return 0<=t&&t<=255};if("127"===t[0]&&r(t[1])&&r(t[2])&&r(t[3])&&4===t.length)return}throw new a.C("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:t})}})(p,e.logger);const h=n.$.create({requestTimeout:e.timeout??1e3,connectionTimeout:e.timeout??1e3});return y=async()=>{const t=function(e){return new c.K({protocol:e.protocol,hostname:e.hostname,port:Number(e.port),path:e.pathname,query:Array.from(e.searchParams.entries()).reduce((e,[t,r])=>(e[t]=r,e),{}),fragment:e.hash})}(p);w?t.headers.Authorization=w:u&&(t.headers.Authorization=(await i().readFile(u)).toString());try{return async function(e,t){const r=(0,l.c)(e.body),o=await r.transformToString();if(200===e.statusCode){const e=JSON.parse(o);if("string"!=typeof e.AccessKeyId||"string"!=typeof e.SecretAccessKey||"string"!=typeof e.Token||"string"!=typeof e.Expiration)throw new a.C("HTTP credential provider response not of the required format, an object matching: { AccessKeyId: string, SecretAccessKey: string, Token: string, Expiration: string(rfc3339) }",{logger:t});return{accessKeyId:e.AccessKeyId,secretAccessKey:e.SecretAccessKey,sessionToken:e.Token,expiration:(0,f.EI)(e.Expiration)}}if(e.statusCode>=400&&e.statusCode<500){let r={};try{r=JSON.parse(o)}catch(e){}throw Object.assign(new a.C(`Server responded with status: ${e.statusCode}`,{logger:t}),{Code:r.Code,Message:r.Message})}throw new a.C(`Server responded with status: ${e.statusCode}`,{logger:t})}((await h.handle(t)).response).then(e=>(0,o.g)(e,"CREDENTIALS_HTTP","z"))}catch(t){throw new a.C(String(t),{logger:e.logger})}},m=e.maxRetries??3,b=e.timeout??1e3,async()=>{for(let e=0;e<m;++e)try{return await y()}catch(e){await new Promise(e=>setTimeout(e,b))}return await y()};var y,m,b}},841(e,t,r){r.d(t,{c:()=>y});var o=r(100),n=r(84),a=r(8),s=r(112);const i=async e=>"function"==typeof Blob&&e instanceof Blob||"Blob"===e.constructor?.name?void 0!==Blob.prototype.arrayBuffer?new Uint8Array(await e.arrayBuffer()):async function(e){const t=await function(e){return new Promise((t,r)=>{const o=new FileReader;o.onloadend=()=>{if(2!==o.readyState)return r(new Error("Reader aborted too early"));const e=o.result??"",n=e.indexOf(","),a=n>-1?n+1:e.length;t(e.substring(a))},o.onabort=()=>r(new Error("Read aborted")),o.onerror=()=>r(o.error),o.readAsDataURL(e)})}(e),r=(0,s.E)(t);return new Uint8Array(r)}(e):async function(e){const t=[],r=e.getReader();let o=!1,n=0;for(;!o;){const{done:e,value:a}=await r.read();a&&(t.push(a),n+=a.length),o=e}const a=new Uint8Array(n);let s=0;for(const e of t)a.set(e,s),s+=e.length;return a}(e);var c=r(113),f=r(81),l=r(114);const w=e=>"function"==typeof ReadableStream&&(e?.constructor?.name===ReadableStream.name||e instanceof ReadableStream),u="The stream has already been transformed.",d=e=>{if(!p(e)&&!w(e)){throw new Error(`Unexpected stream implementation, expect Blob or ReadableStream, got ${e?.__proto__?.constructor?.name||e}`)}let t=!1;const r=async()=>{if(t)throw new Error(u);return t=!0,await i(e)};return Object.assign(e,{transformToByteArray:r,transformToString:async e=>{const t=await r();if("base64"===e)return(0,c.n)(t);if("hex"===e)return(0,f.n)(t);if(void 0===e||"utf8"===e||"utf-8"===e)return(0,l.P)(t);if("function"==typeof TextDecoder)return new TextDecoder(e).decode(t);throw new Error("TextDecoder is not available, please make sure polyfill is provided.")},transformToWebStream:()=>{if(t)throw new Error(u);if(t=!0,p(e))return(e=>{if("function"!=typeof e.stream)throw new Error("Cannot transform payload Blob to web stream. Please make sure the Blob.stream() is polyfilled.\nIf you are using React Native, this API is not yet supported, see: https://react-native.canny.io/feature-requests/p/fetch-streaming-body");return e.stream()})(e);if(w(e))return e;throw new Error(`Cannot transform payload to web stream, got ${e}`)}})},p=e=>"function"==typeof Blob&&e instanceof Blob,h="The stream has already been transformed.",y=e=>{if(!(e instanceof a.Readable))try{return d(e)}catch(t){throw new Error(`Unexpected stream implementation, expect Stream.Readable instance, got ${e?.__proto__?.constructor?.name||e}`)}let t=!1;const r=async()=>{if(t)throw new Error(h);return t=!0,await(0,o.k)(e)};return Object.assign(e,{transformToByteArray:r,transformToString:async e=>{const t=await r();if(void 0===e||Buffer.isEncoding(e))return(0,n.Q)(t.buffer,t.byteOffset,t.byteLength).toString(e);return new TextDecoder(e).decode(t)},transformToWebStream:()=>{if(t)throw new Error(h);if(null!==e.readableFlowing)throw new Error("The stream has been consumed by other callbacks.");if("function"!=typeof a.Readable.toWeb)throw new Error("Readable.toWeb() is not supported. Please ensure a polyfill is available.");return t=!0,a.Readable.toWeb(e)}})}}};
3
3
  //# sourceMappingURL=963.index.js.map
package/dist/974.index.js CHANGED
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
- "use strict";exports.id=974,exports.ids=[593,974],exports.modules={829(e,o,s){s.d(o,{fromSSO:()=>N});var t=s(58),n=s(59),r=s(830),i=s(63),a=s(61),c=s(62);const l=e=>Object.entries(e).filter(([e])=>e.startsWith(a.I.SSO_SESSION+c.Q)).reduce((e,[o,s])=>({...e,[o.substring(o.indexOf(c.Q)+1)]:s}),{});var f=s(65),g=s(66);const w=()=>({}),h=async(e={})=>(0,g.TA)(e.configFilepath??(0,i.g)()).then(f.A).then(l).catch(w);var d=s(79),p=s(56);class u extends p.m{name="TokenProviderError";constructor(e,o=!0){super(e,o),Object.setPrototypeOf(this,u.prototype)}}var S=s(831);const C="To refresh this SSO session run 'aws sso login' with the corresponding profile.",y=async(e,o,t={},n)=>{const{CreateTokenCommand:r}=await Promise.all([s.e(372),s.e(224)]).then(s.bind(s,848)),i=await(async(e,o={},t)=>{const{SSOOIDCClient:n}=await Promise.all([s.e(372),s.e(224)]).then(s.bind(s,848)),r=e=>o.clientConfig?.[e]??o.parentClientConfig?.[e]??t?.[e];return new n(Object.assign({},o.clientConfig??{},{region:e??o.clientConfig?.region,logger:r("logger"),userAgentAppId:r("userAgentAppId")}))})(o,t,n);return i.send(new r({clientId:e.clientId,clientSecret:e.clientSecret,refreshToken:e.refreshToken,grantType:"refresh_token"}))},k=e=>{if(e.expiration&&e.expiration.getTime()<Date.now())throw new u(`Token is expired. ${C}`,!1)},m=(e,o,s=!1)=>{if(void 0===o)throw new u(`Value not present for '${e}' in SSO Token${s?". Cannot refresh":""}. ${C}`,!1)};var _=s(832),O=s(6);const{writeFile:x}=O.promises,T=new Date(0),A=(e={})=>async({callerClientConfig:o}={})=>{e.logger?.debug("@aws-sdk/token-providers - fromSso");const s=await(0,r.Y)(e),t=(0,n.Bz)({profile:e.profile??o?.profile}),i=s[t];if(!i)throw new u(`Profile '${t}' could not be found in shared credentials file.`,!1);if(!i.sso_session)throw new u(`Profile '${t}' is missing required property 'sso_session'.`);const a=i.sso_session,c=(await h(e))[a];if(!c)throw new u(`Sso session '${a}' could not be found in shared credentials file.`,!1);for(const e of["sso_start_url","sso_region"])if(!c[e])throw new u(`Sso session '${a}' is missing required property '${e}'.`,!1);c.sso_start_url;const l=c.sso_region;let f;try{f=await(0,S.v)(a)}catch(e){throw new u(`The SSO session token associated with profile=${t} was not found or is invalid. ${C}`,!1)}m("accessToken",f.accessToken),m("expiresAt",f.expiresAt);const{accessToken:g,expiresAt:w}=f,d={token:g,expiration:new Date(w)};if(d.expiration.getTime()-Date.now()>3e5)return d;if(Date.now()-T.getTime()<3e4)return k(d),d;m("clientId",f.clientId,!0),m("clientSecret",f.clientSecret,!0),m("refreshToken",f.refreshToken,!0);try{T.setTime(Date.now());const s=await y(f,l,e,o);m("accessToken",s.accessToken),m("expiresIn",s.expiresIn);const t=new Date(Date.now()+1e3*s.expiresIn);try{await((e,o)=>{const s=(0,_.C)(e),t=JSON.stringify(o,null,2);return x(s,t)})(a,{...f,accessToken:s.accessToken,expiresAt:t.toISOString(),refreshToken:s.refreshToken})}catch(e){}return{token:s.accessToken,expiration:t}}catch(e){return k(d),d}},I=!1,v=async({ssoStartUrl:e,ssoSession:o,ssoAccountId:n,ssoRegion:r,ssoRoleName:i,ssoClient:a,clientConfig:c,parentClientConfig:l,callerClientConfig:f,profile:g,filepath:w,configFilepath:h,ignoreCache:p,logger:u})=>{let C;const y="To refresh this SSO session run aws sso login with the corresponding profile.";if(o)try{const e=await A({profile:g,filepath:w,configFilepath:h,ignoreCache:p})();C={accessToken:e.token,expiresAt:new Date(e.expiration).toISOString()}}catch(e){throw new t.C(e.message,{tryNextLink:I,logger:u})}else try{C=await(0,S.v)(e)}catch(e){throw new t.C(`The SSO session associated with this profile is invalid. ${y}`,{tryNextLink:I,logger:u})}if(new Date(C.expiresAt).getTime()-Date.now()<=0)throw new t.C(`The SSO session associated with this profile has expired. ${y}`,{tryNextLink:I,logger:u});const{accessToken:k}=C,{SSOClient:m,GetRoleCredentialsCommand:_}=await Promise.all([s.e(372),s.e(365)]).then(s.bind(s,842)),O=a||new m(Object.assign({},c??{},{logger:c?.logger??f?.logger??l?.logger,region:c?.region??r,userAgentAppId:c?.userAgentAppId??f?.userAgentAppId??l?.userAgentAppId}));let x;try{x=await O.send(new _({accountId:n,roleName:i,accessToken:k}))}catch(e){throw new t.C(e,{tryNextLink:I,logger:u})}const{roleCredentials:{accessKeyId:T,secretAccessKey:v,sessionToken:N,expiration:$,credentialScope:D,accountId:R}={}}=x;if(!(T&&v&&N&&$))throw new t.C("SSO returns an invalid temporary credential.",{tryNextLink:I,logger:u});const L={accessKeyId:T,secretAccessKey:v,sessionToken:N,expiration:new Date($),...D&&{credentialScope:D},...R&&{accountId:R}};return o?(0,d.g)(L,"CREDENTIALS_SSO","s"):(0,d.g)(L,"CREDENTIALS_SSO_LEGACY","u"),L},N=(e={})=>async({callerClientConfig:o}={})=>{e.logger?.debug("@aws-sdk/credential-provider-sso - fromSSO");const{ssoStartUrl:s,ssoAccountId:i,ssoRegion:a,ssoRoleName:c,ssoSession:l}=e,{ssoClient:f}=e,g=(0,n.Bz)({profile:e.profile??o?.profile});if(s||i||a||c||l){if(s&&i&&a&&c)return v({ssoStartUrl:s,ssoSession:l,ssoAccountId:i,ssoRegion:a,ssoRoleName:c,ssoClient:f,clientConfig:e.clientConfig,parentClientConfig:e.parentClientConfig,callerClientConfig:e.callerClientConfig,profile:g,filepath:e.filepath,configFilepath:e.configFilepath,ignoreCache:e.ignoreCache,logger:e.logger});throw new t.C('Incomplete configuration. The fromSSO() argument hash must include "ssoStartUrl", "ssoAccountId", "ssoRegion", "ssoRoleName"',{tryNextLink:!1,logger:e.logger})}{const o=(await(0,r.Y)(e))[g];if(!o)throw new t.C(`Profile ${g} was not found.`,{logger:e.logger});if(!(w=o)||"string"!=typeof w.sso_start_url&&"string"!=typeof w.sso_account_id&&"string"!=typeof w.sso_session&&"string"!=typeof w.sso_region&&"string"!=typeof w.sso_role_name)throw new t.C(`Profile ${g} is not configured with SSO credentials.`,{logger:e.logger});if(o?.sso_session){const n=(await h(e))[o.sso_session],r=` configurations in profile ${g} and sso-session ${o.sso_session}`;if(a&&a!==n.sso_region)throw new t.C("Conflicting SSO region"+r,{tryNextLink:!1,logger:e.logger});if(s&&s!==n.sso_start_url)throw new t.C("Conflicting SSO start_url"+r,{tryNextLink:!1,logger:e.logger});o.sso_region=n.sso_region,o.sso_start_url=n.sso_start_url}const{sso_start_url:n,sso_account_id:i,sso_region:c,sso_role_name:l,sso_session:d}=((e,o)=>{const{sso_start_url:s,sso_account_id:n,sso_region:r,sso_role_name:i}=e;if(!(s&&n&&r&&i))throw new t.C(`Profile is configured with invalid SSO credentials. Required parameters "sso_account_id", "sso_region", "sso_role_name", "sso_start_url". Got ${Object.keys(e).join(", ")}\nReference: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sso.html`,{tryNextLink:!1,logger:o});return e})(o,e.logger);return v({ssoStartUrl:n,ssoSession:d,ssoAccountId:i,ssoRegion:c,ssoRoleName:l,ssoClient:f,clientConfig:e.clientConfig,parentClientConfig:e.parentClientConfig,callerClientConfig:e.callerClientConfig,profile:g,filepath:e.filepath,configFilepath:e.configFilepath,ignoreCache:e.ignoreCache,logger:e.logger})}var w}},832(e,o,s){s.d(o,{C:()=>i});var t=s(5),n=s(3),r=s(64);const i=e=>{const o=(0,t.createHash)("sha1").update(e).digest("hex");return(0,n.join)((0,r.R)(),".aws","sso","cache",`${o}.json`)}},831(e,o,s){s.d(o,{a:()=>r,v:()=>i});var t=s(27),n=s(832);const r={},i=async e=>{if(r[e])return r[e];const o=(0,n.C)(e),s=await(0,t.readFile)(o,"utf8");return JSON.parse(s)}},830(e,o,s){s.d(o,{Y:()=>n});var t=s(60);const n=async e=>{const o=await(0,t.p)(e);return((...e)=>{const o={};for(const s of e)for(const[e,t]of Object.entries(s))void 0!==o[e]?Object.assign(o[e],t):o[e]=t;return o})(o.configFile,o.credentialsFile)}}};
2
+ "use strict";exports.id=974,exports.ids=[593,974],exports.modules={830(e,o,s){s.d(o,{fromSSO:()=>N});var t=s(59),n=s(60),r=s(831),i=s(64),a=s(62),c=s(63);const l=e=>Object.entries(e).filter(([e])=>e.startsWith(a.I.SSO_SESSION+c.Q)).reduce((e,[o,s])=>({...e,[o.substring(o.indexOf(c.Q)+1)]:s}),{});var f=s(66),g=s(67);const w=()=>({}),h=async(e={})=>(0,g.TA)(e.configFilepath??(0,i.g)()).then(f.A).then(l).catch(w);var d=s(80),p=s(57);class u extends p.m{name="TokenProviderError";constructor(e,o=!0){super(e,o),Object.setPrototypeOf(this,u.prototype)}}var S=s(832);const C="To refresh this SSO session run 'aws sso login' with the corresponding profile.",y=async(e,o,t={},n)=>{const{CreateTokenCommand:r}=await Promise.all([s.e(372),s.e(224)]).then(s.bind(s,849)),i=await(async(e,o={},t)=>{const{SSOOIDCClient:n}=await Promise.all([s.e(372),s.e(224)]).then(s.bind(s,849)),r=e=>o.clientConfig?.[e]??o.parentClientConfig?.[e]??t?.[e];return new n(Object.assign({},o.clientConfig??{},{region:e??o.clientConfig?.region,logger:r("logger"),userAgentAppId:r("userAgentAppId")}))})(o,t,n);return i.send(new r({clientId:e.clientId,clientSecret:e.clientSecret,refreshToken:e.refreshToken,grantType:"refresh_token"}))},k=e=>{if(e.expiration&&e.expiration.getTime()<Date.now())throw new u(`Token is expired. ${C}`,!1)},m=(e,o,s=!1)=>{if(void 0===o)throw new u(`Value not present for '${e}' in SSO Token${s?". Cannot refresh":""}. ${C}`,!1)};var _=s(833),O=s(6);const{writeFile:x}=O.promises,T=new Date(0),A=(e={})=>async({callerClientConfig:o}={})=>{e.logger?.debug("@aws-sdk/token-providers - fromSso");const s=await(0,r.Y)(e),t=(0,n.Bz)({profile:e.profile??o?.profile}),i=s[t];if(!i)throw new u(`Profile '${t}' could not be found in shared credentials file.`,!1);if(!i.sso_session)throw new u(`Profile '${t}' is missing required property 'sso_session'.`);const a=i.sso_session,c=(await h(e))[a];if(!c)throw new u(`Sso session '${a}' could not be found in shared credentials file.`,!1);for(const e of["sso_start_url","sso_region"])if(!c[e])throw new u(`Sso session '${a}' is missing required property '${e}'.`,!1);c.sso_start_url;const l=c.sso_region;let f;try{f=await(0,S.v)(a)}catch(e){throw new u(`The SSO session token associated with profile=${t} was not found or is invalid. ${C}`,!1)}m("accessToken",f.accessToken),m("expiresAt",f.expiresAt);const{accessToken:g,expiresAt:w}=f,d={token:g,expiration:new Date(w)};if(d.expiration.getTime()-Date.now()>3e5)return d;if(Date.now()-T.getTime()<3e4)return k(d),d;m("clientId",f.clientId,!0),m("clientSecret",f.clientSecret,!0),m("refreshToken",f.refreshToken,!0);try{T.setTime(Date.now());const s=await y(f,l,e,o);m("accessToken",s.accessToken),m("expiresIn",s.expiresIn);const t=new Date(Date.now()+1e3*s.expiresIn);try{await((e,o)=>{const s=(0,_.C)(e),t=JSON.stringify(o,null,2);return x(s,t)})(a,{...f,accessToken:s.accessToken,expiresAt:t.toISOString(),refreshToken:s.refreshToken})}catch(e){}return{token:s.accessToken,expiration:t}}catch(e){return k(d),d}},I=!1,v=async({ssoStartUrl:e,ssoSession:o,ssoAccountId:n,ssoRegion:r,ssoRoleName:i,ssoClient:a,clientConfig:c,parentClientConfig:l,callerClientConfig:f,profile:g,filepath:w,configFilepath:h,ignoreCache:p,logger:u})=>{let C;const y="To refresh this SSO session run aws sso login with the corresponding profile.";if(o)try{const e=await A({profile:g,filepath:w,configFilepath:h,ignoreCache:p})();C={accessToken:e.token,expiresAt:new Date(e.expiration).toISOString()}}catch(e){throw new t.C(e.message,{tryNextLink:I,logger:u})}else try{C=await(0,S.v)(e)}catch(e){throw new t.C(`The SSO session associated with this profile is invalid. ${y}`,{tryNextLink:I,logger:u})}if(new Date(C.expiresAt).getTime()-Date.now()<=0)throw new t.C(`The SSO session associated with this profile has expired. ${y}`,{tryNextLink:I,logger:u});const{accessToken:k}=C,{SSOClient:m,GetRoleCredentialsCommand:_}=await Promise.all([s.e(372),s.e(896)]).then(s.bind(s,843)),O=a||new m(Object.assign({},c??{},{logger:c?.logger??f?.logger??l?.logger,region:c?.region??r,userAgentAppId:c?.userAgentAppId??f?.userAgentAppId??l?.userAgentAppId}));let x;try{x=await O.send(new _({accountId:n,roleName:i,accessToken:k}))}catch(e){throw new t.C(e,{tryNextLink:I,logger:u})}const{roleCredentials:{accessKeyId:T,secretAccessKey:v,sessionToken:N,expiration:$,credentialScope:D,accountId:R}={}}=x;if(!(T&&v&&N&&$))throw new t.C("SSO returns an invalid temporary credential.",{tryNextLink:I,logger:u});const L={accessKeyId:T,secretAccessKey:v,sessionToken:N,expiration:new Date($),...D&&{credentialScope:D},...R&&{accountId:R}};return o?(0,d.g)(L,"CREDENTIALS_SSO","s"):(0,d.g)(L,"CREDENTIALS_SSO_LEGACY","u"),L},N=(e={})=>async({callerClientConfig:o}={})=>{e.logger?.debug("@aws-sdk/credential-provider-sso - fromSSO");const{ssoStartUrl:s,ssoAccountId:i,ssoRegion:a,ssoRoleName:c,ssoSession:l}=e,{ssoClient:f}=e,g=(0,n.Bz)({profile:e.profile??o?.profile});if(s||i||a||c||l){if(s&&i&&a&&c)return v({ssoStartUrl:s,ssoSession:l,ssoAccountId:i,ssoRegion:a,ssoRoleName:c,ssoClient:f,clientConfig:e.clientConfig,parentClientConfig:e.parentClientConfig,callerClientConfig:e.callerClientConfig,profile:g,filepath:e.filepath,configFilepath:e.configFilepath,ignoreCache:e.ignoreCache,logger:e.logger});throw new t.C('Incomplete configuration. The fromSSO() argument hash must include "ssoStartUrl", "ssoAccountId", "ssoRegion", "ssoRoleName"',{tryNextLink:!1,logger:e.logger})}{const o=(await(0,r.Y)(e))[g];if(!o)throw new t.C(`Profile ${g} was not found.`,{logger:e.logger});if(!(w=o)||"string"!=typeof w.sso_start_url&&"string"!=typeof w.sso_account_id&&"string"!=typeof w.sso_session&&"string"!=typeof w.sso_region&&"string"!=typeof w.sso_role_name)throw new t.C(`Profile ${g} is not configured with SSO credentials.`,{logger:e.logger});if(o?.sso_session){const n=(await h(e))[o.sso_session],r=` configurations in profile ${g} and sso-session ${o.sso_session}`;if(a&&a!==n.sso_region)throw new t.C("Conflicting SSO region"+r,{tryNextLink:!1,logger:e.logger});if(s&&s!==n.sso_start_url)throw new t.C("Conflicting SSO start_url"+r,{tryNextLink:!1,logger:e.logger});o.sso_region=n.sso_region,o.sso_start_url=n.sso_start_url}const{sso_start_url:n,sso_account_id:i,sso_region:c,sso_role_name:l,sso_session:d}=((e,o)=>{const{sso_start_url:s,sso_account_id:n,sso_region:r,sso_role_name:i}=e;if(!(s&&n&&r&&i))throw new t.C(`Profile is configured with invalid SSO credentials. Required parameters "sso_account_id", "sso_region", "sso_role_name", "sso_start_url". Got ${Object.keys(e).join(", ")}\nReference: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sso.html`,{tryNextLink:!1,logger:o});return e})(o,e.logger);return v({ssoStartUrl:n,ssoSession:d,ssoAccountId:i,ssoRegion:c,ssoRoleName:l,ssoClient:f,clientConfig:e.clientConfig,parentClientConfig:e.parentClientConfig,callerClientConfig:e.callerClientConfig,profile:g,filepath:e.filepath,configFilepath:e.configFilepath,ignoreCache:e.ignoreCache,logger:e.logger})}var w}},833(e,o,s){s.d(o,{C:()=>i});var t=s(5),n=s(3),r=s(65);const i=e=>{const o=(0,t.createHash)("sha1").update(e).digest("hex");return(0,n.join)((0,r.R)(),".aws","sso","cache",`${o}.json`)}},832(e,o,s){s.d(o,{a:()=>r,v:()=>i});var t=s(27),n=s(833);const r={},i=async e=>{if(r[e])return r[e];const o=(0,n.C)(e),s=await(0,t.readFile)(o,"utf8");return JSON.parse(s)}},831(e,o,s){s.d(o,{Y:()=>n});var t=s(61);const n=async e=>{const o=await(0,t.p)(e);return((...e)=>{const o={};for(const s of e)for(const[e,t]of Object.entries(s))void 0!==o[e]?Object.assign(o[e],t):o[e]=t;return o})(o.configFile,o.credentialsFile)}}};
3
3
  //# sourceMappingURL=974.index.js.map