"use client";
import { jsx as f } from "react/jsx-runtime";
import i from "../../../../../../../../_virtual/dayjs.min.js";
import { useContext as d, useMemo as n } from "react";
import { GanttContext as D } from "../../../../Gantt/GanttContext.js";
import l from "../RepeteadBars/RepeteadBars.js";
import I from "../BarItem/BarItem.js";
const C = ({
  data: e,
  title: s,
  barKey: o,
  leftRender: x,
  onBarDoubleClick: a
}) => {
  const { scaleDates: t, scaleRenderState: r } = d(D), m = n(() => t[r.overscanStartIndex], [t, r.overscanStartIndex]), u = n(() => t[r.overscanStopIndex], [t, r.overscanStopIndex]), p = n(() => i(e?.startDate).unix(), [e?.startDate]), c = n(() => i(e?.endDate).unix(), [e?.endDate]);
  return e ? e.repeatType ? /* @__PURE__ */ f(
    l,
    {
      data: e,
      firstRenderedDate: m,
      lastRenderedDate: u,
      title: s,
      barKey: o,
      onBarDoubleClick: a
    }
  ) : p > u || c < m ? null : /* @__PURE__ */ f(
    I,
    {
      title: s,
      barKey: o,
      startDate: p,
      endDate: c,
      repetead: !1,
      leftRender: x,
      onBarDoubleClick: a
    },
    e.startDate
  ) : null;
};
export {
  C as default
};
