import { ExtenderToggle } from "../templates/ui/ExtenderToggle.mjs";
import { c } from "react-compiler-runtime";
import React, { useState } from "react";
import { Collapse, makeStyles, useTheme } from "@material-ui/core";
import PropTypes from "prop-types";
//#region src/UI/dataDisplay/HeaderExpander.jsx
const useStyles = makeStyles((theme) => ({
	root: { width: "100%" },
	container: {
		padding: (props) => props.open ? theme.spacing(1) : theme.spacing(.25),
		parddingRight: theme.spacing(1),
		parddingleft: theme.spacing(1),
		background: (props) => props.color ? props.color : theme.palette.secondary.main
	},
	compactContainer: { padding: 1 },
	lowerShelf: {
		display: "flex",
		borderTop: (props) => `1px solid ${props.color ? props.color : theme.palette.secondary.main}`
	},
	lowerShelfCompact: { display: "flex" },
	shelfOptions: {
		flex: 1,
		width: "100%"
	}
}));
const HeaderExpander = (props) => {
	const $ = c(25);
	const classes = useStyles(props);
	const { children, options, toggleLabel, color, compact } = props;
	const [extendedHeader, setExtendedHeader] = useState(true);
	let t0;
	if ($[0] !== extendedHeader) {
		t0 = () => {
			setExtendedHeader(!extendedHeader);
		};
		$[0] = extendedHeader;
		$[1] = t0;
	} else t0 = $[1];
	const toggleExpandedHeader = t0;
	const theme = useTheme();
	const t1 = compact ? classes.compactContainer : classes.container;
	let t2;
	if ($[2] !== children || $[3] !== t1) {
		t2 = /* @__PURE__ */ React.createElement("div", { className: t1 }, " ", children, " ");
		$[2] = children;
		$[3] = t1;
		$[4] = t2;
	} else t2 = $[4];
	let t3;
	if ($[5] !== extendedHeader || $[6] !== t2) {
		t3 = /* @__PURE__ */ React.createElement(Collapse, { in: extendedHeader }, t2);
		$[5] = extendedHeader;
		$[6] = t2;
		$[7] = t3;
	} else t3 = $[7];
	const t4 = compact ? classes.lowerShelfCompact : classes.lowerShelf;
	let t5;
	if ($[8] !== classes.shelfOptions || $[9] !== options) {
		t5 = /* @__PURE__ */ React.createElement("div", { className: classes.shelfOptions }, options);
		$[8] = classes.shelfOptions;
		$[9] = options;
		$[10] = t5;
	} else t5 = $[10];
	const t6 = color ? color : theme.palette.secondary.main;
	let t7;
	if ($[11] !== compact || $[12] !== extendedHeader || $[13] !== t6 || $[14] !== toggleExpandedHeader || $[15] !== toggleLabel) {
		t7 = /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(ExtenderToggle, {
			onClick: toggleExpandedHeader,
			open: extendedHeader,
			toggleLabel,
			color: t6,
			compact
		}));
		$[11] = compact;
		$[12] = extendedHeader;
		$[13] = t6;
		$[14] = toggleExpandedHeader;
		$[15] = toggleLabel;
		$[16] = t7;
	} else t7 = $[16];
	let t8;
	if ($[17] !== t4 || $[18] !== t5 || $[19] !== t7) {
		t8 = /* @__PURE__ */ React.createElement("div", { className: t4 }, t5, t7);
		$[17] = t4;
		$[18] = t5;
		$[19] = t7;
		$[20] = t8;
	} else t8 = $[20];
	let t9;
	if ($[21] !== classes.root || $[22] !== t3 || $[23] !== t8) {
		t9 = /* @__PURE__ */ React.createElement("div", { className: classes.root }, t3, t8);
		$[21] = classes.root;
		$[22] = t3;
		$[23] = t8;
		$[24] = t9;
	} else t9 = $[24];
	return t9;
};
HeaderExpander.propTypes = {
	children: PropTypes.node,
	onClick: PropTypes.func,
	sectionOpen: PropTypes.bool,
	options: PropTypes.node,
	toggleLabel: PropTypes.node,
	color: PropTypes.string
};
//#endregion
export { HeaderExpander };

//# sourceMappingURL=HeaderExpander.mjs.map