"use strict";var _a;Object.defineProperty(exports,"__esModule",{value:!0}),exports.CustomResource=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var cfn_resource_1=()=>{var tmp=require("./cfn-resource");return cfn_resource_1=()=>tmp,tmp},removal_policy_1=()=>{var tmp=require("./removal-policy");return removal_policy_1=()=>tmp,tmp},resource_1=()=>{var tmp=require("./resource");return resource_1=()=>tmp,tmp},token_1=()=>{var tmp=require("./token");return token_1=()=>tmp,tmp};class CustomResource extends resource_1().Resource{constructor(scope,id,props){super(scope,id);try{jsiiDeprecationWarnings().aws_cdk_lib_CustomResourceProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,CustomResource),error}const type=renderResourceType(props.resourceType),properties=props.pascalCaseProperties??!1?uppercaseProperties(props.properties||{}):props.properties||{};this.resource=new(cfn_resource_1()).CfnResource(this,"Default",{type,properties:{ServiceToken:props.serviceToken,...properties}}),this.resource.applyRemovalPolicy(props.removalPolicy,{default:removal_policy_1().RemovalPolicy.DESTROY})}get ref(){return this.resource.ref}getAtt(attributeName){return this.resource.getAtt(attributeName)}getAttString(attributeName){return token_1().Token.asString(this.getAtt(attributeName))}}exports.CustomResource=CustomResource,_a=JSII_RTTI_SYMBOL_1,CustomResource[_a]={fqn:"aws-cdk-lib.CustomResource",version:"2.159.0"};function uppercaseProperties(props){const ret={};return Object.keys(props).forEach(key=>{const upper=key.slice(0,1).toUpperCase()+key.slice(1);ret[upper]=props[key]}),ret}function renderResourceType(resourceType){if(!resourceType)return"AWS::CloudFormation::CustomResource";if(!resourceType.startsWith("Custom::"))throw new Error(`Custom resource type must begin with "Custom::" (${resourceType})`);if(resourceType.length>60)throw new Error(`Custom resource type length > 60 (${resourceType})`);const typeName=resourceType.slice(resourceType.indexOf("::")+2);if(!/^[a-z0-9_@-]+$/i.test(typeName))throw new Error(`Custom resource type name can only include alphanumeric characters and _@- (${typeName})`);return resourceType}
