manage-storage 0.0.3 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -4,16 +4,16 @@
4
4
 
5
5
  # Cloud Storage Manager
6
6
 
7
- Universal cloud storage manager supporting AWS S3, Cloudflare R2, and Backblaze B2 with automatic provider detection. Built on the lightweight [@aws-lite](https://aws-lite.org/) SDK for optimal performance in serverless environments.
7
+ Universal cloud storage manager supporting Amazon S3, Cloudflare R2, and Backblaze B2 with automatic provider detection. Built on the official AWS SDK v3 with optimized configuration for multi-cloud compatibility.
8
8
 
9
9
  ## Features
10
10
 
11
- - **Multi-Cloud Support**: Works seamlessly with AWS S3, Cloudflare R2, and Backblaze B2
11
+ - **Multi-Cloud Support**: Works seamlessly with Amazon S3, Cloudflare R2, and Backblaze B2
12
12
  - **Auto-Detection**: Automatically detects the configured provider from environment variables
13
- - **Lightweight**: Built on aws-lite (not the bloated AWS SDK) for faster cold starts
13
+ - **Modern SDK**: Built on AWS SDK v3 with command pattern for optimal performance
14
14
  - **Simple API**: Single function interface for all storage operations
15
15
  - **No File System**: Returns data directly - perfect for serverless/edge environments
16
- - **TypeScript Ready**: Full type support with comprehensive type definitions
16
+ - **Minified**: Terser minification for smaller bundle sizes
17
17
 
18
18
  ## Installation
19
19
 
@@ -44,6 +44,18 @@ const data = await manageStorage("download", {
44
44
  // List all files
45
45
  const files = await manageStorage("list");
46
46
 
47
+ // Copy a file
48
+ await manageStorage("copy", {
49
+ key: "documents/report.pdf",
50
+ destinationKey: "documents/report-backup.pdf",
51
+ });
52
+
53
+ // Rename a file (copy + delete)
54
+ await manageStorage("rename", {
55
+ key: "documents/old-name.pdf",
56
+ destinationKey: "documents/new-name.pdf",
57
+ });
58
+
47
59
  // Delete a file
48
60
  await manageStorage("delete", {
49
61
  key: "documents/report.pdf",
@@ -57,29 +69,29 @@ Set environment variables for your preferred provider. The library will automati
57
69
  ### Cloudflare R2
58
70
 
59
71
  ```env
60
- R2_BUCKET_NAME=my-bucket
61
- R2_ACCESS_KEY_ID=your-access-key-id
62
- R2_SECRET_ACCESS_KEY=your-secret-access-key
63
- R2_BUCKET_URL=https://your-account-id.r2.cloudflarestorage.com
72
+ CLOUDFLARE_BUCKET_NAME=my-bucket
73
+ CLOUDFLARE_ACCESS_KEY_ID=your-access-key-id
74
+ CLOUDFLARE_SECRET_ACCESS_KEY=your-secret-access-key
75
+ CLOUDFLARE_BUCKET_URL=https://your-account-id.r2.cloudflarestorage.com
64
76
  ```
65
77
 
66
78
  ### Backblaze B2
67
79
 
68
80
  ```env
69
- B2_BUCKET_NAME=my-bucket
70
- B2_ACCESS_KEY_ID=your-key-id
71
- B2_SECRET_ACCESS_KEY=your-application-key
72
- B2_BUCKET_URL=https://s3.us-west-004.backblazeb2.com
81
+ BACKBLAZE_BUCKET_NAME=my-bucket
82
+ BACKBLAZE_ACCESS_KEY_ID=your-key-id
83
+ BACKBLAZE_SECRET_ACCESS_KEY=your-application-key
84
+ BACKBLAZE_BUCKET_URL=https://s3.us-west-004.backblazeb2.com
73
85
  ```
74
86
 
75
- ### AWS S3
87
+ ### Amazon S3
76
88
 
77
89
  ```env
78
- S3_BUCKET_NAME=my-bucket
79
- S3_ACCESS_KEY_ID=your-access-key-id
80
- S3_SECRET_ACCESS_KEY=your-secret-access-key
81
- S3_BUCKET_URL=https://s3.amazonaws.com
82
- S3_REGION=us-east-1
90
+ AMAZON_BUCKET_NAME=my-bucket
91
+ AMAZON_ACCESS_KEY_ID=your-access-key-id
92
+ AMAZON_SECRET_ACCESS_KEY=your-secret-access-key
93
+ AMAZON_BUCKET_URL=https://s3.amazonaws.com
94
+ AMAZON_REGION=us-east-1
83
95
  ```
84
96
 
85
97
  ## API Reference
@@ -90,16 +102,17 @@ Performs storage operations on your configured cloud provider.
90
102
 
91
103
  #### Parameters
92
104
 
93
- - **action** `string` - The operation to perform: `'upload'`, `'download'`, `'delete'`, `'list'`, or `'deleteAll'`
105
+ - **action** `string` - The operation to perform: `'upload'`, `'download'`, `'delete'`, `'list'`, `'deleteAll'`, `'copy'`, or `'rename'`
94
106
  - **options** `object` - Operation-specific options
95
107
 
96
108
  #### Options
97
109
 
98
- | Option | Type | Required | Description |
99
- | ---------- | ------------------------ | ----------------------------------- | ---------------------------------------------------- |
100
- | `key` | `string` | Yes (except for `list`/`deleteAll`) | The object key/path |
101
- | `body` | `string\|Buffer\|Stream` | Yes (for `upload`) | The file content to upload |
102
- | `provider` | `'s3'\|'r2'\|'b2'` | No | Force a specific provider (auto-detected if omitted) |
110
+ | Option | Type | Required | Description |
111
+ | ---------------- | ----------------------------------- | ----------------------------------- | ---------------------------------------------------- |
112
+ | `key` | `string` | Yes (except for `list`/`deleteAll`) | The object key/path |
113
+ | `destinationKey` | `string` | Yes (for `copy`/`rename`) | The destination key/path for copy/rename operations |
114
+ | `body` | `string\|Buffer\|Stream` | Yes (for `upload`) | The file content to upload |
115
+ | `provider` | `'amazon'\|'cloudflare'\|'backblaze'` | No | Force a specific provider (auto-detected if omitted) |
103
116
 
104
117
  ## Usage Examples
105
118
 
@@ -156,7 +169,39 @@ const notes = files.filter((key) => key.startsWith("notes/"));
156
169
  console.log(notes); // ['notes/memo.txt']
157
170
  ```
158
171
 
159
- ### 4. Delete Files
172
+ ### 4. Copy Files
173
+
174
+ ```javascript
175
+ // Copy a file to a new location
176
+ await manageStorage("copy", {
177
+ key: "documents/report.pdf",
178
+ destinationKey: "documents/backup/report-2024.pdf",
179
+ });
180
+
181
+ // Create a backup
182
+ await manageStorage("copy", {
183
+ key: "config/settings.json",
184
+ destinationKey: "config/settings.backup.json",
185
+ });
186
+ ```
187
+
188
+ ### 5. Rename Files
189
+
190
+ ```javascript
191
+ // Rename a file (performs copy + delete)
192
+ await manageStorage("rename", {
193
+ key: "old-filename.txt",
194
+ destinationKey: "new-filename.txt",
195
+ });
196
+
197
+ // Move to a different folder
198
+ await manageStorage("rename", {
199
+ key: "temp/draft.md",
200
+ destinationKey: "published/article.md",
201
+ });
202
+ ```
203
+
204
+ ### 6. Delete Files
160
205
 
161
206
  ```javascript
162
207
  // Delete a single file
@@ -169,32 +214,32 @@ const result = await manageStorage("deleteAll");
169
214
  console.log(`Deleted ${result.count} files`);
170
215
  ```
171
216
 
172
- ### 5. Force a Specific Provider
217
+ ### 7. Force a Specific Provider
173
218
 
174
219
  ```javascript
175
- // Use R2 even if other providers are configured
220
+ // Use Cloudflare R2 even if other providers are configured
176
221
  await manageStorage("upload", {
177
222
  key: "test.txt",
178
- body: "Hello R2!",
179
- provider: "r2",
223
+ body: "Hello Cloudflare!",
224
+ provider: "cloudflare",
180
225
  });
181
226
 
182
- // Use B2 specifically
227
+ // Use Backblaze B2 specifically
183
228
  await manageStorage("upload", {
184
229
  key: "test.txt",
185
- body: "Hello B2!",
186
- provider: "b2",
230
+ body: "Hello Backblaze!",
231
+ provider: "backblaze",
187
232
  });
188
233
  ```
189
234
 
190
- ### 6. Runtime Configuration (Override Environment Variables)
235
+ ### 8. Runtime Configuration (Override Environment Variables)
191
236
 
192
237
  ```javascript
193
238
  // Pass credentials at runtime instead of using env vars
194
239
  await manageStorage("upload", {
195
240
  key: "secure/data.json",
196
241
  body: JSON.stringify({ secret: "value" }),
197
- provider: "r2",
242
+ provider: "cloudflare",
198
243
  BUCKET_NAME: "my-custom-bucket",
199
244
  ACCESS_KEY_ID: "runtime-key-id",
200
245
  SECRET_ACCESS_KEY: "runtime-secret",
@@ -242,7 +287,7 @@ export async function GET(req) {
242
287
 
243
288
  ```javascript
244
289
  import express from "express";
245
- import { manageStorage } from "@opensourceagi/cloud-storage";
290
+ import { manageStorage } from "manage-storage";
246
291
 
247
292
  const app = express();
248
293
  app.use(express.json());
@@ -290,7 +335,7 @@ app.listen(3000, () => console.log("Server running on port 3000"));
290
335
  ### Cloudflare Workers
291
336
 
292
337
  ```javascript
293
- import { manageStorage } from "@opensourceagi/cloud-storage";
338
+ import { manageStorage } from "manage-storage";
294
339
 
295
340
  export default {
296
341
  async fetch(request, env) {
@@ -302,11 +347,11 @@ export default {
302
347
  const result = await manageStorage("upload", {
303
348
  key,
304
349
  body: content,
305
- provider: "r2",
306
- BUCKET_NAME: env.R2_BUCKET_NAME,
307
- ACCESS_KEY_ID: env.R2_ACCESS_KEY_ID,
308
- SECRET_ACCESS_KEY: env.R2_SECRET_ACCESS_KEY,
309
- BUCKET_URL: env.R2_BUCKET_URL,
350
+ provider: "cloudflare",
351
+ BUCKET_NAME: env.CLOUDFLARE_BUCKET_NAME,
352
+ ACCESS_KEY_ID: env.CLOUDFLARE_ACCESS_KEY_ID,
353
+ SECRET_ACCESS_KEY: env.CLOUDFLARE_SECRET_ACCESS_KEY,
354
+ BUCKET_URL: env.CLOUDFLARE_BUCKET_URL,
310
355
  });
311
356
 
312
357
  return Response.json(result);
@@ -383,21 +428,38 @@ const contents = await Promise.all(
383
428
  }
384
429
  ```
385
430
 
386
- ## Why aws-lite?
431
+ ### Copy
387
432
 
388
- This library uses [@aws-lite](https://aws-lite.org/) instead of the official AWS SDK because:
433
+ ```javascript
434
+ {
435
+ success: true,
436
+ sourceKey: 'documents/report.pdf',
437
+ destinationKey: 'documents/backup/report-2024.pdf'
438
+ }
439
+ ```
440
+
441
+ ### Rename
442
+
443
+ ```javascript
444
+ {
445
+ success: true,
446
+ oldKey: 'old-filename.txt',
447
+ newKey: 'new-filename.txt'
448
+ }
449
+ ```
389
450
 
390
- - **10-100x smaller**: Significantly reduced bundle size
391
- - **Faster cold starts**: Critical for serverless/edge functions
392
- - **S3-compatible**: Works with S3, R2, B2, and any S3-compatible service
393
- - **Modern API**: Clean, promise-based interface
394
- - **No dependencies overhead**: Minimal dependency tree
451
+ ## Why AWS SDK v3?
395
452
 
396
- # Cloud Object Storage Comparison: GCS, Backblaze B2, Cloudflare R2, and AWS S3
453
+ This library uses the official [@aws-sdk/client-s3](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/s3/) because:
397
454
 
398
- Google Cloud Storage (GCS) joins Backblaze B2, Cloudflare R2, and AWS S3 as a hyperscaler option with [strong multi-region support](https://cloud.google.com/storage/pricing), multiple storage classes, and [deep integration with Google Cloud services](https://cloud.google.com/storage/pricing). These providers all [offer S3-compatible object storage](https://www.backblaze.com/cloud-storage/pricing) but differ significantly in [pricing models](https://www.backblaze.com/cloud-storage/pricing), especially storage costs, egress fees, and ecosystem fit.
455
+ - **Modern Architecture**: Modular SDK with tree-shakable imports
456
+ - **Command Pattern**: Clean, consistent API design
457
+ - **S3-Compatible**: Works with S3, R2, B2, and any S3-compatible service
458
+ - **Official Support**: Direct support from AWS with regular updates
459
+ - **Production Ready**: Battle-tested in enterprise environments
460
+ - **Minified Output**: Terser minification reduces bundle size
399
461
 
400
- ## Updated pricing snapshot ("hot"/Standard storage)
462
+ # Cloud Object Storage Comparison
401
463
 
402
464
  | Service | Storage price (/TB-month) | Egress to internet | API ops (Class A/B per 1K, approx) | Minimum duration | Notes |
403
465
  | --------------------------------------------------------------- | ------------------------------ | ----------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ----------------------------------------------------------- | ------------------------------------------------------------------ |
@@ -0,0 +1 @@
1
+ import{t as e,f as t}from"./manage-storage-B0amn6is.js";class r{marshaller;serializer;deserializer;serdeContext;defaultContentType;constructor({marshaller:e,serializer:t,deserializer:r,serdeContext:i,defaultContentType:s}){this.marshaller=e,this.serializer=t,this.deserializer=r,this.serdeContext=i,this.defaultContentType=s}async serializeEventStream({eventStream:e,requestSchema:t,initialRequest:r}){const i=this.marshaller,s=t.getEventStreamMember(),n=t.getMemberSchema(s),a=this.serializer,o=this.defaultContentType,l=/* @__PURE__ */Symbol("initialRequestMarker"),c={async*[Symbol.asyncIterator](){if(r){const e={":event-type":{type:"string",value:"initial-request"},":message-type":{type:"string",value:"event"},":content-type":{type:"string",value:o}};a.write(t,r);const i=a.flush();yield{[l]:!0,headers:e,body:i}}for await(const t of e)yield t}};return i.serialize(c,e=>{if(e[l])return{headers:e.headers,body:e.body};const t=Object.keys(e).find(e=>"__type"!==e)??"",{additionalHeaders:r,body:i,eventType:s,explicitPayloadContentType:a}=this.writeEventBody(t,n,e);return{headers:{":event-type":{type:"string",value:s},":message-type":{type:"string",value:"event"},":content-type":{type:"string",value:a??o},...r},body:i}})}async deserializeEventStream({response:t,responseSchema:r,initialResponseContainer:i}){const s=this.marshaller,n=r.getEventStreamMember(),a=r.getMemberSchema(n).getMemberSchemas(),o=/* @__PURE__ */Symbol("initialResponseMarker"),l=s.deserialize(t.body,async t=>{const i=Object.keys(t).find(e=>"__type"!==e)??"",s=t[i].body;if("initial-response"===i){const e=await this.deserializer.read(r,s);return delete e[n],{[o]:!0,...e}}if(i in a){const r=a[i];if(r.isStructSchema()){const n={};let a=!1;for(const[o,l]of r.structIterator()){const{eventHeader:r,eventPayload:c}=l.getMergedTraits();if(a=a||Boolean(r||c),c)l.isBlobSchema()?n[o]=s:l.isStringSchema()?n[o]=(this.serdeContext?.utf8Encoder??e)(s):l.isStructSchema()&&(n[o]=await this.deserializer.read(l,s));else if(r){const e=t[i].headers[o]?.value;null!=e&&(l.isNumericSchema()?n[o]=e&&"object"==typeof e&&"bytes"in e?BigInt(e.toString()):Number(e):n[o]=e)}}if(a)return{[i]:n}}return{[i]:await this.deserializer.read(r,s)}}return{$unknown:t}}),c=l[Symbol.asyncIterator](),d=await c.next();if(d.done)return l;if(d.value?.[o]){if(!r)throw new Error("@smithy::core/protocols - initial-response event encountered in event stream but no response schema given.");for(const[e,t]of Object.entries(d.value))i[e]=t}return{async*[Symbol.asyncIterator](){for(d?.value?.[o]||(yield d.value);;){const{done:e,value:t}=await c.next();if(e)break;yield t}}}}writeEventBody(e,r,i){const s=this.serializer;let n,a=e,o=null;const l={};if(r.getSchema()[4].includes(e)){const t=r.getMemberSchema(e);if(!t.isStructSchema())throw new Error("@smithy/core/event-streams - non-struct member not supported in event stream union.");for(const[r,s]of t.structIterator()){const{eventHeader:t,eventPayload:n}=s.getMergedTraits();if(n)o=r;else if(t){const t=i[e][r];let n="binary";s.isNumericSchema()?n=(-2)**31<=t&&t<=2**31-1?"integer":"long":s.isTimestampSchema()?n="timestamp":s.isStringSchema()?n="string":s.isBooleanSchema()&&(n="boolean"),null!=t&&(l[r]={type:n,value:t},delete i[e][r])}}if(null!==o){const r=t.getMemberSchema(o);r.isBlobSchema()?n="application/octet-stream":r.isStringSchema()&&(n="text/plain"),s.write(r,i[e][o])}else s.write(t,i[e])}else{const[t,r]=i[e];a=t,s.write(15,r)}const c=s.flush();return{body:"string"==typeof c?(this.serdeContext?.utf8Decoder??t)(c):c,eventType:a,explicitPayloadContentType:n,additionalHeaders:l}}}export{r as EventStreamSerde};
@@ -0,0 +1 @@
1
+ import{config as e}from"dotenv";var t,r,n,s;(r=t||(t={})).HTTP="http",r.HTTPS="https",(s=n||(n={})).MD5="md5",s.CRC32="crc32",s.CRC32C="crc32c",s.SHA1="sha1",s.SHA256="sha256";const i="__smithy_context";class o{method;protocol;hostname;port;path;query;headers;username;password;fragment;body;constructor(e){this.method=e.method||"GET",this.hostname=e.hostname||"localhost",this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?":"!==e.protocol.slice(-1)?`${e.protocol}:`:e.protocol:"https:",this.path=e.path?"/"!==e.path.charAt(0)?`/${e.path}`:e.path:"/",this.username=e.username,this.password=e.password,this.fragment=e.fragment}static clone(e){const t=new o({...e,headers:{...e.headers}});var r;return t.query&&(t.query=(r=t.query,Object.keys(r).reduce((e,t)=>{const n=r[t];return{...e,[t]:Array.isArray(n)?[...n]:n}},{}))),t}static isInstance(e){if(!e)return!1;const t=e;return"method"in t&&"protocol"in t&&"hostname"in t&&"path"in t&&"object"==typeof t.query&&"object"==typeof t.headers}clone(){return o.clone(this)}}class a{statusCode;reason;headers;body;constructor(e){this.statusCode=e.statusCode,this.reason=e.reason,this.headers=e.headers||{},this.body=e.body}static isInstance(e){if(!e)return!1;const t=e;return"number"==typeof t.statusCode&&"object"==typeof t.headers}}const c={step:"build",tags:["SET_EXPECT_HEADER","EXPECT_HEADER"],name:"addExpectContinueMiddleware",override:!0},u=e=>({applyToStack:t=>{t.add(function(e){return t=>async r=>{const{request:n}=r;if(!1!==e.expectContinueHeader&&o.isInstance(n)&&n.body&&"node"===e.runtime&&"FetchHttpHandler"!==e.requestHandler?.constructor?.name){let t=!0;if("number"==typeof e.expectContinueHeader)try{t=(Number(n.headers?.["content-length"])??e.bodyLengthChecker?.(n.body)??1/0)>=e.expectContinueHeader}catch(s){}else t=!!e.expectContinueHeader;t&&(n.headers.Expect="100-continue")}return t({...r,request:n})}}(e),c)}}),d="WHEN_SUPPORTED",l="WHEN_REQUIRED",h=d,p="WHEN_SUPPORTED",f="WHEN_REQUIRED",m=d;var g,y,w,b;(y=g||(g={})).MD5="MD5",y.CRC32="CRC32",y.CRC32C="CRC32C",y.CRC64NVME="CRC64NVME",y.SHA1="SHA1",y.SHA256="SHA256",(b=w||(w={})).HEADER="header",b.TRAILER="trailer";const S=g.CRC32;function v(e,t,r){e.__aws_sdk_context?e.__aws_sdk_context.features||(e.__aws_sdk_context.features={}):e.__aws_sdk_context={features:{}},e.__aws_sdk_context.features[t]=r}const E=e=>a.isInstance(e)?e.headers?.date??e.headers?.Date:void 0,C=e=>new Date(Date.now()+e),x=(e,t)=>{const r=Date.parse(e);return((e,t)=>Math.abs(C(t).getTime()-e)>=3e5)(r,t)?r-Date.now():t},A=(e,t)=>{if(!t)throw new Error(`Property \`${e}\` is not resolved for AWS SDK SigV4Auth`);return t},R=async e=>{const t=A("context",e.context),r=A("config",e.config),n=t.endpointV2?.properties?.authSchemes?.[0],s=A("signer",r.signer),i=await s(n),o=e?.signingRegion,a=e?.signingRegionSet,c=e?.signingName;return{config:r,signer:i,signingRegion:o,signingRegionSet:a,signingName:c}};class k{async sign(e,t,r){if(!o.isInstance(e))throw new Error("The request is not an instance of `HttpRequest` and cannot be signed");const n=await R(r),{config:s,signer:i}=n;let{signingRegion:a,signingName:c}=n;const u=r.context;if(u?.authSchemes?.length){const[e,t]=u.authSchemes;"sigv4a"===e?.name&&"sigv4"===t?.name&&(a=t?.signingRegion??a,c=t?.signingName??c)}return await i.sign(e,{signingDate:C(s.systemClockOffset),signingRegion:a,signingService:c})}errorHandler(e){return t=>{const r=t.ServerTime??E(t.$response);if(r){const n=A("config",e.config),s=n.systemClockOffset;n.systemClockOffset=x(r,n.systemClockOffset);n.systemClockOffset!==s&&t.$metadata&&(t.$metadata.clockSkewCorrected=!0)}throw t}}successHandler(e,t){const r=E(e);if(r){const e=A("config",t.config);e.systemClockOffset=x(r,e.systemClockOffset)}}}class T extends k{async sign(e,t,r){if(!o.isInstance(e))throw new Error("The request is not an instance of `HttpRequest` and cannot be signed");const{config:n,signer:s,signingRegion:i,signingRegionSet:a,signingName:c}=await R(r),u=(await(n.sigv4aSigningRegionSet?.())??a??[i]).join(",");return await s.sign(e,{signingDate:C(n.systemClockOffset),signingRegion:u,signingService:c})}}const P=e=>e[i]||(e[i]={}),I=e=>{if("function"==typeof e)return e;const t=Promise.resolve(e);return()=>t};const M=(e,t)=>(r,n)=>async s=>{const i=((e,t)=>{if(!t||0===t.length)return e;const r=[];for(const n of t)for(const t of e)t.schemeId.split("#")[1]===n&&r.push(t);for(const n of e)r.find(({schemeId:e})=>e===n.schemeId)||r.push(n);return r})(e.httpAuthSchemeProvider(await t.httpAuthSchemeParametersProvider(e,n,s.input)),e.authSchemePreference?await e.authSchemePreference():[]),o=function(e){const t=/* @__PURE__ */new Map;for(const r of e)t.set(r.schemeId,r);return t}(e.httpAuthSchemes),a=P(n),c=[];for(const r of i){const s=o.get(r.schemeId);if(!s){c.push(`HttpAuthScheme \`${r.schemeId}\` was not enabled for this service.`);continue}const i=s.identityProvider(await t.identityProviderConfigProvider(e));if(!i){c.push(`HttpAuthScheme \`${r.schemeId}\` did not have an IdentityProvider configured.`);continue}const{identityProperties:u={},signingProperties:d={}}=r.propertiesExtractor?.(e,n)||{};r.identityProperties=Object.assign(r.identityProperties||{},u),r.signingProperties=Object.assign(r.signingProperties||{},d),a.selectedHttpAuthScheme={httpAuthOption:r,identity:await i(r.identityProperties),signer:s.signer};break}if(!a.selectedHttpAuthScheme)throw new Error(c.join("\n"));return r(s)},O={step:"serialize",tags:["HTTP_AUTH_SCHEME"],name:"httpAuthSchemeMiddleware",override:!0,relation:"before",toMiddleware:"endpointV2Middleware"},U=e=>e=>{throw e},N=(e,t)=>{},$={step:"finalizeRequest",tags:["HTTP_SIGNING"],name:"httpSigningMiddleware",aliases:["apiKeyMiddleware","tokenMiddleware","awsAuthMiddleware"],override:!0,relation:"after",toMiddleware:"retryMiddleware"},D=e=>({applyToStack:e=>{e.addRelativeTo((e,t)=>async r=>{if(!o.isInstance(r.request))return e(r);const n=P(t).selectedHttpAuthScheme;if(!n)throw new Error("No HttpAuthScheme was selected: unable to sign request");const{httpAuthOption:{signingProperties:s={}},identity:i,signer:a}=n,c=await e({...r,request:await a.sign(r.request,i,s)}).catch((a.errorHandler||U)(s));return(a.successHandler||N)(c.response,s),c},$)}}),L=e=>{if("function"==typeof e)return e;const t=Promise.resolve(e);return()=>t},_="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",B=Object.entries(_).reduce((e,[t,r])=>(e[r]=Number(t),e),{}),z=_.split(""),j=e=>{let t=e.length/4*3;"=="===e.slice(-2)?t-=2:"="===e.slice(-1)&&t--;const r=new ArrayBuffer(t),n=new DataView(r);for(let s=0;s<e.length;s+=4){let t=0,r=0;for(let n=s,a=s+3;n<=a;n++)if("="!==e[n]){if(!(e[n]in B))throw new TypeError(`Invalid character ${e[n]} in base64 string.`);t|=B[e[n]]<<6*(a-n),r+=6}else t>>=6;const i=s/4*3;t>>=r%8;const o=Math.floor(r/8);for(let e=0;e<o;e++){const r=8*(o-e-1);n.setUint8(i+e,(t&255<<r)>>r)}}return new Uint8Array(r)},H=e=>(new TextEncoder).encode(e),q=e=>"string"==typeof e?H(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e),F=e=>{if("string"==typeof e)return e;if("object"!=typeof e||"number"!=typeof e.byteOffset||"number"!=typeof e.byteLength)throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.");return new TextDecoder("utf-8").decode(e)};function K(e){let t;t="string"==typeof e?H(e):e;const r="object"==typeof t&&"number"==typeof t.length,n="object"==typeof t&&"number"==typeof t.byteOffset&&"number"==typeof t.byteLength;if(!r&&!n)throw new Error("@smithy/util-base64: toBase64 encoder function only accepts string | Uint8Array.");let s="";for(let i=0;i<t.length;i+=3){let e=0,r=0;for(let s=i,o=Math.min(i+3,t.length);s<o;s++)e|=t[s]<<8*(o-s-1),r+=8;const n=Math.ceil(r/6);e<<=6*n-r;for(let t=1;t<=n;t++){const r=6*(n-t);s+=z[(e&63<<r)>>r]}s+="==".slice(0,4-n)}return s}class V extends Uint8Array{static fromString(e,t="utf-8"){if("string"==typeof e)return"base64"===t?V.mutate(j(e)):V.mutate(H(e));throw new Error(`Unsupported conversion from ${typeof e} to Uint8ArrayBlobAdapter.`)}static mutate(e){return Object.setPrototypeOf(e,V.prototype),e}transformToString(e="utf-8"){return"base64"===e?K(this):F(this)}}const W="function"==typeof ReadableStream?ReadableStream:function(){};class Z extends W{}const G=e=>"function"==typeof ReadableStream&&(e?.constructor?.name===ReadableStream.name||e instanceof ReadableStream),X=({expectedChecksum:e,checksum:t,source:r,checksumSourceLocation:n,base64Encoder:s})=>{if(!G(r))throw new Error(`@smithy/util-stream: unsupported source type ${r?.constructor?.name??r} in ChecksumStream.`);const i=s??K;if("function"!=typeof TransformStream)throw new Error("@smithy/util-stream: unable to instantiate ChecksumStream because API unavailable: ReadableStream/TransformStream.");const o=new TransformStream({start(){},async transform(e,r){t.update(e),r.enqueue(e)},async flush(r){const s=await t.digest(),o=i(s);if(e!==o){const t=new Error(`Checksum mismatch: expected "${e}" but received "${o}" in response header "${n}".`);r.error(t)}else r.terminate()}});r.pipeThrough(o);const a=o.readable;return Object.setPrototypeOf(a,Z.prototype),a};class Y{allocByteArray;byteLength=0;byteArrays=[];constructor(e){this.allocByteArray=e}push(e){this.byteArrays.push(e),this.byteLength+=e.byteLength}flush(){if(1===this.byteArrays.length){const e=this.byteArrays[0];return this.reset(),e}const e=this.allocByteArray(this.byteLength);let t=0;for(let r=0;r<this.byteArrays.length;++r){const n=this.byteArrays[r];e.set(n,t),t+=n.byteLength}return this.reset(),e}reset(){this.byteArrays=[],this.byteLength=0}}const J=function(e,t,r){const n=e.getReader();let s=!1,i=0;const o=["",new Y(e=>new Uint8Array(e))];let a=-1;const c=async e=>{const{value:u,done:d}=await n.read(),l=u;if(d){if(-1!==a){const t=Q(o,a);ee(t)>0&&e.enqueue(t)}e.close()}else{const n=function(e,t=!0){if(t&&"undefined"!=typeof Buffer&&e instanceof Buffer)return 2;if(e instanceof Uint8Array)return 1;if("string"==typeof e)return 0;return-1}(l,!1);if(a!==n&&(a>=0&&e.enqueue(Q(o,a)),a=n),-1===a)return void e.enqueue(l);const u=ee(l);i+=u;const d=ee(o[a]);if(u>=t&&0===d)e.enqueue(l);else{const n=function(e,t,r){switch(t){case 0:return e[0]+=r,ee(e[0]);case 1:case 2:return e[t].push(r),ee(e[t])}}(o,a,l);!s&&i>2*t&&(s=!0,r?.warn(`@smithy/util-stream - stream chunk size ${u} is below threshold of ${t}, automatically buffering.`)),n>=t?e.enqueue(Q(o,a)):await c(e)}}};return new ReadableStream({pull:c})};function Q(e,t){switch(t){case 0:const r=e[0];return e[0]="",r;case 1:case 2:return e[t].flush()}throw new Error(`@smithy/util-stream - invalid index ${t} given to flush()`)}function ee(e){return e?.byteLength??e?.length??0}const te=(e,t)=>{const{base64Encoder:r,bodyLengthChecker:n,checksumAlgorithmFn:s,checksumLocationName:i,streamHasher:o}=t,a=void 0!==r&&void 0!==n&&void 0!==s&&void 0!==i&&void 0!==o,c=a?o(s,e):void 0,u=e.getReader();return new ReadableStream({async pull(e){const{value:t,done:s}=await u.read();if(s){if(e.enqueue("0\r\n"),a){const t=r(await c);e.enqueue(`${i}:${t}\r\n`),e.enqueue("\r\n")}e.close()}else e.enqueue(`${(n(t)||0).toString(16)}\r\n${t}\r\n`)}})};const re=e=>encodeURIComponent(e).replace(/[!'()*]/g,ne),ne=e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`;function se(e,t){return new Request(e,t)}function ie(e=0){return new Promise((t,r)=>{e&&setTimeout(()=>{const t=new Error(`Request did not complete within ${e} ms`);t.name="TimeoutError",r(t)},e)})}const oe={supported:void 0};class ae{config;configProvider;static create(e){return"function"==typeof e?.handle?e:new ae(e)}constructor(e){"function"==typeof e?this.configProvider=e().then(e=>e||{}):(this.config=e??{},this.configProvider=Promise.resolve(this.config)),void 0===oe.supported&&(oe.supported=Boolean("undefined"!=typeof Request&&"keepalive"in se("https://[::1]")))}destroy(){}async handle(e,{abortSignal:t,requestTimeout:r}={}){this.config||(this.config=await this.configProvider);const n=r??this.config.requestTimeout,s=!0===this.config.keepAlive,i=this.config.credentials;if(t?.aborted){const e=new Error("Request aborted");return e.name="AbortError",Promise.reject(e)}let o=e.path;const c=function(e){const t=[];for(let r of Object.keys(e).sort()){const n=e[r];if(r=re(r),Array.isArray(n))for(let e=0,s=n.length;e<s;e++)t.push(`${r}=${re(n[e])}`);else{let e=r;(n||"string"==typeof n)&&(e+=`=${re(n)}`),t.push(e)}}return t.join("&")}(e.query||{});c&&(o+=`?${c}`),e.fragment&&(o+=`#${e.fragment}`);let u="";if(null!=e.username||null!=e.password){u=`${e.username??""}:${e.password??""}@`}const{port:d,method:l}=e,h=`${e.protocol}//${u}${e.hostname}${d?`:${d}`:""}${o}`,p="GET"===l||"HEAD"===l?void 0:e.body,f={body:p,headers:new Headers(e.headers),method:l,credentials:i};this.config?.cache&&(f.cache=this.config.cache),p&&(f.duplex="half"),"undefined"!=typeof AbortController&&(f.signal=t),oe.supported&&(f.keepalive=s),"function"==typeof this.config.requestInit&&Object.assign(f,this.config.requestInit(e));let m=()=>{};const g=se(h,f),y=[fetch(g).then(e=>{const t=e.headers,r={};for(const n of t.entries())r[n[0]]=n[1];return null!=e.body?{response:new a({headers:r,reason:e.statusText,statusCode:e.status,body:e.body})}:e.blob().then(t=>({response:new a({headers:r,reason:e.statusText,statusCode:e.status,body:t})}))}),ie(n)];return t&&y.push(new Promise((e,r)=>{const n=()=>{const e=new Error("Request aborted");e.name="AbortError",r(e)};if("function"==typeof t.addEventListener){const e=t;e.addEventListener("abort",n,{once:!0}),m=()=>e.removeEventListener("abort",n)}else t.onabort=n})),Promise.race(y).finally(m)}updateHttpClientConfig(e,t){this.config=void 0,this.configProvider=this.configProvider.then(r=>(r[e]=t,r))}httpHandlerConfigs(){return this.config??{}}}const ce=async e=>"function"==typeof Blob&&e instanceof Blob||"Blob"===e.constructor?.name?void 0!==Blob.prototype.arrayBuffer?new Uint8Array(await e.arrayBuffer()):async function(e){const t=await function(e){return new Promise((t,r)=>{const n=new FileReader;n.onloadend=()=>{if(2!==n.readyState)return r(new Error("Reader aborted too early"));const e=n.result??"",s=e.indexOf(","),i=s>-1?s+1:e.length;t(e.substring(i))},n.onabort=()=>r(new Error("Read aborted")),n.onerror=()=>r(n.error),n.readAsDataURL(e)})}(e),r=j(t);return new Uint8Array(r)}(e):async function(e){const t=[],r=e.getReader();let n=!1,s=0;for(;!n;){const{done:e,value:i}=await r.read();i&&(t.push(i),s+=i.length),n=e}const i=new Uint8Array(s);let o=0;for(const a of t)i.set(a,o),o+=a.length;return i}(e);const ue={},de={};for(let Sf=0;Sf<256;Sf++){let e=Sf.toString(16).toLowerCase();1===e.length&&(e=`0${e}`),ue[Sf]=e,de[e]=Sf}function le(e){if(e.length%2!=0)throw new Error("Hex encoded strings must have an even number length");const t=new Uint8Array(e.length/2);for(let r=0;r<e.length;r+=2){const n=e.slice(r,r+2).toLowerCase();if(!(n in de))throw new Error(`Cannot decode unrecognized sequence ${n} as hexadecimal`);t[r/2]=de[n]}return t}function he(e){let t="";for(let r=0;r<e.byteLength;r++)t+=ue[e[r]];return t}const pe="The stream has already been transformed.",fe=e=>{if(!me(e)&&!G(e)){throw new Error(`Unexpected stream implementation, expect Blob or ReadableStream, got ${e?.__proto__?.constructor?.name||e}`)}let t=!1;const r=async()=>{if(t)throw new Error(pe);return t=!0,await ce(e)};return Object.assign(e,{transformToByteArray:r,transformToString:async e=>{const t=await r();if("base64"===e)return K(t);if("hex"===e)return he(t);if(void 0===e||"utf8"===e||"utf-8"===e)return F(t);if("function"==typeof TextDecoder)return new TextDecoder(e).decode(t);throw new Error("TextDecoder is not available, please make sure polyfill is provided.")},transformToWebStream:()=>{if(t)throw new Error(pe);if(t=!0,me(e))return(e=>{if("function"!=typeof e.stream)throw new Error("Cannot transform payload Blob to web stream. Please make sure the Blob.stream() is polyfilled.\nIf you are using React Native, this API is not yet supported, see: https://react-native.canny.io/feature-requests/p/fetch-streaming-body");return e.stream()})(e);if(G(e))return e;throw new Error(`Cannot transform payload to web stream, got ${e}`)}})},me=e=>"function"==typeof Blob&&e instanceof Blob;const ge=async(e=new Uint8Array,t)=>{if(e instanceof Uint8Array)return V.mutate(e);if(!e)return V.mutate(new Uint8Array);const r=t.streamCollector(e);return V.mutate(await r)};function ye(e){return encodeURIComponent(e).replace(/[!'()*]/g,function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})}const we=e=>"function"==typeof e?e():e,be=(e,t,r,n,s)=>({name:t,namespace:e,traits:r,input:n,output:s}),Se=(e,t)=>(t.find(([t])=>t.match(e))||[void 0,void 0])[1],ve={name:"deserializerMiddleware",step:"deserialize",tags:["DESERIALIZER"],override:!0},Ee={name:"serializerMiddleware",step:"serialize",tags:["SERIALIZER"],override:!0};function Ce(e){return{applyToStack:t=>{t.add((e=>(t,r)=>async n=>{const{operationSchema:s}=P(r),[,i,o,a,c,u]=s??[],d=r.endpointV2?.url&&e.urlParser?async()=>e.urlParser(r.endpointV2.url):e.endpoint,l=await e.protocol.serializeRequest(be(i,o,a,c,u),n.input,{...e,...r,endpoint:d});return t({...n,request:l})})(e),Ee),t.add((e=>(t,r)=>async n=>{const{response:s}=await t(n),{operationSchema:i}=P(r),[,o,c,u,d,l]=i??[];try{return{response:s,output:await e.protocol.deserializeResponse(be(o,c,u,d,l),{...e,...r},s)}}catch(h){if(Object.defineProperty(h,"$response",{value:s,enumerable:!1,writable:!1,configurable:!1}),!("$metadata"in h)){const e="Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.";try{h.message+="\n "+e}catch(p){r.logger&&"NoOpLogger"!==r.logger?.constructor?.name?r.logger?.warn?.(e):console.warn(e)}void 0!==h.$responseBodyText&&h.$response&&(h.$response.body=h.$responseBodyText);try{if(a.isInstance(s)){const{headers:e={}}=s,t=Object.entries(e);h.$metadata={httpStatusCode:s.statusCode,requestId:Se(/^x-[\w-]+-request-?id$/,t),extendedRequestId:Se(/^x-[\w-]+-id-2$/,t),cfId:Se(/^x-[\w-]+-cf-id$/,t)}}}catch(p){}}throw h}})(e),ve),e.protocol.setSerdeContext(e)}}}function xe(e){if("object"==typeof e)return e;e|=0;const t={};let r=0;for(const n of["httpLabel","idempotent","idempotencyToken","sensitive","httpPayload","httpResponseCode","httpQueryParams"])1==(e>>r++&1)&&(t[n]=1);return t}class Ae{ref;memberName;static symbol=/* @__PURE__ */Symbol.for("@smithy/nor");symbol=Ae.symbol;name;schema;_isMemberSchema;traits;memberTraits;normalizedTraits;constructor(e,t){this.ref=e,this.memberName=t;const r=[];let n=e,s=e;for(this._isMemberSchema=!1;ke(n);)r.push(n[1]),n=n[0],s=we(n),this._isMemberSchema=!0;if(r.length>0){this.memberTraits={};for(let e=r.length-1;e>=0;--e){const t=r[e];Object.assign(this.memberTraits,xe(t))}}else this.memberTraits=0;if(s instanceof Ae){const e=this.memberTraits;return Object.assign(this,s),this.memberTraits=Object.assign({},e,s.getMemberTraits(),this.getMemberTraits()),this.normalizedTraits=void 0,void(this.memberName=t??s.memberName)}if(this.schema=we(s),Te(this.schema)?(this.name=`${this.schema[1]}#${this.schema[2]}`,this.traits=this.schema[3]):(this.name=this.memberName??String(s),this.traits=0),this._isMemberSchema&&!t)throw new Error(`@smithy/core/schema - NormalizedSchema member init ${this.getName(!0)} missing member name.`)}static[Symbol.hasInstance](e){const t=this.prototype.isPrototypeOf(e);if(!t&&"object"==typeof e&&null!==e){return e.symbol===this.symbol}return t}static of(e){const t=we(e);if(t instanceof Ae)return t;if(ke(t)){const[r,n]=t;if(r instanceof Ae)return Object.assign(r.getMergedTraits(),xe(n)),r;throw new Error(`@smithy/core/schema - may not init unwrapped member schema=${JSON.stringify(e,null,2)}.`)}return new Ae(t)}getSchema(){const e=this.schema;return 0===e[0]?e[4]:e}getName(e=!1){const{name:t}=this;return!e&&t&&t.includes("#")?t.split("#")[1]:t||void 0}getMemberName(){return this.memberName}isMemberSchema(){return this._isMemberSchema}isListSchema(){const e=this.getSchema();return"number"==typeof e?e>=64&&e<128:1===e[0]}isMapSchema(){const e=this.getSchema();return"number"==typeof e?e>=128&&e<=255:2===e[0]}isStructSchema(){const e=this.getSchema()[0];return 3===e||-3===e||4===e}isUnionSchema(){return 4===this.getSchema()[0]}isBlobSchema(){const e=this.getSchema();return 21===e||42===e}isTimestampSchema(){const e=this.getSchema();return"number"==typeof e&&e>=4&&e<=7}isUnitSchema(){return"unit"===this.getSchema()}isDocumentSchema(){return 15===this.getSchema()}isStringSchema(){return 0===this.getSchema()}isBooleanSchema(){return 2===this.getSchema()}isNumericSchema(){return 1===this.getSchema()}isBigIntegerSchema(){return 17===this.getSchema()}isBigDecimalSchema(){return 19===this.getSchema()}isStreaming(){const{streaming:e}=this.getMergedTraits();return!!e||42===this.getSchema()}isIdempotencyToken(){const e=e=>!(4&~e&&!e?.idempotencyToken),{normalizedTraits:t,traits:r,memberTraits:n}=this;return e(t)||e(r)||e(n)}getMergedTraits(){return this.normalizedTraits??(this.normalizedTraits={...this.getOwnTraits(),...this.getMemberTraits()})}getMemberTraits(){return xe(this.memberTraits)}getOwnTraits(){return xe(this.traits)}getKeySchema(){const[e,t]=[this.isDocumentSchema(),this.isMapSchema()];if(!e&&!t)throw new Error(`@smithy/core/schema - cannot get key for non-map: ${this.getName(!0)}`);const r=this.getSchema();return Re([e?15:r[4]??0,0],"key")}getValueSchema(){const e=this.getSchema(),[t,r,n]=[this.isDocumentSchema(),this.isMapSchema(),this.isListSchema()],s="number"==typeof e?63&e:e&&"object"==typeof e&&(r||n)?e[3+e[0]]:t?15:void 0;if(null!=s)return Re([s,0],r?"value":"member");throw new Error(`@smithy/core/schema - ${this.getName(!0)} has no value member.`)}getMemberSchema(e){const t=this.getSchema();if(this.isStructSchema()&&t[4].includes(e)){const r=t[4].indexOf(e),n=t[5][r];return Re(ke(n)?n:[n,0],e)}if(this.isDocumentSchema())return Re([15,0],e);throw new Error(`@smithy/core/schema - ${this.getName(!0)} has no no member=${e}.`)}getMemberSchemas(){const e={};try{for(const[t,r]of this.structIterator())e[t]=r}catch(t){}return e}getEventStreamMember(){if(this.isStructSchema())for(const[e,t]of this.structIterator())if(t.isStreaming()&&t.isStructSchema())return e;return""}*structIterator(){if(this.isUnitSchema())return;if(!this.isStructSchema())throw new Error("@smithy/core/schema - cannot iterate non-struct schema.");const e=this.getSchema();for(let t=0;t<e[4].length;++t)yield[e[4][t],Re([e[5][t],0],e[4][t])]}}function Re(e,t){if(e instanceof Ae)return Object.assign(e,{memberName:t,_isMemberSchema:!0});return new Ae(e,t)}const ke=e=>Array.isArray(e)&&2===e.length,Te=e=>Array.isArray(e)&&e.length>=5;class Pe{namespace;schemas;exceptions;static registries=/* @__PURE__ */new Map;constructor(e,t=/* @__PURE__ */new Map,r=/* @__PURE__ */new Map){this.namespace=e,this.schemas=t,this.exceptions=r}static for(e){return Pe.registries.has(e)||Pe.registries.set(e,new Pe(e)),Pe.registries.get(e)}register(e,t){const r=this.normalizeShapeId(e);Pe.for(r.split("#")[0]).schemas.set(r,t)}getSchema(e){const t=this.normalizeShapeId(e);if(!this.schemas.has(t))throw new Error(`@smithy/core/schema - schema not found for ${t}`);return this.schemas.get(t)}registerError(e,t){const r=e,n=Pe.for(r[1]);n.schemas.set(r[1]+"#"+r[2],r),n.exceptions.set(r,t)}getErrorCtor(e){const t=e;return Pe.for(t[1]).exceptions.get(t)}getBaseException(){for(const e of this.exceptions.keys())if(Array.isArray(e)){const[,t,r]=e,n=t+"#"+r;if(n.startsWith("smithy.ts.sdk.synthetic.")&&n.endsWith("ServiceException"))return e}}find(e){return[...this.schemas.values()].find(e)}clear(){this.schemas.clear(),this.exceptions.clear()}normalizeShapeId(e){return e.includes("#")?e:this.namespace+"#"+e}}const Ie=Math.ceil(2**127*(2-2**-23)),Me=e=>{const t=(e=>{if(null!=e){if("string"==typeof e){const t=parseFloat(e);if(!Number.isNaN(t))return String(t)!==String(e)&&ze.warn(Be(`Expected number but observed string: ${e}`)),t}if("number"==typeof e)return e;throw new TypeError(`Expected number, got ${typeof e}: ${e}`)}})(e);if(void 0!==t&&!Number.isNaN(t)&&t!==1/0&&t!==-1/0&&Math.abs(t)>Ie)throw new TypeError(`Expected 32-bit float, got ${e}`);return t},Oe=e=>Ne(e,16),Ue=e=>Ne(e,8),Ne=(e,t)=>{const r=(e=>{if(null!=e){if(Number.isInteger(e)&&!Number.isNaN(e))return e;throw new TypeError(`Expected integer, got ${typeof e}: ${e}`)}})(e);if(void 0!==r&&$e(r,t)!==r)throw new TypeError(`Expected ${t}-bit integer, got ${e}`);return r},$e=(e,t)=>{switch(t){case 32:return Int32Array.of(e)[0];case 16:return Int16Array.of(e)[0];case 8:return Int8Array.of(e)[0]}},De=/(-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?)|(-?Infinity)|(NaN)/g,Le=e=>{const t=e.match(De);if(null===t||t[0].length!==e.length)throw new TypeError("Expected real number, got implicit NaN");return parseFloat(e)},_e=e=>Oe("string"==typeof e?Le(e):e),Be=e=>String(new TypeError(e).stack||e).split("\n").slice(0,5).filter(e=>!e.includes("stackTraceWarning")).join("\n"),ze={warn:console.warn},je=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],He=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function qe(e){const t=e.getUTCFullYear(),r=e.getUTCMonth(),n=e.getUTCDay(),s=e.getUTCDate(),i=e.getUTCHours(),o=e.getUTCMinutes(),a=e.getUTCSeconds(),c=i<10?`0${i}`:`${i}`,u=o<10?`0${o}`:`${o}`,d=a<10?`0${a}`:`${a}`;return`${je[n]}, ${s<10?`0${s}`:`${s}`} ${He[r]} ${t} ${c}:${u}:${d} GMT`}const Fe=new RegExp(/^(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d{2}) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? GMT$/),Ke=new RegExp(/^(?:Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d{2})-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d{2}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? GMT$/),Ve=new RegExp(/^(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( [1-9]|\d{2}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? (\d{4})$/),We=(e,t,r,n)=>{const s=t-1;return Je(e,s,r),new Date(Date.UTC(e,s,r,et(n.hours,"hour",0,23),et(n.minutes,"minute",0,59),et(n.seconds,"seconds",0,60),tt(n.fractionalMilliseconds)))},Ze=e=>{const t=/* @__PURE__ */(new Date).getUTCFullYear(),r=100*Math.floor(t/100)+_e(rt(e));return r<t?r+100:r},Ge=e=>e.getTime()-/* @__PURE__ */(new Date).getTime()>15768e8?new Date(Date.UTC(e.getUTCFullYear()-100,e.getUTCMonth(),e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds())):e,Xe=e=>{const t=He.indexOf(e);if(t<0)throw new TypeError(`Invalid month: ${e}`);return t+1},Ye=[31,28,31,30,31,30,31,31,30,31,30,31],Je=(e,t,r)=>{let n=Ye[t];if(1===t&&Qe(e)&&(n=29),r>n)throw new TypeError(`Invalid day for ${He[t]} in ${e}: ${r}`)},Qe=e=>e%4==0&&(e%100!=0||e%400==0),et=(e,t,r,n)=>{const s=(e=>Ue("string"==typeof e?Le(e):e))(rt(e));if(s<r||s>n)throw new TypeError(`${t} must be between ${r} and ${n}, inclusive`);return s},tt=e=>null==e?0:1e3*(e=>Me("string"==typeof e?Le(e):e))("0."+e),rt=e=>{let t=0;for(;t<e.length-1&&"0"===e.charAt(t);)t++;return 0===t?e:e.slice(t)},nt="undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),st=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0")),it=()=>{if(nt)return nt();const e=new Uint8Array(16);return crypto.getRandomValues(e),e[6]=15&e[6]|64,e[8]=63&e[8]|128,st[e[0]]+st[e[1]]+st[e[2]]+st[e[3]]+"-"+st[e[4]]+st[e[5]]+"-"+st[e[6]]+st[e[7]]+"-"+st[e[8]]+st[e[9]]+"-"+st[e[10]]+st[e[11]]+st[e[12]]+st[e[13]]+st[e[14]]+st[e[15]]},ot=function(e){return Object.assign(new String(e),{deserializeJSON:()=>JSON.parse(String(e)),toString:()=>String(e),toJSON:()=>String(e)})};function at(e){return(e.includes(",")||e.includes('"'))&&(e=`"${e.replace(/"/g,'\\"')}"`),e}ot.from=e=>e&&"object"==typeof e&&(e instanceof ot||"deserializeJSON"in e)?e:"string"==typeof e||Object.getPrototypeOf(e)===String.prototype?ot(String(e)):ot(JSON.stringify(e)),ot.fromObject=ot.from;const ct="(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun)(?:[ne|u?r]?s?day)?",ut="(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)",dt="(\\d?\\d):(\\d{2}):(\\d{2})(?:\\.(\\d+))?",lt="(\\d?\\d)",ht="(\\d{4})",pt=new RegExp(/^(\d{4})-(\d\d)-(\d\d)[tT](\d\d):(\d\d):(\d\d)(\.(\d+))?(([-+]\d\d:\d\d)|[zZ])$/),ft=new RegExp(`^${ct}, ${lt} ${ut} ${ht} ${dt} GMT$`),mt=new RegExp(`^${ct}, ${lt}-${ut}-(\\d\\d) ${dt} GMT$`),gt=new RegExp(`^${ct} ${ut} ( [1-9]|\\d\\d) ${dt} ${ht}$`),yt=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function wt(e,t,r){const n=Number(e);if(n<t||n>r)throw new Error(`Value ${n} out of range [${t}, ${r}]`)}function bt(e,t,r){if(!Number.isInteger(r))throw new Error("Invalid number of delimiters ("+r+") for splitEvery.");const n=e.split(t),s=[];let i="";for(let o=0;o<n.length;o++)""===i?i=n[o]:i+=t+n[o],(o+1)%r===0&&(s.push(i),i="");return""!==i&&s.push(i),s}const St=e=>{const t=e.length,r=[];let n,s=!1,i=0;for(let o=0;o<t;++o){const t=e[o];switch(t){case'"':"\\"!==n&&(s=!s);break;case",":s||(r.push(e.slice(i,o)),i=o+1)}n=t}return r.push(e.slice(i)),r.map(e=>{const t=(e=e.trim()).length;return t<2?e:('"'===e[0]&&'"'===e[t-1]&&(e=e.slice(1,t-1)),e.replace(/\\"/g,'"'))})},vt=/^-?\d*(\.\d+)?$/;class Et{string;type;constructor(e,t){if(this.string=e,this.type=t,!vt.test(e))throw new Error('@smithy/core/serde - NumericValue must only contain [0-9], at most one decimal point ".", and an optional negation prefix "-".')}toString(){return this.string}static[Symbol.hasInstance](e){if(!e||"object"!=typeof e)return!1;const t=e;return Et.prototype.isPrototypeOf(e)||"bigDecimal"===t.type&&vt.test(t.string)}}class Ct{serdeContext;setSerdeContext(e){this.serdeContext=e}}class xt extends Ct{options;constructor(e){super(),this.options=e}getRequestType(){return o}getResponseType(){return a}setSerdeContext(e){this.serdeContext=e,this.serializer.setSerdeContext(e),this.deserializer.setSerdeContext(e),this.getPayloadCodec()&&this.getPayloadCodec().setSerdeContext(e)}updateServiceEndpoint(e,t){if("url"in t){e.protocol=t.url.protocol,e.hostname=t.url.hostname,e.port=t.url.port?Number(t.url.port):void 0,e.path=t.url.pathname,e.fragment=t.url.hash||void 0,e.username=t.url.username||void 0,e.password=t.url.password||void 0,e.query||(e.query={});for(const[r,n]of t.url.searchParams.entries())e.query[r]=n;return e}return e.protocol=t.protocol,e.hostname=t.hostname,e.port=t.port?Number(t.port):void 0,e.path=t.path,e.query={...t.query},e}setHostPrefix(e,t,r){const n=Ae.of(t.input),s=xe(t.traits??{});if(s.endpoint){let t=s.endpoint?.[0];if("string"==typeof t){const s=[...n.structIterator()].filter(([,e])=>e.getMergedTraits().hostLabel);for(const[e]of s){const n=r[e];if("string"!=typeof n)throw new Error(`@smithy/core/schema - ${e} in input must be a string as hostLabel.`);t=t.replace(`{${e}}`,n)}e.hostname=t+e.hostname}}}deserializeMetadata(e){return{httpStatusCode:e.statusCode,requestId:e.headers["x-amzn-requestid"]??e.headers["x-amzn-request-id"]??e.headers["x-amz-request-id"],extendedRequestId:e.headers["x-amz-id-2"],cfId:e.headers["x-amz-cf-id"]}}async serializeEventStream({eventStream:e,requestSchema:t,initialRequest:r}){return(await this.loadEventStreamCapability()).serializeEventStream({eventStream:e,requestSchema:t,initialRequest:r})}async deserializeEventStream({response:e,responseSchema:t,initialResponseContainer:r}){return(await this.loadEventStreamCapability()).deserializeEventStream({response:e,responseSchema:t,initialResponseContainer:r})}async loadEventStreamCapability(){const{EventStreamSerde:e}=await import("./index-Bsc1j7P2.js");return new e({marshaller:this.getEventStreamMarshaller(),serializer:this.serializer,deserializer:this.deserializer,serdeContext:this.serdeContext,defaultContentType:this.getDefaultContentType()})}getDefaultContentType(){throw new Error(`@smithy/core/protocols - ${this.constructor.name} getDefaultContentType() implementation missing.`)}async deserializeHttpMessage(e,t,r,n,s){return[]}getEventStreamMarshaller(){const e=this.serdeContext;if(!e.eventStreamMarshaller)throw new Error("@smithy/core - HttpProtocol: eventStreamMarshaller missing in serdeContext.");return e.eventStreamMarshaller}}class At extends xt{async serializeRequest(e,t,r){const n={...t??{}},s=this.serializer,i={},a={},c=await r.endpoint(),u=Ae.of(e?.input),d=u.getSchema();let l,h=!1;const p=new o({protocol:"",hostname:"",port:void 0,path:"",fragment:void 0,query:i,headers:a,body:void 0});if(c){this.updateServiceEndpoint(p,c),this.setHostPrefix(p,e,n);const t=xe(e.traits);if(t.http){p.method=t.http[0];const[e,r]=t.http[1].split("?");"/"==p.path?p.path=e:p.path+=e;const n=new URLSearchParams(r??"");Object.assign(i,Object.fromEntries(n))}}for(const[o,f]of u.structIterator()){const e=f.getMergedTraits()??{},t=n[o];if(null!=t||f.isIdempotencyToken())if(e.httpPayload){if(f.isStreaming()){f.isStructSchema()?n[o]&&(l=await this.serializeEventStream({eventStream:n[o],requestSchema:u})):l=t}else s.write(f,t),l=s.flush();delete n[o]}else if(e.httpLabel){s.write(f,t);const e=s.flush();p.path.includes(`{${o}+}`)?p.path=p.path.replace(`{${o}+}`,e.split("/").map(ye).join("/")):p.path.includes(`{${o}}`)&&(p.path=p.path.replace(`{${o}}`,ye(e))),delete n[o]}else if(e.httpHeader)s.write(f,t),a[e.httpHeader.toLowerCase()]=String(s.flush()),delete n[o];else if("string"==typeof e.httpPrefixHeaders){for(const[r,n]of Object.entries(t)){const t=e.httpPrefixHeaders+r;s.write([f.getValueSchema(),{httpHeader:t}],n),a[t.toLowerCase()]=s.flush()}delete n[o]}else e.httpQuery||e.httpQueryParams?(this.serializeQuery(f,t,i),delete n[o]):h=!0}return h&&n&&(s.write(d,n),l=s.flush()),p.headers=a,p.query=i,p.body=l,p}serializeQuery(e,t,r){const n=this.serializer,s=e.getMergedTraits();if(s.httpQueryParams){for(const[i,o]of Object.entries(t))if(!(i in r)){const t=e.getValueSchema();Object.assign(t.getMergedTraits(),{...s,httpQuery:i,httpQueryParams:void 0}),this.serializeQuery(t,o,r)}}else if(e.isListSchema()){const i=!!e.getMergedTraits().sparse,o=[];for(const r of t){n.write([e.getValueSchema(),s],r);const t=n.flush();(i||void 0!==t)&&o.push(t)}r[s.httpQuery]=o}else n.write([e,s],t),r[s.httpQuery]=n.flush()}async deserializeResponse(e,t,r){const n=this.deserializer,s=Ae.of(e.output),i={};if(r.statusCode>=300){const s=await ge(r.body,t);throw s.byteLength>0&&Object.assign(i,await n.read(15,s)),await this.handleError(e,t,r,i,this.deserializeMetadata(r)),new Error("@smithy/core/protocols - HTTP Protocol error handler failed to throw.")}for(const a in r.headers){const e=r.headers[a];delete r.headers[a],r.headers[a.toLowerCase()]=e}const o=await this.deserializeHttpMessage(s,t,r,i);if(o.length){const e=await ge(r.body,t);if(e.byteLength>0){const t=await n.read(s,e);for(const e of o)i[e]=t[e]}}else o.discardResponseBody&&await ge(r.body,t);return i.$metadata=this.deserializeMetadata(r),i}async deserializeHttpMessage(e,t,r,n,s){let i;i=n instanceof Set?s:n;let o=!0;const a=this.deserializer,c=Ae.of(e),u=[];for(const[d,l]of c.structIterator()){const e=l.getMemberTraits();if(e.httpPayload){o=!1;if(l.isStreaming()){const e=l.isStructSchema();i[d]=e?await this.deserializeEventStream({response:r,responseSchema:c}):fe(r.body)}else if(r.body){const e=await ge(r.body,t);e.byteLength>0&&(i[d]=await a.read(l,e))}}else if(e.httpHeader){const t=String(e.httpHeader).toLowerCase(),n=r.headers[t];if(null!=n)if(l.isListSchema()){const e=l.getValueSchema();let r;e.getMergedTraits().httpHeader=t,r=e.isTimestampSchema()&&4===e.getSchema()?bt(n,",",2):St(n);const s=[];for(const t of r)s.push(await a.read(e,t.trim()));i[d]=s}else i[d]=await a.read(l,n)}else if(void 0!==e.httpPrefixHeaders){i[d]={};for(const[t,n]of Object.entries(r.headers))if(t.startsWith(e.httpPrefixHeaders)){const r=l.getValueSchema();r.getMergedTraits().httpHeader=t,i[d][t.slice(e.httpPrefixHeaders.length)]=await a.read(r,n)}}else e.httpResponseCode?i[d]=r.statusCode:u.push(d)}return u.discardResponseBody=o,u}}function Rt(e,t){if(t.timestampFormat.useTrait&&e.isTimestampSchema()&&(5===e.getSchema()||6===e.getSchema()||7===e.getSchema()))return e.getSchema();const{httpLabel:r,httpPrefixHeaders:n,httpHeader:s,httpQuery:i}=e.getMergedTraits();return(t.httpBindings?"string"==typeof n||Boolean(s)?6:Boolean(i)||Boolean(r)?5:void 0:void 0)??t.timestampFormat.default}class kt extends Ct{settings;constructor(e){super(),this.settings=e}read(e,t){const r=Ae.of(e);if(r.isListSchema())return St(t).map(e=>this.read(r.getValueSchema(),e));if(r.isBlobSchema())return(this.serdeContext?.base64Decoder??j)(t);if(r.isTimestampSchema()){switch(Rt(r,this.settings)){case 5:return(e=>{if(null==e)return;if("string"!=typeof e)throw new TypeError("RFC3339 timestamps must be strings");const t=pt.exec(e);if(!t)throw new TypeError(`Invalid RFC3339 timestamp format ${e}`);const[,r,n,s,i,o,a,,c,u]=t;wt(n,1,12),wt(s,1,31),wt(i,0,23),wt(o,0,59),wt(a,0,60);const d=new Date(Date.UTC(Number(r),Number(n)-1,Number(s),Number(i),Number(o),Number(a),Number(c)?Math.round(1e3*parseFloat(`0.${c}`)):0));if(d.setUTCFullYear(Number(r)),"Z"!=u.toUpperCase()){const[,e,t,r]=/([+-])(\d\d):(\d\d)/.exec(u)||[void 0,"+",0,0],n="-"===e?1:-1;d.setTime(d.getTime()+n*(60*Number(t)*60*1e3+60*Number(r)*1e3))}return d})(t);case 6:return(e=>{if(null==e)return;if("string"!=typeof e)throw new TypeError("RFC7231 timestamps must be strings.");let t,r,n,s,i,o,a,c;if((c=ft.exec(e))?[,t,r,n,s,i,o,a]=c:(c=mt.exec(e))?([,t,r,n,s,i,o,a]=c,n=(Number(n)+1900).toString()):(c=gt.exec(e))&&([,r,t,s,i,o,a,n]=c),n&&o){const e=Date.UTC(Number(n),yt.indexOf(r),Number(t),Number(s),Number(i),Number(o),a?Math.round(1e3*parseFloat(`0.${a}`)):0);wt(t,1,31),wt(s,0,23),wt(i,0,59),wt(o,0,60);const c=new Date(e);return c.setUTCFullYear(Number(n)),c}throw new TypeError(`Invalid RFC7231 date-time value ${e}.`)})(t);case 7:return(e=>{if(null==e)return;let t=NaN;if("number"==typeof e)t=e;else if("string"==typeof e){if(!/^-?\d*\.?\d+$/.test(e))throw new TypeError("parseEpochTimestamp - numeric string invalid.");t=Number.parseFloat(e)}else"object"==typeof e&&1===e.tag&&(t=e.value);if(isNaN(t)||Math.abs(t)===1/0)throw new TypeError("Epoch timestamps must be valid finite numbers.");return new Date(Math.round(1e3*t))})(t);default:return console.warn("Missing timestamp format, parsing value with Date constructor:",t),new Date(t)}}if(r.isStringSchema()){const e=r.getMergedTraits().mediaType;let n=t;if(e){r.getMergedTraits().httpHeader&&(n=this.base64ToUtf8(n));return("application/json"===e||e.endsWith("+json"))&&(n=ot.from(n)),n}}return r.isNumericSchema()?Number(t):r.isBigIntegerSchema()?BigInt(t):r.isBigDecimalSchema()?new Et(t,"bigDecimal"):r.isBooleanSchema()?"true"===String(t).toLowerCase():t}base64ToUtf8(e){return(this.serdeContext?.utf8Encoder??F)((this.serdeContext?.base64Decoder??j)(e))}}class Tt extends Ct{codecDeserializer;stringDeserializer;constructor(e,t){super(),this.codecDeserializer=e,this.stringDeserializer=new kt(t)}setSerdeContext(e){this.stringDeserializer.setSerdeContext(e),this.codecDeserializer.setSerdeContext(e),this.serdeContext=e}read(e,t){const r=Ae.of(e),n=r.getMergedTraits(),s=this.serdeContext?.utf8Encoder??F;if(n.httpHeader||n.httpResponseCode)return this.stringDeserializer.read(r,s(t));if(n.httpPayload){if(r.isBlobSchema()){const e=this.serdeContext?.utf8Decoder??H;return"string"==typeof t?e(t):t}if(r.isStringSchema())return"byteLength"in t?s(t):t}return this.codecDeserializer.read(r,t)}}class Pt extends Ct{settings;stringBuffer="";constructor(e){super(),this.settings=e}write(e,t){const r=Ae.of(e);switch(typeof t){case"object":if(null===t)return void(this.stringBuffer="null");if(r.isTimestampSchema()){if(!(t instanceof Date))throw new Error(`@smithy/core/protocols - received non-Date value ${t} when schema expected Date in ${r.getName(!0)}`);switch(Rt(r,this.settings)){case 5:this.stringBuffer=t.toISOString().replace(".000Z","Z");break;case 6:this.stringBuffer=qe(t);break;case 7:this.stringBuffer=String(t.getTime()/1e3);break;default:console.warn("Missing timestamp format, using epoch seconds",t),this.stringBuffer=String(t.getTime()/1e3)}return}if(r.isBlobSchema()&&"byteLength"in t)return void(this.stringBuffer=(this.serdeContext?.base64Encoder??K)(t));if(r.isListSchema()&&Array.isArray(t)){let e="";for(const n of t){this.write([r.getValueSchema(),r.getMergedTraits()],n);const t=this.flush();""!==e&&(e+=", "),e+=r.getValueSchema().isTimestampSchema()?t:at(t)}return void(this.stringBuffer=e)}this.stringBuffer=JSON.stringify(t,null,2);break;case"string":const e=r.getMergedTraits().mediaType;let n=t;if(e){if(("application/json"===e||e.endsWith("+json"))&&(n=ot.from(n)),r.getMergedTraits().httpHeader)return void(this.stringBuffer=(this.serdeContext?.base64Encoder??K)(n.toString()))}this.stringBuffer=t;break;default:r.isIdempotencyToken()?this.stringBuffer=it():this.stringBuffer=String(t)}}flush(){const e=this.stringBuffer;return this.stringBuffer="",e}}class It{codecSerializer;stringSerializer;buffer;constructor(e,t,r=new Pt(t)){this.codecSerializer=e,this.stringSerializer=r}setSerdeContext(e){this.codecSerializer.setSerdeContext(e),this.stringSerializer.setSerdeContext(e)}write(e,t){const r=Ae.of(e),n=r.getMergedTraits();return n.httpHeader||n.httpLabel||n.httpQuery?(this.stringSerializer.write(r,t),void(this.buffer=this.stringSerializer.flush())):this.codecSerializer.write(r,t)}flush(){if(void 0!==this.buffer){const e=this.buffer;return this.buffer=void 0,e}return this.codecSerializer.flush()}}class Mt{authSchemes=/* @__PURE__ */new Map;constructor(e){for(const[t,r]of Object.entries(e))void 0!==r&&this.authSchemes.set(t,r)}getIdentityProvider(e){return this.authSchemes.get(e)}}const Ot=(Ut=3e5,function(e){return Nt(e)&&e.expiration.getTime()-Date.now()<Ut});var Ut;const Nt=e=>void 0!==e.expiration,$t=(e,t,r)=>{let n,s,i,o=!1;return async t=>(i&&!t?.forceRefresh||(n=await(async()=>{s||(s=e());try{n=await s,i=!0,o=!1}finally{s=void 0}return n})()),n)},Dt="X-Amz-Date",Lt="X-Amz-Signature",_t="X-Amz-Security-Token",Bt="authorization",zt=Dt.toLowerCase(),jt=[Bt,zt,"date"],Ht=Lt.toLowerCase(),qt="x-amz-content-sha256",Ft=_t.toLowerCase(),Kt={authorization:!0,"cache-control":!0,connection:!0,expect:!0,from:!0,"keep-alive":!0,"max-forwards":!0,pragma:!0,referer:!0,te:!0,trailer:!0,"transfer-encoding":!0,upgrade:!0,"user-agent":!0,"x-amzn-trace-id":!0},Vt=/^proxy-/,Wt=/^sec-/,Zt="AWS4-HMAC-SHA256",Gt="AWS4-HMAC-SHA256-PAYLOAD",Xt="aws4_request",Yt={},Jt=[],Qt=(e,t,r)=>`${e}/${t}/${r}/${Xt}`,er=(e,t,r)=>{const n=new e(t);return n.update(q(r)),n.digest()},tr=({headers:e},t,r)=>{const n={};for(const s of Object.keys(e).sort()){if(null==e[s])continue;const i=s.toLowerCase();(i in Kt||t?.has(i)||Vt.test(i)||Wt.test(i))&&(!r||r&&!r.has(i))||(n[i]=e[s].trim().replace(/\s+/g," "))}return n},rr=e=>"function"==typeof ArrayBuffer&&e instanceof ArrayBuffer||"[object ArrayBuffer]"===Object.prototype.toString.call(e),nr=async({headers:e,body:t},r)=>{for(const n of Object.keys(e))if(n.toLowerCase()===qt)return e[n];if(null==t)return"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";if("string"==typeof t||ArrayBuffer.isView(t)||rr(t)){const e=new r;return e.update(q(t)),he(await e.digest())}return"UNSIGNED-PAYLOAD"};class sr{format(e){const t=[];for(const s of Object.keys(e)){const r=H(s);t.push(Uint8Array.from([r.byteLength]),r,this.formatHeaderValue(e[s]))}const r=new Uint8Array(t.reduce((e,t)=>e+t.byteLength,0));let n=0;for(const s of t)r.set(s,n),n+=s.byteLength;return r}formatHeaderValue(e){switch(e.type){case"boolean":return Uint8Array.from([e.value?0:1]);case"byte":return Uint8Array.from([2,e.value]);case"short":const t=new DataView(new ArrayBuffer(3));return t.setUint8(0,3),t.setInt16(1,e.value,!1),new Uint8Array(t.buffer);case"integer":const r=new DataView(new ArrayBuffer(5));return r.setUint8(0,4),r.setInt32(1,e.value,!1),new Uint8Array(r.buffer);case"long":const n=new Uint8Array(9);return n[0]=5,n.set(e.value.bytes,1),n;case"binary":const s=new DataView(new ArrayBuffer(3+e.value.byteLength));s.setUint8(0,6),s.setUint16(1,e.value.byteLength,!1);const i=new Uint8Array(s.buffer);return i.set(e.value,3),i;case"string":const o=H(e.value),a=new DataView(new ArrayBuffer(3+o.byteLength));a.setUint8(0,7),a.setUint16(1,o.byteLength,!1);const c=new Uint8Array(a.buffer);return c.set(o,3),c;case"timestamp":const u=new Uint8Array(9);return u[0]=8,u.set(cr.fromNumber(e.value.valueOf()).bytes,1),u;case"uuid":if(!ar.test(e.value))throw new Error(`Invalid UUID received: ${e.value}`);const d=new Uint8Array(17);return d[0]=9,d.set(le(e.value.replace(/\-/g,"")),1),d}}}var ir,or;(or=ir||(ir={}))[or.boolTrue=0]="boolTrue",or[or.boolFalse=1]="boolFalse",or[or.byte=2]="byte",or[or.short=3]="short",or[or.integer=4]="integer",or[or.long=5]="long",or[or.byteArray=6]="byteArray",or[or.string=7]="string",or[or.timestamp=8]="timestamp",or[or.uuid=9]="uuid";const ar=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;let cr=class e{bytes;constructor(e){if(this.bytes=e,8!==e.byteLength)throw new Error("Int64 buffers must be exactly 8 bytes")}static fromNumber(t){if(t>0x8000000000000000||t<-0x8000000000000000)throw new Error(`${t} is too large (or, if negative, too small) to represent as an Int64`);const r=new Uint8Array(8);for(let e=7,n=Math.abs(Math.round(t));e>-1&&n>0;e--,n/=256)r[e]=n;return t<0&&ur(r),new e(r)}valueOf(){const e=this.bytes.slice(0),t=128&e[0];return t&&ur(e),parseInt(he(e),16)*(t?-1:1)}toString(){return String(this.valueOf())}};function ur(e){for(let t=0;t<8;t++)e[t]^=255;for(let t=7;t>-1&&(e[t]++,0===e[t]);t--);}const dr=e=>{e=o.clone(e);for(const t of Object.keys(e.headers))jt.indexOf(t.toLowerCase())>-1&&delete e.headers[t];return e},lr=e=>"number"==typeof e?new Date(1e3*e):"string"==typeof e?Number(e)?new Date(1e3*Number(e)):new Date(e):e;class hr{service;regionProvider;credentialProvider;sha256;uriEscapePath;applyChecksum;constructor({applyChecksum:e,credentials:t,region:r,service:n,sha256:s,uriEscapePath:i=!0}){this.service=n,this.sha256=s,this.uriEscapePath=i,this.applyChecksum="boolean"!=typeof e||e,this.regionProvider=I(r),this.credentialProvider=I(t)}createCanonicalRequest(e,t,r){const n=Object.keys(t).sort();return`${e.method}\n${this.getCanonicalPath(e)}\n${(({query:e={}})=>{const t=[],r={};for(const n of Object.keys(e)){if(n.toLowerCase()===Ht)continue;const s=re(n);t.push(s);const i=e[n];"string"==typeof i?r[s]=`${s}=${re(i)}`:Array.isArray(i)&&(r[s]=i.slice(0).reduce((e,t)=>e.concat([`${s}=${re(t)}`]),[]).sort().join("&"))}return t.sort().map(e=>r[e]).filter(e=>e).join("&")})(e)}\n${n.map(e=>`${e}:${t[e]}`).join("\n")}\n\n${n.join(";")}\n${r}`}async createStringToSign(e,t,r,n){const s=new this.sha256;s.update(q(r));return`${n}\n${e}\n${t}\n${he(await s.digest())}`}getCanonicalPath({path:e}){if(this.uriEscapePath){const t=[];for(const n of e.split("/"))0!==n?.length&&"."!==n&&(".."===n?t.pop():t.push(n));const r=`${e?.startsWith("/")?"/":""}${t.join("/")}${t.length>0&&e?.endsWith("/")?"/":""}`;return re(r).replace(/%2F/g,"/")}return e}validateResolvedCredentials(e){if("object"!=typeof e||"string"!=typeof e.accessKeyId||"string"!=typeof e.secretAccessKey)throw new Error("Resolved credential object is not valid")}formatDate(e){const t=(r=e,lr(r).toISOString().replace(/\.\d{3}Z$/,"Z")).replace(/[\-:]/g,"");var r;return{longDate:t,shortDate:t.slice(0,8)}}getCanonicalHeaderList(e){return Object.keys(e).sort().join(";")}}class pr extends hr{headerFormatter=new sr;constructor({applyChecksum:e,credentials:t,region:r,service:n,sha256:s,uriEscapePath:i=!0}){super({applyChecksum:e,credentials:t,region:r,service:n,sha256:s,uriEscapePath:i})}async presign(e,t={}){const{signingDate:r=/* @__PURE__ */new Date,expiresIn:n=3600,unsignableHeaders:s,unhoistableHeaders:i,signableHeaders:a,hoistableHeaders:c,signingRegion:u,signingService:d}=t,l=await this.credentialProvider();this.validateResolvedCredentials(l);const h=u??await this.regionProvider(),{longDate:p,shortDate:f}=this.formatDate(r);if(n>604800)return Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future");const m=Qt(f,h,d??this.service),g=((e,t={})=>{const{headers:r,query:n={}}=o.clone(e);for(const s of Object.keys(r)){const e=s.toLowerCase();("x-amz-"===e.slice(0,6)&&!t.unhoistableHeaders?.has(e)||t.hoistableHeaders?.has(e))&&(n[s]=r[s],delete r[s])}return{...e,headers:r,query:n}})(dr(e),{unhoistableHeaders:i,hoistableHeaders:c});l.sessionToken&&(g.query[_t]=l.sessionToken),g.query["X-Amz-Algorithm"]=Zt,g.query["X-Amz-Credential"]=`${l.accessKeyId}/${m}`,g.query[Dt]=p,g.query["X-Amz-Expires"]=n.toString(10);const y=tr(g,s,a);return g.query["X-Amz-SignedHeaders"]=this.getCanonicalHeaderList(y),g.query[Lt]=await this.getSignature(p,m,this.getSigningKey(l,h,f,d),this.createCanonicalRequest(g,y,await nr(e,this.sha256))),g}async sign(e,t){return"string"==typeof e?this.signString(e,t):e.headers&&e.payload?this.signEvent(e,t):e.message?this.signMessage(e,t):this.signRequest(e,t)}async signEvent({headers:e,payload:t},{signingDate:r=/* @__PURE__ */new Date,priorSignature:n,signingRegion:s,signingService:i}){const o=s??await this.regionProvider(),{shortDate:a,longDate:c}=this.formatDate(r),u=Qt(a,o,i??this.service),d=await nr({headers:{},body:t},this.sha256),l=new this.sha256;l.update(e);const h=he(await l.digest()),p=[Gt,c,u,n,h,d].join("\n");return this.signString(p,{signingDate:r,signingRegion:o,signingService:i})}async signMessage(e,{signingDate:t=/* @__PURE__ */new Date,signingRegion:r,signingService:n}){return this.signEvent({headers:this.headerFormatter.format(e.message.headers),payload:e.message.body},{signingDate:t,signingRegion:r,signingService:n,priorSignature:e.priorSignature}).then(t=>({message:e.message,signature:t}))}async signString(e,{signingDate:t=/* @__PURE__ */new Date,signingRegion:r,signingService:n}={}){const s=await this.credentialProvider();this.validateResolvedCredentials(s);const i=r??await this.regionProvider(),{shortDate:o}=this.formatDate(t),a=new this.sha256(await this.getSigningKey(s,i,o,n));return a.update(q(e)),he(await a.digest())}async signRequest(e,{signingDate:t=/* @__PURE__ */new Date,signableHeaders:r,unsignableHeaders:n,signingRegion:s,signingService:i}={}){const o=await this.credentialProvider();this.validateResolvedCredentials(o);const a=s??await this.regionProvider(),c=dr(e),{longDate:u,shortDate:d}=this.formatDate(t),l=Qt(d,a,i??this.service);c.headers[zt]=u,o.sessionToken&&(c.headers[Ft]=o.sessionToken);const h=await nr(c,this.sha256);!((e,t)=>{e=e.toLowerCase();for(const r of Object.keys(t))if(e===r.toLowerCase())return!0;return!1})(qt,c.headers)&&this.applyChecksum&&(c.headers[qt]=h);const p=tr(c,n,r),f=await this.getSignature(u,l,this.getSigningKey(o,a,d,i),this.createCanonicalRequest(c,p,h));return c.headers[Bt]=`${Zt} Credential=${o.accessKeyId}/${l}, SignedHeaders=${this.getCanonicalHeaderList(p)}, Signature=${f}`,c}async getSignature(e,t,r,n){const s=await this.createStringToSign(e,t,n,Zt),i=new this.sha256(await r);return i.update(q(s)),he(await i.digest())}getSigningKey(e,t,r,n){return(async(e,t,r,n,s)=>{const i=`${r}:${n}:${s}:${he(await er(e,t.secretAccessKey,t.accessKeyId))}:${t.sessionToken}`;if(i in Yt)return Yt[i];for(Jt.push(i);Jt.length>50;)delete Yt[Jt.shift()];let o=`AWS4${t.secretAccessKey}`;for(const a of[r,n,s,Xt])o=await er(e,o,a);return Yt[i]=o})(this.sha256,e,r,t,n||this.service)}}const fr=e=>{let t,r=e.credentials,n=!!e.credentials;Object.defineProperty(e,"credentials",{set(s){s&&s!==r&&s!==t&&(n=!0),r=s;const i=function(e,{credentials:t,credentialDefaultProvider:r}){let n;n=t?t?.memoized?t:((e,t,r)=>{if(void 0===e)return;const n="function"!=typeof e?async()=>Promise.resolve(e):e;let s,i,o,a=!1;const c=async e=>{i||(i=n(e));try{s=await i,o=!0,a=!1}finally{i=void 0}return s};return void 0===t?async e=>(o&&!e?.forceRefresh||(s=await c(e)),s):async e=>(o&&!e?.forceRefresh||(s=await c(e)),a?s:r(s)?t(s)?(await c(e),s):s:(a=!0,s))})(t,Ot,Nt):r?L(r(Object.assign({},e,{parentClientConfig:e}))):async()=>{throw new Error("@aws-sdk/core::resolveAwsSdkSigV4Config - `credentials` not provided and no credentialDefaultProvider was configured.")};return n.memoized=!0,n}(e,{credentials:r,credentialDefaultProvider:e.credentialDefaultProvider}),o=function(e,t){if(t.configBound)return t;const r=async r=>t({...r,callerClientConfig:e});return r.memoized=t.memoized,r.configBound=!0,r}(e,i);if(n&&!o.attributed){const e="object"==typeof r&&null!==r;t=async t=>{const r=await o(t);return!e||r.$source&&0!==Object.keys(r.$source).length?r:function(e,t,r){return e.$source||(e.$source={}),e.$source[t]=r,e}(r,"CREDENTIALS_CODE","e")},t.memoized=o.memoized,t.configBound=o.configBound,t.attributed=!0}else t=o},get:()=>t,enumerable:!0,configurable:!0}),e.credentials=r;const{signingEscapePath:s=!0,systemClockOffset:i=e.systemClockOffset||0,sha256:o}=e;let a;a=e.signer?L(e.signer):e.regionInfoProvider?()=>L(e.region)().then(async t=>[await e.regionInfoProvider(t,{useFipsEndpoint:await e.useFipsEndpoint(),useDualstackEndpoint:await e.useDualstackEndpoint()})||{},t]).then(([t,r])=>{const{signingRegion:n,signingService:i}=t;e.signingRegion=e.signingRegion||n||r,e.signingName=e.signingName||i||e.serviceId;const a={...e,credentials:e.credentials,region:e.signingRegion,service:e.signingName,sha256:o,uriEscapePath:s};return new(e.signerConstructor||pr)(a)}):async t=>{const r=(t=Object.assign({},{name:"sigv4",signingName:e.signingName||e.defaultSigningName,signingRegion:await L(e.region)(),properties:{}},t)).signingRegion,n=t.signingName;e.signingRegion=e.signingRegion||r,e.signingName=e.signingName||n||e.serviceId;const i={...e,credentials:e.credentials,region:e.signingRegion,service:e.signingName,sha256:o,uriEscapePath:s};return new(e.signerConstructor||pr)(i)};return Object.assign(e,{systemClockOffset:i,signingEscapePath:s,signer:a})};const mr="function"==typeof TextEncoder?new TextEncoder:null,gr=e=>{if("string"==typeof e){if(mr)return mr.encode(e).byteLength;let t=e.length;for(let r=t-1;r>=0;r--){const n=e.charCodeAt(r);n>127&&n<=2047?t++:n>2047&&n<=65535&&(t+=2),n>=56320&&n<=57343&&r--}return t}if("number"==typeof e.byteLength)return e.byteLength;if("number"==typeof e.size)return e.size;throw new Error(`Body Length computation failed for ${e}`)},yr=(e,t)=>{const r=[];if(e&&r.push(e),t)for(const n of t)r.push(n);return r},wr=(e,t)=>`${e||"anonymous"}${t&&t.length>0?` (a.k.a. ${t.join(",")})`:""}`,br=()=>{let e=[],t=[],r=!1;const n=/* @__PURE__ */new Set,s=r=>(e.forEach(e=>{r.add(e.middleware,{...e})}),t.forEach(e=>{r.addRelativeTo(e.middleware,{...e})}),r.identifyOnResolve?.(a.identifyOnResolve()),r),i=e=>{const t=[];return e.before.forEach(e=>{0===e.before.length&&0===e.after.length?t.push(e):t.push(...i(e))}),t.push(e),e.after.reverse().forEach(e=>{0===e.before.length&&0===e.after.length?t.push(e):t.push(...i(e))}),t},o=(r=!1)=>{const n=[],s=[],o={};e.forEach(e=>{const t={...e,before:[],after:[]};for(const r of yr(t.name,t.aliases))o[r]=t;n.push(t)}),t.forEach(e=>{const t={...e,before:[],after:[]};for(const r of yr(t.name,t.aliases))o[r]=t;s.push(t)}),s.forEach(e=>{if(e.toMiddleware){const t=o[e.toMiddleware];if(void 0===t){if(r)return;throw new Error(`${e.toMiddleware} is not found when adding ${wr(e.name,e.aliases)} middleware ${e.relation} ${e.toMiddleware}`)}"after"===e.relation&&t.after.push(e),"before"===e.relation&&t.before.push(e)}});var a;return(a=n,a.sort((e,t)=>Sr[t.step]-Sr[e.step]||vr[t.priority||"normal"]-vr[e.priority||"normal"])).map(i).reduce((e,t)=>(e.push(...t),e),[])},a={add:(t,r={})=>{const{name:s,override:i,aliases:o}=r,a={step:"initialize",priority:"normal",middleware:t,...r},c=yr(s,o);if(c.length>0){if(c.some(e=>n.has(e))){if(!i)throw new Error(`Duplicate middleware name '${wr(s,o)}'`);for(const t of c){const r=e.findIndex(e=>e.name===t||e.aliases?.some(e=>e===t));if(-1===r)continue;const n=e[r];if(n.step!==a.step||a.priority!==n.priority)throw new Error(`"${wr(n.name,n.aliases)}" middleware with ${n.priority} priority in ${n.step} step cannot be overridden by "${wr(s,o)}" middleware with ${a.priority} priority in ${a.step} step.`);e.splice(r,1)}}for(const e of c)n.add(e)}e.push(a)},addRelativeTo:(e,r)=>{const{name:s,override:i,aliases:o}=r,a={middleware:e,...r},c=yr(s,o);if(c.length>0){if(c.some(e=>n.has(e))){if(!i)throw new Error(`Duplicate middleware name '${wr(s,o)}'`);for(const e of c){const r=t.findIndex(t=>t.name===e||t.aliases?.some(t=>t===e));if(-1===r)continue;const n=t[r];if(n.toMiddleware!==a.toMiddleware||n.relation!==a.relation)throw new Error(`"${wr(n.name,n.aliases)}" middleware ${n.relation} "${n.toMiddleware}" middleware cannot be overridden by "${wr(s,o)}" middleware ${a.relation} "${a.toMiddleware}" middleware.`);t.splice(r,1)}}for(const e of c)n.add(e)}t.push(a)},clone:()=>s(br()),use:e=>{e.applyToStack(a)},remove:r=>"string"==typeof r?(r=>{let s=!1;const i=e=>{const t=yr(e.name,e.aliases);if(t.includes(r)){s=!0;for(const e of t)n.delete(e);return!1}return!0};return e=e.filter(i),t=t.filter(i),s})(r):(r=>{let s=!1;const i=e=>{if(e.middleware===r){s=!0;for(const t of yr(e.name,e.aliases))n.delete(t);return!1}return!0};return e=e.filter(i),t=t.filter(i),s})(r),removeByTag:r=>{let s=!1;const i=e=>{const{tags:t,name:i,aliases:o}=e;if(t&&t.includes(r)){const e=yr(i,o);for(const t of e)n.delete(t);return s=!0,!1}return!0};return e=e.filter(i),t=t.filter(i),s},concat:e=>{const t=s(br());return t.use(e),t.identifyOnResolve(r||t.identifyOnResolve()||(e.identifyOnResolve?.()??!1)),t},applyToStack:s,identify:()=>o(!0).map(e=>{const t=e.step??e.relation+" "+e.toMiddleware;return wr(e.name,e.aliases)+" - "+t}),identifyOnResolve:e=>("boolean"==typeof e&&(r=e),r),resolve:(e,t)=>{for(const r of o().map(e=>e.middleware).reverse())e=r(e,t);return r&&console.log(a.identify()),e}};return a},Sr={initialize:5,serialize:4,build:3,finalizeRequest:2,deserialize:1},vr={high:3,normal:2,low:1};class Er{config;middlewareStack=br();initConfig;handlers;constructor(e){this.config=e;const{protocol:t,protocolSettings:r}=e;r&&"function"==typeof t&&(e.protocol=new t(r))}send(e,t,r){const n="function"!=typeof t?t:void 0,s="function"==typeof t?t:r;let i;if(void 0===n&&!0===this.config.cacheMiddleware){this.handlers||(this.handlers=/* @__PURE__ */new WeakMap);const t=this.handlers;t.has(e.constructor)?i=t.get(e.constructor):(i=e.resolveMiddleware(this.middlewareStack,this.config,n),t.set(e.constructor,i))}else delete this.handlers,i=e.resolveMiddleware(this.middlewareStack,this.config,n);if(!s)return i(e).then(e=>e.output);i(e).then(e=>s(null,e.output),e=>s(e)).catch(()=>{})}destroy(){this.config?.requestHandler?.destroy?.(),delete this.handlers}}const Cr="***SensitiveInformation***";function xr(e,t){if(null==t)return t;const r=Ae.of(e);if(r.getMergedTraits().sensitive)return Cr;if(r.isListSchema()){if(!!r.getValueSchema().getMergedTraits().sensitive)return Cr}else if(r.isMapSchema()){if(!!r.getKeySchema().getMergedTraits().sensitive||!!r.getValueSchema().getMergedTraits().sensitive)return Cr}else if(r.isStructSchema()&&"object"==typeof t){const e=t,n={};for(const[t,s]of r.structIterator())null!=e[t]&&(n[t]=xr(s,e[t]));return n}return t}class Ar{middlewareStack=br();schema;static classBuilder(){return new Rr}resolveMiddlewareWithContext(e,t,r,{middlewareFn:n,clientName:s,commandName:o,inputFilterSensitiveLog:a,outputFilterSensitiveLog:c,smithyContext:u,additionalContext:d,CommandCtor:l}){for(const i of n.bind(this)(l,e,t,r))this.middlewareStack.use(i);const h=e.concat(this.middlewareStack),{logger:p}=t,f={logger:p,clientName:s,commandName:o,inputFilterSensitiveLog:a,outputFilterSensitiveLog:c,[i]:{commandInstance:this,...u},...d},{requestHandler:m}=t;return h.resolve(e=>m.handle(e.request,r||{}),f)}}class Rr{_init=()=>{};_ep={};_middlewareFn=()=>[];_commandName="";_clientName="";_additionalContext={};_smithyContext={};_inputFilterSensitiveLog=void 0;_outputFilterSensitiveLog=void 0;_serializer=null;_deserializer=null;_operationSchema;init(e){this._init=e}ep(e){return this._ep=e,this}m(e){return this._middlewareFn=e,this}s(e,t,r={}){return this._smithyContext={service:e,operation:t,...r},this}c(e={}){return this._additionalContext=e,this}n(e,t){return this._clientName=e,this._commandName=t,this}f(e=e=>e,t=e=>e){return this._inputFilterSensitiveLog=e,this._outputFilterSensitiveLog=t,this}ser(e){return this._serializer=e,this}de(e){return this._deserializer=e,this}sc(e){return this._operationSchema=e,this._smithyContext.operationSchema=e,this}build(){const e=this;let t;return t=class extends Ar{input;static getEndpointParameterInstructions(){return e._ep}constructor(...[t]){super(),this.input=t??{},e._init(this),this.schema=e._operationSchema}resolveMiddleware(r,n,s){const i=e._operationSchema,o=i?.[4]??i?.input,a=i?.[5]??i?.output;return this.resolveMiddlewareWithContext(r,n,s,{CommandCtor:t,middlewareFn:e._middlewareFn,clientName:e._clientName,commandName:e._commandName,inputFilterSensitiveLog:e._inputFilterSensitiveLog??(i?xr.bind(null,o):e=>e),outputFilterSensitiveLog:e._outputFilterSensitiveLog??(i?xr.bind(null,a):e=>e),smithyContext:e._smithyContext,additionalContext:e._additionalContext})}serialize=e._serializer;deserialize=e._deserializer}}}class kr extends Error{$fault;$response;$retryable;$metadata;constructor(e){super(e.message),Object.setPrototypeOf(this,Object.getPrototypeOf(this).constructor.prototype),this.name=e.name,this.$fault=e.$fault,this.$metadata=e.$metadata}static isInstance(e){if(!e)return!1;const t=e;return kr.prototype.isPrototypeOf(t)||Boolean(t.$fault)&&Boolean(t.$metadata)&&("client"===t.$fault||"server"===t.$fault)}static[Symbol.hasInstance](e){if(!e)return!1;const t=e;return this===kr?kr.isInstance(e):!!kr.isInstance(e)&&(t.name&&this.name?this.prototype.isPrototypeOf(e)||t.name===this.name:this.prototype.isPrototypeOf(e))}}const Tr=(e,t={})=>{Object.entries(t).filter(([,e])=>void 0!==e).forEach(([t,r])=>{null!=e[t]&&""!==e[t]||(e[t]=r)});const r=e.message||e.Message||"UnknownError";return e.message=r,delete e.Message,e},Pr=e=>{switch(e){case"standard":case"cross-region":return{retryMode:"standard",connectionTimeout:3100};case"in-region":return{retryMode:"standard",connectionTimeout:1100};case"mobile":return{retryMode:"standard",connectionTimeout:3e4};default:return{}}},Ir=e=>Object.assign((e=>{const t=[];for(const r in n){const s=n[r];void 0!==e[s]&&t.push({algorithmId:()=>s,checksumConstructor:()=>e[s]})}return{addChecksumAlgorithm(e){t.push(e)},checksumAlgorithms:()=>t}})(e),(e=>({setRetryStrategy(t){e.retryStrategy=t},retryStrategy:()=>e.retryStrategy}))(e)),Mr=e=>{const t="#text";for(const r in e)e.hasOwnProperty(r)&&void 0!==e[r][t]?e[r]=e[r][t]:"object"==typeof e[r]&&null!==e[r]&&(e[r]=Mr(e[r]));return e};class Or{trace(){}debug(){}info(){}warn(){}error(){}}class Ur{queryCompat;constructor(e=!1){this.queryCompat=e}resolveRestContentType(e,t){const r=t.getMemberSchemas(),n=Object.values(r).find(e=>!!e.getMergedTraits().httpPayload);if(n){const t=n.getMergedTraits().mediaType;return t||(n.isStringSchema()?"text/plain":n.isBlobSchema()?"application/octet-stream":e)}if(!t.isUnitSchema()){if(Object.values(r).find(e=>{const{httpQuery:t,httpQueryParams:r,httpHeader:n,httpLabel:s,httpPrefixHeaders:i}=e.getMergedTraits();return!t&&!r&&!n&&!s&&void 0===i}))return e}}async getErrorSchemaOrThrowBaseException(e,t,r,n,s,i){let o=t,a=e;e.includes("#")&&([o,a]=e.split("#"));const c={$metadata:s,$fault:r.statusCode<500?"client":"server"},u=Pe.for(o);try{return{errorSchema:i?.(u,a)??u.getSchema(e),errorMetadata:c}}catch(d){n.message=n.message??n.Message??"UnknownError";const e=Pe.for("smithy.ts.sdk.synthetic."+o),t=e.getBaseException();if(t){const r=e.getErrorCtor(t)??Error;throw this.decorateServiceException(Object.assign(new r({name:a}),c),n)}throw this.decorateServiceException(Object.assign(new Error(a),c),n)}}decorateServiceException(e,t={}){if(this.queryCompat){const r=e.Message??t.Message,n=Tr(e,t);r&&(n.message=r),n.Error={...n.Error,Type:n.Error.Type,Code:n.Error.Code,Message:n.Error.message??n.Error.Message??r};const s=n.$metadata.requestId;return s&&(n.RequestId=s),n}return Tr(e,t)}setQueryCompatError(e,t){const r=t.headers?.["x-amzn-query-error"];if(void 0!==e&&null!=r){const[t,n]=r.split(";"),s=Object.entries(e),i={Code:t,Type:n};Object.assign(e,i);for(const[e,r]of s)i["message"===e?"Message":e]=r;delete i.__type,e.Error=i}}queryCompatOutput(e,t){e.Error&&(t.Error=e.Error),e.Type&&(t.Type=e.Type),e.Code&&(t.Code=e.Code)}findQueryCompatibleError(e,t){try{return e.getSchema(t)}catch(r){return e.find(e=>Ae.of(e).getMergedTraits().awsQueryError?.[0]===t)}}}class Nr{serdeContext;setSerdeContext(e){this.serdeContext=e}}class $r{from;to;keys;constructor(e,t){this.from=e,this.to=t,this.keys=new Set(Object.keys(this.from).filter(e=>"__type"!==e))}mark(e){this.keys.delete(e)}hasUnknown(){return 1===this.keys.size&&0===Object.keys(this.to).length}writeUnknown(){if(this.hasUnknown()){const e=this.keys.values().next().value,t=this.from[e];this.to.$unknown=[e,t]}}}function Dr(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}class Lr{value;constructor(e){this.value=e}toString(){return(""+this.value).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&apos;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\r/g,"&#x0D;").replace(/\n/g,"&#x0A;").replace(/\u0085/g,"&#x85;").replace(/\u2028/,"&#x2028;")}}class _r{name;children;attributes={};static of(e,t,r){const n=new _r(e);return void 0!==t&&n.addChildNode(new Lr(t)),void 0!==r&&n.withName(r),n}constructor(e,t=[]){this.name=e,this.children=t}withName(e){return this.name=e,this}addAttribute(e,t){return this.attributes[e]=t,this}addChildNode(e){return this.children.push(e),this}removeAttribute(e){return delete this.attributes[e],this}n(e){return this.name=e,this}c(e){return this.children.push(e),this}a(e,t){return null!=t&&(this.attributes[e]=t),this}cc(e,t,r=t){if(null!=e[t]){const n=_r.of(t,e[t]).withName(r);this.c(n)}}l(e,t,r,n){if(null!=e[t]){n().map(e=>{e.withName(r),this.c(e)})}}lc(e,t,r,n){if(null!=e[t]){const e=n(),t=new _r(r);e.map(e=>{t.c(e)}),this.c(t)}}toString(){const e=Boolean(this.children.length);let t=`<${this.name}`;const r=this.attributes;for(const n of Object.keys(r)){const e=r[n];null!=e&&(t+=` ${n}="${Dr(""+e)}"`)}return t+(e?`>${this.children.map(e=>e.toString()).join("")}</${this.name}>`:"/>")}}let Br;class zr extends Nr{settings;stringDeserializer;constructor(e){super(),this.settings=e,this.stringDeserializer=new kt(e)}setSerdeContext(e){this.serdeContext=e,this.stringDeserializer.setSerdeContext(e)}read(e,t,r){const n=Ae.of(e),s=n.getMemberSchemas();if(n.isStructSchema()&&n.isMemberSchema()&&!!Object.values(s).find(e=>!!e.getMemberTraits().eventPayload)){const e={},r=Object.keys(s)[0];return s[r].isBlobSchema()?e[r]=t:e[r]=this.read(s[r],t),e}const i=(this.serdeContext?.utf8Encoder??F)(t),o=this.parseXml(i);return this.readSchema(e,r?o[r]:o)}readSchema(e,t){const r=Ae.of(e);if(r.isUnitSchema())return;const n=r.getMergedTraits();if(r.isListSchema()&&!Array.isArray(t))return this.readSchema(r,[t]);if(null==t)return t;if("object"==typeof t){const e=!!n.sparse,s=!!n.xmlFlattened;if(r.isListSchema()){const n=r.getValueSchema(),i=[],o=n.getMergedTraits().xmlName??"member",a=s?t:(t[0]??t)[o],c=Array.isArray(a)?a:[a];for(const t of c)(null!=t||e)&&i.push(this.readSchema(n,t));return i}const i={};if(r.isMapSchema()){const n=r.getKeySchema(),o=r.getValueSchema();let a;a=s?Array.isArray(t)?t:[t]:Array.isArray(t.entry)?t.entry:[t.entry];const c=n.getMergedTraits().xmlName??"key",u=o.getMergedTraits().xmlName??"value";for(const t of a){const r=t[c],n=t[u];(null!=n||e)&&(i[r]=this.readSchema(o,n))}return i}if(r.isStructSchema()){const e=r.isUnionSchema();let n;e&&(n=new $r(t,i));for(const[s,o]of r.structIterator()){const r=o.getMergedTraits(),a=r.httpPayload?r.xmlName??o.getName():o.getMemberTraits().xmlName??s;e&&n.mark(a),null!=t[a]&&(i[s]=this.readSchema(o,t[a]))}return e&&n.writeUnknown(),i}if(r.isDocumentSchema())return t;throw new Error(`@aws-sdk/core/protocols - xml deserializer unhandled schema type for ${r.getName(!0)}`)}return r.isListSchema()?[]:r.isMapSchema()||r.isStructSchema()?{}:this.stringDeserializer.read(r,t)}parseXml(e){if(e.length){let r;try{r=function(e){Br||(Br=new DOMParser);const t=Br.parseFromString(e,"application/xml");if(t.getElementsByTagName("parsererror").length>0)throw new Error("DOMParser XML parsing error.");const r=e=>{if(e.nodeType===Node.TEXT_NODE&&e.textContent?.trim())return e.textContent;if(e.nodeType===Node.ELEMENT_NODE){const t=e;if(0===t.attributes.length&&0===t.childNodes.length)return"";const n={},s=Array.from(t.attributes);for(const e of s)n[`${e.name}`]=e.value;const i=Array.from(t.childNodes);for(const e of i){const o=r(e);if(null!=o){const t=e.nodeName;if(1===i.length&&0===s.length&&"#text"===t)return o;n[t]?Array.isArray(n[t])?n[t].push(o):n[t]=[n[t],o]:n[t]=o}else if(1===i.length&&0===s.length)return t.textContent}return n}return null};return{[t.documentElement.nodeName]:r(t.documentElement)}}(e)}catch(t){throw t&&"object"==typeof t&&Object.defineProperty(t,"$responseBodyText",{value:e}),t}const n="#text",s=Object.keys(r)[0],i=r[s];return i[n]&&(i[s]=i[n],delete i[n]),Mr(i)}return{}}}class jr extends Nr{settings;stringBuffer;byteBuffer;buffer;constructor(e){super(),this.settings=e}write(e,t){const r=Ae.of(e);if(r.isStringSchema()&&"string"==typeof t)this.stringBuffer=t;else if(r.isBlobSchema())this.byteBuffer="byteLength"in t?t:(this.serdeContext?.base64Decoder??j)(t);else{this.buffer=this.writeStruct(r,t,void 0);const e=r.getMergedTraits();e.httpPayload&&!e.xmlName&&this.buffer.withName(r.getName())}}flush(){if(void 0!==this.byteBuffer){const e=this.byteBuffer;return delete this.byteBuffer,e}if(void 0!==this.stringBuffer){const e=this.stringBuffer;return delete this.stringBuffer,e}const e=this.buffer;return this.settings.xmlNamespace&&(e?.attributes?.xmlns||e.addAttribute("xmlns",this.settings.xmlNamespace)),delete this.buffer,e.toString()}writeStruct(e,t,r){const n=e.getMergedTraits(),s=e.isMemberSchema()&&!n.httpPayload?e.getMemberTraits().xmlName??e.getMemberName():n.xmlName??e.getName();if(!s||!e.isStructSchema())throw new Error(`@aws-sdk/core/protocols - xml serializer, cannot write struct with empty name or non-struct, schema=${e.getName(!0)}.`);const i=_r.of(s),[o,a]=this.getXmlnsAttribute(e,r);for(const[u,d]of function*(e,t){if(e.isUnitSchema())return;const r=e.getSchema();for(let n=0;n<r[4].length;++n){const e=r[4][n],s=r[5][n],i=new Ae([s,0],e);(e in t||i.isIdempotencyToken())&&(yield[e,i])}}(e,t)){const e=t[u];if(null!=e||d.isIdempotencyToken()){if(d.getMergedTraits().xmlAttribute){i.addAttribute(d.getMergedTraits().xmlName??u,this.writeSimple(d,e));continue}if(d.isListSchema())this.writeList(d,e,i,a);else if(d.isMapSchema())this.writeMap(d,e,i,a);else if(d.isStructSchema())i.addChildNode(this.writeStruct(d,e,a));else{const t=_r.of(d.getMergedTraits().xmlName??d.getMemberName());this.writeSimpleInto(d,e,t,a),i.addChildNode(t)}}}const{$unknown:c}=t;if(c&&e.isUnionSchema()&&Array.isArray(c)&&1===Object.keys(t).length){const[e,r]=c,n=_r.of(e);if("string"!=typeof r){if(!(t instanceof _r||t instanceof Lr))throw new Error("@aws-sdk - $unknown union member in XML requires value of type string, @aws-sdk/xml-builder::XmlNode or XmlText.");i.addChildNode(t)}this.writeSimpleInto(0,r,n,a),i.addChildNode(n)}return a&&i.addAttribute(o,a),i}writeList(e,t,r,n){if(!e.isMemberSchema())throw new Error(`@aws-sdk/core/protocols - xml serializer, cannot write non-member list: ${e.getName(!0)}`);const s=e.getMergedTraits(),i=e.getValueSchema(),o=i.getMergedTraits(),a=!!o.sparse,c=!!s.xmlFlattened,[u,d]=this.getXmlnsAttribute(e,n),l=(t,r)=>{if(i.isListSchema())this.writeList(i,Array.isArray(r)?r:[r],t,d);else if(i.isMapSchema())this.writeMap(i,r,t,d);else if(i.isStructSchema()){const n=this.writeStruct(i,r,d);t.addChildNode(n.withName(c?s.xmlName??e.getMemberName():o.xmlName??"member"))}else{const n=_r.of(c?s.xmlName??e.getMemberName():o.xmlName??"member");this.writeSimpleInto(i,r,n,d),t.addChildNode(n)}};if(c)for(const h of t)(a||null!=h)&&l(r,h);else{const n=_r.of(s.xmlName??e.getMemberName());d&&n.addAttribute(u,d);for(const e of t)(a||null!=e)&&l(n,e);r.addChildNode(n)}}writeMap(e,t,r,n,s=!1){if(!e.isMemberSchema())throw new Error(`@aws-sdk/core/protocols - xml serializer, cannot write non-member map: ${e.getName(!0)}`);const i=e.getMergedTraits(),o=e.getKeySchema(),a=o.getMergedTraits().xmlName??"key",c=e.getValueSchema(),u=c.getMergedTraits(),d=u.xmlName??"value",l=!!u.sparse,h=!!i.xmlFlattened,[p,f]=this.getXmlnsAttribute(e,n),m=(e,t,r)=>{const n=_r.of(a,t),[s,i]=this.getXmlnsAttribute(o,f);i&&n.addAttribute(s,i),e.addChildNode(n);let u=_r.of(d);c.isListSchema()?this.writeList(c,r,u,f):c.isMapSchema()?this.writeMap(c,r,u,f,!0):c.isStructSchema()?u=this.writeStruct(c,r,f):this.writeSimpleInto(c,r,u,f),e.addChildNode(u)};if(h){for(const[g,y]of Object.entries(t))if(l||null!=y){const t=_r.of(i.xmlName??e.getMemberName());m(t,g,y),r.addChildNode(t)}}else{let n;s||(n=_r.of(i.xmlName??e.getMemberName()),f&&n.addAttribute(p,f),r.addChildNode(n));for(const[e,i]of Object.entries(t))if(l||null!=i){const t=_r.of("entry");m(t,e,i),(s?r:n).addChildNode(t)}}}writeSimple(e,t){if(null===t)throw new Error("@aws-sdk/core/protocols - (XML serializer) cannot write null value.");const r=Ae.of(e);let n=null;if(t&&"object"==typeof t)if(r.isBlobSchema())n=(this.serdeContext?.base64Encoder??K)(t);else{if(!(r.isTimestampSchema()&&t instanceof Date)){if(r.isBigDecimalSchema()&&t)return t instanceof Et?t.string:String(t);throw r.isMapSchema()||r.isListSchema()?new Error("@aws-sdk/core/protocols - xml serializer, cannot call _write() on List/Map schema, call writeList or writeMap() instead."):new Error(`@aws-sdk/core/protocols - xml serializer, unhandled schema type for object value and schema: ${r.getName(!0)}`)}switch(Rt(r,this.settings)){case 5:n=t.toISOString().replace(".000Z","Z");break;case 6:n=qe(t);break;case 7:n=String(t.getTime()/1e3);break;default:console.warn("Missing timestamp format, using http date",t),n=qe(t)}}if((r.isBooleanSchema()||r.isNumericSchema()||r.isBigIntegerSchema()||r.isBigDecimalSchema())&&(n=String(t)),r.isStringSchema()&&(n=void 0===t&&r.isIdempotencyToken()?it():String(t)),null===n)throw new Error(`Unhandled schema-value pair ${r.getName(!0)}=${t}`);return n}writeSimpleInto(e,t,r,n){const s=this.writeSimple(e,t),i=Ae.of(e),o=new Lr(s),[a,c]=this.getXmlnsAttribute(i,n);c&&r.addAttribute(a,c),r.addChildNode(o)}getXmlnsAttribute(e,t){const r=e.getMergedTraits(),[n,s]=r.xmlNamespace??[];return s&&s!==t?[n?`xmlns:${n}`:"xmlns",s]:[void 0,void 0]}}class Hr extends Nr{settings;constructor(e){super(),this.settings=e}createSerializer(){const e=new jr(this.settings);return e.setSerdeContext(this.serdeContext),e}createDeserializer(){const e=new zr(this.settings);return e.setSerdeContext(this.serdeContext),e}}class qr extends At{codec;serializer;deserializer;mixin=new Ur;constructor(e){super(e);const t={timestampFormat:{useTrait:!0,default:5},httpBindings:!0,xmlNamespace:e.xmlNamespace,serviceNamespace:e.defaultNamespace};this.codec=new Hr(t),this.serializer=new It(this.codec.createSerializer(),t),this.deserializer=new Tt(this.codec.createDeserializer(),t)}getPayloadCodec(){return this.codec}getShapeId(){return"aws.protocols#restXml"}async serializeRequest(e,t,r){const n=await super.serializeRequest(e,t,r),s=Ae.of(e.input);if(!n.headers["content-type"]){const e=this.mixin.resolveRestContentType(this.getDefaultContentType(),s);e&&(n.headers["content-type"]=e)}return"string"!=typeof n.body||n.headers["content-type"]!==this.getDefaultContentType()||n.body.startsWith("<?xml ")||this.hasUnstructuredPayloadBinding(s)||(n.body='<?xml version="1.0" encoding="UTF-8"?>'+n.body),n}async deserializeResponse(e,t,r){return super.deserializeResponse(e,t,r)}async handleError(e,t,r,n,s){const i=((e,t)=>void 0!==t?.Error?.Code?t.Error.Code:void 0!==t?.Code?t.Code:404==e.statusCode?"NotFound":void 0)(r,n)??"Unknown",{errorSchema:o,errorMetadata:a}=await this.mixin.getErrorSchemaOrThrowBaseException(i,this.options.defaultNamespace,r,n,s),c=Ae.of(o),u=n.Error?.message??n.Error?.Message??n.message??n.Message??"Unknown",d=new(Pe.for(o[1]).getErrorCtor(o)??Error)(u);await this.deserializeHttpMessage(o,t,r,n);const l={};for(const[h,p]of c.structIterator()){const e=p.getMergedTraits().xmlName??h,t=n.Error?.[e]??n[e];l[h]=this.codec.createDeserializer().readSchema(p,t)}throw this.mixin.decorateServiceException(Object.assign(d,a,{$fault:c.getMergedTraits().error,message:u},l),n)}getDefaultContentType(){return"application/xml"}hasUnstructuredPayloadBinding(e){for(const[,t]of e.structIterator())if(t.getMergedTraits().httpPayload)return!(t.isStructSchema()||t.isMapSchema()||t.isListSchema());return!1}}const Fr=[g.CRC32,g.CRC32C,g.CRC64NVME,g.SHA1,g.SHA256],Kr=[g.SHA256,g.SHA1,g.CRC32,g.CRC32C,g.CRC64NVME],Vr=e=>e===g.MD5?"content-md5":`x-amz-checksum-${e.toLowerCase()}`,Wr=e=>void 0!==e&&"string"!=typeof e&&!ArrayBuffer.isView(e)&&!rr(e);function Zr(e,t,r,n){return new(r||(r=Promise))(function(s,i){function o(e){try{c(n.next(e))}catch(t){i(t)}}function a(e){try{c(n.throw(e))}catch(t){i(t)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(o,a)}c((n=n.apply(e,t||[])).next())})}function Gr(e,t){var r,n,s,i={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=a(0),o.throw=a(1),o.return=a(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(c){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(i=0)),i;)try{if(r=1,n&&(s=2&a[0]?n.return:a[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,a[1])).done)return s;switch(n=0,s&&(a=[2&a[0],s.value]),a[0]){case 0:case 1:s=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,n=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(s=i.trys,(s=s.length>0&&s[s.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!s||a[1]>s[0]&&a[1]<s[3])){i.label=a[1];break}if(6===a[0]&&i.label<s[1]){i.label=s[1],s=a;break}if(s&&i.label<s[2]){i.label=s[2],i.ops.push(a);break}s[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(c){a=[6,c],n=0}finally{r=s=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}function Xr(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}"function"==typeof SuppressedError&&SuppressedError;const Yr=e=>(new TextEncoder).encode(e);var Jr="undefined"!=typeof Buffer&&Buffer.from?function(e){return Buffer.from(e,"utf8")}:Yr;function Qr(e){return e instanceof Uint8Array?e:"string"==typeof e?Jr(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e)}function en(e){return"string"==typeof e?0===e.length:0===e.byteLength}function tn(e){return new Uint8Array([(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e])}function rn(e){if(!Uint32Array.from){for(var t=new Uint32Array(e.length),r=0;r<e.length;)t[r]=e[r],r+=1;return t}return Uint32Array.from(e)}var nn=function(){function e(){this.crc32c=new sn}return e.prototype.update=function(e){en(e)||this.crc32c.update(Qr(e))},e.prototype.digest=function(){return Zr(this,void 0,void 0,function(){return Gr(this,function(e){return[2,tn(this.crc32c.digest())]})})},e.prototype.reset=function(){this.crc32c=new sn},e}(),sn=function(){function e(){this.checksum=4294967295}return e.prototype.update=function(e){var t,r;try{for(var n=Xr(e),s=n.next();!s.done;s=n.next()){var i=s.value;this.checksum=this.checksum>>>8^on[255&(this.checksum^i)]}}catch(o){t={error:o}}finally{try{s&&!s.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}return this},e.prototype.digest=function(){return(4294967295^this.checksum)>>>0},e}(),on=rn([0,4067132163,3778769143,324072436,3348797215,904991772,648144872,3570033899,2329499855,2024987596,1809983544,2575936315,1296289744,3207089363,2893594407,1578318884,274646895,3795141740,4049975192,51262619,3619967088,632279923,922689671,3298075524,2592579488,1760304291,2075979607,2312596564,1562183871,2943781820,3156637768,1313733451,549293790,3537243613,3246849577,871202090,3878099393,357341890,102525238,4101499445,2858735121,1477399826,1264559846,3107202533,1845379342,2677391885,2361733625,2125378298,820201905,3263744690,3520608582,598981189,4151959214,85089709,373468761,3827903834,3124367742,1213305469,1526817161,2842354314,2107672161,2412447074,2627466902,1861252501,1098587580,3004210879,2688576843,1378610760,2262928035,1955203488,1742404180,2511436119,3416409459,969524848,714683780,3639785095,205050476,4266873199,3976438427,526918040,1361435347,2739821008,2954799652,1114974503,2529119692,1691668175,2005155131,2247081528,3690758684,697762079,986182379,3366744552,476452099,3993867776,4250756596,255256311,1640403810,2477592673,2164122517,1922457750,2791048317,1412925310,1197962378,3037525897,3944729517,427051182,170179418,4165941337,746937522,3740196785,3451792453,1070968646,1905808397,2213795598,2426610938,1657317369,3053634322,1147748369,1463399397,2773627110,4215344322,153784257,444234805,3893493558,1021025245,3467647198,3722505002,797665321,2197175160,1889384571,1674398607,2443626636,1164749927,3070701412,2757221520,1446797203,137323447,4198817972,3910406976,461344835,3484808360,1037989803,781091935,3705997148,2460548119,1623424788,1939049696,2180517859,1429367560,2807687179,3020495871,1180866812,410100952,3927582683,4182430767,186734380,3756733383,763408580,1053836080,3434856499,2722870694,1344288421,1131464017,2971354706,1708204729,2545590714,2229949006,1988219213,680717673,3673779818,3383336350,1002577565,4010310262,493091189,238226049,4233660802,2987750089,1082061258,1395524158,2705686845,1972364758,2279892693,2494862625,1725896226,952904198,3399985413,3656866545,731699698,4283874585,222117402,510512622,3959836397,3280807620,837199303,582374963,3504198960,68661723,4135334616,3844915500,390545967,1230274059,3141532936,2825850620,1510247935,2395924756,2091215383,1878366691,2644384480,3553878443,565732008,854102364,3229815391,340358836,3861050807,4117890627,119113024,1493875044,2875275879,3090270611,1247431312,2660249211,1828433272,2141937292,2378227087,3811616794,291187481,34330861,4032846830,615137029,3603020806,3314634738,939183345,1776939221,2609017814,2295496738,2058945313,2926798794,1545135305,1330124605,3173225534,4084100981,17165430,307568514,3762199681,888469610,3332340585,3587147933,665062302,2042050490,2346497209,2559330125,1793573966,3190661285,1279665062,1595330642,2910671697]);let an,cn,un,dn,ln,hn,pn,fn,mn;const gn=()=>{an||(an=(()=>{const e=new Array(8);for(let t=0;t<8;t++){const r=new Array(512);for(let e=0;e<256;e++){let n=BigInt(e);for(let e=0;e<8*(t+1);e++)1n&n?n=n>>1n^0x9a6c9329ac4bc9b5n:n>>=1n;r[2*e]=Number(n>>32n&0xffffffffn),r[2*e+1]=Number(0xffffffffn&n)}e[t]=new Uint32Array(r)}return e})(),[cn,un,dn,ln,hn,pn,fn,mn]=an)};class yn{c1=0;c2=0;constructor(){gn(),this.reset()}update(e){const t=e.length;let r=0,n=this.c1,s=this.c2;for(;r+8<=t;){const t=(255&(s^e[r++]))<<1,i=(255&(s>>>8^e[r++]))<<1,o=(255&(s>>>16^e[r++]))<<1,a=(255&(s>>>24^e[r++]))<<1,c=(255&(n^e[r++]))<<1,u=(255&(n>>>8^e[r++]))<<1,d=(255&(n>>>16^e[r++]))<<1,l=(255&(n>>>24^e[r++]))<<1;n=mn[t]^fn[i]^pn[o]^hn[a]^ln[c]^dn[u]^un[d]^cn[l],s=mn[t+1]^fn[i+1]^pn[o+1]^hn[a+1]^ln[c+1]^dn[u+1]^un[d+1]^cn[l+1]}for(;r<t;){const t=(255&(s^e[r]))<<1;s=(s>>>8|(255&n)<<24)>>>0,n=n>>>8^cn[t],s^=cn[t+1],r++}this.c1=n,this.c2=s}async digest(){const e=4294967295^this.c1,t=4294967295^this.c2;return new Uint8Array([e>>>24,e>>>16&255,e>>>8&255,255&e,t>>>24,t>>>16&255,t>>>8&255,255&t])}reset(){this.c1=4294967295,this.c2=4294967295}}var wn=function(){function e(){this.crc32=new bn}return e.prototype.update=function(e){en(e)||this.crc32.update(Qr(e))},e.prototype.digest=function(){return Zr(this,void 0,void 0,function(){return Gr(this,function(e){return[2,tn(this.crc32.digest())]})})},e.prototype.reset=function(){this.crc32=new bn},e}(),bn=function(){function e(){this.checksum=4294967295}return e.prototype.update=function(e){var t,r;try{for(var n=Xr(e),s=n.next();!s.done;s=n.next()){var i=s.value;this.checksum=this.checksum>>>8^Sn[255&(this.checksum^i)]}}catch(o){t={error:o}}finally{try{s&&!s.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}return this},e.prototype.digest=function(){return(4294967295^this.checksum)>>>0},e}(),Sn=rn([0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117]);const vn=(e,t)=>{switch(e){case g.MD5:return t.md5;case g.CRC32:return wn;case g.CRC32C:return nn;case g.CRC64NVME:return yn;case g.SHA1:return t.sha1;case g.SHA256:return t.sha256;default:throw new Error(`Unsupported checksum algorithm: ${e}`)}},En=(e,t)=>{const r=new e;return r.update(q(t||"")),r.digest()},Cn={name:"flexibleChecksumsMiddleware",step:"build",tags:["BODY_CHECKSUM"],override:!0},xn=(e,t)=>(r,n)=>async s=>{if(!o.isInstance(s.request))return r(s);if(((e,t)=>{const r=e.toLowerCase();for(const n of Object.keys(t))if(n.toLowerCase().startsWith(r))return!0;return!1})("x-amz-checksum-",s.request.headers))return r(s);const{request:i,input:a}=s,{body:c,headers:u}=i,{base64Encoder:l,streamHasher:h}=e,{requestChecksumRequired:p,requestAlgorithmMember:f}=t,m=await e.requestChecksumCalculation(),y=f?.name,w=f?.httpHeader;y&&!a[y]&&(m===d||p)&&(a[y]=S,w&&(u[w]=S));const b=((e,{requestChecksumRequired:t,requestAlgorithmMember:r,requestChecksumCalculation:n})=>{if(!r)return n===d||t?S:void 0;if(!e[r])return;const s=e[r];if(!Fr.includes(s))throw new Error(`The checksum algorithm "${s}" is not supported by the client. Select one of ${Fr}.`);return s})(a,{requestChecksumRequired:p,requestAlgorithmMember:f?.name,requestChecksumCalculation:m});let E=c,C=u;if(b){switch(b){case g.CRC32:v(n,"FLEXIBLE_CHECKSUMS_REQ_CRC32","U");break;case g.CRC32C:v(n,"FLEXIBLE_CHECKSUMS_REQ_CRC32C","V");break;case g.CRC64NVME:v(n,"FLEXIBLE_CHECKSUMS_REQ_CRC64","W");break;case g.SHA1:v(n,"FLEXIBLE_CHECKSUMS_REQ_SHA1","X");break;case g.SHA256:v(n,"FLEXIBLE_CHECKSUMS_REQ_SHA256","Y")}const t=Vr(b),r=vn(b,e);if(Wr(c)){const{getAwsChunkedEncodingStream:s,bodyLengthChecker:i}=e;E=s("number"==typeof e.requestStreamBufferSize&&e.requestStreamBufferSize>=8192?J(c,e.requestStreamBufferSize,n.logger):c,{base64Encoder:l,bodyLengthChecker:i,checksumLocationName:t,checksumAlgorithmFn:r,streamHasher:h}),C={...u,"content-encoding":u["content-encoding"]?`${u["content-encoding"]},aws-chunked`:"aws-chunked","transfer-encoding":"chunked","x-amz-decoded-content-length":u["content-length"],"x-amz-content-sha256":"STREAMING-UNSIGNED-PAYLOAD-TRAILER","x-amz-trailer":t},delete C["content-length"]}else if(!((e,t)=>{const r=e.toLowerCase();for(const n of Object.keys(t))if(r===n.toLowerCase())return!0;return!1})(t,u)){const e=await En(r,c);C={...u,[t]:l(e)}}}try{return await r({...s,request:{...i,headers:C,body:E}})}catch(x){if(x instanceof Error&&"InvalidChunkSizeError"===x.name)try{x.message.endsWith(".")||(x.message+="."),x.message+=" Set [requestStreamBufferSize=number e.g. 65_536] in client constructor to instruct AWS SDK to buffer your input stream."}catch(A){}throw x}},An={name:"flexibleChecksumsInputMiddleware",toMiddleware:"serializerMiddleware",relation:"before",tags:["BODY_CHECKSUM"],override:!0},Rn=(e=[])=>{const t=[];for(const r of Kr)e.includes(r)&&Fr.includes(r)&&t.push(r);return t},kn=async(e,{checksumAlgorithmFn:t,base64Encoder:r})=>r(await En(t,e)),Tn={name:"flexibleChecksumsResponseMiddleware",toMiddleware:"deserializerMiddleware",relation:"after",tags:["BODY_CHECKSUM"],override:!0},Pn=(e,t)=>(r,n)=>async s=>{if(!o.isInstance(s.request))return r(s);const i=s.input,a=await r(s),c=a.response,{requestValidationModeMember:u,responseAlgorithms:d}=t;if(u&&"ENABLED"===i[u]){const{clientName:t,commandName:r}=n;if("S3Client"===t&&"GetObjectCommand"===r&&Rn(d).every(e=>{const t=Vr(e),r=c.headers[t];return!r||(e=>{const t=e.lastIndexOf("-");if(-1!==t){const r=e.slice(t+1);if(!r.startsWith("0")){const e=parseInt(r,10);if(!isNaN(e)&&e>=1&&e<=1e4)return!0}}return!1})(r)}))return a;await(async(e,{config:t,responseAlgorithms:r,logger:n})=>{const s=Rn(r),{body:i,headers:o}=e;for(const c of s){const r=Vr(c),s=o[r];if(s){let o;try{o=vn(c,t)}catch(a){if(c===g.CRC64NVME){n?.warn(`Skipping ${g.CRC64NVME} checksum validation: ${a.message}`);continue}throw a}const{base64Encoder:u}=t;if(Wr(i))return void(e.body=X({expectedChecksum:s,checksumSourceLocation:r,checksum:new o,source:i,base64Encoder:u}));const d=await kn(i,{checksumAlgorithmFn:o,base64Encoder:u});if(d===s)break;throw new Error(`Checksum mismatch: expected "${d}" but received "${s}" in response header "${r}".`)}}})(c,{config:e,responseAlgorithms:d,logger:n.logger})}return a},In=(e,t)=>({applyToStack:r=>{r.add(xn(e,t),Cn),r.addRelativeTo(((e,t)=>(r,n)=>async s=>{const i=s.input,{requestValidationModeMember:o}=t,a=await e.requestChecksumCalculation(),c=await e.responseChecksumValidation();switch(a){case l:v(n,"FLEXIBLE_CHECKSUMS_REQ_WHEN_REQUIRED","a");break;case d:v(n,"FLEXIBLE_CHECKSUMS_REQ_WHEN_SUPPORTED","Z")}switch(c){case f:v(n,"FLEXIBLE_CHECKSUMS_RES_WHEN_REQUIRED","c");break;case p:v(n,"FLEXIBLE_CHECKSUMS_RES_WHEN_SUPPORTED","b")}return o&&!i[o]&&c===p&&(i[o]="ENABLED"),r(s)})(e,t),An),r.addRelativeTo(Pn(e,t),Tn)}});const Mn={name:"hostHeaderMiddleware",step:"build",priority:"low",tags:["HOST"],override:!0},On=e=>({applyToStack:t=>{t.add((e=>t=>async r=>{if(!o.isInstance(r.request))return t(r);const{request:n}=r,{handlerProtocol:s=""}=e.requestHandler.metadata||{};if(s.indexOf("h2")>=0&&!n.headers[":authority"])delete n.headers.host,n.headers[":authority"]=n.hostname+(n.port?":"+n.port:"");else if(!n.headers.host){let e=n.hostname;null!=n.port&&(e+=`:${n.port}`),n.headers.host=e}return t(r)})(e),Mn)}}),Un={name:"loggerMiddleware",tags:["LOGGER"],step:"initialize",override:!0},Nn={step:"build",tags:["RECURSION_DETECTION"],name:"recursionDetectionMiddleware",override:!0,priority:"low"};const $n={step:"finalizeRequest",tags:["CHECK_CONTENT_LENGTH_HEADER"],name:"getCheckContentLengthHeaderPlugin",override:!0},Dn=e=>({applyToStack:e=>{e.add((e,t)=>async r=>{const{request:n}=r;if(o.isInstance(n)&&!("content-length"in n.headers)&&!("x-amz-decoded-content-length"in n.headers)){const e="Are you using a Stream of unknown length as the Body of a PutObject request? Consider using Upload instead from @aws-sdk/lib-storage.";"function"!=typeof t?.logger?.warn||t.logger instanceof Or?console.warn(e):t.logger.warn(e)}return e({...r})},$n)}}),Ln={tags:["REGION_REDIRECT","S3"],name:"regionRedirectEndpointMiddleware",override:!0,relation:"before",toMiddleware:"endpointV2Middleware"};const _n={step:"initialize",tags:["REGION_REDIRECT","S3"],name:"regionRedirectMiddleware",override:!0},Bn=e=>({applyToStack:t=>{var r;t.add(function(e){return(t,r)=>async n=>{try{return await t(n)}catch(s){if(e.followRegionRedirects){const o=s?.$metadata?.httpStatusCode,a="HeadBucketCommand"===r.commandName,c=s?.$response?.headers?.["x-amz-bucket-region"];if(c&&(301===o||400===o&&("IllegalLocationConstraintException"===s?.name||a))){try{const t=c;r.logger?.debug(`Redirecting from ${await e.region()} to ${t}`),r.__s3RegionRedirect=t}catch(i){throw new Error("Region redirect failed: "+i)}return t(n)}}throw s}}}(e),_n),t.addRelativeTo((r=e,(e,t)=>async n=>{const s=await r.region(),i=r.region;let o=()=>{};t.__s3RegionRedirect&&(Object.defineProperty(r,"region",{writable:!1,value:async()=>t.__s3RegionRedirect}),o=()=>Object.defineProperty(r,"region",{writable:!0,value:i}));try{const i=await e(n);if(t.__s3RegionRedirect&&(o(),s!==await r.region()))throw new Error("Region was not restored following S3 region redirect.");return i}catch(a){throw o(),a}}),Ln)}}),zn=e=>(e,t)=>async r=>{const n=await e(r),{response:s}=n;if(a.isInstance(s)&&s.headers.expires){s.headers.expiresstring=s.headers.expires;try{(e=>{if(null==e)return;if("string"!=typeof e)throw new TypeError("RFC-7231 date-times must be expressed as strings");let t=Fe.exec(e);if(t){const[e,r,n,s,i,o,a,c]=t;return We(_e(rt(s)),Xe(n),et(r,"day",1,31),{hours:i,minutes:o,seconds:a,fractionalMilliseconds:c})}if(t=Ke.exec(e),t){const[e,r,n,s,i,o,a,c]=t;return Ge(We(Ze(s),Xe(n),et(r,"day",1,31),{hours:i,minutes:o,seconds:a,fractionalMilliseconds:c}))}if(t=Ve.exec(e),t){const[e,r,n,s,i,o,a,c]=t;return We(_e(rt(c)),Xe(r),et(n.trimLeft(),"day",1,31),{hours:s,minutes:i,seconds:o,fractionalMilliseconds:a})}throw new TypeError("Invalid RFC-7231 date-time value")})(s.headers.expires)}catch(i){t.logger?.warn(`AWS SDK Warning for ${t.clientName}::${t.commandName} response parsing (${s.headers.expires}): ${i}`),delete s.headers.expires}}return n},jn={tags:["S3"],name:"s3ExpiresMiddleware",override:!0,relation:"after",toMiddleware:"deserializerMiddleware"};class Hn{data;lastPurgeTime=Date.now();static EXPIRED_CREDENTIAL_PURGE_INTERVAL_MS=3e4;constructor(e={}){this.data=e}get(e){const t=this.data[e];if(t)return t}set(e,t){return this.data[e]=t,t}delete(e){delete this.data[e]}async purgeExpired(){const e=Date.now();if(!(this.lastPurgeTime+Hn.EXPIRED_CREDENTIAL_PURGE_INTERVAL_MS>e))for(const t in this.data){const r=this.data[t];if(!r.isRefreshing){const n=await r.identity;n.expiration&&n.expiration.getTime()<e&&delete this.data[t]}}}}class qn{_identity;isRefreshing;accessed;constructor(e,t=!1,r=Date.now()){this._identity=e,this.isRefreshing=t,this.accessed=r}get identity(){return this.accessed=Date.now(),this._identity}}class Fn{createSessionFn;cache;static REFRESH_WINDOW_MS=6e4;constructor(e,t=new Hn){this.createSessionFn=e,this.cache=t}async getS3ExpressIdentity(e,t){const r=t.Bucket,{cache:n}=this,s=n.get(r);return s?s.identity.then(e=>{if((e.expiration?.getTime()??0)<Date.now())return n.set(r,new qn(this.getIdentity(r))).identity;return(e.expiration?.getTime()??0)<Date.now()+Fn.REFRESH_WINDOW_MS&&!s.isRefreshing&&(s.isRefreshing=!0,this.getIdentity(r).then(e=>{n.set(r,new qn(Promise.resolve(e)))})),e}):n.set(r,new qn(this.getIdentity(r))).identity}async getIdentity(e){await this.cache.purgeExpired().catch(e=>{console.warn("Error while clearing expired entries in S3ExpressIdentityCache: \n"+e)});const t=await this.createSessionFn(e);if(!t.Credentials?.AccessKeyId||!t.Credentials?.SecretAccessKey)throw new Error("s3#createSession response credential missing AccessKeyId or SecretAccessKey.");return{accessKeyId:t.Credentials.AccessKeyId,secretAccessKey:t.Credentials.SecretAccessKey,sessionToken:t.Credentials.SessionToken,expiration:t.Credentials.Expiration?new Date(t.Credentials.Expiration):void 0}}}const Kn="X-Amz-S3session-Token",Vn=Kn.toLowerCase();class Wn extends pr{async signWithCredentials(e,t,r){const n=Zn(t);e.headers[Vn]=t.sessionToken;return Gn(this,n),this.signRequest(e,r??{})}async presignWithCredentials(e,t,r){const n=Zn(t);delete e.headers[Vn],e.headers[Kn]=t.sessionToken,e.query=e.query??{},e.query[Kn]=t.sessionToken;return Gn(this,n),this.presign(e,r)}}function Zn(e){return{accessKeyId:e.accessKeyId,secretAccessKey:e.secretAccessKey,expiration:e.expiration}}function Gn(e,t){const r=setTimeout(()=>{throw new Error("SignatureV4S3Express credential override was created but not called.")},10),n=e.credentialProvider;e.credentialProvider=()=>(clearTimeout(r),e.credentialProvider=n,Promise.resolve(t))}const Xn={name:"s3ExpressMiddleware",step:"build",tags:["S3","S3_EXPRESS"],override:!0},Yn=e=>({applyToStack:t=>{t.add((e=>(t,r)=>async n=>{if(r.endpointV2){const t=r.endpointV2,s="sigv4-s3express"===t.properties?.authSchemes?.[0]?.name;if(("S3Express"===t.properties?.backend||"Directory"===t.properties?.bucketType)&&(v(r,"S3_EXPRESS_BUCKET","J"),r.isS3ExpressBucket=!0),s){const t=n.input.Bucket;if(t){const s=await e.s3ExpressIdentityProvider.getS3ExpressIdentity(await e.credentials(),{Bucket:t});r.s3ExpressIdentity=s,o.isInstance(n.request)&&s.sessionToken&&(n.request.headers[Vn]=s.sessionToken)}}}return t(n)})(e),Xn)}}),Jn=e=>e=>{throw e},Qn=(e,t)=>{},es=e=>(t,r)=>async n=>{if(!o.isInstance(n.request))return t(n);const s=P(r).selectedHttpAuthScheme;if(!s)throw new Error("No HttpAuthScheme was selected: unable to sign request");const{httpAuthOption:{signingProperties:i={}},identity:a,signer:c}=s;let u;u=r.s3ExpressIdentity?await(async(e,t,r,n)=>{const s=await n.signWithCredentials(r,e,{});if(s.headers["X-Amz-Security-Token"]||s.headers["x-amz-security-token"])throw new Error("X-Amz-Security-Token must not be set for s3-express requests.");return s})(r.s3ExpressIdentity,0,n.request,await e.signer()):await c.sign(n.request,a,i);const d=await t({...n,request:u}).catch((c.errorHandler||Jn)(i));return(c.successHandler||Qn)(d.response,i),d},ts={CopyObjectCommand:!0,UploadPartCopyCommand:!0,CompleteMultipartUploadCommand:!0},rs=e=>(t,r)=>async n=>{const s=await t(n),{response:i}=s;if(!a.isInstance(i))return s;const{statusCode:o,body:c}=i;if(o<200||o>=300)return s;if(!("function"==typeof c?.stream||"function"==typeof c?.pipe||"function"==typeof c?.tee))return s;let u=c,d=c;!c||"object"!=typeof c||c instanceof Uint8Array||([u,d]=await async function(e){return"function"==typeof e.stream&&(e=e.stream()),e.tee()}(c)),i.body=d;const l=await ns(u,{streamCollector:async e=>async function(e,t){let r=0;const n=[],s=e.getReader();let i=!1;for(;!i;){const{done:e,value:o}=await s.read();if(o&&(n.push(o),r+=o?.byteLength??0),r>=t)break;i=e}s.releaseLock();const o=new Uint8Array(Math.min(t,r));let a=0;for(const c of n){if(c.byteLength>o.byteLength-a){o.set(c.subarray(0,o.byteLength-a),a);break}o.set(c,a),a+=c.length}return o}(e,3e3)});"function"==typeof u?.destroy&&u.destroy();const h=e.utf8Encoder(l.subarray(l.length-16));if(0===l.length&&ts[r.commandName]){const e=new Error("S3 aborted request");throw e.name="InternalError",e}return h&&h.endsWith("</Error>")&&(i.statusCode=400),s},ns=(e=new Uint8Array,t)=>e instanceof Uint8Array?Promise.resolve(e):t.streamCollector(e)||Promise.resolve(new Uint8Array),ss={relation:"after",toMiddleware:"deserializerMiddleware",tags:["THROW_200_EXCEPTIONS","S3"],name:"throw200ExceptionsMiddleware",override:!0},is=e=>({applyToStack:t=>{t.addRelativeTo(rs(e),ss)}});const os={name:"bucketEndpointMiddleware",override:!0,relation:"after",toMiddleware:"endpointV2Middleware"};const as={step:"initialize",tags:["VALIDATE_BUCKET_NAME"],name:"validateBucketNameMiddleware",override:!0},cs=e=>({applyToStack:t=>{t.add(function({bucketEndpoint:e}){return t=>async r=>{const{input:{Bucket:n}}=r;if(!e&&"string"==typeof n&&!("string"==typeof(s=n)&&0===s.indexOf("arn:")&&s.split(":").length>=6)&&n.indexOf("/")>=0){const e=new Error(`Bucket name shouldn't contain '/', received '${n}'`);throw e.name="InvalidBucketName",e}var s;return t({...r})}}(e),as),t.addRelativeTo(function(e){return(t,r)=>async n=>{if(e.bucketEndpoint){const e=r.endpointV2;if(e){const t=n.input.Bucket;if("string"==typeof t)try{const n=new URL(t);r.endpointV2={...e,url:n}}catch(s){const e=`@aws-sdk/middleware-sdk-s3: bucketEndpoint=true was set but Bucket=${t} could not be parsed as URL.`;throw"NoOpLogger"===r.logger?.constructor?.name?console.warn(e):r.logger?.warn?.(e),s}}}return t(n)}}(e),os)}});const us=new RegExp("^(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}$"),ds=e=>us.test(e)||e.startsWith("[")&&e.endsWith("]"),ls=new RegExp("^(?!.*-$)(?!-)[a-zA-Z0-9-]{1,63}$"),hs=(e,t=!1)=>{if(!t)return ls.test(e);const r=e.split(".");for(const n of r)if(!hs(n))return!1;return!0},ps={},fs="endpoints";function ms(e){return"object"!=typeof e||null==e?e:"ref"in e?`$${ms(e.ref)}`:"fn"in e?`${e.fn}(${(e.argv||[]).map(ms).join(", ")})`:JSON.stringify(e,null,2)}class gs extends Error{constructor(e){super(e),this.name="EndpointError"}}const ys=(e,t)=>(e=>{const t=e.split("."),r=[];for(const n of t){const t=n.indexOf("[");if(-1!==t){if(n.indexOf("]")!==n.length-1)throw new gs(`Path: '${e}' does not end with ']'`);const s=n.slice(t+1,-1);if(Number.isNaN(parseInt(s)))throw new gs(`Invalid array index: '${s}' in path: '${e}'`);0!==t&&r.push(n.slice(0,t)),r.push(s)}else r.push(n)}return r})(t).reduce((r,n)=>{if("object"!=typeof r)throw new gs(`Index '${n}' in '${t}' not found in '${JSON.stringify(e)}'`);return Array.isArray(r)?r[parseInt(n)]:r[n]},e),ws={[t.HTTP]:80,[t.HTTPS]:443},bs={booleanEquals:(e,t)=>e===t,getAttr:ys,isSet:e=>null!=e,isValidHostLabel:hs,not:e=>!e,parseURL:e=>{const r=(()=>{try{if(e instanceof URL)return e;if("object"==typeof e&&"hostname"in e){const{hostname:t,port:r,protocol:n="",path:s="",query:i={}}=e,o=new URL(`${n}//${t}${r?`:${r}`:""}${s}`);return o.search=Object.entries(i).map(([e,t])=>`${e}=${t}`).join("&"),o}return new URL(e)}catch(t){return null}})();if(!r)return console.error(`Unable to parse ${JSON.stringify(e)} as a whatwg URL.`),null;const n=r.href,{host:s,hostname:i,pathname:o,protocol:a,search:c}=r;if(c)return null;const u=a.slice(0,-1);if(!Object.values(t).includes(u))return null;const d=ds(i);return{scheme:u,authority:`${s}${n.includes(`${s}:${ws[u]}`)||"string"==typeof e&&e.includes(`${s}:${ws[u]}`)?`:${ws[u]}`:""}`,path:o,normalizedPath:o.endsWith("/")?o:`${o}/`,isIp:d}},stringEquals:(e,t)=>e===t,substring:(e,t,r,n)=>t>=r||e.length<r?null:n?e.substring(e.length-r,e.length-t):e.substring(t,r),uriEncode:e=>encodeURIComponent(e).replace(/[!*'()]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)},Ss=(e,t)=>{const r=[],n={...t.endpointParams,...t.referenceRecord};let s=0;for(;s<e.length;){const t=e.indexOf("{",s);if(-1===t){r.push(e.slice(s));break}r.push(e.slice(s,t));const i=e.indexOf("}",t);if(-1===i){r.push(e.slice(t));break}"{"===e[t+1]&&"}"===e[i+1]&&(r.push(e.slice(t+1,i)),s=i+2);const o=e.substring(t+1,i);if(o.includes("#")){const[e,t]=o.split("#");r.push(ys(n[e],t))}else r.push(n[o]);s=i+1}return r.join("")},vs=(e,t,r)=>{if("string"==typeof e)return Ss(e,r);if(e.fn)return Cs.callFunction(e,r);if(e.ref)return(({ref:e},t)=>({...t.endpointParams,...t.referenceRecord}[e]))(e,r);throw new gs(`'${t}': ${String(e)} is not a string, function or reference.`)},Es=({fn:e,argv:t},r)=>{const n=t.map(e=>["boolean","number"].includes(typeof e)?e:Cs.evaluateExpression(e,"arg",r)),s=e.split(".");return s[0]in ps&&null!=s[1]?ps[s[0]][s[1]](...n):bs[e](...n)},Cs={evaluateExpression:vs,callFunction:Es},xs=({assign:e,...t},r)=>{if(e&&e in r.referenceRecord)throw new gs(`'${e}' is already defined in Reference Record.`);const n=Es(t,r);return r.logger?.debug?.(`${fs} evaluateCondition: ${ms(t)} = ${ms(n)}`),{result:""===n||!!n,...null!=e&&{toAssign:{name:e,value:n}}}},As=(e=[],t)=>{const r={};for(const n of e){const{result:e,toAssign:s}=xs(n,{...t,referenceRecord:{...t.referenceRecord,...r}});if(!e)return{result:e};s&&(r[s.name]=s.value,t.logger?.debug?.(`${fs} assign: ${s.name} := ${ms(s.value)}`))}return{result:!0,referenceRecord:r}},Rs=(e,t)=>Object.entries(e).reduce((e,[r,n])=>({...e,[r]:n.map(e=>{const n=vs(e,"Header value entry",t);if("string"!=typeof n)throw new gs(`Header '${r}' value '${n}' is not a string`);return n})}),{}),ks=(e,t)=>Object.entries(e).reduce((e,[r,n])=>({...e,[r]:Ps.getEndpointProperty(n,t)}),{}),Ts=(e,t)=>{if(Array.isArray(e))return e.map(e=>Ts(e,t));switch(typeof e){case"string":return Ss(e,t);case"object":if(null===e)throw new gs(`Unexpected endpoint property: ${e}`);return Ps.getEndpointProperties(e,t);case"boolean":return e;default:throw new gs("Unexpected endpoint property type: "+typeof e)}},Ps={getEndpointProperty:Ts,getEndpointProperties:ks},Is=(e,t)=>{const r=vs(e,"Endpoint URL",t);if("string"==typeof r)try{return new URL(r)}catch(n){throw console.error(`Failed to construct URL with ${r}`,n),n}throw new gs("Endpoint URL must be a string, got "+typeof r)},Ms=(e,t)=>{const{conditions:r,endpoint:n}=e,{result:s,referenceRecord:i}=As(r,t);if(!s)return;const o={...t,referenceRecord:{...t.referenceRecord,...i}},{url:a,properties:c,headers:u}=n;return t.logger?.debug?.(`${fs} Resolving endpoint from template: ${ms(n)}`),{...null!=u&&{headers:Rs(u,o)},...null!=c&&{properties:ks(c,o)},url:Is(a,o)}},Os=(e,t)=>{const{conditions:r,error:n}=e,{result:s,referenceRecord:i}=As(r,t);if(s)throw new gs(vs(n,"Error",{...t,referenceRecord:{...t.referenceRecord,...i}}))},Us=(e,t)=>{for(const r of e)if("endpoint"===r.type){const e=Ms(r,t);if(e)return e}else if("error"===r.type)Os(r,t);else{if("tree"!==r.type)throw new gs(`Unknown endpoint rule: ${r}`);{const e=Ns.evaluateTreeRule(r,t);if(e)return e}}throw new gs("Rules evaluation failed")},Ns={evaluateRules:Us,evaluateTreeRule:(e,t)=>{const{conditions:r,rules:n}=e,{result:s,referenceRecord:i}=As(r,t);if(s)return Ns.evaluateRules(n,{...t,referenceRecord:{...t.referenceRecord,...i}})}},$s=(e,t=!1)=>{if(t){for(const t of e.split("."))if(!$s(t))return!1;return!0}return!!hs(e)&&(!(e.length<3||e.length>63)&&(e===e.toLowerCase()&&!ds(e)))};let Ds={partitions:[{id:"aws",outputs:{dnsSuffix:"amazonaws.com",dualStackDnsSuffix:"api.aws",implicitGlobalRegion:"us-east-1",name:"aws",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^(us|eu|ap|sa|ca|me|af|il|mx)\\-\\w+\\-\\d+$",regions:{"af-south-1":{description:"Africa (Cape Town)"},"ap-east-1":{description:"Asia Pacific (Hong Kong)"},"ap-east-2":{description:"Asia Pacific (Taipei)"},"ap-northeast-1":{description:"Asia Pacific (Tokyo)"},"ap-northeast-2":{description:"Asia Pacific (Seoul)"},"ap-northeast-3":{description:"Asia Pacific (Osaka)"},"ap-south-1":{description:"Asia Pacific (Mumbai)"},"ap-south-2":{description:"Asia Pacific (Hyderabad)"},"ap-southeast-1":{description:"Asia Pacific (Singapore)"},"ap-southeast-2":{description:"Asia Pacific (Sydney)"},"ap-southeast-3":{description:"Asia Pacific (Jakarta)"},"ap-southeast-4":{description:"Asia Pacific (Melbourne)"},"ap-southeast-5":{description:"Asia Pacific (Malaysia)"},"ap-southeast-6":{description:"Asia Pacific (New Zealand)"},"ap-southeast-7":{description:"Asia Pacific (Thailand)"},"aws-global":{description:"aws global region"},"ca-central-1":{description:"Canada (Central)"},"ca-west-1":{description:"Canada West (Calgary)"},"eu-central-1":{description:"Europe (Frankfurt)"},"eu-central-2":{description:"Europe (Zurich)"},"eu-north-1":{description:"Europe (Stockholm)"},"eu-south-1":{description:"Europe (Milan)"},"eu-south-2":{description:"Europe (Spain)"},"eu-west-1":{description:"Europe (Ireland)"},"eu-west-2":{description:"Europe (London)"},"eu-west-3":{description:"Europe (Paris)"},"il-central-1":{description:"Israel (Tel Aviv)"},"me-central-1":{description:"Middle East (UAE)"},"me-south-1":{description:"Middle East (Bahrain)"},"mx-central-1":{description:"Mexico (Central)"},"sa-east-1":{description:"South America (Sao Paulo)"},"us-east-1":{description:"US East (N. Virginia)"},"us-east-2":{description:"US East (Ohio)"},"us-west-1":{description:"US West (N. California)"},"us-west-2":{description:"US West (Oregon)"}}},{id:"aws-cn",outputs:{dnsSuffix:"amazonaws.com.cn",dualStackDnsSuffix:"api.amazonwebservices.com.cn",implicitGlobalRegion:"cn-northwest-1",name:"aws-cn",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^cn\\-\\w+\\-\\d+$",regions:{"aws-cn-global":{description:"aws-cn global region"},"cn-north-1":{description:"China (Beijing)"},"cn-northwest-1":{description:"China (Ningxia)"}}},{id:"aws-eusc",outputs:{dnsSuffix:"amazonaws.eu",dualStackDnsSuffix:"api.amazonwebservices.eu",implicitGlobalRegion:"eusc-de-east-1",name:"aws-eusc",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^eusc\\-(de)\\-\\w+\\-\\d+$",regions:{"eusc-de-east-1":{description:"EU (Germany)"}}},{id:"aws-iso",outputs:{dnsSuffix:"c2s.ic.gov",dualStackDnsSuffix:"api.aws.ic.gov",implicitGlobalRegion:"us-iso-east-1",name:"aws-iso",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^us\\-iso\\-\\w+\\-\\d+$",regions:{"aws-iso-global":{description:"aws-iso global region"},"us-iso-east-1":{description:"US ISO East"},"us-iso-west-1":{description:"US ISO WEST"}}},{id:"aws-iso-b",outputs:{dnsSuffix:"sc2s.sgov.gov",dualStackDnsSuffix:"api.aws.scloud",implicitGlobalRegion:"us-isob-east-1",name:"aws-iso-b",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^us\\-isob\\-\\w+\\-\\d+$",regions:{"aws-iso-b-global":{description:"aws-iso-b global region"},"us-isob-east-1":{description:"US ISOB East (Ohio)"},"us-isob-west-1":{description:"US ISOB West"}}},{id:"aws-iso-e",outputs:{dnsSuffix:"cloud.adc-e.uk",dualStackDnsSuffix:"api.cloud-aws.adc-e.uk",implicitGlobalRegion:"eu-isoe-west-1",name:"aws-iso-e",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^eu\\-isoe\\-\\w+\\-\\d+$",regions:{"aws-iso-e-global":{description:"aws-iso-e global region"},"eu-isoe-west-1":{description:"EU ISOE West"}}},{id:"aws-iso-f",outputs:{dnsSuffix:"csp.hci.ic.gov",dualStackDnsSuffix:"api.aws.hci.ic.gov",implicitGlobalRegion:"us-isof-south-1",name:"aws-iso-f",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^us\\-isof\\-\\w+\\-\\d+$",regions:{"aws-iso-f-global":{description:"aws-iso-f global region"},"us-isof-east-1":{description:"US ISOF EAST"},"us-isof-south-1":{description:"US ISOF SOUTH"}}},{id:"aws-us-gov",outputs:{dnsSuffix:"amazonaws.com",dualStackDnsSuffix:"api.aws",implicitGlobalRegion:"us-gov-west-1",name:"aws-us-gov",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^us\\-gov\\-\\w+\\-\\d+$",regions:{"aws-us-gov-global":{description:"aws-us-gov global region"},"us-gov-east-1":{description:"AWS GovCloud (US-East)"},"us-gov-west-1":{description:"AWS GovCloud (US-West)"}}}]};const Ls={isVirtualHostableS3Bucket:$s,parseArn:e=>{const t=e.split(":");if(t.length<6)return null;const[r,n,s,i,o,...a]=t;if("arn"!==r||""===n||""===s||""===a.join(":"))return null;return{partition:n,service:s,region:i,accountId:o,resourceId:a.map(e=>e.split("/")).flat()}},partition:e=>{const{partitions:t}=Ds;for(const n of t){const{regions:t,outputs:r}=n;for(const[n,s]of Object.entries(t))if(n===e)return{...r,...s}}for(const n of t){const{regionRegex:t,outputs:r}=n;if(new RegExp(t).test(e))return{...r}}const r=t.find(e=>"aws"===e.id);if(!r)throw new Error("Provided region was not found in the partition array or regex, and default partition with id 'aws' doesn't exist.");return{...r.outputs}}};ps.aws=Ls;const _s=e=>{if("string"==typeof e)return _s(new URL(e));const{hostname:t,pathname:r,port:n,protocol:s,search:i}=e;let o;return i&&(o=function(e){const t={};if(e=e.replace(/^\?/,""))for(const r of e.split("&")){let[e,n=null]=r.split("=");e=decodeURIComponent(e),n&&(n=decodeURIComponent(n)),e in t?Array.isArray(t[e])?t[e].push(n):t[e]=[t[e],n]:t[e]=n}return t}(i)),{hostname:t,port:n?parseInt(n):void 0,protocol:s,path:r,query:o}},Bs=/\d{12}\.ddb/;const zs="user-agent",js="x-amz-user-agent",Hs=/[^!$%&'*+\-.^_`|~\w]/g,qs=/[^!$%&'*+\-.^_`|~\w#]/g;const Fs=e=>(t,r)=>async n=>{const{request:s}=n;if(!o.isInstance(s))return t(n);const{headers:i}=s,a=r?.userAgent?.map(Ks)||[],c=(await e.defaultUserAgentProvider()).map(Ks);await async function(e,t,r){const n=r.request;if("rpc-v2-cbor"===n?.headers?.["smithy-protocol"]&&v(e,"PROTOCOL_RPC_V2_CBOR","M"),"function"==typeof t.retryStrategy){const r=await t.retryStrategy();"function"==typeof r.acquireInitialRetryToken?r.constructor?.name?.includes("Adaptive")?v(e,"RETRY_MODE_ADAPTIVE","F"):v(e,"RETRY_MODE_STANDARD","E"):v(e,"RETRY_MODE_LEGACY","D")}if("function"==typeof t.accountIdEndpointMode){const r=e.endpointV2;switch(String(r?.url?.hostname).match(Bs)&&v(e,"ACCOUNT_ID_ENDPOINT","O"),await(t.accountIdEndpointMode?.())){case"disabled":v(e,"ACCOUNT_ID_MODE_DISABLED","Q");break;case"preferred":v(e,"ACCOUNT_ID_MODE_PREFERRED","P");break;case"required":v(e,"ACCOUNT_ID_MODE_REQUIRED","R")}}const s=e.__smithy_context?.selectedHttpAuthScheme?.identity;if(s?.$source){const t=s;t.accountId&&v(e,"RESOLVED_ACCOUNT_ID","T");for(const[r,n]of Object.entries(t.$source??{}))v(e,r,n)}}(r,e,n);const u=r;c.push(`m/${function(e){let t="";for(const r in e){const n=e[r];if(!(t.length+n.length+1<=1024))break;t.length?t+=","+n:t+=n}return t}(Object.assign({},r.__smithy_context?.features,u.__aws_sdk_context?.features))}`);const d=e?.customUserAgent?.map(Ks)||[],l=await e.userAgentAppId();l&&c.push(Ks(["app",`${l}`]));const h=[].concat([...c,...a,...d]).join(" "),p=[...c.filter(e=>e.startsWith("aws-sdk-")),...d].join(" ");return"browser"!==e.runtime?(p&&(i[js]=i[js]?`${i[zs]} ${p}`:p),i[zs]=h):i[js]=h,t({...n,request:s})},Ks=e=>{const t=e[0].split("/").map(e=>e.replace(Hs,"-")).join("/"),r=e[1]?.replace(qs,"-"),n=t.indexOf("/"),s=t.substring(0,n);let i=t.substring(n+1);return"api"===s&&(i=i.toLowerCase()),[s,i,r].filter(e=>e&&e.length>0).reduce((e,t,r)=>{switch(r){case 0:return t;case 1:return`${e}/${t}`;default:return`${e}#${t}`}},"")},Vs={name:"getUserAgentMiddleware",step:"build",priority:"low",tags:["SET_USER_AGENT","USER_AGENT"],override:!0},Ws=/* @__PURE__ */new Set,Zs=e=>"string"==typeof e&&(e.startsWith("fips-")||e.endsWith("-fips")),Gs=e=>{const{region:t,useFipsEndpoint:r}=e;if(!t)throw new Error("Region is missing");return Object.assign(e,{region:async()=>{const e=(e=>Zs(e)?["fips-aws-global","aws-fips"].includes(e)?"us-east-1":e.replace(/fips-(dkr-|prod-)?|-fips/,""):e)("function"==typeof t?await t():t);return((e,t=hs)=>{if(Ws.has(e)||t(e))Ws.add(e);else{if("*"!==e)throw new Error(`Region not accepted: region="${e}" is not a valid hostname component.`);console.warn('@smithy/config-resolver WARN - Please use the caller region instead of "*". See "sigv4a" in https://github.com/aws/aws-sdk-js-v3/blob/main/supplemental-docs/CLIENTS.md.')}})(e),e},useFipsEndpoint:async()=>{const e="string"==typeof t?t:await t();return!!Zs(e)||("function"!=typeof r?Promise.resolve(!!r):r())}})},Xs="content-length";const Ys={step:"build",tags:["SET_CONTENT_LENGTH","CONTENT_LENGTH"],name:"contentLengthMiddleware",override:!0},Js=e=>({applyToStack:t=>{var r;t.add((r=e.bodyLengthChecker,e=>async t=>{const n=t.request;if(o.isInstance(n)){const{body:e,headers:t}=n;if(e&&-1===Object.keys(t).map(e=>e.toLowerCase()).indexOf(Xs))try{const t=r(e);n.headers={...n.headers,[Xs]:String(t)}}catch(s){}}return e({...t,request:n})}),Ys)}}),Qs=/^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/,ei=/(\d+\.){3}\d+/,ti=/\.\./,ri=e=>Qs.test(e)&&!ei.test(e)&&!ti.test(e),ni=e=>{const[t,r,n,,,s]=e.split(":"),i="arn"===t&&e.split(":").length>=6,o=Boolean(i&&r&&n&&s);if(i&&!o)throw new Error(`Invalid ARN: ${e} was an invalid ARN.`);return o},si=(e,t,r,n=!1)=>{const s=async()=>{let s;if(n){const n=r.clientContextParams,i=n?.[e];s=i??r[e]??r[t]}else s=r[e]??r[t];return"function"==typeof s?s():s};return"credentialScope"===e||"CredentialScope"===t?async()=>{const e="function"==typeof r.credentials?await r.credentials():r.credentials;return e?.credentialScope??e?.CredentialScope}:"accountId"===e||"AccountId"===t?async()=>{const e="function"==typeof r.credentials?await r.credentials():r.credentials;return e?.accountId??e?.AccountId}:"endpoint"===e||"endpoint"===t?async()=>{if(!1===r.isCustomEndpoint)return;const e=await s();if(e&&"object"==typeof e){if("url"in e)return e.url.href;if("hostname"in e){const{protocol:t,hostname:r,port:n,path:s}=e;return`${t}//${r}${n?":"+n:""}${s}`}}return e}:s},ii=async e=>{},oi=e=>"object"==typeof e?"url"in e?_s(e.url):e:_s(e),ai=async(e,t,r)=>{const n={},s=t?.getEndpointParameterInstructions?.()||{};for(const[i,o]of Object.entries(s))switch(o.type){case"staticContextParams":n[i]=o.value;break;case"contextParams":n[i]=e[o.name];break;case"clientContextParams":case"builtInParams":n[i]=await si(o.name,i,r,"builtInParams"!==o.type)();break;case"operationContextParams":n[i]=o.get(e);break;default:throw new Error("Unrecognized endpoint parameter instruction: "+JSON.stringify(o))}return 0===Object.keys(s).length&&Object.assign(n,r),"s3"===String(r.serviceId).toLowerCase()&&await(async e=>{const t=e?.Bucket||"";if("string"==typeof e.Bucket&&(e.Bucket=t.replace(/#/g,encodeURIComponent("#")).replace(/\?/g,encodeURIComponent("?"))),ni(t)){if(!0===e.ForcePathStyle)throw new Error("Path-style addressing cannot be used with ARN buckets")}else(!ri(t)||-1!==t.indexOf(".")&&!String(e.Endpoint).startsWith("http:")||t.toLowerCase()!==t||t.length<3)&&(e.ForcePathStyle=!0);return e.DisableMultiRegionAccessPoints&&(e.disableMultiRegionAccessPoints=!0,e.DisableMRAP=!0),e})(n),n},ci=({config:e,instructions:t})=>(r,n)=>async s=>{e.isCustomEndpoint&&function(e,t,r){e.__smithy_context?e.__smithy_context.features||(e.__smithy_context.features={}):e.__smithy_context={features:{}},e.__smithy_context.features[t]=r}(n,"ENDPOINT_OVERRIDE","N");const i=await(async(e,t,r,n)=>{if(!r.isCustomEndpoint){let e;e=r.serviceConfiguredEndpoint?await r.serviceConfiguredEndpoint():await ii(r.serviceId),e&&(r.endpoint=()=>Promise.resolve(oi(e)),r.isCustomEndpoint=!0)}const s=await ai(e,t,r);if("function"!=typeof r.endpointProvider)throw new Error("config.endpointProvider is not set.");return r.endpointProvider(s,n)})(s.input,{getEndpointParameterInstructions:()=>t},{...e},n);n.endpointV2=i,n.authSchemes=i.properties?.authSchemes;const o=n.authSchemes?.[0];if(o){n.signing_region=o.signingRegion,n.signing_service=o.signingName;const e=P(n),t=e?.selectedHttpAuthScheme?.httpAuthOption;t&&(t.signingProperties=Object.assign(t.signingProperties||{},{signing_region:o.signingRegion,signingRegion:o.signingRegion,signing_service:o.signingName,signingName:o.signingName,signingRegionSet:o.signingRegionSet},o.properties))}return r({...s})},ui={step:"serialize",tags:["ENDPOINT_PARAMETERS","ENDPOINT_V2","ENDPOINT"],name:"endpointV2Middleware",override:!0,relation:"before",toMiddleware:"serializerMiddleware"},di=(e,t)=>({applyToStack:r=>{r.addRelativeTo(ci({config:e,instructions:t}),ui)}});var li,hi;(hi=li||(li={})).STANDARD="standard",hi.ADAPTIVE="adaptive";const pi=li.STANDARD,fi=["BandwidthLimitExceeded","EC2ThrottledException","LimitExceededException","PriorRequestNotComplete","ProvisionedThroughputExceededException","RequestLimitExceeded","RequestThrottled","RequestThrottledException","SlowDown","ThrottledException","Throttling","ThrottlingException","TooManyRequestsException","TransactionInProgressException"],mi=["TimeoutError","RequestTimeout","RequestTimeoutException"],gi=[500,502,503,504],yi=["ECONNRESET","ECONNREFUSED","EPIPE","ETIMEDOUT"],wi=["EHOSTUNREACH","ENETUNREACH","ENOTFOUND"],bi=e=>429===e.$metadata?.httpStatusCode||fi.includes(e.name)||1==e.$retryable?.throttling,Si=(e,t=0)=>(e=>void 0!==e?.$retryable)(e)||(e=>e.$metadata?.clockSkewCorrected)(e)||mi.includes(e.name)||yi.includes(e?.code||"")||wi.includes(e?.code||"")||gi.includes(e.$metadata?.httpStatusCode||0)||(e=>!!(e&&e instanceof TypeError)&&/* @__PURE__ */new Set(["Failed to fetch","NetworkError when attempting to fetch resource","The Internet connection appears to be offline","Load failed","Network request failed"]).has(e.message))(e)||void 0!==e.cause&&t<=10&&Si(e.cause,t+1);class vi{static setTimeoutFn=setTimeout;beta;minCapacity;minFillRate;scaleConstant;smooth;currentCapacity=0;enabled=!1;lastMaxRate=0;measuredTxRate=0;requestCount=0;fillRate;lastThrottleTime;lastTimestamp=0;lastTxRateBucket;maxCapacity;timeWindow=0;constructor(e){this.beta=e?.beta??.7,this.minCapacity=e?.minCapacity??1,this.minFillRate=e?.minFillRate??.5,this.scaleConstant=e?.scaleConstant??.4,this.smooth=e?.smooth??.8;const t=this.getCurrentTimeInSeconds();this.lastThrottleTime=t,this.lastTxRateBucket=Math.floor(this.getCurrentTimeInSeconds()),this.fillRate=this.minFillRate,this.maxCapacity=this.minCapacity}getCurrentTimeInSeconds(){return Date.now()/1e3}async getSendToken(){return this.acquireTokenBucket(1)}async acquireTokenBucket(e){if(this.enabled){if(this.refillTokenBucket(),e>this.currentCapacity){const t=(e-this.currentCapacity)/this.fillRate*1e3;await new Promise(e=>vi.setTimeoutFn(e,t))}this.currentCapacity=this.currentCapacity-e}}refillTokenBucket(){const e=this.getCurrentTimeInSeconds();if(!this.lastTimestamp)return void(this.lastTimestamp=e);const t=(e-this.lastTimestamp)*this.fillRate;this.currentCapacity=Math.min(this.maxCapacity,this.currentCapacity+t),this.lastTimestamp=e}updateClientSendingRate(e){let t;if(this.updateMeasuredRate(),bi(e)){const e=this.enabled?Math.min(this.measuredTxRate,this.fillRate):this.measuredTxRate;this.lastMaxRate=e,this.calculateTimeWindow(),this.lastThrottleTime=this.getCurrentTimeInSeconds(),t=this.cubicThrottle(e),this.enableTokenBucket()}else this.calculateTimeWindow(),t=this.cubicSuccess(this.getCurrentTimeInSeconds());const r=Math.min(t,2*this.measuredTxRate);this.updateTokenBucketRate(r)}calculateTimeWindow(){this.timeWindow=this.getPrecise(Math.pow(this.lastMaxRate*(1-this.beta)/this.scaleConstant,1/3))}cubicThrottle(e){return this.getPrecise(e*this.beta)}cubicSuccess(e){return this.getPrecise(this.scaleConstant*Math.pow(e-this.lastThrottleTime-this.timeWindow,3)+this.lastMaxRate)}enableTokenBucket(){this.enabled=!0}updateTokenBucketRate(e){this.refillTokenBucket(),this.fillRate=Math.max(e,this.minFillRate),this.maxCapacity=Math.max(e,this.minCapacity),this.currentCapacity=Math.min(this.currentCapacity,this.maxCapacity)}updateMeasuredRate(){const e=this.getCurrentTimeInSeconds(),t=Math.floor(2*e)/2;if(this.requestCount++,t>this.lastTxRateBucket){const e=this.requestCount/(t-this.lastTxRateBucket);this.measuredTxRate=this.getPrecise(e*this.smooth+this.measuredTxRate*(1-this.smooth)),this.requestCount=0,this.lastTxRateBucket=t}}getPrecise(e){return parseFloat(e.toFixed(8))}}const Ei=({retryDelay:e,retryCount:t,retryCost:r})=>({getRetryCount:()=>t,getRetryDelay:()=>Math.min(2e4,e),getRetryCost:()=>r});class Ci{maxAttempts;mode=li.STANDARD;capacity=500;retryBackoffStrategy=(()=>{let e=100;return{computeNextBackoffDelay:t=>Math.floor(Math.min(2e4,Math.random()*2**t*e)),setDelayBase:t=>{e=t}}})();maxAttemptsProvider;constructor(e){this.maxAttempts=e,this.maxAttemptsProvider="function"==typeof e?e:async()=>e}async acquireInitialRetryToken(e){return Ei({retryDelay:100,retryCount:0})}async refreshRetryTokenForRetry(e,t){const r=await this.getMaxAttempts();if(this.shouldRetry(e,t,r)){const r=t.errorType;this.retryBackoffStrategy.setDelayBase("THROTTLING"===r?500:100);const n=this.retryBackoffStrategy.computeNextBackoffDelay(e.getRetryCount()),s=t.retryAfterHint?Math.max(t.retryAfterHint.getTime()-Date.now()||0,n):n,i=this.getCapacityCost(r);return this.capacity-=i,Ei({retryDelay:s,retryCount:e.getRetryCount()+1,retryCost:i})}throw new Error("No retry token available")}recordSuccess(e){this.capacity=Math.max(500,this.capacity+(e.getRetryCost()??1))}getCapacity(){return this.capacity}async getMaxAttempts(){try{return await this.maxAttemptsProvider()}catch(e){return console.warn("Max attempts provider could not resolve. Using default of 3"),3}}shouldRetry(e,t,r){return e.getRetryCount()+1<r&&this.capacity>=this.getCapacityCost(t.errorType)&&this.isRetryableError(t.errorType)}getCapacityCost(e){return"TRANSIENT"===e?10:5}isRetryableError(e){return"THROTTLING"===e||"TRANSIENT"===e}}class xi{maxAttemptsProvider;rateLimiter;standardRetryStrategy;mode=li.ADAPTIVE;constructor(e,t){this.maxAttemptsProvider=e;const{rateLimiter:r}=t??{};this.rateLimiter=r??new vi,this.standardRetryStrategy=new Ci(e)}async acquireInitialRetryToken(e){return await this.rateLimiter.getSendToken(),this.standardRetryStrategy.acquireInitialRetryToken(e)}async refreshRetryTokenForRetry(e,t){return this.rateLimiter.updateClientSendingRate(t),this.standardRetryStrategy.refreshRetryTokenForRetry(e,t)}recordSuccess(e){this.rateLimiter.updateClientSendingRate({}),this.standardRetryStrategy.recordSuccess(e)}}const Ai=e=>e instanceof Error?e:e instanceof Object?Object.assign(new Error,e):"string"==typeof e?new Error(e):new Error(`AWS SDK error wrapper for ${e}`),Ri=e=>e?.body instanceof ReadableStream,ki=e=>void 0!==e.acquireInitialRetryToken&&void 0!==e.refreshRetryTokenForRetry&&void 0!==e.recordSuccess,Ti=e=>{const t={error:e,errorType:Pi(e)},r=Oi(e.$response);return r&&(t.retryAfterHint=r),t},Pi=e=>bi(e)?"THROTTLING":Si(e)?"TRANSIENT":(e=>{if(void 0!==e.$metadata?.httpStatusCode){const t=e.$metadata.httpStatusCode;return 500<=t&&t<=599&&!Si(e)}return!1})(e)?"SERVER_ERROR":"CLIENT_ERROR",Ii={name:"retryMiddleware",tags:["RETRY"],step:"finalizeRequest",priority:"high",override:!0},Mi=e=>({applyToStack:t=>{t.add((e=>(t,r)=>async n=>{let s=await e.retryStrategy();const i=await e.maxAttempts();if(!ki(s))return s?.mode&&(r.userAgent=[...r.userAgent||[],["cfg/retry-mode",s.mode]]),s.retry(t,n);{let e=await s.acquireInitialRetryToken(r.partition_id),u=new Error,d=0,l=0;const{request:h}=n,p=o.isInstance(h);for(p&&(h.headers["amz-sdk-invocation-id"]=it());;)try{p&&(h.headers["amz-sdk-request"]=`attempt=${d+1}; max=${i}`);const{response:r,output:o}=await t(n);return s.recordSuccess(e),o.$metadata.attempts=d+1,o.$metadata.totalRetryDelay=l,{response:r,output:o}}catch(a){const t=Ti(a);if(u=Ai(a),p&&Ri(h))throw(r.logger instanceof Or?console:r.logger)?.warn("An error was encountered in a non-retryable streaming request."),u;try{e=await s.refreshRetryTokenForRetry(e,t)}catch(c){throw u.$metadata||(u.$metadata={}),u.$metadata.attempts=d+1,u.$metadata.totalRetryDelay=l,u}d=e.getRetryCount();const n=e.getRetryDelay();l+=n,await new Promise(e=>setTimeout(e,n))}}})(e),Ii)}}),Oi=e=>{if(!a.isInstance(e))return;const t=Object.keys(e.headers).find(e=>"retry-after"===e.toLowerCase());if(!t)return;const r=e.headers[t],n=Number(r);if(!Number.isNaN(n))return new Date(1e3*n);return new Date(r)};class Ui{sigv4aSigner;sigv4Signer;signerOptions;static sigv4aDependency(){return"none"}constructor(e){this.sigv4Signer=new Wn(e),this.signerOptions=e}async sign(e,t={}){return"*"===t.signingRegion?this.getSigv4aSigner().sign(e,t):this.sigv4Signer.sign(e,t)}async signWithCredentials(e,t,r={}){if("*"===r.signingRegion)throw this.getSigv4aSigner(),new Error('signWithCredentials with signingRegion \'*\' is only supported when using the CRT dependency @aws-sdk/signature-v4-crt. Please check whether you have installed the "@aws-sdk/signature-v4-crt" package explicitly. You must also register the package by calling [require("@aws-sdk/signature-v4-crt");] or an ESM equivalent such as [import "@aws-sdk/signature-v4-crt";]. For more information please go to https://github.com/aws/aws-sdk-js-v3#functionality-requiring-aws-common-runtime-crt');return this.sigv4Signer.signWithCredentials(e,t,r)}async presign(e,t={}){if("*"===t.signingRegion)throw this.getSigv4aSigner(),new Error('presign with signingRegion \'*\' is only supported when using the CRT dependency @aws-sdk/signature-v4-crt. Please check whether you have installed the "@aws-sdk/signature-v4-crt" package explicitly. You must also register the package by calling [require("@aws-sdk/signature-v4-crt");] or an ESM equivalent such as [import "@aws-sdk/signature-v4-crt";]. For more information please go to https://github.com/aws/aws-sdk-js-v3#functionality-requiring-aws-common-runtime-crt');return this.sigv4Signer.presign(e,t)}async presignWithCredentials(e,t,r={}){if("*"===r.signingRegion)throw new Error("Method presignWithCredentials is not supported for [signingRegion=*].");return this.sigv4Signer.presignWithCredentials(e,t,r)}getSigv4aSigner(){if(!this.sigv4aSigner)throw"node"===this.signerOptions.runtime?new Error("Neither CRT nor JS SigV4a implementation is available. Please load either @aws-sdk/signature-v4-crt or @aws-sdk/signature-v4a. For more information please go to https://github.com/aws/aws-sdk-js-v3#functionality-requiring-aws-common-runtime-crt"):new Error("JS SigV4a implementation is not available or not a valid constructor. Please check whether you have installed the @aws-sdk/signature-v4a package explicitly. The CRT implementation is not available for browsers. You must also register the package by calling [require('@aws-sdk/signature-v4a');] or an ESM equivalent such as [import '@aws-sdk/signature-v4a';]. For more information please go to https://github.com/aws/aws-sdk-js-v3#using-javascript-non-crt-implementation-of-sigv4a");return this.sigv4aSigner}}const Ni="required",$i="type",Di="rules",Li="conditions",_i="fn",Bi="argv",zi="ref",ji="assign",Hi="url",qi="properties",Fi="backend",Ki="authSchemes",Vi="disableDoubleEncoding",Wi="signingName",Zi="signingRegion",Gi="headers",Xi="signingRegionSet",Yi=!0,Ji="isSet",Qi="booleanEquals",eo="error",to="aws.partition",ro="stringEquals",no="getAttr",so="name",io="substring",oo="bucketSuffix",ao="parseURL",co="endpoint",uo="tree",lo="aws.isVirtualHostableS3Bucket",ho="{url#scheme}://{Bucket}.{url#authority}{url#path}",po="not",fo="accessPointSuffix",mo="{url#scheme}://{url#authority}{url#path}",go="hardwareType",yo="regionPrefix",wo="bucketAliasSuffix",bo="outpostId",So="isValidHostLabel",vo="sigv4a",Eo="s3-outposts",Co="s3",xo="{url#scheme}://{url#authority}{url#normalizedPath}{Bucket}",Ao="https://{Bucket}.s3-accelerate.{partitionResult#dnsSuffix}",Ro="https://{Bucket}.s3.{partitionResult#dnsSuffix}",ko="aws.parseArn",To="bucketArn",Po="arnType",Io="s3-object-lambda",Mo="accesspoint",Oo="accessPointName",Uo="{url#scheme}://{accessPointName}-{bucketArn#accountId}.{url#authority}{url#path}",No="mrapPartition",$o="outpostType",Do="arnPrefix",Lo="{url#scheme}://{url#authority}{url#normalizedPath}{uri_encoded_bucket}",_o="https://s3.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",Bo="https://s3.{partitionResult#dnsSuffix}",zo={[Ni]:!1,[$i]:"string"},jo={[Ni]:!0,default:!1,[$i]:"boolean"},Ho={[Ni]:!1,[$i]:"boolean"},qo={[_i]:Qi,[Bi]:[{[zi]:"Accelerate"},!0]},Fo={[_i]:Qi,[Bi]:[{[zi]:"UseFIPS"},!0]},Ko={[_i]:Qi,[Bi]:[{[zi]:"UseDualStack"},!0]},Vo={[_i]:Ji,[Bi]:[{[zi]:"Endpoint"}]},Wo={[_i]:to,[Bi]:[{[zi]:"Region"}],[ji]:"partitionResult"},Zo={[_i]:ro,[Bi]:[{[_i]:no,[Bi]:[{[zi]:"partitionResult"},so]},"aws-cn"]},Go={[_i]:Ji,[Bi]:[{[zi]:"Bucket"}]},Xo={[zi]:"Bucket"},Yo={[Li]:[qo],[eo]:"S3Express does not support S3 Accelerate.",[$i]:eo},Jo={[Li]:[Vo,{[_i]:ao,[Bi]:[{[zi]:"Endpoint"}],[ji]:"url"}],[Di]:[{[Li]:[{[_i]:Ji,[Bi]:[{[zi]:"DisableS3ExpressSessionAuth"}]},{[_i]:Qi,[Bi]:[{[zi]:"DisableS3ExpressSessionAuth"},!0]}],[Di]:[{[Li]:[{[_i]:Qi,[Bi]:[{[_i]:no,[Bi]:[{[zi]:"url"},"isIp"]},!0]}],[Di]:[{[Li]:[{[_i]:"uriEncode",[Bi]:[Xo],[ji]:"uri_encoded_bucket"}],[Di]:[{[co]:{[Hi]:"{url#scheme}://{url#authority}/{uri_encoded_bucket}{url#path}",[qi]:{[Fi]:"S3Express",[Ki]:[{[Vi]:!0,[so]:"sigv4",[Wi]:"s3express",[Zi]:"{Region}"}]},[Gi]:{}},[$i]:co}],[$i]:uo}],[$i]:uo},{[Li]:[{[_i]:lo,[Bi]:[Xo,!1]}],[Di]:[{[co]:{[Hi]:ho,[qi]:{[Fi]:"S3Express",[Ki]:[{[Vi]:!0,[so]:"sigv4",[Wi]:"s3express",[Zi]:"{Region}"}]},[Gi]:{}},[$i]:co}],[$i]:uo},{[eo]:"S3Express bucket name is not a valid virtual hostable name.",[$i]:eo}],[$i]:uo},{[Li]:[{[_i]:Qi,[Bi]:[{[_i]:no,[Bi]:[{[zi]:"url"},"isIp"]},!0]}],[Di]:[{[Li]:[{[_i]:"uriEncode",[Bi]:[Xo],[ji]:"uri_encoded_bucket"}],[Di]:[{[co]:{[Hi]:"{url#scheme}://{url#authority}/{uri_encoded_bucket}{url#path}",[qi]:{[Fi]:"S3Express",[Ki]:[{[Vi]:!0,[so]:"sigv4-s3express",[Wi]:"s3express",[Zi]:"{Region}"}]},[Gi]:{}},[$i]:co}],[$i]:uo}],[$i]:uo},{[Li]:[{[_i]:lo,[Bi]:[Xo,!1]}],[Di]:[{[co]:{[Hi]:ho,[qi]:{[Fi]:"S3Express",[Ki]:[{[Vi]:!0,[so]:"sigv4-s3express",[Wi]:"s3express",[Zi]:"{Region}"}]},[Gi]:{}},[$i]:co}],[$i]:uo},{[eo]:"S3Express bucket name is not a valid virtual hostable name.",[$i]:eo}],[$i]:uo},Qo={[_i]:ao,[Bi]:[{[zi]:"Endpoint"}],[ji]:"url"},ea={[_i]:Qi,[Bi]:[{[_i]:no,[Bi]:[{[zi]:"url"},"isIp"]},!0]},ta={[zi]:"url"},ra={[_i]:"uriEncode",[Bi]:[Xo],[ji]:"uri_encoded_bucket"},na={[Fi]:"S3Express",[Ki]:[{[Vi]:!0,[so]:"sigv4",[Wi]:"s3express",[Zi]:"{Region}"}]},sa={},ia={[_i]:lo,[Bi]:[Xo,!1]},oa={[eo]:"S3Express bucket name is not a valid virtual hostable name.",[$i]:eo},aa={[_i]:Ji,[Bi]:[{[zi]:"UseS3ExpressControlEndpoint"}]},ca={[_i]:Qi,[Bi]:[{[zi]:"UseS3ExpressControlEndpoint"},!0]},ua={[_i]:po,[Bi]:[Vo]},da={[_i]:Qi,[Bi]:[{[zi]:"UseDualStack"},!1]},la={[_i]:Qi,[Bi]:[{[zi]:"UseFIPS"},!1]},ha={[eo]:"Unrecognized S3Express bucket name format.",[$i]:eo},pa={[_i]:po,[Bi]:[Go]},fa={[zi]:go},ma={[Li]:[ua],[eo]:"Expected a endpoint to be specified but no endpoint was found",[$i]:eo},ga={[Ki]:[{[Vi]:!0,[so]:vo,[Wi]:Eo,[Xi]:["*"]},{[Vi]:!0,[so]:"sigv4",[Wi]:Eo,[Zi]:"{Region}"}]},ya={[_i]:Qi,[Bi]:[{[zi]:"ForcePathStyle"},!1]},wa={[zi]:"ForcePathStyle"},ba={[_i]:Qi,[Bi]:[{[zi]:"Accelerate"},!1]},Sa={[_i]:ro,[Bi]:[{[zi]:"Region"},"aws-global"]},va={[Ki]:[{[Vi]:!0,[so]:"sigv4",[Wi]:Co,[Zi]:"us-east-1"}]},Ea={[_i]:po,[Bi]:[Sa]},Ca={[_i]:Qi,[Bi]:[{[zi]:"UseGlobalEndpoint"},!0]},xa={[Hi]:"https://{Bucket}.s3-fips.dualstack.{Region}.{partitionResult#dnsSuffix}",[qi]:{[Ki]:[{[Vi]:!0,[so]:"sigv4",[Wi]:Co,[Zi]:"{Region}"}]},[Gi]:{}},Aa={[Ki]:[{[Vi]:!0,[so]:"sigv4",[Wi]:Co,[Zi]:"{Region}"}]},Ra={[_i]:Qi,[Bi]:[{[zi]:"UseGlobalEndpoint"},!1]},ka={[Hi]:"https://{Bucket}.s3-fips.{Region}.{partitionResult#dnsSuffix}",[qi]:Aa,[Gi]:{}},Ta={[Hi]:"https://{Bucket}.s3-accelerate.dualstack.{partitionResult#dnsSuffix}",[qi]:Aa,[Gi]:{}},Pa={[Hi]:"https://{Bucket}.s3.dualstack.{Region}.{partitionResult#dnsSuffix}",[qi]:Aa,[Gi]:{}},Ia={[_i]:Qi,[Bi]:[{[_i]:no,[Bi]:[ta,"isIp"]},!1]},Ma={[Hi]:xo,[qi]:Aa,[Gi]:{}},Oa={[Hi]:ho,[qi]:Aa,[Gi]:{}},Ua={[co]:Oa,[$i]:co},Na={[Hi]:Ao,[qi]:Aa,[Gi]:{}},$a={[Hi]:"https://{Bucket}.s3.{Region}.{partitionResult#dnsSuffix}",[qi]:Aa,[Gi]:{}},Da={[eo]:"Invalid region: region was not a valid DNS name.",[$i]:eo},La={[zi]:To},_a={[zi]:Po},Ba={[_i]:no,[Bi]:[La,"service"]},za={[zi]:Oo},ja={[Li]:[Ko],[eo]:"S3 Object Lambda does not support Dual-stack",[$i]:eo},Ha={[Li]:[qo],[eo]:"S3 Object Lambda does not support S3 Accelerate",[$i]:eo},qa={[Li]:[{[_i]:Ji,[Bi]:[{[zi]:"DisableAccessPoints"}]},{[_i]:Qi,[Bi]:[{[zi]:"DisableAccessPoints"},!0]}],[eo]:"Access points are not supported for this operation",[$i]:eo},Fa={[Li]:[{[_i]:Ji,[Bi]:[{[zi]:"UseArnRegion"}]},{[_i]:Qi,[Bi]:[{[zi]:"UseArnRegion"},!1]},{[_i]:po,[Bi]:[{[_i]:ro,[Bi]:[{[_i]:no,[Bi]:[La,"region"]},"{Region}"]}]}],[eo]:"Invalid configuration: region from ARN `{bucketArn#region}` does not match client region `{Region}` and UseArnRegion is `false`",[$i]:eo},Ka={[_i]:no,[Bi]:[{[zi]:"bucketPartition"},so]},Va={[_i]:no,[Bi]:[La,"accountId"]},Wa={[Ki]:[{[Vi]:!0,[so]:"sigv4",[Wi]:Io,[Zi]:"{bucketArn#region}"}]},Za={[eo]:"Invalid ARN: The access point name may only contain a-z, A-Z, 0-9 and `-`. Found: `{accessPointName}`",[$i]:eo},Ga={[eo]:"Invalid ARN: The account id may only contain a-z, A-Z, 0-9 and `-`. Found: `{bucketArn#accountId}`",[$i]:eo},Xa={[eo]:"Invalid region in ARN: `{bucketArn#region}` (invalid DNS name)",[$i]:eo},Ya={[eo]:"Client was configured for partition `{partitionResult#name}` but ARN (`{Bucket}`) has `{bucketPartition#name}`",[$i]:eo},Ja={[eo]:"Invalid ARN: The ARN may only contain a single resource component after `accesspoint`.",[$i]:eo},Qa={[eo]:"Invalid ARN: Expected a resource of the format `accesspoint:<accesspoint name>` but no name was provided",[$i]:eo},ec={[Ki]:[{[Vi]:!0,[so]:"sigv4",[Wi]:Co,[Zi]:"{bucketArn#region}"}]},tc={[Ki]:[{[Vi]:!0,[so]:vo,[Wi]:Eo,[Xi]:["*"]},{[Vi]:!0,[so]:"sigv4",[Wi]:Eo,[Zi]:"{bucketArn#region}"}]},rc={[_i]:ko,[Bi]:[Xo]},nc={[Hi]:"https://s3-fips.dualstack.{Region}.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",[qi]:Aa,[Gi]:{}},sc={[Hi]:"https://s3-fips.{Region}.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",[qi]:Aa,[Gi]:{}},ic={[Hi]:"https://s3.dualstack.{Region}.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",[qi]:Aa,[Gi]:{}},oc={[Hi]:Lo,[qi]:Aa,[Gi]:{}},ac={[Hi]:"https://s3.{Region}.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",[qi]:Aa,[Gi]:{}},cc={[zi]:"UseObjectLambdaEndpoint"},uc={[Ki]:[{[Vi]:!0,[so]:"sigv4",[Wi]:Io,[Zi]:"{Region}"}]},dc={[Hi]:"https://s3-fips.dualstack.{Region}.{partitionResult#dnsSuffix}",[qi]:Aa,[Gi]:{}},lc={[Hi]:"https://s3-fips.{Region}.{partitionResult#dnsSuffix}",[qi]:Aa,[Gi]:{}},hc={[Hi]:"https://s3.dualstack.{Region}.{partitionResult#dnsSuffix}",[qi]:Aa,[Gi]:{}},pc={[Hi]:mo,[qi]:Aa,[Gi]:{}},fc={[Hi]:"https://s3.{Region}.{partitionResult#dnsSuffix}",[qi]:Aa,[Gi]:{}},mc=[{[zi]:"Region"}],gc=[{[zi]:"Endpoint"}],yc=[Xo],wc=[qo],bc=[Vo,Qo],Sc=[{[_i]:Ji,[Bi]:[{[zi]:"DisableS3ExpressSessionAuth"}]},{[_i]:Qi,[Bi]:[{[zi]:"DisableS3ExpressSessionAuth"},!0]}],vc=[ra],Ec=[ia],Cc=[Wo],xc=[Fo,Ko],Ac=[Fo,da],Rc=[la,Ko],kc=[la,da],Tc=[{[_i]:io,[Bi]:[Xo,6,14,!0],[ji]:"s3expressAvailabilityZoneId"},{[_i]:io,[Bi]:[Xo,14,16,!0],[ji]:"s3expressAvailabilityZoneDelim"},{[_i]:ro,[Bi]:[{[zi]:"s3expressAvailabilityZoneDelim"},"--"]}],Pc=[{[Li]:[Fo,Ko],[co]:{[Hi]:"https://{Bucket}.s3express-fips-{s3expressAvailabilityZoneId}.dualstack.{Region}.{partitionResult#dnsSuffix}",[qi]:na,[Gi]:{}},[$i]:co},{[Li]:Ac,[co]:{[Hi]:"https://{Bucket}.s3express-fips-{s3expressAvailabilityZoneId}.{Region}.{partitionResult#dnsSuffix}",[qi]:na,[Gi]:{}},[$i]:co},{[Li]:Rc,[co]:{[Hi]:"https://{Bucket}.s3express-{s3expressAvailabilityZoneId}.dualstack.{Region}.{partitionResult#dnsSuffix}",[qi]:na,[Gi]:{}},[$i]:co},{[Li]:kc,[co]:{[Hi]:"https://{Bucket}.s3express-{s3expressAvailabilityZoneId}.{Region}.{partitionResult#dnsSuffix}",[qi]:na,[Gi]:{}},[$i]:co}],Ic=[{[_i]:io,[Bi]:[Xo,6,15,!0],[ji]:"s3expressAvailabilityZoneId"},{[_i]:io,[Bi]:[Xo,15,17,!0],[ji]:"s3expressAvailabilityZoneDelim"},{[_i]:ro,[Bi]:[{[zi]:"s3expressAvailabilityZoneDelim"},"--"]}],Mc=[{[_i]:io,[Bi]:[Xo,6,19,!0],[ji]:"s3expressAvailabilityZoneId"},{[_i]:io,[Bi]:[Xo,19,21,!0],[ji]:"s3expressAvailabilityZoneDelim"},{[_i]:ro,[Bi]:[{[zi]:"s3expressAvailabilityZoneDelim"},"--"]}],Oc=[{[_i]:io,[Bi]:[Xo,6,20,!0],[ji]:"s3expressAvailabilityZoneId"},{[_i]:io,[Bi]:[Xo,20,22,!0],[ji]:"s3expressAvailabilityZoneDelim"},{[_i]:ro,[Bi]:[{[zi]:"s3expressAvailabilityZoneDelim"},"--"]}],Uc=[{[_i]:io,[Bi]:[Xo,6,26,!0],[ji]:"s3expressAvailabilityZoneId"},{[_i]:io,[Bi]:[Xo,26,28,!0],[ji]:"s3expressAvailabilityZoneDelim"},{[_i]:ro,[Bi]:[{[zi]:"s3expressAvailabilityZoneDelim"},"--"]}],Nc=[{[Li]:[Fo,Ko],[co]:{[Hi]:"https://{Bucket}.s3express-fips-{s3expressAvailabilityZoneId}.dualstack.{Region}.{partitionResult#dnsSuffix}",[qi]:{[Fi]:"S3Express",[Ki]:[{[Vi]:!0,[so]:"sigv4-s3express",[Wi]:"s3express",[Zi]:"{Region}"}]},[Gi]:{}},[$i]:co},{[Li]:Ac,[co]:{[Hi]:"https://{Bucket}.s3express-fips-{s3expressAvailabilityZoneId}.{Region}.{partitionResult#dnsSuffix}",[qi]:{[Fi]:"S3Express",[Ki]:[{[Vi]:!0,[so]:"sigv4-s3express",[Wi]:"s3express",[Zi]:"{Region}"}]},[Gi]:{}},[$i]:co},{[Li]:Rc,[co]:{[Hi]:"https://{Bucket}.s3express-{s3expressAvailabilityZoneId}.dualstack.{Region}.{partitionResult#dnsSuffix}",[qi]:{[Fi]:"S3Express",[Ki]:[{[Vi]:!0,[so]:"sigv4-s3express",[Wi]:"s3express",[Zi]:"{Region}"}]},[Gi]:{}},[$i]:co},{[Li]:kc,[co]:{[Hi]:"https://{Bucket}.s3express-{s3expressAvailabilityZoneId}.{Region}.{partitionResult#dnsSuffix}",[qi]:{[Fi]:"S3Express",[Ki]:[{[Vi]:!0,[so]:"sigv4-s3express",[Wi]:"s3express",[Zi]:"{Region}"}]},[Gi]:{}},[$i]:co}],$c=[Xo,0,7,!0],Dc=[{[_i]:io,[Bi]:[Xo,7,15,!0],[ji]:"s3expressAvailabilityZoneId"},{[_i]:io,[Bi]:[Xo,15,17,!0],[ji]:"s3expressAvailabilityZoneDelim"},{[_i]:ro,[Bi]:[{[zi]:"s3expressAvailabilityZoneDelim"},"--"]}],Lc=[{[_i]:io,[Bi]:[Xo,7,16,!0],[ji]:"s3expressAvailabilityZoneId"},{[_i]:io,[Bi]:[Xo,16,18,!0],[ji]:"s3expressAvailabilityZoneDelim"},{[_i]:ro,[Bi]:[{[zi]:"s3expressAvailabilityZoneDelim"},"--"]}],_c=[{[_i]:io,[Bi]:[Xo,7,20,!0],[ji]:"s3expressAvailabilityZoneId"},{[_i]:io,[Bi]:[Xo,20,22,!0],[ji]:"s3expressAvailabilityZoneDelim"},{[_i]:ro,[Bi]:[{[zi]:"s3expressAvailabilityZoneDelim"},"--"]}],Bc=[{[_i]:io,[Bi]:[Xo,7,21,!0],[ji]:"s3expressAvailabilityZoneId"},{[_i]:io,[Bi]:[Xo,21,23,!0],[ji]:"s3expressAvailabilityZoneDelim"},{[_i]:ro,[Bi]:[{[zi]:"s3expressAvailabilityZoneDelim"},"--"]}],zc=[{[_i]:io,[Bi]:[Xo,7,27,!0],[ji]:"s3expressAvailabilityZoneId"},{[_i]:io,[Bi]:[Xo,27,29,!0],[ji]:"s3expressAvailabilityZoneDelim"},{[_i]:ro,[Bi]:[{[zi]:"s3expressAvailabilityZoneDelim"},"--"]}],jc=[Go],Hc=[{[_i]:So,[Bi]:[{[zi]:bo},!1]}],qc=[{[_i]:ro,[Bi]:[{[zi]:yo},"beta"]}],Fc=[{[_i]:So,[Bi]:[{[zi]:"Region"},!1]}],Kc=[{[_i]:ro,[Bi]:[{[zi]:"Region"},"us-east-1"]}],Vc=[{[_i]:ro,[Bi]:[_a,Mo]}],Wc=[{[_i]:no,[Bi]:[La,"resourceId[1]"],[ji]:Oo},{[_i]:po,[Bi]:[{[_i]:ro,[Bi]:[za,""]}]}],Zc=[La,"resourceId[1]"],Gc=[Ko],Xc=[{[_i]:po,[Bi]:[{[_i]:ro,[Bi]:[{[_i]:no,[Bi]:[La,"region"]},""]}]}],Yc=[{[_i]:po,[Bi]:[{[_i]:Ji,[Bi]:[{[_i]:no,[Bi]:[La,"resourceId[2]"]}]}]}],Jc=[La,"resourceId[2]"],Qc=[{[_i]:to,[Bi]:[{[_i]:no,[Bi]:[La,"region"]}],[ji]:"bucketPartition"}],eu=[{[_i]:ro,[Bi]:[Ka,{[_i]:no,[Bi]:[{[zi]:"partitionResult"},so]}]}],tu=[{[_i]:So,[Bi]:[{[_i]:no,[Bi]:[La,"region"]},!0]}],ru=[{[_i]:So,[Bi]:[Va,!1]}],nu=[{[_i]:So,[Bi]:[za,!1]}],su=[Fo],iu=[{[_i]:So,[Bi]:[{[zi]:"Region"},!0]}],ou={parameters:{Bucket:zo,Region:zo,UseFIPS:jo,UseDualStack:jo,Endpoint:zo,ForcePathStyle:jo,Accelerate:jo,UseGlobalEndpoint:jo,UseObjectLambdaEndpoint:Ho,Key:zo,Prefix:zo,CopySource:zo,DisableAccessPoints:Ho,DisableMultiRegionAccessPoints:jo,UseArnRegion:Ho,UseS3ExpressControlEndpoint:Ho,DisableS3ExpressSessionAuth:Ho},[Di]:[{[Li]:[{[_i]:Ji,[Bi]:mc}],[Di]:[{[Li]:[qo,Fo],error:"Accelerate cannot be used with FIPS",[$i]:eo},{[Li]:[Ko,Vo],error:"Cannot set dual-stack in combination with a custom endpoint.",[$i]:eo},{[Li]:[Vo,Fo],error:"A custom endpoint cannot be combined with FIPS",[$i]:eo},{[Li]:[Vo,qo],error:"A custom endpoint cannot be combined with S3 Accelerate",[$i]:eo},{[Li]:[Fo,Wo,Zo],error:"Partition does not support FIPS",[$i]:eo},{[Li]:[Go,{[_i]:io,[Bi]:[Xo,0,6,Yi],[ji]:oo},{[_i]:ro,[Bi]:[{[zi]:oo},"--x-s3"]}],[Di]:[Yo,Jo,{[Li]:[aa,ca],[Di]:[{[Li]:Cc,[Di]:[{[Li]:[ra,ua],[Di]:[{[Li]:xc,endpoint:{[Hi]:"https://s3express-control-fips.dualstack.{Region}.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",[qi]:na,[Gi]:sa},[$i]:co},{[Li]:Ac,endpoint:{[Hi]:"https://s3express-control-fips.{Region}.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",[qi]:na,[Gi]:sa},[$i]:co},{[Li]:Rc,endpoint:{[Hi]:"https://s3express-control.dualstack.{Region}.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",[qi]:na,[Gi]:sa},[$i]:co},{[Li]:kc,endpoint:{[Hi]:"https://s3express-control.{Region}.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",[qi]:na,[Gi]:sa},[$i]:co}],[$i]:uo}],[$i]:uo}],[$i]:uo},{[Li]:Ec,[Di]:[{[Li]:Cc,[Di]:[{[Li]:Sc,[Di]:[{[Li]:Tc,[Di]:Pc,[$i]:uo},{[Li]:Ic,[Di]:Pc,[$i]:uo},{[Li]:Mc,[Di]:Pc,[$i]:uo},{[Li]:Oc,[Di]:Pc,[$i]:uo},{[Li]:Uc,[Di]:Pc,[$i]:uo},ha],[$i]:uo},{[Li]:Tc,[Di]:Nc,[$i]:uo},{[Li]:Ic,[Di]:Nc,[$i]:uo},{[Li]:Mc,[Di]:Nc,[$i]:uo},{[Li]:Oc,[Di]:Nc,[$i]:uo},{[Li]:Uc,[Di]:Nc,[$i]:uo},ha],[$i]:uo}],[$i]:uo},oa],[$i]:uo},{[Li]:[Go,{[_i]:io,[Bi]:$c,[ji]:fo},{[_i]:ro,[Bi]:[{[zi]:fo},"--xa-s3"]}],[Di]:[Yo,Jo,{[Li]:Ec,[Di]:[{[Li]:Cc,[Di]:[{[Li]:Sc,[Di]:[{[Li]:Dc,[Di]:Pc,[$i]:uo},{[Li]:Lc,[Di]:Pc,[$i]:uo},{[Li]:_c,[Di]:Pc,[$i]:uo},{[Li]:Bc,[Di]:Pc,[$i]:uo},{[Li]:zc,[Di]:Pc,[$i]:uo},ha],[$i]:uo},{[Li]:Dc,[Di]:Nc,[$i]:uo},{[Li]:Lc,[Di]:Nc,[$i]:uo},{[Li]:_c,[Di]:Nc,[$i]:uo},{[Li]:Bc,[Di]:Nc,[$i]:uo},{[Li]:zc,[Di]:Nc,[$i]:uo},ha],[$i]:uo}],[$i]:uo},oa],[$i]:uo},{[Li]:[pa,aa,ca],[Di]:[{[Li]:Cc,[Di]:[{[Li]:bc,endpoint:{[Hi]:mo,[qi]:na,[Gi]:sa},[$i]:co},{[Li]:xc,endpoint:{[Hi]:"https://s3express-control-fips.dualstack.{Region}.{partitionResult#dnsSuffix}",[qi]:na,[Gi]:sa},[$i]:co},{[Li]:Ac,endpoint:{[Hi]:"https://s3express-control-fips.{Region}.{partitionResult#dnsSuffix}",[qi]:na,[Gi]:sa},[$i]:co},{[Li]:Rc,endpoint:{[Hi]:"https://s3express-control.dualstack.{Region}.{partitionResult#dnsSuffix}",[qi]:na,[Gi]:sa},[$i]:co},{[Li]:kc,endpoint:{[Hi]:"https://s3express-control.{Region}.{partitionResult#dnsSuffix}",[qi]:na,[Gi]:sa},[$i]:co}],[$i]:uo}],[$i]:uo},{[Li]:[Go,{[_i]:io,[Bi]:[Xo,49,50,Yi],[ji]:go},{[_i]:io,[Bi]:[Xo,8,12,Yi],[ji]:yo},{[_i]:io,[Bi]:$c,[ji]:wo},{[_i]:io,[Bi]:[Xo,32,49,Yi],[ji]:bo},{[_i]:to,[Bi]:mc,[ji]:"regionPartition"},{[_i]:ro,[Bi]:[{[zi]:wo},"--op-s3"]}],[Di]:[{[Li]:Hc,[Di]:[{[Li]:Ec,[Di]:[{[Li]:[{[_i]:ro,[Bi]:[fa,"e"]}],[Di]:[{[Li]:qc,[Di]:[ma,{[Li]:bc,endpoint:{[Hi]:"https://{Bucket}.ec2.{url#authority}",[qi]:ga,[Gi]:sa},[$i]:co}],[$i]:uo},{endpoint:{[Hi]:"https://{Bucket}.ec2.s3-outposts.{Region}.{regionPartition#dnsSuffix}",[qi]:ga,[Gi]:sa},[$i]:co}],[$i]:uo},{[Li]:[{[_i]:ro,[Bi]:[fa,"o"]}],[Di]:[{[Li]:qc,[Di]:[ma,{[Li]:bc,endpoint:{[Hi]:"https://{Bucket}.op-{outpostId}.{url#authority}",[qi]:ga,[Gi]:sa},[$i]:co}],[$i]:uo},{endpoint:{[Hi]:"https://{Bucket}.op-{outpostId}.s3-outposts.{Region}.{regionPartition#dnsSuffix}",[qi]:ga,[Gi]:sa},[$i]:co}],[$i]:uo},{error:'Unrecognized hardware type: "Expected hardware type o or e but got {hardwareType}"',[$i]:eo}],[$i]:uo},{error:"Invalid Outposts Bucket alias - it must be a valid bucket name.",[$i]:eo}],[$i]:uo},{error:"Invalid ARN: The outpost Id must only contain a-z, A-Z, 0-9 and `-`.",[$i]:eo}],[$i]:uo},{[Li]:jc,[Di]:[{[Li]:[Vo,{[_i]:po,[Bi]:[{[_i]:Ji,[Bi]:[{[_i]:ao,[Bi]:gc}]}]}],error:"Custom endpoint `{Endpoint}` was not a valid URI",[$i]:eo},{[Li]:[ya,ia],[Di]:[{[Li]:Cc,[Di]:[{[Li]:Fc,[Di]:[{[Li]:[qo,Zo],error:"S3 Accelerate cannot be used in this region",[$i]:eo},{[Li]:[Ko,Fo,ba,ua,Sa],endpoint:{[Hi]:"https://{Bucket}.s3-fips.dualstack.us-east-1.{partitionResult#dnsSuffix}",[qi]:va,[Gi]:sa},[$i]:co},{[Li]:[Ko,Fo,ba,ua,Ea,Ca],[Di]:[{endpoint:xa,[$i]:co}],[$i]:uo},{[Li]:[Ko,Fo,ba,ua,Ea,Ra],endpoint:xa,[$i]:co},{[Li]:[da,Fo,ba,ua,Sa],endpoint:{[Hi]:"https://{Bucket}.s3-fips.us-east-1.{partitionResult#dnsSuffix}",[qi]:va,[Gi]:sa},[$i]:co},{[Li]:[da,Fo,ba,ua,Ea,Ca],[Di]:[{endpoint:ka,[$i]:co}],[$i]:uo},{[Li]:[da,Fo,ba,ua,Ea,Ra],endpoint:ka,[$i]:co},{[Li]:[Ko,la,qo,ua,Sa],endpoint:{[Hi]:"https://{Bucket}.s3-accelerate.dualstack.us-east-1.{partitionResult#dnsSuffix}",[qi]:va,[Gi]:sa},[$i]:co},{[Li]:[Ko,la,qo,ua,Ea,Ca],[Di]:[{endpoint:Ta,[$i]:co}],[$i]:uo},{[Li]:[Ko,la,qo,ua,Ea,Ra],endpoint:Ta,[$i]:co},{[Li]:[Ko,la,ba,ua,Sa],endpoint:{[Hi]:"https://{Bucket}.s3.dualstack.us-east-1.{partitionResult#dnsSuffix}",[qi]:va,[Gi]:sa},[$i]:co},{[Li]:[Ko,la,ba,ua,Ea,Ca],[Di]:[{endpoint:Pa,[$i]:co}],[$i]:uo},{[Li]:[Ko,la,ba,ua,Ea,Ra],endpoint:Pa,[$i]:co},{[Li]:[da,la,ba,Vo,Qo,ea,Sa],endpoint:{[Hi]:xo,[qi]:va,[Gi]:sa},[$i]:co},{[Li]:[da,la,ba,Vo,Qo,Ia,Sa],endpoint:{[Hi]:ho,[qi]:va,[Gi]:sa},[$i]:co},{[Li]:[da,la,ba,Vo,Qo,ea,Ea,Ca],[Di]:[{[Li]:Kc,endpoint:Ma,[$i]:co},{endpoint:Ma,[$i]:co}],[$i]:uo},{[Li]:[da,la,ba,Vo,Qo,Ia,Ea,Ca],[Di]:[{[Li]:Kc,endpoint:Oa,[$i]:co},Ua],[$i]:uo},{[Li]:[da,la,ba,Vo,Qo,ea,Ea,Ra],endpoint:Ma,[$i]:co},{[Li]:[da,la,ba,Vo,Qo,Ia,Ea,Ra],endpoint:Oa,[$i]:co},{[Li]:[da,la,qo,ua,Sa],endpoint:{[Hi]:Ao,[qi]:va,[Gi]:sa},[$i]:co},{[Li]:[da,la,qo,ua,Ea,Ca],[Di]:[{[Li]:Kc,endpoint:Na,[$i]:co},{endpoint:Na,[$i]:co}],[$i]:uo},{[Li]:[da,la,qo,ua,Ea,Ra],endpoint:Na,[$i]:co},{[Li]:[da,la,ba,ua,Sa],endpoint:{[Hi]:Ro,[qi]:va,[Gi]:sa},[$i]:co},{[Li]:[da,la,ba,ua,Ea,Ca],[Di]:[{[Li]:Kc,endpoint:{[Hi]:Ro,[qi]:Aa,[Gi]:sa},[$i]:co},{endpoint:$a,[$i]:co}],[$i]:uo},{[Li]:[da,la,ba,ua,Ea,Ra],endpoint:$a,[$i]:co}],[$i]:uo},Da],[$i]:uo}],[$i]:uo},{[Li]:[Vo,Qo,{[_i]:ro,[Bi]:[{[_i]:no,[Bi]:[ta,"scheme"]},"http"]},{[_i]:lo,[Bi]:[Xo,Yi]},ya,la,da,ba],[Di]:[{[Li]:Cc,[Di]:[{[Li]:Fc,[Di]:[Ua],[$i]:uo},Da],[$i]:uo}],[$i]:uo},{[Li]:[ya,{[_i]:ko,[Bi]:yc,[ji]:To}],[Di]:[{[Li]:[{[_i]:no,[Bi]:[La,"resourceId[0]"],[ji]:Po},{[_i]:po,[Bi]:[{[_i]:ro,[Bi]:[_a,""]}]}],[Di]:[{[Li]:[{[_i]:ro,[Bi]:[Ba,Io]}],[Di]:[{[Li]:Vc,[Di]:[{[Li]:Wc,[Di]:[ja,Ha,{[Li]:Xc,[Di]:[qa,{[Li]:Yc,[Di]:[Fa,{[Li]:Qc,[Di]:[{[Li]:Cc,[Di]:[{[Li]:eu,[Di]:[{[Li]:tu,[Di]:[{[Li]:[{[_i]:ro,[Bi]:[Va,""]}],error:"Invalid ARN: Missing account id",[$i]:eo},{[Li]:ru,[Di]:[{[Li]:nu,[Di]:[{[Li]:bc,endpoint:{[Hi]:Uo,[qi]:Wa,[Gi]:sa},[$i]:co},{[Li]:su,endpoint:{[Hi]:"https://{accessPointName}-{bucketArn#accountId}.s3-object-lambda-fips.{bucketArn#region}.{bucketPartition#dnsSuffix}",[qi]:Wa,[Gi]:sa},[$i]:co},{endpoint:{[Hi]:"https://{accessPointName}-{bucketArn#accountId}.s3-object-lambda.{bucketArn#region}.{bucketPartition#dnsSuffix}",[qi]:Wa,[Gi]:sa},[$i]:co}],[$i]:uo},Za],[$i]:uo},Ga],[$i]:uo},Xa],[$i]:uo},Ya],[$i]:uo}],[$i]:uo}],[$i]:uo},Ja],[$i]:uo},{error:"Invalid ARN: bucket ARN is missing a region",[$i]:eo}],[$i]:uo},Qa],[$i]:uo},{error:"Invalid ARN: Object Lambda ARNs only support `accesspoint` arn types, but found: `{arnType}`",[$i]:eo}],[$i]:uo},{[Li]:Vc,[Di]:[{[Li]:Wc,[Di]:[{[Li]:Xc,[Di]:[{[Li]:Vc,[Di]:[{[Li]:Xc,[Di]:[qa,{[Li]:Yc,[Di]:[Fa,{[Li]:Qc,[Di]:[{[Li]:Cc,[Di]:[{[Li]:[{[_i]:ro,[Bi]:[Ka,"{partitionResult#name}"]}],[Di]:[{[Li]:tu,[Di]:[{[Li]:[{[_i]:ro,[Bi]:[Ba,Co]}],[Di]:[{[Li]:ru,[Di]:[{[Li]:nu,[Di]:[{[Li]:wc,error:"Access Points do not support S3 Accelerate",[$i]:eo},{[Li]:xc,endpoint:{[Hi]:"https://{accessPointName}-{bucketArn#accountId}.s3-accesspoint-fips.dualstack.{bucketArn#region}.{bucketPartition#dnsSuffix}",[qi]:ec,[Gi]:sa},[$i]:co},{[Li]:Ac,endpoint:{[Hi]:"https://{accessPointName}-{bucketArn#accountId}.s3-accesspoint-fips.{bucketArn#region}.{bucketPartition#dnsSuffix}",[qi]:ec,[Gi]:sa},[$i]:co},{[Li]:Rc,endpoint:{[Hi]:"https://{accessPointName}-{bucketArn#accountId}.s3-accesspoint.dualstack.{bucketArn#region}.{bucketPartition#dnsSuffix}",[qi]:ec,[Gi]:sa},[$i]:co},{[Li]:[la,da,Vo,Qo],endpoint:{[Hi]:Uo,[qi]:ec,[Gi]:sa},[$i]:co},{[Li]:kc,endpoint:{[Hi]:"https://{accessPointName}-{bucketArn#accountId}.s3-accesspoint.{bucketArn#region}.{bucketPartition#dnsSuffix}",[qi]:ec,[Gi]:sa},[$i]:co}],[$i]:uo},Za],[$i]:uo},Ga],[$i]:uo},{error:"Invalid ARN: The ARN was not for the S3 service, found: {bucketArn#service}",[$i]:eo}],[$i]:uo},Xa],[$i]:uo},Ya],[$i]:uo}],[$i]:uo}],[$i]:uo},Ja],[$i]:uo}],[$i]:uo}],[$i]:uo},{[Li]:[{[_i]:So,[Bi]:[za,Yi]}],[Di]:[{[Li]:Gc,error:"S3 MRAP does not support dual-stack",[$i]:eo},{[Li]:su,error:"S3 MRAP does not support FIPS",[$i]:eo},{[Li]:wc,error:"S3 MRAP does not support S3 Accelerate",[$i]:eo},{[Li]:[{[_i]:Qi,[Bi]:[{[zi]:"DisableMultiRegionAccessPoints"},Yi]}],error:"Invalid configuration: Multi-Region Access Point ARNs are disabled.",[$i]:eo},{[Li]:[{[_i]:to,[Bi]:mc,[ji]:No}],[Di]:[{[Li]:[{[_i]:ro,[Bi]:[{[_i]:no,[Bi]:[{[zi]:No},so]},{[_i]:no,[Bi]:[La,"partition"]}]}],[Di]:[{endpoint:{[Hi]:"https://{accessPointName}.accesspoint.s3-global.{mrapPartition#dnsSuffix}",[qi]:{[Ki]:[{[Vi]:Yi,name:vo,[Wi]:Co,[Xi]:["*"]}]},[Gi]:sa},[$i]:co}],[$i]:uo},{error:"Client was configured for partition `{mrapPartition#name}` but bucket referred to partition `{bucketArn#partition}`",[$i]:eo}],[$i]:uo}],[$i]:uo},{error:"Invalid Access Point Name",[$i]:eo}],[$i]:uo},Qa],[$i]:uo},{[Li]:[{[_i]:ro,[Bi]:[Ba,Eo]}],[Di]:[{[Li]:Gc,error:"S3 Outposts does not support Dual-stack",[$i]:eo},{[Li]:su,error:"S3 Outposts does not support FIPS",[$i]:eo},{[Li]:wc,error:"S3 Outposts does not support S3 Accelerate",[$i]:eo},{[Li]:[{[_i]:Ji,[Bi]:[{[_i]:no,[Bi]:[La,"resourceId[4]"]}]}],error:"Invalid Arn: Outpost Access Point ARN contains sub resources",[$i]:eo},{[Li]:[{[_i]:no,[Bi]:Zc,[ji]:bo}],[Di]:[{[Li]:Hc,[Di]:[Fa,{[Li]:Qc,[Di]:[{[Li]:Cc,[Di]:[{[Li]:eu,[Di]:[{[Li]:tu,[Di]:[{[Li]:ru,[Di]:[{[Li]:[{[_i]:no,[Bi]:Jc,[ji]:$o}],[Di]:[{[Li]:[{[_i]:no,[Bi]:[La,"resourceId[3]"],[ji]:Oo}],[Di]:[{[Li]:[{[_i]:ro,[Bi]:[{[zi]:$o},Mo]}],[Di]:[{[Li]:bc,endpoint:{[Hi]:"https://{accessPointName}-{bucketArn#accountId}.{outpostId}.{url#authority}",[qi]:tc,[Gi]:sa},[$i]:co},{endpoint:{[Hi]:"https://{accessPointName}-{bucketArn#accountId}.{outpostId}.s3-outposts.{bucketArn#region}.{bucketPartition#dnsSuffix}",[qi]:tc,[Gi]:sa},[$i]:co}],[$i]:uo},{error:"Expected an outpost type `accesspoint`, found {outpostType}",[$i]:eo}],[$i]:uo},{error:"Invalid ARN: expected an access point name",[$i]:eo}],[$i]:uo},{error:"Invalid ARN: Expected a 4-component resource",[$i]:eo}],[$i]:uo},Ga],[$i]:uo},Xa],[$i]:uo},Ya],[$i]:uo}],[$i]:uo}],[$i]:uo},{error:"Invalid ARN: The outpost Id may only contain a-z, A-Z, 0-9 and `-`. Found: `{outpostId}`",[$i]:eo}],[$i]:uo},{error:"Invalid ARN: The Outpost Id was not set",[$i]:eo}],[$i]:uo},{error:"Invalid ARN: Unrecognized format: {Bucket} (type: {arnType})",[$i]:eo}],[$i]:uo},{error:"Invalid ARN: No ARN type specified",[$i]:eo}],[$i]:uo},{[Li]:[{[_i]:io,[Bi]:[Xo,0,4,!1],[ji]:Do},{[_i]:ro,[Bi]:[{[zi]:Do},"arn:"]},{[_i]:po,[Bi]:[{[_i]:Ji,[Bi]:[rc]}]}],error:"Invalid ARN: `{Bucket}` was not a valid ARN",[$i]:eo},{[Li]:[{[_i]:Qi,[Bi]:[wa,Yi]},rc],error:"Path-style addressing cannot be used with ARN buckets",[$i]:eo},{[Li]:vc,[Di]:[{[Li]:Cc,[Di]:[{[Li]:[ba],[Di]:[{[Li]:[Ko,ua,Fo,Sa],endpoint:{[Hi]:"https://s3-fips.dualstack.us-east-1.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",[qi]:va,[Gi]:sa},[$i]:co},{[Li]:[Ko,ua,Fo,Ea,Ca],[Di]:[{endpoint:nc,[$i]:co}],[$i]:uo},{[Li]:[Ko,ua,Fo,Ea,Ra],endpoint:nc,[$i]:co},{[Li]:[da,ua,Fo,Sa],endpoint:{[Hi]:"https://s3-fips.us-east-1.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",[qi]:va,[Gi]:sa},[$i]:co},{[Li]:[da,ua,Fo,Ea,Ca],[Di]:[{endpoint:sc,[$i]:co}],[$i]:uo},{[Li]:[da,ua,Fo,Ea,Ra],endpoint:sc,[$i]:co},{[Li]:[Ko,ua,la,Sa],endpoint:{[Hi]:"https://s3.dualstack.us-east-1.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",[qi]:va,[Gi]:sa},[$i]:co},{[Li]:[Ko,ua,la,Ea,Ca],[Di]:[{endpoint:ic,[$i]:co}],[$i]:uo},{[Li]:[Ko,ua,la,Ea,Ra],endpoint:ic,[$i]:co},{[Li]:[da,Vo,Qo,la,Sa],endpoint:{[Hi]:Lo,[qi]:va,[Gi]:sa},[$i]:co},{[Li]:[da,Vo,Qo,la,Ea,Ca],[Di]:[{[Li]:Kc,endpoint:oc,[$i]:co},{endpoint:oc,[$i]:co}],[$i]:uo},{[Li]:[da,Vo,Qo,la,Ea,Ra],endpoint:oc,[$i]:co},{[Li]:[da,ua,la,Sa],endpoint:{[Hi]:_o,[qi]:va,[Gi]:sa},[$i]:co},{[Li]:[da,ua,la,Ea,Ca],[Di]:[{[Li]:Kc,endpoint:{[Hi]:_o,[qi]:Aa,[Gi]:sa},[$i]:co},{endpoint:ac,[$i]:co}],[$i]:uo},{[Li]:[da,ua,la,Ea,Ra],endpoint:ac,[$i]:co}],[$i]:uo},{error:"Path-style addressing cannot be used with S3 Accelerate",[$i]:eo}],[$i]:uo}],[$i]:uo}],[$i]:uo},{[Li]:[{[_i]:Ji,[Bi]:[cc]},{[_i]:Qi,[Bi]:[cc,Yi]}],[Di]:[{[Li]:Cc,[Di]:[{[Li]:iu,[Di]:[ja,Ha,{[Li]:bc,endpoint:{[Hi]:mo,[qi]:uc,[Gi]:sa},[$i]:co},{[Li]:su,endpoint:{[Hi]:"https://s3-object-lambda-fips.{Region}.{partitionResult#dnsSuffix}",[qi]:uc,[Gi]:sa},[$i]:co},{endpoint:{[Hi]:"https://s3-object-lambda.{Region}.{partitionResult#dnsSuffix}",[qi]:uc,[Gi]:sa},[$i]:co}],[$i]:uo},Da],[$i]:uo}],[$i]:uo},{[Li]:[pa],[Di]:[{[Li]:Cc,[Di]:[{[Li]:iu,[Di]:[{[Li]:[Fo,Ko,ua,Sa],endpoint:{[Hi]:"https://s3-fips.dualstack.us-east-1.{partitionResult#dnsSuffix}",[qi]:va,[Gi]:sa},[$i]:co},{[Li]:[Fo,Ko,ua,Ea,Ca],[Di]:[{endpoint:dc,[$i]:co}],[$i]:uo},{[Li]:[Fo,Ko,ua,Ea,Ra],endpoint:dc,[$i]:co},{[Li]:[Fo,da,ua,Sa],endpoint:{[Hi]:"https://s3-fips.us-east-1.{partitionResult#dnsSuffix}",[qi]:va,[Gi]:sa},[$i]:co},{[Li]:[Fo,da,ua,Ea,Ca],[Di]:[{endpoint:lc,[$i]:co}],[$i]:uo},{[Li]:[Fo,da,ua,Ea,Ra],endpoint:lc,[$i]:co},{[Li]:[la,Ko,ua,Sa],endpoint:{[Hi]:"https://s3.dualstack.us-east-1.{partitionResult#dnsSuffix}",[qi]:va,[Gi]:sa},[$i]:co},{[Li]:[la,Ko,ua,Ea,Ca],[Di]:[{endpoint:hc,[$i]:co}],[$i]:uo},{[Li]:[la,Ko,ua,Ea,Ra],endpoint:hc,[$i]:co},{[Li]:[la,da,Vo,Qo,Sa],endpoint:{[Hi]:mo,[qi]:va,[Gi]:sa},[$i]:co},{[Li]:[la,da,Vo,Qo,Ea,Ca],[Di]:[{[Li]:Kc,endpoint:pc,[$i]:co},{endpoint:pc,[$i]:co}],[$i]:uo},{[Li]:[la,da,Vo,Qo,Ea,Ra],endpoint:pc,[$i]:co},{[Li]:[la,da,ua,Sa],endpoint:{[Hi]:Bo,[qi]:va,[Gi]:sa},[$i]:co},{[Li]:[la,da,ua,Ea,Ca],[Di]:[{[Li]:Kc,endpoint:{[Hi]:Bo,[qi]:Aa,[Gi]:sa},[$i]:co},{endpoint:fc,[$i]:co}],[$i]:uo},{[Li]:[la,da,ua,Ea,Ra],endpoint:fc,[$i]:co}],[$i]:uo},Da],[$i]:uo}],[$i]:uo}],[$i]:uo},{error:"A region must be set when sending requests to S3.",[$i]:eo}]},au=new class{capacity;data=/* @__PURE__ */new Map;parameters=[];constructor({size:e,params:t}){this.capacity=e??50,t&&(this.parameters=t)}get(e,t){const r=this.hash(e);if(!1===r)return t();if(!this.data.has(r)){if(this.data.size>this.capacity+10){const e=this.data.keys();let t=0;for(;;){const{value:r,done:n}=e.next();if(this.data.delete(r),n||++t>10)break}}this.data.set(r,t())}return this.data.get(r)}size(){return this.data.size}hash(e){let t="";const{parameters:r}=this;if(0===r.length)return!1;for(const n of r){const r=String(e[n]??"");if(r.includes("|;"))return!1;t+=r+"|;"}return t}}({size:50,params:["Accelerate","Bucket","DisableAccessPoints","DisableMultiRegionAccessPoints","DisableS3ExpressSessionAuth","Endpoint","ForcePathStyle","Region","UseArnRegion","UseDualStack","UseFIPS","UseGlobalEndpoint","UseObjectLambdaEndpoint","UseS3ExpressControlEndpoint"]}),cu=(e,t={})=>au.get(e,()=>((e,t)=>{const{endpointParams:r,logger:n}=t,{parameters:s,rules:i}=e;t.logger?.debug?.(`${fs} Initial EndpointParams: ${ms(r)}`);const o=Object.entries(s).filter(([,e])=>null!=e.default).map(([e,t])=>[e,t.default]);if(o.length>0)for(const[u,d]of o)r[u]=r[u]??d;const a=Object.entries(s).filter(([,e])=>e.required).map(([e])=>e);for(const u of a)if(null==r[u])throw new gs(`Missing required parameter: '${u}'`);const c=Us(i,{endpointParams:r,logger:n,referenceRecord:{}});return t.logger?.debug?.(`${fs} Resolved endpoint: ${ms(c)}`),c})(ou,{endpointParams:e,logger:t.logger}));ps.aws=Ls;const uu=(du=async(e,t,r)=>({operation:P(t).operation,region:await I(e.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()}),async(e,t,r)=>{if(!r)throw new Error("Could not find `input` for `defaultEndpointRuleSetHttpAuthSchemeParametersProvider`");const n=await du(e,t,r),s=P(t)?.commandInstance?.constructor?.getEndpointParameterInstructions;if(!s)throw new Error(`getEndpointParameterInstructions() is not defined on '${t.commandName}'`);const i=await ai(r,{getEndpointParameterInstructions:s},e);return Object.assign(n,i)});var du;function lu(e){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"s3",region:e.region},propertiesExtractor:(e,t)=>({signingProperties:{config:e,context:t}})}}function hu(e){return{schemeId:"aws.auth#sigv4a",signingProperties:{name:"s3",region:e.region},propertiesExtractor:(e,t)=>({signingProperties:{config:e,context:t}})}}const pu=(fu=cu,mu=e=>{const t=[];return e.operation,t.push(lu(e)),t.push(hu(e)),t},gu={"aws.auth#sigv4":lu,"aws.auth#sigv4a":hu},e=>{const t=fu(e),r=t.properties?.authSchemes;if(!r)return mu(e);const n=[];for(const s of r){const{name:t,properties:i={},...o}=s,a=t.toLowerCase();let c;if(t!==a&&console.warn(`HttpAuthScheme has been normalized with lowercasing: '${t}' to '${a}'`),"sigv4a"===a){c="aws.auth#sigv4a";const e=r.find(e=>{const t=e.name.toLowerCase();return"sigv4a"!==t&&t.startsWith("sigv4")});if("none"===Ui.sigv4aDependency()&&e)continue}else{if(!a.startsWith("sigv4"))throw new Error(`Unknown HttpAuthScheme found in '@smithy.rules#endpointRuleSet': '${a}'`);c="aws.auth#sigv4"}const u=gu[c];if(!u)throw new Error(`Could not find HttpAuthOption create function for '${c}'`);const d=u(e);d.schemeId=c,d.signingProperties={...d.signingProperties||{},...o,...i},n.push(d)}return n});var fu,mu,gu;const yu=e=>{const t=(e=>(e.sigv4aSigningRegionSet=L(e.sigv4aSigningRegionSet),e))(fr(e));return Object.assign(t,{authSchemePreference:I(e.authSchemePreference??[])})},wu={ForcePathStyle:{type:"clientContextParams",name:"forcePathStyle"},UseArnRegion:{type:"clientContextParams",name:"useArnRegion"},DisableMultiRegionAccessPoints:{type:"clientContextParams",name:"disableMultiregionAccessPoints"},Accelerate:{type:"clientContextParams",name:"useAccelerateEndpoint"},DisableS3ExpressSessionAuth:{type:"clientContextParams",name:"disableS3ExpressSessionAuth"},UseGlobalEndpoint:{type:"builtInParams",name:"useGlobalEndpoint"},UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}};class bu extends kr{constructor(e){super(e),Object.setPrototypeOf(this,bu.prototype)}}class Su extends bu{name="NoSuchUpload";$fault="client";constructor(e){super({name:"NoSuchUpload",$fault:"client",...e}),Object.setPrototypeOf(this,Su.prototype)}}class vu extends bu{name="ObjectNotInActiveTierError";$fault="client";constructor(e){super({name:"ObjectNotInActiveTierError",$fault:"client",...e}),Object.setPrototypeOf(this,vu.prototype)}}class Eu extends bu{name="BucketAlreadyExists";$fault="client";constructor(e){super({name:"BucketAlreadyExists",$fault:"client",...e}),Object.setPrototypeOf(this,Eu.prototype)}}class Cu extends bu{name="BucketAlreadyOwnedByYou";$fault="client";constructor(e){super({name:"BucketAlreadyOwnedByYou",$fault:"client",...e}),Object.setPrototypeOf(this,Cu.prototype)}}class xu extends bu{name="NoSuchBucket";$fault="client";constructor(e){super({name:"NoSuchBucket",$fault:"client",...e}),Object.setPrototypeOf(this,xu.prototype)}}class Au extends bu{name="InvalidObjectState";$fault="client";StorageClass;AccessTier;constructor(e){super({name:"InvalidObjectState",$fault:"client",...e}),Object.setPrototypeOf(this,Au.prototype),this.StorageClass=e.StorageClass,this.AccessTier=e.AccessTier}}class Ru extends bu{name="NoSuchKey";$fault="client";constructor(e){super({name:"NoSuchKey",$fault:"client",...e}),Object.setPrototypeOf(this,Ru.prototype)}}class ku extends bu{name="NotFound";$fault="client";constructor(e){super({name:"NotFound",$fault:"client",...e}),Object.setPrototypeOf(this,ku.prototype)}}class Tu extends bu{name="EncryptionTypeMismatch";$fault="client";constructor(e){super({name:"EncryptionTypeMismatch",$fault:"client",...e}),Object.setPrototypeOf(this,Tu.prototype)}}class Pu extends bu{name="InvalidRequest";$fault="client";constructor(e){super({name:"InvalidRequest",$fault:"client",...e}),Object.setPrototypeOf(this,Pu.prototype)}}class Iu extends bu{name="InvalidWriteOffset";$fault="client";constructor(e){super({name:"InvalidWriteOffset",$fault:"client",...e}),Object.setPrototypeOf(this,Iu.prototype)}}class Mu extends bu{name="TooManyParts";$fault="client";constructor(e){super({name:"TooManyParts",$fault:"client",...e}),Object.setPrototypeOf(this,Mu.prototype)}}class Ou extends bu{name="IdempotencyParameterMismatch";$fault="client";constructor(e){super({name:"IdempotencyParameterMismatch",$fault:"client",...e}),Object.setPrototypeOf(this,Ou.prototype)}}class Uu extends bu{name="ObjectAlreadyInActiveTierError";$fault="client";constructor(e){super({name:"ObjectAlreadyInActiveTierError",$fault:"client",...e}),Object.setPrototypeOf(this,Uu.prototype)}}const Nu="AccessKeyId",$u="Bucket",Du="BypassGovernanceRetention",Lu="BucketKeyEnabled",_u="Body",Bu="ChecksumAlgorithm",zu="CacheControl",ju="ChecksumCRC32",Hu="ChecksumCRC32C",qu="ChecksumCRC64NVME",Fu="Cache-Control",Ku="Content-Disposition",Vu="ContentDisposition",Wu="Content-Encoding",Zu="ContentEncoding",Gu="ContentLanguage",Xu="Content-Language",Yu="Content-Length",Ju="ContentLength",Qu="CopyObjectResult",ed="ChecksumSHA1",td="ChecksumSHA256",rd="CopySourceSSECustomerKey",nd="ChecksumType",sd="Content-Type",id="ContentType",od="ContinuationToken",ad="Credentials",cd="DeleteMarker",ud="Delete",dd="Delimiter",ld="Expiration",hd="ExpectedBucketOwner",pd="ExpiresString",fd="ETag",md="EncodingType",gd="Errors",yd="Error",wd="Expires",bd="GrantFullControl",Sd="GrantRead",vd="GrantReadACP",Ed="GrantWriteACP",Cd="IfMatch",xd="If-Match",Ad="IfNoneMatch",Rd="If-None-Match",kd="Key",Td="LastModified",Pd="Metadata",Id="MaxKeys",Md="Owner",Od="ObjectLockLegalHoldStatus",Ud="ObjectLockMode",Nd="ObjectLockRetainUntilDate",$d="Object",Dd="Prefix",Ld="RequestCharged",_d="RequestPayer",Bd="RestoreStatus",zd="Range",jd="StartAfter",Hd="SecretAccessKey",qd="StorageClass",Fd="ServerSideEncryption",Kd="SSECustomerAlgorithm",Vd="SSECustomerKey",Wd="SSECustomerKeyMD5",Zd="SSEKMSEncryptionContext",Gd="SSEKMSKeyId",Xd="SessionToken",Yd="Size",Jd="Tagging",Qd="VersionId",el="WebsiteRedirectLocation",tl="client",rl="error",nl="http",sl="httpChecksum",il="httpError",ol="httpHeader",al="httpPayload",cl="httpPrefixHeaders",ul="httpQuery",dl="streaming",ll="smithy.ts.sdk.synthetic.com.amazonaws.s3",hl="versionId",pl="xmlFlattened",fl="xmlName",ml="x-amz-acl",gl="x-amz-bypass-governance-retention",yl="x-amz-checksum-crc32",wl="x-amz-checksum-crc32c",bl="x-amz-checksum-crc64nvme",Sl="x-amz-checksum-sha1",vl="x-amz-checksum-sha256",El="x-amz-checksum-type",Cl="x-amz-delete-marker",xl="x-amz-expiration",Al="x-amz-expected-bucket-owner",Rl="x-amz-grant-full-control",kl="x-amz-grant-read",Tl="x-amz-grant-read-acp",Pl="x-amz-grant-write-acp",Il="x-amz-meta-",Ml="x-amz-mfa",Ol="x-amz-object-lock-legal-hold",Ul="x-amz-object-lock-mode",Nl="x-amz-object-lock-retain-until-date",$l="x-amz-request-charged",Dl="x-amz-request-payer",Ll="x-amz-storage-class",_l="x-amz-sdk-checksum-algorithm",Bl="x-amz-server-side-encryption",zl="x-amz-server-side-encryption-aws-kms-key-id",jl="x-amz-server-side-encryption-bucket-key-enabled",Hl="x-amz-server-side-encryption-context",ql="x-amz-server-side-encryption-customer-algorithm",Fl="x-amz-server-side-encryption-customer-key",Kl="x-amz-server-side-encryption-customer-key-MD5",Vl="x-amz-tagging",Wl="x-amz-version-id",Zl="x-amz-website-redirect-location",Gl="com.amazonaws.s3";var Xl=[0,Gl,rd,8,0],Yl=[0,Gl,"SessionCredentialValue",8,0],Jl=[0,Gl,Vd,8,0],Ql=[0,Gl,Zd,8,0],eh=[0,Gl,Gd,8,0],th=[0,Gl,"StreamingBlob",{[dl]:1},42],rh=[-3,Gl,"BucketAlreadyExists",{[rl]:tl,[il]:409},[],[]];Pe.for(Gl).registerError(rh,Eu);var nh=[-3,Gl,"BucketAlreadyOwnedByYou",{[rl]:tl,[il]:409},[],[]];Pe.for(Gl).registerError(nh,Cu);var sh=[3,Gl,"CommonPrefix",0,[Dd],[0]],ih=[3,Gl,"CopyObjectOutput",0,[Qu,ld,"CopySourceVersionId",Qd,Fd,Kd,Wd,Gd,Zd,Lu,Ld],[[()=>ah,16],[0,{[ol]:xl}],[0,{[ol]:"x-amz-copy-source-version-id"}],[0,{[ol]:Wl}],[0,{[ol]:Bl}],[0,{[ol]:ql}],[0,{[ol]:Kl}],[()=>eh,{[ol]:zl}],[()=>Ql,{[ol]:Hl}],[2,{[ol]:jl}],[0,{[ol]:$l}]]],oh=[3,Gl,"CopyObjectRequest",0,["ACL",$u,zu,Bu,Vu,Zu,Gu,id,"CopySource","CopySourceIfMatch","CopySourceIfModifiedSince","CopySourceIfNoneMatch","CopySourceIfUnmodifiedSince",wd,bd,Sd,vd,Ed,Cd,Ad,kd,Pd,"MetadataDirective","TaggingDirective",Fd,qd,el,Kd,Vd,Wd,Gd,Zd,Lu,"CopySourceSSECustomerAlgorithm",rd,"CopySourceSSECustomerKeyMD5",_d,Jd,Ud,Nd,Od,hd,"ExpectedSourceBucketOwner"],[[0,{[ol]:ml}],[0,1],[0,{[ol]:Fu}],[0,{[ol]:"x-amz-checksum-algorithm"}],[0,{[ol]:Ku}],[0,{[ol]:Wu}],[0,{[ol]:Xu}],[0,{[ol]:sd}],[0,{[ol]:"x-amz-copy-source"}],[0,{[ol]:"x-amz-copy-source-if-match"}],[4,{[ol]:"x-amz-copy-source-if-modified-since"}],[0,{[ol]:"x-amz-copy-source-if-none-match"}],[4,{[ol]:"x-amz-copy-source-if-unmodified-since"}],[4,{[ol]:wd}],[0,{[ol]:Rl}],[0,{[ol]:kl}],[0,{[ol]:Tl}],[0,{[ol]:Pl}],[0,{[ol]:xd}],[0,{[ol]:Rd}],[0,1],[128,{[cl]:Il}],[0,{[ol]:"x-amz-metadata-directive"}],[0,{[ol]:"x-amz-tagging-directive"}],[0,{[ol]:Bl}],[0,{[ol]:Ll}],[0,{[ol]:Zl}],[0,{[ol]:ql}],[()=>Jl,{[ol]:Fl}],[0,{[ol]:Kl}],[()=>eh,{[ol]:zl}],[()=>Ql,{[ol]:Hl}],[2,{[ol]:jl}],[0,{[ol]:"x-amz-copy-source-server-side-encryption-customer-algorithm"}],[()=>Xl,{[ol]:"x-amz-copy-source-server-side-encryption-customer-key"}],[0,{[ol]:"x-amz-copy-source-server-side-encryption-customer-key-MD5"}],[0,{[ol]:Dl}],[0,{[ol]:Vl}],[0,{[ol]:Ul}],[5,{[ol]:Nl}],[0,{[ol]:Ol}],[0,{[ol]:Al}],[0,{[ol]:"x-amz-source-expected-bucket-owner"}]]],ah=[3,Gl,Qu,0,[fd,Td,nd,ju,Hu,qu,ed,td],[0,4,0,0,0,0,0,0]],ch=[3,Gl,"CreateSessionOutput",{[fl]:"CreateSessionResult"},[Fd,Gd,Zd,Lu,ad],[[0,{[ol]:Bl}],[()=>eh,{[ol]:zl}],[()=>Ql,{[ol]:Hl}],[2,{[ol]:jl}],[()=>_h,{[fl]:ad}]]],uh=[3,Gl,"CreateSessionRequest",0,["SessionMode",$u,Fd,Gd,Zd,Lu],[[0,{[ol]:"x-amz-create-session-mode"}],[0,1],[0,{[ol]:Bl}],[()=>eh,{[ol]:zl}],[()=>Ql,{[ol]:Hl}],[2,{[ol]:jl}]]],dh=[3,Gl,ud,0,["Objects","Quiet"],[[()=>Fh,{[pl]:1,[fl]:$d}],2]],lh=[3,Gl,"DeletedObject",0,[kd,Qd,cd,"DeleteMarkerVersionId"],[0,0,2,0]],hh=[3,Gl,"DeleteObjectOutput",0,[cd,Qd,Ld],[[2,{[ol]:Cl}],[0,{[ol]:Wl}],[0,{[ol]:$l}]]],ph=[3,Gl,"DeleteObjectRequest",0,[$u,kd,"MFA",Qd,_d,Du,hd,Cd,"IfMatchLastModifiedTime","IfMatchSize"],[[0,1],[0,1],[0,{[ol]:Ml}],[0,{[ul]:hl}],[0,{[ol]:Dl}],[2,{[ol]:gl}],[0,{[ol]:Al}],[0,{[ol]:xd}],[6,{[ol]:"x-amz-if-match-last-modified-time"}],[1,{[ol]:"x-amz-if-match-size"}]]],fh=[3,Gl,"DeleteObjectsOutput",{[fl]:"DeleteResult"},["Deleted",Ld,gd],[[()=>Hh,{[pl]:1}],[0,{[ol]:$l}],[()=>qh,{[pl]:1,[fl]:yd}]]],mh=[3,Gl,"DeleteObjectsRequest",0,[$u,ud,"MFA",_d,Du,hd,Bu],[[0,1],[()=>dh,{[al]:1,[fl]:ud}],[0,{[ol]:Ml}],[0,{[ol]:Dl}],[2,{[ol]:gl}],[0,{[ol]:Al}],[0,{[ol]:_l}]]],gh=[-3,Gl,"EncryptionTypeMismatch",{[rl]:tl,[il]:400},[],[]];Pe.for(Gl).registerError(gh,Tu);var yh=[3,Gl,yd,0,[kd,Qd,"Code","Message"],[0,0,0,0]],wh=[3,Gl,"GetObjectOutput",0,[_u,cd,"AcceptRanges",ld,"Restore",Td,Ju,fd,ju,Hu,qu,ed,td,nd,"MissingMeta",Qd,zu,Vu,Zu,Gu,"ContentRange",id,wd,pd,el,Fd,Pd,Kd,Wd,Gd,Lu,qd,Ld,"ReplicationStatus","PartsCount","TagCount",Ud,Nd,Od],[[()=>th,16],[2,{[ol]:Cl}],[0,{[ol]:"accept-ranges"}],[0,{[ol]:xl}],[0,{[ol]:"x-amz-restore"}],[4,{[ol]:"Last-Modified"}],[1,{[ol]:Yu}],[0,{[ol]:fd}],[0,{[ol]:yl}],[0,{[ol]:wl}],[0,{[ol]:bl}],[0,{[ol]:Sl}],[0,{[ol]:vl}],[0,{[ol]:El}],[1,{[ol]:"x-amz-missing-meta"}],[0,{[ol]:Wl}],[0,{[ol]:Fu}],[0,{[ol]:Ku}],[0,{[ol]:Wu}],[0,{[ol]:Xu}],[0,{[ol]:"Content-Range"}],[0,{[ol]:sd}],[4,{[ol]:wd}],[0,{[ol]:pd}],[0,{[ol]:Zl}],[0,{[ol]:Bl}],[128,{[cl]:Il}],[0,{[ol]:ql}],[0,{[ol]:Kl}],[()=>eh,{[ol]:zl}],[2,{[ol]:jl}],[0,{[ol]:Ll}],[0,{[ol]:$l}],[0,{[ol]:"x-amz-replication-status"}],[1,{[ol]:"x-amz-mp-parts-count"}],[1,{[ol]:"x-amz-tagging-count"}],[0,{[ol]:Ul}],[5,{[ol]:Nl}],[0,{[ol]:Ol}]]],bh=[3,Gl,"GetObjectRequest",0,[$u,Cd,"IfModifiedSince",Ad,"IfUnmodifiedSince",kd,zd,"ResponseCacheControl","ResponseContentDisposition","ResponseContentEncoding","ResponseContentLanguage","ResponseContentType","ResponseExpires",Qd,Kd,Vd,Wd,_d,"PartNumber",hd,"ChecksumMode"],[[0,1],[0,{[ol]:xd}],[4,{[ol]:"If-Modified-Since"}],[0,{[ol]:Rd}],[4,{[ol]:"If-Unmodified-Since"}],[0,1],[0,{[ol]:zd}],[0,{[ul]:"response-cache-control"}],[0,{[ul]:"response-content-disposition"}],[0,{[ul]:"response-content-encoding"}],[0,{[ul]:"response-content-language"}],[0,{[ul]:"response-content-type"}],[6,{[ul]:"response-expires"}],[0,{[ul]:hl}],[0,{[ol]:ql}],[()=>Jl,{[ol]:Fl}],[0,{[ol]:Kl}],[0,{[ol]:Dl}],[1,{[ul]:"partNumber"}],[0,{[ol]:Al}],[0,{[ol]:"x-amz-checksum-mode"}]]],Sh=[-3,Gl,"IdempotencyParameterMismatch",{[rl]:tl,[il]:400},[],[]];Pe.for(Gl).registerError(Sh,Ou);var vh=[-3,Gl,"InvalidObjectState",{[rl]:tl,[il]:403},[qd,"AccessTier"],[0,0]];Pe.for(Gl).registerError(vh,Au);var Eh=[-3,Gl,"InvalidRequest",{[rl]:tl,[il]:400},[],[]];Pe.for(Gl).registerError(Eh,Pu);var Ch=[-3,Gl,"InvalidWriteOffset",{[rl]:tl,[il]:400},[],[]];Pe.for(Gl).registerError(Ch,Iu);var xh=[3,Gl,"ListObjectsV2Output",{[fl]:"ListBucketResult"},["IsTruncated","Contents","Name",Dd,dd,Id,"CommonPrefixes",md,"KeyCount",od,"NextContinuationToken",jd,Ld],[2,[()=>Kh,{[pl]:1}],0,0,0,1,[()=>jh,{[pl]:1}],0,1,0,0,0,[0,{[ol]:$l}]]],Ah=[3,Gl,"ListObjectsV2Request",0,[$u,dd,md,Id,Dd,od,"FetchOwner",jd,_d,hd,"OptionalObjectAttributes"],[[0,1],[0,{[ul]:"delimiter"}],[0,{[ul]:"encoding-type"}],[1,{[ul]:"max-keys"}],[0,{[ul]:"prefix"}],[0,{[ul]:"continuation-token"}],[2,{[ul]:"fetch-owner"}],[0,{[ul]:"start-after"}],[0,{[ol]:Dl}],[0,{[ol]:Al}],[64,{[ol]:"x-amz-optional-object-attributes"}]]],Rh=[-3,Gl,"NoSuchBucket",{[rl]:tl,[il]:404},[],[]];Pe.for(Gl).registerError(Rh,xu);var kh=[-3,Gl,"NoSuchKey",{[rl]:tl,[il]:404},[],[]];Pe.for(Gl).registerError(kh,Ru);var Th=[-3,Gl,"NoSuchUpload",{[rl]:tl,[il]:404},[],[]];Pe.for(Gl).registerError(Th,Su);var Ph=[-3,Gl,"NotFound",{[rl]:tl},[],[]];Pe.for(Gl).registerError(Ph,ku);var Ih=[3,Gl,$d,0,[kd,Td,fd,Bu,nd,Yd,qd,Md,Bd],[0,4,0,[64,{[pl]:1}],0,1,0,()=>Nh,()=>Lh]],Mh=[-3,Gl,"ObjectAlreadyInActiveTierError",{[rl]:tl,[il]:403},[],[]];Pe.for(Gl).registerError(Mh,Uu);var Oh=[3,Gl,"ObjectIdentifier",0,[kd,Qd,fd,"LastModifiedTime",Yd],[0,0,0,6,1]],Uh=[-3,Gl,"ObjectNotInActiveTierError",{[rl]:tl,[il]:403},[],[]];Pe.for(Gl).registerError(Uh,vu);var Nh=[3,Gl,Md,0,["DisplayName","ID"],[0,0]],$h=[3,Gl,"PutObjectOutput",0,[ld,fd,ju,Hu,qu,ed,td,nd,Fd,Qd,Kd,Wd,Gd,Zd,Lu,Yd,Ld],[[0,{[ol]:xl}],[0,{[ol]:fd}],[0,{[ol]:yl}],[0,{[ol]:wl}],[0,{[ol]:bl}],[0,{[ol]:Sl}],[0,{[ol]:vl}],[0,{[ol]:El}],[0,{[ol]:Bl}],[0,{[ol]:Wl}],[0,{[ol]:ql}],[0,{[ol]:Kl}],[()=>eh,{[ol]:zl}],[()=>Ql,{[ol]:Hl}],[2,{[ol]:jl}],[1,{[ol]:"x-amz-object-size"}],[0,{[ol]:$l}]]],Dh=[3,Gl,"PutObjectRequest",0,["ACL",_u,$u,zu,Vu,Zu,Gu,Ju,"ContentMD5",id,Bu,ju,Hu,qu,ed,td,wd,Cd,Ad,bd,Sd,vd,Ed,kd,"WriteOffsetBytes",Pd,Fd,qd,el,Kd,Vd,Wd,Gd,Zd,Lu,_d,Jd,Ud,Nd,Od,hd],[[0,{[ol]:ml}],[()=>th,16],[0,1],[0,{[ol]:Fu}],[0,{[ol]:Ku}],[0,{[ol]:Wu}],[0,{[ol]:Xu}],[1,{[ol]:Yu}],[0,{[ol]:"Content-MD5"}],[0,{[ol]:sd}],[0,{[ol]:_l}],[0,{[ol]:yl}],[0,{[ol]:wl}],[0,{[ol]:bl}],[0,{[ol]:Sl}],[0,{[ol]:vl}],[4,{[ol]:wd}],[0,{[ol]:xd}],[0,{[ol]:Rd}],[0,{[ol]:Rl}],[0,{[ol]:kl}],[0,{[ol]:Tl}],[0,{[ol]:Pl}],[0,1],[1,{[ol]:"x-amz-write-offset-bytes"}],[128,{[cl]:Il}],[0,{[ol]:Bl}],[0,{[ol]:Ll}],[0,{[ol]:Zl}],[0,{[ol]:ql}],[()=>Jl,{[ol]:Fl}],[0,{[ol]:Kl}],[()=>eh,{[ol]:zl}],[()=>Ql,{[ol]:Hl}],[2,{[ol]:jl}],[0,{[ol]:Dl}],[0,{[ol]:Vl}],[0,{[ol]:Ul}],[5,{[ol]:Nl}],[0,{[ol]:Ol}],[0,{[ol]:Al}]]],Lh=[3,Gl,Bd,0,["IsRestoreInProgress","RestoreExpiryDate"],[2,4]],_h=[3,Gl,"SessionCredentials",0,[Nu,Hd,Xd,ld],[[0,{[fl]:Nu}],[()=>Yl,{[fl]:Hd}],[()=>Yl,{[fl]:Xd}],[4,{[fl]:ld}]]],Bh=[-3,Gl,"TooManyParts",{[rl]:tl,[il]:400},[],[]];Pe.for(Gl).registerError(Bh,Mu);var zh=[-3,ll,"S3ServiceException",0,[],[]];Pe.for(ll).registerError(zh,bu);var jh=[1,Gl,"CommonPrefixList",0,()=>sh],Hh=[1,Gl,"DeletedObjects",0,()=>lh],qh=[1,Gl,gd,0,()=>yh],Fh=[1,Gl,"ObjectIdentifierList",0,()=>Oh],Kh=[1,Gl,"ObjectList",0,[()=>Ih,0]],Vh=[9,Gl,"CopyObject",{[nl]:["PUT","/{Key+}?x-id=CopyObject",200]},()=>oh,()=>ih],Wh=[9,Gl,"CreateSession",{[nl]:["GET","/?session",200]},()=>uh,()=>ch],Zh=[9,Gl,"DeleteObject",{[nl]:["DELETE","/{Key+}?x-id=DeleteObject",204]},()=>ph,()=>hh],Gh=[9,Gl,"DeleteObjects",{[sl]:"-",[nl]:["POST","/?delete",200]},()=>mh,()=>fh],Xh=[9,Gl,"GetObject",{[sl]:"-",[nl]:["GET","/{Key+}?x-id=GetObject",200]},()=>bh,()=>wh],Yh=[9,Gl,"ListObjectsV2",{[nl]:["GET","/?list-type=2",200]},()=>Ah,()=>xh],Jh=[9,Gl,"PutObject",{[sl]:"-",[nl]:["PUT","/{Key+}?x-id=PutObject",200]},()=>Dh,()=>$h];class Qh extends(Ar.classBuilder().ep({...wu,DisableS3ExpressSessionAuth:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function(e,t,r,n){return[di(r,e.getEndpointParameterInstructions()),is(r)]}).s("AmazonS3","CreateSession",{}).n("S3Client","CreateSessionCommand").sc(Wh).build()){}const ep="3.965.0";function tp(e){return"string"==typeof e?0===e.length:0===e.byteLength}var rp={name:"SHA-1"},np={name:"HMAC",hash:rp},sp=new Uint8Array([218,57,163,238,94,107,75,13,50,85,191,239,149,96,24,144,175,216,7,9]);const ip={};function op(){return"undefined"!=typeof window?window:"undefined"!=typeof self?self:ip}var ap=function(){function e(e){this.toHash=new Uint8Array(0),void 0!==e&&(this.key=new Promise(function(t,r){op().crypto.subtle.importKey("raw",cp(e),np,!1,["sign"]).then(t,r)}),this.key.catch(function(){}))}return e.prototype.update=function(e){if(!tp(e)){var t=cp(e),r=new Uint8Array(this.toHash.byteLength+t.byteLength);r.set(this.toHash,0),r.set(t,this.toHash.byteLength),this.toHash=r}},e.prototype.digest=function(){var e=this;return this.key?this.key.then(function(t){return op().crypto.subtle.sign(np,t,e.toHash).then(function(e){return new Uint8Array(e)})}):tp(this.toHash)?Promise.resolve(sp):Promise.resolve().then(function(){return op().crypto.subtle.digest(rp,e.toHash)}).then(function(e){return Promise.resolve(new Uint8Array(e))})},e.prototype.reset=function(){this.toHash=new Uint8Array(0)},e}();function cp(e){return"string"==typeof e?Yr(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e)}var up=["decrypt","digest","encrypt","exportKey","generateKey","importKey","sign","verify"];function dp(e){return!(!function(e){if("object"==typeof e&&"object"==typeof e.crypto){return"function"==typeof e.crypto.getRandomValues}return!1}(e)||"object"!=typeof e.crypto.subtle)&&function(e){return e&&up.every(function(t){return"function"==typeof e[t]})}(e.crypto.subtle)}var lp=function(){function e(e){if(!dp(op()))throw new Error("SHA1 not supported");this.hash=new ap(e)}return e.prototype.update=function(e,t){this.hash.update(Qr(e))},e.prototype.digest=function(){return this.hash.digest()},e.prototype.reset=function(){this.hash.reset()},e}(),hp={name:"SHA-256"},pp={name:"HMAC",hash:hp},fp=new Uint8Array([227,176,196,66,152,252,28,20,154,251,244,200,153,111,185,36,39,174,65,228,100,155,147,76,164,149,153,27,120,82,184,85]),mp=function(){function e(e){this.toHash=new Uint8Array(0),this.secret=e,this.reset()}return e.prototype.update=function(e){if(!en(e)){var t=Qr(e),r=new Uint8Array(this.toHash.byteLength+t.byteLength);r.set(this.toHash,0),r.set(t,this.toHash.byteLength),this.toHash=r}},e.prototype.digest=function(){var e=this;return this.key?this.key.then(function(t){return op().crypto.subtle.sign(pp,t,e.toHash).then(function(e){return new Uint8Array(e)})}):en(this.toHash)?Promise.resolve(fp):Promise.resolve().then(function(){return op().crypto.subtle.digest(hp,e.toHash)}).then(function(e){return Promise.resolve(new Uint8Array(e))})},e.prototype.reset=function(){var e=this;this.toHash=new Uint8Array(0),this.secret&&void 0!==this.secret&&(this.key=new Promise(function(t,r){op().crypto.subtle.importKey("raw",Qr(e.secret),pp,!1,["sign"]).then(t,r)}),this.key.catch(function(){}))},e}(),gp=64,yp=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),wp=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],bp=Math.pow(2,53)-1,Sp=function(){function e(){this.state=Int32Array.from(wp),this.temp=new Int32Array(64),this.buffer=new Uint8Array(64),this.bufferLength=0,this.bytesHashed=0,this.finished=!1}return e.prototype.update=function(e){if(this.finished)throw new Error("Attempted to update an already finished hash.");var t=0,r=e.byteLength;if(this.bytesHashed+=r,8*this.bytesHashed>bp)throw new Error("Cannot hash more than 2^53 - 1 bits");for(;r>0;)this.buffer[this.bufferLength++]=e[t++],r--,this.bufferLength===gp&&(this.hashBuffer(),this.bufferLength=0)},e.prototype.digest=function(){if(!this.finished){var e=8*this.bytesHashed,t=new DataView(this.buffer.buffer,this.buffer.byteOffset,this.buffer.byteLength),r=this.bufferLength;if(t.setUint8(this.bufferLength++,128),r%gp>=56){for(var n=this.bufferLength;n<gp;n++)t.setUint8(n,0);this.hashBuffer(),this.bufferLength=0}for(n=this.bufferLength;n<56;n++)t.setUint8(n,0);t.setUint32(56,Math.floor(e/4294967296),!0),t.setUint32(60,e),this.hashBuffer(),this.finished=!0}var s=new Uint8Array(32);for(n=0;n<8;n++)s[4*n]=this.state[n]>>>24&255,s[4*n+1]=this.state[n]>>>16&255,s[4*n+2]=this.state[n]>>>8&255,s[4*n+3]=this.state[n]>>>0&255;return s},e.prototype.hashBuffer=function(){for(var e=this.buffer,t=this.state,r=t[0],n=t[1],s=t[2],i=t[3],o=t[4],a=t[5],c=t[6],u=t[7],d=0;d<gp;d++){if(d<16)this.temp[d]=(255&e[4*d])<<24|(255&e[4*d+1])<<16|(255&e[4*d+2])<<8|255&e[4*d+3];else{var l=this.temp[d-2],h=(l>>>17|l<<15)^(l>>>19|l<<13)^l>>>10,p=((l=this.temp[d-15])>>>7|l<<25)^(l>>>18|l<<14)^l>>>3;this.temp[d]=(h+this.temp[d-7]|0)+(p+this.temp[d-16]|0)}var f=(((o>>>6|o<<26)^(o>>>11|o<<21)^(o>>>25|o<<7))+(o&a^~o&c)|0)+(u+(yp[d]+this.temp[d]|0)|0)|0,m=((r>>>2|r<<30)^(r>>>13|r<<19)^(r>>>22|r<<10))+(r&n^r&s^n&s)|0;u=c,c=a,a=o,o=i+f|0,i=s,s=n,n=r,r=f+m|0}t[0]+=r,t[1]+=n,t[2]+=s,t[3]+=i,t[4]+=o,t[5]+=a,t[6]+=c,t[7]+=u},e}(),vp=function(){function e(e){this.secret=e,this.hash=new Sp,this.reset()}return e.prototype.update=function(e){if(!en(e)&&!this.error)try{this.hash.update(Qr(e))}catch(t){this.error=t}},e.prototype.digestSync=function(){if(this.error)throw this.error;return this.outer?(this.outer.finished||this.outer.update(this.hash.digest()),this.outer.digest()):this.hash.digest()},e.prototype.digest=function(){return Zr(this,void 0,void 0,function(){return Gr(this,function(e){return[2,this.digestSync()]})})},e.prototype.reset=function(){if(this.hash=new Sp,this.secret){this.outer=new Sp;var e=function(e){var t=Qr(e);if(t.byteLength>gp){var r=new Sp;r.update(t),t=r.digest()}var n=new Uint8Array(gp);return n.set(t),n}(this.secret),t=new Uint8Array(gp);t.set(e);for(var r=0;r<gp;r++)e[r]^=54,t[r]^=92;this.hash.update(e),this.outer.update(t);for(r=0;r<e.byteLength;r++)e[r]=0}},e}();var Ep=function(){function e(e){dp(op())?this.hash=new mp(e):this.hash=new vp(e)}return e.prototype.update=function(e,t){this.hash.update(Qr(e))},e.prototype.digest=function(){return this.hash.digest()},e.prototype.reset=function(){this.hash.reset()},e}();const Cp=({serviceId:e,clientVersion:t})=>async r=>{const n="undefined"!=typeof window?window.navigator:void 0,s=n?.userAgent??"",i=n?.userAgentData?.platform??xp.os(s)??"other",o=n?.userAgentData?.brands??[],a=o[o.length-1],c=a?.brand??xp.browser(s)??"unknown",u=[["aws-sdk-js",t],["ua","2.1"],[`os/${i}`,void 0],["lang/js"],["md/browser",`${c}_${a?.version??"unknown"}`]];e&&u.push([`api/${e}`,t]);const d=await(r?.userAgentAppId?.());return d&&u.push([`app/${d}`]),u},xp={os:e=>/iPhone|iPad|iPod/.test(e)?"iOS":/Macintosh|Mac OS X/.test(e)?"macOS":/Windows NT/.test(e)?"Windows":/Android/.test(e)?"Android":/Linux/.test(e)?"Linux":void 0,browser:e=>/EdgiOS|EdgA|Edg\//.test(e)?"Microsoft Edge":/Firefox\//.test(e)?"Firefox":/Chrome\//.test(e)?"Chrome":/Safari\//.test(e)?"Safari":void 0};class Ap{bytes;constructor(e){if(this.bytes=e,8!==e.byteLength)throw new Error("Int64 buffers must be exactly 8 bytes")}static fromNumber(e){if(e>0x8000000000000000||e<-0x8000000000000000)throw new Error(`${e} is too large (or, if negative, too small) to represent as an Int64`);const t=new Uint8Array(8);for(let r=7,n=Math.abs(Math.round(e));r>-1&&n>0;r--,n/=256)t[r]=n;return e<0&&Rp(t),new Ap(t)}valueOf(){const e=this.bytes.slice(0),t=128&e[0];return t&&Rp(e),parseInt(he(e),16)*(t?-1:1)}toString(){return String(this.valueOf())}}function Rp(e){for(let t=0;t<8;t++)e[t]^=255;for(let t=7;t>-1&&(e[t]++,0===e[t]);t--);}class kp{toUtf8;fromUtf8;constructor(e,t){this.toUtf8=e,this.fromUtf8=t}format(e){const t=[];for(const s of Object.keys(e)){const r=this.fromUtf8(s);t.push(Uint8Array.from([r.byteLength]),r,this.formatHeaderValue(e[s]))}const r=new Uint8Array(t.reduce((e,t)=>e+t.byteLength,0));let n=0;for(const s of t)r.set(s,n),n+=s.byteLength;return r}formatHeaderValue(e){switch(e.type){case"boolean":return Uint8Array.from([e.value?0:1]);case"byte":return Uint8Array.from([2,e.value]);case"short":const t=new DataView(new ArrayBuffer(3));return t.setUint8(0,3),t.setInt16(1,e.value,!1),new Uint8Array(t.buffer);case"integer":const r=new DataView(new ArrayBuffer(5));return r.setUint8(0,4),r.setInt32(1,e.value,!1),new Uint8Array(r.buffer);case"long":const n=new Uint8Array(9);return n[0]=5,n.set(e.value.bytes,1),n;case"binary":const s=new DataView(new ArrayBuffer(3+e.value.byteLength));s.setUint8(0,6),s.setUint16(1,e.value.byteLength,!1);const i=new Uint8Array(s.buffer);return i.set(e.value,3),i;case"string":const o=this.fromUtf8(e.value),a=new DataView(new ArrayBuffer(3+o.byteLength));a.setUint8(0,7),a.setUint16(1,o.byteLength,!1);const c=new Uint8Array(a.buffer);return c.set(o,3),c;case"timestamp":const u=new Uint8Array(9);return u[0]=8,u.set(Ap.fromNumber(e.value.valueOf()).bytes,1),u;case"uuid":if(!_p.test(e.value))throw new Error(`Invalid UUID received: ${e.value}`);const d=new Uint8Array(17);return d[0]=9,d.set(le(e.value.replace(/\-/g,"")),1),d}}parse(e){const t={};let r=0;for(;r<e.byteLength;){const n=e.getUint8(r++),s=this.toUtf8(new Uint8Array(e.buffer,e.byteOffset+r,n));switch(r+=n,e.getUint8(r++)){case 0:t[s]={type:Pp,value:!0};break;case 1:t[s]={type:Pp,value:!1};break;case 2:t[s]={type:Ip,value:e.getInt8(r++)};break;case 3:t[s]={type:Mp,value:e.getInt16(r,!1)},r+=2;break;case 4:t[s]={type:Op,value:e.getInt32(r,!1)},r+=4;break;case 5:t[s]={type:Up,value:new Ap(new Uint8Array(e.buffer,e.byteOffset+r,8))},r+=8;break;case 6:const n=e.getUint16(r,!1);r+=2,t[s]={type:Np,value:new Uint8Array(e.buffer,e.byteOffset+r,n)},r+=n;break;case 7:const i=e.getUint16(r,!1);r+=2,t[s]={type:$p,value:this.toUtf8(new Uint8Array(e.buffer,e.byteOffset+r,i))},r+=i;break;case 8:t[s]={type:Dp,value:new Date(new Ap(new Uint8Array(e.buffer,e.byteOffset+r,8)).valueOf())},r+=8;break;case 9:const o=new Uint8Array(e.buffer,e.byteOffset+r,16);r+=16,t[s]={type:Lp,value:`${he(o.subarray(0,4))}-${he(o.subarray(4,6))}-${he(o.subarray(6,8))}-${he(o.subarray(8,10))}-${he(o.subarray(10))}`};break;default:throw new Error("Unrecognized header type tag")}}return t}}var Tp;!function(e){e[e.boolTrue=0]="boolTrue",e[e.boolFalse=1]="boolFalse",e[e.byte=2]="byte",e[e.short=3]="short",e[e.integer=4]="integer",e[e.long=5]="long",e[e.byteArray=6]="byteArray",e[e.string=7]="string",e[e.timestamp=8]="timestamp",e[e.uuid=9]="uuid"}(Tp||(Tp={}));const Pp="boolean",Ip="byte",Mp="short",Op="integer",Up="long",Np="binary",$p="string",Dp="timestamp",Lp="uuid",_p=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;class Bp{headerMarshaller;messageBuffer;isEndOfStream;constructor(e,t){this.headerMarshaller=new kp(e,t),this.messageBuffer=[],this.isEndOfStream=!1}feed(e){this.messageBuffer.push(this.decode(e))}endOfStream(){this.isEndOfStream=!0}getMessage(){const e=this.messageBuffer.pop(),t=this.isEndOfStream;return{getMessage:()=>e,isEndOfStream:()=>t}}getAvailableMessages(){const e=this.messageBuffer;this.messageBuffer=[];const t=this.isEndOfStream;return{getMessages:()=>e,isEndOfStream:()=>t}}encode({headers:e,body:t}){const r=this.headerMarshaller.format(e),n=r.byteLength+t.byteLength+16,s=new Uint8Array(n),i=new DataView(s.buffer,s.byteOffset,s.byteLength),o=new bn;return i.setUint32(0,n,!1),i.setUint32(4,r.byteLength,!1),i.setUint32(8,o.update(s.subarray(0,8)).digest(),!1),s.set(r,12),s.set(t,r.byteLength+12),i.setUint32(n-4,o.update(s.subarray(8,n-4)).digest(),!1),s}decode(e){const{headers:t,body:r}=function({byteLength:e,byteOffset:t,buffer:r}){if(e<16)throw new Error("Provided message too short to accommodate event stream message overhead");const n=new DataView(r,t,e),s=n.getUint32(0,!1);if(e!==s)throw new Error("Reported message length does not match received message length");const i=n.getUint32(4,!1),o=n.getUint32(8,!1),a=n.getUint32(e-4,!1),c=(new bn).update(new Uint8Array(r,t,8));if(o!==c.digest())throw new Error(`The prelude checksum specified in the message (${o}) does not match the calculated CRC32 checksum (${c.digest()})`);if(c.update(new Uint8Array(r,t+8,e-12)),a!==c.digest())throw new Error(`The message checksum (${c.digest()}) did not match the expected value of ${a}`);return{headers:new DataView(r,t+8+4,i),body:new Uint8Array(r,t+8+4+i,s-i-16)}}(e);return{headers:this.headerMarshaller.parse(t),body:r}}formatHeaders(e){return this.headerMarshaller.format(e)}}class zp{options;constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(const e of this.options.inputStream){const t=this.options.decoder.decode(e);yield t}}}class jp{options;constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(const e of this.options.messageStream){const t=this.options.encoder.encode(e);yield t}this.options.includeEndFrame&&(yield new Uint8Array(0))}}class Hp{options;constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(const e of this.options.messageStream){const t=await this.options.deserializer(e);void 0!==t&&(yield t)}}}class qp{options;constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(const e of this.options.inputStream){const t=this.options.serializer(e);yield t}}}function Fp(e,t){return async function(r){const{value:n}=r.headers[":message-type"];if("error"===n){const e=new Error(r.headers[":error-message"].value||"UnknownError");throw e.name=r.headers[":error-code"].value,e}if("exception"===n){const n=r.headers[":exception-type"].value,s={[n]:r},i=await e(s);if(i.$unknown){const e=new Error(t(r.body));throw e.name=n,e}throw i[n]}if("event"===n){const t={[r.headers[":event-type"].value]:r},n=await e(t);if(n.$unknown)return;return n}throw Error(`Unrecognizable event type: ${r.headers[":event-type"].value}`)}}let Kp=class{eventStreamCodec;utfEncoder;constructor({utf8Encoder:e,utf8Decoder:t}){this.eventStreamCodec=new Bp(e,t),this.utfEncoder=e}deserialize(e,t){const r=function(e){let t=0,r=0,n=null,s=null;const i=e=>{if("number"!=typeof e)throw new Error("Attempted to allocate an event message where size was not a number: "+e);t=e,r=4,n=new Uint8Array(e),new DataView(n.buffer).setUint32(0,e,!1)};return{[Symbol.asyncIterator]:async function*(){const o=e[Symbol.asyncIterator]();for(;;){const{value:e,done:a}=await o.next();if(a){if(!t)return;if(t!==r)throw new Error("Truncated event message received.");return void(yield n)}const c=e.length;let u=0;for(;u<c;){if(!n){const t=c-u;s||(s=new Uint8Array(4));const n=Math.min(4-r,t);if(s.set(e.slice(u,u+n),r),r+=n,u+=n,r<4)break;i(new DataView(s.buffer).getUint32(0,!1)),s=null}const o=Math.min(t-r,c-u);n.set(e.slice(u,u+o),r),r+=o,u+=o,t&&t===r&&(yield n,n=null,t=0,r=0)}}}}}(e);return new Hp({messageStream:new zp({inputStream:r,decoder:this.eventStreamCodec}),deserializer:Fp(t,this.utfEncoder)})}serialize(e,t){return new jp({messageStream:new qp({inputStream:e,serializer:t}),encoder:this.eventStreamCodec,includeEndFrame:!0})}};class Vp{universalMarshaller;constructor({utf8Encoder:e,utf8Decoder:t}){this.universalMarshaller=new Kp({utf8Decoder:t,utf8Encoder:e})}deserialize(e,t){const r=Wp(e)?(n=e,{[Symbol.asyncIterator]:async function*(){const e=n.getReader();try{for(;;){const{done:t,value:r}=await e.read();if(t)return;yield r}}finally{e.releaseLock()}}}):e;var n;return this.universalMarshaller.deserialize(r,t)}serialize(e,t){const r=this.universalMarshaller.serialize(e,t);return"function"==typeof ReadableStream?(e=>{const t=e[Symbol.asyncIterator]();return new ReadableStream({async pull(e){const{done:r,value:n}=await t.next();if(r)return e.close();e.enqueue(n)}})})(r):r}}const Wp=e=>"function"==typeof ReadableStream&&e instanceof ReadableStream,Zp=e=>new Vp(e);const Gp=async function(e,t){const r=new e;return await async function(e,t,r=1048576){const n=e.size;let s=0;for(;s<n;){const i=e.slice(s,Math.min(n,s+r));t(new Uint8Array(await i.arrayBuffer())),s+=i.size}}(t,e=>{r.update(e)}),r.digest()},Xp=64,Yp=[1732584193,4023233417,2562383102,271733878];class Jp{state;buffer;bufferLength;bytesHashed;finished;constructor(){this.reset()}update(e){if(function(e){if("string"==typeof e)return 0===e.length;return 0===e.byteLength}(e))return;if(this.finished)throw new Error("Attempted to update an already finished hash.");const t=function(e){if("string"==typeof e)return H(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT);return new Uint8Array(e)}(e);let r=0,{byteLength:n}=t;for(this.bytesHashed+=n;n>0;)this.buffer.setUint8(this.bufferLength++,t[r++]),n--,this.bufferLength===Xp&&(this.hashBuffer(),this.bufferLength=0)}async digest(){if(!this.finished){const{buffer:e,bufferLength:t,bytesHashed:r}=this,n=8*r;if(e.setUint8(this.bufferLength++,128),t%Xp>=56){for(let t=this.bufferLength;t<Xp;t++)e.setUint8(t,0);this.hashBuffer(),this.bufferLength=0}for(let s=this.bufferLength;s<56;s++)e.setUint8(s,0);e.setUint32(56,n>>>0,!0),e.setUint32(60,Math.floor(n/4294967296),!0),this.hashBuffer(),this.finished=!0}const e=new DataView(new ArrayBuffer(16));for(let t=0;t<4;t++)e.setUint32(4*t,this.state[t],!0);return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}hashBuffer(){const{buffer:e,state:t}=this;let r=t[0],n=t[1],s=t[2],i=t[3];r=ef(r,n,s,i,e.getUint32(0,!0),7,3614090360),i=ef(i,r,n,s,e.getUint32(4,!0),12,3905402710),s=ef(s,i,r,n,e.getUint32(8,!0),17,606105819),n=ef(n,s,i,r,e.getUint32(12,!0),22,3250441966),r=ef(r,n,s,i,e.getUint32(16,!0),7,4118548399),i=ef(i,r,n,s,e.getUint32(20,!0),12,1200080426),s=ef(s,i,r,n,e.getUint32(24,!0),17,2821735955),n=ef(n,s,i,r,e.getUint32(28,!0),22,4249261313),r=ef(r,n,s,i,e.getUint32(32,!0),7,1770035416),i=ef(i,r,n,s,e.getUint32(36,!0),12,2336552879),s=ef(s,i,r,n,e.getUint32(40,!0),17,4294925233),n=ef(n,s,i,r,e.getUint32(44,!0),22,2304563134),r=ef(r,n,s,i,e.getUint32(48,!0),7,1804603682),i=ef(i,r,n,s,e.getUint32(52,!0),12,4254626195),s=ef(s,i,r,n,e.getUint32(56,!0),17,2792965006),n=ef(n,s,i,r,e.getUint32(60,!0),22,1236535329),r=tf(r,n,s,i,e.getUint32(4,!0),5,4129170786),i=tf(i,r,n,s,e.getUint32(24,!0),9,3225465664),s=tf(s,i,r,n,e.getUint32(44,!0),14,643717713),n=tf(n,s,i,r,e.getUint32(0,!0),20,3921069994),r=tf(r,n,s,i,e.getUint32(20,!0),5,3593408605),i=tf(i,r,n,s,e.getUint32(40,!0),9,38016083),s=tf(s,i,r,n,e.getUint32(60,!0),14,3634488961),n=tf(n,s,i,r,e.getUint32(16,!0),20,3889429448),r=tf(r,n,s,i,e.getUint32(36,!0),5,568446438),i=tf(i,r,n,s,e.getUint32(56,!0),9,3275163606),s=tf(s,i,r,n,e.getUint32(12,!0),14,4107603335),n=tf(n,s,i,r,e.getUint32(32,!0),20,1163531501),r=tf(r,n,s,i,e.getUint32(52,!0),5,2850285829),i=tf(i,r,n,s,e.getUint32(8,!0),9,4243563512),s=tf(s,i,r,n,e.getUint32(28,!0),14,1735328473),n=tf(n,s,i,r,e.getUint32(48,!0),20,2368359562),r=rf(r,n,s,i,e.getUint32(20,!0),4,4294588738),i=rf(i,r,n,s,e.getUint32(32,!0),11,2272392833),s=rf(s,i,r,n,e.getUint32(44,!0),16,1839030562),n=rf(n,s,i,r,e.getUint32(56,!0),23,4259657740),r=rf(r,n,s,i,e.getUint32(4,!0),4,2763975236),i=rf(i,r,n,s,e.getUint32(16,!0),11,1272893353),s=rf(s,i,r,n,e.getUint32(28,!0),16,4139469664),n=rf(n,s,i,r,e.getUint32(40,!0),23,3200236656),r=rf(r,n,s,i,e.getUint32(52,!0),4,681279174),i=rf(i,r,n,s,e.getUint32(0,!0),11,3936430074),s=rf(s,i,r,n,e.getUint32(12,!0),16,3572445317),n=rf(n,s,i,r,e.getUint32(24,!0),23,76029189),r=rf(r,n,s,i,e.getUint32(36,!0),4,3654602809),i=rf(i,r,n,s,e.getUint32(48,!0),11,3873151461),s=rf(s,i,r,n,e.getUint32(60,!0),16,530742520),n=rf(n,s,i,r,e.getUint32(8,!0),23,3299628645),r=nf(r,n,s,i,e.getUint32(0,!0),6,4096336452),i=nf(i,r,n,s,e.getUint32(28,!0),10,1126891415),s=nf(s,i,r,n,e.getUint32(56,!0),15,2878612391),n=nf(n,s,i,r,e.getUint32(20,!0),21,4237533241),r=nf(r,n,s,i,e.getUint32(48,!0),6,1700485571),i=nf(i,r,n,s,e.getUint32(12,!0),10,2399980690),s=nf(s,i,r,n,e.getUint32(40,!0),15,4293915773),n=nf(n,s,i,r,e.getUint32(4,!0),21,2240044497),r=nf(r,n,s,i,e.getUint32(32,!0),6,1873313359),i=nf(i,r,n,s,e.getUint32(60,!0),10,4264355552),s=nf(s,i,r,n,e.getUint32(24,!0),15,2734768916),n=nf(n,s,i,r,e.getUint32(52,!0),21,1309151649),r=nf(r,n,s,i,e.getUint32(16,!0),6,4149444226),i=nf(i,r,n,s,e.getUint32(44,!0),10,3174756917),s=nf(s,i,r,n,e.getUint32(8,!0),15,718787259),n=nf(n,s,i,r,e.getUint32(36,!0),21,3951481745),t[0]=r+t[0]&4294967295,t[1]=n+t[1]&4294967295,t[2]=s+t[2]&4294967295,t[3]=i+t[3]&4294967295}reset(){this.state=Uint32Array.from(Yp),this.buffer=new DataView(new ArrayBuffer(Xp)),this.bufferLength=0,this.bytesHashed=0,this.finished=!1}}function Qp(e,t,r,n,s,i){return((t=(t+e&4294967295)+(n+i&4294967295)&4294967295)<<s|t>>>32-s)+r&4294967295}function ef(e,t,r,n,s,i,o){return Qp(t&r|~t&n,e,t,s,i,o)}function tf(e,t,r,n,s,i,o){return Qp(t&n|r&~n,e,t,s,i,o)}function rf(e,t,r,n,s,i,o){return Qp(t^r^n,e,t,s,i,o)}function nf(e,t,r,n,s,i,o){return Qp(r^(t|~n),e,t,s,i,o)}const sf=["in-region","cross-region","mobile","standard","legacy"],of=()=>{const e=window?.navigator;if(e?.connection){const{effectiveType:t,rtt:r,downlink:n}=e?.connection;if("string"==typeof t&&"4g"!==t||Number(r)>100||Number(n)<10)return!0}return e?.userAgentData?.mobile||"number"==typeof e?.maxTouchPoints&&e?.maxTouchPoints>1},af=e=>{const t=(({defaultsMode:e}={})=>$t(async()=>{const t="function"==typeof e?await e():e;switch(t?.toLowerCase()){case"auto":return Promise.resolve(of()?"mobile":"standard");case"mobile":case"in-region":case"cross-region":case"standard":case"legacy":return Promise.resolve(t?.toLocaleLowerCase());case void 0:return Promise.resolve("legacy");default:throw new Error(`Invalid parameter for "defaultsMode", expect ${sf.join(", ")}, got ${t}`)}}))(e),r=()=>t().then(Pr),n=(e=>({apiVersion:"2006-03-01",base64Decoder:e?.base64Decoder??j,base64Encoder:e?.base64Encoder??K,disableHostPrefix:e?.disableHostPrefix??!1,endpointProvider:e?.endpointProvider??cu,extensions:e?.extensions??[],getAwsChunkedEncodingStream:e?.getAwsChunkedEncodingStream??te,httpAuthSchemeProvider:e?.httpAuthSchemeProvider??pu,httpAuthSchemes:e?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4"),signer:new k},{schemeId:"aws.auth#sigv4a",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4a"),signer:new T}],logger:e?.logger??new Or,protocol:e?.protocol??qr,protocolSettings:e?.protocolSettings??{defaultNamespace:"com.amazonaws.s3",xmlNamespace:"http://s3.amazonaws.com/doc/2006-03-01/",version:"2006-03-01",serviceTarget:"AmazonS3"},sdkStreamMixin:e?.sdkStreamMixin??fe,serviceId:e?.serviceId??"S3",signerConstructor:e?.signerConstructor??Ui,signingEscapePath:e?.signingEscapePath??!1,urlParser:e?.urlParser??_s,useArnRegion:e?.useArnRegion??void 0,utf8Decoder:e?.utf8Decoder??H,utf8Encoder:e?.utf8Encoder??F}))(e);return{...n,...e,runtime:"browser",defaultsMode:t,bodyLengthChecker:e?.bodyLengthChecker??gr,credentialDefaultProvider:e?.credentialDefaultProvider??(e=>()=>Promise.reject(new Error("Credential is missing"))),defaultUserAgentProvider:e?.defaultUserAgentProvider??Cp({serviceId:n.serviceId,clientVersion:ep}),eventStreamSerdeProvider:e?.eventStreamSerdeProvider??Zp,maxAttempts:e?.maxAttempts??3,md5:e?.md5??Jp,region:e?.region??(s="Region is missing",()=>Promise.reject(s)),requestHandler:ae.create(e?.requestHandler??r),retryMode:e?.retryMode??(async()=>(await r()).retryMode||pi),sha1:e?.sha1??lp,sha256:e?.sha256??Ep,streamCollector:e?.streamCollector??ce,streamHasher:e?.streamHasher??Gp,useDualstackEndpoint:e?.useDualstackEndpoint??(()=>Promise.resolve(false)),useFipsEndpoint:e?.useFipsEndpoint??(()=>Promise.resolve(false))};var s},cf=(e,t)=>{const r=Object.assign((e=>({setRegion(t){e.region=t},region:()=>e.region}))(e),Ir(e),(e=>({setHttpHandler(t){e.httpHandler=t},httpHandler:()=>e.httpHandler,updateHttpClientConfig(t,r){e.httpHandler?.updateHttpClientConfig(t,r)},httpHandlerConfigs:()=>e.httpHandler.httpHandlerConfigs()}))(e),(e=>{const t=e.httpAuthSchemes;let r=e.httpAuthSchemeProvider,n=e.credentials;return{setHttpAuthScheme(e){const r=t.findIndex(t=>t.schemeId===e.schemeId);-1===r?t.push(e):t.splice(r,1,e)},httpAuthSchemes:()=>t,setHttpAuthSchemeProvider(e){r=e},httpAuthSchemeProvider:()=>r,setCredentials(e){n=e},credentials:()=>n}})(e));return t.forEach(e=>e.configure(r)),Object.assign(e,{region:r.region()},(n=r,Object.assign((e=>{const t={};return e.checksumAlgorithms().forEach(e=>{t[e.algorithmId()]=e.checksumConstructor()}),t})(n),(e=>{const t={};return t.retryStrategy=e.retryStrategy(),t})(n))),{httpHandler:r.httpHandler()},(e=>({httpAuthSchemes:e.httpAuthSchemes(),httpAuthSchemeProvider:e.httpAuthSchemeProvider(),credentials:e.credentials()}))(r));var n};class uf extends Er{config;constructor(...[e]){const t=af(e||{});super(t),this.initConfig=t;var r;const n=function(e){const t=L(e.userAgentAppId??void 0),{customUserAgent:r}=e;return Object.assign(e,{customUserAgent:"string"==typeof r?[[r]]:r,userAgentAppId:async()=>{const r=await t();if(!function(e){return void 0===e||"string"==typeof e&&e.length<=50}(r)){const t="NoOpLogger"!==e.logger?.constructor?.name&&e.logger?e.logger:console;"string"!=typeof r?t?.warn("userAgentAppId must be a string or undefined."):r.length>50&&t?.warn("The provided userAgentAppId exceeds the maximum length of 50 characters.")}return r}})}((r=t,Object.assign(r,{useFipsEndpoint:r.useFipsEndpoint??!1,useDualstackEndpoint:r.useDualstackEndpoint??!1,forcePathStyle:r.forcePathStyle??!1,useAccelerateEndpoint:r.useAccelerateEndpoint??!1,useGlobalEndpoint:r.useGlobalEndpoint??!1,disableMultiregionAccessPoints:r.disableMultiregionAccessPoints??!1,defaultSigningName:"s3",clientContextParams:r.clientContextParams??{}}))),s=(e=>{const{requestChecksumCalculation:t,responseChecksumValidation:r,requestStreamBufferSize:n}=e;return Object.assign(e,{requestChecksumCalculation:I(t??h),responseChecksumValidation:I(r??m),requestStreamBufferSize:Number(n??0)})})(n),i=(e=>{const{retryStrategy:t,retryMode:r,maxAttempts:n}=e,s=I(n??3);return Object.assign(e,{maxAttempts:s,retryStrategy:async()=>t||(await I(r)()===li.ADAPTIVE?new xi(s):new Ci(s))})})(s),o=(e=>{const t=e.tls??!0,{endpoint:r,useDualstackEndpoint:n,useFipsEndpoint:s}=e,i=null!=r?async()=>oi(await I(r)()):void 0,o=!!r,a=Object.assign(e,{endpoint:i,tls:t,isCustomEndpoint:o,useDualstackEndpoint:I(n??!1),useFipsEndpoint:I(s??!1)});let c;return a.serviceConfiguredEndpoint=async()=>(e.serviceId&&!c&&(c=ii(e.serviceId)),c),a})(Gs(i)),a=(c=o,Object.assign(c,{eventStreamMarshaller:c.eventStreamSerdeProvider(c)}));var c;const d=((e,{session:t})=>{const[r,n]=t,{forcePathStyle:s,useAccelerateEndpoint:i,disableMultiregionAccessPoints:o,followRegionRedirects:a,s3ExpressIdentityProvider:c,bucketEndpoint:u,expectContinueHeader:d}=e;return Object.assign(e,{forcePathStyle:s??!1,useAccelerateEndpoint:i??!1,disableMultiregionAccessPoints:o??!1,followRegionRedirects:a??!1,s3ExpressIdentityProvider:c??new Fn(async e=>r().send(new n({Bucket:e}))),bucketEndpoint:u??!1,expectContinueHeader:d??2097152})})(yu(a),{session:[()=>this,Qh]}),l=cf(d,e?.extensions||[]);var p;this.config=l,this.middlewareStack.use(Ce(this.config)),this.middlewareStack.use((p=this.config,{applyToStack:e=>{e.add(Fs(p),Vs)}})),this.middlewareStack.use(Mi(this.config)),this.middlewareStack.use(Js(this.config)),this.middlewareStack.use(On(this.config)),this.middlewareStack.use((this.config,{applyToStack:e=>{e.add((e,t)=>async r=>{try{const n=await e(r),{clientName:s,commandName:i,logger:o,dynamoDbDocumentClientOptions:a={}}=t,{overrideInputFilterSensitiveLog:c,overrideOutputFilterSensitiveLog:u}=a,d=c??t.inputFilterSensitiveLog,l=u??t.outputFilterSensitiveLog,{$metadata:h,...p}=n.output;return o?.info?.({clientName:s,commandName:i,input:d(r.input),output:l(p),metadata:h}),n}catch(n){const{clientName:e,commandName:s,logger:i,dynamoDbDocumentClientOptions:o={}}=t,{overrideInputFilterSensitiveLog:a}=o,c=a??t.inputFilterSensitiveLog;throw i?.error?.({clientName:e,commandName:s,input:c(r.input),error:n,metadata:n.$metadata}),n}},Un)}})),this.middlewareStack.use((this.config,{applyToStack:e=>{e.add(e=>async t=>e(t),Nn)}})),this.middlewareStack.use(((e,{httpAuthSchemeParametersProvider:t,identityProviderConfigProvider:r})=>({applyToStack:n=>{n.addRelativeTo(M(e,{httpAuthSchemeParametersProvider:t,identityProviderConfigProvider:r}),O)}}))(this.config,{httpAuthSchemeParametersProvider:uu,identityProviderConfigProvider:async e=>new Mt({"aws.auth#sigv4":e.credentials,"aws.auth#sigv4a":e.credentials})})),this.middlewareStack.use(D(this.config)),this.middlewareStack.use(cs(this.config)),this.middlewareStack.use(u(this.config)),this.middlewareStack.use(Bn(this.config)),this.middlewareStack.use(Yn(this.config)),this.middlewareStack.use((e=>({applyToStack:t=>{t.addRelativeTo(es(e),$)}}))(this.config))}destroy(){super.destroy()}}const df={name:"ssecMiddleware",step:"initialize",tags:["SSE"],override:!0},lf=e=>({applyToStack:t=>{var r;t.add((r=e,e=>async t=>{const n={...t.input},s=[{target:"SSECustomerKey",hash:"SSECustomerKeyMD5"},{target:"CopySourceSSECustomerKey",hash:"CopySourceSSECustomerKeyMD5"}];for(const e of s){const t=n[e.target];if(t){let s;"string"==typeof t?hf(t,r)?s=r.base64Decoder(t):(s=r.utf8Decoder(t),n[e.target]=r.base64Encoder(s)):(s=ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):new Uint8Array(t),n[e.target]=r.base64Encoder(s));const i=new r.md5;i.update(s),n[e.hash]=r.base64Encoder(await i.digest())}}return e({...t,input:n})}),df)}});function hf(e,t){if(!/^(?:[A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e))return!1;try{return 32===t.base64Decoder(e).length}catch{return!1}}class pf extends(Ar.classBuilder().ep({...wu,DisableS3ExpressSessionAuth:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"},Key:{type:"contextParams",name:"Key"},CopySource:{type:"contextParams",name:"CopySource"}}).m(function(e,t,r,n){return[di(r,e.getEndpointParameterInstructions()),is(r),lf(r)]}).s("AmazonS3","CopyObject",{}).n("S3Client","CopyObjectCommand").sc(Vh).build()){}class ff extends(Ar.classBuilder().ep({...wu,Bucket:{type:"contextParams",name:"Bucket"},Key:{type:"contextParams",name:"Key"}}).m(function(e,t,r,n){return[di(r,e.getEndpointParameterInstructions()),is(r)]}).s("AmazonS3","DeleteObject",{}).n("S3Client","DeleteObjectCommand").sc(Zh).build()){}class mf extends(Ar.classBuilder().ep({...wu,Bucket:{type:"contextParams",name:"Bucket"}}).m(function(e,t,r,n){return[di(r,e.getEndpointParameterInstructions()),In(r,{requestAlgorithmMember:{httpHeader:"x-amz-sdk-checksum-algorithm",name:"ChecksumAlgorithm"},requestChecksumRequired:!0}),is(r)]}).s("AmazonS3","DeleteObjects",{}).n("S3Client","DeleteObjectsCommand").sc(Gh).build()){}class gf extends(Ar.classBuilder().ep({...wu,Bucket:{type:"contextParams",name:"Bucket"},Key:{type:"contextParams",name:"Key"}}).m(function(e,t,r,n){return[di(r,e.getEndpointParameterInstructions()),In(r,{requestChecksumRequired:!1,requestValidationModeMember:"ChecksumMode",responseAlgorithms:["CRC64NVME","CRC32","CRC32C","SHA256","SHA1"]}),lf(r),{applyToStack:e=>{e.addRelativeTo(zn(),jn)}}]}).s("AmazonS3","GetObject",{}).n("S3Client","GetObjectCommand").sc(Xh).build()){}class yf extends(Ar.classBuilder().ep({...wu,Bucket:{type:"contextParams",name:"Bucket"},Prefix:{type:"contextParams",name:"Prefix"}}).m(function(e,t,r,n){return[di(r,e.getEndpointParameterInstructions()),is(r)]}).s("AmazonS3","ListObjectsV2",{}).n("S3Client","ListObjectsV2Command").sc(Yh).build()){}class wf extends(Ar.classBuilder().ep({...wu,Bucket:{type:"contextParams",name:"Bucket"},Key:{type:"contextParams",name:"Key"}}).m(function(e,t,r,n){return[di(r,e.getEndpointParameterInstructions()),In(r,{requestAlgorithmMember:{httpHeader:"x-amz-sdk-checksum-algorithm",name:"ChecksumAlgorithm"},requestChecksumRequired:!1}),Dn(),is(r),lf(r)]}).s("AmazonS3","PutObject",{}).n("S3Client","PutObjectCommand").sc(Jh).build()){}async function bf(e,t={}){const{key:r,body:n,destinationKey:s,provider:i,...o}=t,a=i||function(){const e={cloudflare:["CLOUDFLARE_BUCKET_NAME","CLOUDFLARE_ACCESS_KEY_ID","CLOUDFLARE_SECRET_ACCESS_KEY","CLOUDFLARE_BUCKET_URL"],backblaze:["BACKBLAZE_BUCKET_NAME","BACKBLAZE_ACCESS_KEY_ID","BACKBLAZE_SECRET_ACCESS_KEY","BACKBLAZE_BUCKET_URL"],amazon:["AMAZON_BUCKET_NAME","AMAZON_ACCESS_KEY_ID","AMAZON_SECRET_ACCESS_KEY","AMAZON_BUCKET_URL"]};for(const[t,r]of Object.entries(e))if(r.every(e=>process.env[e]))return t;return"cloudflare"}(),c=Object.fromEntries(Object.entries(o).map(([e,t])=>[`${a.toUpperCase()}_${e}`,t])),u=function(e,t={}){const r=e.toUpperCase()+"_";return{region:"amazon"===e?t.awsRegion||process.env.AMAZON_REGION||"us-east-1":"auto",endpoint:t[`${r}BUCKET_URL`]||process.env[`${r}BUCKET_URL`]||"",bucket:t[`${r}BUCKET_NAME`]||process.env[`${r}BUCKET_NAME`]||"",accessKeyId:t[`${r}ACCESS_KEY_ID`]||t[`${r}APPLICATION_KEY_ID`]||process.env[`${r}ACCESS_KEY_ID`]||process.env[`${r}APPLICATION_KEY_ID`]||"",secretAccessKey:t[`${r}SECRET_ACCESS_KEY`]||t[`${r}APPLICATION_KEY`]||process.env[`${r}SECRET_ACCESS_KEY`]||process.env[`${r}APPLICATION_KEY`]||""}}(a,c);if(!u.bucket||!u.accessKeyId||!u.secretAccessKey)throw new Error(`Missing credentials for ${a}`);const d=new uf({region:u.region,endpoint:u.endpoint,credentials:{accessKeyId:u.accessKeyId,secretAccessKey:u.secretAccessKey}});try{switch(e){case"upload":return{success:!0,key:r,...await d.send(new wf({Bucket:u.bucket,Key:r,Body:n}))};case"download":const e=await d.send(new gf({Bucket:u.bucket,Key:r}));return await(e.Body?.transformToString());case"delete":return{success:!0,key:r,...await d.send(new ff({Bucket:u.bucket,Key:r}))};case"list":const t=await d.send(new yf({Bucket:u.bucket}));return t.Contents?.map(e=>e.Key)||[];case"deleteAll":const i=await d.send(new yf({Bucket:u.bucket}));if(i.Contents?.length){const e=await d.send(new mf({Bucket:u.bucket,Delete:{Objects:i.Contents.map(e=>({Key:e.Key}))}}));return{success:!0,count:i.Contents.length,...e}}return{success:!0,count:0};case"copy":if(!s)throw new Error("destinationKey is required for copy operation");return{success:!0,sourceKey:r,destinationKey:s,...await d.send(new pf({Bucket:u.bucket,CopySource:`${u.bucket}/${r}`,Key:s}))};case"rename":if(!s)throw new Error("destinationKey is required for rename operation");return await d.send(new pf({Bucket:u.bucket,CopySource:`${u.bucket}/${r}`,Key:s})),await d.send(new ff({Bucket:u.bucket,Key:r})),{success:!0,oldKey:r,newKey:s};default:throw new Error("Invalid action: upload, download, delete, list, deleteAll, copy, rename")}}catch(l){throw console.error(`Error in ${a}:`,l.message),l}}e();export{H as f,bf as m,F as t};
@@ -1,7 +1,20 @@
1
1
  /**
2
2
  * Storage operation action type
3
3
  */
4
- export declare type Action = "upload" | "download" | "delete" | "list" | "deleteAll";
4
+ export declare type Action = "upload" | "download" | "delete" | "list" | "deleteAll" | "copy" | "rename";
5
+
6
+ /**
7
+ * Result from copy operation
8
+ */
9
+ export declare interface CopyResult {
10
+ /** Whether the copy was successful */
11
+ success: boolean;
12
+ /** The source object key */
13
+ sourceKey: string;
14
+ /** The destination object key */
15
+ destinationKey: string;
16
+ [key: string]: any;
17
+ }
5
18
 
6
19
  /**
7
20
  * Result from deleteAll operation
@@ -26,7 +39,7 @@ export declare interface DeleteResult {
26
39
  }
27
40
 
28
41
  /**
29
- * Universal cloud storage manager supporting AWS S3, Cloudflare R2, and Backblaze B2.
42
+ * Universal cloud storage manager supporting Amazon S3, Backblaze B2, and Cloudflare R2.
30
43
  * Automatically detects the configured provider from environment variables.
31
44
  *
32
45
  * @param action - The storage operation to perform
@@ -63,38 +76,77 @@ export declare interface DeleteResult {
63
76
  * });
64
77
  *
65
78
  * @example
79
+ * // Copy a file
80
+ * await manageStorage('copy', {
81
+ * key: 'documents/report.pdf',
82
+ * destinationKey: 'documents/report-copy.pdf'
83
+ * });
84
+ *
85
+ * @example
86
+ * // Rename a file (copy + delete)
87
+ * await manageStorage('rename', {
88
+ * key: 'documents/old-name.pdf',
89
+ * destinationKey: 'documents/new-name.pdf'
90
+ * });
91
+ *
92
+ * @example
66
93
  * // Force a specific provider with runtime credentials
67
94
  * await manageStorage('upload', {
68
95
  * key: 'test.txt',
69
96
  * body: 'Hello!',
70
- * provider: 'r2',
97
+ * provider: 'cloudflare',
71
98
  * BUCKET_NAME: 'my-bucket',
72
99
  * ACCESS_KEY_ID: 'key-id',
73
100
  * SECRET_ACCESS_KEY: 'secret',
74
101
  * BUCKET_URL: 'https://account.r2.cloudflarestorage.com'
75
102
  * });
76
103
  */
77
- export declare function manageStorage(action: "upload", options: StorageOptions & {
104
+ declare function manageStorage(action: "upload", options: StorageOptions & {
78
105
  key: string;
79
106
  body: string | Buffer | ReadableStream;
80
107
  }): Promise<UploadResult>;
81
108
 
82
- export declare function manageStorage(action: "download", options: StorageOptions & {
109
+ declare function manageStorage(action: "download", options: StorageOptions & {
83
110
  key: string;
84
111
  }): Promise<string>;
85
112
 
86
- export declare function manageStorage(action: "delete", options: StorageOptions & {
113
+ declare function manageStorage(action: "delete", options: StorageOptions & {
87
114
  key: string;
88
115
  }): Promise<DeleteResult>;
89
116
 
90
- export declare function manageStorage(action: "list", options?: StorageOptions): Promise<string[]>;
117
+ declare function manageStorage(action: "list", options?: StorageOptions): Promise<string[]>;
118
+
119
+ declare function manageStorage(action: "deleteAll", options?: StorageOptions): Promise<DeleteAllResult>;
120
+
121
+ declare function manageStorage(action: "copy", options: StorageOptions & {
122
+ key: string;
123
+ destinationKey: string;
124
+ }): Promise<CopyResult>;
91
125
 
92
- export declare function manageStorage(action: "deleteAll", options?: StorageOptions): Promise<DeleteAllResult>;
126
+ declare function manageStorage(action: "rename", options: StorageOptions & {
127
+ key: string;
128
+ destinationKey: string;
129
+ }): Promise<RenameResult>;
130
+ export default manageStorage;
131
+ export { manageStorage }
93
132
 
94
133
  /**
95
134
  * Cloud storage provider type
96
135
  */
97
- export declare type Provider = "s3" | "r2" | "b2";
136
+ export declare type Provider = "amazon" | "backblaze" | "cloudflare";
137
+
138
+ /**
139
+ * Result from rename operation
140
+ */
141
+ export declare interface RenameResult {
142
+ /** Whether the rename was successful */
143
+ success: boolean;
144
+ /** The old object key */
145
+ oldKey: string;
146
+ /** The new object key */
147
+ newKey: string;
148
+ [key: string]: any;
149
+ }
98
150
 
99
151
  /**
100
152
  * Options for storage operations
@@ -102,6 +154,8 @@ export declare type Provider = "s3" | "r2" | "b2";
102
154
  export declare interface StorageOptions {
103
155
  /** The object key/path (required for upload, download, delete) */
104
156
  key?: string;
157
+ /** The destination key/path (required for copy, rename) */
158
+ destinationKey?: string;
105
159
  /** The file content to upload (required for upload) */
106
160
  body?: string | Buffer | ReadableStream;
107
161
  /** Force a specific cloud provider (auto-detected if omitted) */
@@ -0,0 +1 @@
1
+ import"dotenv";import{m as a,m as e}from"./manage-storage-B0amn6is.js";export{a as default,e as manageStorage};
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "manage-storage",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "description": "Storage manager supporting AWS S3, Cloudflare R2, and Backblaze B2 with automatic provider detection",
5
- "main": "./dist/index.js",
6
- "module": "./dist/index.js",
7
- "types": "./dist/index.d.ts",
5
+ "main": "./dist/manage-storage.js",
6
+ "module": "./dist/manage-storage.js",
7
+ "types": "./dist/manage-storage.d.ts",
8
8
  "type": "module",
9
9
  "keywords": [
10
10
  "s3",
@@ -30,16 +30,15 @@
30
30
  },
31
31
  "homepage": "https://github.com/vtempest/Starter-DOCS#readme",
32
32
  "dependencies": {
33
- "@aws-lite/client": "^0.23.2",
34
- "@aws-lite/s3": "^0.2.6",
33
+ "@aws-sdk/client-s3": "^3.965.0",
35
34
  "dotenv": "^17.2.3"
36
35
  },
37
36
  "devDependencies": {
38
- "@aws-lite/s3-types": "^0.2.6",
39
- "@types/node": "^22.19.3",
40
- "typescript": "^5.7.3",
41
- "vite": "^6.0.7",
42
- "vite-plugin-dts": "^4.3.0"
37
+ "@types/node": "^25.0.3",
38
+ "terser": "^5.44.1",
39
+ "typescript": "^5.9.3",
40
+ "vite": "^7.3.1",
41
+ "vite-plugin-dts": "^4.5.4"
43
42
  },
44
43
  "scripts": {
45
44
  "build": "vite build",
@@ -48,8 +47,8 @@
48
47
  },
49
48
  "exports": {
50
49
  ".": {
51
- "types": "./dist/index.d.ts",
52
- "import": "./dist/index.js"
50
+ "types": "./dist/manage-storage.d.ts",
51
+ "import": "./dist/manage-storage.js"
53
52
  }
54
53
  },
55
54
  "files": [
package/dist/index.js DELETED
@@ -1,113 +0,0 @@
1
- import $ from "@aws-lite/client";
2
- import y from "@aws-lite/s3";
3
- import { config as f } from "dotenv";
4
- f();
5
- async function w(o, s = {}) {
6
- var _, i;
7
- const { key: e, body: E, provider: d, ...K } = s, c = d || b(), A = Object.fromEntries(
8
- Object.entries(K).map(([n, a]) => [`${c.toUpperCase()}_${n}`, a])
9
- ), t = g(c, A);
10
- if (!t.bucket || !t.accessKeyId || !t.secretAccessKey)
11
- throw new Error(`Missing credentials for ${c}`);
12
- const r = await $({
13
- region: t.region,
14
- endpoint: t.endpoint,
15
- accessKeyId: t.accessKeyId,
16
- secretAccessKey: t.secretAccessKey,
17
- plugins: [y]
18
- });
19
- try {
20
- switch (o) {
21
- case "upload":
22
- const n = await r.s3.PutObject({
23
- Bucket: t.bucket,
24
- Key: e,
25
- Body: E
26
- });
27
- return console.log(`Uploaded ${e} to ${c}`), { success: !0, key: e, ...n };
28
- case "download":
29
- const a = await r.s3.GetObject({
30
- Bucket: t.bucket,
31
- Key: e
32
- });
33
- return console.log(`Downloaded ${e} from ${c}`), a.Body;
34
- case "delete":
35
- const S = await r.s3.DeleteObject({
36
- Bucket: t.bucket,
37
- Key: e
38
- });
39
- return console.log(`Deleted ${e} from ${c}`), { success: !0, key: e, ...S };
40
- case "list":
41
- const C = ((_ = (await r.s3.ListObjectsV2({
42
- Bucket: t.bucket
43
- })).Contents) == null ? void 0 : _.map((u) => u.Key)) || [];
44
- return console.log(C.join(`
45
- `)), C;
46
- case "deleteAll":
47
- const l = await r.s3.ListObjectsV2({
48
- Bucket: t.bucket
49
- });
50
- if ((i = l.Contents) != null && i.length) {
51
- const u = await r.s3.DeleteObjects({
52
- Bucket: t.bucket,
53
- Delete: {
54
- Objects: l.Contents.map((p) => ({ Key: p.Key }))
55
- }
56
- });
57
- return console.log(
58
- `Deleted all ${l.Contents.length} files from ${c}`
59
- ), {
60
- success: !0,
61
- count: l.Contents.length,
62
- ...u
63
- };
64
- } else
65
- return console.log(`${c} bucket empty`), { success: !0, count: 0 };
66
- default:
67
- throw new Error(
68
- "Invalid action: upload, download, delete, list, deleteAll"
69
- );
70
- }
71
- } catch (n) {
72
- throw console.error(`Error in ${c}:`, n.message), n;
73
- }
74
- }
75
- function b() {
76
- const o = {
77
- r2: [
78
- "R2_BUCKET_NAME",
79
- "R2_ACCESS_KEY_ID",
80
- "R2_SECRET_ACCESS_KEY",
81
- "R2_BUCKET_URL"
82
- ],
83
- b2: [
84
- "B2_BUCKET_NAME",
85
- "B2_ACCESS_KEY_ID",
86
- "B2_SECRET_ACCESS_KEY",
87
- "B2_BUCKET_URL"
88
- ],
89
- s3: [
90
- "S3_BUCKET_NAME",
91
- "S3_ACCESS_KEY_ID",
92
- "S3_SECRET_ACCESS_KEY",
93
- "S3_BUCKET_URL"
94
- ]
95
- };
96
- for (const [s, e] of Object.entries(o))
97
- if (e.every((E) => process.env[E]))
98
- return s;
99
- return "r2";
100
- }
101
- function g(o, s = {}) {
102
- const e = o.toUpperCase() + "_";
103
- return {
104
- region: o === "s3" ? s.awsRegion || process.env.S3_REGION || "us-east-1" : "auto",
105
- endpoint: s[`${e}BUCKET_URL`] || process.env[`${e}BUCKET_URL`] || "",
106
- bucket: s[`${e}BUCKET_NAME`] || process.env[`${e}BUCKET_NAME`] || "",
107
- accessKeyId: s[`${e}ACCESS_KEY_ID`] || s[`${e}APPLICATION_KEY_ID`] || process.env[`${e}ACCESS_KEY_ID`] || process.env[`${e}APPLICATION_KEY_ID`] || "",
108
- secretAccessKey: s[`${e}SECRET_ACCESS_KEY`] || s[`${e}APPLICATION_KEY`] || process.env[`${e}SECRET_ACCESS_KEY`] || process.env[`${e}APPLICATION_KEY`] || ""
109
- };
110
- }
111
- export {
112
- w as manageStorage
113
- };