manage-storage 0.0.5 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
File without changes
@@ -0,0 +1 @@
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};
@@ -0,0 +1 @@
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={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"};function Cn(e){return e.replace(vn,e=>En[e])}const An=/[&"'<>\r\n\u0085\u2028]/g,xn={"&":"&amp;",'"':"&quot;","'":"&apos;","<":"&lt;",">":"&gt;","\r":"&#x0D;","\n":"&#x0A;","…":"&#x85;","\u2028":"&#x2028;"};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};
File without changes
@@ -1 +1 @@
1
- import"dotenv";import{m as a,m as e}from"./manage-storage-B0amn6is.js";export{a as default,e as manageStorage};
1
+ import"dotenv";import{m as a,m as e}from"./manage-storage-CFQpLcZ9.js";export{a as default,e as manageStorage};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "manage-storage",
3
- "version": "0.0.5",
4
- "description": "Storage manager supporting AWS S3, Cloudflare R2, and Backblaze B2 with automatic provider detection",
3
+ "version": "0.0.6",
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",
7
7
  "types": "./dist/manage-storage.d.ts",
@@ -9,26 +9,24 @@
9
9
  "keywords": [
10
10
  "s3",
11
11
  "r2",
12
+ "b2",
12
13
  "cloudflare",
13
14
  "backblaze",
14
- "b2",
15
+ "aws",
16
+ "amazon",
15
17
  "storage",
16
18
  "cloud",
17
- "aws",
18
- "object-storage",
19
+ "cloud-storage",
20
+ "file-storage",
19
21
  "multi-cloud"
20
22
  ],
21
23
  "author": "vtempest",
22
24
  "license": "MIT",
23
25
  "repository": {
24
26
  "type": "git",
25
- "url": "https://github.com/vtempest/Starter-DOCS.git",
26
- "directory": "storage"
27
- },
28
- "bugs": {
29
- "url": "https://github.com/vtempest/Starter-DOCS/issues"
27
+ "url": "https://github.com/OpenSourceAGI/appdemo-dev-tools/tree/master/packages/manage-storage"
30
28
  },
31
- "homepage": "https://github.com/vtempest/Starter-DOCS#readme",
29
+ "homepage": "https://github.com/OpenSourceAGI/appdemo-dev-tools/tree/master/packages/manage-storage",
32
30
  "dependencies": {
33
31
  "@aws-sdk/client-s3": "^3.965.0",
34
32
  "dotenv": "^17.2.3"
@@ -1 +0,0 @@
1
- import{t as e,f as t}from"./manage-storage-B0amn6is.js";class r{marshaller;serializer;deserializer;serdeContext;defaultContentType;constructor({marshaller:e,serializer:t,deserializer:r,serdeContext:i,defaultContentType:s}){this.marshaller=e,this.serializer=t,this.deserializer=r,this.serdeContext=i,this.defaultContentType=s}async serializeEventStream({eventStream:e,requestSchema:t,initialRequest:r}){const i=this.marshaller,s=t.getEventStreamMember(),n=t.getMemberSchema(s),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};const t=Object.keys(e).find(e=>"__type"!==e)??"",{additionalHeaders:r,body:i,eventType:s,explicitPayloadContentType:a}=this.writeEventBody(t,n,e);return{headers:{":event-type":{type:"string",value:s},":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 s=this.marshaller,n=r.getEventStreamMember(),a=r.getMemberSchema(n).getMemberSchemas(),o=/* @__PURE__ */Symbol("initialResponseMarker"),l=s.deserialize(t.body,async t=>{const i=Object.keys(t).find(e=>"__type"!==e)??"",s=t[i].body;if("initial-response"===i){const e=await this.deserializer.read(r,s);return delete e[n],{[o]:!0,...e}}if(i in a){const r=a[i];if(r.isStructSchema()){const n={};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()?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[i].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(a)return{[i]:n}}return{[i]:await this.deserializer.read(r,s)}}return{$unknown:t}}),c=l[Symbol.asyncIterator](),d=await c.next();if(d.done)return l;if(d.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,t]of Object.entries(d.value))i[e]=t}return{async*[Symbol.asyncIterator](){for(d?.value?.[o]||(yield d.value);;){const{done:e,value:t}=await c.next();if(e)break;yield t}}}}writeEventBody(e,r,i){const s=this.serializer;let n,a=e,o=null;const l={};if(r.getSchema()[4].includes(e)){const t=r.getMemberSchema(e);if(!t.isStructSchema())throw new Error("@smithy/core/event-streams - non-struct member not supported in event stream union.");for(const[r,s]of t.structIterator()){const{eventHeader:t,eventPayload:n}=s.getMergedTraits();if(n)o=r;else if(t){const t=i[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 i[e][r])}}if(null!==o){const r=t.getMemberSchema(o);r.isBlobSchema()?n="application/octet-stream":r.isStringSchema()&&(n="text/plain"),s.write(r,i[e][o])}else s.write(t,i[e])}else{const[t,r]=i[e];a=t,s.write(15,r)}const c=s.flush();return{body:"string"==typeof c?(this.serdeContext?.utf8Decoder??t)(c):c,eventType:a,explicitPayloadContentType:n,additionalHeaders:l}}}export{r as EventStreamSerde};
@@ -1 +0,0 @@
1
- import{config as e}from"dotenv";var t,r,n,s;(r=t||(t={})).HTTP="http",r.HTTPS="https",(s=n||(n={})).MD5="md5",s.CRC32="crc32",s.CRC32C="crc32c",s.SHA1="sha1",s.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 n=r[t];return{...e,[t]:Array.isArray(n)?[...n]:n}},{}))),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:n}=r;if(!1!==e.expectContinueHeader&&o.isInstance(n)&&n.body&&"node"===e.runtime&&"FetchHttpHandler"!==e.requestHandler?.constructor?.name){let t=!0;if("number"==typeof e.expectContinueHeader)try{t=(Number(n.headers?.["content-length"])??e.bodyLengthChecker?.(n.body)??1/0)>=e.expectContinueHeader}catch(s){}else t=!!e.expectContinueHeader;t&&(n.headers.Expect="100-continue")}return t({...r,request:n})}}(e),c)}}),d="WHEN_SUPPORTED",l="WHEN_REQUIRED",h=d,p="WHEN_SUPPORTED",f="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;function v(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}const E=e=>a.isInstance(e)?e.headers?.date??e.headers?.Date:void 0,C=e=>new Date(Date.now()+e),x=(e,t)=>{const r=Date.parse(e);return((e,t)=>Math.abs(C(t).getTime()-e)>=3e5)(r,t)?r-Date.now():t},A=(e,t)=>{if(!t)throw new Error(`Property \`${e}\` is not resolved for AWS SDK SigV4Auth`);return t},R=async e=>{const t=A("context",e.context),r=A("config",e.config),n=t.endpointV2?.properties?.authSchemes?.[0],s=A("signer",r.signer),i=await s(n),o=e?.signingRegion,a=e?.signingRegionSet,c=e?.signingName;return{config:r,signer:i,signingRegion:o,signingRegionSet:a,signingName:c}};class k{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 n=await R(r),{config:s,signer:i}=n;let{signingRegion:a,signingName:c}=n;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:C(s.systemClockOffset),signingRegion:a,signingService:c})}errorHandler(e){return t=>{const r=t.ServerTime??E(t.$response);if(r){const n=A("config",e.config),s=n.systemClockOffset;n.systemClockOffset=x(r,n.systemClockOffset);n.systemClockOffset!==s&&t.$metadata&&(t.$metadata.clockSkewCorrected=!0)}throw t}}successHandler(e,t){const r=E(e);if(r){const e=A("config",t.config);e.systemClockOffset=x(r,e.systemClockOffset)}}}class T extends k{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:n,signer:s,signingRegion:i,signingRegionSet:a,signingName:c}=await R(r),u=(await(n.sigv4aSigningRegionSet?.())??a??[i]).join(",");return await s.sign(e,{signingDate:C(n.systemClockOffset),signingRegion:u,signingService:c})}}const P=e=>e[i]||(e[i]={}),I=e=>{if("function"==typeof e)return e;const t=Promise.resolve(e);return()=>t};const M=(e,t)=>(r,n)=>async s=>{const i=((e,t)=>{if(!t||0===t.length)return e;const r=[];for(const n of t)for(const t of e)t.schemeId.split("#")[1]===n&&r.push(t);for(const n of e)r.find(({schemeId:e})=>e===n.schemeId)||r.push(n);return r})(e.httpAuthSchemeProvider(await t.httpAuthSchemeParametersProvider(e,n,s.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=P(n),c=[];for(const r of i){const s=o.get(r.schemeId);if(!s){c.push(`HttpAuthScheme \`${r.schemeId}\` was not enabled for this service.`);continue}const i=s.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,n)||{};r.identityProperties=Object.assign(r.identityProperties||{},u),r.signingProperties=Object.assign(r.signingProperties||{},d),a.selectedHttpAuthScheme={httpAuthOption:r,identity:await i(r.identityProperties),signer:s.signer};break}if(!a.selectedHttpAuthScheme)throw new Error(c.join("\n"));return r(s)},O={step:"serialize",tags:["HTTP_AUTH_SCHEME"],name:"httpAuthSchemeMiddleware",override:!0,relation:"before",toMiddleware:"endpointV2Middleware"},U=e=>e=>{throw e},N=(e,t)=>{},$={step:"finalizeRequest",tags:["HTTP_SIGNING"],name:"httpSigningMiddleware",aliases:["apiKeyMiddleware","tokenMiddleware","awsAuthMiddleware"],override:!0,relation:"after",toMiddleware:"retryMiddleware"},D=e=>({applyToStack:e=>{e.addRelativeTo((e,t)=>async r=>{if(!o.isInstance(r.request))return e(r);const n=P(t).selectedHttpAuthScheme;if(!n)throw new Error("No HttpAuthScheme was selected: unable to sign request");const{httpAuthOption:{signingProperties:s={}},identity:i,signer:a}=n,c=await e({...r,request:await a.sign(r.request,i,s)}).catch((a.errorHandler||U)(s));return(a.successHandler||N)(c.response,s),c},$)}}),L=e=>{if("function"==typeof e)return e;const t=Promise.resolve(e);return()=>t},_="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",B=Object.entries(_).reduce((e,[t,r])=>(e[r]=Number(t),e),{}),z=_.split(""),j=e=>{let t=e.length/4*3;"=="===e.slice(-2)?t-=2:"="===e.slice(-1)&&t--;const r=new ArrayBuffer(t),n=new DataView(r);for(let s=0;s<e.length;s+=4){let t=0,r=0;for(let n=s,a=s+3;n<=a;n++)if("="!==e[n]){if(!(e[n]in B))throw new TypeError(`Invalid character ${e[n]} in base64 string.`);t|=B[e[n]]<<6*(a-n),r+=6}else t>>=6;const i=s/4*3;t>>=r%8;const o=Math.floor(r/8);for(let e=0;e<o;e++){const r=8*(o-e-1);n.setUint8(i+e,(t&255<<r)>>r)}}return new Uint8Array(r)},H=e=>(new TextEncoder).encode(e),q=e=>"string"==typeof e?H(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e),F=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 K(e){let t;t="string"==typeof e?H(e):e;const r="object"==typeof t&&"number"==typeof t.length,n="object"==typeof t&&"number"==typeof t.byteOffset&&"number"==typeof t.byteLength;if(!r&&!n)throw new Error("@smithy/util-base64: toBase64 encoder function only accepts string | Uint8Array.");let s="";for(let i=0;i<t.length;i+=3){let e=0,r=0;for(let s=i,o=Math.min(i+3,t.length);s<o;s++)e|=t[s]<<8*(o-s-1),r+=8;const n=Math.ceil(r/6);e<<=6*n-r;for(let t=1;t<=n;t++){const r=6*(n-t);s+=z[(e&63<<r)>>r]}s+="==".slice(0,4-n)}return s}class V extends Uint8Array{static fromString(e,t="utf-8"){if("string"==typeof e)return"base64"===t?V.mutate(j(e)):V.mutate(H(e));throw new Error(`Unsupported conversion from ${typeof e} to Uint8ArrayBlobAdapter.`)}static mutate(e){return Object.setPrototypeOf(e,V.prototype),e}transformToString(e="utf-8"){return"base64"===e?K(this):F(this)}}const W="function"==typeof ReadableStream?ReadableStream:function(){};class Z extends W{}const G=e=>"function"==typeof ReadableStream&&(e?.constructor?.name===ReadableStream.name||e instanceof ReadableStream),X=({expectedChecksum:e,checksum:t,source:r,checksumSourceLocation:n,base64Encoder:s})=>{if(!G(r))throw new Error(`@smithy/util-stream: unsupported source type ${r?.constructor?.name??r} in ChecksumStream.`);const i=s??K;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 s=await t.digest(),o=i(s);if(e!==o){const t=new Error(`Checksum mismatch: expected "${e}" but received "${o}" in response header "${n}".`);r.error(t)}else r.terminate()}});r.pipeThrough(o);const a=o.readable;return Object.setPrototypeOf(a,Z.prototype),a};class Y{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 n=this.byteArrays[r];e.set(n,t),t+=n.byteLength}return this.reset(),e}reset(){this.byteArrays=[],this.byteLength=0}}const J=function(e,t,r){const n=e.getReader();let s=!1,i=0;const o=["",new Y(e=>new Uint8Array(e))];let a=-1;const c=async e=>{const{value:u,done:d}=await n.read(),l=u;if(d){if(-1!==a){const t=Q(o,a);ee(t)>0&&e.enqueue(t)}e.close()}else{const n=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!==n&&(a>=0&&e.enqueue(Q(o,a)),a=n),-1===a)return void e.enqueue(l);const u=ee(l);i+=u;const d=ee(o[a]);if(u>=t&&0===d)e.enqueue(l);else{const n=function(e,t,r){switch(t){case 0:return e[0]+=r,ee(e[0]);case 1:case 2:return e[t].push(r),ee(e[t])}}(o,a,l);!s&&i>2*t&&(s=!0,r?.warn(`@smithy/util-stream - stream chunk size ${u} is below threshold of ${t}, automatically buffering.`)),n>=t?e.enqueue(Q(o,a)):await c(e)}}};return new ReadableStream({pull:c})};function Q(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 ee(e){return e?.byteLength??e?.length??0}const te=(e,t)=>{const{base64Encoder:r,bodyLengthChecker:n,checksumAlgorithmFn:s,checksumLocationName:i,streamHasher:o}=t,a=void 0!==r&&void 0!==n&&void 0!==s&&void 0!==i&&void 0!==o,c=a?o(s,e):void 0,u=e.getReader();return new ReadableStream({async pull(e){const{value:t,done:s}=await u.read();if(s){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(`${(n(t)||0).toString(16)}\r\n${t}\r\n`)}})};const re=e=>encodeURIComponent(e).replace(/[!'()*]/g,ne),ne=e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`;function se(e,t){return new Request(e,t)}function ie(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 oe={supported:void 0};class ae{config;configProvider;static create(e){return"function"==typeof e?.handle?e:new ae(e)}constructor(e){"function"==typeof e?this.configProvider=e().then(e=>e||{}):(this.config=e??{},this.configProvider=Promise.resolve(this.config)),void 0===oe.supported&&(oe.supported=Boolean("undefined"!=typeof Request&&"keepalive"in se("https://[::1]")))}destroy(){}async handle(e,{abortSignal:t,requestTimeout:r}={}){this.config||(this.config=await this.configProvider);const n=r??this.config.requestTimeout,s=!0===this.config.keepAlive,i=this.config.credentials;if(t?.aborted){const e=new Error("Request aborted");return e.name="AbortError",Promise.reject(e)}let o=e.path;const c=function(e){const t=[];for(let r of Object.keys(e).sort()){const n=e[r];if(r=re(r),Array.isArray(n))for(let e=0,s=n.length;e<s;e++)t.push(`${r}=${re(n[e])}`);else{let e=r;(n||"string"==typeof n)&&(e+=`=${re(n)}`),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}`,p="GET"===l||"HEAD"===l?void 0:e.body,f={body:p,headers:new Headers(e.headers),method:l,credentials:i};this.config?.cache&&(f.cache=this.config.cache),p&&(f.duplex="half"),"undefined"!=typeof AbortController&&(f.signal=t),oe.supported&&(f.keepalive=s),"function"==typeof this.config.requestInit&&Object.assign(f,this.config.requestInit(e));let m=()=>{};const g=se(h,f),y=[fetch(g).then(e=>{const t=e.headers,r={};for(const n of t.entries())r[n[0]]=n[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})}))}),ie(n)];return t&&y.push(new Promise((e,r)=>{const n=()=>{const e=new Error("Request aborted");e.name="AbortError",r(e)};if("function"==typeof t.addEventListener){const e=t;e.addEventListener("abort",n,{once:!0}),m=()=>e.removeEventListener("abort",n)}else t.onabort=n})),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??{}}}const ce=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 n=new FileReader;n.onloadend=()=>{if(2!==n.readyState)return r(new Error("Reader aborted too early"));const e=n.result??"",s=e.indexOf(","),i=s>-1?s+1:e.length;t(e.substring(i))},n.onabort=()=>r(new Error("Read aborted")),n.onerror=()=>r(n.error),n.readAsDataURL(e)})}(e),r=j(t);return new Uint8Array(r)}(e):async function(e){const t=[],r=e.getReader();let n=!1,s=0;for(;!n;){const{done:e,value:i}=await r.read();i&&(t.push(i),s+=i.length),n=e}const i=new Uint8Array(s);let o=0;for(const a of t)i.set(a,o),o+=a.length;return i}(e);const ue={},de={};for(let Sf=0;Sf<256;Sf++){let e=Sf.toString(16).toLowerCase();1===e.length&&(e=`0${e}`),ue[Sf]=e,de[e]=Sf}function le(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 n=e.slice(r,r+2).toLowerCase();if(!(n in de))throw new Error(`Cannot decode unrecognized sequence ${n} as hexadecimal`);t[r/2]=de[n]}return t}function he(e){let t="";for(let r=0;r<e.byteLength;r++)t+=ue[e[r]];return t}const pe="The stream has already been transformed.",fe=e=>{if(!me(e)&&!G(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(pe);return t=!0,await ce(e)};return Object.assign(e,{transformToByteArray:r,transformToString:async e=>{const t=await r();if("base64"===e)return K(t);if("hex"===e)return he(t);if(void 0===e||"utf8"===e||"utf-8"===e)return F(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(pe);if(t=!0,me(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(G(e))return e;throw new Error(`Cannot transform payload to web stream, got ${e}`)}})},me=e=>"function"==typeof Blob&&e instanceof Blob;const ge=async(e=new Uint8Array,t)=>{if(e instanceof Uint8Array)return V.mutate(e);if(!e)return V.mutate(new Uint8Array);const r=t.streamCollector(e);return V.mutate(await r)};function ye(e){return encodeURIComponent(e).replace(/[!'()*]/g,function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})}const we=e=>"function"==typeof e?e():e,be=(e,t,r,n,s)=>({name:t,namespace:e,traits:r,input:n,output:s}),Se=(e,t)=>(t.find(([t])=>t.match(e))||[void 0,void 0])[1],ve={name:"deserializerMiddleware",step:"deserialize",tags:["DESERIALIZER"],override:!0},Ee={name:"serializerMiddleware",step:"serialize",tags:["SERIALIZER"],override:!0};function Ce(e){return{applyToStack:t=>{t.add((e=>(t,r)=>async n=>{const{operationSchema:s}=P(r),[,i,o,a,c,u]=s??[],d=r.endpointV2?.url&&e.urlParser?async()=>e.urlParser(r.endpointV2.url):e.endpoint,l=await e.protocol.serializeRequest(be(i,o,a,c,u),n.input,{...e,...r,endpoint:d});return t({...n,request:l})})(e),Ee),t.add((e=>(t,r)=>async n=>{const{response:s}=await t(n),{operationSchema:i}=P(r),[,o,c,u,d,l]=i??[];try{return{response:s,output:await e.protocol.deserializeResponse(be(o,c,u,d,l),{...e,...r},s)}}catch(h){if(Object.defineProperty(h,"$response",{value:s,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(p){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(s)){const{headers:e={}}=s,t=Object.entries(e);h.$metadata={httpStatusCode:s.statusCode,requestId:Se(/^x-[\w-]+-request-?id$/,t),extendedRequestId:Se(/^x-[\w-]+-id-2$/,t),cfId:Se(/^x-[\w-]+-cf-id$/,t)}}}catch(p){}}throw h}})(e),ve),e.protocol.setSerdeContext(e)}}}function xe(e){if("object"==typeof e)return e;e|=0;const t={};let r=0;for(const n of["httpLabel","idempotent","idempotencyToken","sensitive","httpPayload","httpResponseCode","httpQueryParams"])1==(e>>r++&1)&&(t[n]=1);return t}class Ae{ref;memberName;static symbol=/* @__PURE__ */Symbol.for("@smithy/nor");symbol=Ae.symbol;name;schema;_isMemberSchema;traits;memberTraits;normalizedTraits;constructor(e,t){this.ref=e,this.memberName=t;const r=[];let n=e,s=e;for(this._isMemberSchema=!1;ke(n);)r.push(n[1]),n=n[0],s=we(n),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,xe(t))}}else this.memberTraits=0;if(s instanceof Ae){const e=this.memberTraits;return Object.assign(this,s),this.memberTraits=Object.assign({},e,s.getMemberTraits(),this.getMemberTraits()),this.normalizedTraits=void 0,void(this.memberName=t??s.memberName)}if(this.schema=we(s),Te(this.schema)?(this.name=`${this.schema[1]}#${this.schema[2]}`,this.traits=this.schema[3]):(this.name=this.memberName??String(s),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=we(e);if(t instanceof Ae)return t;if(ke(t)){const[r,n]=t;if(r instanceof Ae)return Object.assign(r.getMergedTraits(),xe(n)),r;throw new Error(`@smithy/core/schema - may not init unwrapped member schema=${JSON.stringify(e,null,2)}.`)}return new Ae(t)}getSchema(){const e=this.schema;return 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()[0];return 3===e||-3===e||4===e}isUnionSchema(){return 4===this.getSchema()[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(){const e=e=>!(4&~e&&!e?.idempotencyToken),{normalizedTraits:t,traits:r,memberTraits:n}=this;return e(t)||e(r)||e(n)}getMergedTraits(){return this.normalizedTraits??(this.normalizedTraits={...this.getOwnTraits(),...this.getMemberTraits()})}getMemberTraits(){return xe(this.memberTraits)}getOwnTraits(){return xe(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 Re([e?15:r[4]??0,0],"key")}getValueSchema(){const e=this.getSchema(),[t,r,n]=[this.isDocumentSchema(),this.isMapSchema(),this.isListSchema()],s="number"==typeof e?63&e:e&&"object"==typeof e&&(r||n)?e[3+e[0]]:t?15:void 0;if(null!=s)return Re([s,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),n=t[5][r];return Re(ke(n)?n:[n,0],e)}if(this.isDocumentSchema())return Re([15,0],e);throw new Error(`@smithy/core/schema - ${this.getName(!0)} has no 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();for(let t=0;t<e[4].length;++t)yield[e[4][t],Re([e[5][t],0],e[4][t])]}}function Re(e,t){if(e instanceof Ae)return Object.assign(e,{memberName:t,_isMemberSchema:!0});return new Ae(e,t)}const ke=e=>Array.isArray(e)&&2===e.length,Te=e=>Array.isArray(e)&&e.length>=5;class Pe{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 Pe.registries.has(e)||Pe.registries.set(e,new Pe(e)),Pe.registries.get(e)}register(e,t){const r=this.normalizeShapeId(e);Pe.for(r.split("#")[0]).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,n=Pe.for(r[1]);n.schemas.set(r[1]+"#"+r[2],r),n.exceptions.set(r,t)}getErrorCtor(e){const t=e;return Pe.for(t[1]).exceptions.get(t)}getBaseException(){for(const e of this.exceptions.keys())if(Array.isArray(e)){const[,t,r]=e,n=t+"#"+r;if(n.startsWith("smithy.ts.sdk.synthetic.")&&n.endsWith("ServiceException"))return e}}find(e){return[...this.schemas.values()].find(e)}clear(){this.schemas.clear(),this.exceptions.clear()}normalizeShapeId(e){return e.includes("#")?e:this.namespace+"#"+e}}const Ie=Math.ceil(2**127*(2-2**-23)),Me=e=>{const t=(e=>{if(null!=e){if("string"==typeof e){const t=parseFloat(e);if(!Number.isNaN(t))return String(t)!==String(e)&&ze.warn(Be(`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)>Ie)throw new TypeError(`Expected 32-bit float, got ${e}`);return t},Oe=e=>Ne(e,16),Ue=e=>Ne(e,8),Ne=(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&&$e(r,t)!==r)throw new TypeError(`Expected ${t}-bit integer, got ${e}`);return r},$e=(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]}},De=/(-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?)|(-?Infinity)|(NaN)/g,Le=e=>{const t=e.match(De);if(null===t||t[0].length!==e.length)throw new TypeError("Expected real number, got implicit NaN");return parseFloat(e)},_e=e=>Oe("string"==typeof e?Le(e):e),Be=e=>String(new TypeError(e).stack||e).split("\n").slice(0,5).filter(e=>!e.includes("stackTraceWarning")).join("\n"),ze={warn:console.warn},je=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],He=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function qe(e){const t=e.getUTCFullYear(),r=e.getUTCMonth(),n=e.getUTCDay(),s=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`${je[n]}, ${s<10?`0${s}`:`${s}`} ${He[r]} ${t} ${c}:${u}:${d} GMT`}const Fe=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$/),Ke=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$/),Ve=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})$/),We=(e,t,r,n)=>{const s=t-1;return Je(e,s,r),new Date(Date.UTC(e,s,r,et(n.hours,"hour",0,23),et(n.minutes,"minute",0,59),et(n.seconds,"seconds",0,60),tt(n.fractionalMilliseconds)))},Ze=e=>{const t=/* @__PURE__ */(new Date).getUTCFullYear(),r=100*Math.floor(t/100)+_e(rt(e));return r<t?r+100:r},Ge=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,Xe=e=>{const t=He.indexOf(e);if(t<0)throw new TypeError(`Invalid month: ${e}`);return t+1},Ye=[31,28,31,30,31,30,31,31,30,31,30,31],Je=(e,t,r)=>{let n=Ye[t];if(1===t&&Qe(e)&&(n=29),r>n)throw new TypeError(`Invalid day for ${He[t]} in ${e}: ${r}`)},Qe=e=>e%4==0&&(e%100!=0||e%400==0),et=(e,t,r,n)=>{const s=(e=>Ue("string"==typeof e?Le(e):e))(rt(e));if(s<r||s>n)throw new TypeError(`${t} must be between ${r} and ${n}, inclusive`);return s},tt=e=>null==e?0:1e3*(e=>Me("string"==typeof e?Le(e):e))("0."+e),rt=e=>{let t=0;for(;t<e.length-1&&"0"===e.charAt(t);)t++;return 0===t?e:e.slice(t)},nt="undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),st=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0")),it=()=>{if(nt)return nt();const e=new Uint8Array(16);return crypto.getRandomValues(e),e[6]=15&e[6]|64,e[8]=63&e[8]|128,st[e[0]]+st[e[1]]+st[e[2]]+st[e[3]]+"-"+st[e[4]]+st[e[5]]+"-"+st[e[6]]+st[e[7]]+"-"+st[e[8]]+st[e[9]]+"-"+st[e[10]]+st[e[11]]+st[e[12]]+st[e[13]]+st[e[14]]+st[e[15]]},ot=function(e){return Object.assign(new String(e),{deserializeJSON:()=>JSON.parse(String(e)),toString:()=>String(e),toJSON:()=>String(e)})};function at(e){return(e.includes(",")||e.includes('"'))&&(e=`"${e.replace(/"/g,'\\"')}"`),e}ot.from=e=>e&&"object"==typeof e&&(e instanceof ot||"deserializeJSON"in e)?e:"string"==typeof e||Object.getPrototypeOf(e)===String.prototype?ot(String(e)):ot(JSON.stringify(e)),ot.fromObject=ot.from;const ct="(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun)(?:[ne|u?r]?s?day)?",ut="(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)",dt="(\\d?\\d):(\\d{2}):(\\d{2})(?:\\.(\\d+))?",lt="(\\d?\\d)",ht="(\\d{4})",pt=new RegExp(/^(\d{4})-(\d\d)-(\d\d)[tT](\d\d):(\d\d):(\d\d)(\.(\d+))?(([-+]\d\d:\d\d)|[zZ])$/),ft=new RegExp(`^${ct}, ${lt} ${ut} ${ht} ${dt} GMT$`),mt=new RegExp(`^${ct}, ${lt}-${ut}-(\\d\\d) ${dt} GMT$`),gt=new RegExp(`^${ct} ${ut} ( [1-9]|\\d\\d) ${dt} ${ht}$`),yt=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function wt(e,t,r){const n=Number(e);if(n<t||n>r)throw new Error(`Value ${n} out of range [${t}, ${r}]`)}function bt(e,t,r){if(!Number.isInteger(r))throw new Error("Invalid number of delimiters ("+r+") for splitEvery.");const n=e.split(t),s=[];let i="";for(let o=0;o<n.length;o++)""===i?i=n[o]:i+=t+n[o],(o+1)%r===0&&(s.push(i),i="");return""!==i&&s.push(i),s}const St=e=>{const t=e.length,r=[];let n,s=!1,i=0;for(let o=0;o<t;++o){const t=e[o];switch(t){case'"':"\\"!==n&&(s=!s);break;case",":s||(r.push(e.slice(i,o)),i=o+1)}n=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,'"'))})},vt=/^-?\d*(\.\d+)?$/;class Et{string;type;constructor(e,t){if(this.string=e,this.type=t,!vt.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 Et.prototype.isPrototypeOf(e)||"bigDecimal"===t.type&&vt.test(t.string)}}class Ct{serdeContext;setSerdeContext(e){this.serdeContext=e}}class xt extends Ct{options;constructor(e){super(),this.options=e}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,n]of t.url.searchParams.entries())e.query[r]=n;return e}return 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},e}setHostPrefix(e,t,r){const n=Ae.of(t.input),s=xe(t.traits??{});if(s.endpoint){let t=s.endpoint?.[0];if("string"==typeof t){const s=[...n.structIterator()].filter(([,e])=>e.getMergedTraits().hostLabel);for(const[e]of s){const n=r[e];if("string"!=typeof n)throw new Error(`@smithy/core/schema - ${e} in input must be a string as hostLabel.`);t=t.replace(`{${e}}`,n)}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-Bsc1j7P2.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,n,s){return[]}getEventStreamMarshaller(){const e=this.serdeContext;if(!e.eventStreamMarshaller)throw new Error("@smithy/core - HttpProtocol: eventStreamMarshaller missing in serdeContext.");return e.eventStreamMarshaller}}class At extends xt{async serializeRequest(e,t,r){const n={...t??{}},s=this.serializer,i={},a={},c=await r.endpoint(),u=Ae.of(e?.input),d=u.getSchema();let l,h=!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,n);const t=xe(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 n=new URLSearchParams(r??"");Object.assign(i,Object.fromEntries(n))}}for(const[o,f]of u.structIterator()){const e=f.getMergedTraits()??{},t=n[o];if(null!=t||f.isIdempotencyToken())if(e.httpPayload){if(f.isStreaming()){f.isStructSchema()?n[o]&&(l=await this.serializeEventStream({eventStream:n[o],requestSchema:u})):l=t}else s.write(f,t),l=s.flush();delete n[o]}else if(e.httpLabel){s.write(f,t);const e=s.flush();p.path.includes(`{${o}+}`)?p.path=p.path.replace(`{${o}+}`,e.split("/").map(ye).join("/")):p.path.includes(`{${o}}`)&&(p.path=p.path.replace(`{${o}}`,ye(e))),delete n[o]}else if(e.httpHeader)s.write(f,t),a[e.httpHeader.toLowerCase()]=String(s.flush()),delete n[o];else if("string"==typeof e.httpPrefixHeaders){for(const[r,n]of Object.entries(t)){const t=e.httpPrefixHeaders+r;s.write([f.getValueSchema(),{httpHeader:t}],n),a[t.toLowerCase()]=s.flush()}delete n[o]}else e.httpQuery||e.httpQueryParams?(this.serializeQuery(f,t,i),delete n[o]):h=!0}return h&&n&&(s.write(d,n),l=s.flush()),p.headers=a,p.query=i,p.body=l,p}serializeQuery(e,t,r){const n=this.serializer,s=e.getMergedTraits();if(s.httpQueryParams){for(const[i,o]of Object.entries(t))if(!(i in r)){const t=e.getValueSchema();Object.assign(t.getMergedTraits(),{...s,httpQuery:i,httpQueryParams:void 0}),this.serializeQuery(t,o,r)}}else if(e.isListSchema()){const i=!!e.getMergedTraits().sparse,o=[];for(const r of t){n.write([e.getValueSchema(),s],r);const t=n.flush();(i||void 0!==t)&&o.push(t)}r[s.httpQuery]=o}else n.write([e,s],t),r[s.httpQuery]=n.flush()}async deserializeResponse(e,t,r){const n=this.deserializer,s=Ae.of(e.output),i={};if(r.statusCode>=300){const s=await ge(r.body,t);throw s.byteLength>0&&Object.assign(i,await n.read(15,s)),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(s,t,r,i);if(o.length){const e=await ge(r.body,t);if(e.byteLength>0){const t=await n.read(s,e);for(const e of o)i[e]=t[e]}}else o.discardResponseBody&&await ge(r.body,t);return i.$metadata=this.deserializeMetadata(r),i}async deserializeHttpMessage(e,t,r,n,s){let i;i=n instanceof Set?s:n;let o=!0;const a=this.deserializer,c=Ae.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}):fe(r.body)}else if(r.body){const e=await ge(r.body,t);e.byteLength>0&&(i[d]=await a.read(l,e))}}else if(e.httpHeader){const t=String(e.httpHeader).toLowerCase(),n=r.headers[t];if(null!=n)if(l.isListSchema()){const e=l.getValueSchema();let r;e.getMergedTraits().httpHeader=t,r=e.isTimestampSchema()&&4===e.getSchema()?bt(n,",",2):St(n);const s=[];for(const t of r)s.push(await a.read(e,t.trim()));i[d]=s}else i[d]=await a.read(l,n)}else if(void 0!==e.httpPrefixHeaders){i[d]={};for(const[t,n]of Object.entries(r.headers))if(t.startsWith(e.httpPrefixHeaders)){const r=l.getValueSchema();r.getMergedTraits().httpHeader=t,i[d][t.slice(e.httpPrefixHeaders.length)]=await a.read(r,n)}}else e.httpResponseCode?i[d]=r.statusCode:u.push(d)}return u.discardResponseBody=o,u}}function Rt(e,t){if(t.timestampFormat.useTrait&&e.isTimestampSchema()&&(5===e.getSchema()||6===e.getSchema()||7===e.getSchema()))return e.getSchema();const{httpLabel:r,httpPrefixHeaders:n,httpHeader:s,httpQuery:i}=e.getMergedTraits();return(t.httpBindings?"string"==typeof n||Boolean(s)?6:Boolean(i)||Boolean(r)?5:void 0:void 0)??t.timestampFormat.default}class kt extends Ct{settings;constructor(e){super(),this.settings=e}read(e,t){const r=Ae.of(e);if(r.isListSchema())return St(t).map(e=>this.read(r.getValueSchema(),e));if(r.isBlobSchema())return(this.serdeContext?.base64Decoder??j)(t);if(r.isTimestampSchema()){switch(Rt(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=pt.exec(e);if(!t)throw new TypeError(`Invalid RFC3339 timestamp format ${e}`);const[,r,n,s,i,o,a,,c,u]=t;wt(n,1,12),wt(s,1,31),wt(i,0,23),wt(o,0,59),wt(a,0,60);const d=new Date(Date.UTC(Number(r),Number(n)-1,Number(s),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],n="-"===e?1:-1;d.setTime(d.getTime()+n*(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,n,s,i,o,a,c;if((c=ft.exec(e))?[,t,r,n,s,i,o,a]=c:(c=mt.exec(e))?([,t,r,n,s,i,o,a]=c,n=(Number(n)+1900).toString()):(c=gt.exec(e))&&([,r,t,s,i,o,a,n]=c),n&&o){const e=Date.UTC(Number(n),yt.indexOf(r),Number(t),Number(s),Number(i),Number(o),a?Math.round(1e3*parseFloat(`0.${a}`)):0);wt(t,1,31),wt(s,0,23),wt(i,0,59),wt(o,0,60);const c=new Date(e);return c.setUTCFullYear(Number(n)),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 n=t;if(e){r.getMergedTraits().httpHeader&&(n=this.base64ToUtf8(n));return("application/json"===e||e.endsWith("+json"))&&(n=ot.from(n)),n}}return r.isNumericSchema()?Number(t):r.isBigIntegerSchema()?BigInt(t):r.isBigDecimalSchema()?new Et(t,"bigDecimal"):r.isBooleanSchema()?"true"===String(t).toLowerCase():t}base64ToUtf8(e){return(this.serdeContext?.utf8Encoder??F)((this.serdeContext?.base64Decoder??j)(e))}}class Tt extends Ct{codecDeserializer;stringDeserializer;constructor(e,t){super(),this.codecDeserializer=e,this.stringDeserializer=new kt(t)}setSerdeContext(e){this.stringDeserializer.setSerdeContext(e),this.codecDeserializer.setSerdeContext(e),this.serdeContext=e}read(e,t){const r=Ae.of(e),n=r.getMergedTraits(),s=this.serdeContext?.utf8Encoder??F;if(n.httpHeader||n.httpResponseCode)return this.stringDeserializer.read(r,s(t));if(n.httpPayload){if(r.isBlobSchema()){const e=this.serdeContext?.utf8Decoder??H;return"string"==typeof t?e(t):t}if(r.isStringSchema())return"byteLength"in t?s(t):t}return this.codecDeserializer.read(r,t)}}class Pt extends Ct{settings;stringBuffer="";constructor(e){super(),this.settings=e}write(e,t){const r=Ae.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(Rt(r,this.settings)){case 5:this.stringBuffer=t.toISOString().replace(".000Z","Z");break;case 6:this.stringBuffer=qe(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??K)(t));if(r.isListSchema()&&Array.isArray(t)){let e="";for(const n of t){this.write([r.getValueSchema(),r.getMergedTraits()],n);const t=this.flush();""!==e&&(e+=", "),e+=r.getValueSchema().isTimestampSchema()?t:at(t)}return void(this.stringBuffer=e)}this.stringBuffer=JSON.stringify(t,null,2);break;case"string":const e=r.getMergedTraits().mediaType;let n=t;if(e){if(("application/json"===e||e.endsWith("+json"))&&(n=ot.from(n)),r.getMergedTraits().httpHeader)return void(this.stringBuffer=(this.serdeContext?.base64Encoder??K)(n.toString()))}this.stringBuffer=t;break;default:r.isIdempotencyToken()?this.stringBuffer=it():this.stringBuffer=String(t)}}flush(){const e=this.stringBuffer;return this.stringBuffer="",e}}class It{codecSerializer;stringSerializer;buffer;constructor(e,t,r=new Pt(t)){this.codecSerializer=e,this.stringSerializer=r}setSerdeContext(e){this.codecSerializer.setSerdeContext(e),this.stringSerializer.setSerdeContext(e)}write(e,t){const r=Ae.of(e),n=r.getMergedTraits();return n.httpHeader||n.httpLabel||n.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()}}class Mt{authSchemes=/* @__PURE__ */new Map;constructor(e){for(const[t,r]of Object.entries(e))void 0!==r&&this.authSchemes.set(t,r)}getIdentityProvider(e){return this.authSchemes.get(e)}}const Ot=(Ut=3e5,function(e){return Nt(e)&&e.expiration.getTime()-Date.now()<Ut});var Ut;const Nt=e=>void 0!==e.expiration,$t=(e,t,r)=>{let n,s,i,o=!1;return async t=>(i&&!t?.forceRefresh||(n=await(async()=>{s||(s=e());try{n=await s,i=!0,o=!1}finally{s=void 0}return n})()),n)},Dt="X-Amz-Date",Lt="X-Amz-Signature",_t="X-Amz-Security-Token",Bt="authorization",zt=Dt.toLowerCase(),jt=[Bt,zt,"date"],Ht=Lt.toLowerCase(),qt="x-amz-content-sha256",Ft=_t.toLowerCase(),Kt={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},Vt=/^proxy-/,Wt=/^sec-/,Zt="AWS4-HMAC-SHA256",Gt="AWS4-HMAC-SHA256-PAYLOAD",Xt="aws4_request",Yt={},Jt=[],Qt=(e,t,r)=>`${e}/${t}/${r}/${Xt}`,er=(e,t,r)=>{const n=new e(t);return n.update(q(r)),n.digest()},tr=({headers:e},t,r)=>{const n={};for(const s of Object.keys(e).sort()){if(null==e[s])continue;const i=s.toLowerCase();(i in Kt||t?.has(i)||Vt.test(i)||Wt.test(i))&&(!r||r&&!r.has(i))||(n[i]=e[s].trim().replace(/\s+/g," "))}return n},rr=e=>"function"==typeof ArrayBuffer&&e instanceof ArrayBuffer||"[object ArrayBuffer]"===Object.prototype.toString.call(e),nr=async({headers:e,body:t},r)=>{for(const n of Object.keys(e))if(n.toLowerCase()===qt)return e[n];if(null==t)return"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";if("string"==typeof t||ArrayBuffer.isView(t)||rr(t)){const e=new r;return e.update(q(t)),he(await e.digest())}return"UNSIGNED-PAYLOAD"};class sr{format(e){const t=[];for(const s of Object.keys(e)){const r=H(s);t.push(Uint8Array.from([r.byteLength]),r,this.formatHeaderValue(e[s]))}const r=new Uint8Array(t.reduce((e,t)=>e+t.byteLength,0));let n=0;for(const s of t)r.set(s,n),n+=s.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 n=new Uint8Array(9);return n[0]=5,n.set(e.value.bytes,1),n;case"binary":const s=new DataView(new ArrayBuffer(3+e.value.byteLength));s.setUint8(0,6),s.setUint16(1,e.value.byteLength,!1);const i=new Uint8Array(s.buffer);return i.set(e.value,3),i;case"string":const o=H(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(cr.fromNumber(e.value.valueOf()).bytes,1),u;case"uuid":if(!ar.test(e.value))throw new Error(`Invalid UUID received: ${e.value}`);const d=new Uint8Array(17);return d[0]=9,d.set(le(e.value.replace(/\-/g,"")),1),d}}}var ir,or;(or=ir||(ir={}))[or.boolTrue=0]="boolTrue",or[or.boolFalse=1]="boolFalse",or[or.byte=2]="byte",or[or.short=3]="short",or[or.integer=4]="integer",or[or.long=5]="long",or[or.byteArray=6]="byteArray",or[or.string=7]="string",or[or.timestamp=8]="timestamp",or[or.uuid=9]="uuid";const ar=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;let cr=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,n=Math.abs(Math.round(t));e>-1&&n>0;e--,n/=256)r[e]=n;return t<0&&ur(r),new e(r)}valueOf(){const e=this.bytes.slice(0),t=128&e[0];return t&&ur(e),parseInt(he(e),16)*(t?-1:1)}toString(){return String(this.valueOf())}};function ur(e){for(let t=0;t<8;t++)e[t]^=255;for(let t=7;t>-1&&(e[t]++,0===e[t]);t--);}const dr=e=>{e=o.clone(e);for(const t of Object.keys(e.headers))jt.indexOf(t.toLowerCase())>-1&&delete e.headers[t];return e},lr=e=>"number"==typeof e?new Date(1e3*e):"string"==typeof e?Number(e)?new Date(1e3*Number(e)):new Date(e):e;class hr{service;regionProvider;credentialProvider;sha256;uriEscapePath;applyChecksum;constructor({applyChecksum:e,credentials:t,region:r,service:n,sha256:s,uriEscapePath:i=!0}){this.service=n,this.sha256=s,this.uriEscapePath=i,this.applyChecksum="boolean"!=typeof e||e,this.regionProvider=I(r),this.credentialProvider=I(t)}createCanonicalRequest(e,t,r){const n=Object.keys(t).sort();return`${e.method}\n${this.getCanonicalPath(e)}\n${(({query:e={}})=>{const t=[],r={};for(const n of Object.keys(e)){if(n.toLowerCase()===Ht)continue;const s=re(n);t.push(s);const i=e[n];"string"==typeof i?r[s]=`${s}=${re(i)}`:Array.isArray(i)&&(r[s]=i.slice(0).reduce((e,t)=>e.concat([`${s}=${re(t)}`]),[]).sort().join("&"))}return t.sort().map(e=>r[e]).filter(e=>e).join("&")})(e)}\n${n.map(e=>`${e}:${t[e]}`).join("\n")}\n\n${n.join(";")}\n${r}`}async createStringToSign(e,t,r,n){const s=new this.sha256;s.update(q(r));return`${n}\n${e}\n${t}\n${he(await s.digest())}`}getCanonicalPath({path:e}){if(this.uriEscapePath){const t=[];for(const n of e.split("/"))0!==n?.length&&"."!==n&&(".."===n?t.pop():t.push(n));const r=`${e?.startsWith("/")?"/":""}${t.join("/")}${t.length>0&&e?.endsWith("/")?"/":""}`;return re(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,lr(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 pr extends hr{headerFormatter=new sr;constructor({applyChecksum:e,credentials:t,region:r,service:n,sha256:s,uriEscapePath:i=!0}){super({applyChecksum:e,credentials:t,region:r,service:n,sha256:s,uriEscapePath:i})}async presign(e,t={}){const{signingDate:r=/* @__PURE__ */new Date,expiresIn:n=3600,unsignableHeaders:s,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:p,shortDate:f}=this.formatDate(r);if(n>604800)return Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future");const m=Qt(f,h,d??this.service),g=((e,t={})=>{const{headers:r,query:n={}}=o.clone(e);for(const s of Object.keys(r)){const e=s.toLowerCase();("x-amz-"===e.slice(0,6)&&!t.unhoistableHeaders?.has(e)||t.hoistableHeaders?.has(e))&&(n[s]=r[s],delete r[s])}return{...e,headers:r,query:n}})(dr(e),{unhoistableHeaders:i,hoistableHeaders:c});l.sessionToken&&(g.query[_t]=l.sessionToken),g.query["X-Amz-Algorithm"]=Zt,g.query["X-Amz-Credential"]=`${l.accessKeyId}/${m}`,g.query[Dt]=p,g.query["X-Amz-Expires"]=n.toString(10);const y=tr(g,s,a);return g.query["X-Amz-SignedHeaders"]=this.getCanonicalHeaderList(y),g.query[Lt]=await this.getSignature(p,m,this.getSigningKey(l,h,f,d),this.createCanonicalRequest(g,y,await nr(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:n,signingRegion:s,signingService:i}){const o=s??await this.regionProvider(),{shortDate:a,longDate:c}=this.formatDate(r),u=Qt(a,o,i??this.service),d=await nr({headers:{},body:t},this.sha256),l=new this.sha256;l.update(e);const h=he(await l.digest()),p=[Gt,c,u,n,h,d].join("\n");return this.signString(p,{signingDate:r,signingRegion:o,signingService:i})}async signMessage(e,{signingDate:t=/* @__PURE__ */new Date,signingRegion:r,signingService:n}){return this.signEvent({headers:this.headerFormatter.format(e.message.headers),payload:e.message.body},{signingDate:t,signingRegion:r,signingService:n,priorSignature:e.priorSignature}).then(t=>({message:e.message,signature:t}))}async signString(e,{signingDate:t=/* @__PURE__ */new Date,signingRegion:r,signingService:n}={}){const s=await this.credentialProvider();this.validateResolvedCredentials(s);const i=r??await this.regionProvider(),{shortDate:o}=this.formatDate(t),a=new this.sha256(await this.getSigningKey(s,i,o,n));return a.update(q(e)),he(await a.digest())}async signRequest(e,{signingDate:t=/* @__PURE__ */new Date,signableHeaders:r,unsignableHeaders:n,signingRegion:s,signingService:i}={}){const o=await this.credentialProvider();this.validateResolvedCredentials(o);const a=s??await this.regionProvider(),c=dr(e),{longDate:u,shortDate:d}=this.formatDate(t),l=Qt(d,a,i??this.service);c.headers[zt]=u,o.sessionToken&&(c.headers[Ft]=o.sessionToken);const h=await nr(c,this.sha256);!((e,t)=>{e=e.toLowerCase();for(const r of Object.keys(t))if(e===r.toLowerCase())return!0;return!1})(qt,c.headers)&&this.applyChecksum&&(c.headers[qt]=h);const p=tr(c,n,r),f=await this.getSignature(u,l,this.getSigningKey(o,a,d,i),this.createCanonicalRequest(c,p,h));return c.headers[Bt]=`${Zt} Credential=${o.accessKeyId}/${l}, SignedHeaders=${this.getCanonicalHeaderList(p)}, Signature=${f}`,c}async getSignature(e,t,r,n){const s=await this.createStringToSign(e,t,n,Zt),i=new this.sha256(await r);return i.update(q(s)),he(await i.digest())}getSigningKey(e,t,r,n){return(async(e,t,r,n,s)=>{const i=`${r}:${n}:${s}:${he(await er(e,t.secretAccessKey,t.accessKeyId))}:${t.sessionToken}`;if(i in Yt)return Yt[i];for(Jt.push(i);Jt.length>50;)delete Yt[Jt.shift()];let o=`AWS4${t.secretAccessKey}`;for(const a of[r,n,s,Xt])o=await er(e,o,a);return Yt[i]=o})(this.sha256,e,r,t,n||this.service)}}const fr=e=>{let t,r=e.credentials,n=!!e.credentials;Object.defineProperty(e,"credentials",{set(s){s&&s!==r&&s!==t&&(n=!0),r=s;const i=function(e,{credentials:t,credentialDefaultProvider:r}){let n;n=t?t?.memoized?t:((e,t,r)=>{if(void 0===e)return;const n="function"!=typeof e?async()=>Promise.resolve(e):e;let s,i,o,a=!1;const c=async e=>{i||(i=n(e));try{s=await i,o=!0,a=!1}finally{i=void 0}return s};return void 0===t?async e=>(o&&!e?.forceRefresh||(s=await c(e)),s):async e=>(o&&!e?.forceRefresh||(s=await c(e)),a?s:r(s)?t(s)?(await c(e),s):s:(a=!0,s))})(t,Ot,Nt):r?L(r(Object.assign({},e,{parentClientConfig:e}))):async()=>{throw new Error("@aws-sdk/core::resolveAwsSdkSigV4Config - `credentials` not provided and no credentialDefaultProvider was configured.")};return n.memoized=!0,n}(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(n&&!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:s=!0,systemClockOffset:i=e.systemClockOffset||0,sha256:o}=e;let a;a=e.signer?L(e.signer):e.regionInfoProvider?()=>L(e.region)().then(async t=>[await e.regionInfoProvider(t,{useFipsEndpoint:await e.useFipsEndpoint(),useDualstackEndpoint:await e.useDualstackEndpoint()})||{},t]).then(([t,r])=>{const{signingRegion:n,signingService:i}=t;e.signingRegion=e.signingRegion||n||r,e.signingName=e.signingName||i||e.serviceId;const a={...e,credentials:e.credentials,region:e.signingRegion,service:e.signingName,sha256:o,uriEscapePath:s};return new(e.signerConstructor||pr)(a)}):async t=>{const r=(t=Object.assign({},{name:"sigv4",signingName:e.signingName||e.defaultSigningName,signingRegion:await L(e.region)(),properties:{}},t)).signingRegion,n=t.signingName;e.signingRegion=e.signingRegion||r,e.signingName=e.signingName||n||e.serviceId;const i={...e,credentials:e.credentials,region:e.signingRegion,service:e.signingName,sha256:o,uriEscapePath:s};return new(e.signerConstructor||pr)(i)};return Object.assign(e,{systemClockOffset:i,signingEscapePath:s,signer:a})};const mr="function"==typeof TextEncoder?new TextEncoder:null,gr=e=>{if("string"==typeof e){if(mr)return mr.encode(e).byteLength;let t=e.length;for(let r=t-1;r>=0;r--){const n=e.charCodeAt(r);n>127&&n<=2047?t++:n>2047&&n<=65535&&(t+=2),n>=56320&&n<=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}`)},yr=(e,t)=>{const r=[];if(e&&r.push(e),t)for(const n of t)r.push(n);return r},wr=(e,t)=>`${e||"anonymous"}${t&&t.length>0?` (a.k.a. ${t.join(",")})`:""}`,br=()=>{let e=[],t=[],r=!1;const n=/* @__PURE__ */new Set,s=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 n=[],s=[],o={};e.forEach(e=>{const t={...e,before:[],after:[]};for(const r of yr(t.name,t.aliases))o[r]=t;n.push(t)}),t.forEach(e=>{const t={...e,before:[],after:[]};for(const r of yr(t.name,t.aliases))o[r]=t;s.push(t)}),s.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 ${wr(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=n,a.sort((e,t)=>Sr[t.step]-Sr[e.step]||vr[t.priority||"normal"]-vr[e.priority||"normal"])).map(i).reduce((e,t)=>(e.push(...t),e),[])},a={add:(t,r={})=>{const{name:s,override:i,aliases:o}=r,a={step:"initialize",priority:"normal",middleware:t,...r},c=yr(s,o);if(c.length>0){if(c.some(e=>n.has(e))){if(!i)throw new Error(`Duplicate middleware name '${wr(s,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 n=e[r];if(n.step!==a.step||a.priority!==n.priority)throw new Error(`"${wr(n.name,n.aliases)}" middleware with ${n.priority} priority in ${n.step} step cannot be overridden by "${wr(s,o)}" middleware with ${a.priority} priority in ${a.step} step.`);e.splice(r,1)}}for(const e of c)n.add(e)}e.push(a)},addRelativeTo:(e,r)=>{const{name:s,override:i,aliases:o}=r,a={middleware:e,...r},c=yr(s,o);if(c.length>0){if(c.some(e=>n.has(e))){if(!i)throw new Error(`Duplicate middleware name '${wr(s,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 n=t[r];if(n.toMiddleware!==a.toMiddleware||n.relation!==a.relation)throw new Error(`"${wr(n.name,n.aliases)}" middleware ${n.relation} "${n.toMiddleware}" middleware cannot be overridden by "${wr(s,o)}" middleware ${a.relation} "${a.toMiddleware}" middleware.`);t.splice(r,1)}}for(const e of c)n.add(e)}t.push(a)},clone:()=>s(br()),use:e=>{e.applyToStack(a)},remove:r=>"string"==typeof r?(r=>{let s=!1;const i=e=>{const t=yr(e.name,e.aliases);if(t.includes(r)){s=!0;for(const e of t)n.delete(e);return!1}return!0};return e=e.filter(i),t=t.filter(i),s})(r):(r=>{let s=!1;const i=e=>{if(e.middleware===r){s=!0;for(const t of yr(e.name,e.aliases))n.delete(t);return!1}return!0};return e=e.filter(i),t=t.filter(i),s})(r),removeByTag:r=>{let s=!1;const i=e=>{const{tags:t,name:i,aliases:o}=e;if(t&&t.includes(r)){const e=yr(i,o);for(const t of e)n.delete(t);return s=!0,!1}return!0};return e=e.filter(i),t=t.filter(i),s},concat:e=>{const t=s(br());return t.use(e),t.identifyOnResolve(r||t.identifyOnResolve()||(e.identifyOnResolve?.()??!1)),t},applyToStack:s,identify:()=>o(!0).map(e=>{const t=e.step??e.relation+" "+e.toMiddleware;return wr(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},Sr={initialize:5,serialize:4,build:3,finalizeRequest:2,deserialize:1},vr={high:3,normal:2,low:1};class Er{config;middlewareStack=br();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 n="function"!=typeof t?t:void 0,s="function"==typeof t?t:r;let i;if(void 0===n&&!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,n),t.set(e.constructor,i))}else delete this.handlers,i=e.resolveMiddleware(this.middlewareStack,this.config,n);if(!s)return i(e).then(e=>e.output);i(e).then(e=>s(null,e.output),e=>s(e)).catch(()=>{})}destroy(){this.config?.requestHandler?.destroy?.(),delete this.handlers}}const Cr="***SensitiveInformation***";function xr(e,t){if(null==t)return t;const r=Ae.of(e);if(r.getMergedTraits().sensitive)return Cr;if(r.isListSchema()){if(!!r.getValueSchema().getMergedTraits().sensitive)return Cr}else if(r.isMapSchema()){if(!!r.getKeySchema().getMergedTraits().sensitive||!!r.getValueSchema().getMergedTraits().sensitive)return Cr}else if(r.isStructSchema()&&"object"==typeof t){const e=t,n={};for(const[t,s]of r.structIterator())null!=e[t]&&(n[t]=xr(s,e[t]));return n}return t}class Ar{middlewareStack=br();schema;static classBuilder(){return new Rr}resolveMiddlewareWithContext(e,t,r,{middlewareFn:n,clientName:s,commandName:o,inputFilterSensitiveLog:a,outputFilterSensitiveLog:c,smithyContext:u,additionalContext:d,CommandCtor:l}){for(const i of n.bind(this)(l,e,t,r))this.middlewareStack.use(i);const h=e.concat(this.middlewareStack),{logger:p}=t,f={logger:p,clientName:s,commandName:o,inputFilterSensitiveLog:a,outputFilterSensitiveLog:c,[i]:{commandInstance:this,...u},...d},{requestHandler:m}=t;return h.resolve(e=>m.handle(e.request,r||{}),f)}}class Rr{_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 Ar{input;static getEndpointParameterInstructions(){return e._ep}constructor(...[t]){super(),this.input=t??{},e._init(this),this.schema=e._operationSchema}resolveMiddleware(r,n,s){const i=e._operationSchema,o=i?.[4]??i?.input,a=i?.[5]??i?.output;return this.resolveMiddlewareWithContext(r,n,s,{CommandCtor:t,middlewareFn:e._middlewareFn,clientName:e._clientName,commandName:e._commandName,inputFilterSensitiveLog:e._inputFilterSensitiveLog??(i?xr.bind(null,o):e=>e),outputFilterSensitiveLog:e._outputFilterSensitiveLog??(i?xr.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 Tr=(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},Pr=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{}}},Ir=e=>Object.assign((e=>{const t=[];for(const r in n){const s=n[r];void 0!==e[s]&&t.push({algorithmId:()=>s,checksumConstructor:()=>e[s]})}return{addChecksumAlgorithm(e){t.push(e)},checksumAlgorithms:()=>t}})(e),(e=>({setRetryStrategy(t){e.retryStrategy=t},retryStrategy:()=>e.retryStrategy}))(e)),Mr=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]=Mr(e[r]));return e};class Or{trace(){}debug(){}info(){}warn(){}error(){}}class Ur{queryCompat;constructor(e=!1){this.queryCompat=e}resolveRestContentType(e,t){const r=t.getMemberSchemas(),n=Object.values(r).find(e=>!!e.getMergedTraits().httpPayload);if(n){const t=n.getMergedTraits().mediaType;return t||(n.isStringSchema()?"text/plain":n.isBlobSchema()?"application/octet-stream":e)}if(!t.isUnitSchema()){if(Object.values(r).find(e=>{const{httpQuery:t,httpQueryParams:r,httpHeader:n,httpLabel:s,httpPrefixHeaders:i}=e.getMergedTraits();return!t&&!r&&!n&&!s&&void 0===i}))return e}}async getErrorSchemaOrThrowBaseException(e,t,r,n,s,i){let o=t,a=e;e.includes("#")&&([o,a]=e.split("#"));const c={$metadata:s,$fault:r.statusCode<500?"client":"server"},u=Pe.for(o);try{return{errorSchema:i?.(u,a)??u.getSchema(e),errorMetadata:c}}catch(d){n.message=n.message??n.Message??"UnknownError";const e=Pe.for("smithy.ts.sdk.synthetic."+o),t=e.getBaseException();if(t){const r=e.getErrorCtor(t)??Error;throw this.decorateServiceException(Object.assign(new r({name:a}),c),n)}throw this.decorateServiceException(Object.assign(new Error(a),c),n)}}decorateServiceException(e,t={}){if(this.queryCompat){const r=e.Message??t.Message,n=Tr(e,t);r&&(n.message=r),n.Error={...n.Error,Type:n.Error.Type,Code:n.Error.Code,Message:n.Error.message??n.Error.Message??r};const s=n.$metadata.requestId;return s&&(n.RequestId=s),n}return Tr(e,t)}setQueryCompatError(e,t){const r=t.headers?.["x-amzn-query-error"];if(void 0!==e&&null!=r){const[t,n]=r.split(";"),s=Object.entries(e),i={Code:t,Type:n};Object.assign(e,i);for(const[e,r]of s)i["message"===e?"Message":e]=r;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=>Ae.of(e).getMergedTraits().awsQueryError?.[0]===t)}}}class Nr{serdeContext;setSerdeContext(e){this.serdeContext=e}}class $r{from;to;keys;constructor(e,t){this.from=e,this.to=t,this.keys=new Set(Object.keys(this.from).filter(e=>"__type"!==e))}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]}}}function Dr(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}class Lr{value;constructor(e){this.value=e}toString(){return(""+this.value).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&apos;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\r/g,"&#x0D;").replace(/\n/g,"&#x0A;").replace(/\u0085/g,"&#x85;").replace(/\u2028/,"&#x2028;")}}class _r{name;children;attributes={};static of(e,t,r){const n=new _r(e);return void 0!==t&&n.addChildNode(new Lr(t)),void 0!==r&&n.withName(r),n}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 n=_r.of(t,e[t]).withName(r);this.c(n)}}l(e,t,r,n){if(null!=e[t]){n().map(e=>{e.withName(r),this.c(e)})}}lc(e,t,r,n){if(null!=e[t]){const e=n(),t=new _r(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 n of Object.keys(r)){const e=r[n];null!=e&&(t+=` ${n}="${Dr(""+e)}"`)}return t+(e?`>${this.children.map(e=>e.toString()).join("")}</${this.name}>`:"/>")}}let Br;class zr extends Nr{settings;stringDeserializer;constructor(e){super(),this.settings=e,this.stringDeserializer=new kt(e)}setSerdeContext(e){this.serdeContext=e,this.stringDeserializer.setSerdeContext(e)}read(e,t,r){const n=Ae.of(e),s=n.getMemberSchemas();if(n.isStructSchema()&&n.isMemberSchema()&&!!Object.values(s).find(e=>!!e.getMemberTraits().eventPayload)){const e={},r=Object.keys(s)[0];return s[r].isBlobSchema()?e[r]=t:e[r]=this.read(s[r],t),e}const i=(this.serdeContext?.utf8Encoder??F)(t),o=this.parseXml(i);return this.readSchema(e,r?o[r]:o)}readSchema(e,t){const r=Ae.of(e);if(r.isUnitSchema())return;const n=r.getMergedTraits();if(r.isListSchema()&&!Array.isArray(t))return this.readSchema(r,[t]);if(null==t)return t;if("object"==typeof t){const e=!!n.sparse,s=!!n.xmlFlattened;if(r.isListSchema()){const n=r.getValueSchema(),i=[],o=n.getMergedTraits().xmlName??"member",a=s?t:(t[0]??t)[o],c=Array.isArray(a)?a:[a];for(const t of c)(null!=t||e)&&i.push(this.readSchema(n,t));return i}const i={};if(r.isMapSchema()){const n=r.getKeySchema(),o=r.getValueSchema();let a;a=s?Array.isArray(t)?t:[t]:Array.isArray(t.entry)?t.entry:[t.entry];const c=n.getMergedTraits().xmlName??"key",u=o.getMergedTraits().xmlName??"value";for(const t of a){const r=t[c],n=t[u];(null!=n||e)&&(i[r]=this.readSchema(o,n))}return i}if(r.isStructSchema()){const e=r.isUnionSchema();let n;e&&(n=new $r(t,i));for(const[s,o]of r.structIterator()){const r=o.getMergedTraits(),a=r.httpPayload?r.xmlName??o.getName():o.getMemberTraits().xmlName??s;e&&n.mark(a),null!=t[a]&&(i[s]=this.readSchema(o,t[a]))}return e&&n.writeUnknown(),i}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){Br||(Br=new DOMParser);const t=Br.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 n={},s=Array.from(t.attributes);for(const e of s)n[`${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===s.length&&"#text"===t)return o;n[t]?Array.isArray(n[t])?n[t].push(o):n[t]=[n[t],o]:n[t]=o}else if(1===i.length&&0===s.length)return t.textContent}return n}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 n="#text",s=Object.keys(r)[0],i=r[s];return i[n]&&(i[s]=i[n],delete i[n]),Mr(i)}return{}}}class jr extends Nr{settings;stringBuffer;byteBuffer;buffer;constructor(e){super(),this.settings=e}write(e,t){const r=Ae.of(e);if(r.isStringSchema()&&"string"==typeof t)this.stringBuffer=t;else if(r.isBlobSchema())this.byteBuffer="byteLength"in t?t:(this.serdeContext?.base64Decoder??j)(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 n=e.getMergedTraits(),s=e.isMemberSchema()&&!n.httpPayload?e.getMemberTraits().xmlName??e.getMemberName():n.xmlName??e.getName();if(!s||!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=_r.of(s),[o,a]=this.getXmlnsAttribute(e,r);for(const[u,d]of function*(e,t){if(e.isUnitSchema())return;const r=e.getSchema();for(let n=0;n<r[4].length;++n){const e=r[4][n],s=r[5][n],i=new Ae([s,0],e);(e in t||i.isIdempotencyToken())&&(yield[e,i])}}(e,t)){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=_r.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,n=_r.of(e);if("string"!=typeof r){if(!(t instanceof _r||t instanceof Lr))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,n,a),i.addChildNode(n)}return a&&i.addAttribute(o,a),i}writeList(e,t,r,n){if(!e.isMemberSchema())throw new Error(`@aws-sdk/core/protocols - xml serializer, cannot write non-member list: ${e.getName(!0)}`);const s=e.getMergedTraits(),i=e.getValueSchema(),o=i.getMergedTraits(),a=!!o.sparse,c=!!s.xmlFlattened,[u,d]=this.getXmlnsAttribute(e,n),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 n=this.writeStruct(i,r,d);t.addChildNode(n.withName(c?s.xmlName??e.getMemberName():o.xmlName??"member"))}else{const n=_r.of(c?s.xmlName??e.getMemberName():o.xmlName??"member");this.writeSimpleInto(i,r,n,d),t.addChildNode(n)}};if(c)for(const h of t)(a||null!=h)&&l(r,h);else{const n=_r.of(s.xmlName??e.getMemberName());d&&n.addAttribute(u,d);for(const e of t)(a||null!=e)&&l(n,e);r.addChildNode(n)}}writeMap(e,t,r,n,s=!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,[p,f]=this.getXmlnsAttribute(e,n),m=(e,t,r)=>{const n=_r.of(a,t),[s,i]=this.getXmlnsAttribute(o,f);i&&n.addAttribute(s,i),e.addChildNode(n);let u=_r.of(d);c.isListSchema()?this.writeList(c,r,u,f):c.isMapSchema()?this.writeMap(c,r,u,f,!0):c.isStructSchema()?u=this.writeStruct(c,r,f):this.writeSimpleInto(c,r,u,f),e.addChildNode(u)};if(h){for(const[g,y]of Object.entries(t))if(l||null!=y){const t=_r.of(i.xmlName??e.getMemberName());m(t,g,y),r.addChildNode(t)}}else{let n;s||(n=_r.of(i.xmlName??e.getMemberName()),f&&n.addAttribute(p,f),r.addChildNode(n));for(const[e,i]of Object.entries(t))if(l||null!=i){const t=_r.of("entry");m(t,e,i),(s?r:n).addChildNode(t)}}}writeSimple(e,t){if(null===t)throw new Error("@aws-sdk/core/protocols - (XML serializer) cannot write null value.");const r=Ae.of(e);let n=null;if(t&&"object"==typeof t)if(r.isBlobSchema())n=(this.serdeContext?.base64Encoder??K)(t);else{if(!(r.isTimestampSchema()&&t instanceof Date)){if(r.isBigDecimalSchema()&&t)return t instanceof Et?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(Rt(r,this.settings)){case 5:n=t.toISOString().replace(".000Z","Z");break;case 6:n=qe(t);break;case 7:n=String(t.getTime()/1e3);break;default:console.warn("Missing timestamp format, using http date",t),n=qe(t)}}if((r.isBooleanSchema()||r.isNumericSchema()||r.isBigIntegerSchema()||r.isBigDecimalSchema())&&(n=String(t)),r.isStringSchema()&&(n=void 0===t&&r.isIdempotencyToken()?it():String(t)),null===n)throw new Error(`Unhandled schema-value pair ${r.getName(!0)}=${t}`);return n}writeSimpleInto(e,t,r,n){const s=this.writeSimple(e,t),i=Ae.of(e),o=new Lr(s),[a,c]=this.getXmlnsAttribute(i,n);c&&r.addAttribute(a,c),r.addChildNode(o)}getXmlnsAttribute(e,t){const r=e.getMergedTraits(),[n,s]=r.xmlNamespace??[];return s&&s!==t?[n?`xmlns:${n}`:"xmlns",s]:[void 0,void 0]}}class Hr extends Nr{settings;constructor(e){super(),this.settings=e}createSerializer(){const e=new jr(this.settings);return e.setSerdeContext(this.serdeContext),e}createDeserializer(){const e=new zr(this.settings);return e.setSerdeContext(this.serdeContext),e}}class qr extends At{codec;serializer;deserializer;mixin=new Ur;constructor(e){super(e);const t={timestampFormat:{useTrait:!0,default:5},httpBindings:!0,xmlNamespace:e.xmlNamespace,serviceNamespace:e.defaultNamespace};this.codec=new Hr(t),this.serializer=new It(this.codec.createSerializer(),t),this.deserializer=new Tt(this.codec.createDeserializer(),t)}getPayloadCodec(){return this.codec}getShapeId(){return"aws.protocols#restXml"}async serializeRequest(e,t,r){const n=await super.serializeRequest(e,t,r),s=Ae.of(e.input);if(!n.headers["content-type"]){const e=this.mixin.resolveRestContentType(this.getDefaultContentType(),s);e&&(n.headers["content-type"]=e)}return"string"!=typeof n.body||n.headers["content-type"]!==this.getDefaultContentType()||n.body.startsWith("<?xml ")||this.hasUnstructuredPayloadBinding(s)||(n.body='<?xml version="1.0" encoding="UTF-8"?>'+n.body),n}async deserializeResponse(e,t,r){return super.deserializeResponse(e,t,r)}async handleError(e,t,r,n,s){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,n)??"Unknown",{errorSchema:o,errorMetadata:a}=await this.mixin.getErrorSchemaOrThrowBaseException(i,this.options.defaultNamespace,r,n,s),c=Ae.of(o),u=n.Error?.message??n.Error?.Message??n.message??n.Message??"Unknown",d=new(Pe.for(o[1]).getErrorCtor(o)??Error)(u);await this.deserializeHttpMessage(o,t,r,n);const l={};for(const[h,p]of c.structIterator()){const e=p.getMergedTraits().xmlName??h,t=n.Error?.[e]??n[e];l[h]=this.codec.createDeserializer().readSchema(p,t)}throw this.mixin.decorateServiceException(Object.assign(d,a,{$fault:c.getMergedTraits().error,message:u},l),n)}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}}const Fr=[g.CRC32,g.CRC32C,g.CRC64NVME,g.SHA1,g.SHA256],Kr=[g.SHA256,g.SHA1,g.CRC32,g.CRC32C,g.CRC64NVME],Vr=e=>e===g.MD5?"content-md5":`x-amz-checksum-${e.toLowerCase()}`,Wr=e=>void 0!==e&&"string"!=typeof e&&!ArrayBuffer.isView(e)&&!rr(e);function Zr(e,t,r,n){return new(r||(r=Promise))(function(s,i){function o(e){try{c(n.next(e))}catch(t){i(t)}}function a(e){try{c(n.throw(e))}catch(t){i(t)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(o,a)}c((n=n.apply(e,t||[])).next())})}function Gr(e,t){var r,n,s,i={label:0,sent:function(){if(1&s[0])throw s[1];return s[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,n&&(s=2&a[0]?n.return:a[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,a[1])).done)return s;switch(n=0,s&&(a=[2&a[0],s.value]),a[0]){case 0:case 1:s=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,n=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(s=i.trys,(s=s.length>0&&s[s.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!s||a[1]>s[0]&&a[1]<s[3])){i.label=a[1];break}if(6===a[0]&&i.label<s[1]){i.label=s[1],s=a;break}if(s&&i.label<s[2]){i.label=s[2],i.ops.push(a);break}s[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(c){a=[6,c],n=0}finally{r=s=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}function Xr(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}"function"==typeof SuppressedError&&SuppressedError;const Yr=e=>(new TextEncoder).encode(e);var Jr="undefined"!=typeof Buffer&&Buffer.from?function(e){return Buffer.from(e,"utf8")}:Yr;function Qr(e){return e instanceof Uint8Array?e:"string"==typeof e?Jr(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e)}function en(e){return"string"==typeof e?0===e.length:0===e.byteLength}function tn(e){return new Uint8Array([(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e])}function rn(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 nn=function(){function e(){this.crc32c=new sn}return e.prototype.update=function(e){en(e)||this.crc32c.update(Qr(e))},e.prototype.digest=function(){return Zr(this,void 0,void 0,function(){return Gr(this,function(e){return[2,tn(this.crc32c.digest())]})})},e.prototype.reset=function(){this.crc32c=new sn},e}(),sn=function(){function e(){this.checksum=4294967295}return e.prototype.update=function(e){var t,r;try{for(var n=Xr(e),s=n.next();!s.done;s=n.next()){var i=s.value;this.checksum=this.checksum>>>8^on[255&(this.checksum^i)]}}catch(o){t={error:o}}finally{try{s&&!s.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}return this},e.prototype.digest=function(){return(4294967295^this.checksum)>>>0},e}(),on=rn([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 an,cn,un,dn,ln,hn,pn,fn,mn;const gn=()=>{an||(an=(()=>{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 n=BigInt(e);for(let e=0;e<8*(t+1);e++)1n&n?n=n>>1n^0x9a6c9329ac4bc9b5n:n>>=1n;r[2*e]=Number(n>>32n&0xffffffffn),r[2*e+1]=Number(0xffffffffn&n)}e[t]=new Uint32Array(r)}return e})(),[cn,un,dn,ln,hn,pn,fn,mn]=an)};class yn{c1=0;c2=0;constructor(){gn(),this.reset()}update(e){const t=e.length;let r=0,n=this.c1,s=this.c2;for(;r+8<=t;){const t=(255&(s^e[r++]))<<1,i=(255&(s>>>8^e[r++]))<<1,o=(255&(s>>>16^e[r++]))<<1,a=(255&(s>>>24^e[r++]))<<1,c=(255&(n^e[r++]))<<1,u=(255&(n>>>8^e[r++]))<<1,d=(255&(n>>>16^e[r++]))<<1,l=(255&(n>>>24^e[r++]))<<1;n=mn[t]^fn[i]^pn[o]^hn[a]^ln[c]^dn[u]^un[d]^cn[l],s=mn[t+1]^fn[i+1]^pn[o+1]^hn[a+1]^ln[c+1]^dn[u+1]^un[d+1]^cn[l+1]}for(;r<t;){const t=(255&(s^e[r]))<<1;s=(s>>>8|(255&n)<<24)>>>0,n=n>>>8^cn[t],s^=cn[t+1],r++}this.c1=n,this.c2=s}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 wn=function(){function e(){this.crc32=new bn}return e.prototype.update=function(e){en(e)||this.crc32.update(Qr(e))},e.prototype.digest=function(){return Zr(this,void 0,void 0,function(){return Gr(this,function(e){return[2,tn(this.crc32.digest())]})})},e.prototype.reset=function(){this.crc32=new bn},e}(),bn=function(){function e(){this.checksum=4294967295}return e.prototype.update=function(e){var t,r;try{for(var n=Xr(e),s=n.next();!s.done;s=n.next()){var i=s.value;this.checksum=this.checksum>>>8^Sn[255&(this.checksum^i)]}}catch(o){t={error:o}}finally{try{s&&!s.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}return this},e.prototype.digest=function(){return(4294967295^this.checksum)>>>0},e}(),Sn=rn([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 vn=(e,t)=>{switch(e){case g.MD5:return t.md5;case g.CRC32:return wn;case g.CRC32C:return nn;case g.CRC64NVME:return yn;case g.SHA1:return t.sha1;case g.SHA256:return t.sha256;default:throw new Error(`Unsupported checksum algorithm: ${e}`)}},En=(e,t)=>{const r=new e;return r.update(q(t||"")),r.digest()},Cn={name:"flexibleChecksumsMiddleware",step:"build",tags:["BODY_CHECKSUM"],override:!0},xn=(e,t)=>(r,n)=>async s=>{if(!o.isInstance(s.request))return r(s);if(((e,t)=>{const r=e.toLowerCase();for(const n of Object.keys(t))if(n.toLowerCase().startsWith(r))return!0;return!1})("x-amz-checksum-",s.request.headers))return r(s);const{request:i,input:a}=s,{body:c,headers:u}=i,{base64Encoder:l,streamHasher:h}=e,{requestChecksumRequired:p,requestAlgorithmMember:f}=t,m=await e.requestChecksumCalculation(),y=f?.name,w=f?.httpHeader;y&&!a[y]&&(m===d||p)&&(a[y]=S,w&&(u[w]=S));const b=((e,{requestChecksumRequired:t,requestAlgorithmMember:r,requestChecksumCalculation:n})=>{if(!r)return n===d||t?S:void 0;if(!e[r])return;const s=e[r];if(!Fr.includes(s))throw new Error(`The checksum algorithm "${s}" is not supported by the client. Select one of ${Fr}.`);return s})(a,{requestChecksumRequired:p,requestAlgorithmMember:f?.name,requestChecksumCalculation:m});let E=c,C=u;if(b){switch(b){case g.CRC32:v(n,"FLEXIBLE_CHECKSUMS_REQ_CRC32","U");break;case g.CRC32C:v(n,"FLEXIBLE_CHECKSUMS_REQ_CRC32C","V");break;case g.CRC64NVME:v(n,"FLEXIBLE_CHECKSUMS_REQ_CRC64","W");break;case g.SHA1:v(n,"FLEXIBLE_CHECKSUMS_REQ_SHA1","X");break;case g.SHA256:v(n,"FLEXIBLE_CHECKSUMS_REQ_SHA256","Y")}const t=Vr(b),r=vn(b,e);if(Wr(c)){const{getAwsChunkedEncodingStream:s,bodyLengthChecker:i}=e;E=s("number"==typeof e.requestStreamBufferSize&&e.requestStreamBufferSize>=8192?J(c,e.requestStreamBufferSize,n.logger):c,{base64Encoder:l,bodyLengthChecker:i,checksumLocationName:t,checksumAlgorithmFn:r,streamHasher:h}),C={...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 C["content-length"]}else if(!((e,t)=>{const r=e.toLowerCase();for(const n of Object.keys(t))if(r===n.toLowerCase())return!0;return!1})(t,u)){const e=await En(r,c);C={...u,[t]:l(e)}}}try{return await r({...s,request:{...i,headers:C,body:E}})}catch(x){if(x instanceof Error&&"InvalidChunkSizeError"===x.name)try{x.message.endsWith(".")||(x.message+="."),x.message+=" Set [requestStreamBufferSize=number e.g. 65_536] in client constructor to instruct AWS SDK to buffer your input stream."}catch(A){}throw x}},An={name:"flexibleChecksumsInputMiddleware",toMiddleware:"serializerMiddleware",relation:"before",tags:["BODY_CHECKSUM"],override:!0},Rn=(e=[])=>{const t=[];for(const r of Kr)e.includes(r)&&Fr.includes(r)&&t.push(r);return t},kn=async(e,{checksumAlgorithmFn:t,base64Encoder:r})=>r(await En(t,e)),Tn={name:"flexibleChecksumsResponseMiddleware",toMiddleware:"deserializerMiddleware",relation:"after",tags:["BODY_CHECKSUM"],override:!0},Pn=(e,t)=>(r,n)=>async s=>{if(!o.isInstance(s.request))return r(s);const i=s.input,a=await r(s),c=a.response,{requestValidationModeMember:u,responseAlgorithms:d}=t;if(u&&"ENABLED"===i[u]){const{clientName:t,commandName:r}=n;if("S3Client"===t&&"GetObjectCommand"===r&&Rn(d).every(e=>{const t=Vr(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:n})=>{const s=Rn(r),{body:i,headers:o}=e;for(const c of s){const r=Vr(c),s=o[r];if(s){let o;try{o=vn(c,t)}catch(a){if(c===g.CRC64NVME){n?.warn(`Skipping ${g.CRC64NVME} checksum validation: ${a.message}`);continue}throw a}const{base64Encoder:u}=t;if(Wr(i))return void(e.body=X({expectedChecksum:s,checksumSourceLocation:r,checksum:new o,source:i,base64Encoder:u}));const d=await kn(i,{checksumAlgorithmFn:o,base64Encoder:u});if(d===s)break;throw new Error(`Checksum mismatch: expected "${d}" but received "${s}" in response header "${r}".`)}}})(c,{config:e,responseAlgorithms:d,logger:n.logger})}return a},In=(e,t)=>({applyToStack:r=>{r.add(xn(e,t),Cn),r.addRelativeTo(((e,t)=>(r,n)=>async s=>{const i=s.input,{requestValidationModeMember:o}=t,a=await e.requestChecksumCalculation(),c=await e.responseChecksumValidation();switch(a){case l:v(n,"FLEXIBLE_CHECKSUMS_REQ_WHEN_REQUIRED","a");break;case d:v(n,"FLEXIBLE_CHECKSUMS_REQ_WHEN_SUPPORTED","Z")}switch(c){case f:v(n,"FLEXIBLE_CHECKSUMS_RES_WHEN_REQUIRED","c");break;case p:v(n,"FLEXIBLE_CHECKSUMS_RES_WHEN_SUPPORTED","b")}return o&&!i[o]&&c===p&&(i[o]="ENABLED"),r(s)})(e,t),An),r.addRelativeTo(Pn(e,t),Tn)}});const Mn={name:"hostHeaderMiddleware",step:"build",priority:"low",tags:["HOST"],override:!0},On=e=>({applyToStack:t=>{t.add((e=>t=>async r=>{if(!o.isInstance(r.request))return t(r);const{request:n}=r,{handlerProtocol:s=""}=e.requestHandler.metadata||{};if(s.indexOf("h2")>=0&&!n.headers[":authority"])delete n.headers.host,n.headers[":authority"]=n.hostname+(n.port?":"+n.port:"");else if(!n.headers.host){let e=n.hostname;null!=n.port&&(e+=`:${n.port}`),n.headers.host=e}return t(r)})(e),Mn)}}),Un={name:"loggerMiddleware",tags:["LOGGER"],step:"initialize",override:!0},Nn={step:"build",tags:["RECURSION_DETECTION"],name:"recursionDetectionMiddleware",override:!0,priority:"low"};const $n={step:"finalizeRequest",tags:["CHECK_CONTENT_LENGTH_HEADER"],name:"getCheckContentLengthHeaderPlugin",override:!0},Dn=e=>({applyToStack:e=>{e.add((e,t)=>async r=>{const{request:n}=r;if(o.isInstance(n)&&!("content-length"in n.headers)&&!("x-amz-decoded-content-length"in n.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 Or?console.warn(e):t.logger.warn(e)}return e({...r})},$n)}}),Ln={tags:["REGION_REDIRECT","S3"],name:"regionRedirectEndpointMiddleware",override:!0,relation:"before",toMiddleware:"endpointV2Middleware"};const _n={step:"initialize",tags:["REGION_REDIRECT","S3"],name:"regionRedirectMiddleware",override:!0},Bn=e=>({applyToStack:t=>{var r;t.add(function(e){return(t,r)=>async n=>{try{return await t(n)}catch(s){if(e.followRegionRedirects){const o=s?.$metadata?.httpStatusCode,a="HeadBucketCommand"===r.commandName,c=s?.$response?.headers?.["x-amz-bucket-region"];if(c&&(301===o||400===o&&("IllegalLocationConstraintException"===s?.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(n)}}throw s}}}(e),_n),t.addRelativeTo((r=e,(e,t)=>async n=>{const s=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(n);if(t.__s3RegionRedirect&&(o(),s!==await r.region()))throw new Error("Region was not restored following S3 region redirect.");return i}catch(a){throw o(),a}}),Ln)}}),zn=e=>(e,t)=>async r=>{const n=await e(r),{response:s}=n;if(a.isInstance(s)&&s.headers.expires){s.headers.expiresstring=s.headers.expires;try{(e=>{if(null==e)return;if("string"!=typeof e)throw new TypeError("RFC-7231 date-times must be expressed as strings");let t=Fe.exec(e);if(t){const[e,r,n,s,i,o,a,c]=t;return We(_e(rt(s)),Xe(n),et(r,"day",1,31),{hours:i,minutes:o,seconds:a,fractionalMilliseconds:c})}if(t=Ke.exec(e),t){const[e,r,n,s,i,o,a,c]=t;return Ge(We(Ze(s),Xe(n),et(r,"day",1,31),{hours:i,minutes:o,seconds:a,fractionalMilliseconds:c}))}if(t=Ve.exec(e),t){const[e,r,n,s,i,o,a,c]=t;return We(_e(rt(c)),Xe(r),et(n.trimLeft(),"day",1,31),{hours:s,minutes:i,seconds:o,fractionalMilliseconds:a})}throw new TypeError("Invalid RFC-7231 date-time value")})(s.headers.expires)}catch(i){t.logger?.warn(`AWS SDK Warning for ${t.clientName}::${t.commandName} response parsing (${s.headers.expires}): ${i}`),delete s.headers.expires}}return n},jn={tags:["S3"],name:"s3ExpiresMiddleware",override:!0,relation:"after",toMiddleware:"deserializerMiddleware"};class Hn{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+Hn.EXPIRED_CREDENTIAL_PURGE_INTERVAL_MS>e))for(const t in this.data){const r=this.data[t];if(!r.isRefreshing){const n=await r.identity;n.expiration&&n.expiration.getTime()<e&&delete this.data[t]}}}}class qn{_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 Fn{createSessionFn;cache;static REFRESH_WINDOW_MS=6e4;constructor(e,t=new Hn){this.createSessionFn=e,this.cache=t}async getS3ExpressIdentity(e,t){const r=t.Bucket,{cache:n}=this,s=n.get(r);return s?s.identity.then(e=>{if((e.expiration?.getTime()??0)<Date.now())return n.set(r,new qn(this.getIdentity(r))).identity;return(e.expiration?.getTime()??0)<Date.now()+Fn.REFRESH_WINDOW_MS&&!s.isRefreshing&&(s.isRefreshing=!0,this.getIdentity(r).then(e=>{n.set(r,new qn(Promise.resolve(e)))})),e}):n.set(r,new qn(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 Kn="X-Amz-S3session-Token",Vn=Kn.toLowerCase();class Wn extends pr{async signWithCredentials(e,t,r){const n=Zn(t);e.headers[Vn]=t.sessionToken;return Gn(this,n),this.signRequest(e,r??{})}async presignWithCredentials(e,t,r){const n=Zn(t);delete e.headers[Vn],e.headers[Kn]=t.sessionToken,e.query=e.query??{},e.query[Kn]=t.sessionToken;return Gn(this,n),this.presign(e,r)}}function Zn(e){return{accessKeyId:e.accessKeyId,secretAccessKey:e.secretAccessKey,expiration:e.expiration}}function Gn(e,t){const r=setTimeout(()=>{throw new Error("SignatureV4S3Express credential override was created but not called.")},10),n=e.credentialProvider;e.credentialProvider=()=>(clearTimeout(r),e.credentialProvider=n,Promise.resolve(t))}const Xn={name:"s3ExpressMiddleware",step:"build",tags:["S3","S3_EXPRESS"],override:!0},Yn=e=>({applyToStack:t=>{t.add((e=>(t,r)=>async n=>{if(r.endpointV2){const t=r.endpointV2,s="sigv4-s3express"===t.properties?.authSchemes?.[0]?.name;if(("S3Express"===t.properties?.backend||"Directory"===t.properties?.bucketType)&&(v(r,"S3_EXPRESS_BUCKET","J"),r.isS3ExpressBucket=!0),s){const t=n.input.Bucket;if(t){const s=await e.s3ExpressIdentityProvider.getS3ExpressIdentity(await e.credentials(),{Bucket:t});r.s3ExpressIdentity=s,o.isInstance(n.request)&&s.sessionToken&&(n.request.headers[Vn]=s.sessionToken)}}}return t(n)})(e),Xn)}}),Jn=e=>e=>{throw e},Qn=(e,t)=>{},es=e=>(t,r)=>async n=>{if(!o.isInstance(n.request))return t(n);const s=P(r).selectedHttpAuthScheme;if(!s)throw new Error("No HttpAuthScheme was selected: unable to sign request");const{httpAuthOption:{signingProperties:i={}},identity:a,signer:c}=s;let u;u=r.s3ExpressIdentity?await(async(e,t,r,n)=>{const s=await n.signWithCredentials(r,e,{});if(s.headers["X-Amz-Security-Token"]||s.headers["x-amz-security-token"])throw new Error("X-Amz-Security-Token must not be set for s3-express requests.");return s})(r.s3ExpressIdentity,0,n.request,await e.signer()):await c.sign(n.request,a,i);const d=await t({...n,request:u}).catch((c.errorHandler||Jn)(i));return(c.successHandler||Qn)(d.response,i),d},ts={CopyObjectCommand:!0,UploadPartCopyCommand:!0,CompleteMultipartUploadCommand:!0},rs=e=>(t,r)=>async n=>{const s=await t(n),{response:i}=s;if(!a.isInstance(i))return s;const{statusCode:o,body:c}=i;if(o<200||o>=300)return s;if(!("function"==typeof c?.stream||"function"==typeof c?.pipe||"function"==typeof c?.tee))return s;let u=c,d=c;!c||"object"!=typeof c||c instanceof Uint8Array||([u,d]=await async function(e){return"function"==typeof e.stream&&(e=e.stream()),e.tee()}(c)),i.body=d;const l=await ns(u,{streamCollector:async e=>async function(e,t){let r=0;const n=[],s=e.getReader();let i=!1;for(;!i;){const{done:e,value:o}=await s.read();if(o&&(n.push(o),r+=o?.byteLength??0),r>=t)break;i=e}s.releaseLock();const o=new Uint8Array(Math.min(t,r));let a=0;for(const c of n){if(c.byteLength>o.byteLength-a){o.set(c.subarray(0,o.byteLength-a),a);break}o.set(c,a),a+=c.length}return o}(e,3e3)});"function"==typeof u?.destroy&&u.destroy();const h=e.utf8Encoder(l.subarray(l.length-16));if(0===l.length&&ts[r.commandName]){const e=new Error("S3 aborted request");throw e.name="InternalError",e}return h&&h.endsWith("</Error>")&&(i.statusCode=400),s},ns=(e=new Uint8Array,t)=>e instanceof Uint8Array?Promise.resolve(e):t.streamCollector(e)||Promise.resolve(new Uint8Array),ss={relation:"after",toMiddleware:"deserializerMiddleware",tags:["THROW_200_EXCEPTIONS","S3"],name:"throw200ExceptionsMiddleware",override:!0},is=e=>({applyToStack:t=>{t.addRelativeTo(rs(e),ss)}});const os={name:"bucketEndpointMiddleware",override:!0,relation:"after",toMiddleware:"endpointV2Middleware"};const as={step:"initialize",tags:["VALIDATE_BUCKET_NAME"],name:"validateBucketNameMiddleware",override:!0},cs=e=>({applyToStack:t=>{t.add(function({bucketEndpoint:e}){return t=>async r=>{const{input:{Bucket:n}}=r;if(!e&&"string"==typeof n&&!("string"==typeof(s=n)&&0===s.indexOf("arn:")&&s.split(":").length>=6)&&n.indexOf("/")>=0){const e=new Error(`Bucket name shouldn't contain '/', received '${n}'`);throw e.name="InvalidBucketName",e}var s;return t({...r})}}(e),as),t.addRelativeTo(function(e){return(t,r)=>async n=>{if(e.bucketEndpoint){const e=r.endpointV2;if(e){const t=n.input.Bucket;if("string"==typeof t)try{const n=new URL(t);r.endpointV2={...e,url:n}}catch(s){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),s}}}return t(n)}}(e),os)}});const us=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}$"),ds=e=>us.test(e)||e.startsWith("[")&&e.endsWith("]"),ls=new RegExp("^(?!.*-$)(?!-)[a-zA-Z0-9-]{1,63}$"),hs=(e,t=!1)=>{if(!t)return ls.test(e);const r=e.split(".");for(const n of r)if(!hs(n))return!1;return!0},ps={},fs="endpoints";function ms(e){return"object"!=typeof e||null==e?e:"ref"in e?`$${ms(e.ref)}`:"fn"in e?`${e.fn}(${(e.argv||[]).map(ms).join(", ")})`:JSON.stringify(e,null,2)}class gs extends Error{constructor(e){super(e),this.name="EndpointError"}}const ys=(e,t)=>(e=>{const t=e.split("."),r=[];for(const n of t){const t=n.indexOf("[");if(-1!==t){if(n.indexOf("]")!==n.length-1)throw new gs(`Path: '${e}' does not end with ']'`);const s=n.slice(t+1,-1);if(Number.isNaN(parseInt(s)))throw new gs(`Invalid array index: '${s}' in path: '${e}'`);0!==t&&r.push(n.slice(0,t)),r.push(s)}else r.push(n)}return r})(t).reduce((r,n)=>{if("object"!=typeof r)throw new gs(`Index '${n}' in '${t}' not found in '${JSON.stringify(e)}'`);return Array.isArray(r)?r[parseInt(n)]:r[n]},e),ws={[t.HTTP]:80,[t.HTTPS]:443},bs={booleanEquals:(e,t)=>e===t,getAttr:ys,isSet:e=>null!=e,isValidHostLabel:hs,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:n="",path:s="",query:i={}}=e,o=new URL(`${n}//${t}${r?`:${r}`:""}${s}`);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 n=r.href,{host:s,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=ds(i);return{scheme:u,authority:`${s}${n.includes(`${s}:${ws[u]}`)||"string"==typeof e&&e.includes(`${s}:${ws[u]}`)?`:${ws[u]}`:""}`,path:o,normalizedPath:o.endsWith("/")?o:`${o}/`,isIp:d}},stringEquals:(e,t)=>e===t,substring:(e,t,r,n)=>t>=r||e.length<r?null:n?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()}`)},Ss=(e,t)=>{const r=[],n={...t.endpointParams,...t.referenceRecord};let s=0;for(;s<e.length;){const t=e.indexOf("{",s);if(-1===t){r.push(e.slice(s));break}r.push(e.slice(s,t));const i=e.indexOf("}",t);if(-1===i){r.push(e.slice(t));break}"{"===e[t+1]&&"}"===e[i+1]&&(r.push(e.slice(t+1,i)),s=i+2);const o=e.substring(t+1,i);if(o.includes("#")){const[e,t]=o.split("#");r.push(ys(n[e],t))}else r.push(n[o]);s=i+1}return r.join("")},vs=(e,t,r)=>{if("string"==typeof e)return Ss(e,r);if(e.fn)return Cs.callFunction(e,r);if(e.ref)return(({ref:e},t)=>({...t.endpointParams,...t.referenceRecord}[e]))(e,r);throw new gs(`'${t}': ${String(e)} is not a string, function or reference.`)},Es=({fn:e,argv:t},r)=>{const n=t.map(e=>["boolean","number"].includes(typeof e)?e:Cs.evaluateExpression(e,"arg",r)),s=e.split(".");return s[0]in ps&&null!=s[1]?ps[s[0]][s[1]](...n):bs[e](...n)},Cs={evaluateExpression:vs,callFunction:Es},xs=({assign:e,...t},r)=>{if(e&&e in r.referenceRecord)throw new gs(`'${e}' is already defined in Reference Record.`);const n=Es(t,r);return r.logger?.debug?.(`${fs} evaluateCondition: ${ms(t)} = ${ms(n)}`),{result:""===n||!!n,...null!=e&&{toAssign:{name:e,value:n}}}},As=(e=[],t)=>{const r={};for(const n of e){const{result:e,toAssign:s}=xs(n,{...t,referenceRecord:{...t.referenceRecord,...r}});if(!e)return{result:e};s&&(r[s.name]=s.value,t.logger?.debug?.(`${fs} assign: ${s.name} := ${ms(s.value)}`))}return{result:!0,referenceRecord:r}},Rs=(e,t)=>Object.entries(e).reduce((e,[r,n])=>({...e,[r]:n.map(e=>{const n=vs(e,"Header value entry",t);if("string"!=typeof n)throw new gs(`Header '${r}' value '${n}' is not a string`);return n})}),{}),ks=(e,t)=>Object.entries(e).reduce((e,[r,n])=>({...e,[r]:Ps.getEndpointProperty(n,t)}),{}),Ts=(e,t)=>{if(Array.isArray(e))return e.map(e=>Ts(e,t));switch(typeof e){case"string":return Ss(e,t);case"object":if(null===e)throw new gs(`Unexpected endpoint property: ${e}`);return Ps.getEndpointProperties(e,t);case"boolean":return e;default:throw new gs("Unexpected endpoint property type: "+typeof e)}},Ps={getEndpointProperty:Ts,getEndpointProperties:ks},Is=(e,t)=>{const r=vs(e,"Endpoint URL",t);if("string"==typeof r)try{return new URL(r)}catch(n){throw console.error(`Failed to construct URL with ${r}`,n),n}throw new gs("Endpoint URL must be a string, got "+typeof r)},Ms=(e,t)=>{const{conditions:r,endpoint:n}=e,{result:s,referenceRecord:i}=As(r,t);if(!s)return;const o={...t,referenceRecord:{...t.referenceRecord,...i}},{url:a,properties:c,headers:u}=n;return t.logger?.debug?.(`${fs} Resolving endpoint from template: ${ms(n)}`),{...null!=u&&{headers:Rs(u,o)},...null!=c&&{properties:ks(c,o)},url:Is(a,o)}},Os=(e,t)=>{const{conditions:r,error:n}=e,{result:s,referenceRecord:i}=As(r,t);if(s)throw new gs(vs(n,"Error",{...t,referenceRecord:{...t.referenceRecord,...i}}))},Us=(e,t)=>{for(const r of e)if("endpoint"===r.type){const e=Ms(r,t);if(e)return e}else if("error"===r.type)Os(r,t);else{if("tree"!==r.type)throw new gs(`Unknown endpoint rule: ${r}`);{const e=Ns.evaluateTreeRule(r,t);if(e)return e}}throw new gs("Rules evaluation failed")},Ns={evaluateRules:Us,evaluateTreeRule:(e,t)=>{const{conditions:r,rules:n}=e,{result:s,referenceRecord:i}=As(r,t);if(s)return Ns.evaluateRules(n,{...t,referenceRecord:{...t.referenceRecord,...i}})}},$s=(e,t=!1)=>{if(t){for(const t of e.split("."))if(!$s(t))return!1;return!0}return!!hs(e)&&(!(e.length<3||e.length>63)&&(e===e.toLowerCase()&&!ds(e)))};let Ds={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:"EU (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 Ls={isVirtualHostableS3Bucket:$s,parseArn:e=>{const t=e.split(":");if(t.length<6)return null;const[r,n,s,i,o,...a]=t;if("arn"!==r||""===n||""===s||""===a.join(":"))return null;return{partition:n,service:s,region:i,accountId:o,resourceId:a.map(e=>e.split("/")).flat()}},partition:e=>{const{partitions:t}=Ds;for(const n of t){const{regions:t,outputs:r}=n;for(const[n,s]of Object.entries(t))if(n===e)return{...r,...s}}for(const n of t){const{regionRegex:t,outputs:r}=n;if(new RegExp(t).test(e))return{...r}}const 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}}};ps.aws=Ls;const _s=e=>{if("string"==typeof e)return _s(new URL(e));const{hostname:t,pathname:r,port:n,protocol:s,search:i}=e;let o;return i&&(o=function(e){const t={};if(e=e.replace(/^\?/,""))for(const r of e.split("&")){let[e,n=null]=r.split("=");e=decodeURIComponent(e),n&&(n=decodeURIComponent(n)),e in t?Array.isArray(t[e])?t[e].push(n):t[e]=[t[e],n]:t[e]=n}return t}(i)),{hostname:t,port:n?parseInt(n):void 0,protocol:s,path:r,query:o}},Bs=/\d{12}\.ddb/;const zs="user-agent",js="x-amz-user-agent",Hs=/[^!$%&'*+\-.^_`|~\w]/g,qs=/[^!$%&'*+\-.^_`|~\w#]/g;const Fs=e=>(t,r)=>async n=>{const{request:s}=n;if(!o.isInstance(s))return t(n);const{headers:i}=s,a=r?.userAgent?.map(Ks)||[],c=(await e.defaultUserAgentProvider()).map(Ks);await async function(e,t,r){const n=r.request;if("rpc-v2-cbor"===n?.headers?.["smithy-protocol"]&&v(e,"PROTOCOL_RPC_V2_CBOR","M"),"function"==typeof t.retryStrategy){const r=await t.retryStrategy();"function"==typeof r.acquireInitialRetryToken?r.constructor?.name?.includes("Adaptive")?v(e,"RETRY_MODE_ADAPTIVE","F"):v(e,"RETRY_MODE_STANDARD","E"):v(e,"RETRY_MODE_LEGACY","D")}if("function"==typeof t.accountIdEndpointMode){const r=e.endpointV2;switch(String(r?.url?.hostname).match(Bs)&&v(e,"ACCOUNT_ID_ENDPOINT","O"),await(t.accountIdEndpointMode?.())){case"disabled":v(e,"ACCOUNT_ID_MODE_DISABLED","Q");break;case"preferred":v(e,"ACCOUNT_ID_MODE_PREFERRED","P");break;case"required":v(e,"ACCOUNT_ID_MODE_REQUIRED","R")}}const s=e.__smithy_context?.selectedHttpAuthScheme?.identity;if(s?.$source){const t=s;t.accountId&&v(e,"RESOLVED_ACCOUNT_ID","T");for(const[r,n]of Object.entries(t.$source??{}))v(e,r,n)}}(r,e,n);const u=r;c.push(`m/${function(e){let t="";for(const r in e){const n=e[r];if(!(t.length+n.length+1<=1024))break;t.length?t+=","+n:t+=n}return t}(Object.assign({},r.__smithy_context?.features,u.__aws_sdk_context?.features))}`);const d=e?.customUserAgent?.map(Ks)||[],l=await e.userAgentAppId();l&&c.push(Ks(["app",`${l}`]));const h=[].concat([...c,...a,...d]).join(" "),p=[...c.filter(e=>e.startsWith("aws-sdk-")),...d].join(" ");return"browser"!==e.runtime?(p&&(i[js]=i[js]?`${i[zs]} ${p}`:p),i[zs]=h):i[js]=h,t({...n,request:s})},Ks=e=>{const t=e[0].split("/").map(e=>e.replace(Hs,"-")).join("/"),r=e[1]?.replace(qs,"-"),n=t.indexOf("/"),s=t.substring(0,n);let i=t.substring(n+1);return"api"===s&&(i=i.toLowerCase()),[s,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}`}},"")},Vs={name:"getUserAgentMiddleware",step:"build",priority:"low",tags:["SET_USER_AGENT","USER_AGENT"],override:!0},Ws=/* @__PURE__ */new Set,Zs=e=>"string"==typeof e&&(e.startsWith("fips-")||e.endsWith("-fips")),Gs=e=>{const{region:t,useFipsEndpoint:r}=e;if(!t)throw new Error("Region is missing");return Object.assign(e,{region:async()=>{const e=(e=>Zs(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=hs)=>{if(Ws.has(e)||t(e))Ws.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!!Zs(e)||("function"!=typeof r?Promise.resolve(!!r):r())}})},Xs="content-length";const Ys={step:"build",tags:["SET_CONTENT_LENGTH","CONTENT_LENGTH"],name:"contentLengthMiddleware",override:!0},Js=e=>({applyToStack:t=>{var r;t.add((r=e.bodyLengthChecker,e=>async t=>{const n=t.request;if(o.isInstance(n)){const{body:e,headers:t}=n;if(e&&-1===Object.keys(t).map(e=>e.toLowerCase()).indexOf(Xs))try{const t=r(e);n.headers={...n.headers,[Xs]:String(t)}}catch(s){}}return e({...t,request:n})}),Ys)}}),Qs=/^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/,ei=/(\d+\.){3}\d+/,ti=/\.\./,ri=e=>Qs.test(e)&&!ei.test(e)&&!ti.test(e),ni=e=>{const[t,r,n,,,s]=e.split(":"),i="arn"===t&&e.split(":").length>=6,o=Boolean(i&&r&&n&&s);if(i&&!o)throw new Error(`Invalid ARN: ${e} was an invalid ARN.`);return o},si=(e,t,r,n=!1)=>{const s=async()=>{let s;if(n){const n=r.clientContextParams,i=n?.[e];s=i??r[e]??r[t]}else s=r[e]??r[t];return"function"==typeof s?s():s};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 s();if(e&&"object"==typeof e){if("url"in e)return e.url.href;if("hostname"in e){const{protocol:t,hostname:r,port:n,path:s}=e;return`${t}//${r}${n?":"+n:""}${s}`}}return e}:s},ii=async e=>{},oi=e=>"object"==typeof e?"url"in e?_s(e.url):e:_s(e),ai=async(e,t,r)=>{const n={},s=t?.getEndpointParameterInstructions?.()||{};for(const[i,o]of Object.entries(s))switch(o.type){case"staticContextParams":n[i]=o.value;break;case"contextParams":n[i]=e[o.name];break;case"clientContextParams":case"builtInParams":n[i]=await si(o.name,i,r,"builtInParams"!==o.type)();break;case"operationContextParams":n[i]=o.get(e);break;default:throw new Error("Unrecognized endpoint parameter instruction: "+JSON.stringify(o))}return 0===Object.keys(s).length&&Object.assign(n,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("?"))),ni(t)){if(!0===e.ForcePathStyle)throw new Error("Path-style addressing cannot be used with ARN buckets")}else(!ri(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})(n),n},ci=({config:e,instructions:t})=>(r,n)=>async s=>{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 i=await(async(e,t,r,n)=>{if(!r.isCustomEndpoint){let e;e=r.serviceConfiguredEndpoint?await r.serviceConfiguredEndpoint():await ii(r.serviceId),e&&(r.endpoint=()=>Promise.resolve(oi(e)),r.isCustomEndpoint=!0)}const s=await ai(e,t,r);if("function"!=typeof r.endpointProvider)throw new Error("config.endpointProvider is not set.");return r.endpointProvider(s,n)})(s.input,{getEndpointParameterInstructions:()=>t},{...e},n);n.endpointV2=i,n.authSchemes=i.properties?.authSchemes;const o=n.authSchemes?.[0];if(o){n.signing_region=o.signingRegion,n.signing_service=o.signingName;const e=P(n),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({...s})},ui={step:"serialize",tags:["ENDPOINT_PARAMETERS","ENDPOINT_V2","ENDPOINT"],name:"endpointV2Middleware",override:!0,relation:"before",toMiddleware:"serializerMiddleware"},di=(e,t)=>({applyToStack:r=>{r.addRelativeTo(ci({config:e,instructions:t}),ui)}});var li,hi;(hi=li||(li={})).STANDARD="standard",hi.ADAPTIVE="adaptive";const pi=li.STANDARD,fi=["BandwidthLimitExceeded","EC2ThrottledException","LimitExceededException","PriorRequestNotComplete","ProvisionedThroughputExceededException","RequestLimitExceeded","RequestThrottled","RequestThrottledException","SlowDown","ThrottledException","Throttling","ThrottlingException","TooManyRequestsException","TransactionInProgressException"],mi=["TimeoutError","RequestTimeout","RequestTimeoutException"],gi=[500,502,503,504],yi=["ECONNRESET","ECONNREFUSED","EPIPE","ETIMEDOUT"],wi=["EHOSTUNREACH","ENETUNREACH","ENOTFOUND"],bi=e=>429===e.$metadata?.httpStatusCode||fi.includes(e.name)||1==e.$retryable?.throttling,Si=(e,t=0)=>(e=>void 0!==e?.$retryable)(e)||(e=>e.$metadata?.clockSkewCorrected)(e)||mi.includes(e.name)||yi.includes(e?.code||"")||wi.includes(e?.code||"")||gi.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)||void 0!==e.cause&&t<=10&&Si(e.cause,t+1);class vi{static setTimeoutFn=setTimeout;beta;minCapacity;minFillRate;scaleConstant;smooth;currentCapacity=0;enabled=!1;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;const t=this.getCurrentTimeInSeconds();this.lastThrottleTime=t,this.lastTxRateBucket=Math.floor(this.getCurrentTimeInSeconds()),this.fillRate=this.minFillRate,this.maxCapacity=this.minCapacity}getCurrentTimeInSeconds(){return Date.now()/1e3}async getSendToken(){return this.acquireTokenBucket(1)}async acquireTokenBucket(e){if(this.enabled){if(this.refillTokenBucket(),e>this.currentCapacity){const t=(e-this.currentCapacity)/this.fillRate*1e3;await new Promise(e=>vi.setTimeoutFn(e,t))}this.currentCapacity=this.currentCapacity-e}}refillTokenBucket(){const e=this.getCurrentTimeInSeconds();if(!this.lastTimestamp)return void(this.lastTimestamp=e);const t=(e-this.lastTimestamp)*this.fillRate;this.currentCapacity=Math.min(this.maxCapacity,this.currentCapacity+t),this.lastTimestamp=e}updateClientSendingRate(e){let t;if(this.updateMeasuredRate(),bi(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 r=Math.min(t,2*this.measuredTxRate);this.updateTokenBucketRate(r)}calculateTimeWindow(){this.timeWindow=this.getPrecise(Math.pow(this.lastMaxRate*(1-this.beta)/this.scaleConstant,1/3))}cubicThrottle(e){return this.getPrecise(e*this.beta)}cubicSuccess(e){return this.getPrecise(this.scaleConstant*Math.pow(e-this.lastThrottleTime-this.timeWindow,3)+this.lastMaxRate)}enableTokenBucket(){this.enabled=!0}updateTokenBucketRate(e){this.refillTokenBucket(),this.fillRate=Math.max(e,this.minFillRate),this.maxCapacity=Math.max(e,this.minCapacity),this.currentCapacity=Math.min(this.currentCapacity,this.maxCapacity)}updateMeasuredRate(){const e=this.getCurrentTimeInSeconds(),t=Math.floor(2*e)/2;if(this.requestCount++,t>this.lastTxRateBucket){const e=this.requestCount/(t-this.lastTxRateBucket);this.measuredTxRate=this.getPrecise(e*this.smooth+this.measuredTxRate*(1-this.smooth)),this.requestCount=0,this.lastTxRateBucket=t}}getPrecise(e){return parseFloat(e.toFixed(8))}}const Ei=({retryDelay:e,retryCount:t,retryCost:r})=>({getRetryCount:()=>t,getRetryDelay:()=>Math.min(2e4,e),getRetryCost:()=>r});class Ci{maxAttempts;mode=li.STANDARD;capacity=500;retryBackoffStrategy=(()=>{let e=100;return{computeNextBackoffDelay:t=>Math.floor(Math.min(2e4,Math.random()*2**t*e)),setDelayBase:t=>{e=t}}})();maxAttemptsProvider;constructor(e){this.maxAttempts=e,this.maxAttemptsProvider="function"==typeof e?e:async()=>e}async acquireInitialRetryToken(e){return Ei({retryDelay:100,retryCount:0})}async refreshRetryTokenForRetry(e,t){const r=await this.getMaxAttempts();if(this.shouldRetry(e,t,r)){const r=t.errorType;this.retryBackoffStrategy.setDelayBase("THROTTLING"===r?500:100);const n=this.retryBackoffStrategy.computeNextBackoffDelay(e.getRetryCount()),s=t.retryAfterHint?Math.max(t.retryAfterHint.getTime()-Date.now()||0,n):n,i=this.getCapacityCost(r);return this.capacity-=i,Ei({retryDelay:s,retryCount:e.getRetryCount()+1,retryCost:i})}throw new Error("No retry token available")}recordSuccess(e){this.capacity=Math.max(500,this.capacity+(e.getRetryCost()??1))}getCapacity(){return this.capacity}async getMaxAttempts(){try{return await this.maxAttemptsProvider()}catch(e){return console.warn("Max attempts provider could not resolve. Using default of 3"),3}}shouldRetry(e,t,r){return e.getRetryCount()+1<r&&this.capacity>=this.getCapacityCost(t.errorType)&&this.isRetryableError(t.errorType)}getCapacityCost(e){return"TRANSIENT"===e?10:5}isRetryableError(e){return"THROTTLING"===e||"TRANSIENT"===e}}class xi{maxAttemptsProvider;rateLimiter;standardRetryStrategy;mode=li.ADAPTIVE;constructor(e,t){this.maxAttemptsProvider=e;const{rateLimiter:r}=t??{};this.rateLimiter=r??new vi,this.standardRetryStrategy=new Ci(e)}async acquireInitialRetryToken(e){return await this.rateLimiter.getSendToken(),this.standardRetryStrategy.acquireInitialRetryToken(e)}async refreshRetryTokenForRetry(e,t){return this.rateLimiter.updateClientSendingRate(t),this.standardRetryStrategy.refreshRetryTokenForRetry(e,t)}recordSuccess(e){this.rateLimiter.updateClientSendingRate({}),this.standardRetryStrategy.recordSuccess(e)}}const Ai=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}`),Ri=e=>e?.body instanceof ReadableStream,ki=e=>void 0!==e.acquireInitialRetryToken&&void 0!==e.refreshRetryTokenForRetry&&void 0!==e.recordSuccess,Ti=e=>{const t={error:e,errorType:Pi(e)},r=Oi(e.$response);return r&&(t.retryAfterHint=r),t},Pi=e=>bi(e)?"THROTTLING":Si(e)?"TRANSIENT":(e=>{if(void 0!==e.$metadata?.httpStatusCode){const t=e.$metadata.httpStatusCode;return 500<=t&&t<=599&&!Si(e)}return!1})(e)?"SERVER_ERROR":"CLIENT_ERROR",Ii={name:"retryMiddleware",tags:["RETRY"],step:"finalizeRequest",priority:"high",override:!0},Mi=e=>({applyToStack:t=>{t.add((e=>(t,r)=>async n=>{let s=await e.retryStrategy();const i=await e.maxAttempts();if(!ki(s))return s?.mode&&(r.userAgent=[...r.userAgent||[],["cfg/retry-mode",s.mode]]),s.retry(t,n);{let e=await s.acquireInitialRetryToken(r.partition_id),u=new Error,d=0,l=0;const{request:h}=n,p=o.isInstance(h);for(p&&(h.headers["amz-sdk-invocation-id"]=it());;)try{p&&(h.headers["amz-sdk-request"]=`attempt=${d+1}; max=${i}`);const{response:r,output:o}=await t(n);return s.recordSuccess(e),o.$metadata.attempts=d+1,o.$metadata.totalRetryDelay=l,{response:r,output:o}}catch(a){const t=Ti(a);if(u=Ai(a),p&&Ri(h))throw(r.logger instanceof Or?console:r.logger)?.warn("An error was encountered in a non-retryable streaming request."),u;try{e=await s.refreshRetryTokenForRetry(e,t)}catch(c){throw u.$metadata||(u.$metadata={}),u.$metadata.attempts=d+1,u.$metadata.totalRetryDelay=l,u}d=e.getRetryCount();const n=e.getRetryDelay();l+=n,await new Promise(e=>setTimeout(e,n))}}})(e),Ii)}}),Oi=e=>{if(!a.isInstance(e))return;const t=Object.keys(e.headers).find(e=>"retry-after"===e.toLowerCase());if(!t)return;const r=e.headers[t],n=Number(r);if(!Number.isNaN(n))return new Date(1e3*n);return new Date(r)};class Ui{sigv4aSigner;sigv4Signer;signerOptions;static sigv4aDependency(){return"none"}constructor(e){this.sigv4Signer=new Wn(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 Ni="required",$i="type",Di="rules",Li="conditions",_i="fn",Bi="argv",zi="ref",ji="assign",Hi="url",qi="properties",Fi="backend",Ki="authSchemes",Vi="disableDoubleEncoding",Wi="signingName",Zi="signingRegion",Gi="headers",Xi="signingRegionSet",Yi=!0,Ji="isSet",Qi="booleanEquals",eo="error",to="aws.partition",ro="stringEquals",no="getAttr",so="name",io="substring",oo="bucketSuffix",ao="parseURL",co="endpoint",uo="tree",lo="aws.isVirtualHostableS3Bucket",ho="{url#scheme}://{Bucket}.{url#authority}{url#path}",po="not",fo="accessPointSuffix",mo="{url#scheme}://{url#authority}{url#path}",go="hardwareType",yo="regionPrefix",wo="bucketAliasSuffix",bo="outpostId",So="isValidHostLabel",vo="sigv4a",Eo="s3-outposts",Co="s3",xo="{url#scheme}://{url#authority}{url#normalizedPath}{Bucket}",Ao="https://{Bucket}.s3-accelerate.{partitionResult#dnsSuffix}",Ro="https://{Bucket}.s3.{partitionResult#dnsSuffix}",ko="aws.parseArn",To="bucketArn",Po="arnType",Io="s3-object-lambda",Mo="accesspoint",Oo="accessPointName",Uo="{url#scheme}://{accessPointName}-{bucketArn#accountId}.{url#authority}{url#path}",No="mrapPartition",$o="outpostType",Do="arnPrefix",Lo="{url#scheme}://{url#authority}{url#normalizedPath}{uri_encoded_bucket}",_o="https://s3.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",Bo="https://s3.{partitionResult#dnsSuffix}",zo={[Ni]:!1,[$i]:"string"},jo={[Ni]:!0,default:!1,[$i]:"boolean"},Ho={[Ni]:!1,[$i]:"boolean"},qo={[_i]:Qi,[Bi]:[{[zi]:"Accelerate"},!0]},Fo={[_i]:Qi,[Bi]:[{[zi]:"UseFIPS"},!0]},Ko={[_i]:Qi,[Bi]:[{[zi]:"UseDualStack"},!0]},Vo={[_i]:Ji,[Bi]:[{[zi]:"Endpoint"}]},Wo={[_i]:to,[Bi]:[{[zi]:"Region"}],[ji]:"partitionResult"},Zo={[_i]:ro,[Bi]:[{[_i]:no,[Bi]:[{[zi]:"partitionResult"},so]},"aws-cn"]},Go={[_i]:Ji,[Bi]:[{[zi]:"Bucket"}]},Xo={[zi]:"Bucket"},Yo={[Li]:[qo],[eo]:"S3Express does not support S3 Accelerate.",[$i]:eo},Jo={[Li]:[Vo,{[_i]:ao,[Bi]:[{[zi]:"Endpoint"}],[ji]:"url"}],[Di]:[{[Li]:[{[_i]:Ji,[Bi]:[{[zi]:"DisableS3ExpressSessionAuth"}]},{[_i]:Qi,[Bi]:[{[zi]:"DisableS3ExpressSessionAuth"},!0]}],[Di]:[{[Li]:[{[_i]:Qi,[Bi]:[{[_i]:no,[Bi]:[{[zi]:"url"},"isIp"]},!0]}],[Di]:[{[Li]:[{[_i]:"uriEncode",[Bi]:[Xo],[ji]:"uri_encoded_bucket"}],[Di]:[{[co]:{[Hi]:"{url#scheme}://{url#authority}/{uri_encoded_bucket}{url#path}",[qi]:{[Fi]:"S3Express",[Ki]:[{[Vi]:!0,[so]:"sigv4",[Wi]:"s3express",[Zi]:"{Region}"}]},[Gi]:{}},[$i]:co}],[$i]:uo}],[$i]:uo},{[Li]:[{[_i]:lo,[Bi]:[Xo,!1]}],[Di]:[{[co]:{[Hi]:ho,[qi]:{[Fi]:"S3Express",[Ki]:[{[Vi]:!0,[so]:"sigv4",[Wi]:"s3express",[Zi]:"{Region}"}]},[Gi]:{}},[$i]:co}],[$i]:uo},{[eo]:"S3Express bucket name is not a valid virtual hostable name.",[$i]:eo}],[$i]:uo},{[Li]:[{[_i]:Qi,[Bi]:[{[_i]:no,[Bi]:[{[zi]:"url"},"isIp"]},!0]}],[Di]:[{[Li]:[{[_i]:"uriEncode",[Bi]:[Xo],[ji]:"uri_encoded_bucket"}],[Di]:[{[co]:{[Hi]:"{url#scheme}://{url#authority}/{uri_encoded_bucket}{url#path}",[qi]:{[Fi]:"S3Express",[Ki]:[{[Vi]:!0,[so]:"sigv4-s3express",[Wi]:"s3express",[Zi]:"{Region}"}]},[Gi]:{}},[$i]:co}],[$i]:uo}],[$i]:uo},{[Li]:[{[_i]:lo,[Bi]:[Xo,!1]}],[Di]:[{[co]:{[Hi]:ho,[qi]:{[Fi]:"S3Express",[Ki]:[{[Vi]:!0,[so]:"sigv4-s3express",[Wi]:"s3express",[Zi]:"{Region}"}]},[Gi]:{}},[$i]:co}],[$i]:uo},{[eo]:"S3Express bucket name is not a valid virtual hostable name.",[$i]:eo}],[$i]:uo},Qo={[_i]:ao,[Bi]:[{[zi]:"Endpoint"}],[ji]:"url"},ea={[_i]:Qi,[Bi]:[{[_i]:no,[Bi]:[{[zi]:"url"},"isIp"]},!0]},ta={[zi]:"url"},ra={[_i]:"uriEncode",[Bi]:[Xo],[ji]:"uri_encoded_bucket"},na={[Fi]:"S3Express",[Ki]:[{[Vi]:!0,[so]:"sigv4",[Wi]:"s3express",[Zi]:"{Region}"}]},sa={},ia={[_i]:lo,[Bi]:[Xo,!1]},oa={[eo]:"S3Express bucket name is not a valid virtual hostable name.",[$i]:eo},aa={[_i]:Ji,[Bi]:[{[zi]:"UseS3ExpressControlEndpoint"}]},ca={[_i]:Qi,[Bi]:[{[zi]:"UseS3ExpressControlEndpoint"},!0]},ua={[_i]:po,[Bi]:[Vo]},da={[_i]:Qi,[Bi]:[{[zi]:"UseDualStack"},!1]},la={[_i]:Qi,[Bi]:[{[zi]:"UseFIPS"},!1]},ha={[eo]:"Unrecognized S3Express bucket name format.",[$i]:eo},pa={[_i]:po,[Bi]:[Go]},fa={[zi]:go},ma={[Li]:[ua],[eo]:"Expected a endpoint to be specified but no endpoint was found",[$i]:eo},ga={[Ki]:[{[Vi]:!0,[so]:vo,[Wi]:Eo,[Xi]:["*"]},{[Vi]:!0,[so]:"sigv4",[Wi]:Eo,[Zi]:"{Region}"}]},ya={[_i]:Qi,[Bi]:[{[zi]:"ForcePathStyle"},!1]},wa={[zi]:"ForcePathStyle"},ba={[_i]:Qi,[Bi]:[{[zi]:"Accelerate"},!1]},Sa={[_i]:ro,[Bi]:[{[zi]:"Region"},"aws-global"]},va={[Ki]:[{[Vi]:!0,[so]:"sigv4",[Wi]:Co,[Zi]:"us-east-1"}]},Ea={[_i]:po,[Bi]:[Sa]},Ca={[_i]:Qi,[Bi]:[{[zi]:"UseGlobalEndpoint"},!0]},xa={[Hi]:"https://{Bucket}.s3-fips.dualstack.{Region}.{partitionResult#dnsSuffix}",[qi]:{[Ki]:[{[Vi]:!0,[so]:"sigv4",[Wi]:Co,[Zi]:"{Region}"}]},[Gi]:{}},Aa={[Ki]:[{[Vi]:!0,[so]:"sigv4",[Wi]:Co,[Zi]:"{Region}"}]},Ra={[_i]:Qi,[Bi]:[{[zi]:"UseGlobalEndpoint"},!1]},ka={[Hi]:"https://{Bucket}.s3-fips.{Region}.{partitionResult#dnsSuffix}",[qi]:Aa,[Gi]:{}},Ta={[Hi]:"https://{Bucket}.s3-accelerate.dualstack.{partitionResult#dnsSuffix}",[qi]:Aa,[Gi]:{}},Pa={[Hi]:"https://{Bucket}.s3.dualstack.{Region}.{partitionResult#dnsSuffix}",[qi]:Aa,[Gi]:{}},Ia={[_i]:Qi,[Bi]:[{[_i]:no,[Bi]:[ta,"isIp"]},!1]},Ma={[Hi]:xo,[qi]:Aa,[Gi]:{}},Oa={[Hi]:ho,[qi]:Aa,[Gi]:{}},Ua={[co]:Oa,[$i]:co},Na={[Hi]:Ao,[qi]:Aa,[Gi]:{}},$a={[Hi]:"https://{Bucket}.s3.{Region}.{partitionResult#dnsSuffix}",[qi]:Aa,[Gi]:{}},Da={[eo]:"Invalid region: region was not a valid DNS name.",[$i]:eo},La={[zi]:To},_a={[zi]:Po},Ba={[_i]:no,[Bi]:[La,"service"]},za={[zi]:Oo},ja={[Li]:[Ko],[eo]:"S3 Object Lambda does not support Dual-stack",[$i]:eo},Ha={[Li]:[qo],[eo]:"S3 Object Lambda does not support S3 Accelerate",[$i]:eo},qa={[Li]:[{[_i]:Ji,[Bi]:[{[zi]:"DisableAccessPoints"}]},{[_i]:Qi,[Bi]:[{[zi]:"DisableAccessPoints"},!0]}],[eo]:"Access points are not supported for this operation",[$i]:eo},Fa={[Li]:[{[_i]:Ji,[Bi]:[{[zi]:"UseArnRegion"}]},{[_i]:Qi,[Bi]:[{[zi]:"UseArnRegion"},!1]},{[_i]:po,[Bi]:[{[_i]:ro,[Bi]:[{[_i]:no,[Bi]:[La,"region"]},"{Region}"]}]}],[eo]:"Invalid configuration: region from ARN `{bucketArn#region}` does not match client region `{Region}` and UseArnRegion is `false`",[$i]:eo},Ka={[_i]:no,[Bi]:[{[zi]:"bucketPartition"},so]},Va={[_i]:no,[Bi]:[La,"accountId"]},Wa={[Ki]:[{[Vi]:!0,[so]:"sigv4",[Wi]:Io,[Zi]:"{bucketArn#region}"}]},Za={[eo]:"Invalid ARN: The access point name may only contain a-z, A-Z, 0-9 and `-`. Found: `{accessPointName}`",[$i]:eo},Ga={[eo]:"Invalid ARN: The account id may only contain a-z, A-Z, 0-9 and `-`. Found: `{bucketArn#accountId}`",[$i]:eo},Xa={[eo]:"Invalid region in ARN: `{bucketArn#region}` (invalid DNS name)",[$i]:eo},Ya={[eo]:"Client was configured for partition `{partitionResult#name}` but ARN (`{Bucket}`) has `{bucketPartition#name}`",[$i]:eo},Ja={[eo]:"Invalid ARN: The ARN may only contain a single resource component after `accesspoint`.",[$i]:eo},Qa={[eo]:"Invalid ARN: Expected a resource of the format `accesspoint:<accesspoint name>` but no name was provided",[$i]:eo},ec={[Ki]:[{[Vi]:!0,[so]:"sigv4",[Wi]:Co,[Zi]:"{bucketArn#region}"}]},tc={[Ki]:[{[Vi]:!0,[so]:vo,[Wi]:Eo,[Xi]:["*"]},{[Vi]:!0,[so]:"sigv4",[Wi]:Eo,[Zi]:"{bucketArn#region}"}]},rc={[_i]:ko,[Bi]:[Xo]},nc={[Hi]:"https://s3-fips.dualstack.{Region}.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",[qi]:Aa,[Gi]:{}},sc={[Hi]:"https://s3-fips.{Region}.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",[qi]:Aa,[Gi]:{}},ic={[Hi]:"https://s3.dualstack.{Region}.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",[qi]:Aa,[Gi]:{}},oc={[Hi]:Lo,[qi]:Aa,[Gi]:{}},ac={[Hi]:"https://s3.{Region}.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",[qi]:Aa,[Gi]:{}},cc={[zi]:"UseObjectLambdaEndpoint"},uc={[Ki]:[{[Vi]:!0,[so]:"sigv4",[Wi]:Io,[Zi]:"{Region}"}]},dc={[Hi]:"https://s3-fips.dualstack.{Region}.{partitionResult#dnsSuffix}",[qi]:Aa,[Gi]:{}},lc={[Hi]:"https://s3-fips.{Region}.{partitionResult#dnsSuffix}",[qi]:Aa,[Gi]:{}},hc={[Hi]:"https://s3.dualstack.{Region}.{partitionResult#dnsSuffix}",[qi]:Aa,[Gi]:{}},pc={[Hi]:mo,[qi]:Aa,[Gi]:{}},fc={[Hi]:"https://s3.{Region}.{partitionResult#dnsSuffix}",[qi]:Aa,[Gi]:{}},mc=[{[zi]:"Region"}],gc=[{[zi]:"Endpoint"}],yc=[Xo],wc=[qo],bc=[Vo,Qo],Sc=[{[_i]:Ji,[Bi]:[{[zi]:"DisableS3ExpressSessionAuth"}]},{[_i]:Qi,[Bi]:[{[zi]:"DisableS3ExpressSessionAuth"},!0]}],vc=[ra],Ec=[ia],Cc=[Wo],xc=[Fo,Ko],Ac=[Fo,da],Rc=[la,Ko],kc=[la,da],Tc=[{[_i]:io,[Bi]:[Xo,6,14,!0],[ji]:"s3expressAvailabilityZoneId"},{[_i]:io,[Bi]:[Xo,14,16,!0],[ji]:"s3expressAvailabilityZoneDelim"},{[_i]:ro,[Bi]:[{[zi]:"s3expressAvailabilityZoneDelim"},"--"]}],Pc=[{[Li]:[Fo,Ko],[co]:{[Hi]:"https://{Bucket}.s3express-fips-{s3expressAvailabilityZoneId}.dualstack.{Region}.{partitionResult#dnsSuffix}",[qi]:na,[Gi]:{}},[$i]:co},{[Li]:Ac,[co]:{[Hi]:"https://{Bucket}.s3express-fips-{s3expressAvailabilityZoneId}.{Region}.{partitionResult#dnsSuffix}",[qi]:na,[Gi]:{}},[$i]:co},{[Li]:Rc,[co]:{[Hi]:"https://{Bucket}.s3express-{s3expressAvailabilityZoneId}.dualstack.{Region}.{partitionResult#dnsSuffix}",[qi]:na,[Gi]:{}},[$i]:co},{[Li]:kc,[co]:{[Hi]:"https://{Bucket}.s3express-{s3expressAvailabilityZoneId}.{Region}.{partitionResult#dnsSuffix}",[qi]:na,[Gi]:{}},[$i]:co}],Ic=[{[_i]:io,[Bi]:[Xo,6,15,!0],[ji]:"s3expressAvailabilityZoneId"},{[_i]:io,[Bi]:[Xo,15,17,!0],[ji]:"s3expressAvailabilityZoneDelim"},{[_i]:ro,[Bi]:[{[zi]:"s3expressAvailabilityZoneDelim"},"--"]}],Mc=[{[_i]:io,[Bi]:[Xo,6,19,!0],[ji]:"s3expressAvailabilityZoneId"},{[_i]:io,[Bi]:[Xo,19,21,!0],[ji]:"s3expressAvailabilityZoneDelim"},{[_i]:ro,[Bi]:[{[zi]:"s3expressAvailabilityZoneDelim"},"--"]}],Oc=[{[_i]:io,[Bi]:[Xo,6,20,!0],[ji]:"s3expressAvailabilityZoneId"},{[_i]:io,[Bi]:[Xo,20,22,!0],[ji]:"s3expressAvailabilityZoneDelim"},{[_i]:ro,[Bi]:[{[zi]:"s3expressAvailabilityZoneDelim"},"--"]}],Uc=[{[_i]:io,[Bi]:[Xo,6,26,!0],[ji]:"s3expressAvailabilityZoneId"},{[_i]:io,[Bi]:[Xo,26,28,!0],[ji]:"s3expressAvailabilityZoneDelim"},{[_i]:ro,[Bi]:[{[zi]:"s3expressAvailabilityZoneDelim"},"--"]}],Nc=[{[Li]:[Fo,Ko],[co]:{[Hi]:"https://{Bucket}.s3express-fips-{s3expressAvailabilityZoneId}.dualstack.{Region}.{partitionResult#dnsSuffix}",[qi]:{[Fi]:"S3Express",[Ki]:[{[Vi]:!0,[so]:"sigv4-s3express",[Wi]:"s3express",[Zi]:"{Region}"}]},[Gi]:{}},[$i]:co},{[Li]:Ac,[co]:{[Hi]:"https://{Bucket}.s3express-fips-{s3expressAvailabilityZoneId}.{Region}.{partitionResult#dnsSuffix}",[qi]:{[Fi]:"S3Express",[Ki]:[{[Vi]:!0,[so]:"sigv4-s3express",[Wi]:"s3express",[Zi]:"{Region}"}]},[Gi]:{}},[$i]:co},{[Li]:Rc,[co]:{[Hi]:"https://{Bucket}.s3express-{s3expressAvailabilityZoneId}.dualstack.{Region}.{partitionResult#dnsSuffix}",[qi]:{[Fi]:"S3Express",[Ki]:[{[Vi]:!0,[so]:"sigv4-s3express",[Wi]:"s3express",[Zi]:"{Region}"}]},[Gi]:{}},[$i]:co},{[Li]:kc,[co]:{[Hi]:"https://{Bucket}.s3express-{s3expressAvailabilityZoneId}.{Region}.{partitionResult#dnsSuffix}",[qi]:{[Fi]:"S3Express",[Ki]:[{[Vi]:!0,[so]:"sigv4-s3express",[Wi]:"s3express",[Zi]:"{Region}"}]},[Gi]:{}},[$i]:co}],$c=[Xo,0,7,!0],Dc=[{[_i]:io,[Bi]:[Xo,7,15,!0],[ji]:"s3expressAvailabilityZoneId"},{[_i]:io,[Bi]:[Xo,15,17,!0],[ji]:"s3expressAvailabilityZoneDelim"},{[_i]:ro,[Bi]:[{[zi]:"s3expressAvailabilityZoneDelim"},"--"]}],Lc=[{[_i]:io,[Bi]:[Xo,7,16,!0],[ji]:"s3expressAvailabilityZoneId"},{[_i]:io,[Bi]:[Xo,16,18,!0],[ji]:"s3expressAvailabilityZoneDelim"},{[_i]:ro,[Bi]:[{[zi]:"s3expressAvailabilityZoneDelim"},"--"]}],_c=[{[_i]:io,[Bi]:[Xo,7,20,!0],[ji]:"s3expressAvailabilityZoneId"},{[_i]:io,[Bi]:[Xo,20,22,!0],[ji]:"s3expressAvailabilityZoneDelim"},{[_i]:ro,[Bi]:[{[zi]:"s3expressAvailabilityZoneDelim"},"--"]}],Bc=[{[_i]:io,[Bi]:[Xo,7,21,!0],[ji]:"s3expressAvailabilityZoneId"},{[_i]:io,[Bi]:[Xo,21,23,!0],[ji]:"s3expressAvailabilityZoneDelim"},{[_i]:ro,[Bi]:[{[zi]:"s3expressAvailabilityZoneDelim"},"--"]}],zc=[{[_i]:io,[Bi]:[Xo,7,27,!0],[ji]:"s3expressAvailabilityZoneId"},{[_i]:io,[Bi]:[Xo,27,29,!0],[ji]:"s3expressAvailabilityZoneDelim"},{[_i]:ro,[Bi]:[{[zi]:"s3expressAvailabilityZoneDelim"},"--"]}],jc=[Go],Hc=[{[_i]:So,[Bi]:[{[zi]:bo},!1]}],qc=[{[_i]:ro,[Bi]:[{[zi]:yo},"beta"]}],Fc=[{[_i]:So,[Bi]:[{[zi]:"Region"},!1]}],Kc=[{[_i]:ro,[Bi]:[{[zi]:"Region"},"us-east-1"]}],Vc=[{[_i]:ro,[Bi]:[_a,Mo]}],Wc=[{[_i]:no,[Bi]:[La,"resourceId[1]"],[ji]:Oo},{[_i]:po,[Bi]:[{[_i]:ro,[Bi]:[za,""]}]}],Zc=[La,"resourceId[1]"],Gc=[Ko],Xc=[{[_i]:po,[Bi]:[{[_i]:ro,[Bi]:[{[_i]:no,[Bi]:[La,"region"]},""]}]}],Yc=[{[_i]:po,[Bi]:[{[_i]:Ji,[Bi]:[{[_i]:no,[Bi]:[La,"resourceId[2]"]}]}]}],Jc=[La,"resourceId[2]"],Qc=[{[_i]:to,[Bi]:[{[_i]:no,[Bi]:[La,"region"]}],[ji]:"bucketPartition"}],eu=[{[_i]:ro,[Bi]:[Ka,{[_i]:no,[Bi]:[{[zi]:"partitionResult"},so]}]}],tu=[{[_i]:So,[Bi]:[{[_i]:no,[Bi]:[La,"region"]},!0]}],ru=[{[_i]:So,[Bi]:[Va,!1]}],nu=[{[_i]:So,[Bi]:[za,!1]}],su=[Fo],iu=[{[_i]:So,[Bi]:[{[zi]:"Region"},!0]}],ou={parameters:{Bucket:zo,Region:zo,UseFIPS:jo,UseDualStack:jo,Endpoint:zo,ForcePathStyle:jo,Accelerate:jo,UseGlobalEndpoint:jo,UseObjectLambdaEndpoint:Ho,Key:zo,Prefix:zo,CopySource:zo,DisableAccessPoints:Ho,DisableMultiRegionAccessPoints:jo,UseArnRegion:Ho,UseS3ExpressControlEndpoint:Ho,DisableS3ExpressSessionAuth:Ho},[Di]:[{[Li]:[{[_i]:Ji,[Bi]:mc}],[Di]:[{[Li]:[qo,Fo],error:"Accelerate cannot be used with FIPS",[$i]:eo},{[Li]:[Ko,Vo],error:"Cannot set dual-stack in combination with a custom endpoint.",[$i]:eo},{[Li]:[Vo,Fo],error:"A custom endpoint cannot be combined with FIPS",[$i]:eo},{[Li]:[Vo,qo],error:"A custom endpoint cannot be combined with S3 Accelerate",[$i]:eo},{[Li]:[Fo,Wo,Zo],error:"Partition does not support FIPS",[$i]:eo},{[Li]:[Go,{[_i]:io,[Bi]:[Xo,0,6,Yi],[ji]:oo},{[_i]:ro,[Bi]:[{[zi]:oo},"--x-s3"]}],[Di]:[Yo,Jo,{[Li]:[aa,ca],[Di]:[{[Li]:Cc,[Di]:[{[Li]:[ra,ua],[Di]:[{[Li]:xc,endpoint:{[Hi]:"https://s3express-control-fips.dualstack.{Region}.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",[qi]:na,[Gi]:sa},[$i]:co},{[Li]:Ac,endpoint:{[Hi]:"https://s3express-control-fips.{Region}.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",[qi]:na,[Gi]:sa},[$i]:co},{[Li]:Rc,endpoint:{[Hi]:"https://s3express-control.dualstack.{Region}.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",[qi]:na,[Gi]:sa},[$i]:co},{[Li]:kc,endpoint:{[Hi]:"https://s3express-control.{Region}.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",[qi]:na,[Gi]:sa},[$i]:co}],[$i]:uo}],[$i]:uo}],[$i]:uo},{[Li]:Ec,[Di]:[{[Li]:Cc,[Di]:[{[Li]:Sc,[Di]:[{[Li]:Tc,[Di]:Pc,[$i]:uo},{[Li]:Ic,[Di]:Pc,[$i]:uo},{[Li]:Mc,[Di]:Pc,[$i]:uo},{[Li]:Oc,[Di]:Pc,[$i]:uo},{[Li]:Uc,[Di]:Pc,[$i]:uo},ha],[$i]:uo},{[Li]:Tc,[Di]:Nc,[$i]:uo},{[Li]:Ic,[Di]:Nc,[$i]:uo},{[Li]:Mc,[Di]:Nc,[$i]:uo},{[Li]:Oc,[Di]:Nc,[$i]:uo},{[Li]:Uc,[Di]:Nc,[$i]:uo},ha],[$i]:uo}],[$i]:uo},oa],[$i]:uo},{[Li]:[Go,{[_i]:io,[Bi]:$c,[ji]:fo},{[_i]:ro,[Bi]:[{[zi]:fo},"--xa-s3"]}],[Di]:[Yo,Jo,{[Li]:Ec,[Di]:[{[Li]:Cc,[Di]:[{[Li]:Sc,[Di]:[{[Li]:Dc,[Di]:Pc,[$i]:uo},{[Li]:Lc,[Di]:Pc,[$i]:uo},{[Li]:_c,[Di]:Pc,[$i]:uo},{[Li]:Bc,[Di]:Pc,[$i]:uo},{[Li]:zc,[Di]:Pc,[$i]:uo},ha],[$i]:uo},{[Li]:Dc,[Di]:Nc,[$i]:uo},{[Li]:Lc,[Di]:Nc,[$i]:uo},{[Li]:_c,[Di]:Nc,[$i]:uo},{[Li]:Bc,[Di]:Nc,[$i]:uo},{[Li]:zc,[Di]:Nc,[$i]:uo},ha],[$i]:uo}],[$i]:uo},oa],[$i]:uo},{[Li]:[pa,aa,ca],[Di]:[{[Li]:Cc,[Di]:[{[Li]:bc,endpoint:{[Hi]:mo,[qi]:na,[Gi]:sa},[$i]:co},{[Li]:xc,endpoint:{[Hi]:"https://s3express-control-fips.dualstack.{Region}.{partitionResult#dnsSuffix}",[qi]:na,[Gi]:sa},[$i]:co},{[Li]:Ac,endpoint:{[Hi]:"https://s3express-control-fips.{Region}.{partitionResult#dnsSuffix}",[qi]:na,[Gi]:sa},[$i]:co},{[Li]:Rc,endpoint:{[Hi]:"https://s3express-control.dualstack.{Region}.{partitionResult#dnsSuffix}",[qi]:na,[Gi]:sa},[$i]:co},{[Li]:kc,endpoint:{[Hi]:"https://s3express-control.{Region}.{partitionResult#dnsSuffix}",[qi]:na,[Gi]:sa},[$i]:co}],[$i]:uo}],[$i]:uo},{[Li]:[Go,{[_i]:io,[Bi]:[Xo,49,50,Yi],[ji]:go},{[_i]:io,[Bi]:[Xo,8,12,Yi],[ji]:yo},{[_i]:io,[Bi]:$c,[ji]:wo},{[_i]:io,[Bi]:[Xo,32,49,Yi],[ji]:bo},{[_i]:to,[Bi]:mc,[ji]:"regionPartition"},{[_i]:ro,[Bi]:[{[zi]:wo},"--op-s3"]}],[Di]:[{[Li]:Hc,[Di]:[{[Li]:Ec,[Di]:[{[Li]:[{[_i]:ro,[Bi]:[fa,"e"]}],[Di]:[{[Li]:qc,[Di]:[ma,{[Li]:bc,endpoint:{[Hi]:"https://{Bucket}.ec2.{url#authority}",[qi]:ga,[Gi]:sa},[$i]:co}],[$i]:uo},{endpoint:{[Hi]:"https://{Bucket}.ec2.s3-outposts.{Region}.{regionPartition#dnsSuffix}",[qi]:ga,[Gi]:sa},[$i]:co}],[$i]:uo},{[Li]:[{[_i]:ro,[Bi]:[fa,"o"]}],[Di]:[{[Li]:qc,[Di]:[ma,{[Li]:bc,endpoint:{[Hi]:"https://{Bucket}.op-{outpostId}.{url#authority}",[qi]:ga,[Gi]:sa},[$i]:co}],[$i]:uo},{endpoint:{[Hi]:"https://{Bucket}.op-{outpostId}.s3-outposts.{Region}.{regionPartition#dnsSuffix}",[qi]:ga,[Gi]:sa},[$i]:co}],[$i]:uo},{error:'Unrecognized hardware type: "Expected hardware type o or e but got {hardwareType}"',[$i]:eo}],[$i]:uo},{error:"Invalid Outposts Bucket alias - it must be a valid bucket name.",[$i]:eo}],[$i]:uo},{error:"Invalid ARN: The outpost Id must only contain a-z, A-Z, 0-9 and `-`.",[$i]:eo}],[$i]:uo},{[Li]:jc,[Di]:[{[Li]:[Vo,{[_i]:po,[Bi]:[{[_i]:Ji,[Bi]:[{[_i]:ao,[Bi]:gc}]}]}],error:"Custom endpoint `{Endpoint}` was not a valid URI",[$i]:eo},{[Li]:[ya,ia],[Di]:[{[Li]:Cc,[Di]:[{[Li]:Fc,[Di]:[{[Li]:[qo,Zo],error:"S3 Accelerate cannot be used in this region",[$i]:eo},{[Li]:[Ko,Fo,ba,ua,Sa],endpoint:{[Hi]:"https://{Bucket}.s3-fips.dualstack.us-east-1.{partitionResult#dnsSuffix}",[qi]:va,[Gi]:sa},[$i]:co},{[Li]:[Ko,Fo,ba,ua,Ea,Ca],[Di]:[{endpoint:xa,[$i]:co}],[$i]:uo},{[Li]:[Ko,Fo,ba,ua,Ea,Ra],endpoint:xa,[$i]:co},{[Li]:[da,Fo,ba,ua,Sa],endpoint:{[Hi]:"https://{Bucket}.s3-fips.us-east-1.{partitionResult#dnsSuffix}",[qi]:va,[Gi]:sa},[$i]:co},{[Li]:[da,Fo,ba,ua,Ea,Ca],[Di]:[{endpoint:ka,[$i]:co}],[$i]:uo},{[Li]:[da,Fo,ba,ua,Ea,Ra],endpoint:ka,[$i]:co},{[Li]:[Ko,la,qo,ua,Sa],endpoint:{[Hi]:"https://{Bucket}.s3-accelerate.dualstack.us-east-1.{partitionResult#dnsSuffix}",[qi]:va,[Gi]:sa},[$i]:co},{[Li]:[Ko,la,qo,ua,Ea,Ca],[Di]:[{endpoint:Ta,[$i]:co}],[$i]:uo},{[Li]:[Ko,la,qo,ua,Ea,Ra],endpoint:Ta,[$i]:co},{[Li]:[Ko,la,ba,ua,Sa],endpoint:{[Hi]:"https://{Bucket}.s3.dualstack.us-east-1.{partitionResult#dnsSuffix}",[qi]:va,[Gi]:sa},[$i]:co},{[Li]:[Ko,la,ba,ua,Ea,Ca],[Di]:[{endpoint:Pa,[$i]:co}],[$i]:uo},{[Li]:[Ko,la,ba,ua,Ea,Ra],endpoint:Pa,[$i]:co},{[Li]:[da,la,ba,Vo,Qo,ea,Sa],endpoint:{[Hi]:xo,[qi]:va,[Gi]:sa},[$i]:co},{[Li]:[da,la,ba,Vo,Qo,Ia,Sa],endpoint:{[Hi]:ho,[qi]:va,[Gi]:sa},[$i]:co},{[Li]:[da,la,ba,Vo,Qo,ea,Ea,Ca],[Di]:[{[Li]:Kc,endpoint:Ma,[$i]:co},{endpoint:Ma,[$i]:co}],[$i]:uo},{[Li]:[da,la,ba,Vo,Qo,Ia,Ea,Ca],[Di]:[{[Li]:Kc,endpoint:Oa,[$i]:co},Ua],[$i]:uo},{[Li]:[da,la,ba,Vo,Qo,ea,Ea,Ra],endpoint:Ma,[$i]:co},{[Li]:[da,la,ba,Vo,Qo,Ia,Ea,Ra],endpoint:Oa,[$i]:co},{[Li]:[da,la,qo,ua,Sa],endpoint:{[Hi]:Ao,[qi]:va,[Gi]:sa},[$i]:co},{[Li]:[da,la,qo,ua,Ea,Ca],[Di]:[{[Li]:Kc,endpoint:Na,[$i]:co},{endpoint:Na,[$i]:co}],[$i]:uo},{[Li]:[da,la,qo,ua,Ea,Ra],endpoint:Na,[$i]:co},{[Li]:[da,la,ba,ua,Sa],endpoint:{[Hi]:Ro,[qi]:va,[Gi]:sa},[$i]:co},{[Li]:[da,la,ba,ua,Ea,Ca],[Di]:[{[Li]:Kc,endpoint:{[Hi]:Ro,[qi]:Aa,[Gi]:sa},[$i]:co},{endpoint:$a,[$i]:co}],[$i]:uo},{[Li]:[da,la,ba,ua,Ea,Ra],endpoint:$a,[$i]:co}],[$i]:uo},Da],[$i]:uo}],[$i]:uo},{[Li]:[Vo,Qo,{[_i]:ro,[Bi]:[{[_i]:no,[Bi]:[ta,"scheme"]},"http"]},{[_i]:lo,[Bi]:[Xo,Yi]},ya,la,da,ba],[Di]:[{[Li]:Cc,[Di]:[{[Li]:Fc,[Di]:[Ua],[$i]:uo},Da],[$i]:uo}],[$i]:uo},{[Li]:[ya,{[_i]:ko,[Bi]:yc,[ji]:To}],[Di]:[{[Li]:[{[_i]:no,[Bi]:[La,"resourceId[0]"],[ji]:Po},{[_i]:po,[Bi]:[{[_i]:ro,[Bi]:[_a,""]}]}],[Di]:[{[Li]:[{[_i]:ro,[Bi]:[Ba,Io]}],[Di]:[{[Li]:Vc,[Di]:[{[Li]:Wc,[Di]:[ja,Ha,{[Li]:Xc,[Di]:[qa,{[Li]:Yc,[Di]:[Fa,{[Li]:Qc,[Di]:[{[Li]:Cc,[Di]:[{[Li]:eu,[Di]:[{[Li]:tu,[Di]:[{[Li]:[{[_i]:ro,[Bi]:[Va,""]}],error:"Invalid ARN: Missing account id",[$i]:eo},{[Li]:ru,[Di]:[{[Li]:nu,[Di]:[{[Li]:bc,endpoint:{[Hi]:Uo,[qi]:Wa,[Gi]:sa},[$i]:co},{[Li]:su,endpoint:{[Hi]:"https://{accessPointName}-{bucketArn#accountId}.s3-object-lambda-fips.{bucketArn#region}.{bucketPartition#dnsSuffix}",[qi]:Wa,[Gi]:sa},[$i]:co},{endpoint:{[Hi]:"https://{accessPointName}-{bucketArn#accountId}.s3-object-lambda.{bucketArn#region}.{bucketPartition#dnsSuffix}",[qi]:Wa,[Gi]:sa},[$i]:co}],[$i]:uo},Za],[$i]:uo},Ga],[$i]:uo},Xa],[$i]:uo},Ya],[$i]:uo}],[$i]:uo}],[$i]:uo},Ja],[$i]:uo},{error:"Invalid ARN: bucket ARN is missing a region",[$i]:eo}],[$i]:uo},Qa],[$i]:uo},{error:"Invalid ARN: Object Lambda ARNs only support `accesspoint` arn types, but found: `{arnType}`",[$i]:eo}],[$i]:uo},{[Li]:Vc,[Di]:[{[Li]:Wc,[Di]:[{[Li]:Xc,[Di]:[{[Li]:Vc,[Di]:[{[Li]:Xc,[Di]:[qa,{[Li]:Yc,[Di]:[Fa,{[Li]:Qc,[Di]:[{[Li]:Cc,[Di]:[{[Li]:[{[_i]:ro,[Bi]:[Ka,"{partitionResult#name}"]}],[Di]:[{[Li]:tu,[Di]:[{[Li]:[{[_i]:ro,[Bi]:[Ba,Co]}],[Di]:[{[Li]:ru,[Di]:[{[Li]:nu,[Di]:[{[Li]:wc,error:"Access Points do not support S3 Accelerate",[$i]:eo},{[Li]:xc,endpoint:{[Hi]:"https://{accessPointName}-{bucketArn#accountId}.s3-accesspoint-fips.dualstack.{bucketArn#region}.{bucketPartition#dnsSuffix}",[qi]:ec,[Gi]:sa},[$i]:co},{[Li]:Ac,endpoint:{[Hi]:"https://{accessPointName}-{bucketArn#accountId}.s3-accesspoint-fips.{bucketArn#region}.{bucketPartition#dnsSuffix}",[qi]:ec,[Gi]:sa},[$i]:co},{[Li]:Rc,endpoint:{[Hi]:"https://{accessPointName}-{bucketArn#accountId}.s3-accesspoint.dualstack.{bucketArn#region}.{bucketPartition#dnsSuffix}",[qi]:ec,[Gi]:sa},[$i]:co},{[Li]:[la,da,Vo,Qo],endpoint:{[Hi]:Uo,[qi]:ec,[Gi]:sa},[$i]:co},{[Li]:kc,endpoint:{[Hi]:"https://{accessPointName}-{bucketArn#accountId}.s3-accesspoint.{bucketArn#region}.{bucketPartition#dnsSuffix}",[qi]:ec,[Gi]:sa},[$i]:co}],[$i]:uo},Za],[$i]:uo},Ga],[$i]:uo},{error:"Invalid ARN: The ARN was not for the S3 service, found: {bucketArn#service}",[$i]:eo}],[$i]:uo},Xa],[$i]:uo},Ya],[$i]:uo}],[$i]:uo}],[$i]:uo},Ja],[$i]:uo}],[$i]:uo}],[$i]:uo},{[Li]:[{[_i]:So,[Bi]:[za,Yi]}],[Di]:[{[Li]:Gc,error:"S3 MRAP does not support dual-stack",[$i]:eo},{[Li]:su,error:"S3 MRAP does not support FIPS",[$i]:eo},{[Li]:wc,error:"S3 MRAP does not support S3 Accelerate",[$i]:eo},{[Li]:[{[_i]:Qi,[Bi]:[{[zi]:"DisableMultiRegionAccessPoints"},Yi]}],error:"Invalid configuration: Multi-Region Access Point ARNs are disabled.",[$i]:eo},{[Li]:[{[_i]:to,[Bi]:mc,[ji]:No}],[Di]:[{[Li]:[{[_i]:ro,[Bi]:[{[_i]:no,[Bi]:[{[zi]:No},so]},{[_i]:no,[Bi]:[La,"partition"]}]}],[Di]:[{endpoint:{[Hi]:"https://{accessPointName}.accesspoint.s3-global.{mrapPartition#dnsSuffix}",[qi]:{[Ki]:[{[Vi]:Yi,name:vo,[Wi]:Co,[Xi]:["*"]}]},[Gi]:sa},[$i]:co}],[$i]:uo},{error:"Client was configured for partition `{mrapPartition#name}` but bucket referred to partition `{bucketArn#partition}`",[$i]:eo}],[$i]:uo}],[$i]:uo},{error:"Invalid Access Point Name",[$i]:eo}],[$i]:uo},Qa],[$i]:uo},{[Li]:[{[_i]:ro,[Bi]:[Ba,Eo]}],[Di]:[{[Li]:Gc,error:"S3 Outposts does not support Dual-stack",[$i]:eo},{[Li]:su,error:"S3 Outposts does not support FIPS",[$i]:eo},{[Li]:wc,error:"S3 Outposts does not support S3 Accelerate",[$i]:eo},{[Li]:[{[_i]:Ji,[Bi]:[{[_i]:no,[Bi]:[La,"resourceId[4]"]}]}],error:"Invalid Arn: Outpost Access Point ARN contains sub resources",[$i]:eo},{[Li]:[{[_i]:no,[Bi]:Zc,[ji]:bo}],[Di]:[{[Li]:Hc,[Di]:[Fa,{[Li]:Qc,[Di]:[{[Li]:Cc,[Di]:[{[Li]:eu,[Di]:[{[Li]:tu,[Di]:[{[Li]:ru,[Di]:[{[Li]:[{[_i]:no,[Bi]:Jc,[ji]:$o}],[Di]:[{[Li]:[{[_i]:no,[Bi]:[La,"resourceId[3]"],[ji]:Oo}],[Di]:[{[Li]:[{[_i]:ro,[Bi]:[{[zi]:$o},Mo]}],[Di]:[{[Li]:bc,endpoint:{[Hi]:"https://{accessPointName}-{bucketArn#accountId}.{outpostId}.{url#authority}",[qi]:tc,[Gi]:sa},[$i]:co},{endpoint:{[Hi]:"https://{accessPointName}-{bucketArn#accountId}.{outpostId}.s3-outposts.{bucketArn#region}.{bucketPartition#dnsSuffix}",[qi]:tc,[Gi]:sa},[$i]:co}],[$i]:uo},{error:"Expected an outpost type `accesspoint`, found {outpostType}",[$i]:eo}],[$i]:uo},{error:"Invalid ARN: expected an access point name",[$i]:eo}],[$i]:uo},{error:"Invalid ARN: Expected a 4-component resource",[$i]:eo}],[$i]:uo},Ga],[$i]:uo},Xa],[$i]:uo},Ya],[$i]:uo}],[$i]:uo}],[$i]:uo},{error:"Invalid ARN: The outpost Id may only contain a-z, A-Z, 0-9 and `-`. Found: `{outpostId}`",[$i]:eo}],[$i]:uo},{error:"Invalid ARN: The Outpost Id was not set",[$i]:eo}],[$i]:uo},{error:"Invalid ARN: Unrecognized format: {Bucket} (type: {arnType})",[$i]:eo}],[$i]:uo},{error:"Invalid ARN: No ARN type specified",[$i]:eo}],[$i]:uo},{[Li]:[{[_i]:io,[Bi]:[Xo,0,4,!1],[ji]:Do},{[_i]:ro,[Bi]:[{[zi]:Do},"arn:"]},{[_i]:po,[Bi]:[{[_i]:Ji,[Bi]:[rc]}]}],error:"Invalid ARN: `{Bucket}` was not a valid ARN",[$i]:eo},{[Li]:[{[_i]:Qi,[Bi]:[wa,Yi]},rc],error:"Path-style addressing cannot be used with ARN buckets",[$i]:eo},{[Li]:vc,[Di]:[{[Li]:Cc,[Di]:[{[Li]:[ba],[Di]:[{[Li]:[Ko,ua,Fo,Sa],endpoint:{[Hi]:"https://s3-fips.dualstack.us-east-1.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",[qi]:va,[Gi]:sa},[$i]:co},{[Li]:[Ko,ua,Fo,Ea,Ca],[Di]:[{endpoint:nc,[$i]:co}],[$i]:uo},{[Li]:[Ko,ua,Fo,Ea,Ra],endpoint:nc,[$i]:co},{[Li]:[da,ua,Fo,Sa],endpoint:{[Hi]:"https://s3-fips.us-east-1.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",[qi]:va,[Gi]:sa},[$i]:co},{[Li]:[da,ua,Fo,Ea,Ca],[Di]:[{endpoint:sc,[$i]:co}],[$i]:uo},{[Li]:[da,ua,Fo,Ea,Ra],endpoint:sc,[$i]:co},{[Li]:[Ko,ua,la,Sa],endpoint:{[Hi]:"https://s3.dualstack.us-east-1.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",[qi]:va,[Gi]:sa},[$i]:co},{[Li]:[Ko,ua,la,Ea,Ca],[Di]:[{endpoint:ic,[$i]:co}],[$i]:uo},{[Li]:[Ko,ua,la,Ea,Ra],endpoint:ic,[$i]:co},{[Li]:[da,Vo,Qo,la,Sa],endpoint:{[Hi]:Lo,[qi]:va,[Gi]:sa},[$i]:co},{[Li]:[da,Vo,Qo,la,Ea,Ca],[Di]:[{[Li]:Kc,endpoint:oc,[$i]:co},{endpoint:oc,[$i]:co}],[$i]:uo},{[Li]:[da,Vo,Qo,la,Ea,Ra],endpoint:oc,[$i]:co},{[Li]:[da,ua,la,Sa],endpoint:{[Hi]:_o,[qi]:va,[Gi]:sa},[$i]:co},{[Li]:[da,ua,la,Ea,Ca],[Di]:[{[Li]:Kc,endpoint:{[Hi]:_o,[qi]:Aa,[Gi]:sa},[$i]:co},{endpoint:ac,[$i]:co}],[$i]:uo},{[Li]:[da,ua,la,Ea,Ra],endpoint:ac,[$i]:co}],[$i]:uo},{error:"Path-style addressing cannot be used with S3 Accelerate",[$i]:eo}],[$i]:uo}],[$i]:uo}],[$i]:uo},{[Li]:[{[_i]:Ji,[Bi]:[cc]},{[_i]:Qi,[Bi]:[cc,Yi]}],[Di]:[{[Li]:Cc,[Di]:[{[Li]:iu,[Di]:[ja,Ha,{[Li]:bc,endpoint:{[Hi]:mo,[qi]:uc,[Gi]:sa},[$i]:co},{[Li]:su,endpoint:{[Hi]:"https://s3-object-lambda-fips.{Region}.{partitionResult#dnsSuffix}",[qi]:uc,[Gi]:sa},[$i]:co},{endpoint:{[Hi]:"https://s3-object-lambda.{Region}.{partitionResult#dnsSuffix}",[qi]:uc,[Gi]:sa},[$i]:co}],[$i]:uo},Da],[$i]:uo}],[$i]:uo},{[Li]:[pa],[Di]:[{[Li]:Cc,[Di]:[{[Li]:iu,[Di]:[{[Li]:[Fo,Ko,ua,Sa],endpoint:{[Hi]:"https://s3-fips.dualstack.us-east-1.{partitionResult#dnsSuffix}",[qi]:va,[Gi]:sa},[$i]:co},{[Li]:[Fo,Ko,ua,Ea,Ca],[Di]:[{endpoint:dc,[$i]:co}],[$i]:uo},{[Li]:[Fo,Ko,ua,Ea,Ra],endpoint:dc,[$i]:co},{[Li]:[Fo,da,ua,Sa],endpoint:{[Hi]:"https://s3-fips.us-east-1.{partitionResult#dnsSuffix}",[qi]:va,[Gi]:sa},[$i]:co},{[Li]:[Fo,da,ua,Ea,Ca],[Di]:[{endpoint:lc,[$i]:co}],[$i]:uo},{[Li]:[Fo,da,ua,Ea,Ra],endpoint:lc,[$i]:co},{[Li]:[la,Ko,ua,Sa],endpoint:{[Hi]:"https://s3.dualstack.us-east-1.{partitionResult#dnsSuffix}",[qi]:va,[Gi]:sa},[$i]:co},{[Li]:[la,Ko,ua,Ea,Ca],[Di]:[{endpoint:hc,[$i]:co}],[$i]:uo},{[Li]:[la,Ko,ua,Ea,Ra],endpoint:hc,[$i]:co},{[Li]:[la,da,Vo,Qo,Sa],endpoint:{[Hi]:mo,[qi]:va,[Gi]:sa},[$i]:co},{[Li]:[la,da,Vo,Qo,Ea,Ca],[Di]:[{[Li]:Kc,endpoint:pc,[$i]:co},{endpoint:pc,[$i]:co}],[$i]:uo},{[Li]:[la,da,Vo,Qo,Ea,Ra],endpoint:pc,[$i]:co},{[Li]:[la,da,ua,Sa],endpoint:{[Hi]:Bo,[qi]:va,[Gi]:sa},[$i]:co},{[Li]:[la,da,ua,Ea,Ca],[Di]:[{[Li]:Kc,endpoint:{[Hi]:Bo,[qi]:Aa,[Gi]:sa},[$i]:co},{endpoint:fc,[$i]:co}],[$i]:uo},{[Li]:[la,da,ua,Ea,Ra],endpoint:fc,[$i]:co}],[$i]:uo},Da],[$i]:uo}],[$i]:uo}],[$i]:uo},{error:"A region must be set when sending requests to S3.",[$i]:eo}]},au=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:n}=e.next();if(this.data.delete(r),n||++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 n of r){const r=String(e[n]??"");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"]}),cu=(e,t={})=>au.get(e,()=>((e,t)=>{const{endpointParams:r,logger:n}=t,{parameters:s,rules:i}=e;t.logger?.debug?.(`${fs} Initial EndpointParams: ${ms(r)}`);const o=Object.entries(s).filter(([,e])=>null!=e.default).map(([e,t])=>[e,t.default]);if(o.length>0)for(const[u,d]of o)r[u]=r[u]??d;const a=Object.entries(s).filter(([,e])=>e.required).map(([e])=>e);for(const u of a)if(null==r[u])throw new gs(`Missing required parameter: '${u}'`);const c=Us(i,{endpointParams:r,logger:n,referenceRecord:{}});return t.logger?.debug?.(`${fs} Resolved endpoint: ${ms(c)}`),c})(ou,{endpointParams:e,logger:t.logger}));ps.aws=Ls;const uu=(du=async(e,t,r)=>({operation:P(t).operation,region:await I(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 n=await du(e,t,r),s=P(t)?.commandInstance?.constructor?.getEndpointParameterInstructions;if(!s)throw new Error(`getEndpointParameterInstructions() is not defined on '${t.commandName}'`);const i=await ai(r,{getEndpointParameterInstructions:s},e);return Object.assign(n,i)});var du;function lu(e){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"s3",region:e.region},propertiesExtractor:(e,t)=>({signingProperties:{config:e,context:t}})}}function hu(e){return{schemeId:"aws.auth#sigv4a",signingProperties:{name:"s3",region:e.region},propertiesExtractor:(e,t)=>({signingProperties:{config:e,context:t}})}}const pu=(fu=cu,mu=e=>{const t=[];return e.operation,t.push(lu(e)),t.push(hu(e)),t},gu={"aws.auth#sigv4":lu,"aws.auth#sigv4a":hu},e=>{const t=fu(e),r=t.properties?.authSchemes;if(!r)return mu(e);const n=[];for(const s of r){const{name:t,properties:i={},...o}=s,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"===Ui.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=gu[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},n.push(d)}return n});var fu,mu,gu;const yu=e=>{const t=(e=>(e.sigv4aSigningRegionSet=L(e.sigv4aSigningRegionSet),e))(fr(e));return Object.assign(t,{authSchemePreference:I(e.authSchemePreference??[])})},wu={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 bu extends kr{constructor(e){super(e),Object.setPrototypeOf(this,bu.prototype)}}class Su extends bu{name="NoSuchUpload";$fault="client";constructor(e){super({name:"NoSuchUpload",$fault:"client",...e}),Object.setPrototypeOf(this,Su.prototype)}}class vu extends bu{name="ObjectNotInActiveTierError";$fault="client";constructor(e){super({name:"ObjectNotInActiveTierError",$fault:"client",...e}),Object.setPrototypeOf(this,vu.prototype)}}class Eu extends bu{name="BucketAlreadyExists";$fault="client";constructor(e){super({name:"BucketAlreadyExists",$fault:"client",...e}),Object.setPrototypeOf(this,Eu.prototype)}}class Cu extends bu{name="BucketAlreadyOwnedByYou";$fault="client";constructor(e){super({name:"BucketAlreadyOwnedByYou",$fault:"client",...e}),Object.setPrototypeOf(this,Cu.prototype)}}class xu extends bu{name="NoSuchBucket";$fault="client";constructor(e){super({name:"NoSuchBucket",$fault:"client",...e}),Object.setPrototypeOf(this,xu.prototype)}}class Au extends bu{name="InvalidObjectState";$fault="client";StorageClass;AccessTier;constructor(e){super({name:"InvalidObjectState",$fault:"client",...e}),Object.setPrototypeOf(this,Au.prototype),this.StorageClass=e.StorageClass,this.AccessTier=e.AccessTier}}class Ru extends bu{name="NoSuchKey";$fault="client";constructor(e){super({name:"NoSuchKey",$fault:"client",...e}),Object.setPrototypeOf(this,Ru.prototype)}}class ku extends bu{name="NotFound";$fault="client";constructor(e){super({name:"NotFound",$fault:"client",...e}),Object.setPrototypeOf(this,ku.prototype)}}class Tu extends bu{name="EncryptionTypeMismatch";$fault="client";constructor(e){super({name:"EncryptionTypeMismatch",$fault:"client",...e}),Object.setPrototypeOf(this,Tu.prototype)}}class Pu extends bu{name="InvalidRequest";$fault="client";constructor(e){super({name:"InvalidRequest",$fault:"client",...e}),Object.setPrototypeOf(this,Pu.prototype)}}class Iu extends bu{name="InvalidWriteOffset";$fault="client";constructor(e){super({name:"InvalidWriteOffset",$fault:"client",...e}),Object.setPrototypeOf(this,Iu.prototype)}}class Mu extends bu{name="TooManyParts";$fault="client";constructor(e){super({name:"TooManyParts",$fault:"client",...e}),Object.setPrototypeOf(this,Mu.prototype)}}class Ou extends bu{name="IdempotencyParameterMismatch";$fault="client";constructor(e){super({name:"IdempotencyParameterMismatch",$fault:"client",...e}),Object.setPrototypeOf(this,Ou.prototype)}}class Uu extends bu{name="ObjectAlreadyInActiveTierError";$fault="client";constructor(e){super({name:"ObjectAlreadyInActiveTierError",$fault:"client",...e}),Object.setPrototypeOf(this,Uu.prototype)}}const Nu="AccessKeyId",$u="Bucket",Du="BypassGovernanceRetention",Lu="BucketKeyEnabled",_u="Body",Bu="ChecksumAlgorithm",zu="CacheControl",ju="ChecksumCRC32",Hu="ChecksumCRC32C",qu="ChecksumCRC64NVME",Fu="Cache-Control",Ku="Content-Disposition",Vu="ContentDisposition",Wu="Content-Encoding",Zu="ContentEncoding",Gu="ContentLanguage",Xu="Content-Language",Yu="Content-Length",Ju="ContentLength",Qu="CopyObjectResult",ed="ChecksumSHA1",td="ChecksumSHA256",rd="CopySourceSSECustomerKey",nd="ChecksumType",sd="Content-Type",id="ContentType",od="ContinuationToken",ad="Credentials",cd="DeleteMarker",ud="Delete",dd="Delimiter",ld="Expiration",hd="ExpectedBucketOwner",pd="ExpiresString",fd="ETag",md="EncodingType",gd="Errors",yd="Error",wd="Expires",bd="GrantFullControl",Sd="GrantRead",vd="GrantReadACP",Ed="GrantWriteACP",Cd="IfMatch",xd="If-Match",Ad="IfNoneMatch",Rd="If-None-Match",kd="Key",Td="LastModified",Pd="Metadata",Id="MaxKeys",Md="Owner",Od="ObjectLockLegalHoldStatus",Ud="ObjectLockMode",Nd="ObjectLockRetainUntilDate",$d="Object",Dd="Prefix",Ld="RequestCharged",_d="RequestPayer",Bd="RestoreStatus",zd="Range",jd="StartAfter",Hd="SecretAccessKey",qd="StorageClass",Fd="ServerSideEncryption",Kd="SSECustomerAlgorithm",Vd="SSECustomerKey",Wd="SSECustomerKeyMD5",Zd="SSEKMSEncryptionContext",Gd="SSEKMSKeyId",Xd="SessionToken",Yd="Size",Jd="Tagging",Qd="VersionId",el="WebsiteRedirectLocation",tl="client",rl="error",nl="http",sl="httpChecksum",il="httpError",ol="httpHeader",al="httpPayload",cl="httpPrefixHeaders",ul="httpQuery",dl="streaming",ll="smithy.ts.sdk.synthetic.com.amazonaws.s3",hl="versionId",pl="xmlFlattened",fl="xmlName",ml="x-amz-acl",gl="x-amz-bypass-governance-retention",yl="x-amz-checksum-crc32",wl="x-amz-checksum-crc32c",bl="x-amz-checksum-crc64nvme",Sl="x-amz-checksum-sha1",vl="x-amz-checksum-sha256",El="x-amz-checksum-type",Cl="x-amz-delete-marker",xl="x-amz-expiration",Al="x-amz-expected-bucket-owner",Rl="x-amz-grant-full-control",kl="x-amz-grant-read",Tl="x-amz-grant-read-acp",Pl="x-amz-grant-write-acp",Il="x-amz-meta-",Ml="x-amz-mfa",Ol="x-amz-object-lock-legal-hold",Ul="x-amz-object-lock-mode",Nl="x-amz-object-lock-retain-until-date",$l="x-amz-request-charged",Dl="x-amz-request-payer",Ll="x-amz-storage-class",_l="x-amz-sdk-checksum-algorithm",Bl="x-amz-server-side-encryption",zl="x-amz-server-side-encryption-aws-kms-key-id",jl="x-amz-server-side-encryption-bucket-key-enabled",Hl="x-amz-server-side-encryption-context",ql="x-amz-server-side-encryption-customer-algorithm",Fl="x-amz-server-side-encryption-customer-key",Kl="x-amz-server-side-encryption-customer-key-MD5",Vl="x-amz-tagging",Wl="x-amz-version-id",Zl="x-amz-website-redirect-location",Gl="com.amazonaws.s3";var Xl=[0,Gl,rd,8,0],Yl=[0,Gl,"SessionCredentialValue",8,0],Jl=[0,Gl,Vd,8,0],Ql=[0,Gl,Zd,8,0],eh=[0,Gl,Gd,8,0],th=[0,Gl,"StreamingBlob",{[dl]:1},42],rh=[-3,Gl,"BucketAlreadyExists",{[rl]:tl,[il]:409},[],[]];Pe.for(Gl).registerError(rh,Eu);var nh=[-3,Gl,"BucketAlreadyOwnedByYou",{[rl]:tl,[il]:409},[],[]];Pe.for(Gl).registerError(nh,Cu);var sh=[3,Gl,"CommonPrefix",0,[Dd],[0]],ih=[3,Gl,"CopyObjectOutput",0,[Qu,ld,"CopySourceVersionId",Qd,Fd,Kd,Wd,Gd,Zd,Lu,Ld],[[()=>ah,16],[0,{[ol]:xl}],[0,{[ol]:"x-amz-copy-source-version-id"}],[0,{[ol]:Wl}],[0,{[ol]:Bl}],[0,{[ol]:ql}],[0,{[ol]:Kl}],[()=>eh,{[ol]:zl}],[()=>Ql,{[ol]:Hl}],[2,{[ol]:jl}],[0,{[ol]:$l}]]],oh=[3,Gl,"CopyObjectRequest",0,["ACL",$u,zu,Bu,Vu,Zu,Gu,id,"CopySource","CopySourceIfMatch","CopySourceIfModifiedSince","CopySourceIfNoneMatch","CopySourceIfUnmodifiedSince",wd,bd,Sd,vd,Ed,Cd,Ad,kd,Pd,"MetadataDirective","TaggingDirective",Fd,qd,el,Kd,Vd,Wd,Gd,Zd,Lu,"CopySourceSSECustomerAlgorithm",rd,"CopySourceSSECustomerKeyMD5",_d,Jd,Ud,Nd,Od,hd,"ExpectedSourceBucketOwner"],[[0,{[ol]:ml}],[0,1],[0,{[ol]:Fu}],[0,{[ol]:"x-amz-checksum-algorithm"}],[0,{[ol]:Ku}],[0,{[ol]:Wu}],[0,{[ol]:Xu}],[0,{[ol]:sd}],[0,{[ol]:"x-amz-copy-source"}],[0,{[ol]:"x-amz-copy-source-if-match"}],[4,{[ol]:"x-amz-copy-source-if-modified-since"}],[0,{[ol]:"x-amz-copy-source-if-none-match"}],[4,{[ol]:"x-amz-copy-source-if-unmodified-since"}],[4,{[ol]:wd}],[0,{[ol]:Rl}],[0,{[ol]:kl}],[0,{[ol]:Tl}],[0,{[ol]:Pl}],[0,{[ol]:xd}],[0,{[ol]:Rd}],[0,1],[128,{[cl]:Il}],[0,{[ol]:"x-amz-metadata-directive"}],[0,{[ol]:"x-amz-tagging-directive"}],[0,{[ol]:Bl}],[0,{[ol]:Ll}],[0,{[ol]:Zl}],[0,{[ol]:ql}],[()=>Jl,{[ol]:Fl}],[0,{[ol]:Kl}],[()=>eh,{[ol]:zl}],[()=>Ql,{[ol]:Hl}],[2,{[ol]:jl}],[0,{[ol]:"x-amz-copy-source-server-side-encryption-customer-algorithm"}],[()=>Xl,{[ol]:"x-amz-copy-source-server-side-encryption-customer-key"}],[0,{[ol]:"x-amz-copy-source-server-side-encryption-customer-key-MD5"}],[0,{[ol]:Dl}],[0,{[ol]:Vl}],[0,{[ol]:Ul}],[5,{[ol]:Nl}],[0,{[ol]:Ol}],[0,{[ol]:Al}],[0,{[ol]:"x-amz-source-expected-bucket-owner"}]]],ah=[3,Gl,Qu,0,[fd,Td,nd,ju,Hu,qu,ed,td],[0,4,0,0,0,0,0,0]],ch=[3,Gl,"CreateSessionOutput",{[fl]:"CreateSessionResult"},[Fd,Gd,Zd,Lu,ad],[[0,{[ol]:Bl}],[()=>eh,{[ol]:zl}],[()=>Ql,{[ol]:Hl}],[2,{[ol]:jl}],[()=>_h,{[fl]:ad}]]],uh=[3,Gl,"CreateSessionRequest",0,["SessionMode",$u,Fd,Gd,Zd,Lu],[[0,{[ol]:"x-amz-create-session-mode"}],[0,1],[0,{[ol]:Bl}],[()=>eh,{[ol]:zl}],[()=>Ql,{[ol]:Hl}],[2,{[ol]:jl}]]],dh=[3,Gl,ud,0,["Objects","Quiet"],[[()=>Fh,{[pl]:1,[fl]:$d}],2]],lh=[3,Gl,"DeletedObject",0,[kd,Qd,cd,"DeleteMarkerVersionId"],[0,0,2,0]],hh=[3,Gl,"DeleteObjectOutput",0,[cd,Qd,Ld],[[2,{[ol]:Cl}],[0,{[ol]:Wl}],[0,{[ol]:$l}]]],ph=[3,Gl,"DeleteObjectRequest",0,[$u,kd,"MFA",Qd,_d,Du,hd,Cd,"IfMatchLastModifiedTime","IfMatchSize"],[[0,1],[0,1],[0,{[ol]:Ml}],[0,{[ul]:hl}],[0,{[ol]:Dl}],[2,{[ol]:gl}],[0,{[ol]:Al}],[0,{[ol]:xd}],[6,{[ol]:"x-amz-if-match-last-modified-time"}],[1,{[ol]:"x-amz-if-match-size"}]]],fh=[3,Gl,"DeleteObjectsOutput",{[fl]:"DeleteResult"},["Deleted",Ld,gd],[[()=>Hh,{[pl]:1}],[0,{[ol]:$l}],[()=>qh,{[pl]:1,[fl]:yd}]]],mh=[3,Gl,"DeleteObjectsRequest",0,[$u,ud,"MFA",_d,Du,hd,Bu],[[0,1],[()=>dh,{[al]:1,[fl]:ud}],[0,{[ol]:Ml}],[0,{[ol]:Dl}],[2,{[ol]:gl}],[0,{[ol]:Al}],[0,{[ol]:_l}]]],gh=[-3,Gl,"EncryptionTypeMismatch",{[rl]:tl,[il]:400},[],[]];Pe.for(Gl).registerError(gh,Tu);var yh=[3,Gl,yd,0,[kd,Qd,"Code","Message"],[0,0,0,0]],wh=[3,Gl,"GetObjectOutput",0,[_u,cd,"AcceptRanges",ld,"Restore",Td,Ju,fd,ju,Hu,qu,ed,td,nd,"MissingMeta",Qd,zu,Vu,Zu,Gu,"ContentRange",id,wd,pd,el,Fd,Pd,Kd,Wd,Gd,Lu,qd,Ld,"ReplicationStatus","PartsCount","TagCount",Ud,Nd,Od],[[()=>th,16],[2,{[ol]:Cl}],[0,{[ol]:"accept-ranges"}],[0,{[ol]:xl}],[0,{[ol]:"x-amz-restore"}],[4,{[ol]:"Last-Modified"}],[1,{[ol]:Yu}],[0,{[ol]:fd}],[0,{[ol]:yl}],[0,{[ol]:wl}],[0,{[ol]:bl}],[0,{[ol]:Sl}],[0,{[ol]:vl}],[0,{[ol]:El}],[1,{[ol]:"x-amz-missing-meta"}],[0,{[ol]:Wl}],[0,{[ol]:Fu}],[0,{[ol]:Ku}],[0,{[ol]:Wu}],[0,{[ol]:Xu}],[0,{[ol]:"Content-Range"}],[0,{[ol]:sd}],[4,{[ol]:wd}],[0,{[ol]:pd}],[0,{[ol]:Zl}],[0,{[ol]:Bl}],[128,{[cl]:Il}],[0,{[ol]:ql}],[0,{[ol]:Kl}],[()=>eh,{[ol]:zl}],[2,{[ol]:jl}],[0,{[ol]:Ll}],[0,{[ol]:$l}],[0,{[ol]:"x-amz-replication-status"}],[1,{[ol]:"x-amz-mp-parts-count"}],[1,{[ol]:"x-amz-tagging-count"}],[0,{[ol]:Ul}],[5,{[ol]:Nl}],[0,{[ol]:Ol}]]],bh=[3,Gl,"GetObjectRequest",0,[$u,Cd,"IfModifiedSince",Ad,"IfUnmodifiedSince",kd,zd,"ResponseCacheControl","ResponseContentDisposition","ResponseContentEncoding","ResponseContentLanguage","ResponseContentType","ResponseExpires",Qd,Kd,Vd,Wd,_d,"PartNumber",hd,"ChecksumMode"],[[0,1],[0,{[ol]:xd}],[4,{[ol]:"If-Modified-Since"}],[0,{[ol]:Rd}],[4,{[ol]:"If-Unmodified-Since"}],[0,1],[0,{[ol]:zd}],[0,{[ul]:"response-cache-control"}],[0,{[ul]:"response-content-disposition"}],[0,{[ul]:"response-content-encoding"}],[0,{[ul]:"response-content-language"}],[0,{[ul]:"response-content-type"}],[6,{[ul]:"response-expires"}],[0,{[ul]:hl}],[0,{[ol]:ql}],[()=>Jl,{[ol]:Fl}],[0,{[ol]:Kl}],[0,{[ol]:Dl}],[1,{[ul]:"partNumber"}],[0,{[ol]:Al}],[0,{[ol]:"x-amz-checksum-mode"}]]],Sh=[-3,Gl,"IdempotencyParameterMismatch",{[rl]:tl,[il]:400},[],[]];Pe.for(Gl).registerError(Sh,Ou);var vh=[-3,Gl,"InvalidObjectState",{[rl]:tl,[il]:403},[qd,"AccessTier"],[0,0]];Pe.for(Gl).registerError(vh,Au);var Eh=[-3,Gl,"InvalidRequest",{[rl]:tl,[il]:400},[],[]];Pe.for(Gl).registerError(Eh,Pu);var Ch=[-3,Gl,"InvalidWriteOffset",{[rl]:tl,[il]:400},[],[]];Pe.for(Gl).registerError(Ch,Iu);var xh=[3,Gl,"ListObjectsV2Output",{[fl]:"ListBucketResult"},["IsTruncated","Contents","Name",Dd,dd,Id,"CommonPrefixes",md,"KeyCount",od,"NextContinuationToken",jd,Ld],[2,[()=>Kh,{[pl]:1}],0,0,0,1,[()=>jh,{[pl]:1}],0,1,0,0,0,[0,{[ol]:$l}]]],Ah=[3,Gl,"ListObjectsV2Request",0,[$u,dd,md,Id,Dd,od,"FetchOwner",jd,_d,hd,"OptionalObjectAttributes"],[[0,1],[0,{[ul]:"delimiter"}],[0,{[ul]:"encoding-type"}],[1,{[ul]:"max-keys"}],[0,{[ul]:"prefix"}],[0,{[ul]:"continuation-token"}],[2,{[ul]:"fetch-owner"}],[0,{[ul]:"start-after"}],[0,{[ol]:Dl}],[0,{[ol]:Al}],[64,{[ol]:"x-amz-optional-object-attributes"}]]],Rh=[-3,Gl,"NoSuchBucket",{[rl]:tl,[il]:404},[],[]];Pe.for(Gl).registerError(Rh,xu);var kh=[-3,Gl,"NoSuchKey",{[rl]:tl,[il]:404},[],[]];Pe.for(Gl).registerError(kh,Ru);var Th=[-3,Gl,"NoSuchUpload",{[rl]:tl,[il]:404},[],[]];Pe.for(Gl).registerError(Th,Su);var Ph=[-3,Gl,"NotFound",{[rl]:tl},[],[]];Pe.for(Gl).registerError(Ph,ku);var Ih=[3,Gl,$d,0,[kd,Td,fd,Bu,nd,Yd,qd,Md,Bd],[0,4,0,[64,{[pl]:1}],0,1,0,()=>Nh,()=>Lh]],Mh=[-3,Gl,"ObjectAlreadyInActiveTierError",{[rl]:tl,[il]:403},[],[]];Pe.for(Gl).registerError(Mh,Uu);var Oh=[3,Gl,"ObjectIdentifier",0,[kd,Qd,fd,"LastModifiedTime",Yd],[0,0,0,6,1]],Uh=[-3,Gl,"ObjectNotInActiveTierError",{[rl]:tl,[il]:403},[],[]];Pe.for(Gl).registerError(Uh,vu);var Nh=[3,Gl,Md,0,["DisplayName","ID"],[0,0]],$h=[3,Gl,"PutObjectOutput",0,[ld,fd,ju,Hu,qu,ed,td,nd,Fd,Qd,Kd,Wd,Gd,Zd,Lu,Yd,Ld],[[0,{[ol]:xl}],[0,{[ol]:fd}],[0,{[ol]:yl}],[0,{[ol]:wl}],[0,{[ol]:bl}],[0,{[ol]:Sl}],[0,{[ol]:vl}],[0,{[ol]:El}],[0,{[ol]:Bl}],[0,{[ol]:Wl}],[0,{[ol]:ql}],[0,{[ol]:Kl}],[()=>eh,{[ol]:zl}],[()=>Ql,{[ol]:Hl}],[2,{[ol]:jl}],[1,{[ol]:"x-amz-object-size"}],[0,{[ol]:$l}]]],Dh=[3,Gl,"PutObjectRequest",0,["ACL",_u,$u,zu,Vu,Zu,Gu,Ju,"ContentMD5",id,Bu,ju,Hu,qu,ed,td,wd,Cd,Ad,bd,Sd,vd,Ed,kd,"WriteOffsetBytes",Pd,Fd,qd,el,Kd,Vd,Wd,Gd,Zd,Lu,_d,Jd,Ud,Nd,Od,hd],[[0,{[ol]:ml}],[()=>th,16],[0,1],[0,{[ol]:Fu}],[0,{[ol]:Ku}],[0,{[ol]:Wu}],[0,{[ol]:Xu}],[1,{[ol]:Yu}],[0,{[ol]:"Content-MD5"}],[0,{[ol]:sd}],[0,{[ol]:_l}],[0,{[ol]:yl}],[0,{[ol]:wl}],[0,{[ol]:bl}],[0,{[ol]:Sl}],[0,{[ol]:vl}],[4,{[ol]:wd}],[0,{[ol]:xd}],[0,{[ol]:Rd}],[0,{[ol]:Rl}],[0,{[ol]:kl}],[0,{[ol]:Tl}],[0,{[ol]:Pl}],[0,1],[1,{[ol]:"x-amz-write-offset-bytes"}],[128,{[cl]:Il}],[0,{[ol]:Bl}],[0,{[ol]:Ll}],[0,{[ol]:Zl}],[0,{[ol]:ql}],[()=>Jl,{[ol]:Fl}],[0,{[ol]:Kl}],[()=>eh,{[ol]:zl}],[()=>Ql,{[ol]:Hl}],[2,{[ol]:jl}],[0,{[ol]:Dl}],[0,{[ol]:Vl}],[0,{[ol]:Ul}],[5,{[ol]:Nl}],[0,{[ol]:Ol}],[0,{[ol]:Al}]]],Lh=[3,Gl,Bd,0,["IsRestoreInProgress","RestoreExpiryDate"],[2,4]],_h=[3,Gl,"SessionCredentials",0,[Nu,Hd,Xd,ld],[[0,{[fl]:Nu}],[()=>Yl,{[fl]:Hd}],[()=>Yl,{[fl]:Xd}],[4,{[fl]:ld}]]],Bh=[-3,Gl,"TooManyParts",{[rl]:tl,[il]:400},[],[]];Pe.for(Gl).registerError(Bh,Mu);var zh=[-3,ll,"S3ServiceException",0,[],[]];Pe.for(ll).registerError(zh,bu);var jh=[1,Gl,"CommonPrefixList",0,()=>sh],Hh=[1,Gl,"DeletedObjects",0,()=>lh],qh=[1,Gl,gd,0,()=>yh],Fh=[1,Gl,"ObjectIdentifierList",0,()=>Oh],Kh=[1,Gl,"ObjectList",0,[()=>Ih,0]],Vh=[9,Gl,"CopyObject",{[nl]:["PUT","/{Key+}?x-id=CopyObject",200]},()=>oh,()=>ih],Wh=[9,Gl,"CreateSession",{[nl]:["GET","/?session",200]},()=>uh,()=>ch],Zh=[9,Gl,"DeleteObject",{[nl]:["DELETE","/{Key+}?x-id=DeleteObject",204]},()=>ph,()=>hh],Gh=[9,Gl,"DeleteObjects",{[sl]:"-",[nl]:["POST","/?delete",200]},()=>mh,()=>fh],Xh=[9,Gl,"GetObject",{[sl]:"-",[nl]:["GET","/{Key+}?x-id=GetObject",200]},()=>bh,()=>wh],Yh=[9,Gl,"ListObjectsV2",{[nl]:["GET","/?list-type=2",200]},()=>Ah,()=>xh],Jh=[9,Gl,"PutObject",{[sl]:"-",[nl]:["PUT","/{Key+}?x-id=PutObject",200]},()=>Dh,()=>$h];class Qh extends(Ar.classBuilder().ep({...wu,DisableS3ExpressSessionAuth:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function(e,t,r,n){return[di(r,e.getEndpointParameterInstructions()),is(r)]}).s("AmazonS3","CreateSession",{}).n("S3Client","CreateSessionCommand").sc(Wh).build()){}const ep="3.965.0";function tp(e){return"string"==typeof e?0===e.length:0===e.byteLength}var rp={name:"SHA-1"},np={name:"HMAC",hash:rp},sp=new Uint8Array([218,57,163,238,94,107,75,13,50,85,191,239,149,96,24,144,175,216,7,9]);const ip={};function op(){return"undefined"!=typeof window?window:"undefined"!=typeof self?self:ip}var ap=function(){function e(e){this.toHash=new Uint8Array(0),void 0!==e&&(this.key=new Promise(function(t,r){op().crypto.subtle.importKey("raw",cp(e),np,!1,["sign"]).then(t,r)}),this.key.catch(function(){}))}return e.prototype.update=function(e){if(!tp(e)){var t=cp(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 op().crypto.subtle.sign(np,t,e.toHash).then(function(e){return new Uint8Array(e)})}):tp(this.toHash)?Promise.resolve(sp):Promise.resolve().then(function(){return op().crypto.subtle.digest(rp,e.toHash)}).then(function(e){return Promise.resolve(new Uint8Array(e))})},e.prototype.reset=function(){this.toHash=new Uint8Array(0)},e}();function cp(e){return"string"==typeof e?Yr(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e)}var up=["decrypt","digest","encrypt","exportKey","generateKey","importKey","sign","verify"];function dp(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&&up.every(function(t){return"function"==typeof e[t]})}(e.crypto.subtle)}var lp=function(){function e(e){if(!dp(op()))throw new Error("SHA1 not supported");this.hash=new ap(e)}return e.prototype.update=function(e,t){this.hash.update(Qr(e))},e.prototype.digest=function(){return this.hash.digest()},e.prototype.reset=function(){this.hash.reset()},e}(),hp={name:"SHA-256"},pp={name:"HMAC",hash:hp},fp=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]),mp=function(){function e(e){this.toHash=new Uint8Array(0),this.secret=e,this.reset()}return e.prototype.update=function(e){if(!en(e)){var t=Qr(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 op().crypto.subtle.sign(pp,t,e.toHash).then(function(e){return new Uint8Array(e)})}):en(this.toHash)?Promise.resolve(fp):Promise.resolve().then(function(){return op().crypto.subtle.digest(hp,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){op().crypto.subtle.importKey("raw",Qr(e.secret),pp,!1,["sign"]).then(t,r)}),this.key.catch(function(){}))},e}(),gp=64,yp=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]),wp=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],bp=Math.pow(2,53)-1,Sp=function(){function e(){this.state=Int32Array.from(wp),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>bp)throw new Error("Cannot hash more than 2^53 - 1 bits");for(;r>0;)this.buffer[this.bufferLength++]=e[t++],r--,this.bufferLength===gp&&(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%gp>=56){for(var n=this.bufferLength;n<gp;n++)t.setUint8(n,0);this.hashBuffer(),this.bufferLength=0}for(n=this.bufferLength;n<56;n++)t.setUint8(n,0);t.setUint32(56,Math.floor(e/4294967296),!0),t.setUint32(60,e),this.hashBuffer(),this.finished=!0}var s=new Uint8Array(32);for(n=0;n<8;n++)s[4*n]=this.state[n]>>>24&255,s[4*n+1]=this.state[n]>>>16&255,s[4*n+2]=this.state[n]>>>8&255,s[4*n+3]=this.state[n]>>>0&255;return s},e.prototype.hashBuffer=function(){for(var e=this.buffer,t=this.state,r=t[0],n=t[1],s=t[2],i=t[3],o=t[4],a=t[5],c=t[6],u=t[7],d=0;d<gp;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,p=((l=this.temp[d-15])>>>7|l<<25)^(l>>>18|l<<14)^l>>>3;this.temp[d]=(h+this.temp[d-7]|0)+(p+this.temp[d-16]|0)}var f=(((o>>>6|o<<26)^(o>>>11|o<<21)^(o>>>25|o<<7))+(o&a^~o&c)|0)+(u+(yp[d]+this.temp[d]|0)|0)|0,m=((r>>>2|r<<30)^(r>>>13|r<<19)^(r>>>22|r<<10))+(r&n^r&s^n&s)|0;u=c,c=a,a=o,o=i+f|0,i=s,s=n,n=r,r=f+m|0}t[0]+=r,t[1]+=n,t[2]+=s,t[3]+=i,t[4]+=o,t[5]+=a,t[6]+=c,t[7]+=u},e}(),vp=function(){function e(e){this.secret=e,this.hash=new Sp,this.reset()}return e.prototype.update=function(e){if(!en(e)&&!this.error)try{this.hash.update(Qr(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 Zr(this,void 0,void 0,function(){return Gr(this,function(e){return[2,this.digestSync()]})})},e.prototype.reset=function(){if(this.hash=new Sp,this.secret){this.outer=new Sp;var e=function(e){var t=Qr(e);if(t.byteLength>gp){var r=new Sp;r.update(t),t=r.digest()}var n=new Uint8Array(gp);return n.set(t),n}(this.secret),t=new Uint8Array(gp);t.set(e);for(var r=0;r<gp;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 Ep=function(){function e(e){dp(op())?this.hash=new mp(e):this.hash=new vp(e)}return e.prototype.update=function(e,t){this.hash.update(Qr(e))},e.prototype.digest=function(){return this.hash.digest()},e.prototype.reset=function(){this.hash.reset()},e}();const Cp=({serviceId:e,clientVersion:t})=>async r=>{const n="undefined"!=typeof window?window.navigator:void 0,s=n?.userAgent??"",i=n?.userAgentData?.platform??xp.os(s)??"other",o=n?.userAgentData?.brands??[],a=o[o.length-1],c=a?.brand??xp.browser(s)??"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},xp={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 Ap{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,n=Math.abs(Math.round(e));r>-1&&n>0;r--,n/=256)t[r]=n;return e<0&&Rp(t),new Ap(t)}valueOf(){const e=this.bytes.slice(0),t=128&e[0];return t&&Rp(e),parseInt(he(e),16)*(t?-1:1)}toString(){return String(this.valueOf())}}function Rp(e){for(let t=0;t<8;t++)e[t]^=255;for(let t=7;t>-1&&(e[t]++,0===e[t]);t--);}class kp{toUtf8;fromUtf8;constructor(e,t){this.toUtf8=e,this.fromUtf8=t}format(e){const t=[];for(const s of Object.keys(e)){const r=this.fromUtf8(s);t.push(Uint8Array.from([r.byteLength]),r,this.formatHeaderValue(e[s]))}const r=new Uint8Array(t.reduce((e,t)=>e+t.byteLength,0));let n=0;for(const s of t)r.set(s,n),n+=s.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 n=new Uint8Array(9);return n[0]=5,n.set(e.value.bytes,1),n;case"binary":const s=new DataView(new ArrayBuffer(3+e.value.byteLength));s.setUint8(0,6),s.setUint16(1,e.value.byteLength,!1);const i=new Uint8Array(s.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(Ap.fromNumber(e.value.valueOf()).bytes,1),u;case"uuid":if(!_p.test(e.value))throw new Error(`Invalid UUID received: ${e.value}`);const d=new Uint8Array(17);return d[0]=9,d.set(le(e.value.replace(/\-/g,"")),1),d}}parse(e){const t={};let r=0;for(;r<e.byteLength;){const n=e.getUint8(r++),s=this.toUtf8(new Uint8Array(e.buffer,e.byteOffset+r,n));switch(r+=n,e.getUint8(r++)){case 0:t[s]={type:Pp,value:!0};break;case 1:t[s]={type:Pp,value:!1};break;case 2:t[s]={type:Ip,value:e.getInt8(r++)};break;case 3:t[s]={type:Mp,value:e.getInt16(r,!1)},r+=2;break;case 4:t[s]={type:Op,value:e.getInt32(r,!1)},r+=4;break;case 5:t[s]={type:Up,value:new Ap(new Uint8Array(e.buffer,e.byteOffset+r,8))},r+=8;break;case 6:const n=e.getUint16(r,!1);r+=2,t[s]={type:Np,value:new Uint8Array(e.buffer,e.byteOffset+r,n)},r+=n;break;case 7:const i=e.getUint16(r,!1);r+=2,t[s]={type:$p,value:this.toUtf8(new Uint8Array(e.buffer,e.byteOffset+r,i))},r+=i;break;case 8:t[s]={type:Dp,value:new Date(new Ap(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[s]={type:Lp,value:`${he(o.subarray(0,4))}-${he(o.subarray(4,6))}-${he(o.subarray(6,8))}-${he(o.subarray(8,10))}-${he(o.subarray(10))}`};break;default:throw new Error("Unrecognized header type tag")}}return t}}var Tp;!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"}(Tp||(Tp={}));const Pp="boolean",Ip="byte",Mp="short",Op="integer",Up="long",Np="binary",$p="string",Dp="timestamp",Lp="uuid",_p=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;class Bp{headerMarshaller;messageBuffer;isEndOfStream;constructor(e,t){this.headerMarshaller=new kp(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),n=r.byteLength+t.byteLength+16,s=new Uint8Array(n),i=new DataView(s.buffer,s.byteOffset,s.byteLength),o=new bn;return i.setUint32(0,n,!1),i.setUint32(4,r.byteLength,!1),i.setUint32(8,o.update(s.subarray(0,8)).digest(),!1),s.set(r,12),s.set(t,r.byteLength+12),i.setUint32(n-4,o.update(s.subarray(8,n-4)).digest(),!1),s}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 n=new DataView(r,t,e),s=n.getUint32(0,!1);if(e!==s)throw new Error("Reported message length does not match received message length");const i=n.getUint32(4,!1),o=n.getUint32(8,!1),a=n.getUint32(e-4,!1),c=(new bn).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,s-i-16)}}(e);return{headers:this.headerMarshaller.parse(t),body:r}}formatHeaders(e){return this.headerMarshaller.format(e)}}class zp{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 jp{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 Hp{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 qp{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 Fp(e,t){return async function(r){const{value:n}=r.headers[":message-type"];if("error"===n){const e=new Error(r.headers[":error-message"].value||"UnknownError");throw e.name=r.headers[":error-code"].value,e}if("exception"===n){const n=r.headers[":exception-type"].value,s={[n]:r},i=await e(s);if(i.$unknown){const e=new Error(t(r.body));throw e.name=n,e}throw i[n]}if("event"===n){const t={[r.headers[":event-type"].value]:r},n=await e(t);if(n.$unknown)return;return n}throw Error(`Unrecognizable event type: ${r.headers[":event-type"].value}`)}}let Kp=class{eventStreamCodec;utfEncoder;constructor({utf8Encoder:e,utf8Decoder:t}){this.eventStreamCodec=new Bp(e,t),this.utfEncoder=e}deserialize(e,t){const r=function(e){let t=0,r=0,n=null,s=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,n=new Uint8Array(e),new DataView(n.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 n)}const c=e.length;let u=0;for(;u<c;){if(!n){const t=c-u;s||(s=new Uint8Array(4));const n=Math.min(4-r,t);if(s.set(e.slice(u,u+n),r),r+=n,u+=n,r<4)break;i(new DataView(s.buffer).getUint32(0,!1)),s=null}const o=Math.min(t-r,c-u);n.set(e.slice(u,u+o),r),r+=o,u+=o,t&&t===r&&(yield n,n=null,t=0,r=0)}}}}}(e);return new Hp({messageStream:new zp({inputStream:r,decoder:this.eventStreamCodec}),deserializer:Fp(t,this.utfEncoder)})}serialize(e,t){return new jp({messageStream:new qp({inputStream:e,serializer:t}),encoder:this.eventStreamCodec,includeEndFrame:!0})}};class Vp{universalMarshaller;constructor({utf8Encoder:e,utf8Decoder:t}){this.universalMarshaller=new Kp({utf8Decoder:t,utf8Encoder:e})}deserialize(e,t){const r=Wp(e)?(n=e,{[Symbol.asyncIterator]:async function*(){const e=n.getReader();try{for(;;){const{done:t,value:r}=await e.read();if(t)return;yield r}}finally{e.releaseLock()}}}):e;var n;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:n}=await t.next();if(r)return e.close();e.enqueue(n)}})})(r):r}}const Wp=e=>"function"==typeof ReadableStream&&e instanceof ReadableStream,Zp=e=>new Vp(e);const Gp=async function(e,t){const r=new e;return await async function(e,t,r=1048576){const n=e.size;let s=0;for(;s<n;){const i=e.slice(s,Math.min(n,s+r));t(new Uint8Array(await i.arrayBuffer())),s+=i.size}}(t,e=>{r.update(e)}),r.digest()},Xp=64,Yp=[1732584193,4023233417,2562383102,271733878];class Jp{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 H(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:n}=t;for(this.bytesHashed+=n;n>0;)this.buffer.setUint8(this.bufferLength++,t[r++]),n--,this.bufferLength===Xp&&(this.hashBuffer(),this.bufferLength=0)}async digest(){if(!this.finished){const{buffer:e,bufferLength:t,bytesHashed:r}=this,n=8*r;if(e.setUint8(this.bufferLength++,128),t%Xp>=56){for(let t=this.bufferLength;t<Xp;t++)e.setUint8(t,0);this.hashBuffer(),this.bufferLength=0}for(let s=this.bufferLength;s<56;s++)e.setUint8(s,0);e.setUint32(56,n>>>0,!0),e.setUint32(60,Math.floor(n/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],n=t[1],s=t[2],i=t[3];r=ef(r,n,s,i,e.getUint32(0,!0),7,3614090360),i=ef(i,r,n,s,e.getUint32(4,!0),12,3905402710),s=ef(s,i,r,n,e.getUint32(8,!0),17,606105819),n=ef(n,s,i,r,e.getUint32(12,!0),22,3250441966),r=ef(r,n,s,i,e.getUint32(16,!0),7,4118548399),i=ef(i,r,n,s,e.getUint32(20,!0),12,1200080426),s=ef(s,i,r,n,e.getUint32(24,!0),17,2821735955),n=ef(n,s,i,r,e.getUint32(28,!0),22,4249261313),r=ef(r,n,s,i,e.getUint32(32,!0),7,1770035416),i=ef(i,r,n,s,e.getUint32(36,!0),12,2336552879),s=ef(s,i,r,n,e.getUint32(40,!0),17,4294925233),n=ef(n,s,i,r,e.getUint32(44,!0),22,2304563134),r=ef(r,n,s,i,e.getUint32(48,!0),7,1804603682),i=ef(i,r,n,s,e.getUint32(52,!0),12,4254626195),s=ef(s,i,r,n,e.getUint32(56,!0),17,2792965006),n=ef(n,s,i,r,e.getUint32(60,!0),22,1236535329),r=tf(r,n,s,i,e.getUint32(4,!0),5,4129170786),i=tf(i,r,n,s,e.getUint32(24,!0),9,3225465664),s=tf(s,i,r,n,e.getUint32(44,!0),14,643717713),n=tf(n,s,i,r,e.getUint32(0,!0),20,3921069994),r=tf(r,n,s,i,e.getUint32(20,!0),5,3593408605),i=tf(i,r,n,s,e.getUint32(40,!0),9,38016083),s=tf(s,i,r,n,e.getUint32(60,!0),14,3634488961),n=tf(n,s,i,r,e.getUint32(16,!0),20,3889429448),r=tf(r,n,s,i,e.getUint32(36,!0),5,568446438),i=tf(i,r,n,s,e.getUint32(56,!0),9,3275163606),s=tf(s,i,r,n,e.getUint32(12,!0),14,4107603335),n=tf(n,s,i,r,e.getUint32(32,!0),20,1163531501),r=tf(r,n,s,i,e.getUint32(52,!0),5,2850285829),i=tf(i,r,n,s,e.getUint32(8,!0),9,4243563512),s=tf(s,i,r,n,e.getUint32(28,!0),14,1735328473),n=tf(n,s,i,r,e.getUint32(48,!0),20,2368359562),r=rf(r,n,s,i,e.getUint32(20,!0),4,4294588738),i=rf(i,r,n,s,e.getUint32(32,!0),11,2272392833),s=rf(s,i,r,n,e.getUint32(44,!0),16,1839030562),n=rf(n,s,i,r,e.getUint32(56,!0),23,4259657740),r=rf(r,n,s,i,e.getUint32(4,!0),4,2763975236),i=rf(i,r,n,s,e.getUint32(16,!0),11,1272893353),s=rf(s,i,r,n,e.getUint32(28,!0),16,4139469664),n=rf(n,s,i,r,e.getUint32(40,!0),23,3200236656),r=rf(r,n,s,i,e.getUint32(52,!0),4,681279174),i=rf(i,r,n,s,e.getUint32(0,!0),11,3936430074),s=rf(s,i,r,n,e.getUint32(12,!0),16,3572445317),n=rf(n,s,i,r,e.getUint32(24,!0),23,76029189),r=rf(r,n,s,i,e.getUint32(36,!0),4,3654602809),i=rf(i,r,n,s,e.getUint32(48,!0),11,3873151461),s=rf(s,i,r,n,e.getUint32(60,!0),16,530742520),n=rf(n,s,i,r,e.getUint32(8,!0),23,3299628645),r=nf(r,n,s,i,e.getUint32(0,!0),6,4096336452),i=nf(i,r,n,s,e.getUint32(28,!0),10,1126891415),s=nf(s,i,r,n,e.getUint32(56,!0),15,2878612391),n=nf(n,s,i,r,e.getUint32(20,!0),21,4237533241),r=nf(r,n,s,i,e.getUint32(48,!0),6,1700485571),i=nf(i,r,n,s,e.getUint32(12,!0),10,2399980690),s=nf(s,i,r,n,e.getUint32(40,!0),15,4293915773),n=nf(n,s,i,r,e.getUint32(4,!0),21,2240044497),r=nf(r,n,s,i,e.getUint32(32,!0),6,1873313359),i=nf(i,r,n,s,e.getUint32(60,!0),10,4264355552),s=nf(s,i,r,n,e.getUint32(24,!0),15,2734768916),n=nf(n,s,i,r,e.getUint32(52,!0),21,1309151649),r=nf(r,n,s,i,e.getUint32(16,!0),6,4149444226),i=nf(i,r,n,s,e.getUint32(44,!0),10,3174756917),s=nf(s,i,r,n,e.getUint32(8,!0),15,718787259),n=nf(n,s,i,r,e.getUint32(36,!0),21,3951481745),t[0]=r+t[0]&4294967295,t[1]=n+t[1]&4294967295,t[2]=s+t[2]&4294967295,t[3]=i+t[3]&4294967295}reset(){this.state=Uint32Array.from(Yp),this.buffer=new DataView(new ArrayBuffer(Xp)),this.bufferLength=0,this.bytesHashed=0,this.finished=!1}}function Qp(e,t,r,n,s,i){return((t=(t+e&4294967295)+(n+i&4294967295)&4294967295)<<s|t>>>32-s)+r&4294967295}function ef(e,t,r,n,s,i,o){return Qp(t&r|~t&n,e,t,s,i,o)}function tf(e,t,r,n,s,i,o){return Qp(t&n|r&~n,e,t,s,i,o)}function rf(e,t,r,n,s,i,o){return Qp(t^r^n,e,t,s,i,o)}function nf(e,t,r,n,s,i,o){return Qp(r^(t|~n),e,t,s,i,o)}const sf=["in-region","cross-region","mobile","standard","legacy"],of=()=>{const e=window?.navigator;if(e?.connection){const{effectiveType:t,rtt:r,downlink:n}=e?.connection;if("string"==typeof t&&"4g"!==t||Number(r)>100||Number(n)<10)return!0}return e?.userAgentData?.mobile||"number"==typeof e?.maxTouchPoints&&e?.maxTouchPoints>1},af=e=>{const t=(({defaultsMode:e}={})=>$t(async()=>{const t="function"==typeof e?await e():e;switch(t?.toLowerCase()){case"auto":return Promise.resolve(of()?"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 ${sf.join(", ")}, got ${t}`)}}))(e),r=()=>t().then(Pr),n=(e=>({apiVersion:"2006-03-01",base64Decoder:e?.base64Decoder??j,base64Encoder:e?.base64Encoder??K,disableHostPrefix:e?.disableHostPrefix??!1,endpointProvider:e?.endpointProvider??cu,extensions:e?.extensions??[],getAwsChunkedEncodingStream:e?.getAwsChunkedEncodingStream??te,httpAuthSchemeProvider:e?.httpAuthSchemeProvider??pu,httpAuthSchemes:e?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4"),signer:new k},{schemeId:"aws.auth#sigv4a",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4a"),signer:new T}],logger:e?.logger??new Or,protocol:e?.protocol??qr,protocolSettings:e?.protocolSettings??{defaultNamespace:"com.amazonaws.s3",xmlNamespace:"http://s3.amazonaws.com/doc/2006-03-01/",version:"2006-03-01",serviceTarget:"AmazonS3"},sdkStreamMixin:e?.sdkStreamMixin??fe,serviceId:e?.serviceId??"S3",signerConstructor:e?.signerConstructor??Ui,signingEscapePath:e?.signingEscapePath??!1,urlParser:e?.urlParser??_s,useArnRegion:e?.useArnRegion??void 0,utf8Decoder:e?.utf8Decoder??H,utf8Encoder:e?.utf8Encoder??F}))(e);return{...n,...e,runtime:"browser",defaultsMode:t,bodyLengthChecker:e?.bodyLengthChecker??gr,credentialDefaultProvider:e?.credentialDefaultProvider??(e=>()=>Promise.reject(new Error("Credential is missing"))),defaultUserAgentProvider:e?.defaultUserAgentProvider??Cp({serviceId:n.serviceId,clientVersion:ep}),eventStreamSerdeProvider:e?.eventStreamSerdeProvider??Zp,maxAttempts:e?.maxAttempts??3,md5:e?.md5??Jp,region:e?.region??(s="Region is missing",()=>Promise.reject(s)),requestHandler:ae.create(e?.requestHandler??r),retryMode:e?.retryMode??(async()=>(await r()).retryMode||pi),sha1:e?.sha1??lp,sha256:e?.sha256??Ep,streamCollector:e?.streamCollector??ce,streamHasher:e?.streamHasher??Gp,useDualstackEndpoint:e?.useDualstackEndpoint??(()=>Promise.resolve(false)),useFipsEndpoint:e?.useFipsEndpoint??(()=>Promise.resolve(false))};var s},cf=(e,t)=>{const r=Object.assign((e=>({setRegion(t){e.region=t},region:()=>e.region}))(e),Ir(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,n=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){n=e},credentials:()=>n}})(e));return t.forEach(e=>e.configure(r)),Object.assign(e,{region:r.region()},(n=r,Object.assign((e=>{const t={};return e.checksumAlgorithms().forEach(e=>{t[e.algorithmId()]=e.checksumConstructor()}),t})(n),(e=>{const t={};return t.retryStrategy=e.retryStrategy(),t})(n))),{httpHandler:r.httpHandler()},(e=>({httpAuthSchemes:e.httpAuthSchemes(),httpAuthSchemeProvider:e.httpAuthSchemeProvider(),credentials:e.credentials()}))(r));var n};class uf extends Er{config;constructor(...[e]){const t=af(e||{});super(t),this.initConfig=t;var r;const n=function(e){const t=L(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??{}}))),s=(e=>{const{requestChecksumCalculation:t,responseChecksumValidation:r,requestStreamBufferSize:n}=e;return Object.assign(e,{requestChecksumCalculation:I(t??h),responseChecksumValidation:I(r??m),requestStreamBufferSize:Number(n??0)})})(n),i=(e=>{const{retryStrategy:t,retryMode:r,maxAttempts:n}=e,s=I(n??3);return Object.assign(e,{maxAttempts:s,retryStrategy:async()=>t||(await I(r)()===li.ADAPTIVE?new xi(s):new Ci(s))})})(s),o=(e=>{const t=e.tls??!0,{endpoint:r,useDualstackEndpoint:n,useFipsEndpoint:s}=e,i=null!=r?async()=>oi(await I(r)()):void 0,o=!!r,a=Object.assign(e,{endpoint:i,tls:t,isCustomEndpoint:o,useDualstackEndpoint:I(n??!1),useFipsEndpoint:I(s??!1)});let c;return a.serviceConfiguredEndpoint=async()=>(e.serviceId&&!c&&(c=ii(e.serviceId)),c),a})(Gs(i)),a=(c=o,Object.assign(c,{eventStreamMarshaller:c.eventStreamSerdeProvider(c)}));var c;const d=((e,{session:t})=>{const[r,n]=t,{forcePathStyle:s,useAccelerateEndpoint:i,disableMultiregionAccessPoints:o,followRegionRedirects:a,s3ExpressIdentityProvider:c,bucketEndpoint:u,expectContinueHeader:d}=e;return Object.assign(e,{forcePathStyle:s??!1,useAccelerateEndpoint:i??!1,disableMultiregionAccessPoints:o??!1,followRegionRedirects:a??!1,s3ExpressIdentityProvider:c??new Fn(async e=>r().send(new n({Bucket:e}))),bucketEndpoint:u??!1,expectContinueHeader:d??2097152})})(yu(a),{session:[()=>this,Qh]}),l=cf(d,e?.extensions||[]);var p;this.config=l,this.middlewareStack.use(Ce(this.config)),this.middlewareStack.use((p=this.config,{applyToStack:e=>{e.add(Fs(p),Vs)}})),this.middlewareStack.use(Mi(this.config)),this.middlewareStack.use(Js(this.config)),this.middlewareStack.use(On(this.config)),this.middlewareStack.use((this.config,{applyToStack:e=>{e.add((e,t)=>async r=>{try{const n=await e(r),{clientName:s,commandName:i,logger:o,dynamoDbDocumentClientOptions:a={}}=t,{overrideInputFilterSensitiveLog:c,overrideOutputFilterSensitiveLog:u}=a,d=c??t.inputFilterSensitiveLog,l=u??t.outputFilterSensitiveLog,{$metadata:h,...p}=n.output;return o?.info?.({clientName:s,commandName:i,input:d(r.input),output:l(p),metadata:h}),n}catch(n){const{clientName:e,commandName:s,logger:i,dynamoDbDocumentClientOptions:o={}}=t,{overrideInputFilterSensitiveLog:a}=o,c=a??t.inputFilterSensitiveLog;throw i?.error?.({clientName:e,commandName:s,input:c(r.input),error:n,metadata:n.$metadata}),n}},Un)}})),this.middlewareStack.use((this.config,{applyToStack:e=>{e.add(e=>async t=>e(t),Nn)}})),this.middlewareStack.use(((e,{httpAuthSchemeParametersProvider:t,identityProviderConfigProvider:r})=>({applyToStack:n=>{n.addRelativeTo(M(e,{httpAuthSchemeParametersProvider:t,identityProviderConfigProvider:r}),O)}}))(this.config,{httpAuthSchemeParametersProvider:uu,identityProviderConfigProvider:async e=>new Mt({"aws.auth#sigv4":e.credentials,"aws.auth#sigv4a":e.credentials})})),this.middlewareStack.use(D(this.config)),this.middlewareStack.use(cs(this.config)),this.middlewareStack.use(u(this.config)),this.middlewareStack.use(Bn(this.config)),this.middlewareStack.use(Yn(this.config)),this.middlewareStack.use((e=>({applyToStack:t=>{t.addRelativeTo(es(e),$)}}))(this.config))}destroy(){super.destroy()}}const df={name:"ssecMiddleware",step:"initialize",tags:["SSE"],override:!0},lf=e=>({applyToStack:t=>{var r;t.add((r=e,e=>async t=>{const n={...t.input},s=[{target:"SSECustomerKey",hash:"SSECustomerKeyMD5"},{target:"CopySourceSSECustomerKey",hash:"CopySourceSSECustomerKeyMD5"}];for(const e of s){const t=n[e.target];if(t){let s;"string"==typeof t?hf(t,r)?s=r.base64Decoder(t):(s=r.utf8Decoder(t),n[e.target]=r.base64Encoder(s)):(s=ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):new Uint8Array(t),n[e.target]=r.base64Encoder(s));const i=new r.md5;i.update(s),n[e.hash]=r.base64Encoder(await i.digest())}}return e({...t,input:n})}),df)}});function hf(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 pf extends(Ar.classBuilder().ep({...wu,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,n){return[di(r,e.getEndpointParameterInstructions()),is(r),lf(r)]}).s("AmazonS3","CopyObject",{}).n("S3Client","CopyObjectCommand").sc(Vh).build()){}class ff extends(Ar.classBuilder().ep({...wu,Bucket:{type:"contextParams",name:"Bucket"},Key:{type:"contextParams",name:"Key"}}).m(function(e,t,r,n){return[di(r,e.getEndpointParameterInstructions()),is(r)]}).s("AmazonS3","DeleteObject",{}).n("S3Client","DeleteObjectCommand").sc(Zh).build()){}class mf extends(Ar.classBuilder().ep({...wu,Bucket:{type:"contextParams",name:"Bucket"}}).m(function(e,t,r,n){return[di(r,e.getEndpointParameterInstructions()),In(r,{requestAlgorithmMember:{httpHeader:"x-amz-sdk-checksum-algorithm",name:"ChecksumAlgorithm"},requestChecksumRequired:!0}),is(r)]}).s("AmazonS3","DeleteObjects",{}).n("S3Client","DeleteObjectsCommand").sc(Gh).build()){}class gf extends(Ar.classBuilder().ep({...wu,Bucket:{type:"contextParams",name:"Bucket"},Key:{type:"contextParams",name:"Key"}}).m(function(e,t,r,n){return[di(r,e.getEndpointParameterInstructions()),In(r,{requestChecksumRequired:!1,requestValidationModeMember:"ChecksumMode",responseAlgorithms:["CRC64NVME","CRC32","CRC32C","SHA256","SHA1"]}),lf(r),{applyToStack:e=>{e.addRelativeTo(zn(),jn)}}]}).s("AmazonS3","GetObject",{}).n("S3Client","GetObjectCommand").sc(Xh).build()){}class yf extends(Ar.classBuilder().ep({...wu,Bucket:{type:"contextParams",name:"Bucket"},Prefix:{type:"contextParams",name:"Prefix"}}).m(function(e,t,r,n){return[di(r,e.getEndpointParameterInstructions()),is(r)]}).s("AmazonS3","ListObjectsV2",{}).n("S3Client","ListObjectsV2Command").sc(Yh).build()){}class wf extends(Ar.classBuilder().ep({...wu,Bucket:{type:"contextParams",name:"Bucket"},Key:{type:"contextParams",name:"Key"}}).m(function(e,t,r,n){return[di(r,e.getEndpointParameterInstructions()),In(r,{requestAlgorithmMember:{httpHeader:"x-amz-sdk-checksum-algorithm",name:"ChecksumAlgorithm"},requestChecksumRequired:!1}),Dn(),is(r),lf(r)]}).s("AmazonS3","PutObject",{}).n("S3Client","PutObjectCommand").sc(Jh).build()){}async function bf(e,t={}){const{key:r,body:n,destinationKey:s,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 uf({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 wf({Bucket:u.bucket,Key:r,Body:n}))};case"download":const e=await d.send(new gf({Bucket:u.bucket,Key:r}));return await(e.Body?.transformToString());case"delete":return{success:!0,key:r,...await d.send(new ff({Bucket:u.bucket,Key:r}))};case"list":const t=await d.send(new yf({Bucket:u.bucket}));return t.Contents?.map(e=>e.Key)||[];case"deleteAll":const i=await d.send(new yf({Bucket:u.bucket}));if(i.Contents?.length){const e=await d.send(new mf({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(!s)throw new Error("destinationKey is required for copy operation");return{success:!0,sourceKey:r,destinationKey:s,...await d.send(new pf({Bucket:u.bucket,CopySource:`${u.bucket}/${r}`,Key:s}))};case"rename":if(!s)throw new Error("destinationKey is required for rename operation");return await d.send(new pf({Bucket:u.bucket,CopySource:`${u.bucket}/${r}`,Key:s})),await d.send(new ff({Bucket:u.bucket,Key:r})),{success:!0,oldKey:r,newKey:s};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{H as f,bf as m,F as t};