const FACTORIES = new Map();
export function registerChannel(name, factory) {
    FACTORIES.set(name, factory);
}
export async function makeChannel(name, cfg) {
    const factory = FACTORIES.get(name);
    if (!factory) {
        throw new Error(`unknown channel "${name}". Known: ${Array.from(FACTORIES.keys()).join(", ") || "(none registered)"}`);
    }
    return await factory(cfg);
}
export function listAvailableChannels() {
    return Array.from(FACTORIES.keys()).sort();
}
// Lazy registration of built-in adapters happens via registerBuiltins().
let builtinsRegistered = false;
export async function registerBuiltins() {
    if (builtinsRegistered)
        return;
    builtinsRegistered = true;
    // Each adapter file calls registerChannel() at module-load time.
    await import("./imessage.js");
    await import("./telegram.js");
    await import("./webhook.js");
    await import("./slack.js");
    await import("./discord.js");
    await import("./feishu.js");
}
//# sourceMappingURL=registry.js.map