import { Field } from "../../../../utilities/form/Field.mjs";
import { LayoutUnit } from "../../../../layout/LayoutUnit.mjs";
import { SideSheet } from "../../../../UI/surfaces/SideSheet.mjs";
import { AmbientAutoComplete } from "../../../../UI/inputs/textField/AmbientAutoComplete.mjs";
import { c } from "react-compiler-runtime";
import React from "react";
import { FormControlLabel, Switch } from "@material-ui/core";
import { useTranslation } from "react-i18next";
//#region src/udp/pages/UdpTransactionTypesPage/sidesheets/UdpTransactionTypeCalendarViewConfigurationSidesheet.jsx
const CALENDAR_VIEW_TYPE_OPTIONS = [
	"day",
	"week",
	"month"
];
const UdpTransactionTypeCalendarViewConfigurationSidesheet = (props) => {
	const $ = c(52);
	const { initialData, isSidesheetOpen, setIsSidesheetOpen, domainFieldOptions, dateDomainFieldOptions, isCalendarViewEnabled, handleCalendarViewEnabledChange } = props;
	const { t } = useTranslation();
	const calendarViewConfiguration = initialData?.pageConfiguration?.calendarViewConfiguration;
	let t0;
	if ($[0] !== t) {
		t0 = t("Calendar View Configuration");
		$[0] = t;
		$[1] = t0;
	} else t0 = $[1];
	let t1;
	if ($[2] !== setIsSidesheetOpen) {
		t1 = () => setIsSidesheetOpen(false);
		$[2] = setIsSidesheetOpen;
		$[3] = t1;
	} else t1 = $[3];
	let t2;
	if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
		t2 = /* @__PURE__ */ React.createElement(LayoutUnit, { unit: "nudge" });
		$[4] = t2;
	} else t2 = $[4];
	const t3 = !!calendarViewConfiguration?.enabled;
	let t4;
	if ($[5] !== handleCalendarViewEnabledChange || $[6] !== t3) {
		t4 = /* @__PURE__ */ React.createElement(Field, {
			component: Switch,
			id: "calendarViewEnabled",
			name: "calendarViewEnabled",
			type: "checkbox",
			initialValue: t3,
			onChange: handleCalendarViewEnabledChange
		});
		$[5] = handleCalendarViewEnabledChange;
		$[6] = t3;
		$[7] = t4;
	} else t4 = $[7];
	let t5;
	if ($[8] !== t) {
		t5 = t("Enable Calendar View");
		$[8] = t;
		$[9] = t5;
	} else t5 = $[9];
	let t6;
	if ($[10] !== t4 || $[11] !== t5) {
		t6 = /* @__PURE__ */ React.createElement(FormControlLabel, {
			control: t4,
			label: t5
		});
		$[10] = t4;
		$[11] = t5;
		$[12] = t6;
	} else t6 = $[12];
	let t7;
	if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
		t7 = /* @__PURE__ */ React.createElement(LayoutUnit, { unit: "nudge" });
		$[13] = t7;
	} else t7 = $[13];
	let t8;
	if ($[14] !== calendarViewConfiguration?.isDefaultView || $[15] !== isCalendarViewEnabled || $[16] !== t) {
		t8 = isCalendarViewEnabled && /* @__PURE__ */ React.createElement(FormControlLabel, {
			control: /* @__PURE__ */ React.createElement(Field, {
				component: Switch,
				id: "isDefaultView",
				name: "isDefaultView",
				type: "checkbox",
				initialValue: !!calendarViewConfiguration?.isDefaultView
			}),
			label: t("Default to Calendar View")
		});
		$[14] = calendarViewConfiguration?.isDefaultView;
		$[15] = isCalendarViewEnabled;
		$[16] = t;
		$[17] = t8;
	} else t8 = $[17];
	let t9;
	if ($[18] !== isCalendarViewEnabled) {
		t9 = isCalendarViewEnabled && /* @__PURE__ */ React.createElement(LayoutUnit, { unit: "nudge" });
		$[18] = isCalendarViewEnabled;
		$[19] = t9;
	} else t9 = $[19];
	let t10;
	if ($[20] !== calendarViewConfiguration?.defaultCalendarViewType || $[21] !== isCalendarViewEnabled || $[22] !== t) {
		t10 = isCalendarViewEnabled && /* @__PURE__ */ React.createElement(Field, {
			component: AmbientAutoComplete,
			label: t("Default View"),
			id: "defaultCalendarViewType",
			name: "defaultCalendarViewType",
			variant: "outlined",
			isMultiple: false,
			disableCloseOnSelect: false,
			options: CALENDAR_VIEW_TYPE_OPTIONS,
			getOptionLabelFunction: _temp,
			initialValue: calendarViewConfiguration?.defaultCalendarViewType
		});
		$[20] = calendarViewConfiguration?.defaultCalendarViewType;
		$[21] = isCalendarViewEnabled;
		$[22] = t;
		$[23] = t10;
	} else t10 = $[23];
	let t11;
	if ($[24] !== calendarViewConfiguration?.domainStartDateProperty || $[25] !== dateDomainFieldOptions || $[26] !== isCalendarViewEnabled || $[27] !== t) {
		t11 = isCalendarViewEnabled && /* @__PURE__ */ React.createElement(Field, {
			component: AmbientAutoComplete,
			label: t("Start Date Field"),
			id: "domainStartDateProperty",
			name: "domainStartDateProperty",
			variant: "outlined",
			isMultiple: false,
			disableCloseOnSelect: false,
			options: dateDomainFieldOptions || [],
			getOptionLabelFunction: _temp2,
			initialValue: calendarViewConfiguration?.domainStartDateProperty || ""
		});
		$[24] = calendarViewConfiguration?.domainStartDateProperty;
		$[25] = dateDomainFieldOptions;
		$[26] = isCalendarViewEnabled;
		$[27] = t;
		$[28] = t11;
	} else t11 = $[28];
	let t12;
	if ($[29] !== calendarViewConfiguration?.domainEndDateProperty || $[30] !== dateDomainFieldOptions || $[31] !== isCalendarViewEnabled || $[32] !== t) {
		t12 = isCalendarViewEnabled && /* @__PURE__ */ React.createElement(Field, {
			component: AmbientAutoComplete,
			label: t("End Date Field"),
			id: "domainEndDateProperty",
			name: "domainEndDateProperty",
			variant: "outlined",
			isMultiple: false,
			disableCloseOnSelect: false,
			options: dateDomainFieldOptions || [],
			getOptionLabelFunction: _temp3,
			initialValue: calendarViewConfiguration?.domainEndDateProperty || ""
		});
		$[29] = calendarViewConfiguration?.domainEndDateProperty;
		$[30] = dateDomainFieldOptions;
		$[31] = isCalendarViewEnabled;
		$[32] = t;
		$[33] = t12;
	} else t12 = $[33];
	let t13;
	if ($[34] !== calendarViewConfiguration?.domainPropertyToDisplay || $[35] !== domainFieldOptions || $[36] !== isCalendarViewEnabled || $[37] !== t) {
		t13 = isCalendarViewEnabled && /* @__PURE__ */ React.createElement(Field, {
			component: AmbientAutoComplete,
			label: t("Property to Display"),
			id: "domainPropertyToDisplay",
			name: "domainPropertyToDisplay",
			variant: "outlined",
			isMultiple: false,
			disableCloseOnSelect: false,
			options: domainFieldOptions || [],
			getOptionLabelFunction: _temp4,
			initialValue: calendarViewConfiguration?.domainPropertyToDisplay || ""
		});
		$[34] = calendarViewConfiguration?.domainPropertyToDisplay;
		$[35] = domainFieldOptions;
		$[36] = isCalendarViewEnabled;
		$[37] = t;
		$[38] = t13;
	} else t13 = $[38];
	let t14;
	if ($[39] !== t10 || $[40] !== t11 || $[41] !== t12 || $[42] !== t13 || $[43] !== t6 || $[44] !== t8 || $[45] !== t9) {
		t14 = /* @__PURE__ */ React.createElement(React.Fragment, null, t2, t6, t7, t8, t9, t10, t11, t12, t13);
		$[39] = t10;
		$[40] = t11;
		$[41] = t12;
		$[42] = t13;
		$[43] = t6;
		$[44] = t8;
		$[45] = t9;
		$[46] = t14;
	} else t14 = $[46];
	let t15;
	if ($[47] !== isSidesheetOpen || $[48] !== t0 || $[49] !== t1 || $[50] !== t14) {
		t15 = /* @__PURE__ */ React.createElement(SideSheet, {
			open: isSidesheetOpen,
			width: 600,
			title: t0,
			onClose: t1
		}, t14);
		$[47] = isSidesheetOpen;
		$[48] = t0;
		$[49] = t1;
		$[50] = t14;
		$[51] = t15;
	} else t15 = $[51];
	return t15;
};
function _temp(option) {
	return option;
}
function _temp2(option_0) {
	return option_0;
}
function _temp3(option_1) {
	return option_1;
}
function _temp4(option_2) {
	return option_2;
}
//#endregion
export { UdpTransactionTypeCalendarViewConfigurationSidesheet as default };

//# sourceMappingURL=UdpTransactionTypeCalendarViewConfigurationSidesheet.mjs.map