'use strict';

require('../../../utils/index.js');
var runtime = require('../../../utils/props/runtime.js');

"use strict";
const calendarEventTextSizes = ["sm", "md", "lg"];
const calendarWeekdayFormats = ["min", "short", "long"];
const calendarWeekStartDays = [0, 1];
const calendarWeekColumnDateFormats = [
  "M/D",
  "M\u6708D\u65E5",
  "D\u65E5",
  "D"
];
const calendarFirstDayFormats = [
  "monthDay",
  "dayMonth",
  "chineseDate"
];
const calendarDayTitleFormats = [
  "YYYY-MM-DD",
  "YYYY/MM/DD",
  "YYYY\u5E74M\u6708D\u65E5",
  "YYYY\u5E74MM\u6708DD\u65E5",
  "M\u6708D\u65E5 dddd",
  "MM/DD ddd",
  "DD/MM/YYYY",
  "ddd, MMM D, YYYY",
  "dddd, MMMM D"
];
const calendarMonthTitleFormats = [
  "YYYY-MM",
  "YYYY\u5E74M\u6708",
  "M\u6708"
];
const calendarWeekTitleFormats = [
  "YYYY \u7B2CW\u5468",
  "YYYY\u5E74 \u7B2CW\u5468",
  "\u7B2CW\u5468",
  "W\u5468",
  "YYYY/W",
  "W/YYYY",
  "MM/DD - MM/DD",
  "YYYY/MM/DD - MM/DD",
  "YYYY\u5E74M\u6708D\u65E5-D\u65E5",
  "YYYY\u5E74M\u6708D\u65E5 - M\u6708D\u65E5",
  "Week W, YYYY",
  "YYYY-MM-DD / DD"
];
const defaultCalendarFieldComponents = {
  LlTag: "ll-tag",
  LlAvatar: "ll-avatar",
  LlButton: "ll-button",
  LlImage: "ll-image",
  LlSpace: "ll-space",
  LlTooltip: "ll-tooltip"
};
const calendarProps = runtime.buildProps({
  modelValue: {
    type: runtime.definePropType(Array),
    default: () => []
  },
  view: {
    type: runtime.definePropType(String),
    default: "month"
  },
  currentDate: {
    type: runtime.definePropType([String, Date]),
    default: void 0
  },
  editableEvents: {
    type: runtime.definePropType(Object),
    default: () => ({})
  },
  selectable: {
    type: Boolean,
    default: true
  },
  readonly: {
    type: Boolean,
    default: false
  },
  disableCreateInPast: {
    type: Boolean,
    default: false
  },
  clickOutOfMonthJump: {
    type: Boolean,
    default: false
  },
  allDaySlot: {
    type: Boolean,
    default: false
  },
  nowIndicator: {
    type: Boolean,
    default: true
  },
  timeSlotFormat: {
    type: String,
    default: "HH:mm"
  },
  dayMaxEvents: {
    type: runtime.definePropType([Boolean, Number]),
    default: true
  },
  eventsOnMonthView: {
    type: runtime.definePropType([Boolean, String]),
    default: true
  },
  height: {
    type: runtime.definePropType([String, Number]),
    default: "auto"
  },
  slotMinTime: {
    type: String,
    default: "00:00:00"
  },
  slotMaxTime: {
    type: String,
    default: "24:00:00"
  },
  slotDuration: {
    type: String,
    default: "00:15:00"
  },
  timeCellHeight: {
    type: Number,
    default: 190
  },
  autoScrollToNow: {
    type: Boolean,
    default: true
  },
  autoScrollOnlyToday: {
    type: Boolean,
    default: true
  },
  eventTitleKey: {
    type: String,
    default: "title"
  },
  eventDescriptionKey: {
    type: String,
    default: "content"
  },
  eventImageKey: {
    type: String,
    default: ""
  },
  eventMetaFields: {
    type: runtime.definePropType(Array),
    default: () => []
  },
  eventDisplayFields: {
    type: runtime.definePropType(Array),
    default: () => []
  },
  components: {
    type: runtime.definePropType(Object),
    default: () => ({})
  },
  eventMaxMetaCount: {
    type: Number,
    default: 2
  },
  eventTextSize: {
    type: runtime.definePropType(String),
    default: "md",
    values: calendarEventTextSizes
  },
  weekdayFormat: {
    type: runtime.definePropType(String),
    default: "long",
    values: calendarWeekdayFormats
  },
  weekStartDay: {
    type: runtime.definePropType(Number),
    default: 0,
    values: calendarWeekStartDays
  },
  weekColumnDateFormat: {
    type: runtime.definePropType(String),
    default: "D",
    values: calendarWeekColumnDateFormats
  },
  firstDayFormat: {
    type: runtime.definePropType(String),
    default: "chineseDate"
  },
  monthTitleFormat: {
    type: runtime.definePropType(String),
    default: "YYYY-MM"
  },
  weekTitleFormat: {
    type: runtime.definePropType(String),
    default: "YYYY \u7B2CW\u5468"
  },
  dayTitleFormat: {
    type: runtime.definePropType(String),
    default: "YYYY-MM-DD"
  },
  showLunar: {
    type: Boolean,
    default: false
  },
  /**
   * 日期组配置：将一条原始记录展开为多条派生日程（如「计划」「实际」）。
   * 为空数组时功能关闭，组件按常规事件渲染 modelValue。
   */
  dateGroups: {
    type: runtime.definePropType(Array),
    default: () => []
  },
  /**
   * 派生事件标题模板，支持 `{字段名}` 占位符（如 `{name}-{stage}`）。
   * 为空时回退到原始记录的 title。
   */
  dateGroupTitleFormat: {
    type: String,
    default: ""
  }
});
function formatCalendarDateTime(value) {
  const year = value.getFullYear();
  const month = String(value.getMonth() + 1).padStart(2, "0");
  const day = String(value.getDate()).padStart(2, "0");
  const hours = String(value.getHours()).padStart(2, "0");
  const minutes = String(value.getMinutes()).padStart(2, "0");
  const seconds = String(value.getSeconds()).padStart(2, "0");
  return `${year}-${month}-${day}T${hours}:${minutes}:${seconds}`;
}
function normalizeCalendarEvent(event) {
  const normalized = { ...event };
  if (normalized.start instanceof Date) {
    normalized.start = formatCalendarDateTime(normalized.start);
  }
  if (normalized.end instanceof Date) {
    normalized.end = formatCalendarDateTime(normalized.end);
  }
  return normalized;
}
function normalizeCalendarEvents(events) {
  return (events ?? []).map(normalizeCalendarEvent);
}
const titleEnum = {
  day: "\u65E5",
  week: "\u5468",
  month: "\u6708"
};

exports.calendarDayTitleFormats = calendarDayTitleFormats;
exports.calendarEventTextSizes = calendarEventTextSizes;
exports.calendarFirstDayFormats = calendarFirstDayFormats;
exports.calendarMonthTitleFormats = calendarMonthTitleFormats;
exports.calendarProps = calendarProps;
exports.calendarWeekColumnDateFormats = calendarWeekColumnDateFormats;
exports.calendarWeekStartDays = calendarWeekStartDays;
exports.calendarWeekTitleFormats = calendarWeekTitleFormats;
exports.calendarWeekdayFormats = calendarWeekdayFormats;
exports.defaultCalendarFieldComponents = defaultCalendarFieldComponents;
exports.normalizeCalendarEvent = normalizeCalendarEvent;
exports.normalizeCalendarEvents = normalizeCalendarEvents;
exports.titleEnum = titleEnum;
//# sourceMappingURL=calendar.js.map
