import { isValidDateRangePreset } from "@open-mercato/ui/backend/date-range";
const DEFAULT_SETTINGS = {
  dateRange: "this_month",
  limit: 10,
  layout: "horizontal"
};
function hydrateSettings(raw) {
  if (!raw || typeof raw !== "object") return { ...DEFAULT_SETTINGS };
  const obj = raw;
  const parsedLimit = Number(obj.limit);
  const layout = obj.layout === "vertical" ? "vertical" : "horizontal";
  return {
    dateRange: isValidDateRangePreset(obj.dateRange) ? obj.dateRange : DEFAULT_SETTINGS.dateRange,
    limit: Number.isFinite(parsedLimit) && parsedLimit >= 1 && parsedLimit <= 20 ? Math.floor(parsedLimit) : DEFAULT_SETTINGS.limit,
    layout
  };
}
export {
  DEFAULT_SETTINGS,
  hydrateSettings
};
//# sourceMappingURL=config.js.map
