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Ae,IACX,EAAY,cAAc,mBAAmB,CACzC,SACA,iBACA,0BAA0B,IAIhC,sBAAyB,IAC3B,MAAM,EAAM,EAAM,MAAO,GACnB,SAAE,EAAQ,qBAAE,EAAoB,gBAAE,GAAoB,EACtD,EAAqC,MAAZ,EAAmB,SAAY,mBAAmB,eAAe,kBAAkB,EAAjC,SAAgD,EAC3H,IAAqB,EACrB,EAAiB,OAAO,OAAO,EAAO,CACxC,SAAU,EACV,MACA,mBACA,qBAAsB,eAAe,kBAAkB,IAAwB,GAC/E,gBAAiB,eAAe,kBAAkB,IAAmB,KAEzE,IAAI,EAOJ,OANA,EAAe,0BAA4B,UACnC,EAAM,YAAc,IACpB,EAA4B,sBAAsB,sBAAsB,EAAM,YAE3E,GAEJ,CAAc,EAGnB,8BAAiC,IACnC,MAAM,SAAE,GAAa,EAMrB,YALiB,IAAb,IACA,EAAM,SAAW,UACb,MAAM,IAAI,MAAM,+GAA+G,GAGhI,CAAK,EAGhB,QAAQ,mBAAqB,mBAC7B,QAAQ,0BAA4B,0BACpC,QAAQ,4BAA8B,4BACtC,QAAQ,kBAAoB,kBAC5B,QAAQ,sBAAwB,sBAChC,QAAQ,8BAAgC,8BACxC,QAAQ,cAAgB,cACxB,QAAQ,aAAe","file":"/npm/@smithy/middleware-endpoint@4.4.18/dist-cjs/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/@smithy/middleware-endpoint@4.4.18/dist-cjs/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","'use strict';\n\nvar getEndpointFromConfig = require('./adaptors/getEndpointFromConfig');\nvar urlParser = require('@smithy/url-parser');\nvar core = require('@smithy/core');\nvar utilMiddleware = require('@smithy/util-middleware');\nvar middlewareSerde = require('@smithy/middleware-serde');\n\nconst resolveParamsForS3 = async (endpointParams) => {\n    const bucket = endpointParams?.Bucket || \"\";\n    if (typeof endpointParams.Bucket === \"string\") {\n        endpointParams.Bucket = bucket.replace(/#/g, encodeURIComponent(\"#\")).replace(/\\?/g, encodeURIComponent(\"?\"));\n    }\n    if (isArnBucketName(bucket)) {\n        if (endpointParams.ForcePathStyle === true) {\n            throw new Error(\"Path-style addressing cannot be used with ARN buckets\");\n        }\n    }\n    else if (!isDnsCompatibleBucketName(bucket) ||\n        (bucket.indexOf(\".\") !== -1 && !String(endpointParams.Endpoint).startsWith(\"http:\")) ||\n        bucket.toLowerCase() !== bucket ||\n        bucket.length < 3) {\n        endpointParams.ForcePathStyle = true;\n    }\n    if (endpointParams.DisableMultiRegionAccessPoints) {\n        endpointParams.disableMultiRegionAccessPoints = true;\n        endpointParams.DisableMRAP = true;\n    }\n    return endpointParams;\n};\nconst DOMAIN_PATTERN = /^[a-z0-9][a-z0-9\\.\\-]{1,61}[a-z0-9]$/;\nconst IP_ADDRESS_PATTERN = /(\\d+\\.){3}\\d+/;\nconst DOTS_PATTERN = /\\.\\./;\nconst isDnsCompatibleBucketName = (bucketName) => DOMAIN_PATTERN.test(bucketName) && !IP_ADDRESS_PATTERN.test(bucketName) && !DOTS_PATTERN.test(bucketName);\nconst isArnBucketName = (bucketName) => {\n    const [arn, partition, service, , , bucket] = bucketName.split(\":\");\n    const isArn = arn === \"arn\" && bucketName.split(\":\").length >= 6;\n    const isValidArn = Boolean(isArn && partition && service && bucket);\n    if (isArn && !isValidArn) {\n        throw new Error(`Invalid ARN: ${bucketName} was an invalid ARN.`);\n    }\n    return isValidArn;\n};\n\nconst createConfigValueProvider = (configKey, canonicalEndpointParamKey, config, isClientContextParam = false) => {\n    const configProvider = async () => {\n        let configValue;\n        if (isClientContextParam) {\n            const clientContextParams = config.clientContextParams;\n            const nestedValue = clientContextParams?.[configKey];\n            configValue = nestedValue ?? config[configKey] ?? config[canonicalEndpointParamKey];\n        }\n        else {\n            configValue = config[configKey] ?? config[canonicalEndpointParamKey];\n        }\n        if (typeof configValue === \"function\") {\n            return configValue();\n        }\n        return configValue;\n    };\n    if (configKey === \"credentialScope\" || canonicalEndpointParamKey === \"CredentialScope\") {\n        return async () => {\n            const credentials = typeof config.credentials === \"function\" ? await config.credentials() : config.credentials;\n            const configValue = credentials?.credentialScope ?? credentials?.CredentialScope;\n            return configValue;\n        };\n    }\n    if (configKey === \"accountId\" || canonicalEndpointParamKey === \"AccountId\") {\n        return async () => {\n            const credentials = typeof config.credentials === \"function\" ? await config.credentials() : config.credentials;\n            const configValue = credentials?.accountId ?? credentials?.AccountId;\n            return configValue;\n        };\n    }\n    if (configKey === \"endpoint\" || canonicalEndpointParamKey === \"endpoint\") {\n        return async () => {\n            if (config.isCustomEndpoint === false) {\n                return undefined;\n            }\n            const endpoint = await configProvider();\n            if (endpoint && typeof endpoint === \"object\") {\n                if (\"url\" in endpoint) {\n                    return endpoint.url.href;\n                }\n                if (\"hostname\" in endpoint) {\n                    const { protocol, hostname, port, path } = endpoint;\n                    return `${protocol}//${hostname}${port ? \":\" + port : \"\"}${path}`;\n                }\n            }\n            return endpoint;\n        };\n    }\n    return configProvider;\n};\n\nconst toEndpointV1 = (endpoint) => {\n    if (typeof endpoint === \"object\") {\n        if (\"url\" in endpoint) {\n            return urlParser.parseUrl(endpoint.url);\n        }\n        return endpoint;\n    }\n    return urlParser.parseUrl(endpoint);\n};\n\nconst getEndpointFromInstructions = async (commandInput, instructionsSupplier, clientConfig, context) => {\n    if (!clientConfig.isCustomEndpoint) {\n        let endpointFromConfig;\n        if (clientConfig.serviceConfiguredEndpoint) {\n            endpointFromConfig = await clientConfig.serviceConfiguredEndpoint();\n        }\n        else {\n            endpointFromConfig = await getEndpointFromConfig.getEndpointFromConfig(clientConfig.serviceId);\n        }\n        if (endpointFromConfig) {\n            clientConfig.endpoint = () => Promise.resolve(toEndpointV1(endpointFromConfig));\n            clientConfig.isCustomEndpoint = true;\n        }\n    }\n    const endpointParams = await resolveParams(commandInput, instructionsSupplier, clientConfig);\n    if (typeof clientConfig.endpointProvider !== \"function\") {\n        throw new Error(\"config.endpointProvider is not set.\");\n    }\n    const endpoint = clientConfig.endpointProvider(endpointParams, context);\n    return endpoint;\n};\nconst resolveParams = async (commandInput, instructionsSupplier, clientConfig) => {\n    const endpointParams = {};\n    const instructions = instructionsSupplier?.getEndpointParameterInstructions?.() || {};\n    for (const [name, instruction] of Object.entries(instructions)) {\n        switch (instruction.type) {\n            case \"staticContextParams\":\n                endpointParams[name] = instruction.value;\n                break;\n            case \"contextParams\":\n                endpointParams[name] = commandInput[instruction.name];\n                break;\n            case \"clientContextParams\":\n            case \"builtInParams\":\n                endpointParams[name] = await createConfigValueProvider(instruction.name, name, clientConfig, instruction.type !== \"builtInParams\")();\n                break;\n            case \"operationContextParams\":\n                endpointParams[name] = instruction.get(commandInput);\n                break;\n            default:\n                throw new Error(\"Unrecognized endpoint parameter instruction: \" + JSON.stringify(instruction));\n        }\n    }\n    if (Object.keys(instructions).length === 0) {\n        Object.assign(endpointParams, clientConfig);\n    }\n    if (String(clientConfig.serviceId).toLowerCase() === \"s3\") {\n        await resolveParamsForS3(endpointParams);\n    }\n    return endpointParams;\n};\n\nconst endpointMiddleware = ({ config, instructions, }) => {\n    return (next, context) => async (args) => {\n        if (config.isCustomEndpoint) {\n            core.setFeature(context, \"ENDPOINT_OVERRIDE\", \"N\");\n        }\n        const endpoint = await getEndpointFromInstructions(args.input, {\n            getEndpointParameterInstructions() {\n                return instructions;\n            },\n        }, { ...config }, context);\n        context.endpointV2 = endpoint;\n        context.authSchemes = endpoint.properties?.authSchemes;\n        const authScheme = context.authSchemes?.[0];\n        if (authScheme) {\n            context[\"signing_region\"] = authScheme.signingRegion;\n            context[\"signing_service\"] = authScheme.signingName;\n            const smithyContext = utilMiddleware.getSmithyContext(context);\n            const httpAuthOption = smithyContext?.selectedHttpAuthScheme?.httpAuthOption;\n            if (httpAuthOption) {\n                httpAuthOption.signingProperties = Object.assign(httpAuthOption.signingProperties || {}, {\n                    signing_region: authScheme.signingRegion,\n                    signingRegion: authScheme.signingRegion,\n                    signing_service: authScheme.signingName,\n                    signingName: authScheme.signingName,\n                    signingRegionSet: authScheme.signingRegionSet,\n                }, authScheme.properties);\n            }\n        }\n        return next({\n            ...args,\n        });\n    };\n};\n\nconst endpointMiddlewareOptions = {\n    step: \"serialize\",\n    tags: [\"ENDPOINT_PARAMETERS\", \"ENDPOINT_V2\", \"ENDPOINT\"],\n    name: \"endpointV2Middleware\",\n    override: true,\n    relation: \"before\",\n    toMiddleware: middlewareSerde.serializerMiddlewareOption.name,\n};\nconst getEndpointPlugin = (config, instructions) => ({\n    applyToStack: (clientStack) => {\n        clientStack.addRelativeTo(endpointMiddleware({\n            config,\n            instructions,\n        }), endpointMiddlewareOptions);\n    },\n});\n\nconst resolveEndpointConfig = (input) => {\n    const tls = input.tls ?? true;\n    const { endpoint, useDualstackEndpoint, useFipsEndpoint } = input;\n    const customEndpointProvider = endpoint != null ? async () => toEndpointV1(await utilMiddleware.normalizeProvider(endpoint)()) : undefined;\n    const isCustomEndpoint = !!endpoint;\n    const resolvedConfig = Object.assign(input, {\n        endpoint: customEndpointProvider,\n        tls,\n        isCustomEndpoint,\n        useDualstackEndpoint: utilMiddleware.normalizeProvider(useDualstackEndpoint ?? false),\n        useFipsEndpoint: utilMiddleware.normalizeProvider(useFipsEndpoint ?? false),\n    });\n    let configuredEndpointPromise = undefined;\n    resolvedConfig.serviceConfiguredEndpoint = async () => {\n        if (input.serviceId && !configuredEndpointPromise) {\n            configuredEndpointPromise = getEndpointFromConfig.getEndpointFromConfig(input.serviceId);\n        }\n        return configuredEndpointPromise;\n    };\n    return resolvedConfig;\n};\n\nconst resolveEndpointRequiredConfig = (input) => {\n    const { endpoint } = input;\n    if (endpoint === undefined) {\n        input.endpoint = async () => {\n            throw new Error(\"@smithy/middleware-endpoint: (default endpointRuleSet) endpoint is not set - you must configure an endpoint.\");\n        };\n    }\n    return input;\n};\n\nexports.endpointMiddleware = endpointMiddleware;\nexports.endpointMiddlewareOptions = endpointMiddlewareOptions;\nexports.getEndpointFromInstructions = getEndpointFromInstructions;\nexports.getEndpointPlugin = getEndpointPlugin;\nexports.resolveEndpointConfig = resolveEndpointConfig;\nexports.resolveEndpointRequiredConfig = resolveEndpointRequiredConfig;\nexports.resolveParams = resolveParams;\nexports.toEndpointV1 = toEndpointV1;\n"]}