{"version":3,"sources":["../src/components/Calendar.tsx","../src/components/CalendarItemDay.tsx","../../../node_modules/mitt/src/index.ts","../src/hooks/useOptimizedDayMetadata.ts","../src/hooks/useCalendar.ts","../src/helpers/dates.ts","../src/helpers/numbers.ts","../src/hooks/useTheme.ts","../src/helpers/tokens.ts","../src/components/CalendarThemeProvider.tsx","../src/components/CalendarItemEmpty.tsx","../src/components/CalendarItemWeekName.tsx","../src/components/CalendarRowMonth.tsx","../src/components/CalendarRowWeek.tsx","../src/components/HStack.tsx","../src/components/VStack.tsx","../src/helpers/strings.ts","../src/components/CalendarList.tsx","../src/hooks/useCalendarList.tsx","../src/helpers/functions.ts","../src/components/index.ts","../src/hooks/useDateRange.ts"],"sourcesContent":["import { memo, useEffect } from \"react\";\nimport type { ColorSchemeName, PressableProps } from \"react-native\";\n\nimport type {\n  CalendarItemDayContainerProps,\n  CalendarItemDayProps,\n} from \"@/components/CalendarItemDay\";\nimport {\n  CalendarItemDayContainer,\n  CalendarItemDayWithContainer,\n} from \"@/components/CalendarItemDay\";\nimport type { CalendarItemEmptyProps } from \"@/components/CalendarItemEmpty\";\nimport { CalendarItemEmpty } from \"@/components/CalendarItemEmpty\";\nimport type { CalendarItemWeekNameProps } from \"@/components/CalendarItemWeekName\";\nimport { CalendarItemWeekName } from \"@/components/CalendarItemWeekName\";\nimport type { CalendarRowMonthProps } from \"@/components/CalendarRowMonth\";\nimport { CalendarRowMonth } from \"@/components/CalendarRowMonth\";\nimport type { CalendarRowWeekProps } from \"@/components/CalendarRowWeek\";\nimport { CalendarRowWeek } from \"@/components/CalendarRowWeek\";\nimport { VStack } from \"@/components/VStack\";\nimport { uppercaseFirstLetter } from \"@/helpers/strings\";\nimport type { BaseTheme } from \"@/helpers/tokens\";\nimport type { UseCalendarParams } from \"@/hooks/useCalendar\";\nimport { useCalendar } from \"@/hooks/useCalendar\";\nimport { activeDateRangesEmitter } from \"@/hooks/useOptimizedDayMetadata\";\nimport { CalendarThemeProvider } from \"@/components/CalendarThemeProvider\";\n\nexport type PressableLike = React.ComponentType<\n  Pick<PressableProps, \"children\" | \"style\" | \"disabled\"> & {\n    onPress: () => void;\n  }\n>;\n\nexport interface CalendarTheme {\n  rowMonth?: CalendarRowMonthProps[\"theme\"];\n  rowWeek?: CalendarRowWeekProps[\"theme\"];\n  itemWeekName?: CalendarItemWeekNameProps[\"theme\"];\n  itemEmpty?: CalendarItemEmptyProps[\"theme\"];\n  itemDayContainer?: CalendarItemDayContainerProps[\"theme\"];\n  /**\n   * The theme for the day. `base` is applied before any state, allowing you to\n   * set a base value once and use it for all states.\n   */\n  itemDay?: CalendarItemDayProps[\"theme\"];\n}\n\nexport type CalendarOnDayPress = (dateId: string) => void;\n\nexport interface CalendarProps extends UseCalendarParams {\n  /**\n   * A unique identifier for this calendar instance. This is useful if you\n   * need to render more than one calendar at once. This allows Flash Calendar\n   * to scope its state to the given instance.\n   *\n   * No need to get fancy with `uuid` or anything like that - a simple static\n   * string is enough.\n   *\n   * If not provided, Flash Calendar will use a default value which will hoist\n   * the state in a global scope.\n   */\n  calendarInstanceId?: string;\n  /**\n   * The spacing between each calendar row (the month header, the week days row,\n   * and the weeks row)\n   * @defaultValue 8\n   */\n  calendarRowVerticalSpacing?: number;\n  /**\n   * The spacing between each day in the weeks row.\n   * @defaultValue 8\n   */\n  calendarRowHorizontalSpacing?: number;\n  /**\n   * The height of each day cell.\n   * @defaultValue 32\n   */\n  calendarDayHeight?: number;\n  /**\n   * The height of the week day's header.\n   * @defaultValue calendarDayHeight\n   */\n  calendarWeekHeaderHeight?: number;\n  /**\n   * The height of the month header.\n   * @defaultValue 20\n   */\n  calendarMonthHeaderHeight?: number;\n  /**\n   * When set, Flash Calendar will use this color scheme instead of the system's\n   * value (`light|dark`). This is useful if your app doesn't support dark-mode,\n   * for example.\n   *\n   * We don't advise using this prop - ideally, your app should reflect the\n   * user's preferences.\n   * @defaultValue undefined\n   */\n  calendarColorScheme?: ColorSchemeName;\n  /**\n   * The callback to be called when a day is pressed.\n   */\n  onCalendarDayPress: CalendarOnDayPress;\n  /** Theme to customize the calendar component. */\n  theme?: CalendarTheme;\n  /** Optional component to replace the default <Pressable> component. */\n  CalendarPressableComponent?: PressableLike;\n}\n\nconst BaseCalendar = memo(function BaseCalendar(props: CalendarProps) {\n  const {\n    calendarInstanceId,\n    calendarRowVerticalSpacing = 8,\n    calendarRowHorizontalSpacing = 8,\n    calendarDayHeight = 32,\n    calendarMonthHeaderHeight = 20,\n    calendarWeekHeaderHeight = calendarDayHeight,\n    onCalendarDayPress,\n    theme,\n    CalendarPressableComponent,\n    ...buildCalendarParams\n  } = props;\n\n  const { calendarRowMonth, weeksList, weekDaysList } =\n    useCalendar(buildCalendarParams);\n\n  return (\n    <VStack\n      alignItems=\"center\"\n      spacing={calendarRowVerticalSpacing as keyof BaseTheme[\"spacing\"]}\n    >\n      <CalendarRowMonth\n        height={calendarMonthHeaderHeight}\n        theme={theme?.rowMonth}\n      >\n        {uppercaseFirstLetter(calendarRowMonth)}\n      </CalendarRowMonth>\n      <CalendarRowWeek spacing={8} theme={theme?.rowWeek}>\n        {weekDaysList.map((weekDay, i) => (\n          <CalendarItemWeekName\n            height={calendarWeekHeaderHeight}\n            key={i}\n            theme={theme?.itemWeekName}\n          >\n            {weekDay}\n          </CalendarItemWeekName>\n        ))}\n      </CalendarRowWeek>\n      {weeksList.map((week, index) => (\n        <CalendarRowWeek key={index}>\n          {week.map((dayProps) => {\n            if (dayProps.isDifferentMonth) {\n              return (\n                <CalendarItemDayContainer\n                  dayHeight={calendarDayHeight}\n                  daySpacing={calendarRowHorizontalSpacing}\n                  isStartOfWeek={dayProps.isStartOfWeek}\n                  key={dayProps.id}\n                  metadata={dayProps}\n                  theme={theme?.itemDayContainer}\n                >\n                  <CalendarItemEmpty\n                    height={calendarDayHeight}\n                    theme={theme?.itemEmpty}\n                  />\n                </CalendarItemDayContainer>\n              );\n            }\n\n            return (\n              <CalendarItemDayWithContainer\n                CalendarPressableComponent={CalendarPressableComponent}\n                calendarInstanceId={calendarInstanceId}\n                containerTheme={theme?.itemDayContainer}\n                dayHeight={calendarDayHeight}\n                daySpacing={calendarRowHorizontalSpacing}\n                key={dayProps.id}\n                metadata={dayProps}\n                onPress={onCalendarDayPress}\n                theme={theme?.itemDay}\n              >\n                {dayProps.displayLabel}\n              </CalendarItemDayWithContainer>\n            );\n          })}\n        </CalendarRowWeek>\n      ))}\n    </VStack>\n  );\n});\n\nexport const Calendar = memo(function Calendar(props: CalendarProps) {\n  const {\n    calendarInstanceId,\n    calendarActiveDateRanges,\n    calendarMonthId,\n    calendarColorScheme,\n    ...otherProps\n  } = props;\n  useEffect(() => {\n    activeDateRangesEmitter.emit(\"onSetActiveDateRanges\", {\n      instanceId: calendarInstanceId,\n      ranges: calendarActiveDateRanges ?? [],\n    });\n    /**\n     * While `calendarMonthId` is not used by the effect, we still need it in\n     * the dependency array since [FlashList uses recycling\n     * internally](https://shopify.github.io/flash-list/docs/recycling).\n     *\n     * This means `Calendar` can re-render with different props instead of\n     * getting re-mounted. Without it, we would see staled/invalid data, as\n     * reported by\n     * [#11](https://github.com/MarceloPrado/flash-calendar/issues/11).\n     */\n  }, [calendarActiveDateRanges, calendarInstanceId, calendarMonthId]);\n\n  return (\n    <CalendarThemeProvider colorScheme={calendarColorScheme}>\n      <BaseCalendar\n        {...otherProps}\n        calendarInstanceId={calendarInstanceId}\n        calendarMonthId={calendarMonthId}\n      />\n    </CalendarThemeProvider>\n  );\n});\n","import type { ReactNode } from \"react\";\nimport { useCallback, useMemo } from \"react\";\nimport type { TextProps, TextStyle, ViewStyle } from \"react-native\";\nimport { Pressable, StyleSheet, Text, View } from \"react-native\";\n\nimport type { BaseTheme } from \"@/helpers/tokens\";\nimport type { CalendarDayMetadata } from \"@/hooks/useCalendar\";\nimport { useOptimizedDayMetadata } from \"@/hooks/useOptimizedDayMetadata\";\nimport { useTheme } from \"@/hooks/useTheme\";\n\nimport type { PressableLike } from \"./Calendar\";\n\n// react-native-web/overrides.ts\ndeclare module \"react-native\" {\n  interface PressableStateCallbackType {\n    hovered?: boolean;\n    focused?: boolean;\n  }\n}\n\nconst styles = StyleSheet.create({\n  baseContainer: {\n    padding: 6,\n    alignItems: \"center\",\n    justifyContent: \"center\",\n    borderRadius: 16,\n    flex: 1,\n  },\n  baseContent: {\n    textAlign: \"center\",\n  },\n});\n\nexport type DayState = \"idle\" | \"active\" | \"today\" | \"disabled\";\n\ninterface DayTheme {\n  container: Omit<ViewStyle, \"borderRadius\">;\n  content: TextStyle;\n}\ntype CalendarItemDayTheme = Record<\n  DayState,\n  (params: {\n    isStartOfRange: boolean;\n    isEndOfRange: boolean;\n    isPressed: boolean;\n    isHovered?: boolean;\n    isFocused?: boolean;\n  }) => DayTheme\n>;\n\nconst buildBaseStyles = (theme: BaseTheme): CalendarItemDayTheme => {\n  const baseContent = {\n    ...styles.baseContent,\n    color: theme.colors.content.primary,\n  };\n\n  return {\n    active: ({ isPressed, isHovered, isStartOfRange, isEndOfRange }) => {\n      const baseStyles: DayTheme & { container: ViewStyle } =\n        isPressed || isHovered\n          ? {\n              container: {\n                ...styles.baseContainer,\n                backgroundColor: theme.colors.background.tertiary,\n              },\n              content: {\n                ...baseContent,\n                color: theme.colors.content.primary,\n              },\n            }\n          : {\n              container: {\n                ...styles.baseContainer,\n                backgroundColor: theme.colors.background.inverse.primary,\n              },\n              content: {\n                ...baseContent,\n                color: theme.colors.content.inverse.primary,\n              },\n            };\n\n      baseStyles.container.borderRadius = 0;\n      if (isStartOfRange) {\n        baseStyles.container.borderTopLeftRadius = 16;\n        baseStyles.container.borderBottomLeftRadius = 16;\n      }\n      if (isEndOfRange) {\n        baseStyles.container.borderTopRightRadius = 16;\n        baseStyles.container.borderBottomRightRadius = 16;\n      }\n      if (!isStartOfRange && !isEndOfRange) {\n        baseStyles.container.borderRadius = 0;\n      }\n      return baseStyles;\n    },\n    disabled: () => ({\n      container: styles.baseContainer,\n      content: {\n        ...baseContent,\n        color: theme.colors.content.disabled,\n      },\n    }),\n    idle: ({ isPressed, isHovered }) => {\n      return isPressed || isHovered\n        ? {\n            container: {\n              ...styles.baseContainer,\n              backgroundColor: theme.colors.background.tertiary,\n            },\n            content: {\n              ...baseContent,\n              color: theme.colors.content.primary,\n            },\n          }\n        : {\n            container: styles.baseContainer,\n            content: baseContent,\n          };\n    },\n    today: ({ isPressed, isHovered }) => {\n      return isPressed || isHovered\n        ? {\n            container: {\n              ...styles.baseContainer,\n              backgroundColor: theme.colors.background.tertiaryPressed,\n            },\n            content: baseContent,\n          }\n        : {\n            container: {\n              ...styles.baseContainer,\n              borderColor: theme.colors.borders.default,\n              borderStyle: \"solid\",\n              borderWidth: 1,\n            },\n            content: baseContent,\n          };\n    },\n  };\n};\n\nexport interface CalendarItemDayProps {\n  children: ReactNode;\n  onPress: (id: string) => void;\n  metadata: CalendarDayMetadata;\n  theme?: Partial<\n    Record<\n      DayState | \"base\",\n      (\n        params: CalendarDayMetadata & {\n          isPressed: boolean;\n          isHovered?: boolean;\n          isFocused?: boolean;\n        }\n      ) => Partial<DayTheme>\n    >\n  >;\n  /** The cell's height */\n  height: number;\n  /** Optional TextProps to spread to the <Text> component. */\n  textProps?: Omit<TextProps, \"children\" | \"onPress\">;\n  /** Optional component to replace the default <Pressable> component. */\n  CalendarPressableComponent?: PressableLike;\n}\n\n/**\n * The base calendar item day component. This component is responsible for\n * rendering each day cell, along with its event handlers.\n *\n * This is not meant to be used directly. Instead, use the\n * `CalendarItemDayWithContainer`, since it also includes the spacing between\n * each day.\n */\nexport const CalendarItemDay = ({\n  onPress,\n  children,\n  theme,\n  height,\n  metadata,\n  textProps,\n  CalendarPressableComponent = Pressable as PressableLike,\n}: CalendarItemDayProps) => {\n  const baseTheme = useTheme();\n  const baseStyles = useMemo(() => {\n    return buildBaseStyles(baseTheme);\n  }, [baseTheme]);\n\n  const handlePress = useCallback(() => {\n    onPress(metadata.id);\n  }, [metadata.id, onPress]);\n\n  return (\n    <CalendarPressableComponent\n      disabled={metadata.state === \"disabled\"}\n      onPress={handlePress}\n      style={({\n        pressed: isPressed,\n        hovered: isHovered,\n        focused: isFocused,\n      }) => {\n        const params = {\n          isPressed,\n          isHovered,\n          isFocused,\n          isEndOfRange: metadata.isEndOfRange ?? false,\n          isStartOfRange: metadata.isStartOfRange ?? false,\n        };\n        const { container } = baseStyles[metadata.state](params);\n        return {\n          ...container,\n          height,\n          ...theme?.base?.({ ...metadata, isPressed }).container,\n          ...theme?.[metadata.state]?.({ ...metadata, isPressed }).container,\n        };\n      }}\n    >\n      {({ pressed: isPressed, hovered: isHovered, focused: isFocused }) => {\n        const params = {\n          isPressed,\n          isHovered,\n          isFocused,\n          isEndOfRange: metadata.isEndOfRange ?? false,\n          isStartOfRange: metadata.isStartOfRange ?? false,\n        };\n        const { content } = baseStyles[metadata.state](params);\n        return (\n          <Text\n            {...textProps}\n            style={{\n              ...content,\n              ...(textProps?.style ?? ({} as object)),\n              ...theme?.base?.({ ...metadata, isPressed, isHovered, isFocused })\n                .content,\n              ...theme?.[metadata.state]?.({\n                ...metadata,\n                isPressed,\n                isHovered,\n                isFocused,\n              }).content,\n            }}\n          >\n            {children}\n          </Text>\n        );\n      }}\n    </CalendarPressableComponent>\n  );\n};\n\ninterface CalendarItemDayContainerTheme {\n  /** An empty view that acts as a spacer between each day. The spacing is\n   * controlled by the `daySpacing` prop. */\n  spacer?: ViewStyle;\n  /** An absolute positioned filler to join the active days together in a single\n   * complete range. */\n  activeDayFiller?: ViewStyle | ((params: CalendarDayMetadata) => ViewStyle);\n}\n\nexport interface CalendarItemDayContainerProps {\n  children: ReactNode;\n  isStartOfWeek: boolean;\n  /**\n   * If true, the active day filler/extension will be shown. The filler is used\n   * as a visual effect to join the active days together in a complete range.\n   */\n  shouldShowActiveDayFiller?: boolean;\n  theme?: CalendarItemDayContainerTheme;\n  /**\n   * The spacing between each day\n   */\n  daySpacing: number;\n  /** The day's height */\n  dayHeight: number;\n  /** The metadata for the day, extracted from the calendar's state. */\n  metadata?: CalendarDayMetadata;\n}\n\nexport const CalendarItemDayContainer = ({\n  children,\n  isStartOfWeek,\n  shouldShowActiveDayFiller,\n  theme,\n  daySpacing,\n  dayHeight,\n  metadata,\n}: CalendarItemDayContainerProps) => {\n  const baseTheme = useTheme();\n  const spacerStyles = useMemo<ViewStyle>(() => {\n    return {\n      position: \"relative\",\n      marginLeft: isStartOfWeek ? 0 : daySpacing,\n      flex: 1,\n      height: dayHeight,\n      ...theme?.spacer,\n    };\n  }, [dayHeight, daySpacing, isStartOfWeek, theme?.spacer]);\n\n  const activeDayFiller = useMemo<ViewStyle | null>(() => {\n    if (!shouldShowActiveDayFiller) {\n      return null;\n    }\n\n    return {\n      position: \"absolute\",\n      top: 0,\n      bottom: 0,\n      right: -(daySpacing + 1), // +1 to cover the 1px gap\n      width: daySpacing + 2, // +2 to cover the 1px gap (distributes evenly on both sides)\n      backgroundColor: baseTheme.colors.background.inverse.primary,\n      ...(typeof theme?.activeDayFiller === \"function\" && !!metadata\n        ? theme.activeDayFiller(metadata)\n        : theme?.activeDayFiller),\n    };\n  }, [\n    baseTheme.colors.background.inverse.primary,\n    daySpacing,\n    metadata,\n    shouldShowActiveDayFiller,\n    theme,\n  ]);\n\n  return (\n    <View style={spacerStyles}>\n      {children}\n      {activeDayFiller ? <View style={activeDayFiller} /> : null}\n    </View>\n  );\n};\n\nexport interface CalendarItemDayWithContainerProps\n  extends Omit<CalendarItemDayProps, \"height\">,\n    Pick<CalendarItemDayContainerProps, \"daySpacing\" | \"dayHeight\"> {\n  containerTheme?: CalendarItemDayContainerTheme;\n  /**\n   * A unique identifier for this calendar instance. This is useful if you\n   * need to render more than one calendar at once. This allows Flash Calendar\n   * to scope its state to the given instance.\n   *\n   * No need to get fancy with `uuid` or anything like that - a simple static\n   * string is enough.\n   *\n   * If not provided, Flash Calendar will use a default value which will hoist\n   * the state in a global scope.\n   */\n  calendarInstanceId?: string;\n}\n\nexport const CalendarItemDayWithContainer = ({\n  children,\n  metadata: baseMetadata,\n  onPress,\n  theme,\n  dayHeight,\n  daySpacing,\n  containerTheme,\n  calendarInstanceId,\n  CalendarPressableComponent,\n}: CalendarItemDayWithContainerProps) => {\n  const metadata = useOptimizedDayMetadata(baseMetadata, calendarInstanceId);\n\n  return (\n    <CalendarItemDayContainer\n      dayHeight={dayHeight}\n      daySpacing={daySpacing}\n      isStartOfWeek={metadata.isStartOfWeek}\n      metadata={metadata}\n      shouldShowActiveDayFiller={\n        metadata.isRangeValid && !metadata.isEndOfWeek\n          ? !metadata.isEndOfRange\n          : false\n      }\n      theme={containerTheme}\n    >\n      <CalendarItemDay\n        CalendarPressableComponent={CalendarPressableComponent}\n        height={dayHeight}\n        metadata={metadata}\n        onPress={onPress}\n        theme={theme}\n      >\n        {children}\n      </CalendarItemDay>\n    </CalendarItemDayContainer>\n  );\n};\n","export type EventType = string | symbol;\n\n// An event handler can take an optional event argument\n// and should not return a value\nexport type Handler<T = unknown> = (event: T) => void;\nexport type WildcardHandler<T = Record<string, unknown>> = (\n\ttype: keyof T,\n\tevent: T[keyof T]\n) => void;\n\n// An array of all currently registered event handlers for a type\nexport type EventHandlerList<T = unknown> = Array<Handler<T>>;\nexport type WildCardEventHandlerList<T = Record<string, unknown>> = Array<\n\tWildcardHandler<T>\n>;\n\n// A map of event types and their corresponding event handlers.\nexport type EventHandlerMap<Events extends Record<EventType, unknown>> = Map<\n\tkeyof Events | '*',\n\tEventHandlerList<Events[keyof Events]> | WildCardEventHandlerList<Events>\n>;\n\nexport interface Emitter<Events extends Record<EventType, unknown>> {\n\tall: EventHandlerMap<Events>;\n\n\ton<Key extends keyof Events>(type: Key, handler: Handler<Events[Key]>): void;\n\ton(type: '*', handler: WildcardHandler<Events>): void;\n\n\toff<Key extends keyof Events>(\n\t\ttype: Key,\n\t\thandler?: Handler<Events[Key]>\n\t): void;\n\toff(type: '*', handler: WildcardHandler<Events>): void;\n\n\temit<Key extends keyof Events>(type: Key, event: Events[Key]): void;\n\temit<Key extends keyof Events>(\n\t\ttype: undefined extends Events[Key] ? Key : never\n\t): void;\n}\n\n/**\n * Mitt: Tiny (~200b) functional event emitter / pubsub.\n * @name mitt\n * @returns {Mitt}\n */\nexport default function mitt<Events extends Record<EventType, unknown>>(\n\tall?: EventHandlerMap<Events>\n): Emitter<Events> {\n\ttype GenericEventHandler =\n\t\t| Handler<Events[keyof Events]>\n\t\t| WildcardHandler<Events>;\n\tall = all || new Map();\n\n\treturn {\n\t\t/**\n\t\t * A Map of event names to registered handler functions.\n\t\t */\n\t\tall,\n\n\t\t/**\n\t\t * Register an event handler for the given type.\n\t\t * @param {string|symbol} type Type of event to listen for, or `'*'` for all events\n\t\t * @param {Function} handler Function to call in response to given event\n\t\t * @memberOf mitt\n\t\t */\n\t\ton<Key extends keyof Events>(type: Key, handler: GenericEventHandler) {\n\t\t\tconst handlers: Array<GenericEventHandler> | undefined = all!.get(type);\n\t\t\tif (handlers) {\n\t\t\t\thandlers.push(handler);\n\t\t\t} else {\n\t\t\t\tall!.set(type, [handler] as EventHandlerList<Events[keyof Events]>);\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Remove an event handler for the given type.\n\t\t * If `handler` is omitted, all handlers of the given type are removed.\n\t\t * @param {string|symbol} type Type of event to unregister `handler` from (`'*'` to remove a wildcard handler)\n\t\t * @param {Function} [handler] Handler function to remove\n\t\t * @memberOf mitt\n\t\t */\n\t\toff<Key extends keyof Events>(type: Key, handler?: GenericEventHandler) {\n\t\t\tconst handlers: Array<GenericEventHandler> | undefined = all!.get(type);\n\t\t\tif (handlers) {\n\t\t\t\tif (handler) {\n\t\t\t\t\thandlers.splice(handlers.indexOf(handler) >>> 0, 1);\n\t\t\t\t} else {\n\t\t\t\t\tall!.set(type, []);\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Invoke all handlers for the given type.\n\t\t * If present, `'*'` handlers are invoked after type-matched handlers.\n\t\t *\n\t\t * Note: Manually firing '*' handlers is not supported.\n\t\t *\n\t\t * @param {string|symbol} type The event type to invoke\n\t\t * @param {Any} [evt] Any value (object is recommended and powerful), passed to each handler\n\t\t * @memberOf mitt\n\t\t */\n\t\temit<Key extends keyof Events>(type: Key, evt?: Events[Key]) {\n\t\t\tlet handlers = all!.get(type);\n\t\t\tif (handlers) {\n\t\t\t\t(handlers as EventHandlerList<Events[keyof Events]>)\n\t\t\t\t\t.slice()\n\t\t\t\t\t.map((handler) => {\n\t\t\t\t\t\thandler(evt!);\n\t\t\t\t\t});\n\t\t\t}\n\n\t\t\thandlers = all!.get('*');\n\t\t\tif (handlers) {\n\t\t\t\t(handlers as WildCardEventHandlerList<Events>)\n\t\t\t\t\t.slice()\n\t\t\t\t\t.map((handler) => {\n\t\t\t\t\t\thandler(type, evt!);\n\t\t\t\t\t});\n\t\t\t}\n\t\t}\n\t};\n}\n","import mitt from \"mitt\";\nimport { useEffect, useState } from \"react\";\n\nimport {\n  getStateFields,\n  type CalendarActiveDateRange,\n  type CalendarDayMetadata,\n} from \"@/hooks/useCalendar\";\n\ninterface OnSetActiveDateRangesPayload {\n  instanceId?: string;\n  ranges: CalendarActiveDateRange[];\n}\n\n/**\n * An event emitter for the active date ranges. This notifies the calendar items\n * when their state changes, allowing just the affected items to re-render.\n *\n * While this is an implementation detail focused on improving performance, it's\n * exported in case you need to build your own calendar. Check the source code\n * for a reference implementation.\n */\nexport const activeDateRangesEmitter = mitt<{\n  onSetActiveDateRanges: OnSetActiveDateRangesPayload;\n}>();\n\n/**\n * The default calendar instance ID. This is used when no instance ID is provided.\n */\nconst DEFAULT_CALENDAR_INSTANCE_ID = \"flash-calendar-default-instance\";\n\n/**\n * Returns an optimized metadata for a particular day. This hook listens to the\n * `activeDateRanges` emitter, enabling only the affected calendar items to\n * re-render.\n *\n * While this is an implementation detail focused on improving performance, it's\n * exported in case you need to build your own calendar. Check the source code\n * for a reference implementation.\n */\nexport const useOptimizedDayMetadata = (\n  baseMetadata: CalendarDayMetadata,\n  calendarInstanceId?: string\n) => {\n  const [metadata, setMetadata] = useState(baseMetadata);\n\n  const safeCalendarInstanceId =\n    calendarInstanceId ?? DEFAULT_CALENDAR_INSTANCE_ID;\n\n  // Ensure the metadata is updated when the base changes.\n  useEffect(() => {\n    setMetadata(baseMetadata);\n  }, [baseMetadata]);\n\n  useEffect(() => {\n    const handler = (payload: OnSetActiveDateRangesPayload) => {\n      const { ranges, instanceId = DEFAULT_CALENDAR_INSTANCE_ID } = payload;\n      if (instanceId !== safeCalendarInstanceId) {\n        // This event is not for this instance, ignore it.\n        return;\n      }\n\n      // We're only interested in the active date ranges, no need to worry about\n      // disabled states. These are already covered by the base metadata.\n      const { isStartOfRange, isEndOfRange, isRangeValid, state } =\n        getStateFields({\n          id: metadata.id,\n          calendarActiveDateRanges: ranges,\n        });\n\n      if (state === \"active\") {\n        setMetadata((prev) => ({\n          ...prev,\n          isStartOfRange,\n          isEndOfRange,\n          isRangeValid,\n          state,\n        }));\n      } else {\n        // Resets the state when it's no longer active.\n        setMetadata(baseMetadata);\n      }\n    };\n\n    activeDateRangesEmitter.on(\"onSetActiveDateRanges\", handler);\n\n    return () => {\n      activeDateRangesEmitter.off(\"onSetActiveDateRanges\", handler);\n    };\n  }, [baseMetadata, safeCalendarInstanceId, metadata]);\n\n  return metadata;\n};\n","import { useMemo } from \"react\";\n\nimport type { DayState } from \"@/components/CalendarItemDay\";\nimport {\n  addDays,\n  endOfMonth,\n  fromDateId,\n  isWeekend,\n  startOfMonth,\n  startOfWeek,\n  subDays,\n  toDateId,\n} from \"@/helpers/dates\";\nimport { range } from \"@/helpers/numbers\";\n\nconst getNumberOfEmptyCellsAtStart = (\n  month: Date,\n  firstDayOfWeek: \"sunday\" | \"monday\"\n) => {\n  const startOfMonthDay = month.getDay();\n\n  if (firstDayOfWeek === \"sunday\") {\n    return startOfMonthDay;\n  }\n\n  return startOfMonthDay === 0 ? 6 : startOfMonthDay - 1;\n};\n\n/** All fields that affects the day's state. */\ninterface CalendarDayStateFields {\n  /** Is this day disabled? */\n  isDisabled: boolean;\n  /** Is this the current day? */\n  isToday: boolean;\n  /** Is this the start of a range? */\n  isStartOfRange: boolean;\n  /**  Is this the end of a range? */\n  isEndOfRange: boolean;\n  /** The state of the day */\n  state: DayState;\n  /** Is the range valid (has both start and end dates set)? */\n  isRangeValid: boolean;\n}\n\n/**\n * The type of each day in the calendar. Has a few pre-computed properties to\n * help increase re-rendering performance.\n */\nexport type CalendarDayMetadata = {\n  date: Date;\n  /** The day displayed in the desired format from `calendarDayFormat` */\n  displayLabel: string;\n  /** Does this day belong to a different month? */\n  isDifferentMonth: boolean;\n  /** Is this the last day of the month? */\n  isEndOfMonth: boolean;\n  /** Is this the last day of the week? */\n  isEndOfWeek: boolean;\n  /** Is this the first day of the month? */\n  isStartOfMonth: boolean;\n  /** Is this the first day of the week? */\n  isStartOfWeek: boolean;\n  /** Is this day part of the weekend? */\n  isWeekend: boolean;\n\n  /** The ID of this date is the `YYYY-MM-DD` representation */\n  id: string;\n} & CalendarDayStateFields;\n\n/**\n * An active date range to highlight in the calendar.\n */\nexport interface CalendarActiveDateRange {\n  startId?: string;\n  endId?: string;\n}\n\nexport interface UseCalendarParams {\n  /**\n   * The calendar's month. It can be any date within the month, since it gets\n   * normalized to the first day of the month.\n   *\n   * **Tip**: To convert to date ID, use `toDateId(date)`.\n   */\n  calendarMonthId: string;\n  /**\n   * The minimum date allowed to be selected (inclusive). Dates earlier than\n   * this will be disabled.\n   *\n   * **Tip**: To convert to date ID, use `toDateId(date)`.\n   */\n  calendarMinDateId?: string;\n  /**\n   * The maximum date allowed to be selected (inclusive). Dates later than this\n   * will be disabled.\n   *\n   * **Tip**: To convert to date ID, use `toDateId(date)`.\n   */\n  calendarMaxDateId?: string;\n\n  /**\n   * The locale to use for the date formatting. If you're using custom\n   * formatting functions, this value will be forwarded as the second argument.\n   * @defaultValue \"en-US\"\n   */\n  calendarFormatLocale?: string;\n\n  /**\n   * A custom function to override the default month format (\"January 2022\").\n   */\n  getCalendarMonthFormat?: (date: Date, locale: string) => string;\n\n  /**\n   * A custom function to override the default month format (\"S\", \"M\", \"T\").\n   */\n  getCalendarWeekDayFormat?: (date: Date, locale: string) => string;\n  /**\n   * A custom function to override the default day format (\"1\", \"9\", \"17\").\n   */\n  getCalendarDayFormat?: (date: Date, locale: string) => string;\n  /**\n   * The day of the week to start the calendar with.\n   * @defaultValue \"sunday\"\n   */\n  calendarFirstDayOfWeek?: \"sunday\" | \"monday\";\n  /**\n   * The active date ranges to highlight in the calendar.\n   */\n  calendarActiveDateRanges?: CalendarActiveDateRange[];\n  /**\n   * The disabled date IDs. Dates in this list will be in the `disabled` state\n   * unless they are part of an active range.\n   */\n  calendarDisabledDateIds?: string[];\n}\n\ntype GetStateFields = Pick<\n  UseCalendarParams,\n  | \"calendarActiveDateRanges\"\n  | \"calendarMinDateId\"\n  | \"calendarMaxDateId\"\n  | \"calendarDisabledDateIds\"\n> & {\n  todayId?: string;\n  id: string;\n};\n\n/**\n * Computes the state fields for a given date.\n */\nexport const getStateFields = ({\n  todayId,\n  id,\n  calendarActiveDateRanges,\n  calendarMinDateId,\n  calendarMaxDateId,\n  calendarDisabledDateIds,\n}: GetStateFields): CalendarDayStateFields => {\n  const activeRange = calendarActiveDateRanges?.find(({ startId, endId }) => {\n    // Regular range\n    if (startId && endId) {\n      return id >= startId && id <= endId;\n    } else if (startId) {\n      return id === startId;\n    } else if (endId) {\n      return id === endId;\n    }\n    return false;\n  });\n\n  const isRangeValid =\n    activeRange?.startId !== undefined && activeRange.endId !== undefined;\n\n  const isDisabled =\n    (calendarDisabledDateIds?.includes(id) ||\n      (calendarMinDateId && id < calendarMinDateId) ||\n      (calendarMaxDateId && id > calendarMaxDateId)) === true;\n\n  const isToday = todayId === id;\n\n  const state: DayState = activeRange\n    ? (\"active\" as const)\n    : isDisabled\n    ? \"disabled\"\n    : isToday\n    ? \"today\"\n    : \"idle\";\n\n  return {\n    isStartOfRange: id === activeRange?.startId,\n    isEndOfRange: id === activeRange?.endId,\n    isRangeValid,\n    state,\n    isDisabled,\n    isToday,\n  };\n};\n\nconst getBaseCalendarMonthFormat = (date: Date, locale: string) => {\n  return new Intl.DateTimeFormat(locale, {\n    month: \"long\",\n    year: \"numeric\",\n  }).format(date);\n};\nconst getBaseCalendarWeekDayFormat = (date: Date, locale: string) => {\n  return new Intl.DateTimeFormat(locale, {\n    weekday: \"narrow\",\n  }).format(date);\n};\n\nconst getBaseCalendarDayFormat = (date: Date, locale: string) => {\n  return new Intl.DateTimeFormat(locale, {\n    day: \"numeric\",\n  }).format(date);\n};\n\n/**\n * Builds a calendar based on the given parameters.\n */\nexport const buildCalendar = (params: UseCalendarParams) => {\n  const {\n    calendarMonthId: monthId,\n    calendarFirstDayOfWeek = \"sunday\",\n    calendarFormatLocale = \"en-US\",\n    getCalendarMonthFormat = getBaseCalendarMonthFormat,\n    getCalendarWeekDayFormat = getBaseCalendarWeekDayFormat,\n    getCalendarDayFormat = getBaseCalendarDayFormat,\n  } = params;\n\n  const month = fromDateId(monthId);\n  const monthStart = startOfMonth(month);\n  const monthStartId = toDateId(monthStart);\n  const monthEnd = endOfMonth(month);\n  const monthEndId = toDateId(monthEnd);\n\n  const emptyDaysAtStart = getNumberOfEmptyCellsAtStart(\n    monthStart,\n    calendarFirstDayOfWeek\n  );\n\n  const startOfWeekIndex = calendarFirstDayOfWeek === \"sunday\" ? 0 : 1;\n  const endOfWeekIndex = calendarFirstDayOfWeek === \"sunday\" ? 6 : 0;\n\n  const todayId = toDateId(new Date());\n\n  // The first day to iterate is the first day of the month minus the empty days at the start\n  let dayToIterate = subDays(monthStart, emptyDaysAtStart);\n\n  const weeksList: CalendarDayMetadata[][] = [\n    [\n      ...range(1, emptyDaysAtStart).map((): CalendarDayMetadata => {\n        const id = toDateId(dayToIterate);\n\n        const dayShape: CalendarDayMetadata = {\n          date: dayToIterate,\n          displayLabel: getCalendarDayFormat(\n            dayToIterate,\n            calendarFormatLocale\n          ),\n          id,\n          isDifferentMonth: true,\n          isEndOfMonth: false,\n          isEndOfWeek: dayToIterate.getDay() === endOfWeekIndex,\n          isStartOfMonth: false,\n          isStartOfWeek: dayToIterate.getDay() === startOfWeekIndex,\n          isWeekend: isWeekend(dayToIterate),\n          ...getStateFields({\n            ...params,\n            todayId,\n            id,\n          }),\n        };\n        dayToIterate = addDays(dayToIterate, 1);\n        return dayShape;\n      }),\n    ],\n  ];\n\n  // By this point, we're back at the start of the month\n  while (dayToIterate.getMonth() === monthStart.getMonth()) {\n    const currentWeek = weeksList[weeksList.length - 1];\n    if (currentWeek.length === 7) {\n      weeksList.push([]);\n    }\n    const id = toDateId(dayToIterate);\n    weeksList[weeksList.length - 1].push({\n      date: dayToIterate,\n      displayLabel: getCalendarDayFormat(dayToIterate, calendarFormatLocale),\n      id,\n      isDifferentMonth: false,\n      isEndOfMonth: id === monthEndId,\n      isEndOfWeek: dayToIterate.getDay() === endOfWeekIndex,\n      isStartOfMonth: id === monthStartId,\n      isStartOfWeek: dayToIterate.getDay() === startOfWeekIndex,\n      isWeekend: isWeekend(dayToIterate),\n      ...getStateFields({\n        ...params,\n        todayId,\n        id,\n      }),\n    });\n    dayToIterate = addDays(dayToIterate, 1);\n  }\n\n  // Once all the days of the month have been added, we need to add the empty days at the end\n  const lastWeek = weeksList[weeksList.length - 1];\n  const emptyDaysAtEnd = 7 - lastWeek.length;\n  lastWeek.push(\n    ...range(1, emptyDaysAtEnd).map(() => {\n      const id = toDateId(dayToIterate);\n      const dayShape: CalendarDayMetadata = {\n        date: dayToIterate,\n        displayLabel: getCalendarDayFormat(dayToIterate, calendarFormatLocale),\n        id,\n        isDifferentMonth: true,\n        isEndOfMonth: false,\n        isEndOfWeek: dayToIterate.getDay() === endOfWeekIndex,\n        isStartOfMonth: false,\n        isStartOfWeek: dayToIterate.getDay() === startOfWeekIndex,\n        isWeekend: isWeekend(dayToIterate),\n        ...getStateFields({\n          ...params,\n          todayId,\n          id,\n        }),\n      };\n      dayToIterate = addDays(dayToIterate, 1);\n      return dayShape;\n    })\n  );\n\n  const startOfWeekDate = startOfWeek(month, calendarFirstDayOfWeek);\n  const weekDaysList = range(1, 7).map((i) =>\n    getCalendarWeekDayFormat(\n      addDays(startOfWeekDate, i - 1),\n      calendarFormatLocale\n    )\n  );\n\n  return {\n    weeksList,\n    calendarRowMonth: getCalendarMonthFormat(month, calendarFormatLocale),\n    weekDaysList,\n  };\n};\n\n/**\n * Returns a memoized calendar based on the given parameters.\n */\nexport const useCalendar = (params: UseCalendarParams) =>\n  useMemo(() => buildCalendar(params), [params]);\n","/**\n * Returns the date formatted as YYYY-MM-DD, ensuring timezone doesn't affect\n * the result.\n */\nexport function toDateId(date: Date) {\n  const year = date.getFullYear();\n  const month = date.getMonth() + 1; // getMonth() returns 0-11\n  const day = date.getDate();\n\n  // Pad single digit month and day with leading zeros\n  const monthFormatted = month < 10 ? `0${month}` : month;\n  const dayFormatted = day < 10 ? `0${day}` : day;\n\n  return `${year}-${monthFormatted}-${dayFormatted}`;\n}\n\n/**\n * Converts a date ID to a `Date` object, correctly accounting for timezone.\n */\nexport function fromDateId(dateId: string) {\n  const [year, month, day] = dateId.split(\"-\").map(Number);\n  return new Date(year, month - 1, day);\n}\n\n/**\n * Returns the first day of the month for the given date.\n */\nexport function startOfMonth(date: Date) {\n  return new Date(date.getFullYear(), date.getMonth(), 1);\n}\n\n/**\n * Returns the last day of the month for the given date.\n */\nexport function endOfMonth(date: Date) {\n  const nextMonth = new Date(date.getFullYear(), date.getMonth() + 1, 1);\n  const lastDay = new Date(nextMonth.getTime() - 1);\n  return new Date(lastDay);\n}\n\n/**\n * Returns the first day of the week for the given date.\n */\nexport function startOfWeek(\n  baseDate: Date,\n  firstDayOfWeek: \"monday\" | \"sunday\"\n): Date {\n  // Clone the baseDate to avoid modifying the original date\n  const date = new Date(baseDate.getTime());\n\n  // Calculate the day of the week (0 for Sunday, 1 for Monday, etc.)\n  const dayOfWeek = date.getDay();\n  const isSunday = dayOfWeek === 0;\n\n  if (isSunday && firstDayOfWeek === \"monday\") {\n    date.setDate(date.getDate() - 6);\n    return date;\n  }\n\n  // Calculate the difference between the current day and the first day of the week\n  const diff = dayOfWeek - (firstDayOfWeek === \"monday\" ? 1 : 0);\n  date.setDate(date.getDate() - diff);\n\n  return date;\n}\n\n/**\n * Add `n` months to the given date.\n */\nexport function addMonths(date: Date, months: number) {\n  const newDate = new Date(date);\n  newDate.setMonth(newDate.getMonth() + months);\n  return newDate;\n}\n\n/**\n * Subtract `n` months from the given date.\n */\nexport function subMonths(date: Date, months: number) {\n  const newDate = new Date(date);\n  newDate.setMonth(newDate.getMonth() - months);\n  return newDate;\n}\n\n/**\n * Add `n` days to the given date.\n */\nexport function addDays(date: Date, days: number) {\n  const newDate = new Date(date);\n  newDate.setDate(newDate.getDate() + days);\n  return newDate;\n}\n\n/**\n * Subtract `n` days from the given date.\n */\nexport function subDays(date: Date, days: number) {\n  const newDate = new Date(date);\n  newDate.setDate(newDate.getDate() - days);\n  return newDate;\n}\n\n/**\n * Does the given date fall on a weekend?\n */\nexport function isWeekend(date: Date) {\n  const day = date.getDay();\n  return day === 0 || day === 6;\n}\n\n/**\n * Get the number of months between the given dates.\n */\nexport function differenceInMonths(laterDate: Date, earlierDate: Date) {\n  const yearDiff = laterDate.getFullYear() - earlierDate.getFullYear();\n  const monthDiff = laterDate.getMonth() - earlierDate.getMonth();\n\n  return yearDiff * 12 + monthDiff;\n}\n\n/**\n * Get the number of weeks in the month for the given date.\n */\nexport function getWeeksInMonth(\n  date: Date,\n  firstDayOfWeek: \"monday\" | \"sunday\"\n) {\n  const firstDay = new Date(date.getFullYear(), date.getMonth(), 1);\n  let dayOfWeek = firstDay.getDay();\n\n  // Adjust the first day of the week\n  if (firstDayOfWeek === \"monday\") {\n    dayOfWeek = dayOfWeek === 0 ? 6 : dayOfWeek - 1;\n  }\n\n  const totalDays = new Date(\n    date.getFullYear(),\n    date.getMonth() + 1,\n    0\n  ).getDate();\n\n  return Math.ceil((dayOfWeek + totalDays) / 7);\n}\n\n/**\n * Get the week of the month of the given date. The week index is 1-based.\n */\nexport function getWeekOfMonth(\n  date: Date,\n  firstDayOfWeek: \"monday\" | \"sunday\"\n) {\n  const firstDay = new Date(date.getFullYear(), date.getMonth(), 1);\n  let dayOfWeek = firstDay.getDay();\n\n  // Adjust the first day of the week\n  if (firstDayOfWeek === \"monday\") {\n    dayOfWeek = dayOfWeek === 0 ? 6 : dayOfWeek - 1;\n  }\n\n  const dayOfMonth = date.getDate();\n\n  return Math.floor((dayOfWeek + dayOfMonth - 1) / 7) + 1;\n}\n","/**\n * Returns a list of numbers from `start` (inclusive) to `stop`\n * (inclusive). In mathematical terms, `range(a, b)` is equivalent to\n * the interval `[a, b]`.\n *\n * An optional `step` can be provided to control the size of the increemnt (defaults to `1`).\n *\n * Copied from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from\n */\nexport const range = (start: number, stop: number, step = 1) =>\n  Array.from({ length: (stop - start) / step + 1 }, (_, i) => start + i * step);\n","import { useColorScheme } from \"react-native\";\n\nimport type { BaseTheme } from \"@/helpers/tokens\";\nimport { darkTheme, lightTheme } from \"@/helpers/tokens\";\nimport { useCalendarTheme } from \"@/components/CalendarThemeProvider\";\n\nexport const useTheme = (): BaseTheme => {\n  const appearance = useColorScheme();\n  const { colorScheme } = useCalendarTheme();\n\n  const theme = colorScheme ?? appearance;\n\n  return theme === \"dark\" ? darkTheme : lightTheme;\n};\n","const baseTokens = {\n  spacing: {\n    0: 0,\n    2: 2,\n    4: 4,\n    6: 6,\n    8: 8,\n    12: 12,\n    16: 16,\n    20: 20,\n    24: 24,\n  },\n} as const;\n\n/**\n * Minimal theme for the Flash Calendar component.\n * @internal\n */\nexport const lightTheme = {\n  ...baseTokens,\n  colors: {\n    content: {\n      disabled: \"#B0B0B0\",\n      primary: \"#000000\",\n      secondary: \"#212121\",\n      inverse: {\n        primary: \"#FFFFFF\",\n      },\n    },\n    background: {\n      primary: \"#FFFFFF\",\n      tertiary: \"#EDEFEE\",\n      tertiaryPressed: \"#D1D2D3\",\n      inverse: {\n        primary: \"#000000\",\n      },\n    },\n    borders: {\n      default: \"#E0E0E0\",\n    },\n    transparent: \"transparent\",\n  },\n} as const;\n\nexport const darkTheme = {\n  ...baseTokens,\n  colors: {\n    content: {\n      disabled: \"#bdbdbd\",\n      primary: \"#FFFFFF\",\n      secondary: \"#e8e8e8\",\n      inverse: {\n        primary: \"#000000\",\n      },\n    },\n    background: {\n      primary: \"#000000\",\n      tertiary: \"#111111\",\n      tertiaryPressed: \"#212121\",\n      inverse: {\n        primary: \"#FFFFFF\",\n      },\n    },\n    borders: {\n      default: \"#5c5c5c\",\n    },\n    transparent: \"transparent\",\n  },\n} as const;\n\nexport type BaseTheme = typeof lightTheme | typeof darkTheme;\n","import type { ReactNode } from \"react\";\nimport { createContext, useContext, useMemo } from \"react\";\nimport type { ColorSchemeName } from \"react-native\";\n\nexport interface CalendarThemeContextType {\n  colorScheme?: ColorSchemeName;\n}\n\nconst CalendarThemeContext = createContext<CalendarThemeContextType>({\n  colorScheme: undefined,\n});\n\nexport const CalendarThemeProvider = ({\n  children,\n  colorScheme,\n}: {\n  children: ReactNode;\n  /**\n   * When set, Flash Calendar will use this color scheme instead of the system's\n   * value (`light|dark`). This is useful if your app doesn't support dark-mode,\n   * for example.\n   *\n   * We don't advise using this prop - ideally, your app should reflect the\n   * user's preferences.\n   */\n  colorScheme?: ColorSchemeName;\n}) => {\n  const calendarThemeContextValue = useMemo<CalendarThemeContextType>(\n    () => ({ colorScheme }),\n    [colorScheme]\n  );\n\n  return (\n    <CalendarThemeContext.Provider value={calendarThemeContextValue}>\n      {children}\n    </CalendarThemeContext.Provider>\n  );\n};\n\nexport const useCalendarTheme = () => {\n  const context = useContext(CalendarThemeContext);\n  return context;\n};\n","import { memo, useMemo } from \"react\";\nimport type { ViewStyle } from \"react-native\";\nimport { View, StyleSheet } from \"react-native\";\n\nconst styles = StyleSheet.create({\n  container: {\n    padding: 6,\n    flex: 1,\n  },\n});\n\nexport interface CalendarItemEmptyProps {\n  /** The height of the cell. Should be the same as `CalendarItemDay`. */\n  height: number;\n  /** The theme of the empty cell, useful for customizing the component. */\n  theme?: {\n    container?: ViewStyle;\n  };\n}\n\nexport const CalendarItemEmpty = memo(function CalendarItemEmpty(\n  props: CalendarItemEmptyProps\n) {\n  const { height, theme } = props;\n  const containerStyles = useMemo(() => {\n    return [{ ...styles.container, height }, theme?.container];\n  }, [height, theme?.container]);\n\n  return <View style={containerStyles} />;\n});\n","import type { ReactNode } from \"react\";\nimport { useMemo } from \"react\";\nimport type { TextProps, TextStyle, ViewStyle } from \"react-native\";\nimport { StyleSheet, Text, View } from \"react-native\";\n\nimport { lightTheme } from \"@/helpers/tokens\";\nimport { useTheme } from \"@/hooks/useTheme\";\n\nconst styles = StyleSheet.create({\n  container: {\n    alignItems: \"center\",\n    flex: 1,\n    justifyContent: \"center\",\n    padding: lightTheme.spacing[6],\n  },\n  content: {},\n});\n\ninterface CalendarItemWeekNameTheme {\n  container?: ViewStyle;\n  content?: TextStyle;\n}\n\nexport interface CalendarItemWeekNameProps {\n  children: ReactNode;\n  /**\n   * The height of the week name, needed to correctly measure the calendar's\n   */\n  height: number;\n  /** The theme of the week name, useful for customizing the component. */\n  theme?: CalendarItemWeekNameTheme;\n  /** Optional TextProps to spread to the <Text> component. */\n  textProps?: Omit<TextProps, \"children\">;\n}\n\nexport const CalendarItemWeekName = ({\n  children,\n  height,\n  theme,\n  textProps,\n}: CalendarItemWeekNameProps) => {\n  const { colors } = useTheme();\n  const { containerStyles, contentStyles } = useMemo(() => {\n    const containerStyles = [styles.container, { height }, theme?.container];\n    const contentStyles = [\n      styles.content,\n      { color: colors.content.primary },\n      textProps?.style,\n      theme?.content,\n    ];\n    return { containerStyles, contentStyles };\n  }, [\n    colors.content.primary,\n    height,\n    theme?.container,\n    theme?.content,\n    textProps?.style,\n  ]);\n\n  return (\n    <View style={containerStyles}>\n      <Text {...textProps} style={contentStyles}>\n        {children}\n      </Text>\n    </View>\n  );\n};\n","import type { ReactNode } from \"react\";\nimport { useMemo } from \"react\";\nimport type { TextStyle, ViewStyle } from \"react-native\";\nimport { StyleSheet, Text, View } from \"react-native\";\n\nimport { useTheme } from \"@/hooks/useTheme\";\n\nconst styles = StyleSheet.create({\n  container: {\n    width: \"100%\",\n    alignItems: \"center\",\n    justifyContent: \"center\",\n  },\n  content: {\n    textAlign: \"center\",\n    width: \"100%\",\n  },\n});\n\ninterface CalendarRowMonthTheme {\n  container?: ViewStyle;\n  content?: TextStyle;\n}\n\nexport interface CalendarRowMonthProps {\n  children: ReactNode;\n  /**\n   * The height of the month row, needed to correctly measure the calendar's\n   * height.\n   */\n  height: number;\n  /** The theme of the month row, useful for customizing the component. */\n  theme?: CalendarRowMonthTheme;\n}\n\nexport const CalendarRowMonth = ({\n  children,\n  height,\n  theme,\n}: CalendarRowMonthProps) => {\n  const baseTheme = useTheme();\n  const { containerStyles, contentStyles } = useMemo(() => {\n    const containerStyles = [styles.container, { height }, theme?.container];\n    const contentStyles = [\n      styles.content,\n      { color: baseTheme.colors.content.primary },\n      theme?.content,\n    ];\n    return { containerStyles, contentStyles };\n  }, [\n    baseTheme.colors.content.primary,\n    height,\n    theme?.container,\n    theme?.content,\n  ]);\n\n  return (\n    <View style={containerStyles}>\n      <Text style={contentStyles}>{children}</Text>\n    </View>\n  );\n};\n","import type { ReactNode } from \"react\";\nimport { useMemo } from \"react\";\nimport type { ViewStyle } from \"react-native\";\nimport { StyleSheet } from \"react-native\";\n\nimport { HStack } from \"@/components/HStack\";\nimport type { BaseTheme } from \"@/helpers/tokens\";\n\nexport interface CalendarRowWeekProps {\n  children: ReactNode;\n  spacing?: keyof BaseTheme[\"spacing\"];\n  theme?: CalendarRowWeekTheme;\n}\n\ninterface CalendarRowWeekTheme {\n  container?: ViewStyle;\n}\n\nconst styles = StyleSheet.create({\n  container: {\n    width: \"100%\",\n  },\n});\n\nexport const CalendarRowWeek = ({\n  children,\n  spacing = 0,\n  theme,\n}: CalendarRowWeekProps) => {\n  const { containerStyles } = useMemo(() => {\n    return {\n      containerStyles: { ...styles.container, ...(theme?.container ?? {}) },\n    };\n  }, [theme?.container]);\n  return (\n    <HStack\n      alignItems=\"center\"\n      grow\n      justifyContent=\"space-between\"\n      spacing={spacing}\n      style={containerStyles}\n    >\n      {children}\n    </HStack>\n  );\n};\n","import { useMemo, type ReactNode } from \"react\";\nimport { StyleSheet, View, type ViewStyle } from \"react-native\";\n\nconst styles = StyleSheet.create({\n  container: {\n    alignItems: \"center\",\n    flexDirection: \"row\",\n    flexGrow: 0,\n    flexShrink: 0,\n    flexWrap: \"nowrap\",\n    justifyContent: \"flex-start\",\n  },\n});\n\nexport interface HStackProps {\n  alignItems?: ViewStyle[\"alignItems\"];\n  justifyContent?: ViewStyle[\"justifyContent\"];\n  children: ReactNode;\n  grow?: boolean;\n  shrink?: boolean;\n  spacing?: number;\n  wrap?: ViewStyle[\"flexWrap\"];\n  backgroundColor?: string;\n  style?: ViewStyle;\n  width?: ViewStyle[\"width\"];\n}\n\nexport const HStack = ({\n  alignItems,\n  children,\n  justifyContent = \"flex-start\",\n  grow = false,\n  shrink = false,\n  spacing = 0,\n  wrap = \"nowrap\",\n  backgroundColor,\n  width,\n  style = {},\n}: HStackProps) => {\n  const containerStyles = useMemo<ViewStyle[]>(\n    () => [\n      styles.container,\n      { gap: spacing },\n      grow ? { flexGrow: 1 } : {},\n      shrink ? { flexShrink: 1 } : {},\n      wrap ? { flexWrap: wrap } : {},\n      alignItems ? { alignItems } : {},\n      justifyContent ? { justifyContent } : {},\n      backgroundColor ? { backgroundColor } : {},\n      width ? { width } : {},\n      style,\n    ],\n    [\n      alignItems,\n      backgroundColor,\n      grow,\n      justifyContent,\n      shrink,\n      spacing,\n      style,\n      width,\n      wrap,\n    ]\n  );\n\n  return <View style={containerStyles}>{children}</View>;\n};\n","import {\n  Children,\n  Fragment,\n  isValidElement,\n  useMemo,\n  type ReactElement,\n  type ReactNode,\n} from \"react\";\nimport { StyleSheet, View, type ViewStyle } from \"react-native\";\n\nconst styles = StyleSheet.create({\n  container: {\n    flexDirection: \"column\",\n  },\n});\n\nexport interface VStackDividerProps {\n  marginBottom: number;\n}\n\nexport interface VStackProps {\n  children: ReactNode;\n  spacing?: number;\n\n  alignItems?: ViewStyle[\"alignItems\"];\n  justifyContent?: ViewStyle[\"justifyContent\"];\n\n  /** If the VStack should `flex: 1` to fill the parent's height */\n  grow?: boolean;\n}\n\nfunction isFragment(\n  child: ReactNode\n): child is ReactElement<{ children?: ReactNode }> {\n  return isValidElement(child) && child.type === Fragment;\n}\n\nexport function VStack({\n  children,\n  spacing = 0,\n  alignItems,\n  justifyContent,\n  grow,\n}: VStackProps) {\n  const containerStyles = useMemo<ViewStyle>(\n    () => ({\n      ...styles.container,\n      gap: spacing,\n      alignItems,\n      justifyContent,\n      flex: grow ? 1 : undefined,\n    }),\n    [alignItems, grow, justifyContent, spacing]\n  );\n\n  return (\n    <View style={containerStyles}>\n      {Children.toArray(children)\n        .map((c) => (isFragment(c) ? c.props.children : c))\n        .flat()\n        .filter((c) => c !== null && typeof c !== \"undefined\")\n        .map((child, i) => (\n          <Fragment key={i}>{child}</Fragment>\n        ))}\n    </View>\n  );\n}\n","export const uppercaseFirstLetter = (value: string) =>\n  value.charAt(0).toUpperCase() + value.slice(1);\n","import type { FlashListProps, FlashListRef } from \"@shopify/flash-list\";\nimport { FlashList } from \"@shopify/flash-list\";\nimport type { Ref } from \"react\";\nimport {\n  forwardRef,\n  memo,\n  useCallback,\n  useImperativeHandle,\n  useLayoutEffect,\n  useMemo,\n  useRef,\n} from \"react\";\nimport { View } from \"react-native\";\n\nimport type { CalendarProps } from \"@/components/Calendar\";\nimport { Calendar } from \"@/components/Calendar\";\nimport { getWeekOfMonth, startOfMonth, toDateId } from \"@/helpers/dates\";\nimport type { CalendarMonth } from \"@/hooks/useCalendarList\";\nimport { getHeightForMonth, useCalendarList } from \"@/hooks/useCalendarList\";\n\n/**\n * Represents each `CalendarList` item. It's enhanced with the required\n * `Calendar` props to simplify building custom `Calendar` components.\n */\nexport type CalendarMonthEnhanced = CalendarMonth & {\n  calendarProps: Omit<CalendarProps, \"calendarMonthId\">;\n};\n\nconst keyExtractor = (month: CalendarMonth) => month.id;\n\nexport interface CalendarListProps\n  extends Omit<CalendarProps, \"calendarMonthId\">,\n    Omit<FlashListProps<CalendarMonthEnhanced>, \"renderItem\" | \"data\"> {\n  /**\n   * How many months to show before the current month. Once the user scrolls\n   * past this range and if they haven't exceeded the `calendarMinDateId`, new\n   * months are prepended in this increment.\n   * @defaultValue 12\n   */\n  calendarPastScrollRangeInMonths?: number;\n  /**\n   * How many months to show after the current month. Once the user scrolls\n   * past this range and if they haven't exceeded the `calendarMaxDateId`, new\n   * months are appended in this increment.\n   * @defaultValue 12\n   */\n  calendarFutureScrollRangeInMonths?: number;\n\n  /**\n   * An additional height to use in the month's height calculation. Useful when\n   * providing a custom `Calendar` component with extra content such as a\n   * footer.\n   */\n  calendarAdditionalHeight?: number;\n\n  /**\n   * The vertical spacing between each `<Calendar />` component.\n   * @defaultValue 20\n   */\n  calendarSpacing?: number;\n\n  /**\n   * The initial month to open the calendar to, as a `YYYY-MM-DD` string.\n   * Defaults to the current month.\n   *\n   * **Tip**: To convert to date ID, use `toDateId(date)`.\n   */\n  calendarInitialMonthId?: string;\n\n  /**\n   * The scroll component to use. Useful if you need to replace the FlashList\n   * with an alternative (e.g. a BottomSheet FlashList).\n   * @defaultValue FlashList\n   */\n  CalendarScrollComponent?: typeof FlashList;\n\n  /**\n   * Overwrites the default `Calendar` component.\n   *\n   * **Important**: when providing a custom implementation, make sure to\n   * manually set all the spacing and height props to ensure the list scrolls\n   * to the right offset:\n   * - calendarDayHeight\n   * - calendarMonthHeaderHeight\n   * - calendarWeekHeaderHeight\n   * - calendarAdditionalHeight\n   * - calendarRowVerticalSpacing\n   * - calendarSpacing\n   */\n  renderItem?: FlashListProps<CalendarMonthEnhanced>[\"renderItem\"];\n}\n\ninterface ImperativeScrollParams {\n  /**\n   * An additional offset to add to the final scroll position. Useful when\n   * you need to slightly change the final scroll position.\n   */\n  additionalOffset?: number;\n}\nexport interface CalendarListRef {\n  scrollToMonth: (\n    date: Date,\n    animated: boolean,\n    params?: ImperativeScrollParams\n  ) => void;\n  scrollToDate: (\n    date: Date,\n    animated: boolean,\n    params?: ImperativeScrollParams\n  ) => void;\n  scrollToOffset: (offset: number, animated: boolean) => void;\n}\n\nexport const CalendarList = memo(\n  forwardRef(function CalendarList(\n    props: CalendarListProps,\n    ref: Ref<CalendarListRef>\n  ) {\n    const {\n      // List-related props\n      calendarInitialMonthId,\n      calendarPastScrollRangeInMonths = 12,\n      calendarFutureScrollRangeInMonths = 12,\n      calendarFirstDayOfWeek = \"sunday\",\n      CalendarScrollComponent = FlashList,\n      calendarFormatLocale,\n\n      // Spacings\n      calendarSpacing = 20,\n      calendarRowHorizontalSpacing,\n      calendarRowVerticalSpacing = 8,\n\n      // Heights\n      calendarMonthHeaderHeight = 20,\n      calendarDayHeight = 32,\n      calendarWeekHeaderHeight = calendarDayHeight,\n      calendarAdditionalHeight = 0,\n\n      // Other props\n      calendarColorScheme,\n      theme,\n      onEndReached,\n      ...otherProps\n    } = props;\n\n    const {\n      calendarActiveDateRanges,\n      calendarDisabledDateIds,\n      calendarInstanceId,\n      calendarMaxDateId,\n      calendarMinDateId,\n      getCalendarDayFormat,\n      getCalendarMonthFormat,\n      getCalendarWeekDayFormat,\n      onCalendarDayPress,\n      CalendarPressableComponent,\n      ...flatListProps\n    } = otherProps;\n\n    const calendarProps = useMemo(\n      (): CalendarMonthEnhanced[\"calendarProps\"] => ({\n        calendarActiveDateRanges,\n        calendarColorScheme,\n        calendarDayHeight,\n        calendarDisabledDateIds,\n        calendarFirstDayOfWeek,\n        calendarFormatLocale,\n        calendarInstanceId,\n        calendarMaxDateId,\n        calendarMinDateId,\n        calendarMonthHeaderHeight,\n        calendarRowHorizontalSpacing,\n        calendarRowVerticalSpacing,\n        calendarWeekHeaderHeight,\n        getCalendarDayFormat,\n        getCalendarMonthFormat,\n        getCalendarWeekDayFormat,\n        onCalendarDayPress,\n        theme,\n        CalendarPressableComponent,\n      }),\n      [\n        calendarColorScheme,\n        calendarActiveDateRanges,\n        calendarDayHeight,\n        calendarDisabledDateIds,\n        calendarFirstDayOfWeek,\n        calendarFormatLocale,\n        calendarMaxDateId,\n        calendarMinDateId,\n        calendarMonthHeaderHeight,\n        calendarRowHorizontalSpacing,\n        calendarRowVerticalSpacing,\n        calendarWeekHeaderHeight,\n        getCalendarDayFormat,\n        getCalendarMonthFormat,\n        getCalendarWeekDayFormat,\n        calendarInstanceId,\n        onCalendarDayPress,\n        theme,\n        CalendarPressableComponent,\n      ]\n    );\n\n    const { initialMonthIndex, monthList, appendMonths, addMissingMonths } =\n      useCalendarList({\n        calendarFirstDayOfWeek,\n        calendarFutureScrollRangeInMonths,\n        calendarPastScrollRangeInMonths,\n        calendarInitialMonthId,\n        calendarMaxDateId,\n        calendarMinDateId,\n      });\n\n    const monthListWithCalendarProps = useMemo(() => {\n      return monthList.map((month) => ({\n        ...month,\n        calendarProps,\n      }));\n    }, [calendarProps, monthList]);\n\n    const handleOnEndReached = useCallback(() => {\n      appendMonths(calendarFutureScrollRangeInMonths);\n      onEndReached?.();\n    }, [appendMonths, calendarFutureScrollRangeInMonths, onEndReached]);\n\n    /**\n     * Returns the offset for the given month (how much the user needs to\n     * scroll to reach the month).\n     */\n    const getScrollOffsetForMonth = useCallback(\n      (date: Date) => {\n        const monthId = toDateId(startOfMonth(date));\n\n        let baseMonthList = monthList;\n        let index = baseMonthList.findIndex((month) => month.id === monthId);\n\n        if (index === -1) {\n          baseMonthList = addMissingMonths(monthId);\n          index = baseMonthList.findIndex((month) => month.id === monthId);\n        }\n\n        return baseMonthList.slice(0, index).reduce((acc, month) => {\n          const currentHeight = getHeightForMonth({\n            calendarMonth: month,\n            calendarSpacing,\n            calendarDayHeight,\n            calendarMonthHeaderHeight,\n            calendarRowVerticalSpacing,\n            calendarWeekHeaderHeight,\n            calendarAdditionalHeight,\n          });\n\n          return acc + currentHeight;\n        }, 0);\n      },\n      [\n        addMissingMonths,\n        calendarAdditionalHeight,\n        calendarDayHeight,\n        calendarMonthHeaderHeight,\n        calendarRowVerticalSpacing,\n        calendarSpacing,\n        calendarWeekHeaderHeight,\n        monthList,\n      ]\n    );\n\n    const flashListRef = useRef<FlashListRef<CalendarMonthEnhanced>>(null);\n\n    // fix for this issue: https://github.com/Shopify/flash-list/issues/1797\n    useLayoutEffect(() => {\n      if (initialMonthIndex <= 0) return;\n      flashListRef.current?.scrollToIndex({\n        index: initialMonthIndex,\n        animated: false,\n      });\n      // Only run on mount\n      // eslint-disable-next-line react-hooks/exhaustive-deps\n    }, []);\n\n    useImperativeHandle(ref, () => ({\n      scrollToMonth(\n        date,\n        animated,\n        { additionalOffset = 0 } = { additionalOffset: 0 }\n      ) {\n        // Wait for the next render cycle to ensure the list has been\n        // updated with the new months.\n        setTimeout(() => {\n          flashListRef.current?.scrollToOffset({\n            offset: getScrollOffsetForMonth(date) + additionalOffset,\n            animated,\n          });\n        }, 0);\n      },\n      scrollToDate(\n        date,\n        animated,\n        { additionalOffset = 0 } = {\n          additionalOffset: 0,\n        }\n      ) {\n        const currentMonthOffset = getScrollOffsetForMonth(date);\n        const weekOfMonthIndex = getWeekOfMonth(date, calendarFirstDayOfWeek);\n        const rowHeight = calendarDayHeight + calendarRowVerticalSpacing;\n\n        let weekOffset =\n          calendarWeekHeaderHeight + rowHeight * weekOfMonthIndex;\n\n        /**\n         * We need to subtract one vertical spacing to avoid cutting off the\n         * desired date. A simple way of understanding why is imagining we\n         * want to scroll exactly to the given date, but leave a little bit of\n         * breathing room (`calendarRowVerticalSpacing`) above it.\n         */\n        weekOffset = weekOffset - calendarRowVerticalSpacing;\n\n        flashListRef.current?.scrollToOffset({\n          offset: currentMonthOffset + weekOffset + additionalOffset,\n          animated,\n        });\n      },\n      scrollToOffset(offset, animated) {\n        flashListRef.current?.scrollToOffset({ offset, animated });\n      },\n    }));\n\n    const calendarContainerStyle = useMemo(() => {\n      return { paddingBottom: calendarSpacing };\n    }, [calendarSpacing]);\n\n    return (\n      <CalendarScrollComponent\n        data={monthListWithCalendarProps}\n        initialScrollIndex={initialMonthIndex}\n        keyExtractor={keyExtractor}\n        onEndReached={handleOnEndReached}\n        ref={flashListRef}\n        renderItem={({ item }) => (\n          <View style={calendarContainerStyle}>\n            <Calendar calendarMonthId={item.id} {...item.calendarProps} />\n          </View>\n        )}\n        showsVerticalScrollIndicator={false}\n        {...flatListProps}\n      />\n    );\n  })\n);\n","import { useCallback, useMemo, useState } from \"react\";\n\nimport type { CalendarProps } from \"@/components/Calendar\";\nimport {\n  fromDateId,\n  toDateId,\n  startOfMonth,\n  addMonths,\n  subMonths,\n  differenceInMonths,\n  getWeeksInMonth,\n} from \"@/helpers/dates\";\nimport type { UseCalendarParams } from \"@/hooks/useCalendar\";\nimport { pipe } from \"@/helpers/functions\";\n\nexport interface CalendarMonth {\n  id: string;\n  date: Date;\n  numberOfWeeks: number;\n}\n\nconst buildMonthList = (\n  startingMonth: Date,\n  endingMonth: Date,\n  firstDayOfWeek: CalendarProps[\"calendarFirstDayOfWeek\"] = \"sunday\"\n): CalendarMonth[] => {\n  const startingMonthId = toDateId(startingMonth);\n  const endingMonthId = toDateId(endingMonth);\n\n  if (endingMonthId < startingMonthId) {\n    return [];\n  }\n\n  const months = [\n    {\n      id: toDateId(startingMonth),\n      date: startingMonth,\n      numberOfWeeks: getWeeksInMonth(startingMonth, firstDayOfWeek),\n    },\n  ];\n\n  if (startingMonthId === endingMonthId) {\n    return months;\n  }\n\n  const numberOfMonths = differenceInMonths(endingMonth, startingMonth);\n\n  for (let i = 1; i <= numberOfMonths; i++) {\n    const month = addMonths(startingMonth, i);\n    const numberOfWeeks = getWeeksInMonth(month, firstDayOfWeek);\n\n    months.push({\n      id: toDateId(month),\n      date: month,\n      numberOfWeeks,\n    });\n  }\n  return months;\n};\n\nexport interface UseCalendarListParams\n  extends Pick<UseCalendarParams, \"calendarMinDateId\" | \"calendarMaxDateId\"> {\n  /**\n   * The initial month to open the calendar to, as a `YYYY-MM-DD` string.\n   * @defaultValue today\n   */\n  calendarInitialMonthId?: string;\n  /**\n   * How many months to show before the current month. Only applicable if\n   * `calendarMinDateId` is not set.\n   */\n  calendarPastScrollRangeInMonths: number;\n  /**\n   * How many months to show after the current month. Applicable if\n   * `calendarMaxDateId` is not set.\n   */\n  calendarFutureScrollRangeInMonths: number;\n  calendarFirstDayOfWeek: \"monday\" | \"sunday\";\n}\n\nconst getEndingMonth = (\n  calendarFutureScrollRange: number,\n  calendarMaxDateId: string | undefined,\n  baseDate: Date\n) => {\n  const endingMonthFromRange = addMonths(baseDate, calendarFutureScrollRange);\n  const newEndingMonthId = toDateId(endingMonthFromRange);\n  const safeMaxDateId = calendarMaxDateId ?? newEndingMonthId;\n\n  // We've exceeded the max date\n  return startOfMonth(\n    newEndingMonthId > safeMaxDateId\n      ? fromDateId(safeMaxDateId)\n      : endingMonthFromRange\n  );\n};\n\nconst getStartingMonth = (\n  calendarPastScrollRange: number,\n  calendarMinDateId: string | undefined,\n  baseDate: Date\n) => {\n  const startingMonthFromRange = subMonths(baseDate, calendarPastScrollRange);\n  const newStartingMonthId = toDateId(startingMonthFromRange);\n  const safeMinDateId = calendarMinDateId ?? newStartingMonthId;\n\n  // We've exceeded the min date.\n  return safeMinDateId > newStartingMonthId\n    ? // Normalize to start of month since each month ID is represented by the first day of month\n      pipe(fromDateId(safeMinDateId), startOfMonth)\n    : startingMonthFromRange;\n};\n\n/**\n * Returns a list of months to display in the calendar, and methods to append\n * and prepend months to the list.\n */\nexport const useCalendarList = ({\n  calendarInitialMonthId,\n  calendarPastScrollRangeInMonths,\n  calendarFutureScrollRangeInMonths,\n  calendarFirstDayOfWeek,\n  calendarMaxDateId,\n  calendarMinDateId,\n}: UseCalendarListParams) => {\n  // Initialize key values\n  const { initialMonth, initialMonthId } = useMemo(() => {\n    const baseDate = calendarInitialMonthId\n      ? fromDateId(calendarInitialMonthId)\n      : fromDateId(toDateId(new Date()));\n\n    // Normalize to start of month since each month ID is represented by the first day of month\n    const baseStartOfMonth = startOfMonth(baseDate);\n\n    return {\n      initialMonth: baseStartOfMonth,\n      initialMonthId: toDateId(baseStartOfMonth),\n    };\n  }, [calendarInitialMonthId]);\n\n  const [monthList, setMonthList] = useState<CalendarMonth[]>(() => {\n    const currentMonth = startOfMonth(initialMonth);\n\n    const startingMonth = getStartingMonth(\n      calendarPastScrollRangeInMonths,\n      calendarMinDateId,\n      currentMonth\n    );\n\n    const endingMonth = getEndingMonth(\n      calendarFutureScrollRangeInMonths,\n      calendarMaxDateId,\n      currentMonth\n    );\n\n    return buildMonthList(startingMonth, endingMonth, calendarFirstDayOfWeek);\n  });\n\n  /**\n   * Append new months to the list.\n   */\n  const appendMonths = useCallback(\n    (numberOfMonths: number) => {\n      // Last month + 1\n      const startingMonth = addMonths(monthList[monthList.length - 1].date, 1);\n\n      const endingMonth = getEndingMonth(\n        Math.max(numberOfMonths - 1, 0),\n        calendarMaxDateId,\n        startingMonth\n      );\n\n      const hasReachedEndingMonth = monthList.find(\n        (m) => m.id === toDateId(endingMonth)\n      );\n      if (hasReachedEndingMonth) {\n        return monthList;\n      }\n\n      const newMonths = buildMonthList(\n        startingMonth,\n        endingMonth,\n        calendarFirstDayOfWeek\n      );\n\n      const newMonthList = [...monthList, ...newMonths];\n      setMonthList(newMonthList);\n      return newMonthList;\n    },\n    [calendarFirstDayOfWeek, calendarMaxDateId, monthList]\n  );\n\n  const prependMonths = useCallback(\n    (numberOfMonths: number) => {\n      const endingMonth = subMonths(monthList[0].date, 1);\n\n      const startingMonth = getStartingMonth(\n        Math.max(numberOfMonths - 1, 0),\n        calendarMinDateId,\n        endingMonth\n      );\n\n      const newMonths = buildMonthList(\n        startingMonth,\n        endingMonth,\n        calendarFirstDayOfWeek\n      );\n\n      const newMonthList = [...newMonths, ...monthList];\n      setMonthList(newMonthList);\n      return newMonthList;\n    },\n    [calendarFirstDayOfWeek, calendarMinDateId, monthList]\n  );\n\n  const addMissingMonths = useCallback(\n    (targetMonthId: string) => {\n      const firstMonth = monthList[0];\n      const lastMonth = monthList[monthList.length - 1];\n\n      if (targetMonthId > lastMonth.id) {\n        return appendMonths(\n          differenceInMonths(fromDateId(targetMonthId), lastMonth.date)\n        );\n      } else {\n        return prependMonths(\n          differenceInMonths(firstMonth.date, fromDateId(targetMonthId))\n        );\n      }\n    },\n    [appendMonths, monthList, prependMonths]\n  );\n\n  const initialMonthIndex = useMemo(() => {\n    const index = monthList.findIndex((i) => i.id === initialMonthId);\n    return index;\n  }, [initialMonthId, monthList]);\n\n  return {\n    /**\n     * The list of months to display in the calendar.\n     */\n    monthList,\n    /**\n     * The index of the initial month in the list.\n     */\n    initialMonthIndex,\n    /**\n     * Appends new months to the list.\n     */\n    appendMonths,\n    /**\n     * Prepends new months to the list.\n     */\n    prependMonths,\n    /**\n     * Adds missing months to the list, so that the target month is included.\n     */\n    addMissingMonths,\n  };\n};\n\n/**\n * Returns the absolute height for a month, accounting for the spacings and\n * headers.\n */\nexport const getHeightForMonth = ({\n  calendarRowVerticalSpacing: vSpacing,\n  calendarDayHeight: day,\n  calendarWeekHeaderHeight: weekName,\n  calendarMonthHeaderHeight: header,\n  calendarAdditionalHeight: extraHeight,\n  calendarMonth,\n  calendarSpacing,\n}: {\n  calendarAdditionalHeight: number;\n  calendarDayHeight: number;\n  calendarMonthHeaderHeight: number;\n  calendarRowVerticalSpacing: number;\n  calendarWeekHeaderHeight: number;\n  calendarMonth: CalendarMonth;\n  calendarSpacing: number;\n}) => {\n  const headerHeight = header + vSpacing + weekName + vSpacing;\n  const daysHeight =\n    day * calendarMonth.numberOfWeeks +\n    // The last week doesn't have a bottom spacing (not referring to `calendarSpacing`)\n    (calendarMonth.numberOfWeeks - 1) * vSpacing;\n\n  return headerHeight + daysHeight + extraHeight + calendarSpacing;\n};\n","/**\n * Pipes the value of an expression into a pipeline of functions.\n *\n * See also [`flow`](#flow).\n *\n * @example\n * import { pipe } from 'fp-ts/function'\n *\n * const len = (s: string): number => s.length\n * const double = (n: number): number => n * 2\n *\n * // without pipe\n * assert.strictEqual(double(len('aaa')), 6)\n *\n * // with pipe\n * assert.strictEqual(pipe('aaa', len, double), 6)\n *\n * @remark copied from https://github.com/gcanti/fp-ts/blob/master/src/function.ts\n */\nexport function pipe<A>(a: A): A;\nexport function pipe<A, B>(a: A, ab: (a: A) => B): B;\nexport function pipe<A, B, C>(a: A, ab: (a: A) => B, bc: (b: B) => C): C;\nexport function pipe<A, B, C, D>(\n  a: A,\n  ab: (a: A) => B,\n  bc: (b: B) => C,\n  cd: (c: C) => D\n): D;\nexport function pipe<A, B, C, D, E>(\n  a: A,\n  ab: (a: A) => B,\n  bc: (b: B) => C,\n  cd: (c: C) => D,\n  de: (d: D) => E\n): E;\nexport function pipe<A, B, C, D, E, F>(\n  a: A,\n  ab: (a: A) => B,\n  bc: (b: B) => C,\n  cd: (c: C) => D,\n  de: (d: D) => E,\n  ef: (e: E) => F\n): F;\nexport function pipe<A, B, C, D, E, F, G>(\n  a: A,\n  ab: (a: A) => B,\n  bc: (b: B) => C,\n  cd: (c: C) => D,\n  de: (d: D) => E,\n  ef: (e: E) => F,\n  fg: (f: F) => G\n): G;\nexport function pipe<A, B, C, D, E, F, G, H>(\n  a: A,\n  ab: (a: A) => B,\n  bc: (b: B) => C,\n  cd: (c: C) => D,\n  de: (d: D) => E,\n  ef: (e: E) => F,\n  fg: (f: F) => G,\n  gh: (g: G) => H\n): H;\nexport function pipe<A, B, C, D, E, F, G, H, I>(\n  a: A,\n  ab: (a: A) => B,\n  bc: (b: B) => C,\n  cd: (c: C) => D,\n  de: (d: D) => E,\n  ef: (e: E) => F,\n  fg: (f: F) => G,\n  gh: (g: G) => H,\n  hi: (h: H) => I\n): I;\nexport function pipe<A, B, C, D, E, F, G, H, I, J>(\n  a: A,\n  ab: (a: A) => B,\n  bc: (b: B) => C,\n  cd: (c: C) => D,\n  de: (d: D) => E,\n  ef: (e: E) => F,\n  fg: (f: F) => G,\n  gh: (g: G) => H,\n  hi: (h: H) => I,\n  ij: (i: I) => J\n): J;\nexport function pipe<A, B, C, D, E, F, G, H, I, J, K>(\n  a: A,\n  ab: (a: A) => B,\n  bc: (b: B) => C,\n  cd: (c: C) => D,\n  de: (d: D) => E,\n  ef: (e: E) => F,\n  fg: (f: F) => G,\n  gh: (g: G) => H,\n  hi: (h: H) => I,\n  ij: (i: I) => J,\n  jk: (j: J) => K\n): K;\nexport function pipe<A, B, C, D, E, F, G, H, I, J, K, L>(\n  a: A,\n  ab: (a: A) => B,\n  bc: (b: B) => C,\n  cd: (c: C) => D,\n  de: (d: D) => E,\n  ef: (e: E) => F,\n  fg: (f: F) => G,\n  gh: (g: G) => H,\n  hi: (h: H) => I,\n  ij: (i: I) => J,\n  jk: (j: J) => K,\n  kl: (k: K) => L\n): L;\nexport function pipe<A, B, C, D, E, F, G, H, I, J, K, L, M>(\n  a: A,\n  ab: (a: A) => B,\n  bc: (b: B) => C,\n  cd: (c: C) => D,\n  de: (d: D) => E,\n  ef: (e: E) => F,\n  fg: (f: F) => G,\n  gh: (g: G) => H,\n  hi: (h: H) => I,\n  ij: (i: I) => J,\n  jk: (j: J) => K,\n  kl: (k: K) => L,\n  lm: (l: L) => M\n): M;\nexport function pipe<A, B, C, D, E, F, G, H, I, J, K, L, M, N>(\n  a: A,\n  ab: (a: A) => B,\n  bc: (b: B) => C,\n  cd: (c: C) => D,\n  de: (d: D) => E,\n  ef: (e: E) => F,\n  fg: (f: F) => G,\n  gh: (g: G) => H,\n  hi: (h: H) => I,\n  ij: (i: I) => J,\n  jk: (j: J) => K,\n  kl: (k: K) => L,\n  lm: (l: L) => M,\n  mn: (m: M) => N\n): N;\nexport function pipe<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O>(\n  a: A,\n  ab: (a: A) => B,\n  bc: (b: B) => C,\n  cd: (c: C) => D,\n  de: (d: D) => E,\n  ef: (e: E) => F,\n  fg: (f: F) => G,\n  gh: (g: G) => H,\n  hi: (h: H) => I,\n  ij: (i: I) => J,\n  jk: (j: J) => K,\n  kl: (k: K) => L,\n  lm: (l: L) => M,\n  mn: (m: M) => N,\n  no: (n: N) => O\n): O;\n\nexport function pipe<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P>(\n  a: A,\n  ab: (a: A) => B,\n  bc: (b: B) => C,\n  cd: (c: C) => D,\n  de: (d: D) => E,\n  ef: (e: E) => F,\n  fg: (f: F) => G,\n  gh: (g: G) => H,\n  hi: (h: H) => I,\n  ij: (i: I) => J,\n  jk: (j: J) => K,\n  kl: (k: K) => L,\n  lm: (l: L) => M,\n  mn: (m: M) => N,\n  no: (n: N) => O,\n  op: (o: O) => P\n): P;\n\nexport function pipe<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q>(\n  a: A,\n  ab: (a: A) => B,\n  bc: (b: B) => C,\n  cd: (c: C) => D,\n  de: (d: D) => E,\n  ef: (e: E) => F,\n  fg: (f: F) => G,\n  gh: (g: G) => H,\n  hi: (h: H) => I,\n  ij: (i: I) => J,\n  jk: (j: J) => K,\n  kl: (k: K) => L,\n  lm: (l: L) => M,\n  mn: (m: M) => N,\n  no: (n: N) => O,\n  op: (o: O) => P,\n  pq: (p: P) => Q\n): Q;\n\nexport function pipe<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R>(\n  a: A,\n  ab: (a: A) => B,\n  bc: (b: B) => C,\n  cd: (c: C) => D,\n  de: (d: D) => E,\n  ef: (e: E) => F,\n  fg: (f: F) => G,\n  gh: (g: G) => H,\n  hi: (h: H) => I,\n  ij: (i: I) => J,\n  jk: (j: J) => K,\n  kl: (k: K) => L,\n  lm: (l: L) => M,\n  mn: (m: M) => N,\n  no: (n: N) => O,\n  op: (o: O) => P,\n  pq: (p: P) => Q,\n  qr: (q: Q) => R\n): R;\n\nexport function pipe<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S>(\n  a: A,\n  ab: (a: A) => B,\n  bc: (b: B) => C,\n  cd: (c: C) => D,\n  de: (d: D) => E,\n  ef: (e: E) => F,\n  fg: (f: F) => G,\n  gh: (g: G) => H,\n  hi: (h: H) => I,\n  ij: (i: I) => J,\n  jk: (j: J) => K,\n  kl: (k: K) => L,\n  lm: (l: L) => M,\n  mn: (m: M) => N,\n  no: (n: N) => O,\n  op: (o: O) => P,\n  pq: (p: P) => Q,\n  qr: (q: Q) => R,\n  rs: (r: R) => S\n): S;\n\nexport function pipe<\n  A,\n  B,\n  C,\n  D,\n  E,\n  F,\n  G,\n  H,\n  I,\n  J,\n  K,\n  L,\n  M,\n  N,\n  O,\n  P,\n  Q,\n  R,\n  S,\n  T\n>(\n  a: A,\n  ab: (a: A) => B,\n  bc: (b: B) => C,\n  cd: (c: C) => D,\n  de: (d: D) => E,\n  ef: (e: E) => F,\n  fg: (f: F) => G,\n  gh: (g: G) => H,\n  hi: (h: H) => I,\n  ij: (i: I) => J,\n  jk: (j: J) => K,\n  kl: (k: K) => L,\n  lm: (l: L) => M,\n  mn: (m: M) => N,\n  no: (n: N) => O,\n  op: (o: O) => P,\n  pq: (p: P) => Q,\n  qr: (q: Q) => R,\n  rs: (r: R) => S,\n  st: (s: S) => T\n): T;\nexport function pipe(\n  a: unknown,\n  ab?: Function,\n  bc?: Function,\n  cd?: Function,\n  de?: Function,\n  ef?: Function,\n  fg?: Function,\n  gh?: Function,\n  hi?: Function\n): unknown {\n  switch (arguments.length) {\n    case 1:\n      return a;\n    case 2:\n      return ab!(a);\n    case 3:\n      return bc!(ab!(a));\n    case 4:\n      return cd!(bc!(ab!(a)));\n    case 5:\n      return de!(cd!(bc!(ab!(a))));\n    case 6:\n      return ef!(de!(cd!(bc!(ab!(a)))));\n    case 7:\n      return fg!(ef!(de!(cd!(bc!(ab!(a))))));\n    case 8:\n      return gh!(fg!(ef!(de!(cd!(bc!(ab!(a)))))));\n    case 9:\n      return hi!(gh!(fg!(ef!(de!(cd!(bc!(ab!(a))))))));\n    default: {\n      // eslint-disable-next-line prefer-rest-params\n      let ret = arguments[0];\n      for (let i = 1; i < arguments.length; i++) {\n        // eslint-disable-next-line @typescript-eslint/no-unsafe-call, prefer-rest-params\n        ret = arguments[i](ret);\n      }\n      return ret;\n    }\n  }\n}\n","import { Calendar as CalendarDefault } from \"@/components/Calendar\";\nimport {\n  CalendarItemDay,\n  CalendarItemDayContainer,\n  CalendarItemDayWithContainer,\n} from \"@/components/CalendarItemDay\";\nimport { CalendarItemEmpty } from \"@/components/CalendarItemEmpty\";\nimport { CalendarItemWeekName } from \"@/components/CalendarItemWeekName\";\nimport { CalendarList } from \"@/components/CalendarList\";\nimport { CalendarRowMonth } from \"@/components/CalendarRowMonth\";\nimport { CalendarRowWeek } from \"@/components/CalendarRowWeek\";\nimport { HStack } from \"@/components/HStack\";\nimport { VStack } from \"@/components/VStack\";\n\n/**\n * This file houses the public API for the flash-calendar package.\n */\n\ntype CalendarItemDayNamespace = {\n  Container: typeof CalendarItemDayContainer;\n  WithContainer: typeof CalendarItemDayWithContainer;\n} & typeof CalendarItemDay;\n\nconst CalendarItemDayWithNamespace =\n  CalendarItemDay as CalendarItemDayNamespace;\n\nCalendarItemDayWithNamespace.Container = CalendarItemDayContainer;\nCalendarItemDayWithNamespace.WithContainer = CalendarItemDayWithContainer;\nexport type {\n  CalendarItemDayContainerProps,\n  CalendarItemDayProps,\n  CalendarItemDayWithContainerProps,\n} from \"@/components/CalendarItemDay\";\n\ninterface CalendarItemNamespace {\n  /**\n   * Renders the day item of the calendar (e.g. `1`, `2`, `3`, etc.)\n   */\n  Day: typeof CalendarItemDayWithNamespace;\n  /**\n   * Renders the week day name item of the calendar (e.g. `Sun`, `Mon`, `Tue`, etc.)\n   */\n  WeekName: typeof CalendarItemWeekName;\n  /**\n   * Renders an empty item to fill the calendar's grid in the start or end of\n   * the month.\n   */\n  Empty: typeof CalendarItemEmpty;\n}\n\nconst CalendarItemWithNamespace = {} as CalendarItemNamespace;\nCalendarItemWithNamespace.Day = CalendarItemDayWithNamespace;\n\nCalendarItemWithNamespace.WeekName = CalendarItemWeekName;\nexport type { CalendarItemWeekNameProps } from \"@/components/CalendarItemWeekName\";\n\nCalendarItemWithNamespace.Empty = CalendarItemEmpty;\nexport type { CalendarItemEmptyProps } from \"@/components/CalendarItemEmpty\";\n\ninterface CalendarRowNamespace {\n  /**\n   * Renders the month row of the calendar (e.g. `January`, `February`, `March`, etc.)\n   */\n  Month: typeof CalendarRowMonth;\n  /**\n   * Renders each week row of the calendar, including the week day names.\n   */\n  Week: typeof CalendarRowWeek;\n}\n\nconst CalendarRowWithNamespace = {} as CalendarRowNamespace;\nCalendarRowWithNamespace.Month = CalendarRowMonth;\nexport type { CalendarRowMonthProps } from \"@/components/CalendarRowMonth\";\n\nCalendarRowWithNamespace.Week = CalendarRowWeek;\nexport type { CalendarRowWeekProps } from \"@/components/CalendarRowWeek\";\n\ntype CalendarNamespace = {\n  Item: typeof CalendarItemWithNamespace;\n  Row: typeof CalendarRowWithNamespace;\n  List: typeof CalendarList;\n  HStack: typeof HStack;\n  VStack: typeof VStack;\n} & typeof CalendarDefault;\nexport type {\n  CalendarOnDayPress,\n  CalendarProps,\n  CalendarTheme,\n} from \"@/components/Calendar\";\n\nconst CalendarWithNamespace = CalendarDefault as CalendarNamespace;\nCalendarWithNamespace.Item = CalendarItemWithNamespace;\nCalendarWithNamespace.Row = CalendarRowWithNamespace;\n\nCalendarWithNamespace.List = CalendarList;\nexport type {\n  CalendarListProps,\n  CalendarListRef,\n  CalendarMonthEnhanced,\n} from \"@/components/CalendarList\";\n\n// Useful for customizing the layout of the calendar, re-exported for convenience\nCalendarWithNamespace.HStack = HStack;\nCalendarWithNamespace.VStack = VStack;\nexport type { HStackProps } from \"@/components/HStack\";\nexport type { VStackProps } from \"@/components/VStack\";\n\nexport const Calendar = CalendarWithNamespace;\n","import { useCallback, useMemo, useState } from \"react\";\n\nimport type { CalendarOnDayPress } from \"@/components\";\nimport type { CalendarActiveDateRange } from \"@/hooks/useCalendar\";\n\n/**\n * A convenience hook to simplify managing a date range in the calendar in a\n * performant way.\n */\nexport const useDateRange = (\n  initialDateRange: CalendarActiveDateRange = {\n    startId: undefined,\n    endId: undefined,\n  }\n) => {\n  const [dateRange, setDateRange] =\n    useState<CalendarActiveDateRange>(initialDateRange);\n\n  const onCalendarDayPress = useCallback<CalendarOnDayPress>(\n    (dateId: string) => {\n      setDateRange((prev) => {\n        // Starting the first range\n        if (!prev.startId && !prev.endId) {\n          return {\n            startId: dateId,\n            endId: undefined,\n          };\n        } else if (prev.startId && prev.endId) {\n          // Starting a new range\n          return {\n            startId: dateId,\n            endId: undefined,\n          };\n        } else if (prev.startId && !prev.endId) {\n          if (dateId < prev.startId) {\n            return {\n              startId: dateId,\n              endId: prev.startId,\n            };\n          } else {\n            return {\n              ...prev,\n              endId: dateId,\n            };\n          }\n        }\n        return {\n          startId: dateId,\n          endId: dateId,\n        };\n      });\n    },\n    []\n  );\n\n  const onClearDateRange = useCallback(() => {\n    setDateRange({\n      startId: undefined,\n      endId: undefined,\n    });\n  }, []);\n\n  return useMemo(() => {\n    const calendarActiveDateRanges =\n      !dateRange.startId && !dateRange.endId ? [] : [dateRange];\n    const isDateRangeValid = !!(dateRange.startId && dateRange.endId);\n\n    return {\n      /**\n       * The current date range.\n       **/\n      dateRange,\n      /**\n       * Derived from the current date range as a convenience when passing to\n       * the `<Calendar.List />` component.\n       */\n      calendarActiveDateRanges,\n      /**\n       * Clears the current date range.\n       */\n      onClearDateRange,\n      /**\n       * Callback to pass to the `<Calendar.List />` component to handle date\n       * range.\n       */\n      onCalendarDayPress,\n      /**\n       * Whether the current date range is valid (e.g. has both start and end\n       * dates)\n       */\n      isDateRangeValid,\n    };\n  }, [dateRange, onCalendarDayPress, onClearDateRange]);\n};\n"],"mappings":"8lBAAA,OAAS,QAAAA,GAAM,aAAAC,OAAiB,QCChC,OAAS,eAAAC,GAAa,WAAAC,OAAe,QAErC,OAAS,aAAAC,GAAW,cAAAC,GAAY,QAAAC,GAA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EAAEZ,EAAU,SAAWA,EAAU,OAE3D,MAAO,CAIL,UAAAA,EAKA,yBAAAW,EAIA,iBAAAF,EAKA,mBAAAN,EAKA,iBAAAS,CACF,CACF,EAAG,CAACZ,EAAWG,EAAoBM,CAAgB,CAAC,CACtD","names":["memo","useEffect","useCallback","useMemo","Pressable","StyleSheet","Text","View","all","Map","on","type","handler","handlers","get","push","set","off","splice","indexOf","emit","evt","slice","map","useEffect","useState","useMemo","toDateId","date","year","month","day","monthFormatted","dayFormatted","fromDateId","dateId","startOfMonth","endOfMonth","nextMonth","lastDay","startOfWeek","baseDate","firstDayOfWeek","dayOfWeek","diff","addMonths","months","newDate","subMonths","addDays","days","subDays","isWeekend","differenceInMonths","laterDate","earlierDate","yearDiff","monthDiff","getWeeksInMonth","totalDays","getWeekOfMonth","dayOfMonth","range","start","stop","step","_","i","getNumberOfEmptyCellsAtStart","month","firstDayOfWeek","startOfMonthDay","getStateFields","todayId","id","calendarActiveDateRanges","calendarMinDateId","calendarMaxDateId","calendarDisabledDateIds","activeRange","startId","endId","isRangeValid","isDisabled","isToday","state","getBaseCalendarMonthFormat","date","locale","getBaseCalendarWeekDayFormat","getBaseCalendarDayFormat","buildCalendar","params","monthId","calendarFirstDayOfWeek","calendarFormatLocale","getCalendarMonthFormat","getCalendarWeekDayFormat","getCalendarDayFormat","fromDateId","monthStart","startOfMonth","monthStartId","toDateId","monthEnd","endOfMonth","monthEndId","emptyDaysAtStart","startOfWeekIndex","endOfWeekIndex","dayToIterate","subDays","weeksList","range","dayShape","__spreadValues","isWeekend","__spreadProps","addDays","lastWeek","emptyDaysAtEnd","startOfWeekDate","startOfWeek","weekDaysList","i","useCalendar","useMemo","activeDateRangesEmitter","mitt_default","DEFAULT_CALENDAR_INSTANCE_ID","useOptimizedDayMetadata","baseMetadata","calendarInstanceId","metadata","setMetadata","useState","safeCalendarInstanceId","useEffect","handler","payload","ranges","instanceId","isStartOfRange","isEndOfRange","isRangeValid","state","getStateFields","prev","__spreadProps","__spreadValues","useColorScheme","baseTokens","lightTheme","__spreadProps","__spreadValues","darkTheme","createContext","useContext","useMemo","jsx","CalendarThemeContext","CalendarThemeProvider","children","colorScheme","calendarThemeContextValue","useCalendarTheme","useTheme","appearance","useColorScheme","colorScheme","useCalendarTheme","darkTheme","lightTheme","jsx","jsxs","styles","StyleSheet","buildBaseStyles","theme","baseContent","__spreadProps","__spreadValues","isPressed","isHovered","isStartOfRange","isEndOfRange","baseStyles","CalendarItemDay","onPress","children","height","metadata","textProps","CalendarPressableComponent","Pressable","baseTheme","useTheme","useMemo","handlePress","useCallback","isFocused","_a","_b","_c","_d","params","container","_e","content","Text","CalendarItemDayContainer","isStartOfWeek","shouldShowActiveDayFiller","daySpacing","dayHeight","spacerStyles","activeDayFiller","View","CalendarItemDayWithContainer","baseMetadata","containerTheme","calendarInstanceId","useOptimizedDayMetadata","memo","useMemo","View","StyleSheet","jsx","styles","StyleSheet","CalendarItemEmpty","memo","props","height","theme","containerStyles","useMemo","__spreadProps","__spreadValues","View","useMemo","StyleSheet","Text","View","jsx","styles","StyleSheet","lightTheme","CalendarItemWeekName","children","height","theme","textProps","colors","useTheme","containerStyles","contentStyles","useMemo","View","Text","__spreadProps","__spreadValues","useMemo","StyleSheet","Text","View","jsx","styles","StyleSheet","CalendarRowMonth","children","height","theme","baseTheme","useTheme","containerStyles","contentStyles","useMemo","View","Text","useMemo","StyleSheet","useMemo","StyleSheet","View","jsx","styles","HStack","alignItems","children","justifyContent","grow","shrink","spacing","wrap","backgroundColor","width","style","containerStyles","jsx","styles","StyleSheet","CalendarRowWeek","children","spacing","theme","containerStyles","useMemo","_a","__spreadValues","HStack","Children","Fragment","isValidElement","useMemo","StyleSheet","View","jsx","styles","StyleSheet","isFragment","child","isValidElement","Fragment","VStack","children","spacing","alignItems","justifyContent","grow","containerStyles","useMemo","__spreadProps","__spreadValues","View","Children","c","i","uppercaseFirstLetter","value","jsx","jsxs","BaseCalendar","memo","props","_a","calendarInstanceId","calendarRowVerticalSpacing","calendarRowHorizontalSpacing","calendarDayHeight","calendarMonthHeaderHeight","calendarWeekHeaderHeight","onCalendarDayPress","theme","CalendarPressableComponent","buildCalendarParams","__objRest","calendarRowMonth","weeksList","weekDaysList","useCalendar","VStack","CalendarRowMonth","uppercaseFirstLetter","CalendarRowWeek","weekDay","i","CalendarItemWeekName","week","index","dayProps","CalendarItemDayContainer","CalendarItemEmpty","CalendarItemDayWithContainer","Calendar","calendarActiveDateRanges","calendarMonthId","calendarColorScheme","otherProps","useEffect","activeDateRangesEmitter","CalendarThemeProvider","__spreadProps","__spreadValues","FlashList","forwardRef","memo","useCallback","useImperativeHandle","useLayoutEffect","useMemo","useRef","View","useCallback","useMemo","useState","pipe","a","ab","bc","cd","de","ef","fg","gh","hi","ret","i","buildMonthList","startingMonth","endingMonth","firstDayOfWeek","startingMonthId","toDateId","endingMonthId","months","getWeeksInMonth","numberOfMonths","differenceInMonths","i","month","addMonths","numberOfWeeks","getEndingMonth","calendarFutureScrollRange","calendarMaxDateId","baseDate","endingMonthFromRange","newEndingMonthId","safeMaxDateId","startOfMonth","fromDateId","getStartingMonth","calendarPastScrollRange","calendarMinDateId","startingMonthFromRange","subMonths","newStartingMonthId","safeMinDateId","pipe","useCalendarList","calendarInitialMonthId","calendarPastScrollRangeInMonths","calendarFutureScrollRangeInMonths","calendarFirstDayOfWeek","initialMonth","initialMonthId","useMemo","baseStartOfMonth","monthList","setMonthList","useState","currentMonth","appendMonths","useCallback","m","newMonths","newMonthList","prependMonths","addMissingMonths","targetMonthId","firstMonth","lastMonth","initialMonthIndex","getHeightForMonth","vSpacing","day","weekName","header","extraHeight","calendarMonth","calendarSpacing","headerHeight","daysHeight","jsx","keyExtractor","month","CalendarList","memo","forwardRef","props","ref","_a","calendarInitialMonthId","calendarPastScrollRangeInMonths","calendarFutureScrollRangeInMonths","calendarFirstDayOfWeek","CalendarScrollComponent","FlashList","calendarFormatLocale","calendarSpacing","calendarRowHorizontalSpacing","calendarRowVerticalSpacing","calendarMonthHeaderHeight","calendarDayHeight","calendarWeekHeaderHeight","calendarAdditionalHeight","calendarColorScheme","theme","onEndReached","_b","__objRest","calendarActiveDateRanges","calendarDisabledDateIds","calendarInstanceId","calendarMaxDateId","calendarMinDateId","getCalendarDayFormat","getCalendarMonthFormat","getCalendarWeekDayFormat","onCalendarDayPress","CalendarPressableComponent","flatListProps","calendarProps","useMemo","initialMonthIndex","monthList","appendMonths","addMissingMonths","useCalendarList","monthListWithCalendarProps","__spreadProps","__spreadValues","handleOnEndReached","useCallback","getScrollOffsetForMonth","date","monthId","toDateId","startOfMonth","baseMonthList","index","acc","currentHeight","getHeightForMonth","flashListRef","useRef","useLayoutEffect","useImperativeHandle","animated","additionalOffset","currentMonthOffset","weekOfMonthIndex","getWeekOfMonth","rowHeight","weekOffset","offset","calendarContainerStyle","item","View","Calendar","CalendarItemDayWithNamespace","CalendarItemDay","CalendarItemDayContainer","CalendarItemDayWithContainer","CalendarItemWithNamespace","CalendarItemWeekName","CalendarItemEmpty","CalendarRowWithNamespace","CalendarRowMonth","CalendarRowWeek","CalendarWithNamespace","Calendar","CalendarList","HStack","VStack","useCallback","useMemo","useState","useDateRange","initialDateRange","dateRange","setDateRange","useState","onCalendarDayPress","useCallback","dateId","prev","__spreadProps","__spreadValues","onClearDateRange","useMemo","calendarActiveDateRanges","isDateRangeValid"]}