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Y,EAAyBd,EAAUC,GAAa4C,EAAAA,EAAoBA,CACtE,OAAOtC,EAAkBjD,KAAAA,GAAyB4C,EACpD,ESasCmB,EAAKsB,GACrC3D,GAAS3B,CAAAA,EAAS2B,OAAO,CAAGA,CAAAA,EAIhC,IAAMC,EAAU6D,SH9BkB9C,CAAQ,CAAEC,CAAS,CAAE3C,CAAO,EAC9D,IAAM4C,EAAOY,EAAyBd,EAAUC,GAAa,IAC7D,OAAOM,EAAkBjD,KAAAA,GAAyB4C,EACpD,EG2BsCmB,EAFX3C,EAAIiE,EAAkB,CAAE3D,QAAS3B,EAAS2B,OAAO,IAK1E,OAFIC,GAAS5B,CAAAA,EAAS4B,OAAO,CAAGA,CAAAA,EAEzB5B,CACT","sources":["webpack://_N_E/./node_modules/date-fns/addDays.mjs","webpack://_N_E/./node_modules/date-fns/addMilliseconds.mjs","webpack://_N_E/./node_modules/date-fns/addHours.mjs","webpack://_N_E/./node_modules/date-fns/endOfDay.mjs","webpack://_N_E/./node_modules/date-fns/formatDuration.mjs","webpack://_N_E/./node_modules/date-fns/addMonths.mjs","webpack://_N_E/./node_modules/date-fns/add.mjs","webpack://_N_E/./node_modules/date-fns/differenceInDays.mjs","webpack://_N_E/./node_modules/date-fns/_lib/getRoundingMethod.mjs","webpack://_N_E/./node_modules/date-fns/differenceInMilliseconds.mjs","webpack://_N_E/./node_modules/date-fns/differenceInHours.mjs","webpack://_N_E/./node_modules/date-fns/differenceInMinutes.mjs","webpack://_N_E/./node_modules/date-fns/compareAsc.mjs","webpack://_N_E/./node_modules/date-fns/differenceInCalendarMonths.mjs","webpack://_N_E/./node_modules/date-fns/endOfMonth.mjs","webpack://_N_E/./node_modules/date-fns/isLastDayOfMonth.mjs","webpack://_N_E/./node_modules/date-fns/differenceInMonths.mjs","webpack://_N_E/./node_modules/date-fns/differenceInSeconds.mjs","webpack://_N_E/./node_modules/date-fns/differenceInCalendarYears.mjs","webpack://_N_E/./node_modules/date-fns/differenceInYears.mjs","webpack://_N_E/./node_modules/date-fns/intervalToDuration.mjs"],"sourcesContent":["import { toDate } from \"./toDate.mjs\";\nimport { constructFrom } from \"./constructFrom.mjs\";\n\n/**\n * @name addDays\n * @category Day Helpers\n * @summary Add the specified number of days to the given date.\n *\n * @description\n * Add the specified number of days to the given date.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n *\n * @param date - The date to be changed\n * @param amount - The amount of days to be added.\n *\n * @returns The new date with the days added\n *\n * @example\n * // Add 10 days to 1 September 2014:\n * const result = addDays(new Date(2014, 8, 1), 10)\n * //=> Thu Sep 11 2014 00:00:00\n */\nexport function addDays(date, amount) {\n const _date = toDate(date);\n if (isNaN(amount)) return constructFrom(date, NaN);\n if (!amount) {\n // If 0 days, no-op to avoid changing times in the hour before end of DST\n return _date;\n }\n _date.setDate(_date.getDate() + amount);\n return _date;\n}\n\n// Fallback for modularized imports:\nexport default addDays;\n","import { toDate } from \"./toDate.mjs\";\nimport { constructFrom } from \"./constructFrom.mjs\";\n\n/**\n * @name addMilliseconds\n * @category Millisecond Helpers\n * @summary Add the specified number of milliseconds to the given date.\n *\n * @description\n * Add the specified number of milliseconds to the given date.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n *\n * @param date - The date to be changed\n * @param amount - The amount of milliseconds to be added.\n *\n * @returns The new date with the milliseconds added\n *\n * @example\n * // Add 750 milliseconds to 10 July 2014 12:45:30.000:\n * const result = addMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)\n * //=> Thu Jul 10 2014 12:45:30.750\n */\nexport function addMilliseconds(date, amount) {\n const timestamp = +toDate(date);\n return constructFrom(date, timestamp + amount);\n}\n\n// Fallback for modularized imports:\nexport default addMilliseconds;\n","import { addMilliseconds } from \"./addMilliseconds.mjs\";\nimport { millisecondsInHour } from \"./constants.mjs\";\n\n/**\n * @name addHours\n * @category Hour Helpers\n * @summary Add the specified number of hours to the given date.\n *\n * @description\n * Add the specified number of hours to the given date.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n *\n * @param date - The date to be changed\n * @param amount - The amount of hours to be added.\n *\n * @returns The new date with the hours added\n *\n * @example\n * // Add 2 hours to 10 July 2014 23:00:00:\n * const result = addHours(new Date(2014, 6, 10, 23, 0), 2)\n * //=> Fri Jul 11 2014 01:00:00\n */\nexport function addHours(date, amount) {\n return addMilliseconds(date, amount * millisecondsInHour);\n}\n\n// Fallback for modularized imports:\nexport default addHours;\n","import { toDate } from \"./toDate.mjs\";\n\n/**\n * @name endOfDay\n * @category Day Helpers\n * @summary Return the end of a day for the given date.\n *\n * @description\n * Return the end of a day for the given date.\n * The result will be in the local timezone.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n *\n * @param date - The original date\n *\n * @returns The end of a day\n *\n * @example\n * // The end of a day for 2 September 2014 11:55:00:\n * const result = endOfDay(new Date(2014, 8, 2, 11, 55, 0))\n * //=> Tue Sep 02 2014 23:59:59.999\n */\nexport function endOfDay(date) {\n const _date = toDate(date);\n _date.setHours(23, 59, 59, 999);\n return _date;\n}\n\n// Fallback for modularized imports:\nexport default endOfDay;\n","import { defaultLocale } from \"./_lib/defaultLocale.mjs\";\nimport { getDefaultOptions } from \"./_lib/defaultOptions.mjs\";\n\n/**\n * The {@link formatDuration} function options.\n */\n\nconst defaultFormat = [\n \"years\",\n \"months\",\n \"weeks\",\n \"days\",\n \"hours\",\n \"minutes\",\n \"seconds\",\n];\n\n/**\n * @name formatDuration\n * @category Common Helpers\n * @summary Formats a duration in human-readable format\n *\n * @description\n * Return human-readable duration string i.e. \"9 months 2 days\"\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n *\n * @param duration - The duration to format\n * @param options - An object with options.\n *\n * @returns The formatted date string\n *\n * @example\n * // Format full duration\n * formatDuration({\n * years: 2,\n * months: 9,\n * weeks: 1,\n * days: 7,\n * hours: 5,\n * minutes: 9,\n * seconds: 30\n * })\n * //=> '2 years 9 months 1 week 7 days 5 hours 9 minutes 30 seconds'\n *\n * @example\n * // Format partial duration\n * formatDuration({ months: 9, days: 2 })\n * //=> '9 months 2 days'\n *\n * @example\n * // Customize the format\n * formatDuration(\n * {\n * years: 2,\n * months: 9,\n * weeks: 1,\n * days: 7,\n * hours: 5,\n * minutes: 9,\n * seconds: 30\n * },\n * { format: ['months', 'weeks'] }\n * ) === '9 months 1 week'\n *\n * @example\n * // Customize the zeros presence\n * formatDuration({ years: 0, months: 9 })\n * //=> '9 months'\n * formatDuration({ years: 0, months: 9 }, { zero: true })\n * //=> '0 years 9 months'\n *\n * @example\n * // Customize the delimiter\n * formatDuration({ years: 2, months: 9, weeks: 3 }, { delimiter: ', ' })\n * //=> '2 years, 9 months, 3 weeks'\n */\nexport function formatDuration(duration, options) {\n const defaultOptions = getDefaultOptions();\n const locale = options?.locale ?? defaultOptions.locale ?? defaultLocale;\n const format = options?.format ?? defaultFormat;\n const zero = options?.zero ?? false;\n const delimiter = options?.delimiter ?? \" \";\n\n if (!locale.formatDistance) {\n return \"\";\n }\n\n const result = format\n .reduce((acc, unit) => {\n const token = `x${unit.replace(/(^.)/, (m) => m.toUpperCase())}`;\n const value = duration[unit];\n if (value !== undefined && (zero || duration[unit])) {\n return acc.concat(locale.formatDistance(token, value));\n }\n return acc;\n }, [])\n .join(delimiter);\n\n return result;\n}\n\n// Fallback for modularized imports:\nexport default formatDuration;\n","import { toDate } from \"./toDate.mjs\";\nimport { constructFrom } from \"./constructFrom.mjs\";\n\n/**\n * @name addMonths\n * @category Month Helpers\n * @summary Add the specified number of months to the given date.\n *\n * @description\n * Add the specified number of months to the given date.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n *\n * @param date - The date to be changed\n * @param amount - The amount of months to be added.\n *\n * @returns The new date with the months added\n *\n * @example\n * // Add 5 months to 1 September 2014:\n * const result = addMonths(new Date(2014, 8, 1), 5)\n * //=> Sun Feb 01 2015 00:00:00\n *\n * // Add one month to 30 January 2023:\n * const result = addMonths(new Date(2023, 0, 30), 1)\n * //=> Tue Feb 28 2023 00:00:00\n */\nexport function addMonths(date, amount) {\n const _date = toDate(date);\n if (isNaN(amount)) return constructFrom(date, NaN);\n if (!amount) {\n // If 0 months, no-op to avoid changing times in the hour before end of DST\n return _date;\n }\n const dayOfMonth = _date.getDate();\n\n // The JS Date object supports date math by accepting out-of-bounds values for\n // month, day, etc. For example, new Date(2020, 0, 0) returns 31 Dec 2019 and\n // new Date(2020, 13, 1) returns 1 Feb 2021. This is *almost* the behavior we\n // want except that dates will wrap around the end of a month, meaning that\n // new Date(2020, 13, 31) will return 3 Mar 2021 not 28 Feb 2021 as desired. So\n // we'll default to the end of the desired month by adding 1 to the desired\n // month and using a date of 0 to back up one day to the end of the desired\n // month.\n const endOfDesiredMonth = constructFrom(date, _date.getTime());\n endOfDesiredMonth.setMonth(_date.getMonth() + amount + 1, 0);\n const daysInMonth = endOfDesiredMonth.getDate();\n if (dayOfMonth >= daysInMonth) {\n // If we're already at the end of the month, then this is the correct date\n // and we're done.\n return endOfDesiredMonth;\n } else {\n // Otherwise, we now know that setting the original day-of-month value won't\n // cause an overflow, so set the desired day-of-month. Note that we can't\n // just set the date of `endOfDesiredMonth` because that object may have had\n // its time changed in the unusual case where where a DST transition was on\n // the last day of the month and its local time was in the hour skipped or\n // repeated next to a DST transition. So we use `date` instead which is\n // guaranteed to still have the original time.\n _date.setFullYear(\n endOfDesiredMonth.getFullYear(),\n endOfDesiredMonth.getMonth(),\n dayOfMonth,\n );\n return _date;\n }\n}\n\n// Fallback for modularized imports:\nexport default addMonths;\n","import { addDays } from \"./addDays.mjs\";\nimport { addMonths } from \"./addMonths.mjs\";\nimport { constructFrom } from \"./constructFrom.mjs\";\nimport { toDate } from \"./toDate.mjs\";\n\n/**\n * @name add\n * @category Common Helpers\n * @summary Add the specified years, months, weeks, days, hours, minutes and seconds to the given date.\n *\n * @description\n * Add the specified years, months, weeks, days, hours, minutes and seconds to the given date.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n *\n * @param date - The date to be changed\n * @param duration - The object with years, months, weeks, days, hours, minutes and seconds to be added.\n *\n * | Key | Description |\n * |----------------|------------------------------------|\n * | years | Amount of years to be added |\n * | months | Amount of months to be added |\n * | weeks | Amount of weeks to be added |\n * | days | Amount of days to be added |\n * | hours | Amount of hours to be added |\n * | minutes | Amount of minutes to be added |\n * | seconds | Amount of seconds to be added |\n *\n * All values default to 0\n *\n * @returns The new date with the seconds added\n *\n * @example\n * // Add the following duration to 1 September 2014, 10:19:50\n * const result = add(new Date(2014, 8, 1, 10, 19, 50), {\n * years: 2,\n * months: 9,\n * weeks: 1,\n * days: 7,\n * hours: 5,\\\\-7\n * minutes: 9,\n * seconds: 30,\n * })\n * //=> Thu Jun 15 2017 15:29:20\n */\nexport function add(date, duration) {\n const {\n years = 0,\n months = 0,\n weeks = 0,\n days = 0,\n hours = 0,\n minutes = 0,\n seconds = 0,\n } = duration;\n\n // Add years and months\n const _date = toDate(date);\n const dateWithMonths =\n months || years ? addMonths(_date, months + years * 12) : _date;\n\n // Add weeks and days\n const dateWithDays =\n days || weeks ? addDays(dateWithMonths, days + weeks * 7) : dateWithMonths;\n\n // Add days, hours, minutes and seconds\n const minutesToAdd = minutes + hours * 60;\n const secondsToAdd = seconds + minutesToAdd * 60;\n const msToAdd = secondsToAdd * 1000;\n const finalDate = constructFrom(date, dateWithDays.getTime() + msToAdd);\n\n return finalDate;\n}\n\n// Fallback for modularized imports:\nexport default add;\n","import { differenceInCalendarDays } from \"./differenceInCalendarDays.mjs\";\nimport { toDate } from \"./toDate.mjs\";\n\n/**\n * @name differenceInDays\n * @category Day Helpers\n * @summary Get the number of full days between the given dates.\n *\n * @description\n * Get the number of full day periods between two dates. Fractional days are\n * truncated towards zero.\n *\n * One \"full day\" is the distance between a local time in one day to the same\n * local time on the next or previous day. A full day can sometimes be less than\n * or more than 24 hours if a daylight savings change happens between two dates.\n *\n * To ignore DST and only measure exact 24-hour periods, use this instead:\n * `Math.trunc(differenceInHours(dateLeft, dateRight)/24)|0`.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n *\n * @param dateLeft - The later date\n * @param dateRight - The earlier date\n *\n * @returns The number of full days according to the local timezone\n *\n * @example\n * // How many full days are between\n * // 2 July 2011 23:00:00 and 2 July 2012 00:00:00?\n * const result = differenceInDays(\n * new Date(2012, 6, 2, 0, 0),\n * new Date(2011, 6, 2, 23, 0)\n * )\n * //=> 365\n *\n * @example\n * // How many full days are between\n * // 2 July 2011 23:59:00 and 3 July 2011 00:01:00?\n * const result = differenceInDays(\n * new Date(2011, 6, 3, 0, 1),\n * new Date(2011, 6, 2, 23, 59)\n * )\n * //=> 0\n *\n * @example\n * // How many full days are between\n * // 1 March 2020 0:00 and 1 June 2020 0:00 ?\n * // Note: because local time is used, the\n * // result will always be 92 days, even in\n * // time zones where DST starts and the\n * // period has only 92*24-1 hours.\n * const result = differenceInDays(\n * new Date(2020, 5, 1),\n * new Date(2020, 2, 1)\n * )\n * //=> 92\n */\nexport function differenceInDays(dateLeft, dateRight) {\n const _dateLeft = toDate(dateLeft);\n const _dateRight = toDate(dateRight);\n\n const sign = compareLocalAsc(_dateLeft, _dateRight);\n const difference = Math.abs(differenceInCalendarDays(_dateLeft, _dateRight));\n\n _dateLeft.setDate(_dateLeft.getDate() - sign * difference);\n\n // Math.abs(diff in full days - diff in calendar days) === 1 if last calendar day is not full\n // If so, result must be decreased by 1 in absolute value\n const isLastDayNotFull = Number(\n compareLocalAsc(_dateLeft, _dateRight) === -sign,\n );\n const result = sign * (difference - isLastDayNotFull);\n // Prevent negative zero\n return result === 0 ? 0 : result;\n}\n\n// Like `compareAsc` but uses local time not UTC, which is needed\n// for accurate equality comparisons of UTC timestamps that end up\n// having the same representation in local time, e.g. one hour before\n// DST ends vs. the instant that DST ends.\nfunction compareLocalAsc(dateLeft, dateRight) {\n const diff =\n dateLeft.getFullYear() - dateRight.getFullYear() ||\n dateLeft.getMonth() - dateRight.getMonth() ||\n dateLeft.getDate() - dateRight.getDate() ||\n dateLeft.getHours() - dateRight.getHours() ||\n dateLeft.getMinutes() - dateRight.getMinutes() ||\n dateLeft.getSeconds() - dateRight.getSeconds() ||\n dateLeft.getMilliseconds() - dateRight.getMilliseconds();\n\n if (diff < 0) {\n return -1;\n } else if (diff > 0) {\n return 1;\n // Return 0 if diff is 0; return NaN if diff is NaN\n } else {\n return diff;\n }\n}\n\n// Fallback for modularized imports:\nexport default differenceInDays;\n","export function getRoundingMethod(method) {\n return (number) => {\n const round = method ? Math[method] : Math.trunc;\n const result = round(number);\n // Prevent negative zero\n return result === 0 ? 0 : result;\n };\n}\n","import { toDate } from \"./toDate.mjs\";\n\n/**\n * @name differenceInMilliseconds\n * @category Millisecond Helpers\n * @summary Get the number of milliseconds between the given dates.\n *\n * @description\n * Get the number of milliseconds between the given dates.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n *\n * @param dateLeft - The later date\n * @param dateRight - The earlier date\n *\n * @returns The number of milliseconds\n *\n * @example\n * // How many milliseconds are between\n * // 2 July 2014 12:30:20.600 and 2 July 2014 12:30:21.700?\n * const result = differenceInMilliseconds(\n * new Date(2014, 6, 2, 12, 30, 21, 700),\n * new Date(2014, 6, 2, 12, 30, 20, 600)\n * )\n * //=> 1100\n */\nexport function differenceInMilliseconds(dateLeft, dateRight) {\n return +toDate(dateLeft) - +toDate(dateRight);\n}\n\n// Fallback for modularized imports:\nexport default differenceInMilliseconds;\n","import { getRoundingMethod } from \"./_lib/getRoundingMethod.mjs\";\nimport { millisecondsInHour } from \"./constants.mjs\";\nimport { differenceInMilliseconds } from \"./differenceInMilliseconds.mjs\";\n\n/**\n * The {@link differenceInHours} function options.\n */\n\n/**\n * @name differenceInHours\n * @category Hour Helpers\n * @summary Get the number of hours between the given dates.\n *\n * @description\n * Get the number of hours between the given dates.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n *\n * @param dateLeft - The later date\n * @param dateRight - The earlier date\n * @param options - An object with options.\n *\n * @returns The number of hours\n *\n * @example\n * // How many hours are between 2 July 2014 06:50:00 and 2 July 2014 19:00:00?\n * const result = differenceInHours(\n * new Date(2014, 6, 2, 19, 0),\n * new Date(2014, 6, 2, 6, 50)\n * )\n * //=> 12\n */\nexport function differenceInHours(dateLeft, dateRight, options) {\n const diff =\n differenceInMilliseconds(dateLeft, dateRight) / millisecondsInHour;\n return getRoundingMethod(options?.roundingMethod)(diff);\n}\n\n// Fallback for modularized imports:\nexport default differenceInHours;\n","import { getRoundingMethod } from \"./_lib/getRoundingMethod.mjs\";\nimport { millisecondsInMinute } from \"./constants.mjs\";\nimport { differenceInMilliseconds } from \"./differenceInMilliseconds.mjs\";\n\n/**\n * The {@link differenceInMinutes} function options.\n */\n\n/**\n * @name differenceInMinutes\n * @category Minute Helpers\n * @summary Get the number of minutes between the given dates.\n *\n * @description\n * Get the signed number of full (rounded towards 0) minutes between the given dates.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n *\n * @param dateLeft - The later date\n * @param dateRight - The earlier date\n * @param options - An object with options.\n *\n * @returns The number of minutes\n *\n * @example\n * // How many minutes are between 2 July 2014 12:07:59 and 2 July 2014 12:20:00?\n * const result = differenceInMinutes(\n * new Date(2014, 6, 2, 12, 20, 0),\n * new Date(2014, 6, 2, 12, 7, 59)\n * )\n * //=> 12\n *\n * @example\n * // How many minutes are between 10:01:59 and 10:00:00\n * const result = differenceInMinutes(\n * new Date(2000, 0, 1, 10, 0, 0),\n * new Date(2000, 0, 1, 10, 1, 59)\n * )\n * //=> -1\n */\nexport function differenceInMinutes(dateLeft, dateRight, options) {\n const diff =\n differenceInMilliseconds(dateLeft, dateRight) / millisecondsInMinute;\n return getRoundingMethod(options?.roundingMethod)(diff);\n}\n\n// Fallback for modularized imports:\nexport default differenceInMinutes;\n","import { toDate } from \"./toDate.mjs\";\n\n/**\n * @name compareAsc\n * @category Common Helpers\n * @summary Compare the two dates and return -1, 0 or 1.\n *\n * @description\n * Compare the two dates and return 1 if the first date is after the second,\n * -1 if the first date is before the second or 0 if dates are equal.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n *\n * @param dateLeft - The first date to compare\n * @param dateRight - The second date to compare\n *\n * @returns The result of the comparison\n *\n * @example\n * // Compare 11 February 1987 and 10 July 1989:\n * const result = compareAsc(new Date(1987, 1, 11), new Date(1989, 6, 10))\n * //=> -1\n *\n * @example\n * // Sort the array of dates:\n * const result = [\n * new Date(1995, 6, 2),\n * new Date(1987, 1, 11),\n * new Date(1989, 6, 10)\n * ].sort(compareAsc)\n * //=> [\n * // Wed Feb 11 1987 00:00:00,\n * // Mon Jul 10 1989 00:00:00,\n * // Sun Jul 02 1995 00:00:00\n * // ]\n */\nexport function compareAsc(dateLeft, dateRight) {\n const _dateLeft = toDate(dateLeft);\n const _dateRight = toDate(dateRight);\n\n const diff = _dateLeft.getTime() - _dateRight.getTime();\n\n if (diff < 0) {\n return -1;\n } else if (diff > 0) {\n return 1;\n // Return 0 if diff is 0; return NaN if diff is NaN\n } else {\n return diff;\n }\n}\n\n// Fallback for modularized imports:\nexport default compareAsc;\n","import { toDate } from \"./toDate.mjs\";\n\n/**\n * @name differenceInCalendarMonths\n * @category Month Helpers\n * @summary Get the number of calendar months between the given dates.\n *\n * @description\n * Get the number of calendar months between the given dates.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n *\n * @param dateLeft - The later date\n * @param dateRight - The earlier date\n *\n * @returns The number of calendar months\n *\n * @example\n * // How many calendar months are between 31 January 2014 and 1 September 2014?\n * const result = differenceInCalendarMonths(\n * new Date(2014, 8, 1),\n * new Date(2014, 0, 31)\n * )\n * //=> 8\n */\nexport function differenceInCalendarMonths(dateLeft, dateRight) {\n const _dateLeft = toDate(dateLeft);\n const _dateRight = toDate(dateRight);\n\n const yearDiff = _dateLeft.getFullYear() - _dateRight.getFullYear();\n const monthDiff = _dateLeft.getMonth() - _dateRight.getMonth();\n\n return yearDiff * 12 + monthDiff;\n}\n\n// Fallback for modularized imports:\nexport default differenceInCalendarMonths;\n","import { toDate } from \"./toDate.mjs\";\n\n/**\n * @name endOfMonth\n * @category Month Helpers\n * @summary Return the end of a month for the given date.\n *\n * @description\n * Return the end of a month for the given date.\n * The result will be in the local timezone.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n *\n * @param date - The original date\n *\n * @returns The end of a month\n *\n * @example\n * // The end of a month for 2 September 2014 11:55:00:\n * const result = endOfMonth(new Date(2014, 8, 2, 11, 55, 0))\n * //=> Tue Sep 30 2014 23:59:59.999\n */\nexport function endOfMonth(date) {\n const _date = toDate(date);\n const month = _date.getMonth();\n _date.setFullYear(_date.getFullYear(), month + 1, 0);\n _date.setHours(23, 59, 59, 999);\n return _date;\n}\n\n// Fallback for modularized imports:\nexport default endOfMonth;\n","import { endOfDay } from \"./endOfDay.mjs\";\nimport { endOfMonth } from \"./endOfMonth.mjs\";\nimport { toDate } from \"./toDate.mjs\";\n\n/**\n * @name isLastDayOfMonth\n * @category Month Helpers\n * @summary Is the given date the last day of a month?\n *\n * @description\n * Is the given date the last day of a month?\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n *\n * @param date - The date to check\n\n * @returns The date is the last day of a month\n *\n * @example\n * // Is 28 February 2014 the last day of a month?\n * const result = isLastDayOfMonth(new Date(2014, 1, 28))\n * //=> true\n */\nexport function isLastDayOfMonth(date) {\n const _date = toDate(date);\n return +endOfDay(_date) === +endOfMonth(_date);\n}\n\n// Fallback for modularized imports:\nexport default isLastDayOfMonth;\n","import { compareAsc } from \"./compareAsc.mjs\";\nimport { differenceInCalendarMonths } from \"./differenceInCalendarMonths.mjs\";\nimport { isLastDayOfMonth } from \"./isLastDayOfMonth.mjs\";\nimport { toDate } from \"./toDate.mjs\";\n\n/**\n * @name differenceInMonths\n * @category Month Helpers\n * @summary Get the number of full months between the given dates.\n *\n * @description\n * Get the number of full months between the given dates using trunc as a default rounding method.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n *\n * @param dateLeft - The later date\n * @param dateRight - The earlier date\n *\n * @returns The number of full months\n *\n * @example\n * // How many full months are between 31 January 2014 and 1 September 2014?\n * const result = differenceInMonths(new Date(2014, 8, 1), new Date(2014, 0, 31))\n * //=> 7\n */\nexport function differenceInMonths(dateLeft, dateRight) {\n const _dateLeft = toDate(dateLeft);\n const _dateRight = toDate(dateRight);\n\n const sign = compareAsc(_dateLeft, _dateRight);\n const difference = Math.abs(\n differenceInCalendarMonths(_dateLeft, _dateRight),\n );\n let result;\n\n // Check for the difference of less than month\n if (difference < 1) {\n result = 0;\n } else {\n if (_dateLeft.getMonth() === 1 && _dateLeft.getDate() > 27) {\n // This will check if the date is end of Feb and assign a higher end of month date\n // to compare it with Jan\n _dateLeft.setDate(30);\n }\n\n _dateLeft.setMonth(_dateLeft.getMonth() - sign * difference);\n\n // Math.abs(diff in full months - diff in calendar months) === 1 if last calendar month is not full\n // If so, result must be decreased by 1 in absolute value\n let isLastMonthNotFull = compareAsc(_dateLeft, _dateRight) === -sign;\n\n // Check for cases of one full calendar month\n if (\n isLastDayOfMonth(toDate(dateLeft)) &&\n difference === 1 &&\n compareAsc(dateLeft, _dateRight) === 1\n ) {\n isLastMonthNotFull = false;\n }\n\n result = sign * (difference - Number(isLastMonthNotFull));\n }\n\n // Prevent negative zero\n return result === 0 ? 0 : result;\n}\n\n// Fallback for modularized imports:\nexport default differenceInMonths;\n","import { getRoundingMethod } from \"./_lib/getRoundingMethod.mjs\";\nimport { differenceInMilliseconds } from \"./differenceInMilliseconds.mjs\";\n\n/**\n * The {@link differenceInSeconds} function options.\n */\n\n/**\n * @name differenceInSeconds\n * @category Second Helpers\n * @summary Get the number of seconds between the given dates.\n *\n * @description\n * Get the number of seconds between the given dates.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n *\n * @param dateLeft - The later date\n * @param dateRight - The earlier date\n * @param options - An object with options.\n *\n * @returns The number of seconds\n *\n * @example\n * // How many seconds are between\n * // 2 July 2014 12:30:07.999 and 2 July 2014 12:30:20.000?\n * const result = differenceInSeconds(\n * new Date(2014, 6, 2, 12, 30, 20, 0),\n * new Date(2014, 6, 2, 12, 30, 7, 999)\n * )\n * //=> 12\n */\nexport function differenceInSeconds(dateLeft, dateRight, options) {\n const diff = differenceInMilliseconds(dateLeft, dateRight) / 1000;\n return getRoundingMethod(options?.roundingMethod)(diff);\n}\n\n// Fallback for modularized imports:\nexport default differenceInSeconds;\n","import { toDate } from \"./toDate.mjs\";\n\n/**\n * @name differenceInCalendarYears\n * @category Year Helpers\n * @summary Get the number of calendar years between the given dates.\n *\n * @description\n * Get the number of calendar years between the given dates.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n *\n * @param dateLeft - The later date\n * @param dateRight - The earlier date\n\n * @returns The number of calendar years\n *\n * @example\n * // How many calendar years are between 31 December 2013 and 11 February 2015?\n * const result = differenceInCalendarYears(\n * new Date(2015, 1, 11),\n * new Date(2013, 11, 31)\n * )\n * //=> 2\n */\nexport function differenceInCalendarYears(dateLeft, dateRight) {\n const _dateLeft = toDate(dateLeft);\n const _dateRight = toDate(dateRight);\n\n return _dateLeft.getFullYear() - _dateRight.getFullYear();\n}\n\n// Fallback for modularized imports:\nexport default differenceInCalendarYears;\n","import { compareAsc } from \"./compareAsc.mjs\";\nimport { differenceInCalendarYears } from \"./differenceInCalendarYears.mjs\";\nimport { toDate } from \"./toDate.mjs\";\n\n/**\n * @name differenceInYears\n * @category Year Helpers\n * @summary Get the number of full years between the given dates.\n *\n * @description\n * Get the number of full years between the given dates.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n *\n * @param dateLeft - The later date\n * @param dateRight - The earlier date\n *\n * @returns The number of full years\n *\n * @example\n * // How many full years are between 31 December 2013 and 11 February 2015?\n * const result = differenceInYears(new Date(2015, 1, 11), new Date(2013, 11, 31))\n * //=> 1\n */\nexport function differenceInYears(dateLeft, dateRight) {\n const _dateLeft = toDate(dateLeft);\n const _dateRight = toDate(dateRight);\n\n const sign = compareAsc(_dateLeft, _dateRight);\n const difference = Math.abs(differenceInCalendarYears(_dateLeft, _dateRight));\n\n // Set both dates to a valid leap year for accurate comparison when dealing\n // with leap days\n _dateLeft.setFullYear(1584);\n _dateRight.setFullYear(1584);\n\n // Math.abs(diff in full years - diff in calendar years) === 1 if last calendar year is not full\n // If so, result must be decreased by 1 in absolute value\n const isLastYearNotFull = compareAsc(_dateLeft, _dateRight) === -sign;\n const result = sign * (difference - +isLastYearNotFull);\n\n // Prevent negative zero\n return result === 0 ? 0 : result;\n}\n\n// Fallback for modularized imports:\nexport default differenceInYears;\n","import { add } from \"./add.mjs\";\nimport { differenceInDays } from \"./differenceInDays.mjs\";\nimport { differenceInHours } from \"./differenceInHours.mjs\";\nimport { differenceInMinutes } from \"./differenceInMinutes.mjs\";\nimport { differenceInMonths } from \"./differenceInMonths.mjs\";\nimport { differenceInSeconds } from \"./differenceInSeconds.mjs\";\nimport { differenceInYears } from \"./differenceInYears.mjs\";\nimport { toDate } from \"./toDate.mjs\";\n\n/**\n * @name intervalToDuration\n * @category Common Helpers\n * @summary Convert interval to duration\n *\n * @description\n * Convert a interval object to a duration object.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n *\n * @param interval - The interval to convert to duration\n *\n * @returns The duration object\n *\n * @example\n * // Get the duration between January 15, 1929 and April 4, 1968.\n * intervalToDuration({\n * start: new Date(1929, 0, 15, 12, 0, 0),\n * end: new Date(1968, 3, 4, 19, 5, 0)\n * })\n * // => { years: 39, months: 2, days: 20, hours: 7, minutes: 5, seconds: 0 }\n */\nexport function intervalToDuration(interval) {\n const start = toDate(interval.start);\n const end = toDate(interval.end);\n\n const duration = {};\n\n const years = differenceInYears(end, start);\n if (years) duration.years = years;\n\n const remainingMonths = add(start, { years: duration.years });\n\n const months = differenceInMonths(end, remainingMonths);\n if (months) duration.months = months;\n\n const remainingDays = add(remainingMonths, { months: duration.months });\n\n const days = differenceInDays(end, remainingDays);\n if (days) duration.days = days;\n\n const remainingHours = add(remainingDays, { days: duration.days });\n\n const hours = differenceInHours(end, remainingHours);\n if (hours) duration.hours = hours;\n\n const remainingMinutes = add(remainingHours, { hours: duration.hours });\n\n const minutes = differenceInMinutes(end, remainingMinutes);\n if (minutes) duration.minutes = minutes;\n\n const remainingSeconds = add(remainingMinutes, { minutes: duration.minutes });\n\n const seconds = differenceInSeconds(end, remainingSeconds);\n if (seconds) duration.seconds = seconds;\n\n return duration;\n}\n\n// Fallback for modularized imports:\nexport default intervalToDuration;\n"],"names":["addDays","date","amount","_date","toDate","constructFrom","NaN","setDate","getDate","addHours","addMilliseconds","timestamp","millisecondsInHour","endOfDay","setHours","defaultFormat","formatDuration","duration","options","defaultOptions","getDefaultOptions","locale","defaultLocale","format","zero","delimiter","formatDistance","reduce","acc","unit","token","concat","replace","m","toUpperCase","value","undefined","join","add","years","months","weeks","days","hours","minutes","seconds","dateWithMonths","addMonths","isNaN","dayOfMonth","endOfDesiredMonth","getTime","setMonth","getMonth","setFullYear","getFullYear","dateWithDays","secondsToAdd","minutesToAdd","compareLocalAsc","dateLeft","dateRight","diff","getHours","getMinutes","getSeconds","getMilliseconds","getRoundingMethod","method","result","round","Math","trunc","number","differenceInMilliseconds","compareAsc","_dateLeft","_dateRight","intervalToDuration","interval","start","end","differenceInYears","sign","difference","abs","differenceInCalendarYears","isLastYearNotFull","remainingMonths","differenceInMonths","differenceInCalendarMonths","yearDiff","isLastMonthNotFull","isLastDayOfMonth","endOfMonth","month","Number","remainingDays","differenceInDays","differenceInCalendarDays","isLastDayNotFull","remainingHours","differenceInHours","remainingMinutes","differenceInMinutes","millisecondsInMinute","differenceInSeconds"],"sourceRoot":""}