gemi 0.4.34 → 0.4.35
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/dist/chunk-01e07763e3e32710.js +2 -0
- package/dist/chunk-1cc0d1072ee4a92b.js +1 -1
- package/dist/chunk-29bc27c5e126c304.js +18 -0
- package/dist/chunk-32f06f9ad00aaabd.js +2 -0
- package/dist/chunk-3ab807ceccde81f3.js +3 -0
- package/dist/chunk-4e023976eb557258.js +1 -1
- package/dist/chunk-589f4b330dd6d32e.js +2 -0
- package/dist/chunk-7d7b2c1f2a8dd018.js +6 -0
- package/dist/chunk-860f5fcef7074193.js +1 -1
- package/dist/chunk-9d069ba29a122630.js +1 -0
- package/dist/chunk-db65c75cda396f98.js +1 -1
- package/dist/chunk-e4f28182cf5f6e1d.js +2 -0
- package/dist/client/index.js +5 -2
- package/dist/client/init.d.ts.map +1 -1
- package/dist/storage/index.js +10 -1
- package/package.json +1 -1
package/dist/storage/index.js
CHANGED
|
@@ -1,2 +1,11 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import"../chunk-3728fa21e6931333.js";import{x as W} from"../chunk-a5c18c07abe8fd9c.js";import{$ as $r,A as Gg,B as J,C as Qr,D as Hr,F as Qg,K as jm,L as Dl,M as oh,N as Ar,O as v,Q as ws,T as ar,U as nh,V as Sr,W as ph,X as gs,Y as zr,_ as Tf,aa as Hh,ba as O,ca as uh,da as wg,ea as ag,fa as Fg,ga as Kg,ia as C,ka as th,ma as Pg,na as Ng,z as Cg} from"../chunk-3bd48fb5397a155b.js";import{$a as lg,Aa as Fh,Ba as Yg,Ca as Sg,Da as Rg,Ea as Ag,Fa as kg,Ga as Bg,Ha as vg,Ia as Kh,Ja as kr,Ka as Ir,La as Og,Ma as Ig,Na as sl,Oa as dg,Pa as qg,Qa as Eg,Ra as _g,Sa as ea,Ta as or,Ua as eg,Va as ng,Wa as sg,Xa as es,Ya as fg,Za as Ds,_a as $g,ab as hg,bb as Mg,cb as Wg,db as Vg,oa as Lg,pa as Xg,qa as Jg,ra as Hg,sa as Nl,ta as ew,ua as n,va as p,wa as Xs,xa as yg,ya as Ch,za as Gh} from"../chunk-8295e42bcfc910ff.js";import{eb as $w} from"../chunk-a57ecc74c0fb9045.js";import{fb as Ja,gb as c} from"../chunk-bcd70a6fc2fd359c.js";import"../chunk-1109657ed53fbdc9.js";import{ib as Ug} from"../chunk-12ca7224eb6ccf72.js";import"../chunk-a3526e321ac9d173.js";function ww(r){return(s)=>async(f)=>{const{request:l}=f;if(J.isInstance(l)&&l.body&&r.runtime==="node"){if(r.requestHandler?.constructor?.name!=="FetchHttpHandler")l.headers={...l.headers,Expect:"100-continue"}}return s({...f,request:l})}}var aw={step:"build",tags:["SET_EXPECT_HEADER","EXPECT_HEADER"],name:"addExpectContinueMiddleware",override:!0},fl=(r)=>({applyToStack:(s)=>{s.add(ww(r),aw)}});function Rw(){return(r,s)=>async(f)=>{const{request:l}=f;if(J.isInstance(l)){if(!(Sw in l.headers))if(typeof s?.logger?.warn==="function"&&!(s.logger instanceof Hr))s.logger.warn("Are you using a Stream of unknown length as the Body of a PutObject request? Consider using Upload instead from @aws-sdk/lib-storage.");else console.warn("Are you using a Stream of unknown length as the Body of a PutObject request? Consider using Upload instead from @aws-sdk/lib-storage.")}return r({...f})}}var Sw="content-length",Aw={step:"finalizeRequest",tags:["CHECK_CONTENT_LENGTH_HEADER"],name:"getCheckContentLengthHeaderPlugin",override:!0},ll=(r)=>({applyToStack:(s)=>{s.add(Rw(),Aw)}});var hl=(r)=>{return(s,f)=>async(l)=>{const h=await r.region(),m=r.region;let g=()=>{};if(f.__s3RegionRedirect)Object.defineProperty(r,"region",{writable:!1,value:async()=>{return f.__s3RegionRedirect}}),g=()=>Object.defineProperty(r,"region",{writable:!0,value:m});try{const w=await s(l);if(f.__s3RegionRedirect){g();const a=await r.region();if(h!==a)throw new Error("Region was not restored following S3 region redirect.")}return w}catch(w){throw g(),w}}},ml={tags:["REGION_REDIRECT","S3"],name:"regionRedirectEndpointMiddleware",override:!0,relation:"before",toMiddleware:"endpointV2Middleware"};function kw(r){return(s,f)=>async(l)=>{try{return await s(l)}catch(h){if(r.followRegionRedirects&&h?.$metadata?.httpStatusCode===301){try{const m=h.$response.headers["x-amz-bucket-region"];f.logger?.debug(`Redirecting from ${await r.region()} to ${m}`),f.__s3RegionRedirect=m}catch(m){throw new Error("Region redirect failed: "+m)}return s(l)}else throw h}}}var Iw={step:"initialize",tags:["REGION_REDIRECT","S3"],name:"regionRedirectMiddleware",override:!0},gl=(r)=>({applyToStack:(s)=>{s.add(kw(r),Iw),s.addRelativeTo(hl(r),ml)}});var dw=(r)=>{return(s,f)=>async(l)=>{const h=await s(l),{response:m}=h;if(Qr.isInstance(m)){if(m.headers.expires){m.headers.expiresstring=m.headers.expires;try{$r(m.headers.expires)}catch(g){f.logger?.warn(`AWS SDK Warning for ${f.clientName}::${f.commandName} response parsing (${m.headers.expires}): ${g}`),delete m.headers.expires}}}return h}},Ew={tags:["S3"],name:"s3ExpiresMiddleware",override:!0,relation:"after",toMiddleware:"deserializerMiddleware"},wl=(r)=>({applyToStack:(s)=>{s.addRelativeTo(dw(r),Ew)}});class sr{constructor(r={}){this.data=r,this.lastPurgeTime=Date.now()}get(r){const s=this.data[r];if(!s)return;return s}set(r,s){return this.data[r]=s,s}delete(r){delete this.data[r]}async purgeExpired(){const r=Date.now();if(this.lastPurgeTime+sr.EXPIRED_CREDENTIAL_PURGE_INTERVAL_MS>r)return;for(let s in this.data){const f=this.data[s];if(!f.isRefreshing){const l=await f.identity;if(l.expiration){if(l.expiration.getTime()<r)delete this.data[s]}}}}}sr.EXPIRED_CREDENTIAL_PURGE_INTERVAL_MS=30000;class fr{constructor(r,s=!1,f=Date.now()){this._identity=r,this.isRefreshing=s,this.accessed=f}get identity(){return this.accessed=Date.now(),this._identity}}class lr{constructor(r,s=new sr){this.createSessionFn=r,this.cache=s}async getS3ExpressIdentity(r,s){const f=s.Bucket,{cache:l}=this,h=l.get(f);if(h)return h.identity.then((m)=>{if((m.expiration?.getTime()??0)<Date.now())return l.set(f,new fr(this.getIdentity(f))).identity;if((m.expiration?.getTime()??0)<Date.now()+lr.REFRESH_WINDOW_MS&&!h.isRefreshing)h.isRefreshing=!0,this.getIdentity(f).then((a)=>{l.set(f,new fr(Promise.resolve(a)))});return m});return l.set(f,new fr(this.getIdentity(f))).identity}async getIdentity(r){await this.cache.purgeExpired().catch((l)=>{console.warn("Error while clearing expired entries in S3ExpressIdentityCache: \n"+l)});const s=await this.createSessionFn(r);if(!s.Credentials?.AccessKeyId||!s.Credentials?.SecretAccessKey)throw new Error("s3#createSession response credential missing AccessKeyId or SecretAccessKey.");return{accessKeyId:s.Credentials.AccessKeyId,secretAccessKey:s.Credentials.SecretAccessKey,sessionToken:s.Credentials.SessionToken,expiration:s.Credentials.Expiration?new Date(s.Credentials.Expiration):void 0}}}lr.REFRESH_WINDOW_MS=60000;var Il=W(ew(),1);var al="Directory",Sl="S3Express",Rl="sigv4-s3express",yr="X-Amz-S3session-Token",Mr=yr.toLowerCase(),Pw="AWS_S3_DISABLE_EXPRESS_SESSION_AUTH",Nw="s3_disable_express_session_auth",Zs={environmentVariableSelector:(r)=>n(r,Pw,p.ENV),configFileSelector:(r)=>n(r,Nw,p.CONFIG),default:!1};var Al=function(r){return{accessKeyId:r.accessKeyId,secretAccessKey:r.secretAccessKey,expiration:r.expiration}},kl=function(r,s){const f=setTimeout(()=>{throw new Error("SignatureV4S3Express credential override was created but not called.")},10),l=r.credentialProvider,h=()=>{return clearTimeout(f),r.credentialProvider=l,Promise.resolve(s)};r.credentialProvider=h};class Yr extends Il.SignatureV4{async signWithCredentials(r,s,f){const l=Al(s);r.headers[Mr]=s.sessionToken;const h=this;return kl(h,l),h.signRequest(r,f??{})}async presignWithCredentials(r,s,f){const l=Al(s);return delete r.headers[Mr],r.headers[yr]=s.sessionToken,r.query=r.query??{},r.query[yr]=s.sessionToken,kl(this,l),this.presign(r,f)}}var dl=(r)=>{return(s,f)=>async(l)=>{if(f.endpointV2){const h=f.endpointV2,m=h.properties?.authSchemes?.[0]?.name===Rl;if(h.properties?.backend===Sl||h.properties?.bucketType===al)f.isS3ExpressBucket=!0;if(m){const w=l.input.Bucket;if(w){const a=await r.s3ExpressIdentityProvider.getS3ExpressIdentity(await r.credentials(),{Bucket:w});if(f.s3ExpressIdentity=a,J.isInstance(l.request)&&a.sessionToken)l.request.headers[Mr]=a.sessionToken}}}return s(l)}},El={name:"s3ExpressMiddleware",step:"build",tags:["S3","S3_EXPRESS"],override:!0},Ls=(r)=>({applyToStack:(s)=>{s.add(dl(r),El)}});var el=W(Xs(),1);var Mw=W($w(),1),$l=W(Nl(),1);var Pl=async(r,s,f,l)=>{const h=await l.signWithCredentials(f,r,{});if(h.headers["X-Amz-Security-Token"]||h.headers["x-amz-security-token"])throw new Error("X-Amz-Security-Token must not be set for s3-express requests.");return h};var Uw=(r)=>(s)=>{throw s},Dw=(r,s)=>{};var Ml=(r)=>(s,f)=>async(l)=>{if(!J.isInstance(l.request))return s(l);const m=$l.getSmithyContext(f).selectedHttpAuthScheme;if(!m)throw new Error("No HttpAuthScheme was selected: unable to sign request");const{httpAuthOption:{signingProperties:g={}},identity:w,signer:a}=m;let P;if(f.s3ExpressIdentity)P=await Pl(f.s3ExpressIdentity,g,l.request,await r.signer());else P=await a.sign(l.request,w,g);const N=await s({...l,request:P}).catch((a.errorHandler||Uw)(g));return(a.successHandler||Dw)(N.response,g),N},Js=(r)=>({applyToStack:(s)=>{s.addRelativeTo(Ml(r),el.httpSigningMiddlewareOptions)}});var Ul=(r,{session:s})=>{const[f,l]=s;return{...r,forcePathStyle:r.forcePathStyle??!1,useAccelerateEndpoint:r.useAccelerateEndpoint??!1,disableMultiregionAccessPoints:r.disableMultiregionAccessPoints??!1,followRegionRedirects:r.followRegionRedirects??!1,s3ExpressIdentityProvider:r.s3ExpressIdentityProvider??new lr(async(h)=>f().send(new l({Bucket:h,SessionMode:"ReadWrite"}))),bucketEndpoint:r.bucketEndpoint??!1}};var Br=W(Dl(),1),Tw={CopyObjectCommand:!0,UploadPartCopyCommand:!0,CompleteMultipartUploadCommand:!0},zw=3000,Cw=(r)=>(s,f)=>async(l)=>{const h=await s(l),{response:m}=h;if(!Qr.isInstance(m))return h;const{statusCode:g,body:w}=m;if(g<200||g>=300)return h;let a=w,P=w;if(w&&typeof w==="object"&&!(w instanceof Uint8Array))[a,P]=await Br.splitStream(w);m.body=P;const N=await Gw(a,{streamCollector:async(e)=>{return Br.headStream(e,zw)}});if(typeof a?.destroy==="function")a.destroy();const $=r.utf8Encoder(N.subarray(N.length-16));if(N.length===0&&Tw[f.commandName]){const e=new Error("S3 aborted request");throw e.name="InternalError",e}if($&&$.endsWith("</Error>"))m.statusCode=400;return h},Gw=(r=new Uint8Array,s)=>{if(r instanceof Uint8Array)return Promise.resolve(r);return s.streamCollector(r)||Promise.resolve(new Uint8Array)},Fw={relation:"after",toMiddleware:"deserializerMiddleware",tags:["THROW_200_EXCEPTIONS","S3"],name:"throw200ExceptionsMiddleware",override:!0},vr=(r)=>({applyToStack:(s)=>{s.addRelativeTo(Cw(r),Fw)}});var Hs=(r)=>typeof r==="string"&&r.indexOf("arn:")===0&&r.split(":").length>=6;function Tl(r){return(s,f)=>async(l)=>{if(r.bucketEndpoint){const h=f.endpointV2;if(h){const m=l.input.Bucket;if(typeof m==="string")try{const g=new URL(m);h.url=g}catch(g){const w=`@aws-sdk/middleware-sdk-s3: bucketEndpoint=true was set but Bucket=${m} could not be parsed as URL.`;if(f.logger?.constructor?.name==="NoOpLogger")console.warn(w);else f.logger?.warn?.(w);throw g}}}return s(l)}}var zl={name:"bucketEndpointMiddleware",override:!0,relation:"after",toMiddleware:"endpointV2Middleware"};function Kw({bucketEndpoint:r}){return(s)=>async(f)=>{const{input:{Bucket:l}}=f;if(!r&&typeof l==="string"&&!Hs(l)&&l.indexOf("/")>=0){const h=new Error(`Bucket name shouldn't contain '/', received '${l}'`);throw h.name="InvalidBucketName",h}return s({...f})}}var Ww={step:"initialize",tags:["VALIDATE_BUCKET_NAME"],name:"validateBucketNameMiddleware",override:!0},Cl=(r)=>({applyToStack:(s)=>{s.add(Kw(r),Ww),s.addRelativeTo(Tl(r),zl)}});var Er=W(Xs(),1);var Gl=(r)=>({...r,eventStreamMarshaller:r.eventStreamSerdeProvider(r)});var nr=W(or(),1);var Or={CrtSignerV4:null};class Qs{constructor(r){this.sigv4Signer=new Yr(r),this.signerOptions=r}async sign(r,s={}){if(s.signingRegion==="*"){if(this.signerOptions.runtime!=="node")throw new Error("This request requires signing with SigV4Asymmetric algorithm. It's only available in Node.js");return this.getSigv4aSigner().sign(r,s)}return this.sigv4Signer.sign(r,s)}async signWithCredentials(r,s,f={}){if(f.signingRegion==="*"){if(this.signerOptions.runtime!=="node")throw new Error("This request requires signing with SigV4Asymmetric algorithm. It's only available in Node.js");return this.getSigv4aSigner().signWithCredentials(r,s,f)}return this.sigv4Signer.signWithCredentials(r,s,f)}async presign(r,s={}){if(s.signingRegion==="*"){if(this.signerOptions.runtime!=="node")throw new Error("This request requires signing with SigV4Asymmetric algorithm. It's only available in Node.js");return this.getSigv4aSigner().presign(r,s)}return this.sigv4Signer.presign(r,s)}async presignWithCredentials(r,s,f={}){if(f.signingRegion==="*")throw new Error("Method presignWithCredentials is not supported for [signingRegion=*].");return this.sigv4Signer.presignWithCredentials(r,s,f)}getSigv4aSigner(){if(!this.sigv4aSigner){let r=null;try{if(r=Or.CrtSignerV4,typeof r!=="function")throw new Error}catch(s){throw s.message=`${s.message}\n`+'Please check whether you have installed the "@aws-sdk/signature-v4-crt" package explicitly. \nYou 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";]. \nFor more information please go to https://github.com/aws/aws-sdk-js-v3#functionality-requiring-aws-common-runtime-crt',s}this.sigv4aSigner=new r({...this.signerOptions,signingAlgorithm:1})}return this.sigv4aSigner}}var Tr=W(Nl(),1);var hr={["required"]:!1,["type"]:"String"},mr={["required"]:!0,default:!1,["type"]:"Boolean"},Ur={["required"]:!1,["type"]:"Boolean"},B={["fn"]:"booleanEquals",["argv"]:[{["ref"]:"Accelerate"},!0]},E={["fn"]:"booleanEquals",["argv"]:[{["ref"]:"UseFIPS"},!0]},d={["fn"]:"booleanEquals",["argv"]:[{["ref"]:"UseDualStack"},!0]},D={["fn"]:"isSet",["argv"]:[{["ref"]:"Endpoint"}]},Nh={["fn"]:"aws.partition",["argv"]:[{["ref"]:"Region"}],["assign"]:"partitionResult"},Fl={["fn"]:"stringEquals",["argv"]:[{["fn"]:"getAttr",["argv"]:[{["ref"]:"partitionResult"},"name"]},"aws-cn"]},br={["fn"]:"isSet",["argv"]:[{["ref"]:"Bucket"}]},Z={["ref"]:"Bucket"},V={["fn"]:"parseURL",["argv"]:[{["ref"]:"Endpoint"}],["assign"]:"url"},cr={["fn"]:"booleanEquals",["argv"]:[{["fn"]:"getAttr",["argv"]:[{["ref"]:"url"},"isIp"]},!0]},eh={["ref"]:"url"},$h={["fn"]:"uriEncode",["argv"]:[Z],["assign"]:"uri_encoded_bucket"},_={["backend"]:"S3Express",["authSchemes"]:[{["disableDoubleEncoding"]:!0,["name"]:"sigv4",["signingName"]:"s3express",["signingRegion"]:"{Region}"}]},S={},Mh={["fn"]:"aws.isVirtualHostableS3Bucket",["argv"]:[Z,!1]},ys={["error"]:"S3Express bucket name is not a valid virtual hostable name.",["type"]:"error"},ir={["backend"]:"S3Express",["authSchemes"]:[{["disableDoubleEncoding"]:!0,["name"]:"sigv4-s3express",["signingName"]:"s3express",["signingRegion"]:"{Region}"}]},Kl={["fn"]:"isSet",["argv"]:[{["ref"]:"UseS3ExpressControlEndpoint"}]},Wl={["fn"]:"booleanEquals",["argv"]:[{["ref"]:"UseS3ExpressControlEndpoint"},!0]},R={["fn"]:"not",["argv"]:[D]},Vl={["error"]:"Unrecognized S3Express bucket name format.",["type"]:"error"},Zl={["fn"]:"not",["argv"]:[br]},Ll={["ref"]:"hardwareType"},Xl={["conditions"]:[R],["error"]:"Expected a endpoint to be specified but no endpoint was found",["type"]:"error"},qr={["authSchemes"]:[{["disableDoubleEncoding"]:!0,["name"]:"sigv4a",["signingName"]:"s3-outposts",["signingRegionSet"]:["*"]},{["disableDoubleEncoding"]:!0,["name"]:"sigv4",["signingName"]:"s3-outposts",["signingRegion"]:"{Region}"}]},Ys={["fn"]:"booleanEquals",["argv"]:[{["ref"]:"ForcePathStyle"},!1]},Vw={["ref"]:"ForcePathStyle"},U={["fn"]:"booleanEquals",["argv"]:[{["ref"]:"Accelerate"},!1]},z={["fn"]:"stringEquals",["argv"]:[{["ref"]:"Region"},"aws-global"]},G={["authSchemes"]:[{["disableDoubleEncoding"]:!0,["name"]:"sigv4",["signingName"]:"s3",["signingRegion"]:"us-east-1"}]},I={["fn"]:"not",["argv"]:[z]},F={["fn"]:"booleanEquals",["argv"]:[{["ref"]:"UseGlobalEndpoint"},!0]},Jl={["url"]:"https://{Bucket}.s3-fips.dualstack.{Region}.{partitionResult#dnsSuffix}",["properties"]:{["authSchemes"]:[{["disableDoubleEncoding"]:!0,["name"]:"sigv4",["signingName"]:"s3",["signingRegion"]:"{Region}"}]},["headers"]:{}},T={["authSchemes"]:[{["disableDoubleEncoding"]:!0,["name"]:"sigv4",["signingName"]:"s3",["signingRegion"]:"{Region}"}]},K={["fn"]:"booleanEquals",["argv"]:[{["ref"]:"UseGlobalEndpoint"},!1]},k={["fn"]:"booleanEquals",["argv"]:[{["ref"]:"UseDualStack"},!1]},Hl={["url"]:"https://{Bucket}.s3-fips.{Region}.{partitionResult#dnsSuffix}",["properties"]:T,["headers"]:{}},A={["fn"]:"booleanEquals",["argv"]:[{["ref"]:"UseFIPS"},!1]},Ql={["url"]:"https://{Bucket}.s3-accelerate.dualstack.{partitionResult#dnsSuffix}",["properties"]:T,["headers"]:{}},yl={["url"]:"https://{Bucket}.s3.dualstack.{Region}.{partitionResult#dnsSuffix}",["properties"]:T,["headers"]:{}},Bs={["fn"]:"booleanEquals",["argv"]:[{["fn"]:"getAttr",["argv"]:[eh,"isIp"]},!1]},vs={["url"]:"{url#scheme}://{url#authority}{url#normalizedPath}{Bucket}",["properties"]:T,["headers"]:{}},gf={["url"]:"{url#scheme}://{Bucket}.{url#authority}{url#path}",["properties"]:T,["headers"]:{}},Yl={["endpoint"]:gf,["type"]:"endpoint"},Os={["url"]:"https://{Bucket}.s3-accelerate.{partitionResult#dnsSuffix}",["properties"]:T,["headers"]:{}},Bl={["url"]:"https://{Bucket}.s3.{Region}.{partitionResult#dnsSuffix}",["properties"]:T,["headers"]:{}},_r={["error"]:"Invalid region: region was not a valid DNS name.",["type"]:"error"},X={["ref"]:"bucketArn"},Uh={["ref"]:"arnType"},qs={["fn"]:"getAttr",["argv"]:[X,"service"]},wf={["ref"]:"accessPointName"},vl={["conditions"]:[d],["error"]:"S3 Object Lambda does not support Dual-stack",["type"]:"error"},Ol={["conditions"]:[B],["error"]:"S3 Object Lambda does not support S3 Accelerate",["type"]:"error"},ql={["conditions"]:[{["fn"]:"isSet",["argv"]:[{["ref"]:"DisableAccessPoints"}]},{["fn"]:"booleanEquals",["argv"]:[{["ref"]:"DisableAccessPoints"},!0]}],["error"]:"Access points are not supported for this operation",["type"]:"error"},_s={["conditions"]:[{["fn"]:"isSet",["argv"]:[{["ref"]:"UseArnRegion"}]},{["fn"]:"booleanEquals",["argv"]:[{["ref"]:"UseArnRegion"},!1]},{["fn"]:"not",["argv"]:[{["fn"]:"stringEquals",["argv"]:[{["fn"]:"getAttr",["argv"]:[X,"region"]},"{Region}"]}]}],["error"]:"Invalid configuration: region from ARN `{bucketArn#region}` does not match client region `{Region}` and UseArnRegion is `false`",["type"]:"error"},Dh={["fn"]:"getAttr",["argv"]:[{["ref"]:"bucketPartition"},"name"]},Th={["fn"]:"getAttr",["argv"]:[X,"accountId"]},js={["authSchemes"]:[{["disableDoubleEncoding"]:!0,["name"]:"sigv4",["signingName"]:"s3-object-lambda",["signingRegion"]:"{bucketArn#region}"}]},_l={["error"]:"Invalid ARN: The access point name may only contain a-z, A-Z, 0-9 and `-`. Found: `{accessPointName}`",["type"]:"error"},cs={["error"]:"Invalid ARN: The account id may only contain a-z, A-Z, 0-9 and `-`. Found: `{bucketArn#accountId}`",["type"]:"error"},bs={["error"]:"Invalid region in ARN: `{bucketArn#region}` (invalid DNS name)",["type"]:"error"},is={["error"]:"Client was configured for partition `{partitionResult#name}` but ARN (`{Bucket}`) has `{bucketPartition#name}`",["type"]:"error"},jl={["error"]:"Invalid ARN: The ARN may only contain a single resource component after `accesspoint`.",["type"]:"error"},cl={["error"]:"Invalid ARN: Expected a resource of the format `accesspoint:<accesspoint name>` but no name was provided",["type"]:"error"},Dr={["authSchemes"]:[{["disableDoubleEncoding"]:!0,["name"]:"sigv4",["signingName"]:"s3",["signingRegion"]:"{bucketArn#region}"}]},bl={["authSchemes"]:[{["disableDoubleEncoding"]:!0,["name"]:"sigv4a",["signingName"]:"s3-outposts",["signingRegionSet"]:["*"]},{["disableDoubleEncoding"]:!0,["name"]:"sigv4",["signingName"]:"s3-outposts",["signingRegion"]:"{bucketArn#region}"}]},il={["fn"]:"aws.parseArn",["argv"]:[Z]},xl={["url"]:"https://s3-fips.dualstack.{Region}.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",["properties"]:T,["headers"]:{}},ol={["url"]:"https://s3-fips.{Region}.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",["properties"]:T,["headers"]:{}},nl={["url"]:"https://s3.dualstack.{Region}.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",["properties"]:T,["headers"]:{}},xs={["url"]:"{url#scheme}://{url#authority}{url#normalizedPath}{uri_encoded_bucket}",["properties"]:T,["headers"]:{}},pl={["url"]:"https://s3.{Region}.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",["properties"]:T,["headers"]:{}},ul={["ref"]:"UseObjectLambdaEndpoint"},os={["authSchemes"]:[{["disableDoubleEncoding"]:!0,["name"]:"sigv4",["signingName"]:"s3-object-lambda",["signingRegion"]:"{Region}"}]},tl={["url"]:"https://s3-fips.dualstack.{Region}.{partitionResult#dnsSuffix}",["properties"]:T,["headers"]:{}},rh={["url"]:"https://s3-fips.{Region}.{partitionResult#dnsSuffix}",["properties"]:T,["headers"]:{}},sh={["url"]:"https://s3.dualstack.{Region}.{partitionResult#dnsSuffix}",["properties"]:T,["headers"]:{}},ns={["url"]:"{url#scheme}://{url#authority}{url#path}",["properties"]:T,["headers"]:{}},fh={["url"]:"https://s3.{Region}.{partitionResult#dnsSuffix}",["properties"]:T,["headers"]:{}},ps=[{["ref"]:"Region"}],Zw=[{["ref"]:"Endpoint"}],Lw=[Z],us=[d],jr=[B],u=[D,V],lh=[{["fn"]:"isSet",["argv"]:[{["ref"]:"DisableS3ExpressSessionAuth"}]},{["fn"]:"booleanEquals",["argv"]:[{["ref"]:"DisableS3ExpressSessionAuth"},!0]}],hh=[cr],ts=[$h],rf=[Mh],gr=[E],mh=[{["fn"]:"substring",["argv"]:[Z,6,14,!0],["assign"]:"s3expressAvailabilityZoneId"},{["fn"]:"substring",["argv"]:[Z,14,16,!0],["assign"]:"s3expressAvailabilityZoneDelim"},{["fn"]:"stringEquals",["argv"]:[{["ref"]:"s3expressAvailabilityZoneDelim"},"--"]}],gh=[{["conditions"]:[E],["endpoint"]:{["url"]:"https://{Bucket}.s3express-fips-{s3expressAvailabilityZoneId}.{Region}.amazonaws.com",["properties"]:_,["headers"]:{}},["type"]:"endpoint"},{["endpoint"]:{["url"]:"https://{Bucket}.s3express-{s3expressAvailabilityZoneId}.{Region}.amazonaws.com",["properties"]:_,["headers"]:{}},["type"]:"endpoint"}],wh=[{["fn"]:"substring",["argv"]:[Z,6,15,!0],["assign"]:"s3expressAvailabilityZoneId"},{["fn"]:"substring",["argv"]:[Z,15,17,!0],["assign"]:"s3expressAvailabilityZoneDelim"},{["fn"]:"stringEquals",["argv"]:[{["ref"]:"s3expressAvailabilityZoneDelim"},"--"]}],ah=[{["conditions"]:[E],["endpoint"]:{["url"]:"https://{Bucket}.s3express-fips-{s3expressAvailabilityZoneId}.{Region}.amazonaws.com",["properties"]:ir,["headers"]:{}},["type"]:"endpoint"},{["endpoint"]:{["url"]:"https://{Bucket}.s3express-{s3expressAvailabilityZoneId}.{Region}.amazonaws.com",["properties"]:ir,["headers"]:{}},["type"]:"endpoint"}],Xw=[br],Sh=[{["fn"]:"isValidHostLabel",["argv"]:[{["ref"]:"outpostId"},!1]}],Rh=[{["fn"]:"stringEquals",["argv"]:[{["ref"]:"regionPrefix"},"beta"]}],Jw=["*"],b=[Nh],Ah=[{["fn"]:"isValidHostLabel",["argv"]:[{["ref"]:"Region"},!1]}],i=[{["fn"]:"stringEquals",["argv"]:[{["ref"]:"Region"},"us-east-1"]}],sf=[{["fn"]:"stringEquals",["argv"]:[Uh,"accesspoint"]}],kh=[{["fn"]:"getAttr",["argv"]:[X,"resourceId[1]"],["assign"]:"accessPointName"},{["fn"]:"not",["argv"]:[{["fn"]:"stringEquals",["argv"]:[wf,""]}]}],Hw=[X,"resourceId[1]"],ff=[{["fn"]:"not",["argv"]:[{["fn"]:"stringEquals",["argv"]:[{["fn"]:"getAttr",["argv"]:[X,"region"]},""]}]}],Ih=[{["fn"]:"not",["argv"]:[{["fn"]:"isSet",["argv"]:[{["fn"]:"getAttr",["argv"]:[X,"resourceId[2]"]}]}]}],Qw=[X,"resourceId[2]"],lf=[{["fn"]:"aws.partition",["argv"]:[{["fn"]:"getAttr",["argv"]:[X,"region"]}],["assign"]:"bucketPartition"}],dh=[{["fn"]:"stringEquals",["argv"]:[Dh,{["fn"]:"getAttr",["argv"]:[{["ref"]:"partitionResult"},"name"]}]}],hf=[{["fn"]:"isValidHostLabel",["argv"]:[{["fn"]:"getAttr",["argv"]:[X,"region"]},!0]}],mf=[{["fn"]:"isValidHostLabel",["argv"]:[Th,!1]}],Eh=[{["fn"]:"isValidHostLabel",["argv"]:[wf,!1]}],Ph=[{["fn"]:"isValidHostLabel",["argv"]:[{["ref"]:"Region"},!0]}],yw={version:"1.0",parameters:{Bucket:hr,Region:hr,UseFIPS:mr,UseDualStack:mr,Endpoint:hr,ForcePathStyle:mr,Accelerate:mr,UseGlobalEndpoint:mr,UseObjectLambdaEndpoint:Ur,Key:hr,Prefix:hr,CopySource:hr,DisableAccessPoints:Ur,DisableMultiRegionAccessPoints:mr,UseArnRegion:Ur,UseS3ExpressControlEndpoint:Ur,DisableS3ExpressSessionAuth:Ur},rules:[{["conditions"]:[{["fn"]:"isSet",["argv"]:ps}],rules:[{["conditions"]:[B,E],error:"Accelerate cannot be used with FIPS",["type"]:"error"},{["conditions"]:[d,D],error:"Cannot set dual-stack in combination with a custom endpoint.",["type"]:"error"},{["conditions"]:[D,E],error:"A custom endpoint cannot be combined with FIPS",["type"]:"error"},{["conditions"]:[D,B],error:"A custom endpoint cannot be combined with S3 Accelerate",["type"]:"error"},{["conditions"]:[E,Nh,Fl],error:"Partition does not support FIPS",["type"]:"error"},{["conditions"]:[br,{["fn"]:"substring",["argv"]:[Z,0,6,!0],["assign"]:"bucketSuffix"},{["fn"]:"stringEquals",["argv"]:[{["ref"]:"bucketSuffix"},"--x-s3"]}],rules:[{["conditions"]:us,error:"S3Express does not support Dual-stack.",["type"]:"error"},{["conditions"]:jr,error:"S3Express does not support S3 Accelerate.",["type"]:"error"},{["conditions"]:u,rules:[{["conditions"]:lh,rules:[{["conditions"]:hh,rules:[{["conditions"]:ts,rules:[{endpoint:{["url"]:"{url#scheme}://{url#authority}/{uri_encoded_bucket}{url#path}",["properties"]:_,["headers"]:S},["type"]:"endpoint"}],["type"]:"tree"}],["type"]:"tree"},{["conditions"]:rf,rules:[{endpoint:{["url"]:"{url#scheme}://{Bucket}.{url#authority}{url#path}",["properties"]:_,["headers"]:S},["type"]:"endpoint"}],["type"]:"tree"},ys],["type"]:"tree"},{["conditions"]:hh,rules:[{["conditions"]:ts,rules:[{endpoint:{["url"]:"{url#scheme}://{url#authority}/{uri_encoded_bucket}{url#path}",["properties"]:ir,["headers"]:S},["type"]:"endpoint"}],["type"]:"tree"}],["type"]:"tree"},{["conditions"]:rf,rules:[{endpoint:{["url"]:"{url#scheme}://{Bucket}.{url#authority}{url#path}",["properties"]:ir,["headers"]:S},["type"]:"endpoint"}],["type"]:"tree"},ys],["type"]:"tree"},{["conditions"]:[Kl,Wl],rules:[{["conditions"]:[$h,R],rules:[{["conditions"]:gr,endpoint:{["url"]:"https://s3express-control-fips.{Region}.amazonaws.com/{uri_encoded_bucket}",["properties"]:_,["headers"]:S},["type"]:"endpoint"},{endpoint:{["url"]:"https://s3express-control.{Region}.amazonaws.com/{uri_encoded_bucket}",["properties"]:_,["headers"]:S},["type"]:"endpoint"}],["type"]:"tree"}],["type"]:"tree"},{["conditions"]:rf,rules:[{["conditions"]:lh,rules:[{["conditions"]:mh,rules:gh,["type"]:"tree"},{["conditions"]:wh,rules:gh,["type"]:"tree"},Vl],["type"]:"tree"},{["conditions"]:mh,rules:ah,["type"]:"tree"},{["conditions"]:wh,rules:ah,["type"]:"tree"},Vl],["type"]:"tree"},ys],["type"]:"tree"},{["conditions"]:[Zl,Kl,Wl],rules:[{["conditions"]:u,endpoint:{["url"]:"{url#scheme}://{url#authority}{url#path}",["properties"]:_,["headers"]:S},["type"]:"endpoint"},{["conditions"]:gr,endpoint:{["url"]:"https://s3express-control-fips.{Region}.amazonaws.com",["properties"]:_,["headers"]:S},["type"]:"endpoint"},{endpoint:{["url"]:"https://s3express-control.{Region}.amazonaws.com",["properties"]:_,["headers"]:S},["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[br,{["fn"]:"substring",["argv"]:[Z,49,50,!0],["assign"]:"hardwareType"},{["fn"]:"substring",["argv"]:[Z,8,12,!0],["assign"]:"regionPrefix"},{["fn"]:"substring",["argv"]:[Z,0,7,!0],["assign"]:"bucketAliasSuffix"},{["fn"]:"substring",["argv"]:[Z,32,49,!0],["assign"]:"outpostId"},{["fn"]:"aws.partition",["argv"]:ps,["assign"]:"regionPartition"},{["fn"]:"stringEquals",["argv"]:[{["ref"]:"bucketAliasSuffix"},"--op-s3"]}],rules:[{["conditions"]:Sh,rules:[{["conditions"]:[{["fn"]:"stringEquals",["argv"]:[Ll,"e"]}],rules:[{["conditions"]:Rh,rules:[Xl,{["conditions"]:u,endpoint:{["url"]:"https://{Bucket}.ec2.{url#authority}",["properties"]:qr,["headers"]:S},["type"]:"endpoint"}],["type"]:"tree"},{endpoint:{["url"]:"https://{Bucket}.ec2.s3-outposts.{Region}.{regionPartition#dnsSuffix}",["properties"]:qr,["headers"]:S},["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[{["fn"]:"stringEquals",["argv"]:[Ll,"o"]}],rules:[{["conditions"]:Rh,rules:[Xl,{["conditions"]:u,endpoint:{["url"]:"https://{Bucket}.op-{outpostId}.{url#authority}",["properties"]:qr,["headers"]:S},["type"]:"endpoint"}],["type"]:"tree"},{endpoint:{["url"]:"https://{Bucket}.op-{outpostId}.s3-outposts.{Region}.{regionPartition#dnsSuffix}",["properties"]:qr,["headers"]:S},["type"]:"endpoint"}],["type"]:"tree"},{error:"Unrecognized hardware type: \"Expected hardware type o or e but got {hardwareType}\"",["type"]:"error"}],["type"]:"tree"},{error:"Invalid ARN: The outpost Id must only contain a-z, A-Z, 0-9 and `-`.",["type"]:"error"}],["type"]:"tree"},{["conditions"]:Xw,rules:[{["conditions"]:[D,{["fn"]:"not",["argv"]:[{["fn"]:"isSet",["argv"]:[{["fn"]:"parseURL",["argv"]:Zw}]}]}],error:"Custom endpoint `{Endpoint}` was not a valid URI",["type"]:"error"},{["conditions"]:[Ys,Mh],rules:[{["conditions"]:b,rules:[{["conditions"]:Ah,rules:[{["conditions"]:[B,Fl],error:"S3 Accelerate cannot be used in this region",["type"]:"error"},{["conditions"]:[d,E,U,R,z],endpoint:{["url"]:"https://{Bucket}.s3-fips.dualstack.us-east-1.{partitionResult#dnsSuffix}",["properties"]:G,["headers"]:S},["type"]:"endpoint"},{["conditions"]:[d,E,U,R,I,F],rules:[{endpoint:Jl,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[d,E,U,R,I,K],endpoint:Jl,["type"]:"endpoint"},{["conditions"]:[k,E,U,R,z],endpoint:{["url"]:"https://{Bucket}.s3-fips.us-east-1.{partitionResult#dnsSuffix}",["properties"]:G,["headers"]:S},["type"]:"endpoint"},{["conditions"]:[k,E,U,R,I,F],rules:[{endpoint:Hl,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[k,E,U,R,I,K],endpoint:Hl,["type"]:"endpoint"},{["conditions"]:[d,A,B,R,z],endpoint:{["url"]:"https://{Bucket}.s3-accelerate.dualstack.us-east-1.{partitionResult#dnsSuffix}",["properties"]:G,["headers"]:S},["type"]:"endpoint"},{["conditions"]:[d,A,B,R,I,F],rules:[{endpoint:Ql,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[d,A,B,R,I,K],endpoint:Ql,["type"]:"endpoint"},{["conditions"]:[d,A,U,R,z],endpoint:{["url"]:"https://{Bucket}.s3.dualstack.us-east-1.{partitionResult#dnsSuffix}",["properties"]:G,["headers"]:S},["type"]:"endpoint"},{["conditions"]:[d,A,U,R,I,F],rules:[{endpoint:yl,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[d,A,U,R,I,K],endpoint:yl,["type"]:"endpoint"},{["conditions"]:[k,A,U,D,V,cr,z],endpoint:{["url"]:"{url#scheme}://{url#authority}{url#normalizedPath}{Bucket}",["properties"]:G,["headers"]:S},["type"]:"endpoint"},{["conditions"]:[k,A,U,D,V,Bs,z],endpoint:{["url"]:"{url#scheme}://{Bucket}.{url#authority}{url#path}",["properties"]:G,["headers"]:S},["type"]:"endpoint"},{["conditions"]:[k,A,U,D,V,cr,I,F],rules:[{["conditions"]:i,endpoint:vs,["type"]:"endpoint"},{endpoint:vs,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[k,A,U,D,V,Bs,I,F],rules:[{["conditions"]:i,endpoint:gf,["type"]:"endpoint"},Yl],["type"]:"tree"},{["conditions"]:[k,A,U,D,V,cr,I,K],endpoint:vs,["type"]:"endpoint"},{["conditions"]:[k,A,U,D,V,Bs,I,K],endpoint:gf,["type"]:"endpoint"},{["conditions"]:[k,A,B,R,z],endpoint:{["url"]:"https://{Bucket}.s3-accelerate.{partitionResult#dnsSuffix}",["properties"]:G,["headers"]:S},["type"]:"endpoint"},{["conditions"]:[k,A,B,R,I,F],rules:[{["conditions"]:i,endpoint:Os,["type"]:"endpoint"},{endpoint:Os,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[k,A,B,R,I,K],endpoint:Os,["type"]:"endpoint"},{["conditions"]:[k,A,U,R,z],endpoint:{["url"]:"https://{Bucket}.s3.{partitionResult#dnsSuffix}",["properties"]:G,["headers"]:S},["type"]:"endpoint"},{["conditions"]:[k,A,U,R,I,F],rules:[{["conditions"]:i,endpoint:{["url"]:"https://{Bucket}.s3.{partitionResult#dnsSuffix}",["properties"]:T,["headers"]:S},["type"]:"endpoint"},{endpoint:Bl,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[k,A,U,R,I,K],endpoint:Bl,["type"]:"endpoint"}],["type"]:"tree"},_r],["type"]:"tree"}],["type"]:"tree"},{["conditions"]:[D,V,{["fn"]:"stringEquals",["argv"]:[{["fn"]:"getAttr",["argv"]:[eh,"scheme"]},"http"]},{["fn"]:"aws.isVirtualHostableS3Bucket",["argv"]:[Z,!0]},Ys,A,k,U],rules:[{["conditions"]:b,rules:[{["conditions"]:Ah,rules:[Yl],["type"]:"tree"},_r],["type"]:"tree"}],["type"]:"tree"},{["conditions"]:[Ys,{["fn"]:"aws.parseArn",["argv"]:Lw,["assign"]:"bucketArn"}],rules:[{["conditions"]:[{["fn"]:"getAttr",["argv"]:[X,"resourceId[0]"],["assign"]:"arnType"},{["fn"]:"not",["argv"]:[{["fn"]:"stringEquals",["argv"]:[Uh,""]}]}],rules:[{["conditions"]:[{["fn"]:"stringEquals",["argv"]:[qs,"s3-object-lambda"]}],rules:[{["conditions"]:sf,rules:[{["conditions"]:kh,rules:[vl,Ol,{["conditions"]:ff,rules:[ql,{["conditions"]:Ih,rules:[_s,{["conditions"]:lf,rules:[{["conditions"]:b,rules:[{["conditions"]:dh,rules:[{["conditions"]:hf,rules:[{["conditions"]:[{["fn"]:"stringEquals",["argv"]:[Th,""]}],error:"Invalid ARN: Missing account id",["type"]:"error"},{["conditions"]:mf,rules:[{["conditions"]:Eh,rules:[{["conditions"]:u,endpoint:{["url"]:"{url#scheme}://{accessPointName}-{bucketArn#accountId}.{url#authority}{url#path}",["properties"]:js,["headers"]:S},["type"]:"endpoint"},{["conditions"]:gr,endpoint:{["url"]:"https://{accessPointName}-{bucketArn#accountId}.s3-object-lambda-fips.{bucketArn#region}.{bucketPartition#dnsSuffix}",["properties"]:js,["headers"]:S},["type"]:"endpoint"},{endpoint:{["url"]:"https://{accessPointName}-{bucketArn#accountId}.s3-object-lambda.{bucketArn#region}.{bucketPartition#dnsSuffix}",["properties"]:js,["headers"]:S},["type"]:"endpoint"}],["type"]:"tree"},_l],["type"]:"tree"},cs],["type"]:"tree"},bs],["type"]:"tree"},is],["type"]:"tree"}],["type"]:"tree"}],["type"]:"tree"},jl],["type"]:"tree"},{error:"Invalid ARN: bucket ARN is missing a region",["type"]:"error"}],["type"]:"tree"},cl],["type"]:"tree"},{error:"Invalid ARN: Object Lambda ARNs only support `accesspoint` arn types, but found: `{arnType}`",["type"]:"error"}],["type"]:"tree"},{["conditions"]:sf,rules:[{["conditions"]:kh,rules:[{["conditions"]:ff,rules:[{["conditions"]:sf,rules:[{["conditions"]:ff,rules:[ql,{["conditions"]:Ih,rules:[_s,{["conditions"]:lf,rules:[{["conditions"]:b,rules:[{["conditions"]:[{["fn"]:"stringEquals",["argv"]:[Dh,"{partitionResult#name}"]}],rules:[{["conditions"]:hf,rules:[{["conditions"]:[{["fn"]:"stringEquals",["argv"]:[qs,"s3"]}],rules:[{["conditions"]:mf,rules:[{["conditions"]:Eh,rules:[{["conditions"]:jr,error:"Access Points do not support S3 Accelerate",["type"]:"error"},{["conditions"]:[E,d],endpoint:{["url"]:"https://{accessPointName}-{bucketArn#accountId}.s3-accesspoint-fips.dualstack.{bucketArn#region}.{bucketPartition#dnsSuffix}",["properties"]:Dr,["headers"]:S},["type"]:"endpoint"},{["conditions"]:[E,k],endpoint:{["url"]:"https://{accessPointName}-{bucketArn#accountId}.s3-accesspoint-fips.{bucketArn#region}.{bucketPartition#dnsSuffix}",["properties"]:Dr,["headers"]:S},["type"]:"endpoint"},{["conditions"]:[A,d],endpoint:{["url"]:"https://{accessPointName}-{bucketArn#accountId}.s3-accesspoint.dualstack.{bucketArn#region}.{bucketPartition#dnsSuffix}",["properties"]:Dr,["headers"]:S},["type"]:"endpoint"},{["conditions"]:[A,k,D,V],endpoint:{["url"]:"{url#scheme}://{accessPointName}-{bucketArn#accountId}.{url#authority}{url#path}",["properties"]:Dr,["headers"]:S},["type"]:"endpoint"},{["conditions"]:[A,k],endpoint:{["url"]:"https://{accessPointName}-{bucketArn#accountId}.s3-accesspoint.{bucketArn#region}.{bucketPartition#dnsSuffix}",["properties"]:Dr,["headers"]:S},["type"]:"endpoint"}],["type"]:"tree"},_l],["type"]:"tree"},cs],["type"]:"tree"},{error:"Invalid ARN: The ARN was not for the S3 service, found: {bucketArn#service}",["type"]:"error"}],["type"]:"tree"},bs],["type"]:"tree"},is],["type"]:"tree"}],["type"]:"tree"}],["type"]:"tree"},jl],["type"]:"tree"}],["type"]:"tree"}],["type"]:"tree"},{["conditions"]:[{["fn"]:"isValidHostLabel",["argv"]:[wf,!0]}],rules:[{["conditions"]:us,error:"S3 MRAP does not support dual-stack",["type"]:"error"},{["conditions"]:gr,error:"S3 MRAP does not support FIPS",["type"]:"error"},{["conditions"]:jr,error:"S3 MRAP does not support S3 Accelerate",["type"]:"error"},{["conditions"]:[{["fn"]:"booleanEquals",["argv"]:[{["ref"]:"DisableMultiRegionAccessPoints"},!0]}],error:"Invalid configuration: Multi-Region Access Point ARNs are disabled.",["type"]:"error"},{["conditions"]:[{["fn"]:"aws.partition",["argv"]:ps,["assign"]:"mrapPartition"}],rules:[{["conditions"]:[{["fn"]:"stringEquals",["argv"]:[{["fn"]:"getAttr",["argv"]:[{["ref"]:"mrapPartition"},"name"]},{["fn"]:"getAttr",["argv"]:[X,"partition"]}]}],rules:[{endpoint:{["url"]:"https://{accessPointName}.accesspoint.s3-global.{mrapPartition#dnsSuffix}",["properties"]:{["authSchemes"]:[{["disableDoubleEncoding"]:!0,name:"sigv4a",["signingName"]:"s3",["signingRegionSet"]:Jw}]},["headers"]:S},["type"]:"endpoint"}],["type"]:"tree"},{error:"Client was configured for partition `{mrapPartition#name}` but bucket referred to partition `{bucketArn#partition}`",["type"]:"error"}],["type"]:"tree"}],["type"]:"tree"},{error:"Invalid Access Point Name",["type"]:"error"}],["type"]:"tree"},cl],["type"]:"tree"},{["conditions"]:[{["fn"]:"stringEquals",["argv"]:[qs,"s3-outposts"]}],rules:[{["conditions"]:us,error:"S3 Outposts does not support Dual-stack",["type"]:"error"},{["conditions"]:gr,error:"S3 Outposts does not support FIPS",["type"]:"error"},{["conditions"]:jr,error:"S3 Outposts does not support S3 Accelerate",["type"]:"error"},{["conditions"]:[{["fn"]:"isSet",["argv"]:[{["fn"]:"getAttr",["argv"]:[X,"resourceId[4]"]}]}],error:"Invalid Arn: Outpost Access Point ARN contains sub resources",["type"]:"error"},{["conditions"]:[{["fn"]:"getAttr",["argv"]:Hw,["assign"]:"outpostId"}],rules:[{["conditions"]:Sh,rules:[_s,{["conditions"]:lf,rules:[{["conditions"]:b,rules:[{["conditions"]:dh,rules:[{["conditions"]:hf,rules:[{["conditions"]:mf,rules:[{["conditions"]:[{["fn"]:"getAttr",["argv"]:Qw,["assign"]:"outpostType"}],rules:[{["conditions"]:[{["fn"]:"getAttr",["argv"]:[X,"resourceId[3]"],["assign"]:"accessPointName"}],rules:[{["conditions"]:[{["fn"]:"stringEquals",["argv"]:[{["ref"]:"outpostType"},"accesspoint"]}],rules:[{["conditions"]:u,endpoint:{["url"]:"https://{accessPointName}-{bucketArn#accountId}.{outpostId}.{url#authority}",["properties"]:bl,["headers"]:S},["type"]:"endpoint"},{endpoint:{["url"]:"https://{accessPointName}-{bucketArn#accountId}.{outpostId}.s3-outposts.{bucketArn#region}.{bucketPartition#dnsSuffix}",["properties"]:bl,["headers"]:S},["type"]:"endpoint"}],["type"]:"tree"},{error:"Expected an outpost type `accesspoint`, found {outpostType}",["type"]:"error"}],["type"]:"tree"},{error:"Invalid ARN: expected an access point name",["type"]:"error"}],["type"]:"tree"},{error:"Invalid ARN: Expected a 4-component resource",["type"]:"error"}],["type"]:"tree"},cs],["type"]:"tree"},bs],["type"]:"tree"},is],["type"]:"tree"}],["type"]:"tree"}],["type"]:"tree"},{error:"Invalid ARN: The outpost Id may only contain a-z, A-Z, 0-9 and `-`. Found: `{outpostId}`",["type"]:"error"}],["type"]:"tree"},{error:"Invalid ARN: The Outpost Id was not set",["type"]:"error"}],["type"]:"tree"},{error:"Invalid ARN: Unrecognized format: {Bucket} (type: {arnType})",["type"]:"error"}],["type"]:"tree"},{error:"Invalid ARN: No ARN type specified",["type"]:"error"}],["type"]:"tree"},{["conditions"]:[{["fn"]:"substring",["argv"]:[Z,0,4,!1],["assign"]:"arnPrefix"},{["fn"]:"stringEquals",["argv"]:[{["ref"]:"arnPrefix"},"arn:"]},{["fn"]:"not",["argv"]:[{["fn"]:"isSet",["argv"]:[il]}]}],error:"Invalid ARN: `{Bucket}` was not a valid ARN",["type"]:"error"},{["conditions"]:[{["fn"]:"booleanEquals",["argv"]:[Vw,!0]},il],error:"Path-style addressing cannot be used with ARN buckets",["type"]:"error"},{["conditions"]:ts,rules:[{["conditions"]:b,rules:[{["conditions"]:[U],rules:[{["conditions"]:[d,R,E,z],endpoint:{["url"]:"https://s3-fips.dualstack.us-east-1.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",["properties"]:G,["headers"]:S},["type"]:"endpoint"},{["conditions"]:[d,R,E,I,F],rules:[{endpoint:xl,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[d,R,E,I,K],endpoint:xl,["type"]:"endpoint"},{["conditions"]:[k,R,E,z],endpoint:{["url"]:"https://s3-fips.us-east-1.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",["properties"]:G,["headers"]:S},["type"]:"endpoint"},{["conditions"]:[k,R,E,I,F],rules:[{endpoint:ol,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[k,R,E,I,K],endpoint:ol,["type"]:"endpoint"},{["conditions"]:[d,R,A,z],endpoint:{["url"]:"https://s3.dualstack.us-east-1.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",["properties"]:G,["headers"]:S},["type"]:"endpoint"},{["conditions"]:[d,R,A,I,F],rules:[{endpoint:nl,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[d,R,A,I,K],endpoint:nl,["type"]:"endpoint"},{["conditions"]:[k,D,V,A,z],endpoint:{["url"]:"{url#scheme}://{url#authority}{url#normalizedPath}{uri_encoded_bucket}",["properties"]:G,["headers"]:S},["type"]:"endpoint"},{["conditions"]:[k,D,V,A,I,F],rules:[{["conditions"]:i,endpoint:xs,["type"]:"endpoint"},{endpoint:xs,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[k,D,V,A,I,K],endpoint:xs,["type"]:"endpoint"},{["conditions"]:[k,R,A,z],endpoint:{["url"]:"https://s3.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",["properties"]:G,["headers"]:S},["type"]:"endpoint"},{["conditions"]:[k,R,A,I,F],rules:[{["conditions"]:i,endpoint:{["url"]:"https://s3.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",["properties"]:T,["headers"]:S},["type"]:"endpoint"},{endpoint:pl,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[k,R,A,I,K],endpoint:pl,["type"]:"endpoint"}],["type"]:"tree"},{error:"Path-style addressing cannot be used with S3 Accelerate",["type"]:"error"}],["type"]:"tree"}],["type"]:"tree"}],["type"]:"tree"},{["conditions"]:[{["fn"]:"isSet",["argv"]:[ul]},{["fn"]:"booleanEquals",["argv"]:[ul,!0]}],rules:[{["conditions"]:b,rules:[{["conditions"]:Ph,rules:[vl,Ol,{["conditions"]:u,endpoint:{["url"]:"{url#scheme}://{url#authority}{url#path}",["properties"]:os,["headers"]:S},["type"]:"endpoint"},{["conditions"]:gr,endpoint:{["url"]:"https://s3-object-lambda-fips.{Region}.{partitionResult#dnsSuffix}",["properties"]:os,["headers"]:S},["type"]:"endpoint"},{endpoint:{["url"]:"https://s3-object-lambda.{Region}.{partitionResult#dnsSuffix}",["properties"]:os,["headers"]:S},["type"]:"endpoint"}],["type"]:"tree"},_r],["type"]:"tree"}],["type"]:"tree"},{["conditions"]:[Zl],rules:[{["conditions"]:b,rules:[{["conditions"]:Ph,rules:[{["conditions"]:[E,d,R,z],endpoint:{["url"]:"https://s3-fips.dualstack.us-east-1.{partitionResult#dnsSuffix}",["properties"]:G,["headers"]:S},["type"]:"endpoint"},{["conditions"]:[E,d,R,I,F],rules:[{endpoint:tl,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[E,d,R,I,K],endpoint:tl,["type"]:"endpoint"},{["conditions"]:[E,k,R,z],endpoint:{["url"]:"https://s3-fips.us-east-1.{partitionResult#dnsSuffix}",["properties"]:G,["headers"]:S},["type"]:"endpoint"},{["conditions"]:[E,k,R,I,F],rules:[{endpoint:rh,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[E,k,R,I,K],endpoint:rh,["type"]:"endpoint"},{["conditions"]:[A,d,R,z],endpoint:{["url"]:"https://s3.dualstack.us-east-1.{partitionResult#dnsSuffix}",["properties"]:G,["headers"]:S},["type"]:"endpoint"},{["conditions"]:[A,d,R,I,F],rules:[{endpoint:sh,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[A,d,R,I,K],endpoint:sh,["type"]:"endpoint"},{["conditions"]:[A,k,D,V,z],endpoint:{["url"]:"{url#scheme}://{url#authority}{url#path}",["properties"]:G,["headers"]:S},["type"]:"endpoint"},{["conditions"]:[A,k,D,V,I,F],rules:[{["conditions"]:i,endpoint:ns,["type"]:"endpoint"},{endpoint:ns,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[A,k,D,V,I,K],endpoint:ns,["type"]:"endpoint"},{["conditions"]:[A,k,R,z],endpoint:{["url"]:"https://s3.{partitionResult#dnsSuffix}",["properties"]:G,["headers"]:S},["type"]:"endpoint"},{["conditions"]:[A,k,R,I,F],rules:[{["conditions"]:i,endpoint:{["url"]:"https://s3.{partitionResult#dnsSuffix}",["properties"]:T,["headers"]:S},["type"]:"endpoint"},{endpoint:fh,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[A,k,R,I,K],endpoint:fh,["type"]:"endpoint"}],["type"]:"tree"},_r],["type"]:"tree"}],["type"]:"tree"}],["type"]:"tree"},{error:"A region must be set when sending requests to S3.",["type"]:"error"}]},zh=yw;var xr=(r,s={})=>{return Gh(zh,{endpointParams:r,logger:s.logger})};Ch.aws=Fh;var Vh=function(r){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"s3",region:r.region},propertiesExtractor:(s,f)=>({signingProperties:{config:s,context:f}})}},Zh=function(r){return{schemeId:"aws.auth#sigv4a",signingProperties:{name:"s3",region:r.region},propertiesExtractor:(s,f)=>({signingProperties:{config:s,context:f}})}},Yw=(r)=>async(s,f,l)=>{if(!l)throw new Error("Could not find \`input\` for \`defaultEndpointRuleSetHttpAuthSchemeParametersProvider\`");const h=await r(s,f,l),m=Tr.getSmithyContext(f)?.commandInstance?.constructor?.getEndpointParameterInstructions;if(!m)throw new Error(`getEndpointParameterInstructions() is not defined on \`${f.commandName}\``);const g=await Kh(l,{getEndpointParameterInstructions:m},s);return Object.assign(h,g)},Bw=async(r,s,f)=>{return{operation:Tr.getSmithyContext(s).operation,region:await Tr.normalizeProvider(r.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()}},Wh=Yw(Bw),vw=(r,s,f)=>{return(h)=>{const g=r(h).properties?.authSchemes;if(!g)return s(h);const w=[];for(let a of g){const{name:P,properties:N={},...$}=a,e=P.toLowerCase();if(P!==e)console.warn(`HttpAuthScheme has been normalized with lowercasing: \`${P}\` to \`${e}\``);let H;if(e==="sigv4a"){H="aws.auth#sigv4a";const Jr=g.find((q)=>{const er=q.name.toLowerCase();return er!=="sigv4a"&&er.startsWith("sigv4")});if(!Or.CrtSignerV4&&Jr)continue}else if(e.startsWith("sigv4"))H="aws.auth#sigv4";else throw new Error(`Unknown HttpAuthScheme found in \`@smithy.rules#endpointRuleSet\`: \`${e}\``);const Q=f[H];if(!Q)throw new Error(`Could not find HttpAuthOption create function for \`${H}\``);const Y=Q(h);Y.schemeId=H,Y.signingProperties={...Y.signingProperties||{},...$,...N},w.push(Y)}return w}},Ow=(r)=>{const s=[];switch(r.operation){default:s.push(Vh(r)),s.push(Zh(r))}return s},Lh=vw(xr,Ow,{"aws.auth#sigv4":Vh,"aws.auth#sigv4a":Zh}),Xh=(r)=>{const s=nr.resolveAwsSdkSigV4Config(r);return{...nr.resolveAwsSdkSigV4AConfig(s)}};var Jh=(r)=>{return{...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"}},wr={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 L extends Hh{constructor(r){super(r);Object.setPrototypeOf(this,L.prototype)}}class pr extends L{constructor(r){super({name:"NoSuchUpload",$fault:"client",...r});this.name="NoSuchUpload",this.$fault="client",Object.setPrototypeOf(this,pr.prototype)}}class ur extends L{constructor(r){super({name:"ObjectNotInActiveTierError",$fault:"client",...r});this.name="ObjectNotInActiveTierError",this.$fault="client",Object.setPrototypeOf(this,ur.prototype)}}class tr extends L{constructor(r){super({name:"BucketAlreadyExists",$fault:"client",...r});this.name="BucketAlreadyExists",this.$fault="client",Object.setPrototypeOf(this,tr.prototype)}}class rs extends L{constructor(r){super({name:"BucketAlreadyOwnedByYou",$fault:"client",...r});this.name="BucketAlreadyOwnedByYou",this.$fault="client",Object.setPrototypeOf(this,rs.prototype)}}class ss extends L{constructor(r){super({name:"NoSuchBucket",$fault:"client",...r});this.name="NoSuchBucket",this.$fault="client",Object.setPrototypeOf(this,ss.prototype)}}var af;(function(r){r.visit=(s,f)=>{if(s.Prefix!==void 0)return f.Prefix(s.Prefix);if(s.Tag!==void 0)return f.Tag(s.Tag);if(s.And!==void 0)return f.And(s.And);return f._(s.$unknown[0],s.$unknown[1])}})(af||(af={}));var Sf;(function(r){r.visit=(s,f)=>{if(s.Prefix!==void 0)return f.Prefix(s.Prefix);if(s.Tag!==void 0)return f.Tag(s.Tag);if(s.ObjectSizeGreaterThan!==void 0)return f.ObjectSizeGreaterThan(s.ObjectSizeGreaterThan);if(s.ObjectSizeLessThan!==void 0)return f.ObjectSizeLessThan(s.ObjectSizeLessThan);if(s.And!==void 0)return f.And(s.And);return f._(s.$unknown[0],s.$unknown[1])}})(Sf||(Sf={}));var Rf;(function(r){r.visit=(s,f)=>{if(s.Prefix!==void 0)return f.Prefix(s.Prefix);if(s.Tag!==void 0)return f.Tag(s.Tag);if(s.AccessPointArn!==void 0)return f.AccessPointArn(s.AccessPointArn);if(s.And!==void 0)return f.And(s.And);return f._(s.$unknown[0],s.$unknown[1])}})(Rf||(Rf={}));var Af;(function(r){r.visit=(s,f)=>{if(s.Prefix!==void 0)return f.Prefix(s.Prefix);if(s.Tag!==void 0)return f.Tag(s.Tag);if(s.And!==void 0)return f.And(s.And);return f._(s.$unknown[0],s.$unknown[1])}})(Af||(Af={}));class fs extends L{constructor(r){super({name:"InvalidObjectState",$fault:"client",...r});this.name="InvalidObjectState",this.$fault="client",Object.setPrototypeOf(this,fs.prototype),this.StorageClass=r.StorageClass,this.AccessTier=r.AccessTier}}class ls extends L{constructor(r){super({name:"NoSuchKey",$fault:"client",...r});this.name="NoSuchKey",this.$fault="client",Object.setPrototypeOf(this,ls.prototype)}}class hs extends L{constructor(r){super({name:"NotFound",$fault:"client",...r});this.name="NotFound",this.$fault="client",Object.setPrototypeOf(this,hs.prototype)}}var qw=(r)=>({...r,...r.SecretAccessKey&&{SecretAccessKey:v},...r.SessionToken&&{SessionToken:v}}),Qh=(r)=>({...r,...r.Credentials&&{Credentials:qw(r.Credentials)}});var yh=(r)=>({...r,...r.SSEKMSKeyId&&{SSEKMSKeyId:v}}),Yh=(r)=>({...r,...r.SSECustomerKey&&{SSECustomerKey:v}});var Rr=W(or(),1);var Ss=W(Xs(),1);class ms extends L{constructor(r){super({name:"ObjectAlreadyInActiveTierError",$fault:"client",...r});this.name="ObjectAlreadyInActiveTierError",this.$fault="client",Object.setPrototypeOf(this,ms.prototype)}}var Bh;(function(r){r.visit=(s,f)=>{if(s.Records!==void 0)return f.Records(s.Records);if(s.Stats!==void 0)return f.Stats(s.Stats);if(s.Progress!==void 0)return f.Progress(s.Progress);if(s.Cont!==void 0)return f.Cont(s.Cont);if(s.End!==void 0)return f.End(s.End);return f._(s.$unknown[0],s.$unknown[1])}})(Bh||(Bh={}));var vh=(r)=>({...r,...r.SSEKMSKeyId&&{SSEKMSKeyId:v},...r.SSEKMSEncryptionContext&&{SSEKMSEncryptionContext:v}}),Oh=(r)=>({...r,...r.SSECustomerKey&&{SSECustomerKey:v},...r.SSEKMSKeyId&&{SSEKMSKeyId:v},...r.SSEKMSEncryptionContext&&{SSEKMSEncryptionContext:v}});var rm=async(r,s)=>{const f=Ss.requestBuilder(r,s),l=C({},j,{[p3]:r[K3]});f.bp("/"),f.p("Bucket",()=>r.Bucket,"{Bucket}",!1);const h=C({[i3]:[,""]});let m;return f.m("GET").h(l).q(h).b(m),f.build()};var sm=async(r,s)=>{const f=Ss.requestBuilder(r,s),l=C({},j,{[H3]:r[I3],[Q3]:[()=>j(r[qh]),()=>zr(r[qh]).toString()],[y3]:r[d3],[Y3]:[()=>j(r[_h]),()=>zr(r[_h]).toString()],[v3]:r[$3],[ks]:r[Rs],[Jm]:r[Nm],[Is]:r[As],[Zm]:r[Pm],[Fm]:r[Am],[n3]:r[h3]});f.bp("/{Key+}"),f.p("Bucket",()=>r.Bucket,"{Bucket}",!1),f.p("Key",()=>r.Key,"{Key+}",!0);const h=C({[ym]:[,"GetObject"],[O3]:[,r[M3]],[q3]:[,r[U3]],[_3]:[,r[D3]],[j3]:[,r[T3]],[c3]:[,r[z3]],[b3]:[()=>r.ResponseExpires!==void 0,()=>zr(r[C3]).toString()],[x3]:[,r[Zf]],[B3]:[()=>r.PartNumber!==void 0,()=>r[e3].toString()]});let m;return f.m("GET").h(l).q(h).b(m),f.build()};var fm=async(r,s)=>{const f=Ss.requestBuilder(r,s),l=C({},j,{[zm]:r[Rm]||"application/octet-stream",[o3]:r[s3],[Mm]:r[gm],[Um]:r[wm],[Dm]:r[am],[Tm]:r[Sm],[Mf]:[()=>j(r[Nf]),()=>r[Nf].toString()],[L3]:r[m3],[ha]:r[l3],[Lf]:r[Cf],[Xf]:r[Gf],[Jf]:r[Ff],[Hf]:r[Kf],[Uf]:[()=>j(r[ef]),()=>zr(r[ef]).toString()],[u3]:r[S3],[t3]:r[R3],[ra]:r[A3],[sa]:r[k3],[Qf]:r[Wf],[Lm]:r[Gr],[Qm]:r[$m],[ks]:r[Rs],[Jm]:r[Nm],[Is]:r[As],[yf]:r[Vf],[Xm]:r[em],[Fr]:[()=>j(r[as]),()=>r[as].toString()],[Zm]:r[Pm],[ma]:r[W3],[Wm]:r[dm],[Df]:[()=>j(r[$f]),()=>th(r[$f]).toString()],[Km]:r[Im],[Fm]:r[Am],...r.Metadata!==void 0&&Object.keys(r.Metadata).reduce((w,a)=>{return w[`x-amz-meta-${a.toLowerCase()}`]=r.Metadata[a],w},{})});f.bp("/{Key+}"),f.p("Bucket",()=>r.Bucket,"{Bucket}",!1),f.p("Key",()=>r.Key,"{Key+}",!0);const h=C({[ym]:[,"PutObject"]});let m,g;if(r.Body!==void 0)g=r.Body,m=g;return f.m("PUT").h(l).q(h).b(m),f.build()};var lm=async(r,s)=>{if(r.statusCode!==200&&r.statusCode>=300)return zf(r,s);const f=C({$metadata:y(r)}),l=ar(nh(await Rr.parseXmlBody(r.body,s)),"body");if(l[df]!=null)f[df]=r3(l[df],s);return f};var hm=async(r,s)=>{if(r.statusCode!==200&&r.statusCode>=300)return zf(r,s);const f=C({$metadata:y(r),[w3]:[()=>r.headers[ch]!==void 0,()=>ws(r.headers[ch])],[f3]:[,r.headers[Z3]],[Cr]:[,r.headers[Gm]],[F3]:[,r.headers[fa]],[E3]:[()=>r.headers[jh]!==void 0,()=>ar($r(r.headers[jh]))],[Nf]:[()=>r.headers[Mf]!==void 0,()=>ph(r.headers[Mf])],[km]:[,r.headers[Cm]],[Cf]:[,r.headers[Lf]],[Gf]:[,r.headers[Xf]],[Ff]:[,r.headers[Jf]],[Kf]:[,r.headers[Hf]],[P3]:[()=>r.headers[bh]!==void 0,()=>gs(r.headers[bh])],[Zf]:[,r.headers[Hm]],[gm]:[,r.headers[Mm]],[wm]:[,r.headers[Um]],[am]:[,r.headers[Dm]],[Sm]:[,r.headers[Tm]],[g3]:[,r.headers[X3]],[Rm]:[,r.headers[zm]],[ef]:[()=>r.headers[Uf]!==void 0,()=>ar($r(r.headers[Uf]))],[a3]:[,r.headers[J3]],[$m]:[,r.headers[Qm]],[Wf]:[,r.headers[Qf]],[Rs]:[,r.headers[ks]],[As]:[,r.headers[Is]],[Vf]:[,r.headers[yf]],[as]:[()=>r.headers[Fr]!==void 0,()=>ws(r.headers[Fr])],[Gr]:[,r.headers[Lm]],[Em]:[,r.headers[Vm]],[G3]:[,r.headers[la]],[N3]:[()=>r.headers[ih]!==void 0,()=>gs(r.headers[ih])],[V3]:[()=>r.headers[xh]!==void 0,()=>gs(r.headers[xh])],[dm]:[,r.headers[Wm]],[$f]:[()=>r.headers[Df]!==void 0,()=>ar(Tf(r.headers[Df]))],[Im]:[,r.headers[Km]],Metadata:[,Object.keys(r.headers).filter((h)=>h.startsWith("x-amz-meta-")).reduce((h,m)=>{return h[m.substring(11)]=r.headers[m],h},{})]}),l=r.body;return s.sdkStreamMixin(l),f.Body=l,f};var mm=async(r,s)=>{if(r.statusCode!==200&&r.statusCode>=300)return zf(r,s);const f=C({$metadata:y(r),[Cr]:[,r.headers[Gm]],[km]:[,r.headers[Cm]],[Cf]:[,r.headers[Lf]],[Gf]:[,r.headers[Xf]],[Ff]:[,r.headers[Jf]],[Kf]:[,r.headers[Hf]],[Wf]:[,r.headers[Qf]],[Zf]:[,r.headers[Hm]],[Rs]:[,r.headers[ks]],[As]:[,r.headers[Is]],[Vf]:[,r.headers[yf]],[em]:[,r.headers[Xm]],[as]:[()=>r.headers[Fr]!==void 0,()=>ws(r.headers[Fr])],[Em]:[,r.headers[Vm]]});return await oh(r.body,s),f};var zf=async(r,s)=>{const f={...r,body:await Rr.parseXmlErrorBody(r.body,s)},l=Rr.loadRestXmlErrorCode(r,f.body);switch(l){case"NoSuchUpload":case"com.amazonaws.s3#NoSuchUpload":throw await nw(f,s);case"ObjectNotInActiveTierError":case"com.amazonaws.s3#ObjectNotInActiveTierError":throw await tw(f,s);case"BucketAlreadyExists":case"com.amazonaws.s3#BucketAlreadyExists":throw await cw(f,s);case"BucketAlreadyOwnedByYou":case"com.amazonaws.s3#BucketAlreadyOwnedByYou":throw await bw(f,s);case"NoSuchBucket":case"com.amazonaws.s3#NoSuchBucket":throw await xw(f,s);case"InvalidObjectState":case"com.amazonaws.s3#InvalidObjectState":throw await iw(f,s);case"NoSuchKey":case"com.amazonaws.s3#NoSuchKey":throw await ow(f,s);case"NotFound":case"com.amazonaws.s3#NotFound":throw await pw(f,s);case"ObjectAlreadyInActiveTierError":case"com.amazonaws.s3#ObjectAlreadyInActiveTierError":throw await uw(f,s);default:const h=f.body;return jw({output:r,parsedBody:h,errorCode:l})}},jw=uh(L),cw=async(r,s)=>{const f=C({}),l=r.body,h=new tr({$metadata:y(r),...f});return O(h,r.body)},bw=async(r,s)=>{const f=C({}),l=r.body,h=new rs({$metadata:y(r),...f});return O(h,r.body)},iw=async(r,s)=>{const f=C({}),l=r.body;if(l[If]!=null)f[If]=Sr(l[If]);if(l[Gr]!=null)f[Gr]=Sr(l[Gr]);const h=new fs({$metadata:y(r),...f});return O(h,r.body)},xw=async(r,s)=>{const f=C({}),l=r.body,h=new ss({$metadata:y(r),...f});return O(h,r.body)},ow=async(r,s)=>{const f=C({}),l=r.body,h=new ls({$metadata:y(r),...f});return O(h,r.body)},nw=async(r,s)=>{const f=C({}),l=r.body,h=new pr({$metadata:y(r),...f});return O(h,r.body)},pw=async(r,s)=>{const f=C({}),l=r.body,h=new hs({$metadata:y(r),...f});return O(h,r.body)},uw=async(r,s)=>{const f=C({}),l=r.body,h=new ms({$metadata:y(r),...f});return O(h,r.body)},tw=async(r,s)=>{const f=C({}),l=r.body,h=new ur({$metadata:y(r),...f});return O(h,r.body)};var r3=(r,s)=>{const f={};if(r[kf]!=null)f[kf]=Sr(r[kf]);if(r[Ef]!=null)f[Ef]=Sr(r[Ef]);if(r[Pf]!=null)f[Pf]=Sr(r[Pf]);if(r[Cr]!=null)f[Cr]=ar(Tf(r[Cr]));return f};var y=(r)=>({httpStatusCode:r.statusCode,requestId:r.headers["x-amzn-requestid"]??r.headers["x-amzn-request-id"]??r.headers["x-amz-request-id"],extendedRequestId:r.headers["x-amz-id-2"],cfId:r.headers["x-amz-cf-id"]});var j=(r)=>r!==void 0&&r!==null&&r!==""&&(!Object.getOwnPropertyNames(r).includes("length")||r.length!=0)&&(!Object.getOwnPropertyNames(r).includes("size")||r.size!=0);var s3="ACL";var kf="AccessKeyId";var f3="AcceptRanges";var If="AccessTier";var as="BucketKeyEnabled";var df="Credentials",l3="ChecksumAlgorithm";var gm="CacheControl",Cf="ChecksumCRC32",Gf="ChecksumCRC32C",wm="ContentDisposition";var am="ContentEncoding";var Sm="ContentLanguage",Nf="ContentLength",h3="ChecksumMode",m3="ContentMD5";var g3="ContentRange";var Ff="ChecksumSHA1",Kf="ChecksumSHA256";var Rm="ContentType";var w3="DeleteMarker";var ef="Expires";var Am="ExpectedBucketOwner";var a3="ExpiresString";var km="ETag";var Cr="Expiration";var S3="GrantFullControl";var R3="GrantRead",A3="GrantReadACP";var k3="GrantWriteACP";var I3="IfMatch",qh="IfModifiedSince",d3="IfNoneMatch";var _h="IfUnmodifiedSince";var E3="LastModified";var P3="MissingMeta";var Im="ObjectLockLegalHoldStatus",dm="ObjectLockMode";var $f="ObjectLockRetainUntilDate";var N3="PartsCount";var e3="PartNumber";var $3="Range";var Em="RequestCharged",M3="ResponseCacheControl",U3="ResponseContentDisposition",D3="ResponseContentEncoding",T3="ResponseContentLanguage",z3="ResponseContentType";var C3="ResponseExpires";var Pm="RequestPayer";var G3="ReplicationStatus";var F3="Restore";var Ef="SecretAccessKey";var Gr="StorageClass";var K3="SessionMode";var Wf="ServerSideEncryption";var Rs="SSECustomerAlgorithm",Nm="SSECustomerKey",As="SSECustomerKeyMD5";var em="SSEKMSEncryptionContext",Vf="SSEKMSKeyId";var Pf="SessionToken";var W3="Tagging";var V3="TagCount";var Zf="VersionId";var $m="WebsiteRedirectLocation";var Z3="accept-ranges";var Mm="cache-control",Um="content-disposition",Dm="content-encoding",Tm="content-language",Mf="content-length",L3="content-md5",X3="content-range",zm="content-type";var Uf="expires";var Cm="etag",J3="expiresstring";var H3="if-match",Q3="if-modified-since";var y3="if-none-match";var Y3="if-unmodified-since";var jh="last-modified";var B3="partNumber";var v3="range",O3="response-cache-control",q3="response-content-disposition",_3="response-content-encoding",j3="response-content-language",c3="response-content-type",b3="response-expires";var i3="session";var x3="versionId";var o3="x-amz-acl";var Lf="x-amz-checksum-crc32",Xf="x-amz-checksum-crc32c",n3="x-amz-checksum-mode";var Jf="x-amz-checksum-sha1",Hf="x-amz-checksum-sha256";var p3="x-amz-create-session-mode";var ch="x-amz-delete-marker",Gm="x-amz-expiration",Fm="x-amz-expected-bucket-owner";var u3="x-amz-grant-full-control",t3="x-amz-grant-read",ra="x-amz-grant-read-acp";var sa="x-amz-grant-write-acp";var bh="x-amz-missing-meta";var ih="x-amz-mp-parts-count";var Km="x-amz-object-lock-legal-hold",Wm="x-amz-object-lock-mode",Df="x-amz-object-lock-retain-until-date";var fa="x-amz-restore",Vm="x-amz-request-charged";var Zm="x-amz-request-payer";var la="x-amz-replication-status";var Lm="x-amz-storage-class",ha="x-amz-sdk-checksum-algorithm";var Qf="x-amz-server-side-encryption",yf="x-amz-server-side-encryption-aws-kms-key-id",Fr="x-amz-server-side-encryption-bucket-key-enabled",Xm="x-amz-server-side-encryption-context",ks="x-amz-server-side-encryption-customer-algorithm",Jm="x-amz-server-side-encryption-customer-key",Is="x-amz-server-side-encryption-customer-key-md5",ma="x-amz-tagging",xh="x-amz-tagging-count";var Hm="x-amz-version-id",Qm="x-amz-website-redirect-location",ym="x-id";class Yf extends Ar.classBuilder().ep({...wr,DisableS3ExpressSessionAuth:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function(r,s,f,l){return[kr(f,this.serialize,this.deserialize),Ir(f,r.getEndpointParameterInstructions()),vr(f)]}).s("AmazonS3","CreateSession",{}).n("S3Client","CreateSessionCommand").f(void 0,Qh).ser(rm).de(lm).build(){}var Ym={name:"@aws-sdk/client-s3",description:"AWS SDK for JavaScript S3 Client for Node.js, Browser and React Native",version:"3.629.0",scripts:{build:"concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'","build:cjs":"node ../../scripts/compilation/inline client-s3","build:es":"tsc -p tsconfig.es.json","build:include:deps":"lerna run --scope $npm_package_name --include-dependencies build","build:types":"tsc -p tsconfig.types.json","build:types:downlevel":"downlevel-dts dist-types dist-types/ts3.4",clean:"rimraf ./dist-* && rimraf *.tsbuildinfo","extract:docs":"api-extractor run --local","generate:client":"node ../../scripts/generate-clients/single-service --solo s3",test:"yarn test:unit","test:e2e":"yarn test:e2e:node && yarn test:e2e:browser","test:e2e:browser":"ts-mocha test/**/*.browser.ispec.ts && karma start karma.conf.js","test:e2e:node":"jest --c jest.config.e2e.js","test:unit":"ts-mocha test/unit/**/*.spec.ts"},main:"./dist-cjs/index.js",types:"./dist-types/index.d.ts",module:"./dist-es/index.js",sideEffects:!1,dependencies:{"@aws-crypto/sha1-browser":"5.2.0","@aws-crypto/sha256-browser":"5.2.0","@aws-crypto/sha256-js":"5.2.0","@aws-sdk/client-sso-oidc":"3.629.0","@aws-sdk/client-sts":"3.629.0","@aws-sdk/core":"3.629.0","@aws-sdk/credential-provider-node":"3.629.0","@aws-sdk/middleware-bucket-endpoint":"3.620.0","@aws-sdk/middleware-expect-continue":"3.620.0","@aws-sdk/middleware-flexible-checksums":"3.620.0","@aws-sdk/middleware-host-header":"3.620.0","@aws-sdk/middleware-location-constraint":"3.609.0","@aws-sdk/middleware-logger":"3.609.0","@aws-sdk/middleware-recursion-detection":"3.620.0","@aws-sdk/middleware-sdk-s3":"3.629.0","@aws-sdk/middleware-ssec":"3.609.0","@aws-sdk/middleware-user-agent":"3.620.0","@aws-sdk/region-config-resolver":"3.614.0","@aws-sdk/signature-v4-multi-region":"3.629.0","@aws-sdk/types":"3.609.0","@aws-sdk/util-endpoints":"3.614.0","@aws-sdk/util-user-agent-browser":"3.609.0","@aws-sdk/util-user-agent-node":"3.614.0","@aws-sdk/xml-builder":"3.609.0","@smithy/config-resolver":"^3.0.5","@smithy/core":"^2.3.2","@smithy/eventstream-serde-browser":"^3.0.6","@smithy/eventstream-serde-config-resolver":"^3.0.3","@smithy/eventstream-serde-node":"^3.0.5","@smithy/fetch-http-handler":"^3.2.4","@smithy/hash-blob-browser":"^3.1.2","@smithy/hash-node":"^3.0.3","@smithy/hash-stream-node":"^3.1.2","@smithy/invalid-dependency":"^3.0.3","@smithy/md5-js":"^3.0.3","@smithy/middleware-content-length":"^3.0.5","@smithy/middleware-endpoint":"^3.1.0","@smithy/middleware-retry":"^3.0.14","@smithy/middleware-serde":"^3.0.3","@smithy/middleware-stack":"^3.0.3","@smithy/node-config-provider":"^3.1.4","@smithy/node-http-handler":"^3.1.4","@smithy/protocol-http":"^4.1.0","@smithy/smithy-client":"^3.1.12","@smithy/types":"^3.3.0","@smithy/url-parser":"^3.0.3","@smithy/util-base64":"^3.0.0","@smithy/util-body-length-browser":"^3.0.0","@smithy/util-body-length-node":"^3.0.0","@smithy/util-defaults-mode-browser":"^3.0.14","@smithy/util-defaults-mode-node":"^3.0.14","@smithy/util-endpoints":"^2.0.5","@smithy/util-middleware":"^3.0.3","@smithy/util-retry":"^3.0.3","@smithy/util-stream":"^3.1.3","@smithy/util-utf8":"^3.0.0","@smithy/util-waiter":"^3.1.2",tslib:"^2.6.2"},devDependencies:{"@aws-sdk/signature-v4-crt":"3.629.0","@tsconfig/node16":"16.1.3","@types/chai":"^4.2.11","@types/mocha":"^8.0.4","@types/node":"^16.18.96",concurrently:"7.0.0","downlevel-dts":"0.10.1",rimraf:"3.0.2",typescript:"~4.9.5"},engines:{node:">=16.0.0"},typesVersions:{"<4.0":{"dist-types/*":["dist-types/ts3.4/*"]}},files:["dist-*/**"],author:{name:"AWS SDK for JavaScript Team",url:"https://aws.amazon.com/javascript/"},license:"Apache-2.0",browser:{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.browser"},"react-native":{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.native"},homepage:"https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-s3",repository:{type:"git",url:"https://github.com/aws/aws-sdk-js-v3.git",directory:"clients/client-s3"}};var Ts=W(or(),1);var wa="AWS_S3_USE_ARN_REGION",aa="s3_use_arn_region",Bm={environmentVariableSelector:(r)=>n(r,wa,p.ENV),configFileSelector:(r)=>n(r,aa,p.CONFIG),default:!1};var vm=W(ea(),1),{__extends:zA,__assign:CA,__rest:GA,__decorate:FA,__param:KA,__esDecorate:WA,__runInitializers:VA,__propKey:ZA,__setFunctionName:LA,__metadata:XA,__awaiter:ds,__generator:Es,__exportStar:JA,__createBinding:HA,__values:Ps,__read:QA,__spread:yA,__spreadArrays:YA,__spreadArray:BA,__await:vA,__asyncGenerator:OA,__asyncDelegator:qA,__asyncValues:_A,__makeTemplateObject:jA,__importStar:cA,__importDefault:bA,__classPrivateFieldGet:iA,__classPrivateFieldSet:xA,__classPrivateFieldIn:oA,__addDisposableResource:nA,__disposeResources:pA}=vm.default;import{Buffer as Om} from"buffer";var qm=(r,s)=>{if(typeof r!=="string")throw new TypeError(`The "input" argument must be of type string. Received type ${typeof r} (${r})`);return s?Om.from(r,s):Om.from(r)};var Bf=(r)=>{const s=qm(r,"utf8");return new Uint8Array(s.buffer,s.byteOffset,s.byteLength/Uint8Array.BYTES_PER_ELEMENT)};function Kr(r){if(r instanceof Uint8Array)return r;if(typeof r==="string")return $a(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength/Uint8Array.BYTES_PER_ELEMENT);return new Uint8Array(r)}var $a=typeof Buffer!=="undefined"&&Buffer.from?function(r){return Buffer.from(r,"utf8")}:Bf;function Wr(r){if(typeof r==="string")return r.length===0;return r.byteLength===0}function Vr(r){return new Uint8Array([(r&4278190080)>>24,(r&16711680)>>16,(r&65280)>>8,r&255])}function Zr(r){if(!Uint32Array.from){var s=new Uint32Array(r.length),f=0;while(f<r.length)s[f]=r[f],f+=1;return s}return Uint32Array.from(r)}var vf=function(){function r(){this.crc32=new t}return r.prototype.update=function(s){if(Wr(s))return;this.crc32.update(Kr(s))},r.prototype.digest=function(){return ds(this,void 0,void 0,function(){return Es(this,function(s){return[2,Vr(this.crc32.digest())]})})},r.prototype.reset=function(){this.crc32=new t},r}();var t=function(){function r(){this.checksum=4294967295}return r.prototype.update=function(s){var f,l;try{for(var h=Ps(s),m=h.next();!m.done;m=h.next()){var g=m.value;this.checksum=this.checksum>>>8^Ua[(this.checksum^g)&255]}}catch(w){f={error:w}}finally{try{if(m&&!m.done&&(l=h.return))l.call(h)}finally{if(f)throw f.error}}return this},r.prototype.digest=function(){return(this.checksum^4294967295)>>>0},r}();var Ma=[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,936918000,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117],Ua=Zr(Ma);var x=W(jm(),1);var cm=W(jm(),1),_m=function(r){for(let s=0;s<8;s++)r[s]^=255;for(let s=7;s>-1;s--)if(r[s]++,r[s]!==0)break};class dr{constructor(r){if(this.bytes=r,r.byteLength!==8)throw new Error("Int64 buffers must be exactly 8 bytes")}static fromNumber(r){if(r>9223372036854776000||r<-9223372036854776000)throw new Error(`${r} is too large (or, if negative, too small) to represent as an Int64`);const s=new Uint8Array(8);for(let f=7,l=Math.abs(Math.round(r));f>-1&&l>0;f--,l/=256)s[f]=l;if(r<0)_m(s);return new dr(s)}valueOf(){const r=this.bytes.slice(0),s=r[0]&128;if(s)_m(r);return parseInt(cm.toHex(r),16)*(s?-1:1)}toString(){return String(this.valueOf())}}class Of{constructor(r,s){this.toUtf8=r,this.fromUtf8=s}format(r){const s=[];for(let h of Object.keys(r)){const m=this.fromUtf8(h);s.push(Uint8Array.from([m.byteLength]),m,this.formatHeaderValue(r[h]))}const f=new Uint8Array(s.reduce((h,m)=>h+m.byteLength,0));let l=0;for(let h of s)f.set(h,l),l+=h.byteLength;return f}formatHeaderValue(r){switch(r.type){case"boolean":return Uint8Array.from([r.value?0:1]);case"byte":return Uint8Array.from([2,r.value]);case"short":const s=new DataView(new ArrayBuffer(3));return s.setUint8(0,3),s.setInt16(1,r.value,!1),new Uint8Array(s.buffer);case"integer":const f=new DataView(new ArrayBuffer(5));return f.setUint8(0,4),f.setInt32(1,r.value,!1),new Uint8Array(f.buffer);case"long":const l=new Uint8Array(9);return l[0]=5,l.set(r.value.bytes,1),l;case"binary":const h=new DataView(new ArrayBuffer(3+r.value.byteLength));h.setUint8(0,6),h.setUint16(1,r.value.byteLength,!1);const m=new Uint8Array(h.buffer);return m.set(r.value,3),m;case"string":const g=this.fromUtf8(r.value),w=new DataView(new ArrayBuffer(3+g.byteLength));w.setUint8(0,7),w.setUint16(1,g.byteLength,!1);const a=new Uint8Array(w.buffer);return a.set(g,3),a;case"timestamp":const P=new Uint8Array(9);return P[0]=8,P.set(dr.fromNumber(r.value.valueOf()).bytes,1),P;case"uuid":if(!Va.test(r.value))throw new Error(`Invalid UUID received: ${r.value}`);const N=new Uint8Array(17);return N[0]=9,N.set(x.fromHex(r.value.replace(/\-/g,"")),1),N}}parse(r){const s={};let f=0;while(f<r.byteLength){const l=r.getUint8(f++),h=this.toUtf8(new Uint8Array(r.buffer,r.byteOffset+f,l));switch(f+=l,r.getUint8(f++)){case 0:s[h]={type:im,value:!0};break;case 1:s[h]={type:im,value:!1};break;case 2:s[h]={type:Da,value:r.getInt8(f++)};break;case 3:s[h]={type:Ta,value:r.getInt16(f,!1)},f+=2;break;case 4:s[h]={type:za,value:r.getInt32(f,!1)},f+=4;break;case 5:s[h]={type:Ca,value:new dr(new Uint8Array(r.buffer,r.byteOffset+f,8))},f+=8;break;case 6:const m=r.getUint16(f,!1);f+=2,s[h]={type:Ga,value:new Uint8Array(r.buffer,r.byteOffset+f,m)},f+=m;break;case 7:const g=r.getUint16(f,!1);f+=2,s[h]={type:Fa,value:this.toUtf8(new Uint8Array(r.buffer,r.byteOffset+f,g))},f+=g;break;case 8:s[h]={type:Ka,value:new Date(new dr(new Uint8Array(r.buffer,r.byteOffset+f,8)).valueOf())},f+=8;break;case 9:const w=new Uint8Array(r.buffer,r.byteOffset+f,16);f+=16,s[h]={type:Wa,value:`${x.toHex(w.subarray(0,4))}-${x.toHex(w.subarray(4,6))}-${x.toHex(w.subarray(6,8))}-${x.toHex(w.subarray(8,10))}-${x.toHex(w.subarray(10))}`};break;default:throw new Error("Unrecognized header type tag")}}return s}}var bm;(function(r){r[r.boolTrue=0]="boolTrue",r[r.boolFalse=1]="boolFalse",r[r.byte=2]="byte",r[r.short=3]="short",r[r.integer=4]="integer",r[r.long=5]="long",r[r.byteArray=6]="byteArray",r[r.string=7]="string",r[r.timestamp=8]="timestamp",r[r.uuid=9]="uuid"})(bm||(bm={}));var im="boolean",Da="byte",Ta="short",za="integer",Ca="long",Ga="binary",Fa="string",Ka="timestamp",Wa="uuid",Va=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;function om({byteLength:r,byteOffset:s,buffer:f}){if(r<Za)throw new Error("Provided message too short to accommodate event stream message overhead");const l=new DataView(f,s,r),h=l.getUint32(0,!1);if(r!==h)throw new Error("Reported message length does not match received message length");const m=l.getUint32(xm,!1),g=l.getUint32(o,!1),w=l.getUint32(r-rr,!1),a=new t().update(new Uint8Array(f,s,o));if(g!==a.digest())throw new Error(`The prelude checksum specified in the message (${g}) does not match the calculated CRC32 checksum (${a.digest()})`);if(a.update(new Uint8Array(f,s+o,r-(o+rr))),w!==a.digest())throw new Error(`The message checksum (${a.digest()}) did not match the expected value of ${w}`);return{headers:new DataView(f,s+o+rr,m),body:new Uint8Array(f,s+o+rr+m,h-m-(o+rr+rr))}}var xm=4,o=xm*2,rr=4,Za=o+rr*2;class qf{constructor(r,s){this.headerMarshaller=new Of(r,s),this.messageBuffer=[],this.isEndOfStream=!1}feed(r){this.messageBuffer.push(this.decode(r))}endOfStream(){this.isEndOfStream=!0}getMessage(){const r=this.messageBuffer.pop(),s=this.isEndOfStream;return{getMessage(){return r},isEndOfStream(){return s}}}getAvailableMessages(){const r=this.messageBuffer;this.messageBuffer=[];const s=this.isEndOfStream;return{getMessages(){return r},isEndOfStream(){return s}}}encode({headers:r,body:s}){const f=this.headerMarshaller.format(r),l=f.byteLength+s.byteLength+16,h=new Uint8Array(l),m=new DataView(h.buffer,h.byteOffset,h.byteLength),g=new t;return m.setUint32(0,l,!1),m.setUint32(4,f.byteLength,!1),m.setUint32(8,g.update(h.subarray(0,8)).digest(),!1),h.set(f,12),h.set(s,f.byteLength+12),m.setUint32(l-4,g.update(h.subarray(8,l-4)).digest(),!1),h}decode(r){const{headers:s,body:f}=om(r);return{headers:this.headerMarshaller.parse(s),body:f}}formatHeaders(r){return this.headerMarshaller.format(r)}}class _f{constructor(r){this.options=r}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let r of this.options.inputStream)yield this.options.decoder.decode(r)}}class jf{constructor(r){this.options=r}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let r of this.options.messageStream)yield this.options.encoder.encode(r);if(this.options.includeEndFrame)yield new Uint8Array(0)}}class cf{constructor(r){this.options=r}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let r of this.options.messageStream){const s=await this.options.deserializer(r);if(s===void 0)continue;yield s}}}class bf{constructor(r){this.options=r}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let r of this.options.inputStream)yield this.options.serializer(r)}}function nm(r){let s=0,f=0,l=null,h=null;const m=(w)=>{if(typeof w!=="number")throw new Error("Attempted to allocate an event message where size was not a number: "+w);s=w,f=4,l=new Uint8Array(w),new DataView(l.buffer).setUint32(0,w,!1)},g=async function*(){const w=r[Symbol.asyncIterator]();while(!0){const{value:a,done:P}=await w.next();if(P){if(!s)return;else if(s===f)yield l;else throw new Error("Truncated event message received.");return}const N=a.length;let $=0;while($<N){if(!l){const H=N-$;if(!h)h=new Uint8Array(4);const Q=Math.min(4-f,H);if(h.set(a.slice($,$+Q),f),f+=Q,$+=Q,f<4)break;m(new DataView(h.buffer).getUint32(0,!1)),h=null}const e=Math.min(s-f,N-$);if(l.set(a.slice($,$+e),f),f+=e,$+=e,s&&s===f)yield l,l=null,s=0,f=0}}};return{[Symbol.asyncIterator]:g}}function pm(r,s){return async function(f){const{value:l}=f.headers[":message-type"];if(l==="error"){const h=new Error(f.headers[":error-message"].value||"UnknownError");throw h.name=f.headers[":error-code"].value,h}else if(l==="exception"){const h=f.headers[":exception-type"].value,m={[h]:f},g=await r(m);if(g.$unknown){const w=new Error(s(f.body));throw w.name=h,w}throw g[h]}else if(l==="event"){const h={[f.headers[":event-type"].value]:f},m=await r(h);if(m.$unknown)return;return m}else throw Error(`Unrecognizable event type: ${f.headers[":event-type"].value}`)}}class Ns{constructor({utf8Encoder:r,utf8Decoder:s}){this.eventStreamCodec=new qf(r,s),this.utfEncoder=r}deserialize(r,s){const f=nm(r);return new cf({messageStream:new _f({inputStream:f,decoder:this.eventStreamCodec}),deserializer:pm(s,this.utfEncoder)})}serialize(r,s){return new jf({messageStream:new bf({inputStream:r,serializer:s}),encoder:this.eventStreamCodec,includeEndFrame:!0})}}import{Readable as La} from"stream";async function*um(r){let s=!1,f=!1;const l=new Array;r.on("error",(h)=>{if(!s)s=!0;if(h)throw h}),r.on("data",(h)=>{l.push(h)}),r.on("end",()=>{s=!0});while(!f){const h=await new Promise((m)=>setTimeout(()=>m(l.shift()),0));if(h)yield h;f=s&&l.length===0}}class xf{constructor({utf8Encoder:r,utf8Decoder:s}){this.universalMarshaller=new Ns({utf8Decoder:s,utf8Encoder:r})}deserialize(r,s){const f=typeof r[Symbol.asyncIterator]==="function"?r:um(r);return this.universalMarshaller.deserialize(f,s)}serialize(r,s){return La.from(this.universalMarshaller.serialize(r,s))}}var tm=(r)=>new xf(r);import{Writable as Xa} from"stream";class $s extends Xa{constructor(r,s){super(s);this.hash=r}_write(r,s,f){try{this.hash.update(es(r))}catch(l){return f(l)}f()}}var rg=(r,s)=>{if(s.readableFlowing!==null)throw new Error("Unable to calculate hash for flowing readable stream");const f=new r,l=new $s(f);return s.pipe(l),new Promise((h,m)=>{s.on("error",(g)=>{l.end(),m(g)}),l.on("error",m),l.on("finish",()=>{f.digest().then(h).catch(m)})})};var Ms=W(or(),1);var mg=W(Ja(),1);var Us=W(Dl(),1);var gg=(r)=>{return{apiVersion:"2006-03-01",base64Decoder:r?.base64Decoder??lg,base64Encoder:r?.base64Encoder??hg,disableHostPrefix:r?.disableHostPrefix??!1,endpointProvider:r?.endpointProvider??xr,extensions:r?.extensions??[],getAwsChunkedEncodingStream:r?.getAwsChunkedEncodingStream??Us.getAwsChunkedEncodingStream,httpAuthSchemeProvider:r?.httpAuthSchemeProvider??Lh,httpAuthSchemes:r?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:(s)=>s.getIdentityProvider("aws.auth#sigv4"),signer:new Ms.AwsSdkSigV4Signer},{schemeId:"aws.auth#sigv4a",identityProvider:(s)=>s.getIdentityProvider("aws.auth#sigv4a"),signer:new Ms.AwsSdkSigV4ASigner}],logger:r?.logger??new Hr,sdkStreamMixin:r?.sdkStreamMixin??Us.sdkStreamMixin,serviceId:r?.serviceId??"S3",signerConstructor:r?.signerConstructor??Qs,signingEscapePath:r?.signingEscapePath??!1,urlParser:r?.urlParser??mg.parseUrl,useArnRegion:r?.useArnRegion??!1,utf8Decoder:r?.utf8Decoder??sg,utf8Encoder:r?.utf8Encoder??fg}};var Dg=(r)=>{ag(process.version);const s=Mg(r),f=()=>s().then(wg),l=gg(r);return Ts.emitWarningIfUnsupportedVersion(process.version),{...l,...r,runtime:"node",defaultsMode:s,bodyLengthChecker:r?.bodyLengthChecker??$g,credentialDefaultProvider:r?.credentialDefaultProvider??Ug,defaultUserAgentProvider:r?.defaultUserAgentProvider??eg({serviceId:l.serviceId,clientVersion:Ym.version}),disableS3ExpressSessionAuth:r?.disableS3ExpressSessionAuth??c(Zs),eventStreamSerdeProvider:r?.eventStreamSerdeProvider??tm,maxAttempts:r?.maxAttempts??c(dg),md5:r?.md5??Ds.bind(null,"md5"),region:r?.region??c(Ag,kg),requestHandler:Pg.create(r?.requestHandler??f),retryMode:r?.retryMode??c({...Eg,default:async()=>(await f()).retryMode||Ig}),sha1:r?.sha1??Ds.bind(null,"sha1"),sha256:r?.sha256??Ds.bind(null,"sha256"),sigv4aSigningRegionSet:r?.sigv4aSigningRegionSet??c(Ts.NODE_SIGV4A_CONFIG_OPTIONS),streamCollector:r?.streamCollector??Ng,streamHasher:r?.streamHasher??rg,useArnRegion:r?.useArnRegion??c(Bm),useDualstackEndpoint:r?.useDualstackEndpoint??c(Sg),useFipsEndpoint:r?.useFipsEndpoint??c(Rg)}};var Tg=(r)=>{const s=r.httpAuthSchemes;let{httpAuthSchemeProvider:f,credentials:l}=r;return{setHttpAuthScheme(h){const m=s.findIndex((g)=>g.schemeId===h.schemeId);if(m===-1)s.push(h);else s.splice(m,1,h)},httpAuthSchemes(){return s},setHttpAuthSchemeProvider(h){f=h},httpAuthSchemeProvider(){return f},setCredentials(h){l=h},credentials(){return l}}},zg=(r)=>{return{httpAuthSchemes:r.httpAuthSchemes(),httpAuthSchemeProvider:r.httpAuthSchemeProvider(),credentials:r.credentials()}};var zs=(r)=>r,Zg=(r,s)=>{const f={...zs(Wg(r)),...zs(Fg(r)),...zs(Cg(r)),...zs(Tg(r))};return s.forEach((l)=>l.configure(f)),{...r,...Vg(f),...Kg(f),...Gg(f),...zg(f)}};class of extends Qg{constructor(...[r]){const s=Dg(r||{}),f=Jh(s),l=yg(f),h=qg(l),m=Bg(h),g=Lg(m),w=Og(g),a=Gl(w),P=Xh(a),N=Ul(P,{session:[()=>this,Yf]}),$=Zg(N,r?.extensions||[]);super($);this.config=$,this.middlewareStack.use(Yg(this.config)),this.middlewareStack.use(_g(this.config)),this.middlewareStack.use(vg(this.config)),this.middlewareStack.use(Xg(this.config)),this.middlewareStack.use(Jg(this.config)),this.middlewareStack.use(Hg(this.config)),this.middlewareStack.use(Er.getHttpAuthSchemeEndpointRuleSetPlugin(this.config,{httpAuthSchemeParametersProvider:Wh,identityProviderConfigProvider:async(e)=>new Er.DefaultIdentityProviderConfig({"aws.auth#sigv4":e.credentials,"aws.auth#sigv4a":e.credentials})})),this.middlewareStack.use(Er.getHttpSigningPlugin(this.config)),this.middlewareStack.use(Cl(this.config)),this.middlewareStack.use(fl(this.config)),this.middlewareStack.use(gl(this.config)),this.middlewareStack.use(Ls(this.config)),this.middlewareStack.use(Js(this.config))}destroy(){super.destroy()}}function Ha(r){return(s)=>async(f)=>{const l={...f.input},h=[{target:"SSECustomerKey",hash:"SSECustomerKeyMD5"},{target:"CopySourceSSECustomerKey",hash:"CopySourceSSECustomerKeyMD5"}];for(let m of h){const g=l[m.target];if(g){let w;if(typeof g==="string")if(ya(g,r))w=r.base64Decoder(g);else w=r.utf8Decoder(g),l[m.target]=r.base64Encoder(w);else w=ArrayBuffer.isView(g)?new Uint8Array(g.buffer,g.byteOffset,g.byteLength):new Uint8Array(g),l[m.target]=r.base64Encoder(w);const a=new r.md5;a.update(w),l[m.hash]=r.base64Encoder(await a.digest())}}return s({...f,input:l})}}function ya(r,s){if(!/^(?:[A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(r))return!1;try{return s.base64Decoder(r).length===32}catch{return!1}}var Qa={name:"ssecMiddleware",step:"initialize",tags:["SSE"],override:!0},Cs=(r)=>({applyToStack:(s)=>{s.add(Ha(r),Qa)}});var M;(function(r){r.MD5="MD5",r.CRC32="CRC32",r.CRC32C="CRC32C",r.SHA1="SHA1",r.SHA256="SHA256"})(M||(M={}));var jg;(function(r){r.HEADER="header",r.TRAILER="trailer"})(jg||(jg={}));var{MD5:cg,CRC32:bg}=M;var Lr=[M.CRC32,M.CRC32C,M.SHA1,M.SHA256],ig=[M.CRC32,M.CRC32C,M.SHA1,M.SHA256];var xg=(r,{requestChecksumRequired:s,requestAlgorithmMember:f},l)=>{const h=l?bg:cg;if(!f||!r[f])return s?h:void 0;const m=r[f];if(!Lr.includes(m))throw new Error(`The checksum algorithm "${m}" is not supported by the client.`+` Select one of ${Lr}.`);return m};var Pr=(r)=>r===M.MD5?"content-md5":`x-amz-checksum-${r.toLowerCase()}`;var og=(r,s)=>{const f=r.toLowerCase();for(let l of Object.keys(s))if(f===l.toLowerCase())return!0;return!1};var Nr=(r)=>r!==void 0&&typeof r!=="string"&&!ArrayBuffer.isView(r)&&!ng(r);var pf=function(){function r(){this.crc32c=new nf}return r.prototype.update=function(s){if(Wr(s))return;this.crc32c.update(Kr(s))},r.prototype.digest=function(){return ds(this,void 0,void 0,function(){return Es(this,function(s){return[2,Vr(this.crc32c.digest())]})})},r.prototype.reset=function(){this.crc32c=new nf},r}();var nf=function(){function r(){this.checksum=4294967295}return r.prototype.update=function(s){var f,l;try{for(var h=Ps(s),m=h.next();!m.done;m=h.next()){var g=m.value;this.checksum=this.checksum>>>8^Ba[(this.checksum^g)&255]}}catch(w){f={error:w}}finally{try{if(m&&!m.done&&(l=h.return))l.call(h)}finally{if(f)throw f.error}}return this},r.prototype.digest=function(){return(this.checksum^4294967295)>>>0},r}();var Ya=[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],Ba=Zr(Ya);var Gs=(r,s)=>({[M.MD5]:s.md5,[M.CRC32]:vf,[M.CRC32C]:pf,[M.SHA1]:s.sha1,[M.SHA256]:s.sha256})[r];var Fs=(r,s)=>{const f=new r;return f.update(es(s||"")),f.digest()};var pg={name:"flexibleChecksumsMiddleware",step:"build",tags:["BODY_CHECKSUM"],override:!0},ug=(r,s)=>(f,l)=>async(h)=>{if(!J.isInstance(h.request))return f(h);const{request:m}=h,{body:g,headers:w}=m,{base64Encoder:a,streamHasher:P}=r,{input:N,requestChecksumRequired:$,requestAlgorithmMember:e}=s,H=xg(N,{requestChecksumRequired:$,requestAlgorithmMember:e},!!l.isS3ExpressBucket);let Q=g,Y=w;if(H){const q=Pr(H),er=Gs(H,r);if(Nr(g)){const{getAwsChunkedEncodingStream:Vs,bodyLengthChecker:gw}=r;Q=Vs(g,{base64Encoder:a,bodyLengthChecker:gw,checksumLocationName:q,checksumAlgorithmFn:er,streamHasher:P}),Y={...w,"content-encoding":w["content-encoding"]?`${w["content-encoding"]},aws-chunked`:"aws-chunked","transfer-encoding":"chunked","x-amz-decoded-content-length":w["content-length"],"x-amz-content-sha256":"STREAMING-UNSIGNED-PAYLOAD-TRAILER","x-amz-trailer":q},delete Y["content-length"]}else if(!og(q,w)){const Vs=await Fs(er,g);Y={...w,[q]:a(Vs)}}}return await f({...h,request:{...m,headers:Y,body:Q}})};var Ks=(r=[])=>{const s=[];for(let f of ig){if(!r.includes(f)||!Lr.includes(f))continue;s.push(f)}return s};var tg=(r)=>{const s=r.lastIndexOf("-");if(s!==-1){const f=r.slice(s+1);if(!f.startsWith("0")){const l=parseInt(f,10);if(!isNaN(l)&&l>=1&&l<=1e4)return!0}}return!1};import{Transform as va} from"stream";function uf(r){const s=new va;return s.push(r),s.push(null),s}var rw=async(r,{streamHasher:s,checksumAlgorithmFn:f,base64Encoder:l})=>{const h=Nr(r)?s(f,r):Fs(f,r);return l(await h)};var sw=async(r,{config:s,responseAlgorithms:f})=>{const l=Ks(f),{body:h,headers:m}=r;for(let g of l){const w=Pr(g),a=m[w];if(a){const P=Gs(g,s),{streamHasher:N,base64Encoder:$}=s,e=await rw(h,{streamHasher:N,checksumAlgorithmFn:P,base64Encoder:$});if(e===a)break;throw new Error(`Checksum mismatch: expected "${e}" but received "${a}"`+` in response header "${w}".`)}}};var fw={name:"flexibleChecksumsResponseMiddleware",toMiddleware:"deserializerMiddleware",relation:"after",tags:["BODY_CHECKSUM"],override:!0},lw=(r,s)=>(f,l)=>async(h)=>{if(!J.isInstance(h.request))return f(h);const m=h.input,g=await f(h),w=g.response;let a=void 0;const{requestValidationModeMember:P,responseAlgorithms:N}=s;if(P&&m[P]==="ENABLED"){const{clientName:$,commandName:e}=l;if($==="S3Client"&&e==="GetObjectCommand"&&Ks(N).every((Y)=>{const Jr=Pr(Y),q=w.headers[Jr];return!q||tg(q)}))return g;const Q=Nr(w.body);if(Q)a=await r.streamCollector(w.body),w.body=uf(a);if(await sw(g.response,{config:r,responseAlgorithms:N}),Q&&a)w.body=uf(a)}return g};var Ws=(r,s)=>({applyToStack:(f)=>{f.add(ug(r,s),pg),f.addRelativeTo(lw(r,s),fw)}});class tf extends Ar.classBuilder().ep({...wr,Bucket:{type:"contextParams",name:"Bucket"},Key:{type:"contextParams",name:"Key"}}).m(function(r,s,f,l){return[kr(f,this.serialize,this.deserialize),Ir(f,r.getEndpointParameterInstructions()),Ws(f,{input:this.input,requestChecksumRequired:!1,requestValidationModeMember:"ChecksumMode",responseAlgorithms:["CRC32","CRC32C","SHA256","SHA1"]}),Cs(f),wl(f)]}).s("AmazonS3","GetObject",{}).n("S3Client","GetObjectCommand").f(Yh,yh).ser(sm).de(hm).build(){}class rl extends Ar.classBuilder().ep({...wr,Bucket:{type:"contextParams",name:"Bucket"},Key:{type:"contextParams",name:"Key"}}).m(function(r,s,f,l){return[kr(f,this.serialize,this.deserialize),Ir(f,r.getEndpointParameterInstructions()),Ws(f,{input:this.input,requestAlgorithmMember:"ChecksumAlgorithm",requestChecksumRequired:!1}),ll(f),vr(f),Cs(f)]}).s("AmazonS3","PutObject",{}).n("S3Client","PutObjectCommand").f(Oh,vh).ser(fm).de(mm).build(){}import{Buffer as hw} from"buffer";var mw=new of;class Xr{static folder(r){if(!r||r.includes("null")||r.includes("undefined"))throw new Error("Folder path has to be specified.");return{put:async(s)=>{let f;if(s instanceof Blob)return f=`${sl()}.${s.type.split("/")[1]}`,Xr.put({body:s,name:`${r}/${f}`});return Xr.put({...s,name:`${r}/${f}`})},fetch:async(s)=>{let f=process.env.BUCKET_NAME,l;if(typeof s==="string")l=s;else f=s.bucket??f,l=s.name;if(!l)throw new Error("Object name has to be specified");return Xr.fetch({...s,name:`${r}/${l}`})}}}static async put(r){let s,f,l,h=process.env.BUCKET_NAME;if(r instanceof Blob)s=r,l=`${sl()}.${r.type.split("/")[1]}`,f=r.type;else s=r.body,l=r.name,f=r.contentType;f=s instanceof Blob||s instanceof File?s.type:void 0;const m=s instanceof hw?s:hw.from(await s.arrayBuffer());return await mw.send(new rl({Bucket:h,Key:l,Body:m,ContentType:f})),l}static async fetch(r){let s=process.env.BUCKET_NAME,f;if(typeof r==="string")f=r;else s=r.bucket??s,f=r.name;if(!f)throw new Error("Object name has to be specified");const l=await mw.send(new tf({Bucket:s,Key:f}));return new Response(l.Body.transformToWebStream(),{headers:{"Content-Type":l.ContentType,"Content-Length":l.ContentLength.toString(),"Cache-Control":"private, max-age=12000, must-revalidate","Last-Modified":l.LastModified?.toUTCString()||"",ETag:l.ETag||""}})}static delete(){}}export{Xr as Storage};
|
|
2
|
+
import"../chunk-94578320d28e33ad.js";import{x as U} from"../chunk-a5c18c07abe8fd9c.js";import{A as Mm,B as F,C as _r,D as Or,F as Fm,G as xr,J as nh,K as Cr,L as v,M as ph,N as uh,O as th,P as pe,Q as em,R as lm,S as ar,T as rm,U as Pl,V as Nl,W as ja,X as dr,Y as B,_ as Us,ba as Ar,ca as ia,da as Sr,ea as ba,fa as Ds,ga as Lr,ia as jf,ja as Ur,ka as La,la as O,ma as xa,na as am,oa as hm,pa as Tm,qa as ym,sa as G,ua as oa,z as Um} from"../chunk-3ab807ceccde81f3.js";import{$a as Im,Aa as ps,Ba as p,Ca as u,Da as sf,Ea as Wm,Fa as Ua,Ga as Ma,Ha as Ta,Ia as Xm,Ja as mm,Ka as gm,La as wm,Ma as Am,Na as Zm,Oa as Qm,Pa as ya,Qa as Ir,Ra as Er,Sa as Vm,Ta as Sm,Ua as Te,Va as Rm,Wa as vm,Xa as dm,Ya as Jm,Za as IA,_a as ws,ab as Xs,bb as Em,cb as km,db as Cm,eb as cm,wa as Gm,xa as Hm,ya as Km,za as Lm} from"../chunk-29bc27c5e126c304.js";import{fb as Eg} from"../chunk-bbd36ce62b950ee5.js";import{gb as KA,hb as i} from"../chunk-9d069ba29a122630.js";import"../chunk-0ffc38ed09847e35.js";import{jb as Pm} from"../chunk-860f5fcef7074193.js";import"../chunk-a816613f5321b9db.js";function fg(r){return(s)=>async(f)=>{const{request:e}=f;if(F.isInstance(e)&&e.body&&r.runtime==="node"){if(r.requestHandler?.constructor?.name!=="FetchHttpHandler")e.headers={...e.headers,Expect:"100-continue"}}return s({...f,request:e})}}var eg={step:"build",tags:["SET_EXPECT_HEADER","EXPECT_HEADER"],name:"addExpectContinueMiddleware",override:!0},ye=(r)=>({applyToStack:(s)=>{s.add(fg(r),eg)}});function ag(){return(r,s)=>async(f)=>{const{request:e}=f;if(F.isInstance(e)){if(!(lg in e.headers))if(typeof s?.logger?.warn==="function"&&!(s.logger instanceof Or))s.logger.warn("Are you using a Stream of unknown length as the Body of a PutObject request? Consider using Upload instead from @aws-sdk/lib-storage.");else console.warn("Are you using a Stream of unknown length as the Body of a PutObject request? Consider using Upload instead from @aws-sdk/lib-storage.")}return r({...f})}}var lg="content-length",hg={step:"finalizeRequest",tags:["CHECK_CONTENT_LENGTH_HEADER"],name:"getCheckContentLengthHeaderPlugin",override:!0},Ce=(r)=>({applyToStack:(s)=>{s.add(ag(),hg)}});var ce=(r)=>{return(s,f)=>async(e)=>{const l=await r.region(),a=r.region;let h=()=>{};if(f.__s3RegionRedirect)Object.defineProperty(r,"region",{writable:!1,value:async()=>{return f.__s3RegionRedirect}}),h=()=>Object.defineProperty(r,"region",{writable:!0,value:a});try{const m=await s(e);if(f.__s3RegionRedirect){h();const g=await r.region();if(l!==g)throw new Error("Region was not restored following S3 region redirect.")}return m}catch(m){throw h(),m}}},ze={tags:["REGION_REDIRECT","S3"],name:"regionRedirectEndpointMiddleware",override:!0,relation:"before",toMiddleware:"endpointV2Middleware"};function mg(r){return(s,f)=>async(e)=>{try{return await s(e)}catch(l){if(r.followRegionRedirects&&l?.$metadata?.httpStatusCode===301){try{const a=l.$response.headers["x-amz-bucket-region"];f.logger?.debug(`Redirecting from ${await r.region()} to ${a}`),f.__s3RegionRedirect=a}catch(a){throw new Error("Region redirect failed: "+a)}return s(e)}else throw l}}}var gg={step:"initialize",tags:["REGION_REDIRECT","S3"],name:"regionRedirectMiddleware",override:!0},Ge=(r)=>({applyToStack:(s)=>{s.add(mg(r),gg),s.addRelativeTo(ce(r),ze)}});var wg=(r)=>{return(s,f)=>async(e)=>{const l=await s(e),{response:a}=l;if(_r.isInstance(a)){if(a.headers.expires){a.headers.expiresstring=a.headers.expires;try{Ur(a.headers.expires)}catch(h){f.logger?.warn(`AWS SDK Warning for ${f.clientName}::${f.commandName} response parsing (${a.headers.expires}): ${h}`),delete a.headers.expires}}}return l}},Ag={tags:["S3"],name:"s3ExpiresMiddleware",override:!0,relation:"after",toMiddleware:"deserializerMiddleware"},He=(r)=>({applyToStack:(s)=>{s.addRelativeTo(wg(r),Ag)}});class fr{constructor(r={}){this.data=r,this.lastPurgeTime=Date.now()}get(r){const s=this.data[r];if(!s)return;return s}set(r,s){return this.data[r]=s,s}delete(r){delete this.data[r]}async purgeExpired(){const r=Date.now();if(this.lastPurgeTime+fr.EXPIRED_CREDENTIAL_PURGE_INTERVAL_MS>r)return;for(let s in this.data){const f=this.data[s];if(!f.isRefreshing){const e=await f.identity;if(e.expiration){if(e.expiration.getTime()<r)delete this.data[s]}}}}}fr.EXPIRED_CREDENTIAL_PURGE_INTERVAL_MS=30000;class er{constructor(r,s=!1,f=Date.now()){this._identity=r,this.isRefreshing=s,this.accessed=f}get identity(){return this.accessed=Date.now(),this._identity}}class lr{constructor(r,s=new fr){this.createSessionFn=r,this.cache=s}async getS3ExpressIdentity(r,s){const f=s.Bucket,{cache:e}=this,l=e.get(f);if(l)return l.identity.then((a)=>{if((a.expiration?.getTime()??0)<Date.now())return e.set(f,new er(this.getIdentity(f))).identity;if((a.expiration?.getTime()??0)<Date.now()+lr.REFRESH_WINDOW_MS&&!l.isRefreshing)l.isRefreshing=!0,this.getIdentity(f).then((g)=>{e.set(f,new er(Promise.resolve(g)))});return a});return e.set(f,new er(this.getIdentity(f))).identity}async getIdentity(r){await this.cache.purgeExpired().catch((e)=>{console.warn("Error while clearing expired entries in S3ExpressIdentityCache: \n"+e)});const s=await this.createSessionFn(r);if(!s.Credentials?.AccessKeyId||!s.Credentials?.SecretAccessKey)throw new Error("s3#createSession response credential missing AccessKeyId or SecretAccessKey.");return{accessKeyId:s.Credentials.AccessKeyId,secretAccessKey:s.Credentials.SecretAccessKey,sessionToken:s.Credentials.SessionToken,expiration:s.Credentials.Expiration?new Date(s.Credentials.Expiration):void 0}}}lr.REFRESH_WINDOW_MS=60000;var cr=U(ar(),1),ns=U(ps(),1),ll=U(pe(),1);var Ke="X-Amz-Algorithm",Le="X-Amz-Credential",Fe="X-Amz-Date",We="X-Amz-SignedHeaders",Xe="X-Amz-Expires",Ze="X-Amz-Signature",Qe="X-Amz-Security-Token";var Ve="authorization",_s="X-Amz-Date".toLowerCase();var ve=["authorization",_s,"date"],Je="X-Amz-Signature".toLowerCase(),Mr="x-amz-content-sha256",Ye="X-Amz-Security-Token".toLowerCase();var Be={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},Oe=/^proxy-/,_e=/^sec-/;var qr="AWS4-HMAC-SHA256";var qe="AWS4-HMAC-SHA256-PAYLOAD",je="UNSIGNED-PAYLOAD",ie=50,qs="aws4_request",be=604800;var oe=U(ar(),1);var jr={},js=[],ir=(r,s,f)=>`${r}/${s}/${f}/${qs}`,ne=async(r,s,f,e,l)=>{const a=await xe(r,s.secretAccessKey,s.accessKeyId),h=`${f}:${e}:${l}:${oe.toHex(a)}:${s.sessionToken}`;if(h in jr)return jr[h];js.push(h);while(js.length>ie)delete jr[js.shift()];let m=`AWS4${s.secretAccessKey}`;for(let g of[f,e,l,qs])m=await xe(r,m,g);return jr[h]=m};var xe=(r,s,f)=>{const e=new r(s);return e.update(v(f)),e.digest()};var br=({headers:r},s,f)=>{const e={};for(let l of Object.keys(r).sort()){if(r[l]==null)continue;const a=l.toLowerCase();if(a in Be||s?.has(a)||Oe.test(a)||_e.test(a)){if(!f||f&&!f.has(a))continue}e[a]=r[l].trim().replace(/\s+/g," ")}return e};var Tr=U(pe(),1);var is=({query:r={}})=>{const s=[],f={};for(let e of Object.keys(r).sort()){if(e.toLowerCase()===Je)continue;s.push(e);const l=r[e];if(typeof l==="string")f[e]=`${Tr.escapeUri(e)}=${Tr.escapeUri(l)}`;else if(Array.isArray(l))f[e]=l.slice(0).reduce((a,h)=>a.concat([`${Tr.escapeUri(e)}=${Tr.escapeUri(h)}`]),[]).sort().join("&")}return s.map((e)=>f[e]).filter((e)=>e).join("&")};var ue=U(ar(),1);var yr=async({headers:r,body:s},f)=>{for(let e of Object.keys(r))if(e.toLowerCase()===Mr)return r[e];if(s==null)return"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";else if(typeof s==="string"||ArrayBuffer.isView(s)||xr(s)){const e=new f;return e.update(v(s)),ue.toHex(await e.digest())}return je};var or=U(ar(),1);var rl=function(r){for(let s=0;s<8;s++)r[s]^=255;for(let s=7;s>-1;s--)if(r[s]++,r[s]!==0)break};class bs{format(r){const s=[];for(let l of Object.keys(r)){const a=Cr(l);s.push(Uint8Array.from([a.byteLength]),a,this.formatHeaderValue(r[l]))}const f=new Uint8Array(s.reduce((l,a)=>l+a.byteLength,0));let e=0;for(let l of s)f.set(l,e),e+=l.byteLength;return f}formatHeaderValue(r){switch(r.type){case"boolean":return Uint8Array.from([r.value?0:1]);case"byte":return Uint8Array.from([2,r.value]);case"short":const s=new DataView(new ArrayBuffer(3));return s.setUint8(0,3),s.setInt16(1,r.value,!1),new Uint8Array(s.buffer);case"integer":const f=new DataView(new ArrayBuffer(5));return f.setUint8(0,4),f.setInt32(1,r.value,!1),new Uint8Array(f.buffer);case"long":const e=new Uint8Array(9);return e[0]=5,e.set(r.value.bytes,1),e;case"binary":const l=new DataView(new ArrayBuffer(3+r.value.byteLength));l.setUint8(0,6),l.setUint16(1,r.value.byteLength,!1);const a=new Uint8Array(l.buffer);return a.set(r.value,3),a;case"string":const h=Cr(r.value),m=new DataView(new ArrayBuffer(3+h.byteLength));m.setUint8(0,7),m.setUint16(1,h.byteLength,!1);const g=new Uint8Array(m.buffer);return g.set(h,3),g;case"timestamp":const S=new Uint8Array(9);return S[0]=8,S.set(xs.fromNumber(r.value.valueOf()).bytes,1),S;case"uuid":if(!Sg.test(r.value))throw new Error(`Invalid UUID received: ${r.value}`);const d=new Uint8Array(17);return d[0]=9,d.set(or.fromHex(r.value.replace(/\-/g,"")),1),d}}}var te;(function(r){r[r.boolTrue=0]="boolTrue",r[r.boolFalse=1]="boolFalse",r[r.byte=2]="byte",r[r.short=3]="short",r[r.integer=4]="integer",r[r.long=5]="long",r[r.byteArray=6]="byteArray",r[r.string=7]="string",r[r.timestamp=8]="timestamp",r[r.uuid=9]="uuid"})(te||(te={}));var Sg=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;class xs{constructor(r){if(this.bytes=r,r.byteLength!==8)throw new Error("Int64 buffers must be exactly 8 bytes")}static fromNumber(r){if(r>9223372036854776000||r<-9223372036854776000)throw new Error(`${r} is too large (or, if negative, too small) to represent as an Int64`);const s=new Uint8Array(8);for(let f=7,e=Math.abs(Math.round(r));f>-1&&e>0;f--,e/=256)s[f]=e;if(r<0)rl(s);return new xs(s)}valueOf(){const r=this.bytes.slice(0),s=r[0]&128;if(s)rl(r);return parseInt(or.toHex(r),16)*(s?-1:1)}toString(){return String(this.valueOf())}}var sl=(r,s)=>{r=r.toLowerCase();for(let f of Object.keys(s))if(r===f.toLowerCase())return!0;return!1};var os=(r,s={})=>{const{headers:f,query:e={}}=F.clone(r);for(let l of Object.keys(f)){const a=l.toLowerCase();if(a.slice(0,6)==="x-amz-"&&!s.unhoistableHeaders?.has(a))e[l]=f[l],delete f[l]}return{...r,headers:f,query:e}};var nr=(r)=>{r=F.clone(r);for(let s of Object.keys(r.headers))if(ve.indexOf(s.toLowerCase())>-1)delete r.headers[s];return r};var fl=(r)=>Rg(r).toISOString().replace(/\.\d{3}Z$/,"Z"),Rg=(r)=>{if(typeof r==="number")return new Date(r*1000);if(typeof r==="string"){if(Number(r))return new Date(Number(r)*1000);return new Date(r)}return r};class us{constructor({applyChecksum:r,credentials:s,region:f,service:e,sha256:l,uriEscapePath:a=!0}){this.headerFormatter=new bs,this.service=e,this.sha256=l,this.uriEscapePath=a,this.applyChecksum=typeof r==="boolean"?r:!0,this.regionProvider=ns.normalizeProvider(f),this.credentialProvider=ns.normalizeProvider(s)}async presign(r,s={}){const{signingDate:f=new Date,expiresIn:e=3600,unsignableHeaders:l,unhoistableHeaders:a,signableHeaders:h,signingRegion:m,signingService:g}=s,S=await this.credentialProvider();this.validateResolvedCredentials(S);const d=m??await this.regionProvider(),{longDate:k,shortDate:P}=pr(f);if(e>be)return Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future");const T=ir(P,d,g??this.service),D=os(nr(r),{unhoistableHeaders:a});if(S.sessionToken)D.query[Qe]=S.sessionToken;D.query[Ke]=qr,D.query[Le]=`${S.accessKeyId}/${T}`,D.query[Fe]=k,D.query[Xe]=e.toString(10);const Q=br(D,l,h);return D.query[We]=el(Q),D.query[Ze]=await this.getSignature(k,T,this.getSigningKey(S,d,P,g),this.createCanonicalRequest(D,Q,await yr(r,this.sha256))),D}async sign(r,s){if(typeof r==="string")return this.signString(r,s);else if(r.headers&&r.payload)return this.signEvent(r,s);else if(r.message)return this.signMessage(r,s);else return this.signRequest(r,s)}async signEvent({headers:r,payload:s},{signingDate:f=new Date,priorSignature:e,signingRegion:l,signingService:a}){const h=l??await this.regionProvider(),{shortDate:m,longDate:g}=pr(f),S=ir(m,h,a??this.service),d=await yr({headers:{},body:s},this.sha256),k=new this.sha256;k.update(r);const P=cr.toHex(await k.digest()),T=[qe,g,S,e,P,d].join("\n");return this.signString(T,{signingDate:f,signingRegion:h,signingService:a})}async signMessage(r,{signingDate:s=new Date,signingRegion:f,signingService:e}){return this.signEvent({headers:this.headerFormatter.format(r.message.headers),payload:r.message.body},{signingDate:s,signingRegion:f,signingService:e,priorSignature:r.priorSignature}).then((a)=>{return{message:r.message,signature:a}})}async signString(r,{signingDate:s=new Date,signingRegion:f,signingService:e}={}){const l=await this.credentialProvider();this.validateResolvedCredentials(l);const a=f??await this.regionProvider(),{shortDate:h}=pr(s),m=new this.sha256(await this.getSigningKey(l,a,h,e));return m.update(v(r)),cr.toHex(await m.digest())}async signRequest(r,{signingDate:s=new Date,signableHeaders:f,unsignableHeaders:e,signingRegion:l,signingService:a}={}){const h=await this.credentialProvider();this.validateResolvedCredentials(h);const m=l??await this.regionProvider(),g=nr(r),{longDate:S,shortDate:d}=pr(s),k=ir(d,m,a??this.service);if(g.headers[_s]=S,h.sessionToken)g.headers[Ye]=h.sessionToken;const P=await yr(g,this.sha256);if(!sl(Mr,g.headers)&&this.applyChecksum)g.headers[Mr]=P;const T=br(g,e,f),D=await this.getSignature(S,k,this.getSigningKey(h,m,d,a),this.createCanonicalRequest(g,T,P));return g.headers[Ve]=`${qr} `+`Credential=${h.accessKeyId}/${k}, `+`SignedHeaders=${el(T)}, `+`Signature=${D}`,g}createCanonicalRequest(r,s,f){const e=Object.keys(s).sort();return`${r.method}
|
|
3
|
+
${this.getCanonicalPath(r)}
|
|
4
|
+
${is(r)}
|
|
5
|
+
${e.map((l)=>`${l}:${s[l]}`).join("\n")}
|
|
6
|
+
|
|
7
|
+
${e.join(";")}
|
|
8
|
+
${f}`}async createStringToSign(r,s,f){const e=new this.sha256;e.update(v(f));const l=await e.digest();return`${qr}
|
|
9
|
+
${r}
|
|
10
|
+
${s}
|
|
11
|
+
${cr.toHex(l)}`}getCanonicalPath({path:r}){if(this.uriEscapePath){const s=[];for(let l of r.split("/")){if(l?.length===0)continue;if(l===".")continue;if(l==="..")s.pop();else s.push(l)}const f=`${r?.startsWith("/")?"/":""}${s.join("/")}${s.length>0&&r?.endsWith("/")?"/":""}`;return ll.escapeUri(f).replace(/%2F/g,"/")}return r}async getSignature(r,s,f,e){const l=await this.createStringToSign(r,s,e),a=new this.sha256(await f);return a.update(v(l)),cr.toHex(await a.digest())}getSigningKey(r,s,f,e){return ne(this.sha256,r,f,s,e||this.service)}validateResolvedCredentials(r){if(typeof r!=="object"||typeof r.accessKeyId!=="string"||typeof r.secretAccessKey!=="string")throw new Error("Resolved credential object is not valid")}}var pr=(r)=>{const s=fl(r).replace(/[\-:]/g,"");return{longDate:s,shortDate:s.slice(0,8)}},el=(r)=>Object.keys(r).sort().join(";");var al="Directory",hl="S3Express",ml="sigv4-s3express",ur="X-Amz-S3session-Token",zr=ur.toLowerCase(),dg="AWS_S3_DISABLE_EXPRESS_SESSION_AUTH",Ig="s3_disable_express_session_auth",ts={environmentVariableSelector:(r)=>p(r,dg,u.ENV),configFileSelector:(r)=>p(r,Ig,u.CONFIG),default:!1};var gl=function(r){return{accessKeyId:r.accessKeyId,secretAccessKey:r.secretAccessKey,expiration:r.expiration}},wl=function(r,s){const f=setTimeout(()=>{throw new Error("SignatureV4S3Express credential override was created but not called.")},10),e=r.credentialProvider,l=()=>{return clearTimeout(f),r.credentialProvider=e,Promise.resolve(s)};r.credentialProvider=l};class tr extends us{async signWithCredentials(r,s,f){const e=gl(s);r.headers[zr]=s.sessionToken;const l=this;return wl(l,e),l.signRequest(r,f??{})}async presignWithCredentials(r,s,f){const e=gl(s);return delete r.headers[zr],r.headers[ur]=s.sessionToken,r.query=r.query??{},r.query[ur]=s.sessionToken,wl(this,e),this.presign(r,f)}}var Al=(r)=>{return(s,f)=>async(e)=>{if(f.endpointV2){const l=f.endpointV2,a=l.properties?.authSchemes?.[0]?.name===ml;if(l.properties?.backend===hl||l.properties?.bucketType===al)f.isS3ExpressBucket=!0;if(a){const m=e.input.Bucket;if(m){const g=await r.s3ExpressIdentityProvider.getS3ExpressIdentity(await r.credentials(),{Bucket:m});if(f.s3ExpressIdentity=g,F.isInstance(e.request)&&g.sessionToken)e.request.headers[zr]=g.sessionToken}}}return s(e)}},Sl={name:"s3ExpressMiddleware",step:"build",tags:["S3","S3_EXPRESS"],override:!0},rf=(r)=>({applyToStack:(s)=>{s.add(Al(r),Sl)}});var dl=U(sf(),1);var kg=U(Eg(),1),Il=U(ps(),1);var Rl=async(r,s,f,e)=>{const l=await e.signWithCredentials(f,r,{});if(l.headers["X-Amz-Security-Token"]||l.headers["x-amz-security-token"])throw new Error("X-Amz-Security-Token must not be set for s3-express requests.");return l};var Pg=(r)=>(s)=>{throw s},Ng=(r,s)=>{};var El=(r)=>(s,f)=>async(e)=>{if(!F.isInstance(e.request))return s(e);const a=Il.getSmithyContext(f).selectedHttpAuthScheme;if(!a)throw new Error("No HttpAuthScheme was selected: unable to sign request");const{httpAuthOption:{signingProperties:h={}},identity:m,signer:g}=a;let S;if(f.s3ExpressIdentity)S=await Rl(f.s3ExpressIdentity,h,e.request,await r.signer());else S=await g.sign(e.request,m,h);const d=await s({...e,request:S}).catch((g.errorHandler||Pg)(h));return(g.successHandler||Ng)(d.response,h),d},ff=(r)=>({applyToStack:(s)=>{s.addRelativeTo(El(r),dl.httpSigningMiddlewareOptions)}});var kl=(r,{session:s})=>{const[f,e]=s;return{...r,forcePathStyle:r.forcePathStyle??!1,useAccelerateEndpoint:r.useAccelerateEndpoint??!1,disableMultiregionAccessPoints:r.disableMultiregionAccessPoints??!1,followRegionRedirects:r.followRegionRedirects??!1,s3ExpressIdentityProvider:r.s3ExpressIdentityProvider??new lr(async(l)=>f().send(new e({Bucket:l,SessionMode:"ReadWrite"}))),bucketEndpoint:r.bucketEndpoint??!1}};var $g={CopyObjectCommand:!0,UploadPartCopyCommand:!0,CompleteMultipartUploadCommand:!0},Dg=3000,Ug=(r)=>(s,f)=>async(e)=>{const l=await s(e),{response:a}=l;if(!_r.isInstance(a))return l;const{statusCode:h,body:m}=a;if(h<200||h>=300)return l;let g=m,S=m;if(m&&typeof m==="object"&&!(m instanceof Uint8Array))[g,S]=await Pl(m);a.body=S;const d=await Mg(g,{streamCollector:async(P)=>{return Nl(P,Dg)}});if(typeof g?.destroy==="function")g.destroy();const k=r.utf8Encoder(d.subarray(d.length-16));if(d.length===0&&$g[f.commandName]){const P=new Error("S3 aborted request");throw P.name="InternalError",P}if(k&&k.endsWith("</Error>"))a.statusCode=400;return l},Mg=(r=new Uint8Array,s)=>{if(r instanceof Uint8Array)return Promise.resolve(r);return s.streamCollector(r)||Promise.resolve(new Uint8Array)},Tg={relation:"after",toMiddleware:"deserializerMiddleware",tags:["THROW_200_EXCEPTIONS","S3"],name:"throw200ExceptionsMiddleware",override:!0},rs=(r)=>({applyToStack:(s)=>{s.addRelativeTo(Ug(r),Tg)}});var ef=(r)=>typeof r==="string"&&r.indexOf("arn:")===0&&r.split(":").length>=6;function $l(r){return(s,f)=>async(e)=>{if(r.bucketEndpoint){const l=f.endpointV2;if(l){const a=e.input.Bucket;if(typeof a==="string")try{const h=new URL(a);l.url=h}catch(h){const m=`@aws-sdk/middleware-sdk-s3: bucketEndpoint=true was set but Bucket=${a} could not be parsed as URL.`;if(f.logger?.constructor?.name==="NoOpLogger")console.warn(m);else f.logger?.warn?.(m);throw h}}}return s(e)}}var Dl={name:"bucketEndpointMiddleware",override:!0,relation:"after",toMiddleware:"endpointV2Middleware"};function yg({bucketEndpoint:r}){return(s)=>async(f)=>{const{input:{Bucket:e}}=f;if(!r&&typeof e==="string"&&!ef(e)&&e.indexOf("/")>=0){const l=new Error(`Bucket name shouldn't contain '/', received '${e}'`);throw l.name="InvalidBucketName",l}return s({...f})}}var Cg={step:"initialize",tags:["VALIDATE_BUCKET_NAME"],name:"validateBucketNameMiddleware",override:!0},Ul=(r)=>({applyToStack:(s)=>{s.add(yg(r),Cg),s.addRelativeTo($l(r),Dl)}});var Pr=U(sf(),1);var Ml=(r)=>({...r,eventStreamMarshaller:r.eventStreamSerdeProvider(r)});var As=U(ws(),1);var ss={CrtSignerV4:null};class lf{constructor(r){this.sigv4Signer=new tr(r),this.signerOptions=r}async sign(r,s={}){if(s.signingRegion==="*"){if(this.signerOptions.runtime!=="node")throw new Error("This request requires signing with SigV4Asymmetric algorithm. It's only available in Node.js");return this.getSigv4aSigner().sign(r,s)}return this.sigv4Signer.sign(r,s)}async signWithCredentials(r,s,f={}){if(f.signingRegion==="*"){if(this.signerOptions.runtime!=="node")throw new Error("This request requires signing with SigV4Asymmetric algorithm. It's only available in Node.js");return this.getSigv4aSigner().signWithCredentials(r,s,f)}return this.sigv4Signer.signWithCredentials(r,s,f)}async presign(r,s={}){if(s.signingRegion==="*"){if(this.signerOptions.runtime!=="node")throw new Error("This request requires signing with SigV4Asymmetric algorithm. It's only available in Node.js");return this.getSigv4aSigner().presign(r,s)}return this.sigv4Signer.presign(r,s)}async presignWithCredentials(r,s,f={}){if(f.signingRegion==="*")throw new Error("Method presignWithCredentials is not supported for [signingRegion=*].");return this.sigv4Signer.presignWithCredentials(r,s,f)}getSigv4aSigner(){if(!this.sigv4aSigner){let r=null;try{if(r=ss.CrtSignerV4,typeof r!=="function")throw new Error}catch(s){throw s.message=`${s.message}\n`+'Please check whether you have installed the "@aws-sdk/signature-v4-crt" package explicitly. \nYou 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";]. \nFor more information please go to https://github.com/aws/aws-sdk-js-v3#functionality-requiring-aws-common-runtime-crt',s}this.sigv4aSigner=new r({...this.signerOptions,signingAlgorithm:1})}return this.sigv4aSigner}}var Kr=U(ps(),1);var hr={["required"]:!1,["type"]:"String"},mr={["required"]:!0,default:!1,["type"]:"Boolean"},Gr={["required"]:!1,["type"]:"Boolean"},Y={["fn"]:"booleanEquals",["argv"]:[{["ref"]:"Accelerate"},!0]},$={["fn"]:"booleanEquals",["argv"]:[{["ref"]:"UseFIPS"},!0]},N={["fn"]:"booleanEquals",["argv"]:[{["ref"]:"UseDualStack"},!0]},C={["fn"]:"isSet",["argv"]:[{["ref"]:"Endpoint"}]},da={["fn"]:"aws.partition",["argv"]:[{["ref"]:"Region"}],["assign"]:"partitionResult"},Tl={["fn"]:"stringEquals",["argv"]:[{["fn"]:"getAttr",["argv"]:[{["ref"]:"partitionResult"},"name"]},"aws-cn"]},hs={["fn"]:"isSet",["argv"]:[{["ref"]:"Bucket"}]},X={["ref"]:"Bucket"},W={["fn"]:"parseURL",["argv"]:[{["ref"]:"Endpoint"}],["assign"]:"url"},as={["fn"]:"booleanEquals",["argv"]:[{["fn"]:"getAttr",["argv"]:[{["ref"]:"url"},"isIp"]},!0]},Ia={["ref"]:"url"},Ea={["fn"]:"uriEncode",["argv"]:[X],["assign"]:"uri_encoded_bucket"},q={["backend"]:"S3Express",["authSchemes"]:[{["disableDoubleEncoding"]:!0,["name"]:"sigv4",["signingName"]:"s3express",["signingRegion"]:"{Region}"}]},w={},ka={["fn"]:"aws.isVirtualHostableS3Bucket",["argv"]:[X,!1]},af={["error"]:"S3Express bucket name is not a valid virtual hostable name.",["type"]:"error"},ms={["backend"]:"S3Express",["authSchemes"]:[{["disableDoubleEncoding"]:!0,["name"]:"sigv4-s3express",["signingName"]:"s3express",["signingRegion"]:"{Region}"}]},yl={["fn"]:"isSet",["argv"]:[{["ref"]:"UseS3ExpressControlEndpoint"}]},Cl={["fn"]:"booleanEquals",["argv"]:[{["ref"]:"UseS3ExpressControlEndpoint"},!0]},A={["fn"]:"not",["argv"]:[C]},cl={["error"]:"Unrecognized S3Express bucket name format.",["type"]:"error"},zl={["fn"]:"not",["argv"]:[hs]},Gl={["ref"]:"hardwareType"},Hl={["conditions"]:[A],["error"]:"Expected a endpoint to be specified but no endpoint was found",["type"]:"error"},fs={["authSchemes"]:[{["disableDoubleEncoding"]:!0,["name"]:"sigv4a",["signingName"]:"s3-outposts",["signingRegionSet"]:["*"]},{["disableDoubleEncoding"]:!0,["name"]:"sigv4",["signingName"]:"s3-outposts",["signingRegion"]:"{Region}"}]},hf={["fn"]:"booleanEquals",["argv"]:[{["ref"]:"ForcePathStyle"},!1]},cg={["ref"]:"ForcePathStyle"},y={["fn"]:"booleanEquals",["argv"]:[{["ref"]:"Accelerate"},!1]},z={["fn"]:"stringEquals",["argv"]:[{["ref"]:"Region"},"aws-global"]},H={["authSchemes"]:[{["disableDoubleEncoding"]:!0,["name"]:"sigv4",["signingName"]:"s3",["signingRegion"]:"us-east-1"}]},E={["fn"]:"not",["argv"]:[z]},K={["fn"]:"booleanEquals",["argv"]:[{["ref"]:"UseGlobalEndpoint"},!0]},Kl={["url"]:"https://{Bucket}.s3-fips.dualstack.{Region}.{partitionResult#dnsSuffix}",["properties"]:{["authSchemes"]:[{["disableDoubleEncoding"]:!0,["name"]:"sigv4",["signingName"]:"s3",["signingRegion"]:"{Region}"}]},["headers"]:{}},c={["authSchemes"]:[{["disableDoubleEncoding"]:!0,["name"]:"sigv4",["signingName"]:"s3",["signingRegion"]:"{Region}"}]},L={["fn"]:"booleanEquals",["argv"]:[{["ref"]:"UseGlobalEndpoint"},!1]},I={["fn"]:"booleanEquals",["argv"]:[{["ref"]:"UseDualStack"},!1]},Ll={["url"]:"https://{Bucket}.s3-fips.{Region}.{partitionResult#dnsSuffix}",["properties"]:c,["headers"]:{}},R={["fn"]:"booleanEquals",["argv"]:[{["ref"]:"UseFIPS"},!1]},Fl={["url"]:"https://{Bucket}.s3-accelerate.dualstack.{partitionResult#dnsSuffix}",["properties"]:c,["headers"]:{}},Wl={["url"]:"https://{Bucket}.s3.dualstack.{Region}.{partitionResult#dnsSuffix}",["properties"]:c,["headers"]:{}},mf={["fn"]:"booleanEquals",["argv"]:[{["fn"]:"getAttr",["argv"]:[Ia,"isIp"]},!1]},gf={["url"]:"{url#scheme}://{url#authority}{url#normalizedPath}{Bucket}",["properties"]:c,["headers"]:{}},Gf={["url"]:"{url#scheme}://{Bucket}.{url#authority}{url#path}",["properties"]:c,["headers"]:{}},Xl={["endpoint"]:Gf,["type"]:"endpoint"},wf={["url"]:"https://{Bucket}.s3-accelerate.{partitionResult#dnsSuffix}",["properties"]:c,["headers"]:{}},Zl={["url"]:"https://{Bucket}.s3.{Region}.{partitionResult#dnsSuffix}",["properties"]:c,["headers"]:{}},es={["error"]:"Invalid region: region was not a valid DNS name.",["type"]:"error"},V={["ref"]:"bucketArn"},Pa={["ref"]:"arnType"},Af={["fn"]:"getAttr",["argv"]:[V,"service"]},Hf={["ref"]:"accessPointName"},Ql={["conditions"]:[N],["error"]:"S3 Object Lambda does not support Dual-stack",["type"]:"error"},Vl={["conditions"]:[Y],["error"]:"S3 Object Lambda does not support S3 Accelerate",["type"]:"error"},vl={["conditions"]:[{["fn"]:"isSet",["argv"]:[{["ref"]:"DisableAccessPoints"}]},{["fn"]:"booleanEquals",["argv"]:[{["ref"]:"DisableAccessPoints"},!0]}],["error"]:"Access points are not supported for this operation",["type"]:"error"},Sf={["conditions"]:[{["fn"]:"isSet",["argv"]:[{["ref"]:"UseArnRegion"}]},{["fn"]:"booleanEquals",["argv"]:[{["ref"]:"UseArnRegion"},!1]},{["fn"]:"not",["argv"]:[{["fn"]:"stringEquals",["argv"]:[{["fn"]:"getAttr",["argv"]:[V,"region"]},"{Region}"]}]}],["error"]:"Invalid configuration: region from ARN `{bucketArn#region}` does not match client region `{Region}` and UseArnRegion is `false`",["type"]:"error"},Na={["fn"]:"getAttr",["argv"]:[{["ref"]:"bucketPartition"},"name"]},$a={["fn"]:"getAttr",["argv"]:[V,"accountId"]},Rf={["authSchemes"]:[{["disableDoubleEncoding"]:!0,["name"]:"sigv4",["signingName"]:"s3-object-lambda",["signingRegion"]:"{bucketArn#region}"}]},Jl={["error"]:"Invalid ARN: The access point name may only contain a-z, A-Z, 0-9 and `-`. Found: `{accessPointName}`",["type"]:"error"},df={["error"]:"Invalid ARN: The account id may only contain a-z, A-Z, 0-9 and `-`. Found: `{bucketArn#accountId}`",["type"]:"error"},If={["error"]:"Invalid region in ARN: `{bucketArn#region}` (invalid DNS name)",["type"]:"error"},Ef={["error"]:"Client was configured for partition `{partitionResult#name}` but ARN (`{Bucket}`) has `{bucketPartition#name}`",["type"]:"error"},Yl={["error"]:"Invalid ARN: The ARN may only contain a single resource component after `accesspoint`.",["type"]:"error"},Bl={["error"]:"Invalid ARN: Expected a resource of the format `accesspoint:<accesspoint name>` but no name was provided",["type"]:"error"},Hr={["authSchemes"]:[{["disableDoubleEncoding"]:!0,["name"]:"sigv4",["signingName"]:"s3",["signingRegion"]:"{bucketArn#region}"}]},Ol={["authSchemes"]:[{["disableDoubleEncoding"]:!0,["name"]:"sigv4a",["signingName"]:"s3-outposts",["signingRegionSet"]:["*"]},{["disableDoubleEncoding"]:!0,["name"]:"sigv4",["signingName"]:"s3-outposts",["signingRegion"]:"{bucketArn#region}"}]},_l={["fn"]:"aws.parseArn",["argv"]:[X]},ql={["url"]:"https://s3-fips.dualstack.{Region}.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",["properties"]:c,["headers"]:{}},jl={["url"]:"https://s3-fips.{Region}.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",["properties"]:c,["headers"]:{}},il={["url"]:"https://s3.dualstack.{Region}.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",["properties"]:c,["headers"]:{}},kf={["url"]:"{url#scheme}://{url#authority}{url#normalizedPath}{uri_encoded_bucket}",["properties"]:c,["headers"]:{}},bl={["url"]:"https://s3.{Region}.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",["properties"]:c,["headers"]:{}},xl={["ref"]:"UseObjectLambdaEndpoint"},Pf={["authSchemes"]:[{["disableDoubleEncoding"]:!0,["name"]:"sigv4",["signingName"]:"s3-object-lambda",["signingRegion"]:"{Region}"}]},ol={["url"]:"https://s3-fips.dualstack.{Region}.{partitionResult#dnsSuffix}",["properties"]:c,["headers"]:{}},nl={["url"]:"https://s3-fips.{Region}.{partitionResult#dnsSuffix}",["properties"]:c,["headers"]:{}},pl={["url"]:"https://s3.dualstack.{Region}.{partitionResult#dnsSuffix}",["properties"]:c,["headers"]:{}},Nf={["url"]:"{url#scheme}://{url#authority}{url#path}",["properties"]:c,["headers"]:{}},ul={["url"]:"https://s3.{Region}.{partitionResult#dnsSuffix}",["properties"]:c,["headers"]:{}},$f=[{["ref"]:"Region"}],zg=[{["ref"]:"Endpoint"}],Gg=[X],Df=[N],ls=[Y],t=[C,W],tl=[{["fn"]:"isSet",["argv"]:[{["ref"]:"DisableS3ExpressSessionAuth"}]},{["fn"]:"booleanEquals",["argv"]:[{["ref"]:"DisableS3ExpressSessionAuth"},!0]}],ra=[as],Uf=[Ea],Mf=[ka],gr=[$],sa=[{["fn"]:"substring",["argv"]:[X,6,14,!0],["assign"]:"s3expressAvailabilityZoneId"},{["fn"]:"substring",["argv"]:[X,14,16,!0],["assign"]:"s3expressAvailabilityZoneDelim"},{["fn"]:"stringEquals",["argv"]:[{["ref"]:"s3expressAvailabilityZoneDelim"},"--"]}],fa=[{["conditions"]:[$],["endpoint"]:{["url"]:"https://{Bucket}.s3express-fips-{s3expressAvailabilityZoneId}.{Region}.amazonaws.com",["properties"]:q,["headers"]:{}},["type"]:"endpoint"},{["endpoint"]:{["url"]:"https://{Bucket}.s3express-{s3expressAvailabilityZoneId}.{Region}.amazonaws.com",["properties"]:q,["headers"]:{}},["type"]:"endpoint"}],ea=[{["fn"]:"substring",["argv"]:[X,6,15,!0],["assign"]:"s3expressAvailabilityZoneId"},{["fn"]:"substring",["argv"]:[X,15,17,!0],["assign"]:"s3expressAvailabilityZoneDelim"},{["fn"]:"stringEquals",["argv"]:[{["ref"]:"s3expressAvailabilityZoneDelim"},"--"]}],la=[{["conditions"]:[$],["endpoint"]:{["url"]:"https://{Bucket}.s3express-fips-{s3expressAvailabilityZoneId}.{Region}.amazonaws.com",["properties"]:ms,["headers"]:{}},["type"]:"endpoint"},{["endpoint"]:{["url"]:"https://{Bucket}.s3express-{s3expressAvailabilityZoneId}.{Region}.amazonaws.com",["properties"]:ms,["headers"]:{}},["type"]:"endpoint"}],Hg=[hs],aa=[{["fn"]:"isValidHostLabel",["argv"]:[{["ref"]:"outpostId"},!1]}],ha=[{["fn"]:"stringEquals",["argv"]:[{["ref"]:"regionPrefix"},"beta"]}],Kg=["*"],b=[da],ma=[{["fn"]:"isValidHostLabel",["argv"]:[{["ref"]:"Region"},!1]}],x=[{["fn"]:"stringEquals",["argv"]:[{["ref"]:"Region"},"us-east-1"]}],Tf=[{["fn"]:"stringEquals",["argv"]:[Pa,"accesspoint"]}],ga=[{["fn"]:"getAttr",["argv"]:[V,"resourceId[1]"],["assign"]:"accessPointName"},{["fn"]:"not",["argv"]:[{["fn"]:"stringEquals",["argv"]:[Hf,""]}]}],Lg=[V,"resourceId[1]"],yf=[{["fn"]:"not",["argv"]:[{["fn"]:"stringEquals",["argv"]:[{["fn"]:"getAttr",["argv"]:[V,"region"]},""]}]}],wa=[{["fn"]:"not",["argv"]:[{["fn"]:"isSet",["argv"]:[{["fn"]:"getAttr",["argv"]:[V,"resourceId[2]"]}]}]}],Fg=[V,"resourceId[2]"],Cf=[{["fn"]:"aws.partition",["argv"]:[{["fn"]:"getAttr",["argv"]:[V,"region"]}],["assign"]:"bucketPartition"}],Aa=[{["fn"]:"stringEquals",["argv"]:[Na,{["fn"]:"getAttr",["argv"]:[{["ref"]:"partitionResult"},"name"]}]}],cf=[{["fn"]:"isValidHostLabel",["argv"]:[{["fn"]:"getAttr",["argv"]:[V,"region"]},!0]}],zf=[{["fn"]:"isValidHostLabel",["argv"]:[$a,!1]}],Sa=[{["fn"]:"isValidHostLabel",["argv"]:[Hf,!1]}],Ra=[{["fn"]:"isValidHostLabel",["argv"]:[{["ref"]:"Region"},!0]}],Wg={version:"1.0",parameters:{Bucket:hr,Region:hr,UseFIPS:mr,UseDualStack:mr,Endpoint:hr,ForcePathStyle:mr,Accelerate:mr,UseGlobalEndpoint:mr,UseObjectLambdaEndpoint:Gr,Key:hr,Prefix:hr,CopySource:hr,DisableAccessPoints:Gr,DisableMultiRegionAccessPoints:mr,UseArnRegion:Gr,UseS3ExpressControlEndpoint:Gr,DisableS3ExpressSessionAuth:Gr},rules:[{["conditions"]:[{["fn"]:"isSet",["argv"]:$f}],rules:[{["conditions"]:[Y,$],error:"Accelerate cannot be used with FIPS",["type"]:"error"},{["conditions"]:[N,C],error:"Cannot set dual-stack in combination with a custom endpoint.",["type"]:"error"},{["conditions"]:[C,$],error:"A custom endpoint cannot be combined with FIPS",["type"]:"error"},{["conditions"]:[C,Y],error:"A custom endpoint cannot be combined with S3 Accelerate",["type"]:"error"},{["conditions"]:[$,da,Tl],error:"Partition does not support FIPS",["type"]:"error"},{["conditions"]:[hs,{["fn"]:"substring",["argv"]:[X,0,6,!0],["assign"]:"bucketSuffix"},{["fn"]:"stringEquals",["argv"]:[{["ref"]:"bucketSuffix"},"--x-s3"]}],rules:[{["conditions"]:Df,error:"S3Express does not support Dual-stack.",["type"]:"error"},{["conditions"]:ls,error:"S3Express does not support S3 Accelerate.",["type"]:"error"},{["conditions"]:t,rules:[{["conditions"]:tl,rules:[{["conditions"]:ra,rules:[{["conditions"]:Uf,rules:[{endpoint:{["url"]:"{url#scheme}://{url#authority}/{uri_encoded_bucket}{url#path}",["properties"]:q,["headers"]:w},["type"]:"endpoint"}],["type"]:"tree"}],["type"]:"tree"},{["conditions"]:Mf,rules:[{endpoint:{["url"]:"{url#scheme}://{Bucket}.{url#authority}{url#path}",["properties"]:q,["headers"]:w},["type"]:"endpoint"}],["type"]:"tree"},af],["type"]:"tree"},{["conditions"]:ra,rules:[{["conditions"]:Uf,rules:[{endpoint:{["url"]:"{url#scheme}://{url#authority}/{uri_encoded_bucket}{url#path}",["properties"]:ms,["headers"]:w},["type"]:"endpoint"}],["type"]:"tree"}],["type"]:"tree"},{["conditions"]:Mf,rules:[{endpoint:{["url"]:"{url#scheme}://{Bucket}.{url#authority}{url#path}",["properties"]:ms,["headers"]:w},["type"]:"endpoint"}],["type"]:"tree"},af],["type"]:"tree"},{["conditions"]:[yl,Cl],rules:[{["conditions"]:[Ea,A],rules:[{["conditions"]:gr,endpoint:{["url"]:"https://s3express-control-fips.{Region}.amazonaws.com/{uri_encoded_bucket}",["properties"]:q,["headers"]:w},["type"]:"endpoint"},{endpoint:{["url"]:"https://s3express-control.{Region}.amazonaws.com/{uri_encoded_bucket}",["properties"]:q,["headers"]:w},["type"]:"endpoint"}],["type"]:"tree"}],["type"]:"tree"},{["conditions"]:Mf,rules:[{["conditions"]:tl,rules:[{["conditions"]:sa,rules:fa,["type"]:"tree"},{["conditions"]:ea,rules:fa,["type"]:"tree"},cl],["type"]:"tree"},{["conditions"]:sa,rules:la,["type"]:"tree"},{["conditions"]:ea,rules:la,["type"]:"tree"},cl],["type"]:"tree"},af],["type"]:"tree"},{["conditions"]:[zl,yl,Cl],rules:[{["conditions"]:t,endpoint:{["url"]:"{url#scheme}://{url#authority}{url#path}",["properties"]:q,["headers"]:w},["type"]:"endpoint"},{["conditions"]:gr,endpoint:{["url"]:"https://s3express-control-fips.{Region}.amazonaws.com",["properties"]:q,["headers"]:w},["type"]:"endpoint"},{endpoint:{["url"]:"https://s3express-control.{Region}.amazonaws.com",["properties"]:q,["headers"]:w},["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[hs,{["fn"]:"substring",["argv"]:[X,49,50,!0],["assign"]:"hardwareType"},{["fn"]:"substring",["argv"]:[X,8,12,!0],["assign"]:"regionPrefix"},{["fn"]:"substring",["argv"]:[X,0,7,!0],["assign"]:"bucketAliasSuffix"},{["fn"]:"substring",["argv"]:[X,32,49,!0],["assign"]:"outpostId"},{["fn"]:"aws.partition",["argv"]:$f,["assign"]:"regionPartition"},{["fn"]:"stringEquals",["argv"]:[{["ref"]:"bucketAliasSuffix"},"--op-s3"]}],rules:[{["conditions"]:aa,rules:[{["conditions"]:[{["fn"]:"stringEquals",["argv"]:[Gl,"e"]}],rules:[{["conditions"]:ha,rules:[Hl,{["conditions"]:t,endpoint:{["url"]:"https://{Bucket}.ec2.{url#authority}",["properties"]:fs,["headers"]:w},["type"]:"endpoint"}],["type"]:"tree"},{endpoint:{["url"]:"https://{Bucket}.ec2.s3-outposts.{Region}.{regionPartition#dnsSuffix}",["properties"]:fs,["headers"]:w},["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[{["fn"]:"stringEquals",["argv"]:[Gl,"o"]}],rules:[{["conditions"]:ha,rules:[Hl,{["conditions"]:t,endpoint:{["url"]:"https://{Bucket}.op-{outpostId}.{url#authority}",["properties"]:fs,["headers"]:w},["type"]:"endpoint"}],["type"]:"tree"},{endpoint:{["url"]:"https://{Bucket}.op-{outpostId}.s3-outposts.{Region}.{regionPartition#dnsSuffix}",["properties"]:fs,["headers"]:w},["type"]:"endpoint"}],["type"]:"tree"},{error:"Unrecognized hardware type: \"Expected hardware type o or e but got {hardwareType}\"",["type"]:"error"}],["type"]:"tree"},{error:"Invalid ARN: The outpost Id must only contain a-z, A-Z, 0-9 and `-`.",["type"]:"error"}],["type"]:"tree"},{["conditions"]:Hg,rules:[{["conditions"]:[C,{["fn"]:"not",["argv"]:[{["fn"]:"isSet",["argv"]:[{["fn"]:"parseURL",["argv"]:zg}]}]}],error:"Custom endpoint `{Endpoint}` was not a valid URI",["type"]:"error"},{["conditions"]:[hf,ka],rules:[{["conditions"]:b,rules:[{["conditions"]:ma,rules:[{["conditions"]:[Y,Tl],error:"S3 Accelerate cannot be used in this region",["type"]:"error"},{["conditions"]:[N,$,y,A,z],endpoint:{["url"]:"https://{Bucket}.s3-fips.dualstack.us-east-1.{partitionResult#dnsSuffix}",["properties"]:H,["headers"]:w},["type"]:"endpoint"},{["conditions"]:[N,$,y,A,E,K],rules:[{endpoint:Kl,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[N,$,y,A,E,L],endpoint:Kl,["type"]:"endpoint"},{["conditions"]:[I,$,y,A,z],endpoint:{["url"]:"https://{Bucket}.s3-fips.us-east-1.{partitionResult#dnsSuffix}",["properties"]:H,["headers"]:w},["type"]:"endpoint"},{["conditions"]:[I,$,y,A,E,K],rules:[{endpoint:Ll,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[I,$,y,A,E,L],endpoint:Ll,["type"]:"endpoint"},{["conditions"]:[N,R,Y,A,z],endpoint:{["url"]:"https://{Bucket}.s3-accelerate.dualstack.us-east-1.{partitionResult#dnsSuffix}",["properties"]:H,["headers"]:w},["type"]:"endpoint"},{["conditions"]:[N,R,Y,A,E,K],rules:[{endpoint:Fl,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[N,R,Y,A,E,L],endpoint:Fl,["type"]:"endpoint"},{["conditions"]:[N,R,y,A,z],endpoint:{["url"]:"https://{Bucket}.s3.dualstack.us-east-1.{partitionResult#dnsSuffix}",["properties"]:H,["headers"]:w},["type"]:"endpoint"},{["conditions"]:[N,R,y,A,E,K],rules:[{endpoint:Wl,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[N,R,y,A,E,L],endpoint:Wl,["type"]:"endpoint"},{["conditions"]:[I,R,y,C,W,as,z],endpoint:{["url"]:"{url#scheme}://{url#authority}{url#normalizedPath}{Bucket}",["properties"]:H,["headers"]:w},["type"]:"endpoint"},{["conditions"]:[I,R,y,C,W,mf,z],endpoint:{["url"]:"{url#scheme}://{Bucket}.{url#authority}{url#path}",["properties"]:H,["headers"]:w},["type"]:"endpoint"},{["conditions"]:[I,R,y,C,W,as,E,K],rules:[{["conditions"]:x,endpoint:gf,["type"]:"endpoint"},{endpoint:gf,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[I,R,y,C,W,mf,E,K],rules:[{["conditions"]:x,endpoint:Gf,["type"]:"endpoint"},Xl],["type"]:"tree"},{["conditions"]:[I,R,y,C,W,as,E,L],endpoint:gf,["type"]:"endpoint"},{["conditions"]:[I,R,y,C,W,mf,E,L],endpoint:Gf,["type"]:"endpoint"},{["conditions"]:[I,R,Y,A,z],endpoint:{["url"]:"https://{Bucket}.s3-accelerate.{partitionResult#dnsSuffix}",["properties"]:H,["headers"]:w},["type"]:"endpoint"},{["conditions"]:[I,R,Y,A,E,K],rules:[{["conditions"]:x,endpoint:wf,["type"]:"endpoint"},{endpoint:wf,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[I,R,Y,A,E,L],endpoint:wf,["type"]:"endpoint"},{["conditions"]:[I,R,y,A,z],endpoint:{["url"]:"https://{Bucket}.s3.{partitionResult#dnsSuffix}",["properties"]:H,["headers"]:w},["type"]:"endpoint"},{["conditions"]:[I,R,y,A,E,K],rules:[{["conditions"]:x,endpoint:{["url"]:"https://{Bucket}.s3.{partitionResult#dnsSuffix}",["properties"]:c,["headers"]:w},["type"]:"endpoint"},{endpoint:Zl,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[I,R,y,A,E,L],endpoint:Zl,["type"]:"endpoint"}],["type"]:"tree"},es],["type"]:"tree"}],["type"]:"tree"},{["conditions"]:[C,W,{["fn"]:"stringEquals",["argv"]:[{["fn"]:"getAttr",["argv"]:[Ia,"scheme"]},"http"]},{["fn"]:"aws.isVirtualHostableS3Bucket",["argv"]:[X,!0]},hf,R,I,y],rules:[{["conditions"]:b,rules:[{["conditions"]:ma,rules:[Xl],["type"]:"tree"},es],["type"]:"tree"}],["type"]:"tree"},{["conditions"]:[hf,{["fn"]:"aws.parseArn",["argv"]:Gg,["assign"]:"bucketArn"}],rules:[{["conditions"]:[{["fn"]:"getAttr",["argv"]:[V,"resourceId[0]"],["assign"]:"arnType"},{["fn"]:"not",["argv"]:[{["fn"]:"stringEquals",["argv"]:[Pa,""]}]}],rules:[{["conditions"]:[{["fn"]:"stringEquals",["argv"]:[Af,"s3-object-lambda"]}],rules:[{["conditions"]:Tf,rules:[{["conditions"]:ga,rules:[Ql,Vl,{["conditions"]:yf,rules:[vl,{["conditions"]:wa,rules:[Sf,{["conditions"]:Cf,rules:[{["conditions"]:b,rules:[{["conditions"]:Aa,rules:[{["conditions"]:cf,rules:[{["conditions"]:[{["fn"]:"stringEquals",["argv"]:[$a,""]}],error:"Invalid ARN: Missing account id",["type"]:"error"},{["conditions"]:zf,rules:[{["conditions"]:Sa,rules:[{["conditions"]:t,endpoint:{["url"]:"{url#scheme}://{accessPointName}-{bucketArn#accountId}.{url#authority}{url#path}",["properties"]:Rf,["headers"]:w},["type"]:"endpoint"},{["conditions"]:gr,endpoint:{["url"]:"https://{accessPointName}-{bucketArn#accountId}.s3-object-lambda-fips.{bucketArn#region}.{bucketPartition#dnsSuffix}",["properties"]:Rf,["headers"]:w},["type"]:"endpoint"},{endpoint:{["url"]:"https://{accessPointName}-{bucketArn#accountId}.s3-object-lambda.{bucketArn#region}.{bucketPartition#dnsSuffix}",["properties"]:Rf,["headers"]:w},["type"]:"endpoint"}],["type"]:"tree"},Jl],["type"]:"tree"},df],["type"]:"tree"},If],["type"]:"tree"},Ef],["type"]:"tree"}],["type"]:"tree"}],["type"]:"tree"},Yl],["type"]:"tree"},{error:"Invalid ARN: bucket ARN is missing a region",["type"]:"error"}],["type"]:"tree"},Bl],["type"]:"tree"},{error:"Invalid ARN: Object Lambda ARNs only support `accesspoint` arn types, but found: `{arnType}`",["type"]:"error"}],["type"]:"tree"},{["conditions"]:Tf,rules:[{["conditions"]:ga,rules:[{["conditions"]:yf,rules:[{["conditions"]:Tf,rules:[{["conditions"]:yf,rules:[vl,{["conditions"]:wa,rules:[Sf,{["conditions"]:Cf,rules:[{["conditions"]:b,rules:[{["conditions"]:[{["fn"]:"stringEquals",["argv"]:[Na,"{partitionResult#name}"]}],rules:[{["conditions"]:cf,rules:[{["conditions"]:[{["fn"]:"stringEquals",["argv"]:[Af,"s3"]}],rules:[{["conditions"]:zf,rules:[{["conditions"]:Sa,rules:[{["conditions"]:ls,error:"Access Points do not support S3 Accelerate",["type"]:"error"},{["conditions"]:[$,N],endpoint:{["url"]:"https://{accessPointName}-{bucketArn#accountId}.s3-accesspoint-fips.dualstack.{bucketArn#region}.{bucketPartition#dnsSuffix}",["properties"]:Hr,["headers"]:w},["type"]:"endpoint"},{["conditions"]:[$,I],endpoint:{["url"]:"https://{accessPointName}-{bucketArn#accountId}.s3-accesspoint-fips.{bucketArn#region}.{bucketPartition#dnsSuffix}",["properties"]:Hr,["headers"]:w},["type"]:"endpoint"},{["conditions"]:[R,N],endpoint:{["url"]:"https://{accessPointName}-{bucketArn#accountId}.s3-accesspoint.dualstack.{bucketArn#region}.{bucketPartition#dnsSuffix}",["properties"]:Hr,["headers"]:w},["type"]:"endpoint"},{["conditions"]:[R,I,C,W],endpoint:{["url"]:"{url#scheme}://{accessPointName}-{bucketArn#accountId}.{url#authority}{url#path}",["properties"]:Hr,["headers"]:w},["type"]:"endpoint"},{["conditions"]:[R,I],endpoint:{["url"]:"https://{accessPointName}-{bucketArn#accountId}.s3-accesspoint.{bucketArn#region}.{bucketPartition#dnsSuffix}",["properties"]:Hr,["headers"]:w},["type"]:"endpoint"}],["type"]:"tree"},Jl],["type"]:"tree"},df],["type"]:"tree"},{error:"Invalid ARN: The ARN was not for the S3 service, found: {bucketArn#service}",["type"]:"error"}],["type"]:"tree"},If],["type"]:"tree"},Ef],["type"]:"tree"}],["type"]:"tree"}],["type"]:"tree"},Yl],["type"]:"tree"}],["type"]:"tree"}],["type"]:"tree"},{["conditions"]:[{["fn"]:"isValidHostLabel",["argv"]:[Hf,!0]}],rules:[{["conditions"]:Df,error:"S3 MRAP does not support dual-stack",["type"]:"error"},{["conditions"]:gr,error:"S3 MRAP does not support FIPS",["type"]:"error"},{["conditions"]:ls,error:"S3 MRAP does not support S3 Accelerate",["type"]:"error"},{["conditions"]:[{["fn"]:"booleanEquals",["argv"]:[{["ref"]:"DisableMultiRegionAccessPoints"},!0]}],error:"Invalid configuration: Multi-Region Access Point ARNs are disabled.",["type"]:"error"},{["conditions"]:[{["fn"]:"aws.partition",["argv"]:$f,["assign"]:"mrapPartition"}],rules:[{["conditions"]:[{["fn"]:"stringEquals",["argv"]:[{["fn"]:"getAttr",["argv"]:[{["ref"]:"mrapPartition"},"name"]},{["fn"]:"getAttr",["argv"]:[V,"partition"]}]}],rules:[{endpoint:{["url"]:"https://{accessPointName}.accesspoint.s3-global.{mrapPartition#dnsSuffix}",["properties"]:{["authSchemes"]:[{["disableDoubleEncoding"]:!0,name:"sigv4a",["signingName"]:"s3",["signingRegionSet"]:Kg}]},["headers"]:w},["type"]:"endpoint"}],["type"]:"tree"},{error:"Client was configured for partition `{mrapPartition#name}` but bucket referred to partition `{bucketArn#partition}`",["type"]:"error"}],["type"]:"tree"}],["type"]:"tree"},{error:"Invalid Access Point Name",["type"]:"error"}],["type"]:"tree"},Bl],["type"]:"tree"},{["conditions"]:[{["fn"]:"stringEquals",["argv"]:[Af,"s3-outposts"]}],rules:[{["conditions"]:Df,error:"S3 Outposts does not support Dual-stack",["type"]:"error"},{["conditions"]:gr,error:"S3 Outposts does not support FIPS",["type"]:"error"},{["conditions"]:ls,error:"S3 Outposts does not support S3 Accelerate",["type"]:"error"},{["conditions"]:[{["fn"]:"isSet",["argv"]:[{["fn"]:"getAttr",["argv"]:[V,"resourceId[4]"]}]}],error:"Invalid Arn: Outpost Access Point ARN contains sub resources",["type"]:"error"},{["conditions"]:[{["fn"]:"getAttr",["argv"]:Lg,["assign"]:"outpostId"}],rules:[{["conditions"]:aa,rules:[Sf,{["conditions"]:Cf,rules:[{["conditions"]:b,rules:[{["conditions"]:Aa,rules:[{["conditions"]:cf,rules:[{["conditions"]:zf,rules:[{["conditions"]:[{["fn"]:"getAttr",["argv"]:Fg,["assign"]:"outpostType"}],rules:[{["conditions"]:[{["fn"]:"getAttr",["argv"]:[V,"resourceId[3]"],["assign"]:"accessPointName"}],rules:[{["conditions"]:[{["fn"]:"stringEquals",["argv"]:[{["ref"]:"outpostType"},"accesspoint"]}],rules:[{["conditions"]:t,endpoint:{["url"]:"https://{accessPointName}-{bucketArn#accountId}.{outpostId}.{url#authority}",["properties"]:Ol,["headers"]:w},["type"]:"endpoint"},{endpoint:{["url"]:"https://{accessPointName}-{bucketArn#accountId}.{outpostId}.s3-outposts.{bucketArn#region}.{bucketPartition#dnsSuffix}",["properties"]:Ol,["headers"]:w},["type"]:"endpoint"}],["type"]:"tree"},{error:"Expected an outpost type `accesspoint`, found {outpostType}",["type"]:"error"}],["type"]:"tree"},{error:"Invalid ARN: expected an access point name",["type"]:"error"}],["type"]:"tree"},{error:"Invalid ARN: Expected a 4-component resource",["type"]:"error"}],["type"]:"tree"},df],["type"]:"tree"},If],["type"]:"tree"},Ef],["type"]:"tree"}],["type"]:"tree"}],["type"]:"tree"},{error:"Invalid ARN: The outpost Id may only contain a-z, A-Z, 0-9 and `-`. Found: `{outpostId}`",["type"]:"error"}],["type"]:"tree"},{error:"Invalid ARN: The Outpost Id was not set",["type"]:"error"}],["type"]:"tree"},{error:"Invalid ARN: Unrecognized format: {Bucket} (type: {arnType})",["type"]:"error"}],["type"]:"tree"},{error:"Invalid ARN: No ARN type specified",["type"]:"error"}],["type"]:"tree"},{["conditions"]:[{["fn"]:"substring",["argv"]:[X,0,4,!1],["assign"]:"arnPrefix"},{["fn"]:"stringEquals",["argv"]:[{["ref"]:"arnPrefix"},"arn:"]},{["fn"]:"not",["argv"]:[{["fn"]:"isSet",["argv"]:[_l]}]}],error:"Invalid ARN: `{Bucket}` was not a valid ARN",["type"]:"error"},{["conditions"]:[{["fn"]:"booleanEquals",["argv"]:[cg,!0]},_l],error:"Path-style addressing cannot be used with ARN buckets",["type"]:"error"},{["conditions"]:Uf,rules:[{["conditions"]:b,rules:[{["conditions"]:[y],rules:[{["conditions"]:[N,A,$,z],endpoint:{["url"]:"https://s3-fips.dualstack.us-east-1.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",["properties"]:H,["headers"]:w},["type"]:"endpoint"},{["conditions"]:[N,A,$,E,K],rules:[{endpoint:ql,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[N,A,$,E,L],endpoint:ql,["type"]:"endpoint"},{["conditions"]:[I,A,$,z],endpoint:{["url"]:"https://s3-fips.us-east-1.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",["properties"]:H,["headers"]:w},["type"]:"endpoint"},{["conditions"]:[I,A,$,E,K],rules:[{endpoint:jl,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[I,A,$,E,L],endpoint:jl,["type"]:"endpoint"},{["conditions"]:[N,A,R,z],endpoint:{["url"]:"https://s3.dualstack.us-east-1.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",["properties"]:H,["headers"]:w},["type"]:"endpoint"},{["conditions"]:[N,A,R,E,K],rules:[{endpoint:il,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[N,A,R,E,L],endpoint:il,["type"]:"endpoint"},{["conditions"]:[I,C,W,R,z],endpoint:{["url"]:"{url#scheme}://{url#authority}{url#normalizedPath}{uri_encoded_bucket}",["properties"]:H,["headers"]:w},["type"]:"endpoint"},{["conditions"]:[I,C,W,R,E,K],rules:[{["conditions"]:x,endpoint:kf,["type"]:"endpoint"},{endpoint:kf,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[I,C,W,R,E,L],endpoint:kf,["type"]:"endpoint"},{["conditions"]:[I,A,R,z],endpoint:{["url"]:"https://s3.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",["properties"]:H,["headers"]:w},["type"]:"endpoint"},{["conditions"]:[I,A,R,E,K],rules:[{["conditions"]:x,endpoint:{["url"]:"https://s3.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",["properties"]:c,["headers"]:w},["type"]:"endpoint"},{endpoint:bl,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[I,A,R,E,L],endpoint:bl,["type"]:"endpoint"}],["type"]:"tree"},{error:"Path-style addressing cannot be used with S3 Accelerate",["type"]:"error"}],["type"]:"tree"}],["type"]:"tree"}],["type"]:"tree"},{["conditions"]:[{["fn"]:"isSet",["argv"]:[xl]},{["fn"]:"booleanEquals",["argv"]:[xl,!0]}],rules:[{["conditions"]:b,rules:[{["conditions"]:Ra,rules:[Ql,Vl,{["conditions"]:t,endpoint:{["url"]:"{url#scheme}://{url#authority}{url#path}",["properties"]:Pf,["headers"]:w},["type"]:"endpoint"},{["conditions"]:gr,endpoint:{["url"]:"https://s3-object-lambda-fips.{Region}.{partitionResult#dnsSuffix}",["properties"]:Pf,["headers"]:w},["type"]:"endpoint"},{endpoint:{["url"]:"https://s3-object-lambda.{Region}.{partitionResult#dnsSuffix}",["properties"]:Pf,["headers"]:w},["type"]:"endpoint"}],["type"]:"tree"},es],["type"]:"tree"}],["type"]:"tree"},{["conditions"]:[zl],rules:[{["conditions"]:b,rules:[{["conditions"]:Ra,rules:[{["conditions"]:[$,N,A,z],endpoint:{["url"]:"https://s3-fips.dualstack.us-east-1.{partitionResult#dnsSuffix}",["properties"]:H,["headers"]:w},["type"]:"endpoint"},{["conditions"]:[$,N,A,E,K],rules:[{endpoint:ol,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[$,N,A,E,L],endpoint:ol,["type"]:"endpoint"},{["conditions"]:[$,I,A,z],endpoint:{["url"]:"https://s3-fips.us-east-1.{partitionResult#dnsSuffix}",["properties"]:H,["headers"]:w},["type"]:"endpoint"},{["conditions"]:[$,I,A,E,K],rules:[{endpoint:nl,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[$,I,A,E,L],endpoint:nl,["type"]:"endpoint"},{["conditions"]:[R,N,A,z],endpoint:{["url"]:"https://s3.dualstack.us-east-1.{partitionResult#dnsSuffix}",["properties"]:H,["headers"]:w},["type"]:"endpoint"},{["conditions"]:[R,N,A,E,K],rules:[{endpoint:pl,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[R,N,A,E,L],endpoint:pl,["type"]:"endpoint"},{["conditions"]:[R,I,C,W,z],endpoint:{["url"]:"{url#scheme}://{url#authority}{url#path}",["properties"]:H,["headers"]:w},["type"]:"endpoint"},{["conditions"]:[R,I,C,W,E,K],rules:[{["conditions"]:x,endpoint:Nf,["type"]:"endpoint"},{endpoint:Nf,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[R,I,C,W,E,L],endpoint:Nf,["type"]:"endpoint"},{["conditions"]:[R,I,A,z],endpoint:{["url"]:"https://s3.{partitionResult#dnsSuffix}",["properties"]:H,["headers"]:w},["type"]:"endpoint"},{["conditions"]:[R,I,A,E,K],rules:[{["conditions"]:x,endpoint:{["url"]:"https://s3.{partitionResult#dnsSuffix}",["properties"]:c,["headers"]:w},["type"]:"endpoint"},{endpoint:ul,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[R,I,A,E,L],endpoint:ul,["type"]:"endpoint"}],["type"]:"tree"},es],["type"]:"tree"}],["type"]:"tree"}],["type"]:"tree"},{error:"A region must be set when sending requests to S3.",["type"]:"error"}]},Da=Wg;var gs=(r,s={})=>{return Ma(Da,{endpointParams:r,logger:s.logger})};Ua.aws=Ta;var ca=function(r){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"s3",region:r.region},propertiesExtractor:(s,f)=>({signingProperties:{config:s,context:f}})}},za=function(r){return{schemeId:"aws.auth#sigv4a",signingProperties:{name:"s3",region:r.region},propertiesExtractor:(s,f)=>({signingProperties:{config:s,context:f}})}},Xg=(r)=>async(s,f,e)=>{if(!e)throw new Error("Could not find \`input\` for \`defaultEndpointRuleSetHttpAuthSchemeParametersProvider\`");const l=await r(s,f,e),a=Kr.getSmithyContext(f)?.commandInstance?.constructor?.getEndpointParameterInstructions;if(!a)throw new Error(`getEndpointParameterInstructions() is not defined on \`${f.commandName}\``);const h=await ya(e,{getEndpointParameterInstructions:a},s);return Object.assign(l,h)},Zg=async(r,s,f)=>{return{operation:Kr.getSmithyContext(s).operation,region:await Kr.normalizeProvider(r.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()}},Ca=Xg(Zg),Qg=(r,s,f)=>{return(l)=>{const h=r(l).properties?.authSchemes;if(!h)return s(l);const m=[];for(let g of h){const{name:S,properties:d={},...k}=g,P=S.toLowerCase();if(S!==P)console.warn(`HttpAuthScheme has been normalized with lowercasing: \`${S}\` to \`${P}\``);let T;if(P==="sigv4a"){T="aws.auth#sigv4a";const Br=h.find((_)=>{const Dr=_.name.toLowerCase();return Dr!=="sigv4a"&&Dr.startsWith("sigv4")});if(!ss.CrtSignerV4&&Br)continue}else if(P.startsWith("sigv4"))T="aws.auth#sigv4";else throw new Error(`Unknown HttpAuthScheme found in \`@smithy.rules#endpointRuleSet\`: \`${P}\``);const D=f[T];if(!D)throw new Error(`Could not find HttpAuthOption create function for \`${T}\``);const Q=D(l);Q.schemeId=T,Q.signingProperties={...Q.signingProperties||{},...k,...d},m.push(Q)}return m}},Vg=(r)=>{const s=[];switch(r.operation){default:s.push(ca(r)),s.push(za(r))}return s},Ga=Qg(gs,Vg,{"aws.auth#sigv4":ca,"aws.auth#sigv4a":za}),Ha=(r)=>{const s=As.resolveAwsSdkSigV4Config(r);return{...As.resolveAwsSdkSigV4AConfig(s)}};var Ka=(r)=>{return{...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"}},wr={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 Z extends La{constructor(r){super(r);Object.setPrototypeOf(this,Z.prototype)}}class Ss extends Z{constructor(r){super({name:"NoSuchUpload",$fault:"client",...r});this.name="NoSuchUpload",this.$fault="client",Object.setPrototypeOf(this,Ss.prototype)}}class Rs extends Z{constructor(r){super({name:"ObjectNotInActiveTierError",$fault:"client",...r});this.name="ObjectNotInActiveTierError",this.$fault="client",Object.setPrototypeOf(this,Rs.prototype)}}class ds extends Z{constructor(r){super({name:"BucketAlreadyExists",$fault:"client",...r});this.name="BucketAlreadyExists",this.$fault="client",Object.setPrototypeOf(this,ds.prototype)}}class Is extends Z{constructor(r){super({name:"BucketAlreadyOwnedByYou",$fault:"client",...r});this.name="BucketAlreadyOwnedByYou",this.$fault="client",Object.setPrototypeOf(this,Is.prototype)}}class Es extends Z{constructor(r){super({name:"NoSuchBucket",$fault:"client",...r});this.name="NoSuchBucket",this.$fault="client",Object.setPrototypeOf(this,Es.prototype)}}var Kf;(function(r){r.visit=(s,f)=>{if(s.Prefix!==void 0)return f.Prefix(s.Prefix);if(s.Tag!==void 0)return f.Tag(s.Tag);if(s.And!==void 0)return f.And(s.And);return f._(s.$unknown[0],s.$unknown[1])}})(Kf||(Kf={}));var Lf;(function(r){r.visit=(s,f)=>{if(s.Prefix!==void 0)return f.Prefix(s.Prefix);if(s.Tag!==void 0)return f.Tag(s.Tag);if(s.ObjectSizeGreaterThan!==void 0)return f.ObjectSizeGreaterThan(s.ObjectSizeGreaterThan);if(s.ObjectSizeLessThan!==void 0)return f.ObjectSizeLessThan(s.ObjectSizeLessThan);if(s.And!==void 0)return f.And(s.And);return f._(s.$unknown[0],s.$unknown[1])}})(Lf||(Lf={}));var Ff;(function(r){r.visit=(s,f)=>{if(s.Prefix!==void 0)return f.Prefix(s.Prefix);if(s.Tag!==void 0)return f.Tag(s.Tag);if(s.AccessPointArn!==void 0)return f.AccessPointArn(s.AccessPointArn);if(s.And!==void 0)return f.And(s.And);return f._(s.$unknown[0],s.$unknown[1])}})(Ff||(Ff={}));var Wf;(function(r){r.visit=(s,f)=>{if(s.Prefix!==void 0)return f.Prefix(s.Prefix);if(s.Tag!==void 0)return f.Tag(s.Tag);if(s.And!==void 0)return f.And(s.And);return f._(s.$unknown[0],s.$unknown[1])}})(Wf||(Wf={}));class ks extends Z{constructor(r){super({name:"InvalidObjectState",$fault:"client",...r});this.name="InvalidObjectState",this.$fault="client",Object.setPrototypeOf(this,ks.prototype),this.StorageClass=r.StorageClass,this.AccessTier=r.AccessTier}}class Ps extends Z{constructor(r){super({name:"NoSuchKey",$fault:"client",...r});this.name="NoSuchKey",this.$fault="client",Object.setPrototypeOf(this,Ps.prototype)}}class Ns extends Z{constructor(r){super({name:"NotFound",$fault:"client",...r});this.name="NotFound",this.$fault="client",Object.setPrototypeOf(this,Ns.prototype)}}var vg=(r)=>({...r,...r.SecretAccessKey&&{SecretAccessKey:B},...r.SessionToken&&{SessionToken:B}}),Fa=(r)=>({...r,...r.Credentials&&{Credentials:vg(r.Credentials)}});var Wa=(r)=>({...r,...r.SSEKMSKeyId&&{SSEKMSKeyId:B}}),Xa=(r)=>({...r,...r.SSECustomerKey&&{SSECustomerKey:B}});var Rr=U(ws(),1);var Ts=U(sf(),1);class $s extends Z{constructor(r){super({name:"ObjectAlreadyInActiveTierError",$fault:"client",...r});this.name="ObjectAlreadyInActiveTierError",this.$fault="client",Object.setPrototypeOf(this,$s.prototype)}}var Za;(function(r){r.visit=(s,f)=>{if(s.Records!==void 0)return f.Records(s.Records);if(s.Stats!==void 0)return f.Stats(s.Stats);if(s.Progress!==void 0)return f.Progress(s.Progress);if(s.Cont!==void 0)return f.Cont(s.Cont);if(s.End!==void 0)return f.End(s.End);return f._(s.$unknown[0],s.$unknown[1])}})(Za||(Za={}));var Qa=(r)=>({...r,...r.SSEKMSKeyId&&{SSEKMSKeyId:B},...r.SSEKMSEncryptionContext&&{SSEKMSEncryptionContext:B}}),Va=(r)=>({...r,...r.SSECustomerKey&&{SSECustomerKey:B},...r.SSEKMSKeyId&&{SSEKMSKeyId:B},...r.SSEKMSEncryptionContext&&{SSEKMSEncryptionContext:B}});var na=async(r,s)=>{const f=Ts.requestBuilder(r,s),e=G({},j,{[bw]:r[yw]});f.bp("/"),f.p("Bucket",()=>r.Bucket,"{Bucket}",!1);const l=G({[_w]:[,""]});let a;return f.m("GET").h(e).q(l).b(a),f.build()};var pa=async(r,s)=>{const f=Ts.requestBuilder(r,s),e=G({},j,{[Lw]:r[ww],[Fw]:[()=>j(r[va]),()=>Lr(r[va]).toString()],[Ww]:r[Aw],[Xw]:[()=>j(r[Ja]),()=>Lr(r[Ja]).toString()],[Qw]:r[Ew],[cs]:r[ys],[Kh]:r[dh],[zs]:r[Cs],[zh]:r[Rh],[Th]:r[mh],[iw]:r[rw]});f.bp("/{Key+}"),f.p("Bucket",()=>r.Bucket,"{Bucket}",!1),f.p("Key",()=>r.Key,"{Key+}",!0);const l=G({[Wh]:[,"GetObject"],[Vw]:[,r[kw]],[vw]:[,r[Pw]],[Jw]:[,r[Nw]],[Yw]:[,r[$w]],[Bw]:[,r[Dw]],[Ow]:[()=>r.ResponseExpires!==void 0,()=>Lr(r[Uw]).toString()],[qw]:[,r[re]],[Zw]:[()=>r.PartNumber!==void 0,()=>r[Iw].toString()]});let a;return f.m("GET").h(e).q(l).b(a),f.build()};var ua=async(r,s)=>{const f=Ts.requestBuilder(r,s),e=G({},j,{[Dh]:r[hh]||"application/octet-stream",[jw]:r[pg],[kh]:r[fh],[Ph]:r[eh],[Nh]:r[lh],[$h]:r[ah],[Of]:[()=>j(r[Jf]),()=>r[Jf].toString()],[Gw]:r[sw],[rA]:r[tg],[se]:r[xf],[fe]:r[of],[ee]:r[nf],[le]:r[pf],[_f]:[()=>j(r[Yf]),()=>Lr(r[Yf]).toString()],[xw]:r[aw],[ow]:r[hw],[nw]:r[mw],[pw]:r[gw],[ae]:r[uf],[Gh]:r[Wr],[Fh]:r[Eh],[cs]:r[ys],[Kh]:r[dh],[zs]:r[Cs],[he]:r[tf],[Hh]:r[Ih],[Xr]:[()=>j(r[Ms]),()=>r[Ms].toString()],[zh]:r[Rh],[sA]:r[Cw],[Ch]:r[Ah],[qf]:[()=>j(r[Bf]),()=>oa(r[Bf]).toString()],[yh]:r[wh],[Th]:r[mh],...r.Metadata!==void 0&&Object.keys(r.Metadata).reduce((m,g)=>{return m[`x-amz-meta-${g.toLowerCase()}`]=r.Metadata[g],m},{})});f.bp("/{Key+}"),f.p("Bucket",()=>r.Bucket,"{Bucket}",!1),f.p("Key",()=>r.Key,"{Key+}",!0);const l=G({[Wh]:[,"PutObject"]});let a,h;if(r.Body!==void 0)h=r.Body,a=h;return f.m("PUT").h(e).q(l).b(a),f.build()};var ta=async(r,s)=>{if(r.statusCode!==200&&r.statusCode>=300)return bf(r,s);const f=G({$metadata:J(r)}),e=Ar(ia(await Rr.parseXmlBody(r.body,s)),"body");if(e[Qf]!=null)f[Qf]=ng(e[Qf],s);return f};var rh=async(r,s)=>{if(r.statusCode!==200&&r.statusCode>=300)return bf(r,s);const f=G({$metadata:J(r),[ew]:[()=>r.headers[Ba]!==void 0,()=>Us(r.headers[Ba])],[ug]:[,r.headers[zw]],[Fr]:[,r.headers[Mh]],[Tw]:[,r.headers[uw]],[Sw]:[()=>r.headers[Ya]!==void 0,()=>Ar(Ur(r.headers[Ya]))],[Jf]:[()=>r.headers[Of]!==void 0,()=>ba(r.headers[Of])],[gh]:[,r.headers[Uh]],[xf]:[,r.headers[se]],[of]:[,r.headers[fe]],[nf]:[,r.headers[ee]],[pf]:[,r.headers[le]],[Rw]:[()=>r.headers[Oa]!==void 0,()=>Ds(r.headers[Oa])],[re]:[,r.headers[Lh]],[fh]:[,r.headers[kh]],[eh]:[,r.headers[Ph]],[lh]:[,r.headers[Nh]],[ah]:[,r.headers[$h]],[fw]:[,r.headers[Hw]],[hh]:[,r.headers[Dh]],[Yf]:[()=>r.headers[_f]!==void 0,()=>Ar(Ur(r.headers[_f]))],[lw]:[,r.headers[Kw]],[Eh]:[,r.headers[Fh]],[uf]:[,r.headers[ae]],[ys]:[,r.headers[cs]],[Cs]:[,r.headers[zs]],[tf]:[,r.headers[he]],[Ms]:[()=>r.headers[Xr]!==void 0,()=>Us(r.headers[Xr])],[Wr]:[,r.headers[Gh]],[Sh]:[,r.headers[ch]],[Mw]:[,r.headers[tw]],[dw]:[()=>r.headers[_a]!==void 0,()=>Ds(r.headers[_a])],[cw]:[()=>r.headers[qa]!==void 0,()=>Ds(r.headers[qa])],[Ah]:[,r.headers[Ch]],[Bf]:[()=>r.headers[qf]!==void 0,()=>Ar(jf(r.headers[qf]))],[wh]:[,r.headers[yh]],Metadata:[,Object.keys(r.headers).filter((l)=>l.startsWith("x-amz-meta-")).reduce((l,a)=>{return l[a.substring(11)]=r.headers[a],l},{})]}),e=r.body;return s.sdkStreamMixin(e),f.Body=e,f};var sh=async(r,s)=>{if(r.statusCode!==200&&r.statusCode>=300)return bf(r,s);const f=G({$metadata:J(r),[Fr]:[,r.headers[Mh]],[gh]:[,r.headers[Uh]],[xf]:[,r.headers[se]],[of]:[,r.headers[fe]],[nf]:[,r.headers[ee]],[pf]:[,r.headers[le]],[uf]:[,r.headers[ae]],[re]:[,r.headers[Lh]],[ys]:[,r.headers[cs]],[Cs]:[,r.headers[zs]],[tf]:[,r.headers[he]],[Ih]:[,r.headers[Hh]],[Ms]:[()=>r.headers[Xr]!==void 0,()=>Us(r.headers[Xr])],[Sh]:[,r.headers[ch]]});return await ja(r.body,s),f};var bf=async(r,s)=>{const f={...r,body:await Rr.parseXmlErrorBody(r.body,s)},e=Rr.loadRestXmlErrorCode(r,f.body);switch(e){case"NoSuchUpload":case"com.amazonaws.s3#NoSuchUpload":throw await ig(f,s);case"ObjectNotInActiveTierError":case"com.amazonaws.s3#ObjectNotInActiveTierError":throw await og(f,s);case"BucketAlreadyExists":case"com.amazonaws.s3#BucketAlreadyExists":throw await Bg(f,s);case"BucketAlreadyOwnedByYou":case"com.amazonaws.s3#BucketAlreadyOwnedByYou":throw await Og(f,s);case"NoSuchBucket":case"com.amazonaws.s3#NoSuchBucket":throw await qg(f,s);case"InvalidObjectState":case"com.amazonaws.s3#InvalidObjectState":throw await _g(f,s);case"NoSuchKey":case"com.amazonaws.s3#NoSuchKey":throw await jg(f,s);case"NotFound":case"com.amazonaws.s3#NotFound":throw await bg(f,s);case"ObjectAlreadyInActiveTierError":case"com.amazonaws.s3#ObjectAlreadyInActiveTierError":throw await xg(f,s);default:const l=f.body;return Yg({output:r,parsedBody:l,errorCode:e})}},Yg=xa(Z),Bg=async(r,s)=>{const f=G({}),e=r.body,l=new ds({$metadata:J(r),...f});return O(l,r.body)},Og=async(r,s)=>{const f=G({}),e=r.body,l=new Is({$metadata:J(r),...f});return O(l,r.body)},_g=async(r,s)=>{const f=G({}),e=r.body;if(e[Zf]!=null)f[Zf]=Sr(e[Zf]);if(e[Wr]!=null)f[Wr]=Sr(e[Wr]);const l=new ks({$metadata:J(r),...f});return O(l,r.body)},qg=async(r,s)=>{const f=G({}),e=r.body,l=new Es({$metadata:J(r),...f});return O(l,r.body)},jg=async(r,s)=>{const f=G({}),e=r.body,l=new Ps({$metadata:J(r),...f});return O(l,r.body)},ig=async(r,s)=>{const f=G({}),e=r.body,l=new Ss({$metadata:J(r),...f});return O(l,r.body)},bg=async(r,s)=>{const f=G({}),e=r.body,l=new Ns({$metadata:J(r),...f});return O(l,r.body)},xg=async(r,s)=>{const f=G({}),e=r.body,l=new $s({$metadata:J(r),...f});return O(l,r.body)},og=async(r,s)=>{const f=G({}),e=r.body,l=new Rs({$metadata:J(r),...f});return O(l,r.body)};var ng=(r,s)=>{const f={};if(r[Xf]!=null)f[Xf]=Sr(r[Xf]);if(r[Vf]!=null)f[Vf]=Sr(r[Vf]);if(r[vf]!=null)f[vf]=Sr(r[vf]);if(r[Fr]!=null)f[Fr]=Ar(jf(r[Fr]));return f};var J=(r)=>({httpStatusCode:r.statusCode,requestId:r.headers["x-amzn-requestid"]??r.headers["x-amzn-request-id"]??r.headers["x-amz-request-id"],extendedRequestId:r.headers["x-amz-id-2"],cfId:r.headers["x-amz-cf-id"]});var j=(r)=>r!==void 0&&r!==null&&r!==""&&(!Object.getOwnPropertyNames(r).includes("length")||r.length!=0)&&(!Object.getOwnPropertyNames(r).includes("size")||r.size!=0);var pg="ACL";var Xf="AccessKeyId";var ug="AcceptRanges";var Zf="AccessTier";var Ms="BucketKeyEnabled";var Qf="Credentials",tg="ChecksumAlgorithm";var fh="CacheControl",xf="ChecksumCRC32",of="ChecksumCRC32C",eh="ContentDisposition";var lh="ContentEncoding";var ah="ContentLanguage",Jf="ContentLength",rw="ChecksumMode",sw="ContentMD5";var fw="ContentRange";var nf="ChecksumSHA1",pf="ChecksumSHA256";var hh="ContentType";var ew="DeleteMarker";var Yf="Expires";var mh="ExpectedBucketOwner";var lw="ExpiresString";var gh="ETag";var Fr="Expiration";var aw="GrantFullControl";var hw="GrantRead",mw="GrantReadACP";var gw="GrantWriteACP";var ww="IfMatch",va="IfModifiedSince",Aw="IfNoneMatch";var Ja="IfUnmodifiedSince";var Sw="LastModified";var Rw="MissingMeta";var wh="ObjectLockLegalHoldStatus",Ah="ObjectLockMode";var Bf="ObjectLockRetainUntilDate";var dw="PartsCount";var Iw="PartNumber";var Ew="Range";var Sh="RequestCharged",kw="ResponseCacheControl",Pw="ResponseContentDisposition",Nw="ResponseContentEncoding",$w="ResponseContentLanguage",Dw="ResponseContentType";var Uw="ResponseExpires";var Rh="RequestPayer";var Mw="ReplicationStatus";var Tw="Restore";var Vf="SecretAccessKey";var Wr="StorageClass";var yw="SessionMode";var uf="ServerSideEncryption";var ys="SSECustomerAlgorithm",dh="SSECustomerKey",Cs="SSECustomerKeyMD5";var Ih="SSEKMSEncryptionContext",tf="SSEKMSKeyId";var vf="SessionToken";var Cw="Tagging";var cw="TagCount";var re="VersionId";var Eh="WebsiteRedirectLocation";var zw="accept-ranges";var kh="cache-control",Ph="content-disposition",Nh="content-encoding",$h="content-language",Of="content-length",Gw="content-md5",Hw="content-range",Dh="content-type";var _f="expires";var Uh="etag",Kw="expiresstring";var Lw="if-match",Fw="if-modified-since";var Ww="if-none-match";var Xw="if-unmodified-since";var Ya="last-modified";var Zw="partNumber";var Qw="range",Vw="response-cache-control",vw="response-content-disposition",Jw="response-content-encoding",Yw="response-content-language",Bw="response-content-type",Ow="response-expires";var _w="session";var qw="versionId";var jw="x-amz-acl";var se="x-amz-checksum-crc32",fe="x-amz-checksum-crc32c",iw="x-amz-checksum-mode";var ee="x-amz-checksum-sha1",le="x-amz-checksum-sha256";var bw="x-amz-create-session-mode";var Ba="x-amz-delete-marker",Mh="x-amz-expiration",Th="x-amz-expected-bucket-owner";var xw="x-amz-grant-full-control",ow="x-amz-grant-read",nw="x-amz-grant-read-acp";var pw="x-amz-grant-write-acp";var Oa="x-amz-missing-meta";var _a="x-amz-mp-parts-count";var yh="x-amz-object-lock-legal-hold",Ch="x-amz-object-lock-mode",qf="x-amz-object-lock-retain-until-date";var uw="x-amz-restore",ch="x-amz-request-charged";var zh="x-amz-request-payer";var tw="x-amz-replication-status";var Gh="x-amz-storage-class",rA="x-amz-sdk-checksum-algorithm";var ae="x-amz-server-side-encryption",he="x-amz-server-side-encryption-aws-kms-key-id",Xr="x-amz-server-side-encryption-bucket-key-enabled",Hh="x-amz-server-side-encryption-context",cs="x-amz-server-side-encryption-customer-algorithm",Kh="x-amz-server-side-encryption-customer-key",zs="x-amz-server-side-encryption-customer-key-md5",sA="x-amz-tagging",qa="x-amz-tagging-count";var Lh="x-amz-version-id",Fh="x-amz-website-redirect-location",Wh="x-id";class me extends dr.classBuilder().ep({...wr,DisableS3ExpressSessionAuth:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function(r,s,f,e){return[Ir(f,this.serialize,this.deserialize),Er(f,r.getEndpointParameterInstructions()),rs(f)]}).s("AmazonS3","CreateSession",{}).n("S3Client","CreateSessionCommand").f(void 0,Fa).ser(na).de(ta).build(){}var Xh={name:"@aws-sdk/client-s3",description:"AWS SDK for JavaScript S3 Client for Node.js, Browser and React Native",version:"3.629.0",scripts:{build:"concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'","build:cjs":"node ../../scripts/compilation/inline client-s3","build:es":"tsc -p tsconfig.es.json","build:include:deps":"lerna run --scope $npm_package_name --include-dependencies build","build:types":"tsc -p tsconfig.types.json","build:types:downlevel":"downlevel-dts dist-types dist-types/ts3.4",clean:"rimraf ./dist-* && rimraf *.tsbuildinfo","extract:docs":"api-extractor run --local","generate:client":"node ../../scripts/generate-clients/single-service --solo s3",test:"yarn test:unit","test:e2e":"yarn test:e2e:node && yarn test:e2e:browser","test:e2e:browser":"ts-mocha test/**/*.browser.ispec.ts && karma start karma.conf.js","test:e2e:node":"jest --c jest.config.e2e.js","test:unit":"ts-mocha test/unit/**/*.spec.ts"},main:"./dist-cjs/index.js",types:"./dist-types/index.d.ts",module:"./dist-es/index.js",sideEffects:!1,dependencies:{"@aws-crypto/sha1-browser":"5.2.0","@aws-crypto/sha256-browser":"5.2.0","@aws-crypto/sha256-js":"5.2.0","@aws-sdk/client-sso-oidc":"3.629.0","@aws-sdk/client-sts":"3.629.0","@aws-sdk/core":"3.629.0","@aws-sdk/credential-provider-node":"3.629.0","@aws-sdk/middleware-bucket-endpoint":"3.620.0","@aws-sdk/middleware-expect-continue":"3.620.0","@aws-sdk/middleware-flexible-checksums":"3.620.0","@aws-sdk/middleware-host-header":"3.620.0","@aws-sdk/middleware-location-constraint":"3.609.0","@aws-sdk/middleware-logger":"3.609.0","@aws-sdk/middleware-recursion-detection":"3.620.0","@aws-sdk/middleware-sdk-s3":"3.629.0","@aws-sdk/middleware-ssec":"3.609.0","@aws-sdk/middleware-user-agent":"3.620.0","@aws-sdk/region-config-resolver":"3.614.0","@aws-sdk/signature-v4-multi-region":"3.629.0","@aws-sdk/types":"3.609.0","@aws-sdk/util-endpoints":"3.614.0","@aws-sdk/util-user-agent-browser":"3.609.0","@aws-sdk/util-user-agent-node":"3.614.0","@aws-sdk/xml-builder":"3.609.0","@smithy/config-resolver":"^3.0.5","@smithy/core":"^2.3.2","@smithy/eventstream-serde-browser":"^3.0.6","@smithy/eventstream-serde-config-resolver":"^3.0.3","@smithy/eventstream-serde-node":"^3.0.5","@smithy/fetch-http-handler":"^3.2.4","@smithy/hash-blob-browser":"^3.1.2","@smithy/hash-node":"^3.0.3","@smithy/hash-stream-node":"^3.1.2","@smithy/invalid-dependency":"^3.0.3","@smithy/md5-js":"^3.0.3","@smithy/middleware-content-length":"^3.0.5","@smithy/middleware-endpoint":"^3.1.0","@smithy/middleware-retry":"^3.0.14","@smithy/middleware-serde":"^3.0.3","@smithy/middleware-stack":"^3.0.3","@smithy/node-config-provider":"^3.1.4","@smithy/node-http-handler":"^3.1.4","@smithy/protocol-http":"^4.1.0","@smithy/smithy-client":"^3.1.12","@smithy/types":"^3.3.0","@smithy/url-parser":"^3.0.3","@smithy/util-base64":"^3.0.0","@smithy/util-body-length-browser":"^3.0.0","@smithy/util-body-length-node":"^3.0.0","@smithy/util-defaults-mode-browser":"^3.0.14","@smithy/util-defaults-mode-node":"^3.0.14","@smithy/util-endpoints":"^2.0.5","@smithy/util-middleware":"^3.0.3","@smithy/util-retry":"^3.0.3","@smithy/util-stream":"^3.1.3","@smithy/util-utf8":"^3.0.0","@smithy/util-waiter":"^3.1.2",tslib:"^2.6.2"},devDependencies:{"@aws-sdk/signature-v4-crt":"3.629.0","@tsconfig/node16":"16.1.3","@types/chai":"^4.2.11","@types/mocha":"^8.0.4","@types/node":"^16.18.96",concurrently:"7.0.0","downlevel-dts":"0.10.1",rimraf:"3.0.2",typescript:"~4.9.5"},engines:{node:">=16.0.0"},typesVersions:{"<4.0":{"dist-types/*":["dist-types/ts3.4/*"]}},files:["dist-*/**"],author:{name:"AWS SDK for JavaScript Team",url:"https://aws.amazon.com/javascript/"},license:"Apache-2.0",browser:{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.browser"},"react-native":{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.native"},homepage:"https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-s3",repository:{type:"git",url:"https://github.com/aws/aws-sdk-js-v3.git",directory:"clients/client-s3"}};var Zs=U(ws(),1);var eA="AWS_S3_USE_ARN_REGION",lA="s3_use_arn_region",Zh={environmentVariableSelector:(r)=>p(r,eA,u.ENV),configFileSelector:(r)=>p(r,lA,u.CONFIG),default:!1};var Qh=U(IA(),1),{__extends:wd,__assign:Ad,__rest:Sd,__decorate:Rd,__param:dd,__esDecorate:Id,__runInitializers:Ed,__propKey:kd,__setFunctionName:Pd,__metadata:Nd,__awaiter:Gs,__generator:Hs,__exportStar:$d,__createBinding:Dd,__values:Ks,__read:Ud,__spread:Md,__spreadArrays:Td,__spreadArray:yd,__await:Cd,__asyncGenerator:cd,__asyncDelegator:zd,__asyncValues:Gd,__makeTemplateObject:Hd,__importStar:Kd,__importDefault:Ld,__classPrivateFieldGet:Fd,__classPrivateFieldSet:Wd,__classPrivateFieldIn:Xd,__addDisposableResource:Zd,__disposeResources:Qd}=Qh.default;import{Buffer as Vh} from"buffer";var vh=(r,s)=>{if(typeof r!=="string")throw new TypeError(`The "input" argument must be of type string. Received type ${typeof r} (${r})`);return s?Vh.from(r,s):Vh.from(r)};var ge=(r)=>{const s=vh(r,"utf8");return new Uint8Array(s.buffer,s.byteOffset,s.byteLength/Uint8Array.BYTES_PER_ELEMENT)};function Zr(r){if(r instanceof Uint8Array)return r;if(typeof r==="string")return EA(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength/Uint8Array.BYTES_PER_ELEMENT);return new Uint8Array(r)}var EA=typeof Buffer!=="undefined"&&Buffer.from?function(r){return Buffer.from(r,"utf8")}:ge;function Qr(r){if(typeof r==="string")return r.length===0;return r.byteLength===0}function Vr(r){return new Uint8Array([(r&4278190080)>>24,(r&16711680)>>16,(r&65280)>>8,r&255])}function vr(r){if(!Uint32Array.from){var s=new Uint32Array(r.length),f=0;while(f<r.length)s[f]=r[f],f+=1;return s}return Uint32Array.from(r)}var we=function(){function r(){this.crc32=new rr}return r.prototype.update=function(s){if(Qr(s))return;this.crc32.update(Zr(s))},r.prototype.digest=function(){return Gs(this,void 0,void 0,function(){return Hs(this,function(s){return[2,Vr(this.crc32.digest())]})})},r.prototype.reset=function(){this.crc32=new rr},r}();var rr=function(){function r(){this.checksum=4294967295}return r.prototype.update=function(s){var f,e;try{for(var l=Ks(s),a=l.next();!a.done;a=l.next()){var h=a.value;this.checksum=this.checksum>>>8^PA[(this.checksum^h)&255]}}catch(m){f={error:m}}finally{try{if(a&&!a.done&&(e=l.return))e.call(l)}finally{if(f)throw f.error}}return this},r.prototype.digest=function(){return(this.checksum^4294967295)>>>0},r}();var kA=[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,936918000,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117],PA=vr(kA);var o=U(ar(),1);var Yh=U(ar(),1),Jh=function(r){for(let s=0;s<8;s++)r[s]^=255;for(let s=7;s>-1;s--)if(r[s]++,r[s]!==0)break};class kr{constructor(r){if(this.bytes=r,r.byteLength!==8)throw new Error("Int64 buffers must be exactly 8 bytes")}static fromNumber(r){if(r>9223372036854776000||r<-9223372036854776000)throw new Error(`${r} is too large (or, if negative, too small) to represent as an Int64`);const s=new Uint8Array(8);for(let f=7,e=Math.abs(Math.round(r));f>-1&&e>0;f--,e/=256)s[f]=e;if(r<0)Jh(s);return new kr(s)}valueOf(){const r=this.bytes.slice(0),s=r[0]&128;if(s)Jh(r);return parseInt(Yh.toHex(r),16)*(s?-1:1)}toString(){return String(this.valueOf())}}class Ae{constructor(r,s){this.toUtf8=r,this.fromUtf8=s}format(r){const s=[];for(let l of Object.keys(r)){const a=this.fromUtf8(l);s.push(Uint8Array.from([a.byteLength]),a,this.formatHeaderValue(r[l]))}const f=new Uint8Array(s.reduce((l,a)=>l+a.byteLength,0));let e=0;for(let l of s)f.set(l,e),e+=l.byteLength;return f}formatHeaderValue(r){switch(r.type){case"boolean":return Uint8Array.from([r.value?0:1]);case"byte":return Uint8Array.from([2,r.value]);case"short":const s=new DataView(new ArrayBuffer(3));return s.setUint8(0,3),s.setInt16(1,r.value,!1),new Uint8Array(s.buffer);case"integer":const f=new DataView(new ArrayBuffer(5));return f.setUint8(0,4),f.setInt32(1,r.value,!1),new Uint8Array(f.buffer);case"long":const e=new Uint8Array(9);return e[0]=5,e.set(r.value.bytes,1),e;case"binary":const l=new DataView(new ArrayBuffer(3+r.value.byteLength));l.setUint8(0,6),l.setUint16(1,r.value.byteLength,!1);const a=new Uint8Array(l.buffer);return a.set(r.value,3),a;case"string":const h=this.fromUtf8(r.value),m=new DataView(new ArrayBuffer(3+h.byteLength));m.setUint8(0,7),m.setUint16(1,h.byteLength,!1);const g=new Uint8Array(m.buffer);return g.set(h,3),g;case"timestamp":const S=new Uint8Array(9);return S[0]=8,S.set(kr.fromNumber(r.value.valueOf()).bytes,1),S;case"uuid":if(!cA.test(r.value))throw new Error(`Invalid UUID received: ${r.value}`);const d=new Uint8Array(17);return d[0]=9,d.set(o.fromHex(r.value.replace(/\-/g,"")),1),d}}parse(r){const s={};let f=0;while(f<r.byteLength){const e=r.getUint8(f++),l=this.toUtf8(new Uint8Array(r.buffer,r.byteOffset+f,e));switch(f+=e,r.getUint8(f++)){case 0:s[l]={type:Oh,value:!0};break;case 1:s[l]={type:Oh,value:!1};break;case 2:s[l]={type:NA,value:r.getInt8(f++)};break;case 3:s[l]={type:$A,value:r.getInt16(f,!1)},f+=2;break;case 4:s[l]={type:DA,value:r.getInt32(f,!1)},f+=4;break;case 5:s[l]={type:UA,value:new kr(new Uint8Array(r.buffer,r.byteOffset+f,8))},f+=8;break;case 6:const a=r.getUint16(f,!1);f+=2,s[l]={type:MA,value:new Uint8Array(r.buffer,r.byteOffset+f,a)},f+=a;break;case 7:const h=r.getUint16(f,!1);f+=2,s[l]={type:TA,value:this.toUtf8(new Uint8Array(r.buffer,r.byteOffset+f,h))},f+=h;break;case 8:s[l]={type:yA,value:new Date(new kr(new Uint8Array(r.buffer,r.byteOffset+f,8)).valueOf())},f+=8;break;case 9:const m=new Uint8Array(r.buffer,r.byteOffset+f,16);f+=16,s[l]={type:CA,value:`${o.toHex(m.subarray(0,4))}-${o.toHex(m.subarray(4,6))}-${o.toHex(m.subarray(6,8))}-${o.toHex(m.subarray(8,10))}-${o.toHex(m.subarray(10))}`};break;default:throw new Error("Unrecognized header type tag")}}return s}}var Bh;(function(r){r[r.boolTrue=0]="boolTrue",r[r.boolFalse=1]="boolFalse",r[r.byte=2]="byte",r[r.short=3]="short",r[r.integer=4]="integer",r[r.long=5]="long",r[r.byteArray=6]="byteArray",r[r.string=7]="string",r[r.timestamp=8]="timestamp",r[r.uuid=9]="uuid"})(Bh||(Bh={}));var Oh="boolean",NA="byte",$A="short",DA="integer",UA="long",MA="binary",TA="string",yA="timestamp",CA="uuid",cA=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;function qh({byteLength:r,byteOffset:s,buffer:f}){if(r<zA)throw new Error("Provided message too short to accommodate event stream message overhead");const e=new DataView(f,s,r),l=e.getUint32(0,!1);if(r!==l)throw new Error("Reported message length does not match received message length");const a=e.getUint32(_h,!1),h=e.getUint32(n,!1),m=e.getUint32(r-sr,!1),g=new rr().update(new Uint8Array(f,s,n));if(h!==g.digest())throw new Error(`The prelude checksum specified in the message (${h}) does not match the calculated CRC32 checksum (${g.digest()})`);if(g.update(new Uint8Array(f,s+n,r-(n+sr))),m!==g.digest())throw new Error(`The message checksum (${g.digest()}) did not match the expected value of ${m}`);return{headers:new DataView(f,s+n+sr,a),body:new Uint8Array(f,s+n+sr+a,l-a-(n+sr+sr))}}var _h=4,n=_h*2,sr=4,zA=n+sr*2;class Se{constructor(r,s){this.headerMarshaller=new Ae(r,s),this.messageBuffer=[],this.isEndOfStream=!1}feed(r){this.messageBuffer.push(this.decode(r))}endOfStream(){this.isEndOfStream=!0}getMessage(){const r=this.messageBuffer.pop(),s=this.isEndOfStream;return{getMessage(){return r},isEndOfStream(){return s}}}getAvailableMessages(){const r=this.messageBuffer;this.messageBuffer=[];const s=this.isEndOfStream;return{getMessages(){return r},isEndOfStream(){return s}}}encode({headers:r,body:s}){const f=this.headerMarshaller.format(r),e=f.byteLength+s.byteLength+16,l=new Uint8Array(e),a=new DataView(l.buffer,l.byteOffset,l.byteLength),h=new rr;return a.setUint32(0,e,!1),a.setUint32(4,f.byteLength,!1),a.setUint32(8,h.update(l.subarray(0,8)).digest(),!1),l.set(f,12),l.set(s,f.byteLength+12),a.setUint32(e-4,h.update(l.subarray(8,e-4)).digest(),!1),l}decode(r){const{headers:s,body:f}=qh(r);return{headers:this.headerMarshaller.parse(s),body:f}}formatHeaders(r){return this.headerMarshaller.format(r)}}class Re{constructor(r){this.options=r}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let r of this.options.inputStream)yield this.options.decoder.decode(r)}}class de{constructor(r){this.options=r}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let r of this.options.messageStream)yield this.options.encoder.encode(r);if(this.options.includeEndFrame)yield new Uint8Array(0)}}class Ie{constructor(r){this.options=r}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let r of this.options.messageStream){const s=await this.options.deserializer(r);if(s===void 0)continue;yield s}}}class Ee{constructor(r){this.options=r}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let r of this.options.inputStream)yield this.options.serializer(r)}}function jh(r){let s=0,f=0,e=null,l=null;const a=(m)=>{if(typeof m!=="number")throw new Error("Attempted to allocate an event message where size was not a number: "+m);s=m,f=4,e=new Uint8Array(m),new DataView(e.buffer).setUint32(0,m,!1)},h=async function*(){const m=r[Symbol.asyncIterator]();while(!0){const{value:g,done:S}=await m.next();if(S){if(!s)return;else if(s===f)yield e;else throw new Error("Truncated event message received.");return}const d=g.length;let k=0;while(k<d){if(!e){const T=d-k;if(!l)l=new Uint8Array(4);const D=Math.min(4-f,T);if(l.set(g.slice(k,k+D),f),f+=D,k+=D,f<4)break;a(new DataView(l.buffer).getUint32(0,!1)),l=null}const P=Math.min(s-f,d-k);if(e.set(g.slice(k,k+P),f),f+=P,k+=P,s&&s===f)yield e,e=null,s=0,f=0}}};return{[Symbol.asyncIterator]:h}}function ih(r,s){return async function(f){const{value:e}=f.headers[":message-type"];if(e==="error"){const l=new Error(f.headers[":error-message"].value||"UnknownError");throw l.name=f.headers[":error-code"].value,l}else if(e==="exception"){const l=f.headers[":exception-type"].value,a={[l]:f},h=await r(a);if(h.$unknown){const m=new Error(s(f.body));throw m.name=l,m}throw h[l]}else if(e==="event"){const l={[f.headers[":event-type"].value]:f},a=await r(l);if(a.$unknown)return;return a}else throw Error(`Unrecognizable event type: ${f.headers[":event-type"].value}`)}}class Ls{constructor({utf8Encoder:r,utf8Decoder:s}){this.eventStreamCodec=new Se(r,s),this.utfEncoder=r}deserialize(r,s){const f=jh(r);return new Ie({messageStream:new Re({inputStream:f,decoder:this.eventStreamCodec}),deserializer:ih(s,this.utfEncoder)})}serialize(r,s){return new de({messageStream:new Ee({inputStream:r,serializer:s}),encoder:this.eventStreamCodec,includeEndFrame:!0})}}import{Readable as GA} from"stream";async function*bh(r){let s=!1,f=!1;const e=new Array;r.on("error",(l)=>{if(!s)s=!0;if(l)throw l}),r.on("data",(l)=>{e.push(l)}),r.on("end",()=>{s=!0});while(!f){const l=await new Promise((a)=>setTimeout(()=>a(e.shift()),0));if(l)yield l;f=s&&e.length===0}}class ke{constructor({utf8Encoder:r,utf8Decoder:s}){this.universalMarshaller=new Ls({utf8Decoder:s,utf8Encoder:r})}deserialize(r,s){const f=typeof r[Symbol.asyncIterator]==="function"?r:bh(r);return this.universalMarshaller.deserialize(f,s)}serialize(r,s){return GA.from(this.universalMarshaller.serialize(r,s))}}var xh=(r)=>new ke(r);import{Writable as HA} from"stream";class Fs extends HA{constructor(r,s){super(s);this.hash=r}_write(r,s,f){try{this.hash.update(v(r))}catch(e){return f(e)}f()}}var oh=(r,s)=>{if(s.readableFlowing!==null)throw new Error("Unable to calculate hash for flowing readable stream");const f=new r,e=new Fs(f);return s.pipe(e),new Promise((l,a)=>{s.on("error",(h)=>{e.end(),a(h)}),e.on("error",a),e.on("finish",()=>{f.digest().then(l).catch(a)})})};var Ws=U(ws(),1);var sm=U(KA(),1);var fm=(r)=>{return{apiVersion:"2006-03-01",base64Decoder:r?.base64Decoder??nh,base64Encoder:r?.base64Encoder??uh,disableHostPrefix:r?.disableHostPrefix??!1,endpointProvider:r?.endpointProvider??gs,extensions:r?.extensions??[],getAwsChunkedEncodingStream:r?.getAwsChunkedEncodingStream??th,httpAuthSchemeProvider:r?.httpAuthSchemeProvider??Ga,httpAuthSchemes:r?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:(s)=>s.getIdentityProvider("aws.auth#sigv4"),signer:new Ws.AwsSdkSigV4Signer},{schemeId:"aws.auth#sigv4a",identityProvider:(s)=>s.getIdentityProvider("aws.auth#sigv4a"),signer:new Ws.AwsSdkSigV4ASigner}],logger:r?.logger??new Or,sdkStreamMixin:r?.sdkStreamMixin??rm,serviceId:r?.serviceId??"S3",signerConstructor:r?.signerConstructor??lf,signingEscapePath:r?.signingEscapePath??!1,urlParser:r?.urlParser??sm.parseUrl,useArnRegion:r?.useArnRegion??!1,utf8Decoder:r?.utf8Decoder??Cr,utf8Encoder:r?.utf8Encoder??ph}};var Nm=(r)=>{hm(process.version);const s=km(r),f=()=>s().then(am),e=fm(r);return Zs.emitWarningIfUnsupportedVersion(process.version),{...e,...r,runtime:"node",defaultsMode:s,bodyLengthChecker:r?.bodyLengthChecker??Em,credentialDefaultProvider:r?.credentialDefaultProvider??Pm,defaultUserAgentProvider:r?.defaultUserAgentProvider??Im({serviceId:e.serviceId,clientVersion:Xh.version}),disableS3ExpressSessionAuth:r?.disableS3ExpressSessionAuth??i(ts),eventStreamSerdeProvider:r?.eventStreamSerdeProvider??xh,maxAttempts:r?.maxAttempts??i(Rm),md5:r?.md5??Xs.bind(null,"md5"),region:r?.region??i(wm,Am),requestHandler:em.create(r?.requestHandler??f),retryMode:r?.retryMode??i({...dm,default:async()=>(await f()).retryMode||Sm}),sha1:r?.sha1??Xs.bind(null,"sha1"),sha256:r?.sha256??Xs.bind(null,"sha256"),sigv4aSigningRegionSet:r?.sigv4aSigningRegionSet??i(Zs.NODE_SIGV4A_CONFIG_OPTIONS),streamCollector:r?.streamCollector??lm,streamHasher:r?.streamHasher??oh,useArnRegion:r?.useArnRegion??i(Zh),useDualstackEndpoint:r?.useDualstackEndpoint??i(mm),useFipsEndpoint:r?.useFipsEndpoint??i(gm)}};var $m=(r)=>{const s=r.httpAuthSchemes;let{httpAuthSchemeProvider:f,credentials:e}=r;return{setHttpAuthScheme(l){const a=s.findIndex((h)=>h.schemeId===l.schemeId);if(a===-1)s.push(l);else s.splice(a,1,l)},httpAuthSchemes(){return s},setHttpAuthSchemeProvider(l){f=l},httpAuthSchemeProvider(){return f},setCredentials(l){e=l},credentials(){return e}}},Dm=(r)=>{return{httpAuthSchemes:r.httpAuthSchemes(),httpAuthSchemeProvider:r.httpAuthSchemeProvider(),credentials:r.credentials()}};var Qs=(r)=>r,zm=(r,s)=>{const f={...Qs(Cm(r)),...Qs(Tm(r)),...Qs(Um(r)),...Qs($m(r))};return s.forEach((e)=>e.configure(f)),{...r,...cm(f),...ym(f),...Mm(f),...Dm(f)}};class Pe extends Fm{constructor(...[r]){const s=Nm(r||{}),f=Ka(s),e=Wm(f),l=vm(e),a=Zm(l),h=Gm(a),m=Vm(h),g=Ml(m),S=Ha(g),d=kl(S,{session:[()=>this,me]}),k=zm(d,r?.extensions||[]);super(k);this.config=k,this.middlewareStack.use(Xm(this.config)),this.middlewareStack.use(Jm(this.config)),this.middlewareStack.use(Qm(this.config)),this.middlewareStack.use(Hm(this.config)),this.middlewareStack.use(Km(this.config)),this.middlewareStack.use(Lm(this.config)),this.middlewareStack.use(Pr.getHttpAuthSchemeEndpointRuleSetPlugin(this.config,{httpAuthSchemeParametersProvider:Ca,identityProviderConfigProvider:async(P)=>new Pr.DefaultIdentityProviderConfig({"aws.auth#sigv4":P.credentials,"aws.auth#sigv4a":P.credentials})})),this.middlewareStack.use(Pr.getHttpSigningPlugin(this.config)),this.middlewareStack.use(Ul(this.config)),this.middlewareStack.use(ye(this.config)),this.middlewareStack.use(Ge(this.config)),this.middlewareStack.use(rf(this.config)),this.middlewareStack.use(ff(this.config))}destroy(){super.destroy()}}function LA(r){return(s)=>async(f)=>{const e={...f.input},l=[{target:"SSECustomerKey",hash:"SSECustomerKeyMD5"},{target:"CopySourceSSECustomerKey",hash:"CopySourceSSECustomerKeyMD5"}];for(let a of l){const h=e[a.target];if(h){let m;if(typeof h==="string")if(WA(h,r))m=r.base64Decoder(h);else m=r.utf8Decoder(h),e[a.target]=r.base64Encoder(m);else m=ArrayBuffer.isView(h)?new Uint8Array(h.buffer,h.byteOffset,h.byteLength):new Uint8Array(h),e[a.target]=r.base64Encoder(m);const g=new r.md5;g.update(m),e[a.hash]=r.base64Encoder(await g.digest())}}return s({...f,input:e})}}function WA(r,s){if(!/^(?:[A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(r))return!1;try{return s.base64Decoder(r).length===32}catch{return!1}}var FA={name:"ssecMiddleware",step:"initialize",tags:["SSE"],override:!0},Vs=(r)=>({applyToStack:(s)=>{s.add(LA(r),FA)}});var M;(function(r){r.MD5="MD5",r.CRC32="CRC32",r.CRC32C="CRC32C",r.SHA1="SHA1",r.SHA256="SHA256"})(M||(M={}));var Ym;(function(r){r.HEADER="header",r.TRAILER="trailer"})(Ym||(Ym={}));var{MD5:Bm,CRC32:Om}=M;var Jr=[M.CRC32,M.CRC32C,M.SHA1,M.SHA256],_m=[M.CRC32,M.CRC32C,M.SHA1,M.SHA256];var qm=(r,{requestChecksumRequired:s,requestAlgorithmMember:f},e)=>{const l=e?Om:Bm;if(!f||!r[f])return s?l:void 0;const a=r[f];if(!Jr.includes(a))throw new Error(`The checksum algorithm "${a}" is not supported by the client.`+` Select one of ${Jr}.`);return a};var Nr=(r)=>r===M.MD5?"content-md5":`x-amz-checksum-${r.toLowerCase()}`;var jm=(r,s)=>{const f=r.toLowerCase();for(let e of Object.keys(s))if(f===e.toLowerCase())return!0;return!1};var $r=(r)=>r!==void 0&&typeof r!=="string"&&!ArrayBuffer.isView(r)&&!xr(r);var $e=function(){function r(){this.crc32c=new Ne}return r.prototype.update=function(s){if(Qr(s))return;this.crc32c.update(Zr(s))},r.prototype.digest=function(){return Gs(this,void 0,void 0,function(){return Hs(this,function(s){return[2,Vr(this.crc32c.digest())]})})},r.prototype.reset=function(){this.crc32c=new Ne},r}();var Ne=function(){function r(){this.checksum=4294967295}return r.prototype.update=function(s){var f,e;try{for(var l=Ks(s),a=l.next();!a.done;a=l.next()){var h=a.value;this.checksum=this.checksum>>>8^ZA[(this.checksum^h)&255]}}catch(m){f={error:m}}finally{try{if(a&&!a.done&&(e=l.return))e.call(l)}finally{if(f)throw f.error}}return this},r.prototype.digest=function(){return(this.checksum^4294967295)>>>0},r}();var XA=[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],ZA=vr(XA);var vs=(r,s)=>({[M.MD5]:s.md5,[M.CRC32]:we,[M.CRC32C]:$e,[M.SHA1]:s.sha1,[M.SHA256]:s.sha256})[r];var Js=(r,s)=>{const f=new r;return f.update(v(s||"")),f.digest()};var im={name:"flexibleChecksumsMiddleware",step:"build",tags:["BODY_CHECKSUM"],override:!0},bm=(r,s)=>(f,e)=>async(l)=>{if(!F.isInstance(l.request))return f(l);const{request:a}=l,{body:h,headers:m}=a,{base64Encoder:g,streamHasher:S}=r,{input:d,requestChecksumRequired:k,requestAlgorithmMember:P}=s,T=qm(d,{requestChecksumRequired:k,requestAlgorithmMember:P},!!e.isS3ExpressBucket);let D=h,Q=m;if(T){const _=Nr(T),Dr=vs(T,r);if($r(h)){const{getAwsChunkedEncodingStream:Os,bodyLengthChecker:sg}=r;D=Os(h,{base64Encoder:g,bodyLengthChecker:sg,checksumLocationName:_,checksumAlgorithmFn:Dr,streamHasher:S}),Q={...m,"content-encoding":m["content-encoding"]?`${m["content-encoding"]},aws-chunked`:"aws-chunked","transfer-encoding":"chunked","x-amz-decoded-content-length":m["content-length"],"x-amz-content-sha256":"STREAMING-UNSIGNED-PAYLOAD-TRAILER","x-amz-trailer":_},delete Q["content-length"]}else if(!jm(_,m)){const Os=await Js(Dr,h);Q={...m,[_]:g(Os)}}}return await f({...l,request:{...a,headers:Q,body:D}})};var Ys=(r=[])=>{const s=[];for(let f of _m){if(!r.includes(f)||!Jr.includes(f))continue;s.push(f)}return s};var xm=(r)=>{const s=r.lastIndexOf("-");if(s!==-1){const f=r.slice(s+1);if(!f.startsWith("0")){const e=parseInt(f,10);if(!isNaN(e)&&e>=1&&e<=1e4)return!0}}return!1};import{Transform as QA} from"stream";function De(r){const s=new QA;return s.push(r),s.push(null),s}var om=async(r,{streamHasher:s,checksumAlgorithmFn:f,base64Encoder:e})=>{const l=$r(r)?s(f,r):Js(f,r);return e(await l)};var nm=async(r,{config:s,responseAlgorithms:f})=>{const e=Ys(f),{body:l,headers:a}=r;for(let h of e){const m=Nr(h),g=a[m];if(g){const S=vs(h,s),{streamHasher:d,base64Encoder:k}=s,P=await om(l,{streamHasher:d,checksumAlgorithmFn:S,base64Encoder:k});if(P===g)break;throw new Error(`Checksum mismatch: expected "${P}" but received "${g}"`+` in response header "${m}".`)}}};var pm={name:"flexibleChecksumsResponseMiddleware",toMiddleware:"deserializerMiddleware",relation:"after",tags:["BODY_CHECKSUM"],override:!0},um=(r,s)=>(f,e)=>async(l)=>{if(!F.isInstance(l.request))return f(l);const a=l.input,h=await f(l),m=h.response;let g=void 0;const{requestValidationModeMember:S,responseAlgorithms:d}=s;if(S&&a[S]==="ENABLED"){const{clientName:k,commandName:P}=e;if(k==="S3Client"&&P==="GetObjectCommand"&&Ys(d).every((Q)=>{const Br=Nr(Q),_=m.headers[Br];return!_||xm(_)}))return h;const D=$r(m.body);if(D)g=await r.streamCollector(m.body),m.body=De(g);if(await nm(h.response,{config:r,responseAlgorithms:d}),D&&g)m.body=De(g)}return h};var Bs=(r,s)=>({applyToStack:(f)=>{f.add(bm(r,s),im),f.addRelativeTo(um(r,s),pm)}});class Ue extends dr.classBuilder().ep({...wr,Bucket:{type:"contextParams",name:"Bucket"},Key:{type:"contextParams",name:"Key"}}).m(function(r,s,f,e){return[Ir(f,this.serialize,this.deserialize),Er(f,r.getEndpointParameterInstructions()),Bs(f,{input:this.input,requestChecksumRequired:!1,requestValidationModeMember:"ChecksumMode",responseAlgorithms:["CRC32","CRC32C","SHA256","SHA1"]}),Vs(f),He(f)]}).s("AmazonS3","GetObject",{}).n("S3Client","GetObjectCommand").f(Xa,Wa).ser(pa).de(rh).build(){}class Me extends dr.classBuilder().ep({...wr,Bucket:{type:"contextParams",name:"Bucket"},Key:{type:"contextParams",name:"Key"}}).m(function(r,s,f,e){return[Ir(f,this.serialize,this.deserialize),Er(f,r.getEndpointParameterInstructions()),Bs(f,{input:this.input,requestAlgorithmMember:"ChecksumAlgorithm",requestChecksumRequired:!1}),Ce(f),rs(f),Vs(f)]}).s("AmazonS3","PutObject",{}).n("S3Client","PutObjectCommand").f(Va,Qa).ser(ua).de(sh).build(){}import{Buffer as tm} from"buffer";var rg=new Pe;class Yr{static folder(r){if(!r||r.includes("null")||r.includes("undefined"))throw new Error("Folder path has to be specified.");return{put:async(s)=>{let f;if(s instanceof Blob)return f=`${Te()}.${s.type.split("/")[1]}`,Yr.put({body:s,name:`${r}/${f}`});return Yr.put({...s,name:`${r}/${f}`})},fetch:async(s)=>{let f=process.env.BUCKET_NAME,e;if(typeof s==="string")e=s;else f=s.bucket??f,e=s.name;if(!e)throw new Error("Object name has to be specified");return Yr.fetch({...s,name:`${r}/${e}`})}}}static async put(r){let s,f,e,l=process.env.BUCKET_NAME;if(r instanceof Blob)s=r,e=`${Te()}.${r.type.split("/")[1]}`,f=r.type;else s=r.body,e=r.name,f=r.contentType;f=s instanceof Blob||s instanceof File?s.type:void 0;const a=s instanceof tm?s:tm.from(await s.arrayBuffer());return await rg.send(new Me({Bucket:l,Key:e,Body:a,ContentType:f})),e}static async fetch(r){let s=process.env.BUCKET_NAME,f;if(typeof r==="string")f=r;else s=r.bucket??s,f=r.name;if(!f)throw new Error("Object name has to be specified");const e=await rg.send(new Ue({Bucket:s,Key:f}));return new Response(e.Body.transformToWebStream(),{headers:{"Content-Type":e.ContentType,"Content-Length":e.ContentLength.toString(),"Cache-Control":"private, max-age=12000, must-revalidate","Last-Modified":e.LastModified?.toUTCString()||"",ETag:e.ETag||""}})}static delete(){}}export{Yr as Storage};
|