@brainfish-ai/components 0.23.3 → 0.23.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/articles-coverage.d.ts +41 -0
- package/dist/esm/chunks/{chart.BmBO7tNe.js → chart.4ZbtBMmR.js} +2 -2
- package/dist/esm/chunks/chart.4ZbtBMmR.js.map +1 -0
- package/dist/esm/chunks/{formatDate.CuWGpZ_T.js → formatDate.CWN6IFKq.js} +3 -1
- package/dist/esm/chunks/{formatDate.CuWGpZ_T.js.map → formatDate.CWN6IFKq.js.map} +1 -1
- package/dist/esm/chunks/{review-list.Dhuy7ITv.js → review-list.BJ-4eNKh.js} +2 -2
- package/dist/esm/chunks/{review-list.Dhuy7ITv.js.map → review-list.BJ-4eNKh.js.map} +1 -1
- package/dist/esm/chunks/{useChartDateFormatters.DG-OZUxq.js → useChartDateFormatters.DS9ASgFO.js} +2 -2
- package/dist/esm/chunks/useChartDateFormatters.DS9ASgFO.js.map +1 -0
- package/dist/esm/components/articles-coverage.js +117 -0
- package/dist/esm/components/articles-coverage.js.map +1 -0
- package/dist/esm/components/chart-area-linear.js +2 -2
- package/dist/esm/components/chart-radial-stacked.js +1 -1
- package/dist/esm/components/convos.js +1 -1
- package/dist/esm/components/discoveries-created.js +2 -2
- package/dist/esm/global.css +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/scenes/knowledge-review.js +1 -1
- package/dist/stats.html +1 -1
- package/package.json +1 -1
- package/dist/esm/chunks/chart.BmBO7tNe.js.map +0 -1
- package/dist/esm/chunks/useChartDateFormatters.DG-OZUxq.js.map +0 -1
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { default as default_2 } from 'react';
|
|
2
|
+
import * as React_2 from 'react';
|
|
3
|
+
|
|
4
|
+
export declare function ArticlesCoverage({ total, trend, trendValue, coveragePercentage, data, chartConfig, locale, className, }: ArticlesCoverageProps): default_2.JSX.Element;
|
|
5
|
+
|
|
6
|
+
export declare interface ArticlesCoverageProps {
|
|
7
|
+
total: number;
|
|
8
|
+
trend: Trend;
|
|
9
|
+
trendValue: string;
|
|
10
|
+
coveragePercentage: number;
|
|
11
|
+
data: Array<Record<string, number | string | Date>>;
|
|
12
|
+
chartConfig: ChartConfig;
|
|
13
|
+
locale?: string;
|
|
14
|
+
className?: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
declare type ChartConfig = {
|
|
18
|
+
[k in string]: {
|
|
19
|
+
label?: React_2.ReactNode;
|
|
20
|
+
icon?: React_2.ComponentType;
|
|
21
|
+
} & ({
|
|
22
|
+
color?: string;
|
|
23
|
+
theme?: never;
|
|
24
|
+
} | {
|
|
25
|
+
color?: never;
|
|
26
|
+
theme: Record<keyof typeof THEMES, string>;
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
declare const THEMES: {
|
|
31
|
+
readonly light: "";
|
|
32
|
+
readonly dark: ".dark";
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
declare enum Trend {
|
|
36
|
+
UP = "up",
|
|
37
|
+
DOWN = "down",
|
|
38
|
+
FLAT = "flat"
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export { }
|
|
@@ -137,7 +137,7 @@ const ChartTooltipContent = React.forwardRef(
|
|
|
137
137
|
)
|
|
138
138
|
},
|
|
139
139
|
/* @__PURE__ */ React.createElement("div", { className: "grid gap-1.5" }, nestLabel ? tooltipLabel : null, /* @__PURE__ */ React.createElement("span", { className: "text-muted-foreground" }, itemConfig?.label || item.name)),
|
|
140
|
-
item.value && /* @__PURE__ */ React.createElement("span", { className: "font-mono font-medium tabular-nums text-foreground" }, item.value.toLocaleString())
|
|
140
|
+
item.value != null && /* @__PURE__ */ React.createElement("span", { className: "font-mono font-medium tabular-nums text-foreground" }, item.value.toLocaleString())
|
|
141
141
|
))
|
|
142
142
|
);
|
|
143
143
|
}))
|
|
@@ -196,4 +196,4 @@ function getPayloadConfigFromPayload(config, payload, key) {
|
|
|
196
196
|
}
|
|
197
197
|
|
|
198
198
|
export { ChartContainer as C, ChartTooltip as a, ChartTooltipContent as b, ChartLegend as c, ChartLegendContent as d };
|
|
199
|
-
//# sourceMappingURL=chart.
|
|
199
|
+
//# sourceMappingURL=chart.4ZbtBMmR.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chart.4ZbtBMmR.js","sources":["../../../src/components/ui/chart.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as RechartsPrimitive from 'recharts';\n\nimport { cn } from '@/lib/utils';\n\n// Format: { THEME_NAME: CSS_SELECTOR }\nconst THEMES = { light: '', dark: '.dark' } as const;\n\nexport type ChartConfig = {\n [k in string]: {\n label?: React.ReactNode;\n icon?: React.ComponentType;\n } & ({ color?: string; theme?: never } | { color?: never; theme: Record<keyof typeof THEMES, string> });\n};\n\ntype ChartContextProps = {\n config: ChartConfig;\n};\n\nconst ChartContext = React.createContext<ChartContextProps | null>(null);\n\nfunction useChart() {\n const context = React.useContext(ChartContext);\n\n if (!context) {\n throw new Error('useChart must be used within a <ChartContainer />');\n }\n\n return context;\n}\n\nconst ChartContainer = React.forwardRef<\n HTMLDivElement,\n React.ComponentProps<'div'> & {\n config: ChartConfig;\n children: React.ComponentProps<typeof RechartsPrimitive.ResponsiveContainer>['children'];\n }\n>(({ id, className, children, config, ...props }, ref) => {\n const uniqueId = React.useId();\n const chartId = `chart-${id || uniqueId.replace(/:/g, '')}`;\n\n return (\n <ChartContext.Provider value={{ config }}>\n <div\n data-chart={chartId}\n ref={ref}\n className={cn(\n \"flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none\",\n className,\n )}\n {...props}\n >\n <ChartStyle id={chartId} config={config} />\n <RechartsPrimitive.ResponsiveContainer>{children}</RechartsPrimitive.ResponsiveContainer>\n </div>\n </ChartContext.Provider>\n );\n});\nChartContainer.displayName = 'Chart';\n\nconst ChartStyle = ({ id, config }: { id: string; config: ChartConfig }) => {\n const colorConfig = Object.entries(config).filter(([, config]) => config.theme || config.color);\n\n if (!colorConfig.length) {\n return null;\n }\n\n return (\n <style\n dangerouslySetInnerHTML={{\n __html: Object.entries(THEMES)\n .map(\n ([theme, prefix]) => `\n${prefix} [data-chart=${id}] {\n${colorConfig\n .map(([key, itemConfig]) => {\n const color = itemConfig.theme?.[theme as keyof typeof itemConfig.theme] || itemConfig.color;\n\n return color ? ` --color-${key}: ${color};` : null;\n })\n .join('\\n')}\n}\n`,\n )\n .join('\\n'),\n }}\n />\n );\n};\n\nconst ChartTooltip = RechartsPrimitive.Tooltip;\n\nconst ChartTooltipContent = React.forwardRef<\n HTMLDivElement,\n React.ComponentProps<typeof RechartsPrimitive.Tooltip> &\n React.ComponentProps<'div'> & {\n hideLabel?: boolean;\n hideIndicator?: boolean;\n indicator?: 'line' | 'dot' | 'dashed';\n nameKey?: string;\n labelKey?: string;\n }\n>(\n (\n {\n active,\n payload,\n className,\n indicator = 'dot',\n hideLabel = false,\n hideIndicator = false,\n label,\n labelFormatter,\n labelClassName,\n formatter,\n color,\n nameKey,\n labelKey,\n },\n ref,\n ) => {\n const { config } = useChart();\n\n const tooltipLabel = React.useMemo(() => {\n if (hideLabel || !payload?.length) {\n return null;\n }\n\n const [item] = payload;\n const key = `${labelKey || item?.dataKey || item?.name || 'value'}`;\n const itemConfig = getPayloadConfigFromPayload(config, item, key);\n const value =\n !labelKey && typeof label === 'string'\n ? config[label as keyof typeof config]?.label || label\n : itemConfig?.label;\n\n if (labelFormatter) {\n return <div className={cn('font-medium', labelClassName)}>{labelFormatter(value, payload)}</div>;\n }\n\n if (!value) {\n return null;\n }\n\n return <div className={cn('font-medium', labelClassName)}>{value}</div>;\n }, [label, labelFormatter, payload, hideLabel, labelClassName, config, labelKey]);\n\n if (!active || !payload?.length) {\n return null;\n }\n\n const nestLabel = payload.length === 1 && indicator !== 'dot';\n\n return (\n <div\n ref={ref}\n className={cn(\n 'grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl',\n className,\n )}\n >\n {!nestLabel ? tooltipLabel : null}\n <div className=\"grid gap-1.5\">\n {payload\n .filter((item) => item.type !== 'none')\n .map((item, index) => {\n const key = `${nameKey || item.name || item.dataKey || 'value'}`;\n const itemConfig = getPayloadConfigFromPayload(config, item, key);\n const indicatorColor = color || item.payload.fill || item.color;\n\n return (\n <div\n key={item.dataKey}\n className={cn(\n 'flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground',\n indicator === 'dot' && 'items-center',\n )}\n >\n {formatter && item?.value !== undefined && item.name ? (\n formatter(item.value, item.name, item, index, item.payload)\n ) : (\n <>\n {itemConfig?.icon ? (\n <itemConfig.icon />\n ) : (\n !hideIndicator && (\n <div\n className={cn('shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]', {\n 'h-2.5 w-2.5': indicator === 'dot',\n 'w-1': indicator === 'line',\n 'w-0 border-[1.5px] border-dashed bg-transparent': indicator === 'dashed',\n 'my-0.5': nestLabel && indicator === 'dashed',\n })}\n style={\n {\n '--color-bg': indicatorColor,\n '--color-border': indicatorColor,\n } as React.CSSProperties\n }\n />\n )\n )}\n <div\n className={cn(\n 'flex flex-1 justify-between leading-none',\n nestLabel ? 'items-end' : 'items-center',\n )}\n >\n <div className=\"grid gap-1.5\">\n {nestLabel ? tooltipLabel : null}\n <span className=\"text-muted-foreground\">{itemConfig?.label || item.name}</span>\n </div>\n {item.value != null && (\n <span className=\"font-mono font-medium tabular-nums text-foreground\">\n {item.value.toLocaleString()}\n </span>\n )}\n </div>\n </>\n )}\n </div>\n );\n })}\n </div>\n </div>\n );\n },\n);\nChartTooltipContent.displayName = 'ChartTooltip';\n\nconst ChartLegend = RechartsPrimitive.Legend;\n\nconst ChartLegendContent = React.forwardRef<\n HTMLDivElement,\n React.ComponentProps<'div'> &\n Pick<RechartsPrimitive.LegendProps, 'payload' | 'verticalAlign'> & {\n hideIcon?: boolean;\n nameKey?: string;\n }\n>(({ className, hideIcon = false, payload, verticalAlign = 'bottom', nameKey }, ref) => {\n const { config } = useChart();\n\n if (!payload?.length) {\n return null;\n }\n\n return (\n <div\n ref={ref}\n className={cn('flex items-center justify-center gap-4', verticalAlign === 'top' ? 'pb-3' : 'pt-3', className)}\n >\n {payload\n .filter((item) => item.type !== 'none')\n .map((item) => {\n const key = `${nameKey || item.dataKey || 'value'}`;\n const itemConfig = getPayloadConfigFromPayload(config, item, key);\n\n return (\n <div\n key={item.value}\n className={cn('flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground')}\n >\n {itemConfig?.icon && !hideIcon ? (\n <itemConfig.icon />\n ) : (\n <div\n className=\"h-2 w-2 shrink-0 rounded-[2px]\"\n style={{\n backgroundColor: item.color,\n }}\n />\n )}\n {itemConfig?.label}\n </div>\n );\n })}\n </div>\n );\n});\nChartLegendContent.displayName = 'ChartLegend';\n\n// Helper to extract item config from a payload.\nfunction getPayloadConfigFromPayload(config: ChartConfig, payload: unknown, key: string) {\n if (typeof payload !== 'object' || payload === null) {\n return undefined;\n }\n\n const payloadPayload =\n 'payload' in payload && typeof payload.payload === 'object' && payload.payload !== null\n ? payload.payload\n : undefined;\n\n let configLabelKey: string = key;\n\n if (key in payload && typeof payload[key as keyof typeof payload] === 'string') {\n configLabelKey = payload[key as keyof typeof payload] as string;\n } else if (\n payloadPayload &&\n key in payloadPayload &&\n typeof payloadPayload[key as keyof typeof payloadPayload] === 'string'\n ) {\n configLabelKey = payloadPayload[key as keyof typeof payloadPayload] as string;\n }\n\n return configLabelKey in config ? config[configLabelKey] : config[key as keyof typeof config];\n}\n\nexport { ChartContainer, ChartTooltip, ChartTooltipContent, ChartLegend, ChartLegendContent, ChartStyle };\n"],"names":["config"],"mappings":";;;;AAMA,MAAM,MAAA,GAAS,EAAE,KAAA,EAAO,EAAA,EAAI,MAAM,OAAA,EAAQ;AAa1C,MAAM,YAAA,GAAe,KAAA,CAAM,aAAA,CAAwC,IAAI,CAAA;AAEvE,SAAS,QAAA,GAAW;AAClB,EAAA,MAAM,OAAA,GAAU,KAAA,CAAM,UAAA,CAAW,YAAY,CAAA;AAE7C,EAAA,IAAI,CAAC,OAAA,EAAS;AACZ,IAAA,MAAM,IAAI,MAAM,mDAAmD,CAAA;AAAA,EACrE;AAEA,EAAA,OAAO,OAAA;AACT;AAEA,MAAM,cAAA,GAAiB,KAAA,CAAM,UAAA,CAM3B,CAAC,EAAE,EAAA,EAAI,SAAA,EAAW,QAAA,EAAU,MAAA,EAAQ,GAAG,KAAA,EAAM,EAAG,GAAA,KAAQ;AACxD,EAAA,MAAM,QAAA,GAAW,MAAM,KAAA,EAAM;AAC7B,EAAA,MAAM,UAAU,CAAA,MAAA,EAAS,EAAA,IAAM,SAAS,OAAA,CAAQ,IAAA,EAAM,EAAE,CAAC,CAAA,CAAA;AAEzD,EAAA,2CACG,YAAA,CAAa,QAAA,EAAb,EAAsB,KAAA,EAAO,EAAE,QAAO,EAAA,kBACrC,KAAA,CAAA,aAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,YAAA,EAAY,OAAA;AAAA,MACZ,GAAA;AAAA,MACA,SAAA,EAAW,EAAA;AAAA,QACT,upBAAA;AAAA,QACA;AAAA,OACF;AAAA,MACC,GAAG;AAAA,KAAA;AAAA,oBAEJ,KAAA,CAAA,aAAA,CAAC,UAAA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AA;AAAA,UAAA;AAAA,YACC,SAAA,EAAU,gCAAA;AAAA,YACV,KAAA,EAAO;AAAA,cACL,iBAAiB,IAAA,CAAK;AAAA;AACxB;AAAA,SACF;AAAA,QAED,UAAA,EAAY;AAAA,OACf;AAAA,IAEJ,CAAC;AAAA,GACL;AAEJ,CAAC;AACD,kBAAA,CAAmB,WAAA,GAAc,aAAA;AAGjC,SAAS,2BAAA,CAA4B,MAAA,EAAqB,OAAA,EAAkB,GAAA,EAAa;AACvF,EAAA,IAAI,OAAO,OAAA,KAAY,QAAA,IAAY,OAAA,KAAY,IAAA,EAAM;AACnD,IAAA,OAAO,MAAA;AAAA,EACT;AAEA,EAAA,MAAM,cAAA,GACJ,SAAA,IAAa,OAAA,IAAW,OAAO,OAAA,CAAQ,OAAA,KAAY,QAAA,IAAY,OAAA,CAAQ,OAAA,KAAY,IAAA,GAC/E,OAAA,CAAQ,OAAA,GACR,MAAA;AAEN,EAAA,IAAI,cAAA,GAAyB,GAAA;AAE7B,EAAA,IAAI,OAAO,OAAA,IAAW,OAAO,OAAA,CAAQ,GAA2B,MAAM,QAAA,EAAU;AAC9E,IAAA,cAAA,GAAiB,QAAQ,GAA2B,CAAA;AAAA,EACtD,CAAA,MAAA,IACE,kBACA,GAAA,IAAO,cAAA,IACP,OAAO,cAAA,CAAe,GAAkC,MAAM,QAAA,EAC9D;AACA,IAAA,cAAA,GAAiB,eAAe,GAAkC,CAAA;AAAA,EACpE;AAEA,EAAA,OAAO,kBAAkB,MAAA,GAAS,MAAA,CAAO,cAAc,CAAA,GAAI,OAAO,GAA0B,CAAA;AAC9F;;;;"}
|
|
@@ -939,12 +939,14 @@ function formatDate(date, localeParam) {
|
|
|
939
939
|
}
|
|
940
940
|
function formatChartTick(value, locale = "en-US") {
|
|
941
941
|
if (typeof value === "string") return value;
|
|
942
|
+
if (!(value instanceof Date)) return "";
|
|
942
943
|
return value.toLocaleDateString(locale, { month: "short", day: "numeric" });
|
|
943
944
|
}
|
|
944
945
|
function formatChartLabel(value, locale = "en-US") {
|
|
945
946
|
if (typeof value === "string") return value;
|
|
947
|
+
if (!(value instanceof Date)) return "";
|
|
946
948
|
return value.toLocaleDateString(locale, { month: "long", day: "numeric", year: "numeric" });
|
|
947
949
|
}
|
|
948
950
|
|
|
949
951
|
export { formatChartLabel as a, formatDistance as b, formatDate as c, formatChartTick as f };
|
|
950
|
-
//# sourceMappingURL=formatDate.
|
|
952
|
+
//# sourceMappingURL=formatDate.CWN6IFKq.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatDate.CuWGpZ_T.js","sources":["../../../node_modules/date-fns/constants.js","../../../node_modules/date-fns/constructFrom.js","../../../node_modules/date-fns/_lib/normalizeDates.js","../../../node_modules/date-fns/toDate.js","../../../node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js","../../../node_modules/date-fns/startOfDay.js","../../../node_modules/date-fns/differenceInCalendarDays.js","../../../node_modules/date-fns/differenceInCalendarMonths.js","../../../node_modules/date-fns/getQuarter.js","../../../node_modules/date-fns/differenceInCalendarQuarters.js","../../../node_modules/date-fns/_lib/defaultOptions.js","../../../node_modules/date-fns/startOfWeek.js","../../../node_modules/date-fns/differenceInCalendarWeeks.js","../../../node_modules/date-fns/differenceInCalendarYears.js","../../../node_modules/date-fns/_lib/getRoundingMethod.js","../../../node_modules/date-fns/differenceInHours.js","../../../node_modules/date-fns/differenceInMilliseconds.js","../../../node_modules/date-fns/differenceInMinutes.js","../../../node_modules/date-fns/differenceInSeconds.js","../../../node_modules/date-fns/intlFormatDistance.js","../../../src/lib/formatDate.ts"],"sourcesContent":["/**\n * @module constants\n * @summary Useful constants\n * @description\n * Collection of useful date constants.\n *\n * The constants could be imported from `date-fns/constants`:\n *\n * ```ts\n * import { maxTime, minTime } from \"./constants/date-fns/constants\";\n *\n * function isAllowedTime(time) {\n * return time <= maxTime && time >= minTime;\n * }\n * ```\n */\n\n/**\n * @constant\n * @name daysInWeek\n * @summary Days in 1 week.\n */\nexport const daysInWeek = 7;\n\n/**\n * @constant\n * @name daysInYear\n * @summary Days in 1 year.\n *\n * @description\n * How many days in a year.\n *\n * One years equals 365.2425 days according to the formula:\n *\n * > Leap year occurs every 4 years, except for years that are divisible by 100 and not divisible by 400.\n * > 1 mean year = (365+1/4-1/100+1/400) days = 365.2425 days\n */\nexport const daysInYear = 365.2425;\n\n/**\n * @constant\n * @name maxTime\n * @summary Maximum allowed time.\n *\n * @example\n * import { maxTime } from \"./constants/date-fns/constants\";\n *\n * const isValid = 8640000000000001 <= maxTime;\n * //=> false\n *\n * new Date(8640000000000001);\n * //=> Invalid Date\n */\nexport const maxTime = Math.pow(10, 8) * 24 * 60 * 60 * 1000;\n\n/**\n * @constant\n * @name minTime\n * @summary Minimum allowed time.\n *\n * @example\n * import { minTime } from \"./constants/date-fns/constants\";\n *\n * const isValid = -8640000000000001 >= minTime;\n * //=> false\n *\n * new Date(-8640000000000001)\n * //=> Invalid Date\n */\nexport const minTime = -maxTime;\n\n/**\n * @constant\n * @name millisecondsInWeek\n * @summary Milliseconds in 1 week.\n */\nexport const millisecondsInWeek = 604800000;\n\n/**\n * @constant\n * @name millisecondsInDay\n * @summary Milliseconds in 1 day.\n */\nexport const millisecondsInDay = 86400000;\n\n/**\n * @constant\n * @name millisecondsInMinute\n * @summary Milliseconds in 1 minute\n */\nexport const millisecondsInMinute = 60000;\n\n/**\n * @constant\n * @name millisecondsInHour\n * @summary Milliseconds in 1 hour\n */\nexport const millisecondsInHour = 3600000;\n\n/**\n * @constant\n * @name millisecondsInSecond\n * @summary Milliseconds in 1 second\n */\nexport const millisecondsInSecond = 1000;\n\n/**\n * @constant\n * @name minutesInYear\n * @summary Minutes in 1 year.\n */\nexport const minutesInYear = 525600;\n\n/**\n * @constant\n * @name minutesInMonth\n * @summary Minutes in 1 month.\n */\nexport const minutesInMonth = 43200;\n\n/**\n * @constant\n * @name minutesInDay\n * @summary Minutes in 1 day.\n */\nexport const minutesInDay = 1440;\n\n/**\n * @constant\n * @name minutesInHour\n * @summary Minutes in 1 hour.\n */\nexport const minutesInHour = 60;\n\n/**\n * @constant\n * @name monthsInQuarter\n * @summary Months in 1 quarter.\n */\nexport const monthsInQuarter = 3;\n\n/**\n * @constant\n * @name monthsInYear\n * @summary Months in 1 year.\n */\nexport const monthsInYear = 12;\n\n/**\n * @constant\n * @name quartersInYear\n * @summary Quarters in 1 year\n */\nexport const quartersInYear = 4;\n\n/**\n * @constant\n * @name secondsInHour\n * @summary Seconds in 1 hour.\n */\nexport const secondsInHour = 3600;\n\n/**\n * @constant\n * @name secondsInMinute\n * @summary Seconds in 1 minute.\n */\nexport const secondsInMinute = 60;\n\n/**\n * @constant\n * @name secondsInDay\n * @summary Seconds in 1 day.\n */\nexport const secondsInDay = secondsInHour * 24;\n\n/**\n * @constant\n * @name secondsInWeek\n * @summary Seconds in 1 week.\n */\nexport const secondsInWeek = secondsInDay * 7;\n\n/**\n * @constant\n * @name secondsInYear\n * @summary Seconds in 1 year.\n */\nexport const secondsInYear = secondsInDay * daysInYear;\n\n/**\n * @constant\n * @name secondsInMonth\n * @summary Seconds in 1 month\n */\nexport const secondsInMonth = secondsInYear / 12;\n\n/**\n * @constant\n * @name secondsInQuarter\n * @summary Seconds in 1 quarter.\n */\nexport const secondsInQuarter = secondsInMonth * 3;\n\n/**\n * @constant\n * @name constructFromSymbol\n * @summary Symbol enabling Date extensions to inherit properties from the reference date.\n *\n * The symbol is used to enable the `constructFrom` function to construct a date\n * using a reference date and a value. It allows to transfer extra properties\n * from the reference date to the new date. It's useful for extensions like\n * [`TZDate`](https://github.com/date-fns/tz) that accept a time zone as\n * a constructor argument.\n */\nexport const constructFromSymbol = Symbol.for(\"constructDateFrom\");\n","import { constructFromSymbol } from \"./constants.js\";\n\n/**\n * @name constructFrom\n * @category Generic Helpers\n * @summary Constructs a date using the reference date and the value\n *\n * @description\n * The function constructs a new date using the constructor from the reference\n * date and the given value. It helps to build generic functions that accept\n * date extensions.\n *\n * It defaults to `Date` if the passed reference date is a number or a string.\n *\n * Starting from v3.7.0, it allows to construct a date using `[Symbol.for(\"constructDateFrom\")]`\n * enabling to transfer extra properties from the reference date to the new date.\n * It's useful for extensions like [`TZDate`](https://github.com/date-fns/tz)\n * that accept a time zone as a constructor argument.\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 reference date to take constructor from\n * @param value - The value to create the date\n *\n * @returns Date initialized using the given date and value\n *\n * @example\n * import { constructFrom } from \"./constructFrom/date-fns\";\n *\n * // A function that clones a date preserving the original type\n * function cloneDate<DateType extends Date>(date: DateType): DateType {\n * return constructFrom(\n * date, // Use constructor from the given date\n * date.getTime() // Use the date value to create a new date\n * );\n * }\n */\nexport function constructFrom(date, value) {\n if (typeof date === \"function\") return date(value);\n\n if (date && typeof date === \"object\" && constructFromSymbol in date)\n return date[constructFromSymbol](value);\n\n if (date instanceof Date) return new date.constructor(value);\n\n return new Date(value);\n}\n\n// Fallback for modularized imports:\nexport default constructFrom;\n","import { constructFrom } from \"../constructFrom.js\";\n\nexport function normalizeDates(context, ...dates) {\n const normalize = constructFrom.bind(\n null,\n context || dates.find((date) => typeof date === \"object\"),\n );\n return dates.map(normalize);\n}\n","import { constructFrom } from \"./constructFrom.js\";\n\n/**\n * @name toDate\n * @category Common Helpers\n * @summary Convert the given argument to an instance of Date.\n *\n * @description\n * Convert the given argument to an instance of Date.\n *\n * If the argument is an instance of Date, the function returns its clone.\n *\n * If the argument is a number, it is treated as a timestamp.\n *\n * If the argument is none of the above, the function returns Invalid Date.\n *\n * Starting from v3.7.0, it clones a date using `[Symbol.for(\"constructDateFrom\")]`\n * enabling to transfer extra properties from the reference date to the new date.\n * It's useful for extensions like [`TZDate`](https://github.com/date-fns/tz)\n * that accept a time zone as a constructor argument.\n *\n * **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.\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 * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.\n *\n * @param argument - The value to convert\n *\n * @returns The parsed date in the local time zone\n *\n * @example\n * // Clone the date:\n * const result = toDate(new Date(2014, 1, 11, 11, 30, 30))\n * //=> Tue Feb 11 2014 11:30:30\n *\n * @example\n * // Convert the timestamp to date:\n * const result = toDate(1392098430000)\n * //=> Tue Feb 11 2014 11:30:30\n */\nexport function toDate(argument, context) {\n // [TODO] Get rid of `toDate` or `constructFrom`?\n return constructFrom(context || argument, argument);\n}\n\n// Fallback for modularized imports:\nexport default toDate;\n","import { toDate } from \"../toDate.js\";\n\n/**\n * Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds.\n * They usually appear for dates that denote time before the timezones were introduced\n * (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891\n * and GMT+01:00:00 after that date)\n *\n * Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above,\n * which would lead to incorrect calculations.\n *\n * This function returns the timezone offset in milliseconds that takes seconds in account.\n */\nexport function getTimezoneOffsetInMilliseconds(date) {\n const _date = toDate(date);\n const utcDate = new Date(\n Date.UTC(\n _date.getFullYear(),\n _date.getMonth(),\n _date.getDate(),\n _date.getHours(),\n _date.getMinutes(),\n _date.getSeconds(),\n _date.getMilliseconds(),\n ),\n );\n utcDate.setUTCFullYear(_date.getFullYear());\n return +date - +utcDate;\n}\n","import { toDate } from \"./toDate.js\";\n\n/**\n * The {@link startOfDay} function options.\n */\n\n/**\n * @name startOfDay\n * @category Day Helpers\n * @summary Return the start of a day for the given date.\n *\n * @description\n * Return the start 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 * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.\n *\n * @param date - The original date\n * @param options - The options\n *\n * @returns The start of a day\n *\n * @example\n * // The start of a day for 2 September 2014 11:55:00:\n * const result = startOfDay(new Date(2014, 8, 2, 11, 55, 0))\n * //=> Tue Sep 02 2014 00:00:00\n */\nexport function startOfDay(date, options) {\n const _date = toDate(date, options?.in);\n _date.setHours(0, 0, 0, 0);\n return _date;\n}\n\n// Fallback for modularized imports:\nexport default startOfDay;\n","import { getTimezoneOffsetInMilliseconds } from \"./_lib/getTimezoneOffsetInMilliseconds.js\";\nimport { normalizeDates } from \"./_lib/normalizeDates.js\";\nimport { millisecondsInDay } from \"./constants.js\";\nimport { startOfDay } from \"./startOfDay.js\";\n\n/**\n * The {@link differenceInCalendarDays} function options.\n */\n\n/**\n * @name differenceInCalendarDays\n * @category Day Helpers\n * @summary Get the number of calendar days between the given dates.\n *\n * @description\n * Get the number of calendar days between the given dates. This means that the times are removed\n * from the dates and then the difference in days is calculated.\n *\n * @param laterDate - The later date\n * @param earlierDate - The earlier date\n * @param options - The options object\n *\n * @returns The number of calendar days\n *\n * @example\n * // How many calendar days are between\n * // 2 July 2011 23:00:00 and 2 July 2012 00:00:00?\n * const result = differenceInCalendarDays(\n * new Date(2012, 6, 2, 0, 0),\n * new Date(2011, 6, 2, 23, 0)\n * )\n * //=> 366\n * // How many calendar days are between\n * // 2 July 2011 23:59:00 and 3 July 2011 00:01:00?\n * const result = differenceInCalendarDays(\n * new Date(2011, 6, 3, 0, 1),\n * new Date(2011, 6, 2, 23, 59)\n * )\n * //=> 1\n */\nexport function differenceInCalendarDays(laterDate, earlierDate, options) {\n const [laterDate_, earlierDate_] = normalizeDates(\n options?.in,\n laterDate,\n earlierDate,\n );\n\n const laterStartOfDay = startOfDay(laterDate_);\n const earlierStartOfDay = startOfDay(earlierDate_);\n\n const laterTimestamp =\n +laterStartOfDay - getTimezoneOffsetInMilliseconds(laterStartOfDay);\n const earlierTimestamp =\n +earlierStartOfDay - getTimezoneOffsetInMilliseconds(earlierStartOfDay);\n\n // Round the number of days to the nearest integer because the number of\n // milliseconds in a day is not constant (e.g. it's different in the week of\n // the daylight saving time clock shift).\n return Math.round((laterTimestamp - earlierTimestamp) / millisecondsInDay);\n}\n\n// Fallback for modularized imports:\nexport default differenceInCalendarDays;\n","import { normalizeDates } from \"./_lib/normalizeDates.js\";\n\n/**\n * The {@link differenceInCalendarMonths} function options.\n */\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 * @param laterDate - The later date\n * @param earlierDate - The earlier date\n * @param options - An object with options\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(laterDate, earlierDate, options) {\n const [laterDate_, earlierDate_] = normalizeDates(\n options?.in,\n laterDate,\n earlierDate,\n );\n\n const yearsDiff = laterDate_.getFullYear() - earlierDate_.getFullYear();\n const monthsDiff = laterDate_.getMonth() - earlierDate_.getMonth();\n\n return yearsDiff * 12 + monthsDiff;\n}\n\n// Fallback for modularized imports:\nexport default differenceInCalendarMonths;\n","import { toDate } from \"./toDate.js\";\n\n/**\n * The {@link getQuarter} function options.\n */\n\n/**\n * @name getQuarter\n * @category Quarter Helpers\n * @summary Get the year quarter of the given date.\n *\n * @description\n * Get the year quarter of the given date.\n *\n * @param date - The given date\n * @param options - An object with options\n *\n * @returns The quarter\n *\n * @example\n * // Which quarter is 2 July 2014?\n * const result = getQuarter(new Date(2014, 6, 2));\n * //=> 3\n */\nexport function getQuarter(date, options) {\n const _date = toDate(date, options?.in);\n const quarter = Math.trunc(_date.getMonth() / 3) + 1;\n return quarter;\n}\n\n// Fallback for modularized imports:\nexport default getQuarter;\n","import { normalizeDates } from \"./_lib/normalizeDates.js\";\nimport { getQuarter } from \"./getQuarter.js\";\n\n/**\n * The {@link differenceInCalendarQuarters} function options.\n */\n\n/**\n * @name differenceInCalendarQuarters\n * @category Quarter Helpers\n * @summary Get the number of calendar quarters between the given dates.\n *\n * @description\n * Get the number of calendar quarters between the given dates.\n *\n * @param laterDate - The later date\n * @param earlierDate - The earlier date\n * @param options - An object with options\n *\n * @returns The number of calendar quarters\n *\n * @example\n * // How many calendar quarters are between 31 December 2013 and 2 July 2014?\n * const result = differenceInCalendarQuarters(\n * new Date(2014, 6, 2),\n * new Date(2013, 11, 31)\n * )\n * //=> 3\n */\nexport function differenceInCalendarQuarters(laterDate, earlierDate, options) {\n const [laterDate_, earlierDate_] = normalizeDates(\n options?.in,\n laterDate,\n earlierDate,\n );\n\n const yearsDiff = laterDate_.getFullYear() - earlierDate_.getFullYear();\n const quartersDiff = getQuarter(laterDate_) - getQuarter(earlierDate_);\n\n return yearsDiff * 4 + quartersDiff;\n}\n\n// Fallback for modularized imports:\nexport default differenceInCalendarQuarters;\n","let defaultOptions = {};\n\nexport function getDefaultOptions() {\n return defaultOptions;\n}\n\nexport function setDefaultOptions(newOptions) {\n defaultOptions = newOptions;\n}\n","import { getDefaultOptions } from \"./_lib/defaultOptions.js\";\nimport { toDate } from \"./toDate.js\";\n\n/**\n * The {@link startOfWeek} function options.\n */\n\n/**\n * @name startOfWeek\n * @category Week Helpers\n * @summary Return the start of a week for the given date.\n *\n * @description\n * Return the start of a week 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 * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.\n *\n * @param date - The original date\n * @param options - An object with options\n *\n * @returns The start of a week\n *\n * @example\n * // The start of a week for 2 September 2014 11:55:00:\n * const result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0))\n * //=> Sun Aug 31 2014 00:00:00\n *\n * @example\n * // If the week starts on Monday, the start of the week for 2 September 2014 11:55:00:\n * const result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0), { weekStartsOn: 1 })\n * //=> Mon Sep 01 2014 00:00:00\n */\nexport function startOfWeek(date, options) {\n const defaultOptions = getDefaultOptions();\n const weekStartsOn =\n options?.weekStartsOn ??\n options?.locale?.options?.weekStartsOn ??\n defaultOptions.weekStartsOn ??\n defaultOptions.locale?.options?.weekStartsOn ??\n 0;\n\n const _date = toDate(date, options?.in);\n const day = _date.getDay();\n const diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;\n\n _date.setDate(_date.getDate() - diff);\n _date.setHours(0, 0, 0, 0);\n return _date;\n}\n\n// Fallback for modularized imports:\nexport default startOfWeek;\n","import { getTimezoneOffsetInMilliseconds } from \"./_lib/getTimezoneOffsetInMilliseconds.js\";\nimport { normalizeDates } from \"./_lib/normalizeDates.js\";\nimport { millisecondsInWeek } from \"./constants.js\";\nimport { startOfWeek } from \"./startOfWeek.js\";\n\n/**\n * The {@link differenceInCalendarWeeks} function options.\n */\n\n/**\n * @name differenceInCalendarWeeks\n * @category Week Helpers\n * @summary Get the number of calendar weeks between the given dates.\n *\n * @description\n * Get the number of calendar weeks between the given dates.\n *\n * @param laterDate - The later date\n * @param earlierDate - The earlier date\n * @param options - An object with options.\n *\n * @returns The number of calendar weeks\n *\n * @example\n * // How many calendar weeks are between 5 July 2014 and 20 July 2014?\n * const result = differenceInCalendarWeeks(\n * new Date(2014, 6, 20),\n * new Date(2014, 6, 5)\n * )\n * //=> 3\n *\n * @example\n * // If the week starts on Monday,\n * // how many calendar weeks are between 5 July 2014 and 20 July 2014?\n * const result = differenceInCalendarWeeks(\n * new Date(2014, 6, 20),\n * new Date(2014, 6, 5),\n * { weekStartsOn: 1 }\n * )\n * //=> 2\n */\nexport function differenceInCalendarWeeks(laterDate, earlierDate, options) {\n const [laterDate_, earlierDate_] = normalizeDates(\n options?.in,\n laterDate,\n earlierDate,\n );\n\n const laterStartOfWeek = startOfWeek(laterDate_, options);\n const earlierStartOfWeek = startOfWeek(earlierDate_, options);\n\n const laterTimestamp =\n +laterStartOfWeek - getTimezoneOffsetInMilliseconds(laterStartOfWeek);\n const earlierTimestamp =\n +earlierStartOfWeek - getTimezoneOffsetInMilliseconds(earlierStartOfWeek);\n\n return Math.round((laterTimestamp - earlierTimestamp) / millisecondsInWeek);\n}\n\n// Fallback for modularized imports:\nexport default differenceInCalendarWeeks;\n","import { normalizeDates } from \"./_lib/normalizeDates.js\";\n\n/**\n * The {@link differenceInCalendarYears} function options.\n */\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 * @param laterDate - The later date\n * @param earlierDate - The earlier date\n * @param options - An object with options\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(laterDate, earlierDate, options) {\n const [laterDate_, earlierDate_] = normalizeDates(\n options?.in,\n laterDate,\n earlierDate,\n );\n return laterDate_.getFullYear() - earlierDate_.getFullYear();\n}\n\n// Fallback for modularized imports:\nexport default differenceInCalendarYears;\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 { getRoundingMethod } from \"./_lib/getRoundingMethod.js\";\nimport { normalizeDates } from \"./_lib/normalizeDates.js\";\nimport { millisecondsInHour } from \"./constants.js\";\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 * @param laterDate - The later date\n * @param earlierDate - 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(laterDate, earlierDate, options) {\n const [laterDate_, earlierDate_] = normalizeDates(\n options?.in,\n laterDate,\n earlierDate,\n );\n const diff = (+laterDate_ - +earlierDate_) / millisecondsInHour;\n return getRoundingMethod(options?.roundingMethod)(diff);\n}\n\n// Fallback for modularized imports:\nexport default differenceInHours;\n","import { toDate } from \"./toDate.js\";\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 * @param laterDate - The later date\n * @param earlierDate - 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(laterDate, earlierDate) {\n return +toDate(laterDate) - +toDate(earlierDate);\n}\n\n// Fallback for modularized imports:\nexport default differenceInMilliseconds;\n","import { getRoundingMethod } from \"./_lib/getRoundingMethod.js\";\nimport { millisecondsInMinute } from \"./constants.js\";\nimport { differenceInMilliseconds } from \"./differenceInMilliseconds.js\";\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 * @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 { getRoundingMethod } from \"./_lib/getRoundingMethod.js\";\nimport { differenceInMilliseconds } from \"./differenceInMilliseconds.js\";\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 * @param laterDate - The later date\n * @param earlierDate - 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(laterDate, earlierDate, options) {\n const diff = differenceInMilliseconds(laterDate, earlierDate) / 1000;\n return getRoundingMethod(options?.roundingMethod)(diff);\n}\n\n// Fallback for modularized imports:\nexport default differenceInSeconds;\n","import { normalizeDates } from \"./_lib/normalizeDates.js\";\nimport {\n secondsInDay,\n secondsInHour,\n secondsInMinute,\n secondsInMonth,\n secondsInQuarter,\n secondsInWeek,\n secondsInYear,\n} from \"./constants.js\";\nimport { differenceInCalendarDays } from \"./differenceInCalendarDays.js\";\nimport { differenceInCalendarMonths } from \"./differenceInCalendarMonths.js\";\nimport { differenceInCalendarQuarters } from \"./differenceInCalendarQuarters.js\";\nimport { differenceInCalendarWeeks } from \"./differenceInCalendarWeeks.js\";\nimport { differenceInCalendarYears } from \"./differenceInCalendarYears.js\";\nimport { differenceInHours } from \"./differenceInHours.js\";\nimport { differenceInMinutes } from \"./differenceInMinutes.js\";\nimport { differenceInSeconds } from \"./differenceInSeconds.js\";\n\n/**\n * The {@link intlFormatDistance} function options.\n */\n\n/**\n * The unit used to format the distance in {@link intlFormatDistance}.\n */\n\n/**\n * @name intlFormatDistance\n * @category Common Helpers\n * @summary Formats distance between two dates in a human-readable format\n * @description\n * The function calculates the difference between two dates and formats it as a human-readable string.\n *\n * The function will pick the most appropriate unit depending on the distance between dates. For example, if the distance is a few hours, it might return `x hours`. If the distance is a few months, it might return `x months`.\n *\n * You can also specify a unit to force using it regardless of the distance to get a result like `123456 hours`.\n *\n * See the table below for the unit picking logic:\n *\n * | Distance between dates | Result (past) | Result (future) |\n * | ---------------------- | -------------- | --------------- |\n * | 0 seconds | now | now |\n * | 1-59 seconds | X seconds ago | in X seconds |\n * | 1-59 minutes | X minutes ago | in X minutes |\n * | 1-23 hours | X hours ago | in X hours |\n * | 1 day | yesterday | tomorrow |\n * | 2-6 days | X days ago | in X days |\n * | 7 days | last week | next week |\n * | 8 days-1 month | X weeks ago | in X weeks |\n * | 1 month | last month | next month |\n * | 2-3 months | X months ago | in X months |\n * | 1 quarter | last quarter | next quarter |\n * | 2-3 quarters | X quarters ago | in X quarters |\n * | 1 year | last year | next year |\n * | 2+ years | X years ago | in X years |\n *\n * @param laterDate - The date\n * @param earlierDate - The date to compare with.\n * @param options - An object with options.\n * See MDN for details [Locale identification and negotiation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#locale_identification_and_negotiation)\n * The narrow one could be similar to the short one for some locales.\n *\n * @returns The distance in words according to language-sensitive relative time formatting.\n *\n * @throws `date` must not be Invalid Date\n * @throws `baseDate` must not be Invalid Date\n * @throws `options.unit` must not be invalid Unit\n * @throws `options.locale` must not be invalid locale\n * @throws `options.localeMatcher` must not be invalid localeMatcher\n * @throws `options.numeric` must not be invalid numeric\n * @throws `options.style` must not be invalid style\n *\n * @example\n * // What is the distance between the dates when the fist date is after the second?\n * intlFormatDistance(\n * new Date(1986, 3, 4, 11, 30, 0),\n * new Date(1986, 3, 4, 10, 30, 0)\n * )\n * //=> 'in 1 hour'\n *\n * // What is the distance between the dates when the fist date is before the second?\n * intlFormatDistance(\n * new Date(1986, 3, 4, 10, 30, 0),\n * new Date(1986, 3, 4, 11, 30, 0)\n * )\n * //=> '1 hour ago'\n *\n * @example\n * // Use the unit option to force the function to output the result in quarters. Without setting it, the example would return \"next year\"\n * intlFormatDistance(\n * new Date(1987, 6, 4, 10, 30, 0),\n * new Date(1986, 3, 4, 10, 30, 0),\n * { unit: 'quarter' }\n * )\n * //=> 'in 5 quarters'\n *\n * @example\n * // Use the locale option to get the result in Spanish. Without setting it, the example would return \"in 1 hour\".\n * intlFormatDistance(\n * new Date(1986, 3, 4, 11, 30, 0),\n * new Date(1986, 3, 4, 10, 30, 0),\n * { locale: 'es' }\n * )\n * //=> 'dentro de 1 hora'\n *\n * @example\n * // Use the numeric option to force the function to use numeric values. Without setting it, the example would return \"tomorrow\".\n * intlFormatDistance(\n * new Date(1986, 3, 5, 11, 30, 0),\n * new Date(1986, 3, 4, 11, 30, 0),\n * { numeric: 'always' }\n * )\n * //=> 'in 1 day'\n *\n * @example\n * // Use the style option to force the function to use short values. Without setting it, the example would return \"in 2 years\".\n * intlFormatDistance(\n * new Date(1988, 3, 4, 11, 30, 0),\n * new Date(1986, 3, 4, 11, 30, 0),\n * { style: 'short' }\n * )\n * //=> 'in 2 yr'\n */\nexport function intlFormatDistance(laterDate, earlierDate, options) {\n let value = 0;\n let unit;\n\n const [laterDate_, earlierDate_] = normalizeDates(\n options?.in,\n laterDate,\n earlierDate,\n );\n\n if (!options?.unit) {\n // Get the unit based on diffInSeconds calculations if no unit is specified\n const diffInSeconds = differenceInSeconds(laterDate_, earlierDate_); // The smallest unit\n\n if (Math.abs(diffInSeconds) < secondsInMinute) {\n value = differenceInSeconds(laterDate_, earlierDate_);\n unit = \"second\";\n } else if (Math.abs(diffInSeconds) < secondsInHour) {\n value = differenceInMinutes(laterDate_, earlierDate_);\n unit = \"minute\";\n } else if (\n Math.abs(diffInSeconds) < secondsInDay &&\n Math.abs(differenceInCalendarDays(laterDate_, earlierDate_)) < 1\n ) {\n value = differenceInHours(laterDate_, earlierDate_);\n unit = \"hour\";\n } else if (\n Math.abs(diffInSeconds) < secondsInWeek &&\n (value = differenceInCalendarDays(laterDate_, earlierDate_)) &&\n Math.abs(value) < 7\n ) {\n unit = \"day\";\n } else if (Math.abs(diffInSeconds) < secondsInMonth) {\n value = differenceInCalendarWeeks(laterDate_, earlierDate_);\n unit = \"week\";\n } else if (Math.abs(diffInSeconds) < secondsInQuarter) {\n value = differenceInCalendarMonths(laterDate_, earlierDate_);\n unit = \"month\";\n } else if (Math.abs(diffInSeconds) < secondsInYear) {\n if (differenceInCalendarQuarters(laterDate_, earlierDate_) < 4) {\n // To filter out cases that are less than a year but match 4 quarters\n value = differenceInCalendarQuarters(laterDate_, earlierDate_);\n unit = \"quarter\";\n } else {\n value = differenceInCalendarYears(laterDate_, earlierDate_);\n unit = \"year\";\n }\n } else {\n value = differenceInCalendarYears(laterDate_, earlierDate_);\n unit = \"year\";\n }\n } else {\n // Get the value if unit is specified\n unit = options?.unit;\n if (unit === \"second\") {\n value = differenceInSeconds(laterDate_, earlierDate_);\n } else if (unit === \"minute\") {\n value = differenceInMinutes(laterDate_, earlierDate_);\n } else if (unit === \"hour\") {\n value = differenceInHours(laterDate_, earlierDate_);\n } else if (unit === \"day\") {\n value = differenceInCalendarDays(laterDate_, earlierDate_);\n } else if (unit === \"week\") {\n value = differenceInCalendarWeeks(laterDate_, earlierDate_);\n } else if (unit === \"month\") {\n value = differenceInCalendarMonths(laterDate_, earlierDate_);\n } else if (unit === \"quarter\") {\n value = differenceInCalendarQuarters(laterDate_, earlierDate_);\n } else if (unit === \"year\") {\n value = differenceInCalendarYears(laterDate_, earlierDate_);\n }\n }\n\n const rtf = new Intl.RelativeTimeFormat(options?.locale, {\n numeric: \"auto\",\n ...options,\n });\n\n return rtf.format(value, unit);\n}\n\n// Fallback for modularized imports:\nexport default intlFormatDistance;\n","import { intlFormatDistance } from 'date-fns/intlFormatDistance';\n\nfunction getLocale(locale?: string) {\n const defaultLocale = 'en-US';\n if (!locale) {\n if (typeof navigator !== 'undefined') {\n locale = navigator.language;\n } else {\n locale = defaultLocale;\n }\n }\n\n return locale;\n}\nexport function formatDistance(timestamp: Date, localeParam?: string) {\n const locale = getLocale(localeParam);\n\n return intlFormatDistance(timestamp, new Date(), { locale, style: 'short' });\n}\n\nexport function formatDate(date: Date, localeParam?: string) {\n const locale = getLocale(localeParam);\n\n return date.toLocaleDateString(locale, {\n month: 'short',\n day: 'numeric',\n year: 'numeric',\n hour: 'numeric',\n minute: '2-digit',\n hour12: true,\n });\n}\n\nexport function formatChartTick(value: Date | string, locale = 'en-US'): string {\n if (typeof value === 'string') return value;\n\n return value.toLocaleDateString(locale, { month: 'short', day: 'numeric' });\n}\n\nexport function formatChartLabel(value: Date | string, locale = 'en-US'): string {\n if (typeof value === 'string') return value;\n\n return value.toLocaleDateString(locale, { month: 'long', day: 'numeric', year: 'numeric' });\n}\n"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AASA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,UAAU,GAAG,QAAQ;;AAkClC;AACA;AACA;AACA;AACA;AACO,MAAM,kBAAkB,GAAG,SAAS;;AAE3C;AACA;AACA;AACA;AACA;AACO,MAAM,iBAAiB,GAAG,QAAQ;;AAEzC;AACA;AACA;AACA;AACA;AACO,MAAM,oBAAoB,GAAG,KAAK;;AAEzC;AACA;AACA;AACA;AACA;AACO,MAAM,kBAAkB,GAAG,OAAO;;AA0DzC;AACA;AACA;AACA;AACA;AACO,MAAM,aAAa,GAAG,IAAI;;AAEjC;AACA;AACA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ACtE,EAAE,OAAO,iBAAiB,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC,IAAI,CAAC;AACzD;;ACdA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,kBAAkB,CAAC,SAAS,EAAE,WAAW,EAAE,OAAO,EAAE;AACpE,EAAE,IAAI,KAAK,GAAG,CAAC;AACf,EAAE,IAAI,IAAI;;AAEV,EAAE,MAAM,CAAC,UAAU,EAAE,YAAY,CAAC,GAAG,cAAc;AACnD,IAAI,OAAO,EAAE,EAAE;AACf,IAAI,SAAS;AACb,IAAI,WAAW;AACf,GAAG;;AAEH,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,EAAE;AACtB;AACA,IAAI,MAAM,aAAa,GAAG,mBAAmB,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;;AAExE,IAAI,IAAI,IAAI,CAAC,GAAG,CAAC,aAAa,CAAC,GAAG,eAAe,EAAE;AACnD,MAAM,KAAK,GAAG,mBAAmB,CAAC,UAAU,EAAE,YAAY,CAAC;AAC3D,MAAM,IAAI,GAAG,QAAQ;AACrB,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,GAAG,CAAC,aAAa,CAAC,GAAG,aAAa,EAAE;AACxD,MAAM,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AAA;AAEtC,EAAA,OAAO,KAAA,CAAM,mBAAmB,MAAA,EAAQ,EAAE,OAAO,OAAA,EAAS,GAAA,EAAK,WAAW,CAAA;AAC5E;AAEO,SAAS,gBAAA,CAAiB,KAAA,EAAsB,MAAA,GAAS,OAAA,EAAiB;AAC/E,EAAA,IAAI,OAAO,KAAA,KAAU,QAAA,EAAU,OAAO,KAAA;AAEtC,EAAA,OAAO,KAAA,CAAM,kBAAA,CAAmB,MAAA,EAAQ,EAAE,KAAA,EAAO,QAAQ,GAAA,EAAK,SAAA,EAAW,IAAA,EAAM,SAAA,EAAW,CAAA;AAC5F;;;;","x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]}
|
|
1
|
+
{"version":3,"file":"formatDate.CWN6IFKq.js","sources":["../../../node_modules/date-fns/constants.js","../../../node_modules/date-fns/constructFrom.js","../../../node_modules/date-fns/_lib/normalizeDates.js","../../../node_modules/date-fns/toDate.js","../../../node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js","../../../node_modules/date-fns/startOfDay.js","../../../node_modules/date-fns/differenceInCalendarDays.js","../../../node_modules/date-fns/differenceInCalendarMonths.js","../../../node_modules/date-fns/getQuarter.js","../../../node_modules/date-fns/differenceInCalendarQuarters.js","../../../node_modules/date-fns/_lib/defaultOptions.js","../../../node_modules/date-fns/startOfWeek.js","../../../node_modules/date-fns/differenceInCalendarWeeks.js","../../../node_modules/date-fns/differenceInCalendarYears.js","../../../node_modules/date-fns/_lib/getRoundingMethod.js","../../../node_modules/date-fns/differenceInHours.js","../../../node_modules/date-fns/differenceInMilliseconds.js","../../../node_modules/date-fns/differenceInMinutes.js","../../../node_modules/date-fns/differenceInSeconds.js","../../../node_modules/date-fns/intlFormatDistance.js","../../../src/lib/formatDate.ts"],"sourcesContent":["/**\n * @module constants\n * @summary Useful constants\n * @description\n * Collection of useful date constants.\n *\n * The constants could be imported from `date-fns/constants`:\n *\n * ```ts\n * import { maxTime, minTime } from \"./constants/date-fns/constants\";\n *\n * function isAllowedTime(time) {\n * return time <= maxTime && time >= minTime;\n * }\n * ```\n */\n\n/**\n * @constant\n * @name daysInWeek\n * @summary Days in 1 week.\n */\nexport const daysInWeek = 7;\n\n/**\n * @constant\n * @name daysInYear\n * @summary Days in 1 year.\n *\n * @description\n * How many days in a year.\n *\n * One years equals 365.2425 days according to the formula:\n *\n * > Leap year occurs every 4 years, except for years that are divisible by 100 and not divisible by 400.\n * > 1 mean year = (365+1/4-1/100+1/400) days = 365.2425 days\n */\nexport const daysInYear = 365.2425;\n\n/**\n * @constant\n * @name maxTime\n * @summary Maximum allowed time.\n *\n * @example\n * import { maxTime } from \"./constants/date-fns/constants\";\n *\n * const isValid = 8640000000000001 <= maxTime;\n * //=> false\n *\n * new Date(8640000000000001);\n * //=> Invalid Date\n */\nexport const maxTime = Math.pow(10, 8) * 24 * 60 * 60 * 1000;\n\n/**\n * @constant\n * @name minTime\n * @summary Minimum allowed time.\n *\n * @example\n * import { minTime } from \"./constants/date-fns/constants\";\n *\n * const isValid = -8640000000000001 >= minTime;\n * //=> false\n *\n * new Date(-8640000000000001)\n * //=> Invalid Date\n */\nexport const minTime = -maxTime;\n\n/**\n * @constant\n * @name millisecondsInWeek\n * @summary Milliseconds in 1 week.\n */\nexport const millisecondsInWeek = 604800000;\n\n/**\n * @constant\n * @name millisecondsInDay\n * @summary Milliseconds in 1 day.\n */\nexport const millisecondsInDay = 86400000;\n\n/**\n * @constant\n * @name millisecondsInMinute\n * @summary Milliseconds in 1 minute\n */\nexport const millisecondsInMinute = 60000;\n\n/**\n * @constant\n * @name millisecondsInHour\n * @summary Milliseconds in 1 hour\n */\nexport const millisecondsInHour = 3600000;\n\n/**\n * @constant\n * @name millisecondsInSecond\n * @summary Milliseconds in 1 second\n */\nexport const millisecondsInSecond = 1000;\n\n/**\n * @constant\n * @name minutesInYear\n * @summary Minutes in 1 year.\n */\nexport const minutesInYear = 525600;\n\n/**\n * @constant\n * @name minutesInMonth\n * @summary Minutes in 1 month.\n */\nexport const minutesInMonth = 43200;\n\n/**\n * @constant\n * @name minutesInDay\n * @summary Minutes in 1 day.\n */\nexport const minutesInDay = 1440;\n\n/**\n * @constant\n * @name minutesInHour\n * @summary Minutes in 1 hour.\n */\nexport const minutesInHour = 60;\n\n/**\n * @constant\n * @name monthsInQuarter\n * @summary Months in 1 quarter.\n */\nexport const monthsInQuarter = 3;\n\n/**\n * @constant\n * @name monthsInYear\n * @summary Months in 1 year.\n */\nexport const monthsInYear = 12;\n\n/**\n * @constant\n * @name quartersInYear\n * @summary Quarters in 1 year\n */\nexport const quartersInYear = 4;\n\n/**\n * @constant\n * @name secondsInHour\n * @summary Seconds in 1 hour.\n */\nexport const secondsInHour = 3600;\n\n/**\n * @constant\n * @name secondsInMinute\n * @summary Seconds in 1 minute.\n */\nexport const secondsInMinute = 60;\n\n/**\n * @constant\n * @name secondsInDay\n * @summary Seconds in 1 day.\n */\nexport const secondsInDay = secondsInHour * 24;\n\n/**\n * @constant\n * @name secondsInWeek\n * @summary Seconds in 1 week.\n */\nexport const secondsInWeek = secondsInDay * 7;\n\n/**\n * @constant\n * @name secondsInYear\n * @summary Seconds in 1 year.\n */\nexport const secondsInYear = secondsInDay * daysInYear;\n\n/**\n * @constant\n * @name secondsInMonth\n * @summary Seconds in 1 month\n */\nexport const secondsInMonth = secondsInYear / 12;\n\n/**\n * @constant\n * @name secondsInQuarter\n * @summary Seconds in 1 quarter.\n */\nexport const secondsInQuarter = secondsInMonth * 3;\n\n/**\n * @constant\n * @name constructFromSymbol\n * @summary Symbol enabling Date extensions to inherit properties from the reference date.\n *\n * The symbol is used to enable the `constructFrom` function to construct a date\n * using a reference date and a value. It allows to transfer extra properties\n * from the reference date to the new date. It's useful for extensions like\n * [`TZDate`](https://github.com/date-fns/tz) that accept a time zone as\n * a constructor argument.\n */\nexport const constructFromSymbol = Symbol.for(\"constructDateFrom\");\n","import { constructFromSymbol } from \"./constants.js\";\n\n/**\n * @name constructFrom\n * @category Generic Helpers\n * @summary Constructs a date using the reference date and the value\n *\n * @description\n * The function constructs a new date using the constructor from the reference\n * date and the given value. It helps to build generic functions that accept\n * date extensions.\n *\n * It defaults to `Date` if the passed reference date is a number or a string.\n *\n * Starting from v3.7.0, it allows to construct a date using `[Symbol.for(\"constructDateFrom\")]`\n * enabling to transfer extra properties from the reference date to the new date.\n * It's useful for extensions like [`TZDate`](https://github.com/date-fns/tz)\n * that accept a time zone as a constructor argument.\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 reference date to take constructor from\n * @param value - The value to create the date\n *\n * @returns Date initialized using the given date and value\n *\n * @example\n * import { constructFrom } from \"./constructFrom/date-fns\";\n *\n * // A function that clones a date preserving the original type\n * function cloneDate<DateType extends Date>(date: DateType): DateType {\n * return constructFrom(\n * date, // Use constructor from the given date\n * date.getTime() // Use the date value to create a new date\n * );\n * }\n */\nexport function constructFrom(date, value) {\n if (typeof date === \"function\") return date(value);\n\n if (date && typeof date === \"object\" && constructFromSymbol in date)\n return date[constructFromSymbol](value);\n\n if (date instanceof Date) return new date.constructor(value);\n\n return new Date(value);\n}\n\n// Fallback for modularized imports:\nexport default constructFrom;\n","import { constructFrom } from \"../constructFrom.js\";\n\nexport function normalizeDates(context, ...dates) {\n const normalize = constructFrom.bind(\n null,\n context || dates.find((date) => typeof date === \"object\"),\n );\n return dates.map(normalize);\n}\n","import { constructFrom } from \"./constructFrom.js\";\n\n/**\n * @name toDate\n * @category Common Helpers\n * @summary Convert the given argument to an instance of Date.\n *\n * @description\n * Convert the given argument to an instance of Date.\n *\n * If the argument is an instance of Date, the function returns its clone.\n *\n * If the argument is a number, it is treated as a timestamp.\n *\n * If the argument is none of the above, the function returns Invalid Date.\n *\n * Starting from v3.7.0, it clones a date using `[Symbol.for(\"constructDateFrom\")]`\n * enabling to transfer extra properties from the reference date to the new date.\n * It's useful for extensions like [`TZDate`](https://github.com/date-fns/tz)\n * that accept a time zone as a constructor argument.\n *\n * **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.\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 * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.\n *\n * @param argument - The value to convert\n *\n * @returns The parsed date in the local time zone\n *\n * @example\n * // Clone the date:\n * const result = toDate(new Date(2014, 1, 11, 11, 30, 30))\n * //=> Tue Feb 11 2014 11:30:30\n *\n * @example\n * // Convert the timestamp to date:\n * const result = toDate(1392098430000)\n * //=> Tue Feb 11 2014 11:30:30\n */\nexport function toDate(argument, context) {\n // [TODO] Get rid of `toDate` or `constructFrom`?\n return constructFrom(context || argument, argument);\n}\n\n// Fallback for modularized imports:\nexport default toDate;\n","import { toDate } from \"../toDate.js\";\n\n/**\n * Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds.\n * They usually appear for dates that denote time before the timezones were introduced\n * (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891\n * and GMT+01:00:00 after that date)\n *\n * Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above,\n * which would lead to incorrect calculations.\n *\n * This function returns the timezone offset in milliseconds that takes seconds in account.\n */\nexport function getTimezoneOffsetInMilliseconds(date) {\n const _date = toDate(date);\n const utcDate = new Date(\n Date.UTC(\n _date.getFullYear(),\n _date.getMonth(),\n _date.getDate(),\n _date.getHours(),\n _date.getMinutes(),\n _date.getSeconds(),\n _date.getMilliseconds(),\n ),\n );\n utcDate.setUTCFullYear(_date.getFullYear());\n return +date - +utcDate;\n}\n","import { toDate } from \"./toDate.js\";\n\n/**\n * The {@link startOfDay} function options.\n */\n\n/**\n * @name startOfDay\n * @category Day Helpers\n * @summary Return the start of a day for the given date.\n *\n * @description\n * Return the start 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 * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.\n *\n * @param date - The original date\n * @param options - The options\n *\n * @returns The start of a day\n *\n * @example\n * // The start of a day for 2 September 2014 11:55:00:\n * const result = startOfDay(new Date(2014, 8, 2, 11, 55, 0))\n * //=> Tue Sep 02 2014 00:00:00\n */\nexport function startOfDay(date, options) {\n const _date = toDate(date, options?.in);\n _date.setHours(0, 0, 0, 0);\n return _date;\n}\n\n// Fallback for modularized imports:\nexport default startOfDay;\n","import { getTimezoneOffsetInMilliseconds } from \"./_lib/getTimezoneOffsetInMilliseconds.js\";\nimport { normalizeDates } from \"./_lib/normalizeDates.js\";\nimport { millisecondsInDay } from \"./constants.js\";\nimport { startOfDay } from \"./startOfDay.js\";\n\n/**\n * The {@link differenceInCalendarDays} function options.\n */\n\n/**\n * @name differenceInCalendarDays\n * @category Day Helpers\n * @summary Get the number of calendar days between the given dates.\n *\n * @description\n * Get the number of calendar days between the given dates. This means that the times are removed\n * from the dates and then the difference in days is calculated.\n *\n * @param laterDate - The later date\n * @param earlierDate - The earlier date\n * @param options - The options object\n *\n * @returns The number of calendar days\n *\n * @example\n * // How many calendar days are between\n * // 2 July 2011 23:00:00 and 2 July 2012 00:00:00?\n * const result = differenceInCalendarDays(\n * new Date(2012, 6, 2, 0, 0),\n * new Date(2011, 6, 2, 23, 0)\n * )\n * //=> 366\n * // How many calendar days are between\n * // 2 July 2011 23:59:00 and 3 July 2011 00:01:00?\n * const result = differenceInCalendarDays(\n * new Date(2011, 6, 3, 0, 1),\n * new Date(2011, 6, 2, 23, 59)\n * )\n * //=> 1\n */\nexport function differenceInCalendarDays(laterDate, earlierDate, options) {\n const [laterDate_, earlierDate_] = normalizeDates(\n options?.in,\n laterDate,\n earlierDate,\n );\n\n const laterStartOfDay = startOfDay(laterDate_);\n const earlierStartOfDay = startOfDay(earlierDate_);\n\n const laterTimestamp =\n +laterStartOfDay - getTimezoneOffsetInMilliseconds(laterStartOfDay);\n const earlierTimestamp =\n +earlierStartOfDay - getTimezoneOffsetInMilliseconds(earlierStartOfDay);\n\n // Round the number of days to the nearest integer because the number of\n // milliseconds in a day is not constant (e.g. it's different in the week of\n // the daylight saving time clock shift).\n return Math.round((laterTimestamp - earlierTimestamp) / millisecondsInDay);\n}\n\n// Fallback for modularized imports:\nexport default differenceInCalendarDays;\n","import { normalizeDates } from \"./_lib/normalizeDates.js\";\n\n/**\n * The {@link differenceInCalendarMonths} function options.\n */\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 * @param laterDate - The later date\n * @param earlierDate - The earlier date\n * @param options - An object with options\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(laterDate, earlierDate, options) {\n const [laterDate_, earlierDate_] = normalizeDates(\n options?.in,\n laterDate,\n earlierDate,\n );\n\n const yearsDiff = laterDate_.getFullYear() - earlierDate_.getFullYear();\n const monthsDiff = laterDate_.getMonth() - earlierDate_.getMonth();\n\n return yearsDiff * 12 + monthsDiff;\n}\n\n// Fallback for modularized imports:\nexport default differenceInCalendarMonths;\n","import { toDate } from \"./toDate.js\";\n\n/**\n * The {@link getQuarter} function options.\n */\n\n/**\n * @name getQuarter\n * @category Quarter Helpers\n * @summary Get the year quarter of the given date.\n *\n * @description\n * Get the year quarter of the given date.\n *\n * @param date - The given date\n * @param options - An object with options\n *\n * @returns The quarter\n *\n * @example\n * // Which quarter is 2 July 2014?\n * const result = getQuarter(new Date(2014, 6, 2));\n * //=> 3\n */\nexport function getQuarter(date, options) {\n const _date = toDate(date, options?.in);\n const quarter = Math.trunc(_date.getMonth() / 3) + 1;\n return quarter;\n}\n\n// Fallback for modularized imports:\nexport default getQuarter;\n","import { normalizeDates } from \"./_lib/normalizeDates.js\";\nimport { getQuarter } from \"./getQuarter.js\";\n\n/**\n * The {@link differenceInCalendarQuarters} function options.\n */\n\n/**\n * @name differenceInCalendarQuarters\n * @category Quarter Helpers\n * @summary Get the number of calendar quarters between the given dates.\n *\n * @description\n * Get the number of calendar quarters between the given dates.\n *\n * @param laterDate - The later date\n * @param earlierDate - The earlier date\n * @param options - An object with options\n *\n * @returns The number of calendar quarters\n *\n * @example\n * // How many calendar quarters are between 31 December 2013 and 2 July 2014?\n * const result = differenceInCalendarQuarters(\n * new Date(2014, 6, 2),\n * new Date(2013, 11, 31)\n * )\n * //=> 3\n */\nexport function differenceInCalendarQuarters(laterDate, earlierDate, options) {\n const [laterDate_, earlierDate_] = normalizeDates(\n options?.in,\n laterDate,\n earlierDate,\n );\n\n const yearsDiff = laterDate_.getFullYear() - earlierDate_.getFullYear();\n const quartersDiff = getQuarter(laterDate_) - getQuarter(earlierDate_);\n\n return yearsDiff * 4 + quartersDiff;\n}\n\n// Fallback for modularized imports:\nexport default differenceInCalendarQuarters;\n","let defaultOptions = {};\n\nexport function getDefaultOptions() {\n return defaultOptions;\n}\n\nexport function setDefaultOptions(newOptions) {\n defaultOptions = newOptions;\n}\n","import { getDefaultOptions } from \"./_lib/defaultOptions.js\";\nimport { toDate } from \"./toDate.js\";\n\n/**\n * The {@link startOfWeek} function options.\n */\n\n/**\n * @name startOfWeek\n * @category Week Helpers\n * @summary Return the start of a week for the given date.\n *\n * @description\n * Return the start of a week 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 * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.\n *\n * @param date - The original date\n * @param options - An object with options\n *\n * @returns The start of a week\n *\n * @example\n * // The start of a week for 2 September 2014 11:55:00:\n * const result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0))\n * //=> Sun Aug 31 2014 00:00:00\n *\n * @example\n * // If the week starts on Monday, the start of the week for 2 September 2014 11:55:00:\n * const result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0), { weekStartsOn: 1 })\n * //=> Mon Sep 01 2014 00:00:00\n */\nexport function startOfWeek(date, options) {\n const defaultOptions = getDefaultOptions();\n const weekStartsOn =\n options?.weekStartsOn ??\n options?.locale?.options?.weekStartsOn ??\n defaultOptions.weekStartsOn ??\n defaultOptions.locale?.options?.weekStartsOn ??\n 0;\n\n const _date = toDate(date, options?.in);\n const day = _date.getDay();\n const diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;\n\n _date.setDate(_date.getDate() - diff);\n _date.setHours(0, 0, 0, 0);\n return _date;\n}\n\n// Fallback for modularized imports:\nexport default startOfWeek;\n","import { getTimezoneOffsetInMilliseconds } from \"./_lib/getTimezoneOffsetInMilliseconds.js\";\nimport { normalizeDates } from \"./_lib/normalizeDates.js\";\nimport { millisecondsInWeek } from \"./constants.js\";\nimport { startOfWeek } from \"./startOfWeek.js\";\n\n/**\n * The {@link differenceInCalendarWeeks} function options.\n */\n\n/**\n * @name differenceInCalendarWeeks\n * @category Week Helpers\n * @summary Get the number of calendar weeks between the given dates.\n *\n * @description\n * Get the number of calendar weeks between the given dates.\n *\n * @param laterDate - The later date\n * @param earlierDate - The earlier date\n * @param options - An object with options.\n *\n * @returns The number of calendar weeks\n *\n * @example\n * // How many calendar weeks are between 5 July 2014 and 20 July 2014?\n * const result = differenceInCalendarWeeks(\n * new Date(2014, 6, 20),\n * new Date(2014, 6, 5)\n * )\n * //=> 3\n *\n * @example\n * // If the week starts on Monday,\n * // how many calendar weeks are between 5 July 2014 and 20 July 2014?\n * const result = differenceInCalendarWeeks(\n * new Date(2014, 6, 20),\n * new Date(2014, 6, 5),\n * { weekStartsOn: 1 }\n * )\n * //=> 2\n */\nexport function differenceInCalendarWeeks(laterDate, earlierDate, options) {\n const [laterDate_, earlierDate_] = normalizeDates(\n options?.in,\n laterDate,\n earlierDate,\n );\n\n const laterStartOfWeek = startOfWeek(laterDate_, options);\n const earlierStartOfWeek = startOfWeek(earlierDate_, options);\n\n const laterTimestamp =\n +laterStartOfWeek - getTimezoneOffsetInMilliseconds(laterStartOfWeek);\n const earlierTimestamp =\n +earlierStartOfWeek - getTimezoneOffsetInMilliseconds(earlierStartOfWeek);\n\n return Math.round((laterTimestamp - earlierTimestamp) / millisecondsInWeek);\n}\n\n// Fallback for modularized imports:\nexport default differenceInCalendarWeeks;\n","import { normalizeDates } from \"./_lib/normalizeDates.js\";\n\n/**\n * The {@link differenceInCalendarYears} function options.\n */\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 * @param laterDate - The later date\n * @param earlierDate - The earlier date\n * @param options - An object with options\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(laterDate, earlierDate, options) {\n const [laterDate_, earlierDate_] = normalizeDates(\n options?.in,\n laterDate,\n earlierDate,\n );\n return laterDate_.getFullYear() - earlierDate_.getFullYear();\n}\n\n// Fallback for modularized imports:\nexport default differenceInCalendarYears;\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 { getRoundingMethod } from \"./_lib/getRoundingMethod.js\";\nimport { normalizeDates } from \"./_lib/normalizeDates.js\";\nimport { millisecondsInHour } from \"./constants.js\";\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 * @param laterDate - The later date\n * @param earlierDate - 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(laterDate, earlierDate, options) {\n const [laterDate_, earlierDate_] = normalizeDates(\n options?.in,\n laterDate,\n earlierDate,\n );\n const diff = (+laterDate_ - +earlierDate_) / millisecondsInHour;\n return getRoundingMethod(options?.roundingMethod)(diff);\n}\n\n// Fallback for modularized imports:\nexport default differenceInHours;\n","import { toDate } from \"./toDate.js\";\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 * @param laterDate - The later date\n * @param earlierDate - 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(laterDate, earlierDate) {\n return +toDate(laterDate) - +toDate(earlierDate);\n}\n\n// Fallback for modularized imports:\nexport default differenceInMilliseconds;\n","import { getRoundingMethod } from \"./_lib/getRoundingMethod.js\";\nimport { millisecondsInMinute } from \"./constants.js\";\nimport { differenceInMilliseconds } from \"./differenceInMilliseconds.js\";\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 * @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 { getRoundingMethod } from \"./_lib/getRoundingMethod.js\";\nimport { differenceInMilliseconds } from \"./differenceInMilliseconds.js\";\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 * @param laterDate - The later date\n * @param earlierDate - 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(laterDate, earlierDate, options) {\n const diff = differenceInMilliseconds(laterDate, earlierDate) / 1000;\n return getRoundingMethod(options?.roundingMethod)(diff);\n}\n\n// Fallback for modularized imports:\nexport default differenceInSeconds;\n","import { normalizeDates } from \"./_lib/normalizeDates.js\";\nimport {\n secondsInDay,\n secondsInHour,\n secondsInMinute,\n secondsInMonth,\n secondsInQuarter,\n secondsInWeek,\n secondsInYear,\n} from \"./constants.js\";\nimport { differenceInCalendarDays } from \"./differenceInCalendarDays.js\";\nimport { differenceInCalendarMonths } from \"./differenceInCalendarMonths.js\";\nimport { differenceInCalendarQuarters } from \"./differenceInCalendarQuarters.js\";\nimport { differenceInCalendarWeeks } from \"./differenceInCalendarWeeks.js\";\nimport { differenceInCalendarYears } from \"./differenceInCalendarYears.js\";\nimport { differenceInHours } from \"./differenceInHours.js\";\nimport { differenceInMinutes } from \"./differenceInMinutes.js\";\nimport { differenceInSeconds } from \"./differenceInSeconds.js\";\n\n/**\n * The {@link intlFormatDistance} function options.\n */\n\n/**\n * The unit used to format the distance in {@link intlFormatDistance}.\n */\n\n/**\n * @name intlFormatDistance\n * @category Common Helpers\n * @summary Formats distance between two dates in a human-readable format\n * @description\n * The function calculates the difference between two dates and formats it as a human-readable string.\n *\n * The function will pick the most appropriate unit depending on the distance between dates. For example, if the distance is a few hours, it might return `x hours`. If the distance is a few months, it might return `x months`.\n *\n * You can also specify a unit to force using it regardless of the distance to get a result like `123456 hours`.\n *\n * See the table below for the unit picking logic:\n *\n * | Distance between dates | Result (past) | Result (future) |\n * | ---------------------- | -------------- | --------------- |\n * | 0 seconds | now | now |\n * | 1-59 seconds | X seconds ago | in X seconds |\n * | 1-59 minutes | X minutes ago | in X minutes |\n * | 1-23 hours | X hours ago | in X hours |\n * | 1 day | yesterday | tomorrow |\n * | 2-6 days | X days ago | in X days |\n * | 7 days | last week | next week |\n * | 8 days-1 month | X weeks ago | in X weeks |\n * | 1 month | last month | next month |\n * | 2-3 months | X months ago | in X months |\n * | 1 quarter | last quarter | next quarter |\n * | 2-3 quarters | X quarters ago | in X quarters |\n * | 1 year | last year | next year |\n * | 2+ years | X years ago | in X years |\n *\n * @param laterDate - The date\n * @param earlierDate - The date to compare with.\n * @param options - An object with options.\n * See MDN for details [Locale identification and negotiation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#locale_identification_and_negotiation)\n * The narrow one could be similar to the short one for some locales.\n *\n * @returns The distance in words according to language-sensitive relative time formatting.\n *\n * @throws `date` must not be Invalid Date\n * @throws `baseDate` must not be Invalid Date\n * @throws `options.unit` must not be invalid Unit\n * @throws `options.locale` must not be invalid locale\n * @throws `options.localeMatcher` must not be invalid localeMatcher\n * @throws `options.numeric` must not be invalid numeric\n * @throws `options.style` must not be invalid style\n *\n * @example\n * // What is the distance between the dates when the fist date is after the second?\n * intlFormatDistance(\n * new Date(1986, 3, 4, 11, 30, 0),\n * new Date(1986, 3, 4, 10, 30, 0)\n * )\n * //=> 'in 1 hour'\n *\n * // What is the distance between the dates when the fist date is before the second?\n * intlFormatDistance(\n * new Date(1986, 3, 4, 10, 30, 0),\n * new Date(1986, 3, 4, 11, 30, 0)\n * )\n * //=> '1 hour ago'\n *\n * @example\n * // Use the unit option to force the function to output the result in quarters. Without setting it, the example would return \"next year\"\n * intlFormatDistance(\n * new Date(1987, 6, 4, 10, 30, 0),\n * new Date(1986, 3, 4, 10, 30, 0),\n * { unit: 'quarter' }\n * )\n * //=> 'in 5 quarters'\n *\n * @example\n * // Use the locale option to get the result in Spanish. Without setting it, the example would return \"in 1 hour\".\n * intlFormatDistance(\n * new Date(1986, 3, 4, 11, 30, 0),\n * new Date(1986, 3, 4, 10, 30, 0),\n * { locale: 'es' }\n * )\n * //=> 'dentro de 1 hora'\n *\n * @example\n * // Use the numeric option to force the function to use numeric values. Without setting it, the example would return \"tomorrow\".\n * intlFormatDistance(\n * new Date(1986, 3, 5, 11, 30, 0),\n * new Date(1986, 3, 4, 11, 30, 0),\n * { numeric: 'always' }\n * )\n * //=> 'in 1 day'\n *\n * @example\n * // Use the style option to force the function to use short values. Without setting it, the example would return \"in 2 years\".\n * intlFormatDistance(\n * new Date(1988, 3, 4, 11, 30, 0),\n * new Date(1986, 3, 4, 11, 30, 0),\n * { style: 'short' }\n * )\n * //=> 'in 2 yr'\n */\nexport function intlFormatDistance(laterDate, earlierDate, options) {\n let value = 0;\n let unit;\n\n const [laterDate_, earlierDate_] = normalizeDates(\n options?.in,\n laterDate,\n earlierDate,\n );\n\n if (!options?.unit) {\n // Get the unit based on diffInSeconds calculations if no unit is specified\n const diffInSeconds = differenceInSeconds(laterDate_, earlierDate_); // The smallest unit\n\n if (Math.abs(diffInSeconds) < secondsInMinute) {\n value = differenceInSeconds(laterDate_, earlierDate_);\n unit = \"second\";\n } else if (Math.abs(diffInSeconds) < secondsInHour) {\n value = differenceInMinutes(laterDate_, earlierDate_);\n unit = \"minute\";\n } else if (\n Math.abs(diffInSeconds) < secondsInDay &&\n Math.abs(differenceInCalendarDays(laterDate_, earlierDate_)) < 1\n ) {\n value = differenceInHours(laterDate_, earlierDate_);\n unit = \"hour\";\n } else if (\n Math.abs(diffInSeconds) < secondsInWeek &&\n (value = differenceInCalendarDays(laterDate_, earlierDate_)) &&\n Math.abs(value) < 7\n ) {\n unit = \"day\";\n } else if (Math.abs(diffInSeconds) < secondsInMonth) {\n value = differenceInCalendarWeeks(laterDate_, earlierDate_);\n unit = \"week\";\n } else if (Math.abs(diffInSeconds) < secondsInQuarter) {\n value = differenceInCalendarMonths(laterDate_, earlierDate_);\n unit = \"month\";\n } else if (Math.abs(diffInSeconds) < secondsInYear) {\n if (differenceInCalendarQuarters(laterDate_, earlierDate_) < 4) {\n // To filter out cases that are less than a year but match 4 quarters\n value = differenceInCalendarQuarters(laterDate_, earlierDate_);\n unit = \"quarter\";\n } else {\n value = differenceInCalendarYears(laterDate_, earlierDate_);\n unit = \"year\";\n }\n } else {\n value = differenceInCalendarYears(laterDate_, earlierDate_);\n unit = \"year\";\n }\n } else {\n // Get the value if unit is specified\n unit = options?.unit;\n if (unit === \"second\") {\n value = differenceInSeconds(laterDate_, earlierDate_);\n } else if (unit === \"minute\") {\n value = differenceInMinutes(laterDate_, earlierDate_);\n } else if (unit === \"hour\") {\n value = differenceInHours(laterDate_, earlierDate_);\n } else if (unit === \"day\") {\n value = differenceInCalendarDays(laterDate_, earlierDate_);\n } else if (unit === \"week\") {\n value = differenceInCalendarWeeks(laterDate_, earlierDate_);\n } else if (unit === \"month\") {\n value = differenceInCalendarMonths(laterDate_, earlierDate_);\n } else if (unit === \"quarter\") {\n value = differenceInCalendarQuarters(laterDate_, earlierDate_);\n } else if (unit === \"year\") {\n value = differenceInCalendarYears(laterDate_, earlierDate_);\n }\n }\n\n const rtf = new Intl.RelativeTimeFormat(options?.locale, {\n numeric: \"auto\",\n ...options,\n });\n\n return rtf.format(value, unit);\n}\n\n// Fallback for modularized imports:\nexport default intlFormatDistance;\n","import { intlFormatDistance } from 'date-fns/intlFormatDistance';\n\nfunction getLocale(locale?: string) {\n const defaultLocale = 'en-US';\n if (!locale) {\n if (typeof navigator !== 'undefined') {\n locale = navigator.language;\n } else {\n locale = defaultLocale;\n }\n }\n\n return locale;\n}\nexport function formatDistance(timestamp: Date, localeParam?: string) {\n const locale = getLocale(localeParam);\n\n return intlFormatDistance(timestamp, new Date(), { locale, style: 'short' });\n}\n\nexport function formatDate(date: Date, localeParam?: string) {\n const locale = getLocale(localeParam);\n\n return date.toLocaleDateString(locale, {\n month: 'short',\n day: 'numeric',\n year: 'numeric',\n hour: 'numeric',\n minute: '2-digit',\n hour12: true,\n });\n}\n\nexport function formatChartTick(value: Date | string | undefined, locale = 'en-US'): string {\n if (typeof value === 'string') return value;\n if (!(value instanceof Date)) return '';\n\n return value.toLocaleDateString(locale, { month: 'short', day: 'numeric' });\n}\n\nexport function formatChartLabel(value: Date | string | undefined, locale = 'en-US'): string {\n if (typeof value === 'string') return value;\n if (!(value instanceof Date)) return '';\n\n return value.toLocaleDateString(locale, { month: 'long', day: 'numeric', year: 'numeric' });\n}\n"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AASA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,UAAU,GAAG,QAAQ;;AAkClC;AACA;AACA;AACA;AACA;AACO,MAAM,kBAAkB,GAAG,SAAS;;AAE3C;AACA;AACA;AACA;AACA;AACO,MAAM,iBAAiB,GAAG,QAAQ;;AAEzC;AACA;AAC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;AACH;;ACHA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,iBAAiB,CAAC,SAAS,EAAE,WAAW,EAAE,OAAO,EAAE;AACnE,EAAE,MAAM,CAAC,UAAU,EAAE,YAAY,CAAC,GAAG,cAAc;AACnD,IAAI,OAAO,EAAE,EAAE;AACf,IAAI,SAAS;AACb,IAAI,WAAW;AACf,GAAG;AACH,EAAE,MAAM,IAAI,GAAG,CAAC,CAAC,UAAU,GAAG,CAAC,YAAY,IAAI,kBAAkB;AACjE,EAAE,OAAO,iBAAiB,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC,IAAI,CAAC;AACzD;;ACpCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,wBAAwB,CAAC,SAAS,EAAE,WAAW,EAAE;AACjE,EAAE,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC;AAClD;;ACtBA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,mBAAmB,CAAC,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE;AAClE,EAAE,MAAM,IAAI;AACZ,IAAI,wBAAwB,CAAC,QAAQ,EAAE,SAAS,CAAC,GAAG,oBAAoB;AACxE,EAAE,OAAO,iBAAiB,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC,IAAI,CAAC;AACzD;;ACvCA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,mBAAmB,CAAC,SAAS,EAAE,WAAW,EAAE,OAAO,EAAE;AACrE,EAAE,MAAM,IAAI,GAAG,wBAAwB,CAAC,SAAS,EAAE,WAAW,CAAC,GAAG,IAAI;AACtE,EAAE,OAAO,iBAAiB,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC,IAAI,CAAC;AACzD;;ACdA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,kBAAkB,CAAC,SAAS,EAAE,WAAW,EAAE,OAAO,EAAE;AACpE,EAAE,IAAI,KAAK,GAAG,CAAC;AACf,EAAE,IAAI,IAAI;;AAEV,EAAE,MAAM,CAAC,UAAU,EAAE,YAAY,CAAC,GAAG,cAAc;AACnD,IAAI,OAAO,EAAE,EAAE;AACf,IAAI,SAAS;AACb,IAAI,WAAW;AACf,GAAG;;AAEH,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,EAAE;AACtB;AACA,IAAI,MAAM,aAAa,GAAG,mBAAmB,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;;AAExE,IAAI,IAAI,IAAI,CAAC,GAAG,CAAC,aAAa,CAAC,GAAG,eAAe,EAAE;AACnD,MAAM,KA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AQ,SAAA;AAAA,IACR,MAAA,EAAQ;AAAA,GACT,CAAA;AACH;AAEO,SAAS,eAAA,CAAgB,KAAA,EAAkC,MAAA,GAAS,OAAA,EAAiB;AAC1F,EAAA,IAAI,OAAO,KAAA,KAAU,QAAA,EAAU,OAAO,KAAA;AACtC,EAAA,IAAI,EAAE,KAAA,YAAiB,IAAA,CAAA,EAAO,OAAO,EAAA;AAErC,EAAA,OAAO,KAAA,CAAM,mBAAmB,MAAA,EAAQ,EAAE,OAAO,OAAA,EAAS,GAAA,EAAK,WAAW,CAAA;AAC5E;AAEO,SAAS,gBAAA,CAAiB,KAAA,EAAkC,MAAA,GAAS,OAAA,EAAiB;AAC3F,EAAA,IAAI,OAAO,KAAA,KAAU,QAAA,EAAU,OAAO,KAAA;AACtC,EAAA,IAAI,EAAE,KAAA,YAAiB,IAAA,CAAA,EAAO,OAAO,EAAA;AAErC,EAAA,OAAO,KAAA,CAAM,kBAAA,CAAmB,MAAA,EAAQ,EAAE,KAAA,EAAO,QAAQ,GAAA,EAAK,SAAA,EAAW,IAAA,EAAM,SAAA,EAAW,CAAA;AAC5F;;;;","x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]}
|
|
@@ -2,7 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import React__default, { useState, useCallback, useMemo, useContext, createContext, forwardRef } from 'react';
|
|
3
3
|
import { Circle } from '@phosphor-icons/react';
|
|
4
4
|
import { c as cn } from './utils.Cwtlq8dh.js';
|
|
5
|
-
import { b as formatDistance } from './formatDate.
|
|
5
|
+
import { b as formatDistance } from './formatDate.CWN6IFKq.js';
|
|
6
6
|
import { S as StatusBadge } from './status-badge.eFJ1PYeb.js';
|
|
7
7
|
|
|
8
8
|
function EditCount({ count }) {
|
|
@@ -108,4 +108,4 @@ const ReviewList = forwardRef(({ items, className, ...props }, ref) => {
|
|
|
108
108
|
ReviewList.displayName = "ReviewList";
|
|
109
109
|
|
|
110
110
|
export { EditCount as E, ReviewList as R, ReviewListItem as a, ReviewsSelectionProvider as b, useReviewsSelection as u };
|
|
111
|
-
//# sourceMappingURL=review-list.
|
|
111
|
+
//# sourceMappingURL=review-list.BJ-4eNKh.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"review-list.Dhuy7ITv.js","sources":["../../../src/scenes/knowledge-review/review-list/edit-count.tsx","../../../src/scenes/knowledge-review/review-list/review-list-item.tsx","../../../src/scenes/knowledge-review/context.tsx","../../../src/scenes/knowledge-review/review-list/review-list.tsx"],"sourcesContent":["import React from 'react';\nimport { Circle } from '@phosphor-icons/react';\n\nexport function EditCount({ count }: { count: number }) {\n return (\n <span className=\"inline-flex items-center gap-0.5\">\n <Circle size={8} weight=\"fill\" aria-hidden=\"true\" className=\"text-blue\" />\n <span className=\"text-xs leading-4 text-subtle\">\n {count} {count === 1 ? 'edit' : 'edits'}\n </span>\n </span>\n );\n}\n","import * as React from 'react';\n\nimport { EditCount } from './edit-count';\n\nimport { cn } from '@/lib/utils';\nimport { formatDistance } from '@/lib/formatDate';\nimport { StatusBadge } from '@/components/convos/status-badge';\n\nexport interface ReviewListItemProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n /** Unique identifier for the knowledge article */\n id: string;\n /** Primary text displayed in the first row */\n title: string;\n /** Content rendered in the top-right corner (e.g. relative timestamp) */\n timestamp: Date;\n /** Icon rendered at the start of the second row */\n icon?: React.ReactNode;\n /** Text or content next to the icon in the second row */\n description?: string | null;\n /** Whether this item is new */\n isNew?: boolean;\n /** Whether this item has been accepted (e.g. accepted as draft) */\n isAccepted?: boolean;\n /** Number of edits for this item */\n editCount?: number;\n /** Whether this item is currently selected */\n isSelected?: boolean;\n}\n\nexport const ReviewListItem = React.forwardRef<HTMLButtonElement, ReviewListItemProps>(function ReviewListItem(\n { title, timestamp, icon, description, isNew, isAccepted, editCount, isSelected = false, className, ...props },\n ref,\n) {\n let status: React.ReactNode | undefined;\n if (isAccepted) {\n status = <StatusBadge variant=\"accepted\">Accepted</StatusBadge>;\n } else if (isNew) {\n status = <StatusBadge variant=\"success\">New</StatusBadge>;\n } else if (editCount) {\n status = <EditCount count={editCount} />;\n }\n\n return (\n <button\n {...props}\n ref={ref}\n type=\"button\"\n aria-pressed={isSelected}\n className={cn(\n 'relative flex w-full flex-col gap-1 bg-surface rounded p-4 cursor-pointer transition-colors text-left border border-transparent',\n isSelected\n ? [\n 'shadow-[0px_1px_3px_0px_rgba(95,95,95,0.26)]',\n 'after:content-[\"\"] after:block after:absolute after:right-[-2px] after:top-1/2 after:-translate-y-1/2 after:w-1 after:h-14 after:rounded-sm after:bg-primary',\n ]\n : 'hover:bg-dark-100 hover:border-dark-300',\n className,\n )}\n >\n {/* Row 1: Title + Timestamp */}\n <span className=\"flex items-center justify-between w-full gap-2\">\n <span className={cn('text-sm text-default truncate min-w-0 flex-1', isSelected ? 'font-bold' : 'font-normal')}>\n {title}\n </span>\n {timestamp && <span className=\"text-xs leading-4 text-subtlest shrink-0\">{formatDistance(timestamp)}</span>}\n </span>\n\n {/* Row 2: Icon + Description + Status */}\n {(icon || description || status) && (\n <span className=\"flex items-center gap-1 leading-4\">\n {icon && <span className=\"shrink-0 flex items-center\">{icon}</span>}\n {description && <span className=\"text-xs text-subtle truncate\">{description}</span>}\n {status && <span className=\"shrink-0 ml-1 flex items-center\">{status}</span>}\n </span>\n )}\n </button>\n );\n});\n","import React, { createContext, useCallback, useContext, useMemo, useState } from 'react';\n\nimport type { ReviewListItemProps } from './review-list/review-list-item';\n\nexport type LoadedDiffDoc = {\n isNew: boolean;\n diffTitle: string;\n diffContent: React.ReactNode;\n};\n\ntype ReviewsSelectionValue = {\n selectedItem: ReviewListItemProps | null;\n setSelectedItem: (item: ReviewListItemProps | null) => void;\n loadedDiffDoc: LoadedDiffDoc | null;\n setLoadedDiffDoc: (doc: LoadedDiffDoc | null) => void;\n loadingDiff: boolean;\n setLoadingDiff: (loading: boolean) => void;\n onApproveAllSuggestions: () => void;\n onRejectAllSuggestions: () => void;\n onOpenArticleLink?: () => void;\n onSourceLinkClick?: () => void;\n breadcrumb?: string;\n};\n\nconst ReviewsContext = createContext<ReviewsSelectionValue | null>(null);\n\nexport type ReviewsProviderProps = {\n children: React.ReactNode;\n /** Optional initial selection (e.g. from server or mock data) */\n defaultSelectedItem?: ReviewListItemProps | null;\n onApproveAllSuggestions: () => void;\n onRejectAllSuggestions: () => void;\n onOpenArticleLink?: () => void;\n onSourceLinkClick?: () => void;\n breadcrumb?: string;\n};\n\nexport function ReviewsSelectionProvider({\n children,\n defaultSelectedItem = null,\n onApproveAllSuggestions,\n onRejectAllSuggestions,\n onOpenArticleLink,\n onSourceLinkClick,\n breadcrumb,\n}: ReviewsProviderProps) {\n const [userSelectedItem, setUserSelectedItem] = useState<ReviewListItemProps | null>(null);\n const selectedItem = userSelectedItem ?? defaultSelectedItem;\n\n const [loadedDiffDoc, setLoadedDiffDoc] = useState<LoadedDiffDoc | null>(null);\n\n const [loadingDiff, setLoadingDiff] = useState(false);\n\n const handleSelect = useCallback((item: ReviewListItemProps | null) => setUserSelectedItem(item), []);\n const value = useMemo<ReviewsSelectionValue>(\n () => ({\n selectedItem,\n setSelectedItem: handleSelect,\n loadedDiffDoc,\n setLoadedDiffDoc,\n loadingDiff,\n setLoadingDiff,\n onApproveAllSuggestions,\n onRejectAllSuggestions,\n onOpenArticleLink,\n onSourceLinkClick,\n breadcrumb,\n }),\n [\n selectedItem,\n handleSelect,\n loadedDiffDoc,\n loadingDiff,\n onApproveAllSuggestions,\n onRejectAllSuggestions,\n onOpenArticleLink,\n onSourceLinkClick,\n breadcrumb,\n ],\n );\n\n return <ReviewsContext.Provider value={value}>{children}</ReviewsContext.Provider>;\n}\n\nexport function useReviewsSelection(): ReviewsSelectionValue {\n const ctx = useContext(ReviewsContext);\n if (!ctx) {\n throw new Error('useReviewsSelection must be used within ReviewsSelectionProvider');\n }\n\n return ctx;\n}\n","import React, { forwardRef } from 'react';\n\nimport { ReviewListItem, ReviewListItemProps } from './review-list-item';\nimport { useReviewsSelection } from '../context';\n\nimport { cn } from '@/lib/utils';\n\ninterface ReviewListProps {\n items: ReviewListItemProps[];\n className?: string;\n}\n\nexport const ReviewList = forwardRef<HTMLUListElement, ReviewListProps>(({ items, className, ...props }, ref) => {\n const { selectedItem, setSelectedItem } = useReviewsSelection();\n\n return (\n <ul\n ref={ref}\n className={cn(\n 'min-w-0 w-full overflow-hidden bg-muted border border-dark-300 rounded-lg p-2 space-y-2 list-none m-0',\n className,\n )}\n {...props}\n >\n {items.map((item) => (\n <li key={item.id}>\n <ReviewListItem {...item} isSelected={selectedItem?.id === item.id} onClick={() => setSelectedItem(item)} />\n </li>\n ))}\n </ul>\n );\n});\nReviewList.displayName = 'ReviewList';\n"],"names":["React","ReviewListItem"],"mappings":";;;;;;;AAGO,SAAS,SAAA,CAAU,EAAE,KAAA,EAAM,EAAsB;AACtD,EAAA,uBACEA,cAAA,CAAA,aAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,kCAAA,EAAA,kBACdA,cAAA,CAAA,aAAA,CAAC,UAAO,IAAA,EAAM,CAAA,EAAG,MAAA,EAAO,MAAA,EAAO,aAAA,EAAY,MAAA,EAAO,WAAU,WAAA,EAAY,CAAA,kBACxEA,cAAA,CAAA,aAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,+BAAA,EAAA,EACb,KAAA,EAAM,GAAA,EAAE,KAAA,KAAU,CAAA,GAAI,MAAA,GAAS,OAClC,CACF,CAAA;AAEJ;;ACiBO,MAAM,iBAAiB,KAAA,CAAM,UAAA,CAAmD,SAASC,eAAAA,CAC9F,EAAE,OAAO,SAAA,EAAW,IAAA,EAAM,aAAa,KAAA,EAAO,UAAA,EAAY,WAAW,UAAA,GAAa,KAAA,EAAO,WAAW,GAAG,KAAA,IACvG,GAAA,EACA;AACA,EAAA,IAAI,MAAA;AACJ,EAAA,IAAI,UAAA,EAAY;AACd,IAAA,MAAA,mBAAS,KAAA,CAAA,aAAA,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AAAA,MACA;AAAA;AACF,GACF;AAEA,EAAA,uBAAOD,cAAA,CAAA,aAAA,CAAC,cAAA,CAAe,QAAA,EAAf,EAAwB,SAAe,QAAS,CAAA;AAC1D;AAEO,SAAS,mBAAA,GAA6C;AAC3D,EAAA,MAAM,GAAA,GAAM,WAAW,cAAc,CAAA;AACrC,EAAA,IAAI,CAAC,GAAA,EAAK;AACR,IAAA,MAAM,IAAI,MAAM,kEAAkE,CAAA;AAAA,EACpF;AAEA,EAAA,OAAO,GAAA;AACT;;AC/EO,MAAM,UAAA,GAAa,WAA8C,CAAC,EAAE,OAAO,SAAA,EAAW,GAAG,KAAA,EAAM,EAAG,GAAA,KAAQ;AAC/G,EAAA,MAAM,EAAE,YAAA,EAAc,eAAA,EAAgB,GAAI,mBAAA,EAAoB;AAE9D,EAAA,uBACEA,cAAA,CAAA,aAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MACC,GAAA;AAAA,MACA,SAAA,EAAW,EAAA;AAAA,QACT,uGAAA;AAAA,QACA;AAAA,OACF;AAAA,MACC,GAAG;AAAA,KAAA;AAAA,IAEH,KAAA,CAAM,GAAA,CAAI,CAAC,IAAA,qBACVA,cAAA,CAAA,aAAA,CAAC,QAAG,GAAA,EAAK,IAAA,CAAK,EAAA,EAAA,kBACZA,cAAA,CAAA,aAAA,CAAC,cAAA,EAAA,EAAgB,GAAG,MAAM,UAAA,EAAY,YAAA,EAAc,EAAA,KAAO,IAAA,CAAK,EAAA,EAAI,OAAA,EAAS,MAAM,eAAA,CAAgB,IAAI,CAAA,EAAG,CAC5G,CACD;AAAA,GACH;AAEJ,CAAC;AACD,UAAA,CAAW,WAAA,GAAc,YAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"review-list.BJ-4eNKh.js","sources":["../../../src/scenes/knowledge-review/review-list/edit-count.tsx","../../../src/scenes/knowledge-review/review-list/review-list-item.tsx","../../../src/scenes/knowledge-review/context.tsx","../../../src/scenes/knowledge-review/review-list/review-list.tsx"],"sourcesContent":["import React from 'react';\nimport { Circle } from '@phosphor-icons/react';\n\nexport function EditCount({ count }: { count: number }) {\n return (\n <span className=\"inline-flex items-center gap-0.5\">\n <Circle size={8} weight=\"fill\" aria-hidden=\"true\" className=\"text-blue\" />\n <span className=\"text-xs leading-4 text-subtle\">\n {count} {count === 1 ? 'edit' : 'edits'}\n </span>\n </span>\n );\n}\n","import * as React from 'react';\n\nimport { EditCount } from './edit-count';\n\nimport { cn } from '@/lib/utils';\nimport { formatDistance } from '@/lib/formatDate';\nimport { StatusBadge } from '@/components/convos/status-badge';\n\nexport interface ReviewListItemProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n /** Unique identifier for the knowledge article */\n id: string;\n /** Primary text displayed in the first row */\n title: string;\n /** Content rendered in the top-right corner (e.g. relative timestamp) */\n timestamp: Date;\n /** Icon rendered at the start of the second row */\n icon?: React.ReactNode;\n /** Text or content next to the icon in the second row */\n description?: string | null;\n /** Whether this item is new */\n isNew?: boolean;\n /** Whether this item has been accepted (e.g. accepted as draft) */\n isAccepted?: boolean;\n /** Number of edits for this item */\n editCount?: number;\n /** Whether this item is currently selected */\n isSelected?: boolean;\n}\n\nexport const ReviewListItem = React.forwardRef<HTMLButtonElement, ReviewListItemProps>(function ReviewListItem(\n { title, timestamp, icon, description, isNew, isAccepted, editCount, isSelected = false, className, ...props },\n ref,\n) {\n let status: React.ReactNode | undefined;\n if (isAccepted) {\n status = <StatusBadge variant=\"accepted\">Accepted</StatusBadge>;\n } else if (isNew) {\n status = <StatusBadge variant=\"success\">New</StatusBadge>;\n } else if (editCount) {\n status = <EditCount count={editCount} />;\n }\n\n return (\n <button\n {...props}\n ref={ref}\n type=\"button\"\n aria-pressed={isSelected}\n className={cn(\n 'relative flex w-full flex-col gap-1 bg-surface rounded p-4 cursor-pointer transition-colors text-left border border-transparent',\n isSelected\n ? [\n 'shadow-[0px_1px_3px_0px_rgba(95,95,95,0.26)]',\n 'after:content-[\"\"] after:block after:absolute after:right-[-2px] after:top-1/2 after:-translate-y-1/2 after:w-1 after:h-14 after:rounded-sm after:bg-primary',\n ]\n : 'hover:bg-dark-100 hover:border-dark-300',\n className,\n )}\n >\n {/* Row 1: Title + Timestamp */}\n <span className=\"flex items-center justify-between w-full gap-2\">\n <span className={cn('text-sm text-default truncate min-w-0 flex-1', isSelected ? 'font-bold' : 'font-normal')}>\n {title}\n </span>\n {timestamp && <span className=\"text-xs leading-4 text-subtlest shrink-0\">{formatDistance(timestamp)}</span>}\n </span>\n\n {/* Row 2: Icon + Description + Status */}\n {(icon || description || status) && (\n <span className=\"flex items-center gap-1 leading-4\">\n {icon && <span className=\"shrink-0 flex items-center\">{icon}</span>}\n {description && <span className=\"text-xs text-subtle truncate\">{description}</span>}\n {status && <span className=\"shrink-0 ml-1 flex items-center\">{status}</span>}\n </span>\n )}\n </button>\n );\n});\n","import React, { createContext, useCallback, useContext, useMemo, useState } from 'react';\n\nimport type { ReviewListItemProps } from './review-list/review-list-item';\n\nexport type LoadedDiffDoc = {\n isNew: boolean;\n diffTitle: string;\n diffContent: React.ReactNode;\n};\n\ntype ReviewsSelectionValue = {\n selectedItem: ReviewListItemProps | null;\n setSelectedItem: (item: ReviewListItemProps | null) => void;\n loadedDiffDoc: LoadedDiffDoc | null;\n setLoadedDiffDoc: (doc: LoadedDiffDoc | null) => void;\n loadingDiff: boolean;\n setLoadingDiff: (loading: boolean) => void;\n onApproveAllSuggestions: () => void;\n onRejectAllSuggestions: () => void;\n onOpenArticleLink?: () => void;\n onSourceLinkClick?: () => void;\n breadcrumb?: string;\n};\n\nconst ReviewsContext = createContext<ReviewsSelectionValue | null>(null);\n\nexport type ReviewsProviderProps = {\n children: React.ReactNode;\n /** Optional initial selection (e.g. from server or mock data) */\n defaultSelectedItem?: ReviewListItemProps | null;\n onApproveAllSuggestions: () => void;\n onRejectAllSuggestions: () => void;\n onOpenArticleLink?: () => void;\n onSourceLinkClick?: () => void;\n breadcrumb?: string;\n};\n\nexport function ReviewsSelectionProvider({\n children,\n defaultSelectedItem = null,\n onApproveAllSuggestions,\n onRejectAllSuggestions,\n onOpenArticleLink,\n onSourceLinkClick,\n breadcrumb,\n}: ReviewsProviderProps) {\n const [userSelectedItem, setUserSelectedItem] = useState<ReviewListItemProps | null>(null);\n const selectedItem = userSelectedItem ?? defaultSelectedItem;\n\n const [loadedDiffDoc, setLoadedDiffDoc] = useState<LoadedDiffDoc | null>(null);\n\n const [loadingDiff, setLoadingDiff] = useState(false);\n\n const handleSelect = useCallback((item: ReviewListItemProps | null) => setUserSelectedItem(item), []);\n const value = useMemo<ReviewsSelectionValue>(\n () => ({\n selectedItem,\n setSelectedItem: handleSelect,\n loadedDiffDoc,\n setLoadedDiffDoc,\n loadingDiff,\n setLoadingDiff,\n onApproveAllSuggestions,\n onRejectAllSuggestions,\n onOpenArticleLink,\n onSourceLinkClick,\n breadcrumb,\n }),\n [\n selectedItem,\n handleSelect,\n loadedDiffDoc,\n loadingDiff,\n onApproveAllSuggestions,\n onRejectAllSuggestions,\n onOpenArticleLink,\n onSourceLinkClick,\n breadcrumb,\n ],\n );\n\n return <ReviewsContext.Provider value={value}>{children}</ReviewsContext.Provider>;\n}\n\nexport function useReviewsSelection(): ReviewsSelectionValue {\n const ctx = useContext(ReviewsContext);\n if (!ctx) {\n throw new Error('useReviewsSelection must be used within ReviewsSelectionProvider');\n }\n\n return ctx;\n}\n","import React, { forwardRef } from 'react';\n\nimport { ReviewListItem, ReviewListItemProps } from './review-list-item';\nimport { useReviewsSelection } from '../context';\n\nimport { cn } from '@/lib/utils';\n\ninterface ReviewListProps {\n items: ReviewListItemProps[];\n className?: string;\n}\n\nexport const ReviewList = forwardRef<HTMLUListElement, ReviewListProps>(({ items, className, ...props }, ref) => {\n const { selectedItem, setSelectedItem } = useReviewsSelection();\n\n return (\n <ul\n ref={ref}\n className={cn(\n 'min-w-0 w-full overflow-hidden bg-muted border border-dark-300 rounded-lg p-2 space-y-2 list-none m-0',\n className,\n )}\n {...props}\n >\n {items.map((item) => (\n <li key={item.id}>\n <ReviewListItem {...item} isSelected={selectedItem?.id === item.id} onClick={() => setSelectedItem(item)} />\n </li>\n ))}\n </ul>\n );\n});\nReviewList.displayName = 'ReviewList';\n"],"names":["React","ReviewListItem"],"mappings":";;;;;;;AAGO,SAAS,SAAA,CAAU,EAAE,KAAA,EAAM,EAAsB;AACtD,EAAA,uBACEA,cAAA,CAAA,aAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,kCAAA,EAAA,kBACdA,cAAA,CAAA,aAAA,CAAC,UAAO,IAAA,EAAM,CAAA,EAAG,MAAA,EAAO,MAAA,EAAO,aAAA,EAAY,MAAA,EAAO,WAAU,WAAA,EAAY,CAAA,kBACxEA,cAAA,CAAA,aAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,+BAAA,EAAA,EACb,KAAA,EAAM,GAAA,EAAE,KAAA,KAAU,CAAA,GAAI,MAAA,GAAS,OAClC,CACF,CAAA;AAEJ;;ACiBO,MAAM,iBAAiB,KAAA,CAAM,UAAA,CAAmD,SAASC,eAAAA,CAC9F,EAAE,OAAO,SAAA,EAAW,IAAA,EAAM,aAAa,KAAA,EAAO,UAAA,EAAY,WAAW,UAAA,GAAa,KAAA,EAAO,WAAW,GAAG,KAAA,IACvG,GAAA,EACA;AACA,EAAA,IAAI,MAAA;AACJ,EAAA,IAAI,UAAA,EAAY;AACd,IAAA,MAAA,mBAAS,KAAA,CAAA,aAAA,CAAC,WAAA,EAAA,EAAY,OAAA,EAAQ,UAAA,EAAA,EAAW,UAAQ,CAAA;AAAA,EACnD,WAAW,KAAA,EAAO;AAChB,IAAA,MAAA,mBAAS,KAAA,CAAA,aAAA,CAAC,WAAA,EAAA,EAAY,OAAA,EAAQ,SAAA,EAAA,EAAU,KAAG,CAAA;AAAA,EAC7C,WAAW,SAAA,EAAW;AACpB,IAAA,MAAA,mBAAS,KAAA,CAAA,aAAA,CAAC,SAAA,EAAA,EAAU,KAAA,EAAO,SAAA,EAAW,CAAA;AAA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A,GAAa,WAA8C,CAAC,EAAE,OAAO,SAAA,EAAW,GAAG,KAAA,EAAM,EAAG,GAAA,KAAQ;AAC/G,EAAA,MAAM,EAAE,YAAA,EAAc,eAAA,EAAgB,GAAI,mBAAA,EAAoB;AAE9D,EAAA,uBACEA,cAAA,CAAA,aAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MACC,GAAA;AAAA,MACA,SAAA,EAAW,EAAA;AAAA,QACT,uGAAA;AAAA,QACA;AAAA,OACF;AAAA,MACC,GAAG;AAAA,KAAA;AAAA,IAEH,KAAA,CAAM,GAAA,CAAI,CAAC,IAAA,qBACVA,cAAA,CAAA,aAAA,CAAC,QAAG,GAAA,EAAK,IAAA,CAAK,EAAA,EAAA,kBACZA,cAAA,CAAA,aAAA,CAAC,cAAA,EAAA,EAAgB,GAAG,MAAM,UAAA,EAAY,YAAA,EAAc,EAAA,KAAO,IAAA,CAAK,EAAA,EAAI,OAAA,EAAS,MAAM,eAAA,CAAgB,IAAI,CAAA,EAAG,CAC5G,CACD;AAAA,GACH;AAEJ,CAAC;AACD,UAAA,CAAW,WAAA,GAAc,YAAA;;;;"}
|
package/dist/esm/chunks/{useChartDateFormatters.DG-OZUxq.js → useChartDateFormatters.DS9ASgFO.js}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useCallback } from 'react';
|
|
2
|
-
import { f as formatChartTick, a as formatChartLabel } from './formatDate.
|
|
2
|
+
import { f as formatChartTick, a as formatChartLabel } from './formatDate.CWN6IFKq.js';
|
|
3
3
|
|
|
4
4
|
function useChartDateFormatters(locale) {
|
|
5
5
|
const tickFormatter = useCallback((value) => formatChartTick(value, locale ?? "en-US"), [locale]);
|
|
@@ -8,4 +8,4 @@ function useChartDateFormatters(locale) {
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
export { useChartDateFormatters as u };
|
|
11
|
-
//# sourceMappingURL=useChartDateFormatters.
|
|
11
|
+
//# sourceMappingURL=useChartDateFormatters.DS9ASgFO.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useChartDateFormatters.DS9ASgFO.js","sources":["../../../src/lib/useChartDateFormatters.ts"],"sourcesContent":["import { useCallback } from 'react';\n\nimport { formatChartLabel, formatChartTick } from './formatDate';\n\nexport function useChartDateFormatters(locale?: string) {\n const tickFormatter = useCallback((value: Date | string | undefined) => formatChartTick(value, locale ?? 'en-US'), [locale]);\n\n const formatXLabel = useCallback((label: Date | string | undefined) => formatChartLabel(label, locale ?? 'en-US'), [locale]);\n\n return { tickFormatter, formatXLabel };\n}\n"],"names":[],"mappings":";;;AAIO,SAAS,uBAAuB,MAAA,EAAiB;AACtD,EAAA,MAAM,aAAA,GAAgB,WAAA,CAAY,CAAC,KAAA,KAAqC,eAAA,CAAgB,KAAA,EAAO,MAAA,IAAU,OAAO,CAAA,EAAG,CAAC,MAAM,CAAC,CAAA;AAE3H,EAAA,MAAM,YAAA,GAAe,WAAA,CAAY,CAAC,KAAA,KAAqC,gBAAA,CAAiB,KAAA,EAAO,MAAA,IAAU,OAAO,CAAA,EAAG,CAAC,MAAM,CAAC,CAAA;AAE3H,EAAA,OAAO,EAAE,eAAe,YAAA,EAAa;AACvC;;;;"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
import { LineChart, CartesianGrid, XAxis, Line, PieChart, Pie, Label } from 'recharts';
|
|
3
|
+
import { a as TrendValue } from '../chunks/trend-value.COSukPwk.js';
|
|
4
|
+
import { Card, CardHeader, CardContent } from './ui/card.js';
|
|
5
|
+
import { C as ChartContainer, a as ChartTooltip, b as ChartTooltipContent } from '../chunks/chart.4ZbtBMmR.js';
|
|
6
|
+
import { f as formatNumber } from '../chunks/formatNumber.Bm2k8QrT.js';
|
|
7
|
+
import { u as useChartDateFormatters } from '../chunks/useChartDateFormatters.DS9ASgFO.js';
|
|
8
|
+
import { c as cn } from '../chunks/utils.Cwtlq8dh.js';
|
|
9
|
+
|
|
10
|
+
const formatWhole = (value) => formatNumber(value, {});
|
|
11
|
+
const COVERAGE_CHART_CONFIG = {
|
|
12
|
+
covered: {
|
|
13
|
+
label: "Covered",
|
|
14
|
+
color: "var(--bfc-v2-color-blue-600, #357DE8)"
|
|
15
|
+
},
|
|
16
|
+
uncovered: {
|
|
17
|
+
label: "Uncovered",
|
|
18
|
+
color: "var(--bfc-v2-color-mono-300, #E5E5E5)"
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
function ArticlesCoverage({
|
|
22
|
+
total,
|
|
23
|
+
trend,
|
|
24
|
+
trendValue,
|
|
25
|
+
coveragePercentage,
|
|
26
|
+
data,
|
|
27
|
+
chartConfig,
|
|
28
|
+
locale,
|
|
29
|
+
className
|
|
30
|
+
}) {
|
|
31
|
+
const { tickFormatter, formatXLabel } = useChartDateFormatters(locale);
|
|
32
|
+
const lineKeys = Object.keys(chartConfig);
|
|
33
|
+
const clampedCoverage = Math.round(Math.min(100, Math.max(0, coveragePercentage)));
|
|
34
|
+
return /* @__PURE__ */ React__default.createElement(Card, { className: cn("shadow-none border border-dark-300 rounded-lg", className) }, /* @__PURE__ */ React__default.createElement(CardHeader, { className: "p-0 space-y-0 border-b border-dark-300" }, /* @__PURE__ */ React__default.createElement("div", { className: "flex flex-col gap-1 justify-center py-4 px-4" }, /* @__PURE__ */ React__default.createElement("p", { className: "uppercase heading-xxxs font-semibold text-dark tracking-normal" }, "Articles Generated by Brainfish (coverage)"), /* @__PURE__ */ React__default.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ React__default.createElement("span", { className: "font-mono text-3xl leading-10 text-dark" }, formatWhole(total)), /* @__PURE__ */ React__default.createElement(TrendValue, { trend, trendValue })))), /* @__PURE__ */ React__default.createElement(CardContent, { className: "flex gap-2 p-0" }, /* @__PURE__ */ React__default.createElement("div", { className: "flex-1 min-w-0 px-4 pt-4 pb-0" }, /* @__PURE__ */ React__default.createElement(ChartContainer, { config: chartConfig, className: "h-48 w-full" }, /* @__PURE__ */ React__default.createElement(LineChart, { data, margin: { top: 8, left: 20, right: 20, bottom: 0 } }, /* @__PURE__ */ React__default.createElement(CartesianGrid, { horizontal: true, vertical: false, className: "stroke-dark-300" }), /* @__PURE__ */ React__default.createElement(
|
|
35
|
+
XAxis,
|
|
36
|
+
{
|
|
37
|
+
dataKey: "date",
|
|
38
|
+
tickLine: false,
|
|
39
|
+
axisLine: false,
|
|
40
|
+
tickMargin: 8,
|
|
41
|
+
padding: { left: 15, right: 15 },
|
|
42
|
+
minTickGap: 32,
|
|
43
|
+
interval: "preserveStartEnd",
|
|
44
|
+
tickFormatter,
|
|
45
|
+
tick: ({ x, y, payload, index }) => {
|
|
46
|
+
const isFirst = index === 0;
|
|
47
|
+
const isLast = index === data.length - 1;
|
|
48
|
+
const anchor = isFirst ? "start" : isLast ? "end" : "middle";
|
|
49
|
+
const tickX = isFirst ? x - 15 : isLast ? x + 15 : x;
|
|
50
|
+
return /* @__PURE__ */ React__default.createElement("text", { x: tickX, y, dy: 12, textAnchor: anchor, className: "text-xs fill-dark-600" }, tickFormatter(payload.value));
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
), /* @__PURE__ */ React__default.createElement(
|
|
54
|
+
ChartTooltip,
|
|
55
|
+
{
|
|
56
|
+
cursor: false,
|
|
57
|
+
content: ({ active, payload, label }) => /* @__PURE__ */ React__default.createElement(
|
|
58
|
+
ChartTooltipContent,
|
|
59
|
+
{
|
|
60
|
+
active,
|
|
61
|
+
payload,
|
|
62
|
+
label: label != null ? formatXLabel(label) : ""
|
|
63
|
+
}
|
|
64
|
+
)
|
|
65
|
+
}
|
|
66
|
+
), lineKeys.map((key) => /* @__PURE__ */ React__default.createElement(
|
|
67
|
+
Line,
|
|
68
|
+
{
|
|
69
|
+
key,
|
|
70
|
+
dataKey: key,
|
|
71
|
+
type: "monotone",
|
|
72
|
+
stroke: `var(--color-${key})`,
|
|
73
|
+
strokeWidth: 2,
|
|
74
|
+
dot: { r: 4, fill: "white", strokeWidth: 2, stroke: `var(--color-${key})` },
|
|
75
|
+
activeDot: { r: 5, fill: "white", strokeWidth: 2, stroke: `var(--color-${key})` }
|
|
76
|
+
}
|
|
77
|
+
))))), /* @__PURE__ */ React__default.createElement("div", { className: "w-80 shrink-0 flex items-center justify-center" }, /* @__PURE__ */ React__default.createElement(ChartContainer, { config: COVERAGE_CHART_CONFIG, className: "aspect-square w-full max-w-44" }, /* @__PURE__ */ React__default.createElement(PieChart, null, /* @__PURE__ */ React__default.createElement(
|
|
78
|
+
Pie,
|
|
79
|
+
{
|
|
80
|
+
data: [{ value: 100, fill: "var(--color-uncovered)" }],
|
|
81
|
+
dataKey: "value",
|
|
82
|
+
innerRadius: "76%",
|
|
83
|
+
outerRadius: "82%",
|
|
84
|
+
stroke: "none",
|
|
85
|
+
isAnimationActive: false
|
|
86
|
+
}
|
|
87
|
+
), /* @__PURE__ */ React__default.createElement(
|
|
88
|
+
Pie,
|
|
89
|
+
{
|
|
90
|
+
data: [
|
|
91
|
+
{ name: "covered", value: clampedCoverage, fill: "var(--color-covered)" },
|
|
92
|
+
{ name: "uncovered", value: 100 - clampedCoverage, fill: "transparent" }
|
|
93
|
+
],
|
|
94
|
+
dataKey: "value",
|
|
95
|
+
nameKey: "name",
|
|
96
|
+
innerRadius: "68%",
|
|
97
|
+
outerRadius: "90%",
|
|
98
|
+
startAngle: 90,
|
|
99
|
+
endAngle: -270,
|
|
100
|
+
stroke: "none"
|
|
101
|
+
},
|
|
102
|
+
/* @__PURE__ */ React__default.createElement(
|
|
103
|
+
Label,
|
|
104
|
+
{
|
|
105
|
+
content: ({ viewBox }) => {
|
|
106
|
+
if (viewBox && "cx" in viewBox && "cy" in viewBox) {
|
|
107
|
+
return /* @__PURE__ */ React__default.createElement("text", { x: viewBox.cx, y: viewBox.cy, textAnchor: "middle", dominantBaseline: "central" }, /* @__PURE__ */ React__default.createElement("tspan", { className: "font-mono text-3xl fill-dark-600" }, clampedCoverage, "%"));
|
|
108
|
+
}
|
|
109
|
+
return null;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
)
|
|
113
|
+
))))));
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export { ArticlesCoverage };
|
|
117
|
+
//# sourceMappingURL=articles-coverage.js.map
|