create-sailor 1.8.0 → 1.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/README.md +2 -2
  2. package/dist/aws-kms-3GX7ZOSJ.js +1 -0
  3. package/dist/{chunk-4AGDXYPL.js → chunk-5ECPN42W.js} +1 -1
  4. package/dist/chunk-FNDUJLS6.js +1 -0
  5. package/dist/chunk-HGJYEXMU.js +1 -0
  6. package/dist/chunk-HX3EZBGO.js +30 -0
  7. package/dist/chunk-IYWUY3VA.js +1 -0
  8. package/dist/chunk-JTXBZ2SU.js +1 -0
  9. package/dist/{chunk-M3QJPQWS.js → chunk-KRX2KWWT.js} +1 -1
  10. package/dist/chunk-OIQB5F6Y.js +1 -0
  11. package/dist/chunk-P2WEIQRQ.js +3 -0
  12. package/dist/chunk-RH2FFVSB.js +1 -0
  13. package/dist/chunk-STX7THHW.js +21 -0
  14. package/dist/chunk-TW5BOTVX.js +0 -0
  15. package/dist/chunk-VFREGXHN.js +1 -0
  16. package/dist/chunk-W5TBFCWY.js +4 -0
  17. package/dist/chunk-WJLTO7JW.js +0 -0
  18. package/dist/chunk-WU3IV4WF.js +1 -0
  19. package/dist/{chunk-UU4YUKYZ.js → chunk-XE3I3HCZ.js} +1 -1
  20. package/dist/chunk-ZIBRKYXP.js +23 -0
  21. package/dist/credits-HWAYRMKF.js +2635 -0
  22. package/dist/{dist-V6L2DNL2.js → dist-B346V4U6.js} +2 -2
  23. package/dist/dist-UXDXDLES.js +1 -0
  24. package/dist/dist-es-B5M7V6O6.js +1 -0
  25. package/dist/{dist-es-JATELSE4.js → dist-es-FU66ZQS5.js} +1 -1
  26. package/dist/dist-es-KE65J6GC.js +1 -0
  27. package/dist/dist-es-PFLN3FTL.js +5 -0
  28. package/dist/dist-es-U3NYQORW.js +1 -0
  29. package/dist/dist-es-VG3XXJ7M.js +2 -0
  30. package/dist/dist-es-WAHVDQ3F.js +2 -0
  31. package/dist/{event-streams-IPTOYMEP.js → event-streams-BXAP5G2H.js} +1 -1
  32. package/dist/event-streams-SGW54BDO.js +1 -0
  33. package/dist/index.js +184 -185
  34. package/dist/loadSso-WRXP2HXL.js +1 -0
  35. package/dist/local-6WWVOMA7.js +1 -0
  36. package/dist/{query_compiler_fast_bg.postgresql-FOSFFKA5.js → query_compiler_fast_bg.postgresql-JA2BFVW5.js} +1 -1
  37. package/dist/{query_compiler_fast_bg.postgresql.wasm-base64-JU7X67WB.js → query_compiler_fast_bg.postgresql.wasm-base64-URHQ2Y3Y.js} +1 -1
  38. package/dist/signin-JB7STGTR.js +1 -0
  39. package/dist/sso-oidc-LTNOJMPI.js +1 -0
  40. package/dist/sts-RKUL4Q47.js +5 -0
  41. package/package.json +1 -1
  42. package/templates/deploy/Dockerfile.web +1 -1
  43. package/dist/aws-kms-EYG3LGYA.js +0 -1
  44. package/dist/chunk-224RJRPV.js +0 -5
  45. package/dist/chunk-2YUF6TO6.js +0 -2
  46. package/dist/chunk-76FD5Z7D.js +0 -23
  47. package/dist/chunk-7OZT53MS.js +0 -1
  48. package/dist/chunk-AAIUIEEA.js +0 -1
  49. package/dist/chunk-C6CKWQY5.js +0 -20
  50. package/dist/chunk-CHWVD37K.js +0 -1
  51. package/dist/chunk-EBTFPGDR.js +0 -9
  52. package/dist/chunk-EIQ2HSZP.js +0 -1
  53. package/dist/chunk-FSRPMVAS.js +0 -1
  54. package/dist/chunk-IY2KKEUD.js +0 -1
  55. package/dist/chunk-OWZF7P72.js +0 -1
  56. package/dist/chunk-WI7DO2VU.js +0 -1
  57. package/dist/chunk-XPRSUMI6.js +0 -1
  58. package/dist/credits-7FJY7HK2.js +0 -2613
  59. package/dist/dist-LOLT3W3R.js +0 -1
  60. package/dist/dist-es-3AHFNYTD.js +0 -5
  61. package/dist/dist-es-6KZILXYZ.js +0 -1
  62. package/dist/dist-es-H627TNCU.js +0 -1
  63. package/dist/dist-es-I6TTSEP7.js +0 -2
  64. package/dist/dist-es-NRANDF25.js +0 -2
  65. package/dist/dist-es-YSAFQMS4.js +0 -1
  66. package/dist/loadSso-FR7LG5FX.js +0 -1
  67. package/dist/local-BUKM6VCO.js +0 -1
  68. package/dist/signin-N4XQB5ZB.js +0 -1
  69. package/dist/sso-oidc-FXPYRI5I.js +0 -1
  70. package/dist/sts-SIEJPPW3.js +0 -6
  71. /package/dist/{chunk-3T4EOSMQ.js → chunk-SPHQRDN5.js} +0 -0
package/README.md CHANGED
@@ -175,8 +175,8 @@ single monorepo you can extend instead of re-assembling from scratch.
175
175
 
176
176
  ## Documentation
177
177
 
