@yxw007/translate 0.0.1-alpha.3 → 0.0.2
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.md +46 -15
- package/README_zh-CN.md +44 -14
- 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.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{Buffer as e}from"buffer";import{Readable as t,Writable as n}from"stream";import{Agent as r,request as o}from"http";import{Agent as s,request as i}from"https";import"http2";import{TextDecoder as a,promisify as c}from"util";import{homedir as l,platform as u,release as d}from"os";import{sep as p,join as h}from"path";import{createHash as f,createHmac as g}from"crypto";import{promises as m,lstatSync as y,fstatSync as w,readFileSync as b}from"fs";import{parse as v}from"url";import S from"fs/promises";import{exec as E}from"child_process";import{versions as x,env as A}from"process";const P=e=>{let t=e.httpHandler;return{setHttpHandler(e){t=e},httpHandler:()=>t,updateHttpClientConfig(e,n){t.updateHttpClientConfig(e,n)},httpHandlerConfigs:()=>t.httpHandlerConfigs()}},T=e=>({httpHandler:e.httpHandler()});var I,C,k,_,R;!function(e){e.HEADER="header",e.QUERY="query"}(I||(I={})),function(e){e.HEADER="header",e.QUERY="query"}(C||(C={})),function(e){e.HTTP="http",e.HTTPS="https"}(k||(k={})),function(e){e.MD5="md5",e.CRC32="crc32",e.CRC32C="crc32c",e.SHA1="sha1",e.SHA256="sha256"}(_||(_={})),function(e){e[e.HEADER=0]="HEADER",e[e.TRAILER=1]="TRAILER"}(R||(R={}));const O="__smithy_context";var $,N;!function(e){e.PROFILE="profile",e.SSO_SESSION="sso-session",e.SERVICES="services"}($||($={})),function(e){e.HTTP_0_9="http/0.9",e.HTTP_1_0="http/1.0",e.TDS_8_0="tds/8.0"}(N||(N={}));class D{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 D({...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 D.clone(this)}}class j{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 L={name:"hostHeaderMiddleware",step:"build",priority:"low",tags:["HOST"],override:!0},M=e=>({applyToStack:t=>{t.add((e=>t=>async n=>{if(!D.isInstance(n.request))return t(n);const{request:r}=n,{handlerProtocol:o=""}=e.requestHandler.metadata||{};if(o.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),L)}}),U={name:"loggerMiddleware",tags:["LOGGER"],step:"initialize",override:!0},F=e=>({applyToStack:e=>{e.add(((e,t)=>async n=>{try{const r=await e(n),{clientName:o,commandName:s,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:o,commandName:s,input:u(n.input),output:d(h),metadata:p}),r}catch(e){const{clientName:r,commandName:o,logger:s,dynamoDbDocumentClientOptions:i={}}=t,{overrideInputFilterSensitiveLog:a}=i,c=a??t.inputFilterSensitiveLog;throw s?.error?.({clientName:r,commandName:o,input:c(n.input),error:e,metadata:e.$metadata}),e}}),U)}}),z="X-Amzn-Trace-Id",q={step:"build",tags:["RECURSION_DETECTION"],name:"recursionDetectionMiddleware",override:!0,priority:"low"},W=e=>({applyToStack:t=>{t.add((e=>t=>async n=>{const{request:r}=n;if(!D.isInstance(r)||"node"!==e.runtime||r.headers.hasOwnProperty(z))return t(n);const o=process.env.AWS_LAMBDA_FUNCTION_NAME,s=process.env._X_AMZN_TRACE_ID,i=e=>"string"==typeof e&&e.length>0;return i(o)&&i(s)&&(r.headers[z]=s),t({...n,request:r})})(e),q)}});function B(e){return{...e,customUserAgent:"string"==typeof e.customUserAgent?[[e.customUserAgent]]:e.customUserAgent}}const H=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}$"),V=e=>H.test(e)||e.startsWith("[")&&e.endsWith("]"),K=new RegExp("^(?!.*-$)(?!-)[a-zA-Z0-9-]{1,63}$"),G=(e,t=!1)=>{if(!t)return K.test(e);const n=e.split(".");for(const e of n)if(!G(e))return!1;return!0},X={},J="endpoints";function Y(e){return"object"!=typeof e||null==e?e:"ref"in e?`$${Y(e.ref)}`:"fn"in e?`${e.fn}(${(e.argv||[]).map(Y).join(", ")})`:JSON.stringify(e,null,2)}class Z extends Error{constructor(e){super(e),this.name="EndpointError"}}const Q=(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 Z(`Path: '${e}' does not end with ']'`);const o=r.slice(t+1,-1);if(Number.isNaN(parseInt(o)))throw new Z(`Invalid array index: '${o}' in path: '${e}'`);0!==t&&n.push(r.slice(0,t)),n.push(o)}else n.push(r)}return n})(t).reduce(((n,r)=>{if("object"!=typeof n)throw new Z(`Index '${r}' in '${t}' not found in '${JSON.stringify(e)}'`);return Array.isArray(n)?n[parseInt(r)]:n[r]}),e),ee={[k.HTTP]:80,[k.HTTPS]:443},te={booleanEquals:(e,t)=>e===t,getAttr:Q,isSet:e=>null!=e,isValidHostLabel:G,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:o="",query:s={}}=e,i=new URL(`${r}//${t}${n?`:${n}`:""}${o}`);return i.search=Object.entries(s).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:o,pathname:s,protocol:i,search:a}=t;if(a)return null;const c=i.slice(0,-1);if(!Object.values(k).includes(c))return null;const l=V(o);return{scheme:c,authority:`${r}${n.includes(`${r}:${ee[c]}`)||"string"==typeof e&&e.includes(`${r}:${ee[c]}`)?`:${ee[c]}`:""}`,path:s,normalizedPath:s.endsWith("/")?s:`${s}/`,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()}`))},ne=(e,t)=>{const n=[],r={...t.endpointParams,...t.referenceRecord};let o=0;for(;o<e.length;){const t=e.indexOf("{",o);if(-1===t){n.push(e.slice(o));break}n.push(e.slice(o,t));const s=e.indexOf("}",t);if(-1===s){n.push(e.slice(t));break}"{"===e[t+1]&&"}"===e[s+1]&&(n.push(e.slice(t+1,s)),o=s+2);const i=e.substring(t+1,s);if(i.includes("#")){const[e,t]=i.split("#");n.push(Q(r[e],t))}else n.push(r[i]);o=s+1}return n.join("")},re=(e,t,n)=>{if("string"==typeof e)return ne(e,n);if(e.fn)return oe(e,n);if(e.ref)return(({ref:e},t)=>({...t.endpointParams,...t.referenceRecord}[e]))(e,n);throw new Z(`'${t}': ${String(e)} is not a string, function or reference.`)},oe=({fn:e,argv:t},n)=>{const r=t.map((e=>["boolean","number"].includes(typeof e)?e:re(e,"arg",n))),o=e.split(".");return o[0]in X&&null!=o[1]?X[o[0]][o[1]](...r):te[e](...r)},se=({assign:e,...t},n)=>{if(e&&e in n.referenceRecord)throw new Z(`'${e}' is already defined in Reference Record.`);const r=oe(t,n);return n.logger?.debug?.(`${J} evaluateCondition: ${Y(t)} = ${Y(r)}`),{result:""===r||!!r,...null!=e&&{toAssign:{name:e,value:r}}}},ie=(e=[],t)=>{const n={};for(const r of e){const{result:e,toAssign:o}=se(r,{...t,referenceRecord:{...t.referenceRecord,...n}});if(!e)return{result:e};o&&(n[o.name]=o.value,t.logger?.debug?.(`${J} assign: ${o.name} := ${Y(o.value)}`))}return{result:!0,referenceRecord:n}},ae=(e,t)=>Object.entries(e).reduce(((e,[n,r])=>({...e,[n]:r.map((e=>{const r=re(e,"Header value entry",t);if("string"!=typeof r)throw new Z(`Header '${n}' value '${r}' is not a string`);return r}))})),{}),ce=(e,t)=>{if(Array.isArray(e))return e.map((e=>ce(e,t)));switch(typeof e){case"string":return ne(e,t);case"object":if(null===e)throw new Z(`Unexpected endpoint property: ${e}`);return le(e,t);case"boolean":return e;default:throw new Z("Unexpected endpoint property type: "+typeof e)}},le=(e,t)=>Object.entries(e).reduce(((e,[n,r])=>({...e,[n]:ce(r,t)})),{}),ue=(e,t)=>{const n=re(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 Z("Endpoint URL must be a string, got "+typeof n)},de=(e,t)=>{const{conditions:n,endpoint:r}=e,{result:o,referenceRecord:s}=ie(n,t);if(!o)return;const i={...t,referenceRecord:{...t.referenceRecord,...s}},{url:a,properties:c,headers:l}=r;return t.logger?.debug?.(`${J} Resolving endpoint from template: ${Y(r)}`),{...null!=l&&{headers:ae(l,i)},...null!=c&&{properties:le(c,i)},url:ue(a,i)}},pe=(e,t)=>{const{conditions:n,error:r}=e,{result:o,referenceRecord:s}=ie(n,t);if(o)throw new Z(re(r,"Error",{...t,referenceRecord:{...t.referenceRecord,...s}}))},he=(e,t)=>{const{conditions:n,rules:r}=e,{result:o,referenceRecord:s}=ie(n,t);if(o)return fe(r,{...t,referenceRecord:{...t.referenceRecord,...s}})},fe=(e,t)=>{for(const n of e)if("endpoint"===n.type){const e=de(n,t);if(e)return e}else if("error"===n.type)pe(n,t);else{if("tree"!==n.type)throw new Z(`Unknown endpoint rule: ${n}`);{const e=he(n,t);if(e)return e}}throw new Z("Rules evaluation failed")},ge=(e,t)=>{const{endpointParams:n,logger:r}=t,{parameters:o,rules:s}=e;t.logger?.debug?.(`${J} Initial EndpointParams: ${Y(n)}`);const i=Object.entries(o).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(o).filter((([,e])=>e.required)).map((([e])=>e));for(const e of a)if(null==n[e])throw new Z(`Missing required parameter: '${e}'`);const c=fe(s,{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?.(`${J} Resolved endpoint: ${Y(c)}`),c},me=(e,t=!1)=>{if(t){for(const t of e.split("."))if(!me(t))return!1;return!0}return!!G(e)&&(!(e.length<3||e.length>63)&&(e===e.toLowerCase()&&!V(e)))};let ye={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 we={isVirtualHostableS3Bucket:me,parseArn:e=>{const t=e.split(":");if(t.length<6)return null;const[n,r,o,s,i,...a]=t;if("arn"!==n||""===r||""===o||""===a.join(":"))return null;return{partition:r,service:o,region:s,accountId:i,resourceId:a.map((e=>e.split("/"))).flat()}},partition:e=>{const{partitions:t}=ye;for(const n of t){const{regions:t,outputs:r}=n;for(const[n,o]of Object.entries(t))if(n===e)return{...r,...o}}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}}};X.aws=we;const be="user-agent",ve="x-amz-user-agent",Se=/[^\!\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w]/g,Ee=/[^\!\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w\#]/g,xe=e=>{const t=e[0].split("/").map((e=>e.replace(Se,"-"))).join("/"),n=e[1]?.replace(Ee,"-"),r=t.indexOf("/"),o=t.substring(0,r);let s=t.substring(r+1);return"api"===o&&(s=s.toLowerCase()),[o,s,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}`}}),"")},Ae={name:"getUserAgentMiddleware",step:"build",priority:"low",tags:["SET_USER_AGENT","USER_AGENT"],override:!0},Pe=e=>({applyToStack:t=>{var n;t.add((n=e,(e,t)=>async r=>{const{request:o}=r;if(!D.isInstance(o))return e(r);const{headers:s}=o,i=t?.userAgent?.map(xe)||[],a=(await n.defaultUserAgentProvider()).map(xe),c=n?.customUserAgent?.map(xe)||[],l=[].concat([...a,...i,...c]).join(" "),u=[...a.filter((e=>e.startsWith("aws-sdk-"))),...c].join(" ");return"browser"!==n.runtime?(u&&(s[ve]=s[ve]?`${s[be]} ${u}`:u),s[be]=l):s[ve]=l,e({...r,request:o})}),Ae)}}),Te=(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 Ie;!function(e){e.ENV="env",e.CONFIG="shared config entry"}(Ie||(Ie={}));const Ce={environmentVariableSelector:e=>Te(e,"AWS_USE_DUALSTACK_ENDPOINT",Ie.ENV),configFileSelector:e=>Te(e,"use_dualstack_endpoint",Ie.CONFIG),default:!1},ke={environmentVariableSelector:e=>Te(e,"AWS_USE_FIPS_ENDPOINT",Ie.ENV),configFileSelector:e=>Te(e,"use_fips_endpoint",Ie.CONFIG),default:!1},_e=e=>e[O]||(e[O]={}),Re=e=>{if("function"==typeof e)return e;const t=Promise.resolve(e);return()=>t},Oe={environmentVariableSelector:e=>e.AWS_REGION,configFileSelector:e=>e.region,default:()=>{throw new Error("Region is missing")}},$e={preferredFile:"credentials"},Ne=e=>"string"==typeof e&&(e.startsWith("fips-")||e.endsWith("-fips")),De=e=>Ne(e)?["fips-aws-global","aws-fips"].includes(e)?"us-east-1":e.replace(/fips-(dkr-|prod-)?|-fips/,""):e,je=e=>{const{region:t,useFipsEndpoint:n}=e;if(!t)throw new Error("Region is missing");return{...e,region:async()=>{if("string"==typeof t)return De(t);const e=await t();return De(e)},useFipsEndpoint:async()=>{const e="string"==typeof t?t:await t();return!!Ne(e)||("function"!=typeof n?Promise.resolve(!!n):n())}}};const Le=(e,t)=>(n,r)=>async o=>{const s=e.httpAuthSchemeProvider(await t.httpAuthSchemeParametersProvider(e,r,o.input)),i=function(e){const t=new Map;for(const n of e)t.set(n.schemeId,n);return t}(e.httpAuthSchemes),a=_e(r),c=[];for(const n of s){const o=i.get(n.schemeId);if(!o){c.push(`HttpAuthScheme \`${n.schemeId}\` was not enabled for this service.`);continue}const s=o.identityProvider(await t.identityProviderConfigProvider(e));if(!s){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 s(n.identityProperties),signer:o.signer};break}if(!a.selectedHttpAuthScheme)throw new Error(c.join("\n"));return n(o)},Me=/^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/,Ue=/(\d+\.){3}\d+/,Fe=/\.\./,ze=e=>Me.test(e)&&!Ue.test(e)&&!Fe.test(e),qe=e=>{const[t,n,r,,,o]=e.split(":"),s="arn"===t&&e.split(":").length>=6,i=Boolean(s&&n&&r&&o);if(s&&!i)throw new Error(`Invalid ARN: ${e} was an invalid ARN.`);return i},We=(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:o}=e;return`${t}//${n}${r?":"+r:""}${o}`}}return e}:r};class Be 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,Be.prototype),n?.debug?.(`@smithy/property-provider ${r?"->":"(!)"} ${e}`)}static from(e,t=!0){return Object.assign(new this(e.message,t),e)}}class He extends Be{constructor(e,t=!0){super(e,t),this.name="CredentialsProviderError",Object.setPrototypeOf(this,He.prototype)}}class Ve extends Be{constructor(e,t=!0){super(e,t),this.name="TokenProviderError",Object.setPrototypeOf(this,Ve.prototype)}}const Ke=(...e)=>async()=>{if(0===e.length)throw new Be("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},Ge=(e,t,n)=>{let r,o,s,i=!1;const a=async()=>{o||(o=e());try{r=await o,s=!0,i=!1}finally{o=void 0}return r};return void 0===t?async e=>(s&&!e?.forceRefresh||(r=await a()),r):async e=>(s&&!e?.forceRefresh||(r=await a()),i?r:n&&!n(r)?(i=!0,r):t(r)?(await a(),r):r)};function Xe(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 Je={},Ye=()=>{const{HOME:e,USERPROFILE:t,HOMEPATH:n,HOMEDRIVE:r=`C:${p}`}=process.env;if(e)return e;if(t)return t;if(n)return`${r}${n}`;const o=process&&process.geteuid?`${process.geteuid()}`:"DEFAULT";return Je[o]||(Je[o]=l()),Je[o]},Ze="AWS_PROFILE",Qe=e=>e.profile||process.env[Ze]||"default",et=e=>{const t=f("sha1").update(e).digest("hex");return h(Ye(),".aws","sso","cache",`${t}.json`)},{readFile:tt}=m,nt=async e=>{const t=et(e),n=await tt(t,"utf8");return JSON.parse(n)},rt=e=>Object.entries(e).filter((([e])=>{const t=e.indexOf(ht);return-1!==t&&Object.values($).includes(e.substring(0,t))})).reduce(((e,[t,n])=>{const r=t.indexOf(ht);return e[t.substring(0,r)===$.PROFILE?t.substring(r+1):t]=n,e}),{...e.default&&{default:e.default}}),ot=()=>process.env.AWS_CONFIG_FILE||h(Ye(),".aws","config"),st=()=>process.env.AWS_SHARED_CREDENTIALS_FILE||h(Ye(),".aws","credentials"),it=/^([\w-]+)\s(["'])?([\w-@\+\.%:/]+)\2$/,at=["__proto__","profile __proto__"],ct=e=>{const t={};let n,r;for(const o of e.split(/\r?\n/)){const e=o.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),o=it.exec(t);if(o){const[,e,,t]=o;Object.values($).includes(e)&&(n=[e,t].join(ht))}else n=t;if(at.includes(t))throw new Error(`Found invalid profile name "${t}"`)}else if(n){const s=e.indexOf("=");if(![0,-1].includes(s)){const[i,a]=[e.substring(0,s).trim(),e.substring(s+1).trim()];if(""===a)r=i;else{r&&o.trimStart()===o&&(r=void 0),t[n]=t[n]||{};const e=r?[r,i].join(ht):i;t[n][e]=a}}}}return t},{readFile:lt}=m,ut={},dt=(e,t)=>(ut[e]&&!t?.ignoreCache||(ut[e]=lt(e,"utf8")),ut[e]),pt=()=>({}),ht=".",ft=async(e={})=>{const{filepath:t=st(),configFilepath:n=ot()}=e,r=Ye();let o=t;t.startsWith("~/")&&(o=h(r,t.slice(2)));let s=n;n.startsWith("~/")&&(s=h(r,n.slice(2)));const i=await Promise.all([dt(s,{ignoreCache:e.ignoreCache}).then(ct).then(rt).catch(pt),dt(o,{ignoreCache:e.ignoreCache}).then(ct).catch(pt)]);return{configFile:i[0],credentialsFile:i[1]}},gt=e=>Object.entries(e).filter((([e])=>e.startsWith($.SSO_SESSION+ht))).reduce(((e,[t,n])=>({...e,[t.substring(t.indexOf(ht)+1)]:n})),{}),mt=()=>({}),yt=async(e={})=>dt(e.configFilepath??ot()).then(ct).then(gt).catch(mt),wt=async e=>{const t=await ft(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)},bt=e=>{return"function"==typeof e?async()=>await e():(t=e,()=>Promise.resolve(t));var t},vt=({environmentVariableSelector:e,configFileSelector:t,default:n},r={})=>Ge(Ke(((e,t)=>async()=>{try{const t=e(process.env);if(void 0===t)throw new Error;return t}catch(n){throw new He(n.message||`Not found in ENV: ${Xe(e.toString())}`,{logger:t})}})(e),((e,{preferredFile:t="config",...n}={})=>async()=>{const r=Qe(n),{configFile:o,credentialsFile:s}=await ft(n),i=s[r]||{},a=o[r]||{},c="config"===t?{...i,...a}:{...a,...i};try{const n=e(c,"config"===t?o:s);if(void 0===n)throw new Error;return n}catch(t){throw new He(t.message||`Not found in config files w/ profile [${r}]: ${Xe(e.toString())}`,{logger:n.logger})}})(t,r),bt(n))),St="AWS_ENDPOINT_URL",Et="endpoint_url",xt=async e=>vt((e=>({environmentVariableSelector:t=>{const n=e.split(" ").map((e=>e.toUpperCase())),r=t[[St,...n].join("_")];if(r)return r;return t[St]||void 0},configFileSelector:(t,n)=>{if(n&&t.services){const r=n[["services",t.services].join(ht)];if(r){const t=e.split(" ").map((e=>e.toLowerCase())),n=r[[t.join("_"),Et].join(ht)];if(n)return n}}const r=t[Et];if(r)return r},default:void 0}))(e))();const At=e=>{if("string"==typeof e)return At(new URL(e));const{hostname:t,pathname:n,port:r,protocol:o,search:s}=e;let i;return s&&(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}(s)),{hostname:t,port:r?parseInt(r):void 0,protocol:o,path:n,query:i}},Pt=e=>"object"==typeof e?"url"in e?At(e.url):e:At(e),Tt=async(e,t,n)=>{const r={},o=t?.getEndpointParameterInstructions?.()||{};for(const[t,s]of Object.entries(o))switch(s.type){case"staticContextParams":r[t]=s.value;break;case"contextParams":r[t]=e[s.name];break;case"clientContextParams":case"builtInParams":r[t]=await We(s.name,t,n)();break;default:throw new Error("Unrecognized endpoint parameter instruction: "+JSON.stringify(s))}return 0===Object.keys(o).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("?"))),qe(t)){if(!0===e.ForcePathStyle)throw new Error("Path-style addressing cannot be used with ARN buckets")}else(!ze(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},It=({config:e,instructions:t})=>(n,r)=>async o=>{const s=await(async(e,t,n,r)=>{if(!n.endpoint){const e=await xt(n.serviceId||"");e&&(n.endpoint=()=>Promise.resolve(Pt(e)))}const o=await Tt(e,t,n);if("function"!=typeof n.endpointProvider)throw new Error("config.endpointProvider is not set.");return n.endpointProvider(o,r)})(o.input,{getEndpointParameterInstructions:()=>t},{...e},r);r.endpointV2=s,r.authSchemes=s.properties?.authSchemes;const i=r.authSchemes?.[0];if(i){r.signing_region=i.signingRegion,r.signing_service=i.signingName;const e=_e(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({...o})},Ct={name:"deserializerMiddleware",step:"deserialize",tags:["DESERIALIZER"],override:!0},kt={name:"serializerMiddleware",step:"serialize",tags:["SERIALIZER"],override:!0};function _t(e,t,n){return{applyToStack:r=>{r.add(((e,t)=>n=>async r=>{const{response:o}=await n(r);try{return{response:o,output:await t(o,e)}}catch(e){if(Object.defineProperty(e,"$response",{value:o}),!("$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),Ct),r.add(((e,t)=>(n,r)=>async o=>{const s=r.endpointV2?.url&&e.urlParser?async()=>e.urlParser(r.endpointV2.url):e.endpoint;if(!s)throw new Error("No valid endpoint provider available.");const i=await t(o.input,{...e,endpoint:s});return n({...o,request:i})})(e,t),kt)}}}const Rt={step:"serialize",tags:["ENDPOINT_PARAMETERS","ENDPOINT_V2","ENDPOINT"],name:"endpointV2Middleware",override:!0,relation:"before",toMiddleware:kt.name},Ot=(e,t)=>({applyToStack:n=>{n.addRelativeTo(It({config:e,instructions:t}),Rt)}}),$t=e=>{const t=e.tls??!0,{endpoint:n}=e,r=null!=n?async()=>Pt(await Re(n)()):void 0,o=!!n;return{...e,endpoint:r,tls:t,isCustomEndpoint:o,useDualstackEndpoint:Re(e.useDualstackEndpoint??!1),useFipsEndpoint:Re(e.useFipsEndpoint??!1)}},Nt={step:"serialize",tags:["HTTP_AUTH_SCHEME"],name:"httpAuthSchemeMiddleware",override:!0,relation:"before",toMiddleware:Rt.name},Dt=(e,{httpAuthSchemeParametersProvider:t,identityProviderConfigProvider:n})=>({applyToStack:r=>{r.addRelativeTo(Le(e,{httpAuthSchemeParametersProvider:t,identityProviderConfigProvider:n}),Nt)}}),jt=e=>e=>{throw e},Lt=(e,t)=>{};var Mt;!function(e){e.STANDARD="standard",e.ADAPTIVE="adaptive"}(Mt||(Mt={}));const Ut=Mt.STANDARD,Ft=["BandwidthLimitExceeded","EC2ThrottledException","LimitExceededException","PriorRequestNotComplete","ProvisionedThroughputExceededException","RequestLimitExceeded","RequestThrottled","RequestThrottledException","SlowDown","ThrottledException","Throttling","ThrottlingException","TooManyRequestsException","TransactionInProgressException"],zt=["TimeoutError","RequestTimeout","RequestTimeoutException"],qt=[500,502,503,504],Wt=["ECONNRESET","ECONNREFUSED","EPIPE","ETIMEDOUT"],Bt=e=>429===e.$metadata?.httpStatusCode||Ft.includes(e.name)||1==e.$retryable?.throttling,Ht=e=>(e=>e.$metadata?.clockSkewCorrected)(e)||zt.includes(e.name)||Wt.includes(e?.code||"")||qt.includes(e.$metadata?.httpStatusCode||0);class Vt{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(),Bt(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 Kt=({retryDelay:e,retryCount:t,retryCost:n})=>({getRetryCount:()=>t,getRetryDelay:()=>Math.min(2e4,e),getRetryCost:()=>n});class Gt{constructor(e){this.maxAttempts=e,this.mode=Mt.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 Kt({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()),o=t.retryAfterHint?Math.max(t.retryAfterHint.getTime()-Date.now()||0,r):r,s=this.getCapacityCost(n);return this.capacity-=s,Kt({retryDelay:o,retryCount:e.getRetryCount()+1,retryCost:s})}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 Xt{constructor(e,t){this.maxAttemptsProvider=e,this.mode=Mt.ADAPTIVE;const{rateLimiter:n}=t??{};this.rateLimiter=n??new Vt,this.standardRetryStrategy=new Gt(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 Jt;const Yt=new Uint8Array(16);function Zt(){if(!Jt&&(Jt="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Jt))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Jt(Yt)}const Qt=[];for(let e=0;e<256;++e)Qt.push((e+256).toString(16).slice(1));var en={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function tn(e,t,n){if(en.randomUUID&&!t&&!e)return en.randomUUID();const r=(e=e||{}).random||(e.rng||Zt)();return r[6]=15&r[6]|64,r[8]=63&r[8]|128,function(e,t=0){return Qt[e[t+0]]+Qt[e[t+1]]+Qt[e[t+2]]+Qt[e[t+3]]+"-"+Qt[e[t+4]]+Qt[e[t+5]]+"-"+Qt[e[t+6]]+Qt[e[t+7]]+"-"+Qt[e[t+8]]+Qt[e[t+9]]+"-"+Qt[e[t+10]]+Qt[e[t+11]]+Qt[e[t+12]]+Qt[e[t+13]]+Qt[e[t+14]]+Qt[e[t+15]]}(r)}const nn="AWS_MAX_ATTEMPTS",rn="max_attempts",on={environmentVariableSelector:e=>{const t=e[nn];if(!t)return;const n=parseInt(t);if(Number.isNaN(n))throw new Error(`Environment variable ${nn} mast be a number, got "${t}"`);return n},configFileSelector:e=>{const t=e[rn];if(!t)return;const n=parseInt(t);if(Number.isNaN(n))throw new Error(`Shared config file entry ${rn} mast be a number, got "${t}"`);return n},default:3},sn=e=>{const{retryStrategy:t}=e,n=Re(e.maxAttempts??3);return{...e,maxAttempts:n,retryStrategy:async()=>{if(t)return t;return await Re(e.retryMode)()===Mt.ADAPTIVE?new Xt(n):new Gt(n)}}},an={environmentVariableSelector:e=>e.AWS_RETRY_MODE,configFileSelector:e=>e.retry_mode,default:Ut};class cn{trace(){}debug(){}info(){}warn(){}error(){}}const ln=(e,t)=>{const n=[];if(e&&n.push(e),t)for(const e of t)n.push(e);return n},un=(e,t)=>`${e||"anonymous"}${t&&t.length>0?` (a.k.a. ${t.join(",")})`:""}`,dn=()=>{let e=[],t=[],n=!1;const r=new Set,o=n=>(e.forEach((e=>{n.add(e.middleware,{...e})})),t.forEach((e=>{n.addRelativeTo(e.middleware,{...e})})),n.identifyOnResolve?.(a.identifyOnResolve()),n),s=e=>{const t=[];return e.before.forEach((e=>{0===e.before.length&&0===e.after.length?t.push(e):t.push(...s(e))})),t.push(e),e.after.reverse().forEach((e=>{0===e.before.length&&0===e.after.length?t.push(e):t.push(...s(e))})),t},i=(n=!1)=>{const r=[],o=[],i={};e.forEach((e=>{const t={...e,before:[],after:[]};for(const e of ln(t.name,t.aliases))i[e]=t;r.push(t)})),t.forEach((e=>{const t={...e,before:[],after:[]};for(const e of ln(t.name,t.aliases))i[e]=t;o.push(t)})),o.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 ${un(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)=>pn[t.step]-pn[e.step]||hn[t.priority||"normal"]-hn[e.priority||"normal"]))).map(s).reduce(((e,t)=>(e.push(...t),e)),[]);var c;return a},a={add:(t,n={})=>{const{name:o,override:s,aliases:i}=n,a={step:"initialize",priority:"normal",middleware:t,...n},c=ln(o,i);if(c.length>0){if(c.some((e=>r.has(e)))){if(!s)throw new Error(`Duplicate middleware name '${un(o,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(`"${un(r.name,r.aliases)}" middleware with ${r.priority} priority in ${r.step} step cannot be overridden by "${un(o,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:o,override:s,aliases:i}=n,a={middleware:e,...n},c=ln(o,i);if(c.length>0){if(c.some((e=>r.has(e)))){if(!s)throw new Error(`Duplicate middleware name '${un(o,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(`"${un(r.name,r.aliases)}" middleware ${r.relation} "${r.toMiddleware}" middleware cannot be overridden by "${un(o,i)}" middleware ${a.relation} "${a.toMiddleware}" middleware.`);t.splice(n,1)}}for(const e of c)r.add(e)}t.push(a)},clone:()=>o(dn()),use:e=>{e.applyToStack(a)},remove:n=>"string"==typeof n?(n=>{let o=!1;const s=e=>{const t=ln(e.name,e.aliases);if(t.includes(n)){o=!0;for(const e of t)r.delete(e);return!1}return!0};return e=e.filter(s),t=t.filter(s),o})(n):(n=>{let o=!1;const s=e=>{if(e.middleware===n){o=!0;for(const t of ln(e.name,e.aliases))r.delete(t);return!1}return!0};return e=e.filter(s),t=t.filter(s),o})(n),removeByTag:n=>{let o=!1;const s=e=>{const{tags:t,name:s,aliases:i}=e;if(t&&t.includes(n)){const e=ln(s,i);for(const t of e)r.delete(t);return o=!0,!1}return!0};return e=e.filter(s),t=t.filter(s),o},concat:e=>{const t=o(dn());return t.use(e),t.identifyOnResolve(n||t.identifyOnResolve()||(e.identifyOnResolve?.()??!1)),t},applyToStack:o,identify:()=>i(!0).map((e=>{const t=e.step??e.relation+" "+e.toMiddleware;return un(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},pn={initialize:5,serialize:4,build:3,finalizeRequest:2,deserialize:1},hn={high:3,normal:2,low:1};class fn{constructor(e){this.middlewareStack=dn(),this.config=e}send(e,t,n){const r="function"!=typeof t?t:void 0,o="function"==typeof t?t:n,s=e.resolveMiddleware(this.middlewareStack,this.config,r);if(!o)return s(e).then((e=>e.output));s(e).then((e=>o(null,e.output)),(e=>o(e))).catch((()=>{}))}destroy(){this.config.requestHandler.destroy&&this.config.requestHandler.destroy()}}const gn=e=>"function"==typeof ArrayBuffer&&e instanceof ArrayBuffer||"[object ArrayBuffer]"===Object.prototype.toString.call(e),mn=(t,n=0,r=t.byteLength-n)=>{if(!gn(t))throw new TypeError(`The "input" argument must be ArrayBuffer. Received type ${typeof t} (${t})`);return e.from(t,n,r)},yn=(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.from(t,n):e.from(t)},wn=/^[A-Za-z0-9+/]*={0,2}$/,bn=e=>{if(3*e.length%4!=0)throw new TypeError("Incorrect padding on base64 string.");if(!wn.exec(e))throw new TypeError("Invalid base64 string.");const t=yn(e,"base64");return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)},vn=e=>{const t=yn(e,"utf8");return new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT)},Sn=e=>"string"==typeof e?vn(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e),En=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 mn(e.buffer,e.byteOffset,e.byteLength).toString("utf8")},xn=e=>{let t;if(t="string"==typeof e?vn(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 mn(t.buffer,t.byteOffset,t.byteLength).toString("base64")};class An extends Uint8Array{static fromString(e,t="utf-8"){if("string"==typeof e)return function(e,t){return"base64"===t?An.mutate(bn(e)):An.mutate(vn(e))}(e,t);throw new Error(`Unsupported conversion from ${typeof e} to Uint8ArrayBlobAdapter.`)}static mutate(e){return Object.setPrototypeOf(e,An.prototype),e}transformToString(e="utf-8"){return function(e,t="utf-8"){return"base64"===t?xn(e):En(e)}(this,e)}}const Pn=e=>encodeURIComponent(e).replace(/[!'()*]/g,Tn),Tn=e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`;const In=["ECONNRESET","EPIPE","ETIMEDOUT"],Cn=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 kn(e,n,r=1e3){const o=n.headers??{},s=o.Expect||o.expect;let i=-1,a=!1;"100-continue"===s&&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)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 _n{static create(e){return"function"==typeof e?.handle?e:new _n(e)}static checkSocketUsage(e,t,n=console){const{sockets:r,requests:o,maxSockets:s}=e;if("number"!=typeof s||s===1/0)return t;if(Date.now()-15e3<t)return t;if(r&&o)for(const e in r){const t=r[e]?.length??0,i=o[e]?.length??0;if(t>=s&&i>=2*s)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:n,socketTimeout:o,httpAgent:i,httpsAgent:a}=e||{},c=!0;return{connectionTimeout:n,requestTimeout:t??o,httpAgent:i instanceof r||"function"==typeof i?.destroy?i:new r({keepAlive:c,maxSockets:50,...i}),httpsAgent:a instanceof s||"function"==typeof a?.destroy?a:new s({keepAlive:c,maxSockets:50,...a}),logger:console}}destroy(){this.config?.httpAgent?.destroy(),this.config?.httpsAgent?.destroy()}async handle(e,{abortSignal:t}={}){let n;return this.config||(this.config=await this.configProvider),new Promise(((r,s)=>{let a;const c=async e=>{await a,clearTimeout(n),s(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;n=setTimeout((()=>{this.socketWarningTimestamp=_n.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=Pn(n),Array.isArray(r))for(let e=0,o=r.length;e<o;e++)t.push(`${n}=${Pn(r[e])}`);else{let e=n;(r||"string"==typeof r)&&(e+=`=${Pn(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?i:o)(f,(e=>{(async e=>{await a,clearTimeout(n),r(e)})({response:new j({statusCode:e.statusCode||-1,reason:e.statusMessage,headers:Cn(e.headers),body:e})})}));if(g.on("error",(e=>{In.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=kn(g,e,this.config.requestTimeout).catch((e=>(clearTimeout(n),s(e))))}))}updateHttpClientConfig(e,t){this.config=void 0,this.configProvider=this.configProvider.then((n=>({...n,[e]:t})))}httpHandlerConfigs(){return this.config??{}}}class Rn extends n{constructor(){super(...arguments),this.bufferedBytes=[]}_write(e,t,n){this.bufferedBytes.push(e),n()}}const On=e=>$n(e)?async function(e){const t=[],n=e.getReader();let r=!1,o=0;for(;!r;){const{done:e,value:s}=await n.read();s&&(t.push(s),o+=s.length),r=e}const s=new Uint8Array(o);let i=0;for(const e of t)s.set(e,i),i+=e.length;return s}(e):new Promise(((t,n)=>{const r=new Rn;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)}))})),$n=e=>"function"==typeof ReadableStream&&e instanceof ReadableStream;const Nn=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??"",o=e.indexOf(","),s=o>-1?o+1:e.length;t(e.substring(s))},r.onabort=()=>n(new Error("Read aborted")),r.onerror=()=>n(r.error),r.readAsDataURL(e)}))}(e),n=bn(t);return new Uint8Array(n)}(e):async function(e){const t=[],n=e.getReader();let r=!1,o=0;for(;!r;){const{done:e,value:s}=await n.read();s&&(t.push(s),o+=s.length),r=e}const s=new Uint8Array(o);let i=0;for(const e of t)s.set(e,i),i+=e.length;return s}(e);const Dn={},jn={};for(let e=0;e<256;e++){let t=e.toString(16).toLowerCase();1===t.length&&(t=`0${t}`),Dn[e]=t,jn[t]=e}function Ln(e){let t="";for(let n=0;n<e.byteLength;n++)t+=Dn[e[n]];return t}const Mn=e=>"function"==typeof ReadableStream&&(e?.constructor?.name===ReadableStream.name||e instanceof ReadableStream),Un="The stream has already been transformed.",Fn=e=>{if(!zn(e)&&!Mn(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(Un);return t=!0,await Nn(e)};return Object.assign(e,{transformToByteArray:n,transformToString:async e=>{const t=await n();if("base64"===e)return xn(t);if("hex"===e)return Ln(t);if(void 0===e||"utf8"===e||"utf-8"===e)return En(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(Un);if(t=!0,zn(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(Mn(e))return e;throw new Error(`Cannot transform payload to web stream, got ${e}`)}})},zn=e=>"function"==typeof Blob&&e instanceof Blob,qn="The stream has already been transformed.";class Wn{constructor(){this.middlewareStack=dn()}static classBuilder(){return new Bn}resolveMiddlewareWithContext(e,t,n,{middlewareFn:r,clientName:o,commandName:s,inputFilterSensitiveLog:i,outputFilterSensitiveLog:a,smithyContext:c,additionalContext:l,CommandCtor:u}){for(const o of r.bind(this)(u,e,t,n))this.middlewareStack.use(o);const d=e.concat(this.middlewareStack),{logger:p}=t,h={logger:p,clientName:o,commandName:s,inputFilterSensitiveLog:i,outputFilterSensitiveLog:a,[O]:{commandInstance:this,...c},...l},{requestHandler:f}=t;return d.resolve((e=>f.handle(e.request,n||{})),h)}}class Bn{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 Wn{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,o){return this.resolveMiddlewareWithContext(n,r,o,{CommandCtor:t,middlewareFn:e._middlewareFn,clientName:e._clientName,commandName:e._commandName,inputFilterSensitiveLog:e._inputFilterSensitiveLog,outputFilterSensitiveLog:e._outputFilterSensitiveLog,smithyContext:e._smithyContext,additionalContext:e._additionalContext})}}}}const Hn="***SensitiveInformation***",Vn=Math.ceil(2**127*(2-2**-23)),Kn=e=>{const t=(e=>{if(null!=e){if("string"==typeof e){const t=parseFloat(e);if(!Number.isNaN(t))return String(t)!==String(e)&&ar.warn(ir(`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)>Vn)throw new TypeError(`Expected 32-bit float, got ${e}`);return t},Gn=e=>Yn(e,32),Xn=e=>Yn(e,16),Jn=e=>Yn(e,8),Yn=(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},er=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}`)},tr=e=>{if(null!=e){if("string"==typeof e)return e;if(["boolean","number","bigint"].includes(typeof e))return ar.warn(ir(`Expected string, got ${typeof e}: ${e}`)),String(e);throw new TypeError(`Expected string, got ${typeof e}: ${e}`)}},nr=/(-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?)|(-?Infinity)|(NaN)/g,rr=e=>{const t=e.match(nr);if(null===t||t[0].length!==e.length)throw new TypeError("Expected real number, got implicit NaN");return parseFloat(e)},or=e=>Gn("string"==typeof e?rr(e):e),sr=e=>Xn("string"==typeof e?rr(e):e),ir=e=>String(new TypeError(e).stack||e).split("\n").slice(0,5).filter((e=>!e.includes("stackTraceWarning"))).join("\n"),ar={warn:console.warn},cr=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],lr=new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?[zZ]$/),ur=e=>{if(null==e)return;if("string"!=typeof e)throw new TypeError("RFC-3339 date-times must be expressed as strings");const t=lr.exec(e);if(!t)throw new TypeError("Invalid RFC-3339 date-time value");const[n,r,o,s,i,a,c,l]=t,u=sr(br(r)),d=mr(o,"month",1,12),p=mr(s,"day",1,31);return pr(u,d,p,{hours:i,minutes:a,seconds:c,fractionalMilliseconds:l})},dr=new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(([-+]\d{2}\:\d{2})|[zZ])$/),pr=(e,t,n,r)=>{const o=t-1;return fr(e,o,n),new Date(Date.UTC(e,o,n,mr(r.hours,"hour",0,23),mr(r.minutes,"minute",0,59),mr(r.seconds,"seconds",0,60),yr(r.fractionalMilliseconds)))},hr=[31,28,31,30,31,30,31,31,30,31,30,31],fr=(e,t,n)=>{let r=hr[t];if(1===t&&gr(e)&&(r=29),n>r)throw new TypeError(`Invalid day for ${cr[t]} in ${e}: ${n}`)},gr=e=>e%4==0&&(e%100!=0||e%400==0),mr=(e,t,n,r)=>{const o=(e=>Jn("string"==typeof e?rr(e):e))(br(e));if(o<n||o>r)throw new TypeError(`${t} must be between ${n} and ${r}, inclusive`);return o},yr=e=>null==e?0:1e3*(e=>Kn("string"==typeof e?rr(e):e))("0."+e),wr=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},br=e=>{let t=0;for(;t<e.length-1&&"0"===e.charAt(t);)t++;return 0===t?e:e.slice(t)};class vr extends Error{constructor(e){super(e.message),Object.setPrototypeOf(this,vr.prototype),this.name=e.name,this.$fault=e.$fault,this.$metadata=e.$metadata}}const Sr=(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},Er=e=>({output:t,parsedBody:n,errorCode:r})=>{(({output:e,parsedBody:t,exceptionCtor:n,errorCode:r})=>{const o=xr(e),s=o.httpStatusCode?o.httpStatusCode+"":void 0,i=new n({name:t?.code||t?.Code||r||s||"UnknownError",$fault:"client",$metadata:o});throw Sr(i,t)})({output:t,parsedBody:n,exceptionCtor:e,errorCode:r})},xr=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"]}),Ar=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 Pr=!1;const Tr=e=>{e&&!Pr&&parseInt(e.substring(1,e.indexOf(".")))<16&&(Pr=!0)},Ir=e=>{const t=[];for(const n in _){const r=_[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}}},Cr=e=>{const t={};return e.checksumAlgorithms().forEach((e=>{t[e.algorithmId()]=e.checksumConstructor()})),t},kr=e=>{let t=e.retryStrategy;return{setRetryStrategy(e){t=e},retryStrategy:()=>t}},_r=e=>{const t={};return t.retryStrategy=e.retryStrategy(),t},Rr=e=>({...Ir(e),...kr(e)}),Or=e=>({...Cr(e),..._r(e)});function $r(e){return encodeURIComponent(e).replace(/[!'()*]/g,(function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()}))}const Nr=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]=Nr(e[n]));return e},Dr=function(){const e=Object.getPrototypeOf(this).constructor,t=new(Function.bind.apply(String,[null,...arguments]));return Object.setPrototypeOf(t,e.prototype),t};function jr(e,t,n){let r,o,s;if(void 0===t&&void 0===n)r={},s=e;else{if(r=e,"function"==typeof t)return o=t,s=n,Mr(r,o,s);s=t}for(const e of Object.keys(s))Array.isArray(s[e])?Ur(r,null,s,e):r[e]=s[e];return r}Dr.prototype=Object.create(String.prototype,{constructor:{value:Dr,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf(Dr,String);const Lr=(e,t)=>{const n={};for(const r in t)Ur(n,e,t,r);return n},Mr=(e,t,n)=>jr(e,Object.entries(n).reduce(((e,[n,r])=>(Array.isArray(r)?e[n]=r:e[n]="function"==typeof r?[t,r()]:[t,r],e)),{})),Ur=(e,t,n,r)=>{if(null!==t){let o=n[r];"function"==typeof o&&(o=[,o]);const[s=Fr,i=zr,a=r]=o;return void(("function"==typeof s&&s(t[a])||"function"!=typeof s&&s)&&(e[r]=i(t[a])))}let[o,s]=n[r];if("function"==typeof s){let t;const n=void 0===o&&null!=(t=s()),i="function"==typeof o&&!!o(void 0)||"function"!=typeof o&&!!o;n?e[r]=t:i&&(e[r]=s())}else{const t=void 0===o&&null!=s,n="function"==typeof o&&!!o(s)||"function"!=typeof o&&!!o;(t||n)&&(e[r]=s)}},Fr=e=>null!=e,zr=e=>e,qr=e=>{if(null==e)return{};if(Array.isArray(e))return e.filter((e=>null!=e)).map(qr);if("object"==typeof e){const t={};for(const n of Object.keys(e))null!=e[n]&&(t[n]=qr(e[n]));return t}return e},Wr=e=>e?.body instanceof t||"undefined"!=typeof ReadableStream&&e?.body instanceof ReadableStream,Br=e=>void 0!==e.acquireInitialRetryToken&&void 0!==e.refreshRetryTokenForRetry&&void 0!==e.recordSuccess,Hr=e=>{const t={error:e,errorType:Vr(e)},n=Xr(e.$response);return n&&(t.retryAfterHint=n),t},Vr=e=>Bt(e)?"THROTTLING":Ht(e)?"TRANSIENT":(e=>{if(void 0!==e.$metadata?.httpStatusCode){const t=e.$metadata.httpStatusCode;return 500<=t&&t<=599&&!Ht(e)}return!1})(e)?"SERVER_ERROR":"CLIENT_ERROR",Kr={name:"retryMiddleware",tags:["RETRY"],step:"finalizeRequest",priority:"high",override:!0},Gr=e=>({applyToStack:t=>{t.add((e=>(t,n)=>async r=>{let o=await e.retryStrategy();const s=await e.maxAttempts();if(!Br(o))return o?.mode&&(n.userAgent=[...n.userAgent||[],["cfg/retry-mode",o.mode]]),o.retry(t,r);{let e=await o.acquireInitialRetryToken(n.partition_id),a=new Error,c=0,l=0;const{request:u}=r,d=D.isInstance(u);for(d&&(u.headers["amz-sdk-invocation-id"]=tn());;)try{d&&(u.headers["amz-sdk-request"]=`attempt=${c+1}; max=${s}`);const{response:n,output:i}=await t(r);return o.recordSuccess(e),i.$metadata.attempts=c+1,i.$metadata.totalRetryDelay=l,{response:n,output:i}}catch(t){const r=Hr(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&&Wr(u))throw(n.logger instanceof cn?console:n.logger)?.warn("An error was encountered in a non-retryable streaming request."),a;try{e=await o.refreshRetryTokenForRetry(e,r)}catch(e){throw a.$metadata||(a.$metadata={}),a.$metadata.attempts=c+1,a.$metadata.totalRetryDelay=l,a}c=e.getRetryCount();const s=e.getRetryDelay();l+=s,await new Promise((e=>setTimeout(e,s)))}}var i})(e),Kr)}}),Xr=e=>{if(!j.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)},Jr={step:"finalizeRequest",tags:["HTTP_SIGNING"],name:"httpSigningMiddleware",aliases:["apiKeyMiddleware","tokenMiddleware","awsAuthMiddleware"],override:!0,relation:"after",toMiddleware:Kr.name},Yr=e=>({applyToStack:e=>{e.addRelativeTo(((e,t)=>async n=>{if(!D.isInstance(n.request))return e(n);const r=_e(t).selectedHttpAuthScheme;if(!r)throw new Error("No HttpAuthScheme was selected: unable to sign request");const{httpAuthOption:{signingProperties:o={}},identity:s,signer:i}=r,a=await e({...n,request:await i.sign(n.request,s,o)}).catch((i.errorHandler||jt)(o));return(i.successHandler||Lt)(a.response,o),a}),Jr)}});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 eo=(to=3e5,e=>no(e)&&e.expiration.getTime()-Date.now()<to);var to;const no=e=>void 0!==e.expiration,ro=e=>{if("function"==typeof e)return e;const t=Promise.resolve(e);return()=>t};function oo(e,t){return new so(e,t)}class so{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 D({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((o=>{this.path=((e,t,n,r,o,s)=>{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(o,s?t.split("/").map((e=>$r(e))).join("/"):$r(t))}return e})(o,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 io="content-length";const ao={step:"build",tags:["SET_CONTENT_LENGTH","CONTENT_LENGTH"],name:"contentLengthMiddleware",override:!0},co=e=>({applyToStack:t=>{var n;t.add((n=e.bodyLengthChecker,e=>async t=>{const r=t.request;if(D.isInstance(r)){const{body:e,headers:t}=r;if(e&&-1===Object.keys(t).map((e=>e.toLowerCase())).indexOf(io))try{const t=n(e);r.headers={...r.headers,[io]:String(t)}}catch(e){}}return e({...t,request:r})}),ao)}});let lo=!1;const uo=e=>{e&&!lo&&parseInt(e.substring(1,e.indexOf(".")))<18&&(lo=!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"))},po=e=>j.isInstance(e)?e.headers?.date??e.headers?.Date:void 0,ho=e=>new Date(Date.now()+e),fo=(e,t)=>{const n=Date.parse(e);return((e,t)=>Math.abs(ho(t).getTime()-e)>=3e5)(n,t)?n-Date.now():t},go=(e,t)=>{if(!t)throw new Error(`Property \`${e}\` is not resolved for AWS SDK SigV4Auth`);return t};class mo{async sign(e,t,n){if(!D.isInstance(e))throw new Error("The request is not an instance of `HttpRequest` and cannot be signed");const r=await(async e=>{const t=go("context",e.context),n=go("config",e.config),r=t.endpointV2?.properties?.authSchemes?.[0],o=go("signer",n.signer),s=await o(r),i=e?.signingRegion,a=e?.signingRegionSet,c=e?.signingName;return{config:n,signer:s,signingRegion:i,signingRegionSet:a,signingName:c}})(n),{config:o,signer:s}=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 s.sign(e,{signingDate:ho(o.systemClockOffset),signingRegion:i,signingService:a})}errorHandler(e){return t=>{const n=t.ServerTime??po(t.$response);if(n){const r=go("config",e.config),o=r.systemClockOffset;r.systemClockOffset=fo(n,r.systemClockOffset);r.systemClockOffset!==o&&t.$metadata&&(t.$metadata.clockSkewCorrected=!0)}throw t}}successHandler(e,t){const n=po(e);if(n){const e=go("config",t.config);e.systemClockOffset=fo(n,e.systemClockOffset)}}}const yo="X-Amz-Date",wo="X-Amz-Signature",bo="X-Amz-Security-Token",vo="authorization",So=yo.toLowerCase(),Eo=[vo,So,"date"],xo=wo.toLowerCase(),Ao="x-amz-content-sha256",Po=bo.toLowerCase(),To={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},Io=/^proxy-/,Co=/^sec-/,ko="AWS4-HMAC-SHA256",_o="AWS4-HMAC-SHA256-PAYLOAD",Ro="aws4_request",Oo={},$o=[],No=(e,t,n)=>`${e}/${t}/${n}/${Ro}`,Do=(e,t,n)=>{const r=new e(t);return r.update(Sn(n)),r.digest()},jo=({headers:e},t,n)=>{const r={};for(const o of Object.keys(e).sort()){if(null==e[o])continue;const s=o.toLowerCase();(s in To||t?.has(s)||Io.test(s)||Co.test(s))&&(!n||n&&!n.has(s))||(r[s]=e[o].trim().replace(/\s+/g," "))}return r},Lo=async({headers:e,body:t},n)=>{for(const t of Object.keys(e))if(t.toLowerCase()===Ao)return e[t];if(null==t)return"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";if("string"==typeof t||ArrayBuffer.isView(t)||gn(t)){const e=new n;return e.update(Sn(t)),Ln(await e.digest())}return"UNSIGNED-PAYLOAD"};class Mo{format(e){const t=[];for(const n of Object.keys(e)){const r=vn(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 o=new DataView(new ArrayBuffer(3+e.value.byteLength));o.setUint8(0,6),o.setUint16(1,e.value.byteLength,!1);const s=new Uint8Array(o.buffer);return s.set(e.value,3),s;case"string":const i=vn(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(zo.fromNumber(e.value.valueOf()).bytes,1),l;case"uuid":if(!Fo.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 jn))throw new Error(`Cannot decode unrecognized sequence ${r} as hexadecimal`);t[n/2]=jn[r]}return t}(e.value.replace(/\-/g,"")),1),u}}}var Uo;!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"}(Uo||(Uo={}));const Fo=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;class zo{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&&qo(t),new zo(t)}valueOf(){const e=this.bytes.slice(0),t=128&e[0];return t&&qo(e),parseInt(Ln(e),16)*(t?-1:1)}toString(){return String(this.valueOf())}}function qo(e){for(let t=0;t<8;t++)e[t]^=255;for(let t=7;t>-1&&(e[t]++,0===e[t]);t--);}const Wo=e=>{e=D.clone(e);for(const t of Object.keys(e.headers))Eo.indexOf(t.toLowerCase())>-1&&delete e.headers[t];return e},Bo=e=>"number"==typeof e?new Date(1e3*e):"string"==typeof e?Number(e)?new Date(1e3*Number(e)):new Date(e):e;class Ho{constructor({applyChecksum:e,credentials:t,region:n,service:r,sha256:o,uriEscapePath:s=!0}){this.headerFormatter=new Mo,this.service=r,this.sha256=o,this.uriEscapePath=s,this.applyChecksum="boolean"!=typeof e||e,this.regionProvider=Re(n),this.credentialProvider=Re(t)}async presign(e,t={}){const{signingDate:n=new Date,expiresIn:r=3600,unsignableHeaders:o,unhoistableHeaders:s,signableHeaders:i,signingRegion:a,signingService:c}=t,l=await this.credentialProvider();this.validateResolvedCredentials(l);const u=a??await this.regionProvider(),{longDate:d,shortDate:p}=Vo(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=No(p,u,c??this.service),f=((e,t={})=>{const{headers:n,query:r={}}=D.clone(e);for(const e of Object.keys(n)){const o=e.toLowerCase();"x-amz-"!==o.slice(0,6)||t.unhoistableHeaders?.has(o)||(r[e]=n[e],delete n[e])}return{...e,headers:n,query:r}})(Wo(e),{unhoistableHeaders:s});l.sessionToken&&(f.query[bo]=l.sessionToken),f.query["X-Amz-Algorithm"]=ko,f.query["X-Amz-Credential"]=`${l.accessKeyId}/${h}`,f.query[yo]=d,f.query["X-Amz-Expires"]=r.toString(10);const g=jo(f,o,i);return f.query["X-Amz-SignedHeaders"]=Ko(g),f.query[wo]=await this.getSignature(d,h,this.getSigningKey(l,u,p,c),this.createCanonicalRequest(f,g,await Lo(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:o,signingService:s}){const i=o??await this.regionProvider(),{shortDate:a,longDate:c}=Vo(n),l=No(a,i,s??this.service),u=await Lo({headers:{},body:t},this.sha256),d=new this.sha256;d.update(e);const p=Ln(await d.digest()),h=[_o,c,l,r,p,u].join("\n");return this.signString(h,{signingDate:n,signingRegion:i,signingService:s})}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 o=await this.credentialProvider();this.validateResolvedCredentials(o);const s=n??await this.regionProvider(),{shortDate:i}=Vo(t),a=new this.sha256(await this.getSigningKey(o,s,i,r));return a.update(Sn(e)),Ln(await a.digest())}async signRequest(e,{signingDate:t=new Date,signableHeaders:n,unsignableHeaders:r,signingRegion:o,signingService:s}={}){const i=await this.credentialProvider();this.validateResolvedCredentials(i);const a=o??await this.regionProvider(),c=Wo(e),{longDate:l,shortDate:u}=Vo(t),d=No(u,a,s??this.service);c.headers[So]=l,i.sessionToken&&(c.headers[Po]=i.sessionToken);const p=await Lo(c,this.sha256);!((e,t)=>{e=e.toLowerCase();for(const n of Object.keys(t))if(e===n.toLowerCase())return!0;return!1})(Ao,c.headers)&&this.applyChecksum&&(c.headers[Ao]=p);const h=jo(c,r,n),f=await this.getSignature(l,d,this.getSigningKey(i,a,u,s),this.createCanonicalRequest(c,h,p));return c.headers[vo]=`${ko} Credential=${i.accessKeyId}/${d}, SignedHeaders=${Ko(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()===xo)continue;t.push(r);const o=e[r];"string"==typeof o?n[r]=`${Pn(r)}=${Pn(o)}`:Array.isArray(o)&&(n[r]=o.slice(0).reduce(((e,t)=>e.concat([`${Pn(r)}=${Pn(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(Sn(n));const o=await r.digest();return`${ko}\n${e}\n${t}\n${Ln(o)}`}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 Pn(n).replace(/%2F/g,"/")}return e}async getSignature(e,t,n,r){const o=await this.createStringToSign(e,t,r),s=new this.sha256(await n);return s.update(Sn(o)),Ln(await s.digest())}getSigningKey(e,t,n,r){return(async(e,t,n,r,o)=>{const s=`${n}:${r}:${o}:${Ln(await Do(e,t.secretAccessKey,t.accessKeyId))}:${t.sessionToken}`;if(s in Oo)return Oo[s];for($o.push(s);$o.length>50;)delete Oo[$o.shift()];let i=`AWS4${t.secretAccessKey}`;for(const t of[n,r,o,Ro])i=await Do(e,i,t);return Oo[s]=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 Vo=e=>{const t=(n=e,Bo(n).toISOString().replace(/\.\d{3}Z$/,"Z")).replace(/[\-:]/g,"");var n;return{longDate:t,shortDate:t.slice(0,8)}},Ko=e=>Object.keys(e).sort().join(";"),Go=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 o,s,i,a=!1;const c=async e=>{s||(s=r(e));try{o=await s,i=!0,a=!1}finally{s=void 0}return o};return void 0===t?async e=>(i&&!e?.forceRefresh||(o=await c(e)),o):async e=>(i&&!e?.forceRefresh||(o=await c(e)),a?o:n(o)?t(o)?(await c(e),o):o:(a=!0,o))})(e.credentials,eo,no)),t||(t=e.credentialDefaultProvider?ro(e.credentialDefaultProvider(Object.assign({},e,{parentClientConfig:e}))):async()=>{throw new Error("`credentials` is missing")});const{signingEscapePath:n=!0,systemClockOffset:r=e.systemClockOffset||0,sha256:o}=e;let s;return s=e.signer?ro(e.signer):e.regionInfoProvider?()=>ro(e.region)().then((async t=>[await e.regionInfoProvider(t,{useFipsEndpoint:await e.useFipsEndpoint(),useDualstackEndpoint:await e.useDualstackEndpoint()})||{},t])).then((([r,s])=>{const{signingRegion:i,signingService:a}=r;e.signingRegion=e.signingRegion||i||s,e.signingName=e.signingName||a||e.serviceId;const c={...e,credentials:t,region:e.signingRegion,service:e.signingName,sha256:o,uriEscapePath:n};return new(e.signerConstructor||Ho)(c)})):async r=>{const s=(r=Object.assign({},{name:"sigv4",signingName:e.signingName||e.defaultSigningName,signingRegion:await ro(e.region)(),properties:{}},r)).signingRegion,i=r.signingName;e.signingRegion=e.signingRegion||s,e.signingName=e.signingName||i||e.serviceId;const a={...e,credentials:t,region:e.signingRegion,service:e.signingName,sha256:o,uriEscapePath:n};return new(e.signerConstructor||Ho)(a)},{...e,systemClockOffset:r,signingEscapePath:n,credentials:t,signer:s}},Xo=(e,t)=>(async(e=new Uint8Array,t)=>{if(e instanceof Uint8Array)return An.mutate(e);if(!e)return An.mutate(new Uint8Array);const n=t.streamCollector(e);return An.mutate(await n)})(e,t).then((e=>t.utf8Encoder(e))),Jo=(e,t)=>Xo(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{}})),Yo=async(e,t)=>{const n=await Jo(e,t);return n.message=n.message??n.Message,n},Zo=(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=(o=e.headers,s="x-amzn-errortype",Object.keys(o).find((e=>e.toLowerCase()===s.toLowerCase())));var o,s;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 Qo="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function es(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ts={},ns={};!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),o=r.length;for(let s=0;s<o;s++)e[r[s]]="strict"===n?[t[r[s]]]:t[r[s]]}},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 o=[];o.startIndex=t.lastIndex-r[0].length;const s=r.length;for(let e=0;e<s;e++)o.push(r[e]);n.push(o),r=t.exec(e)}return n},e.nameRegexp=n}(ns);const rs=ns,os={allowBooleanAttributes:!1,unpairedTags:[]};function ss(e){return" "===e||"\t"===e||"\n"===e||"\r"===e}function is(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 fs("InvalidXml","XML declaration allowed only at the start of the document.",ms(e,t));if("?"==e[t]&&">"==e[t+1]){t++;break}}return t}function as(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}ts.validate=function(e,t){t=Object.assign({},os,t);const n=[];let r=!1,o=!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=is(e,i),i.err)return i}else{if("<"!==e[i]){if(ss(e[i]))continue;return fs("InvalidChar","char '"+e[i]+"' is not expected.",ms(e,i))}{let a=i;if(i++,"!"===e[i]){i=as(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--),s=l,!rs.isName(s)){let t;return t=0===l.trim().length?"Invalid space after '<'.":"Tag '"+l+"' is an invalid name.",fs("InvalidTag",t,ms(e,i))}const u=us(e,i);if(!1===u)return fs("InvalidAttr","Attributes for '"+l+"' have open quote.",ms(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 o=ps(d,t);if(!0!==o)return fs(o.err.code,o.err.msg,ms(e,n+o.err.line));r=!0}else if(c){if(!u.tagClosed)return fs("InvalidTag","Closing tag '"+l+"' doesn't have proper closing.",ms(e,i));if(d.trim().length>0)return fs("InvalidTag","Closing tag '"+l+"' can't have attributes or invalid starting.",ms(e,a));if(0===n.length)return fs("InvalidTag","Closing tag '"+l+"' has not been opened.",ms(e,a));{const t=n.pop();if(l!==t.tagName){let n=ms(e,t.tagStartPos);return fs("InvalidTag","Expected closing tag '"+t.tagName+"' (opened in line "+n.line+", col "+n.col+") instead of closing tag '"+l+"'.",ms(e,a))}0==n.length&&(o=!0)}}else{const s=ps(d,t);if(!0!==s)return fs(s.err.code,s.err.msg,ms(e,i-d.length+s.err.line));if(!0===o)return fs("InvalidXml","Multiple possible root nodes found.",ms(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=as(e,i);continue}if("?"!==e[i+1])break;if(i=is(e,++i),i.err)return i}else if("&"===e[i]){const t=hs(e,i);if(-1==t)return fs("InvalidChar","char '&' is not expected.",ms(e,i));i=t}else if(!0===o&&!ss(e[i]))return fs("InvalidXml","Extra text at the end",ms(e,i));"<"===e[i]&&i--}}}var s;return r?1==n.length?fs("InvalidTag","Unclosed tag '"+n[0].tagName+"'.",ms(e,n[0].tagStartPos)):!(n.length>0)||fs("InvalidXml","Invalid '"+JSON.stringify(n.map((e=>e.tagName)),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1}):fs("InvalidXml","Start tag expected.",1)};const cs='"',ls="'";function us(e,t){let n="",r="",o=!1;for(;t<e.length;t++){if(e[t]===cs||e[t]===ls)""===r?r=e[t]:r!==e[t]||(r="");else if(">"===e[t]&&""===r){o=!0;break}n+=e[t]}return""===r&&{value:n,index:t,tagClosed:o}}const ds=new RegExp("(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['\"])(([\\s\\S])*?)\\5)?","g");function ps(e,t){const n=rs.getAllMatches(e,ds),r={};for(let e=0;e<n.length;e++){if(0===n[e][1].length)return fs("InvalidAttr","Attribute '"+n[e][2]+"' has no space in starting.",ys(n[e]));if(void 0!==n[e][3]&&void 0===n[e][4])return fs("InvalidAttr","Attribute '"+n[e][2]+"' is without value.",ys(n[e]));if(void 0===n[e][3]&&!t.allowBooleanAttributes)return fs("InvalidAttr","boolean attribute '"+n[e][2]+"' is not allowed.",ys(n[e]));const o=n[e][2];if(!gs(o))return fs("InvalidAttr","Attribute '"+o+"' is an invalid name.",ys(n[e]));if(r.hasOwnProperty(o))return fs("InvalidAttr","Attribute '"+o+"' is repeated.",ys(n[e]));r[o]=1}return!0}function hs(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 fs(e,t,n){return{err:{code:e,msg:t,line:n.line||n,col:n.col}}}function gs(e){return rs.isName(e)}function ms(e,t){const n=e.substring(0,t).split(/\r?\n/);return{line:n.length,col:n[n.length-1].length+1}}function ys(e){return e.startIndex+e[1].length}var ws={};const bs={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}};ws.buildOptions=function(e){return Object.assign({},bs,e)},ws.defaultOptions=bs;var vs=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 Ss=ns;function Es(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 o="";for(;t<e.length&&e[t]!==r;t++)o+=e[t];return[n,o,t]}function xs(e,t){return"!"===e[t+1]&&"-"===e[t+2]&&"-"===e[t+3]}function As(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 Ps(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 Ts(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 Is(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 Cs(e){if(Ss.isName(e))return e;throw new Error(`Invalid entity name ${e}`)}var ks=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,o=!1,s=!1,i="";for(;t<e.length;t++)if("<"!==e[t]||s)if(">"===e[t]){if(s?"-"===e[t-1]&&"-"===e[t-2]&&(s=!1,r--):r--,0===r)break}else"["===e[t]?o=!0:i+=e[t];else{if(o&&As(e,t))t+=7,[entityName,val,t]=Es(e,t+1),-1===val.indexOf("&")&&(n[Cs(entityName)]={regx:RegExp(`&${entityName};`,"g"),val:val});else if(o&&Ps(e,t))t+=8;else if(o&&Ts(e,t))t+=8;else if(o&&Is(e,t))t+=9;else{if(!xs)throw new Error("Invalid DOCTYPE");s=!0}r++,i=""}if(0!==r)throw new Error("Unclosed DOCTYPE")}return{entities:n,i:t}};const _s=/^[-+]?0x[a-fA-F0-9]+$/,Rs=/^([\-\+])?(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 Os={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};const $s=ns,Ns=vs,Ds=ks,js=function(e,t={}){if(t=Object.assign({},Os,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&&_s.test(n))return Number.parseInt(n,16);{const r=Rs.exec(n);if(r){const o=r[1],s=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&&s.length>0&&o&&"."!==n[2])return e;if(!t.leadingZeros&&s.length>0&&!o&&"."!==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||o&&c==="-"+i?r:e:s?i===c||o+i===c?r:e:n===c||n===o+c?r:e}}return e}};function Ls(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 Ms(e,t,n,r,o,s,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,o,s);if(null==r)return e;if(typeof r!=typeof e||r!==e)return r;if(this.options.trimValues)return Js(e,this.options.parseTagValue,this.options.numberParseOptions);return e.trim()===e?Js(e,this.options.parseTagValue,this.options.numberParseOptions):e}}function Us(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 Fs=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");function zs(e,t,n){if(!this.options.ignoreAttributes&&"string"==typeof e){const n=$s.getAllMatches(e,Fs),r=n.length,o={};for(let e=0;e<r;e++){const r=this.resolveNameSpace(n[e][1]);let s=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!==s){this.options.trimValues&&(s=s.trim()),s=this.replaceEntitiesValue(s);const e=this.options.attributeValueProcessor(r,s,t);o[i]=null==e?s:typeof e!=typeof s||e!==s?e:Js(s,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(o[i]=!0)}if(!Object.keys(o).length)return;if(this.options.attributesGroupName){const e={};return e[this.options.attributesGroupName]=o,e}return o}}const qs=function(e){e=e.replace(/\r\n?/g,"\n");const t=new Ns("!xml");let n=t,r="",o="";for(let s=0;s<e.length;s++){if("<"===e[s])if("/"===e[s+1]){const t=Ks(e,">",s,"Closing Tag is not closed.");let i=e.substring(s+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,o));const a=o.substring(o.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=o.lastIndexOf(".",o.lastIndexOf(".")-1),this.tagsNodeStack.pop()):c=o.lastIndexOf("."),o=o.substring(0,c),n=this.tagsNodeStack.pop(),r="",s=t}else if("?"===e[s+1]){let t=Gs(e,s,!1,"?>");if(!t)throw new Error("Pi Tag is not closed.");if(r=this.saveTextToParentTag(r,n,o),this.options.ignoreDeclaration&&"?xml"===t.tagName||this.options.ignorePiTags);else{const e=new Ns(t.tagName);e.add(this.options.textNodeName,""),t.tagName!==t.tagExp&&t.attrExpPresent&&(e[":@"]=this.buildAttributesMap(t.tagExp,o,t.tagName)),this.addChild(n,e,o)}s=t.closeIndex+1}else if("!--"===e.substr(s+1,3)){const t=Ks(e,"--\x3e",s+4,"Comment is not closed.");if(this.options.commentPropName){const i=e.substring(s+4,t-2);r=this.saveTextToParentTag(r,n,o),n.add(this.options.commentPropName,[{[this.options.textNodeName]:i}])}s=t}else if("!D"===e.substr(s+1,2)){const t=Ds(e,s);this.docTypeEntities=t.entities,s=t.i}else if("!["===e.substr(s+1,2)){const t=Ks(e,"]]>",s,"CDATA is not closed.")-2,i=e.substring(s+9,t);r=this.saveTextToParentTag(r,n,o);let a=this.parseTextData(i,n.tagname,o,!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),s=t+2}else{let i=Gs(e,s,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,o,!1));const p=n;if(p&&-1!==this.options.unpairedTags.indexOf(p.tagname)&&(n=this.tagsNodeStack.pop(),o=o.substring(0,o.lastIndexOf("."))),a!==t.tagname&&(o+=o?"."+a:a),this.isItStopNode(this.options.stopNodes,o,a)){let t="";if(l.length>0&&l.lastIndexOf("/")===l.length-1)"/"===a[a.length-1]?(a=a.substr(0,a.length-1),o=o.substr(0,o.length-1),l=a):l=l.substr(0,l.length-1),s=i.closeIndex;else if(-1!==this.options.unpairedTags.indexOf(a))s=i.closeIndex;else{const n=this.readStopNodeData(e,c,d+1);if(!n)throw new Error(`Unexpected end of ${c}`);s=n.i,t=n.tagContent}const r=new Ns(a);a!==l&&u&&(r[":@"]=this.buildAttributesMap(l,o,a)),t&&(t=this.parseTextData(t,a,o,!0,u,!0,!0)),o=o.substr(0,o.lastIndexOf(".")),r.add(this.options.textNodeName,t),this.addChild(n,r,o)}else{if(l.length>0&&l.lastIndexOf("/")===l.length-1){"/"===a[a.length-1]?(a=a.substr(0,a.length-1),o=o.substr(0,o.length-1),l=a):l=l.substr(0,l.length-1),this.options.transformTagName&&(a=this.options.transformTagName(a));const e=new Ns(a);a!==l&&u&&(e[":@"]=this.buildAttributesMap(l,o,a)),this.addChild(n,e,o),o=o.substr(0,o.lastIndexOf("."))}else{const e=new Ns(a);this.tagsNodeStack.push(n),a!==l&&u&&(e[":@"]=this.buildAttributesMap(l,o,a)),this.addChild(n,e,o),n=e}r="",s=d}}else r+=e[s]}return t.child};function Ws(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 Bs=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 Hs(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 Vs(e,t,n){const r="*."+n;for(const n in e){const o=e[n];if(r===o||t===o)return!0}return!1}function Ks(e,t,n,r){const o=e.indexOf(t,n);if(-1===o)throw new Error(r);return o+t.length-1}function Gs(e,t,n,r=">"){const o=function(e,t,n=">"){let r,o="";for(let s=t;s<e.length;s++){let t=e[s];if(r)t===r&&(r="");else if('"'===t||"'"===t)r=t;else if(t===n[0]){if(!n[1])return{data:o,index:s};if(e[s+1]===n[1])return{data:o,index:s}}else"\t"===t&&(t=" ");o+=t}}(e,t+1,r);if(!o)return;let s=o.data;const i=o.index,a=s.search(/\s/);let c=s,l=!0;-1!==a&&(c=s.substring(0,a),s=s.substring(a+1).trimStart());const u=c;if(n){const e=c.indexOf(":");-1!==e&&(c=c.substr(e+1),l=c!==o.data.substr(e+1))}return{tagName:c,tagExp:s,closeIndex:i,attrExpPresent:l,rawTagName:u}}function Xs(e,t,n){const r=n;let o=1;for(;n<e.length;n++)if("<"===e[n])if("/"===e[n+1]){const s=Ks(e,">",n,`${t} is not closed`);if(e.substring(n+2,s).trim()===t&&(o--,0===o))return{tagContent:e.substring(r,n),i:s};n=s}else if("?"===e[n+1]){n=Ks(e,"?>",n+1,"StopNode is not closed.")}else if("!--"===e.substr(n+1,3)){n=Ks(e,"--\x3e",n+3,"StopNode is not closed.")}else if("!["===e.substr(n+1,2)){n=Ks(e,"]]>",n,"StopNode is not closed.")-2}else{const r=Gs(e,n,">");if(r){(r&&r.tagName)===t&&"/"!==r.tagExp[r.tagExp.length-1]&&o++,n=r.closeIndex}}}function Js(e,t,n){if(t&&"string"==typeof e){const t=e.trim();return"true"===t||"false"!==t&&js(e,n)}return $s.isExist(e)?e:""}var Ys=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=Ls,this.parseXml=qs,this.parseTextData=Ms,this.resolveNameSpace=Us,this.buildAttributesMap=zs,this.isItStopNode=Vs,this.replaceEntitiesValue=Bs,this.readStopNodeData=Xs,this.saveTextToParentTag=Hs,this.addChild=Ws}},Zs={};function Qs(e,t,n){let r;const o={};for(let s=0;s<e.length;s++){const i=e[s],a=ei(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=Qs(i[a],t,c);const n=ni(e,t);i[":@"]?ti(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!==o[a]&&o.hasOwnProperty(a)?(Array.isArray(o[a])||(o[a]=[o[a]]),o[a].push(e)):t.isArray(a,c,n)?o[a]=[e]:o[a]=e}}}return"string"==typeof r?r.length>0&&(o[t.textNodeName]=r):void 0!==r&&(o[t.textNodeName]=r),o}function ei(e){const t=Object.keys(e);for(let e=0;e<t.length;e++){const n=t[e];if(":@"!==n)return n}}function ti(e,t,n,r){if(t){const o=Object.keys(t),s=o.length;for(let i=0;i<s;i++){const s=o[i];r.isArray(s,n+"."+s,!0,!0)?e[s]=[t[s]]:e[s]=t[s]}}}function ni(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])}Zs.prettify=function(e,t){return Qs(e,t)};const{buildOptions:ri}=ws,oi=Ys,{prettify:si}=Zs,ii=ts;var ai=class{constructor(e){this.externalEntities={},this.options=ri(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=ii.validate(e,t);if(!0!==n)throw Error(`${n.err.msg}:${n.err.line}:${n.err.col}`)}const n=new oi(this.options);n.addExternalEntities(this.externalEntities);const r=n.parseXml(e);return this.options.preserveOrder||void 0===r?r:si(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 ci(e,t,n,r){let o="",s=!1;for(let i=0;i<e.length;i++){const a=e[i],c=li(a);if(void 0===c)continue;let l="";if(l=0===n.length?c:`${n}.${c}`,c===t.textNodeName){let e=a[c];di(l,t)||(e=t.tagValueProcessor(c,e),e=pi(e,t)),s&&(o+=r),o+=e,s=!1;continue}if(c===t.cdataPropName){s&&(o+=r),o+=`<![CDATA[${a[c][0][t.textNodeName]}]]>`,s=!1;continue}if(c===t.commentPropName){o+=r+`\x3c!--${a[c][0][t.textNodeName]}--\x3e`,s=!0;continue}if("?"===c[0]){const e=ui(a[":@"],t),n="?xml"===c?"":r;let i=a[c][0][t.textNodeName];i=0!==i.length?" "+i:"",o+=n+`<${c}${i}${e}?>`,s=!0;continue}let u=r;""!==u&&(u+=t.indentBy);const d=r+`<${c}${ui(a[":@"],t)}`,p=ci(a[c],t,l,u);-1!==t.unpairedTags.indexOf(c)?t.suppressUnpairedNode?o+=d+">":o+=d+"/>":p&&0!==p.length||!t.suppressEmptyNode?p&&p.endsWith(">")?o+=d+`>${p}${r}</${c}>`:(o+=d+">",p&&""!==r&&(p.includes("/>")||p.includes("</"))?o+=r+t.indentBy+p+r:o+=p,o+=`</${c}>`):o+=d+"/>",s=!0}return o}function li(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 ui(e,t){let n="";if(e&&!t.ignoreAttributes)for(let r in e){if(!e.hasOwnProperty(r))continue;let o=t.attributeValueProcessor(r,e[r]);o=pi(o,t),!0===o&&t.suppressBooleanAttributes?n+=` ${r.substr(t.attributeNamePrefix.length)}`:n+=` ${r.substr(t.attributeNamePrefix.length)}="${o}"`}return n}function di(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 pi(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 hi=function(e,t){let n="";return t.format&&t.indentBy.length>0&&(n="\n"),ci(e,t,"",n)},fi={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 gi(e){this.options=Object.assign({},fi,e),this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=wi),this.processTextOrObjNode=mi,this.options.format?(this.indentate=yi,this.tagEndChar=">\n",this.newLine="\n"):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}function mi(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 yi(e){return this.options.indentBy.repeat(e)}function wi(e){return!(!e.startsWith(this.options.attributeNamePrefix)||e===this.options.textNodeName)&&e.substr(this.attrPrefixLen)}gi.prototype.build=function(e){return this.options.preserveOrder?hi(e,this.options):(Array.isArray(e)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(e={[this.options.arrayNodeName]:e}),this.j2x(e,0).val)},gi.prototype.j2x=function(e,t){let n="",r="";for(let o in e)if(Object.prototype.hasOwnProperty.call(e,o))if(void 0===e[o])this.isAttribute(o)&&(r+="");else if(null===e[o])this.isAttribute(o)?r+="":"?"===o[0]?r+=this.indentate(t)+"<"+o+"?"+this.tagEndChar:r+=this.indentate(t)+"<"+o+"/"+this.tagEndChar;else if(e[o]instanceof Date)r+=this.buildTextValNode(e[o],o,"",t);else if("object"!=typeof e[o]){const s=this.isAttribute(o);if(s)n+=this.buildAttrPairStr(s,""+e[o]);else if(o===this.options.textNodeName){let t=this.options.tagValueProcessor(o,""+e[o]);r+=this.replaceEntitiesValue(t)}else r+=this.buildTextValNode(e[o],o,"",t)}else if(Array.isArray(e[o])){const n=e[o].length;let s="",i="";for(let a=0;a<n;a++){const n=e[o][a];if(void 0===n);else if(null===n)"?"===o[0]?r+=this.indentate(t)+"<"+o+"?"+this.tagEndChar:r+=this.indentate(t)+"<"+o+"/"+this.tagEndChar;else if("object"==typeof n)if(this.options.oneListGroup){const e=this.j2x(n,t+1);s+=e.val,this.options.attributesGroupName&&n.hasOwnProperty(this.options.attributesGroupName)&&(i+=e.attrStr)}else s+=this.processTextOrObjNode(n,o,t);else if(this.options.oneListGroup){let e=this.options.tagValueProcessor(o,n);e=this.replaceEntitiesValue(e),s+=e}else s+=this.buildTextValNode(n,o,"",t)}this.options.oneListGroup&&(s=this.buildObjectNode(s,o,i,t)),r+=s}else if(this.options.attributesGroupName&&o===this.options.attributesGroupName){const t=Object.keys(e[o]),r=t.length;for(let s=0;s<r;s++)n+=this.buildAttrPairStr(t[s],""+e[o][t[s]])}else r+=this.processTextOrObjNode(e[o],o,t);return{attrStr:n,val:r}},gi.prototype.buildAttrPairStr=function(e,t){return t=this.options.attributeValueProcessor(e,""+t),t=this.replaceEntitiesValue(t),this.options.suppressBooleanAttributes&&"true"===t?" "+e:" "+e+'="'+t+'"'},gi.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 o="</"+t+this.tagEndChar,s="";return"?"===t[0]&&(s="?",o=""),!n&&""!==n||-1!==e.indexOf("<")?!1!==this.options.commentPropName&&t===this.options.commentPropName&&0===s.length?this.indentate(r)+`\x3c!--${e}--\x3e`+this.newLine:this.indentate(r)+"<"+t+n+s+this.tagEndChar+e+this.indentate(r)+o:this.indentate(r)+"<"+t+n+s+">"+e+o}},gi.prototype.closeTag=function(e){let t="";return-1!==this.options.unpairedTags.indexOf(e)?this.options.suppressUnpairedNode||(t="/"):t=this.options.suppressEmptyNode?"/":`></${e}`,t},gi.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 o=this.options.tagValueProcessor(t,e);return o=this.replaceEntitiesValue(o),""===o?this.indentate(r)+"<"+t+n+this.closeTag(t)+this.tagEndChar:this.indentate(r)+"<"+t+n+">"+o+"</"+t+this.tagEndChar}},gi.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 bi={XMLParser:ai,XMLValidator:ts,XMLBuilder:gi};const vi=(e,t)=>Xo(e,t).then((e=>{if(e.length){const t=new bi.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",o=Object.keys(n)[0],s=n[o];return s[r]&&(s[o]=s[r],delete s[r]),Nr(s)}return{}})),Si=async(e,t)=>{const n=await vi(e,t);return n.Error&&(n.Error.message=n.Error.message??n.Error.Message),n},Ei=async(e,t,n)=>({operation:_e(t).operation,region:await Re(e.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});const xi=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},Ai={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}};var Pi="3.645.0";const Ti="AWS_ACCESS_KEY_ID",Ii="AWS_SECRET_ACCESS_KEY",Ci="AWS_SESSION_TOKEN",ki="AWS_CREDENTIAL_EXPIRATION",_i="AWS_CREDENTIAL_SCOPE",Ri="AWS_ACCOUNT_ID",Oi=e=>async()=>{e?.logger?.debug("@aws-sdk/credential-provider-env - fromEnv");const t=process.env[Ti],n=process.env[Ii],r=process.env[Ci],o=process.env[ki],s=process.env[_i],i=process.env[Ri];if(t&&n)return{accessKeyId:t,secretAccessKey:n,...r&&{sessionToken:r},...o&&{expiration:new Date(o)},...s&&{credentialScope:s},...i&&{accountId:i}};throw new He("Unable to find environment variable credentials.",{logger:e?.logger})};var $i=Object.freeze({__proto__:null,ENV_ACCOUNT_ID:Ri,ENV_CREDENTIAL_SCOPE:_i,ENV_EXPIRATION:ki,ENV_KEY:Ti,ENV_SECRET:Ii,ENV_SESSION:Ci,fromEnv:Oi});let Ni=!1;const Di=(e={})=>Ge(Ke((async()=>{if(e.profile??process.env[Ze]){if(process.env[Ti]&&process.env[Ii]&&!Ni){(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"),Ni=!0}throw new He("AWS_PROFILE is set, skipping fromEnv provider.",{logger:e.logger,tryNextLink:!0})}return e.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromEnv"),Oi(e)()}),(async()=>{e.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromSSO");const{ssoStartUrl:t,ssoAccountId:n,ssoRegion:r,ssoRoleName:o,ssoSession:s}=e;if(!(t||n||r||o||s))throw new He("Skipping SSO provider in default chain (inputs do not include SSO fields).",{logger:e.logger});const{fromSSO:i}=await Promise.resolve().then((function(){return pl}));return i(e)()}),(async()=>{e.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromIni");const{fromIni:t}=await Promise.resolve().then((function(){return bl}));return t(e)()}),(async()=>{e.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromProcess");const{fromProcess:t}=await Promise.resolve().then((function(){return Sl}));return t(e)()}),(async()=>{e.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromTokenFile");const{fromTokenFile:t}=await Promise.resolve().then((function(){return xl}));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:o}=await Promise.resolve().then((function(){return Yc}));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 Qc}));return Ke(t(e),r(e))}return process.env.AWS_EC2_METADATA_DISABLED?async()=>{throw new He("EC2 Instance Metadata Service access disabled",{logger:e.logger})}:(e.logger?.debug("@aws-sdk/credential-provider-node - remoteProvider::fromInstanceMetadata"),o(e))})(e))())),(async()=>{throw new He("Could not load credentials from any providers",{tryNextLink:!1,logger:e.logger})})),Li,ji),ji=e=>void 0!==e?.expiration,Li=e=>void 0!==e?.expiration&&e.expiration.getTime()-Date.now()<3e5,Mi=({serviceId:e,clientVersion:t})=>{const n=[["aws-sdk-js",t],["ua","2.0"],[`os/${u()}`,d()],["lang/js"],["md/nodejs",`${x.node}`]];e&&n.push([`api/${e}`,t]),A.AWS_EXECUTION_ENV&&n.push([`exec-env/${A.AWS_EXECUTION_ENV}`]);const r=vt({environmentVariableSelector:e=>e.AWS_SDK_UA_APP_ID,configFileSelector:e=>e["sdk-ua-app-id"],default:void 0})();let o;return async()=>{if(!o){const e=await r;o=e?[...n,[`app/${e}`]]:[...n]}return o}};class Ui{constructor(e,t){this.algorithmIdentifier=e,this.secret=t,this.reset()}update(e,t){this.hash.update(Sn(Fi(e,t)))}digest(){return Promise.resolve(this.hash.digest())}reset(){this.hash=this.secret?g(this.algorithmIdentifier,Fi(this.secret)):f(this.algorithmIdentifier)}}function Fi(t,n){return e.isBuffer(t)?t:"string"==typeof t?yn(t,n):ArrayBuffer.isView(t)?mn(t.buffer,t.byteOffset,t.byteLength):mn(t)}const zi=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 y(e.path).size;if("number"==typeof e.fd)return w(e.fd).size;throw new Error(`Body Length computation failed for ${e}`)},qi="required",Wi="fn",Bi="argv",Hi="ref",Vi=!0,Ki="isSet",Gi="booleanEquals",Xi="error",Ji="endpoint",Yi="tree",Zi="PartitionResult",Qi={[qi]:!1,type:"String"},ea={[qi]:!0,default:!1,type:"Boolean"},ta={[Hi]:"Endpoint"},na={[Wi]:Gi,[Bi]:[{[Hi]:"UseFIPS"},!0]},ra={[Wi]:Gi,[Bi]:[{[Hi]:"UseDualStack"},!0]},oa={},sa={[Wi]:"getAttr",[Bi]:[{[Hi]:Zi},"supportsFIPS"]},ia={[Wi]:Gi,[Bi]:[!0,{[Wi]:"getAttr",[Bi]:[{[Hi]:Zi},"supportsDualStack"]}]},aa=[na],ca=[ra],la=[{[Hi]:"Region"}],ua={version:"1.0",parameters:{Region:Qi,UseDualStack:ea,UseFIPS:ea,Endpoint:Qi},rules:[{conditions:[{[Wi]:Ki,[Bi]:[ta]}],rules:[{conditions:aa,error:"Invalid Configuration: FIPS and custom endpoint are not supported",type:Xi},{conditions:ca,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",type:Xi},{endpoint:{url:ta,properties:oa,headers:oa},type:Ji}],type:Yi},{conditions:[{[Wi]:Ki,[Bi]:la}],rules:[{conditions:[{[Wi]:"aws.partition",[Bi]:la,assign:Zi}],rules:[{conditions:[na,ra],rules:[{conditions:[{[Wi]:Gi,[Bi]:[Vi,sa]},ia],rules:[{endpoint:{url:"https://translate-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:oa,headers:oa},type:Ji}],type:Yi},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",type:Xi}],type:Yi},{conditions:aa,rules:[{conditions:[{[Wi]:Gi,[Bi]:[sa,Vi]}],rules:[{endpoint:{url:"https://translate-fips.{Region}.{PartitionResult#dnsSuffix}",properties:oa,headers:oa},type:Ji}],type:Yi},{error:"FIPS is enabled but this partition does not support FIPS",type:Xi}],type:Yi},{conditions:ca,rules:[{conditions:[ia],rules:[{endpoint:{url:"https://translate.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:oa,headers:oa},type:Ji}],type:Yi},{error:"DualStack is enabled but this partition does not support DualStack",type:Xi}],type:Yi},{endpoint:{url:"https://translate.{Region}.{PartitionResult#dnsSuffix}",properties:oa,headers:oa},type:Ji}],type:Yi}],type:Yi},{error:"Invalid Configuration: Missing Region",type:Xi}]},da=(e,t={})=>ge(ua,{endpointParams:e,logger:t.logger});X.aws=we;const pa="AWS_REGION",ha="AWS_DEFAULT_REGION",fa=["in-region","cross-region","mobile","standard","legacy"],ga={environmentVariableSelector:e=>e.AWS_DEFAULTS_MODE,configFileSelector:e=>e.defaults_mode,default:"legacy"},ma=({region:e=vt(Oe),defaultsMode:t=vt(ga)}={})=>Ge((async()=>{const n="function"==typeof t?await t():t;switch(n?.toLowerCase()){case"auto":return ya(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 ${fa.join(", ")}, got ${n}`)}})),ya=async e=>{if(e){const t="function"==typeof e?await e():e,n=await wa();return n?t===n?"in-region":"cross-region":"standard"}return"standard"},wa=async()=>{if(process.env.AWS_EXECUTION_ENV&&(process.env[pa]||process.env[ha]))return process.env[pa]??process.env[ha];if(!process.env.AWS_EC2_METADATA_DISABLED)try{const{getInstanceMetadataEndpoint:e,httpRequest:t}=await Promise.resolve().then((function(){return Yc})),n=await e();return(await t({...n,path:"/latest/meta-data/placement/region"})).toString()}catch(e){}},ba=e=>{Tr(process.version);const t=ma(e),n=()=>t().then(Ar),r=(e=>({apiVersion:"2017-07-01",base64Decoder:e?.base64Decoder??bn,base64Encoder:e?.base64Encoder??xn,disableHostPrefix:e?.disableHostPrefix??!1,endpointProvider:e?.endpointProvider??da,extensions:e?.extensions??[],httpAuthSchemeProvider:e?.httpAuthSchemeProvider??xi,httpAuthSchemes:e?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4"),signer:new mo}],logger:e?.logger??new cn,serviceId:e?.serviceId??"Translate",urlParser:e?.urlParser??At,utf8Decoder:e?.utf8Decoder??vn,utf8Encoder:e?.utf8Encoder??En}))(e);return uo(process.version),{...r,...e,runtime:"node",defaultsMode:t,bodyLengthChecker:e?.bodyLengthChecker??zi,credentialDefaultProvider:e?.credentialDefaultProvider??Di,defaultUserAgentProvider:e?.defaultUserAgentProvider??Mi({serviceId:r.serviceId,clientVersion:Pi}),maxAttempts:e?.maxAttempts??vt(on),region:e?.region??vt(Oe,$e),requestHandler:_n.create(e?.requestHandler??n),retryMode:e?.retryMode??vt({...an,default:async()=>(await n()).retryMode||Ut}),sha256:e?.sha256??Ui.bind(null,"sha256"),streamCollector:e?.streamCollector??On,useDualstackEndpoint:e?.useDualstackEndpoint??vt(Ce),useFipsEndpoint:e?.useFipsEndpoint??vt(ke)}},va=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}},Sa=e=>({region:e.region()}),Ea=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 xa extends fn{constructor(...[e]){const t=ba(e||{});var n;const r=B((n=t,{...n,useDualstackEndpoint:n.useDualstackEndpoint??!1,useFipsEndpoint:n.useFipsEndpoint??!1,defaultSigningName:"translate"})),o=sn(r),s=je(o),i=$t(s);const a=((e,t)=>{const n={...va(e),...Rr(e),...P(e),...Ea(e)};return t.forEach((e=>e.configure(n))),{...e,...Sa(n),...Or(n),...T(n),...(r=n,{httpAuthSchemes:r.httpAuthSchemes(),httpAuthSchemeProvider:r.httpAuthSchemeProvider(),credentials:r.credentials()})};var r})({...Go(i)},e?.extensions||[]);super(a),this.config=a,this.middlewareStack.use(Pe(this.config)),this.middlewareStack.use(Gr(this.config)),this.middlewareStack.use(co(this.config)),this.middlewareStack.use(M(this.config)),this.middlewareStack.use(F(this.config)),this.middlewareStack.use(W(this.config)),this.middlewareStack.use(Dt(this.config,{httpAuthSchemeParametersProvider:Ei,identityProviderConfigProvider:async e=>new Zr({"aws.auth#sigv4":e.credentials})})),this.middlewareStack.use(Yr(this.config))}destroy(){super.destroy()}}class Aa extends vr{constructor(e){super(e),Object.setPrototypeOf(this,Aa.prototype)}}class Pa extends Aa{constructor(e){super({name:"ConcurrentModificationException",$fault:"client",...e}),this.name="ConcurrentModificationException",this.$fault="client",Object.setPrototypeOf(this,Pa.prototype),this.Message=e.Message}}class Ta extends Aa{constructor(e){super({name:"ConflictException",$fault:"client",...e}),this.name="ConflictException",this.$fault="client",Object.setPrototypeOf(this,Ta.prototype),this.Message=e.Message}}let Ia=class e extends Aa{constructor(t){super({name:"InternalServerException",$fault:"server",...t}),this.name="InternalServerException",this.$fault="server",Object.setPrototypeOf(this,e.prototype),this.Message=t.Message}};class Ca extends Aa{constructor(e){super({name:"InvalidParameterValueException",$fault:"client",...e}),this.name="InvalidParameterValueException",this.$fault="client",Object.setPrototypeOf(this,Ca.prototype),this.Message=e.Message}}let ka=class e extends Aa{constructor(t){super({name:"InvalidRequestException",$fault:"client",...t}),this.name="InvalidRequestException",this.$fault="client",Object.setPrototypeOf(this,e.prototype),this.Message=t.Message}};class _a extends Aa{constructor(e){super({name:"LimitExceededException",$fault:"client",...e}),this.name="LimitExceededException",this.$fault="client",Object.setPrototypeOf(this,_a.prototype),this.Message=e.Message}}let Ra=class e extends Aa{constructor(t){super({name:"TooManyRequestsException",$fault:"client",...t}),this.name="TooManyRequestsException",this.$fault="client",Object.setPrototypeOf(this,e.prototype),this.Message=t.Message}};class Oa extends Aa{constructor(e){super({name:"TooManyTagsException",$fault:"client",...e}),this.name="TooManyTagsException",this.$fault="client",Object.setPrototypeOf(this,Oa.prototype),this.ResourceArn=e.ResourceArn}}let $a=class e extends Aa{constructor(t){super({name:"ResourceNotFoundException",$fault:"client",...t}),this.name="ResourceNotFoundException",this.$fault="client",Object.setPrototypeOf(this,e.prototype),this.Message=t.Message}};class Na extends Aa{constructor(e){super({name:"UnsupportedDisplayLanguageCodeException",$fault:"client",...e}),this.name="UnsupportedDisplayLanguageCodeException",this.$fault="client",Object.setPrototypeOf(this,Na.prototype),this.Message=e.Message,this.DisplayLanguageCode=e.DisplayLanguageCode}}class Da extends Aa{constructor(e){super({name:"InvalidFilterException",$fault:"client",...e}),this.name="InvalidFilterException",this.$fault="client",Object.setPrototypeOf(this,Da.prototype),this.Message=e.Message}}class ja extends Aa{constructor(e){super({name:"UnsupportedLanguagePairException",$fault:"client",...e}),this.name="UnsupportedLanguagePairException",this.$fault="client",Object.setPrototypeOf(this,ja.prototype),this.Message=e.Message,this.SourceLanguageCode=e.SourceLanguageCode,this.TargetLanguageCode=e.TargetLanguageCode}}class La extends Aa{constructor(e){super({name:"ServiceUnavailableException",$fault:"server",...e}),this.name="ServiceUnavailableException",this.$fault="server",Object.setPrototypeOf(this,La.prototype),this.Message=e.Message}}class Ma extends Aa{constructor(e){super({name:"DetectedLanguageLowConfidenceException",$fault:"client",...e}),this.name="DetectedLanguageLowConfidenceException",this.$fault="client",Object.setPrototypeOf(this,Ma.prototype),this.Message=e.Message,this.DetectedLanguageCode=e.DetectedLanguageCode}}class Ua extends Aa{constructor(e){super({name:"TextSizeLimitExceededException",$fault:"client",...e}),this.name="TextSizeLimitExceededException",this.$fault="client",Object.setPrototypeOf(this,Ua.prototype),this.Message=e.Message}}const Fa=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(qr(e)),ic(t,n,"/",void 0,r)},za=async(e,t)=>{if(e.statusCode>=300)return qa(e,t);const n=await Jo(e.body,t);let r={};r=qr(n);return{$metadata:oc(e),...r}},qa=async(e,t)=>{const n={...e,body:await Yo(e.body,t)},r=Zo(e,n.body);switch(r){case"ConcurrentModificationException":case"com.amazonaws.translate#ConcurrentModificationException":throw await Wa(n);case"ConflictException":case"com.amazonaws.translate#ConflictException":throw await Ba(n);case"InternalServerException":case"com.amazonaws.translate#InternalServerException":throw await Va(n);case"InvalidParameterValueException":case"com.amazonaws.translate#InvalidParameterValueException":throw await Ga(n);case"InvalidRequestException":case"com.amazonaws.translate#InvalidRequestException":throw await Xa(n);case"LimitExceededException":case"com.amazonaws.translate#LimitExceededException":throw await Ja(n);case"TooManyRequestsException":case"com.amazonaws.translate#TooManyRequestsException":throw await ec(n);case"TooManyTagsException":case"com.amazonaws.translate#TooManyTagsException":throw await tc(n);case"ResourceNotFoundException":case"com.amazonaws.translate#ResourceNotFoundException":throw await Ya(n);case"UnsupportedDisplayLanguageCodeException":case"com.amazonaws.translate#UnsupportedDisplayLanguageCodeException":throw await nc(n);case"InvalidFilterException":case"com.amazonaws.translate#InvalidFilterException":throw await Ka(n);case"UnsupportedLanguagePairException":case"com.amazonaws.translate#UnsupportedLanguagePairException":throw await rc(n);case"ServiceUnavailableException":case"com.amazonaws.translate#ServiceUnavailableException":throw await Za(n);case"DetectedLanguageLowConfidenceException":case"com.amazonaws.translate#DetectedLanguageLowConfidenceException":throw await Ha(n);case"TextSizeLimitExceededException":case"com.amazonaws.translate#TextSizeLimitExceededException":throw await Qa(n);default:const t=n.body;return sc({output:e,parsedBody:t,errorCode:r})}},Wa=async(e,t)=>{const n=e.body,r=qr(n),o=new Pa({$metadata:oc(e),...r});return Sr(o,n)},Ba=async(e,t)=>{const n=e.body,r=qr(n),o=new Ta({$metadata:oc(e),...r});return Sr(o,n)},Ha=async(e,t)=>{const n=e.body,r=qr(n),o=new Ma({$metadata:oc(e),...r});return Sr(o,n)},Va=async(e,t)=>{const n=e.body,r=qr(n),o=new Ia({$metadata:oc(e),...r});return Sr(o,n)},Ka=async(e,t)=>{const n=e.body,r=qr(n),o=new Da({$metadata:oc(e),...r});return Sr(o,n)},Ga=async(e,t)=>{const n=e.body,r=qr(n),o=new Ca({$metadata:oc(e),...r});return Sr(o,n)},Xa=async(e,t)=>{const n=e.body,r=qr(n),o=new ka({$metadata:oc(e),...r});return Sr(o,n)},Ja=async(e,t)=>{const n=e.body,r=qr(n),o=new _a({$metadata:oc(e),...r});return Sr(o,n)},Ya=async(e,t)=>{const n=e.body,r=qr(n),o=new $a({$metadata:oc(e),...r});return Sr(o,n)},Za=async(e,t)=>{const n=e.body,r=qr(n),o=new La({$metadata:oc(e),...r});return Sr(o,n)},Qa=async(e,t)=>{const n=e.body,r=qr(n),o=new Ua({$metadata:oc(e),...r});return Sr(o,n)},ec=async(e,t)=>{const n=e.body,r=qr(n),o=new Ra({$metadata:oc(e),...r});return Sr(o,n)},tc=async(e,t)=>{const n=e.body,r=qr(n),o=new Oa({$metadata:oc(e),...r});return Sr(o,n)},nc=async(e,t)=>{const n=e.body,r=qr(n),o=new Na({$metadata:oc(e),...r});return Sr(o,n)},rc=async(e,t)=>{const n=e.body,r=qr(n),o=new ja({$metadata:oc(e),...r});return Sr(o,n)},oc=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"]}),sc=Er(Aa),ic=async(e,t,n,r,o)=>{const{hostname:s,protocol:i="https",port:a,path:c}=await e.endpoint(),l={protocol:i,hostname:s,port:a,method:"POST",path:c.endsWith("/")?c.slice(0,-1)+n:c+n,headers:t};return void 0!==o&&(l.body=o),new D(l)};class ac extends(Wn.classBuilder().ep({...Ai}).m((function(e,t,n,r){return[_t(n,this.serialize,this.deserialize),Ot(n,e.getEndpointParameterInstructions())]})).s("AWSShineFrontendService_20170701","TranslateText",{}).n("TranslateClient","TranslateTextCommand").f(void 0,void 0).ser(Fa).de(za).build()){}var cc={exports:{}};var lc,uc,dc={exports:{}};function pc(){return lc||(lc=1,dc.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!==Qo&&Qo.crypto&&(n=Qo.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.")},o=Object.create||function(){function e(){}return function(t){var n;return e.prototype=t,n=new e,e.prototype=null,n}}(),s={},i=s.lib={},a=i.Base={extend:function(e){var t=o(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,o=e.sigBytes;if(this.clamp(),r%4)for(var s=0;s<o;s++){var i=n[s>>>2]>>>24-s%4*8&255;t[r+s>>>2]|=i<<24-(r+s)%4*8}else for(var a=0;a<o;a+=4)t[r+a>>>2]=n[a>>>2];return this.sigBytes+=o,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=s.enc={},u=l.Hex={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],o=0;o<n;o++){var s=t[o>>>2]>>>24-o%4*8&255;r.push((s>>>4).toString(16)),r.push((15&s).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=[],o=0;o<n;o++){var s=t[o>>>2]>>>24-o%4*8&255;r.push(String.fromCharCode(s))}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,o=r.words,s=r.sigBytes,i=this.blockSize,a=s/(4*i),l=(a=t?e.ceil(a):e.max((0|a)-this._minBufferSize,0))*i,u=e.min(4*l,s);if(l){for(var d=0;d<l;d+=i)this._doProcessBlock(o,d);n=o.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=s.algo={};return s}(Math),e)),dc.exports;var e}cc.exports=(uc=pc(),function(e){var t=uc,n=t.lib,r=n.WordArray,o=n.Hasher,s=t.algo,i=[];!function(){for(var t=0;t<64;t++)i[t]=4294967296*e.abs(e.sin(t+1))|0}();var a=s.MD5=o.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,o=e[r];e[r]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8)}var s=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=s[0],C=s[1],k=s[2],_=s[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]),s[0]=s[0]+I|0,s[1]=s[1]+C|0,s[2]=s[2]+k|0,s[3]=s[3]+_|0},_doFinalize:function(){var t=this._data,n=t.words,r=8*this._nDataBytes,o=8*t.sigBytes;n[o>>>5]|=128<<24-o%32;var s=e.floor(r/4294967296),i=r;n[15+(o+64>>>9<<4)]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),n[14+(o+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=o.clone.call(this);return e._hash=this._hash.clone(),e}});function c(e,t,n,r,o,s,i){var a=e+(t&n|~t&r)+o+i;return(a<<s|a>>>32-s)+t}function l(e,t,n,r,o,s,i){var a=e+(t&r|n&~r)+o+i;return(a<<s|a>>>32-s)+t}function u(e,t,n,r,o,s,i){var a=e+(t^n^r)+o+i;return(a<<s|a>>>32-s)+t}function d(e,t,n,r,o,s,i){var a=e+(n^(t|~r))+o+i;return(a<<s|a>>>32-s)+t}t.MD5=o._createHelper(a),t.HmacMD5=o._createHmacHelper(a)}(Math),uc.MD5);var hc=es(cc.exports);const fc={google:function(e){return{name:"google",async translate(e,t){const{from:n,to:r}=t;Array.isArray(e)||(e=[e]);const o=e.join("\n"),s=`https://translate.googleapis.com/translate_a/single?client=gtx&sl=${n}&tl=${r}&dt=t&q=${encodeURI(o)}`,i=await fetch(s),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:o,to:s}=r,i=`https://api.cognitive.microsofttranslator.com/translate?api-version=3.0&from=${o}&to=${s}`;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,o){const{from:s,to:i}=o,a=new xa({region:t,credentials:{accessKeyId:n,secretAccessKey:r}});Array.isArray(e)||(e=[e]);const c=new ac({SourceLanguageCode:s,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:o,from:s,domain:i="it"}=r;Array.isArray(e)||(e=[e]);const a=e.join("\n"),c=Date.now(),l=hc(`${t}${a}${c}${i}${n}`).toString(),u=new URLSearchParams;u.append("q",a),u.append("from",s),u.append("to",o),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 gc=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 mc(e){if(e.length>100)throw new Error(`The "language" is too long at ${e.length} characters`);if(!gc.includes(e))throw new Error(`The language "${e}" is not part of the ISO 639-1`);return e}class yc{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 o={value:t,expire:Date.now()+n};isNaN(o.expire)||(o.timeout=setTimeout((()=>this.del(e)),n)),this.cache.set(e,o)}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 wc=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)}}}(),bc=new yc;const vc=new class{engines;constructor(){this.engines=new Map}use(e){this.engines.has(e.name)?wc.warn("Engine already exists"):this.engines.set(e.name,e)}translate(e,t){const{from:n,to:r,engine:o="google",cache_time:s=6e4}=t;if(!this.engines.has(o))throw new Error(`Engine ${o} not found`);if(!mc(n))throw new Error(`Language ${n} not found`);if(!mc(r))throw new Error(`Language ${r} not found`);const i=`${n}:${r}:${o}:${e}`;if(bc.get(i))return bc.get(i)?.value;const a=this.engines.get(o);if(!a)throw new Error(`Engine ${o} not found`);return a.translate(e,t).then((e=>(bc.set(i,e,s),e)))}};var Sc={engines:fc,translator:vc};function Ec(t){return new Promise(((n,r)=>{const s=o({method:"GET",...t,hostname:t.hostname?.replace(/^\[(.+)\]$/,"$1")});s.on("error",(e=>{r(Object.assign(new Be("Unable to connect to instance metadata service"),e)),s.destroy()})),s.on("timeout",(()=>{r(new Be("TimeoutError from instance metadata service")),s.destroy()})),s.on("response",(t=>{const{statusCode:o=400}=t;(o<200||300<=o)&&(r(Object.assign(new Be("Error response received from instance metadata service"),{statusCode:o})),s.destroy());const i=[];t.on("data",(e=>{i.push(e)})),t.on("end",(()=>{n(e.concat(i)),s.destroy()}))})),s.end()}))}const xc=e=>Boolean(e)&&"object"==typeof e&&"string"==typeof e.AccessKeyId&&"string"==typeof e.SecretAccessKey&&"string"==typeof e.Token&&"string"==typeof e.Expiration,Ac=e=>({accessKeyId:e.AccessKeyId,secretAccessKey:e.SecretAccessKey,sessionToken:e.Token,expiration:new Date(e.Expiration),...e.AccountId&&{accountId:e.AccountId}}),Pc=({maxRetries:e=0,timeout:t=1e3})=>({maxRetries:e,timeout:t}),Tc=(e,t)=>{let n=e();for(let r=0;r<t;r++)n=n.catch(e);return n},Ic="AWS_CONTAINER_CREDENTIALS_FULL_URI",Cc="AWS_CONTAINER_CREDENTIALS_RELATIVE_URI",kc="AWS_CONTAINER_AUTHORIZATION_TOKEN",_c=async(e,t)=>{process.env[kc]&&(t.headers={...t.headers,Authorization:process.env[kc]});return(await Ec({...t,timeout:e})).toString()},Rc={localhost:!0,"127.0.0.1":!0},Oc={"http:":!0,"https:":!0},$c=async({logger:e})=>{if(process.env[Cc])return{hostname:"169.254.170.2",path:process.env[Cc]};if(process.env[Ic]){const t=v(process.env[Ic]);if(!t.hostname||!(t.hostname in Rc))throw new He(`${t.hostname} is not a valid container metadata service hostname`,{tryNextLink:!1,logger:e});if(!t.protocol||!(t.protocol in Oc))throw new He(`${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 He(`The container metadata credential provider cannot be used unless the ${Cc} or ${Ic} environment variable is set`,{tryNextLink:!1,logger:e})};class Nc extends He{constructor(e,t=!0){super(e,t),this.tryNextLink=t,this.name="InstanceMetadataV1FallbackError",Object.setPrototypeOf(this,Nc.prototype)}}var Dc;!function(e){e.IPv4="http://169.254.169.254",e.IPv6="http://[fd00:ec2::254]"}(Dc||(Dc={}));const jc={environmentVariableSelector:e=>e.AWS_EC2_METADATA_SERVICE_ENDPOINT,configFileSelector:e=>e.ec2_metadata_service_endpoint,default:void 0};var Lc;!function(e){e.IPv4="IPv4",e.IPv6="IPv6"}(Lc||(Lc={}));const Mc={environmentVariableSelector:e=>e.AWS_EC2_METADATA_SERVICE_ENDPOINT_MODE,configFileSelector:e=>e.ec2_metadata_service_endpoint_mode,default:Lc.IPv4},Uc=async()=>At(await Fc()||await zc()),Fc=async()=>vt(jc)(),zc=async()=>{const e=await vt(Mc)();switch(e){case Lc.IPv4:return Dc.IPv4;case Lc.IPv6:return Dc.IPv6;default:throw new Error(`Unsupported endpoint mode: ${e}. Select from ${Object.values(Lc)}`)}},qc=(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 o=e.originalExpiration??e.expiration;return{...e,...o?{originalExpiration:o}:{},expiration:r}},Wc="/latest/meta-data/iam/security-credentials/",Bc="AWS_EC2_METADATA_V1_DISABLED",Hc="ec2_metadata_v1_disabled",Vc="x-aws-ec2-metadata-token",Kc=(e={})=>{let t=!1;const{logger:n,profile:r}=e,{timeout:o,maxRetries:s}=Pc(e),i=async(n,o)=>{if(t||null==o.headers?.[Vc]){let t=!1,n=!1;const o=await vt({environmentVariableSelector:t=>{const r=t[Bc];if(n=!!r&&"false"!==r,void 0===r)throw new He(`${Bc} not set in env, checking config file next.`,{logger:e.logger});return n},configFileSelector:e=>{const n=e[Hc];return t=!!n&&"false"!==n,t},default:!1},{profile:r})();if(e.ec2MetadataV1Disabled||o){const r=[];throw e.ec2MetadataV1Disabled&&r.push("credential provider initialization (runtime option ec2MetadataV1Disabled)"),t&&r.push(`config file profile (${Hc})`),n&&r.push(`process environment variable (${Bc})`),new Nc(`AWS EC2 Metadata v1 fallback has been blocked by AWS SDK configuration in the following: [${r.join(", ")}].`)}}const s=(await Tc((async()=>{let e;try{e=await Xc(o)}catch(e){throw 401===e.statusCode&&(t=!1),e}return e}),n)).trim();return Tc((async()=>{let n;try{n=await Jc(s,o,e)}catch(e){throw 401===e.statusCode&&(t=!1),e}return n}),n)};return async()=>{const e=await Uc();if(t)return n?.debug("AWS SDK Instance Metadata","using v1 fallback (no token fetch)"),i(s,{...e,timeout:o});{let r;try{r=(await Gc({...e,timeout:o})).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(s,{...e,timeout:o})}return i(s,{...e,headers:{[Vc]:r},timeout:o})}}},Gc=async e=>Ec({...e,path:"/latest/api/token",method:"PUT",headers:{"x-aws-ec2-metadata-token-ttl-seconds":"21600"}}),Xc=async e=>(await Ec({...e,path:Wc})).toString(),Jc=async(e,t,n)=>{const r=JSON.parse((await Ec({...t,path:Wc+e})).toString());if(!xc(r))throw new He("Invalid response received from instance metadata service.",{logger:n.logger});return Ac(r)};var Yc=Object.freeze({__proto__:null,DEFAULT_MAX_RETRIES:0,DEFAULT_TIMEOUT:1e3,ENV_CMDS_AUTH_TOKEN:kc,ENV_CMDS_FULL_URI:Ic,ENV_CMDS_RELATIVE_URI:Cc,get Endpoint(){return Dc},fromContainerMetadata:(e={})=>{const{timeout:t,maxRetries:n}=Pc(e);return()=>Tc((async()=>{const n=await $c({logger:e.logger}),r=JSON.parse(await _c(t,n));if(!xc(r))throw new He("Invalid response received from instance metadata service.",{logger:e.logger});return Ac(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=qc(t,n))}catch(e){if(!r)throw e;n.warn("Credential renew failed: ",e),t=qc(r,n)}return r=t,t}})(Kc(e),{logger:e.logger}),getInstanceMetadataEndpoint:Uc,httpRequest:Ec,providerConfigFromInit:Pc});async function Zc(e,n){const r=(e=>{if(!(e instanceof t))try{return Fn(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(qn);return n=!0,await On(e)};return Object.assign(e,{transformToByteArray:r,transformToString:async e=>{const t=await r();return void 0===e||Buffer.isEncoding(e)?mn(t.buffer,t.byteOffset,t.byteLength).toString(e):new a(e).decode(t)},transformToWebStream:()=>{if(n)throw new Error(qn);if(null!==e.readableFlowing)throw new Error("The stream has been consumed by other callbacks.");if("function"!=typeof t.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.toWeb(e)}})})(e.body),o=await r.transformToString();if(200===e.statusCode){const e=JSON.parse(o);if("string"!=typeof e.AccessKeyId||"string"!=typeof e.SecretAccessKey||"string"!=typeof e.Token||"string"!=typeof e.Expiration)throw new He("HTTP credential provider response not of the required format, an object matching: { AccessKeyId: string, SecretAccessKey: string, Token: string, Expiration: string(rfc3339) }",{logger:n});return{accessKeyId:e.AccessKeyId,secretAccessKey:e.SecretAccessKey,sessionToken:e.Token,expiration:ur(e.Expiration)}}if(e.statusCode>=400&&e.statusCode<500){let t={};try{t=JSON.parse(o)}catch(e){}throw Object.assign(new He(`Server responded with status: ${e.statusCode}`,{logger:n}),{Code:t.Code,Message:t.Message})}throw new He(`Server responded with status: ${e.statusCode}`,{logger:n})}var Qc=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,o=e.awsContainerAuthorizationToken??process.env.AWS_CONTAINER_AUTHORIZATION_TOKEN,s=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.")),o&&s&&(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 He("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 He("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 _n({requestTimeout:e.timeout??1e3,connectionTimeout:e.timeout??1e3});return l=async()=>{const t=function(e){return new D({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);o?t.headers.Authorization=o:s&&(t.headers.Authorization=(await S.readFile(s)).toString());try{return Zc((await c.handle(t)).response)}catch(t){throw new He(String(t),{logger:e.logger})}},u=e.maxRetries??3,d=e.timeout??1e3,async()=>{for(let e=0;e<u;++e)try{return await l()}catch(e){await new Promise((e=>setTimeout(e,d)))}return await l()};var l,u,d}});const el=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),tl="To refresh this SSO session run 'aws sso login' with the corresponding profile.",nl={},rl=async(e,t)=>{const{CreateTokenCommand:n}=await Promise.resolve().then((function(){return Uu})),r=await(async e=>{const{SSOOIDCClient:t}=await Promise.resolve().then((function(){return Uu}));if(nl[e])return nl[e];const n=new t({region:e});return nl[e]=n,n})(t);return r.send(new n({clientId:e.clientId,clientSecret:e.clientSecret,refreshToken:e.refreshToken,grantType:"refresh_token"}))},ol=e=>{if(e.expiration&&e.expiration.getTime()<Date.now())throw new Ve(`Token is expired. ${tl}`,!1)},sl=(e,t,n=!1)=>{if(void 0===t)throw new Ve(`Value not present for '${e}' in SSO Token${n?". Cannot refresh":""}. ${tl}`,!1)},{writeFile:il}=m,al=new Date(0),cl=(e={})=>async()=>{e.logger?.debug("@aws-sdk/token-providers - fromSso");const t=await wt(e),n=Qe(e),r=t[n];if(!r)throw new Ve(`Profile '${n}' could not be found in shared credentials file.`,!1);if(!r.sso_session)throw new Ve(`Profile '${n}' is missing required property 'sso_session'.`);const o=r.sso_session,s=(await yt(e))[o];if(!s)throw new Ve(`Sso session '${o}' could not be found in shared credentials file.`,!1);for(const e of["sso_start_url","sso_region"])if(!s[e])throw new Ve(`Sso session '${o}' is missing required property '${e}'.`,!1);s.sso_start_url;const i=s.sso_region;let a;try{a=await nt(o)}catch(e){throw new Ve(`The SSO session token associated with profile=${n} was not found or is invalid. ${tl}`,!1)}sl("accessToken",a.accessToken),sl("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()-al.getTime()<3e4)return ol(u),u;sl("clientId",a.clientId,!0),sl("clientSecret",a.clientSecret,!0),sl("refreshToken",a.refreshToken,!0);try{al.setTime(Date.now());const e=await rl(a,i);sl("accessToken",e.accessToken),sl("expiresIn",e.expiresIn);const t=new Date(Date.now()+1e3*e.expiresIn);try{await((e,t)=>{const n=et(e),r=JSON.stringify(t,null,2);return il(n,r)})(o,{...a,accessToken:e.accessToken,expiresAt:t.toISOString(),refreshToken:e.refreshToken})}catch(e){}return{token:e.accessToken,expiration:t}}catch(e){return ol(u),u}},ll=!1,ul=async({ssoStartUrl:e,ssoSession:t,ssoAccountId:n,ssoRegion:r,ssoRoleName:o,ssoClient:s,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 cl({profile:a})();l={accessToken:e.token,expiresAt:new Date(e.expiration).toISOString()}}catch(e){throw new He(e.message,{tryNextLink:ll,logger:c})}else try{l=await nt(e)}catch(e){throw new He(`The SSO session associated with this profile is invalid. ${u}`,{tryNextLink:ll,logger:c})}if(new Date(l.expiresAt).getTime()-Date.now()<=0)throw new He(`The SSO session associated with this profile has expired. ${u}`,{tryNextLink:ll,logger:c});const{accessToken:d}=l,{SSOClient:p,GetRoleCredentialsCommand:h}=await Promise.resolve().then((function(){return Wd})),f=s||new p(Object.assign({},i??{},{region:i?.region??r}));let g;try{g=await f.send(new h({accountId:n,roleName:o,accessToken:d}))}catch(e){throw new He(e,{tryNextLink:ll,logger:c})}const{roleCredentials:{accessKeyId:m,secretAccessKey:y,sessionToken:w,expiration:b,credentialScope:v,accountId:S}={}}=g;if(!(m&&y&&w&&b))throw new He("SSO returns an invalid temporary credential.",{tryNextLink:ll,logger:c});return{accessKeyId:m,secretAccessKey:y,sessionToken:w,expiration:new Date(b),...v&&{credentialScope:v},...S&&{accountId:S}}},dl=(e,t)=>{const{sso_start_url:n,sso_account_id:r,sso_region:o,sso_role_name:s}=e;if(!(n&&r&&o&&s))throw new He(`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 pl=Object.freeze({__proto__:null,fromSSO:(e={})=>async()=>{e.logger?.debug("@aws-sdk/credential-provider-sso - fromSSO");const{ssoStartUrl:t,ssoAccountId:n,ssoRegion:r,ssoRoleName:o,ssoSession:s}=e,{ssoClient:i}=e,a=Qe(e);if(t||n||r||o||s){if(t&&n&&r&&o)return ul({ssoStartUrl:t,ssoSession:s,ssoAccountId:n,ssoRegion:r,ssoRoleName:o,ssoClient:i,clientConfig:e.clientConfig,profile:a});throw new He('Incomplete configuration. The fromSSO() argument hash must include "ssoStartUrl", "ssoAccountId", "ssoRegion", "ssoRoleName"',{tryNextLink:!1,logger:e.logger})}{const n=(await wt(e))[a];if(!n)throw new He(`Profile ${a} was not found.`,{logger:e.logger});if(!el(n))throw new He(`Profile ${a} is not configured with SSO credentials.`,{logger:e.logger});if(n?.sso_session){const o=(await yt(e))[n.sso_session],s=` configurations in profile ${a} and sso-session ${n.sso_session}`;if(r&&r!==o.sso_region)throw new He("Conflicting SSO region"+s,{tryNextLink:!1,logger:e.logger});if(t&&t!==o.sso_start_url)throw new He("Conflicting SSO start_url"+s,{tryNextLink:!1,logger:e.logger});n.sso_region=o.sso_region,n.sso_start_url=o.sso_start_url}const{sso_start_url:o,sso_account_id:s,sso_region:c,sso_role_name:l,sso_session:u}=dl(n,e.logger);return ul({ssoStartUrl:o,ssoSession:u,ssoAccountId:s,ssoRegion:c,ssoRoleName:l,ssoClient:i,clientConfig:e.clientConfig,profile:a})}},isSsoProfile:el,validateSsoProfile:dl});const hl=(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},fl=(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},gl=async(e,t,n,r={})=>{n.logger?.debug("@aws-sdk/credential-provider-ini - resolveAssumeRoleCredentials (STS)");const o=t[e];if(!n.roleAssumer){const{getDefaultRoleAssumer:e}=await Promise.resolve().then((function(){return Pf}));n.roleAssumer=e({...n.clientConfig,credentialProviderLogger:n.logger,parentClientConfig:n?.parentClientConfig},n.clientPlugins)}const{source_profile:s}=o;if(s&&s in r)throw new He(`Detected a cycle attempting to resolve credentials for profile ${Qe(n)}. Profiles visited: `+Object.keys(r).join(", "),{logger:n.logger});n.logger?.debug("@aws-sdk/credential-provider-ini - finding credential resolver using "+(s?`source_profile=[${s}]`:`profile=[${e}]`));const i=s?wl(s,{...t,[s]:{...t[s],role_arn:o.role_arn??t[s].role_arn}},n,{...r,[s]:!0}):(await((e,t,n)=>{const r={EcsContainer:async e=>{const{fromHttp:t}=await Promise.resolve().then((function(){return Qc})),{fromContainerMetadata:r}=await Promise.resolve().then((function(){return Yc}));return n?.debug("@aws-sdk/credential-provider-ini - credential_source is EcsContainer"),Ke(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 Yc}));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 $i}));return t(e)}};if(e in r)return r[e];throw new He(`Unsupported credential source in profile ${t}. Got ${e}, expected EcsContainer or Ec2InstanceMetadata or Environment.`,{logger:n})})(o.credential_source,e,n.logger)(n))(),a={RoleArn:o.role_arn,RoleSessionName:o.role_session_name||`aws-sdk-js-${Date.now()}`,ExternalId:o.external_id,DurationSeconds:parseInt(o.duration_seconds||"3600",10)},{mfa_serial:c}=o;if(c){if(!n.mfaCodeProvider)throw new He(`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)},ml=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,yl=(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}})),wl=async(e,t,n,r={})=>{const o=t[e];if(Object.keys(r).length>0&&ml(o))return yl(o,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&&(hl(e,{profile:t,logger:n})||fl(e,{profile:t,logger:n})))(o,{profile:e,logger:n.logger}))return gl(e,t,n,r);if(ml(o))return yl(o,n);if(s=o,Boolean(s)&&"object"==typeof s&&"string"==typeof s.web_identity_token_file&&"string"==typeof s.role_arn&&["undefined","string"].indexOf(typeof s.role_session_name)>-1)return(async(e,t)=>Promise.resolve().then((function(){return xl})).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})())))(o,n);var s;if((e=>Boolean(e)&&"object"==typeof e&&"string"==typeof e.credential_process)(o))return(async(e,t)=>Promise.resolve().then((function(){return Sl})).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))(o))return await(async(e,t={})=>{const{fromSSO:n}=await Promise.resolve().then((function(){return pl}));return n({profile:e,logger:t.logger})()})(e,n);throw new He(`Could not resolve credentials using profile: [${e}] in configuration/credentials file(s).`,{logger:n.logger})};var bl=Object.freeze({__proto__:null,fromIni:(e={})=>async()=>{e.logger?.debug("@aws-sdk/credential-provider-ini - fromIni");const t=await wt(e);return wl(Qe(e),t,e)}});const vl=async(e,t,n)=>{const r=t[e];if(!t[e])throw new He(`Profile ${e} could not be found in shared credentials file.`,{logger:n});{const o=r.credential_process;if(void 0===o)throw new He(`Profile ${e} did not contain credential_process.`,{logger:n});{const r=c(E);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 He(e.message,{logger:n})}}}};var Sl=Object.freeze({__proto__:null,fromProcess:(e={})=>async()=>{e.logger?.debug("@aws-sdk/credential-provider-process - fromProcess");const t=await wt(e);return vl(Qe(e),t,e.logger)}});const El=e=>async()=>{e.logger?.debug("@aws-sdk/credential-provider-web-identity - fromWebToken");const{roleArn:t,roleSessionName:n,webIdentityToken:r,providerId:o,policyArns:s,policy:i,durationSeconds:a}=e;let{roleAssumerWithWebIdentity:c}=e;if(!c){const{getDefaultRoleAssumerWithWebIdentity:t}=await Promise.resolve().then((function(){return Pf}));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:o,PolicyArns:s,Policy:i,DurationSeconds:a})};var xl=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 He("Web identity configuration not specified",{logger:e.logger});return El({...e,webIdentityToken:b(t,{encoding:"ascii"}),roleArn:n,roleSessionName:r})()},fromWebToken:El});const Al=async(e,t,n)=>({operation:_e(t).operation,region:await Re(e.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});const Pl=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},Tl={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}};var Il="3.645.0";const Cl="required",kl="fn",_l="argv",Rl="ref",Ol=!0,$l="isSet",Nl="booleanEquals",Dl="error",jl="endpoint",Ll="tree",Ml="PartitionResult",Ul="getAttr",Fl={[Cl]:!1,type:"String"},zl={[Cl]:!0,default:!1,type:"Boolean"},ql={[Rl]:"Endpoint"},Wl={[kl]:Nl,[_l]:[{[Rl]:"UseFIPS"},!0]},Bl={[kl]:Nl,[_l]:[{[Rl]:"UseDualStack"},!0]},Hl={},Vl={[kl]:Ul,[_l]:[{[Rl]:Ml},"supportsFIPS"]},Kl={[Rl]:Ml},Gl={[kl]:Nl,[_l]:[!0,{[kl]:Ul,[_l]:[Kl,"supportsDualStack"]}]},Xl=[Wl],Jl=[Bl],Yl=[{[Rl]:"Region"}],Zl={version:"1.0",parameters:{Region:Fl,UseDualStack:zl,UseFIPS:zl,Endpoint:Fl},rules:[{conditions:[{[kl]:$l,[_l]:[ql]}],rules:[{conditions:Xl,error:"Invalid Configuration: FIPS and custom endpoint are not supported",type:Dl},{conditions:Jl,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",type:Dl},{endpoint:{url:ql,properties:Hl,headers:Hl},type:jl}],type:Ll},{conditions:[{[kl]:$l,[_l]:Yl}],rules:[{conditions:[{[kl]:"aws.partition",[_l]:Yl,assign:Ml}],rules:[{conditions:[Wl,Bl],rules:[{conditions:[{[kl]:Nl,[_l]:[Ol,Vl]},Gl],rules:[{endpoint:{url:"https://oidc-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:Hl,headers:Hl},type:jl}],type:Ll},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",type:Dl}],type:Ll},{conditions:Xl,rules:[{conditions:[{[kl]:Nl,[_l]:[Vl,Ol]}],rules:[{conditions:[{[kl]:"stringEquals",[_l]:[{[kl]:Ul,[_l]:[Kl,"name"]},"aws-us-gov"]}],endpoint:{url:"https://oidc.{Region}.amazonaws.com",properties:Hl,headers:Hl},type:jl},{endpoint:{url:"https://oidc-fips.{Region}.{PartitionResult#dnsSuffix}",properties:Hl,headers:Hl},type:jl}],type:Ll},{error:"FIPS is enabled but this partition does not support FIPS",type:Dl}],type:Ll},{conditions:Jl,rules:[{conditions:[Gl],rules:[{endpoint:{url:"https://oidc.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:Hl,headers:Hl},type:jl}],type:Ll},{error:"DualStack is enabled but this partition does not support DualStack",type:Dl}],type:Ll},{endpoint:{url:"https://oidc.{Region}.{PartitionResult#dnsSuffix}",properties:Hl,headers:Hl},type:jl}],type:Ll}],type:Ll},{error:"Invalid Configuration: Missing Region",type:Dl}]},Ql=(e,t={})=>ge(Zl,{endpointParams:e,logger:t.logger});X.aws=we;const eu=e=>{Tr(process.version);const t=ma(e),n=()=>t().then(Ar),r=(e=>({apiVersion:"2019-06-10",base64Decoder:e?.base64Decoder??bn,base64Encoder:e?.base64Encoder??xn,disableHostPrefix:e?.disableHostPrefix??!1,endpointProvider:e?.endpointProvider??Ql,extensions:e?.extensions??[],httpAuthSchemeProvider:e?.httpAuthSchemeProvider??Pl,httpAuthSchemes:e?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4"),signer:new mo},{schemeId:"smithy.api#noAuth",identityProvider:e=>e.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new Qr}],logger:e?.logger??new cn,serviceId:e?.serviceId??"SSO OIDC",urlParser:e?.urlParser??At,utf8Decoder:e?.utf8Decoder??vn,utf8Encoder:e?.utf8Encoder??En}))(e);return uo(process.version),{...r,...e,runtime:"node",defaultsMode:t,bodyLengthChecker:e?.bodyLengthChecker??zi,credentialDefaultProvider:e?.credentialDefaultProvider??Di,defaultUserAgentProvider:e?.defaultUserAgentProvider??Mi({serviceId:r.serviceId,clientVersion:Il}),maxAttempts:e?.maxAttempts??vt(on),region:e?.region??vt(Oe,$e),requestHandler:_n.create(e?.requestHandler??n),retryMode:e?.retryMode??vt({...an,default:async()=>(await n()).retryMode||Ut}),sha256:e?.sha256??Ui.bind(null,"sha256"),streamCollector:e?.streamCollector??On,useDualstackEndpoint:e?.useDualstackEndpoint??vt(Ce),useFipsEndpoint:e?.useFipsEndpoint??vt(ke)}},tu=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 nu extends vr{constructor(e){super(e),Object.setPrototypeOf(this,nu.prototype)}}class ru extends nu{constructor(e){super({name:"AccessDeniedException",$fault:"client",...e}),this.name="AccessDeniedException",this.$fault="client",Object.setPrototypeOf(this,ru.prototype),this.error=e.error,this.error_description=e.error_description}}class ou extends nu{constructor(e){super({name:"AuthorizationPendingException",$fault:"client",...e}),this.name="AuthorizationPendingException",this.$fault="client",Object.setPrototypeOf(this,ou.prototype),this.error=e.error,this.error_description=e.error_description}}let su=class e extends nu{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 iu extends nu{constructor(e){super({name:"InternalServerException",$fault:"server",...e}),this.name="InternalServerException",this.$fault="server",Object.setPrototypeOf(this,iu.prototype),this.error=e.error,this.error_description=e.error_description}}class au extends nu{constructor(e){super({name:"InvalidClientException",$fault:"client",...e}),this.name="InvalidClientException",this.$fault="client",Object.setPrototypeOf(this,au.prototype),this.error=e.error,this.error_description=e.error_description}}class cu extends nu{constructor(e){super({name:"InvalidGrantException",$fault:"client",...e}),this.name="InvalidGrantException",this.$fault="client",Object.setPrototypeOf(this,cu.prototype),this.error=e.error,this.error_description=e.error_description}}let lu=class e extends nu{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 uu extends nu{constructor(e){super({name:"InvalidScopeException",$fault:"client",...e}),this.name="InvalidScopeException",this.$fault="client",Object.setPrototypeOf(this,uu.prototype),this.error=e.error,this.error_description=e.error_description}}class du extends nu{constructor(e){super({name:"SlowDownException",$fault:"client",...e}),this.name="SlowDownException",this.$fault="client",Object.setPrototypeOf(this,du.prototype),this.error=e.error,this.error_description=e.error_description}}class pu extends nu{constructor(e){super({name:"UnauthorizedClientException",$fault:"client",...e}),this.name="UnauthorizedClientException",this.$fault="client",Object.setPrototypeOf(this,pu.prototype),this.error=e.error,this.error_description=e.error_description}}class hu extends nu{constructor(e){super({name:"UnsupportedGrantTypeException",$fault:"client",...e}),this.name="UnsupportedGrantTypeException",this.$fault="client",Object.setPrototypeOf(this,hu.prototype),this.error=e.error,this.error_description=e.error_description}}class fu extends nu{constructor(e){super({name:"InvalidRequestRegionException",$fault:"client",...e}),this.name="InvalidRequestRegionException",this.$fault="client",Object.setPrototypeOf(this,fu.prototype),this.error=e.error,this.error_description=e.error_description,this.endpoint=e.endpoint,this.region=e.region}}class gu extends nu{constructor(e){super({name:"InvalidClientMetadataException",$fault:"client",...e}),this.name="InvalidClientMetadataException",this.$fault="client",Object.setPrototypeOf(this,gu.prototype),this.error=e.error,this.error_description=e.error_description}}class mu extends nu{constructor(e){super({name:"InvalidRedirectUriException",$fault:"client",...e}),this.name="InvalidRedirectUriException",this.$fault="client",Object.setPrototypeOf(this,mu.prototype),this.error=e.error,this.error_description=e.error_description}}const yu=e=>({...e,...e.clientSecret&&{clientSecret:Hn},...e.refreshToken&&{refreshToken:Hn},...e.codeVerifier&&{codeVerifier:Hn}}),wu=e=>({...e,...e.accessToken&&{accessToken:Hn},...e.refreshToken&&{refreshToken:Hn},...e.idToken&&{idToken:Hn}}),bu=async(e,t)=>{const n=oo(e,t);let r;return n.bp("/token"),r=JSON.stringify(Lr(e,{clientId:[],clientSecret:[],code:[],codeVerifier:[],deviceCode:[],grantType:[],redirectUri:[],refreshToken:[],scope:e=>qr(e)})),n.m("POST").h({"content-type":"application/json"}).b(r),n.build()},vu=async(e,t)=>{if(200!==e.statusCode&&e.statusCode>=300)return Su(e,t);const n=jr({$metadata:Lu(e)}),r=Qn(er(await Jo(e.body,t)),"body"),o=Lr(r,{accessToken:tr,expiresIn:Gn,idToken:tr,refreshToken:tr,tokenType:tr});return Object.assign(n,o),n},Su=async(e,t)=>{const n={...e,body:await Yo(e.body,t)},r=Zo(e,n.body);switch(r){case"AccessDeniedException":case"com.amazonaws.ssooidc#AccessDeniedException":throw await xu(n);case"AuthorizationPendingException":case"com.amazonaws.ssooidc#AuthorizationPendingException":throw await Au(n);case"ExpiredTokenException":case"com.amazonaws.ssooidc#ExpiredTokenException":throw await Pu(n);case"InternalServerException":case"com.amazonaws.ssooidc#InternalServerException":throw await Tu(n);case"InvalidClientException":case"com.amazonaws.ssooidc#InvalidClientException":throw await Iu(n);case"InvalidGrantException":case"com.amazonaws.ssooidc#InvalidGrantException":throw await ku(n);case"InvalidRequestException":case"com.amazonaws.ssooidc#InvalidRequestException":throw await Ru(n);case"InvalidScopeException":case"com.amazonaws.ssooidc#InvalidScopeException":throw await $u(n);case"SlowDownException":case"com.amazonaws.ssooidc#SlowDownException":throw await Nu(n);case"UnauthorizedClientException":case"com.amazonaws.ssooidc#UnauthorizedClientException":throw await Du(n);case"UnsupportedGrantTypeException":case"com.amazonaws.ssooidc#UnsupportedGrantTypeException":throw await ju(n);case"InvalidRequestRegionException":case"com.amazonaws.ssooidc#InvalidRequestRegionException":throw await Ou(n);case"InvalidClientMetadataException":case"com.amazonaws.ssooidc#InvalidClientMetadataException":throw await Cu(n);case"InvalidRedirectUriException":case"com.amazonaws.ssooidc#InvalidRedirectUriException":throw await _u(n);default:const t=n.body;return Eu({output:e,parsedBody:t,errorCode:r})}},Eu=Er(nu),xu=async(e,t)=>{const n=jr({}),r=e.body,o=Lr(r,{error:tr,error_description:tr});Object.assign(n,o);const s=new ru({$metadata:Lu(e),...n});return Sr(s,e.body)},Au=async(e,t)=>{const n=jr({}),r=e.body,o=Lr(r,{error:tr,error_description:tr});Object.assign(n,o);const s=new ou({$metadata:Lu(e),...n});return Sr(s,e.body)},Pu=async(e,t)=>{const n=jr({}),r=e.body,o=Lr(r,{error:tr,error_description:tr});Object.assign(n,o);const s=new su({$metadata:Lu(e),...n});return Sr(s,e.body)},Tu=async(e,t)=>{const n=jr({}),r=e.body,o=Lr(r,{error:tr,error_description:tr});Object.assign(n,o);const s=new iu({$metadata:Lu(e),...n});return Sr(s,e.body)},Iu=async(e,t)=>{const n=jr({}),r=e.body,o=Lr(r,{error:tr,error_description:tr});Object.assign(n,o);const s=new au({$metadata:Lu(e),...n});return Sr(s,e.body)},Cu=async(e,t)=>{const n=jr({}),r=e.body,o=Lr(r,{error:tr,error_description:tr});Object.assign(n,o);const s=new gu({$metadata:Lu(e),...n});return Sr(s,e.body)},ku=async(e,t)=>{const n=jr({}),r=e.body,o=Lr(r,{error:tr,error_description:tr});Object.assign(n,o);const s=new cu({$metadata:Lu(e),...n});return Sr(s,e.body)},_u=async(e,t)=>{const n=jr({}),r=e.body,o=Lr(r,{error:tr,error_description:tr});Object.assign(n,o);const s=new mu({$metadata:Lu(e),...n});return Sr(s,e.body)},Ru=async(e,t)=>{const n=jr({}),r=e.body,o=Lr(r,{error:tr,error_description:tr});Object.assign(n,o);const s=new lu({$metadata:Lu(e),...n});return Sr(s,e.body)},Ou=async(e,t)=>{const n=jr({}),r=e.body,o=Lr(r,{endpoint:tr,error:tr,error_description:tr,region:tr});Object.assign(n,o);const s=new fu({$metadata:Lu(e),...n});return Sr(s,e.body)},$u=async(e,t)=>{const n=jr({}),r=e.body,o=Lr(r,{error:tr,error_description:tr});Object.assign(n,o);const s=new uu({$metadata:Lu(e),...n});return Sr(s,e.body)},Nu=async(e,t)=>{const n=jr({}),r=e.body,o=Lr(r,{error:tr,error_description:tr});Object.assign(n,o);const s=new du({$metadata:Lu(e),...n});return Sr(s,e.body)},Du=async(e,t)=>{const n=jr({}),r=e.body,o=Lr(r,{error:tr,error_description:tr});Object.assign(n,o);const s=new pu({$metadata:Lu(e),...n});return Sr(s,e.body)},ju=async(e,t)=>{const n=jr({}),r=e.body,o=Lr(r,{error:tr,error_description:tr});Object.assign(n,o);const s=new hu({$metadata:Lu(e),...n});return Sr(s,e.body)},Lu=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 Mu extends(Wn.classBuilder().ep({...Tl}).m((function(e,t,n,r){return[_t(n,this.serialize,this.deserialize),Ot(n,e.getEndpointParameterInstructions())]})).s("AWSSSOOIDCService","CreateToken",{}).n("SSOOIDCClient","CreateTokenCommand").f(yu,wu).ser(bu).de(vu).build()){}var Uu=Object.freeze({__proto__:null,$Command:Wn,AccessDeniedException:ru,AuthorizationPendingException:ou,CreateTokenCommand:Mu,CreateTokenRequestFilterSensitiveLog:yu,CreateTokenResponseFilterSensitiveLog:wu,ExpiredTokenException:su,InternalServerException:iu,InvalidClientException:au,InvalidClientMetadataException:gu,InvalidGrantException:cu,InvalidRedirectUriException:mu,InvalidRequestException:lu,InvalidRequestRegionException:fu,InvalidScopeException:uu,SSOOIDCClient:class extends fn{constructor(...[e]){const t=eu(e||{});var n;const r=B((n=t,{...n,useDualstackEndpoint:n.useDualstackEndpoint??!1,useFipsEndpoint:n.useFipsEndpoint??!1,defaultSigningName:"sso-oauth"})),o=sn(r),s=je(o),i=$t(s);const a=((e,t)=>{const n={...va(e),...Rr(e),...P(e),...tu(e)};return t.forEach((e=>e.configure(n))),{...e,...Sa(n),...Or(n),...T(n),...(r=n,{httpAuthSchemes:r.httpAuthSchemes(),httpAuthSchemeProvider:r.httpAuthSchemeProvider(),credentials:r.credentials()})};var r})({...Go(i)},e?.extensions||[]);super(a),this.config=a,this.middlewareStack.use(Pe(this.config)),this.middlewareStack.use(Gr(this.config)),this.middlewareStack.use(co(this.config)),this.middlewareStack.use(M(this.config)),this.middlewareStack.use(F(this.config)),this.middlewareStack.use(W(this.config)),this.middlewareStack.use(Dt(this.config,{httpAuthSchemeParametersProvider:Al,identityProviderConfigProvider:async e=>new Zr({"aws.auth#sigv4":e.credentials})})),this.middlewareStack.use(Yr(this.config))}destroy(){super.destroy()}},SSOOIDCServiceException:nu,SlowDownException:du,UnauthorizedClientException:pu,UnsupportedGrantTypeException:hu,__Client:fn});const Fu=async(e,t,n)=>({operation:_e(t).operation,region:await Re(e.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});const zu=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},qu={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}};var Wu="3.645.0";const Bu="required",Hu="fn",Vu="argv",Ku="ref",Gu=!0,Xu="isSet",Ju="booleanEquals",Yu="error",Zu="endpoint",Qu="tree",ed="PartitionResult",td="getAttr",nd={[Bu]:!1,type:"String"},rd={[Bu]:!0,default:!1,type:"Boolean"},od={[Ku]:"Endpoint"},sd={[Hu]:Ju,[Vu]:[{[Ku]:"UseFIPS"},!0]},id={[Hu]:Ju,[Vu]:[{[Ku]:"UseDualStack"},!0]},ad={},cd={[Hu]:td,[Vu]:[{[Ku]:ed},"supportsFIPS"]},ld={[Ku]:ed},ud={[Hu]:Ju,[Vu]:[!0,{[Hu]:td,[Vu]:[ld,"supportsDualStack"]}]},dd=[sd],pd=[id],hd=[{[Ku]:"Region"}],fd={version:"1.0",parameters:{Region:nd,UseDualStack:rd,UseFIPS:rd,Endpoint:nd},rules:[{conditions:[{[Hu]:Xu,[Vu]:[od]}],rules:[{conditions:dd,error:"Invalid Configuration: FIPS and custom endpoint are not supported",type:Yu},{conditions:pd,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",type:Yu},{endpoint:{url:od,properties:ad,headers:ad},type:Zu}],type:Qu},{conditions:[{[Hu]:Xu,[Vu]:hd}],rules:[{conditions:[{[Hu]:"aws.partition",[Vu]:hd,assign:ed}],rules:[{conditions:[sd,id],rules:[{conditions:[{[Hu]:Ju,[Vu]:[Gu,cd]},ud],rules:[{endpoint:{url:"https://portal.sso-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:ad,headers:ad},type:Zu}],type:Qu},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",type:Yu}],type:Qu},{conditions:dd,rules:[{conditions:[{[Hu]:Ju,[Vu]:[cd,Gu]}],rules:[{conditions:[{[Hu]:"stringEquals",[Vu]:[{[Hu]:td,[Vu]:[ld,"name"]},"aws-us-gov"]}],endpoint:{url:"https://portal.sso.{Region}.amazonaws.com",properties:ad,headers:ad},type:Zu},{endpoint:{url:"https://portal.sso-fips.{Region}.{PartitionResult#dnsSuffix}",properties:ad,headers:ad},type:Zu}],type:Qu},{error:"FIPS is enabled but this partition does not support FIPS",type:Yu}],type:Qu},{conditions:pd,rules:[{conditions:[ud],rules:[{endpoint:{url:"https://portal.sso.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:ad,headers:ad},type:Zu}],type:Qu},{error:"DualStack is enabled but this partition does not support DualStack",type:Yu}],type:Qu},{endpoint:{url:"https://portal.sso.{Region}.{PartitionResult#dnsSuffix}",properties:ad,headers:ad},type:Zu}],type:Qu}],type:Qu},{error:"Invalid Configuration: Missing Region",type:Yu}]},gd=(e,t={})=>ge(fd,{endpointParams:e,logger:t.logger});X.aws=we;const md=e=>{Tr(process.version);const t=ma(e),n=()=>t().then(Ar),r=(e=>({apiVersion:"2019-06-10",base64Decoder:e?.base64Decoder??bn,base64Encoder:e?.base64Encoder??xn,disableHostPrefix:e?.disableHostPrefix??!1,endpointProvider:e?.endpointProvider??gd,extensions:e?.extensions??[],httpAuthSchemeProvider:e?.httpAuthSchemeProvider??zu,httpAuthSchemes:e?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4"),signer:new mo},{schemeId:"smithy.api#noAuth",identityProvider:e=>e.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new Qr}],logger:e?.logger??new cn,serviceId:e?.serviceId??"SSO",urlParser:e?.urlParser??At,utf8Decoder:e?.utf8Decoder??vn,utf8Encoder:e?.utf8Encoder??En}))(e);return uo(process.version),{...r,...e,runtime:"node",defaultsMode:t,bodyLengthChecker:e?.bodyLengthChecker??zi,defaultUserAgentProvider:e?.defaultUserAgentProvider??Mi({serviceId:r.serviceId,clientVersion:Wu}),maxAttempts:e?.maxAttempts??vt(on),region:e?.region??vt(Oe,$e),requestHandler:_n.create(e?.requestHandler??n),retryMode:e?.retryMode??vt({...an,default:async()=>(await n()).retryMode||Ut}),sha256:e?.sha256??Ui.bind(null,"sha256"),streamCollector:e?.streamCollector??On,useDualstackEndpoint:e?.useDualstackEndpoint??vt(Ce),useFipsEndpoint:e?.useFipsEndpoint??vt(ke)}},yd=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 wd extends vr{constructor(e){super(e),Object.setPrototypeOf(this,wd.prototype)}}class bd extends wd{constructor(e){super({name:"InvalidRequestException",$fault:"client",...e}),this.name="InvalidRequestException",this.$fault="client",Object.setPrototypeOf(this,bd.prototype)}}class vd extends wd{constructor(e){super({name:"ResourceNotFoundException",$fault:"client",...e}),this.name="ResourceNotFoundException",this.$fault="client",Object.setPrototypeOf(this,vd.prototype)}}class Sd extends wd{constructor(e){super({name:"TooManyRequestsException",$fault:"client",...e}),this.name="TooManyRequestsException",this.$fault="client",Object.setPrototypeOf(this,Sd.prototype)}}class Ed extends wd{constructor(e){super({name:"UnauthorizedException",$fault:"client",...e}),this.name="UnauthorizedException",this.$fault="client",Object.setPrototypeOf(this,Ed.prototype)}}const xd=e=>({...e,...e.accessToken&&{accessToken:Hn}}),Ad=e=>({...e,...e.secretAccessKey&&{secretAccessKey:Hn},...e.sessionToken&&{sessionToken:Hn}}),Pd=e=>({...e,...e.roleCredentials&&{roleCredentials:Ad(e.roleCredentials)}}),Td=async(e,t)=>{const n=oo(e,t),r=jr({},Dd,{[zd]:e[Ld]});n.bp("/federation/credentials");const o=jr({[Fd]:[,Qn(e[Ud],"roleName")],[Md]:[,Qn(e[jd],"accountId")]});return n.m("GET").h(r).q(o).b(undefined),n.build()},Id=async(e,t)=>{if(200!==e.statusCode&&e.statusCode>=300)return Cd(e,t);const n=jr({$metadata:Nd(e)}),r=Qn(er(await Jo(e.body,t)),"body"),o=Lr(r,{roleCredentials:qr});return Object.assign(n,o),n},Cd=async(e,t)=>{const n={...e,body:await Yo(e.body,t)},r=Zo(e,n.body);switch(r){case"InvalidRequestException":case"com.amazonaws.sso#InvalidRequestException":throw await _d(n);case"ResourceNotFoundException":case"com.amazonaws.sso#ResourceNotFoundException":throw await Rd(n);case"TooManyRequestsException":case"com.amazonaws.sso#TooManyRequestsException":throw await Od(n);case"UnauthorizedException":case"com.amazonaws.sso#UnauthorizedException":throw await $d(n);default:const t=n.body;return kd({output:e,parsedBody:t,errorCode:r})}},kd=Er(wd),_d=async(e,t)=>{const n=jr({}),r=e.body,o=Lr(r,{message:tr});Object.assign(n,o);const s=new bd({$metadata:Nd(e),...n});return Sr(s,e.body)},Rd=async(e,t)=>{const n=jr({}),r=e.body,o=Lr(r,{message:tr});Object.assign(n,o);const s=new vd({$metadata:Nd(e),...n});return Sr(s,e.body)},Od=async(e,t)=>{const n=jr({}),r=e.body,o=Lr(r,{message:tr});Object.assign(n,o);const s=new Sd({$metadata:Nd(e),...n});return Sr(s,e.body)},$d=async(e,t)=>{const n=jr({}),r=e.body,o=Lr(r,{message:tr});Object.assign(n,o);const s=new Ed({$metadata:Nd(e),...n});return Sr(s,e.body)},Nd=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"]}),Dd=e=>!(null==e||""===e||Object.getOwnPropertyNames(e).includes("length")&&0==e.length||Object.getOwnPropertyNames(e).includes("size")&&0==e.size),jd="accountId",Ld="accessToken",Md="account_id",Ud="roleName",Fd="role_name",zd="x-amz-sso_bearer_token";class qd extends(Wn.classBuilder().ep({...qu}).m((function(e,t,n,r){return[_t(n,this.serialize,this.deserialize),Ot(n,e.getEndpointParameterInstructions())]})).s("SWBPortalService","GetRoleCredentials",{}).n("SSOClient","GetRoleCredentialsCommand").f(xd,Pd).ser(Td).de(Id).build()){}var Wd=Object.freeze({__proto__:null,GetRoleCredentialsCommand:qd,SSOClient:class extends fn{constructor(...[e]){const t=md(e||{});var n;const r=B((n=t,{...n,useDualstackEndpoint:n.useDualstackEndpoint??!1,useFipsEndpoint:n.useFipsEndpoint??!1,defaultSigningName:"awsssoportal"})),o=sn(r),s=je(o),i=$t(s);const a=((e,t)=>{const n={...va(e),...Rr(e),...P(e),...yd(e)};return t.forEach((e=>e.configure(n))),{...e,...Sa(n),...Or(n),...T(n),...(r=n,{httpAuthSchemes:r.httpAuthSchemes(),httpAuthSchemeProvider:r.httpAuthSchemeProvider(),credentials:r.credentials()})};var r})({...Go(i)},e?.extensions||[]);super(a),this.config=a,this.middlewareStack.use(Pe(this.config)),this.middlewareStack.use(Gr(this.config)),this.middlewareStack.use(co(this.config)),this.middlewareStack.use(M(this.config)),this.middlewareStack.use(F(this.config)),this.middlewareStack.use(W(this.config)),this.middlewareStack.use(Dt(this.config,{httpAuthSchemeParametersProvider:Fu,identityProviderConfigProvider:async e=>new Zr({"aws.auth#sigv4":e.credentials})})),this.middlewareStack.use(Yr(this.config))}destroy(){super.destroy()}}});const Bd=async(e,t,n)=>({operation:_e(t).operation,region:await Re(e.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});const Hd=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},Vd=e=>{const t=(n=e,{...n,stsClientCtor:Np});var n;return{...Go(t)}},Kd={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 Gd="3.645.0";const Xd="required",Jd="type",Yd="fn",Zd="argv",Qd="ref",ep=!1,tp=!0,np="booleanEquals",rp="stringEquals",op="sigv4",sp="us-east-1",ip="endpoint",ap="https://sts.{Region}.{PartitionResult#dnsSuffix}",cp="tree",lp="error",up="getAttr",dp={[Xd]:!1,[Jd]:"String"},pp={[Xd]:!0,default:!1,[Jd]:"Boolean"},hp={[Qd]:"Endpoint"},fp={[Yd]:"isSet",[Zd]:[{[Qd]:"Region"}]},gp={[Qd]:"Region"},mp={[Yd]:"aws.partition",[Zd]:[gp],assign:"PartitionResult"},yp={[Qd]:"UseFIPS"},wp={[Qd]:"UseDualStack"},bp={url:"https://sts.amazonaws.com",properties:{authSchemes:[{name:op,signingName:"sts",signingRegion:sp}]},headers:{}},vp={},Sp={conditions:[{[Yd]:rp,[Zd]:[gp,"aws-global"]}],[ip]:bp,[Jd]:ip},Ep={[Yd]:np,[Zd]:[yp,!0]},xp={[Yd]:np,[Zd]:[wp,!0]},Ap={[Yd]:up,[Zd]:[{[Qd]:"PartitionResult"},"supportsFIPS"]},Pp={[Qd]:"PartitionResult"},Tp={[Yd]:np,[Zd]:[!0,{[Yd]:up,[Zd]:[Pp,"supportsDualStack"]}]},Ip=[{[Yd]:"isSet",[Zd]:[hp]}],Cp=[Ep],kp=[xp],_p={version:"1.0",parameters:{Region:dp,UseDualStack:pp,UseFIPS:pp,Endpoint:dp,UseGlobalEndpoint:pp},rules:[{conditions:[{[Yd]:np,[Zd]:[{[Qd]:"UseGlobalEndpoint"},tp]},{[Yd]:"not",[Zd]:Ip},fp,mp,{[Yd]:np,[Zd]:[yp,ep]},{[Yd]:np,[Zd]:[wp,ep]}],rules:[{conditions:[{[Yd]:rp,[Zd]:[gp,"ap-northeast-1"]}],endpoint:bp,[Jd]:ip},{conditions:[{[Yd]:rp,[Zd]:[gp,"ap-south-1"]}],endpoint:bp,[Jd]:ip},{conditions:[{[Yd]:rp,[Zd]:[gp,"ap-southeast-1"]}],endpoint:bp,[Jd]:ip},{conditions:[{[Yd]:rp,[Zd]:[gp,"ap-southeast-2"]}],endpoint:bp,[Jd]:ip},Sp,{conditions:[{[Yd]:rp,[Zd]:[gp,"ca-central-1"]}],endpoint:bp,[Jd]:ip},{conditions:[{[Yd]:rp,[Zd]:[gp,"eu-central-1"]}],endpoint:bp,[Jd]:ip},{conditions:[{[Yd]:rp,[Zd]:[gp,"eu-north-1"]}],endpoint:bp,[Jd]:ip},{conditions:[{[Yd]:rp,[Zd]:[gp,"eu-west-1"]}],endpoint:bp,[Jd]:ip},{conditions:[{[Yd]:rp,[Zd]:[gp,"eu-west-2"]}],endpoint:bp,[Jd]:ip},{conditions:[{[Yd]:rp,[Zd]:[gp,"eu-west-3"]}],endpoint:bp,[Jd]:ip},{conditions:[{[Yd]:rp,[Zd]:[gp,"sa-east-1"]}],endpoint:bp,[Jd]:ip},{conditions:[{[Yd]:rp,[Zd]:[gp,sp]}],endpoint:bp,[Jd]:ip},{conditions:[{[Yd]:rp,[Zd]:[gp,"us-east-2"]}],endpoint:bp,[Jd]:ip},{conditions:[{[Yd]:rp,[Zd]:[gp,"us-west-1"]}],endpoint:bp,[Jd]:ip},{conditions:[{[Yd]:rp,[Zd]:[gp,"us-west-2"]}],endpoint:bp,[Jd]:ip},{endpoint:{url:ap,properties:{authSchemes:[{name:op,signingName:"sts",signingRegion:"{Region}"}]},headers:vp},[Jd]:ip}],[Jd]:cp},{conditions:Ip,rules:[{conditions:Cp,error:"Invalid Configuration: FIPS and custom endpoint are not supported",[Jd]:lp},{conditions:kp,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",[Jd]:lp},{endpoint:{url:hp,properties:vp,headers:vp},[Jd]:ip}],[Jd]:cp},{conditions:[fp],rules:[{conditions:[mp],rules:[{conditions:[Ep,xp],rules:[{conditions:[{[Yd]:np,[Zd]:[tp,Ap]},Tp],rules:[{endpoint:{url:"https://sts-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:vp,headers:vp},[Jd]:ip}],[Jd]:cp},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",[Jd]:lp}],[Jd]:cp},{conditions:Cp,rules:[{conditions:[{[Yd]:np,[Zd]:[Ap,tp]}],rules:[{conditions:[{[Yd]:rp,[Zd]:[{[Yd]:up,[Zd]:[Pp,"name"]},"aws-us-gov"]}],endpoint:{url:"https://sts.{Region}.amazonaws.com",properties:vp,headers:vp},[Jd]:ip},{endpoint:{url:"https://sts-fips.{Region}.{PartitionResult#dnsSuffix}",properties:vp,headers:vp},[Jd]:ip}],[Jd]:cp},{error:"FIPS is enabled but this partition does not support FIPS",[Jd]:lp}],[Jd]:cp},{conditions:kp,rules:[{conditions:[Tp],rules:[{endpoint:{url:"https://sts.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:vp,headers:vp},[Jd]:ip}],[Jd]:cp},{error:"DualStack is enabled but this partition does not support DualStack",[Jd]:lp}],[Jd]:cp},Sp,{endpoint:{url:ap,properties:vp,headers:vp},[Jd]:ip}],[Jd]:cp}],[Jd]:cp},{error:"Invalid Configuration: Missing Region",[Jd]:lp}]},Rp=(e,t={})=>ge(_p,{endpointParams:e,logger:t.logger});X.aws=we;const Op=e=>{Tr(process.version);const t=ma(e),n=()=>t().then(Ar),r=(e=>({apiVersion:"2011-06-15",base64Decoder:e?.base64Decoder??bn,base64Encoder:e?.base64Encoder??xn,disableHostPrefix:e?.disableHostPrefix??!1,endpointProvider:e?.endpointProvider??Rp,extensions:e?.extensions??[],httpAuthSchemeProvider:e?.httpAuthSchemeProvider??Hd,httpAuthSchemes:e?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4"),signer:new mo},{schemeId:"smithy.api#noAuth",identityProvider:e=>e.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new Qr}],logger:e?.logger??new cn,serviceId:e?.serviceId??"STS",urlParser:e?.urlParser??At,utf8Decoder:e?.utf8Decoder??vn,utf8Encoder:e?.utf8Encoder??En}))(e);return uo(process.version),{...r,...e,runtime:"node",defaultsMode:t,bodyLengthChecker:e?.bodyLengthChecker??zi,credentialDefaultProvider:e?.credentialDefaultProvider??Di,defaultUserAgentProvider:e?.defaultUserAgentProvider??Mi({serviceId:r.serviceId,clientVersion:Gd}),httpAuthSchemes:e?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4")||(async e=>await Di(e?.__config||{})()),signer:new mo},{schemeId:"smithy.api#noAuth",identityProvider:e=>e.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new Qr}],maxAttempts:e?.maxAttempts??vt(on),region:e?.region??vt(Oe,$e),requestHandler:_n.create(e?.requestHandler??n),retryMode:e?.retryMode??vt({...an,default:async()=>(await n()).retryMode||Ut}),sha256:e?.sha256??Ui.bind(null,"sha256"),streamCollector:e?.streamCollector??On,useDualstackEndpoint:e?.useDualstackEndpoint??vt(Ce),useFipsEndpoint:e?.useFipsEndpoint??vt(ke)}},$p=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 Np extends fn{constructor(...[e]){const t=Op(e||{});var n;const r=B((n=t,{...n,useDualstackEndpoint:n.useDualstackEndpoint??!1,useFipsEndpoint:n.useFipsEndpoint??!1,useGlobalEndpoint:n.useGlobalEndpoint??!1,defaultSigningName:"sts"})),o=sn(r),s=je(o),i=$t(s),a=((e,t)=>{const n={...va(e),...Rr(e),...P(e),...$p(e)};return t.forEach((e=>e.configure(n))),{...e,...Sa(n),...Or(n),...T(n),...(r=n,{httpAuthSchemes:r.httpAuthSchemes(),httpAuthSchemeProvider:r.httpAuthSchemeProvider(),credentials:r.credentials()})};var r})(Vd(i),e?.extensions||[]);super(a),this.config=a,this.middlewareStack.use(Pe(this.config)),this.middlewareStack.use(Gr(this.config)),this.middlewareStack.use(co(this.config)),this.middlewareStack.use(M(this.config)),this.middlewareStack.use(F(this.config)),this.middlewareStack.use(W(this.config)),this.middlewareStack.use(Dt(this.config,{httpAuthSchemeParametersProvider:Bd,identityProviderConfigProvider:async e=>new Zr({"aws.auth#sigv4":e.credentials})})),this.middlewareStack.use(Yr(this.config))}destroy(){super.destroy()}}class Dp extends vr{constructor(e){super(e),Object.setPrototypeOf(this,Dp.prototype)}}class jp extends Dp{constructor(e){super({name:"ExpiredTokenException",$fault:"client",...e}),this.name="ExpiredTokenException",this.$fault="client",Object.setPrototypeOf(this,jp.prototype)}}class Lp extends Dp{constructor(e){super({name:"MalformedPolicyDocumentException",$fault:"client",...e}),this.name="MalformedPolicyDocumentException",this.$fault="client",Object.setPrototypeOf(this,Lp.prototype)}}class Mp extends Dp{constructor(e){super({name:"PackedPolicyTooLargeException",$fault:"client",...e}),this.name="PackedPolicyTooLargeException",this.$fault="client",Object.setPrototypeOf(this,Mp.prototype)}}class Up extends Dp{constructor(e){super({name:"RegionDisabledException",$fault:"client",...e}),this.name="RegionDisabledException",this.$fault="client",Object.setPrototypeOf(this,Up.prototype)}}class Fp extends Dp{constructor(e){super({name:"IDPRejectedClaimException",$fault:"client",...e}),this.name="IDPRejectedClaimException",this.$fault="client",Object.setPrototypeOf(this,Fp.prototype)}}class zp extends Dp{constructor(e){super({name:"InvalidIdentityTokenException",$fault:"client",...e}),this.name="InvalidIdentityTokenException",this.$fault="client",Object.setPrototypeOf(this,zp.prototype)}}class qp extends Dp{constructor(e){super({name:"IDPCommunicationErrorException",$fault:"client",...e}),this.name="IDPCommunicationErrorException",this.$fault="client",Object.setPrototypeOf(this,qp.prototype)}}class Wp extends Dp{constructor(e){super({name:"InvalidAuthorizationMessageException",$fault:"client",...e}),this.name="InvalidAuthorizationMessageException",this.$fault="client",Object.setPrototypeOf(this,Wp.prototype)}}const Bp=e=>({...e,...e.SecretAccessKey&&{SecretAccessKey:Hn}}),Hp=e=>({...e,...e.Credentials&&{Credentials:Bp(e.Credentials)}}),Vp=e=>({...e,...e.WebIdentityToken&&{WebIdentityToken:Hn}}),Kp=e=>({...e,...e.Credentials&&{Credentials:Bp(e.Credentials)}}),Gp=async(e,t)=>{const n=Rh;let r;return r=mf({...ah(e),[$h]:Dh,[df]:Oh}),_h(t,n,"/",void 0,r)},Xp=async(e,t)=>{const n=Rh;let r;return r=mf({...ch(e),[$h]:Mh,[df]:Oh}),_h(t,n,"/",void 0,r)},Jp=async(e,t)=>{if(e.statusCode>=300)return Zp(e,t);const n=await vi(e.body,t);let r={};r=yh(n.AssumeRoleResult);return{$metadata:Ch(e),...r}},Yp=async(e,t)=>{if(e.statusCode>=300)return Zp(e,t);const n=await vi(e.body,t);let r={};r=wh(n.AssumeRoleWithWebIdentityResult);return{$metadata:Ch(e),...r}},Zp=async(e,t)=>{const n={...e,body:await Si(e.body,t)},r=yf(e,n.body);switch(r){case"ExpiredTokenException":case"com.amazonaws.sts#ExpiredTokenException":throw await Qp(n);case"MalformedPolicyDocument":case"com.amazonaws.sts#MalformedPolicyDocumentException":throw await oh(n);case"PackedPolicyTooLarge":case"com.amazonaws.sts#PackedPolicyTooLargeException":throw await sh(n);case"RegionDisabledException":case"com.amazonaws.sts#RegionDisabledException":throw await ih(n);case"IDPRejectedClaim":case"com.amazonaws.sts#IDPRejectedClaimException":throw await th(n);case"InvalidIdentityToken":case"com.amazonaws.sts#InvalidIdentityTokenException":throw await rh(n);case"IDPCommunicationError":case"com.amazonaws.sts#IDPCommunicationErrorException":throw await eh(n);case"InvalidAuthorizationMessageException":case"com.amazonaws.sts#InvalidAuthorizationMessageException":throw await nh(n);default:const t=n.body;return kh({output:e,parsedBody:t.Error,errorCode:r})}},Qp=async(e,t)=>{const n=e.body,r=vh(n.Error),o=new jp({$metadata:Ch(e),...r});return Sr(o,n)},eh=async(e,t)=>{const n=e.body,r=Sh(n.Error),o=new qp({$metadata:Ch(e),...r});return Sr(o,n)},th=async(e,t)=>{const n=e.body,r=Eh(n.Error),o=new Fp({$metadata:Ch(e),...r});return Sr(o,n)},nh=async(e,t)=>{const n=e.body,r=xh(n.Error),o=new Wp({$metadata:Ch(e),...r});return Sr(o,n)},rh=async(e,t)=>{const n=e.body,r=Ah(n.Error),o=new zp({$metadata:Ch(e),...r});return Sr(o,n)},oh=async(e,t)=>{const n=e.body,r=Ph(n.Error),o=new Lp({$metadata:Ch(e),...r});return Sr(o,n)},sh=async(e,t)=>{const n=e.body,r=Th(n.Error),o=new Mp({$metadata:Ch(e),...r});return Sr(o,n)},ih=async(e,t)=>{const n=e.body,r=Ih(n.Error),o=new Up({$metadata:Ch(e),...r});return Sr(o,n)},ah=(e,t)=>{const n={};if(null!=e[ef]&&(n[ef]=e[ef]),null!=e[tf]&&(n[tf]=e[tf]),null!=e[Gh]){const t=lh(e[Gh]);0===e[Gh]?.length&&(n.PolicyArns=[]),Object.entries(t).forEach((([e,t])=>{n[`PolicyArns.${e}`]=t}))}if(null!=e[Kh]&&(n[Kh]=e[Kh]),null!=e[Wh]&&(n[Wh]=e[Wh]),null!=e[cf]){const t=gh(e[cf]);0===e[cf]?.length&&(n.Tags=[]),Object.entries(t).forEach((([e,t])=>{n[`Tags.${e}`]=t}))}if(null!=e[uf]){const t=fh(e[uf]);0===e[uf]?.length&&(n.TransitiveTagKeys=[]),Object.entries(t).forEach((([e,t])=>{n[`TransitiveTagKeys.${e}`]=t}))}if(null!=e[Hh]&&(n[Hh]=e[Hh]),null!=e[sf]&&(n[sf]=e[sf]),null!=e[lf]&&(n[lf]=e[lf]),null!=e[of]&&(n[of]=e[of]),null!=e[Jh]){const t=ph(e[Jh]);0===e[Jh]?.length&&(n.ProvidedContexts=[]),Object.entries(t).forEach((([e,t])=>{n[`ProvidedContexts.${e}`]=t}))}return n},ch=(e,t)=>{const n={};if(null!=e[ef]&&(n[ef]=e[ef]),null!=e[tf]&&(n[tf]=e[tf]),null!=e[hf]&&(n[hf]=e[hf]),null!=e[Yh]&&(n[Yh]=e[Yh]),null!=e[Gh]){const t=lh(e[Gh]);0===e[Gh]?.length&&(n.PolicyArns=[]),Object.entries(t).forEach((([e,t])=>{n[`PolicyArns.${e}`]=t}))}return null!=e[Kh]&&(n[Kh]=e[Kh]),null!=e[Wh]&&(n[Wh]=e[Wh]),n},lh=(e,t)=>{const n={};let r=1;for(const t of e){if(null===t)continue;const e=uh(t);Object.entries(e).forEach((([e,t])=>{n[`member.${r}.${e}`]=t})),r++}return n},uh=(e,t)=>{const n={};return null!=e[ff]&&(n[ff]=e[ff]),n},dh=(e,t)=>{const n={};return null!=e[Xh]&&(n[Xh]=e[Xh]),null!=e[qh]&&(n[qh]=e[qh]),n},ph=(e,t)=>{const n={};let r=1;for(const t of e){if(null===t)continue;const e=dh(t);Object.entries(e).forEach((([e,t])=>{n[`member.${r}.${e}`]=t})),r++}return n},hh=(e,t)=>{const n={};return null!=e[Vh]&&(n[Vh]=e[Vh]),null!=e[pf]&&(n[pf]=e[pf]),n},fh=(e,t)=>{const n={};let r=1;for(const t of e)null!==t&&(n[`member.${r}`]=t,r++);return n},gh=(e,t)=>{const n={};let r=1;for(const t of e){if(null===t)continue;const e=hh(t);Object.entries(e).forEach((([e,t])=>{n[`member.${r}.${e}`]=t})),r++}return n},mh=(e,t)=>{const n={};return null!=e[jh]&&(n[jh]=tr(e[jh])),null!=e[Uh]&&(n[Uh]=tr(e[Uh])),n},yh=(e,t)=>{const n={};return null!=e[zh]&&(n[zh]=bh(e[zh])),null!=e[Lh]&&(n[Lh]=mh(e[Lh])),null!=e[Zh]&&(n[Zh]=or(e[Zh])),null!=e[of]&&(n[of]=tr(e[of])),n},wh=(e,t)=>{const n={};return null!=e[zh]&&(n[zh]=bh(e[zh])),null!=e[rf]&&(n[rf]=tr(e[rf])),null!=e[Lh]&&(n[Lh]=mh(e[Lh])),null!=e[Zh]&&(n[Zh]=or(e[Zh])),null!=e[Qh]&&(n[Qh]=tr(e[Qh])),null!=e[Fh]&&(n[Fh]=tr(e[Fh])),null!=e[of]&&(n[of]=tr(e[of])),n},bh=(e,t)=>{const n={};return null!=e[Nh]&&(n[Nh]=tr(e[Nh])),null!=e[nf]&&(n[nf]=tr(e[nf])),null!=e[af]&&(n[af]=tr(e[af])),null!=e[Bh]&&(n[Bh]=Qn((e=>{if(null==e)return;if("string"!=typeof e)throw new TypeError("RFC-3339 date-times must be expressed as strings");const t=dr.exec(e);if(!t)throw new TypeError("Invalid RFC-3339 date-time value");const[n,r,o,s,i,a,c,l,u]=t,d=sr(br(r)),p=mr(o,"month",1,12),h=mr(s,"day",1,31),f=pr(d,p,h,{hours:i,minutes:a,seconds:c,fractionalMilliseconds:l});return"Z"!=u.toUpperCase()&&f.setTime(f.getTime()-wr(u)),f})(e[Bh]))),n},vh=(e,t)=>{const n={};return null!=e[gf]&&(n[gf]=tr(e[gf])),n},Sh=(e,t)=>{const n={};return null!=e[gf]&&(n[gf]=tr(e[gf])),n},Eh=(e,t)=>{const n={};return null!=e[gf]&&(n[gf]=tr(e[gf])),n},xh=(e,t)=>{const n={};return null!=e[gf]&&(n[gf]=tr(e[gf])),n},Ah=(e,t)=>{const n={};return null!=e[gf]&&(n[gf]=tr(e[gf])),n},Ph=(e,t)=>{const n={};return null!=e[gf]&&(n[gf]=tr(e[gf])),n},Th=(e,t)=>{const n={};return null!=e[gf]&&(n[gf]=tr(e[gf])),n},Ih=(e,t)=>{const n={};return null!=e[gf]&&(n[gf]=tr(e[gf])),n},Ch=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"]}),kh=Er(Dp),_h=async(e,t,n,r,o)=>{const{hostname:s,protocol:i="https",port:a,path:c}=await e.endpoint(),l={protocol:i,hostname:s,port:a,method:"POST",path:c.endsWith("/")?c.slice(0,-1)+n:c+n,headers:t};return void 0!==o&&(l.body=o),new D(l)},Rh={"content-type":"application/x-www-form-urlencoded"},Oh="2011-06-15",$h="Action",Nh="AccessKeyId",Dh="AssumeRole",jh="AssumedRoleId",Lh="AssumedRoleUser",Mh="AssumeRoleWithWebIdentity",Uh="Arn",Fh="Audience",zh="Credentials",qh="ContextAssertion",Wh="DurationSeconds",Bh="Expiration",Hh="ExternalId",Vh="Key",Kh="Policy",Gh="PolicyArns",Xh="ProviderArn",Jh="ProvidedContexts",Yh="ProviderId",Zh="PackedPolicySize",Qh="Provider",ef="RoleArn",tf="RoleSessionName",nf="SecretAccessKey",rf="SubjectFromWebIdentityToken",of="SourceIdentity",sf="SerialNumber",af="SessionToken",cf="Tags",lf="TokenCode",uf="TransitiveTagKeys",df="Version",pf="Value",hf="WebIdentityToken",ff="arn",gf="message",mf=e=>Object.entries(e).map((([e,t])=>$r(e)+"="+$r(t))).join("&"),yf=(e,t)=>void 0!==t.Error?.Code?t.Error.Code:404==e.statusCode?"NotFound":void 0;class wf extends(Wn.classBuilder().ep({...Kd}).m((function(e,t,n,r){return[_t(n,this.serialize,this.deserialize),Ot(n,e.getEndpointParameterInstructions())]})).s("AWSSecurityTokenServiceV20110615","AssumeRole",{}).n("STSClient","AssumeRoleCommand").f(void 0,Hp).ser(Gp).de(Jp).build()){}class bf extends(Wn.classBuilder().ep({...Kd}).m((function(e,t,n,r){return[_t(n,this.serialize,this.deserialize),Ot(n,e.getEndpointParameterInstructions())]})).s("AWSSecurityTokenServiceV20110615","AssumeRoleWithWebIdentity",{}).n("STSClient","AssumeRoleWithWebIdentityCommand").f(Vp,Kp).ser(Xp).de(Yp).build()){}const vf="us-east-1",Sf=e=>{if("string"==typeof e?.Arn){const t=e.Arn.split(":");if(t.length>4&&""!==t[4])return t[4]}},Ef=async(e,t,n)=>{const r="function"==typeof e?await e():e,o="function"==typeof t?await t():t;return n?.debug?.("@aws-sdk/client-sts::resolveRegion","accepting first of:",`${r} (provider)`,`${o} (parent client)`,`${vf} (STS default)`),r??o??vf},xf=e=>"h2"===e?.metadata?.handlerProtocol,Af=(e,t)=>t?class extends e{constructor(e){super(e);for(const e of t)this.middlewareStack.use(e)}}:e;var Pf=Object.freeze({__proto__:null,$Command:Wn,AssumeRoleCommand:wf,AssumeRoleResponseFilterSensitiveLog:Hp,AssumeRoleWithWebIdentityCommand:bf,AssumeRoleWithWebIdentityRequestFilterSensitiveLog:Vp,AssumeRoleWithWebIdentityResponseFilterSensitiveLog:Kp,CredentialsFilterSensitiveLog:Bp,ExpiredTokenException:jp,IDPCommunicationErrorException:qp,IDPRejectedClaimException:Fp,InvalidAuthorizationMessageException:Wp,InvalidIdentityTokenException:zp,MalformedPolicyDocumentException:Lp,PackedPolicyTooLargeException:Mp,RegionDisabledException:Up,STSClient:Np,STSServiceException:Dp,__Client:fn,getDefaultRoleAssumer:(e={},t)=>((e,t)=>{let n,r;return async(o,s)=>{if(r=o,!n){const{logger:o=e?.parentClientConfig?.logger,region:s,requestHandler:i=e?.parentClientConfig?.requestHandler,credentialProviderLogger:a}=e,c=await Ef(s,e?.parentClientConfig?.region,a),l=!xf(i);n=new t({credentialDefaultProvider:()=>async()=>r,region:c,requestHandler:l?i:void 0,logger:o})}const{Credentials:i,AssumedRoleUser:a}=await n.send(new wf(s));if(!i||!i.AccessKeyId||!i.SecretAccessKey)throw new Error(`Invalid response from STS.assumeRole call with role ${s.RoleArn}`);const c=Sf(a);return{accessKeyId:i.AccessKeyId,secretAccessKey:i.SecretAccessKey,sessionToken:i.SessionToken,expiration:i.Expiration,...i.CredentialScope&&{credentialScope:i.CredentialScope},...c&&{accountId:c}}}})(e,Af(Np,t)),getDefaultRoleAssumerWithWebIdentity:(e={},t)=>((e,t)=>{let n;return async r=>{if(!n){const{logger:r=e?.parentClientConfig?.logger,region:o,requestHandler:s=e?.parentClientConfig?.requestHandler,credentialProviderLogger:i}=e,a=await Ef(o,e?.parentClientConfig?.region,i),c=!xf(s);n=new t({region:a,requestHandler:c?s:void 0,logger:r})}const{Credentials:o,AssumedRoleUser:s}=await n.send(new bf(r));if(!o||!o.AccessKeyId||!o.SecretAccessKey)throw new Error(`Invalid response from STS.assumeRoleWithWebIdentity call with role ${r.RoleArn}`);const i=Sf(s);return{accessKeyId:o.AccessKeyId,secretAccessKey:o.SecretAccessKey,sessionToken:o.SessionToken,expiration:o.Expiration,...o.CredentialScope&&{credentialScope:o.CredentialScope},...i&&{accountId:i}}}})(e,Af(Np,t))});export{yc as Cache,Sc as default,fc as engines,vc as translator};
|
|
2
|
-
//# sourceMappingURL=index.min.js.map
|