"use strict";var _a;Object.defineProperty(exports,"__esModule",{value:!0}),exports.ElasticBeanstalkEnvironmentEndpointTarget=void 0;const jsiiDeprecationWarnings=require("../../.warnings.jsii.js"),JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti"),cdk=require("../../core"),region_info_1=require("../../region-info");class ElasticBeanstalkEnvironmentEndpointTarget{constructor(environmentEndpoint){this.environmentEndpoint=environmentEndpoint}bind(_record,_zone){try{jsiiDeprecationWarnings.aws_cdk_lib_aws_route53_IRecordSet(_record),jsiiDeprecationWarnings.aws_cdk_lib_aws_route53_IHostedZone(_zone)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.bind),error}if(cdk.Token.isUnresolved(this.environmentEndpoint))throw new Error("Cannot use an EBS alias as `environmentEndpoint`. You must find your EBS environment endpoint via the AWS console. See the Elastic Beanstalk developer guide: https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customdomains.html");const dnsName=this.environmentEndpoint,subDomains=cdk.Fn.split(".",dnsName),regionSubdomainIndex=subDomains.length-3,region=cdk.Fn.select(regionSubdomainIndex,subDomains),{ebsEnvEndpointHostedZoneId:hostedZoneId}=region_info_1.RegionInfo.get(region);if(!hostedZoneId||!dnsName)throw new Error(`Elastic Beanstalk environment target is not supported for the "${region}" region.`);return{hostedZoneId,dnsName}}}exports.ElasticBeanstalkEnvironmentEndpointTarget=ElasticBeanstalkEnvironmentEndpointTarget,_a=JSII_RTTI_SYMBOL_1,ElasticBeanstalkEnvironmentEndpointTarget[_a]={fqn:"aws-cdk-lib.aws_route53_targets.ElasticBeanstalkEnvironmentEndpointTarget",version:"2.96.1"};
