From 7b369ea7690e4f1d680815bc72447f2a4ee6b8d5 Mon Sep 17 00:00:00 2001 From: "Marcus R. Brown" Date: Tue, 19 May 2026 00:41:00 -0700 Subject: [PATCH 1/8] fix(gateway): plumb AWS credentials through optional secret files Reads AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, and the optional AWS_SESSION_TOKEN from secret files in loadGatewayConfig, validates the access/secret pair, and injects them into the S3Client constructor. When neither is set, the SDK default credential chain takes over so IRSA/EC2-instance-role deployments keep working. - AwsCredentials interface added next to ObjectStoreConfig - Pair validation: throws when exactly one of the access/secret pair is set - AWS_SESSION_TOKEN is optional and only attached when the pair is present - Orphan session token (set without the pair) logs an info-level warning and falls through to the SDK default chain - S3Client receives credentials only when explicitly configured Gateway tests: 87 -> 95 (+8). Runtime tests: 350 -> 352 (+2). --- packages/gateway/src/config.test.ts | 157 +++++++++++++++++- packages/gateway/src/config.ts | 38 ++++- packages/gateway/src/runtime-effect.ts | 2 +- .../src/object-store/s3-adapter.test.ts | 30 ++++ .../runtime/src/object-store/s3-adapter.ts | 7 +- packages/runtime/src/shared/types.ts | 8 + 6 files changed, 238 insertions(+), 4 deletions(-) diff --git a/packages/gateway/src/config.test.ts b/packages/gateway/src/config.test.ts index 211be854..3eb70c38 100644 --- a/packages/gateway/src/config.test.ts +++ b/packages/gateway/src/config.test.ts @@ -4,7 +4,7 @@ import {mkdtempSync, rmSync, writeFileSync} from 'node:fs' import {tmpdir} from 'node:os' import {join} from 'node:path' -import {afterEach, beforeEach, describe, expect, it} from 'vitest' +import {afterEach, beforeEach, describe, expect, it, vi} from 'vitest' import {loadGatewayConfig, readOptionalSecret, readSecret} from './config.js' @@ -39,6 +39,12 @@ beforeEach(() => { 'TOKEN_FILE', 'MISSING', 'MISSING_FILE', + 'AWS_ACCESS_KEY_ID', + 'AWS_ACCESS_KEY_ID_FILE', + 'AWS_SECRET_ACCESS_KEY', + 'AWS_SECRET_ACCESS_KEY_FILE', + 'AWS_SESSION_TOKEN', + 'AWS_SESSION_TOKEN_FILE', ]) { delete process.env[key] } @@ -352,3 +358,152 @@ describe('loadGatewayConfig', () => { expect(config.objectStore.endpoint).toBeUndefined() }) }) + +// --------------------------------------------------------------------------- +// AWS credentials +// --------------------------------------------------------------------------- + +describe('AWS credentials', () => { + it('happy path: both credentials set, no session token', () => { + // #given + setRequiredEnv() + const keyFile = join(tmpDir, 'aws-key-id.txt') + const secretFile = join(tmpDir, 'aws-secret.txt') + writeFileSync(keyFile, 'AKIAIOSFODNN7EXAMPLE') + writeFileSync(secretFile, 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY') + process.env.AWS_ACCESS_KEY_ID_FILE = keyFile + process.env.AWS_SECRET_ACCESS_KEY_FILE = secretFile + + // #when + const config = loadGatewayConfig() + + // #then + expect(config.objectStore.credentials).toEqual({ + accessKeyId: 'AKIAIOSFODNN7EXAMPLE', + secretAccessKey: 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY', + }) + expect(config.objectStore.credentials).not.toHaveProperty('sessionToken') + }) + + it('happy path: all three credentials set', () => { + // #given + setRequiredEnv() + const keyFile = join(tmpDir, 'aws-key-id.txt') + const secretFile = join(tmpDir, 'aws-secret.txt') + const tokenFile = join(tmpDir, 'aws-session-token.txt') + writeFileSync(keyFile, 'AKIAIOSFODNN7EXAMPLE') + writeFileSync(secretFile, 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY') + writeFileSync(tokenFile, 'AQoXnyc4lcK4w4OIaHPuTZat//SESSION_TOKEN') + process.env.AWS_ACCESS_KEY_ID_FILE = keyFile + process.env.AWS_SECRET_ACCESS_KEY_FILE = secretFile + process.env.AWS_SESSION_TOKEN_FILE = tokenFile + + // #when + const config = loadGatewayConfig() + + // #then + expect(config.objectStore.credentials).toEqual({ + accessKeyId: 'AKIAIOSFODNN7EXAMPLE', + secretAccessKey: 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY', + sessionToken: 'AQoXnyc4lcK4w4OIaHPuTZat//SESSION_TOKEN', + }) + }) + + it('happy path: no credentials set — credentials is undefined', () => { + // #given + setRequiredEnv() + + // #when + const config = loadGatewayConfig() + + // #then + expect(config.objectStore.credentials).toBeUndefined() + }) + + it('edge case: empty credential files treated as not set — credentials is undefined', () => { + // #given + setRequiredEnv() + const keyFile = join(tmpDir, 'aws-key-id-empty.txt') + const secretFile = join(tmpDir, 'aws-secret-empty.txt') + writeFileSync(keyFile, '') + writeFileSync(secretFile, '') + process.env.AWS_ACCESS_KEY_ID_FILE = keyFile + process.env.AWS_SECRET_ACCESS_KEY_FILE = secretFile + + // #when + const config = loadGatewayConfig() + + // #then — empty files are treated as "not set" by readOptionalSecret + expect(config.objectStore.credentials).toBeUndefined() + }) + + it('edge case: pair present + empty session-token file — sessionToken omitted', () => { + // #given + setRequiredEnv() + const keyFile = join(tmpDir, 'aws-key-id.txt') + const secretFile = join(tmpDir, 'aws-secret.txt') + const tokenFile = join(tmpDir, 'aws-session-token-empty.txt') + writeFileSync(keyFile, 'AKIAIOSFODNN7EXAMPLE') + writeFileSync(secretFile, 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY') + writeFileSync(tokenFile, '') + process.env.AWS_ACCESS_KEY_ID_FILE = keyFile + process.env.AWS_SECRET_ACCESS_KEY_FILE = secretFile + process.env.AWS_SESSION_TOKEN_FILE = tokenFile + + // #when + const config = loadGatewayConfig() + + // #then — empty session token file is treated as "not set" + expect(config.objectStore.credentials).toEqual({ + accessKeyId: 'AKIAIOSFODNN7EXAMPLE', + secretAccessKey: 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY', + }) + expect(config.objectStore.credentials).not.toHaveProperty('sessionToken') + }) + + it('error path: only AWS_ACCESS_KEY_ID set — throws with pair error message', () => { + // #given + setRequiredEnv() + process.env.AWS_ACCESS_KEY_ID = 'AKIAIOSFODNN7EXAMPLE' + + // #when / #then + expect(() => loadGatewayConfig()).toThrow( + 'Both AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY must be set together (received: AWS_ACCESS_KEY_ID)', + ) + }) + + it('error path: only AWS_SECRET_ACCESS_KEY set — throws with pair error message', () => { + // #given + setRequiredEnv() + process.env.AWS_SECRET_ACCESS_KEY = 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY' + + // #when / #then + expect(() => loadGatewayConfig()).toThrow( + 'Both AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY must be set together (received: AWS_SECRET_ACCESS_KEY)', + ) + }) + + it('edge case: orphan session token — no throw, credentials undefined, warning logged', () => { + // #given + setRequiredEnv() + process.env.AWS_SESSION_TOKEN = 'AQoXnyc4lcK4w4OIaHPuTZat//SESSION_TOKEN' + const consoleSpy = vi.spyOn(console, 'log').mockImplementation(() => undefined) + + // #when + const config = loadGatewayConfig() + + // #then — assert before restoring spy so mock.calls is still populated + expect(config.objectStore.credentials).toBeUndefined() + expect(consoleSpy).toHaveBeenCalledTimes(1) + const loggedArg: unknown = consoleSpy.mock.calls[0]?.[0] + expect(typeof loggedArg).toBe('string') + const parsed: unknown = JSON.parse(loggedArg as string) + expect(parsed).toMatchObject({ + level: 'info', + msg: expect.stringContaining( + 'AWS_SESSION_TOKEN is set without AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY', + ) as unknown, + }) + consoleSpy.mockRestore() + }) +}) diff --git a/packages/gateway/src/config.ts b/packages/gateway/src/config.ts index 32038ccd..04ad7d6f 100644 --- a/packages/gateway/src/config.ts +++ b/packages/gateway/src/config.ts @@ -1,4 +1,4 @@ -import type {ObjectStoreConfig} from './runtime-effect.js' +import type {AwsCredentials, ObjectStoreConfig} from './runtime-effect.js' import {existsSync, readFileSync} from 'node:fs' import process from 'node:process' @@ -81,6 +81,41 @@ export function loadGatewayConfig(): GatewayConfig { } const logLevel = rawLogLevel as GatewayConfig['logLevel'] + const awsAccessKeyId = readOptionalSecret('AWS_ACCESS_KEY_ID') + const awsSecretAccessKey = readOptionalSecret('AWS_SECRET_ACCESS_KEY') + const awsSessionToken = readOptionalSecret('AWS_SESSION_TOKEN') + + // Pair validation: both must be set together, or neither + if (awsAccessKeyId !== null && awsSecretAccessKey === null) { + throw new Error( + 'Both AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY must be set together (received: AWS_ACCESS_KEY_ID). Set both, or set neither to use the SDK default credential chain.', + ) + } + + if (awsSecretAccessKey !== null && awsAccessKeyId === null) { + throw new Error( + 'Both AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY must be set together (received: AWS_SECRET_ACCESS_KEY). Set both, or set neither to use the SDK default credential chain.', + ) + } + + let credentials: AwsCredentials | undefined + + if (awsAccessKeyId !== null && awsSecretAccessKey !== null) { + credentials = { + accessKeyId: awsAccessKeyId, + secretAccessKey: awsSecretAccessKey, + ...(awsSessionToken === null ? {} : {sessionToken: awsSessionToken}), + } + } else if (awsSessionToken !== null) { + // eslint-disable-next-line no-console + console.log( + JSON.stringify({ + level: 'info', + msg: 'AWS_SESSION_TOKEN is set without AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY; ignoring it and falling back to SDK default credential chain.', + }), + ) + } + const objectStore: ObjectStoreConfig = { enabled: true, bucket: s3Bucket, @@ -88,6 +123,7 @@ export function loadGatewayConfig(): GatewayConfig { prefix: s3Prefix, ...(s3Endpoint === undefined ? {} : {endpoint: s3Endpoint}), ...(s3Sse === undefined ? {} : {sseEncryption: s3Sse as ObjectStoreConfig['sseEncryption']}), + ...(credentials === undefined ? {} : {credentials}), } return { diff --git a/packages/gateway/src/runtime-effect.ts b/packages/gateway/src/runtime-effect.ts index 8e95d78b..c2e13581 100644 --- a/packages/gateway/src/runtime-effect.ts +++ b/packages/gateway/src/runtime-effect.ts @@ -33,7 +33,7 @@ import { } from '@fro-bot/runtime' import {Effect} from 'effect' -export type {ObjectStoreConfig} from '@fro-bot/runtime' +export type {AwsCredentials, ObjectStoreConfig} from '@fro-bot/runtime' // --------------------------------------------------------------------------- // Shared logger type used by all coordination functions diff --git a/packages/runtime/src/object-store/s3-adapter.test.ts b/packages/runtime/src/object-store/s3-adapter.test.ts index ce4888c8..0dda535f 100644 --- a/packages/runtime/src/object-store/s3-adapter.test.ts +++ b/packages/runtime/src/object-store/s3-adapter.test.ts @@ -447,4 +447,34 @@ describe('createS3Adapter', () => { expect(result.success).toBe(false) expect(result.success === false ? result.error : undefined).toBeInstanceOf(Error) }) + + it('passes credentials to S3Client when credentials are provided in config', () => { + // #given + const credentials = { + accessKeyId: 'AKIAIOSFODNN7EXAMPLE', + secretAccessKey: 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY', + } + const configWithCredentials: ObjectStoreConfig = {...baseConfig, credentials} + clientConfigs.length = 0 + + // #when + createS3Adapter(configWithCredentials, createLogger()) + + // #then + expect(clientConfigs).toHaveLength(1) + expect(clientConfigs[0]).toHaveProperty('credentials', credentials) + }) + + it('does not set credentials on S3Client when credentials are absent in config', () => { + // #given + const configWithoutCredentials: ObjectStoreConfig = {...baseConfig} + clientConfigs.length = 0 + + // #when + createS3Adapter(configWithoutCredentials, createLogger()) + + // #then + expect(clientConfigs).toHaveLength(1) + expect(clientConfigs[0]).not.toHaveProperty('credentials') + }) }) diff --git a/packages/runtime/src/object-store/s3-adapter.ts b/packages/runtime/src/object-store/s3-adapter.ts index 8c9bfeac..9607d7ef 100644 --- a/packages/runtime/src/object-store/s3-adapter.ts +++ b/packages/runtime/src/object-store/s3-adapter.ts @@ -97,10 +97,15 @@ function createClient(config: ObjectStoreConfig): S3Client { forcePathStyle: true, maxAttempts, region, + ...(config.credentials == null ? {} : {credentials: config.credentials}), }) } - return new S3Client({maxAttempts, region}) + return new S3Client({ + maxAttempts, + region, + ...(config.credentials == null ? {} : {credentials: config.credentials}), + }) } function getEffectiveEncryption(config: ObjectStoreConfig): 'AES256' | 'aws:kms' { diff --git a/packages/runtime/src/shared/types.ts b/packages/runtime/src/shared/types.ts index 04d38289..521429a9 100644 --- a/packages/runtime/src/shared/types.ts +++ b/packages/runtime/src/shared/types.ts @@ -7,6 +7,13 @@ export {err, isErr, isOk, ok} from '@bfra.me/es/result' // Agent identity for cache scoping export type AgentIdentity = 'discord' | 'github' +// AWS credential identity for explicit S3 authentication +export interface AwsCredentials { + readonly accessKeyId: string + readonly secretAccessKey: string + readonly sessionToken?: string +} + // Object store configuration (pure data shape; adapter lives in services/object-store/) export interface ObjectStoreConfig { readonly enabled: boolean @@ -18,6 +25,7 @@ export interface ObjectStoreConfig { readonly allowInsecureEndpoint?: boolean readonly sseEncryption?: 'aws:kms' | 'AES256' readonly sseKmsKeyId?: string + readonly credentials?: AwsCredentials } // Cache restore result From 000e83715d5360d7dd6c7347fcb1a127777d8bd0 Mon Sep 17 00:00:00 2001 From: "Marcus R. Brown" Date: Tue, 19 May 2026 00:44:45 -0700 Subject: [PATCH 2/8] fix(gateway): mount AWS credential secrets, bound log output, guard directory secrets deploy/compose.yaml now mounts the three AWS credential bind-mounts (access key id, secret access key, session token) alongside the existing Discord and S3 secret files, so operators wiring infra-as-code can supply them through the same pattern. Each service also gains a bounded json-file logging block (10m x 3) to keep small-VM disk usage in check. readOptionalSecret now asserts the secret path resolves to a file via statSync, not just that the path exists. When a bind-mount source doesn't exist on the host, Docker materializes the path as a directory; the new guard surfaces a clear startup error pointing operators at the likely cause instead of failing later with a raw EISDIR. Gateway tests: 95 -> 96 (+1). Docker compose config validates clean once the three AWS secret files exist (empty files for the default-chain path). --- deploy/compose.yaml | 25 +++++++++++++++++++++++++ packages/gateway/src/config.test.ts | 19 +++++++++++++++++++ packages/gateway/src/config.ts | 8 +++++++- 3 files changed, 51 insertions(+), 1 deletion(-) diff --git a/deploy/compose.yaml b/deploy/compose.yaml index ab215b2b..baa42f7b 100644 --- a/deploy/compose.yaml +++ b/deploy/compose.yaml @@ -20,6 +20,9 @@ services: S3_BUCKET_FILE: /run/secrets/s3_bucket S3_REGION_FILE: /run/secrets/s3_region S3_ENDPOINT_FILE: /run/secrets/s3_endpoint + AWS_ACCESS_KEY_ID_FILE: /run/secrets/aws_access_key_id + AWS_SECRET_ACCESS_KEY_FILE: /run/secrets/aws_secret_access_key + AWS_SESSION_TOKEN_FILE: /run/secrets/aws_session_token # Optional — guild-scoped slash command registration (fast dev propagation) DISCORD_GUILD_ID_FILE: /run/secrets/discord_guild_id # Egress proxy (regular proxy mode — NOT transparent) @@ -34,6 +37,13 @@ services: - ./secrets/s3-bucket:/run/secrets/s3_bucket:ro - ./secrets/s3-region:/run/secrets/s3_region:ro - ./secrets/s3-endpoint:/run/secrets/s3_endpoint:ro + # Optional — AWS credentials for explicit S3 authentication. Leave the + # access-key-id and secret-access-key files empty (`touch deploy/secrets/aws-access-key-id`) + # to fall back to the AWS SDK default credential chain (env, ~/.aws, IMDS). + # AWS_SESSION_TOKEN is only needed for STS temporary credentials. + - ./secrets/aws-access-key-id:/run/secrets/aws_access_key_id:ro + - ./secrets/aws-secret-access-key:/run/secrets/aws_secret_access_key:ro + - ./secrets/aws-session-token:/run/secrets/aws_session_token:ro # Optional — guild-scoped slash command registration (fast dev propagation). # Create the file empty (`touch deploy/secrets/discord-guild-id`) to register # slash commands globally; the gateway treats empty files as unset. @@ -44,6 +54,11 @@ services: - gateway-net - sandbox-net restart: unless-stopped + logging: + driver: json-file + options: + max-size: 10m + max-file: '3' healthcheck: test: [CMD-SHELL, test -s /etc/ssl/certs/mitmproxy-ca-cert.pem] interval: 30s @@ -65,6 +80,11 @@ services: networks: - sandbox-net restart: unless-stopped + logging: + driver: json-file + options: + max-size: 10m + max-file: '3' mitmproxy: image: mitmproxy/mitmproxy:11.0.2@sha256:92ab9e0626ec73a3abae9c460e5475323f414745d7d0001205c8fa0c77ad31a2 @@ -89,6 +109,11 @@ services: networks: - sandbox-net restart: unless-stopped + logging: + driver: json-file + options: + max-size: 10m + max-file: '3' healthcheck: # Gate dependent services on the CA actually existing in the shared # volume. mitmproxy generates ~/.mitmproxy/mitmproxy-ca-cert.pem on diff --git a/packages/gateway/src/config.test.ts b/packages/gateway/src/config.test.ts index 3eb70c38..e57c752a 100644 --- a/packages/gateway/src/config.test.ts +++ b/packages/gateway/src/config.test.ts @@ -202,6 +202,25 @@ describe('readOptionalSecret', () => { delete process.env.WS_ENV_VAR }) + it('throws with a clear message when _FILE points to a directory', () => { + // #given a temp directory (simulates a Docker bind-mount where the host path doesn't exist, + // causing Docker to create a directory at the container mount point instead of a file) + const dirPath = mkdtempSync(join(tmpDir, 'fake-dir-secret-')) + process.env.FAKE_DIR_FILE = dirPath + + // #when / #then + expect(() => readOptionalSecret('FAKE_DIR')).toThrow('Secret path is a directory, not a file:') + + delete process.env.FAKE_DIR_FILE + }) + + // TOCTOU resilience: we intentionally do NOT add a test where existsSync returns true but + // statSync throws ENOENT. The existing test suite uses real temp files (no vi.mock('node:fs')), + // so there's no seam to inject that race condition without restructuring the entire test module. + // The TOCTOU behaviour is correct by construction: statSync is called immediately after existsSync + // with no await in between, and Node's synchronous fs calls are not interruptible. The plan's + // "if practical" qualifier applies here — it is not practical without mocking. + it('preserves leading whitespace in file contents', () => { // Some operators may legitimately have secrets with leading whitespace // (e.g. tokens copied from a UI that quoted with leading padding). diff --git a/packages/gateway/src/config.ts b/packages/gateway/src/config.ts index 04ad7d6f..e0e94cc3 100644 --- a/packages/gateway/src/config.ts +++ b/packages/gateway/src/config.ts @@ -1,6 +1,6 @@ import type {AwsCredentials, ObjectStoreConfig} from './runtime-effect.js' -import {existsSync, readFileSync} from 'node:fs' +import {existsSync, readFileSync, statSync} from 'node:fs' import process from 'node:process' const DEFAULT_S3_PREFIX = 'fro-bot-state' @@ -41,6 +41,12 @@ export function readSecret(name: string): string { export function readOptionalSecret(name: string): string | null { const filePath = process.env[`${name}_FILE`] if (filePath !== undefined && existsSync(filePath)) { + const stat = statSync(filePath) + if (!stat.isFile()) { + throw new Error( + `Secret path is a directory, not a file: ${filePath} (the bind-mount source likely doesn't exist on the host)`, + ) + } const contents = readFileSync(filePath, 'utf8') // Strip only trailing whitespace (newline/spaces from echo) so leading whitespace // in valid secrets is preserved — matching the env-var path which uses raw process.env[name]. From cb6006d250aea8238f658ccad7957b5c1c0fd2cb Mon Sep 17 00:00:00 2001 From: "Marcus R. Brown" Date: Tue, 19 May 2026 00:53:58 -0700 Subject: [PATCH 3/8] fix(gateway): real readiness healthcheck backed by Discord clientReady The Dockerfile healthcheck no longer succeeds before the gateway is genuinely connected to Discord. A new readiness helper clears any stale `/tmp/gateway-ready` flag at process startup and registers a one-time `clientReady` listener that writes the flag once Discord confirms the bot is fully connected. The healthcheck polls for the flag plus PID 1 liveness, so `docker compose up --wait` only returns once the daemon is actually ready. - packages/gateway/src/readiness.ts: setupReadinessFlag(client, logger) - main.ts wires it between client creation and login() - Dockerfile HEALTHCHECK switched from no-op to file-and-pid probe with --interval=10s --timeout=3s --retries=12 --start-period=45s - compose.yaml drops the gateway healthcheck override (CA-cert wait is already gated by depends_on: mitmproxy: service_healthy) - deploy/README.md documents the new readiness semantics and the AWS credential `touch` block for operators wiring infra-as-code Gateway tests: 96 -> 101 (+5). --- deploy/README.md | 18 +++ deploy/compose.yaml | 5 - deploy/gateway.Dockerfile | 10 +- packages/gateway/src/main.ts | 5 + packages/gateway/src/readiness.test.ts | 163 +++++++++++++++++++++++++ packages/gateway/src/readiness.ts | 59 +++++++++ 6 files changed, 252 insertions(+), 8 deletions(-) create mode 100644 packages/gateway/src/readiness.test.ts create mode 100644 packages/gateway/src/readiness.ts diff --git a/deploy/README.md b/deploy/README.md index 3f4480cc..2865dd2e 100644 --- a/deploy/README.md +++ b/deploy/README.md @@ -48,6 +48,15 @@ echo -n 'us-east-1' > deploy/secrets/s3-region # Optional — leave empty for standard AWS S3; set for R2 or other S3-compatible stores. touch deploy/secrets/s3-endpoint # echo -n 'https://your-endpoint.r2.dev' > deploy/secrets/s3-endpoint +# Optional — AWS credentials for explicit S3 authentication. Leave empty +# to fall back to the SDK default credential chain (env vars, ~/.aws, +# or EC2/EKS instance role). +touch deploy/secrets/aws-access-key-id +touch deploy/secrets/aws-secret-access-key +touch deploy/secrets/aws-session-token +# echo -n 'AKIAI...' > deploy/secrets/aws-access-key-id +# echo -n 'wJal...' > deploy/secrets/aws-secret-access-key +# echo -n 'FwoG...' > deploy/secrets/aws-session-token # only for STS temporary credentials # Optional — guild-scoped slash command registration (propagates in ~5s vs up to 1h globally). # Leave the file empty (or omit the echo) to register slash commands globally instead: touch deploy/secrets/discord-guild-id @@ -107,6 +116,15 @@ This checks: - Recent log output - Gateway exit code (fails if gateway crashed in the last cycle) +## Gateway Readiness + +The gateway container is considered healthy only after two conditions are both true: + +1. The Discord `clientReady` event has fired — the bot is fully connected and ready to receive events. At that point the process writes `/tmp/gateway-ready`. +2. The daemon process (PID 1) is still alive (`kill -0 1`). + +The flag is cleared at process startup, so a stale `/tmp/gateway-ready` from a prior container run cannot mask a current-run failure. `docker compose up --wait` blocks until the gateway is genuinely connected to Discord before returning. + ## Stopping the Stack ```bash diff --git a/deploy/compose.yaml b/deploy/compose.yaml index baa42f7b..087bfe2d 100644 --- a/deploy/compose.yaml +++ b/deploy/compose.yaml @@ -59,11 +59,6 @@ services: options: max-size: 10m max-file: '3' - healthcheck: - test: [CMD-SHELL, test -s /etc/ssl/certs/mitmproxy-ca-cert.pem] - interval: 30s - timeout: 5s - retries: 3 workspace: build: diff --git a/deploy/gateway.Dockerfile b/deploy/gateway.Dockerfile index dd9312ec..1c2f0d59 100644 --- a/deploy/gateway.Dockerfile +++ b/deploy/gateway.Dockerfile @@ -38,8 +38,12 @@ COPY --from=build /workspace/packages/gateway/dist/ ./packages/gateway/dist/ WORKDIR /app/packages/gateway -# Placeholder healthcheck — real HTTP health endpoint arrives in Unit 7 -HEALTHCHECK --interval=30s --timeout=5s --retries=3 \ - CMD node -e 'process.exit(0)' +# Readiness healthcheck — passes when the Discord `clientReady` event has +# fired (writes /tmp/gateway-ready) AND PID 1 is alive. Cleared at process +# startup so a stale flag from a prior process cannot mask a current-run +# failure. A real liveness probe (HTTP /healthz) lands alongside the +# workspace agent. +HEALTHCHECK --interval=10s --timeout=3s --retries=12 --start-period=45s \ + CMD test -f /tmp/gateway-ready && kill -0 1 || exit 1 CMD ["node", "dist/main.mjs"] diff --git a/packages/gateway/src/main.ts b/packages/gateway/src/main.ts index b236a331..e7fb2db0 100644 --- a/packages/gateway/src/main.ts +++ b/packages/gateway/src/main.ts @@ -9,6 +9,7 @@ import {loadGatewayConfig} from './config.js' import {createDiscordClient} from './discord/client.js' import {dispatchCommand, getCommandRegistry, registerSlashCommands} from './discord/commands/index.js' import {handleMention} from './discord/mentions.js' +import {setupReadinessFlag} from './readiness.js' import {installShutdownHandlers} from './shutdown.js' // --------------------------------------------------------------------------- @@ -58,6 +59,10 @@ const program = Effect.gen(function* () { // c. Create Discord client const client = createDiscordClient({logger}) + // c2. Set up readiness flag — clears stale flag, registers clientReady listener. + // Must run BEFORE client.login() so the event cannot be missed. + yield* Effect.sync(() => setupReadinessFlag(client, logger)) + // d. Build command registry const registry = getCommandRegistry() diff --git a/packages/gateway/src/readiness.test.ts b/packages/gateway/src/readiness.test.ts new file mode 100644 index 00000000..be1b0119 --- /dev/null +++ b/packages/gateway/src/readiness.test.ts @@ -0,0 +1,163 @@ +import type {GatewayLogger} from './discord/client.js' +import type {ReadinessClient} from './readiness.js' + +import {existsSync, mkdirSync, rmSync, writeFileSync} from 'node:fs' +import {tmpdir} from 'node:os' +import {join} from 'node:path' + +import {afterEach, beforeEach, describe, expect, it, vi} from 'vitest' + +import {setupReadinessFlag} from './readiness.js' + +// --------------------------------------------------------------------------- +// Helpers +// --------------------------------------------------------------------------- + +function makeLogger(): {logger: GatewayLogger; calls: {method: string; ctx: Record; msg: string}[]} { + const calls: {method: string; ctx: Record; msg: string}[] = [] + const logger: GatewayLogger = { + debug: (ctx, msg) => calls.push({method: 'debug', ctx, msg}), + info: (ctx, msg) => calls.push({method: 'info', ctx, msg}), + warn: (ctx, msg) => calls.push({method: 'warn', ctx, msg}), + error: (ctx, msg) => calls.push({method: 'error', ctx, msg}), + } + return {logger, calls} +} + +/** + * Minimal ReadinessClient mock that captures the `clientReady` callback so + * tests can simulate the event by invoking it directly. + */ +function makeClient(): {client: ReadinessClient; fireClientReady: () => void} { + let capturedCallback: (() => void) | undefined + + const client: ReadinessClient = { + once: (event: 'clientReady', listener: () => void) => { + if (event === 'clientReady') { + capturedCallback = listener + } + return client + }, + } + + return { + client, + fireClientReady: () => { + if (capturedCallback === undefined) throw new Error('clientReady listener was never registered') + capturedCallback() + }, + } +} + +// --------------------------------------------------------------------------- +// Per-test temp flag path so tests are isolated and don't touch /tmp directly +// --------------------------------------------------------------------------- + +let testDir: string +let flagPath: string + +beforeEach(() => { + testDir = join(tmpdir(), `readiness-test-${process.pid}-${Date.now()}`) + mkdirSync(testDir, {recursive: true}) + flagPath = join(testDir, 'gateway-ready') +}) + +afterEach(() => { + rmSync(testDir, {recursive: true, force: true}) + vi.restoreAllMocks() +}) + +// --------------------------------------------------------------------------- +// Tests +// --------------------------------------------------------------------------- + +describe('setupReadinessFlag', () => { + // #given a fresh container with no prior flag + // #when setupReadinessFlag is called and clientReady fires + // #then the flag file is written + it('writes the flag file when clientReady fires', () => { + const {logger} = makeLogger() + const {client, fireClientReady} = makeClient() + + setupReadinessFlag(client, logger, flagPath) + expect(existsSync(flagPath)).toBe(false) // not written yet — only on event + + fireClientReady() + + expect(existsSync(flagPath)).toBe(true) + }) + + // #given a stale flag from a prior process run + // #when setupReadinessFlag is called + // #then the stale flag is removed BEFORE the listener is registered + it('clears a stale flag before registering the clientReady listener', () => { + const {logger} = makeLogger() + + // Pre-create a stale flag + writeFileSync(flagPath, 'stale') + + const removalOrder: string[] = [] + + // Intercept `once` to record when the listener is registered + const {client} = makeClient() + const originalOnce = client.once.bind(client) + vi.spyOn(client, 'once').mockImplementation((event, listener) => { + removalOrder.push('listener-registered') + return originalOnce(event, listener) + }) + + // The stale flag should be gone before once() is called + const originalSetup = setupReadinessFlag + // We can't easily intercept unlinkSync mid-function, so instead we verify + // the observable outcome: after setup, the flag is absent (cleared), and + // the listener is registered (once was called). + originalSetup(client, logger, flagPath) + + expect(existsSync(flagPath)).toBe(false) + expect(removalOrder).toContain('listener-registered') + }) + + // #given no flag file exists (fresh container) + // #when setupReadinessFlag is called + // #then ENOENT is silently tolerated — no error thrown, no warn logged + it('tolerates ENOENT when no stale flag exists', () => { + const {logger, calls} = makeLogger() + const {client} = makeClient() + + // flagPath does not exist — should not throw + expect(() => setupReadinessFlag(client, logger, flagPath)).not.toThrow() + + const warnCalls = calls.filter(c => c.method === 'warn') + expect(warnCalls).toHaveLength(0) + }) + + // #given clientReady fires + // #then logger.info is called with 'gateway ready' + it('logs info when the flag is written successfully', () => { + const {logger, calls} = makeLogger() + const {client, fireClientReady} = makeClient() + + setupReadinessFlag(client, logger, flagPath) + fireClientReady() + + const infoCalls = calls.filter(c => c.method === 'info' && c.msg === 'gateway ready') + expect(infoCalls).toHaveLength(1) + }) + + // #given writeFileSync fails (e.g. permission error) + // #then logger.error is called and no exception propagates + it('logs error and does not throw when writeFileSync fails', () => { + const {logger, calls} = makeLogger() + const {client, fireClientReady} = makeClient() + + // Use a path that cannot be written (directory instead of file) + const unwritablePath = testDir // a directory — writeFileSync will throw EISDIR + + setupReadinessFlag(client, logger, unwritablePath) + expect(() => fireClientReady()).not.toThrow() + + const errorCalls = calls.filter(c => c.method === 'error') + expect(errorCalls).toHaveLength(1) + expect(errorCalls[0]?.msg).toBe('failed to write gateway-ready flag') + }) +}) diff --git a/packages/gateway/src/readiness.ts b/packages/gateway/src/readiness.ts new file mode 100644 index 00000000..0aaa7969 --- /dev/null +++ b/packages/gateway/src/readiness.ts @@ -0,0 +1,59 @@ +import type {GatewayLogger} from './discord/client.js' + +import {unlinkSync, writeFileSync} from 'node:fs' + +// --------------------------------------------------------------------------- +// Gateway readiness flag — /tmp/gateway-ready +// +// The Dockerfile healthcheck polls for this file. It is written when the +// Discord `clientReady` event fires (i.e. the bot is fully connected and +// ready to receive events). It is cleared at process startup so a stale flag +// from a prior process cannot mask a current-run failure. +// --------------------------------------------------------------------------- + +/** + * Minimal interface for the Discord client subset used by readiness setup. + * Avoids importing the full discord.js Client type in tests. + */ +export interface ReadinessClient { + once: (event: 'clientReady', listener: () => void) => this +} + +/** + * Clears any stale readiness flag from a prior process, then registers a + * one-time `clientReady` listener that writes the flag when Discord confirms + * the bot is fully connected. + * + * Must be called BEFORE `client.login()` so the event cannot be missed. + * + * @param client - Discord client (or compatible mock) + * @param logger - Structured logger + * @param flagPath - Path to the readiness flag file (default: /tmp/gateway-ready) + */ +export function setupReadinessFlag( + client: ReadinessClient, + logger: GatewayLogger, + flagPath = '/tmp/gateway-ready', +): void { + // Clear any stale flag from a prior process. ENOENT is expected on fresh + // containers and is silently ignored. Other errors are non-fatal here + // because the flag-file is best-effort — permission errors will surface + // when we try to writeFileSync below. + try { + unlinkSync(flagPath) + } catch (error) { + if (!(error instanceof Error && 'code' in error && (error as NodeJS.ErrnoException).code === 'ENOENT')) { + logger.warn({err: error}, 'failed to clear stale gateway-ready flag') + } + } + + // Register the listener BEFORE login() so the event cannot be missed. + client.once('clientReady', () => { + try { + writeFileSync(flagPath, '') + logger.info({}, 'gateway ready') + } catch (error) { + logger.error({err: error}, 'failed to write gateway-ready flag') + } + }) +} From 82060b105e5ac02c25767545961b4dff36329472 Mon Sep 17 00:00:00 2001 From: "Marcus R. Brown" Date: Tue, 19 May 2026 21:01:03 -0700 Subject: [PATCH 4/8] chore(gateway): tighten deploy contract review pass - `stat.isFile()` check uses explicit boolean comparison - Orphan AWS_SESSION_TOKEN warning emits via `console.warn` rather than `console.log` (matches makeLogger's warn-level pattern; lifts the eslint-disable directive) - Drop the redundant `NodeJS.ErrnoException` cast in readiness stale-flag cleanup -- in-operator narrowing is sufficient - Strengthen the stale-readiness test to assert flag unlink ordering at listener-registration time, not just final state - Replace `as string` / `as unknown` assertions in config.test.ts with proper narrowing - Add custom-endpoint+credentials coverage to s3-adapter - Document the AWS credential pair contract for operators in deploy/README.md Runtime tests: 352 -> 353 (+1). --- deploy/README.md | 5 ++++ packages/gateway/src/config.test.ts | 14 +++++------ packages/gateway/src/config.ts | 7 +++--- packages/gateway/src/readiness.test.ts | 18 +++++++------- packages/gateway/src/readiness.ts | 2 +- .../src/object-store/s3-adapter.test.ts | 24 +++++++++++++++++++ 6 files changed, 47 insertions(+), 23 deletions(-) diff --git a/deploy/README.md b/deploy/README.md index 2865dd2e..029e2e88 100644 --- a/deploy/README.md +++ b/deploy/README.md @@ -51,6 +51,11 @@ touch deploy/secrets/s3-endpoint # Optional — AWS credentials for explicit S3 authentication. Leave empty # to fall back to the SDK default credential chain (env vars, ~/.aws, # or EC2/EKS instance role). +``` + +> **Pair contract:** `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` must both be provided or both left empty. `AWS_SESSION_TOKEN` is only used when the pair is present — it is ignored otherwise. With neither pair value set, the AWS SDK default credential chain takes over (env vars, `~/.aws`, EC2/EKS instance role). + +```sh touch deploy/secrets/aws-access-key-id touch deploy/secrets/aws-secret-access-key touch deploy/secrets/aws-session-token diff --git a/packages/gateway/src/config.test.ts b/packages/gateway/src/config.test.ts index e57c752a..10da30e8 100644 --- a/packages/gateway/src/config.test.ts +++ b/packages/gateway/src/config.test.ts @@ -506,7 +506,7 @@ describe('AWS credentials', () => { // #given setRequiredEnv() process.env.AWS_SESSION_TOKEN = 'AQoXnyc4lcK4w4OIaHPuTZat//SESSION_TOKEN' - const consoleSpy = vi.spyOn(console, 'log').mockImplementation(() => undefined) + const consoleSpy = vi.spyOn(console, 'warn').mockImplementation(() => undefined) // #when const config = loadGatewayConfig() @@ -516,13 +516,11 @@ describe('AWS credentials', () => { expect(consoleSpy).toHaveBeenCalledTimes(1) const loggedArg: unknown = consoleSpy.mock.calls[0]?.[0] expect(typeof loggedArg).toBe('string') - const parsed: unknown = JSON.parse(loggedArg as string) - expect(parsed).toMatchObject({ - level: 'info', - msg: expect.stringContaining( - 'AWS_SESSION_TOKEN is set without AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY', - ) as unknown, - }) + const parsed: unknown = JSON.parse(String(loggedArg)) as unknown + const sessionTokenMsg = expect.stringContaining( + 'AWS_SESSION_TOKEN is set without AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY', + ) as unknown + expect(parsed).toMatchObject({level: 'warn', msg: sessionTokenMsg}) consoleSpy.mockRestore() }) }) diff --git a/packages/gateway/src/config.ts b/packages/gateway/src/config.ts index e0e94cc3..c507b687 100644 --- a/packages/gateway/src/config.ts +++ b/packages/gateway/src/config.ts @@ -42,7 +42,7 @@ export function readOptionalSecret(name: string): string | null { const filePath = process.env[`${name}_FILE`] if (filePath !== undefined && existsSync(filePath)) { const stat = statSync(filePath) - if (!stat.isFile()) { + if (stat.isFile() === false) { throw new Error( `Secret path is a directory, not a file: ${filePath} (the bind-mount source likely doesn't exist on the host)`, ) @@ -113,10 +113,9 @@ export function loadGatewayConfig(): GatewayConfig { ...(awsSessionToken === null ? {} : {sessionToken: awsSessionToken}), } } else if (awsSessionToken !== null) { - // eslint-disable-next-line no-console - console.log( + console.warn( JSON.stringify({ - level: 'info', + level: 'warn', msg: 'AWS_SESSION_TOKEN is set without AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY; ignoring it and falling back to SDK default credential chain.', }), ) diff --git a/packages/gateway/src/readiness.test.ts b/packages/gateway/src/readiness.test.ts index be1b0119..58b36a9c 100644 --- a/packages/gateway/src/readiness.test.ts +++ b/packages/gateway/src/readiness.test.ts @@ -96,25 +96,23 @@ describe('setupReadinessFlag', () => { // Pre-create a stale flag writeFileSync(flagPath, 'stale') - const removalOrder: string[] = [] + // Capture filesystem state at the exact moment once() is called + let flagExistedAtRegistration: boolean | undefined - // Intercept `once` to record when the listener is registered const {client} = makeClient() const originalOnce = client.once.bind(client) vi.spyOn(client, 'once').mockImplementation((event, listener) => { - removalOrder.push('listener-registered') + // Record whether the flag still exists when the listener is being registered + flagExistedAtRegistration = existsSync(flagPath) return originalOnce(event, listener) }) - // The stale flag should be gone before once() is called - const originalSetup = setupReadinessFlag - // We can't easily intercept unlinkSync mid-function, so instead we verify - // the observable outcome: after setup, the flag is absent (cleared), and - // the listener is registered (once was called). - originalSetup(client, logger, flagPath) + setupReadinessFlag(client, logger, flagPath) + // The flag must have been absent at the moment of listener registration + expect(flagExistedAtRegistration).toBe(false) + // And still absent after setup completes expect(existsSync(flagPath)).toBe(false) - expect(removalOrder).toContain('listener-registered') }) // #given no flag file exists (fresh container) diff --git a/packages/gateway/src/readiness.ts b/packages/gateway/src/readiness.ts index 0aaa7969..8309d1d8 100644 --- a/packages/gateway/src/readiness.ts +++ b/packages/gateway/src/readiness.ts @@ -42,7 +42,7 @@ export function setupReadinessFlag( try { unlinkSync(flagPath) } catch (error) { - if (!(error instanceof Error && 'code' in error && (error as NodeJS.ErrnoException).code === 'ENOENT')) { + if (!(error instanceof Error && 'code' in error && error.code === 'ENOENT')) { logger.warn({err: error}, 'failed to clear stale gateway-ready flag') } } diff --git a/packages/runtime/src/object-store/s3-adapter.test.ts b/packages/runtime/src/object-store/s3-adapter.test.ts index 0dda535f..58c4a513 100644 --- a/packages/runtime/src/object-store/s3-adapter.test.ts +++ b/packages/runtime/src/object-store/s3-adapter.test.ts @@ -477,4 +477,28 @@ describe('createS3Adapter', () => { expect(clientConfigs).toHaveLength(1) expect(clientConfigs[0]).not.toHaveProperty('credentials') }) + + it('passes credentials to S3Client constructor when endpoint and credentials are both set', () => { + // #given — custom endpoint (e.g. Cloudflare R2) with explicit credentials + const config: ObjectStoreConfig = { + ...baseConfig, + endpoint: 'https://r2.cloudflarestorage.com', + credentials: { + accessKeyId: 'AKIA...', + secretAccessKey: 'wJal...', + }, + } + clientConfigs.length = 0 + + // #when + createS3Adapter(config, createLogger()) + + // #then — both endpoint config and credentials must be forwarded together + expect(clientConfigs).toHaveLength(1) + expect(clientConfigs[0]).toMatchObject({ + endpoint: 'https://r2.cloudflarestorage.com', + forcePathStyle: true, + credentials: {accessKeyId: 'AKIA...', secretAccessKey: 'wJal...'}, + }) + }) }) From b6bcb54f0f70670445d162971d423e038e870fb6 Mon Sep 17 00:00:00 2001 From: "Marcus R. Brown" Date: Tue, 19 May 2026 21:02:20 -0700 Subject: [PATCH 5/8] docs(plans): add deploy contract hardening plan Captures the v0.44.x deploy contract hardening pass: AWS credential plumbing, compose mounts and bounded logging, secret-path directory guard, and a real readiness healthcheck backed by Discord clientReady. --- ...-001-fix-deploy-contract-hardening-plan.md | 275 ++++++++++++++++++ 1 file changed, 275 insertions(+) create mode 100644 docs/plans/2026-05-18-001-fix-deploy-contract-hardening-plan.md diff --git a/docs/plans/2026-05-18-001-fix-deploy-contract-hardening-plan.md b/docs/plans/2026-05-18-001-fix-deploy-contract-hardening-plan.md new file mode 100644 index 00000000..4f3b41a8 --- /dev/null +++ b/docs/plans/2026-05-18-001-fix-deploy-contract-hardening-plan.md @@ -0,0 +1,275 @@ +--- +title: 'fix: deploy contract hardening for external IaC consumers' +type: fix +status: active +date: 2026-05-18 +deepened: 2026-05-18 +--- + +# fix: deploy contract hardening for external IaC consumers + +## Overview + +Three concrete deploy-contract gaps surfaced during the first external infra-as-code deploy attempt against `fro-bot/agent` v0.44.0. Two are real and block first-deploy from external repos: + +1. The S3 adapter constructs `S3Client` without explicit `credentials:`, falling back to the AWS SDK default credential chain (env / `~/.aws` / IMDS) — all of which fail inside the gateway container on self-hosted hosts like DigitalOcean. +2. The gateway container's Dockerfile healthcheck is a literal no-op (`node -e 'process.exit(0)'`) and the compose override only checks for the mitmproxy CA cert in the shared volume. Neither proves the gateway is actually connected to Discord; `docker compose up --wait` returns success even when the daemon has crashed at startup. + +Plus two small hardening items that came up while verifying the above: + +3. Bind-mounted secret paths that don't exist on the host become directories under default Docker compose behavior; `existsSync()` passes and `readFileSync()` throws a raw `EISDIR` with no actionable message. +4. Compose has no `logging:` block, so the default unbounded `json-file` driver can fill a small droplet's disk before the operator notices. + +This work lands as a coordinated patch series in a single PR so external infra repos can pin to one version of fro-bot/agent and have a complete deploy contract. + +## Problem Frame + +External operators deploying gateway via infra-as-code repositories (Terraform, Pulumi, NixOS, Ansible) need a deploy contract they can wire to without reading source. The contract today omits AWS credentials wiring entirely and ships a healthcheck that lies. First-deploy attempts succeed at `compose up --wait` but fail at runtime, which is the worst kind of contract violation. + +The two stale claims in the original handoff brief (`DISCORD_GUILD_ID` plumbing and empty-secret-file handling) were already addressed in PRs #638 and #644 last session. Verified against current `main` (HEAD `b8298bc`, tag `v0.44.0`) before scoping this plan. + +## Requirements Trace + +- R1. The S3 adapter accepts explicit AWS credentials via secret files when present (including the optional `AWS_SESSION_TOKEN` for STS temporary credentials), falls back to the SDK default credential chain when absent, and fails fast when the access-key / secret-key pair is partially set. +- R2. The deploy compose stack documents and mounts the AWS credential secrets following the same pattern as Discord and S3 secrets (`*_FILE` env vars + bind-mount). +- R3. `docker compose up --wait` only reports the gateway as healthy when the Discord client has emitted the `ready` event and the daemon is alive. +- R4. The configured ready signal is cleared on container start so a stale flag from a previous run cannot mask a current-run failure. +- R5. Bind-mounted secret paths that resolve to directories produce a clear, actionable error message at startup. +- R6. Compose log output is bounded so a small VM cannot run out of disk from gateway log accumulation. +- R7. `deploy/README.md` reflects the new AWS secret files and updated healthcheck behavior without exposing internal session or planning artifacts. + +## Scope Boundaries + +- Not adding mandatory AWS credentials. They remain optional so the current "Discord-plumbing-only" testing workflow keeps working. +- Not touching the workspace container's missing `NODE_EXTRA_CA_CERTS` / CA cert mount. That's a Unit 7 (workspace agent) concern. +- Not adding resource limits (`mem_limit` / `cpus`). No clear "right" default for a deploy stack consumed by external operators with varying host sizes. +- Not adding an HTTP `/healthz` endpoint. Unit 7 is the right time for that. +- Not redesigning the secrets management approach (Docker Swarm secrets, sops, age). Bind-mount + file is the v1 contract. + +### Deferred to Separate Tasks + +- Workspace CA cert + `NODE_EXTRA_CA_CERTS` mount: deferred to Unit 7 (workspace agent), `docs/plans/2026-04-18-001-feat-fro-bot-gateway-discord-v1-plan.md`. +- HTTP `/healthz` endpoint: deferred to Unit 7. +- Resource limits and observability defaults: tracked locally as a follow-up todo. + +## Context & Research + +### Relevant Code and Patterns + +- `packages/gateway/src/config.ts:28-58` — `readSecret`/`readOptionalSecret` helpers. The pattern to follow when adding AWS credential reads. +- `packages/gateway/src/config.ts:65-101` — `loadGatewayConfig` assembly. Where new AWS credential fields and the credentials sub-object on `ObjectStoreConfig` get wired. +- `packages/runtime/src/object-store/s3-adapter.ts:90-103` — `createClient` is the only construction site for `S3Client`; both branches (custom endpoint / AWS default) need the new conditional `credentials:` block. +- `packages/runtime/src/object-store/types.ts` — `ObjectStoreConfig` interface. Adds an optional `credentials?: { accessKeyId, secretAccessKey, sessionToken? }` field. +- `packages/gateway/src/main.ts:49-100` — the Effect program that constructs the client and runs the startup sequence. Where the `ready` event handler attaches and `/tmp/gateway-ready` gets touched. +- `packages/gateway/src/discord/client.ts:30-66` — `createDiscordClient`. Existing shard-event handlers show the pattern for one-time event handlers; the `ready` handler attaches in `main.ts` between client creation and `login()`. +- `deploy/compose.yaml:16-51` — gateway service. Pattern to follow when adding AWS file mounts and updating the healthcheck. +- `deploy/gateway.Dockerfile:41-43` — the no-op healthcheck site. +- `packages/gateway/src/config.test.ts:161-184` — existing test pattern for `readOptionalSecret` empty-file behavior. Pattern to extend for new AWS credential cases. + +### Institutional Learnings + +- PR #644 (commit `a16391a`): testing ergonomics — establishes the "operator creates empty file when omitting an optional secret" pattern. AWS credentials should follow this so external IaC can `touch deploy/secrets/aws-access-key-id` without setting it. +- PR #638 (commit `7234d25`): `OBJECT_STORE_HOSTS` env-var allowlist, fail-closed defaults. The mitmproxy allowlist already validates outbound hosts, so even with broken AWS credentials the egress side is not at risk. +- Memory ID 3155 (this session, prior conversation): when amending a commit with new working-tree fixes, stage explicitly first, then `git commit --amend`. `git reset --soft` discards unstaged working-tree changes. + +### External References + +- AWS SDK v3 S3Client `credentials` accepts `AwsCredentialIdentity | AwsCredentialIdentityProvider`. The identity shape is `{ accessKeyId, secretAccessKey, sessionToken? }`. Verified in `node_modules/@aws-sdk/client-s3/dist-types/S3Client.d.ts:12,72`. SDK version `3.1045.0` per `package.json`. +- Docker Compose `logging:` driver options: `json-file` with `max-size` and `max-file` is the standard rotation pattern. Both options take size strings like `"10m"` and integer file counts. +- Discord.js v14 emits both `'ready'` (deprecated) and `'clientReady'` (canonical, recommended) when the gateway is fully connected. Verified in `node_modules/discord.js/src/util/Events.js:15,111` and `node_modules/discord.js/src/client/websocket/WebSocketManager.js:375-392`. Use `'clientReady'` as the canonical name; both fire on the same condition in v14.26.4. + +## Key Technical Decisions + +- **Credentials field on `ObjectStoreConfig`, not env-var promotion.** Explicit constructor injection keeps the credential material out of process env vars where child processes inherit it, and keeps the gateway / workspace `_FILE` contract symmetric with the rest of the secrets. Rejected env-var promotion (set `AWS_ACCESS_KEY_ID` from `*_FILE` at startup) for the same reason. +- **Both-or-neither validation at config layer, not adapter.** If exactly one of `AWS_ACCESS_KEY_ID` / `AWS_SECRET_ACCESS_KEY` is set (the required pair), fail fast in `loadGatewayConfig` with a clear error. `AWS_SESSION_TOKEN` is independent: it can be set without invalidating the config (becomes part of `credentials` when the pair is present) but is ignored when no pair is set. Don't pass a half-constructed credentials object to the adapter. +- **Optional credentials preserve SDK default chain.** When both are absent, do not set `credentials:` on the `S3Client` constructor — the SDK default chain (env, `~/.aws`, IMDS) takes over. This keeps IRSA / EC2-instance-role deployments working without code change. +- **Readiness signal via filesystem flag, not HTTP probe.** `/tmp/gateway-ready` is touched after Discord `'clientReady'` event, cleared at process startup so stale flags from container restarts cannot mask a current-run failure. Healthcheck combines file-exists + PID-1-alive (`test -f /tmp/gateway-ready && kill -0 1`). HTTP probe adds a new port + listener for v1; not worth the surface area. Log-grep approach rejected as brittle. +- **Healthcheck moves from compose to Dockerfile.** Compose currently overrides the Dockerfile healthcheck to check the mitmproxy CA cert in the shared volume — that's the wrong concern (CA-cert presence is gated by `depends_on.mitmproxy.condition: service_healthy` already). The Dockerfile becomes authoritative for gateway readiness; compose drops the override. +- **Secret-path guard: `isFile()` check, not `try/catch`.** `statSync(filePath).isFile()` is cheap and gives a clearer signal than catching `EISDIR` after the fact. +- **Log rotation: `max-size: "10m"`, `max-file: "3"`.** Defaults that keep a small droplet healthy without losing the last few minutes of context during an incident. + +## Open Questions + +### Resolved During Planning + +- **Which Discord event do we hook?** `'clientReady'` is the canonical name in discord.js v14; `'ready'` is deprecated but still emitted on the same condition. Use `'clientReady'` to be forward-compatible with v15 when the deprecated event is removed. +- **Where does the readiness handler attach?** In `main.ts` after `createDiscordClient` returns the client and before `client.login()`. Uses `client.once('clientReady', ...)` so it fires exactly once; reconnects don't re-touch the file (they don't need to — the file is for "this process has been ready at least once"). +- **Should the `/tmp` directory be a tmpfs?** No. Default container `/tmp` works. Adding a tmpfs adds another compose surface for external IaC to wire. +- **Should we add `discord-guild-id` to the AWS-style "always-mount-empty-when-omitted" pattern?** Already done in PR #644. No action. + +### Deferred to Implementation + +- Exact wording of `loadGatewayConfig` error messages for partial AWS credentials. Match the existing `Missing required secret: ...` style. +- Whether to log "Discord ready" at info level when the flag file is touched (probably yes, for operator visibility, but not contract-critical). + +## Implementation Units + +- [ ] **Unit 1: AWS credential plumbing (config + adapter + tests)** + +**Goal:** Read optional AWS credentials from secret files in `loadGatewayConfig`, pass them through `ObjectStoreConfig`, and inject them into the `S3Client` constructor when both are present. + +**Requirements:** R1, R2 + +**Dependencies:** None + +**Files:** + +- Modify: `packages/runtime/src/object-store/types.ts` +- Modify: `packages/runtime/src/object-store/s3-adapter.ts` +- Modify: `packages/gateway/src/config.ts` +- Test: `packages/gateway/src/config.test.ts` +- Test: `packages/runtime/src/object-store/s3-adapter.test.ts` (create if absent; check whether existing tests already cover construction) + +**Approach:** + +- Add an `AwsCredentials` type to `types.ts`: `{ readonly accessKeyId: string; readonly secretAccessKey: string; readonly sessionToken?: string }`. Then `ObjectStoreConfig.credentials?: AwsCredentials` (optional, read-only). +- In `s3-adapter.ts:90-103`, both `createClient` branches (custom endpoint and AWS default) gain a conditional `...(config.credentials != null ? { credentials: config.credentials } : {})` spread. SDK default chain remains active when absent. +- In `config.ts:65-101`, after the existing S3 reads, add: + - `const awsAccessKeyId = readOptionalSecret('AWS_ACCESS_KEY_ID')` + - `const awsSecretAccessKey = readOptionalSecret('AWS_SECRET_ACCESS_KEY')` + - `const awsSessionToken = readOptionalSecret('AWS_SESSION_TOKEN')` + - Pair validation: if exactly one of `awsAccessKeyId`/`awsSecretAccessKey` is non-null, throw with `Both AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY must be set together (received: ). Set both, or set neither to use the SDK default credential chain.` + - Session-token wiring: if the pair is present, build `credentials: { accessKeyId, secretAccessKey, ...(awsSessionToken !== null ? { sessionToken: awsSessionToken } : {}) }`. If the pair is absent and `awsSessionToken` is set, emit a single info-level warning (`AWS_SESSION_TOKEN is set without AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY; ignoring it and falling back to SDK default credential chain.`) and do not set `credentials`. +- Match the existing `?? undefined` / conditional-spread idiom in `loadGatewayConfig` so the assembled object stays clean. + +**Patterns to follow:** + +- `config.ts:72` — `const s3Endpoint = readOptionalSecret('S3_ENDPOINT') ?? undefined` is the pattern for optional fields. +- `config.ts:89-90` — conditional spread (`...(s3Endpoint === undefined ? {} : {endpoint: s3Endpoint})`) is the pattern for conditional object fields. +- `s3-adapter.ts:94-103` — two-branch client construction. Both branches need the same conditional credentials spread. + +**Test scenarios:** + +- Happy path: both `AWS_ACCESS_KEY_ID_FILE` and `AWS_SECRET_ACCESS_KEY_FILE` point at non-empty files → `loadGatewayConfig().objectStore.credentials` is `{ accessKeyId, secretAccessKey }` (no `sessionToken`). +- Happy path: all three (`AWS_ACCESS_KEY_ID_FILE`, `AWS_SECRET_ACCESS_KEY_FILE`, `AWS_SESSION_TOKEN_FILE`) set → `objectStore.credentials` is `{ accessKeyId, secretAccessKey, sessionToken }`. +- Happy path: neither access-key nor secret-key env var is set → `objectStore.credentials` is `undefined` (SDK default chain takes over). +- Edge case: empty `AWS_ACCESS_KEY_ID` file (whitespace-only) is treated as absent — consistent with existing `readOptionalSecret` behavior. If both files are empty, `credentials` is `undefined`. +- Edge case: pair present + `AWS_SESSION_TOKEN_FILE` points at an empty file → `sessionToken` is omitted (`readOptionalSecret` already returns null for empty files). +- Error path: only `AWS_ACCESS_KEY_ID_FILE` set, `AWS_SECRET_ACCESS_KEY_FILE` absent → `loadGatewayConfig()` throws with a message naming the missing one. +- Error path: only `AWS_SECRET_ACCESS_KEY_FILE` set → throws with a message naming the missing one. +- Edge case: `AWS_SESSION_TOKEN_FILE` set but pair absent → no throw; `credentials` is `undefined`; a single info-level message is logged about the orphan session token. +- Integration (adapter-level): when `ObjectStoreConfig.credentials` is set, the `S3Client` constructor is called with that exact credentials object. When absent, `S3Client` is called without a `credentials:` key. Verify via spy or `vi.mock` on `@aws-sdk/client-s3`. + +**Verification:** + +- `pnpm --filter @fro-bot/gateway test` and `pnpm --filter @fro-bot/runtime test` both pass with new tests included. +- `pnpm check-types` clean across the workspace. +- `pnpm lint` clean. + +- [ ] **Unit 2: Compose AWS credential mounts + log rotation + secret-path guard** + +**Goal:** Wire the new AWS credential `*_FILE` env vars + bind-mounts in `deploy/compose.yaml`. Add bounded `logging:` to gateway, workspace, and mitmproxy. Add the `isFile()` guard to `readOptionalSecret` so directory-as-secret-path fails with a clear error. + +**Requirements:** R2, R5, R6 + +**Dependencies:** Unit 1 (the env-var names and contract come from Unit 1's config schema). + +**Files:** + +- Modify: `deploy/compose.yaml` +- Modify: `packages/gateway/src/config.ts` (the `readOptionalSecret` guard) +- Test: `packages/gateway/src/config.test.ts` + +**Approach:** + +- In `deploy/compose.yaml` gateway service `environment:`, add three entries: `AWS_ACCESS_KEY_ID_FILE: /run/secrets/aws_access_key_id`, `AWS_SECRET_ACCESS_KEY_FILE: /run/secrets/aws_secret_access_key`, `AWS_SESSION_TOKEN_FILE: /run/secrets/aws_session_token` (same pattern as existing S3 entries). +- In `deploy/compose.yaml` gateway `volumes:`, add three bind-mounts: `- ./secrets/aws-access-key-id:/run/secrets/aws_access_key_id:ro`, `- ./secrets/aws-secret-access-key:/run/secrets/aws_secret_access_key:ro`, `- ./secrets/aws-session-token:/run/secrets/aws_session_token:ro` with comments noting they're optional and operators should `touch` empty files to omit (matching `discord-guild-id` pattern). The session-token comment should call out it's only used for STS temporary credentials. +- Add `logging:` blocks to gateway, workspace, and mitmproxy services using `driver: json-file` with `options: { max-size: "10m", max-file: "3" }`. +- In `config.ts:43`, change the file-existence check from `if (filePath !== undefined && existsSync(filePath))` to also assert `statSync(filePath).isFile()`. On `existsSync && !isFile`, throw with `Secret path is a directory, not a file: ${filePath} (the bind-mount source likely doesn't exist on the host)`. Note: `statSync` can throw `EACCES` on permission errors and `ENOENT` if the file disappears between `existsSync` and `statSync` (TOCTOU); both should surface as clear startup errors, not be swallowed. + +**Patterns to follow:** + +- `deploy/compose.yaml:32-40` — existing secret mount pattern. +- `deploy/compose.yaml:37-39` — comment-driven empty-file pattern for optional secrets. +- `deploy/README.md` step-2 block — operator-facing `touch` instructions live here too (see Unit 3). + +**Test scenarios:** + +- Happy path: file exists at the bind-mount path → reads normally. +- Error path: bind-mount source missing on host → mounts as directory → `readOptionalSecret('AWS_ACCESS_KEY_ID')` throws with the new directory-not-file error. +- Integration: `docker compose -f deploy/compose.yaml config --quiet` exits 0 (validates the merged compose syntax). Note this requires `deploy/secrets/aws-access-key-id` and `deploy/secrets/aws-secret-access-key` to exist (even empty) — `validate-stack.sh` should be updated. + +**Verification:** + +- `pnpm --filter @fro-bot/gateway test` passes new directory-guard test. +- `docker compose -f deploy/compose.yaml config --quiet` exits 0 after running `touch deploy/secrets/aws-{access-key-id,secret-access-key}`. + +- [ ] **Unit 3: Gateway readiness healthcheck + docs** + +**Goal:** Replace the no-op Dockerfile healthcheck with a real readiness check backed by a `/tmp/gateway-ready` flag file touched by the Discord `ready` handler. Remove the compose healthcheck override (the Dockerfile's becomes authoritative). Update `deploy/README.md` to reflect AWS credentials + the readiness behavior. + +**Requirements:** R3, R4, R7 + +**Dependencies:** None (independent of Units 1 and 2 — touches the runtime entrypoint and Dockerfile, not config schema or compose secrets). + +**Files:** + +- Modify: `packages/gateway/src/main.ts` +- Modify: `deploy/gateway.Dockerfile` +- Modify: `deploy/compose.yaml` (remove the gateway healthcheck override block) +- Modify: `deploy/README.md` +- Modify: `deploy/.env.example` (operator-facing doc updates if needed) +- Test: `packages/gateway/src/main.test.ts` (verify; may not exist — add minimal coverage if absent) + +**Approach:** + +- In `main.ts`, between `createDiscordClient(...)` (step c) and `client.login(...)` (step h): clear `/tmp/gateway-ready` synchronously (best-effort, swallow `ENOENT`); register `client.once('clientReady', ...)` that touches `/tmp/gateway-ready` (the file's mere presence is the signal; content is empty). Log at info level when the file is touched. +- In `gateway.Dockerfile:41-43`, replace the no-op with `HEALTHCHECK --interval=10s --timeout=3s --retries=12 --start-period=45s CMD test -f /tmp/gateway-ready && kill -0 1 || exit 1`. Tighter interval since startup is the critical window. `start_period: 45s` accommodates cold image start + npm cold cache + Discord WebSocket handshake variance on small VMs (oracle and feasibility flagged 30s as slightly tight). +- In `deploy/compose.yaml:47-51`, remove the gateway-service `healthcheck:` override block. The Dockerfile's becomes authoritative. +- In `deploy/README.md`, update the operator setup section to add the AWS credential `touch` instructions (mirroring the `discord-guild-id` and `s3-endpoint` patterns) and replace any text that claims the healthcheck "succeeds when the CA cert is present" with the new readiness semantics. + +**Patterns to follow:** + +- `main.ts:55-65` — Effect.gen step ordering. The ready-flag setup goes in the same style. +- `deploy/compose.yaml:92-101` — mitmproxy healthcheck shows the `interval`/`timeout`/`retries`/`start_period` knob conventions. +- `deploy/README.md` "step 2 — Create secrets" — existing `touch` + commented `echo` pattern for optional secrets is the template for AWS credentials. + +**Test scenarios:** + +- Happy path: gateway startup → `/tmp/gateway-ready` cleared → Discord `'clientReady'` event fires → file is created → healthcheck script (`test -f /tmp/gateway-ready && kill -0 1`) exits 0. Verify via mock Discord client emitting `'clientReady'`. +- Edge case: stale `/tmp/gateway-ready` left over from previous process → file is removed at process start → healthcheck reports unhealthy until current Discord client is ready. +- Edge case: `/tmp/gateway-ready` cleanup at startup tolerates `ENOENT` (no such file) without crashing. +- Integration: `docker compose -f deploy/compose.yaml up -d` followed by `docker compose -f deploy/compose.yaml ps --filter health=healthy` shows the gateway as healthy only after Discord ready event. (Manual smoke test; not asserted in unit test.) + +**Verification:** + +- New healthcheck unit test passes. +- `deploy/README.md` reads naturally and matches the existing voice (first-person, no session leakage). +- Manual smoke: with a real Discord token, `docker compose up --wait` succeeds only after the gateway actually connects. + +## System-Wide Impact + +- **Interaction graph:** `loadGatewayConfig` ↔ `createS3Adapter` ↔ `S3Client`. The new `credentials` field travels along the existing `ObjectStoreConfig` path. No new modules involved. +- **Error propagation:** Partial AWS credentials throw at config-load (process startup, before Discord login). Empty/missing optional secrets continue to return `null` per existing behavior. Directory-as-secret-path throws at first `readOptionalSecret` call with the new clear message. +- **State lifecycle risks:** The `/tmp/gateway-ready` flag is per-process: cleared on startup, touched on first `ready`. Container restart correctly invalidates the prior process's readiness. The flag has no relation to reconnects — the gateway is considered ready as long as it was ready once and PID 1 is still alive. If Discord disconnects long enough that the client is permanently broken, the healthcheck will still report healthy because PID 1 is alive. This is acceptable for v0.44.x; a real liveness probe is Unit 7 work. +- **API surface parity:** No new public APIs. `ObjectStoreConfig` is an internal interface used only between gateway and runtime; the optional `credentials` field is additive. +- **Integration coverage:** The Dockerfile healthcheck is verified manually (the test would require a running container). Unit tests cover the underlying `ready` handler behavior. +- **Unchanged invariants:** Existing operators with no AWS credentials configured continue to work (SDK default chain takes over). Existing operators using IRSA / EC2-instance-role continue to work. The compose stack's mitmproxy egress allowlist is unchanged. Discord-only "testing plumbing" deploys (per `deploy/README.md`) continue to work without setting AWS credentials. + +## Risks & Dependencies + +| Risk | Mitigation | +|------|------------| +| Healthcheck change surprises existing operators who didn't realize their deploys were succeeding under a no-op check | Mention prominently in PR body + `deploy/README.md` update. The "surprise" is exposing already-broken deployments, not creating new failure. | +| Operators with valid AWS credentials in env vars (not files) lose them | Not applicable — the `_FILE` pattern is additive. Operators using env vars directly continue to work via the SDK default chain. | +| `/tmp/gateway-ready` cleanup race if startup is interrupted between unlink and listener attach | Cleanup is best-effort and tolerates `ENOENT`. Attach the `'clientReady'` listener before `login()` so the listener is guaranteed registered before any chance of the event firing. | +| `statSync` TOCTOU race: file disappears between `existsSync` and `statSync`, or `EACCES` on a permission-restricted secret path | Both surface as startup errors with the file path in the message; let them throw rather than swallow. Operators get a clear signal to check the bind-mount permissions. | +| Log rotation defaults too aggressive for high-traffic operators | `max-size: "10m"` × `max-file: "3"` = 30 MB per container. Conservative for the testing-targeted v0.44.x deploy. Operators with real volume can override via their own `compose.override.yaml`. | +| Workspace container picks up the broken-healthcheck pattern when Unit 7 lands | Document in this PR's body that workspace will need its own readiness story. Tracked in todo 010 (mitmproxy HTTP probe — partial). | + +## Documentation / Operational Notes + +- **README updates** (Unit 3): AWS credential `touch` block matching `discord-guild-id` pattern. Replace any "CA cert present = healthy" framing. +- **`.env.example`**: review for any references to the old healthcheck behavior; update if needed. +- **CHANGELOG**: Not maintained as a separate file — release notes come from squash-merge commit messages per repo convention. PR body needs to clearly describe the operator-facing changes. +- **Cross-repo coordination**: Marcus runs `marcusrbrown/infra` against this stack. Once this PR is merged and a v0.44.x tag ships, `apps/gateway/upstream.json` in the infra repo bumps to the new version. The PR body should link forward to the eventual infra-side issue/PR. + +## Sources & References + +- Verified state of current `main` (HEAD `b8298bc`, tag `v0.44.0`) via direct file reads documented in this session's transcript. +- Oracle verification pass — confirmed Gaps 1 and 3 are stale on current main, Gap 2 is real with caveat (gateway daemon does not yet call S3), Gap 4 is real. +- Feasibility verification pass — confirmed `@aws-sdk/client-s3@3.1045.0` accepts `AwsCredentialIdentity | AwsCredentialIdentityProvider` for the `credentials:` field, `sessionToken` is part of the identity shape, and discord.js v14.26.4 emits both `'ready'` (deprecated) and `'clientReady'` (canonical). +- Prior related PRs: #638 (security closeout), #644 (testing ergonomics) — established the `*_FILE` + bind-mount + `touch` pattern. +- Gateway v1 plan: `docs/plans/2026-04-18-001-feat-fro-bot-gateway-discord-v1-plan.md` — Unit 7 carries the deferred items (workspace CA, HTTP healthz). +- AWS SDK v3 `S3Client` credentials: `node_modules/@aws-sdk/client-s3/dist-types/S3Client.d.ts:12,72`. +- discord.js `Events` constants: `node_modules/discord.js/src/util/Events.js:15,111`. `WebSocketManager` ready emit: `node_modules/discord.js/src/client/websocket/WebSocketManager.js:375-392`. From 263dc372293528b290067504c4b999735957c59a Mon Sep 17 00:00:00 2001 From: "Marcus R. Brown" Date: Tue, 19 May 2026 21:15:14 -0700 Subject: [PATCH 6/8] fix(gateway): move readiness flag out of /tmp MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Static analyzers flag predictable paths in /tmp as a temp-file weakness (CWE-377/378). The flag is intentionally deterministic — the Dockerfile healthcheck has to know where to find it — so fs.mkdtempSync() doesn't apply. Move the default to /var/run/fro-bot/gateway-ready, which the Dockerfile creates with 0700 permissions before the HEALTHCHECK runs. The FRO_BOT_READY_FLAG_PATH env override is preserved; tests already use isolated mkdtempSync paths and didn't need changes. Rebuilt dist/ for the readiness path baked into main.mjs. --- deploy/README.md | 4 ++-- deploy/gateway.Dockerfile | 15 ++++++++++----- ...{artifact-D-cL1zfn.js => artifact-BFFXP2kT.js} | 2 +- dist/main.js | 2 +- dist/post.js | 2 +- packages/gateway/src/readiness.ts | 7 ++++--- 6 files changed, 19 insertions(+), 13 deletions(-) rename dist/{artifact-D-cL1zfn.js => artifact-BFFXP2kT.js} (98%) diff --git a/deploy/README.md b/deploy/README.md index 029e2e88..bf188b0e 100644 --- a/deploy/README.md +++ b/deploy/README.md @@ -125,10 +125,10 @@ This checks: The gateway container is considered healthy only after two conditions are both true: -1. The Discord `clientReady` event has fired — the bot is fully connected and ready to receive events. At that point the process writes `/tmp/gateway-ready`. +1. The Discord `clientReady` event has fired — the bot is fully connected and ready to receive events. At that point the process writes `/var/run/fro-bot/gateway-ready`. 2. The daemon process (PID 1) is still alive (`kill -0 1`). -The flag is cleared at process startup, so a stale `/tmp/gateway-ready` from a prior container run cannot mask a current-run failure. `docker compose up --wait` blocks until the gateway is genuinely connected to Discord before returning. +The flag is cleared at process startup, so a stale `/var/run/fro-bot/gateway-ready` from a prior container run cannot mask a current-run failure. `docker compose up --wait` blocks until the gateway is genuinely connected to Discord before returning. ## Stopping the Stack diff --git a/deploy/gateway.Dockerfile b/deploy/gateway.Dockerfile index 1c2f0d59..934d93ef 100644 --- a/deploy/gateway.Dockerfile +++ b/deploy/gateway.Dockerfile @@ -38,12 +38,17 @@ COPY --from=build /workspace/packages/gateway/dist/ ./packages/gateway/dist/ WORKDIR /app/packages/gateway +# Readiness flag directory. Kept outside /tmp so static-analysis tools +# don't flag the predictable-path pattern, and so the flag survives any +# future tmpfs-mount changes to /tmp. +RUN mkdir -p /var/run/fro-bot && chmod 0700 /var/run/fro-bot + # Readiness healthcheck — passes when the Discord `clientReady` event has -# fired (writes /tmp/gateway-ready) AND PID 1 is alive. Cleared at process -# startup so a stale flag from a prior process cannot mask a current-run -# failure. A real liveness probe (HTTP /healthz) lands alongside the -# workspace agent. +# fired (writes /var/run/fro-bot/gateway-ready) AND PID 1 is alive. Cleared +# at process startup so a stale flag from a prior process cannot mask a +# current-run failure. A real liveness probe (HTTP /healthz) lands alongside +# the workspace agent. HEALTHCHECK --interval=10s --timeout=3s --retries=12 --start-period=45s \ - CMD test -f /tmp/gateway-ready && kill -0 1 || exit 1 + CMD test -f /var/run/fro-bot/gateway-ready && kill -0 1 || exit 1 CMD ["node", "dist/main.mjs"] diff --git a/dist/artifact-D-cL1zfn.js b/dist/artifact-BFFXP2kT.js similarity index 98% rename from dist/artifact-D-cL1zfn.js rename to dist/artifact-BFFXP2kT.js index 200560d5..f4209ecd 100644 --- a/dist/artifact-D-cL1zfn.js +++ b/dist/artifact-BFFXP2kT.js @@ -102,7 +102,7 @@ Every response you post — regardless of channel (issue, PR, discussion, review However, a future version may change this behavior to prefer the ENV static credentials. Please ensure that your environment only sets either the AWS_PROFILE or the AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY pair. -`),!0)),new r.CredentialsProviderError(`AWS_PROFILE is set, skipping fromEnv provider.`,{logger:e.logger,tryNextLink:!0});return e.logger?.debug(`@aws-sdk/credential-provider-node - defaultProvider::fromEnv`),t.fromEnv(e)()},async t=>{e.logger?.debug(`@aws-sdk/credential-provider-node - defaultProvider::fromSSO`);let{ssoStartUrl:i,ssoAccountId:a,ssoRegion:o,ssoRoleName:s,ssoSession:c}=e;if(!i&&!a&&!o&&!s&&!c)throw new r.CredentialsProviderError(`Skipping SSO provider in default chain (inputs do not include SSO fields).`,{logger:e.logger});let{fromSSO:l}=await import(`./dist-cjs-Fom3JyZC.js`).then(e=>n(e.default));return l(e)(t)},async t=>{e.logger?.debug(`@aws-sdk/credential-provider-node - defaultProvider::fromIni`);let{fromIni:r}=await import(`./dist-cjs-BPBeq5Um.js`).then(e=>n(e.default));return r(e)(t)},async t=>{e.logger?.debug(`@aws-sdk/credential-provider-node - defaultProvider::fromProcess`);let{fromProcess:r}=await import(`./dist-cjs-BkdmBfYB.js`).then(e=>n(e.default));return r(e)(t)},async t=>{e.logger?.debug(`@aws-sdk/credential-provider-node - defaultProvider::fromTokenFile`);let{fromTokenFile:r}=await import(`./dist-cjs-DjaETdKJ.js`).then(e=>n(e.default));return r(e)(t)},async()=>(e.logger?.debug(`@aws-sdk/credential-provider-node - defaultProvider::remoteProvider`),(await o(e))()),async()=>{throw new r.CredentialsProviderError(`Could not load credentials from any providers`,{tryNextLink:!1,logger:e.logger})}],f),d=e=>e?.expiration!==void 0,f=e=>e?.expiration!==void 0&&e.expiration.getTime()-Date.now()<3e5;e.credentialsTreatedAsExpired=f,e.credentialsWillNeedRefresh=d,e.defaultProvider=u})),js=i((e=>{var t=T(),n=ae(),r=c();let i=`AWS_S3_DISABLE_MULTIREGION_ACCESS_POINTS`,a=`s3_disable_multiregion_access_points`,o={environmentVariableSelector:e=>t.booleanSelector(e,i,t.SelectorType.ENV),configFileSelector:e=>t.booleanSelector(e,a,t.SelectorType.CONFIG),default:!1},s=`AWS_S3_USE_ARN_REGION`,l=`s3_use_arn_region`,u={environmentVariableSelector:e=>t.booleanSelector(e,s,t.SelectorType.ENV),configFileSelector:e=>t.booleanSelector(e,l,t.SelectorType.CONFIG),default:void 0},d=/^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/,f=/(\d+\.){3}\d+/,p=/\.\./,m=/\./,h=/^(.+\.)?s3(-fips)?(\.dualstack)?[.-]([a-z0-9-]+)\./,g=/^s3(-external-1)?\.amazonaws\.com$/,v=`amazonaws.com`,y=e=>typeof e.bucketName==`string`,b=e=>d.test(e)&&!f.test(e)&&!p.test(e),x=e=>{let t=e.match(h);return[t[4],e.replace(RegExp(`^${t[0]}`),``)]},S=e=>g.test(e)?[`us-east-1`,v]:x(e),C=e=>g.test(e)?[e.replace(`.${v}`,``),v]:x(e),w=e=>{if(e.pathStyleEndpoint)throw Error(`Path-style S3 endpoint is not supported when bucket is an ARN`);if(e.accelerateEndpoint)throw Error(`Accelerate endpoint is not supported when bucket is an ARN`);if(!e.tlsCompatible)throw Error(`HTTPS is required when bucket is an ARN`)},E=e=>{if(e!==`s3`&&e!==`s3-outposts`&&e!==`s3-object-lambda`)throw Error(`Expect 's3' or 's3-outposts' or 's3-object-lambda' in ARN service component`)},D=e=>{if(e!==`s3`)throw Error(`Expect 's3' in Accesspoint ARN service component`)},O=e=>{if(e!==`s3-outposts`)throw Error(`Expect 's3-posts' in Outpost ARN service component`)},k=(e,t)=>{if(e!==t.clientPartition)throw Error(`Partition in ARN is incompatible, got "${e}" but expected "${t.clientPartition}"`)},A=(e,t)=>{},j=e=>{if([`s3-external-1`,`aws-global`].includes(e))throw Error(`Client region ${e} is not regional`)},M=e=>{if(!/[0-9]{12}/.exec(e))throw Error(`Access point ARN accountID does not match regex '[0-9]{12}'`)},N=(e,t={tlsCompatible:!0})=>{if(e.length>=64||!/^[a-z0-9][a-z0-9.-]*[a-z0-9]$/.test(e)||/(\d+\.){3}\d+/.test(e)||/[.-]{2}/.test(e)||t?.tlsCompatible&&m.test(e))throw Error(`Invalid DNS label ${e}`)},P=e=>{if(e.isCustomEndpoint){if(e.dualstackEndpoint)throw Error(`Dualstack endpoint is not supported with custom endpoint`);if(e.accelerateEndpoint)throw Error(`Accelerate endpoint is not supported with custom endpoint`)}},F=e=>{let t=e.includes(`:`)?`:`:`/`,[n,...r]=e.split(t);if(n===`accesspoint`){if(r.length!==1||r[0]===``)throw Error(`Access Point ARN should have one resource accesspoint${t}{accesspointname}`);return{accesspointName:r[0]}}else if(n===`outpost`){if(!r[0]||r[1]!==`accesspoint`||!r[2]||r.length!==3)throw Error(`Outpost ARN should have resource outpost${t}{outpostId}${t}accesspoint${t}{accesspointName}`);let[e,n,i]=r;return{outpostId:e,accesspointName:i}}else throw Error(`ARN resource should begin with 'accesspoint${t}' or 'outpost${t}'`)},I=e=>{},L=e=>{if(e)throw Error(`FIPS region is not supported with Outpost.`)},R=e=>{try{e.split(`.`).forEach(e=>{N(e)})}catch{throw Error(`"${e}" is not a DNS compatible name.`)}},z=e=>(P(e),y(e)?ee(e):te(e)),ee=({accelerateEndpoint:e=!1,clientRegion:t,baseHostname:n,bucketName:r,dualstackEndpoint:i=!1,fipsEndpoint:a=!1,pathStyleEndpoint:o=!1,tlsCompatible:s=!0,isCustomEndpoint:c=!1})=>{let[l,u]=c?[t,n]:S(n);return o||!b(r)||s&&m.test(r)?{bucketEndpoint:!1,hostname:i?`s3.dualstack.${l}.${u}`:n}:(e?n=`s3-accelerate${i?`.dualstack`:``}.${u}`:i&&(n=`s3.dualstack.${l}.${u}`),{bucketEndpoint:!0,hostname:`${r}.${n}`})},te=e=>{let{isCustomEndpoint:t,baseHostname:n,clientRegion:r}=e,i=t?n:C(n)[1],{pathStyleEndpoint:a,accelerateEndpoint:o=!1,fipsEndpoint:s=!1,tlsCompatible:c=!0,bucketName:l,clientPartition:u=`aws`}=e;w({pathStyleEndpoint:a,accelerateEndpoint:o,tlsCompatible:c});let{service:d,partition:f,accountId:p,region:m,resource:h}=l;E(d),k(f,{clientPartition:u}),M(p);let{accesspointName:g,outpostId:v}=F(h);return d===`s3-object-lambda`?ne({...e,tlsCompatible:c,bucketName:l,accesspointName:g,hostnameSuffix:i}):m===``?re({...e,mrapAlias:g,hostnameSuffix:i}):v?B({...e,clientRegion:r,outpostId:v,accesspointName:g,hostnameSuffix:i}):ie({...e,clientRegion:r,accesspointName:g,hostnameSuffix:i})},ne=({dualstackEndpoint:e=!1,fipsEndpoint:t=!1,tlsCompatible:n=!0,useArnRegion:r,clientRegion:i,clientSigningRegion:a=i,accesspointName:o,bucketName:s,hostnameSuffix:c})=>{let{accountId:l,region:u,service:d}=s;j(i);let f=`${o}-${l}`;N(f,{tlsCompatible:n});let p=r?u:i,m=r?u:a;return{bucketEndpoint:!0,hostname:`${f}.${d}${t?`-fips`:``}.${p}.${c}`,signingRegion:m,signingService:d}},re=({disableMultiregionAccessPoints:e,dualstackEndpoint:t=!1,isCustomEndpoint:n,mrapAlias:r,hostnameSuffix:i})=>{if(e===!0)throw Error(`SDK is attempting to use a MRAP ARN. Please enable to feature.`);return R(r),{bucketEndpoint:!0,hostname:`${r}${n?``:`.accesspoint.s3-global`}.${i}`,signingRegion:`*`}},B=({useArnRegion:e,clientRegion:t,clientSigningRegion:n=t,bucketName:r,outpostId:i,dualstackEndpoint:a=!1,fipsEndpoint:o=!1,tlsCompatible:s=!0,accesspointName:c,isCustomEndpoint:l,hostnameSuffix:u})=>{j(t);let d=`${c}-${r.accountId}`;N(d,{tlsCompatible:s});let f=e?r.region:t,p=e?r.region:n;return O(r.service),N(i,{tlsCompatible:s}),L(o),{bucketEndpoint:!0,hostname:`${`${d}.${i}`}${l?``:`.s3-outposts.${f}`}.${u}`,signingRegion:p,signingService:`s3-outposts`}},ie=({useArnRegion:e,clientRegion:t,clientSigningRegion:n=t,bucketName:r,dualstackEndpoint:i=!1,fipsEndpoint:a=!1,tlsCompatible:o=!0,accesspointName:s,isCustomEndpoint:c,hostnameSuffix:l})=>{j(t);let u=`${s}-${r.accountId}`;N(u,{tlsCompatible:o});let d=e?r.region:t,f=e?r.region:n;return D(r.service),{bucketEndpoint:!0,hostname:`${u}${c?``:`.s3-accesspoint${a?`-fips`:``}${i?`.dualstack`:``}.${d}`}.${l}`,signingRegion:f}},V=e=>(t,i)=>async a=>{let{Bucket:o}=a.input,s=e.bucketEndpoint,c=a.request;if(r.HttpRequest.isInstance(c)){if(e.bucketEndpoint)c.hostname=o;else if(n.validate(o)){let t=n.parse(o),r=await e.region(),a=await e.useDualstackEndpoint(),l=await e.useFipsEndpoint(),{partition:u,signingRegion:d=r}=await e.regionInfoProvider(r,{useDualstackEndpoint:a,useFipsEndpoint:l})||{},f=await e.useArnRegion(),{hostname:p,bucketEndpoint:m,signingRegion:h,signingService:g}=z({bucketName:t,baseHostname:c.hostname,accelerateEndpoint:e.useAccelerateEndpoint,dualstackEndpoint:a,fipsEndpoint:l,pathStyleEndpoint:e.forcePathStyle,tlsCompatible:c.protocol===`https:`,useArnRegion:f,clientPartition:u,clientSigningRegion:d,clientRegion:r,isCustomEndpoint:e.isCustomEndpoint,disableMultiregionAccessPoints:await e.disableMultiregionAccessPoints()});h&&h!==d&&(i.signing_region=h),g&&g!==`s3`&&(i.signing_service=g),c.hostname=p,s=m}else{let t=await e.region(),n=await e.useDualstackEndpoint(),r=await e.useFipsEndpoint(),{hostname:i,bucketEndpoint:a}=z({bucketName:o,clientRegion:t,baseHostname:c.hostname,accelerateEndpoint:e.useAccelerateEndpoint,dualstackEndpoint:n,fipsEndpoint:r,pathStyleEndpoint:e.forcePathStyle,tlsCompatible:c.protocol===`https:`,isCustomEndpoint:e.isCustomEndpoint});c.hostname=i,s=a}s&&(c.path=c.path.replace(/^(\/)?[^\/]+/,``),c.path===``&&(c.path=`/`))}return t({...a,request:c})},oe={tags:[`BUCKET_ENDPOINT`],name:`bucketEndpointMiddleware`,relation:`before`,toMiddleware:`hostHeaderMiddleware`,override:!0},H=e=>({applyToStack:t=>{t.addRelativeTo(V(e),oe)}});function se(e){let{bucketEndpoint:t=!1,forcePathStyle:n=!1,useAccelerateEndpoint:r=!1,useArnRegion:i,disableMultiregionAccessPoints:a=!1}=e;return Object.assign(e,{bucketEndpoint:t,forcePathStyle:n,useAccelerateEndpoint:r,useArnRegion:typeof i==`function`?i:()=>Promise.resolve(i),disableMultiregionAccessPoints:typeof a==`function`?a:()=>Promise.resolve(a)})}e.NODE_DISABLE_MULTIREGION_ACCESS_POINT_CONFIG_OPTIONS=o,e.NODE_DISABLE_MULTIREGION_ACCESS_POINT_ENV_NAME=i,e.NODE_DISABLE_MULTIREGION_ACCESS_POINT_INI_NAME=a,e.NODE_USE_ARN_REGION_CONFIG_OPTIONS=u,e.NODE_USE_ARN_REGION_ENV_NAME=s,e.NODE_USE_ARN_REGION_INI_NAME=l,e.bucketEndpointMiddleware=V,e.bucketEndpointMiddlewareOptions=oe,e.bucketHostname=z,e.getArnResources=F,e.getBucketEndpointPlugin=H,e.getSuffixForArnEndpoint=C,e.resolveBucketEndpointConfig=se,e.validateAccountId=M,e.validateDNSHostLabel=N,e.validateNoDualstack=I,e.validateNoFIPS=L,e.validateOutpostService=O,e.validatePartition=k,e.validateRegion=A})),Ms=i((e=>{var t=ys(),n=y(),r=class e{bytes;constructor(e){if(this.bytes=e,e.byteLength!==8)throw Error(`Int64 buffers must be exactly 8 bytes`)}static fromNumber(t){if(t>0x8000000000000000||t<-0x8000000000000000)throw Error(`${t} is too large (or, if negative, too small) to represent as an Int64`);let n=new Uint8Array(8);for(let e=7,r=Math.abs(Math.round(t));e>-1&&r>0;e--,r/=256)n[e]=r;return t<0&&i(n),new e(n)}valueOf(){let e=this.bytes.slice(0),t=e[0]&128;return t&&i(e),parseInt(n.toHex(e),16)*(t?-1:1)}toString(){return String(this.valueOf())}};function i(e){for(let t=0;t<8;t++)e[t]^=255;for(let t=7;t>-1&&(e[t]++,e[t]===0);t--);}var a=class{toUtf8;fromUtf8;constructor(e,t){this.toUtf8=e,this.fromUtf8=t}format(e){let t=[];for(let n of Object.keys(e)){let r=this.fromUtf8(n);t.push(Uint8Array.from([r.byteLength]),r,this.formatHeaderValue(e[n]))}let n=new Uint8Array(t.reduce((e,t)=>e+t.byteLength,0)),r=0;for(let e of t)n.set(e,r),r+=e.byteLength;return n}formatHeaderValue(e){switch(e.type){case`boolean`:return Uint8Array.from([+!e.value]);case`byte`:return Uint8Array.from([2,e.value]);case`short`:let t=new DataView(new ArrayBuffer(3));return t.setUint8(0,3),t.setInt16(1,e.value,!1),new Uint8Array(t.buffer);case`integer`:let i=new DataView(new ArrayBuffer(5));return i.setUint8(0,4),i.setInt32(1,e.value,!1),new Uint8Array(i.buffer);case`long`:let a=new Uint8Array(9);return a[0]=5,a.set(e.value.bytes,1),a;case`binary`:let o=new DataView(new ArrayBuffer(3+e.value.byteLength));o.setUint8(0,6),o.setUint16(1,e.value.byteLength,!1);let s=new Uint8Array(o.buffer);return s.set(e.value,3),s;case`string`:let c=this.fromUtf8(e.value),l=new DataView(new ArrayBuffer(3+c.byteLength));l.setUint8(0,7),l.setUint16(1,c.byteLength,!1);let u=new Uint8Array(l.buffer);return u.set(c,3),u;case`timestamp`:let d=new Uint8Array(9);return d[0]=8,d.set(r.fromNumber(e.value.valueOf()).bytes,1),d;case`uuid`:if(!g.test(e.value))throw Error(`Invalid UUID received: ${e.value}`);let f=new Uint8Array(17);return f[0]=9,f.set(n.fromHex(e.value.replace(/\-/g,``)),1),f}}parse(e){let t={},i=0;for(;i{var t=Ms();function n(e){let t=0,n=0,r=null,i=null,a=e=>{if(typeof e!=`number`)throw Error(`Attempted to allocate an event message where size was not a number: `+e);t=e,n=4,r=new Uint8Array(e),new DataView(r.buffer).setUint32(0,e,!1)},o=async function*(){let o=e[Symbol.asyncIterator]();for(;;){let{value:e,done:s}=await o.next();if(s){if(!t)return;if(t===n)yield r;else throw Error(`Truncated event message received.`);return}let c=e.length,l=0;for(;lnew i(e)})),Ps=i((e=>{var n=Ns(),r=t(`stream`);async function*i(e){let t=!1,n=!1,r=[];for(e.on(`error`,e=>{if(t||=!0,e)throw e}),e.on(`data`,e=>{r.push(e)}),e.on(`end`,()=>{t=!0});!n;){let e=await new Promise(e=>setTimeout(()=>e(r.shift()),0));e&&(yield e),n=t&&r.length===0}}var a=class{universalMarshaller;constructor({utf8Encoder:e,utf8Decoder:t}){this.universalMarshaller=new n.EventStreamMarshaller({utf8Decoder:t,utf8Encoder:e})}deserialize(e,t){let n=typeof e[Symbol.asyncIterator]==`function`?e:i(e);return this.universalMarshaller.deserialize(n,t)}serialize(e,t){return r.Readable.from(this.universalMarshaller.serialize(e,t))}};e.EventStreamMarshaller=a,e.eventStreamSerdeProvider=e=>new a(e)})),Fs=i((e=>{var n=t(`fs`),r=p(),i=t(`stream`),a=class extends i.Writable{hash;constructor(e,t){super(t),this.hash=e}_write(e,t,n){try{this.hash.update(r.toUint8Array(e))}catch(e){return n(e)}n()}};let o=(e,t)=>new Promise((r,i)=>{if(!s(t)){i(Error(`Unable to calculate hash for non-file streams.`));return}let o=n.createReadStream(t.path,{start:t.start,end:t.end}),c=new e,l=new a(c);o.pipe(l),o.on(`error`,e=>{l.end(),i(e)}),l.on(`error`,i),l.on(`finish`,function(){c.digest().then(r).catch(i)})}),s=e=>typeof e.path==`string`;e.fileStreamHasher=o,e.readableStreamHasher=(e,t)=>{if(t.readableFlowing!==null)throw Error(`Unable to calculate hash for flowing readable stream`);let n=new e,r=new a(n);return t.pipe(r),new Promise((e,i)=>{t.on(`error`,e=>{r.end(),i(e)}),r.on(`error`,i),r.on(`finish`,()=>{n.digest().then(e).catch(i)})})}})),Is=i((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.getRuntimeConfig=void 0;let n=(ee(),e(R)),r=V(),i=oe(),a=w(),o=ie(),s=m(),c=v(),l=p(),u=Ts(),d=ws(),f=Os();t.getRuntimeConfig=e=>({apiVersion:`2006-03-01`,base64Decoder:e?.base64Decoder??s.fromBase64,base64Encoder:e?.base64Encoder??s.toBase64,disableHostPrefix:e?.disableHostPrefix??!1,endpointProvider:e?.endpointProvider??d.defaultEndpointResolver,extensions:e?.extensions??[],getAwsChunkedEncodingStream:e?.getAwsChunkedEncodingStream??c.getAwsChunkedEncodingStream,httpAuthSchemeProvider:e?.httpAuthSchemeProvider??u.defaultS3HttpAuthSchemeProvider,httpAuthSchemes:e?.httpAuthSchemes??[{schemeId:`aws.auth#sigv4`,identityProvider:e=>e.getIdentityProvider(`aws.auth#sigv4`),signer:new n.AwsSdkSigV4Signer},{schemeId:`aws.auth#sigv4a`,identityProvider:e=>e.getIdentityProvider(`aws.auth#sigv4a`),signer:new n.AwsSdkSigV4ASigner}],logger:e?.logger??new a.NoOpLogger,protocol:e?.protocol??r.S3RestXmlProtocol,protocolSettings:e?.protocolSettings??{defaultNamespace:`com.amazonaws.s3`,errorTypeRegistries:f.errorTypeRegistries,xmlNamespace:`http://s3.amazonaws.com/doc/2006-03-01/`,version:`2006-03-01`,serviceTarget:`AmazonS3`},sdkStreamMixin:e?.sdkStreamMixin??c.sdkStreamMixin,serviceId:e?.serviceId??`S3`,signerConstructor:e?.signerConstructor??i.SignatureV4MultiRegion,signingEscapePath:e?.signingEscapePath??!1,urlParser:e?.urlParser??o.parseUrl,useArnRegion:e?.useArnRegion??void 0,utf8Decoder:e?.utf8Decoder??l.fromUtf8,utf8Encoder:e?.utf8Encoder??l.toUtf8})})),Ls=i((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.getRuntimeConfig=void 0;let n=(x(),e(g)).__importDefault(ks()),r=(l(),e(d)),i=(ee(),e(R)),a=As(),o=js(),s=xs(),c=V(),f=j(),p=A(),m=Ps(),h=F(),v=Fs(),y=I(),b=ce(),C=S(),T=w(),E=z(),D=L(),O=u(),k=Is();t.getRuntimeConfig=e=>{(0,T.emitWarningIfUnsupportedVersion)(process.version);let t=(0,D.resolveDefaultsModeConfig)(e),l=()=>t().then(T.loadConfigsForDefaultMode),u=(0,k.getRuntimeConfig)(e);(0,r.emitWarningIfUnsupportedVersion)(process.version);let d={profile:e?.profile,logger:u.logger};return{...u,...e,runtime:`node`,defaultsMode:t,authSchemePreference:e?.authSchemePreference??(0,b.loadConfig)(i.NODE_AUTH_SCHEME_PREFERENCE_OPTIONS,d),bodyLengthChecker:e?.bodyLengthChecker??E.calculateBodyLength,credentialDefaultProvider:e?.credentialDefaultProvider??a.defaultProvider,defaultUserAgentProvider:e?.defaultUserAgentProvider??(0,f.createDefaultUserAgentProvider)({serviceId:u.serviceId,clientVersion:n.default.version}),disableS3ExpressSessionAuth:e?.disableS3ExpressSessionAuth??(0,b.loadConfig)(c.NODE_DISABLE_S3_EXPRESS_SESSION_AUTH_OPTIONS,d),eventStreamSerdeProvider:e?.eventStreamSerdeProvider??m.eventStreamSerdeProvider,maxAttempts:e?.maxAttempts??(0,b.loadConfig)(y.NODE_MAX_ATTEMPT_CONFIG_OPTIONS,e),md5:e?.md5??h.Hash.bind(null,`md5`),region:e?.region??(0,b.loadConfig)(p.NODE_REGION_CONFIG_OPTIONS,{...p.NODE_REGION_CONFIG_FILE_OPTIONS,...d}),requestChecksumCalculation:e?.requestChecksumCalculation??(0,b.loadConfig)(s.NODE_REQUEST_CHECKSUM_CALCULATION_CONFIG_OPTIONS,d),requestHandler:C.NodeHttpHandler.create(e?.requestHandler??l),responseChecksumValidation:e?.responseChecksumValidation??(0,b.loadConfig)(s.NODE_RESPONSE_CHECKSUM_VALIDATION_CONFIG_OPTIONS,d),retryMode:e?.retryMode??(0,b.loadConfig)({...y.NODE_RETRY_MODE_CONFIG_OPTIONS,default:async()=>(await l()).retryMode||O.DEFAULT_RETRY_MODE},e),sha1:e?.sha1??h.Hash.bind(null,`sha1`),sha256:e?.sha256??h.Hash.bind(null,`sha256`),sigv4aSigningRegionSet:e?.sigv4aSigningRegionSet??(0,b.loadConfig)(i.NODE_SIGV4A_CONFIG_OPTIONS,d),streamCollector:e?.streamCollector??C.streamCollector,streamHasher:e?.streamHasher??v.readableStreamHasher,useArnRegion:e?.useArnRegion??(0,b.loadConfig)(o.NODE_USE_ARN_REGION_CONFIG_OPTIONS,d),useDualstackEndpoint:e?.useDualstackEndpoint??(0,b.loadConfig)(p.NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS,d),useFipsEndpoint:e?.useFipsEndpoint??(0,b.loadConfig)(p.NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS,d),userAgentAppId:e?.userAgentAppId??(0,b.loadConfig)(f.NODE_APP_ID_CONFIG_OPTIONS,d)}}})),Rs=i((e=>{function t(e){return t=>async n=>{let r={...n.input};for(let t of[{target:`SSECustomerKey`,hash:`SSECustomerKeyMD5`},{target:`CopySourceSSECustomerKey`,hash:`CopySourceSSECustomerKeyMD5`}]){let n=r[t.target];if(n){let a;typeof n==`string`?i(n,e)?a=e.base64Decoder(n):(a=e.utf8Decoder(n),r[t.target]=e.base64Encoder(a)):(a=ArrayBuffer.isView(n)?new Uint8Array(n.buffer,n.byteOffset,n.byteLength):new Uint8Array(n),r[t.target]=e.base64Encoder(a));let o=new e.md5;o.update(a),r[t.hash]=e.base64Encoder(await o.digest())}}return t({...n,input:r})}}let n={name:`ssecMiddleware`,step:`initialize`,tags:[`SSE`],override:!0},r=e=>({applyToStack:r=>{r.add(t(e),n)}});function i(e,t){if(!/^(?:[A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e))return!1;try{return t.base64Decoder(e).length===32}catch{return!1}}e.getSsecPlugin=r,e.isValidBase64EncodedSSECustomerKey=i,e.ssecMiddleware=t,e.ssecMiddlewareOptions=n})),zs=i((e=>{function t(e){return t=>async n=>{let{CreateBucketConfiguration:r}=n.input,i=await e.region();return!r?.LocationConstraint&&!r?.Location&&i!==`us-east-1`&&(n.input.CreateBucketConfiguration=n.input.CreateBucketConfiguration??{},n.input.CreateBucketConfiguration.LocationConstraint=i),t(n)}}let n={step:`initialize`,tags:[`LOCATION_CONSTRAINT`,`CREATE_BUCKET_CONFIGURATION`],name:`locationConstraintMiddleware`,override:!0};e.getLocationConstraintPlugin=e=>({applyToStack:r=>{r.add(t(e),n)}}),e.locationConstraintMiddleware=t,e.locationConstraintMiddlewareOptions=n})),Bs=i((e=>{let t=()=>{let e=new WeakSet;return(t,n)=>{if(typeof n==`object`&&n){if(e.has(n))return`[Circular]`;e.add(n)}return n}},n=e=>new Promise(t=>setTimeout(t,e*1e3)),r={minDelay:2,maxDelay:120};e.WaiterState=void 0,(function(e){e.ABORTED=`ABORTED`,e.FAILURE=`FAILURE`,e.SUCCESS=`SUCCESS`,e.RETRY=`RETRY`,e.TIMEOUT=`TIMEOUT`})(e.WaiterState||={});let i=n=>{if(n.state===e.WaiterState.ABORTED){let e=Error(`${JSON.stringify({...n,reason:`Request was aborted`},t())}`);throw e.name=`AbortError`,e}else if(n.state===e.WaiterState.TIMEOUT){let e=Error(`${JSON.stringify({...n,reason:`Waiter has timed out`},t())}`);throw e.name=`TimeoutError`,e}else if(n.state!==e.WaiterState.SUCCESS)throw Error(`${JSON.stringify(n,t())}`);return n},a=async({minDelay:t,maxDelay:r,maxWaitTime:i,abortController:a,client:l,abortSignal:u},d,f)=>{let p={},[m,h]=[t*1e3,r*1e3],g=0,v=Date.now()+i*1e3,y=Date.now()+6e4,b=!1;for(;;){if(g>0){let t=c(m,h,g,v);if(a?.signal?.aborted||u?.aborted){let t=`AbortController signal aborted.`;return p[t]|=0,p[t]+=1,{state:e.WaiterState.ABORTED,observedResponses:p}}if(Date.now()+t>v)return{state:e.WaiterState.TIMEOUT,observedResponses:p};await n(t/1e3)}let{state:t,reason:r}=await f(l,d);if(r){let e=s(r);p[e]|=0,p[e]+=1}if(t!==e.WaiterState.RETRY)return{state:t,reason:r,final:r,observedResponses:p};g+=1,!b&&Date.now()>=y&&(o(p,l),b=!0)}},o=(e={},t)=>{let n=Object.keys(e),r=0;for(let t of n){let n=e[t]|0;t.startsWith(`403:`)&&(r+=n)}let i=t?.config?.logger,a=typeof i?.warn==`function`&&!i.constructor?.name?.includes?.(`NoOpLogger`)?i:console;(r>=3||n[n.length-1].startsWith(`403:`))&&a.warn(`@smithy/util-waiter WARN - 403 status code encountered during waiter polling.`)},s=e=>{let n=e?.$response?.statusCode??e?.$metadata?.httpStatusCode;return e?.$responseBodyText?`${n?n+`: `:``}Deserialization error for body: ${e.$responseBodyText}`:n?e?.$response||e?.message?`${n??`Unknown`}: ${e?.message}`:`${n}: OK`:String(e?.message??JSON.stringify(e,t())??`Unknown`)},c=(e,t,n,r)=>{if(n>Math.log(t/e)/Math.log(2)+1)return t;let i=e*2**(n-1),a=l(e,Math.min(i,t));if(Date.now()+a>r){let e=r-Date.now();return Math.max(0,e-500)}return a},l=(e,t)=>e+Math.random()*(t-e),u=e=>{if(e.maxWaitTime<=0)throw Error(`WaiterConfiguration.maxWaitTime must be greater than 0`);if(e.minDelay<=0)throw Error(`WaiterConfiguration.minDelay must be greater than 0`);if(e.maxDelay<=0)throw Error(`WaiterConfiguration.maxDelay must be greater than 0`);if(e.maxWaitTime<=e.minDelay)throw Error(`WaiterConfiguration.maxWaitTime [${e.maxWaitTime}] must be greater than WaiterConfiguration.minDelay [${e.minDelay}] for this waiter`);if(e.maxDelay{let n;return{clearListener(){typeof t.removeEventListener==`function`&&t.removeEventListener(`abort`,n)},aborted:new Promise(r=>{n=()=>r({state:e.WaiterState.ABORTED}),typeof t.addEventListener==`function`?t.addEventListener(`abort`,n):t.onabort=n})}};e.checkExceptions=i,e.createWaiter=async(e,t,n)=>{let i={...r,...e};u(i);let o=[a(i,t,n)],s=[];if(e.abortSignal){let{aborted:t,clearListener:n}=d(e.abortSignal);s.push(n),o.push(t)}if(e.abortController?.signal){let{aborted:t,clearListener:n}=d(e.abortController.signal);s.push(n),o.push(t)}return Promise.race(o).then(e=>{for(let e of s)e();return e})},e.waiterServiceDefaults=r})),Vs=i((t=>{var n=os(),r=xs(),i=E(),a=O(),o=D(),s=V(),l=ne(),u=A(),d=(k(),e(re)),f=(C(),e(h)),p=Ss(),m=N(),g=P(),v=I(),y=w(),b=Ts(),x=Os(),S=Ls(),T=te(),j=c(),M=Rs(),F=zs(),L=Bs(),R=Ds(),z=Es();let ee=e=>Object.assign(e,{useFipsEndpoint:e.useFipsEndpoint??!1,useDualstackEndpoint:e.useDualstackEndpoint??!1,forcePathStyle:e.forcePathStyle??!1,useAccelerateEndpoint:e.useAccelerateEndpoint??!1,useGlobalEndpoint:e.useGlobalEndpoint??!1,disableMultiregionAccessPoints:e.disableMultiregionAccessPoints??!1,defaultSigningName:`s3`,clientContextParams:e.clientContextParams??{}}),B={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`}};var ie=class extends y.Command.classBuilder().ep({...B,DisableS3ExpressSessionAuth:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`CreateSession`,{}).n(`S3Client`,`CreateSessionCommand`).sc(x.CreateSession$).build(){};let ae=e=>{let t=e.httpAuthSchemes,n=e.httpAuthSchemeProvider,r=e.credentials;return{setHttpAuthScheme(e){let n=t.findIndex(t=>t.schemeId===e.schemeId);n===-1?t.push(e):t.splice(n,1,e)},httpAuthSchemes(){return t},setHttpAuthSchemeProvider(e){n=e},httpAuthSchemeProvider(){return n},setCredentials(e){r=e},credentials(){return r}}},oe=e=>({httpAuthSchemes:e.httpAuthSchemes(),httpAuthSchemeProvider:e.httpAuthSchemeProvider(),credentials:e.credentials()}),H=(e,t)=>{let n=Object.assign(T.getAwsRegionExtensionConfiguration(e),y.getDefaultExtensionConfiguration(e),j.getHttpHandlerExtensionConfiguration(e),ae(e));return t.forEach(e=>e.configure(n)),Object.assign(e,T.resolveAwsRegionExtensionConfiguration(n),y.resolveDefaultRuntimeConfig(n),j.resolveHttpHandlerRuntimeConfig(n),oe(n))};var se=class extends y.Client{config;constructor(...[e]){let t=S.getRuntimeConfig(e||{});super(t),this.initConfig=t;let c=ee(t),h=l.resolveUserAgentConfig(c),y=r.resolveFlexibleChecksumsConfig(h),x=v.resolveRetryConfig(y),C=u.resolveRegionConfig(x),w=i.resolveHostHeaderConfig(C),T=g.resolveEndpointConfig(w),E=p.resolveEventStreamSerdeConfig(T),D=b.resolveHttpAuthSchemeConfig(E),O=H(s.resolveS3Config(D,{session:[()=>this,ie]}),e?.extensions||[]);this.config=O,this.middlewareStack.use(f.getSchemaSerdePlugin(this.config)),this.middlewareStack.use(l.getUserAgentPlugin(this.config)),this.middlewareStack.use(v.getRetryPlugin(this.config)),this.middlewareStack.use(m.getContentLengthPlugin(this.config)),this.middlewareStack.use(i.getHostHeaderPlugin(this.config)),this.middlewareStack.use(a.getLoggerPlugin(this.config)),this.middlewareStack.use(o.getRecursionDetectionPlugin(this.config)),this.middlewareStack.use(d.getHttpAuthSchemeEndpointRuleSetPlugin(this.config,{httpAuthSchemeParametersProvider:b.defaultS3HttpAuthSchemeParametersProvider,identityProviderConfigProvider:async e=>new d.DefaultIdentityProviderConfig({"aws.auth#sigv4":e.credentials,"aws.auth#sigv4a":e.credentials})})),this.middlewareStack.use(d.getHttpSigningPlugin(this.config)),this.middlewareStack.use(s.getValidateBucketNamePlugin(this.config)),this.middlewareStack.use(n.getAddExpectContinuePlugin(this.config)),this.middlewareStack.use(s.getRegionRedirectMiddlewarePlugin(this.config)),this.middlewareStack.use(s.getS3ExpressPlugin(this.config)),this.middlewareStack.use(s.getS3ExpressHttpSigningPlugin(this.config))}destroy(){super.destroy()}},ce=class extends y.Command.classBuilder().ep({...B,Bucket:{type:`contextParams`,name:`Bucket`},Key:{type:`contextParams`,name:`Key`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`AbortMultipartUpload`,{}).n(`S3Client`,`AbortMultipartUploadCommand`).sc(x.AbortMultipartUpload$).build(){},le=class extends y.Command.classBuilder().ep({...B,Bucket:{type:`contextParams`,name:`Bucket`},Key:{type:`contextParams`,name:`Key`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n),M.getSsecPlugin(n)]}).s(`AmazonS3`,`CompleteMultipartUpload`,{}).n(`S3Client`,`CompleteMultipartUploadCommand`).sc(x.CompleteMultipartUpload$).build(){},ue=class extends y.Command.classBuilder().ep({...B,DisableS3ExpressSessionAuth:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`},Key:{type:`contextParams`,name:`Key`},CopySource:{type:`contextParams`,name:`CopySource`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n),M.getSsecPlugin(n)]}).s(`AmazonS3`,`CopyObject`,{}).n(`S3Client`,`CopyObjectCommand`).sc(x.CopyObject$).build(){},de=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},DisableAccessPoints:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n),F.getLocationConstraintPlugin(n)]}).s(`AmazonS3`,`CreateBucket`,{}).n(`S3Client`,`CreateBucketCommand`).sc(x.CreateBucket$).build(){},fe=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,i){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),r.getFlexibleChecksumsPlugin(n,{requestAlgorithmMember:{httpHeader:`x-amz-sdk-checksum-algorithm`,name:`ChecksumAlgorithm`},requestChecksumRequired:!0})]}).s(`AmazonS3`,`CreateBucketMetadataConfiguration`,{}).n(`S3Client`,`CreateBucketMetadataConfigurationCommand`).sc(x.CreateBucketMetadataConfiguration$).build(){},pe=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,i){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),r.getFlexibleChecksumsPlugin(n,{requestAlgorithmMember:{httpHeader:`x-amz-sdk-checksum-algorithm`,name:`ChecksumAlgorithm`},requestChecksumRequired:!0})]}).s(`AmazonS3`,`CreateBucketMetadataTableConfiguration`,{}).n(`S3Client`,`CreateBucketMetadataTableConfigurationCommand`).sc(x.CreateBucketMetadataTableConfiguration$).build(){},me=class extends y.Command.classBuilder().ep({...B,Bucket:{type:`contextParams`,name:`Bucket`},Key:{type:`contextParams`,name:`Key`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n),M.getSsecPlugin(n)]}).s(`AmazonS3`,`CreateMultipartUpload`,{}).n(`S3Client`,`CreateMultipartUploadCommand`).sc(x.CreateMultipartUpload$).build(){},he=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions())]}).s(`AmazonS3`,`DeleteBucketAnalyticsConfiguration`,{}).n(`S3Client`,`DeleteBucketAnalyticsConfigurationCommand`).sc(x.DeleteBucketAnalyticsConfiguration$).build(){},ge=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions())]}).s(`AmazonS3`,`DeleteBucket`,{}).n(`S3Client`,`DeleteBucketCommand`).sc(x.DeleteBucket$).build(){},_e=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions())]}).s(`AmazonS3`,`DeleteBucketCors`,{}).n(`S3Client`,`DeleteBucketCorsCommand`).sc(x.DeleteBucketCors$).build(){},ve=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions())]}).s(`AmazonS3`,`DeleteBucketEncryption`,{}).n(`S3Client`,`DeleteBucketEncryptionCommand`).sc(x.DeleteBucketEncryption$).build(){},ye=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions())]}).s(`AmazonS3`,`DeleteBucketIntelligentTieringConfiguration`,{}).n(`S3Client`,`DeleteBucketIntelligentTieringConfigurationCommand`).sc(x.DeleteBucketIntelligentTieringConfiguration$).build(){},be=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions())]}).s(`AmazonS3`,`DeleteBucketInventoryConfiguration`,{}).n(`S3Client`,`DeleteBucketInventoryConfigurationCommand`).sc(x.DeleteBucketInventoryConfiguration$).build(){},U=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions())]}).s(`AmazonS3`,`DeleteBucketLifecycle`,{}).n(`S3Client`,`DeleteBucketLifecycleCommand`).sc(x.DeleteBucketLifecycle$).build(){},xe=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions())]}).s(`AmazonS3`,`DeleteBucketMetadataConfiguration`,{}).n(`S3Client`,`DeleteBucketMetadataConfigurationCommand`).sc(x.DeleteBucketMetadataConfiguration$).build(){},Se=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions())]}).s(`AmazonS3`,`DeleteBucketMetadataTableConfiguration`,{}).n(`S3Client`,`DeleteBucketMetadataTableConfigurationCommand`).sc(x.DeleteBucketMetadataTableConfiguration$).build(){},Ce=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions())]}).s(`AmazonS3`,`DeleteBucketMetricsConfiguration`,{}).n(`S3Client`,`DeleteBucketMetricsConfigurationCommand`).sc(x.DeleteBucketMetricsConfiguration$).build(){},we=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions())]}).s(`AmazonS3`,`DeleteBucketOwnershipControls`,{}).n(`S3Client`,`DeleteBucketOwnershipControlsCommand`).sc(x.DeleteBucketOwnershipControls$).build(){},Te=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions())]}).s(`AmazonS3`,`DeleteBucketPolicy`,{}).n(`S3Client`,`DeleteBucketPolicyCommand`).sc(x.DeleteBucketPolicy$).build(){},Ee=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions())]}).s(`AmazonS3`,`DeleteBucketReplication`,{}).n(`S3Client`,`DeleteBucketReplicationCommand`).sc(x.DeleteBucketReplication$).build(){},De=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions())]}).s(`AmazonS3`,`DeleteBucketTagging`,{}).n(`S3Client`,`DeleteBucketTaggingCommand`).sc(x.DeleteBucketTagging$).build(){},Oe=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions())]}).s(`AmazonS3`,`DeleteBucketWebsite`,{}).n(`S3Client`,`DeleteBucketWebsiteCommand`).sc(x.DeleteBucketWebsite$).build(){},ke=class extends y.Command.classBuilder().ep({...B,Bucket:{type:`contextParams`,name:`Bucket`},Key:{type:`contextParams`,name:`Key`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`DeleteObject`,{}).n(`S3Client`,`DeleteObjectCommand`).sc(x.DeleteObject$).build(){},Ae=class extends y.Command.classBuilder().ep({...B,Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,i){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),r.getFlexibleChecksumsPlugin(n,{requestAlgorithmMember:{httpHeader:`x-amz-sdk-checksum-algorithm`,name:`ChecksumAlgorithm`},requestChecksumRequired:!0}),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`DeleteObjects`,{}).n(`S3Client`,`DeleteObjectsCommand`).sc(x.DeleteObjects$).build(){},je=class extends y.Command.classBuilder().ep({...B,Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`DeleteObjectTagging`,{}).n(`S3Client`,`DeleteObjectTaggingCommand`).sc(x.DeleteObjectTagging$).build(){},W=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions())]}).s(`AmazonS3`,`DeletePublicAccessBlock`,{}).n(`S3Client`,`DeletePublicAccessBlockCommand`).sc(x.DeletePublicAccessBlock$).build(){},Me=class extends y.Command.classBuilder().ep({...B,Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`GetBucketAbac`,{}).n(`S3Client`,`GetBucketAbacCommand`).sc(x.GetBucketAbac$).build(){},Ne=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`GetBucketAccelerateConfiguration`,{}).n(`S3Client`,`GetBucketAccelerateConfigurationCommand`).sc(x.GetBucketAccelerateConfiguration$).build(){},Pe=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`GetBucketAcl`,{}).n(`S3Client`,`GetBucketAclCommand`).sc(x.GetBucketAcl$).build(){},Fe=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`GetBucketAnalyticsConfiguration`,{}).n(`S3Client`,`GetBucketAnalyticsConfigurationCommand`).sc(x.GetBucketAnalyticsConfiguration$).build(){},Ie=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`GetBucketCors`,{}).n(`S3Client`,`GetBucketCorsCommand`).sc(x.GetBucketCors$).build(){},Le=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`GetBucketEncryption`,{}).n(`S3Client`,`GetBucketEncryptionCommand`).sc(x.GetBucketEncryption$).build(){},Re=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`GetBucketIntelligentTieringConfiguration`,{}).n(`S3Client`,`GetBucketIntelligentTieringConfigurationCommand`).sc(x.GetBucketIntelligentTieringConfiguration$).build(){},ze=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`GetBucketInventoryConfiguration`,{}).n(`S3Client`,`GetBucketInventoryConfigurationCommand`).sc(x.GetBucketInventoryConfiguration$).build(){},Be=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`GetBucketLifecycleConfiguration`,{}).n(`S3Client`,`GetBucketLifecycleConfigurationCommand`).sc(x.GetBucketLifecycleConfiguration$).build(){},Ve=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`GetBucketLocation`,{}).n(`S3Client`,`GetBucketLocationCommand`).sc(x.GetBucketLocation$).build(){},He=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`GetBucketLogging`,{}).n(`S3Client`,`GetBucketLoggingCommand`).sc(x.GetBucketLogging$).build(){},Ue=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`GetBucketMetadataConfiguration`,{}).n(`S3Client`,`GetBucketMetadataConfigurationCommand`).sc(x.GetBucketMetadataConfiguration$).build(){},We=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`GetBucketMetadataTableConfiguration`,{}).n(`S3Client`,`GetBucketMetadataTableConfigurationCommand`).sc(x.GetBucketMetadataTableConfiguration$).build(){},Ge=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`GetBucketMetricsConfiguration`,{}).n(`S3Client`,`GetBucketMetricsConfigurationCommand`).sc(x.GetBucketMetricsConfiguration$).build(){},Ke=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`GetBucketNotificationConfiguration`,{}).n(`S3Client`,`GetBucketNotificationConfigurationCommand`).sc(x.GetBucketNotificationConfiguration$).build(){},qe=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`GetBucketOwnershipControls`,{}).n(`S3Client`,`GetBucketOwnershipControlsCommand`).sc(x.GetBucketOwnershipControls$).build(){},Je=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions())]}).s(`AmazonS3`,`GetBucketPolicy`,{}).n(`S3Client`,`GetBucketPolicyCommand`).sc(x.GetBucketPolicy$).build(){},Ye=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`GetBucketPolicyStatus`,{}).n(`S3Client`,`GetBucketPolicyStatusCommand`).sc(x.GetBucketPolicyStatus$).build(){},Xe=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`GetBucketReplication`,{}).n(`S3Client`,`GetBucketReplicationCommand`).sc(x.GetBucketReplication$).build(){},Ze=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`GetBucketRequestPayment`,{}).n(`S3Client`,`GetBucketRequestPaymentCommand`).sc(x.GetBucketRequestPayment$).build(){},Qe=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`GetBucketTagging`,{}).n(`S3Client`,`GetBucketTaggingCommand`).sc(x.GetBucketTagging$).build(){},$e=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`GetBucketVersioning`,{}).n(`S3Client`,`GetBucketVersioningCommand`).sc(x.GetBucketVersioning$).build(){},G=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`GetBucketWebsite`,{}).n(`S3Client`,`GetBucketWebsiteCommand`).sc(x.GetBucketWebsite$).build(){},et=class extends y.Command.classBuilder().ep({...B,Bucket:{type:`contextParams`,name:`Bucket`},Key:{type:`contextParams`,name:`Key`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`GetObjectAcl`,{}).n(`S3Client`,`GetObjectAclCommand`).sc(x.GetObjectAcl$).build(){},tt=class extends y.Command.classBuilder().ep({...B,Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n),M.getSsecPlugin(n)]}).s(`AmazonS3`,`GetObjectAttributes`,{}).n(`S3Client`,`GetObjectAttributesCommand`).sc(x.GetObjectAttributes$).build(){},nt=class extends y.Command.classBuilder().ep({...B,Bucket:{type:`contextParams`,name:`Bucket`},Key:{type:`contextParams`,name:`Key`}}).m(function(e,t,n,i){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),r.getFlexibleChecksumsPlugin(n,{requestChecksumRequired:!1,requestValidationModeMember:`ChecksumMode`,responseAlgorithms:[`CRC64NVME`,`CRC32`,`CRC32C`,`SHA256`,`SHA1`,`SHA512`,`MD5`,`XXHASH64`,`XXHASH3`,`XXHASH128`]}),M.getSsecPlugin(n),s.getS3ExpiresMiddlewarePlugin(n)]}).s(`AmazonS3`,`GetObject`,{}).n(`S3Client`,`GetObjectCommand`).sc(x.GetObject$).build(){},rt=class extends y.Command.classBuilder().ep({...B,Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`GetObjectLegalHold`,{}).n(`S3Client`,`GetObjectLegalHoldCommand`).sc(x.GetObjectLegalHold$).build(){},it=class extends y.Command.classBuilder().ep({...B,Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`GetObjectLockConfiguration`,{}).n(`S3Client`,`GetObjectLockConfigurationCommand`).sc(x.GetObjectLockConfiguration$).build(){},at=class extends y.Command.classBuilder().ep({...B,Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`GetObjectRetention`,{}).n(`S3Client`,`GetObjectRetentionCommand`).sc(x.GetObjectRetention$).build(){},ot=class extends y.Command.classBuilder().ep({...B,Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`GetObjectTagging`,{}).n(`S3Client`,`GetObjectTaggingCommand`).sc(x.GetObjectTagging$).build(){},st=class extends y.Command.classBuilder().ep({...B,Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions())]}).s(`AmazonS3`,`GetObjectTorrent`,{}).n(`S3Client`,`GetObjectTorrentCommand`).sc(x.GetObjectTorrent$).build(){},ct=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`GetPublicAccessBlock`,{}).n(`S3Client`,`GetPublicAccessBlockCommand`).sc(x.GetPublicAccessBlock$).build(){},lt=class extends y.Command.classBuilder().ep({...B,Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`HeadBucket`,{}).n(`S3Client`,`HeadBucketCommand`).sc(x.HeadBucket$).build(){},ut=class extends y.Command.classBuilder().ep({...B,Bucket:{type:`contextParams`,name:`Bucket`},Key:{type:`contextParams`,name:`Key`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n),M.getSsecPlugin(n),s.getS3ExpiresMiddlewarePlugin(n)]}).s(`AmazonS3`,`HeadObject`,{}).n(`S3Client`,`HeadObjectCommand`).sc(x.HeadObject$).build(){},dt=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`ListBucketAnalyticsConfigurations`,{}).n(`S3Client`,`ListBucketAnalyticsConfigurationsCommand`).sc(x.ListBucketAnalyticsConfigurations$).build(){},ft=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`ListBucketIntelligentTieringConfigurations`,{}).n(`S3Client`,`ListBucketIntelligentTieringConfigurationsCommand`).sc(x.ListBucketIntelligentTieringConfigurations$).build(){},pt=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`ListBucketInventoryConfigurations`,{}).n(`S3Client`,`ListBucketInventoryConfigurationsCommand`).sc(x.ListBucketInventoryConfigurations$).build(){},mt=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`ListBucketMetricsConfigurations`,{}).n(`S3Client`,`ListBucketMetricsConfigurationsCommand`).sc(x.ListBucketMetricsConfigurations$).build(){},ht=class extends y.Command.classBuilder().ep(B).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`ListBuckets`,{}).n(`S3Client`,`ListBucketsCommand`).sc(x.ListBuckets$).build(){},gt=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`ListDirectoryBuckets`,{}).n(`S3Client`,`ListDirectoryBucketsCommand`).sc(x.ListDirectoryBuckets$).build(){},_t=class extends y.Command.classBuilder().ep({...B,Bucket:{type:`contextParams`,name:`Bucket`},Prefix:{type:`contextParams`,name:`Prefix`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`ListMultipartUploads`,{}).n(`S3Client`,`ListMultipartUploadsCommand`).sc(x.ListMultipartUploads$).build(){},vt=class extends y.Command.classBuilder().ep({...B,Bucket:{type:`contextParams`,name:`Bucket`},Prefix:{type:`contextParams`,name:`Prefix`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`ListObjects`,{}).n(`S3Client`,`ListObjectsCommand`).sc(x.ListObjects$).build(){},yt=class extends y.Command.classBuilder().ep({...B,Bucket:{type:`contextParams`,name:`Bucket`},Prefix:{type:`contextParams`,name:`Prefix`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`ListObjectsV2`,{}).n(`S3Client`,`ListObjectsV2Command`).sc(x.ListObjectsV2$).build(){},bt=class extends y.Command.classBuilder().ep({...B,Bucket:{type:`contextParams`,name:`Bucket`},Prefix:{type:`contextParams`,name:`Prefix`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`ListObjectVersions`,{}).n(`S3Client`,`ListObjectVersionsCommand`).sc(x.ListObjectVersions$).build(){},xt=class extends y.Command.classBuilder().ep({...B,Bucket:{type:`contextParams`,name:`Bucket`},Key:{type:`contextParams`,name:`Key`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n),M.getSsecPlugin(n)]}).s(`AmazonS3`,`ListParts`,{}).n(`S3Client`,`ListPartsCommand`).sc(x.ListParts$).build(){},St=class extends y.Command.classBuilder().ep({...B,Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,i){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),r.getFlexibleChecksumsPlugin(n,{requestAlgorithmMember:{httpHeader:`x-amz-sdk-checksum-algorithm`,name:`ChecksumAlgorithm`},requestChecksumRequired:!1})]}).s(`AmazonS3`,`PutBucketAbac`,{}).n(`S3Client`,`PutBucketAbacCommand`).sc(x.PutBucketAbac$).build(){},Ct=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,i){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),r.getFlexibleChecksumsPlugin(n,{requestAlgorithmMember:{httpHeader:`x-amz-sdk-checksum-algorithm`,name:`ChecksumAlgorithm`},requestChecksumRequired:!1})]}).s(`AmazonS3`,`PutBucketAccelerateConfiguration`,{}).n(`S3Client`,`PutBucketAccelerateConfigurationCommand`).sc(x.PutBucketAccelerateConfiguration$).build(){},wt=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,i){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),r.getFlexibleChecksumsPlugin(n,{requestAlgorithmMember:{httpHeader:`x-amz-sdk-checksum-algorithm`,name:`ChecksumAlgorithm`},requestChecksumRequired:!0})]}).s(`AmazonS3`,`PutBucketAcl`,{}).n(`S3Client`,`PutBucketAclCommand`).sc(x.PutBucketAcl$).build(){},Tt=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions())]}).s(`AmazonS3`,`PutBucketAnalyticsConfiguration`,{}).n(`S3Client`,`PutBucketAnalyticsConfigurationCommand`).sc(x.PutBucketAnalyticsConfiguration$).build(){},Et=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,i){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),r.getFlexibleChecksumsPlugin(n,{requestAlgorithmMember:{httpHeader:`x-amz-sdk-checksum-algorithm`,name:`ChecksumAlgorithm`},requestChecksumRequired:!0})]}).s(`AmazonS3`,`PutBucketCors`,{}).n(`S3Client`,`PutBucketCorsCommand`).sc(x.PutBucketCors$).build(){},Dt=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,i){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),r.getFlexibleChecksumsPlugin(n,{requestAlgorithmMember:{httpHeader:`x-amz-sdk-checksum-algorithm`,name:`ChecksumAlgorithm`},requestChecksumRequired:!0})]}).s(`AmazonS3`,`PutBucketEncryption`,{}).n(`S3Client`,`PutBucketEncryptionCommand`).sc(x.PutBucketEncryption$).build(){},Ot=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions())]}).s(`AmazonS3`,`PutBucketIntelligentTieringConfiguration`,{}).n(`S3Client`,`PutBucketIntelligentTieringConfigurationCommand`).sc(x.PutBucketIntelligentTieringConfiguration$).build(){},kt=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions())]}).s(`AmazonS3`,`PutBucketInventoryConfiguration`,{}).n(`S3Client`,`PutBucketInventoryConfigurationCommand`).sc(x.PutBucketInventoryConfiguration$).build(){},At=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,i){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),r.getFlexibleChecksumsPlugin(n,{requestAlgorithmMember:{httpHeader:`x-amz-sdk-checksum-algorithm`,name:`ChecksumAlgorithm`},requestChecksumRequired:!0}),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`PutBucketLifecycleConfiguration`,{}).n(`S3Client`,`PutBucketLifecycleConfigurationCommand`).sc(x.PutBucketLifecycleConfiguration$).build(){},jt=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,i){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),r.getFlexibleChecksumsPlugin(n,{requestAlgorithmMember:{httpHeader:`x-amz-sdk-checksum-algorithm`,name:`ChecksumAlgorithm`},requestChecksumRequired:!0})]}).s(`AmazonS3`,`PutBucketLogging`,{}).n(`S3Client`,`PutBucketLoggingCommand`).sc(x.PutBucketLogging$).build(){},Mt=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions())]}).s(`AmazonS3`,`PutBucketMetricsConfiguration`,{}).n(`S3Client`,`PutBucketMetricsConfigurationCommand`).sc(x.PutBucketMetricsConfiguration$).build(){},Nt=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions())]}).s(`AmazonS3`,`PutBucketNotificationConfiguration`,{}).n(`S3Client`,`PutBucketNotificationConfigurationCommand`).sc(x.PutBucketNotificationConfiguration$).build(){},Pt=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,i){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),r.getFlexibleChecksumsPlugin(n,{requestAlgorithmMember:{httpHeader:`x-amz-sdk-checksum-algorithm`,name:`ChecksumAlgorithm`},requestChecksumRequired:!0})]}).s(`AmazonS3`,`PutBucketOwnershipControls`,{}).n(`S3Client`,`PutBucketOwnershipControlsCommand`).sc(x.PutBucketOwnershipControls$).build(){},Ft=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,i){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),r.getFlexibleChecksumsPlugin(n,{requestAlgorithmMember:{httpHeader:`x-amz-sdk-checksum-algorithm`,name:`ChecksumAlgorithm`},requestChecksumRequired:!0})]}).s(`AmazonS3`,`PutBucketPolicy`,{}).n(`S3Client`,`PutBucketPolicyCommand`).sc(x.PutBucketPolicy$).build(){},It=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,i){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),r.getFlexibleChecksumsPlugin(n,{requestAlgorithmMember:{httpHeader:`x-amz-sdk-checksum-algorithm`,name:`ChecksumAlgorithm`},requestChecksumRequired:!0})]}).s(`AmazonS3`,`PutBucketReplication`,{}).n(`S3Client`,`PutBucketReplicationCommand`).sc(x.PutBucketReplication$).build(){},Lt=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,i){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),r.getFlexibleChecksumsPlugin(n,{requestAlgorithmMember:{httpHeader:`x-amz-sdk-checksum-algorithm`,name:`ChecksumAlgorithm`},requestChecksumRequired:!0})]}).s(`AmazonS3`,`PutBucketRequestPayment`,{}).n(`S3Client`,`PutBucketRequestPaymentCommand`).sc(x.PutBucketRequestPayment$).build(){},Rt=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,i){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),r.getFlexibleChecksumsPlugin(n,{requestAlgorithmMember:{httpHeader:`x-amz-sdk-checksum-algorithm`,name:`ChecksumAlgorithm`},requestChecksumRequired:!0})]}).s(`AmazonS3`,`PutBucketTagging`,{}).n(`S3Client`,`PutBucketTaggingCommand`).sc(x.PutBucketTagging$).build(){},zt=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,i){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),r.getFlexibleChecksumsPlugin(n,{requestAlgorithmMember:{httpHeader:`x-amz-sdk-checksum-algorithm`,name:`ChecksumAlgorithm`},requestChecksumRequired:!0})]}).s(`AmazonS3`,`PutBucketVersioning`,{}).n(`S3Client`,`PutBucketVersioningCommand`).sc(x.PutBucketVersioning$).build(){},Bt=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,i){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),r.getFlexibleChecksumsPlugin(n,{requestAlgorithmMember:{httpHeader:`x-amz-sdk-checksum-algorithm`,name:`ChecksumAlgorithm`},requestChecksumRequired:!0})]}).s(`AmazonS3`,`PutBucketWebsite`,{}).n(`S3Client`,`PutBucketWebsiteCommand`).sc(x.PutBucketWebsite$).build(){},Vt=class extends y.Command.classBuilder().ep({...B,Bucket:{type:`contextParams`,name:`Bucket`},Key:{type:`contextParams`,name:`Key`}}).m(function(e,t,n,i){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),r.getFlexibleChecksumsPlugin(n,{requestAlgorithmMember:{httpHeader:`x-amz-sdk-checksum-algorithm`,name:`ChecksumAlgorithm`},requestChecksumRequired:!0}),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`PutObjectAcl`,{}).n(`S3Client`,`PutObjectAclCommand`).sc(x.PutObjectAcl$).build(){},Ht=class extends y.Command.classBuilder().ep({...B,Bucket:{type:`contextParams`,name:`Bucket`},Key:{type:`contextParams`,name:`Key`}}).m(function(e,t,n,i){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),r.getFlexibleChecksumsPlugin(n,{requestAlgorithmMember:{httpHeader:`x-amz-sdk-checksum-algorithm`,name:`ChecksumAlgorithm`},requestChecksumRequired:!1}),s.getCheckContentLengthHeaderPlugin(n),s.getThrow200ExceptionsPlugin(n),M.getSsecPlugin(n)]}).s(`AmazonS3`,`PutObject`,{}).n(`S3Client`,`PutObjectCommand`).sc(x.PutObject$).build(){},Ut=class extends y.Command.classBuilder().ep({...B,Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,i){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),r.getFlexibleChecksumsPlugin(n,{requestAlgorithmMember:{httpHeader:`x-amz-sdk-checksum-algorithm`,name:`ChecksumAlgorithm`},requestChecksumRequired:!0}),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`PutObjectLegalHold`,{}).n(`S3Client`,`PutObjectLegalHoldCommand`).sc(x.PutObjectLegalHold$).build(){},Wt=class extends y.Command.classBuilder().ep({...B,Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,i){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),r.getFlexibleChecksumsPlugin(n,{requestAlgorithmMember:{httpHeader:`x-amz-sdk-checksum-algorithm`,name:`ChecksumAlgorithm`},requestChecksumRequired:!0}),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`PutObjectLockConfiguration`,{}).n(`S3Client`,`PutObjectLockConfigurationCommand`).sc(x.PutObjectLockConfiguration$).build(){},Gt=class extends y.Command.classBuilder().ep({...B,Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,i){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),r.getFlexibleChecksumsPlugin(n,{requestAlgorithmMember:{httpHeader:`x-amz-sdk-checksum-algorithm`,name:`ChecksumAlgorithm`},requestChecksumRequired:!0}),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`PutObjectRetention`,{}).n(`S3Client`,`PutObjectRetentionCommand`).sc(x.PutObjectRetention$).build(){},Kt=class extends y.Command.classBuilder().ep({...B,Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,i){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),r.getFlexibleChecksumsPlugin(n,{requestAlgorithmMember:{httpHeader:`x-amz-sdk-checksum-algorithm`,name:`ChecksumAlgorithm`},requestChecksumRequired:!0}),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`PutObjectTagging`,{}).n(`S3Client`,`PutObjectTaggingCommand`).sc(x.PutObjectTagging$).build(){},qt=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,i){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),r.getFlexibleChecksumsPlugin(n,{requestAlgorithmMember:{httpHeader:`x-amz-sdk-checksum-algorithm`,name:`ChecksumAlgorithm`},requestChecksumRequired:!0})]}).s(`AmazonS3`,`PutPublicAccessBlock`,{}).n(`S3Client`,`PutPublicAccessBlockCommand`).sc(x.PutPublicAccessBlock$).build(){},Jt=class extends y.Command.classBuilder().ep({...B,Bucket:{type:`contextParams`,name:`Bucket`},Key:{type:`contextParams`,name:`Key`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`RenameObject`,{}).n(`S3Client`,`RenameObjectCommand`).sc(x.RenameObject$).build(){},Yt=class extends y.Command.classBuilder().ep({...B,Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,i){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),r.getFlexibleChecksumsPlugin(n,{requestAlgorithmMember:{httpHeader:`x-amz-sdk-checksum-algorithm`,name:`ChecksumAlgorithm`},requestChecksumRequired:!1}),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`RestoreObject`,{}).n(`S3Client`,`RestoreObjectCommand`).sc(x.RestoreObject$).build(){},Xt=class extends y.Command.classBuilder().ep({...B,Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),M.getSsecPlugin(n)]}).s(`AmazonS3`,`SelectObjectContent`,{eventStream:{output:!0}}).n(`S3Client`,`SelectObjectContentCommand`).sc(x.SelectObjectContent$).build(){},Zt=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,i){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),r.getFlexibleChecksumsPlugin(n,{requestAlgorithmMember:{httpHeader:`x-amz-sdk-checksum-algorithm`,name:`ChecksumAlgorithm`},requestChecksumRequired:!0})]}).s(`AmazonS3`,`UpdateBucketMetadataInventoryTableConfiguration`,{}).n(`S3Client`,`UpdateBucketMetadataInventoryTableConfigurationCommand`).sc(x.UpdateBucketMetadataInventoryTableConfiguration$).build(){},Qt=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,i){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),r.getFlexibleChecksumsPlugin(n,{requestAlgorithmMember:{httpHeader:`x-amz-sdk-checksum-algorithm`,name:`ChecksumAlgorithm`},requestChecksumRequired:!0})]}).s(`AmazonS3`,`UpdateBucketMetadataJournalTableConfiguration`,{}).n(`S3Client`,`UpdateBucketMetadataJournalTableConfigurationCommand`).sc(x.UpdateBucketMetadataJournalTableConfiguration$).build(){},$t=class extends y.Command.classBuilder().ep({...B,Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,i){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),r.getFlexibleChecksumsPlugin(n,{requestAlgorithmMember:{httpHeader:`x-amz-sdk-checksum-algorithm`,name:`ChecksumAlgorithm`},requestChecksumRequired:!0}),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`UpdateObjectEncryption`,{}).n(`S3Client`,`UpdateObjectEncryptionCommand`).sc(x.UpdateObjectEncryption$).build(){},en=class extends y.Command.classBuilder().ep({...B,Bucket:{type:`contextParams`,name:`Bucket`},Key:{type:`contextParams`,name:`Key`}}).m(function(e,t,n,i){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),r.getFlexibleChecksumsPlugin(n,{requestAlgorithmMember:{httpHeader:`x-amz-sdk-checksum-algorithm`,name:`ChecksumAlgorithm`},requestChecksumRequired:!1}),s.getThrow200ExceptionsPlugin(n),M.getSsecPlugin(n)]}).s(`AmazonS3`,`UploadPart`,{}).n(`S3Client`,`UploadPartCommand`).sc(x.UploadPart$).build(){},tn=class extends y.Command.classBuilder().ep({...B,DisableS3ExpressSessionAuth:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n),M.getSsecPlugin(n)]}).s(`AmazonS3`,`UploadPartCopy`,{}).n(`S3Client`,`UploadPartCopyCommand`).sc(x.UploadPartCopy$).build(){},nn=class extends y.Command.classBuilder().ep({...B,UseObjectLambdaEndpoint:{type:`staticContextParams`,value:!0}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions())]}).s(`AmazonS3`,`WriteGetObjectResponse`,{}).n(`S3Client`,`WriteGetObjectResponseCommand`).sc(x.WriteGetObjectResponse$).build(){};let rn=d.createPaginator(se,ht,`ContinuationToken`,`ContinuationToken`,`MaxBuckets`),an=d.createPaginator(se,gt,`ContinuationToken`,`ContinuationToken`,`MaxDirectoryBuckets`),on=d.createPaginator(se,yt,`ContinuationToken`,`NextContinuationToken`,`MaxKeys`),sn=d.createPaginator(se,xt,`PartNumberMarker`,`NextPartNumberMarker`,`MaxParts`),cn=async(e,t)=>{let n;try{return n=await e.send(new lt(t)),{state:L.WaiterState.SUCCESS,reason:n}}catch(e){if(n=e,e.name===`NotFound`)return{state:L.WaiterState.RETRY,reason:n}}return{state:L.WaiterState.RETRY,reason:n}},ln=async(e,t)=>L.createWaiter({minDelay:5,maxDelay:120,...e},t,cn),un=async(e,t)=>{let n=await L.createWaiter({minDelay:5,maxDelay:120,...e},t,cn);return L.checkExceptions(n)},dn=async(e,t)=>{let n;try{n=await e.send(new lt(t))}catch(e){if(n=e,e.name===`NotFound`)return{state:L.WaiterState.SUCCESS,reason:n}}return{state:L.WaiterState.RETRY,reason:n}},fn=async(e,t)=>L.createWaiter({minDelay:5,maxDelay:120,...e},t,dn),pn=async(e,t)=>{let n=await L.createWaiter({minDelay:5,maxDelay:120,...e},t,dn);return L.checkExceptions(n)},mn=async(e,t)=>{let n;try{return n=await e.send(new ut(t)),{state:L.WaiterState.SUCCESS,reason:n}}catch(e){if(n=e,e.name===`NotFound`)return{state:L.WaiterState.RETRY,reason:n}}return{state:L.WaiterState.RETRY,reason:n}},hn=async(e,t)=>L.createWaiter({minDelay:5,maxDelay:120,...e},t,mn),gn=async(e,t)=>{let n=await L.createWaiter({minDelay:5,maxDelay:120,...e},t,mn);return L.checkExceptions(n)},_n=async(e,t)=>{let n;try{n=await e.send(new ut(t))}catch(e){if(n=e,e.name===`NotFound`)return{state:L.WaiterState.SUCCESS,reason:n}}return{state:L.WaiterState.RETRY,reason:n}},vn=async(e,t)=>L.createWaiter({minDelay:5,maxDelay:120,...e},t,_n),yn=async(e,t)=>{let n=await L.createWaiter({minDelay:5,maxDelay:120,...e},t,_n);return L.checkExceptions(n)},bn={AbortMultipartUploadCommand:ce,CompleteMultipartUploadCommand:le,CopyObjectCommand:ue,CreateBucketCommand:de,CreateBucketMetadataConfigurationCommand:fe,CreateBucketMetadataTableConfigurationCommand:pe,CreateMultipartUploadCommand:me,CreateSessionCommand:ie,DeleteBucketCommand:ge,DeleteBucketAnalyticsConfigurationCommand:he,DeleteBucketCorsCommand:_e,DeleteBucketEncryptionCommand:ve,DeleteBucketIntelligentTieringConfigurationCommand:ye,DeleteBucketInventoryConfigurationCommand:be,DeleteBucketLifecycleCommand:U,DeleteBucketMetadataConfigurationCommand:xe,DeleteBucketMetadataTableConfigurationCommand:Se,DeleteBucketMetricsConfigurationCommand:Ce,DeleteBucketOwnershipControlsCommand:we,DeleteBucketPolicyCommand:Te,DeleteBucketReplicationCommand:Ee,DeleteBucketTaggingCommand:De,DeleteBucketWebsiteCommand:Oe,DeleteObjectCommand:ke,DeleteObjectsCommand:Ae,DeleteObjectTaggingCommand:je,DeletePublicAccessBlockCommand:W,GetBucketAbacCommand:Me,GetBucketAccelerateConfigurationCommand:Ne,GetBucketAclCommand:Pe,GetBucketAnalyticsConfigurationCommand:Fe,GetBucketCorsCommand:Ie,GetBucketEncryptionCommand:Le,GetBucketIntelligentTieringConfigurationCommand:Re,GetBucketInventoryConfigurationCommand:ze,GetBucketLifecycleConfigurationCommand:Be,GetBucketLocationCommand:Ve,GetBucketLoggingCommand:He,GetBucketMetadataConfigurationCommand:Ue,GetBucketMetadataTableConfigurationCommand:We,GetBucketMetricsConfigurationCommand:Ge,GetBucketNotificationConfigurationCommand:Ke,GetBucketOwnershipControlsCommand:qe,GetBucketPolicyCommand:Je,GetBucketPolicyStatusCommand:Ye,GetBucketReplicationCommand:Xe,GetBucketRequestPaymentCommand:Ze,GetBucketTaggingCommand:Qe,GetBucketVersioningCommand:$e,GetBucketWebsiteCommand:G,GetObjectCommand:nt,GetObjectAclCommand:et,GetObjectAttributesCommand:tt,GetObjectLegalHoldCommand:rt,GetObjectLockConfigurationCommand:it,GetObjectRetentionCommand:at,GetObjectTaggingCommand:ot,GetObjectTorrentCommand:st,GetPublicAccessBlockCommand:ct,HeadBucketCommand:lt,HeadObjectCommand:ut,ListBucketAnalyticsConfigurationsCommand:dt,ListBucketIntelligentTieringConfigurationsCommand:ft,ListBucketInventoryConfigurationsCommand:pt,ListBucketMetricsConfigurationsCommand:mt,ListBucketsCommand:ht,ListDirectoryBucketsCommand:gt,ListMultipartUploadsCommand:_t,ListObjectsCommand:vt,ListObjectsV2Command:yt,ListObjectVersionsCommand:bt,ListPartsCommand:xt,PutBucketAbacCommand:St,PutBucketAccelerateConfigurationCommand:Ct,PutBucketAclCommand:wt,PutBucketAnalyticsConfigurationCommand:Tt,PutBucketCorsCommand:Et,PutBucketEncryptionCommand:Dt,PutBucketIntelligentTieringConfigurationCommand:Ot,PutBucketInventoryConfigurationCommand:kt,PutBucketLifecycleConfigurationCommand:At,PutBucketLoggingCommand:jt,PutBucketMetricsConfigurationCommand:Mt,PutBucketNotificationConfigurationCommand:Nt,PutBucketOwnershipControlsCommand:Pt,PutBucketPolicyCommand:Ft,PutBucketReplicationCommand:It,PutBucketRequestPaymentCommand:Lt,PutBucketTaggingCommand:Rt,PutBucketVersioningCommand:zt,PutBucketWebsiteCommand:Bt,PutObjectCommand:Ht,PutObjectAclCommand:Vt,PutObjectLegalHoldCommand:Ut,PutObjectLockConfigurationCommand:Wt,PutObjectRetentionCommand:Gt,PutObjectTaggingCommand:Kt,PutPublicAccessBlockCommand:qt,RenameObjectCommand:Jt,RestoreObjectCommand:Yt,SelectObjectContentCommand:Xt,UpdateBucketMetadataInventoryTableConfigurationCommand:Zt,UpdateBucketMetadataJournalTableConfigurationCommand:Qt,UpdateObjectEncryptionCommand:$t,UploadPartCommand:en,UploadPartCopyCommand:tn,WriteGetObjectResponseCommand:nn},xn={paginateListBuckets:rn,paginateListDirectoryBuckets:an,paginateListObjectsV2:on,paginateListParts:sn},Sn={waitUntilBucketExists:un,waitUntilBucketNotExists:pn,waitUntilObjectExists:gn,waitUntilObjectNotExists:yn};var Cn=class extends se{};y.createAggregatedClient(bn,Cn,{paginators:xn,waiters:Sn}),t.$Command=y.Command,t.__Client=y.Client,t.S3ServiceException=z.S3ServiceException,t.AbortMultipartUploadCommand=ce,t.AnalyticsS3ExportFileFormat={CSV:`CSV`},t.ArchiveStatus={ARCHIVE_ACCESS:`ARCHIVE_ACCESS`,DEEP_ARCHIVE_ACCESS:`DEEP_ARCHIVE_ACCESS`},t.BucketAbacStatus={Disabled:`Disabled`,Enabled:`Enabled`},t.BucketAccelerateStatus={Enabled:`Enabled`,Suspended:`Suspended`},t.BucketCannedACL={authenticated_read:`authenticated-read`,private:`private`,public_read:`public-read`,public_read_write:`public-read-write`},t.BucketLocationConstraint={EU:`EU`,af_south_1:`af-south-1`,ap_east_1:`ap-east-1`,ap_east_2:`ap-east-2`,ap_northeast_1:`ap-northeast-1`,ap_northeast_2:`ap-northeast-2`,ap_northeast_3:`ap-northeast-3`,ap_south_1:`ap-south-1`,ap_south_2:`ap-south-2`,ap_southeast_1:`ap-southeast-1`,ap_southeast_2:`ap-southeast-2`,ap_southeast_3:`ap-southeast-3`,ap_southeast_4:`ap-southeast-4`,ap_southeast_5:`ap-southeast-5`,ap_southeast_6:`ap-southeast-6`,ap_southeast_7:`ap-southeast-7`,ca_central_1:`ca-central-1`,ca_west_1:`ca-west-1`,cn_north_1:`cn-north-1`,cn_northwest_1:`cn-northwest-1`,eu_central_1:`eu-central-1`,eu_central_2:`eu-central-2`,eu_north_1:`eu-north-1`,eu_south_1:`eu-south-1`,eu_south_2:`eu-south-2`,eu_west_1:`eu-west-1`,eu_west_2:`eu-west-2`,eu_west_3:`eu-west-3`,il_central_1:`il-central-1`,me_central_1:`me-central-1`,me_south_1:`me-south-1`,mx_central_1:`mx-central-1`,sa_east_1:`sa-east-1`,us_east_2:`us-east-2`,us_gov_east_1:`us-gov-east-1`,us_gov_west_1:`us-gov-west-1`,us_west_1:`us-west-1`,us_west_2:`us-west-2`},t.BucketLogsPermission={FULL_CONTROL:`FULL_CONTROL`,READ:`READ`,WRITE:`WRITE`},t.BucketNamespace={ACCOUNT_REGIONAL:`account-regional`,GLOBAL:`global`},t.BucketType={Directory:`Directory`},t.BucketVersioningStatus={Enabled:`Enabled`,Suspended:`Suspended`},t.ChecksumAlgorithm={CRC32:`CRC32`,CRC32C:`CRC32C`,CRC64NVME:`CRC64NVME`,MD5:`MD5`,SHA1:`SHA1`,SHA256:`SHA256`,SHA512:`SHA512`,XXHASH128:`XXHASH128`,XXHASH3:`XXHASH3`,XXHASH64:`XXHASH64`},t.ChecksumMode={ENABLED:`ENABLED`},t.ChecksumType={COMPOSITE:`COMPOSITE`,FULL_OBJECT:`FULL_OBJECT`},t.CompleteMultipartUploadCommand=le,t.CompressionType={BZIP2:`BZIP2`,GZIP:`GZIP`,NONE:`NONE`},t.CopyObjectCommand=ue,t.CreateBucketCommand=de,t.CreateBucketMetadataConfigurationCommand=fe,t.CreateBucketMetadataTableConfigurationCommand=pe,t.CreateMultipartUploadCommand=me,t.CreateSessionCommand=ie,t.DataRedundancy={SingleAvailabilityZone:`SingleAvailabilityZone`,SingleLocalZone:`SingleLocalZone`},t.DeleteBucketAnalyticsConfigurationCommand=he,t.DeleteBucketCommand=ge,t.DeleteBucketCorsCommand=_e,t.DeleteBucketEncryptionCommand=ve,t.DeleteBucketIntelligentTieringConfigurationCommand=ye,t.DeleteBucketInventoryConfigurationCommand=be,t.DeleteBucketLifecycleCommand=U,t.DeleteBucketMetadataConfigurationCommand=xe,t.DeleteBucketMetadataTableConfigurationCommand=Se,t.DeleteBucketMetricsConfigurationCommand=Ce,t.DeleteBucketOwnershipControlsCommand=we,t.DeleteBucketPolicyCommand=Te,t.DeleteBucketReplicationCommand=Ee,t.DeleteBucketTaggingCommand=De,t.DeleteBucketWebsiteCommand=Oe,t.DeleteMarkerReplicationStatus={Disabled:`Disabled`,Enabled:`Enabled`},t.DeleteObjectCommand=ke,t.DeleteObjectTaggingCommand=je,t.DeleteObjectsCommand=Ae,t.DeletePublicAccessBlockCommand=W,t.EncodingType={url:`url`},t.EncryptionType={NONE:`NONE`,SSE_C:`SSE-C`},t.Event={s3_IntelligentTiering:`s3:IntelligentTiering`,s3_LifecycleExpiration_:`s3:LifecycleExpiration:*`,s3_LifecycleExpiration_Delete:`s3:LifecycleExpiration:Delete`,s3_LifecycleExpiration_DeleteMarkerCreated:`s3:LifecycleExpiration:DeleteMarkerCreated`,s3_LifecycleTransition:`s3:LifecycleTransition`,s3_ObjectAcl_Put:`s3:ObjectAcl:Put`,s3_ObjectCreated_:`s3:ObjectCreated:*`,s3_ObjectCreated_CompleteMultipartUpload:`s3:ObjectCreated:CompleteMultipartUpload`,s3_ObjectCreated_Copy:`s3:ObjectCreated:Copy`,s3_ObjectCreated_Post:`s3:ObjectCreated:Post`,s3_ObjectCreated_Put:`s3:ObjectCreated:Put`,s3_ObjectRemoved_:`s3:ObjectRemoved:*`,s3_ObjectRemoved_Delete:`s3:ObjectRemoved:Delete`,s3_ObjectRemoved_DeleteMarkerCreated:`s3:ObjectRemoved:DeleteMarkerCreated`,s3_ObjectRestore_:`s3:ObjectRestore:*`,s3_ObjectRestore_Completed:`s3:ObjectRestore:Completed`,s3_ObjectRestore_Delete:`s3:ObjectRestore:Delete`,s3_ObjectRestore_Post:`s3:ObjectRestore:Post`,s3_ObjectTagging_:`s3:ObjectTagging:*`,s3_ObjectTagging_Delete:`s3:ObjectTagging:Delete`,s3_ObjectTagging_Put:`s3:ObjectTagging:Put`,s3_ReducedRedundancyLostObject:`s3:ReducedRedundancyLostObject`,s3_Replication_:`s3:Replication:*`,s3_Replication_OperationFailedReplication:`s3:Replication:OperationFailedReplication`,s3_Replication_OperationMissedThreshold:`s3:Replication:OperationMissedThreshold`,s3_Replication_OperationNotTracked:`s3:Replication:OperationNotTracked`,s3_Replication_OperationReplicatedAfterThreshold:`s3:Replication:OperationReplicatedAfterThreshold`},t.ExistingObjectReplicationStatus={Disabled:`Disabled`,Enabled:`Enabled`},t.ExpirationState={DISABLED:`DISABLED`,ENABLED:`ENABLED`},t.ExpirationStatus={Disabled:`Disabled`,Enabled:`Enabled`},t.ExpressionType={SQL:`SQL`},t.FileHeaderInfo={IGNORE:`IGNORE`,NONE:`NONE`,USE:`USE`},t.FilterRuleName={prefix:`prefix`,suffix:`suffix`},t.GetBucketAbacCommand=Me,t.GetBucketAccelerateConfigurationCommand=Ne,t.GetBucketAclCommand=Pe,t.GetBucketAnalyticsConfigurationCommand=Fe,t.GetBucketCorsCommand=Ie,t.GetBucketEncryptionCommand=Le,t.GetBucketIntelligentTieringConfigurationCommand=Re,t.GetBucketInventoryConfigurationCommand=ze,t.GetBucketLifecycleConfigurationCommand=Be,t.GetBucketLocationCommand=Ve,t.GetBucketLoggingCommand=He,t.GetBucketMetadataConfigurationCommand=Ue,t.GetBucketMetadataTableConfigurationCommand=We,t.GetBucketMetricsConfigurationCommand=Ge,t.GetBucketNotificationConfigurationCommand=Ke,t.GetBucketOwnershipControlsCommand=qe,t.GetBucketPolicyCommand=Je,t.GetBucketPolicyStatusCommand=Ye,t.GetBucketReplicationCommand=Xe,t.GetBucketRequestPaymentCommand=Ze,t.GetBucketTaggingCommand=Qe,t.GetBucketVersioningCommand=$e,t.GetBucketWebsiteCommand=G,t.GetObjectAclCommand=et,t.GetObjectAttributesCommand=tt,t.GetObjectCommand=nt,t.GetObjectLegalHoldCommand=rt,t.GetObjectLockConfigurationCommand=it,t.GetObjectRetentionCommand=at,t.GetObjectTaggingCommand=ot,t.GetObjectTorrentCommand=st,t.GetPublicAccessBlockCommand=ct,t.HeadBucketCommand=lt,t.HeadObjectCommand=ut,t.IntelligentTieringAccessTier={ARCHIVE_ACCESS:`ARCHIVE_ACCESS`,DEEP_ARCHIVE_ACCESS:`DEEP_ARCHIVE_ACCESS`},t.IntelligentTieringStatus={Disabled:`Disabled`,Enabled:`Enabled`},t.InventoryConfigurationState={DISABLED:`DISABLED`,ENABLED:`ENABLED`},t.InventoryFormat={CSV:`CSV`,ORC:`ORC`,Parquet:`Parquet`},t.InventoryFrequency={Daily:`Daily`,Weekly:`Weekly`},t.InventoryIncludedObjectVersions={All:`All`,Current:`Current`},t.InventoryOptionalField={BucketKeyStatus:`BucketKeyStatus`,ChecksumAlgorithm:`ChecksumAlgorithm`,ETag:`ETag`,EncryptionStatus:`EncryptionStatus`,IntelligentTieringAccessTier:`IntelligentTieringAccessTier`,IsMultipartUploaded:`IsMultipartUploaded`,LastModifiedDate:`LastModifiedDate`,LifecycleExpirationDate:`LifecycleExpirationDate`,ObjectAccessControlList:`ObjectAccessControlList`,ObjectLockLegalHoldStatus:`ObjectLockLegalHoldStatus`,ObjectLockMode:`ObjectLockMode`,ObjectLockRetainUntilDate:`ObjectLockRetainUntilDate`,ObjectOwner:`ObjectOwner`,ReplicationStatus:`ReplicationStatus`,Size:`Size`,StorageClass:`StorageClass`},t.JSONType={DOCUMENT:`DOCUMENT`,LINES:`LINES`},t.ListBucketAnalyticsConfigurationsCommand=dt,t.ListBucketIntelligentTieringConfigurationsCommand=ft,t.ListBucketInventoryConfigurationsCommand=pt,t.ListBucketMetricsConfigurationsCommand=mt,t.ListBucketsCommand=ht,t.ListDirectoryBucketsCommand=gt,t.ListMultipartUploadsCommand=_t,t.ListObjectVersionsCommand=bt,t.ListObjectsCommand=vt,t.ListObjectsV2Command=yt,t.ListPartsCommand=xt,t.LocationType={AvailabilityZone:`AvailabilityZone`,LocalZone:`LocalZone`},t.MFADelete={Disabled:`Disabled`,Enabled:`Enabled`},t.MFADeleteStatus={Disabled:`Disabled`,Enabled:`Enabled`},t.MetadataDirective={COPY:`COPY`,REPLACE:`REPLACE`},t.MetricsStatus={Disabled:`Disabled`,Enabled:`Enabled`},t.ObjectAttributes={CHECKSUM:`Checksum`,ETAG:`ETag`,OBJECT_PARTS:`ObjectParts`,OBJECT_SIZE:`ObjectSize`,STORAGE_CLASS:`StorageClass`},t.ObjectCannedACL={authenticated_read:`authenticated-read`,aws_exec_read:`aws-exec-read`,bucket_owner_full_control:`bucket-owner-full-control`,bucket_owner_read:`bucket-owner-read`,private:`private`,public_read:`public-read`,public_read_write:`public-read-write`},t.ObjectLockEnabled={Enabled:`Enabled`},t.ObjectLockLegalHoldStatus={OFF:`OFF`,ON:`ON`},t.ObjectLockMode={COMPLIANCE:`COMPLIANCE`,GOVERNANCE:`GOVERNANCE`},t.ObjectLockRetentionMode={COMPLIANCE:`COMPLIANCE`,GOVERNANCE:`GOVERNANCE`},t.ObjectOwnership={BucketOwnerEnforced:`BucketOwnerEnforced`,BucketOwnerPreferred:`BucketOwnerPreferred`,ObjectWriter:`ObjectWriter`},t.ObjectStorageClass={DEEP_ARCHIVE:`DEEP_ARCHIVE`,EXPRESS_ONEZONE:`EXPRESS_ONEZONE`,FSX_ONTAP:`FSX_ONTAP`,FSX_OPENZFS:`FSX_OPENZFS`,GLACIER:`GLACIER`,GLACIER_IR:`GLACIER_IR`,INTELLIGENT_TIERING:`INTELLIGENT_TIERING`,ONEZONE_IA:`ONEZONE_IA`,OUTPOSTS:`OUTPOSTS`,REDUCED_REDUNDANCY:`REDUCED_REDUNDANCY`,SNOW:`SNOW`,STANDARD:`STANDARD`,STANDARD_IA:`STANDARD_IA`},t.ObjectVersionStorageClass={STANDARD:`STANDARD`},t.OptionalObjectAttributes={RESTORE_STATUS:`RestoreStatus`},t.OwnerOverride={Destination:`Destination`},t.PartitionDateSource={DeliveryTime:`DeliveryTime`,EventTime:`EventTime`},t.Payer={BucketOwner:`BucketOwner`,Requester:`Requester`},t.Permission={FULL_CONTROL:`FULL_CONTROL`,READ:`READ`,READ_ACP:`READ_ACP`,WRITE:`WRITE`,WRITE_ACP:`WRITE_ACP`},t.Protocol={http:`http`,https:`https`},t.PutBucketAbacCommand=St,t.PutBucketAccelerateConfigurationCommand=Ct,t.PutBucketAclCommand=wt,t.PutBucketAnalyticsConfigurationCommand=Tt,t.PutBucketCorsCommand=Et,t.PutBucketEncryptionCommand=Dt,t.PutBucketIntelligentTieringConfigurationCommand=Ot,t.PutBucketInventoryConfigurationCommand=kt,t.PutBucketLifecycleConfigurationCommand=At,t.PutBucketLoggingCommand=jt,t.PutBucketMetricsConfigurationCommand=Mt,t.PutBucketNotificationConfigurationCommand=Nt,t.PutBucketOwnershipControlsCommand=Pt,t.PutBucketPolicyCommand=Ft,t.PutBucketReplicationCommand=It,t.PutBucketRequestPaymentCommand=Lt,t.PutBucketTaggingCommand=Rt,t.PutBucketVersioningCommand=zt,t.PutBucketWebsiteCommand=Bt,t.PutObjectAclCommand=Vt,t.PutObjectCommand=Ht,t.PutObjectLegalHoldCommand=Ut,t.PutObjectLockConfigurationCommand=Wt,t.PutObjectRetentionCommand=Gt,t.PutObjectTaggingCommand=Kt,t.PutPublicAccessBlockCommand=qt,t.QuoteFields={ALWAYS:`ALWAYS`,ASNEEDED:`ASNEEDED`},t.RenameObjectCommand=Jt,t.ReplicaModificationsStatus={Disabled:`Disabled`,Enabled:`Enabled`},t.ReplicationRuleStatus={Disabled:`Disabled`,Enabled:`Enabled`},t.ReplicationStatus={COMPLETE:`COMPLETE`,COMPLETED:`COMPLETED`,FAILED:`FAILED`,PENDING:`PENDING`,REPLICA:`REPLICA`},t.ReplicationTimeStatus={Disabled:`Disabled`,Enabled:`Enabled`},t.RequestCharged={requester:`requester`},t.RequestPayer={requester:`requester`},t.RestoreObjectCommand=Yt,t.RestoreRequestType={SELECT:`SELECT`},t.S3=Cn,t.S3Client=se,t.S3TablesBucketType={aws:`aws`,customer:`customer`},t.SelectObjectContentCommand=Xt,t.ServerSideEncryption={AES256:`AES256`,aws_fsx:`aws:fsx`,aws_kms:`aws:kms`,aws_kms_dsse:`aws:kms:dsse`},t.SessionMode={ReadOnly:`ReadOnly`,ReadWrite:`ReadWrite`},t.SseKmsEncryptedObjectsStatus={Disabled:`Disabled`,Enabled:`Enabled`},t.StorageClass={DEEP_ARCHIVE:`DEEP_ARCHIVE`,EXPRESS_ONEZONE:`EXPRESS_ONEZONE`,FSX_ONTAP:`FSX_ONTAP`,FSX_OPENZFS:`FSX_OPENZFS`,GLACIER:`GLACIER`,GLACIER_IR:`GLACIER_IR`,INTELLIGENT_TIERING:`INTELLIGENT_TIERING`,ONEZONE_IA:`ONEZONE_IA`,OUTPOSTS:`OUTPOSTS`,REDUCED_REDUNDANCY:`REDUCED_REDUNDANCY`,SNOW:`SNOW`,STANDARD:`STANDARD`,STANDARD_IA:`STANDARD_IA`},t.StorageClassAnalysisSchemaVersion={V_1:`V_1`},t.TableSseAlgorithm={AES256:`AES256`,aws_kms:`aws:kms`},t.TaggingDirective={COPY:`COPY`,REPLACE:`REPLACE`},t.Tier={Bulk:`Bulk`,Expedited:`Expedited`,Standard:`Standard`},t.TransitionDefaultMinimumObjectSize={all_storage_classes_128K:`all_storage_classes_128K`,varies_by_storage_class:`varies_by_storage_class`},t.TransitionStorageClass={DEEP_ARCHIVE:`DEEP_ARCHIVE`,GLACIER:`GLACIER`,GLACIER_IR:`GLACIER_IR`,INTELLIGENT_TIERING:`INTELLIGENT_TIERING`,ONEZONE_IA:`ONEZONE_IA`,STANDARD_IA:`STANDARD_IA`},t.Type={AmazonCustomerByEmail:`AmazonCustomerByEmail`,CanonicalUser:`CanonicalUser`,Group:`Group`},t.UpdateBucketMetadataInventoryTableConfigurationCommand=Zt,t.UpdateBucketMetadataJournalTableConfigurationCommand=Qt,t.UpdateObjectEncryptionCommand=$t,t.UploadPartCommand=en,t.UploadPartCopyCommand=tn,t.WriteGetObjectResponseCommand=nn,t.paginateListBuckets=rn,t.paginateListDirectoryBuckets=an,t.paginateListObjectsV2=on,t.paginateListParts=sn,t.waitForBucketExists=ln,t.waitForBucketNotExists=fn,t.waitForObjectExists=hn,t.waitForObjectNotExists=vn,t.waitUntilBucketExists=un,t.waitUntilBucketNotExists=pn,t.waitUntilObjectExists=gn,t.waitUntilObjectNotExists=yn,Object.prototype.hasOwnProperty.call(x,`__proto__`)&&!Object.prototype.hasOwnProperty.call(t,`__proto__`)&&Object.defineProperty(t,`__proto__`,{enumerable:!0,value:x.__proto__}),Object.keys(x).forEach(function(e){e!==`default`&&!Object.prototype.hasOwnProperty.call(t,e)&&(t[e]=x[e])}),Object.prototype.hasOwnProperty.call(R,`__proto__`)&&!Object.prototype.hasOwnProperty.call(t,`__proto__`)&&Object.defineProperty(t,`__proto__`,{enumerable:!0,value:R.__proto__}),Object.keys(R).forEach(function(e){e!==`default`&&!Object.prototype.hasOwnProperty.call(t,e)&&(t[e]=R[e])})}))();function Hs(e){return e.replaceAll(/X-Amz-[A-Za-z0-9-]+=[^&\s]+/g,`X-Amz-REDACTED=[REDACTED]`).replaceAll(/Authorization([:=]\s*)(Bearer\s+)?[^,\s]+/gi,`Authorization$1$2[REDACTED]`).slice(0,500)}function Us(e,t,n){let r=typeof n==`object`&&n&&`Code`in n?String(n.Code):void 0,i=n instanceof Error?n.name:`UnknownError`,a=typeof n==`object`&&n&&`$metadata`in n&&typeof n.$metadata==`object`&&n.$metadata!=null&&`httpStatusCode`in n.$metadata?Number(n.$metadata.httpStatusCode):void 0,o=Hs(n instanceof Error?n.message:String(n));return e.warning(`Object store ${t} failed`,{errorCode:r,errorName:i,httpStatusCode:a,message:o}),Io(`Object store ${t} failed: ${o}`)}async function Ws(e){if(e instanceof W){let t=[];for await(let n of e){if(typeof n==`string`){t.push(Pe.from(n));continue}t.push(Pe.isBuffer(n)?n:Pe.from(n))}return Pe.concat(t).toString(`utf8`)}if(typeof e==`object`&&e&&`transformToString`in e){let t=e.transformToString;if(typeof t==`function`)return String(await t.call(e))}throw Io(`Object store getObject failed: response body was not readable`)}function Gs(e,t){if(e==null||e.length===0)throw Io(`Object store ${t} failed: missing ETag in response`);return e}function Ks(e){return e.region.length>0?e.region:void 0}function qs(e){let t=Ks(e);return e.endpoint==null?new Vs.S3Client({maxAttempts:3,region:t}):new Vs.S3Client({endpoint:e.endpoint,forcePathStyle:!0,maxAttempts:3,region:t})}function Js(e){return e.sseEncryption==null?e.endpoint==null?`aws:kms`:`AES256`:e.sseEncryption}function Ys(e,t){let n=qs(e),r=Js(e);return{upload:async(i,a)=>{t.debug(`Uploading object store file`,{key:i,localPath:a});try{let o={Body:Je.createReadStream(a),Bucket:e.bucket,ExpectedBucketOwner:e.expectedBucketOwner,Key:i,ServerSideEncryption:r};r===`aws:kms`&&e.sseKmsKeyId!=null&&(o.SSEKMSKeyId=e.sseKmsKeyId);let s=new Vs.PutObjectCommand({...o});return await n.send(s),t.info(`Uploaded object store file`,{key:i}),Do(void 0)}catch(e){return Oo(Us(t,`upload`,e))}},download:async(r,i)=>{t.debug(`Downloading object store file`,{key:r,localPath:i});try{await Ue.mkdir(We.dirname(i),{recursive:!0});let a=await n.send(new Vs.GetObjectCommand({Bucket:e.bucket,ExpectedBucketOwner:e.expectedBucketOwner,Key:r}));return a.Body instanceof W?(await Xe(a.Body,Je.createWriteStream(i)),t.info(`Downloaded object store file`,{key:r,localPath:i}),Do(void 0)):Oo(Io(`Object store download failed: response body was not readable`))}catch(e){return Oo(Us(t,`download`,e))}},list:async r=>{t.debug(`Listing object store keys`,{prefix:r});try{let i=[],a,o=0;do{if(o>=100){t.warning(`Object store list hit iteration cap, truncating result`,{prefix:r,maxIterations:100,keysReturned:i.length});break}o++;let s=await n.send(new Vs.ListObjectsV2Command({Bucket:e.bucket,ContinuationToken:a,ExpectedBucketOwner:e.expectedBucketOwner,Prefix:r}));for(let e of s.Contents??[])e.Key!=null&&i.push(e.Key);a=s.IsTruncated===!0?s.NextContinuationToken:void 0}while(a!=null);return t.info(`Listed object store keys`,{count:i.length,prefix:r}),Do(i)}catch(e){return Oo(Us(t,`list`,e))}},conditionalPut:async(i,a,o)=>{t.debug(`Conditionally uploading object store data`,{key:i,options:o});try{let s=Gs((await n.send(new Vs.PutObjectCommand({Body:a,Bucket:e.bucket,ExpectedBucketOwner:e.expectedBucketOwner,IfMatch:o.ifMatch,IfNoneMatch:o.ifNoneMatch,Key:i,ServerSideEncryption:r,...r===`aws:kms`&&e.sseKmsKeyId!=null?{SSEKMSKeyId:e.sseKmsKeyId}:{}}))).ETag,`conditionalPut`);return t.info(`Conditionally uploaded object store data`,{key:i,etag:s}),Do({etag:s})}catch(e){return Oo(Us(t,`conditionalPut`,e))}},conditionalDelete:async(r,i)=>{t.debug(`Conditionally deleting object store data`,{key:r});try{return await n.send(new Vs.DeleteObjectCommand({Bucket:e.bucket,ExpectedBucketOwner:e.expectedBucketOwner,IfMatch:i.ifMatch,Key:r})),t.info(`Conditionally deleted object store data`,{key:r}),Do(void 0)}catch(e){return Oo(Us(t,`conditionalDelete`,e))}},getObject:async r=>{t.debug(`Reading object store data`,{key:r});try{let i=await n.send(new Vs.GetObjectCommand({Bucket:e.bucket,ExpectedBucketOwner:e.expectedBucketOwner,Key:r})),a=await Ws(i.Body),o=Gs(i.ETag,`getObject`);return t.info(`Read object store data`,{key:r,etag:o}),Do({data:a,etag:o})}catch(e){return Oo(Us(t,`getObject`,e))}}}}const Xs=[`token`,`password`,`secret`,`key`,`auth`,`credential`,`bearer`,`apikey`,`api_key`,`access_token`,`refresh_token`,`private`];function Zs(e,t){let n=e.toLowerCase();return t.some(e=>n.includes(e.toLowerCase()))}function Qs(e,t=Xs){if(typeof e!=`object`||!e)return e;if(Array.isArray(e))return e.map(e=>Qs(e,t));let n={};for(let[r,i]of Object.entries(e))Zs(r,t)&&typeof i==`string`?n[r]=`[REDACTED]`:typeof i==`object`&&i?n[r]=Qs(i,t):n[r]=i;return n}function $s(e,t,n,r){let i=Qs({...n,...r},Xs),a={timestamp:new Date().toISOString(),level:e,message:t,...i};if(r!=null&&`error`in r&&r.error instanceof Error){let e=r.error;a.error={message:e.message,name:e.name,stack:e.stack}}return JSON.stringify(a)}function ec(e){return{debug:(t,n)=>{K($s(`debug`,t,e,n))},info:(t,n)=>{xi($s(`info`,t,e,n))},warning:(t,n)=>{bi($s(`warning`,t,e,n))},error:(t,n)=>{yi($s(`error`,t,e,n))}}}const tc={SHOULD_SAVE_CACHE:`shouldSaveCache`,SESSION_ID:`sessionId`,CACHE_SAVED:`cacheSaved`,ARTIFACT_UPLOADED:`artifactUploaded`,OPENCODE_VERSION:`opencodeVersion`,S3_ENABLED:`storeConfig.enabled`,S3_BUCKET:`storeConfig.bucket`,S3_REGION:`storeConfig.region`,S3_PREFIX:`storeConfig.prefix`,S3_ENDPOINT:`storeConfig.endpoint`,S3_EXPECTED_BUCKET_OWNER:`storeConfig.expectedBucketOwner`,S3_ALLOW_INSECURE_ENDPOINT:`storeConfig.allowInsecureEndpoint`,S3_SSE_ENCRYPTION:`storeConfig.sseEncryption`,S3_SSE_KMS_KEY_ID:`storeConfig.sseKmsKeyId`};var nc=class{constructor(){if(this.payload={},process.env.GITHUB_EVENT_PATH)if(_e(process.env.GITHUB_EVENT_PATH))this.payload=JSON.parse(ye(process.env.GITHUB_EVENT_PATH,{encoding:`utf8`}));else{let e=process.env.GITHUB_EVENT_PATH;process.stdout.write(`GITHUB_EVENT_PATH ${e} does not exist${pe}`)}this.eventName=process.env.GITHUB_EVENT_NAME,this.sha=process.env.GITHUB_SHA,this.ref=process.env.GITHUB_REF,this.workflow=process.env.GITHUB_WORKFLOW,this.action=process.env.GITHUB_ACTION,this.actor=process.env.GITHUB_ACTOR,this.job=process.env.GITHUB_JOB,this.runAttempt=parseInt(process.env.GITHUB_RUN_ATTEMPT,10),this.runNumber=parseInt(process.env.GITHUB_RUN_NUMBER,10),this.runId=parseInt(process.env.GITHUB_RUN_ID,10),this.apiUrl=process.env.GITHUB_API_URL??`https://api.github.com`,this.serverUrl=process.env.GITHUB_SERVER_URL??`https://github.com`,this.graphqlUrl=process.env.GITHUB_GRAPHQL_URL??`https://api.github.com/graphql`}get issue(){let e=this.payload;return Object.assign(Object.assign({},this.repo),{number:(e.issue||e.pull_request||e).number})}get repo(){if(process.env.GITHUB_REPOSITORY){let[e,t]=process.env.GITHUB_REPOSITORY.split(`/`);return{owner:e,repo:t}}if(this.payload.repository)return{owner:this.payload.repository.owner.login,repo:this.payload.repository.name};throw Error(`context.repo requires a GITHUB_REPOSITORY environment variable like 'owner/repo'`)}},rc=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.getProxyUrl=t,e.checkBypass=n;function t(e){let t=e.protocol===`https:`;if(n(e))return;let r=t?process.env.https_proxy||process.env.HTTPS_PROXY:process.env.http_proxy||process.env.HTTP_PROXY;if(r)try{return new i(r)}catch{if(!r.startsWith(`http://`)&&!r.startsWith(`https://`))return new i(`http://${r}`)}else return}function n(e){if(!e.hostname)return!1;let t=e.hostname;if(r(t))return!0;let n=process.env.no_proxy||process.env.NO_PROXY||``;if(!n)return!1;let i;e.port?i=Number(e.port):e.protocol===`http:`?i=80:e.protocol===`https:`&&(i=443);let a=[e.hostname.toUpperCase()];typeof i==`number`&&a.push(`${a[0]}:${i}`);for(let e of n.split(`,`).map(e=>e.trim().toUpperCase()).filter(e=>e))if(e===`*`||a.some(t=>t===e||t.endsWith(`.${e}`)||e.startsWith(`.`)&&t.endsWith(`${e}`)))return!0;return!1}function r(e){let t=e.toLowerCase();return t===`localhost`||t.startsWith(`127.`)||t.startsWith(`[::1]`)||t.startsWith(`[0:0:0:0:0:0:0:1]`)}var i=class extends URL{constructor(e,t){super(e,t),this._decodedUsername=decodeURIComponent(super.username),this._decodedPassword=decodeURIComponent(super.password)}get username(){return this._decodedUsername}get password(){return this._decodedPassword}}})),ic=n(i((e=>{var n=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),r=e&&e.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,`default`,{enumerable:!0,value:t})}):function(e,t){e.default=t}),i=e&&e.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[t.length]=n);return t},e(t)};return function(t){if(t&&t.__esModule)return t;var i={};if(t!=null)for(var a=e(t),o=0;oa(this,void 0,void 0,function*(){let t=Buffer.alloc(0);this.message.on(`data`,e=>{t=Buffer.concat([t,e])}),this.message.on(`end`,()=>{e(t.toString())})}))})}readBodyBuffer(){return a(this,void 0,void 0,function*(){return new Promise(e=>a(this,void 0,void 0,function*(){let t=[];this.message.on(`data`,e=>{t.push(e)}),this.message.on(`end`,()=>{e(Buffer.concat(t))})}))})}};e.HttpClientResponse=b;function x(e){return new URL(e).protocol===`https:`}e.HttpClient=class{constructor(e,t,n){this._ignoreSslError=!1,this._allowRedirects=!0,this._allowRedirectDowngrade=!1,this._maxRedirects=50,this._allowRetries=!1,this._maxRetries=1,this._keepAlive=!1,this._disposed=!1,this.userAgent=this._getUserAgentWithOrchestrationId(e),this.handlers=t||[],this.requestOptions=n,n&&(n.ignoreSslError!=null&&(this._ignoreSslError=n.ignoreSslError),this._socketTimeout=n.socketTimeout,n.allowRedirects!=null&&(this._allowRedirects=n.allowRedirects),n.allowRedirectDowngrade!=null&&(this._allowRedirectDowngrade=n.allowRedirectDowngrade),n.maxRedirects!=null&&(this._maxRedirects=Math.max(n.maxRedirects,0)),n.keepAlive!=null&&(this._keepAlive=n.keepAlive),n.allowRetries!=null&&(this._allowRetries=n.allowRetries),n.maxRetries!=null&&(this._maxRetries=n.maxRetries))}options(e,t){return a(this,void 0,void 0,function*(){return this.request(`OPTIONS`,e,null,t||{})})}get(e,t){return a(this,void 0,void 0,function*(){return this.request(`GET`,e,null,t||{})})}del(e,t){return a(this,void 0,void 0,function*(){return this.request(`DELETE`,e,null,t||{})})}post(e,t,n){return a(this,void 0,void 0,function*(){return this.request(`POST`,e,t,n||{})})}patch(e,t,n){return a(this,void 0,void 0,function*(){return this.request(`PATCH`,e,t,n||{})})}put(e,t,n){return a(this,void 0,void 0,function*(){return this.request(`PUT`,e,t,n||{})})}head(e,t){return a(this,void 0,void 0,function*(){return this.request(`HEAD`,e,null,t||{})})}sendStream(e,t,n,r){return a(this,void 0,void 0,function*(){return this.request(e,t,n,r)})}getJson(e){return a(this,arguments,void 0,function*(e,t={}){t[f.Accept]=this._getExistingOrDefaultHeader(t,f.Accept,p.ApplicationJson);let n=yield this.get(e,t);return this._processResponse(n,this.requestOptions)})}postJson(e,t){return a(this,arguments,void 0,function*(e,t,n={}){let r=JSON.stringify(t,null,2);n[f.Accept]=this._getExistingOrDefaultHeader(n,f.Accept,p.ApplicationJson),n[f.ContentType]=this._getExistingOrDefaultContentTypeHeader(n,p.ApplicationJson);let i=yield this.post(e,r,n);return this._processResponse(i,this.requestOptions)})}putJson(e,t){return a(this,arguments,void 0,function*(e,t,n={}){let r=JSON.stringify(t,null,2);n[f.Accept]=this._getExistingOrDefaultHeader(n,f.Accept,p.ApplicationJson),n[f.ContentType]=this._getExistingOrDefaultContentTypeHeader(n,p.ApplicationJson);let i=yield this.put(e,r,n);return this._processResponse(i,this.requestOptions)})}patchJson(e,t){return a(this,arguments,void 0,function*(e,t,n={}){let r=JSON.stringify(t,null,2);n[f.Accept]=this._getExistingOrDefaultHeader(n,f.Accept,p.ApplicationJson),n[f.ContentType]=this._getExistingOrDefaultContentTypeHeader(n,p.ApplicationJson);let i=yield this.patch(e,r,n);return this._processResponse(i,this.requestOptions)})}request(e,t,n,r){return a(this,void 0,void 0,function*(){if(this._disposed)throw Error(`Client has already been disposed.`);let i=new URL(t),a=this._prepareRequest(e,i,r),o=this._allowRetries&&v.includes(e)?this._maxRetries+1:1,s=0,c;do{if(c=yield this.requestRaw(a,n),c&&c.message&&c.message.statusCode===d.Unauthorized){let e;for(let t of this.handlers)if(t.canHandleAuthentication(c)){e=t;break}return e?e.handleAuthentication(this,a,n):c}let t=this._maxRedirects;for(;c.message.statusCode&&h.includes(c.message.statusCode)&&this._allowRedirects&&t>0;){let o=c.message.headers.location;if(!o)break;let s=new URL(o);if(i.protocol===`https:`&&i.protocol!==s.protocol&&!this._allowRedirectDowngrade)throw Error(`Redirect from HTTPS to HTTP protocol. This downgrade is not allowed for security reasons. If you want to allow this behavior, set the allowRedirectDowngrade option to true.`);if(yield c.readBody(),s.hostname!==i.hostname)for(let e in r)e.toLowerCase()===`authorization`&&delete r[e];a=this._prepareRequest(e,s,r),c=yield this.requestRaw(a,n),t--}if(!c.message.statusCode||!g.includes(c.message.statusCode))return c;s+=1,s{function i(e,t){e?r(e):t?n(t):r(Error(`Unknown error`))}this.requestRawWithCallback(e,t,i)})})}requestRawWithCallback(e,t,n){typeof t==`string`&&(e.options.headers||(e.options.headers={}),e.options.headers[`Content-Length`]=Buffer.byteLength(t,`utf8`));let r=!1;function i(e,t){r||(r=!0,n(e,t))}let a=e.httpModule.request(e.options,e=>{i(void 0,new b(e))}),o;a.on(`socket`,e=>{o=e}),a.setTimeout(this._socketTimeout||3*6e4,()=>{o&&o.end(),i(Error(`Request timeout: ${e.options.path}`))}),a.on(`error`,function(e){i(e)}),t&&typeof t==`string`&&a.write(t,`utf8`),t&&typeof t!=`string`?(t.on(`close`,function(){a.end()}),t.pipe(a)):a.end()}getAgent(e){let t=new URL(e);return this._getAgent(t)}getAgentDispatcher(e){let t=new URL(e),n=c.getProxyUrl(t);if(n&&n.hostname)return this._getProxyAgentDispatcher(t,n)}_prepareRequest(e,t,n){let r={};r.parsedUrl=t;let i=r.parsedUrl.protocol===`https:`;r.httpModule=i?s:o;let a=i?443:80;if(r.options={},r.options.host=r.parsedUrl.hostname,r.options.port=r.parsedUrl.port?parseInt(r.parsedUrl.port):a,r.options.path=(r.parsedUrl.pathname||``)+(r.parsedUrl.search||``),r.options.method=e,r.options.headers=this._mergeHeaders(n),this.userAgent!=null&&(r.options.headers[`user-agent`]=this.userAgent),r.options.agent=this._getAgent(r.parsedUrl),this.handlers)for(let e of this.handlers)e.prepareRequest(r.options);return r}_mergeHeaders(e){return this.requestOptions&&this.requestOptions.headers?Object.assign({},S(this.requestOptions.headers),S(e||{})):S(e||{})}_getExistingOrDefaultHeader(e,t,n){let r;if(this.requestOptions&&this.requestOptions.headers){let e=S(this.requestOptions.headers)[t];e&&(r=typeof e==`number`?e.toString():e)}let i=e[t];return i===void 0?r===void 0?n:r:typeof i==`number`?i.toString():i}_getExistingOrDefaultContentTypeHeader(e,t){let n;if(this.requestOptions&&this.requestOptions.headers){let e=S(this.requestOptions.headers)[f.ContentType];e&&(n=typeof e==`number`?String(e):Array.isArray(e)?e.join(`, `):e)}let r=e[f.ContentType];return r===void 0?n===void 0?t:n:typeof r==`number`?String(r):Array.isArray(r)?r.join(`, `):r}_getAgent(e){let t,n=c.getProxyUrl(e),r=n&&n.hostname;if(this._keepAlive&&r&&(t=this._proxyAgent),r||(t=this._agent),t)return t;let i=e.protocol===`https:`,a=100;if(this.requestOptions&&(a=this.requestOptions.maxSockets||o.globalAgent.maxSockets),n&&n.hostname){let e={maxSockets:a,keepAlive:this._keepAlive,proxy:Object.assign(Object.assign({},(n.username||n.password)&&{proxyAuth:`${n.username}:${n.password}`}),{host:n.hostname,port:n.port})},r,o=n.protocol===`https:`;r=i?o?l.httpsOverHttps:l.httpsOverHttp:o?l.httpOverHttps:l.httpOverHttp,t=r(e),this._proxyAgent=t}if(!t){let e={keepAlive:this._keepAlive,maxSockets:a};t=i?new s.Agent(e):new o.Agent(e),this._agent=t}return i&&this._ignoreSslError&&(t.options=Object.assign(t.options||{},{rejectUnauthorized:!1})),t}_getProxyAgentDispatcher(e,t){let n;if(this._keepAlive&&(n=this._proxyAgentDispatcher),n)return n;let r=e.protocol===`https:`;return n=new u.ProxyAgent(Object.assign({uri:t.href,pipelining:+!!this._keepAlive},(t.username||t.password)&&{token:`Basic ${Buffer.from(`${t.username}:${t.password}`).toString(`base64`)}`})),this._proxyAgentDispatcher=n,r&&this._ignoreSslError&&(n.options=Object.assign(n.options.requestTls||{},{rejectUnauthorized:!1})),n}_getUserAgentWithOrchestrationId(e){let t=e||`actions/http-client`,n=process.env.ACTIONS_ORCHESTRATION_ID;return n?`${t} actions_orchestration_id/${n.replace(/[^a-z0-9_.-]/gi,`_`)}`:t}_performExponentialBackoff(e){return a(this,void 0,void 0,function*(){e=Math.min(10,e);let t=5*2**e;return new Promise(e=>setTimeout(()=>e(),t))})}_processResponse(e,t){return a(this,void 0,void 0,function*(){return new Promise((n,r)=>a(this,void 0,void 0,function*(){let i=e.message.statusCode||0,a={statusCode:i,result:null,headers:{}};i===d.NotFound&&n(a);function o(e,t){if(typeof t==`string`){let e=new Date(t);if(!isNaN(e.valueOf()))return e}return t}let s,c;try{c=yield e.readBody(),c&&c.length>0&&(s=t&&t.deserializeDates?JSON.parse(c,o):JSON.parse(c),a.result=s),a.headers=e.message.headers}catch{}if(i>299){let e;e=s&&s.message?s.message:c&&c.length>0?c:`Failed request: (${i})`;let t=new y(e,i);t.result=a.result,r(t)}else n(a)}))})}};let S=e=>Object.keys(e).reduce((t,n)=>(t[n.toLowerCase()]=e[n],t),{})}))(),1),ac=function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})};function oc(e,t){if(!e&&!t.auth)throw Error(`Parameter token or opts.auth is required`);if(e&&t.auth)throw Error(`Parameters token and opts.auth may not both be specified`);return typeof t.auth==`string`?t.auth:`token ${e}`}function sc(e){return new ic.HttpClient().getAgent(e)}function cc(e){return new ic.HttpClient().getAgentDispatcher(e)}function lc(e){let t=cc(e);return(e,n)=>ac(this,void 0,void 0,function*(){return(0,cr.fetch)(e,Object.assign(Object.assign({},n),{dispatcher:t}))})}function uc(){return process.env.GITHUB_API_URL||`https://api.github.com`}function dc(e){let t=process.env.ACTIONS_ORCHESTRATION_ID?.trim();if(t){let n=`actions_orchestration_id/${t.replace(/[^a-z0-9_.-]/gi,`_`)}`;return e?.includes(n)?e:`${e?`${e} `:``}${n}`}return e}function fc(){return typeof navigator==`object`&&`userAgent`in navigator?navigator.userAgent:typeof process==`object`&&process.version!==void 0?`Node.js/${process.version.substr(1)} (${process.platform}; ${process.arch})`:``}function pc(e,t,n,r){if(typeof n!=`function`)throw Error(`method for before hook must be a function`);return r||={},Array.isArray(t)?t.reverse().reduce((t,n)=>pc.bind(null,e,n,t,r),n)():Promise.resolve().then(()=>e.registry[t]?e.registry[t].reduce((e,t)=>t.hook.bind(null,e,r),n)():n(r))}function mc(e,t,n,r){let i=r;e.registry[n]||(e.registry[n]=[]),t===`before`&&(r=(e,t)=>Promise.resolve().then(i.bind(null,t)).then(e.bind(null,t))),t===`after`&&(r=(e,t)=>{let n;return Promise.resolve().then(e.bind(null,t)).then(e=>(n=e,i(n,t))).then(()=>n)}),t===`error`&&(r=(e,t)=>Promise.resolve().then(e.bind(null,t)).catch(e=>i(e,t))),e.registry[n].push({hook:r,orig:i})}function hc(e,t,n){if(!e.registry[t])return;let r=e.registry[t].map(e=>e.orig).indexOf(n);r!==-1&&e.registry[t].splice(r,1)}const gc=Function.bind,_c=gc.bind(gc);function vc(e,t,n){let r=_c(hc,null).apply(null,n?[t,n]:[t]);e.api={remove:r},e.remove=r,[`before`,`error`,`after`,`wrap`].forEach(r=>{let i=n?[t,r,n]:[t,r];e[r]=e.api[r]=_c(mc,null).apply(null,i)})}function yc(){let e=Symbol(`Singular`),t={registry:{}},n=pc.bind(null,t,e);return vc(n,t,e),n}function bc(){let e={registry:{}},t=pc.bind(null,e);return vc(t,e),t}var xc={Singular:yc,Collection:bc},Sc={method:`GET`,baseUrl:`https://api.github.com`,headers:{accept:`application/vnd.github.v3+json`,"user-agent":`octokit-endpoint.js/0.0.0-development ${fc()}`},mediaType:{format:``}};function Cc(e){return e?Object.keys(e).reduce((t,n)=>(t[n.toLowerCase()]=e[n],t),{}):{}}function wc(e){if(typeof e!=`object`||!e||Object.prototype.toString.call(e)!==`[object Object]`)return!1;let t=Object.getPrototypeOf(e);if(t===null)return!0;let n=Object.prototype.hasOwnProperty.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n instanceof n&&Function.prototype.call(n)===Function.prototype.call(e)}function Tc(e,t){let n=Object.assign({},e);return Object.keys(t).forEach(r=>{wc(t[r])&&r in e?n[r]=Tc(e[r],t[r]):Object.assign(n,{[r]:t[r]})}),n}function Ec(e){for(let t in e)e[t]===void 0&&delete e[t];return e}function Dc(e,t,n){if(typeof t==`string`){let[e,r]=t.split(` `);n=Object.assign(r?{method:e,url:r}:{url:e},n)}else n=Object.assign({},t);n.headers=Cc(n.headers),Ec(n),Ec(n.headers);let r=Tc(e||{},n);return n.url===`/graphql`&&(e&&e.mediaType.previews?.length&&(r.mediaType.previews=e.mediaType.previews.filter(e=>!r.mediaType.previews.includes(e)).concat(r.mediaType.previews)),r.mediaType.previews=(r.mediaType.previews||[]).map(e=>e.replace(/-preview/,``))),r}function Oc(e,t){let n=/\?/.test(e)?`&`:`?`,r=Object.keys(t);return r.length===0?e:e+n+r.map(e=>e===`q`?`q=`+t.q.split(`+`).map(encodeURIComponent).join(`+`):`${e}=${encodeURIComponent(t[e])}`).join(`&`)}var kc=/\{[^{}}]+\}/g;function Ac(e){return e.replace(/(?:^\W+)|(?:(?e.concat(t),[]):[]}function Mc(e,t){let n={__proto__:null};for(let r of Object.keys(e))t.indexOf(r)===-1&&(n[r]=e[r]);return n}function Nc(e){return e.split(/(%[0-9A-Fa-f]{2})/g).map(function(e){return/%[0-9A-Fa-f]/.test(e)||(e=encodeURI(e).replace(/%5B/g,`[`).replace(/%5D/g,`]`)),e}).join(``)}function Pc(e){return encodeURIComponent(e).replace(/[!'()*]/g,function(e){return`%`+e.charCodeAt(0).toString(16).toUpperCase()})}function Fc(e,t,n){return t=e===`+`||e===`#`?Nc(t):Pc(t),n?Pc(n)+`=`+t:t}function Ic(e){return e!=null}function Lc(e){return e===`;`||e===`&`||e===`?`}function Rc(e,t,n,r){var i=e[n],a=[];if(Ic(i)&&i!==``)if(typeof i==`string`||typeof i==`number`||typeof i==`bigint`||typeof i==`boolean`)i=i.toString(),r&&r!==`*`&&(i=i.substring(0,parseInt(r,10))),a.push(Fc(t,i,Lc(t)?n:``));else if(r===`*`)Array.isArray(i)?i.filter(Ic).forEach(function(e){a.push(Fc(t,e,Lc(t)?n:``))}):Object.keys(i).forEach(function(e){Ic(i[e])&&a.push(Fc(t,i[e],e))});else{let e=[];Array.isArray(i)?i.filter(Ic).forEach(function(n){e.push(Fc(t,n))}):Object.keys(i).forEach(function(n){Ic(i[n])&&(e.push(Pc(n)),e.push(Fc(t,i[n].toString())))}),Lc(t)?a.push(Pc(n)+`=`+e.join(`,`)):e.length!==0&&a.push(e.join(`,`))}else t===`;`?Ic(i)&&a.push(Pc(n)):i===``&&(t===`&`||t===`?`)?a.push(Pc(n)+`=`):i===``&&a.push(``);return a}function zc(e){return{expand:Bc.bind(null,e)}}function Bc(e,t){var n=[`+`,`#`,`.`,`/`,`;`,`?`,`&`];return e=e.replace(/\{([^\{\}]+)\}|([^\{\}]+)/g,function(e,r,i){if(r){let e=``,i=[];if(n.indexOf(r.charAt(0))!==-1&&(e=r.charAt(0),r=r.substr(1)),r.split(/,/g).forEach(function(n){var r=/([^:\*]*)(?::(\d+)|(\*))?/.exec(n);i.push(Rc(t,e,r[1],r[2]||r[3]))}),e&&e!==`+`){var a=`,`;return e===`?`?a=`&`:e!==`#`&&(a=e),(i.length===0?``:e)+i.join(a)}else return i.join(`,`)}else return Nc(i)}),e===`/`?e:e.replace(/\/$/,``)}function Vc(e){let t=e.method.toUpperCase(),n=(e.url||`/`).replace(/:([a-z]\w+)/g,`{$1}`),r=Object.assign({},e.headers),i,a=Mc(e,[`method`,`baseUrl`,`url`,`headers`,`request`,`mediaType`]),o=jc(n);n=zc(n).expand(a),/^http/.test(n)||(n=e.baseUrl+n);let s=Mc(a,Object.keys(e).filter(e=>o.includes(e)).concat(`baseUrl`));return/application\/octet-stream/i.test(r.accept)||(e.mediaType.format&&(r.accept=r.accept.split(/,/).map(t=>t.replace(/application\/vnd(\.\w+)(\.v3)?(\.\w+)?(\+json)?$/,`application/vnd$1$2.${e.mediaType.format}`)).join(`,`)),n.endsWith(`/graphql`)&&e.mediaType.previews?.length&&(r.accept=(r.accept.match(/(?`application/vnd.github.${t}-preview${e.mediaType.format?`.${e.mediaType.format}`:`+json`}`).join(`,`))),[`GET`,`HEAD`].includes(t)?n=Oc(n,s):`data`in s?i=s.data:Object.keys(s).length&&(i=s),!r[`content-type`]&&i!==void 0&&(r[`content-type`]=`application/json; charset=utf-8`),[`PATCH`,`PUT`].includes(t)&&i===void 0&&(i=``),Object.assign({method:t,url:n,headers:r},i===void 0?null:{body:i},e.request?{request:e.request}:null)}function Hc(e,t,n){return Vc(Dc(e,t,n))}function Uc(e,t){let n=Dc(e,t),r=Hc.bind(null,n);return Object.assign(r,{DEFAULTS:n,defaults:Uc.bind(null,n),merge:Dc.bind(null,n),parse:Vc})}var Wc=Uc(null,Sc),Gc=i(((e,t)=>{let n=function(){};n.prototype=Object.create(null);let r=/; *([!#$%&'*+.^\w`|~-]+)=("(?:[\v\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\v\u0020-\u00ff])*"|[!#$%&'*+.^\w`|~-]+) */gu,i=/\\([\v\u0020-\u00ff])/gu,a=/^[!#$%&'*+.^\w|~-]+\/[!#$%&'*+.^\w|~-]+$/u,o={type:``,parameters:new n};Object.freeze(o.parameters),Object.freeze(o);function s(e){if(typeof e!=`string`)throw TypeError(`argument header is required and must be a string`);let t=e.indexOf(`;`),o=t===-1?e.trim():e.slice(0,t).trim();if(a.test(o)===!1)throw TypeError(`invalid media type`);let s={type:o.toLowerCase(),parameters:new n};if(t===-1)return s;let c,l,u;for(r.lastIndex=t;l=r.exec(e);){if(l.index!==t)throw TypeError(`invalid parameter format`);t+=l[0].length,c=l[1].toLowerCase(),u=l[2],u[0]===`"`&&(u=u.slice(1,u.length-1),i.test(u)&&(u=u.replace(i,`$1`))),s.parameters[c]=u}if(t!==e.length)throw TypeError(`invalid parameter format`);return s}function c(e){if(typeof e!=`string`)return o;let t=e.indexOf(`;`),s=t===-1?e.trim():e.slice(0,t).trim();if(a.test(s)===!1)return o;let c={type:s.toLowerCase(),parameters:new n};if(t===-1)return c;let l,u,d;for(r.lastIndex=t;u=r.exec(e);){if(u.index!==t)return o;t+=u[0].length,l=u[1].toLowerCase(),d=u[2],d[0]===`"`&&(d=d.slice(1,d.length-1),i.test(d)&&(d=d.replace(i,`$1`))),c.parameters[l]=d}return t===e.length?c:o}t.exports.default={parse:s,safeParse:c},t.exports.parse=s,t.exports.safeParse=c,t.exports.defaultContentType=o}))();const Kc=/^-?\d+$/,qc=/^-?\d+n+$/,Jc=JSON.stringify,Yc=JSON.parse,Xc=/^-?\d+n$/,Zc=/([\[:])?"(-?\d+)n"($|([\\n]|\s)*(\s|[\\n])*[,\}\]])/g,Qc=/([\[:])?("-?\d+n+)n("$|"([\\n]|\s)*(\s|[\\n])*[,\}\]])/g,$c=(e,t,n)=>`rawJSON`in JSON?Jc(e,(e,n)=>typeof n==`bigint`?JSON.rawJSON(n.toString()):typeof t==`function`?t(e,n):(Array.isArray(t)&&t.includes(e),n),n):e?Jc(e,(e,n)=>typeof n==`string`&&n.match(qc)||typeof n==`bigint`?n.toString()+`n`:typeof t==`function`?t(e,n):(Array.isArray(t)&&t.includes(e),n),n).replace(Zc,`$1$2$3`).replace(Qc,`$1$2$3`):Jc(e,t,n),el=()=>JSON.parse(`1`,(e,t,n)=>!!n&&n.source===`1`),tl=(e,t,n,r)=>typeof t==`string`&&t.match(Xc)?BigInt(t.slice(0,-1)):typeof t==`string`&&t.match(qc)?t.slice(0,-1):typeof r==`function`?r(e,t,n):t,nl=(e,t)=>JSON.parse(e,(e,n,r)=>{let i=typeof n==`number`&&(n>2**53-1||n<-(2**53-1)),a=r&&Kc.test(r.source);return i&&a?BigInt(r.source):typeof t==`function`?t(e,n,r):n}),rl=(2**53-1).toString(),il=rl.length,al=/"(?:\\.|[^"])*"|-?(0|[1-9][0-9]*)(\.[0-9]+)?([eE][+-]?[0-9]+)?/g,ol=/^"-?\d+n+"$/,sl=(e,t)=>e?el()?nl(e,t):Yc(e.replace(al,(e,t,n,r)=>{let i=e[0]===`"`;if(i&&e.match(ol))return e.substring(0,e.length-1)+`n"`;let a=n||r,o=t&&(t.lengthtl(e,n,r,t)):Yc(e,t);var cl=class extends Error{name;status;request;response;constructor(e,t,n){super(e,{cause:n.cause}),this.name=`HttpError`,this.status=Number.parseInt(t),Number.isNaN(this.status)&&(this.status=0),`response`in n&&(this.response=n.response);let r=Object.assign({},n.request);n.request.headers.authorization&&(r.headers=Object.assign({},n.request.headers,{authorization:n.request.headers.authorization.replace(/(?``;async function fl(e){let t=e.request?.fetch||globalThis.fetch;if(!t)throw Error(`fetch is not set. Please pass a fetch implementation as new Octokit({ request: { fetch }}). Learn more at https://github.com/octokit/octokit.js/#fetch-missing`);let n=e.request?.log||console,r=e.request?.parseSuccessResponseBody!==!1,i=ul(e.body)||Array.isArray(e.body)?$c(e.body):e.body,a=Object.fromEntries(Object.entries(e.headers).map(([e,t])=>[e,String(t)])),o;try{o=await t(e.url,{method:e.method,body:i,redirect:e.request?.redirect,headers:a,signal:e.request?.signal,...e.body&&{duplex:`half`}})}catch(t){let n=`Unknown Error`;if(t instanceof Error){if(t.name===`AbortError`)throw t.status=500,t;n=t.message,t.name===`TypeError`&&`cause`in t&&(t.cause instanceof Error?n=t.cause.message:typeof t.cause==`string`&&(n=t.cause))}let r=new cl(n,500,{request:e});throw r.cause=t,r}let s=o.status,c=o.url,l={};for(let[e,t]of o.headers)l[e]=t;let u={url:c,status:s,headers:l,data:``};if(`deprecation`in l){let t=l.link&&l.link.match(/<([^<>]+)>; rel="deprecation"/),r=t&&t.pop();n.warn(`[@octokit/request] "${e.method} ${e.url}" is deprecated. It is scheduled to be removed on ${l.sunset}${r?`. See ${r}`:``}`)}if(s===204||s===205)return u;if(e.method===`HEAD`){if(s<400)return u;throw new cl(o.statusText,s,{response:u,request:e})}if(s===304)throw u.data=await pl(o),new cl(`Not modified`,s,{response:u,request:e});if(s>=400)throw u.data=await pl(o),new cl(hl(u.data),s,{response:u,request:e});return u.data=r?await pl(o):o.body,u}async function pl(e){let t=e.headers.get(`content-type`);if(!t)return e.text().catch(dl);let n=(0,Gc.safeParse)(t);if(ml(n)){let t=``;try{return t=await e.text(),sl(t)}catch{return t}}else if(n.type.startsWith(`text/`)||n.parameters.charset?.toLowerCase()===`utf-8`)return e.text().catch(dl);else return e.arrayBuffer().catch(()=>new ArrayBuffer(0))}function ml(e){return e.type===`application/json`||e.type===`application/scim+json`}function hl(e){if(typeof e==`string`)return e;if(e instanceof ArrayBuffer)return`Unknown error`;if(`message`in e){let t=`documentation_url`in e?` - ${e.documentation_url}`:``;return Array.isArray(e.errors)?`${e.message}: ${e.errors.map(e=>JSON.stringify(e)).join(`, `)}${t}`:`${e.message}${t}`}return`Unknown error: ${JSON.stringify(e)}`}function gl(e,t){let n=e.defaults(t);return Object.assign(function(e,t){let r=n.merge(e,t);if(!r.request||!r.request.hook)return fl(n.parse(r));let i=(e,t)=>fl(n.parse(n.merge(e,t)));return Object.assign(i,{endpoint:n,defaults:gl.bind(null,n)}),r.request.hook(i,r)},{endpoint:n,defaults:gl.bind(null,n)})}var _l=gl(Wc,ll),vl=`0.0.0-development`;function yl(e){return`Request failed due to following response errors: +`),!0)),new r.CredentialsProviderError(`AWS_PROFILE is set, skipping fromEnv provider.`,{logger:e.logger,tryNextLink:!0});return e.logger?.debug(`@aws-sdk/credential-provider-node - defaultProvider::fromEnv`),t.fromEnv(e)()},async t=>{e.logger?.debug(`@aws-sdk/credential-provider-node - defaultProvider::fromSSO`);let{ssoStartUrl:i,ssoAccountId:a,ssoRegion:o,ssoRoleName:s,ssoSession:c}=e;if(!i&&!a&&!o&&!s&&!c)throw new r.CredentialsProviderError(`Skipping SSO provider in default chain (inputs do not include SSO fields).`,{logger:e.logger});let{fromSSO:l}=await import(`./dist-cjs-Fom3JyZC.js`).then(e=>n(e.default));return l(e)(t)},async t=>{e.logger?.debug(`@aws-sdk/credential-provider-node - defaultProvider::fromIni`);let{fromIni:r}=await import(`./dist-cjs-BPBeq5Um.js`).then(e=>n(e.default));return r(e)(t)},async t=>{e.logger?.debug(`@aws-sdk/credential-provider-node - defaultProvider::fromProcess`);let{fromProcess:r}=await import(`./dist-cjs-BkdmBfYB.js`).then(e=>n(e.default));return r(e)(t)},async t=>{e.logger?.debug(`@aws-sdk/credential-provider-node - defaultProvider::fromTokenFile`);let{fromTokenFile:r}=await import(`./dist-cjs-DjaETdKJ.js`).then(e=>n(e.default));return r(e)(t)},async()=>(e.logger?.debug(`@aws-sdk/credential-provider-node - defaultProvider::remoteProvider`),(await o(e))()),async()=>{throw new r.CredentialsProviderError(`Could not load credentials from any providers`,{tryNextLink:!1,logger:e.logger})}],f),d=e=>e?.expiration!==void 0,f=e=>e?.expiration!==void 0&&e.expiration.getTime()-Date.now()<3e5;e.credentialsTreatedAsExpired=f,e.credentialsWillNeedRefresh=d,e.defaultProvider=u})),js=i((e=>{var t=T(),n=ae(),r=c();let i=`AWS_S3_DISABLE_MULTIREGION_ACCESS_POINTS`,a=`s3_disable_multiregion_access_points`,o={environmentVariableSelector:e=>t.booleanSelector(e,i,t.SelectorType.ENV),configFileSelector:e=>t.booleanSelector(e,a,t.SelectorType.CONFIG),default:!1},s=`AWS_S3_USE_ARN_REGION`,l=`s3_use_arn_region`,u={environmentVariableSelector:e=>t.booleanSelector(e,s,t.SelectorType.ENV),configFileSelector:e=>t.booleanSelector(e,l,t.SelectorType.CONFIG),default:void 0},d=/^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/,f=/(\d+\.){3}\d+/,p=/\.\./,m=/\./,h=/^(.+\.)?s3(-fips)?(\.dualstack)?[.-]([a-z0-9-]+)\./,g=/^s3(-external-1)?\.amazonaws\.com$/,v=`amazonaws.com`,y=e=>typeof e.bucketName==`string`,b=e=>d.test(e)&&!f.test(e)&&!p.test(e),x=e=>{let t=e.match(h);return[t[4],e.replace(RegExp(`^${t[0]}`),``)]},S=e=>g.test(e)?[`us-east-1`,v]:x(e),C=e=>g.test(e)?[e.replace(`.${v}`,``),v]:x(e),w=e=>{if(e.pathStyleEndpoint)throw Error(`Path-style S3 endpoint is not supported when bucket is an ARN`);if(e.accelerateEndpoint)throw Error(`Accelerate endpoint is not supported when bucket is an ARN`);if(!e.tlsCompatible)throw Error(`HTTPS is required when bucket is an ARN`)},E=e=>{if(e!==`s3`&&e!==`s3-outposts`&&e!==`s3-object-lambda`)throw Error(`Expect 's3' or 's3-outposts' or 's3-object-lambda' in ARN service component`)},D=e=>{if(e!==`s3`)throw Error(`Expect 's3' in Accesspoint ARN service component`)},O=e=>{if(e!==`s3-outposts`)throw Error(`Expect 's3-posts' in Outpost ARN service component`)},k=(e,t)=>{if(e!==t.clientPartition)throw Error(`Partition in ARN is incompatible, got "${e}" but expected "${t.clientPartition}"`)},A=(e,t)=>{},j=e=>{if([`s3-external-1`,`aws-global`].includes(e))throw Error(`Client region ${e} is not regional`)},M=e=>{if(!/[0-9]{12}/.exec(e))throw Error(`Access point ARN accountID does not match regex '[0-9]{12}'`)},N=(e,t={tlsCompatible:!0})=>{if(e.length>=64||!/^[a-z0-9][a-z0-9.-]*[a-z0-9]$/.test(e)||/(\d+\.){3}\d+/.test(e)||/[.-]{2}/.test(e)||t?.tlsCompatible&&m.test(e))throw Error(`Invalid DNS label ${e}`)},P=e=>{if(e.isCustomEndpoint){if(e.dualstackEndpoint)throw Error(`Dualstack endpoint is not supported with custom endpoint`);if(e.accelerateEndpoint)throw Error(`Accelerate endpoint is not supported with custom endpoint`)}},F=e=>{let t=e.includes(`:`)?`:`:`/`,[n,...r]=e.split(t);if(n===`accesspoint`){if(r.length!==1||r[0]===``)throw Error(`Access Point ARN should have one resource accesspoint${t}{accesspointname}`);return{accesspointName:r[0]}}else if(n===`outpost`){if(!r[0]||r[1]!==`accesspoint`||!r[2]||r.length!==3)throw Error(`Outpost ARN should have resource outpost${t}{outpostId}${t}accesspoint${t}{accesspointName}`);let[e,n,i]=r;return{outpostId:e,accesspointName:i}}else throw Error(`ARN resource should begin with 'accesspoint${t}' or 'outpost${t}'`)},I=e=>{},L=e=>{if(e)throw Error(`FIPS region is not supported with Outpost.`)},R=e=>{try{e.split(`.`).forEach(e=>{N(e)})}catch{throw Error(`"${e}" is not a DNS compatible name.`)}},z=e=>(P(e),y(e)?ee(e):te(e)),ee=({accelerateEndpoint:e=!1,clientRegion:t,baseHostname:n,bucketName:r,dualstackEndpoint:i=!1,fipsEndpoint:a=!1,pathStyleEndpoint:o=!1,tlsCompatible:s=!0,isCustomEndpoint:c=!1})=>{let[l,u]=c?[t,n]:S(n);return o||!b(r)||s&&m.test(r)?{bucketEndpoint:!1,hostname:i?`s3.dualstack.${l}.${u}`:n}:(e?n=`s3-accelerate${i?`.dualstack`:``}.${u}`:i&&(n=`s3.dualstack.${l}.${u}`),{bucketEndpoint:!0,hostname:`${r}.${n}`})},te=e=>{let{isCustomEndpoint:t,baseHostname:n,clientRegion:r}=e,i=t?n:C(n)[1],{pathStyleEndpoint:a,accelerateEndpoint:o=!1,fipsEndpoint:s=!1,tlsCompatible:c=!0,bucketName:l,clientPartition:u=`aws`}=e;w({pathStyleEndpoint:a,accelerateEndpoint:o,tlsCompatible:c});let{service:d,partition:f,accountId:p,region:m,resource:h}=l;E(d),k(f,{clientPartition:u}),M(p);let{accesspointName:g,outpostId:v}=F(h);return d===`s3-object-lambda`?ne({...e,tlsCompatible:c,bucketName:l,accesspointName:g,hostnameSuffix:i}):m===``?re({...e,mrapAlias:g,hostnameSuffix:i}):v?B({...e,clientRegion:r,outpostId:v,accesspointName:g,hostnameSuffix:i}):ie({...e,clientRegion:r,accesspointName:g,hostnameSuffix:i})},ne=({dualstackEndpoint:e=!1,fipsEndpoint:t=!1,tlsCompatible:n=!0,useArnRegion:r,clientRegion:i,clientSigningRegion:a=i,accesspointName:o,bucketName:s,hostnameSuffix:c})=>{let{accountId:l,region:u,service:d}=s;j(i);let f=`${o}-${l}`;N(f,{tlsCompatible:n});let p=r?u:i,m=r?u:a;return{bucketEndpoint:!0,hostname:`${f}.${d}${t?`-fips`:``}.${p}.${c}`,signingRegion:m,signingService:d}},re=({disableMultiregionAccessPoints:e,dualstackEndpoint:t=!1,isCustomEndpoint:n,mrapAlias:r,hostnameSuffix:i})=>{if(e===!0)throw Error(`SDK is attempting to use a MRAP ARN. Please enable to feature.`);return R(r),{bucketEndpoint:!0,hostname:`${r}${n?``:`.accesspoint.s3-global`}.${i}`,signingRegion:`*`}},B=({useArnRegion:e,clientRegion:t,clientSigningRegion:n=t,bucketName:r,outpostId:i,dualstackEndpoint:a=!1,fipsEndpoint:o=!1,tlsCompatible:s=!0,accesspointName:c,isCustomEndpoint:l,hostnameSuffix:u})=>{j(t);let d=`${c}-${r.accountId}`;N(d,{tlsCompatible:s});let f=e?r.region:t,p=e?r.region:n;return O(r.service),N(i,{tlsCompatible:s}),L(o),{bucketEndpoint:!0,hostname:`${`${d}.${i}`}${l?``:`.s3-outposts.${f}`}.${u}`,signingRegion:p,signingService:`s3-outposts`}},ie=({useArnRegion:e,clientRegion:t,clientSigningRegion:n=t,bucketName:r,dualstackEndpoint:i=!1,fipsEndpoint:a=!1,tlsCompatible:o=!0,accesspointName:s,isCustomEndpoint:c,hostnameSuffix:l})=>{j(t);let u=`${s}-${r.accountId}`;N(u,{tlsCompatible:o});let d=e?r.region:t,f=e?r.region:n;return D(r.service),{bucketEndpoint:!0,hostname:`${u}${c?``:`.s3-accesspoint${a?`-fips`:``}${i?`.dualstack`:``}.${d}`}.${l}`,signingRegion:f}},V=e=>(t,i)=>async a=>{let{Bucket:o}=a.input,s=e.bucketEndpoint,c=a.request;if(r.HttpRequest.isInstance(c)){if(e.bucketEndpoint)c.hostname=o;else if(n.validate(o)){let t=n.parse(o),r=await e.region(),a=await e.useDualstackEndpoint(),l=await e.useFipsEndpoint(),{partition:u,signingRegion:d=r}=await e.regionInfoProvider(r,{useDualstackEndpoint:a,useFipsEndpoint:l})||{},f=await e.useArnRegion(),{hostname:p,bucketEndpoint:m,signingRegion:h,signingService:g}=z({bucketName:t,baseHostname:c.hostname,accelerateEndpoint:e.useAccelerateEndpoint,dualstackEndpoint:a,fipsEndpoint:l,pathStyleEndpoint:e.forcePathStyle,tlsCompatible:c.protocol===`https:`,useArnRegion:f,clientPartition:u,clientSigningRegion:d,clientRegion:r,isCustomEndpoint:e.isCustomEndpoint,disableMultiregionAccessPoints:await e.disableMultiregionAccessPoints()});h&&h!==d&&(i.signing_region=h),g&&g!==`s3`&&(i.signing_service=g),c.hostname=p,s=m}else{let t=await e.region(),n=await e.useDualstackEndpoint(),r=await e.useFipsEndpoint(),{hostname:i,bucketEndpoint:a}=z({bucketName:o,clientRegion:t,baseHostname:c.hostname,accelerateEndpoint:e.useAccelerateEndpoint,dualstackEndpoint:n,fipsEndpoint:r,pathStyleEndpoint:e.forcePathStyle,tlsCompatible:c.protocol===`https:`,isCustomEndpoint:e.isCustomEndpoint});c.hostname=i,s=a}s&&(c.path=c.path.replace(/^(\/)?[^\/]+/,``),c.path===``&&(c.path=`/`))}return t({...a,request:c})},oe={tags:[`BUCKET_ENDPOINT`],name:`bucketEndpointMiddleware`,relation:`before`,toMiddleware:`hostHeaderMiddleware`,override:!0},H=e=>({applyToStack:t=>{t.addRelativeTo(V(e),oe)}});function se(e){let{bucketEndpoint:t=!1,forcePathStyle:n=!1,useAccelerateEndpoint:r=!1,useArnRegion:i,disableMultiregionAccessPoints:a=!1}=e;return Object.assign(e,{bucketEndpoint:t,forcePathStyle:n,useAccelerateEndpoint:r,useArnRegion:typeof i==`function`?i:()=>Promise.resolve(i),disableMultiregionAccessPoints:typeof a==`function`?a:()=>Promise.resolve(a)})}e.NODE_DISABLE_MULTIREGION_ACCESS_POINT_CONFIG_OPTIONS=o,e.NODE_DISABLE_MULTIREGION_ACCESS_POINT_ENV_NAME=i,e.NODE_DISABLE_MULTIREGION_ACCESS_POINT_INI_NAME=a,e.NODE_USE_ARN_REGION_CONFIG_OPTIONS=u,e.NODE_USE_ARN_REGION_ENV_NAME=s,e.NODE_USE_ARN_REGION_INI_NAME=l,e.bucketEndpointMiddleware=V,e.bucketEndpointMiddlewareOptions=oe,e.bucketHostname=z,e.getArnResources=F,e.getBucketEndpointPlugin=H,e.getSuffixForArnEndpoint=C,e.resolveBucketEndpointConfig=se,e.validateAccountId=M,e.validateDNSHostLabel=N,e.validateNoDualstack=I,e.validateNoFIPS=L,e.validateOutpostService=O,e.validatePartition=k,e.validateRegion=A})),Ms=i((e=>{var t=ys(),n=y(),r=class e{bytes;constructor(e){if(this.bytes=e,e.byteLength!==8)throw Error(`Int64 buffers must be exactly 8 bytes`)}static fromNumber(t){if(t>0x8000000000000000||t<-0x8000000000000000)throw Error(`${t} is too large (or, if negative, too small) to represent as an Int64`);let n=new Uint8Array(8);for(let e=7,r=Math.abs(Math.round(t));e>-1&&r>0;e--,r/=256)n[e]=r;return t<0&&i(n),new e(n)}valueOf(){let e=this.bytes.slice(0),t=e[0]&128;return t&&i(e),parseInt(n.toHex(e),16)*(t?-1:1)}toString(){return String(this.valueOf())}};function i(e){for(let t=0;t<8;t++)e[t]^=255;for(let t=7;t>-1&&(e[t]++,e[t]===0);t--);}var a=class{toUtf8;fromUtf8;constructor(e,t){this.toUtf8=e,this.fromUtf8=t}format(e){let t=[];for(let n of Object.keys(e)){let r=this.fromUtf8(n);t.push(Uint8Array.from([r.byteLength]),r,this.formatHeaderValue(e[n]))}let n=new Uint8Array(t.reduce((e,t)=>e+t.byteLength,0)),r=0;for(let e of t)n.set(e,r),r+=e.byteLength;return n}formatHeaderValue(e){switch(e.type){case`boolean`:return Uint8Array.from([+!e.value]);case`byte`:return Uint8Array.from([2,e.value]);case`short`:let t=new DataView(new ArrayBuffer(3));return t.setUint8(0,3),t.setInt16(1,e.value,!1),new Uint8Array(t.buffer);case`integer`:let i=new DataView(new ArrayBuffer(5));return i.setUint8(0,4),i.setInt32(1,e.value,!1),new Uint8Array(i.buffer);case`long`:let a=new Uint8Array(9);return a[0]=5,a.set(e.value.bytes,1),a;case`binary`:let o=new DataView(new ArrayBuffer(3+e.value.byteLength));o.setUint8(0,6),o.setUint16(1,e.value.byteLength,!1);let s=new Uint8Array(o.buffer);return s.set(e.value,3),s;case`string`:let c=this.fromUtf8(e.value),l=new DataView(new ArrayBuffer(3+c.byteLength));l.setUint8(0,7),l.setUint16(1,c.byteLength,!1);let u=new Uint8Array(l.buffer);return u.set(c,3),u;case`timestamp`:let d=new Uint8Array(9);return d[0]=8,d.set(r.fromNumber(e.value.valueOf()).bytes,1),d;case`uuid`:if(!g.test(e.value))throw Error(`Invalid UUID received: ${e.value}`);let f=new Uint8Array(17);return f[0]=9,f.set(n.fromHex(e.value.replace(/\-/g,``)),1),f}}parse(e){let t={},i=0;for(;i{var t=Ms();function n(e){let t=0,n=0,r=null,i=null,a=e=>{if(typeof e!=`number`)throw Error(`Attempted to allocate an event message where size was not a number: `+e);t=e,n=4,r=new Uint8Array(e),new DataView(r.buffer).setUint32(0,e,!1)},o=async function*(){let o=e[Symbol.asyncIterator]();for(;;){let{value:e,done:s}=await o.next();if(s){if(!t)return;if(t===n)yield r;else throw Error(`Truncated event message received.`);return}let c=e.length,l=0;for(;lnew i(e)})),Ps=i((e=>{var n=Ns(),r=t(`stream`);async function*i(e){let t=!1,n=!1,r=[];for(e.on(`error`,e=>{if(t||=!0,e)throw e}),e.on(`data`,e=>{r.push(e)}),e.on(`end`,()=>{t=!0});!n;){let e=await new Promise(e=>setTimeout(()=>e(r.shift()),0));e&&(yield e),n=t&&r.length===0}}var a=class{universalMarshaller;constructor({utf8Encoder:e,utf8Decoder:t}){this.universalMarshaller=new n.EventStreamMarshaller({utf8Decoder:t,utf8Encoder:e})}deserialize(e,t){let n=typeof e[Symbol.asyncIterator]==`function`?e:i(e);return this.universalMarshaller.deserialize(n,t)}serialize(e,t){return r.Readable.from(this.universalMarshaller.serialize(e,t))}};e.EventStreamMarshaller=a,e.eventStreamSerdeProvider=e=>new a(e)})),Fs=i((e=>{var n=t(`fs`),r=p(),i=t(`stream`),a=class extends i.Writable{hash;constructor(e,t){super(t),this.hash=e}_write(e,t,n){try{this.hash.update(r.toUint8Array(e))}catch(e){return n(e)}n()}};let o=(e,t)=>new Promise((r,i)=>{if(!s(t)){i(Error(`Unable to calculate hash for non-file streams.`));return}let o=n.createReadStream(t.path,{start:t.start,end:t.end}),c=new e,l=new a(c);o.pipe(l),o.on(`error`,e=>{l.end(),i(e)}),l.on(`error`,i),l.on(`finish`,function(){c.digest().then(r).catch(i)})}),s=e=>typeof e.path==`string`;e.fileStreamHasher=o,e.readableStreamHasher=(e,t)=>{if(t.readableFlowing!==null)throw Error(`Unable to calculate hash for flowing readable stream`);let n=new e,r=new a(n);return t.pipe(r),new Promise((e,i)=>{t.on(`error`,e=>{r.end(),i(e)}),r.on(`error`,i),r.on(`finish`,()=>{n.digest().then(e).catch(i)})})}})),Is=i((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.getRuntimeConfig=void 0;let n=(ee(),e(R)),r=V(),i=oe(),a=w(),o=ie(),s=m(),c=v(),l=p(),u=Ts(),d=ws(),f=Os();t.getRuntimeConfig=e=>({apiVersion:`2006-03-01`,base64Decoder:e?.base64Decoder??s.fromBase64,base64Encoder:e?.base64Encoder??s.toBase64,disableHostPrefix:e?.disableHostPrefix??!1,endpointProvider:e?.endpointProvider??d.defaultEndpointResolver,extensions:e?.extensions??[],getAwsChunkedEncodingStream:e?.getAwsChunkedEncodingStream??c.getAwsChunkedEncodingStream,httpAuthSchemeProvider:e?.httpAuthSchemeProvider??u.defaultS3HttpAuthSchemeProvider,httpAuthSchemes:e?.httpAuthSchemes??[{schemeId:`aws.auth#sigv4`,identityProvider:e=>e.getIdentityProvider(`aws.auth#sigv4`),signer:new n.AwsSdkSigV4Signer},{schemeId:`aws.auth#sigv4a`,identityProvider:e=>e.getIdentityProvider(`aws.auth#sigv4a`),signer:new n.AwsSdkSigV4ASigner}],logger:e?.logger??new a.NoOpLogger,protocol:e?.protocol??r.S3RestXmlProtocol,protocolSettings:e?.protocolSettings??{defaultNamespace:`com.amazonaws.s3`,errorTypeRegistries:f.errorTypeRegistries,xmlNamespace:`http://s3.amazonaws.com/doc/2006-03-01/`,version:`2006-03-01`,serviceTarget:`AmazonS3`},sdkStreamMixin:e?.sdkStreamMixin??c.sdkStreamMixin,serviceId:e?.serviceId??`S3`,signerConstructor:e?.signerConstructor??i.SignatureV4MultiRegion,signingEscapePath:e?.signingEscapePath??!1,urlParser:e?.urlParser??o.parseUrl,useArnRegion:e?.useArnRegion??void 0,utf8Decoder:e?.utf8Decoder??l.fromUtf8,utf8Encoder:e?.utf8Encoder??l.toUtf8})})),Ls=i((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.getRuntimeConfig=void 0;let n=(x(),e(g)).__importDefault(ks()),r=(l(),e(d)),i=(ee(),e(R)),a=As(),o=js(),s=xs(),c=V(),f=j(),p=A(),m=Ps(),h=F(),v=Fs(),y=I(),b=ce(),C=S(),T=w(),E=z(),D=L(),O=u(),k=Is();t.getRuntimeConfig=e=>{(0,T.emitWarningIfUnsupportedVersion)(process.version);let t=(0,D.resolveDefaultsModeConfig)(e),l=()=>t().then(T.loadConfigsForDefaultMode),u=(0,k.getRuntimeConfig)(e);(0,r.emitWarningIfUnsupportedVersion)(process.version);let d={profile:e?.profile,logger:u.logger};return{...u,...e,runtime:`node`,defaultsMode:t,authSchemePreference:e?.authSchemePreference??(0,b.loadConfig)(i.NODE_AUTH_SCHEME_PREFERENCE_OPTIONS,d),bodyLengthChecker:e?.bodyLengthChecker??E.calculateBodyLength,credentialDefaultProvider:e?.credentialDefaultProvider??a.defaultProvider,defaultUserAgentProvider:e?.defaultUserAgentProvider??(0,f.createDefaultUserAgentProvider)({serviceId:u.serviceId,clientVersion:n.default.version}),disableS3ExpressSessionAuth:e?.disableS3ExpressSessionAuth??(0,b.loadConfig)(c.NODE_DISABLE_S3_EXPRESS_SESSION_AUTH_OPTIONS,d),eventStreamSerdeProvider:e?.eventStreamSerdeProvider??m.eventStreamSerdeProvider,maxAttempts:e?.maxAttempts??(0,b.loadConfig)(y.NODE_MAX_ATTEMPT_CONFIG_OPTIONS,e),md5:e?.md5??h.Hash.bind(null,`md5`),region:e?.region??(0,b.loadConfig)(p.NODE_REGION_CONFIG_OPTIONS,{...p.NODE_REGION_CONFIG_FILE_OPTIONS,...d}),requestChecksumCalculation:e?.requestChecksumCalculation??(0,b.loadConfig)(s.NODE_REQUEST_CHECKSUM_CALCULATION_CONFIG_OPTIONS,d),requestHandler:C.NodeHttpHandler.create(e?.requestHandler??l),responseChecksumValidation:e?.responseChecksumValidation??(0,b.loadConfig)(s.NODE_RESPONSE_CHECKSUM_VALIDATION_CONFIG_OPTIONS,d),retryMode:e?.retryMode??(0,b.loadConfig)({...y.NODE_RETRY_MODE_CONFIG_OPTIONS,default:async()=>(await l()).retryMode||O.DEFAULT_RETRY_MODE},e),sha1:e?.sha1??h.Hash.bind(null,`sha1`),sha256:e?.sha256??h.Hash.bind(null,`sha256`),sigv4aSigningRegionSet:e?.sigv4aSigningRegionSet??(0,b.loadConfig)(i.NODE_SIGV4A_CONFIG_OPTIONS,d),streamCollector:e?.streamCollector??C.streamCollector,streamHasher:e?.streamHasher??v.readableStreamHasher,useArnRegion:e?.useArnRegion??(0,b.loadConfig)(o.NODE_USE_ARN_REGION_CONFIG_OPTIONS,d),useDualstackEndpoint:e?.useDualstackEndpoint??(0,b.loadConfig)(p.NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS,d),useFipsEndpoint:e?.useFipsEndpoint??(0,b.loadConfig)(p.NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS,d),userAgentAppId:e?.userAgentAppId??(0,b.loadConfig)(f.NODE_APP_ID_CONFIG_OPTIONS,d)}}})),Rs=i((e=>{function t(e){return t=>async n=>{let r={...n.input};for(let t of[{target:`SSECustomerKey`,hash:`SSECustomerKeyMD5`},{target:`CopySourceSSECustomerKey`,hash:`CopySourceSSECustomerKeyMD5`}]){let n=r[t.target];if(n){let a;typeof n==`string`?i(n,e)?a=e.base64Decoder(n):(a=e.utf8Decoder(n),r[t.target]=e.base64Encoder(a)):(a=ArrayBuffer.isView(n)?new Uint8Array(n.buffer,n.byteOffset,n.byteLength):new Uint8Array(n),r[t.target]=e.base64Encoder(a));let o=new e.md5;o.update(a),r[t.hash]=e.base64Encoder(await o.digest())}}return t({...n,input:r})}}let n={name:`ssecMiddleware`,step:`initialize`,tags:[`SSE`],override:!0},r=e=>({applyToStack:r=>{r.add(t(e),n)}});function i(e,t){if(!/^(?:[A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e))return!1;try{return t.base64Decoder(e).length===32}catch{return!1}}e.getSsecPlugin=r,e.isValidBase64EncodedSSECustomerKey=i,e.ssecMiddleware=t,e.ssecMiddlewareOptions=n})),zs=i((e=>{function t(e){return t=>async n=>{let{CreateBucketConfiguration:r}=n.input,i=await e.region();return!r?.LocationConstraint&&!r?.Location&&i!==`us-east-1`&&(n.input.CreateBucketConfiguration=n.input.CreateBucketConfiguration??{},n.input.CreateBucketConfiguration.LocationConstraint=i),t(n)}}let n={step:`initialize`,tags:[`LOCATION_CONSTRAINT`,`CREATE_BUCKET_CONFIGURATION`],name:`locationConstraintMiddleware`,override:!0};e.getLocationConstraintPlugin=e=>({applyToStack:r=>{r.add(t(e),n)}}),e.locationConstraintMiddleware=t,e.locationConstraintMiddlewareOptions=n})),Bs=i((e=>{let t=()=>{let e=new WeakSet;return(t,n)=>{if(typeof n==`object`&&n){if(e.has(n))return`[Circular]`;e.add(n)}return n}},n=e=>new Promise(t=>setTimeout(t,e*1e3)),r={minDelay:2,maxDelay:120};e.WaiterState=void 0,(function(e){e.ABORTED=`ABORTED`,e.FAILURE=`FAILURE`,e.SUCCESS=`SUCCESS`,e.RETRY=`RETRY`,e.TIMEOUT=`TIMEOUT`})(e.WaiterState||={});let i=n=>{if(n.state===e.WaiterState.ABORTED){let e=Error(`${JSON.stringify({...n,reason:`Request was aborted`},t())}`);throw e.name=`AbortError`,e}else if(n.state===e.WaiterState.TIMEOUT){let e=Error(`${JSON.stringify({...n,reason:`Waiter has timed out`},t())}`);throw e.name=`TimeoutError`,e}else if(n.state!==e.WaiterState.SUCCESS)throw Error(`${JSON.stringify(n,t())}`);return n},a=async({minDelay:t,maxDelay:r,maxWaitTime:i,abortController:a,client:l,abortSignal:u},d,f)=>{let p={},[m,h]=[t*1e3,r*1e3],g=0,v=Date.now()+i*1e3,y=Date.now()+6e4,b=!1;for(;;){if(g>0){let t=c(m,h,g,v);if(a?.signal?.aborted||u?.aborted){let t=`AbortController signal aborted.`;return p[t]|=0,p[t]+=1,{state:e.WaiterState.ABORTED,observedResponses:p}}if(Date.now()+t>v)return{state:e.WaiterState.TIMEOUT,observedResponses:p};await n(t/1e3)}let{state:t,reason:r}=await f(l,d);if(r){let e=s(r);p[e]|=0,p[e]+=1}if(t!==e.WaiterState.RETRY)return{state:t,reason:r,final:r,observedResponses:p};g+=1,!b&&Date.now()>=y&&(o(p,l),b=!0)}},o=(e={},t)=>{let n=Object.keys(e),r=0;for(let t of n){let n=e[t]|0;t.startsWith(`403:`)&&(r+=n)}let i=t?.config?.logger,a=typeof i?.warn==`function`&&!i.constructor?.name?.includes?.(`NoOpLogger`)?i:console;(r>=3||n[n.length-1].startsWith(`403:`))&&a.warn(`@smithy/util-waiter WARN - 403 status code encountered during waiter polling.`)},s=e=>{let n=e?.$response?.statusCode??e?.$metadata?.httpStatusCode;return e?.$responseBodyText?`${n?n+`: `:``}Deserialization error for body: ${e.$responseBodyText}`:n?e?.$response||e?.message?`${n??`Unknown`}: ${e?.message}`:`${n}: OK`:String(e?.message??JSON.stringify(e,t())??`Unknown`)},c=(e,t,n,r)=>{if(n>Math.log(t/e)/Math.log(2)+1)return t;let i=e*2**(n-1),a=l(e,Math.min(i,t));if(Date.now()+a>r){let e=r-Date.now();return Math.max(0,e-500)}return a},l=(e,t)=>e+Math.random()*(t-e),u=e=>{if(e.maxWaitTime<=0)throw Error(`WaiterConfiguration.maxWaitTime must be greater than 0`);if(e.minDelay<=0)throw Error(`WaiterConfiguration.minDelay must be greater than 0`);if(e.maxDelay<=0)throw Error(`WaiterConfiguration.maxDelay must be greater than 0`);if(e.maxWaitTime<=e.minDelay)throw Error(`WaiterConfiguration.maxWaitTime [${e.maxWaitTime}] must be greater than WaiterConfiguration.minDelay [${e.minDelay}] for this waiter`);if(e.maxDelay{let n;return{clearListener(){typeof t.removeEventListener==`function`&&t.removeEventListener(`abort`,n)},aborted:new Promise(r=>{n=()=>r({state:e.WaiterState.ABORTED}),typeof t.addEventListener==`function`?t.addEventListener(`abort`,n):t.onabort=n})}};e.checkExceptions=i,e.createWaiter=async(e,t,n)=>{let i={...r,...e};u(i);let o=[a(i,t,n)],s=[];if(e.abortSignal){let{aborted:t,clearListener:n}=d(e.abortSignal);s.push(n),o.push(t)}if(e.abortController?.signal){let{aborted:t,clearListener:n}=d(e.abortController.signal);s.push(n),o.push(t)}return Promise.race(o).then(e=>{for(let e of s)e();return e})},e.waiterServiceDefaults=r})),Vs=i((t=>{var n=os(),r=xs(),i=E(),a=O(),o=D(),s=V(),l=ne(),u=A(),d=(k(),e(re)),f=(C(),e(h)),p=Ss(),m=N(),g=P(),v=I(),y=w(),b=Ts(),x=Os(),S=Ls(),T=te(),j=c(),M=Rs(),F=zs(),L=Bs(),R=Ds(),z=Es();let ee=e=>Object.assign(e,{useFipsEndpoint:e.useFipsEndpoint??!1,useDualstackEndpoint:e.useDualstackEndpoint??!1,forcePathStyle:e.forcePathStyle??!1,useAccelerateEndpoint:e.useAccelerateEndpoint??!1,useGlobalEndpoint:e.useGlobalEndpoint??!1,disableMultiregionAccessPoints:e.disableMultiregionAccessPoints??!1,defaultSigningName:`s3`,clientContextParams:e.clientContextParams??{}}),B={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`}};var ie=class extends y.Command.classBuilder().ep({...B,DisableS3ExpressSessionAuth:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`CreateSession`,{}).n(`S3Client`,`CreateSessionCommand`).sc(x.CreateSession$).build(){};let ae=e=>{let t=e.httpAuthSchemes,n=e.httpAuthSchemeProvider,r=e.credentials;return{setHttpAuthScheme(e){let n=t.findIndex(t=>t.schemeId===e.schemeId);n===-1?t.push(e):t.splice(n,1,e)},httpAuthSchemes(){return t},setHttpAuthSchemeProvider(e){n=e},httpAuthSchemeProvider(){return n},setCredentials(e){r=e},credentials(){return r}}},oe=e=>({httpAuthSchemes:e.httpAuthSchemes(),httpAuthSchemeProvider:e.httpAuthSchemeProvider(),credentials:e.credentials()}),H=(e,t)=>{let n=Object.assign(T.getAwsRegionExtensionConfiguration(e),y.getDefaultExtensionConfiguration(e),j.getHttpHandlerExtensionConfiguration(e),ae(e));return t.forEach(e=>e.configure(n)),Object.assign(e,T.resolveAwsRegionExtensionConfiguration(n),y.resolveDefaultRuntimeConfig(n),j.resolveHttpHandlerRuntimeConfig(n),oe(n))};var se=class extends y.Client{config;constructor(...[e]){let t=S.getRuntimeConfig(e||{});super(t),this.initConfig=t;let c=ee(t),h=l.resolveUserAgentConfig(c),y=r.resolveFlexibleChecksumsConfig(h),x=v.resolveRetryConfig(y),C=u.resolveRegionConfig(x),w=i.resolveHostHeaderConfig(C),T=g.resolveEndpointConfig(w),E=p.resolveEventStreamSerdeConfig(T),D=b.resolveHttpAuthSchemeConfig(E),O=H(s.resolveS3Config(D,{session:[()=>this,ie]}),e?.extensions||[]);this.config=O,this.middlewareStack.use(f.getSchemaSerdePlugin(this.config)),this.middlewareStack.use(l.getUserAgentPlugin(this.config)),this.middlewareStack.use(v.getRetryPlugin(this.config)),this.middlewareStack.use(m.getContentLengthPlugin(this.config)),this.middlewareStack.use(i.getHostHeaderPlugin(this.config)),this.middlewareStack.use(a.getLoggerPlugin(this.config)),this.middlewareStack.use(o.getRecursionDetectionPlugin(this.config)),this.middlewareStack.use(d.getHttpAuthSchemeEndpointRuleSetPlugin(this.config,{httpAuthSchemeParametersProvider:b.defaultS3HttpAuthSchemeParametersProvider,identityProviderConfigProvider:async e=>new d.DefaultIdentityProviderConfig({"aws.auth#sigv4":e.credentials,"aws.auth#sigv4a":e.credentials})})),this.middlewareStack.use(d.getHttpSigningPlugin(this.config)),this.middlewareStack.use(s.getValidateBucketNamePlugin(this.config)),this.middlewareStack.use(n.getAddExpectContinuePlugin(this.config)),this.middlewareStack.use(s.getRegionRedirectMiddlewarePlugin(this.config)),this.middlewareStack.use(s.getS3ExpressPlugin(this.config)),this.middlewareStack.use(s.getS3ExpressHttpSigningPlugin(this.config))}destroy(){super.destroy()}},ce=class extends y.Command.classBuilder().ep({...B,Bucket:{type:`contextParams`,name:`Bucket`},Key:{type:`contextParams`,name:`Key`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`AbortMultipartUpload`,{}).n(`S3Client`,`AbortMultipartUploadCommand`).sc(x.AbortMultipartUpload$).build(){},le=class extends y.Command.classBuilder().ep({...B,Bucket:{type:`contextParams`,name:`Bucket`},Key:{type:`contextParams`,name:`Key`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n),M.getSsecPlugin(n)]}).s(`AmazonS3`,`CompleteMultipartUpload`,{}).n(`S3Client`,`CompleteMultipartUploadCommand`).sc(x.CompleteMultipartUpload$).build(){},ue=class extends y.Command.classBuilder().ep({...B,DisableS3ExpressSessionAuth:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`},Key:{type:`contextParams`,name:`Key`},CopySource:{type:`contextParams`,name:`CopySource`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n),M.getSsecPlugin(n)]}).s(`AmazonS3`,`CopyObject`,{}).n(`S3Client`,`CopyObjectCommand`).sc(x.CopyObject$).build(){},de=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},DisableAccessPoints:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n),F.getLocationConstraintPlugin(n)]}).s(`AmazonS3`,`CreateBucket`,{}).n(`S3Client`,`CreateBucketCommand`).sc(x.CreateBucket$).build(){},fe=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,i){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),r.getFlexibleChecksumsPlugin(n,{requestAlgorithmMember:{httpHeader:`x-amz-sdk-checksum-algorithm`,name:`ChecksumAlgorithm`},requestChecksumRequired:!0})]}).s(`AmazonS3`,`CreateBucketMetadataConfiguration`,{}).n(`S3Client`,`CreateBucketMetadataConfigurationCommand`).sc(x.CreateBucketMetadataConfiguration$).build(){},pe=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,i){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),r.getFlexibleChecksumsPlugin(n,{requestAlgorithmMember:{httpHeader:`x-amz-sdk-checksum-algorithm`,name:`ChecksumAlgorithm`},requestChecksumRequired:!0})]}).s(`AmazonS3`,`CreateBucketMetadataTableConfiguration`,{}).n(`S3Client`,`CreateBucketMetadataTableConfigurationCommand`).sc(x.CreateBucketMetadataTableConfiguration$).build(){},me=class extends y.Command.classBuilder().ep({...B,Bucket:{type:`contextParams`,name:`Bucket`},Key:{type:`contextParams`,name:`Key`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n),M.getSsecPlugin(n)]}).s(`AmazonS3`,`CreateMultipartUpload`,{}).n(`S3Client`,`CreateMultipartUploadCommand`).sc(x.CreateMultipartUpload$).build(){},he=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions())]}).s(`AmazonS3`,`DeleteBucketAnalyticsConfiguration`,{}).n(`S3Client`,`DeleteBucketAnalyticsConfigurationCommand`).sc(x.DeleteBucketAnalyticsConfiguration$).build(){},ge=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions())]}).s(`AmazonS3`,`DeleteBucket`,{}).n(`S3Client`,`DeleteBucketCommand`).sc(x.DeleteBucket$).build(){},_e=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions())]}).s(`AmazonS3`,`DeleteBucketCors`,{}).n(`S3Client`,`DeleteBucketCorsCommand`).sc(x.DeleteBucketCors$).build(){},ve=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions())]}).s(`AmazonS3`,`DeleteBucketEncryption`,{}).n(`S3Client`,`DeleteBucketEncryptionCommand`).sc(x.DeleteBucketEncryption$).build(){},ye=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions())]}).s(`AmazonS3`,`DeleteBucketIntelligentTieringConfiguration`,{}).n(`S3Client`,`DeleteBucketIntelligentTieringConfigurationCommand`).sc(x.DeleteBucketIntelligentTieringConfiguration$).build(){},be=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions())]}).s(`AmazonS3`,`DeleteBucketInventoryConfiguration`,{}).n(`S3Client`,`DeleteBucketInventoryConfigurationCommand`).sc(x.DeleteBucketInventoryConfiguration$).build(){},U=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions())]}).s(`AmazonS3`,`DeleteBucketLifecycle`,{}).n(`S3Client`,`DeleteBucketLifecycleCommand`).sc(x.DeleteBucketLifecycle$).build(){},xe=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions())]}).s(`AmazonS3`,`DeleteBucketMetadataConfiguration`,{}).n(`S3Client`,`DeleteBucketMetadataConfigurationCommand`).sc(x.DeleteBucketMetadataConfiguration$).build(){},Se=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions())]}).s(`AmazonS3`,`DeleteBucketMetadataTableConfiguration`,{}).n(`S3Client`,`DeleteBucketMetadataTableConfigurationCommand`).sc(x.DeleteBucketMetadataTableConfiguration$).build(){},Ce=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions())]}).s(`AmazonS3`,`DeleteBucketMetricsConfiguration`,{}).n(`S3Client`,`DeleteBucketMetricsConfigurationCommand`).sc(x.DeleteBucketMetricsConfiguration$).build(){},we=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions())]}).s(`AmazonS3`,`DeleteBucketOwnershipControls`,{}).n(`S3Client`,`DeleteBucketOwnershipControlsCommand`).sc(x.DeleteBucketOwnershipControls$).build(){},Te=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions())]}).s(`AmazonS3`,`DeleteBucketPolicy`,{}).n(`S3Client`,`DeleteBucketPolicyCommand`).sc(x.DeleteBucketPolicy$).build(){},Ee=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions())]}).s(`AmazonS3`,`DeleteBucketReplication`,{}).n(`S3Client`,`DeleteBucketReplicationCommand`).sc(x.DeleteBucketReplication$).build(){},De=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions())]}).s(`AmazonS3`,`DeleteBucketTagging`,{}).n(`S3Client`,`DeleteBucketTaggingCommand`).sc(x.DeleteBucketTagging$).build(){},Oe=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions())]}).s(`AmazonS3`,`DeleteBucketWebsite`,{}).n(`S3Client`,`DeleteBucketWebsiteCommand`).sc(x.DeleteBucketWebsite$).build(){},ke=class extends y.Command.classBuilder().ep({...B,Bucket:{type:`contextParams`,name:`Bucket`},Key:{type:`contextParams`,name:`Key`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`DeleteObject`,{}).n(`S3Client`,`DeleteObjectCommand`).sc(x.DeleteObject$).build(){},Ae=class extends y.Command.classBuilder().ep({...B,Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,i){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),r.getFlexibleChecksumsPlugin(n,{requestAlgorithmMember:{httpHeader:`x-amz-sdk-checksum-algorithm`,name:`ChecksumAlgorithm`},requestChecksumRequired:!0}),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`DeleteObjects`,{}).n(`S3Client`,`DeleteObjectsCommand`).sc(x.DeleteObjects$).build(){},je=class extends y.Command.classBuilder().ep({...B,Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`DeleteObjectTagging`,{}).n(`S3Client`,`DeleteObjectTaggingCommand`).sc(x.DeleteObjectTagging$).build(){},W=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions())]}).s(`AmazonS3`,`DeletePublicAccessBlock`,{}).n(`S3Client`,`DeletePublicAccessBlockCommand`).sc(x.DeletePublicAccessBlock$).build(){},Me=class extends y.Command.classBuilder().ep({...B,Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`GetBucketAbac`,{}).n(`S3Client`,`GetBucketAbacCommand`).sc(x.GetBucketAbac$).build(){},Ne=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`GetBucketAccelerateConfiguration`,{}).n(`S3Client`,`GetBucketAccelerateConfigurationCommand`).sc(x.GetBucketAccelerateConfiguration$).build(){},Pe=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`GetBucketAcl`,{}).n(`S3Client`,`GetBucketAclCommand`).sc(x.GetBucketAcl$).build(){},Fe=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`GetBucketAnalyticsConfiguration`,{}).n(`S3Client`,`GetBucketAnalyticsConfigurationCommand`).sc(x.GetBucketAnalyticsConfiguration$).build(){},Ie=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`GetBucketCors`,{}).n(`S3Client`,`GetBucketCorsCommand`).sc(x.GetBucketCors$).build(){},Le=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`GetBucketEncryption`,{}).n(`S3Client`,`GetBucketEncryptionCommand`).sc(x.GetBucketEncryption$).build(){},Re=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`GetBucketIntelligentTieringConfiguration`,{}).n(`S3Client`,`GetBucketIntelligentTieringConfigurationCommand`).sc(x.GetBucketIntelligentTieringConfiguration$).build(){},ze=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`GetBucketInventoryConfiguration`,{}).n(`S3Client`,`GetBucketInventoryConfigurationCommand`).sc(x.GetBucketInventoryConfiguration$).build(){},Be=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`GetBucketLifecycleConfiguration`,{}).n(`S3Client`,`GetBucketLifecycleConfigurationCommand`).sc(x.GetBucketLifecycleConfiguration$).build(){},Ve=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`GetBucketLocation`,{}).n(`S3Client`,`GetBucketLocationCommand`).sc(x.GetBucketLocation$).build(){},He=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`GetBucketLogging`,{}).n(`S3Client`,`GetBucketLoggingCommand`).sc(x.GetBucketLogging$).build(){},Ue=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`GetBucketMetadataConfiguration`,{}).n(`S3Client`,`GetBucketMetadataConfigurationCommand`).sc(x.GetBucketMetadataConfiguration$).build(){},We=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`GetBucketMetadataTableConfiguration`,{}).n(`S3Client`,`GetBucketMetadataTableConfigurationCommand`).sc(x.GetBucketMetadataTableConfiguration$).build(){},Ge=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`GetBucketMetricsConfiguration`,{}).n(`S3Client`,`GetBucketMetricsConfigurationCommand`).sc(x.GetBucketMetricsConfiguration$).build(){},Ke=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`GetBucketNotificationConfiguration`,{}).n(`S3Client`,`GetBucketNotificationConfigurationCommand`).sc(x.GetBucketNotificationConfiguration$).build(){},qe=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`GetBucketOwnershipControls`,{}).n(`S3Client`,`GetBucketOwnershipControlsCommand`).sc(x.GetBucketOwnershipControls$).build(){},Je=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions())]}).s(`AmazonS3`,`GetBucketPolicy`,{}).n(`S3Client`,`GetBucketPolicyCommand`).sc(x.GetBucketPolicy$).build(){},Ye=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`GetBucketPolicyStatus`,{}).n(`S3Client`,`GetBucketPolicyStatusCommand`).sc(x.GetBucketPolicyStatus$).build(){},Xe=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`GetBucketReplication`,{}).n(`S3Client`,`GetBucketReplicationCommand`).sc(x.GetBucketReplication$).build(){},Ze=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`GetBucketRequestPayment`,{}).n(`S3Client`,`GetBucketRequestPaymentCommand`).sc(x.GetBucketRequestPayment$).build(){},Qe=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`GetBucketTagging`,{}).n(`S3Client`,`GetBucketTaggingCommand`).sc(x.GetBucketTagging$).build(){},$e=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`GetBucketVersioning`,{}).n(`S3Client`,`GetBucketVersioningCommand`).sc(x.GetBucketVersioning$).build(){},G=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`GetBucketWebsite`,{}).n(`S3Client`,`GetBucketWebsiteCommand`).sc(x.GetBucketWebsite$).build(){},et=class extends y.Command.classBuilder().ep({...B,Bucket:{type:`contextParams`,name:`Bucket`},Key:{type:`contextParams`,name:`Key`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`GetObjectAcl`,{}).n(`S3Client`,`GetObjectAclCommand`).sc(x.GetObjectAcl$).build(){},tt=class extends y.Command.classBuilder().ep({...B,Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n),M.getSsecPlugin(n)]}).s(`AmazonS3`,`GetObjectAttributes`,{}).n(`S3Client`,`GetObjectAttributesCommand`).sc(x.GetObjectAttributes$).build(){},nt=class extends y.Command.classBuilder().ep({...B,Bucket:{type:`contextParams`,name:`Bucket`},Key:{type:`contextParams`,name:`Key`}}).m(function(e,t,n,i){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),r.getFlexibleChecksumsPlugin(n,{requestChecksumRequired:!1,requestValidationModeMember:`ChecksumMode`,responseAlgorithms:[`CRC64NVME`,`CRC32`,`CRC32C`,`SHA256`,`SHA1`,`SHA512`,`MD5`,`XXHASH64`,`XXHASH3`,`XXHASH128`]}),M.getSsecPlugin(n),s.getS3ExpiresMiddlewarePlugin(n)]}).s(`AmazonS3`,`GetObject`,{}).n(`S3Client`,`GetObjectCommand`).sc(x.GetObject$).build(){},rt=class extends y.Command.classBuilder().ep({...B,Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`GetObjectLegalHold`,{}).n(`S3Client`,`GetObjectLegalHoldCommand`).sc(x.GetObjectLegalHold$).build(){},it=class extends y.Command.classBuilder().ep({...B,Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`GetObjectLockConfiguration`,{}).n(`S3Client`,`GetObjectLockConfigurationCommand`).sc(x.GetObjectLockConfiguration$).build(){},at=class extends y.Command.classBuilder().ep({...B,Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`GetObjectRetention`,{}).n(`S3Client`,`GetObjectRetentionCommand`).sc(x.GetObjectRetention$).build(){},ot=class extends y.Command.classBuilder().ep({...B,Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`GetObjectTagging`,{}).n(`S3Client`,`GetObjectTaggingCommand`).sc(x.GetObjectTagging$).build(){},st=class extends y.Command.classBuilder().ep({...B,Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions())]}).s(`AmazonS3`,`GetObjectTorrent`,{}).n(`S3Client`,`GetObjectTorrentCommand`).sc(x.GetObjectTorrent$).build(){},ct=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`GetPublicAccessBlock`,{}).n(`S3Client`,`GetPublicAccessBlockCommand`).sc(x.GetPublicAccessBlock$).build(){},lt=class extends y.Command.classBuilder().ep({...B,Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`HeadBucket`,{}).n(`S3Client`,`HeadBucketCommand`).sc(x.HeadBucket$).build(){},ut=class extends y.Command.classBuilder().ep({...B,Bucket:{type:`contextParams`,name:`Bucket`},Key:{type:`contextParams`,name:`Key`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n),M.getSsecPlugin(n),s.getS3ExpiresMiddlewarePlugin(n)]}).s(`AmazonS3`,`HeadObject`,{}).n(`S3Client`,`HeadObjectCommand`).sc(x.HeadObject$).build(){},dt=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`ListBucketAnalyticsConfigurations`,{}).n(`S3Client`,`ListBucketAnalyticsConfigurationsCommand`).sc(x.ListBucketAnalyticsConfigurations$).build(){},ft=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`ListBucketIntelligentTieringConfigurations`,{}).n(`S3Client`,`ListBucketIntelligentTieringConfigurationsCommand`).sc(x.ListBucketIntelligentTieringConfigurations$).build(){},pt=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`ListBucketInventoryConfigurations`,{}).n(`S3Client`,`ListBucketInventoryConfigurationsCommand`).sc(x.ListBucketInventoryConfigurations$).build(){},mt=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`ListBucketMetricsConfigurations`,{}).n(`S3Client`,`ListBucketMetricsConfigurationsCommand`).sc(x.ListBucketMetricsConfigurations$).build(){},ht=class extends y.Command.classBuilder().ep(B).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`ListBuckets`,{}).n(`S3Client`,`ListBucketsCommand`).sc(x.ListBuckets$).build(){},gt=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`ListDirectoryBuckets`,{}).n(`S3Client`,`ListDirectoryBucketsCommand`).sc(x.ListDirectoryBuckets$).build(){},_t=class extends y.Command.classBuilder().ep({...B,Bucket:{type:`contextParams`,name:`Bucket`},Prefix:{type:`contextParams`,name:`Prefix`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`ListMultipartUploads`,{}).n(`S3Client`,`ListMultipartUploadsCommand`).sc(x.ListMultipartUploads$).build(){},vt=class extends y.Command.classBuilder().ep({...B,Bucket:{type:`contextParams`,name:`Bucket`},Prefix:{type:`contextParams`,name:`Prefix`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`ListObjects`,{}).n(`S3Client`,`ListObjectsCommand`).sc(x.ListObjects$).build(){},yt=class extends y.Command.classBuilder().ep({...B,Bucket:{type:`contextParams`,name:`Bucket`},Prefix:{type:`contextParams`,name:`Prefix`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`ListObjectsV2`,{}).n(`S3Client`,`ListObjectsV2Command`).sc(x.ListObjectsV2$).build(){},bt=class extends y.Command.classBuilder().ep({...B,Bucket:{type:`contextParams`,name:`Bucket`},Prefix:{type:`contextParams`,name:`Prefix`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`ListObjectVersions`,{}).n(`S3Client`,`ListObjectVersionsCommand`).sc(x.ListObjectVersions$).build(){},xt=class extends y.Command.classBuilder().ep({...B,Bucket:{type:`contextParams`,name:`Bucket`},Key:{type:`contextParams`,name:`Key`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n),M.getSsecPlugin(n)]}).s(`AmazonS3`,`ListParts`,{}).n(`S3Client`,`ListPartsCommand`).sc(x.ListParts$).build(){},St=class extends y.Command.classBuilder().ep({...B,Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,i){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),r.getFlexibleChecksumsPlugin(n,{requestAlgorithmMember:{httpHeader:`x-amz-sdk-checksum-algorithm`,name:`ChecksumAlgorithm`},requestChecksumRequired:!1})]}).s(`AmazonS3`,`PutBucketAbac`,{}).n(`S3Client`,`PutBucketAbacCommand`).sc(x.PutBucketAbac$).build(){},Ct=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,i){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),r.getFlexibleChecksumsPlugin(n,{requestAlgorithmMember:{httpHeader:`x-amz-sdk-checksum-algorithm`,name:`ChecksumAlgorithm`},requestChecksumRequired:!1})]}).s(`AmazonS3`,`PutBucketAccelerateConfiguration`,{}).n(`S3Client`,`PutBucketAccelerateConfigurationCommand`).sc(x.PutBucketAccelerateConfiguration$).build(){},wt=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,i){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),r.getFlexibleChecksumsPlugin(n,{requestAlgorithmMember:{httpHeader:`x-amz-sdk-checksum-algorithm`,name:`ChecksumAlgorithm`},requestChecksumRequired:!0})]}).s(`AmazonS3`,`PutBucketAcl`,{}).n(`S3Client`,`PutBucketAclCommand`).sc(x.PutBucketAcl$).build(){},Tt=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions())]}).s(`AmazonS3`,`PutBucketAnalyticsConfiguration`,{}).n(`S3Client`,`PutBucketAnalyticsConfigurationCommand`).sc(x.PutBucketAnalyticsConfiguration$).build(){},Et=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,i){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),r.getFlexibleChecksumsPlugin(n,{requestAlgorithmMember:{httpHeader:`x-amz-sdk-checksum-algorithm`,name:`ChecksumAlgorithm`},requestChecksumRequired:!0})]}).s(`AmazonS3`,`PutBucketCors`,{}).n(`S3Client`,`PutBucketCorsCommand`).sc(x.PutBucketCors$).build(){},Dt=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,i){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),r.getFlexibleChecksumsPlugin(n,{requestAlgorithmMember:{httpHeader:`x-amz-sdk-checksum-algorithm`,name:`ChecksumAlgorithm`},requestChecksumRequired:!0})]}).s(`AmazonS3`,`PutBucketEncryption`,{}).n(`S3Client`,`PutBucketEncryptionCommand`).sc(x.PutBucketEncryption$).build(){},Ot=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions())]}).s(`AmazonS3`,`PutBucketIntelligentTieringConfiguration`,{}).n(`S3Client`,`PutBucketIntelligentTieringConfigurationCommand`).sc(x.PutBucketIntelligentTieringConfiguration$).build(){},kt=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions())]}).s(`AmazonS3`,`PutBucketInventoryConfiguration`,{}).n(`S3Client`,`PutBucketInventoryConfigurationCommand`).sc(x.PutBucketInventoryConfiguration$).build(){},At=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,i){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),r.getFlexibleChecksumsPlugin(n,{requestAlgorithmMember:{httpHeader:`x-amz-sdk-checksum-algorithm`,name:`ChecksumAlgorithm`},requestChecksumRequired:!0}),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`PutBucketLifecycleConfiguration`,{}).n(`S3Client`,`PutBucketLifecycleConfigurationCommand`).sc(x.PutBucketLifecycleConfiguration$).build(){},jt=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,i){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),r.getFlexibleChecksumsPlugin(n,{requestAlgorithmMember:{httpHeader:`x-amz-sdk-checksum-algorithm`,name:`ChecksumAlgorithm`},requestChecksumRequired:!0})]}).s(`AmazonS3`,`PutBucketLogging`,{}).n(`S3Client`,`PutBucketLoggingCommand`).sc(x.PutBucketLogging$).build(){},Mt=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions())]}).s(`AmazonS3`,`PutBucketMetricsConfiguration`,{}).n(`S3Client`,`PutBucketMetricsConfigurationCommand`).sc(x.PutBucketMetricsConfiguration$).build(){},Nt=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions())]}).s(`AmazonS3`,`PutBucketNotificationConfiguration`,{}).n(`S3Client`,`PutBucketNotificationConfigurationCommand`).sc(x.PutBucketNotificationConfiguration$).build(){},Pt=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,i){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),r.getFlexibleChecksumsPlugin(n,{requestAlgorithmMember:{httpHeader:`x-amz-sdk-checksum-algorithm`,name:`ChecksumAlgorithm`},requestChecksumRequired:!0})]}).s(`AmazonS3`,`PutBucketOwnershipControls`,{}).n(`S3Client`,`PutBucketOwnershipControlsCommand`).sc(x.PutBucketOwnershipControls$).build(){},Ft=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,i){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),r.getFlexibleChecksumsPlugin(n,{requestAlgorithmMember:{httpHeader:`x-amz-sdk-checksum-algorithm`,name:`ChecksumAlgorithm`},requestChecksumRequired:!0})]}).s(`AmazonS3`,`PutBucketPolicy`,{}).n(`S3Client`,`PutBucketPolicyCommand`).sc(x.PutBucketPolicy$).build(){},It=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,i){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),r.getFlexibleChecksumsPlugin(n,{requestAlgorithmMember:{httpHeader:`x-amz-sdk-checksum-algorithm`,name:`ChecksumAlgorithm`},requestChecksumRequired:!0})]}).s(`AmazonS3`,`PutBucketReplication`,{}).n(`S3Client`,`PutBucketReplicationCommand`).sc(x.PutBucketReplication$).build(){},Lt=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,i){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),r.getFlexibleChecksumsPlugin(n,{requestAlgorithmMember:{httpHeader:`x-amz-sdk-checksum-algorithm`,name:`ChecksumAlgorithm`},requestChecksumRequired:!0})]}).s(`AmazonS3`,`PutBucketRequestPayment`,{}).n(`S3Client`,`PutBucketRequestPaymentCommand`).sc(x.PutBucketRequestPayment$).build(){},Rt=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,i){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),r.getFlexibleChecksumsPlugin(n,{requestAlgorithmMember:{httpHeader:`x-amz-sdk-checksum-algorithm`,name:`ChecksumAlgorithm`},requestChecksumRequired:!0})]}).s(`AmazonS3`,`PutBucketTagging`,{}).n(`S3Client`,`PutBucketTaggingCommand`).sc(x.PutBucketTagging$).build(){},zt=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,i){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),r.getFlexibleChecksumsPlugin(n,{requestAlgorithmMember:{httpHeader:`x-amz-sdk-checksum-algorithm`,name:`ChecksumAlgorithm`},requestChecksumRequired:!0})]}).s(`AmazonS3`,`PutBucketVersioning`,{}).n(`S3Client`,`PutBucketVersioningCommand`).sc(x.PutBucketVersioning$).build(){},Bt=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,i){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),r.getFlexibleChecksumsPlugin(n,{requestAlgorithmMember:{httpHeader:`x-amz-sdk-checksum-algorithm`,name:`ChecksumAlgorithm`},requestChecksumRequired:!0})]}).s(`AmazonS3`,`PutBucketWebsite`,{}).n(`S3Client`,`PutBucketWebsiteCommand`).sc(x.PutBucketWebsite$).build(){},Vt=class extends y.Command.classBuilder().ep({...B,Bucket:{type:`contextParams`,name:`Bucket`},Key:{type:`contextParams`,name:`Key`}}).m(function(e,t,n,i){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),r.getFlexibleChecksumsPlugin(n,{requestAlgorithmMember:{httpHeader:`x-amz-sdk-checksum-algorithm`,name:`ChecksumAlgorithm`},requestChecksumRequired:!0}),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`PutObjectAcl`,{}).n(`S3Client`,`PutObjectAclCommand`).sc(x.PutObjectAcl$).build(){},Ht=class extends y.Command.classBuilder().ep({...B,Bucket:{type:`contextParams`,name:`Bucket`},Key:{type:`contextParams`,name:`Key`}}).m(function(e,t,n,i){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),r.getFlexibleChecksumsPlugin(n,{requestAlgorithmMember:{httpHeader:`x-amz-sdk-checksum-algorithm`,name:`ChecksumAlgorithm`},requestChecksumRequired:!1}),s.getCheckContentLengthHeaderPlugin(n),s.getThrow200ExceptionsPlugin(n),M.getSsecPlugin(n)]}).s(`AmazonS3`,`PutObject`,{}).n(`S3Client`,`PutObjectCommand`).sc(x.PutObject$).build(){},Ut=class extends y.Command.classBuilder().ep({...B,Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,i){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),r.getFlexibleChecksumsPlugin(n,{requestAlgorithmMember:{httpHeader:`x-amz-sdk-checksum-algorithm`,name:`ChecksumAlgorithm`},requestChecksumRequired:!0}),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`PutObjectLegalHold`,{}).n(`S3Client`,`PutObjectLegalHoldCommand`).sc(x.PutObjectLegalHold$).build(){},Wt=class extends y.Command.classBuilder().ep({...B,Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,i){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),r.getFlexibleChecksumsPlugin(n,{requestAlgorithmMember:{httpHeader:`x-amz-sdk-checksum-algorithm`,name:`ChecksumAlgorithm`},requestChecksumRequired:!0}),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`PutObjectLockConfiguration`,{}).n(`S3Client`,`PutObjectLockConfigurationCommand`).sc(x.PutObjectLockConfiguration$).build(){},Gt=class extends y.Command.classBuilder().ep({...B,Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,i){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),r.getFlexibleChecksumsPlugin(n,{requestAlgorithmMember:{httpHeader:`x-amz-sdk-checksum-algorithm`,name:`ChecksumAlgorithm`},requestChecksumRequired:!0}),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`PutObjectRetention`,{}).n(`S3Client`,`PutObjectRetentionCommand`).sc(x.PutObjectRetention$).build(){},Kt=class extends y.Command.classBuilder().ep({...B,Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,i){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),r.getFlexibleChecksumsPlugin(n,{requestAlgorithmMember:{httpHeader:`x-amz-sdk-checksum-algorithm`,name:`ChecksumAlgorithm`},requestChecksumRequired:!0}),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`PutObjectTagging`,{}).n(`S3Client`,`PutObjectTaggingCommand`).sc(x.PutObjectTagging$).build(){},qt=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,i){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),r.getFlexibleChecksumsPlugin(n,{requestAlgorithmMember:{httpHeader:`x-amz-sdk-checksum-algorithm`,name:`ChecksumAlgorithm`},requestChecksumRequired:!0})]}).s(`AmazonS3`,`PutPublicAccessBlock`,{}).n(`S3Client`,`PutPublicAccessBlockCommand`).sc(x.PutPublicAccessBlock$).build(){},Jt=class extends y.Command.classBuilder().ep({...B,Bucket:{type:`contextParams`,name:`Bucket`},Key:{type:`contextParams`,name:`Key`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`RenameObject`,{}).n(`S3Client`,`RenameObjectCommand`).sc(x.RenameObject$).build(){},Yt=class extends y.Command.classBuilder().ep({...B,Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,i){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),r.getFlexibleChecksumsPlugin(n,{requestAlgorithmMember:{httpHeader:`x-amz-sdk-checksum-algorithm`,name:`ChecksumAlgorithm`},requestChecksumRequired:!1}),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`RestoreObject`,{}).n(`S3Client`,`RestoreObjectCommand`).sc(x.RestoreObject$).build(){},Xt=class extends y.Command.classBuilder().ep({...B,Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),M.getSsecPlugin(n)]}).s(`AmazonS3`,`SelectObjectContent`,{eventStream:{output:!0}}).n(`S3Client`,`SelectObjectContentCommand`).sc(x.SelectObjectContent$).build(){},Zt=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,i){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),r.getFlexibleChecksumsPlugin(n,{requestAlgorithmMember:{httpHeader:`x-amz-sdk-checksum-algorithm`,name:`ChecksumAlgorithm`},requestChecksumRequired:!0})]}).s(`AmazonS3`,`UpdateBucketMetadataInventoryTableConfiguration`,{}).n(`S3Client`,`UpdateBucketMetadataInventoryTableConfigurationCommand`).sc(x.UpdateBucketMetadataInventoryTableConfiguration$).build(){},Qt=class extends y.Command.classBuilder().ep({...B,UseS3ExpressControlEndpoint:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,i){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),r.getFlexibleChecksumsPlugin(n,{requestAlgorithmMember:{httpHeader:`x-amz-sdk-checksum-algorithm`,name:`ChecksumAlgorithm`},requestChecksumRequired:!0})]}).s(`AmazonS3`,`UpdateBucketMetadataJournalTableConfiguration`,{}).n(`S3Client`,`UpdateBucketMetadataJournalTableConfigurationCommand`).sc(x.UpdateBucketMetadataJournalTableConfiguration$).build(){},$t=class extends y.Command.classBuilder().ep({...B,Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,i){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),r.getFlexibleChecksumsPlugin(n,{requestAlgorithmMember:{httpHeader:`x-amz-sdk-checksum-algorithm`,name:`ChecksumAlgorithm`},requestChecksumRequired:!0}),s.getThrow200ExceptionsPlugin(n)]}).s(`AmazonS3`,`UpdateObjectEncryption`,{}).n(`S3Client`,`UpdateObjectEncryptionCommand`).sc(x.UpdateObjectEncryption$).build(){},en=class extends y.Command.classBuilder().ep({...B,Bucket:{type:`contextParams`,name:`Bucket`},Key:{type:`contextParams`,name:`Key`}}).m(function(e,t,n,i){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),r.getFlexibleChecksumsPlugin(n,{requestAlgorithmMember:{httpHeader:`x-amz-sdk-checksum-algorithm`,name:`ChecksumAlgorithm`},requestChecksumRequired:!1}),s.getThrow200ExceptionsPlugin(n),M.getSsecPlugin(n)]}).s(`AmazonS3`,`UploadPart`,{}).n(`S3Client`,`UploadPartCommand`).sc(x.UploadPart$).build(){},tn=class extends y.Command.classBuilder().ep({...B,DisableS3ExpressSessionAuth:{type:`staticContextParams`,value:!0},Bucket:{type:`contextParams`,name:`Bucket`}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions()),s.getThrow200ExceptionsPlugin(n),M.getSsecPlugin(n)]}).s(`AmazonS3`,`UploadPartCopy`,{}).n(`S3Client`,`UploadPartCopyCommand`).sc(x.UploadPartCopy$).build(){},nn=class extends y.Command.classBuilder().ep({...B,UseObjectLambdaEndpoint:{type:`staticContextParams`,value:!0}}).m(function(e,t,n,r){return[g.getEndpointPlugin(n,e.getEndpointParameterInstructions())]}).s(`AmazonS3`,`WriteGetObjectResponse`,{}).n(`S3Client`,`WriteGetObjectResponseCommand`).sc(x.WriteGetObjectResponse$).build(){};let rn=d.createPaginator(se,ht,`ContinuationToken`,`ContinuationToken`,`MaxBuckets`),an=d.createPaginator(se,gt,`ContinuationToken`,`ContinuationToken`,`MaxDirectoryBuckets`),on=d.createPaginator(se,yt,`ContinuationToken`,`NextContinuationToken`,`MaxKeys`),sn=d.createPaginator(se,xt,`PartNumberMarker`,`NextPartNumberMarker`,`MaxParts`),cn=async(e,t)=>{let n;try{return n=await e.send(new lt(t)),{state:L.WaiterState.SUCCESS,reason:n}}catch(e){if(n=e,e.name===`NotFound`)return{state:L.WaiterState.RETRY,reason:n}}return{state:L.WaiterState.RETRY,reason:n}},ln=async(e,t)=>L.createWaiter({minDelay:5,maxDelay:120,...e},t,cn),un=async(e,t)=>{let n=await L.createWaiter({minDelay:5,maxDelay:120,...e},t,cn);return L.checkExceptions(n)},dn=async(e,t)=>{let n;try{n=await e.send(new lt(t))}catch(e){if(n=e,e.name===`NotFound`)return{state:L.WaiterState.SUCCESS,reason:n}}return{state:L.WaiterState.RETRY,reason:n}},fn=async(e,t)=>L.createWaiter({minDelay:5,maxDelay:120,...e},t,dn),pn=async(e,t)=>{let n=await L.createWaiter({minDelay:5,maxDelay:120,...e},t,dn);return L.checkExceptions(n)},mn=async(e,t)=>{let n;try{return n=await e.send(new ut(t)),{state:L.WaiterState.SUCCESS,reason:n}}catch(e){if(n=e,e.name===`NotFound`)return{state:L.WaiterState.RETRY,reason:n}}return{state:L.WaiterState.RETRY,reason:n}},hn=async(e,t)=>L.createWaiter({minDelay:5,maxDelay:120,...e},t,mn),gn=async(e,t)=>{let n=await L.createWaiter({minDelay:5,maxDelay:120,...e},t,mn);return L.checkExceptions(n)},_n=async(e,t)=>{let n;try{n=await e.send(new ut(t))}catch(e){if(n=e,e.name===`NotFound`)return{state:L.WaiterState.SUCCESS,reason:n}}return{state:L.WaiterState.RETRY,reason:n}},vn=async(e,t)=>L.createWaiter({minDelay:5,maxDelay:120,...e},t,_n),yn=async(e,t)=>{let n=await L.createWaiter({minDelay:5,maxDelay:120,...e},t,_n);return L.checkExceptions(n)},bn={AbortMultipartUploadCommand:ce,CompleteMultipartUploadCommand:le,CopyObjectCommand:ue,CreateBucketCommand:de,CreateBucketMetadataConfigurationCommand:fe,CreateBucketMetadataTableConfigurationCommand:pe,CreateMultipartUploadCommand:me,CreateSessionCommand:ie,DeleteBucketCommand:ge,DeleteBucketAnalyticsConfigurationCommand:he,DeleteBucketCorsCommand:_e,DeleteBucketEncryptionCommand:ve,DeleteBucketIntelligentTieringConfigurationCommand:ye,DeleteBucketInventoryConfigurationCommand:be,DeleteBucketLifecycleCommand:U,DeleteBucketMetadataConfigurationCommand:xe,DeleteBucketMetadataTableConfigurationCommand:Se,DeleteBucketMetricsConfigurationCommand:Ce,DeleteBucketOwnershipControlsCommand:we,DeleteBucketPolicyCommand:Te,DeleteBucketReplicationCommand:Ee,DeleteBucketTaggingCommand:De,DeleteBucketWebsiteCommand:Oe,DeleteObjectCommand:ke,DeleteObjectsCommand:Ae,DeleteObjectTaggingCommand:je,DeletePublicAccessBlockCommand:W,GetBucketAbacCommand:Me,GetBucketAccelerateConfigurationCommand:Ne,GetBucketAclCommand:Pe,GetBucketAnalyticsConfigurationCommand:Fe,GetBucketCorsCommand:Ie,GetBucketEncryptionCommand:Le,GetBucketIntelligentTieringConfigurationCommand:Re,GetBucketInventoryConfigurationCommand:ze,GetBucketLifecycleConfigurationCommand:Be,GetBucketLocationCommand:Ve,GetBucketLoggingCommand:He,GetBucketMetadataConfigurationCommand:Ue,GetBucketMetadataTableConfigurationCommand:We,GetBucketMetricsConfigurationCommand:Ge,GetBucketNotificationConfigurationCommand:Ke,GetBucketOwnershipControlsCommand:qe,GetBucketPolicyCommand:Je,GetBucketPolicyStatusCommand:Ye,GetBucketReplicationCommand:Xe,GetBucketRequestPaymentCommand:Ze,GetBucketTaggingCommand:Qe,GetBucketVersioningCommand:$e,GetBucketWebsiteCommand:G,GetObjectCommand:nt,GetObjectAclCommand:et,GetObjectAttributesCommand:tt,GetObjectLegalHoldCommand:rt,GetObjectLockConfigurationCommand:it,GetObjectRetentionCommand:at,GetObjectTaggingCommand:ot,GetObjectTorrentCommand:st,GetPublicAccessBlockCommand:ct,HeadBucketCommand:lt,HeadObjectCommand:ut,ListBucketAnalyticsConfigurationsCommand:dt,ListBucketIntelligentTieringConfigurationsCommand:ft,ListBucketInventoryConfigurationsCommand:pt,ListBucketMetricsConfigurationsCommand:mt,ListBucketsCommand:ht,ListDirectoryBucketsCommand:gt,ListMultipartUploadsCommand:_t,ListObjectsCommand:vt,ListObjectsV2Command:yt,ListObjectVersionsCommand:bt,ListPartsCommand:xt,PutBucketAbacCommand:St,PutBucketAccelerateConfigurationCommand:Ct,PutBucketAclCommand:wt,PutBucketAnalyticsConfigurationCommand:Tt,PutBucketCorsCommand:Et,PutBucketEncryptionCommand:Dt,PutBucketIntelligentTieringConfigurationCommand:Ot,PutBucketInventoryConfigurationCommand:kt,PutBucketLifecycleConfigurationCommand:At,PutBucketLoggingCommand:jt,PutBucketMetricsConfigurationCommand:Mt,PutBucketNotificationConfigurationCommand:Nt,PutBucketOwnershipControlsCommand:Pt,PutBucketPolicyCommand:Ft,PutBucketReplicationCommand:It,PutBucketRequestPaymentCommand:Lt,PutBucketTaggingCommand:Rt,PutBucketVersioningCommand:zt,PutBucketWebsiteCommand:Bt,PutObjectCommand:Ht,PutObjectAclCommand:Vt,PutObjectLegalHoldCommand:Ut,PutObjectLockConfigurationCommand:Wt,PutObjectRetentionCommand:Gt,PutObjectTaggingCommand:Kt,PutPublicAccessBlockCommand:qt,RenameObjectCommand:Jt,RestoreObjectCommand:Yt,SelectObjectContentCommand:Xt,UpdateBucketMetadataInventoryTableConfigurationCommand:Zt,UpdateBucketMetadataJournalTableConfigurationCommand:Qt,UpdateObjectEncryptionCommand:$t,UploadPartCommand:en,UploadPartCopyCommand:tn,WriteGetObjectResponseCommand:nn},xn={paginateListBuckets:rn,paginateListDirectoryBuckets:an,paginateListObjectsV2:on,paginateListParts:sn},Sn={waitUntilBucketExists:un,waitUntilBucketNotExists:pn,waitUntilObjectExists:gn,waitUntilObjectNotExists:yn};var Cn=class extends se{};y.createAggregatedClient(bn,Cn,{paginators:xn,waiters:Sn}),t.$Command=y.Command,t.__Client=y.Client,t.S3ServiceException=z.S3ServiceException,t.AbortMultipartUploadCommand=ce,t.AnalyticsS3ExportFileFormat={CSV:`CSV`},t.ArchiveStatus={ARCHIVE_ACCESS:`ARCHIVE_ACCESS`,DEEP_ARCHIVE_ACCESS:`DEEP_ARCHIVE_ACCESS`},t.BucketAbacStatus={Disabled:`Disabled`,Enabled:`Enabled`},t.BucketAccelerateStatus={Enabled:`Enabled`,Suspended:`Suspended`},t.BucketCannedACL={authenticated_read:`authenticated-read`,private:`private`,public_read:`public-read`,public_read_write:`public-read-write`},t.BucketLocationConstraint={EU:`EU`,af_south_1:`af-south-1`,ap_east_1:`ap-east-1`,ap_east_2:`ap-east-2`,ap_northeast_1:`ap-northeast-1`,ap_northeast_2:`ap-northeast-2`,ap_northeast_3:`ap-northeast-3`,ap_south_1:`ap-south-1`,ap_south_2:`ap-south-2`,ap_southeast_1:`ap-southeast-1`,ap_southeast_2:`ap-southeast-2`,ap_southeast_3:`ap-southeast-3`,ap_southeast_4:`ap-southeast-4`,ap_southeast_5:`ap-southeast-5`,ap_southeast_6:`ap-southeast-6`,ap_southeast_7:`ap-southeast-7`,ca_central_1:`ca-central-1`,ca_west_1:`ca-west-1`,cn_north_1:`cn-north-1`,cn_northwest_1:`cn-northwest-1`,eu_central_1:`eu-central-1`,eu_central_2:`eu-central-2`,eu_north_1:`eu-north-1`,eu_south_1:`eu-south-1`,eu_south_2:`eu-south-2`,eu_west_1:`eu-west-1`,eu_west_2:`eu-west-2`,eu_west_3:`eu-west-3`,il_central_1:`il-central-1`,me_central_1:`me-central-1`,me_south_1:`me-south-1`,mx_central_1:`mx-central-1`,sa_east_1:`sa-east-1`,us_east_2:`us-east-2`,us_gov_east_1:`us-gov-east-1`,us_gov_west_1:`us-gov-west-1`,us_west_1:`us-west-1`,us_west_2:`us-west-2`},t.BucketLogsPermission={FULL_CONTROL:`FULL_CONTROL`,READ:`READ`,WRITE:`WRITE`},t.BucketNamespace={ACCOUNT_REGIONAL:`account-regional`,GLOBAL:`global`},t.BucketType={Directory:`Directory`},t.BucketVersioningStatus={Enabled:`Enabled`,Suspended:`Suspended`},t.ChecksumAlgorithm={CRC32:`CRC32`,CRC32C:`CRC32C`,CRC64NVME:`CRC64NVME`,MD5:`MD5`,SHA1:`SHA1`,SHA256:`SHA256`,SHA512:`SHA512`,XXHASH128:`XXHASH128`,XXHASH3:`XXHASH3`,XXHASH64:`XXHASH64`},t.ChecksumMode={ENABLED:`ENABLED`},t.ChecksumType={COMPOSITE:`COMPOSITE`,FULL_OBJECT:`FULL_OBJECT`},t.CompleteMultipartUploadCommand=le,t.CompressionType={BZIP2:`BZIP2`,GZIP:`GZIP`,NONE:`NONE`},t.CopyObjectCommand=ue,t.CreateBucketCommand=de,t.CreateBucketMetadataConfigurationCommand=fe,t.CreateBucketMetadataTableConfigurationCommand=pe,t.CreateMultipartUploadCommand=me,t.CreateSessionCommand=ie,t.DataRedundancy={SingleAvailabilityZone:`SingleAvailabilityZone`,SingleLocalZone:`SingleLocalZone`},t.DeleteBucketAnalyticsConfigurationCommand=he,t.DeleteBucketCommand=ge,t.DeleteBucketCorsCommand=_e,t.DeleteBucketEncryptionCommand=ve,t.DeleteBucketIntelligentTieringConfigurationCommand=ye,t.DeleteBucketInventoryConfigurationCommand=be,t.DeleteBucketLifecycleCommand=U,t.DeleteBucketMetadataConfigurationCommand=xe,t.DeleteBucketMetadataTableConfigurationCommand=Se,t.DeleteBucketMetricsConfigurationCommand=Ce,t.DeleteBucketOwnershipControlsCommand=we,t.DeleteBucketPolicyCommand=Te,t.DeleteBucketReplicationCommand=Ee,t.DeleteBucketTaggingCommand=De,t.DeleteBucketWebsiteCommand=Oe,t.DeleteMarkerReplicationStatus={Disabled:`Disabled`,Enabled:`Enabled`},t.DeleteObjectCommand=ke,t.DeleteObjectTaggingCommand=je,t.DeleteObjectsCommand=Ae,t.DeletePublicAccessBlockCommand=W,t.EncodingType={url:`url`},t.EncryptionType={NONE:`NONE`,SSE_C:`SSE-C`},t.Event={s3_IntelligentTiering:`s3:IntelligentTiering`,s3_LifecycleExpiration_:`s3:LifecycleExpiration:*`,s3_LifecycleExpiration_Delete:`s3:LifecycleExpiration:Delete`,s3_LifecycleExpiration_DeleteMarkerCreated:`s3:LifecycleExpiration:DeleteMarkerCreated`,s3_LifecycleTransition:`s3:LifecycleTransition`,s3_ObjectAcl_Put:`s3:ObjectAcl:Put`,s3_ObjectCreated_:`s3:ObjectCreated:*`,s3_ObjectCreated_CompleteMultipartUpload:`s3:ObjectCreated:CompleteMultipartUpload`,s3_ObjectCreated_Copy:`s3:ObjectCreated:Copy`,s3_ObjectCreated_Post:`s3:ObjectCreated:Post`,s3_ObjectCreated_Put:`s3:ObjectCreated:Put`,s3_ObjectRemoved_:`s3:ObjectRemoved:*`,s3_ObjectRemoved_Delete:`s3:ObjectRemoved:Delete`,s3_ObjectRemoved_DeleteMarkerCreated:`s3:ObjectRemoved:DeleteMarkerCreated`,s3_ObjectRestore_:`s3:ObjectRestore:*`,s3_ObjectRestore_Completed:`s3:ObjectRestore:Completed`,s3_ObjectRestore_Delete:`s3:ObjectRestore:Delete`,s3_ObjectRestore_Post:`s3:ObjectRestore:Post`,s3_ObjectTagging_:`s3:ObjectTagging:*`,s3_ObjectTagging_Delete:`s3:ObjectTagging:Delete`,s3_ObjectTagging_Put:`s3:ObjectTagging:Put`,s3_ReducedRedundancyLostObject:`s3:ReducedRedundancyLostObject`,s3_Replication_:`s3:Replication:*`,s3_Replication_OperationFailedReplication:`s3:Replication:OperationFailedReplication`,s3_Replication_OperationMissedThreshold:`s3:Replication:OperationMissedThreshold`,s3_Replication_OperationNotTracked:`s3:Replication:OperationNotTracked`,s3_Replication_OperationReplicatedAfterThreshold:`s3:Replication:OperationReplicatedAfterThreshold`},t.ExistingObjectReplicationStatus={Disabled:`Disabled`,Enabled:`Enabled`},t.ExpirationState={DISABLED:`DISABLED`,ENABLED:`ENABLED`},t.ExpirationStatus={Disabled:`Disabled`,Enabled:`Enabled`},t.ExpressionType={SQL:`SQL`},t.FileHeaderInfo={IGNORE:`IGNORE`,NONE:`NONE`,USE:`USE`},t.FilterRuleName={prefix:`prefix`,suffix:`suffix`},t.GetBucketAbacCommand=Me,t.GetBucketAccelerateConfigurationCommand=Ne,t.GetBucketAclCommand=Pe,t.GetBucketAnalyticsConfigurationCommand=Fe,t.GetBucketCorsCommand=Ie,t.GetBucketEncryptionCommand=Le,t.GetBucketIntelligentTieringConfigurationCommand=Re,t.GetBucketInventoryConfigurationCommand=ze,t.GetBucketLifecycleConfigurationCommand=Be,t.GetBucketLocationCommand=Ve,t.GetBucketLoggingCommand=He,t.GetBucketMetadataConfigurationCommand=Ue,t.GetBucketMetadataTableConfigurationCommand=We,t.GetBucketMetricsConfigurationCommand=Ge,t.GetBucketNotificationConfigurationCommand=Ke,t.GetBucketOwnershipControlsCommand=qe,t.GetBucketPolicyCommand=Je,t.GetBucketPolicyStatusCommand=Ye,t.GetBucketReplicationCommand=Xe,t.GetBucketRequestPaymentCommand=Ze,t.GetBucketTaggingCommand=Qe,t.GetBucketVersioningCommand=$e,t.GetBucketWebsiteCommand=G,t.GetObjectAclCommand=et,t.GetObjectAttributesCommand=tt,t.GetObjectCommand=nt,t.GetObjectLegalHoldCommand=rt,t.GetObjectLockConfigurationCommand=it,t.GetObjectRetentionCommand=at,t.GetObjectTaggingCommand=ot,t.GetObjectTorrentCommand=st,t.GetPublicAccessBlockCommand=ct,t.HeadBucketCommand=lt,t.HeadObjectCommand=ut,t.IntelligentTieringAccessTier={ARCHIVE_ACCESS:`ARCHIVE_ACCESS`,DEEP_ARCHIVE_ACCESS:`DEEP_ARCHIVE_ACCESS`},t.IntelligentTieringStatus={Disabled:`Disabled`,Enabled:`Enabled`},t.InventoryConfigurationState={DISABLED:`DISABLED`,ENABLED:`ENABLED`},t.InventoryFormat={CSV:`CSV`,ORC:`ORC`,Parquet:`Parquet`},t.InventoryFrequency={Daily:`Daily`,Weekly:`Weekly`},t.InventoryIncludedObjectVersions={All:`All`,Current:`Current`},t.InventoryOptionalField={BucketKeyStatus:`BucketKeyStatus`,ChecksumAlgorithm:`ChecksumAlgorithm`,ETag:`ETag`,EncryptionStatus:`EncryptionStatus`,IntelligentTieringAccessTier:`IntelligentTieringAccessTier`,IsMultipartUploaded:`IsMultipartUploaded`,LastModifiedDate:`LastModifiedDate`,LifecycleExpirationDate:`LifecycleExpirationDate`,ObjectAccessControlList:`ObjectAccessControlList`,ObjectLockLegalHoldStatus:`ObjectLockLegalHoldStatus`,ObjectLockMode:`ObjectLockMode`,ObjectLockRetainUntilDate:`ObjectLockRetainUntilDate`,ObjectOwner:`ObjectOwner`,ReplicationStatus:`ReplicationStatus`,Size:`Size`,StorageClass:`StorageClass`},t.JSONType={DOCUMENT:`DOCUMENT`,LINES:`LINES`},t.ListBucketAnalyticsConfigurationsCommand=dt,t.ListBucketIntelligentTieringConfigurationsCommand=ft,t.ListBucketInventoryConfigurationsCommand=pt,t.ListBucketMetricsConfigurationsCommand=mt,t.ListBucketsCommand=ht,t.ListDirectoryBucketsCommand=gt,t.ListMultipartUploadsCommand=_t,t.ListObjectVersionsCommand=bt,t.ListObjectsCommand=vt,t.ListObjectsV2Command=yt,t.ListPartsCommand=xt,t.LocationType={AvailabilityZone:`AvailabilityZone`,LocalZone:`LocalZone`},t.MFADelete={Disabled:`Disabled`,Enabled:`Enabled`},t.MFADeleteStatus={Disabled:`Disabled`,Enabled:`Enabled`},t.MetadataDirective={COPY:`COPY`,REPLACE:`REPLACE`},t.MetricsStatus={Disabled:`Disabled`,Enabled:`Enabled`},t.ObjectAttributes={CHECKSUM:`Checksum`,ETAG:`ETag`,OBJECT_PARTS:`ObjectParts`,OBJECT_SIZE:`ObjectSize`,STORAGE_CLASS:`StorageClass`},t.ObjectCannedACL={authenticated_read:`authenticated-read`,aws_exec_read:`aws-exec-read`,bucket_owner_full_control:`bucket-owner-full-control`,bucket_owner_read:`bucket-owner-read`,private:`private`,public_read:`public-read`,public_read_write:`public-read-write`},t.ObjectLockEnabled={Enabled:`Enabled`},t.ObjectLockLegalHoldStatus={OFF:`OFF`,ON:`ON`},t.ObjectLockMode={COMPLIANCE:`COMPLIANCE`,GOVERNANCE:`GOVERNANCE`},t.ObjectLockRetentionMode={COMPLIANCE:`COMPLIANCE`,GOVERNANCE:`GOVERNANCE`},t.ObjectOwnership={BucketOwnerEnforced:`BucketOwnerEnforced`,BucketOwnerPreferred:`BucketOwnerPreferred`,ObjectWriter:`ObjectWriter`},t.ObjectStorageClass={DEEP_ARCHIVE:`DEEP_ARCHIVE`,EXPRESS_ONEZONE:`EXPRESS_ONEZONE`,FSX_ONTAP:`FSX_ONTAP`,FSX_OPENZFS:`FSX_OPENZFS`,GLACIER:`GLACIER`,GLACIER_IR:`GLACIER_IR`,INTELLIGENT_TIERING:`INTELLIGENT_TIERING`,ONEZONE_IA:`ONEZONE_IA`,OUTPOSTS:`OUTPOSTS`,REDUCED_REDUNDANCY:`REDUCED_REDUNDANCY`,SNOW:`SNOW`,STANDARD:`STANDARD`,STANDARD_IA:`STANDARD_IA`},t.ObjectVersionStorageClass={STANDARD:`STANDARD`},t.OptionalObjectAttributes={RESTORE_STATUS:`RestoreStatus`},t.OwnerOverride={Destination:`Destination`},t.PartitionDateSource={DeliveryTime:`DeliveryTime`,EventTime:`EventTime`},t.Payer={BucketOwner:`BucketOwner`,Requester:`Requester`},t.Permission={FULL_CONTROL:`FULL_CONTROL`,READ:`READ`,READ_ACP:`READ_ACP`,WRITE:`WRITE`,WRITE_ACP:`WRITE_ACP`},t.Protocol={http:`http`,https:`https`},t.PutBucketAbacCommand=St,t.PutBucketAccelerateConfigurationCommand=Ct,t.PutBucketAclCommand=wt,t.PutBucketAnalyticsConfigurationCommand=Tt,t.PutBucketCorsCommand=Et,t.PutBucketEncryptionCommand=Dt,t.PutBucketIntelligentTieringConfigurationCommand=Ot,t.PutBucketInventoryConfigurationCommand=kt,t.PutBucketLifecycleConfigurationCommand=At,t.PutBucketLoggingCommand=jt,t.PutBucketMetricsConfigurationCommand=Mt,t.PutBucketNotificationConfigurationCommand=Nt,t.PutBucketOwnershipControlsCommand=Pt,t.PutBucketPolicyCommand=Ft,t.PutBucketReplicationCommand=It,t.PutBucketRequestPaymentCommand=Lt,t.PutBucketTaggingCommand=Rt,t.PutBucketVersioningCommand=zt,t.PutBucketWebsiteCommand=Bt,t.PutObjectAclCommand=Vt,t.PutObjectCommand=Ht,t.PutObjectLegalHoldCommand=Ut,t.PutObjectLockConfigurationCommand=Wt,t.PutObjectRetentionCommand=Gt,t.PutObjectTaggingCommand=Kt,t.PutPublicAccessBlockCommand=qt,t.QuoteFields={ALWAYS:`ALWAYS`,ASNEEDED:`ASNEEDED`},t.RenameObjectCommand=Jt,t.ReplicaModificationsStatus={Disabled:`Disabled`,Enabled:`Enabled`},t.ReplicationRuleStatus={Disabled:`Disabled`,Enabled:`Enabled`},t.ReplicationStatus={COMPLETE:`COMPLETE`,COMPLETED:`COMPLETED`,FAILED:`FAILED`,PENDING:`PENDING`,REPLICA:`REPLICA`},t.ReplicationTimeStatus={Disabled:`Disabled`,Enabled:`Enabled`},t.RequestCharged={requester:`requester`},t.RequestPayer={requester:`requester`},t.RestoreObjectCommand=Yt,t.RestoreRequestType={SELECT:`SELECT`},t.S3=Cn,t.S3Client=se,t.S3TablesBucketType={aws:`aws`,customer:`customer`},t.SelectObjectContentCommand=Xt,t.ServerSideEncryption={AES256:`AES256`,aws_fsx:`aws:fsx`,aws_kms:`aws:kms`,aws_kms_dsse:`aws:kms:dsse`},t.SessionMode={ReadOnly:`ReadOnly`,ReadWrite:`ReadWrite`},t.SseKmsEncryptedObjectsStatus={Disabled:`Disabled`,Enabled:`Enabled`},t.StorageClass={DEEP_ARCHIVE:`DEEP_ARCHIVE`,EXPRESS_ONEZONE:`EXPRESS_ONEZONE`,FSX_ONTAP:`FSX_ONTAP`,FSX_OPENZFS:`FSX_OPENZFS`,GLACIER:`GLACIER`,GLACIER_IR:`GLACIER_IR`,INTELLIGENT_TIERING:`INTELLIGENT_TIERING`,ONEZONE_IA:`ONEZONE_IA`,OUTPOSTS:`OUTPOSTS`,REDUCED_REDUNDANCY:`REDUCED_REDUNDANCY`,SNOW:`SNOW`,STANDARD:`STANDARD`,STANDARD_IA:`STANDARD_IA`},t.StorageClassAnalysisSchemaVersion={V_1:`V_1`},t.TableSseAlgorithm={AES256:`AES256`,aws_kms:`aws:kms`},t.TaggingDirective={COPY:`COPY`,REPLACE:`REPLACE`},t.Tier={Bulk:`Bulk`,Expedited:`Expedited`,Standard:`Standard`},t.TransitionDefaultMinimumObjectSize={all_storage_classes_128K:`all_storage_classes_128K`,varies_by_storage_class:`varies_by_storage_class`},t.TransitionStorageClass={DEEP_ARCHIVE:`DEEP_ARCHIVE`,GLACIER:`GLACIER`,GLACIER_IR:`GLACIER_IR`,INTELLIGENT_TIERING:`INTELLIGENT_TIERING`,ONEZONE_IA:`ONEZONE_IA`,STANDARD_IA:`STANDARD_IA`},t.Type={AmazonCustomerByEmail:`AmazonCustomerByEmail`,CanonicalUser:`CanonicalUser`,Group:`Group`},t.UpdateBucketMetadataInventoryTableConfigurationCommand=Zt,t.UpdateBucketMetadataJournalTableConfigurationCommand=Qt,t.UpdateObjectEncryptionCommand=$t,t.UploadPartCommand=en,t.UploadPartCopyCommand=tn,t.WriteGetObjectResponseCommand=nn,t.paginateListBuckets=rn,t.paginateListDirectoryBuckets=an,t.paginateListObjectsV2=on,t.paginateListParts=sn,t.waitForBucketExists=ln,t.waitForBucketNotExists=fn,t.waitForObjectExists=hn,t.waitForObjectNotExists=vn,t.waitUntilBucketExists=un,t.waitUntilBucketNotExists=pn,t.waitUntilObjectExists=gn,t.waitUntilObjectNotExists=yn,Object.prototype.hasOwnProperty.call(x,`__proto__`)&&!Object.prototype.hasOwnProperty.call(t,`__proto__`)&&Object.defineProperty(t,`__proto__`,{enumerable:!0,value:x.__proto__}),Object.keys(x).forEach(function(e){e!==`default`&&!Object.prototype.hasOwnProperty.call(t,e)&&(t[e]=x[e])}),Object.prototype.hasOwnProperty.call(R,`__proto__`)&&!Object.prototype.hasOwnProperty.call(t,`__proto__`)&&Object.defineProperty(t,`__proto__`,{enumerable:!0,value:R.__proto__}),Object.keys(R).forEach(function(e){e!==`default`&&!Object.prototype.hasOwnProperty.call(t,e)&&(t[e]=R[e])})}))();function Hs(e){return e.replaceAll(/X-Amz-[A-Za-z0-9-]+=[^&\s]+/g,`X-Amz-REDACTED=[REDACTED]`).replaceAll(/Authorization([:=]\s*)(Bearer\s+)?[^,\s]+/gi,`Authorization$1$2[REDACTED]`).slice(0,500)}function Us(e,t,n){let r=typeof n==`object`&&n&&`Code`in n?String(n.Code):void 0,i=n instanceof Error?n.name:`UnknownError`,a=typeof n==`object`&&n&&`$metadata`in n&&typeof n.$metadata==`object`&&n.$metadata!=null&&`httpStatusCode`in n.$metadata?Number(n.$metadata.httpStatusCode):void 0,o=Hs(n instanceof Error?n.message:String(n));return e.warning(`Object store ${t} failed`,{errorCode:r,errorName:i,httpStatusCode:a,message:o}),Io(`Object store ${t} failed: ${o}`)}async function Ws(e){if(e instanceof W){let t=[];for await(let n of e){if(typeof n==`string`){t.push(Pe.from(n));continue}t.push(Pe.isBuffer(n)?n:Pe.from(n))}return Pe.concat(t).toString(`utf8`)}if(typeof e==`object`&&e&&`transformToString`in e){let t=e.transformToString;if(typeof t==`function`)return String(await t.call(e))}throw Io(`Object store getObject failed: response body was not readable`)}function Gs(e,t){if(e==null||e.length===0)throw Io(`Object store ${t} failed: missing ETag in response`);return e}function Ks(e){return e.region.length>0?e.region:void 0}function qs(e){let t=Ks(e);return e.endpoint==null?new Vs.S3Client({maxAttempts:3,region:t,...e.credentials==null?{}:{credentials:e.credentials}}):new Vs.S3Client({endpoint:e.endpoint,forcePathStyle:!0,maxAttempts:3,region:t,...e.credentials==null?{}:{credentials:e.credentials}})}function Js(e){return e.sseEncryption==null?e.endpoint==null?`aws:kms`:`AES256`:e.sseEncryption}function Ys(e,t){let n=qs(e),r=Js(e);return{upload:async(i,a)=>{t.debug(`Uploading object store file`,{key:i,localPath:a});try{let o={Body:Je.createReadStream(a),Bucket:e.bucket,ExpectedBucketOwner:e.expectedBucketOwner,Key:i,ServerSideEncryption:r};r===`aws:kms`&&e.sseKmsKeyId!=null&&(o.SSEKMSKeyId=e.sseKmsKeyId);let s=new Vs.PutObjectCommand({...o});return await n.send(s),t.info(`Uploaded object store file`,{key:i}),Do(void 0)}catch(e){return Oo(Us(t,`upload`,e))}},download:async(r,i)=>{t.debug(`Downloading object store file`,{key:r,localPath:i});try{await Ue.mkdir(We.dirname(i),{recursive:!0});let a=await n.send(new Vs.GetObjectCommand({Bucket:e.bucket,ExpectedBucketOwner:e.expectedBucketOwner,Key:r}));return a.Body instanceof W?(await Xe(a.Body,Je.createWriteStream(i)),t.info(`Downloaded object store file`,{key:r,localPath:i}),Do(void 0)):Oo(Io(`Object store download failed: response body was not readable`))}catch(e){return Oo(Us(t,`download`,e))}},list:async r=>{t.debug(`Listing object store keys`,{prefix:r});try{let i=[],a,o=0;do{if(o>=100){t.warning(`Object store list hit iteration cap, truncating result`,{prefix:r,maxIterations:100,keysReturned:i.length});break}o++;let s=await n.send(new Vs.ListObjectsV2Command({Bucket:e.bucket,ContinuationToken:a,ExpectedBucketOwner:e.expectedBucketOwner,Prefix:r}));for(let e of s.Contents??[])e.Key!=null&&i.push(e.Key);a=s.IsTruncated===!0?s.NextContinuationToken:void 0}while(a!=null);return t.info(`Listed object store keys`,{count:i.length,prefix:r}),Do(i)}catch(e){return Oo(Us(t,`list`,e))}},conditionalPut:async(i,a,o)=>{t.debug(`Conditionally uploading object store data`,{key:i,options:o});try{let s=Gs((await n.send(new Vs.PutObjectCommand({Body:a,Bucket:e.bucket,ExpectedBucketOwner:e.expectedBucketOwner,IfMatch:o.ifMatch,IfNoneMatch:o.ifNoneMatch,Key:i,ServerSideEncryption:r,...r===`aws:kms`&&e.sseKmsKeyId!=null?{SSEKMSKeyId:e.sseKmsKeyId}:{}}))).ETag,`conditionalPut`);return t.info(`Conditionally uploaded object store data`,{key:i,etag:s}),Do({etag:s})}catch(e){return Oo(Us(t,`conditionalPut`,e))}},conditionalDelete:async(r,i)=>{t.debug(`Conditionally deleting object store data`,{key:r});try{return await n.send(new Vs.DeleteObjectCommand({Bucket:e.bucket,ExpectedBucketOwner:e.expectedBucketOwner,IfMatch:i.ifMatch,Key:r})),t.info(`Conditionally deleted object store data`,{key:r}),Do(void 0)}catch(e){return Oo(Us(t,`conditionalDelete`,e))}},getObject:async r=>{t.debug(`Reading object store data`,{key:r});try{let i=await n.send(new Vs.GetObjectCommand({Bucket:e.bucket,ExpectedBucketOwner:e.expectedBucketOwner,Key:r})),a=await Ws(i.Body),o=Gs(i.ETag,`getObject`);return t.info(`Read object store data`,{key:r,etag:o}),Do({data:a,etag:o})}catch(e){return Oo(Us(t,`getObject`,e))}}}}const Xs=[`token`,`password`,`secret`,`key`,`auth`,`credential`,`bearer`,`apikey`,`api_key`,`access_token`,`refresh_token`,`private`];function Zs(e,t){let n=e.toLowerCase();return t.some(e=>n.includes(e.toLowerCase()))}function Qs(e,t=Xs){if(typeof e!=`object`||!e)return e;if(Array.isArray(e))return e.map(e=>Qs(e,t));let n={};for(let[r,i]of Object.entries(e))Zs(r,t)&&typeof i==`string`?n[r]=`[REDACTED]`:typeof i==`object`&&i?n[r]=Qs(i,t):n[r]=i;return n}function $s(e,t,n,r){let i=Qs({...n,...r},Xs),a={timestamp:new Date().toISOString(),level:e,message:t,...i};if(r!=null&&`error`in r&&r.error instanceof Error){let e=r.error;a.error={message:e.message,name:e.name,stack:e.stack}}return JSON.stringify(a)}function ec(e){return{debug:(t,n)=>{K($s(`debug`,t,e,n))},info:(t,n)=>{xi($s(`info`,t,e,n))},warning:(t,n)=>{bi($s(`warning`,t,e,n))},error:(t,n)=>{yi($s(`error`,t,e,n))}}}const tc={SHOULD_SAVE_CACHE:`shouldSaveCache`,SESSION_ID:`sessionId`,CACHE_SAVED:`cacheSaved`,ARTIFACT_UPLOADED:`artifactUploaded`,OPENCODE_VERSION:`opencodeVersion`,S3_ENABLED:`storeConfig.enabled`,S3_BUCKET:`storeConfig.bucket`,S3_REGION:`storeConfig.region`,S3_PREFIX:`storeConfig.prefix`,S3_ENDPOINT:`storeConfig.endpoint`,S3_EXPECTED_BUCKET_OWNER:`storeConfig.expectedBucketOwner`,S3_ALLOW_INSECURE_ENDPOINT:`storeConfig.allowInsecureEndpoint`,S3_SSE_ENCRYPTION:`storeConfig.sseEncryption`,S3_SSE_KMS_KEY_ID:`storeConfig.sseKmsKeyId`};var nc=class{constructor(){if(this.payload={},process.env.GITHUB_EVENT_PATH)if(_e(process.env.GITHUB_EVENT_PATH))this.payload=JSON.parse(ye(process.env.GITHUB_EVENT_PATH,{encoding:`utf8`}));else{let e=process.env.GITHUB_EVENT_PATH;process.stdout.write(`GITHUB_EVENT_PATH ${e} does not exist${pe}`)}this.eventName=process.env.GITHUB_EVENT_NAME,this.sha=process.env.GITHUB_SHA,this.ref=process.env.GITHUB_REF,this.workflow=process.env.GITHUB_WORKFLOW,this.action=process.env.GITHUB_ACTION,this.actor=process.env.GITHUB_ACTOR,this.job=process.env.GITHUB_JOB,this.runAttempt=parseInt(process.env.GITHUB_RUN_ATTEMPT,10),this.runNumber=parseInt(process.env.GITHUB_RUN_NUMBER,10),this.runId=parseInt(process.env.GITHUB_RUN_ID,10),this.apiUrl=process.env.GITHUB_API_URL??`https://api.github.com`,this.serverUrl=process.env.GITHUB_SERVER_URL??`https://github.com`,this.graphqlUrl=process.env.GITHUB_GRAPHQL_URL??`https://api.github.com/graphql`}get issue(){let e=this.payload;return Object.assign(Object.assign({},this.repo),{number:(e.issue||e.pull_request||e).number})}get repo(){if(process.env.GITHUB_REPOSITORY){let[e,t]=process.env.GITHUB_REPOSITORY.split(`/`);return{owner:e,repo:t}}if(this.payload.repository)return{owner:this.payload.repository.owner.login,repo:this.payload.repository.name};throw Error(`context.repo requires a GITHUB_REPOSITORY environment variable like 'owner/repo'`)}},rc=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.getProxyUrl=t,e.checkBypass=n;function t(e){let t=e.protocol===`https:`;if(n(e))return;let r=t?process.env.https_proxy||process.env.HTTPS_PROXY:process.env.http_proxy||process.env.HTTP_PROXY;if(r)try{return new i(r)}catch{if(!r.startsWith(`http://`)&&!r.startsWith(`https://`))return new i(`http://${r}`)}else return}function n(e){if(!e.hostname)return!1;let t=e.hostname;if(r(t))return!0;let n=process.env.no_proxy||process.env.NO_PROXY||``;if(!n)return!1;let i;e.port?i=Number(e.port):e.protocol===`http:`?i=80:e.protocol===`https:`&&(i=443);let a=[e.hostname.toUpperCase()];typeof i==`number`&&a.push(`${a[0]}:${i}`);for(let e of n.split(`,`).map(e=>e.trim().toUpperCase()).filter(e=>e))if(e===`*`||a.some(t=>t===e||t.endsWith(`.${e}`)||e.startsWith(`.`)&&t.endsWith(`${e}`)))return!0;return!1}function r(e){let t=e.toLowerCase();return t===`localhost`||t.startsWith(`127.`)||t.startsWith(`[::1]`)||t.startsWith(`[0:0:0:0:0:0:0:1]`)}var i=class extends URL{constructor(e,t){super(e,t),this._decodedUsername=decodeURIComponent(super.username),this._decodedPassword=decodeURIComponent(super.password)}get username(){return this._decodedUsername}get password(){return this._decodedPassword}}})),ic=n(i((e=>{var n=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),r=e&&e.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,`default`,{enumerable:!0,value:t})}):function(e,t){e.default=t}),i=e&&e.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[t.length]=n);return t},e(t)};return function(t){if(t&&t.__esModule)return t;var i={};if(t!=null)for(var a=e(t),o=0;oa(this,void 0,void 0,function*(){let t=Buffer.alloc(0);this.message.on(`data`,e=>{t=Buffer.concat([t,e])}),this.message.on(`end`,()=>{e(t.toString())})}))})}readBodyBuffer(){return a(this,void 0,void 0,function*(){return new Promise(e=>a(this,void 0,void 0,function*(){let t=[];this.message.on(`data`,e=>{t.push(e)}),this.message.on(`end`,()=>{e(Buffer.concat(t))})}))})}};e.HttpClientResponse=b;function x(e){return new URL(e).protocol===`https:`}e.HttpClient=class{constructor(e,t,n){this._ignoreSslError=!1,this._allowRedirects=!0,this._allowRedirectDowngrade=!1,this._maxRedirects=50,this._allowRetries=!1,this._maxRetries=1,this._keepAlive=!1,this._disposed=!1,this.userAgent=this._getUserAgentWithOrchestrationId(e),this.handlers=t||[],this.requestOptions=n,n&&(n.ignoreSslError!=null&&(this._ignoreSslError=n.ignoreSslError),this._socketTimeout=n.socketTimeout,n.allowRedirects!=null&&(this._allowRedirects=n.allowRedirects),n.allowRedirectDowngrade!=null&&(this._allowRedirectDowngrade=n.allowRedirectDowngrade),n.maxRedirects!=null&&(this._maxRedirects=Math.max(n.maxRedirects,0)),n.keepAlive!=null&&(this._keepAlive=n.keepAlive),n.allowRetries!=null&&(this._allowRetries=n.allowRetries),n.maxRetries!=null&&(this._maxRetries=n.maxRetries))}options(e,t){return a(this,void 0,void 0,function*(){return this.request(`OPTIONS`,e,null,t||{})})}get(e,t){return a(this,void 0,void 0,function*(){return this.request(`GET`,e,null,t||{})})}del(e,t){return a(this,void 0,void 0,function*(){return this.request(`DELETE`,e,null,t||{})})}post(e,t,n){return a(this,void 0,void 0,function*(){return this.request(`POST`,e,t,n||{})})}patch(e,t,n){return a(this,void 0,void 0,function*(){return this.request(`PATCH`,e,t,n||{})})}put(e,t,n){return a(this,void 0,void 0,function*(){return this.request(`PUT`,e,t,n||{})})}head(e,t){return a(this,void 0,void 0,function*(){return this.request(`HEAD`,e,null,t||{})})}sendStream(e,t,n,r){return a(this,void 0,void 0,function*(){return this.request(e,t,n,r)})}getJson(e){return a(this,arguments,void 0,function*(e,t={}){t[f.Accept]=this._getExistingOrDefaultHeader(t,f.Accept,p.ApplicationJson);let n=yield this.get(e,t);return this._processResponse(n,this.requestOptions)})}postJson(e,t){return a(this,arguments,void 0,function*(e,t,n={}){let r=JSON.stringify(t,null,2);n[f.Accept]=this._getExistingOrDefaultHeader(n,f.Accept,p.ApplicationJson),n[f.ContentType]=this._getExistingOrDefaultContentTypeHeader(n,p.ApplicationJson);let i=yield this.post(e,r,n);return this._processResponse(i,this.requestOptions)})}putJson(e,t){return a(this,arguments,void 0,function*(e,t,n={}){let r=JSON.stringify(t,null,2);n[f.Accept]=this._getExistingOrDefaultHeader(n,f.Accept,p.ApplicationJson),n[f.ContentType]=this._getExistingOrDefaultContentTypeHeader(n,p.ApplicationJson);let i=yield this.put(e,r,n);return this._processResponse(i,this.requestOptions)})}patchJson(e,t){return a(this,arguments,void 0,function*(e,t,n={}){let r=JSON.stringify(t,null,2);n[f.Accept]=this._getExistingOrDefaultHeader(n,f.Accept,p.ApplicationJson),n[f.ContentType]=this._getExistingOrDefaultContentTypeHeader(n,p.ApplicationJson);let i=yield this.patch(e,r,n);return this._processResponse(i,this.requestOptions)})}request(e,t,n,r){return a(this,void 0,void 0,function*(){if(this._disposed)throw Error(`Client has already been disposed.`);let i=new URL(t),a=this._prepareRequest(e,i,r),o=this._allowRetries&&v.includes(e)?this._maxRetries+1:1,s=0,c;do{if(c=yield this.requestRaw(a,n),c&&c.message&&c.message.statusCode===d.Unauthorized){let e;for(let t of this.handlers)if(t.canHandleAuthentication(c)){e=t;break}return e?e.handleAuthentication(this,a,n):c}let t=this._maxRedirects;for(;c.message.statusCode&&h.includes(c.message.statusCode)&&this._allowRedirects&&t>0;){let o=c.message.headers.location;if(!o)break;let s=new URL(o);if(i.protocol===`https:`&&i.protocol!==s.protocol&&!this._allowRedirectDowngrade)throw Error(`Redirect from HTTPS to HTTP protocol. This downgrade is not allowed for security reasons. If you want to allow this behavior, set the allowRedirectDowngrade option to true.`);if(yield c.readBody(),s.hostname!==i.hostname)for(let e in r)e.toLowerCase()===`authorization`&&delete r[e];a=this._prepareRequest(e,s,r),c=yield this.requestRaw(a,n),t--}if(!c.message.statusCode||!g.includes(c.message.statusCode))return c;s+=1,s{function i(e,t){e?r(e):t?n(t):r(Error(`Unknown error`))}this.requestRawWithCallback(e,t,i)})})}requestRawWithCallback(e,t,n){typeof t==`string`&&(e.options.headers||(e.options.headers={}),e.options.headers[`Content-Length`]=Buffer.byteLength(t,`utf8`));let r=!1;function i(e,t){r||(r=!0,n(e,t))}let a=e.httpModule.request(e.options,e=>{i(void 0,new b(e))}),o;a.on(`socket`,e=>{o=e}),a.setTimeout(this._socketTimeout||3*6e4,()=>{o&&o.end(),i(Error(`Request timeout: ${e.options.path}`))}),a.on(`error`,function(e){i(e)}),t&&typeof t==`string`&&a.write(t,`utf8`),t&&typeof t!=`string`?(t.on(`close`,function(){a.end()}),t.pipe(a)):a.end()}getAgent(e){let t=new URL(e);return this._getAgent(t)}getAgentDispatcher(e){let t=new URL(e),n=c.getProxyUrl(t);if(n&&n.hostname)return this._getProxyAgentDispatcher(t,n)}_prepareRequest(e,t,n){let r={};r.parsedUrl=t;let i=r.parsedUrl.protocol===`https:`;r.httpModule=i?s:o;let a=i?443:80;if(r.options={},r.options.host=r.parsedUrl.hostname,r.options.port=r.parsedUrl.port?parseInt(r.parsedUrl.port):a,r.options.path=(r.parsedUrl.pathname||``)+(r.parsedUrl.search||``),r.options.method=e,r.options.headers=this._mergeHeaders(n),this.userAgent!=null&&(r.options.headers[`user-agent`]=this.userAgent),r.options.agent=this._getAgent(r.parsedUrl),this.handlers)for(let e of this.handlers)e.prepareRequest(r.options);return r}_mergeHeaders(e){return this.requestOptions&&this.requestOptions.headers?Object.assign({},S(this.requestOptions.headers),S(e||{})):S(e||{})}_getExistingOrDefaultHeader(e,t,n){let r;if(this.requestOptions&&this.requestOptions.headers){let e=S(this.requestOptions.headers)[t];e&&(r=typeof e==`number`?e.toString():e)}let i=e[t];return i===void 0?r===void 0?n:r:typeof i==`number`?i.toString():i}_getExistingOrDefaultContentTypeHeader(e,t){let n;if(this.requestOptions&&this.requestOptions.headers){let e=S(this.requestOptions.headers)[f.ContentType];e&&(n=typeof e==`number`?String(e):Array.isArray(e)?e.join(`, `):e)}let r=e[f.ContentType];return r===void 0?n===void 0?t:n:typeof r==`number`?String(r):Array.isArray(r)?r.join(`, `):r}_getAgent(e){let t,n=c.getProxyUrl(e),r=n&&n.hostname;if(this._keepAlive&&r&&(t=this._proxyAgent),r||(t=this._agent),t)return t;let i=e.protocol===`https:`,a=100;if(this.requestOptions&&(a=this.requestOptions.maxSockets||o.globalAgent.maxSockets),n&&n.hostname){let e={maxSockets:a,keepAlive:this._keepAlive,proxy:Object.assign(Object.assign({},(n.username||n.password)&&{proxyAuth:`${n.username}:${n.password}`}),{host:n.hostname,port:n.port})},r,o=n.protocol===`https:`;r=i?o?l.httpsOverHttps:l.httpsOverHttp:o?l.httpOverHttps:l.httpOverHttp,t=r(e),this._proxyAgent=t}if(!t){let e={keepAlive:this._keepAlive,maxSockets:a};t=i?new s.Agent(e):new o.Agent(e),this._agent=t}return i&&this._ignoreSslError&&(t.options=Object.assign(t.options||{},{rejectUnauthorized:!1})),t}_getProxyAgentDispatcher(e,t){let n;if(this._keepAlive&&(n=this._proxyAgentDispatcher),n)return n;let r=e.protocol===`https:`;return n=new u.ProxyAgent(Object.assign({uri:t.href,pipelining:+!!this._keepAlive},(t.username||t.password)&&{token:`Basic ${Buffer.from(`${t.username}:${t.password}`).toString(`base64`)}`})),this._proxyAgentDispatcher=n,r&&this._ignoreSslError&&(n.options=Object.assign(n.options.requestTls||{},{rejectUnauthorized:!1})),n}_getUserAgentWithOrchestrationId(e){let t=e||`actions/http-client`,n=process.env.ACTIONS_ORCHESTRATION_ID;return n?`${t} actions_orchestration_id/${n.replace(/[^a-z0-9_.-]/gi,`_`)}`:t}_performExponentialBackoff(e){return a(this,void 0,void 0,function*(){e=Math.min(10,e);let t=5*2**e;return new Promise(e=>setTimeout(()=>e(),t))})}_processResponse(e,t){return a(this,void 0,void 0,function*(){return new Promise((n,r)=>a(this,void 0,void 0,function*(){let i=e.message.statusCode||0,a={statusCode:i,result:null,headers:{}};i===d.NotFound&&n(a);function o(e,t){if(typeof t==`string`){let e=new Date(t);if(!isNaN(e.valueOf()))return e}return t}let s,c;try{c=yield e.readBody(),c&&c.length>0&&(s=t&&t.deserializeDates?JSON.parse(c,o):JSON.parse(c),a.result=s),a.headers=e.message.headers}catch{}if(i>299){let e;e=s&&s.message?s.message:c&&c.length>0?c:`Failed request: (${i})`;let t=new y(e,i);t.result=a.result,r(t)}else n(a)}))})}};let S=e=>Object.keys(e).reduce((t,n)=>(t[n.toLowerCase()]=e[n],t),{})}))(),1),ac=function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})};function oc(e,t){if(!e&&!t.auth)throw Error(`Parameter token or opts.auth is required`);if(e&&t.auth)throw Error(`Parameters token and opts.auth may not both be specified`);return typeof t.auth==`string`?t.auth:`token ${e}`}function sc(e){return new ic.HttpClient().getAgent(e)}function cc(e){return new ic.HttpClient().getAgentDispatcher(e)}function lc(e){let t=cc(e);return(e,n)=>ac(this,void 0,void 0,function*(){return(0,cr.fetch)(e,Object.assign(Object.assign({},n),{dispatcher:t}))})}function uc(){return process.env.GITHUB_API_URL||`https://api.github.com`}function dc(e){let t=process.env.ACTIONS_ORCHESTRATION_ID?.trim();if(t){let n=`actions_orchestration_id/${t.replace(/[^a-z0-9_.-]/gi,`_`)}`;return e?.includes(n)?e:`${e?`${e} `:``}${n}`}return e}function fc(){return typeof navigator==`object`&&`userAgent`in navigator?navigator.userAgent:typeof process==`object`&&process.version!==void 0?`Node.js/${process.version.substr(1)} (${process.platform}; ${process.arch})`:``}function pc(e,t,n,r){if(typeof n!=`function`)throw Error(`method for before hook must be a function`);return r||={},Array.isArray(t)?t.reverse().reduce((t,n)=>pc.bind(null,e,n,t,r),n)():Promise.resolve().then(()=>e.registry[t]?e.registry[t].reduce((e,t)=>t.hook.bind(null,e,r),n)():n(r))}function mc(e,t,n,r){let i=r;e.registry[n]||(e.registry[n]=[]),t===`before`&&(r=(e,t)=>Promise.resolve().then(i.bind(null,t)).then(e.bind(null,t))),t===`after`&&(r=(e,t)=>{let n;return Promise.resolve().then(e.bind(null,t)).then(e=>(n=e,i(n,t))).then(()=>n)}),t===`error`&&(r=(e,t)=>Promise.resolve().then(e.bind(null,t)).catch(e=>i(e,t))),e.registry[n].push({hook:r,orig:i})}function hc(e,t,n){if(!e.registry[t])return;let r=e.registry[t].map(e=>e.orig).indexOf(n);r!==-1&&e.registry[t].splice(r,1)}const gc=Function.bind,_c=gc.bind(gc);function vc(e,t,n){let r=_c(hc,null).apply(null,n?[t,n]:[t]);e.api={remove:r},e.remove=r,[`before`,`error`,`after`,`wrap`].forEach(r=>{let i=n?[t,r,n]:[t,r];e[r]=e.api[r]=_c(mc,null).apply(null,i)})}function yc(){let e=Symbol(`Singular`),t={registry:{}},n=pc.bind(null,t,e);return vc(n,t,e),n}function bc(){let e={registry:{}},t=pc.bind(null,e);return vc(t,e),t}var xc={Singular:yc,Collection:bc},Sc={method:`GET`,baseUrl:`https://api.github.com`,headers:{accept:`application/vnd.github.v3+json`,"user-agent":`octokit-endpoint.js/0.0.0-development ${fc()}`},mediaType:{format:``}};function Cc(e){return e?Object.keys(e).reduce((t,n)=>(t[n.toLowerCase()]=e[n],t),{}):{}}function wc(e){if(typeof e!=`object`||!e||Object.prototype.toString.call(e)!==`[object Object]`)return!1;let t=Object.getPrototypeOf(e);if(t===null)return!0;let n=Object.prototype.hasOwnProperty.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n instanceof n&&Function.prototype.call(n)===Function.prototype.call(e)}function Tc(e,t){let n=Object.assign({},e);return Object.keys(t).forEach(r=>{wc(t[r])&&r in e?n[r]=Tc(e[r],t[r]):Object.assign(n,{[r]:t[r]})}),n}function Ec(e){for(let t in e)e[t]===void 0&&delete e[t];return e}function Dc(e,t,n){if(typeof t==`string`){let[e,r]=t.split(` `);n=Object.assign(r?{method:e,url:r}:{url:e},n)}else n=Object.assign({},t);n.headers=Cc(n.headers),Ec(n),Ec(n.headers);let r=Tc(e||{},n);return n.url===`/graphql`&&(e&&e.mediaType.previews?.length&&(r.mediaType.previews=e.mediaType.previews.filter(e=>!r.mediaType.previews.includes(e)).concat(r.mediaType.previews)),r.mediaType.previews=(r.mediaType.previews||[]).map(e=>e.replace(/-preview/,``))),r}function Oc(e,t){let n=/\?/.test(e)?`&`:`?`,r=Object.keys(t);return r.length===0?e:e+n+r.map(e=>e===`q`?`q=`+t.q.split(`+`).map(encodeURIComponent).join(`+`):`${e}=${encodeURIComponent(t[e])}`).join(`&`)}var kc=/\{[^{}}]+\}/g;function Ac(e){return e.replace(/(?:^\W+)|(?:(?e.concat(t),[]):[]}function Mc(e,t){let n={__proto__:null};for(let r of Object.keys(e))t.indexOf(r)===-1&&(n[r]=e[r]);return n}function Nc(e){return e.split(/(%[0-9A-Fa-f]{2})/g).map(function(e){return/%[0-9A-Fa-f]/.test(e)||(e=encodeURI(e).replace(/%5B/g,`[`).replace(/%5D/g,`]`)),e}).join(``)}function Pc(e){return encodeURIComponent(e).replace(/[!'()*]/g,function(e){return`%`+e.charCodeAt(0).toString(16).toUpperCase()})}function Fc(e,t,n){return t=e===`+`||e===`#`?Nc(t):Pc(t),n?Pc(n)+`=`+t:t}function Ic(e){return e!=null}function Lc(e){return e===`;`||e===`&`||e===`?`}function Rc(e,t,n,r){var i=e[n],a=[];if(Ic(i)&&i!==``)if(typeof i==`string`||typeof i==`number`||typeof i==`bigint`||typeof i==`boolean`)i=i.toString(),r&&r!==`*`&&(i=i.substring(0,parseInt(r,10))),a.push(Fc(t,i,Lc(t)?n:``));else if(r===`*`)Array.isArray(i)?i.filter(Ic).forEach(function(e){a.push(Fc(t,e,Lc(t)?n:``))}):Object.keys(i).forEach(function(e){Ic(i[e])&&a.push(Fc(t,i[e],e))});else{let e=[];Array.isArray(i)?i.filter(Ic).forEach(function(n){e.push(Fc(t,n))}):Object.keys(i).forEach(function(n){Ic(i[n])&&(e.push(Pc(n)),e.push(Fc(t,i[n].toString())))}),Lc(t)?a.push(Pc(n)+`=`+e.join(`,`)):e.length!==0&&a.push(e.join(`,`))}else t===`;`?Ic(i)&&a.push(Pc(n)):i===``&&(t===`&`||t===`?`)?a.push(Pc(n)+`=`):i===``&&a.push(``);return a}function zc(e){return{expand:Bc.bind(null,e)}}function Bc(e,t){var n=[`+`,`#`,`.`,`/`,`;`,`?`,`&`];return e=e.replace(/\{([^\{\}]+)\}|([^\{\}]+)/g,function(e,r,i){if(r){let e=``,i=[];if(n.indexOf(r.charAt(0))!==-1&&(e=r.charAt(0),r=r.substr(1)),r.split(/,/g).forEach(function(n){var r=/([^:\*]*)(?::(\d+)|(\*))?/.exec(n);i.push(Rc(t,e,r[1],r[2]||r[3]))}),e&&e!==`+`){var a=`,`;return e===`?`?a=`&`:e!==`#`&&(a=e),(i.length===0?``:e)+i.join(a)}else return i.join(`,`)}else return Nc(i)}),e===`/`?e:e.replace(/\/$/,``)}function Vc(e){let t=e.method.toUpperCase(),n=(e.url||`/`).replace(/:([a-z]\w+)/g,`{$1}`),r=Object.assign({},e.headers),i,a=Mc(e,[`method`,`baseUrl`,`url`,`headers`,`request`,`mediaType`]),o=jc(n);n=zc(n).expand(a),/^http/.test(n)||(n=e.baseUrl+n);let s=Mc(a,Object.keys(e).filter(e=>o.includes(e)).concat(`baseUrl`));return/application\/octet-stream/i.test(r.accept)||(e.mediaType.format&&(r.accept=r.accept.split(/,/).map(t=>t.replace(/application\/vnd(\.\w+)(\.v3)?(\.\w+)?(\+json)?$/,`application/vnd$1$2.${e.mediaType.format}`)).join(`,`)),n.endsWith(`/graphql`)&&e.mediaType.previews?.length&&(r.accept=(r.accept.match(/(?`application/vnd.github.${t}-preview${e.mediaType.format?`.${e.mediaType.format}`:`+json`}`).join(`,`))),[`GET`,`HEAD`].includes(t)?n=Oc(n,s):`data`in s?i=s.data:Object.keys(s).length&&(i=s),!r[`content-type`]&&i!==void 0&&(r[`content-type`]=`application/json; charset=utf-8`),[`PATCH`,`PUT`].includes(t)&&i===void 0&&(i=``),Object.assign({method:t,url:n,headers:r},i===void 0?null:{body:i},e.request?{request:e.request}:null)}function Hc(e,t,n){return Vc(Dc(e,t,n))}function Uc(e,t){let n=Dc(e,t),r=Hc.bind(null,n);return Object.assign(r,{DEFAULTS:n,defaults:Uc.bind(null,n),merge:Dc.bind(null,n),parse:Vc})}var Wc=Uc(null,Sc),Gc=i(((e,t)=>{let n=function(){};n.prototype=Object.create(null);let r=/; *([!#$%&'*+.^\w`|~-]+)=("(?:[\v\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\v\u0020-\u00ff])*"|[!#$%&'*+.^\w`|~-]+) */gu,i=/\\([\v\u0020-\u00ff])/gu,a=/^[!#$%&'*+.^\w|~-]+\/[!#$%&'*+.^\w|~-]+$/u,o={type:``,parameters:new n};Object.freeze(o.parameters),Object.freeze(o);function s(e){if(typeof e!=`string`)throw TypeError(`argument header is required and must be a string`);let t=e.indexOf(`;`),o=t===-1?e.trim():e.slice(0,t).trim();if(a.test(o)===!1)throw TypeError(`invalid media type`);let s={type:o.toLowerCase(),parameters:new n};if(t===-1)return s;let c,l,u;for(r.lastIndex=t;l=r.exec(e);){if(l.index!==t)throw TypeError(`invalid parameter format`);t+=l[0].length,c=l[1].toLowerCase(),u=l[2],u[0]===`"`&&(u=u.slice(1,u.length-1),i.test(u)&&(u=u.replace(i,`$1`))),s.parameters[c]=u}if(t!==e.length)throw TypeError(`invalid parameter format`);return s}function c(e){if(typeof e!=`string`)return o;let t=e.indexOf(`;`),s=t===-1?e.trim():e.slice(0,t).trim();if(a.test(s)===!1)return o;let c={type:s.toLowerCase(),parameters:new n};if(t===-1)return c;let l,u,d;for(r.lastIndex=t;u=r.exec(e);){if(u.index!==t)return o;t+=u[0].length,l=u[1].toLowerCase(),d=u[2],d[0]===`"`&&(d=d.slice(1,d.length-1),i.test(d)&&(d=d.replace(i,`$1`))),c.parameters[l]=d}return t===e.length?c:o}t.exports.default={parse:s,safeParse:c},t.exports.parse=s,t.exports.safeParse=c,t.exports.defaultContentType=o}))();const Kc=/^-?\d+$/,qc=/^-?\d+n+$/,Jc=JSON.stringify,Yc=JSON.parse,Xc=/^-?\d+n$/,Zc=/([\[:])?"(-?\d+)n"($|([\\n]|\s)*(\s|[\\n])*[,\}\]])/g,Qc=/([\[:])?("-?\d+n+)n("$|"([\\n]|\s)*(\s|[\\n])*[,\}\]])/g,$c=(e,t,n)=>`rawJSON`in JSON?Jc(e,(e,n)=>typeof n==`bigint`?JSON.rawJSON(n.toString()):typeof t==`function`?t(e,n):(Array.isArray(t)&&t.includes(e),n),n):e?Jc(e,(e,n)=>typeof n==`string`&&n.match(qc)||typeof n==`bigint`?n.toString()+`n`:typeof t==`function`?t(e,n):(Array.isArray(t)&&t.includes(e),n),n).replace(Zc,`$1$2$3`).replace(Qc,`$1$2$3`):Jc(e,t,n),el=()=>JSON.parse(`1`,(e,t,n)=>!!n&&n.source===`1`),tl=(e,t,n,r)=>typeof t==`string`&&t.match(Xc)?BigInt(t.slice(0,-1)):typeof t==`string`&&t.match(qc)?t.slice(0,-1):typeof r==`function`?r(e,t,n):t,nl=(e,t)=>JSON.parse(e,(e,n,r)=>{let i=typeof n==`number`&&(n>2**53-1||n<-(2**53-1)),a=r&&Kc.test(r.source);return i&&a?BigInt(r.source):typeof t==`function`?t(e,n,r):n}),rl=(2**53-1).toString(),il=rl.length,al=/"(?:\\.|[^"])*"|-?(0|[1-9][0-9]*)(\.[0-9]+)?([eE][+-]?[0-9]+)?/g,ol=/^"-?\d+n+"$/,sl=(e,t)=>e?el()?nl(e,t):Yc(e.replace(al,(e,t,n,r)=>{let i=e[0]===`"`;if(i&&e.match(ol))return e.substring(0,e.length-1)+`n"`;let a=n||r,o=t&&(t.lengthtl(e,n,r,t)):Yc(e,t);var cl=class extends Error{name;status;request;response;constructor(e,t,n){super(e,{cause:n.cause}),this.name=`HttpError`,this.status=Number.parseInt(t),Number.isNaN(this.status)&&(this.status=0),`response`in n&&(this.response=n.response);let r=Object.assign({},n.request);n.request.headers.authorization&&(r.headers=Object.assign({},n.request.headers,{authorization:n.request.headers.authorization.replace(/(?``;async function fl(e){let t=e.request?.fetch||globalThis.fetch;if(!t)throw Error(`fetch is not set. Please pass a fetch implementation as new Octokit({ request: { fetch }}). Learn more at https://github.com/octokit/octokit.js/#fetch-missing`);let n=e.request?.log||console,r=e.request?.parseSuccessResponseBody!==!1,i=ul(e.body)||Array.isArray(e.body)?$c(e.body):e.body,a=Object.fromEntries(Object.entries(e.headers).map(([e,t])=>[e,String(t)])),o;try{o=await t(e.url,{method:e.method,body:i,redirect:e.request?.redirect,headers:a,signal:e.request?.signal,...e.body&&{duplex:`half`}})}catch(t){let n=`Unknown Error`;if(t instanceof Error){if(t.name===`AbortError`)throw t.status=500,t;n=t.message,t.name===`TypeError`&&`cause`in t&&(t.cause instanceof Error?n=t.cause.message:typeof t.cause==`string`&&(n=t.cause))}let r=new cl(n,500,{request:e});throw r.cause=t,r}let s=o.status,c=o.url,l={};for(let[e,t]of o.headers)l[e]=t;let u={url:c,status:s,headers:l,data:``};if(`deprecation`in l){let t=l.link&&l.link.match(/<([^<>]+)>; rel="deprecation"/),r=t&&t.pop();n.warn(`[@octokit/request] "${e.method} ${e.url}" is deprecated. It is scheduled to be removed on ${l.sunset}${r?`. See ${r}`:``}`)}if(s===204||s===205)return u;if(e.method===`HEAD`){if(s<400)return u;throw new cl(o.statusText,s,{response:u,request:e})}if(s===304)throw u.data=await pl(o),new cl(`Not modified`,s,{response:u,request:e});if(s>=400)throw u.data=await pl(o),new cl(hl(u.data),s,{response:u,request:e});return u.data=r?await pl(o):o.body,u}async function pl(e){let t=e.headers.get(`content-type`);if(!t)return e.text().catch(dl);let n=(0,Gc.safeParse)(t);if(ml(n)){let t=``;try{return t=await e.text(),sl(t)}catch{return t}}else if(n.type.startsWith(`text/`)||n.parameters.charset?.toLowerCase()===`utf-8`)return e.text().catch(dl);else return e.arrayBuffer().catch(()=>new ArrayBuffer(0))}function ml(e){return e.type===`application/json`||e.type===`application/scim+json`}function hl(e){if(typeof e==`string`)return e;if(e instanceof ArrayBuffer)return`Unknown error`;if(`message`in e){let t=`documentation_url`in e?` - ${e.documentation_url}`:``;return Array.isArray(e.errors)?`${e.message}: ${e.errors.map(e=>JSON.stringify(e)).join(`, `)}${t}`:`${e.message}${t}`}return`Unknown error: ${JSON.stringify(e)}`}function gl(e,t){let n=e.defaults(t);return Object.assign(function(e,t){let r=n.merge(e,t);if(!r.request||!r.request.hook)return fl(n.parse(r));let i=(e,t)=>fl(n.parse(n.merge(e,t)));return Object.assign(i,{endpoint:n,defaults:gl.bind(null,n)}),r.request.hook(i,r)},{endpoint:n,defaults:gl.bind(null,n)})}var _l=gl(Wc,ll),vl=`0.0.0-development`;function yl(e){return`Request failed due to following response errors: `+e.errors.map(e=>` - ${e.message}`).join(` `)}var bl=class extends Error{constructor(e,t,n){super(yl(n)),this.request=e,this.headers=t,this.response=n,this.errors=n.errors,this.data=n.data,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}name=`GraphqlResponseError`;errors;data},xl=[`method`,`baseUrl`,`url`,`headers`,`request`,`query`,`mediaType`,`operationName`],Sl=[`query`,`method`,`url`],Cl=/\/api\/v3\/?$/;function wl(e,t,n){if(n){if(typeof t==`string`&&`query`in n)return Promise.reject(Error(`[@octokit/graphql] "query" cannot be used as variable name`));for(let e in n)if(Sl.includes(e))return Promise.reject(Error(`[@octokit/graphql] "${e}" cannot be used as variable name`))}let r=typeof t==`string`?Object.assign({query:t},n):t,i=Object.keys(r).reduce((e,t)=>xl.includes(t)?(e[t]=r[t],e):(e.variables||={},e.variables[t]=r[t],e),{}),a=r.baseUrl||e.endpoint.DEFAULTS.baseUrl;return Cl.test(a)&&(i.url=a.replace(Cl,`/api/graphql`)),e(i).then(e=>{if(e.data.errors){let t={};for(let n of Object.keys(e.headers))t[n]=e.headers[n];throw new bl(i,t,e.data)}return e.data.data})}function Tl(e,t){let n=e.defaults(t);return Object.assign((e,t)=>wl(n,e,t),{defaults:Tl.bind(null,n),endpoint:n.endpoint})}Tl(_l,{headers:{"user-agent":`octokit-graphql.js/${vl} ${fc()}`},method:`POST`,url:`/graphql`});function El(e){return Tl(e,{method:`POST`,url:`/graphql`})}var Dl=`(?:[a-zA-Z0-9_-]+)`,Ol=`\\.`,kl=RegExp(`^${Dl}${Ol}${Dl}${Ol}${Dl}$`),Al=kl.test.bind(kl);async function jl(e){let t=Al(e),n=e.startsWith(`v1.`)||e.startsWith(`ghs_`),r=e.startsWith(`ghu_`);return{type:`token`,token:e,tokenType:t?`app`:n?`installation`:r?`user-to-server`:`oauth`}}function Ml(e){return e.split(/\./).length===3?`bearer ${e}`:`token ${e}`}async function Nl(e,t,n,r){let i=t.endpoint.merge(n,r);return i.headers.authorization=Ml(e),t(i)}var Pl=function(e){if(!e)throw Error(`[@octokit/auth-token] No token passed to createTokenAuth`);if(typeof e!=`string`)throw Error(`[@octokit/auth-token] Token passed to createTokenAuth is not a string`);return e=e.replace(/^(token|bearer) +/i,``),Object.assign(jl.bind(null,e),{hook:Nl.bind(null,e)})};const Fl=`7.0.6`,Il=()=>{},Ll=console.warn.bind(console),Rl=console.error.bind(console);function zl(e={}){return typeof e.debug!=`function`&&(e.debug=Il),typeof e.info!=`function`&&(e.info=Il),typeof e.warn!=`function`&&(e.warn=Ll),typeof e.error!=`function`&&(e.error=Rl),e}const Bl=`octokit-core.js/${Fl} ${fc()}`;var Vl=class{static VERSION=Fl;static defaults(e){return class extends this{constructor(...t){let n=t[0]||{};if(typeof e==`function`){super(e(n));return}super(Object.assign({},e,n,n.userAgent&&e.userAgent?{userAgent:`${n.userAgent} ${e.userAgent}`}:null))}}}static plugins=[];static plugin(...e){let t=this.plugins;return class extends this{static plugins=t.concat(e.filter(e=>!t.includes(e)))}}constructor(e={}){let t=new xc.Collection,n={baseUrl:_l.endpoint.DEFAULTS.baseUrl,headers:{},request:Object.assign({},e.request,{hook:t.bind(null,`request`)}),mediaType:{previews:[],format:``}};if(n.headers[`user-agent`]=e.userAgent?`${e.userAgent} ${Bl}`:Bl,e.baseUrl&&(n.baseUrl=e.baseUrl),e.previews&&(n.mediaType.previews=e.previews),e.timeZone&&(n.headers[`time-zone`]=e.timeZone),this.request=_l.defaults(n),this.graphql=El(this.request).defaults(n),this.log=zl(e.log),this.hook=t,e.authStrategy){let{authStrategy:n,...r}=e,i=n(Object.assign({request:this.request,log:this.log,octokit:this,octokitOptions:r},e.auth));t.wrap(`request`,i.hook),this.auth=i}else if(!e.auth)this.auth=async()=>({type:`unauthenticated`});else{let n=Pl(e.auth);t.wrap(`request`,n.hook),this.auth=n}let r=this.constructor;for(let t=0;t({async next(){if(!s)return{done:!0};try{let e=Zl(await i({method:a,url:s,headers:o}));if(s=((e.headers.link||``).match(/<([^<>]+)>;\s*rel="next"/)||[])[1],!s&&`total_commits`in e.data){let t=new URL(e.url),n=t.searchParams,r=parseInt(n.get(`page`)||`1`,10);r*parseInt(n.get(`per_page`)||`250`,10){if(i.done)return t;let a=!1;function o(){a=!0}return t=t.concat(r?r(i.value,o):i.value.data),a?t:eu(e,t,n,r)})}Object.assign($l,{iterator:Ql});function tu(e){return{paginate:Object.assign($l.bind(null,e),{iterator:Ql.bind(null,e)})}}tu.VERSION=Xl,new nc;const nu=uc(),ru={baseUrl:nu,request:{agent:sc(nu),fetch:lc(nu)}},iu=Vl.plugin(Jl,tu).defaults(ru);function au(e,t){let n=Object.assign({},t||{}),r=oc(e,n);r&&(n.auth=r);let i=dc(n.userAgent);return i&&(n.userAgent=i),n}const ou=new nc;function su(e,t,...n){return new(iu.plugin(...n))(au(e,t))}var cu=i(((e,t)=>{t.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:2**53-1||9007199254740991,RELEASE_TYPES:[`major`,`premajor`,`minor`,`preminor`,`patch`,`prepatch`,`prerelease`],SEMVER_SPEC_VERSION:`2.0.0`,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}})),lu=i(((e,t)=>{t.exports=typeof process==`object`&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error(`SEMVER`,...e):()=>{}})),uu=i(((e,t)=>{let{MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:r,MAX_LENGTH:i}=cu(),a=lu();e=t.exports={};let o=e.re=[],s=e.safeRe=[],c=e.src=[],l=e.safeSrc=[],u=e.t={},d=0,f=`[a-zA-Z0-9-]`,p=[[`\\s`,1],[`\\d`,i],[f,r]],m=e=>{for(let[t,n]of p)e=e.split(`${t}*`).join(`${t}{0,${n}}`).split(`${t}+`).join(`${t}{1,${n}}`);return e},h=(e,t,n)=>{let r=m(t),i=d++;a(e,i,t),u[e]=i,c[i]=t,l[i]=r,o[i]=new RegExp(t,n?`g`:void 0),s[i]=new RegExp(r,n?`g`:void 0)};h(`NUMERICIDENTIFIER`,`0|[1-9]\\d*`),h(`NUMERICIDENTIFIERLOOSE`,`\\d+`),h(`NONNUMERICIDENTIFIER`,`\\d*[a-zA-Z-]${f}*`),h(`MAINVERSION`,`(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})`),h(`MAINVERSIONLOOSE`,`(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})`),h(`PRERELEASEIDENTIFIER`,`(?:${c[u.NONNUMERICIDENTIFIER]}|${c[u.NUMERICIDENTIFIER]})`),h(`PRERELEASEIDENTIFIERLOOSE`,`(?:${c[u.NONNUMERICIDENTIFIER]}|${c[u.NUMERICIDENTIFIERLOOSE]})`),h(`PRERELEASE`,`(?:-(${c[u.PRERELEASEIDENTIFIER]}(?:\\.${c[u.PRERELEASEIDENTIFIER]})*))`),h(`PRERELEASELOOSE`,`(?:-?(${c[u.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${c[u.PRERELEASEIDENTIFIERLOOSE]})*))`),h(`BUILDIDENTIFIER`,`${f}+`),h(`BUILD`,`(?:\\+(${c[u.BUILDIDENTIFIER]}(?:\\.${c[u.BUILDIDENTIFIER]})*))`),h(`FULLPLAIN`,`v?${c[u.MAINVERSION]}${c[u.PRERELEASE]}?${c[u.BUILD]}?`),h(`FULL`,`^${c[u.FULLPLAIN]}$`),h(`LOOSEPLAIN`,`[v=\\s]*${c[u.MAINVERSIONLOOSE]}${c[u.PRERELEASELOOSE]}?${c[u.BUILD]}?`),h(`LOOSE`,`^${c[u.LOOSEPLAIN]}$`),h(`GTLT`,`((?:<|>)?=?)`),h(`XRANGEIDENTIFIERLOOSE`,`${c[u.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),h(`XRANGEIDENTIFIER`,`${c[u.NUMERICIDENTIFIER]}|x|X|\\*`),h(`XRANGEPLAIN`,`[v=\\s]*(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:${c[u.PRERELEASE]})?${c[u.BUILD]}?)?)?`),h(`XRANGEPLAINLOOSE`,`[v=\\s]*(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:${c[u.PRERELEASELOOSE]})?${c[u.BUILD]}?)?)?`),h(`XRANGE`,`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAIN]}$`),h(`XRANGELOOSE`,`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAINLOOSE]}$`),h(`COERCEPLAIN`,`(^|[^\\d])(\\d{1,${n}})(?:\\.(\\d{1,${n}}))?(?:\\.(\\d{1,${n}}))?`),h(`COERCE`,`${c[u.COERCEPLAIN]}(?:$|[^\\d])`),h(`COERCEFULL`,c[u.COERCEPLAIN]+`(?:${c[u.PRERELEASE]})?(?:${c[u.BUILD]})?(?:$|[^\\d])`),h(`COERCERTL`,c[u.COERCE],!0),h(`COERCERTLFULL`,c[u.COERCEFULL],!0),h(`LONETILDE`,`(?:~>?)`),h(`TILDETRIM`,`(\\s*)${c[u.LONETILDE]}\\s+`,!0),e.tildeTrimReplace=`$1~`,h(`TILDE`,`^${c[u.LONETILDE]}${c[u.XRANGEPLAIN]}$`),h(`TILDELOOSE`,`^${c[u.LONETILDE]}${c[u.XRANGEPLAINLOOSE]}$`),h(`LONECARET`,`(?:\\^)`),h(`CARETTRIM`,`(\\s*)${c[u.LONECARET]}\\s+`,!0),e.caretTrimReplace=`$1^`,h(`CARET`,`^${c[u.LONECARET]}${c[u.XRANGEPLAIN]}$`),h(`CARETLOOSE`,`^${c[u.LONECARET]}${c[u.XRANGEPLAINLOOSE]}$`),h(`COMPARATORLOOSE`,`^${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]})$|^$`),h(`COMPARATOR`,`^${c[u.GTLT]}\\s*(${c[u.FULLPLAIN]})$|^$`),h(`COMPARATORTRIM`,`(\\s*)${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]}|${c[u.XRANGEPLAIN]})`,!0),e.comparatorTrimReplace=`$1$2$3`,h(`HYPHENRANGE`,`^\\s*(${c[u.XRANGEPLAIN]})\\s+-\\s+(${c[u.XRANGEPLAIN]})\\s*$`),h(`HYPHENRANGELOOSE`,`^\\s*(${c[u.XRANGEPLAINLOOSE]})\\s+-\\s+(${c[u.XRANGEPLAINLOOSE]})\\s*$`),h(`STAR`,`(<|>)?=?\\s*\\*`),h(`GTE0`,`^\\s*>=\\s*0\\.0\\.0\\s*$`),h(`GTE0PRE`,`^\\s*>=\\s*0\\.0\\.0-0\\s*$`)})),du=i(((e,t)=>{let n=Object.freeze({loose:!0}),r=Object.freeze({});t.exports=e=>e?typeof e==`object`?e:n:r})),fu=i(((e,t)=>{let n=/^[0-9]+$/,r=(e,t)=>{if(typeof e==`number`&&typeof t==`number`)return e===t?0:er(t,e)}})),pu=i(((e,t)=>{let n=lu(),{MAX_LENGTH:r,MAX_SAFE_INTEGER:i}=cu(),{safeRe:a,t:o}=uu(),s=du(),{compareIdentifiers:c}=fu();t.exports=class e{constructor(t,c){if(c=s(c),t instanceof e){if(t.loose===!!c.loose&&t.includePrerelease===!!c.includePrerelease)return t;t=t.version}else if(typeof t!=`string`)throw TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>r)throw TypeError(`version is longer than ${r} characters`);n(`SemVer`,t,c),this.options=c,this.loose=!!c.loose,this.includePrerelease=!!c.includePrerelease;let l=t.trim().match(c.loose?a[o.LOOSE]:a[o.FULL]);if(!l)throw TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+l[1],this.minor=+l[2],this.patch=+l[3],this.major>i||this.major<0)throw TypeError(`Invalid major version`);if(this.minor>i||this.minor<0)throw TypeError(`Invalid minor version`);if(this.patch>i||this.patch<0)throw TypeError(`Invalid patch version`);l[4]?this.prerelease=l[4].split(`.`).map(e=>{if(/^[0-9]+$/.test(e)){let t=+e;if(t>=0&&tt.major?1:this.minort.minor?1:this.patcht.patch)}comparePre(t){if(t instanceof e||(t=new e(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let r=0;do{let e=this.prerelease[r],i=t.prerelease[r];if(n(`prerelease compare`,r,e,i),e===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(e===void 0)return-1;if(e===i)continue;return c(e,i)}while(++r)}compareBuild(t){t instanceof e||(t=new e(t,this.options));let r=0;do{let e=this.build[r],i=t.build[r];if(n(`build compare`,r,e,i),e===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(e===void 0)return-1;if(e===i)continue;return c(e,i)}while(++r)}inc(e,t,n){if(e.startsWith(`pre`)){if(!t&&n===!1)throw Error(`invalid increment argument: identifier is empty`);if(t){let e=`-${t}`.match(this.options.loose?a[o.PRERELEASELOOSE]:a[o.PRERELEASE]);if(!e||e[1]!==t)throw Error(`invalid identifier: ${t}`)}}switch(e){case`premajor`:this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc(`pre`,t,n);break;case`preminor`:this.prerelease.length=0,this.patch=0,this.minor++,this.inc(`pre`,t,n);break;case`prepatch`:this.prerelease.length=0,this.inc(`patch`,t,n),this.inc(`pre`,t,n);break;case`prerelease`:this.prerelease.length===0&&this.inc(`patch`,t,n),this.inc(`pre`,t,n);break;case`release`:if(this.prerelease.length===0)throw Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case`major`:(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case`minor`:(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case`patch`:this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case`pre`:{let e=+!!Number(n);if(this.prerelease.length===0)this.prerelease=[e];else{let r=this.prerelease.length;for(;--r>=0;)typeof this.prerelease[r]==`number`&&(this.prerelease[r]++,r=-2);if(r===-1){if(t===this.prerelease.join(`.`)&&n===!1)throw Error(`invalid increment argument: identifier already exists`);this.prerelease.push(e)}}if(t){let r=[t,e];n===!1&&(r=[t]),c(this.prerelease[0],t)===0?isNaN(this.prerelease[1])&&(this.prerelease=r):this.prerelease=r}break}default:throw Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(`.`)}`),this}}})),mu=i(((e,t)=>{let n=pu();t.exports=(e,t,r=!1)=>{if(e instanceof n)return e;try{return new n(e,t)}catch(e){if(!r)return null;throw e}}})),hu=i(((e,t)=>{let n=mu();t.exports=(e,t)=>{let r=n(e,t);return r?r.version:null}})),gu=i(((e,t)=>{let n=mu();t.exports=(e,t)=>{let r=n(e.trim().replace(/^[=v]+/,``),t);return r?r.version:null}})),_u=i(((e,t)=>{let n=pu();t.exports=(e,t,r,i,a)=>{typeof r==`string`&&(a=i,i=r,r=void 0);try{return new n(e instanceof n?e.version:e,r).inc(t,i,a).version}catch{return null}}})),vu=i(((e,t)=>{let n=mu();t.exports=(e,t)=>{let r=n(e,null,!0),i=n(t,null,!0),a=r.compare(i);if(a===0)return null;let o=a>0,s=o?r:i,c=o?i:r,l=!!s.prerelease.length;if(c.prerelease.length&&!l){if(!c.patch&&!c.minor)return`major`;if(c.compareMain(s)===0)return c.minor&&!c.patch?`minor`:`patch`}let u=l?`pre`:``;return r.major===i.major?r.minor===i.minor?r.patch===i.patch?`prerelease`:u+`patch`:u+`minor`:u+`major`}})),yu=i(((e,t)=>{let n=pu();t.exports=(e,t)=>new n(e,t).major})),bu=i(((e,t)=>{let n=pu();t.exports=(e,t)=>new n(e,t).minor})),xu=i(((e,t)=>{let n=pu();t.exports=(e,t)=>new n(e,t).patch})),Su=i(((e,t)=>{let n=mu();t.exports=(e,t)=>{let r=n(e,t);return r&&r.prerelease.length?r.prerelease:null}})),Cu=i(((e,t)=>{let n=pu();t.exports=(e,t,r)=>new n(e,r).compare(new n(t,r))})),wu=i(((e,t)=>{let n=Cu();t.exports=(e,t,r)=>n(t,e,r)})),Tu=i(((e,t)=>{let n=Cu();t.exports=(e,t)=>n(e,t,!0)})),Eu=i(((e,t)=>{let n=pu();t.exports=(e,t,r)=>{let i=new n(e,r),a=new n(t,r);return i.compare(a)||i.compareBuild(a)}})),Du=i(((e,t)=>{let n=Eu();t.exports=(e,t)=>e.sort((e,r)=>n(e,r,t))})),Ou=i(((e,t)=>{let n=Eu();t.exports=(e,t)=>e.sort((e,r)=>n(r,e,t))})),ku=i(((e,t)=>{let n=Cu();t.exports=(e,t,r)=>n(e,t,r)>0})),Au=i(((e,t)=>{let n=Cu();t.exports=(e,t,r)=>n(e,t,r)<0})),ju=i(((e,t)=>{let n=Cu();t.exports=(e,t,r)=>n(e,t,r)===0})),Mu=i(((e,t)=>{let n=Cu();t.exports=(e,t,r)=>n(e,t,r)!==0})),Nu=i(((e,t)=>{let n=Cu();t.exports=(e,t,r)=>n(e,t,r)>=0})),Pu=i(((e,t)=>{let n=Cu();t.exports=(e,t,r)=>n(e,t,r)<=0})),Fu=i(((e,t)=>{let n=ju(),r=Mu(),i=ku(),a=Nu(),o=Au(),s=Pu();t.exports=(e,t,c,l)=>{switch(t){case`===`:return typeof e==`object`&&(e=e.version),typeof c==`object`&&(c=c.version),e===c;case`!==`:return typeof e==`object`&&(e=e.version),typeof c==`object`&&(c=c.version),e!==c;case``:case`=`:case`==`:return n(e,c,l);case`!=`:return r(e,c,l);case`>`:return i(e,c,l);case`>=`:return a(e,c,l);case`<`:return o(e,c,l);case`<=`:return s(e,c,l);default:throw TypeError(`Invalid operator: ${t}`)}}})),Iu=i(((e,t)=>{let n=pu(),r=mu(),{safeRe:i,t:a}=uu();t.exports=(e,t)=>{if(e instanceof n)return e;if(typeof e==`number`&&(e=String(e)),typeof e!=`string`)return null;t||={};let o=null;if(!t.rtl)o=e.match(t.includePrerelease?i[a.COERCEFULL]:i[a.COERCE]);else{let n=t.includePrerelease?i[a.COERCERTLFULL]:i[a.COERCERTL],r;for(;(r=n.exec(e))&&(!o||o.index+o[0].length!==e.length);)(!o||r.index+r[0].length!==o.index+o[0].length)&&(o=r),n.lastIndex=r.index+r[1].length+r[2].length;n.lastIndex=-1}if(o===null)return null;let s=o[2];return r(`${s}.${o[3]||`0`}.${o[4]||`0`}${t.includePrerelease&&o[5]?`-${o[5]}`:``}${t.includePrerelease&&o[6]?`+${o[6]}`:``}`,t)}})),Lu=i(((e,t)=>{t.exports=class{constructor(){this.max=1e3,this.map=new Map}get(e){let t=this.map.get(e);if(t!==void 0)return this.map.delete(e),this.map.set(e,t),t}delete(e){return this.map.delete(e)}set(e,t){if(!this.delete(e)&&t!==void 0){if(this.map.size>=this.max){let e=this.map.keys().next().value;this.delete(e)}this.map.set(e,t)}return this}}})),Ru=i(((e,t)=>{let n=/\s+/g;t.exports=class e{constructor(t,r){if(r=i(r),t instanceof e)return t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease?t:new e(t.raw,r);if(t instanceof a)return this.raw=t.value,this.set=[[t]],this.formatted=void 0,this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=t.trim().replace(n,` `),this.set=this.raw.split(`||`).map(e=>this.parseRange(e.trim())).filter(e=>e.length),!this.set.length)throw TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let e=this.set[0];if(this.set=this.set.filter(e=>!h(e[0])),this.set.length===0)this.set=[e];else if(this.set.length>1){for(let e of this.set)if(e.length===1&&g(e[0])){this.set=[e];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted=``;for(let e=0;e0&&(this.formatted+=`||`);let t=this.set[e];for(let e=0;e0&&(this.formatted+=` `),this.formatted+=t[e].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){let t=((this.options.includePrerelease&&p)|(this.options.loose&&m))+`:`+e,n=r.get(t);if(n)return n;let i=this.options.loose,s=i?c[l.HYPHENRANGELOOSE]:c[l.HYPHENRANGE];e=e.replace(s,k(this.options.includePrerelease)),o(`hyphen replace`,e),e=e.replace(c[l.COMPARATORTRIM],u),o(`comparator trim`,e),e=e.replace(c[l.TILDETRIM],d),o(`tilde trim`,e),e=e.replace(c[l.CARETTRIM],f),o(`caret trim`,e);let g=e.split(` `).map(e=>y(e,this.options)).join(` `).split(/\s+/).map(e=>O(e,this.options));i&&(g=g.filter(e=>(o(`loose invalid filter`,e,this.options),!!e.match(c[l.COMPARATORLOOSE])))),o(`range list`,g);let v=new Map,b=g.map(e=>new a(e,this.options));for(let e of b){if(h(e))return[e];v.set(e.value,e)}v.size>1&&v.has(``)&&v.delete(``);let x=[...v.values()];return r.set(t,x),x}intersects(t,n){if(!(t instanceof e))throw TypeError(`a Range is required`);return this.set.some(e=>v(e,n)&&t.set.some(t=>v(t,n)&&e.every(e=>t.every(t=>e.intersects(t,n)))))}test(e){if(!e)return!1;if(typeof e==`string`)try{e=new s(e,this.options)}catch{return!1}for(let t=0;te.value===`<0.0.0-0`,g=e=>e.value===``,v=(e,t)=>{let n=!0,r=e.slice(),i=r.pop();for(;n&&r.length;)n=r.every(e=>i.intersects(e,t)),i=r.pop();return n},y=(e,t)=>(e=e.replace(c[l.BUILD],``),o(`comp`,e,t),e=C(e,t),o(`caret`,e),e=x(e,t),o(`tildes`,e),e=T(e,t),o(`xrange`,e),e=D(e,t),o(`stars`,e),e),b=e=>!e||e.toLowerCase()===`x`||e===`*`,x=(e,t)=>e.trim().split(/\s+/).map(e=>S(e,t)).join(` `),S=(e,t)=>{let n=t.loose?c[l.TILDELOOSE]:c[l.TILDE];return e.replace(n,(t,n,r,i,a)=>{o(`tilde`,e,t,n,r,i,a);let s;return b(n)?s=``:b(r)?s=`>=${n}.0.0 <${+n+1}.0.0-0`:b(i)?s=`>=${n}.${r}.0 <${n}.${+r+1}.0-0`:a?(o(`replaceTilde pr`,a),s=`>=${n}.${r}.${i}-${a} <${n}.${+r+1}.0-0`):s=`>=${n}.${r}.${i} <${n}.${+r+1}.0-0`,o(`tilde return`,s),s})},C=(e,t)=>e.trim().split(/\s+/).map(e=>w(e,t)).join(` `),w=(e,t)=>{o(`caret`,e,t);let n=t.loose?c[l.CARETLOOSE]:c[l.CARET],r=t.includePrerelease?`-0`:``;return e.replace(n,(t,n,i,a,s)=>{o(`caret`,e,t,n,i,a,s);let c;return b(n)?c=``:b(i)?c=`>=${n}.0.0${r} <${+n+1}.0.0-0`:b(a)?c=n===`0`?`>=${n}.${i}.0${r} <${n}.${+i+1}.0-0`:`>=${n}.${i}.0${r} <${+n+1}.0.0-0`:s?(o(`replaceCaret pr`,s),c=n===`0`?i===`0`?`>=${n}.${i}.${a}-${s} <${n}.${i}.${+a+1}-0`:`>=${n}.${i}.${a}-${s} <${n}.${+i+1}.0-0`:`>=${n}.${i}.${a}-${s} <${+n+1}.0.0-0`):(o(`no pr`),c=n===`0`?i===`0`?`>=${n}.${i}.${a}${r} <${n}.${i}.${+a+1}-0`:`>=${n}.${i}.${a}${r} <${n}.${+i+1}.0-0`:`>=${n}.${i}.${a} <${+n+1}.0.0-0`),o(`caret return`,c),c})},T=(e,t)=>(o(`replaceXRanges`,e,t),e.split(/\s+/).map(e=>E(e,t)).join(` `)),E=(e,t)=>{e=e.trim();let n=t.loose?c[l.XRANGELOOSE]:c[l.XRANGE];return e.replace(n,(n,r,i,a,s,c)=>{o(`xRange`,e,n,r,i,a,s,c);let l=b(i),u=l||b(a),d=u||b(s),f=d;return r===`=`&&f&&(r=``),c=t.includePrerelease?`-0`:``,l?n=r===`>`||r===`<`?`<0.0.0-0`:`*`:r&&f?(u&&(a=0),s=0,r===`>`?(r=`>=`,u?(i=+i+1,a=0,s=0):(a=+a+1,s=0)):r===`<=`&&(r=`<`,u?i=+i+1:a=+a+1),r===`<`&&(c=`-0`),n=`${r+i}.${a}.${s}${c}`):u?n=`>=${i}.0.0${c} <${+i+1}.0.0-0`:d&&(n=`>=${i}.${a}.0${c} <${i}.${+a+1}.0-0`),o(`xRange return`,n),n})},D=(e,t)=>(o(`replaceStars`,e,t),e.trim().replace(c[l.STAR],``)),O=(e,t)=>(o(`replaceGTE0`,e,t),e.trim().replace(c[t.includePrerelease?l.GTE0PRE:l.GTE0],``)),k=e=>(t,n,r,i,a,o,s,c,l,u,d,f)=>(n=b(r)?``:b(i)?`>=${r}.0.0${e?`-0`:``}`:b(a)?`>=${r}.${i}.0${e?`-0`:``}`:o?`>=${n}`:`>=${n}${e?`-0`:``}`,c=b(l)?``:b(u)?`<${+l+1}.0.0-0`:b(d)?`<${l}.${+u+1}.0-0`:f?`<=${l}.${u}.${d}-${f}`:e?`<${l}.${u}.${+d+1}-0`:`<=${c}`,`${n} ${c}`.trim()),A=(e,t,n)=>{for(let n=0;n0){let r=e[n].semver;if(r.major===t.major&&r.minor===t.minor&&r.patch===t.patch)return!0}return!1}return!0}})),zu=i(((e,t)=>{let n=Symbol(`SemVer ANY`);t.exports=class e{static get ANY(){return n}constructor(t,i){if(i=r(i),t instanceof e){if(t.loose===!!i.loose)return t;t=t.value}t=t.trim().split(/\s+/).join(` `),s(`comparator`,t,i),this.options=i,this.loose=!!i.loose,this.parse(t),this.semver===n?this.value=``:this.value=this.operator+this.semver.version,s(`comp`,this)}parse(e){let t=this.options.loose?i[a.COMPARATORLOOSE]:i[a.COMPARATOR],r=e.match(t);if(!r)throw TypeError(`Invalid comparator: ${e}`);this.operator=r[1]===void 0?``:r[1],this.operator===`=`&&(this.operator=``),r[2]?this.semver=new c(r[2],this.options.loose):this.semver=n}toString(){return this.value}test(e){if(s(`Comparator.test`,e,this.options.loose),this.semver===n||e===n)return!0;if(typeof e==`string`)try{e=new c(e,this.options)}catch{return!1}return o(e,this.operator,this.semver,this.options)}intersects(t,n){if(!(t instanceof e))throw TypeError(`a Comparator is required`);return this.operator===``?this.value===``?!0:new l(t.value,n).test(this.value):t.operator===``?t.value===``?!0:new l(this.value,n).test(t.semver):(n=r(n),n.includePrerelease&&(this.value===`<0.0.0-0`||t.value===`<0.0.0-0`)||!n.includePrerelease&&(this.value.startsWith(`<0.0.0`)||t.value.startsWith(`<0.0.0`))?!1:!!(this.operator.startsWith(`>`)&&t.operator.startsWith(`>`)||this.operator.startsWith(`<`)&&t.operator.startsWith(`<`)||this.semver.version===t.semver.version&&this.operator.includes(`=`)&&t.operator.includes(`=`)||o(this.semver,`<`,t.semver,n)&&this.operator.startsWith(`>`)&&t.operator.startsWith(`<`)||o(this.semver,`>`,t.semver,n)&&this.operator.startsWith(`<`)&&t.operator.startsWith(`>`)))}};let r=du(),{safeRe:i,t:a}=uu(),o=Fu(),s=lu(),c=pu(),l=Ru()})),Bu=i(((e,t)=>{let n=Ru();t.exports=(e,t,r)=>{try{t=new n(t,r)}catch{return!1}return t.test(e)}})),Vu=i(((e,t)=>{let n=Ru();t.exports=(e,t)=>new n(e,t).set.map(e=>e.map(e=>e.value).join(` `).trim().split(` `))})),Hu=i(((e,t)=>{let n=pu(),r=Ru();t.exports=(e,t,i)=>{let a=null,o=null,s=null;try{s=new r(t,i)}catch{return null}return e.forEach(e=>{s.test(e)&&(!a||o.compare(e)===-1)&&(a=e,o=new n(a,i))}),a}})),Uu=i(((e,t)=>{let n=pu(),r=Ru();t.exports=(e,t,i)=>{let a=null,o=null,s=null;try{s=new r(t,i)}catch{return null}return e.forEach(e=>{s.test(e)&&(!a||o.compare(e)===1)&&(a=e,o=new n(a,i))}),a}})),Wu=i(((e,t)=>{let n=pu(),r=Ru(),i=ku();t.exports=(e,t)=>{e=new r(e,t);let a=new n(`0.0.0`);if(e.test(a)||(a=new n(`0.0.0-0`),e.test(a)))return a;a=null;for(let t=0;t{let t=new n(e.semver.version);switch(e.operator){case`>`:t.prerelease.length===0?t.patch++:t.prerelease.push(0),t.raw=t.format();case``:case`>=`:(!o||i(t,o))&&(o=t);break;case`<`:case`<=`:break;default:throw Error(`Unexpected operation: ${e.operator}`)}}),o&&(!a||i(a,o))&&(a=o)}return a&&e.test(a)?a:null}})),Gu=i(((e,t)=>{let n=Ru();t.exports=(e,t)=>{try{return new n(e,t).range||`*`}catch{return null}}})),Ku=i(((e,t)=>{let n=pu(),r=zu(),{ANY:i}=r,a=Ru(),o=Bu(),s=ku(),c=Au(),l=Pu(),u=Nu();t.exports=(e,t,d,f)=>{e=new n(e,f),t=new a(t,f);let p,m,h,g,v;switch(d){case`>`:p=s,m=l,h=c,g=`>`,v=`>=`;break;case`<`:p=c,m=u,h=s,g=`<`,v=`<=`;break;default:throw TypeError(`Must provide a hilo val of "<" or ">"`)}if(o(e,t,f))return!1;for(let n=0;n{e.semver===i&&(e=new r(`>=0.0.0`)),o||=e,s||=e,p(e.semver,o.semver,f)?o=e:h(e.semver,s.semver,f)&&(s=e)}),o.operator===g||o.operator===v||(!s.operator||s.operator===g)&&m(e,s.semver)||s.operator===v&&h(e,s.semver))return!1}return!0}})),qu=i(((e,t)=>{let n=Ku();t.exports=(e,t,r)=>n(e,t,`>`,r)})),Ju=i(((e,t)=>{let n=Ku();t.exports=(e,t,r)=>n(e,t,`<`,r)})),Yu=i(((e,t)=>{let n=Ru();t.exports=(e,t,r)=>(e=new n(e,r),t=new n(t,r),e.intersects(t,r))})),Xu=i(((e,t)=>{let n=Bu(),r=Cu();t.exports=(e,t,i)=>{let a=[],o=null,s=null,c=e.sort((e,t)=>r(e,t,i));for(let e of c)n(e,t,i)?(s=e,o||=e):(s&&a.push([o,s]),s=null,o=null);o&&a.push([o,null]);let l=[];for(let[e,t]of a)e===t?l.push(e):!t&&e===c[0]?l.push(`*`):t?e===c[0]?l.push(`<=${t}`):l.push(`${e} - ${t}`):l.push(`>=${e}`);let u=l.join(` || `),d=typeof t.raw==`string`?t.raw:String(t);return u.length{let n=Ru(),r=zu(),{ANY:i}=r,a=Bu(),o=Cu(),s=(e,t,r={})=>{if(e===t)return!0;e=new n(e,r),t=new n(t,r);let i=!1;OUTER:for(let n of e.set){for(let e of t.set){let t=u(n,e,r);if(i||=t!==null,t)continue OUTER}if(i)return!1}return!0},c=[new r(`>=0.0.0-0`)],l=[new r(`>=0.0.0`)],u=(e,t,n)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===i){if(t.length===1&&t[0].semver===i)return!0;e=n.includePrerelease?c:l}if(t.length===1&&t[0].semver===i){if(n.includePrerelease)return!0;t=l}let r=new Set,s,u;for(let t of e)t.operator===`>`||t.operator===`>=`?s=d(s,t,n):t.operator===`<`||t.operator===`<=`?u=f(u,t,n):r.add(t.semver);if(r.size>1)return null;let p;if(s&&u&&(p=o(s.semver,u.semver,n),p>0||p===0&&(s.operator!==`>=`||u.operator!==`<=`)))return null;for(let e of r){if(s&&!a(e,String(s),n)||u&&!a(e,String(u),n))return null;for(let r of t)if(!a(e,String(r),n))return!1;return!0}let m,h,g,v,y=u&&!n.includePrerelease&&u.semver.prerelease.length?u.semver:!1,b=s&&!n.includePrerelease&&s.semver.prerelease.length?s.semver:!1;y&&y.prerelease.length===1&&u.operator===`<`&&y.prerelease[0]===0&&(y=!1);for(let e of t){if(v=v||e.operator===`>`||e.operator===`>=`,g=g||e.operator===`<`||e.operator===`<=`,s){if(b&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===b.major&&e.semver.minor===b.minor&&e.semver.patch===b.patch&&(b=!1),e.operator===`>`||e.operator===`>=`){if(m=d(s,e,n),m===e&&m!==s)return!1}else if(s.operator===`>=`&&!a(s.semver,String(e),n))return!1}if(u){if(y&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===y.major&&e.semver.minor===y.minor&&e.semver.patch===y.patch&&(y=!1),e.operator===`<`||e.operator===`<=`){if(h=f(u,e,n),h===e&&h!==u)return!1}else if(u.operator===`<=`&&!a(u.semver,String(e),n))return!1}if(!e.operator&&(u||s)&&p!==0)return!1}return!(s&&g&&!u&&p!==0||u&&v&&!s&&p!==0||b||y)},d=(e,t,n)=>{if(!e)return t;let r=o(e.semver,t.semver,n);return r>0?e:r<0||t.operator===`>`&&e.operator===`>=`?t:e},f=(e,t,n)=>{if(!e)return t;let r=o(e.semver,t.semver,n);return r<0?e:r>0||t.operator===`<`&&e.operator===`<=`?t:e};t.exports=s})),Qu=i(((e,t)=>{let n=uu(),r=cu(),i=pu(),a=fu();t.exports={parse:mu(),valid:hu(),clean:gu(),inc:_u(),diff:vu(),major:yu(),minor:bu(),patch:xu(),prerelease:Su(),compare:Cu(),rcompare:wu(),compareLoose:Tu(),compareBuild:Eu(),sort:Du(),rsort:Ou(),gt:ku(),lt:Au(),eq:ju(),neq:Mu(),gte:Nu(),lte:Pu(),cmp:Fu(),coerce:Iu(),Comparator:zu(),Range:Ru(),satisfies:Bu(),toComparators:Vu(),maxSatisfying:Hu(),minSatisfying:Uu(),minVersion:Wu(),validRange:Gu(),outside:Ku(),gtr:qu(),ltr:Ju(),intersects:Yu(),simplifyRange:Xu(),subset:Zu(),SemVer:i,re:n.re,src:n.src,tokens:n.t,SEMVER_SPEC_VERSION:r.SEMVER_SPEC_VERSION,RELEASE_TYPES:r.RELEASE_TYPES,compareIdentifiers:a.compareIdentifiers,rcompareIdentifiers:a.rcompareIdentifiers}}));function $u(e){let t={followSymbolicLinks:!0,implicitDescendants:!0,matchDirectories:!0,omitBrokenSymbolicLinks:!0,excludeHiddenFiles:!1};return e&&(typeof e.followSymbolicLinks==`boolean`&&(t.followSymbolicLinks=e.followSymbolicLinks,K(`followSymbolicLinks '${t.followSymbolicLinks}'`)),typeof e.implicitDescendants==`boolean`&&(t.implicitDescendants=e.implicitDescendants,K(`implicitDescendants '${t.implicitDescendants}'`)),typeof e.matchDirectories==`boolean`&&(t.matchDirectories=e.matchDirectories,K(`matchDirectories '${t.matchDirectories}'`)),typeof e.omitBrokenSymbolicLinks==`boolean`&&(t.omitBrokenSymbolicLinks=e.omitBrokenSymbolicLinks,K(`omitBrokenSymbolicLinks '${t.omitBrokenSymbolicLinks}'`)),typeof e.excludeHiddenFiles==`boolean`&&(t.excludeHiddenFiles=e.excludeHiddenFiles,K(`excludeHiddenFiles '${t.excludeHiddenFiles}'`))),t}const ed=process.platform===`win32`;function td(e){if(e=od(e),ed&&/^\\\\[^\\]+(\\[^\\]+)?$/.test(e))return e;let t=U.dirname(e);return ed&&/^\\\\[^\\]+\\[^\\]+\\$/.test(t)&&(t=od(t)),t}function nd(e,t){if(De(e,`ensureAbsoluteRoot parameter 'root' must not be empty`),De(t,`ensureAbsoluteRoot parameter 'itemPath' must not be empty`),rd(t))return t;if(ed){if(t.match(/^[A-Z]:[^\\/]|^[A-Z]:$/i)){let e=process.cwd();return De(e.match(/^[A-Z]:\\/i),`Expected current directory to start with an absolute drive root. Actual '${e}'`),t[0].toUpperCase()===e[0].toUpperCase()?t.length===2?`${t[0]}:\\${e.substr(3)}`:(e.endsWith(`\\`)||(e+=`\\`),`${t[0]}:\\${e.substr(3)}${t.substr(2)}`):`${t[0]}:\\${t.substr(2)}`}else if(ad(t).match(/^\\$|^\\[^\\]/)){let e=process.cwd();return De(e.match(/^[A-Z]:\\/i),`Expected current directory to start with an absolute drive root. Actual '${e}'`),`${e[0]}:\\${t.substr(1)}`}}return De(rd(e),`ensureAbsoluteRoot parameter 'root' must have an absolute root`),e.endsWith(`/`)||ed&&e.endsWith(`\\`)||(e+=U.sep),e+t}function rd(e){return De(e,`hasAbsoluteRoot parameter 'itemPath' must not be empty`),e=ad(e),ed?e.startsWith(`\\\\`)||/^[A-Z]:\\/i.test(e):e.startsWith(`/`)}function id(e){return De(e,`isRooted parameter 'itemPath' must not be empty`),e=ad(e),ed?e.startsWith(`\\`)||/^[A-Z]:/i.test(e):e.startsWith(`/`)}function ad(e){return e||=``,ed?(e=e.replace(/\//g,`\\`),(/^\\\\+[^\\]/.test(e)?`\\`:``)+e.replace(/\\\\+/g,`\\`)):e.replace(/\/\/+/g,`/`)}function od(e){return e?(e=ad(e),!e.endsWith(U.sep)||e===U.sep||ed&&/^[A-Z]:\\$/i.test(e)?e:e.substr(0,e.length-1)):``}var sd;(function(e){e[e.None=0]=`None`,e[e.Directory=1]=`Directory`,e[e.File=2]=`File`,e[e.All=3]=`All`})(sd||={});const cd=process.platform===`win32`;function ld(e){e=e.filter(e=>!e.negate);let t={};for(let n of e){let e=cd?n.searchPath.toUpperCase():n.searchPath;t[e]=`candidate`}let n=[];for(let r of e){let e=cd?r.searchPath.toUpperCase():r.searchPath;if(t[e]===`included`)continue;let i=!1,a=e,o=td(a);for(;o!==a;){if(t[o]){i=!0;break}a=o,o=td(a)}i||(n.push(r.searchPath),t[e]=`included`)}return n}function ud(e,t){let n=sd.None;for(let r of e)r.negate?n&=~r.match(t):n|=r.match(t);return n}function dd(e,t){return e.some(e=>!e.negate&&e.partialMatch(t))}var fd=i(((e,t)=>{t.exports=function(e,t){for(var r=[],i=0;i{t.exports=n;function n(e,t,n){e instanceof RegExp&&(e=r(e,n)),t instanceof RegExp&&(t=r(t,n));var a=i(e,t,n);return a&&{start:a[0],end:a[1],pre:n.slice(0,a[0]),body:n.slice(a[0]+e.length,a[1]),post:n.slice(a[1]+t.length)}}function r(e,t){var n=t.match(e);return n?n[0]:null}n.range=i;function i(e,t,n){var r,i,a,o,s,c=n.indexOf(e),l=n.indexOf(t,c+1),u=c;if(c>=0&&l>0){if(e===t)return[c,l];for(r=[],a=n.length;u>=0&&!s;)u==c?(r.push(u),c=n.indexOf(e,u+1)):r.length==1?s=[r.pop(),l]:(i=r.pop(),i=0?c:l;r.length&&(s=[a,o])}return s}})),md=i(((e,t)=>{var n=fd(),r=pd();t.exports=p;var i=`\0SLASH`+Math.random()+`\0`,a=`\0OPEN`+Math.random()+`\0`,o=`\0CLOSE`+Math.random()+`\0`,s=`\0COMMA`+Math.random()+`\0`,c=`\0PERIOD`+Math.random()+`\0`;function l(e){return parseInt(e,10)==e?parseInt(e,10):e.charCodeAt(0)}function u(e){return e.split(`\\\\`).join(i).split(`\\{`).join(a).split(`\\}`).join(o).split(`\\,`).join(s).split(`\\.`).join(c)}function d(e){return e.split(i).join(`\\`).split(a).join(`{`).split(o).join(`}`).split(s).join(`,`).split(c).join(`.`)}function f(e){if(!e)return[``];var t=[],n=r(`{`,`}`,e);if(!n)return e.split(`,`);var i=n.pre,a=n.body,o=n.post,s=i.split(`,`);s[s.length-1]+=`{`+a+`}`;var c=f(o);return o.length&&(s[s.length-1]+=c.shift(),s.push.apply(s,c)),t.push.apply(t,s),t}function p(e,t){if(!e)return[];t||={};var n=t.max==null?1/0:t.max;return e.substr(0,2)===`{}`&&(e=`\\{\\}`+e.substr(2)),y(u(e),n,!0).map(d)}function m(e){return`{`+e+`}`}function h(e){return/^-?0\d/.test(e)}function g(e,t){return e<=t}function v(e,t){return e>=t}function y(e,t,i){var a=[],s=r(`{`,`}`,e);if(!s||/\$$/.test(s.pre))return[e];var c=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(s.body),u=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(s.body),d=c||u,p=s.body.indexOf(`,`)>=0;if(!d&&!p)return s.post.match(/,(?!,).*\}/)?(e=s.pre+`{`+s.body+o+s.post,y(e,t,!0)):[e];var b;if(d)b=s.body.split(/\.\./);else if(b=f(s.body),b.length===1&&(b=y(b[0],t,!1).map(m),b.length===1)){var x=s.post.length?y(s.post,t,!1):[``];return x.map(function(e){return s.pre+b[0]+e})}var S=s.pre,x=s.post.length?y(s.post,t,!1):[``],C;if(d){var w=l(b[0]),T=l(b[1]),E=Math.max(b[0].length,b[1].length),D=b.length==3?Math.max(Math.abs(l(b[2])),1):1,O=g;T0){var N=Array(M+1).join(`0`);j=A<0?`-`+N+j.slice(1):N+j}}C.push(j)}}else C=n(b,function(e){return y(e,t,!1)});for(var P=0;P{n.exports=g,g.Minimatch=v;var r=function(){try{return t(`path`)}catch{}}()||{sep:`/`};g.sep=r.sep;var i=g.GLOBSTAR=v.GLOBSTAR={},a=md(),o={"!":{open:`(?:(?!(?:`,close:`))[^/]*?)`},"?":{open:`(?:`,close:`)?`},"+":{open:`(?:`,close:`)+`},"*":{open:`(?:`,close:`)*`},"@":{open:`(?:`,close:`)`}},s=`[^/]`,c=s+`*?`,l=`(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?`,u=`(?:(?!(?:\\/|^)\\.).)*?`,d=f(`().*{}+?[]^$\\!`);function f(e){return e.split(``).reduce(function(e,t){return e[t]=!0,e},{})}var p=/\/+/;g.filter=m;function m(e,t){return t||={},function(n,r,i){return g(n,e,t)}}function h(e,t){t||={};var n={};return Object.keys(e).forEach(function(t){n[t]=e[t]}),Object.keys(t).forEach(function(e){n[e]=t[e]}),n}g.defaults=function(e){if(!e||typeof e!=`object`||!Object.keys(e).length)return g;var t=g,n=function(n,r,i){return t(n,r,h(e,i))};return n.Minimatch=function(n,r){return new t.Minimatch(n,h(e,r))},n.Minimatch.defaults=function(n){return t.defaults(h(e,n)).Minimatch},n.filter=function(n,r){return t.filter(n,h(e,r))},n.defaults=function(n){return t.defaults(h(e,n))},n.makeRe=function(n,r){return t.makeRe(n,h(e,r))},n.braceExpand=function(n,r){return t.braceExpand(n,h(e,r))},n.match=function(n,r,i){return t.match(n,r,h(e,i))},n},v.defaults=function(e){return g.defaults(e).Minimatch};function g(e,t,n){return C(t),n||={},!n.nocomment&&t.charAt(0)===`#`?!1:new v(t,n).match(e)}function v(e,t){if(!(this instanceof v))return new v(e,t);C(e),t||={},e=e.trim(),!t.allowWindowsEscape&&r.sep!==`/`&&(e=e.split(r.sep).join(`/`)),this.options=t,this.maxGlobstarRecursion=t.maxGlobstarRecursion===void 0?200:t.maxGlobstarRecursion,this.set=[],this.pattern=e,this.regexp=null,this.negate=!1,this.comment=!1,this.empty=!1,this.partial=!!t.partial,this.make()}v.prototype.debug=function(){},v.prototype.make=y;function y(){var e=this.pattern,t=this.options;if(!t.nocomment&&e.charAt(0)===`#`){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate();var n=this.globSet=this.braceExpand();t.debug&&(this.debug=function(){console.error.apply(console,arguments)}),this.debug(this.pattern,n),n=this.globParts=n.map(function(e){return e.split(p)}),this.debug(this.pattern,n),n=n.map(function(e,t,n){return e.map(this.parse,this)},this),this.debug(this.pattern,n),n=n.filter(function(e){return e.indexOf(!1)===-1}),this.debug(this.pattern,n),this.set=n}v.prototype.parseNegate=b;function b(){var e=this.pattern,t=!1,n=this.options,r=0;if(!n.nonegate){for(var i=0,a=e.length;iS)throw TypeError(`pattern is too long`)};v.prototype.parse=T;var w={};function T(e,t){C(e);var n=this.options;if(e===`**`)if(n.noglobstar)e=`*`;else return i;if(e===``)return``;var r=``,a=!!n.nocase,l=!1,u=[],f=[],p,m=!1,h=-1,g=-1,v=e.charAt(0)===`.`?``:n.dot?`(?!(?:^|\\/)\\.{1,2}(?:$|\\/))`:`(?!\\.)`,y=this;function b(){if(p){switch(p){case`*`:r+=c,a=!0;break;case`?`:r+=s,a=!0;break;default:r+=`\\`+p;break}y.debug(`clearStateChar %j %j`,p,r),p=!1}}for(var x=0,S=e.length,T;x-1;N--){var P=f[N],F=r.slice(0,P.reStart),I=r.slice(P.reStart,P.reEnd-8),L=r.slice(P.reEnd-8,P.reEnd),R=r.slice(P.reEnd);L+=R;var z=F.split(`(`).length-1,ee=R;for(x=0;x=0&&(a=e[o],!a);o--);for(o=0;o=0;o--)if(t[o]===i){c=o;break}var l=t.slice(a,s),u=n?t.slice(s+1):t.slice(s+1,c),d=n?[]:t.slice(c+1);if(l.length){var f=e.slice(r,r+l.length);if(!this._matchOne(f,l,n,0,0))return!1;r+=l.length}var p=0;if(d.length){if(d.length+r>e.length)return!1;var m=e.length-d.length;if(this._matchOne(e,d,n,m,0))p=d.length;else{if(e[e.length-1]!==``||r+d.length===e.length||(m--,!this._matchOne(e,d,n,m,0)))return!1;p=d.length+1}}if(!u.length){var h=!!p;for(o=r;o0,`Parameter 'itemPath' must not be an empty array`);for(let t=0;te.getLiteral(t)).filter(e=>!o&&!(o=e===``));this.searchPath=new _d(s).toString(),this.rootRegExp=new RegExp(e.regExpEscape(s[0]),yd?`i`:``),this.isImplicitPattern=n;let c={dot:!0,nobrace:!0,nocase:yd,nocomment:!0,noext:!0,nonegate:!0};a=yd?a.replace(/\\/g,`/`):a,this.minimatch=new vd(a,c)}match(e){return this.segments[this.segments.length-1]===`**`?(e=ad(e),!e.endsWith(U.sep)&&this.isImplicitPattern===!1&&(e=`${e}${U.sep}`)):e=od(e),this.minimatch.match(e)?this.trailingSeparator?sd.Directory:sd.All:sd.None}partialMatch(e){return e=od(e),td(e)===e?this.rootRegExp.test(e):this.minimatch.matchOne(e.split(yd?/\\+/:/\/+/),this.minimatch.set[0],!0)}static globEscape(e){return(yd?e:e.replace(/\\/g,`\\\\`)).replace(/(\[)(?=[^/]+\])/g,`[[]`).replace(/\?/g,`[?]`).replace(/\*/g,`[*]`)}static fixupPattern(t,n){De(t,`pattern cannot be empty`);let r=new _d(t).segments.map(t=>e.getLiteral(t));if(De(r.every((e,t)=>(e!==`.`||t===0)&&e!==`..`),`Invalid pattern '${t}'. Relative pathing '.' and '..' is not allowed.`),De(!id(t)||r[0],`Invalid pattern '${t}'. Root segment must not contain globs.`),t=ad(t),t===`.`||t.startsWith(`.${U.sep}`))t=e.globEscape(process.cwd())+t.substr(1);else if(t===`~`||t.startsWith(`~${U.sep}`))n||=de.homedir(),De(n,`Unable to determine HOME directory`),De(rd(n),`Expected HOME directory to be a rooted path. Actual '${n}'`),t=e.globEscape(n)+t.substr(1);else if(yd&&(t.match(/^[A-Z]:$/i)||t.match(/^[A-Z]:[^\\]/i))){let n=nd(`C:\\dummy-root`,t.substr(0,2));t.length>2&&!n.endsWith(`\\`)&&(n+=`\\`),t=e.globEscape(n)+t.substr(2)}else if(yd&&(t===`\\`||t.match(/^\\[^\\]/))){let n=nd(`C:\\dummy-root`,`\\`);n.endsWith(`\\`)||(n+=`\\`),t=e.globEscape(n)+t.substr(1)}else t=nd(e.globEscape(process.cwd()),t);return ad(t)}static getLiteral(e){let t=``;for(let n=0;n=0){if(r.length>1)return``;if(r){t+=r,n=i;continue}}}t+=r}return t}static regExpEscape(e){return e.replace(/[[\\^$.|?*+()]/g,`\\$&`)}},xd=class{constructor(e,t){this.path=e,this.level=t}},Sd=function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})},Cd=function(e){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof __values==`function`?__values(e):e[Symbol.iterator](),n={},r(`next`),r(`throw`),r(`return`),n[Symbol.asyncIterator]=function(){return this},n);function r(t){n[t]=e[t]&&function(n){return new Promise(function(r,a){n=e[t](n),i(r,a,n.done,n.value)})}}function i(e,t,n,r){Promise.resolve(r).then(function(t){e({value:t,done:n})},t)}},wd=function(e){return this instanceof wd?(this.v=e,this):new wd(e)},Td=function(e,t,n){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var r=n.apply(e,t||[]),i,a=[];return i=Object.create((typeof AsyncIterator==`function`?AsyncIterator:Object).prototype),s(`next`),s(`throw`),s(`return`,o),i[Symbol.asyncIterator]=function(){return this},i;function o(e){return function(t){return Promise.resolve(t).then(e,d)}}function s(e,t){r[e]&&(i[e]=function(t){return new Promise(function(n,r){a.push([e,t,n,r])>1||c(e,t)})},t&&(i[e]=t(i[e])))}function c(e,t){try{l(r[e](t))}catch(e){f(a[0][3],e)}}function l(e){e.value instanceof wd?Promise.resolve(e.value.v).then(u,d):f(a[0][2],e)}function u(e){c(`next`,e)}function d(e){c(`throw`,e)}function f(e,t){e(t),a.shift(),a.length&&c(a[0][0],a[0][1])}};const Ed=process.platform===`win32`;var Dd=class e{constructor(e){this.patterns=[],this.searchPaths=[],this.options=$u(e)}getSearchPaths(){return this.searchPaths.slice()}glob(){return Sd(this,void 0,void 0,function*(){var e,t,n,r;let i=[];try{for(var a=!0,o=Cd(this.globGenerator()),s;s=yield o.next(),e=s.done,!e;a=!0){r=s.value,a=!1;let e=r;i.push(e)}}catch(e){t={error:e}}finally{try{!a&&!e&&(n=o.return)&&(yield n.call(o))}finally{if(t)throw t.error}}return i})}globGenerator(){return Td(this,arguments,function*(){let t=$u(this.options),n=[];for(let e of this.patterns)n.push(e),t.implicitDescendants&&(e.trailingSeparator||e.segments[e.segments.length-1]!==`**`)&&n.push(new bd(e.negate,!0,e.segments.concat(`**`)));let r=[];for(let e of ld(n)){K(`Search path '${e}'`);try{yield wd(he.promises.lstat(e))}catch(e){if(e.code===`ENOENT`)continue;throw e}r.unshift(new xd(e,1))}let i=[];for(;r.length;){let a=r.pop(),o=ud(n,a.path),s=!!o||dd(n,a.path);if(!o&&!s)continue;let c=yield wd(e.stat(a,t,i));if(c&&!(t.excludeHiddenFiles&&U.basename(a.path).match(/^\./)))if(c.isDirectory()){if(o&sd.Directory&&t.matchDirectories)yield yield wd(a.path);else if(!s)continue;let e=a.level+1,n=(yield wd(he.promises.readdir(a.path))).map(t=>new xd(U.join(a.path,t),e));r.push(...n.reverse())}else o&sd.File&&(yield yield wd(a.path))}})}static create(t,n){return Sd(this,void 0,void 0,function*(){let r=new e(n);Ed&&(t=t.replace(/\r\n/g,` diff --git a/dist/main.js b/dist/main.js index 006a240e..f589a915 100644 --- a/dist/main.js +++ b/dist/main.js @@ -1,4 +1,4 @@ -import{o as e}from"./chunk-Bdh3yLIe.js";import{$ as t,A as n,B as r,C as i,Ct as a,D as o,E as s,F as c,G as l,H as u,I as d,J as f,K as p,L as m,M as h,N as g,O as _,P as v,Q as y,R as b,S as x,St as S,T as C,U as w,V as T,W as ee,X as te,Y as ne,Z as E,_ as re,_t as ie,a as ae,at as D,bt as O,c as oe,d as k,dt as A,et as se,f as j,ft as M,g as ce,gt as N,h as le,ht as ue,i as P,it as de,k as fe,l as pe,lt as me,m as he,mt as ge,n as _e,nt as ve,o as ye,ot as F,p as be,pt as I,q as xe,r as Se,rt as Ce,s as we,st as L,t as Te,tt as Ee,u as De,ut as Oe,v as ke,vt as Ae,w as je,xt as Me,yt as Ne,z as Pe}from"./artifact-D-cL1zfn.js";import R from"node:process";import*as Fe from"os";import*as Ie from"crypto";import*as z from"fs";import*as B from"path";import{ok as Le}from"assert";import*as Re from"util";import{Buffer as ze}from"node:buffer";import*as Be from"node:crypto";import{createHash as Ve}from"node:crypto";import{pathToFileURL as He}from"node:url";import*as V from"node:fs/promises";import Ue,{mkdir as We,readFile as Ge,writeFile as Ke}from"node:fs/promises";import*as H from"node:path";import U,{join as qe}from"node:path";import*as Je from"node:os";import Ye,{homedir as Xe}from"node:os";import*as Ze from"stream";const Qe=e=>typeof e==`object`&&!!e,W=e=>typeof e==`string`?e:null,$e=e=>typeof e==`number`?e:null;function et(e){if(Array.isArray(e))return e.filter(Qe).map(e=>({file:W(e.file)??``,additions:$e(e.additions)??0,deletions:$e(e.deletions)??0}))}function tt(e){return{id:e.id,version:e.version,projectID:e.projectID,directory:e.directory,parentID:e.parentID,title:e.title,time:{created:e.time.created,updated:e.time.updated,compacting:e.time.compacting,archived:e.time.archived},summary:e.summary==null?void 0:{additions:e.summary.additions,deletions:e.summary.deletions,files:e.summary.files,diffs:et(e.summary.diffs)},share:e.share?.url==null?void 0:{url:e.share.url},permission:e.permission==null?void 0:{rules:e.permission.rules},revert:e.revert==null?void 0:{messageID:e.revert.messageID,partID:e.revert.partID,snapshot:e.revert.snapshot,diff:e.revert.diff}}}function nt(e){let t=U.resolve(U.normalize(e));return t.endsWith(U.sep)&&t.length>1?t.slice(0,-1):t}async function rt(e,t){let n=await e.project.list();if(n.error!=null||n.data==null)return t.warning(`SDK project list failed`,{error:String(n.error)}),[];if(!Array.isArray(n.data))return[];let r=[];for(let e of n.data){if(!Qe(e))continue;let t=W(e.id),n=W(e.worktree),i=W(e.path);t==null||n==null||i==null||r.push({id:t,worktree:n,path:i,vcs:`git`,time:{created:0,updated:0}})}return r}async function it(e,t,n){let r=nt(t),i=await rt(e,n);for(let e of i){if(nt(e.worktree)===r)return e;let t=W(e.path);if(t!=null&&nt(t)===r)return e}return null}function at(e){return e.status===`running`?{status:`running`,input:e.input,time:{start:e.time.start}}:e.status===`error`?{status:`error`,input:e.input,error:e.error,time:{start:e.time.start,end:e.time.end}}:e.status===`pending`?{status:`pending`}:{status:`completed`,input:e.input,output:e.output,title:e.title,metadata:e.metadata,time:{start:e.time.start,end:e.time.end,compacted:e.time.compacted},attachments:void 0}}function ot(e){let t={id:e.id,sessionID:e.sessionID,messageID:e.messageID};if(e.type===`text`)return{...t,type:`text`,text:e.text,synthetic:e.synthetic,ignored:e.ignored,time:e.time,metadata:e.metadata};if(e.type===`reasoning`)return{...t,type:`reasoning`,reasoning:e.reasoning??e.text,time:e.time};if(e.type===`tool`)return{...t,type:`tool`,callID:e.callID,tool:e.tool,state:at(e.state),metadata:e.metadata};if(e.type!==`step-finish`)return{...t,type:`text`,text:`text`in e?e.text:``};let n=e;return{...t,type:`step-finish`,reason:n.reason,snapshot:n.snapshot,cost:n.cost,tokens:{input:n.tokens.input,output:n.tokens.output,reasoning:n.tokens.reasoning,cache:{read:n.tokens.cache.read,write:n.tokens.cache.write}}}}function st(e){if(e.role===`user`){let t=e;return{id:t.id,sessionID:t.sessionID,role:`user`,time:{created:t.time.created},summary:t.summary==null?void 0:{title:t.summary.title,body:t.summary.body,diffs:et(t.summary.diffs)??[]},agent:t.agent,model:{providerID:t.model.providerID,modelID:t.model.modelID},system:t.system,tools:t.tools,variant:t.variant}}let t=e;return{id:t.id,sessionID:t.sessionID,role:`assistant`,time:{created:t.time.created,completed:t.time.completed},parentID:t.parentID,modelID:t.modelID,providerID:t.providerID,mode:t.mode,agent:t.agent??``,path:{cwd:t.path.cwd,root:t.path.root},summary:t.summary,cost:t.cost,tokens:{input:t.tokens.input,output:t.tokens.output,reasoning:t.tokens.reasoning,cache:{read:t.tokens.cache.read,write:t.tokens.cache.write}},finish:t.finish,error:t.error?{name:t.error.name,message:W(t.error.data.message)??``}:void 0}}function ct(e){return[...e.map(e=>{let t=st(`info`in e?e.info:e),n=`parts`in e?e.parts.map(ot):void 0;return n==null||n.length===0?t:{...t,parts:n}})].sort((e,t)=>e.time.created-t.time.created)}async function lt(e,t,n){let r=await e.session.list({query:{directory:t}});return r.error==null&&r.data!=null?Array.isArray(r.data)?r.data.map(tt):[]:(n.warning(`SDK session list failed`,{error:String(r.error)}),[])}async function ut(e,t,n){let r=await e.session.messages({path:{id:t}});return r.error==null&&r.data!=null?ct(r.data):(n.warning(`SDK session messages failed`,{error:String(r.error)}),[])}async function dt(e,t,n,r){let i=await e.session.list({query:{directory:t,start:n,roots:!0,limit:10}});if(i.error!=null||i.data==null)return r.warning(`SDK session list failed`,{error:String(i.error)}),null;if(!Array.isArray(i.data)||i.data.length===0)return null;let a=i.data.map(tt);if(a.length===0)return null;let o=a.reduce((e,t)=>t.time.created>e.time.created?t:e);return{projectID:o.projectID,session:o}}async function ft(e,t,n){let r=await e.session.delete({path:{id:t}});if(r.error!=null){n.warning(`SDK session delete failed`,{sessionID:t,error:String(r.error)});return}n.debug(`Deleted session via SDK`,{sessionID:t})}function G(e,t){return{key:`${e}-${t}`,entityType:e,entityId:t}}function pt(e){return Ve(`sha256`).update(e).digest(`hex`).slice(0,8)}function mt(e){if(e.eventType===`unsupported`)return null;if(e.eventType===`schedule`){let t=typeof e.raw==`object`&&e.raw!=null&&`event`in e.raw?e.raw.event:void 0,n=typeof t==`object`&&t&&`type`in t&&t.type===`schedule`&&`schedule`in t&&typeof t.schedule==`string`?t.schedule:void 0;return G(`schedule`,pt((n!=null&&n.trim().length>0?n:e.action)??`default`))}return e.eventType===`workflow_dispatch`?G(`dispatch`,String(e.runId)):e.target==null?null:e.eventType===`issue_comment`?e.target.kind===`issue`?G(`issue`,String(e.target.number)):e.target.kind===`pr`?G(`pr`,String(e.target.number)):null:e.eventType===`discussion_comment`?e.target.kind===`discussion`?G(`discussion`,String(e.target.number)):null:e.eventType===`issues`?e.target.kind===`issue`?G(`issue`,String(e.target.number)):null:(e.eventType===`pull_request`||e.eventType===`pull_request_review_comment`)&&e.target.kind===`pr`?G(`pr`,String(e.target.number)):null}function ht(e){return`fro-bot: ${e.key}`}function gt(e,t){let n=e.filter(e=>e.title===t);return n.length===0?null:n.reduce((e,t)=>t.time.updated>e.time.updated?t:e)}function _t(e){let t=H.resolve(e);return t.endsWith(H.sep)&&t.length>1?t.slice(0,-1):t}async function vt(e,t,n,r){try{let i=await lt(e,t,r),a=ht(n),o=_t(t),s=gt(i.filter(e=>_t(e.directory)===o),a);if(s==null){let e=gt(i,a);return e!=null&&r.warning(`Session continuity: matching session has different workspace directory, ignoring`,{sessionId:e.id,sessionDirectory:e.directory,workspacePath:t}),{status:`not-found`}}return s.time.archived!=null||s.time.compacting!=null?{status:`not-found`}:{status:`found`,session:s}}catch(e){return{status:`error`,error:e instanceof Error?e.message:String(e)}}}const yt={maxSessions:50,maxAgeDays:30};async function bt(e,n,r,i){let{maxSessions:a,maxAgeDays:o}=r;if(i.info(`Starting session pruning`,{workspacePath:n,maxSessions:a,maxAgeDays:o}),await it(e,n,i)==null)return i.debug(`No project found for pruning`,{workspacePath:n}),{prunedCount:0,prunedSessionIds:[],remainingCount:0,freedBytes:0};let s=await lt(e,n,i),c=s.filter(e=>e.parentID==null);if(c.length===0)return{prunedCount:0,prunedSessionIds:[],remainingCount:0,freedBytes:0};let l=[...c].sort((e,t)=>t.time.updated-e.time.updated),u=new Date;u.setDate(u.getDate()-o);let d=u.getTime(),f=new Set;for(let e of l)e.time.updated>=d&&f.add(e.id);for(let e=0;e!f.has(e.id)),m=new Set;for(let e of p){m.add(e.id);for(let t of s)t.parentID===e.id&&m.add(t.id)}if(m.size===0)return i.info(`No sessions to prune`),{prunedCount:0,prunedSessionIds:[],remainingCount:c.length,freedBytes:0};let h=[];for(let n of m)try{await ft(e,n,i),h.push(n),i.debug(`Pruned session`,{sessionId:n})}catch(e){i.warning(`Failed to prune session`,{sessionId:n,error:t(e)})}let g=c.length-p.length;return i.info(`Session pruning complete`,{prunedCount:h.length,remainingCount:g}),{prunedCount:h.length,prunedSessionIds:h,remainingCount:g,freedBytes:0}}async function xt(e,t,n,r){let{limit:i,fromDate:a,toDate:o}=n;r.debug(`Listing sessions`,{directory:t,limit:i});let s=[...(await lt(e,t,r)).filter(e=>!(e.parentID!=null||a!=null&&e.time.createdo.getTime()))].sort((e,t)=>t.time.updated-e.time.updated),c=[],l=i==null?s:s.slice(0,i);for(let t of l){let n=await ut(e,t.id,r),i=St(n);c.push({id:t.id,projectID:t.projectID,directory:t.directory,title:t.title,createdAt:t.time.created,updatedAt:t.time.updated,messageCount:n.length,agents:i,isChild:!1})}return r.info(`Listed sessions`,{count:c.length,directory:t}),c}function St(e){let t=new Set;for(let n of e)n.agent!=null&&t.add(n.agent);return[...t]}async function Ct(e,t,n,r,i){let{limit:a=20,caseSensitive:o=!1,sessionId:s}=r;i.debug(`Searching sessions`,{query:e,directory:n,limit:a,caseSensitive:o});let c=o?e:e.toLowerCase(),l=[],u=0;if(s!=null){let e=await wt(t,s,c,o,i);return e.length>0&&l.push({sessionId:s,matches:e.slice(0,a)}),l}let d=await xt(t,n,{},i);for(let e of d){if(u>=a)break;let n=await wt(t,e.id,c,o,i);if(n.length>0){let t=a-u;l.push({sessionId:e.id,matches:n.slice(0,t)}),u+=Math.min(n.length,t)}}return i.info(`Session search complete`,{query:e,resultCount:l.length,totalMatches:u}),l}async function wt(e,t,n,r,i){let a=await ut(e,t,i),o=[];for(let e of a){let t=e.parts??[];for(let i of t){let t=Tt(i);if(t==null)continue;let a=r?t:t.toLowerCase();if(a.includes(n)){let r=a.indexOf(n),s=Math.max(0,r-50),c=Math.min(t.length,r+n.length+50),l=t.slice(s,c);o.push({messageId:e.id,partId:i.id,excerpt:`...${l}...`,role:e.role,agent:e.agent})}}}return o}function Tt(e){switch(e.type){case`text`:return e.text;case`reasoning`:return e.reasoning;case`tool`:return e.state.status===`completed`?`${e.tool}: ${e.state.output}`:null;case`step-finish`:return null}}async function Et(e,t,n,r){if(n!=null)try{let i=await e.session.update({path:{id:t},body:{title:n}});i.error!=null&&r.warning(`Best-effort session title re-assertion failed`,{sessionId:t,sessionTitle:n,error:String(i.error)})}catch(e){r.warning(`Best-effort session title re-assertion failed`,{sessionId:t,sessionTitle:n,error:e instanceof Error?e.message:String(e)})}}function Dt(e){let t=[`--- Fro Bot Run Summary ---`,`Event: ${e.eventType}`,`Repo: ${e.repo}`,`Ref: ${e.ref}`,`Run ID: ${e.runId}`,`Cache: ${e.cacheStatus}`,`Duration: ${e.duration}s`];return e.sessionIds.length>0&&t.push(`Sessions used: ${e.sessionIds.join(`, `)}`),e.logicalKey!=null&&t.push(`Logical Thread: ${e.logicalKey}`),e.createdPRs.length>0&&t.push(`PRs created: ${e.createdPRs.join(`, `)}`),e.createdCommits.length>0&&t.push(`Commits: ${e.createdCommits.join(`, `)}`),e.tokenUsage!=null&&t.push(`Tokens: ${e.tokenUsage.input} in / ${e.tokenUsage.output} out`),t.join(` +import{o as e}from"./chunk-Bdh3yLIe.js";import{$ as t,A as n,B as r,C as i,Ct as a,D as o,E as s,F as c,G as l,H as u,I as d,J as f,K as p,L as m,M as h,N as g,O as _,P as v,Q as y,R as b,S as x,St as S,T as C,U as w,V as T,W as ee,X as te,Y as ne,Z as E,_ as re,_t as ie,a as ae,at as D,bt as O,c as oe,d as k,dt as A,et as se,f as j,ft as M,g as ce,gt as N,h as le,ht as ue,i as P,it as de,k as fe,l as pe,lt as me,m as he,mt as ge,n as _e,nt as ve,o as ye,ot as F,p as be,pt as I,q as xe,r as Se,rt as Ce,s as we,st as L,t as Te,tt as Ee,u as De,ut as Oe,v as ke,vt as Ae,w as je,xt as Me,yt as Ne,z as Pe}from"./artifact-BFFXP2kT.js";import R from"node:process";import*as Fe from"os";import*as Ie from"crypto";import*as z from"fs";import*as B from"path";import{ok as Le}from"assert";import*as Re from"util";import{Buffer as ze}from"node:buffer";import*as Be from"node:crypto";import{createHash as Ve}from"node:crypto";import{pathToFileURL as He}from"node:url";import*as V from"node:fs/promises";import Ue,{mkdir as We,readFile as Ge,writeFile as Ke}from"node:fs/promises";import*as H from"node:path";import U,{join as qe}from"node:path";import*as Je from"node:os";import Ye,{homedir as Xe}from"node:os";import*as Ze from"stream";const Qe=e=>typeof e==`object`&&!!e,W=e=>typeof e==`string`?e:null,$e=e=>typeof e==`number`?e:null;function et(e){if(Array.isArray(e))return e.filter(Qe).map(e=>({file:W(e.file)??``,additions:$e(e.additions)??0,deletions:$e(e.deletions)??0}))}function tt(e){return{id:e.id,version:e.version,projectID:e.projectID,directory:e.directory,parentID:e.parentID,title:e.title,time:{created:e.time.created,updated:e.time.updated,compacting:e.time.compacting,archived:e.time.archived},summary:e.summary==null?void 0:{additions:e.summary.additions,deletions:e.summary.deletions,files:e.summary.files,diffs:et(e.summary.diffs)},share:e.share?.url==null?void 0:{url:e.share.url},permission:e.permission==null?void 0:{rules:e.permission.rules},revert:e.revert==null?void 0:{messageID:e.revert.messageID,partID:e.revert.partID,snapshot:e.revert.snapshot,diff:e.revert.diff}}}function nt(e){let t=U.resolve(U.normalize(e));return t.endsWith(U.sep)&&t.length>1?t.slice(0,-1):t}async function rt(e,t){let n=await e.project.list();if(n.error!=null||n.data==null)return t.warning(`SDK project list failed`,{error:String(n.error)}),[];if(!Array.isArray(n.data))return[];let r=[];for(let e of n.data){if(!Qe(e))continue;let t=W(e.id),n=W(e.worktree),i=W(e.path);t==null||n==null||i==null||r.push({id:t,worktree:n,path:i,vcs:`git`,time:{created:0,updated:0}})}return r}async function it(e,t,n){let r=nt(t),i=await rt(e,n);for(let e of i){if(nt(e.worktree)===r)return e;let t=W(e.path);if(t!=null&&nt(t)===r)return e}return null}function at(e){return e.status===`running`?{status:`running`,input:e.input,time:{start:e.time.start}}:e.status===`error`?{status:`error`,input:e.input,error:e.error,time:{start:e.time.start,end:e.time.end}}:e.status===`pending`?{status:`pending`}:{status:`completed`,input:e.input,output:e.output,title:e.title,metadata:e.metadata,time:{start:e.time.start,end:e.time.end,compacted:e.time.compacted},attachments:void 0}}function ot(e){let t={id:e.id,sessionID:e.sessionID,messageID:e.messageID};if(e.type===`text`)return{...t,type:`text`,text:e.text,synthetic:e.synthetic,ignored:e.ignored,time:e.time,metadata:e.metadata};if(e.type===`reasoning`)return{...t,type:`reasoning`,reasoning:e.reasoning??e.text,time:e.time};if(e.type===`tool`)return{...t,type:`tool`,callID:e.callID,tool:e.tool,state:at(e.state),metadata:e.metadata};if(e.type!==`step-finish`)return{...t,type:`text`,text:`text`in e?e.text:``};let n=e;return{...t,type:`step-finish`,reason:n.reason,snapshot:n.snapshot,cost:n.cost,tokens:{input:n.tokens.input,output:n.tokens.output,reasoning:n.tokens.reasoning,cache:{read:n.tokens.cache.read,write:n.tokens.cache.write}}}}function st(e){if(e.role===`user`){let t=e;return{id:t.id,sessionID:t.sessionID,role:`user`,time:{created:t.time.created},summary:t.summary==null?void 0:{title:t.summary.title,body:t.summary.body,diffs:et(t.summary.diffs)??[]},agent:t.agent,model:{providerID:t.model.providerID,modelID:t.model.modelID},system:t.system,tools:t.tools,variant:t.variant}}let t=e;return{id:t.id,sessionID:t.sessionID,role:`assistant`,time:{created:t.time.created,completed:t.time.completed},parentID:t.parentID,modelID:t.modelID,providerID:t.providerID,mode:t.mode,agent:t.agent??``,path:{cwd:t.path.cwd,root:t.path.root},summary:t.summary,cost:t.cost,tokens:{input:t.tokens.input,output:t.tokens.output,reasoning:t.tokens.reasoning,cache:{read:t.tokens.cache.read,write:t.tokens.cache.write}},finish:t.finish,error:t.error?{name:t.error.name,message:W(t.error.data.message)??``}:void 0}}function ct(e){return[...e.map(e=>{let t=st(`info`in e?e.info:e),n=`parts`in e?e.parts.map(ot):void 0;return n==null||n.length===0?t:{...t,parts:n}})].sort((e,t)=>e.time.created-t.time.created)}async function lt(e,t,n){let r=await e.session.list({query:{directory:t}});return r.error==null&&r.data!=null?Array.isArray(r.data)?r.data.map(tt):[]:(n.warning(`SDK session list failed`,{error:String(r.error)}),[])}async function ut(e,t,n){let r=await e.session.messages({path:{id:t}});return r.error==null&&r.data!=null?ct(r.data):(n.warning(`SDK session messages failed`,{error:String(r.error)}),[])}async function dt(e,t,n,r){let i=await e.session.list({query:{directory:t,start:n,roots:!0,limit:10}});if(i.error!=null||i.data==null)return r.warning(`SDK session list failed`,{error:String(i.error)}),null;if(!Array.isArray(i.data)||i.data.length===0)return null;let a=i.data.map(tt);if(a.length===0)return null;let o=a.reduce((e,t)=>t.time.created>e.time.created?t:e);return{projectID:o.projectID,session:o}}async function ft(e,t,n){let r=await e.session.delete({path:{id:t}});if(r.error!=null){n.warning(`SDK session delete failed`,{sessionID:t,error:String(r.error)});return}n.debug(`Deleted session via SDK`,{sessionID:t})}function G(e,t){return{key:`${e}-${t}`,entityType:e,entityId:t}}function pt(e){return Ve(`sha256`).update(e).digest(`hex`).slice(0,8)}function mt(e){if(e.eventType===`unsupported`)return null;if(e.eventType===`schedule`){let t=typeof e.raw==`object`&&e.raw!=null&&`event`in e.raw?e.raw.event:void 0,n=typeof t==`object`&&t&&`type`in t&&t.type===`schedule`&&`schedule`in t&&typeof t.schedule==`string`?t.schedule:void 0;return G(`schedule`,pt((n!=null&&n.trim().length>0?n:e.action)??`default`))}return e.eventType===`workflow_dispatch`?G(`dispatch`,String(e.runId)):e.target==null?null:e.eventType===`issue_comment`?e.target.kind===`issue`?G(`issue`,String(e.target.number)):e.target.kind===`pr`?G(`pr`,String(e.target.number)):null:e.eventType===`discussion_comment`?e.target.kind===`discussion`?G(`discussion`,String(e.target.number)):null:e.eventType===`issues`?e.target.kind===`issue`?G(`issue`,String(e.target.number)):null:(e.eventType===`pull_request`||e.eventType===`pull_request_review_comment`)&&e.target.kind===`pr`?G(`pr`,String(e.target.number)):null}function ht(e){return`fro-bot: ${e.key}`}function gt(e,t){let n=e.filter(e=>e.title===t);return n.length===0?null:n.reduce((e,t)=>t.time.updated>e.time.updated?t:e)}function _t(e){let t=H.resolve(e);return t.endsWith(H.sep)&&t.length>1?t.slice(0,-1):t}async function vt(e,t,n,r){try{let i=await lt(e,t,r),a=ht(n),o=_t(t),s=gt(i.filter(e=>_t(e.directory)===o),a);if(s==null){let e=gt(i,a);return e!=null&&r.warning(`Session continuity: matching session has different workspace directory, ignoring`,{sessionId:e.id,sessionDirectory:e.directory,workspacePath:t}),{status:`not-found`}}return s.time.archived!=null||s.time.compacting!=null?{status:`not-found`}:{status:`found`,session:s}}catch(e){return{status:`error`,error:e instanceof Error?e.message:String(e)}}}const yt={maxSessions:50,maxAgeDays:30};async function bt(e,n,r,i){let{maxSessions:a,maxAgeDays:o}=r;if(i.info(`Starting session pruning`,{workspacePath:n,maxSessions:a,maxAgeDays:o}),await it(e,n,i)==null)return i.debug(`No project found for pruning`,{workspacePath:n}),{prunedCount:0,prunedSessionIds:[],remainingCount:0,freedBytes:0};let s=await lt(e,n,i),c=s.filter(e=>e.parentID==null);if(c.length===0)return{prunedCount:0,prunedSessionIds:[],remainingCount:0,freedBytes:0};let l=[...c].sort((e,t)=>t.time.updated-e.time.updated),u=new Date;u.setDate(u.getDate()-o);let d=u.getTime(),f=new Set;for(let e of l)e.time.updated>=d&&f.add(e.id);for(let e=0;e!f.has(e.id)),m=new Set;for(let e of p){m.add(e.id);for(let t of s)t.parentID===e.id&&m.add(t.id)}if(m.size===0)return i.info(`No sessions to prune`),{prunedCount:0,prunedSessionIds:[],remainingCount:c.length,freedBytes:0};let h=[];for(let n of m)try{await ft(e,n,i),h.push(n),i.debug(`Pruned session`,{sessionId:n})}catch(e){i.warning(`Failed to prune session`,{sessionId:n,error:t(e)})}let g=c.length-p.length;return i.info(`Session pruning complete`,{prunedCount:h.length,remainingCount:g}),{prunedCount:h.length,prunedSessionIds:h,remainingCount:g,freedBytes:0}}async function xt(e,t,n,r){let{limit:i,fromDate:a,toDate:o}=n;r.debug(`Listing sessions`,{directory:t,limit:i});let s=[...(await lt(e,t,r)).filter(e=>!(e.parentID!=null||a!=null&&e.time.createdo.getTime()))].sort((e,t)=>t.time.updated-e.time.updated),c=[],l=i==null?s:s.slice(0,i);for(let t of l){let n=await ut(e,t.id,r),i=St(n);c.push({id:t.id,projectID:t.projectID,directory:t.directory,title:t.title,createdAt:t.time.created,updatedAt:t.time.updated,messageCount:n.length,agents:i,isChild:!1})}return r.info(`Listed sessions`,{count:c.length,directory:t}),c}function St(e){let t=new Set;for(let n of e)n.agent!=null&&t.add(n.agent);return[...t]}async function Ct(e,t,n,r,i){let{limit:a=20,caseSensitive:o=!1,sessionId:s}=r;i.debug(`Searching sessions`,{query:e,directory:n,limit:a,caseSensitive:o});let c=o?e:e.toLowerCase(),l=[],u=0;if(s!=null){let e=await wt(t,s,c,o,i);return e.length>0&&l.push({sessionId:s,matches:e.slice(0,a)}),l}let d=await xt(t,n,{},i);for(let e of d){if(u>=a)break;let n=await wt(t,e.id,c,o,i);if(n.length>0){let t=a-u;l.push({sessionId:e.id,matches:n.slice(0,t)}),u+=Math.min(n.length,t)}}return i.info(`Session search complete`,{query:e,resultCount:l.length,totalMatches:u}),l}async function wt(e,t,n,r,i){let a=await ut(e,t,i),o=[];for(let e of a){let t=e.parts??[];for(let i of t){let t=Tt(i);if(t==null)continue;let a=r?t:t.toLowerCase();if(a.includes(n)){let r=a.indexOf(n),s=Math.max(0,r-50),c=Math.min(t.length,r+n.length+50),l=t.slice(s,c);o.push({messageId:e.id,partId:i.id,excerpt:`...${l}...`,role:e.role,agent:e.agent})}}}return o}function Tt(e){switch(e.type){case`text`:return e.text;case`reasoning`:return e.reasoning;case`tool`:return e.state.status===`completed`?`${e.tool}: ${e.state.output}`:null;case`step-finish`:return null}}async function Et(e,t,n,r){if(n!=null)try{let i=await e.session.update({path:{id:t},body:{title:n}});i.error!=null&&r.warning(`Best-effort session title re-assertion failed`,{sessionId:t,sessionTitle:n,error:String(i.error)})}catch(e){r.warning(`Best-effort session title re-assertion failed`,{sessionId:t,sessionTitle:n,error:e instanceof Error?e.message:String(e)})}}function Dt(e){let t=[`--- Fro Bot Run Summary ---`,`Event: ${e.eventType}`,`Repo: ${e.repo}`,`Ref: ${e.ref}`,`Run ID: ${e.runId}`,`Cache: ${e.cacheStatus}`,`Duration: ${e.duration}s`];return e.sessionIds.length>0&&t.push(`Sessions used: ${e.sessionIds.join(`, `)}`),e.logicalKey!=null&&t.push(`Logical Thread: ${e.logicalKey}`),e.createdPRs.length>0&&t.push(`PRs created: ${e.createdPRs.join(`, `)}`),e.createdCommits.length>0&&t.push(`Commits: ${e.createdCommits.join(`, `)}`),e.tokenUsage!=null&&t.push(`Tokens: ${e.tokenUsage.input} in / ${e.tokenUsage.output} out`),t.join(` `)}async function Ot(e,n,r,i){let a=Dt(n);try{let t=await r.session.prompt({path:{id:e},body:{noReply:!0,parts:[{type:`text`,text:a}]}});if(t.error!=null){i.warning(`SDK prompt writeback failed`,{sessionId:e,error:String(t.error)});return}i.info(`Session summary written via SDK`,{sessionId:e})}catch(n){i.warning(`SDK prompt writeback failed`,{sessionId:e,error:t(n)})}}function kt(e){if(e.storeAdapter.conditionalPut==null)throw Error(`Object store adapter does not support conditionalPut`);return e.storeAdapter.conditionalPut}function At(e){if(e.storeAdapter.conditionalDelete==null)throw Error(`Object store adapter does not support conditionalDelete`);return e.storeAdapter.conditionalDelete}function jt(e){if(e.storeAdapter.getObject==null)throw Error(`Object store adapter does not support getObject`);return e.storeAdapter.getObject}function Mt(e){try{return s(kt(e))}catch(e){return C(e instanceof Error?e:Error(String(e)))}}function Nt(e){try{return s(At(e))}catch(e){return C(e instanceof Error?e:Error(String(e)))}}function Pt(e){try{return s(jt(e))}catch(e){return C(e instanceof Error?e:Error(String(e)))}}function Ft(e,t){let n=ce(e.storeConfig,`coordination`,t,`locks`,`repo.json`);return n.success===!1?C(n.error):s(n.data)}function It(e){return/pre-?condition/.test(e.message.toLowerCase())}function Lt(e,t){return new Date(e.acquired_at).getTime()+e.ttl_seconds*1e3<=t.getTime()}function Rt(e){if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.repo==`string`&&typeof t.holder_id==`string`&&(t.surface===`github`||t.surface===`discord`)&&typeof t.acquired_at==`string`&&typeof t.ttl_seconds==`number`&&Number.isFinite(t.ttl_seconds)&&typeof t.run_id==`string`}function zt(e){try{let t=JSON.parse(e);return Rt(t)===!1?C(Error(`Invalid lock record payload`)):s(t)}catch(e){return C(e instanceof Error?e:Error(String(e)))}}function Bt(e,t,n,r,i,a){return{repo:e,holder_id:t,surface:n,acquired_at:a,ttl_seconds:i,run_id:r}}async function Vt(e,t,n,r,i,a){let o=Ft(e,t);if(o.success===!1)return C(o.error);let c=new Date().toISOString(),l=Bt(t,n,r,i,e.lockTtlSeconds,c),u=Mt(e);if(u.success===!1)return C(u.error);let d=Pt(e);if(d.success===!1)return C(d.error);a.debug(`Attempting lock acquisition`,{key:o.data,repo:t,runId:i,surface:r});let f=await u.data(o.data,JSON.stringify(l),{ifNoneMatch:`*`});if(f.success===!0)return s({acquired:!0,etag:f.data.etag,holder:null});if(It(f.error)===!1)return C(f.error);let p=await d.data(o.data);if(p.success===!1)return C(p.error);let m=zt(p.data.data);if(m.success===!1)return C(m.error);if(Lt(m.data,new Date(c))===!1)return s({acquired:!1,etag:null,holder:m.data});let h=await u.data(o.data,JSON.stringify(l),{ifMatch:p.data.etag});return h.success===!1?It(h.error)===!0?s({acquired:!1,etag:null,holder:null}):C(h.error):s({acquired:!0,etag:h.data.etag,holder:null})}async function Ht(e,t,n,r){let i=Ft(e,t);if(i.success===!1)return C(i.error);let a=Nt(e);return a.success===!1?C(a.error):(r.debug(`Releasing lock`,{key:i.data,repo:t}),a.data(i.data,{ifMatch:n}))}const Ut=6e4,Wt={todowrite:[`Todo`,`\x1B[33m\x1B[1m`],todoread:[`Todo`,`\x1B[33m\x1B[1m`],bash:[`Bash`,`\x1B[31m\x1B[1m`],edit:[`Edit`,`\x1B[32m\x1B[1m`],glob:[`Glob`,`\x1B[34m\x1B[1m`],grep:[`Grep`,`\x1B[34m\x1B[1m`],list:[`List`,`\x1B[34m\x1B[1m`],read:[`Read`,`\x1B[35m\x1B[1m`],write:[`Write`,`\x1B[32m\x1B[1m`],websearch:[`Search`,`\x1B[2m\x1B[1m`]},Gt=`\x1B[0m`;function Kt(){return R.env.NO_COLOR==null}function qt(e,t){let[n,r]=Wt[e.toLowerCase()]??[e,`\x1B[36m\x1B[1m`],i=n.padEnd(10,` `);Kt()?R.stdout.write(`\n${r}|${Gt} ${i} ${Gt}${t}\n`):R.stdout.write(`\n| ${i} ${t}\n`)}function Jt(e){R.stdout.write(`\n${e}\n`)}function Yt(e){switch(e){case`hit`:return`✅ hit`;case`miss`:return`🆕 miss`;case`corrupted`:return`⚠️ corrupted (clean start)`}}function Xt(e){let t=Math.round(e/1e3);return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`}async function Zt(e,n){let{eventType:r,repo:i,ref:a,runId:o,runUrl:s,metrics:c,agent:l,resolvedOutputMode:u}=e;try{if(S.addHeading(`Fro Bot Agent Run`,2).addTable([[{data:`Field`,header:!0},{data:`Value`,header:!0}],[`Event`,r],[`Repository`,i],[`Ref`,a],[`Run ID`,`[${o}](${s})`],[`Agent`,l],[`Output Mode`,u??`N/A`],[`Cache Status`,Yt(c.cacheStatus)],[`Duration`,c.duration==null?`N/A`:Xt(c.duration)]]),(c.sessionsUsed.length>0||c.sessionsCreated.length>0)&&(S.addHeading(`Sessions`,3),c.sessionsUsed.length>0&&S.addRaw(`**Used:** ${c.sessionsUsed.join(`, `)}\n`),c.sessionsCreated.length>0&&S.addRaw(`**Created:** ${c.sessionsCreated.join(`, `)}\n`)),c.tokenUsage!=null&&(S.addHeading(`Token Usage`,3),S.addTable([[{data:`Metric`,header:!0},{data:`Count`,header:!0}],[`Input`,c.tokenUsage.input.toLocaleString()],[`Output`,c.tokenUsage.output.toLocaleString()],[`Reasoning`,c.tokenUsage.reasoning.toLocaleString()],[`Cache Read`,c.tokenUsage.cache.read.toLocaleString()],[`Cache Write`,c.tokenUsage.cache.write.toLocaleString()]]),c.model!=null&&S.addRaw(`**Model:** ${c.model}\n`),c.cost!=null&&S.addRaw(`**Cost:** $${c.cost.toFixed(4)}\n`)),(c.prsCreated.length>0||c.commitsCreated.length>0||c.commentsPosted>0)&&(S.addHeading(`Created Artifacts`,3),c.prsCreated.length>0&&S.addList([...c.prsCreated]),c.commitsCreated.length>0&&S.addList(c.commitsCreated.map(e=>`Commit \`${e.slice(0,7)}\``)),c.commentsPosted>0&&S.addRaw(`**Comments Posted:** ${c.commentsPosted}\n`)),c.errors.length>0){S.addHeading(`Errors`,3);for(let e of c.errors){let t=e.recoverable?`🔄 Recovered`:`❌ Failed`;S.addRaw(`- **${e.type}** (${t}): ${e.message}\n`)}}await S.write(),n.debug(`Wrote job summary`)}catch(e){let r=t(e);n.warning(`Failed to write job summary`,{error:r}),ue(`Failed to write job summary: ${r}`)}}function Qt(){let e=0,t=null,n=`miss`,r=null,i=[],a=[],o=[],s=[],c=0,l=null,u=null,d=null,f=[];return{start(){e=Date.now()},end(){t=Date.now()},setCacheStatus(e){n=e},setCacheSource(e){r=e},addSessionUsed(e){i.includes(e)||i.push(e)},addSessionCreated(e){a.includes(e)||a.push(e)},addPRCreated(e){o.includes(e)||o.push(e)},addCommitCreated(e){s.includes(e)||s.push(e)},incrementComments(){c++},setTokenUsage(e,t,n){l=e,u=t,d=n},recordError(e,t,n){f.push({timestamp:new Date().toISOString(),type:e,message:t,recoverable:n})},getMetrics(){let p=t==null?Date.now()-e:t-e;return Object.freeze({startTime:e,endTime:t,duration:p,cacheStatus:n,cacheSource:r,sessionsUsed:Object.freeze([...i]),sessionsCreated:Object.freeze([...a]),prsCreated:Object.freeze([...o]),commitsCreated:Object.freeze([...s]),commentsPosted:c,tokenUsage:l,model:u,cost:d,errors:Object.freeze([...f])})}}}function $t(e){I(`session-id`,e.sessionId??``),I(`resolved-output-mode`,e.resolvedOutputMode??``),I(`cache-status`,e.cacheStatus),I(`duration`,e.duration)}function K(e){let[t,n]=e.split(`/`);if(t==null||n==null||t.length===0||n.length===0)throw Error(`Invalid repository string: ${e}`);return{owner:t,repo:n}}async function en(e,n,r,i,a){try{let{owner:t,repo:o}=K(n),{data:s}=await e.rest.reactions.createForIssueComment({owner:t,repo:o,comment_id:r,content:i});return a.debug(`Created comment reaction`,{commentId:r,content:i,reactionId:s.id}),{id:s.id}}catch(e){return a.warning(`Failed to create comment reaction`,{commentId:r,content:i,error:t(e)}),null}}async function tn(e,n,r,i){try{let{owner:t,repo:i}=K(n),{data:a}=await e.rest.reactions.listForIssueComment({owner:t,repo:i,comment_id:r,per_page:100});return a.map(e=>({id:e.id,content:e.content,userLogin:e.user?.login??null}))}catch(e){return i.warning(`Failed to list comment reactions`,{commentId:r,error:t(e)}),[]}}async function nn(e,n,r,i,a){try{let{owner:t,repo:o}=K(n);return await e.rest.reactions.deleteForIssueComment({owner:t,repo:o,comment_id:r,reaction_id:i}),a.debug(`Deleted comment reaction`,{commentId:r,reactionId:i}),!0}catch(e){return a.warning(`Failed to delete comment reaction`,{commentId:r,reactionId:i,error:t(e)}),!1}}async function rn(e,n,r,i,a,o){let{owner:s,repo:c}=K(n);try{return await e.rest.issues.createLabel({owner:s,repo:c,name:r,color:i,description:a}),o.debug(`Created label`,{name:r,color:i}),!0}catch(e){return e instanceof Error&&`status`in e&&e.status===422?(o.debug(`Label already exists`,{name:r}),!0):(o.warning(`Failed to create label`,{name:r,error:t(e)}),!1)}}async function an(e,n,r,i,a){try{let{owner:t,repo:o}=K(n);return await e.rest.issues.addLabels({owner:t,repo:o,issue_number:r,labels:[...i]}),a.debug(`Added labels to issue`,{issueNumber:r,labels:i}),!0}catch(e){return a.warning(`Failed to add labels to issue`,{issueNumber:r,labels:i,error:t(e)}),!1}}async function on(e,n,r,i,a){try{let{owner:t,repo:o}=K(n);return await e.rest.issues.removeLabel({owner:t,repo:o,issue_number:r,name:i}),a.debug(`Removed label from issue`,{issueNumber:r,label:i}),!0}catch(e){return e instanceof Error&&`status`in e&&e.status===404?(a.debug(`Label was not present on issue`,{issueNumber:r,label:i}),!0):(a.warning(`Failed to remove label from issue`,{issueNumber:r,label:i,error:t(e)}),!1)}}async function sn(e,n,r){try{let{owner:t,repo:r}=K(n),{data:i}=await e.rest.repos.get({owner:t,repo:r});return i.default_branch}catch(e){return r.warning(`Failed to get default branch`,{repo:n,error:t(e)}),`main`}}const cn={admin:`OWNER`,maintain:`MEMBER`,write:`COLLABORATOR`,triage:`COLLABORATOR`};async function ln(e,n,r,i,a){try{let{data:t}=await e.rest.repos.getCollaboratorPermissionLevel({owner:n,repo:r,username:i}),o=cn[t.permission]??null;return a.debug(`Resolved sender permission`,{username:i,permission:t.permission,association:o}),o}catch(e){return a.warning(`Failed to resolve sender permission`,{username:i,error:t(e)}),null}}async function un(e,n,r){try{let{data:t}=await e.rest.users.getByUsername({username:n});return{id:t.id,login:t.login}}catch(e){return r.debug(`Failed to get user by username`,{username:n,error:t(e)}),null}}const dn={maxComments:50,maxCommits:100,maxFiles:100,maxReviews:100,maxBodyBytes:10*1024,maxTotalBytes:100*1024},fn=`…[truncated]`;function pn(e,t){if(e.length===0)return{text:``,truncated:!1};let n=new TextEncoder,r=n.encode(e);if(r.length<=t)return{text:e,truncated:!1};let i=t-n.encode(fn).length;if(i<=0)return{text:fn,truncated:!0};let a=r.slice(0,i),o=new TextDecoder(`utf-8`,{fatal:!1}).decode(a);for(;o.length>0&&o.charCodeAt(o.length-1)===65533;)a=a.slice(0,-1),o=new TextDecoder(`utf-8`,{fatal:!1}).decode(a);return{text:o+fn,truncated:!0}}async function mn(e,n,r,i,a,o){try{let[t,o]=await Promise.all([e.rest.issues.get({owner:n,repo:r,issue_number:i}),e.rest.issues.listComments({owner:n,repo:r,issue_number:i,per_page:a.maxComments})]),s=t.data,c=pn(s.body??``,a.maxBodyBytes),l=o.data.slice(0,a.maxComments).map(e=>({id:e.node_id??String(e.id),author:e.user?.login??null,body:e.body??``,createdAt:e.created_at,authorAssociation:e.author_association,isMinimized:!1})),u=(s.labels??[]).filter(e=>typeof e==`object`&&!!e&&`name`in e).map(e=>({name:e.name??``,color:e.color})),d=(s.assignees??[]).map(e=>({login:e?.login??``}));return{type:`issue`,number:s.number,title:s.title,body:c.text,bodyTruncated:c.truncated,state:s.state,author:s.user?.login??null,createdAt:s.created_at,labels:u,assignees:d,comments:l,commentsTruncated:o.data.length>=a.maxComments,totalComments:o.data.length}}catch(e){return o.warning(`REST issue fallback failed`,{owner:n,repo:r,number:i,error:t(e)}),null}}async function hn(e,n,r,i,a,o){try{let[s,c,l,u,d]=await Promise.all([e.rest.pulls.get({owner:n,repo:r,pull_number:i}),e.rest.pulls.listCommits({owner:n,repo:r,pull_number:i,per_page:a.maxCommits}),e.rest.pulls.listFiles({owner:n,repo:r,pull_number:i,per_page:a.maxFiles}),e.rest.pulls.listReviews({owner:n,repo:r,pull_number:i,per_page:a.maxReviews}),e.rest.issues.listComments({owner:n,repo:r,issue_number:i,per_page:a.maxComments})]),f=await e.rest.pulls.listRequestedReviewers({owner:n,repo:r,pull_number:i}).catch(e=>(o.warning(`Failed to fetch requested reviewers, defaulting to empty`,{owner:n,repo:r,number:i,error:t(e)}),{data:{users:[],teams:[]}})),p=s.data,m=pn(p.body??``,a.maxBodyBytes),h=p.base.repo?.owner.login,g=p.head.repo?.owner.login,_=g==null||h!==g,v=d.data.slice(0,a.maxComments).map(e=>({id:e.node_id??String(e.id),author:e.user?.login??null,body:e.body??``,createdAt:e.created_at,authorAssociation:e.author_association,isMinimized:!1})),y=c.data.slice(0,a.maxCommits).map(e=>({oid:e.sha,message:e.commit.message,author:e.commit.author?.name??null})),b=l.data.slice(0,a.maxFiles).map(e=>({path:e.filename,additions:e.additions,deletions:e.deletions,status:e.status})),x=u.data.slice(0,a.maxReviews).map(e=>({author:e.user?.login??null,state:e.state,body:e.body??``,createdAt:e.submitted_at??``,comments:[]})),S=(p.labels??[]).map(e=>({name:e.name??``,color:e.color})),C=(p.assignees??[]).map(e=>({login:e?.login??``})),w=(f.data.users??[]).map(e=>e.login),T=(f.data.teams??[]).map(e=>e.name);return{type:`pull_request`,number:p.number,title:p.title,body:m.text,bodyTruncated:m.truncated,state:p.state,author:p.user?.login??null,createdAt:p.created_at,baseBranch:p.base.ref,headBranch:p.head.ref,isFork:_,labels:S,assignees:C,comments:v,commentsTruncated:d.data.length>=a.maxComments,totalComments:d.data.length,commits:y,commitsTruncated:c.data.length>=a.maxCommits,totalCommits:c.data.length,files:b,filesTruncated:l.data.length>=a.maxFiles,totalFiles:l.data.length,reviews:x,reviewsTruncated:u.data.length>=a.maxReviews,totalReviews:u.data.length,authorAssociation:p.author_association,requestedReviewers:w,requestedReviewerTeams:T}}catch(e){return o.warning(`REST pull request fallback failed`,{owner:n,repo:r,number:i,error:t(e)}),null}}async function gn(e,n,r,i,a,o){try{return await e.graphql(` query GetIssue($owner: String!, $repo: String!, $number: Int!, $maxComments: Int!) { repository(owner: $owner, name: $repo) { diff --git a/dist/post.js b/dist/post.js index 5ff9c4a8..5fb9797b 100644 --- a/dist/post.js +++ b/dist/post.js @@ -1 +1 @@ -import{$ as e,B as t,F as n,I as r,L as i,M as a,N as o,a as s,ct as c,d as l,f as u,h as d,j as f,m as p,n as m,p as h,t as g}from"./artifact-D-cL1zfn.js";function _(e){let t=c(e);return t.length>0?t:void 0}function v(){let e=_(l.S3_ENABLED),t=_(l.S3_BUCKET),n=_(l.S3_PREFIX);if(e==null||t==null||n==null)return;let r=_(l.S3_REGION)??``,i=_(l.S3_ENDPOINT),a=_(l.S3_EXPECTED_BUCKET_OWNER),o=_(l.S3_ALLOW_INSECURE_ENDPOINT),s=_(l.S3_SSE_ENCRYPTION),c=_(l.S3_SSE_KMS_KEY_ID);return{enabled:e===`true`,bucket:t,region:r,prefix:n,endpoint:i,expectedBucketOwner:a,allowInsecureEndpoint:o===`true`,sseEncryption:s===`aws:kms`||s===`AES256`?s:void 0,sseKmsKeyId:c}}async function y(_={}){let y=_.logger??u({phase:`post`}),b=c(l.SHOULD_SAVE_CACHE),x=c(l.CACHE_SAVED),S=c(l.SESSION_ID)||null,C=c(l.OPENCODE_VERSION)||null,w=v();if(y.debug(`Post-action state`,{shouldSaveCache:b,cacheSaved:x,sessionId:S,opencodeVersion:C,hasStoreConfig:w!=null}),b!==`true`){y.info(`Skipping post-action: event was not processed`,{shouldSaveCache:b});return}if(x===`true`)y.info(`Skipping post-action: cache already saved by main action`,{cacheSaved:x});else{let t=String(o());try{await m({components:s(),runId:o(),logger:y,storagePath:i(),authPath:n(),opencodeVersion:C,...w==null?{}:{storeConfig:w}})?y.info(`Post-action cache saved`,{sessionId:S}):y.info(`Post-action: no cache content to save`,{sessionId:S})}catch(t){y.warning(`Post-action cache save failed (non-fatal)`,{error:e(t)})}if(w?.enabled===!0)try{let e=u({phase:`post-object-store`}),n=h(w,e),i=f(),o=a();await d(n,w,`github`,i,t,{runId:t,timestamp:new Date().toISOString(),cleanupSkipped:!0,runAttempt:o},e),await p(n,w,`github`,i,t,r(),e)}catch(t){y.warning(`Post-action object store sync failed (non-fatal)`,{error:e(t)})}}if(t()&&c(l.ARTIFACT_UPLOADED)!==`true`)try{let e=u({phase:`post-artifact-upload`});await g({logPath:r(),runId:o(),runAttempt:a(),logger:e})}catch(t){y.warning(`Post-action artifact upload failed (non-fatal)`,{error:e(t)})}}await y();export{}; \ No newline at end of file +import{$ as e,B as t,F as n,I as r,L as i,M as a,N as o,a as s,ct as c,d as l,f as u,h as d,j as f,m as p,n as m,p as h,t as g}from"./artifact-BFFXP2kT.js";function _(e){let t=c(e);return t.length>0?t:void 0}function v(){let e=_(l.S3_ENABLED),t=_(l.S3_BUCKET),n=_(l.S3_PREFIX);if(e==null||t==null||n==null)return;let r=_(l.S3_REGION)??``,i=_(l.S3_ENDPOINT),a=_(l.S3_EXPECTED_BUCKET_OWNER),o=_(l.S3_ALLOW_INSECURE_ENDPOINT),s=_(l.S3_SSE_ENCRYPTION),c=_(l.S3_SSE_KMS_KEY_ID);return{enabled:e===`true`,bucket:t,region:r,prefix:n,endpoint:i,expectedBucketOwner:a,allowInsecureEndpoint:o===`true`,sseEncryption:s===`aws:kms`||s===`AES256`?s:void 0,sseKmsKeyId:c}}async function y(_={}){let y=_.logger??u({phase:`post`}),b=c(l.SHOULD_SAVE_CACHE),x=c(l.CACHE_SAVED),S=c(l.SESSION_ID)||null,C=c(l.OPENCODE_VERSION)||null,w=v();if(y.debug(`Post-action state`,{shouldSaveCache:b,cacheSaved:x,sessionId:S,opencodeVersion:C,hasStoreConfig:w!=null}),b!==`true`){y.info(`Skipping post-action: event was not processed`,{shouldSaveCache:b});return}if(x===`true`)y.info(`Skipping post-action: cache already saved by main action`,{cacheSaved:x});else{let t=String(o());try{await m({components:s(),runId:o(),logger:y,storagePath:i(),authPath:n(),opencodeVersion:C,...w==null?{}:{storeConfig:w}})?y.info(`Post-action cache saved`,{sessionId:S}):y.info(`Post-action: no cache content to save`,{sessionId:S})}catch(t){y.warning(`Post-action cache save failed (non-fatal)`,{error:e(t)})}if(w?.enabled===!0)try{let e=u({phase:`post-object-store`}),n=h(w,e),i=f(),o=a();await d(n,w,`github`,i,t,{runId:t,timestamp:new Date().toISOString(),cleanupSkipped:!0,runAttempt:o},e),await p(n,w,`github`,i,t,r(),e)}catch(t){y.warning(`Post-action object store sync failed (non-fatal)`,{error:e(t)})}}if(t()&&c(l.ARTIFACT_UPLOADED)!==`true`)try{let e=u({phase:`post-artifact-upload`});await g({logPath:r(),runId:o(),runAttempt:a(),logger:e})}catch(t){y.warning(`Post-action artifact upload failed (non-fatal)`,{error:e(t)})}}await y();export{}; \ No newline at end of file diff --git a/packages/gateway/src/readiness.ts b/packages/gateway/src/readiness.ts index 8309d1d8..7d11f01b 100644 --- a/packages/gateway/src/readiness.ts +++ b/packages/gateway/src/readiness.ts @@ -1,9 +1,10 @@ import type {GatewayLogger} from './discord/client.js' import {unlinkSync, writeFileSync} from 'node:fs' +import process from 'node:process' // --------------------------------------------------------------------------- -// Gateway readiness flag — /tmp/gateway-ready +// Gateway readiness flag — /var/run/fro-bot/gateway-ready // // The Dockerfile healthcheck polls for this file. It is written when the // Discord `clientReady` event fires (i.e. the bot is fully connected and @@ -28,12 +29,12 @@ export interface ReadinessClient { * * @param client - Discord client (or compatible mock) * @param logger - Structured logger - * @param flagPath - Path to the readiness flag file (default: /tmp/gateway-ready) + * @param flagPath - Path to the readiness flag file (default: /var/run/fro-bot/gateway-ready) */ export function setupReadinessFlag( client: ReadinessClient, logger: GatewayLogger, - flagPath = '/tmp/gateway-ready', + flagPath = process.env.FRO_BOT_READY_FLAG_PATH ?? '/var/run/fro-bot/gateway-ready', ): void { // Clear any stale flag from a prior process. ENOENT is expected on fresh // containers and is silently ignored. Other errors are non-fatal here From 676ff363772457b931171cb76d955b439834e9fd Mon Sep 17 00:00:00 2001 From: "Marcus R. Brown" Date: Tue, 19 May 2026 21:24:12 -0700 Subject: [PATCH 7/8] fix(gateway): address static-analysis findings on secret read + readiness write MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Collapse `existsSync` + `statSync` in `readOptionalSecret` into a single `try/catch` on `statSync`. ENOENT falls through to the env-var fallback; any other error rethrows. Behavior is identical (missing file → null, directory → clear error, file → read) without the check-then-act window. - Pass `{mode: 0o600}` to `writeFileSync` for the gateway-ready flag and its corresponding test fixture. Defense-in-depth on the readiness flag permissions and a signal to static analyzers that the write is intentional and owner-scoped. --- packages/gateway/src/config.ts | 37 +++++++++++++++++--------- packages/gateway/src/readiness.test.ts | 2 +- packages/gateway/src/readiness.ts | 2 +- 3 files changed, 26 insertions(+), 15 deletions(-) diff --git a/packages/gateway/src/config.ts b/packages/gateway/src/config.ts index c507b687..bc0562c7 100644 --- a/packages/gateway/src/config.ts +++ b/packages/gateway/src/config.ts @@ -1,6 +1,8 @@ +import type {Stats} from 'node:fs' + import type {AwsCredentials, ObjectStoreConfig} from './runtime-effect.js' -import {existsSync, readFileSync, statSync} from 'node:fs' +import {readFileSync, statSync} from 'node:fs' import process from 'node:process' const DEFAULT_S3_PREFIX = 'fro-bot-state' @@ -40,19 +42,28 @@ export function readSecret(name: string): string { */ export function readOptionalSecret(name: string): string | null { const filePath = process.env[`${name}_FILE`] - if (filePath !== undefined && existsSync(filePath)) { - const stat = statSync(filePath) - if (stat.isFile() === false) { - throw new Error( - `Secret path is a directory, not a file: ${filePath} (the bind-mount source likely doesn't exist on the host)`, - ) + if (filePath !== undefined) { + let stat: Stats | undefined + try { + stat = statSync(filePath) + } catch (error) { + if (!(error instanceof Error && 'code' in error && error.code === 'ENOENT')) { + throw error + } + } + if (stat !== undefined) { + if (stat.isFile() === false) { + throw new Error( + `Secret path is a directory, not a file: ${filePath} (the bind-mount source likely doesn't exist on the host)`, + ) + } + const contents = readFileSync(filePath, 'utf8') + // Strip only trailing whitespace (newline/spaces from echo) so leading whitespace + // in valid secrets is preserved — matching the env-var path which uses raw process.env[name]. + // Treat whitespace-only or empty files as "not set" (e.g. empty bind-mounted optional secrets). + const trailingTrimmed = contents.trimEnd() + return trailingTrimmed.trim() === '' ? null : trailingTrimmed } - const contents = readFileSync(filePath, 'utf8') - // Strip only trailing whitespace (newline/spaces from echo) so leading whitespace - // in valid secrets is preserved — matching the env-var path which uses raw process.env[name]. - // Treat whitespace-only or empty files as "not set" (e.g. empty bind-mounted optional secrets). - const trailingTrimmed = contents.trimEnd() - return trailingTrimmed.trim() === '' ? null : trailingTrimmed } const value = process.env[name] diff --git a/packages/gateway/src/readiness.test.ts b/packages/gateway/src/readiness.test.ts index 58b36a9c..3b167236 100644 --- a/packages/gateway/src/readiness.test.ts +++ b/packages/gateway/src/readiness.test.ts @@ -94,7 +94,7 @@ describe('setupReadinessFlag', () => { const {logger} = makeLogger() // Pre-create a stale flag - writeFileSync(flagPath, 'stale') + writeFileSync(flagPath, 'stale', {mode: 0o600}) // Capture filesystem state at the exact moment once() is called let flagExistedAtRegistration: boolean | undefined diff --git a/packages/gateway/src/readiness.ts b/packages/gateway/src/readiness.ts index 7d11f01b..3b36d419 100644 --- a/packages/gateway/src/readiness.ts +++ b/packages/gateway/src/readiness.ts @@ -51,7 +51,7 @@ export function setupReadinessFlag( // Register the listener BEFORE login() so the event cannot be missed. client.once('clientReady', () => { try { - writeFileSync(flagPath, '') + writeFileSync(flagPath, '', {mode: 0o600}) logger.info({}, 'gateway ready') } catch (error) { logger.error({err: error}, 'failed to write gateway-ready flag') From 791a0d531550f0f7f289fe1b07b2ce7e0cdf3b45 Mon Sep 17 00:00:00 2001 From: "Marcus R. Brown" Date: Tue, 19 May 2026 21:36:45 -0700 Subject: [PATCH 8/8] fix(gateway): close stat-then-read race; document credential rotation; harden compose - `readOptionalSecret` collapses to a single `readFileSync` that catches ENOENT (fall through to env-var) and EISDIR (clear directory error). Removes the stat-then-read pattern that static analyzers flag as a file-system race. - Drop redundant `|| exit 1` from the gateway HEALTHCHECK -- the shell already exits non-zero when test/kill fail. - Convert secret bind mounts in compose.yaml to long syntax with `bind.create_host_path: false`. Missing secret source files now fail at `docker compose up` time instead of silently materializing as directories. The readOptionalSecret directory guard remains as a backstop. - Document static-credential rotation in deploy/README.md: rotate by writing the new value into the secret file and restarting the gateway. STS or instance-role credentials should leave the pair empty and rely on the SDK default credential chain. --- deploy/README.md | 2 + deploy/compose.yaml | 67 ++++++++++++++++++++++++----- deploy/gateway.Dockerfile | 2 +- packages/gateway/src/config.test.ts | 9 ++-- packages/gateway/src/config.ts | 28 ++++++------ 5 files changed, 78 insertions(+), 30 deletions(-) diff --git a/deploy/README.md b/deploy/README.md index bf188b0e..19343574 100644 --- a/deploy/README.md +++ b/deploy/README.md @@ -55,6 +55,8 @@ touch deploy/secrets/s3-endpoint > **Pair contract:** `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` must both be provided or both left empty. `AWS_SESSION_TOKEN` is only used when the pair is present — it is ignored otherwise. With neither pair value set, the AWS SDK default credential chain takes over (env vars, `~/.aws`, EC2/EKS instance role). +> **Rotation:** Static credentials read from `AWS_*_FILE` are loaded at gateway startup. Rotate by writing the new value into the secret file and restarting the gateway container. For refreshable credentials (STS temporary tokens, EC2/EKS instance roles), leave the pair empty and rely on the SDK default credential chain — it refreshes without restart. + ```sh touch deploy/secrets/aws-access-key-id touch deploy/secrets/aws-secret-access-key diff --git a/deploy/compose.yaml b/deploy/compose.yaml index 087bfe2d..0fb6be82 100644 --- a/deploy/compose.yaml +++ b/deploy/compose.yaml @@ -31,23 +31,70 @@ services: NO_PROXY: workspace,localhost,127.0.0.1 NODE_EXTRA_CA_CERTS: /etc/ssl/certs/mitmproxy-ca-cert.pem volumes: - # Credentials — bind-mounted as accepted-risk (no Docker Swarm secrets in v1) - - ./secrets/discord-token:/run/secrets/discord_token:ro - - ./secrets/discord-application-id:/run/secrets/discord_application_id:ro - - ./secrets/s3-bucket:/run/secrets/s3_bucket:ro - - ./secrets/s3-region:/run/secrets/s3_region:ro - - ./secrets/s3-endpoint:/run/secrets/s3_endpoint:ro + # Credentials — bind-mounted as accepted-risk (no Docker Swarm secrets in v1). + # create_host_path: false ensures a missing source file causes a clear Compose + # error at `docker compose up` time instead of Docker silently creating a directory. + - type: bind + source: ./secrets/discord-token + target: /run/secrets/discord_token + read_only: true + bind: + create_host_path: false + - type: bind + source: ./secrets/discord-application-id + target: /run/secrets/discord_application_id + read_only: true + bind: + create_host_path: false + - type: bind + source: ./secrets/s3-bucket + target: /run/secrets/s3_bucket + read_only: true + bind: + create_host_path: false + - type: bind + source: ./secrets/s3-region + target: /run/secrets/s3_region + read_only: true + bind: + create_host_path: false + - type: bind + source: ./secrets/s3-endpoint + target: /run/secrets/s3_endpoint + read_only: true + bind: + create_host_path: false # Optional — AWS credentials for explicit S3 authentication. Leave the # access-key-id and secret-access-key files empty (`touch deploy/secrets/aws-access-key-id`) # to fall back to the AWS SDK default credential chain (env, ~/.aws, IMDS). # AWS_SESSION_TOKEN is only needed for STS temporary credentials. - - ./secrets/aws-access-key-id:/run/secrets/aws_access_key_id:ro - - ./secrets/aws-secret-access-key:/run/secrets/aws_secret_access_key:ro - - ./secrets/aws-session-token:/run/secrets/aws_session_token:ro + - type: bind + source: ./secrets/aws-access-key-id + target: /run/secrets/aws_access_key_id + read_only: true + bind: + create_host_path: false + - type: bind + source: ./secrets/aws-secret-access-key + target: /run/secrets/aws_secret_access_key + read_only: true + bind: + create_host_path: false + - type: bind + source: ./secrets/aws-session-token + target: /run/secrets/aws_session_token + read_only: true + bind: + create_host_path: false # Optional — guild-scoped slash command registration (fast dev propagation). # Create the file empty (`touch deploy/secrets/discord-guild-id`) to register # slash commands globally; the gateway treats empty files as unset. - - ./secrets/discord-guild-id:/run/secrets/discord_guild_id:ro + - type: bind + source: ./secrets/discord-guild-id + target: /run/secrets/discord_guild_id + read_only: true + bind: + create_host_path: false # mitmproxy CA cert (written by mitmproxy on first start, read here for trust) - mitmproxy-certs:/etc/ssl/certs:ro networks: diff --git a/deploy/gateway.Dockerfile b/deploy/gateway.Dockerfile index 934d93ef..a83f2ecc 100644 --- a/deploy/gateway.Dockerfile +++ b/deploy/gateway.Dockerfile @@ -49,6 +49,6 @@ RUN mkdir -p /var/run/fro-bot && chmod 0700 /var/run/fro-bot # current-run failure. A real liveness probe (HTTP /healthz) lands alongside # the workspace agent. HEALTHCHECK --interval=10s --timeout=3s --retries=12 --start-period=45s \ - CMD test -f /var/run/fro-bot/gateway-ready && kill -0 1 || exit 1 + CMD test -f /var/run/fro-bot/gateway-ready && kill -0 1 CMD ["node", "dist/main.mjs"] diff --git a/packages/gateway/src/config.test.ts b/packages/gateway/src/config.test.ts index 10da30e8..b601c7dd 100644 --- a/packages/gateway/src/config.test.ts +++ b/packages/gateway/src/config.test.ts @@ -214,12 +214,9 @@ describe('readOptionalSecret', () => { delete process.env.FAKE_DIR_FILE }) - // TOCTOU resilience: we intentionally do NOT add a test where existsSync returns true but - // statSync throws ENOENT. The existing test suite uses real temp files (no vi.mock('node:fs')), - // so there's no seam to inject that race condition without restructuring the entire test module. - // The TOCTOU behaviour is correct by construction: statSync is called immediately after existsSync - // with no await in between, and Node's synchronous fs calls are not interruptible. The plan's - // "if practical" qualifier applies here — it is not practical without mocking. + // readOptionalSecret uses a single readFileSync call — ENOENT falls through to the env-var + // fallback, EISDIR throws a clear error. There is no stat-then-read sequence, so no TOCTOU + // window exists. The directory test below exercises the EISDIR path directly. it('preserves leading whitespace in file contents', () => { // Some operators may legitimately have secrets with leading whitespace diff --git a/packages/gateway/src/config.ts b/packages/gateway/src/config.ts index bc0562c7..fb883607 100644 --- a/packages/gateway/src/config.ts +++ b/packages/gateway/src/config.ts @@ -1,8 +1,6 @@ -import type {Stats} from 'node:fs' - import type {AwsCredentials, ObjectStoreConfig} from './runtime-effect.js' -import {readFileSync, statSync} from 'node:fs' +import {readFileSync} from 'node:fs' import process from 'node:process' const DEFAULT_S3_PREFIX = 'fro-bot-state' @@ -43,21 +41,25 @@ export function readSecret(name: string): string { export function readOptionalSecret(name: string): string | null { const filePath = process.env[`${name}_FILE`] if (filePath !== undefined) { - let stat: Stats | undefined + let contents: string | undefined try { - stat = statSync(filePath) + contents = readFileSync(filePath, 'utf8') } catch (error) { - if (!(error instanceof Error && 'code' in error && error.code === 'ENOENT')) { + if (error instanceof Error && 'code' in error) { + if (error.code === 'ENOENT') { + // file not present; fall through to env-var fallback + } else if (error.code === 'EISDIR') { + throw new Error( + `Secret path is a directory, not a file: ${filePath} (the bind-mount source likely doesn't exist on the host)`, + ) + } else { + throw error + } + } else { throw error } } - if (stat !== undefined) { - if (stat.isFile() === false) { - throw new Error( - `Secret path is a directory, not a file: ${filePath} (the bind-mount source likely doesn't exist on the host)`, - ) - } - const contents = readFileSync(filePath, 'utf8') + if (contents !== undefined) { // Strip only trailing whitespace (newline/spaces from echo) so leading whitespace // in valid secrets is preserved — matching the env-var path which uses raw process.env[name]. // Treat whitespace-only or empty files as "not set" (e.g. empty bind-mounted optional secrets).