import { readFileSync } from "node:fs";
import { dirname, join } from "node:path";
import { fileURLToPath } from "node:url";
const __dirname = dirname(fileURLToPath(import.meta.url));
let _cache = null;
export function loadProviderRegistry() {
    if (_cache)
        return _cache;
    try {
        const raw = readFileSync(join(__dirname, "..", "..", "..", "..", "..", "config", "providers.json"), "utf-8");
        const data = JSON.parse(raw);
        _cache = data.providers;
        return _cache;
    }
    catch {
        try {
            const raw = readFileSync(join(__dirname, "..", "..", "providers.json"), "utf-8");
            const data = JSON.parse(raw);
            _cache = data.providers;
            return _cache;
        }
        catch {
            return [];
        }
    }
}
export function getProviderById(id) {
    return loadProviderRegistry().find((provider) => provider.id === id);
}
//# sourceMappingURL=registry.js.map