@stackone/olap 1.42.0 → 1.43.0

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.
Files changed (56) hide show
  1. package/dist/chunk-51fMIa0T.mjs +1 -0
  2. package/dist/index.cjs +20 -14
  3. package/dist/index.d.cts +30 -457
  4. package/dist/index.d.mts +31 -457
  5. package/dist/index.mjs +20 -14
  6. package/package.json +1 -1
  7. package/dist/chunk-C_uqNoKw.cjs +0 -1
  8. package/dist/chunk-vR2LO-B7.mjs +0 -1
  9. package/dist/client-CxiSp4Kz.mjs +0 -7
  10. package/dist/client-D_jZT_sh.cjs +0 -7
  11. package/dist/dist-cjs-7cgXmuN1.cjs +0 -1
  12. package/dist/dist-cjs-BBOPveZ_.cjs +0 -1
  13. package/dist/dist-cjs-BEXyl9CE.cjs +0 -1
  14. package/dist/dist-cjs-BJejHHw0.mjs +0 -1
  15. package/dist/dist-cjs-BROT1u6D.mjs +0 -21
  16. package/dist/dist-cjs-C3UFC3Rw.cjs +0 -1
  17. package/dist/dist-cjs-CDrv1zcx.cjs +0 -1
  18. package/dist/dist-cjs-CFQiiLMm.cjs +0 -1
  19. package/dist/dist-cjs-CImGb38T.mjs +0 -1
  20. package/dist/dist-cjs-C_zn_i01.cjs +0 -1
  21. package/dist/dist-cjs-CgFnrTst.cjs +0 -1
  22. package/dist/dist-cjs-Cj3NYQtI.mjs +0 -1
  23. package/dist/dist-cjs-CmG4hcDN.cjs +0 -1
  24. package/dist/dist-cjs-D24pTYrl.mjs +0 -1
  25. package/dist/dist-cjs-D2IONrv0.cjs +0 -1
  26. package/dist/dist-cjs-D2azcEBs.cjs +0 -1
  27. package/dist/dist-cjs-DC7dl5c4.cjs +0 -1
  28. package/dist/dist-cjs-DCc0jF-Z.mjs +0 -1
  29. package/dist/dist-cjs-DJQQKYqb.mjs +0 -1
  30. package/dist/dist-cjs-DNkXQvYD.mjs +0 -1
  31. package/dist/dist-cjs-DcIt6eMS.mjs +0 -5
  32. package/dist/dist-cjs-DdKFBEUG.mjs +0 -1
  33. package/dist/dist-cjs-DhtfbTa-.cjs +0 -1
  34. package/dist/dist-cjs-DtKIuDDF.cjs +0 -1
  35. package/dist/dist-cjs-DuCMBjQS.cjs +0 -21
  36. package/dist/dist-cjs-LWm2hVH_.cjs +0 -12
  37. package/dist/dist-cjs-PLsdzpHT.mjs +0 -1
  38. package/dist/dist-cjs-X19WxNr5.mjs +0 -1
  39. package/dist/dist-cjs-_8tdit4z.mjs +0 -1
  40. package/dist/dist-cjs-eAT0vqyG.cjs +0 -5
  41. package/dist/dist-cjs-ngBHCypA.mjs +0 -1
  42. package/dist/dist-cjs-qRyJRodq.mjs +0 -1
  43. package/dist/dist-cjs-t0C5x-PN.mjs +0 -1
  44. package/dist/dist-cjs-wmzGBAE4.mjs +0 -12
  45. package/dist/event-streams-CA37ge5J.mjs +0 -1
  46. package/dist/event-streams-XivmSWgG.cjs +0 -1
  47. package/dist/package--ZTLvSpm.cjs +0 -1
  48. package/dist/package-DmN2B-57.mjs +0 -1
  49. package/dist/signin-BIIeLOjk.mjs +0 -1
  50. package/dist/signin-Bxo7nUca.cjs +0 -1
  51. package/dist/sso-oidc-4-y3FFnG.mjs +0 -1
  52. package/dist/sso-oidc-Cd15Ws6v.cjs +0 -1
  53. package/dist/sts-BNVkCfCW.mjs +0 -1
  54. package/dist/sts-BbQcEhgP.mjs +0 -1
  55. package/dist/sts-JEd7nqQo.cjs +0 -1
  56. package/dist/sts-Rnhz_R5a.cjs +0 -1
