"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getCatalogRoutingSnapshot = void 0;
const cliproxy_model_routing_1 = require("../../shared/cliproxy-model-routing");
const stats_fetcher_1 = require("./stats-fetcher");
const catalog_cache_1 = require("./catalog-cache");
async function getCatalogRoutingSnapshot() {
    const snapshot = await (0, catalog_cache_1.getResolvedCatalogSnapshot)();
    const modelsResponse = snapshot.source === 'live' ? await (0, stats_fetcher_1.fetchCliproxyModels)() : null;
    const routing = (0, cliproxy_model_routing_1.buildCliproxyRoutingHints)(snapshot.catalogs, modelsResponse?.models ?? []);
    return {
        catalogs: snapshot.catalogs,
        source: snapshot.source,
        cacheAge: snapshot.cacheAge,
        routing,
    };
}
exports.getCatalogRoutingSnapshot = getCatalogRoutingSnapshot;
//# sourceMappingURL=catalog-routing.js.map