"use strict";var _a;Object.defineProperty(exports,"__esModule",{value:!0}),exports.CfnOutput=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_element_1=()=>{var tmp=require("./cfn-element");return cfn_element_1=()=>tmp,tmp};class CfnOutput extends cfn_element_1().CfnElement{constructor(scope,id,props){super(scope,id);try{jsiiDeprecationWarnings().aws_cdk_lib_CfnOutputProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,CfnOutput),error}if(props.value===void 0)throw new Error(`Missing value for CloudFormation output at path "${this.node.path}"`);if(Array.isArray(props.value))throw new Error(`CloudFormation output was given a string list instead of a string at path "${this.node.path}"`);this._description=props.description,this._key=props.key,this._value=props.value,this._condition=props.condition,this._exportName=props.exportName,this.node.addValidation({validate:()=>this.validateOutput()})}get description(){return this._description}set description(description){this._description=description}get value(){return this._value}set value(value){this._value=value}get condition(){return this._condition}set condition(condition){this._condition=condition}get exportName(){return this._exportName}set exportName(exportName){this._exportName=exportName}get importValue(){return cfn_fn_1().Fn.importValue(lazy_1().Lazy.uncachedString({produce:ctx=>{if(stack_1().Stack.of(ctx.scope)===this.stack)throw new Error(`'importValue' property of '${this.node.path}' should only be used in a different Stack`);if(!this._exportName)throw new Error(`Add an exportName to the CfnOutput at '${this.node.path}' in order to use 'output.importValue'`);return this._exportName}}))}_toCloudFormation(){return{Outputs:{[this._key??this.logicalId]:{Description:this._description,Value:this._value,Export:this._exportName!=null?{Name:this._exportName}:void 0,Condition:this._condition?this._condition.logicalId:void 0}}}}validateOutput(){const errors=[];return this._exportName!==void 0&&!token_1().Token.isUnresolved(this._exportName)&&(this._exportName.length===0&&errors.push("Export name cannot be empty"),this._exportName.length>255&&errors.push(`Export name cannot exceed 255 characters (got ${this._exportName.length} characters)`),/^[A-Za-z0-9-:]*$/.test(this._exportName)||errors.push(`Export name must only include alphanumeric characters, colons, or hyphens (got '${this._exportName}')`)),errors}}exports.CfnOutput=CfnOutput,_a=JSII_RTTI_SYMBOL_1,CfnOutput[_a]={fqn:"aws-cdk-lib.CfnOutput",version:"2.159.0"};var cfn_fn_1=()=>{var tmp=require("./cfn-fn");return cfn_fn_1=()=>tmp,tmp},lazy_1=()=>{var tmp=require("./lazy");return lazy_1=()=>tmp,tmp},stack_1=()=>{var tmp=require("./stack");return stack_1=()=>tmp,tmp},token_1=()=>{var tmp=require("./token");return token_1=()=>tmp,tmp};
