@yxw007/translate 0.0.1-alpha.3 → 0.0.1
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/README_zh-CN.md +43 -15
- package/dist/browser/index.cjs +1 -1
- package/dist/browser/index.umd.js +1 -1
- package/dist/node/index.cjs +1 -1
- package/dist/node/index.js +1 -1
- package/dist/package.json +1 -5
- package/package.json +1 -5
- package/dist/node/index.min.cjs +0 -2
- package/dist/node/index.min.cjs.map +0 -1
- package/dist/node/index.min.js +0 -2
- package/dist/node/index.min.js.map +0 -1
package/dist/node/index.min.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("buffer"),t=require("stream"),n=require("http"),r=require("https");require("http2");var s=require("util"),o=require("os"),i=require("path"),a=require("crypto"),c=require("fs"),l=require("url"),u=require("fs/promises"),d=require("child_process"),p=require("process");const h=e=>{let t=e.httpHandler;return{setHttpHandler(e){t=e},httpHandler:()=>t,updateHttpClientConfig(e,n){t.updateHttpClientConfig(e,n)},httpHandlerConfigs:()=>t.httpHandlerConfigs()}},f=e=>({httpHandler:e.httpHandler()});var g,m,y,w,b;!function(e){e.HEADER="header",e.QUERY="query"}(g||(g={})),function(e){e.HEADER="header",e.QUERY="query"}(m||(m={})),function(e){e.HTTP="http",e.HTTPS="https"}(y||(y={})),function(e){e.MD5="md5",e.CRC32="crc32",e.CRC32C="crc32c",e.SHA1="sha1",e.SHA256="sha256"}(w||(w={})),function(e){e[e.HEADER=0]="HEADER",e[e.TRAILER=1]="TRAILER"}(b||(b={}));const v="__smithy_context";var S,E;!function(e){e.PROFILE="profile",e.SSO_SESSION="sso-session",e.SERVICES="services"}(S||(S={})),function(e){e.HTTP_0_9="http/0.9",e.HTTP_1_0="http/1.0",e.TDS_8_0="tds/8.0"}(E||(E={}));class x{constructor(e){this.method=e.method||"GET",this.hostname=e.hostname||"localhost",this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?":"!==e.protocol.slice(-1)?`${e.protocol}:`:e.protocol:"https:",this.path=e.path?"/"!==e.path.charAt(0)?`/${e.path}`:e.path:"/",this.username=e.username,this.password=e.password,this.fragment=e.fragment}static clone(e){const t=new x({...e,headers:{...e.headers}});var n;return t.query&&(t.query=(n=t.query,Object.keys(n).reduce(((e,t)=>{const r=n[t];return{...e,[t]:Array.isArray(r)?[...r]:r}}),{}))),t}static isInstance(e){if(!e)return!1;const t=e;return"method"in t&&"protocol"in t&&"hostname"in t&&"path"in t&&"object"==typeof t.query&&"object"==typeof t.headers}clone(){return x.clone(this)}}class A{constructor(e){this.statusCode=e.statusCode,this.reason=e.reason,this.headers=e.headers||{},this.body=e.body}static isInstance(e){if(!e)return!1;const t=e;return"number"==typeof t.statusCode&&"object"==typeof t.headers}}const P={name:"hostHeaderMiddleware",step:"build",priority:"low",tags:["HOST"],override:!0},T=e=>({applyToStack:t=>{t.add((e=>t=>async n=>{if(!x.isInstance(n.request))return t(n);const{request:r}=n,{handlerProtocol:s=""}=e.requestHandler.metadata||{};if(s.indexOf("h2")>=0&&!r.headers[":authority"])delete r.headers.host,r.headers[":authority"]=r.hostname+(r.port?":"+r.port:"");else if(!r.headers.host){let e=r.hostname;null!=r.port&&(e+=`:${r.port}`),r.headers.host=e}return t(n)})(e),P)}}),I={name:"loggerMiddleware",tags:["LOGGER"],step:"initialize",override:!0},C=e=>({applyToStack:e=>{e.add(((e,t)=>async n=>{try{const r=await e(n),{clientName:s,commandName:o,logger:i,dynamoDbDocumentClientOptions:a={}}=t,{overrideInputFilterSensitiveLog:c,overrideOutputFilterSensitiveLog:l}=a,u=c??t.inputFilterSensitiveLog,d=l??t.outputFilterSensitiveLog,{$metadata:p,...h}=r.output;return i?.info?.({clientName:s,commandName:o,input:u(n.input),output:d(h),metadata:p}),r}catch(e){const{clientName:r,commandName:s,logger:o,dynamoDbDocumentClientOptions:i={}}=t,{overrideInputFilterSensitiveLog:a}=i,c=a??t.inputFilterSensitiveLog;throw o?.error?.({clientName:r,commandName:s,input:c(n.input),error:e,metadata:e.$metadata}),e}}),I)}}),k="X-Amzn-Trace-Id",_={step:"build",tags:["RECURSION_DETECTION"],name:"recursionDetectionMiddleware",override:!0,priority:"low"},R=e=>({applyToStack:t=>{t.add((e=>t=>async n=>{const{request:r}=n;if(!x.isInstance(r)||"node"!==e.runtime||r.headers.hasOwnProperty(k))return t(n);const s=process.env.AWS_LAMBDA_FUNCTION_NAME,o=process.env._X_AMZN_TRACE_ID,i=e=>"string"==typeof e&&e.length>0;return i(s)&&i(o)&&(r.headers[k]=o),t({...n,request:r})})(e),_)}});function O(e){return{...e,customUserAgent:"string"==typeof e.customUserAgent?[[e.customUserAgent]]:e.customUserAgent}}const $=new RegExp("^(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}$"),N=e=>$.test(e)||e.startsWith("[")&&e.endsWith("]"),D=new RegExp("^(?!.*-$)(?!-)[a-zA-Z0-9-]{1,63}$"),j=(e,t=!1)=>{if(!t)return D.test(e);const n=e.split(".");for(const e of n)if(!j(e))return!1;return!0},L={},M="endpoints";function U(e){return"object"!=typeof e||null==e?e:"ref"in e?`$${U(e.ref)}`:"fn"in e?`${e.fn}(${(e.argv||[]).map(U).join(", ")})`:JSON.stringify(e,null,2)}class F extends Error{constructor(e){super(e),this.name="EndpointError"}}const z=(e,t)=>(e=>{const t=e.split("."),n=[];for(const r of t){const t=r.indexOf("[");if(-1!==t){if(r.indexOf("]")!==r.length-1)throw new F(`Path: '${e}' does not end with ']'`);const s=r.slice(t+1,-1);if(Number.isNaN(parseInt(s)))throw new F(`Invalid array index: '${s}' in path: '${e}'`);0!==t&&n.push(r.slice(0,t)),n.push(s)}else n.push(r)}return n})(t).reduce(((n,r)=>{if("object"!=typeof n)throw new F(`Index '${r}' in '${t}' not found in '${JSON.stringify(e)}'`);return Array.isArray(n)?n[parseInt(r)]:n[r]}),e),q={[y.HTTP]:80,[y.HTTPS]:443},W={booleanEquals:(e,t)=>e===t,getAttr:z,isSet:e=>null!=e,isValidHostLabel:j,not:e=>!e,parseURL:e=>{const t=(()=>{try{if(e instanceof URL)return e;if("object"==typeof e&&"hostname"in e){const{hostname:t,port:n,protocol:r="",path:s="",query:o={}}=e,i=new URL(`${r}//${t}${n?`:${n}`:""}${s}`);return i.search=Object.entries(o).map((([e,t])=>`${e}=${t}`)).join("&"),i}return new URL(e)}catch(e){return null}})();if(!t)return console.error(`Unable to parse ${JSON.stringify(e)} as a whatwg URL.`),null;const n=t.href,{host:r,hostname:s,pathname:o,protocol:i,search:a}=t;if(a)return null;const c=i.slice(0,-1);if(!Object.values(y).includes(c))return null;const l=N(s);return{scheme:c,authority:`${r}${n.includes(`${r}:${q[c]}`)||"string"==typeof e&&e.includes(`${r}:${q[c]}`)?`:${q[c]}`:""}`,path:o,normalizedPath:o.endsWith("/")?o:`${o}/`,isIp:l}},stringEquals:(e,t)=>e===t,substring:(e,t,n,r)=>t>=n||e.length<n?null:r?e.substring(e.length-n,e.length-t):e.substring(t,n),uriEncode:e=>encodeURIComponent(e).replace(/[!*'()]/g,(e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`))},B=(e,t)=>{const n=[],r={...t.endpointParams,...t.referenceRecord};let s=0;for(;s<e.length;){const t=e.indexOf("{",s);if(-1===t){n.push(e.slice(s));break}n.push(e.slice(s,t));const o=e.indexOf("}",t);if(-1===o){n.push(e.slice(t));break}"{"===e[t+1]&&"}"===e[o+1]&&(n.push(e.slice(t+1,o)),s=o+2);const i=e.substring(t+1,o);if(i.includes("#")){const[e,t]=i.split("#");n.push(z(r[e],t))}else n.push(r[i]);s=o+1}return n.join("")},H=(e,t,n)=>{if("string"==typeof e)return B(e,n);if(e.fn)return V(e,n);if(e.ref)return(({ref:e},t)=>({...t.endpointParams,...t.referenceRecord}[e]))(e,n);throw new F(`'${t}': ${String(e)} is not a string, function or reference.`)},V=({fn:e,argv:t},n)=>{const r=t.map((e=>["boolean","number"].includes(typeof e)?e:H(e,"arg",n))),s=e.split(".");return s[0]in L&&null!=s[1]?L[s[0]][s[1]](...r):W[e](...r)},K=({assign:e,...t},n)=>{if(e&&e in n.referenceRecord)throw new F(`'${e}' is already defined in Reference Record.`);const r=V(t,n);return n.logger?.debug?.(`${M} evaluateCondition: ${U(t)} = ${U(r)}`),{result:""===r||!!r,...null!=e&&{toAssign:{name:e,value:r}}}},G=(e=[],t)=>{const n={};for(const r of e){const{result:e,toAssign:s}=K(r,{...t,referenceRecord:{...t.referenceRecord,...n}});if(!e)return{result:e};s&&(n[s.name]=s.value,t.logger?.debug?.(`${M} assign: ${s.name} := ${U(s.value)}`))}return{result:!0,referenceRecord:n}},X=(e,t)=>Object.entries(e).reduce(((e,[n,r])=>({...e,[n]:r.map((e=>{const r=H(e,"Header value entry",t);if("string"!=typeof r)throw new F(`Header '${n}' value '${r}' is not a string`);return r}))})),{}),J=(e,t)=>{if(Array.isArray(e))return e.map((e=>J(e,t)));switch(typeof e){case"string":return B(e,t);case"object":if(null===e)throw new F(`Unexpected endpoint property: ${e}`);return Y(e,t);case"boolean":return e;default:throw new F("Unexpected endpoint property type: "+typeof e)}},Y=(e,t)=>Object.entries(e).reduce(((e,[n,r])=>({...e,[n]:J(r,t)})),{}),Z=(e,t)=>{const n=H(e,"Endpoint URL",t);if("string"==typeof n)try{return new URL(n)}catch(e){throw console.error(`Failed to construct URL with ${n}`,e),e}throw new F("Endpoint URL must be a string, got "+typeof n)},Q=(e,t)=>{const{conditions:n,endpoint:r}=e,{result:s,referenceRecord:o}=G(n,t);if(!s)return;const i={...t,referenceRecord:{...t.referenceRecord,...o}},{url:a,properties:c,headers:l}=r;return t.logger?.debug?.(`${M} Resolving endpoint from template: ${U(r)}`),{...null!=l&&{headers:X(l,i)},...null!=c&&{properties:Y(c,i)},url:Z(a,i)}},ee=(e,t)=>{const{conditions:n,error:r}=e,{result:s,referenceRecord:o}=G(n,t);if(s)throw new F(H(r,"Error",{...t,referenceRecord:{...t.referenceRecord,...o}}))},te=(e,t)=>{const{conditions:n,rules:r}=e,{result:s,referenceRecord:o}=G(n,t);if(s)return ne(r,{...t,referenceRecord:{...t.referenceRecord,...o}})},ne=(e,t)=>{for(const n of e)if("endpoint"===n.type){const e=Q(n,t);if(e)return e}else if("error"===n.type)ee(n,t);else{if("tree"!==n.type)throw new F(`Unknown endpoint rule: ${n}`);{const e=te(n,t);if(e)return e}}throw new F("Rules evaluation failed")},re=(e,t)=>{const{endpointParams:n,logger:r}=t,{parameters:s,rules:o}=e;t.logger?.debug?.(`${M} Initial EndpointParams: ${U(n)}`);const i=Object.entries(s).filter((([,e])=>null!=e.default)).map((([e,t])=>[e,t.default]));if(i.length>0)for(const[e,t]of i)n[e]=n[e]??t;const a=Object.entries(s).filter((([,e])=>e.required)).map((([e])=>e));for(const e of a)if(null==n[e])throw new F(`Missing required parameter: '${e}'`);const c=ne(o,{endpointParams:n,logger:r,referenceRecord:{}});if(t.endpointParams?.Endpoint)try{const e=new URL(t.endpointParams.Endpoint),{protocol:n,port:r}=e;c.url.protocol=n,c.url.port=r}catch(e){}return t.logger?.debug?.(`${M} Resolved endpoint: ${U(c)}`),c},se=(e,t=!1)=>{if(t){for(const t of e.split("."))if(!se(t))return!1;return!0}return!!j(e)&&(!(e.length<3||e.length>63)&&(e===e.toLowerCase()&&!N(e)))};let oe={partitions:[{id:"aws",outputs:{dnsSuffix:"amazonaws.com",dualStackDnsSuffix:"api.aws",implicitGlobalRegion:"us-east-1",name:"aws",supportsDualStack:!0,supportsFIPS:!0},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-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)"},"aws-global":{description:"AWS Standard 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)"},"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:!0,supportsFIPS:!0},regionRegex:"^cn\\-\\w+\\-\\d+$",regions:{"aws-cn-global":{description:"AWS China global region"},"cn-north-1":{description:"China (Beijing)"},"cn-northwest-1":{description:"China (Ningxia)"}}},{id:"aws-us-gov",outputs:{dnsSuffix:"amazonaws.com",dualStackDnsSuffix:"api.aws",implicitGlobalRegion:"us-gov-west-1",name:"aws-us-gov",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^us\\-gov\\-\\w+\\-\\d+$",regions:{"aws-us-gov-global":{description:"AWS GovCloud (US) global region"},"us-gov-east-1":{description:"AWS GovCloud (US-East)"},"us-gov-west-1":{description:"AWS GovCloud (US-West)"}}},{id:"aws-iso",outputs:{dnsSuffix:"c2s.ic.gov",dualStackDnsSuffix:"c2s.ic.gov",implicitGlobalRegion:"us-iso-east-1",name:"aws-iso",supportsDualStack:!1,supportsFIPS:!0},regionRegex:"^us\\-iso\\-\\w+\\-\\d+$",regions:{"aws-iso-global":{description:"AWS ISO (US) 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:"sc2s.sgov.gov",implicitGlobalRegion:"us-isob-east-1",name:"aws-iso-b",supportsDualStack:!1,supportsFIPS:!0},regionRegex:"^us\\-isob\\-\\w+\\-\\d+$",regions:{"aws-iso-b-global":{description:"AWS ISOB (US) global region"},"us-isob-east-1":{description:"US ISOB East (Ohio)"}}},{id:"aws-iso-e",outputs:{dnsSuffix:"cloud.adc-e.uk",dualStackDnsSuffix:"cloud.adc-e.uk",implicitGlobalRegion:"eu-isoe-west-1",name:"aws-iso-e",supportsDualStack:!1,supportsFIPS:!0},regionRegex:"^eu\\-isoe\\-\\w+\\-\\d+$",regions:{"eu-isoe-west-1":{description:"EU ISOE West"}}},{id:"aws-iso-f",outputs:{dnsSuffix:"csp.hci.ic.gov",dualStackDnsSuffix:"csp.hci.ic.gov",implicitGlobalRegion:"us-isof-south-1",name:"aws-iso-f",supportsDualStack:!1,supportsFIPS:!0},regionRegex:"^us\\-isof\\-\\w+\\-\\d+$",regions:{}}],version:"1.1"};const ie={isVirtualHostableS3Bucket:se,parseArn:e=>{const t=e.split(":");if(t.length<6)return null;const[n,r,s,o,i,...a]=t;if("arn"!==n||""===r||""===s||""===a.join(":"))return null;return{partition:r,service:s,region:o,accountId:i,resourceId:a.map((e=>e.split("/"))).flat()}},partition:e=>{const{partitions:t}=oe;for(const n of t){const{regions:t,outputs:r}=n;for(const[n,s]of Object.entries(t))if(n===e)return{...r,...s}}for(const n of t){const{regionRegex:t,outputs:r}=n;if(new RegExp(t).test(e))return{...r}}const n=t.find((e=>"aws"===e.id));if(!n)throw new Error("Provided region was not found in the partition array or regex, and default partition with id 'aws' doesn't exist.");return{...n.outputs}}};L.aws=ie;const ae="user-agent",ce="x-amz-user-agent",le=/[^\!\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w]/g,ue=/[^\!\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w\#]/g,de=e=>{const t=e[0].split("/").map((e=>e.replace(le,"-"))).join("/"),n=e[1]?.replace(ue,"-"),r=t.indexOf("/"),s=t.substring(0,r);let o=t.substring(r+1);return"api"===s&&(o=o.toLowerCase()),[s,o,n].filter((e=>e&&e.length>0)).reduce(((e,t,n)=>{switch(n){case 0:return t;case 1:return`${e}/${t}`;default:return`${e}#${t}`}}),"")},pe={name:"getUserAgentMiddleware",step:"build",priority:"low",tags:["SET_USER_AGENT","USER_AGENT"],override:!0},he=e=>({applyToStack:t=>{var n;t.add((n=e,(e,t)=>async r=>{const{request:s}=r;if(!x.isInstance(s))return e(r);const{headers:o}=s,i=t?.userAgent?.map(de)||[],a=(await n.defaultUserAgentProvider()).map(de),c=n?.customUserAgent?.map(de)||[],l=[].concat([...a,...i,...c]).join(" "),u=[...a.filter((e=>e.startsWith("aws-sdk-"))),...c].join(" ");return"browser"!==n.runtime?(u&&(o[ce]=o[ce]?`${o[ae]} ${u}`:u),o[ae]=l):o[ce]=l,e({...r,request:s})}),pe)}}),fe=(e,t,n)=>{if(t in e){if("true"===e[t])return!0;if("false"===e[t])return!1;throw new Error(`Cannot load ${n} "${t}". Expected "true" or "false", got ${e[t]}.`)}};var ge;!function(e){e.ENV="env",e.CONFIG="shared config entry"}(ge||(ge={}));const me={environmentVariableSelector:e=>fe(e,"AWS_USE_DUALSTACK_ENDPOINT",ge.ENV),configFileSelector:e=>fe(e,"use_dualstack_endpoint",ge.CONFIG),default:!1},ye={environmentVariableSelector:e=>fe(e,"AWS_USE_FIPS_ENDPOINT",ge.ENV),configFileSelector:e=>fe(e,"use_fips_endpoint",ge.CONFIG),default:!1},we=e=>e[v]||(e[v]={}),be=e=>{if("function"==typeof e)return e;const t=Promise.resolve(e);return()=>t},ve={environmentVariableSelector:e=>e.AWS_REGION,configFileSelector:e=>e.region,default:()=>{throw new Error("Region is missing")}},Se={preferredFile:"credentials"},Ee=e=>"string"==typeof e&&(e.startsWith("fips-")||e.endsWith("-fips")),xe=e=>Ee(e)?["fips-aws-global","aws-fips"].includes(e)?"us-east-1":e.replace(/fips-(dkr-|prod-)?|-fips/,""):e,Ae=e=>{const{region:t,useFipsEndpoint:n}=e;if(!t)throw new Error("Region is missing");return{...e,region:async()=>{if("string"==typeof t)return xe(t);const e=await t();return xe(e)},useFipsEndpoint:async()=>{const e="string"==typeof t?t:await t();return!!Ee(e)||("function"!=typeof n?Promise.resolve(!!n):n())}}};const Pe=(e,t)=>(n,r)=>async s=>{const o=e.httpAuthSchemeProvider(await t.httpAuthSchemeParametersProvider(e,r,s.input)),i=function(e){const t=new Map;for(const n of e)t.set(n.schemeId,n);return t}(e.httpAuthSchemes),a=we(r),c=[];for(const n of o){const s=i.get(n.schemeId);if(!s){c.push(`HttpAuthScheme \`${n.schemeId}\` was not enabled for this service.`);continue}const o=s.identityProvider(await t.identityProviderConfigProvider(e));if(!o){c.push(`HttpAuthScheme \`${n.schemeId}\` did not have an IdentityProvider configured.`);continue}const{identityProperties:l={},signingProperties:u={}}=n.propertiesExtractor?.(e,r)||{};n.identityProperties=Object.assign(n.identityProperties||{},l),n.signingProperties=Object.assign(n.signingProperties||{},u),a.selectedHttpAuthScheme={httpAuthOption:n,identity:await o(n.identityProperties),signer:s.signer};break}if(!a.selectedHttpAuthScheme)throw new Error(c.join("\n"));return n(s)},Te=/^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/,Ie=/(\d+\.){3}\d+/,Ce=/\.\./,ke=e=>Te.test(e)&&!Ie.test(e)&&!Ce.test(e),_e=e=>{const[t,n,r,,,s]=e.split(":"),o="arn"===t&&e.split(":").length>=6,i=Boolean(o&&n&&r&&s);if(o&&!i)throw new Error(`Invalid ARN: ${e} was an invalid ARN.`);return i},Re=(e,t,n)=>{const r=async()=>{const r=n[e]??n[t];return"function"==typeof r?r():r};return"credentialScope"===e||"CredentialScope"===t?async()=>{const e="function"==typeof n.credentials?await n.credentials():n.credentials;return e?.credentialScope??e?.CredentialScope}:"accountId"===e||"AccountId"===t?async()=>{const e="function"==typeof n.credentials?await n.credentials():n.credentials;return e?.accountId??e?.AccountId}:"endpoint"===e||"endpoint"===t?async()=>{const e=await r();if(e&&"object"==typeof e){if("url"in e)return e.url.href;if("hostname"in e){const{protocol:t,hostname:n,port:r,path:s}=e;return`${t}//${n}${r?":"+r:""}${s}`}}return e}:r};class Oe extends Error{constructor(e,t=!0){let n,r=!0;"boolean"==typeof t?(n=void 0,r=t):null!=t&&"object"==typeof t&&(n=t.logger,r=t.tryNextLink??!0),super(e),this.name="ProviderError",this.tryNextLink=r,Object.setPrototypeOf(this,Oe.prototype),n?.debug?.(`@smithy/property-provider ${r?"->":"(!)"} ${e}`)}static from(e,t=!0){return Object.assign(new this(e.message,t),e)}}class $e extends Oe{constructor(e,t=!0){super(e,t),this.name="CredentialsProviderError",Object.setPrototypeOf(this,$e.prototype)}}class Ne extends Oe{constructor(e,t=!0){super(e,t),this.name="TokenProviderError",Object.setPrototypeOf(this,Ne.prototype)}}const De=(...e)=>async()=>{if(0===e.length)throw new Oe("No providers in chain");let t;for(const n of e)try{return await n()}catch(e){if(t=e,e?.tryNextLink)continue;throw e}throw t},je=(e,t,n)=>{let r,s,o,i=!1;const a=async()=>{s||(s=e());try{r=await s,o=!0,i=!1}finally{s=void 0}return r};return void 0===t?async e=>(o&&!e?.forceRefresh||(r=await a()),r):async e=>(o&&!e?.forceRefresh||(r=await a()),i?r:n&&!n(r)?(i=!0,r):t(r)?(await a(),r):r)};function Le(e){try{const t=new Set(Array.from(e.match(/([A-Z_]){3,}/g)??[]));return t.delete("CONFIG"),t.delete("CONFIG_PREFIX_SEPARATOR"),t.delete("ENV"),[...t].join(", ")}catch(t){return e}}const Me={},Ue=()=>{const{HOME:e,USERPROFILE:t,HOMEPATH:n,HOMEDRIVE:r=`C:${i.sep}`}=process.env;if(e)return e;if(t)return t;if(n)return`${r}${n}`;const s=process&&process.geteuid?`${process.geteuid()}`:"DEFAULT";return Me[s]||(Me[s]=o.homedir()),Me[s]},Fe="AWS_PROFILE",ze=e=>e.profile||process.env[Fe]||"default",qe=e=>{const t=a.createHash("sha1").update(e).digest("hex");return i.join(Ue(),".aws","sso","cache",`${t}.json`)},{readFile:We}=c.promises,Be=async e=>{const t=qe(e),n=await We(t,"utf8");return JSON.parse(n)},He=e=>Object.entries(e).filter((([e])=>{const t=e.indexOf(tt);return-1!==t&&Object.values(S).includes(e.substring(0,t))})).reduce(((e,[t,n])=>{const r=t.indexOf(tt);return e[t.substring(0,r)===S.PROFILE?t.substring(r+1):t]=n,e}),{...e.default&&{default:e.default}}),Ve=()=>process.env.AWS_CONFIG_FILE||i.join(Ue(),".aws","config"),Ke=()=>process.env.AWS_SHARED_CREDENTIALS_FILE||i.join(Ue(),".aws","credentials"),Ge=/^([\w-]+)\s(["'])?([\w-@\+\.%:/]+)\2$/,Xe=["__proto__","profile __proto__"],Je=e=>{const t={};let n,r;for(const s of e.split(/\r?\n/)){const e=s.split(/(^|\s)[;#]/)[0].trim();if("["===e[0]&&"]"===e[e.length-1]){n=void 0,r=void 0;const t=e.substring(1,e.length-1),s=Ge.exec(t);if(s){const[,e,,t]=s;Object.values(S).includes(e)&&(n=[e,t].join(tt))}else n=t;if(Xe.includes(t))throw new Error(`Found invalid profile name "${t}"`)}else if(n){const o=e.indexOf("=");if(![0,-1].includes(o)){const[i,a]=[e.substring(0,o).trim(),e.substring(o+1).trim()];if(""===a)r=i;else{r&&s.trimStart()===s&&(r=void 0),t[n]=t[n]||{};const e=r?[r,i].join(tt):i;t[n][e]=a}}}}return t},{readFile:Ye}=c.promises,Ze={},Qe=(e,t)=>(Ze[e]&&!t?.ignoreCache||(Ze[e]=Ye(e,"utf8")),Ze[e]),et=()=>({}),tt=".",nt=async(e={})=>{const{filepath:t=Ke(),configFilepath:n=Ve()}=e,r=Ue();let s=t;t.startsWith("~/")&&(s=i.join(r,t.slice(2)));let o=n;n.startsWith("~/")&&(o=i.join(r,n.slice(2)));const a=await Promise.all([Qe(o,{ignoreCache:e.ignoreCache}).then(Je).then(He).catch(et),Qe(s,{ignoreCache:e.ignoreCache}).then(Je).catch(et)]);return{configFile:a[0],credentialsFile:a[1]}},rt=e=>Object.entries(e).filter((([e])=>e.startsWith(S.SSO_SESSION+tt))).reduce(((e,[t,n])=>({...e,[t.substring(t.indexOf(tt)+1)]:n})),{}),st=()=>({}),ot=async(e={})=>Qe(e.configFilepath??Ve()).then(Je).then(rt).catch(st),it=async e=>{const t=await nt(e);return((...e)=>{const t={};for(const n of e)for(const[e,r]of Object.entries(n))void 0!==t[e]?Object.assign(t[e],r):t[e]=r;return t})(t.configFile,t.credentialsFile)},at=e=>{return"function"==typeof e?async()=>await e():(t=e,()=>Promise.resolve(t));var t},ct=({environmentVariableSelector:e,configFileSelector:t,default:n},r={})=>je(De(((e,t)=>async()=>{try{const t=e(process.env);if(void 0===t)throw new Error;return t}catch(n){throw new $e(n.message||`Not found in ENV: ${Le(e.toString())}`,{logger:t})}})(e),((e,{preferredFile:t="config",...n}={})=>async()=>{const r=ze(n),{configFile:s,credentialsFile:o}=await nt(n),i=o[r]||{},a=s[r]||{},c="config"===t?{...i,...a}:{...a,...i};try{const n=e(c,"config"===t?s:o);if(void 0===n)throw new Error;return n}catch(t){throw new $e(t.message||`Not found in config files w/ profile [${r}]: ${Le(e.toString())}`,{logger:n.logger})}})(t,r),at(n))),lt="AWS_ENDPOINT_URL",ut="endpoint_url",dt=async e=>ct((e=>({environmentVariableSelector:t=>{const n=e.split(" ").map((e=>e.toUpperCase())),r=t[[lt,...n].join("_")];if(r)return r;return t[lt]||void 0},configFileSelector:(t,n)=>{if(n&&t.services){const r=n[["services",t.services].join(tt)];if(r){const t=e.split(" ").map((e=>e.toLowerCase())),n=r[[t.join("_"),ut].join(tt)];if(n)return n}}const r=t[ut];if(r)return r},default:void 0}))(e))();const pt=e=>{if("string"==typeof e)return pt(new URL(e));const{hostname:t,pathname:n,port:r,protocol:s,search:o}=e;let i;return o&&(i=function(e){const t={};if(e=e.replace(/^\?/,""))for(const n of e.split("&")){let[e,r=null]=n.split("=");e=decodeURIComponent(e),r&&(r=decodeURIComponent(r)),e in t?Array.isArray(t[e])?t[e].push(r):t[e]=[t[e],r]:t[e]=r}return t}(o)),{hostname:t,port:r?parseInt(r):void 0,protocol:s,path:n,query:i}},ht=e=>"object"==typeof e?"url"in e?pt(e.url):e:pt(e),ft=async(e,t,n)=>{const r={},s=t?.getEndpointParameterInstructions?.()||{};for(const[t,o]of Object.entries(s))switch(o.type){case"staticContextParams":r[t]=o.value;break;case"contextParams":r[t]=e[o.name];break;case"clientContextParams":case"builtInParams":r[t]=await Re(o.name,t,n)();break;default:throw new Error("Unrecognized endpoint parameter instruction: "+JSON.stringify(o))}return 0===Object.keys(s).length&&Object.assign(r,n),"s3"===String(n.serviceId).toLowerCase()&&await(async e=>{const t=e?.Bucket||"";if("string"==typeof e.Bucket&&(e.Bucket=t.replace(/#/g,encodeURIComponent("#")).replace(/\?/g,encodeURIComponent("?"))),_e(t)){if(!0===e.ForcePathStyle)throw new Error("Path-style addressing cannot be used with ARN buckets")}else(!ke(t)||-1!==t.indexOf(".")&&!String(e.Endpoint).startsWith("http:")||t.toLowerCase()!==t||t.length<3)&&(e.ForcePathStyle=!0);return e.DisableMultiRegionAccessPoints&&(e.disableMultiRegionAccessPoints=!0,e.DisableMRAP=!0),e})(r),r},gt=({config:e,instructions:t})=>(n,r)=>async s=>{const o=await(async(e,t,n,r)=>{if(!n.endpoint){const e=await dt(n.serviceId||"");e&&(n.endpoint=()=>Promise.resolve(ht(e)))}const s=await ft(e,t,n);if("function"!=typeof n.endpointProvider)throw new Error("config.endpointProvider is not set.");return n.endpointProvider(s,r)})(s.input,{getEndpointParameterInstructions:()=>t},{...e},r);r.endpointV2=o,r.authSchemes=o.properties?.authSchemes;const i=r.authSchemes?.[0];if(i){r.signing_region=i.signingRegion,r.signing_service=i.signingName;const e=we(r),t=e?.selectedHttpAuthScheme?.httpAuthOption;t&&(t.signingProperties=Object.assign(t.signingProperties||{},{signing_region:i.signingRegion,signingRegion:i.signingRegion,signing_service:i.signingName,signingName:i.signingName,signingRegionSet:i.signingRegionSet},i.properties))}return n({...s})},mt={name:"deserializerMiddleware",step:"deserialize",tags:["DESERIALIZER"],override:!0},yt={name:"serializerMiddleware",step:"serialize",tags:["SERIALIZER"],override:!0};function wt(e,t,n){return{applyToStack:r=>{r.add(((e,t)=>n=>async r=>{const{response:s}=await n(r);try{return{response:s,output:await t(s,e)}}catch(e){if(Object.defineProperty(e,"$response",{value:s}),!("$metadata"in e)){const t="Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.";e.message+="\n "+t,void 0!==e.$responseBodyText&&e.$response&&(e.$response.body=e.$responseBodyText)}throw e}})(e,n),mt),r.add(((e,t)=>(n,r)=>async s=>{const o=r.endpointV2?.url&&e.urlParser?async()=>e.urlParser(r.endpointV2.url):e.endpoint;if(!o)throw new Error("No valid endpoint provider available.");const i=await t(s.input,{...e,endpoint:o});return n({...s,request:i})})(e,t),yt)}}}const bt={step:"serialize",tags:["ENDPOINT_PARAMETERS","ENDPOINT_V2","ENDPOINT"],name:"endpointV2Middleware",override:!0,relation:"before",toMiddleware:yt.name},vt=(e,t)=>({applyToStack:n=>{n.addRelativeTo(gt({config:e,instructions:t}),bt)}}),St=e=>{const t=e.tls??!0,{endpoint:n}=e,r=null!=n?async()=>ht(await be(n)()):void 0,s=!!n;return{...e,endpoint:r,tls:t,isCustomEndpoint:s,useDualstackEndpoint:be(e.useDualstackEndpoint??!1),useFipsEndpoint:be(e.useFipsEndpoint??!1)}},Et={step:"serialize",tags:["HTTP_AUTH_SCHEME"],name:"httpAuthSchemeMiddleware",override:!0,relation:"before",toMiddleware:bt.name},xt=(e,{httpAuthSchemeParametersProvider:t,identityProviderConfigProvider:n})=>({applyToStack:r=>{r.addRelativeTo(Pe(e,{httpAuthSchemeParametersProvider:t,identityProviderConfigProvider:n}),Et)}}),At=e=>e=>{throw e},Pt=(e,t)=>{};var Tt;!function(e){e.STANDARD="standard",e.ADAPTIVE="adaptive"}(Tt||(Tt={}));const It=Tt.STANDARD,Ct=["BandwidthLimitExceeded","EC2ThrottledException","LimitExceededException","PriorRequestNotComplete","ProvisionedThroughputExceededException","RequestLimitExceeded","RequestThrottled","RequestThrottledException","SlowDown","ThrottledException","Throttling","ThrottlingException","TooManyRequestsException","TransactionInProgressException"],kt=["TimeoutError","RequestTimeout","RequestTimeoutException"],_t=[500,502,503,504],Rt=["ECONNRESET","ECONNREFUSED","EPIPE","ETIMEDOUT"],Ot=e=>429===e.$metadata?.httpStatusCode||Ct.includes(e.name)||1==e.$retryable?.throttling,$t=e=>(e=>e.$metadata?.clockSkewCorrected)(e)||kt.includes(e.name)||Rt.includes(e?.code||"")||_t.includes(e.$metadata?.httpStatusCode||0);class Nt{constructor(e){this.currentCapacity=0,this.enabled=!1,this.lastMaxRate=0,this.measuredTxRate=0,this.requestCount=0,this.lastTimestamp=0,this.timeWindow=0,this.beta=e?.beta??.7,this.minCapacity=e?.minCapacity??1,this.minFillRate=e?.minFillRate??.5,this.scaleConstant=e?.scaleConstant??.4,this.smooth=e?.smooth??.8;const t=this.getCurrentTimeInSeconds();this.lastThrottleTime=t,this.lastTxRateBucket=Math.floor(this.getCurrentTimeInSeconds()),this.fillRate=this.minFillRate,this.maxCapacity=this.minCapacity}getCurrentTimeInSeconds(){return Date.now()/1e3}async getSendToken(){return this.acquireTokenBucket(1)}async acquireTokenBucket(e){if(this.enabled){if(this.refillTokenBucket(),e>this.currentCapacity){const t=(e-this.currentCapacity)/this.fillRate*1e3;await new Promise((e=>setTimeout(e,t)))}this.currentCapacity=this.currentCapacity-e}}refillTokenBucket(){const e=this.getCurrentTimeInSeconds();if(!this.lastTimestamp)return void(this.lastTimestamp=e);const t=(e-this.lastTimestamp)*this.fillRate;this.currentCapacity=Math.min(this.maxCapacity,this.currentCapacity+t),this.lastTimestamp=e}updateClientSendingRate(e){let t;if(this.updateMeasuredRate(),Ot(e)){const e=this.enabled?Math.min(this.measuredTxRate,this.fillRate):this.measuredTxRate;this.lastMaxRate=e,this.calculateTimeWindow(),this.lastThrottleTime=this.getCurrentTimeInSeconds(),t=this.cubicThrottle(e),this.enableTokenBucket()}else this.calculateTimeWindow(),t=this.cubicSuccess(this.getCurrentTimeInSeconds());const n=Math.min(t,2*this.measuredTxRate);this.updateTokenBucketRate(n)}calculateTimeWindow(){this.timeWindow=this.getPrecise(Math.pow(this.lastMaxRate*(1-this.beta)/this.scaleConstant,1/3))}cubicThrottle(e){return this.getPrecise(e*this.beta)}cubicSuccess(e){return this.getPrecise(this.scaleConstant*Math.pow(e-this.lastThrottleTime-this.timeWindow,3)+this.lastMaxRate)}enableTokenBucket(){this.enabled=!0}updateTokenBucketRate(e){this.refillTokenBucket(),this.fillRate=Math.max(e,this.minFillRate),this.maxCapacity=Math.max(e,this.minCapacity),this.currentCapacity=Math.min(this.currentCapacity,this.maxCapacity)}updateMeasuredRate(){const e=this.getCurrentTimeInSeconds(),t=Math.floor(2*e)/2;if(this.requestCount++,t>this.lastTxRateBucket){const e=this.requestCount/(t-this.lastTxRateBucket);this.measuredTxRate=this.getPrecise(e*this.smooth+this.measuredTxRate*(1-this.smooth)),this.requestCount=0,this.lastTxRateBucket=t}}getPrecise(e){return parseFloat(e.toFixed(8))}}const Dt=({retryDelay:e,retryCount:t,retryCost:n})=>({getRetryCount:()=>t,getRetryDelay:()=>Math.min(2e4,e),getRetryCost:()=>n});class jt{constructor(e){this.maxAttempts=e,this.mode=Tt.STANDARD,this.capacity=500,this.retryBackoffStrategy=(()=>{let e=100;return{computeNextBackoffDelay:t=>Math.floor(Math.min(2e4,Math.random()*2**t*e)),setDelayBase:t=>{e=t}}})(),this.maxAttemptsProvider="function"==typeof e?e:async()=>e}async acquireInitialRetryToken(e){return Dt({retryDelay:100,retryCount:0})}async refreshRetryTokenForRetry(e,t){const n=await this.getMaxAttempts();if(this.shouldRetry(e,t,n)){const n=t.errorType;this.retryBackoffStrategy.setDelayBase("THROTTLING"===n?500:100);const r=this.retryBackoffStrategy.computeNextBackoffDelay(e.getRetryCount()),s=t.retryAfterHint?Math.max(t.retryAfterHint.getTime()-Date.now()||0,r):r,o=this.getCapacityCost(n);return this.capacity-=o,Dt({retryDelay:s,retryCount:e.getRetryCount()+1,retryCost:o})}throw new Error("No retry token available")}recordSuccess(e){this.capacity=Math.max(500,this.capacity+(e.getRetryCost()??1))}getCapacity(){return this.capacity}async getMaxAttempts(){try{return await this.maxAttemptsProvider()}catch(e){return console.warn("Max attempts provider could not resolve. Using default of 3"),3}}shouldRetry(e,t,n){return e.getRetryCount()+1<n&&this.capacity>=this.getCapacityCost(t.errorType)&&this.isRetryableError(t.errorType)}getCapacityCost(e){return"TRANSIENT"===e?10:5}isRetryableError(e){return"THROTTLING"===e||"TRANSIENT"===e}}class Lt{constructor(e,t){this.maxAttemptsProvider=e,this.mode=Tt.ADAPTIVE;const{rateLimiter:n}=t??{};this.rateLimiter=n??new Nt,this.standardRetryStrategy=new jt(e)}async acquireInitialRetryToken(e){return await this.rateLimiter.getSendToken(),this.standardRetryStrategy.acquireInitialRetryToken(e)}async refreshRetryTokenForRetry(e,t){return this.rateLimiter.updateClientSendingRate(t),this.standardRetryStrategy.refreshRetryTokenForRetry(e,t)}recordSuccess(e){this.rateLimiter.updateClientSendingRate({}),this.standardRetryStrategy.recordSuccess(e)}}let Mt;const Ut=new Uint8Array(16);function Ft(){if(!Mt&&(Mt="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Mt))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Mt(Ut)}const zt=[];for(let e=0;e<256;++e)zt.push((e+256).toString(16).slice(1));var qt={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Wt(e,t,n){if(qt.randomUUID&&!t&&!e)return qt.randomUUID();const r=(e=e||{}).random||(e.rng||Ft)();return r[6]=15&r[6]|64,r[8]=63&r[8]|128,function(e,t=0){return zt[e[t+0]]+zt[e[t+1]]+zt[e[t+2]]+zt[e[t+3]]+"-"+zt[e[t+4]]+zt[e[t+5]]+"-"+zt[e[t+6]]+zt[e[t+7]]+"-"+zt[e[t+8]]+zt[e[t+9]]+"-"+zt[e[t+10]]+zt[e[t+11]]+zt[e[t+12]]+zt[e[t+13]]+zt[e[t+14]]+zt[e[t+15]]}(r)}const Bt="AWS_MAX_ATTEMPTS",Ht="max_attempts",Vt={environmentVariableSelector:e=>{const t=e[Bt];if(!t)return;const n=parseInt(t);if(Number.isNaN(n))throw new Error(`Environment variable ${Bt} mast be a number, got "${t}"`);return n},configFileSelector:e=>{const t=e[Ht];if(!t)return;const n=parseInt(t);if(Number.isNaN(n))throw new Error(`Shared config file entry ${Ht} mast be a number, got "${t}"`);return n},default:3},Kt=e=>{const{retryStrategy:t}=e,n=be(e.maxAttempts??3);return{...e,maxAttempts:n,retryStrategy:async()=>{if(t)return t;return await be(e.retryMode)()===Tt.ADAPTIVE?new Lt(n):new jt(n)}}},Gt={environmentVariableSelector:e=>e.AWS_RETRY_MODE,configFileSelector:e=>e.retry_mode,default:It};class Xt{trace(){}debug(){}info(){}warn(){}error(){}}const Jt=(e,t)=>{const n=[];if(e&&n.push(e),t)for(const e of t)n.push(e);return n},Yt=(e,t)=>`${e||"anonymous"}${t&&t.length>0?` (a.k.a. ${t.join(",")})`:""}`,Zt=()=>{let e=[],t=[],n=!1;const r=new Set,s=n=>(e.forEach((e=>{n.add(e.middleware,{...e})})),t.forEach((e=>{n.addRelativeTo(e.middleware,{...e})})),n.identifyOnResolve?.(a.identifyOnResolve()),n),o=e=>{const t=[];return e.before.forEach((e=>{0===e.before.length&&0===e.after.length?t.push(e):t.push(...o(e))})),t.push(e),e.after.reverse().forEach((e=>{0===e.before.length&&0===e.after.length?t.push(e):t.push(...o(e))})),t},i=(n=!1)=>{const r=[],s=[],i={};e.forEach((e=>{const t={...e,before:[],after:[]};for(const e of Jt(t.name,t.aliases))i[e]=t;r.push(t)})),t.forEach((e=>{const t={...e,before:[],after:[]};for(const e of Jt(t.name,t.aliases))i[e]=t;s.push(t)})),s.forEach((e=>{if(e.toMiddleware){const t=i[e.toMiddleware];if(void 0===t){if(n)return;throw new Error(`${e.toMiddleware} is not found when adding ${Yt(e.name,e.aliases)} middleware ${e.relation} ${e.toMiddleware}`)}"after"===e.relation&&t.after.push(e),"before"===e.relation&&t.before.push(e)}}));const a=(c=r,c.sort(((e,t)=>Qt[t.step]-Qt[e.step]||en[t.priority||"normal"]-en[e.priority||"normal"]))).map(o).reduce(((e,t)=>(e.push(...t),e)),[]);var c;return a},a={add:(t,n={})=>{const{name:s,override:o,aliases:i}=n,a={step:"initialize",priority:"normal",middleware:t,...n},c=Jt(s,i);if(c.length>0){if(c.some((e=>r.has(e)))){if(!o)throw new Error(`Duplicate middleware name '${Yt(s,i)}'`);for(const t of c){const n=e.findIndex((e=>e.name===t||e.aliases?.some((e=>e===t))));if(-1===n)continue;const r=e[n];if(r.step!==a.step||a.priority!==r.priority)throw new Error(`"${Yt(r.name,r.aliases)}" middleware with ${r.priority} priority in ${r.step} step cannot be overridden by "${Yt(s,i)}" middleware with ${a.priority} priority in ${a.step} step.`);e.splice(n,1)}}for(const e of c)r.add(e)}e.push(a)},addRelativeTo:(e,n)=>{const{name:s,override:o,aliases:i}=n,a={middleware:e,...n},c=Jt(s,i);if(c.length>0){if(c.some((e=>r.has(e)))){if(!o)throw new Error(`Duplicate middleware name '${Yt(s,i)}'`);for(const e of c){const n=t.findIndex((t=>t.name===e||t.aliases?.some((t=>t===e))));if(-1===n)continue;const r=t[n];if(r.toMiddleware!==a.toMiddleware||r.relation!==a.relation)throw new Error(`"${Yt(r.name,r.aliases)}" middleware ${r.relation} "${r.toMiddleware}" middleware cannot be overridden by "${Yt(s,i)}" middleware ${a.relation} "${a.toMiddleware}" middleware.`);t.splice(n,1)}}for(const e of c)r.add(e)}t.push(a)},clone:()=>s(Zt()),use:e=>{e.applyToStack(a)},remove:n=>"string"==typeof n?(n=>{let s=!1;const o=e=>{const t=Jt(e.name,e.aliases);if(t.includes(n)){s=!0;for(const e of t)r.delete(e);return!1}return!0};return e=e.filter(o),t=t.filter(o),s})(n):(n=>{let s=!1;const o=e=>{if(e.middleware===n){s=!0;for(const t of Jt(e.name,e.aliases))r.delete(t);return!1}return!0};return e=e.filter(o),t=t.filter(o),s})(n),removeByTag:n=>{let s=!1;const o=e=>{const{tags:t,name:o,aliases:i}=e;if(t&&t.includes(n)){const e=Jt(o,i);for(const t of e)r.delete(t);return s=!0,!1}return!0};return e=e.filter(o),t=t.filter(o),s},concat:e=>{const t=s(Zt());return t.use(e),t.identifyOnResolve(n||t.identifyOnResolve()||(e.identifyOnResolve?.()??!1)),t},applyToStack:s,identify:()=>i(!0).map((e=>{const t=e.step??e.relation+" "+e.toMiddleware;return Yt(e.name,e.aliases)+" - "+t})),identifyOnResolve:e=>("boolean"==typeof e&&(n=e),n),resolve:(e,t)=>{for(const n of i().map((e=>e.middleware)).reverse())e=n(e,t);return n&&console.log(a.identify()),e}};return a},Qt={initialize:5,serialize:4,build:3,finalizeRequest:2,deserialize:1},en={high:3,normal:2,low:1};class tn{constructor(e){this.middlewareStack=Zt(),this.config=e}send(e,t,n){const r="function"!=typeof t?t:void 0,s="function"==typeof t?t:n,o=e.resolveMiddleware(this.middlewareStack,this.config,r);if(!s)return o(e).then((e=>e.output));o(e).then((e=>s(null,e.output)),(e=>s(e))).catch((()=>{}))}destroy(){this.config.requestHandler.destroy&&this.config.requestHandler.destroy()}}const nn=e=>"function"==typeof ArrayBuffer&&e instanceof ArrayBuffer||"[object ArrayBuffer]"===Object.prototype.toString.call(e),rn=(t,n=0,r=t.byteLength-n)=>{if(!nn(t))throw new TypeError(`The "input" argument must be ArrayBuffer. Received type ${typeof t} (${t})`);return e.Buffer.from(t,n,r)},sn=(t,n)=>{if("string"!=typeof t)throw new TypeError(`The "input" argument must be of type string. Received type ${typeof t} (${t})`);return n?e.Buffer.from(t,n):e.Buffer.from(t)},on=/^[A-Za-z0-9+/]*={0,2}$/,an=e=>{if(3*e.length%4!=0)throw new TypeError("Incorrect padding on base64 string.");if(!on.exec(e))throw new TypeError("Invalid base64 string.");const t=sn(e,"base64");return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)},cn=e=>{const t=sn(e,"utf8");return new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT)},ln=e=>"string"==typeof e?cn(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e),un=e=>{if("string"==typeof e)return e;if("object"!=typeof e||"number"!=typeof e.byteOffset||"number"!=typeof e.byteLength)throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.");return rn(e.buffer,e.byteOffset,e.byteLength).toString("utf8")},dn=e=>{let t;if(t="string"==typeof e?cn(e):e,"object"!=typeof t||"number"!=typeof t.byteOffset||"number"!=typeof t.byteLength)throw new Error("@smithy/util-base64: toBase64 encoder function only accepts string | Uint8Array.");return rn(t.buffer,t.byteOffset,t.byteLength).toString("base64")};class pn extends Uint8Array{static fromString(e,t="utf-8"){if("string"==typeof e)return function(e,t){return"base64"===t?pn.mutate(an(e)):pn.mutate(cn(e))}(e,t);throw new Error(`Unsupported conversion from ${typeof e} to Uint8ArrayBlobAdapter.`)}static mutate(e){return Object.setPrototypeOf(e,pn.prototype),e}transformToString(e="utf-8"){return function(e,t="utf-8"){return"base64"===t?dn(e):un(e)}(this,e)}}const hn=e=>encodeURIComponent(e).replace(/[!'()*]/g,fn),fn=e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`;const gn=["ECONNRESET","EPIPE","ETIMEDOUT"],mn=e=>{const t={};for(const n of Object.keys(e)){const r=e[n];t[n]=Array.isArray(r)?r.join(","):r}return t};async function yn(e,n,r=1e3){const s=n.headers??{},o=s.Expect||s.expect;let i=-1,a=!1;"100-continue"===o&&await Promise.race([new Promise((e=>{i=Number(setTimeout(e,Math.max(1e3,r)))})),new Promise((t=>{e.on("continue",(()=>{clearTimeout(i),t()})),e.on("error",(()=>{a=!0,clearTimeout(i),t()}))}))]),a||function(e,n){if(n instanceof t.Readable)return void n.pipe(e);if(n){if(Buffer.isBuffer(n)||"string"==typeof n)return void e.end(n);const t=n;return"object"==typeof t&&t.buffer&&"number"==typeof t.byteOffset&&"number"==typeof t.byteLength?void e.end(Buffer.from(t.buffer,t.byteOffset,t.byteLength)):void e.end(Buffer.from(n))}e.end()}(e,n.body)}class wn{static create(e){return"function"==typeof e?.handle?e:new wn(e)}static checkSocketUsage(e,t,n=console){const{sockets:r,requests:s,maxSockets:o}=e;if("number"!=typeof o||o===1/0)return t;if(Date.now()-15e3<t)return t;if(r&&s)for(const e in r){const t=r[e]?.length??0,i=s[e]?.length??0;if(t>=o&&i>=2*o)return n?.warn?.(`@smithy/node-http-handler:WARN - socket usage at capacity=${t} and ${i} additional requests are enqueued.\nSee https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/node-configuring-maxsockets.html\nor increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler config.`),Date.now()}return t}constructor(e){this.socketWarningTimestamp=0,this.metadata={handlerProtocol:"http/1.1"},this.configProvider=new Promise(((t,n)=>{"function"==typeof e?e().then((e=>{t(this.resolveDefaultConfig(e))})).catch(n):t(this.resolveDefaultConfig(e))}))}resolveDefaultConfig(e){const{requestTimeout:t,connectionTimeout:s,socketTimeout:o,httpAgent:i,httpsAgent:a}=e||{},c=!0;return{connectionTimeout:s,requestTimeout:t??o,httpAgent:i instanceof n.Agent||"function"==typeof i?.destroy?i:new n.Agent({keepAlive:c,maxSockets:50,...i}),httpsAgent:a instanceof r.Agent||"function"==typeof a?.destroy?a:new r.Agent({keepAlive:c,maxSockets:50,...a}),logger:console}}destroy(){this.config?.httpAgent?.destroy(),this.config?.httpsAgent?.destroy()}async handle(e,{abortSignal:t}={}){let s;return this.config||(this.config=await this.configProvider),new Promise(((o,i)=>{let a;const c=async e=>{await a,clearTimeout(s),i(e)};if(!this.config)throw new Error("Node HTTP request handler config is not resolved");if(t?.aborted){const e=new Error("Request aborted");return e.name="AbortError",void c(e)}const l="https:"===e.protocol,u=l?this.config.httpsAgent:this.config.httpAgent;s=setTimeout((()=>{this.socketWarningTimestamp=wn.checkSocketUsage(u,this.socketWarningTimestamp,this.config.logger)}),this.config.socketAcquisitionWarningTimeout??(this.config.requestTimeout??2e3)+(this.config.connectionTimeout??1e3));const d=function(e){const t=[];for(let n of Object.keys(e).sort()){const r=e[n];if(n=hn(n),Array.isArray(r))for(let e=0,s=r.length;e<s;e++)t.push(`${n}=${hn(r[e])}`);else{let e=n;(r||"string"==typeof r)&&(e+=`=${hn(r)}`),t.push(e)}}return t.join("&")}(e.query||{});let p;if(null!=e.username||null!=e.password){p=`${e.username??""}:${e.password??""}`}let h=e.path;d&&(h+=`?${d}`),e.fragment&&(h+=`#${e.fragment}`);const f={headers:e.headers,host:e.hostname,method:e.method,path:h,port:e.port,agent:u,auth:p},g=(l?r.request:n.request)(f,(e=>{(async e=>{await a,clearTimeout(s),o(e)})({response:new A({statusCode:e.statusCode||-1,reason:e.statusMessage,headers:mn(e.headers),body:e})})}));if(g.on("error",(e=>{gn.includes(e.code)?c(Object.assign(e,{name:"TimeoutError"})):c(e)})),((e,t,n=0)=>{if(!n)return;const r=setTimeout((()=>{e.destroy(),t(Object.assign(new Error(`Socket timed out without establishing a connection within ${n} ms`),{name:"TimeoutError"}))}),n);e.on("socket",(e=>{e.connecting?e.on("connect",(()=>{clearTimeout(r)})):clearTimeout(r)}))})(g,c,this.config.connectionTimeout),((e,t,n=0)=>{e.setTimeout(n,(()=>{e.destroy(),t(Object.assign(new Error(`Connection timed out after ${n} ms`),{name:"TimeoutError"}))}))})(g,c,this.config.requestTimeout),t){const e=()=>{g.destroy();const e=new Error("Request aborted");e.name="AbortError",c(e)};if("function"==typeof t.addEventListener){const n=t;n.addEventListener("abort",e,{once:!0}),g.once("close",(()=>n.removeEventListener("abort",e)))}else t.onabort=e}const m=f.agent;"object"==typeof m&&"keepAlive"in m&&((e,{keepAlive:t,keepAliveMsecs:n})=>{!0===t&&e.on("socket",(e=>{e.setKeepAlive(t,n||0)}))})(g,{keepAlive:m.keepAlive,keepAliveMsecs:m.keepAliveMsecs}),a=yn(g,e,this.config.requestTimeout).catch((e=>(clearTimeout(s),i(e))))}))}updateHttpClientConfig(e,t){this.config=void 0,this.configProvider=this.configProvider.then((n=>({...n,[e]:t})))}httpHandlerConfigs(){return this.config??{}}}class bn extends t.Writable{constructor(){super(...arguments),this.bufferedBytes=[]}_write(e,t,n){this.bufferedBytes.push(e),n()}}const vn=e=>Sn(e)?async function(e){const t=[],n=e.getReader();let r=!1,s=0;for(;!r;){const{done:e,value:o}=await n.read();o&&(t.push(o),s+=o.length),r=e}const o=new Uint8Array(s);let i=0;for(const e of t)o.set(e,i),i+=e.length;return o}(e):new Promise(((t,n)=>{const r=new bn;e.pipe(r),e.on("error",(e=>{r.end(),n(e)})),r.on("error",n),r.on("finish",(function(){const e=new Uint8Array(Buffer.concat(this.bufferedBytes));t(e)}))})),Sn=e=>"function"==typeof ReadableStream&&e instanceof ReadableStream;const En=e=>"function"==typeof Blob&&e instanceof Blob?async function(e){const t=await function(e){return new Promise(((t,n)=>{const r=new FileReader;r.onloadend=()=>{if(2!==r.readyState)return n(new Error("Reader aborted too early"));const e=r.result??"",s=e.indexOf(","),o=s>-1?s+1:e.length;t(e.substring(o))},r.onabort=()=>n(new Error("Read aborted")),r.onerror=()=>n(r.error),r.readAsDataURL(e)}))}(e),n=an(t);return new Uint8Array(n)}(e):async function(e){const t=[],n=e.getReader();let r=!1,s=0;for(;!r;){const{done:e,value:o}=await n.read();o&&(t.push(o),s+=o.length),r=e}const o=new Uint8Array(s);let i=0;for(const e of t)o.set(e,i),i+=e.length;return o}(e);const xn={},An={};for(let e=0;e<256;e++){let t=e.toString(16).toLowerCase();1===t.length&&(t=`0${t}`),xn[e]=t,An[t]=e}function Pn(e){let t="";for(let n=0;n<e.byteLength;n++)t+=xn[e[n]];return t}const Tn=e=>"function"==typeof ReadableStream&&(e?.constructor?.name===ReadableStream.name||e instanceof ReadableStream),In="The stream has already been transformed.",Cn=e=>{if(!kn(e)&&!Tn(e)){throw new Error(`Unexpected stream implementation, expect Blob or ReadableStream, got ${e?.__proto__?.constructor?.name||e}`)}let t=!1;const n=async()=>{if(t)throw new Error(In);return t=!0,await En(e)};return Object.assign(e,{transformToByteArray:n,transformToString:async e=>{const t=await n();if("base64"===e)return dn(t);if("hex"===e)return Pn(t);if(void 0===e||"utf8"===e||"utf-8"===e)return un(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(In);if(t=!0,kn(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(Tn(e))return e;throw new Error(`Cannot transform payload to web stream, got ${e}`)}})},kn=e=>"function"==typeof Blob&&e instanceof Blob,_n="The stream has already been transformed.",Rn=e=>{if(!(e instanceof t.Readable))try{return Cn(e)}catch(t){throw new Error(`Unexpected stream implementation, expect Stream.Readable instance, got ${e?.__proto__?.constructor?.name||e}`)}let n=!1;const r=async()=>{if(n)throw new Error(_n);return n=!0,await vn(e)};return Object.assign(e,{transformToByteArray:r,transformToString:async e=>{const t=await r();if(void 0===e||Buffer.isEncoding(e))return rn(t.buffer,t.byteOffset,t.byteLength).toString(e);return new s.TextDecoder(e).decode(t)},transformToWebStream:()=>{if(n)throw new Error(_n);if(null!==e.readableFlowing)throw new Error("The stream has been consumed by other callbacks.");if("function"!=typeof t.Readable.toWeb)throw new Error("Readable.toWeb() is not supported. Please make sure you are using Node.js >= 17.0.0, or polyfill is available.");return n=!0,t.Readable.toWeb(e)}})};class On{constructor(){this.middlewareStack=Zt()}static classBuilder(){return new $n}resolveMiddlewareWithContext(e,t,n,{middlewareFn:r,clientName:s,commandName:o,inputFilterSensitiveLog:i,outputFilterSensitiveLog:a,smithyContext:c,additionalContext:l,CommandCtor:u}){for(const s of r.bind(this)(u,e,t,n))this.middlewareStack.use(s);const d=e.concat(this.middlewareStack),{logger:p}=t,h={logger:p,clientName:s,commandName:o,inputFilterSensitiveLog:i,outputFilterSensitiveLog:a,[v]:{commandInstance:this,...c},...l},{requestHandler:f}=t;return d.resolve((e=>f.handle(e.request,n||{})),h)}}class $n{constructor(){this._init=()=>{},this._ep={},this._middlewareFn=()=>[],this._commandName="",this._clientName="",this._additionalContext={},this._smithyContext={},this._inputFilterSensitiveLog=e=>e,this._outputFilterSensitiveLog=e=>e,this._serializer=null,this._deserializer=null}init(e){this._init=e}ep(e){return this._ep=e,this}m(e){return this._middlewareFn=e,this}s(e,t,n={}){return this._smithyContext={service:e,operation:t,...n},this}c(e={}){return this._additionalContext=e,this}n(e,t){return this._clientName=e,this._commandName=t,this}f(e=e=>e,t=e=>e){return this._inputFilterSensitiveLog=e,this._outputFilterSensitiveLog=t,this}ser(e){return this._serializer=e,this}de(e){return this._deserializer=e,this}build(){const e=this;let t;return t=class extends On{static getEndpointParameterInstructions(){return e._ep}constructor(...[t]){super(),this.serialize=e._serializer,this.deserialize=e._deserializer,this.input=t??{},e._init(this)}resolveMiddleware(n,r,s){return this.resolveMiddlewareWithContext(n,r,s,{CommandCtor:t,middlewareFn:e._middlewareFn,clientName:e._clientName,commandName:e._commandName,inputFilterSensitiveLog:e._inputFilterSensitiveLog,outputFilterSensitiveLog:e._outputFilterSensitiveLog,smithyContext:e._smithyContext,additionalContext:e._additionalContext})}}}}const Nn="***SensitiveInformation***",Dn=Math.ceil(2**127*(2-2**-23)),jn=e=>{const t=(e=>{if(null!=e){if("string"==typeof e){const t=parseFloat(e);if(!Number.isNaN(t))return String(t)!==String(e)&&Jn.warn(Xn(`Expected number but observed string: ${e}`)),t}if("number"==typeof e)return e;throw new TypeError(`Expected number, got ${typeof e}: ${e}`)}})(e);if(void 0!==t&&!Number.isNaN(t)&&t!==1/0&&t!==-1/0&&Math.abs(t)>Dn)throw new TypeError(`Expected 32-bit float, got ${e}`);return t},Ln=e=>Fn(e,32),Mn=e=>Fn(e,16),Un=e=>Fn(e,8),Fn=(e,t)=>{const n=(e=>{if(null!=e){if(Number.isInteger(e)&&!Number.isNaN(e))return e;throw new TypeError(`Expected integer, got ${typeof e}: ${e}`)}})(e);if(void 0!==n&&zn(n,t)!==n)throw new TypeError(`Expected ${t}-bit integer, got ${e}`);return n},zn=(e,t)=>{switch(t){case 32:return Int32Array.of(e)[0];case 16:return Int16Array.of(e)[0];case 8:return Int8Array.of(e)[0]}},qn=(e,t)=>{if(null==e){if(t)throw new TypeError(`Expected a non-null value for ${t}`);throw new TypeError("Expected a non-null value")}return e},Wn=e=>{if(null==e)return;if("object"==typeof e&&!Array.isArray(e))return e;const t=Array.isArray(e)?"array":typeof e;throw new TypeError(`Expected object, got ${t}: ${e}`)},Bn=e=>{if(null!=e){if("string"==typeof e)return e;if(["boolean","number","bigint"].includes(typeof e))return Jn.warn(Xn(`Expected string, got ${typeof e}: ${e}`)),String(e);throw new TypeError(`Expected string, got ${typeof e}: ${e}`)}},Hn=/(-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?)|(-?Infinity)|(NaN)/g,Vn=e=>{const t=e.match(Hn);if(null===t||t[0].length!==e.length)throw new TypeError("Expected real number, got implicit NaN");return parseFloat(e)},Kn=e=>Ln("string"==typeof e?Vn(e):e),Gn=e=>Mn("string"==typeof e?Vn(e):e),Xn=e=>String(new TypeError(e).stack||e).split("\n").slice(0,5).filter((e=>!e.includes("stackTraceWarning"))).join("\n"),Jn={warn:console.warn},Yn=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Zn=new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?[zZ]$/),Qn=e=>{if(null==e)return;if("string"!=typeof e)throw new TypeError("RFC-3339 date-times must be expressed as strings");const t=Zn.exec(e);if(!t)throw new TypeError("Invalid RFC-3339 date-time value");const[n,r,s,o,i,a,c,l]=t,u=Gn(cr(r)),d=or(s,"month",1,12),p=or(o,"day",1,31);return tr(u,d,p,{hours:i,minutes:a,seconds:c,fractionalMilliseconds:l})},er=new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(([-+]\d{2}\:\d{2})|[zZ])$/),tr=(e,t,n,r)=>{const s=t-1;return rr(e,s,n),new Date(Date.UTC(e,s,n,or(r.hours,"hour",0,23),or(r.minutes,"minute",0,59),or(r.seconds,"seconds",0,60),ir(r.fractionalMilliseconds)))},nr=[31,28,31,30,31,30,31,31,30,31,30,31],rr=(e,t,n)=>{let r=nr[t];if(1===t&&sr(e)&&(r=29),n>r)throw new TypeError(`Invalid day for ${Yn[t]} in ${e}: ${n}`)},sr=e=>e%4==0&&(e%100!=0||e%400==0),or=(e,t,n,r)=>{const s=(e=>Un("string"==typeof e?Vn(e):e))(cr(e));if(s<n||s>r)throw new TypeError(`${t} must be between ${n} and ${r}, inclusive`);return s},ir=e=>null==e?0:1e3*(e=>jn("string"==typeof e?Vn(e):e))("0."+e),ar=e=>{const t=e[0];let n=1;if("+"==t)n=1;else{if("-"!=t)throw new TypeError(`Offset direction, ${t}, must be "+" or "-"`);n=-1}return n*(60*Number(e.substring(1,3))+Number(e.substring(4,6)))*60*1e3},cr=e=>{let t=0;for(;t<e.length-1&&"0"===e.charAt(t);)t++;return 0===t?e:e.slice(t)};class lr extends Error{constructor(e){super(e.message),Object.setPrototypeOf(this,lr.prototype),this.name=e.name,this.$fault=e.$fault,this.$metadata=e.$metadata}}const ur=(e,t={})=>{Object.entries(t).filter((([,e])=>void 0!==e)).forEach((([t,n])=>{null!=e[t]&&""!==e[t]||(e[t]=n)}));const n=e.message||e.Message||"UnknownError";return e.message=n,delete e.Message,e},dr=e=>({output:t,parsedBody:n,errorCode:r})=>{(({output:e,parsedBody:t,exceptionCtor:n,errorCode:r})=>{const s=pr(e),o=s.httpStatusCode?s.httpStatusCode+"":void 0,i=new n({name:t?.code||t?.Code||r||o||"UnknownError",$fault:"client",$metadata:s});throw ur(i,t)})({output:t,parsedBody:n,exceptionCtor:e,errorCode:r})},pr=e=>({httpStatusCode:e.statusCode,requestId:e.headers["x-amzn-requestid"]??e.headers["x-amzn-request-id"]??e.headers["x-amz-request-id"],extendedRequestId:e.headers["x-amz-id-2"],cfId:e.headers["x-amz-cf-id"]}),hr=e=>{switch(e){case"standard":case"cross-region":return{retryMode:"standard",connectionTimeout:3100};case"in-region":return{retryMode:"standard",connectionTimeout:1100};case"mobile":return{retryMode:"standard",connectionTimeout:3e4};default:return{}}};let fr=!1;const gr=e=>{e&&!fr&&parseInt(e.substring(1,e.indexOf(".")))<16&&(fr=!0)},mr=e=>{const t=[];for(const n in w){const r=w[n];void 0!==e[r]&&t.push({algorithmId:()=>r,checksumConstructor:()=>e[r]})}return{_checksumAlgorithms:t,addChecksumAlgorithm(e){this._checksumAlgorithms.push(e)},checksumAlgorithms(){return this._checksumAlgorithms}}},yr=e=>{const t={};return e.checksumAlgorithms().forEach((e=>{t[e.algorithmId()]=e.checksumConstructor()})),t},wr=e=>{let t=e.retryStrategy;return{setRetryStrategy(e){t=e},retryStrategy:()=>t}},br=e=>{const t={};return t.retryStrategy=e.retryStrategy(),t},vr=e=>({...mr(e),...wr(e)}),Sr=e=>({...yr(e),...br(e)});function Er(e){return encodeURIComponent(e).replace(/[!'()*]/g,(function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()}))}const xr=e=>{const t="#text";for(const n in e)e.hasOwnProperty(n)&&void 0!==e[n][t]?e[n]=e[n][t]:"object"==typeof e[n]&&null!==e[n]&&(e[n]=xr(e[n]));return e},Ar=function(){const e=Object.getPrototypeOf(this).constructor,t=new(Function.bind.apply(String,[null,...arguments]));return Object.setPrototypeOf(t,e.prototype),t};function Pr(e,t,n){let r,s,o;if(void 0===t&&void 0===n)r={},o=e;else{if(r=e,"function"==typeof t)return s=t,o=n,Ir(r,s,o);o=t}for(const e of Object.keys(o))Array.isArray(o[e])?Cr(r,null,o,e):r[e]=o[e];return r}Ar.prototype=Object.create(String.prototype,{constructor:{value:Ar,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf(Ar,String);const Tr=(e,t)=>{const n={};for(const r in t)Cr(n,e,t,r);return n},Ir=(e,t,n)=>Pr(e,Object.entries(n).reduce(((e,[n,r])=>(Array.isArray(r)?e[n]=r:e[n]="function"==typeof r?[t,r()]:[t,r],e)),{})),Cr=(e,t,n,r)=>{if(null!==t){let s=n[r];"function"==typeof s&&(s=[,s]);const[o=kr,i=_r,a=r]=s;return void(("function"==typeof o&&o(t[a])||"function"!=typeof o&&o)&&(e[r]=i(t[a])))}let[s,o]=n[r];if("function"==typeof o){let t;const n=void 0===s&&null!=(t=o()),i="function"==typeof s&&!!s(void 0)||"function"!=typeof s&&!!s;n?e[r]=t:i&&(e[r]=o())}else{const t=void 0===s&&null!=o,n="function"==typeof s&&!!s(o)||"function"!=typeof s&&!!s;(t||n)&&(e[r]=o)}},kr=e=>null!=e,_r=e=>e,Rr=e=>{if(null==e)return{};if(Array.isArray(e))return e.filter((e=>null!=e)).map(Rr);if("object"==typeof e){const t={};for(const n of Object.keys(e))null!=e[n]&&(t[n]=Rr(e[n]));return t}return e},Or=e=>e?.body instanceof t.Readable||"undefined"!=typeof ReadableStream&&e?.body instanceof ReadableStream,$r=e=>void 0!==e.acquireInitialRetryToken&&void 0!==e.refreshRetryTokenForRetry&&void 0!==e.recordSuccess,Nr=e=>{const t={error:e,errorType:Dr(e)},n=Mr(e.$response);return n&&(t.retryAfterHint=n),t},Dr=e=>Ot(e)?"THROTTLING":$t(e)?"TRANSIENT":(e=>{if(void 0!==e.$metadata?.httpStatusCode){const t=e.$metadata.httpStatusCode;return 500<=t&&t<=599&&!$t(e)}return!1})(e)?"SERVER_ERROR":"CLIENT_ERROR",jr={name:"retryMiddleware",tags:["RETRY"],step:"finalizeRequest",priority:"high",override:!0},Lr=e=>({applyToStack:t=>{t.add((e=>(t,n)=>async r=>{let s=await e.retryStrategy();const o=await e.maxAttempts();if(!$r(s))return s?.mode&&(n.userAgent=[...n.userAgent||[],["cfg/retry-mode",s.mode]]),s.retry(t,r);{let e=await s.acquireInitialRetryToken(n.partition_id),a=new Error,c=0,l=0;const{request:u}=r,d=x.isInstance(u);for(d&&(u.headers["amz-sdk-invocation-id"]=Wt());;)try{d&&(u.headers["amz-sdk-request"]=`attempt=${c+1}; max=${o}`);const{response:n,output:i}=await t(r);return s.recordSuccess(e),i.$metadata.attempts=c+1,i.$metadata.totalRetryDelay=l,{response:n,output:i}}catch(t){const r=Nr(t);if(a=(i=t)instanceof Error?i:i instanceof Object?Object.assign(new Error,i):"string"==typeof i?new Error(i):new Error(`AWS SDK error wrapper for ${i}`),d&&Or(u))throw(n.logger instanceof Xt?console:n.logger)?.warn("An error was encountered in a non-retryable streaming request."),a;try{e=await s.refreshRetryTokenForRetry(e,r)}catch(e){throw a.$metadata||(a.$metadata={}),a.$metadata.attempts=c+1,a.$metadata.totalRetryDelay=l,a}c=e.getRetryCount();const o=e.getRetryDelay();l+=o,await new Promise((e=>setTimeout(e,o)))}}var i})(e),jr)}}),Mr=e=>{if(!A.isInstance(e))return;const t=Object.keys(e.headers).find((e=>"retry-after"===e.toLowerCase()));if(!t)return;const n=e.headers[t],r=Number(n);if(!Number.isNaN(r))return new Date(1e3*r);return new Date(n)},Ur={step:"finalizeRequest",tags:["HTTP_SIGNING"],name:"httpSigningMiddleware",aliases:["apiKeyMiddleware","tokenMiddleware","awsAuthMiddleware"],override:!0,relation:"after",toMiddleware:jr.name},Fr=e=>({applyToStack:e=>{e.addRelativeTo(((e,t)=>async n=>{if(!x.isInstance(n.request))return e(n);const r=we(t).selectedHttpAuthScheme;if(!r)throw new Error("No HttpAuthScheme was selected: unable to sign request");const{httpAuthOption:{signingProperties:s={}},identity:o,signer:i}=r,a=await e({...n,request:await i.sign(n.request,o,s)}).catch((i.errorHandler||At)(s));return(i.successHandler||Pt)(a.response,s),a}),Ur)}});class zr{constructor(e){this.authSchemes=new Map;for(const[t,n]of Object.entries(e))void 0!==n&&this.authSchemes.set(t,n)}getIdentityProvider(e){return this.authSchemes.get(e)}}class qr{async sign(e,t,n){return e}}const Wr=(Br=3e5,e=>Hr(e)&&e.expiration.getTime()-Date.now()<Br);var Br;const Hr=e=>void 0!==e.expiration,Vr=e=>{if("function"==typeof e)return e;const t=Promise.resolve(e);return()=>t};function Kr(e,t){return new Gr(e,t)}class Gr{constructor(e,t){this.input=e,this.context=t,this.query={},this.method="",this.headers={},this.path="",this.body=null,this.hostname="",this.resolvePathStack=[]}async build(){const{hostname:e,protocol:t="https",port:n,path:r}=await this.context.endpoint();this.path=r;for(const e of this.resolvePathStack)e(this.path);return new x({protocol:t,hostname:this.hostname||e,port:n,method:this.method,path:this.path,query:this.query,body:this.body,headers:this.headers})}hn(e){return this.hostname=e,this}bp(e){return this.resolvePathStack.push((t=>{this.path=`${t?.endsWith("/")?t.slice(0,-1):t||""}`+e})),this}p(e,t,n,r){return this.resolvePathStack.push((s=>{this.path=((e,t,n,r,s,o)=>{if(null==t||void 0===t[n])throw new Error("No value provided for input HTTP label: "+n+".");{const t=r();if(t.length<=0)throw new Error("Empty value provided for input HTTP label: "+n+".");e=e.replace(s,o?t.split("/").map((e=>Er(e))).join("/"):Er(t))}return e})(s,this.input,e,t,n,r)})),this}h(e){return this.headers=e,this}q(e){return this.query=e,this}b(e){return this.body=e,this}m(e){return this.method=e,this}}const Xr="content-length";const Jr={step:"build",tags:["SET_CONTENT_LENGTH","CONTENT_LENGTH"],name:"contentLengthMiddleware",override:!0},Yr=e=>({applyToStack:t=>{var n;t.add((n=e.bodyLengthChecker,e=>async t=>{const r=t.request;if(x.isInstance(r)){const{body:e,headers:t}=r;if(e&&-1===Object.keys(t).map((e=>e.toLowerCase())).indexOf(Xr))try{const t=n(e);r.headers={...r.headers,[Xr]:String(t)}}catch(e){}}return e({...t,request:r})}),Jr)}});let Zr=!1;const Qr=e=>{e&&!Zr&&parseInt(e.substring(1,e.indexOf(".")))<18&&(Zr=!0,process.emitWarning("NodeDeprecationWarning: The AWS SDK for JavaScript (v3) will\nno longer support Node.js 16.x on January 6, 2025.\n\nTo continue receiving updates to AWS services, bug fixes, and security\nupdates please upgrade to a supported Node.js LTS version.\n\nMore information can be found at: https://a.co/74kJMmI"))},es=e=>A.isInstance(e)?e.headers?.date??e.headers?.Date:void 0,ts=e=>new Date(Date.now()+e),ns=(e,t)=>{const n=Date.parse(e);return((e,t)=>Math.abs(ts(t).getTime()-e)>=3e5)(n,t)?n-Date.now():t},rs=(e,t)=>{if(!t)throw new Error(`Property \`${e}\` is not resolved for AWS SDK SigV4Auth`);return t};class ss{async sign(e,t,n){if(!x.isInstance(e))throw new Error("The request is not an instance of `HttpRequest` and cannot be signed");const r=await(async e=>{const t=rs("context",e.context),n=rs("config",e.config),r=t.endpointV2?.properties?.authSchemes?.[0],s=rs("signer",n.signer),o=await s(r),i=e?.signingRegion,a=e?.signingRegionSet,c=e?.signingName;return{config:n,signer:o,signingRegion:i,signingRegionSet:a,signingName:c}})(n),{config:s,signer:o}=r;let{signingRegion:i,signingName:a}=r;const c=n.context;if(c?.authSchemes?.length){const[e,t]=c.authSchemes;"sigv4a"===e?.name&&"sigv4"===t?.name&&(i=t?.signingRegion??i,a=t?.signingName??a)}return await o.sign(e,{signingDate:ts(s.systemClockOffset),signingRegion:i,signingService:a})}errorHandler(e){return t=>{const n=t.ServerTime??es(t.$response);if(n){const r=rs("config",e.config),s=r.systemClockOffset;r.systemClockOffset=ns(n,r.systemClockOffset);r.systemClockOffset!==s&&t.$metadata&&(t.$metadata.clockSkewCorrected=!0)}throw t}}successHandler(e,t){const n=es(e);if(n){const e=rs("config",t.config);e.systemClockOffset=ns(n,e.systemClockOffset)}}}const os="X-Amz-Date",is="X-Amz-Signature",as="X-Amz-Security-Token",cs="authorization",ls=os.toLowerCase(),us=[cs,ls,"date"],ds=is.toLowerCase(),ps="x-amz-content-sha256",hs=as.toLowerCase(),fs={authorization:!0,"cache-control":!0,connection:!0,expect:!0,from:!0,"keep-alive":!0,"max-forwards":!0,pragma:!0,referer:!0,te:!0,trailer:!0,"transfer-encoding":!0,upgrade:!0,"user-agent":!0,"x-amzn-trace-id":!0},gs=/^proxy-/,ms=/^sec-/,ys="AWS4-HMAC-SHA256",ws="AWS4-HMAC-SHA256-PAYLOAD",bs="aws4_request",vs={},Ss=[],Es=(e,t,n)=>`${e}/${t}/${n}/${bs}`,xs=(e,t,n)=>{const r=new e(t);return r.update(ln(n)),r.digest()},As=({headers:e},t,n)=>{const r={};for(const s of Object.keys(e).sort()){if(null==e[s])continue;const o=s.toLowerCase();(o in fs||t?.has(o)||gs.test(o)||ms.test(o))&&(!n||n&&!n.has(o))||(r[o]=e[s].trim().replace(/\s+/g," "))}return r},Ps=async({headers:e,body:t},n)=>{for(const t of Object.keys(e))if(t.toLowerCase()===ps)return e[t];if(null==t)return"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";if("string"==typeof t||ArrayBuffer.isView(t)||nn(t)){const e=new n;return e.update(ln(t)),Pn(await e.digest())}return"UNSIGNED-PAYLOAD"};class Ts{format(e){const t=[];for(const n of Object.keys(e)){const r=cn(n);t.push(Uint8Array.from([r.byteLength]),r,this.formatHeaderValue(e[n]))}const n=new Uint8Array(t.reduce(((e,t)=>e+t.byteLength),0));let r=0;for(const e of t)n.set(e,r),r+=e.byteLength;return n}formatHeaderValue(e){switch(e.type){case"boolean":return Uint8Array.from([e.value?0:1]);case"byte":return Uint8Array.from([2,e.value]);case"short":const t=new DataView(new ArrayBuffer(3));return t.setUint8(0,3),t.setInt16(1,e.value,!1),new Uint8Array(t.buffer);case"integer":const n=new DataView(new ArrayBuffer(5));return n.setUint8(0,4),n.setInt32(1,e.value,!1),new Uint8Array(n.buffer);case"long":const r=new Uint8Array(9);return r[0]=5,r.set(e.value.bytes,1),r;case"binary":const s=new DataView(new ArrayBuffer(3+e.value.byteLength));s.setUint8(0,6),s.setUint16(1,e.value.byteLength,!1);const o=new Uint8Array(s.buffer);return o.set(e.value,3),o;case"string":const i=cn(e.value),a=new DataView(new ArrayBuffer(3+i.byteLength));a.setUint8(0,7),a.setUint16(1,i.byteLength,!1);const c=new Uint8Array(a.buffer);return c.set(i,3),c;case"timestamp":const l=new Uint8Array(9);return l[0]=8,l.set(ks.fromNumber(e.value.valueOf()).bytes,1),l;case"uuid":if(!Cs.test(e.value))throw new Error(`Invalid UUID received: ${e.value}`);const u=new Uint8Array(17);return u[0]=9,u.set(function(e){if(e.length%2!=0)throw new Error("Hex encoded strings must have an even number length");const t=new Uint8Array(e.length/2);for(let n=0;n<e.length;n+=2){const r=e.slice(n,n+2).toLowerCase();if(!(r in An))throw new Error(`Cannot decode unrecognized sequence ${r} as hexadecimal`);t[n/2]=An[r]}return t}(e.value.replace(/\-/g,"")),1),u}}}var Is;!function(e){e[e.boolTrue=0]="boolTrue",e[e.boolFalse=1]="boolFalse",e[e.byte=2]="byte",e[e.short=3]="short",e[e.integer=4]="integer",e[e.long=5]="long",e[e.byteArray=6]="byteArray",e[e.string=7]="string",e[e.timestamp=8]="timestamp",e[e.uuid=9]="uuid"}(Is||(Is={}));const Cs=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;class ks{constructor(e){if(this.bytes=e,8!==e.byteLength)throw new Error("Int64 buffers must be exactly 8 bytes")}static fromNumber(e){if(e>0x8000000000000000||e<-0x8000000000000000)throw new Error(`${e} is too large (or, if negative, too small) to represent as an Int64`);const t=new Uint8Array(8);for(let n=7,r=Math.abs(Math.round(e));n>-1&&r>0;n--,r/=256)t[n]=r;return e<0&&_s(t),new ks(t)}valueOf(){const e=this.bytes.slice(0),t=128&e[0];return t&&_s(e),parseInt(Pn(e),16)*(t?-1:1)}toString(){return String(this.valueOf())}}function _s(e){for(let t=0;t<8;t++)e[t]^=255;for(let t=7;t>-1&&(e[t]++,0===e[t]);t--);}const Rs=e=>{e=x.clone(e);for(const t of Object.keys(e.headers))us.indexOf(t.toLowerCase())>-1&&delete e.headers[t];return e},Os=e=>"number"==typeof e?new Date(1e3*e):"string"==typeof e?Number(e)?new Date(1e3*Number(e)):new Date(e):e;class $s{constructor({applyChecksum:e,credentials:t,region:n,service:r,sha256:s,uriEscapePath:o=!0}){this.headerFormatter=new Ts,this.service=r,this.sha256=s,this.uriEscapePath=o,this.applyChecksum="boolean"!=typeof e||e,this.regionProvider=be(n),this.credentialProvider=be(t)}async presign(e,t={}){const{signingDate:n=new Date,expiresIn:r=3600,unsignableHeaders:s,unhoistableHeaders:o,signableHeaders:i,signingRegion:a,signingService:c}=t,l=await this.credentialProvider();this.validateResolvedCredentials(l);const u=a??await this.regionProvider(),{longDate:d,shortDate:p}=Ns(n);if(r>604800)return Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future");const h=Es(p,u,c??this.service),f=((e,t={})=>{const{headers:n,query:r={}}=x.clone(e);for(const e of Object.keys(n)){const s=e.toLowerCase();"x-amz-"!==s.slice(0,6)||t.unhoistableHeaders?.has(s)||(r[e]=n[e],delete n[e])}return{...e,headers:n,query:r}})(Rs(e),{unhoistableHeaders:o});l.sessionToken&&(f.query[as]=l.sessionToken),f.query["X-Amz-Algorithm"]=ys,f.query["X-Amz-Credential"]=`${l.accessKeyId}/${h}`,f.query[os]=d,f.query["X-Amz-Expires"]=r.toString(10);const g=As(f,s,i);return f.query["X-Amz-SignedHeaders"]=Ds(g),f.query[is]=await this.getSignature(d,h,this.getSigningKey(l,u,p,c),this.createCanonicalRequest(f,g,await Ps(e,this.sha256))),f}async sign(e,t){return"string"==typeof e?this.signString(e,t):e.headers&&e.payload?this.signEvent(e,t):e.message?this.signMessage(e,t):this.signRequest(e,t)}async signEvent({headers:e,payload:t},{signingDate:n=new Date,priorSignature:r,signingRegion:s,signingService:o}){const i=s??await this.regionProvider(),{shortDate:a,longDate:c}=Ns(n),l=Es(a,i,o??this.service),u=await Ps({headers:{},body:t},this.sha256),d=new this.sha256;d.update(e);const p=Pn(await d.digest()),h=[ws,c,l,r,p,u].join("\n");return this.signString(h,{signingDate:n,signingRegion:i,signingService:o})}async signMessage(e,{signingDate:t=new Date,signingRegion:n,signingService:r}){return this.signEvent({headers:this.headerFormatter.format(e.message.headers),payload:e.message.body},{signingDate:t,signingRegion:n,signingService:r,priorSignature:e.priorSignature}).then((t=>({message:e.message,signature:t})))}async signString(e,{signingDate:t=new Date,signingRegion:n,signingService:r}={}){const s=await this.credentialProvider();this.validateResolvedCredentials(s);const o=n??await this.regionProvider(),{shortDate:i}=Ns(t),a=new this.sha256(await this.getSigningKey(s,o,i,r));return a.update(ln(e)),Pn(await a.digest())}async signRequest(e,{signingDate:t=new Date,signableHeaders:n,unsignableHeaders:r,signingRegion:s,signingService:o}={}){const i=await this.credentialProvider();this.validateResolvedCredentials(i);const a=s??await this.regionProvider(),c=Rs(e),{longDate:l,shortDate:u}=Ns(t),d=Es(u,a,o??this.service);c.headers[ls]=l,i.sessionToken&&(c.headers[hs]=i.sessionToken);const p=await Ps(c,this.sha256);!((e,t)=>{e=e.toLowerCase();for(const n of Object.keys(t))if(e===n.toLowerCase())return!0;return!1})(ps,c.headers)&&this.applyChecksum&&(c.headers[ps]=p);const h=As(c,r,n),f=await this.getSignature(l,d,this.getSigningKey(i,a,u,o),this.createCanonicalRequest(c,h,p));return c.headers[cs]=`${ys} Credential=${i.accessKeyId}/${d}, SignedHeaders=${Ds(h)}, Signature=${f}`,c}createCanonicalRequest(e,t,n){const r=Object.keys(t).sort();return`${e.method}\n${this.getCanonicalPath(e)}\n${(({query:e={}})=>{const t=[],n={};for(const r of Object.keys(e).sort()){if(r.toLowerCase()===ds)continue;t.push(r);const s=e[r];"string"==typeof s?n[r]=`${hn(r)}=${hn(s)}`:Array.isArray(s)&&(n[r]=s.slice(0).reduce(((e,t)=>e.concat([`${hn(r)}=${hn(t)}`])),[]).sort().join("&"))}return t.map((e=>n[e])).filter((e=>e)).join("&")})(e)}\n${r.map((e=>`${e}:${t[e]}`)).join("\n")}\n\n${r.join(";")}\n${n}`}async createStringToSign(e,t,n){const r=new this.sha256;r.update(ln(n));const s=await r.digest();return`${ys}\n${e}\n${t}\n${Pn(s)}`}getCanonicalPath({path:e}){if(this.uriEscapePath){const t=[];for(const n of e.split("/"))0!==n?.length&&"."!==n&&(".."===n?t.pop():t.push(n));const n=`${e?.startsWith("/")?"/":""}${t.join("/")}${t.length>0&&e?.endsWith("/")?"/":""}`;return hn(n).replace(/%2F/g,"/")}return e}async getSignature(e,t,n,r){const s=await this.createStringToSign(e,t,r),o=new this.sha256(await n);return o.update(ln(s)),Pn(await o.digest())}getSigningKey(e,t,n,r){return(async(e,t,n,r,s)=>{const o=`${n}:${r}:${s}:${Pn(await xs(e,t.secretAccessKey,t.accessKeyId))}:${t.sessionToken}`;if(o in vs)return vs[o];for(Ss.push(o);Ss.length>50;)delete vs[Ss.shift()];let i=`AWS4${t.secretAccessKey}`;for(const t of[n,r,s,bs])i=await xs(e,i,t);return vs[o]=i})(this.sha256,e,n,t,r||this.service)}validateResolvedCredentials(e){if("object"!=typeof e||"string"!=typeof e.accessKeyId||"string"!=typeof e.secretAccessKey)throw new Error("Resolved credential object is not valid")}}const Ns=e=>{const t=(n=e,Os(n).toISOString().replace(/\.\d{3}Z$/,"Z")).replace(/[\-:]/g,"");var n;return{longDate:t,shortDate:t.slice(0,8)}},Ds=e=>Object.keys(e).sort().join(";"),js=e=>{let t;e.credentials&&(t=((e,t,n)=>{if(void 0===e)return;const r="function"!=typeof e?async()=>Promise.resolve(e):e;let s,o,i,a=!1;const c=async e=>{o||(o=r(e));try{s=await o,i=!0,a=!1}finally{o=void 0}return s};return void 0===t?async e=>(i&&!e?.forceRefresh||(s=await c(e)),s):async e=>(i&&!e?.forceRefresh||(s=await c(e)),a?s:n(s)?t(s)?(await c(e),s):s:(a=!0,s))})(e.credentials,Wr,Hr)),t||(t=e.credentialDefaultProvider?Vr(e.credentialDefaultProvider(Object.assign({},e,{parentClientConfig:e}))):async()=>{throw new Error("`credentials` is missing")});const{signingEscapePath:n=!0,systemClockOffset:r=e.systemClockOffset||0,sha256:s}=e;let o;return o=e.signer?Vr(e.signer):e.regionInfoProvider?()=>Vr(e.region)().then((async t=>[await e.regionInfoProvider(t,{useFipsEndpoint:await e.useFipsEndpoint(),useDualstackEndpoint:await e.useDualstackEndpoint()})||{},t])).then((([r,o])=>{const{signingRegion:i,signingService:a}=r;e.signingRegion=e.signingRegion||i||o,e.signingName=e.signingName||a||e.serviceId;const c={...e,credentials:t,region:e.signingRegion,service:e.signingName,sha256:s,uriEscapePath:n};return new(e.signerConstructor||$s)(c)})):async r=>{const o=(r=Object.assign({},{name:"sigv4",signingName:e.signingName||e.defaultSigningName,signingRegion:await Vr(e.region)(),properties:{}},r)).signingRegion,i=r.signingName;e.signingRegion=e.signingRegion||o,e.signingName=e.signingName||i||e.serviceId;const a={...e,credentials:t,region:e.signingRegion,service:e.signingName,sha256:s,uriEscapePath:n};return new(e.signerConstructor||$s)(a)},{...e,systemClockOffset:r,signingEscapePath:n,credentials:t,signer:o}},Ls=(e,t)=>(async(e=new Uint8Array,t)=>{if(e instanceof Uint8Array)return pn.mutate(e);if(!e)return pn.mutate(new Uint8Array);const n=t.streamCollector(e);return pn.mutate(await n)})(e,t).then((e=>t.utf8Encoder(e))),Ms=(e,t)=>Ls(e,t).then((e=>{if(e.length)try{return JSON.parse(e)}catch(t){throw"SyntaxError"===t?.name&&Object.defineProperty(t,"$responseBodyText",{value:e}),t}return{}})),Us=async(e,t)=>{const n=await Ms(e,t);return n.message=n.message??n.Message,n},Fs=(e,t)=>{const n=e=>{let t=e;return"number"==typeof t&&(t=t.toString()),t.indexOf(",")>=0&&(t=t.split(",")[0]),t.indexOf(":")>=0&&(t=t.split(":")[0]),t.indexOf("#")>=0&&(t=t.split("#")[1]),t},r=(s=e.headers,o="x-amzn-errortype",Object.keys(s).find((e=>e.toLowerCase()===o.toLowerCase())));var s,o;return void 0!==r?n(e.headers[r]):void 0!==t.code?n(t.code):void 0!==t.__type?n(t.__type):void 0};var zs="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function qs(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ws={},Bs={};!function(e){const t=":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",n="["+t+"]["+(t+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040")+"]*",r=new RegExp("^"+n+"$");e.isExist=function(e){return void 0!==e},e.isEmptyObject=function(e){return 0===Object.keys(e).length},e.merge=function(e,t,n){if(t){const r=Object.keys(t),s=r.length;for(let o=0;o<s;o++)e[r[o]]="strict"===n?[t[r[o]]]:t[r[o]]}},e.getValue=function(t){return e.isExist(t)?t:""},e.isName=function(e){const t=r.exec(e);return!(null==t)},e.getAllMatches=function(e,t){const n=[];let r=t.exec(e);for(;r;){const s=[];s.startIndex=t.lastIndex-r[0].length;const o=r.length;for(let e=0;e<o;e++)s.push(r[e]);n.push(s),r=t.exec(e)}return n},e.nameRegexp=n}(Bs);const Hs=Bs,Vs={allowBooleanAttributes:!1,unpairedTags:[]};function Ks(e){return" "===e||"\t"===e||"\n"===e||"\r"===e}function Gs(e,t){const n=t;for(;t<e.length;t++)if("?"!=e[t]&&" "!=e[t]);else{const r=e.substr(n,t-n);if(t>5&&"xml"===r)return no("InvalidXml","XML declaration allowed only at the start of the document.",so(e,t));if("?"==e[t]&&">"==e[t+1]){t++;break}}return t}function Xs(e,t){if(e.length>t+5&&"-"===e[t+1]&&"-"===e[t+2]){for(t+=3;t<e.length;t++)if("-"===e[t]&&"-"===e[t+1]&&">"===e[t+2]){t+=2;break}}else if(e.length>t+8&&"D"===e[t+1]&&"O"===e[t+2]&&"C"===e[t+3]&&"T"===e[t+4]&&"Y"===e[t+5]&&"P"===e[t+6]&&"E"===e[t+7]){let n=1;for(t+=8;t<e.length;t++)if("<"===e[t])n++;else if(">"===e[t]&&(n--,0===n))break}else if(e.length>t+9&&"["===e[t+1]&&"C"===e[t+2]&&"D"===e[t+3]&&"A"===e[t+4]&&"T"===e[t+5]&&"A"===e[t+6]&&"["===e[t+7])for(t+=8;t<e.length;t++)if("]"===e[t]&&"]"===e[t+1]&&">"===e[t+2]){t+=2;break}return t}Ws.validate=function(e,t){t=Object.assign({},Vs,t);const n=[];let r=!1,s=!1;"\ufeff"===e[0]&&(e=e.substr(1));for(let i=0;i<e.length;i++)if("<"===e[i]&&"?"===e[i+1]){if(i+=2,i=Gs(e,i),i.err)return i}else{if("<"!==e[i]){if(Ks(e[i]))continue;return no("InvalidChar","char '"+e[i]+"' is not expected.",so(e,i))}{let a=i;if(i++,"!"===e[i]){i=Xs(e,i);continue}{let c=!1;"/"===e[i]&&(c=!0,i++);let l="";for(;i<e.length&&">"!==e[i]&&" "!==e[i]&&"\t"!==e[i]&&"\n"!==e[i]&&"\r"!==e[i];i++)l+=e[i];if(l=l.trim(),"/"===l[l.length-1]&&(l=l.substring(0,l.length-1),i--),o=l,!Hs.isName(o)){let t;return t=0===l.trim().length?"Invalid space after '<'.":"Tag '"+l+"' is an invalid name.",no("InvalidTag",t,so(e,i))}const u=Zs(e,i);if(!1===u)return no("InvalidAttr","Attributes for '"+l+"' have open quote.",so(e,i));let d=u.value;if(i=u.index,"/"===d[d.length-1]){const n=i-d.length;d=d.substring(0,d.length-1);const s=eo(d,t);if(!0!==s)return no(s.err.code,s.err.msg,so(e,n+s.err.line));r=!0}else if(c){if(!u.tagClosed)return no("InvalidTag","Closing tag '"+l+"' doesn't have proper closing.",so(e,i));if(d.trim().length>0)return no("InvalidTag","Closing tag '"+l+"' can't have attributes or invalid starting.",so(e,a));if(0===n.length)return no("InvalidTag","Closing tag '"+l+"' has not been opened.",so(e,a));{const t=n.pop();if(l!==t.tagName){let n=so(e,t.tagStartPos);return no("InvalidTag","Expected closing tag '"+t.tagName+"' (opened in line "+n.line+", col "+n.col+") instead of closing tag '"+l+"'.",so(e,a))}0==n.length&&(s=!0)}}else{const o=eo(d,t);if(!0!==o)return no(o.err.code,o.err.msg,so(e,i-d.length+o.err.line));if(!0===s)return no("InvalidXml","Multiple possible root nodes found.",so(e,i));-1!==t.unpairedTags.indexOf(l)||n.push({tagName:l,tagStartPos:a}),r=!0}for(i++;i<e.length;i++)if("<"===e[i]){if("!"===e[i+1]){i++,i=Xs(e,i);continue}if("?"!==e[i+1])break;if(i=Gs(e,++i),i.err)return i}else if("&"===e[i]){const t=to(e,i);if(-1==t)return no("InvalidChar","char '&' is not expected.",so(e,i));i=t}else if(!0===s&&!Ks(e[i]))return no("InvalidXml","Extra text at the end",so(e,i));"<"===e[i]&&i--}}}var o;return r?1==n.length?no("InvalidTag","Unclosed tag '"+n[0].tagName+"'.",so(e,n[0].tagStartPos)):!(n.length>0)||no("InvalidXml","Invalid '"+JSON.stringify(n.map((e=>e.tagName)),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1}):no("InvalidXml","Start tag expected.",1)};const Js='"',Ys="'";function Zs(e,t){let n="",r="",s=!1;for(;t<e.length;t++){if(e[t]===Js||e[t]===Ys)""===r?r=e[t]:r!==e[t]||(r="");else if(">"===e[t]&&""===r){s=!0;break}n+=e[t]}return""===r&&{value:n,index:t,tagClosed:s}}const Qs=new RegExp("(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['\"])(([\\s\\S])*?)\\5)?","g");function eo(e,t){const n=Hs.getAllMatches(e,Qs),r={};for(let e=0;e<n.length;e++){if(0===n[e][1].length)return no("InvalidAttr","Attribute '"+n[e][2]+"' has no space in starting.",oo(n[e]));if(void 0!==n[e][3]&&void 0===n[e][4])return no("InvalidAttr","Attribute '"+n[e][2]+"' is without value.",oo(n[e]));if(void 0===n[e][3]&&!t.allowBooleanAttributes)return no("InvalidAttr","boolean attribute '"+n[e][2]+"' is not allowed.",oo(n[e]));const s=n[e][2];if(!ro(s))return no("InvalidAttr","Attribute '"+s+"' is an invalid name.",oo(n[e]));if(r.hasOwnProperty(s))return no("InvalidAttr","Attribute '"+s+"' is repeated.",oo(n[e]));r[s]=1}return!0}function to(e,t){if(";"===e[++t])return-1;if("#"===e[t])return function(e,t){let n=/\d/;for("x"===e[t]&&(t++,n=/[\da-fA-F]/);t<e.length;t++){if(";"===e[t])return t;if(!e[t].match(n))break}return-1}(e,++t);let n=0;for(;t<e.length;t++,n++)if(!(e[t].match(/\w/)&&n<20)){if(";"===e[t])break;return-1}return t}function no(e,t,n){return{err:{code:e,msg:t,line:n.line||n,col:n.col}}}function ro(e){return Hs.isName(e)}function so(e,t){const n=e.substring(0,t).split(/\r?\n/);return{line:n.length,col:n[n.length-1].length+1}}function oo(e){return e.startIndex+e[1].length}var io={};const ao={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(e,t){return t},attributeValueProcessor:function(e,t){return t},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(e,t,n){return e}};io.buildOptions=function(e){return Object.assign({},ao,e)},io.defaultOptions=ao;var co=class{constructor(e){this.tagname=e,this.child=[],this[":@"]={}}add(e,t){"__proto__"===e&&(e="#__proto__"),this.child.push({[e]:t})}addChild(e){"__proto__"===e.tagname&&(e.tagname="#__proto__"),e[":@"]&&Object.keys(e[":@"]).length>0?this.child.push({[e.tagname]:e.child,":@":e[":@"]}):this.child.push({[e.tagname]:e.child})}};const lo=Bs;function uo(e,t){let n="";for(;t<e.length&&"'"!==e[t]&&'"'!==e[t];t++)n+=e[t];if(n=n.trim(),-1!==n.indexOf(" "))throw new Error("External entites are not supported");const r=e[t++];let s="";for(;t<e.length&&e[t]!==r;t++)s+=e[t];return[n,s,t]}function po(e,t){return"!"===e[t+1]&&"-"===e[t+2]&&"-"===e[t+3]}function ho(e,t){return"!"===e[t+1]&&"E"===e[t+2]&&"N"===e[t+3]&&"T"===e[t+4]&&"I"===e[t+5]&&"T"===e[t+6]&&"Y"===e[t+7]}function fo(e,t){return"!"===e[t+1]&&"E"===e[t+2]&&"L"===e[t+3]&&"E"===e[t+4]&&"M"===e[t+5]&&"E"===e[t+6]&&"N"===e[t+7]&&"T"===e[t+8]}function go(e,t){return"!"===e[t+1]&&"A"===e[t+2]&&"T"===e[t+3]&&"T"===e[t+4]&&"L"===e[t+5]&&"I"===e[t+6]&&"S"===e[t+7]&&"T"===e[t+8]}function mo(e,t){return"!"===e[t+1]&&"N"===e[t+2]&&"O"===e[t+3]&&"T"===e[t+4]&&"A"===e[t+5]&&"T"===e[t+6]&&"I"===e[t+7]&&"O"===e[t+8]&&"N"===e[t+9]}function yo(e){if(lo.isName(e))return e;throw new Error(`Invalid entity name ${e}`)}var wo=function(e,t){const n={};if("O"!==e[t+3]||"C"!==e[t+4]||"T"!==e[t+5]||"Y"!==e[t+6]||"P"!==e[t+7]||"E"!==e[t+8])throw new Error("Invalid Tag instead of DOCTYPE");{t+=9;let r=1,s=!1,o=!1,i="";for(;t<e.length;t++)if("<"!==e[t]||o)if(">"===e[t]){if(o?"-"===e[t-1]&&"-"===e[t-2]&&(o=!1,r--):r--,0===r)break}else"["===e[t]?s=!0:i+=e[t];else{if(s&&ho(e,t))t+=7,[entityName,val,t]=uo(e,t+1),-1===val.indexOf("&")&&(n[yo(entityName)]={regx:RegExp(`&${entityName};`,"g"),val:val});else if(s&&fo(e,t))t+=8;else if(s&&go(e,t))t+=8;else if(s&&mo(e,t))t+=9;else{if(!po)throw new Error("Invalid DOCTYPE");o=!0}r++,i=""}if(0!==r)throw new Error("Unclosed DOCTYPE")}return{entities:n,i:t}};const bo=/^[-+]?0x[a-fA-F0-9]+$/,vo=/^([\-\+])?(0*)(\.[0-9]+([eE]\-?[0-9]+)?|[0-9]+(\.[0-9]+([eE]\-?[0-9]+)?)?)$/;!Number.parseInt&&window.parseInt&&(Number.parseInt=window.parseInt),!Number.parseFloat&&window.parseFloat&&(Number.parseFloat=window.parseFloat);const So={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};const Eo=Bs,xo=co,Ao=wo,Po=function(e,t={}){if(t=Object.assign({},So,t),!e||"string"!=typeof e)return e;let n=e.trim();if(void 0!==t.skipLike&&t.skipLike.test(n))return e;if(t.hex&&bo.test(n))return Number.parseInt(n,16);{const r=vo.exec(n);if(r){const s=r[1],o=r[2];let i=function(e){if(e&&-1!==e.indexOf("."))return"."===(e=e.replace(/0+$/,""))?e="0":"."===e[0]?e="0"+e:"."===e[e.length-1]&&(e=e.substr(0,e.length-1)),e;return e}(r[3]);const a=r[4]||r[6];if(!t.leadingZeros&&o.length>0&&s&&"."!==n[2])return e;if(!t.leadingZeros&&o.length>0&&!s&&"."!==n[1])return e;{const r=Number(n),c=""+r;return-1!==c.search(/[eE]/)||a?t.eNotation?r:e:-1!==n.indexOf(".")?"0"===c&&""===i||c===i||s&&c==="-"+i?r:e:o?i===c||s+i===c?r:e:n===c||n===s+c?r:e}}return e}};function To(e){const t=Object.keys(e);for(let n=0;n<t.length;n++){const r=t[n];this.lastEntities[r]={regex:new RegExp("&"+r+";","g"),val:e[r]}}}function Io(e,t,n,r,s,o,i){if(void 0!==e&&(this.options.trimValues&&!r&&(e=e.trim()),e.length>0)){i||(e=this.replaceEntitiesValue(e));const r=this.options.tagValueProcessor(t,e,n,s,o);if(null==r)return e;if(typeof r!=typeof e||r!==e)return r;if(this.options.trimValues)return Uo(e,this.options.parseTagValue,this.options.numberParseOptions);return e.trim()===e?Uo(e,this.options.parseTagValue,this.options.numberParseOptions):e}}function Co(e){if(this.options.removeNSPrefix){const t=e.split(":"),n="/"===e.charAt(0)?"/":"";if("xmlns"===t[0])return"";2===t.length&&(e=n+t[1])}return e}const ko=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");function _o(e,t,n){if(!this.options.ignoreAttributes&&"string"==typeof e){const n=Eo.getAllMatches(e,ko),r=n.length,s={};for(let e=0;e<r;e++){const r=this.resolveNameSpace(n[e][1]);let o=n[e][4],i=this.options.attributeNamePrefix+r;if(r.length)if(this.options.transformAttributeName&&(i=this.options.transformAttributeName(i)),"__proto__"===i&&(i="#__proto__"),void 0!==o){this.options.trimValues&&(o=o.trim()),o=this.replaceEntitiesValue(o);const e=this.options.attributeValueProcessor(r,o,t);s[i]=null==e?o:typeof e!=typeof o||e!==o?e:Uo(o,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(s[i]=!0)}if(!Object.keys(s).length)return;if(this.options.attributesGroupName){const e={};return e[this.options.attributesGroupName]=s,e}return s}}const Ro=function(e){e=e.replace(/\r\n?/g,"\n");const t=new xo("!xml");let n=t,r="",s="";for(let o=0;o<e.length;o++){if("<"===e[o])if("/"===e[o+1]){const t=jo(e,">",o,"Closing Tag is not closed.");let i=e.substring(o+2,t).trim();if(this.options.removeNSPrefix){const e=i.indexOf(":");-1!==e&&(i=i.substr(e+1))}this.options.transformTagName&&(i=this.options.transformTagName(i)),n&&(r=this.saveTextToParentTag(r,n,s));const a=s.substring(s.lastIndexOf(".")+1);if(i&&-1!==this.options.unpairedTags.indexOf(i))throw new Error(`Unpaired tag can not be used as closing tag: </${i}>`);let c=0;a&&-1!==this.options.unpairedTags.indexOf(a)?(c=s.lastIndexOf(".",s.lastIndexOf(".")-1),this.tagsNodeStack.pop()):c=s.lastIndexOf("."),s=s.substring(0,c),n=this.tagsNodeStack.pop(),r="",o=t}else if("?"===e[o+1]){let t=Lo(e,o,!1,"?>");if(!t)throw new Error("Pi Tag is not closed.");if(r=this.saveTextToParentTag(r,n,s),this.options.ignoreDeclaration&&"?xml"===t.tagName||this.options.ignorePiTags);else{const e=new xo(t.tagName);e.add(this.options.textNodeName,""),t.tagName!==t.tagExp&&t.attrExpPresent&&(e[":@"]=this.buildAttributesMap(t.tagExp,s,t.tagName)),this.addChild(n,e,s)}o=t.closeIndex+1}else if("!--"===e.substr(o+1,3)){const t=jo(e,"--\x3e",o+4,"Comment is not closed.");if(this.options.commentPropName){const i=e.substring(o+4,t-2);r=this.saveTextToParentTag(r,n,s),n.add(this.options.commentPropName,[{[this.options.textNodeName]:i}])}o=t}else if("!D"===e.substr(o+1,2)){const t=Ao(e,o);this.docTypeEntities=t.entities,o=t.i}else if("!["===e.substr(o+1,2)){const t=jo(e,"]]>",o,"CDATA is not closed.")-2,i=e.substring(o+9,t);r=this.saveTextToParentTag(r,n,s);let a=this.parseTextData(i,n.tagname,s,!0,!1,!0,!0);null==a&&(a=""),this.options.cdataPropName?n.add(this.options.cdataPropName,[{[this.options.textNodeName]:i}]):n.add(this.options.textNodeName,a),o=t+2}else{let i=Lo(e,o,this.options.removeNSPrefix),a=i.tagName;const c=i.rawTagName;let l=i.tagExp,u=i.attrExpPresent,d=i.closeIndex;this.options.transformTagName&&(a=this.options.transformTagName(a)),n&&r&&"!xml"!==n.tagname&&(r=this.saveTextToParentTag(r,n,s,!1));const p=n;if(p&&-1!==this.options.unpairedTags.indexOf(p.tagname)&&(n=this.tagsNodeStack.pop(),s=s.substring(0,s.lastIndexOf("."))),a!==t.tagname&&(s+=s?"."+a:a),this.isItStopNode(this.options.stopNodes,s,a)){let t="";if(l.length>0&&l.lastIndexOf("/")===l.length-1)"/"===a[a.length-1]?(a=a.substr(0,a.length-1),s=s.substr(0,s.length-1),l=a):l=l.substr(0,l.length-1),o=i.closeIndex;else if(-1!==this.options.unpairedTags.indexOf(a))o=i.closeIndex;else{const n=this.readStopNodeData(e,c,d+1);if(!n)throw new Error(`Unexpected end of ${c}`);o=n.i,t=n.tagContent}const r=new xo(a);a!==l&&u&&(r[":@"]=this.buildAttributesMap(l,s,a)),t&&(t=this.parseTextData(t,a,s,!0,u,!0,!0)),s=s.substr(0,s.lastIndexOf(".")),r.add(this.options.textNodeName,t),this.addChild(n,r,s)}else{if(l.length>0&&l.lastIndexOf("/")===l.length-1){"/"===a[a.length-1]?(a=a.substr(0,a.length-1),s=s.substr(0,s.length-1),l=a):l=l.substr(0,l.length-1),this.options.transformTagName&&(a=this.options.transformTagName(a));const e=new xo(a);a!==l&&u&&(e[":@"]=this.buildAttributesMap(l,s,a)),this.addChild(n,e,s),s=s.substr(0,s.lastIndexOf("."))}else{const e=new xo(a);this.tagsNodeStack.push(n),a!==l&&u&&(e[":@"]=this.buildAttributesMap(l,s,a)),this.addChild(n,e,s),n=e}r="",o=d}}else r+=e[o]}return t.child};function Oo(e,t,n){const r=this.options.updateTag(t.tagname,n,t[":@"]);!1===r||("string"==typeof r?(t.tagname=r,e.addChild(t)):e.addChild(t))}const $o=function(e){if(this.options.processEntities){for(let t in this.docTypeEntities){const n=this.docTypeEntities[t];e=e.replace(n.regx,n.val)}for(let t in this.lastEntities){const n=this.lastEntities[t];e=e.replace(n.regex,n.val)}if(this.options.htmlEntities)for(let t in this.htmlEntities){const n=this.htmlEntities[t];e=e.replace(n.regex,n.val)}e=e.replace(this.ampEntity.regex,this.ampEntity.val)}return e};function No(e,t,n,r){return e&&(void 0===r&&(r=0===Object.keys(t.child).length),void 0!==(e=this.parseTextData(e,t.tagname,n,!1,!!t[":@"]&&0!==Object.keys(t[":@"]).length,r))&&""!==e&&t.add(this.options.textNodeName,e),e=""),e}function Do(e,t,n){const r="*."+n;for(const n in e){const s=e[n];if(r===s||t===s)return!0}return!1}function jo(e,t,n,r){const s=e.indexOf(t,n);if(-1===s)throw new Error(r);return s+t.length-1}function Lo(e,t,n,r=">"){const s=function(e,t,n=">"){let r,s="";for(let o=t;o<e.length;o++){let t=e[o];if(r)t===r&&(r="");else if('"'===t||"'"===t)r=t;else if(t===n[0]){if(!n[1])return{data:s,index:o};if(e[o+1]===n[1])return{data:s,index:o}}else"\t"===t&&(t=" ");s+=t}}(e,t+1,r);if(!s)return;let o=s.data;const i=s.index,a=o.search(/\s/);let c=o,l=!0;-1!==a&&(c=o.substring(0,a),o=o.substring(a+1).trimStart());const u=c;if(n){const e=c.indexOf(":");-1!==e&&(c=c.substr(e+1),l=c!==s.data.substr(e+1))}return{tagName:c,tagExp:o,closeIndex:i,attrExpPresent:l,rawTagName:u}}function Mo(e,t,n){const r=n;let s=1;for(;n<e.length;n++)if("<"===e[n])if("/"===e[n+1]){const o=jo(e,">",n,`${t} is not closed`);if(e.substring(n+2,o).trim()===t&&(s--,0===s))return{tagContent:e.substring(r,n),i:o};n=o}else if("?"===e[n+1]){n=jo(e,"?>",n+1,"StopNode is not closed.")}else if("!--"===e.substr(n+1,3)){n=jo(e,"--\x3e",n+3,"StopNode is not closed.")}else if("!["===e.substr(n+1,2)){n=jo(e,"]]>",n,"StopNode is not closed.")-2}else{const r=Lo(e,n,">");if(r){(r&&r.tagName)===t&&"/"!==r.tagExp[r.tagExp.length-1]&&s++,n=r.closeIndex}}}function Uo(e,t,n){if(t&&"string"==typeof e){const t=e.trim();return"true"===t||"false"!==t&&Po(e,n)}return Eo.isExist(e)?e:""}var Fo=class{constructor(e){this.options=e,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:(e,t)=>String.fromCharCode(Number.parseInt(t,10))},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(e,t)=>String.fromCharCode(Number.parseInt(t,16))}},this.addExternalEntities=To,this.parseXml=Ro,this.parseTextData=Io,this.resolveNameSpace=Co,this.buildAttributesMap=_o,this.isItStopNode=Do,this.replaceEntitiesValue=$o,this.readStopNodeData=Mo,this.saveTextToParentTag=No,this.addChild=Oo}},zo={};function qo(e,t,n){let r;const s={};for(let o=0;o<e.length;o++){const i=e[o],a=Wo(i);let c="";if(c=void 0===n?a:n+"."+a,a===t.textNodeName)void 0===r?r=i[a]:r+=""+i[a];else{if(void 0===a)continue;if(i[a]){let e=qo(i[a],t,c);const n=Ho(e,t);i[":@"]?Bo(e,i[":@"],c,t):1!==Object.keys(e).length||void 0===e[t.textNodeName]||t.alwaysCreateTextNode?0===Object.keys(e).length&&(t.alwaysCreateTextNode?e[t.textNodeName]="":e=""):e=e[t.textNodeName],void 0!==s[a]&&s.hasOwnProperty(a)?(Array.isArray(s[a])||(s[a]=[s[a]]),s[a].push(e)):t.isArray(a,c,n)?s[a]=[e]:s[a]=e}}}return"string"==typeof r?r.length>0&&(s[t.textNodeName]=r):void 0!==r&&(s[t.textNodeName]=r),s}function Wo(e){const t=Object.keys(e);for(let e=0;e<t.length;e++){const n=t[e];if(":@"!==n)return n}}function Bo(e,t,n,r){if(t){const s=Object.keys(t),o=s.length;for(let i=0;i<o;i++){const o=s[i];r.isArray(o,n+"."+o,!0,!0)?e[o]=[t[o]]:e[o]=t[o]}}}function Ho(e,t){const{textNodeName:n}=t,r=Object.keys(e).length;return 0===r||!(1!==r||!e[n]&&"boolean"!=typeof e[n]&&0!==e[n])}zo.prettify=function(e,t){return qo(e,t)};const{buildOptions:Vo}=io,Ko=Fo,{prettify:Go}=zo,Xo=Ws;var Jo=class{constructor(e){this.externalEntities={},this.options=Vo(e)}parse(e,t){if("string"==typeof e);else{if(!e.toString)throw new Error("XML data is accepted in String or Bytes[] form.");e=e.toString()}if(t){!0===t&&(t={});const n=Xo.validate(e,t);if(!0!==n)throw Error(`${n.err.msg}:${n.err.line}:${n.err.col}`)}const n=new Ko(this.options);n.addExternalEntities(this.externalEntities);const r=n.parseXml(e);return this.options.preserveOrder||void 0===r?r:Go(r,this.options)}addEntity(e,t){if(-1!==t.indexOf("&"))throw new Error("Entity value can't have '&'");if(-1!==e.indexOf("&")||-1!==e.indexOf(";"))throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '
'");if("&"===t)throw new Error("An entity with value '&' is not permitted");this.externalEntities[e]=t}};function Yo(e,t,n,r){let s="",o=!1;for(let i=0;i<e.length;i++){const a=e[i],c=Zo(a);if(void 0===c)continue;let l="";if(l=0===n.length?c:`${n}.${c}`,c===t.textNodeName){let e=a[c];ei(l,t)||(e=t.tagValueProcessor(c,e),e=ti(e,t)),o&&(s+=r),s+=e,o=!1;continue}if(c===t.cdataPropName){o&&(s+=r),s+=`<![CDATA[${a[c][0][t.textNodeName]}]]>`,o=!1;continue}if(c===t.commentPropName){s+=r+`\x3c!--${a[c][0][t.textNodeName]}--\x3e`,o=!0;continue}if("?"===c[0]){const e=Qo(a[":@"],t),n="?xml"===c?"":r;let i=a[c][0][t.textNodeName];i=0!==i.length?" "+i:"",s+=n+`<${c}${i}${e}?>`,o=!0;continue}let u=r;""!==u&&(u+=t.indentBy);const d=r+`<${c}${Qo(a[":@"],t)}`,p=Yo(a[c],t,l,u);-1!==t.unpairedTags.indexOf(c)?t.suppressUnpairedNode?s+=d+">":s+=d+"/>":p&&0!==p.length||!t.suppressEmptyNode?p&&p.endsWith(">")?s+=d+`>${p}${r}</${c}>`:(s+=d+">",p&&""!==r&&(p.includes("/>")||p.includes("</"))?s+=r+t.indentBy+p+r:s+=p,s+=`</${c}>`):s+=d+"/>",o=!0}return s}function Zo(e){const t=Object.keys(e);for(let n=0;n<t.length;n++){const r=t[n];if(e.hasOwnProperty(r)&&":@"!==r)return r}}function Qo(e,t){let n="";if(e&&!t.ignoreAttributes)for(let r in e){if(!e.hasOwnProperty(r))continue;let s=t.attributeValueProcessor(r,e[r]);s=ti(s,t),!0===s&&t.suppressBooleanAttributes?n+=` ${r.substr(t.attributeNamePrefix.length)}`:n+=` ${r.substr(t.attributeNamePrefix.length)}="${s}"`}return n}function ei(e,t){let n=(e=e.substr(0,e.length-t.textNodeName.length-1)).substr(e.lastIndexOf(".")+1);for(let r in t.stopNodes)if(t.stopNodes[r]===e||t.stopNodes[r]==="*."+n)return!0;return!1}function ti(e,t){if(e&&e.length>0&&t.processEntities)for(let n=0;n<t.entities.length;n++){const r=t.entities[n];e=e.replace(r.regex,r.val)}return e}const ni=function(e,t){let n="";return t.format&&t.indentBy.length>0&&(n="\n"),Yo(e,t,"",n)},ri={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(e,t){return t},attributeValueProcessor:function(e,t){return t},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&"},{regex:new RegExp(">","g"),val:">"},{regex:new RegExp("<","g"),val:"<"},{regex:new RegExp("'","g"),val:"'"},{regex:new RegExp('"',"g"),val:"""}],processEntities:!0,stopNodes:[],oneListGroup:!1};function si(e){this.options=Object.assign({},ri,e),this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=ai),this.processTextOrObjNode=oi,this.options.format?(this.indentate=ii,this.tagEndChar=">\n",this.newLine="\n"):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}function oi(e,t,n){const r=this.j2x(e,n+1);return void 0!==e[this.options.textNodeName]&&1===Object.keys(e).length?this.buildTextValNode(e[this.options.textNodeName],t,r.attrStr,n):this.buildObjectNode(r.val,t,r.attrStr,n)}function ii(e){return this.options.indentBy.repeat(e)}function ai(e){return!(!e.startsWith(this.options.attributeNamePrefix)||e===this.options.textNodeName)&&e.substr(this.attrPrefixLen)}si.prototype.build=function(e){return this.options.preserveOrder?ni(e,this.options):(Array.isArray(e)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(e={[this.options.arrayNodeName]:e}),this.j2x(e,0).val)},si.prototype.j2x=function(e,t){let n="",r="";for(let s in e)if(Object.prototype.hasOwnProperty.call(e,s))if(void 0===e[s])this.isAttribute(s)&&(r+="");else if(null===e[s])this.isAttribute(s)?r+="":"?"===s[0]?r+=this.indentate(t)+"<"+s+"?"+this.tagEndChar:r+=this.indentate(t)+"<"+s+"/"+this.tagEndChar;else if(e[s]instanceof Date)r+=this.buildTextValNode(e[s],s,"",t);else if("object"!=typeof e[s]){const o=this.isAttribute(s);if(o)n+=this.buildAttrPairStr(o,""+e[s]);else if(s===this.options.textNodeName){let t=this.options.tagValueProcessor(s,""+e[s]);r+=this.replaceEntitiesValue(t)}else r+=this.buildTextValNode(e[s],s,"",t)}else if(Array.isArray(e[s])){const n=e[s].length;let o="",i="";for(let a=0;a<n;a++){const n=e[s][a];if(void 0===n);else if(null===n)"?"===s[0]?r+=this.indentate(t)+"<"+s+"?"+this.tagEndChar:r+=this.indentate(t)+"<"+s+"/"+this.tagEndChar;else if("object"==typeof n)if(this.options.oneListGroup){const e=this.j2x(n,t+1);o+=e.val,this.options.attributesGroupName&&n.hasOwnProperty(this.options.attributesGroupName)&&(i+=e.attrStr)}else o+=this.processTextOrObjNode(n,s,t);else if(this.options.oneListGroup){let e=this.options.tagValueProcessor(s,n);e=this.replaceEntitiesValue(e),o+=e}else o+=this.buildTextValNode(n,s,"",t)}this.options.oneListGroup&&(o=this.buildObjectNode(o,s,i,t)),r+=o}else if(this.options.attributesGroupName&&s===this.options.attributesGroupName){const t=Object.keys(e[s]),r=t.length;for(let o=0;o<r;o++)n+=this.buildAttrPairStr(t[o],""+e[s][t[o]])}else r+=this.processTextOrObjNode(e[s],s,t);return{attrStr:n,val:r}},si.prototype.buildAttrPairStr=function(e,t){return t=this.options.attributeValueProcessor(e,""+t),t=this.replaceEntitiesValue(t),this.options.suppressBooleanAttributes&&"true"===t?" "+e:" "+e+'="'+t+'"'},si.prototype.buildObjectNode=function(e,t,n,r){if(""===e)return"?"===t[0]?this.indentate(r)+"<"+t+n+"?"+this.tagEndChar:this.indentate(r)+"<"+t+n+this.closeTag(t)+this.tagEndChar;{let s="</"+t+this.tagEndChar,o="";return"?"===t[0]&&(o="?",s=""),!n&&""!==n||-1!==e.indexOf("<")?!1!==this.options.commentPropName&&t===this.options.commentPropName&&0===o.length?this.indentate(r)+`\x3c!--${e}--\x3e`+this.newLine:this.indentate(r)+"<"+t+n+o+this.tagEndChar+e+this.indentate(r)+s:this.indentate(r)+"<"+t+n+o+">"+e+s}},si.prototype.closeTag=function(e){let t="";return-1!==this.options.unpairedTags.indexOf(e)?this.options.suppressUnpairedNode||(t="/"):t=this.options.suppressEmptyNode?"/":`></${e}`,t},si.prototype.buildTextValNode=function(e,t,n,r){if(!1!==this.options.cdataPropName&&t===this.options.cdataPropName)return this.indentate(r)+`<![CDATA[${e}]]>`+this.newLine;if(!1!==this.options.commentPropName&&t===this.options.commentPropName)return this.indentate(r)+`\x3c!--${e}--\x3e`+this.newLine;if("?"===t[0])return this.indentate(r)+"<"+t+n+"?"+this.tagEndChar;{let s=this.options.tagValueProcessor(t,e);return s=this.replaceEntitiesValue(s),""===s?this.indentate(r)+"<"+t+n+this.closeTag(t)+this.tagEndChar:this.indentate(r)+"<"+t+n+">"+s+"</"+t+this.tagEndChar}},si.prototype.replaceEntitiesValue=function(e){if(e&&e.length>0&&this.options.processEntities)for(let t=0;t<this.options.entities.length;t++){const n=this.options.entities[t];e=e.replace(n.regex,n.val)}return e};var ci={XMLParser:Jo,XMLValidator:Ws,XMLBuilder:si};const li=(e,t)=>Ls(e,t).then((e=>{if(e.length){const t=new ci.XMLParser({attributeNamePrefix:"",htmlEntities:!0,ignoreAttributes:!1,ignoreDeclaration:!0,parseTagValue:!1,trimValues:!1,tagValueProcessor:(e,t)=>""===t.trim()&&t.includes("\n")?"":void 0});let n;t.addEntity("#xD","\r"),t.addEntity("#10","\n");try{n=t.parse(e,!0)}catch(t){throw t&&"object"==typeof t&&Object.defineProperty(t,"$responseBodyText",{value:e}),t}const r="#text",s=Object.keys(n)[0],o=n[s];return o[r]&&(o[s]=o[r],delete o[r]),xr(o)}return{}})),ui=async(e,t)=>{const n=await li(e,t);return n.Error&&(n.Error.message=n.Error.message??n.Error.Message),n},di=async(e,t,n)=>({operation:we(t).operation,region:await be(e.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});const pi=e=>{const t=[];return e.operation,t.push(function(e){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"translate",region:e.region},propertiesExtractor:(e,t)=>({signingProperties:{config:e,context:t}})}}(e)),t},hi={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}};var fi="3.645.0";const gi="AWS_ACCESS_KEY_ID",mi="AWS_SECRET_ACCESS_KEY",yi="AWS_SESSION_TOKEN",wi="AWS_CREDENTIAL_EXPIRATION",bi="AWS_CREDENTIAL_SCOPE",vi="AWS_ACCOUNT_ID",Si=e=>async()=>{e?.logger?.debug("@aws-sdk/credential-provider-env - fromEnv");const t=process.env[gi],n=process.env[mi],r=process.env[yi],s=process.env[wi],o=process.env[bi],i=process.env[vi];if(t&&n)return{accessKeyId:t,secretAccessKey:n,...r&&{sessionToken:r},...s&&{expiration:new Date(s)},...o&&{credentialScope:o},...i&&{accountId:i}};throw new $e("Unable to find environment variable credentials.",{logger:e?.logger})};var Ei=Object.freeze({__proto__:null,ENV_ACCOUNT_ID:vi,ENV_CREDENTIAL_SCOPE:bi,ENV_EXPIRATION:wi,ENV_KEY:gi,ENV_SECRET:mi,ENV_SESSION:yi,fromEnv:Si});let xi=!1;const Ai=(e={})=>je(De((async()=>{if(e.profile??process.env[Fe]){if(process.env[gi]&&process.env[mi]&&!xi){(e.logger?.warn&&"NoOpLogger"!==e.logger?.constructor?.name?e.logger.warn:console.warn)("@aws-sdk/credential-provider-node - defaultProvider::fromEnv WARNING:\n Multiple credential sources detected: \n Both AWS_PROFILE and the pair AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY static credentials are set.\n This SDK will proceed with the AWS_PROFILE value.\n \n However, a future version may change this behavior to prefer the ENV static credentials.\n Please ensure that your environment only sets either the AWS_PROFILE or the\n AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY pair.\n"),xi=!0}throw new $e("AWS_PROFILE is set, skipping fromEnv provider.",{logger:e.logger,tryNextLink:!0})}return e.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromEnv"),Si(e)()}),(async()=>{e.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromSSO");const{ssoStartUrl:t,ssoAccountId:n,ssoRegion:r,ssoRoleName:s,ssoSession:o}=e;if(!(t||n||r||s||o))throw new $e("Skipping SSO provider in default chain (inputs do not include SSO fields).",{logger:e.logger});const{fromSSO:i}=await Promise.resolve().then((function(){return el}));return i(e)()}),(async()=>{e.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromIni");const{fromIni:t}=await Promise.resolve().then((function(){return al}));return t(e)()}),(async()=>{e.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromProcess");const{fromProcess:t}=await Promise.resolve().then((function(){return ll}));return t(e)()}),(async()=>{e.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromTokenFile");const{fromTokenFile:t}=await Promise.resolve().then((function(){return dl}));return t(e)()}),(async()=>(e.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::remoteProvider"),(await(async e=>{const{ENV_CMDS_FULL_URI:t,ENV_CMDS_RELATIVE_URI:n,fromContainerMetadata:r,fromInstanceMetadata:s}=await Promise.resolve().then((function(){return Fc}));if(process.env[n]||process.env[t]){e.logger?.debug("@aws-sdk/credential-provider-node - remoteProvider::fromHttp/fromContainerMetadata");const{fromHttp:t}=await Promise.resolve().then((function(){return zc}));return De(t(e),r(e))}return process.env.AWS_EC2_METADATA_DISABLED?async()=>{throw new $e("EC2 Instance Metadata Service access disabled",{logger:e.logger})}:(e.logger?.debug("@aws-sdk/credential-provider-node - remoteProvider::fromInstanceMetadata"),s(e))})(e))())),(async()=>{throw new $e("Could not load credentials from any providers",{tryNextLink:!1,logger:e.logger})})),Ti,Pi),Pi=e=>void 0!==e?.expiration,Ti=e=>void 0!==e?.expiration&&e.expiration.getTime()-Date.now()<3e5,Ii=({serviceId:e,clientVersion:t})=>{const n=[["aws-sdk-js",t],["ua","2.0"],[`os/${o.platform()}`,o.release()],["lang/js"],["md/nodejs",`${p.versions.node}`]];e&&n.push([`api/${e}`,t]),p.env.AWS_EXECUTION_ENV&&n.push([`exec-env/${p.env.AWS_EXECUTION_ENV}`]);const r=ct({environmentVariableSelector:e=>e.AWS_SDK_UA_APP_ID,configFileSelector:e=>e["sdk-ua-app-id"],default:void 0})();let s;return async()=>{if(!s){const e=await r;s=e?[...n,[`app/${e}`]]:[...n]}return s}};class Ci{constructor(e,t){this.algorithmIdentifier=e,this.secret=t,this.reset()}update(e,t){this.hash.update(ln(ki(e,t)))}digest(){return Promise.resolve(this.hash.digest())}reset(){this.hash=this.secret?a.createHmac(this.algorithmIdentifier,ki(this.secret)):a.createHash(this.algorithmIdentifier)}}function ki(t,n){return e.Buffer.isBuffer(t)?t:"string"==typeof t?sn(t,n):ArrayBuffer.isView(t)?rn(t.buffer,t.byteOffset,t.byteLength):rn(t)}const _i=e=>{if(!e)return 0;if("string"==typeof e)return Buffer.byteLength(e);if("number"==typeof e.byteLength)return e.byteLength;if("number"==typeof e.size)return e.size;if("number"==typeof e.start&&"number"==typeof e.end)return e.end+1-e.start;if("string"==typeof e.path||Buffer.isBuffer(e.path))return c.lstatSync(e.path).size;if("number"==typeof e.fd)return c.fstatSync(e.fd).size;throw new Error(`Body Length computation failed for ${e}`)},Ri="required",Oi="fn",$i="argv",Ni="ref",Di=!0,ji="isSet",Li="booleanEquals",Mi="error",Ui="endpoint",Fi="tree",zi="PartitionResult",qi={[Ri]:!1,type:"String"},Wi={[Ri]:!0,default:!1,type:"Boolean"},Bi={[Ni]:"Endpoint"},Hi={[Oi]:Li,[$i]:[{[Ni]:"UseFIPS"},!0]},Vi={[Oi]:Li,[$i]:[{[Ni]:"UseDualStack"},!0]},Ki={},Gi={[Oi]:"getAttr",[$i]:[{[Ni]:zi},"supportsFIPS"]},Xi={[Oi]:Li,[$i]:[!0,{[Oi]:"getAttr",[$i]:[{[Ni]:zi},"supportsDualStack"]}]},Ji=[Hi],Yi=[Vi],Zi=[{[Ni]:"Region"}],Qi={version:"1.0",parameters:{Region:qi,UseDualStack:Wi,UseFIPS:Wi,Endpoint:qi},rules:[{conditions:[{[Oi]:ji,[$i]:[Bi]}],rules:[{conditions:Ji,error:"Invalid Configuration: FIPS and custom endpoint are not supported",type:Mi},{conditions:Yi,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",type:Mi},{endpoint:{url:Bi,properties:Ki,headers:Ki},type:Ui}],type:Fi},{conditions:[{[Oi]:ji,[$i]:Zi}],rules:[{conditions:[{[Oi]:"aws.partition",[$i]:Zi,assign:zi}],rules:[{conditions:[Hi,Vi],rules:[{conditions:[{[Oi]:Li,[$i]:[Di,Gi]},Xi],rules:[{endpoint:{url:"https://translate-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:Ki,headers:Ki},type:Ui}],type:Fi},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",type:Mi}],type:Fi},{conditions:Ji,rules:[{conditions:[{[Oi]:Li,[$i]:[Gi,Di]}],rules:[{endpoint:{url:"https://translate-fips.{Region}.{PartitionResult#dnsSuffix}",properties:Ki,headers:Ki},type:Ui}],type:Fi},{error:"FIPS is enabled but this partition does not support FIPS",type:Mi}],type:Fi},{conditions:Yi,rules:[{conditions:[Xi],rules:[{endpoint:{url:"https://translate.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:Ki,headers:Ki},type:Ui}],type:Fi},{error:"DualStack is enabled but this partition does not support DualStack",type:Mi}],type:Fi},{endpoint:{url:"https://translate.{Region}.{PartitionResult#dnsSuffix}",properties:Ki,headers:Ki},type:Ui}],type:Fi}],type:Fi},{error:"Invalid Configuration: Missing Region",type:Mi}]},ea=(e,t={})=>re(Qi,{endpointParams:e,logger:t.logger});L.aws=ie;const ta="AWS_REGION",na="AWS_DEFAULT_REGION",ra=["in-region","cross-region","mobile","standard","legacy"],sa={environmentVariableSelector:e=>e.AWS_DEFAULTS_MODE,configFileSelector:e=>e.defaults_mode,default:"legacy"},oa=({region:e=ct(ve),defaultsMode:t=ct(sa)}={})=>je((async()=>{const n="function"==typeof t?await t():t;switch(n?.toLowerCase()){case"auto":return ia(e);case"in-region":case"cross-region":case"mobile":case"standard":case"legacy":return Promise.resolve(n?.toLocaleLowerCase());case void 0:return Promise.resolve("legacy");default:throw new Error(`Invalid parameter for "defaultsMode", expect ${ra.join(", ")}, got ${n}`)}})),ia=async e=>{if(e){const t="function"==typeof e?await e():e,n=await aa();return n?t===n?"in-region":"cross-region":"standard"}return"standard"},aa=async()=>{if(process.env.AWS_EXECUTION_ENV&&(process.env[ta]||process.env[na]))return process.env[ta]??process.env[na];if(!process.env.AWS_EC2_METADATA_DISABLED)try{const{getInstanceMetadataEndpoint:e,httpRequest:t}=await Promise.resolve().then((function(){return Fc})),n=await e();return(await t({...n,path:"/latest/meta-data/placement/region"})).toString()}catch(e){}},ca=e=>{gr(process.version);const t=oa(e),n=()=>t().then(hr),r=(e=>({apiVersion:"2017-07-01",base64Decoder:e?.base64Decoder??an,base64Encoder:e?.base64Encoder??dn,disableHostPrefix:e?.disableHostPrefix??!1,endpointProvider:e?.endpointProvider??ea,extensions:e?.extensions??[],httpAuthSchemeProvider:e?.httpAuthSchemeProvider??pi,httpAuthSchemes:e?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4"),signer:new ss}],logger:e?.logger??new Xt,serviceId:e?.serviceId??"Translate",urlParser:e?.urlParser??pt,utf8Decoder:e?.utf8Decoder??cn,utf8Encoder:e?.utf8Encoder??un}))(e);return Qr(process.version),{...r,...e,runtime:"node",defaultsMode:t,bodyLengthChecker:e?.bodyLengthChecker??_i,credentialDefaultProvider:e?.credentialDefaultProvider??Ai,defaultUserAgentProvider:e?.defaultUserAgentProvider??Ii({serviceId:r.serviceId,clientVersion:fi}),maxAttempts:e?.maxAttempts??ct(Vt),region:e?.region??ct(ve,Se),requestHandler:wn.create(e?.requestHandler??n),retryMode:e?.retryMode??ct({...Gt,default:async()=>(await n()).retryMode||It}),sha256:e?.sha256??Ci.bind(null,"sha256"),streamCollector:e?.streamCollector??vn,useDualstackEndpoint:e?.useDualstackEndpoint??ct(me),useFipsEndpoint:e?.useFipsEndpoint??ct(ye)}},la=e=>{let t=async()=>{if(void 0===e.region)throw new Error("Region is missing from runtimeConfig");const t=e.region;return"string"==typeof t?t:t()};return{setRegion(e){t=e},region:()=>t}},ua=e=>({region:e.region()}),da=e=>{const t=e.httpAuthSchemes;let n=e.httpAuthSchemeProvider,r=e.credentials;return{setHttpAuthScheme(e){const n=t.findIndex((t=>t.schemeId===e.schemeId));-1===n?t.push(e):t.splice(n,1,e)},httpAuthSchemes:()=>t,setHttpAuthSchemeProvider(e){n=e},httpAuthSchemeProvider:()=>n,setCredentials(e){r=e},credentials:()=>r}};class pa extends tn{constructor(...[e]){const t=ca(e||{});var n;const r=O((n=t,{...n,useDualstackEndpoint:n.useDualstackEndpoint??!1,useFipsEndpoint:n.useFipsEndpoint??!1,defaultSigningName:"translate"})),s=Kt(r),o=Ae(s),i=St(o);const a=((e,t)=>{const n={...la(e),...vr(e),...h(e),...da(e)};return t.forEach((e=>e.configure(n))),{...e,...ua(n),...Sr(n),...f(n),...(r=n,{httpAuthSchemes:r.httpAuthSchemes(),httpAuthSchemeProvider:r.httpAuthSchemeProvider(),credentials:r.credentials()})};var r})({...js(i)},e?.extensions||[]);super(a),this.config=a,this.middlewareStack.use(he(this.config)),this.middlewareStack.use(Lr(this.config)),this.middlewareStack.use(Yr(this.config)),this.middlewareStack.use(T(this.config)),this.middlewareStack.use(C(this.config)),this.middlewareStack.use(R(this.config)),this.middlewareStack.use(xt(this.config,{httpAuthSchemeParametersProvider:di,identityProviderConfigProvider:async e=>new zr({"aws.auth#sigv4":e.credentials})})),this.middlewareStack.use(Fr(this.config))}destroy(){super.destroy()}}class ha extends lr{constructor(e){super(e),Object.setPrototypeOf(this,ha.prototype)}}class fa extends ha{constructor(e){super({name:"ConcurrentModificationException",$fault:"client",...e}),this.name="ConcurrentModificationException",this.$fault="client",Object.setPrototypeOf(this,fa.prototype),this.Message=e.Message}}class ga extends ha{constructor(e){super({name:"ConflictException",$fault:"client",...e}),this.name="ConflictException",this.$fault="client",Object.setPrototypeOf(this,ga.prototype),this.Message=e.Message}}let ma=class e extends ha{constructor(t){super({name:"InternalServerException",$fault:"server",...t}),this.name="InternalServerException",this.$fault="server",Object.setPrototypeOf(this,e.prototype),this.Message=t.Message}};class ya extends ha{constructor(e){super({name:"InvalidParameterValueException",$fault:"client",...e}),this.name="InvalidParameterValueException",this.$fault="client",Object.setPrototypeOf(this,ya.prototype),this.Message=e.Message}}let wa=class e extends ha{constructor(t){super({name:"InvalidRequestException",$fault:"client",...t}),this.name="InvalidRequestException",this.$fault="client",Object.setPrototypeOf(this,e.prototype),this.Message=t.Message}};class ba extends ha{constructor(e){super({name:"LimitExceededException",$fault:"client",...e}),this.name="LimitExceededException",this.$fault="client",Object.setPrototypeOf(this,ba.prototype),this.Message=e.Message}}let va=class e extends ha{constructor(t){super({name:"TooManyRequestsException",$fault:"client",...t}),this.name="TooManyRequestsException",this.$fault="client",Object.setPrototypeOf(this,e.prototype),this.Message=t.Message}};class Sa extends ha{constructor(e){super({name:"TooManyTagsException",$fault:"client",...e}),this.name="TooManyTagsException",this.$fault="client",Object.setPrototypeOf(this,Sa.prototype),this.ResourceArn=e.ResourceArn}}let Ea=class e extends ha{constructor(t){super({name:"ResourceNotFoundException",$fault:"client",...t}),this.name="ResourceNotFoundException",this.$fault="client",Object.setPrototypeOf(this,e.prototype),this.Message=t.Message}};class xa extends ha{constructor(e){super({name:"UnsupportedDisplayLanguageCodeException",$fault:"client",...e}),this.name="UnsupportedDisplayLanguageCodeException",this.$fault="client",Object.setPrototypeOf(this,xa.prototype),this.Message=e.Message,this.DisplayLanguageCode=e.DisplayLanguageCode}}class Aa extends ha{constructor(e){super({name:"InvalidFilterException",$fault:"client",...e}),this.name="InvalidFilterException",this.$fault="client",Object.setPrototypeOf(this,Aa.prototype),this.Message=e.Message}}class Pa extends ha{constructor(e){super({name:"UnsupportedLanguagePairException",$fault:"client",...e}),this.name="UnsupportedLanguagePairException",this.$fault="client",Object.setPrototypeOf(this,Pa.prototype),this.Message=e.Message,this.SourceLanguageCode=e.SourceLanguageCode,this.TargetLanguageCode=e.TargetLanguageCode}}class Ta extends ha{constructor(e){super({name:"ServiceUnavailableException",$fault:"server",...e}),this.name="ServiceUnavailableException",this.$fault="server",Object.setPrototypeOf(this,Ta.prototype),this.Message=e.Message}}class Ia extends ha{constructor(e){super({name:"DetectedLanguageLowConfidenceException",$fault:"client",...e}),this.name="DetectedLanguageLowConfidenceException",this.$fault="client",Object.setPrototypeOf(this,Ia.prototype),this.Message=e.Message,this.DetectedLanguageCode=e.DetectedLanguageCode}}class Ca extends ha{constructor(e){super({name:"TextSizeLimitExceededException",$fault:"client",...e}),this.name="TextSizeLimitExceededException",this.$fault="client",Object.setPrototypeOf(this,Ca.prototype),this.Message=e.Message}}const ka=async(e,t)=>{const n={"content-type":"application/x-amz-json-1.1","x-amz-target":`AWSShineFrontendService_20170701.${"TranslateText"}`};let r;return r=JSON.stringify(Rr(e)),Xa(t,n,"/",void 0,r)},_a=async(e,t)=>{if(e.statusCode>=300)return Ra(e,t);const n=await Ms(e.body,t);let r={};r=Rr(n);return{$metadata:Ka(e),...r}},Ra=async(e,t)=>{const n={...e,body:await Us(e.body,t)},r=Fs(e,n.body);switch(r){case"ConcurrentModificationException":case"com.amazonaws.translate#ConcurrentModificationException":throw await Oa(n);case"ConflictException":case"com.amazonaws.translate#ConflictException":throw await $a(n);case"InternalServerException":case"com.amazonaws.translate#InternalServerException":throw await Da(n);case"InvalidParameterValueException":case"com.amazonaws.translate#InvalidParameterValueException":throw await La(n);case"InvalidRequestException":case"com.amazonaws.translate#InvalidRequestException":throw await Ma(n);case"LimitExceededException":case"com.amazonaws.translate#LimitExceededException":throw await Ua(n);case"TooManyRequestsException":case"com.amazonaws.translate#TooManyRequestsException":throw await Wa(n);case"TooManyTagsException":case"com.amazonaws.translate#TooManyTagsException":throw await Ba(n);case"ResourceNotFoundException":case"com.amazonaws.translate#ResourceNotFoundException":throw await Fa(n);case"UnsupportedDisplayLanguageCodeException":case"com.amazonaws.translate#UnsupportedDisplayLanguageCodeException":throw await Ha(n);case"InvalidFilterException":case"com.amazonaws.translate#InvalidFilterException":throw await ja(n);case"UnsupportedLanguagePairException":case"com.amazonaws.translate#UnsupportedLanguagePairException":throw await Va(n);case"ServiceUnavailableException":case"com.amazonaws.translate#ServiceUnavailableException":throw await za(n);case"DetectedLanguageLowConfidenceException":case"com.amazonaws.translate#DetectedLanguageLowConfidenceException":throw await Na(n);case"TextSizeLimitExceededException":case"com.amazonaws.translate#TextSizeLimitExceededException":throw await qa(n);default:const t=n.body;return Ga({output:e,parsedBody:t,errorCode:r})}},Oa=async(e,t)=>{const n=e.body,r=Rr(n),s=new fa({$metadata:Ka(e),...r});return ur(s,n)},$a=async(e,t)=>{const n=e.body,r=Rr(n),s=new ga({$metadata:Ka(e),...r});return ur(s,n)},Na=async(e,t)=>{const n=e.body,r=Rr(n),s=new Ia({$metadata:Ka(e),...r});return ur(s,n)},Da=async(e,t)=>{const n=e.body,r=Rr(n),s=new ma({$metadata:Ka(e),...r});return ur(s,n)},ja=async(e,t)=>{const n=e.body,r=Rr(n),s=new Aa({$metadata:Ka(e),...r});return ur(s,n)},La=async(e,t)=>{const n=e.body,r=Rr(n),s=new ya({$metadata:Ka(e),...r});return ur(s,n)},Ma=async(e,t)=>{const n=e.body,r=Rr(n),s=new wa({$metadata:Ka(e),...r});return ur(s,n)},Ua=async(e,t)=>{const n=e.body,r=Rr(n),s=new ba({$metadata:Ka(e),...r});return ur(s,n)},Fa=async(e,t)=>{const n=e.body,r=Rr(n),s=new Ea({$metadata:Ka(e),...r});return ur(s,n)},za=async(e,t)=>{const n=e.body,r=Rr(n),s=new Ta({$metadata:Ka(e),...r});return ur(s,n)},qa=async(e,t)=>{const n=e.body,r=Rr(n),s=new Ca({$metadata:Ka(e),...r});return ur(s,n)},Wa=async(e,t)=>{const n=e.body,r=Rr(n),s=new va({$metadata:Ka(e),...r});return ur(s,n)},Ba=async(e,t)=>{const n=e.body,r=Rr(n),s=new Sa({$metadata:Ka(e),...r});return ur(s,n)},Ha=async(e,t)=>{const n=e.body,r=Rr(n),s=new xa({$metadata:Ka(e),...r});return ur(s,n)},Va=async(e,t)=>{const n=e.body,r=Rr(n),s=new Pa({$metadata:Ka(e),...r});return ur(s,n)},Ka=e=>({httpStatusCode:e.statusCode,requestId:e.headers["x-amzn-requestid"]??e.headers["x-amzn-request-id"]??e.headers["x-amz-request-id"],extendedRequestId:e.headers["x-amz-id-2"],cfId:e.headers["x-amz-cf-id"]}),Ga=dr(ha),Xa=async(e,t,n,r,s)=>{const{hostname:o,protocol:i="https",port:a,path:c}=await e.endpoint(),l={protocol:i,hostname:o,port:a,method:"POST",path:c.endsWith("/")?c.slice(0,-1)+n:c+n,headers:t};return void 0!==s&&(l.body=s),new x(l)};class Ja extends(On.classBuilder().ep({...hi}).m((function(e,t,n,r){return[wt(n,this.serialize,this.deserialize),vt(n,e.getEndpointParameterInstructions())]})).s("AWSShineFrontendService_20170701","TranslateText",{}).n("TranslateClient","TranslateTextCommand").f(void 0,void 0).ser(ka).de(_a).build()){}var Ya={exports:{}};var Za,Qa,ec={exports:{}};function tc(){return Za||(Za=1,ec.exports=(e=e||function(e,t){var n;if("undefined"!=typeof window&&window.crypto&&(n=window.crypto),"undefined"!=typeof self&&self.crypto&&(n=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(n=globalThis.crypto),!n&&"undefined"!=typeof window&&window.msCrypto&&(n=window.msCrypto),!n&&void 0!==zs&&zs.crypto&&(n=zs.crypto),!n)try{n=require("crypto")}catch(e){}var r=function(){if(n){if("function"==typeof n.getRandomValues)try{return n.getRandomValues(new Uint32Array(1))[0]}catch(e){}if("function"==typeof n.randomBytes)try{return n.randomBytes(4).readInt32LE()}catch(e){}}throw new Error("Native crypto module could not be used to get secure random number.")},s=Object.create||function(){function e(){}return function(t){var n;return e.prototype=t,n=new e,e.prototype=null,n}}(),o={},i=o.lib={},a=i.Base={extend:function(e){var t=s(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},c=i.WordArray=a.extend({init:function(e,n){e=this.words=e||[],this.sigBytes=n!=t?n:4*e.length},toString:function(e){return(e||u).stringify(this)},concat:function(e){var t=this.words,n=e.words,r=this.sigBytes,s=e.sigBytes;if(this.clamp(),r%4)for(var o=0;o<s;o++){var i=n[o>>>2]>>>24-o%4*8&255;t[r+o>>>2]|=i<<24-(r+o)%4*8}else for(var a=0;a<s;a+=4)t[r+a>>>2]=n[a>>>2];return this.sigBytes+=s,this},clamp:function(){var t=this.words,n=this.sigBytes;t[n>>>2]&=4294967295<<32-n%4*8,t.length=e.ceil(n/4)},clone:function(){var e=a.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],n=0;n<e;n+=4)t.push(r());return new c.init(t,e)}}),l=o.enc={},u=l.Hex={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],s=0;s<n;s++){var o=t[s>>>2]>>>24-s%4*8&255;r.push((o>>>4).toString(16)),r.push((15&o).toString(16))}return r.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r<t;r+=2)n[r>>>3]|=parseInt(e.substr(r,2),16)<<24-r%8*4;return new c.init(n,t/2)}},d=l.Latin1={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],s=0;s<n;s++){var o=t[s>>>2]>>>24-s%4*8&255;r.push(String.fromCharCode(o))}return r.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r<t;r++)n[r>>>2]|=(255&e.charCodeAt(r))<<24-r%4*8;return new c.init(n,t)}},p=l.Utf8={stringify:function(e){try{return decodeURIComponent(escape(d.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return d.parse(unescape(encodeURIComponent(e)))}},h=i.BufferedBlockAlgorithm=a.extend({reset:function(){this._data=new c.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=p.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var n,r=this._data,s=r.words,o=r.sigBytes,i=this.blockSize,a=o/(4*i),l=(a=t?e.ceil(a):e.max((0|a)-this._minBufferSize,0))*i,u=e.min(4*l,o);if(l){for(var d=0;d<l;d+=i)this._doProcessBlock(s,d);n=s.splice(0,l),r.sigBytes-=u}return new c.init(n,u)},clone:function(){var e=a.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0});i.Hasher=h.extend({cfg:a.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){h.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,n){return new e.init(n).finalize(t)}},_createHmacHelper:function(e){return function(t,n){return new f.HMAC.init(e,n).finalize(t)}}});var f=o.algo={};return o}(Math),e)),ec.exports;var e}Ya.exports=(Qa=tc(),function(e){var t=Qa,n=t.lib,r=n.WordArray,s=n.Hasher,o=t.algo,i=[];!function(){for(var t=0;t<64;t++)i[t]=4294967296*e.abs(e.sin(t+1))|0}();var a=o.MD5=s.extend({_doReset:function(){this._hash=new r.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(e,t){for(var n=0;n<16;n++){var r=t+n,s=e[r];e[r]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8)}var o=this._hash.words,a=e[t+0],p=e[t+1],h=e[t+2],f=e[t+3],g=e[t+4],m=e[t+5],y=e[t+6],w=e[t+7],b=e[t+8],v=e[t+9],S=e[t+10],E=e[t+11],x=e[t+12],A=e[t+13],P=e[t+14],T=e[t+15],I=o[0],C=o[1],k=o[2],_=o[3];I=c(I,C,k,_,a,7,i[0]),_=c(_,I,C,k,p,12,i[1]),k=c(k,_,I,C,h,17,i[2]),C=c(C,k,_,I,f,22,i[3]),I=c(I,C,k,_,g,7,i[4]),_=c(_,I,C,k,m,12,i[5]),k=c(k,_,I,C,y,17,i[6]),C=c(C,k,_,I,w,22,i[7]),I=c(I,C,k,_,b,7,i[8]),_=c(_,I,C,k,v,12,i[9]),k=c(k,_,I,C,S,17,i[10]),C=c(C,k,_,I,E,22,i[11]),I=c(I,C,k,_,x,7,i[12]),_=c(_,I,C,k,A,12,i[13]),k=c(k,_,I,C,P,17,i[14]),I=l(I,C=c(C,k,_,I,T,22,i[15]),k,_,p,5,i[16]),_=l(_,I,C,k,y,9,i[17]),k=l(k,_,I,C,E,14,i[18]),C=l(C,k,_,I,a,20,i[19]),I=l(I,C,k,_,m,5,i[20]),_=l(_,I,C,k,S,9,i[21]),k=l(k,_,I,C,T,14,i[22]),C=l(C,k,_,I,g,20,i[23]),I=l(I,C,k,_,v,5,i[24]),_=l(_,I,C,k,P,9,i[25]),k=l(k,_,I,C,f,14,i[26]),C=l(C,k,_,I,b,20,i[27]),I=l(I,C,k,_,A,5,i[28]),_=l(_,I,C,k,h,9,i[29]),k=l(k,_,I,C,w,14,i[30]),I=u(I,C=l(C,k,_,I,x,20,i[31]),k,_,m,4,i[32]),_=u(_,I,C,k,b,11,i[33]),k=u(k,_,I,C,E,16,i[34]),C=u(C,k,_,I,P,23,i[35]),I=u(I,C,k,_,p,4,i[36]),_=u(_,I,C,k,g,11,i[37]),k=u(k,_,I,C,w,16,i[38]),C=u(C,k,_,I,S,23,i[39]),I=u(I,C,k,_,A,4,i[40]),_=u(_,I,C,k,a,11,i[41]),k=u(k,_,I,C,f,16,i[42]),C=u(C,k,_,I,y,23,i[43]),I=u(I,C,k,_,v,4,i[44]),_=u(_,I,C,k,x,11,i[45]),k=u(k,_,I,C,T,16,i[46]),I=d(I,C=u(C,k,_,I,h,23,i[47]),k,_,a,6,i[48]),_=d(_,I,C,k,w,10,i[49]),k=d(k,_,I,C,P,15,i[50]),C=d(C,k,_,I,m,21,i[51]),I=d(I,C,k,_,x,6,i[52]),_=d(_,I,C,k,f,10,i[53]),k=d(k,_,I,C,S,15,i[54]),C=d(C,k,_,I,p,21,i[55]),I=d(I,C,k,_,b,6,i[56]),_=d(_,I,C,k,T,10,i[57]),k=d(k,_,I,C,y,15,i[58]),C=d(C,k,_,I,A,21,i[59]),I=d(I,C,k,_,g,6,i[60]),_=d(_,I,C,k,E,10,i[61]),k=d(k,_,I,C,h,15,i[62]),C=d(C,k,_,I,v,21,i[63]),o[0]=o[0]+I|0,o[1]=o[1]+C|0,o[2]=o[2]+k|0,o[3]=o[3]+_|0},_doFinalize:function(){var t=this._data,n=t.words,r=8*this._nDataBytes,s=8*t.sigBytes;n[s>>>5]|=128<<24-s%32;var o=e.floor(r/4294967296),i=r;n[15+(s+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),n[14+(s+64>>>9<<4)]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),t.sigBytes=4*(n.length+1),this._process();for(var a=this._hash,c=a.words,l=0;l<4;l++){var u=c[l];c[l]=16711935&(u<<8|u>>>24)|4278255360&(u<<24|u>>>8)}return a},clone:function(){var e=s.clone.call(this);return e._hash=this._hash.clone(),e}});function c(e,t,n,r,s,o,i){var a=e+(t&n|~t&r)+s+i;return(a<<o|a>>>32-o)+t}function l(e,t,n,r,s,o,i){var a=e+(t&r|n&~r)+s+i;return(a<<o|a>>>32-o)+t}function u(e,t,n,r,s,o,i){var a=e+(t^n^r)+s+i;return(a<<o|a>>>32-o)+t}function d(e,t,n,r,s,o,i){var a=e+(n^(t|~r))+s+i;return(a<<o|a>>>32-o)+t}t.MD5=s._createHelper(a),t.HmacMD5=s._createHmacHelper(a)}(Math),Qa.MD5);var nc=qs(Ya.exports);const rc={google:function(e){return{name:"google",async translate(e,t){const{from:n,to:r}=t;Array.isArray(e)||(e=[e]);const s=e.join("\n"),o=`https://translate.googleapis.com/translate_a/single?client=gtx&sl=${n}&tl=${r}&dt=t&q=${encodeURI(s)}`,i=await fetch(o),a=await i.json();if(!a||0===a.length)throw new Error("Translate fail ! translate's result is null or empty");const c=[];for(let e=0;a[0]&&e<a[0].length;e++){const t=a[0][e];t&&0!=t.length&&Array.isArray(t)&&t[0]&&c.push(t[0].replaceAll("\n",""))}return c}}},azure:function(e){const{key:t,region:n}=e;return{name:"azure",async translate(e,r){const{from:s,to:o}=r,i=`https://api.cognitive.microsofttranslator.com/translate?api-version=3.0&from=${s}&to=${o}`;Array.isArray(e)||(e=[e]);const a=await fetch(i,{method:"POST",headers:{"Content-Type":"application/json; charset=UTF-8","Ocp-Apim-Subscription-Key":t,"Ocp-Apim-Subscription-Region":n},body:JSON.stringify(e.map((e=>({Text:e}))))}),c=await a.json();if(!c||0===c.length)throw new Error("Translate fail ! translate's result is null or empty");const l=[];for(const e of c)e.translations&&0!=e.translations.length&&l.push(...e.translations.map((e=>e.text)));return l}}},amazon:function(e){const{region:t,accessKeyId:n,secretAccessKey:r}=e;return{name:"amazon",async translate(e,s){const{from:o,to:i}=s,a=new pa({region:t,credentials:{accessKeyId:n,secretAccessKey:r}});Array.isArray(e)||(e=[e]);const c=new Ja({SourceLanguageCode:o,TargetLanguageCode:i,Text:e.join("\n")}),l=await a.send(c),u=[];if(l.TranslatedText){const e=l.TranslatedText??"";u.push(...e.split("\n"))}return u}}},baidu:function(e){const{appId:t,secretKey:n}=e;return{name:"baidu",async translate(e,r){const{to:s,from:o,domain:i="it"}=r;Array.isArray(e)||(e=[e]);const a=e.join("\n"),c=Date.now(),l=nc(`${t}${a}${c}${i}${n}`).toString(),u=new URLSearchParams;u.append("q",a),u.append("from",o),u.append("to",s),u.append("appid",t),u.append("salt",c.toString()),u.append("domain",i),u.append("sign",l);const d=await fetch("https://fanyi-api.baidu.com/api/trans/vip/fieldtranslate",{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:u.toString()}),p=await d.json();if(!p||p.error_code||!p.trans_result||0===p.trans_result.length)throw new Error("Failed to translate text");const h=[];for(const e of p.trans_result)e.dst&&h.push(e.dst);return h}}}};const sc=Object.values({aar:"aa",abk:"ab",afr:"af",aka:"ak",alb:"sq",amh:"am",ara:"ar",arg:"an",arm:"hy",asm:"as",ava:"av",ave:"ae",aym:"ay",aze:"az",bak:"ba",bam:"bm",baq:"eu",bel:"be",ben:"bn",bih:"bh",bis:"bi",bos:"bs",bre:"br",bul:"bg",bur:"my",cat:"ca",cha:"ch",che:"ce",chi:"zh",chu:"cu",chv:"cv",cor:"kw",cos:"co",cre:"cr",cze:"cs",dan:"da",div:"dv",dut:"nl",dzo:"dz",eng:"en",epo:"eo",est:"et",ewe:"ee",fao:"fo",fij:"fj",fin:"fi",fre:"fr",fry:"fy",ful:"ff",geo:"ka",ger:"de",gla:"gd",gle:"ga",glg:"gl",glv:"gv",gre:"el",grn:"gn",guj:"gu",hat:"ht",hau:"ha",heb:"he",her:"hz",hin:"hi",hmo:"ho",hrv:"hr",hun:"hu",ibo:"ig",ice:"is",ido:"io",iii:"ii",iku:"iu",ile:"ie",ina:"ia",ind:"id",ipk:"ik",ita:"it",jav:"jv",jpn:"ja",kal:"kl",kan:"kn",kas:"ks",kau:"kr",kaz:"kk",khm:"km",kik:"ki",kin:"rw",kir:"ky",kom:"kv",kon:"kg",kor:"ko",kua:"kj",kur:"ku",lao:"lo",lat:"la",lav:"lv",lim:"li",lin:"ln",lit:"lt",ltz:"lb",lub:"lu",lug:"lg",mac:"mk",mah:"mh",mal:"ml",mao:"mi",mar:"mr",may:"ms",mlg:"mg",mlt:"mt",mon:"mn",nau:"na",nav:"nv",nbl:"nr",nde:"nd",ndo:"ng",nep:"ne",nno:"nn",nob:"nb",nor:"no",nya:"ny",oci:"oc",oji:"oj",ori:"or",orm:"om",oss:"os",pan:"pa",per:"fa",pli:"pi",pol:"pl",por:"pt",pus:"ps",que:"qu",roh:"rm",rum:"ro",run:"rn",rus:"ru",sag:"sg",san:"sa",sin:"si",slo:"sk",slv:"sl",sme:"se",smo:"sm",sna:"sn",snd:"sd",som:"so",sot:"st",spa:"es",srd:"sc",srp:"sr",ssw:"ss",sun:"su",swa:"sw",swe:"sv",tah:"ty",tam:"ta",tat:"tt",tel:"te",tgk:"tg",tgl:"tl",tha:"th",tib:"bo",tir:"ti",ton:"to",tsn:"tn",tso:"ts",tuk:"tk",tur:"tr",twi:"tw",uig:"ug",ukr:"uk",urd:"ur",uzb:"uz",ven:"ve",vie:"vi",vol:"vo",wel:"cy",wln:"wa",wol:"wo",xho:"xh",yid:"yi",yor:"yo",zha:"za",zul:"zu"}).sort();function oc(e){if(e.length>100)throw new Error(`The "language" is too long at ${e.length} characters`);if(!sc.includes(e))throw new Error(`The language "${e}" is not part of the ISO 639-1`);return e}class ic{cache;constructor(){this.cache=new Map}set(e,t,n){if(n<=0)throw new Error("time must be greater than 0");const r=this.cache.get(e);r&&clearTimeout(r.timeout);const s={value:t,expire:Date.now()+n};isNaN(s.expire)||(s.timeout=setTimeout((()=>this.del(e)),n)),this.cache.set(e,s)}get(e){return this.cache.get(e)}delete(e){let t=!0;const n=this.cache.get(e);return n?!isNaN(n.expire)&&n.expire<Date.now()?t=!1:clearTimeout(n.timeout):t=!1,t&&this.del(e),t}del(e){this.cache.delete(e)}clear(){for(const[,e]of this.cache.entries())clearTimeout(e.timeout);this.cache.clear()}}const ac=function(e=""){return{log(...e){this.info(...e)},info(...t){console.log(`[translate ${e}]`,...t)},error(...t){console.error(`[translate ${e}]`,...t)},warn(...t){console.warn(`[translate ${e}]`,...t)}}}(),cc=new ic;const lc=new class{engines;constructor(){this.engines=new Map}use(e){this.engines.has(e.name)?ac.warn("Engine already exists"):this.engines.set(e.name,e)}translate(e,t){const{from:n,to:r,engine:s="google",cache_time:o=6e4}=t;if(!this.engines.has(s))throw new Error(`Engine ${s} not found`);if(!oc(n))throw new Error(`Language ${n} not found`);if(!oc(r))throw new Error(`Language ${r} not found`);const i=`${n}:${r}:${s}:${e}`;if(cc.get(i))return cc.get(i)?.value;const a=this.engines.get(s);if(!a)throw new Error(`Engine ${s} not found`);return a.translate(e,t).then((e=>(cc.set(i,e,o),e)))}};var uc={engines:rc,translator:lc};function dc(t){return new Promise(((r,s)=>{const o=n.request({method:"GET",...t,hostname:t.hostname?.replace(/^\[(.+)\]$/,"$1")});o.on("error",(e=>{s(Object.assign(new Oe("Unable to connect to instance metadata service"),e)),o.destroy()})),o.on("timeout",(()=>{s(new Oe("TimeoutError from instance metadata service")),o.destroy()})),o.on("response",(t=>{const{statusCode:n=400}=t;(n<200||300<=n)&&(s(Object.assign(new Oe("Error response received from instance metadata service"),{statusCode:n})),o.destroy());const i=[];t.on("data",(e=>{i.push(e)})),t.on("end",(()=>{r(e.Buffer.concat(i)),o.destroy()}))})),o.end()}))}const pc=e=>Boolean(e)&&"object"==typeof e&&"string"==typeof e.AccessKeyId&&"string"==typeof e.SecretAccessKey&&"string"==typeof e.Token&&"string"==typeof e.Expiration,hc=e=>({accessKeyId:e.AccessKeyId,secretAccessKey:e.SecretAccessKey,sessionToken:e.Token,expiration:new Date(e.Expiration),...e.AccountId&&{accountId:e.AccountId}}),fc=({maxRetries:e=0,timeout:t=1e3})=>({maxRetries:e,timeout:t}),gc=(e,t)=>{let n=e();for(let r=0;r<t;r++)n=n.catch(e);return n},mc="AWS_CONTAINER_CREDENTIALS_FULL_URI",yc="AWS_CONTAINER_CREDENTIALS_RELATIVE_URI",wc="AWS_CONTAINER_AUTHORIZATION_TOKEN",bc=async(e,t)=>{process.env[wc]&&(t.headers={...t.headers,Authorization:process.env[wc]});return(await dc({...t,timeout:e})).toString()},vc={localhost:!0,"127.0.0.1":!0},Sc={"http:":!0,"https:":!0},Ec=async({logger:e})=>{if(process.env[yc])return{hostname:"169.254.170.2",path:process.env[yc]};if(process.env[mc]){const t=l.parse(process.env[mc]);if(!t.hostname||!(t.hostname in vc))throw new $e(`${t.hostname} is not a valid container metadata service hostname`,{tryNextLink:!1,logger:e});if(!t.protocol||!(t.protocol in Sc))throw new $e(`${t.protocol} is not a valid container metadata service protocol`,{tryNextLink:!1,logger:e});return{...t,port:t.port?parseInt(t.port,10):void 0}}throw new $e(`The container metadata credential provider cannot be used unless the ${yc} or ${mc} environment variable is set`,{tryNextLink:!1,logger:e})};class xc extends $e{constructor(e,t=!0){super(e,t),this.tryNextLink=t,this.name="InstanceMetadataV1FallbackError",Object.setPrototypeOf(this,xc.prototype)}}var Ac;!function(e){e.IPv4="http://169.254.169.254",e.IPv6="http://[fd00:ec2::254]"}(Ac||(Ac={}));const Pc={environmentVariableSelector:e=>e.AWS_EC2_METADATA_SERVICE_ENDPOINT,configFileSelector:e=>e.ec2_metadata_service_endpoint,default:void 0};var Tc;!function(e){e.IPv4="IPv4",e.IPv6="IPv6"}(Tc||(Tc={}));const Ic={environmentVariableSelector:e=>e.AWS_EC2_METADATA_SERVICE_ENDPOINT_MODE,configFileSelector:e=>e.ec2_metadata_service_endpoint_mode,default:Tc.IPv4},Cc=async()=>pt(await kc()||await _c()),kc=async()=>ct(Pc)(),_c=async()=>{const e=await ct(Ic)();switch(e){case Tc.IPv4:return Ac.IPv4;case Tc.IPv6:return Ac.IPv6;default:throw new Error(`Unsupported endpoint mode: ${e}. Select from ${Object.values(Tc)}`)}},Rc=(e,t)=>{const n=300+Math.floor(300*Math.random()),r=new Date(Date.now()+1e3*n);t.warn(`Attempting credential expiration extension due to a credential service availability issue. A refresh of these credentials will be attempted after ${new Date(r)}.\nFor more information, please visit: https://docs.aws.amazon.com/sdkref/latest/guide/feature-static-credentials.html`);const s=e.originalExpiration??e.expiration;return{...e,...s?{originalExpiration:s}:{},expiration:r}},Oc="/latest/meta-data/iam/security-credentials/",$c="AWS_EC2_METADATA_V1_DISABLED",Nc="ec2_metadata_v1_disabled",Dc="x-aws-ec2-metadata-token",jc=(e={})=>{let t=!1;const{logger:n,profile:r}=e,{timeout:s,maxRetries:o}=fc(e),i=async(n,s)=>{if(t||null==s.headers?.[Dc]){let t=!1,n=!1;const s=await ct({environmentVariableSelector:t=>{const r=t[$c];if(n=!!r&&"false"!==r,void 0===r)throw new $e(`${$c} not set in env, checking config file next.`,{logger:e.logger});return n},configFileSelector:e=>{const n=e[Nc];return t=!!n&&"false"!==n,t},default:!1},{profile:r})();if(e.ec2MetadataV1Disabled||s){const r=[];throw e.ec2MetadataV1Disabled&&r.push("credential provider initialization (runtime option ec2MetadataV1Disabled)"),t&&r.push(`config file profile (${Nc})`),n&&r.push(`process environment variable (${$c})`),new xc(`AWS EC2 Metadata v1 fallback has been blocked by AWS SDK configuration in the following: [${r.join(", ")}].`)}}const o=(await gc((async()=>{let e;try{e=await Mc(s)}catch(e){throw 401===e.statusCode&&(t=!1),e}return e}),n)).trim();return gc((async()=>{let n;try{n=await Uc(o,s,e)}catch(e){throw 401===e.statusCode&&(t=!1),e}return n}),n)};return async()=>{const e=await Cc();if(t)return n?.debug("AWS SDK Instance Metadata","using v1 fallback (no token fetch)"),i(o,{...e,timeout:s});{let r;try{r=(await Lc({...e,timeout:s})).toString()}catch(r){if(400===r?.statusCode)throw Object.assign(r,{message:"EC2 Metadata token request returned error"});return("TimeoutError"===r.message||[403,404,405].includes(r.statusCode))&&(t=!0),n?.debug("AWS SDK Instance Metadata","using v1 fallback (initial)"),i(o,{...e,timeout:s})}return i(o,{...e,headers:{[Dc]:r},timeout:s})}}},Lc=async e=>dc({...e,path:"/latest/api/token",method:"PUT",headers:{"x-aws-ec2-metadata-token-ttl-seconds":"21600"}}),Mc=async e=>(await dc({...e,path:Oc})).toString(),Uc=async(e,t,n)=>{const r=JSON.parse((await dc({...t,path:Oc+e})).toString());if(!pc(r))throw new $e("Invalid response received from instance metadata service.",{logger:n.logger});return hc(r)};var Fc=Object.freeze({__proto__:null,DEFAULT_MAX_RETRIES:0,DEFAULT_TIMEOUT:1e3,ENV_CMDS_AUTH_TOKEN:wc,ENV_CMDS_FULL_URI:mc,ENV_CMDS_RELATIVE_URI:yc,get Endpoint(){return Ac},fromContainerMetadata:(e={})=>{const{timeout:t,maxRetries:n}=fc(e);return()=>gc((async()=>{const n=await Ec({logger:e.logger}),r=JSON.parse(await bc(t,n));if(!pc(r))throw new $e("Invalid response received from instance metadata service.",{logger:e.logger});return hc(r)}),n)},fromInstanceMetadata:(e={})=>((e,t={})=>{const n=t?.logger||console;let r;return async()=>{let t;try{t=await e(),t.expiration&&t.expiration.getTime()<Date.now()&&(t=Rc(t,n))}catch(e){if(!r)throw e;n.warn("Credential renew failed: ",e),t=Rc(r,n)}return r=t,t}})(jc(e),{logger:e.logger}),getInstanceMetadataEndpoint:Cc,httpRequest:dc,providerConfigFromInit:fc});var zc=Object.freeze({__proto__:null,fromHttp:(e={})=>{let t;e.logger?.debug("@aws-sdk/credential-provider-http - fromHttp");const n=e.awsContainerCredentialsRelativeUri??process.env.AWS_CONTAINER_CREDENTIALS_RELATIVE_URI,r=e.awsContainerCredentialsFullUri??process.env.AWS_CONTAINER_CREDENTIALS_FULL_URI,s=e.awsContainerAuthorizationToken??process.env.AWS_CONTAINER_AUTHORIZATION_TOKEN,o=e.awsContainerAuthorizationTokenFile??process.env.AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE,i="NoOpLogger"!==e.logger?.constructor?.name&&e.logger?e.logger.warn:console.warn;if(n&&r&&(i("@aws-sdk/credential-provider-http: you have set both awsContainerCredentialsRelativeUri and awsContainerCredentialsFullUri."),i("awsContainerCredentialsFullUri will take precedence.")),s&&o&&(i("@aws-sdk/credential-provider-http: you have set both awsContainerAuthorizationToken and awsContainerAuthorizationTokenFile."),i("awsContainerAuthorizationToken will take precedence.")),r)t=r;else{if(!n)throw new $e("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${n}`}const a=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("."),n=e=>{const t=parseInt(e,10);return 0<=t&&t<=255};if("127"===t[0]&&n(t[1])&&n(t[2])&&n(t[3])&&4===t.length)return}throw new $e("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})}})(a,e.logger);const c=new wn({requestTimeout:e.timeout??1e3,connectionTimeout:e.timeout??1e3});return l=async()=>{const t=function(e){return new x({protocol:e.protocol,hostname:e.hostname,port:Number(e.port),path:e.pathname,query:Array.from(e.searchParams.entries()).reduce(((e,[t,n])=>(e[t]=n,e)),{}),fragment:e.hash})}(a);s?t.headers.Authorization=s:o&&(t.headers.Authorization=(await u.readFile(o)).toString());try{return async function(e,t){const n=Rn(e.body),r=await n.transformToString();if(200===e.statusCode){const e=JSON.parse(r);if("string"!=typeof e.AccessKeyId||"string"!=typeof e.SecretAccessKey||"string"!=typeof e.Token||"string"!=typeof e.Expiration)throw new $e("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:Qn(e.Expiration)}}if(e.statusCode>=400&&e.statusCode<500){let n={};try{n=JSON.parse(r)}catch(e){}throw Object.assign(new $e(`Server responded with status: ${e.statusCode}`,{logger:t}),{Code:n.Code,Message:n.Message})}throw new $e(`Server responded with status: ${e.statusCode}`,{logger:t})}((await c.handle(t)).response)}catch(t){throw new $e(String(t),{logger:e.logger})}},d=e.maxRetries??3,p=e.timeout??1e3,async()=>{for(let e=0;e<d;++e)try{return await l()}catch(e){await new Promise((e=>setTimeout(e,p)))}return await l()};var l,d,p}});const qc=e=>e&&("string"==typeof e.sso_start_url||"string"==typeof e.sso_account_id||"string"==typeof e.sso_session||"string"==typeof e.sso_region||"string"==typeof e.sso_role_name),Wc="To refresh this SSO session run 'aws sso login' with the corresponding profile.",Bc={},Hc=async(e,t)=>{const{CreateTokenCommand:n}=await Promise.resolve().then((function(){return Iu})),r=await(async e=>{const{SSOOIDCClient:t}=await Promise.resolve().then((function(){return Iu}));if(Bc[e])return Bc[e];const n=new t({region:e});return Bc[e]=n,n})(t);return r.send(new n({clientId:e.clientId,clientSecret:e.clientSecret,refreshToken:e.refreshToken,grantType:"refresh_token"}))},Vc=e=>{if(e.expiration&&e.expiration.getTime()<Date.now())throw new Ne(`Token is expired. ${Wc}`,!1)},Kc=(e,t,n=!1)=>{if(void 0===t)throw new Ne(`Value not present for '${e}' in SSO Token${n?". Cannot refresh":""}. ${Wc}`,!1)},{writeFile:Gc}=c.promises,Xc=new Date(0),Jc=(e={})=>async()=>{e.logger?.debug("@aws-sdk/token-providers - fromSso");const t=await it(e),n=ze(e),r=t[n];if(!r)throw new Ne(`Profile '${n}' could not be found in shared credentials file.`,!1);if(!r.sso_session)throw new Ne(`Profile '${n}' is missing required property 'sso_session'.`);const s=r.sso_session,o=(await ot(e))[s];if(!o)throw new Ne(`Sso session '${s}' could not be found in shared credentials file.`,!1);for(const e of["sso_start_url","sso_region"])if(!o[e])throw new Ne(`Sso session '${s}' is missing required property '${e}'.`,!1);o.sso_start_url;const i=o.sso_region;let a;try{a=await Be(s)}catch(e){throw new Ne(`The SSO session token associated with profile=${n} was not found or is invalid. ${Wc}`,!1)}Kc("accessToken",a.accessToken),Kc("expiresAt",a.expiresAt);const{accessToken:c,expiresAt:l}=a,u={token:c,expiration:new Date(l)};if(u.expiration.getTime()-Date.now()>3e5)return u;if(Date.now()-Xc.getTime()<3e4)return Vc(u),u;Kc("clientId",a.clientId,!0),Kc("clientSecret",a.clientSecret,!0),Kc("refreshToken",a.refreshToken,!0);try{Xc.setTime(Date.now());const e=await Hc(a,i);Kc("accessToken",e.accessToken),Kc("expiresIn",e.expiresIn);const t=new Date(Date.now()+1e3*e.expiresIn);try{await((e,t)=>{const n=qe(e),r=JSON.stringify(t,null,2);return Gc(n,r)})(s,{...a,accessToken:e.accessToken,expiresAt:t.toISOString(),refreshToken:e.refreshToken})}catch(e){}return{token:e.accessToken,expiration:t}}catch(e){return Vc(u),u}},Yc=!1,Zc=async({ssoStartUrl:e,ssoSession:t,ssoAccountId:n,ssoRegion:r,ssoRoleName:s,ssoClient:o,clientConfig:i,profile:a,logger:c})=>{let l;const u="To refresh this SSO session run aws sso login with the corresponding profile.";if(t)try{const e=await Jc({profile:a})();l={accessToken:e.token,expiresAt:new Date(e.expiration).toISOString()}}catch(e){throw new $e(e.message,{tryNextLink:Yc,logger:c})}else try{l=await Be(e)}catch(e){throw new $e(`The SSO session associated with this profile is invalid. ${u}`,{tryNextLink:Yc,logger:c})}if(new Date(l.expiresAt).getTime()-Date.now()<=0)throw new $e(`The SSO session associated with this profile has expired. ${u}`,{tryNextLink:Yc,logger:c});const{accessToken:d}=l,{SSOClient:p,GetRoleCredentialsCommand:h}=await Promise.resolve().then((function(){return Rd})),f=o||new p(Object.assign({},i??{},{region:i?.region??r}));let g;try{g=await f.send(new h({accountId:n,roleName:s,accessToken:d}))}catch(e){throw new $e(e,{tryNextLink:Yc,logger:c})}const{roleCredentials:{accessKeyId:m,secretAccessKey:y,sessionToken:w,expiration:b,credentialScope:v,accountId:S}={}}=g;if(!(m&&y&&w&&b))throw new $e("SSO returns an invalid temporary credential.",{tryNextLink:Yc,logger:c});return{accessKeyId:m,secretAccessKey:y,sessionToken:w,expiration:new Date(b),...v&&{credentialScope:v},...S&&{accountId:S}}},Qc=(e,t)=>{const{sso_start_url:n,sso_account_id:r,sso_region:s,sso_role_name:o}=e;if(!(n&&r&&s&&o))throw new $e(`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:t});return e};var el=Object.freeze({__proto__:null,fromSSO:(e={})=>async()=>{e.logger?.debug("@aws-sdk/credential-provider-sso - fromSSO");const{ssoStartUrl:t,ssoAccountId:n,ssoRegion:r,ssoRoleName:s,ssoSession:o}=e,{ssoClient:i}=e,a=ze(e);if(t||n||r||s||o){if(t&&n&&r&&s)return Zc({ssoStartUrl:t,ssoSession:o,ssoAccountId:n,ssoRegion:r,ssoRoleName:s,ssoClient:i,clientConfig:e.clientConfig,profile:a});throw new $e('Incomplete configuration. The fromSSO() argument hash must include "ssoStartUrl", "ssoAccountId", "ssoRegion", "ssoRoleName"',{tryNextLink:!1,logger:e.logger})}{const n=(await it(e))[a];if(!n)throw new $e(`Profile ${a} was not found.`,{logger:e.logger});if(!qc(n))throw new $e(`Profile ${a} is not configured with SSO credentials.`,{logger:e.logger});if(n?.sso_session){const s=(await ot(e))[n.sso_session],o=` configurations in profile ${a} and sso-session ${n.sso_session}`;if(r&&r!==s.sso_region)throw new $e("Conflicting SSO region"+o,{tryNextLink:!1,logger:e.logger});if(t&&t!==s.sso_start_url)throw new $e("Conflicting SSO start_url"+o,{tryNextLink:!1,logger:e.logger});n.sso_region=s.sso_region,n.sso_start_url=s.sso_start_url}const{sso_start_url:s,sso_account_id:o,sso_region:c,sso_role_name:l,sso_session:u}=Qc(n,e.logger);return Zc({ssoStartUrl:s,ssoSession:u,ssoAccountId:o,ssoRegion:c,ssoRoleName:l,ssoClient:i,clientConfig:e.clientConfig,profile:a})}},isSsoProfile:qc,validateSsoProfile:Qc});const tl=(e,{profile:t,logger:n})=>{const r="string"==typeof e.source_profile&&void 0===e.credential_source;return r&&n?.debug?.(` ${t} isAssumeRoleWithSourceProfile source_profile=${e.source_profile}`),r},nl=(e,{profile:t,logger:n})=>{const r="string"==typeof e.credential_source&&void 0===e.source_profile;return r&&n?.debug?.(` ${t} isCredentialSourceProfile credential_source=${e.credential_source}`),r},rl=async(e,t,n,r={})=>{n.logger?.debug("@aws-sdk/credential-provider-ini - resolveAssumeRoleCredentials (STS)");const s=t[e];if(!n.roleAssumer){const{getDefaultRoleAssumer:e}=await Promise.resolve().then((function(){return hf}));n.roleAssumer=e({...n.clientConfig,credentialProviderLogger:n.logger,parentClientConfig:n?.parentClientConfig},n.clientPlugins)}const{source_profile:o}=s;if(o&&o in r)throw new $e(`Detected a cycle attempting to resolve credentials for profile ${ze(n)}. Profiles visited: `+Object.keys(r).join(", "),{logger:n.logger});n.logger?.debug("@aws-sdk/credential-provider-ini - finding credential resolver using "+(o?`source_profile=[${o}]`:`profile=[${e}]`));const i=o?il(o,{...t,[o]:{...t[o],role_arn:s.role_arn??t[o].role_arn}},n,{...r,[o]:!0}):(await((e,t,n)=>{const r={EcsContainer:async e=>{const{fromHttp:t}=await Promise.resolve().then((function(){return zc})),{fromContainerMetadata:r}=await Promise.resolve().then((function(){return Fc}));return n?.debug("@aws-sdk/credential-provider-ini - credential_source is EcsContainer"),De(t(e??{}),r(e))},Ec2InstanceMetadata:async e=>{n?.debug("@aws-sdk/credential-provider-ini - credential_source is Ec2InstanceMetadata");const{fromInstanceMetadata:t}=await Promise.resolve().then((function(){return Fc}));return t(e)},Environment:async e=>{n?.debug("@aws-sdk/credential-provider-ini - credential_source is Environment");const{fromEnv:t}=await Promise.resolve().then((function(){return Ei}));return t(e)}};if(e in r)return r[e];throw new $e(`Unsupported credential source in profile ${t}. Got ${e}, expected EcsContainer or Ec2InstanceMetadata or Environment.`,{logger:n})})(s.credential_source,e,n.logger)(n))(),a={RoleArn:s.role_arn,RoleSessionName:s.role_session_name||`aws-sdk-js-${Date.now()}`,ExternalId:s.external_id,DurationSeconds:parseInt(s.duration_seconds||"3600",10)},{mfa_serial:c}=s;if(c){if(!n.mfaCodeProvider)throw new $e(`Profile ${e} requires multi-factor authentication, but no MFA code callback was provided.`,{logger:n.logger,tryNextLink:!1});a.SerialNumber=c,a.TokenCode=await n.mfaCodeProvider(c)}const l=await i;return n.roleAssumer(l,a)},sl=e=>Boolean(e)&&"object"==typeof e&&"string"==typeof e.aws_access_key_id&&"string"==typeof e.aws_secret_access_key&&["undefined","string"].indexOf(typeof e.aws_session_token)>-1&&["undefined","string"].indexOf(typeof e.aws_account_id)>-1,ol=(e,t)=>(t?.logger?.debug("@aws-sdk/credential-provider-ini - resolveStaticCredentials"),Promise.resolve({accessKeyId:e.aws_access_key_id,secretAccessKey:e.aws_secret_access_key,sessionToken:e.aws_session_token,...e.aws_credential_scope&&{credentialScope:e.aws_credential_scope},...e.aws_account_id&&{accountId:e.aws_account_id}})),il=async(e,t,n,r={})=>{const s=t[e];if(Object.keys(r).length>0&&sl(s))return ol(s,n);if(((e,{profile:t="default",logger:n}={})=>Boolean(e)&&"object"==typeof e&&"string"==typeof e.role_arn&&["undefined","string"].indexOf(typeof e.role_session_name)>-1&&["undefined","string"].indexOf(typeof e.external_id)>-1&&["undefined","string"].indexOf(typeof e.mfa_serial)>-1&&(tl(e,{profile:t,logger:n})||nl(e,{profile:t,logger:n})))(s,{profile:e,logger:n.logger}))return rl(e,t,n,r);if(sl(s))return ol(s,n);if(o=s,Boolean(o)&&"object"==typeof o&&"string"==typeof o.web_identity_token_file&&"string"==typeof o.role_arn&&["undefined","string"].indexOf(typeof o.role_session_name)>-1)return(async(e,t)=>Promise.resolve().then((function(){return dl})).then((({fromTokenFile:n})=>n({webIdentityTokenFile:e.web_identity_token_file,roleArn:e.role_arn,roleSessionName:e.role_session_name,roleAssumerWithWebIdentity:t.roleAssumerWithWebIdentity,logger:t.logger,parentClientConfig:t.parentClientConfig})())))(s,n);var o;if((e=>Boolean(e)&&"object"==typeof e&&"string"==typeof e.credential_process)(s))return(async(e,t)=>Promise.resolve().then((function(){return ll})).then((({fromProcess:n})=>n({...e,profile:t})())))(n,e);if((e=>e&&("string"==typeof e.sso_start_url||"string"==typeof e.sso_account_id||"string"==typeof e.sso_session||"string"==typeof e.sso_region||"string"==typeof e.sso_role_name))(s))return await(async(e,t={})=>{const{fromSSO:n}=await Promise.resolve().then((function(){return el}));return n({profile:e,logger:t.logger})()})(e,n);throw new $e(`Could not resolve credentials using profile: [${e}] in configuration/credentials file(s).`,{logger:n.logger})};var al=Object.freeze({__proto__:null,fromIni:(e={})=>async()=>{e.logger?.debug("@aws-sdk/credential-provider-ini - fromIni");const t=await it(e);return il(ze(e),t,e)}});const cl=async(e,t,n)=>{const r=t[e];if(!t[e])throw new $e(`Profile ${e} could not be found in shared credentials file.`,{logger:n});{const o=r.credential_process;if(void 0===o)throw new $e(`Profile ${e} did not contain credential_process.`,{logger:n});{const r=s.promisify(d.exec);try{const{stdout:n}=await r(o);let s;try{s=JSON.parse(n.trim())}catch{throw Error(`Profile ${e} credential_process returned invalid JSON.`)}return((e,t,n)=>{if(1!==t.Version)throw Error(`Profile ${e} credential_process did not return Version 1.`);if(void 0===t.AccessKeyId||void 0===t.SecretAccessKey)throw Error(`Profile ${e} credential_process returned invalid credentials.`);if(t.Expiration){const n=new Date;if(new Date(t.Expiration)<n)throw Error(`Profile ${e} credential_process returned expired credentials.`)}let r=t.AccountId;return!r&&n?.[e]?.aws_account_id&&(r=n[e].aws_account_id),{accessKeyId:t.AccessKeyId,secretAccessKey:t.SecretAccessKey,...t.SessionToken&&{sessionToken:t.SessionToken},...t.Expiration&&{expiration:new Date(t.Expiration)},...t.CredentialScope&&{credentialScope:t.CredentialScope},...r&&{accountId:r}}})(e,s,t)}catch(e){throw new $e(e.message,{logger:n})}}}};var ll=Object.freeze({__proto__:null,fromProcess:(e={})=>async()=>{e.logger?.debug("@aws-sdk/credential-provider-process - fromProcess");const t=await it(e);return cl(ze(e),t,e.logger)}});const ul=e=>async()=>{e.logger?.debug("@aws-sdk/credential-provider-web-identity - fromWebToken");const{roleArn:t,roleSessionName:n,webIdentityToken:r,providerId:s,policyArns:o,policy:i,durationSeconds:a}=e;let{roleAssumerWithWebIdentity:c}=e;if(!c){const{getDefaultRoleAssumerWithWebIdentity:t}=await Promise.resolve().then((function(){return hf}));c=t({...e.clientConfig,credentialProviderLogger:e.logger,parentClientConfig:e.parentClientConfig},e.clientPlugins)}return c({RoleArn:t,RoleSessionName:n??`aws-sdk-js-session-${Date.now()}`,WebIdentityToken:r,ProviderId:s,PolicyArns:o,Policy:i,DurationSeconds:a})};var dl=Object.freeze({__proto__:null,fromTokenFile:(e={})=>async()=>{e.logger?.debug("@aws-sdk/credential-provider-web-identity - fromTokenFile");const t=e?.webIdentityTokenFile??process.env.AWS_WEB_IDENTITY_TOKEN_FILE,n=e?.roleArn??process.env.AWS_ROLE_ARN,r=e?.roleSessionName??process.env.AWS_ROLE_SESSION_NAME;if(!t||!n)throw new $e("Web identity configuration not specified",{logger:e.logger});return ul({...e,webIdentityToken:c.readFileSync(t,{encoding:"ascii"}),roleArn:n,roleSessionName:r})()},fromWebToken:ul});const pl=async(e,t,n)=>({operation:we(t).operation,region:await be(e.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});const hl=e=>{const t=[];switch(e.operation){case"CreateToken":case"RegisterClient":case"StartDeviceAuthorization":t.push({schemeId:"smithy.api#noAuth"});break;default:t.push(function(e){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"sso-oauth",region:e.region},propertiesExtractor:(e,t)=>({signingProperties:{config:e,context:t}})}}(e))}return t},fl={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}};var gl="3.645.0";const ml="required",yl="fn",wl="argv",bl="ref",vl=!0,Sl="isSet",El="booleanEquals",xl="error",Al="endpoint",Pl="tree",Tl="PartitionResult",Il="getAttr",Cl={[ml]:!1,type:"String"},kl={[ml]:!0,default:!1,type:"Boolean"},_l={[bl]:"Endpoint"},Rl={[yl]:El,[wl]:[{[bl]:"UseFIPS"},!0]},Ol={[yl]:El,[wl]:[{[bl]:"UseDualStack"},!0]},$l={},Nl={[yl]:Il,[wl]:[{[bl]:Tl},"supportsFIPS"]},Dl={[bl]:Tl},jl={[yl]:El,[wl]:[!0,{[yl]:Il,[wl]:[Dl,"supportsDualStack"]}]},Ll=[Rl],Ml=[Ol],Ul=[{[bl]:"Region"}],Fl={version:"1.0",parameters:{Region:Cl,UseDualStack:kl,UseFIPS:kl,Endpoint:Cl},rules:[{conditions:[{[yl]:Sl,[wl]:[_l]}],rules:[{conditions:Ll,error:"Invalid Configuration: FIPS and custom endpoint are not supported",type:xl},{conditions:Ml,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",type:xl},{endpoint:{url:_l,properties:$l,headers:$l},type:Al}],type:Pl},{conditions:[{[yl]:Sl,[wl]:Ul}],rules:[{conditions:[{[yl]:"aws.partition",[wl]:Ul,assign:Tl}],rules:[{conditions:[Rl,Ol],rules:[{conditions:[{[yl]:El,[wl]:[vl,Nl]},jl],rules:[{endpoint:{url:"https://oidc-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:$l,headers:$l},type:Al}],type:Pl},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",type:xl}],type:Pl},{conditions:Ll,rules:[{conditions:[{[yl]:El,[wl]:[Nl,vl]}],rules:[{conditions:[{[yl]:"stringEquals",[wl]:[{[yl]:Il,[wl]:[Dl,"name"]},"aws-us-gov"]}],endpoint:{url:"https://oidc.{Region}.amazonaws.com",properties:$l,headers:$l},type:Al},{endpoint:{url:"https://oidc-fips.{Region}.{PartitionResult#dnsSuffix}",properties:$l,headers:$l},type:Al}],type:Pl},{error:"FIPS is enabled but this partition does not support FIPS",type:xl}],type:Pl},{conditions:Ml,rules:[{conditions:[jl],rules:[{endpoint:{url:"https://oidc.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:$l,headers:$l},type:Al}],type:Pl},{error:"DualStack is enabled but this partition does not support DualStack",type:xl}],type:Pl},{endpoint:{url:"https://oidc.{Region}.{PartitionResult#dnsSuffix}",properties:$l,headers:$l},type:Al}],type:Pl}],type:Pl},{error:"Invalid Configuration: Missing Region",type:xl}]},zl=(e,t={})=>re(Fl,{endpointParams:e,logger:t.logger});L.aws=ie;const ql=e=>{gr(process.version);const t=oa(e),n=()=>t().then(hr),r=(e=>({apiVersion:"2019-06-10",base64Decoder:e?.base64Decoder??an,base64Encoder:e?.base64Encoder??dn,disableHostPrefix:e?.disableHostPrefix??!1,endpointProvider:e?.endpointProvider??zl,extensions:e?.extensions??[],httpAuthSchemeProvider:e?.httpAuthSchemeProvider??hl,httpAuthSchemes:e?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4"),signer:new ss},{schemeId:"smithy.api#noAuth",identityProvider:e=>e.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new qr}],logger:e?.logger??new Xt,serviceId:e?.serviceId??"SSO OIDC",urlParser:e?.urlParser??pt,utf8Decoder:e?.utf8Decoder??cn,utf8Encoder:e?.utf8Encoder??un}))(e);return Qr(process.version),{...r,...e,runtime:"node",defaultsMode:t,bodyLengthChecker:e?.bodyLengthChecker??_i,credentialDefaultProvider:e?.credentialDefaultProvider??Ai,defaultUserAgentProvider:e?.defaultUserAgentProvider??Ii({serviceId:r.serviceId,clientVersion:gl}),maxAttempts:e?.maxAttempts??ct(Vt),region:e?.region??ct(ve,Se),requestHandler:wn.create(e?.requestHandler??n),retryMode:e?.retryMode??ct({...Gt,default:async()=>(await n()).retryMode||It}),sha256:e?.sha256??Ci.bind(null,"sha256"),streamCollector:e?.streamCollector??vn,useDualstackEndpoint:e?.useDualstackEndpoint??ct(me),useFipsEndpoint:e?.useFipsEndpoint??ct(ye)}},Wl=e=>{const t=e.httpAuthSchemes;let n=e.httpAuthSchemeProvider,r=e.credentials;return{setHttpAuthScheme(e){const n=t.findIndex((t=>t.schemeId===e.schemeId));-1===n?t.push(e):t.splice(n,1,e)},httpAuthSchemes:()=>t,setHttpAuthSchemeProvider(e){n=e},httpAuthSchemeProvider:()=>n,setCredentials(e){r=e},credentials:()=>r}};class Bl extends lr{constructor(e){super(e),Object.setPrototypeOf(this,Bl.prototype)}}class Hl extends Bl{constructor(e){super({name:"AccessDeniedException",$fault:"client",...e}),this.name="AccessDeniedException",this.$fault="client",Object.setPrototypeOf(this,Hl.prototype),this.error=e.error,this.error_description=e.error_description}}class Vl extends Bl{constructor(e){super({name:"AuthorizationPendingException",$fault:"client",...e}),this.name="AuthorizationPendingException",this.$fault="client",Object.setPrototypeOf(this,Vl.prototype),this.error=e.error,this.error_description=e.error_description}}let Kl=class e extends Bl{constructor(t){super({name:"ExpiredTokenException",$fault:"client",...t}),this.name="ExpiredTokenException",this.$fault="client",Object.setPrototypeOf(this,e.prototype),this.error=t.error,this.error_description=t.error_description}};class Gl extends Bl{constructor(e){super({name:"InternalServerException",$fault:"server",...e}),this.name="InternalServerException",this.$fault="server",Object.setPrototypeOf(this,Gl.prototype),this.error=e.error,this.error_description=e.error_description}}class Xl extends Bl{constructor(e){super({name:"InvalidClientException",$fault:"client",...e}),this.name="InvalidClientException",this.$fault="client",Object.setPrototypeOf(this,Xl.prototype),this.error=e.error,this.error_description=e.error_description}}class Jl extends Bl{constructor(e){super({name:"InvalidGrantException",$fault:"client",...e}),this.name="InvalidGrantException",this.$fault="client",Object.setPrototypeOf(this,Jl.prototype),this.error=e.error,this.error_description=e.error_description}}let Yl=class e extends Bl{constructor(t){super({name:"InvalidRequestException",$fault:"client",...t}),this.name="InvalidRequestException",this.$fault="client",Object.setPrototypeOf(this,e.prototype),this.error=t.error,this.error_description=t.error_description}};class Zl extends Bl{constructor(e){super({name:"InvalidScopeException",$fault:"client",...e}),this.name="InvalidScopeException",this.$fault="client",Object.setPrototypeOf(this,Zl.prototype),this.error=e.error,this.error_description=e.error_description}}class Ql extends Bl{constructor(e){super({name:"SlowDownException",$fault:"client",...e}),this.name="SlowDownException",this.$fault="client",Object.setPrototypeOf(this,Ql.prototype),this.error=e.error,this.error_description=e.error_description}}class eu extends Bl{constructor(e){super({name:"UnauthorizedClientException",$fault:"client",...e}),this.name="UnauthorizedClientException",this.$fault="client",Object.setPrototypeOf(this,eu.prototype),this.error=e.error,this.error_description=e.error_description}}class tu extends Bl{constructor(e){super({name:"UnsupportedGrantTypeException",$fault:"client",...e}),this.name="UnsupportedGrantTypeException",this.$fault="client",Object.setPrototypeOf(this,tu.prototype),this.error=e.error,this.error_description=e.error_description}}class nu extends Bl{constructor(e){super({name:"InvalidRequestRegionException",$fault:"client",...e}),this.name="InvalidRequestRegionException",this.$fault="client",Object.setPrototypeOf(this,nu.prototype),this.error=e.error,this.error_description=e.error_description,this.endpoint=e.endpoint,this.region=e.region}}class ru extends Bl{constructor(e){super({name:"InvalidClientMetadataException",$fault:"client",...e}),this.name="InvalidClientMetadataException",this.$fault="client",Object.setPrototypeOf(this,ru.prototype),this.error=e.error,this.error_description=e.error_description}}class su extends Bl{constructor(e){super({name:"InvalidRedirectUriException",$fault:"client",...e}),this.name="InvalidRedirectUriException",this.$fault="client",Object.setPrototypeOf(this,su.prototype),this.error=e.error,this.error_description=e.error_description}}const ou=e=>({...e,...e.clientSecret&&{clientSecret:Nn},...e.refreshToken&&{refreshToken:Nn},...e.codeVerifier&&{codeVerifier:Nn}}),iu=e=>({...e,...e.accessToken&&{accessToken:Nn},...e.refreshToken&&{refreshToken:Nn},...e.idToken&&{idToken:Nn}}),au=async(e,t)=>{const n=Kr(e,t);let r;return n.bp("/token"),r=JSON.stringify(Tr(e,{clientId:[],clientSecret:[],code:[],codeVerifier:[],deviceCode:[],grantType:[],redirectUri:[],refreshToken:[],scope:e=>Rr(e)})),n.m("POST").h({"content-type":"application/json"}).b(r),n.build()},cu=async(e,t)=>{if(200!==e.statusCode&&e.statusCode>=300)return lu(e,t);const n=Pr({$metadata:Pu(e)}),r=qn(Wn(await Ms(e.body,t)),"body"),s=Tr(r,{accessToken:Bn,expiresIn:Ln,idToken:Bn,refreshToken:Bn,tokenType:Bn});return Object.assign(n,s),n},lu=async(e,t)=>{const n={...e,body:await Us(e.body,t)},r=Fs(e,n.body);switch(r){case"AccessDeniedException":case"com.amazonaws.ssooidc#AccessDeniedException":throw await du(n);case"AuthorizationPendingException":case"com.amazonaws.ssooidc#AuthorizationPendingException":throw await pu(n);case"ExpiredTokenException":case"com.amazonaws.ssooidc#ExpiredTokenException":throw await hu(n);case"InternalServerException":case"com.amazonaws.ssooidc#InternalServerException":throw await fu(n);case"InvalidClientException":case"com.amazonaws.ssooidc#InvalidClientException":throw await gu(n);case"InvalidGrantException":case"com.amazonaws.ssooidc#InvalidGrantException":throw await yu(n);case"InvalidRequestException":case"com.amazonaws.ssooidc#InvalidRequestException":throw await bu(n);case"InvalidScopeException":case"com.amazonaws.ssooidc#InvalidScopeException":throw await Su(n);case"SlowDownException":case"com.amazonaws.ssooidc#SlowDownException":throw await Eu(n);case"UnauthorizedClientException":case"com.amazonaws.ssooidc#UnauthorizedClientException":throw await xu(n);case"UnsupportedGrantTypeException":case"com.amazonaws.ssooidc#UnsupportedGrantTypeException":throw await Au(n);case"InvalidRequestRegionException":case"com.amazonaws.ssooidc#InvalidRequestRegionException":throw await vu(n);case"InvalidClientMetadataException":case"com.amazonaws.ssooidc#InvalidClientMetadataException":throw await mu(n);case"InvalidRedirectUriException":case"com.amazonaws.ssooidc#InvalidRedirectUriException":throw await wu(n);default:const t=n.body;return uu({output:e,parsedBody:t,errorCode:r})}},uu=dr(Bl),du=async(e,t)=>{const n=Pr({}),r=e.body,s=Tr(r,{error:Bn,error_description:Bn});Object.assign(n,s);const o=new Hl({$metadata:Pu(e),...n});return ur(o,e.body)},pu=async(e,t)=>{const n=Pr({}),r=e.body,s=Tr(r,{error:Bn,error_description:Bn});Object.assign(n,s);const o=new Vl({$metadata:Pu(e),...n});return ur(o,e.body)},hu=async(e,t)=>{const n=Pr({}),r=e.body,s=Tr(r,{error:Bn,error_description:Bn});Object.assign(n,s);const o=new Kl({$metadata:Pu(e),...n});return ur(o,e.body)},fu=async(e,t)=>{const n=Pr({}),r=e.body,s=Tr(r,{error:Bn,error_description:Bn});Object.assign(n,s);const o=new Gl({$metadata:Pu(e),...n});return ur(o,e.body)},gu=async(e,t)=>{const n=Pr({}),r=e.body,s=Tr(r,{error:Bn,error_description:Bn});Object.assign(n,s);const o=new Xl({$metadata:Pu(e),...n});return ur(o,e.body)},mu=async(e,t)=>{const n=Pr({}),r=e.body,s=Tr(r,{error:Bn,error_description:Bn});Object.assign(n,s);const o=new ru({$metadata:Pu(e),...n});return ur(o,e.body)},yu=async(e,t)=>{const n=Pr({}),r=e.body,s=Tr(r,{error:Bn,error_description:Bn});Object.assign(n,s);const o=new Jl({$metadata:Pu(e),...n});return ur(o,e.body)},wu=async(e,t)=>{const n=Pr({}),r=e.body,s=Tr(r,{error:Bn,error_description:Bn});Object.assign(n,s);const o=new su({$metadata:Pu(e),...n});return ur(o,e.body)},bu=async(e,t)=>{const n=Pr({}),r=e.body,s=Tr(r,{error:Bn,error_description:Bn});Object.assign(n,s);const o=new Yl({$metadata:Pu(e),...n});return ur(o,e.body)},vu=async(e,t)=>{const n=Pr({}),r=e.body,s=Tr(r,{endpoint:Bn,error:Bn,error_description:Bn,region:Bn});Object.assign(n,s);const o=new nu({$metadata:Pu(e),...n});return ur(o,e.body)},Su=async(e,t)=>{const n=Pr({}),r=e.body,s=Tr(r,{error:Bn,error_description:Bn});Object.assign(n,s);const o=new Zl({$metadata:Pu(e),...n});return ur(o,e.body)},Eu=async(e,t)=>{const n=Pr({}),r=e.body,s=Tr(r,{error:Bn,error_description:Bn});Object.assign(n,s);const o=new Ql({$metadata:Pu(e),...n});return ur(o,e.body)},xu=async(e,t)=>{const n=Pr({}),r=e.body,s=Tr(r,{error:Bn,error_description:Bn});Object.assign(n,s);const o=new eu({$metadata:Pu(e),...n});return ur(o,e.body)},Au=async(e,t)=>{const n=Pr({}),r=e.body,s=Tr(r,{error:Bn,error_description:Bn});Object.assign(n,s);const o=new tu({$metadata:Pu(e),...n});return ur(o,e.body)},Pu=e=>({httpStatusCode:e.statusCode,requestId:e.headers["x-amzn-requestid"]??e.headers["x-amzn-request-id"]??e.headers["x-amz-request-id"],extendedRequestId:e.headers["x-amz-id-2"],cfId:e.headers["x-amz-cf-id"]});class Tu extends(On.classBuilder().ep({...fl}).m((function(e,t,n,r){return[wt(n,this.serialize,this.deserialize),vt(n,e.getEndpointParameterInstructions())]})).s("AWSSSOOIDCService","CreateToken",{}).n("SSOOIDCClient","CreateTokenCommand").f(ou,iu).ser(au).de(cu).build()){}var Iu=Object.freeze({__proto__:null,$Command:On,AccessDeniedException:Hl,AuthorizationPendingException:Vl,CreateTokenCommand:Tu,CreateTokenRequestFilterSensitiveLog:ou,CreateTokenResponseFilterSensitiveLog:iu,ExpiredTokenException:Kl,InternalServerException:Gl,InvalidClientException:Xl,InvalidClientMetadataException:ru,InvalidGrantException:Jl,InvalidRedirectUriException:su,InvalidRequestException:Yl,InvalidRequestRegionException:nu,InvalidScopeException:Zl,SSOOIDCClient:class extends tn{constructor(...[e]){const t=ql(e||{});var n;const r=O((n=t,{...n,useDualstackEndpoint:n.useDualstackEndpoint??!1,useFipsEndpoint:n.useFipsEndpoint??!1,defaultSigningName:"sso-oauth"})),s=Kt(r),o=Ae(s),i=St(o);const a=((e,t)=>{const n={...la(e),...vr(e),...h(e),...Wl(e)};return t.forEach((e=>e.configure(n))),{...e,...ua(n),...Sr(n),...f(n),...(r=n,{httpAuthSchemes:r.httpAuthSchemes(),httpAuthSchemeProvider:r.httpAuthSchemeProvider(),credentials:r.credentials()})};var r})({...js(i)},e?.extensions||[]);super(a),this.config=a,this.middlewareStack.use(he(this.config)),this.middlewareStack.use(Lr(this.config)),this.middlewareStack.use(Yr(this.config)),this.middlewareStack.use(T(this.config)),this.middlewareStack.use(C(this.config)),this.middlewareStack.use(R(this.config)),this.middlewareStack.use(xt(this.config,{httpAuthSchemeParametersProvider:pl,identityProviderConfigProvider:async e=>new zr({"aws.auth#sigv4":e.credentials})})),this.middlewareStack.use(Fr(this.config))}destroy(){super.destroy()}},SSOOIDCServiceException:Bl,SlowDownException:Ql,UnauthorizedClientException:eu,UnsupportedGrantTypeException:tu,__Client:tn});const Cu=async(e,t,n)=>({operation:we(t).operation,region:await be(e.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});const ku=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},_u={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}};var Ru="3.645.0";const Ou="required",$u="fn",Nu="argv",Du="ref",ju=!0,Lu="isSet",Mu="booleanEquals",Uu="error",Fu="endpoint",zu="tree",qu="PartitionResult",Wu="getAttr",Bu={[Ou]:!1,type:"String"},Hu={[Ou]:!0,default:!1,type:"Boolean"},Vu={[Du]:"Endpoint"},Ku={[$u]:Mu,[Nu]:[{[Du]:"UseFIPS"},!0]},Gu={[$u]:Mu,[Nu]:[{[Du]:"UseDualStack"},!0]},Xu={},Ju={[$u]:Wu,[Nu]:[{[Du]:qu},"supportsFIPS"]},Yu={[Du]:qu},Zu={[$u]:Mu,[Nu]:[!0,{[$u]:Wu,[Nu]:[Yu,"supportsDualStack"]}]},Qu=[Ku],ed=[Gu],td=[{[Du]:"Region"}],nd={version:"1.0",parameters:{Region:Bu,UseDualStack:Hu,UseFIPS:Hu,Endpoint:Bu},rules:[{conditions:[{[$u]:Lu,[Nu]:[Vu]}],rules:[{conditions:Qu,error:"Invalid Configuration: FIPS and custom endpoint are not supported",type:Uu},{conditions:ed,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",type:Uu},{endpoint:{url:Vu,properties:Xu,headers:Xu},type:Fu}],type:zu},{conditions:[{[$u]:Lu,[Nu]:td}],rules:[{conditions:[{[$u]:"aws.partition",[Nu]:td,assign:qu}],rules:[{conditions:[Ku,Gu],rules:[{conditions:[{[$u]:Mu,[Nu]:[ju,Ju]},Zu],rules:[{endpoint:{url:"https://portal.sso-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:Xu,headers:Xu},type:Fu}],type:zu},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",type:Uu}],type:zu},{conditions:Qu,rules:[{conditions:[{[$u]:Mu,[Nu]:[Ju,ju]}],rules:[{conditions:[{[$u]:"stringEquals",[Nu]:[{[$u]:Wu,[Nu]:[Yu,"name"]},"aws-us-gov"]}],endpoint:{url:"https://portal.sso.{Region}.amazonaws.com",properties:Xu,headers:Xu},type:Fu},{endpoint:{url:"https://portal.sso-fips.{Region}.{PartitionResult#dnsSuffix}",properties:Xu,headers:Xu},type:Fu}],type:zu},{error:"FIPS is enabled but this partition does not support FIPS",type:Uu}],type:zu},{conditions:ed,rules:[{conditions:[Zu],rules:[{endpoint:{url:"https://portal.sso.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:Xu,headers:Xu},type:Fu}],type:zu},{error:"DualStack is enabled but this partition does not support DualStack",type:Uu}],type:zu},{endpoint:{url:"https://portal.sso.{Region}.{PartitionResult#dnsSuffix}",properties:Xu,headers:Xu},type:Fu}],type:zu}],type:zu},{error:"Invalid Configuration: Missing Region",type:Uu}]},rd=(e,t={})=>re(nd,{endpointParams:e,logger:t.logger});L.aws=ie;const sd=e=>{gr(process.version);const t=oa(e),n=()=>t().then(hr),r=(e=>({apiVersion:"2019-06-10",base64Decoder:e?.base64Decoder??an,base64Encoder:e?.base64Encoder??dn,disableHostPrefix:e?.disableHostPrefix??!1,endpointProvider:e?.endpointProvider??rd,extensions:e?.extensions??[],httpAuthSchemeProvider:e?.httpAuthSchemeProvider??ku,httpAuthSchemes:e?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4"),signer:new ss},{schemeId:"smithy.api#noAuth",identityProvider:e=>e.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new qr}],logger:e?.logger??new Xt,serviceId:e?.serviceId??"SSO",urlParser:e?.urlParser??pt,utf8Decoder:e?.utf8Decoder??cn,utf8Encoder:e?.utf8Encoder??un}))(e);return Qr(process.version),{...r,...e,runtime:"node",defaultsMode:t,bodyLengthChecker:e?.bodyLengthChecker??_i,defaultUserAgentProvider:e?.defaultUserAgentProvider??Ii({serviceId:r.serviceId,clientVersion:Ru}),maxAttempts:e?.maxAttempts??ct(Vt),region:e?.region??ct(ve,Se),requestHandler:wn.create(e?.requestHandler??n),retryMode:e?.retryMode??ct({...Gt,default:async()=>(await n()).retryMode||It}),sha256:e?.sha256??Ci.bind(null,"sha256"),streamCollector:e?.streamCollector??vn,useDualstackEndpoint:e?.useDualstackEndpoint??ct(me),useFipsEndpoint:e?.useFipsEndpoint??ct(ye)}},od=e=>{const t=e.httpAuthSchemes;let n=e.httpAuthSchemeProvider,r=e.credentials;return{setHttpAuthScheme(e){const n=t.findIndex((t=>t.schemeId===e.schemeId));-1===n?t.push(e):t.splice(n,1,e)},httpAuthSchemes:()=>t,setHttpAuthSchemeProvider(e){n=e},httpAuthSchemeProvider:()=>n,setCredentials(e){r=e},credentials:()=>r}};class id extends lr{constructor(e){super(e),Object.setPrototypeOf(this,id.prototype)}}class ad extends id{constructor(e){super({name:"InvalidRequestException",$fault:"client",...e}),this.name="InvalidRequestException",this.$fault="client",Object.setPrototypeOf(this,ad.prototype)}}class cd extends id{constructor(e){super({name:"ResourceNotFoundException",$fault:"client",...e}),this.name="ResourceNotFoundException",this.$fault="client",Object.setPrototypeOf(this,cd.prototype)}}class ld extends id{constructor(e){super({name:"TooManyRequestsException",$fault:"client",...e}),this.name="TooManyRequestsException",this.$fault="client",Object.setPrototypeOf(this,ld.prototype)}}class ud extends id{constructor(e){super({name:"UnauthorizedException",$fault:"client",...e}),this.name="UnauthorizedException",this.$fault="client",Object.setPrototypeOf(this,ud.prototype)}}const dd=e=>({...e,...e.accessToken&&{accessToken:Nn}}),pd=e=>({...e,...e.secretAccessKey&&{secretAccessKey:Nn},...e.sessionToken&&{sessionToken:Nn}}),hd=e=>({...e,...e.roleCredentials&&{roleCredentials:pd(e.roleCredentials)}}),fd=async(e,t)=>{const n=Kr(e,t),r=Pr({},xd,{[kd]:e[Pd]});n.bp("/federation/credentials");const s=Pr({[Cd]:[,qn(e[Id],"roleName")],[Td]:[,qn(e[Ad],"accountId")]});return n.m("GET").h(r).q(s).b(undefined),n.build()},gd=async(e,t)=>{if(200!==e.statusCode&&e.statusCode>=300)return md(e,t);const n=Pr({$metadata:Ed(e)}),r=qn(Wn(await Ms(e.body,t)),"body"),s=Tr(r,{roleCredentials:Rr});return Object.assign(n,s),n},md=async(e,t)=>{const n={...e,body:await Us(e.body,t)},r=Fs(e,n.body);switch(r){case"InvalidRequestException":case"com.amazonaws.sso#InvalidRequestException":throw await wd(n);case"ResourceNotFoundException":case"com.amazonaws.sso#ResourceNotFoundException":throw await bd(n);case"TooManyRequestsException":case"com.amazonaws.sso#TooManyRequestsException":throw await vd(n);case"UnauthorizedException":case"com.amazonaws.sso#UnauthorizedException":throw await Sd(n);default:const t=n.body;return yd({output:e,parsedBody:t,errorCode:r})}},yd=dr(id),wd=async(e,t)=>{const n=Pr({}),r=e.body,s=Tr(r,{message:Bn});Object.assign(n,s);const o=new ad({$metadata:Ed(e),...n});return ur(o,e.body)},bd=async(e,t)=>{const n=Pr({}),r=e.body,s=Tr(r,{message:Bn});Object.assign(n,s);const o=new cd({$metadata:Ed(e),...n});return ur(o,e.body)},vd=async(e,t)=>{const n=Pr({}),r=e.body,s=Tr(r,{message:Bn});Object.assign(n,s);const o=new ld({$metadata:Ed(e),...n});return ur(o,e.body)},Sd=async(e,t)=>{const n=Pr({}),r=e.body,s=Tr(r,{message:Bn});Object.assign(n,s);const o=new ud({$metadata:Ed(e),...n});return ur(o,e.body)},Ed=e=>({httpStatusCode:e.statusCode,requestId:e.headers["x-amzn-requestid"]??e.headers["x-amzn-request-id"]??e.headers["x-amz-request-id"],extendedRequestId:e.headers["x-amz-id-2"],cfId:e.headers["x-amz-cf-id"]}),xd=e=>!(null==e||""===e||Object.getOwnPropertyNames(e).includes("length")&&0==e.length||Object.getOwnPropertyNames(e).includes("size")&&0==e.size),Ad="accountId",Pd="accessToken",Td="account_id",Id="roleName",Cd="role_name",kd="x-amz-sso_bearer_token";class _d extends(On.classBuilder().ep({..._u}).m((function(e,t,n,r){return[wt(n,this.serialize,this.deserialize),vt(n,e.getEndpointParameterInstructions())]})).s("SWBPortalService","GetRoleCredentials",{}).n("SSOClient","GetRoleCredentialsCommand").f(dd,hd).ser(fd).de(gd).build()){}var Rd=Object.freeze({__proto__:null,GetRoleCredentialsCommand:_d,SSOClient:class extends tn{constructor(...[e]){const t=sd(e||{});var n;const r=O((n=t,{...n,useDualstackEndpoint:n.useDualstackEndpoint??!1,useFipsEndpoint:n.useFipsEndpoint??!1,defaultSigningName:"awsssoportal"})),s=Kt(r),o=Ae(s),i=St(o);const a=((e,t)=>{const n={...la(e),...vr(e),...h(e),...od(e)};return t.forEach((e=>e.configure(n))),{...e,...ua(n),...Sr(n),...f(n),...(r=n,{httpAuthSchemes:r.httpAuthSchemes(),httpAuthSchemeProvider:r.httpAuthSchemeProvider(),credentials:r.credentials()})};var r})({...js(i)},e?.extensions||[]);super(a),this.config=a,this.middlewareStack.use(he(this.config)),this.middlewareStack.use(Lr(this.config)),this.middlewareStack.use(Yr(this.config)),this.middlewareStack.use(T(this.config)),this.middlewareStack.use(C(this.config)),this.middlewareStack.use(R(this.config)),this.middlewareStack.use(xt(this.config,{httpAuthSchemeParametersProvider:Cu,identityProviderConfigProvider:async e=>new zr({"aws.auth#sigv4":e.credentials})})),this.middlewareStack.use(Fr(this.config))}destroy(){super.destroy()}}});const Od=async(e,t,n)=>({operation:we(t).operation,region:await be(e.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});const $d=e=>{const t=[];switch(e.operation){case"AssumeRoleWithSAML":case"AssumeRoleWithWebIdentity":t.push({schemeId:"smithy.api#noAuth"});break;default:t.push(function(e){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"sts",region:e.region},propertiesExtractor:(e,t)=>({signingProperties:{config:e,context:t}})}}(e))}return t},Nd=e=>{const t=(n=e,{...n,stsClientCtor:Ep});var n;return{...js(t)}},Dd={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 jd="3.645.0";const Ld="required",Md="type",Ud="fn",Fd="argv",zd="ref",qd=!1,Wd=!0,Bd="booleanEquals",Hd="stringEquals",Vd="sigv4",Kd="us-east-1",Gd="endpoint",Xd="https://sts.{Region}.{PartitionResult#dnsSuffix}",Jd="tree",Yd="error",Zd="getAttr",Qd={[Ld]:!1,[Md]:"String"},ep={[Ld]:!0,default:!1,[Md]:"Boolean"},tp={[zd]:"Endpoint"},np={[Ud]:"isSet",[Fd]:[{[zd]:"Region"}]},rp={[zd]:"Region"},sp={[Ud]:"aws.partition",[Fd]:[rp],assign:"PartitionResult"},op={[zd]:"UseFIPS"},ip={[zd]:"UseDualStack"},ap={url:"https://sts.amazonaws.com",properties:{authSchemes:[{name:Vd,signingName:"sts",signingRegion:Kd}]},headers:{}},cp={},lp={conditions:[{[Ud]:Hd,[Fd]:[rp,"aws-global"]}],[Gd]:ap,[Md]:Gd},up={[Ud]:Bd,[Fd]:[op,!0]},dp={[Ud]:Bd,[Fd]:[ip,!0]},pp={[Ud]:Zd,[Fd]:[{[zd]:"PartitionResult"},"supportsFIPS"]},hp={[zd]:"PartitionResult"},fp={[Ud]:Bd,[Fd]:[!0,{[Ud]:Zd,[Fd]:[hp,"supportsDualStack"]}]},gp=[{[Ud]:"isSet",[Fd]:[tp]}],mp=[up],yp=[dp],wp={version:"1.0",parameters:{Region:Qd,UseDualStack:ep,UseFIPS:ep,Endpoint:Qd,UseGlobalEndpoint:ep},rules:[{conditions:[{[Ud]:Bd,[Fd]:[{[zd]:"UseGlobalEndpoint"},Wd]},{[Ud]:"not",[Fd]:gp},np,sp,{[Ud]:Bd,[Fd]:[op,qd]},{[Ud]:Bd,[Fd]:[ip,qd]}],rules:[{conditions:[{[Ud]:Hd,[Fd]:[rp,"ap-northeast-1"]}],endpoint:ap,[Md]:Gd},{conditions:[{[Ud]:Hd,[Fd]:[rp,"ap-south-1"]}],endpoint:ap,[Md]:Gd},{conditions:[{[Ud]:Hd,[Fd]:[rp,"ap-southeast-1"]}],endpoint:ap,[Md]:Gd},{conditions:[{[Ud]:Hd,[Fd]:[rp,"ap-southeast-2"]}],endpoint:ap,[Md]:Gd},lp,{conditions:[{[Ud]:Hd,[Fd]:[rp,"ca-central-1"]}],endpoint:ap,[Md]:Gd},{conditions:[{[Ud]:Hd,[Fd]:[rp,"eu-central-1"]}],endpoint:ap,[Md]:Gd},{conditions:[{[Ud]:Hd,[Fd]:[rp,"eu-north-1"]}],endpoint:ap,[Md]:Gd},{conditions:[{[Ud]:Hd,[Fd]:[rp,"eu-west-1"]}],endpoint:ap,[Md]:Gd},{conditions:[{[Ud]:Hd,[Fd]:[rp,"eu-west-2"]}],endpoint:ap,[Md]:Gd},{conditions:[{[Ud]:Hd,[Fd]:[rp,"eu-west-3"]}],endpoint:ap,[Md]:Gd},{conditions:[{[Ud]:Hd,[Fd]:[rp,"sa-east-1"]}],endpoint:ap,[Md]:Gd},{conditions:[{[Ud]:Hd,[Fd]:[rp,Kd]}],endpoint:ap,[Md]:Gd},{conditions:[{[Ud]:Hd,[Fd]:[rp,"us-east-2"]}],endpoint:ap,[Md]:Gd},{conditions:[{[Ud]:Hd,[Fd]:[rp,"us-west-1"]}],endpoint:ap,[Md]:Gd},{conditions:[{[Ud]:Hd,[Fd]:[rp,"us-west-2"]}],endpoint:ap,[Md]:Gd},{endpoint:{url:Xd,properties:{authSchemes:[{name:Vd,signingName:"sts",signingRegion:"{Region}"}]},headers:cp},[Md]:Gd}],[Md]:Jd},{conditions:gp,rules:[{conditions:mp,error:"Invalid Configuration: FIPS and custom endpoint are not supported",[Md]:Yd},{conditions:yp,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",[Md]:Yd},{endpoint:{url:tp,properties:cp,headers:cp},[Md]:Gd}],[Md]:Jd},{conditions:[np],rules:[{conditions:[sp],rules:[{conditions:[up,dp],rules:[{conditions:[{[Ud]:Bd,[Fd]:[Wd,pp]},fp],rules:[{endpoint:{url:"https://sts-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:cp,headers:cp},[Md]:Gd}],[Md]:Jd},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",[Md]:Yd}],[Md]:Jd},{conditions:mp,rules:[{conditions:[{[Ud]:Bd,[Fd]:[pp,Wd]}],rules:[{conditions:[{[Ud]:Hd,[Fd]:[{[Ud]:Zd,[Fd]:[hp,"name"]},"aws-us-gov"]}],endpoint:{url:"https://sts.{Region}.amazonaws.com",properties:cp,headers:cp},[Md]:Gd},{endpoint:{url:"https://sts-fips.{Region}.{PartitionResult#dnsSuffix}",properties:cp,headers:cp},[Md]:Gd}],[Md]:Jd},{error:"FIPS is enabled but this partition does not support FIPS",[Md]:Yd}],[Md]:Jd},{conditions:yp,rules:[{conditions:[fp],rules:[{endpoint:{url:"https://sts.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:cp,headers:cp},[Md]:Gd}],[Md]:Jd},{error:"DualStack is enabled but this partition does not support DualStack",[Md]:Yd}],[Md]:Jd},lp,{endpoint:{url:Xd,properties:cp,headers:cp},[Md]:Gd}],[Md]:Jd}],[Md]:Jd},{error:"Invalid Configuration: Missing Region",[Md]:Yd}]},bp=(e,t={})=>re(wp,{endpointParams:e,logger:t.logger});L.aws=ie;const vp=e=>{gr(process.version);const t=oa(e),n=()=>t().then(hr),r=(e=>({apiVersion:"2011-06-15",base64Decoder:e?.base64Decoder??an,base64Encoder:e?.base64Encoder??dn,disableHostPrefix:e?.disableHostPrefix??!1,endpointProvider:e?.endpointProvider??bp,extensions:e?.extensions??[],httpAuthSchemeProvider:e?.httpAuthSchemeProvider??$d,httpAuthSchemes:e?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4"),signer:new ss},{schemeId:"smithy.api#noAuth",identityProvider:e=>e.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new qr}],logger:e?.logger??new Xt,serviceId:e?.serviceId??"STS",urlParser:e?.urlParser??pt,utf8Decoder:e?.utf8Decoder??cn,utf8Encoder:e?.utf8Encoder??un}))(e);return Qr(process.version),{...r,...e,runtime:"node",defaultsMode:t,bodyLengthChecker:e?.bodyLengthChecker??_i,credentialDefaultProvider:e?.credentialDefaultProvider??Ai,defaultUserAgentProvider:e?.defaultUserAgentProvider??Ii({serviceId:r.serviceId,clientVersion:jd}),httpAuthSchemes:e?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4")||(async e=>await Ai(e?.__config||{})()),signer:new ss},{schemeId:"smithy.api#noAuth",identityProvider:e=>e.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new qr}],maxAttempts:e?.maxAttempts??ct(Vt),region:e?.region??ct(ve,Se),requestHandler:wn.create(e?.requestHandler??n),retryMode:e?.retryMode??ct({...Gt,default:async()=>(await n()).retryMode||It}),sha256:e?.sha256??Ci.bind(null,"sha256"),streamCollector:e?.streamCollector??vn,useDualstackEndpoint:e?.useDualstackEndpoint??ct(me),useFipsEndpoint:e?.useFipsEndpoint??ct(ye)}},Sp=e=>{const t=e.httpAuthSchemes;let n=e.httpAuthSchemeProvider,r=e.credentials;return{setHttpAuthScheme(e){const n=t.findIndex((t=>t.schemeId===e.schemeId));-1===n?t.push(e):t.splice(n,1,e)},httpAuthSchemes:()=>t,setHttpAuthSchemeProvider(e){n=e},httpAuthSchemeProvider:()=>n,setCredentials(e){r=e},credentials:()=>r}};class Ep extends tn{constructor(...[e]){const t=vp(e||{});var n;const r=O((n=t,{...n,useDualstackEndpoint:n.useDualstackEndpoint??!1,useFipsEndpoint:n.useFipsEndpoint??!1,useGlobalEndpoint:n.useGlobalEndpoint??!1,defaultSigningName:"sts"})),s=Kt(r),o=Ae(s),i=St(o),a=((e,t)=>{const n={...la(e),...vr(e),...h(e),...Sp(e)};return t.forEach((e=>e.configure(n))),{...e,...ua(n),...Sr(n),...f(n),...(r=n,{httpAuthSchemes:r.httpAuthSchemes(),httpAuthSchemeProvider:r.httpAuthSchemeProvider(),credentials:r.credentials()})};var r})(Nd(i),e?.extensions||[]);super(a),this.config=a,this.middlewareStack.use(he(this.config)),this.middlewareStack.use(Lr(this.config)),this.middlewareStack.use(Yr(this.config)),this.middlewareStack.use(T(this.config)),this.middlewareStack.use(C(this.config)),this.middlewareStack.use(R(this.config)),this.middlewareStack.use(xt(this.config,{httpAuthSchemeParametersProvider:Od,identityProviderConfigProvider:async e=>new zr({"aws.auth#sigv4":e.credentials})})),this.middlewareStack.use(Fr(this.config))}destroy(){super.destroy()}}class xp extends lr{constructor(e){super(e),Object.setPrototypeOf(this,xp.prototype)}}class Ap extends xp{constructor(e){super({name:"ExpiredTokenException",$fault:"client",...e}),this.name="ExpiredTokenException",this.$fault="client",Object.setPrototypeOf(this,Ap.prototype)}}class Pp extends xp{constructor(e){super({name:"MalformedPolicyDocumentException",$fault:"client",...e}),this.name="MalformedPolicyDocumentException",this.$fault="client",Object.setPrototypeOf(this,Pp.prototype)}}class Tp extends xp{constructor(e){super({name:"PackedPolicyTooLargeException",$fault:"client",...e}),this.name="PackedPolicyTooLargeException",this.$fault="client",Object.setPrototypeOf(this,Tp.prototype)}}class Ip extends xp{constructor(e){super({name:"RegionDisabledException",$fault:"client",...e}),this.name="RegionDisabledException",this.$fault="client",Object.setPrototypeOf(this,Ip.prototype)}}class Cp extends xp{constructor(e){super({name:"IDPRejectedClaimException",$fault:"client",...e}),this.name="IDPRejectedClaimException",this.$fault="client",Object.setPrototypeOf(this,Cp.prototype)}}class kp extends xp{constructor(e){super({name:"InvalidIdentityTokenException",$fault:"client",...e}),this.name="InvalidIdentityTokenException",this.$fault="client",Object.setPrototypeOf(this,kp.prototype)}}class _p extends xp{constructor(e){super({name:"IDPCommunicationErrorException",$fault:"client",...e}),this.name="IDPCommunicationErrorException",this.$fault="client",Object.setPrototypeOf(this,_p.prototype)}}class Rp extends xp{constructor(e){super({name:"InvalidAuthorizationMessageException",$fault:"client",...e}),this.name="InvalidAuthorizationMessageException",this.$fault="client",Object.setPrototypeOf(this,Rp.prototype)}}const Op=e=>({...e,...e.SecretAccessKey&&{SecretAccessKey:Nn}}),$p=e=>({...e,...e.Credentials&&{Credentials:Op(e.Credentials)}}),Np=e=>({...e,...e.WebIdentityToken&&{WebIdentityToken:Nn}}),Dp=e=>({...e,...e.Credentials&&{Credentials:Op(e.Credentials)}}),jp=async(e,t)=>{const n=bh;let r;return r=rf({...Xp(e),[Sh]:xh,[Zh]:vh}),wh(t,n,"/",void 0,r)},Lp=async(e,t)=>{const n=bh;let r;return r=rf({...Jp(e),[Sh]:Th,[Zh]:vh}),wh(t,n,"/",void 0,r)},Mp=async(e,t)=>{if(e.statusCode>=300)return Fp(e,t);const n=await li(e.body,t);let r={};r=oh(n.AssumeRoleResult);return{$metadata:mh(e),...r}},Up=async(e,t)=>{if(e.statusCode>=300)return Fp(e,t);const n=await li(e.body,t);let r={};r=ih(n.AssumeRoleWithWebIdentityResult);return{$metadata:mh(e),...r}},Fp=async(e,t)=>{const n={...e,body:await ui(e.body,t)},r=sf(e,n.body);switch(r){case"ExpiredTokenException":case"com.amazonaws.sts#ExpiredTokenException":throw await zp(n);case"MalformedPolicyDocument":case"com.amazonaws.sts#MalformedPolicyDocumentException":throw await Vp(n);case"PackedPolicyTooLarge":case"com.amazonaws.sts#PackedPolicyTooLargeException":throw await Kp(n);case"RegionDisabledException":case"com.amazonaws.sts#RegionDisabledException":throw await Gp(n);case"IDPRejectedClaim":case"com.amazonaws.sts#IDPRejectedClaimException":throw await Wp(n);case"InvalidIdentityToken":case"com.amazonaws.sts#InvalidIdentityTokenException":throw await Hp(n);case"IDPCommunicationError":case"com.amazonaws.sts#IDPCommunicationErrorException":throw await qp(n);case"InvalidAuthorizationMessageException":case"com.amazonaws.sts#InvalidAuthorizationMessageException":throw await Bp(n);default:const t=n.body;return yh({output:e,parsedBody:t.Error,errorCode:r})}},zp=async(e,t)=>{const n=e.body,r=ch(n.Error),s=new Ap({$metadata:mh(e),...r});return ur(s,n)},qp=async(e,t)=>{const n=e.body,r=lh(n.Error),s=new _p({$metadata:mh(e),...r});return ur(s,n)},Wp=async(e,t)=>{const n=e.body,r=uh(n.Error),s=new Cp({$metadata:mh(e),...r});return ur(s,n)},Bp=async(e,t)=>{const n=e.body,r=dh(n.Error),s=new Rp({$metadata:mh(e),...r});return ur(s,n)},Hp=async(e,t)=>{const n=e.body,r=ph(n.Error),s=new kp({$metadata:mh(e),...r});return ur(s,n)},Vp=async(e,t)=>{const n=e.body,r=hh(n.Error),s=new Pp({$metadata:mh(e),...r});return ur(s,n)},Kp=async(e,t)=>{const n=e.body,r=fh(n.Error),s=new Tp({$metadata:mh(e),...r});return ur(s,n)},Gp=async(e,t)=>{const n=e.body,r=gh(n.Error),s=new Ip({$metadata:mh(e),...r});return ur(s,n)},Xp=(e,t)=>{const n={};if(null!=e[qh]&&(n[qh]=e[qh]),null!=e[Wh]&&(n[Wh]=e[Wh]),null!=e[jh]){const t=Yp(e[jh]);0===e[jh]?.length&&(n.PolicyArns=[]),Object.entries(t).forEach((([e,t])=>{n[`PolicyArns.${e}`]=t}))}if(null!=e[Dh]&&(n[Dh]=e[Dh]),null!=e[Rh]&&(n[Rh]=e[Rh]),null!=e[Xh]){const t=rh(e[Xh]);0===e[Xh]?.length&&(n.Tags=[]),Object.entries(t).forEach((([e,t])=>{n[`Tags.${e}`]=t}))}if(null!=e[Yh]){const t=nh(e[Yh]);0===e[Yh]?.length&&(n.TransitiveTagKeys=[]),Object.entries(t).forEach((([e,t])=>{n[`TransitiveTagKeys.${e}`]=t}))}if(null!=e[$h]&&(n[$h]=e[$h]),null!=e[Kh]&&(n[Kh]=e[Kh]),null!=e[Jh]&&(n[Jh]=e[Jh]),null!=e[Vh]&&(n[Vh]=e[Vh]),null!=e[Mh]){const t=eh(e[Mh]);0===e[Mh]?.length&&(n.ProvidedContexts=[]),Object.entries(t).forEach((([e,t])=>{n[`ProvidedContexts.${e}`]=t}))}return n},Jp=(e,t)=>{const n={};if(null!=e[qh]&&(n[qh]=e[qh]),null!=e[Wh]&&(n[Wh]=e[Wh]),null!=e[ef]&&(n[ef]=e[ef]),null!=e[Uh]&&(n[Uh]=e[Uh]),null!=e[jh]){const t=Yp(e[jh]);0===e[jh]?.length&&(n.PolicyArns=[]),Object.entries(t).forEach((([e,t])=>{n[`PolicyArns.${e}`]=t}))}return null!=e[Dh]&&(n[Dh]=e[Dh]),null!=e[Rh]&&(n[Rh]=e[Rh]),n},Yp=(e,t)=>{const n={};let r=1;for(const t of e){if(null===t)continue;const e=Zp(t);Object.entries(e).forEach((([e,t])=>{n[`member.${r}.${e}`]=t})),r++}return n},Zp=(e,t)=>{const n={};return null!=e[tf]&&(n[tf]=e[tf]),n},Qp=(e,t)=>{const n={};return null!=e[Lh]&&(n[Lh]=e[Lh]),null!=e[_h]&&(n[_h]=e[_h]),n},eh=(e,t)=>{const n={};let r=1;for(const t of e){if(null===t)continue;const e=Qp(t);Object.entries(e).forEach((([e,t])=>{n[`member.${r}.${e}`]=t})),r++}return n},th=(e,t)=>{const n={};return null!=e[Nh]&&(n[Nh]=e[Nh]),null!=e[Qh]&&(n[Qh]=e[Qh]),n},nh=(e,t)=>{const n={};let r=1;for(const t of e)null!==t&&(n[`member.${r}`]=t,r++);return n},rh=(e,t)=>{const n={};let r=1;for(const t of e){if(null===t)continue;const e=th(t);Object.entries(e).forEach((([e,t])=>{n[`member.${r}.${e}`]=t})),r++}return n},sh=(e,t)=>{const n={};return null!=e[Ah]&&(n[Ah]=Bn(e[Ah])),null!=e[Ih]&&(n[Ih]=Bn(e[Ih])),n},oh=(e,t)=>{const n={};return null!=e[kh]&&(n[kh]=ah(e[kh])),null!=e[Ph]&&(n[Ph]=sh(e[Ph])),null!=e[Fh]&&(n[Fh]=Kn(e[Fh])),null!=e[Vh]&&(n[Vh]=Bn(e[Vh])),n},ih=(e,t)=>{const n={};return null!=e[kh]&&(n[kh]=ah(e[kh])),null!=e[Hh]&&(n[Hh]=Bn(e[Hh])),null!=e[Ph]&&(n[Ph]=sh(e[Ph])),null!=e[Fh]&&(n[Fh]=Kn(e[Fh])),null!=e[zh]&&(n[zh]=Bn(e[zh])),null!=e[Ch]&&(n[Ch]=Bn(e[Ch])),null!=e[Vh]&&(n[Vh]=Bn(e[Vh])),n},ah=(e,t)=>{const n={};return null!=e[Eh]&&(n[Eh]=Bn(e[Eh])),null!=e[Bh]&&(n[Bh]=Bn(e[Bh])),null!=e[Gh]&&(n[Gh]=Bn(e[Gh])),null!=e[Oh]&&(n[Oh]=qn((e=>{if(null==e)return;if("string"!=typeof e)throw new TypeError("RFC-3339 date-times must be expressed as strings");const t=er.exec(e);if(!t)throw new TypeError("Invalid RFC-3339 date-time value");const[n,r,s,o,i,a,c,l,u]=t,d=Gn(cr(r)),p=or(s,"month",1,12),h=or(o,"day",1,31),f=tr(d,p,h,{hours:i,minutes:a,seconds:c,fractionalMilliseconds:l});return"Z"!=u.toUpperCase()&&f.setTime(f.getTime()-ar(u)),f})(e[Oh]))),n},ch=(e,t)=>{const n={};return null!=e[nf]&&(n[nf]=Bn(e[nf])),n},lh=(e,t)=>{const n={};return null!=e[nf]&&(n[nf]=Bn(e[nf])),n},uh=(e,t)=>{const n={};return null!=e[nf]&&(n[nf]=Bn(e[nf])),n},dh=(e,t)=>{const n={};return null!=e[nf]&&(n[nf]=Bn(e[nf])),n},ph=(e,t)=>{const n={};return null!=e[nf]&&(n[nf]=Bn(e[nf])),n},hh=(e,t)=>{const n={};return null!=e[nf]&&(n[nf]=Bn(e[nf])),n},fh=(e,t)=>{const n={};return null!=e[nf]&&(n[nf]=Bn(e[nf])),n},gh=(e,t)=>{const n={};return null!=e[nf]&&(n[nf]=Bn(e[nf])),n},mh=e=>({httpStatusCode:e.statusCode,requestId:e.headers["x-amzn-requestid"]??e.headers["x-amzn-request-id"]??e.headers["x-amz-request-id"],extendedRequestId:e.headers["x-amz-id-2"],cfId:e.headers["x-amz-cf-id"]}),yh=dr(xp),wh=async(e,t,n,r,s)=>{const{hostname:o,protocol:i="https",port:a,path:c}=await e.endpoint(),l={protocol:i,hostname:o,port:a,method:"POST",path:c.endsWith("/")?c.slice(0,-1)+n:c+n,headers:t};return void 0!==s&&(l.body=s),new x(l)},bh={"content-type":"application/x-www-form-urlencoded"},vh="2011-06-15",Sh="Action",Eh="AccessKeyId",xh="AssumeRole",Ah="AssumedRoleId",Ph="AssumedRoleUser",Th="AssumeRoleWithWebIdentity",Ih="Arn",Ch="Audience",kh="Credentials",_h="ContextAssertion",Rh="DurationSeconds",Oh="Expiration",$h="ExternalId",Nh="Key",Dh="Policy",jh="PolicyArns",Lh="ProviderArn",Mh="ProvidedContexts",Uh="ProviderId",Fh="PackedPolicySize",zh="Provider",qh="RoleArn",Wh="RoleSessionName",Bh="SecretAccessKey",Hh="SubjectFromWebIdentityToken",Vh="SourceIdentity",Kh="SerialNumber",Gh="SessionToken",Xh="Tags",Jh="TokenCode",Yh="TransitiveTagKeys",Zh="Version",Qh="Value",ef="WebIdentityToken",tf="arn",nf="message",rf=e=>Object.entries(e).map((([e,t])=>Er(e)+"="+Er(t))).join("&"),sf=(e,t)=>void 0!==t.Error?.Code?t.Error.Code:404==e.statusCode?"NotFound":void 0;class of extends(On.classBuilder().ep({...Dd}).m((function(e,t,n,r){return[wt(n,this.serialize,this.deserialize),vt(n,e.getEndpointParameterInstructions())]})).s("AWSSecurityTokenServiceV20110615","AssumeRole",{}).n("STSClient","AssumeRoleCommand").f(void 0,$p).ser(jp).de(Mp).build()){}class af extends(On.classBuilder().ep({...Dd}).m((function(e,t,n,r){return[wt(n,this.serialize,this.deserialize),vt(n,e.getEndpointParameterInstructions())]})).s("AWSSecurityTokenServiceV20110615","AssumeRoleWithWebIdentity",{}).n("STSClient","AssumeRoleWithWebIdentityCommand").f(Np,Dp).ser(Lp).de(Up).build()){}const cf="us-east-1",lf=e=>{if("string"==typeof e?.Arn){const t=e.Arn.split(":");if(t.length>4&&""!==t[4])return t[4]}},uf=async(e,t,n)=>{const r="function"==typeof e?await e():e,s="function"==typeof t?await t():t;return n?.debug?.("@aws-sdk/client-sts::resolveRegion","accepting first of:",`${r} (provider)`,`${s} (parent client)`,`${cf} (STS default)`),r??s??cf},df=e=>"h2"===e?.metadata?.handlerProtocol,pf=(e,t)=>t?class extends e{constructor(e){super(e);for(const e of t)this.middlewareStack.use(e)}}:e;var hf=Object.freeze({__proto__:null,$Command:On,AssumeRoleCommand:of,AssumeRoleResponseFilterSensitiveLog:$p,AssumeRoleWithWebIdentityCommand:af,AssumeRoleWithWebIdentityRequestFilterSensitiveLog:Np,AssumeRoleWithWebIdentityResponseFilterSensitiveLog:Dp,CredentialsFilterSensitiveLog:Op,ExpiredTokenException:Ap,IDPCommunicationErrorException:_p,IDPRejectedClaimException:Cp,InvalidAuthorizationMessageException:Rp,InvalidIdentityTokenException:kp,MalformedPolicyDocumentException:Pp,PackedPolicyTooLargeException:Tp,RegionDisabledException:Ip,STSClient:Ep,STSServiceException:xp,__Client:tn,getDefaultRoleAssumer:(e={},t)=>((e,t)=>{let n,r;return async(s,o)=>{if(r=s,!n){const{logger:s=e?.parentClientConfig?.logger,region:o,requestHandler:i=e?.parentClientConfig?.requestHandler,credentialProviderLogger:a}=e,c=await uf(o,e?.parentClientConfig?.region,a),l=!df(i);n=new t({credentialDefaultProvider:()=>async()=>r,region:c,requestHandler:l?i:void 0,logger:s})}const{Credentials:i,AssumedRoleUser:a}=await n.send(new of(o));if(!i||!i.AccessKeyId||!i.SecretAccessKey)throw new Error(`Invalid response from STS.assumeRole call with role ${o.RoleArn}`);const c=lf(a);return{accessKeyId:i.AccessKeyId,secretAccessKey:i.SecretAccessKey,sessionToken:i.SessionToken,expiration:i.Expiration,...i.CredentialScope&&{credentialScope:i.CredentialScope},...c&&{accountId:c}}}})(e,pf(Ep,t)),getDefaultRoleAssumerWithWebIdentity:(e={},t)=>((e,t)=>{let n;return async r=>{if(!n){const{logger:r=e?.parentClientConfig?.logger,region:s,requestHandler:o=e?.parentClientConfig?.requestHandler,credentialProviderLogger:i}=e,a=await uf(s,e?.parentClientConfig?.region,i),c=!df(o);n=new t({region:a,requestHandler:c?o:void 0,logger:r})}const{Credentials:s,AssumedRoleUser:o}=await n.send(new af(r));if(!s||!s.AccessKeyId||!s.SecretAccessKey)throw new Error(`Invalid response from STS.assumeRoleWithWebIdentity call with role ${r.RoleArn}`);const i=lf(o);return{accessKeyId:s.AccessKeyId,secretAccessKey:s.SecretAccessKey,sessionToken:s.SessionToken,expiration:s.Expiration,...s.CredentialScope&&{credentialScope:s.CredentialScope},...i&&{accountId:i}}}})(e,pf(Ep,t))});exports.Cache=ic,exports.default=uc,exports.engines=rc,exports.translator=lc;
|
|
2
|
-
//# sourceMappingURL=index.min.cjs.map
|