import { useCronType, ScheduleTypeSelector, TimeSelector, DayChips, MonthDayGrid, CustomInput, SchedulePreview, CronSchedulerProvider } from './chunk-PVAX67JG.mjs';
import { __name } from './chunk-N2XQF2OL.mjs';
import { cn } from '@djangocfg/ui-core/lib';
import { jsxs, jsx } from 'react/jsx-runtime';

function CronSchedulerInner({
  showPreview,
  showCronExpression,
  allowCopy,
  timeFormat,
  disabled,
  className
}) {
  const { type } = useCronType();
  return /* @__PURE__ */ jsxs("div", { className: cn("space-y-3", className), children: [
    /* @__PURE__ */ jsx(ScheduleTypeSelector, { disabled }),
    type !== "custom" && /* @__PURE__ */ jsx(TimeSelector, { format: timeFormat, disabled }),
    type === "weekly" && /* @__PURE__ */ jsx(DayChips, { disabled, showPresets: true }),
    type === "monthly" && /* @__PURE__ */ jsx(MonthDayGrid, { disabled, showPresets: true }),
    type === "custom" && /* @__PURE__ */ jsx(CustomInput, { disabled }),
    showPreview && /* @__PURE__ */ jsx(
      SchedulePreview,
      {
        showCronExpression: true,
        allowCopy
      }
    )
  ] });
}
__name(CronSchedulerInner, "CronSchedulerInner");
function CronScheduler({
  value,
  onChange,
  defaultType = "daily",
  showPreview = true,
  showCronExpression = false,
  allowCopy = false,
  timeFormat = "24h",
  disabled = false,
  className
}) {
  return /* @__PURE__ */ jsx(
    CronSchedulerProvider,
    {
      value,
      onChange,
      defaultType,
      children: /* @__PURE__ */ jsx(
        CronSchedulerInner,
        {
          showPreview,
          showCronExpression,
          allowCopy,
          timeFormat,
          disabled,
          className
        }
      )
    }
  );
}
__name(CronScheduler, "CronScheduler");
var CronScheduler_client_default = CronScheduler;

export { CronScheduler, CronScheduler_client_default as default };
//# sourceMappingURL=CronScheduler.client-DLMXCPAJ.mjs.map
//# sourceMappingURL=CronScheduler.client-DLMXCPAJ.mjs.map