@@ -1,21 +0,0 @@
1
- const e=require(`./chunk-C_uqNoKw.cjs`),t=require(`./dist-cjs-D2azcEBs.cjs`),n=require(`./dist-cjs-DC7dl5c4.cjs`),i=require(`./dist-cjs-LWm2hVH_.cjs`),a=require(`./dist-cjs-C3UFC3Rw.cjs`),o=require(`./dist-cjs-BBOPveZ_.cjs`),d=require(`./client-D_jZT_sh.cjs`),f=require(`./dist-cjs-CgFnrTst.cjs`),m=require(`./dist-cjs-DtKIuDDF.cjs`),h=require(`./dist-cjs-DhtfbTa-.cjs`);var _=e.t((e=>{var t=n.t();function resolveHostHeaderConfig(e){return e}let hostHeaderMiddleware=e=>n=>async i=>{if(!t.HttpRequest.isInstance(i.request))return n(i);let{request:a}=i,{handlerProtocol:o=``}=e.requestHandler.metadata||{};if(o.indexOf(`h2`)>=0&&!a.headers[`:authority`])delete a.headers.host,a.headers[`:authority`]=a.hostname+(a.port?`:`+a.port:``);else if(!a.headers.host){let e=a.hostname;a.port!=null&&(e+=`:${a.port}`),a.headers.host=e}return n(i)},i={name:`hostHeaderMiddleware`,step:`build`,priority:`low`,tags:[`HOST`],override:!0},getHostHeaderPlugin=e=>({applyToStack:t=>{t.add(hostHeaderMiddleware(e),i)}});e.getHostHeaderPlugin=getHostHeaderPlugin,e.hostHeaderMiddleware=hostHeaderMiddleware,e.hostHeaderMiddlewareOptions=i,e.resolveHostHeaderConfig=resolveHostHeaderConfig})),k=e.t((e=>{let loggerMiddleware=()=>(e,t)=>async n=>{try{let i=await e(n),{clientName:a,commandName:o,logger:d,dynamoDbDocumentClientOptions:f={}}=t,{overrideInputFilterSensitiveLog:m,overrideOutputFilterSensitiveLog:h}=f,_=m??t.inputFilterSensitiveLog,k=h??t.outputFilterSensitiveLog,{$metadata:j,...P}=i.output;return d?.info?.({clientName:a,commandName:o,input:_(n.input),output:k(P),metadata:j}),i}catch(e){let{clientName:i,commandName:a,logger:o,dynamoDbDocumentClientOptions:d={}}=t,{overrideInputFilterSensitiveLog:f}=d,m=f??t.inputFilterSensitiveLog;throw o?.error?.({clientName:i,commandName:a,input:m(n.input),error:e,metadata:e.$metadata}),e}},t={name:`loggerMiddleware`,tags:[`LOGGER`],step:`initialize`,override:!0},getLoggerPlugin=e=>({applyToStack:e=>{e.add(loggerMiddleware(),t)}});e.getLoggerPlugin=getLoggerPlugin,e.loggerMiddleware=loggerMiddleware,e.loggerMiddlewareOptions=t})),j=e.r({InvokeStore:()=>H,InvokeStoreBase:()=>InvokeStoreBase}),P,L,InvokeStoreBase,InvokeStoreSingle,V,H,U=e.n((()=>{P={REQUEST_ID:Symbol.for(`_AWS_LAMBDA_REQUEST_ID`),X_RAY_TRACE_ID:Symbol.for(`_AWS_LAMBDA_X_RAY_TRACE_ID`),TENANT_ID:Symbol.for(`_AWS_LAMBDA_TENANT_ID`)},L=[`true`,`1`].includes(process.env?.AWS_LAMBDA_NODEJS_NO_GLOBAL_AWSLAMBDA??``),L||(globalThis.awslambda=globalThis.awslambda||{}),InvokeStoreBase=class{static PROTECTED_KEYS=P;isProtectedKey(e){return Object.values(P).includes(e)}getRequestId(){return this.get(P.REQUEST_ID)??`-`}getXRayTraceId(){return this.get(P.X_RAY_TRACE_ID)}getTenantId(){return this.get(P.TENANT_ID)}},InvokeStoreSingle=class extends InvokeStoreBase{currentContext;getContext(){return this.currentContext}hasContext(){return this.currentContext!==void 0}get(e){return this.currentContext?.[e]}set(e,t){if(this.isProtectedKey(e))throw Error(`Cannot modify protected Lambda context field: ${String(e)}`);this.currentContext=this.currentContext||{},this.currentContext[e]=t}run(e,t){return this.currentContext=e,t()}},V=class InvokeStoreMulti extends InvokeStoreBase{als;static async create(){let e=new InvokeStoreMulti;return e.als=new(await(import(`node:async_hooks`))).AsyncLocalStorage,e}getContext(){return this.als.getStore()}hasContext(){return this.als.getStore()!==void 0}get(e){return this.als.getStore()?.[e]}set(e,t){if(this.isProtectedKey(e))throw Error(`Cannot modify protected Lambda context field: ${String(e)}`);let n=this.als.getStore();if(!n)throw Error(`No context available`);n[e]=t}run(e,t){return this.als.run(e,t)}},(function(e){let t=null;async function getInstanceAsync(e){return t||=(async()=>{let t=e===!0||`AWS_LAMBDA_MAX_CONCURRENCY`in process.env?await V.create():new InvokeStoreSingle;return!L&&globalThis.awslambda?.InvokeStore?globalThis.awslambda.InvokeStore:(!L&&globalThis.awslambda&&(globalThis.awslambda.InvokeStore=t),t)})(),t}e.getInstanceAsync=getInstanceAsync,e._testing=process.env.AWS_LAMBDA_BENCHMARK_MODE===`1`?{reset:()=>{t=null,globalThis.awslambda?.InvokeStore&&delete globalThis.awslambda.InvokeStore,globalThis.awslambda={InvokeStore:void 0}}}:void 0})(H||={})})),W=e.t((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.recursionDetectionMiddleware=void 0;let i=(U(),e.a(j)),a=n.t(),o=`X-Amzn-Trace-Id`,recursionDetectionMiddleware=()=>e=>async t=>{let{request:n}=t;if(!a.HttpRequest.isInstance(n))return e(t);let d=Object.keys(n.headers??{}).find(e=>e.toLowerCase()===`x-amzn-trace-id`)??o;if(n.headers.hasOwnProperty(d))return e(t);let f=process.env.AWS_LAMBDA_FUNCTION_NAME,m=process.env._X_AMZN_TRACE_ID,h=(await i.InvokeStore.getInstanceAsync())?.getXRayTraceId()??m,nonEmptyString=e=>typeof e==`string`&&e.length>0;return nonEmptyString(f)&&nonEmptyString(h)&&(n.headers[o]=h),e({...t,request:n})};t.recursionDetectionMiddleware=recursionDetectionMiddleware})),ee=e.t((e=>{var t=W();let n={step:`build`,tags:[`RECURSION_DETECTION`],name:`recursionDetectionMiddleware`,override:!0,priority:`low`},getRecursionDetectionPlugin=e=>({applyToStack:e=>{e.add(t.recursionDetectionMiddleware(),n)}});e.getRecursionDetectionPlugin=getRecursionDetectionPlugin,Object.prototype.hasOwnProperty.call(t,`__proto__`)&&!Object.prototype.hasOwnProperty.call(e,`__proto__`)&&Object.defineProperty(e,`__proto__`,{enumerable:!0,value:t.__proto__}),Object.keys(t).forEach(function(n){n!==`default`&&!Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=t[n])})})),K,te,ne=e.n((()=>{K=t.t(),te=e.i(e=>e[K.SMITHY_CONTEXT_KEY]||(e[K.SMITHY_CONTEXT_KEY]={}),`getSmithyContext`)})),resolveAuthOptions,re=e.n((()=>{resolveAuthOptions=(e,t)=>{if(!t||t.length===0)return e;let n=[];for(let i of t)for(let t of e)t.schemeId.split(`#`)[1]===i&&n.push(t);for(let t of e)n.find(({schemeId:e})=>e===t.schemeId)||n.push(t);return n}}));function convertHttpAuthSchemesToMap(e){let t=new Map;for(let n of e)t.set(n.schemeId,n);return t}var ie,httpAuthSchemeMiddleware,ae=e.n((()=>{ie=i.B(),re(),httpAuthSchemeMiddleware=(e,t)=>(n,i)=>async a=>{let o=resolveAuthOptions(e.httpAuthSchemeProvider(await t.httpAuthSchemeParametersProvider(e,i,a.input)),e.authSchemePreference?await e.authSchemePreference():[]),d=convertHttpAuthSchemesToMap(e.httpAuthSchemes),f=(0,ie.getSmithyContext)(i),m=[];for(let n of o){let a=d.get(n.schemeId);if(!a){m.push(`HttpAuthScheme \`${n.schemeId}\` was not enabled for this service.`);continue}let o=a.identityProvider(await t.identityProviderConfigProvider(e));if(!o){m.push(`HttpAuthScheme \`${n.schemeId}\` did not have an IdentityProvider configured.`);continue}let{identityProperties:h={},signingProperties:_={}}=n.propertiesExtractor?.(e,i)||{};n.identityProperties=Object.assign(n.identityProperties||{},h),n.signingProperties=Object.assign(n.signingProperties||{},_),f.selectedHttpAuthScheme={httpAuthOption:n,identity:await o(n.identityProperties),signer:a.signer};break}if(!f.selectedHttpAuthScheme)throw Error(m.join(`
2
- `));return n(a)}})),oe,getHttpAuthSchemeEndpointRuleSetPlugin,se=e.n((()=>{ae(),oe={step:`serialize`,tags:[`HTTP_AUTH_SCHEME`],name:`httpAuthSchemeMiddleware`,override:!0,relation:`before`,toMiddleware:`endpointV2Middleware`},getHttpAuthSchemeEndpointRuleSetPlugin=(e,{httpAuthSchemeParametersProvider:t,identityProviderConfigProvider:n})=>({applyToStack:i=>{i.addRelativeTo(httpAuthSchemeMiddleware(e,{httpAuthSchemeParametersProvider:t,identityProviderConfigProvider:n}),oe)}})})),ce,getHttpAuthSchemePlugin,le=e.n((()=>{ae(),ce={step:`serialize`,tags:[`HTTP_AUTH_SCHEME`],name:`httpAuthSchemeMiddleware`,override:!0,relation:`before`,toMiddleware:`serializerMiddleware`},getHttpAuthSchemePlugin=(e,{httpAuthSchemeParametersProvider:t,identityProviderConfigProvider:n})=>({applyToStack:i=>{i.addRelativeTo(httpAuthSchemeMiddleware(e,{httpAuthSchemeParametersProvider:t,identityProviderConfigProvider:n}),ce)}})})),ue=e.n((()=>{ae(),se(),le()})),de,fe,defaultErrorHandler,defaultSuccessHandler,httpSigningMiddleware,pe=e.n((()=>{de=n.t(),fe=i.B(),defaultErrorHandler=e=>e=>{throw e},defaultSuccessHandler=(e,t)=>{},httpSigningMiddleware=e=>(e,t)=>async n=>{if(!de.HttpRequest.isInstance(n.request))return e(n);let i=(0,fe.getSmithyContext)(t).selectedHttpAuthScheme;if(!i)throw Error(`No HttpAuthScheme was selected: unable to sign request`);let{httpAuthOption:{signingProperties:a={}},identity:o,signer:d}=i,f=await e({...n,request:await d.sign(n.request,o,a)}).catch((d.errorHandler||defaultErrorHandler)(a));return(d.successHandler||defaultSuccessHandler)(f.response,a),f}})),me,getHttpSigningPlugin,he=e.n((()=>{pe(),me={step:`finalizeRequest`,tags:[`HTTP_SIGNING`],name:`httpSigningMiddleware`,aliases:[`apiKeyMiddleware`,`tokenMiddleware`,`awsAuthMiddleware`],override:!0,relation:`after`,toMiddleware:`retryMiddleware`},getHttpSigningPlugin=e=>({applyToStack:t=>{t.addRelativeTo(httpSigningMiddleware(e),me)}})})),ge=e.n((()=>{pe(),he()})),normalizeProvider,_e=e.n((()=>{normalizeProvider=e=>{if(typeof e==`function`)return e;let t=Promise.resolve(e);return()=>t}}));function createPaginator(e,t,n,i,a){return async function*paginateOperation(o,d,...f){let m=d,h=o.startingToken??m[n],_=!0,k;for(;_;){if(m[n]=h,a&&(m[a]=m[a]??o.pageSize),o.client instanceof e)k=await makePagedClientRequest(t,o.client,d,o.withCommand,...f);else throw Error(`Invalid client, expected instance of ${e.name}`);yield k;let j=h;h=get(k,i),_=!!(h&&(!o.stopOnSameToken||h!==j))}return void 0}}var makePagedClientRequest,get,ve=e.n((()=>{makePagedClientRequest=async(e,t,n,i=e=>e,...a)=>{let o=new e(n);return o=i(o)??o,await t.send(o,...a)},get=(e,t)=>{let n=e,i=t.split(`.`);for(let e of i){if(!n||typeof n!=`object`)return;n=n[e]}return n}})),ye=e.n((()=>{i.n()}));function setFeature(e,t,n){e.__smithy_context?e.__smithy_context.features||(e.__smithy_context.features={}):e.__smithy_context={features:{}},e.__smithy_context.features[t]=n}var be=e.n((()=>{})),DefaultIdentityProviderConfig,xe=e.n((()=>{DefaultIdentityProviderConfig=class{authSchemes=new Map;constructor(e){for(let[t,n]of Object.entries(e))n!==void 0&&this.authSchemes.set(t,n)}getIdentityProvider(e){return this.authSchemes.get(e)}}})),Se,Ce,HttpApiKeyAuthSigner,we=e.n((()=>{Se=n.t(),Ce=t.t(),HttpApiKeyAuthSigner=class{async sign(e,t,n){if(!n)throw Error("request could not be signed with `apiKey` since the `name` and `in` signer properties are missing");if(!n.name)throw Error("request could not be signed with `apiKey` since the `name` signer property is missing");if(!n.in)throw Error("request could not be signed with `apiKey` since the `in` signer property is missing");if(!t.apiKey)throw Error("request could not be signed with `apiKey` since the `apiKey` is not defined");let i=Se.HttpRequest.clone(e);if(n.in===Ce.HttpApiKeyAuthLocation.QUERY)i.query[n.name]=t.apiKey;else if(n.in===Ce.HttpApiKeyAuthLocation.HEADER)i.headers[n.name]=n.scheme?`${n.scheme} ${t.apiKey}`:t.apiKey;else throw Error("request can only be signed with `apiKey` locations `query` or `header`, but found: `"+n.in+"`");return i}}})),Te,HttpBearerAuthSigner,Ee=e.n((()=>{Te=n.t(),HttpBearerAuthSigner=class{async sign(e,t,n){let i=Te.HttpRequest.clone(e);if(!t.token)throw Error("request could not be signed with `token` since the `token` is not defined");return i.headers.Authorization=`Bearer ${t.token}`,i}}})),NoAuthSigner,De=e.n((()=>{NoAuthSigner=class{async sign(e,t,n){return e}}})),Oe=e.n((()=>{we(),Ee(),De()})),createIsIdentityExpiredFunction,ke,Ae,doesIdentityRequireRefresh,memoizeIdentityProvider,je=e.n((()=>{createIsIdentityExpiredFunction=e=>function isIdentityExpired$1(t){return doesIdentityRequireRefresh(t)&&t.expiration.getTime()-Date.now()<e},ke=3e5,Ae=createIsIdentityExpiredFunction(ke),doesIdentityRequireRefresh=e=>e.expiration!==void 0,memoizeIdentityProvider=(e,t,n)=>{if(e===void 0)return;let i=typeof e==`function`?e:async()=>Promise.resolve(e),a,o,d,f=!1,coalesceProvider=async e=>{o||=i(e);try{a=await o,d=!0,f=!1}finally{o=void 0}return a};return t===void 0?async e=>((!d||e?.forceRefresh)&&(a=await coalesceProvider(e)),a):async e=>((!d||e?.forceRefresh)&&(a=await coalesceProvider(e)),f?a:n(a)?(t(a)&&await coalesceProvider(e),a):(f=!0,a))}})),Me=e.n((()=>{xe(),Oe(),je()})),Ne=e.r({DefaultIdentityProviderConfig:()=>DefaultIdentityProviderConfig,EXPIRATION_MS:()=>ke,HttpApiKeyAuthSigner:()=>HttpApiKeyAuthSigner,HttpBearerAuthSigner:()=>HttpBearerAuthSigner,NoAuthSigner:()=>NoAuthSigner,createIsIdentityExpiredFunction:()=>createIsIdentityExpiredFunction,createPaginator:()=>createPaginator,doesIdentityRequireRefresh:()=>doesIdentityRequireRefresh,getHttpAuthSchemeEndpointRuleSetPlugin:()=>getHttpAuthSchemeEndpointRuleSetPlugin,getHttpAuthSchemePlugin:()=>getHttpAuthSchemePlugin,getHttpSigningPlugin:()=>getHttpSigningPlugin,getSmithyContext:()=>te,httpAuthSchemeEndpointRuleSetMiddlewareOptions:()=>oe,httpAuthSchemeMiddleware:()=>httpAuthSchemeMiddleware,httpAuthSchemeMiddlewareOptions:()=>ce,httpSigningMiddleware:()=>httpSigningMiddleware,httpSigningMiddlewareOptions:()=>me,isIdentityExpired:()=>Ae,memoizeIdentityProvider:()=>memoizeIdentityProvider,normalizeProvider:()=>normalizeProvider,requestBuilder:()=>i.s,setFeature:()=>setFeature}),Pe=e.n((()=>{ne(),ue(),ge(),_e(),ve(),ye(),be(),Me()})),Fe=e.t((e=>{var n=t.t(),i=class BinaryDecisionDiagram{nodes;root;conditions;results;constructor(e,t,n,i){this.nodes=e,this.root=t,this.conditions=n,this.results=i}static from(e,t,n,i){return new BinaryDecisionDiagram(e,t,n,i)}},EndpointCache=class{capacity;data=new Map;parameters=[];constructor({size:e,params:t}){this.capacity=e??50,t&&(this.parameters=t)}get(e,t){let n=this.hash(e);if(n===!1)return t();if(!this.data.has(n)){if(this.data.size>this.capacity+10){let e=this.data.keys(),t=0;for(;;){let{value:n,done:i}=e.next();if(this.data.delete(n),i||++t>10)break}}this.data.set(n,t())}return this.data.get(n)}size(){return this.data.size}hash(e){let t=``,{parameters:n}=this;if(n.length===0)return!1;for(let i of n){let n=String(e[i]??``);if(n.includes(`|;`))return!1;t+=n+`|;`}return t}},EndpointError=class extends Error{constructor(e){super(e),this.name=`EndpointError`}};let a=`endpoints`;function toDebugString(e){return typeof e!=`object`||!e?e:`ref`in e?`$${toDebugString(e.ref)}`:`fn`in e?`${e.fn}(${(e.argv||[]).map(toDebugString).join(`, `)})`:JSON.stringify(e,null,2)}let o={},booleanEquals=(e,t)=>e===t;function coalesce(...e){for(let t of e)if(t!=null)return t}let getAttrPathList=e=>{let t=e.split(`.`),n=[];for(let i of t){let t=i.indexOf(`[`);if(t!==-1){if(i.indexOf(`]`)!==i.length-1)throw new EndpointError(`Path: '${e}' does not end with ']'`);let a=i.slice(t+1,-1);if(Number.isNaN(parseInt(a)))throw new EndpointError(`Invalid array index: '${a}' in path: '${e}'`);t!==0&&n.push(i.slice(0,t)),n.push(a)}else n.push(i)}return n},getAttr=(e,t)=>getAttrPathList(t).reduce((n,i)=>{if(typeof n!=`object`)throw new EndpointError(`Index '${i}' in '${t}' not found in '${JSON.stringify(e)}'`);if(Array.isArray(n)){let e=parseInt(i);return n[e<0?n.length+e:e]}return n[i]},e),isSet=e=>e!=null,d=RegExp(`^(?!.*-$)(?!-)[a-zA-Z0-9-]{1,63}$`),isValidHostLabel=(e,t=!1)=>{if(!t)return d.test(e);let n=e.split(`.`);for(let e of n)if(!isValidHostLabel(e))return!1;return!0};function ite(e,t,n){return e?t:n}let not=e=>!e,f=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}$`),isIpAddress=e=>f.test(e)||e.startsWith(`[`)&&e.endsWith(`]`),m={[n.EndpointURLScheme.HTTP]:80,[n.EndpointURLScheme.HTTPS]:443},parseURL=e=>{let t=(()=>{try{if(e instanceof URL)return e;if(typeof e==`object`&&`hostname`in e){let{hostname:t,port:n,protocol:i=``,path:a=``,query:o={}}=e,d=new URL(`${i}//${t}${n?`:${n}`:``}${a}`);return d.search=Object.entries(o).map(([e,t])=>`${e}=${t}`).join(`&`),d}return new URL(e)}catch{return null}})();if(!t)return console.error(`Unable to parse ${JSON.stringify(e)} as a whatwg URL.`),null;let i=t.href,{host:a,hostname:o,pathname:d,protocol:f,search:h}=t;if(h)return null;let _=f.slice(0,-1);if(!Object.values(n.EndpointURLScheme).includes(_))return null;let k=isIpAddress(o);return{scheme:_,authority:`${a}${i.includes(`${a}:${m[_]}`)||typeof e==`string`&&e.includes(`${a}:${m[_]}`)?`:${m[_]}`:``}`,path:d,normalizedPath:d.endsWith(`/`)?d:`${d}/`,isIp:k}};function split(e,t,n){if(n===1)return[e];if(e===``)return[``];let i=e.split(t);return n===0?i:i.slice(0,n-1).concat(i.slice(1).join(t))}let stringEquals=(e,t)=>e===t,substring=(e,t,n,i)=>e==null||t>=n||e.length<n||/[^\u0000-\u007f]/.test(e)?null:i?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()}`),h={booleanEquals,coalesce,getAttr,isSet,isValidHostLabel,ite,not,parseURL,split,stringEquals,substring,uriEncode},evaluateTemplate=(e,t)=>{let n=[],{referenceRecord:i,endpointParams:a}=t,o=0;for(;o<e.length;){let t=e.indexOf(`{`,o);if(t===-1){n.push(e.slice(o));break}n.push(e.slice(o,t));let d=e.indexOf(`}`,t);if(d===-1){n.push(e.slice(t));break}e[t+1]===`{`&&e[d+1]===`}`&&(n.push(e.slice(t+1,d)),o=d+2);let f=e.substring(t+1,d);if(f.includes(`#`)){let[e,t]=f.split(`#`);n.push(getAttr(i[e]??a[e],t))}else n.push(i[f]??a[f]);o=d+1}return n.join(``)},getReferenceValue=({ref:e},t)=>t.referenceRecord[e]??t.endpointParams[e],evaluateExpression=(e,t,n)=>{if(typeof e==`string`)return evaluateTemplate(e,n);if(e.fn)return _.callFunction(e,n);if(e.ref)return getReferenceValue(e,n);throw new EndpointError(`'${t}': ${String(e)} is not a string, function or reference.`)},callFunction=({fn:e,argv:t},n)=>{let i=Array(t.length);for(let e=0;e<i.length;++e){let a=t[e];typeof a==`boolean`||typeof a==`number`?i[e]=a:i[e]=_.evaluateExpression(a,`arg`,n)}if(e.includes(`.`)){let t=e.split(`.`);if(t[0]in o&&t[1]!=null)return o[t[0]][t[1]](...i)}if(typeof h[e]!=`function`)throw Error(`function ${e} not loaded in endpointFunctions.`);let a=h[e];return a(...i)},_={evaluateExpression,callFunction},evaluateCondition=({assign:e,...t},n)=>{if(e&&e in n.referenceRecord)throw new EndpointError(`'${e}' is already defined in Reference Record.`);let i=callFunction(t,n);return n.logger?.debug?.(`${a} evaluateCondition: ${toDebugString(t)} = ${toDebugString(i)}`),{result:i===``?!0:!!i,...e!=null&&{toAssign:{name:e,value:i}}}},getEndpointHeaders=(e,t)=>Object.entries(e??{}).reduce((e,[n,i])=>({...e,[n]:i.map(e=>{let i=evaluateExpression(e,`Header value entry`,t);if(typeof i!=`string`)throw new EndpointError(`Header '${n}' value '${i}' is not a string`);return i})}),{}),getEndpointProperties=(e,t)=>Object.entries(e).reduce((e,[n,i])=>({...e,[n]:k.getEndpointProperty(i,t)}),{}),getEndpointProperty=(e,t)=>{if(Array.isArray(e))return e.map(e=>getEndpointProperty(e,t));switch(typeof e){case`string`:return evaluateTemplate(e,t);case`object`:if(e===null)throw new EndpointError(`Unexpected endpoint property: ${e}`);return k.getEndpointProperties(e,t);case`boolean`:return e;default:throw new EndpointError(`Unexpected endpoint property type: ${typeof e}`)}},k={getEndpointProperty,getEndpointProperties},getEndpointUrl=(e,t)=>{let n=evaluateExpression(e,`Endpoint URL`,t);if(typeof n==`string`)try{return new URL(n)}catch(e){throw console.error(`Failed to construct URL with ${n}`,e),e}throw new EndpointError(`Endpoint URL must be a string, got ${typeof n}`)},j=1e8,decideEndpoint=(e,t)=>{let{nodes:n,root:i,results:a,conditions:o}=e,d=i,f={},m={referenceRecord:f,endpointParams:t.endpointParams,logger:t.logger};for(;d!==1&&d!==-1&&d<j;){let e=3*(Math.abs(d)-1),[t,i,a]=[n[e],n[e+1],n[e+2]],[h,_,k]=o[t],j=evaluateCondition({fn:h,assign:k,argv:_},m);if(j.toAssign){let{name:e,value:t}=j.toAssign;f[e]=t}d=d>=0===j.result?i:a}if(d>=j){let e=a[d-j];if(e[0]===-1){let[,t]=e;throw new EndpointError(evaluateExpression(t,`Error`,m))}let[t,n,i]=e;return{url:getEndpointUrl(t,m),properties:getEndpointProperties(n,m),headers:getEndpointHeaders(i??{},m)}}throw new EndpointError(`No matching endpoint.`)},evaluateConditions=(e=[],t)=>{let n={};for(let i of e){let{result:e,toAssign:o}=evaluateCondition(i,{...t,referenceRecord:{...t.referenceRecord,...n}});if(!e)return{result:e};o&&(n[o.name]=o.value,t.logger?.debug?.(`${a} assign: ${o.name} := ${toDebugString(o.value)}`))}return{result:!0,referenceRecord:n}},evaluateEndpointRule=(e,t)=>{let{conditions:n,endpoint:i}=e,{result:o,referenceRecord:d}=evaluateConditions(n,t);if(!o)return;let f={...t,referenceRecord:{...t.referenceRecord,...d}},{url:m,properties:h,headers:_}=i;return t.logger?.debug?.(`${a} Resolving endpoint from template: ${toDebugString(i)}`),{..._!=null&&{headers:getEndpointHeaders(_,f)},...h!=null&&{properties:getEndpointProperties(h,f)},url:getEndpointUrl(m,f)}},evaluateErrorRule=(e,t)=>{let{conditions:n,error:i}=e,{result:a,referenceRecord:o}=evaluateConditions(n,t);if(a)throw new EndpointError(evaluateExpression(i,`Error`,{...t,referenceRecord:{...t.referenceRecord,...o}}))},evaluateRules=(e,t)=>{for(let n of e)if(n.type===`endpoint`){let e=evaluateEndpointRule(n,t);if(e)return e}else if(n.type===`error`)evaluateErrorRule(n,t);else if(n.type===`tree`){let e=P.evaluateTreeRule(n,t);if(e)return e}else throw new EndpointError(`Unknown endpoint rule: ${n}`);throw new EndpointError(`Rules evaluation failed`)},evaluateTreeRule=(e,t)=>{let{conditions:n,rules:i}=e,{result:a,referenceRecord:o}=evaluateConditions(n,t);if(a)return P.evaluateRules(i,{...t,referenceRecord:{...t.referenceRecord,...o}})},P={evaluateRules,evaluateTreeRule},resolveEndpoint=(e,t)=>{let{endpointParams:n,logger:i}=t,{parameters:o,rules:d}=e;for(let e in t.logger?.debug?.(`${a} Initial EndpointParams: ${toDebugString(n)}`),o){let t=o[e],i=n[e];if(i==null&&t.default!=null){n[e]=t.default;continue}if(t.required&&i==null)throw new EndpointError(`Missing required parameter: '${e}'`)}let f=evaluateRules(d,{endpointParams:n,logger:i,referenceRecord:{}});return t.logger?.debug?.(`${a} Resolved endpoint: ${toDebugString(f)}`),f};e.BinaryDecisionDiagram=i,e.EndpointCache=EndpointCache,e.EndpointError=EndpointError,e.customEndpointFunctions=o,e.decideEndpoint=decideEndpoint,e.isIpAddress=isIpAddress,e.isValidHostLabel=isValidHostLabel,e.resolveEndpoint=resolveEndpoint})),Ie=e.t((e=>{var t=Fe(),n=o.t();let isVirtualHostableS3Bucket=(e,n=!1)=>{if(n){for(let t of e.split(`.`))if(!isVirtualHostableS3Bucket(t))return!1;return!0}return!(!t.isValidHostLabel(e)||e.length<3||e.length>63||e!==e.toLowerCase()||t.isIpAddress(e))},parseArn=e=>{let t=e.split(`:`);if(t.length<6)return null;let[n,i,a,o,d,...f]=t;return n!==`arn`||i===``||a===``||f.join(`:`)===``?null:{partition:i,service:a,region:o,accountId:d,resourceId:f.map(e=>e.split(`/`)).flat()}};var i={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-east-2":{description:`Asia Pacific (Taipei)`},"ap-northeast-1":{description:`Asia Pacific (Tokyo)`},"ap-northeast-2":{description:`Asia Pacific (Seoul)`},"ap-northeast-3":{description:`Asia Pacific (Osaka)`},"ap-south-1":{description:`Asia Pacific (Mumbai)`},"ap-south-2":{description:`Asia Pacific (Hyderabad)`},"ap-southeast-1":{description:`Asia Pacific (Singapore)`},"ap-southeast-2":{description:`Asia Pacific (Sydney)`},"ap-southeast-3":{description:`Asia Pacific (Jakarta)`},"ap-southeast-4":{description:`Asia Pacific (Melbourne)`},"ap-southeast-5":{description:`Asia Pacific (Malaysia)`},"ap-southeast-6":{description:`Asia Pacific (New Zealand)`},"ap-southeast-7":{description:`Asia Pacific (Thailand)`},"aws-global":{description:`aws global region`},"ca-central-1":{description:`Canada (Central)`},"ca-west-1":{description:`Canada West (Calgary)`},"eu-central-1":{description:`Europe (Frankfurt)`},"eu-central-2":{description:`Europe (Zurich)`},"eu-north-1":{description:`Europe (Stockholm)`},"eu-south-1":{description:`Europe (Milan)`},"eu-south-2":{description:`Europe (Spain)`},"eu-west-1":{description:`Europe (Ireland)`},"eu-west-2":{description:`Europe (London)`},"eu-west-3":{description:`Europe (Paris)`},"il-central-1":{description:`Israel (Tel Aviv)`},"me-central-1":{description:`Middle East (UAE)`},"me-south-1":{description:`Middle East (Bahrain)`},"mx-central-1":{description:`Mexico (Central)`},"sa-east-1":{description:`South America (Sao Paulo)`},"us-east-1":{description:`US East (N. Virginia)`},"us-east-2":{description:`US East (Ohio)`},"us-west-1":{description:`US West (N. California)`},"us-west-2":{description:`US West (Oregon)`}}},{id:`aws-cn`,outputs:{dnsSuffix:`amazonaws.com.cn`,dualStackDnsSuffix:`api.amazonwebservices.com.cn`,implicitGlobalRegion:`cn-northwest-1`,name:`aws-cn`,supportsDualStack:!0,supportsFIPS:!0},regionRegex:`^cn\\-\\w+\\-\\d+$`,regions:{"aws-cn-global":{description:`aws-cn global region`},"cn-north-1":{description:`China (Beijing)`},"cn-northwest-1":{description:`China (Ningxia)`}}},{id:`aws-eusc`,outputs:{dnsSuffix:`amazonaws.eu`,dualStackDnsSuffix:`api.amazonwebservices.eu`,implicitGlobalRegion:`eusc-de-east-1`,name:`aws-eusc`,supportsDualStack:!0,supportsFIPS:!0},regionRegex:`^eusc\\-(de)\\-\\w+\\-\\d+$`,regions:{"eusc-de-east-1":{description:`AWS European Sovereign Cloud (Germany)`}}},{id:`aws-iso`,outputs:{dnsSuffix:`c2s.ic.gov`,dualStackDnsSuffix:`api.aws.ic.gov`,implicitGlobalRegion:`us-iso-east-1`,name:`aws-iso`,supportsDualStack:!0,supportsFIPS:!0},regionRegex:`^us\\-iso\\-\\w+\\-\\d+$`,regions:{"aws-iso-global":{description:`aws-iso global region`},"us-iso-east-1":{description:`US ISO East`},"us-iso-west-1":{description:`US ISO WEST`}}},{id:`aws-iso-b`,outputs:{dnsSuffix:`sc2s.sgov.gov`,dualStackDnsSuffix:`api.aws.scloud`,implicitGlobalRegion:`us-isob-east-1`,name:`aws-iso-b`,supportsDualStack:!0,supportsFIPS:!0},regionRegex:`^us\\-isob\\-\\w+\\-\\d+$`,regions:{"aws-iso-b-global":{description:`aws-iso-b global region`},"us-isob-east-1":{description:`US ISOB East (Ohio)`},"us-isob-west-1":{description:`US ISOB West`}}},{id:`aws-iso-e`,outputs:{dnsSuffix:`cloud.adc-e.uk`,dualStackDnsSuffix:`api.cloud-aws.adc-e.uk`,implicitGlobalRegion:`eu-isoe-west-1`,name:`aws-iso-e`,supportsDualStack:!0,supportsFIPS:!0},regionRegex:`^eu\\-isoe\\-\\w+\\-\\d+$`,regions:{"aws-iso-e-global":{description:`aws-iso-e global region`},"eu-isoe-west-1":{description:`EU ISOE West`}}},{id:`aws-iso-f`,outputs:{dnsSuffix:`csp.hci.ic.gov`,dualStackDnsSuffix:`api.aws.hci.ic.gov`,implicitGlobalRegion:`us-isof-south-1`,name:`aws-iso-f`,supportsDualStack:!0,supportsFIPS:!0},regionRegex:`^us\\-isof\\-\\w+\\-\\d+$`,regions:{"aws-iso-f-global":{description:`aws-iso-f global region`},"us-isof-east-1":{description:`US ISOF EAST`},"us-isof-south-1":{description:`US ISOF SOUTH`}}},{id:`aws-us-gov`,outputs:{dnsSuffix:`amazonaws.com`,dualStackDnsSuffix:`api.aws`,implicitGlobalRegion:`us-gov-west-1`,name:`aws-us-gov`,supportsDualStack:!0,supportsFIPS:!0},regionRegex:`^us\\-gov\\-\\w+\\-\\d+$`,regions:{"aws-us-gov-global":{description:`aws-us-gov global region`},"us-gov-east-1":{description:`AWS GovCloud (US-East)`},"us-gov-west-1":{description:`AWS GovCloud (US-West)`}}}],version:`1.1`};let a=i,d=``,partition=e=>{let{partitions:t}=a;for(let n of t){let{regions:t,outputs:i}=n;for(let[n,a]of Object.entries(t))if(n===e)return{...i,...a}}for(let n of t){let{regionRegex:t,outputs:i}=n;if(new RegExp(t).test(e))return{...i}}let n=t.find(e=>e.id===`aws`);if(!n)throw Error(`Provided region was not found in the partition array or regex, and default partition with id 'aws' doesn't exist.`);return{...n.outputs}},setPartitionInfo=(e,t=``)=>{a=e,d=t},useDefaultPartitionInfo=()=>{setPartitionInfo(i,``)},getUserAgentPrefix=()=>d,f={isVirtualHostableS3Bucket,parseArn,partition};t.customEndpointFunctions.aws=f;let resolveDefaultAwsRegionalEndpointsConfig=e=>{if(typeof e.endpointProvider!=`function`)throw Error(`@aws-sdk/util-endpoint - endpointProvider and endpoint missing in config for this client.`);let{endpoint:t}=e;return t===void 0&&(e.endpoint=async()=>toEndpointV1(e.endpointProvider({Region:typeof e.region==`function`?await e.region():e.region,UseDualStack:typeof e.useDualstackEndpoint==`function`?await e.useDualstackEndpoint():e.useDualstackEndpoint,UseFIPS:typeof e.useFipsEndpoint==`function`?await e.useFipsEndpoint():e.useFipsEndpoint,Endpoint:void 0},{logger:e.logger}))),e},toEndpointV1=e=>n.parseUrl(e.url);e.EndpointError=t.EndpointError,e.isIpAddress=t.isIpAddress,e.resolveEndpoint=t.resolveEndpoint,e.awsEndpointFunctions=f,e.getUserAgentPrefix=getUserAgentPrefix,e.partition=partition,e.resolveDefaultAwsRegionalEndpointsConfig=resolveDefaultAwsRegionalEndpointsConfig,e.setPartitionInfo=setPartitionInfo,e.toEndpointV1=toEndpointV1,e.useDefaultPartitionInfo=useDefaultPartitionInfo})),Le=e.t((e=>{let t=[`AuthFailure`,`InvalidSignatureException`,`RequestExpired`,`RequestInTheFuture`,`RequestTimeTooSkewed`,`SignatureDoesNotMatch`],n=[`BandwidthLimitExceeded`,`EC2ThrottledException`,`LimitExceededException`,`PriorRequestNotComplete`,`ProvisionedThroughputExceededException`,`RequestLimitExceeded`,`RequestThrottled`,`RequestThrottledException`,`SlowDown`,`ThrottledException`,`Throttling`,`ThrottlingException`,`TooManyRequestsException`,`TransactionInProgressException`],i=[`TimeoutError`,`RequestTimeout`,`RequestTimeoutException`],a=[500,502,503,504],o=[`ECONNRESET`,`ECONNREFUSED`,`EPIPE`,`ETIMEDOUT`],d=[`EHOSTUNREACH`,`ENETUNREACH`,`ENOTFOUND`],isRetryableByTrait=e=>e?.$retryable!==void 0,isClockSkewError=e=>t.includes(e.name),isClockSkewCorrectedError=e=>e.$metadata?.clockSkewCorrected,isBrowserNetworkError=e=>{let t=new Set([`Failed to fetch`,`NetworkError when attempting to fetch resource`,`The Internet connection appears to be offline`,`Load failed`,`Network request failed`]);return e&&e instanceof TypeError?t.has(e.message):!1},isThrottlingError=e=>e.$metadata?.httpStatusCode===429||n.includes(e.name)||e.$retryable?.throttling==1,isTransientError=(e,t=0)=>isRetryableByTrait(e)||isClockSkewCorrectedError(e)||i.includes(e.name)||o.includes(e?.code||``)||d.includes(e?.code||``)||a.includes(e.$metadata?.httpStatusCode||0)||isBrowserNetworkError(e)||e.cause!==void 0&&t<=10&&isTransientError(e.cause,t+1),isServerError=e=>{if(e.$metadata?.httpStatusCode!==void 0){let t=e.$metadata.httpStatusCode;return 500<=t&&t<=599&&!isTransientError(e)}return!1};e.isBrowserNetworkError=isBrowserNetworkError,e.isClockSkewCorrectedError=isClockSkewCorrectedError,e.isClockSkewError=isClockSkewError,e.isRetryableByTrait=isRetryableByTrait,e.isServerError=isServerError,e.isThrottlingError=isThrottlingError,e.isTransientError=isTransientError})),Re=e.t((e=>{var t=Le();e.RETRY_MODES=void 0,(function(e){e.STANDARD=`standard`,e.ADAPTIVE=`adaptive`})(e.RETRY_MODES||={});let n=e.RETRY_MODES.STANDARD;var i=class DefaultRateLimiter{static setTimeoutFn=setTimeout;beta;minCapacity;minFillRate;scaleConstant;smooth;enabled=!1;availableTokens=0;lastMaxRate=0;measuredTxRate=0;requestCount=0;fillRate;lastThrottleTime;lastTimestamp=0;lastTxRateBucket;maxCapacity;timeWindow=0;constructor(e){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,this.lastThrottleTime=this.getCurrentTimeInSeconds(),this.lastTxRateBucket=Math.floor(this.getCurrentTimeInSeconds()),this.fillRate=this.minFillRate,this.maxCapacity=this.minCapacity}async getSendToken(){return this.acquireTokenBucket(1)}updateClientSendingRate(e){let n;this.updateMeasuredRate();let i=e;if(i?.errorType===`THROTTLING`||t.isThrottlingError(i?.error??e)){let e=this.enabled?Math.min(this.measuredTxRate,this.fillRate):this.measuredTxRate;this.lastMaxRate=e,this.calculateTimeWindow(),this.lastThrottleTime=this.getCurrentTimeInSeconds(),n=this.cubicThrottle(e),this.enableTokenBucket()}else this.calculateTimeWindow(),n=this.cubicSuccess(this.getCurrentTimeInSeconds());let a=Math.min(n,2*this.measuredTxRate);this.updateTokenBucketRate(a)}getCurrentTimeInSeconds(){return Date.now()/1e3}async acquireTokenBucket(e){if(this.enabled){if(this.refillTokenBucket(),e>this.availableTokens){let t=(e-this.availableTokens)/this.fillRate*1e3;await new Promise(e=>DefaultRateLimiter.setTimeoutFn(e,t))}this.availableTokens-=e}}refillTokenBucket(){let e=this.getCurrentTimeInSeconds();if(!this.lastTimestamp){this.lastTimestamp=e;return}let t=(e-this.lastTimestamp)*this.fillRate;this.availableTokens=Math.min(this.maxCapacity,this.availableTokens+t),this.lastTimestamp=e}calculateTimeWindow(){this.timeWindow=this.getPrecise((this.lastMaxRate*(1-this.beta)/this.scaleConstant)**(1/3))}cubicThrottle(e){return this.getPrecise(e*this.beta)}cubicSuccess(e){return this.getPrecise(this.scaleConstant*(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.availableTokens=Math.min(this.availableTokens,this.maxCapacity)}updateMeasuredRate(){let e=this.getCurrentTimeInSeconds(),t=Math.floor(e*2)/2;if(this.requestCount++,t>this.lastTxRateBucket){let 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))}};let a=20*1e3;var o=class Retry{static v2026=typeof process<`u`&&process.env?.SMITHY_NEW_RETRIES_2026===`true`;static delay(){return Retry.v2026?50:100}static throttlingDelay(){return Retry.v2026?1e3:500}static cost(){return Retry.v2026?14:5}static throttlingCost(){return Retry.v2026?5:10}static modifiedCostType(){return Retry.v2026?`THROTTLING`:`TRANSIENT`}},DefaultRetryBackoffStrategy=class{x=o.delay();computeNextBackoffDelay(e){let t=Math.random()*Math.min(this.x*2**e,a);return Math.floor(t)}setDelayBase(e){this.x=e}},DefaultRetryToken=class{delay;count;cost;longPoll;constructor(e,t,n,i){this.delay=e,this.count=t,this.cost=n,this.longPoll=i}getRetryCount(){return this.count}getRetryDelay(){return Math.min(a,this.delay)}getRetryCost(){return this.cost}isLongPoll(){return this.longPoll}},StandardRetryStrategy=class{mode=e.RETRY_MODES.STANDARD;capacity=500;retryBackoffStrategy;maxAttemptsProvider;baseDelay;constructor(e){typeof e==`number`?this.maxAttemptsProvider=async()=>e:typeof e==`function`?this.maxAttemptsProvider=e:e&&typeof e==`object`&&(this.maxAttemptsProvider=async()=>e.maxAttempts,this.baseDelay=e.baseDelay,this.retryBackoffStrategy=e.backoff),this.maxAttemptsProvider??=async()=>3,this.baseDelay??=o.delay(),this.retryBackoffStrategy??=new DefaultRetryBackoffStrategy}async acquireInitialRetryToken(e){return new DefaultRetryToken(o.delay(),0,void 0,o.v2026&&e.includes(`:longpoll`))}async refreshRetryTokenForRetry(e,t){let n=await this.getMaxAttempts(),i=this.shouldRetry(e,t,n);if(i||e.isLongPoll?.()){let n=t.errorType;this.retryBackoffStrategy.setDelayBase(n===`THROTTLING`?o.throttlingDelay():this.baseDelay);let a=this.retryBackoffStrategy.computeNextBackoffDelay(e.getRetryCount()),d=a;if(t.retryAfterHint instanceof Date&&(d=Math.max(a,Math.min(t.retryAfterHint.getTime()-Date.now(),a+5e3))),i){let t=this.getCapacityCost(n);return this.capacity-=t,new DefaultRetryToken(d,e.getRetryCount()+1,t,e.isLongPoll?.()??!1)}else throw Object.assign(Error(`No retry token available`),{$backoff:o.v2026?d:0})}throw Error(`No retry token available`)}recordSuccess(e){this.capacity=Math.min(500,this.capacity+(e.getRetryCost()??1))}getCapacity(){return this.capacity}async getMaxAttempts(){try{return await this.maxAttemptsProvider()}catch{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 e===o.modifiedCostType()?o.throttlingCost():o.cost()}isRetryableError(e){return e===`THROTTLING`||e===`TRANSIENT`}async maxAttempts(){return this.maxAttemptsProvider()}},AdaptiveRetryStrategy=class{mode=e.RETRY_MODES.ADAPTIVE;rateLimiter;standardRetryStrategy;constructor(e,t){let{rateLimiter:n}=t??{};this.rateLimiter=n??new i,this.standardRetryStrategy=t?new StandardRetryStrategy({maxAttempts:typeof e==`number`?e:3,...t}):new StandardRetryStrategy(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)}async maxAttemptsProvider(){return this.standardRetryStrategy.maxAttempts()}},ConfiguredRetryStrategy=class extends StandardRetryStrategy{computeNextBackoffDelay;constructor(e,t=o.delay()){super(typeof e==`function`?e:async()=>e),typeof t==`number`?this.computeNextBackoffDelay=()=>t:this.computeNextBackoffDelay=t}async refreshRetryTokenForRetry(e,t){let n=await super.refreshRetryTokenForRetry(e,t);return n.getRetryDelay=()=>this.computeNextBackoffDelay(n.getRetryCount()),n}};e.AdaptiveRetryStrategy=AdaptiveRetryStrategy,e.ConfiguredRetryStrategy=ConfiguredRetryStrategy,e.DEFAULT_MAX_ATTEMPTS=3,e.DEFAULT_RETRY_DELAY_BASE=100,e.DEFAULT_RETRY_MODE=n,e.DefaultRateLimiter=i,e.INITIAL_RETRY_TOKENS=500,e.INVOCATION_ID_HEADER=`amz-sdk-invocation-id`,e.MAXIMUM_RETRY_DELAY=a,e.NO_RETRY_INCREMENT=1,e.REQUEST_HEADER=`amz-sdk-request`,e.RETRY_COST=5,e.Retry=o,e.StandardRetryStrategy=StandardRetryStrategy,e.THROTTLING_RETRY_DELAY_BASE=500,e.TIMEOUT_RETRY_COST=10})),ze=e.t((t=>{var i=(Pe(),e.a(Ne)),a=Ie(),o=n.t(),f=(d.n(),e.a(d.t)),m=Re();function isValidUserAgentAppId(e){return e===void 0?!0:typeof e==`string`&&e.length<=50}function resolveUserAgentConfig(e){let t=i.normalizeProvider(e.userAgentAppId??void 0),{customUserAgent:n}=e;return Object.assign(e,{customUserAgent:typeof n==`string`?[[n]]:n,userAgentAppId:async()=>{let n=await t();if(!isValidUserAgentAppId(n)){let t=e.logger?.constructor?.name===`NoOpLogger`||!e.logger?console:e.logger;typeof n==`string`?n.length>50&&t?.warn(`The provided userAgentAppId exceeds the maximum length of 50 characters.`):t?.warn(`userAgentAppId must be a string or undefined.`)}return n}})}let h=/\d{12}\.ddb/;async function checkFeatures(e,t,n){if(n.request?.headers?.[`smithy-protocol`]===`rpc-v2-cbor`&&f.setFeature(e,`PROTOCOL_RPC_V2_CBOR`,`M`),typeof t.retryStrategy==`function`){let n=await t.retryStrategy();if(typeof n.mode==`string`)switch(n.mode){case m.RETRY_MODES.ADAPTIVE:f.setFeature(e,`RETRY_MODE_ADAPTIVE`,`F`);break;case m.RETRY_MODES.STANDARD:f.setFeature(e,`RETRY_MODE_STANDARD`,`E`);break}}if(typeof t.accountIdEndpointMode==`function`){let n=e.endpointV2;switch(String(n?.url?.hostname).match(h)&&f.setFeature(e,`ACCOUNT_ID_ENDPOINT`,`O`),await t.accountIdEndpointMode?.()){case`disabled`:f.setFeature(e,`ACCOUNT_ID_MODE_DISABLED`,`Q`);break;case`preferred`:f.setFeature(e,`ACCOUNT_ID_MODE_PREFERRED`,`P`);break;case`required`:f.setFeature(e,`ACCOUNT_ID_MODE_REQUIRED`,`R`);break}}let i=e.__smithy_context?.selectedHttpAuthScheme?.identity;if(i?.$source){let t=i;t.accountId&&f.setFeature(e,`RESOLVED_ACCOUNT_ID`,`T`);for(let[n,i]of Object.entries(t.$source??{}))f.setFeature(e,n,i)}}let _=`user-agent`,k=`x-amz-user-agent`,j=/[^!$%&'*+\-.^_`|~\w]/g,P=/[^!$%&'*+\-.^_`|~\w#]/g;function encodeFeatures(e){let t=``;for(let n in e){let i=e[n];if(t.length+i.length+1<=1024){t.length?t+=`,`+i:t+=i;continue}break}return t}let userAgentMiddleware=e=>(t,n)=>async i=>{let{request:d}=i;if(!o.HttpRequest.isInstance(d))return t(i);let{headers:f}=d,m=n?.userAgent?.map(escapeUserAgent)||[],h=(await e.defaultUserAgentProvider()).map(escapeUserAgent);await checkFeatures(n,e,i);let j=n;h.push(`m/${encodeFeatures(Object.assign({},n.__smithy_context?.features,j.__aws_sdk_context?.features))}`);let P=e?.customUserAgent?.map(escapeUserAgent)||[],L=await e.userAgentAppId();L&&h.push(escapeUserAgent([`app`,`${L}`]));let V=a.getUserAgentPrefix(),H=(V?[V]:[]).concat([...h,...m,...P]).join(` `),U=[...h.filter(e=>e.startsWith(`aws-sdk-`)),...P].join(` `);return e.runtime===`browser`?f[k]=H:(U&&(f[k]=f[k]?`${f[_]} ${U}`:U),f[_]=H),t({...i,request:d})},escapeUserAgent=e=>{let t=e[0].split(`/`).map(e=>e.replace(j,`-`)).join(`/`),n=e[1]?.replace(P,`-`),i=t.indexOf(`/`),a=t.substring(0,i),o=t.substring(i+1);return a===`api`&&(o=o.toLowerCase()),[a,o,n].filter(e=>e&&e.length>0).reduce((e,t,n)=>{switch(n){case 0:return t;case 1:return`${e}/${t}`;default:return`${e}#${t}`}},``)},L={name:`getUserAgentMiddleware`,step:`build`,priority:`low`,tags:[`SET_USER_AGENT`,`USER_AGENT`],override:!0},getUserAgentPlugin=e=>({applyToStack:t=>{t.add(userAgentMiddleware(e),L)}});t.DEFAULT_UA_APP_ID=void 0,t.getUserAgentMiddlewareOptions=L,t.getUserAgentPlugin=getUserAgentPlugin,t.resolveUserAgentConfig=resolveUserAgentConfig,t.userAgentMiddleware=userAgentMiddleware})),Be=e.t((e=>{let booleanSelector=(e,t,n)=>{if(t in e){if(e[t]===`true`)return!0;if(e[t]===`false`)return!1;throw Error(`Cannot load ${n} "${t}". Expected "true" or "false", got ${e[t]}.`)}},numberSelector=(e,t,n)=>{if(!(t in e))return;let i=parseInt(e[t],10);if(Number.isNaN(i))throw TypeError(`Cannot load ${n} '${t}'. Expected number, got '${e[t]}'.`);return i};e.SelectorType=void 0,(function(e){e.ENV=`env`,e.CONFIG=`shared config entry`})(e.SelectorType||={}),e.booleanSelector=booleanSelector,e.numberSelector=numberSelector})),Ve=e.t((e=>{var t=Be(),n=i.B(),a=Fe();let o=`AWS_USE_DUALSTACK_ENDPOINT`,d=`use_dualstack_endpoint`,f={environmentVariableSelector:e=>t.booleanSelector(e,o,t.SelectorType.ENV),configFileSelector:e=>t.booleanSelector(e,d,t.SelectorType.CONFIG),default:!1},m={environmentVariableSelector:e=>t.booleanSelector(e,o,t.SelectorType.ENV),configFileSelector:e=>t.booleanSelector(e,d,t.SelectorType.CONFIG),default:void 0},h=`AWS_USE_FIPS_ENDPOINT`,_=`use_fips_endpoint`,k={environmentVariableSelector:e=>t.booleanSelector(e,h,t.SelectorType.ENV),configFileSelector:e=>t.booleanSelector(e,_,t.SelectorType.CONFIG),default:!1},j={environmentVariableSelector:e=>t.booleanSelector(e,h,t.SelectorType.ENV),configFileSelector:e=>t.booleanSelector(e,_,t.SelectorType.CONFIG),default:void 0},resolveCustomEndpointsConfig=e=>{let{tls:t,endpoint:i,urlParser:a,useDualstackEndpoint:o}=e;return Object.assign(e,{tls:t??!0,endpoint:n.normalizeProvider(typeof i==`string`?a(i):i),isCustomEndpoint:!0,useDualstackEndpoint:n.normalizeProvider(o??!1)})},getEndpointFromRegion=async e=>{let{tls:t=!0}=e,n=await e.region();if(!new RegExp(/^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9])$/).test(n))throw Error(`Invalid region in client config`);let i=await e.useDualstackEndpoint(),a=await e.useFipsEndpoint(),{hostname:o}=await e.regionInfoProvider(n,{useDualstackEndpoint:i,useFipsEndpoint:a})??{};if(!o)throw Error(`Cannot resolve hostname from client config`);return e.urlParser(`${t?`https:`:`http:`}//${o}`)},resolveEndpointsConfig=e=>{let t=n.normalizeProvider(e.useDualstackEndpoint??!1),{endpoint:i,useFipsEndpoint:a,urlParser:o,tls:d}=e;return Object.assign(e,{tls:d??!0,endpoint:i?n.normalizeProvider(typeof i==`string`?o(i):i):()=>getEndpointFromRegion({...e,useDualstackEndpoint:t,useFipsEndpoint:a}),isCustomEndpoint:!!i,useDualstackEndpoint:t})},P=`AWS_REGION`,L=`region`,V={environmentVariableSelector:e=>e[P],configFileSelector:e=>e[L],default:()=>{throw Error(`Region is missing`)}},H={preferredFile:`credentials`},U=new Set,checkRegion=(e,t=a.isValidHostLabel)=>{if(!U.has(e)&&!t(e))if(e===`*`)console.warn(`@smithy/config-resolver WARN - Please use the caller region instead of "*". See "sigv4a" in https://github.com/aws/aws-sdk-js-v3/blob/main/supplemental-docs/CLIENTS.md.`);else throw Error(`Region not accepted: region="${e}" is not a valid hostname component.`);else U.add(e)},isFipsRegion=e=>typeof e==`string`&&(e.startsWith(`fips-`)||e.endsWith(`-fips`)),getRealRegion=e=>isFipsRegion(e)?[`fips-aws-global`,`aws-fips`].includes(e)?`us-east-1`:e.replace(/fips-(dkr-|prod-)?|-fips/,``):e,resolveRegionConfig=e=>{let{region:t,useFipsEndpoint:n}=e;if(!t)throw Error(`Region is missing`);return Object.assign(e,{region:async()=>{let e=getRealRegion(typeof t==`function`?await t():t);return checkRegion(e),e},useFipsEndpoint:async()=>isFipsRegion(typeof t==`string`?t:await t())?!0:typeof n==`function`?n():Promise.resolve(!!n)})},getHostnameFromVariants=(e=[],{useFipsEndpoint:t,useDualstackEndpoint:n})=>e.find(({tags:e})=>t===e.includes(`fips`)&&n===e.includes(`dualstack`))?.hostname,getResolvedHostname=(e,{regionHostname:t,partitionHostname:n})=>t||(n?n.replace(`{region}`,e):void 0),getResolvedPartition=(e,{partitionHash:t})=>Object.keys(t||{}).find(n=>t[n].regions.includes(e))??`aws`,getResolvedSigningRegion=(e,{signingRegion:t,regionRegex:n,useFipsEndpoint:i})=>{if(t)return t;if(i){let t=n.replace(`\\\\`,`\\`).replace(/^\^/g,`\\.`).replace(/\$$/g,`\\.`),i=e.match(t);if(i)return i[0].slice(1,-1)}},getRegionInfo=(e,{useFipsEndpoint:t=!1,useDualstackEndpoint:n=!1,signingService:i,regionHash:a,partitionHash:o})=>{let d=getResolvedPartition(e,{partitionHash:o}),f=e in a?e:o[d]?.endpoint??e,m={useFipsEndpoint:t,useDualstackEndpoint:n},h=getResolvedHostname(f,{regionHostname:getHostnameFromVariants(a[f]?.variants,m),partitionHostname:getHostnameFromVariants(o[d]?.variants,m)});if(h===void 0)throw Error(`Endpoint resolution failed for: [object Object]`);let _=getResolvedSigningRegion(h,{signingRegion:a[f]?.signingRegion,regionRegex:o[d].regionRegex,useFipsEndpoint:t});return{partition:d,signingService:i,hostname:h,..._&&{signingRegion:_},...a[f]?.signingService&&{signingService:a[f].signingService}}};e.CONFIG_USE_DUALSTACK_ENDPOINT=d,e.CONFIG_USE_FIPS_ENDPOINT=_,e.DEFAULT_USE_DUALSTACK_ENDPOINT=!1,e.DEFAULT_USE_FIPS_ENDPOINT=!1,e.ENV_USE_DUALSTACK_ENDPOINT=o,e.ENV_USE_FIPS_ENDPOINT=h,e.NODE_REGION_CONFIG_FILE_OPTIONS=H,e.NODE_REGION_CONFIG_OPTIONS=V,e.NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS=f,e.NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS=k,e.REGION_ENV_NAME=P,e.REGION_INI_NAME=L,e.getRegionInfo=getRegionInfo,e.nodeDualstackConfigSelectors=m,e.nodeFipsConfigSelectors=j,e.resolveCustomEndpointsConfig=resolveCustomEndpointsConfig,e.resolveEndpointsConfig=resolveEndpointsConfig,e.resolveRegionConfig=resolveRegionConfig})),He=e.t((e=>{var t=n.t();let i=`content-length`;function contentLengthMiddleware(e){return n=>async a=>{let o=a.request;if(t.HttpRequest.isInstance(o)){let{body:t,headers:n}=o;if(t&&Object.keys(n).map(e=>e.toLowerCase()).indexOf(i)===-1)try{let n=e(t);o.headers={...o.headers,[i]:String(n)}}catch{}}return n({...a,request:o})}}let a={step:`build`,tags:[`SET_CONTENT_LENGTH`,`CONTENT_LENGTH`],name:`contentLengthMiddleware`,override:!0},getContentLengthPlugin=e=>({applyToStack:t=>{t.add(contentLengthMiddleware(e.bodyLengthChecker),a)}});e.contentLengthMiddleware=contentLengthMiddleware,e.contentLengthMiddlewareOptions=a,e.getContentLengthPlugin=getContentLengthPlugin})),Ue=e.t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.getEndpointUrlConfig=void 0;let t=m.t(),n=`AWS_ENDPOINT_URL`,i=`endpoint_url`,getEndpointUrlConfig=e=>({environmentVariableSelector:t=>{let i=t[[n,...e.split(` `).map(e=>e.toUpperCase())].join(`_`)];if(i)return i;let a=t[n];if(a)return a},configFileSelector:(n,a)=>{if(a&&n.services){let o=a[[`services`,n.services].join(t.CONFIG_PREFIX_SEPARATOR)];if(o){let n=o[[e.split(` `).map(e=>e.toLowerCase()).join(`_`),i].join(t.CONFIG_PREFIX_SEPARATOR)];if(n)return n}}let o=n[i];if(o)return o},default:void 0});e.getEndpointUrlConfig=getEndpointUrlConfig})),We=e.t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.getEndpointFromConfig=void 0;let t=h.t(),n=Ue(),getEndpointFromConfig=async e=>(0,t.loadConfig)((0,n.getEndpointUrlConfig)(e??``))();e.getEndpointFromConfig=getEndpointFromConfig})),Ge=e.t((t=>{var a=n.t(),o=(i.j(),e.a(i.A));let deserializerMiddleware=(e,t)=>(n,i)=>async o=>{let{response:d}=await n(o);try{return{response:d,output:await t(d,e)}}catch(e){if(Object.defineProperty(e,`$response`,{value:d,enumerable:!1,writable:!1,configurable:!1}),!(`$metadata`in e)){let t=`Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.`;try{e.message+=`
3
- `+t}catch{!i.logger||i.logger?.constructor?.name===`NoOpLogger`?console.warn(t):i.logger?.warn?.(t)}e.$responseBodyText!==void 0&&e.$response&&(e.$response.body=e.$responseBodyText);try{if(a.HttpResponse.isInstance(d)){let{headers:t={}}=d,n=Object.entries(t);e.$metadata={httpStatusCode:d.statusCode,requestId:findHeader(/^x-[\w-]+-request-?id$/,n),extendedRequestId:findHeader(/^x-[\w-]+-id-2$/,n),cfId:findHeader(/^x-[\w-]+-cf-id$/,n)}}}catch{}}throw e}},findHeader=(e,t)=>(t.find(([t])=>t.match(e))||[void 0,void 0])[1],serializerMiddleware=(e,t)=>(n,i)=>async a=>{let d=e,f=i.endpointV2?async()=>o.toEndpointV1(i.endpointV2):d.endpoint;if(!f)throw Error(`No valid endpoint provider available.`);let m=await t(a.input,{...e,endpoint:f});return n({...a,request:m})},d={name:`deserializerMiddleware`,step:`deserialize`,tags:[`DESERIALIZER`],override:!0},f={name:`serializerMiddleware`,step:`serialize`,tags:[`SERIALIZER`],override:!0};function getSerdePlugin(e,t,n){return{applyToStack:i=>{i.add(deserializerMiddleware(e,n),d),i.add(serializerMiddleware(e,t),f)}}}t.deserializerMiddleware=deserializerMiddleware,t.deserializerMiddlewareOption=d,t.getSerdePlugin=getSerdePlugin,t.serializerMiddleware=serializerMiddleware,t.serializerMiddlewareOption=f})),Ke=e.t((t=>{var n=(Pe(),e.a(Ne)),a=i.B(),d=We(),f=o.t(),m=Ge();let resolveParamsForS3=async e=>{let t=e?.Bucket||``;if(typeof e.Bucket==`string`&&(e.Bucket=t.replace(/#/g,`%23`).replace(/\?/g,`%3F`)),isArnBucketName(t)){if(e.ForcePathStyle===!0)throw Error(`Path-style addressing cannot be used with ARN buckets`)}else (!isDnsCompatibleBucketName(t)||t.indexOf(`.`)!==-1&&!String(e.Endpoint).startsWith(`http:`)||t.toLowerCase()!==t||t.length<3)&&(e.ForcePathStyle=!0);return e.DisableMultiRegionAccessPoints&&(e.disableMultiRegionAccessPoints=!0,e.DisableMRAP=!0),e},h=/^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/,_=/(\d+\.){3}\d+/,k=/\.\./,isDnsCompatibleBucketName=e=>h.test(e)&&!_.test(e)&&!k.test(e),isArnBucketName=e=>{let[t,n,i,,,a]=e.split(`:`),o=t===`arn`&&e.split(`:`).length>=6,d=!!(o&&n&&i&&a);if(o&&!d)throw Error(`Invalid ARN: ${e} was an invalid ARN.`);return d},createConfigValueProvider=(e,t,n,i=!1)=>{let configProvider=async()=>{let a;return a=i?n.clientContextParams?.[e]??n[e]??n[t]:n[e]??n[t],typeof a==`function`?a():a};return e===`credentialScope`||t===`CredentialScope`?async()=>{let e=typeof n.credentials==`function`?await n.credentials():n.credentials;return e?.credentialScope??e?.CredentialScope}:e===`accountId`||t===`AccountId`?async()=>{let e=typeof n.credentials==`function`?await n.credentials():n.credentials;return e?.accountId??e?.AccountId}:e===`endpoint`||t===`endpoint`?async()=>{if(n.isCustomEndpoint===!1)return;let e=await configProvider();if(e&&typeof e==`object`){if(`url`in e)return e.url.href;if(`hostname`in e){let{protocol:t,hostname:n,port:i,path:a}=e;return`${t}//${n}${i?`:`+i:``}${a}`}}return e}:configProvider},toEndpointV1=e=>{if(typeof e==`object`){if(`url`in e){let t=f.parseUrl(e.url);if(e.headers){t.headers={};for(let[n,i]of Object.entries(e.headers))t.headers[n.toLowerCase()]=i.join(`, `)}return t}return e}return f.parseUrl(e)},getEndpointFromInstructions=async(e,t,n,i)=>{if(!n.isCustomEndpoint){let e;e=n.serviceConfiguredEndpoint?await n.serviceConfiguredEndpoint():await d.getEndpointFromConfig(n.serviceId),e&&(n.endpoint=()=>Promise.resolve(toEndpointV1(e)),n.isCustomEndpoint=!0)}let a=await resolveParams(e,t,n);if(typeof n.endpointProvider!=`function`)throw Error(`config.endpointProvider is not set.`);let o=n.endpointProvider(a,i);if(n.isCustomEndpoint&&n.endpoint){let e=await n.endpoint();if(e?.headers){o.headers??={};for(let[t,n]of Object.entries(e.headers))o.headers[t]=Array.isArray(n)?n:[n]}}return o},resolveParams=async(e,t,n)=>{let i={},a=t?.getEndpointParameterInstructions?.()||{};for(let[t,o]of Object.entries(a))switch(o.type){case`staticContextParams`:i[t]=o.value;break;case`contextParams`:i[t]=e[o.name];break;case`clientContextParams`:case`builtInParams`:i[t]=await createConfigValueProvider(o.name,t,n,o.type!==`builtInParams`)();break;case`operationContextParams`:i[t]=o.get(e);break;default:throw Error(`Unrecognized endpoint parameter instruction: `+JSON.stringify(o))}return Object.keys(a).length===0&&Object.assign(i,n),String(n.serviceId).toLowerCase()===`s3`&&await resolveParamsForS3(i),i},endpointMiddleware=({config:e,instructions:t})=>(i,o)=>async d=>{e.isCustomEndpoint&&n.setFeature(o,`ENDPOINT_OVERRIDE`,`N`);let f=await getEndpointFromInstructions(d.input,{getEndpointParameterInstructions(){return t}},{...e},o);o.endpointV2=f,o.authSchemes=f.properties?.authSchemes;let m=o.authSchemes?.[0];if(m){o.signing_region=m.signingRegion,o.signing_service=m.signingName;let e=a.getSmithyContext(o)?.selectedHttpAuthScheme?.httpAuthOption;e&&(e.signingProperties=Object.assign(e.signingProperties||{},{signing_region:m.signingRegion,signingRegion:m.signingRegion,signing_service:m.signingName,signingName:m.signingName,signingRegionSet:m.signingRegionSet},m.properties))}return i({...d})},j={step:`serialize`,tags:[`ENDPOINT_PARAMETERS`,`ENDPOINT_V2`,`ENDPOINT`],name:`endpointV2Middleware`,override:!0,relation:`before`,toMiddleware:m.serializerMiddlewareOption.name},getEndpointPlugin=(e,t)=>({applyToStack:n=>{n.addRelativeTo(endpointMiddleware({config:e,instructions:t}),j)}}),resolveEndpointConfig=e=>{let t=e.tls??!0,{endpoint:n,useDualstackEndpoint:i,useFipsEndpoint:o}=e,f=n==null?void 0:async()=>toEndpointV1(await a.normalizeProvider(n)()),m=!!n,h=Object.assign(e,{endpoint:f,tls:t,isCustomEndpoint:m,useDualstackEndpoint:a.normalizeProvider(i??!1),useFipsEndpoint:a.normalizeProvider(o??!1)}),_;return h.serviceConfiguredEndpoint=async()=>(e.serviceId&&!_&&(_=d.getEndpointFromConfig(e.serviceId)),_),h},resolveEndpointRequiredConfig=e=>{let{endpoint:t}=e;return t===void 0&&(e.endpoint=async()=>{throw Error(`@smithy/middleware-endpoint: (default endpointRuleSet) endpoint is not set - you must configure an endpoint.`)}),e};t.endpointMiddleware=endpointMiddleware,t.endpointMiddlewareOptions=j,t.getEndpointFromInstructions=getEndpointFromInstructions,t.getEndpointPlugin=getEndpointPlugin,t.resolveEndpointConfig=resolveEndpointConfig,t.resolveEndpointRequiredConfig=resolveEndpointRequiredConfig,t.resolveParams=resolveParams,t.toEndpointV1=toEndpointV1})),qe=e.t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.isStreamingPayload=void 0;let t=require(`stream`),isStreamingPayload=e=>e?.body instanceof t.Readable||typeof ReadableStream<`u`&&e?.body instanceof ReadableStream;e.isStreamingPayload=isStreamingPayload})),Je=e.t((t=>{var a=Re(),o=n.t(),d=Le(),f=i.v(),m=i.B(),h=i.t(),_=qe(),k=(i.d(),e.a(i.f));let asSdkError=e=>e instanceof Error?e:e instanceof Object?Object.assign(Error(),e):typeof e==`string`?Error(e):Error(`AWS SDK error wrapper for ${e}`),getDefaultRetryQuota=(e,t)=>{let n=e,i=a.NO_RETRY_INCREMENT,o=a.RETRY_COST,d=a.TIMEOUT_RETRY_COST,f=e,getCapacityAmount=e=>e.name===`TimeoutError`?d:o,hasRetryTokens=e=>getCapacityAmount(e)<=f,retrieveRetryTokens=e=>{if(!hasRetryTokens(e))throw Error(`No retry token available`);let t=getCapacityAmount(e);return f-=t,t},releaseRetryTokens=e=>{f+=e??i,f=Math.min(f,n)};return Object.freeze({hasRetryTokens,retrieveRetryTokens,releaseRetryTokens})},defaultDelayDecider=(e,t)=>Math.floor(Math.min(a.MAXIMUM_RETRY_DELAY,Math.random()*2**t*e)),defaultRetryDecider=e=>e?d.isRetryableByTrait(e)||d.isClockSkewError(e)||d.isThrottlingError(e)||d.isTransientError(e):!1;var StandardRetryStrategy=class{maxAttemptsProvider;retryDecider;delayDecider;retryQuota;mode=a.RETRY_MODES.STANDARD;constructor(e,t){this.maxAttemptsProvider=e,this.retryDecider=t?.retryDecider??defaultRetryDecider,this.delayDecider=t?.delayDecider??defaultDelayDecider,this.retryQuota=t?.retryQuota??getDefaultRetryQuota(a.INITIAL_RETRY_TOKENS)}shouldRetry(e,t,n){return t<n&&this.retryDecider(e)&&this.retryQuota.hasRetryTokens(e)}async getMaxAttempts(){let e;try{e=await this.maxAttemptsProvider()}catch{e=a.DEFAULT_MAX_ATTEMPTS}return e}async retry(e,t,n){let i,m=0,h=0,_=await this.getMaxAttempts(),{request:k}=t;for(o.HttpRequest.isInstance(k)&&(k.headers[a.INVOCATION_ID_HEADER]=f.v4());;)try{o.HttpRequest.isInstance(k)&&(k.headers[a.REQUEST_HEADER]=`attempt=${m+1}; max=${_}`),n?.beforeRequest&&await n.beforeRequest();let{response:d,output:f}=await e(t);return n?.afterRequest&&n.afterRequest(d),this.retryQuota.releaseRetryTokens(i),f.$metadata.attempts=m+1,f.$metadata.totalRetryDelay=h,{response:d,output:f}}catch(e){let t=asSdkError(e);if(m++,this.shouldRetry(t,m,_)){i=this.retryQuota.retrieveRetryTokens(t);let e=this.delayDecider(d.isThrottlingError(t)?a.THROTTLING_RETRY_DELAY_BASE:a.DEFAULT_RETRY_DELAY_BASE,m),n=getDelayFromRetryAfterHeader(t.$response),o=Math.max(n||0,e);h+=o,await new Promise(e=>setTimeout(e,o));continue}throw t.$metadata||={},t.$metadata.attempts=m,t.$metadata.totalRetryDelay=h,t}}};let getDelayFromRetryAfterHeader=e=>{if(!o.HttpResponse.isInstance(e))return;let t=Object.keys(e.headers).find(e=>e.toLowerCase()===`retry-after`);if(!t)return;let n=e.headers[t],i=Number(n);return Number.isNaN(i)?new Date(n).getTime()-Date.now():i*1e3};var AdaptiveRetryStrategy=class extends StandardRetryStrategy{rateLimiter;constructor(e,t){let{rateLimiter:n,...i}=t??{};super(e,i),this.rateLimiter=n??new a.DefaultRateLimiter,this.mode=a.RETRY_MODES.ADAPTIVE}async retry(e,t){return super.retry(e,t,{beforeRequest:async()=>this.rateLimiter.getSendToken(),afterRequest:e=>{this.rateLimiter.updateClientSendingRate(e)}})}};let j=`AWS_MAX_ATTEMPTS`,P=`max_attempts`,L={environmentVariableSelector:e=>{let t=e[j];if(!t)return;let n=parseInt(t);if(Number.isNaN(n))throw Error(`Environment variable ${j} mast be a number, got "${t}"`);return n},configFileSelector:e=>{let t=e[P];if(!t)return;let n=parseInt(t);if(Number.isNaN(n))throw Error(`Shared config file entry ${P} mast be a number, got "${t}"`);return n},default:a.DEFAULT_MAX_ATTEMPTS},resolveRetryConfig=e=>{let{retryStrategy:t,retryMode:n}=e,i=m.normalizeProvider(e.maxAttempts??a.DEFAULT_MAX_ATTEMPTS),o=t?Promise.resolve(t):void 0,getDefault=async()=>await m.normalizeProvider(n)()===a.RETRY_MODES.ADAPTIVE?new a.AdaptiveRetryStrategy(i):new a.StandardRetryStrategy(i);return Object.assign(e,{maxAttempts:i,retryStrategy:()=>o??=getDefault()})},V=`AWS_RETRY_MODE`,H=`retry_mode`,U={environmentVariableSelector:e=>e[V],configFileSelector:e=>e[H],default:a.DEFAULT_RETRY_MODE},omitRetryHeadersMiddleware=()=>e=>async t=>{let{request:n}=t;return o.HttpRequest.isInstance(n)&&(delete n.headers[a.INVOCATION_ID_HEADER],delete n.headers[a.REQUEST_HEADER]),e(t)},W={name:`omitRetryHeadersMiddleware`,tags:[`RETRY`,`HEADERS`,`OMIT_RETRY_HEADERS`],relation:`before`,toMiddleware:`awsAuthMiddleware`,override:!0},getOmitRetryHeadersPlugin=e=>({applyToStack:e=>{e.addRelativeTo(omitRetryHeadersMiddleware(),W)}});function parseRetryAfterHeader(e,t){if(o.HttpResponse.isInstance(e))for(let n of Object.keys(e.headers)){let i=n.toLowerCase();if(i===`retry-after`){let i=e.headers[n],a=NaN;if(i.endsWith(`GMT`))try{a=(k.parseRfc7231DateTime(i).getTime()-Date.now())/1e3}catch(e){t?.trace?.(`Failed to parse retry-after header`),t?.trace?.(e)}else i.match(/ GMT, ((\d+)|(\d+\.\d+))$/)?a=Number(i.match(/ GMT, ([\d.]+)$/)?.[1]):i.match(/^((\d+)|(\d+\.\d+))$/)?a=Number(i):Date.parse(i)>=Date.now()&&(a=(Date.parse(i)-Date.now())/1e3);return isNaN(a)?void 0:new Date(Date.now()+a*1e3)}else if(i===`x-amz-retry-after`){let i=e.headers[n],a=Number(i);if(isNaN(a)){t?.trace?.(`Failed to parse x-amz-retry-after=${i}`);return}return new Date(Date.now()+a)}}}function getRetryAfterHint(e,t){return parseRetryAfterHeader(e,t)}let retryMiddleware=e=>(t,n)=>async i=>{let d=await e.retryStrategy(),m=await e.maxAttempts();if(isRetryStrategyV2(d)){d=d;let k=await d.acquireInitialRetryToken((n.partition_id??``)+(n.__retryLongPoll?`:longpoll`:``)),j=Error(),P=0,L=0,{request:V}=i,H=o.HttpRequest.isInstance(V);for(H&&(V.headers[a.INVOCATION_ID_HEADER]=f.v4());;)try{H&&(V.headers[a.REQUEST_HEADER]=`attempt=${P+1}; max=${m}`);let{response:e,output:n}=await t(i);return d.recordSuccess(k),n.$metadata.attempts=P+1,n.$metadata.totalRetryDelay=L,{response:e,output:n}}catch(t){let i=getRetryErrorInfo(t,e.logger);if(j=asSdkError(t),H&&_.isStreamingPayload(V))throw(n.logger instanceof h.NoOpLogger?console:n.logger)?.warn(`An error was encountered in a non-retryable streaming request.`),j;try{k=await d.refreshRetryTokenForRetry(k,i)}catch(e){throw typeof e.$backoff==`number`&&await cooldown(e.$backoff),j.$metadata||={},j.$metadata.attempts=P+1,j.$metadata.totalRetryDelay=L,j}P=k.getRetryCount();let a=k.getRetryDelay();L+=a,await cooldown(a)}}else return d=d,d?.mode&&(n.userAgent=[...n.userAgent||[],[`cfg/retry-mode`,d.mode]]),d.retry(t,i)},cooldown=e=>new Promise(t=>setTimeout(t,e)),isRetryStrategyV2=e=>e.acquireInitialRetryToken!==void 0&&e.refreshRetryTokenForRetry!==void 0&&e.recordSuccess!==void 0,getRetryErrorInfo=(e,t)=>{let n={error:e,errorType:getRetryErrorType(e)},i=parseRetryAfterHeader(e.$response,t);return i&&(n.retryAfterHint=i),n},getRetryErrorType=e=>d.isThrottlingError(e)?`THROTTLING`:d.isTransientError(e)?`TRANSIENT`:d.isServerError(e)?`SERVER_ERROR`:`CLIENT_ERROR`,ee={name:`retryMiddleware`,tags:[`RETRY`],step:`finalizeRequest`,priority:`high`,override:!0},getRetryPlugin=e=>({applyToStack:t=>{t.add(retryMiddleware(e),ee)}});t.AdaptiveRetryStrategy=AdaptiveRetryStrategy,t.CONFIG_MAX_ATTEMPTS=P,t.CONFIG_RETRY_MODE=H,t.ENV_MAX_ATTEMPTS=j,t.ENV_RETRY_MODE=V,t.NODE_MAX_ATTEMPT_CONFIG_OPTIONS=L,t.NODE_RETRY_MODE_CONFIG_OPTIONS=U,t.StandardRetryStrategy=StandardRetryStrategy,t.defaultDelayDecider=defaultDelayDecider,t.defaultRetryDecider=defaultRetryDecider,t.getOmitRetryHeadersPlugin=getOmitRetryHeadersPlugin,t.getRetryAfterHint=getRetryAfterHint,t.getRetryPlugin=getRetryPlugin,t.omitRetryHeadersMiddleware=omitRetryHeadersMiddleware,t.omitRetryHeadersMiddlewareOptions=W,t.resolveRetryConfig=resolveRetryConfig,t.retryMiddleware=retryMiddleware,t.retryMiddlewareOptions=ee})),Ye,getDateHeader,Xe=e.n((()=>{Ye=n.t(),getDateHeader=e=>Ye.HttpResponse.isInstance(e)?e.headers?.date??e.headers?.Date:void 0})),getSkewCorrectedDate,Ze=e.n((()=>{getSkewCorrectedDate=e=>new Date(Date.now()+e)})),isClockSkewed,Qe=e.n((()=>{Ze(),isClockSkewed=(e,t)=>Math.abs(getSkewCorrectedDate(t).getTime()-e)>=3e5})),getUpdatedSystemClockOffset,$e=e.n((()=>{Qe(),getUpdatedSystemClockOffset=(e,t)=>{let n=Date.parse(e);return isClockSkewed(n,t)?n-Date.now():t}})),ot=e.n((()=>{Xe(),Ze(),$e()})),yt,throwSigningPropertyError,validateSigningProperties,AwsSdkSigV4Signer,Lt,zt=e.n((()=>{yt=n.t(),ot(),throwSigningPropertyError=(e,t)=>{if(!t)throw Error(`Property \`${e}\` is not resolved for AWS SDK SigV4Auth`);return t},validateSigningProperties=async e=>{let t=throwSigningPropertyError(`context`,e.context),n=throwSigningPropertyError(`config`,e.config),i=t.endpointV2?.properties?.authSchemes?.[0];return{config:n,signer:await throwSigningPropertyError(`signer`,n.signer)(i),signingRegion:e?.signingRegion,signingRegionSet:e?.signingRegionSet,signingName:e?.signingName}},AwsSdkSigV4Signer=class{async sign(e,t,n){if(!yt.HttpRequest.isInstance(e))throw Error("The request is not an instance of `HttpRequest` and cannot be signed");let i=await validateSigningProperties(n),{config:a,signer:o}=i,{signingRegion:d,signingName:f}=i,m=n.context;if(m?.authSchemes?.length??!1){let[e,t]=m.authSchemes;e?.name===`sigv4a`&&t?.name===`sigv4`&&(d=t?.signingRegion??d,f=t?.signingName??f)}return await o.sign(e,{signingDate:getSkewCorrectedDate(a.systemClockOffset),signingRegion:d,signingService:f})}errorHandler(e){return t=>{let n=t.ServerTime??getDateHeader(t.$response);if(n){let i=throwSigningPropertyError(`config`,e.config),a=i.systemClockOffset;i.systemClockOffset=getUpdatedSystemClockOffset(n,i.systemClockOffset),i.systemClockOffset!==a&&t.$metadata&&(t.$metadata.clockSkewCorrected=!0)}throw t}}successHandler(e,t){let n=getDateHeader(e);if(n){let e=throwSigningPropertyError(`config`,t.config);e.systemClockOffset=getUpdatedSystemClockOffset(n,e.systemClockOffset)}}},Lt=AwsSdkSigV4Signer})),Bt,AwsSdkSigV4ASigner,Ht=e.n((()=>{Bt=n.t(),ot(),zt(),AwsSdkSigV4ASigner=class extends AwsSdkSigV4Signer{async sign(e,t,n){if(!Bt.HttpRequest.isInstance(e))throw Error("The request is not an instance of `HttpRequest` and cannot be signed");let{config:i,signer:a,signingRegion:o,signingRegionSet:d,signingName:f}=await validateSigningProperties(n),m=(await i.sigv4aSigningRegionSet?.()??d??[o]).join(`,`);return await a.sign(e,{signingDate:getSkewCorrectedDate(i.systemClockOffset),signingRegion:m,signingService:f})}}})),getArrayForCommaSeparatedString,Ut=e.n((()=>{getArrayForCommaSeparatedString=e=>typeof e==`string`&&e.length>0?e.split(`,`).map(e=>e.trim()):[]})),getBearerTokenEnvKey,Wt=e.n((()=>{getBearerTokenEnvKey=e=>`AWS_BEARER_TOKEN_${e.replace(/[\s-]/g,`_`).toUpperCase()}`})),Kt,qt,Jt,Yt=e.n((()=>{Ut(),Wt(),Kt=`AWS_AUTH_SCHEME_PREFERENCE`,qt=`auth_scheme_preference`,Jt={environmentVariableSelector:(e,t)=>{if(t?.signingName&&getBearerTokenEnvKey(t.signingName)in e)return[`httpBearerAuth`];if(Kt in e)return getArrayForCommaSeparatedString(e[Kt])},configFileSelector:e=>{if(qt in e)return getArrayForCommaSeparatedString(e[qt])},default:[]}})),Xt,resolveAwsSdkSigV4AConfig,Zt,Qt=e.n((()=>{Pe(),Xt=f.t(),resolveAwsSdkSigV4AConfig=e=>(e.sigv4aSigningRegionSet=normalizeProvider(e.sigv4aSigningRegionSet),e),Zt={environmentVariableSelector(e){if(e.AWS_SIGV4A_SIGNING_REGION_SET)return e.AWS_SIGV4A_SIGNING_REGION_SET.split(`,`).map(e=>e.trim());throw new Xt.ProviderError(`AWS_SIGV4A_SIGNING_REGION_SET not set in env.`,{tryNextLink:!0})},configFileSelector(e){if(e.sigv4a_signing_region_set)return(e.sigv4a_signing_region_set??``).split(`,`).map(e=>e.trim());throw new Xt.ProviderError(`sigv4a_signing_region_set not set in profile.`,{tryNextLink:!0})},default:void 0}})),en=e.t((e=>{var t=i.I(),o=a.t(),d=a.r(),f=n.t(),m=i.B(),h=i.R();let _=`authorization`,k=`x-amz-date`,j=[_,k,`date`],P=`x-amz-content-sha256`,L={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},V=/^proxy-/,H=/^sec-/,U=`AWS4-HMAC-SHA256`,W=`aws4_request`,ee={},K=[],createScope=(e,t,n)=>`${e}/${t}/${n}/${W}`,getSigningKey=async(e,n,i,a,o)=>{let d=await hmac(e,n.secretAccessKey,n.accessKeyId),f=`${i}:${a}:${o}:${t.toHex(d)}:${n.sessionToken}`;if(f in ee)return ee[f];for(K.push(f);K.length>50;)delete ee[K.shift()];let m=`AWS4${n.secretAccessKey}`;for(let t of[i,a,o,W])m=await hmac(e,m,t);return ee[f]=m},hmac=(e,t,n)=>{let i=new e(t);return i.update(o.toUint8Array(n)),i.digest()},getCanonicalHeaders=({headers:e},t,n)=>{let i={};for(let a of Object.keys(e).sort()){if(e[a]==null)continue;let o=a.toLowerCase();(o in L||t?.has(o)||V.test(o)||H.test(o))&&(!n||n&&!n.has(o))||(i[o]=e[a].trim().replace(/\s+/g,` `))}return i},getPayloadHash=async({headers:e,body:n},i)=>{for(let t of Object.keys(e))if(t.toLowerCase()===P)return e[t];if(n==null)return`e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855`;if(typeof n==`string`||ArrayBuffer.isView(n)||d.isArrayBuffer(n)){let e=new i;return e.update(o.toUint8Array(n)),t.toHex(await e.digest())}return`UNSIGNED-PAYLOAD`};var HeaderFormatter=class{format(e){let t=[];for(let n of Object.keys(e)){let i=o.fromUtf8(n);t.push(Uint8Array.from([i.byteLength]),i,this.formatHeaderValue(e[n]))}let n=new Uint8Array(t.reduce((e,t)=>e+t.byteLength,0)),i=0;for(let e of t)n.set(e,i),i+=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`:let n=new DataView(new ArrayBuffer(3));return n.setUint8(0,3),n.setInt16(1,e.value,!1),new Uint8Array(n.buffer);case`integer`:let i=new DataView(new ArrayBuffer(5));return i.setUint8(0,4),i.setInt32(1,e.value,!1),new Uint8Array(i.buffer);case`long`:let a=new Uint8Array(9);return a[0]=5,a.set(e.value.bytes,1),a;case`binary`:let d=new DataView(new ArrayBuffer(3+e.value.byteLength));d.setUint8(0,6),d.setUint16(1,e.value.byteLength,!1);let f=new Uint8Array(d.buffer);return f.set(e.value,3),f;case`string`:let m=o.fromUtf8(e.value),h=new DataView(new ArrayBuffer(3+m.byteLength));h.setUint8(0,7),h.setUint16(1,m.byteLength,!1);let _=new Uint8Array(h.buffer);return _.set(m,3),_;case`timestamp`:let k=new Uint8Array(9);return k[0]=8,k.set(re.fromNumber(e.value.valueOf()).bytes,1),k;case`uuid`:if(!ne.test(e.value))throw Error(`Invalid UUID received: ${e.value}`);let j=new Uint8Array(17);return j[0]=9,j.set(t.fromHex(e.value.replace(/\-/g,``)),1),j}}},te;(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`})(te||={});let ne=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;var re=class Int64{bytes;constructor(e){if(this.bytes=e,e.byteLength!==8)throw Error(`Int64 buffers must be exactly 8 bytes`)}static fromNumber(e){if(e>0x8000000000000000||e<-0x8000000000000000)throw Error(`${e} is too large (or, if negative, too small) to represent as an Int64`);let t=new Uint8Array(8);for(let n=7,i=Math.abs(Math.round(e));n>-1&&i>0;n--,i/=256)t[n]=i;return e<0&&negate(t),new Int64(t)}valueOf(){let e=this.bytes.slice(0),n=e[0]&128;return n&&negate(e),parseInt(t.toHex(e),16)*(n?-1:1)}toString(){return String(this.valueOf())}};function negate(e){for(let t=0;t<8;t++)e[t]^=255;for(let t=7;t>-1&&(e[t]++,e[t]===0);t--);}let hasHeader=(e,t)=>{e=e.toLowerCase();for(let n of Object.keys(t))if(e===n.toLowerCase())return!0;return!1},moveHeadersToQuery=(e,t={})=>{let{headers:n,query:i={}}=f.HttpRequest.clone(e);for(let e of Object.keys(n)){let a=e.toLowerCase();(a.slice(0,6)===`x-amz-`&&!t.unhoistableHeaders?.has(a)||t.hoistableHeaders?.has(a))&&(i[e]=n[e],delete n[e])}return{...e,headers:n,query:i}},prepareRequest=e=>{e=f.HttpRequest.clone(e);for(let t of Object.keys(e.headers))j.indexOf(t.toLowerCase())>-1&&delete e.headers[t];return e},getCanonicalQuery=({query:e={}})=>{let t=[],n={};for(let i of Object.keys(e)){if(i.toLowerCase()===`x-amz-signature`)continue;let a=h.escapeUri(i);t.push(a);let o=e[i];typeof o==`string`?n[a]=`${a}=${h.escapeUri(o)}`:Array.isArray(o)&&(n[a]=o.slice(0).reduce((e,t)=>e.concat([`${a}=${h.escapeUri(t)}`]),[]).sort().join(`&`))}return t.sort().map(e=>n[e]).filter(e=>e).join(`&`)},iso8601=e=>toDate(e).toISOString().replace(/\.\d{3}Z$/,`Z`),toDate=e=>typeof e==`number`?new Date(e*1e3):typeof e==`string`?Number(e)?new Date(Number(e)*1e3):new Date(e):e;var SignatureV4Base=class{service;regionProvider;credentialProvider;sha256;uriEscapePath;applyChecksum;constructor({applyChecksum:e,credentials:t,region:n,service:i,sha256:a,uriEscapePath:o=!0}){this.service=i,this.sha256=a,this.uriEscapePath=o,this.applyChecksum=typeof e==`boolean`?e:!0,this.regionProvider=m.normalizeProvider(n),this.credentialProvider=m.normalizeProvider(t)}createCanonicalRequest(e,t,n){let i=Object.keys(t).sort();return`${e.method}
4
- ${this.getCanonicalPath(e)}
5
- ${getCanonicalQuery(e)}
6
- ${i.map(e=>`${e}:${t[e]}`).join(`
7
- `)}
8
-
9
- ${i.join(`;`)}
10
- ${n}`}async createStringToSign(e,n,i,a){let d=new this.sha256;d.update(o.toUint8Array(i));let f=await d.digest();return`${a}
11
- ${e}
12
- ${n}
13
- ${t.toHex(f)}`}getCanonicalPath({path:e}){if(this.uriEscapePath){let t=[];for(let n of e.split(`/`))n?.length!==0&&n!==`.`&&(n===`..`?t.pop():t.push(n));let n=`${e?.startsWith(`/`)?`/`:``}${t.join(`/`)}${t.length>0&&e?.endsWith(`/`)?`/`:``}`;return h.escapeUri(n).replace(/%2F/g,`/`)}return e}validateResolvedCredentials(e){if(typeof e!=`object`||typeof e.accessKeyId!=`string`||typeof e.secretAccessKey!=`string`)throw Error(`Resolved credential object is not valid`)}formatDate(e){let t=iso8601(e).replace(/[\-:]/g,``);return{longDate:t,shortDate:t.slice(0,8)}}getCanonicalHeaderList(e){return Object.keys(e).sort().join(`;`)}},SignatureV4=class extends SignatureV4Base{headerFormatter=new HeaderFormatter;constructor({applyChecksum:e,credentials:t,region:n,service:i,sha256:a,uriEscapePath:o=!0}){super({applyChecksum:e,credentials:t,region:n,service:i,sha256:a,uriEscapePath:o})}async presign(e,t={}){let{signingDate:n=new Date,expiresIn:i=3600,unsignableHeaders:a,unhoistableHeaders:o,signableHeaders:d,hoistableHeaders:f,signingRegion:m,signingService:h}=t,_=await this.credentialProvider();this.validateResolvedCredentials(_);let k=m??await this.regionProvider(),{longDate:j,shortDate:P}=this.formatDate(n);if(i>604800)return Promise.reject(`Signature version 4 presigned URLs must have an expiration date less than one week in the future`);let L=createScope(P,k,h??this.service),V=moveHeadersToQuery(prepareRequest(e),{unhoistableHeaders:o,hoistableHeaders:f});_.sessionToken&&(V.query[`X-Amz-Security-Token`]=_.sessionToken),V.query[`X-Amz-Algorithm`]=U,V.query[`X-Amz-Credential`]=`${_.accessKeyId}/${L}`,V.query[`X-Amz-Date`]=j,V.query[`X-Amz-Expires`]=i.toString(10);let H=getCanonicalHeaders(V,a,d);return V.query[`X-Amz-SignedHeaders`]=this.getCanonicalHeaderList(H),V.query[`X-Amz-Signature`]=await this.getSignature(j,L,this.getSigningKey(_,k,P,h),this.createCanonicalRequest(V,H,await getPayloadHash(e,this.sha256))),V}async sign(e,t){return typeof e==`string`?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:n},{signingDate:i=new Date,priorSignature:a,signingRegion:o,signingService:d,eventStreamCredentials:f}){let m=o??await this.regionProvider(),{shortDate:h,longDate:_}=this.formatDate(i),k=createScope(h,m,d??this.service),j=await getPayloadHash({headers:{},body:n},this.sha256),P=new this.sha256;P.update(e);let L=[`AWS4-HMAC-SHA256-PAYLOAD`,_,k,a,t.toHex(await P.digest()),j].join(`
14
- `);return this.signString(L,{signingDate:i,signingRegion:m,signingService:d,eventStreamCredentials:f})}async signMessage(e,{signingDate:t=new Date,signingRegion:n,signingService:i,eventStreamCredentials:a}){return this.signEvent({headers:this.headerFormatter.format(e.message.headers),payload:e.message.body},{signingDate:t,signingRegion:n,signingService:i,priorSignature:e.priorSignature,eventStreamCredentials:a}).then(t=>({message:e.message,signature:t}))}async signString(e,{signingDate:n=new Date,signingRegion:i,signingService:a,eventStreamCredentials:d}={}){let f=d??await this.credentialProvider();this.validateResolvedCredentials(f);let m=i??await this.regionProvider(),{shortDate:h}=this.formatDate(n),_=new this.sha256(await this.getSigningKey(f,m,h,a));return _.update(o.toUint8Array(e)),t.toHex(await _.digest())}async signRequest(e,{signingDate:t=new Date,signableHeaders:n,unsignableHeaders:i,signingRegion:a,signingService:o}={}){let d=await this.credentialProvider();this.validateResolvedCredentials(d);let f=a??await this.regionProvider(),m=prepareRequest(e),{longDate:h,shortDate:j}=this.formatDate(t),L=createScope(j,f,o??this.service);m.headers[k]=h,d.sessionToken&&(m.headers[`x-amz-security-token`]=d.sessionToken);let V=await getPayloadHash(m,this.sha256);!hasHeader(P,m.headers)&&this.applyChecksum&&(m.headers[P]=V);let H=getCanonicalHeaders(m,i,n),W=await this.getSignature(h,L,this.getSigningKey(d,f,j,o),this.createCanonicalRequest(m,H,V));return m.headers[_]=`${U} Credential=${d.accessKeyId}/${L}, SignedHeaders=${this.getCanonicalHeaderList(H)}, Signature=${W}`,m}async getSignature(e,n,i,a){let d=await this.createStringToSign(e,n,a,U),f=new this.sha256(await i);return f.update(o.toUint8Array(d)),t.toHex(await f.digest())}getSigningKey(e,t,n,i){return getSigningKey(this.sha256,e,n,t,i||this.service)}};e.SignatureV4=SignatureV4}));function normalizeCredentialProvider(e,{credentials:t,credentialDefaultProvider:n}){let i;return i=t?t?.memoized?t:memoizeIdentityProvider(t,Ae,doesIdentityRequireRefresh):n?normalizeProvider(n(Object.assign({},e,{parentClientConfig:e}))):async()=>{throw Error("@aws-sdk/core::resolveAwsSdkSigV4Config - `credentials` not provided and no credentialDefaultProvider was configured.")},i.memoized=!0,i}function bindCallerConfig(e,t){if(t.configBound)return t;let fn=async n=>t({...n,callerClientConfig:e});return fn.memoized=t.memoized,fn.configBound=!0,fn}var tn,resolveAwsSdkSigV4Config,nn,rn=e.n((()=>{d.n(),Pe(),tn=en(),resolveAwsSdkSigV4Config=e=>{let t=e.credentials,n=!!e.credentials,resolvedCredentials;Object.defineProperty(e,`credentials`,{set(i){i&&i!==t&&i!==resolvedCredentials&&(n=!0),t=i;let a=bindCallerConfig(e,normalizeCredentialProvider(e,{credentials:t,credentialDefaultProvider:e.credentialDefaultProvider}));if(n&&!a.attributed){let e=typeof t==`object`&&!!t;resolvedCredentials=async t=>{let n=await a(t);return e&&(!n.$source||Object.keys(n.$source).length===0)?d.r(n,`CREDENTIALS_CODE`,`e`):n},resolvedCredentials.memoized=a.memoized,resolvedCredentials.configBound=a.configBound,resolvedCredentials.attributed=!0}else resolvedCredentials=a},get(){return resolvedCredentials},enumerable:!0,configurable:!0}),e.credentials=t;let{signingEscapePath:i=!0,systemClockOffset:a=e.systemClockOffset||0,sha256:o}=e,f;return f=e.signer?normalizeProvider(e.signer):e.regionInfoProvider?()=>normalizeProvider(e.region)().then(async t=>[await e.regionInfoProvider(t,{useFipsEndpoint:await e.useFipsEndpoint(),useDualstackEndpoint:await e.useDualstackEndpoint()})||{},t]).then(([t,n])=>{let{signingRegion:a,signingService:d}=t;e.signingRegion=e.signingRegion||a||n,e.signingName=e.signingName||d||e.serviceId;let f={...e,credentials:e.credentials,region:e.signingRegion,service:e.signingName,sha256:o,uriEscapePath:i};return new(e.signerConstructor||tn.SignatureV4)(f)}):async t=>{t=Object.assign({},{name:`sigv4`,signingName:e.signingName||e.defaultSigningName,signingRegion:await normalizeProvider(e.region)(),properties:{}},t);let n=t.signingRegion,a=t.signingName;e.signingRegion=e.signingRegion||n,e.signingName=e.signingName||a||e.serviceId;let d={...e,credentials:e.credentials,region:e.signingRegion,service:e.signingName,sha256:o,uriEscapePath:i};return new(e.signerConstructor||tn.SignatureV4)(d)},Object.assign(e,{systemClockOffset:a,signingEscapePath:i,signer:f})},nn=resolveAwsSdkSigV4Config})),an=e.n((()=>{zt(),Ht(),Yt(),Qt(),rn()})),on=e.r({AWSSDKSigV4Signer:()=>Lt,AwsSdkSigV4ASigner:()=>AwsSdkSigV4ASigner,AwsSdkSigV4Signer:()=>AwsSdkSigV4Signer,NODE_AUTH_SCHEME_PREFERENCE_OPTIONS:()=>Jt,NODE_SIGV4A_CONFIG_OPTIONS:()=>Zt,getBearerTokenEnvKey:()=>getBearerTokenEnvKey,resolveAWSSDKSigV4Config:()=>nn,resolveAwsSdkSigV4AConfig:()=>resolveAwsSdkSigV4AConfig,resolveAwsSdkSigV4Config:()=>resolveAwsSdkSigV4Config,validateSigningProperties:()=>validateSigningProperties}),sn=e.n((()=>{an(),Wt()})),cn=e.t((e=>{var t=require(`node:os`),n=require(`node:process`),i=Be(),a=require(`node:fs/promises`),o=require(`node:path`),d=ze();let getRuntimeUserAgentPair=()=>{for(let e of[`deno`,`bun`,`llrt`])if(n.versions[e])return[`md/${e}`,n.versions[e]];return[`md/nodejs`,n.versions.node]},getNodeModulesParentDirs=e=>{let t=process.cwd();if(!e)return[t];let n=o.normalize(e),i=n.split(o.sep),a=i.indexOf(`node_modules`),d=a===-1?n:i.slice(0,a).join(o.sep);return t===d?[t]:[d,t]},f=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*)?$/,getSanitizedTypeScriptVersion=(e=``)=>{let t=e.match(f);if(!t)return;let[n,i,a,o]=[t[1],t[2],t[3],t[4]];return o?`${n}.${i}.${a}-${o}`:`${n}.${i}.${a}`},m=[`^`,`~`,`>=`,`<=`,`>`,`<`],h=[`latest`,`beta`,`dev`,`rc`,`insiders`,`next`],getSanitizedDevTypeScriptVersion=(e=``)=>{if(h.includes(e))return e;let t=m.find(t=>e.startsWith(t))??``,n=getSanitizedTypeScriptVersion(e.slice(t.length));if(n)return`${t}${n}`},_,k=o.join(`node_modules`,`typescript`,`package.json`),getTypeScriptUserAgentPair=async()=>{if(_===null)return;if(typeof _==`string`)return[`md/tsc`,_];let e=!1;try{e=i.booleanSelector(process.env,`AWS_SDK_JS_TYPESCRIPT_DETECTION_DISABLED`,i.SelectorType.ENV)||!1}catch{}if(e){_=null;return}let t=getNodeModulesParentDirs(typeof __dirname<`u`?__dirname:void 0),n;for(let e of t)try{let t=o.join(e,`package.json`),i=await a.readFile(t,`utf-8`),{dependencies:d,devDependencies:f}=JSON.parse(i),m=f?.typescript??d?.typescript;if(typeof m!=`string`)continue;n=m;break}catch{}if(!n){_=null;return}let d;for(let e of t)try{let t=o.join(e,k),n=await a.readFile(t,`utf-8`),{version:i}=JSON.parse(n),f=getSanitizedTypeScriptVersion(i);if(typeof f!=`string`)continue;d=f;break}catch{}if(d)return _=d,[`md/tsc`,_];let f=getSanitizedDevTypeScriptVersion(n);if(typeof f!=`string`){_=null;return}return _=`dev_${f}`,[`md/tsc`,_]},j={isCrtAvailable:!1},isCrtAvailable=()=>j.isCrtAvailable?[`md/crt-avail`]:null,createDefaultUserAgentProvider=({serviceId:e,clientVersion:i})=>{let a=getRuntimeUserAgentPair();return async o=>{let d=[[`aws-sdk-js`,i],[`ua`,`2.1`],[`os/${t.platform()}`,t.release()],[`lang/js`],a],f=await getTypeScriptUserAgentPair();f&&d.push(f);let m=isCrtAvailable();m&&d.push(m),e&&d.push([`api/${e}`,i]),n.env.AWS_EXECUTION_ENV&&d.push([`exec-env/${n.env.AWS_EXECUTION_ENV}`]);let h=await o?.userAgentAppId?.();return h?[...d,[`app/${h}`]]:[...d]}},P=createDefaultUserAgentProvider,L=`AWS_SDK_UA_APP_ID`,V=`sdk_ua_app_id`;e.NODE_APP_ID_CONFIG_OPTIONS={environmentVariableSelector:e=>e[L],configFileSelector:e=>e[V]??e[`sdk-ua-app-id`],default:d.DEFAULT_UA_APP_ID},e.UA_APP_ID_ENV_NAME=L,e.UA_APP_ID_INI_NAME=V,e.createDefaultUserAgentProvider=createDefaultUserAgentProvider,e.crtAvailability=j,e.defaultUserAgent=P})),ln=e.t((e=>{var t=a.n(),n=a.t(),i=require(`buffer`),o=require(`crypto`),Hash=class{algorithmIdentifier;secret;hash;constructor(e,t){this.algorithmIdentifier=e,this.secret=t,this.reset()}update(e,t){this.hash.update(n.toUint8Array(castSourceData(e,t)))}digest(){return Promise.resolve(this.hash.digest())}reset(){this.hash=this.secret?o.createHmac(this.algorithmIdentifier,castSourceData(this.secret)):o.createHash(this.algorithmIdentifier)}};function castSourceData(e,n){return i.Buffer.isBuffer(e)?e:typeof e==`string`?t.fromString(e,n):ArrayBuffer.isView(e)?t.fromArrayBuffer(e.buffer,e.byteOffset,e.byteLength):t.fromArrayBuffer(e)}e.Hash=Hash})),un=e.t((e=>{var t=require(`node:fs`);let calculateBodyLength=e=>{if(!e)return 0;if(typeof e==`string`)return Buffer.byteLength(e);if(typeof e.byteLength==`number`)return e.byteLength;if(typeof e.size==`number`)return e.size;if(typeof e.start==`number`&&typeof e.end==`number`)return e.end+1-e.start;if(e instanceof t.ReadStream){if(e.path!=null)return t.lstatSync(e.path).size;if(typeof e.fd==`number`)return t.fstatSync(e.fd).size}throw Error(`Body Length computation failed for ${e}`)};e.calculateBodyLength=calculateBodyLength})),dn=e.t((t=>{var n=Ve(),i=h.t(),a=f.t();let o=`AWS_REGION`,d=`AWS_DEFAULT_REGION`,m=[`in-region`,`cross-region`,`mobile`,`standard`,`legacy`],_={environmentVariableSelector:e=>e.AWS_DEFAULTS_MODE,configFileSelector:e=>e.defaults_mode,default:`legacy`},resolveDefaultsModeConfig=({region:e=i.loadConfig(n.NODE_REGION_CONFIG_OPTIONS),defaultsMode:t=i.loadConfig(_)}={})=>a.memoize(async()=>{let n=typeof t==`function`?await t():t;switch(n?.toLowerCase()){case`auto`:return resolveNodeDefaultsModeAuto(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 Error(`Invalid parameter for "defaultsMode", expect ${m.join(`, `)}, got ${n}`)}}),resolveNodeDefaultsModeAuto=async e=>{if(e){let t=typeof e==`function`?await e():e,n=await inferPhysicalRegion();return n?t===n?`in-region`:`cross-region`:`standard`}return`standard`},inferPhysicalRegion=async()=>{if(process.env.AWS_EXECUTION_ENV&&(process.env[o]||process.env[d]))return process.env[o]??process.env[d];if(!process.env.AWS_EC2_METADATA_DISABLED)try{let{getInstanceMetadataEndpoint:t,httpRequest:n}=await Promise.resolve().then(()=>e.o()(require(`./dist-cjs-CDrv1zcx.cjs`)));return(await n({...await t(),path:`/latest/meta-data/placement/region`})).toString()}catch{}};t.resolveDefaultsModeConfig=resolveDefaultsModeConfig}));function alloc(e){return typeof Buffer<`u`?Buffer.alloc(e):new Uint8Array(e)}function tag(e){return e[An]=!0,e}var pn,mn,hn,gn,_n,vn,yn,bn,xn,Sn,Cn,wn,Tn,En,Dn,On,kn,An,jn=e.n((()=>{pn=0,mn=1,hn=2,gn=3,_n=4,vn=5,yn=6,bn=7,xn=20,Sn=21,Cn=22,wn=23,Tn=24,En=25,Dn=26,On=27,kn=31,An=Symbol(`@smithy/core/cbor::tagSymbol`)}));function setPayload(e){J=e,Fn=new DataView(J.buffer,J.byteOffset,J.byteLength)}function decode(e,t){if(e>=t)throw Error(`unexpected end of (decode) payload.`);let n=(J[e]&224)>>5,a=J[e]&31;switch(n){case pn:case mn:case yn:let o,d;if(a<24)o=a,d=1;else switch(a){case Tn:case En:case Dn:case On:let n=Ln[a],i=n+1;if(d=i,t-e<i)throw Error(`countLength ${n} greater than remaining buf len.`);let f=e+1;o=n===1?J[f]:n===2?Fn.getUint16(f):n===4?Fn.getUint32(f):Fn.getBigUint64(f);break;default:throw Error(`unexpected minor value ${a}.`)}if(n===pn)return Y=d,castBigInt(o);if(n===mn){let e;return e=typeof o==`bigint`?BigInt(-1)-o:-1-o,Y=d,castBigInt(e)}else if(a===2||a===3){let n=decodeCount(e+d,t),i=BigInt(0),o=e+d+Y;for(let e=o;e<o+n;++e)i=i<<BigInt(8)|BigInt(J[e]);return Y=d+Y+n,a===3?-i-BigInt(1):i}else if(a===4){let[n,a]=decode(e+d,t),o=a<0?-1:1,f=`0`.repeat(Math.abs(n)+1)+String(BigInt(o)*BigInt(a)),m,h=a<0?`-`:``;return m=n===0?f:f.slice(0,f.length+n)+`.`+f.slice(n),m=m.replace(/^0+/g,``),m===``&&(m=`0`),m[0]===`.`&&(m=`0`+m),m=h+m,Y=d+Y,i.m(m)}else{let n=decode(e+d,t);return Y=d+Y,tag({tag:castBigInt(o),value:n})}case gn:case vn:case _n:case hn:if(a===kn)switch(n){case gn:return decodeUtf8StringIndefinite(e,t);case vn:return decodeMapIndefinite(e,t);case _n:return decodeListIndefinite(e,t);case hn:return decodeUnstructuredByteStringIndefinite(e,t)}else switch(n){case gn:return decodeUtf8String(e,t);case vn:return decodeMap(e,t);case _n:return decodeList(e,t);case hn:return decodeUnstructuredByteString(e,t)}default:return decodeSpecial(e,t)}}function bytesToUtf8(e,t,n){return Pn&&e.constructor?.name===`Buffer`?e.toString(`utf-8`,t,n):In?In.decode(e.subarray(t,n)):(0,Mn.toUtf8)(e.subarray(t,n))}function demote(e){let t=Number(e);return(t<-(2**53-1)||2**53-1<t)&&console.warn(Error(`@smithy/core/cbor - truncating BigInt(${e}) to ${t} with loss of precision.`)),t}function bytesToFloat16(e,t){let n=e>>7,i=(e&124)>>2,a=(e&3)<<8|t,o=n===0?1:-1,d,f;if(i===0){if(a===0)return 0;d=2**-14,f=0}else if(i===31)return a===0?o*(1/0):NaN;else d=2**(i-15),f=1;return f+=a/1024,d*f*o}function decodeCount(e,t){let n=J[e]&31;if(n<24)return Y=1,n;if(n===Tn||n===En||n===Dn||n===On){let i=Ln[n];if(Y=i+1,t-e<Y)throw Error(`countLength ${i} greater than remaining buf len.`);let a=e+1;return i===1?J[a]:i===2?Fn.getUint16(a):i===4?Fn.getUint32(a):demote(Fn.getBigUint64(a))}throw Error(`unexpected minor value ${n}.`)}function decodeUtf8String(e,t){let n=decodeCount(e,t),i=Y;if(e+=i,t-e<n)throw Error(`string len ${n} greater than remaining buf len.`);let a=bytesToUtf8(J,e,e+n);return Y=i+n,a}function decodeUtf8StringIndefinite(e,t){e+=1;let n=[];for(let i=e;e<t;){if(J[e]===255){let t=alloc(n.length);return t.set(n,0),Y=e-i+2,bytesToUtf8(t,0,t.length)}let a=(J[e]&224)>>5,o=J[e]&31;if(a!==gn)throw Error(`unexpected major type ${a} in indefinite string.`);if(o===kn)throw Error(`nested indefinite string.`);let d=decodeUnstructuredByteString(e,t);e+=Y;for(let e=0;e<d.length;++e)n.push(d[e])}throw Error(`expected break marker.`)}function decodeUnstructuredByteString(e,t){let n=decodeCount(e,t),i=Y;if(e+=i,t-e<n)throw Error(`unstructured byte string len ${n} greater than remaining buf len.`);let a=J.subarray(e,e+n);return Y=i+n,a}function decodeUnstructuredByteStringIndefinite(e,t){e+=1;let n=[];for(let i=e;e<t;){if(J[e]===255){let t=alloc(n.length);return t.set(n,0),Y=e-i+2,t}let a=(J[e]&224)>>5,o=J[e]&31;if(a!==hn)throw Error(`unexpected major type ${a} in indefinite string.`);if(o===kn)throw Error(`nested indefinite string.`);let d=decodeUnstructuredByteString(e,t);e+=Y;for(let e=0;e<d.length;++e)n.push(d[e])}throw Error(`expected break marker.`)}function decodeList(e,t){let n=decodeCount(e,t),i=Y;e+=i;let a=e,o=Array(n);for(let i=0;i<n;++i){let n=decode(e,t),a=Y;o[i]=n,e+=a}return Y=i+(e-a),o}function decodeListIndefinite(e,t){e+=1;let n=[];for(let i=e;e<t;){if(J[e]===255)return Y=e-i+2,n;let a=decode(e,t);e+=Y,n.push(a)}throw Error(`expected break marker.`)}function decodeMap(e,t){let n=decodeCount(e,t),i=Y;e+=i;let a=e,o={};for(let i=0;i<n;++i){if(e>=t)throw Error(`unexpected end of map payload.`);let n=(J[e]&224)>>5;if(n!==gn)throw Error(`unexpected major type ${n} for map key at index ${e}.`);let i=decode(e,t);e+=Y;let a=decode(e,t);e+=Y,o[i]=a}return Y=i+(e-a),o}function decodeMapIndefinite(e,t){e+=1;let n=e,i={};for(;e<t;){if(e>=t)throw Error(`unexpected end of map payload.`);if(J[e]===255)return Y=e-n+2,i;let a=(J[e]&224)>>5;if(a!==gn)throw Error(`unexpected major type ${a} for map key.`);let o=decode(e,t);e+=Y;let d=decode(e,t);e+=Y,i[o]=d}throw Error(`expected break marker.`)}function decodeSpecial(e,t){let n=J[e]&31;switch(n){case Sn:case xn:return Y=1,n===Sn;case Cn:return Y=1,null;case wn:return Y=1,null;case En:if(t-e<3)throw Error(`incomplete float16 at end of buf.`);return Y=3,bytesToFloat16(J[e+1],J[e+2]);case Dn:if(t-e<5)throw Error(`incomplete float32 at end of buf.`);return Y=5,Fn.getFloat32(e+1);case On:if(t-e<9)throw Error(`incomplete float64 at end of buf.`);return Y=9,Fn.getFloat64(e+1);default:throw Error(`unexpected minor value ${n}.`)}}function castBigInt(e){if(typeof e==`number`)return e;let t=Number(e);return-(2**53-1)<=t&&t<=2**53-1?t:e}var Mn,Nn,Pn,J,Fn,In,Y,Ln,Rn=e.n((()=>{i.d(),Mn=a.t(),jn(),Nn=typeof TextDecoder<`u`,Pn=typeof Buffer<`u`,J=alloc(0),Fn=new DataView(J.buffer,J.byteOffset,J.byteLength),In=Nn?new TextDecoder:null,Y=0,Ln={[Tn]:1,[En]:2,[Dn]:4,[On]:8}}));function ensureSpace(e){X.byteLength-Z<e&&resize(Z<16e6?Math.max(X.byteLength*4,X.byteLength+e):X.byteLength+e+16e6)}function toUint8Array(){let e=alloc(Z);return e.set(X.subarray(0,Z),0),Z=0,e}function resize(e){let t=X;X=alloc(e),t&&(t.copy?t.copy(X,0,0,t.byteLength):X.set(t,0)),Vn=new DataView(X.buffer,X.byteOffset,X.byteLength)}function encodeHeader(e,t){t<24?X[Z++]=e<<5|t:t<256?(X[Z++]=e<<5|24,X[Z++]=t):t<65536?(X[Z++]=e<<5|En,Vn.setUint16(Z,t),Z+=2):t<2**32?(X[Z++]=e<<5|Dn,Vn.setUint32(Z,t),Z+=4):(X[Z++]=e<<5|On,Vn.setBigUint64(Z,typeof t==`bigint`?t:BigInt(t)),Z+=8)}function encode(e){let t=[e];for(;t.length;){let e=t.pop();if(ensureSpace(typeof e==`string`?e.length*4:64),typeof e==`string`){if(Bn)encodeHeader(gn,Buffer.byteLength(e)),Z+=X.write(e,Z);else{let t=(0,zn.fromUtf8)(e);encodeHeader(gn,t.byteLength),X.set(t,Z),Z+=t.byteLength}continue}else if(typeof e==`number`){if(Number.isInteger(e)){let t=e>=0,n=t?pn:mn,i=t?e:-e-1;i<24?X[Z++]=n<<5|i:i<256?(X[Z++]=n<<5|24,X[Z++]=i):i<65536?(X[Z++]=n<<5|En,X[Z++]=i>>8,X[Z++]=i):i<4294967296?(X[Z++]=n<<5|Dn,Vn.setUint32(Z,i),Z+=4):(X[Z++]=n<<5|On,Vn.setBigUint64(Z,BigInt(i)),Z+=8);continue}X[Z++]=bn<<5|On,Vn.setFloat64(Z,e),Z+=8;continue}else if(typeof e==`bigint`){let t=e>=0,n=t?pn:mn,i=t?e:-e-BigInt(1),a=Number(i);if(a<24)X[Z++]=n<<5|a;else if(a<256)X[Z++]=n<<5|24,X[Z++]=a;else if(a<65536)X[Z++]=n<<5|En,X[Z++]=a>>8,X[Z++]=a&255;else if(a<4294967296)X[Z++]=n<<5|Dn,Vn.setUint32(Z,a),Z+=4;else if(i<BigInt(`18446744073709551616`))X[Z++]=n<<5|On,Vn.setBigUint64(Z,i),Z+=8;else{let e=i.toString(2),n=new Uint8Array(Math.ceil(e.length/8)),a=i,o=0;for(;n.byteLength-++o>=0;)n[n.byteLength-o]=Number(a&BigInt(255)),a>>=BigInt(8);ensureSpace(n.byteLength*2),X[Z++]=t?194:195,Bn?encodeHeader(hn,Buffer.byteLength(n)):encodeHeader(hn,n.byteLength),X.set(n,Z),Z+=n.byteLength}continue}else if(e===null){X[Z++]=bn<<5|Cn;continue}else if(typeof e==`boolean`){X[Z++]=bn<<5|(e?Sn:xn);continue}else if(e===void 0)throw Error(`@smithy/core/cbor: client may not serialize undefined value.`);else if(Array.isArray(e)){for(let n=e.length-1;n>=0;--n)t.push(e[n]);encodeHeader(_n,e.length);continue}else if(typeof e.byteLength==`number`){ensureSpace(e.length*2),encodeHeader(hn,e.length),X.set(e,Z),Z+=e.byteLength;continue}else if(typeof e==`object`){if(e instanceof i.p){let n=e.string.indexOf(`.`),i=n===-1?0:n-e.string.length+1,a=BigInt(e.string.replace(`.`,``));X[Z++]=196,t.push(a),t.push(i),encodeHeader(_n,2);continue}if(e[An])if(`tag`in e&&`value`in e){t.push(e.value),encodeHeader(yn,e.tag);continue}else throw Error(`tag encountered with missing fields, need 'tag' and 'value', found: `+JSON.stringify(e));let n=Object.keys(e);for(let i=n.length-1;i>=0;--i){let a=n[i];t.push(e[a]),t.push(a)}encodeHeader(vn,n.length);continue}throw Error(`data type ${e?.constructor?.name??typeof e} not compatible for encoding.`)}}var zn,Bn,X,Vn,Z,Hn=e.n((()=>{i.d(),zn=a.t(),jn(),Bn=typeof Buffer<`u`,X=alloc(2048),Vn=new DataView(X.buffer,X.byteOffset,X.byteLength),Z=0})),Un,Wn=e.n((()=>{Rn(),Hn(),Un={deserialize(e){return setPayload(e),decode(0,e.length)},serialize(e){try{return encode(e),toUint8Array()}catch(e){throw toUint8Array(),e}},resizeEncodingBuffer(e){resize(e)}}})),dateToTag,loadSmithyRpcV2CborErrorCode,Gn=e.n((()=>{i.n(),jn(),dateToTag=e=>tag({tag:1,value:e.getTime()/1e3}),loadSmithyRpcV2CborErrorCode=(e,t)=>{let sanitizeErrorCode=e=>{let t=e;return typeof t==`number`&&(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};if(t.__type!==void 0)return sanitizeErrorCode(t.__type);let n=Object.keys(t).find(e=>e.toLowerCase()===`code`);if(n&&t[n]!==void 0)return sanitizeErrorCode(t[n])}})),Kn,CborCodec,CborShapeSerializer,CborShapeDeserializer,qn=e.n((()=>{i.n(),i.T(),i.d(),Kn=i.z(),Wn(),Gn(),CborCodec=class extends i.u{createSerializer(){let e=new CborShapeSerializer;return e.setSerdeContext(this.serdeContext),e}createDeserializer(){let e=new CborShapeDeserializer;return e.setSerdeContext(this.serdeContext),e}},CborShapeSerializer=class extends i.u{value;write(e,t){this.value=this.serialize(e,t)}serialize(e,t){let n=i.O.of(e);if(t==null)return n.isIdempotencyToken()?(0,i._.v4)():t;if(n.isBlobSchema())return typeof t==`string`?(this.serdeContext?.base64Decoder??Kn.fromBase64)(t):t;if(n.isTimestampSchema())return dateToTag(typeof t==`number`||typeof t==`bigint`?new Date(Number(t)/1e3|0):t);if(typeof t==`function`||typeof t==`object`){let e=t;if(n.isListSchema()&&Array.isArray(e)){let t=!!n.getMergedTraits().sparse,i=[],a=0;for(let o of e){let e=this.serialize(n.getValueSchema(),o);(e!=null||t)&&(i[a++]=e)}return i}if(e instanceof Date)return dateToTag(e);let i={};if(n.isMapSchema()){let t=!!n.getMergedTraits().sparse;for(let a of Object.keys(e)){let o=this.serialize(n.getValueSchema(),e[a]);(o!=null||t)&&(i[a]=o)}}else if(n.isStructSchema()){for(let[t,a]of n.structIterator()){let n=this.serialize(a,e[t]);n!=null&&(i[t]=n)}if(n.isUnionSchema()&&Array.isArray(e.$unknown)){let[t,n]=e.$unknown;i[t]=n}else if(typeof e.__type==`string`)for(let[t,n]of Object.entries(e))t in i||(i[t]=this.serialize(15,n))}else if(n.isDocumentSchema())for(let t of Object.keys(e))i[t]=this.serialize(n.getValueSchema(),e[t]);else if(n.isBigDecimalSchema())return e;return i}return t}flush(){let e=Un.serialize(this.value);return this.value=void 0,e}},CborShapeDeserializer=class extends i.u{read(e,t){let n=Un.deserialize(t);return this.readValue(e,n)}readValue(e,t){let n=i.O.of(e);if(n.isTimestampSchema()){if(typeof t==`number`)return i.h(t);if(typeof t==`object`&&t.tag===1&&`value`in t)return i.h(t.value)}if(n.isBlobSchema())return typeof t==`string`?(this.serdeContext?.base64Decoder??Kn.fromBase64)(t):t;if(t===void 0||typeof t==`boolean`||typeof t==`number`||typeof t==`string`||typeof t==`bigint`||typeof t==`symbol`)return t;if(typeof t==`object`){if(t===null)return null;if(`byteLength`in t||t instanceof Date||n.isDocumentSchema())return t;if(n.isListSchema()){let e=[],i=n.getValueSchema();for(let n of t){let t=this.readValue(i,n);e.push(t)}return e}let e={};if(n.isMapSchema()){let i=n.getValueSchema();for(let n of Object.keys(t))e[n]=this.readValue(i,t[n])}else if(n.isStructSchema()){let i=n.isUnionSchema(),a;i&&(a=new Set(Object.keys(t).filter(e=>e!==`__type`)));for(let[o,d]of n.structIterator())i&&a.delete(o),t[o]!=null&&(e[o]=this.readValue(d,t[o]));if(i&&a?.size===1&&Object.keys(e).length===0){let n=a.values().next().value;e.$unknown=[n,t[n]]}else if(typeof t.__type==`string`)for(let[n,i]of Object.entries(t))n in e||(e[n]=i)}else if(t instanceof i.p)return t;return e}else return t}}})),Jn,SmithyRpcV2CborProtocol,Yn=e.n((()=>{i.n(),i.T(),Jn=i.B(),qn(),Gn(),SmithyRpcV2CborProtocol=class extends i.c{codec=new CborCodec;serializer=this.codec.createSerializer();deserializer=this.codec.createDeserializer();constructor({defaultNamespace:e,errorTypeRegistries:t}){super({defaultNamespace:e,errorTypeRegistries:t})}getShapeId(){return`smithy.protocols#rpcv2Cbor`}getPayloadCodec(){return this.codec}async serializeRequest(e,t,n){let a=await super.serializeRequest(e,t,n);if(Object.assign(a.headers,{"content-type":this.getDefaultContentType(),"smithy-protocol":`rpc-v2-cbor`,accept:this.getDefaultContentType()}),i.M(e.input)===`unit`)delete a.body,delete a.headers[`content-type`];else{a.body||=(this.serializer.write(15,{}),this.serializer.flush());try{a.headers[`content-length`]=String(a.body.byteLength)}catch{}}let{service:o,operation:d}=(0,Jn.getSmithyContext)(n),f=`/service/${o}/operation/${d}`;return a.path.endsWith(`/`)?a.path+=f.slice(1):a.path+=f,a}async deserializeResponse(e,t,n){return super.deserializeResponse(e,t,n)}async handleError(e,t,n,a,o){let d=loadSmithyRpcV2CborErrorCode(n,a)??`Unknown`,f={$metadata:o,$fault:n.statusCode<=500?`client`:`server`},m=this.options.defaultNamespace;d.includes(`#`)&&([m]=d.split(`#`));let h=this.compositeErrorRegistry,_=i.D.for(m);h.copyFrom(_);let k;try{k=h.getSchema(d)}catch{a.Message&&(a.message=a.Message);let e=i.D.for(`smithy.ts.sdk.synthetic.`+m);h.copyFrom(e);let t=h.getBaseException();if(t){let e=h.getErrorCtor(t);throw Object.assign(new e({name:d}),f,a)}throw Object.assign(Error(d),f,a)}let j=i.O.of(k),P=h.getErrorCtor(k),L=a.message??a.Message??`Unknown`,V=new P(L),H={};for(let[e,t]of j.structIterator())H[e]=this.deserializer.readValue(t,a[e]);throw Object.assign(V,f,{$fault:j.getMergedTraits().error,message:L},H)}getDefaultContentType(){return`application/cbor`}}})),Xn=e.n((()=>{Gn(),Yn(),qn()})),Zn,ProtocolLib,Qn=e.n((()=>{i.T(),Zn=i.t(),ProtocolLib=class{queryCompat;errorRegistry;constructor(e=!1){this.queryCompat=e}resolveRestContentType(e,t){let n=t.getMemberSchemas(),i=Object.values(n).find(e=>!!e.getMergedTraits().httpPayload);if(i)return i.getMergedTraits().mediaType||(i.isStringSchema()?`text/plain`:i.isBlobSchema()?`application/octet-stream`:e);if(!t.isUnitSchema()&&Object.values(n).find(e=>{let{httpQuery:t,httpQueryParams:n,httpHeader:i,httpLabel:a,httpPrefixHeaders:o}=e.getMergedTraits();return!t&&!n&&!i&&!a&&o===void 0}))return e}async getErrorSchemaOrThrowBaseException(e,t,n,i,a,o){let d=e;e.includes(`#`)&&([,d]=e.split(`#`));let f={$metadata:a,$fault:n.statusCode<500?`client`:`server`};if(!this.errorRegistry)throw Error(`@aws-sdk/core/protocols - error handler not initialized.`);try{return{errorSchema:o?.(this.errorRegistry,d)??this.errorRegistry.getSchema(e),errorMetadata:f}}catch{i.message=i.message??i.Message??`UnknownError`;let e=this.errorRegistry,t=e.getBaseException();if(t){let n=e.getErrorCtor(t)??Error;throw this.decorateServiceException(Object.assign(new n({name:d}),f),i)}let n=i,a=n?.message??n?.Message??n?.Error?.Message??n?.Error?.message;throw this.decorateServiceException(Object.assign(Error(a),{name:d},f),i)}}compose(e,t,n){let a=n;t.includes(`#`)&&([a]=t.split(`#`));let o=i.D.for(a),d=i.D.for(`smithy.ts.sdk.synthetic.`+n);e.copyFrom(o),e.copyFrom(d),this.errorRegistry=e}decorateServiceException(e,t={}){if(this.queryCompat){let n=e.Message??t.Message,i=(0,Zn.decorateServiceException)(e,t);n&&(i.message=n),i.Error={...i.Error,Type:i.Error?.Type,Code:i.Error?.Code,Message:i.Error?.message??i.Error?.Message??n};let a=i.$metadata.requestId;return a&&(i.RequestId=a),i}return(0,Zn.decorateServiceException)(e,t)}setQueryCompatError(e,t){let n=t.headers?.[`x-amzn-query-error`];if(e!==void 0&&n!=null){let[t,i]=n.split(`;`),a=Object.entries(e),o={Code:t,Type:i};Object.assign(e,o);for(let[e,t]of a)o[e===`message`?`Message`:e]=t;delete o.__type,e.Error=o}}queryCompatOutput(e,t){e.Error&&(t.Error=e.Error),e.Type&&(t.Type=e.Type),e.Code&&(t.Code=e.Code)}findQueryCompatibleError(e,t){try{return e.getSchema(t)}catch{return e.find(e=>i.O.of(e).getMergedTraits().awsQueryError?.[0]===t)}}}})),AwsSmithyRpcV2CborProtocol,$n=e.n((()=>{Xn(),i.T(),Qn(),AwsSmithyRpcV2CborProtocol=class extends SmithyRpcV2CborProtocol{awsQueryCompatible;mixin;constructor({defaultNamespace:e,errorTypeRegistries:t,awsQueryCompatible:n}){super({defaultNamespace:e,errorTypeRegistries:t}),this.awsQueryCompatible=!!n,this.mixin=new ProtocolLib(this.awsQueryCompatible)}async serializeRequest(e,t,n){let i=await super.serializeRequest(e,t,n);return this.awsQueryCompatible&&(i.headers[`x-amzn-query-mode`]=`true`),i}async handleError(e,t,n,a,o){this.awsQueryCompatible&&this.mixin.setQueryCompatError(a,n);let d=(()=>{let e=n.headers[`x-amzn-query-error`];return e&&this.awsQueryCompatible?e.split(`;`)[0]:loadSmithyRpcV2CborErrorCode(n,a)??`Unknown`})();this.mixin.compose(this.compositeErrorRegistry,d,this.options.defaultNamespace);let{errorSchema:f,errorMetadata:m}=await this.mixin.getErrorSchemaOrThrowBaseException(d,this.options.defaultNamespace,n,a,o,this.awsQueryCompatible?this.mixin.findQueryCompatibleError:void 0),h=i.O.of(f),_=a.message??a.Message??`UnknownError`,k=new((this.compositeErrorRegistry.getErrorCtor(f))??Error)(_),j={};for(let[e,t]of h.structIterator())a[e]!=null&&(j[e]=this.deserializer.readValue(t,a[e]));throw this.awsQueryCompatible&&this.mixin.queryCompatOutput(a,j),this.mixin.decorateServiceException(Object.assign(k,m,{$fault:h.getMergedTraits().error,message:_},j),a)}}})),_toStr,_toBool,_toNum,er=e.n((()=>{_toStr=e=>{if(e==null)return e;if(typeof e==`number`||typeof e==`bigint`){let t=Error(`Received number ${e} where a string was expected.`);return t.name=`Warning`,console.warn(t),String(e)}if(typeof e==`boolean`){let t=Error(`Received boolean ${e} where a string was expected.`);return t.name=`Warning`,console.warn(t),String(e)}return e},_toBool=e=>{if(e==null)return e;if(typeof e==`string`){let t=e.toLowerCase();if(e!==``&&t!==`false`&&t!==`true`){let t=Error(`Received string "${e}" where a boolean was expected.`);t.name=`Warning`,console.warn(t)}return e!==``&&t!==`false`}return e},_toNum=e=>{if(e==null)return e;if(typeof e==`string`){let t=Number(e);if(t.toString()!==e){let t=Error(`Received string "${e}" where a number was expected.`);return t.name=`Warning`,console.warn(t),e}return t}return e}})),SerdeContextConfig,tr=e.n((()=>{SerdeContextConfig=class{serdeContext;setSerdeContext(e){this.serdeContext=e}}})),UnionSerde,nr=e.n((()=>{UnionSerde=class{from;to;keys;constructor(e,t){this.from=e,this.to=t,this.keys=new Set(Object.keys(this.from).filter(e=>e!==`__type`))}mark(e){this.keys.delete(e)}hasUnknown(){return this.keys.size===1&&Object.keys(this.to).length===0}writeUnknown(){if(this.hasUnknown()){let e=this.keys.values().next().value,t=this.from[e];this.to.$unknown=[e,t]}}}}));function jsonReviver(e,t,n){if(n?.source){let e=n.source;if(typeof t==`number`&&(t>2**53-1||t<-(2**53-1)||e!==String(t)))return e.includes(`.`)?new i.p(e,`bigDecimal`):BigInt(e)}return t}var rr=e.n((()=>{i.d()})),ir,ar,collectBodyString,or=e.n((()=>{ir=i.t(),ar=a.t(),collectBodyString=(e,t)=>(0,ir.collectBody)(e,t).then(e=>(t?.utf8Encoder??ar.toUtf8)(e))})),parseJsonBody,parseJsonErrorBody,loadRestJsonErrorCode,sr=e.n((()=>{or(),parseJsonBody=(e,t)=>collectBodyString(e,t).then(e=>{if(e.length)try{return JSON.parse(e)}catch(t){throw t?.name===`SyntaxError`&&Object.defineProperty(t,`$responseBodyText`,{value:e}),t}return{}}),parseJsonErrorBody=async(e,t)=>{let n=await parseJsonBody(e,t);return n.message=n.message??n.Message,n},loadRestJsonErrorCode=(e,t)=>{let findKey=(e,t)=>Object.keys(e).find(e=>e.toLowerCase()===t.toLowerCase()),sanitizeErrorCode=e=>{let t=e;return typeof t==`number`&&(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},n=findKey(e.headers,`x-amzn-errortype`);if(n!==void 0)return sanitizeErrorCode(e.headers[n]);if(t&&typeof t==`object`){let e=findKey(t,`code`);if(e&&t[e]!==void 0)return sanitizeErrorCode(t[e]);if(t.__type!==void 0)return sanitizeErrorCode(t.__type)}}})),cr,JsonShapeDeserializer,lr=e.n((()=>{i.n(),i.T(),i.d(),cr=i.z(),tr(),nr(),rr(),sr(),JsonShapeDeserializer=class extends SerdeContextConfig{settings;constructor(e){super(),this.settings=e}async read(e,t){return this._read(e,typeof t==`string`?JSON.parse(t,jsonReviver):await parseJsonBody(t,this.serdeContext))}readObject(e,t){return this._read(e,t)}_read(e,t){let n=typeof t==`object`&&!!t,a=i.O.of(e);if(n){if(a.isStructSchema()){let e=t,n=a.isUnionSchema(),i={},o,{jsonName:d}=this.settings;d&&(o={});let f;n&&(f=new UnionSerde(e,i));for(let[t,m]of a.structIterator()){let a=t;d&&(a=m.getMergedTraits().jsonName??a,o[a]=t),n&&f.mark(a),e[a]!=null&&(i[t]=this._read(m,e[a]))}if(n)f.writeUnknown();else if(typeof e.__type==`string`)for(let[t,n]of Object.entries(e)){let e=d?o[t]??t:t;e in i||(i[e]=n)}return i}if(Array.isArray(t)&&a.isListSchema()){let e=a.getValueSchema(),n=[];for(let i of t)n.push(this._read(e,i));return n}if(a.isMapSchema()){let e=a.getValueSchema(),n={};for(let[i,a]of Object.entries(t))n[i]=this._read(e,a);return n}}if(a.isBlobSchema()&&typeof t==`string`)return(0,cr.fromBase64)(t);let o=a.getMergedTraits().mediaType;if(a.isStringSchema()&&typeof t==`string`&&o)return o===`application/json`||o.endsWith(`+json`)?i.g.from(t):t;if(a.isTimestampSchema()&&t!=null)switch(i.o(a,this.settings)){case 5:return i.C(t);case 6:return i.w(t);case 7:return i.S(t);default:return console.warn(`Missing timestamp format, parsing value with Date constructor:`,t),new Date(t)}if(a.isBigIntegerSchema()&&(typeof t==`number`||typeof t==`string`))return BigInt(t);if(a.isBigDecimalSchema()&&t!=null){if(t instanceof i.p)return t;let e=t;return e.type===`bigDecimal`&&`string`in e?new i.p(e.string,e.type):new i.p(String(t),`bigDecimal`)}if(a.isNumericSchema()&&typeof t==`string`){switch(t){case`Infinity`:return 1/0;case`-Infinity`:return-1/0;case`NaN`:return NaN}return t}if(a.isDocumentSchema())if(n){let e=Array.isArray(t)?[]:{};for(let[n,o]of Object.entries(t))o instanceof i.p?e[n]=o:e[n]=this._read(a,o);return e}else return structuredClone(t);return t}}})),ur,JsonReplacer,dr=e.n((()=>{i.d(),ur=`Ν`,JsonReplacer=class{values=new Map;counter=0;stage=0;createReplacer(){if(this.stage===1)throw Error(`@aws-sdk/core/protocols - JsonReplacer already created.`);if(this.stage===2)throw Error(`@aws-sdk/core/protocols - JsonReplacer exhausted.`);return this.stage=1,(e,t)=>{if(t instanceof i.p){let e=`${ur+`nv`+ this.counter++}_`+t.string;return this.values.set(`"${e}"`,t.string),e}if(typeof t==`bigint`){let e=t.toString(),n=`${ur+`b`+ this.counter++}_`+e;return this.values.set(`"${n}"`,e),n}return t}}replaceInJson(e){if(this.stage===0)throw Error(`@aws-sdk/core/protocols - JsonReplacer not created yet.`);if(this.stage===2)throw Error(`@aws-sdk/core/protocols - JsonReplacer exhausted.`);if(this.stage=2,this.counter===0)return e;for(let[t,n]of this.values)e=e.replace(t,n);return e}}})),fr,JsonShapeSerializer,pr=e.n((()=>{i.n(),i.T(),i.d(),fr=i.z(),tr(),dr(),JsonShapeSerializer=class extends SerdeContextConfig{settings;buffer;useReplacer=!1;rootSchema;constructor(e){super(),this.settings=e}write(e,t){this.rootSchema=i.O.of(e),this.buffer=this._write(this.rootSchema,t)}writeDiscriminatedDocument(e,t){this.write(e,t),typeof this.buffer==`object`&&(this.buffer.__type=i.O.of(e).getName(!0))}flush(){let{rootSchema:e,useReplacer:t}=this;if(this.rootSchema=void 0,this.useReplacer=!1,e?.isStructSchema()||e?.isDocumentSchema()){if(!t)return JSON.stringify(this.buffer);let e=new JsonReplacer;return e.replaceInJson(JSON.stringify(this.buffer,e.createReplacer(),0))}return this.buffer}_write(e,t,n){let a=typeof t==`object`&&!!t,o=i.O.of(e);if(a){if(o.isStructSchema()){let e=t,n={},{jsonName:i}=this.settings,a;i&&(a={});for(let[t,d]of o.structIterator()){let f=this._write(d,e[t],o);if(f!==void 0){let e=t;i&&(e=d.getMergedTraits().jsonName??t,a[t]=e),n[e]=f}}if(o.isUnionSchema()&&Object.keys(n).length===0){let{$unknown:t}=e;if(Array.isArray(t)){let[e,i]=t;n[e]=this._write(15,i)}}else if(typeof e.__type==`string`)for(let[t,o]of Object.entries(e)){let e=i?a[t]??t:t;e in n||(n[e]=this._write(15,o))}return n}if(Array.isArray(t)&&o.isListSchema()){let e=o.getValueSchema(),n=[],i=!!o.getMergedTraits().sparse;for(let a of t)(i||a!=null)&&n.push(this._write(e,a));return n}if(o.isMapSchema()){let e=o.getValueSchema(),n={},i=!!o.getMergedTraits().sparse;for(let[a,o]of Object.entries(t))(i||o!=null)&&(n[a]=this._write(e,o));return n}if(t instanceof Uint8Array&&(o.isBlobSchema()||o.isDocumentSchema()))return o===this.rootSchema?t:(this.serdeContext?.base64Encoder??fr.toBase64)(t);if(t instanceof Date&&(o.isTimestampSchema()||o.isDocumentSchema()))switch(i.o(o,this.settings)){case 5:return t.toISOString().replace(`.000Z`,`Z`);case 6:return i.x(t);case 7:return t.getTime()/1e3;default:return console.warn(`Missing timestamp format, using epoch seconds`,t),t.getTime()/1e3}t instanceof i.p&&(this.useReplacer=!0)}if(!(t===null&&n?.isStructSchema())){if(o.isStringSchema()){if(t===void 0&&o.isIdempotencyToken())return(0,i._.v4)();let e=o.getMergedTraits().mediaType;return t!=null&&e&&(e===`application/json`||e.endsWith(`+json`))?i.g.from(t):t}if(typeof t==`number`&&o.isNumericSchema())return Math.abs(t)===1/0||isNaN(t)?String(t):t;if(typeof t==`string`&&o.isBlobSchema())return o===this.rootSchema?t:(this.serdeContext?.base64Encoder??fr.toBase64)(t);if(typeof t==`bigint`&&(this.useReplacer=!0),o.isDocumentSchema())if(a){let e=Array.isArray(t)?[]:{};for(let[n,a]of Object.entries(t))a instanceof i.p?(this.useReplacer=!0,e[n]=a):e[n]=this._write(o,a);return e}else return structuredClone(t);return t}}}})),JsonCodec,mr=e.n((()=>{tr(),lr(),pr(),JsonCodec=class extends SerdeContextConfig{settings;constructor(e){super(),this.settings=e}createSerializer(){let e=new JsonShapeSerializer(this.settings);return e.setSerdeContext(this.serdeContext),e}createDeserializer(){let e=new JsonShapeDeserializer(this.settings);return e.setSerdeContext(this.serdeContext),e}}})),AwsJsonRpcProtocol,hr=e.n((()=>{i.n(),i.T(),Qn(),mr(),sr(),AwsJsonRpcProtocol=class extends i.c{serializer;deserializer;serviceTarget;codec;mixin;awsQueryCompatible;constructor({defaultNamespace:e,errorTypeRegistries:t,serviceTarget:n,awsQueryCompatible:i,jsonCodec:a}){super({defaultNamespace:e,errorTypeRegistries:t}),this.serviceTarget=n,this.codec=a??new JsonCodec({timestampFormat:{useTrait:!0,default:7},jsonName:!1}),this.serializer=this.codec.createSerializer(),this.deserializer=this.codec.createDeserializer(),this.awsQueryCompatible=!!i,this.mixin=new ProtocolLib(this.awsQueryCompatible)}async serializeRequest(e,t,n){let a=await super.serializeRequest(e,t,n);return a.path.endsWith(`/`)||(a.path+=`/`),Object.assign(a.headers,{"content-type":`application/x-amz-json-${this.getJsonRpcVersion()}`,"x-amz-target":`${this.serviceTarget}.${e.name}`}),this.awsQueryCompatible&&(a.headers[`x-amzn-query-mode`]=`true`),(i.M(e.input)===`unit`||!a.body)&&(a.body=`{}`),a}getPayloadCodec(){return this.codec}async handleError(e,t,n,a,o){this.awsQueryCompatible&&this.mixin.setQueryCompatError(a,n);let d=loadRestJsonErrorCode(n,a)??`Unknown`;this.mixin.compose(this.compositeErrorRegistry,d,this.options.defaultNamespace);let{errorSchema:f,errorMetadata:m}=await this.mixin.getErrorSchemaOrThrowBaseException(d,this.options.defaultNamespace,n,a,o,this.awsQueryCompatible?this.mixin.findQueryCompatibleError:void 0),h=i.O.of(f),_=a.message??a.Message??`UnknownError`,k=new((this.compositeErrorRegistry.getErrorCtor(f))??Error)(_),j={};for(let[e,t]of h.structIterator())a[e]!=null&&(j[e]=this.codec.createDeserializer().readObject(t,a[e]));throw this.awsQueryCompatible&&this.mixin.queryCompatOutput(a,j),this.mixin.decorateServiceException(Object.assign(k,m,{$fault:h.getMergedTraits().error,message:_},j),a)}}})),AwsJson1_0Protocol,gr=e.n((()=>{hr(),AwsJson1_0Protocol=class extends AwsJsonRpcProtocol{constructor({defaultNamespace:e,errorTypeRegistries:t,serviceTarget:n,awsQueryCompatible:i,jsonCodec:a}){super({defaultNamespace:e,errorTypeRegistries:t,serviceTarget:n,awsQueryCompatible:i,jsonCodec:a})}getShapeId(){return`aws.protocols#awsJson1_0`}getJsonRpcVersion(){return`1.0`}getDefaultContentType(){return`application/x-amz-json-1.0`}}})),AwsJson1_1Protocol,_r=e.n((()=>{hr(),AwsJson1_1Protocol=class extends AwsJsonRpcProtocol{constructor({defaultNamespace:e,errorTypeRegistries:t,serviceTarget:n,awsQueryCompatible:i,jsonCodec:a}){super({defaultNamespace:e,errorTypeRegistries:t,serviceTarget:n,awsQueryCompatible:i,jsonCodec:a})}getShapeId(){return`aws.protocols#awsJson1_1`}getJsonRpcVersion(){return`1.1`}getDefaultContentType(){return`application/x-amz-json-1.1`}}})),AwsRestJsonProtocol,vr=e.n((()=>{i.n(),i.T(),Qn(),mr(),sr(),AwsRestJsonProtocol=class extends i.l{serializer;deserializer;codec;mixin=new ProtocolLib;constructor({defaultNamespace:e,errorTypeRegistries:t}){super({defaultNamespace:e,errorTypeRegistries:t});let n={timestampFormat:{useTrait:!0,default:7},httpBindings:!0,jsonName:!0};this.codec=new JsonCodec(n),this.serializer=new i.r(this.codec.createSerializer(),n),this.deserializer=new i.i(this.codec.createDeserializer(),n)}getShapeId(){return`aws.protocols#restJson1`}getPayloadCodec(){return this.codec}setSerdeContext(e){this.codec.setSerdeContext(e),super.setSerdeContext(e)}async serializeRequest(e,t,n){let a=await super.serializeRequest(e,t,n),o=i.O.of(e.input);if(!a.headers[`content-type`]){let e=this.mixin.resolveRestContentType(this.getDefaultContentType(),o);e&&(a.headers[`content-type`]=e)}return a.body==null&&a.headers[`content-type`]===this.getDefaultContentType()&&(a.body=`{}`),a}async deserializeResponse(e,t,n){let a=await super.deserializeResponse(e,t,n),o=i.O.of(e.output);for(let[e,t]of o.structIterator())t.getMemberTraits().httpPayload&&!(e in a)&&(a[e]=null);return a}async handleError(e,t,n,a,o){let d=loadRestJsonErrorCode(n,a)??`Unknown`;this.mixin.compose(this.compositeErrorRegistry,d,this.options.defaultNamespace);let{errorSchema:f,errorMetadata:m}=await this.mixin.getErrorSchemaOrThrowBaseException(d,this.options.defaultNamespace,n,a,o),h=i.O.of(f),_=a.message??a.Message??`UnknownError`,k=new((this.compositeErrorRegistry.getErrorCtor(f))??Error)(_);await this.deserializeHttpMessage(f,t,n,a);let j={};for(let[e,t]of h.structIterator()){let n=t.getMergedTraits().jsonName??e;j[e]=this.codec.createDeserializer().readObject(t,a[n])}throw this.mixin.decorateServiceException(Object.assign(k,m,{$fault:h.getMergedTraits().error,message:_},j),a)}getDefaultContentType(){return`application/json`}}})),yr,awsExpectUnion,br=e.n((()=>{yr=i.t(),awsExpectUnion=e=>{if(e!=null)return typeof e==`object`&&`__type`in e&&delete e.__type,(0,yr.expectUnion)(e)}})),xr=e.t(((e,t)=>{(()=>{"use strict";var e={d:(t,n)=>{for(var i in n)e.o(n,i)&&!e.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:n[i]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{typeof Symbol<`u`&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:`Module`}),Object.defineProperty(e,`__esModule`,{value:!0})}},n={};e.r(n),e.d(n,{XMLBuilder:()=>ae,XMLParser:()=>Tt,XMLValidator:()=>oe});let i=RegExp(`^[: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][: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\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$`);function s(e,t){let n=[],i=t.exec(e);for(;i;){let a=[];a.startIndex=t.lastIndex-i[0].length;let o=i.length;for(let e=0;e<o;e++)a.push(i[e]);n.push(a),i=t.exec(e)}return n}let r=function(e){return i.exec(e)!=null},a=[`hasOwnProperty`,`toString`,`valueOf`,`__defineGetter__`,`__defineSetter__`,`__lookupGetter__`,`__lookupSetter__`],o=[`__proto__`,`constructor`,`prototype`],d={allowBooleanAttributes:!1,unpairedTags:[]};function l(e,t){t=Object.assign({},d,t);let n=[],i=!1,a=!1;e[0]===``&&(e=e.substr(1));for(let o=0;o<e.length;o++)if(e[o]===`<`&&e[o+1]===`?`){if(o+=2,o=p(e,o),o.err)return o}else{if(e[o]!==`<`){if(u(e[o]))continue;return b(`InvalidChar`,`char '`+e[o]+`' is not expected.`,w(e,o))}{let d=o;if(o++,e[o]===`!`){o=c(e,o);continue}{let f=!1;e[o]===`/`&&(f=!0,o++);let m=``;for(;o<e.length&&e[o]!==`>`&&e[o]!==` `&&e[o]!==` `&&e[o]!==`
15
- `&&e[o]!==`\r`;o++)m+=e[o];if(m=m.trim(),m[m.length-1]===`/`&&(m=m.substring(0,m.length-1),o--),!E(m)){let t;return t=m.trim().length===0?`Invalid space after '<'.`:`Tag '`+m+`' is an invalid name.`,b(`InvalidTag`,t,w(e,o))}let h=g(e,o);if(!1===h)return b(`InvalidAttr`,`Attributes for '`+m+`' have open quote.`,w(e,o));let _=h.value;if(o=h.index,_[_.length-1]===`/`){let n=o-_.length;_=_.substring(0,_.length-1);let a=x(_,t);if(!0!==a)return b(a.err.code,a.err.msg,w(e,n+a.err.line));i=!0}else if(f){if(!h.tagClosed)return b(`InvalidTag`,`Closing tag '`+m+`' doesn't have proper closing.`,w(e,o));if(_.trim().length>0)return b(`InvalidTag`,`Closing tag '`+m+`' can't have attributes or invalid starting.`,w(e,d));if(n.length===0)return b(`InvalidTag`,`Closing tag '`+m+`' has not been opened.`,w(e,d));{let t=n.pop();if(m!==t.tagName){let n=w(e,t.tagStartPos);return b(`InvalidTag`,`Expected closing tag '`+t.tagName+`' (opened in line `+n.line+`, col `+n.col+`) instead of closing tag '`+m+`'.`,w(e,d))}n.length==0&&(a=!0)}}else{let f=x(_,t);if(!0!==f)return b(f.err.code,f.err.msg,w(e,o-_.length+f.err.line));if(!0===a)return b(`InvalidXml`,`Multiple possible root nodes found.`,w(e,o));t.unpairedTags.indexOf(m)!==-1||n.push({tagName:m,tagStartPos:d}),i=!0}for(o++;o<e.length;o++)if(e[o]===`<`){if(e[o+1]===`!`){o++,o=c(e,o);continue}if(e[o+1]!==`?`)break;if(o=p(e,++o),o.err)return o}else if(e[o]===`&`){let t=N(e,o);if(t==-1)return b(`InvalidChar`,`char '&' is not expected.`,w(e,o));o=t}else if(!0===a&&!u(e[o]))return b(`InvalidXml`,`Extra text at the end`,w(e,o));e[o]===`<`&&o--}}}return i?n.length==1?b(`InvalidTag`,`Unclosed tag '`+n[0].tagName+`'.`,w(e,n[0].tagStartPos)):!(n.length>0)||b(`InvalidXml`,`Invalid '`+JSON.stringify(n.map(e=>e.tagName),null,4).replace(/\r?\n/g,``)+`' found.`,{line:1,col:1}):b(`InvalidXml`,`Start tag expected.`,1)}function u(e){return e===` `||e===` `||e===`
16
- `||e===`\r`}function p(e,t){let n=t;for(;t<e.length;t++)if(e[t]==`?`||e[t]==` `){let i=e.substr(n,t-n);if(t>5&&i===`xml`)return b(`InvalidXml`,`XML declaration allowed only at the start of the document.`,w(e,t));if(e[t]==`?`&&e[t+1]==`>`){t++;break}continue}return t}function c(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&&e[t+1]===`D`&&e[t+2]===`O`&&e[t+3]===`C`&&e[t+4]===`T`&&e[t+5]===`Y`&&e[t+6]===`P`&&e[t+7]===`E`){let n=1;for(t+=8;t<e.length;t++)if(e[t]===`<`)n++;else if(e[t]===`>`&&(n--,n===0))break}else if(e.length>t+9&&e[t+1]===`[`&&e[t+2]===`C`&&e[t+3]===`D`&&e[t+4]===`A`&&e[t+5]===`T`&&e[t+6]===`A`&&e[t+7]===`[`){for(t+=8;t<e.length;t++)if(e[t]===`]`&&e[t+1]===`]`&&e[t+2]===`>`){t+=2;break}}return t}function g(e,t){let n=``,i=``,a=!1;for(;t<e.length;t++){if(e[t]===`"`||e[t]===`'`)i===``?i=e[t]:i!==e[t]||(i=``);else if(e[t]===`>`&&i===``){a=!0;break}n+=e[t]}return i===``&&{value:n,index:t,tagClosed:a}}let f=RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,`g`);function x(e,t){let n=s(e,f),i={};for(let e=0;e<n.length;e++){if(n[e][1].length===0)return b(`InvalidAttr`,`Attribute '`+n[e][2]+`' has no space in starting.`,v(n[e]));if(n[e][3]!==void 0&&n[e][4]===void 0)return b(`InvalidAttr`,`Attribute '`+n[e][2]+`' is without value.`,v(n[e]));if(n[e][3]===void 0&&!t.allowBooleanAttributes)return b(`InvalidAttr`,`boolean attribute '`+n[e][2]+`' is not allowed.`,v(n[e]));let a=n[e][2];if(!y(a))return b(`InvalidAttr`,`Attribute '`+a+`' is an invalid name.`,v(n[e]));if(Object.prototype.hasOwnProperty.call(i,a))return b(`InvalidAttr`,`Attribute '`+a+`' is repeated.`,v(n[e]));i[a]=1}return!0}function N(e,t){if(e[++t]===`;`)return-1;if(e[t]===`#`)return function(e,t){let n=/\d/;for(e[t]===`x`&&(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 b(e,t,n){return{err:{code:e,msg:t,line:n.line||n,col:n.col}}}function y(e){return r(e)}function E(e){return r(e)}function w(e,t){let n=e.substring(0,t).split(/\r?\n/);return{line:n.length,col:n[n.length-1].length+1}}function v(e){return e.startIndex+e[1].length}let S=e=>a.includes(e)?`__`+e:e,m={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,entityDecoder:null,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(e,t,n){return e},captureMetaData:!1,maxNestedTags:100,strictReservedNames:!0,jPath:!0,onDangerousProperty:S};function A(e,t){if(typeof e!=`string`)return;let n=e.toLowerCase();if(a.some(e=>n===e.toLowerCase())||o.some(e=>n===e.toLowerCase()))throw Error(`[SECURITY] Invalid ${t}: "${e}" is a reserved JavaScript keyword that could cause prototype pollution`)}function T(e,t){return typeof e==`boolean`?{enabled:e,maxEntitySize:1e4,maxExpansionDepth:1e4,maxTotalExpansions:1/0,maxExpandedLength:1e5,maxEntityCount:1e3,allowedTags:null,tagFilter:null,appliesTo:`all`}:typeof e==`object`&&e?{enabled:!1!==e.enabled,maxEntitySize:Math.max(1,e.maxEntitySize??1e4),maxExpansionDepth:Math.max(1,e.maxExpansionDepth??1e4),maxTotalExpansions:Math.max(1,e.maxTotalExpansions??1/0),maxExpandedLength:Math.max(1,e.maxExpandedLength??1e5),maxEntityCount:Math.max(1,e.maxEntityCount??1e3),allowedTags:e.allowedTags??null,tagFilter:e.tagFilter??null,appliesTo:e.appliesTo??`all`}:T(!0)}let C=function(e){let t=Object.assign({},m,e),n=[{value:t.attributeNamePrefix,name:`attributeNamePrefix`},{value:t.attributesGroupName,name:`attributesGroupName`},{value:t.textNodeName,name:`textNodeName`},{value:t.cdataPropName,name:`cdataPropName`},{value:t.commentPropName,name:`commentPropName`}];for(let{value:e,name:t}of n)e&&A(e,t);return t.onDangerousProperty===null&&(t.onDangerousProperty=S),t.processEntities=T(t.processEntities,t.htmlEntities),t.unpairedTagsSet=new Set(t.unpairedTags),t.stopNodes&&Array.isArray(t.stopNodes)&&(t.stopNodes=t.stopNodes.map(e=>typeof e==`string`&&e.startsWith(`*.`)?`..`+e.substring(2):e)),t},h;h=typeof Symbol==`function`?Symbol(`XML Node Metadata`):`@@xmlMetadata`;class O{constructor(e){this.tagname=e,this.child=[],this[`:@`]=Object.create(null)}add(e,t){e===`__proto__`&&(e=`#__proto__`),this.child.push({[e]:t})}addChild(e,t){e.tagname===`__proto__`&&(e.tagname=`#__proto__`),e[`:@`]&&Object.keys(e[`:@`]).length>0?this.child.push({[e.tagname]:e.child,":@":e[`:@`]}):this.child.push({[e.tagname]:e.child}),t!==void 0&&(this.child[this.child.length-1][h]={startIndex:t})}static getMetaDataSymbol(){return h}}class ${constructor(e){this.suppressValidationErr=!e,this.options=e}readDocType(e,t){let n=Object.create(null),i=0;if(e[t+3]!==`O`||e[t+4]!==`C`||e[t+5]!==`T`||e[t+6]!==`Y`||e[t+7]!==`P`||e[t+8]!==`E`)throw Error(`Invalid Tag instead of DOCTYPE`);{t+=9;let a=1,o=!1,d=!1,f=``;for(;t<e.length;t++)if(e[t]!==`<`||d)if(e[t]===`>`){if(d?e[t-1]===`-`&&e[t-2]===`-`&&(d=!1,a--):a--,a===0)break}else e[t]===`[`?o=!0:f+=e[t];else{if(o&&D(e,`!ENTITY`,t)){let a,o;if(t+=7,[a,o,t]=this.readEntityExp(e,t+1,this.suppressValidationErr),o.indexOf(`&`)===-1){if(!1!==this.options.enabled&&this.options.maxEntityCount!=null&&i>=this.options.maxEntityCount)throw Error(`Entity count (${i+1}) exceeds maximum allowed (${this.options.maxEntityCount})`);n[a]=o,i++}}else if(o&&D(e,`!ELEMENT`,t)){t+=8;let{index:n}=this.readElementExp(e,t+1);t=n}else if(o&&D(e,`!ATTLIST`,t))t+=8;else if(o&&D(e,`!NOTATION`,t)){t+=9;let{index:n}=this.readNotationExp(e,t+1,this.suppressValidationErr);t=n}else{if(!D(e,`!--`,t))throw Error(`Invalid DOCTYPE`);d=!0}a++,f=``}if(a!==0)throw Error(`Unclosed DOCTYPE`)}return{entities:n,i:t}}readEntityExp(e,t){let n=t=I(e,t);for(;t<e.length&&!/\s/.test(e[t])&&e[t]!==`"`&&e[t]!==`'`;)t++;let i=e.substring(n,t);if(M(i),t=I(e,t),!this.suppressValidationErr){if(e.substring(t,t+6).toUpperCase()===`SYSTEM`)throw Error(`External entities are not supported`);if(e[t]===`%`)throw Error(`Parameter entities are not supported`)}let a=``;if([t,a]=this.readIdentifierVal(e,t,`entity`),!1!==this.options.enabled&&this.options.maxEntitySize!=null&&a.length>this.options.maxEntitySize)throw Error(`Entity "${i}" size (${a.length}) exceeds maximum allowed size (${this.options.maxEntitySize})`);return[i,a,--t]}readNotationExp(e,t){let n=t=I(e,t);for(;t<e.length&&!/\s/.test(e[t]);)t++;let i=e.substring(n,t);!this.suppressValidationErr&&M(i),t=I(e,t);let a=e.substring(t,t+6).toUpperCase();if(!this.suppressValidationErr&&a!==`SYSTEM`&&a!==`PUBLIC`)throw Error(`Expected SYSTEM or PUBLIC, found "${a}"`);t+=a.length,t=I(e,t);let o=null,d=null;if(a===`PUBLIC`)[t,o]=this.readIdentifierVal(e,t,`publicIdentifier`),e[t=I(e,t)]!==`"`&&e[t]!==`'`||([t,d]=this.readIdentifierVal(e,t,`systemIdentifier`));else if(a===`SYSTEM`&&([t,d]=this.readIdentifierVal(e,t,`systemIdentifier`),!this.suppressValidationErr&&!d))throw Error(`Missing mandatory system identifier for SYSTEM notation`);return{notationName:i,publicIdentifier:o,systemIdentifier:d,index:--t}}readIdentifierVal(e,t,n){let i=``,a=e[t];if(a!==`"`&&a!==`'`)throw Error(`Expected quoted string, found "${a}"`);let o=++t;for(;t<e.length&&e[t]!==a;)t++;if(i=e.substring(o,t),e[t]!==a)throw Error(`Unterminated ${n} value`);return[++t,i]}readElementExp(e,t){let n=t=I(e,t);for(;t<e.length&&!/\s/.test(e[t]);)t++;let i=e.substring(n,t);if(!this.suppressValidationErr&&!r(i))throw Error(`Invalid element name: "${i}"`);let a=``;if(e[t=I(e,t)]===`E`&&D(e,`MPTY`,t))t+=4;else if(e[t]===`A`&&D(e,`NY`,t))t+=2;else if(e[t]===`(`){let n=++t;for(;t<e.length&&e[t]!==`)`;)t++;if(a=e.substring(n,t),e[t]!==`)`)throw Error(`Unterminated content model`)}else if(!this.suppressValidationErr)throw Error(`Invalid Element Expression, found "${e[t]}"`);return{elementName:i,contentModel:a.trim(),index:t}}readAttlistExp(e,t){let n=t=I(e,t);for(;t<e.length&&!/\s/.test(e[t]);)t++;let i=e.substring(n,t);for(M(i),n=t=I(e,t);t<e.length&&!/\s/.test(e[t]);)t++;let a=e.substring(n,t);if(!M(a))throw Error(`Invalid attribute name: "${a}"`);t=I(e,t);let o=``;if(e.substring(t,t+8).toUpperCase()===`NOTATION`){if(o=`NOTATION`,e[t=I(e,t+=8)]!==`(`)throw Error(`Expected '(', found "${e[t]}"`);t++;let n=[];for(;t<e.length&&e[t]!==`)`;){let i=t;for(;t<e.length&&e[t]!==`|`&&e[t]!==`)`;)t++;let a=e.substring(i,t);if(a=a.trim(),!M(a))throw Error(`Invalid notation name: "${a}"`);n.push(a),e[t]===`|`&&(t++,t=I(e,t))}if(e[t]!==`)`)throw Error(`Unterminated list of notations`);t++,o+=` (`+n.join(`|`)+`)`}else{let n=t;for(;t<e.length&&!/\s/.test(e[t]);)t++;if(o+=e.substring(n,t),!this.suppressValidationErr&&![`CDATA`,`ID`,`IDREF`,`IDREFS`,`ENTITY`,`ENTITIES`,`NMTOKEN`,`NMTOKENS`].includes(o.toUpperCase()))throw Error(`Invalid attribute type: "${o}"`)}t=I(e,t);let d=``;return e.substring(t,t+8).toUpperCase()===`#REQUIRED`?(d=`#REQUIRED`,t+=8):e.substring(t,t+7).toUpperCase()===`#IMPLIED`?(d=`#IMPLIED`,t+=7):[t,d]=this.readIdentifierVal(e,t,`ATTLIST`),{elementName:i,attributeName:a,attributeType:o,defaultValue:d,index:t}}}let I=(e,t)=>{for(;t<e.length&&/\s/.test(e[t]);)t++;return t};function D(e,t,n){for(let i=0;i<t.length;i++)if(t[i]!==e[n+i+1])return!1;return!0}function M(e){if(r(e))return e;throw Error(`Invalid entity name ${e}`)}let _=/^[-+]?0x[a-fA-F0-9]+$/,k=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,j={hex:!0,leadingZeros:!0,decimalPoint:`.`,eNotation:!0,infinity:`original`},P=/^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;class F{constructor(e){this._matcher=e}get separator(){return this._matcher.separator}getCurrentTag(){let e=this._matcher.path;return e.length>0?e[e.length-1].tag:void 0}getCurrentNamespace(){let e=this._matcher.path;return e.length>0?e[e.length-1].namespace:void 0}getAttrValue(e){let t=this._matcher.path;if(t.length!==0)return t[t.length-1].values?.[e]}hasAttr(e){let t=this._matcher.path;if(t.length===0)return!1;let n=t[t.length-1];return n.values!==void 0&&e in n.values}getPosition(){let e=this._matcher.path;return e.length===0?-1:e[e.length-1].position??0}getCounter(){let e=this._matcher.path;return e.length===0?-1:e[e.length-1].counter??0}getIndex(){return this.getPosition()}getDepth(){return this._matcher.path.length}toString(e,t=!0){return this._matcher.toString(e,t)}toArray(){return this._matcher.path.map(e=>e.tag)}matches(e){return this._matcher.matches(e)}matchesAny(e){return e.matchesAny(this._matcher)}}class R{constructor(e={}){this.separator=e.separator||`.`,this.path=[],this.siblingStacks=[],this._pathStringCache=null,this._view=new F(this)}push(e,t=null,n=null){this._pathStringCache=null,this.path.length>0&&(this.path[this.path.length-1].values=void 0);let i=this.path.length;this.siblingStacks[i]||(this.siblingStacks[i]=new Map);let a=this.siblingStacks[i],o=n?`${n}:${e}`:e,d=a.get(o)||0,f=0;for(let e of a.values())f+=e;a.set(o,d+1);let m={tag:e,position:f,counter:d};n!=null&&(m.namespace=n),t!=null&&(m.values=t),this.path.push(m)}pop(){if(this.path.length===0)return;this._pathStringCache=null;let e=this.path.pop();return this.siblingStacks.length>this.path.length+1&&(this.siblingStacks.length=this.path.length+1),e}updateCurrent(e){if(this.path.length>0){let t=this.path[this.path.length-1];e!=null&&(t.values=e)}}getCurrentTag(){return this.path.length>0?this.path[this.path.length-1].tag:void 0}getCurrentNamespace(){return this.path.length>0?this.path[this.path.length-1].namespace:void 0}getAttrValue(e){if(this.path.length!==0)return this.path[this.path.length-1].values?.[e]}hasAttr(e){if(this.path.length===0)return!1;let t=this.path[this.path.length-1];return t.values!==void 0&&e in t.values}getPosition(){return this.path.length===0?-1:this.path[this.path.length-1].position??0}getCounter(){return this.path.length===0?-1:this.path[this.path.length-1].counter??0}getIndex(){return this.getPosition()}getDepth(){return this.path.length}toString(e,t=!0){let n=e||this.separator;if(n===this.separator&&!0===t){if(this._pathStringCache!==null)return this._pathStringCache;let e=this.path.map(e=>e.namespace?`${e.namespace}:${e.tag}`:e.tag).join(n);return this._pathStringCache=e,e}return this.path.map(e=>t&&e.namespace?`${e.namespace}:${e.tag}`:e.tag).join(n)}toArray(){return this.path.map(e=>e.tag)}reset(){this._pathStringCache=null,this.path=[],this.siblingStacks=[]}matches(e){let t=e.segments;return t.length!==0&&(e.hasDeepWildcard()?this._matchWithDeepWildcard(t):this._matchSimple(t))}_matchSimple(e){if(this.path.length!==e.length)return!1;for(let t=0;t<e.length;t++)if(!this._matchSegment(e[t],this.path[t],t===this.path.length-1))return!1;return!0}_matchWithDeepWildcard(e){let t=this.path.length-1,n=e.length-1;for(;n>=0&&t>=0;){let i=e[n];if(i.type===`deep-wildcard`){if(n--,n<0)return!0;let i=e[n],a=!1;for(let e=t;e>=0;e--)if(this._matchSegment(i,this.path[e],e===this.path.length-1)){t=e-1,n--,a=!0;break}if(!a)return!1}else{if(!this._matchSegment(i,this.path[t],t===this.path.length-1))return!1;t--,n--}}return n<0}_matchSegment(e,t,n){if(e.tag!==`*`&&e.tag!==t.tag||e.namespace!==void 0&&e.namespace!==`*`&&e.namespace!==t.namespace||e.attrName!==void 0&&(!n||!t.values||!(e.attrName in t.values)||e.attrValue!==void 0&&String(t.values[e.attrName])!==String(e.attrValue)))return!1;if(e.position!==void 0){if(!n)return!1;let i=t.counter??0;if(e.position===`first`&&i!==0||e.position===`odd`&&i%2!=1||e.position===`even`&&i%2!=0||e.position===`nth`&&i!==e.positionValue)return!1}return!0}matchesAny(e){return e.matchesAny(this)}snapshot(){return{path:this.path.map(e=>({...e})),siblingStacks:this.siblingStacks.map(e=>new Map(e))}}restore(e){this._pathStringCache=null,this.path=e.path.map(e=>({...e})),this.siblingStacks=e.siblingStacks.map(e=>new Map(e))}readOnly(){return this._view}}class G{constructor(e,t={},n){this.pattern=e,this.separator=t.separator||`.`,this.segments=this._parse(e),this.data=n,this._hasDeepWildcard=this.segments.some(e=>e.type===`deep-wildcard`),this._hasAttributeCondition=this.segments.some(e=>e.attrName!==void 0),this._hasPositionSelector=this.segments.some(e=>e.position!==void 0)}_parse(e){let t=[],n=0,i=``;for(;n<e.length;)e[n]===this.separator?n+1<e.length&&e[n+1]===this.separator?(i.trim()&&(t.push(this._parseSegment(i.trim())),i=``),t.push({type:`deep-wildcard`}),n+=2):(i.trim()&&t.push(this._parseSegment(i.trim())),i=``,n++):(i+=e[n],n++);return i.trim()&&t.push(this._parseSegment(i.trim())),t}_parseSegment(e){let t={type:`tag`},n=null,i=e,a=e.match(/^([^\[]+)(\[[^\]]*\])(.*)$/);if(a&&(i=a[1]+a[3],a[2])){let e=a[2].slice(1,-1);e&&(n=e)}let o,d,f=i;if(i.includes(`::`)){let t=i.indexOf(`::`);if(o=i.substring(0,t).trim(),f=i.substring(t+2).trim(),!o)throw Error(`Invalid namespace in pattern: ${e}`)}let m=null;if(f.includes(`:`)){let e=f.lastIndexOf(`:`),t=f.substring(0,e).trim(),n=f.substring(e+1).trim();[`first`,`last`,`odd`,`even`].includes(n)||/^nth\(\d+\)$/.test(n)?(d=t,m=n):d=f}else d=f;if(!d)throw Error(`Invalid segment pattern: ${e}`);if(t.tag=d,o&&(t.namespace=o),n)if(n.includes(`=`)){let e=n.indexOf(`=`);t.attrName=n.substring(0,e).trim(),t.attrValue=n.substring(e+1).trim()}else t.attrName=n.trim();if(m){let e=m.match(/^nth\((\d+)\)$/);e?(t.position=`nth`,t.positionValue=parseInt(e[1],10)):t.position=m}return t}get length(){return this.segments.length}hasDeepWildcard(){return this._hasDeepWildcard}hasAttributeCondition(){return this._hasAttributeCondition}hasPositionSelector(){return this._hasPositionSelector}toString(){return this.pattern}}class B{constructor(){this._byDepthAndTag=new Map,this._wildcardByDepth=new Map,this._deepWildcards=[],this._patterns=new Set,this._sealed=!1}add(e){if(this._sealed)throw TypeError(`ExpressionSet is sealed. Create a new ExpressionSet to add more expressions.`);if(this._patterns.has(e.pattern))return this;if(this._patterns.add(e.pattern),e.hasDeepWildcard())return this._deepWildcards.push(e),this;let t=e.length,n=e.segments[e.segments.length-1]?.tag;if(n&&n!==`*`){let i=`${t}:${n}`;this._byDepthAndTag.has(i)||this._byDepthAndTag.set(i,[]),this._byDepthAndTag.get(i).push(e)}else this._wildcardByDepth.has(t)||this._wildcardByDepth.set(t,[]),this._wildcardByDepth.get(t).push(e);return this}addAll(e){for(let t of e)this.add(t);return this}has(e){return this._patterns.has(e.pattern)}get size(){return this._patterns.size}seal(){return this._sealed=!0,this}get isSealed(){return this._sealed}matchesAny(e){return this.findMatch(e)!==null}findMatch(e){let t=e.getDepth(),n=`${t}:${e.getCurrentTag()}`,i=this._byDepthAndTag.get(n);if(i){for(let t=0;t<i.length;t++)if(e.matches(i[t]))return i[t]}let a=this._wildcardByDepth.get(t);if(a){for(let t=0;t<a.length;t++)if(e.matches(a[t]))return a[t]}for(let t=0;t<this._deepWildcards.length;t++)if(e.matches(this._deepWildcards[t]))return this._deepWildcards[t];return null}}let L={cent:`¢`,pound:`£`,curren:`¤`,yen:`¥`,euro:`€`,dollar:`$`,euro:`€`,fnof:`ƒ`,inr:`₹`,af:`؋`,birr:`ብር`,peso:`₱`,rub:`₽`,won:`₩`,yuan:`¥`,cedil:`¸`},V={amp:`&`,apos:`'`,gt:`>`,lt:`<`,quot:`"`},H={nbsp:`\xA0`,copy:`©`,reg:`®`,trade:`™`,mdash:`—`,ndash:`–`,hellip:`…`,laquo:`«`,raquo:`»`,lsquo:`‘`,rsquo:`’`,ldquo:`“`,rdquo:`”`,bull:`•`,para:`¶`,sect:`§`,deg:`°`,frac12:`½`,frac14:`¼`,frac34:`¾`},U=new Set(`!?\\\\/[]$%{}^&*()<>|+`);function z(e){if(e[0]===`#`)throw Error(`[EntityReplacer] Invalid character '#' in entity name: "${e}"`);for(let t of e)if(U.has(t))throw Error(`[EntityReplacer] Invalid character '${t}' in entity name: "${e}"`);return e}function q(...e){let t=Object.create(null);for(let n of e)if(n)for(let e of Object.keys(n)){let i=n[e];if(typeof i==`string`)t[e]=i;else if(i&&typeof i==`object`&&i.val!==void 0){let n=i.val;typeof n==`string`&&(t[e]=n)}}return t}let W=`external`,ee=`base`,K=Object.freeze({allow:0,leave:1,remove:2,throw:3}),te=new Set([9,10,13]);class tt{constructor(e={}){var t;this._limit=e.limit||{},this._maxTotalExpansions=this._limit.maxTotalExpansions||0,this._maxExpandedLength=this._limit.maxExpandedLength||0,this._postCheck=typeof e.postCheck==`function`?e.postCheck:e=>e,this._limitTiers=(t=this._limit.applyLimitsTo??W)&&t!==W?t===`all`?new Set([`all`]):t===ee?new Set([ee]):Array.isArray(t)?new Set(t):new Set([W]):new Set([W]),this._numericAllowed=e.numericAllowed??!0,this._baseMap=q(V,e.namedEntities||null),this._externalMap=Object.create(null),this._inputMap=Object.create(null),this._totalExpansions=0,this._expandedLength=0,this._removeSet=new Set(e.remove&&Array.isArray(e.remove)?e.remove:[]),this._leaveSet=new Set(e.leave&&Array.isArray(e.leave)?e.leave:[]);let n=function(e){if(!e)return{xmlVersion:1,onLevel:K.allow,nullLevel:K.remove};let t=e.xmlVersion===1.1?1.1:1,n=K[e.onNCR]??K.allow,i=K[e.nullNCR]??K.remove;return{xmlVersion:t,onLevel:n,nullLevel:Math.max(i,K.remove)}}(e.ncr);this._ncrXmlVersion=n.xmlVersion,this._ncrOnLevel=n.onLevel,this._ncrNullLevel=n.nullLevel}setExternalEntities(e){if(e)for(let t of Object.keys(e))z(t);this._externalMap=q(e)}addExternalEntity(e,t){z(e),typeof t==`string`&&t.indexOf(`&`)===-1&&(this._externalMap[e]=t)}addInputEntities(e){this._totalExpansions=0,this._expandedLength=0,this._inputMap=q(e)}reset(){return this._inputMap=Object.create(null),this._totalExpansions=0,this._expandedLength=0,this}setXmlVersion(e){this._ncrXmlVersion=e===1.1?1.1:1}decode(e){if(typeof e!=`string`||e.length===0)return e;let t=e,n=[],i=e.length,a=0,o=0,d=this._maxTotalExpansions>0,f=this._maxExpandedLength>0,m=d||f;for(;o<i;){if(e.charCodeAt(o)!==38){o++;continue}let t=o+1;for(;t<i&&e.charCodeAt(t)!==59&&t-o<=32;)t++;if(t>=i||e.charCodeAt(t)!==59){o++;continue}let h=e.slice(o+1,t);if(h.length===0){o++;continue}let _,k;if(this._removeSet.has(h))_=``,k===void 0&&(k=W);else{if(this._leaveSet.has(h)){o++;continue}if(h.charCodeAt(0)===35){let e=this._resolveNCR(h);if(e===void 0){o++;continue}_=e,k=ee}else{let e=this._resolveName(h);_=e?.value,k=e?.tier}}if(_!==void 0){if(o>a&&n.push(e.slice(a,o)),n.push(_),a=t+1,o=a,m&&this._tierCounts(k)){if(d&&(this._totalExpansions++,this._totalExpansions>this._maxTotalExpansions))throw Error(`[EntityReplacer] Entity expansion count limit exceeded: ${this._totalExpansions} > ${this._maxTotalExpansions}`);if(f){let e=_.length-(h.length+2);if(e>0&&(this._expandedLength+=e,this._expandedLength>this._maxExpandedLength))throw Error(`[EntityReplacer] Expanded content length limit exceeded: ${this._expandedLength} > ${this._maxExpandedLength}`)}}}else o++}a<i&&n.push(e.slice(a));let h=n.length===0?e:n.join(``);return this._postCheck(h,t)}_tierCounts(e){return!!this._limitTiers.has(`all`)||this._limitTiers.has(e)}_resolveName(e){return e in this._inputMap?{value:this._inputMap[e],tier:W}:e in this._externalMap?{value:this._externalMap[e],tier:W}:e in this._baseMap?{value:this._baseMap[e],tier:ee}:void 0}_classifyNCR(e){return e===0?this._ncrNullLevel:e>=55296&&e<=57343||this._ncrXmlVersion===1&&e>=1&&e<=31&&!te.has(e)?K.remove:-1}_applyNCRAction(e,t,n){switch(e){case K.allow:return String.fromCodePoint(n);case K.remove:return``;case K.leave:return;case K.throw:throw Error(`[EntityDecoder] Prohibited numeric character reference &${t}; (U+${n.toString(16).toUpperCase().padStart(4,`0`)})`);default:return String.fromCodePoint(n)}}_resolveNCR(e){let t=e.charCodeAt(1),n;if(n=t===120||t===88?parseInt(e.slice(2),16):parseInt(e.slice(1),10),Number.isNaN(n)||n<0||n>1114111)return;let i=this._classifyNCR(n);if(!this._numericAllowed&&i<K.remove)return;let a=i===-1?this._ncrOnLevel:Math.max(this._ncrOnLevel,i);return this._applyNCRAction(a,e,n)}}function et(e,t){if(!e)return{};let n=t.attributesGroupName?e[t.attributesGroupName]:e;if(!n)return{};let i={};for(let e in n)e.startsWith(t.attributeNamePrefix)?i[e.substring(t.attributeNamePrefix.length)]=n[e]:i[e]=n[e];return i}function nt(e){if(!e||typeof e!=`string`)return;let t=e.indexOf(`:`);if(t!==-1&&t>0){let n=e.substring(0,t);if(n!==`xmlns`)return n}}class it{constructor(e,t){var n;this.options=e,this.currentNode=null,this.tagsNodeStack=[],this.parseXml=ht,this.parseTextData=st,this.resolveNameSpace=rt,this.buildAttributesMap=at,this.isItStopNode=ct,this.replaceEntitiesValue=ut,this.readStopNodeData=mt,this.saveTextToParentTag=pt,this.addChild=lt,this.ignoreAttributesFn=typeof(n=this.options.ignoreAttributes)==`function`?n:Array.isArray(n)?e=>{for(let t of n)if(typeof t==`string`&&e===t||t instanceof RegExp&&t.test(e))return!0}:()=>!1,this.entityExpansionCount=0,this.currentExpandedLength=0;let i={...V};this.options.entityDecoder?this.entityDecoder=this.options.entityDecoder:(typeof this.options.htmlEntities==`object`?i=this.options.htmlEntities:!0===this.options.htmlEntities&&(i={...H,...L}),this.entityDecoder=new tt({namedEntities:{...i,...t},numericAllowed:this.options.htmlEntities,limit:{maxTotalExpansions:this.options.processEntities.maxTotalExpansions,maxExpandedLength:this.options.processEntities.maxExpandedLength,applyLimitsTo:this.options.processEntities.appliesTo}})),this.matcher=new R,this.readonlyMatcher=this.matcher.readOnly(),this.isCurrentNodeStopNode=!1,this.stopNodeExpressionsSet=new B;let a=this.options.stopNodes;if(a&&a.length>0){for(let e=0;e<a.length;e++){let t=a[e];typeof t==`string`?this.stopNodeExpressionsSet.add(new G(t)):t instanceof G&&this.stopNodeExpressionsSet.add(t)}this.stopNodeExpressionsSet.seal()}}}function st(e,t,n,i,a,o,d){let f=this.options;if(e!==void 0&&(f.trimValues&&!i&&(e=e.trim()),e.length>0)){d||(e=this.replaceEntitiesValue(e,t,n));let i=f.jPath?n.toString():n,m=f.tagValueProcessor(t,e,i,a,o);return m==null?e:typeof m!=typeof e||m!==e?m:f.trimValues||e.trim()===e?xt(e,f.parseTagValue,f.numberParseOptions):e}}function rt(e){if(this.options.removeNSPrefix){let t=e.split(`:`),n=e.charAt(0)===`/`?`/`:``;if(t[0]===`xmlns`)return``;t.length===2&&(e=n+t[1])}return e}let ne=RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,`gm`);function at(e,t,n,i=!1){let a=this.options;if(!0===i||!0!==a.ignoreAttributes&&typeof e==`string`){let i=s(e,ne),o=i.length,d={},f=Array(o),m=!1,h={};for(let e=0;e<o;e++){let t=this.resolveNameSpace(i[e][1]),o=i[e][4];if(t.length&&o!==void 0){let i=o;a.trimValues&&(i=i.trim()),i=this.replaceEntitiesValue(i,n,this.readonlyMatcher),f[e]=i,h[t]=i,m=!0}}m&&typeof t==`object`&&t.updateCurrent&&t.updateCurrent(h);let _=a.jPath?t.toString():this.readonlyMatcher,k=!1;for(let e=0;e<o;e++){let t=this.resolveNameSpace(i[e][1]);if(this.ignoreAttributesFn(t,_))continue;let n=a.attributeNamePrefix+t;if(t.length)if(a.transformAttributeName&&(n=a.transformAttributeName(n)),n=bt(n,a),i[e][4]!==void 0){let i=f[e],o=a.attributeValueProcessor(t,i,_);d[n]=o==null?i:typeof o!=typeof i||o!==i?o:xt(i,a.parseAttributeValue,a.numberParseOptions),k=!0}else a.allowBooleanAttributes&&(d[n]=!0,k=!0)}if(!k)return;if(a.attributesGroupName&&!a.preserveOrder){let e={};return e[a.attributesGroupName]=d,e}return d}}let ht=function(e){e=e.replace(/\r\n?/g,`
17
- `);let t=new O(`!xml`),n=t,i=``;this.matcher.reset(),this.entityDecoder.reset(),this.entityExpansionCount=0,this.currentExpandedLength=0;let a=this.options,o=new $(a.processEntities),d=e.length;for(let f=0;f<d;f++)if(e[f]===`<`){let m=e.charCodeAt(f+1);if(m===47){let t=dt(e,`>`,f,`Closing Tag is not closed.`),o=e.substring(f+2,t).trim();if(a.removeNSPrefix){let e=o.indexOf(`:`);e!==-1&&(o=o.substr(e+1))}o=Nt(a.transformTagName,o,``,a).tagName,n&&(i=this.saveTextToParentTag(i,n,this.readonlyMatcher));let d=this.matcher.getCurrentTag();if(o&&a.unpairedTagsSet.has(o))throw Error(`Unpaired tag can not be used as closing tag: </${o}>`);d&&a.unpairedTagsSet.has(d)&&(this.matcher.pop(),this.tagsNodeStack.pop()),this.matcher.pop(),this.isCurrentNodeStopNode=!1,n=this.tagsNodeStack.pop(),i=``,f=t}else if(m===63){let t=gt(e,f,!1,`?>`);if(!t)throw Error(`Pi Tag is not closed.`);i=this.saveTextToParentTag(i,n,this.readonlyMatcher);let o=this.buildAttributesMap(t.tagExp,this.matcher,t.tagName,!0);if(o){let e=o[this.options.attributeNamePrefix+`version`];this.entityDecoder.setXmlVersion(Number(e)||1)}if(!(a.ignoreDeclaration&&t.tagName===`?xml`||a.ignorePiTags)){let e=new O(t.tagName);e.add(a.textNodeName,``),t.tagName!==t.tagExp&&t.attrExpPresent&&!0!==a.ignoreAttributes&&(e[`:@`]=o),this.addChild(n,e,this.readonlyMatcher,f)}f=t.closeIndex+1}else if(m===33&&e.charCodeAt(f+2)===45&&e.charCodeAt(f+3)===45){let t=dt(e,`-->`,f+4,`Comment is not closed.`);if(a.commentPropName){let o=e.substring(f+4,t-2);i=this.saveTextToParentTag(i,n,this.readonlyMatcher),n.add(a.commentPropName,[{[a.textNodeName]:o}])}f=t}else if(m===33&&e.charCodeAt(f+2)===68){let t=o.readDocType(e,f);this.entityDecoder.addInputEntities(t.entities),f=t.i}else if(m===33&&e.charCodeAt(f+2)===91){let t=dt(e,`]]>`,f,`CDATA is not closed.`)-2,o=e.substring(f+9,t);i=this.saveTextToParentTag(i,n,this.readonlyMatcher);let d=this.parseTextData(o,n.tagname,this.readonlyMatcher,!0,!1,!0,!0);d??=``,a.cdataPropName?n.add(a.cdataPropName,[{[a.textNodeName]:o}]):n.add(a.textNodeName,d),f=t+2}else{let o=gt(e,f,a.removeNSPrefix);if(!o){let t=e.substring(Math.max(0,f-50),Math.min(d,f+50));throw Error(`readTagExp returned undefined at position ${f}. Context: "${t}"`)}let m=o.tagName,h=o.rawTagName,_=o.tagExp,k=o.attrExpPresent,j=o.closeIndex;if({tagName:m,tagExp:_}=Nt(a.transformTagName,m,_,a),a.strictReservedNames&&(m===a.commentPropName||m===a.cdataPropName||m===a.textNodeName||m===a.attributesGroupName))throw Error(`Invalid tag name: ${m}`);n&&i&&n.tagname!==`!xml`&&(i=this.saveTextToParentTag(i,n,this.readonlyMatcher,!1));let P=n;P&&a.unpairedTagsSet.has(P.tagname)&&(n=this.tagsNodeStack.pop(),this.matcher.pop());let L=!1;_.length>0&&_.lastIndexOf(`/`)===_.length-1&&(L=!0,m[m.length-1]===`/`?(m=m.substr(0,m.length-1),_=m):_=_.substr(0,_.length-1),k=m!==_);let V,H=null;V=nt(h),m!==t.tagname&&this.matcher.push(m,{},V),m!==_&&k&&(H=this.buildAttributesMap(_,this.matcher,m),H&&et(H,a)),m!==t.tagname&&(this.isCurrentNodeStopNode=this.isItStopNode());let U=f;if(this.isCurrentNodeStopNode){let t=``;if(L)f=o.closeIndex;else if(a.unpairedTagsSet.has(m))f=o.closeIndex;else{let n=this.readStopNodeData(e,h,j+1);if(!n)throw Error(`Unexpected end of ${h}`);f=n.i,t=n.tagContent}let i=new O(m);H&&(i[`:@`]=H),i.add(a.textNodeName,t),this.matcher.pop(),this.isCurrentNodeStopNode=!1,this.addChild(n,i,this.readonlyMatcher,U)}else{if(L){({tagName:m,tagExp:_}=Nt(a.transformTagName,m,_,a));let e=new O(m);H&&(e[`:@`]=H),this.addChild(n,e,this.readonlyMatcher,U),this.matcher.pop(),this.isCurrentNodeStopNode=!1}else{if(a.unpairedTagsSet.has(m)){let e=new O(m);H&&(e[`:@`]=H),this.addChild(n,e,this.readonlyMatcher,U),this.matcher.pop(),this.isCurrentNodeStopNode=!1,f=o.closeIndex;continue}{let e=new O(m);if(this.tagsNodeStack.length>a.maxNestedTags)throw Error(`Maximum nested tags exceeded`);this.tagsNodeStack.push(n),H&&(e[`:@`]=H),this.addChild(n,e,this.readonlyMatcher,U),n=e}}i=``,f=j}}}else i+=e[f];return t.child};function lt(e,t,n,i){this.options.captureMetaData||(i=void 0);let a=this.options.jPath?n.toString():n,o=this.options.updateTag(t.tagname,a,t[`:@`]);!1===o||(typeof o==`string`&&(t.tagname=o),e.addChild(t,i))}function ut(e,t,n){let i=this.options.processEntities;if(!i||!i.enabled)return e;if(i.allowedTags){let a=this.options.jPath?n.toString():n;if(!(Array.isArray(i.allowedTags)?i.allowedTags.includes(t):i.allowedTags(t,a)))return e}if(i.tagFilter){let a=this.options.jPath?n.toString():n;if(!i.tagFilter(t,a))return e}return this.entityDecoder.decode(e)}function pt(e,t,n,i){return e&&=(i===void 0&&(i=t.child.length===0),(e=this.parseTextData(e,t.tagname,n,!1,!!t[`:@`]&&Object.keys(t[`:@`]).length!==0,i))!==void 0&&e!==``&&t.add(this.options.textNodeName,e),``),e}function ct(){return this.stopNodeExpressionsSet.size!==0&&this.matcher.matchesAny(this.stopNodeExpressionsSet)}function dt(e,t,n,i){let a=e.indexOf(t,n);if(a===-1)throw Error(i);return a+t.length-1}function ft(e,t,n,i){let a=e.indexOf(t,n);if(a===-1)throw Error(i);return a}function gt(e,t,n,i=`>`){let a=function(e,t,n=`>`){let i=0,a=e.length,o=n.charCodeAt(0),d=n.length>1?n.charCodeAt(1):-1,f=``,m=t;for(let n=t;n<a;n++){let t=e.charCodeAt(n);if(i)t===i&&(i=0);else if(t===34||t===39)i=t;else if(t===o){if(d===-1||e.charCodeAt(n+1)===d)return f+=e.substring(m,n),{data:f,index:n}}else t!==9||i||(f+=e.substring(m,n)+` `,m=n+1)}}(e,t+1,i);if(!a)return;let o=a.data,d=a.index,f=o.search(/\s/),m=o,h=!0;f!==-1&&(m=o.substring(0,f),o=o.substring(f+1).trimStart());let _=m;if(n){let e=m.indexOf(`:`);e!==-1&&(m=m.substr(e+1),h=m!==a.data.substr(e+1))}return{tagName:m,tagExp:o,closeIndex:d,attrExpPresent:h,rawTagName:_}}function mt(e,t,n){let i=n,a=1,o=e.length;for(;n<o;n++)if(e[n]===`<`){let o=e.charCodeAt(n+1);if(o===47){let o=ft(e,`>`,n,`${t} is not closed`);if(e.substring(n+2,o).trim()===t&&(a--,a===0))return{tagContent:e.substring(i,n),i:o};n=o}else if(o===63)n=dt(e,`?>`,n+1,`StopNode is not closed.`);else if(o===33&&e.charCodeAt(n+2)===45&&e.charCodeAt(n+3)===45)n=dt(e,`-->`,n+3,`StopNode is not closed.`);else if(o===33&&e.charCodeAt(n+2)===91)n=dt(e,`]]>`,n,`StopNode is not closed.`)-2;else{let i=gt(e,n,`>`);i&&((i&&i.tagName)===t&&i.tagExp[i.tagExp.length-1]!==`/`&&a++,n=i.closeIndex)}}}function xt(e,t,n){if(t&&typeof e==`string`){let t=e.trim();return t===`true`||t!==`false`&&function(e,t={}){if(t=Object.assign({},j,t),!e||typeof e!=`string`)return e;let n=e.trim();if(n.length===0||t.skipLike!==void 0&&t.skipLike.test(n))return e;if(n===`0`)return 0;if(t.hex&&_.test(n))return function(e){if(parseInt)return parseInt(e,16);if(Number.parseInt)return Number.parseInt(e,16);if(window&&window.parseInt)return window.parseInt(e,16);throw Error(`parseInt, Number.parseInt, window.parseInt are not supported`)}(n);if(isFinite(n)){if(n.includes(`e`)||n.includes(`E`))return function(e,t,n){if(!n.eNotation)return e;let i=t.match(P);if(i){let a=i[1]||``,o=i[3].indexOf(`e`)===-1?`E`:`e`,d=i[2],f=a?e[d.length+1]===o:e[d.length]===o;return d.length>1&&f?e:(d.length!==1||!i[3].startsWith(`.${o}`)&&i[3][0]!==o)&&d.length>0?n.leadingZeros&&!f?(t=(i[1]||``)+i[3],Number(t)):e:Number(t)}return e}(e,n,t);{let a=k.exec(n);if(a){let o=a[1]||``,d=a[2],f=((i=a[3])&&i.indexOf(`.`)!==-1&&((i=i.replace(/0+$/,``))===`.`?i=`0`:i[0]===`.`?i=`0`+i:i[i.length-1]===`.`&&(i=i.substring(0,i.length-1))),i),m=o?e[d.length+1]===`.`:e[d.length]===`.`;if(!t.leadingZeros&&(d.length>1||d.length===1&&!m))return e;{let i=Number(n),a=String(i);if(i===0)return i;if(a.search(/[eE]/)!==-1)return t.eNotation?i:e;if(n.indexOf(`.`)!==-1)return a===`0`||a===f||a===`${o}${f}`?i:e;let m=d?f:n;return d?m===a||o+m===a?i:e:m===a||m===o+a?i:e}}return e}}var i;return function(e,t,n){let i=t===1/0;switch(n.infinity.toLowerCase()){case`null`:return null;case`infinity`:return t;case`string`:return i?`Infinity`:`-Infinity`;default:return e}}(e,Number(n),t)}(e,n)}return e===void 0?``:e}function Nt(e,t,n,i){if(e){let i=e(t);n===t&&(n=i),t=i}return{tagName:t=bt(t,i),tagExp:n}}function bt(e,t){if(o.includes(e))throw Error(`[SECURITY] Invalid name: "${e}" is a reserved JavaScript keyword that could cause prototype pollution`);return a.includes(e)?t.onDangerousProperty(e):e}let re=O.getMetaDataSymbol();function Et(e,t){if(!e||typeof e!=`object`)return{};if(!t)return e;let n={};for(let i in e)i.startsWith(t)?n[i.substring(t.length)]=e[i]:n[i]=e[i];return n}function wt(e,t,n,i){return vt(e,t,n,i)}function vt(e,t,n,i){let a,o={};for(let d=0;d<e.length;d++){let f=e[d],m=St(f);if(m!==void 0&&m!==t.textNodeName){let e=Et(f[`:@`]||{},t.attributeNamePrefix);n.push(m,e)}if(m===t.textNodeName)a===void 0?a=f[m]:a+=``+f[m];else{if(m===void 0)continue;if(f[m]){let e=vt(f[m],t,n,i),a=At(e,t);if(f[`:@`]?_t(e,f[`:@`],i,t):Object.keys(e).length!==1||e[t.textNodeName]===void 0||t.alwaysCreateTextNode?Object.keys(e).length===0&&(t.alwaysCreateTextNode?e[t.textNodeName]=``:e=``):e=e[t.textNodeName],f[re]!==void 0&&typeof e==`object`&&e&&(e[re]=f[re]),o[m]!==void 0&&Object.prototype.hasOwnProperty.call(o,m))Array.isArray(o[m])||(o[m]=[o[m]]),o[m].push(e);else{let n=t.jPath?i.toString():i;t.isArray(m,n,a)?o[m]=[e]:o[m]=e}m!==void 0&&m!==t.textNodeName&&n.pop()}}}return typeof a==`string`?a.length>0&&(o[t.textNodeName]=a):a!==void 0&&(o[t.textNodeName]=a),o}function St(e){let t=Object.keys(e);for(let e=0;e<t.length;e++){let n=t[e];if(n!==`:@`)return n}}function _t(e,t,n,i){if(t){let a=Object.keys(t),o=a.length;for(let d=0;d<o;d++){let o=a[d],f=o.startsWith(i.attributeNamePrefix)?o.substring(i.attributeNamePrefix.length):o,m=i.jPath?n.toString()+`.`+f:n;i.isArray(o,m,!0,!0)?e[o]=[t[o]]:e[o]=t[o]}}}function At(e,t){let{textNodeName:n}=t,i=Object.keys(e).length;return i===0||!(i!==1||!e[n]&&typeof e[n]!=`boolean`&&e[n]!==0)}class Tt{constructor(e){this.externalEntities={},this.options=C(e)}parse(e,t){if(typeof e!=`string`&&e.toString)e=e.toString();else if(typeof e!=`string`)throw Error(`XML data is accepted in String or Bytes[] form.`);if(t){!0===t&&(t={});let n=l(e,t);if(!0!==n)throw Error(`${n.err.msg}:${n.err.line}:${n.err.col}`)}let n=new it(this.options,this.externalEntities),i=n.parseXml(e);return this.options.preserveOrder||i===void 0?i:wt(i,this.options,n.matcher,n.readonlyMatcher)}addEntity(e,t){if(t.indexOf(`&`)!==-1)throw Error(`Entity value can't have '&'`);if(e.indexOf(`&`)!==-1||e.indexOf(`;`)!==-1)throw Error(`An entity must be set without '&' and ';'. Eg. use '#xD' for '&#xD;'`);if(t===`&`)throw Error(`An entity with value '&' is not permitted`);this.externalEntities[e]=t}static getMetaDataSymbol(){return O.getMetaDataSymbol()}}function Ct(e,t){let n=``;t.format&&t.indentBy.length>0&&(n=`
18
- `);let i=[];if(t.stopNodes&&Array.isArray(t.stopNodes))for(let e=0;e<t.stopNodes.length;e++){let n=t.stopNodes[e];typeof n==`string`?i.push(new G(n)):n instanceof G&&i.push(n)}return Pt(e,t,n,new R,i)}function Pt(e,t,n,i,a){let o=``,d=!1;if(t.maxNestedTags&&i.getDepth()>t.maxNestedTags)throw Error(`Maximum nested tags exceeded`);if(!Array.isArray(e)){if(e!=null){let n=e.toString();return n=Vt(n,t),n}return``}for(let f=0;f<e.length;f++){let m=e[f],h=Dt(m);if(h===void 0)continue;let _=Ot(m[`:@`],t);i.push(h,_);let k=jt(i,a);if(h===t.textNodeName){let e=m[h];k||(e=t.tagValueProcessor(h,e),e=Vt(e,t)),d&&(o+=n),o+=e,d=!1,i.pop();continue}if(h===t.cdataPropName){d&&(o+=n);let e=m[h][0][t.textNodeName];o+=`<![CDATA[${String(e).replace(/\]\]>/g,`]]]]><![CDATA[>`)}]]>`,d=!1,i.pop();continue}if(h===t.commentPropName){let e=m[h][0][t.textNodeName];o+=n+`\x3c!--${String(e).replace(/--/g,`- -`).replace(/-$/,`- `)}--\x3e`,d=!0,i.pop();continue}if(h[0]===`?`){let e=Mt(m[`:@`],t,k),a=h===`?xml`?``:n,f=m[h][0][t.textNodeName];f=f.length===0?``:` `+f,o+=a+`<${h}${f}${e}?>`,d=!0,i.pop();continue}let j=n;j!==``&&(j+=t.indentBy);let P=n+`<${h}${Mt(m[`:@`],t,k)}`,L;L=k?$t(m[h],t):Pt(m[h],t,j,i,a),t.unpairedTags.indexOf(h)===-1?L&&L.length!==0||!t.suppressEmptyNode?L&&L.endsWith(`>`)?o+=P+`>${L}${n}</${h}>`:(o+=P+`>`,L&&n!==``&&(L.includes(`/>`)||L.includes(`</`))?o+=n+t.indentBy+L+n:o+=L,o+=`</${h}>`):o+=P+`/>`:t.suppressUnpairedNode?o+=P+`>`:o+=P+`/>`,d=!0,i.pop()}return o}function Ot(e,t){if(!e||t.ignoreAttributes)return null;let n={},i=!1;for(let a in e)Object.prototype.hasOwnProperty.call(e,a)&&(n[a.startsWith(t.attributeNamePrefix)?a.substr(t.attributeNamePrefix.length):a]=e[a],i=!0);return i?n:null}function $t(e,t){if(!Array.isArray(e))return e==null?``:e.toString();let n=``;for(let i=0;i<e.length;i++){let a=e[i],o=Dt(a);if(o===t.textNodeName)n+=a[o];else if(o===t.cdataPropName)n+=a[o][0][t.textNodeName];else if(o===t.commentPropName)n+=a[o][0][t.textNodeName];else{if(o&&o[0]===`?`)continue;if(o){let e=It(a[`:@`],t),i=$t(a[o],t);i&&i.length!==0?n+=`<${o}${e}>${i}</${o}>`:n+=`<${o}${e}/>`}}}return n}function It(e,t){let n=``;if(e&&!t.ignoreAttributes)for(let i in e){if(!Object.prototype.hasOwnProperty.call(e,i))continue;let a=e[i];!0===a&&t.suppressBooleanAttributes?n+=` ${i.substr(t.attributeNamePrefix.length)}`:n+=` ${i.substr(t.attributeNamePrefix.length)}="${a}"`}return n}function Dt(e){let t=Object.keys(e);for(let n=0;n<t.length;n++){let i=t[n];if(Object.prototype.hasOwnProperty.call(e,i)&&i!==`:@`)return i}}function Mt(e,t,n){let i=``;if(e&&!t.ignoreAttributes)for(let a in e){if(!Object.prototype.hasOwnProperty.call(e,a))continue;let o;n?o=e[a]:(o=t.attributeValueProcessor(a,e[a]),o=Vt(o,t)),!0===o&&t.suppressBooleanAttributes?i+=` ${a.substr(t.attributeNamePrefix.length)}`:i+=` ${a.substr(t.attributeNamePrefix.length)}="${o}"`}return i}function jt(e,t){if(!t||t.length===0)return!1;for(let n=0;n<t.length;n++)if(e.matches(t[n]))return!0;return!1}function Vt(e,t){if(e&&e.length>0&&t.processEntities)for(let n=0;n<t.entities.length;n++){let i=t.entities[n];e=e.replace(i.regex,i.val)}return e}let ie={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:RegExp(`&`,`g`),val:`&amp;`},{regex:RegExp(`>`,`g`),val:`&gt;`},{regex:RegExp(`<`,`g`),val:`&lt;`},{regex:RegExp(`'`,`g`),val:`&apos;`},{regex:RegExp(`"`,`g`),val:`&quot;`}],processEntities:!0,stopNodes:[],oneListGroup:!1,maxNestedTags:100,jPath:!0};function kt(e){if(this.options=Object.assign({},ie,e),this.options.stopNodes&&Array.isArray(this.options.stopNodes)&&(this.options.stopNodes=this.options.stopNodes.map(e=>typeof e==`string`&&e.startsWith(`*.`)?`..`+e.substring(2):e)),this.stopNodeExpressions=[],this.options.stopNodes&&Array.isArray(this.options.stopNodes))for(let e=0;e<this.options.stopNodes.length;e++){let t=this.options.stopNodes[e];typeof t==`string`?this.stopNodeExpressions.push(new G(t)):t instanceof G&&this.stopNodeExpressions.push(t)}var t;!0===this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.ignoreAttributesFn=typeof(t=this.options.ignoreAttributes)==`function`?t:Array.isArray(t)?e=>{for(let n of t)if(typeof n==`string`&&e===n||n instanceof RegExp&&n.test(e))return!0}:()=>!1,this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=Gt),this.processTextOrObjNode=Ft,this.options.format?(this.indentate=Rt,this.tagEndChar=`>
19
- `,this.newLine=`
20
- `):(this.indentate=function(){return``},this.tagEndChar=`>`,this.newLine=``)}function Ft(e,t,n,i){let a=this.extractAttributes(e);if(i.push(t,a),this.checkStopNode(i)){let a=this.buildRawContent(e),o=this.buildAttributesForStopNode(e);return i.pop(),this.buildObjectNode(a,t,o,n)}let o=this.j2x(e,n+1,i);return i.pop(),e[this.options.textNodeName]!==void 0&&Object.keys(e).length===1?this.buildTextValNode(e[this.options.textNodeName],t,o.attrStr,n,i):this.buildObjectNode(o.val,t,o.attrStr,n)}function Rt(e){return this.options.indentBy.repeat(e)}function Gt(e){return!(!e.startsWith(this.options.attributeNamePrefix)||e===this.options.textNodeName)&&e.substr(this.attrPrefixLen)}kt.prototype.build=function(e){if(this.options.preserveOrder)return Ct(e,this.options);{Array.isArray(e)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(e={[this.options.arrayNodeName]:e});let t=new R;return this.j2x(e,0,t).val}},kt.prototype.j2x=function(e,t,n){let i=``,a=``;if(this.options.maxNestedTags&&n.getDepth()>=this.options.maxNestedTags)throw Error(`Maximum nested tags exceeded`);let o=this.options.jPath?n.toString():n,d=this.checkStopNode(n);for(let f in e)if(Object.prototype.hasOwnProperty.call(e,f))if(e[f]===void 0)this.isAttribute(f)&&(a+=``);else if(e[f]===null)this.isAttribute(f)||f===this.options.cdataPropName?a+=``:f[0]===`?`?a+=this.indentate(t)+`<`+f+`?`+this.tagEndChar:a+=this.indentate(t)+`<`+f+`/`+this.tagEndChar;else if(e[f]instanceof Date)a+=this.buildTextValNode(e[f],f,``,t,n);else if(typeof e[f]!=`object`){let m=this.isAttribute(f);if(m&&!this.ignoreAttributesFn(m,o))i+=this.buildAttrPairStr(m,``+e[f],d);else if(!m)if(f===this.options.textNodeName){let t=this.options.tagValueProcessor(f,``+e[f]);a+=this.replaceEntitiesValue(t)}else{n.push(f);let i=this.checkStopNode(n);if(n.pop(),i){let n=``+e[f];a+=n===``?this.indentate(t)+`<`+f+this.closeTag(f)+this.tagEndChar:this.indentate(t)+`<`+f+`>`+n+`</`+f+this.tagEndChar}else a+=this.buildTextValNode(e[f],f,``,t,n)}}else if(Array.isArray(e[f])){let i=e[f].length,o=``,d=``;for(let m=0;m<i;m++){let i=e[f][m];if(i!==void 0)if(i===null)f[0]===`?`?a+=this.indentate(t)+`<`+f+`?`+this.tagEndChar:a+=this.indentate(t)+`<`+f+`/`+this.tagEndChar;else if(typeof i==`object`)if(this.options.oneListGroup){n.push(f);let e=this.j2x(i,t+1,n);n.pop(),o+=e.val,this.options.attributesGroupName&&i.hasOwnProperty(this.options.attributesGroupName)&&(d+=e.attrStr)}else o+=this.processTextOrObjNode(i,f,t,n);else if(this.options.oneListGroup){let e=this.options.tagValueProcessor(f,i);e=this.replaceEntitiesValue(e),o+=e}else{n.push(f);let e=this.checkStopNode(n);if(n.pop(),e){let e=``+i;o+=e===``?this.indentate(t)+`<`+f+this.closeTag(f)+this.tagEndChar:this.indentate(t)+`<`+f+`>`+e+`</`+f+this.tagEndChar}else o+=this.buildTextValNode(i,f,``,t,n)}}this.options.oneListGroup&&(o=this.buildObjectNode(o,f,d,t)),a+=o}else if(this.options.attributesGroupName&&f===this.options.attributesGroupName){let t=Object.keys(e[f]),n=t.length;for(let a=0;a<n;a++)i+=this.buildAttrPairStr(t[a],``+e[f][t[a]],d)}else a+=this.processTextOrObjNode(e[f],f,t,n);return{attrStr:i,val:a}},kt.prototype.buildAttrPairStr=function(e,t,n){return n||(t=this.options.attributeValueProcessor(e,``+t),t=this.replaceEntitiesValue(t)),this.options.suppressBooleanAttributes&&t===`true`?` `+e:` `+e+`="`+t+`"`},kt.prototype.extractAttributes=function(e){if(!e||typeof e!=`object`)return null;let t={},n=!1;if(this.options.attributesGroupName&&e[this.options.attributesGroupName]){let i=e[this.options.attributesGroupName];for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(t[e.startsWith(this.options.attributeNamePrefix)?e.substring(this.options.attributeNamePrefix.length):e]=i[e],n=!0)}else for(let i in e){if(!Object.prototype.hasOwnProperty.call(e,i))continue;let a=this.isAttribute(i);a&&(t[a]=e[i],n=!0)}return n?t:null},kt.prototype.buildRawContent=function(e){if(typeof e==`string`)return e;if(typeof e!=`object`||!e)return String(e);if(e[this.options.textNodeName]!==void 0)return e[this.options.textNodeName];let t=``;for(let n in e){if(!Object.prototype.hasOwnProperty.call(e,n)||this.isAttribute(n)||this.options.attributesGroupName&&n===this.options.attributesGroupName)continue;let i=e[n];if(n===this.options.textNodeName)t+=i;else if(Array.isArray(i)){for(let e of i)if(typeof e==`string`||typeof e==`number`)t+=`<${n}>${e}</${n}>`;else if(typeof e==`object`&&e){let i=this.buildRawContent(e),a=this.buildAttributesForStopNode(e);t+=i===``?`<${n}${a}/>`:`<${n}${a}>${i}</${n}>`}}else if(typeof i==`object`&&i){let e=this.buildRawContent(i),a=this.buildAttributesForStopNode(i);t+=e===``?`<${n}${a}/>`:`<${n}${a}>${e}</${n}>`}else t+=`<${n}>${i}</${n}>`}return t},kt.prototype.buildAttributesForStopNode=function(e){if(!e||typeof e!=`object`)return``;let t=``;if(this.options.attributesGroupName&&e[this.options.attributesGroupName]){let n=e[this.options.attributesGroupName];for(let e in n){if(!Object.prototype.hasOwnProperty.call(n,e))continue;let i=e.startsWith(this.options.attributeNamePrefix)?e.substring(this.options.attributeNamePrefix.length):e,a=n[e];!0===a&&this.options.suppressBooleanAttributes?t+=` `+i:t+=` `+i+`="`+a+`"`}}else for(let n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;let i=this.isAttribute(n);if(i){let a=e[n];!0===a&&this.options.suppressBooleanAttributes?t+=` `+i:t+=` `+i+`="`+a+`"`}}return t},kt.prototype.buildObjectNode=function(e,t,n,i){if(e===``)return t[0]===`?`?this.indentate(i)+`<`+t+n+`?`+this.tagEndChar:this.indentate(i)+`<`+t+n+this.closeTag(t)+this.tagEndChar;{let a=`</`+t+this.tagEndChar,o=``;return t[0]===`?`&&(o=`?`,a=``),!n&&n!==``||e.indexOf(`<`)!==-1?!1!==this.options.commentPropName&&t===this.options.commentPropName&&o.length===0?this.indentate(i)+`\x3c!--${e}--\x3e`+this.newLine:this.indentate(i)+`<`+t+n+o+this.tagEndChar+e+this.indentate(i)+a:this.indentate(i)+`<`+t+n+o+`>`+e+a}},kt.prototype.closeTag=function(e){let t=``;return this.options.unpairedTags.indexOf(e)===-1?t=this.options.suppressEmptyNode?`/`:`></${e}`:this.options.suppressUnpairedNode||(t=`/`),t},kt.prototype.checkStopNode=function(e){if(!this.stopNodeExpressions||this.stopNodeExpressions.length===0)return!1;for(let t=0;t<this.stopNodeExpressions.length;t++)if(e.matches(this.stopNodeExpressions[t]))return!0;return!1},kt.prototype.buildTextValNode=function(e,t,n,i,a){if(!1!==this.options.cdataPropName&&t===this.options.cdataPropName){let t=String(e).replace(/\]\]>/g,`]]]]><![CDATA[>`);return this.indentate(i)+`<![CDATA[${t}]]>`+this.newLine}if(!1!==this.options.commentPropName&&t===this.options.commentPropName){let t=String(e).replace(/--/g,`- -`).replace(/-$/,`- `);return this.indentate(i)+`\x3c!--${t}--\x3e`+this.newLine}if(t[0]===`?`)return this.indentate(i)+`<`+t+n+`?`+this.tagEndChar;{let a=this.options.tagValueProcessor(t,e);return a=this.replaceEntitiesValue(a),a===``?this.indentate(i)+`<`+t+n+this.closeTag(t)+this.tagEndChar:this.indentate(i)+`<`+t+n+`>`+a+`</`+t+this.tagEndChar}},kt.prototype.replaceEntitiesValue=function(e){if(e&&e.length>0&&this.options.processEntities)for(let t=0;t<this.options.entities.length;t++){let n=this.options.entities[t];e=e.replace(n.regex,n.val)}return e};let ae=kt,oe={validate:l};t.exports=n})()})),Sr=e.t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.EntityDecoderImpl=e.CURRENCY=e.COMMON_HTML=e.XML=void 0,e.XML={amp:`&`,apos:`'`,gt:`>`,lt:`<`,quot:`"`},e.COMMON_HTML={nbsp:`\xA0`,copy:`©`,reg:`®`,trade:`™`,mdash:`—`,ndash:`–`,hellip:`…`,laquo:`«`,raquo:`»`,lsquo:`‘`,rsquo:`’`,ldquo:`“`,rdquo:`”`,bull:`•`,para:`¶`,sect:`§`,deg:`°`,frac12:`½`,frac14:`¼`,frac34:`¾`},e.CURRENCY={cent:`¢`,pound:`£`,curren:`¤`,yen:`¥`,euro:`€`,dollar:`$`,fnof:`ƒ`,inr:`₹`,af:`؋`,birr:`ብር`,peso:`₱`,rub:`₽`,won:`₩`,yuan:`¥`,cedil:`¸`};let t=new Set(`!?\\/[]$%{}^&*()<>|+`);function validateEntityName(e){if(e[0]===`#`)throw Error(`[EntityReplacer] Invalid character '#' in entity name: "${e}"`);for(let n of e)if(t.has(n))throw Error(`[EntityReplacer] Invalid character '${n}' in entity name: "${e}"`);return e}function mergeEntityMaps(...e){let t=Object.create(null);for(let n of e)if(n)for(let e of Object.keys(n)){let i=n[e];if(typeof i==`string`)t[e]=i;else if(i&&typeof i==`object`&&i.val!==void 0){let n=i.val;typeof n==`string`&&(t[e]=n)}}return t}let n=`external`,i=`base`;function parseLimitTiers(e){return!e||e===n?new Set([n]):e===`all`?new Set([`all`]):e===i?new Set([i]):Array.isArray(e)?new Set(e):new Set([n])}let a=Object.freeze({allow:0,leave:1,remove:2,throw:3}),o=new Set([9,10,13]);function parseNCRConfig(e){if(!e)return{xmlVersion:1,onLevel:a.allow,nullLevel:a.remove};let t=e.xmlVersion===1.1?1.1:1,n=a[e.onNCR??`allow`]??a.allow,i=a[e.nullNCR??`remove`]??a.remove;return{xmlVersion:t,onLevel:n,nullLevel:Math.max(i,a.remove)}}e.EntityDecoderImpl=class EntityDecoderImpl{_limit;_maxTotalExpansions;_maxExpandedLength;_postCheck;_limitTiers;_numericAllowed;_baseMap;_externalMap;_inputMap;_totalExpansions;_expandedLength;_removeSet;_leaveSet;_ncrXmlVersion;_ncrOnLevel;_ncrNullLevel;constructor(t={}){this._limit=t.limit||{},this._maxTotalExpansions=this._limit.maxTotalExpansions||0,this._maxExpandedLength=this._limit.maxExpandedLength||0,this._postCheck=typeof t.postCheck==`function`?t.postCheck:e=>e,this._limitTiers=parseLimitTiers(this._limit.applyLimitsTo??n),this._numericAllowed=t.numericAllowed??!0,this._baseMap=mergeEntityMaps(e.XML,t.namedEntities||null),this._externalMap=Object.create(null),this._inputMap=Object.create(null),this._totalExpansions=0,this._expandedLength=0,this._removeSet=new Set(t.remove&&Array.isArray(t.remove)?t.remove:[]),this._leaveSet=new Set(t.leave&&Array.isArray(t.leave)?t.leave:[]);let i=parseNCRConfig(t.ncr);this._ncrXmlVersion=i.xmlVersion,this._ncrOnLevel=i.onLevel,this._ncrNullLevel=i.nullLevel}setExternalEntities(e){if(e)for(let t of Object.keys(e))validateEntityName(t);this._externalMap=mergeEntityMaps(e)}addExternalEntity(e,t){validateEntityName(e),typeof t==`string`&&t.indexOf(`&`)===-1&&(this._externalMap[e]=t)}addInputEntities(e){this._totalExpansions=0,this._expandedLength=0,this._inputMap=mergeEntityMaps(e)}reset(){return this._inputMap=Object.create(null),this._totalExpansions=0,this._expandedLength=0,this}setXmlVersion(e){this._ncrXmlVersion=e===`1.1`||e===1.1?1.1:1}decode(e){if(typeof e!=`string`||e.length===0)return e;let t=e,a=[],o=e.length,d=0,f=0,m=this._maxTotalExpansions>0,h=this._maxExpandedLength>0,_=m||h;for(;f<o;){if(e.charCodeAt(f)!==38){f++;continue}let t=f+1;for(;t<o&&e.charCodeAt(t)!==59&&t-f<=32;)t++;if(t>=o||e.charCodeAt(t)!==59){f++;continue}let k=e.slice(f+1,t);if(k.length===0){f++;continue}let j,P;if(this._removeSet.has(k))j=``,P===void 0&&(P=n);else if(this._leaveSet.has(k)){f++;continue}else if(k.charCodeAt(0)===35){let e=this._resolveNCR(k);if(e===void 0){f++;continue}j=e,P=i}else{let e=this._resolveName(k);j=e?.value,P=e?.tier}if(j===void 0){f++;continue}if(f>d&&a.push(e.slice(d,f)),a.push(j),d=t+1,f=d,_&&this._tierCounts(P)){if(m&&(this._totalExpansions++,this._totalExpansions>this._maxTotalExpansions))throw Error(`[EntityReplacer] Entity expansion count limit exceeded: ${this._totalExpansions} > ${this._maxTotalExpansions}`);if(h){let e=j.length-(k.length+2);if(e>0&&(this._expandedLength+=e,this._expandedLength>this._maxExpandedLength))throw Error(`[EntityReplacer] Expanded content length limit exceeded: ${this._expandedLength} > ${this._maxExpandedLength}`)}}}d<o&&a.push(e.slice(d));let k=a.length===0?e:a.join(``);return this._postCheck(k,t)}_tierCounts(e){return this._limitTiers.has(`all`)?!0:this._limitTiers.has(e)}_resolveName(e){if(e in this._inputMap)return{value:this._inputMap[e],tier:n};if(e in this._externalMap)return{value:this._externalMap[e],tier:n};if(e in this._baseMap)return{value:this._baseMap[e],tier:i}}_classifyNCR(e){return e===0?this._ncrNullLevel:e>=55296&&e<=57343||this._ncrXmlVersion===1&&e>=1&&e<=31&&!o.has(e)?a.remove:-1}_applyNCRAction(e,t,n){switch(e){case a.allow:return String.fromCodePoint(n);case a.remove:return``;case a.leave:return;case a.throw:throw Error(`[EntityDecoder] Prohibited numeric character reference &${t}; (U+${n.toString(16).toUpperCase().padStart(4,`0`)})`);default:return String.fromCodePoint(n)}}_resolveNCR(e){let t=e.charCodeAt(1),n;if(n=t===120||t===88?parseInt(e.slice(2),16):parseInt(e.slice(1),10),Number.isNaN(n)||n<0||n>1114111)return;let i=this._classifyNCR(n);if(!this._numericAllowed&&i<a.remove)return;let o=i===-1?this._ncrOnLevel:Math.max(this._ncrOnLevel,i);return this._applyNCRAction(o,e,n)}}})),Cr=e.t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.parseXML=parseXML;let t=xr(),n=Sr(),i=new n.EntityDecoderImpl({namedEntities:{...n.XML,...n.COMMON_HTML,...n.CURRENCY},numericAllowed:!0,limit:{maxTotalExpansions:1/0},ncr:{xmlVersion:1.1}}),a=new t.XMLParser({attributeNamePrefix:``,processEntities:{enabled:!0,maxTotalExpansions:1/0},htmlEntities:!0,entityDecoder:{setExternalEntities:e=>{i.setExternalEntities(e)},addInputEntities:e=>{i.addInputEntities(e)},reset:()=>{i.reset()},decode:e=>i.decode(e),setXmlVersion:e=>void 0},ignoreAttributes:!1,ignoreDeclaration:!0,parseTagValue:!1,trimValues:!1,tagValueProcessor:(e,t)=>t.trim()===``&&t.includes(`
21
- `)?``:void 0,maxNestedTags:1/0});function parseXML(e){return a.parse(e,!0)}})),wr=e.t((e=>{var t=Cr();let n=/[&<>"]/g,i={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`};function escapeAttribute(e){return e.replace(n,e=>i[e])}let a=/[&"'<>\r\n\u0085\u2028]/g,o={"&":`&amp;`,'"':`&quot;`,"'":`&apos;`,"<":`&lt;`,">":`&gt;`,"\r":`&#x0D;`,"\n":`&#x0A;`,"…":`&#x85;`,"\u2028":`&#x2028;`};function escapeElement(e){return e.replace(a,e=>o[e])}var XmlText=class{value;constructor(e){this.value=e}toString(){return escapeElement(``+this.value)}},d=class XmlNode{name;children;attributes={};static of(e,t,n){let i=new XmlNode(e);return t!==void 0&&i.addChildNode(new XmlText(t)),n!==void 0&&i.withName(n),i}constructor(e,t=[]){this.name=e,this.children=t}withName(e){return this.name=e,this}addAttribute(e,t){return this.attributes[e]=t,this}addChildNode(e){return this.children.push(e),this}removeAttribute(e){return delete this.attributes[e],this}n(e){return this.name=e,this}c(e){return this.children.push(e),this}a(e,t){return t!=null&&(this.attributes[e]=t),this}cc(e,t,n=t){if(e[t]!=null){let i=XmlNode.of(t,e[t]).withName(n);this.c(i)}}l(e,t,n,i){e[t]!=null&&i().map(e=>{e.withName(n),this.c(e)})}lc(e,t,n,i){if(e[t]!=null){let e=i(),t=new XmlNode(n);e.map(e=>{t.c(e)}),this.c(t)}}toString(){let e=!!this.children.length,t=`<${this.name}`,n=this.attributes;for(let e of Object.keys(n)){let i=n[e];i!=null&&(t+=` ${e}="${escapeAttribute(``+i)}"`)}return t+=e?`>${this.children.map(e=>e.toString()).join(``)}</${this.name}>`:`/>`}};e.parseXML=t.parseXML,e.XmlNode=d,e.XmlText=XmlText})),Tr,Er,Dr,XmlShapeDeserializer,Or=e.n((()=>{Tr=wr(),i.n(),i.T(),Er=i.t(),Dr=a.t(),tr(),nr(),XmlShapeDeserializer=class extends SerdeContextConfig{settings;stringDeserializer;constructor(e){super(),this.settings=e,this.stringDeserializer=new i.a(e)}setSerdeContext(e){this.serdeContext=e,this.stringDeserializer.setSerdeContext(e)}read(e,t,n){let a=i.O.of(e),o=a.getMemberSchemas();if(a.isStructSchema()&&a.isMemberSchema()&&Object.values(o).find(e=>!!e.getMemberTraits().eventPayload)){let e={},n=Object.keys(o)[0];return o[n].isBlobSchema()?e[n]=t:e[n]=this.read(o[n],t),e}let d=(this.serdeContext?.utf8Encoder??Dr.toUtf8)(t),f=this.parseXml(d);return this.readSchema(e,n?f[n]:f)}readSchema(e,t){let n=i.O.of(e);if(n.isUnitSchema())return;let a=n.getMergedTraits();if(n.isListSchema()&&!Array.isArray(t))return this.readSchema(n,[t]);if(t==null)return t;if(typeof t==`object`){let e=!!a.xmlFlattened;if(n.isListSchema()){let i=n.getValueSchema(),a=[],o=i.getMergedTraits().xmlName??`member`,d=e?t:(t[0]??t)[o];if(d==null)return a;let f=Array.isArray(d)?d:[d];for(let e of f)a.push(this.readSchema(i,e));return a}let i={};if(n.isMapSchema()){let a=n.getKeySchema(),o=n.getValueSchema(),d;d=e?Array.isArray(t)?t:[t]:Array.isArray(t.entry)?t.entry:[t.entry];let f=a.getMergedTraits().xmlName??`key`,m=o.getMergedTraits().xmlName??`value`;for(let e of d){let t=e[f],n=e[m];i[t]=this.readSchema(o,n)}return i}if(n.isStructSchema()){let e=n.isUnionSchema(),a;e&&(a=new UnionSerde(t,i));for(let[o,d]of n.structIterator()){let n=d.getMergedTraits(),f=n.httpPayload?n.xmlName??d.getName():d.getMemberTraits().xmlName??o;e&&a.mark(f),t[f]!=null&&(i[o]=this.readSchema(d,t[f]))}return e&&a.writeUnknown(),i}if(n.isDocumentSchema())return t;throw Error(`@aws-sdk/core/protocols - xml deserializer unhandled schema type for ${n.getName(!0)}`)}return n.isListSchema()?[]:n.isMapSchema()||n.isStructSchema()?{}:this.stringDeserializer.read(n,t)}parseXml(e){if(e.length){let t;try{t=(0,Tr.parseXML)(e)}catch(t){throw t&&typeof t==`object`&&Object.defineProperty(t,`$responseBodyText`,{value:e}),t}let n=`#text`,i=Object.keys(t)[0],a=t[i];return a[n]&&(a[i]=a[n],delete a[n]),(0,Er.getValueFromTextNode)(a)}return{}}}})),kr,Ar,QueryShapeSerializer,jr=e.n((()=>{i.n(),i.T(),i.d(),kr=i.t(),Ar=i.z(),tr(),QueryShapeSerializer=class extends SerdeContextConfig{settings;buffer;constructor(e){super(),this.settings=e}write(e,t,n=``){this.buffer===void 0&&(this.buffer=``);let a=i.O.of(e);if(n&&!n.endsWith(`.`)&&(n+=`.`),a.isBlobSchema())(typeof t==`string`||t instanceof Uint8Array)&&(this.writeKey(n),this.writeValue((this.serdeContext?.base64Encoder??Ar.toBase64)(t)));else if(a.isBooleanSchema()||a.isNumericSchema()||a.isStringSchema())t==null?a.isIdempotencyToken()&&(this.writeKey(n),this.writeValue((0,i._.v4)())):(this.writeKey(n),this.writeValue(String(t)));else if(a.isBigIntegerSchema())t!=null&&(this.writeKey(n),this.writeValue(String(t)));else if(a.isBigDecimalSchema())t!=null&&(this.writeKey(n),this.writeValue(t instanceof i.p?t.string:String(t)));else if(a.isTimestampSchema()){if(t instanceof Date)switch(this.writeKey(n),i.o(a,this.settings)){case 5:this.writeValue(t.toISOString().replace(`.000Z`,`Z`));break;case 6:this.writeValue((0,kr.dateToUtcString)(t));break;case 7:this.writeValue(String(t.getTime()/1e3));break}}else if(a.isDocumentSchema())Array.isArray(t)?this.write(79,t,n):t instanceof Date?this.write(4,t,n):t instanceof Uint8Array?this.write(21,t,n):t&&typeof t==`object`?this.write(143,t,n):(this.writeKey(n),this.writeValue(String(t)));else if(a.isListSchema()){if(Array.isArray(t))if(t.length===0)this.settings.serializeEmptyLists&&(this.writeKey(n),this.writeValue(``));else{let e=a.getValueSchema(),i=this.settings.flattenLists||a.getMergedTraits().xmlFlattened,o=1;for(let a of t){if(a==null)continue;let t=e.getMergedTraits(),d=this.getKey(`member`,t.xmlName,t.ec2QueryName),f=i?`${n}${o}`:`${n}${d}.${o}`;this.write(e,a,f),++o}}}else if(a.isMapSchema()){if(t&&typeof t==`object`){let e=a.getKeySchema(),i=a.getValueSchema(),o=a.getMergedTraits().xmlFlattened,d=1;for(let[a,f]of Object.entries(t)){if(f==null)continue;let t=e.getMergedTraits(),m=this.getKey(`key`,t.xmlName,t.ec2QueryName),h=o?`${n}${d}.${m}`:`${n}entry.${d}.${m}`,_=i.getMergedTraits(),k=this.getKey(`value`,_.xmlName,_.ec2QueryName),j=o?`${n}${d}.${k}`:`${n}entry.${d}.${k}`;this.write(e,a,h),this.write(i,f,j),++d}}}else if(a.isStructSchema()){if(t&&typeof t==`object`){let e=!1;for(let[i,o]of a.structIterator()){if(t[i]==null&&!o.isIdempotencyToken())continue;let a=o.getMergedTraits(),d=this.getKey(i,a.xmlName,a.ec2QueryName,`struct`),f=`${n}${d}`;this.write(o,t[i],f),e=!0}if(!e&&a.isUnionSchema()){let{$unknown:e}=t;if(Array.isArray(e)){let[t,i]=e,a=`${n}${t}`;this.write(15,i,a)}}}}else if(!a.isUnitSchema())throw Error(`@aws-sdk/core/protocols - QuerySerializer unrecognized schema type ${a.getName(!0)}`)}flush(){if(this.buffer===void 0)throw Error(`@aws-sdk/core/protocols - QuerySerializer cannot flush with nothing written to buffer.`);let e=this.buffer;return delete this.buffer,e}getKey(e,t,n,i){let{ec2:a,capitalizeKeys:o}=this.settings;if(a&&n)return n;let d=t??e;return o&&i===`struct`?d[0].toUpperCase()+d.slice(1):d}writeKey(e){e.endsWith(`.`)&&(e=e.slice(0,e.length-1)),this.buffer+=`&${i.N(e)}=`}writeValue(e){this.buffer+=i.N(e)}}})),AwsQueryProtocol,Mr=e.n((()=>{i.n(),i.T(),Qn(),Or(),jr(),AwsQueryProtocol=class extends i.c{options;serializer;deserializer;mixin=new ProtocolLib;constructor(e){super({defaultNamespace:e.defaultNamespace,errorTypeRegistries:e.errorTypeRegistries}),this.options=e;let t={timestampFormat:{useTrait:!0,default:5},httpBindings:!1,xmlNamespace:e.xmlNamespace,serviceNamespace:e.defaultNamespace,serializeEmptyLists:!0};this.serializer=new QueryShapeSerializer(t),this.deserializer=new XmlShapeDeserializer(t)}getShapeId(){return`aws.protocols#awsQuery`}setSerdeContext(e){this.serializer.setSerdeContext(e),this.deserializer.setSerdeContext(e)}getPayloadCodec(){throw Error(`AWSQuery protocol has no payload codec.`)}async serializeRequest(e,t,n){let a=await super.serializeRequest(e,t,n);return a.path.endsWith(`/`)||(a.path+=`/`),Object.assign(a.headers,{"content-type":`application/x-www-form-urlencoded`}),(i.M(e.input)===`unit`||!a.body)&&(a.body=``),a.body=`Action=${e.name.split(`#`)[1]??e.name}&Version=${this.options.version}`+a.body,a.body.endsWith(`&`)&&(a.body=a.body.slice(-1)),a}async deserializeResponse(e,t,n){let a=this.deserializer,o=i.O.of(e.output),d={};if(n.statusCode>=300){let o=await i.P(n.body,t);o.byteLength>0&&Object.assign(d,await a.read(15,o)),await this.handleError(e,t,n,d,this.deserializeMetadata(n))}for(let e in n.headers){let t=n.headers[e];delete n.headers[e],n.headers[e.toLowerCase()]=t}let f=e.name.split(`#`)[1]??e.name,m=o.isStructSchema()&&this.useNestedResult()?f+`Result`:void 0,h=await i.P(n.body,t);return h.byteLength>0&&Object.assign(d,await a.read(o,h,m)),{$metadata:this.deserializeMetadata(n),...d}}useNestedResult(){return!0}async handleError(e,t,n,a,o){let d=this.loadQueryErrorCode(n,a)??`Unknown`;this.mixin.compose(this.compositeErrorRegistry,d,this.options.defaultNamespace);let f=this.loadQueryError(a)??{},m=this.loadQueryErrorMessage(a);f.message=m,f.Error={Type:f.Type,Code:f.Code,Message:m};let{errorSchema:h,errorMetadata:_}=await this.mixin.getErrorSchemaOrThrowBaseException(d,this.options.defaultNamespace,n,f,o,this.mixin.findQueryCompatibleError),k=i.O.of(h),j=new((this.compositeErrorRegistry.getErrorCtor(h))??Error)(m),P={Type:f.Error.Type,Code:f.Error.Code,Error:f.Error};for(let[e,t]of k.structIterator()){let n=t.getMergedTraits().xmlName??e,i=f[n]??a[n];P[e]=this.deserializer.readSchema(t,i)}throw this.mixin.decorateServiceException(Object.assign(j,_,{$fault:k.getMergedTraits().error,message:m},P),a)}loadQueryErrorCode(e,t){let n=(t.Errors?.[0]?.Error??t.Errors?.Error??t.Error)?.Code;if(n!==void 0)return n;if(e.statusCode==404)return`NotFound`}loadQueryError(e){return e.Errors?.[0]?.Error??e.Errors?.Error??e.Error}loadQueryErrorMessage(e){let t=this.loadQueryError(e);return t?.message??t?.Message??e.message??e.Message??`Unknown`}getDefaultContentType(){return`application/x-www-form-urlencoded`}}})),AwsEc2QueryProtocol,Nr=e.n((()=>{Mr(),AwsEc2QueryProtocol=class extends AwsQueryProtocol{options;constructor(e){super(e),this.options=e,Object.assign(this.serializer.settings,{capitalizeKeys:!0,flattenLists:!0,serializeEmptyLists:!1,ec2:!0})}getShapeId(){return`aws.protocols#ec2Query`}useNestedResult(){return!1}}})),Pr=e.n((()=>{})),Fr,Ir,parseXmlBody,parseXmlErrorBody,loadRestXmlErrorCode,Lr=e.n((()=>{Fr=wr(),Ir=i.t(),or(),parseXmlBody=(e,t)=>collectBodyString(e,t).then(e=>{if(e.length){let t;try{t=(0,Fr.parseXML)(e)}catch(t){throw t&&typeof t==`object`&&Object.defineProperty(t,`$responseBodyText`,{value:e}),t}let n=`#text`,i=Object.keys(t)[0],a=t[i];return a[n]&&(a[i]=a[n],delete a[n]),(0,Ir.getValueFromTextNode)(a)}return{}}),parseXmlErrorBody=async(e,t)=>{let n=await parseXmlBody(e,t);return n.Error&&(n.Error.message=n.Error.message??n.Error.Message),n},loadRestXmlErrorCode=(e,t)=>{if(t?.Error?.Code!==void 0)return t.Error.Code;if(t?.Code!==void 0)return t.Code;if(e.statusCode==404)return`NotFound`}})),Q,Rr,zr,XmlShapeSerializer,Br=e.n((()=>{Q=wr(),i.n(),i.T(),i.d(),Rr=i.t(),zr=i.z(),tr(),XmlShapeSerializer=class extends SerdeContextConfig{settings;stringBuffer;byteBuffer;buffer;constructor(e){super(),this.settings=e}write(e,t){let n=i.O.of(e);if(n.isStringSchema()&&typeof t==`string`)this.stringBuffer=t;else if(n.isBlobSchema())this.byteBuffer=`byteLength`in t?t:(this.serdeContext?.base64Decoder??zr.fromBase64)(t);else{this.buffer=this.writeStruct(n,t,void 0);let e=n.getMergedTraits();e.httpPayload&&!e.xmlName&&this.buffer.withName(n.getName())}}flush(){if(this.byteBuffer!==void 0){let e=this.byteBuffer;return delete this.byteBuffer,e}if(this.stringBuffer!==void 0){let e=this.stringBuffer;return delete this.stringBuffer,e}let e=this.buffer;return this.settings.xmlNamespace&&(e?.attributes?.xmlns||e.addAttribute(`xmlns`,this.settings.xmlNamespace)),delete this.buffer,e.toString()}writeStruct(e,t,n){let i=e.getMergedTraits(),a=e.isMemberSchema()&&!i.httpPayload?e.getMemberTraits().xmlName??e.getMemberName():i.xmlName??e.getName();if(!a||!e.isStructSchema())throw Error(`@aws-sdk/core/protocols - xml serializer, cannot write struct with empty name or non-struct, schema=${e.getName(!0)}.`);let o=Q.XmlNode.of(a),[d,f]=this.getXmlnsAttribute(e,n);for(let[n,i]of e.structIterator()){let e=t[n];if(e!=null||i.isIdempotencyToken()){if(i.getMergedTraits().xmlAttribute){o.addAttribute(i.getMergedTraits().xmlName??n,this.writeSimple(i,e));continue}if(i.isListSchema())this.writeList(i,e,o,f);else if(i.isMapSchema())this.writeMap(i,e,o,f);else if(i.isStructSchema())o.addChildNode(this.writeStruct(i,e,f));else{let t=Q.XmlNode.of(i.getMergedTraits().xmlName??i.getMemberName());this.writeSimpleInto(i,e,t,f),o.addChildNode(t)}}}let{$unknown:m}=t;if(m&&e.isUnionSchema()&&Array.isArray(m)&&Object.keys(t).length===1){let[e,n]=m,i=Q.XmlNode.of(e);if(typeof n!=`string`)if(t instanceof Q.XmlNode||t instanceof Q.XmlText)o.addChildNode(t);else throw Error(`@aws-sdk - $unknown union member in XML requires value of type string, @aws-sdk/xml-builder::XmlNode or XmlText.`);this.writeSimpleInto(0,n,i,f),o.addChildNode(i)}return f&&o.addAttribute(d,f),o}writeList(e,t,n,i){if(!e.isMemberSchema())throw Error(`@aws-sdk/core/protocols - xml serializer, cannot write non-member list: ${e.getName(!0)}`);let a=e.getMergedTraits(),o=e.getValueSchema(),d=o.getMergedTraits(),f=!!d.sparse,m=!!a.xmlFlattened,[h,_]=this.getXmlnsAttribute(e,i),writeItem=(t,n)=>{if(o.isListSchema())this.writeList(o,Array.isArray(n)?n:[n],t,_);else if(o.isMapSchema())this.writeMap(o,n,t,_);else if(o.isStructSchema()){let i=this.writeStruct(o,n,_);t.addChildNode(i.withName(m?a.xmlName??e.getMemberName():d.xmlName??`member`))}else{let i=Q.XmlNode.of(m?a.xmlName??e.getMemberName():d.xmlName??`member`);this.writeSimpleInto(o,n,i,_),t.addChildNode(i)}};if(m)for(let e of t)(f||e!=null)&&writeItem(n,e);else{let i=Q.XmlNode.of(a.xmlName??e.getMemberName());_&&i.addAttribute(h,_);for(let e of t)(f||e!=null)&&writeItem(i,e);n.addChildNode(i)}}writeMap(e,t,n,i,a=!1){if(!e.isMemberSchema())throw Error(`@aws-sdk/core/protocols - xml serializer, cannot write non-member map: ${e.getName(!0)}`);let o=e.getMergedTraits(),d=e.getKeySchema(),f=d.getMergedTraits().xmlName??`key`,m=e.getValueSchema(),h=m.getMergedTraits(),_=h.xmlName??`value`,k=!!h.sparse,j=!!o.xmlFlattened,[P,L]=this.getXmlnsAttribute(e,i),addKeyValue=(e,t,n)=>{let i=Q.XmlNode.of(f,t),[a,o]=this.getXmlnsAttribute(d,L);o&&i.addAttribute(a,o),e.addChildNode(i);let h=Q.XmlNode.of(_);m.isListSchema()?this.writeList(m,n,h,L):m.isMapSchema()?this.writeMap(m,n,h,L,!0):m.isStructSchema()?h=this.writeStruct(m,n,L):this.writeSimpleInto(m,n,h,L),e.addChildNode(h)};if(j){for(let[i,a]of Object.entries(t))if(k||a!=null){let t=Q.XmlNode.of(o.xmlName??e.getMemberName());addKeyValue(t,i,a),n.addChildNode(t)}}else{let i;a||(i=Q.XmlNode.of(o.xmlName??e.getMemberName()),L&&i.addAttribute(P,L),n.addChildNode(i));for(let[e,o]of Object.entries(t))if(k||o!=null){let t=Q.XmlNode.of(`entry`);addKeyValue(t,e,o),(a?n:i).addChildNode(t)}}}writeSimple(e,t){if(t===null)throw Error(`@aws-sdk/core/protocols - (XML serializer) cannot write null value.`);let n=i.O.of(e),a=null;if(t&&typeof t==`object`)if(n.isBlobSchema())a=(this.serdeContext?.base64Encoder??zr.toBase64)(t);else if(n.isTimestampSchema()&&t instanceof Date)switch(i.o(n,this.settings)){case 5:a=t.toISOString().replace(`.000Z`,`Z`);break;case 6:a=(0,Rr.dateToUtcString)(t);break;case 7:a=String(t.getTime()/1e3);break;default:console.warn(`Missing timestamp format, using http date`,t),a=(0,Rr.dateToUtcString)(t);break}else if(n.isBigDecimalSchema()&&t)return t instanceof i.p?t.string:String(t);else if(n.isMapSchema()||n.isListSchema())throw Error(`@aws-sdk/core/protocols - xml serializer, cannot call _write() on List/Map schema, call writeList or writeMap() instead.`);else throw Error(`@aws-sdk/core/protocols - xml serializer, unhandled schema type for object value and schema: ${n.getName(!0)}`);if((n.isBooleanSchema()||n.isNumericSchema()||n.isBigIntegerSchema()||n.isBigDecimalSchema())&&(a=String(t)),n.isStringSchema()&&(a=t===void 0&&n.isIdempotencyToken()?(0,i._.v4)():String(t)),a===null)throw Error(`Unhandled schema-value pair ${n.getName(!0)}=${t}`);return a}writeSimpleInto(e,t,n,a){let o=this.writeSimple(e,t),d=i.O.of(e),f=new Q.XmlText(o),[m,h]=this.getXmlnsAttribute(d,a);h&&n.addAttribute(m,h),n.addChildNode(f)}getXmlnsAttribute(e,t){let[n,i]=e.getMergedTraits().xmlNamespace??[];return i&&i!==t?[n?`xmlns:${n}`:`xmlns`,i]:[void 0,void 0]}}})),XmlCodec,Vr=e.n((()=>{tr(),Or(),Br(),XmlCodec=class extends SerdeContextConfig{settings;constructor(e){super(),this.settings=e}createSerializer(){let e=new XmlShapeSerializer(this.settings);return e.setSerdeContext(this.serdeContext),e}createDeserializer(){let e=new XmlShapeDeserializer(this.settings);return e.setSerdeContext(this.serdeContext),e}}})),AwsRestXmlProtocol,Hr=e.n((()=>{i.n(),i.T(),Qn(),Lr(),Vr(),AwsRestXmlProtocol=class extends i.l{codec;serializer;deserializer;mixin=new ProtocolLib;constructor(e){super(e);let t={timestampFormat:{useTrait:!0,default:5},httpBindings:!0,xmlNamespace:e.xmlNamespace,serviceNamespace:e.defaultNamespace};this.codec=new XmlCodec(t),this.serializer=new i.r(this.codec.createSerializer(),t),this.deserializer=new i.i(this.codec.createDeserializer(),t),this.compositeErrorRegistry}getPayloadCodec(){return this.codec}getShapeId(){return`aws.protocols#restXml`}async serializeRequest(e,t,n){let a=await super.serializeRequest(e,t,n),o=i.O.of(e.input);if(!a.headers[`content-type`]){let e=this.mixin.resolveRestContentType(this.getDefaultContentType(),o);e&&(a.headers[`content-type`]=e)}return typeof a.body==`string`&&a.headers[`content-type`]===this.getDefaultContentType()&&!a.body.startsWith(`<?xml `)&&!this.hasUnstructuredPayloadBinding(o)&&(a.body=`<?xml version="1.0" encoding="UTF-8"?>`+a.body),a}async deserializeResponse(e,t,n){return super.deserializeResponse(e,t,n)}async handleError(e,t,n,a,o){let d=loadRestXmlErrorCode(n,a)??`Unknown`;if(this.mixin.compose(this.compositeErrorRegistry,d,this.options.defaultNamespace),a.Error&&typeof a.Error==`object`)for(let e of Object.keys(a.Error))a[e]=a.Error[e],e.toLowerCase()===`message`&&(a.message=a.Error[e]);a.RequestId&&!o.requestId&&(o.requestId=a.RequestId);let{errorSchema:f,errorMetadata:m}=await this.mixin.getErrorSchemaOrThrowBaseException(d,this.options.defaultNamespace,n,a,o),h=i.O.of(f),_=a.Error?.message??a.Error?.Message??a.message??a.Message??`UnknownError`,k=new((this.compositeErrorRegistry.getErrorCtor(f))??Error)(_);await this.deserializeHttpMessage(f,t,n,a);let j={};for(let[e,t]of h.structIterator()){let n=t.getMergedTraits().xmlName??e,i=a.Error?.[n]??a[n];j[e]=this.codec.createDeserializer().readSchema(t,i)}throw this.mixin.decorateServiceException(Object.assign(k,m,{$fault:h.getMergedTraits().error,message:_},j),a)}getDefaultContentType(){return`application/xml`}hasUnstructuredPayloadBinding(e){for(let[,t]of e.structIterator())if(t.getMergedTraits().httpPayload)return!(t.isStructSchema()||t.isMapSchema()||t.isListSchema());return!1}}})),Ur=e.r({AwsEc2QueryProtocol:()=>AwsEc2QueryProtocol,AwsJson1_0Protocol:()=>AwsJson1_0Protocol,AwsJson1_1Protocol:()=>AwsJson1_1Protocol,AwsJsonRpcProtocol:()=>AwsJsonRpcProtocol,AwsQueryProtocol:()=>AwsQueryProtocol,AwsRestJsonProtocol:()=>AwsRestJsonProtocol,AwsRestXmlProtocol:()=>AwsRestXmlProtocol,AwsSmithyRpcV2CborProtocol:()=>AwsSmithyRpcV2CborProtocol,JsonCodec:()=>JsonCodec,JsonShapeDeserializer:()=>JsonShapeDeserializer,JsonShapeSerializer:()=>JsonShapeSerializer,QueryShapeSerializer:()=>QueryShapeSerializer,XmlCodec:()=>XmlCodec,XmlShapeDeserializer:()=>XmlShapeDeserializer,XmlShapeSerializer:()=>XmlShapeSerializer,_toBool:()=>_toBool,_toNum:()=>_toNum,_toStr:()=>_toStr,awsExpectUnion:()=>awsExpectUnion,loadRestJsonErrorCode:()=>loadRestJsonErrorCode,loadRestXmlErrorCode:()=>loadRestXmlErrorCode,parseJsonBody:()=>parseJsonBody,parseJsonErrorBody:()=>parseJsonErrorBody,parseXmlBody:()=>parseXmlBody,parseXmlErrorBody:()=>parseXmlErrorBody}),Wr=e.n((()=>{$n(),er(),gr(),_r(),hr(),vr(),mr(),lr(),pr(),br(),sr(),Nr(),Mr(),Pr(),jr(),Hr(),Vr(),Or(),Br(),Lr()})),Gr=e.t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.warning=void 0,e.stsRegionDefaultResolver=stsRegionDefaultResolver;let t=Ve(),n=h.t();function stsRegionDefaultResolver(i={}){return(0,n.loadConfig)({...t.NODE_REGION_CONFIG_OPTIONS,async default(){return e.warning.silence||console.warn(`@aws-sdk - WARN - default STS region of us-east-1 used. See @aws-sdk/credential-providers README and set a region explicitly.`),`us-east-1`}},{...t.NODE_REGION_CONFIG_FILE_OPTIONS,...i})}e.warning={silence:!1}})),Kr=e.t((e=>{var t=Gr(),n=Ve();let getAwsRegionExtensionConfiguration=e=>({setRegion(t){e.region=t},region(){return e.region}}),resolveAwsRegionExtensionConfiguration=e=>({region:e.region()});e.NODE_REGION_CONFIG_FILE_OPTIONS=n.NODE_REGION_CONFIG_FILE_OPTIONS,e.NODE_REGION_CONFIG_OPTIONS=n.NODE_REGION_CONFIG_OPTIONS,e.REGION_ENV_NAME=n.REGION_ENV_NAME,e.REGION_INI_NAME=n.REGION_INI_NAME,e.resolveRegionConfig=n.resolveRegionConfig,e.getAwsRegionExtensionConfiguration=getAwsRegionExtensionConfiguration,e.resolveAwsRegionExtensionConfiguration=resolveAwsRegionExtensionConfiguration,Object.prototype.hasOwnProperty.call(t,`__proto__`)&&!Object.prototype.hasOwnProperty.call(e,`__proto__`)&&Object.defineProperty(e,`__proto__`,{enumerable:!0,value:t.__proto__}),Object.keys(t).forEach(function(n){n!==`default`&&!Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=t[n])})}));Object.defineProperty(exports,`A`,{enumerable:!0,get:function(){return k}}),Object.defineProperty(exports,`C`,{enumerable:!0,get:function(){return Ne}}),Object.defineProperty(exports,`D`,{enumerable:!0,get:function(){return getHttpSigningPlugin}}),Object.defineProperty(exports,`E`,{enumerable:!0,get:function(){return DefaultIdentityProviderConfig}}),Object.defineProperty(exports,`O`,{enumerable:!0,get:function(){return getHttpAuthSchemeEndpointRuleSetPlugin}}),Object.defineProperty(exports,`S`,{enumerable:!0,get:function(){return Fe}}),Object.defineProperty(exports,`T`,{enumerable:!0,get:function(){return NoAuthSigner}}),Object.defineProperty(exports,`_`,{enumerable:!0,get:function(){return He}}),Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return AwsRestJsonProtocol}}),Object.defineProperty(exports,`b`,{enumerable:!0,get:function(){return Re}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return ln}}),Object.defineProperty(exports,`d`,{enumerable:!0,get:function(){return sn}}),Object.defineProperty(exports,`f`,{enumerable:!0,get:function(){return resolveAwsSdkSigV4Config}}),Object.defineProperty(exports,`g`,{enumerable:!0,get:function(){return Ke}}),Object.defineProperty(exports,`h`,{enumerable:!0,get:function(){return Je}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return AwsQueryProtocol}}),Object.defineProperty(exports,`j`,{enumerable:!0,get:function(){return _}}),Object.defineProperty(exports,`k`,{enumerable:!0,get:function(){return ee}}),Object.defineProperty(exports,`l`,{enumerable:!0,get:function(){return cn}}),Object.defineProperty(exports,`m`,{enumerable:!0,get:function(){return AwsSdkSigV4Signer}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return Wr}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return dn}}),Object.defineProperty(exports,`p`,{enumerable:!0,get:function(){return Jt}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return Ur}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return un}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return Kr}}),Object.defineProperty(exports,`u`,{enumerable:!0,get:function(){return on}}),Object.defineProperty(exports,`v`,{enumerable:!0,get:function(){return Ve}}),Object.defineProperty(exports,`w`,{enumerable:!0,get:function(){return Pe}}),Object.defineProperty(exports,`x`,{enumerable:!0,get:function(){return Ie}}),Object.defineProperty(exports,`y`,{enumerable:!0,get:function(){return ze}});