import "./dialect-helpers-DRI5pyY3.mjs";
import "./base64-CmWvODNW.mjs";
import "./types-CuW0zWDA.mjs";
import { a as getDb, i as emdashLoader } from "./loader-CB6YHeul.mjs";

//#region src/media/provider-loader.ts
let virtualMediaProviders;
const mediaProviderInstances = /* @__PURE__ */ new Map();
/**
* Load media providers from virtual module
*/
async function loadMediaProviders() {
	if (virtualMediaProviders === void 0) virtualMediaProviders = (await import("virtual:emdash/media-providers")).mediaProviders || [];
}
/**
* Get a media provider by ID.
*
* Used by EmDashMedia component for frontend rendering.
* Providers are lazy-loaded from virtual module and cached.
*
* @example
* ```ts
* const provider = await getMediaProvider("cloudflare-images");
* if (provider) {
*   const embed = provider.getEmbed(mediaValue, { width: 800 });
* }
* ```
*/
async function getMediaProvider(providerId) {
	const cached = mediaProviderInstances.get(providerId);
	if (cached) return cached;
	await loadMediaProviders();
	const entry = virtualMediaProviders?.find((p) => p.id === providerId);
	if (!entry) return;
	const provider = entry.createProvider({});
	mediaProviderInstances.set(providerId, provider);
	return provider;
}

//#endregion
export { emdashLoader, getDb, getMediaProvider };
//# sourceMappingURL=runtime.mjs.map