const rangeSelectorTypes = [
  { id: "custom", value: "custom", label: "Custom" },
  { id: "last7Days", value: "last7Days", label: "Last 7 Days" },
  { id: "week", value: "week", label: "Week" },
  { id: "month", value: "month", label: "Month" },
  { id: "quarter", value: "quarter", label: "Quarter" },
  { id: "year", value: "year", label: "Year" }
];
function setStartDateOffset(selectedRange, day) {
  switch (selectedRange) {
    case "last7Days":
      return day.clone().subtract(7, "days");
    case "week":
      return day.clone().startOf("week");
    case "month":
      return day.clone().startOf("month");
    case "quarter":
      return day.clone().startOf("quarter");
    case "year":
      return day.clone().startOf("year");
    default:
      return day.clone();
  }
}
function setEndDateOffset(selectedRange, day) {
  switch (selectedRange) {
    case "last7Days":
      return day.clone();
    case "week":
      return day.clone().endOf("week");
    case "month":
      return day.clone().endOf("month");
    case "quarter":
      return day.clone().endOf("quarter");
    case "year":
      return day.clone().endOf("year");
    default:
      return day.clone();
  }
}
function calculatePosition({
  containerRef,
  setCustomPosition,
  showRangeSelector
}) {
  var _a;
  const containerPos = (_a = containerRef.current) == null ? void 0 : _a.getBoundingClientRect();
  if (!containerPos) return;
  const { x } = containerPos;
  const innerWidth = typeof window !== "undefined" ? window.innerWidth : 0;
  const threshold = showRangeSelector ? 550 : 450;
  const availableSpace = innerWidth - x - 20;
  if (availableSpace < threshold) {
    setCustomPosition({ left: "auto", right: 0 });
  }
}
function formatMomentDate(date, dateFormat = "YYYY-MM-DD") {
  return (date == null ? void 0 : date.format(dateFormat)) ?? "";
}
export {
  calculatePosition,
  formatMomentDate,
  rangeSelectorTypes,
  setEndDateOffset,
  setStartDateOffset
};
