var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// src/components/pisellRecordBoard/shellFrame/Calendar/view/resource/useBookingCalendarResourceDayHeaderRemaining.ts
var useBookingCalendarResourceDayHeaderRemaining_exports = {};
__export(useBookingCalendarResourceDayHeaderRemaining_exports, {
  useBookingCalendarResourceDayHeaderRemaining: () => useBookingCalendarResourceDayHeaderRemaining
});
module.exports = __toCommonJS(useBookingCalendarResourceDayHeaderRemaining_exports);
var import_react = require("react");
var import_bookingCalendarDateUtils = require("../../utils/bookingCalendarDateUtils");
function useBookingCalendarResourceDayHeaderRemaining(resourceMonthDays, visibleCourts, bookings, hourSlots, slotStepHours) {
  return (0, import_react.useMemo)(() => {
    const total = visibleCourts.length;
    const map = {};
    for (const d of resourceMonthDays) {
      const dateKey = (0, import_bookingCalendarDateUtils.fmtDate)(d);
      const remaining = visibleCourts.filter(
        (court) => hourSlots.some((hour) => {
          if (!(0, import_bookingCalendarDateUtils.isHourInTimelineSlots)(hour, hourSlots)) return false;
          return !(0, import_bookingCalendarDateUtils.dayOccupancy)(
            court.id,
            dateKey,
            bookings,
            hourSlots,
            slotStepHours
          )[hour];
        })
      ).length;
      map[dateKey] = {
        remaining,
        total,
        ratio: total > 0 ? remaining / total : 0
      };
    }
    return map;
  }, [
    resourceMonthDays,
    visibleCourts,
    bookings,
    hourSlots,
    slotStepHours
  ]);
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  useBookingCalendarResourceDayHeaderRemaining
});
