import { t as getProviderEnvVars } from "./provider-env-vars-BOJnDEgm.js";
import { n as listMemoryEmbeddingProviders, r as listRegisteredMemoryEmbeddingProviderAdapters } from "./memory-embedding-provider-runtime-DQ44Uy9r.js";
import "./memory-core-host-embedding-registry-C1vFhX3Z.js";
import "./provider-env-vars-9nkd3xZM.js";
//#region extensions/memory-core/src/memory/provider-adapter-registration.ts
function filterUnregisteredMemoryEmbeddingProviderAdapters(params) {
	const existingIds = new Set(params.registeredAdapters.map((adapter) => adapter.id));
	return params.builtinAdapters.filter((adapter) => !existingIds.has(adapter.id));
}
//#endregion
//#region extensions/memory-core/src/memory/provider-adapters.ts
const builtinMemoryEmbeddingProviderAdapters = [];
function getBuiltinMemoryEmbeddingProviderAdapter(id) {
	return listMemoryEmbeddingProviders().find((adapter) => adapter.id === id);
}
function registerBuiltInMemoryEmbeddingProviders(register) {
	for (const adapter of filterUnregisteredMemoryEmbeddingProviderAdapters({
		builtinAdapters: builtinMemoryEmbeddingProviderAdapters,
		registeredAdapters: listRegisteredMemoryEmbeddingProviderAdapters()
	})) register.registerMemoryEmbeddingProvider(adapter);
}
function getBuiltinMemoryEmbeddingProviderDoctorMetadata(providerId) {
	const adapter = getBuiltinMemoryEmbeddingProviderAdapter(providerId);
	if (!adapter) return null;
	const authProviderId = adapter.authProviderId ?? adapter.id;
	return {
		providerId: adapter.id,
		authProviderId,
		envVars: getProviderEnvVars(authProviderId),
		transport: adapter.transport === "local" ? "local" : "remote",
		autoSelectPriority: adapter.autoSelectPriority
	};
}
function listBuiltinAutoSelectMemoryEmbeddingProviderDoctorMetadata() {
	return listMemoryEmbeddingProviders().filter((adapter) => typeof adapter.autoSelectPriority === "number").toSorted((a, b) => (a.autoSelectPriority ?? 0) - (b.autoSelectPriority ?? 0)).map((adapter) => {
		const authProviderId = adapter.authProviderId ?? adapter.id;
		return {
			providerId: adapter.id,
			authProviderId,
			envVars: getProviderEnvVars(authProviderId),
			transport: adapter.transport === "local" ? "local" : "remote",
			autoSelectPriority: adapter.autoSelectPriority
		};
	});
}
//#endregion
export { listBuiltinAutoSelectMemoryEmbeddingProviderDoctorMetadata as n, registerBuiltInMemoryEmbeddingProviders as r, getBuiltinMemoryEmbeddingProviderDoctorMetadata as t };