178
- - **Getting Started**: [nebutra.com/docs/getting-started/installation](https://nebutra.com/docs/getting-started/installation)
179
- - **Customization Guide**: [nebutra.com/docs/customization/overview](https://nebutra.com/docs/customization/overview)
178
+ - **Getting Started**: [docs.nebutra.com/getting-started/installation](https://docs.nebutra.com/getting-started/installation)
179
+ - **Customization Guide**: [docs.nebutra.com/customization/overview](https://docs.nebutra.com/customization/overview)
180
180
  - **Licensing**: [nebutra.com/licensing](https://nebutra.com/licensing)
181
181
  - **Get Free License**: [nebutra.com/get-license](https://nebutra.com/get-license)
182
182
 
@@ -0,0 +1 @@
1
+ import{a}from"./chunk-HX3EZBGO.js";import"./chunk-QSLKOXQ6.js";import"./chunk-ZIBRKYXP.js";import"./chunk-VFREGXHN.js";import"./chunk-ZCWB3HFB.js";import"./chunk-WU3IV4WF.js";import"./chunk-XB6R2VIU.js";import"./chunk-KRX2KWWT.js";import"./chunk-OIQB5F6Y.js";import"./chunk-JTXBZ2SU.js";import"./chunk-WJLTO7JW.js";import"./chunk-TW5BOTVX.js";import"./chunk-SPHQRDN5.js";import"./chunk-FNDUJLS6.js";import"./chunk-HGJYEXMU.js";import"./chunk-W5TBFCWY.js";import"./chunk-TX7AAHER.js";import"./chunk-IYWUY3VA.js";export{a as AWSKMSProvider};
@@ -1 +1 @@
1
- import{a as c,b as h,c as f,d as y,f as n,g as i}from"./chunk-QSLKOXQ6.js";import{a as r}from"./chunk-76FD5Z7D.js";import{randomUUID as E}from"crypto";var k=32,v=class{name="local";masterKey;salt;keyVersion;constructor(e){let t=e.masterKey??g();if(!t)throw new Error("Master key required. Set VAULT_LOCAL_MASTER_KEY or VAULT_MASTER_KEY env var, or pass masterKey in config.");if(this.masterKey=Buffer.from(t,"utf-8"),this.masterKey.length<k)throw new Error(`Vault master key too short: ${this.masterKey.length} bytes, need at least ${k}. Set VAULT_LOCAL_MASTER_KEY / VAULT_MASTER_KEY to a value with at least 32 bytes of entropy.`);this.salt=e.salt??Buffer.from("nebutra-vault","utf-8"),this.keyVersion=e.keyVersion??1,r.debug("[vault:local] Initialized",{keyVersion:this.keyVersion})}buildAad(e,t){return Buffer.from(`v2|tenant=${e??""}|kek=${t}`,"utf-8")}async deriveKek(){let e=Buffer.from(`nebutra-vault-kek-v${this.keyVersion}`,"utf-8");return f(this.masterKey,this.salt,e)}async encrypt(e,t){try{let a=await this.deriveKek(),u=y(32),o=this.buildAad(t?.tenantId,this.keyVersion),s=c(u,a,o),l=c(e,u,o),m={id:t?.id??E(),ciphertext:n(l.ciphertext),encryptedDek:n(s.ciphertext),iv:n(l.iv),authTag:n(l.authTag),dekIv:n(s.iv),dekAuthTag:n(s.authTag),keyVersion:this.keyVersion,envelopeVersion:2,algorithm:"aes-256-gcm",...t?.tenantId!==void 0?{tenantId:t.tenantId}:{},...t?.metadata!==void 0?{metadata:t.metadata}:{},createdAt:new Date().toISOString()};return r.debug("[vault:local] Secret encrypted",{id:m.id,tenantId:t?.tenantId}),m}catch(a){throw r.error("[vault:local] Encryption failed",{error:a}),new Error(`Local vault encryption failed: ${a instanceof Error?a.message:String(a)}`)}}async decrypt(e,t){try{if(t?.tenantId&&e.tenantId&&e.tenantId!==t.tenantId)throw new Error("Tenant ID mismatch");e.keyVersion!==this.keyVersion&&r.warn("[vault:local] Key version mismatch",{secretVersion:e.keyVersion,currentVersion:this.keyVersion});let a=Buffer.from(`nebutra-vault-kek-v${e.keyVersion}`,"utf-8"),u=await f(this.masterKey,this.salt,a),o=e.envelopeVersion===2?this.buildAad(e.tenantId,e.keyVersion):void 0,s;if(e.dekIv&&e.dekAuthTag)s=h(i(e.encryptedDek),u,{iv:i(e.dekIv),authTag:i(e.dekAuthTag)},o);else throw new Error("Encrypted DEK missing IV/authTag \u2014 cannot decrypt. Re-encrypt with current version.");let l=h(i(e.ciphertext),s,{iv:i(e.iv),authTag:i(e.authTag)},o);return r.debug("[vault:local] Secret decrypted",{id:e.id,tenantId:t?.tenantId}),l.toString("utf-8")}catch(a){throw r.error("[vault:local] Decryption failed",{error:a}),new Error(`Local vault decryption failed: ${a instanceof Error?a.message:String(a)}`)}}async rotateKey(e){try{let t=await this.decrypt(e),a=await this.encrypt(t,{id:e.id,...e.tenantId!==void 0?{tenantId:e.tenantId}:{},...e.metadata!==void 0?{metadata:{name:e.metadata.name,type:e.metadata.type,...e.metadata.expiresAt!==void 0?{expiresAt:e.metadata.expiresAt}:{}}}:{}});return a.rotatedAt=new Date().toISOString(),r.debug("[vault:local] Key rotated",{id:e.id}),a}catch(t){throw r.error("[vault:local] Key rotation failed",{error:t}),new Error(`Key rotation failed: ${t instanceof Error?t.message:String(t)}`)}}async rotateKek(){this.keyVersion+=1,r.info("[vault:local] KEK rotated",{newVersion:this.keyVersion})}async generateDek(){return y(32)}async close(){r.debug("[vault:local] Closed")}};function g(){let d=process.env.VAULT_MASTER_KEY,e=process.env.VAULT_LOCAL_MASTER_KEY;if(d&&e&&d!==e)throw new Error("Vault local key mismatch: VAULT_MASTER_KEY and VAULT_LOCAL_MASTER_KEY are both set but differ.");return e??d}export{v as a};
1
+ import{a as c,b as h,c as f,d as y,f as n,g as i}from"./chunk-QSLKOXQ6.js";import{a as r}from"./chunk-ZIBRKYXP.js";import{randomUUID as E}from"crypto";var k=32,v=class{name="local";masterKey;salt;keyVersion;constructor(e){let t=e.masterKey??g();if(!t)throw new Error("Master key required. Set VAULT_LOCAL_MASTER_KEY or VAULT_MASTER_KEY env var, or pass masterKey in config.");if(this.masterKey=Buffer.from(t,"utf-8"),this.masterKey.length<k)throw new Error(`Vault master key too short: ${this.masterKey.length} bytes, need at least ${k}. Set VAULT_LOCAL_MASTER_KEY / VAULT_MASTER_KEY to a value with at least 32 bytes of entropy.`);this.salt=e.salt??Buffer.from("nebutra-vault","utf-8"),this.keyVersion=e.keyVersion??1,r.debug("[vault:local] Initialized",{keyVersion:this.keyVersion})}buildAad(e,t){return Buffer.from(`v2|tenant=${e??""}|kek=${t}`,"utf-8")}async deriveKek(){let e=Buffer.from(`nebutra-vault-kek-v${this.keyVersion}`,"utf-8");return f(this.masterKey,this.salt,e)}async encrypt(e,t){try{let a=await this.deriveKek(),u=y(32),o=this.buildAad(t?.tenantId,this.keyVersion),s=c(u,a,o),l=c(e,u,o),m={id:t?.id??E(),ciphertext:n(l.ciphertext),encryptedDek:n(s.ciphertext),iv:n(l.iv),authTag:n(l.authTag),dekIv:n(s.iv),dekAuthTag:n(s.authTag),keyVersion:this.keyVersion,envelopeVersion:2,algorithm:"aes-256-gcm",...t?.tenantId!==void 0?{tenantId:t.tenantId}:{},...t?.metadata!==void 0?{metadata:t.metadata}:{},createdAt:new Date().toISOString()};return r.debug("[vault:local] Secret encrypted",{id:m.id,tenantId:t?.tenantId}),m}catch(a){throw r.error("[vault:local] Encryption failed",{error:a}),new Error(`Local vault encryption failed: ${a instanceof Error?a.message:String(a)}`)}}async decrypt(e,t){try{if(t?.tenantId&&e.tenantId&&e.tenantId!==t.tenantId)throw new Error("Tenant ID mismatch");e.keyVersion!==this.keyVersion&&r.warn("[vault:local] Key version mismatch",{secretVersion:e.keyVersion,currentVersion:this.keyVersion});let a=Buffer.from(`nebutra-vault-kek-v${e.keyVersion}`,"utf-8"),u=await f(this.masterKey,this.salt,a),o=e.envelopeVersion===2?this.buildAad(e.tenantId,e.keyVersion):void 0,s;if(e.dekIv&&e.dekAuthTag)s=h(i(e.encryptedDek),u,{iv:i(e.dekIv),authTag:i(e.dekAuthTag)},o);else throw new Error("Encrypted DEK missing IV/authTag \u2014 cannot decrypt. Re-encrypt with current version.");let l=h(i(e.ciphertext),s,{iv:i(e.iv),authTag:i(e.authTag)},o);return r.debug("[vault:local] Secret decrypted",{id:e.id,tenantId:t?.tenantId}),l.toString("utf-8")}catch(a){throw r.error("[vault:local] Decryption failed",{error:a}),new Error(`Local vault decryption failed: ${a instanceof Error?a.message:String(a)}`)}}async rotateKey(e){try{let t=await this.decrypt(e),a=await this.encrypt(t,{id:e.id,...e.tenantId!==void 0?{tenantId:e.tenantId}:{},...e.metadata!==void 0?{metadata:{name:e.metadata.name,type:e.metadata.type,...e.metadata.expiresAt!==void 0?{expiresAt:e.metadata.expiresAt}:{}}}:{}});return a.rotatedAt=new Date().toISOString(),r.debug("[vault:local] Key rotated",{id:e.id}),a}catch(t){throw r.error("[vault:local] Key rotation failed",{error:t}),new Error(`Key rotation failed: ${t instanceof Error?t.message:String(t)}`)}}async rotateKek(){this.keyVersion+=1,r.info("[vault:local] KEK rotated",{newVersion:this.keyVersion})}async generateDek(){return y(32)}async close(){r.debug("[vault:local] Closed")}};function g(){let d=process.env.VAULT_MASTER_KEY,e=process.env.VAULT_LOCAL_MASTER_KEY;if(d&&e&&d!==e)throw new Error("Vault local key mismatch: VAULT_MASTER_KEY and VAULT_LOCAL_MASTER_KEY are both set but differ.");return e??d}export{v as a};
@@ -0,0 +1 @@
1
+ import{b as F}from"./chunk-HGJYEXMU.js";var C=(t,e)=>{let r=[];if(t&&r.push(t),e)for(let o of e)r.push(o);return r},S=(t,e)=>`${t||"anonymous"}${e&&e.length>0?` (a.k.a. ${e.join(",")})`:""}`,_=()=>{let t=[],e=[],r=!1,o=new Set,h=i=>i.sort((s,a)=>A[a.step]-A[s.step]||D[a.priority||"normal"]-D[s.priority||"normal"]),d=i=>{let s=!1,a=m=>{let g=C(m.name,m.aliases);if(g.includes(i)){s=!0;for(let n of g)o.delete(n);return!1}return!0};return t=t.filter(a),e=e.filter(a),s},f=i=>{let s=!1,a=m=>{if(m.middleware===i){s=!0;for(let g of C(m.name,m.aliases))o.delete(g);return!1}return!0};return t=t.filter(a),e=e.filter(a),s},u=i=>(t.forEach(s=>{i.add(s.middleware,{...s})}),e.forEach(s=>{i.addRelativeTo(s.middleware,{...s})}),i.identifyOnResolve?.(x.identifyOnResolve()),i),l=i=>{let s=[];return i.before.forEach(a=>{a.before.length===0&&a.after.length===0?s.push(a):s.push(...l(a))}),s.push(i),i.after.reverse().forEach(a=>{a.before.length===0&&a.after.length===0?s.push(a):s.push(...l(a))}),s},v=(i=!1)=>{let s=[],a=[],m={};return t.forEach(n=>{let c={...n,before:[],after:[]};for(let p of C(c.name,c.aliases))m[p]=c;s.push(c)}),e.forEach(n=>{let c={...n,before:[],after:[]};for(let p of C(c.name,c.aliases))m[p]=c;a.push(c)}),a.forEach(n=>{if(n.toMiddleware){let c=m[n.toMiddleware];if(c===void 0){if(i)return;throw new Error(`${n.toMiddleware} is not found when adding ${S(n.name,n.aliases)} middleware ${n.relation} ${n.toMiddleware}`)}n.relation==="after"&&c.after.push(n),n.relation==="before"&&c.before.push(n)}}),h(s).map(l).reduce((n,c)=>(n.push(...c),n),[])},x={add:(i,s={})=>{let{name:a,override:m,aliases:g}=s,n={step:"initialize",priority:"normal",middleware:i,...s},c=C(a,g);if(c.length>0){if(c.some(p=>o.has(p))){if(!m)throw new Error(`Duplicate middleware name '${S(a,g)}'`);for(let p of c){let w=t.findIndex(k=>k.name===p||k.aliases?.some($=>$===p));if(w===-1)continue;let y=t[w];if(y.step!==n.step||n.priority!==y.priority)throw new Error(`"${S(y.name,y.aliases)}" middleware with ${y.priority} priority in ${y.step} step cannot be overridden by "${S(a,g)}" middleware with ${n.priority} priority in ${n.step} step.`);t.splice(w,1)}}for(let p of c)o.add(p)}t.push(n)},addRelativeTo:(i,s)=>{let{name:a,override:m,aliases:g}=s,n={middleware:i,...s},c=C(a,g);if(c.length>0){if(c.some(p=>o.has(p))){if(!m)throw new Error(`Duplicate middleware name '${S(a,g)}'`);for(let p of c){let w=e.findIndex(k=>k.name===p||k.aliases?.some($=>$===p));if(w===-1)continue;let y=e[w];if(y.toMiddleware!==n.toMiddleware||y.relation!==n.relation)throw new Error(`"${S(y.name,y.aliases)}" middleware ${y.relation} "${y.toMiddleware}" middleware cannot be overridden by "${S(a,g)}" middleware ${n.relation} "${n.toMiddleware}" middleware.`);e.splice(w,1)}}for(let p of c)o.add(p)}e.push(n)},clone:()=>u(_()),use:i=>{i.applyToStack(x)},remove:i=>typeof i=="string"?d(i):f(i),removeByTag:i=>{let s=!1,a=m=>{let{tags:g,name:n,aliases:c}=m;if(g&&g.includes(i)){let p=C(n,c);for(let w of p)o.delete(w);return s=!0,!1}return!0};return t=t.filter(a),e=e.filter(a),s},concat:i=>{let s=u(_());return s.use(i),s.identifyOnResolve(r||s.identifyOnResolve()||(i.identifyOnResolve?.()??!1)),s},applyToStack:u,identify:()=>v(!0).map(i=>{let s=i.step??i.relation+" "+i.toMiddleware;return S(i.name,i.aliases)+" - "+s}),identifyOnResolve(i){return typeof i=="boolean"&&(r=i),r},resolve:(i,s)=>{for(let a of v().map(m=>m.middleware).reverse())i=a(i,s);return r&&console.log(x.identify()),i}};return x},A={initialize:5,serialize:4,build:3,finalizeRequest:2,deserialize:1},D={high:3,normal:2,low:1};var T=class{config;middlewareStack=_();initConfig;handlers;constructor(e){this.config=e;let{protocol:r,protocolSettings:o}=e;o&&typeof r=="function"&&(e.protocol=new r(o))}send(e,r,o){let h=typeof r!="function"?r:void 0,d=typeof r=="function"?r:o,f=h===void 0&&this.config.cacheMiddleware===!0,u;if(f){this.handlers||(this.handlers=new WeakMap);let l=this.handlers;l.has(e.constructor)?u=l.get(e.constructor):(u=e.resolveMiddleware(this.middlewareStack,this.config,h),l.set(e.constructor,u))}else delete this.handlers,u=e.resolveMiddleware(this.middlewareStack,this.config,h);if(d)u(e).then(l=>d(null,l.output),l=>d(l)).catch(()=>{});else return u(e).then(l=>l.output)}destroy(){this.config?.requestHandler?.destroy?.(),delete this.handlers}};var E;(function(t){t.MD5="md5",t.CRC32="crc32",t.CRC32C="crc32c",t.SHA1="sha1",t.SHA256="sha256"})(E||(E={}));var M="__smithy_context";var Y=t=>t[M]||(t[M]={});var q=t=>{if(typeof t=="function")return t;let e=Promise.resolve(t);return()=>e};var K=(t,e,r)=>{for(let[d,f]of Object.entries(t)){let u=async function(v,x,i){let s=new f(v);if(typeof x=="function")this.send(s,x);else if(typeof i=="function"){if(typeof x!="object")throw new Error(`Expected http options but got ${typeof x}`);this.send(s,x||{},i)}else return this.send(s,x)},l=(d[0].toLowerCase()+d.slice(1)).replace(/Command$/,"");e.prototype[l]=u}let{paginators:o={},waiters:h={}}=r??{};for(let[d,f]of Object.entries(o))e.prototype[d]===void 0&&(e.prototype[d]=function(u={},l,...v){return f({...l,client:this},u,...v)});for(let[d,f]of Object.entries(h))e.prototype[d]===void 0&&(e.prototype[d]=async function(u={},l,...v){let x=l;return typeof l=="number"&&(x={maxWaitTime:l}),f({...x,client:this},u,...v)})};var b=class t extends Error{$fault;$response;$retryable;$metadata;constructor(e){super(e.message),Object.setPrototypeOf(this,Object.getPrototypeOf(this).constructor.prototype),this.name=e.name,this.$fault=e.$fault,this.$metadata=e.$metadata}static isInstance(e){if(!e)return!1;let r=e;return t.prototype.isPrototypeOf(r)||!!r.$fault&&!!r.$metadata&&(r.$fault==="client"||r.$fault==="server")}static[Symbol.hasInstance](e){if(!e)return!1;let r=e;return this===t?t.isInstance(e):t.isInstance(e)?r.name&&this.name?this.prototype.isPrototypeOf(e)||r.name===this.name:this.prototype.isPrototypeOf(e):!1}},U=(t,e={})=>{Object.entries(e).filter(([,o])=>o!==void 0).forEach(([o,h])=>{(t[o]==null||t[o]==="")&&(t[o]=h)});let r=t.message||t.Message||"UnknownError";return t.message=r,delete t.Message,t};var X=t=>{switch(t){case"standard":return{retryMode:"standard",connectionTimeout:3100};case"in-region":return{retryMode:"standard",connectionTimeout:1100};case"cross-region":return{retryMode:"standard",connectionTimeout:3100};case"mobile":return{retryMode:"standard",connectionTimeout:3e4};default:return{}}};var L=!1,G=t=>{t&&!L&&parseInt(t.substring(1,t.indexOf(".")))<16&&(L=!0)};var P=Object.values(E),W=t=>{let e=[];for(let r in E){let o=E[r];t[o]!==void 0&&e.push({algorithmId:()=>o,checksumConstructor:()=>t[o]})}for(let[r,o]of Object.entries(t.checksumAlgorithms??{}))e.push({algorithmId:()=>r,checksumConstructor:()=>o});return{addChecksumAlgorithm(r){t.checksumAlgorithms=t.checksumAlgorithms??{};let o=r.algorithmId(),h=r.checksumConstructor();P.includes(o)?t.checksumAlgorithms[o.toUpperCase()]=h:t.checksumAlgorithms[o]=h,e.push(r)},checksumAlgorithms(){return e}}},H=t=>{let e={};return t.checksumAlgorithms().forEach(r=>{let o=r.algorithmId();P.includes(o)&&(e[o]=r.checksumConstructor())}),e};var V=t=>({setRetryStrategy(e){t.retryStrategy=e},retryStrategy(){return t.retryStrategy}}),j=t=>{let e={};return e.retryStrategy=t.retryStrategy(),e};var J=t=>Object.assign(W(t),V(t));var Q=t=>Object.assign(H(t),j(t));var B=t=>{let e="#text";for(let r in t)t.hasOwnProperty(r)&&t[r][e]!==void 0?t[r]=t[r][e]:typeof t[r]=="object"&&t[r]!==null&&(t[r]=B(t[r]));return t};var N=class{trace(){}debug(){}info(){}warn(){}error(){}};var O="***SensitiveInformation***";function R(t,e){if(e==null)return e;let r=F.of(t);if(r.getMergedTraits().sensitive)return O;if(r.isListSchema()){if(!!r.getValueSchema().getMergedTraits().sensitive)return O}else if(r.isMapSchema()){if(!!r.getKeySchema().getMergedTraits().sensitive||!!r.getValueSchema().getMergedTraits().sensitive)return O}else if(r.isStructSchema()&&typeof e=="object"){let o=e,h={};for(let[d,f]of r.structIterator())o[d]!=null&&(h[d]=R(f,o[d]));return h}return e}var I=class{middlewareStack=_();schema;static classBuilder(){return new z}resolveMiddlewareWithContext(e,r,o,{middlewareFn:h,clientName:d,commandName:f,inputFilterSensitiveLog:u,outputFilterSensitiveLog:l,smithyContext:v,additionalContext:x,CommandCtor:i}){for(let c of h.bind(this)(i,e,r,o))this.middlewareStack.use(c);let s=e.concat(this.middlewareStack),{logger:a}=r,m={logger:a,clientName:d,commandName:f,inputFilterSensitiveLog:u,outputFilterSensitiveLog:l,[M]:{commandInstance:this,...v},...x},{requestHandler:g}=r,n=o??{};return v.eventStream&&(n={isEventStream:!0,...n}),s.resolve(c=>g.handle(c.request,n),m)}},z=class{_init=()=>{};_ep={};_middlewareFn=()=>[];_commandName="";_clientName="";_additionalContext={};_smithyContext={};_inputFilterSensitiveLog=void 0;_outputFilterSensitiveLog=void 0;_serializer=null;_deserializer=null;_operationSchema;init(e){this._init=e}ep(e){return this._ep=e,this}m(e){return this._middlewareFn=e,this}s(e,r,o={}){return this._smithyContext={service:e,operation:r,...o},this}c(e={}){return this._additionalContext=e,this}n(e,r){return this._clientName=e,this._commandName=r,this}f(e=o=>o,r=o=>o){return this._inputFilterSensitiveLog=e,this._outputFilterSensitiveLog=r,this}ser(e){return this._serializer=e,this}de(e){return this._deserializer=e,this}sc(e){return this._operationSchema=e,this._smithyContext.operationSchema=e,this}build(){let e=this,r;return r=class extends I{input;static getEndpointParameterInstructions(){return e._ep}constructor(...[o]){super(),this.input=o??{},e._init(this),this.schema=e._operationSchema}resolveMiddleware(o,h,d){let f=e._operationSchema,u=f?.[4]??f?.input,l=f?.[5]??f?.output;return this.resolveMiddlewareWithContext(o,h,d,{CommandCtor:r,middlewareFn:e._middlewareFn,clientName:e._clientName,commandName:e._commandName,inputFilterSensitiveLog:e._inputFilterSensitiveLog??(f?R.bind(null,u):v=>v),outputFilterSensitiveLog:e._outputFilterSensitiveLog??(f?R.bind(null,l):v=>v),smithyContext:e._smithyContext,additionalContext:e._additionalContext})}serialize=e._serializer;deserialize=e._deserializer}}};export{E as a,M as b,_ as c,Y as d,q as e,T as f,I as g,K as h,b as i,U as j,X as k,G as l,J as m,Q as n,B as o,N as p};
@@ -0,0 +1 @@
1
+ import{A as se,a as G,f as B,g as K,h as Z,i as X,j as Y,k as _,l as j,m as ee,q as A,r as te,s as I,u as k,x as P,y as re}from"./chunk-W5TBFCWY.js";var R=class i{namespace;schemas;exceptions;static registries=new Map;constructor(e,t=new Map,r=new Map){this.namespace=e,this.schemas=t,this.exceptions=r}static for(e){return i.registries.has(e)||i.registries.set(e,new i(e)),i.registries.get(e)}copyFrom(e){let{schemas:t,exceptions:r}=this;for(let[s,o]of e.schemas)t.has(s)||t.set(s,o);for(let[s,o]of e.exceptions)r.has(s)||r.set(s,o)}register(e,t){let r=this.normalizeShapeId(e);for(let s of[this,i.for(r.split("#")[0])])s.schemas.set(r,t)}getSchema(e){let t=this.normalizeShapeId(e);if(!this.schemas.has(t)){if(!e.includes("#")){let r="#"+e,s=[];for(let[o,a]of this.schemas.entries())o.endsWith(r)&&s.push(a);if(s.length===1)return s[0]}throw new Error(`@smithy/core/schema - schema not found for ${t}`)}return this.schemas.get(t)}registerError(e,t){let r=e,s=r[1];for(let o of[this,i.for(s)])o.schemas.set(s+"#"+r[2],r),o.exceptions.set(r,t)}getErrorCtor(e){let t=e;return this.exceptions.has(t)?this.exceptions.get(t):i.for(t[1]).exceptions.get(t)}getBaseException(){for(let e of this.exceptions.keys())if(Array.isArray(e)){let[,t,r]=e,s=t+"#"+r;if(s.startsWith("smithy.ts.sdk.synthetic.")&&s.endsWith("ServiceException"))return e}}find(e){for(let t of this.schemas.values())if(e(t))return t}clear(){this.schemas.clear(),this.exceptions.clear()}normalizeShapeId(e){return e.includes("#")?e:this.namespace+"#"+e}};function Q(i){return encodeURIComponent(i).replace(/[!'()*]/g,function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})}var O=i=>typeof i=="function"?i():i;var q=[];function C(i){if(typeof i=="object")return i;if(i=i|0,q[i])return q[i];let e={},t=0;for(let r of["httpLabel","idempotent","idempotencyToken","sensitive","httpPayload","httpResponseCode","httpQueryParams"])(i>>t++&1)===1&&(e[r]=1);return q[i]=e}var E={it:Symbol.for("@smithy/nor-struct-it"),ns:Symbol.for("@smithy/ns")},V=[],F={},l=class i{ref;memberName;static symbol=Symbol.for("@smithy/nor");symbol=i.symbol;name;schema;_isMemberSchema;traits;memberTraits;normalizedTraits;constructor(e,t){this.ref=e,this.memberName=t;let r=[],s=e,o=e;for(this._isMemberSchema=!1;J(s);)r.push(s[1]),s=s[0],o=O(s),this._isMemberSchema=!0;if(r.length>0){this.memberTraits={};for(let a=r.length-1;a>=0;--a){let h=r[a];Object.assign(this.memberTraits,C(h))}}else this.memberTraits=0;if(o instanceof i){let a=this.memberTraits;Object.assign(this,o),this.memberTraits=Object.assign({},a,o.getMemberTraits(),this.getMemberTraits()),this.normalizedTraits=void 0,this.memberName=t??o.memberName;return}if(this.schema=O(o),le(this.schema)?(this.name=`${this.schema[1]}#${this.schema[2]}`,this.traits=this.schema[3]):(this.name=this.memberName??String(o),this.traits=0),this._isMemberSchema&&!t)throw new Error(`@smithy/core/schema - NormalizedSchema member init ${this.getName(!0)} missing member name.`)}static[Symbol.hasInstance](e){let t=this.prototype.isPrototypeOf(e);return!t&&typeof e=="object"&&e!==null?e.symbol===this.symbol:t}static of(e){let t=typeof e=="function"||typeof e=="object"&&e!==null;if(typeof e=="number"){if(V[e])return V[e]}else if(typeof e=="string"){if(F[e])return F[e]}else if(t&&e[E.ns])return e[E.ns];let r=O(e);if(r instanceof i)return r;if(J(r)){let[o,a]=r;if(o instanceof i)return Object.assign(o.getMergedTraits(),C(a)),o;throw new Error(`@smithy/core/schema - may not init unwrapped member schema=${JSON.stringify(e,null,2)}.`)}let s=new i(r);return t?e[E.ns]=s:typeof r=="string"?F[r]=s:typeof r=="number"?V[r]=s:s}getSchema(){let e=this.schema;return Array.isArray(e)&&e[0]===0?e[4]:e}getName(e=!1){let{name:t}=this;return!e&&t&&t.includes("#")?t.split("#")[1]:t||void 0}getMemberName(){return this.memberName}isMemberSchema(){return this._isMemberSchema}isListSchema(){let e=this.getSchema();return typeof e=="number"?e>=64&&e<128:e[0]===1}isMapSchema(){let e=this.getSchema();return typeof e=="number"?e>=128&&e<=255:e[0]===2}isStructSchema(){let e=this.getSchema();if(typeof e!="object")return!1;let t=e[0];return t===3||t===-3||t===4}isUnionSchema(){let e=this.getSchema();return typeof e!="object"?!1:e[0]===4}isBlobSchema(){let e=this.getSchema();return e===21||e===42}isTimestampSchema(){let e=this.getSchema();return typeof e=="number"&&e>=4&&e<=7}isUnitSchema(){return this.getSchema()==="unit"}isDocumentSchema(){return this.getSchema()===15}isStringSchema(){return this.getSchema()===0}isBooleanSchema(){return this.getSchema()===2}isNumericSchema(){return this.getSchema()===1}isBigIntegerSchema(){return this.getSchema()===17}isBigDecimalSchema(){return this.getSchema()===19}isStreaming(){let{streaming:e}=this.getMergedTraits();return!!e||this.getSchema()===42}isIdempotencyToken(){return!!this.getMergedTraits().idempotencyToken}getMergedTraits(){return this.normalizedTraits??(this.normalizedTraits={...this.getOwnTraits(),...this.getMemberTraits()})}getMemberTraits(){return C(this.memberTraits)}getOwnTraits(){return C(this.traits)}getKeySchema(){let[e,t]=[this.isDocumentSchema(),this.isMapSchema()];if(!e&&!t)throw new Error(`@smithy/core/schema - cannot get key for non-map: ${this.getName(!0)}`);let r=this.getSchema(),s=e?15:r[4]??0;return H([s,0],"key")}getValueSchema(){let e=this.getSchema(),[t,r,s]=[this.isDocumentSchema(),this.isMapSchema(),this.isListSchema()],o=typeof e=="number"?63&e:e&&typeof e=="object"&&(r||s)?e[3+e[0]]:t?15:void 0;if(o!=null)return H([o,0],r?"value":"member");throw new Error(`@smithy/core/schema - ${this.getName(!0)} has no value member.`)}getMemberSchema(e){let t=this.getSchema();if(this.isStructSchema()&&t[4].includes(e)){let r=t[4].indexOf(e),s=t[5][r];return H(J(s)?s:[s,0],e)}if(this.isDocumentSchema())return H([15,0],e);throw new Error(`@smithy/core/schema - ${this.getName(!0)} has no member=${e}.`)}getMemberSchemas(){let e={};try{for(let[t,r]of this.structIterator())e[t]=r}catch{}return e}getEventStreamMember(){if(this.isStructSchema()){for(let[e,t]of this.structIterator())if(t.isStreaming()&&t.isStructSchema())return e}return""}*structIterator(){if(this.isUnitSchema())return;if(!this.isStructSchema())throw new Error("@smithy/core/schema - cannot iterate non-struct schema.");let e=this.getSchema(),t=e[4].length,r=e[E.it];if(r&&t===r.length){yield*r;return}r=Array(t);for(let s=0;s<t;++s){let o=e[4][s],a=H([e[5][s],0],o);yield r[s]=[o,a]}e[E.it]=r}};function H(i,e){if(i instanceof l)return Object.assign(i,{memberName:e,_isMemberSchema:!0});let t=l;return new t(i,e)}var J=i=>Array.isArray(i)&&i.length===2,le=i=>Array.isArray(i)&&i.length>=5;var T=class{serdeContext;setSerdeContext(e){this.serdeContext=e}};var x=class i{method;protocol;hostname;port;path;query;headers;username;password;fragment;body;constructor(e){this.method=e.method||"GET",this.hostname=e.hostname||"localhost",this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?e.protocol.slice(-1)!==":"?`${e.protocol}:`:e.protocol:"https:",this.path=e.path?e.path.charAt(0)!=="/"?`/${e.path}`:e.path:"/",this.username=e.username,this.password=e.password,this.fragment=e.fragment}static clone(e){let t=new i({...e,headers:{...e.headers}});return t.query&&(t.query=ue(t.query)),t}static isInstance(e){if(!e)return!1;let t=e;return"method"in t&&"protocol"in t&&"hostname"in t&&"path"in t&&typeof t.query=="object"&&typeof t.headers=="object"}clone(){return i.clone(this)}};function ue(i){return Object.keys(i).reduce((e,t)=>{let r=i[t];return{...e,[t]:Array.isArray(r)?[...r]:r}},{})}var v=class{statusCode;reason;headers;body;constructor(e){this.statusCode=e.statusCode,this.reason=e.reason,this.headers=e.headers||{},this.body=e.body}static isInstance(e){if(!e)return!1;let t=e;return typeof t.statusCode=="number"&&typeof t.headers=="object"}};var M=class extends T{options;compositeErrorRegistry;constructor(e){super(),this.options=e,this.compositeErrorRegistry=R.for(e.defaultNamespace);for(let t of e.errorTypeRegistries??[])this.compositeErrorRegistry.copyFrom(t)}getRequestType(){return x}getResponseType(){return v}setSerdeContext(e){this.serdeContext=e,this.serializer.setSerdeContext(e),this.deserializer.setSerdeContext(e),this.getPayloadCodec()&&this.getPayloadCodec().setSerdeContext(e)}updateServiceEndpoint(e,t){if("url"in t){e.protocol=t.url.protocol,e.hostname=t.url.hostname,e.port=t.url.port?Number(t.url.port):void 0,e.path=t.url.pathname,e.fragment=t.url.hash||void 0,e.username=t.url.username||void 0,e.password=t.url.password||void 0,e.query||(e.query={});for(let[r,s]of t.url.searchParams.entries())e.query[r]=s;if(t.headers)for(let r in t.headers)e.headers[r]=t.headers[r].join(", ");return e}else{if(e.protocol=t.protocol,e.hostname=t.hostname,e.port=t.port?Number(t.port):void 0,e.path=t.path,e.query={...t.query},t.headers)for(let r in t.headers)e.headers[r]=t.headers[r];return e}}setHostPrefix(e,t,r){if(this.serdeContext?.disableHostPrefix)return;let s=l.of(t.input),o=C(t.traits??{});if(o.endpoint){let a=o.endpoint?.[0];if(typeof a=="string"){for(let[h,n]of s.structIterator()){if(!n.getMergedTraits().hostLabel)continue;let f=r[h];if(typeof f!="string")throw new Error(`@smithy/core/schema - ${h} in input must be a string as hostLabel.`);a=a.replace(`{${h}}`,f)}e.hostname=a+e.hostname}}}deserializeMetadata(e){return{httpStatusCode:e.statusCode,requestId:e.headers["x-amzn-requestid"]??e.headers["x-amzn-request-id"]??e.headers["x-amz-request-id"],extendedRequestId:e.headers["x-amz-id-2"],cfId:e.headers["x-amz-cf-id"]}}async serializeEventStream({eventStream:e,requestSchema:t,initialRequest:r}){return(await this.loadEventStreamCapability()).serializeEventStream({eventStream:e,requestSchema:t,initialRequest:r})}async deserializeEventStream({response:e,responseSchema:t,initialResponseContainer:r}){return(await this.loadEventStreamCapability()).deserializeEventStream({response:e,responseSchema:t,initialResponseContainer:r})}async loadEventStreamCapability(){let{EventStreamSerde:e}=await import("./event-streams-SGW54BDO.js");return new e({marshaller:this.getEventStreamMarshaller(),serializer:this.serializer,deserializer:this.deserializer,serdeContext:this.serdeContext,defaultContentType:this.getDefaultContentType()})}getDefaultContentType(){throw new Error(`@smithy/core/protocols - ${this.constructor.name} getDefaultContentType() implementation missing.`)}async deserializeHttpMessage(e,t,r,s,o){return[]}getEventStreamMarshaller(){let e=this.serdeContext;if(!e.eventStreamMarshaller)throw new Error("@smithy/core - HttpProtocol: eventStreamMarshaller missing in serdeContext.");return e.eventStreamMarshaller}};var ie=class extends M{async serializeRequest(e,t,r){let s=t&&typeof t=="object"?t:{},o=this.serializer,a={},h={},n=await r.endpoint(),f=l.of(e?.input),b=[],u=[],p=!1,g,m=new x({protocol:"",hostname:"",port:void 0,path:"",fragment:void 0,query:a,headers:h,body:void 0});if(n){this.updateServiceEndpoint(m,n),this.setHostPrefix(m,e,s);let c=C(e.traits);if(c.http){m.method=c.http[0];let[d,S]=c.http[1].split("?");m.path=="/"?m.path=d:m.path+=d;let y=new URLSearchParams(S??"");for(let[w,N]of y)a[w]=N}}for(let[c,d]of f.structIterator()){let S=d.getMergedTraits()??{},y=s[c];if(y==null&&!d.isIdempotencyToken()){if(S.httpLabel&&(m.path.includes(`{${c}+}`)||m.path.includes(`{${c}}`)))throw new Error(`No value provided for input HTTP label: ${c}.`);continue}if(S.httpPayload)d.isStreaming()?d.isStructSchema()?s[c]&&(g=await this.serializeEventStream({eventStream:s[c],requestSchema:f})):g=y:(o.write(d,y),g=o.flush());else if(S.httpLabel){o.write(d,y);let w=o.flush();m.path.includes(`{${c}+}`)?m.path=m.path.replace(`{${c}+}`,w.split("/").map(Q).join("/")):m.path.includes(`{${c}}`)&&(m.path=m.path.replace(`{${c}}`,Q(w)))}else if(S.httpHeader)o.write(d,y),h[S.httpHeader.toLowerCase()]=String(o.flush());else if(typeof S.httpPrefixHeaders=="string")for(let w in y){let N=y[w],W=S.httpPrefixHeaders+w;o.write([d.getValueSchema(),{httpHeader:W}],N),h[W.toLowerCase()]=o.flush()}else S.httpQuery||S.httpQueryParams?this.serializeQuery(d,y,a):(p=!0,b.push(c),u.push(d))}if(p&&s){let[c,d]=(f.getName(!0)??"#Unknown").split("#"),S=f.getSchema()[6],y=[3,c,d,f.getMergedTraits(),b,u,void 0];S?y[6]=S:y.pop(),o.write(y,s),g=o.flush()}return m.headers=h,m.query=a,m.body=g,m}serializeQuery(e,t,r){let s=this.serializer,o=e.getMergedTraits();if(o.httpQueryParams){for(let a in t)if(!(a in r)){let h=t[a],n=e.getValueSchema();Object.assign(n.getMergedTraits(),{...o,httpQuery:a,httpQueryParams:void 0}),this.serializeQuery(n,h,r)}return}if(e.isListSchema()){let a=!!e.getMergedTraits().sparse,h=[];for(let n of t){s.write([e.getValueSchema(),o],n);let f=s.flush();(a||f!==void 0)&&h.push(f)}r[o.httpQuery]=h}else s.write([e,o],t),r[o.httpQuery]=s.flush()}async deserializeResponse(e,t,r){let s=this.deserializer,o=l.of(e.output),a={};if(r.statusCode>=300){let n=await z(r.body,t);throw n.byteLength>0&&Object.assign(a,await s.read(15,n)),await this.handleError(e,t,r,a,this.deserializeMetadata(r)),new Error("@smithy/core/protocols - HTTP Protocol error handler failed to throw.")}for(let n in r.headers){let f=r.headers[n];delete r.headers[n],r.headers[n.toLowerCase()]=f}let h=await this.deserializeHttpMessage(o,t,r,a);if(h.length){let n=await z(r.body,t);if(n.byteLength>0){let f=await s.read(o,n);for(let b of h)f[b]!=null&&(a[b]=f[b])}}else h.discardResponseBody&&await z(r.body,t);return a.$metadata=this.deserializeMetadata(r),a}async deserializeHttpMessage(e,t,r,s,o){let a;s instanceof Set?a=o:a=s;let h=!0,n=this.deserializer,f=l.of(e),b=[];for(let[u,p]of f.structIterator()){let g=p.getMemberTraits();if(g.httpPayload){if(h=!1,p.isStreaming())p.isStructSchema()?a[u]=await this.deserializeEventStream({response:r,responseSchema:f}):a[u]=re(r.body);else if(r.body){let c=await z(r.body,t);c.byteLength>0&&(a[u]=await n.read(p,c))}}else if(g.httpHeader){let m=String(g.httpHeader).toLowerCase(),c=r.headers[m];if(c!=null)if(p.isListSchema()){let d=p.getValueSchema();d.getMergedTraits().httpHeader=m;let S;d.isTimestampSchema()&&d.getSchema()===4?S=_(c,",",2):S=j(c);let y=[];for(let w of S)y.push(await n.read(d,w.trim()));a[u]=y}else a[u]=await n.read(p,c)}else if(g.httpPrefixHeaders!==void 0){a[u]={};for(let m in r.headers)if(m.startsWith(g.httpPrefixHeaders)){let c=r.headers[m],d=p.getValueSchema();d.getMergedTraits().httpHeader=m,a[u][m.slice(g.httpPrefixHeaders.length)]=await n.read(d,c)}}else g.httpResponseCode?a[u]=r.statusCode:b.push(u)}return b.discardResponseBody=h,b}};var oe=class extends M{async serializeRequest(e,t,r){let s=this.serializer,o={},a={},h=await r.endpoint(),n=l.of(e?.input),f=n.getSchema(),b,u=t&&typeof t=="object"?t:{},p=new x({protocol:"",hostname:"",port:void 0,path:"/",fragment:void 0,query:o,headers:a,body:void 0});if(h&&(this.updateServiceEndpoint(p,h),this.setHostPrefix(p,e,u)),u){let g=n.getEventStreamMember();if(g){if(u[g]){let m={};for(let[c,d]of n.structIterator())c!==g&&u[c]&&(s.write(d,u[c]),m[c]=s.flush());b=await this.serializeEventStream({eventStream:u[g],requestSchema:n,initialRequest:m})}}else s.write(f,u),b=s.flush()}return p.headers=Object.assign(p.headers,a),p.query=o,p.body=b,p.method="POST",p}async deserializeResponse(e,t,r){let s=this.deserializer,o=l.of(e.output),a={};if(r.statusCode>=300){let n=await z(r.body,t);throw n.byteLength>0&&Object.assign(a,await s.read(15,n)),await this.handleError(e,t,r,a,this.deserializeMetadata(r)),new Error("@smithy/core/protocols - RPC Protocol error handler failed to throw.")}for(let n in r.headers){let f=r.headers[n];delete r.headers[n],r.headers[n.toLowerCase()]=f}let h=o.getEventStreamMember();if(h)a[h]=await this.deserializeEventStream({response:r,responseSchema:o,initialResponseContainer:a});else{let n=await z(r.body,t);n.byteLength>0&&Object.assign(a,await s.read(o,n))}return a.$metadata=this.deserializeMetadata(r),a}};function $(i,e){if(e.timestampFormat.useTrait&&i.isTimestampSchema()&&(i.getSchema()===5||i.getSchema()===6||i.getSchema()===7))return i.getSchema();let{httpLabel:t,httpPrefixHeaders:r,httpHeader:s,httpQuery:o}=i.getMergedTraits();return(e.httpBindings?typeof r=="string"||s?6:o||t?5:void 0:void 0)??e.timestampFormat.default}var D=class extends T{settings;constructor(e){super(),this.settings=e}read(e,t){let r=l.of(e);if(r.isListSchema())return j(t).map(s=>this.read(r.getValueSchema(),s));if(r.isBlobSchema())return(this.serdeContext?.base64Decoder??A)(t);if(r.isTimestampSchema())switch($(r,this.settings)){case 5:return X(t);case 6:return Y(t);case 7:return Z(t);default:return console.warn("Missing timestamp format, parsing value with Date constructor:",t),new Date(t)}if(r.isStringSchema()){let s=r.getMergedTraits().mediaType,o=t;if(s)return r.getMergedTraits().httpHeader&&(o=this.base64ToUtf8(o)),(s==="application/json"||s.endsWith("+json"))&&(o=B.from(o)),o}return r.isNumericSchema()?Number(t):r.isBigIntegerSchema()?BigInt(t):r.isBigDecimalSchema()?new ee(t,"bigDecimal"):r.isBooleanSchema()?String(t).toLowerCase()==="true":t}base64ToUtf8(e){return(this.serdeContext?.utf8Encoder??k)((this.serdeContext?.base64Decoder??A)(e))}};var ae=class extends T{codecDeserializer;stringDeserializer;constructor(e,t){super(),this.codecDeserializer=e,this.stringDeserializer=new D(t)}setSerdeContext(e){this.stringDeserializer.setSerdeContext(e),this.codecDeserializer.setSerdeContext(e),this.serdeContext=e}read(e,t){let r=l.of(e),s=r.getMergedTraits(),o=this.serdeContext?.utf8Encoder??k;if(s.httpHeader||s.httpResponseCode)return this.stringDeserializer.read(r,o(t));if(s.httpPayload){if(r.isBlobSchema()){let a=this.serdeContext?.utf8Decoder??te;return typeof t=="string"?a(t):t}else if(r.isStringSchema())return"byteLength"in t?o(t):t}return this.codecDeserializer.read(r,t)}};var U=class extends T{settings;stringBuffer="";constructor(e){super(),this.settings=e}write(e,t){let r=l.of(e);switch(typeof t){case"object":if(t===null){this.stringBuffer="null";return}if(r.isTimestampSchema()){if(!(t instanceof Date))throw new Error(`@smithy/core/protocols - received non-Date value ${t} when schema expected Date in ${r.getName(!0)}`);switch($(r,this.settings)){case 5:this.stringBuffer=t.toISOString().replace(".000Z","Z");break;case 6:this.stringBuffer=G(t);break;case 7:this.stringBuffer=String(t.getTime()/1e3);break;default:console.warn("Missing timestamp format, using epoch seconds",t),this.stringBuffer=String(t.getTime()/1e3)}return}if(r.isBlobSchema()&&"byteLength"in t){this.stringBuffer=(this.serdeContext?.base64Encoder??I)(t);return}if(r.isListSchema()&&Array.isArray(t)){let a="";for(let h of t){this.write([r.getValueSchema(),r.getMergedTraits()],h);let n=this.flush(),f=r.getValueSchema().isTimestampSchema()?n:K(n);a!==""&&(a+=", "),a+=f}this.stringBuffer=a;return}this.stringBuffer=JSON.stringify(t,null,2);break;case"string":let s=r.getMergedTraits().mediaType,o=t;if(s&&((s==="application/json"||s.endsWith("+json"))&&(o=B.from(o)),r.getMergedTraits().httpHeader)){this.stringBuffer=(this.serdeContext?.base64Encoder??I)(o.toString());return}this.stringBuffer=t;break;default:r.isIdempotencyToken()?this.stringBuffer=se():this.stringBuffer=String(t)}}flush(){let e=this.stringBuffer;return this.stringBuffer="",e}};var ne=class{codecSerializer;stringSerializer;buffer;constructor(e,t,r=new U(t)){this.codecSerializer=e,this.stringSerializer=r}setSerdeContext(e){this.codecSerializer.setSerdeContext(e),this.stringSerializer.setSerdeContext(e)}write(e,t){let r=l.of(e),s=r.getMergedTraits();if(s.httpHeader||s.httpLabel||s.httpQuery){this.stringSerializer.write(r,t),this.buffer=this.stringSerializer.flush();return}return this.codecSerializer.write(r,t)}flush(){if(this.buffer!==void 0){let e=this.buffer;return this.buffer=void 0,e}return this.codecSerializer.flush()}};var pe=i=>({setHttpHandler(e){i.httpHandler=e},httpHandler(){return i.httpHandler},updateHttpClientConfig(e,t){i.httpHandler?.updateHttpClientConfig(e,t)},httpHandlerConfigs(){return i.httpHandler.httpHandlerConfigs()}}),ge=i=>({httpHandler:i.httpHandler()});var ce="content-length";function he(i){return e=>async t=>{let r=t.request;if(x.isInstance(r)){let{body:s,headers:o}=r;if(s&&Object.keys(o).map(a=>a.toLowerCase()).indexOf(ce)===-1)try{let a=i(s);r.headers={...r.headers,[ce]:String(a)}}catch{}}return e({...t,request:r})}}var me={step:"build",tags:["SET_CONTENT_LENGTH","CONTENT_LENGTH"],name:"contentLengthMiddleware",override:!0},Se=i=>({applyToStack:e=>{e.add(he(i.bodyLengthChecker),me)}});var L=i=>encodeURIComponent(i).replace(/[!'()*]/g,ye),ye=i=>`%${i.charCodeAt(0).toString(16).toUpperCase()}`;function be(i){let e=[];for(let t of Object.keys(i).sort()){let r=i[t];if(t=L(t),Array.isArray(r))for(let s=0,o=r.length;s<o;s++)e.push(`${t}=${L(r[s])}`);else{let s=t;(r||typeof r=="string")&&(s+=`=${L(r)}`),e.push(s)}}return e.join("&")}function fe(i){let e={};if(i=i.replace(/^\?/,""),i)for(let t of i.split("&")){let[r,s=null]=t.split("=");r=decodeURIComponent(r),s&&(s=decodeURIComponent(s)),r in e?Array.isArray(e[r])?e[r].push(s):e[r]=[e[r],s]:e[r]=s}return e}var de=i=>{if(typeof i=="string")return de(new URL(i));let{hostname:e,pathname:t,port:r,protocol:s,search:o}=i,a;return o&&(a=fe(o)),{hostname:e,port:r?parseInt(r):void 0,protocol:s,path:t,query:a}};var z=async(i=new Uint8Array,e)=>{if(i instanceof Uint8Array)return P.mutate(i);if(!i)return P.mutate(new Uint8Array);let t=e.streamCollector(i);return P.mutate(await t)};export{O as a,l as b,R as c,z as d,Q as e,x as f,v as g,ie as h,oe as i,$ as j,D as k,ae as l,ne as m,pe as n,ge as o,Se as p,L as q,be as r,de as s};
@@ -0,0 +1,30 @@
1
+ import{a as co,b as po,f as ce,g as pe}from"./chunk-QSLKOXQ6.js";import{a as N}from"./chunk-ZIBRKYXP.js";import{a as _o,b as te,c as vo,d as Ao,e as Co,f as wo,h as Io,i as Po,j as me,k as Rr,l as Do,m as To,n as Oo,s as U,t as Oe,u as fe,v as J,w as Q,x as Fo,z as Go}from"./chunk-VFREGXHN.js";import{a as Ke}from"./chunk-ZCWB3HFB.js";import{a as No,b as $o,f as ko}from"./chunk-WU3IV4WF.js";import{a as bo,b as _r,c as Ko,d as re,e as be}from"./chunk-XB6R2VIU.js";import{a as Mo,b as Uo,g as Lo}from"./chunk-KRX2KWWT.js";import{a as Ie,b as de,e as yo,k as Eo,l as De,m as xr}from"./chunk-OIQB5F6Y.js";import{a as Pe,b as ue,c as le,d as k,e as M,j as Er,p as ho}from"./chunk-FNDUJLS6.js";import{a as go,b as O,c as yr,d as So,f as P,g as B,i as Ro,j as Te,s as se}from"./chunk-HGJYEXMU.js";import{A as xo,a as uo,c as lo,d as mo,e as fo,f as we,m as T,v as Sr}from"./chunk-W5TBFCWY.js";import{b as L}from"./chunk-TX7AAHER.js";import{randomUUID as bd}from"crypto";var Xa=e=>t=>async r=>{if(!P.isInstance(r.request))return t(r);let{request:o}=r,{handlerProtocol:n=""}=e.requestHandler.metadata||{};if(n.indexOf("h2")>=0&&!o.headers[":authority"])delete o.headers.host,o.headers[":authority"]=o.hostname+(o.port?":"+o.port:"");else if(!o.headers.host){let s=o.hostname;o.port!=null&&(s+=`:${o.port}`),o.headers.host=s}return t(r)},za={name:"hostHeaderMiddleware",step:"build",priority:"low",tags:["HOST"],override:!0},Ho=e=>({applyToStack:t=>{t.add(Xa(e),za)}});var Wa=()=>(e,t)=>async r=>{try{let o=await e(r),{clientName:n,commandName:s,logger:i,dynamoDbDocumentClientOptions:a={}}=t,{overrideInputFilterSensitiveLog:c,overrideOutputFilterSensitiveLog:p}=a,d=c??t.inputFilterSensitiveLog,u=p??t.outputFilterSensitiveLog,{$metadata:l,...f}=o.output;return i?.info?.({clientName:n,commandName:s,input:d(r.input),output:u(f),metadata:l}),o}catch(o){let{clientName:n,commandName:s,logger:i,dynamoDbDocumentClientOptions:a={}}=t,{overrideInputFilterSensitiveLog:c}=a,p=c??t.inputFilterSensitiveLog;throw i?.error?.({clientName:n,commandName:s,input:p(r.input),error:o,metadata:o.$metadata}),o}},Ba={name:"loggerMiddleware",tags:["LOGGER"],step:"initialize",override:!0},Vo=e=>({applyToStack:t=>{t.add(Wa(),Ba)}});var jo={step:"build",tags:["RECURSION_DETECTION"],name:"recursionDetectionMiddleware",override:!0,priority:"low"};var vr="X-Amzn-Trace-Id",Ja="AWS_LAMBDA_FUNCTION_NAME",Qa="_X_AMZN_TRACE_ID",qo=()=>e=>async t=>{let{request:r}=t;if(!P.isInstance(r))return e(t);let o=Object.keys(r.headers??{}).find(d=>d.toLowerCase()===vr.toLowerCase())??vr;if(r.headers.hasOwnProperty(o))return e(t);let n=process.env[Ja],s=process.env[Qa],c=(await _o.getInstanceAsync())?.getXRayTraceId()??s,p=d=>typeof d=="string"&&d.length>0;return p(n)&&p(c)&&(r.headers[vr]=c),e({...t,request:r})};var Xo=e=>({applyToStack:t=>{t.add(qo(),jo)}});function zo(e,t,r){e.__smithy_context?e.__smithy_context.features||(e.__smithy_context.features={}):e.__smithy_context={features:{}},e.__smithy_context.features[t]=r}var Ya=void 0;function Za(e){return e===void 0?!0:typeof e=="string"&&e.length<=50}function Wo(e){let t=te(e.userAgentAppId??Ya),{customUserAgent:r}=e;return Object.assign(e,{customUserAgent:typeof r=="string"?[[r]]:r,userAgentAppId:async()=>{let o=await t();if(!Za(o)){let n=e.logger?.constructor?.name==="NoOpLogger"||!e.logger?console:e.logger;typeof o!="string"?n?.warn("userAgentAppId must be a string or undefined."):o.length>50&&n?.warn("The provided userAgentAppId exceeds the maximum length of 50 characters.")}return o}})}var $=e=>typeof e=="string"?re(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e);var ec=/\d{12}\.ddb/;async function Bo(e,t,r){if(r.request?.headers?.["smithy-protocol"]==="rpc-v2-cbor"&&U(e,"PROTOCOL_RPC_V2_CBOR","M"),typeof t.retryStrategy=="function"){let s=await t.retryStrategy();if(typeof s.mode=="string")switch(s.mode){case me.ADAPTIVE:U(e,"RETRY_MODE_ADAPTIVE","F");break;case me.STANDARD:U(e,"RETRY_MODE_STANDARD","E");break}}if(typeof t.accountIdEndpointMode=="function"){let s=e.endpointV2;switch(String(s?.url?.hostname).match(ec)&&U(e,"ACCOUNT_ID_ENDPOINT","O"),await t.accountIdEndpointMode?.()){case"disabled":U(e,"ACCOUNT_ID_MODE_DISABLED","Q");break;case"preferred":U(e,"ACCOUNT_ID_MODE_PREFERRED","P");break;case"required":U(e,"ACCOUNT_ID_MODE_REQUIRED","R");break}}let n=e.__smithy_context?.selectedHttpAuthScheme?.identity;if(n?.$source){let s=n;s.accountId&&U(e,"RESOLVED_ACCOUNT_ID","T");for(let[i,a]of Object.entries(s.$source??{}))U(e,i,a)}}var Ar="user-agent",Ne="x-amz-user-agent";var Jo=/[^!$%&'*+\-.^_`|~\w]/g,Qo=/[^!$%&'*+\-.^_`|~\w#]/g;function Yo(e){let t="";for(let r in e){let o=e[r];if(t.length+o.length+1<=1024){t.length?t+=","+o:t+=o;continue}break}return t}var tc=e=>(t,r)=>async o=>{let{request:n}=o;if(!P.isInstance(n))return t(o);let{headers:s}=n,i=r?.userAgent?.map($e)||[],a=(await e.defaultUserAgentProvider()).map($e);await Bo(r,e,o);let c=r;a.push(`m/${Yo(Object.assign({},r.__smithy_context?.features,c.__aws_sdk_context?.features))}`);let p=e?.customUserAgent?.map($e)||[],d=await e.userAgentAppId();d&&a.push($e(["app",`${d}`]));let u=wo(),l=(u?[u]:[]).concat([...a,...i,...p]).join(" "),f=[...a.filter(R=>R.startsWith("aws-sdk-")),...p].join(" ");return e.runtime!=="browser"?(f&&(s[Ne]=s[Ne]?`${s[Ar]} ${f}`:f),s[Ar]=l):s[Ne]=l,t({...o,request:n})},$e=e=>{let t=e[0].split("/").map(i=>i.replace(Jo,"-")).join("/"),r=e[1]?.replace(Qo,"-"),o=t.indexOf("/"),n=t.substring(0,o),s=t.substring(o+1);return n==="api"&&(s=s.toLowerCase()),[n,s,r].filter(i=>i&&i.length>0).reduce((i,a,c)=>{switch(c){case 0:return a;case 1:return`${i}/${a}`;default:return`${i}#${a}`}},"")},rc={name:"getUserAgentMiddleware",step:"build",priority:"low",tags:["SET_USER_AGENT","USER_AGENT"],override:!0},tn=e=>({applyToStack:t=>{t.add(tc(e),rc)}});var oc="AWS_USE_DUALSTACK_ENDPOINT",nc="use_dualstack_endpoint";var rn={environmentVariableSelector:e=>J(e,oc,Q.ENV),configFileSelector:e=>J(e,nc,Q.CONFIG),default:!1};var sc="AWS_USE_FIPS_ENDPOINT",ic="use_fips_endpoint";var on={environmentVariableSelector:e=>J(e,sc,Q.ENV),configFileSelector:e=>J(e,ic,Q.CONFIG),default:!1};var ac="AWS_REGION",cc="region",nn={environmentVariableSelector:e=>e[ac],configFileSelector:e=>e[cc],default:()=>{throw new Error("Region is missing")}},sn={preferredFile:"credentials"};var an=new Set,cn=(e,t=De)=>{if(!an.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 new Error(`Region not accepted: region="${e}" is not a valid hostname component.`);else an.add(e)};var ke=e=>typeof e=="string"&&(e.startsWith("fips-")||e.endsWith("-fips"));var pn=e=>ke(e)?["fips-aws-global","aws-fips"].includes(e)?"us-east-1":e.replace(/fips-(dkr-|prod-)?|-fips/,""):e;var un=e=>{let{region:t,useFipsEndpoint:r}=e;if(!t)throw new Error("Region is missing");return Object.assign(e,{region:async()=>{let o=typeof t=="function"?await t():t,n=pn(o);return cn(n),n},useFipsEndpoint:async()=>{let o=typeof t=="string"?t:await t();return ke(o)?!0:typeof r!="function"?Promise.resolve(!!r):r()}})};var dn=(e,t)=>{if(!t||t.length===0)return e;let r=[];for(let o of t)for(let n of e)n.schemeId.split("#")[1]===o&&r.push(n);for(let o of e)r.find(({schemeId:n})=>n===o.schemeId)||r.push(o);return r};function pc(e){let t=new Map;for(let r of e)t.set(r.schemeId,r);return t}var ln=(e,t)=>(r,o)=>async n=>{let s=e.httpAuthSchemeProvider(await t.httpAuthSchemeParametersProvider(e,o,n.input)),i=e.authSchemePreference?await e.authSchemePreference():[],a=dn(s,i),c=pc(e.httpAuthSchemes),p=k(o),d=[];for(let u of a){let l=c.get(u.schemeId);if(!l){d.push(`HttpAuthScheme \`${u.schemeId}\` was not enabled for this service.`);continue}let f=l.identityProvider(await t.identityProviderConfigProvider(e));if(!f){d.push(`HttpAuthScheme \`${u.schemeId}\` did not have an IdentityProvider configured.`);continue}let{identityProperties:R={},signingProperties:A={}}=u.propertiesExtractor?.(e,o)||{};u.identityProperties=Object.assign(u.identityProperties||{},R),u.signingProperties=Object.assign(u.signingProperties||{},A),p.selectedHttpAuthScheme={httpAuthOption:u,identity:await f(u.identityProperties),signer:l.signer};break}if(!p.selectedHttpAuthScheme)throw new Error(d.join(`
2
+ `));return r(n)};var uc={step:"serialize",tags:["HTTP_AUTH_SCHEME"],name:"httpAuthSchemeMiddleware",override:!0,relation:"before",toMiddleware:"endpointV2Middleware"},mn=(e,{httpAuthSchemeParametersProvider:t,identityProviderConfigProvider:r})=>({applyToStack:o=>{o.addRelativeTo(ln(e,{httpAuthSchemeParametersProvider:t,identityProviderConfigProvider:r}),uc)}});var dc=e=>t=>{throw t},lc=(e,t)=>{},fn=e=>(t,r)=>async o=>{if(!P.isInstance(o.request))return t(o);let s=k(r).selectedHttpAuthScheme;if(!s)throw new Error("No HttpAuthScheme was selected: unable to sign request");let{httpAuthOption:{signingProperties:i={}},identity:a,signer:c}=s,p=await t({...o,request:await c.sign(o.request,a,i)}).catch((c.errorHandler||dc)(i));return(c.successHandler||lc)(p.response,i),p};var mc={step:"finalizeRequest",tags:["HTTP_SIGNING"],name:"httpSigningMiddleware",aliases:["apiKeyMiddleware","tokenMiddleware","awsAuthMiddleware"],override:!0,relation:"after",toMiddleware:"retryMiddleware"},gn=e=>({applyToStack:t=>{t.addRelativeTo(fn(e),mc)}});var Me=(e,t,r,o,n)=>({name:t,namespace:e,traits:r,input:o,output:n});var hn=e=>(t,r)=>async o=>{let{response:n}=await t(o),{operationSchema:s}=k(r),[,i,a,c,p,d]=s??[];try{let u=await e.protocol.deserializeResponse(Me(i,a,c,p,d),{...e,...r},n);return{response:n,output:u}}catch(u){if(Object.defineProperty(u,"$response",{value:n,enumerable:!1,writable:!1,configurable:!1}),!("$metadata"in u)){let l="Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.";try{u.message+=`
3
+ `+l}catch{!r.logger||r.logger?.constructor?.name==="NoOpLogger"?console.warn(l):r.logger?.warn?.(l)}typeof u.$responseBodyText<"u"&&u.$response&&(u.$response.body=u.$responseBodyText);try{if(B.isInstance(n)){let{headers:f={}}=n,R=Object.entries(f);u.$metadata={httpStatusCode:n.statusCode,requestId:wr(/^x-[\w-]+-request-?id$/,R),extendedRequestId:wr(/^x-[\w-]+-id-2$/,R),cfId:wr(/^x-[\w-]+-cf-id$/,R)}}}catch{}}throw u}},wr=(e,t)=>(t.find(([r])=>r.match(e))||[void 0,void 0])[1];var yn=e=>{if(typeof e=="object"){if("url"in e){let t=se(e.url);if(e.headers){t.headers={};for(let[r,o]of Object.entries(e.headers))t.headers[r.toLowerCase()]=o.join(", ")}return t}return e}return se(e)};var En=e=>(t,r)=>async o=>{let{operationSchema:n}=k(r),[,s,i,a,c,p]=n??[],d=r.endpointV2?async()=>yn(r.endpointV2):e.endpoint,u=await e.protocol.serializeRequest(Me(s,i,a,c,p),o.input,{...e,...r,endpoint:d});return t({...o,request:u})};var fc={name:"deserializerMiddleware",step:"deserialize",tags:["DESERIALIZER"],override:!0},gc={name:"serializerMiddleware",step:"serialize",tags:["SERIALIZER"],override:!0};function xn(e){return{applyToStack:t=>{t.add(En(e),gc),t.add(hn(e),fc),e.protocol.setSerdeContext(e)}}}var ge=class e{namespace;schemas;exceptions;static registries=new Map;constructor(t,r=new Map,o=new Map){this.namespace=t,this.schemas=r,this.exceptions=o}static for(t){return e.registries.has(t)||e.registries.set(t,new e(t)),e.registries.get(t)}copyFrom(t){let{schemas:r,exceptions:o}=this;for(let[n,s]of t.schemas)r.has(n)||r.set(n,s);for(let[n,s]of t.exceptions)o.has(n)||o.set(n,s)}register(t,r){let o=this.normalizeShapeId(t);for(let n of[this,e.for(o.split("#")[0])])n.schemas.set(o,r)}getSchema(t){let r=this.normalizeShapeId(t);if(!this.schemas.has(r))throw new Error(`@smithy/core/schema - schema not found for ${r}`);return this.schemas.get(r)}registerError(t,r){let o=t,n=o[1];for(let s of[this,e.for(n)])s.schemas.set(n+"#"+o[2],o),s.exceptions.set(o,r)}getErrorCtor(t){let r=t;return this.exceptions.has(r)?this.exceptions.get(r):e.for(r[1]).exceptions.get(r)}getBaseException(){for(let t of this.exceptions.keys())if(Array.isArray(t)){let[,r,o]=t,n=r+"#"+o;if(n.startsWith("smithy.ts.sdk.synthetic.")&&n.endsWith("ServiceException"))return t}}find(t){return[...this.schemas.values()].find(t)}clear(){this.schemas.clear(),this.exceptions.clear()}normalizeShapeId(t){return t.includes("#")?t:this.namespace+"#"+t}};import Sn from"crypto";var Ir=Sn.randomUUID.bind(Sn);var D=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0")),Rn=()=>{if(Ir)return Ir();let e=new Uint8Array(16);return crypto.getRandomValues(e),e[6]=e[6]&15|64,e[8]=e[8]&63|128,D[e[0]]+D[e[1]]+D[e[2]]+D[e[3]]+"-"+D[e[4]]+D[e[5]]+"-"+D[e[6]]+D[e[7]]+"-"+D[e[8]]+D[e[9]]+"-"+D[e[10]]+D[e[11]]+D[e[12]]+D[e[13]]+D[e[14]]+D[e[15]]};var Ue=class{authSchemes=new Map;constructor(t){for(let[r,o]of Object.entries(t))o!==void 0&&this.authSchemes.set(r,o)}getIdentityProvider(t){return this.authSchemes.get(t)}};var _n="content-length";function hc(e){return t=>async r=>{let o=r.request;if(P.isInstance(o)){let{body:n,headers:s}=o;if(n&&Object.keys(s).map(i=>i.toLowerCase()).indexOf(_n)===-1)try{let i=e(n);o.headers={...o.headers,[_n]:String(i)}}catch{}}return t({...r,request:o})}}var yc={step:"build",tags:["SET_CONTENT_LENGTH","CONTENT_LENGTH"],name:"contentLengthMiddleware",override:!0},vn=e=>({applyToStack:t=>{t.add(hc(e.bodyLengthChecker),yc)}});var An=async e=>{let t=e?.Bucket||"";if(typeof e.Bucket=="string"&&(e.Bucket=t.replace(/#/g,encodeURIComponent("#")).replace(/\?/g,encodeURIComponent("?"))),_c(t)){if(e.ForcePathStyle===!0)throw new Error("Path-style addressing cannot be used with ARN buckets")}else(!Rc(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},Ec=/^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/,xc=/(\d+\.){3}\d+/,Sc=/\.\./;var Rc=e=>Ec.test(e)&&!xc.test(e)&&!Sc.test(e),_c=e=>{let[t,r,o,,,n]=e.split(":"),s=t==="arn"&&e.split(":").length>=6,i=!!(s&&r&&o&&n);if(s&&!i)throw new Error(`Invalid ARN: ${e} was an invalid ARN.`);return i};var Cn=(e,t,r,o=!1)=>{let n=async()=>{let s;return o?s=r.clientContextParams?.[e]??r[e]??r[t]:s=r[e]??r[t],typeof s=="function"?s():s};return e==="credentialScope"||t==="CredentialScope"?async()=>{let s=typeof r.credentials=="function"?await r.credentials():r.credentials;return s?.credentialScope??s?.CredentialScope}:e==="accountId"||t==="AccountId"?async()=>{let s=typeof r.credentials=="function"?await r.credentials():r.credentials;return s?.accountId??s?.AccountId}:e==="endpoint"||t==="endpoint"?async()=>{if(r.isCustomEndpoint===!1)return;let s=await n();if(s&&typeof s=="object"){if("url"in s)return s.url.href;if("hostname"in s){let{protocol:i,hostname:a,port:c,path:p}=s;return`${i}//${a}${c?":"+c:""}${p}`}}return s}:n};var wn="AWS_ENDPOINT_URL",In="endpoint_url",Pn=e=>({environmentVariableSelector:t=>{let r=e.split(" ").map(s=>s.toUpperCase()),o=t[[wn,...r].join("_")];if(o)return o;let n=t[wn];if(n)return n},configFileSelector:(t,r)=>{if(r&&t.services){let n=r[["services",t.services].join(".")];if(n){let s=e.split(" ").map(a=>a.toLowerCase()),i=n[[s.join("_"),In].join(".")];if(i)return i}}let o=t[In];if(o)return o},default:void 0});var Le=async e=>de(Pn(e??""))();var Fe=e=>{if(typeof e=="object"){if("url"in e){let t=se(e.url);if(e.headers){t.headers={};for(let[r,o]of Object.entries(e.headers))t.headers[r.toLowerCase()]=o.join(", ")}return t}return e}return se(e)};var Dn=async(e,t,r,o)=>{if(!r.isCustomEndpoint){let i;r.serviceConfiguredEndpoint?i=await r.serviceConfiguredEndpoint():i=await Le(r.serviceId),i&&(r.endpoint=()=>Promise.resolve(Fe(i)),r.isCustomEndpoint=!0)}let n=await Ac(e,t,r);if(typeof r.endpointProvider!="function")throw new Error("config.endpointProvider is not set.");let s=r.endpointProvider(n,o);if(r.isCustomEndpoint&&r.endpoint){let i=await r.endpoint();if(i?.headers){s.headers??={};for(let[a,c]of Object.entries(i.headers))s.headers[a]=Array.isArray(c)?c:[c]}}return s},Ac=async(e,t,r)=>{let o={},n=t?.getEndpointParameterInstructions?.()||{};for(let[s,i]of Object.entries(n))switch(i.type){case"staticContextParams":o[s]=i.value;break;case"contextParams":o[s]=e[i.name];break;case"clientContextParams":case"builtInParams":o[s]=await Cn(i.name,s,r,i.type!=="builtInParams")();break;case"operationContextParams":o[s]=i.get(e);break;default:throw new Error("Unrecognized endpoint parameter instruction: "+JSON.stringify(i))}return Object.keys(n).length===0&&Object.assign(o,r),String(r.serviceId).toLowerCase()==="s3"&&await An(o),o};var Tn=({config:e,instructions:t})=>(r,o)=>async n=>{e.isCustomEndpoint&&zo(o,"ENDPOINT_OVERRIDE","N");let s=await Dn(n.input,{getEndpointParameterInstructions(){return t}},{...e},o);o.endpointV2=s,o.authSchemes=s.properties?.authSchemes;let i=o.authSchemes?.[0];if(i){o.signing_region=i.signingRegion,o.signing_service=i.signingName;let c=k(o)?.selectedHttpAuthScheme?.httpAuthOption;c&&(c.signingProperties=Object.assign(c.signingProperties||{},{signing_region:i.signingRegion,signingRegion:i.signingRegion,signing_service:i.signingName,signingName:i.signingName,signingRegionSet:i.signingRegionSet},i.properties))}return r({...n})};var Cc={step:"serialize",tags:["ENDPOINT_PARAMETERS","ENDPOINT_V2","ENDPOINT"],name:"endpointV2Middleware",override:!0,relation:"before",toMiddleware:Sr.name},Ge=(e,t)=>({applyToStack:r=>{r.addRelativeTo(Tn({config:e,instructions:t}),Cc)}});var On=e=>{let t=e.tls??!0,{endpoint:r,useDualstackEndpoint:o,useFipsEndpoint:n}=e,s=r!=null?async()=>Fe(await M(r)()):void 0,a=Object.assign(e,{endpoint:s,tls:t,isCustomEndpoint:!!r,useDualstackEndpoint:M(o??!1),useFipsEndpoint:M(n??!1)}),c;return a.serviceConfiguredEndpoint=async()=>(e.serviceId&&!c&&(c=Le(e.serviceId)),c),a};var bn=["BandwidthLimitExceeded","EC2ThrottledException","LimitExceededException","PriorRequestNotComplete","ProvisionedThroughputExceededException","RequestLimitExceeded","RequestThrottled","RequestThrottledException","SlowDown","ThrottledException","Throttling","ThrottlingException","TooManyRequestsException","TransactionInProgressException"],Kn=["TimeoutError","RequestTimeout","RequestTimeoutException"],Nn=[500,502,503,504],$n=["ECONNRESET","ECONNREFUSED","EPIPE","ETIMEDOUT"],kn=["EHOSTUNREACH","ENETUNREACH","ENOTFOUND"];var wc=e=>e?.$retryable!==void 0;var Ic=e=>e.$metadata?.clockSkewCorrected,Pc=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},Mn=e=>e.$metadata?.httpStatusCode===429||bn.includes(e.name)||e.$retryable?.throttling==!0,He=(e,t=0)=>wc(e)||Ic(e)||Kn.includes(e.name)||$n.includes(e?.code||"")||kn.includes(e?.code||"")||Nn.includes(e.$metadata?.httpStatusCode||0)||Pc(e)||e.cause!==void 0&&t<=10&&He(e.cause,t+1),Un=e=>{if(e.$metadata?.httpStatusCode!==void 0){let t=e.$metadata.httpStatusCode;return 500<=t&&t<=599&&!He(e)}return!1};var Ln=e=>e instanceof Error?e:e instanceof Object?Object.assign(new Error,e):typeof e=="string"?new Error(e):new Error(`AWS SDK error wrapper for ${e}`);var Fn="AWS_MAX_ATTEMPTS",Gn="max_attempts",Hn={environmentVariableSelector:e=>{let t=e[Fn];if(!t)return;let r=parseInt(t);if(Number.isNaN(r))throw new Error(`Environment variable ${Fn} mast be a number, got "${t}"`);return r},configFileSelector:e=>{let t=e[Gn];if(!t)return;let r=parseInt(t);if(Number.isNaN(r))throw new Error(`Shared config file entry ${Gn} mast be a number, got "${t}"`);return r},default:Rr},Vn=e=>{let{retryStrategy:t,retryMode:r}=e,o=M(e.maxAttempts??Rr),n=t?Promise.resolve(t):void 0,s=async()=>await M(r)()===me.ADAPTIVE?new Oo(o):new To(o);return Object.assign(e,{maxAttempts:o,retryStrategy:()=>n??=s()})},Dc="AWS_RETRY_MODE",Tc="retry_mode",jn={environmentVariableSelector:e=>e[Dc],configFileSelector:e=>e[Tc],default:Do};import{Readable as Oc}from"stream";var qn=e=>e?.body instanceof Oc||typeof ReadableStream<"u"&&e?.body instanceof ReadableStream;var bc=e=>(t,r)=>async o=>{let n=await e.retryStrategy(),s=await e.maxAttempts();if(Kc(n)){n=n;let i=await n.acquireInitialRetryToken(r.partition_id),a=new Error,c=0,p=0,{request:d}=o,u=P.isInstance(d);for(u&&(d.headers[Io]=Rn());;)try{u&&(d.headers[Po]=`attempt=${c+1}; max=${s}`);let{response:l,output:f}=await t(o);return n.recordSuccess(i),f.$metadata.attempts=c+1,f.$metadata.totalRetryDelay=p,{response:l,output:f}}catch(l){let f=Nc(l);if(a=Ln(l),u&&qn(d))throw(r.logger instanceof ho?console:r.logger)?.warn("An error was encountered in a non-retryable streaming request."),a;try{i=await n.refreshRetryTokenForRetry(i,f)}catch{throw a.$metadata||(a.$metadata={}),a.$metadata.attempts=c+1,a.$metadata.totalRetryDelay=p,a}c=i.getRetryCount();let R=i.getRetryDelay();p+=R,await new Promise(A=>setTimeout(A,R))}}else return n=n,n?.mode&&(r.userAgent=[...r.userAgent||[],["cfg/retry-mode",n.mode]]),n.retry(t,o)},Kc=e=>typeof e.acquireInitialRetryToken<"u"&&typeof e.refreshRetryTokenForRetry<"u"&&typeof e.recordSuccess<"u",Nc=e=>{let t={error:e,errorType:$c(e)},r=Mc(e.$response);return r&&(t.retryAfterHint=r),t},$c=e=>Mn(e)?"THROTTLING":He(e)?"TRANSIENT":Un(e)?"SERVER_ERROR":"CLIENT_ERROR",kc={name:"retryMiddleware",tags:["RETRY"],step:"finalizeRequest",priority:"high",override:!0},Xn=e=>({applyToStack:t=>{t.add(bc(e),kc)}}),Mc=e=>{if(!B.isInstance(e))return;let t=Object.keys(e.headers).find(s=>s.toLowerCase()==="retry-after");if(!t)return;let r=e.headers[t],o=Number(r);return Number.isNaN(o)?new Date(r):new Date(o*1e3)};var Ve=class{config;middlewareStack=le();initConfig;handlers;constructor(t){this.config=t;let{protocol:r,protocolSettings:o}=t;o&&typeof r=="function"&&(t.protocol=new r(o))}send(t,r,o){let n=typeof r!="function"?r:void 0,s=typeof r=="function"?r:o,i=n===void 0&&this.config.cacheMiddleware===!0,a;if(i){this.handlers||(this.handlers=new WeakMap);let c=this.handlers;c.has(t.constructor)?a=c.get(t.constructor):(a=t.resolveMiddleware(this.middlewareStack,this.config,n),c.set(t.constructor,a))}else delete this.handlers,a=t.resolveMiddleware(this.middlewareStack,this.config,n);if(s)a(t).then(c=>s(null,c.output),c=>s(c)).catch(()=>{});else return a(t).then(c=>c.output)}destroy(){this.config?.requestHandler?.destroy?.(),delete this.handlers}};var Pr="***SensitiveInformation***";function je(e,t){if(t==null)return t;let r=O.of(e);if(r.getMergedTraits().sensitive)return Pr;if(r.isListSchema()){if(!!r.getValueSchema().getMergedTraits().sensitive)return Pr}else if(r.isMapSchema()){if(!!r.getKeySchema().getMergedTraits().sensitive||!!r.getValueSchema().getMergedTraits().sensitive)return Pr}else if(r.isStructSchema()&&typeof t=="object"){let o=t,n={};for(let[s,i]of r.structIterator())o[s]!=null&&(n[s]=je(i,o[s]));return n}return t}var oe=class{middlewareStack=le();schema;static classBuilder(){return new Dr}resolveMiddlewareWithContext(t,r,o,{middlewareFn:n,clientName:s,commandName:i,inputFilterSensitiveLog:a,outputFilterSensitiveLog:c,smithyContext:p,additionalContext:d,CommandCtor:u}){for(let I of n.bind(this)(u,t,r,o))this.middlewareStack.use(I);let l=t.concat(this.middlewareStack),{logger:f}=r,R={logger:f,clientName:s,commandName:i,inputFilterSensitiveLog:a,outputFilterSensitiveLog:c,[ue]:{commandInstance:this,...p},...d},{requestHandler:A}=r;return l.resolve(I=>A.handle(I.request,o||{}),R)}},Dr=class{_init=()=>{};_ep={};_middlewareFn=()=>[];_commandName="";_clientName="";_additionalContext={};_smithyContext={};_inputFilterSensitiveLog=void 0;_outputFilterSensitiveLog=void 0;_serializer=null;_deserializer=null;_operationSchema;init(t){this._init=t}ep(t){return this._ep=t,this}m(t){return this._middlewareFn=t,this}s(t,r,o={}){return this._smithyContext={service:t,operation:r,...o},this}c(t={}){return this._additionalContext=t,this}n(t,r){return this._clientName=t,this._commandName=r,this}f(t=o=>o,r=o=>o){return this._inputFilterSensitiveLog=t,this._outputFilterSensitiveLog=r,this}ser(t){return this._serializer=t,this}de(t){return this._deserializer=t,this}sc(t){return this._operationSchema=t,this._smithyContext.operationSchema=t,this}build(){let t=this,r;return r=class extends oe{input;static getEndpointParameterInstructions(){return t._ep}constructor(...[o]){super(),this.input=o??{},t._init(this),this.schema=t._operationSchema}resolveMiddleware(o,n,s){let i=t._operationSchema,a=i?.[4]??i?.input,c=i?.[5]??i?.output;return this.resolveMiddlewareWithContext(o,n,s,{CommandCtor:r,middlewareFn:t._middlewareFn,clientName:t._clientName,commandName:t._commandName,inputFilterSensitiveLog:t._inputFilterSensitiveLog??(i?je.bind(null,a):p=>p),outputFilterSensitiveLog:t._outputFilterSensitiveLog??(i?je.bind(null,c):p=>p),smithyContext:t._smithyContext,additionalContext:t._additionalContext})}serialize=t._serializer;deserialize=t._deserializer}}};var qe=class e extends Error{$fault;$response;$retryable;$metadata;constructor(t){super(t.message),Object.setPrototypeOf(this,Object.getPrototypeOf(this).constructor.prototype),this.name=t.name,this.$fault=t.$fault,this.$metadata=t.$metadata}static isInstance(t){if(!t)return!1;let r=t;return e.prototype.isPrototypeOf(r)||!!r.$fault&&!!r.$metadata&&(r.$fault==="client"||r.$fault==="server")}static[Symbol.hasInstance](t){if(!t)return!1;let r=t;return this===e?e.isInstance(t):e.isInstance(t)?r.name&&this.name?this.prototype.isPrototypeOf(t)||r.name===this.name:this.prototype.isPrototypeOf(t):!1}};var zn=e=>{switch(e){case"standard":return{retryMode:"standard",connectionTimeout:3100};case"in-region":return{retryMode:"standard",connectionTimeout:1100};case"cross-region":return{retryMode:"standard",connectionTimeout:3100};case"mobile":return{retryMode:"standard",connectionTimeout:3e4};default:return{}}};var Wn=!1,Bn=e=>{e&&!Wn&&parseInt(e.substring(1,e.indexOf(".")))<16&&(Wn=!0)};var Jn=Object.values(Pe),Qn=e=>{let t=[];for(let r in Pe){let o=Pe[r];e[o]!==void 0&&t.push({algorithmId:()=>o,checksumConstructor:()=>e[o]})}for(let[r,o]of Object.entries(e.checksumAlgorithms??{}))t.push({algorithmId:()=>r,checksumConstructor:()=>o});return{addChecksumAlgorithm(r){e.checksumAlgorithms=e.checksumAlgorithms??{};let o=r.algorithmId(),n=r.checksumConstructor();Jn.includes(o)?e.checksumAlgorithms[o.toUpperCase()]=n:e.checksumAlgorithms[o]=n,t.push(r)},checksumAlgorithms(){return t}}},Yn=e=>{let t={};return e.checksumAlgorithms().forEach(r=>{let o=r.algorithmId();Jn.includes(o)&&(t[o]=r.checksumConstructor())}),t};var Zn=e=>({setRetryStrategy(t){e.retryStrategy=t},retryStrategy(){return e.retryStrategy}}),es=e=>{let t={};return t.retryStrategy=e.retryStrategy(),t};var ts=e=>Object.assign(Qn(e),Zn(e));var rs=e=>Object.assign(Yn(e),es(e));var Xe=class{trace(){}debug(){}info(){}warn(){}error(){}};var Tr=e=>B.isInstance(e)?e.headers?.date??e.headers?.Date:void 0;var ze=e=>new Date(Date.now()+e);var os=(e,t)=>Math.abs(ze(t).getTime()-e)>=3e5;var Or=(e,t)=>{let r=Date.parse(e);return os(r,t)?r-Date.now():t};var he=(e,t)=>{if(!t)throw new Error(`Property \`${e}\` is not resolved for AWS SDK SigV4Auth`);return t},ns=async e=>{let t=he("context",e.context),r=he("config",e.config),o=t.endpointV2?.properties?.authSchemes?.[0],s=await he("signer",r.signer)(o),i=e?.signingRegion,a=e?.signingRegionSet,c=e?.signingName;return{config:r,signer:s,signingRegion:i,signingRegionSet:a,signingName:c}},ye=class{async sign(t,r,o){if(!P.isInstance(t))throw new Error("The request is not an instance of `HttpRequest` and cannot be signed");let n=await ns(o),{config:s,signer:i}=n,{signingRegion:a,signingName:c}=n,p=o.context;if(p?.authSchemes?.length??!1){let[u,l]=p.authSchemes;u?.name==="sigv4a"&&l?.name==="sigv4"&&(a=l?.signingRegion??a,c=l?.signingName??c)}return await i.sign(t,{signingDate:ze(s.systemClockOffset),signingRegion:a,signingService:c})}errorHandler(t){return r=>{let o=r.ServerTime??Tr(r.$response);if(o){let n=he("config",t.config),s=n.systemClockOffset;n.systemClockOffset=Or(o,n.systemClockOffset),n.systemClockOffset!==s&&r.$metadata&&(r.$metadata.clockSkewCorrected=!0)}throw r}}successHandler(t,r){let o=Tr(t);if(o){let n=he("config",r.config);n.systemClockOffset=Or(o,n.systemClockOffset)}}};var br=e=>typeof e=="string"&&e.length>0?e.split(",").map(t=>t.trim()):[];var ss=e=>`AWS_BEARER_TOKEN_${e.replace(/[\s-]/g,"_").toUpperCase()}`;var is="AWS_AUTH_SCHEME_PREFERENCE",as="auth_scheme_preference",cs={environmentVariableSelector:(e,t)=>{if(t?.signingName&&ss(t.signingName)in e)return["httpBearerAuth"];if(is in e)return br(e[is])},configFileSelector:e=>{if(as in e)return br(e[as])},default:[]};var ps=e=>()=>Promise.resolve(e);var We=(e,t,r)=>{let o,n,s,i=!1,a=async()=>{n||(n=e());try{o=await n,s=!0,i=!1}finally{n=void 0}return o};return t===void 0?async c=>((!s||c?.forceRefresh)&&(o=await a()),o):async c=>((!s||c?.forceRefresh)&&(o=await a()),i?o:r&&!r(o)?(i=!0,o):(t(o)&&await a(),o))};var us={warningEmitted:!1},ds=e=>{e&&!us.warningEmitted&&parseInt(e.substring(1,e.indexOf(".")))<20&&(us.warningEmitted=!0,process.emitWarning(`NodeDeprecationWarning: The AWS SDK for JavaScript (v3) will
4
+ no longer support Node.js ${e} in January 2026.
5
+
6
+ To continue receiving updates to AWS services, bug fixes, and security
7
+ updates please upgrade to a supported Node.js LTS version.
8
+
9
+ More information can be found at: https://a.co/c895JFp`))};function ls(e,t,r){return e.$source||(e.$source={}),e.$source[t]=r,e}var ms={},Kr={};for(let e=0;e<256;e++){let t=e.toString(16).toLowerCase();t.length===1&&(t=`0${t}`),ms[e]=t,Kr[t]=e}function fs(e){if(e.length%2!==0)throw new Error("Hex encoded strings must have an even number length");let t=new Uint8Array(e.length/2);for(let r=0;r<e.length;r+=2){let o=e.slice(r,r+2).toLowerCase();if(o in Kr)t[r/2]=Kr[o];else throw new Error(`Cannot decode unrecognized sequence ${o} as hexadecimal`)}return t}function b(e){let t="";for(let r=0;r<e.byteLength;r++)t+=ms[e[r]];return t}var gs="X-Amz-Algorithm",hs="X-Amz-Credential",Nr="X-Amz-Date",ys="X-Amz-SignedHeaders",Es="X-Amz-Expires",$r="X-Amz-Signature",kr="X-Amz-Security-Token";var Mr="authorization",Ur=Nr.toLowerCase(),Uc="date",xs=[Mr,Ur,Uc],Ss=$r.toLowerCase(),Ee="x-amz-content-sha256",Rs=kr.toLowerCase();var _s={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},vs=/^proxy-/,As=/^sec-/;var Be="AWS4-HMAC-SHA256";var Cs="AWS4-HMAC-SHA256-PAYLOAD",ws="UNSIGNED-PAYLOAD",Is=50,Lr="aws4_request",Ps=3600*24*7;var Je={},Fr=[],Qe=(e,t,r)=>`${e}/${t}/${r}/${Lr}`,Ts=async(e,t,r,o,n)=>{let s=await Ds(e,t.secretAccessKey,t.accessKeyId),i=`${r}:${o}:${n}:${b(s)}:${t.sessionToken}`;if(i in Je)return Je[i];for(Fr.push(i);Fr.length>Is;)delete Je[Fr.shift()];let a=`AWS4${t.secretAccessKey}`;for(let c of[r,o,n,Lr])a=await Ds(e,a,c);return Je[i]=a};var Ds=(e,t,r)=>{let o=new e(t);return o.update($(r)),o.digest()};var Gr=({headers:e},t,r)=>{let o={};for(let n of Object.keys(e).sort()){if(e[n]==null)continue;let s=n.toLowerCase();(s in _s||t?.has(s)||vs.test(s)||As.test(s))&&(!r||r&&!r.has(s))||(o[s]=e[n].trim().replace(/\s+/g," "))}return o};var Ye=async({headers:e,body:t},r)=>{for(let o of Object.keys(e))if(o.toLowerCase()===Ee)return e[o];if(t==null)return"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";if(typeof t=="string"||ArrayBuffer.isView(t)||bo(t)){let o=new r;return o.update($(t)),b(await o.digest())}return ws};var Ze=class{format(t){let r=[];for(let s of Object.keys(t)){let i=re(s);r.push(Uint8Array.from([i.byteLength]),i,this.formatHeaderValue(t[s]))}let o=new Uint8Array(r.reduce((s,i)=>s+i.byteLength,0)),n=0;for(let s of r)o.set(s,n),n+=s.byteLength;return o}formatHeaderValue(t){switch(t.type){case"boolean":return Uint8Array.from([t.value?0:1]);case"byte":return Uint8Array.from([2,t.value]);case"short":let r=new DataView(new ArrayBuffer(3));return r.setUint8(0,3),r.setInt16(1,t.value,!1),new Uint8Array(r.buffer);case"integer":let o=new DataView(new ArrayBuffer(5));return o.setUint8(0,4),o.setInt32(1,t.value,!1),new Uint8Array(o.buffer);case"long":let n=new Uint8Array(9);return n[0]=5,n.set(t.value.bytes,1),n;case"binary":let s=new DataView(new ArrayBuffer(3+t.value.byteLength));s.setUint8(0,6),s.setUint16(1,t.value.byteLength,!1);let i=new Uint8Array(s.buffer);return i.set(t.value,3),i;case"string":let a=re(t.value),c=new DataView(new ArrayBuffer(3+a.byteLength));c.setUint8(0,7),c.setUint16(1,a.byteLength,!1);let p=new Uint8Array(c.buffer);return p.set(a,3),p;case"timestamp":let d=new Uint8Array(9);return d[0]=8,d.set(Hr.fromNumber(t.value.valueOf()).bytes,1),d;case"uuid":if(!Lc.test(t.value))throw new Error(`Invalid UUID received: ${t.value}`);let u=new Uint8Array(17);return u[0]=9,u.set(fs(t.value.replace(/\-/g,"")),1),u}}},Os;(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"})(Os||(Os={}));var Lc=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/,Hr=class e{bytes;constructor(t){if(this.bytes=t,t.byteLength!==8)throw new Error("Int64 buffers must be exactly 8 bytes")}static fromNumber(t){if(t>9223372036854776e3||t<-9223372036854776e3)throw new Error(`${t} is too large (or, if negative, too small) to represent as an Int64`);let r=new Uint8Array(8);for(let o=7,n=Math.abs(Math.round(t));o>-1&&n>0;o--,n/=256)r[o]=n;return t<0&&bs(r),new e(r)}valueOf(){let t=this.bytes.slice(0),r=t[0]&128;return r&&bs(t),parseInt(b(t),16)*(r?-1:1)}toString(){return String(this.valueOf())}};function bs(e){for(let t=0;t<8;t++)e[t]^=255;for(let t=7;t>-1&&(e[t]++,e[t]===0);t--);}var Ks=(e,t)=>{e=e.toLowerCase();for(let r of Object.keys(t))if(e===r.toLowerCase())return!0;return!1};var Ns=(e,t={})=>{let{headers:r,query:o={}}=P.clone(e);for(let n of Object.keys(r)){let s=n.toLowerCase();(s.slice(0,6)==="x-amz-"&&!t.unhoistableHeaders?.has(s)||t.hoistableHeaders?.has(s))&&(o[n]=r[n],delete r[n])}return{...e,headers:r,query:o}};var Vr=e=>{e=P.clone(e);for(let t of Object.keys(e.headers))xs.indexOf(t.toLowerCase())>-1&&delete e.headers[t];return e};var F=e=>encodeURIComponent(e).replace(/[!'()*]/g,Fc),Fc=e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`;var $s=({query:e={}})=>{let t=[],r={};for(let o of Object.keys(e)){if(o.toLowerCase()===Ss)continue;let n=F(o);t.push(n);let s=e[o];typeof s=="string"?r[n]=`${n}=${F(s)}`:Array.isArray(s)&&(r[n]=s.slice(0).reduce((i,a)=>i.concat([`${n}=${F(a)}`]),[]).sort().join("&"))}return t.sort().map(o=>r[o]).filter(o=>o).join("&")};var ks=e=>Gc(e).toISOString().replace(/\.\d{3}Z$/,"Z"),Gc=e=>typeof e=="number"?new Date(e*1e3):typeof e=="string"?Number(e)?new Date(Number(e)*1e3):new Date(e):e;var et=class{service;regionProvider;credentialProvider;sha256;uriEscapePath;applyChecksum;constructor({applyChecksum:t,credentials:r,region:o,service:n,sha256:s,uriEscapePath:i=!0}){this.service=n,this.sha256=s,this.uriEscapePath=i,this.applyChecksum=typeof t=="boolean"?t:!0,this.regionProvider=M(o),this.credentialProvider=M(r)}createCanonicalRequest(t,r,o){let n=Object.keys(r).sort();return`${t.method}
10
+ ${this.getCanonicalPath(t)}
11
+ ${$s(t)}
12
+ ${n.map(s=>`${s}:${r[s]}`).join(`
13
+ `)}
14
+
15
+ ${n.join(";")}
16
+ ${o}`}async createStringToSign(t,r,o,n){let s=new this.sha256;s.update($(o));let i=await s.digest();return`${n}
17
+ ${t}
18
+ ${r}
19
+ ${b(i)}`}getCanonicalPath({path:t}){if(this.uriEscapePath){let r=[];for(let s of t.split("/"))s?.length!==0&&s!=="."&&(s===".."?r.pop():r.push(s));let o=`${t?.startsWith("/")?"/":""}${r.join("/")}${r.length>0&&t?.endsWith("/")?"/":""}`;return F(o).replace(/%2F/g,"/")}return t}validateResolvedCredentials(t){if(typeof t!="object"||typeof t.accessKeyId!="string"||typeof t.secretAccessKey!="string")throw new Error("Resolved credential object is not valid")}formatDate(t){let r=ks(t).replace(/[\-:]/g,"");return{longDate:r,shortDate:r.slice(0,8)}}getCanonicalHeaderList(t){return Object.keys(t).sort().join(";")}};var xe=class extends et{headerFormatter=new Ze;constructor({applyChecksum:t,credentials:r,region:o,service:n,sha256:s,uriEscapePath:i=!0}){super({applyChecksum:t,credentials:r,region:o,service:n,sha256:s,uriEscapePath:i})}async presign(t,r={}){let{signingDate:o=new Date,expiresIn:n=3600,unsignableHeaders:s,unhoistableHeaders:i,signableHeaders:a,hoistableHeaders:c,signingRegion:p,signingService:d}=r,u=await this.credentialProvider();this.validateResolvedCredentials(u);let l=p??await this.regionProvider(),{longDate:f,shortDate:R}=this.formatDate(o);if(n>Ps)return Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future");let A=Qe(R,l,d??this.service),I=Ns(Vr(t),{unhoistableHeaders:i,hoistableHeaders:c});u.sessionToken&&(I.query[kr]=u.sessionToken),I.query[gs]=Be,I.query[hs]=`${u.accessKeyId}/${A}`,I.query[Nr]=f,I.query[Es]=n.toString(10);let j=Gr(I,s,a);return I.query[ys]=this.getCanonicalHeaderList(j),I.query[$r]=await this.getSignature(f,A,this.getSigningKey(u,l,R,d),this.createCanonicalRequest(I,j,await Ye(t,this.sha256))),I}async sign(t,r){return typeof t=="string"?this.signString(t,r):t.headers&&t.payload?this.signEvent(t,r):t.message?this.signMessage(t,r):this.signRequest(t,r)}async signEvent({headers:t,payload:r},{signingDate:o=new Date,priorSignature:n,signingRegion:s,signingService:i}){let a=s??await this.regionProvider(),{shortDate:c,longDate:p}=this.formatDate(o),d=Qe(c,a,i??this.service),u=await Ye({headers:{},body:r},this.sha256),l=new this.sha256;l.update(t);let f=b(await l.digest()),R=[Cs,p,d,n,f,u].join(`
20
+ `);return this.signString(R,{signingDate:o,signingRegion:a,signingService:i})}async signMessage(t,{signingDate:r=new Date,signingRegion:o,signingService:n}){return this.signEvent({headers:this.headerFormatter.format(t.message.headers),payload:t.message.body},{signingDate:r,signingRegion:o,signingService:n,priorSignature:t.priorSignature}).then(i=>({message:t.message,signature:i}))}async signString(t,{signingDate:r=new Date,signingRegion:o,signingService:n}={}){let s=await this.credentialProvider();this.validateResolvedCredentials(s);let i=o??await this.regionProvider(),{shortDate:a}=this.formatDate(r),c=new this.sha256(await this.getSigningKey(s,i,a,n));return c.update($(t)),b(await c.digest())}async signRequest(t,{signingDate:r=new Date,signableHeaders:o,unsignableHeaders:n,signingRegion:s,signingService:i}={}){let a=await this.credentialProvider();this.validateResolvedCredentials(a);let c=s??await this.regionProvider(),p=Vr(t),{longDate:d,shortDate:u}=this.formatDate(r),l=Qe(u,c,i??this.service);p.headers[Ur]=d,a.sessionToken&&(p.headers[Rs]=a.sessionToken);let f=await Ye(p,this.sha256);!Ks(Ee,p.headers)&&this.applyChecksum&&(p.headers[Ee]=f);let R=Gr(p,n,o),A=await this.getSignature(d,l,this.getSigningKey(a,c,u,i),this.createCanonicalRequest(p,R,f));return p.headers[Mr]=`${Be} Credential=${a.accessKeyId}/${l}, SignedHeaders=${this.getCanonicalHeaderList(R)}, Signature=${A}`,p}async getSignature(t,r,o,n){let s=await this.createStringToSign(t,r,n,Be),i=new this.sha256(await o);return i.update($(s)),b(await i.digest())}getSigningKey(t,r,o,n){return Ts(this.sha256,t,o,r,n||this.service)}};var Ms=e=>{let t=e.credentials,r=!!e.credentials,o;Object.defineProperty(e,"credentials",{set(p){p&&p!==t&&p!==o&&(r=!0),t=p;let d=Hc(e,{credentials:t,credentialDefaultProvider:e.credentialDefaultProvider}),u=Vc(e,d);if(r&&!u.attributed){let l=typeof t=="object"&&t!==null;o=async f=>{let A=await u(f);return l&&(!A.$source||Object.keys(A.$source).length===0)?ls(A,"CREDENTIALS_CODE","e"):A},o.memoized=u.memoized,o.configBound=u.configBound,o.attributed=!0}else o=u},get(){return o},enumerable:!0,configurable:!0}),e.credentials=t;let{signingEscapePath:n=!0,systemClockOffset:s=e.systemClockOffset||0,sha256:i}=e,a;return e.signer?a=te(e.signer):e.regionInfoProvider?a=()=>te(e.region)().then(async p=>[await e.regionInfoProvider(p,{useFipsEndpoint:await e.useFipsEndpoint(),useDualstackEndpoint:await e.useDualstackEndpoint()})||{},p]).then(([p,d])=>{let{signingRegion:u,signingService:l}=p;e.signingRegion=e.signingRegion||u||d,e.signingName=e.signingName||l||e.serviceId;let f={...e,credentials:e.credentials,region:e.signingRegion,service:e.signingName,sha256:i,uriEscapePath:n},R=e.signerConstructor||xe;return new R(f)}):a=async p=>{p=Object.assign({},{name:"sigv4",signingName:e.signingName||e.defaultSigningName,signingRegion:await te(e.region)(),properties:{}},p);let d=p.signingRegion,u=p.signingName;e.signingRegion=e.signingRegion||d,e.signingName=e.signingName||u||e.serviceId;let l={...e,credentials:e.credentials,region:e.signingRegion,service:e.signingName,sha256:i,uriEscapePath:n},f=e.signerConstructor||xe;return new f(l)},Object.assign(e,{systemClockOffset:s,signingEscapePath:n,signer:a})};function Hc(e,{credentials:t,credentialDefaultProvider:r}){let o;return t?t?.memoized?o=t:o=Co(t,vo,Ao):r?o=te(r(Object.assign({},e,{parentClientConfig:e}))):o=async()=>{throw new Error("@aws-sdk/core::resolveAwsSdkSigV4Config - `credentials` not provided and no credentialDefaultProvider was configured.")},o.memoized=!0,o}function Vc(e,t){if(t.configBound)return t;let r=async o=>t({...o,callerClientConfig:e});return r.memoized=t.memoized,r.configBound=!0,r}var Us=e=>e[ue]||(e[ue]={});var jr=e=>{if(typeof e=="function")return e;let t=Promise.resolve(e);return()=>t};var Ls=async(e,t,r)=>({operation:Us(t).operation,region:await jr(e.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});function jc(e){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"kms",region:e.region},propertiesExtractor:(t,r)=>({signingProperties:{config:t,context:r}})}}var Fs=e=>{let t=[];switch(e.operation){default:t.push(jc(e))}return t},Gs=e=>{let t=Ms(e);return Object.assign(t,{authSchemePreference:jr(e.authSchemePreference??[])})};var Hs=e=>Object.assign(e,{useDualstackEndpoint:e.useDualstackEndpoint??!1,useFipsEndpoint:e.useFipsEndpoint??!1,defaultSigningName:"kms"}),tt={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}};var Vs={name:"@aws-sdk/client-kms",description:"AWS SDK for JavaScript Kms Client for Node.js, Browser and React Native",version:"3.1019.0",scripts:{build:"concurrently 'yarn:build:types' 'yarn:build:es' && yarn build:cjs","build:cjs":"node ../../scripts/compilation/inline client-kms","build:es":"tsc -p tsconfig.es.json","build:include:deps":'yarn g:turbo run build -F="$npm_package_name"',"build:types":"tsc -p tsconfig.types.json","build:types:downlevel":"downlevel-dts dist-types dist-types/ts3.4",clean:"premove dist-cjs dist-es dist-types tsconfig.cjs.tsbuildinfo tsconfig.es.tsbuildinfo tsconfig.types.tsbuildinfo","extract:docs":"api-extractor run --local","generate:client":"node ../../scripts/generate-clients/single-service --solo kms","test:e2e":"yarn g:vitest run -c vitest.config.e2e.mts --mode development","test:e2e:watch":"yarn g:vitest watch -c vitest.config.e2e.mts","test:index":"tsc --noEmit ./test/index-types.ts && node ./test/index-objects.spec.mjs"},main:"./dist-cjs/index.js",types:"./dist-types/index.d.ts",module:"./dist-es/index.js",sideEffects:!1,dependencies:{"@aws-crypto/sha256-browser":"5.2.0","@aws-crypto/sha256-js":"5.2.0","@aws-sdk/core":"^3.973.25","@aws-sdk/credential-provider-node":"^3.972.27","@aws-sdk/middleware-host-header":"^3.972.8","@aws-sdk/middleware-logger":"^3.972.8","@aws-sdk/middleware-recursion-detection":"^3.972.9","@aws-sdk/middleware-user-agent":"^3.972.26","@aws-sdk/region-config-resolver":"^3.972.10","@aws-sdk/types":"^3.973.6","@aws-sdk/util-endpoints":"^3.996.5","@aws-sdk/util-user-agent-browser":"^3.972.8","@aws-sdk/util-user-agent-node":"^3.973.12","@smithy/config-resolver":"^4.4.13","@smithy/core":"^3.23.12","@smithy/fetch-http-handler":"^5.3.15","@smithy/hash-node":"^4.2.12","@smithy/invalid-dependency":"^4.2.12","@smithy/middleware-content-length":"^4.2.12","@smithy/middleware-endpoint":"^4.4.27","@smithy/middleware-retry":"^4.4.44","@smithy/middleware-serde":"^4.2.15","@smithy/middleware-stack":"^4.2.12","@smithy/node-config-provider":"^4.3.12","@smithy/node-http-handler":"^4.5.0","@smithy/protocol-http":"^5.3.12","@smithy/smithy-client":"^4.12.7","@smithy/types":"^4.13.1","@smithy/url-parser":"^4.2.12","@smithy/util-base64":"^4.3.2","@smithy/util-body-length-browser":"^4.2.2","@smithy/util-body-length-node":"^4.2.3","@smithy/util-defaults-mode-browser":"^4.3.43","@smithy/util-defaults-mode-node":"^4.2.47","@smithy/util-endpoints":"^3.3.3","@smithy/util-middleware":"^4.2.12","@smithy/util-retry":"^4.2.12","@smithy/util-utf8":"^4.2.2",tslib:"^2.6.2"},devDependencies:{"@tsconfig/node20":"20.1.8","@types/node":"^20.14.8",concurrently:"7.0.0","downlevel-dts":"0.10.1",premove:"4.0.0",typescript:"~5.8.3"},engines:{node:">=20.0.0"},typesVersions:{"<4.5":{"dist-types/*":["dist-types/ts3.4/*"]}},files:["dist-*/**"],author:{name:"AWS SDK for JavaScript Team",url:"https://aws.amazon.com/javascript/"},license:"Apache-2.0",browser:{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.browser"},"react-native":{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.native"},homepage:"https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-kms",repository:{type:"git",url:"https://github.com/aws/aws-sdk-js-v3.git",directory:"clients/client-kms"}};var js="AWS_EC2_METADATA_DISABLED",qs=async e=>{let{ENV_CMDS_FULL_URI:t,ENV_CMDS_RELATIVE_URI:r,fromContainerMetadata:o,fromInstanceMetadata:n}=await import("./dist-es-VG3XXJ7M.js");if(process.env[r]||process.env[t]){e.logger?.debug("@aws-sdk/credential-provider-node - remoteProvider::fromHttp/fromContainerMetadata");let{fromHttp:s}=await import("./dist-es-PFLN3FTL.js");return Ke(s(e),o(e))}return process.env[js]&&process.env[js]!=="false"?async()=>{throw new L("EC2 Instance Metadata Service access disabled",{logger:e.logger})}:(e.logger?.debug("@aws-sdk/credential-provider-node - remoteProvider::fromInstanceMetadata"),n(e))};function Xs(e,t){let r=Xc(e),o,n,s,i=async a=>{if(a?.forceRefresh)return await r(a);if(s?.expiration&&s?.expiration?.getTime()<Date.now()&&(s=void 0),o)await o;else if(!s||t?.(s))if(s)n||(n=r(a).then(c=>{s=c}).finally(()=>{n=void 0}));else return o=r(a).then(c=>{s=c}).finally(()=>{o=void 0}),i(a);return s};return i}var Xc=e=>async t=>{let r;for(let o of e)try{return await o(t)}catch(n){if(r=n,n?.tryNextLink)continue;throw n}throw r};var zs=!1,Ws=(e={})=>Xs([async()=>{if(e.profile??process.env[No])throw process.env[Mo]&&process.env[Uo]&&(zs||((e.logger?.warn&&e.logger?.constructor?.name!=="NoOpLogger"?e.logger.warn.bind(e.logger):console.warn)(`@aws-sdk/credential-provider-node - defaultProvider::fromEnv WARNING:
21
+ Multiple credential sources detected:
22
+ Both AWS_PROFILE and the pair AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY static credentials are set.
23
+ This SDK will proceed with the AWS_PROFILE value.
24
+
25
+ However, a future version may change this behavior to prefer the ENV static credentials.
26
+ Please ensure that your environment only sets either the AWS_PROFILE or the
27
+ AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY pair.
28
+ `),zs=!0)),new L("AWS_PROFILE is set, skipping fromEnv provider.",{logger:e.logger,tryNextLink:!0});return e.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromEnv"),Lo(e)()},async t=>{e.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromSSO");let{ssoStartUrl:r,ssoAccountId:o,ssoRegion:n,ssoRoleName:s,ssoSession:i}=e;if(!r&&!o&&!n&&!s&&!i)throw new L("Skipping SSO provider in default chain (inputs do not include SSO fields).",{logger:e.logger});let{fromSSO:a}=await import("./dist-es-WAHVDQ3F.js");return a(e)(t)},async t=>{e.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromIni");let{fromIni:r}=await import("./dist-es-B5M7V6O6.js");return r(e)(t)},async t=>{e.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromProcess");let{fromProcess:r}=await import("./dist-es-KE65J6GC.js");return r(e)(t)},async t=>{e.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromTokenFile");let{fromTokenFile:r}=await import("./dist-es-U3NYQORW.js");return r(e)(t)},async()=>(e.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::remoteProvider"),(await qs(e))()),async()=>{throw new L("Could not load credentials from any providers",{tryNextLink:!1,logger:e.logger})}],zc);var zc=e=>e?.expiration!==void 0&&e.expiration.getTime()-Date.now()<3e5;import{platform as Zc,release as ep}from"os";import{env as oi}from"process";import{versions as qr}from"process";var Bs=()=>{let e=["deno","bun","llrt"];for(let t of e)if(qr[t])return[`md/${t}`,qr[t]];return["md/nodejs",qr.node]};import{readFile as Zs}from"fs/promises";import{join as Xr}from"path";import{normalize as Wc,sep as Js}from"path";var Qs=e=>{let t=process.cwd();if(!e)return[t];let r=Wc(e),o=r.split(Js),n=o.indexOf("node_modules"),s=n!==-1?o.slice(0,n).join(Js):r;return t===s?[t]:[s,t]};var Bc=/^(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-]+)*)?$/,rt=(e="")=>{let t=e.match(Bc);if(!t)return;let[r,o,n,s]=[t[1],t[2],t[3],t[4]];return s?`${r}.${o}.${n}-${s}`:`${r}.${o}.${n}`};var Jc=["^","~",">=","<=",">","<"],Qc=["latest","beta","dev","rc","insiders","next"],Ys=(e="")=>{if(Qc.includes(e))return e;let t=Jc.find(o=>e.startsWith(o))??"",r=rt(e.slice(t.length));if(r)return`${t}${r}`};var G,Yc=Xr("node_modules","typescript","package.json"),ei=async()=>{if(G===null)return;if(typeof G=="string")return["md/tsc",G];let e=!1;try{e=J(process.env,"AWS_SDK_JS_TYPESCRIPT_DETECTION_DISABLED",Q.ENV)||!1}catch{}if(e){G=null;return}let r=Qs(typeof __dirname<"u"?__dirname:void 0),o;for(let i of r)try{let a=Xr(i,"package.json"),c=await Zs(a,"utf-8"),{dependencies:p,devDependencies:d}=JSON.parse(c),u=d?.typescript??p?.typescript;if(typeof u!="string")continue;o=u;break}catch{}if(!o){G=null;return}let n;for(let i of r)try{let a=Xr(i,Yc),c=await Zs(a,"utf-8"),{version:p}=JSON.parse(c),d=rt(p);if(typeof d!="string")continue;n=d;break}catch{}if(n)return G=n,["md/tsc",G];let s=Ys(o);if(typeof s!="string"){G=null;return}return G=`dev_${s}`,["md/tsc",G]};var ti={isCrtAvailable:!1};var ri=()=>ti.isCrtAvailable?["md/crt-avail"]:null;var ni=({serviceId:e,clientVersion:t})=>{let r=Bs();return async o=>{let n=[["aws-sdk-js",t],["ua","2.1"],[`os/${Zc()}`,ep()],["lang/js"],r],s=await ei();s&&n.push(s);let i=ri();i&&n.push(i),e&&n.push([`api/${e}`,t]),oi.AWS_EXECUTION_ENV&&n.push([`exec-env/${oi.AWS_EXECUTION_ENV}`]);let a=await o?.userAgentAppId?.();return a?[...n,[`app/${a}`]]:[...n]}};var tp="AWS_SDK_UA_APP_ID",rp="sdk_ua_app_id",op="sdk-ua-app-id",si={environmentVariableSelector:e=>e[tp],configFileSelector:e=>e[rp]??e[op],default:Fo};import{Buffer as np}from"buffer";import{createHash as sp,createHmac as ip}from"crypto";var ot=class{algorithmIdentifier;secret;hash;constructor(t,r){this.algorithmIdentifier=t,this.secret=r,this.reset()}update(t,r){this.hash.update($(ii(t,r)))}digest(){return Promise.resolve(this.hash.digest())}reset(){this.hash=this.secret?ip(this.algorithmIdentifier,ii(this.secret)):sp(this.algorithmIdentifier)}};function ii(e,t){return np.isBuffer(e)?e:typeof e=="string"?Ko(e,t):ArrayBuffer.isView(e)?_r(e.buffer,e.byteOffset,e.byteLength):_r(e)}function nt(e){try{let t=new Set(Array.from(e.match(/([A-Z_]){3,}/g)??[]));return t.delete("CONFIG"),t.delete("CONFIG_PREFIX_SEPARATOR"),t.delete("ENV"),[...t].join(", ")}catch{return e}}var ai=(e,t)=>async()=>{try{let r=e(process.env,t);if(r===void 0)throw new Error;return r}catch(r){throw new L(r.message||`Not found in ENV: ${nt(e.toString())}`,{logger:t?.logger})}};var ci=(e,{preferredFile:t="config",...r}={})=>async()=>{let o=$o(r),{configFile:n,credentialsFile:s}=await ko(r),i=s[o]||{},a=n[o]||{},c=t==="config"?{...i,...a}:{...a,...i};try{let d=e(c,t==="config"?n:s);if(d===void 0)throw new Error;return d}catch(p){throw new L(p.message||`Not found in config files w/ profile [${o}]: ${nt(e.toString())}`,{logger:r.logger})}};var ap=e=>typeof e=="function",pi=e=>ap(e)?async()=>await e():ps(e);var Y=({environmentVariableSelector:e,configFileSelector:t,default:r},o={})=>{let{signingName:n,logger:s}=o;return We(Ke(ai(e,{signingName:n,logger:s}),ci(t,o),pi(r)))};function ui(e){let t=[];for(let r of Object.keys(e).sort()){let o=e[r];if(r=F(r),Array.isArray(o))for(let n=0,s=o.length;n<s;n++)t.push(`${r}=${F(o[n])}`);else{let n=r;(o||typeof o=="string")&&(n+=`=${F(o)}`),t.push(n)}}return t.join("&")}import{Agent as Wr,request as dp}from"https";function zr(e){let t=e&&typeof e=="object"&&"reason"in e?e.reason:void 0;if(t){if(t instanceof Error){let n=new Error("Request aborted");return n.name="AbortError",n.cause=t,n}let o=new Error(String(t));return o.name="AbortError",o}let r=new Error("Request aborted");return r.name="AbortError",r}var di=["ECONNRESET","EPIPE","ETIMEDOUT"];var li=e=>{let t={};for(let r of Object.keys(e)){let o=e[r];t[r]=Array.isArray(o)?o.join(","):o}return t};var w={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e)};var mi=1e3,fi=(e,t,r=0)=>{if(!r)return-1;let o=n=>{let s=w.setTimeout(()=>{e.destroy(),t(Object.assign(new Error(`@smithy/node-http-handler - the request socket did not establish a connection with the server within the configured timeout of ${r} ms.`),{name:"TimeoutError"}))},r-n),i=a=>{a?.connecting?a.on("connect",()=>{w.clearTimeout(s)}):w.clearTimeout(s)};e.socket?i(e.socket):e.on("socket",i)};return r<2e3?(o(0),0):w.setTimeout(o.bind(null,mi),mi)};var gi=(e,t,r=0,o,n)=>r?w.setTimeout(()=>{let s=`@smithy/node-http-handler - [${o?"ERROR":"WARN"}] a request has exceeded the configured ${r} ms requestTimeout.`;if(o){let i=Object.assign(new Error(s),{name:"TimeoutError",code:"ETIMEDOUT"});e.destroy(i),t(i)}else s+=" Init client requestHandler with throwOnRequestTimeout=true to turn this into an error.",n?.warn?.(s)},r):-1;var cp=3e3,hi=(e,{keepAlive:t,keepAliveMsecs:r},o=cp)=>{if(t!==!0)return-1;let n=()=>{e.socket?e.socket.setKeepAlive(t,r||0):e.on("socket",s=>{s.setKeepAlive(t,r||0)})};return o===0?(n(),0):w.setTimeout(n,o)};var yi=3e3,Ei=(e,t,r=0)=>{let o=n=>{let s=r-n,i=()=>{e.destroy(),t(Object.assign(new Error(`@smithy/node-http-handler - the request socket timed out after ${r} ms of inactivity (configured by client requestHandler).`),{name:"TimeoutError"}))};e.socket?(e.socket.setTimeout(s,i),e.on("close",()=>e.socket?.removeListener("timeout",i))):e.setTimeout(s,i)};return 0<r&&r<6e3?(o(0),0):w.setTimeout(o.bind(null,r===0?0:yi),yi)};import{Readable as pp}from"stream";var xi=6e3;async function Si(e,t,r=xi,o=!1){let n=t.headers??{},s=n.Expect||n.expect,i=-1,a=!0;!o&&s==="100-continue"&&(a=await Promise.race([new Promise(c=>{i=Number(w.setTimeout(()=>c(!0),Math.max(xi,r)))}),new Promise(c=>{e.on("continue",()=>{w.clearTimeout(i),c(!0)}),e.on("response",()=>{w.clearTimeout(i),c(!1)}),e.on("error",()=>{w.clearTimeout(i),c(!1)})})])),a&&up(e,t.body)}function up(e,t){if(t instanceof pp){t.pipe(e);return}if(t){let r=Buffer.isBuffer(t);if(r||typeof t=="string"){r&&t.byteLength===0?e.end():e.end(t);return}let n=t;if(typeof n=="object"&&n.buffer&&typeof n.byteOffset=="number"&&typeof n.byteLength=="number"){e.end(Buffer.from(n.buffer,n.byteOffset,n.byteLength));return}e.end(Buffer.from(t));return}e.end()}var st,Ri,it=class e{config;configProvider;socketWarningTimestamp=0;externalAgent=!1;metadata={handlerProtocol:"http/1.1"};static create(t){return typeof t?.handle=="function"?t:new e(t)}static checkSocketUsage(t,r,o=console){let{sockets:n,requests:s,maxSockets:i}=t;if(typeof i!="number"||i===1/0||Date.now()-15e3<r)return r;if(n&&s)for(let c in n){let p=n[c]?.length??0,d=s[c]?.length??0;if(p>=i&&d>=2*i)return o?.warn?.(`@smithy/node-http-handler:WARN - socket usage at capacity=${p} and ${d} additional requests are enqueued.
29
+ See https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/node-configuring-maxsockets.html
30
+ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler config.`),Date.now()}return r}constructor(t){this.configProvider=new Promise((r,o)=>{typeof t=="function"?t().then(n=>{r(this.resolveDefaultConfig(n))}).catch(o):r(this.resolveDefaultConfig(t))})}destroy(){this.config?.httpAgent?.destroy(),this.config?.httpsAgent?.destroy()}async handle(t,{abortSignal:r,requestTimeout:o}={}){this.config||(this.config=await this.configProvider);let n=this.config,s=t.protocol==="https:";return!s&&!this.config.httpAgent&&(this.config.httpAgent=await this.config.httpAgentProvider()),new Promise((i,a)=>{let c,p=[],d=async C=>{await c,p.forEach(w.clearTimeout),i(C)},u=async C=>{await c,p.forEach(w.clearTimeout),a(C)};if(r?.aborted){let C=zr(r);u(C);return}let l=t.headers??{},f=(l.Expect??l.expect)==="100-continue",R=s?n.httpsAgent:n.httpAgent;f&&!this.externalAgent&&(R=new(s?Wr:st)({keepAlive:!1,maxSockets:1/0})),p.push(w.setTimeout(()=>{this.socketWarningTimestamp=e.checkSocketUsage(R,this.socketWarningTimestamp,n.logger)},n.socketAcquisitionWarningTimeout??(n.requestTimeout??2e3)+(n.connectionTimeout??1e3)));let A=ui(t.query||{}),I;if(t.username!=null||t.password!=null){let C=t.username??"",W=t.password??"";I=`${C}:${W}`}let j=t.path;A&&(j+=`?${A}`),t.fragment&&(j+=`#${t.fragment}`);let ee=t.hostname??"";ee[0]==="["&&ee.endsWith("]")?ee=t.hostname.slice(1,-1):ee=t.hostname;let Ae={headers:t.headers,host:ee,method:t.method,path:j,port:t.port,agent:R,auth:I},z=(s?dp:Ri)(Ae,C=>{let W=new B({statusCode:C.statusCode||-1,reason:C.statusMessage,headers:li(C.headers),body:C});d({response:W})});if(z.on("error",C=>{di.includes(C.code)?u(Object.assign(C,{name:"TimeoutError"})):u(C)}),r){let C=()=>{z.destroy();let W=zr(r);u(W)};if(typeof r.addEventListener=="function"){let W=r;W.addEventListener("abort",C,{once:!0}),z.once("close",()=>W.removeEventListener("abort",C))}else r.onabort=C}let ao=o??n.requestTimeout;p.push(fi(z,u,n.connectionTimeout)),p.push(gi(z,u,ao,n.throwOnRequestTimeout,n.logger??console)),p.push(Ei(z,u,n.socketTimeout));let Ce=Ae.agent;typeof Ce=="object"&&"keepAlive"in Ce&&p.push(hi(z,{keepAlive:Ce.keepAlive,keepAliveMsecs:Ce.keepAliveMsecs})),c=Si(z,t,ao,this.externalAgent).catch(C=>(p.forEach(w.clearTimeout),a(C)))})}updateHttpClientConfig(t,r){this.config=void 0,this.configProvider=this.configProvider.then(o=>({...o,[t]:r}))}httpHandlerConfigs(){return this.config??{}}resolveDefaultConfig(t){let{requestTimeout:r,connectionTimeout:o,socketTimeout:n,socketAcquisitionWarningTimeout:s,httpAgent:i,httpsAgent:a,throwOnRequestTimeout:c,logger:p}=t||{},d=!0,u=50;return{connectionTimeout:o,requestTimeout:r,socketTimeout:n,socketAcquisitionWarningTimeout:s,throwOnRequestTimeout:c,httpAgentProvider:async()=>{let{Agent:l,request:f}=await import("http");return Ri=f,st=l,i instanceof st||typeof i?.destroy=="function"?(this.externalAgent=!0,i):new st({keepAlive:d,maxSockets:u,...i})},httpsAgent:a instanceof Wr||typeof a?.destroy=="function"?(this.externalAgent=!0,a):new Wr({keepAlive:d,maxSockets:u,...a}),logger:p}}};import{Writable as lp}from"stream";var at=class extends lp{bufferedBytes=[];_write(t,r,o){this.bufferedBytes.push(t),o()}};var _i=e=>mp(e)?fp(e):new Promise((t,r)=>{let o=new at;e.pipe(o),e.on("error",n=>{o.end(),r(n)}),o.on("error",r),o.on("finish",function(){let n=new Uint8Array(Buffer.concat(this.bufferedBytes));t(n)})}),mp=e=>typeof ReadableStream=="function"&&e instanceof ReadableStream;async function fp(e){let t=[],r=e.getReader(),o=!1,n=0;for(;!o;){let{done:a,value:c}=await r.read();c&&(t.push(c),n+=c.length),o=a}let s=new Uint8Array(n),i=0;for(let a of t)s.set(a,i),i+=a.length;return s}var vi="AWS_EXECUTION_ENV",Br="AWS_REGION",Jr="AWS_DEFAULT_REGION",Ai="AWS_EC2_METADATA_DISABLED",Ci=["in-region","cross-region","mobile","standard","legacy"],wi="/latest/meta-data/placement/region";var gp="AWS_DEFAULTS_MODE",hp="defaults_mode",Ii={environmentVariableSelector:e=>e[gp],configFileSelector:e=>e[hp],default:"legacy"};var Pi=({region:e=de(yo),defaultsMode:t=de(Ii)}={})=>We(async()=>{let r=typeof t=="function"?await t():t;switch(r?.toLowerCase()){case"auto":return yp(e);case"in-region":case"cross-region":case"mobile":case"standard":case"legacy":return Promise.resolve(r?.toLocaleLowerCase());case void 0:return Promise.resolve("legacy");default:throw new Error(`Invalid parameter for "defaultsMode", expect ${Ci.join(", ")}, got ${r}`)}}),yp=async e=>{if(e){let t=typeof e=="function"?await e():e,r=await Ep();return r?t===r?"in-region":"cross-region":"standard"}return"standard"},Ep=async()=>{if(process.env[vi]&&(process.env[Br]||process.env[Jr]))return process.env[Br]??process.env[Jr];if(!process.env[Ai])try{let{getInstanceMetadataEndpoint:e,httpRequest:t}=await import("./dist-es-VG3XXJ7M.js"),r=await e();return(await t({...r,path:wi})).toString()}catch{}};var Qr;(function(e){e.STANDARD="standard",e.ADAPTIVE="adaptive"})(Qr||(Qr={}));var Di=Qr.STANDARD;var ct=class{queryCompat;errorRegistry;constructor(t=!1){this.queryCompat=t}resolveRestContentType(t,r){let o=r.getMemberSchemas(),n=Object.values(o).find(s=>!!s.getMergedTraits().httpPayload);if(n){let s=n.getMergedTraits().mediaType;return s||(n.isStringSchema()?"text/plain":n.isBlobSchema()?"application/octet-stream":t)}else if(!r.isUnitSchema()&&Object.values(o).find(i=>{let{httpQuery:a,httpQueryParams:c,httpHeader:p,httpLabel:d,httpPrefixHeaders:u}=i.getMergedTraits();return!a&&!c&&!p&&!d&&u===void 0}))return t}async getErrorSchemaOrThrowBaseException(t,r,o,n,s,i){let a=t;t.includes("#")&&([,a]=t.split("#"));let c={$metadata:s,$fault:o.statusCode<500?"client":"server"};if(!this.errorRegistry)throw new Error("@aws-sdk/core/protocols - error handler not initialized.");try{return{errorSchema:i?.(this.errorRegistry,a)??this.errorRegistry.getSchema(t),errorMetadata:c}}catch{n.message=n.message??n.Message??"UnknownError";let d=this.errorRegistry,u=d.getBaseException();if(u){let R=d.getErrorCtor(u)??Error;throw this.decorateServiceException(Object.assign(new R({name:a}),c),n)}let l=n,f=l?.message??l?.Message??l?.Error?.Message??l?.Error?.message;throw this.decorateServiceException(Object.assign(new Error(f),{name:a},c),n)}}compose(t,r,o){let n=o;r.includes("#")&&([n]=r.split("#"));let s=yr.for(n),i=yr.for("smithy.ts.sdk.synthetic."+o);t.copyFrom(s),t.copyFrom(i),this.errorRegistry=t}decorateServiceException(t,r={}){if(this.queryCompat){let o=t.Message??r.Message,n=Er(t,r);o&&(n.message=o),n.Error={...n.Error,Type:n.Error?.Type,Code:n.Error?.Code,Message:n.Error?.message??n.Error?.Message??o};let s=n.$metadata.requestId;return s&&(n.RequestId=s),n}return Er(t,r)}setQueryCompatError(t,r){let o=r.headers?.["x-amzn-query-error"];if(t!==void 0&&o!=null){let[n,s]=o.split(";"),i=Object.entries(t),a={Code:n,Type:s};Object.assign(t,a);for(let[c,p]of i)a[c==="message"?"Message":c]=p;delete a.__type,t.Error=a}}queryCompatOutput(t,r){t.Error&&(r.Error=t.Error),t.Type&&(r.Type=t.Type),t.Code&&(r.Code=t.Code)}findQueryCompatibleError(t,r){try{return t.getSchema(r)}catch{return t.find(n=>O.of(n).getMergedTraits().awsQueryError?.[0]===r)}}};var Z=class{serdeContext;setSerdeContext(t){this.serdeContext=t}};var pt=class{from;to;keys;constructor(t,r){this.from=t,this.to=r,this.keys=new Set(Object.keys(this.from).filter(o=>o!=="__type"))}mark(t){this.keys.delete(t)}hasUnknown(){return this.keys.size===1&&Object.keys(this.to).length===0}writeUnknown(){if(this.hasUnknown()){let t=this.keys.values().next().value,r=this.from[t];this.to.$unknown=[t,r]}}};function Ti(e,t,r){if(r?.source){let o=r.source;if(typeof t=="number"&&(t>Number.MAX_SAFE_INTEGER||t<Number.MIN_SAFE_INTEGER||o!==String(t)))return o.includes(".")?new T(o,"bigDecimal"):BigInt(o)}return t}var Oi=(e,t)=>So(e,t).then(r=>(t?.utf8Encoder??be)(r));var bi=(e,t)=>Oi(e,t).then(r=>{if(r.length)try{return JSON.parse(r)}catch(o){throw o?.name==="SyntaxError"&&Object.defineProperty(o,"$responseBodyText",{value:r}),o}return{}});var Ki=(e,t)=>{let r=(s,i)=>Object.keys(s).find(a=>a.toLowerCase()===i.toLowerCase()),o=s=>{let i=s;return typeof i=="number"&&(i=i.toString()),i.indexOf(",")>=0&&(i=i.split(",")[0]),i.indexOf(":")>=0&&(i=i.split(":")[0]),i.indexOf("#")>=0&&(i=i.split("#")[1]),i},n=r(e.headers,"x-amzn-errortype");if(n!==void 0)return o(e.headers[n]);if(t&&typeof t=="object"){let s=r(t,"code");if(s&&t[s]!==void 0)return o(t[s]);if(t.__type!==void 0)return o(t.__type)}};var ut=class extends Z{settings;constructor(t){super(),this.settings=t}async read(t,r){return this._read(t,typeof r=="string"?JSON.parse(r,Ti):await bi(r,this.serdeContext))}readObject(t,r){return this._read(t,r)}_read(t,r){let o=r!==null&&typeof r=="object",n=O.of(t);if(o){if(n.isStructSchema()){let i=r,a=n.isUnionSchema(),c={},p,{jsonName:d}=this.settings;d&&(p={});let u;a&&(u=new pt(i,c));for(let[l,f]of n.structIterator()){let R=l;d&&(R=f.getMergedTraits().jsonName??R,p[R]=l),a&&u.mark(R),i[R]!=null&&(c[l]=this._read(f,i[R]))}if(a)u.writeUnknown();else if(typeof i.__type=="string")for(let[l,f]of Object.entries(i)){let R=d?p[l]??l:l;R in c||(c[R]=f)}return c}if(Array.isArray(r)&&n.isListSchema()){let i=n.getValueSchema(),a=[];for(let c of r)a.push(this._read(i,c));return a}if(n.isMapSchema()){let i=n.getValueSchema(),a={};for(let[c,p]of Object.entries(r))a[c]=this._read(i,p);return a}}if(n.isBlobSchema()&&typeof r=="string")return Oe(r);let s=n.getMergedTraits().mediaType;if(n.isStringSchema()&&typeof r=="string"&&s)return s==="application/json"||s.endsWith("+json")?we.from(r):r;if(n.isTimestampSchema()&&r!=null)switch(Te(n,this.settings)){case 5:return lo(r);case 6:return mo(r);case 7:return fo(r);default:return console.warn("Missing timestamp format, parsing value with Date constructor:",r),new Date(r)}if(n.isBigIntegerSchema()&&(typeof r=="number"||typeof r=="string"))return BigInt(r);if(n.isBigDecimalSchema()&&r!=null){if(r instanceof T)return r;let i=r;return i.type==="bigDecimal"&&"string"in i?new T(i.string,i.type):new T(String(r),"bigDecimal")}if(n.isNumericSchema()&&typeof r=="string"){switch(r){case"Infinity":return 1/0;case"-Infinity":return-1/0;case"NaN":return NaN}return r}if(n.isDocumentSchema())if(o){let i=Array.isArray(r)?[]:{};for(let[a,c]of Object.entries(r))c instanceof T?i[a]=c:i[a]=this._read(n,c);return i}else return structuredClone(r);return r}};var Ni="\u039D",dt=class{values=new Map;counter=0;stage=0;createReplacer(){if(this.stage===1)throw new Error("@aws-sdk/core/protocols - JsonReplacer already created.");if(this.stage===2)throw new Error("@aws-sdk/core/protocols - JsonReplacer exhausted.");return this.stage=1,(t,r)=>{if(r instanceof T){let o=`${Ni+"nv"+this.counter++}_`+r.string;return this.values.set(`"${o}"`,r.string),o}if(typeof r=="bigint"){let o=r.toString(),n=`${Ni+"b"+this.counter++}_`+o;return this.values.set(`"${n}"`,o),n}return r}}replaceInJson(t){if(this.stage===0)throw new Error("@aws-sdk/core/protocols - JsonReplacer not created yet.");if(this.stage===2)throw new Error("@aws-sdk/core/protocols - JsonReplacer exhausted.");if(this.stage=2,this.counter===0)return t;for(let[r,o]of this.values)t=t.replace(r,o);return t}};var lt=class extends Z{settings;buffer;useReplacer=!1;rootSchema;constructor(t){super(),this.settings=t}write(t,r){this.rootSchema=O.of(t),this.buffer=this._write(this.rootSchema,r)}writeDiscriminatedDocument(t,r){this.write(t,r),typeof this.buffer=="object"&&(this.buffer.__type=O.of(t).getName(!0))}flush(){let{rootSchema:t,useReplacer:r}=this;if(this.rootSchema=void 0,this.useReplacer=!1,t?.isStructSchema()||t?.isDocumentSchema()){if(!r)return JSON.stringify(this.buffer);let o=new dt;return o.replaceInJson(JSON.stringify(this.buffer,o.createReplacer(),0))}return this.buffer}_write(t,r,o){let n=r!==null&&typeof r=="object",s=O.of(t);if(n){if(s.isStructSchema()){let i=r,a={},{jsonName:c}=this.settings,p;c&&(p={});for(let[d,u]of s.structIterator()){let l=this._write(u,i[d],s);if(l!==void 0){let f=d;c&&(f=u.getMergedTraits().jsonName??d,p[d]=f),a[f]=l}}if(s.isUnionSchema()&&Object.keys(a).length===0){let{$unknown:d}=i;if(Array.isArray(d)){let[u,l]=d;a[u]=this._write(15,l)}}else if(typeof i.__type=="string")for(let[d,u]of Object.entries(i)){let l=c?p[d]??d:d;l in a||(a[l]=this._write(15,u))}return a}if(Array.isArray(r)&&s.isListSchema()){let i=s.getValueSchema(),a=[],c=!!s.getMergedTraits().sparse;for(let p of r)(c||p!=null)&&a.push(this._write(i,p));return a}if(s.isMapSchema()){let i=s.getValueSchema(),a={},c=!!s.getMergedTraits().sparse;for(let[p,d]of Object.entries(r))(c||d!=null)&&(a[p]=this._write(i,d));return a}if(r instanceof Uint8Array&&(s.isBlobSchema()||s.isDocumentSchema()))return s===this.rootSchema?r:(this.serdeContext?.base64Encoder??fe)(r);if(r instanceof Date&&(s.isTimestampSchema()||s.isDocumentSchema()))switch(Te(s,this.settings)){case 5:return r.toISOString().replace(".000Z","Z");case 6:return uo(r);case 7:return r.getTime()/1e3;default:return console.warn("Missing timestamp format, using epoch seconds",r),r.getTime()/1e3}r instanceof T&&(this.useReplacer=!0)}if(!(r===null&&o?.isStructSchema())){if(s.isStringSchema()){if(typeof r>"u"&&s.isIdempotencyToken())return xo();let i=s.getMergedTraits().mediaType;return r!=null&&i&&(i==="application/json"||i.endsWith("+json"))?we.from(r):r}if(typeof r=="number"&&s.isNumericSchema())return Math.abs(r)===1/0||isNaN(r)?String(r):r;if(typeof r=="string"&&s.isBlobSchema())return s===this.rootSchema?r:(this.serdeContext?.base64Encoder??fe)(r);if(typeof r=="bigint"&&(this.useReplacer=!0),s.isDocumentSchema())if(n){let i=Array.isArray(r)?[]:{};for(let[a,c]of Object.entries(r))c instanceof T?(this.useReplacer=!0,i[a]=c):i[a]=this._write(s,c);return i}else return structuredClone(r);return r}}};var mt=class extends Z{settings;constructor(t){super(),this.settings=t}createSerializer(){let t=new lt(this.settings);return t.setSerdeContext(this.serdeContext),t}createDeserializer(){let t=new ut(this.settings);return t.setSerdeContext(this.serdeContext),t}};var ft=class extends Ro{serializer;deserializer;serviceTarget;codec;mixin;awsQueryCompatible;constructor({defaultNamespace:t,errorTypeRegistries:r,serviceTarget:o,awsQueryCompatible:n,jsonCodec:s}){super({defaultNamespace:t,errorTypeRegistries:r}),this.serviceTarget=o,this.codec=s??new mt({timestampFormat:{useTrait:!0,default:7},jsonName:!1}),this.serializer=this.codec.createSerializer(),this.deserializer=this.codec.createDeserializer(),this.awsQueryCompatible=!!n,this.mixin=new ct(this.awsQueryCompatible)}async serializeRequest(t,r,o){let n=await super.serializeRequest(t,r,o);return n.path.endsWith("/")||(n.path+="/"),Object.assign(n.headers,{"content-type":`application/x-amz-json-${this.getJsonRpcVersion()}`,"x-amz-target":`${this.serviceTarget}.${t.name}`}),this.awsQueryCompatible&&(n.headers["x-amzn-query-mode"]="true"),(go(t.input)==="unit"||!n.body)&&(n.body="{}"),n}getPayloadCodec(){return this.codec}async handleError(t,r,o,n,s){this.awsQueryCompatible&&this.mixin.setQueryCompatError(n,o);let i=Ki(o,n)??"Unknown";this.mixin.compose(this.compositeErrorRegistry,i,this.options.defaultNamespace);let{errorSchema:a,errorMetadata:c}=await this.mixin.getErrorSchemaOrThrowBaseException(i,this.options.defaultNamespace,o,n,s,this.awsQueryCompatible?this.mixin.findQueryCompatibleError:void 0),p=O.of(a),d=n.message??n.Message??"UnknownError",u=this.compositeErrorRegistry.getErrorCtor(a)??Error,l=new u(d),f={};for(let[R,A]of p.structIterator())n[R]!=null&&(f[R]=this.codec.createDeserializer().readObject(A,n[R]));throw this.awsQueryCompatible&&this.mixin.queryCompatOutput(n,f),this.mixin.decorateServiceException(Object.assign(l,c,{$fault:p.getMergedTraits().error,message:d},f),n)}};var gt=class extends ft{constructor({defaultNamespace:t,errorTypeRegistries:r,serviceTarget:o,awsQueryCompatible:n,jsonCodec:s}){super({defaultNamespace:t,errorTypeRegistries:r,serviceTarget:o,awsQueryCompatible:n,jsonCodec:s})}getShapeId(){return"aws.protocols#awsJson1_1"}getJsonRpcVersion(){return"1.1"}getDefaultContentType(){return"application/x-amz-json-1.1"}};function $i(e){let t={};if(e=e.replace(/^\?/,""),e)for(let r of e.split("&")){let[o,n=null]=r.split("=");o=decodeURIComponent(o),n&&(n=decodeURIComponent(n)),o in t?Array.isArray(t[o])?t[o].push(n):t[o]=[t[o],n]:t[o]=n}return t}var Yr=e=>{if(typeof e=="string")return Yr(new URL(e));let{hostname:t,pathname:r,port:o,protocol:n,search:s}=e,i;return s&&(i=$i(s)),{hostname:t,port:o?parseInt(o):void 0,protocol:n,path:r,query:i}};var Zr=(e,t=!1)=>{if(t){for(let r of e.split("."))if(!Zr(r))return!1;return!0}return!(!De(e)||e.length<3||e.length>63||e!==e.toLowerCase()||xr(e))};var ki=e=>{let t=e.split(":");if(t.length<6)return null;let[r,o,n,s,i,...a]=t;if(r!=="arn"||o===""||n===""||a.join(":")==="")return null;let c=a.map(p=>p.split("/")).flat();return{partition:o,service:n,region:s,accountId:i,resourceId:c}};var Mi={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"};var Sp=Mi;var Ui=e=>{let{partitions:t}=Sp;for(let o of t){let{regions:n,outputs:s}=o;for(let[i,a]of Object.entries(n))if(i===e)return{...s,...a}}for(let o of t){let{regionRegex:n,outputs:s}=o;if(new RegExp(n).test(e))return{...s}}let r=t.find(o=>o.id==="aws");if(!r)throw new Error("Provided region was not found in the partition array or regex, and default partition with id 'aws' doesn't exist.");return{...r.outputs}};var eo={isVirtualHostableS3Bucket:Zr,parseArn:ki,partition:Ui};Eo.aws=eo;var ht=class{capacity;data=new Map;parameters=[];constructor({size:t,params:r}){this.capacity=t??50,r&&(this.parameters=r)}get(t,r){let o=this.hash(t);if(o===!1)return r();if(!this.data.has(o)){if(this.data.size>this.capacity+10){let n=this.data.keys(),s=0;for(;;){let{value:i,done:a}=n.next();if(this.data.delete(i),a||++s>10)break}}this.data.set(o,r())}return this.data.get(o)}size(){return this.data.size}hash(t){let r="",{parameters:o}=this;if(o.length===0)return!1;for(let n of o){let s=String(t[n]??"");if(s.includes("|;"))return!1;r+=s+"|;"}return r}};var Rp=new RegExp("^(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}$"),Li=e=>Rp.test(e)||e.startsWith("[")&&e.endsWith("]");var _p=new RegExp("^(?!.*-$)(?!-)[a-zA-Z0-9-]{1,63}$"),to=(e,t=!1)=>{if(!t)return _p.test(e);let r=e.split(".");for(let o of r)if(!to(o))return!1;return!0};var Se={};var q="endpoints";function K(e){return typeof e!="object"||e==null?e:"ref"in e?`$${K(e.ref)}`:"fn"in e?`${e.fn}(${(e.argv||[]).map(K).join(", ")})`:JSON.stringify(e,null,2)}var v=class extends Error{constructor(t){super(t),this.name="EndpointError"}};var Fi=(e,t)=>e===t;var Gi=e=>{let t=e.split("."),r=[];for(let o of t){let n=o.indexOf("[");if(n!==-1){if(o.indexOf("]")!==o.length-1)throw new v(`Path: '${e}' does not end with ']'`);let s=o.slice(n+1,-1);if(Number.isNaN(parseInt(s)))throw new v(`Invalid array index: '${s}' in path: '${e}'`);n!==0&&r.push(o.slice(0,n)),r.push(s)}else r.push(o)}return r};var yt=(e,t)=>Gi(t).reduce((r,o)=>{if(typeof r!="object")throw new v(`Index '${o}' in '${t}' not found in '${JSON.stringify(e)}'`);return Array.isArray(r)?r[parseInt(o)]:r[o]},e);var Hi=e=>e!=null;var Vi=e=>!e;var ro={[Ie.HTTP]:80,[Ie.HTTPS]:443},ji=e=>{let t=(()=>{try{if(e instanceof URL)return e;if(typeof e=="object"&&"hostname"in e){let{hostname:l,port:f,protocol:R="",path:A="",query:I={}}=e,j=new URL(`${R}//${l}${f?`:${f}`:""}${A}`);return j.search=Object.entries(I).map(([ee,Ae])=>`${ee}=${Ae}`).join("&"),j}return new URL(e)}catch{return null}})();if(!t)return console.error(`Unable to parse ${JSON.stringify(e)} as a whatwg URL.`),null;let r=t.href,{host:o,hostname:n,pathname:s,protocol:i,search:a}=t;if(a)return null;let c=i.slice(0,-1);if(!Object.values(Ie).includes(c))return null;let p=Li(n),d=r.includes(`${o}:${ro[c]}`)||typeof e=="string"&&e.includes(`${o}:${ro[c]}`),u=`${o}${d?`:${ro[c]}`:""}`;return{scheme:c,authority:u,path:s,normalizedPath:s.endsWith("/")?s:`${s}/`,isIp:p}};var qi=(e,t)=>e===t;var Xi=(e,t,r,o)=>t>=r||e.length<r||/[^\u0000-\u007f]/.test(e)?null:o?e.substring(e.length-r,e.length-t):e.substring(t,r);var zi=e=>encodeURIComponent(e).replace(/[!*'()]/g,t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`);var Wi={booleanEquals:Fi,getAttr:yt,isSet:Hi,isValidHostLabel:to,not:Vi,parseURL:ji,stringEquals:qi,substring:Xi,uriEncode:zi};var Et=(e,t)=>{let r=[],o={...t.endpointParams,...t.referenceRecord},n=0;for(;n<e.length;){let s=e.indexOf("{",n);if(s===-1){r.push(e.slice(n));break}r.push(e.slice(n,s));let i=e.indexOf("}",s);if(i===-1){r.push(e.slice(s));break}e[s+1]==="{"&&e[i+1]==="}"&&(r.push(e.slice(s+1,i)),n=i+2);let a=e.substring(s+1,i);if(a.includes("#")){let[c,p]=a.split("#");r.push(yt(o[c],p))}else r.push(o[a]);n=i+1}return r.join("")};var Bi=({ref:e},t)=>({...t.endpointParams,...t.referenceRecord})[e];var ne=(e,t,r)=>{if(typeof e=="string")return Et(e,r);if(e.fn)return Ji.callFunction(e,r);if(e.ref)return Bi(e,r);throw new v(`'${t}': ${String(e)} is not a string, function or reference.`)},xt=({fn:e,argv:t},r)=>{let o=t.map(s=>["boolean","number"].includes(typeof s)?s:Ji.evaluateExpression(s,"arg",r)),n=e.split(".");return n[0]in Se&&n[1]!=null?Se[n[0]][n[1]](...o):Wi[e](...o)},Ji={evaluateExpression:ne,callFunction:xt};var Qi=({assign:e,...t},r)=>{if(e&&e in r.referenceRecord)throw new v(`'${e}' is already defined in Reference Record.`);let o=xt(t,r);return r.logger?.debug?.(`${q} evaluateCondition: ${K(t)} = ${K(o)}`),{result:o===""?!0:!!o,...e!=null&&{toAssign:{name:e,value:o}}}};var ie=(e=[],t)=>{let r={};for(let o of e){let{result:n,toAssign:s}=Qi(o,{...t,referenceRecord:{...t.referenceRecord,...r}});if(!n)return{result:n};s&&(r[s.name]=s.value,t.logger?.debug?.(`${q} assign: ${s.name} := ${K(s.value)}`))}return{result:!0,referenceRecord:r}};var Yi=(e,t)=>Object.entries(e).reduce((r,[o,n])=>({...r,[o]:n.map(s=>{let i=ne(s,"Header value entry",t);if(typeof i!="string")throw new v(`Header '${o}' value '${i}' is not a string`);return i})}),{});var oo=(e,t)=>Object.entries(e).reduce((r,[o,n])=>({...r,[o]:ea.getEndpointProperty(n,t)}),{}),Zi=(e,t)=>{if(Array.isArray(e))return e.map(r=>Zi(r,t));switch(typeof e){case"string":return Et(e,t);case"object":if(e===null)throw new v(`Unexpected endpoint property: ${e}`);return ea.getEndpointProperties(e,t);case"boolean":return e;default:throw new v(`Unexpected endpoint property type: ${typeof e}`)}},ea={getEndpointProperty:Zi,getEndpointProperties:oo};var ta=(e,t)=>{let r=ne(e,"Endpoint URL",t);if(typeof r=="string")try{return new URL(r)}catch(o){throw console.error(`Failed to construct URL with ${r}`,o),o}throw new v(`Endpoint URL must be a string, got ${typeof r}`)};var ra=(e,t)=>{let{conditions:r,endpoint:o}=e,{result:n,referenceRecord:s}=ie(r,t);if(!n)return;let i={...t,referenceRecord:{...t.referenceRecord,...s}},{url:a,properties:c,headers:p}=o;return t.logger?.debug?.(`${q} Resolving endpoint from template: ${K(o)}`),{...p!=null&&{headers:Yi(p,i)},...c!=null&&{properties:oo(c,i)},url:ta(a,i)}};var oa=(e,t)=>{let{conditions:r,error:o}=e,{result:n,referenceRecord:s}=ie(r,t);if(n)throw new v(ne(o,"Error",{...t,referenceRecord:{...t.referenceRecord,...s}}))};var no=(e,t)=>{for(let r of e)if(r.type==="endpoint"){let o=ra(r,t);if(o)return o}else if(r.type==="error")oa(r,t);else if(r.type==="tree"){let o=na.evaluateTreeRule(r,t);if(o)return o}else throw new v(`Unknown endpoint rule: ${r}`);throw new v("Rules evaluation failed")},vp=(e,t)=>{let{conditions:r,rules:o}=e,{result:n,referenceRecord:s}=ie(r,t);if(n)return na.evaluateRules(o,{...t,referenceRecord:{...t.referenceRecord,...s}})},na={evaluateRules:no,evaluateTreeRule:vp};var sa=(e,t)=>{let{endpointParams:r,logger:o}=t,{parameters:n,rules:s}=e;t.logger?.debug?.(`${q} Initial EndpointParams: ${K(r)}`);let i=Object.entries(n).filter(([,p])=>p.default!=null).map(([p,d])=>[p,d.default]);if(i.length>0)for(let[p,d]of i)r[p]=r[p]??d;let a=Object.entries(n).filter(([,p])=>p.required).map(([p])=>p);for(let p of a)if(r[p]==null)throw new v(`Missing required parameter: '${p}'`);let c=no(s,{endpointParams:r,logger:o,referenceRecord:{}});return t.logger?.debug?.(`${q} Resolved endpoint: ${K(c)}`),c};var ga="required";var V="argv";var ia="isSet",_e="booleanEquals",ae="error",Re="endpoint",X="tree",so="PartitionResult",aa={[ga]:!1,type:"string"},ca={[ga]:!0,default:!1,type:"boolean"},pa={ref:"Endpoint"},ha={fn:_e,[V]:[{ref:"UseFIPS"},!0]},ya={fn:_e,[V]:[{ref:"UseDualStack"},!0]},H={},ua={fn:"getAttr",[V]:[{ref:so},"supportsFIPS"]},da={fn:_e,[V]:[!0,{fn:"getAttr",[V]:[{ref:so},"supportsDualStack"]}]},la=[ha],ma=[ya],fa=[{ref:"Region"}],Ap={version:"1.0",parameters:{Region:aa,UseDualStack:ca,UseFIPS:ca,Endpoint:aa},rules:[{conditions:[{fn:ia,[V]:[pa]}],rules:[{conditions:la,error:"Invalid Configuration: FIPS and custom endpoint are not supported",type:ae},{conditions:ma,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",type:ae},{endpoint:{url:pa,properties:H,headers:H},type:Re}],type:X},{conditions:[{fn:ia,[V]:fa}],rules:[{conditions:[{fn:"aws.partition",[V]:fa,assign:so}],rules:[{conditions:[ha,ya],rules:[{conditions:[{fn:_e,[V]:[!0,ua]},da],rules:[{endpoint:{url:"https://kms-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:H,headers:H},type:Re}],type:X},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",type:ae}],type:X},{conditions:la,rules:[{conditions:[{fn:_e,[V]:[ua,!0]}],rules:[{endpoint:{url:"https://kms-fips.{Region}.{PartitionResult#dnsSuffix}",properties:H,headers:H},type:Re}],type:X},{error:"FIPS is enabled but this partition does not support FIPS",type:ae}],type:X},{conditions:ma,rules:[{conditions:[da],rules:[{endpoint:{url:"https://kms.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:H,headers:H},type:Re}],type:X},{error:"DualStack is enabled but this partition does not support DualStack",type:ae}],type:X},{endpoint:{url:"https://kms.{Region}.{PartitionResult#dnsSuffix}",properties:H,headers:H},type:Re}],type:X}],type:X},{error:"Invalid Configuration: Missing Region",type:ae}]},Ea=Ap;var Cp=new ht({size:50,params:["Endpoint","Region","UseDualStack","UseFIPS"]}),xa=(e,t={})=>Cp.get(e,()=>sa(Ea,{endpointParams:e,logger:t.logger}));Se.aws=eo;var g=class e extends qe{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype)}};var St=class e extends g{name="AlreadyExistsException";$fault="client";constructor(t){super({name:"AlreadyExistsException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},Rt=class e extends g{name="DependencyTimeoutException";$fault="server";constructor(t){super({name:"DependencyTimeoutException",$fault:"server",...t}),Object.setPrototypeOf(this,e.prototype)}},_t=class e extends g{name="InvalidArnException";$fault="client";constructor(t){super({name:"InvalidArnException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},vt=class e extends g{name="KMSInternalException";$fault="server";constructor(t){super({name:"KMSInternalException",$fault:"server",...t}),Object.setPrototypeOf(this,e.prototype)}},At=class e extends g{name="KMSInvalidStateException";$fault="client";constructor(t){super({name:"KMSInvalidStateException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},Ct=class e extends g{name="NotFoundException";$fault="client";constructor(t){super({name:"NotFoundException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},wt=class e extends g{name="CloudHsmClusterInUseException";$fault="client";constructor(t){super({name:"CloudHsmClusterInUseException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},It=class e extends g{name="CloudHsmClusterInvalidConfigurationException";$fault="client";constructor(t){super({name:"CloudHsmClusterInvalidConfigurationException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},Pt=class e extends g{name="CloudHsmClusterNotActiveException";$fault="client";constructor(t){super({name:"CloudHsmClusterNotActiveException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},Dt=class e extends g{name="CloudHsmClusterNotFoundException";$fault="client";constructor(t){super({name:"CloudHsmClusterNotFoundException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},Tt=class e extends g{name="CloudHsmClusterNotRelatedException";$fault="client";constructor(t){super({name:"CloudHsmClusterNotRelatedException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},Ot=class e extends g{name="ConflictException";$fault="client";constructor(t){super({name:"ConflictException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},bt=class e extends g{name="CustomKeyStoreInvalidStateException";$fault="client";constructor(t){super({name:"CustomKeyStoreInvalidStateException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},Kt=class e extends g{name="CustomKeyStoreNotFoundException";$fault="client";constructor(t){super({name:"CustomKeyStoreNotFoundException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},Nt=class e extends g{name="InvalidAliasNameException";$fault="client";constructor(t){super({name:"InvalidAliasNameException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},$t=class e extends g{name="LimitExceededException";$fault="client";constructor(t){super({name:"LimitExceededException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},kt=class e extends g{name="CustomKeyStoreNameInUseException";$fault="client";constructor(t){super({name:"CustomKeyStoreNameInUseException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},Mt=class e extends g{name="IncorrectTrustAnchorException";$fault="client";constructor(t){super({name:"IncorrectTrustAnchorException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},Ut=class e extends g{name="XksProxyIncorrectAuthenticationCredentialException";$fault="client";constructor(t){super({name:"XksProxyIncorrectAuthenticationCredentialException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},Lt=class e extends g{name="XksProxyInvalidConfigurationException";$fault="client";constructor(t){super({name:"XksProxyInvalidConfigurationException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},Ft=class e extends g{name="XksProxyInvalidResponseException";$fault="client";constructor(t){super({name:"XksProxyInvalidResponseException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},Gt=class e extends g{name="XksProxyUriEndpointInUseException";$fault="client";constructor(t){super({name:"XksProxyUriEndpointInUseException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},Ht=class e extends g{name="XksProxyUriInUseException";$fault="client";constructor(t){super({name:"XksProxyUriInUseException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},Vt=class e extends g{name="XksProxyUriUnreachableException";$fault="client";constructor(t){super({name:"XksProxyUriUnreachableException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},jt=class e extends g{name="XksProxyVpcEndpointServiceInUseException";$fault="client";constructor(t){super({name:"XksProxyVpcEndpointServiceInUseException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},qt=class e extends g{name="XksProxyVpcEndpointServiceInvalidConfigurationException";$fault="client";constructor(t){super({name:"XksProxyVpcEndpointServiceInvalidConfigurationException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},Xt=class e extends g{name="XksProxyVpcEndpointServiceNotFoundException";$fault="client";constructor(t){super({name:"XksProxyVpcEndpointServiceNotFoundException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},zt=class e extends g{name="DisabledException";$fault="client";constructor(t){super({name:"DisabledException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},Wt=class e extends g{name="DryRunOperationException";$fault="client";constructor(t){super({name:"DryRunOperationException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},Bt=class e extends g{name="InvalidGrantTokenException";$fault="client";constructor(t){super({name:"InvalidGrantTokenException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},Jt=class e extends g{name="MalformedPolicyDocumentException";$fault="client";constructor(t){super({name:"MalformedPolicyDocumentException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},Qt=class e extends g{name="TagException";$fault="client";constructor(t){super({name:"TagException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},Yt=class e extends g{name="UnsupportedOperationException";$fault="client";constructor(t){super({name:"UnsupportedOperationException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},Zt=class e extends g{name="XksKeyAlreadyInUseException";$fault="client";constructor(t){super({name:"XksKeyAlreadyInUseException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},er=class e extends g{name="XksKeyInvalidConfigurationException";$fault="client";constructor(t){super({name:"XksKeyInvalidConfigurationException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},tr=class e extends g{name="XksKeyNotFoundException";$fault="client";constructor(t){super({name:"XksKeyNotFoundException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},rr=class e extends g{name="CustomKeyStoreHasCMKsException";$fault="client";constructor(t){super({name:"CustomKeyStoreHasCMKsException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},or=class e extends g{name="IncorrectKeyException";$fault="client";constructor(t){super({name:"IncorrectKeyException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},nr=class e extends g{name="InvalidCiphertextException";$fault="client";constructor(t){super({name:"InvalidCiphertextException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},sr=class e extends g{name="InvalidKeyUsageException";$fault="client";constructor(t){super({name:"InvalidKeyUsageException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},ir=class e extends g{name="KeyUnavailableException";$fault="server";constructor(t){super({name:"KeyUnavailableException",$fault:"server",...t}),Object.setPrototypeOf(this,e.prototype)}},ar=class e extends g{name="InvalidMarkerException";$fault="client";constructor(t){super({name:"InvalidMarkerException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},cr=class e extends g{name="ExpiredImportTokenException";$fault="client";constructor(t){super({name:"ExpiredImportTokenException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},pr=class e extends g{name="IncorrectKeyMaterialException";$fault="client";constructor(t){super({name:"IncorrectKeyMaterialException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},ur=class e extends g{name="InvalidImportTokenException";$fault="client";constructor(t){super({name:"InvalidImportTokenException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},dr=class e extends g{name="InvalidGrantIdException";$fault="client";constructor(t){super({name:"InvalidGrantIdException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},lr=class e extends g{name="KMSInvalidMacException";$fault="client";constructor(t){super({name:"KMSInvalidMacException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},mr=class e extends g{name="KMSInvalidSignatureException";$fault="client";constructor(t){super({name:"KMSInvalidSignatureException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}};var wp="AttestationDocument",Ip="AlreadyExistsException";var Sa="CiphertextBlob";var Pp="ConflictException";var Ra="CiphertextForRecipient";var Dp="CloudHsmClusterInvalidConfigurationException",Tp="CloudHsmClusterInUseException",Op="CloudHsmClusterNotActiveException",bp="CloudHsmClusterNotFoundException",Kp="CloudHsmClusterNotRelatedException";var Np="CustomKeyStoreHasCMKsException";var $p="CustomKeyStoreInvalidStateException";var kp="CustomKeyStoreNotFoundException",Mp="CustomKeyStoreNameInUseException";var Up="DisabledException";var _a="DryRun",Lp="DryRunModifiers",Fp="DryRunOperationException",Gp="DecryptRequest",Hp="DecryptResponse";var Vp="DependencyTimeoutException",jp="Decrypt";var va="EncryptionAlgorithm";var Aa="EncryptionContext";var qp="ExpiredImportTokenException";var Xp="GenerateDataKey";var zp="GenerateDataKeyRequest",Wp="GenerateDataKeyResponse";var Ca="GrantTokens";var Bp="InvalidArnException",Jp="InvalidAliasNameException",Qp="InvalidCiphertextException",Yp="InvalidGrantIdException",Zp="InvalidGrantTokenException",eu="InvalidImportTokenException",tu="IncorrectKeyException";var ru="IncorrectKeyMaterialException";var ou="InvalidKeyUsageException",nu="InvalidMarkerException";var su="IncorrectTrustAnchorException";var iu="KeyEncryptionAlgorithm",fr="KeyId";var wa="KeyMaterialId";var au="KMSInternalException",cu="KMSInvalidMacException",pu="KMSInvalidSignatureException",uu="KMSInvalidStateException";var du="KeySpec";var lu="KeyUnavailableException";var mu="LimitExceededException";var fu="MalformedPolicyDocumentException";var gu="NotFoundException";var hu="NumberOfBytes";var yu="PlaintextType";var Ia="Plaintext",Pa="Recipient";var Eu="RecipientInfo";var xu="TagException";var Su="UnsupportedOperationException";var Ru="XksKeyAlreadyInUseException";var _u="XksKeyInvalidConfigurationException",vu="XksKeyNotFoundException";var Au="XksProxyIncorrectAuthenticationCredentialException",Cu="XksProxyInvalidConfigurationException",wu="XksProxyInvalidResponseException";var Iu="XksProxyUriEndpointInUseException",Pu="XksProxyUriInUseException";var Du="XksProxyUriUnreachableException",Tu="XksProxyVpcEndpointServiceInvalidConfigurationException",Ou="XksProxyVpcEndpointServiceInUseException";var bu="XksProxyVpcEndpointServiceNotFoundException";var y="awsQueryError",_="client",E="error",x="httpError",S="message",Da="smithy.ts.sdk.synthetic.com.amazonaws.kms",io="server",m="com.amazonaws.kms",Ta=ge.for(Da),Ku=[-3,Da,"KMSServiceException",0,[],[]];Ta.registerError(Ku,g);var h=ge.for(m),Nu=[-3,m,Ip,{[y]:["AlreadyExists",409],[E]:_,[x]:409},[S],[0]];h.registerError(Nu,St);var $u=[-3,m,Tp,{[y]:["CloudHsmClusterInUseException",400],[E]:_,[x]:400},[S],[0]];h.registerError($u,wt);var ku=[-3,m,Dp,{[y]:["CloudHsmClusterInvalidConfigurationException",400],[E]:_,[x]:400},[S],[0]];h.registerError(ku,It);var Mu=[-3,m,Op,{[y]:["CloudHsmClusterNotActiveException",400],[E]:_,[x]:400},[S],[0]];h.registerError(Mu,Pt);var Uu=[-3,m,bp,{[y]:["CloudHsmClusterNotFoundException",400],[E]:_,[x]:400},[S],[0]];h.registerError(Uu,Dt);var Lu=[-3,m,Kp,{[y]:["CloudHsmClusterNotRelatedException",400],[E]:_,[x]:400},[S],[0]];h.registerError(Lu,Tt);var Fu=[-3,m,Pp,{[y]:["ConflictException",409],[E]:_,[x]:409},[S],[0]];h.registerError(Fu,Ot);var Gu=[-3,m,Np,{[y]:["CustomKeyStoreHasCMKsException",400],[E]:_,[x]:400},[S],[0]];h.registerError(Gu,rr);var Hu=[-3,m,$p,{[y]:["CustomKeyStoreInvalidStateException",400],[E]:_,[x]:400},[S],[0]];h.registerError(Hu,bt);var Vu=[-3,m,Mp,{[y]:["CustomKeyStoreNameInUseException",400],[E]:_,[x]:400},[S],[0]];h.registerError(Vu,kt);var ju=[-3,m,kp,{[y]:["CustomKeyStoreNotFoundException",400],[E]:_,[x]:400},[S],[0]];h.registerError(ju,Kt);var qu=[-3,m,Vp,{[y]:["DependencyTimeout",503],[E]:io,[x]:503},[S],[0]];h.registerError(qu,Rt);var Xu=[-3,m,Up,{[y]:["Disabled",409],[E]:_,[x]:409},[S],[0]];h.registerError(Xu,zt);var zu=[-3,m,Fp,{[y]:["DryRunOperation",412],[E]:_,[x]:412},[S],[0]];h.registerError(zu,Wt);var Wu=[-3,m,qp,{[y]:["ExpiredImportTokenException",400],[E]:_,[x]:400},[S],[0]];h.registerError(Wu,cr);var Bu=[-3,m,tu,{[y]:["IncorrectKeyException",400],[E]:_,[x]:400},[S],[0]];h.registerError(Bu,or);var Ju=[-3,m,ru,{[y]:["IncorrectKeyMaterialException",400],[E]:_,[x]:400},[S],[0]];h.registerError(Ju,pr);var Qu=[-3,m,su,{[y]:["IncorrectTrustAnchorException",400],[E]:_,[x]:400},[S],[0]];h.registerError(Qu,Mt);var Yu=[-3,m,Jp,{[y]:["InvalidAliasName",400],[E]:_,[x]:400},[S],[0]];h.registerError(Yu,Nt);var Zu=[-3,m,Bp,{[y]:["InvalidArn",400],[E]:_,[x]:400},[S],[0]];h.registerError(Zu,_t);var ed=[-3,m,Qp,{[y]:["InvalidCiphertext",400],[E]:_,[x]:400},[S],[0]];h.registerError(ed,nr);var td=[-3,m,Yp,{[y]:["InvalidGrantId",400],[E]:_,[x]:400},[S],[0]];h.registerError(td,dr);var rd=[-3,m,Zp,{[y]:["InvalidGrantToken",400],[E]:_,[x]:400},[S],[0]];h.registerError(rd,Bt);var od=[-3,m,eu,{[y]:["InvalidImportTokenException",400],[E]:_,[x]:400},[S],[0]];h.registerError(od,ur);var nd=[-3,m,ou,{[y]:["InvalidKeyUsage",400],[E]:_,[x]:400},[S],[0]];h.registerError(nd,sr);var sd=[-3,m,nu,{[y]:["InvalidMarker",400],[E]:_,[x]:400},[S],[0]];h.registerError(sd,ar);var id=[-3,m,lu,{[y]:["KeyUnavailable",500],[E]:io,[x]:500},[S],[0]];h.registerError(id,ir);var ad=[-3,m,au,{[y]:["KMSInternal",500],[E]:io,[x]:500},[S],[0]];h.registerError(ad,vt);var cd=[-3,m,cu,{[y]:["KMSInvalidMac",400],[E]:_,[x]:400},[S],[0]];h.registerError(cd,lr);var pd=[-3,m,pu,{[y]:["KMSInvalidSignature",400],[E]:_,[x]:400},[S],[0]];h.registerError(pd,mr);var ud=[-3,m,uu,{[y]:["KMSInvalidStateException",409],[E]:_,[x]:409},[S],[0]];h.registerError(ud,At);var dd=[-3,m,mu,{[y]:["LimitExceeded",400],[E]:_,[x]:400},[S],[0]];h.registerError(dd,$t);var ld=[-3,m,fu,{[y]:["MalformedPolicyDocument",400],[E]:_,[x]:400},[S],[0]];h.registerError(ld,Jt);var md=[-3,m,gu,{[y]:["NotFound",404],[E]:_,[x]:404},[S],[0]];h.registerError(md,Ct);var fd=[-3,m,xu,{[y]:["TagException",400],[E]:_,[x]:400},[S],[0]];h.registerError(fd,Qt);var gd=[-3,m,Su,{[y]:["UnsupportedOperation",400],[E]:_,[x]:400},[S],[0]];h.registerError(gd,Yt);var hd=[-3,m,Ru,{[y]:["XksKeyAlreadyInUse",400],[E]:_,[x]:400},[S],[0]];h.registerError(hd,Zt);var yd=[-3,m,_u,{[y]:["XksKeyInvalidConfiguration",400],[E]:_,[x]:400},[S],[0]];h.registerError(yd,er);var Ed=[-3,m,vu,{[y]:["XksKeyNotFoundException",400],[E]:_,[x]:400},[S],[0]];h.registerError(Ed,tr);var xd=[-3,m,Au,{[y]:["XksProxyIncorrectAuthenticationCredentialException",400],[E]:_,[x]:400},[S],[0]];h.registerError(xd,Ut);var Sd=[-3,m,Cu,{[y]:["XksProxyInvalidConfigurationException",400],[E]:_,[x]:400},[S],[0]];h.registerError(Sd,Lt);var Rd=[-3,m,wu,{[y]:["XksProxyInvalidResponseException",400],[E]:_,[x]:400},[S],[0]];h.registerError(Rd,Ft);var _d=[-3,m,Iu,{[y]:["XksProxyUriEndpointInUseException",400],[E]:_,[x]:400},[S],[0]];h.registerError(_d,Gt);var vd=[-3,m,Pu,{[y]:["XksProxyUriInUseException",400],[E]:_,[x]:400},[S],[0]];h.registerError(vd,Ht);var Ad=[-3,m,Du,{[y]:["XksProxyUriUnreachableException",400],[E]:_,[x]:400},[S],[0]];h.registerError(Ad,Vt);var Cd=[-3,m,Ou,{[y]:["XksProxyVpcEndpointServiceInUseException",400],[E]:_,[x]:400},[S],[0]];h.registerError(Cd,jt);var wd=[-3,m,Tu,{[y]:["XksProxyVpcEndpointServiceInvalidConfigurationException",400],[E]:_,[x]:400},[S],[0]];h.registerError(wd,qt);var Id=[-3,m,bu,{[y]:["XksProxyVpcEndpointServiceNotFoundException",400],[E]:_,[x]:400},[S],[0]];h.registerError(Id,Xt);var Oa=[Ta,h];var ba=[0,m,yu,8,21];var Pd=[3,m,Gp,0,[Sa,Aa,Ca,fr,va,Pa,_a,Lp],[21,128,64,0,0,()=>Ka,2,64]],Dd=[3,m,Hp,0,[fr,Ia,va,Ra,wa],[0,[()=>ba,0],0,21,0]];var Td=[3,m,zp,0,[fr,Aa,hu,du,Ca,Pa,_a],[0,128,1,0,64,()=>Ka,2],1],Od=[3,m,Wp,0,[Sa,Ia,fr,Ra,wa],[21,[()=>ba,0],0,21,0]];var Ka=[3,m,Eu,0,[iu,wp],[0,21]];var Na=[9,m,jp,0,()=>Pd,()=>Dd];var $a=[9,m,Xp,0,()=>Td,()=>Od];var ka=e=>({apiVersion:"2014-11-01",base64Decoder:e?.base64Decoder??Oe,base64Encoder:e?.base64Encoder??fe,disableHostPrefix:e?.disableHostPrefix??!1,endpointProvider:e?.endpointProvider??xa,extensions:e?.extensions??[],httpAuthSchemeProvider:e?.httpAuthSchemeProvider??Fs,httpAuthSchemes:e?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:t=>t.getIdentityProvider("aws.auth#sigv4"),signer:new ye}],logger:e?.logger??new Xe,protocol:e?.protocol??gt,protocolSettings:e?.protocolSettings??{defaultNamespace:"com.amazonaws.kms",errorTypeRegistries:Oa,xmlNamespace:"https://trent.amazonaws.com/doc/2014-11-01/",version:"2014-11-01",serviceTarget:"TrentService"},serviceId:e?.serviceId??"KMS",urlParser:e?.urlParser??Yr,utf8Decoder:e?.utf8Decoder??re,utf8Encoder:e?.utf8Encoder??be});var Ma=e=>{Bn(process.version);let t=Pi(e),r=()=>t().then(zn),o=ka(e);ds(process.version);let n={profile:e?.profile,logger:o.logger};return{...o,...e,runtime:"node",defaultsMode:t,authSchemePreference:e?.authSchemePreference??Y(cs,n),bodyLengthChecker:e?.bodyLengthChecker??Go,credentialDefaultProvider:e?.credentialDefaultProvider??Ws,defaultUserAgentProvider:e?.defaultUserAgentProvider??ni({serviceId:o.serviceId,clientVersion:Vs.version}),maxAttempts:e?.maxAttempts??Y(Hn,e),region:e?.region??Y(nn,{...sn,...n}),requestHandler:it.create(e?.requestHandler??r),retryMode:e?.retryMode??Y({...jn,default:async()=>(await r()).retryMode||Di},e),sha256:e?.sha256??ot.bind(null,"sha256"),streamCollector:e?.streamCollector??_i,useDualstackEndpoint:e?.useDualstackEndpoint??Y(rn,n),useFipsEndpoint:e?.useFipsEndpoint??Y(on,n),userAgentAppId:e?.userAgentAppId??Y(si,n)}};var Ua=e=>({setRegion(t){e.region=t},region(){return e.region}}),La=e=>({region:e.region()});var Fa=e=>({setHttpHandler(t){e.httpHandler=t},httpHandler(){return e.httpHandler},updateHttpClientConfig(t,r){e.httpHandler?.updateHttpClientConfig(t,r)},httpHandlerConfigs(){return e.httpHandler.httpHandlerConfigs()}}),Ga=e=>({httpHandler:e.httpHandler()});var Ha=e=>{let t=e.httpAuthSchemes,r=e.httpAuthSchemeProvider,o=e.credentials;return{setHttpAuthScheme(n){let s=t.findIndex(i=>i.schemeId===n.schemeId);s===-1?t.push(n):t.splice(s,1,n)},httpAuthSchemes(){return t},setHttpAuthSchemeProvider(n){r=n},httpAuthSchemeProvider(){return r},setCredentials(n){o=n},credentials(){return o}}},Va=e=>({httpAuthSchemes:e.httpAuthSchemes(),httpAuthSchemeProvider:e.httpAuthSchemeProvider(),credentials:e.credentials()});var ja=(e,t)=>{let r=Object.assign(Ua(e),ts(e),Fa(e),Ha(e));return t.forEach(o=>o.configure(r)),Object.assign(e,La(r),rs(r),Ga(r),Va(r))};var gr=class extends Ve{config;constructor(...[t]){let r=Ma(t||{});super(r),this.initConfig=r;let o=Hs(r),n=Wo(o),s=Vn(n),i=un(s),a=i,c=On(a),p=Gs(c),d=ja(p,t?.extensions||[]);this.config=d,this.middlewareStack.use(xn(this.config)),this.middlewareStack.use(tn(this.config)),this.middlewareStack.use(Xn(this.config)),this.middlewareStack.use(vn(this.config)),this.middlewareStack.use(Ho(this.config)),this.middlewareStack.use(Vo(this.config)),this.middlewareStack.use(Xo(this.config)),this.middlewareStack.use(mn(this.config,{httpAuthSchemeParametersProvider:Ls,identityProviderConfigProvider:async u=>new Ue({"aws.auth#sigv4":u.credentials})})),this.middlewareStack.use(gn(this.config))}destroy(){super.destroy()}};var hr=class extends oe.classBuilder().ep(tt).m(function(t,r,o,n){return[Ge(o,t.getEndpointParameterInstructions())]}).s("TrentService","Decrypt",{}).n("KMSClient","DecryptCommand").sc(Na).build(){};var ve=class extends oe.classBuilder().ep(tt).m(function(t,r,o,n){return[Ge(o,t.getEndpointParameterInstructions())]}).s("TrentService","GenerateDataKey",{}).n("KMSClient","GenerateDataKeyCommand").sc($a).build(){};var qa=class{name="aws-kms";client;keyId;keyVersion;constructor(t){let r=t.keyId??process.env.AWS_KMS_KEY_ID??process.env.AWS_KMS_KEY_ARN;if(!r)throw new Error("AWS KMS Key ID or ARN required. Set AWS_KMS_KEY_ID or pass keyId in config.");this.keyId=r,this.keyVersion=t.keyVersion??1;let o=t.region??process.env.AWS_REGION??"us-east-1";this.client=new gr({region:o,...t.credentials&&{credentials:{accessKeyId:t.credentials.accessKeyId,secretAccessKey:t.credentials.secretAccessKey}}}),N.debug("[vault:aws-kms] Initialized",{keyId:r,region:o,keyVersion:this.keyVersion})}async encrypt(t,r){try{let o=await this.client.send(new ve({KeyId:this.keyId,KeySpec:"AES_256"})),n=o.Plaintext,s=o.CiphertextBlob;if(!n||!s)throw new Error("AWS KMS GenerateDataKey returned empty DEK");let i=co(t,n),a={id:r?.id??bd(),ciphertext:ce(i.ciphertext),encryptedDek:ce(s),iv:ce(i.iv),authTag:ce(i.authTag),keyVersion:this.keyVersion,algorithm:"aes-256-gcm",...r?.tenantId!==void 0?{tenantId:r.tenantId}:{},metadata:r?.metadata,createdAt:new Date().toISOString()};return N.debug("[vault:aws-kms] Secret encrypted",{id:a.id,tenantId:r?.tenantId}),a}catch(o){throw N.error("[vault:aws-kms] Encryption failed",{error:o}),new Error(`AWS KMS encryption failed: ${o instanceof Error?o.message:String(o)}`)}}async decrypt(t,r){try{if(r?.tenantId&&t.tenantId&&t.tenantId!==r.tenantId)throw new Error("Tenant ID mismatch");let n=(await this.client.send(new hr({CiphertextBlob:pe(t.encryptedDek)}))).Plaintext;if(!n)throw new Error("AWS KMS Decrypt returned empty DEK");let s=po(pe(t.ciphertext),n,{iv:pe(t.iv),authTag:pe(t.authTag)});return N.debug("[vault:aws-kms] Secret decrypted",{id:t.id,tenantId:r?.tenantId}),s.toString("utf-8")}catch(o){throw N.error("[vault:aws-kms] Decryption failed",{error:o}),new Error(`AWS KMS decryption failed: ${o instanceof Error?o.message:String(o)}`)}}async rotateKey(t){try{let r=await this.decrypt(t),o=await this.encrypt(r,{id:t.id,...t.tenantId!==void 0?{tenantId:t.tenantId}:{},metadata:t.metadata});return o.rotatedAt=new Date().toISOString(),N.debug("[vault:aws-kms] Key rotated",{id:t.id}),o}catch(r){throw N.error("[vault:aws-kms] Key rotation failed",{error:r}),new Error(`Key rotation failed: ${r instanceof Error?r.message:String(r)}`)}}async rotateKek(){this.keyVersion+=1,N.info("[vault:aws-kms] KEK rotated",{newVersion:this.keyVersion})}async generateDek(){try{return(await this.client.send(new ve({KeyId:this.keyId,KeySpec:"AES_256"}))).Plaintext}catch(t){throw N.error("[vault:aws-kms] DEK generation failed",{error:t}),new Error(`DEK generation failed: ${t instanceof Error?t.message:String(t)}`)}}async close(){this.client.destroy(),N.debug("[vault:aws-kms] Closed")}};export{qa as a};
@@ -0,0 +1 @@
1
+ var g=Object.create;var e=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var j=Object.getPrototypeOf,k=Object.prototype.hasOwnProperty;var m=(a=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(a,{get:(b,c)=>(typeof require<"u"?require:b)[c]}):a)(function(a){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+a+'" is not supported')});var n=(a,b)=>()=>{try{return b||a((b={exports:{}}).exports,b),b.exports}catch(c){throw b=0,c}},o=(a,b)=>{for(var c in b)e(a,c,{get:b[c],enumerable:!0})},l=(a,b,c,f)=>{if(b&&typeof b=="object"||typeof b=="function")for(let d of i(b))!k.call(a,d)&&d!==c&&e(a,d,{get:()=>b[d],enumerable:!(f=h(b,d))||f.enumerable});return a};var p=(a,b,c)=>(c=a!=null?g(j(a)):{},l(b||!a||!a.__esModule?e(c,"default",{value:a,enumerable:!0}):c,a));export{m as a,n as b,o as c,p as d};
@@ -0,0 +1 @@
1
+ var S;(function(s){s.PROFILE="profile",s.SSO_SESSION="sso-session",s.SERVICES="services"})(S||(S={}));export{S as a};
@@ -1 +1 @@
1
- import{a as _}from"./chunk-3T4EOSMQ.js";import{b as S}from"./chunk-TX7AAHER.js";var p="AWS_ACCESS_KEY_ID",A="AWS_SECRET_ACCESS_KEY",C="AWS_SESSION_TOKEN",N="AWS_CREDENTIAL_EXPIRATION",a="AWS_CREDENTIAL_SCOPE",i="AWS_ACCOUNT_ID",v=e=>async()=>{e?.logger?.debug("@aws-sdk/credential-provider-env - fromEnv");let o=process.env[p],r=process.env[A],n=process.env[C],s=process.env[N],t=process.env[a],E=process.env[i];if(o&&r){let c={accessKeyId:o,secretAccessKey:r,...n&&{sessionToken:n},...s&&{expiration:new Date(s)},...t&&{credentialScope:t},...E&&{accountId:E}};return _(c,"CREDENTIALS_ENV_VARS","g"),c}throw new S("Unable to find environment variable credentials.",{logger:e?.logger})};export{p as a,A as b,C as c,N as d,a as e,i as f,v as g};
1
+ import{a as _}from"./chunk-SPHQRDN5.js";import{b as S}from"./chunk-TX7AAHER.js";var p="AWS_ACCESS_KEY_ID",A="AWS_SECRET_ACCESS_KEY",C="AWS_SESSION_TOKEN",N="AWS_CREDENTIAL_EXPIRATION",a="AWS_CREDENTIAL_SCOPE",i="AWS_ACCOUNT_ID",v=e=>async()=>{e?.logger?.debug("@aws-sdk/credential-provider-env - fromEnv");let o=process.env[p],r=process.env[A],n=process.env[C],s=process.env[N],t=process.env[a],E=process.env[i];if(o&&r){let c={accessKeyId:o,secretAccessKey:r,...n&&{sessionToken:n},...s&&{expiration:new Date(s)},...t&&{credentialScope:t},...E&&{accountId:E}};return _(c,"CREDENTIALS_ENV_VARS","g"),c}throw new S("Unable to find environment variable credentials.",{logger:e?.logger})};export{p as a,A as b,C as c,N as d,a as e,i as f,v as g};
@@ -0,0 +1 @@
1
+ import{a as R}from"./chunk-JTXBZ2SU.js";import{d as ee,e as w}from"./chunk-FNDUJLS6.js";import{s as v}from"./chunk-HGJYEXMU.js";var _=class e extends Error{name="ProviderError";tryNextLink;constructor(t,r=!0){let o,i=!0;typeof r=="boolean"?(o=void 0,i=r):r!=null&&typeof r=="object"&&(o=r.logger,i=r.tryNextLink??!0),super(t),this.tryNextLink=i,Object.setPrototypeOf(this,e.prototype),o?.debug?.(`@smithy/property-provider ${i?"->":"(!)"} ${t}`)}static from(t,r=!0){return Object.assign(new this(t.message,r),t)}};var te=(...e)=>async()=>{if(e.length===0)throw new _("No providers in chain");let t;for(let r of e)try{return await r()}catch(o){if(t=o,o?.tryNextLink)continue;throw o}throw t};var C=(e,t,r)=>{let o,i,n,s=!1,a=async()=>{i||(i=e());try{o=await i,n=!0,s=!1}finally{i=void 0}return o};return t===void 0?async c=>((!n||c?.forceRefresh)&&(o=await a()),o):async c=>((!n||c?.forceRefresh)&&(o=await a()),s?o:r&&!r(o)?(s=!0,o):(t(o)&&await a(),o))};var h=class e extends _{name="CredentialsProviderError";constructor(t,r=!0){super(t,r),Object.setPrototypeOf(this,e.prototype)}};function T(e){try{let t=new Set(Array.from(e.match(/([A-Z_]){3,}/g)??[]));return t.delete("CONFIG"),t.delete("CONFIG_PREFIX_SEPARATOR"),t.delete("ENV"),[...t].join(", ")}catch{return e}}var re=(e,t)=>async()=>{try{let r=e(process.env,t);if(r===void 0)throw new Error;return r}catch(r){throw new h(r.message||`Not found in ENV: ${T(e.toString())}`,{logger:t?.logger})}};var ft="AWS_PROFILE",pt="default",oe=e=>e.profile||process.env[ft]||pt;import{join as ce}from"path";var N;(function(e){e.HTTP="http",e.HTTPS="https"})(N||(N={}));var ne=e=>Object.entries(e).filter(([t])=>{let r=t.indexOf(".");return r===-1?!1:Object.values(R).includes(t.substring(0,r))}).reduce((t,[r,o])=>{let i=r.indexOf("."),n=r.substring(0,i)===R.PROFILE?r.substring(i+1):r;return t[n]=o,t},{...e.default&&{default:e.default}});import{join as mt}from"path";import{homedir as lt}from"os";import{sep as dt}from"path";var V={},ut=()=>process&&process.geteuid?`${process.geteuid()}`:"DEFAULT",x=()=>{let{HOME:e,USERPROFILE:t,HOMEPATH:r,HOMEDRIVE:o=`C:${dt}`}=process.env;if(e)return e;if(t)return t;if(r)return`${o}${r}`;let i=ut();return V[i]||(V[i]=lt()),V[i]};var Et="AWS_CONFIG_FILE",ie=()=>process.env[Et]||mt(x(),".aws","config");import{join as gt}from"path";var _t="AWS_SHARED_CREDENTIALS_FILE",se=()=>process.env[_t]||gt(x(),".aws","credentials");var ht=/^([\w-]+)\s(["'])?([\w-@\+\.%:/]+)\2$/,Nt=["__proto__","profile __proto__"],G=e=>{let t={},r,o;for(let i of e.split(/\r?\n/)){let n=i.split(/(^|\s)[;#]/)[0].trim();if(n[0]==="["&&n[n.length-1]==="]"){r=void 0,o=void 0;let a=n.substring(1,n.length-1),c=ht.exec(a);if(c){let[,f,,l]=c;Object.values(R).includes(f)&&(r=[f,l].join("."))}else r=a;if(Nt.includes(a))throw new Error(`Found invalid profile name "${a}"`)}else if(r){let a=n.indexOf("=");if(![0,-1].includes(a)){let[c,f]=[n.substring(0,a).trim(),n.substring(a+1).trim()];if(f==="")o=c;else{o&&i.trimStart()===i&&(o=void 0),t[r]=t[r]||{};let l=o?[o,c].join("."):c;t[r][l]=f}}}}return t};import{readFile as xt}from"fs/promises";var M={},ae={},H=(e,t)=>ae[e]!==void 0?ae[e]:((!M[e]||t?.ignoreCache)&&(M[e]=xt(e,"utf8")),M[e]);var fe=()=>({}),pe=async(e={})=>{let{filepath:t=se(),configFilepath:r=ie()}=e,o=x(),i="~/",n=t;t.startsWith(i)&&(n=ce(o,t.slice(2)));let s=r;r.startsWith(i)&&(s=ce(o,r.slice(2)));let a=await Promise.all([H(s,{ignoreCache:e.ignoreCache}).then(G).then(ne).catch(fe),H(n,{ignoreCache:e.ignoreCache}).then(G).catch(fe)]);return{configFile:a[0],credentialsFile:a[1]}};var le=(e,{preferredFile:t="config",...r}={})=>async()=>{let o=oe(r),{configFile:i,credentialsFile:n}=await pe(r),s=n[o]||{},a=i[o]||{},c=t==="config"?{...s,...a}:{...a,...s};try{let l=e(c,t==="config"?i:n);if(l===void 0)throw new Error;return l}catch(f){throw new h(f.message||`Not found in config files w/ profile [${o}]: ${T(e.toString())}`,{logger:r.logger})}};var de=e=>()=>Promise.resolve(e);var St=e=>typeof e=="function",ue=e=>St(e)?async()=>await e():de(e);var E=({environmentVariableSelector:e,configFileSelector:t,default:r},o={})=>{let{signingName:i,logger:n}=o;return C(te(re(e,{signingName:i,logger:n}),le(t,o),ue(r)))};var S=(e,t,r)=>{if(t in e){if(e[t]==="true")return!0;if(e[t]==="false")return!1;throw new Error(`Cannot load ${r} "${t}". Expected "true" or "false", got ${e[t]}.`)}};var m;(function(e){e.ENV="env",e.CONFIG="shared config entry"})(m||(m={}));var me="AWS_USE_DUALSTACK_ENDPOINT",Ee="use_dualstack_endpoint";var Ot={environmentVariableSelector:e=>S(e,me,m.ENV),configFileSelector:e=>S(e,Ee,m.CONFIG),default:!1};var ge="AWS_USE_FIPS_ENDPOINT",_e="use_fips_endpoint";var It={environmentVariableSelector:e=>S(e,ge,m.ENV),configFileSelector:e=>S(e,_e,m.CONFIG),default:!1};var he="AWS_REGION",Ne="region",j={environmentVariableSelector:e=>e[he],configFileSelector:e=>e[Ne],default:()=>{throw new Error("Region is missing")}},Rt={preferredFile:"credentials"};var xe="AWS_EXECUTION_ENV",k="AWS_REGION",W="AWS_DEFAULT_REGION",Se="AWS_EC2_METADATA_DISABLED",Oe=["in-region","cross-region","mobile","standard","legacy"],Ie="/latest/meta-data/placement/region";var Pt="AWS_DEFAULTS_MODE",Ft="defaults_mode",Re={environmentVariableSelector:e=>e[Pt],configFileSelector:e=>e[Ft],default:"legacy"};var At=({region:e=E(j),defaultsMode:t=E(Re)}={})=>C(async()=>{let r=typeof t=="function"?await t():t;switch(r?.toLowerCase()){case"auto":return wt(e);case"in-region":case"cross-region":case"mobile":case"standard":case"legacy":return Promise.resolve(r?.toLocaleLowerCase());case void 0:return Promise.resolve("legacy");default:throw new Error(`Invalid parameter for "defaultsMode", expect ${Oe.join(", ")}, got ${r}`)}}),wt=async e=>{if(e){let t=typeof e=="function"?await e():e,r=await vt();return r?t===r?"in-region":"cross-region":"standard"}return"standard"},vt=async()=>{if(process.env[xe]&&(process.env[k]||process.env[W]))return process.env[k]??process.env[W];if(!process.env[Se])try{let e=await Ct();return(await Tt({hostname:e.hostname,path:Ie})).toString()}catch{}},Ct=async()=>{let e=process.env.AWS_EC2_METADATA_SERVICE_ENDPOINT;if(e){let r=new URL(e);return{hostname:r.hostname,path:r.pathname}}return process.env.AWS_EC2_METADATA_SERVICE_ENDPOINT_MODE==="IPv6"?{hostname:"fd00:ec2::254",path:"/"}:{hostname:"169.254.169.254",path:"/"}},Tt=async({hostname:e,path:t})=>{let{request:r}=await import("http");return new Promise((o,i)=>{let n=r({method:"GET",hostname:e.replace(/^\[(.+)]$/,"$1"),path:t,timeout:1e3,signal:AbortSignal.timeout(1e3)});n.on("error",s=>{i(s),n.destroy()}),n.on("timeout",()=>{i(new Error("TimeoutError from instance metadata service")),n.destroy()}),n.on("response",s=>{let{statusCode:a=400}=s;if(a<200||300<=a){i(Object.assign(new Error("Error response received from instance metadata service"),{statusCode:a})),n.destroy();return}let c=[];s.on("data",f=>c.push(f)),s.on("end",()=>{o(Buffer.concat(c)),n.destroy()})}),n.end()})};var Pe="AWS_ENDPOINT_URL",Fe="endpoint_url",Ae=e=>({environmentVariableSelector:t=>{let r=e.split(" ").map(n=>n.toUpperCase()),o=t[[Pe,...r].join("_")];if(o)return o;let i=t[Pe];if(i)return i},configFileSelector:(t,r)=>{if(r&&t.services){let i=r[["services",t.services].join(".")];if(i){let n=e.split(" ").map(a=>a.toLowerCase()),s=i[[n.join("_"),Fe].join(".")];if(s)return s}}let o=t[Fe];if(o)return o},default:void 0});var F=async e=>E(Ae(e??""))();var we=async e=>{let t=e?.Bucket||"";if(typeof e.Bucket=="string"&&(e.Bucket=t.replace(/#/g,encodeURIComponent("#")).replace(/\?/g,encodeURIComponent("?"))),$t(t)){if(e.ForcePathStyle===!0)throw new Error("Path-style addressing cannot be used with ARN buckets")}else(!Lt(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},yt=/^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/,bt=/(\d+\.){3}\d+/,Ut=/\.\./;var Lt=e=>yt.test(e)&&!bt.test(e)&&!Ut.test(e),$t=e=>{let[t,r,o,,,i]=e.split(":"),n=t==="arn"&&e.split(":").length>=6,s=!!(n&&r&&o&&i);if(n&&!s)throw new Error(`Invalid ARN: ${e} was an invalid ARN.`);return s};var ve=(e,t,r,o=!1)=>{let i=async()=>{let n;return o?n=r.clientContextParams?.[e]??r[e]??r[t]:n=r[e]??r[t],typeof n=="function"?n():n};return e==="credentialScope"||t==="CredentialScope"?async()=>{let n=typeof r.credentials=="function"?await r.credentials():r.credentials;return n?.credentialScope??n?.CredentialScope}:e==="accountId"||t==="AccountId"?async()=>{let n=typeof r.credentials=="function"?await r.credentials():r.credentials;return n?.accountId??n?.AccountId}:e==="endpoint"||t==="endpoint"?async()=>{if(r.isCustomEndpoint===!1)return;let n=await i();if(n&&typeof n=="object"){if("url"in n)return n.url.href;if("hostname"in n){let{protocol:s,hostname:a,port:c,path:f}=n;return`${s}//${a}${c?":"+c:""}${f}`}}return n}:i};var A=e=>{if(typeof e=="object"){if("url"in e){let t=v(e.url);if(e.headers){t.headers={};for(let r in e.headers)t.headers[r.toLowerCase()]=e.headers[r].join(", ")}return t}return e}return v(e)};function D(e){return async(t,r,o,i)=>{if(!o.isCustomEndpoint){let a;o.serviceConfiguredEndpoint?a=await o.serviceConfiguredEndpoint():a=await e(o.serviceId),a&&(o.endpoint=()=>Promise.resolve(A(a)),o.isCustomEndpoint=!0)}let n=await Vt(t,r,o);if(typeof o.endpointProvider!="function")throw new Error("config.endpointProvider is not set.");let s=o.endpointProvider(n,i);if(o.isCustomEndpoint&&o.endpoint){let a=await o.endpoint();if(a?.headers){s.headers??={};for(let[c,f]of Object.entries(a.headers))s.headers[c]=Array.isArray(f)?f:[f]}}return s}}var Vt=async(e,t,r)=>{let o={},i=t?.getEndpointParameterInstructions?.()||{};for(let[n,s]of Object.entries(i))switch(s.type){case"staticContextParams":o[n]=s.value;break;case"contextParams":o[n]=e[s.name];break;case"clientContextParams":case"builtInParams":o[n]=await ve(s.name,n,r,s.type!=="builtInParams")();break;case"operationContextParams":o[n]=s.get(e);break;default:throw new Error("Unrecognized endpoint parameter instruction: "+JSON.stringify(s))}return Object.keys(i).length===0&&Object.assign(o,r),String(r.serviceId).toLowerCase()==="s3"&&await we(o),o};function Gt(e,t,r){e.__smithy_context?e.__smithy_context.features||(e.__smithy_context.features={}):e.__smithy_context={features:{}},e.__smithy_context.features[t]=r}function y(e){let t=D(e);return({config:r,instructions:o})=>(i,n)=>async s=>{r.isCustomEndpoint&&Gt(n,"ENDPOINT_OVERRIDE","N");let a=await t(s.input,{getEndpointParameterInstructions(){return o}},{...r},n);n.endpointV2=a,n.authSchemes=a.properties?.authSchemes;let c=n.authSchemes?.[0];if(c){n.signing_region=c.signingRegion,n.signing_service=c.signingName;let l=ee(n)?.selectedHttpAuthScheme?.httpAuthOption;l&&(l.signingProperties=Object.assign(l.signingProperties||{},{signing_region:c.signingRegion,signingRegion:c.signingRegion,signing_service:c.signingName,signingName:c.signingName,signingRegionSet:c.signingRegionSet},c.properties))}return i({...s})}}var Mt={name:"serializerMiddleware",step:"serialize",tags:["SERIALIZER"],override:!0},Ht={step:"serialize",tags:["ENDPOINT_PARAMETERS","ENDPOINT_V2","ENDPOINT"],name:"endpointV2Middleware",override:!0,relation:"before",toMiddleware:Mt.name};function Ce(e){let t=y(e);return(r,o)=>({applyToStack:i=>{i.addRelativeTo(t({config:r,instructions:o}),Ht)}})}function Te(e){return t=>{let r=t.tls??!0,{endpoint:o,useDualstackEndpoint:i,useFipsEndpoint:n}=t,s=o!=null?async()=>A(await w(o)()):void 0,c=Object.assign(t,{endpoint:s,tls:r,isCustomEndpoint:!!o,useDualstackEndpoint:w(i??!1),useFipsEndpoint:w(n??!1)}),f;return c.serviceConfiguredEndpoint=async()=>(t.serviceId&&!f&&(f=e(t.serviceId)),f),c}}var z=class{capacity;data=new Map;parameters=[];constructor({size:t,params:r}){this.capacity=t??50,r&&(this.parameters=r)}get(t,r){let o=this.hash(t);if(o===!1)return r();if(!this.data.has(o)){if(this.data.size>this.capacity+10){let i=this.data.keys(),n=0;for(;;){let{value:s,done:a}=i.next();if(this.data.delete(s),a||++n>10)break}}this.data.set(o,r())}return this.data.get(o)}size(){return this.data.size}hash(t){let r="",{parameters:o}=this;if(o.length===0)return!1;for(let i of o){let n=String(t[i]??"");if(n.includes("|;"))return!1;r+=n+"|;"}return r}};var p=class extends Error{constructor(t){super(t),this.name="EndpointError"}};var u="endpoints";function d(e){return typeof e!="object"||e==null?e:"ref"in e?`$${d(e.ref)}`:"fn"in e?`${e.fn}(${(e.argv||[]).map(d).join(", ")})`:JSON.stringify(e,null,2)}var B={};var De=(e,t)=>e===t;function ye(...e){for(let t of e)if(t!=null)return t}var be=e=>{let t=e.split("."),r=[];for(let o of t){let i=o.indexOf("[");if(i!==-1){if(o.indexOf("]")!==o.length-1)throw new p(`Path: '${e}' does not end with ']'`);let n=o.slice(i+1,-1);if(Number.isNaN(parseInt(n)))throw new p(`Invalid array index: '${n}' in path: '${e}'`);i!==0&&r.push(o.slice(0,i)),r.push(n)}else r.push(o)}return r};var b=(e,t)=>be(t).reduce((r,o)=>{if(typeof r!="object")throw new p(`Index '${o}' in '${t}' not found in '${JSON.stringify(e)}'`);if(Array.isArray(r)){let i=parseInt(o);return r[i<0?r.length+i:i]}return r[o]},e);var Ue=e=>e!=null;var jt=new RegExp("^(?!.*-$)(?!-)[a-zA-Z0-9-]{1,63}$"),O=(e,t=!1)=>{if(!t)return jt.test(e);let r=e.split(".");for(let o of r)if(!O(o))return!1;return!0};function Le(e,t,r){return e?t:r}var $e=e=>!e;var kt=new RegExp("^(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}$"),q=e=>kt.test(e)||e.startsWith("[")&&e.endsWith("]");var X={[N.HTTP]:80,[N.HTTPS]:443},Ve=e=>{let t=(()=>{try{if(e instanceof URL)return e;if(typeof e=="object"&&"hostname"in e){let{hostname:Z,port:Q,protocol:nt="",path:it="",query:st={}}=e,Y=new URL(`${nt}//${Z}${Q?`:${Q}`:""}${it}`);return Y.search=Object.entries(st).map(([at,ct])=>`${at}=${ct}`).join("&"),Y}return new URL(e)}catch{return null}})();if(!t)return console.error(`Unable to parse ${JSON.stringify(e)} as a whatwg URL.`),null;let r=t.href,{host:o,hostname:i,pathname:n,protocol:s,search:a}=t;if(a)return null;let c=s.slice(0,-1);if(!Object.values(N).includes(c))return null;let f=q(i),l=r.includes(`${o}:${X[c]}`)||typeof e=="string"&&e.includes(`${o}:${X[c]}`),ot=`${o}${l?`:${X[c]}`:""}`;return{scheme:c,authority:ot,path:n,normalizedPath:n.endsWith("/")?n:`${n}/`,isIp:f}};function Ge(e,t,r){if(r===1)return[e];if(e==="")return[""];let o=e.split(t);return r===0?o:o.slice(0,r-1).concat(o.slice(1).join(t))}var Me=(e,t)=>e===t;var He=(e,t,r,o)=>e==null||t>=r||e.length<r||/[^\u0000-\u007f]/.test(e)?null:o?e.substring(e.length-r,e.length-t):e.substring(t,r);var je=e=>encodeURIComponent(e).replace(/[!*'()]/g,t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`);var ke={booleanEquals:De,coalesce:ye,getAttr:b,isSet:Ue,isValidHostLabel:O,ite:Le,not:$e,parseURL:Ve,split:Ge,stringEquals:Me,substring:He,uriEncode:je};var U=(e,t)=>{let r=[],{referenceRecord:o,endpointParams:i}=t,n=0;for(;n<e.length;){let s=e.indexOf("{",n);if(s===-1){r.push(e.slice(n));break}r.push(e.slice(n,s));let a=e.indexOf("}",s);if(a===-1){r.push(e.slice(s));break}e[s+1]==="{"&&e[a+1]==="}"&&(r.push(e.slice(s+1,a)),n=a+2);let c=e.substring(s+1,a);if(c.includes("#")){let[f,l]=c.split("#");r.push(b(o[f]??i[f],l))}else r.push(o[c]??i[c]);n=a+1}return r.join("")};var We=({ref:e},t)=>t.referenceRecord[e]??t.endpointParams[e];var g=(e,t,r)=>{if(typeof e=="string")return U(e,r);if(e.fn)return ze.callFunction(e,r);if(e.ref)return We(e,r);throw new p(`'${t}': ${String(e)} is not a string, function or reference.`)},L=({fn:e,argv:t},r)=>{let o=Array(t.length);for(let s=0;s<o.length;++s){let a=t[s];typeof a=="boolean"||typeof a=="number"?o[s]=a:o[s]=ze.evaluateExpression(a,"arg",r)}let i=e.indexOf(".");if(i!==-1){let a=B[e.slice(0,i)]?.[e.slice(i+1)];if(typeof a=="function")return a(...o)}let n=ke[e];if(typeof n=="function")return n(...o);throw new Error(`function ${e} not loaded in endpointFunctions.`)},ze={evaluateExpression:g,callFunction:L};var Be=(e,t)=>{let{assign:r}=e;if(r&&r in t.referenceRecord)throw new p(`'${r}' is already defined in Reference Record.`);let o=L(e,t);t.logger?.debug?.(`${u} evaluateCondition: ${d(e)} = ${d(o)}`);let i=o===""?!0:!!o;return r!=null?{result:i,toAssign:{name:r,value:o}}:{result:i}};var qe=(e,t)=>Object.entries(e??{}).reduce((r,[o,i])=>(r[o]=i.map(n=>{let s=g(n,"Header value entry",t);if(typeof s!="string")throw new p(`Header '${o}' value '${s}' is not a string`);return s}),r),{});var K=(e,t)=>Object.entries(e).reduce((r,[o,i])=>(r[o]=Ke.getEndpointProperty(i,t),r),{}),Xe=(e,t)=>{if(Array.isArray(e))return e.map(r=>Xe(r,t));switch(typeof e){case"string":return U(e,t);case"object":if(e===null)throw new p(`Unexpected endpoint property: ${e}`);return Ke.getEndpointProperties(e,t);case"boolean":return e;default:throw new p(`Unexpected endpoint property type: ${typeof e}`)}},Ke={getEndpointProperty:Xe,getEndpointProperties:K};var Je=(e,t)=>{let r=g(e,"Endpoint URL",t);if(typeof r=="string")try{return new URL(r)}catch(o){throw console.error(`Failed to construct URL with ${r}`,o),o}throw new p(`Endpoint URL must be a string, got ${typeof r}`)};var I=(e=[],t)=>{let r={},o={...t,referenceRecord:{...t.referenceRecord}},i=!1;for(let n of e){let{result:s,toAssign:a}=Be(n,o);if(!s)return{result:s};a&&(i=!0,r[a.name]=a.value,o.referenceRecord[a.name]=a.value,t.logger?.debug?.(`${u} assign: ${a.name} := ${d(a.value)}`))}return i?{result:!0,referenceRecord:r}:{result:!0}};var Ze=(e,t)=>{let{conditions:r,endpoint:o}=e,{result:i,referenceRecord:n}=I(r,t);if(!i)return;let s=n?{...t,referenceRecord:{...t.referenceRecord,...n}}:t,{url:a,properties:c,headers:f}=o;t.logger?.debug?.(`${u} Resolving endpoint from template: ${d(o)}`);let l={url:Je(a,s)};return f!=null&&(l.headers=qe(f,s)),c!=null&&(l.properties=K(c,s)),l};var Qe=(e,t)=>{let{conditions:r,error:o}=e,{result:i,referenceRecord:n}=I(r,t);if(!i)return;let s=n?{...t,referenceRecord:{...t.referenceRecord,...n}}:t;throw new p(g(o,"Error",s))};var J=(e,t)=>{for(let r of e)if(r.type==="endpoint"){let o=Ze(r,t);if(o)return o}else if(r.type==="error")Qe(r,t);else if(r.type==="tree"){let o=Ye.evaluateTreeRule(r,t);if(o)return o}else throw new p(`Unknown endpoint rule: ${r}`);throw new p("Rules evaluation failed")},Wt=(e,t)=>{let{conditions:r,rules:o}=e,{result:i,referenceRecord:n}=I(r,t);if(!i)return;let s=n?{...t,referenceRecord:{...t.referenceRecord,...n}}:t;return Ye.evaluateRules(o,s)},Ye={evaluateRules:J,evaluateTreeRule:Wt};var zt=(e,t)=>{let{endpointParams:r,logger:o}=t,{parameters:i,rules:n}=e;t.logger?.debug?.(`${u} Initial EndpointParams: ${d(r)}`);for(let a in i){let c=i[a],f=r[a];if(f==null&&c.default!=null){r[a]=c.default;continue}if(c.required&&f==null)throw new p(`Missing required parameter: '${a}'`)}let s=J(n,{endpointParams:r,logger:o,referenceRecord:{}});return t.logger?.debug?.(`${u} Resolved endpoint: ${d(s)}`),s};var ci=D(F),fi=Te(F),pi=y(F),li=Ce(F);var et=new Set,tt=(e,t=O)=>{if(!et.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 new Error(`Region not accepted: region="${e}" is not a valid hostname component.`);else et.add(e)};var $=e=>typeof e=="string"&&(e.startsWith("fips-")||e.endsWith("-fips"));var rt=e=>$(e)?["fips-aws-global","aws-fips"].includes(e)?"us-east-1":e.replace(/fips-(dkr-|prod-)?|-fips/,""):e;var Dt=e=>{let{region:t,useFipsEndpoint:r}=e;if(!t)throw new Error("Region is missing");return Object.assign(e,{region:async()=>{let o=typeof t=="function"?await t():t,i=rt(o);return tt(i),i},useFipsEndpoint:async()=>{let o=typeof t=="string"?t:await t();return $(o)?!0:typeof r!="function"?Promise.resolve(!!r):r()}})};export{N as a,E as b,Ot as c,It as d,j as e,Rt as f,Dt as g,At as h,A as i,z as j,B as k,O as l,q as m,zt as n,fi as o,li as p};
@@ -0,0 +1,3 @@
1
+ import{g as D,r as C}from"./chunk-HGJYEXMU.js";import{Agent as O,request as X}from"https";function R(o){let e=o&&typeof o=="object"&&"reason"in o?o.reason:void 0;if(e){if(e instanceof Error){let n=new Error("Request aborted");return n.name="AbortError",n.cause=e,n}let r=new Error(String(e));return r.name="AbortError",r}let t=new Error("Request aborted");return t.name="AbortError",t}var N=["ECONNRESET","EPIPE","ETIMEDOUT"];var L=o=>{let e={};for(let t in o){let r=o[t];e[t]=Array.isArray(r)?r.join(","):r}return e};var c={setTimeout:(o,e)=>setTimeout(o,e),clearTimeout:o=>clearTimeout(o)};var B=1e3,U=(o,e,t=0)=>{if(!t)return-1;let r=n=>{let s=c.setTimeout(()=>{o.destroy(),e(Object.assign(new Error(`@smithy/node-http-handler - the request socket did not establish a connection with the server within the configured timeout of ${t} ms.`),{name:"TimeoutError"}))},t-n),i=a=>{a?.connecting?a.on("connect",()=>{c.clearTimeout(s)}):c.clearTimeout(s)};o.socket?i(o.socket):o.on("socket",i)};return t<2e3?(r(0),0):c.setTimeout(r.bind(null,B),B)};var $=(o,e,t=0,r,n)=>t?c.setTimeout(()=>{let s=`@smithy/node-http-handler - [${r?"ERROR":"WARN"}] a request has exceeded the configured ${t} ms requestTimeout.`;if(r){let i=Object.assign(new Error(s),{name:"TimeoutError",code:"ETIMEDOUT"});o.destroy(i),e(i)}else s+=" Init client requestHandler with throwOnRequestTimeout=true to turn this into an error.",n?.warn?.(s)},t):-1;var Q=3e3,j=(o,{keepAlive:e,keepAliveMsecs:t},r=Q)=>{if(e!==!0)return-1;let n=()=>{o.socket?o.socket.setKeepAlive(e,t||0):o.on("socket",s=>{s.setKeepAlive(e,t||0)})};return r===0?(n(),0):c.setTimeout(n,r)};var H=3e3,W=(o,e,t=0)=>{let r=n=>{let s=t-n,i=()=>{o.destroy(),e(Object.assign(new Error(`@smithy/node-http-handler - the request socket timed out after ${t} ms of inactivity (configured by client requestHandler).`),{name:"TimeoutError"}))};o.socket?(o.socket.setTimeout(s,i),o.on("close",()=>o.socket?.removeListener("timeout",i))):o.setTimeout(s,i)};return 0<t&&t<6e3?(r(0),0):c.setTimeout(r.bind(null,t===0?0:H),H)};import{Readable as z}from"stream";var F=6e3;async function K(o,e,t=F,r=!1){let n=e.headers,s=n?n.Expect||n.expect:void 0,i=-1,a=!0;!r&&s==="100-continue"&&(a=await Promise.race([new Promise(f=>{i=Number(c.setTimeout(()=>f(!0),Math.max(F,t)))}),new Promise(f=>{o.on("continue",()=>{c.clearTimeout(i),f(!0)}),o.on("response",()=>{c.clearTimeout(i),f(!1)}),o.on("error",()=>{c.clearTimeout(i),f(!1)})})])),a&&G(o,e.body)}function G(o,e){if(e instanceof z){e.pipe(o);return}if(e){let t=Buffer.isBuffer(e);if(t||typeof e=="string"){t&&e.byteLength===0?o.end():o.end(e);return}let n=e;if(typeof n=="object"&&n.buffer&&typeof n.byteOffset=="number"&&typeof n.byteLength=="number"){o.end(Buffer.from(n.buffer,n.byteOffset,n.byteLength));return}o.end(Buffer.from(e));return}o.end()}var k,V,M=class o{config;configProvider;socketWarningTimestamp=0;externalAgent=!1;metadata={handlerProtocol:"http/1.1"};static create(e){return typeof e?.handle=="function"?e:new o(e)}static checkSocketUsage(e,t,r=console){let{sockets:n,requests:s,maxSockets:i}=e;if(typeof i!="number"||i===1/0||Date.now()-15e3<t)return t;if(n&&s)for(let f in n){let h=n[f]?.length??0,m=s[f]?.length??0;if(h>=i&&m>=2*i)return r?.warn?.(`@smithy/node-http-handler:WARN - socket usage at capacity=${h} and ${m} additional requests are enqueued.
2
+ See https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/node-configuring-maxsockets.html
3
+ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler config.`),Date.now()}return t}constructor(e){this.configProvider=new Promise((t,r)=>{typeof e=="function"?e().then(n=>{t(this.resolveDefaultConfig(n))}).catch(r):t(this.resolveDefaultConfig(e))})}destroy(){this.config?.httpAgent?.destroy(),this.config?.httpsAgent?.destroy()}async handle(e,{abortSignal:t,requestTimeout:r}={}){this.config||(this.config=await this.configProvider);let n=this.config,s=e.protocol==="https:";return!s&&!this.config.httpAgent&&(this.config.httpAgent=await this.config.httpAgentProvider()),new Promise((i,a)=>{let f,h=-1,m=-1,p=-1,E=-1,y=-1,w=()=>{c.clearTimeout(h),c.clearTimeout(m),c.clearTimeout(p),c.clearTimeout(E),c.clearTimeout(y)},q=async u=>{await f,w(),i(u)},g=async u=>{await f,w(),a(u)};if(t?.aborted){let u=R(t);g(u);return}let v=e.headers,J=v?(v.Expect??v.expect)==="100-continue":!1,b=s?n.httpsAgent:n.httpAgent;J&&!this.externalAgent&&(b=new(s?O:k)({keepAlive:!1,maxSockets:1/0})),h=c.setTimeout(()=>{this.socketWarningTimestamp=o.checkSocketUsage(b,this.socketWarningTimestamp,n.logger)},n.socketAcquisitionWarningTimeout??(n.requestTimeout??2e3)+(n.connectionTimeout??1e3));let S=e.query?C(e.query):"",_;if(e.username!=null||e.password!=null){let u=e.username??"",l=e.password??"";_=`${u}:${l}`}let x=e.path;S&&(x+=`?${S}`),e.fragment&&(x+=`#${e.fragment}`);let T=e.hostname??"";T[0]==="["&&T.endsWith("]")?T=e.hostname.slice(1,-1):T=e.hostname;let I={headers:e.headers,host:T,method:e.method,path:x,port:e.port,agent:b,auth:_},d=(s?X:V)(I,u=>{let l=new D({statusCode:u.statusCode||-1,reason:u.statusMessage,headers:L(u.headers),body:u});q({response:l})});if(d.on("error",u=>{N.includes(u.code)?g(Object.assign(u,{name:"TimeoutError"})):g(u)}),t){let u=()=>{d.destroy();let l=R(t);g(l)};if(typeof t.addEventListener=="function"){let l=t;l.addEventListener("abort",u,{once:!0}),d.once("close",()=>l.removeEventListener("abort",u))}else t.onabort=u}let P=r??n.requestTimeout;m=U(d,g,n.connectionTimeout),p=$(d,g,P,n.throwOnRequestTimeout,n.logger??console),E=W(d,g,n.socketTimeout);let A=I.agent;typeof A=="object"&&"keepAlive"in A&&(y=j(d,{keepAlive:A.keepAlive,keepAliveMsecs:A.keepAliveMsecs})),f=K(d,e,P,this.externalAgent).catch(u=>(w(),a(u)))})}updateHttpClientConfig(e,t){this.config=void 0,this.configProvider=this.configProvider.then(r=>({...r,[e]:t}))}httpHandlerConfigs(){return this.config??{}}resolveDefaultConfig(e){let{requestTimeout:t,connectionTimeout:r,socketTimeout:n,socketAcquisitionWarningTimeout:s,httpAgent:i,httpsAgent:a,throwOnRequestTimeout:f,logger:h}=e||{},m=!0,p=50;return{connectionTimeout:r,requestTimeout:t,socketTimeout:n,socketAcquisitionWarningTimeout:s,throwOnRequestTimeout:f,httpAgentProvider:async()=>{let{Agent:E,request:y}=await import("http");return V=y,k=E,i instanceof k||typeof i?.destroy=="function"?(this.externalAgent=!0,i):new k({keepAlive:m,maxSockets:p,...i})},httpsAgent:a instanceof O||typeof a?.destroy=="function"?(this.externalAgent=!0,a):new O({keepAlive:m,maxSockets:p,...a}),logger:h}}};export{M as a};
@@ -0,0 +1 @@
1
+ import{j as O,k as S,l as L}from"./chunk-STX7THHW.js";import{t as U,u as _}from"./chunk-VFREGXHN.js";import{e as V}from"./chunk-XB6R2VIU.js";import{b as y,d as J,h as B,j as w,l as j,m as A}from"./chunk-HGJYEXMU.js";import{A as k,a as M,c as z,d as I,e as D,f as l,m as g}from"./chunk-W5TBFCWY.js";function F(m,t,e){if(e?.source){let i=e.source;if(typeof t=="number"&&(t>Number.MAX_SAFE_INTEGER||t<Number.MIN_SAFE_INTEGER||i!==String(t)))return i.includes(".")?new g(i,"bigDecimal"):BigInt(i)}return t}var $=(m,t)=>J(m,t).then(e=>(t?.utf8Encoder??V)(e));var H=(m,t)=>$(m,t).then(e=>{if(e.length)try{return JSON.parse(e)}catch(i){throw i?.name==="SyntaxError"&&Object.defineProperty(i,"$responseBodyText",{value:e}),i}return{}});var K=(m,t)=>Object.keys(m).find(e=>e.toLowerCase()===t.toLowerCase()),C=m=>{let t=m;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},P=(m,t)=>{let e=K(m.headers,"x-amzn-errortype");if(e!==void 0)return C(m.headers[e]);if(t&&typeof t=="object"){let i=K(t,"code");if(i&&t[i]!==void 0)return C(t[i]);if(t.__type!==void 0)return C(t.__type)}};var b=class extends S{settings;constructor(t){super(),this.settings=t}async read(t,e){return this._read(t,typeof e=="string"?JSON.parse(e,F):await H(e,this.serdeContext))}readObject(t,e){return this._read(t,e)}_read(t,e){let i=e!==null&&typeof e=="object",s=y.of(t);if(i){if(s.isStructSchema()){let r=e,o=s.isUnionSchema(),c={},p,{jsonName:d}=this.settings;d&&(p={});let a;o&&(a=new L(r,c));for(let[f,h]of s.structIterator()){let u=f;d&&(u=h.getMergedTraits().jsonName??u,p[u]=f),o&&a.mark(u),r[u]!=null&&(c[f]=this._read(h,r[u]))}if(o)a.writeUnknown();else if(typeof r.__type=="string")for(let f in r){let h=r[f],u=d?p[f]??f:f;u in c||(c[u]=h)}return c}if(Array.isArray(e)&&s.isListSchema()){let r=s.getValueSchema(),o=[];for(let c of e)o.push(this._read(r,c));return o}if(s.isMapSchema()){let r=s.getValueSchema(),o={};for(let c in e)o[c]=this._read(r,e[c]);return o}}if(s.isBlobSchema()&&typeof e=="string")return U(e);let n=s.getMergedTraits().mediaType;if(s.isStringSchema()&&typeof e=="string"&&n)return n==="application/json"||n.endsWith("+json")?l.from(e):e;if(s.isTimestampSchema()&&e!=null)switch(w(s,this.settings)){case 5:return z(e);case 6:return I(e);case 7:return D(e);default:return console.warn("Missing timestamp format, parsing value with Date constructor:",e),new Date(e)}if(s.isBigIntegerSchema()&&(typeof e=="number"||typeof e=="string"))return BigInt(e);if(s.isBigDecimalSchema()&&e!=null){if(e instanceof g)return e;let r=e;return r.type==="bigDecimal"&&"string"in r?new g(r.string,r.type):new g(String(e),"bigDecimal")}if(s.isNumericSchema()&&typeof e=="string"){switch(e){case"Infinity":return 1/0;case"-Infinity":return-1/0;case"NaN":return NaN}return e}if(s.isDocumentSchema())if(i){let r=Array.isArray(e)?[]:{};for(let o in e){let c=e[o];c instanceof g?r[o]=c:r[o]=this._read(s,c)}return r}else return structuredClone(e);return e}};var q="\u039D",x=class{values=new Map;counter=0;stage=0;createReplacer(){if(this.stage===1)throw new Error("@aws-sdk/core/protocols - JsonReplacer already created.");if(this.stage===2)throw new Error("@aws-sdk/core/protocols - JsonReplacer exhausted.");return this.stage=1,(t,e)=>{if(e instanceof g){let i=`${q+"nv"+this.counter++}_`+e.string;return this.values.set(`"${i}"`,e.string),i}if(typeof e=="bigint"){let i=e.toString(),s=`${q+"b"+this.counter++}_`+i;return this.values.set(`"${s}"`,i),s}return e}}replaceInJson(t){if(this.stage===0)throw new Error("@aws-sdk/core/protocols - JsonReplacer not created yet.");if(this.stage===2)throw new Error("@aws-sdk/core/protocols - JsonReplacer exhausted.");if(this.stage=2,this.counter===0)return t;for(let[e,i]of this.values)t=t.replace(e,i);return t}};var N=class extends S{settings;buffer;useReplacer=!1;rootSchema;constructor(t){super(),this.settings=t}write(t,e){this.rootSchema=y.of(t),this.buffer=this._write(this.rootSchema,e)}flush(){let{rootSchema:t,useReplacer:e}=this;if(this.rootSchema=void 0,this.useReplacer=!1,t?.isStructSchema()||t?.isDocumentSchema()){if(!e)return JSON.stringify(this.buffer);let i=new x;return i.replaceInJson(JSON.stringify(this.buffer,i.createReplacer(),0))}return this.buffer}writeDiscriminatedDocument(t,e){this.write(t,e),typeof this.buffer=="object"&&(this.buffer.__type=y.of(t).getName(!0))}_write(t,e,i){let s=e!==null&&typeof e=="object",n=y.of(t);if(s){if(n.isStructSchema()){let r=e,o={},{jsonName:c}=this.settings,p;c&&(p={});let d=0;for(let[a,f]of n.structIterator()){let h=this._write(f,r[a],n);if(h!==void 0){let u=a;c&&(u=f.getMergedTraits().jsonName??a,p[a]=u),o[u]=h,d++}}if(n.isUnionSchema()&&d===0){let{$unknown:a}=r;if(Array.isArray(a)){let[f,h]=a;o[f]=this._write(15,h)}}else if(typeof r.__type=="string")for(let a in r){let f=r[a],h=c?p[a]??a:a;h in o||(o[h]=this._write(15,f))}return o}if(Array.isArray(e)&&n.isListSchema()){let r=n.getValueSchema(),o=[],c=!!n.getMergedTraits().sparse;for(let p of e)(c||p!=null)&&o.push(this._write(r,p));return o}if(n.isMapSchema()){let r=n.getValueSchema(),o={},c=!!n.getMergedTraits().sparse;for(let p in e){let d=e[p];(c||d!=null)&&(o[p]=this._write(r,d))}return o}if(e instanceof Uint8Array&&(n.isBlobSchema()||n.isDocumentSchema()))return n===this.rootSchema?e:(this.serdeContext?.base64Encoder??_)(e);if(e instanceof Date&&(n.isTimestampSchema()||n.isDocumentSchema()))switch(w(n,this.settings)){case 5:return e.toISOString().replace(".000Z","Z");case 6:return M(e);case 7:return e.getTime()/1e3;default:return console.warn("Missing timestamp format, using epoch seconds",e),e.getTime()/1e3}e instanceof g&&(this.useReplacer=!0)}if(!(e===null&&i?.isStructSchema())){if(n.isStringSchema()){if(typeof e>"u"&&n.isIdempotencyToken())return k();let r=n.getMergedTraits().mediaType;return e!=null&&r&&(r==="application/json"||r.endsWith("+json"))?l.from(e):e}if(typeof e=="number"&&n.isNumericSchema())return Math.abs(e)===1/0||isNaN(e)?String(e):e;if(typeof e=="string"&&n.isBlobSchema())return n===this.rootSchema?e:(this.serdeContext?.base64Encoder??_)(e);if(typeof e=="bigint"&&(this.useReplacer=!0),n.isDocumentSchema())if(s){let r=Array.isArray(e)?[]:{};for(let o in e){let c=e[o];c instanceof g?(this.useReplacer=!0,r[o]=c):r[o]=this._write(n,c)}return r}else return structuredClone(e);return e}}};var T=class extends S{settings;constructor(t){super(),this.settings=t}createSerializer(){let t=new N(this.settings);return t.setSerdeContext(this.serdeContext),t}createDeserializer(){let t=new b(this.settings);return t.setSerdeContext(this.serdeContext),t}};var W=class extends B{serializer;deserializer;codec;mixin=new O;constructor({defaultNamespace:t,errorTypeRegistries:e}){super({defaultNamespace:t,errorTypeRegistries:e});let i={timestampFormat:{useTrait:!0,default:7},httpBindings:!0,jsonName:!0};this.codec=new T(i),this.serializer=new A(this.codec.createSerializer(),i),this.deserializer=new j(this.codec.createDeserializer(),i)}getShapeId(){return"aws.protocols#restJson1"}getPayloadCodec(){return this.codec}setSerdeContext(t){this.codec.setSerdeContext(t),super.setSerdeContext(t)}async serializeRequest(t,e,i){let s=await super.serializeRequest(t,e,i),n=y.of(t.input);if(!s.headers["content-type"]){let r=this.mixin.resolveRestContentType(this.getDefaultContentType(),n);r&&(s.headers["content-type"]=r)}return s.body==null&&s.headers["content-type"]===this.getDefaultContentType()&&(s.body="{}"),s}async deserializeResponse(t,e,i){let s=await super.deserializeResponse(t,e,i),n=y.of(t.output);for(let[r,o]of n.structIterator())o.getMemberTraits().httpPayload&&!(r in s)&&(s[r]=null);return s}async handleError(t,e,i,s,n){let r=P(i,s)??"Unknown";this.mixin.compose(this.compositeErrorRegistry,r,this.options.defaultNamespace);let{errorSchema:o,errorMetadata:c}=await this.mixin.getErrorSchemaOrThrowBaseException(r,this.options.defaultNamespace,i,s,n),p=y.of(o),d=s.message??s.Message??"UnknownError",a=this.compositeErrorRegistry.getErrorCtor(o)??Error,f=new a(d);await this.deserializeHttpMessage(o,e,i,s);let h={},u=this.codec.createDeserializer();for(let[E,R]of p.structIterator()){let G=R.getMergedTraits().jsonName??E;h[E]=u.readObject(R,s[G])}throw this.mixin.decorateServiceException(Object.assign(f,c,{$fault:p.getMergedTraits().error,message:d},h),s)}getDefaultContentType(){return"application/json"}};export{W as a};