const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.js');
const require_decorateMetadata = require('../../../_virtual/_@oxc-project_runtime@0.94.0/helpers/decorateMetadata.js');
const require_decorate = require('../../../_virtual/_@oxc-project_runtime@0.94.0/helpers/decorate.js');
const require_DidCommModuleConfig = require('./DidCommModuleConfig.js');
const require_DidCommMessageSender = require('./DidCommMessageSender.js');
const require_DidCommConnectionsApi = require('./modules/connections/DidCommConnectionsApi.js');
const require_DidCommFeatureRegistry = require('./DidCommFeatureRegistry.js');
const require_DidCommMessageHandlerRegistry = require('./DidCommMessageHandlerRegistry.js');
const require_DidCommBasicMessagesApi = require('./modules/basic-messages/DidCommBasicMessagesApi.js');
const require_DidCommOutOfBandApi = require('./modules/oob/DidCommOutOfBandApi.js');
const require_DidCommMessagePickupApi = require('./modules/message-pickup/DidCommMessagePickupApi.js');
const require_DidCommMediatorApi = require('./modules/routing/DidCommMediatorApi.js');
const require_DidCommDiscoverFeaturesApi = require('./modules/discover-features/DidCommDiscoverFeaturesApi.js');
const require_DidCommMediationRecipientApi = require('./modules/routing/DidCommMediationRecipientApi.js');
const require_DidCommCredentialsApi = require('./modules/credentials/DidCommCredentialsApi.js');
const require_DidCommProofsApi = require('./modules/proofs/DidCommProofsApi.js');
require('./modules/index.js');
const require_DidCommMessageReceiver = require('./DidCommMessageReceiver.js');
let __credo_ts_core = require("@credo-ts/core");
__credo_ts_core = require_rolldown_runtime.__toESM(__credo_ts_core);

//#region ../didcomm/src/DidCommApi.ts
var _ref, _ref2, _ref3, _ref4, _ref5, _ref6;
let DidCommApi = class DidCommApi$1 {
	constructor(agentContext, messageHandlerRegistry, messageSender, messageReceiver, featureRegistry, config) {
		this.agentContext = agentContext;
		this.messageHandlerRegistry = messageHandlerRegistry;
		this.messageSender = messageSender;
		this.messageReceiver = messageReceiver;
		this.featureRegistry = featureRegistry;
		this.config = config;
		this.connections = this.agentContext.resolve(require_DidCommConnectionsApi.DidCommConnectionsApi);
		this.oob = this.agentContext.resolve(require_DidCommOutOfBandApi.DidCommOutOfBandApi);
		this.discovery = this.agentContext.resolve(require_DidCommDiscoverFeaturesApi.DidCommDiscoverFeaturesApi);
		this.proofs = this.apiOrUndefined(this.config.enabledModules.proofs, require_DidCommProofsApi.DidCommProofsApi);
		this.credentials = this.apiOrUndefined(this.config.enabledModules.credentials, require_DidCommCredentialsApi.DidCommCredentialsApi);
		this.messagePickup = this.apiOrUndefined(this.config.enabledModules.messagePickup, require_DidCommMessagePickupApi.DidCommMessagePickupApi);
		this.basicMessages = this.apiOrUndefined(this.config.enabledModules.basicMessages, require_DidCommBasicMessagesApi.DidCommBasicMessagesApi);
		this.mediator = this.apiOrUndefined(this.config.enabledModules.mediator, require_DidCommMediatorApi.DidCommMediatorApi);
		this.mediationRecipient = this.apiOrUndefined(this.config.enabledModules.mediationRecipient, require_DidCommMediationRecipientApi.DidCommMediationRecipientApi);
	}
	registerInboundTransport(inboundTransport) {
		this.messageReceiver.registerInboundTransport(inboundTransport);
	}
	async unregisterInboundTransport(inboundTransport) {
		await this.messageReceiver.unregisterInboundTransport(inboundTransport);
	}
	get inboundTransports() {
		return this.messageReceiver.inboundTransports;
	}
	registerOutboundTransport(outboundTransport) {
		this.messageSender.registerOutboundTransport(outboundTransport);
	}
	async unregisterOutboundTransport(outboundTransport) {
		await this.messageSender.unregisterOutboundTransport(outboundTransport);
	}
	get outboundTransports() {
		return this.messageSender.outboundTransports;
	}
	/**
	* Agent's feature registry
	*/
	registerMessageHandlers(messageHandlers) {
		for (const messageHandler of messageHandlers) this.messageHandlerRegistry.registerMessageHandler(messageHandler);
	}
	registerMessageHandlerMiddleware(messageHandlerMiddleware) {
		this.messageHandlerRegistry.registerMessageHandlerMiddleware(messageHandlerMiddleware);
	}
	get fallbackMessageHandler() {
		return this.messageHandlerRegistry.fallbackMessageHandler;
	}
	get messageHandlerMiddlewares() {
		return this.messageHandlerRegistry.messageHandlerMiddlewares;
	}
	/**
	* Sets the fallback message handler, the message handler that will be called if no handler
	* is registered for an incoming message type.
	*/
	setFallbackMessageHandler(fallbackMessageHandler) {
		this.messageHandlerRegistry.setFallbackMessageHandler(fallbackMessageHandler);
	}
	get features() {
		return this.featureRegistry;
	}
	apiOrUndefined(isEnabled, apiClass) {
		if (isEnabled) return this.agentContext.resolve(apiClass);
	}
};
DidCommApi = require_decorate.__decorate([(0, __credo_ts_core.injectable)(), require_decorateMetadata.__decorateMetadata("design:paramtypes", [
	typeof (_ref = typeof __credo_ts_core.AgentContext !== "undefined" && __credo_ts_core.AgentContext) === "function" ? _ref : Object,
	typeof (_ref2 = typeof require_DidCommMessageHandlerRegistry.DidCommMessageHandlerRegistry !== "undefined" && require_DidCommMessageHandlerRegistry.DidCommMessageHandlerRegistry) === "function" ? _ref2 : Object,
	typeof (_ref3 = typeof require_DidCommMessageSender.DidCommMessageSender !== "undefined" && require_DidCommMessageSender.DidCommMessageSender) === "function" ? _ref3 : Object,
	typeof (_ref4 = typeof require_DidCommMessageReceiver.DidCommMessageReceiver !== "undefined" && require_DidCommMessageReceiver.DidCommMessageReceiver) === "function" ? _ref4 : Object,
	typeof (_ref5 = typeof require_DidCommFeatureRegistry.DidCommFeatureRegistry !== "undefined" && require_DidCommFeatureRegistry.DidCommFeatureRegistry) === "function" ? _ref5 : Object,
	typeof (_ref6 = typeof require_DidCommModuleConfig.DidCommModuleConfig !== "undefined" && require_DidCommModuleConfig.DidCommModuleConfig) === "function" ? _ref6 : Object
])], DidCommApi);

//#endregion
Object.defineProperty(exports, 'DidCommApi', {
  enumerable: true,
  get: function () {
    return DidCommApi;
  }
});