"use strict";var _a;Object.defineProperty(exports,"__esModule",{value:!0}),exports.EventBridgeDestination=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var events=()=>{var tmp=require("../../aws-events");return events=()=>tmp,tmp},core_1=()=>{var tmp=require("../../core");return core_1=()=>tmp,tmp};class EventBridgeDestination{constructor(eventBus){this.eventBus=eventBus;try{jsiiDeprecationWarnings().aws_cdk_lib_aws_events_IEventBus(eventBus)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,EventBridgeDestination),error}}bind(_scope,fn,_options){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_lambda_IFunction(fn),jsiiDeprecationWarnings().aws_cdk_lib_aws_lambda_DestinationOptions(_options)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.bind),error}if(this.eventBus)return this.eventBus.grantPutEventsTo(fn),{destination:this.eventBus.eventBusArn};let eventBus=_scope.node.tryFindChild("DefaultEventBus")||events().EventBus.fromEventBusArn(_scope,"DefaultEventBus",core_1().Stack.of(fn).formatArn({service:"events",resource:"event-bus",resourceName:"default"}));return eventBus.grantPutEventsTo(fn),{destination:eventBus.eventBusArn}}}exports.EventBridgeDestination=EventBridgeDestination,_a=JSII_RTTI_SYMBOL_1,EventBridgeDestination[_a]={fqn:"aws-cdk-lib.aws_lambda_destinations.EventBridgeDestination",version:"2.159.0"};
