import { c } from "react-compiler-runtime";
import { DateTime } from "luxon";
//#region src/hooks/useDateLocale.ts
const useDateLocale = (t0, t1) => {
	const $ = c(11);
	const datetimeFormatOptions = t0 === void 0 ? null : t0;
	const locale = t1 === void 0 ? null : t1;
	let t2;
	if ($[0] !== datetimeFormatOptions) {
		t2 = datetimeFormatOptions ?? {
			timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone,
			year: "numeric",
			month: "short",
			day: "numeric",
			hour: "numeric",
			minute: "numeric",
			hour12: true
		};
		$[0] = datetimeFormatOptions;
		$[1] = t2;
	} else t2 = $[1];
	const dateTimeOptions = t2;
	const localeString = locale ?? navigator.language;
	let t3;
	if ($[2] !== dateTimeOptions || $[3] !== localeString) {
		t3 = (date) => {
			const luxonDateTime = DateTime.fromISO(date, { zone: "utc" });
			luxonDateTime.setZone(dateTimeOptions.timeZone);
			luxonDateTime.setLocale(localeString);
			if (!luxonDateTime.isValid) return null;
			return luxonDateTime.toLocaleString(dateTimeOptions);
		};
		$[2] = dateTimeOptions;
		$[3] = localeString;
		$[4] = t3;
	} else t3 = $[4];
	const convertISOStringToLocalDateTime = t3;
	let t4;
	if ($[5] !== dateTimeOptions || $[6] !== localeString) {
		t4 = (date_0) => {
			const luxonDateTime_0 = DateTime.fromISO(date_0);
			luxonDateTime_0.setZone(dateTimeOptions.timeZone);
			luxonDateTime_0.setLocale(localeString);
			if (!luxonDateTime_0.isValid) return null;
			const { hour, minute, ...dateOptions } = dateTimeOptions;
			return luxonDateTime_0.toLocaleString(dateOptions);
		};
		$[5] = dateTimeOptions;
		$[6] = localeString;
		$[7] = t4;
	} else t4 = $[7];
	const convertISOStringToLocalDate = t4;
	const getISODate = _temp;
	let t5;
	if ($[8] !== convertISOStringToLocalDate || $[9] !== convertISOStringToLocalDateTime) {
		t5 = {
			convertISOStringToLocalDateTime,
			convertISOStringToLocalDate,
			getISODate
		};
		$[8] = convertISOStringToLocalDate;
		$[9] = convertISOStringToLocalDateTime;
		$[10] = t5;
	} else t5 = $[10];
	return t5;
};
function _temp() {
	return DateTime.now().toISO({
		includeOffset: true,
		suppressMilliseconds: true
	});
}
//#endregion
export { useDateLocale };

//# sourceMappingURL=useDateLocale.mjs.map