import { FluentIconButton } from "../../../inputs/buttons/FluentIconButton.mjs";
import { AmbientPopoverMenuItem } from "../../../inputs/buttons/AmbientPopoverMenuItem.mjs";
import { c } from "react-compiler-runtime";
import React, { useState } from "react";
import { Popover, makeStyles } from "@material-ui/core";
import { ArrowUpRightIcon, ExcelDocumentIcon, TextDocumentIcon } from "@fluentui/react-icons";
//#region src/UI/utilityDisplay/utilityHeader/ui/PAHExport.jsx
const useStyles = makeStyles((theme) => ({
	root: {},
	popoverRoot: {},
	icon: { color: theme.palette.secondary.main }
}));
const PAHExport = (t0) => {
	const $ = c(28);
	const { exportCSV, exportExcel } = t0;
	const classes = useStyles();
	const [anchorEl, setAnchorEl] = useState(null);
	let t1;
	if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
		t1 = (event) => {
			setAnchorEl(event.currentTarget);
		};
		$[0] = t1;
	} else t1 = $[0];
	const handleClick = t1;
	let t2;
	if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
		t2 = () => {
			setAnchorEl(null);
		};
		$[1] = t2;
	} else t2 = $[1];
	const handleClose = t2;
	const open = Boolean(anchorEl);
	const id = open ? "simple-popover" : void 0;
	let t3;
	if ($[2] !== exportCSV) {
		t3 = {
			label: "Export CSV",
			component: TextDocumentIcon,
			click: exportCSV,
			key: 1
		};
		$[2] = exportCSV;
		$[3] = t3;
	} else t3 = $[3];
	let t4;
	if ($[4] !== exportExcel) {
		t4 = {
			label: "Export Excel",
			component: ExcelDocumentIcon,
			click: exportExcel,
			key: 2
		};
		$[4] = exportExcel;
		$[5] = t4;
	} else t4 = $[5];
	let t5;
	if ($[6] !== t3 || $[7] !== t4) {
		t5 = [t3, t4];
		$[6] = t3;
		$[7] = t4;
		$[8] = t5;
	} else t5 = $[8];
	const gridControlsExport = t5;
	let t6;
	if ($[9] !== classes.icon) {
		t6 = /* @__PURE__ */ React.createElement(FluentIconButton, {
			className: classes.icon,
			icon: ArrowUpRightIcon,
			onClick: handleClick
		});
		$[9] = classes.icon;
		$[10] = t6;
	} else t6 = $[10];
	let t7;
	if ($[11] !== classes.popoverRoot) {
		t7 = { root: classes.popoverRoot };
		$[11] = classes.popoverRoot;
		$[12] = t7;
	} else t7 = $[12];
	let t10;
	let t8;
	let t9;
	if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
		t8 = {
			vertical: "bottom",
			horizontal: "left"
		};
		t9 = {
			vertical: "top",
			horizontal: "left"
		};
		t10 = { width: 140 };
		$[13] = t10;
		$[14] = t8;
		$[15] = t9;
	} else {
		t10 = $[13];
		t8 = $[14];
		t9 = $[15];
	}
	let t11;
	if ($[16] !== gridControlsExport) {
		t11 = /* @__PURE__ */ React.createElement("div", { style: t10 }, /* @__PURE__ */ React.createElement("div", null, gridControlsExport.map(_temp)));
		$[16] = gridControlsExport;
		$[17] = t11;
	} else t11 = $[17];
	let t12;
	if ($[18] !== anchorEl || $[19] !== id || $[20] !== open || $[21] !== t11 || $[22] !== t7) {
		t12 = /* @__PURE__ */ React.createElement(Popover, {
			classes: t7,
			square: true,
			elevation: 1,
			id,
			open,
			anchorEl,
			onClose: handleClose,
			anchorOrigin: t8,
			transformOrigin: t9
		}, t11);
		$[18] = anchorEl;
		$[19] = id;
		$[20] = open;
		$[21] = t11;
		$[22] = t7;
		$[23] = t12;
	} else t12 = $[23];
	let t13;
	if ($[24] !== classes.root || $[25] !== t12 || $[26] !== t6) {
		t13 = /* @__PURE__ */ React.createElement("div", { className: classes.root }, t6, t12);
		$[24] = classes.root;
		$[25] = t12;
		$[26] = t6;
		$[27] = t13;
	} else t13 = $[27];
	return t13;
};
function _temp(item) {
	return /* @__PURE__ */ React.createElement(AmbientPopoverMenuItem, {
		label: item.label,
		component: item.component,
		click: item.click
	});
}
//#endregion
export { PAHExport };

//# sourceMappingURL=PAHExport.mjs.map