const ENGINE_QUALITY = {
  wikipedia: "high",
  mdn: "high",
  stackoverflow: "high",
  bing: "medium",
  bing_news: "medium",
  duckduckgo: "medium",
  startpage: "medium",
  brave: "medium",
  "hn-algolia": "medium",
  "github-code": "medium",
  arxiv: "medium",
  "semantic-scholar": "medium",
  lobsters: "low",
  devdocs: "low",
  // RSS feed engine (news vertical, conditional on config). Curated by the
  // user — treat the per-item content as medium quality by default.
  "rss-feed": "medium",
  // Slice S11a long-tail web engines: both run independent indexes and are
  // tagged `secondary` in the general vertical so they cannot dominate
  // consensus. Snippets tend to be sparse (Mojeek title+brief; Marginalia
  // small-web descriptions), so `low` matches the S11b convention used for
  // lobsters/devdocs.
  mojeek: "low",
  marginalia: "low",
  // Slice S11a image engines: image-search results carry source-page +
  // thumbnail/url + alt text rather than evidence-quality snippets. Tag as
  // `medium` so S11c's RRF tuning treats them like the general medium pool
  // (DDG image is the zero-key floor, Brave image is a key-gated peer).
  "ddg-image": "medium",
  "brave-image": "medium"
};
function engineQualityTier(name) {
  return ENGINE_QUALITY[name] ?? "medium";
}
const QUALITY_WEIGHTS = {
  high: 1,
  medium: 0.7,
  low: 0.5
};
function qualityRrfMultiplier(tier) {
  return QUALITY_WEIGHTS[tier];
}
function resolveEngineWeight(name, legacyWeight, callerTier) {
  if (typeof callerTier === "string" && (callerTier === "high" || callerTier === "medium" || callerTier === "low")) {
    return QUALITY_WEIGHTS[callerTier];
  }
  const tier = ENGINE_QUALITY[name];
  if (tier !== void 0 && tier in QUALITY_WEIGHTS) {
    return QUALITY_WEIGHTS[tier];
  }
  if (typeof legacyWeight === "number" && Number.isFinite(legacyWeight)) {
    return legacyWeight;
  }
  return 1;
}
function _enginesWithQualityForTest() {
  return Object.entries(ENGINE_QUALITY);
}
export {
  QUALITY_WEIGHTS,
  _enginesWithQualityForTest,
  engineQualityTier,
  qualityRrfMultiplier,
  resolveEngineWeight
};
//# sourceMappingURL=engine-quality.js.map