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sourcesContent":["/*\n * Copyright 2026 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {CalendarSelectionMode, CalendarState} from 'react-stately/useCalendarState';\nimport {DateDuration} from '@internationalized/date';\nimport {RangeCalendarState} from 'react-stately/useRangeCalendarState';\nimport {useDateFormatter} from '../i18n/useDateFormatter';\nimport {useMemo} from 'react';\n\nexport interface CalendarHeadingFormatOptions {\n  day?: 'numeric' | '2-digit';\n  month?: 'numeric' | '2-digit' | 'long' | 'short' | 'narrow';\n  year?: 'numeric' | '2-digit';\n  era?: 'long' | 'short' | 'narrow';\n}\n\nexport interface CalendarHeadingProps {\n  /**\n   * The number of months from the start of the visible range to display.\n   *\n   * @default 0\n   */\n  offset?: DateDuration;\n  /**\n   * The format of the month heading.\n   */\n  format?: CalendarHeadingFormatOptions;\n}\n\nexport function useCalendarHeading(\n  props: CalendarHeadingProps,\n  state: CalendarState<CalendarSelectionMode> | RangeCalendarState\n): string {\n  let startDate = useMemo(() => {\n    let currentMonth = state.visibleRange.start;\n    if (props.offset) {\n      currentMonth = currentMonth.add(props.offset);\n    }\n    return currentMonth;\n  }, [state.visibleRange.start, props.offset]);\n\n  let isDays = state.visibleDuration.days || state.visibleDuration.weeks;\n  let formatter = useDateFormatter({\n    day: props.format?.day || (isDays ? 'numeric' : undefined),\n    month: props.format?.month || 'long',\n    year: props.format?.year || 'numeric',\n    era:\n      props.format?.era ||\n      (startDate && startDate.calendar.identifier === 'gregory' && startDate.era === 'BC')\n        ? 'short'\n        : undefined,\n    calendar: state.visibleRange?.start.calendar.identifier,\n    timeZone: state.timeZone\n  });\n\n  return useMemo(() => {\n    if (isDays) {\n      return formatter.formatRange(\n        startDate.toDate(state.timeZone),\n        state.visibleRange.end.toDate(state.timeZone)\n      );\n    }\n\n    // Custom calendars like the 4-5-4 fiscal calendar use getFormattableMonth to map\n    // their internal month back to the Gregorian month that should be displayed.\n    let displayDate = startDate.calendar.getFormattableMonth\n      ? startDate.calendar.getFormattableMonth(startDate)\n      : startDate;\n    return formatter.format(displayDate.toDate(state.timeZone));\n  }, [formatter, isDays, startDate, state.timeZone, state.visibleRange.end]);\n}\n"],"names":[],"version":3,"file":"useCalendarHeading.mjs.map"}