function probeHealth(input) {
  const uptimeMs = Date.now() - input.startedAt;
  const uptimeSeconds = Math.round(uptimeMs / 1e3);
  let searxng;
  if (input.backendStatus === null) {
    searxng = "not_initialized";
  } else if (input.backendStatus.isActive) {
    searxng = "active";
  } else {
    searxng = "unavailable";
  }
  const browsers = input.browserPool ? "ready" : "not_initialized";
  const cache = "active";
  let status;
  if (searxng === "active" && browsers === "ready") {
    status = "healthy";
  } else if (browsers === "not_initialized" && searxng !== "active") {
    status = "down";
  } else {
    status = "degraded";
  }
  return {
    status,
    searxng,
    browsers,
    cache,
    uptime_seconds: uptimeSeconds
  };
}
export {
  probeHealth
};
//# sourceMappingURL=health-check.js.map