manage-storage 0.0.6 → 0.0.8
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.
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e,f as t}from"./manage-storage-CGRNU6uH.js";import{E as r,a,H as s,I as n,M as i,c as o,S as l,d as c,b as m,e as d,g as y,h,i as u,r as S,j as f}from"./manage-storage-CGRNU6uH.js";class p{marshaller;serializer;deserializer;serdeContext;defaultContentType;constructor({marshaller:e,serializer:t,deserializer:r,serdeContext:a,defaultContentType:s}){this.marshaller=e,this.serializer=t,this.deserializer=r,this.serdeContext=a,this.defaultContentType=s}async serializeEventStream({eventStream:e,requestSchema:t,initialRequest:r}){const a=this.marshaller,s=t.getEventStreamMember(),n=t.getMemberSchema(s),i=this.serializer,o=this.defaultContentType,l=/* @__PURE__ */Symbol("initialRequestMarker"),c={async*[Symbol.asyncIterator](){if(r){const e={":event-type":{type:"string",value:"initial-request"},":message-type":{type:"string",value:"event"},":content-type":{type:"string",value:o}};i.write(t,r);const a=i.flush();yield{[l]:!0,headers:e,body:a}}for await(const t of e)yield t}};return a.serialize(c,e=>{if(e[l])return{headers:e.headers,body:e.body};let t="";for(const n in e)if("__type"!==n){t=n;break}const{additionalHeaders:r,body:a,eventType:s,explicitPayloadContentType:i}=this.writeEventBody(t,n,e);return{headers:{":event-type":{type:"string",value:s},":message-type":{type:"string",value:"event"},":content-type":{type:"string",value:i??o},...r},body:a}})}async deserializeEventStream({response:t,responseSchema:r,initialResponseContainer:a}){const s=this.marshaller,n=r.getEventStreamMember(),i=r.getMemberSchema(n).getMemberSchemas(),o=/* @__PURE__ */Symbol("initialResponseMarker"),l=s.deserialize(t.body,async t=>{let a="";for(const e in t)if("__type"!==e){a=e;break}const s=t[a].body;if("initial-response"===a){const e=await this.deserializer.read(r,s);return delete e[n],{[o]:!0,...e}}if(a in i){const r=i[a];if(r.isStructSchema()){const n={};let i=!1;for(const[o,l]of r.structIterator()){const{eventHeader:r,eventPayload:c}=l.getMergedTraits();if(i=i||Boolean(r||c),c)l.isBlobSchema()?n[o]=s:l.isStringSchema()?n[o]=(this.serdeContext?.utf8Encoder??e)(s):l.isStructSchema()&&(n[o]=await this.deserializer.read(l,s));else if(r){const e=t[a].headers[o]?.value;null!=e&&(l.isNumericSchema()?n[o]=e&&"object"==typeof e&&"bytes"in e?BigInt(e.toString()):Number(e):n[o]=e)}}if(i)return{[a]:n};if(0===s.byteLength)return{[a]:{}}}return{[a]:await this.deserializer.read(r,s)}}return{$unknown:t}}),c=l[Symbol.asyncIterator](),m=await c.next();if(m.done)return l;if(m.value?.[o]){if(!r)throw new Error("@smithy::core/protocols - initial-response event encountered in event stream but no response schema given.");for(const e in m.value)a[e]=m.value[e]}return{async*[Symbol.asyncIterator](){for(m?.value?.[o]||(yield m.value);;){const{done:e,value:t}=await c.next();if(e)break;yield t}}}}writeEventBody(e,r,a){const s=this.serializer;let n,i=e,o=null;const l={};if(r.getSchema()[4].includes(e)){const t=r.getMemberSchema(e);if(t.isStructSchema()){for(const[r,s]of t.structIterator()){const{eventHeader:t,eventPayload:n}=s.getMergedTraits();if(n)o=r;else if(t){const t=a[e][r];let n="binary";s.isNumericSchema()?n=(-2)**31<=t&&t<=2**31-1?"integer":"long":s.isTimestampSchema()?n="timestamp":s.isStringSchema()?n="string":s.isBooleanSchema()&&(n="boolean"),null!=t&&(l[r]={type:n,value:t},delete a[e][r])}}if(null!==o){const r=t.getMemberSchema(o);r.isBlobSchema()?n="application/octet-stream":r.isStringSchema()&&(n="text/plain"),s.write(r,a[e][o])}else s.write(t,a[e])}else{if(!t.isUnitSchema())throw new Error("@smithy/core/event-streams - non-struct member not supported in event stream union.");s.write(t,{})}}else{const[t,r]=a[e];i=t,s.write(15,r)}const c=s.flush()??new Uint8Array;return{body:"string"==typeof c?(this.serdeContext?.utf8Decoder??t)(c):c,eventType:i,explicitPayloadContentType:n,additionalHeaders:l}}}export{r as EventStreamCodec,a as EventStreamMarshaller,p as EventStreamSerde,s as HeaderMarshaller,n as Int64,i as MessageDecoderStream,o as MessageEncoderStream,l as SmithyMessageDecoderStream,c as SmithyMessageEncoderStream,m as UniversalEventStreamMarshaller,d as eventStreamSerdeProvider,y as getChunkedStream,h as getMessageUnmarshaller,u as iterableToReadableStream,S as readableStreamToIterable,f as resolveEventStreamSerdeConfig};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{config as e}from"dotenv";const t=(e,t)=>{const r=[];if(e&&r.push(e),t)for(const s of t)r.push(s);return r},r=(e,t)=>`${e||"anonymous"}${t&&t.length>0?` (a.k.a. ${t.join(",")})`:""}`,s=()=>{let e=[],o=[],a=!1;const c=/* @__PURE__ */new Set,u=t=>(e.forEach(e=>{t.add(e.middleware,{...e})}),o.forEach(e=>{t.addRelativeTo(e.middleware,{...e})}),t.identifyOnResolve?.(h.identifyOnResolve()),t),d=e=>{const t=[];return e.before.forEach(e=>{0===e.before.length&&0===e.after.length?t.push(e):t.push(...d(e))}),t.push(e),e.after.reverse().forEach(e=>{0===e.before.length&&0===e.after.length?t.push(e):t.push(...d(e))}),t},l=(s=!1)=>{const a=[],c=[],u={};e.forEach(e=>{const r={...e,before:[],after:[]};for(const s of t(r.name,r.aliases))u[s]=r;a.push(r)}),o.forEach(e=>{const r={...e,before:[],after:[]};for(const s of t(r.name,r.aliases))u[s]=r;c.push(r)}),c.forEach(e=>{if(e.toMiddleware){const t=u[e.toMiddleware];if(void 0===t){if(s)return;throw new Error(`${e.toMiddleware} is not found when adding ${r(e.name,e.aliases)} middleware ${e.relation} ${e.toMiddleware}`)}"after"===e.relation&&t.after.push(e),"before"===e.relation&&t.before.push(e)}});var l;return(l=a,l.sort((e,t)=>n[t.step]-n[e.step]||i[t.priority||"normal"]-i[e.priority||"normal"])).map(d).reduce((e,t)=>(e.push(...t),e),[])},h={add:(s,n={})=>{const{name:i,override:o,aliases:a}=n,u={step:"initialize",priority:"normal",middleware:s,...n},d=t(i,a);if(d.length>0){if(d.some(e=>c.has(e))){if(!o)throw new Error(`Duplicate middleware name '${r(i,a)}'`);for(const t of d){const s=e.findIndex(e=>e.name===t||e.aliases?.some(e=>e===t));if(-1===s)continue;const n=e[s];if(n.step!==u.step||u.priority!==n.priority)throw new Error(`"${r(n.name,n.aliases)}" middleware with ${n.priority} priority in ${n.step} step cannot be overridden by "${r(i,a)}" middleware with ${u.priority} priority in ${u.step} step.`);e.splice(s,1)}}for(const e of d)c.add(e)}e.push(u)},addRelativeTo:(e,s)=>{const{name:n,override:i,aliases:a}=s,u={middleware:e,...s},d=t(n,a);if(d.length>0){if(d.some(e=>c.has(e))){if(!i)throw new Error(`Duplicate middleware name '${r(n,a)}'`);for(const e of d){const t=o.findIndex(t=>t.name===e||t.aliases?.some(t=>t===e));if(-1===t)continue;const s=o[t];if(s.toMiddleware!==u.toMiddleware||s.relation!==u.relation)throw new Error(`"${r(s.name,s.aliases)}" middleware ${s.relation} "${s.toMiddleware}" middleware cannot be overridden by "${r(n,a)}" middleware ${u.relation} "${u.toMiddleware}" middleware.`);o.splice(t,1)}}for(const e of d)c.add(e)}o.push(u)},clone:()=>u(s()),use:e=>{e.applyToStack(h)},remove:r=>"string"==typeof r?(r=>{let s=!1;const n=e=>{const n=t(e.name,e.aliases);if(n.includes(r)){s=!0;for(const e of n)c.delete(e);return!1}return!0};return e=e.filter(n),o=o.filter(n),s})(r):(r=>{let s=!1;const n=e=>{if(e.middleware===r){s=!0;for(const r of t(e.name,e.aliases))c.delete(r);return!1}return!0};return e=e.filter(n),o=o.filter(n),s})(r),removeByTag:r=>{let s=!1;const n=e=>{const{tags:n,name:i,aliases:o}=e;if(n&&n.includes(r)){const e=t(i,o);for(const t of e)c.delete(t);return s=!0,!1}return!0};return e=e.filter(n),o=o.filter(n),s},concat:e=>{const t=u(s());return t.use(e),t.identifyOnResolve(a||t.identifyOnResolve()||(e.identifyOnResolve?.()??!1)),t},applyToStack:u,identify:()=>l(!0).map(e=>{const t=e.step??e.relation+" "+e.toMiddleware;return r(e.name,e.aliases)+" - "+t}),identifyOnResolve:e=>("boolean"==typeof e&&(a=e),a),resolve:(e,t)=>{for(const r of l().map(e=>e.middleware).reverse())e=r(e,t);return a&&console.log(h.identify()),e}};return h},n={initialize:5,serialize:4,build:3,finalizeRequest:2,deserialize:1},i={high:3,normal:2,low:1};var o,a,c,u;(a=o||(o={})).HTTP="http",a.HTTPS="https",(u=c||(c={})).MD5="md5",u.CRC32="crc32",u.CRC32C="crc32c",u.SHA1="sha1",u.SHA256="sha256";const d="__smithy_context",l=e=>e[d]||(e[d]={}),h=e=>{if("function"==typeof e)return e;const t=Promise.resolve(e);return()=>t};class f{config;middlewareStack=s();initConfig;handlers;constructor(e){this.config=e;const{protocol:t,protocolSettings:r}=e;r&&"function"==typeof t&&(e.protocol=new t(r))}send(e,t,r){const s="function"!=typeof t?t:void 0,n="function"==typeof t?t:r;let i;if(void 0===s&&!0===this.config.cacheMiddleware){this.handlers||(this.handlers=/* @__PURE__ */new WeakMap);const t=this.handlers;t.has(e.constructor)?i=t.get(e.constructor):(i=e.resolveMiddleware(this.middlewareStack,this.config,s),t.set(e.constructor,i))}else delete this.handlers,i=e.resolveMiddleware(this.middlewareStack,this.config,s);if(!n)return i(e).then(e=>e.output);i(e).then(e=>n(null,e.output),e=>n(e)).catch(()=>{})}destroy(){this.config?.requestHandler?.destroy?.(),delete this.handlers}}const p=e=>"function"==typeof e?e():e,m="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",g=Object.entries(m).reduce((e,[t,r])=>(e[r]=Number(t),e),{}),y=m.split(""),w=e=>{let t=e.length/4*3;"=="===e.slice(-2)?t-=2:"="===e.slice(-1)&&t--;const r=new ArrayBuffer(t),s=new DataView(r);for(let n=0;n<e.length;n+=4){let t=0,r=0;for(let s=n,a=n+3;s<=a;s++)if("="!==e[s]){if(!(e[s]in g))throw new TypeError(`Invalid character ${e[s]} in base64 string.`);t|=g[e[s]]<<6*(a-s),r+=6}else t>>=6;const i=n/4*3;t>>=r%8;const o=Math.floor(r/8);for(let e=0;e<o;e++){const r=8*(o-e-1);s.setUint8(i+e,(t&255<<r)>>r)}}return new Uint8Array(r)},b=e=>(new TextEncoder).encode(e);function S(e){let t;t="string"==typeof e?b(e):e;const r="object"==typeof t&&"number"==typeof t.length,s="object"==typeof t&&"number"==typeof t.byteOffset&&"number"==typeof t.byteLength;if(!r&&!s)throw new Error("@smithy/util-base64: toBase64 encoder function only accepts string | Uint8Array.");let n="";for(let i=0;i<t.length;i+=3){let e=0,r=0;for(let n=i,o=Math.min(i+3,t.length);n<o;n++)e|=t[n]<<8*(o-n-1),r+=8;const s=Math.ceil(r/6);e<<=6*s-r;for(let t=1;t<=s;t++){const r=6*(s-t);n+=y[(e&63<<r)>>r]}n+="==".slice(0,4-s)}return n}const v=e=>{if("string"==typeof e)return e;if("object"!=typeof e||"number"!=typeof e.byteOffset||"number"!=typeof e.byteLength)throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.");return new TextDecoder("utf-8").decode(e)},E=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));const C=Math.ceil(2**127*(2-2**-23)),A=e=>{const t=(e=>{if(null!=e){if("string"==typeof e){const t=parseFloat(e);if(!Number.isNaN(t))return String(t)!==String(e)&&O.warn(N(`Expected number but observed string: ${e}`)),t}if("number"==typeof e)return e;throw new TypeError(`Expected number, got ${typeof e}: ${e}`)}})(e);if(void 0!==t&&!Number.isNaN(t)&&t!==1/0&&t!==-1/0&&Math.abs(t)>C)throw new TypeError(`Expected 32-bit float, got ${e}`);return t},x=e=>R(e,16),k=e=>R(e,8),R=(e,t)=>{const r=(e=>{if(null!=e){if(Number.isInteger(e)&&!Number.isNaN(e))return e;throw new TypeError(`Expected integer, got ${typeof e}: ${e}`)}})(e);if(void 0!==r&&T(r,t)!==r)throw new TypeError(`Expected ${t}-bit integer, got ${e}`);return r},T=(e,t)=>{switch(t){case 32:return Int32Array.of(e)[0];case 16:return Int16Array.of(e)[0];case 8:return Int8Array.of(e)[0]}},P=/(-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?)|(-?Infinity)|(NaN)/g,I=e=>{const t=e.match(P);if(null===t||t[0].length!==e.length)throw new TypeError("Expected real number, got implicit NaN");return parseFloat(e)},M=e=>x("string"==typeof e?I(e):e),N=e=>String(new TypeError(e).stack||e).split("\n").slice(0,5).filter(e=>!e.includes("stackTraceWarning")).join("\n"),O={warn:console.warn},$=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],U=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function D(e){const t=e.getUTCFullYear(),r=e.getUTCMonth(),s=e.getUTCDay(),n=e.getUTCDate(),i=e.getUTCHours(),o=e.getUTCMinutes(),a=e.getUTCSeconds(),c=i<10?`0${i}`:`${i}`,u=o<10?`0${o}`:`${o}`,d=a<10?`0${a}`:`${a}`;return`${$[s]}, ${n<10?`0${n}`:`${n}`} ${U[r]} ${t} ${c}:${u}:${d} GMT`}const _=new RegExp(/^(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d{2}) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? GMT$/),L=new RegExp(/^(?:Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d{2})-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d{2}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? GMT$/),B=new RegExp(/^(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( [1-9]|\d{2}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? (\d{4})$/),z=e=>{if(null==e)return;if("string"!=typeof e)throw new TypeError("RFC-7231 date-times must be expressed as strings");let t=_.exec(e);if(t){const[e,r,s,n,i,o,a,c]=t;return j(M(Y(n)),F(s),G(r,"day",1,31),{hours:i,minutes:o,seconds:a,fractionalMilliseconds:c})}if(t=L.exec(e),t){const[e,r,s,n,i,o,a,c]=t;return q(j(H(n),F(s),G(r,"day",1,31),{hours:i,minutes:o,seconds:a,fractionalMilliseconds:c}))}if(t=B.exec(e),t){const[e,r,s,n,i,o,a,c]=t;return j(M(Y(c)),F(r),G(s.trimLeft(),"day",1,31),{hours:n,minutes:i,seconds:o,fractionalMilliseconds:a})}throw new TypeError("Invalid RFC-7231 date-time value")},j=(e,t,r,s)=>{const n=t-1;return V(e,n,r),new Date(Date.UTC(e,n,r,G(s.hours,"hour",0,23),G(s.minutes,"minute",0,59),G(s.seconds,"seconds",0,60),X(s.fractionalMilliseconds)))},H=e=>{const t=/* @__PURE__ */(new Date).getUTCFullYear(),r=100*Math.floor(t/100)+M(Y(e));return r<t?r+100:r},q=e=>e.getTime()-/* @__PURE__ */(new Date).getTime()>15768e8?new Date(Date.UTC(e.getUTCFullYear()-100,e.getUTCMonth(),e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds())):e,F=e=>{const t=U.indexOf(e);if(t<0)throw new TypeError(`Invalid month: ${e}`);return t+1},K=[31,28,31,30,31,30,31,31,30,31,30,31],V=(e,t,r)=>{let s=K[t];if(1===t&&W(e)&&(s=29),r>s)throw new TypeError(`Invalid day for ${U[t]} in ${e}: ${r}`)},W=e=>e%4==0&&(e%100!=0||e%400==0),G=(e,t,r,s)=>{const n=(e=>k("string"==typeof e?I(e):e))(Y(e));if(n<r||n>s)throw new TypeError(`${t} must be between ${r} and ${s}, inclusive`);return n},X=e=>null==e?0:1e3*(e=>A("string"==typeof e?I(e):e))("0."+e),Y=e=>{let t=0;for(;t<e.length-1&&"0"===e.charAt(t);)t++;return 0===t?e:e.slice(t)},J=function(e){return Object.assign(new String(e),{deserializeJSON:()=>JSON.parse(String(e)),toString:()=>String(e),toJSON:()=>String(e)})};function Q(e){return(e.includes(",")||e.includes('"'))&&(e=`"${e.replace(/"/g,'\\"')}"`),e}J.from=e=>e&&"object"==typeof e&&(e instanceof J||"deserializeJSON"in e)?e:"string"==typeof e||Object.getPrototypeOf(e)===String.prototype?J(String(e)):J(JSON.stringify(e)),J.fromObject=J.from;const Z="(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun)(?:[ne|u?r]?s?day)?",ee="(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)",te="(\\d?\\d):(\\d{2}):(\\d{2})(?:\\.(\\d+))?",re="(\\d?\\d)",se="(\\d{4})",ne=new RegExp(/^(\d{4})-(\d\d)-(\d\d)[tT](\d\d):(\d\d):(\d\d)(\.(\d+))?(([-+]\d\d:\d\d)|[zZ])$/),ie=new RegExp(`^${Z}, ${re} ${ee} ${se} ${te} GMT$`),oe=new RegExp(`^${Z}, ${re}-${ee}-(\\d\\d) ${te} GMT$`),ae=new RegExp(`^${Z} ${ee} ( [1-9]|\\d\\d) ${te} ${se}$`),ce=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function ue(e,t,r){const s=Number(e);if(s<t||s>r)throw new Error(`Value ${s} out of range [${t}, ${r}]`)}function de(e,t,r){if(!Number.isInteger(r))throw new Error("Invalid number of delimiters ("+r+") for splitEvery.");const s=e.split(t),n=[];let i="";for(let o=0;o<s.length;o++)""===i?i=s[o]:i+=t+s[o],(o+1)%r===0&&(n.push(i),i="");return""!==i&&n.push(i),n}const le=e=>{const t=e.length,r=[];let s,n=!1,i=0;for(let o=0;o<t;++o){const t=e[o];switch(t){case'"':"\\"!==s&&(n=!n);break;case",":n||(r.push(e.slice(i,o)),i=o+1)}s=t}return r.push(e.slice(i)),r.map(e=>{const t=(e=e.trim()).length;return t<2?e:('"'===e[0]&&'"'===e[t-1]&&(e=e.slice(1,t-1)),e.replace(/\\"/g,'"'))})},he=/^-?\d*(\.\d+)?$/;class fe{string;type;constructor(e,t){if(this.string=e,this.type=t,!he.test(e))throw new Error('@smithy/core/serde - NumericValue must only contain [0-9], at most one decimal point ".", and an optional negation prefix "-".')}toString(){return this.string}static[Symbol.hasInstance](e){if(!e||"object"!=typeof e)return!1;const t=e;return fe.prototype.isPrototypeOf(e)||"bigDecimal"===t.type&&he.test(t.string)}}const pe={},me={};for(let nf=0;nf<256;nf++){let e=nf.toString(16).toLowerCase();1===e.length&&(e=`0${e}`),pe[nf]=e,me[e]=nf}function ge(e){if(e.length%2!=0)throw new Error("Hex encoded strings must have an even number length");const t=new Uint8Array(e.length/2);for(let r=0;r<e.length;r+=2){const s=e.slice(r,r+2).toLowerCase();if(!(s in me))throw new Error(`Cannot decode unrecognized sequence ${s} as hexadecimal`);t[r/2]=me[s]}return t}function ye(e){let t="";for(let r=0;r<e.byteLength;r++)t+=pe[e[r]];return t}const we="function"==typeof TextEncoder?new TextEncoder:null,be=e=>{if("string"==typeof e){if(we)return we.encode(e).byteLength;let t=e.length;for(let r=t-1;r>=0;r--){const s=e.charCodeAt(r);s>127&&s<=2047?t++:s>2047&&s<=65535&&(t+=2),s>=56320&&s<=57343&&r--}return t}if("number"==typeof e.byteLength)return e.byteLength;if("number"==typeof e.size)return e.size;throw new Error(`Body Length computation failed for ${e}`)},Se=e=>"string"==typeof e?b(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e),ve=e=>"function"==typeof ArrayBuffer&&e instanceof ArrayBuffer||"[object ArrayBuffer]"===Object.prototype.toString.call(e),Ee=async e=>{},Ce=/^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/,Ae=/(\d+\.){3}\d+/,xe=/\.\./,ke=e=>Ce.test(e)&&!Ae.test(e)&&!xe.test(e),Re=e=>{const[t,r,s,,,n]=e.split(":"),i="arn"===t&&e.split(":").length>=6,o=Boolean(i&&r&&s&&n);if(i&&!o)throw new Error(`Invalid ARN: ${e} was an invalid ARN.`);return o},Te=(e,t,r,s=!1)=>{const n=async()=>{let n;if(s){const s=r.clientContextParams,i=s?.[e];n=i??r[e]??r[t]}else n=r[e]??r[t];return"function"==typeof n?n():n};return"credentialScope"===e||"CredentialScope"===t?async()=>{const e="function"==typeof r.credentials?await r.credentials():r.credentials;return e?.credentialScope??e?.CredentialScope}:"accountId"===e||"AccountId"===t?async()=>{const e="function"==typeof r.credentials?await r.credentials():r.credentials;return e?.accountId??e?.AccountId}:"endpoint"===e||"endpoint"===t?async()=>{if(!1===r.isCustomEndpoint)return;const e=await n();if(e&&"object"==typeof e){if("url"in e)return e.url.href;if("hostname"in e){const{protocol:t,hostname:r,port:s,path:n}=e;return`${t}//${r}${s?":"+s:""}${n}`}}return e}:n},Pe=e=>{if("object"==typeof e){if("url"in e){const t=Lt(e.url);if(e.headers){t.headers={};for(const r in e.headers)t.headers[r.toLowerCase()]=e.headers[r].join(", ")}return t}return e}return Lt(e)};const Ie=async(e,t,r)=>{const s={},n=t?.getEndpointParameterInstructions?.()||{};for(const[i,o]of Object.entries(n))switch(o.type){case"staticContextParams":s[i]=o.value;break;case"contextParams":s[i]=e[o.name];break;case"clientContextParams":case"builtInParams":s[i]=await Te(o.name,i,r,"builtInParams"!==o.type)();break;case"operationContextParams":s[i]=o.get(e);break;default:throw new Error("Unrecognized endpoint parameter instruction: "+JSON.stringify(o))}return 0===Object.keys(n).length&&Object.assign(s,r),"s3"===String(r.serviceId).toLowerCase()&&await(async e=>{const t=e?.Bucket||"";if("string"==typeof e.Bucket&&(e.Bucket=t.replace(/#/g,encodeURIComponent("#")).replace(/\?/g,encodeURIComponent("?"))),Re(t)){if(!0===e.ForcePathStyle)throw new Error("Path-style addressing cannot be used with ARN buckets")}else(!ke(t)||-1!==t.indexOf(".")&&!String(e.Endpoint).startsWith("http:")||t.toLowerCase()!==t||t.length<3)&&(e.ForcePathStyle=!0);return e.DisableMultiRegionAccessPoints&&(e.disableMultiRegionAccessPoints=!0,e.DisableMRAP=!0),e})(s),s};function Me(e){const t=function(e){return async(t,r,s,n)=>{if(!s.isCustomEndpoint){let t;t=s.serviceConfiguredEndpoint?await s.serviceConfiguredEndpoint():await e(s.serviceId),t&&(s.endpoint=()=>Promise.resolve(Pe(t)),s.isCustomEndpoint=!0)}const i=await Ie(t,r,s);if("function"!=typeof s.endpointProvider)throw new Error("config.endpointProvider is not set.");const o=s.endpointProvider(i,n);if(s.isCustomEndpoint&&s.endpoint){const e=await s.endpoint();if(e?.headers){o.headers??={};for(const[t,r]of Object.entries(e.headers))o.headers[t]=Array.isArray(r)?r:[r]}}return o}}(e);return({config:e,instructions:r})=>(s,n)=>async i=>{e.isCustomEndpoint&&function(e,t,r){e.__smithy_context?e.__smithy_context.features||(e.__smithy_context.features={}):e.__smithy_context={features:{}},e.__smithy_context.features[t]=r}(n,"ENDPOINT_OVERRIDE","N");const o=await t(i.input,{getEndpointParameterInstructions:()=>r},{...e},n);n.endpointV2=o,n.authSchemes=o.properties?.authSchemes;const a=n.authSchemes?.[0];if(a){n.signing_region=a.signingRegion,n.signing_service=a.signingName;const e=l(n),t=e?.selectedHttpAuthScheme?.httpAuthOption;t&&(t.signingProperties=Object.assign(t.signingProperties||{},{signing_region:a.signingRegion,signingRegion:a.signingRegion,signing_service:a.signingName,signingName:a.signingName,signingRegionSet:a.signingRegionSet},a.properties))}return s({...i})}}const Ne={step:"serialize",tags:["ENDPOINT_PARAMETERS","ENDPOINT_V2","ENDPOINT"],name:"endpointV2Middleware",override:!0,relation:"before",toMiddleware:"serializerMiddleware"};class Oe{nodes;root;conditions;results;constructor(e,t,r,s){this.nodes=e,this.root=t,this.conditions=r,this.results=s}static from(e,t,r,s){return new Oe(e,t,r,s)}}class $e extends Error{constructor(e){super(e),this.name="EndpointError"}}function Ue(e){return"object"!=typeof e||null==e?e:"ref"in e?`$${Ue(e.ref)}`:"fn"in e?`${e.fn}(${(e.argv||[]).map(Ue).join(", ")})`:JSON.stringify(e,null,2)}const De={};const _e=(e,t)=>(e=>{const t=e.split("."),r=[];for(const s of t){const t=s.indexOf("[");if(-1!==t){if(s.indexOf("]")!==s.length-1)throw new $e(`Path: '${e}' does not end with ']'`);const n=s.slice(t+1,-1);if(Number.isNaN(parseInt(n)))throw new $e(`Invalid array index: '${n}' in path: '${e}'`);0!==t&&r.push(s.slice(0,t)),r.push(n)}else r.push(s)}return r})(t).reduce((r,s)=>{if("object"!=typeof r)throw new $e(`Index '${s}' in '${t}' not found in '${JSON.stringify(e)}'`);if(Array.isArray(r)){const e=parseInt(s);return r[e<0?r.length+e:e]}return r[s]},e),Le=new RegExp("^(?!.*-$)(?!-)[a-zA-Z0-9-]{1,63}$"),Be=(e,t=!1)=>{if(!t)return Le.test(e);const r=e.split(".");for(const s of r)if(!Be(s))return!1;return!0};const ze=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}$"),je=e=>ze.test(e)||e.startsWith("[")&&e.endsWith("]"),He={[o.HTTP]:80,[o.HTTPS]:443};const qe={booleanEquals:(e,t)=>e===t,coalesce:function(...e){for(const t of e)if(null!=t)return t},getAttr:_e,isSet:e=>null!=e,isValidHostLabel:Be,ite:function(e,t,r){return e?t:r},not:e=>!e,parseURL:e=>{const t=(()=>{try{if(e instanceof URL)return e;if("object"==typeof e&&"hostname"in e){const{hostname:t,port:r,protocol:s="",path:n="",query:i={}}=e,o=new URL(`${s}//${t}${r?`:${r}`:""}${n}`);return o.search=Object.entries(i).map(([e,t])=>`${e}=${t}`).join("&"),o}return new URL(e)}catch(t){return null}})();if(!t)return console.error(`Unable to parse ${JSON.stringify(e)} as a whatwg URL.`),null;const r=t.href,{host:s,hostname:n,pathname:i,protocol:a,search:c}=t;if(c)return null;const u=a.slice(0,-1);if(!Object.values(o).includes(u))return null;const d=je(n);return{scheme:u,authority:`${s}${r.includes(`${s}:${He[u]}`)||"string"==typeof e&&e.includes(`${s}:${He[u]}`)?`:${He[u]}`:""}`,path:i,normalizedPath:i.endsWith("/")?i:`${i}/`,isIp:d}},split:function(e,t,r){if(1===r)return[e];if(""===e)return[""];const s=e.split(t);return 0===r?s:s.slice(0,r-1).concat(s.slice(1).join(t))},stringEquals:(e,t)=>e===t,substring:(e,t,r,s)=>null==e||t>=r||e.length<r||/[^\u0000-\u007f]/.test(e)?null:s?e.substring(e.length-r,e.length-t):e.substring(t,r),uriEncode:e=>encodeURIComponent(e).replace(/[!*'()]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)},Fe=(e,t)=>{const r=[],{referenceRecord:s,endpointParams:n}=t;let i=0;for(;i<e.length;){const t=e.indexOf("{",i);if(-1===t){r.push(e.slice(i));break}r.push(e.slice(i,t));const o=e.indexOf("}",t);if(-1===o){r.push(e.slice(t));break}"{"===e[t+1]&&"}"===e[o+1]&&(r.push(e.slice(t+1,o)),i=o+2);const a=e.substring(t+1,o);if(a.includes("#")){const[e,t]=a.split("#");r.push(_e(s[e]??n[e],t))}else r.push(s[a]??n[a]);i=o+1}return r.join("")},Ke=(e,t,r)=>{if("string"==typeof e)return Fe(e,r);if(e.fn)return We.callFunction(e,r);if(e.ref)return(({ref:e},t)=>t.referenceRecord[e]??t.endpointParams[e])(e,r);throw new $e(`'${t}': ${String(e)} is not a string, function or reference.`)},Ve=({fn:e,argv:t},r)=>{const s=Array(t.length);for(let o=0;o<s.length;++o){const e=t[o];s[o]="boolean"==typeof e||"number"==typeof e?e:We.evaluateExpression(e,"arg",r)}const n=e.indexOf(".");if(-1!==n){const t=De[e.slice(0,n)],r=t?.[e.slice(n+1)];if("function"==typeof r)return r(...s)}const i=qe[e];if("function"==typeof i)return i(...s);throw new Error(`function ${e} not loaded in endpointFunctions.`)},We={evaluateExpression:Ke,callFunction:Ve},Ge=(e,t)=>{const{assign:r}=e;if(r&&r in t.referenceRecord)throw new $e(`'${r}' is already defined in Reference Record.`);const s=Ve(e,t);t.logger?.debug?.(`endpoints evaluateCondition: ${Ue(e)} = ${Ue(s)}`);const n=""===s||!!s;return null!=r?{result:n,toAssign:{name:r,value:s}}:{result:n}},Xe=(e,t)=>Object.entries(e??{}).reduce((e,[r,s])=>(e[r]=s.map(e=>{const s=Ke(e,"Header value entry",t);if("string"!=typeof s)throw new $e(`Header '${r}' value '${s}' is not a string`);return s}),e),{}),Ye=(e,t)=>Object.entries(e).reduce((e,[r,s])=>(e[r]=Qe.getEndpointProperty(s,t),e),{}),Je=(e,t)=>{if(Array.isArray(e))return e.map(e=>Je(e,t));switch(typeof e){case"string":return Fe(e,t);case"object":if(null===e)throw new $e(`Unexpected endpoint property: ${e}`);return Qe.getEndpointProperties(e,t);case"boolean":return e;default:throw new $e("Unexpected endpoint property type: "+typeof e)}},Qe={getEndpointProperty:Je,getEndpointProperties:Ye},Ze=(e,t)=>{const r=Ke(e,"Endpoint URL",t);if("string"==typeof r)try{return new URL(r)}catch(s){throw console.error(`Failed to construct URL with ${r}`,s),s}throw new $e("Endpoint URL must be a string, got "+typeof r)},et=1e8,tt=(rt=Ee,e=>{const t=e.tls??!0,{endpoint:r,useDualstackEndpoint:s,useFipsEndpoint:n}=e,i=null!=r?async()=>Pe(await h(r)()):void 0,o=!!r,a=Object.assign(e,{endpoint:i,tls:t,isCustomEndpoint:o,useDualstackEndpoint:h(s??!1),useFipsEndpoint:h(n??!1)});let c;return a.serviceConfiguredEndpoint=async()=>(e.serviceId&&!c&&(c=rt(e.serviceId)),c),a});var rt;const st=function(e){const t=Me(e);return(e,r)=>({applyToStack:s=>{s.addRelativeTo(t({config:e,instructions:r}),Ne)}})}(Ee),nt="function"==typeof ReadableStream?ReadableStream:function(){};class it extends nt{}const ot=e=>"function"==typeof ReadableStream&&(e?.constructor?.name===ReadableStream.name||e instanceof ReadableStream),at=({expectedChecksum:e,checksum:t,source:r,checksumSourceLocation:s,base64Encoder:n})=>{if(!ot(r))throw new Error(`@smithy/util-stream: unsupported source type ${r?.constructor?.name??r} in ChecksumStream.`);const i=n??S;if("function"!=typeof TransformStream)throw new Error("@smithy/util-stream: unable to instantiate ChecksumStream because API unavailable: ReadableStream/TransformStream.");const o=new TransformStream({start(){},async transform(e,r){t.update(e),r.enqueue(e)},async flush(r){const n=await t.digest(),o=i(n);if(e!==o){const t=new Error(`Checksum mismatch: expected "${e}" but received "${o}" in response header "${s}".`);r.error(t)}else r.terminate()}});r.pipeThrough(o);const a=o.readable;return Object.setPrototypeOf(a,it.prototype),a};class ct{allocByteArray;byteLength=0;byteArrays=[];constructor(e){this.allocByteArray=e}push(e){this.byteArrays.push(e),this.byteLength+=e.byteLength}flush(){if(1===this.byteArrays.length){const e=this.byteArrays[0];return this.reset(),e}const e=this.allocByteArray(this.byteLength);let t=0;for(let r=0;r<this.byteArrays.length;++r){const s=this.byteArrays[r];e.set(s,t),t+=s.byteLength}return this.reset(),e}reset(){this.byteArrays=[],this.byteLength=0}}const ut=function(e,t,r){const s=e.getReader();let n=!1,i=0;const o=["",new ct(e=>new Uint8Array(e))];let a=-1;const c=async e=>{const{value:u,done:d}=await s.read(),l=u;if(d){if(-1!==a){const t=dt(o,a);lt(t)>0&&e.enqueue(t)}e.close()}else{const s=function(e,t=!0){if(t&&"undefined"!=typeof Buffer&&e instanceof Buffer)return 2;if(e instanceof Uint8Array)return 1;if("string"==typeof e)return 0;return-1}(l,!1);if(a!==s&&(a>=0&&e.enqueue(dt(o,a)),a=s),-1===a)return void e.enqueue(l);const u=lt(l);i+=u;const d=lt(o[a]);if(u>=t&&0===d)e.enqueue(l);else{const s=function(e,t,r){switch(t){case 0:return e[0]+=r,lt(e[0]);case 1:case 2:return e[t].push(r),lt(e[t])}}(o,a,l);!n&&i>2*t&&(n=!0,r?.warn(`@smithy/util-stream - stream chunk size ${u} is below threshold of ${t}, automatically buffering.`)),s>=t?e.enqueue(dt(o,a)):await c(e)}}};return new ReadableStream({pull:c})};function dt(e,t){switch(t){case 0:const r=e[0];return e[0]="",r;case 1:case 2:return e[t].flush()}throw new Error(`@smithy/util-stream - invalid index ${t} given to flush()`)}function lt(e){return e?.byteLength??e?.length??0}const ht=(e,t)=>{const{base64Encoder:r,bodyLengthChecker:s,checksumAlgorithmFn:n,checksumLocationName:i,streamHasher:o}=t,a=void 0!==r&&void 0!==s&&void 0!==n&&void 0!==i&&void 0!==o,c=a?o(n,e):void 0,u=e.getReader();return new ReadableStream({async pull(e){const{value:t,done:n}=await u.read();if(n){if(e.enqueue("0\r\n"),a){const t=r(await c);e.enqueue(`${i}:${t}\r\n`),e.enqueue("\r\n")}e.close()}else e.enqueue(`${(s(t)||0).toString(16)}\r\n${t}\r\n`)}})},ft=async e=>"function"==typeof Blob&&e instanceof Blob||"Blob"===e.constructor?.name?void 0!==Blob.prototype.arrayBuffer?new Uint8Array(await e.arrayBuffer()):async function(e){const t=await function(e){return new Promise((t,r)=>{const s=new FileReader;s.onloadend=()=>{if(2!==s.readyState)return r(new Error("Reader aborted too early"));const e=s.result??"",n=e.indexOf(","),i=n>-1?n+1:e.length;t(e.substring(i))},s.onabort=()=>r(new Error("Read aborted")),s.onerror=()=>r(s.error),s.readAsDataURL(e)})}(e),r=w(t);return new Uint8Array(r)}(e):async function(e){const t=[],r=e.getReader();let s=!1,n=0;for(;!s;){const{done:e,value:i}=await r.read();i&&(t.push(i),n+=i.length),s=e}const i=new Uint8Array(n);let o=0;for(const a of t)i.set(a,o),o+=a.length;return i}(e);const pt="The stream has already been transformed.",mt=e=>{if(!gt(e)&&!ot(e)){throw new Error(`Unexpected stream implementation, expect Blob or ReadableStream, got ${e?.__proto__?.constructor?.name||e}`)}let t=!1;const r=async()=>{if(t)throw new Error(pt);return t=!0,await ft(e)};return Object.assign(e,{transformToByteArray:r,transformToString:async e=>{const t=await r();if("base64"===e)return S(t);if("hex"===e)return ye(t);if(void 0===e||"utf8"===e||"utf-8"===e)return v(t);if("function"==typeof TextDecoder)return new TextDecoder(e).decode(t);throw new Error("TextDecoder is not available, please make sure polyfill is provided.")},transformToWebStream:()=>{if(t)throw new Error(pt);if(t=!0,gt(e))return(e=>{if("function"!=typeof e.stream)throw new Error("Cannot transform payload Blob to web stream. Please make sure the Blob.stream() is polyfilled.\nIf you are using React Native, this API is not yet supported, see: https://react-native.canny.io/feature-requests/p/fetch-streaming-body");return e.stream()})(e);if(ot(e))return e;throw new Error(`Cannot transform payload to web stream, got ${e}`)}})},gt=e=>"function"==typeof Blob&&e instanceof Blob;class yt extends(function(e,t,r,s){return class n extends Uint8Array{static fromString(e,r="utf-8"){if("string"==typeof e)return"base64"===r?n.mutate(s(e)):n.mutate(t(e));throw new Error(`Unsupported conversion from ${typeof e} to Uint8ArrayBlobAdapter.`)}static mutate(e){return Object.setPrototypeOf(e,n.prototype),e}transformToString(t="utf-8"){return"base64"===t?r(this):e(this)}}}(v,b,S,w)){}const wt=(bt=e=>crypto.getRandomValues(e),"undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID?()=>crypto.randomUUID():()=>{const e=new Uint8Array(16);return bt(e),e[6]=15&e[6]|64,e[8]=63&e[8]|128,E[e[0]]+E[e[1]]+E[e[2]]+E[e[3]]+"-"+E[e[4]]+E[e[5]]+"-"+E[e[6]]+E[e[7]]+"-"+E[e[8]]+E[e[9]]+"-"+E[e[10]]+E[e[11]]+E[e[12]]+E[e[13]]+E[e[14]]+E[e[15]]});var bt;const St=wt,vt=async(e=new Uint8Array,t)=>{if(e instanceof Uint8Array)return yt.mutate(e);if(!e)return yt.mutate(new Uint8Array);const r=t.streamCollector(e);return yt.mutate(await r)};function Et(e){return encodeURIComponent(e).replace(/[!'()*]/g,function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})}class Ct{serdeContext;setSerdeContext(e){this.serdeContext=e}}class At{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){const t=new At({...e,headers:{...e.headers}});var r;return t.query&&(t.query=(r=t.query,Object.keys(r).reduce((e,t)=>{const s=r[t];return{...e,[t]:Array.isArray(s)?[...s]:s}},{}))),t}static isInstance(e){if(!e)return!1;const t=e;return"method"in t&&"protocol"in t&&"hostname"in t&&"path"in t&&"object"==typeof t.query&&"object"==typeof t.headers}clone(){return At.clone(this)}}class xt{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;const t=e;return"number"==typeof t.statusCode&&"object"==typeof t.headers}}class kt extends Ct{options;compositeErrorRegistry;constructor(e){super(),this.options=e,this.compositeErrorRegistry=er.for(e.defaultNamespace);for(const t of e.errorTypeRegistries??[])this.compositeErrorRegistry.copyFrom(t)}getRequestType(){return At}getResponseType(){return xt}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(const[r,s]of t.url.searchParams.entries())e.query[r]=s;if(t.headers)for(const r in t.headers)e.headers[r]=t.headers[r].join(", ");return e}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(const r in t.headers)e.headers[r]=t.headers[r];return e}setHostPrefix(e,t,r){if(this.serdeContext?.disableHostPrefix)return;const s=Yt.of(t.input),n=Kt(t.traits??{});if(n.endpoint){let t=n.endpoint?.[0];if("string"==typeof t){for(const[e,n]of s.structIterator()){if(!n.getMergedTraits().hostLabel)continue;const s=r[e];if("string"!=typeof s)throw new Error(`@smithy/core/schema - ${e} in input must be a string as hostLabel.`);t=t.replace(`{${e}}`,s)}e.hostname=t+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(){const{EventStreamSerde:e}=await import("./index.browser-CZ9CQ86G.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,n){return[]}getEventStreamMarshaller(){const e=this.serdeContext;if(!e.eventStreamMarshaller)throw new Error("@smithy/core - HttpProtocol: eventStreamMarshaller missing in serdeContext.");return e.eventStreamMarshaller}}class Rt extends kt{async serializeRequest(e,t,r){const s=t&&"object"==typeof t?t:{},n=this.serializer,i={},o={},a=await r.endpoint(),c=Yt.of(e?.input),u=[],d=[];let l,h=!1;const f=new At({protocol:"",hostname:"",port:void 0,path:"",fragment:void 0,query:i,headers:o,body:void 0});if(a){this.updateServiceEndpoint(f,a),this.setHostPrefix(f,e,s);const t=Kt(e.traits);if(t.http){f.method=t.http[0];const[e,r]=t.http[1].split("?");"/"==f.path?f.path=e:f.path+=e;const s=new URLSearchParams(r??"");for(const[t,n]of s)i[t]=n}}for(const[p,m]of c.structIterator()){const e=m.getMergedTraits()??{},t=s[p];if(null!=t||m.isIdempotencyToken())if(e.httpPayload){if(m.isStreaming()){m.isStructSchema()?s[p]&&(l=await this.serializeEventStream({eventStream:s[p],requestSchema:c})):l=t}else n.write(m,t),l=n.flush()}else if(e.httpLabel){n.write(m,t);const e=n.flush();f.path.includes(`{${p}+}`)?f.path=f.path.replace(`{${p}+}`,e.split("/").map(Et).join("/")):f.path.includes(`{${p}}`)&&(f.path=f.path.replace(`{${p}}`,Et(e)))}else if(e.httpHeader)n.write(m,t),o[e.httpHeader.toLowerCase()]=String(n.flush());else if("string"==typeof e.httpPrefixHeaders)for(const r in t){const s=t[r],i=e.httpPrefixHeaders+r;n.write([m.getValueSchema(),{httpHeader:i}],s),o[i.toLowerCase()]=n.flush()}else e.httpQuery||e.httpQueryParams?this.serializeQuery(m,t,i):(h=!0,u.push(p),d.push(m));else if(e.httpLabel&&(f.path.includes(`{${p}+}`)||f.path.includes(`{${p}}`)))throw new Error(`No value provided for input HTTP label: ${p}.`)}if(h&&s){const[e,t]=(c.getName(!0)??"#Unknown").split("#"),r=c.getSchema()[6],i=[3,e,t,c.getMergedTraits(),u,d,void 0];r?i[6]=r:i.pop(),n.write(i,s),l=n.flush()}return f.headers=o,f.query=i,f.body=l,f}serializeQuery(e,t,r){const s=this.serializer,n=e.getMergedTraits();if(n.httpQueryParams){for(const i in t)if(!(i in r)){const s=t[i],o=e.getValueSchema();Object.assign(o.getMergedTraits(),{...n,httpQuery:i,httpQueryParams:void 0}),this.serializeQuery(o,s,r)}}else if(e.isListSchema()){const i=!!e.getMergedTraits().sparse,o=[];for(const r of t){s.write([e.getValueSchema(),n],r);const t=s.flush();(i||void 0!==t)&&o.push(t)}r[n.httpQuery]=o}else s.write([e,n],t),r[n.httpQuery]=s.flush()}async deserializeResponse(e,t,r){const s=this.deserializer,n=Yt.of(e.output),i={};if(r.statusCode>=300){const n=await vt(r.body,t);throw n.byteLength>0&&Object.assign(i,await s.read(15,n)),await this.handleError(e,t,r,i,this.deserializeMetadata(r)),new Error("@smithy/core/protocols - HTTP Protocol error handler failed to throw.")}for(const a in r.headers){const e=r.headers[a];delete r.headers[a],r.headers[a.toLowerCase()]=e}const o=await this.deserializeHttpMessage(n,t,r,i);if(o.length){const e=await vt(r.body,t);if(e.byteLength>0){const t=await s.read(n,e);for(const e of o)null!=t[e]&&(i[e]=t[e])}}else o.discardResponseBody&&await vt(r.body,t);return i.$metadata=this.deserializeMetadata(r),i}async deserializeHttpMessage(e,t,r,s,n){let i;i=s instanceof Set?n:s;let o=!0;const a=this.deserializer,c=Yt.of(e),u=[];for(const[d,l]of c.structIterator()){const e=l.getMemberTraits();if(e.httpPayload){o=!1;if(l.isStreaming()){const e=l.isStructSchema();i[d]=e?await this.deserializeEventStream({response:r,responseSchema:c}):mt(r.body)}else if(r.body){const e=await vt(r.body,t);e.byteLength>0&&(i[d]=await a.read(l,e))}}else if(e.httpHeader){const t=String(e.httpHeader).toLowerCase(),s=r.headers[t];if(null!=s)if(l.isListSchema()){const e=l.getValueSchema();let r;e.getMergedTraits().httpHeader=t,r=e.isTimestampSchema()&&4===e.getSchema()?de(s,",",2):le(s);const n=[];for(const t of r)n.push(await a.read(e,t.trim()));i[d]=n}else i[d]=await a.read(l,s)}else if(void 0!==e.httpPrefixHeaders){i[d]={};for(const t in r.headers)if(t.startsWith(e.httpPrefixHeaders)){const s=r.headers[t],n=l.getValueSchema();n.getMergedTraits().httpHeader=t,i[d][t.slice(e.httpPrefixHeaders.length)]=await a.read(n,s)}}else e.httpResponseCode?i[d]=r.statusCode:u.push(d)}return u.discardResponseBody=o,u}}function Tt(e,t){if(t.timestampFormat.useTrait&&e.isTimestampSchema()&&(5===e.getSchema()||6===e.getSchema()||7===e.getSchema()))return e.getSchema();const{httpLabel:r,httpPrefixHeaders:s,httpHeader:n,httpQuery:i}=e.getMergedTraits();return(t.httpBindings?"string"==typeof s||Boolean(n)?6:Boolean(i)||Boolean(r)?5:void 0:void 0)??t.timestampFormat.default}class Pt extends Ct{settings;constructor(e){super(),this.settings=e}read(e,t){const r=Yt.of(e);if(r.isListSchema())return le(t).map(e=>this.read(r.getValueSchema(),e));if(r.isBlobSchema())return(this.serdeContext?.base64Decoder??w)(t);if(r.isTimestampSchema()){switch(Tt(r,this.settings)){case 5:return(e=>{if(null==e)return;if("string"!=typeof e)throw new TypeError("RFC3339 timestamps must be strings");const t=ne.exec(e);if(!t)throw new TypeError(`Invalid RFC3339 timestamp format ${e}`);const[,r,s,n,i,o,a,,c,u]=t;ue(s,1,12),ue(n,1,31),ue(i,0,23),ue(o,0,59),ue(a,0,60);const d=new Date(Date.UTC(Number(r),Number(s)-1,Number(n),Number(i),Number(o),Number(a),Number(c)?Math.round(1e3*parseFloat(`0.${c}`)):0));if(d.setUTCFullYear(Number(r)),"Z"!=u.toUpperCase()){const[,e,t,r]=/([+-])(\d\d):(\d\d)/.exec(u)||[void 0,"+",0,0],s="-"===e?1:-1;d.setTime(d.getTime()+s*(60*Number(t)*60*1e3+60*Number(r)*1e3))}return d})(t);case 6:return(e=>{if(null==e)return;if("string"!=typeof e)throw new TypeError("RFC7231 timestamps must be strings.");let t,r,s,n,i,o,a,c;if((c=ie.exec(e))?[,t,r,s,n,i,o,a]=c:(c=oe.exec(e))?([,t,r,s,n,i,o,a]=c,s=(Number(s)+1900).toString()):(c=ae.exec(e))&&([,r,t,n,i,o,a,s]=c),s&&o){const e=Date.UTC(Number(s),ce.indexOf(r),Number(t),Number(n),Number(i),Number(o),a?Math.round(1e3*parseFloat(`0.${a}`)):0);ue(t,1,31),ue(n,0,23),ue(i,0,59),ue(o,0,60);const c=new Date(e);return c.setUTCFullYear(Number(s)),c}throw new TypeError(`Invalid RFC7231 date-time value ${e}.`)})(t);case 7:return(e=>{if(null==e)return;let t=NaN;if("number"==typeof e)t=e;else if("string"==typeof e){if(!/^-?\d*\.?\d+$/.test(e))throw new TypeError("parseEpochTimestamp - numeric string invalid.");t=Number.parseFloat(e)}else"object"==typeof e&&1===e.tag&&(t=e.value);if(isNaN(t)||Math.abs(t)===1/0)throw new TypeError("Epoch timestamps must be valid finite numbers.");return new Date(Math.round(1e3*t))})(t);default:return console.warn("Missing timestamp format, parsing value with Date constructor:",t),new Date(t)}}if(r.isStringSchema()){const e=r.getMergedTraits().mediaType;let s=t;if(e){r.getMergedTraits().httpHeader&&(s=this.base64ToUtf8(s));return("application/json"===e||e.endsWith("+json"))&&(s=J.from(s)),s}}return r.isNumericSchema()?Number(t):r.isBigIntegerSchema()?BigInt(t):r.isBigDecimalSchema()?new fe(t,"bigDecimal"):r.isBooleanSchema()?"true"===String(t).toLowerCase():t}base64ToUtf8(e){return(this.serdeContext?.utf8Encoder??v)((this.serdeContext?.base64Decoder??w)(e))}}class It extends Ct{codecDeserializer;stringDeserializer;constructor(e,t){super(),this.codecDeserializer=e,this.stringDeserializer=new Pt(t)}setSerdeContext(e){this.stringDeserializer.setSerdeContext(e),this.codecDeserializer.setSerdeContext(e),this.serdeContext=e}read(e,t){const r=Yt.of(e),s=r.getMergedTraits(),n=this.serdeContext?.utf8Encoder??v;if(s.httpHeader||s.httpResponseCode)return this.stringDeserializer.read(r,n(t));if(s.httpPayload){if(r.isBlobSchema()){const e=this.serdeContext?.utf8Decoder??b;return"string"==typeof t?e(t):t}if(r.isStringSchema())return"byteLength"in t?n(t):t}return this.codecDeserializer.read(r,t)}}class Mt extends Ct{settings;stringBuffer="";constructor(e){super(),this.settings=e}write(e,t){const r=Yt.of(e);switch(typeof t){case"object":if(null===t)return void(this.stringBuffer="null");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(Tt(r,this.settings)){case 5:this.stringBuffer=t.toISOString().replace(".000Z","Z");break;case 6:this.stringBuffer=D(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)return void(this.stringBuffer=(this.serdeContext?.base64Encoder??S)(t));if(r.isListSchema()&&Array.isArray(t)){let e="";for(const s of t){this.write([r.getValueSchema(),r.getMergedTraits()],s);const t=this.flush();""!==e&&(e+=", "),e+=r.getValueSchema().isTimestampSchema()?t:Q(t)}return void(this.stringBuffer=e)}this.stringBuffer=JSON.stringify(t,null,2);break;case"string":const e=r.getMergedTraits().mediaType;let s=t;if(e){if(("application/json"===e||e.endsWith("+json"))&&(s=J.from(s)),r.getMergedTraits().httpHeader)return void(this.stringBuffer=(this.serdeContext?.base64Encoder??S)(s.toString()))}this.stringBuffer=t;break;default:r.isIdempotencyToken()?this.stringBuffer=St():this.stringBuffer=String(t)}}flush(){const e=this.stringBuffer;return this.stringBuffer="",e}}class Nt{codecSerializer;stringSerializer;buffer;constructor(e,t,r=new Mt(t)){this.codecSerializer=e,this.stringSerializer=r}setSerdeContext(e){this.codecSerializer.setSerdeContext(e),this.stringSerializer.setSerdeContext(e)}write(e,t){const r=Yt.of(e),s=r.getMergedTraits();return s.httpHeader||s.httpLabel||s.httpQuery?(this.stringSerializer.write(r,t),void(this.buffer=this.stringSerializer.flush())):this.codecSerializer.write(r,t)}flush(){if(void 0!==this.buffer){const e=this.buffer;return this.buffer=void 0,e}return this.codecSerializer.flush()}}const Ot="content-length";const $t={step:"build",tags:["SET_CONTENT_LENGTH","CONTENT_LENGTH"],name:"contentLengthMiddleware",override:!0},Ut=e=>({applyToStack:t=>{var r;t.add((r=e.bodyLengthChecker,e=>async t=>{const s=t.request;if(At.isInstance(s)){const{body:e,headers:t}=s;if(e&&-1===Object.keys(t).map(e=>e.toLowerCase()).indexOf(Ot))try{const t=r(e);s.headers={...s.headers,[Ot]:String(t)}}catch(n){}}return e({...t,request:s})}),$t)}}),Dt=e=>encodeURIComponent(e).replace(/[!'()*]/g,_t),_t=e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`;const Lt=e=>{if("string"==typeof e)return Lt(new URL(e));const{hostname:t,pathname:r,port:s,protocol:n,search:i}=e;let o;return i&&(o=function(e){const t={};if(e=e.replace(/^\?/,""))for(const r of e.split("&")){let[e,s=null]=r.split("=");e=decodeURIComponent(e),s&&(s=decodeURIComponent(s)),e in t?Array.isArray(t[e])?t[e].push(s):t[e]=[t[e],s]:t[e]=s}return t}(i)),{hostname:t,port:s?parseInt(s):void 0,protocol:n,path:r,query:o}},Bt=(e,t,r,s,n)=>({name:t,namespace:e,traits:r,input:s,output:n}),zt=(e,t)=>(t.find(([t])=>t.match(e))||[void 0,void 0])[1],jt={name:"deserializerMiddleware",step:"deserialize",tags:["DESERIALIZER"],override:!0},Ht={name:"serializerMiddleware",step:"serialize",tags:["SERIALIZER"],override:!0};function qt(e){return{applyToStack:t=>{t.add((e=>(t,r)=>async s=>{const{operationSchema:n}=l(r),[,i,o,a,c,u]=n??[],d=r.endpointV2?async()=>Pe(r.endpointV2):e.endpoint,h=await e.protocol.serializeRequest(Bt(i,o,a,c,u),s.input,{...e,...r,endpoint:d});return t({...s,request:h})})(e),Ht),t.add((e=>(t,r)=>async s=>{const{response:n}=await t(s),{operationSchema:i}=l(r),[,o,a,c,u,d]=i??[];try{return{response:n,output:await e.protocol.deserializeResponse(Bt(o,a,c,u,d),{...e,...r},n)}}catch(h){if(Object.defineProperty(h,"$response",{value:n,enumerable:!1,writable:!1,configurable:!1}),!("$metadata"in h)){const e="Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.";try{h.message+="\n "+e}catch(f){r.logger&&"NoOpLogger"!==r.logger?.constructor?.name?r.logger?.warn?.(e):console.warn(e)}void 0!==h.$responseBodyText&&h.$response&&(h.$response.body=h.$responseBodyText);try{if(xt.isInstance(n)){const{headers:e={}}=n,t=Object.entries(e);h.$metadata={httpStatusCode:n.statusCode,requestId:zt(/^x-[\w-]+-request-?id$/,t),extendedRequestId:zt(/^x-[\w-]+-id-2$/,t),cfId:zt(/^x-[\w-]+-cf-id$/,t)}}}catch(f){}}throw h}})(e),jt),e.protocol.setSerdeContext(e)}}}const Ft=[];function Kt(e){if("object"==typeof e)return e;if(Ft[e|=0])return Ft[e];const t={};let r=0;for(const s of["httpLabel","idempotent","idempotencyToken","sensitive","httpPayload","httpResponseCode","httpQueryParams"])1==(e>>r++&1)&&(t[s]=1);return Ft[e]=t}const Vt=/* @__PURE__ */Symbol.for("@smithy/nor-struct-it"),Wt=/* @__PURE__ */Symbol.for("@smithy/ns"),Gt=[],Xt={};class Yt{ref;memberName;static symbol=/* @__PURE__ */Symbol.for("@smithy/nor");symbol=Yt.symbol;name;schema;_isMemberSchema;traits;memberTraits;normalizedTraits;constructor(e,t){this.ref=e,this.memberName=t;const r=[];let s=e,n=e;for(this._isMemberSchema=!1;Qt(s);)r.push(s[1]),s=s[0],n=p(s),this._isMemberSchema=!0;if(r.length>0){this.memberTraits={};for(let e=r.length-1;e>=0;--e){const t=r[e];Object.assign(this.memberTraits,Kt(t))}}else this.memberTraits=0;if(n instanceof Yt){const e=this.memberTraits;return Object.assign(this,n),this.memberTraits=Object.assign({},e,n.getMemberTraits(),this.getMemberTraits()),this.normalizedTraits=void 0,void(this.memberName=t??n.memberName)}if(this.schema=p(n),Zt(this.schema)?(this.name=`${this.schema[1]}#${this.schema[2]}`,this.traits=this.schema[3]):(this.name=this.memberName??String(n),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){const t=this.prototype.isPrototypeOf(e);if(!t&&"object"==typeof e&&null!==e){return e.symbol===this.symbol}return t}static of(e){const t="function"==typeof e||"object"==typeof e&&null!==e;if("number"==typeof e){if(Gt[e])return Gt[e]}else if("string"==typeof e){if(Xt[e])return Xt[e]}else if(t&&e[Wt])return e[Wt];const r=p(e);if(r instanceof Yt)return r;if(Qt(r)){const[t,s]=r;if(t instanceof Yt)return Object.assign(t.getMergedTraits(),Kt(s)),t;throw new Error(`@smithy/core/schema - may not init unwrapped member schema=${JSON.stringify(e,null,2)}.`)}const s=new Yt(r);return t?e[Wt]=s:"string"==typeof r?Xt[r]=s:"number"==typeof r?Gt[r]=s:s}getSchema(){const e=this.schema;return Array.isArray(e)&&0===e[0]?e[4]:e}getName(e=!1){const{name:t}=this;return!e&&t&&t.includes("#")?t.split("#")[1]:t||void 0}getMemberName(){return this.memberName}isMemberSchema(){return this._isMemberSchema}isListSchema(){const e=this.getSchema();return"number"==typeof e?e>=64&&e<128:1===e[0]}isMapSchema(){const e=this.getSchema();return"number"==typeof e?e>=128&&e<=255:2===e[0]}isStructSchema(){const e=this.getSchema();if("object"!=typeof e)return!1;const t=e[0];return 3===t||-3===t||4===t}isUnionSchema(){const e=this.getSchema();return"object"==typeof e&&4===e[0]}isBlobSchema(){const e=this.getSchema();return 21===e||42===e}isTimestampSchema(){const e=this.getSchema();return"number"==typeof e&&e>=4&&e<=7}isUnitSchema(){return"unit"===this.getSchema()}isDocumentSchema(){return 15===this.getSchema()}isStringSchema(){return 0===this.getSchema()}isBooleanSchema(){return 2===this.getSchema()}isNumericSchema(){return 1===this.getSchema()}isBigIntegerSchema(){return 17===this.getSchema()}isBigDecimalSchema(){return 19===this.getSchema()}isStreaming(){const{streaming:e}=this.getMergedTraits();return!!e||42===this.getSchema()}isIdempotencyToken(){return!!this.getMergedTraits().idempotencyToken}getMergedTraits(){return this.normalizedTraits??(this.normalizedTraits={...this.getOwnTraits(),...this.getMemberTraits()})}getMemberTraits(){return Kt(this.memberTraits)}getOwnTraits(){return Kt(this.traits)}getKeySchema(){const[e,t]=[this.isDocumentSchema(),this.isMapSchema()];if(!e&&!t)throw new Error(`@smithy/core/schema - cannot get key for non-map: ${this.getName(!0)}`);const r=this.getSchema();return Jt([e?15:r[4]??0,0],"key")}getValueSchema(){const e=this.getSchema(),[t,r,s]=[this.isDocumentSchema(),this.isMapSchema(),this.isListSchema()],n="number"==typeof e?63&e:e&&"object"==typeof e&&(r||s)?e[3+e[0]]:t?15:void 0;if(null!=n)return Jt([n,0],r?"value":"member");throw new Error(`@smithy/core/schema - ${this.getName(!0)} has no value member.`)}getMemberSchema(e){const t=this.getSchema();if(this.isStructSchema()&&t[4].includes(e)){const r=t[4].indexOf(e),s=t[5][r];return Jt(Qt(s)?s:[s,0],e)}if(this.isDocumentSchema())return Jt([15,0],e);throw new Error(`@smithy/core/schema - ${this.getName(!0)} has no member=${e}.`)}getMemberSchemas(){const e={};try{for(const[t,r]of this.structIterator())e[t]=r}catch(t){}return e}getEventStreamMember(){if(this.isStructSchema())for(const[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.");const e=this.getSchema(),t=e[4].length;let r=e[Vt];if(r&&t===r.length)yield*r;else{r=Array(t);for(let s=0;s<t;++s){const t=e[4][s],n=Jt([e[5][s],0],t);yield r[s]=[t,n]}e[Vt]=r}}}function Jt(e,t){if(e instanceof Yt)return Object.assign(e,{memberName:t,_isMemberSchema:!0});return new Yt(e,t)}const Qt=e=>Array.isArray(e)&&2===e.length,Zt=e=>Array.isArray(e)&&e.length>=5;class er{namespace;schemas;exceptions;static registries=/* @__PURE__ */new Map;constructor(e,t=/* @__PURE__ */new Map,r=/* @__PURE__ */new Map){this.namespace=e,this.schemas=t,this.exceptions=r}static for(e){return er.registries.has(e)||er.registries.set(e,new er(e)),er.registries.get(e)}copyFrom(e){const{schemas:t,exceptions:r}=this;for(const[s,n]of e.schemas)t.has(s)||t.set(s,n);for(const[s,n]of e.exceptions)r.has(s)||r.set(s,n)}register(e,t){const r=this.normalizeShapeId(e);for(const s of[this,er.for(r.split("#")[0])])s.schemas.set(r,t)}getSchema(e){const t=this.normalizeShapeId(e);if(!this.schemas.has(t)){if(!e.includes("#")){const t="#"+e,r=[];for(const[e,s]of this.schemas.entries())e.endsWith(t)&&r.push(s);if(1===r.length)return r[0]}throw new Error(`@smithy/core/schema - schema not found for ${t}`)}return this.schemas.get(t)}registerError(e,t){const r=e,s=r[1];for(const n of[this,er.for(s)])n.schemas.set(s+"#"+r[2],r),n.exceptions.set(r,t)}getErrorCtor(e){const t=e;if(this.exceptions.has(t))return this.exceptions.get(t);return er.for(t[1]).exceptions.get(t)}getBaseException(){for(const e of this.exceptions.keys())if(Array.isArray(e)){const[,t,r]=e,s=t+"#"+r;if(s.startsWith("smithy.ts.sdk.synthetic.")&&s.endsWith("ServiceException"))return e}}find(e){for(const 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}}const tr="***SensitiveInformation***";function rr(e,t){if(null==t)return t;const r=Yt.of(e);if(r.getMergedTraits().sensitive)return tr;if(r.isListSchema()){if(!!r.getValueSchema().getMergedTraits().sensitive)return tr}else if(r.isMapSchema()){if(!!r.getKeySchema().getMergedTraits().sensitive||!!r.getValueSchema().getMergedTraits().sensitive)return tr}else if(r.isStructSchema()&&"object"==typeof t){const e=t,s={};for(const[t,n]of r.structIterator())null!=e[t]&&(s[t]=rr(n,e[t]));return s}return t}class sr{middlewareStack=s();schema;static classBuilder(){return new nr}resolveMiddlewareWithContext(e,t,r,{middlewareFn:s,clientName:n,commandName:i,inputFilterSensitiveLog:o,outputFilterSensitiveLog:a,smithyContext:c,additionalContext:u,CommandCtor:l}){for(const d of s.bind(this)(l,e,t,r))this.middlewareStack.use(d);const h=e.concat(this.middlewareStack),{logger:f}=t,p={logger:f,clientName:n,commandName:i,inputFilterSensitiveLog:o,outputFilterSensitiveLog:a,[d]:{commandInstance:this,...c},...u},{requestHandler:m}=t;let g=r??{};return c.eventStream&&(g={isEventStream:!0,...g}),h.resolve(e=>m.handle(e.request,g),p)}}class nr{_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,t,r={}){return this._smithyContext={service:e,operation:t,...r},this}c(e={}){return this._additionalContext=e,this}n(e,t){return this._clientName=e,this._commandName=t,this}f(e=e=>e,t=e=>e){return this._inputFilterSensitiveLog=e,this._outputFilterSensitiveLog=t,this}ser(e){return this._serializer=e,this}de(e){return this._deserializer=e,this}sc(e){return this._operationSchema=e,this._smithyContext.operationSchema=e,this}build(){const e=this;let t;return t=class extends sr{input;static getEndpointParameterInstructions(){return e._ep}constructor(...[t]){super(),this.input=t??{},e._init(this),this.schema=e._operationSchema}resolveMiddleware(r,s,n){const i=e._operationSchema,o=i?.[4]??i?.input,a=i?.[5]??i?.output;return this.resolveMiddlewareWithContext(r,s,n,{CommandCtor:t,middlewareFn:e._middlewareFn,clientName:e._clientName,commandName:e._commandName,inputFilterSensitiveLog:e._inputFilterSensitiveLog??(i?rr.bind(null,o):e=>e),outputFilterSensitiveLog:e._outputFilterSensitiveLog??(i?rr.bind(null,a):e=>e),smithyContext:e._smithyContext,additionalContext:e._additionalContext})}serialize=e._serializer;deserialize=e._deserializer}}}class ir 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;const t=e;return ir.prototype.isPrototypeOf(t)||Boolean(t.$fault)&&Boolean(t.$metadata)&&("client"===t.$fault||"server"===t.$fault)}static[Symbol.hasInstance](e){if(!e)return!1;const t=e;return this===ir?ir.isInstance(e):!!ir.isInstance(e)&&(t.name&&this.name?this.prototype.isPrototypeOf(e)||t.name===this.name:this.prototype.isPrototypeOf(e))}}const or=(e,t={})=>{Object.entries(t).filter(([,e])=>void 0!==e).forEach(([t,r])=>{null!=e[t]&&""!==e[t]||(e[t]=r)});const r=e.message||e.Message||"UnknownError";return e.message=r,delete e.Message,e},ar=e=>{switch(e){case"standard":case"cross-region":return{retryMode:"standard",connectionTimeout:3100};case"in-region":return{retryMode:"standard",connectionTimeout:1100};case"mobile":return{retryMode:"standard",connectionTimeout:3e4};default:return{}}},cr=Object.values(c),ur=e=>Object.assign((e=>{const t=[];for(const r in c){const s=c[r];void 0!==e[s]&&t.push({algorithmId:()=>s,checksumConstructor:()=>e[s]})}for(const[r,s]of Object.entries(e.checksumAlgorithms??{}))t.push({algorithmId:()=>r,checksumConstructor:()=>s});return{addChecksumAlgorithm(r){e.checksumAlgorithms=e.checksumAlgorithms??{};const s=r.algorithmId(),n=r.checksumConstructor();cr.includes(s)?e.checksumAlgorithms[s.toUpperCase()]=n:e.checksumAlgorithms[s]=n,t.push(r)},checksumAlgorithms:()=>t}})(e),(e=>({setRetryStrategy(t){e.retryStrategy=t},retryStrategy:()=>e.retryStrategy}))(e)),dr=e=>Object.assign((e=>{const t={};return e.checksumAlgorithms().forEach(e=>{const r=e.algorithmId();cr.includes(r)&&(t[r]=e.checksumConstructor())}),t})(e),(e=>{const t={};return t.retryStrategy=e.retryStrategy(),t})(e)),lr=e=>{const t="#text";for(const r in e)e.hasOwnProperty(r)&&void 0!==e[r][t]?e[r]=e[r][t]:"object"==typeof e[r]&&null!==e[r]&&(e[r]=lr(e[r]));return e};class hr{trace(){}debug(){}info(){}warn(){}error(){}}const fr=["BandwidthLimitExceeded","EC2ThrottledException","LimitExceededException","PriorRequestNotComplete","ProvisionedThroughputExceededException","RequestLimitExceeded","RequestThrottled","RequestThrottledException","SlowDown","ThrottledException","Throttling","ThrottlingException","TooManyRequestsException","TransactionInProgressException"],pr=["TimeoutError","RequestTimeout","RequestTimeoutException"],mr=[500,502,503,504],gr=["ECONNRESET","ECONNREFUSED","EPIPE","ETIMEDOUT"],yr=["EHOSTUNREACH","ENETUNREACH","ENOTFOUND"],wr=e=>429===e.$metadata?.httpStatusCode||fr.includes(e.name)||1==e.$retryable?.throttling,br=(e,t=0)=>(e=>void 0!==e?.$retryable)(e)||(e=>e.$metadata?.clockSkewCorrected)(e)||"InvalidSignatureException"===e.name&&e.message?.includes("Signature expired")||pr.includes(e.name)||gr.includes(e?.code||"")||yr.includes(e?.code||"")||mr.includes(e.$metadata?.httpStatusCode||0)||(e=>!!(e&&e instanceof TypeError)&&/* @__PURE__ */new Set(["Failed to fetch","NetworkError when attempting to fetch resource","The Internet connection appears to be offline","Load failed","Network request failed"]).has(e.message))(e)||function(e){return"ERR_HTTP2_STREAM_ERROR"===e.code&&e.message.includes("NGHTTP2_REFUSED_STREAM")}(e)||void 0!==e.cause&&t<=10&&br(e.cause,t+1);const Sr=e=>e instanceof Error?e:e instanceof Object?Object.assign(new Error,e):"string"==typeof e?new Error(e):new Error(`AWS SDK error wrapper for ${e}`);const vr=e=>new Promise(t=>setTimeout(t,e)),Er=e=>void 0!==e.acquireInitialRetryToken&&void 0!==e.refreshRetryTokenForRetry&&void 0!==e.recordSuccess,Cr=(e,t)=>{const r={error:e,errorType:Ar(e)},s=function(e,t){if(xt.isInstance(e))for(const s of Object.keys(e.headers)){const n=s.toLowerCase();if("retry-after"===n){const n=e.headers[s];let i=NaN;if(n.endsWith("GMT"))try{i=(z(n).getTime()-Date.now())/1e3}catch(r){t?.trace?.("Failed to parse retry-after header"),t?.trace?.(r)}else n.match(/ GMT, ((\d+)|(\d+\.\d+))$/)?i=Number(n.match(/ GMT, ([\d.]+)$/)?.[1]):n.match(/^((\d+)|(\d+\.\d+))$/)?i=Number(n):Date.parse(n)>=Date.now()&&(i=(Date.parse(n)-Date.now())/1e3);if(isNaN(i))return;return new Date(Date.now()+1e3*i)}if("x-amz-retry-after"===n){const r=e.headers[s],n=Number(r);return isNaN(n)?void t?.trace?.(`Failed to parse x-amz-retry-after=${r}`):new Date(Date.now()+n)}}}(e.$response,t);return s&&(r.retryAfterHint=s),r},Ar=e=>wr(e)?"THROTTLING":br(e)?"TRANSIENT":(e=>{if(void 0!==e.$metadata?.httpStatusCode){const t=e.$metadata.httpStatusCode;return 500<=t&&t<=599&&!br(e)}return!1})(e)?"SERVER_ERROR":"CLIENT_ERROR",xr={name:"retryMiddleware",tags:["RETRY"],step:"finalizeRequest",priority:"high",override:!0};class kr{static setTimeoutFn=setTimeout;beta;minCapacity;minFillRate;scaleConstant;smooth;enabled=!1;availableTokens=0;lastMaxRate=0;measuredTxRate=0;requestCount=0;fillRate;lastThrottleTime;lastTimestamp=0;lastTxRateBucket;maxCapacity;timeWindow=0;constructor(e){this.beta=e?.beta??.7,this.minCapacity=e?.minCapacity??1,this.minFillRate=e?.minFillRate??.5,this.scaleConstant=e?.scaleConstant??.4,this.smooth=e?.smooth??.8,this.lastThrottleTime=this.getCurrentTimeInSeconds(),this.lastTxRateBucket=Math.floor(this.getCurrentTimeInSeconds()),this.fillRate=this.minFillRate,this.maxCapacity=this.minCapacity}async getSendToken(){return this.acquireTokenBucket(1)}updateClientSendingRate(e){let t;this.updateMeasuredRate();const r=e;if("THROTTLING"===r?.errorType||wr(r?.error??e)){const e=this.enabled?Math.min(this.measuredTxRate,this.fillRate):this.measuredTxRate;this.lastMaxRate=e,this.calculateTimeWindow(),this.lastThrottleTime=this.getCurrentTimeInSeconds(),t=this.cubicThrottle(e),this.enableTokenBucket()}else this.calculateTimeWindow(),t=this.cubicSuccess(this.getCurrentTimeInSeconds());const s=Math.min(t,2*this.measuredTxRate);this.updateTokenBucketRate(s)}getCurrentTimeInSeconds(){return Date.now()/1e3}async acquireTokenBucket(e){if(this.enabled){for(this.refillTokenBucket();e>this.availableTokens;){const t=(e-this.availableTokens)/this.fillRate*1e3;await new Promise(e=>kr.setTimeoutFn(e,t)),this.refillTokenBucket()}this.availableTokens=this.availableTokens-e}}refillTokenBucket(){const e=this.getCurrentTimeInSeconds();if(!this.lastTimestamp)return void(this.lastTimestamp=e);const t=(e-this.lastTimestamp)*this.fillRate;this.availableTokens=Math.min(this.maxCapacity,this.availableTokens+t),this.lastTimestamp=e}calculateTimeWindow(){this.timeWindow=this.getPrecise(Math.pow(this.lastMaxRate*(1-this.beta)/this.scaleConstant,1/3))}cubicThrottle(e){return this.getPrecise(e*this.beta)}cubicSuccess(e){return this.getPrecise(this.scaleConstant*Math.pow(e-this.lastThrottleTime-this.timeWindow,3)+this.lastMaxRate)}enableTokenBucket(){this.enabled=!0}updateTokenBucketRate(e){this.refillTokenBucket(),this.fillRate=Math.max(e,this.minFillRate),this.maxCapacity=Math.max(e,this.minCapacity),this.availableTokens=Math.min(this.availableTokens,this.maxCapacity)}updateMeasuredRate(){const e=this.getCurrentTimeInSeconds(),t=Math.floor(2*e)/2;if(this.requestCount++,t>this.lastTxRateBucket){const e=this.requestCount/(t-this.lastTxRateBucket);this.measuredTxRate=this.getPrecise(e*this.smooth+this.measuredTxRate*(1-this.smooth)),this.requestCount=0,this.lastTxRateBucket=t}}getPrecise(e){return parseFloat(e.toFixed(8))}}class Rr{static v2026="undefined"!=typeof process&&"true"===process.env?.SMITHY_NEW_RETRIES_2026;static delay(){return Rr.v2026?50:100}static throttlingDelay(){return Rr.v2026?1e3:500}static cost(){return Rr.v2026?14:5}static throttlingCost(){return Rr.v2026?5:10}static modifiedCostType(){return Rr.v2026?"THROTTLING":"TRANSIENT"}}class Tr{x=Rr.delay();computeNextBackoffDelay(e){const t=Math.random()*Math.min(this.x*2**e,2e4);return Math.floor(t)}setDelayBase(e){this.x=e}}class Pr{delay;count;cost;longPoll;constructor(e,t,r,s){this.delay=e,this.count=t,this.cost=r,this.longPoll=s}getRetryCount(){return this.count}getRetryDelay(){return Math.min(2e4,this.delay)}getRetryCost(){return this.cost}isLongPoll(){return this.longPoll}}var Ir,Mr;(Mr=Ir||(Ir={})).STANDARD="standard",Mr.ADAPTIVE="adaptive";const Nr=Ir.STANDARD,Or=1,$r=2,Ur=3;class Dr{mode=Ir.STANDARD;capacity=500;retryBackoffStrategy;maxAttemptsProvider;baseDelay;constructor(e){"number"==typeof e?this.maxAttemptsProvider=async()=>e:"function"==typeof e?this.maxAttemptsProvider=e:e&&"object"==typeof e&&(this.maxAttemptsProvider=async()=>e.maxAttempts,this.baseDelay=e.baseDelay,this.retryBackoffStrategy=e.backoff),this.maxAttemptsProvider??=async()=>3,this.baseDelay??=Rr.delay(),this.retryBackoffStrategy??=new Tr}async acquireInitialRetryToken(e){return new Pr(Rr.delay(),0,void 0,Rr.v2026&&e.includes(":longpoll"))}async refreshRetryTokenForRetry(e,t){const r=await this.getMaxAttempts(),s=this.retryCode(e,t,r),n=0===s,i=e.isLongPoll?.();if(n||i){const r=t.errorType;this.retryBackoffStrategy.setDelayBase("THROTTLING"===r?Rr.throttlingDelay():this.baseDelay);const o=this.retryBackoffStrategy.computeNextBackoffDelay(e.getRetryCount());let a=o;if(t.retryAfterHint instanceof Date&&(a=Math.max(o,Math.min(t.retryAfterHint.getTime()-Date.now(),o+5e3))),n){const t=this.getCapacityCost(r);return this.capacity-=t,new Pr(a,e.getRetryCount()+1,t,e.isLongPoll?.()??!1)}throw Object.assign(new Error("No retry token available"),{$backoff:Rr.v2026&&s===Ur&&i?a:0})}throw new Error("No retry token available")}recordSuccess(e){this.capacity=Math.min(500,this.capacity+(e.getRetryCost()??1))}getCapacity(){return this.capacity}async maxAttempts(){return this.maxAttemptsProvider()}async getMaxAttempts(){try{return await this.maxAttemptsProvider()}catch(e){return console.warn("Max attempts provider could not resolve. Using default of 3"),3}}retryCode(e,t,r){const s=e.getRetryCount()+1,n=this.isRetryableError(t.errorType)?0:Or,i=s<r?0:$r,o=this.capacity>=this.getCapacityCost(t.errorType)?0:Ur;return n||i||o}getCapacityCost(e){return e===Rr.modifiedCostType()?Rr.throttlingCost():Rr.cost()}isRetryableError(e){return"THROTTLING"===e||"TRANSIENT"===e}}class _r{mode=Ir.ADAPTIVE;rateLimiter;standardRetryStrategy;constructor(e,t){const{rateLimiter:r}=t??{};this.rateLimiter=r??new kr,this.standardRetryStrategy=new Dr(t?{maxAttempts:"number"==typeof e?e:3,...t}:e)}async acquireInitialRetryToken(e){const t=await this.standardRetryStrategy.acquireInitialRetryToken(e);return await this.rateLimiter.getSendToken(),t}async refreshRetryTokenForRetry(e,t){this.rateLimiter.updateClientSendingRate(t);const r=await this.standardRetryStrategy.refreshRetryTokenForRetry(e,t);return await this.rateLimiter.getSendToken(),r}recordSuccess(e){this.rateLimiter.updateClientSendingRate({}),this.standardRetryStrategy.recordSuccess(e)}async maxAttemptsProvider(){return this.standardRetryStrategy.maxAttempts()}}const Lr=e=>{const{retryStrategy:t,retryMode:r}=e,s=h(e.maxAttempts??3);let n=t?Promise.resolve(t):void 0;return Object.assign(e,{maxAttempts:s,retryStrategy:()=>n??=(async()=>await h(r)()===Ir.ADAPTIVE?new _r(s):new Dr(s))()})},Br=function(e){const t=function(e){return t=>(r,s)=>async n=>{let i=await t.retryStrategy();const o=await t.maxAttempts();if(!Er(i))return i?.mode&&(s.userAgent=[...s.userAgent||[],["cfg/retry-mode",i.mode]]),i.retry(r,n);{let u=await i.acquireInitialRetryToken((s.partition_id??"")+(s.__retryLongPoll?":longpoll":"")),d=new Error,l=0,h=0;const{request:f}=n,p=At.isInstance(f);for(p&&(f.headers["amz-sdk-invocation-id"]=wt());;)try{p&&(f.headers["amz-sdk-request"]=`attempt=${l+1}; max=${o}`);const{response:e,output:t}=await r(n);return i.recordSuccess(u),t.$metadata.attempts=l+1,t.$metadata.totalRetryDelay=h,{response:e,output:t}}catch(a){const r=Cr(a,t.logger);if(d=Sr(a),p&&e(f))throw(s.logger instanceof hr?console:s.logger)?.warn("An error was encountered in a non-retryable streaming request."),d;try{u=await i.refreshRetryTokenForRetry(u,r)}catch(c){throw"number"==typeof c.$backoff&&await vr(c.$backoff),d.$metadata||(d.$metadata={}),d.$metadata.attempts=l+1,d.$metadata.totalRetryDelay=h,d}l=u.getRetryCount();const n=u.getRetryDelay();h+=n,await vr(n)}}}}(e);return e=>({applyToStack:r=>{r.add(t(e),xr)}})}(e=>e?.body instanceof ReadableStream);function zr(e,t,r){e.__aws_sdk_context?e.__aws_sdk_context.features||(e.__aws_sdk_context.features={}):e.__aws_sdk_context={features:{}},e.__aws_sdk_context.features[t]=r}Rr.v2026||="object"==typeof process&&"true"===process.env?.AWS_NEW_RETRIES_2026;const jr={name:"hostHeaderMiddleware",step:"build",priority:"low",tags:["HOST"],override:!0},Hr=e=>({applyToStack:t=>{t.add((e=>t=>async r=>{if(!At.isInstance(r.request))return t(r);const{request:s}=r,{handlerProtocol:n=""}=e.requestHandler.metadata||{};if(n.indexOf("h2")>=0&&!s.headers[":authority"])delete s.headers.host,s.headers[":authority"]=s.hostname+(s.port?":"+s.port:"");else if(!s.headers.host){let e=s.hostname;null!=s.port&&(e+=`:${s.port}`),s.headers.host=e}return t(r)})(e),jr)}}),qr={name:"loggerMiddleware",tags:["LOGGER"],step:"initialize",override:!0};const Fr=(e,t)=>(r,s)=>async n=>{const i=((e,t)=>{if(!t||0===t.length)return e;const r=[];for(const s of t)for(const t of e)t.schemeId.split("#")[1]===s&&r.push(t);for(const s of e)r.find(({schemeId:e})=>e===s.schemeId)||r.push(s);return r})(e.httpAuthSchemeProvider(await t.httpAuthSchemeParametersProvider(e,s,n.input)),e.authSchemePreference?await e.authSchemePreference():[]),o=function(e){const t=/* @__PURE__ */new Map;for(const r of e)t.set(r.schemeId,r);return t}(e.httpAuthSchemes),a=l(s),c=[];for(const r of i){const n=o.get(r.schemeId);if(!n){c.push(`HttpAuthScheme \`${r.schemeId}\` was not enabled for this service.`);continue}const i=n.identityProvider(await t.identityProviderConfigProvider(e));if(!i){c.push(`HttpAuthScheme \`${r.schemeId}\` did not have an IdentityProvider configured.`);continue}const{identityProperties:u={},signingProperties:d={}}=r.propertiesExtractor?.(e,s)||{};r.identityProperties=Object.assign(r.identityProperties||{},u),r.signingProperties=Object.assign(r.signingProperties||{},d),a.selectedHttpAuthScheme={httpAuthOption:r,identity:await i(r.identityProperties),signer:n.signer};break}if(!a.selectedHttpAuthScheme)throw new Error(c.join("\n"));return r(n)},Kr={step:"serialize",tags:["HTTP_AUTH_SCHEME"],name:"httpAuthSchemeMiddleware",override:!0,relation:"before",toMiddleware:"endpointV2Middleware"},Vr=e=>e=>{throw e},Wr=(e,t)=>{},Gr={step:"finalizeRequest",tags:["HTTP_SIGNING"],name:"httpSigningMiddleware",aliases:["apiKeyMiddleware","tokenMiddleware","awsAuthMiddleware"],override:!0,relation:"after",toMiddleware:"retryMiddleware"},Xr=e=>({applyToStack:e=>{e.addRelativeTo((e,t)=>async r=>{if(!At.isInstance(r.request))return e(r);const s=l(t).selectedHttpAuthScheme;if(!s)throw new Error("No HttpAuthScheme was selected: unable to sign request");const{httpAuthOption:{signingProperties:n={}},identity:i,signer:o}=s,a=await e({...r,request:await o.sign(r.request,i,n)}).catch((o.errorHandler||Vr)(n));return(o.successHandler||Wr)(a.response,n),a},Gr)}}),Yr=e=>{if("function"==typeof e)return e;const t=Promise.resolve(e);return()=>t};class Jr{authSchemes=/* @__PURE__ */new Map;constructor(e){for(const t in e){const r=e[t];void 0!==r&&this.authSchemes.set(t,r)}}getIdentityProvider(e){return this.authSchemes.get(e)}}const Qr=(Zr=3e5,function(e){return es(e)&&e.expiration.getTime()-Date.now()<Zr});var Zr;const es=e=>void 0!==e.expiration;let ts={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)"}}}]};const rs=/\d{12}\.ddb/;const ss="user-agent",ns="x-amz-user-agent",is=/[^!$%&'*+\-.^_`|~\w]/g,os=/[^!$%&'*+\-.^_`|~\w#]/g;const as=e=>(t,r)=>async s=>{const{request:n}=s;if(!At.isInstance(n))return t(s);const{headers:i}=n,o=r?.userAgent?.map(cs)||[],a=(await e.defaultUserAgentProvider()).map(cs);await async function(e,t,r){const s=r.request;if("rpc-v2-cbor"===s?.headers?.["smithy-protocol"]&&zr(e,"PROTOCOL_RPC_V2_CBOR","M"),"function"==typeof t.retryStrategy){const r=await t.retryStrategy();if("string"==typeof r.mode)switch(r.mode){case Ir.ADAPTIVE:zr(e,"RETRY_MODE_ADAPTIVE","F");break;case Ir.STANDARD:zr(e,"RETRY_MODE_STANDARD","E")}}if("function"==typeof t.accountIdEndpointMode){const r=e.endpointV2;switch(String(r?.url?.hostname).match(rs)&&zr(e,"ACCOUNT_ID_ENDPOINT","O"),await(t.accountIdEndpointMode?.())){case"disabled":zr(e,"ACCOUNT_ID_MODE_DISABLED","Q");break;case"preferred":zr(e,"ACCOUNT_ID_MODE_PREFERRED","P");break;case"required":zr(e,"ACCOUNT_ID_MODE_REQUIRED","R")}}const n=e.__smithy_context?.selectedHttpAuthScheme?.identity;if(n?.$source){const t=n;t.accountId&&zr(e,"RESOLVED_ACCOUNT_ID","T");for(const[r,s]of Object.entries(t.$source??{}))zr(e,r,s)}}(r,e,s);const c=r;a.push(`m/${function(e){let t="";for(const r in e){const s=e[r];if(!(t.length+s.length+1<=1024))break;t.length?t+=","+s:t+=s}return t}(Object.assign({},r.__smithy_context?.features,c.__aws_sdk_context?.features))}`);const u=e?.customUserAgent?.map(cs)||[],d=await e.userAgentAppId();d&&a.push(cs(["app",`${d}`]));const l=[].concat([...a,...o,...u]).join(" "),h=[...a.filter(e=>e.startsWith("aws-sdk-")),...u].join(" ");return"browser"!==e.runtime?(h&&(i[ns]=i[ns]?`${i[ss]} ${h}`:h),i[ss]=l):i[ns]=l,t({...s,request:n})},cs=e=>{const t=e[0].split("/").map(e=>e.replace(is,"-")).join("/"),r=e[1]?.replace(os,"-"),s=t.indexOf("/"),n=t.substring(0,s);let i=t.substring(s+1);return"api"===n&&(i=i.toLowerCase()),[n,i,r].filter(e=>e&&e.length>0).reduce((e,t,r)=>{switch(r){case 0:return t;case 1:return`${e}/${t}`;default:return`${e}#${t}`}},"")},us={name:"getUserAgentMiddleware",step:"build",priority:"low",tags:["SET_USER_AGENT","USER_AGENT"],override:!0},ds=({serviceId:e,clientVersion:t})=>async r=>{const s="undefined"!=typeof window?window.navigator:void 0,n=s?.userAgent??"",i=s?.userAgentData?.platform??ls.os(n)??"other",o=s?.userAgentData?.brands??[],a=o[o.length-1],c=a?.brand??ls.browser(n)??"unknown",u=[["aws-sdk-js",t],["ua","2.1"],[`os/${i}`,void 0],["lang/js"],["md/browser",`${c}_${a?.version??"unknown"}`]];e&&u.push([`api/${e}`,t]);const d=await(r?.userAgentAppId?.());return d&&u.push([`app/${d}`]),u},ls={os:e=>/iPhone|iPad|iPod/.test(e)?"iOS":/Macintosh|Mac OS X/.test(e)?"macOS":/Windows NT/.test(e)?"Windows":/Android/.test(e)?"Android":/Linux/.test(e)?"Linux":void 0,browser:e=>/EdgiOS|EdgA|Edg\//.test(e)?"Microsoft Edge":/Firefox\//.test(e)?"Firefox":/Chrome\//.test(e)?"Chrome":/Safari\//.test(e)?"Safari":void 0},hs=(e,t=!1)=>{if(t){for(const t of e.split("."))if(!hs(t))return!1;return!0}return!!Be(e)&&(!(e.length<3||e.length>63)&&(e===e.toLowerCase()&&!je(e)))},fs={isVirtualHostableS3Bucket:hs,parseArn:e=>{const t=e.split(":");if(t.length<6)return null;const[r,s,n,i,o,...a]=t;if("arn"!==r||""===s||""===n||""===a.join(":"))return null;return{partition:s,service:n,region:i,accountId:o,resourceId:a.map(e=>e.split("/")).flat()}},partition:e=>{const{partitions:t}=ts;for(const s of t){const{regions:t,outputs:r}=s;for(const[s,n]of Object.entries(t))if(s===e)return{...r,...n}}for(const s of t){const{regionRegex:t,outputs:r}=s;if(new RegExp(t).test(e))return{...r}}const r=t.find(e=>"aws"===e.id);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}}};De.aws=fs;const ps=(e,t,r)=>{let s,n,i,o=!1;return async t=>(i&&!t?.forceRefresh||(s=await(async()=>{n||(n=e());try{s=await n,i=!0,o=!1}finally{n=void 0}return s})()),s)},ms=/* @__PURE__ */new Set,gs=e=>"string"==typeof e&&(e.startsWith("fips-")||e.endsWith("-fips")),ys=e=>{const{region:t,useFipsEndpoint:r}=e;if(!t)throw new Error("Region is missing");return Object.assign(e,{region:async()=>{const e=(e=>gs(e)?["fips-aws-global","aws-fips"].includes(e)?"us-east-1":e.replace(/fips-(dkr-|prod-)?|-fips/,""):e)("function"==typeof t?await t():t);return((e,t=Be)=>{if(ms.has(e)||t(e))ms.add(e);else{if("*"!==e)throw new Error(`Region not accepted: region="${e}" is not a valid hostname component.`);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.')}})(e),e},useFipsEndpoint:async()=>{const e="string"==typeof t?t:await t();return!!gs(e)||("function"!=typeof r?Promise.resolve(!!r):r())}})},ws=["in-region","cross-region","mobile","standard","legacy"],bs=()=>{const e=window?.navigator;if(e?.connection){const{effectiveType:t,rtt:r,downlink:s}=e?.connection;if("string"==typeof t&&"4g"!==t||Number(r)>100||Number(s)<10)return!0}return e?.userAgentData?.mobile||"number"==typeof e?.maxTouchPoints&&e?.maxTouchPoints>1};const Ss={step:"build",tags:["SET_EXPECT_HEADER","EXPECT_HEADER"],name:"addExpectContinueMiddleware",override:!0},vs=e=>({applyToStack:t=>{t.add(function(e){return t=>async r=>{const{request:s}=r;if(!1!==e.expectContinueHeader&&At.isInstance(s)&&s.body&&"node"===e.runtime&&"FetchHttpHandler"!==e.requestHandler?.constructor?.name){let t=!0;if("number"==typeof e.expectContinueHeader)try{t=(Number(s.headers?.["content-length"])??e.bodyLengthChecker?.(s.body)??1/0)>=e.expectContinueHeader}catch(n){}else t=!!e.expectContinueHeader;t&&(s.headers.Expect="100-continue")}return t({...r,request:s})}}(e),Ss)}}),Es="WHEN_SUPPORTED",Cs="WHEN_REQUIRED",As=Es,xs="WHEN_SUPPORTED",ks="WHEN_REQUIRED",Rs=Es;var Ts,Ps,Is,Ms;(Ps=Ts||(Ts={})).MD5="MD5",Ps.CRC32="CRC32",Ps.CRC32C="CRC32C",Ps.CRC64NVME="CRC64NVME",Ps.SHA1="SHA1",Ps.SHA256="SHA256",(Ms=Is||(Is={})).HEADER="header",Ms.TRAILER="trailer";const Ns=Ts.CRC32,Os=e=>e===Ts.MD5?"content-md5":`x-amz-checksum-${e.toLowerCase()}`,$s=e=>void 0!==e&&"string"!=typeof e&&!ArrayBuffer.isView(e)&&!ve(e);function Us(e,t,r,s){return new(r||(r=Promise))(function(n,i){function o(e){try{c(s.next(e))}catch(t){i(t)}}function a(e){try{c(s.throw(e))}catch(t){i(t)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(o,a)}c((s=s.apply(e,t||[])).next())})}function Ds(e,t){var r,s,n,i={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=a(0),o.throw=a(1),o.return=a(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(c){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(i=0)),i;)try{if(r=1,s&&(n=2&a[0]?s.return:a[0]?s.throw||((n=s.return)&&n.call(s),0):s.next)&&!(n=n.call(s,a[1])).done)return n;switch(s=0,n&&(a=[2&a[0],n.value]),a[0]){case 0:case 1:n=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,s=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(n=i.trys,(n=n.length>0&&n[n.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!n||a[1]>n[0]&&a[1]<n[3])){i.label=a[1];break}if(6===a[0]&&i.label<n[1]){i.label=n[1],n=a;break}if(n&&i.label<n[2]){i.label=n[2],i.ops.push(a);break}n[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(c){a=[6,c],s=0}finally{r=n=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}function _s(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],s=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&s>=e.length&&(e=void 0),{value:e&&e[s++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}"function"==typeof SuppressedError&&SuppressedError;const Ls=e=>(new TextEncoder).encode(e);var Bs="undefined"!=typeof Buffer&&Buffer.from?function(e){return Buffer.from(e,"utf8")}:Ls;function zs(e){return e instanceof Uint8Array?e:"string"==typeof e?Bs(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e)}function js(e){return"string"==typeof e?0===e.length:0===e.byteLength}function Hs(e){return new Uint8Array([(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e])}function qs(e){if(!Uint32Array.from){for(var t=new Uint32Array(e.length),r=0;r<e.length;)t[r]=e[r],r+=1;return t}return Uint32Array.from(e)}var Fs=function(){function e(){this.crc32c=new Ks}return e.prototype.update=function(e){js(e)||this.crc32c.update(zs(e))},e.prototype.digest=function(){return Us(this,void 0,void 0,function(){return Ds(this,function(e){return[2,Hs(this.crc32c.digest())]})})},e.prototype.reset=function(){this.crc32c=new Ks},e}(),Ks=function(){function e(){this.checksum=4294967295}return e.prototype.update=function(e){var t,r;try{for(var s=_s(e),n=s.next();!n.done;n=s.next()){var i=n.value;this.checksum=this.checksum>>>8^Vs[255&(this.checksum^i)]}}catch(o){t={error:o}}finally{try{n&&!n.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}return this},e.prototype.digest=function(){return(4294967295^this.checksum)>>>0},e}(),Vs=qs([0,4067132163,3778769143,324072436,3348797215,904991772,648144872,3570033899,2329499855,2024987596,1809983544,2575936315,1296289744,3207089363,2893594407,1578318884,274646895,3795141740,4049975192,51262619,3619967088,632279923,922689671,3298075524,2592579488,1760304291,2075979607,2312596564,1562183871,2943781820,3156637768,1313733451,549293790,3537243613,3246849577,871202090,3878099393,357341890,102525238,4101499445,2858735121,1477399826,1264559846,3107202533,1845379342,2677391885,2361733625,2125378298,820201905,3263744690,3520608582,598981189,4151959214,85089709,373468761,3827903834,3124367742,1213305469,1526817161,2842354314,2107672161,2412447074,2627466902,1861252501,1098587580,3004210879,2688576843,1378610760,2262928035,1955203488,1742404180,2511436119,3416409459,969524848,714683780,3639785095,205050476,4266873199,3976438427,526918040,1361435347,2739821008,2954799652,1114974503,2529119692,1691668175,2005155131,2247081528,3690758684,697762079,986182379,3366744552,476452099,3993867776,4250756596,255256311,1640403810,2477592673,2164122517,1922457750,2791048317,1412925310,1197962378,3037525897,3944729517,427051182,170179418,4165941337,746937522,3740196785,3451792453,1070968646,1905808397,2213795598,2426610938,1657317369,3053634322,1147748369,1463399397,2773627110,4215344322,153784257,444234805,3893493558,1021025245,3467647198,3722505002,797665321,2197175160,1889384571,1674398607,2443626636,1164749927,3070701412,2757221520,1446797203,137323447,4198817972,3910406976,461344835,3484808360,1037989803,781091935,3705997148,2460548119,1623424788,1939049696,2180517859,1429367560,2807687179,3020495871,1180866812,410100952,3927582683,4182430767,186734380,3756733383,763408580,1053836080,3434856499,2722870694,1344288421,1131464017,2971354706,1708204729,2545590714,2229949006,1988219213,680717673,3673779818,3383336350,1002577565,4010310262,493091189,238226049,4233660802,2987750089,1082061258,1395524158,2705686845,1972364758,2279892693,2494862625,1725896226,952904198,3399985413,3656866545,731699698,4283874585,222117402,510512622,3959836397,3280807620,837199303,582374963,3504198960,68661723,4135334616,3844915500,390545967,1230274059,3141532936,2825850620,1510247935,2395924756,2091215383,1878366691,2644384480,3553878443,565732008,854102364,3229815391,340358836,3861050807,4117890627,119113024,1493875044,2875275879,3090270611,1247431312,2660249211,1828433272,2141937292,2378227087,3811616794,291187481,34330861,4032846830,615137029,3603020806,3314634738,939183345,1776939221,2609017814,2295496738,2058945313,2926798794,1545135305,1330124605,3173225534,4084100981,17165430,307568514,3762199681,888469610,3332340585,3587147933,665062302,2042050490,2346497209,2559330125,1793573966,3190661285,1279665062,1595330642,2910671697]);let Ws,Gs,Xs,Ys,Js,Qs,Zs,en,tn;const rn=()=>{Ws||(Ws=(()=>{const e=new Array(8);for(let t=0;t<8;t++){const r=new Array(512);for(let e=0;e<256;e++){let s=BigInt(e);for(let e=0;e<8*(t+1);e++)1n&s?s=s>>1n^0x9a6c9329ac4bc9b5n:s>>=1n;r[2*e]=Number(s>>32n&0xffffffffn),r[2*e+1]=Number(0xffffffffn&s)}e[t]=new Uint32Array(r)}return e})(),[Gs,Xs,Ys,Js,Qs,Zs,en,tn]=Ws)};class sn{c1=0;c2=0;constructor(){rn(),this.reset()}update(e){const t=e.length;let r=0,s=this.c1,n=this.c2;for(;r+8<=t;){const t=(255&(n^e[r++]))<<1,i=(255&(n>>>8^e[r++]))<<1,o=(255&(n>>>16^e[r++]))<<1,a=(255&(n>>>24^e[r++]))<<1,c=(255&(s^e[r++]))<<1,u=(255&(s>>>8^e[r++]))<<1,d=(255&(s>>>16^e[r++]))<<1,l=(255&(s>>>24^e[r++]))<<1;s=tn[t]^en[i]^Zs[o]^Qs[a]^Js[c]^Ys[u]^Xs[d]^Gs[l],n=tn[t+1]^en[i+1]^Zs[o+1]^Qs[a+1]^Js[c+1]^Ys[u+1]^Xs[d+1]^Gs[l+1]}for(;r<t;){const t=(255&(n^e[r]))<<1;n=(n>>>8|(255&s)<<24)>>>0,s=s>>>8^Gs[t],n^=Gs[t+1],r++}this.c1=s,this.c2=n}async digest(){const e=4294967295^this.c1,t=4294967295^this.c2;return new Uint8Array([e>>>24,e>>>16&255,e>>>8&255,255&e,t>>>24,t>>>16&255,t>>>8&255,255&t])}reset(){this.c1=4294967295,this.c2=4294967295}}var nn=function(){function e(){this.crc32=new on}return e.prototype.update=function(e){js(e)||this.crc32.update(zs(e))},e.prototype.digest=function(){return Us(this,void 0,void 0,function(){return Ds(this,function(e){return[2,Hs(this.crc32.digest())]})})},e.prototype.reset=function(){this.crc32=new on},e}(),on=function(){function e(){this.checksum=4294967295}return e.prototype.update=function(e){var t,r;try{for(var s=_s(e),n=s.next();!n.done;n=s.next()){var i=n.value;this.checksum=this.checksum>>>8^an[255&(this.checksum^i)]}}catch(o){t={error:o}}finally{try{n&&!n.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}return this},e.prototype.digest=function(){return(4294967295^this.checksum)>>>0},e}(),an=qs([0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117]);const cn=[Ts.CRC32,Ts.CRC32C,Ts.CRC64NVME,Ts.SHA1,Ts.SHA256],un=[Ts.SHA256,Ts.SHA1,Ts.CRC32,Ts.CRC32C,Ts.CRC64NVME],dn=(e,t)=>{const{checksumAlgorithms:r={}}=t;switch(e){case Ts.MD5:return r?.MD5??t.md5;case Ts.CRC32:return r?.CRC32??nn;case Ts.CRC32C:return r?.CRC32C??Fs;case Ts.CRC64NVME:return r?.CRC64NVME??sn;case Ts.SHA1:return r?.SHA1??t.sha1;case Ts.SHA256:return r?.SHA256??t.sha256;default:if(r?.[e])return r[e];throw new Error(`The checksum algorithm "${e}" is not supported by the client. Select one of ${cn}, or provide an implementation to the client constructor checksums field.`)}},ln=(e,t)=>{const r=new e;return r.update(Se(t||"")),r.digest()},hn={name:"flexibleChecksumsMiddleware",step:"build",tags:["BODY_CHECKSUM"],override:!0},fn=(e,t)=>(r,s)=>async n=>{if(!At.isInstance(n.request))return r(n);if(((e,t)=>{const r=e.toLowerCase();for(const s of Object.keys(t))if(s.toLowerCase().startsWith(r))return!0;return!1})("x-amz-checksum-",n.request.headers))return r(n);const{request:i,input:o}=n,{body:a,headers:c}=i,{base64Encoder:u,streamHasher:d}=e,{requestChecksumRequired:l,requestAlgorithmMember:h}=t,f=await e.requestChecksumCalculation(),p=h?.name,m=h?.httpHeader;p&&!o[p]&&(f===Es||l)&&(o[p]=Ns,m&&(c[m]=Ns));const g=((e,{requestChecksumRequired:t,requestAlgorithmMember:r,requestChecksumCalculation:s})=>{if(!r)return s===Es||t?Ns:void 0;if(!e[r])return;return e[r]})(o,{requestChecksumRequired:l,requestAlgorithmMember:h?.name,requestChecksumCalculation:f});let y=a,w=c;if(g){switch(g){case Ts.CRC32:zr(s,"FLEXIBLE_CHECKSUMS_REQ_CRC32","U");break;case Ts.CRC32C:zr(s,"FLEXIBLE_CHECKSUMS_REQ_CRC32C","V");break;case Ts.CRC64NVME:zr(s,"FLEXIBLE_CHECKSUMS_REQ_CRC64","W");break;case Ts.SHA1:zr(s,"FLEXIBLE_CHECKSUMS_REQ_SHA1","X");break;case Ts.SHA256:zr(s,"FLEXIBLE_CHECKSUMS_REQ_SHA256","Y")}const t=Os(g),r=dn(g,e);if($s(a)){const{getAwsChunkedEncodingStream:n,bodyLengthChecker:i}=e;y=n("number"==typeof e.requestStreamBufferSize&&e.requestStreamBufferSize>=8192?ut(a,e.requestStreamBufferSize,s.logger):a,{base64Encoder:u,bodyLengthChecker:i,checksumLocationName:t,checksumAlgorithmFn:r,streamHasher:d}),w={...c,"content-encoding":c["content-encoding"]?`${c["content-encoding"]},aws-chunked`:"aws-chunked","transfer-encoding":"chunked","x-amz-decoded-content-length":c["content-length"],"x-amz-content-sha256":"STREAMING-UNSIGNED-PAYLOAD-TRAILER","x-amz-trailer":t},delete w["content-length"]}else if(!((e,t)=>{const r=e.toLowerCase();for(const s of Object.keys(t))if(r===s.toLowerCase())return!0;return!1})(t,c)){const e=await ln(r,a);w={...c,[t]:u(e)}}}try{return await r({...n,request:{...i,headers:w,body:y}})}catch(b){if(b instanceof Error&&"InvalidChunkSizeError"===b.name)try{b.message.endsWith(".")||(b.message+="."),b.message+=" Set [requestStreamBufferSize=number e.g. 65_536] in client constructor to instruct AWS SDK to buffer your input stream."}catch(S){}throw b}},pn={name:"flexibleChecksumsInputMiddleware",toMiddleware:"serializerMiddleware",relation:"before",tags:["BODY_CHECKSUM"],override:!0},mn=(e=[])=>{const t=[];let r=un.length;for(const s of e){const e=un.indexOf(s);-1!==e?t[e]=s:t[r++]=s}return t.filter(Boolean)},gn=async(e,{checksumAlgorithmFn:t,base64Encoder:r})=>r(await ln(t,e)),yn={name:"flexibleChecksumsResponseMiddleware",toMiddleware:"deserializerMiddleware",relation:"after",tags:["BODY_CHECKSUM"],override:!0},wn=(e,t)=>(r,s)=>async n=>{if(!At.isInstance(n.request))return r(n);const i=n.input,o=await r(n),a=o.response,{requestValidationModeMember:c,responseAlgorithms:u}=t;if(c&&"ENABLED"===i[c]){const{clientName:t,commandName:r}=s,n=Object.keys(e.checksumAlgorithms??{}).filter(e=>{const t=Os(e);return void 0!==a.headers[t]}),i=mn([...u??[],...n]);if("S3Client"===t&&"GetObjectCommand"===r&&i.every(e=>{const t=Os(e),r=a.headers[t];return!r||(e=>{const t=e.lastIndexOf("-");if(-1!==t){const r=e.slice(t+1);if(!r.startsWith("0")){const e=parseInt(r,10);if(!isNaN(e)&&e>=1&&e<=1e4)return!0}}return!1})(r)}))return o;await(async(e,{config:t,responseAlgorithms:r,logger:s})=>{const n=mn(r),{body:i,headers:o}=e;for(const c of n){const r=Os(c),n=o[r];if(n){let o;try{o=dn(c,t)}catch(a){if(c===Ts.CRC64NVME){s?.warn(`Skipping ${Ts.CRC64NVME} checksum validation: ${a.message}`);continue}throw a}const{base64Encoder:u}=t;if($s(i))return void(e.body=at({expectedChecksum:n,checksumSourceLocation:r,checksum:new o,source:i,base64Encoder:u}));const d=await gn(i,{checksumAlgorithmFn:o,base64Encoder:u});if(d===n)break;throw new Error(`Checksum mismatch: expected "${d}" but received "${n}" in response header "${r}".`)}}})(a,{config:e,responseAlgorithms:i,logger:s.logger})}return o},bn=(e,t)=>({applyToStack:r=>{r.add(fn(e,t),hn),r.addRelativeTo(((e,t)=>(r,s)=>async n=>{const i=n.input,{requestValidationModeMember:o}=t,a=await e.requestChecksumCalculation(),c=await e.responseChecksumValidation();switch(a){case Cs:zr(s,"FLEXIBLE_CHECKSUMS_REQ_WHEN_REQUIRED","a");break;case Es:zr(s,"FLEXIBLE_CHECKSUMS_REQ_WHEN_SUPPORTED","Z")}switch(c){case ks:zr(s,"FLEXIBLE_CHECKSUMS_RES_WHEN_REQUIRED","c");break;case xs:zr(s,"FLEXIBLE_CHECKSUMS_RES_WHEN_SUPPORTED","b")}return o&&!i[o]&&c===xs&&(i[o]="ENABLED"),r(n)})(e,t),pn),r.addRelativeTo(wn(e,t),yn)}});const Sn={step:"finalizeRequest",tags:["CHECK_CONTENT_LENGTH_HEADER"],name:"getCheckContentLengthHeaderPlugin",override:!0},vn=e=>({applyToStack:e=>{e.add((e,t)=>async r=>{const{request:s}=r;if(At.isInstance(s)&&!("content-length"in s.headers)&&!("x-amz-decoded-content-length"in s.headers)){const e="Are you using a Stream of unknown length as the Body of a PutObject request? Consider using Upload instead from @aws-sdk/lib-storage.";"function"!=typeof t?.logger?.warn||t.logger instanceof hr?console.warn(e):t.logger.warn(e)}return e({...r})},Sn)}}),En={tags:["REGION_REDIRECT","S3"],name:"regionRedirectEndpointMiddleware",override:!0,relation:"before",toMiddleware:"endpointV2Middleware"};const Cn={step:"initialize",tags:["REGION_REDIRECT","S3"],name:"regionRedirectMiddleware",override:!0},An=e=>({applyToStack:t=>{var r;t.add(function(e){return(t,r)=>async s=>{try{return await t(s)}catch(n){if(e.followRegionRedirects){const o=n?.$metadata?.httpStatusCode,a="HeadBucketCommand"===r.commandName,c=n?.$response?.headers?.["x-amz-bucket-region"];if(c&&(301===o||400===o&&("IllegalLocationConstraintException"===n?.name||a))){try{const t=c;r.logger?.debug(`Redirecting from ${await e.region()} to ${t}`),r.__s3RegionRedirect=t}catch(i){throw new Error("Region redirect failed: "+i)}return t(s)}}throw n}}}(e),Cn),t.addRelativeTo((r=e,(e,t)=>async s=>{const n=await r.region(),i=r.region;let o=()=>{};t.__s3RegionRedirect&&(Object.defineProperty(r,"region",{writable:!1,value:async()=>t.__s3RegionRedirect}),o=()=>Object.defineProperty(r,"region",{writable:!0,value:i}));try{const i=await e(s);if(t.__s3RegionRedirect&&(o(),n!==await r.region()))throw new Error("Region was not restored following S3 region redirect.");return i}catch(a){throw o(),a}}),En)}}),xn={tags:["S3"],name:"s3ExpiresMiddleware",override:!0,relation:"after",toMiddleware:"deserializerMiddleware"},kn=e=>({applyToStack:e=>{e.addRelativeTo((e,t)=>async r=>{const s=await e(r),{response:n}=s;if(xt.isInstance(n)&&n.headers.expires){n.headers.expiresstring=n.headers.expires;try{z(n.headers.expires)}catch(i){t.logger?.warn(`AWS SDK Warning for ${t.clientName}::${t.commandName} response parsing (${n.headers.expires}): ${i}`),delete n.headers.expires}}return s},xn)}});class Rn{data;lastPurgeTime=Date.now();static EXPIRED_CREDENTIAL_PURGE_INTERVAL_MS=3e4;constructor(e={}){this.data=e}get(e){const t=this.data[e];if(t)return t}set(e,t){return this.data[e]=t,t}delete(e){delete this.data[e]}async purgeExpired(){const e=Date.now();if(!(this.lastPurgeTime+Rn.EXPIRED_CREDENTIAL_PURGE_INTERVAL_MS>e))for(const t in this.data){const r=this.data[t];if(!r.isRefreshing){const s=await r.identity;s.expiration&&s.expiration.getTime()<e&&delete this.data[t]}}}}class Tn{_identity;isRefreshing;accessed;constructor(e,t=!1,r=Date.now()){this._identity=e,this.isRefreshing=t,this.accessed=r}get identity(){return this.accessed=Date.now(),this._identity}}class Pn{createSessionFn;cache;static REFRESH_WINDOW_MS=6e4;constructor(e,t=new Rn){this.createSessionFn=e,this.cache=t}async getS3ExpressIdentity(e,t){const r=t.Bucket,{cache:s}=this,n=s.get(r);return n?n.identity.then(e=>{if((e.expiration?.getTime()??0)<Date.now())return s.set(r,new Tn(this.getIdentity(r))).identity;return(e.expiration?.getTime()??0)<Date.now()+Pn.REFRESH_WINDOW_MS&&!n.isRefreshing&&(n.isRefreshing=!0,this.getIdentity(r).then(e=>{s.set(r,new Tn(Promise.resolve(e)))})),e}):s.set(r,new Tn(this.getIdentity(r))).identity}async getIdentity(e){await this.cache.purgeExpired().catch(e=>{console.warn("Error while clearing expired entries in S3ExpressIdentityCache: \n"+e)});const t=await this.createSessionFn(e);if(!t.Credentials?.AccessKeyId||!t.Credentials?.SecretAccessKey)throw new Error("s3#createSession response credential missing AccessKeyId or SecretAccessKey.");return{accessKeyId:t.Credentials.AccessKeyId,secretAccessKey:t.Credentials.SecretAccessKey,sessionToken:t.Credentials.SessionToken,expiration:t.Credentials.Expiration?new Date(t.Credentials.Expiration):void 0}}}class In{format(e){const t=[];for(const n of Object.keys(e)){const r=b(n);t.push(Uint8Array.from([r.byteLength]),r,this.formatHeaderValue(e[n]))}const r=new Uint8Array(t.reduce((e,t)=>e+t.byteLength,0));let s=0;for(const n of t)r.set(n,s),s+=n.byteLength;return r}formatHeaderValue(e){switch(e.type){case"boolean":return Uint8Array.from([e.value?0:1]);case"byte":return Uint8Array.from([2,e.value]);case"short":const t=new DataView(new ArrayBuffer(3));return t.setUint8(0,3),t.setInt16(1,e.value,!1),new Uint8Array(t.buffer);case"integer":const r=new DataView(new ArrayBuffer(5));return r.setUint8(0,4),r.setInt32(1,e.value,!1),new Uint8Array(r.buffer);case"long":const s=new Uint8Array(9);return s[0]=5,s.set(e.value.bytes,1),s;case"binary":const n=new DataView(new ArrayBuffer(3+e.value.byteLength));n.setUint8(0,6),n.setUint16(1,e.value.byteLength,!1);const i=new Uint8Array(n.buffer);return i.set(e.value,3),i;case"string":const o=b(e.value),a=new DataView(new ArrayBuffer(3+o.byteLength));a.setUint8(0,7),a.setUint16(1,o.byteLength,!1);const c=new Uint8Array(a.buffer);return c.set(o,3),c;case"timestamp":const u=new Uint8Array(9);return u[0]=8,u.set($n.fromNumber(e.value.valueOf()).bytes,1),u;case"uuid":if(!On.test(e.value))throw new Error(`Invalid UUID received: ${e.value}`);const d=new Uint8Array(17);return d[0]=9,d.set(ge(e.value.replace(/\-/g,"")),1),d}}}var Mn,Nn;(Nn=Mn||(Mn={}))[Nn.boolTrue=0]="boolTrue",Nn[Nn.boolFalse=1]="boolFalse",Nn[Nn.byte=2]="byte",Nn[Nn.short=3]="short",Nn[Nn.integer=4]="integer",Nn[Nn.long=5]="long",Nn[Nn.byteArray=6]="byteArray",Nn[Nn.string=7]="string",Nn[Nn.timestamp=8]="timestamp",Nn[Nn.uuid=9]="uuid";const On=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;let $n=class e{bytes;constructor(e){if(this.bytes=e,8!==e.byteLength)throw new Error("Int64 buffers must be exactly 8 bytes")}static fromNumber(t){if(t>0x8000000000000000||t<-0x8000000000000000)throw new Error(`${t} is too large (or, if negative, too small) to represent as an Int64`);const r=new Uint8Array(8);for(let e=7,s=Math.abs(Math.round(t));e>-1&&s>0;e--,s/=256)r[e]=s;return t<0&&Un(r),new e(r)}valueOf(){const e=this.bytes.slice(0),t=128&e[0];return t&&Un(e),parseInt(ye(e),16)*(t?-1:1)}toString(){return String(this.valueOf())}};function Un(e){for(let t=0;t<8;t++)e[t]^=255;for(let t=7;t>-1&&(e[t]++,0===e[t]);t--);}const Dn="X-Amz-Date",_n="X-Amz-Signature",Ln="X-Amz-Security-Token",Bn="authorization",zn=Dn.toLowerCase(),jn=[Bn,zn,"date"],Hn=_n.toLowerCase(),qn="x-amz-content-sha256",Fn=Ln.toLowerCase(),Kn={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},Vn=/^proxy-/,Wn=/^sec-/,Gn="AWS4-HMAC-SHA256",Xn="AWS4-HMAC-SHA256-PAYLOAD",Yn="aws4_request",Jn=e=>"number"==typeof e?new Date(1e3*e):"string"==typeof e?Number(e)?new Date(1e3*Number(e)):new Date(e):e;class Qn{service;regionProvider;credentialProvider;sha256;uriEscapePath;applyChecksum;constructor({applyChecksum:e,credentials:t,region:r,service:s,sha256:n,uriEscapePath:i=!0}){this.service=s,this.sha256=n,this.uriEscapePath=i,this.applyChecksum="boolean"!=typeof e||e,this.regionProvider=h(r),this.credentialProvider=h(t)}createCanonicalRequest(e,t,r){const s=Object.keys(t).sort();return`${e.method}\n${this.getCanonicalPath(e)}\n${(({query:e={}})=>{const t=[],r={};for(const s of Object.keys(e)){if(s.toLowerCase()===Hn)continue;const n=Dt(s);t.push(n);const i=e[s];"string"==typeof i?r[n]=`${n}=${Dt(i)}`:Array.isArray(i)&&(r[n]=i.slice(0).reduce((e,t)=>e.concat([`${n}=${Dt(t)}`]),[]).sort().join("&"))}return t.sort().map(e=>r[e]).filter(e=>e).join("&")})(e)}\n${s.map(e=>`${e}:${t[e]}`).join("\n")}\n\n${s.join(";")}\n${r}`}async createStringToSign(e,t,r,s){const n=new this.sha256;n.update(Se(r));return`${s}\n${e}\n${t}\n${ye(await n.digest())}`}getCanonicalPath({path:e}){if(this.uriEscapePath){const t=[];for(const s of e.split("/"))0!==s?.length&&"."!==s&&(".."===s?t.pop():t.push(s));const r=`${e?.startsWith("/")?"/":""}${t.join("/")}${t.length>0&&e?.endsWith("/")?"/":""}`;return Dt(r).replace(/%2F/g,"/")}return e}validateResolvedCredentials(e){if("object"!=typeof e||"string"!=typeof e.accessKeyId||"string"!=typeof e.secretAccessKey)throw new Error("Resolved credential object is not valid")}formatDate(e){const t=(r=e,Jn(r).toISOString().replace(/\.\d{3}Z$/,"Z")).replace(/[\-:]/g,"");var r;return{longDate:t,shortDate:t.slice(0,8)}}getCanonicalHeaderList(e){return Object.keys(e).sort().join(";")}}const Zn={},ei=[],ti=(e,t,r)=>`${e}/${t}/${r}/${Yn}`,ri=(e,t,r)=>{const s=new e(t);return s.update(Se(r)),s.digest()},si=({headers:e},t,r)=>{const s={};for(const n of Object.keys(e).sort()){if(null==e[n])continue;const i=n.toLowerCase();(i in Kn||t?.has(i)||Vn.test(i)||Wn.test(i))&&(!r||r&&!r.has(i))||(s[i]=e[n].trim().replace(/\s+/g," "))}return s},ni=async({headers:e,body:t},r)=>{for(const s of Object.keys(e))if(s.toLowerCase()===qn)return e[s];if(null==t)return"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";if("string"==typeof t||ArrayBuffer.isView(t)||ve(t)){const e=new r;return e.update(Se(t)),ye(await e.digest())}return"UNSIGNED-PAYLOAD"},ii=e=>{e=At.clone(e);for(const t of Object.keys(e.headers))jn.indexOf(t.toLowerCase())>-1&&delete e.headers[t];return e};class oi extends Qn{headerFormatter=new In;constructor({applyChecksum:e,credentials:t,region:r,service:s,sha256:n,uriEscapePath:i=!0}){super({applyChecksum:e,credentials:t,region:r,service:s,sha256:n,uriEscapePath:i})}async presign(e,t={}){const{signingDate:r=/* @__PURE__ */new Date,expiresIn:s=3600,unsignableHeaders:n,unhoistableHeaders:i,signableHeaders:o,hoistableHeaders:a,signingRegion:c,signingService:u}=t,d=await this.credentialProvider();this.validateResolvedCredentials(d);const l=c??await this.regionProvider(),{longDate:h,shortDate:f}=this.formatDate(r);if(s>604800)return Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future");const p=ti(f,l,u??this.service),m=((e,t={})=>{const{headers:r,query:s={}}=At.clone(e);for(const n of Object.keys(r)){const e=n.toLowerCase();("x-amz-"===e.slice(0,6)&&!t.unhoistableHeaders?.has(e)||t.hoistableHeaders?.has(e))&&(s[n]=r[n],delete r[n])}return{...e,headers:r,query:s}})(ii(e),{unhoistableHeaders:i,hoistableHeaders:a});d.sessionToken&&(m.query[Ln]=d.sessionToken),m.query["X-Amz-Algorithm"]=Gn,m.query["X-Amz-Credential"]=`${d.accessKeyId}/${p}`,m.query[Dn]=h,m.query["X-Amz-Expires"]=s.toString(10);const g=si(m,n,o);return m.query["X-Amz-SignedHeaders"]=this.getCanonicalHeaderList(g),m.query[_n]=await this.getSignature(h,p,this.getSigningKey(d,l,f,u),this.createCanonicalRequest(m,g,await ni(e,this.sha256))),m}async sign(e,t){return"string"==typeof e?this.signString(e,t):e.headers&&e.payload?this.signEvent(e,t):e.message?this.signMessage(e,t):this.signRequest(e,t)}async signEvent({headers:e,payload:t},{signingDate:r=/* @__PURE__ */new Date,priorSignature:s,signingRegion:n,signingService:i,eventStreamCredentials:o}){const a=n??await this.regionProvider(),{shortDate:c,longDate:u}=this.formatDate(r),d=ti(c,a,i??this.service),l=await ni({headers:{},body:t},this.sha256),h=new this.sha256;h.update(e);const f=ye(await h.digest()),p=[Xn,u,d,s,f,l].join("\n");return this.signString(p,{signingDate:r,signingRegion:a,signingService:i,eventStreamCredentials:o})}async signMessage(e,{signingDate:t=/* @__PURE__ */new Date,signingRegion:r,signingService:s,eventStreamCredentials:n}){return this.signEvent({headers:this.headerFormatter.format(e.message.headers),payload:e.message.body},{signingDate:t,signingRegion:r,signingService:s,priorSignature:e.priorSignature,eventStreamCredentials:n}).then(t=>({message:e.message,signature:t}))}async signString(e,{signingDate:t=/* @__PURE__ */new Date,signingRegion:r,signingService:s,eventStreamCredentials:n}={}){const i=n??await this.credentialProvider();this.validateResolvedCredentials(i);const o=r??await this.regionProvider(),{shortDate:a}=this.formatDate(t),c=new this.sha256(await this.getSigningKey(i,o,a,s));return c.update(Se(e)),ye(await c.digest())}async signRequest(e,{signingDate:t=/* @__PURE__ */new Date,signableHeaders:r,unsignableHeaders:s,signingRegion:n,signingService:i}={}){const o=await this.credentialProvider();this.validateResolvedCredentials(o);const a=n??await this.regionProvider(),c=ii(e),{longDate:u,shortDate:d}=this.formatDate(t),l=ti(d,a,i??this.service);c.headers[zn]=u,o.sessionToken&&(c.headers[Fn]=o.sessionToken);const h=await ni(c,this.sha256);!((e,t)=>{e=e.toLowerCase();for(const r of Object.keys(t))if(e===r.toLowerCase())return!0;return!1})(qn,c.headers)&&this.applyChecksum&&(c.headers[qn]=h);const f=si(c,s,r),p=await this.getSignature(u,l,this.getSigningKey(o,a,d,i),this.createCanonicalRequest(c,f,h));return c.headers[Bn]=`${Gn} Credential=${o.accessKeyId}/${l}, SignedHeaders=${this.getCanonicalHeaderList(f)}, Signature=${p}`,c}async getSignature(e,t,r,s){const n=await this.createStringToSign(e,t,s,Gn),i=new this.sha256(await r);return i.update(Se(n)),ye(await i.digest())}getSigningKey(e,t,r,s){return(async(e,t,r,s,n)=>{const i=`${r}:${s}:${n}:${ye(await ri(e,t.secretAccessKey,t.accessKeyId))}:${t.sessionToken}`;if(i in Zn)return Zn[i];for(ei.push(i);ei.length>50;)delete Zn[ei.shift()];let o=`AWS4${t.secretAccessKey}`;for(const a of[r,s,n,Yn])o=await ri(e,o,a);return Zn[i]=o})(this.sha256,e,r,t,s||this.service)}}const ai="X-Amz-S3session-Token",ci=ai.toLowerCase();class ui extends oi{async signWithCredentials(e,t,r){const s=di(t);e.headers[ci]=t.sessionToken;return li(this,s),this.signRequest(e,r??{})}async presignWithCredentials(e,t,r){const s=di(t);delete e.headers[ci],e.headers[ai]=t.sessionToken,e.query=e.query??{},e.query[ai]=t.sessionToken;return li(this,s),this.presign(e,r)}}function di(e){return{accessKeyId:e.accessKeyId,secretAccessKey:e.secretAccessKey,expiration:e.expiration}}function li(e,t){const r=e.credentialProvider;e.credentialProvider=()=>(e.credentialProvider=r,Promise.resolve(t))}class hi{sigv4aSigner;sigv4Signer;signerOptions;static sigv4aDependency(){return"none"}constructor(e){this.sigv4Signer=new ui(e),this.signerOptions=e}async sign(e,t={}){return"*"===t.signingRegion?this.getSigv4aSigner().sign(e,t):this.sigv4Signer.sign(e,t)}async signWithCredentials(e,t,r={}){if("*"===r.signingRegion)throw this.getSigv4aSigner(),new Error('signWithCredentials with signingRegion \'*\' is only supported when using the CRT dependency @aws-sdk/signature-v4-crt. Please check whether you have installed the "@aws-sdk/signature-v4-crt" package explicitly. You must also register the package by calling [require("@aws-sdk/signature-v4-crt");] or an ESM equivalent such as [import "@aws-sdk/signature-v4-crt";]. For more information please go to https://github.com/aws/aws-sdk-js-v3#functionality-requiring-aws-common-runtime-crt');return this.sigv4Signer.signWithCredentials(e,t,r)}async presign(e,t={}){if("*"===t.signingRegion)throw this.getSigv4aSigner(),new Error('presign with signingRegion \'*\' is only supported when using the CRT dependency @aws-sdk/signature-v4-crt. Please check whether you have installed the "@aws-sdk/signature-v4-crt" package explicitly. You must also register the package by calling [require("@aws-sdk/signature-v4-crt");] or an ESM equivalent such as [import "@aws-sdk/signature-v4-crt";]. For more information please go to https://github.com/aws/aws-sdk-js-v3#functionality-requiring-aws-common-runtime-crt');return this.sigv4Signer.presign(e,t)}async presignWithCredentials(e,t,r={}){if("*"===r.signingRegion)throw new Error("Method presignWithCredentials is not supported for [signingRegion=*].");return this.sigv4Signer.presignWithCredentials(e,t,r)}getSigv4aSigner(){if(!this.sigv4aSigner)throw"node"===this.signerOptions.runtime?new Error("Neither CRT nor JS SigV4a implementation is available. Please load either @aws-sdk/signature-v4-crt or @aws-sdk/signature-v4a. For more information please go to https://github.com/aws/aws-sdk-js-v3#functionality-requiring-aws-common-runtime-crt"):new Error("JS SigV4a implementation is not available or not a valid constructor. Please check whether you have installed the @aws-sdk/signature-v4a package explicitly. The CRT implementation is not available for browsers. You must also register the package by calling [require('@aws-sdk/signature-v4a');] or an ESM equivalent such as [import '@aws-sdk/signature-v4a';]. For more information please go to https://github.com/aws/aws-sdk-js-v3#using-javascript-non-crt-implementation-of-sigv4a");return this.sigv4aSigner}}const fi="X-Amz-S3session-Token".toLowerCase(),pi={name:"s3ExpressMiddleware",step:"build",tags:["S3","S3_EXPRESS"],override:!0},mi=e=>({applyToStack:t=>{t.add((e=>(t,r)=>async s=>{if(r.endpointV2){const t=r.endpointV2,n="sigv4-s3express"===t.properties?.authSchemes?.[0]?.name;if(("S3Express"===t.properties?.backend||"Directory"===t.properties?.bucketType)&&(zr(r,"S3_EXPRESS_BUCKET","J"),r.isS3ExpressBucket=!0),n){const t=s.input.Bucket;if(t){const n=await e.s3ExpressIdentityProvider.getS3ExpressIdentity(await e.credentials(),{Bucket:t});r.s3ExpressIdentity=n,At.isInstance(s.request)&&n.sessionToken&&(s.request.headers[fi]=n.sessionToken)}}}return t(s)})(e),pi)}}),gi=e=>e=>{throw e},yi=(e,t)=>{},wi=e=>(t,r)=>async s=>{if(!At.isInstance(s.request))return t(s);const n=l(r).selectedHttpAuthScheme;if(!n)throw new Error("No HttpAuthScheme was selected: unable to sign request");const{httpAuthOption:{signingProperties:i={}},identity:o,signer:a}=n;let c;c=r.s3ExpressIdentity?await(async(e,t,r,s)=>{const n=await s.signWithCredentials(r,e,{});if(n.headers["X-Amz-Security-Token"]||n.headers["x-amz-security-token"])throw new Error("X-Amz-Security-Token must not be set for s3-express requests.");return n})(r.s3ExpressIdentity,0,s.request,await e.signer()):await a.sign(s.request,o,i);const u=await t({...s,request:c}).catch((a.errorHandler||gi)(i));return(a.successHandler||yi)(u.response,i),u};const bi={CopyObjectCommand:!0,UploadPartCopyCommand:!0,CompleteMultipartUploadCommand:!0},Si=e=>(t,r)=>async s=>{const n=await t(s),{response:i}=n;if(!xt.isInstance(i))return n;const{statusCode:o,body:a}=i;if(o<200||o>=300)return n;const c=await vi(a,e);var u;if(i.body=(u=c,new ReadableStream({start(e){e.enqueue(u),e.close()}})),0===c.length&&bi[r.commandName]){const e=new Error("S3 aborted request");throw e.$metadata={httpStatusCode:503},e.name="InternalError",e}const d=e.utf8Encoder(c.subarray(c.length-16));return d&&d.endsWith("</Error>")&&(i.statusCode=503),n},vi=(e=new Uint8Array,t)=>e instanceof Uint8Array?Promise.resolve(e):t.streamCollector(e)||Promise.resolve(new Uint8Array),Ei={relation:"after",toMiddleware:"deserializerMiddleware",tags:["THROW_200_EXCEPTIONS","S3"],name:"throw200ExceptionsMiddleware",override:!0},Ci=e=>({applyToStack:t=>{t.addRelativeTo(Si(e),Ei)}});const Ai={name:"bucketEndpointMiddleware",override:!0,relation:"after",toMiddleware:"endpointV2Middleware"};const xi={step:"initialize",tags:["VALIDATE_BUCKET_NAME"],name:"validateBucketNameMiddleware",override:!0},ki=e=>({applyToStack:t=>{t.add(function({bucketEndpoint:e}){return t=>async r=>{const{input:{Bucket:s}}=r;if(!e&&"string"==typeof s&&!("string"==typeof(n=s)&&0===n.indexOf("arn:")&&n.split(":").length>=6)&&s.indexOf("/")>=0){const e=new Error(`Bucket name shouldn't contain '/', received '${s}'`);throw e.name="InvalidBucketName",e}var n;return t({...r})}}(e),xi),t.addRelativeTo(function(e){return(t,r)=>async s=>{if(e.bucketEndpoint){const e=r.endpointV2;if(e){const t=s.input.Bucket;if("string"==typeof t)try{const s=new URL(t);r.endpointV2={...e,url:s}}catch(n){const e=`@aws-sdk/middleware-sdk-s3: bucketEndpoint=true was set but Bucket=${t} could not be parsed as URL.`;throw"NoOpLogger"===r.logger?.constructor?.name?console.warn(e):r.logger?.warn?.(e),n}}}return t(s)}}(e),Ai)}});class Ri{queryCompat;errorRegistry;constructor(e=!1){this.queryCompat=e}resolveRestContentType(e,t){const r=t.getMemberSchemas(),s=Object.values(r).find(e=>!!e.getMergedTraits().httpPayload);if(s){const t=s.getMergedTraits().mediaType;return t||(s.isStringSchema()?"text/plain":s.isBlobSchema()?"application/octet-stream":e)}if(!t.isUnitSchema()){if(Object.values(r).find(e=>{const{httpQuery:t,httpQueryParams:r,httpHeader:s,httpLabel:n,httpPrefixHeaders:i}=e.getMergedTraits();return!t&&!r&&!s&&!n&&void 0===i}))return e}}async getErrorSchemaOrThrowBaseException(e,t,r,s,n,i){let o=e;e.includes("#")&&([,o]=e.split("#"));const a={$metadata:n,$fault:r.statusCode<500?"client":"server"};if(!this.errorRegistry)throw new Error("@aws-sdk/core/protocols - error handler not initialized.");try{return{errorSchema:i?.(this.errorRegistry,o)??this.errorRegistry.getSchema(e),errorMetadata:a}}catch(c){s.message=s.message??s.Message??"UnknownError";const e=this.errorRegistry,t=e.getBaseException();if(t){const r=e.getErrorCtor(t)??Error;throw this.decorateServiceException(Object.assign(new r({name:o}),a),s)}const r=s,n=r?.message??r?.Message??r?.Error?.Message??r?.Error?.message;throw this.decorateServiceException(Object.assign(new Error(n),{name:o},a),s)}}compose(e,t,r){let s=r;t.includes("#")&&([s]=t.split("#"));const n=er.for(s),i=er.for("smithy.ts.sdk.synthetic."+r);e.copyFrom(n),e.copyFrom(i),this.errorRegistry=e}decorateServiceException(e,t={}){if(this.queryCompat){const r=e.Message??t.Message,s=or(e,t);r&&(s.message=r);const n=s.Error??{};n.Type=s.Error?.Type,n.Code=s.Error?.Code,n.Message=s.Error?.message??s.Error?.Message??r,s.Error=n;const i=s.$metadata.requestId;return i&&(s.RequestId=i),s}return or(e,t)}setQueryCompatError(e,t){const r=t.headers?.["x-amzn-query-error"];if(void 0!==e&&null!=r){const[t,s]=r.split(";"),n=Object.keys(e),i={Code:t,Type:s};e.Code=t,e.Type=s;for(let r=0;r<n.length;r++){const t=n[r];i["message"===t?"Message":t]=e[t]}delete i.__type,e.Error=i}}queryCompatOutput(e,t){e.Error&&(t.Error=e.Error),e.Type&&(t.Type=e.Type),e.Code&&(t.Code=e.Code)}findQueryCompatibleError(e,t){try{return e.getSchema(t)}catch(r){return e.find(e=>Yt.of(e).getMergedTraits().awsQueryError?.[0]===t)}}}class Ti{serdeContext;setSerdeContext(e){this.serdeContext=e}}class Pi{from;to;keys;constructor(e,t){this.from=e,this.to=t;const r=Object.keys(this.from),s=new Set(r);s.delete("__type"),this.keys=s}mark(e){this.keys.delete(e)}hasUnknown(){return 1===this.keys.size&&0===Object.keys(this.to).length}writeUnknown(){if(this.hasUnknown()){const e=this.keys.values().next().value,t=this.from[e];this.to.$unknown=[e,t]}}}const Ii=/[&<>"]/g,Mi={"&":"&","<":"<",">":">",'"':"""};function Ni(e){return e.replace(Ii,e=>Mi[e])}const Oi=/[&"'<>\r\n\u0085\u2028]/g,$i={"&":"&",'"':""","'":"'","<":"<",">":">","\r":"
","\n":"
","
":"…","\u2028":"
"};class Ui{value;constructor(e){this.value=e}toString(){return(""+this.value).replace(Oi,e=>$i[e])}}class Di{name;children;attributes={};static of(e,t,r){const s=new Di(e);return void 0!==t&&s.addChildNode(new Ui(t)),void 0!==r&&s.withName(r),s}constructor(e,t=[]){this.name=e,this.children=t}withName(e){return this.name=e,this}addAttribute(e,t){return this.attributes[e]=t,this}addChildNode(e){return this.children.push(e),this}removeAttribute(e){return delete this.attributes[e],this}n(e){return this.name=e,this}c(e){return this.children.push(e),this}a(e,t){return null!=t&&(this.attributes[e]=t),this}cc(e,t,r=t){if(null!=e[t]){const s=Di.of(t,e[t]).withName(r);this.c(s)}}l(e,t,r,s){if(null!=e[t]){s().map(e=>{e.withName(r),this.c(e)})}}lc(e,t,r,s){if(null!=e[t]){const e=s(),t=new Di(r);e.map(e=>{t.c(e)}),this.c(t)}}toString(){const e=Boolean(this.children.length);let t=`<${this.name}`;const r=this.attributes;for(const s of Object.keys(r)){const e=r[s];null!=e&&(t+=` ${s}="${Ni(""+e)}"`)}return t+(e?`>${this.children.map(e=>e.toString()).join("")}</${this.name}>`:"/>")}}let _i;class Li extends Ti{settings;stringDeserializer;constructor(e){super(),this.settings=e,this.stringDeserializer=new Pt(e)}setSerdeContext(e){this.serdeContext=e,this.stringDeserializer.setSerdeContext(e)}read(e,t,r){const s=Yt.of(e),n=s.getMemberSchemas();if(s.isStructSchema()&&s.isMemberSchema()&&!!Object.values(n).find(e=>!!e.getMemberTraits().eventPayload)){const e={},r=Object.keys(n)[0];return n[r].isBlobSchema()?e[r]=t:e[r]=this.read(n[r],t),e}const i=(this.serdeContext?.utf8Encoder??v)(t),o=this.parseXml(i);return this.readSchema(e,r?o[r]:o)}readSchema(e,t){const r=Yt.of(e);if(r.isUnitSchema())return;const s=r.getMergedTraits();if(r.isListSchema()&&!Array.isArray(t))return this.readSchema(r,[t]);if(null==t)return t;if("object"==typeof t){const e=!!s.xmlFlattened;if(r.isListSchema()){const s=r.getValueSchema(),n=[],i=s.getMergedTraits().xmlName??"member",o=e?t:(t[0]??t)[i];if(null==o)return n;const a=Array.isArray(o)?o:[o];for(const e of a)n.push(this.readSchema(s,e));return n}const n={};if(r.isMapSchema()){const s=r.getKeySchema(),i=r.getValueSchema();let o;o=e?Array.isArray(t)?t:[t]:Array.isArray(t.entry)?t.entry:[t.entry];const a=s.getMergedTraits().xmlName??"key",c=i.getMergedTraits().xmlName??"value";for(const e of o){const t=e[a],r=e[c];n[t]=this.readSchema(i,r)}return n}if(r.isStructSchema()){const e=r.isUnionSchema();let s;e&&(s=new Pi(t,n));for(const[i,o]of r.structIterator()){const r=o.getMergedTraits(),a=r.httpPayload?r.xmlName??o.getName():o.getMemberTraits().xmlName??i;e&&s.mark(a),null!=t[a]&&(n[i]=this.readSchema(o,t[a]))}return e&&s.writeUnknown(),n}if(r.isDocumentSchema())return t;throw new Error(`@aws-sdk/core/protocols - xml deserializer unhandled schema type for ${r.getName(!0)}`)}return r.isListSchema()?[]:r.isMapSchema()||r.isStructSchema()?{}:this.stringDeserializer.read(r,t)}parseXml(e){if(e.length){let r;try{r=function(e){_i||(_i=new DOMParser);const t=_i.parseFromString(e,"application/xml");if(t.getElementsByTagName("parsererror").length>0)throw new Error("DOMParser XML parsing error.");const r=e=>{if(e.nodeType===Node.TEXT_NODE&&e.textContent?.trim())return e.textContent;if(e.nodeType===Node.ELEMENT_NODE){const t=e;if(0===t.attributes.length&&0===t.childNodes.length)return"";const s={},n=Array.from(t.attributes);for(const e of n)s[`${e.name}`]=e.value;const i=Array.from(t.childNodes);for(const e of i){const o=r(e);if(null!=o){const t=e.nodeName;if(1===i.length&&0===n.length&&"#text"===t)return o;s[t]?Array.isArray(s[t])?s[t].push(o):s[t]=[s[t],o]:s[t]=o}else if(1===i.length&&0===n.length)return t.textContent}return s}return null};return{[t.documentElement.nodeName]:r(t.documentElement)}}(e)}catch(t){throw t&&"object"==typeof t&&Object.defineProperty(t,"$responseBodyText",{value:e}),t}const s="#text",n=Object.keys(r)[0],i=r[n];return i[s]&&(i[n]=i[s],delete i[s]),lr(i)}return{}}}class Bi extends Ti{settings;stringBuffer;byteBuffer;buffer;constructor(e){super(),this.settings=e}write(e,t){const r=Yt.of(e);if(r.isStringSchema()&&"string"==typeof t)this.stringBuffer=t;else if(r.isBlobSchema())this.byteBuffer="byteLength"in t?t:(this.serdeContext?.base64Decoder??w)(t);else{this.buffer=this.writeStruct(r,t,void 0);const e=r.getMergedTraits();e.httpPayload&&!e.xmlName&&this.buffer.withName(r.getName())}}flush(){if(void 0!==this.byteBuffer){const e=this.byteBuffer;return delete this.byteBuffer,e}if(void 0!==this.stringBuffer){const e=this.stringBuffer;return delete this.stringBuffer,e}const e=this.buffer;return this.settings.xmlNamespace&&(e?.attributes?.xmlns||e.addAttribute("xmlns",this.settings.xmlNamespace)),delete this.buffer,e.toString()}writeStruct(e,t,r){const s=e.getMergedTraits(),n=e.isMemberSchema()&&!s.httpPayload?e.getMemberTraits().xmlName??e.getMemberName():s.xmlName??e.getName();if(!n||!e.isStructSchema())throw new Error(`@aws-sdk/core/protocols - xml serializer, cannot write struct with empty name or non-struct, schema=${e.getName(!0)}.`);const i=Di.of(n),[o,a]=this.getXmlnsAttribute(e,r);for(const[u,d]of e.structIterator()){const e=t[u];if(null!=e||d.isIdempotencyToken()){if(d.getMergedTraits().xmlAttribute){i.addAttribute(d.getMergedTraits().xmlName??u,this.writeSimple(d,e));continue}if(d.isListSchema())this.writeList(d,e,i,a);else if(d.isMapSchema())this.writeMap(d,e,i,a);else if(d.isStructSchema())i.addChildNode(this.writeStruct(d,e,a));else{const t=Di.of(d.getMergedTraits().xmlName??d.getMemberName());this.writeSimpleInto(d,e,t,a),i.addChildNode(t)}}}const{$unknown:c}=t;if(c&&e.isUnionSchema()&&Array.isArray(c)&&1===Object.keys(t).length){const[e,r]=c,s=Di.of(e);if("string"!=typeof r){if(!(t instanceof Di||t instanceof Ui))throw new Error("@aws-sdk - $unknown union member in XML requires value of type string, @aws-sdk/xml-builder::XmlNode or XmlText.");i.addChildNode(t)}this.writeSimpleInto(0,r,s,a),i.addChildNode(s)}return a&&i.addAttribute(o,a),i}writeList(e,t,r,s){if(!e.isMemberSchema())throw new Error(`@aws-sdk/core/protocols - xml serializer, cannot write non-member list: ${e.getName(!0)}`);const n=e.getMergedTraits(),i=e.getValueSchema(),o=i.getMergedTraits(),a=!!o.sparse,c=!!n.xmlFlattened,[u,d]=this.getXmlnsAttribute(e,s),l=(t,r)=>{if(i.isListSchema())this.writeList(i,Array.isArray(r)?r:[r],t,d);else if(i.isMapSchema())this.writeMap(i,r,t,d);else if(i.isStructSchema()){const s=this.writeStruct(i,r,d);t.addChildNode(s.withName(c?n.xmlName??e.getMemberName():o.xmlName??"member"))}else{const s=Di.of(c?n.xmlName??e.getMemberName():o.xmlName??"member");this.writeSimpleInto(i,r,s,d),t.addChildNode(s)}};if(c)for(const h of t)(a||null!=h)&&l(r,h);else{const s=Di.of(n.xmlName??e.getMemberName());d&&s.addAttribute(u,d);for(const e of t)(a||null!=e)&&l(s,e);r.addChildNode(s)}}writeMap(e,t,r,s,n=!1){if(!e.isMemberSchema())throw new Error(`@aws-sdk/core/protocols - xml serializer, cannot write non-member map: ${e.getName(!0)}`);const i=e.getMergedTraits(),o=e.getKeySchema(),a=o.getMergedTraits().xmlName??"key",c=e.getValueSchema(),u=c.getMergedTraits(),d=u.xmlName??"value",l=!!u.sparse,h=!!i.xmlFlattened,[f,p]=this.getXmlnsAttribute(e,s),m=(e,t,r)=>{const s=Di.of(a,t),[n,i]=this.getXmlnsAttribute(o,p);i&&s.addAttribute(n,i),e.addChildNode(s);let u=Di.of(d);c.isListSchema()?this.writeList(c,r,u,p):c.isMapSchema()?this.writeMap(c,r,u,p,!0):c.isStructSchema()?u=this.writeStruct(c,r,p):this.writeSimpleInto(c,r,u,p),e.addChildNode(u)};if(h)for(const g in t){const s=t[g];if(l||null!=s){const t=Di.of(i.xmlName??e.getMemberName());m(t,g,s),r.addChildNode(t)}}else{let s;n||(s=Di.of(i.xmlName??e.getMemberName()),p&&s.addAttribute(f,p),r.addChildNode(s));for(const e in t){const i=t[e];if(l||null!=i){const t=Di.of("entry");m(t,e,i),(n?r:s).addChildNode(t)}}}}writeSimple(e,t){if(null===t)throw new Error("@aws-sdk/core/protocols - (XML serializer) cannot write null value.");const r=Yt.of(e);let s=null;if(t&&"object"==typeof t)if(r.isBlobSchema())s=(this.serdeContext?.base64Encoder??S)(t);else{if(!(r.isTimestampSchema()&&t instanceof Date)){if(r.isBigDecimalSchema()&&t)return t instanceof fe?t.string:String(t);throw r.isMapSchema()||r.isListSchema()?new Error("@aws-sdk/core/protocols - xml serializer, cannot call _write() on List/Map schema, call writeList or writeMap() instead."):new Error(`@aws-sdk/core/protocols - xml serializer, unhandled schema type for object value and schema: ${r.getName(!0)}`)}switch(Tt(r,this.settings)){case 5:s=t.toISOString().replace(".000Z","Z");break;case 6:s=D(t);break;case 7:s=String(t.getTime()/1e3);break;default:console.warn("Missing timestamp format, using http date",t),s=D(t)}}if((r.isBooleanSchema()||r.isNumericSchema()||r.isBigIntegerSchema()||r.isBigDecimalSchema())&&(s=String(t)),r.isStringSchema()&&(s=void 0===t&&r.isIdempotencyToken()?St():String(t)),null===s)throw new Error(`Unhandled schema-value pair ${r.getName(!0)}=${t}`);return s}writeSimpleInto(e,t,r,s){const n=this.writeSimple(e,t),i=Yt.of(e),o=new Ui(n),[a,c]=this.getXmlnsAttribute(i,s);c&&r.addAttribute(a,c),r.addChildNode(o)}getXmlnsAttribute(e,t){const r=e.getMergedTraits(),[s,n]=r.xmlNamespace??[];return n&&n!==t?[s?`xmlns:${s}`:"xmlns",n]:[void 0,void 0]}}class zi extends Ti{settings;constructor(e){super(),this.settings=e}createSerializer(){const e=new Bi(this.settings);return e.setSerdeContext(this.serdeContext),e}createDeserializer(){const e=new Li(this.settings);return e.setSerdeContext(this.serdeContext),e}}class ji extends Rt{codec;serializer;deserializer;mixin=new Ri;constructor(e){super(e);const t={timestampFormat:{useTrait:!0,default:5},httpBindings:!0,xmlNamespace:e.xmlNamespace,serviceNamespace:e.defaultNamespace};this.codec=new zi(t),this.serializer=new Nt(this.codec.createSerializer(),t),this.deserializer=new It(this.codec.createDeserializer(),t)}getPayloadCodec(){return this.codec}getShapeId(){return"aws.protocols#restXml"}async serializeRequest(e,t,r){const s=await super.serializeRequest(e,t,r),n=Yt.of(e.input);if(!s.headers["content-type"]){const e=this.mixin.resolveRestContentType(this.getDefaultContentType(),n);e&&(s.headers["content-type"]=e)}return"string"!=typeof s.body||s.headers["content-type"]!==this.getDefaultContentType()||s.body.startsWith("<?xml ")||this.hasUnstructuredPayloadBinding(n)||(s.body='<?xml version="1.0" encoding="UTF-8"?>'+s.body),s}async deserializeResponse(e,t,r){return super.deserializeResponse(e,t,r)}async handleError(e,t,r,s,n){const i=((e,t)=>void 0!==t?.Error?.Code?t.Error.Code:void 0!==t?.Code?t.Code:404==e.statusCode?"NotFound":void 0)(r,s)??"Unknown";if(this.mixin.compose(this.compositeErrorRegistry,i,this.options.defaultNamespace),s.Error&&"object"==typeof s.Error)for(const f of Object.keys(s.Error))s[f]=s.Error[f],"message"===f.toLowerCase()&&(s.message=s.Error[f]);s.RequestId&&!n.requestId&&(n.requestId=s.RequestId);const{errorSchema:o,errorMetadata:a}=await this.mixin.getErrorSchemaOrThrowBaseException(i,this.options.defaultNamespace,r,s,n),c=Yt.of(o),u=s.Error?.message??s.Error?.Message??s.message??s.Message??"UnknownError",d=new(this.compositeErrorRegistry.getErrorCtor(o)??Error)({});await this.deserializeHttpMessage(o,t,r,s);const l={},h=this.codec.createDeserializer();for(const[f,p]of c.structIterator()){const e=p.getMergedTraits().xmlName??f,t=s.Error?.[e]??s[e];l[f]=h.readSchema(p,t)}throw this.mixin.decorateServiceException(Object.assign(d,a,{$fault:c.getMergedTraits().error,message:u},l),s)}getDefaultContentType(){return"application/xml"}hasUnstructuredPayloadBinding(e){for(const[,t]of e.structIterator())if(t.getMergedTraits().httpPayload)return!(t.isStructSchema()||t.isMapSchema()||t.isListSchema());return!1}}class Hi extends ji{async serializeRequest(e,t,r){const s=await super.serializeRequest(e,t,r),n=Yt.of(e.input);let i=0;const o=n.getSchema()[6]??0;if(t&&"object"==typeof t)for(const[a,c]of n.structIterator()){if(++i>o)break;if("Bucket"===a){if(!t.Bucket&&c.getMergedTraits().httpLabel)throw new Error("No value provided for input HTTP label: Bucket.");break}}return s}}class qi{bytes;constructor(e){if(this.bytes=e,8!==e.byteLength)throw new Error("Int64 buffers must be exactly 8 bytes")}static fromNumber(e){if(e>0x8000000000000000||e<-0x8000000000000000)throw new Error(`${e} is too large (or, if negative, too small) to represent as an Int64`);const t=new Uint8Array(8);for(let r=7,s=Math.abs(Math.round(e));r>-1&&s>0;r--,s/=256)t[r]=s;return e<0&&Fi(t),new qi(t)}valueOf(){const e=this.bytes.slice(0),t=128&e[0];return t&&Fi(e),parseInt(ye(e),16)*(t?-1:1)}toString(){return String(this.valueOf())}}function Fi(e){for(let t=0;t<8;t++)e[t]^=255;for(let t=7;t>-1&&(e[t]++,0===e[t]);t--);}class Ki{toUtf8;fromUtf8;constructor(e,t){this.toUtf8=e,this.fromUtf8=t}format(e){const t=[];for(const n of Object.keys(e)){const r=this.fromUtf8(n);t.push(Uint8Array.from([r.byteLength]),r,this.formatHeaderValue(e[n]))}const r=new Uint8Array(t.reduce((e,t)=>e+t.byteLength,0));let s=0;for(const n of t)r.set(n,s),s+=n.byteLength;return r}formatHeaderValue(e){switch(e.type){case"boolean":return Uint8Array.from([e.value?0:1]);case"byte":return Uint8Array.from([2,e.value]);case"short":const t=new DataView(new ArrayBuffer(3));return t.setUint8(0,3),t.setInt16(1,e.value,!1),new Uint8Array(t.buffer);case"integer":const r=new DataView(new ArrayBuffer(5));return r.setUint8(0,4),r.setInt32(1,e.value,!1),new Uint8Array(r.buffer);case"long":const s=new Uint8Array(9);return s[0]=5,s.set(e.value.bytes,1),s;case"binary":const n=new DataView(new ArrayBuffer(3+e.value.byteLength));n.setUint8(0,6),n.setUint16(1,e.value.byteLength,!1);const i=new Uint8Array(n.buffer);return i.set(e.value,3),i;case"string":const o=this.fromUtf8(e.value),a=new DataView(new ArrayBuffer(3+o.byteLength));a.setUint8(0,7),a.setUint16(1,o.byteLength,!1);const c=new Uint8Array(a.buffer);return c.set(o,3),c;case"timestamp":const u=new Uint8Array(9);return u[0]=8,u.set(qi.fromNumber(e.value.valueOf()).bytes,1),u;case"uuid":if(!ro.test(e.value))throw new Error(`Invalid UUID received: ${e.value}`);const d=new Uint8Array(17);return d[0]=9,d.set(ge(e.value.replace(/\-/g,"")),1),d}}parse(e){const t={};let r=0;for(;r<e.byteLength;){const s=e.getUint8(r++),n=this.toUtf8(new Uint8Array(e.buffer,e.byteOffset+r,s));switch(r+=s,e.getUint8(r++)){case 0:t[n]={type:Wi,value:!0};break;case 1:t[n]={type:Wi,value:!1};break;case 2:t[n]={type:Gi,value:e.getInt8(r++)};break;case 3:t[n]={type:Xi,value:e.getInt16(r,!1)},r+=2;break;case 4:t[n]={type:Yi,value:e.getInt32(r,!1)},r+=4;break;case 5:t[n]={type:Ji,value:new qi(new Uint8Array(e.buffer,e.byteOffset+r,8))},r+=8;break;case 6:const s=e.getUint16(r,!1);r+=2,t[n]={type:Qi,value:new Uint8Array(e.buffer,e.byteOffset+r,s)},r+=s;break;case 7:const i=e.getUint16(r,!1);r+=2,t[n]={type:Zi,value:this.toUtf8(new Uint8Array(e.buffer,e.byteOffset+r,i))},r+=i;break;case 8:t[n]={type:eo,value:new Date(new qi(new Uint8Array(e.buffer,e.byteOffset+r,8)).valueOf())},r+=8;break;case 9:const o=new Uint8Array(e.buffer,e.byteOffset+r,16);r+=16,t[n]={type:to,value:`${ye(o.subarray(0,4))}-${ye(o.subarray(4,6))}-${ye(o.subarray(6,8))}-${ye(o.subarray(8,10))}-${ye(o.subarray(10))}`};break;default:throw new Error("Unrecognized header type tag")}}return t}}var Vi;!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"}(Vi||(Vi={}));const Wi="boolean",Gi="byte",Xi="short",Yi="integer",Ji="long",Qi="binary",Zi="string",eo="timestamp",to="uuid",ro=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;class so{headerMarshaller;messageBuffer;isEndOfStream;constructor(e,t){this.headerMarshaller=new Ki(e,t),this.messageBuffer=[],this.isEndOfStream=!1}feed(e){this.messageBuffer.push(this.decode(e))}endOfStream(){this.isEndOfStream=!0}getMessage(){const e=this.messageBuffer.pop(),t=this.isEndOfStream;return{getMessage:()=>e,isEndOfStream:()=>t}}getAvailableMessages(){const e=this.messageBuffer;this.messageBuffer=[];const t=this.isEndOfStream;return{getMessages:()=>e,isEndOfStream:()=>t}}encode({headers:e,body:t}){const r=this.headerMarshaller.format(e),s=r.byteLength+t.byteLength+16,n=new Uint8Array(s),i=new DataView(n.buffer,n.byteOffset,n.byteLength),o=new on;return i.setUint32(0,s,!1),i.setUint32(4,r.byteLength,!1),i.setUint32(8,o.update(n.subarray(0,8)).digest(),!1),n.set(r,12),n.set(t,r.byteLength+12),i.setUint32(s-4,o.update(n.subarray(8,s-4)).digest(),!1),n}decode(e){const{headers:t,body:r}=function({byteLength:e,byteOffset:t,buffer:r}){if(e<16)throw new Error("Provided message too short to accommodate event stream message overhead");const s=new DataView(r,t,e),n=s.getUint32(0,!1);if(e!==n)throw new Error("Reported message length does not match received message length");const i=s.getUint32(4,!1),o=s.getUint32(8,!1),a=s.getUint32(e-4,!1),c=(new on).update(new Uint8Array(r,t,8));if(o!==c.digest())throw new Error(`The prelude checksum specified in the message (${o}) does not match the calculated CRC32 checksum (${c.digest()})`);if(c.update(new Uint8Array(r,t+8,e-12)),a!==c.digest())throw new Error(`The message checksum (${c.digest()}) did not match the expected value of ${a}`);return{headers:new DataView(r,t+8+4,i),body:new Uint8Array(r,t+8+4+i,n-i-16)}}(e);return{headers:this.headerMarshaller.parse(t),body:r}}formatHeaders(e){return this.headerMarshaller.format(e)}}class no{options;constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(const e of this.options.inputStream){const t=this.options.decoder.decode(e);yield t}}}class io{options;constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(const e of this.options.messageStream){const t=this.options.encoder.encode(e);yield t}this.options.includeEndFrame&&(yield new Uint8Array(0))}}class oo{options;constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(const e of this.options.messageStream){const t=await this.options.deserializer(e);void 0!==t&&(yield t)}}}class ao{options;constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(const e of this.options.inputStream){const t=this.options.serializer(e);yield t}}}function co(e){let t=0,r=0,s=null,n=null;const i=e=>{if("number"!=typeof e)throw new Error("Attempted to allocate an event message where size was not a number: "+e);t=e,r=4,s=new Uint8Array(e);new DataView(s.buffer).setUint32(0,e,!1)};return{[Symbol.asyncIterator]:async function*(){const o=e[Symbol.asyncIterator]();for(;;){const{value:e,done:a}=await o.next();if(a){if(!t)return;if(t!==r)throw new Error("Truncated event message received.");return void(yield s)}const c=e.length;let u=0;for(;u<c;){if(!s){const t=c-u;n||(n=new Uint8Array(4));const s=Math.min(4-r,t);if(n.set(e.slice(u,u+s),r),r+=s,u+=s,r<4)break;i(new DataView(n.buffer).getUint32(0,!1)),n=null}const o=Math.min(t-r,c-u);s.set(e.slice(u,u+o),r),r+=o,u+=o,t&&t===r&&(yield s,s=null,t=0,r=0)}}}}}function uo(e,t){return async function(r){const{value:s}=r.headers[":message-type"];if("error"===s){const e=new Error(r.headers[":error-message"].value||"UnknownError");throw e.name=r.headers[":error-code"].value,e}if("exception"===s){const s=r.headers[":exception-type"].value,n={[s]:r},i=await e(n);if(i.$unknown){const e=new Error(t(r.body));throw e.name=s,e}throw i[s]}if("event"===s){const t={[r.headers[":event-type"].value]:r},s=await e(t);if(s.$unknown)return;return s}throw Error(`Unrecognizable event type: ${r.headers[":event-type"].value}`)}}let lo=class{eventStreamCodec;utfEncoder;constructor({utf8Encoder:e,utf8Decoder:t}){this.eventStreamCodec=new so(e,t),this.utfEncoder=e}deserialize(e,t){const r=co(e);return new oo({messageStream:new no({inputStream:r,decoder:this.eventStreamCodec}),deserializer:uo(t,this.utfEncoder)})}serialize(e,t){return new io({messageStream:new ao({inputStream:e,serializer:t}),encoder:this.eventStreamCodec,includeEndFrame:!0})}};const ho=e=>({[Symbol.asyncIterator]:async function*(){const t=e.getReader();try{for(;;){const{done:e,value:r}=await t.read();if(e)return;yield r}}finally{t.releaseLock()}}}),fo=e=>{const t=e[Symbol.asyncIterator]();return new ReadableStream({async pull(e){const{done:r,value:s}=await t.next();if(r)return e.close();e.enqueue(s)}})};class po{universalMarshaller;constructor({utf8Encoder:e,utf8Decoder:t}){this.universalMarshaller=new lo({utf8Decoder:t,utf8Encoder:e})}deserialize(e,t){const r=mo(e)?ho(e):e;return this.universalMarshaller.deserialize(r,t)}serialize(e,t){const r=this.universalMarshaller.serialize(e,t);return"function"==typeof ReadableStream?fo(r):r}}const mo=e=>"function"==typeof ReadableStream&&e instanceof ReadableStream,go=e=>new po(e),yo=e=>Object.assign(e,{eventStreamMarshaller:e.eventStreamSerdeProvider(e)}),wo=e=>xt.isInstance(e)?e.headers?.date??e.headers?.Date:void 0,bo=e=>new Date(Date.now()+e),So=(e,t)=>{const r=Date.parse(e);return((e,t)=>Math.abs(bo(t).getTime()-e)>=3e5)(r,t)?r-Date.now():t},vo=(e,t)=>{if(!t)throw new Error(`Property \`${e}\` is not resolved for AWS SDK SigV4Auth`);return t},Eo=async e=>{const t=vo("context",e.context),r=vo("config",e.config),s=t.endpointV2?.properties?.authSchemes?.[0],n=vo("signer",r.signer),i=await n(s),o=e?.signingRegion,a=e?.signingRegionSet,c=e?.signingName;return{config:r,signer:i,signingRegion:o,signingRegionSet:a,signingName:c}};class Co{async sign(e,t,r){if(!At.isInstance(e))throw new Error("The request is not an instance of `HttpRequest` and cannot be signed");const s=await Eo(r),{config:n,signer:i}=s;let{signingRegion:o,signingName:a}=s;const c=r.context;if(c?.authSchemes?.length){const[e,t]=c.authSchemes;"sigv4a"===e?.name&&"sigv4"===t?.name&&(o=t?.signingRegion??o,a=t?.signingName??a)}return await i.sign(e,{signingDate:bo(n.systemClockOffset),signingRegion:o,signingService:a})}errorHandler(e){return t=>{const r=t.ServerTime??wo(t.$response);if(r){const s=vo("config",e.config),n=s.systemClockOffset;s.systemClockOffset=So(r,s.systemClockOffset);s.systemClockOffset!==n&&t.$metadata&&(t.$metadata.clockSkewCorrected=!0)}throw t}}successHandler(e,t){const r=wo(e);if(r){const e=vo("config",t.config);e.systemClockOffset=So(r,e.systemClockOffset)}}}class Ao extends Co{async sign(e,t,r){if(!At.isInstance(e))throw new Error("The request is not an instance of `HttpRequest` and cannot be signed");const{config:s,signer:n,signingRegion:i,signingRegionSet:o,signingName:a}=await Eo(r),c=(await(s.sigv4aSigningRegionSet?.())??o??[i]).join(",");return await n.sign(e,{signingDate:bo(s.systemClockOffset),signingRegion:c,signingService:a})}}const xo=e=>{let t,r=e.credentials,s=!!e.credentials;Object.defineProperty(e,"credentials",{set(n){n&&n!==r&&n!==t&&(s=!0),r=n;const i=function(e,{credentials:t,credentialDefaultProvider:r}){let s;s=t?t?.memoized?t:((e,t,r)=>{if(void 0===e)return;const s="function"!=typeof e?async()=>Promise.resolve(e):e;let n,i,o,a=!1;const c=async e=>{i||(i=s(e));try{n=await i,o=!0,a=!1}finally{i=void 0}return n};return void 0===t?async e=>(o&&!e?.forceRefresh||(n=await c(e)),n):async e=>(o&&!e?.forceRefresh||(n=await c(e)),a?n:r(n)?t(n)?(await c(e),n):n:(a=!0,n))})(t,Qr,es):r?Yr(r(Object.assign({},e,{parentClientConfig:e}))):async()=>{throw new Error("@aws-sdk/core::resolveAwsSdkSigV4Config - `credentials` not provided and no credentialDefaultProvider was configured.")};return s.memoized=!0,s}(e,{credentials:r,credentialDefaultProvider:e.credentialDefaultProvider}),o=function(e,t){if(t.configBound)return t;const r=async r=>t({...r,callerClientConfig:e});return r.memoized=t.memoized,r.configBound=!0,r}(e,i);if(s&&!o.attributed){const e="object"==typeof r&&null!==r;t=async t=>{const r=await o(t);return!e||r.$source&&0!==Object.keys(r.$source).length?r:function(e,t,r){return e.$source||(e.$source={}),e.$source[t]=r,e}(r,"CREDENTIALS_CODE","e")},t.memoized=o.memoized,t.configBound=o.configBound,t.attributed=!0}else t=o},get:()=>t,enumerable:!0,configurable:!0}),e.credentials=r;const{signingEscapePath:n=!0,systemClockOffset:i=e.systemClockOffset||0,sha256:o}=e;let a;a=e.signer?Yr(e.signer):e.regionInfoProvider?()=>Yr(e.region)().then(async t=>[await e.regionInfoProvider(t,{useFipsEndpoint:await e.useFipsEndpoint(),useDualstackEndpoint:await e.useDualstackEndpoint()})||{},t]).then(([t,r])=>{const{signingRegion:s,signingService:i}=t;e.signingRegion=e.signingRegion||s||r,e.signingName=e.signingName||i||e.serviceId;const a={...e,credentials:e.credentials,region:e.signingRegion,service:e.signingName,sha256:o,uriEscapePath:n};return new(e.signerConstructor||oi)(a)}):async t=>{const r=(t=Object.assign({},{name:"sigv4",signingName:e.signingName||e.defaultSigningName,signingRegion:await Yr(e.region)(),properties:{}},t)).signingRegion,s=t.signingName;e.signingRegion=e.signingRegion||r,e.signingName=e.signingName||s||e.serviceId;const i={...e,credentials:e.credentials,region:e.signingRegion,service:e.signingName,sha256:o,uriEscapePath:n};return new(e.signerConstructor||oi)(i)};return Object.assign(e,{systemClockOffset:i,signingEscapePath:n,signer:a})};const ko="ref",Ro="argv",To="backend",Po="authSchemes",Io="disableDoubleEncoding",Mo="signingName",No="signingRegion",Oo="signingRegionSet",$o=-1,Uo=!0,Do=!1,_o="isSet",Lo="booleanEquals",Bo="stringEquals",zo="coalesce",jo="substring",Ho="",qo="aws.partition",Fo="partitionResult",Ko="accessPointSuffix",Vo="regionPrefix",Wo=e=>"outpostId_ssa_"+e+Ho,Go="hardwareType",Xo="ite",Yo="isValidHostLabel",Jo="sigv4",Qo="aws.isVirtualHostableS3Bucket",Zo="getAttr",ea="bucketArn",ta="--",ra="arnType",sa="accesspoint",na=e=>"accessPointName_ssa_"+e+Ho,ia="s3-object-lambda",oa="s3-outposts",aa="bucketPartition",ca="us-east-1",ua="outpostType",da="name",la="s3",ha="{url#scheme}://{Bucket}.{url#authority}{url#path}",fa="{url#scheme}://{url#authority}{url#path}",pa="{url#scheme}://{url#authority}{url#normalizedPath}{Bucket}",ma="https://{Bucket}.s3-accelerate.{partitionResult#dnsSuffix}",ga="https://{Bucket}.s3.{partitionResult#dnsSuffix}",ya=e=>"{url#scheme}://{accessPointName_ssa_"+e+"}-{bucketArn#accountId}.{url#authority}{url#path}",wa=e=>"Invalid ARN: The access point name may only contain a-z, A-Z, 0-9 and `-`. Found: `{accessPointName_ssa_"+e+"}`",ba="sigv4a",Sa="{url#scheme}://{url#authority}{url#normalizedPath}{uri_encoded_bucket}",va="https://s3.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",Ea="https://s3.{partitionResult#dnsSuffix}",Ca={[ko]:"UseFIPS"},Aa={[ko]:"UseDualStack"},xa={[ko]:"Bucket"},ka={fn:Zo,[Ro]:[{[ko]:Fo},da]},Ra={[ko]:"url"},Ta={[ko]:"Region"},Pa={[ko]:ea},Ia={[ko]:ra},Ma={[ko]:"accessPointName_ssa_1"},Na={fn:Zo,[Ro]:[Pa,"region"]},Oa={[ko]:Go},$a={fn:Zo,[Ro]:[Pa,"service"]},Ua={fn:Zo,[Ro]:[Pa,"accountId"]},Da={[To]:"S3Express",[Po]:[{[Io]:!0,[da]:"{_s3e_auth}",[Mo]:"s3express",[No]:"{Region}"}]},_a={[To]:"S3Express",[Po]:[{[Io]:!0,[da]:Jo,[Mo]:"s3express",[No]:"{Region}"}]},La={[Po]:[{[Io]:!0,[da]:ba,[Mo]:oa,[Oo]:["*"]},{[Io]:!0,[da]:Jo,[Mo]:oa,[No]:"{Region}"}]},Ba={[Po]:[{[Io]:!0,[da]:Jo,[Mo]:la,[No]:ca}]},za={[Po]:[{[Io]:!0,[da]:Jo,[Mo]:la,[No]:"{Region}"}]},ja={[Po]:[{[Io]:!0,[da]:Jo,[Mo]:ia,[No]:"{bucketArn#region}"}]},Ha={[Po]:[{[Io]:!0,[da]:Jo,[Mo]:la,[No]:"{bucketArn#region}"}]},qa={[Po]:[{[Io]:!0,[da]:ba,[Mo]:oa,[Oo]:["*"]},{[Io]:!0,[da]:Jo,[Mo]:oa,[No]:"{bucketArn#region}"}]},Fa={[Po]:[{[Io]:!0,[da]:Jo,[Mo]:ia,[No]:"{Region}"}]},Ka=[Ta],Va=[{[ko]:"Endpoint"}],Wa=[xa],Ga=[xa,0,7,!0],Xa=[Pa,"resourceId[1]"],Ya={conditions:[[_o,Ka],[Lo,[{[ko]:"Accelerate"},Uo]],[Lo,[Ca,Uo]],[Lo,[Aa,Uo]],[_o,Va],[_o,Wa],[Bo,[{fn:zo,[Ro]:[{fn:jo,[Ro]:[xa,0,6,Uo]},Ho]},"--x-s3"]],[Bo,[{fn:zo,[Ro]:[{fn:jo,[Ro]:Ga},Ho]},"--xa-s3"]],[qo,Ka,Fo],[jo,Ga,Ko],[Bo,[{[ko]:Ko},"--op-s3"]],[jo,[xa,8,12,Uo],Vo],[jo,[xa,32,49,Uo],Wo(2)],[jo,[xa,49,50,Uo],Go],[Lo,[{[ko]:"ForcePathStyle"},Uo]],[Bo,[ka,"aws-cn"]],[Xo,[Aa,".dualstack",Ho],"_s3e_ds"],[Yo,[{[ko]:Wo(2)},Do]],[Xo,[Ca,"-fips",Ho],"_s3e_fips"],[Xo,[{fn:zo,[Ro]:[{[ko]:"DisableS3ExpressSessionAuth"},Do]},Jo,"sigv4-s3express"],"_s3e_auth"],[Qo,[xa,Do]],["parseURL",Va,"url"],[Lo,[{fn:zo,[Ro]:[{[ko]:"UseS3ExpressControlEndpoint"},Do]},Uo]],[Qo,[xa,Uo]],[Bo,[{fn:Zo,[Ro]:[Ra,"scheme"]},"http"]],[Yo,[Ta,Do]],["aws.parseArn",Wa,ea],[Zo,[{fn:"split",[Ro]:[xa,ta,0]},"[-2]"],"s3expressAvailabilityZoneId"],[Bo,[{fn:zo,[Ro]:[{fn:jo,[Ro]:[xa,0,4,Do]},Ho]},"arn:"]],[Bo,[{fn:zo,[Ro]:[{fn:jo,[Ro]:[xa,16,18,Uo]},Ho]},ta]],[Lo,[{fn:Zo,[Ro]:[Ra,"isIp"]},Uo]],[Bo,[{fn:zo,[Ro]:[{fn:jo,[Ro]:[xa,21,23,Uo]},Ho]},ta]],[Bo,[{fn:zo,[Ro]:[{fn:jo,[Ro]:[xa,27,29,Uo]},Ho]},ta]],[Bo,[{[ko]:Vo},"beta"]],["uriEncode",Wa,"uri_encoded_bucket"],[Yo,[Ta,Uo]],[Lo,[{fn:zo,[Ro]:[{[ko]:"UseObjectLambdaEndpoint"},Do]},Uo]],[Zo,[Pa,"resourceId[0]"],ra],[Bo,[Ia,Ho]],[Bo,[Ia,sa]],[Zo,Xa,na(1)],[Bo,[Ma,Ho]],[Bo,[Na,Ho]],[Bo,[{fn:zo,[Ro]:[{fn:jo,[Ro]:[xa,14,16,Uo]},Ho]},ta]],[Bo,[Oa,"e"]],[Bo,[Oa,"o"]],[Bo,[Ta,"aws-global"]],[Bo,[{fn:zo,[Ro]:[{fn:jo,[Ro]:[xa,19,21,Uo]},Ho]},ta]],[Bo,[$a,ia]],[Lo,[{fn:zo,[Ro]:[{[ko]:"DisableAccessPoints"},Do]},Uo]],[Bo,[$a,oa]],[qo,[Na],aa],[Yo,[Ma,Uo]],[Bo,[{fn:zo,[Ro]:[{fn:jo,[Ro]:[xa,26,28,Uo]},Ho]},ta]],[Bo,[{fn:zo,[Ro]:[{fn:jo,[Ro]:[xa,15,17,Uo]},Ho]},ta]],[Zo,[Pa,"resourceId[4]"]],[Bo,[{fn:zo,[Ro]:[{fn:jo,[Ro]:[xa,20,22,Uo]},Ho]},ta]],[Lo,[{[ko]:"UseGlobalEndpoint"},Uo]],[Bo,[Ta,ca]],[Zo,Xa,Wo(1)],[Lo,[{fn:zo,[Ro]:[{[ko]:"UseArnRegion"},Uo]},Uo]],[Yo,[{[ko]:Wo(1)},Do]],[Zo,[Pa,"resourceId[2]"],ua],[Bo,[Ta,Na]],[Bo,[{fn:Zo,[Ro]:[{[ko]:aa},da]},ka]],[Lo,[{[ko]:"DisableMultiRegionAccessPoints"},Uo]],[Yo,[Na,Uo]],[Bo,[{fn:Zo,[Ro]:[Pa,"partition"]},ka]],[Bo,[Ua,Ho]],[Bo,[$a,la]],[Yo,[Ua,Do]],[Zo,[Pa,"resourceId[3]"],na(2)],[Yo,[Ma,Do]],[Bo,[{[ko]:ua},sa]],[Yo,[{[ko]:na(2)},Do]]],results:[[$o],[$o,"Accelerate cannot be used with FIPS"],[$o,"Cannot set dual-stack in combination with a custom endpoint."],[$o,"A custom endpoint cannot be combined with FIPS"],[$o,"A custom endpoint cannot be combined with S3 Accelerate"],[$o,"Partition does not support FIPS"],[$o,"S3Express does not support S3 Accelerate."],["{url#scheme}://{url#authority}/{uri_encoded_bucket}{url#path}",Da],[ha,Da],[$o,"S3Express bucket name is not a valid virtual hostable name."],["https://s3express-control{_s3e_fips}{_s3e_ds}.{Region}.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",_a],["https://{Bucket}.s3express{_s3e_fips}-{s3expressAvailabilityZoneId}{_s3e_ds}.{Region}.{partitionResult#dnsSuffix}",Da],[$o,"Unrecognized S3Express bucket name format."],[fa,Da],["https://s3express-control{_s3e_fips}{_s3e_ds}.{Region}.{partitionResult#dnsSuffix}",_a],[$o,"Expected a endpoint to be specified but no endpoint was found"],["https://{Bucket}.ec2.{url#authority}",La],["https://{Bucket}.ec2.s3-outposts.{Region}.{partitionResult#dnsSuffix}",La],["https://{Bucket}.op-{outpostId_ssa_2}.{url#authority}",La],["https://{Bucket}.op-{outpostId_ssa_2}.s3-outposts.{Region}.{partitionResult#dnsSuffix}",La],[$o,'Unrecognized hardware type: "Expected hardware type o or e but got {hardwareType}"'],[$o,"Invalid Outposts Bucket alias - it must be a valid bucket name."],[$o,"Invalid ARN: The outpost Id must only contain a-z, A-Z, 0-9 and `-`."],[$o,"Custom endpoint `{Endpoint}` was not a valid URI"],[$o,"S3 Accelerate cannot be used in this region"],["https://{Bucket}.s3-fips.dualstack.us-east-1.{partitionResult#dnsSuffix}",Ba],["https://{Bucket}.s3-fips.dualstack.{Region}.{partitionResult#dnsSuffix}",za],["https://{Bucket}.s3-fips.us-east-1.{partitionResult#dnsSuffix}",Ba],["https://{Bucket}.s3-fips.{Region}.{partitionResult#dnsSuffix}",za],["https://{Bucket}.s3-accelerate.dualstack.us-east-1.{partitionResult#dnsSuffix}",Ba],["https://{Bucket}.s3-accelerate.dualstack.{partitionResult#dnsSuffix}",za],["https://{Bucket}.s3.dualstack.us-east-1.{partitionResult#dnsSuffix}",Ba],["https://{Bucket}.s3.dualstack.{Region}.{partitionResult#dnsSuffix}",za],[pa,Ba],[ha,Ba],[pa,za],[ha,za],[ma,Ba],[ma,za],[ga,Ba],[ga,za],["https://{Bucket}.s3.{Region}.{partitionResult#dnsSuffix}",za],[$o,"Invalid region: region was not a valid DNS name."],[$o,"S3 Object Lambda does not support Dual-stack"],[$o,"S3 Object Lambda does not support S3 Accelerate"],[$o,"Access points are not supported for this operation"],[$o,"Invalid configuration: region from ARN `{bucketArn#region}` does not match client region `{Region}` and UseArnRegion is `false`"],[$o,"Invalid ARN: Missing account id"],[ya(1),ja],["https://{accessPointName_ssa_1}-{bucketArn#accountId}.s3-object-lambda-fips.{bucketArn#region}.{bucketPartition#dnsSuffix}",ja],["https://{accessPointName_ssa_1}-{bucketArn#accountId}.s3-object-lambda.{bucketArn#region}.{bucketPartition#dnsSuffix}",ja],[$o,wa(1)],[$o,"Invalid ARN: The account id may only contain a-z, A-Z, 0-9 and `-`. Found: `{bucketArn#accountId}`"],[$o,"Invalid region in ARN: `{bucketArn#region}` (invalid DNS name)"],[$o,"Client was configured for partition `{partitionResult#name}` but ARN (`{Bucket}`) has `{bucketPartition#name}`"],[$o,"Invalid ARN: The ARN may only contain a single resource component after `accesspoint`."],[$o,"Invalid ARN: bucket ARN is missing a region"],[$o,"Invalid ARN: Expected a resource of the format `accesspoint:<accesspoint name>` but no name was provided"],[$o,"Invalid ARN: Object Lambda ARNs only support `accesspoint` arn types, but found: `{arnType}`"],[$o,"Access Points do not support S3 Accelerate"],["https://{accessPointName_ssa_1}-{bucketArn#accountId}.s3-accesspoint-fips.dualstack.{bucketArn#region}.{bucketPartition#dnsSuffix}",Ha],["https://{accessPointName_ssa_1}-{bucketArn#accountId}.s3-accesspoint-fips.{bucketArn#region}.{bucketPartition#dnsSuffix}",Ha],["https://{accessPointName_ssa_1}-{bucketArn#accountId}.s3-accesspoint.dualstack.{bucketArn#region}.{bucketPartition#dnsSuffix}",Ha],[ya(1),Ha],["https://{accessPointName_ssa_1}-{bucketArn#accountId}.s3-accesspoint.{bucketArn#region}.{bucketPartition#dnsSuffix}",Ha],[$o,"Invalid ARN: The ARN was not for the S3 service, found: {bucketArn#service}"],[$o,"S3 MRAP does not support dual-stack"],[$o,"S3 MRAP does not support FIPS"],[$o,"S3 MRAP does not support S3 Accelerate"],[$o,"Invalid configuration: Multi-Region Access Point ARNs are disabled."],["https://{accessPointName_ssa_1}.accesspoint.s3-global.{partitionResult#dnsSuffix}",{[Po]:[{[Io]:Uo,name:ba,[Mo]:la,[Oo]:["*"]}]}],[$o,"Client was configured for partition `{partitionResult#name}` but bucket referred to partition `{bucketArn#partition}`"],[$o,"Invalid Access Point Name"],[$o,"S3 Outposts does not support Dual-stack"],[$o,"S3 Outposts does not support FIPS"],[$o,"S3 Outposts does not support S3 Accelerate"],[$o,"Invalid Arn: Outpost Access Point ARN contains sub resources"],["https://{accessPointName_ssa_2}-{bucketArn#accountId}.{outpostId_ssa_1}.{url#authority}",qa],["https://{accessPointName_ssa_2}-{bucketArn#accountId}.{outpostId_ssa_1}.s3-outposts.{bucketArn#region}.{bucketPartition#dnsSuffix}",qa],[$o,wa(2)],[$o,"Expected an outpost type `accesspoint`, found {outpostType}"],[$o,"Invalid ARN: expected an access point name"],[$o,"Invalid ARN: Expected a 4-component resource"],[$o,"Invalid ARN: The outpost Id may only contain a-z, A-Z, 0-9 and `-`. Found: `{outpostId_ssa_1}`"],[$o,"Invalid ARN: The Outpost Id was not set"],[$o,"Invalid ARN: Unrecognized format: {Bucket} (type: {arnType})"],[$o,"Invalid ARN: No ARN type specified"],[$o,"Invalid ARN: `{Bucket}` was not a valid ARN"],[$o,"Path-style addressing cannot be used with ARN buckets"],["https://s3-fips.dualstack.us-east-1.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",Ba],["https://s3-fips.dualstack.{Region}.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",za],["https://s3-fips.us-east-1.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",Ba],["https://s3-fips.{Region}.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",za],["https://s3.dualstack.us-east-1.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",Ba],["https://s3.dualstack.{Region}.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",za],[Sa,Ba],[Sa,za],[va,Ba],[va,za],["https://s3.{Region}.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",za],[$o,"Path-style addressing cannot be used with S3 Accelerate"],[fa,Fa],["https://s3-object-lambda-fips.{Region}.{partitionResult#dnsSuffix}",Fa],["https://s3-object-lambda.{Region}.{partitionResult#dnsSuffix}",Fa],["https://s3-fips.dualstack.us-east-1.{partitionResult#dnsSuffix}",Ba],["https://s3-fips.dualstack.{Region}.{partitionResult#dnsSuffix}",za],["https://s3-fips.us-east-1.{partitionResult#dnsSuffix}",Ba],["https://s3-fips.{Region}.{partitionResult#dnsSuffix}",za],["https://s3.dualstack.us-east-1.{partitionResult#dnsSuffix}",Ba],["https://s3.dualstack.{Region}.{partitionResult#dnsSuffix}",za],[fa,Ba],[fa,za],[Ea,Ba],[Ea,za],["https://s3.{Region}.{partitionResult#dnsSuffix}",za],[$o,"A region must be set when sending requests to S3."]]},Ja=1e8,Qa=new Int32Array([-1,1,-1,0,3,Ja+115,1,424,4,2,272,5,3,233,6,4,85,7,5,15,8,8,9,Ja+115,16,10,13,18,11,13,19,12,13,22,Ja+14,13,35,14,Ja+42,36,Ja+103,435,6,271,16,7,270,17,8,19,18,14,501,106,9,20,24,10,21,24,11,22,24,12,23,24,13,547,24,14,77,25,20,73,26,26,27,78,37,28,Ja+86,38,Ja+86,29,39,47,30,48,Ja+58,31,50,32,Ja+85,51,33,136,55,Ja+76,34,59,35,Ja+84,60,39,36,61,37,Ja+83,62,38,146,63,41,Ja+46,61,40,Ja+83,62,41,150,64,42,Ja+54,66,43,Ja+53,70,44,Ja+52,71,45,Ja+81,73,46,Ja+80,74,Ja+78,Ja+79,40,48,Ja+57,41,Ja+57,49,42,185,50,48,62,51,49,Ja+45,52,51,53,526,60,56,54,62,Ja+55,55,63,57,Ja+46,62,Ja+55,57,64,58,Ja+54,66,59,Ja+53,69,60,Ja+65,70,61,Ja+52,72,Ja+64,Ja+51,49,Ja+45,63,51,64,526,60,67,65,62,Ja+55,66,63,68,Ja+46,62,Ja+55,68,64,69,Ja+54,66,70,Ja+53,68,Ja+47,71,70,72,Ja+52,72,Ja+50,Ja+51,25,74,Ja+42,46,Ja+39,75,57,76,Ja+41,58,Ja+40,Ja+41,26,Ja+88,78,28,Ja+87,79,34,82,80,35,81,545,36,Ja+103,Ja+115,46,Ja+97,83,57,84,Ja+99,58,Ja+98,Ja+99,5,101,86,8,87,Ja+115,16,88,89,18,91,89,19,90,92,21,97,95,19,93,92,21,98,95,21,97,94,22,Ja+14,95,35,96,Ja+42,36,Ja+103,Ja+42,22,Ja+13,98,35,99,Ja+42,36,Ja+101,100,46,Ja+110,Ja+111,6,214,102,7,208,103,8,119,104,14,118,105,21,106,Ja+23,26,107,502,37,108,Ja+86,38,Ja+86,109,39,112,110,48,Ja+58,111,50,136,Ja+85,40,113,Ja+57,41,Ja+57,114,42,115,500,48,Ja+56,116,52,117,Ja+72,65,Ja+69,Ja+72,21,501,Ja+23,9,120,124,10,121,124,11,122,124,12,123,124,13,202,124,14,195,125,20,190,126,21,127,Ja+23,23,128,129,24,189,129,26,130,197,37,131,Ja+86,38,Ja+86,132,39,159,133,48,Ja+58,134,50,135,Ja+85,51,141,136,55,Ja+76,137,59,138,Ja+84,60,Ja+83,139,61,140,Ja+83,63,Ja+83,Ja+46,55,Ja+76,142,59,143,Ja+84,60,148,144,61,145,Ja+83,62,147,146,63,150,Ja+46,63,153,Ja+46,61,149,Ja+83,62,153,150,64,151,Ja+54,66,152,Ja+53,70,Ja+82,Ja+52,64,154,Ja+54,66,155,Ja+53,70,156,Ja+52,71,157,Ja+81,73,158,Ja+80,74,Ja+77,Ja+79,40,160,Ja+57,41,Ja+57,161,42,185,162,48,174,163,49,Ja+45,164,51,165,526,60,168,166,62,Ja+55,167,63,169,Ja+46,62,Ja+55,169,64,170,Ja+54,66,171,Ja+53,69,172,Ja+65,70,173,Ja+52,72,Ja+63,Ja+51,49,Ja+45,175,51,176,526,60,179,177,62,Ja+55,178,63,180,Ja+46,62,Ja+55,180,64,181,Ja+54,66,182,Ja+53,68,Ja+47,183,70,184,Ja+52,72,Ja+48,Ja+51,48,Ja+56,186,52,187,Ja+72,65,Ja+69,188,67,Ja+70,Ja+71,25,Ja+36,Ja+42,21,191,Ja+23,25,192,Ja+42,30,194,193,46,Ja+34,Ja+36,46,Ja+33,Ja+35,21,196,Ja+23,26,Ja+88,197,28,Ja+87,198,34,201,199,35,200,545,36,Ja+101,Ja+115,46,Ja+95,Ja+96,17,203,Ja+22,20,204,Ja+21,21,205,550,33,206,550,44,Ja+16,207,45,Ja+18,Ja+20,8,209,215,16,210,220,18,211,220,19,212,224,20,213,227,21,231,401,8,218,215,19,216,Ja+9,20,217,227,21,231,Ja+9,16,219,220,18,223,220,19,221,224,20,222,227,21,231,Ja+12,19,226,224,20,225,Ja+9,21,Ja+9,Ja+12,20,230,227,21,228,Ja+9,30,229,Ja+9,34,Ja+7,Ja+9,21,231,415,30,232,Ja+8,34,Ja+7,Ja+8,4,Ja+2,234,5,235,480,6,271,236,7,270,237,8,238,491,9,239,243,10,240,243,11,241,243,12,242,243,13,547,243,14,266,244,20,264,245,26,246,267,37,247,Ja+86,38,Ja+86,248,39,249,518,40,250,Ja+57,41,Ja+57,251,42,538,252,48,Ja+43,253,49,Ja+45,254,51,255,526,60,258,256,62,Ja+55,257,63,259,Ja+46,62,Ja+55,259,64,260,Ja+54,66,261,Ja+53,69,262,Ja+65,70,263,Ja+52,72,Ja+62,Ja+51,25,265,Ja+42,46,Ja+31,Ja+32,26,Ja+88,267,28,Ja+87,268,34,269,544,46,Ja+93,Ja+94,8,397,Ja+9,8,407,Ja+9,3,346,273,4,Ja+3,274,5,284,275,8,276,Ja+115,15,Ja+5,277,16,278,281,18,279,281,19,280,281,22,Ja+14,281,35,282,Ja+42,36,Ja+102,283,46,Ja+106,Ja+107,6,405,285,7,395,286,8,295,287,14,501,288,26,289,502,37,290,Ja+86,38,Ja+86,291,39,292,307,40,293,Ja+57,41,Ja+57,294,42,335,500,9,296,300,10,297,300,11,298,300,12,299,300,13,394,300,14,339,301,15,Ja+5,302,20,337,303,26,304,341,37,305,Ja+86,38,Ja+86,306,39,309,307,48,Ja+58,308,50,Ja+74,Ja+85,40,310,Ja+57,41,Ja+57,311,42,335,312,48,324,313,49,Ja+45,314,51,315,526,60,318,316,62,Ja+55,317,63,319,Ja+46,62,Ja+55,319,64,320,Ja+54,66,321,Ja+53,69,322,Ja+65,70,323,Ja+52,72,Ja+61,Ja+51,49,Ja+45,325,51,326,526,60,329,327,62,Ja+55,328,63,330,Ja+46,62,Ja+55,330,64,331,Ja+54,66,332,Ja+53,68,Ja+47,333,70,334,Ja+52,72,Ja+49,Ja+51,48,Ja+56,336,52,Ja+67,Ja+72,25,338,Ja+42,46,Ja+27,Ja+28,15,Ja+5,340,26,Ja+88,341,28,Ja+87,342,34,345,343,35,344,545,36,Ja+102,Ja+115,46,Ja+91,Ja+92,4,Ja+2,347,5,357,348,8,349,Ja+115,15,Ja+5,350,16,351,354,18,352,354,19,353,354,22,Ja+14,354,35,355,Ja+42,36,Ja+43,356,46,Ja+104,Ja+105,6,405,358,7,395,359,8,360,491,9,361,365,10,362,365,11,363,365,12,364,365,13,394,365,14,389,366,15,Ja+5,367,20,387,368,26,369,391,37,370,Ja+86,38,Ja+86,371,39,372,518,40,373,Ja+57,41,Ja+57,374,42,538,375,48,Ja+43,376,49,Ja+45,377,51,378,526,60,381,379,62,Ja+55,380,63,382,Ja+46,62,Ja+55,382,64,383,Ja+54,66,384,Ja+53,69,385,Ja+65,70,386,Ja+52,72,Ja+60,Ja+51,25,388,Ja+42,46,Ja+25,Ja+26,15,Ja+5,390,26,Ja+88,391,28,Ja+87,392,34,393,544,46,Ja+89,Ja+90,15,Ja+5,547,8,396,Ja+9,15,Ja+5,397,16,398,410,18,399,410,19,400,410,20,401,Ja+9,27,402,Ja+12,29,Ja+11,403,31,Ja+11,404,32,Ja+11,422,8,406,Ja+9,15,Ja+5,407,16,408,410,18,409,410,19,411,410,20,Ja+12,Ja+9,20,414,412,22,413,Ja+9,34,Ja+10,Ja+9,22,416,415,27,419,Ja+12,27,418,417,34,Ja+10,Ja+12,34,Ja+10,419,43,Ja+11,420,47,Ja+11,421,53,Ja+11,422,54,Ja+11,423,56,Ja+11,Ja+12,2,Ja+1,425,3,478,426,4,Ja+4,427,5,438,428,8,429,Ja+115,16,430,433,18,431,433,19,432,433,22,Ja+14,433,35,434,Ja+42,36,Ja+44,435,46,Ja+112,436,57,437,Ja+114,58,Ja+113,Ja+114,6,Ja+6,439,7,Ja+6,440,8,450,441,14,501,442,26,443,502,37,444,Ja+86,38,Ja+86,445,39,446,465,40,447,Ja+57,41,Ja+57,448,42,471,449,48,Ja+44,500,9,451,455,10,452,455,11,453,455,12,454,455,13,547,455,14,473,456,15,460,457,20,458,461,25,459,Ja+42,46,Ja+37,Ja+38,20,540,461,26,462,474,37,463,Ja+86,38,Ja+86,464,39,467,465,48,Ja+58,466,50,Ja+75,Ja+85,40,468,Ja+57,41,Ja+57,469,42,471,470,48,Ja+44,524,48,Ja+44,472,52,Ja+68,Ja+72,26,Ja+88,474,28,Ja+87,475,34,Ja+100,476,35,477,545,36,Ja+44,Ja+115,4,Ja+2,479,5,488,480,8,481,Ja+115,16,482,485,18,483,485,19,484,485,22,Ja+14,485,35,486,Ja+42,36,Ja+43,487,46,Ja+108,Ja+109,6,Ja+6,489,7,Ja+6,490,8,503,491,14,501,492,26,493,502,37,494,Ja+86,38,Ja+86,495,39,496,518,40,497,Ja+57,41,Ja+57,498,42,538,499,48,Ja+43,500,49,Ja+45,526,26,Ja+88,502,28,Ja+87,Ja+115,9,504,508,10,505,508,11,506,508,12,507,508,13,547,508,14,541,509,15,513,510,20,511,514,25,512,Ja+42,46,Ja+29,Ja+30,20,540,514,26,515,542,37,516,Ja+86,38,Ja+86,517,39,520,518,48,Ja+58,519,50,Ja+73,Ja+85,40,521,Ja+57,41,Ja+57,522,42,538,523,48,Ja+43,524,49,Ja+45,525,51,529,526,60,Ja+55,527,62,Ja+55,528,63,Ja+55,Ja+46,60,532,530,62,Ja+55,531,63,533,Ja+46,62,Ja+55,533,64,534,Ja+54,66,535,Ja+53,69,536,Ja+65,70,537,Ja+52,72,Ja+59,Ja+51,48,Ja+43,539,52,Ja+66,Ja+72,25,Ja+24,Ja+42,26,Ja+88,542,28,Ja+87,543,34,Ja+100,544,35,546,545,36,Ja+42,Ja+115,36,Ja+43,Ja+115,17,548,Ja+22,20,549,Ja+21,33,552,550,44,Ja+17,551,45,Ja+19,Ja+20,44,Ja+15,553,45,Ja+15,Ja+20]),Za=Oe.from(Qa,2,Ya.conditions,Ya.results),ec=new class{capacity;data=/* @__PURE__ */new Map;parameters=[];constructor({size:e,params:t}){this.capacity=e??50,t&&(this.parameters=t)}get(e,t){const r=this.hash(e);if(!1===r)return t();if(!this.data.has(r)){if(this.data.size>this.capacity+10){const e=this.data.keys();let t=0;for(;;){const{value:r,done:s}=e.next();if(this.data.delete(r),s||++t>10)break}}this.data.set(r,t())}return this.data.get(r)}size(){return this.data.size}hash(e){let t="";const{parameters:r}=this;if(0===r.length)return!1;for(const s of r){const r=String(e[s]??"");if(r.includes("|;"))return!1;t+=r+"|;"}return t}}({size:50,params:["Accelerate","Bucket","DisableAccessPoints","DisableMultiRegionAccessPoints","DisableS3ExpressSessionAuth","Endpoint","ForcePathStyle","Region","UseArnRegion","UseDualStack","UseFIPS","UseGlobalEndpoint","UseObjectLambdaEndpoint","UseS3ExpressControlEndpoint"]}),tc=(e,t={})=>ec.get(e,()=>((e,t)=>{const{nodes:r,root:s,results:n,conditions:i}=e;let o=s;const a={},c={referenceRecord:a,endpointParams:t.endpointParams,logger:t.logger};for(;1!==o&&-1!==o&&o<et;){const e=3*(Math.abs(o)-1),[t,s,n]=[r[e],r[e+1],r[e+2]],[u,d,l]=i[t],h=Ge({fn:u,assign:l,argv:d},c);if(h.toAssign){const{name:e,value:t}=h.toAssign;a[e]=t}o=o>=0===h.result?s:n}if(o>=et){const e=n[o-et];if(-1===e[0]){const[,t]=e;throw new $e(Ke(t,"Error",c))}const[t,r,s]=e;return{url:Ze(t,c),properties:Ye(r,c),headers:Xe(s??{},c)}}throw new $e("No matching endpoint.")})(Za,{endpointParams:e,logger:t.logger}));De.aws=fs;const rc=(sc=async(e,t,r)=>({operation:l(t).operation,region:await h(e.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()}),async(e,t,r)=>{if(!r)throw new Error("Could not find `input` for `defaultEndpointRuleSetHttpAuthSchemeParametersProvider`");const s=await sc(e,t,r),n=l(t)?.commandInstance?.constructor?.getEndpointParameterInstructions;if(!n)throw new Error(`getEndpointParameterInstructions() is not defined on '${t.commandName}'`);const i=await Ie(r,{getEndpointParameterInstructions:n},e);return Object.assign(s,i)});var sc;function nc(e){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"s3",region:e.region},propertiesExtractor:(e,t)=>({signingProperties:{config:e,context:t}})}}function ic(e){return{schemeId:"aws.auth#sigv4a",signingProperties:{name:"s3",region:e.region},propertiesExtractor:(e,t)=>({signingProperties:{config:e,context:t}})}}const oc=(ac=tc,cc=e=>{const t=[];return e.operation,t.push(nc(e)),t.push(ic(e)),t},uc={"aws.auth#sigv4":nc,"aws.auth#sigv4a":ic},e=>{const t=ac(e),r=t.properties?.authSchemes;if(!r)return cc(e);const s=[];for(const n of r){const{name:t,properties:i={},...o}=n,a=t.toLowerCase();let c;if(t!==a&&console.warn(`HttpAuthScheme has been normalized with lowercasing: '${t}' to '${a}'`),"sigv4a"===a){c="aws.auth#sigv4a";const e=r.find(e=>{const t=e.name.toLowerCase();return"sigv4a"!==t&&t.startsWith("sigv4")});if("none"===hi.sigv4aDependency()&&e)continue}else{if(!a.startsWith("sigv4"))throw new Error(`Unknown HttpAuthScheme found in '@smithy.rules#endpointRuleSet': '${a}'`);c="aws.auth#sigv4"}const u=uc[c];if(!u)throw new Error(`Could not find HttpAuthOption create function for '${c}'`);const d=u(e);d.schemeId=c,d.signingProperties={...d.signingProperties||{},...o,...i},s.push(d)}return s});var ac,cc,uc;const dc=e=>{const t=(e=>(e.sigv4aSigningRegionSet=Yr(e.sigv4aSigningRegionSet),e))(xo(e));return Object.assign(t,{authSchemePreference:h(e.authSchemePreference??[])})},lc={ForcePathStyle:{type:"clientContextParams",name:"forcePathStyle"},UseArnRegion:{type:"clientContextParams",name:"useArnRegion"},DisableMultiRegionAccessPoints:{type:"clientContextParams",name:"disableMultiregionAccessPoints"},Accelerate:{type:"clientContextParams",name:"useAccelerateEndpoint"},DisableS3ExpressSessionAuth:{type:"clientContextParams",name:"disableS3ExpressSessionAuth"},UseGlobalEndpoint:{type:"builtInParams",name:"useGlobalEndpoint"},UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}};class hc extends ir{constructor(e){super(e),Object.setPrototypeOf(this,hc.prototype)}}class fc extends hc{name="NoSuchUpload";$fault="client";constructor(e){super({name:"NoSuchUpload",$fault:"client",...e}),Object.setPrototypeOf(this,fc.prototype)}}class pc extends hc{name="AccessDenied";$fault="client";constructor(e){super({name:"AccessDenied",$fault:"client",...e}),Object.setPrototypeOf(this,pc.prototype)}}class mc extends hc{name="ObjectNotInActiveTierError";$fault="client";constructor(e){super({name:"ObjectNotInActiveTierError",$fault:"client",...e}),Object.setPrototypeOf(this,mc.prototype)}}class gc extends hc{name="BucketAlreadyExists";$fault="client";constructor(e){super({name:"BucketAlreadyExists",$fault:"client",...e}),Object.setPrototypeOf(this,gc.prototype)}}class yc extends hc{name="BucketAlreadyOwnedByYou";$fault="client";constructor(e){super({name:"BucketAlreadyOwnedByYou",$fault:"client",...e}),Object.setPrototypeOf(this,yc.prototype)}}class wc extends hc{name="NoSuchBucket";$fault="client";constructor(e){super({name:"NoSuchBucket",$fault:"client",...e}),Object.setPrototypeOf(this,wc.prototype)}}class bc extends hc{name="InvalidObjectState";$fault="client";StorageClass;AccessTier;constructor(e){super({name:"InvalidObjectState",$fault:"client",...e}),Object.setPrototypeOf(this,bc.prototype),this.StorageClass=e.StorageClass,this.AccessTier=e.AccessTier}}class Sc extends hc{name="NoSuchKey";$fault="client";constructor(e){super({name:"NoSuchKey",$fault:"client",...e}),Object.setPrototypeOf(this,Sc.prototype)}}class vc extends hc{name="NotFound";$fault="client";constructor(e){super({name:"NotFound",$fault:"client",...e}),Object.setPrototypeOf(this,vc.prototype)}}class Ec extends hc{name="EncryptionTypeMismatch";$fault="client";constructor(e){super({name:"EncryptionTypeMismatch",$fault:"client",...e}),Object.setPrototypeOf(this,Ec.prototype)}}class Cc extends hc{name="InvalidRequest";$fault="client";constructor(e){super({name:"InvalidRequest",$fault:"client",...e}),Object.setPrototypeOf(this,Cc.prototype)}}class Ac extends hc{name="InvalidWriteOffset";$fault="client";constructor(e){super({name:"InvalidWriteOffset",$fault:"client",...e}),Object.setPrototypeOf(this,Ac.prototype)}}class xc extends hc{name="TooManyParts";$fault="client";constructor(e){super({name:"TooManyParts",$fault:"client",...e}),Object.setPrototypeOf(this,xc.prototype)}}class kc extends hc{name="IdempotencyParameterMismatch";$fault="client";constructor(e){super({name:"IdempotencyParameterMismatch",$fault:"client",...e}),Object.setPrototypeOf(this,kc.prototype)}}class Rc extends hc{name="ObjectAlreadyInActiveTierError";$fault="client";constructor(e){super({name:"ObjectAlreadyInActiveTierError",$fault:"client",...e}),Object.setPrototypeOf(this,Rc.prototype)}}const Tc="AccessKeyId",Pc="Bucket",Ic="BypassGovernanceRetention",Mc="BucketKeyEnabled",Nc="Body",Oc="ChecksumAlgorithm",$c="CacheControl",Uc="ChecksumCRC32",Dc="ChecksumCRC32C",_c="ChecksumCRC64NVME",Lc="Cache-Control",Bc="Content-Disposition",zc="ContentDisposition",jc="Content-Encoding",Hc="ContentEncoding",qc="ContentLanguage",Fc="Content-Language",Kc="Content-Length",Vc="ContentLength",Wc="ChecksumMD5",Gc="CopyObjectResult",Xc="ChecksumSHA1",Yc="ChecksumSHA256",Jc="ChecksumSHA512",Qc="CopySourceSSECustomerKey",Zc="ChecksumType",eu="Content-Type",tu="ContentType",ru="ContinuationToken",su="ChecksumXXHASH64",nu="ChecksumXXHASH3",iu="ChecksumXXHASH128",ou="Credentials",au="DeleteMarker",cu="Delete",uu="Delimiter",du="Expiration",lu="ExpectedBucketOwner",hu="ExpiresString",fu="ETag",pu="EncodingType",mu="Errors",gu="Error",yu="Expires",wu="GrantFullControl",bu="GrantRead",Su="GrantReadACP",vu="GrantWriteACP",Eu="IfMatch",Cu="If-Match",Au="IfNoneMatch",xu="If-None-Match",ku="Key",Ru="LastModified",Tu="Metadata",Pu="MaxKeys",Iu="Owner",Mu="ObjectLockLegalHoldStatus",Nu="ObjectLockMode",Ou="ObjectLockRetainUntilDate",$u="Object",Uu="Prefix",Du="RequestCharged",_u="RequestPayer",Lu="RestoreStatus",Bu="Range",zu="StartAfter",ju="SecretAccessKey",Hu="StorageClass",qu="ServerSideEncryption",Fu="SSECustomerAlgorithm",Ku="SSECustomerKey",Vu="SSECustomerKeyMD5",Wu="SSEKMSEncryptionContext",Gu="SSEKMSKeyId",Xu="SessionToken",Yu="Size",Ju="Tagging",Qu="VersionId",Zu="WebsiteRedirectLocation",ed="client",td="error",rd="http",sd="httpChecksum",nd="httpError",id="httpHeader",od="httpPayload",ad="httpPrefixHeaders",cd="httpQuery",ud="smithy.ts.sdk.synthetic.com.amazonaws.s3",dd="streaming",ld="versionId",hd="xmlFlattened",fd="xmlName",pd="x-amz-acl",md="x-amz-bypass-governance-retention",gd="x-amz-checksum-crc32",yd="x-amz-checksum-crc32c",wd="x-amz-checksum-crc64nvme",bd="x-amz-checksum-md5",Sd="x-amz-checksum-sha1",vd="x-amz-checksum-sha256",Ed="x-amz-checksum-sha512",Cd="x-amz-checksum-type",Ad="x-amz-checksum-xxhash64",xd="x-amz-checksum-xxhash3",kd="x-amz-checksum-xxhash128",Rd="x-amz-delete-marker",Td="x-amz-expiration",Pd="x-amz-expected-bucket-owner",Id="x-amz-grant-full-control",Md="x-amz-grant-read",Nd="x-amz-grant-read-acp",Od="x-amz-grant-write-acp",$d="x-amz-meta-",Ud="x-amz-mfa",Dd="x-amz-object-lock-legal-hold",_d="x-amz-object-lock-mode",Ld="x-amz-object-lock-retain-until-date",Bd="x-amz-request-charged",zd="x-amz-request-payer",jd="x-amz-storage-class",Hd="x-amz-sdk-checksum-algorithm",qd="x-amz-server-side-encryption",Fd="x-amz-server-side-encryption-aws-kms-key-id",Kd="x-amz-server-side-encryption-bucket-key-enabled",Vd="x-amz-server-side-encryption-context",Wd="x-amz-server-side-encryption-customer-algorithm",Gd="x-amz-server-side-encryption-customer-key",Xd="x-amz-server-side-encryption-customer-key-MD5",Yd="x-amz-tagging",Jd="x-amz-version-id",Qd="x-amz-website-redirect-location",Zd="com.amazonaws.s3",el=er.for(ud);var tl=[-3,ud,"S3ServiceException",0,[],[]];el.registerError(tl,hc);const rl=er.for(Zd);var sl=[-3,Zd,"AccessDenied",{[td]:ed,[nd]:403},[],[]];rl.registerError(sl,pc);var nl=[-3,Zd,"BucketAlreadyExists",{[td]:ed,[nd]:409},[],[]];rl.registerError(nl,gc);var il=[-3,Zd,"BucketAlreadyOwnedByYou",{[td]:ed,[nd]:409},[],[]];rl.registerError(il,yc);var ol=[-3,Zd,"EncryptionTypeMismatch",{[td]:ed,[nd]:400},[],[]];rl.registerError(ol,Ec);var al=[-3,Zd,"IdempotencyParameterMismatch",{[td]:ed,[nd]:400},[],[]];rl.registerError(al,kc);var cl=[-3,Zd,"InvalidObjectState",{[td]:ed,[nd]:403},[Hu,"AccessTier"],[0,0]];rl.registerError(cl,bc);var ul=[-3,Zd,"InvalidRequest",{[td]:ed,[nd]:400},[],[]];rl.registerError(ul,Cc);var dl=[-3,Zd,"InvalidWriteOffset",{[td]:ed,[nd]:400},[],[]];rl.registerError(dl,Ac);var ll=[-3,Zd,"NoSuchBucket",{[td]:ed,[nd]:404},[],[]];rl.registerError(ll,wc);var hl=[-3,Zd,"NoSuchKey",{[td]:ed,[nd]:404},[],[]];rl.registerError(hl,Sc);var fl=[-3,Zd,"NoSuchUpload",{[td]:ed,[nd]:404},[],[]];rl.registerError(fl,fc);var pl=[-3,Zd,"NotFound",{[td]:ed},[],[]];rl.registerError(pl,vc);var ml=[-3,Zd,"ObjectAlreadyInActiveTierError",{[td]:ed,[nd]:403},[],[]];rl.registerError(ml,Rc);var gl=[-3,Zd,"ObjectNotInActiveTierError",{[td]:ed,[nd]:403},[],[]];rl.registerError(gl,mc);var yl=[-3,Zd,"TooManyParts",{[td]:ed,[nd]:400},[],[]];rl.registerError(yl,xc);const wl=[el,rl];var bl=[0,Zd,Qc,8,0],Sl=[0,Zd,"SessionCredentialValue",8,0],vl=[0,Zd,Ku,8,0],El=[0,Zd,Wu,8,0],Cl=[0,Zd,Gu,8,0],Al=[0,Zd,"StreamingBlob",{[dd]:1},42],xl=[3,Zd,"CommonPrefix",0,[Uu],[0]],kl=[3,Zd,"CopyObjectOutput",0,[Gc,du,"CopySourceVersionId",Qu,qu,Fu,Vu,Gu,Wu,Mc,Du],[[()=>Tl,16],[0,{[id]:Td}],[0,{[id]:"x-amz-copy-source-version-id"}],[0,{[id]:Jd}],[0,{[id]:qd}],[0,{[id]:Wd}],[0,{[id]:Xd}],[()=>Cl,{[id]:Fd}],[()=>El,{[id]:Vd}],[2,{[id]:Kd}],[0,{[id]:Bd}]]],Rl=[3,Zd,"CopyObjectRequest",0,[Pc,"CopySource",ku,"ACL",$c,Oc,zc,Hc,qc,tu,"CopySourceIfMatch","CopySourceIfModifiedSince","CopySourceIfNoneMatch","CopySourceIfUnmodifiedSince",yu,wu,bu,Su,vu,Eu,Au,Tu,"MetadataDirective","TaggingDirective",qu,Hu,Zu,Fu,Ku,Vu,Gu,Wu,Mc,"CopySourceSSECustomerAlgorithm",Qc,"CopySourceSSECustomerKeyMD5",_u,Ju,Nu,Ou,Mu,lu,"ExpectedSourceBucketOwner"],[[0,1],[0,{[id]:"x-amz-copy-source"}],[0,1],[0,{[id]:pd}],[0,{[id]:Lc}],[0,{[id]:"x-amz-checksum-algorithm"}],[0,{[id]:Bc}],[0,{[id]:jc}],[0,{[id]:Fc}],[0,{[id]:eu}],[0,{[id]:"x-amz-copy-source-if-match"}],[4,{[id]:"x-amz-copy-source-if-modified-since"}],[0,{[id]:"x-amz-copy-source-if-none-match"}],[4,{[id]:"x-amz-copy-source-if-unmodified-since"}],[4,{[id]:yu}],[0,{[id]:Id}],[0,{[id]:Md}],[0,{[id]:Nd}],[0,{[id]:Od}],[0,{[id]:Cu}],[0,{[id]:xu}],[128,{[ad]:$d}],[0,{[id]:"x-amz-metadata-directive"}],[0,{[id]:"x-amz-tagging-directive"}],[0,{[id]:qd}],[0,{[id]:jd}],[0,{[id]:Qd}],[0,{[id]:Wd}],[()=>vl,{[id]:Gd}],[0,{[id]:Xd}],[()=>Cl,{[id]:Fd}],[()=>El,{[id]:Vd}],[2,{[id]:Kd}],[0,{[id]:"x-amz-copy-source-server-side-encryption-customer-algorithm"}],[()=>bl,{[id]:"x-amz-copy-source-server-side-encryption-customer-key"}],[0,{[id]:"x-amz-copy-source-server-side-encryption-customer-key-MD5"}],[0,{[id]:zd}],[0,{[id]:Yd}],[0,{[id]:_d}],[5,{[id]:Ld}],[0,{[id]:Dd}],[0,{[id]:Pd}],[0,{[id]:"x-amz-source-expected-bucket-owner"}]],3],Tl=[3,Zd,Gc,0,[fu,Ru,Zc,Uc,Dc,_c,Xc,Yc,Jc,Wc,su,nu,iu],[0,4,0,0,0,0,0,0,0,0,0,0,0]],Pl=[3,Zd,"CreateSessionOutput",{[fd]:"CreateSessionResult"},[ou,qu,Gu,Wu,Mc],[[()=>Gl,{[fd]:ou}],[0,{[id]:qd}],[()=>Cl,{[id]:Fd}],[()=>El,{[id]:Vd}],[2,{[id]:Kd}]],1],Il=[3,Zd,"CreateSessionRequest",0,[Pc,"SessionMode",qu,Gu,Wu,Mc],[[0,1],[0,{[id]:"x-amz-create-session-mode"}],[0,{[id]:qd}],[()=>Cl,{[id]:Fd}],[()=>El,{[id]:Vd}],[2,{[id]:Kd}]],1],Ml=[3,Zd,cu,0,["Objects","Quiet"],[[()=>Ql,{[hd]:1,[fd]:$u}],2],1],Nl=[3,Zd,"DeletedObject",0,[ku,Qu,au,"DeleteMarkerVersionId"],[0,0,2,0]],Ol=[3,Zd,"DeleteObjectOutput",0,[au,Qu,Du],[[2,{[id]:Rd}],[0,{[id]:Jd}],[0,{[id]:Bd}]]],$l=[3,Zd,"DeleteObjectRequest",0,[Pc,ku,"MFA",Qu,_u,Ic,lu,Eu,"IfMatchLastModifiedTime","IfMatchSize"],[[0,1],[0,1],[0,{[id]:Ud}],[0,{[cd]:ld}],[0,{[id]:zd}],[2,{[id]:md}],[0,{[id]:Pd}],[0,{[id]:Cu}],[6,{[id]:"x-amz-if-match-last-modified-time"}],[1,{[id]:"x-amz-if-match-size"}]],2],Ul=[3,Zd,"DeleteObjectsOutput",{[fd]:"DeleteResult"},["Deleted",Du,mu],[[()=>Yl,{[hd]:1}],[0,{[id]:Bd}],[()=>Jl,{[hd]:1,[fd]:gu}]]],Dl=[3,Zd,"DeleteObjectsRequest",0,[Pc,cu,"MFA",_u,Ic,lu,Oc],[[0,1],[()=>Ml,{[od]:1,[fd]:cu}],[0,{[id]:Ud}],[0,{[id]:zd}],[2,{[id]:md}],[0,{[id]:Pd}],[0,{[id]:Hd}]],2],_l=[3,Zd,gu,0,[ku,Qu,"Code","Message"],[0,0,0,0]],Ll=[3,Zd,"GetObjectOutput",0,[Nc,au,"AcceptRanges",du,"Restore",Ru,Vc,fu,Uc,Dc,_c,Xc,Yc,Jc,Wc,su,nu,iu,Zc,"MissingMeta",Qu,$c,zc,Hc,qc,"ContentRange",tu,yu,hu,Zu,qu,Tu,Fu,Vu,Gu,Mc,Hu,Du,"ReplicationStatus","PartsCount","TagCount",Nu,Ou,Mu],[[()=>Al,16],[2,{[id]:Rd}],[0,{[id]:"accept-ranges"}],[0,{[id]:Td}],[0,{[id]:"x-amz-restore"}],[4,{[id]:"Last-Modified"}],[1,{[id]:Kc}],[0,{[id]:fu}],[0,{[id]:gd}],[0,{[id]:yd}],[0,{[id]:wd}],[0,{[id]:Sd}],[0,{[id]:vd}],[0,{[id]:Ed}],[0,{[id]:bd}],[0,{[id]:Ad}],[0,{[id]:xd}],[0,{[id]:kd}],[0,{[id]:Cd}],[1,{[id]:"x-amz-missing-meta"}],[0,{[id]:Jd}],[0,{[id]:Lc}],[0,{[id]:Bc}],[0,{[id]:jc}],[0,{[id]:Fc}],[0,{[id]:"Content-Range"}],[0,{[id]:eu}],[4,{[id]:yu}],[0,{[id]:hu}],[0,{[id]:Qd}],[0,{[id]:qd}],[128,{[ad]:$d}],[0,{[id]:Wd}],[0,{[id]:Xd}],[()=>Cl,{[id]:Fd}],[2,{[id]:Kd}],[0,{[id]:jd}],[0,{[id]:Bd}],[0,{[id]:"x-amz-replication-status"}],[1,{[id]:"x-amz-mp-parts-count"}],[1,{[id]:"x-amz-tagging-count"}],[0,{[id]:_d}],[5,{[id]:Ld}],[0,{[id]:Dd}]]],Bl=[3,Zd,"GetObjectRequest",0,[Pc,ku,Eu,"IfModifiedSince",Au,"IfUnmodifiedSince",Bu,"ResponseCacheControl","ResponseContentDisposition","ResponseContentEncoding","ResponseContentLanguage","ResponseContentType","ResponseExpires",Qu,Fu,Ku,Vu,_u,"PartNumber",lu,"ChecksumMode"],[[0,1],[0,1],[0,{[id]:Cu}],[4,{[id]:"If-Modified-Since"}],[0,{[id]:xu}],[4,{[id]:"If-Unmodified-Since"}],[0,{[id]:Bu}],[0,{[cd]:"response-cache-control"}],[0,{[cd]:"response-content-disposition"}],[0,{[cd]:"response-content-encoding"}],[0,{[cd]:"response-content-language"}],[0,{[cd]:"response-content-type"}],[6,{[cd]:"response-expires"}],[0,{[cd]:ld}],[0,{[id]:Wd}],[()=>vl,{[id]:Gd}],[0,{[id]:Xd}],[0,{[id]:zd}],[1,{[cd]:"partNumber"}],[0,{[id]:Pd}],[0,{[id]:"x-amz-checksum-mode"}]],2],zl=[3,Zd,"ListObjectsV2Output",{[fd]:"ListBucketResult"},["IsTruncated","Contents","Name",Uu,uu,Pu,"CommonPrefixes",pu,"KeyCount",ru,"NextContinuationToken",zu,Du],[2,[()=>Zl,{[hd]:1}],0,0,0,1,[()=>Xl,{[hd]:1}],0,1,0,0,0,[0,{[id]:Bd}]]],jl=[3,Zd,"ListObjectsV2Request",0,[Pc,uu,pu,Pu,Uu,ru,"FetchOwner",zu,_u,lu,"OptionalObjectAttributes"],[[0,1],[0,{[cd]:"delimiter"}],[0,{[cd]:"encoding-type"}],[1,{[cd]:"max-keys"}],[0,{[cd]:"prefix"}],[0,{[cd]:"continuation-token"}],[2,{[cd]:"fetch-owner"}],[0,{[cd]:"start-after"}],[0,{[id]:zd}],[0,{[id]:Pd}],[64,{[id]:"x-amz-optional-object-attributes"}]],1],Hl=[3,Zd,$u,0,[ku,Ru,fu,Oc,Zc,Yu,Hu,Iu,Lu],[0,4,0,[64,{[hd]:1}],0,1,0,()=>Fl,()=>Wl]],ql=[3,Zd,"ObjectIdentifier",0,[ku,Qu,fu,"LastModifiedTime",Yu],[0,0,0,6,1],1],Fl=[3,Zd,Iu,0,["DisplayName","ID"],[0,0]],Kl=[3,Zd,"PutObjectOutput",0,[du,fu,Uc,Dc,_c,Xc,Yc,Jc,Wc,su,nu,iu,Zc,qu,Qu,Fu,Vu,Gu,Wu,Mc,Yu,Du],[[0,{[id]:Td}],[0,{[id]:fu}],[0,{[id]:gd}],[0,{[id]:yd}],[0,{[id]:wd}],[0,{[id]:Sd}],[0,{[id]:vd}],[0,{[id]:Ed}],[0,{[id]:bd}],[0,{[id]:Ad}],[0,{[id]:xd}],[0,{[id]:kd}],[0,{[id]:Cd}],[0,{[id]:qd}],[0,{[id]:Jd}],[0,{[id]:Wd}],[0,{[id]:Xd}],[()=>Cl,{[id]:Fd}],[()=>El,{[id]:Vd}],[2,{[id]:Kd}],[1,{[id]:"x-amz-object-size"}],[0,{[id]:Bd}]]],Vl=[3,Zd,"PutObjectRequest",0,[Pc,ku,"ACL",Nc,$c,zc,Hc,qc,Vc,"ContentMD5",tu,Oc,Uc,Dc,_c,Xc,Yc,Jc,Wc,su,nu,iu,yu,Eu,Au,wu,bu,Su,vu,"WriteOffsetBytes",Tu,qu,Hu,Zu,Fu,Ku,Vu,Gu,Wu,Mc,_u,Ju,Nu,Ou,Mu,lu],[[0,1],[0,1],[0,{[id]:pd}],[()=>Al,16],[0,{[id]:Lc}],[0,{[id]:Bc}],[0,{[id]:jc}],[0,{[id]:Fc}],[1,{[id]:Kc}],[0,{[id]:"Content-MD5"}],[0,{[id]:eu}],[0,{[id]:Hd}],[0,{[id]:gd}],[0,{[id]:yd}],[0,{[id]:wd}],[0,{[id]:Sd}],[0,{[id]:vd}],[0,{[id]:Ed}],[0,{[id]:bd}],[0,{[id]:Ad}],[0,{[id]:xd}],[0,{[id]:kd}],[4,{[id]:yu}],[0,{[id]:Cu}],[0,{[id]:xu}],[0,{[id]:Id}],[0,{[id]:Md}],[0,{[id]:Nd}],[0,{[id]:Od}],[1,{[id]:"x-amz-write-offset-bytes"}],[128,{[ad]:$d}],[0,{[id]:qd}],[0,{[id]:jd}],[0,{[id]:Qd}],[0,{[id]:Wd}],[()=>vl,{[id]:Gd}],[0,{[id]:Xd}],[()=>Cl,{[id]:Fd}],[()=>El,{[id]:Vd}],[2,{[id]:Kd}],[0,{[id]:zd}],[0,{[id]:Yd}],[0,{[id]:_d}],[5,{[id]:Ld}],[0,{[id]:Dd}],[0,{[id]:Pd}]],2],Wl=[3,Zd,Lu,0,["IsRestoreInProgress","RestoreExpiryDate"],[2,4]],Gl=[3,Zd,"SessionCredentials",0,[Tc,ju,Xu,du],[[0,{[fd]:Tc}],[()=>Sl,{[fd]:ju}],[()=>Sl,{[fd]:Xu}],[4,{[fd]:du}]],4],Xl=[1,Zd,"CommonPrefixList",0,()=>xl],Yl=[1,Zd,"DeletedObjects",0,()=>Nl],Jl=[1,Zd,mu,0,()=>_l],Ql=[1,Zd,"ObjectIdentifierList",0,()=>ql],Zl=[1,Zd,"ObjectList",0,[()=>Hl,0]],eh=[9,Zd,"CopyObject",{[rd]:["PUT","/{Key+}?x-id=CopyObject",200]},()=>Rl,()=>kl],th=[9,Zd,"CreateSession",{[rd]:["GET","/?session",200]},()=>Il,()=>Pl],rh=[9,Zd,"DeleteObject",{[rd]:["DELETE","/{Key+}?x-id=DeleteObject",204]},()=>$l,()=>Ol],sh=[9,Zd,"DeleteObjects",{[sd]:"-",[rd]:["POST","/?delete",200]},()=>Dl,()=>Ul],nh=[9,Zd,"GetObject",{[sd]:"-",[rd]:["GET","/{Key+}?x-id=GetObject",200]},()=>Bl,()=>Ll],ih=[9,Zd,"ListObjectsV2",{[rd]:["GET","/?list-type=2",200]},()=>jl,()=>zl],oh=[9,Zd,"PutObject",{[sd]:"-",[rd]:["PUT","/{Key+}?x-id=PutObject",200]},()=>Vl,()=>Kl];class ah extends(sr.classBuilder().ep({...lc,DisableS3ExpressSessionAuth:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function(e,t,r,s){return[st(r,e.getEndpointParameterInstructions()),Ci(r)]}).s("AmazonS3","CreateSession",{}).n("S3Client","CreateSessionCommand").sc(th).build()){}const ch="3.1053.0";function uh(e){return"string"==typeof e?0===e.length:0===e.byteLength}var dh={name:"SHA-1"},lh={name:"HMAC",hash:dh},hh=new Uint8Array([218,57,163,238,94,107,75,13,50,85,191,239,149,96,24,144,175,216,7,9]);const fh={};function ph(){return"undefined"!=typeof window?window:"undefined"!=typeof self?self:fh}var mh=function(){function e(e){this.toHash=new Uint8Array(0),void 0!==e&&(this.key=new Promise(function(t,r){ph().crypto.subtle.importKey("raw",gh(e),lh,!1,["sign"]).then(t,r)}),this.key.catch(function(){}))}return e.prototype.update=function(e){if(!uh(e)){var t=gh(e),r=new Uint8Array(this.toHash.byteLength+t.byteLength);r.set(this.toHash,0),r.set(t,this.toHash.byteLength),this.toHash=r}},e.prototype.digest=function(){var e=this;return this.key?this.key.then(function(t){return ph().crypto.subtle.sign(lh,t,e.toHash).then(function(e){return new Uint8Array(e)})}):uh(this.toHash)?Promise.resolve(hh):Promise.resolve().then(function(){return ph().crypto.subtle.digest(dh,e.toHash)}).then(function(e){return Promise.resolve(new Uint8Array(e))})},e.prototype.reset=function(){this.toHash=new Uint8Array(0)},e}();function gh(e){return"string"==typeof e?Ls(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e)}var yh=["decrypt","digest","encrypt","exportKey","generateKey","importKey","sign","verify"];function wh(e){return!(!function(e){if("object"==typeof e&&"object"==typeof e.crypto){return"function"==typeof e.crypto.getRandomValues}return!1}(e)||"object"!=typeof e.crypto.subtle)&&function(e){return e&&yh.every(function(t){return"function"==typeof e[t]})}(e.crypto.subtle)}var bh=function(){function e(e){if(!wh(ph()))throw new Error("SHA1 not supported");this.hash=new mh(e)}return e.prototype.update=function(e,t){this.hash.update(zs(e))},e.prototype.digest=function(){return this.hash.digest()},e.prototype.reset=function(){this.hash.reset()},e}(),Sh={name:"SHA-256"},vh={name:"HMAC",hash:Sh},Eh=new Uint8Array([227,176,196,66,152,252,28,20,154,251,244,200,153,111,185,36,39,174,65,228,100,155,147,76,164,149,153,27,120,82,184,85]),Ch=function(){function e(e){this.toHash=new Uint8Array(0),this.secret=e,this.reset()}return e.prototype.update=function(e){if(!js(e)){var t=zs(e),r=new Uint8Array(this.toHash.byteLength+t.byteLength);r.set(this.toHash,0),r.set(t,this.toHash.byteLength),this.toHash=r}},e.prototype.digest=function(){var e=this;return this.key?this.key.then(function(t){return ph().crypto.subtle.sign(vh,t,e.toHash).then(function(e){return new Uint8Array(e)})}):js(this.toHash)?Promise.resolve(Eh):Promise.resolve().then(function(){return ph().crypto.subtle.digest(Sh,e.toHash)}).then(function(e){return Promise.resolve(new Uint8Array(e))})},e.prototype.reset=function(){var e=this;this.toHash=new Uint8Array(0),this.secret&&void 0!==this.secret&&(this.key=new Promise(function(t,r){ph().crypto.subtle.importKey("raw",zs(e.secret),vh,!1,["sign"]).then(t,r)}),this.key.catch(function(){}))},e}(),Ah=64,xh=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),kh=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],Rh=Math.pow(2,53)-1,Th=function(){function e(){this.state=Int32Array.from(kh),this.temp=new Int32Array(64),this.buffer=new Uint8Array(64),this.bufferLength=0,this.bytesHashed=0,this.finished=!1}return e.prototype.update=function(e){if(this.finished)throw new Error("Attempted to update an already finished hash.");var t=0,r=e.byteLength;if(this.bytesHashed+=r,8*this.bytesHashed>Rh)throw new Error("Cannot hash more than 2^53 - 1 bits");for(;r>0;)this.buffer[this.bufferLength++]=e[t++],r--,this.bufferLength===Ah&&(this.hashBuffer(),this.bufferLength=0)},e.prototype.digest=function(){if(!this.finished){var e=8*this.bytesHashed,t=new DataView(this.buffer.buffer,this.buffer.byteOffset,this.buffer.byteLength),r=this.bufferLength;if(t.setUint8(this.bufferLength++,128),r%Ah>=56){for(var s=this.bufferLength;s<Ah;s++)t.setUint8(s,0);this.hashBuffer(),this.bufferLength=0}for(s=this.bufferLength;s<56;s++)t.setUint8(s,0);t.setUint32(56,Math.floor(e/4294967296),!0),t.setUint32(60,e),this.hashBuffer(),this.finished=!0}var n=new Uint8Array(32);for(s=0;s<8;s++)n[4*s]=this.state[s]>>>24&255,n[4*s+1]=this.state[s]>>>16&255,n[4*s+2]=this.state[s]>>>8&255,n[4*s+3]=this.state[s]>>>0&255;return n},e.prototype.hashBuffer=function(){for(var e=this.buffer,t=this.state,r=t[0],s=t[1],n=t[2],i=t[3],o=t[4],a=t[5],c=t[6],u=t[7],d=0;d<Ah;d++){if(d<16)this.temp[d]=(255&e[4*d])<<24|(255&e[4*d+1])<<16|(255&e[4*d+2])<<8|255&e[4*d+3];else{var l=this.temp[d-2],h=(l>>>17|l<<15)^(l>>>19|l<<13)^l>>>10,f=((l=this.temp[d-15])>>>7|l<<25)^(l>>>18|l<<14)^l>>>3;this.temp[d]=(h+this.temp[d-7]|0)+(f+this.temp[d-16]|0)}var p=(((o>>>6|o<<26)^(o>>>11|o<<21)^(o>>>25|o<<7))+(o&a^~o&c)|0)+(u+(xh[d]+this.temp[d]|0)|0)|0,m=((r>>>2|r<<30)^(r>>>13|r<<19)^(r>>>22|r<<10))+(r&s^r&n^s&n)|0;u=c,c=a,a=o,o=i+p|0,i=n,n=s,s=r,r=p+m|0}t[0]+=r,t[1]+=s,t[2]+=n,t[3]+=i,t[4]+=o,t[5]+=a,t[6]+=c,t[7]+=u},e}(),Ph=function(){function e(e){this.secret=e,this.hash=new Th,this.reset()}return e.prototype.update=function(e){if(!js(e)&&!this.error)try{this.hash.update(zs(e))}catch(t){this.error=t}},e.prototype.digestSync=function(){if(this.error)throw this.error;return this.outer?(this.outer.finished||this.outer.update(this.hash.digest()),this.outer.digest()):this.hash.digest()},e.prototype.digest=function(){return Us(this,void 0,void 0,function(){return Ds(this,function(e){return[2,this.digestSync()]})})},e.prototype.reset=function(){if(this.hash=new Th,this.secret){this.outer=new Th;var e=function(e){var t=zs(e);if(t.byteLength>Ah){var r=new Th;r.update(t),t=r.digest()}var s=new Uint8Array(Ah);return s.set(t),s}(this.secret),t=new Uint8Array(Ah);t.set(e);for(var r=0;r<Ah;r++)e[r]^=54,t[r]^=92;this.hash.update(e),this.outer.update(t);for(r=0;r<e.byteLength;r++)e[r]=0}},e}();var Ih=function(){function e(e){wh(ph())?this.hash=new Ch(e):this.hash=new Ph(e)}return e.prototype.update=function(e,t){this.hash.update(zs(e))},e.prototype.digest=function(){return this.hash.digest()},e.prototype.reset=function(){this.hash.reset()},e}();const Mh=async function(e,t){const r=new e;return await async function(e,t,r=1048576){const s=e.size;let n=0;for(;n<s;){const i=e.slice(n,Math.min(s,n+r));t(new Uint8Array(await i.arrayBuffer())),n+=i.size}}(t,e=>{r.update(e)}),r.digest()},Nh=64,Oh=[1732584193,4023233417,2562383102,271733878];class $h{state;buffer;bufferLength;bytesHashed;finished;constructor(){this.reset()}update(e){if(function(e){if("string"==typeof e)return 0===e.length;return 0===e.byteLength}(e))return;if(this.finished)throw new Error("Attempted to update an already finished hash.");const t=function(e){if("string"==typeof e)return b(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT);return new Uint8Array(e)}(e);let r=0,{byteLength:s}=t;for(this.bytesHashed+=s;s>0;)this.buffer.setUint8(this.bufferLength++,t[r++]),s--,this.bufferLength===Nh&&(this.hashBuffer(),this.bufferLength=0)}async digest(){if(!this.finished){const{buffer:e,bufferLength:t,bytesHashed:r}=this,s=8*r;if(e.setUint8(this.bufferLength++,128),t%Nh>=56){for(let t=this.bufferLength;t<Nh;t++)e.setUint8(t,0);this.hashBuffer(),this.bufferLength=0}for(let n=this.bufferLength;n<56;n++)e.setUint8(n,0);e.setUint32(56,s>>>0,!0),e.setUint32(60,Math.floor(s/4294967296),!0),this.hashBuffer(),this.finished=!0}const e=new DataView(new ArrayBuffer(16));for(let t=0;t<4;t++)e.setUint32(4*t,this.state[t],!0);return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}hashBuffer(){const{buffer:e,state:t}=this;let r=t[0],s=t[1],n=t[2],i=t[3];r=Dh(r,s,n,i,e.getUint32(0,!0),7,3614090360),i=Dh(i,r,s,n,e.getUint32(4,!0),12,3905402710),n=Dh(n,i,r,s,e.getUint32(8,!0),17,606105819),s=Dh(s,n,i,r,e.getUint32(12,!0),22,3250441966),r=Dh(r,s,n,i,e.getUint32(16,!0),7,4118548399),i=Dh(i,r,s,n,e.getUint32(20,!0),12,1200080426),n=Dh(n,i,r,s,e.getUint32(24,!0),17,2821735955),s=Dh(s,n,i,r,e.getUint32(28,!0),22,4249261313),r=Dh(r,s,n,i,e.getUint32(32,!0),7,1770035416),i=Dh(i,r,s,n,e.getUint32(36,!0),12,2336552879),n=Dh(n,i,r,s,e.getUint32(40,!0),17,4294925233),s=Dh(s,n,i,r,e.getUint32(44,!0),22,2304563134),r=Dh(r,s,n,i,e.getUint32(48,!0),7,1804603682),i=Dh(i,r,s,n,e.getUint32(52,!0),12,4254626195),n=Dh(n,i,r,s,e.getUint32(56,!0),17,2792965006),s=Dh(s,n,i,r,e.getUint32(60,!0),22,1236535329),r=_h(r,s,n,i,e.getUint32(4,!0),5,4129170786),i=_h(i,r,s,n,e.getUint32(24,!0),9,3225465664),n=_h(n,i,r,s,e.getUint32(44,!0),14,643717713),s=_h(s,n,i,r,e.getUint32(0,!0),20,3921069994),r=_h(r,s,n,i,e.getUint32(20,!0),5,3593408605),i=_h(i,r,s,n,e.getUint32(40,!0),9,38016083),n=_h(n,i,r,s,e.getUint32(60,!0),14,3634488961),s=_h(s,n,i,r,e.getUint32(16,!0),20,3889429448),r=_h(r,s,n,i,e.getUint32(36,!0),5,568446438),i=_h(i,r,s,n,e.getUint32(56,!0),9,3275163606),n=_h(n,i,r,s,e.getUint32(12,!0),14,4107603335),s=_h(s,n,i,r,e.getUint32(32,!0),20,1163531501),r=_h(r,s,n,i,e.getUint32(52,!0),5,2850285829),i=_h(i,r,s,n,e.getUint32(8,!0),9,4243563512),n=_h(n,i,r,s,e.getUint32(28,!0),14,1735328473),s=_h(s,n,i,r,e.getUint32(48,!0),20,2368359562),r=Lh(r,s,n,i,e.getUint32(20,!0),4,4294588738),i=Lh(i,r,s,n,e.getUint32(32,!0),11,2272392833),n=Lh(n,i,r,s,e.getUint32(44,!0),16,1839030562),s=Lh(s,n,i,r,e.getUint32(56,!0),23,4259657740),r=Lh(r,s,n,i,e.getUint32(4,!0),4,2763975236),i=Lh(i,r,s,n,e.getUint32(16,!0),11,1272893353),n=Lh(n,i,r,s,e.getUint32(28,!0),16,4139469664),s=Lh(s,n,i,r,e.getUint32(40,!0),23,3200236656),r=Lh(r,s,n,i,e.getUint32(52,!0),4,681279174),i=Lh(i,r,s,n,e.getUint32(0,!0),11,3936430074),n=Lh(n,i,r,s,e.getUint32(12,!0),16,3572445317),s=Lh(s,n,i,r,e.getUint32(24,!0),23,76029189),r=Lh(r,s,n,i,e.getUint32(36,!0),4,3654602809),i=Lh(i,r,s,n,e.getUint32(48,!0),11,3873151461),n=Lh(n,i,r,s,e.getUint32(60,!0),16,530742520),s=Lh(s,n,i,r,e.getUint32(8,!0),23,3299628645),r=Bh(r,s,n,i,e.getUint32(0,!0),6,4096336452),i=Bh(i,r,s,n,e.getUint32(28,!0),10,1126891415),n=Bh(n,i,r,s,e.getUint32(56,!0),15,2878612391),s=Bh(s,n,i,r,e.getUint32(20,!0),21,4237533241),r=Bh(r,s,n,i,e.getUint32(48,!0),6,1700485571),i=Bh(i,r,s,n,e.getUint32(12,!0),10,2399980690),n=Bh(n,i,r,s,e.getUint32(40,!0),15,4293915773),s=Bh(s,n,i,r,e.getUint32(4,!0),21,2240044497),r=Bh(r,s,n,i,e.getUint32(32,!0),6,1873313359),i=Bh(i,r,s,n,e.getUint32(60,!0),10,4264355552),n=Bh(n,i,r,s,e.getUint32(24,!0),15,2734768916),s=Bh(s,n,i,r,e.getUint32(52,!0),21,1309151649),r=Bh(r,s,n,i,e.getUint32(16,!0),6,4149444226),i=Bh(i,r,s,n,e.getUint32(44,!0),10,3174756917),n=Bh(n,i,r,s,e.getUint32(8,!0),15,718787259),s=Bh(s,n,i,r,e.getUint32(36,!0),21,3951481745),t[0]=r+t[0]&4294967295,t[1]=s+t[1]&4294967295,t[2]=n+t[2]&4294967295,t[3]=i+t[3]&4294967295}reset(){this.state=Uint32Array.from(Oh),this.buffer=new DataView(new ArrayBuffer(Nh)),this.bufferLength=0,this.bytesHashed=0,this.finished=!1}}function Uh(e,t,r,s,n,i){return((t=(t+e&4294967295)+(s+i&4294967295)&4294967295)<<n|t>>>32-n)+r&4294967295}function Dh(e,t,r,s,n,i,o){return Uh(t&r|~t&s,e,t,n,i,o)}function _h(e,t,r,s,n,i,o){return Uh(t&s|r&~s,e,t,n,i,o)}function Lh(e,t,r,s,n,i,o){return Uh(t^r^s,e,t,n,i,o)}function Bh(e,t,r,s,n,i,o){return Uh(r^(t|~s),e,t,n,i,o)}function zh(e,t){return new Request(e,t)}function jh(e=0){return new Promise((t,r)=>{e&&setTimeout(()=>{const t=new Error(`Request did not complete within ${e} ms`);t.name="TimeoutError",r(t)},e)})}const Hh={supported:void 0};class qh{config;configProvider;static create(e){return"function"==typeof e?.handle?e:new qh(e)}constructor(e){"function"==typeof e?this.configProvider=e().then(e=>e||{}):(this.config=e??{},this.configProvider=Promise.resolve(this.config)),void 0===Hh.supported&&(Hh.supported=Boolean("undefined"!=typeof Request&&"keepalive"in zh("https://[::1]")))}destroy(){}async handle(e,{abortSignal:t,requestTimeout:r}={}){this.config||(this.config=await this.configProvider);const s=r??this.config.requestTimeout,n=!0===this.config.keepAlive,i=this.config.credentials;if(t?.aborted){const e=Fh(t);return Promise.reject(e)}let o=e.path;const a=function(e){const t=[];for(let r of Object.keys(e).sort()){const s=e[r];if(r=Dt(r),Array.isArray(s))for(let e=0,n=s.length;e<n;e++)t.push(`${r}=${Dt(s[e])}`);else{let e=r;(s||"string"==typeof s)&&(e+=`=${Dt(s)}`),t.push(e)}}return t.join("&")}(e.query||{});a&&(o+=`?${a}`),e.fragment&&(o+=`#${e.fragment}`);let c="";if(null!=e.username||null!=e.password){c=`${e.username??""}:${e.password??""}@`}const{port:u,method:d}=e,l=`${e.protocol}//${c}${e.hostname}${u?`:${u}`:""}${o}`,h="GET"===d||"HEAD"===d?void 0:e.body,f={body:h,headers:new Headers(e.headers),method:d,credentials:i};this.config?.cache&&(f.cache=this.config.cache),h&&(f.duplex="half"),"undefined"!=typeof AbortController&&(f.signal=t),Hh.supported&&(f.keepalive=n),"function"==typeof this.config.requestInit&&Object.assign(f,this.config.requestInit(e));let p=()=>{};const m=zh(l,f),g=[fetch(m).then(e=>{const t=e.headers,r={};for(const s of t.entries())r[s[0]]=s[1];return null!=e.body?{response:new xt({headers:r,reason:e.statusText,statusCode:e.status,body:e.body})}:e.blob().then(t=>({response:new xt({headers:r,reason:e.statusText,statusCode:e.status,body:t})}))}),jh(s)];return t&&g.push(new Promise((e,r)=>{const s=()=>{const e=Fh(t);r(e)};if("function"==typeof t.addEventListener){const e=t;e.addEventListener("abort",s,{once:!0}),p=()=>e.removeEventListener("abort",s)}else t.onabort=s})),Promise.race(g).finally(p)}updateHttpClientConfig(e,t){this.config=void 0,this.configProvider=this.configProvider.then(r=>(r[e]=t,r))}httpHandlerConfigs(){return this.config??{}}}function Fh(e){const t=e&&"object"==typeof e&&"reason"in e?e.reason:void 0;if(t){if(t instanceof Error){const e=new Error("Request aborted");return e.name="AbortError",e.cause=t,e}const e=new Error(String(t));return e.name="AbortError",e}const r=new Error("Request aborted");return r.name="AbortError",r}const Kh=async e=>"function"==typeof Blob&&e instanceof Blob||"Blob"===e.constructor?.name?void 0!==Blob.prototype.arrayBuffer?new Uint8Array(await e.arrayBuffer()):async function(e){const t=await function(e){return new Promise((t,r)=>{const s=new FileReader;s.onloadend=()=>{if(2!==s.readyState)return r(new Error("Reader aborted too early"));const e=s.result??"",n=e.indexOf(","),i=n>-1?n+1:e.length;t(e.substring(i))},s.onabort=()=>r(new Error("Read aborted")),s.onerror=()=>r(s.error),s.readAsDataURL(e)})}(e),r=w(t);return new Uint8Array(r)}(e):async function(e){const t=[],r=e.getReader();let s=!1,n=0;for(;!s;){const{done:e,value:i}=await r.read();i&&(t.push(i),n+=i.length),s=e}const i=new Uint8Array(n);let o=0;for(const a of t)i.set(a,o),o+=a.length;return i}(e);const Vh=e=>{const t=(({defaultsMode:e}={})=>ps(async()=>{const t="function"==typeof e?await e():e;switch(t?.toLowerCase()){case"auto":return Promise.resolve(bs()?"mobile":"standard");case"mobile":case"in-region":case"cross-region":case"standard":case"legacy":return Promise.resolve(t?.toLocaleLowerCase());case void 0:return Promise.resolve("legacy");default:throw new Error(`Invalid parameter for "defaultsMode", expect ${ws.join(", ")}, got ${t}`)}}))(e),r=()=>t().then(ar),s=(e=>({apiVersion:"2006-03-01",base64Decoder:e?.base64Decoder??w,base64Encoder:e?.base64Encoder??S,disableHostPrefix:e?.disableHostPrefix??!1,endpointProvider:e?.endpointProvider??tc,extensions:e?.extensions??[],getAwsChunkedEncodingStream:e?.getAwsChunkedEncodingStream??ht,httpAuthSchemeProvider:e?.httpAuthSchemeProvider??oc,httpAuthSchemes:e?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4"),signer:new Co},{schemeId:"aws.auth#sigv4a",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4a"),signer:new Ao}],logger:e?.logger??new hr,protocol:e?.protocol??Hi,protocolSettings:e?.protocolSettings??{defaultNamespace:"com.amazonaws.s3",errorTypeRegistries:wl,xmlNamespace:"http://s3.amazonaws.com/doc/2006-03-01/",version:"2006-03-01",serviceTarget:"AmazonS3"},sdkStreamMixin:e?.sdkStreamMixin??mt,serviceId:e?.serviceId??"S3",signerConstructor:e?.signerConstructor??hi,signingEscapePath:e?.signingEscapePath??!1,urlParser:e?.urlParser??Lt,useArnRegion:e?.useArnRegion??void 0,utf8Decoder:e?.utf8Decoder??b,utf8Encoder:e?.utf8Encoder??v}))(e);return{...s,...e,runtime:"browser",defaultsMode:t,bodyLengthChecker:e?.bodyLengthChecker??be,credentialDefaultProvider:e?.credentialDefaultProvider??(e=>()=>Promise.reject(new Error("Credential is missing"))),defaultUserAgentProvider:e?.defaultUserAgentProvider??ds({serviceId:s.serviceId,clientVersion:ch}),eventStreamSerdeProvider:e?.eventStreamSerdeProvider??go,maxAttempts:e?.maxAttempts??3,md5:e?.md5??$h,region:e?.region??(n="Region is missing",()=>Promise.reject(n)),requestHandler:qh.create(e?.requestHandler??r),retryMode:e?.retryMode??(async()=>(await r()).retryMode||Nr),sha1:e?.sha1??bh,sha256:e?.sha256??Ih,streamCollector:e?.streamCollector??Kh,streamHasher:e?.streamHasher??Mh,useDualstackEndpoint:e?.useDualstackEndpoint??(()=>Promise.resolve(false)),useFipsEndpoint:e?.useFipsEndpoint??(()=>Promise.resolve(false))};var n};class Wh extends f{config;constructor(...[e]){const t=Vh(e||{});super(t),this.initConfig=t;var r;const s=(e=>{const{requestChecksumCalculation:t,responseChecksumValidation:r,requestStreamBufferSize:s}=e;return Object.assign(e,{requestChecksumCalculation:h(t??As),responseChecksumValidation:h(r??Rs),requestStreamBufferSize:Number(s??0),checksumAlgorithms:e.checksumAlgorithms??{}})})(function(e){const t=Yr(e.userAgentAppId??void 0),{customUserAgent:r}=e;return Object.assign(e,{customUserAgent:"string"==typeof r?[[r]]:r,userAgentAppId:async()=>{const r=await t();if(!function(e){return void 0===e||"string"==typeof e&&e.length<=50}(r)){const t="NoOpLogger"!==e.logger?.constructor?.name&&e.logger?e.logger:console;"string"!=typeof r?t?.warn("userAgentAppId must be a string or undefined."):r.length>50&&t?.warn("The provided userAgentAppId exceeds the maximum length of 50 characters.")}return r}})}((r=t,Object.assign(r,{useFipsEndpoint:r.useFipsEndpoint??!1,useDualstackEndpoint:r.useDualstackEndpoint??!1,forcePathStyle:r.forcePathStyle??!1,useAccelerateEndpoint:r.useAccelerateEndpoint??!1,useGlobalEndpoint:r.useGlobalEndpoint??!1,disableMultiregionAccessPoints:r.disableMultiregionAccessPoints??!1,defaultSigningName:"s3",clientContextParams:r.clientContextParams??{}})))),n=Lr(s),i=ys(n),o=tt(i),a=yo(o),c=((e,t)=>{const r=Object.assign((e=>({setRegion(t){e.region=t},region:()=>e.region}))(e),ur(e),(e=>({setHttpHandler(t){e.httpHandler=t},httpHandler:()=>e.httpHandler,updateHttpClientConfig(t,r){e.httpHandler?.updateHttpClientConfig(t,r)},httpHandlerConfigs:()=>e.httpHandler.httpHandlerConfigs()}))(e),(e=>{const t=e.httpAuthSchemes;let r=e.httpAuthSchemeProvider,s=e.credentials;return{setHttpAuthScheme(e){const r=t.findIndex(t=>t.schemeId===e.schemeId);-1===r?t.push(e):t.splice(r,1,e)},httpAuthSchemes:()=>t,setHttpAuthSchemeProvider(e){r=e},httpAuthSchemeProvider:()=>r,setCredentials(e){s=e},credentials:()=>s}})(e));return t.forEach(e=>e.configure(r)),Object.assign(e,{region:r.region()},dr(r),{httpHandler:r.httpHandler()},{httpAuthSchemes:(s=r).httpAuthSchemes(),httpAuthSchemeProvider:s.httpAuthSchemeProvider(),credentials:s.credentials()});var s})(((e,{session:t})=>{const[r,s]=t,{forcePathStyle:n,useAccelerateEndpoint:i,disableMultiregionAccessPoints:o,followRegionRedirects:a,s3ExpressIdentityProvider:c,bucketEndpoint:u,expectContinueHeader:d}=e;return Object.assign(e,{forcePathStyle:n??!1,useAccelerateEndpoint:i??!1,disableMultiregionAccessPoints:o??!1,followRegionRedirects:a??!1,s3ExpressIdentityProvider:c??new Pn(async e=>r().send(new s({Bucket:e}))),bucketEndpoint:u??!1,expectContinueHeader:d??2097152})})(dc(a),{session:[()=>this,ah]}),e?.extensions||[]);var u;this.config=c,this.middlewareStack.use(qt(this.config)),this.middlewareStack.use((u=this.config,{applyToStack:e=>{e.add(as(u),us)}})),this.middlewareStack.use(Br(this.config)),this.middlewareStack.use(Ut(this.config)),this.middlewareStack.use(Hr(this.config)),this.middlewareStack.use((this.config,{applyToStack:e=>{e.add((e,t)=>async r=>{try{const s=await e(r),{clientName:n,commandName:i,logger:o,dynamoDbDocumentClientOptions:a={}}=t,{overrideInputFilterSensitiveLog:c,overrideOutputFilterSensitiveLog:u}=a,d=c??t.inputFilterSensitiveLog,l=u??t.outputFilterSensitiveLog,{$metadata:h,...f}=s.output;return o?.info?.({clientName:n,commandName:i,input:d(r.input),output:l(f),metadata:h}),s}catch(s){const{clientName:e,commandName:n,logger:i,dynamoDbDocumentClientOptions:o={}}=t,{overrideInputFilterSensitiveLog:a}=o,c=a??t.inputFilterSensitiveLog;throw i?.error?.({clientName:e,commandName:n,input:c(r.input),error:s,metadata:s.$metadata}),s}},qr)}})),this.middlewareStack.use((this.config,{applyToStack:e=>{}})),this.middlewareStack.use(((e,{httpAuthSchemeParametersProvider:t,identityProviderConfigProvider:r})=>({applyToStack:s=>{s.addRelativeTo(Fr(e,{httpAuthSchemeParametersProvider:t,identityProviderConfigProvider:r}),Kr)}}))(this.config,{httpAuthSchemeParametersProvider:rc,identityProviderConfigProvider:async e=>new Jr({"aws.auth#sigv4":e.credentials,"aws.auth#sigv4a":e.credentials})})),this.middlewareStack.use(Xr(this.config)),this.middlewareStack.use(ki(this.config)),this.middlewareStack.use(vs(this.config)),this.middlewareStack.use(An(this.config)),this.middlewareStack.use(mi(this.config)),this.middlewareStack.use((e=>({applyToStack:t=>{t.addRelativeTo(wi(e),Gr)}}))(this.config))}destroy(){super.destroy()}}const Gh={name:"ssecMiddleware",step:"initialize",tags:["SSE"],override:!0},Xh=e=>({applyToStack:t=>{var r;t.add((r=e,e=>async t=>{const s={...t.input},n=[{target:"SSECustomerKey",hash:"SSECustomerKeyMD5"},{target:"CopySourceSSECustomerKey",hash:"CopySourceSSECustomerKeyMD5"}];for(const e of n){const t=s[e.target];if(t){let n;"string"==typeof t?Yh(t,r)?n=r.base64Decoder(t):(n=r.utf8Decoder(t),s[e.target]=r.base64Encoder(n)):(n=ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):new Uint8Array(t),s[e.target]=r.base64Encoder(n));const i=new r.md5;i.update(n),s[e.hash]=r.base64Encoder(await i.digest())}}return e({...t,input:s})}),Gh)}});function Yh(e,t){if(!/^(?:[A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e))return!1;try{return 32===t.base64Decoder(e).length}catch{return!1}}class Jh extends(sr.classBuilder().ep({...lc,DisableS3ExpressSessionAuth:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"},Key:{type:"contextParams",name:"Key"},CopySource:{type:"contextParams",name:"CopySource"}}).m(function(e,t,r,s){return[st(r,e.getEndpointParameterInstructions()),Ci(r),Xh(r)]}).s("AmazonS3","CopyObject",{}).n("S3Client","CopyObjectCommand").sc(eh).build()){}class Qh extends(sr.classBuilder().ep({...lc,Bucket:{type:"contextParams",name:"Bucket"},Key:{type:"contextParams",name:"Key"}}).m(function(e,t,r,s){return[st(r,e.getEndpointParameterInstructions()),Ci(r)]}).s("AmazonS3","DeleteObject",{}).n("S3Client","DeleteObjectCommand").sc(rh).build()){}class Zh extends(sr.classBuilder().ep({...lc,Bucket:{type:"contextParams",name:"Bucket"}}).m(function(e,t,r,s){return[st(r,e.getEndpointParameterInstructions()),bn(r,{requestAlgorithmMember:{httpHeader:"x-amz-sdk-checksum-algorithm",name:"ChecksumAlgorithm"},requestChecksumRequired:!0}),Ci(r)]}).s("AmazonS3","DeleteObjects",{}).n("S3Client","DeleteObjectsCommand").sc(sh).build()){}class ef extends(sr.classBuilder().ep({...lc,Bucket:{type:"contextParams",name:"Bucket"},Key:{type:"contextParams",name:"Key"}}).m(function(e,t,r,s){return[st(r,e.getEndpointParameterInstructions()),bn(r,{requestChecksumRequired:!1,requestValidationModeMember:"ChecksumMode",responseAlgorithms:["CRC64NVME","CRC32","CRC32C","SHA256","SHA1","SHA512","MD5","XXHASH64","XXHASH3","XXHASH128"]}),Xh(r),kn()]}).s("AmazonS3","GetObject",{}).n("S3Client","GetObjectCommand").sc(nh).build()){}class tf extends(sr.classBuilder().ep({...lc,Bucket:{type:"contextParams",name:"Bucket"},Prefix:{type:"contextParams",name:"Prefix"}}).m(function(e,t,r,s){return[st(r,e.getEndpointParameterInstructions()),Ci(r)]}).s("AmazonS3","ListObjectsV2",{}).n("S3Client","ListObjectsV2Command").sc(ih).build()){}class rf extends(sr.classBuilder().ep({...lc,Bucket:{type:"contextParams",name:"Bucket"},Key:{type:"contextParams",name:"Key"}}).m(function(e,t,r,s){return[st(r,e.getEndpointParameterInstructions()),bn(r,{requestAlgorithmMember:{httpHeader:"x-amz-sdk-checksum-algorithm",name:"ChecksumAlgorithm"},requestChecksumRequired:!1}),vn(),Ci(r),Xh(r)]}).s("AmazonS3","PutObject",{}).n("S3Client","PutObjectCommand").sc(oh).build()){}async function sf(e,t={}){const{key:r,body:s,destinationKey:n,provider:i,...o}=t,a=i||function(){const e={cloudflare:["CLOUDFLARE_BUCKET_NAME","CLOUDFLARE_ACCESS_KEY_ID","CLOUDFLARE_SECRET_ACCESS_KEY","CLOUDFLARE_BUCKET_URL"],backblaze:["BACKBLAZE_BUCKET_NAME","BACKBLAZE_ACCESS_KEY_ID","BACKBLAZE_SECRET_ACCESS_KEY","BACKBLAZE_BUCKET_URL"],amazon:["AMAZON_BUCKET_NAME","AMAZON_ACCESS_KEY_ID","AMAZON_SECRET_ACCESS_KEY","AMAZON_BUCKET_URL"]};for(const[t,r]of Object.entries(e))if(r.every(e=>process.env[e]))return t;return"cloudflare"}(),c=Object.fromEntries(Object.entries(o).map(([e,t])=>[`${a.toUpperCase()}_${e}`,t])),u=function(e,t={}){const r=e.toUpperCase()+"_";return{region:"amazon"===e?t.awsRegion||process.env.AMAZON_REGION||"us-east-1":"auto",endpoint:t[`${r}BUCKET_URL`]||process.env[`${r}BUCKET_URL`]||"",bucket:t[`${r}BUCKET_NAME`]||process.env[`${r}BUCKET_NAME`]||"",accessKeyId:t[`${r}ACCESS_KEY_ID`]||t[`${r}APPLICATION_KEY_ID`]||process.env[`${r}ACCESS_KEY_ID`]||process.env[`${r}APPLICATION_KEY_ID`]||"",secretAccessKey:t[`${r}SECRET_ACCESS_KEY`]||t[`${r}APPLICATION_KEY`]||process.env[`${r}SECRET_ACCESS_KEY`]||process.env[`${r}APPLICATION_KEY`]||""}}(a,c);if(!u.bucket||!u.accessKeyId||!u.secretAccessKey)throw new Error(`Missing credentials for ${a}`);const d=new Wh({region:u.region,endpoint:u.endpoint,credentials:{accessKeyId:u.accessKeyId,secretAccessKey:u.secretAccessKey}});try{switch(e){case"upload":return{success:!0,key:r,...await d.send(new rf({Bucket:u.bucket,Key:r,Body:s}))};case"download":const e=await d.send(new ef({Bucket:u.bucket,Key:r}));return await(e.Body?.transformToString());case"delete":return{success:!0,key:r,...await d.send(new Qh({Bucket:u.bucket,Key:r}))};case"list":const t=await d.send(new tf({Bucket:u.bucket}));return t.Contents?.map(e=>e.Key)||[];case"deleteAll":const i=await d.send(new tf({Bucket:u.bucket}));if(i.Contents?.length){const e=await d.send(new Zh({Bucket:u.bucket,Delete:{Objects:i.Contents.map(e=>({Key:e.Key}))}}));return{success:!0,count:i.Contents.length,...e}}return{success:!0,count:0};case"copy":if(!n)throw new Error("destinationKey is required for copy operation");return{success:!0,sourceKey:r,destinationKey:n,...await d.send(new Jh({Bucket:u.bucket,CopySource:`${u.bucket}/${r}`,Key:n}))};case"rename":if(!n)throw new Error("destinationKey is required for rename operation");return await d.send(new Jh({Bucket:u.bucket,CopySource:`${u.bucket}/${r}`,Key:n})),await d.send(new Qh({Bucket:u.bucket,Key:r})),{success:!0,oldKey:r,newKey:n};default:throw new Error("Invalid action: upload, download, delete, list, deleteAll, copy, rename")}}catch(l){throw console.error(`Error in ${a}:`,l.message),l}}e();export{so as E,Ki as H,qi as I,no as M,oo as S,po as a,lo as b,io as c,ao as d,go as e,b as f,co as g,uo as h,fo as i,yo as j,sf as m,ho as r,v as t};
|
package/dist/manage-storage.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"dotenv";import{m as a,m as e}from"./manage-storage-
|
|
1
|
+
import"dotenv";import{m as a,m as e}from"./manage-storage-CGRNU6uH.js";export{a as default,e as manageStorage};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "manage-storage",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
4
4
|
"description": "Storage manager supporting AWS S3, Backblaze B2, and Cloudflare R2 with automatic provider detection",
|
|
5
5
|
"main": "./dist/manage-storage.js",
|
|
6
6
|
"module": "./dist/manage-storage.js",
|
package/dist/index-D3VEP7BG.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e,f as t}from"./manage-storage-CFQpLcZ9.js";class r{marshaller;serializer;deserializer;serdeContext;defaultContentType;constructor({marshaller:e,serializer:t,deserializer:r,serdeContext:i,defaultContentType:n}){this.marshaller=e,this.serializer=t,this.deserializer=r,this.serdeContext=i,this.defaultContentType=n}async serializeEventStream({eventStream:e,requestSchema:t,initialRequest:r}){const i=this.marshaller,n=t.getEventStreamMember(),s=t.getMemberSchema(n),a=this.serializer,o=this.defaultContentType,l=/* @__PURE__ */Symbol("initialRequestMarker"),c={async*[Symbol.asyncIterator](){if(r){const e={":event-type":{type:"string",value:"initial-request"},":message-type":{type:"string",value:"event"},":content-type":{type:"string",value:o}};a.write(t,r);const i=a.flush();yield{[l]:!0,headers:e,body:i}}for await(const t of e)yield t}};return i.serialize(c,e=>{if(e[l])return{headers:e.headers,body:e.body};let t="";for(const s in e)if("__type"!==s){t=s;break}const{additionalHeaders:r,body:i,eventType:n,explicitPayloadContentType:a}=this.writeEventBody(t,s,e);return{headers:{":event-type":{type:"string",value:n},":message-type":{type:"string",value:"event"},":content-type":{type:"string",value:a??o},...r},body:i}})}async deserializeEventStream({response:t,responseSchema:r,initialResponseContainer:i}){const n=this.marshaller,s=r.getEventStreamMember(),a=r.getMemberSchema(s).getMemberSchemas(),o=/* @__PURE__ */Symbol("initialResponseMarker"),l=n.deserialize(t.body,async t=>{let i="";for(const e in t)if("__type"!==e){i=e;break}const n=t[i].body;if("initial-response"===i){const e=await this.deserializer.read(r,n);return delete e[s],{[o]:!0,...e}}if(i in a){const r=a[i];if(r.isStructSchema()){const s={};let a=!1;for(const[o,l]of r.structIterator()){const{eventHeader:r,eventPayload:c}=l.getMergedTraits();if(a=a||Boolean(r||c),c)l.isBlobSchema()?s[o]=n:l.isStringSchema()?s[o]=(this.serdeContext?.utf8Encoder??e)(n):l.isStructSchema()&&(s[o]=await this.deserializer.read(l,n));else if(r){const e=t[i].headers[o]?.value;null!=e&&(l.isNumericSchema()?s[o]=e&&"object"==typeof e&&"bytes"in e?BigInt(e.toString()):Number(e):s[o]=e)}}if(a)return{[i]:s};if(0===n.byteLength)return{[i]:{}}}return{[i]:await this.deserializer.read(r,n)}}return{$unknown:t}}),c=l[Symbol.asyncIterator](),m=await c.next();if(m.done)return l;if(m.value?.[o]){if(!r)throw new Error("@smithy::core/protocols - initial-response event encountered in event stream but no response schema given.");for(const e in m.value)i[e]=m.value[e]}return{async*[Symbol.asyncIterator](){for(m?.value?.[o]||(yield m.value);;){const{done:e,value:t}=await c.next();if(e)break;yield t}}}}writeEventBody(e,r,i){const n=this.serializer;let s,a=e,o=null;const l={};if(r.getSchema()[4].includes(e)){const t=r.getMemberSchema(e);if(t.isStructSchema()){for(const[r,n]of t.structIterator()){const{eventHeader:t,eventPayload:s}=n.getMergedTraits();if(s)o=r;else if(t){const t=i[e][r];let s="binary";n.isNumericSchema()?s=(-2)**31<=t&&t<=2**31-1?"integer":"long":n.isTimestampSchema()?s="timestamp":n.isStringSchema()?s="string":n.isBooleanSchema()&&(s="boolean"),null!=t&&(l[r]={type:s,value:t},delete i[e][r])}}if(null!==o){const r=t.getMemberSchema(o);r.isBlobSchema()?s="application/octet-stream":r.isStringSchema()&&(s="text/plain"),n.write(r,i[e][o])}else n.write(t,i[e])}else{if(!t.isUnitSchema())throw new Error("@smithy/core/event-streams - non-struct member not supported in event stream union.");n.write(t,{})}}else{const[t,r]=i[e];a=t,n.write(15,r)}const c=n.flush()??new Uint8Array;return{body:"string"==typeof c?(this.serdeContext?.utf8Decoder??t)(c):c,eventType:a,explicitPayloadContentType:s,additionalHeaders:l}}}export{r as EventStreamSerde};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{config as e}from"dotenv";var t,r,s,n;(r=t||(t={})).HTTP="http",r.HTTPS="https",(n=s||(s={})).MD5="md5",n.CRC32="crc32",n.CRC32C="crc32c",n.SHA1="sha1",n.SHA256="sha256";const i="__smithy_context";class o{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){const t=new o({...e,headers:{...e.headers}});var r;return t.query&&(t.query=(r=t.query,Object.keys(r).reduce((e,t)=>{const s=r[t];return{...e,[t]:Array.isArray(s)?[...s]:s}},{}))),t}static isInstance(e){if(!e)return!1;const t=e;return"method"in t&&"protocol"in t&&"hostname"in t&&"path"in t&&"object"==typeof t.query&&"object"==typeof t.headers}clone(){return o.clone(this)}}class a{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;const t=e;return"number"==typeof t.statusCode&&"object"==typeof t.headers}}const c={step:"build",tags:["SET_EXPECT_HEADER","EXPECT_HEADER"],name:"addExpectContinueMiddleware",override:!0},u=e=>({applyToStack:t=>{t.add(function(e){return t=>async r=>{const{request:s}=r;if(!1!==e.expectContinueHeader&&o.isInstance(s)&&s.body&&"node"===e.runtime&&"FetchHttpHandler"!==e.requestHandler?.constructor?.name){let t=!0;if("number"==typeof e.expectContinueHeader)try{t=(Number(s.headers?.["content-length"])??e.bodyLengthChecker?.(s.body)??1/0)>=e.expectContinueHeader}catch(n){}else t=!!e.expectContinueHeader;t&&(s.headers.Expect="100-continue")}return t({...r,request:s})}}(e),c)}}),d="WHEN_SUPPORTED",l="WHEN_REQUIRED",h=d,f="WHEN_SUPPORTED",p="WHEN_REQUIRED",m=d;var g,y,w,b;(y=g||(g={})).MD5="MD5",y.CRC32="CRC32",y.CRC32C="CRC32C",y.CRC64NVME="CRC64NVME",y.SHA1="SHA1",y.SHA256="SHA256",(b=w||(w={})).HEADER="header",b.TRAILER="trailer";const S=g.CRC32;var v,E;(E=v||(v={})).STANDARD="standard",E.ADAPTIVE="adaptive";const C=v.STANDARD,A=["BandwidthLimitExceeded","EC2ThrottledException","LimitExceededException","PriorRequestNotComplete","ProvisionedThroughputExceededException","RequestLimitExceeded","RequestThrottled","RequestThrottledException","SlowDown","ThrottledException","Throttling","ThrottlingException","TooManyRequestsException","TransactionInProgressException"],x=["TimeoutError","RequestTimeout","RequestTimeoutException"],k=[500,502,503,504],R=["ECONNRESET","ECONNREFUSED","EPIPE","ETIMEDOUT"],T=["EHOSTUNREACH","ENETUNREACH","ENOTFOUND"],P=e=>429===e.$metadata?.httpStatusCode||A.includes(e.name)||1==e.$retryable?.throttling,I=(e,t=0)=>(e=>void 0!==e?.$retryable)(e)||(e=>e.$metadata?.clockSkewCorrected)(e)||"InvalidSignatureException"===e.name&&e.message?.includes("Signature expired")||x.includes(e.name)||R.includes(e?.code||"")||T.includes(e?.code||"")||k.includes(e.$metadata?.httpStatusCode||0)||(e=>!!(e&&e instanceof TypeError)&&/* @__PURE__ */new Set(["Failed to fetch","NetworkError when attempting to fetch resource","The Internet connection appears to be offline","Load failed","Network request failed"]).has(e.message))(e)||function(e){return"ERR_HTTP2_STREAM_ERROR"===e.code&&e.message.includes("NGHTTP2_REFUSED_STREAM")}(e)||void 0!==e.cause&&t<=10&&I(e.cause,t+1);class M{static setTimeoutFn=setTimeout;beta;minCapacity;minFillRate;scaleConstant;smooth;enabled=!1;availableTokens=0;lastMaxRate=0;measuredTxRate=0;requestCount=0;fillRate;lastThrottleTime;lastTimestamp=0;lastTxRateBucket;maxCapacity;timeWindow=0;constructor(e){this.beta=e?.beta??.7,this.minCapacity=e?.minCapacity??1,this.minFillRate=e?.minFillRate??.5,this.scaleConstant=e?.scaleConstant??.4,this.smooth=e?.smooth??.8,this.lastThrottleTime=this.getCurrentTimeInSeconds(),this.lastTxRateBucket=Math.floor(this.getCurrentTimeInSeconds()),this.fillRate=this.minFillRate,this.maxCapacity=this.minCapacity}async getSendToken(){return this.acquireTokenBucket(1)}updateClientSendingRate(e){let t;this.updateMeasuredRate();const r=e;if("THROTTLING"===r?.errorType||P(r?.error??e)){const e=this.enabled?Math.min(this.measuredTxRate,this.fillRate):this.measuredTxRate;this.lastMaxRate=e,this.calculateTimeWindow(),this.lastThrottleTime=this.getCurrentTimeInSeconds(),t=this.cubicThrottle(e),this.enableTokenBucket()}else this.calculateTimeWindow(),t=this.cubicSuccess(this.getCurrentTimeInSeconds());const s=Math.min(t,2*this.measuredTxRate);this.updateTokenBucketRate(s)}getCurrentTimeInSeconds(){return Date.now()/1e3}async acquireTokenBucket(e){if(this.enabled){for(this.refillTokenBucket();e>this.availableTokens;){const t=(e-this.availableTokens)/this.fillRate*1e3;await new Promise(e=>M.setTimeoutFn(e,t)),this.refillTokenBucket()}this.availableTokens=this.availableTokens-e}}refillTokenBucket(){const e=this.getCurrentTimeInSeconds();if(!this.lastTimestamp)return void(this.lastTimestamp=e);const t=(e-this.lastTimestamp)*this.fillRate;this.availableTokens=Math.min(this.maxCapacity,this.availableTokens+t),this.lastTimestamp=e}calculateTimeWindow(){this.timeWindow=this.getPrecise(Math.pow(this.lastMaxRate*(1-this.beta)/this.scaleConstant,1/3))}cubicThrottle(e){return this.getPrecise(e*this.beta)}cubicSuccess(e){return this.getPrecise(this.scaleConstant*Math.pow(e-this.lastThrottleTime-this.timeWindow,3)+this.lastMaxRate)}enableTokenBucket(){this.enabled=!0}updateTokenBucketRate(e){this.refillTokenBucket(),this.fillRate=Math.max(e,this.minFillRate),this.maxCapacity=Math.max(e,this.minCapacity),this.availableTokens=Math.min(this.availableTokens,this.maxCapacity)}updateMeasuredRate(){const e=this.getCurrentTimeInSeconds(),t=Math.floor(2*e)/2;if(this.requestCount++,t>this.lastTxRateBucket){const e=this.requestCount/(t-this.lastTxRateBucket);this.measuredTxRate=this.getPrecise(e*this.smooth+this.measuredTxRate*(1-this.smooth)),this.requestCount=0,this.lastTxRateBucket=t}}getPrecise(e){return parseFloat(e.toFixed(8))}}class N{static v2026="undefined"!=typeof process&&"true"===process.env?.SMITHY_NEW_RETRIES_2026;static delay(){return N.v2026?50:100}static throttlingDelay(){return N.v2026?1e3:500}static cost(){return N.v2026?14:5}static throttlingCost(){return N.v2026?5:10}static modifiedCostType(){return N.v2026?"THROTTLING":"TRANSIENT"}}class O{x=N.delay();computeNextBackoffDelay(e){const t=Math.random()*Math.min(this.x*2**e,2e4);return Math.floor(t)}setDelayBase(e){this.x=e}}class ${delay;count;cost;longPoll;constructor(e,t,r,s){this.delay=e,this.count=t,this.cost=r,this.longPoll=s}getRetryCount(){return this.count}getRetryDelay(){return Math.min(2e4,this.delay)}getRetryCost(){return this.cost}isLongPoll(){return this.longPoll}}const U=1,D=2,_=3;class L{mode=v.STANDARD;capacity=500;retryBackoffStrategy;maxAttemptsProvider;baseDelay;constructor(e){"number"==typeof e?this.maxAttemptsProvider=async()=>e:"function"==typeof e?this.maxAttemptsProvider=e:e&&"object"==typeof e&&(this.maxAttemptsProvider=async()=>e.maxAttempts,this.baseDelay=e.baseDelay,this.retryBackoffStrategy=e.backoff),this.maxAttemptsProvider??=async()=>3,this.baseDelay??=N.delay(),this.retryBackoffStrategy??=new O}async acquireInitialRetryToken(e){return new $(N.delay(),0,void 0,N.v2026&&e.includes(":longpoll"))}async refreshRetryTokenForRetry(e,t){const r=await this.getMaxAttempts(),s=this.retryCode(e,t,r),n=0===s,i=e.isLongPoll?.();if(n||i){const r=t.errorType;this.retryBackoffStrategy.setDelayBase("THROTTLING"===r?N.throttlingDelay():this.baseDelay);const o=this.retryBackoffStrategy.computeNextBackoffDelay(e.getRetryCount());let a=o;if(t.retryAfterHint instanceof Date&&(a=Math.max(o,Math.min(t.retryAfterHint.getTime()-Date.now(),o+5e3))),n){const t=this.getCapacityCost(r);return this.capacity-=t,new $(a,e.getRetryCount()+1,t,e.isLongPoll?.()??!1)}throw Object.assign(new Error("No retry token available"),{$backoff:N.v2026&&s===_&&i?a:0})}throw new Error("No retry token available")}recordSuccess(e){this.capacity=Math.min(500,this.capacity+(e.getRetryCost()??1))}getCapacity(){return this.capacity}async maxAttempts(){return this.maxAttemptsProvider()}async getMaxAttempts(){try{return await this.maxAttemptsProvider()}catch(e){return console.warn("Max attempts provider could not resolve. Using default of 3"),3}}retryCode(e,t,r){const s=e.getRetryCount()+1,n=this.isRetryableError(t.errorType)?0:U,i=s<r?0:D,o=this.capacity>=this.getCapacityCost(t.errorType)?0:_;return n||i||o}getCapacityCost(e){return e===N.modifiedCostType()?N.throttlingCost():N.cost()}isRetryableError(e){return"THROTTLING"===e||"TRANSIENT"===e}}class B{mode=v.ADAPTIVE;rateLimiter;standardRetryStrategy;constructor(e,t){const{rateLimiter:r}=t??{};this.rateLimiter=r??new M,this.standardRetryStrategy=new L(t?{maxAttempts:"number"==typeof e?e:3,...t}:e)}async acquireInitialRetryToken(e){const t=await this.standardRetryStrategy.acquireInitialRetryToken(e);return await this.rateLimiter.getSendToken(),t}async refreshRetryTokenForRetry(e,t){this.rateLimiter.updateClientSendingRate(t);const r=await this.standardRetryStrategy.refreshRetryTokenForRetry(e,t);return await this.rateLimiter.getSendToken(),r}recordSuccess(e){this.rateLimiter.updateClientSendingRate({}),this.standardRetryStrategy.recordSuccess(e)}async maxAttemptsProvider(){return this.standardRetryStrategy.maxAttempts()}}function z(e,t,r){e.__aws_sdk_context?e.__aws_sdk_context.features||(e.__aws_sdk_context.features={}):e.__aws_sdk_context={features:{}},e.__aws_sdk_context.features[t]=r}N.v2026||="object"==typeof process&&"true"===process.env?.AWS_NEW_RETRIES_2026;const j="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",H=Object.entries(j).reduce((e,[t,r])=>(e[r]=Number(t),e),{}),q=j.split(""),F=e=>{let t=e.length/4*3;"=="===e.slice(-2)?t-=2:"="===e.slice(-1)&&t--;const r=new ArrayBuffer(t),s=new DataView(r);for(let n=0;n<e.length;n+=4){let t=0,r=0;for(let s=n,a=n+3;s<=a;s++)if("="!==e[s]){if(!(e[s]in H))throw new TypeError(`Invalid character ${e[s]} in base64 string.`);t|=H[e[s]]<<6*(a-s),r+=6}else t>>=6;const i=n/4*3;t>>=r%8;const o=Math.floor(r/8);for(let e=0;e<o;e++){const r=8*(o-e-1);s.setUint8(i+e,(t&255<<r)>>r)}}return new Uint8Array(r)},K=e=>(new TextEncoder).encode(e),V=e=>"string"==typeof e?K(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e),W=e=>{if("string"==typeof e)return e;if("object"!=typeof e||"number"!=typeof e.byteOffset||"number"!=typeof e.byteLength)throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.");return new TextDecoder("utf-8").decode(e)};function G(e){let t;t="string"==typeof e?K(e):e;const r="object"==typeof t&&"number"==typeof t.length,s="object"==typeof t&&"number"==typeof t.byteOffset&&"number"==typeof t.byteLength;if(!r&&!s)throw new Error("@smithy/util-base64: toBase64 encoder function only accepts string | Uint8Array.");let n="";for(let i=0;i<t.length;i+=3){let e=0,r=0;for(let n=i,o=Math.min(i+3,t.length);n<o;n++)e|=t[n]<<8*(o-n-1),r+=8;const s=Math.ceil(r/6);e<<=6*s-r;for(let t=1;t<=s;t++){const r=6*(s-t);n+=q[(e&63<<r)>>r]}n+="==".slice(0,4-s)}return n}class X extends Uint8Array{static fromString(e,t="utf-8"){if("string"==typeof e)return"base64"===t?X.mutate(F(e)):X.mutate(K(e));throw new Error(`Unsupported conversion from ${typeof e} to Uint8ArrayBlobAdapter.`)}static mutate(e){return Object.setPrototypeOf(e,X.prototype),e}transformToString(e="utf-8"){return"base64"===e?G(this):W(this)}}const Y="function"==typeof ReadableStream?ReadableStream:function(){};class J extends Y{}const Q=e=>"function"==typeof ReadableStream&&(e?.constructor?.name===ReadableStream.name||e instanceof ReadableStream),Z=({expectedChecksum:e,checksum:t,source:r,checksumSourceLocation:s,base64Encoder:n})=>{if(!Q(r))throw new Error(`@smithy/util-stream: unsupported source type ${r?.constructor?.name??r} in ChecksumStream.`);const i=n??G;if("function"!=typeof TransformStream)throw new Error("@smithy/util-stream: unable to instantiate ChecksumStream because API unavailable: ReadableStream/TransformStream.");const o=new TransformStream({start(){},async transform(e,r){t.update(e),r.enqueue(e)},async flush(r){const n=await t.digest(),o=i(n);if(e!==o){const t=new Error(`Checksum mismatch: expected "${e}" but received "${o}" in response header "${s}".`);r.error(t)}else r.terminate()}});r.pipeThrough(o);const a=o.readable;return Object.setPrototypeOf(a,J.prototype),a};class ee{allocByteArray;byteLength=0;byteArrays=[];constructor(e){this.allocByteArray=e}push(e){this.byteArrays.push(e),this.byteLength+=e.byteLength}flush(){if(1===this.byteArrays.length){const e=this.byteArrays[0];return this.reset(),e}const e=this.allocByteArray(this.byteLength);let t=0;for(let r=0;r<this.byteArrays.length;++r){const s=this.byteArrays[r];e.set(s,t),t+=s.byteLength}return this.reset(),e}reset(){this.byteArrays=[],this.byteLength=0}}const te=function(e,t,r){const s=e.getReader();let n=!1,i=0;const o=["",new ee(e=>new Uint8Array(e))];let a=-1;const c=async e=>{const{value:u,done:d}=await s.read(),l=u;if(d){if(-1!==a){const t=re(o,a);se(t)>0&&e.enqueue(t)}e.close()}else{const s=function(e,t=!0){if(t&&"undefined"!=typeof Buffer&&e instanceof Buffer)return 2;if(e instanceof Uint8Array)return 1;if("string"==typeof e)return 0;return-1}(l,!1);if(a!==s&&(a>=0&&e.enqueue(re(o,a)),a=s),-1===a)return void e.enqueue(l);const u=se(l);i+=u;const d=se(o[a]);if(u>=t&&0===d)e.enqueue(l);else{const s=function(e,t,r){switch(t){case 0:return e[0]+=r,se(e[0]);case 1:case 2:return e[t].push(r),se(e[t])}}(o,a,l);!n&&i>2*t&&(n=!0,r?.warn(`@smithy/util-stream - stream chunk size ${u} is below threshold of ${t}, automatically buffering.`)),s>=t?e.enqueue(re(o,a)):await c(e)}}};return new ReadableStream({pull:c})};function re(e,t){switch(t){case 0:const r=e[0];return e[0]="",r;case 1:case 2:return e[t].flush()}throw new Error(`@smithy/util-stream - invalid index ${t} given to flush()`)}function se(e){return e?.byteLength??e?.length??0}const ne=(e,t)=>{const{base64Encoder:r,bodyLengthChecker:s,checksumAlgorithmFn:n,checksumLocationName:i,streamHasher:o}=t,a=void 0!==r&&void 0!==s&&void 0!==n&&void 0!==i&&void 0!==o,c=a?o(n,e):void 0,u=e.getReader();return new ReadableStream({async pull(e){const{value:t,done:n}=await u.read();if(n){if(e.enqueue("0\r\n"),a){const t=r(await c);e.enqueue(`${i}:${t}\r\n`),e.enqueue("\r\n")}e.close()}else e.enqueue(`${(s(t)||0).toString(16)}\r\n${t}\r\n`)}})},ie=e=>encodeURIComponent(e).replace(/[!'()*]/g,oe),oe=e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`;function ae(e,t){return new Request(e,t)}function ce(e=0){return new Promise((t,r)=>{e&&setTimeout(()=>{const t=new Error(`Request did not complete within ${e} ms`);t.name="TimeoutError",r(t)},e)})}const ue={supported:void 0};class de{config;configProvider;static create(e){return"function"==typeof e?.handle?e:new de(e)}constructor(e){"function"==typeof e?this.configProvider=e().then(e=>e||{}):(this.config=e??{},this.configProvider=Promise.resolve(this.config)),void 0===ue.supported&&(ue.supported=Boolean("undefined"!=typeof Request&&"keepalive"in ae("https://[::1]")))}destroy(){}async handle(e,{abortSignal:t,requestTimeout:r}={}){this.config||(this.config=await this.configProvider);const s=r??this.config.requestTimeout,n=!0===this.config.keepAlive,i=this.config.credentials;if(t?.aborted){const e=le(t);return Promise.reject(e)}let o=e.path;const c=function(e){const t=[];for(let r of Object.keys(e).sort()){const s=e[r];if(r=ie(r),Array.isArray(s))for(let e=0,n=s.length;e<n;e++)t.push(`${r}=${ie(s[e])}`);else{let e=r;(s||"string"==typeof s)&&(e+=`=${ie(s)}`),t.push(e)}}return t.join("&")}(e.query||{});c&&(o+=`?${c}`),e.fragment&&(o+=`#${e.fragment}`);let u="";if(null!=e.username||null!=e.password){u=`${e.username??""}:${e.password??""}@`}const{port:d,method:l}=e,h=`${e.protocol}//${u}${e.hostname}${d?`:${d}`:""}${o}`,f="GET"===l||"HEAD"===l?void 0:e.body,p={body:f,headers:new Headers(e.headers),method:l,credentials:i};this.config?.cache&&(p.cache=this.config.cache),f&&(p.duplex="half"),"undefined"!=typeof AbortController&&(p.signal=t),ue.supported&&(p.keepalive=n),"function"==typeof this.config.requestInit&&Object.assign(p,this.config.requestInit(e));let m=()=>{};const g=ae(h,p),y=[fetch(g).then(e=>{const t=e.headers,r={};for(const s of t.entries())r[s[0]]=s[1];return null!=e.body?{response:new a({headers:r,reason:e.statusText,statusCode:e.status,body:e.body})}:e.blob().then(t=>({response:new a({headers:r,reason:e.statusText,statusCode:e.status,body:t})}))}),ce(s)];return t&&y.push(new Promise((e,r)=>{const s=()=>{const e=le(t);r(e)};if("function"==typeof t.addEventListener){const e=t;e.addEventListener("abort",s,{once:!0}),m=()=>e.removeEventListener("abort",s)}else t.onabort=s})),Promise.race(y).finally(m)}updateHttpClientConfig(e,t){this.config=void 0,this.configProvider=this.configProvider.then(r=>(r[e]=t,r))}httpHandlerConfigs(){return this.config??{}}}function le(e){const t=e&&"object"==typeof e&&"reason"in e?e.reason:void 0;if(t){if(t instanceof Error){const e=new Error("Request aborted");return e.name="AbortError",e.cause=t,e}const e=new Error(String(t));return e.name="AbortError",e}const r=new Error("Request aborted");return r.name="AbortError",r}const he=async e=>"function"==typeof Blob&&e instanceof Blob||"Blob"===e.constructor?.name?void 0!==Blob.prototype.arrayBuffer?new Uint8Array(await e.arrayBuffer()):async function(e){const t=await function(e){return new Promise((t,r)=>{const s=new FileReader;s.onloadend=()=>{if(2!==s.readyState)return r(new Error("Reader aborted too early"));const e=s.result??"",n=e.indexOf(","),i=n>-1?n+1:e.length;t(e.substring(i))},s.onabort=()=>r(new Error("Read aborted")),s.onerror=()=>r(s.error),s.readAsDataURL(e)})}(e),r=F(t);return new Uint8Array(r)}(e):async function(e){const t=[],r=e.getReader();let s=!1,n=0;for(;!s;){const{done:e,value:i}=await r.read();i&&(t.push(i),n+=i.length),s=e}const i=new Uint8Array(n);let o=0;for(const a of t)i.set(a,o),o+=a.length;return i}(e);const fe={},pe={};for(let Yh=0;Yh<256;Yh++){let e=Yh.toString(16).toLowerCase();1===e.length&&(e=`0${e}`),fe[Yh]=e,pe[e]=Yh}function me(e){if(e.length%2!=0)throw new Error("Hex encoded strings must have an even number length");const t=new Uint8Array(e.length/2);for(let r=0;r<e.length;r+=2){const s=e.slice(r,r+2).toLowerCase();if(!(s in pe))throw new Error(`Cannot decode unrecognized sequence ${s} as hexadecimal`);t[r/2]=pe[s]}return t}function ge(e){let t="";for(let r=0;r<e.byteLength;r++)t+=fe[e[r]];return t}const ye="The stream has already been transformed.",we=e=>{if(!be(e)&&!Q(e)){throw new Error(`Unexpected stream implementation, expect Blob or ReadableStream, got ${e?.__proto__?.constructor?.name||e}`)}let t=!1;const r=async()=>{if(t)throw new Error(ye);return t=!0,await he(e)};return Object.assign(e,{transformToByteArray:r,transformToString:async e=>{const t=await r();if("base64"===e)return G(t);if("hex"===e)return ge(t);if(void 0===e||"utf8"===e||"utf-8"===e)return W(t);if("function"==typeof TextDecoder)return new TextDecoder(e).decode(t);throw new Error("TextDecoder is not available, please make sure polyfill is provided.")},transformToWebStream:()=>{if(t)throw new Error(ye);if(t=!0,be(e))return(e=>{if("function"!=typeof e.stream)throw new Error("Cannot transform payload Blob to web stream. Please make sure the Blob.stream() is polyfilled.\nIf you are using React Native, this API is not yet supported, see: https://react-native.canny.io/feature-requests/p/fetch-streaming-body");return e.stream()})(e);if(Q(e))return e;throw new Error(`Cannot transform payload to web stream, got ${e}`)}})},be=e=>"function"==typeof Blob&&e instanceof Blob,Se=e=>e===g.MD5?"content-md5":`x-amz-checksum-${e.toLowerCase()}`,ve=e=>"function"==typeof ArrayBuffer&&e instanceof ArrayBuffer||"[object ArrayBuffer]"===Object.prototype.toString.call(e),Ee=e=>void 0!==e&&"string"!=typeof e&&!ArrayBuffer.isView(e)&&!ve(e);function Ce(e,t,r,s){return new(r||(r=Promise))(function(n,i){function o(e){try{c(s.next(e))}catch(t){i(t)}}function a(e){try{c(s.throw(e))}catch(t){i(t)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(o,a)}c((s=s.apply(e,t||[])).next())})}function Ae(e,t){var r,s,n,i={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=a(0),o.throw=a(1),o.return=a(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(c){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(i=0)),i;)try{if(r=1,s&&(n=2&a[0]?s.return:a[0]?s.throw||((n=s.return)&&n.call(s),0):s.next)&&!(n=n.call(s,a[1])).done)return n;switch(s=0,n&&(a=[2&a[0],n.value]),a[0]){case 0:case 1:n=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,s=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(n=i.trys,(n=n.length>0&&n[n.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!n||a[1]>n[0]&&a[1]<n[3])){i.label=a[1];break}if(6===a[0]&&i.label<n[1]){i.label=n[1],n=a;break}if(n&&i.label<n[2]){i.label=n[2],i.ops.push(a);break}n[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(c){a=[6,c],s=0}finally{r=n=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}function xe(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],s=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&s>=e.length&&(e=void 0),{value:e&&e[s++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}"function"==typeof SuppressedError&&SuppressedError;var ke="undefined"!=typeof Buffer&&Buffer.from?function(e){return Buffer.from(e,"utf8")}:e=>(new TextEncoder).encode(e);function Re(e){return e instanceof Uint8Array?e:"string"==typeof e?ke(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e)}function Te(e){return"string"==typeof e?0===e.length:0===e.byteLength}function Pe(e){return new Uint8Array([(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e])}function Ie(e){if(!Uint32Array.from){for(var t=new Uint32Array(e.length),r=0;r<e.length;)t[r]=e[r],r+=1;return t}return Uint32Array.from(e)}var Me=function(){function e(){this.crc32c=new Ne}return e.prototype.update=function(e){Te(e)||this.crc32c.update(Re(e))},e.prototype.digest=function(){return Ce(this,void 0,void 0,function(){return Ae(this,function(e){return[2,Pe(this.crc32c.digest())]})})},e.prototype.reset=function(){this.crc32c=new Ne},e}(),Ne=function(){function e(){this.checksum=4294967295}return e.prototype.update=function(e){var t,r;try{for(var s=xe(e),n=s.next();!n.done;n=s.next()){var i=n.value;this.checksum=this.checksum>>>8^Oe[255&(this.checksum^i)]}}catch(o){t={error:o}}finally{try{n&&!n.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}return this},e.prototype.digest=function(){return(4294967295^this.checksum)>>>0},e}(),Oe=Ie([0,4067132163,3778769143,324072436,3348797215,904991772,648144872,3570033899,2329499855,2024987596,1809983544,2575936315,1296289744,3207089363,2893594407,1578318884,274646895,3795141740,4049975192,51262619,3619967088,632279923,922689671,3298075524,2592579488,1760304291,2075979607,2312596564,1562183871,2943781820,3156637768,1313733451,549293790,3537243613,3246849577,871202090,3878099393,357341890,102525238,4101499445,2858735121,1477399826,1264559846,3107202533,1845379342,2677391885,2361733625,2125378298,820201905,3263744690,3520608582,598981189,4151959214,85089709,373468761,3827903834,3124367742,1213305469,1526817161,2842354314,2107672161,2412447074,2627466902,1861252501,1098587580,3004210879,2688576843,1378610760,2262928035,1955203488,1742404180,2511436119,3416409459,969524848,714683780,3639785095,205050476,4266873199,3976438427,526918040,1361435347,2739821008,2954799652,1114974503,2529119692,1691668175,2005155131,2247081528,3690758684,697762079,986182379,3366744552,476452099,3993867776,4250756596,255256311,1640403810,2477592673,2164122517,1922457750,2791048317,1412925310,1197962378,3037525897,3944729517,427051182,170179418,4165941337,746937522,3740196785,3451792453,1070968646,1905808397,2213795598,2426610938,1657317369,3053634322,1147748369,1463399397,2773627110,4215344322,153784257,444234805,3893493558,1021025245,3467647198,3722505002,797665321,2197175160,1889384571,1674398607,2443626636,1164749927,3070701412,2757221520,1446797203,137323447,4198817972,3910406976,461344835,3484808360,1037989803,781091935,3705997148,2460548119,1623424788,1939049696,2180517859,1429367560,2807687179,3020495871,1180866812,410100952,3927582683,4182430767,186734380,3756733383,763408580,1053836080,3434856499,2722870694,1344288421,1131464017,2971354706,1708204729,2545590714,2229949006,1988219213,680717673,3673779818,3383336350,1002577565,4010310262,493091189,238226049,4233660802,2987750089,1082061258,1395524158,2705686845,1972364758,2279892693,2494862625,1725896226,952904198,3399985413,3656866545,731699698,4283874585,222117402,510512622,3959836397,3280807620,837199303,582374963,3504198960,68661723,4135334616,3844915500,390545967,1230274059,3141532936,2825850620,1510247935,2395924756,2091215383,1878366691,2644384480,3553878443,565732008,854102364,3229815391,340358836,3861050807,4117890627,119113024,1493875044,2875275879,3090270611,1247431312,2660249211,1828433272,2141937292,2378227087,3811616794,291187481,34330861,4032846830,615137029,3603020806,3314634738,939183345,1776939221,2609017814,2295496738,2058945313,2926798794,1545135305,1330124605,3173225534,4084100981,17165430,307568514,3762199681,888469610,3332340585,3587147933,665062302,2042050490,2346497209,2559330125,1793573966,3190661285,1279665062,1595330642,2910671697]);let $e,Ue,De,_e,Le,Be,ze,je,He;const qe=()=>{$e||($e=(()=>{const e=new Array(8);for(let t=0;t<8;t++){const r=new Array(512);for(let e=0;e<256;e++){let s=BigInt(e);for(let e=0;e<8*(t+1);e++)1n&s?s=s>>1n^0x9a6c9329ac4bc9b5n:s>>=1n;r[2*e]=Number(s>>32n&0xffffffffn),r[2*e+1]=Number(0xffffffffn&s)}e[t]=new Uint32Array(r)}return e})(),[Ue,De,_e,Le,Be,ze,je,He]=$e)};class Fe{c1=0;c2=0;constructor(){qe(),this.reset()}update(e){const t=e.length;let r=0,s=this.c1,n=this.c2;for(;r+8<=t;){const t=(255&(n^e[r++]))<<1,i=(255&(n>>>8^e[r++]))<<1,o=(255&(n>>>16^e[r++]))<<1,a=(255&(n>>>24^e[r++]))<<1,c=(255&(s^e[r++]))<<1,u=(255&(s>>>8^e[r++]))<<1,d=(255&(s>>>16^e[r++]))<<1,l=(255&(s>>>24^e[r++]))<<1;s=He[t]^je[i]^ze[o]^Be[a]^Le[c]^_e[u]^De[d]^Ue[l],n=He[t+1]^je[i+1]^ze[o+1]^Be[a+1]^Le[c+1]^_e[u+1]^De[d+1]^Ue[l+1]}for(;r<t;){const t=(255&(n^e[r]))<<1;n=(n>>>8|(255&s)<<24)>>>0,s=s>>>8^Ue[t],n^=Ue[t+1],r++}this.c1=s,this.c2=n}async digest(){const e=4294967295^this.c1,t=4294967295^this.c2;return new Uint8Array([e>>>24,e>>>16&255,e>>>8&255,255&e,t>>>24,t>>>16&255,t>>>8&255,255&t])}reset(){this.c1=4294967295,this.c2=4294967295}}var Ke=function(){function e(){this.crc32=new Ve}return e.prototype.update=function(e){Te(e)||this.crc32.update(Re(e))},e.prototype.digest=function(){return Ce(this,void 0,void 0,function(){return Ae(this,function(e){return[2,Pe(this.crc32.digest())]})})},e.prototype.reset=function(){this.crc32=new Ve},e}(),Ve=function(){function e(){this.checksum=4294967295}return e.prototype.update=function(e){var t,r;try{for(var s=xe(e),n=s.next();!n.done;n=s.next()){var i=n.value;this.checksum=this.checksum>>>8^We[255&(this.checksum^i)]}}catch(o){t={error:o}}finally{try{n&&!n.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}return this},e.prototype.digest=function(){return(4294967295^this.checksum)>>>0},e}(),We=Ie([0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117]);const Ge=[g.CRC32,g.CRC32C,g.CRC64NVME,g.SHA1,g.SHA256],Xe=[g.SHA256,g.SHA1,g.CRC32,g.CRC32C,g.CRC64NVME],Ye=(e,t)=>{const{checksumAlgorithms:r={}}=t;switch(e){case g.MD5:return r?.MD5??t.md5;case g.CRC32:return r?.CRC32??Ke;case g.CRC32C:return r?.CRC32C??Me;case g.CRC64NVME:return r?.CRC64NVME??Fe;case g.SHA1:return r?.SHA1??t.sha1;case g.SHA256:return r?.SHA256??t.sha256;default:if(r?.[e])return r[e];throw new Error(`The checksum algorithm "${e}" is not supported by the client. Select one of ${Ge}, or provide an implementation to the client constructor checksums field.`)}},Je=(e,t)=>{const r=new e;return r.update(V(t||"")),r.digest()},Qe={name:"flexibleChecksumsMiddleware",step:"build",tags:["BODY_CHECKSUM"],override:!0},Ze=(e,t)=>(r,s)=>async n=>{if(!o.isInstance(n.request))return r(n);if(((e,t)=>{const r=e.toLowerCase();for(const s of Object.keys(t))if(s.toLowerCase().startsWith(r))return!0;return!1})("x-amz-checksum-",n.request.headers))return r(n);const{request:i,input:a}=n,{body:c,headers:u}=i,{base64Encoder:l,streamHasher:h}=e,{requestChecksumRequired:f,requestAlgorithmMember:p}=t,m=await e.requestChecksumCalculation(),y=p?.name,w=p?.httpHeader;y&&!a[y]&&(m===d||f)&&(a[y]=S,w&&(u[w]=S));const b=((e,{requestChecksumRequired:t,requestAlgorithmMember:r,requestChecksumCalculation:s})=>{if(!r)return s===d||t?S:void 0;if(!e[r])return;return e[r]})(a,{requestChecksumRequired:f,requestAlgorithmMember:p?.name,requestChecksumCalculation:m});let v=c,E=u;if(b){switch(b){case g.CRC32:z(s,"FLEXIBLE_CHECKSUMS_REQ_CRC32","U");break;case g.CRC32C:z(s,"FLEXIBLE_CHECKSUMS_REQ_CRC32C","V");break;case g.CRC64NVME:z(s,"FLEXIBLE_CHECKSUMS_REQ_CRC64","W");break;case g.SHA1:z(s,"FLEXIBLE_CHECKSUMS_REQ_SHA1","X");break;case g.SHA256:z(s,"FLEXIBLE_CHECKSUMS_REQ_SHA256","Y")}const t=Se(b),r=Ye(b,e);if(Ee(c)){const{getAwsChunkedEncodingStream:n,bodyLengthChecker:i}=e;v=n("number"==typeof e.requestStreamBufferSize&&e.requestStreamBufferSize>=8192?te(c,e.requestStreamBufferSize,s.logger):c,{base64Encoder:l,bodyLengthChecker:i,checksumLocationName:t,checksumAlgorithmFn:r,streamHasher:h}),E={...u,"content-encoding":u["content-encoding"]?`${u["content-encoding"]},aws-chunked`:"aws-chunked","transfer-encoding":"chunked","x-amz-decoded-content-length":u["content-length"],"x-amz-content-sha256":"STREAMING-UNSIGNED-PAYLOAD-TRAILER","x-amz-trailer":t},delete E["content-length"]}else if(!((e,t)=>{const r=e.toLowerCase();for(const s of Object.keys(t))if(r===s.toLowerCase())return!0;return!1})(t,u)){const e=await Je(r,c);E={...u,[t]:l(e)}}}try{return await r({...n,request:{...i,headers:E,body:v}})}catch(C){if(C instanceof Error&&"InvalidChunkSizeError"===C.name)try{C.message.endsWith(".")||(C.message+="."),C.message+=" Set [requestStreamBufferSize=number e.g. 65_536] in client constructor to instruct AWS SDK to buffer your input stream."}catch(A){}throw C}},et={name:"flexibleChecksumsInputMiddleware",toMiddleware:"serializerMiddleware",relation:"before",tags:["BODY_CHECKSUM"],override:!0},tt=(e=[])=>{const t=[];let r=Xe.length;for(const s of e){const e=Xe.indexOf(s);-1!==e?t[e]=s:t[r++]=s}return t.filter(Boolean)},rt=async(e,{checksumAlgorithmFn:t,base64Encoder:r})=>r(await Je(t,e)),st={name:"flexibleChecksumsResponseMiddleware",toMiddleware:"deserializerMiddleware",relation:"after",tags:["BODY_CHECKSUM"],override:!0},nt=(e,t)=>(r,s)=>async n=>{if(!o.isInstance(n.request))return r(n);const i=n.input,a=await r(n),c=a.response,{requestValidationModeMember:u,responseAlgorithms:d}=t;if(u&&"ENABLED"===i[u]){const{clientName:t,commandName:r}=s,n=Object.keys(e.checksumAlgorithms??{}).filter(e=>{const t=Se(e);return void 0!==c.headers[t]}),i=tt([...d??[],...n]);if("S3Client"===t&&"GetObjectCommand"===r&&i.every(e=>{const t=Se(e),r=c.headers[t];return!r||(e=>{const t=e.lastIndexOf("-");if(-1!==t){const r=e.slice(t+1);if(!r.startsWith("0")){const e=parseInt(r,10);if(!isNaN(e)&&e>=1&&e<=1e4)return!0}}return!1})(r)}))return a;await(async(e,{config:t,responseAlgorithms:r,logger:s})=>{const n=tt(r),{body:i,headers:o}=e;for(const c of n){const r=Se(c),n=o[r];if(n){let o;try{o=Ye(c,t)}catch(a){if(c===g.CRC64NVME){s?.warn(`Skipping ${g.CRC64NVME} checksum validation: ${a.message}`);continue}throw a}const{base64Encoder:u}=t;if(Ee(i))return void(e.body=Z({expectedChecksum:n,checksumSourceLocation:r,checksum:new o,source:i,base64Encoder:u}));const d=await rt(i,{checksumAlgorithmFn:o,base64Encoder:u});if(d===n)break;throw new Error(`Checksum mismatch: expected "${d}" but received "${n}" in response header "${r}".`)}}})(c,{config:e,responseAlgorithms:i,logger:s.logger})}return a},it=(e,t)=>({applyToStack:r=>{r.add(Ze(e,t),Qe),r.addRelativeTo(((e,t)=>(r,s)=>async n=>{const i=n.input,{requestValidationModeMember:o}=t,a=await e.requestChecksumCalculation(),c=await e.responseChecksumValidation();switch(a){case l:z(s,"FLEXIBLE_CHECKSUMS_REQ_WHEN_REQUIRED","a");break;case d:z(s,"FLEXIBLE_CHECKSUMS_REQ_WHEN_SUPPORTED","Z")}switch(c){case p:z(s,"FLEXIBLE_CHECKSUMS_RES_WHEN_REQUIRED","c");break;case f:z(s,"FLEXIBLE_CHECKSUMS_RES_WHEN_SUPPORTED","b")}return o&&!i[o]&&c===f&&(i[o]="ENABLED"),r(n)})(e,t),et),r.addRelativeTo(nt(e,t),st)}}),ot=e=>e[i]||(e[i]={}),at=e=>{if("function"==typeof e)return e;const t=Promise.resolve(e);return()=>t};const ct={name:"hostHeaderMiddleware",step:"build",priority:"low",tags:["HOST"],override:!0},ut=e=>({applyToStack:t=>{t.add((e=>t=>async r=>{if(!o.isInstance(r.request))return t(r);const{request:s}=r,{handlerProtocol:n=""}=e.requestHandler.metadata||{};if(n.indexOf("h2")>=0&&!s.headers[":authority"])delete s.headers.host,s.headers[":authority"]=s.hostname+(s.port?":"+s.port:"");else if(!s.headers.host){let e=s.hostname;null!=s.port&&(e+=`:${s.port}`),s.headers.host=e}return t(r)})(e),ct)}}),dt={name:"loggerMiddleware",tags:["LOGGER"],step:"initialize",override:!0},lt={step:"build",tags:["RECURSION_DETECTION"],name:"recursionDetectionMiddleware",override:!0,priority:"low"},ht=(e,t)=>{const r=[];if(e&&r.push(e),t)for(const s of t)r.push(s);return r},ft=(e,t)=>`${e||"anonymous"}${t&&t.length>0?` (a.k.a. ${t.join(",")})`:""}`,pt=()=>{let e=[],t=[],r=!1;const s=/* @__PURE__ */new Set,n=r=>(e.forEach(e=>{r.add(e.middleware,{...e})}),t.forEach(e=>{r.addRelativeTo(e.middleware,{...e})}),r.identifyOnResolve?.(a.identifyOnResolve()),r),i=e=>{const t=[];return e.before.forEach(e=>{0===e.before.length&&0===e.after.length?t.push(e):t.push(...i(e))}),t.push(e),e.after.reverse().forEach(e=>{0===e.before.length&&0===e.after.length?t.push(e):t.push(...i(e))}),t},o=(r=!1)=>{const s=[],n=[],o={};e.forEach(e=>{const t={...e,before:[],after:[]};for(const r of ht(t.name,t.aliases))o[r]=t;s.push(t)}),t.forEach(e=>{const t={...e,before:[],after:[]};for(const r of ht(t.name,t.aliases))o[r]=t;n.push(t)}),n.forEach(e=>{if(e.toMiddleware){const t=o[e.toMiddleware];if(void 0===t){if(r)return;throw new Error(`${e.toMiddleware} is not found when adding ${ft(e.name,e.aliases)} middleware ${e.relation} ${e.toMiddleware}`)}"after"===e.relation&&t.after.push(e),"before"===e.relation&&t.before.push(e)}});var a;return(a=s,a.sort((e,t)=>mt[t.step]-mt[e.step]||gt[t.priority||"normal"]-gt[e.priority||"normal"])).map(i).reduce((e,t)=>(e.push(...t),e),[])},a={add:(t,r={})=>{const{name:n,override:i,aliases:o}=r,a={step:"initialize",priority:"normal",middleware:t,...r},c=ht(n,o);if(c.length>0){if(c.some(e=>s.has(e))){if(!i)throw new Error(`Duplicate middleware name '${ft(n,o)}'`);for(const t of c){const r=e.findIndex(e=>e.name===t||e.aliases?.some(e=>e===t));if(-1===r)continue;const s=e[r];if(s.step!==a.step||a.priority!==s.priority)throw new Error(`"${ft(s.name,s.aliases)}" middleware with ${s.priority} priority in ${s.step} step cannot be overridden by "${ft(n,o)}" middleware with ${a.priority} priority in ${a.step} step.`);e.splice(r,1)}}for(const e of c)s.add(e)}e.push(a)},addRelativeTo:(e,r)=>{const{name:n,override:i,aliases:o}=r,a={middleware:e,...r},c=ht(n,o);if(c.length>0){if(c.some(e=>s.has(e))){if(!i)throw new Error(`Duplicate middleware name '${ft(n,o)}'`);for(const e of c){const r=t.findIndex(t=>t.name===e||t.aliases?.some(t=>t===e));if(-1===r)continue;const s=t[r];if(s.toMiddleware!==a.toMiddleware||s.relation!==a.relation)throw new Error(`"${ft(s.name,s.aliases)}" middleware ${s.relation} "${s.toMiddleware}" middleware cannot be overridden by "${ft(n,o)}" middleware ${a.relation} "${a.toMiddleware}" middleware.`);t.splice(r,1)}}for(const e of c)s.add(e)}t.push(a)},clone:()=>n(pt()),use:e=>{e.applyToStack(a)},remove:r=>"string"==typeof r?(r=>{let n=!1;const i=e=>{const t=ht(e.name,e.aliases);if(t.includes(r)){n=!0;for(const e of t)s.delete(e);return!1}return!0};return e=e.filter(i),t=t.filter(i),n})(r):(r=>{let n=!1;const i=e=>{if(e.middleware===r){n=!0;for(const t of ht(e.name,e.aliases))s.delete(t);return!1}return!0};return e=e.filter(i),t=t.filter(i),n})(r),removeByTag:r=>{let n=!1;const i=e=>{const{tags:t,name:i,aliases:o}=e;if(t&&t.includes(r)){const e=ht(i,o);for(const t of e)s.delete(t);return n=!0,!1}return!0};return e=e.filter(i),t=t.filter(i),n},concat:e=>{const t=n(pt());return t.use(e),t.identifyOnResolve(r||t.identifyOnResolve()||(e.identifyOnResolve?.()??!1)),t},applyToStack:n,identify:()=>o(!0).map(e=>{const t=e.step??e.relation+" "+e.toMiddleware;return ft(e.name,e.aliases)+" - "+t}),identifyOnResolve:e=>("boolean"==typeof e&&(r=e),r),resolve:(e,t)=>{for(const r of o().map(e=>e.middleware).reverse())e=r(e,t);return r&&console.log(a.identify()),e}};return a},mt={initialize:5,serialize:4,build:3,finalizeRequest:2,deserialize:1},gt={high:3,normal:2,low:1};class yt{config;middlewareStack=pt();initConfig;handlers;constructor(e){this.config=e;const{protocol:t,protocolSettings:r}=e;r&&"function"==typeof t&&(e.protocol=new t(r))}send(e,t,r){const s="function"!=typeof t?t:void 0,n="function"==typeof t?t:r;let i;if(void 0===s&&!0===this.config.cacheMiddleware){this.handlers||(this.handlers=/* @__PURE__ */new WeakMap);const t=this.handlers;t.has(e.constructor)?i=t.get(e.constructor):(i=e.resolveMiddleware(this.middlewareStack,this.config,s),t.set(e.constructor,i))}else delete this.handlers,i=e.resolveMiddleware(this.middlewareStack,this.config,s);if(!n)return i(e).then(e=>e.output);i(e).then(e=>n(null,e.output),e=>n(e)).catch(()=>{})}destroy(){this.config?.requestHandler?.destroy?.(),delete this.handlers}}const wt=async(e=new Uint8Array,t)=>{if(e instanceof Uint8Array)return X.mutate(e);if(!e)return X.mutate(new Uint8Array);const r=t.streamCollector(e);return X.mutate(await r)};function bt(e){return encodeURIComponent(e).replace(/[!'()*]/g,function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})}const St=e=>"function"==typeof e?e():e,vt=(e,t,r,s,n)=>({name:t,namespace:e,traits:r,input:s,output:n}),Et=(e,t)=>(t.find(([t])=>t.match(e))||[void 0,void 0])[1];const Ct=e=>{if("string"==typeof e)return Ct(new URL(e));const{hostname:t,pathname:r,port:s,protocol:n,search:i}=e;let o;return i&&(o=function(e){const t={};if(e=e.replace(/^\?/,""))for(const r of e.split("&")){let[e,s=null]=r.split("=");e=decodeURIComponent(e),s&&(s=decodeURIComponent(s)),e in t?Array.isArray(t[e])?t[e].push(s):t[e]=[t[e],s]:t[e]=s}return t}(i)),{hostname:t,port:s?parseInt(s):void 0,protocol:n,path:r,query:o}},At=e=>(t,r)=>async s=>{const{operationSchema:n}=ot(r),[,i,o,a,c,u]=n??[],d=r.endpointV2?async()=>(e=>{if("object"==typeof e){if("url"in e){const t=Ct(e.url);if(e.headers){t.headers={};for(const r in e.headers)t.headers[r.toLowerCase()]=e.headers[r].join(", ")}return t}return e}return Ct(e)})(r.endpointV2):e.endpoint,l=await e.protocol.serializeRequest(vt(i,o,a,c,u),s.input,{...e,...r,endpoint:d});return t({...s,request:l})},xt={name:"deserializerMiddleware",step:"deserialize",tags:["DESERIALIZER"],override:!0},kt={name:"serializerMiddleware",step:"serialize",tags:["SERIALIZER"],override:!0};function Rt(e){return{applyToStack:t=>{t.add(At(e),kt),t.add((e=>(t,r)=>async s=>{const{response:n}=await t(s),{operationSchema:i}=ot(r),[,o,c,u,d,l]=i??[];try{return{response:n,output:await e.protocol.deserializeResponse(vt(o,c,u,d,l),{...e,...r},n)}}catch(h){if(Object.defineProperty(h,"$response",{value:n,enumerable:!1,writable:!1,configurable:!1}),!("$metadata"in h)){const e="Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.";try{h.message+="\n "+e}catch(f){r.logger&&"NoOpLogger"!==r.logger?.constructor?.name?r.logger?.warn?.(e):console.warn(e)}void 0!==h.$responseBodyText&&h.$response&&(h.$response.body=h.$responseBodyText);try{if(a.isInstance(n)){const{headers:e={}}=n,t=Object.entries(e);h.$metadata={httpStatusCode:n.statusCode,requestId:Et(/^x-[\w-]+-request-?id$/,t),extendedRequestId:Et(/^x-[\w-]+-id-2$/,t),cfId:Et(/^x-[\w-]+-cf-id$/,t)}}}catch(f){}}throw h}})(e),xt),e.protocol.setSerdeContext(e)}}}const Tt=[];function Pt(e){if("object"==typeof e)return e;if(Tt[e|=0])return Tt[e];const t={};let r=0;for(const s of["httpLabel","idempotent","idempotencyToken","sensitive","httpPayload","httpResponseCode","httpQueryParams"])1==(e>>r++&1)&&(t[s]=1);return Tt[e]=t}const It=/* @__PURE__ */Symbol.for("@smithy/nor-struct-it"),Mt=/* @__PURE__ */Symbol.for("@smithy/ns"),Nt=[],Ot={};class $t{ref;memberName;static symbol=/* @__PURE__ */Symbol.for("@smithy/nor");symbol=$t.symbol;name;schema;_isMemberSchema;traits;memberTraits;normalizedTraits;constructor(e,t){this.ref=e,this.memberName=t;const r=[];let s=e,n=e;for(this._isMemberSchema=!1;Dt(s);)r.push(s[1]),s=s[0],n=St(s),this._isMemberSchema=!0;if(r.length>0){this.memberTraits={};for(let e=r.length-1;e>=0;--e){const t=r[e];Object.assign(this.memberTraits,Pt(t))}}else this.memberTraits=0;if(n instanceof $t){const e=this.memberTraits;return Object.assign(this,n),this.memberTraits=Object.assign({},e,n.getMemberTraits(),this.getMemberTraits()),this.normalizedTraits=void 0,void(this.memberName=t??n.memberName)}if(this.schema=St(n),_t(this.schema)?(this.name=`${this.schema[1]}#${this.schema[2]}`,this.traits=this.schema[3]):(this.name=this.memberName??String(n),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){const t=this.prototype.isPrototypeOf(e);if(!t&&"object"==typeof e&&null!==e){return e.symbol===this.symbol}return t}static of(e){const t="function"==typeof e||"object"==typeof e&&null!==e;if("number"==typeof e){if(Nt[e])return Nt[e]}else if("string"==typeof e){if(Ot[e])return Ot[e]}else if(t&&e[Mt])return e[Mt];const r=St(e);if(r instanceof $t)return r;if(Dt(r)){const[t,s]=r;if(t instanceof $t)return Object.assign(t.getMergedTraits(),Pt(s)),t;throw new Error(`@smithy/core/schema - may not init unwrapped member schema=${JSON.stringify(e,null,2)}.`)}const s=new $t(r);return t?e[Mt]=s:"string"==typeof r?Ot[r]=s:"number"==typeof r?Nt[r]=s:s}getSchema(){const e=this.schema;return Array.isArray(e)&&0===e[0]?e[4]:e}getName(e=!1){const{name:t}=this;return!e&&t&&t.includes("#")?t.split("#")[1]:t||void 0}getMemberName(){return this.memberName}isMemberSchema(){return this._isMemberSchema}isListSchema(){const e=this.getSchema();return"number"==typeof e?e>=64&&e<128:1===e[0]}isMapSchema(){const e=this.getSchema();return"number"==typeof e?e>=128&&e<=255:2===e[0]}isStructSchema(){const e=this.getSchema();if("object"!=typeof e)return!1;const t=e[0];return 3===t||-3===t||4===t}isUnionSchema(){const e=this.getSchema();return"object"==typeof e&&4===e[0]}isBlobSchema(){const e=this.getSchema();return 21===e||42===e}isTimestampSchema(){const e=this.getSchema();return"number"==typeof e&&e>=4&&e<=7}isUnitSchema(){return"unit"===this.getSchema()}isDocumentSchema(){return 15===this.getSchema()}isStringSchema(){return 0===this.getSchema()}isBooleanSchema(){return 2===this.getSchema()}isNumericSchema(){return 1===this.getSchema()}isBigIntegerSchema(){return 17===this.getSchema()}isBigDecimalSchema(){return 19===this.getSchema()}isStreaming(){const{streaming:e}=this.getMergedTraits();return!!e||42===this.getSchema()}isIdempotencyToken(){return!!this.getMergedTraits().idempotencyToken}getMergedTraits(){return this.normalizedTraits??(this.normalizedTraits={...this.getOwnTraits(),...this.getMemberTraits()})}getMemberTraits(){return Pt(this.memberTraits)}getOwnTraits(){return Pt(this.traits)}getKeySchema(){const[e,t]=[this.isDocumentSchema(),this.isMapSchema()];if(!e&&!t)throw new Error(`@smithy/core/schema - cannot get key for non-map: ${this.getName(!0)}`);const r=this.getSchema();return Ut([e?15:r[4]??0,0],"key")}getValueSchema(){const e=this.getSchema(),[t,r,s]=[this.isDocumentSchema(),this.isMapSchema(),this.isListSchema()],n="number"==typeof e?63&e:e&&"object"==typeof e&&(r||s)?e[3+e[0]]:t?15:void 0;if(null!=n)return Ut([n,0],r?"value":"member");throw new Error(`@smithy/core/schema - ${this.getName(!0)} has no value member.`)}getMemberSchema(e){const t=this.getSchema();if(this.isStructSchema()&&t[4].includes(e)){const r=t[4].indexOf(e),s=t[5][r];return Ut(Dt(s)?s:[s,0],e)}if(this.isDocumentSchema())return Ut([15,0],e);throw new Error(`@smithy/core/schema - ${this.getName(!0)} has no member=${e}.`)}getMemberSchemas(){const e={};try{for(const[t,r]of this.structIterator())e[t]=r}catch(t){}return e}getEventStreamMember(){if(this.isStructSchema())for(const[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.");const e=this.getSchema(),t=e[4].length;let r=e[It];if(r&&t===r.length)yield*r;else{r=Array(t);for(let s=0;s<t;++s){const t=e[4][s],n=Ut([e[5][s],0],t);yield r[s]=[t,n]}e[It]=r}}}function Ut(e,t){if(e instanceof $t)return Object.assign(e,{memberName:t,_isMemberSchema:!0});return new $t(e,t)}const Dt=e=>Array.isArray(e)&&2===e.length,_t=e=>Array.isArray(e)&&e.length>=5;class Lt{namespace;schemas;exceptions;static registries=/* @__PURE__ */new Map;constructor(e,t=/* @__PURE__ */new Map,r=/* @__PURE__ */new Map){this.namespace=e,this.schemas=t,this.exceptions=r}static for(e){return Lt.registries.has(e)||Lt.registries.set(e,new Lt(e)),Lt.registries.get(e)}copyFrom(e){const{schemas:t,exceptions:r}=this;for(const[s,n]of e.schemas)t.has(s)||t.set(s,n);for(const[s,n]of e.exceptions)r.has(s)||r.set(s,n)}register(e,t){const r=this.normalizeShapeId(e);for(const s of[this,Lt.for(r.split("#")[0])])s.schemas.set(r,t)}getSchema(e){const t=this.normalizeShapeId(e);if(!this.schemas.has(t))throw new Error(`@smithy/core/schema - schema not found for ${t}`);return this.schemas.get(t)}registerError(e,t){const r=e,s=r[1];for(const n of[this,Lt.for(s)])n.schemas.set(s+"#"+r[2],r),n.exceptions.set(r,t)}getErrorCtor(e){const t=e;if(this.exceptions.has(t))return this.exceptions.get(t);return Lt.for(t[1]).exceptions.get(t)}getBaseException(){for(const e of this.exceptions.keys())if(Array.isArray(e)){const[,t,r]=e,s=t+"#"+r;if(s.startsWith("smithy.ts.sdk.synthetic.")&&s.endsWith("ServiceException"))return e}}find(e){for(const 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}}const Bt=Math.ceil(2**127*(2-2**-23)),zt=e=>{const t=(e=>{if(null!=e){if("string"==typeof e){const t=parseFloat(e);if(!Number.isNaN(t))return String(t)!==String(e)&&Xt.warn(Gt(`Expected number but observed string: ${e}`)),t}if("number"==typeof e)return e;throw new TypeError(`Expected number, got ${typeof e}: ${e}`)}})(e);if(void 0!==t&&!Number.isNaN(t)&&t!==1/0&&t!==-1/0&&Math.abs(t)>Bt)throw new TypeError(`Expected 32-bit float, got ${e}`);return t},jt=e=>qt(e,16),Ht=e=>qt(e,8),qt=(e,t)=>{const r=(e=>{if(null!=e){if(Number.isInteger(e)&&!Number.isNaN(e))return e;throw new TypeError(`Expected integer, got ${typeof e}: ${e}`)}})(e);if(void 0!==r&&Ft(r,t)!==r)throw new TypeError(`Expected ${t}-bit integer, got ${e}`);return r},Ft=(e,t)=>{switch(t){case 32:return Int32Array.of(e)[0];case 16:return Int16Array.of(e)[0];case 8:return Int8Array.of(e)[0]}},Kt=/(-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?)|(-?Infinity)|(NaN)/g,Vt=e=>{const t=e.match(Kt);if(null===t||t[0].length!==e.length)throw new TypeError("Expected real number, got implicit NaN");return parseFloat(e)},Wt=e=>jt("string"==typeof e?Vt(e):e),Gt=e=>String(new TypeError(e).stack||e).split("\n").slice(0,5).filter(e=>!e.includes("stackTraceWarning")).join("\n"),Xt={warn:console.warn},Yt=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],Jt=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Qt(e){const t=e.getUTCFullYear(),r=e.getUTCMonth(),s=e.getUTCDay(),n=e.getUTCDate(),i=e.getUTCHours(),o=e.getUTCMinutes(),a=e.getUTCSeconds(),c=i<10?`0${i}`:`${i}`,u=o<10?`0${o}`:`${o}`,d=a<10?`0${a}`:`${a}`;return`${Yt[s]}, ${n<10?`0${n}`:`${n}`} ${Jt[r]} ${t} ${c}:${u}:${d} GMT`}const Zt=new RegExp(/^(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d{2}) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? GMT$/),er=new RegExp(/^(?:Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d{2})-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d{2}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? GMT$/),tr=new RegExp(/^(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( [1-9]|\d{2}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? (\d{4})$/),rr=e=>{if(null==e)return;if("string"!=typeof e)throw new TypeError("RFC-7231 date-times must be expressed as strings");let t=Zt.exec(e);if(t){const[e,r,s,n,i,o,a,c]=t;return sr(Wt(hr(n)),or(s),dr(r,"day",1,31),{hours:i,minutes:o,seconds:a,fractionalMilliseconds:c})}if(t=er.exec(e),t){const[e,r,s,n,i,o,a,c]=t;return ir(sr(nr(n),or(s),dr(r,"day",1,31),{hours:i,minutes:o,seconds:a,fractionalMilliseconds:c}))}if(t=tr.exec(e),t){const[e,r,s,n,i,o,a,c]=t;return sr(Wt(hr(c)),or(r),dr(s.trimLeft(),"day",1,31),{hours:n,minutes:i,seconds:o,fractionalMilliseconds:a})}throw new TypeError("Invalid RFC-7231 date-time value")},sr=(e,t,r,s)=>{const n=t-1;return cr(e,n,r),new Date(Date.UTC(e,n,r,dr(s.hours,"hour",0,23),dr(s.minutes,"minute",0,59),dr(s.seconds,"seconds",0,60),lr(s.fractionalMilliseconds)))},nr=e=>{const t=/* @__PURE__ */(new Date).getUTCFullYear(),r=100*Math.floor(t/100)+Wt(hr(e));return r<t?r+100:r},ir=e=>e.getTime()-/* @__PURE__ */(new Date).getTime()>15768e8?new Date(Date.UTC(e.getUTCFullYear()-100,e.getUTCMonth(),e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds())):e,or=e=>{const t=Jt.indexOf(e);if(t<0)throw new TypeError(`Invalid month: ${e}`);return t+1},ar=[31,28,31,30,31,30,31,31,30,31,30,31],cr=(e,t,r)=>{let s=ar[t];if(1===t&&ur(e)&&(s=29),r>s)throw new TypeError(`Invalid day for ${Jt[t]} in ${e}: ${r}`)},ur=e=>e%4==0&&(e%100!=0||e%400==0),dr=(e,t,r,s)=>{const n=(e=>Ht("string"==typeof e?Vt(e):e))(hr(e));if(n<r||n>s)throw new TypeError(`${t} must be between ${r} and ${s}, inclusive`);return n},lr=e=>null==e?0:1e3*(e=>zt("string"==typeof e?Vt(e):e))("0."+e),hr=e=>{let t=0;for(;t<e.length-1&&"0"===e.charAt(t);)t++;return 0===t?e:e.slice(t)},fr="undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),pr=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0")),mr=()=>{if(fr)return fr();const e=new Uint8Array(16);return crypto.getRandomValues(e),e[6]=15&e[6]|64,e[8]=63&e[8]|128,pr[e[0]]+pr[e[1]]+pr[e[2]]+pr[e[3]]+"-"+pr[e[4]]+pr[e[5]]+"-"+pr[e[6]]+pr[e[7]]+"-"+pr[e[8]]+pr[e[9]]+"-"+pr[e[10]]+pr[e[11]]+pr[e[12]]+pr[e[13]]+pr[e[14]]+pr[e[15]]},gr=function(e){return Object.assign(new String(e),{deserializeJSON:()=>JSON.parse(String(e)),toString:()=>String(e),toJSON:()=>String(e)})};function yr(e){return(e.includes(",")||e.includes('"'))&&(e=`"${e.replace(/"/g,'\\"')}"`),e}gr.from=e=>e&&"object"==typeof e&&(e instanceof gr||"deserializeJSON"in e)?e:"string"==typeof e||Object.getPrototypeOf(e)===String.prototype?gr(String(e)):gr(JSON.stringify(e)),gr.fromObject=gr.from;const wr="(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun)(?:[ne|u?r]?s?day)?",br="(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)",Sr="(\\d?\\d):(\\d{2}):(\\d{2})(?:\\.(\\d+))?",vr="(\\d?\\d)",Er="(\\d{4})",Cr=new RegExp(/^(\d{4})-(\d\d)-(\d\d)[tT](\d\d):(\d\d):(\d\d)(\.(\d+))?(([-+]\d\d:\d\d)|[zZ])$/),Ar=new RegExp(`^${wr}, ${vr} ${br} ${Er} ${Sr} GMT$`),xr=new RegExp(`^${wr}, ${vr}-${br}-(\\d\\d) ${Sr} GMT$`),kr=new RegExp(`^${wr} ${br} ( [1-9]|\\d\\d) ${Sr} ${Er}$`),Rr=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Tr(e,t,r){const s=Number(e);if(s<t||s>r)throw new Error(`Value ${s} out of range [${t}, ${r}]`)}function Pr(e,t,r){if(!Number.isInteger(r))throw new Error("Invalid number of delimiters ("+r+") for splitEvery.");const s=e.split(t),n=[];let i="";for(let o=0;o<s.length;o++)""===i?i=s[o]:i+=t+s[o],(o+1)%r===0&&(n.push(i),i="");return""!==i&&n.push(i),n}const Ir=e=>{const t=e.length,r=[];let s,n=!1,i=0;for(let o=0;o<t;++o){const t=e[o];switch(t){case'"':"\\"!==s&&(n=!n);break;case",":n||(r.push(e.slice(i,o)),i=o+1)}s=t}return r.push(e.slice(i)),r.map(e=>{const t=(e=e.trim()).length;return t<2?e:('"'===e[0]&&'"'===e[t-1]&&(e=e.slice(1,t-1)),e.replace(/\\"/g,'"'))})},Mr=/^-?\d*(\.\d+)?$/;class Nr{string;type;constructor(e,t){if(this.string=e,this.type=t,!Mr.test(e))throw new Error('@smithy/core/serde - NumericValue must only contain [0-9], at most one decimal point ".", and an optional negation prefix "-".')}toString(){return this.string}static[Symbol.hasInstance](e){if(!e||"object"!=typeof e)return!1;const t=e;return Nr.prototype.isPrototypeOf(e)||"bigDecimal"===t.type&&Mr.test(t.string)}}class Or{serdeContext;setSerdeContext(e){this.serdeContext=e}}class $r extends Or{options;compositeErrorRegistry;constructor(e){super(),this.options=e,this.compositeErrorRegistry=Lt.for(e.defaultNamespace);for(const t of e.errorTypeRegistries??[])this.compositeErrorRegistry.copyFrom(t)}getRequestType(){return o}getResponseType(){return a}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(const[r,s]of t.url.searchParams.entries())e.query[r]=s;if(t.headers)for(const r in t.headers)e.headers[r]=t.headers[r].join(", ");return e}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(const r in t.headers)e.headers[r]=t.headers[r];return e}setHostPrefix(e,t,r){if(this.serdeContext?.disableHostPrefix)return;const s=$t.of(t.input),n=Pt(t.traits??{});if(n.endpoint){let t=n.endpoint?.[0];if("string"==typeof t){for(const[e,n]of s.structIterator()){if(!n.getMergedTraits().hostLabel)continue;const s=r[e];if("string"!=typeof s)throw new Error(`@smithy/core/schema - ${e} in input must be a string as hostLabel.`);t=t.replace(`{${e}}`,s)}e.hostname=t+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(){const{EventStreamSerde:e}=await import("./index-D3VEP7BG.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,n){return[]}getEventStreamMarshaller(){const e=this.serdeContext;if(!e.eventStreamMarshaller)throw new Error("@smithy/core - HttpProtocol: eventStreamMarshaller missing in serdeContext.");return e.eventStreamMarshaller}}class Ur extends $r{async serializeRequest(e,t,r){const s=t&&"object"==typeof t?t:{},n=this.serializer,i={},a={},c=await r.endpoint(),u=$t.of(e?.input),d=[],l=[];let h,f=!1;const p=new o({protocol:"",hostname:"",port:void 0,path:"",fragment:void 0,query:i,headers:a,body:void 0});if(c){this.updateServiceEndpoint(p,c),this.setHostPrefix(p,e,s);const t=Pt(e.traits);if(t.http){p.method=t.http[0];const[e,r]=t.http[1].split("?");"/"==p.path?p.path=e:p.path+=e;const s=new URLSearchParams(r??"");for(const[t,n]of s)i[t]=n}}for(const[o,m]of u.structIterator()){const e=m.getMergedTraits()??{},t=s[o];if(null!=t||m.isIdempotencyToken())if(e.httpPayload){if(m.isStreaming()){m.isStructSchema()?s[o]&&(h=await this.serializeEventStream({eventStream:s[o],requestSchema:u})):h=t}else n.write(m,t),h=n.flush()}else if(e.httpLabel){n.write(m,t);const e=n.flush();p.path.includes(`{${o}+}`)?p.path=p.path.replace(`{${o}+}`,e.split("/").map(bt).join("/")):p.path.includes(`{${o}}`)&&(p.path=p.path.replace(`{${o}}`,bt(e)))}else if(e.httpHeader)n.write(m,t),a[e.httpHeader.toLowerCase()]=String(n.flush());else if("string"==typeof e.httpPrefixHeaders)for(const r in t){const s=t[r],i=e.httpPrefixHeaders+r;n.write([m.getValueSchema(),{httpHeader:i}],s),a[i.toLowerCase()]=n.flush()}else e.httpQuery||e.httpQueryParams?this.serializeQuery(m,t,i):(f=!0,d.push(o),l.push(m));else if(e.httpLabel&&(p.path.includes(`{${o}+}`)||p.path.includes(`{${o}}`)))throw new Error(`No value provided for input HTTP label: ${o}.`)}if(f&&s){const[e,t]=(u.getName(!0)??"#Unknown").split("#"),r=u.getSchema()[6],i=[3,e,t,u.getMergedTraits(),d,l,void 0];r?i[6]=r:i.pop(),n.write(i,s),h=n.flush()}return p.headers=a,p.query=i,p.body=h,p}serializeQuery(e,t,r){const s=this.serializer,n=e.getMergedTraits();if(n.httpQueryParams){for(const i in t)if(!(i in r)){const s=t[i],o=e.getValueSchema();Object.assign(o.getMergedTraits(),{...n,httpQuery:i,httpQueryParams:void 0}),this.serializeQuery(o,s,r)}}else if(e.isListSchema()){const i=!!e.getMergedTraits().sparse,o=[];for(const r of t){s.write([e.getValueSchema(),n],r);const t=s.flush();(i||void 0!==t)&&o.push(t)}r[n.httpQuery]=o}else s.write([e,n],t),r[n.httpQuery]=s.flush()}async deserializeResponse(e,t,r){const s=this.deserializer,n=$t.of(e.output),i={};if(r.statusCode>=300){const n=await wt(r.body,t);throw n.byteLength>0&&Object.assign(i,await s.read(15,n)),await this.handleError(e,t,r,i,this.deserializeMetadata(r)),new Error("@smithy/core/protocols - HTTP Protocol error handler failed to throw.")}for(const a in r.headers){const e=r.headers[a];delete r.headers[a],r.headers[a.toLowerCase()]=e}const o=await this.deserializeHttpMessage(n,t,r,i);if(o.length){const e=await wt(r.body,t);if(e.byteLength>0){const t=await s.read(n,e);for(const e of o)null!=t[e]&&(i[e]=t[e])}}else o.discardResponseBody&&await wt(r.body,t);return i.$metadata=this.deserializeMetadata(r),i}async deserializeHttpMessage(e,t,r,s,n){let i;i=s instanceof Set?n:s;let o=!0;const a=this.deserializer,c=$t.of(e),u=[];for(const[d,l]of c.structIterator()){const e=l.getMemberTraits();if(e.httpPayload){o=!1;if(l.isStreaming()){const e=l.isStructSchema();i[d]=e?await this.deserializeEventStream({response:r,responseSchema:c}):we(r.body)}else if(r.body){const e=await wt(r.body,t);e.byteLength>0&&(i[d]=await a.read(l,e))}}else if(e.httpHeader){const t=String(e.httpHeader).toLowerCase(),s=r.headers[t];if(null!=s)if(l.isListSchema()){const e=l.getValueSchema();let r;e.getMergedTraits().httpHeader=t,r=e.isTimestampSchema()&&4===e.getSchema()?Pr(s,",",2):Ir(s);const n=[];for(const t of r)n.push(await a.read(e,t.trim()));i[d]=n}else i[d]=await a.read(l,s)}else if(void 0!==e.httpPrefixHeaders){i[d]={};for(const t in r.headers)if(t.startsWith(e.httpPrefixHeaders)){const s=r.headers[t],n=l.getValueSchema();n.getMergedTraits().httpHeader=t,i[d][t.slice(e.httpPrefixHeaders.length)]=await a.read(n,s)}}else e.httpResponseCode?i[d]=r.statusCode:u.push(d)}return u.discardResponseBody=o,u}}function Dr(e,t){if(t.timestampFormat.useTrait&&e.isTimestampSchema()&&(5===e.getSchema()||6===e.getSchema()||7===e.getSchema()))return e.getSchema();const{httpLabel:r,httpPrefixHeaders:s,httpHeader:n,httpQuery:i}=e.getMergedTraits();return(t.httpBindings?"string"==typeof s||Boolean(n)?6:Boolean(i)||Boolean(r)?5:void 0:void 0)??t.timestampFormat.default}class _r extends Or{settings;constructor(e){super(),this.settings=e}read(e,t){const r=$t.of(e);if(r.isListSchema())return Ir(t).map(e=>this.read(r.getValueSchema(),e));if(r.isBlobSchema())return(this.serdeContext?.base64Decoder??F)(t);if(r.isTimestampSchema()){switch(Dr(r,this.settings)){case 5:return(e=>{if(null==e)return;if("string"!=typeof e)throw new TypeError("RFC3339 timestamps must be strings");const t=Cr.exec(e);if(!t)throw new TypeError(`Invalid RFC3339 timestamp format ${e}`);const[,r,s,n,i,o,a,,c,u]=t;Tr(s,1,12),Tr(n,1,31),Tr(i,0,23),Tr(o,0,59),Tr(a,0,60);const d=new Date(Date.UTC(Number(r),Number(s)-1,Number(n),Number(i),Number(o),Number(a),Number(c)?Math.round(1e3*parseFloat(`0.${c}`)):0));if(d.setUTCFullYear(Number(r)),"Z"!=u.toUpperCase()){const[,e,t,r]=/([+-])(\d\d):(\d\d)/.exec(u)||[void 0,"+",0,0],s="-"===e?1:-1;d.setTime(d.getTime()+s*(60*Number(t)*60*1e3+60*Number(r)*1e3))}return d})(t);case 6:return(e=>{if(null==e)return;if("string"!=typeof e)throw new TypeError("RFC7231 timestamps must be strings.");let t,r,s,n,i,o,a,c;if((c=Ar.exec(e))?[,t,r,s,n,i,o,a]=c:(c=xr.exec(e))?([,t,r,s,n,i,o,a]=c,s=(Number(s)+1900).toString()):(c=kr.exec(e))&&([,r,t,n,i,o,a,s]=c),s&&o){const e=Date.UTC(Number(s),Rr.indexOf(r),Number(t),Number(n),Number(i),Number(o),a?Math.round(1e3*parseFloat(`0.${a}`)):0);Tr(t,1,31),Tr(n,0,23),Tr(i,0,59),Tr(o,0,60);const c=new Date(e);return c.setUTCFullYear(Number(s)),c}throw new TypeError(`Invalid RFC7231 date-time value ${e}.`)})(t);case 7:return(e=>{if(null==e)return;let t=NaN;if("number"==typeof e)t=e;else if("string"==typeof e){if(!/^-?\d*\.?\d+$/.test(e))throw new TypeError("parseEpochTimestamp - numeric string invalid.");t=Number.parseFloat(e)}else"object"==typeof e&&1===e.tag&&(t=e.value);if(isNaN(t)||Math.abs(t)===1/0)throw new TypeError("Epoch timestamps must be valid finite numbers.");return new Date(Math.round(1e3*t))})(t);default:return console.warn("Missing timestamp format, parsing value with Date constructor:",t),new Date(t)}}if(r.isStringSchema()){const e=r.getMergedTraits().mediaType;let s=t;if(e){r.getMergedTraits().httpHeader&&(s=this.base64ToUtf8(s));return("application/json"===e||e.endsWith("+json"))&&(s=gr.from(s)),s}}return r.isNumericSchema()?Number(t):r.isBigIntegerSchema()?BigInt(t):r.isBigDecimalSchema()?new Nr(t,"bigDecimal"):r.isBooleanSchema()?"true"===String(t).toLowerCase():t}base64ToUtf8(e){return(this.serdeContext?.utf8Encoder??W)((this.serdeContext?.base64Decoder??F)(e))}}class Lr extends Or{codecDeserializer;stringDeserializer;constructor(e,t){super(),this.codecDeserializer=e,this.stringDeserializer=new _r(t)}setSerdeContext(e){this.stringDeserializer.setSerdeContext(e),this.codecDeserializer.setSerdeContext(e),this.serdeContext=e}read(e,t){const r=$t.of(e),s=r.getMergedTraits(),n=this.serdeContext?.utf8Encoder??W;if(s.httpHeader||s.httpResponseCode)return this.stringDeserializer.read(r,n(t));if(s.httpPayload){if(r.isBlobSchema()){const e=this.serdeContext?.utf8Decoder??K;return"string"==typeof t?e(t):t}if(r.isStringSchema())return"byteLength"in t?n(t):t}return this.codecDeserializer.read(r,t)}}class Br extends Or{settings;stringBuffer="";constructor(e){super(),this.settings=e}write(e,t){const r=$t.of(e);switch(typeof t){case"object":if(null===t)return void(this.stringBuffer="null");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(Dr(r,this.settings)){case 5:this.stringBuffer=t.toISOString().replace(".000Z","Z");break;case 6:this.stringBuffer=Qt(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)return void(this.stringBuffer=(this.serdeContext?.base64Encoder??G)(t));if(r.isListSchema()&&Array.isArray(t)){let e="";for(const s of t){this.write([r.getValueSchema(),r.getMergedTraits()],s);const t=this.flush();""!==e&&(e+=", "),e+=r.getValueSchema().isTimestampSchema()?t:yr(t)}return void(this.stringBuffer=e)}this.stringBuffer=JSON.stringify(t,null,2);break;case"string":const e=r.getMergedTraits().mediaType;let s=t;if(e){if(("application/json"===e||e.endsWith("+json"))&&(s=gr.from(s)),r.getMergedTraits().httpHeader)return void(this.stringBuffer=(this.serdeContext?.base64Encoder??G)(s.toString()))}this.stringBuffer=t;break;default:r.isIdempotencyToken()?this.stringBuffer=mr():this.stringBuffer=String(t)}}flush(){const e=this.stringBuffer;return this.stringBuffer="",e}}class zr{codecSerializer;stringSerializer;buffer;constructor(e,t,r=new Br(t)){this.codecSerializer=e,this.stringSerializer=r}setSerdeContext(e){this.codecSerializer.setSerdeContext(e),this.stringSerializer.setSerdeContext(e)}write(e,t){const r=$t.of(e),s=r.getMergedTraits();return s.httpHeader||s.httpLabel||s.httpQuery?(this.stringSerializer.write(r,t),void(this.buffer=this.stringSerializer.flush())):this.codecSerializer.write(r,t)}flush(){if(void 0!==this.buffer){const e=this.buffer;return this.buffer=void 0,e}return this.codecSerializer.flush()}}const jr="***SensitiveInformation***";function Hr(e,t){if(null==t)return t;const r=$t.of(e);if(r.getMergedTraits().sensitive)return jr;if(r.isListSchema()){if(!!r.getValueSchema().getMergedTraits().sensitive)return jr}else if(r.isMapSchema()){if(!!r.getKeySchema().getMergedTraits().sensitive||!!r.getValueSchema().getMergedTraits().sensitive)return jr}else if(r.isStructSchema()&&"object"==typeof t){const e=t,s={};for(const[t,n]of r.structIterator())null!=e[t]&&(s[t]=Hr(n,e[t]));return s}return t}class qr{middlewareStack=pt();schema;static classBuilder(){return new Fr}resolveMiddlewareWithContext(e,t,r,{middlewareFn:s,clientName:n,commandName:o,inputFilterSensitiveLog:a,outputFilterSensitiveLog:c,smithyContext:u,additionalContext:d,CommandCtor:l}){for(const i of s.bind(this)(l,e,t,r))this.middlewareStack.use(i);const h=e.concat(this.middlewareStack),{logger:f}=t,p={logger:f,clientName:n,commandName:o,inputFilterSensitiveLog:a,outputFilterSensitiveLog:c,[i]:{commandInstance:this,...u},...d},{requestHandler:m}=t;let g=r??{};return u.eventStream&&(g={isEventStream:!0,...g}),h.resolve(e=>m.handle(e.request,g),p)}}class Fr{_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,t,r={}){return this._smithyContext={service:e,operation:t,...r},this}c(e={}){return this._additionalContext=e,this}n(e,t){return this._clientName=e,this._commandName=t,this}f(e=e=>e,t=e=>e){return this._inputFilterSensitiveLog=e,this._outputFilterSensitiveLog=t,this}ser(e){return this._serializer=e,this}de(e){return this._deserializer=e,this}sc(e){return this._operationSchema=e,this._smithyContext.operationSchema=e,this}build(){const e=this;let t;return t=class extends qr{input;static getEndpointParameterInstructions(){return e._ep}constructor(...[t]){super(),this.input=t??{},e._init(this),this.schema=e._operationSchema}resolveMiddleware(r,s,n){const i=e._operationSchema,o=i?.[4]??i?.input,a=i?.[5]??i?.output;return this.resolveMiddlewareWithContext(r,s,n,{CommandCtor:t,middlewareFn:e._middlewareFn,clientName:e._clientName,commandName:e._commandName,inputFilterSensitiveLog:e._inputFilterSensitiveLog??(i?Hr.bind(null,o):e=>e),outputFilterSensitiveLog:e._outputFilterSensitiveLog??(i?Hr.bind(null,a):e=>e),smithyContext:e._smithyContext,additionalContext:e._additionalContext})}serialize=e._serializer;deserialize=e._deserializer}}}class Kr 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;const t=e;return Kr.prototype.isPrototypeOf(t)||Boolean(t.$fault)&&Boolean(t.$metadata)&&("client"===t.$fault||"server"===t.$fault)}static[Symbol.hasInstance](e){if(!e)return!1;const t=e;return this===Kr?Kr.isInstance(e):!!Kr.isInstance(e)&&(t.name&&this.name?this.prototype.isPrototypeOf(e)||t.name===this.name:this.prototype.isPrototypeOf(e))}}const Vr=(e,t={})=>{Object.entries(t).filter(([,e])=>void 0!==e).forEach(([t,r])=>{null!=e[t]&&""!==e[t]||(e[t]=r)});const r=e.message||e.Message||"UnknownError";return e.message=r,delete e.Message,e},Wr=e=>{switch(e){case"standard":case"cross-region":return{retryMode:"standard",connectionTimeout:3100};case"in-region":return{retryMode:"standard",connectionTimeout:1100};case"mobile":return{retryMode:"standard",connectionTimeout:3e4};default:return{}}},Gr=Object.values(s),Xr=e=>Object.assign((e=>{const t=[];for(const r in s){const n=s[r];void 0!==e[n]&&t.push({algorithmId:()=>n,checksumConstructor:()=>e[n]})}for(const[r,s]of Object.entries(e.checksumAlgorithms??{}))t.push({algorithmId:()=>r,checksumConstructor:()=>s});return{addChecksumAlgorithm(r){e.checksumAlgorithms=e.checksumAlgorithms??{};const s=r.algorithmId(),n=r.checksumConstructor();Gr.includes(s)?e.checksumAlgorithms[s.toUpperCase()]=n:e.checksumAlgorithms[s]=n,t.push(r)},checksumAlgorithms:()=>t}})(e),(e=>({setRetryStrategy(t){e.retryStrategy=t},retryStrategy:()=>e.retryStrategy}))(e)),Yr=e=>Object.assign((e=>{const t={};return e.checksumAlgorithms().forEach(e=>{const r=e.algorithmId();Gr.includes(r)&&(t[r]=e.checksumConstructor())}),t})(e),(e=>{const t={};return t.retryStrategy=e.retryStrategy(),t})(e)),Jr=e=>{const t="#text";for(const r in e)e.hasOwnProperty(r)&&void 0!==e[r][t]?e[r]=e[r][t]:"object"==typeof e[r]&&null!==e[r]&&(e[r]=Jr(e[r]));return e};class Qr{trace(){}debug(){}info(){}warn(){}error(){}}const Zr={step:"finalizeRequest",tags:["CHECK_CONTENT_LENGTH_HEADER"],name:"getCheckContentLengthHeaderPlugin",override:!0},es=e=>({applyToStack:e=>{e.add((e,t)=>async r=>{const{request:s}=r;if(o.isInstance(s)&&!("content-length"in s.headers)&&!("x-amz-decoded-content-length"in s.headers)){const e="Are you using a Stream of unknown length as the Body of a PutObject request? Consider using Upload instead from @aws-sdk/lib-storage.";"function"!=typeof t?.logger?.warn||t.logger instanceof Qr?console.warn(e):t.logger.warn(e)}return e({...r})},Zr)}}),ts={tags:["REGION_REDIRECT","S3"],name:"regionRedirectEndpointMiddleware",override:!0,relation:"before",toMiddleware:"endpointV2Middleware"};const rs={step:"initialize",tags:["REGION_REDIRECT","S3"],name:"regionRedirectMiddleware",override:!0},ss=e=>({applyToStack:t=>{var r;t.add(function(e){return(t,r)=>async s=>{try{return await t(s)}catch(n){if(e.followRegionRedirects){const o=n?.$metadata?.httpStatusCode,a="HeadBucketCommand"===r.commandName,c=n?.$response?.headers?.["x-amz-bucket-region"];if(c&&(301===o||400===o&&("IllegalLocationConstraintException"===n?.name||a))){try{const t=c;r.logger?.debug(`Redirecting from ${await e.region()} to ${t}`),r.__s3RegionRedirect=t}catch(i){throw new Error("Region redirect failed: "+i)}return t(s)}}throw n}}}(e),rs),t.addRelativeTo((r=e,(e,t)=>async s=>{const n=await r.region(),i=r.region;let o=()=>{};t.__s3RegionRedirect&&(Object.defineProperty(r,"region",{writable:!1,value:async()=>t.__s3RegionRedirect}),o=()=>Object.defineProperty(r,"region",{writable:!0,value:i}));try{const i=await e(s);if(t.__s3RegionRedirect&&(o(),n!==await r.region()))throw new Error("Region was not restored following S3 region redirect.");return i}catch(a){throw o(),a}}),ts)}}),ns={tags:["S3"],name:"s3ExpiresMiddleware",override:!0,relation:"after",toMiddleware:"deserializerMiddleware"},is=e=>({applyToStack:e=>{e.addRelativeTo((e,t)=>async r=>{const s=await e(r),{response:n}=s;if(a.isInstance(n)&&n.headers.expires){n.headers.expiresstring=n.headers.expires;try{rr(n.headers.expires)}catch(i){t.logger?.warn(`AWS SDK Warning for ${t.clientName}::${t.commandName} response parsing (${n.headers.expires}): ${i}`),delete n.headers.expires}}return s},ns)}});class os{data;lastPurgeTime=Date.now();static EXPIRED_CREDENTIAL_PURGE_INTERVAL_MS=3e4;constructor(e={}){this.data=e}get(e){const t=this.data[e];if(t)return t}set(e,t){return this.data[e]=t,t}delete(e){delete this.data[e]}async purgeExpired(){const e=Date.now();if(!(this.lastPurgeTime+os.EXPIRED_CREDENTIAL_PURGE_INTERVAL_MS>e))for(const t in this.data){const r=this.data[t];if(!r.isRefreshing){const s=await r.identity;s.expiration&&s.expiration.getTime()<e&&delete this.data[t]}}}}class as{_identity;isRefreshing;accessed;constructor(e,t=!1,r=Date.now()){this._identity=e,this.isRefreshing=t,this.accessed=r}get identity(){return this.accessed=Date.now(),this._identity}}class cs{createSessionFn;cache;static REFRESH_WINDOW_MS=6e4;constructor(e,t=new os){this.createSessionFn=e,this.cache=t}async getS3ExpressIdentity(e,t){const r=t.Bucket,{cache:s}=this,n=s.get(r);return n?n.identity.then(e=>{if((e.expiration?.getTime()??0)<Date.now())return s.set(r,new as(this.getIdentity(r))).identity;return(e.expiration?.getTime()??0)<Date.now()+cs.REFRESH_WINDOW_MS&&!n.isRefreshing&&(n.isRefreshing=!0,this.getIdentity(r).then(e=>{s.set(r,new as(Promise.resolve(e)))})),e}):s.set(r,new as(this.getIdentity(r))).identity}async getIdentity(e){await this.cache.purgeExpired().catch(e=>{console.warn("Error while clearing expired entries in S3ExpressIdentityCache: \n"+e)});const t=await this.createSessionFn(e);if(!t.Credentials?.AccessKeyId||!t.Credentials?.SecretAccessKey)throw new Error("s3#createSession response credential missing AccessKeyId or SecretAccessKey.");return{accessKeyId:t.Credentials.AccessKeyId,secretAccessKey:t.Credentials.SecretAccessKey,sessionToken:t.Credentials.SessionToken,expiration:t.Credentials.Expiration?new Date(t.Credentials.Expiration):void 0}}}const us="X-Amz-Date",ds="X-Amz-Signature",ls="X-Amz-Security-Token",hs="authorization",fs=us.toLowerCase(),ps=[hs,fs,"date"],ms=ds.toLowerCase(),gs="x-amz-content-sha256",ys=ls.toLowerCase(),ws={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},bs=/^proxy-/,Ss=/^sec-/,vs="AWS4-HMAC-SHA256",Es="AWS4-HMAC-SHA256-PAYLOAD",Cs="aws4_request",As={},xs=[],ks=(e,t,r)=>`${e}/${t}/${r}/${Cs}`,Rs=(e,t,r)=>{const s=new e(t);return s.update(V(r)),s.digest()},Ts=({headers:e},t,r)=>{const s={};for(const n of Object.keys(e).sort()){if(null==e[n])continue;const i=n.toLowerCase();(i in ws||t?.has(i)||bs.test(i)||Ss.test(i))&&(!r||r&&!r.has(i))||(s[i]=e[n].trim().replace(/\s+/g," "))}return s},Ps=async({headers:e,body:t},r)=>{for(const s of Object.keys(e))if(s.toLowerCase()===gs)return e[s];if(null==t)return"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";if("string"==typeof t||ArrayBuffer.isView(t)||ve(t)){const e=new r;return e.update(V(t)),ge(await e.digest())}return"UNSIGNED-PAYLOAD"};class Is{format(e){const t=[];for(const n of Object.keys(e)){const r=K(n);t.push(Uint8Array.from([r.byteLength]),r,this.formatHeaderValue(e[n]))}const r=new Uint8Array(t.reduce((e,t)=>e+t.byteLength,0));let s=0;for(const n of t)r.set(n,s),s+=n.byteLength;return r}formatHeaderValue(e){switch(e.type){case"boolean":return Uint8Array.from([e.value?0:1]);case"byte":return Uint8Array.from([2,e.value]);case"short":const t=new DataView(new ArrayBuffer(3));return t.setUint8(0,3),t.setInt16(1,e.value,!1),new Uint8Array(t.buffer);case"integer":const r=new DataView(new ArrayBuffer(5));return r.setUint8(0,4),r.setInt32(1,e.value,!1),new Uint8Array(r.buffer);case"long":const s=new Uint8Array(9);return s[0]=5,s.set(e.value.bytes,1),s;case"binary":const n=new DataView(new ArrayBuffer(3+e.value.byteLength));n.setUint8(0,6),n.setUint16(1,e.value.byteLength,!1);const i=new Uint8Array(n.buffer);return i.set(e.value,3),i;case"string":const o=K(e.value),a=new DataView(new ArrayBuffer(3+o.byteLength));a.setUint8(0,7),a.setUint16(1,o.byteLength,!1);const c=new Uint8Array(a.buffer);return c.set(o,3),c;case"timestamp":const u=new Uint8Array(9);return u[0]=8,u.set($s.fromNumber(e.value.valueOf()).bytes,1),u;case"uuid":if(!Os.test(e.value))throw new Error(`Invalid UUID received: ${e.value}`);const d=new Uint8Array(17);return d[0]=9,d.set(me(e.value.replace(/\-/g,"")),1),d}}}var Ms,Ns;(Ns=Ms||(Ms={}))[Ns.boolTrue=0]="boolTrue",Ns[Ns.boolFalse=1]="boolFalse",Ns[Ns.byte=2]="byte",Ns[Ns.short=3]="short",Ns[Ns.integer=4]="integer",Ns[Ns.long=5]="long",Ns[Ns.byteArray=6]="byteArray",Ns[Ns.string=7]="string",Ns[Ns.timestamp=8]="timestamp",Ns[Ns.uuid=9]="uuid";const Os=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;let $s=class e{bytes;constructor(e){if(this.bytes=e,8!==e.byteLength)throw new Error("Int64 buffers must be exactly 8 bytes")}static fromNumber(t){if(t>0x8000000000000000||t<-0x8000000000000000)throw new Error(`${t} is too large (or, if negative, too small) to represent as an Int64`);const r=new Uint8Array(8);for(let e=7,s=Math.abs(Math.round(t));e>-1&&s>0;e--,s/=256)r[e]=s;return t<0&&Us(r),new e(r)}valueOf(){const e=this.bytes.slice(0),t=128&e[0];return t&&Us(e),parseInt(ge(e),16)*(t?-1:1)}toString(){return String(this.valueOf())}};function Us(e){for(let t=0;t<8;t++)e[t]^=255;for(let t=7;t>-1&&(e[t]++,0===e[t]);t--);}const Ds=e=>{e=o.clone(e);for(const t of Object.keys(e.headers))ps.indexOf(t.toLowerCase())>-1&&delete e.headers[t];return e},_s=e=>"number"==typeof e?new Date(1e3*e):"string"==typeof e?Number(e)?new Date(1e3*Number(e)):new Date(e):e;class Ls{service;regionProvider;credentialProvider;sha256;uriEscapePath;applyChecksum;constructor({applyChecksum:e,credentials:t,region:r,service:s,sha256:n,uriEscapePath:i=!0}){this.service=s,this.sha256=n,this.uriEscapePath=i,this.applyChecksum="boolean"!=typeof e||e,this.regionProvider=at(r),this.credentialProvider=at(t)}createCanonicalRequest(e,t,r){const s=Object.keys(t).sort();return`${e.method}\n${this.getCanonicalPath(e)}\n${(({query:e={}})=>{const t=[],r={};for(const s of Object.keys(e)){if(s.toLowerCase()===ms)continue;const n=ie(s);t.push(n);const i=e[s];"string"==typeof i?r[n]=`${n}=${ie(i)}`:Array.isArray(i)&&(r[n]=i.slice(0).reduce((e,t)=>e.concat([`${n}=${ie(t)}`]),[]).sort().join("&"))}return t.sort().map(e=>r[e]).filter(e=>e).join("&")})(e)}\n${s.map(e=>`${e}:${t[e]}`).join("\n")}\n\n${s.join(";")}\n${r}`}async createStringToSign(e,t,r,s){const n=new this.sha256;n.update(V(r));return`${s}\n${e}\n${t}\n${ge(await n.digest())}`}getCanonicalPath({path:e}){if(this.uriEscapePath){const t=[];for(const s of e.split("/"))0!==s?.length&&"."!==s&&(".."===s?t.pop():t.push(s));const r=`${e?.startsWith("/")?"/":""}${t.join("/")}${t.length>0&&e?.endsWith("/")?"/":""}`;return ie(r).replace(/%2F/g,"/")}return e}validateResolvedCredentials(e){if("object"!=typeof e||"string"!=typeof e.accessKeyId||"string"!=typeof e.secretAccessKey)throw new Error("Resolved credential object is not valid")}formatDate(e){const t=(r=e,_s(r).toISOString().replace(/\.\d{3}Z$/,"Z")).replace(/[\-:]/g,"");var r;return{longDate:t,shortDate:t.slice(0,8)}}getCanonicalHeaderList(e){return Object.keys(e).sort().join(";")}}class Bs extends Ls{headerFormatter=new Is;constructor({applyChecksum:e,credentials:t,region:r,service:s,sha256:n,uriEscapePath:i=!0}){super({applyChecksum:e,credentials:t,region:r,service:s,sha256:n,uriEscapePath:i})}async presign(e,t={}){const{signingDate:r=/* @__PURE__ */new Date,expiresIn:s=3600,unsignableHeaders:n,unhoistableHeaders:i,signableHeaders:a,hoistableHeaders:c,signingRegion:u,signingService:d}=t,l=await this.credentialProvider();this.validateResolvedCredentials(l);const h=u??await this.regionProvider(),{longDate:f,shortDate:p}=this.formatDate(r);if(s>604800)return Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future");const m=ks(p,h,d??this.service),g=((e,t={})=>{const{headers:r,query:s={}}=o.clone(e);for(const n of Object.keys(r)){const e=n.toLowerCase();("x-amz-"===e.slice(0,6)&&!t.unhoistableHeaders?.has(e)||t.hoistableHeaders?.has(e))&&(s[n]=r[n],delete r[n])}return{...e,headers:r,query:s}})(Ds(e),{unhoistableHeaders:i,hoistableHeaders:c});l.sessionToken&&(g.query[ls]=l.sessionToken),g.query["X-Amz-Algorithm"]=vs,g.query["X-Amz-Credential"]=`${l.accessKeyId}/${m}`,g.query[us]=f,g.query["X-Amz-Expires"]=s.toString(10);const y=Ts(g,n,a);return g.query["X-Amz-SignedHeaders"]=this.getCanonicalHeaderList(y),g.query[ds]=await this.getSignature(f,m,this.getSigningKey(l,h,p,d),this.createCanonicalRequest(g,y,await Ps(e,this.sha256))),g}async sign(e,t){return"string"==typeof e?this.signString(e,t):e.headers&&e.payload?this.signEvent(e,t):e.message?this.signMessage(e,t):this.signRequest(e,t)}async signEvent({headers:e,payload:t},{signingDate:r=/* @__PURE__ */new Date,priorSignature:s,signingRegion:n,signingService:i,eventStreamCredentials:o}){const a=n??await this.regionProvider(),{shortDate:c,longDate:u}=this.formatDate(r),d=ks(c,a,i??this.service),l=await Ps({headers:{},body:t},this.sha256),h=new this.sha256;h.update(e);const f=ge(await h.digest()),p=[Es,u,d,s,f,l].join("\n");return this.signString(p,{signingDate:r,signingRegion:a,signingService:i,eventStreamCredentials:o})}async signMessage(e,{signingDate:t=/* @__PURE__ */new Date,signingRegion:r,signingService:s,eventStreamCredentials:n}){return this.signEvent({headers:this.headerFormatter.format(e.message.headers),payload:e.message.body},{signingDate:t,signingRegion:r,signingService:s,priorSignature:e.priorSignature,eventStreamCredentials:n}).then(t=>({message:e.message,signature:t}))}async signString(e,{signingDate:t=/* @__PURE__ */new Date,signingRegion:r,signingService:s,eventStreamCredentials:n}={}){const i=n??await this.credentialProvider();this.validateResolvedCredentials(i);const o=r??await this.regionProvider(),{shortDate:a}=this.formatDate(t),c=new this.sha256(await this.getSigningKey(i,o,a,s));return c.update(V(e)),ge(await c.digest())}async signRequest(e,{signingDate:t=/* @__PURE__ */new Date,signableHeaders:r,unsignableHeaders:s,signingRegion:n,signingService:i}={}){const o=await this.credentialProvider();this.validateResolvedCredentials(o);const a=n??await this.regionProvider(),c=Ds(e),{longDate:u,shortDate:d}=this.formatDate(t),l=ks(d,a,i??this.service);c.headers[fs]=u,o.sessionToken&&(c.headers[ys]=o.sessionToken);const h=await Ps(c,this.sha256);!((e,t)=>{e=e.toLowerCase();for(const r of Object.keys(t))if(e===r.toLowerCase())return!0;return!1})(gs,c.headers)&&this.applyChecksum&&(c.headers[gs]=h);const f=Ts(c,s,r),p=await this.getSignature(u,l,this.getSigningKey(o,a,d,i),this.createCanonicalRequest(c,f,h));return c.headers[hs]=`${vs} Credential=${o.accessKeyId}/${l}, SignedHeaders=${this.getCanonicalHeaderList(f)}, Signature=${p}`,c}async getSignature(e,t,r,s){const n=await this.createStringToSign(e,t,s,vs),i=new this.sha256(await r);return i.update(V(n)),ge(await i.digest())}getSigningKey(e,t,r,s){return(async(e,t,r,s,n)=>{const i=`${r}:${s}:${n}:${ge(await Rs(e,t.secretAccessKey,t.accessKeyId))}:${t.sessionToken}`;if(i in As)return As[i];for(xs.push(i);xs.length>50;)delete As[xs.shift()];let o=`AWS4${t.secretAccessKey}`;for(const a of[r,s,n,Cs])o=await Rs(e,o,a);return As[i]=o})(this.sha256,e,r,t,s||this.service)}}const zs="X-Amz-S3session-Token",js=zs.toLowerCase();class Hs extends Bs{async signWithCredentials(e,t,r){const s=qs(t);e.headers[js]=t.sessionToken;return Fs(this,s),this.signRequest(e,r??{})}async presignWithCredentials(e,t,r){const s=qs(t);delete e.headers[js],e.headers[zs]=t.sessionToken,e.query=e.query??{},e.query[zs]=t.sessionToken;return Fs(this,s),this.presign(e,r)}}function qs(e){return{accessKeyId:e.accessKeyId,secretAccessKey:e.secretAccessKey,expiration:e.expiration}}function Fs(e,t){const r=setTimeout(()=>{throw new Error("SignatureV4S3Express credential override was created but not called.")},10),s=e.credentialProvider;e.credentialProvider=()=>(clearTimeout(r),e.credentialProvider=s,Promise.resolve(t))}const Ks={name:"s3ExpressMiddleware",step:"build",tags:["S3","S3_EXPRESS"],override:!0},Vs=e=>({applyToStack:t=>{t.add((e=>(t,r)=>async s=>{if(r.endpointV2){const t=r.endpointV2,n="sigv4-s3express"===t.properties?.authSchemes?.[0]?.name;if(("S3Express"===t.properties?.backend||"Directory"===t.properties?.bucketType)&&(z(r,"S3_EXPRESS_BUCKET","J"),r.isS3ExpressBucket=!0),n){const t=s.input.Bucket;if(t){const n=await e.s3ExpressIdentityProvider.getS3ExpressIdentity(await e.credentials(),{Bucket:t});r.s3ExpressIdentity=n,o.isInstance(s.request)&&n.sessionToken&&(s.request.headers[js]=n.sessionToken)}}}return t(s)})(e),Ks)}});const Ws=(e,t)=>(r,s)=>async n=>{const i=((e,t)=>{if(!t||0===t.length)return e;const r=[];for(const s of t)for(const t of e)t.schemeId.split("#")[1]===s&&r.push(t);for(const s of e)r.find(({schemeId:e})=>e===s.schemeId)||r.push(s);return r})(e.httpAuthSchemeProvider(await t.httpAuthSchemeParametersProvider(e,s,n.input)),e.authSchemePreference?await e.authSchemePreference():[]),o=function(e){const t=/* @__PURE__ */new Map;for(const r of e)t.set(r.schemeId,r);return t}(e.httpAuthSchemes),a=ot(s),c=[];for(const r of i){const n=o.get(r.schemeId);if(!n){c.push(`HttpAuthScheme \`${r.schemeId}\` was not enabled for this service.`);continue}const i=n.identityProvider(await t.identityProviderConfigProvider(e));if(!i){c.push(`HttpAuthScheme \`${r.schemeId}\` did not have an IdentityProvider configured.`);continue}const{identityProperties:u={},signingProperties:d={}}=r.propertiesExtractor?.(e,s)||{};r.identityProperties=Object.assign(r.identityProperties||{},u),r.signingProperties=Object.assign(r.signingProperties||{},d),a.selectedHttpAuthScheme={httpAuthOption:r,identity:await i(r.identityProperties),signer:n.signer};break}if(!a.selectedHttpAuthScheme)throw new Error(c.join("\n"));return r(n)},Gs={step:"serialize",tags:["HTTP_AUTH_SCHEME"],name:"httpAuthSchemeMiddleware",override:!0,relation:"before",toMiddleware:"endpointV2Middleware"},Xs=e=>e=>{throw e},Ys=(e,t)=>{},Js={step:"finalizeRequest",tags:["HTTP_SIGNING"],name:"httpSigningMiddleware",aliases:["apiKeyMiddleware","tokenMiddleware","awsAuthMiddleware"],override:!0,relation:"after",toMiddleware:"retryMiddleware"},Qs=e=>({applyToStack:e=>{e.addRelativeTo((e,t)=>async r=>{if(!o.isInstance(r.request))return e(r);const s=ot(t).selectedHttpAuthScheme;if(!s)throw new Error("No HttpAuthScheme was selected: unable to sign request");const{httpAuthOption:{signingProperties:n={}},identity:i,signer:a}=s,c=await e({...r,request:await a.sign(r.request,i,n)}).catch((a.errorHandler||Xs)(n));return(a.successHandler||Ys)(c.response,n),c},Js)}}),Zs=e=>{if("function"==typeof e)return e;const t=Promise.resolve(e);return()=>t};class en{authSchemes=/* @__PURE__ */new Map;constructor(e){for(const t in e){const r=e[t];void 0!==r&&this.authSchemes.set(t,r)}}getIdentityProvider(e){return this.authSchemes.get(e)}}const tn=(rn=3e5,function(e){return sn(e)&&e.expiration.getTime()-Date.now()<rn});var rn;const sn=e=>void 0!==e.expiration,nn=e=>e=>{throw e},on=(e,t)=>{},an=e=>(t,r)=>async s=>{if(!o.isInstance(s.request))return t(s);const n=ot(r).selectedHttpAuthScheme;if(!n)throw new Error("No HttpAuthScheme was selected: unable to sign request");const{httpAuthOption:{signingProperties:i={}},identity:a,signer:c}=n;let u;u=r.s3ExpressIdentity?await(async(e,t,r,s)=>{const n=await s.signWithCredentials(r,e,{});if(n.headers["X-Amz-Security-Token"]||n.headers["x-amz-security-token"])throw new Error("X-Amz-Security-Token must not be set for s3-express requests.");return n})(r.s3ExpressIdentity,0,s.request,await e.signer()):await c.sign(s.request,a,i);const d=await t({...s,request:u}).catch((c.errorHandler||nn)(i));return(c.successHandler||on)(d.response,i),d};const cn={CopyObjectCommand:!0,UploadPartCopyCommand:!0,CompleteMultipartUploadCommand:!0},un=e=>(t,r)=>async s=>{const n=await t(s),{response:i}=n;if(!a.isInstance(i))return n;const{statusCode:o,body:c}=i;if(o<200||o>=300)return n;const u=await dn(c,e);var d;if(i.body=(d=u,new ReadableStream({start(e){e.enqueue(d),e.close()}})),0===u.length&&cn[r.commandName]){const e=new Error("S3 aborted request");throw e.$metadata={httpStatusCode:503},e.name="InternalError",e}const l=e.utf8Encoder(u.subarray(u.length-16));return l&&l.endsWith("</Error>")&&(i.statusCode=503),n},dn=(e=new Uint8Array,t)=>e instanceof Uint8Array?Promise.resolve(e):t.streamCollector(e)||Promise.resolve(new Uint8Array),ln={relation:"after",toMiddleware:"deserializerMiddleware",tags:["THROW_200_EXCEPTIONS","S3"],name:"throw200ExceptionsMiddleware",override:!0},hn=e=>({applyToStack:t=>{t.addRelativeTo(un(e),ln)}});const fn={name:"bucketEndpointMiddleware",override:!0,relation:"after",toMiddleware:"endpointV2Middleware"};const pn={step:"initialize",tags:["VALIDATE_BUCKET_NAME"],name:"validateBucketNameMiddleware",override:!0},mn=e=>({applyToStack:t=>{t.add(function({bucketEndpoint:e}){return t=>async r=>{const{input:{Bucket:s}}=r;if(!e&&"string"==typeof s&&!("string"==typeof(n=s)&&0===n.indexOf("arn:")&&n.split(":").length>=6)&&s.indexOf("/")>=0){const e=new Error(`Bucket name shouldn't contain '/', received '${s}'`);throw e.name="InvalidBucketName",e}var n;return t({...r})}}(e),pn),t.addRelativeTo(function(e){return(t,r)=>async s=>{if(e.bucketEndpoint){const e=r.endpointV2;if(e){const t=s.input.Bucket;if("string"==typeof t)try{const s=new URL(t);r.endpointV2={...e,url:s}}catch(n){const e=`@aws-sdk/middleware-sdk-s3: bucketEndpoint=true was set but Bucket=${t} could not be parsed as URL.`;throw"NoOpLogger"===r.logger?.constructor?.name?console.warn(e):r.logger?.warn?.(e),n}}}return t(s)}}(e),fn)}}),gn="function"==typeof TextEncoder?new TextEncoder:null,yn=e=>{if("string"==typeof e){if(gn)return gn.encode(e).byteLength;let t=e.length;for(let r=t-1;r>=0;r--){const s=e.charCodeAt(r);s>127&&s<=2047?t++:s>2047&&s<=65535&&(t+=2),s>=56320&&s<=57343&&r--}return t}if("number"==typeof e.byteLength)return e.byteLength;if("number"==typeof e.size)return e.size;throw new Error(`Body Length computation failed for ${e}`)};class wn{queryCompat;errorRegistry;constructor(e=!1){this.queryCompat=e}resolveRestContentType(e,t){const r=t.getMemberSchemas(),s=Object.values(r).find(e=>!!e.getMergedTraits().httpPayload);if(s){const t=s.getMergedTraits().mediaType;return t||(s.isStringSchema()?"text/plain":s.isBlobSchema()?"application/octet-stream":e)}if(!t.isUnitSchema()){if(Object.values(r).find(e=>{const{httpQuery:t,httpQueryParams:r,httpHeader:s,httpLabel:n,httpPrefixHeaders:i}=e.getMergedTraits();return!t&&!r&&!s&&!n&&void 0===i}))return e}}async getErrorSchemaOrThrowBaseException(e,t,r,s,n,i){let o=e;e.includes("#")&&([,o]=e.split("#"));const a={$metadata:n,$fault:r.statusCode<500?"client":"server"};if(!this.errorRegistry)throw new Error("@aws-sdk/core/protocols - error handler not initialized.");try{return{errorSchema:i?.(this.errorRegistry,o)??this.errorRegistry.getSchema(e),errorMetadata:a}}catch(c){s.message=s.message??s.Message??"UnknownError";const e=this.errorRegistry,t=e.getBaseException();if(t){const r=e.getErrorCtor(t)??Error;throw this.decorateServiceException(Object.assign(new r({name:o}),a),s)}const r=s,n=r?.message??r?.Message??r?.Error?.Message??r?.Error?.message;throw this.decorateServiceException(Object.assign(new Error(n),{name:o},a),s)}}compose(e,t,r){let s=r;t.includes("#")&&([s]=t.split("#"));const n=Lt.for(s),i=Lt.for("smithy.ts.sdk.synthetic."+r);e.copyFrom(n),e.copyFrom(i),this.errorRegistry=e}decorateServiceException(e,t={}){if(this.queryCompat){const r=e.Message??t.Message,s=Vr(e,t);r&&(s.message=r);const n=s.Error??{};n.Type=s.Error?.Type,n.Code=s.Error?.Code,n.Message=s.Error?.message??s.Error?.Message??r,s.Error=n;const i=s.$metadata.requestId;return i&&(s.RequestId=i),s}return Vr(e,t)}setQueryCompatError(e,t){const r=t.headers?.["x-amzn-query-error"];if(void 0!==e&&null!=r){const[t,s]=r.split(";"),n=Object.keys(e),i={Code:t,Type:s};e.Code=t,e.Type=s;for(let r=0;r<n.length;r++){const t=n[r];i["message"===t?"Message":t]=e[t]}delete i.__type,e.Error=i}}queryCompatOutput(e,t){e.Error&&(t.Error=e.Error),e.Type&&(t.Type=e.Type),e.Code&&(t.Code=e.Code)}findQueryCompatibleError(e,t){try{return e.getSchema(t)}catch(r){return e.find(e=>$t.of(e).getMergedTraits().awsQueryError?.[0]===t)}}}class bn{serdeContext;setSerdeContext(e){this.serdeContext=e}}class Sn{from;to;keys;constructor(e,t){this.from=e,this.to=t;const r=Object.keys(this.from),s=new Set(r);s.delete("__type"),this.keys=s}mark(e){this.keys.delete(e)}hasUnknown(){return 1===this.keys.size&&0===Object.keys(this.to).length}writeUnknown(){if(this.hasUnknown()){const e=this.keys.values().next().value,t=this.from[e];this.to.$unknown=[e,t]}}}const vn=/[&<>"]/g,En={"&":"&","<":"<",">":">",'"':"""};function Cn(e){return e.replace(vn,e=>En[e])}const An=/[&"'<>\r\n\u0085\u2028]/g,xn={"&":"&",'"':""","'":"'","<":"<",">":">","\r":"
","\n":"
","
":"…","\u2028":"
"};class kn{value;constructor(e){this.value=e}toString(){return(""+this.value).replace(An,e=>xn[e])}}class Rn{name;children;attributes={};static of(e,t,r){const s=new Rn(e);return void 0!==t&&s.addChildNode(new kn(t)),void 0!==r&&s.withName(r),s}constructor(e,t=[]){this.name=e,this.children=t}withName(e){return this.name=e,this}addAttribute(e,t){return this.attributes[e]=t,this}addChildNode(e){return this.children.push(e),this}removeAttribute(e){return delete this.attributes[e],this}n(e){return this.name=e,this}c(e){return this.children.push(e),this}a(e,t){return null!=t&&(this.attributes[e]=t),this}cc(e,t,r=t){if(null!=e[t]){const s=Rn.of(t,e[t]).withName(r);this.c(s)}}l(e,t,r,s){if(null!=e[t]){s().map(e=>{e.withName(r),this.c(e)})}}lc(e,t,r,s){if(null!=e[t]){const e=s(),t=new Rn(r);e.map(e=>{t.c(e)}),this.c(t)}}toString(){const e=Boolean(this.children.length);let t=`<${this.name}`;const r=this.attributes;for(const s of Object.keys(r)){const e=r[s];null!=e&&(t+=` ${s}="${Cn(""+e)}"`)}return t+(e?`>${this.children.map(e=>e.toString()).join("")}</${this.name}>`:"/>")}}let Tn;class Pn extends bn{settings;stringDeserializer;constructor(e){super(),this.settings=e,this.stringDeserializer=new _r(e)}setSerdeContext(e){this.serdeContext=e,this.stringDeserializer.setSerdeContext(e)}read(e,t,r){const s=$t.of(e),n=s.getMemberSchemas();if(s.isStructSchema()&&s.isMemberSchema()&&!!Object.values(n).find(e=>!!e.getMemberTraits().eventPayload)){const e={},r=Object.keys(n)[0];return n[r].isBlobSchema()?e[r]=t:e[r]=this.read(n[r],t),e}const i=(this.serdeContext?.utf8Encoder??W)(t),o=this.parseXml(i);return this.readSchema(e,r?o[r]:o)}readSchema(e,t){const r=$t.of(e);if(r.isUnitSchema())return;const s=r.getMergedTraits();if(r.isListSchema()&&!Array.isArray(t))return this.readSchema(r,[t]);if(null==t)return t;if("object"==typeof t){const e=!!s.xmlFlattened;if(r.isListSchema()){const s=r.getValueSchema(),n=[],i=s.getMergedTraits().xmlName??"member",o=e?t:(t[0]??t)[i];if(null==o)return n;const a=Array.isArray(o)?o:[o];for(const e of a)n.push(this.readSchema(s,e));return n}const n={};if(r.isMapSchema()){const s=r.getKeySchema(),i=r.getValueSchema();let o;o=e?Array.isArray(t)?t:[t]:Array.isArray(t.entry)?t.entry:[t.entry];const a=s.getMergedTraits().xmlName??"key",c=i.getMergedTraits().xmlName??"value";for(const e of o){const t=e[a],r=e[c];n[t]=this.readSchema(i,r)}return n}if(r.isStructSchema()){const e=r.isUnionSchema();let s;e&&(s=new Sn(t,n));for(const[i,o]of r.structIterator()){const r=o.getMergedTraits(),a=r.httpPayload?r.xmlName??o.getName():o.getMemberTraits().xmlName??i;e&&s.mark(a),null!=t[a]&&(n[i]=this.readSchema(o,t[a]))}return e&&s.writeUnknown(),n}if(r.isDocumentSchema())return t;throw new Error(`@aws-sdk/core/protocols - xml deserializer unhandled schema type for ${r.getName(!0)}`)}return r.isListSchema()?[]:r.isMapSchema()||r.isStructSchema()?{}:this.stringDeserializer.read(r,t)}parseXml(e){if(e.length){let r;try{r=function(e){Tn||(Tn=new DOMParser);const t=Tn.parseFromString(e,"application/xml");if(t.getElementsByTagName("parsererror").length>0)throw new Error("DOMParser XML parsing error.");const r=e=>{if(e.nodeType===Node.TEXT_NODE&&e.textContent?.trim())return e.textContent;if(e.nodeType===Node.ELEMENT_NODE){const t=e;if(0===t.attributes.length&&0===t.childNodes.length)return"";const s={},n=Array.from(t.attributes);for(const e of n)s[`${e.name}`]=e.value;const i=Array.from(t.childNodes);for(const e of i){const o=r(e);if(null!=o){const t=e.nodeName;if(1===i.length&&0===n.length&&"#text"===t)return o;s[t]?Array.isArray(s[t])?s[t].push(o):s[t]=[s[t],o]:s[t]=o}else if(1===i.length&&0===n.length)return t.textContent}return s}return null};return{[t.documentElement.nodeName]:r(t.documentElement)}}(e)}catch(t){throw t&&"object"==typeof t&&Object.defineProperty(t,"$responseBodyText",{value:e}),t}const s="#text",n=Object.keys(r)[0],i=r[n];return i[s]&&(i[n]=i[s],delete i[s]),Jr(i)}return{}}}class In extends bn{settings;stringBuffer;byteBuffer;buffer;constructor(e){super(),this.settings=e}write(e,t){const r=$t.of(e);if(r.isStringSchema()&&"string"==typeof t)this.stringBuffer=t;else if(r.isBlobSchema())this.byteBuffer="byteLength"in t?t:(this.serdeContext?.base64Decoder??F)(t);else{this.buffer=this.writeStruct(r,t,void 0);const e=r.getMergedTraits();e.httpPayload&&!e.xmlName&&this.buffer.withName(r.getName())}}flush(){if(void 0!==this.byteBuffer){const e=this.byteBuffer;return delete this.byteBuffer,e}if(void 0!==this.stringBuffer){const e=this.stringBuffer;return delete this.stringBuffer,e}const e=this.buffer;return this.settings.xmlNamespace&&(e?.attributes?.xmlns||e.addAttribute("xmlns",this.settings.xmlNamespace)),delete this.buffer,e.toString()}writeStruct(e,t,r){const s=e.getMergedTraits(),n=e.isMemberSchema()&&!s.httpPayload?e.getMemberTraits().xmlName??e.getMemberName():s.xmlName??e.getName();if(!n||!e.isStructSchema())throw new Error(`@aws-sdk/core/protocols - xml serializer, cannot write struct with empty name or non-struct, schema=${e.getName(!0)}.`);const i=Rn.of(n),[o,a]=this.getXmlnsAttribute(e,r);for(const[u,d]of e.structIterator()){const e=t[u];if(null!=e||d.isIdempotencyToken()){if(d.getMergedTraits().xmlAttribute){i.addAttribute(d.getMergedTraits().xmlName??u,this.writeSimple(d,e));continue}if(d.isListSchema())this.writeList(d,e,i,a);else if(d.isMapSchema())this.writeMap(d,e,i,a);else if(d.isStructSchema())i.addChildNode(this.writeStruct(d,e,a));else{const t=Rn.of(d.getMergedTraits().xmlName??d.getMemberName());this.writeSimpleInto(d,e,t,a),i.addChildNode(t)}}}const{$unknown:c}=t;if(c&&e.isUnionSchema()&&Array.isArray(c)&&1===Object.keys(t).length){const[e,r]=c,s=Rn.of(e);if("string"!=typeof r){if(!(t instanceof Rn||t instanceof kn))throw new Error("@aws-sdk - $unknown union member in XML requires value of type string, @aws-sdk/xml-builder::XmlNode or XmlText.");i.addChildNode(t)}this.writeSimpleInto(0,r,s,a),i.addChildNode(s)}return a&&i.addAttribute(o,a),i}writeList(e,t,r,s){if(!e.isMemberSchema())throw new Error(`@aws-sdk/core/protocols - xml serializer, cannot write non-member list: ${e.getName(!0)}`);const n=e.getMergedTraits(),i=e.getValueSchema(),o=i.getMergedTraits(),a=!!o.sparse,c=!!n.xmlFlattened,[u,d]=this.getXmlnsAttribute(e,s),l=(t,r)=>{if(i.isListSchema())this.writeList(i,Array.isArray(r)?r:[r],t,d);else if(i.isMapSchema())this.writeMap(i,r,t,d);else if(i.isStructSchema()){const s=this.writeStruct(i,r,d);t.addChildNode(s.withName(c?n.xmlName??e.getMemberName():o.xmlName??"member"))}else{const s=Rn.of(c?n.xmlName??e.getMemberName():o.xmlName??"member");this.writeSimpleInto(i,r,s,d),t.addChildNode(s)}};if(c)for(const h of t)(a||null!=h)&&l(r,h);else{const s=Rn.of(n.xmlName??e.getMemberName());d&&s.addAttribute(u,d);for(const e of t)(a||null!=e)&&l(s,e);r.addChildNode(s)}}writeMap(e,t,r,s,n=!1){if(!e.isMemberSchema())throw new Error(`@aws-sdk/core/protocols - xml serializer, cannot write non-member map: ${e.getName(!0)}`);const i=e.getMergedTraits(),o=e.getKeySchema(),a=o.getMergedTraits().xmlName??"key",c=e.getValueSchema(),u=c.getMergedTraits(),d=u.xmlName??"value",l=!!u.sparse,h=!!i.xmlFlattened,[f,p]=this.getXmlnsAttribute(e,s),m=(e,t,r)=>{const s=Rn.of(a,t),[n,i]=this.getXmlnsAttribute(o,p);i&&s.addAttribute(n,i),e.addChildNode(s);let u=Rn.of(d);c.isListSchema()?this.writeList(c,r,u,p):c.isMapSchema()?this.writeMap(c,r,u,p,!0):c.isStructSchema()?u=this.writeStruct(c,r,p):this.writeSimpleInto(c,r,u,p),e.addChildNode(u)};if(h)for(const g in t){const s=t[g];if(l||null!=s){const t=Rn.of(i.xmlName??e.getMemberName());m(t,g,s),r.addChildNode(t)}}else{let s;n||(s=Rn.of(i.xmlName??e.getMemberName()),p&&s.addAttribute(f,p),r.addChildNode(s));for(const e in t){const i=t[e];if(l||null!=i){const t=Rn.of("entry");m(t,e,i),(n?r:s).addChildNode(t)}}}}writeSimple(e,t){if(null===t)throw new Error("@aws-sdk/core/protocols - (XML serializer) cannot write null value.");const r=$t.of(e);let s=null;if(t&&"object"==typeof t)if(r.isBlobSchema())s=(this.serdeContext?.base64Encoder??G)(t);else{if(!(r.isTimestampSchema()&&t instanceof Date)){if(r.isBigDecimalSchema()&&t)return t instanceof Nr?t.string:String(t);throw r.isMapSchema()||r.isListSchema()?new Error("@aws-sdk/core/protocols - xml serializer, cannot call _write() on List/Map schema, call writeList or writeMap() instead."):new Error(`@aws-sdk/core/protocols - xml serializer, unhandled schema type for object value and schema: ${r.getName(!0)}`)}switch(Dr(r,this.settings)){case 5:s=t.toISOString().replace(".000Z","Z");break;case 6:s=Qt(t);break;case 7:s=String(t.getTime()/1e3);break;default:console.warn("Missing timestamp format, using http date",t),s=Qt(t)}}if((r.isBooleanSchema()||r.isNumericSchema()||r.isBigIntegerSchema()||r.isBigDecimalSchema())&&(s=String(t)),r.isStringSchema()&&(s=void 0===t&&r.isIdempotencyToken()?mr():String(t)),null===s)throw new Error(`Unhandled schema-value pair ${r.getName(!0)}=${t}`);return s}writeSimpleInto(e,t,r,s){const n=this.writeSimple(e,t),i=$t.of(e),o=new kn(n),[a,c]=this.getXmlnsAttribute(i,s);c&&r.addAttribute(a,c),r.addChildNode(o)}getXmlnsAttribute(e,t){const r=e.getMergedTraits(),[s,n]=r.xmlNamespace??[];return n&&n!==t?[s?`xmlns:${s}`:"xmlns",n]:[void 0,void 0]}}class Mn extends bn{settings;constructor(e){super(),this.settings=e}createSerializer(){const e=new In(this.settings);return e.setSerdeContext(this.serdeContext),e}createDeserializer(){const e=new Pn(this.settings);return e.setSerdeContext(this.serdeContext),e}}class Nn extends Ur{codec;serializer;deserializer;mixin=new wn;constructor(e){super(e);const t={timestampFormat:{useTrait:!0,default:5},httpBindings:!0,xmlNamespace:e.xmlNamespace,serviceNamespace:e.defaultNamespace};this.codec=new Mn(t),this.serializer=new zr(this.codec.createSerializer(),t),this.deserializer=new Lr(this.codec.createDeserializer(),t)}getPayloadCodec(){return this.codec}getShapeId(){return"aws.protocols#restXml"}async serializeRequest(e,t,r){const s=await super.serializeRequest(e,t,r),n=$t.of(e.input);if(!s.headers["content-type"]){const e=this.mixin.resolveRestContentType(this.getDefaultContentType(),n);e&&(s.headers["content-type"]=e)}return"string"!=typeof s.body||s.headers["content-type"]!==this.getDefaultContentType()||s.body.startsWith("<?xml ")||this.hasUnstructuredPayloadBinding(n)||(s.body='<?xml version="1.0" encoding="UTF-8"?>'+s.body),s}async deserializeResponse(e,t,r){return super.deserializeResponse(e,t,r)}async handleError(e,t,r,s,n){const i=((e,t)=>void 0!==t?.Error?.Code?t.Error.Code:void 0!==t?.Code?t.Code:404==e.statusCode?"NotFound":void 0)(r,s)??"Unknown";if(this.mixin.compose(this.compositeErrorRegistry,i,this.options.defaultNamespace),s.Error&&"object"==typeof s.Error)for(const f of Object.keys(s.Error))s[f]=s.Error[f],"message"===f.toLowerCase()&&(s.message=s.Error[f]);s.RequestId&&!n.requestId&&(n.requestId=s.RequestId);const{errorSchema:o,errorMetadata:a}=await this.mixin.getErrorSchemaOrThrowBaseException(i,this.options.defaultNamespace,r,s,n),c=$t.of(o),u=s.Error?.message??s.Error?.Message??s.message??s.Message??"UnknownError",d=new(this.compositeErrorRegistry.getErrorCtor(o)??Error)(u);await this.deserializeHttpMessage(o,t,r,s);const l={},h=this.codec.createDeserializer();for(const[f,p]of c.structIterator()){const e=p.getMergedTraits().xmlName??f,t=s.Error?.[e]??s[e];l[f]=h.readSchema(p,t)}throw this.mixin.decorateServiceException(Object.assign(d,a,{$fault:c.getMergedTraits().error,message:u},l),s)}getDefaultContentType(){return"application/xml"}hasUnstructuredPayloadBinding(e){for(const[,t]of e.structIterator())if(t.getMergedTraits().httpPayload)return!(t.isStructSchema()||t.isMapSchema()||t.isListSchema());return!1}}class On extends Nn{async serializeRequest(e,t,r){const s=await super.serializeRequest(e,t,r),n=$t.of(e.input);let i=0;const o=n.getSchema()[6]??0;if(t&&"object"==typeof t)for(const[a,c]of n.structIterator()){if(++i>o)break;if("Bucket"===a){if(!t.Bucket&&c.getMergedTraits().httpLabel)throw new Error("No value provided for input HTTP label: Bucket.");break}}return s}}class $n{nodes;root;conditions;results;constructor(e,t,r,s){this.nodes=e,this.root=t,this.conditions=r,this.results=s}static from(e,t,r,s){return new $n(e,t,r,s)}}class Un extends Error{constructor(e){super(e),this.name="EndpointError"}}function Dn(e){return"object"!=typeof e||null==e?e:"ref"in e?`$${Dn(e.ref)}`:"fn"in e?`${e.fn}(${(e.argv||[]).map(Dn).join(", ")})`:JSON.stringify(e,null,2)}const _n={};const Ln=(e,t)=>(e=>{const t=e.split("."),r=[];for(const s of t){const t=s.indexOf("[");if(-1!==t){if(s.indexOf("]")!==s.length-1)throw new Un(`Path: '${e}' does not end with ']'`);const n=s.slice(t+1,-1);if(Number.isNaN(parseInt(n)))throw new Un(`Invalid array index: '${n}' in path: '${e}'`);0!==t&&r.push(s.slice(0,t)),r.push(n)}else r.push(s)}return r})(t).reduce((r,s)=>{if("object"!=typeof r)throw new Un(`Index '${s}' in '${t}' not found in '${JSON.stringify(e)}'`);if(Array.isArray(r)){const e=parseInt(s);return r[e<0?r.length+e:e]}return r[s]},e),Bn=new RegExp("^(?!.*-$)(?!-)[a-zA-Z0-9-]{1,63}$"),zn=(e,t=!1)=>{if(!t)return Bn.test(e);const r=e.split(".");for(const s of r)if(!zn(s))return!1;return!0};const jn=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}$"),Hn=e=>jn.test(e)||e.startsWith("[")&&e.endsWith("]"),qn={[t.HTTP]:80,[t.HTTPS]:443};const Fn={booleanEquals:(e,t)=>e===t,coalesce:function(...e){for(const t of e)if(null!=t)return t},getAttr:Ln,isSet:e=>null!=e,isValidHostLabel:zn,ite:function(e,t,r){return e?t:r},not:e=>!e,parseURL:e=>{const r=(()=>{try{if(e instanceof URL)return e;if("object"==typeof e&&"hostname"in e){const{hostname:t,port:r,protocol:s="",path:n="",query:i={}}=e,o=new URL(`${s}//${t}${r?`:${r}`:""}${n}`);return o.search=Object.entries(i).map(([e,t])=>`${e}=${t}`).join("&"),o}return new URL(e)}catch(t){return null}})();if(!r)return console.error(`Unable to parse ${JSON.stringify(e)} as a whatwg URL.`),null;const s=r.href,{host:n,hostname:i,pathname:o,protocol:a,search:c}=r;if(c)return null;const u=a.slice(0,-1);if(!Object.values(t).includes(u))return null;const d=Hn(i);return{scheme:u,authority:`${n}${s.includes(`${n}:${qn[u]}`)||"string"==typeof e&&e.includes(`${n}:${qn[u]}`)?`:${qn[u]}`:""}`,path:o,normalizedPath:o.endsWith("/")?o:`${o}/`,isIp:d}},split:function(e,t,r){if(1===r)return[e];if(""===e)return[""];const s=e.split(t);return 0===r?s:s.slice(0,r-1).concat(s.slice(1).join(t))},stringEquals:(e,t)=>e===t,substring:(e,t,r,s)=>null==e||t>=r||e.length<r||/[^\u0000-\u007f]/.test(e)?null:s?e.substring(e.length-r,e.length-t):e.substring(t,r),uriEncode:e=>encodeURIComponent(e).replace(/[!*'()]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)},Kn=(e,t)=>{const r=[],{referenceRecord:s,endpointParams:n}=t;let i=0;for(;i<e.length;){const t=e.indexOf("{",i);if(-1===t){r.push(e.slice(i));break}r.push(e.slice(i,t));const o=e.indexOf("}",t);if(-1===o){r.push(e.slice(t));break}"{"===e[t+1]&&"}"===e[o+1]&&(r.push(e.slice(t+1,o)),i=o+2);const a=e.substring(t+1,o);if(a.includes("#")){const[e,t]=a.split("#");r.push(Ln(s[e]??n[e],t))}else r.push(s[a]??n[a]);i=o+1}return r.join("")},Vn=(e,t,r)=>{if("string"==typeof e)return Kn(e,r);if(e.fn)return Gn.callFunction(e,r);if(e.ref)return(({ref:e},t)=>t.referenceRecord[e]??t.endpointParams[e])(e,r);throw new Un(`'${t}': ${String(e)} is not a string, function or reference.`)},Wn=({fn:e,argv:t},r)=>{const s=Array(t.length);for(let o=0;o<s.length;++o){const e=t[o];s[o]="boolean"==typeof e||"number"==typeof e?e:Gn.evaluateExpression(e,"arg",r)}const n=e.indexOf(".");if(-1!==n){const t=_n[e.slice(0,n)],r=t?.[e.slice(n+1)];if("function"==typeof r)return r(...s)}const i=Fn[e];if("function"==typeof i)return i(...s);throw new Error(`function ${e} not loaded in endpointFunctions.`)},Gn={evaluateExpression:Vn,callFunction:Wn},Xn=(e,t)=>{const{assign:r}=e;if(r&&r in t.referenceRecord)throw new Un(`'${r}' is already defined in Reference Record.`);const s=Wn(e,t);t.logger?.debug?.(`endpoints evaluateCondition: ${Dn(e)} = ${Dn(s)}`);const n=""===s||!!s;return null!=r?{result:n,toAssign:{name:r,value:s}}:{result:n}},Yn=(e,t)=>Object.entries(e??{}).reduce((e,[r,s])=>(e[r]=s.map(e=>{const s=Vn(e,"Header value entry",t);if("string"!=typeof s)throw new Un(`Header '${r}' value '${s}' is not a string`);return s}),e),{}),Jn=(e,t)=>Object.entries(e).reduce((e,[r,s])=>(e[r]=Zn.getEndpointProperty(s,t),e),{}),Qn=(e,t)=>{if(Array.isArray(e))return e.map(e=>Qn(e,t));switch(typeof e){case"string":return Kn(e,t);case"object":if(null===e)throw new Un(`Unexpected endpoint property: ${e}`);return Zn.getEndpointProperties(e,t);case"boolean":return e;default:throw new Un("Unexpected endpoint property type: "+typeof e)}},Zn={getEndpointProperty:Qn,getEndpointProperties:Jn},ei=(e,t)=>{const r=Vn(e,"Endpoint URL",t);if("string"==typeof r)try{return new URL(r)}catch(s){throw console.error(`Failed to construct URL with ${r}`,s),s}throw new Un("Endpoint URL must be a string, got "+typeof r)},ti=1e8,ri=(e,t=!1)=>{if(t){for(const t of e.split("."))if(!ri(t))return!1;return!0}return!!zn(e)&&(!(e.length<3||e.length>63)&&(e===e.toLowerCase()&&!Hn(e)))};let si={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)"}}}]};const ni={isVirtualHostableS3Bucket:ri,parseArn:e=>{const t=e.split(":");if(t.length<6)return null;const[r,s,n,i,o,...a]=t;if("arn"!==r||""===s||""===n||""===a.join(":"))return null;return{partition:s,service:n,region:i,accountId:o,resourceId:a.map(e=>e.split("/")).flat()}},partition:e=>{const{partitions:t}=si;for(const s of t){const{regions:t,outputs:r}=s;for(const[s,n]of Object.entries(t))if(s===e)return{...r,...n}}for(const s of t){const{regionRegex:t,outputs:r}=s;if(new RegExp(t).test(e))return{...r}}const r=t.find(e=>"aws"===e.id);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}}};_n.aws=ni;const ii=/\d{12}\.ddb/;const oi="user-agent",ai="x-amz-user-agent",ci=/[^!$%&'*+\-.^_`|~\w]/g,ui=/[^!$%&'*+\-.^_`|~\w#]/g;const di=e=>(t,r)=>async s=>{const{request:n}=s;if(!o.isInstance(n))return t(s);const{headers:i}=n,a=r?.userAgent?.map(li)||[],c=(await e.defaultUserAgentProvider()).map(li);await async function(e,t,r){const s=r.request;if("rpc-v2-cbor"===s?.headers?.["smithy-protocol"]&&z(e,"PROTOCOL_RPC_V2_CBOR","M"),"function"==typeof t.retryStrategy){const r=await t.retryStrategy();if("string"==typeof r.mode)switch(r.mode){case v.ADAPTIVE:z(e,"RETRY_MODE_ADAPTIVE","F");break;case v.STANDARD:z(e,"RETRY_MODE_STANDARD","E")}}if("function"==typeof t.accountIdEndpointMode){const r=e.endpointV2;switch(String(r?.url?.hostname).match(ii)&&z(e,"ACCOUNT_ID_ENDPOINT","O"),await(t.accountIdEndpointMode?.())){case"disabled":z(e,"ACCOUNT_ID_MODE_DISABLED","Q");break;case"preferred":z(e,"ACCOUNT_ID_MODE_PREFERRED","P");break;case"required":z(e,"ACCOUNT_ID_MODE_REQUIRED","R")}}const n=e.__smithy_context?.selectedHttpAuthScheme?.identity;if(n?.$source){const t=n;t.accountId&&z(e,"RESOLVED_ACCOUNT_ID","T");for(const[r,s]of Object.entries(t.$source??{}))z(e,r,s)}}(r,e,s);const u=r;c.push(`m/${function(e){let t="";for(const r in e){const s=e[r];if(!(t.length+s.length+1<=1024))break;t.length?t+=","+s:t+=s}return t}(Object.assign({},r.__smithy_context?.features,u.__aws_sdk_context?.features))}`);const d=e?.customUserAgent?.map(li)||[],l=await e.userAgentAppId();l&&c.push(li(["app",`${l}`]));const h=[].concat([...c,...a,...d]).join(" "),f=[...c.filter(e=>e.startsWith("aws-sdk-")),...d].join(" ");return"browser"!==e.runtime?(f&&(i[ai]=i[ai]?`${i[oi]} ${f}`:f),i[oi]=h):i[ai]=h,t({...s,request:n})},li=e=>{const t=e[0].split("/").map(e=>e.replace(ci,"-")).join("/"),r=e[1]?.replace(ui,"-"),s=t.indexOf("/"),n=t.substring(0,s);let i=t.substring(s+1);return"api"===n&&(i=i.toLowerCase()),[n,i,r].filter(e=>e&&e.length>0).reduce((e,t,r)=>{switch(r){case 0:return t;case 1:return`${e}/${t}`;default:return`${e}#${t}`}},"")},hi={name:"getUserAgentMiddleware",step:"build",priority:"low",tags:["SET_USER_AGENT","USER_AGENT"],override:!0},fi=/* @__PURE__ */new Set,pi=e=>"string"==typeof e&&(e.startsWith("fips-")||e.endsWith("-fips")),mi=e=>{const{region:t,useFipsEndpoint:r}=e;if(!t)throw new Error("Region is missing");return Object.assign(e,{region:async()=>{const e=(e=>pi(e)?["fips-aws-global","aws-fips"].includes(e)?"us-east-1":e.replace(/fips-(dkr-|prod-)?|-fips/,""):e)("function"==typeof t?await t():t);return((e,t=zn)=>{if(fi.has(e)||t(e))fi.add(e);else{if("*"!==e)throw new Error(`Region not accepted: region="${e}" is not a valid hostname component.`);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.')}})(e),e},useFipsEndpoint:async()=>{const e="string"==typeof t?t:await t();return!!pi(e)||("function"!=typeof r?Promise.resolve(!!r):r())}})},gi="content-length";const yi={step:"build",tags:["SET_CONTENT_LENGTH","CONTENT_LENGTH"],name:"contentLengthMiddleware",override:!0},wi=e=>({applyToStack:t=>{var r;t.add((r=e.bodyLengthChecker,e=>async t=>{const s=t.request;if(o.isInstance(s)){const{body:e,headers:t}=s;if(e&&-1===Object.keys(t).map(e=>e.toLowerCase()).indexOf(gi))try{const t=r(e);s.headers={...s.headers,[gi]:String(t)}}catch(n){}}return e({...t,request:s})}),yi)}}),bi=/^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/,Si=/(\d+\.){3}\d+/,vi=/\.\./,Ei=e=>bi.test(e)&&!Si.test(e)&&!vi.test(e),Ci=e=>{const[t,r,s,,,n]=e.split(":"),i="arn"===t&&e.split(":").length>=6,o=Boolean(i&&r&&s&&n);if(i&&!o)throw new Error(`Invalid ARN: ${e} was an invalid ARN.`);return o},Ai=(e,t,r,s=!1)=>{const n=async()=>{let n;if(s){const s=r.clientContextParams,i=s?.[e];n=i??r[e]??r[t]}else n=r[e]??r[t];return"function"==typeof n?n():n};return"credentialScope"===e||"CredentialScope"===t?async()=>{const e="function"==typeof r.credentials?await r.credentials():r.credentials;return e?.credentialScope??e?.CredentialScope}:"accountId"===e||"AccountId"===t?async()=>{const e="function"==typeof r.credentials?await r.credentials():r.credentials;return e?.accountId??e?.AccountId}:"endpoint"===e||"endpoint"===t?async()=>{if(!1===r.isCustomEndpoint)return;const e=await n();if(e&&"object"==typeof e){if("url"in e)return e.url.href;if("hostname"in e){const{protocol:t,hostname:r,port:s,path:n}=e;return`${t}//${r}${s?":"+s:""}${n}`}}return e}:n},xi=async e=>{},ki=e=>{if("object"==typeof e){if("url"in e){const t=Ct(e.url);if(e.headers){t.headers={};for(const[r,s]of Object.entries(e.headers))t.headers[r.toLowerCase()]=s.join(", ")}return t}return e}return Ct(e)},Ri=async(e,t,r)=>{const s={},n=t?.getEndpointParameterInstructions?.()||{};for(const[i,o]of Object.entries(n))switch(o.type){case"staticContextParams":s[i]=o.value;break;case"contextParams":s[i]=e[o.name];break;case"clientContextParams":case"builtInParams":s[i]=await Ai(o.name,i,r,"builtInParams"!==o.type)();break;case"operationContextParams":s[i]=o.get(e);break;default:throw new Error("Unrecognized endpoint parameter instruction: "+JSON.stringify(o))}return 0===Object.keys(n).length&&Object.assign(s,r),"s3"===String(r.serviceId).toLowerCase()&&await(async e=>{const t=e?.Bucket||"";if("string"==typeof e.Bucket&&(e.Bucket=t.replace(/#/g,encodeURIComponent("#")).replace(/\?/g,encodeURIComponent("?"))),Ci(t)){if(!0===e.ForcePathStyle)throw new Error("Path-style addressing cannot be used with ARN buckets")}else(!Ei(t)||-1!==t.indexOf(".")&&!String(e.Endpoint).startsWith("http:")||t.toLowerCase()!==t||t.length<3)&&(e.ForcePathStyle=!0);return e.DisableMultiRegionAccessPoints&&(e.disableMultiRegionAccessPoints=!0,e.DisableMRAP=!0),e})(s),s},Ti=({config:e,instructions:t})=>(r,s)=>async n=>{e.isCustomEndpoint&&function(e,t,r){e.__smithy_context?e.__smithy_context.features||(e.__smithy_context.features={}):e.__smithy_context={features:{}},e.__smithy_context.features[t]=r}(s,"ENDPOINT_OVERRIDE","N");const i=await(async(e,t,r,s)=>{if(!r.isCustomEndpoint){let e;e=r.serviceConfiguredEndpoint?await r.serviceConfiguredEndpoint():await xi(r.serviceId),e&&(r.endpoint=()=>Promise.resolve(ki(e)),r.isCustomEndpoint=!0)}const n=await Ri(e,t,r);if("function"!=typeof r.endpointProvider)throw new Error("config.endpointProvider is not set.");const i=r.endpointProvider(n,s);if(r.isCustomEndpoint&&r.endpoint){const e=await r.endpoint();if(e?.headers){i.headers??={};for(const[t,r]of Object.entries(e.headers))i.headers[t]=Array.isArray(r)?r:[r]}}return i})(n.input,{getEndpointParameterInstructions:()=>t},{...e},s);s.endpointV2=i,s.authSchemes=i.properties?.authSchemes;const o=s.authSchemes?.[0];if(o){s.signing_region=o.signingRegion,s.signing_service=o.signingName;const e=ot(s),t=e?.selectedHttpAuthScheme?.httpAuthOption;t&&(t.signingProperties=Object.assign(t.signingProperties||{},{signing_region:o.signingRegion,signingRegion:o.signingRegion,signing_service:o.signingName,signingName:o.signingName,signingRegionSet:o.signingRegionSet},o.properties))}return r({...n})},Pi={step:"serialize",tags:["ENDPOINT_PARAMETERS","ENDPOINT_V2","ENDPOINT"],name:"endpointV2Middleware",override:!0,relation:"before",toMiddleware:"serializerMiddleware"},Ii=(e,t)=>({applyToStack:r=>{r.addRelativeTo(Ti({config:e,instructions:t}),Pi)}}),Mi=e=>e instanceof Error?e:e instanceof Object?Object.assign(new Error,e):"string"==typeof e?new Error(e):new Error(`AWS SDK error wrapper for ${e}`),Ni=e=>{const{retryStrategy:t,retryMode:r}=e,s=at(e.maxAttempts??3);let n=t?Promise.resolve(t):void 0;return Object.assign(e,{maxAttempts:s,retryStrategy:()=>n??=(async()=>await at(r)()===v.ADAPTIVE?new B(s):new L(s))()})},Oi=e=>e?.body instanceof ReadableStream;const $i=e=>new Promise(t=>setTimeout(t,e)),Ui=e=>void 0!==e.acquireInitialRetryToken&&void 0!==e.refreshRetryTokenForRetry&&void 0!==e.recordSuccess,Di=(e,t)=>{const r={error:e,errorType:_i(e)},s=function(e,t){if(a.isInstance(e))for(const s of Object.keys(e.headers)){const n=s.toLowerCase();if("retry-after"===n){const n=e.headers[s];let i=NaN;if(n.endsWith("GMT"))try{i=(rr(n).getTime()-Date.now())/1e3}catch(r){t?.trace?.("Failed to parse retry-after header"),t?.trace?.(r)}else n.match(/ GMT, ((\d+)|(\d+\.\d+))$/)?i=Number(n.match(/ GMT, ([\d.]+)$/)?.[1]):n.match(/^((\d+)|(\d+\.\d+))$/)?i=Number(n):Date.parse(n)>=Date.now()&&(i=(Date.parse(n)-Date.now())/1e3);if(isNaN(i))return;return new Date(Date.now()+1e3*i)}if("x-amz-retry-after"===n){const r=e.headers[s],n=Number(r);return isNaN(n)?void t?.trace?.(`Failed to parse x-amz-retry-after=${r}`):new Date(Date.now()+n)}}}(e.$response,t);return s&&(r.retryAfterHint=s),r},_i=e=>P(e)?"THROTTLING":I(e)?"TRANSIENT":(e=>{if(void 0!==e.$metadata?.httpStatusCode){const t=e.$metadata.httpStatusCode;return 500<=t&&t<=599&&!I(e)}return!1})(e)?"SERVER_ERROR":"CLIENT_ERROR",Li={name:"retryMiddleware",tags:["RETRY"],step:"finalizeRequest",priority:"high",override:!0},Bi=e=>({applyToStack:t=>{t.add((e=>(t,r)=>async s=>{let n=await e.retryStrategy();const i=await e.maxAttempts();if(!Ui(n))return n?.mode&&(r.userAgent=[...r.userAgent||[],["cfg/retry-mode",n.mode]]),n.retry(t,s);{let u=await n.acquireInitialRetryToken((r.partition_id??"")+(r.__retryLongPoll?":longpoll":"")),d=new Error,l=0,h=0;const{request:f}=s,p=o.isInstance(f);for(p&&(f.headers["amz-sdk-invocation-id"]=mr());;)try{p&&(f.headers["amz-sdk-request"]=`attempt=${l+1}; max=${i}`);const{response:e,output:r}=await t(s);return n.recordSuccess(u),r.$metadata.attempts=l+1,r.$metadata.totalRetryDelay=h,{response:e,output:r}}catch(a){const t=Di(a,e.logger);if(d=Mi(a),p&&Oi(f))throw(r.logger instanceof Qr?console:r.logger)?.warn("An error was encountered in a non-retryable streaming request."),d;try{u=await n.refreshRetryTokenForRetry(u,t)}catch(c){throw"number"==typeof c.$backoff&&await $i(c.$backoff),d.$metadata||(d.$metadata={}),d.$metadata.attempts=l+1,d.$metadata.totalRetryDelay=h,d}l=u.getRetryCount();const s=u.getRetryDelay();h+=s,await $i(s)}}})(e),Li)}}),zi=e=>a.isInstance(e)?e.headers?.date??e.headers?.Date:void 0,ji=e=>new Date(Date.now()+e),Hi=(e,t)=>{const r=Date.parse(e);return((e,t)=>Math.abs(ji(t).getTime()-e)>=3e5)(r,t)?r-Date.now():t},qi=(e,t)=>{if(!t)throw new Error(`Property \`${e}\` is not resolved for AWS SDK SigV4Auth`);return t},Fi=async e=>{const t=qi("context",e.context),r=qi("config",e.config),s=t.endpointV2?.properties?.authSchemes?.[0],n=qi("signer",r.signer),i=await n(s),o=e?.signingRegion,a=e?.signingRegionSet,c=e?.signingName;return{config:r,signer:i,signingRegion:o,signingRegionSet:a,signingName:c}};class Ki{async sign(e,t,r){if(!o.isInstance(e))throw new Error("The request is not an instance of `HttpRequest` and cannot be signed");const s=await Fi(r),{config:n,signer:i}=s;let{signingRegion:a,signingName:c}=s;const u=r.context;if(u?.authSchemes?.length){const[e,t]=u.authSchemes;"sigv4a"===e?.name&&"sigv4"===t?.name&&(a=t?.signingRegion??a,c=t?.signingName??c)}return await i.sign(e,{signingDate:ji(n.systemClockOffset),signingRegion:a,signingService:c})}errorHandler(e){return t=>{const r=t.ServerTime??zi(t.$response);if(r){const s=qi("config",e.config),n=s.systemClockOffset;s.systemClockOffset=Hi(r,s.systemClockOffset);s.systemClockOffset!==n&&t.$metadata&&(t.$metadata.clockSkewCorrected=!0)}throw t}}successHandler(e,t){const r=zi(e);if(r){const e=qi("config",t.config);e.systemClockOffset=Hi(r,e.systemClockOffset)}}}class Vi extends Ki{async sign(e,t,r){if(!o.isInstance(e))throw new Error("The request is not an instance of `HttpRequest` and cannot be signed");const{config:s,signer:n,signingRegion:i,signingRegionSet:a,signingName:c}=await Fi(r),u=(await(s.sigv4aSigningRegionSet?.())??a??[i]).join(",");return await n.sign(e,{signingDate:ji(s.systemClockOffset),signingRegion:u,signingService:c})}}const Wi=(e,t,r)=>{let s,n,i,o=!1;return async t=>(i&&!t?.forceRefresh||(s=await(async()=>{n||(n=e());try{s=await n,i=!0,o=!1}finally{n=void 0}return s})()),s)},Gi=e=>{let t,r=e.credentials,s=!!e.credentials;Object.defineProperty(e,"credentials",{set(n){n&&n!==r&&n!==t&&(s=!0),r=n;const i=function(e,{credentials:t,credentialDefaultProvider:r}){let s;s=t?t?.memoized?t:((e,t,r)=>{if(void 0===e)return;const s="function"!=typeof e?async()=>Promise.resolve(e):e;let n,i,o,a=!1;const c=async e=>{i||(i=s(e));try{n=await i,o=!0,a=!1}finally{i=void 0}return n};return void 0===t?async e=>(o&&!e?.forceRefresh||(n=await c(e)),n):async e=>(o&&!e?.forceRefresh||(n=await c(e)),a?n:r(n)?t(n)?(await c(e),n):n:(a=!0,n))})(t,tn,sn):r?Zs(r(Object.assign({},e,{parentClientConfig:e}))):async()=>{throw new Error("@aws-sdk/core::resolveAwsSdkSigV4Config - `credentials` not provided and no credentialDefaultProvider was configured.")};return s.memoized=!0,s}(e,{credentials:r,credentialDefaultProvider:e.credentialDefaultProvider}),o=function(e,t){if(t.configBound)return t;const r=async r=>t({...r,callerClientConfig:e});return r.memoized=t.memoized,r.configBound=!0,r}(e,i);if(s&&!o.attributed){const e="object"==typeof r&&null!==r;t=async t=>{const r=await o(t);return!e||r.$source&&0!==Object.keys(r.$source).length?r:function(e,t,r){return e.$source||(e.$source={}),e.$source[t]=r,e}(r,"CREDENTIALS_CODE","e")},t.memoized=o.memoized,t.configBound=o.configBound,t.attributed=!0}else t=o},get:()=>t,enumerable:!0,configurable:!0}),e.credentials=r;const{signingEscapePath:n=!0,systemClockOffset:i=e.systemClockOffset||0,sha256:o}=e;let a;a=e.signer?Zs(e.signer):e.regionInfoProvider?()=>Zs(e.region)().then(async t=>[await e.regionInfoProvider(t,{useFipsEndpoint:await e.useFipsEndpoint(),useDualstackEndpoint:await e.useDualstackEndpoint()})||{},t]).then(([t,r])=>{const{signingRegion:s,signingService:i}=t;e.signingRegion=e.signingRegion||s||r,e.signingName=e.signingName||i||e.serviceId;const a={...e,credentials:e.credentials,region:e.signingRegion,service:e.signingName,sha256:o,uriEscapePath:n};return new(e.signerConstructor||Bs)(a)}):async t=>{const r=(t=Object.assign({},{name:"sigv4",signingName:e.signingName||e.defaultSigningName,signingRegion:await Zs(e.region)(),properties:{}},t)).signingRegion,s=t.signingName;e.signingRegion=e.signingRegion||r,e.signingName=e.signingName||s||e.serviceId;const i={...e,credentials:e.credentials,region:e.signingRegion,service:e.signingName,sha256:o,uriEscapePath:n};return new(e.signerConstructor||Bs)(i)};return Object.assign(e,{systemClockOffset:i,signingEscapePath:n,signer:a})};class Xi{sigv4aSigner;sigv4Signer;signerOptions;static sigv4aDependency(){return"none"}constructor(e){this.sigv4Signer=new Hs(e),this.signerOptions=e}async sign(e,t={}){return"*"===t.signingRegion?this.getSigv4aSigner().sign(e,t):this.sigv4Signer.sign(e,t)}async signWithCredentials(e,t,r={}){if("*"===r.signingRegion)throw this.getSigv4aSigner(),new Error('signWithCredentials with signingRegion \'*\' is only supported when using the CRT dependency @aws-sdk/signature-v4-crt. Please check whether you have installed the "@aws-sdk/signature-v4-crt" package explicitly. You must also register the package by calling [require("@aws-sdk/signature-v4-crt");] or an ESM equivalent such as [import "@aws-sdk/signature-v4-crt";]. For more information please go to https://github.com/aws/aws-sdk-js-v3#functionality-requiring-aws-common-runtime-crt');return this.sigv4Signer.signWithCredentials(e,t,r)}async presign(e,t={}){if("*"===t.signingRegion)throw this.getSigv4aSigner(),new Error('presign with signingRegion \'*\' is only supported when using the CRT dependency @aws-sdk/signature-v4-crt. Please check whether you have installed the "@aws-sdk/signature-v4-crt" package explicitly. You must also register the package by calling [require("@aws-sdk/signature-v4-crt");] or an ESM equivalent such as [import "@aws-sdk/signature-v4-crt";]. For more information please go to https://github.com/aws/aws-sdk-js-v3#functionality-requiring-aws-common-runtime-crt');return this.sigv4Signer.presign(e,t)}async presignWithCredentials(e,t,r={}){if("*"===r.signingRegion)throw new Error("Method presignWithCredentials is not supported for [signingRegion=*].");return this.sigv4Signer.presignWithCredentials(e,t,r)}getSigv4aSigner(){if(!this.sigv4aSigner)throw"node"===this.signerOptions.runtime?new Error("Neither CRT nor JS SigV4a implementation is available. Please load either @aws-sdk/signature-v4-crt or @aws-sdk/signature-v4a. For more information please go to https://github.com/aws/aws-sdk-js-v3#functionality-requiring-aws-common-runtime-crt"):new Error("JS SigV4a implementation is not available or not a valid constructor. Please check whether you have installed the @aws-sdk/signature-v4a package explicitly. The CRT implementation is not available for browsers. You must also register the package by calling [require('@aws-sdk/signature-v4a');] or an ESM equivalent such as [import '@aws-sdk/signature-v4a';]. For more information please go to https://github.com/aws/aws-sdk-js-v3#using-javascript-non-crt-implementation-of-sigv4a");return this.sigv4aSigner}}const Yi="ref",Ji="argv",Qi="backend",Zi="authSchemes",eo="disableDoubleEncoding",to="signingName",ro="signingRegion",so="signingRegionSet",no=-1,io=!0,oo=!1,ao="isSet",co="booleanEquals",uo="stringEquals",lo="coalesce",ho="substring",fo="",po="aws.partition",mo="partitionResult",go="accessPointSuffix",yo="regionPrefix",wo=e=>"outpostId_ssa_"+e+fo,bo="hardwareType",So="ite",vo="isValidHostLabel",Eo="sigv4",Co="aws.isVirtualHostableS3Bucket",Ao="getAttr",xo="bucketArn",ko="--",Ro="arnType",To="accesspoint",Po=e=>"accessPointName_ssa_"+e+fo,Io="s3-object-lambda",Mo="s3-outposts",No="bucketPartition",Oo="us-east-1",$o="outpostType",Uo="name",Do="s3",_o="{url#scheme}://{Bucket}.{url#authority}{url#path}",Lo="{url#scheme}://{url#authority}{url#path}",Bo="{url#scheme}://{url#authority}{url#normalizedPath}{Bucket}",zo="https://{Bucket}.s3-accelerate.{partitionResult#dnsSuffix}",jo="https://{Bucket}.s3.{partitionResult#dnsSuffix}",Ho=e=>"{url#scheme}://{accessPointName_ssa_"+e+"}-{bucketArn#accountId}.{url#authority}{url#path}",qo="sigv4a",Fo="{url#scheme}://{url#authority}{url#normalizedPath}{uri_encoded_bucket}",Ko="https://s3.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",Vo="https://s3.{partitionResult#dnsSuffix}",Wo={[Yi]:"UseFIPS"},Go={[Yi]:"UseDualStack"},Xo={[Yi]:"Bucket"},Yo={fn:Ao,[Ji]:[{[Yi]:mo},Uo]},Jo={[Yi]:"url"},Qo={[Yi]:"Region"},Zo={[Yi]:xo},ea={[Yi]:Ro},ta={[Yi]:"accessPointName_ssa_1"},ra={fn:Ao,[Ji]:[Zo,"region"]},sa={[Yi]:bo},na={fn:Ao,[Ji]:[Zo,"service"]},ia={fn:Ao,[Ji]:[Zo,"accountId"]},oa={[Qi]:"S3Express",[Zi]:[{[eo]:!0,[Uo]:"{_s3e_auth}",[to]:"s3express",[ro]:"{Region}"}]},aa={[Qi]:"S3Express",[Zi]:[{[eo]:!0,[Uo]:Eo,[to]:"s3express",[ro]:"{Region}"}]},ca={[Zi]:[{[eo]:!0,[Uo]:qo,[to]:Mo,[so]:["*"]},{[eo]:!0,[Uo]:Eo,[to]:Mo,[ro]:"{Region}"}]},ua={[Zi]:[{[eo]:!0,[Uo]:Eo,[to]:Do,[ro]:Oo}]},da={[Zi]:[{[eo]:!0,[Uo]:Eo,[to]:Do,[ro]:"{Region}"}]},la={[Zi]:[{[eo]:!0,[Uo]:Eo,[to]:Io,[ro]:"{bucketArn#region}"}]},ha={[Zi]:[{[eo]:!0,[Uo]:Eo,[to]:Do,[ro]:"{bucketArn#region}"}]},fa={[Zi]:[{[eo]:!0,[Uo]:qo,[to]:Mo,[so]:["*"]},{[eo]:!0,[Uo]:Eo,[to]:Mo,[ro]:"{bucketArn#region}"}]},pa={[Zi]:[{[eo]:!0,[Uo]:Eo,[to]:Io,[ro]:"{Region}"}]},ma=[Qo],ga=[{[Yi]:"Endpoint"}],ya=[Xo],wa=[Xo,0,7,!0],ba=[Zo,"resourceId[1]"],Sa={conditions:[[ao,ma],[co,[{[Yi]:"Accelerate"},io]],[co,[Wo,io]],[co,[Go,io]],[ao,ga],[ao,ya],[uo,[{fn:lo,[Ji]:[{fn:ho,[Ji]:[Xo,0,6,io]},fo]},"--x-s3"]],[uo,[{fn:lo,[Ji]:[{fn:ho,[Ji]:wa},fo]},"--xa-s3"]],[po,ma,mo],[ho,wa,go],[uo,[{[Yi]:go},"--op-s3"]],[ho,[Xo,8,12,io],yo],[ho,[Xo,32,49,io],wo(2)],[ho,[Xo,49,50,io],bo],[co,[{[Yi]:"ForcePathStyle"},io]],[uo,[Yo,"aws-cn"]],[So,[Go,".dualstack",fo],"_s3e_ds"],[vo,[{[Yi]:wo(2)},oo]],[So,[Wo,"-fips",fo],"_s3e_fips"],[So,[{fn:lo,[Ji]:[{[Yi]:"DisableS3ExpressSessionAuth"},oo]},Eo,"sigv4-s3express"],"_s3e_auth"],[Co,[Xo,oo]],["parseURL",ga,"url"],[co,[{fn:lo,[Ji]:[{[Yi]:"UseS3ExpressControlEndpoint"},oo]},io]],[Co,[Xo,io]],[uo,[{fn:Ao,[Ji]:[Jo,"scheme"]},"http"]],[vo,[Qo,oo]],["aws.parseArn",ya,xo],[Ao,[{fn:"split",[Ji]:[Xo,ko,0]},"[-2]"],"s3expressAvailabilityZoneId"],[uo,[{fn:lo,[Ji]:[{fn:ho,[Ji]:[Xo,0,4,oo]},fo]},"arn:"]],[uo,[{fn:lo,[Ji]:[{fn:ho,[Ji]:[Xo,16,18,io]},fo]},ko]],[co,[{fn:Ao,[Ji]:[Jo,"isIp"]},io]],[uo,[{fn:lo,[Ji]:[{fn:ho,[Ji]:[Xo,21,23,io]},fo]},ko]],[uo,[{fn:lo,[Ji]:[{fn:ho,[Ji]:[Xo,27,29,io]},fo]},ko]],[uo,[{[Yi]:yo},"beta"]],["uriEncode",ya,"uri_encoded_bucket"],[vo,[Qo,io]],[co,[{fn:lo,[Ji]:[{[Yi]:"UseObjectLambdaEndpoint"},oo]},io]],[Ao,[Zo,"resourceId[0]"],Ro],[uo,[ea,fo]],[uo,[ea,To]],[Ao,ba,Po(1)],[uo,[ta,fo]],[uo,[ra,fo]],[uo,[{fn:lo,[Ji]:[{fn:ho,[Ji]:[Xo,14,16,io]},fo]},ko]],[uo,[sa,"e"]],[uo,[sa,"o"]],[uo,[Qo,"aws-global"]],[uo,[{fn:lo,[Ji]:[{fn:ho,[Ji]:[Xo,19,21,io]},fo]},ko]],[uo,[na,Io]],[co,[{fn:lo,[Ji]:[{[Yi]:"DisableAccessPoints"},oo]},io]],[uo,[na,Mo]],[po,[ra],No],[vo,[ta,io]],[uo,[{fn:lo,[Ji]:[{fn:ho,[Ji]:[Xo,26,28,io]},fo]},ko]],[uo,[{fn:lo,[Ji]:[{fn:ho,[Ji]:[Xo,15,17,io]},fo]},ko]],[Ao,[Zo,"resourceId[4]"]],[uo,[{fn:lo,[Ji]:[{fn:ho,[Ji]:[Xo,20,22,io]},fo]},ko]],[co,[{[Yi]:"UseGlobalEndpoint"},io]],[uo,[Qo,Oo]],[Ao,ba,wo(1)],[co,[{fn:lo,[Ji]:[{[Yi]:"UseArnRegion"},io]},io]],[vo,[{[Yi]:wo(1)},oo]],[Ao,[Zo,"resourceId[2]"],$o],[uo,[Qo,ra]],[uo,[{fn:Ao,[Ji]:[{[Yi]:No},Uo]},Yo]],[co,[{[Yi]:"DisableMultiRegionAccessPoints"},io]],[vo,[ra,io]],[uo,[{fn:Ao,[Ji]:[Zo,"partition"]},Yo]],[uo,[ia,fo]],[uo,[na,Do]],[vo,[ia,oo]],[Ao,[Zo,"resourceId[3]"],Po(2)],[vo,[ta,oo]],[uo,[{[Yi]:$o},To]]],results:[[no],[no,"Accelerate cannot be used with FIPS"],[no,"Cannot set dual-stack in combination with a custom endpoint."],[no,"A custom endpoint cannot be combined with FIPS"],[no,"A custom endpoint cannot be combined with S3 Accelerate"],[no,"Partition does not support FIPS"],[no,"S3Express does not support S3 Accelerate."],["{url#scheme}://{url#authority}/{uri_encoded_bucket}{url#path}",oa],[_o,oa],[no,"S3Express bucket name is not a valid virtual hostable name."],["https://s3express-control{_s3e_fips}{_s3e_ds}.{Region}.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",aa],["https://{Bucket}.s3express{_s3e_fips}-{s3expressAvailabilityZoneId}{_s3e_ds}.{Region}.{partitionResult#dnsSuffix}",oa],[no,"Unrecognized S3Express bucket name format."],[Lo,oa],["https://s3express-control{_s3e_fips}{_s3e_ds}.{Region}.{partitionResult#dnsSuffix}",aa],[no,"Expected a endpoint to be specified but no endpoint was found"],["https://{Bucket}.ec2.{url#authority}",ca],["https://{Bucket}.ec2.s3-outposts.{Region}.{partitionResult#dnsSuffix}",ca],["https://{Bucket}.op-{outpostId_ssa_2}.{url#authority}",ca],["https://{Bucket}.op-{outpostId_ssa_2}.s3-outposts.{Region}.{partitionResult#dnsSuffix}",ca],[no,'Unrecognized hardware type: "Expected hardware type o or e but got {hardwareType}"'],[no,"Invalid Outposts Bucket alias - it must be a valid bucket name."],[no,"Invalid ARN: The outpost Id must only contain a-z, A-Z, 0-9 and `-`."],[no,"Custom endpoint `{Endpoint}` was not a valid URI"],[no,"S3 Accelerate cannot be used in this region"],["https://{Bucket}.s3-fips.dualstack.us-east-1.{partitionResult#dnsSuffix}",ua],["https://{Bucket}.s3-fips.dualstack.{Region}.{partitionResult#dnsSuffix}",da],["https://{Bucket}.s3-fips.us-east-1.{partitionResult#dnsSuffix}",ua],["https://{Bucket}.s3-fips.{Region}.{partitionResult#dnsSuffix}",da],["https://{Bucket}.s3-accelerate.dualstack.us-east-1.{partitionResult#dnsSuffix}",ua],["https://{Bucket}.s3-accelerate.dualstack.{partitionResult#dnsSuffix}",da],["https://{Bucket}.s3.dualstack.us-east-1.{partitionResult#dnsSuffix}",ua],["https://{Bucket}.s3.dualstack.{Region}.{partitionResult#dnsSuffix}",da],[Bo,ua],[_o,ua],[Bo,da],[_o,da],[zo,ua],[zo,da],[jo,ua],[jo,da],["https://{Bucket}.s3.{Region}.{partitionResult#dnsSuffix}",da],[no,"Invalid region: region was not a valid DNS name."],[no,"S3 Object Lambda does not support Dual-stack"],[no,"S3 Object Lambda does not support S3 Accelerate"],[no,"Access points are not supported for this operation"],[no,"Invalid configuration: region from ARN `{bucketArn#region}` does not match client region `{Region}` and UseArnRegion is `false`"],[no,"Invalid ARN: Missing account id"],[Ho(1),la],["https://{accessPointName_ssa_1}-{bucketArn#accountId}.s3-object-lambda-fips.{bucketArn#region}.{bucketPartition#dnsSuffix}",la],["https://{accessPointName_ssa_1}-{bucketArn#accountId}.s3-object-lambda.{bucketArn#region}.{bucketPartition#dnsSuffix}",la],[no,"Invalid ARN: The access point name may only contain a-z, A-Z, 0-9 and `-`. Found: `{accessPointName_ssa_1}`"],[no,"Invalid ARN: The account id may only contain a-z, A-Z, 0-9 and `-`. Found: `{bucketArn#accountId}`"],[no,"Invalid region in ARN: `{bucketArn#region}` (invalid DNS name)"],[no,"Client was configured for partition `{partitionResult#name}` but ARN (`{Bucket}`) has `{bucketPartition#name}`"],[no,"Invalid ARN: The ARN may only contain a single resource component after `accesspoint`."],[no,"Invalid ARN: bucket ARN is missing a region"],[no,"Invalid ARN: Expected a resource of the format `accesspoint:<accesspoint name>` but no name was provided"],[no,"Invalid ARN: Object Lambda ARNs only support `accesspoint` arn types, but found: `{arnType}`"],[no,"Access Points do not support S3 Accelerate"],["https://{accessPointName_ssa_1}-{bucketArn#accountId}.s3-accesspoint-fips.dualstack.{bucketArn#region}.{bucketPartition#dnsSuffix}",ha],["https://{accessPointName_ssa_1}-{bucketArn#accountId}.s3-accesspoint-fips.{bucketArn#region}.{bucketPartition#dnsSuffix}",ha],["https://{accessPointName_ssa_1}-{bucketArn#accountId}.s3-accesspoint.dualstack.{bucketArn#region}.{bucketPartition#dnsSuffix}",ha],[Ho(1),ha],["https://{accessPointName_ssa_1}-{bucketArn#accountId}.s3-accesspoint.{bucketArn#region}.{bucketPartition#dnsSuffix}",ha],[no,"Invalid ARN: The ARN was not for the S3 service, found: {bucketArn#service}"],[no,"S3 MRAP does not support dual-stack"],[no,"S3 MRAP does not support FIPS"],[no,"S3 MRAP does not support S3 Accelerate"],[no,"Invalid configuration: Multi-Region Access Point ARNs are disabled."],["https://{accessPointName_ssa_1}.accesspoint.s3-global.{partitionResult#dnsSuffix}",{[Zi]:[{[eo]:io,name:qo,[to]:Do,[so]:["*"]}]}],[no,"Client was configured for partition `{partitionResult#name}` but bucket referred to partition `{bucketArn#partition}`"],[no,"Invalid Access Point Name"],[no,"S3 Outposts does not support Dual-stack"],[no,"S3 Outposts does not support FIPS"],[no,"S3 Outposts does not support S3 Accelerate"],[no,"Invalid Arn: Outpost Access Point ARN contains sub resources"],["https://{accessPointName_ssa_2}-{bucketArn#accountId}.{outpostId_ssa_1}.{url#authority}",fa],["https://{accessPointName_ssa_2}-{bucketArn#accountId}.{outpostId_ssa_1}.s3-outposts.{bucketArn#region}.{bucketPartition#dnsSuffix}",fa],[no,"Expected an outpost type `accesspoint`, found {outpostType}"],[no,"Invalid ARN: expected an access point name"],[no,"Invalid ARN: Expected a 4-component resource"],[no,"Invalid ARN: The outpost Id may only contain a-z, A-Z, 0-9 and `-`. Found: `{outpostId_ssa_1}`"],[no,"Invalid ARN: The Outpost Id was not set"],[no,"Invalid ARN: Unrecognized format: {Bucket} (type: {arnType})"],[no,"Invalid ARN: No ARN type specified"],[no,"Invalid ARN: `{Bucket}` was not a valid ARN"],[no,"Path-style addressing cannot be used with ARN buckets"],["https://s3-fips.dualstack.us-east-1.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",ua],["https://s3-fips.dualstack.{Region}.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",da],["https://s3-fips.us-east-1.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",ua],["https://s3-fips.{Region}.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",da],["https://s3.dualstack.us-east-1.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",ua],["https://s3.dualstack.{Region}.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",da],[Fo,ua],[Fo,da],[Ko,ua],[Ko,da],["https://s3.{Region}.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",da],[no,"Path-style addressing cannot be used with S3 Accelerate"],[Lo,pa],["https://s3-object-lambda-fips.{Region}.{partitionResult#dnsSuffix}",pa],["https://s3-object-lambda.{Region}.{partitionResult#dnsSuffix}",pa],["https://s3-fips.dualstack.us-east-1.{partitionResult#dnsSuffix}",ua],["https://s3-fips.dualstack.{Region}.{partitionResult#dnsSuffix}",da],["https://s3-fips.us-east-1.{partitionResult#dnsSuffix}",ua],["https://s3-fips.{Region}.{partitionResult#dnsSuffix}",da],["https://s3.dualstack.us-east-1.{partitionResult#dnsSuffix}",ua],["https://s3.dualstack.{Region}.{partitionResult#dnsSuffix}",da],[Lo,ua],[Lo,da],[Vo,ua],[Vo,da],["https://s3.{Region}.{partitionResult#dnsSuffix}",da],[no,"A region must be set when sending requests to S3."]]},va=1e8,Ea=new Int32Array([-1,1,-1,0,3,va+114,1,422,4,2,270,5,3,231,6,4,84,7,5,15,8,8,9,va+114,16,10,13,18,11,13,19,12,13,22,va+14,13,35,14,va+42,36,va+102,433,6,269,16,7,268,17,8,19,18,14,499,105,9,20,24,10,21,24,11,22,24,12,23,24,13,545,24,14,76,25,20,72,26,26,27,77,37,28,va+85,38,va+85,29,39,46,30,48,va+58,31,50,32,va+84,51,33,135,55,va+76,34,59,35,va+83,60,39,36,61,37,va+82,62,38,145,63,41,va+46,61,40,va+82,62,41,149,64,42,va+54,66,43,va+53,70,44,va+52,71,45,va+80,73,va+78,va+79,40,47,va+57,41,va+57,48,42,183,49,48,61,50,49,va+45,51,51,52,524,60,55,53,62,va+55,54,63,56,va+46,62,va+55,56,64,57,va+54,66,58,va+53,69,59,va+65,70,60,va+52,72,va+64,va+51,49,va+45,62,51,63,524,60,66,64,62,va+55,65,63,67,va+46,62,va+55,67,64,68,va+54,66,69,va+53,68,va+47,70,70,71,va+52,72,va+50,va+51,25,73,va+42,46,va+39,74,57,75,va+41,58,va+40,va+41,26,va+87,77,28,va+86,78,34,81,79,35,80,543,36,va+102,va+114,46,va+96,82,57,83,va+98,58,va+97,va+98,5,100,85,8,86,va+114,16,87,88,18,90,88,19,89,91,21,96,94,19,92,91,21,97,94,21,96,93,22,va+14,94,35,95,va+42,36,va+102,va+42,22,va+13,97,35,98,va+42,36,va+100,99,46,va+109,va+110,6,212,101,7,206,102,8,118,103,14,117,104,21,105,va+23,26,106,500,37,107,va+85,38,va+85,108,39,111,109,48,va+58,110,50,135,va+84,40,112,va+57,41,va+57,113,42,114,498,48,va+56,115,52,116,va+72,65,va+69,va+72,21,499,va+23,9,119,123,10,120,123,11,121,123,12,122,123,13,200,123,14,193,124,20,188,125,21,126,va+23,23,127,128,24,187,128,26,129,195,37,130,va+85,38,va+85,131,39,157,132,48,va+58,133,50,134,va+84,51,140,135,55,va+76,136,59,137,va+83,60,va+82,138,61,139,va+82,63,va+82,va+46,55,va+76,141,59,142,va+83,60,147,143,61,144,va+82,62,146,145,63,149,va+46,63,152,va+46,61,148,va+82,62,152,149,64,150,va+54,66,151,va+53,70,va+81,va+52,64,153,va+54,66,154,va+53,70,155,va+52,71,156,va+80,73,va+77,va+79,40,158,va+57,41,va+57,159,42,183,160,48,172,161,49,va+45,162,51,163,524,60,166,164,62,va+55,165,63,167,va+46,62,va+55,167,64,168,va+54,66,169,va+53,69,170,va+65,70,171,va+52,72,va+63,va+51,49,va+45,173,51,174,524,60,177,175,62,va+55,176,63,178,va+46,62,va+55,178,64,179,va+54,66,180,va+53,68,va+47,181,70,182,va+52,72,va+48,va+51,48,va+56,184,52,185,va+72,65,va+69,186,67,va+70,va+71,25,va+36,va+42,21,189,va+23,25,190,va+42,30,192,191,46,va+34,va+36,46,va+33,va+35,21,194,va+23,26,va+87,195,28,va+86,196,34,199,197,35,198,543,36,va+100,va+114,46,va+94,va+95,17,201,va+22,20,202,va+21,21,203,548,33,204,548,44,va+16,205,45,va+18,va+20,8,207,213,16,208,218,18,209,218,19,210,222,20,211,225,21,229,399,8,216,213,19,214,va+9,20,215,225,21,229,va+9,16,217,218,18,221,218,19,219,222,20,220,225,21,229,va+12,19,224,222,20,223,va+9,21,va+9,va+12,20,228,225,21,226,va+9,30,227,va+9,34,va+7,va+9,21,229,413,30,230,va+8,34,va+7,va+8,4,va+2,232,5,233,478,6,269,234,7,268,235,8,236,489,9,237,241,10,238,241,11,239,241,12,240,241,13,545,241,14,264,242,20,262,243,26,244,265,37,245,va+85,38,va+85,246,39,247,516,40,248,va+57,41,va+57,249,42,536,250,48,va+43,251,49,va+45,252,51,253,524,60,256,254,62,va+55,255,63,257,va+46,62,va+55,257,64,258,va+54,66,259,va+53,69,260,va+65,70,261,va+52,72,va+62,va+51,25,263,va+42,46,va+31,va+32,26,va+87,265,28,va+86,266,34,267,542,46,va+92,va+93,8,395,va+9,8,405,va+9,3,344,271,4,va+3,272,5,282,273,8,274,va+114,15,va+5,275,16,276,279,18,277,279,19,278,279,22,va+14,279,35,280,va+42,36,va+101,281,46,va+105,va+106,6,403,283,7,393,284,8,293,285,14,499,286,26,287,500,37,288,va+85,38,va+85,289,39,290,305,40,291,va+57,41,va+57,292,42,333,498,9,294,298,10,295,298,11,296,298,12,297,298,13,392,298,14,337,299,15,va+5,300,20,335,301,26,302,339,37,303,va+85,38,va+85,304,39,307,305,48,va+58,306,50,va+74,va+84,40,308,va+57,41,va+57,309,42,333,310,48,322,311,49,va+45,312,51,313,524,60,316,314,62,va+55,315,63,317,va+46,62,va+55,317,64,318,va+54,66,319,va+53,69,320,va+65,70,321,va+52,72,va+61,va+51,49,va+45,323,51,324,524,60,327,325,62,va+55,326,63,328,va+46,62,va+55,328,64,329,va+54,66,330,va+53,68,va+47,331,70,332,va+52,72,va+49,va+51,48,va+56,334,52,va+67,va+72,25,336,va+42,46,va+27,va+28,15,va+5,338,26,va+87,339,28,va+86,340,34,343,341,35,342,543,36,va+101,va+114,46,va+90,va+91,4,va+2,345,5,355,346,8,347,va+114,15,va+5,348,16,349,352,18,350,352,19,351,352,22,va+14,352,35,353,va+42,36,va+43,354,46,va+103,va+104,6,403,356,7,393,357,8,358,489,9,359,363,10,360,363,11,361,363,12,362,363,13,392,363,14,387,364,15,va+5,365,20,385,366,26,367,389,37,368,va+85,38,va+85,369,39,370,516,40,371,va+57,41,va+57,372,42,536,373,48,va+43,374,49,va+45,375,51,376,524,60,379,377,62,va+55,378,63,380,va+46,62,va+55,380,64,381,va+54,66,382,va+53,69,383,va+65,70,384,va+52,72,va+60,va+51,25,386,va+42,46,va+25,va+26,15,va+5,388,26,va+87,389,28,va+86,390,34,391,542,46,va+88,va+89,15,va+5,545,8,394,va+9,15,va+5,395,16,396,408,18,397,408,19,398,408,20,399,va+9,27,400,va+12,29,va+11,401,31,va+11,402,32,va+11,420,8,404,va+9,15,va+5,405,16,406,408,18,407,408,19,409,408,20,va+12,va+9,20,412,410,22,411,va+9,34,va+10,va+9,22,414,413,27,417,va+12,27,416,415,34,va+10,va+12,34,va+10,417,43,va+11,418,47,va+11,419,53,va+11,420,54,va+11,421,56,va+11,va+12,2,va+1,423,3,476,424,4,va+4,425,5,436,426,8,427,va+114,16,428,431,18,429,431,19,430,431,22,va+14,431,35,432,va+42,36,va+44,433,46,va+111,434,57,435,va+113,58,va+112,va+113,6,va+6,437,7,va+6,438,8,448,439,14,499,440,26,441,500,37,442,va+85,38,va+85,443,39,444,463,40,445,va+57,41,va+57,446,42,469,447,48,va+44,498,9,449,453,10,450,453,11,451,453,12,452,453,13,545,453,14,471,454,15,458,455,20,456,459,25,457,va+42,46,va+37,va+38,20,538,459,26,460,472,37,461,va+85,38,va+85,462,39,465,463,48,va+58,464,50,va+75,va+84,40,466,va+57,41,va+57,467,42,469,468,48,va+44,522,48,va+44,470,52,va+68,va+72,26,va+87,472,28,va+86,473,34,va+99,474,35,475,543,36,va+44,va+114,4,va+2,477,5,486,478,8,479,va+114,16,480,483,18,481,483,19,482,483,22,va+14,483,35,484,va+42,36,va+43,485,46,va+107,va+108,6,va+6,487,7,va+6,488,8,501,489,14,499,490,26,491,500,37,492,va+85,38,va+85,493,39,494,516,40,495,va+57,41,va+57,496,42,536,497,48,va+43,498,49,va+45,524,26,va+87,500,28,va+86,va+114,9,502,506,10,503,506,11,504,506,12,505,506,13,545,506,14,539,507,15,511,508,20,509,512,25,510,va+42,46,va+29,va+30,20,538,512,26,513,540,37,514,va+85,38,va+85,515,39,518,516,48,va+58,517,50,va+73,va+84,40,519,va+57,41,va+57,520,42,536,521,48,va+43,522,49,va+45,523,51,527,524,60,va+55,525,62,va+55,526,63,va+55,va+46,60,530,528,62,va+55,529,63,531,va+46,62,va+55,531,64,532,va+54,66,533,va+53,69,534,va+65,70,535,va+52,72,va+59,va+51,48,va+43,537,52,va+66,va+72,25,va+24,va+42,26,va+87,540,28,va+86,541,34,va+99,542,35,544,543,36,va+42,va+114,36,va+43,va+114,17,546,va+22,20,547,va+21,33,550,548,44,va+17,549,45,va+19,va+20,44,va+15,551,45,va+15,va+20]),Ca=$n.from(Ea,2,Sa.conditions,Sa.results),Aa=new class{capacity;data=/* @__PURE__ */new Map;parameters=[];constructor({size:e,params:t}){this.capacity=e??50,t&&(this.parameters=t)}get(e,t){const r=this.hash(e);if(!1===r)return t();if(!this.data.has(r)){if(this.data.size>this.capacity+10){const e=this.data.keys();let t=0;for(;;){const{value:r,done:s}=e.next();if(this.data.delete(r),s||++t>10)break}}this.data.set(r,t())}return this.data.get(r)}size(){return this.data.size}hash(e){let t="";const{parameters:r}=this;if(0===r.length)return!1;for(const s of r){const r=String(e[s]??"");if(r.includes("|;"))return!1;t+=r+"|;"}return t}}({size:50,params:["Accelerate","Bucket","DisableAccessPoints","DisableMultiRegionAccessPoints","DisableS3ExpressSessionAuth","Endpoint","ForcePathStyle","Region","UseArnRegion","UseDualStack","UseFIPS","UseGlobalEndpoint","UseObjectLambdaEndpoint","UseS3ExpressControlEndpoint"]}),xa=(e,t={})=>Aa.get(e,()=>((e,t)=>{const{nodes:r,root:s,results:n,conditions:i}=e;let o=s;const a={},c={referenceRecord:a,endpointParams:t.endpointParams,logger:t.logger};for(;1!==o&&-1!==o&&o<ti;){const e=3*(Math.abs(o)-1),[t,s,n]=[r[e],r[e+1],r[e+2]],[u,d,l]=i[t],h=Xn({fn:u,assign:l,argv:d},c);if(h.toAssign){const{name:e,value:t}=h.toAssign;a[e]=t}o=o>=0===h.result?s:n}if(o>=ti){const e=n[o-ti];if(-1===e[0]){const[,t]=e;throw new Un(Vn(t,"Error",c))}const[t,r,s]=e;return{url:ei(t,c),properties:Jn(r,c),headers:Yn(s??{},c)}}throw new Un("No matching endpoint.")})(Ca,{endpointParams:e,logger:t.logger}));_n.aws=ni;const ka=(Ra=async(e,t,r)=>({operation:ot(t).operation,region:await at(e.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()}),async(e,t,r)=>{if(!r)throw new Error("Could not find `input` for `defaultEndpointRuleSetHttpAuthSchemeParametersProvider`");const s=await Ra(e,t,r),n=ot(t)?.commandInstance?.constructor?.getEndpointParameterInstructions;if(!n)throw new Error(`getEndpointParameterInstructions() is not defined on '${t.commandName}'`);const i=await Ri(r,{getEndpointParameterInstructions:n},e);return Object.assign(s,i)});var Ra;function Ta(e){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"s3",region:e.region},propertiesExtractor:(e,t)=>({signingProperties:{config:e,context:t}})}}function Pa(e){return{schemeId:"aws.auth#sigv4a",signingProperties:{name:"s3",region:e.region},propertiesExtractor:(e,t)=>({signingProperties:{config:e,context:t}})}}const Ia=(Ma=xa,Na=e=>{const t=[];return e.operation,t.push(Ta(e)),t.push(Pa(e)),t},Oa={"aws.auth#sigv4":Ta,"aws.auth#sigv4a":Pa},e=>{const t=Ma(e),r=t.properties?.authSchemes;if(!r)return Na(e);const s=[];for(const n of r){const{name:t,properties:i={},...o}=n,a=t.toLowerCase();let c;if(t!==a&&console.warn(`HttpAuthScheme has been normalized with lowercasing: '${t}' to '${a}'`),"sigv4a"===a){c="aws.auth#sigv4a";const e=r.find(e=>{const t=e.name.toLowerCase();return"sigv4a"!==t&&t.startsWith("sigv4")});if("none"===Xi.sigv4aDependency()&&e)continue}else{if(!a.startsWith("sigv4"))throw new Error(`Unknown HttpAuthScheme found in '@smithy.rules#endpointRuleSet': '${a}'`);c="aws.auth#sigv4"}const u=Oa[c];if(!u)throw new Error(`Could not find HttpAuthOption create function for '${c}'`);const d=u(e);d.schemeId=c,d.signingProperties={...d.signingProperties||{},...o,...i},s.push(d)}return s});var Ma,Na,Oa;const $a=e=>{const t=(e=>(e.sigv4aSigningRegionSet=Zs(e.sigv4aSigningRegionSet),e))(Gi(e));return Object.assign(t,{authSchemePreference:at(e.authSchemePreference??[])})},Ua={ForcePathStyle:{type:"clientContextParams",name:"forcePathStyle"},UseArnRegion:{type:"clientContextParams",name:"useArnRegion"},DisableMultiRegionAccessPoints:{type:"clientContextParams",name:"disableMultiregionAccessPoints"},Accelerate:{type:"clientContextParams",name:"useAccelerateEndpoint"},DisableS3ExpressSessionAuth:{type:"clientContextParams",name:"disableS3ExpressSessionAuth"},UseGlobalEndpoint:{type:"builtInParams",name:"useGlobalEndpoint"},UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}};class Da extends Kr{constructor(e){super(e),Object.setPrototypeOf(this,Da.prototype)}}class _a extends Da{name="NoSuchUpload";$fault="client";constructor(e){super({name:"NoSuchUpload",$fault:"client",...e}),Object.setPrototypeOf(this,_a.prototype)}}class La extends Da{name="AccessDenied";$fault="client";constructor(e){super({name:"AccessDenied",$fault:"client",...e}),Object.setPrototypeOf(this,La.prototype)}}class Ba extends Da{name="ObjectNotInActiveTierError";$fault="client";constructor(e){super({name:"ObjectNotInActiveTierError",$fault:"client",...e}),Object.setPrototypeOf(this,Ba.prototype)}}class za extends Da{name="BucketAlreadyExists";$fault="client";constructor(e){super({name:"BucketAlreadyExists",$fault:"client",...e}),Object.setPrototypeOf(this,za.prototype)}}class ja extends Da{name="BucketAlreadyOwnedByYou";$fault="client";constructor(e){super({name:"BucketAlreadyOwnedByYou",$fault:"client",...e}),Object.setPrototypeOf(this,ja.prototype)}}class Ha extends Da{name="NoSuchBucket";$fault="client";constructor(e){super({name:"NoSuchBucket",$fault:"client",...e}),Object.setPrototypeOf(this,Ha.prototype)}}class qa extends Da{name="InvalidObjectState";$fault="client";StorageClass;AccessTier;constructor(e){super({name:"InvalidObjectState",$fault:"client",...e}),Object.setPrototypeOf(this,qa.prototype),this.StorageClass=e.StorageClass,this.AccessTier=e.AccessTier}}class Fa extends Da{name="NoSuchKey";$fault="client";constructor(e){super({name:"NoSuchKey",$fault:"client",...e}),Object.setPrototypeOf(this,Fa.prototype)}}class Ka extends Da{name="NotFound";$fault="client";constructor(e){super({name:"NotFound",$fault:"client",...e}),Object.setPrototypeOf(this,Ka.prototype)}}class Va extends Da{name="EncryptionTypeMismatch";$fault="client";constructor(e){super({name:"EncryptionTypeMismatch",$fault:"client",...e}),Object.setPrototypeOf(this,Va.prototype)}}class Wa extends Da{name="InvalidRequest";$fault="client";constructor(e){super({name:"InvalidRequest",$fault:"client",...e}),Object.setPrototypeOf(this,Wa.prototype)}}class Ga extends Da{name="InvalidWriteOffset";$fault="client";constructor(e){super({name:"InvalidWriteOffset",$fault:"client",...e}),Object.setPrototypeOf(this,Ga.prototype)}}class Xa extends Da{name="TooManyParts";$fault="client";constructor(e){super({name:"TooManyParts",$fault:"client",...e}),Object.setPrototypeOf(this,Xa.prototype)}}class Ya extends Da{name="IdempotencyParameterMismatch";$fault="client";constructor(e){super({name:"IdempotencyParameterMismatch",$fault:"client",...e}),Object.setPrototypeOf(this,Ya.prototype)}}class Ja extends Da{name="ObjectAlreadyInActiveTierError";$fault="client";constructor(e){super({name:"ObjectAlreadyInActiveTierError",$fault:"client",...e}),Object.setPrototypeOf(this,Ja.prototype)}}const Qa="AccessKeyId",Za="Bucket",ec="BypassGovernanceRetention",tc="BucketKeyEnabled",rc="Body",sc="ChecksumAlgorithm",nc="CacheControl",ic="ChecksumCRC32",oc="ChecksumCRC32C",ac="ChecksumCRC64NVME",cc="Cache-Control",uc="Content-Disposition",dc="ContentDisposition",lc="Content-Encoding",hc="ContentEncoding",fc="ContentLanguage",pc="Content-Language",mc="Content-Length",gc="ContentLength",yc="ChecksumMD5",wc="CopyObjectResult",bc="ChecksumSHA1",Sc="ChecksumSHA256",vc="ChecksumSHA512",Ec="CopySourceSSECustomerKey",Cc="ChecksumType",Ac="Content-Type",xc="ContentType",kc="ContinuationToken",Rc="ChecksumXXHASH64",Tc="ChecksumXXHASH3",Pc="ChecksumXXHASH128",Ic="Credentials",Mc="DeleteMarker",Nc="Delete",Oc="Delimiter",$c="Expiration",Uc="ExpectedBucketOwner",Dc="ExpiresString",_c="ETag",Lc="EncodingType",Bc="Errors",zc="Error",jc="Expires",Hc="GrantFullControl",qc="GrantRead",Fc="GrantReadACP",Kc="GrantWriteACP",Vc="IfMatch",Wc="If-Match",Gc="IfNoneMatch",Xc="If-None-Match",Yc="Key",Jc="LastModified",Qc="Metadata",Zc="MaxKeys",eu="Owner",tu="ObjectLockLegalHoldStatus",ru="ObjectLockMode",su="ObjectLockRetainUntilDate",nu="Object",iu="Prefix",ou="RequestCharged",au="RequestPayer",cu="RestoreStatus",uu="Range",du="StartAfter",lu="SecretAccessKey",hu="StorageClass",fu="ServerSideEncryption",pu="SSECustomerAlgorithm",mu="SSECustomerKey",gu="SSECustomerKeyMD5",yu="SSEKMSEncryptionContext",wu="SSEKMSKeyId",bu="SessionToken",Su="Size",vu="Tagging",Eu="VersionId",Cu="WebsiteRedirectLocation",Au="client",xu="error",ku="http",Ru="httpChecksum",Tu="httpError",Pu="httpHeader",Iu="httpPayload",Mu="httpPrefixHeaders",Nu="httpQuery",Ou="smithy.ts.sdk.synthetic.com.amazonaws.s3",$u="streaming",Uu="versionId",Du="xmlFlattened",_u="xmlName",Lu="x-amz-acl",Bu="x-amz-bypass-governance-retention",zu="x-amz-checksum-crc32",ju="x-amz-checksum-crc32c",Hu="x-amz-checksum-crc64nvme",qu="x-amz-checksum-md5",Fu="x-amz-checksum-sha1",Ku="x-amz-checksum-sha256",Vu="x-amz-checksum-sha512",Wu="x-amz-checksum-type",Gu="x-amz-checksum-xxhash64",Xu="x-amz-checksum-xxhash3",Yu="x-amz-checksum-xxhash128",Ju="x-amz-delete-marker",Qu="x-amz-expiration",Zu="x-amz-expected-bucket-owner",ed="x-amz-grant-full-control",td="x-amz-grant-read",rd="x-amz-grant-read-acp",sd="x-amz-grant-write-acp",nd="x-amz-meta-",id="x-amz-mfa",od="x-amz-object-lock-legal-hold",ad="x-amz-object-lock-mode",cd="x-amz-object-lock-retain-until-date",ud="x-amz-request-charged",dd="x-amz-request-payer",ld="x-amz-storage-class",hd="x-amz-sdk-checksum-algorithm",fd="x-amz-server-side-encryption",pd="x-amz-server-side-encryption-aws-kms-key-id",md="x-amz-server-side-encryption-bucket-key-enabled",gd="x-amz-server-side-encryption-context",yd="x-amz-server-side-encryption-customer-algorithm",wd="x-amz-server-side-encryption-customer-key",bd="x-amz-server-side-encryption-customer-key-MD5",Sd="x-amz-tagging",vd="x-amz-version-id",Ed="x-amz-website-redirect-location",Cd="com.amazonaws.s3",Ad=Lt.for(Ou);var xd=[-3,Ou,"S3ServiceException",0,[],[]];Ad.registerError(xd,Da);const kd=Lt.for(Cd);var Rd=[-3,Cd,"AccessDenied",{[xu]:Au,[Tu]:403},[],[]];kd.registerError(Rd,La);var Td=[-3,Cd,"BucketAlreadyExists",{[xu]:Au,[Tu]:409},[],[]];kd.registerError(Td,za);var Pd=[-3,Cd,"BucketAlreadyOwnedByYou",{[xu]:Au,[Tu]:409},[],[]];kd.registerError(Pd,ja);var Id=[-3,Cd,"EncryptionTypeMismatch",{[xu]:Au,[Tu]:400},[],[]];kd.registerError(Id,Va);var Md=[-3,Cd,"IdempotencyParameterMismatch",{[xu]:Au,[Tu]:400},[],[]];kd.registerError(Md,Ya);var Nd=[-3,Cd,"InvalidObjectState",{[xu]:Au,[Tu]:403},[hu,"AccessTier"],[0,0]];kd.registerError(Nd,qa);var Od=[-3,Cd,"InvalidRequest",{[xu]:Au,[Tu]:400},[],[]];kd.registerError(Od,Wa);var $d=[-3,Cd,"InvalidWriteOffset",{[xu]:Au,[Tu]:400},[],[]];kd.registerError($d,Ga);var Ud=[-3,Cd,"NoSuchBucket",{[xu]:Au,[Tu]:404},[],[]];kd.registerError(Ud,Ha);var Dd=[-3,Cd,"NoSuchKey",{[xu]:Au,[Tu]:404},[],[]];kd.registerError(Dd,Fa);var _d=[-3,Cd,"NoSuchUpload",{[xu]:Au,[Tu]:404},[],[]];kd.registerError(_d,_a);var Ld=[-3,Cd,"NotFound",{[xu]:Au},[],[]];kd.registerError(Ld,Ka);var Bd=[-3,Cd,"ObjectAlreadyInActiveTierError",{[xu]:Au,[Tu]:403},[],[]];kd.registerError(Bd,Ja);var zd=[-3,Cd,"ObjectNotInActiveTierError",{[xu]:Au,[Tu]:403},[],[]];kd.registerError(zd,Ba);var jd=[-3,Cd,"TooManyParts",{[xu]:Au,[Tu]:400},[],[]];kd.registerError(jd,Xa);const Hd=[Ad,kd];var qd=[0,Cd,Ec,8,0],Fd=[0,Cd,"SessionCredentialValue",8,0],Kd=[0,Cd,mu,8,0],Vd=[0,Cd,yu,8,0],Wd=[0,Cd,wu,8,0],Gd=[0,Cd,"StreamingBlob",{[$u]:1},42],Xd=[3,Cd,"CommonPrefix",0,[iu],[0]],Yd=[3,Cd,"CopyObjectOutput",0,[wc,$c,"CopySourceVersionId",Eu,fu,pu,gu,wu,yu,tc,ou],[[()=>Qd,16],[0,{[Pu]:Qu}],[0,{[Pu]:"x-amz-copy-source-version-id"}],[0,{[Pu]:vd}],[0,{[Pu]:fd}],[0,{[Pu]:yd}],[0,{[Pu]:bd}],[()=>Wd,{[Pu]:pd}],[()=>Vd,{[Pu]:gd}],[2,{[Pu]:md}],[0,{[Pu]:ud}]]],Jd=[3,Cd,"CopyObjectRequest",0,[Za,"CopySource",Yc,"ACL",nc,sc,dc,hc,fc,xc,"CopySourceIfMatch","CopySourceIfModifiedSince","CopySourceIfNoneMatch","CopySourceIfUnmodifiedSince",jc,Hc,qc,Fc,Kc,Vc,Gc,Qc,"MetadataDirective","TaggingDirective",fu,hu,Cu,pu,mu,gu,wu,yu,tc,"CopySourceSSECustomerAlgorithm",Ec,"CopySourceSSECustomerKeyMD5",au,vu,ru,su,tu,Uc,"ExpectedSourceBucketOwner"],[[0,1],[0,{[Pu]:"x-amz-copy-source"}],[0,1],[0,{[Pu]:Lu}],[0,{[Pu]:cc}],[0,{[Pu]:"x-amz-checksum-algorithm"}],[0,{[Pu]:uc}],[0,{[Pu]:lc}],[0,{[Pu]:pc}],[0,{[Pu]:Ac}],[0,{[Pu]:"x-amz-copy-source-if-match"}],[4,{[Pu]:"x-amz-copy-source-if-modified-since"}],[0,{[Pu]:"x-amz-copy-source-if-none-match"}],[4,{[Pu]:"x-amz-copy-source-if-unmodified-since"}],[4,{[Pu]:jc}],[0,{[Pu]:ed}],[0,{[Pu]:td}],[0,{[Pu]:rd}],[0,{[Pu]:sd}],[0,{[Pu]:Wc}],[0,{[Pu]:Xc}],[128,{[Mu]:nd}],[0,{[Pu]:"x-amz-metadata-directive"}],[0,{[Pu]:"x-amz-tagging-directive"}],[0,{[Pu]:fd}],[0,{[Pu]:ld}],[0,{[Pu]:Ed}],[0,{[Pu]:yd}],[()=>Kd,{[Pu]:wd}],[0,{[Pu]:bd}],[()=>Wd,{[Pu]:pd}],[()=>Vd,{[Pu]:gd}],[2,{[Pu]:md}],[0,{[Pu]:"x-amz-copy-source-server-side-encryption-customer-algorithm"}],[()=>qd,{[Pu]:"x-amz-copy-source-server-side-encryption-customer-key"}],[0,{[Pu]:"x-amz-copy-source-server-side-encryption-customer-key-MD5"}],[0,{[Pu]:dd}],[0,{[Pu]:Sd}],[0,{[Pu]:ad}],[5,{[Pu]:cd}],[0,{[Pu]:od}],[0,{[Pu]:Zu}],[0,{[Pu]:"x-amz-source-expected-bucket-owner"}]],3],Qd=[3,Cd,wc,0,[_c,Jc,Cc,ic,oc,ac,bc,Sc,vc,yc,Rc,Tc,Pc],[0,4,0,0,0,0,0,0,0,0,0,0,0]],Zd=[3,Cd,"CreateSessionOutput",{[_u]:"CreateSessionResult"},[Ic,fu,wu,yu,tc],[[()=>wl,{[_u]:Ic}],[0,{[Pu]:fd}],[()=>Wd,{[Pu]:pd}],[()=>Vd,{[Pu]:gd}],[2,{[Pu]:md}]],1],el=[3,Cd,"CreateSessionRequest",0,[Za,"SessionMode",fu,wu,yu,tc],[[0,1],[0,{[Pu]:"x-amz-create-session-mode"}],[0,{[Pu]:fd}],[()=>Wd,{[Pu]:pd}],[()=>Vd,{[Pu]:gd}],[2,{[Pu]:md}]],1],tl=[3,Cd,Nc,0,["Objects","Quiet"],[[()=>El,{[Du]:1,[_u]:nu}],2],1],rl=[3,Cd,"DeletedObject",0,[Yc,Eu,Mc,"DeleteMarkerVersionId"],[0,0,2,0]],sl=[3,Cd,"DeleteObjectOutput",0,[Mc,Eu,ou],[[2,{[Pu]:Ju}],[0,{[Pu]:vd}],[0,{[Pu]:ud}]]],nl=[3,Cd,"DeleteObjectRequest",0,[Za,Yc,"MFA",Eu,au,ec,Uc,Vc,"IfMatchLastModifiedTime","IfMatchSize"],[[0,1],[0,1],[0,{[Pu]:id}],[0,{[Nu]:Uu}],[0,{[Pu]:dd}],[2,{[Pu]:Bu}],[0,{[Pu]:Zu}],[0,{[Pu]:Wc}],[6,{[Pu]:"x-amz-if-match-last-modified-time"}],[1,{[Pu]:"x-amz-if-match-size"}]],2],il=[3,Cd,"DeleteObjectsOutput",{[_u]:"DeleteResult"},["Deleted",ou,Bc],[[()=>Sl,{[Du]:1}],[0,{[Pu]:ud}],[()=>vl,{[Du]:1,[_u]:zc}]]],ol=[3,Cd,"DeleteObjectsRequest",0,[Za,Nc,"MFA",au,ec,Uc,sc],[[0,1],[()=>tl,{[Iu]:1,[_u]:Nc}],[0,{[Pu]:id}],[0,{[Pu]:dd}],[2,{[Pu]:Bu}],[0,{[Pu]:Zu}],[0,{[Pu]:hd}]],2],al=[3,Cd,zc,0,[Yc,Eu,"Code","Message"],[0,0,0,0]],cl=[3,Cd,"GetObjectOutput",0,[rc,Mc,"AcceptRanges",$c,"Restore",Jc,gc,_c,ic,oc,ac,bc,Sc,vc,yc,Rc,Tc,Pc,Cc,"MissingMeta",Eu,nc,dc,hc,fc,"ContentRange",xc,jc,Dc,Cu,fu,Qc,pu,gu,wu,tc,hu,ou,"ReplicationStatus","PartsCount","TagCount",ru,su,tu],[[()=>Gd,16],[2,{[Pu]:Ju}],[0,{[Pu]:"accept-ranges"}],[0,{[Pu]:Qu}],[0,{[Pu]:"x-amz-restore"}],[4,{[Pu]:"Last-Modified"}],[1,{[Pu]:mc}],[0,{[Pu]:_c}],[0,{[Pu]:zu}],[0,{[Pu]:ju}],[0,{[Pu]:Hu}],[0,{[Pu]:Fu}],[0,{[Pu]:Ku}],[0,{[Pu]:Vu}],[0,{[Pu]:qu}],[0,{[Pu]:Gu}],[0,{[Pu]:Xu}],[0,{[Pu]:Yu}],[0,{[Pu]:Wu}],[1,{[Pu]:"x-amz-missing-meta"}],[0,{[Pu]:vd}],[0,{[Pu]:cc}],[0,{[Pu]:uc}],[0,{[Pu]:lc}],[0,{[Pu]:pc}],[0,{[Pu]:"Content-Range"}],[0,{[Pu]:Ac}],[4,{[Pu]:jc}],[0,{[Pu]:Dc}],[0,{[Pu]:Ed}],[0,{[Pu]:fd}],[128,{[Mu]:nd}],[0,{[Pu]:yd}],[0,{[Pu]:bd}],[()=>Wd,{[Pu]:pd}],[2,{[Pu]:md}],[0,{[Pu]:ld}],[0,{[Pu]:ud}],[0,{[Pu]:"x-amz-replication-status"}],[1,{[Pu]:"x-amz-mp-parts-count"}],[1,{[Pu]:"x-amz-tagging-count"}],[0,{[Pu]:ad}],[5,{[Pu]:cd}],[0,{[Pu]:od}]]],ul=[3,Cd,"GetObjectRequest",0,[Za,Yc,Vc,"IfModifiedSince",Gc,"IfUnmodifiedSince",uu,"ResponseCacheControl","ResponseContentDisposition","ResponseContentEncoding","ResponseContentLanguage","ResponseContentType","ResponseExpires",Eu,pu,mu,gu,au,"PartNumber",Uc,"ChecksumMode"],[[0,1],[0,1],[0,{[Pu]:Wc}],[4,{[Pu]:"If-Modified-Since"}],[0,{[Pu]:Xc}],[4,{[Pu]:"If-Unmodified-Since"}],[0,{[Pu]:uu}],[0,{[Nu]:"response-cache-control"}],[0,{[Nu]:"response-content-disposition"}],[0,{[Nu]:"response-content-encoding"}],[0,{[Nu]:"response-content-language"}],[0,{[Nu]:"response-content-type"}],[6,{[Nu]:"response-expires"}],[0,{[Nu]:Uu}],[0,{[Pu]:yd}],[()=>Kd,{[Pu]:wd}],[0,{[Pu]:bd}],[0,{[Pu]:dd}],[1,{[Nu]:"partNumber"}],[0,{[Pu]:Zu}],[0,{[Pu]:"x-amz-checksum-mode"}]],2],dl=[3,Cd,"ListObjectsV2Output",{[_u]:"ListBucketResult"},["IsTruncated","Contents","Name",iu,Oc,Zc,"CommonPrefixes",Lc,"KeyCount",kc,"NextContinuationToken",du,ou],[2,[()=>Cl,{[Du]:1}],0,0,0,1,[()=>bl,{[Du]:1}],0,1,0,0,0,[0,{[Pu]:ud}]]],ll=[3,Cd,"ListObjectsV2Request",0,[Za,Oc,Lc,Zc,iu,kc,"FetchOwner",du,au,Uc,"OptionalObjectAttributes"],[[0,1],[0,{[Nu]:"delimiter"}],[0,{[Nu]:"encoding-type"}],[1,{[Nu]:"max-keys"}],[0,{[Nu]:"prefix"}],[0,{[Nu]:"continuation-token"}],[2,{[Nu]:"fetch-owner"}],[0,{[Nu]:"start-after"}],[0,{[Pu]:dd}],[0,{[Pu]:Zu}],[64,{[Pu]:"x-amz-optional-object-attributes"}]],1],hl=[3,Cd,nu,0,[Yc,Jc,_c,sc,Cc,Su,hu,eu,cu],[0,4,0,[64,{[Du]:1}],0,1,0,()=>pl,()=>yl]],fl=[3,Cd,"ObjectIdentifier",0,[Yc,Eu,_c,"LastModifiedTime",Su],[0,0,0,6,1],1],pl=[3,Cd,eu,0,["DisplayName","ID"],[0,0]],ml=[3,Cd,"PutObjectOutput",0,[$c,_c,ic,oc,ac,bc,Sc,vc,yc,Rc,Tc,Pc,Cc,fu,Eu,pu,gu,wu,yu,tc,Su,ou],[[0,{[Pu]:Qu}],[0,{[Pu]:_c}],[0,{[Pu]:zu}],[0,{[Pu]:ju}],[0,{[Pu]:Hu}],[0,{[Pu]:Fu}],[0,{[Pu]:Ku}],[0,{[Pu]:Vu}],[0,{[Pu]:qu}],[0,{[Pu]:Gu}],[0,{[Pu]:Xu}],[0,{[Pu]:Yu}],[0,{[Pu]:Wu}],[0,{[Pu]:fd}],[0,{[Pu]:vd}],[0,{[Pu]:yd}],[0,{[Pu]:bd}],[()=>Wd,{[Pu]:pd}],[()=>Vd,{[Pu]:gd}],[2,{[Pu]:md}],[1,{[Pu]:"x-amz-object-size"}],[0,{[Pu]:ud}]]],gl=[3,Cd,"PutObjectRequest",0,[Za,Yc,"ACL",rc,nc,dc,hc,fc,gc,"ContentMD5",xc,sc,ic,oc,ac,bc,Sc,vc,yc,Rc,Tc,Pc,jc,Vc,Gc,Hc,qc,Fc,Kc,"WriteOffsetBytes",Qc,fu,hu,Cu,pu,mu,gu,wu,yu,tc,au,vu,ru,su,tu,Uc],[[0,1],[0,1],[0,{[Pu]:Lu}],[()=>Gd,16],[0,{[Pu]:cc}],[0,{[Pu]:uc}],[0,{[Pu]:lc}],[0,{[Pu]:pc}],[1,{[Pu]:mc}],[0,{[Pu]:"Content-MD5"}],[0,{[Pu]:Ac}],[0,{[Pu]:hd}],[0,{[Pu]:zu}],[0,{[Pu]:ju}],[0,{[Pu]:Hu}],[0,{[Pu]:Fu}],[0,{[Pu]:Ku}],[0,{[Pu]:Vu}],[0,{[Pu]:qu}],[0,{[Pu]:Gu}],[0,{[Pu]:Xu}],[0,{[Pu]:Yu}],[4,{[Pu]:jc}],[0,{[Pu]:Wc}],[0,{[Pu]:Xc}],[0,{[Pu]:ed}],[0,{[Pu]:td}],[0,{[Pu]:rd}],[0,{[Pu]:sd}],[1,{[Pu]:"x-amz-write-offset-bytes"}],[128,{[Mu]:nd}],[0,{[Pu]:fd}],[0,{[Pu]:ld}],[0,{[Pu]:Ed}],[0,{[Pu]:yd}],[()=>Kd,{[Pu]:wd}],[0,{[Pu]:bd}],[()=>Wd,{[Pu]:pd}],[()=>Vd,{[Pu]:gd}],[2,{[Pu]:md}],[0,{[Pu]:dd}],[0,{[Pu]:Sd}],[0,{[Pu]:ad}],[5,{[Pu]:cd}],[0,{[Pu]:od}],[0,{[Pu]:Zu}]],2],yl=[3,Cd,cu,0,["IsRestoreInProgress","RestoreExpiryDate"],[2,4]],wl=[3,Cd,"SessionCredentials",0,[Qa,lu,bu,$c],[[0,{[_u]:Qa}],[()=>Fd,{[_u]:lu}],[()=>Fd,{[_u]:bu}],[4,{[_u]:$c}]],4],bl=[1,Cd,"CommonPrefixList",0,()=>Xd],Sl=[1,Cd,"DeletedObjects",0,()=>rl],vl=[1,Cd,Bc,0,()=>al],El=[1,Cd,"ObjectIdentifierList",0,()=>fl],Cl=[1,Cd,"ObjectList",0,[()=>hl,0]],Al=[9,Cd,"CopyObject",{[ku]:["PUT","/{Key+}?x-id=CopyObject",200]},()=>Jd,()=>Yd],xl=[9,Cd,"CreateSession",{[ku]:["GET","/?session",200]},()=>el,()=>Zd],kl=[9,Cd,"DeleteObject",{[ku]:["DELETE","/{Key+}?x-id=DeleteObject",204]},()=>nl,()=>sl],Rl=[9,Cd,"DeleteObjects",{[Ru]:"-",[ku]:["POST","/?delete",200]},()=>ol,()=>il],Tl=[9,Cd,"GetObject",{[Ru]:"-",[ku]:["GET","/{Key+}?x-id=GetObject",200]},()=>ul,()=>cl],Pl=[9,Cd,"ListObjectsV2",{[ku]:["GET","/?list-type=2",200]},()=>ll,()=>dl],Il=[9,Cd,"PutObject",{[Ru]:"-",[ku]:["PUT","/{Key+}?x-id=PutObject",200]},()=>gl,()=>ml];class Ml extends(qr.classBuilder().ep({...Ua,DisableS3ExpressSessionAuth:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function(e,t,r,s){return[Ii(r,e.getEndpointParameterInstructions()),hn(r)]}).s("AmazonS3","CreateSession",{}).n("S3Client","CreateSessionCommand").sc(xl).build()){}const Nl="3.1043.0";function Ol(e){return"string"==typeof e?0===e.length:0===e.byteLength}var $l={name:"SHA-1"},Ul={name:"HMAC",hash:$l},Dl=new Uint8Array([218,57,163,238,94,107,75,13,50,85,191,239,149,96,24,144,175,216,7,9]);const _l={};function Ll(){return"undefined"!=typeof window?window:"undefined"!=typeof self?self:_l}var Bl=function(){function e(e){this.toHash=new Uint8Array(0),void 0!==e&&(this.key=new Promise(function(t,r){Ll().crypto.subtle.importKey("raw",zl(e),Ul,!1,["sign"]).then(t,r)}),this.key.catch(function(){}))}return e.prototype.update=function(e){if(!Ol(e)){var t=zl(e),r=new Uint8Array(this.toHash.byteLength+t.byteLength);r.set(this.toHash,0),r.set(t,this.toHash.byteLength),this.toHash=r}},e.prototype.digest=function(){var e=this;return this.key?this.key.then(function(t){return Ll().crypto.subtle.sign(Ul,t,e.toHash).then(function(e){return new Uint8Array(e)})}):Ol(this.toHash)?Promise.resolve(Dl):Promise.resolve().then(function(){return Ll().crypto.subtle.digest($l,e.toHash)}).then(function(e){return Promise.resolve(new Uint8Array(e))})},e.prototype.reset=function(){this.toHash=new Uint8Array(0)},e}();function zl(e){return"string"==typeof e?(t=e,(new TextEncoder).encode(t)):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e);var t}var jl=["decrypt","digest","encrypt","exportKey","generateKey","importKey","sign","verify"];function Hl(e){return!(!function(e){if("object"==typeof e&&"object"==typeof e.crypto){return"function"==typeof e.crypto.getRandomValues}return!1}(e)||"object"!=typeof e.crypto.subtle)&&function(e){return e&&jl.every(function(t){return"function"==typeof e[t]})}(e.crypto.subtle)}var ql=function(){function e(e){if(!Hl(Ll()))throw new Error("SHA1 not supported");this.hash=new Bl(e)}return e.prototype.update=function(e,t){this.hash.update(Re(e))},e.prototype.digest=function(){return this.hash.digest()},e.prototype.reset=function(){this.hash.reset()},e}(),Fl={name:"SHA-256"},Kl={name:"HMAC",hash:Fl},Vl=new Uint8Array([227,176,196,66,152,252,28,20,154,251,244,200,153,111,185,36,39,174,65,228,100,155,147,76,164,149,153,27,120,82,184,85]),Wl=function(){function e(e){this.toHash=new Uint8Array(0),this.secret=e,this.reset()}return e.prototype.update=function(e){if(!Te(e)){var t=Re(e),r=new Uint8Array(this.toHash.byteLength+t.byteLength);r.set(this.toHash,0),r.set(t,this.toHash.byteLength),this.toHash=r}},e.prototype.digest=function(){var e=this;return this.key?this.key.then(function(t){return Ll().crypto.subtle.sign(Kl,t,e.toHash).then(function(e){return new Uint8Array(e)})}):Te(this.toHash)?Promise.resolve(Vl):Promise.resolve().then(function(){return Ll().crypto.subtle.digest(Fl,e.toHash)}).then(function(e){return Promise.resolve(new Uint8Array(e))})},e.prototype.reset=function(){var e=this;this.toHash=new Uint8Array(0),this.secret&&void 0!==this.secret&&(this.key=new Promise(function(t,r){Ll().crypto.subtle.importKey("raw",Re(e.secret),Kl,!1,["sign"]).then(t,r)}),this.key.catch(function(){}))},e}(),Gl=64,Xl=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Yl=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],Jl=Math.pow(2,53)-1,Ql=function(){function e(){this.state=Int32Array.from(Yl),this.temp=new Int32Array(64),this.buffer=new Uint8Array(64),this.bufferLength=0,this.bytesHashed=0,this.finished=!1}return e.prototype.update=function(e){if(this.finished)throw new Error("Attempted to update an already finished hash.");var t=0,r=e.byteLength;if(this.bytesHashed+=r,8*this.bytesHashed>Jl)throw new Error("Cannot hash more than 2^53 - 1 bits");for(;r>0;)this.buffer[this.bufferLength++]=e[t++],r--,this.bufferLength===Gl&&(this.hashBuffer(),this.bufferLength=0)},e.prototype.digest=function(){if(!this.finished){var e=8*this.bytesHashed,t=new DataView(this.buffer.buffer,this.buffer.byteOffset,this.buffer.byteLength),r=this.bufferLength;if(t.setUint8(this.bufferLength++,128),r%Gl>=56){for(var s=this.bufferLength;s<Gl;s++)t.setUint8(s,0);this.hashBuffer(),this.bufferLength=0}for(s=this.bufferLength;s<56;s++)t.setUint8(s,0);t.setUint32(56,Math.floor(e/4294967296),!0),t.setUint32(60,e),this.hashBuffer(),this.finished=!0}var n=new Uint8Array(32);for(s=0;s<8;s++)n[4*s]=this.state[s]>>>24&255,n[4*s+1]=this.state[s]>>>16&255,n[4*s+2]=this.state[s]>>>8&255,n[4*s+3]=this.state[s]>>>0&255;return n},e.prototype.hashBuffer=function(){for(var e=this.buffer,t=this.state,r=t[0],s=t[1],n=t[2],i=t[3],o=t[4],a=t[5],c=t[6],u=t[7],d=0;d<Gl;d++){if(d<16)this.temp[d]=(255&e[4*d])<<24|(255&e[4*d+1])<<16|(255&e[4*d+2])<<8|255&e[4*d+3];else{var l=this.temp[d-2],h=(l>>>17|l<<15)^(l>>>19|l<<13)^l>>>10,f=((l=this.temp[d-15])>>>7|l<<25)^(l>>>18|l<<14)^l>>>3;this.temp[d]=(h+this.temp[d-7]|0)+(f+this.temp[d-16]|0)}var p=(((o>>>6|o<<26)^(o>>>11|o<<21)^(o>>>25|o<<7))+(o&a^~o&c)|0)+(u+(Xl[d]+this.temp[d]|0)|0)|0,m=((r>>>2|r<<30)^(r>>>13|r<<19)^(r>>>22|r<<10))+(r&s^r&n^s&n)|0;u=c,c=a,a=o,o=i+p|0,i=n,n=s,s=r,r=p+m|0}t[0]+=r,t[1]+=s,t[2]+=n,t[3]+=i,t[4]+=o,t[5]+=a,t[6]+=c,t[7]+=u},e}(),Zl=function(){function e(e){this.secret=e,this.hash=new Ql,this.reset()}return e.prototype.update=function(e){if(!Te(e)&&!this.error)try{this.hash.update(Re(e))}catch(t){this.error=t}},e.prototype.digestSync=function(){if(this.error)throw this.error;return this.outer?(this.outer.finished||this.outer.update(this.hash.digest()),this.outer.digest()):this.hash.digest()},e.prototype.digest=function(){return Ce(this,void 0,void 0,function(){return Ae(this,function(e){return[2,this.digestSync()]})})},e.prototype.reset=function(){if(this.hash=new Ql,this.secret){this.outer=new Ql;var e=function(e){var t=Re(e);if(t.byteLength>Gl){var r=new Ql;r.update(t),t=r.digest()}var s=new Uint8Array(Gl);return s.set(t),s}(this.secret),t=new Uint8Array(Gl);t.set(e);for(var r=0;r<Gl;r++)e[r]^=54,t[r]^=92;this.hash.update(e),this.outer.update(t);for(r=0;r<e.byteLength;r++)e[r]=0}},e}();var eh=function(){function e(e){Hl(Ll())?this.hash=new Wl(e):this.hash=new Zl(e)}return e.prototype.update=function(e,t){this.hash.update(Re(e))},e.prototype.digest=function(){return this.hash.digest()},e.prototype.reset=function(){this.hash.reset()},e}();const th=({serviceId:e,clientVersion:t})=>async r=>{const s="undefined"!=typeof window?window.navigator:void 0,n=s?.userAgent??"",i=s?.userAgentData?.platform??rh.os(n)??"other",o=s?.userAgentData?.brands??[],a=o[o.length-1],c=a?.brand??rh.browser(n)??"unknown",u=[["aws-sdk-js",t],["ua","2.1"],[`os/${i}`,void 0],["lang/js"],["md/browser",`${c}_${a?.version??"unknown"}`]];e&&u.push([`api/${e}`,t]);const d=await(r?.userAgentAppId?.());return d&&u.push([`app/${d}`]),u},rh={os:e=>/iPhone|iPad|iPod/.test(e)?"iOS":/Macintosh|Mac OS X/.test(e)?"macOS":/Windows NT/.test(e)?"Windows":/Android/.test(e)?"Android":/Linux/.test(e)?"Linux":void 0,browser:e=>/EdgiOS|EdgA|Edg\//.test(e)?"Microsoft Edge":/Firefox\//.test(e)?"Firefox":/Chrome\//.test(e)?"Chrome":/Safari\//.test(e)?"Safari":void 0};class sh{bytes;constructor(e){if(this.bytes=e,8!==e.byteLength)throw new Error("Int64 buffers must be exactly 8 bytes")}static fromNumber(e){if(e>0x8000000000000000||e<-0x8000000000000000)throw new Error(`${e} is too large (or, if negative, too small) to represent as an Int64`);const t=new Uint8Array(8);for(let r=7,s=Math.abs(Math.round(e));r>-1&&s>0;r--,s/=256)t[r]=s;return e<0&&nh(t),new sh(t)}valueOf(){const e=this.bytes.slice(0),t=128&e[0];return t&&nh(e),parseInt(ge(e),16)*(t?-1:1)}toString(){return String(this.valueOf())}}function nh(e){for(let t=0;t<8;t++)e[t]^=255;for(let t=7;t>-1&&(e[t]++,0===e[t]);t--);}class ih{toUtf8;fromUtf8;constructor(e,t){this.toUtf8=e,this.fromUtf8=t}format(e){const t=[];for(const n of Object.keys(e)){const r=this.fromUtf8(n);t.push(Uint8Array.from([r.byteLength]),r,this.formatHeaderValue(e[n]))}const r=new Uint8Array(t.reduce((e,t)=>e+t.byteLength,0));let s=0;for(const n of t)r.set(n,s),s+=n.byteLength;return r}formatHeaderValue(e){switch(e.type){case"boolean":return Uint8Array.from([e.value?0:1]);case"byte":return Uint8Array.from([2,e.value]);case"short":const t=new DataView(new ArrayBuffer(3));return t.setUint8(0,3),t.setInt16(1,e.value,!1),new Uint8Array(t.buffer);case"integer":const r=new DataView(new ArrayBuffer(5));return r.setUint8(0,4),r.setInt32(1,e.value,!1),new Uint8Array(r.buffer);case"long":const s=new Uint8Array(9);return s[0]=5,s.set(e.value.bytes,1),s;case"binary":const n=new DataView(new ArrayBuffer(3+e.value.byteLength));n.setUint8(0,6),n.setUint16(1,e.value.byteLength,!1);const i=new Uint8Array(n.buffer);return i.set(e.value,3),i;case"string":const o=this.fromUtf8(e.value),a=new DataView(new ArrayBuffer(3+o.byteLength));a.setUint8(0,7),a.setUint16(1,o.byteLength,!1);const c=new Uint8Array(a.buffer);return c.set(o,3),c;case"timestamp":const u=new Uint8Array(9);return u[0]=8,u.set(sh.fromNumber(e.value.valueOf()).bytes,1),u;case"uuid":if(!gh.test(e.value))throw new Error(`Invalid UUID received: ${e.value}`);const d=new Uint8Array(17);return d[0]=9,d.set(me(e.value.replace(/\-/g,"")),1),d}}parse(e){const t={};let r=0;for(;r<e.byteLength;){const s=e.getUint8(r++),n=this.toUtf8(new Uint8Array(e.buffer,e.byteOffset+r,s));switch(r+=s,e.getUint8(r++)){case 0:t[n]={type:ah,value:!0};break;case 1:t[n]={type:ah,value:!1};break;case 2:t[n]={type:ch,value:e.getInt8(r++)};break;case 3:t[n]={type:uh,value:e.getInt16(r,!1)},r+=2;break;case 4:t[n]={type:dh,value:e.getInt32(r,!1)},r+=4;break;case 5:t[n]={type:lh,value:new sh(new Uint8Array(e.buffer,e.byteOffset+r,8))},r+=8;break;case 6:const s=e.getUint16(r,!1);r+=2,t[n]={type:hh,value:new Uint8Array(e.buffer,e.byteOffset+r,s)},r+=s;break;case 7:const i=e.getUint16(r,!1);r+=2,t[n]={type:fh,value:this.toUtf8(new Uint8Array(e.buffer,e.byteOffset+r,i))},r+=i;break;case 8:t[n]={type:ph,value:new Date(new sh(new Uint8Array(e.buffer,e.byteOffset+r,8)).valueOf())},r+=8;break;case 9:const o=new Uint8Array(e.buffer,e.byteOffset+r,16);r+=16,t[n]={type:mh,value:`${ge(o.subarray(0,4))}-${ge(o.subarray(4,6))}-${ge(o.subarray(6,8))}-${ge(o.subarray(8,10))}-${ge(o.subarray(10))}`};break;default:throw new Error("Unrecognized header type tag")}}return t}}var oh;!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"}(oh||(oh={}));const ah="boolean",ch="byte",uh="short",dh="integer",lh="long",hh="binary",fh="string",ph="timestamp",mh="uuid",gh=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;class yh{headerMarshaller;messageBuffer;isEndOfStream;constructor(e,t){this.headerMarshaller=new ih(e,t),this.messageBuffer=[],this.isEndOfStream=!1}feed(e){this.messageBuffer.push(this.decode(e))}endOfStream(){this.isEndOfStream=!0}getMessage(){const e=this.messageBuffer.pop(),t=this.isEndOfStream;return{getMessage:()=>e,isEndOfStream:()=>t}}getAvailableMessages(){const e=this.messageBuffer;this.messageBuffer=[];const t=this.isEndOfStream;return{getMessages:()=>e,isEndOfStream:()=>t}}encode({headers:e,body:t}){const r=this.headerMarshaller.format(e),s=r.byteLength+t.byteLength+16,n=new Uint8Array(s),i=new DataView(n.buffer,n.byteOffset,n.byteLength),o=new Ve;return i.setUint32(0,s,!1),i.setUint32(4,r.byteLength,!1),i.setUint32(8,o.update(n.subarray(0,8)).digest(),!1),n.set(r,12),n.set(t,r.byteLength+12),i.setUint32(s-4,o.update(n.subarray(8,s-4)).digest(),!1),n}decode(e){const{headers:t,body:r}=function({byteLength:e,byteOffset:t,buffer:r}){if(e<16)throw new Error("Provided message too short to accommodate event stream message overhead");const s=new DataView(r,t,e),n=s.getUint32(0,!1);if(e!==n)throw new Error("Reported message length does not match received message length");const i=s.getUint32(4,!1),o=s.getUint32(8,!1),a=s.getUint32(e-4,!1),c=(new Ve).update(new Uint8Array(r,t,8));if(o!==c.digest())throw new Error(`The prelude checksum specified in the message (${o}) does not match the calculated CRC32 checksum (${c.digest()})`);if(c.update(new Uint8Array(r,t+8,e-12)),a!==c.digest())throw new Error(`The message checksum (${c.digest()}) did not match the expected value of ${a}`);return{headers:new DataView(r,t+8+4,i),body:new Uint8Array(r,t+8+4+i,n-i-16)}}(e);return{headers:this.headerMarshaller.parse(t),body:r}}formatHeaders(e){return this.headerMarshaller.format(e)}}class wh{options;constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(const e of this.options.inputStream){const t=this.options.decoder.decode(e);yield t}}}class bh{options;constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(const e of this.options.messageStream){const t=this.options.encoder.encode(e);yield t}this.options.includeEndFrame&&(yield new Uint8Array(0))}}class Sh{options;constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(const e of this.options.messageStream){const t=await this.options.deserializer(e);void 0!==t&&(yield t)}}}class vh{options;constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(const e of this.options.inputStream){const t=this.options.serializer(e);yield t}}}function Eh(e,t){return async function(r){const{value:s}=r.headers[":message-type"];if("error"===s){const e=new Error(r.headers[":error-message"].value||"UnknownError");throw e.name=r.headers[":error-code"].value,e}if("exception"===s){const s=r.headers[":exception-type"].value,n={[s]:r},i=await e(n);if(i.$unknown){const e=new Error(t(r.body));throw e.name=s,e}throw i[s]}if("event"===s){const t={[r.headers[":event-type"].value]:r},s=await e(t);if(s.$unknown)return;return s}throw Error(`Unrecognizable event type: ${r.headers[":event-type"].value}`)}}let Ch=class{eventStreamCodec;utfEncoder;constructor({utf8Encoder:e,utf8Decoder:t}){this.eventStreamCodec=new yh(e,t),this.utfEncoder=e}deserialize(e,t){const r=function(e){let t=0,r=0,s=null,n=null;const i=e=>{if("number"!=typeof e)throw new Error("Attempted to allocate an event message where size was not a number: "+e);t=e,r=4,s=new Uint8Array(e),new DataView(s.buffer).setUint32(0,e,!1)};return{[Symbol.asyncIterator]:async function*(){const o=e[Symbol.asyncIterator]();for(;;){const{value:e,done:a}=await o.next();if(a){if(!t)return;if(t!==r)throw new Error("Truncated event message received.");return void(yield s)}const c=e.length;let u=0;for(;u<c;){if(!s){const t=c-u;n||(n=new Uint8Array(4));const s=Math.min(4-r,t);if(n.set(e.slice(u,u+s),r),r+=s,u+=s,r<4)break;i(new DataView(n.buffer).getUint32(0,!1)),n=null}const o=Math.min(t-r,c-u);s.set(e.slice(u,u+o),r),r+=o,u+=o,t&&t===r&&(yield s,s=null,t=0,r=0)}}}}}(e);return new Sh({messageStream:new wh({inputStream:r,decoder:this.eventStreamCodec}),deserializer:Eh(t,this.utfEncoder)})}serialize(e,t){return new bh({messageStream:new vh({inputStream:e,serializer:t}),encoder:this.eventStreamCodec,includeEndFrame:!0})}};class Ah{universalMarshaller;constructor({utf8Encoder:e,utf8Decoder:t}){this.universalMarshaller=new Ch({utf8Decoder:t,utf8Encoder:e})}deserialize(e,t){const r=xh(e)?(s=e,{[Symbol.asyncIterator]:async function*(){const e=s.getReader();try{for(;;){const{done:t,value:r}=await e.read();if(t)return;yield r}}finally{e.releaseLock()}}}):e;var s;return this.universalMarshaller.deserialize(r,t)}serialize(e,t){const r=this.universalMarshaller.serialize(e,t);return"function"==typeof ReadableStream?(e=>{const t=e[Symbol.asyncIterator]();return new ReadableStream({async pull(e){const{done:r,value:s}=await t.next();if(r)return e.close();e.enqueue(s)}})})(r):r}}const xh=e=>"function"==typeof ReadableStream&&e instanceof ReadableStream,kh=e=>new Ah(e);const Rh=async function(e,t){const r=new e;return await async function(e,t,r=1048576){const s=e.size;let n=0;for(;n<s;){const i=e.slice(n,Math.min(s,n+r));t(new Uint8Array(await i.arrayBuffer())),n+=i.size}}(t,e=>{r.update(e)}),r.digest()},Th=64,Ph=[1732584193,4023233417,2562383102,271733878];class Ih{state;buffer;bufferLength;bytesHashed;finished;constructor(){this.reset()}update(e){if(function(e){if("string"==typeof e)return 0===e.length;return 0===e.byteLength}(e))return;if(this.finished)throw new Error("Attempted to update an already finished hash.");const t=function(e){if("string"==typeof e)return K(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT);return new Uint8Array(e)}(e);let r=0,{byteLength:s}=t;for(this.bytesHashed+=s;s>0;)this.buffer.setUint8(this.bufferLength++,t[r++]),s--,this.bufferLength===Th&&(this.hashBuffer(),this.bufferLength=0)}async digest(){if(!this.finished){const{buffer:e,bufferLength:t,bytesHashed:r}=this,s=8*r;if(e.setUint8(this.bufferLength++,128),t%Th>=56){for(let t=this.bufferLength;t<Th;t++)e.setUint8(t,0);this.hashBuffer(),this.bufferLength=0}for(let n=this.bufferLength;n<56;n++)e.setUint8(n,0);e.setUint32(56,s>>>0,!0),e.setUint32(60,Math.floor(s/4294967296),!0),this.hashBuffer(),this.finished=!0}const e=new DataView(new ArrayBuffer(16));for(let t=0;t<4;t++)e.setUint32(4*t,this.state[t],!0);return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}hashBuffer(){const{buffer:e,state:t}=this;let r=t[0],s=t[1],n=t[2],i=t[3];r=Nh(r,s,n,i,e.getUint32(0,!0),7,3614090360),i=Nh(i,r,s,n,e.getUint32(4,!0),12,3905402710),n=Nh(n,i,r,s,e.getUint32(8,!0),17,606105819),s=Nh(s,n,i,r,e.getUint32(12,!0),22,3250441966),r=Nh(r,s,n,i,e.getUint32(16,!0),7,4118548399),i=Nh(i,r,s,n,e.getUint32(20,!0),12,1200080426),n=Nh(n,i,r,s,e.getUint32(24,!0),17,2821735955),s=Nh(s,n,i,r,e.getUint32(28,!0),22,4249261313),r=Nh(r,s,n,i,e.getUint32(32,!0),7,1770035416),i=Nh(i,r,s,n,e.getUint32(36,!0),12,2336552879),n=Nh(n,i,r,s,e.getUint32(40,!0),17,4294925233),s=Nh(s,n,i,r,e.getUint32(44,!0),22,2304563134),r=Nh(r,s,n,i,e.getUint32(48,!0),7,1804603682),i=Nh(i,r,s,n,e.getUint32(52,!0),12,4254626195),n=Nh(n,i,r,s,e.getUint32(56,!0),17,2792965006),s=Nh(s,n,i,r,e.getUint32(60,!0),22,1236535329),r=Oh(r,s,n,i,e.getUint32(4,!0),5,4129170786),i=Oh(i,r,s,n,e.getUint32(24,!0),9,3225465664),n=Oh(n,i,r,s,e.getUint32(44,!0),14,643717713),s=Oh(s,n,i,r,e.getUint32(0,!0),20,3921069994),r=Oh(r,s,n,i,e.getUint32(20,!0),5,3593408605),i=Oh(i,r,s,n,e.getUint32(40,!0),9,38016083),n=Oh(n,i,r,s,e.getUint32(60,!0),14,3634488961),s=Oh(s,n,i,r,e.getUint32(16,!0),20,3889429448),r=Oh(r,s,n,i,e.getUint32(36,!0),5,568446438),i=Oh(i,r,s,n,e.getUint32(56,!0),9,3275163606),n=Oh(n,i,r,s,e.getUint32(12,!0),14,4107603335),s=Oh(s,n,i,r,e.getUint32(32,!0),20,1163531501),r=Oh(r,s,n,i,e.getUint32(52,!0),5,2850285829),i=Oh(i,r,s,n,e.getUint32(8,!0),9,4243563512),n=Oh(n,i,r,s,e.getUint32(28,!0),14,1735328473),s=Oh(s,n,i,r,e.getUint32(48,!0),20,2368359562),r=$h(r,s,n,i,e.getUint32(20,!0),4,4294588738),i=$h(i,r,s,n,e.getUint32(32,!0),11,2272392833),n=$h(n,i,r,s,e.getUint32(44,!0),16,1839030562),s=$h(s,n,i,r,e.getUint32(56,!0),23,4259657740),r=$h(r,s,n,i,e.getUint32(4,!0),4,2763975236),i=$h(i,r,s,n,e.getUint32(16,!0),11,1272893353),n=$h(n,i,r,s,e.getUint32(28,!0),16,4139469664),s=$h(s,n,i,r,e.getUint32(40,!0),23,3200236656),r=$h(r,s,n,i,e.getUint32(52,!0),4,681279174),i=$h(i,r,s,n,e.getUint32(0,!0),11,3936430074),n=$h(n,i,r,s,e.getUint32(12,!0),16,3572445317),s=$h(s,n,i,r,e.getUint32(24,!0),23,76029189),r=$h(r,s,n,i,e.getUint32(36,!0),4,3654602809),i=$h(i,r,s,n,e.getUint32(48,!0),11,3873151461),n=$h(n,i,r,s,e.getUint32(60,!0),16,530742520),s=$h(s,n,i,r,e.getUint32(8,!0),23,3299628645),r=Uh(r,s,n,i,e.getUint32(0,!0),6,4096336452),i=Uh(i,r,s,n,e.getUint32(28,!0),10,1126891415),n=Uh(n,i,r,s,e.getUint32(56,!0),15,2878612391),s=Uh(s,n,i,r,e.getUint32(20,!0),21,4237533241),r=Uh(r,s,n,i,e.getUint32(48,!0),6,1700485571),i=Uh(i,r,s,n,e.getUint32(12,!0),10,2399980690),n=Uh(n,i,r,s,e.getUint32(40,!0),15,4293915773),s=Uh(s,n,i,r,e.getUint32(4,!0),21,2240044497),r=Uh(r,s,n,i,e.getUint32(32,!0),6,1873313359),i=Uh(i,r,s,n,e.getUint32(60,!0),10,4264355552),n=Uh(n,i,r,s,e.getUint32(24,!0),15,2734768916),s=Uh(s,n,i,r,e.getUint32(52,!0),21,1309151649),r=Uh(r,s,n,i,e.getUint32(16,!0),6,4149444226),i=Uh(i,r,s,n,e.getUint32(44,!0),10,3174756917),n=Uh(n,i,r,s,e.getUint32(8,!0),15,718787259),s=Uh(s,n,i,r,e.getUint32(36,!0),21,3951481745),t[0]=r+t[0]&4294967295,t[1]=s+t[1]&4294967295,t[2]=n+t[2]&4294967295,t[3]=i+t[3]&4294967295}reset(){this.state=Uint32Array.from(Ph),this.buffer=new DataView(new ArrayBuffer(Th)),this.bufferLength=0,this.bytesHashed=0,this.finished=!1}}function Mh(e,t,r,s,n,i){return((t=(t+e&4294967295)+(s+i&4294967295)&4294967295)<<n|t>>>32-n)+r&4294967295}function Nh(e,t,r,s,n,i,o){return Mh(t&r|~t&s,e,t,n,i,o)}function Oh(e,t,r,s,n,i,o){return Mh(t&s|r&~s,e,t,n,i,o)}function $h(e,t,r,s,n,i,o){return Mh(t^r^s,e,t,n,i,o)}function Uh(e,t,r,s,n,i,o){return Mh(r^(t|~s),e,t,n,i,o)}const Dh=["in-region","cross-region","mobile","standard","legacy"],_h=()=>{const e=window?.navigator;if(e?.connection){const{effectiveType:t,rtt:r,downlink:s}=e?.connection;if("string"==typeof t&&"4g"!==t||Number(r)>100||Number(s)<10)return!0}return e?.userAgentData?.mobile||"number"==typeof e?.maxTouchPoints&&e?.maxTouchPoints>1},Lh=e=>{const t=(({defaultsMode:e}={})=>Wi(async()=>{const t="function"==typeof e?await e():e;switch(t?.toLowerCase()){case"auto":return Promise.resolve(_h()?"mobile":"standard");case"mobile":case"in-region":case"cross-region":case"standard":case"legacy":return Promise.resolve(t?.toLocaleLowerCase());case void 0:return Promise.resolve("legacy");default:throw new Error(`Invalid parameter for "defaultsMode", expect ${Dh.join(", ")}, got ${t}`)}}))(e),r=()=>t().then(Wr),s=(e=>({apiVersion:"2006-03-01",base64Decoder:e?.base64Decoder??F,base64Encoder:e?.base64Encoder??G,disableHostPrefix:e?.disableHostPrefix??!1,endpointProvider:e?.endpointProvider??xa,extensions:e?.extensions??[],getAwsChunkedEncodingStream:e?.getAwsChunkedEncodingStream??ne,httpAuthSchemeProvider:e?.httpAuthSchemeProvider??Ia,httpAuthSchemes:e?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4"),signer:new Ki},{schemeId:"aws.auth#sigv4a",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4a"),signer:new Vi}],logger:e?.logger??new Qr,protocol:e?.protocol??On,protocolSettings:e?.protocolSettings??{defaultNamespace:"com.amazonaws.s3",errorTypeRegistries:Hd,xmlNamespace:"http://s3.amazonaws.com/doc/2006-03-01/",version:"2006-03-01",serviceTarget:"AmazonS3"},sdkStreamMixin:e?.sdkStreamMixin??we,serviceId:e?.serviceId??"S3",signerConstructor:e?.signerConstructor??Xi,signingEscapePath:e?.signingEscapePath??!1,urlParser:e?.urlParser??Ct,useArnRegion:e?.useArnRegion??void 0,utf8Decoder:e?.utf8Decoder??K,utf8Encoder:e?.utf8Encoder??W}))(e);return{...s,...e,runtime:"browser",defaultsMode:t,bodyLengthChecker:e?.bodyLengthChecker??yn,credentialDefaultProvider:e?.credentialDefaultProvider??(e=>()=>Promise.reject(new Error("Credential is missing"))),defaultUserAgentProvider:e?.defaultUserAgentProvider??th({serviceId:s.serviceId,clientVersion:Nl}),eventStreamSerdeProvider:e?.eventStreamSerdeProvider??kh,maxAttempts:e?.maxAttempts??3,md5:e?.md5??Ih,region:e?.region??(n="Region is missing",()=>Promise.reject(n)),requestHandler:de.create(e?.requestHandler??r),retryMode:e?.retryMode??(async()=>(await r()).retryMode||C),sha1:e?.sha1??ql,sha256:e?.sha256??eh,streamCollector:e?.streamCollector??he,streamHasher:e?.streamHasher??Rh,useDualstackEndpoint:e?.useDualstackEndpoint??(()=>Promise.resolve(false)),useFipsEndpoint:e?.useFipsEndpoint??(()=>Promise.resolve(false))};var n};class Bh extends yt{config;constructor(...[e]){const t=Lh(e||{});super(t),this.initConfig=t;var r;const s=function(e){const t=Zs(e.userAgentAppId??void 0),{customUserAgent:r}=e;return Object.assign(e,{customUserAgent:"string"==typeof r?[[r]]:r,userAgentAppId:async()=>{const r=await t();if(!function(e){return void 0===e||"string"==typeof e&&e.length<=50}(r)){const t="NoOpLogger"!==e.logger?.constructor?.name&&e.logger?e.logger:console;"string"!=typeof r?t?.warn("userAgentAppId must be a string or undefined."):r.length>50&&t?.warn("The provided userAgentAppId exceeds the maximum length of 50 characters.")}return r}})}((r=t,Object.assign(r,{useFipsEndpoint:r.useFipsEndpoint??!1,useDualstackEndpoint:r.useDualstackEndpoint??!1,forcePathStyle:r.forcePathStyle??!1,useAccelerateEndpoint:r.useAccelerateEndpoint??!1,useGlobalEndpoint:r.useGlobalEndpoint??!1,disableMultiregionAccessPoints:r.disableMultiregionAccessPoints??!1,defaultSigningName:"s3",clientContextParams:r.clientContextParams??{}}))),n=(e=>{const{requestChecksumCalculation:t,responseChecksumValidation:r,requestStreamBufferSize:s}=e;return Object.assign(e,{requestChecksumCalculation:at(t??h),responseChecksumValidation:at(r??m),requestStreamBufferSize:Number(s??0),checksumAlgorithms:e.checksumAlgorithms??{}})})(s),i=Ni(n),o=(e=>{const t=e.tls??!0,{endpoint:r,useDualstackEndpoint:s,useFipsEndpoint:n}=e,i=null!=r?async()=>ki(await at(r)()):void 0,o=!!r,a=Object.assign(e,{endpoint:i,tls:t,isCustomEndpoint:o,useDualstackEndpoint:at(s??!1),useFipsEndpoint:at(n??!1)});let c;return a.serviceConfiguredEndpoint=async()=>(e.serviceId&&!c&&(c=xi(e.serviceId)),c),a})(mi(i)),a=(c=o,Object.assign(c,{eventStreamMarshaller:c.eventStreamSerdeProvider(c)}));var c;const d=((e,{session:t})=>{const[r,s]=t,{forcePathStyle:n,useAccelerateEndpoint:i,disableMultiregionAccessPoints:o,followRegionRedirects:a,s3ExpressIdentityProvider:c,bucketEndpoint:u,expectContinueHeader:d}=e;return Object.assign(e,{forcePathStyle:n??!1,useAccelerateEndpoint:i??!1,disableMultiregionAccessPoints:o??!1,followRegionRedirects:a??!1,s3ExpressIdentityProvider:c??new cs(async e=>r().send(new s({Bucket:e}))),bucketEndpoint:u??!1,expectContinueHeader:d??2097152})})($a(a),{session:[()=>this,Ml]}),l=((e,t)=>{const r=Object.assign((e=>({setRegion(t){e.region=t},region:()=>e.region}))(e),Xr(e),(e=>({setHttpHandler(t){e.httpHandler=t},httpHandler:()=>e.httpHandler,updateHttpClientConfig(t,r){e.httpHandler?.updateHttpClientConfig(t,r)},httpHandlerConfigs:()=>e.httpHandler.httpHandlerConfigs()}))(e),(e=>{const t=e.httpAuthSchemes;let r=e.httpAuthSchemeProvider,s=e.credentials;return{setHttpAuthScheme(e){const r=t.findIndex(t=>t.schemeId===e.schemeId);-1===r?t.push(e):t.splice(r,1,e)},httpAuthSchemes:()=>t,setHttpAuthSchemeProvider(e){r=e},httpAuthSchemeProvider:()=>r,setCredentials(e){s=e},credentials:()=>s}})(e));return t.forEach(e=>e.configure(r)),Object.assign(e,{region:r.region()},Yr(r),{httpHandler:r.httpHandler()},{httpAuthSchemes:(s=r).httpAuthSchemes(),httpAuthSchemeProvider:s.httpAuthSchemeProvider(),credentials:s.credentials()});var s})(d,e?.extensions||[]);var f;this.config=l,this.middlewareStack.use(Rt(this.config)),this.middlewareStack.use((f=this.config,{applyToStack:e=>{e.add(di(f),hi)}})),this.middlewareStack.use(Bi(this.config)),this.middlewareStack.use(wi(this.config)),this.middlewareStack.use(ut(this.config)),this.middlewareStack.use((this.config,{applyToStack:e=>{e.add((e,t)=>async r=>{try{const s=await e(r),{clientName:n,commandName:i,logger:o,dynamoDbDocumentClientOptions:a={}}=t,{overrideInputFilterSensitiveLog:c,overrideOutputFilterSensitiveLog:u}=a,d=c??t.inputFilterSensitiveLog,l=u??t.outputFilterSensitiveLog,{$metadata:h,...f}=s.output;return o?.info?.({clientName:n,commandName:i,input:d(r.input),output:l(f),metadata:h}),s}catch(s){const{clientName:e,commandName:n,logger:i,dynamoDbDocumentClientOptions:o={}}=t,{overrideInputFilterSensitiveLog:a}=o,c=a??t.inputFilterSensitiveLog;throw i?.error?.({clientName:e,commandName:n,input:c(r.input),error:s,metadata:s.$metadata}),s}},dt)}})),this.middlewareStack.use((this.config,{applyToStack:e=>{e.add(e=>async t=>e(t),lt)}})),this.middlewareStack.use(((e,{httpAuthSchemeParametersProvider:t,identityProviderConfigProvider:r})=>({applyToStack:s=>{s.addRelativeTo(Ws(e,{httpAuthSchemeParametersProvider:t,identityProviderConfigProvider:r}),Gs)}}))(this.config,{httpAuthSchemeParametersProvider:ka,identityProviderConfigProvider:async e=>new en({"aws.auth#sigv4":e.credentials,"aws.auth#sigv4a":e.credentials})})),this.middlewareStack.use(Qs(this.config)),this.middlewareStack.use(mn(this.config)),this.middlewareStack.use(u(this.config)),this.middlewareStack.use(ss(this.config)),this.middlewareStack.use(Vs(this.config)),this.middlewareStack.use((e=>({applyToStack:t=>{t.addRelativeTo(an(e),Js)}}))(this.config))}destroy(){super.destroy()}}const zh={name:"ssecMiddleware",step:"initialize",tags:["SSE"],override:!0},jh=e=>({applyToStack:t=>{var r;t.add((r=e,e=>async t=>{const s={...t.input},n=[{target:"SSECustomerKey",hash:"SSECustomerKeyMD5"},{target:"CopySourceSSECustomerKey",hash:"CopySourceSSECustomerKeyMD5"}];for(const e of n){const t=s[e.target];if(t){let n;"string"==typeof t?Hh(t,r)?n=r.base64Decoder(t):(n=r.utf8Decoder(t),s[e.target]=r.base64Encoder(n)):(n=ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):new Uint8Array(t),s[e.target]=r.base64Encoder(n));const i=new r.md5;i.update(n),s[e.hash]=r.base64Encoder(await i.digest())}}return e({...t,input:s})}),zh)}});function Hh(e,t){if(!/^(?:[A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e))return!1;try{return 32===t.base64Decoder(e).length}catch{return!1}}class qh extends(qr.classBuilder().ep({...Ua,DisableS3ExpressSessionAuth:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"},Key:{type:"contextParams",name:"Key"},CopySource:{type:"contextParams",name:"CopySource"}}).m(function(e,t,r,s){return[Ii(r,e.getEndpointParameterInstructions()),hn(r),jh(r)]}).s("AmazonS3","CopyObject",{}).n("S3Client","CopyObjectCommand").sc(Al).build()){}class Fh extends(qr.classBuilder().ep({...Ua,Bucket:{type:"contextParams",name:"Bucket"},Key:{type:"contextParams",name:"Key"}}).m(function(e,t,r,s){return[Ii(r,e.getEndpointParameterInstructions()),hn(r)]}).s("AmazonS3","DeleteObject",{}).n("S3Client","DeleteObjectCommand").sc(kl).build()){}class Kh extends(qr.classBuilder().ep({...Ua,Bucket:{type:"contextParams",name:"Bucket"}}).m(function(e,t,r,s){return[Ii(r,e.getEndpointParameterInstructions()),it(r,{requestAlgorithmMember:{httpHeader:"x-amz-sdk-checksum-algorithm",name:"ChecksumAlgorithm"},requestChecksumRequired:!0}),hn(r)]}).s("AmazonS3","DeleteObjects",{}).n("S3Client","DeleteObjectsCommand").sc(Rl).build()){}class Vh extends(qr.classBuilder().ep({...Ua,Bucket:{type:"contextParams",name:"Bucket"},Key:{type:"contextParams",name:"Key"}}).m(function(e,t,r,s){return[Ii(r,e.getEndpointParameterInstructions()),it(r,{requestChecksumRequired:!1,requestValidationModeMember:"ChecksumMode",responseAlgorithms:["CRC64NVME","CRC32","CRC32C","SHA256","SHA1","SHA512","MD5","XXHASH64","XXHASH3","XXHASH128"]}),jh(r),is()]}).s("AmazonS3","GetObject",{}).n("S3Client","GetObjectCommand").sc(Tl).build()){}class Wh extends(qr.classBuilder().ep({...Ua,Bucket:{type:"contextParams",name:"Bucket"},Prefix:{type:"contextParams",name:"Prefix"}}).m(function(e,t,r,s){return[Ii(r,e.getEndpointParameterInstructions()),hn(r)]}).s("AmazonS3","ListObjectsV2",{}).n("S3Client","ListObjectsV2Command").sc(Pl).build()){}class Gh extends(qr.classBuilder().ep({...Ua,Bucket:{type:"contextParams",name:"Bucket"},Key:{type:"contextParams",name:"Key"}}).m(function(e,t,r,s){return[Ii(r,e.getEndpointParameterInstructions()),it(r,{requestAlgorithmMember:{httpHeader:"x-amz-sdk-checksum-algorithm",name:"ChecksumAlgorithm"},requestChecksumRequired:!1}),es(),hn(r),jh(r)]}).s("AmazonS3","PutObject",{}).n("S3Client","PutObjectCommand").sc(Il).build()){}async function Xh(e,t={}){const{key:r,body:s,destinationKey:n,provider:i,...o}=t,a=i||function(){const e={cloudflare:["CLOUDFLARE_BUCKET_NAME","CLOUDFLARE_ACCESS_KEY_ID","CLOUDFLARE_SECRET_ACCESS_KEY","CLOUDFLARE_BUCKET_URL"],backblaze:["BACKBLAZE_BUCKET_NAME","BACKBLAZE_ACCESS_KEY_ID","BACKBLAZE_SECRET_ACCESS_KEY","BACKBLAZE_BUCKET_URL"],amazon:["AMAZON_BUCKET_NAME","AMAZON_ACCESS_KEY_ID","AMAZON_SECRET_ACCESS_KEY","AMAZON_BUCKET_URL"]};for(const[t,r]of Object.entries(e))if(r.every(e=>process.env[e]))return t;return"cloudflare"}(),c=Object.fromEntries(Object.entries(o).map(([e,t])=>[`${a.toUpperCase()}_${e}`,t])),u=function(e,t={}){const r=e.toUpperCase()+"_";return{region:"amazon"===e?t.awsRegion||process.env.AMAZON_REGION||"us-east-1":"auto",endpoint:t[`${r}BUCKET_URL`]||process.env[`${r}BUCKET_URL`]||"",bucket:t[`${r}BUCKET_NAME`]||process.env[`${r}BUCKET_NAME`]||"",accessKeyId:t[`${r}ACCESS_KEY_ID`]||t[`${r}APPLICATION_KEY_ID`]||process.env[`${r}ACCESS_KEY_ID`]||process.env[`${r}APPLICATION_KEY_ID`]||"",secretAccessKey:t[`${r}SECRET_ACCESS_KEY`]||t[`${r}APPLICATION_KEY`]||process.env[`${r}SECRET_ACCESS_KEY`]||process.env[`${r}APPLICATION_KEY`]||""}}(a,c);if(!u.bucket||!u.accessKeyId||!u.secretAccessKey)throw new Error(`Missing credentials for ${a}`);const d=new Bh({region:u.region,endpoint:u.endpoint,credentials:{accessKeyId:u.accessKeyId,secretAccessKey:u.secretAccessKey}});try{switch(e){case"upload":return{success:!0,key:r,...await d.send(new Gh({Bucket:u.bucket,Key:r,Body:s}))};case"download":const e=await d.send(new Vh({Bucket:u.bucket,Key:r}));return await(e.Body?.transformToString());case"delete":return{success:!0,key:r,...await d.send(new Fh({Bucket:u.bucket,Key:r}))};case"list":const t=await d.send(new Wh({Bucket:u.bucket}));return t.Contents?.map(e=>e.Key)||[];case"deleteAll":const i=await d.send(new Wh({Bucket:u.bucket}));if(i.Contents?.length){const e=await d.send(new Kh({Bucket:u.bucket,Delete:{Objects:i.Contents.map(e=>({Key:e.Key}))}}));return{success:!0,count:i.Contents.length,...e}}return{success:!0,count:0};case"copy":if(!n)throw new Error("destinationKey is required for copy operation");return{success:!0,sourceKey:r,destinationKey:n,...await d.send(new qh({Bucket:u.bucket,CopySource:`${u.bucket}/${r}`,Key:n}))};case"rename":if(!n)throw new Error("destinationKey is required for rename operation");return await d.send(new qh({Bucket:u.bucket,CopySource:`${u.bucket}/${r}`,Key:n})),await d.send(new Fh({Bucket:u.bucket,Key:r})),{success:!0,oldKey:r,newKey:n};default:throw new Error("Invalid action: upload, download, delete, list, deleteAll, copy, rename")}}catch(l){throw console.error(`Error in ${a}:`,l.message),l}}e();export{K as f,Xh as m,W as t};
|