import { useUdpExport } from "../../../../udp/export/useUdpExport.mjs";
import { ExportSidesheet } from "../../../../udp/export/ExportSidesheet.mjs";
import { c } from "react-compiler-runtime";
import React, { forwardRef, useState } from "react";
import { makeStyles } from "@material-ui/core";
import { AmbientTemplateGrid } from "udp-react-stencil-component-library";
import clsx from "clsx";
//#region src/UI/templates/deprecated/UdpGridTemplate/UdpGridTemplate.jsx
const useStyles = makeStyles((theme) => ({ root: {} }));
const UdpGridTemplate = forwardRef((props, ref) => {
	const $ = c(30);
	let otherProps;
	if ($[0] !== props) {
		const { children, ...t0 } = props;
		otherProps = t0;
		$[0] = props;
		$[1] = otherProps;
	} else otherProps = $[1];
	const classes = useStyles(props);
	const { className } = props;
	const [exportSidesheetOpen, setExportSidesheetOpen] = useState(false);
	const { updateExportParameters, createExport, entity, searchObject, fileFormat, numRowsToExport, validSearch, errorList, activeExportJob, exportLoading, handleFileDownload, clearParameters } = useUdpExport();
	let t0;
	if ($[2] !== updateExportParameters) {
		t0 = (entity_0, searchObject_0) => {
			updateExportParameters(entity_0, searchObject_0);
			setExportSidesheetOpen(true);
		};
		$[2] = updateExportParameters;
		$[3] = t0;
	} else t0 = $[3];
	const exportFromGrid = t0;
	let t1;
	if ($[4] !== clearParameters) {
		t1 = () => {
			setExportSidesheetOpen(false);
			clearParameters();
		};
		$[4] = clearParameters;
		$[5] = t1;
	} else t1 = $[5];
	const handleCloseExportSidesheet = t1;
	let t2;
	if ($[6] !== className || $[7] !== classes.root) {
		t2 = clsx(classes.root, className);
		$[6] = className;
		$[7] = classes.root;
		$[8] = t2;
	} else t2 = $[8];
	let t3;
	if ($[9] !== exportFromGrid || $[10] !== otherProps || $[11] !== ref) {
		t3 = /* @__PURE__ */ React.createElement(AmbientTemplateGrid, {
			ref,
			...otherProps,
			exportFunction: exportFromGrid
		});
		$[9] = exportFromGrid;
		$[10] = otherProps;
		$[11] = ref;
		$[12] = t3;
	} else t3 = $[12];
	let t4;
	if ($[13] !== activeExportJob || $[14] !== createExport || $[15] !== entity || $[16] !== errorList || $[17] !== exportLoading || $[18] !== exportSidesheetOpen || $[19] !== fileFormat || $[20] !== handleCloseExportSidesheet || $[21] !== handleFileDownload || $[22] !== numRowsToExport || $[23] !== searchObject || $[24] !== validSearch) {
		t4 = /* @__PURE__ */ React.createElement(ExportSidesheet, {
			entity,
			searchObject,
			fileFormat,
			numRowsToExport,
			errorList,
			activeExportJob,
			handleFileDownload,
			exportSidesheetOpen,
			handleCloseExportSidesheet,
			createExport,
			exportLoading,
			validSearch
		});
		$[13] = activeExportJob;
		$[14] = createExport;
		$[15] = entity;
		$[16] = errorList;
		$[17] = exportLoading;
		$[18] = exportSidesheetOpen;
		$[19] = fileFormat;
		$[20] = handleCloseExportSidesheet;
		$[21] = handleFileDownload;
		$[22] = numRowsToExport;
		$[23] = searchObject;
		$[24] = validSearch;
		$[25] = t4;
	} else t4 = $[25];
	let t5;
	if ($[26] !== t2 || $[27] !== t3 || $[28] !== t4) {
		t5 = /* @__PURE__ */ React.createElement("div", { className: t2 }, t3, t4);
		$[26] = t2;
		$[27] = t3;
		$[28] = t4;
		$[29] = t5;
	} else t5 = $[29];
	return t5;
});
UdpGridTemplate.displayName = "UdpGridTemplate";
//#endregion
export { UdpGridTemplate };

//# sourceMappingURL=UdpGridTemplate.mjs.map