import { UnityFluentIcon } from "../utilities/iconLibrary/UnityFluentIcon.mjs";
import { getIconFromName } from "../utilities/tree/TreeUtilities.mjs";
import { getUnityIconFromName } from "../utilities/iconLibrary/UnityIconLibrary.mjs";
import { c } from "react-compiler-runtime";
import React, { useState } from "react";
import SpeedDial from "@material-ui/lab/SpeedDial";
import SpeedDialIcon from "@material-ui/lab/SpeedDialIcon";
import SpeedDialAction from "@material-ui/lab/SpeedDialAction";
import AddIcon from "@material-ui/icons/esm/Add";
import { makeStyles } from "@material-ui/core/styles";
//#region src/actions/ActionSpeedDial.tsx
const useStyles = makeStyles((theme) => {
	return {
		wrapper: {
			position: "fixed",
			right: theme.spacing(0),
			bottom: theme.spacing(0),
			zIndex: 1200
		},
		speedDial: {
			position: "absolute",
			"&.MuiSpeedDial-directionUp, &.MuiSpeedDial-directionLeft": {
				bottom: theme.spacing(2),
				right: theme.spacing(2)
			}
		},
		speedDialFab: {
			backgroundColor: "black",
			borderRadius: 1,
			margin: 0,
			opacity: .75,
			"&:hover": { backgroundColor: "black" },
			"&:focus": { backgroundColor: "black" }
		},
		speadDialFabExpanded: {
			backgroundColor: "black",
			borderRadius: 1,
			margin: 0,
			"&:hover": { backgroundColor: "black" },
			"&:focus": { backgroundColor: "black" }
		},
		speedDialActions: {
			"&.MuiSpeedDial-directionUp, &.MuiSpeedDial-actions": {
				paddingBottom: 0,
				marginBottom: 0,
				opacity: .75
			},
			"&:hover": { opacity: 1 },
			"&:focus": { opacity: 1 }
		},
		speedDialActionFab: {
			backgroundColor: "black",
			borderRadius: 1,
			margin: 0,
			color: "white",
			width: 56,
			height: 56
		}
	};
});
const ActionSpeedDial = (props) => {
	const $ = c(23);
	const [expanded, setExpanded] = useState(false);
	const classes = useStyles(expanded);
	let actions;
	let otherProps;
	if ($[0] !== props) {
		const { open, ariaLabel, actions: t0, ...t1 } = props;
		actions = t0;
		otherProps = t1;
		$[0] = props;
		$[1] = actions;
		$[2] = otherProps;
	} else {
		actions = $[1];
		otherProps = $[2];
	}
	if (!actions.length) return null;
	const t0 = classes.wrapper;
	const t1 = classes.speedDial;
	const t2 = expanded ? classes.speadDialFabExpanded : classes.speedDialFab;
	let t3;
	if ($[3] !== classes.speedDialActions || $[4] !== t2) {
		t3 = {
			fab: t2,
			actions: classes.speedDialActions
		};
		$[3] = classes.speedDialActions;
		$[4] = t2;
		$[5] = t3;
	} else t3 = $[5];
	let t4;
	let t5;
	let t6;
	if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
		t4 = /* @__PURE__ */ React.createElement(SpeedDialIcon, { icon: /* @__PURE__ */ React.createElement(AddIcon, null) });
		t5 = () => setExpanded(false);
		t6 = () => setExpanded(true);
		$[6] = t4;
		$[7] = t5;
		$[8] = t6;
	} else {
		t4 = $[6];
		t5 = $[7];
		t6 = $[8];
	}
	let t7;
	if ($[9] !== actions || $[10] !== classes.speedDialActionFab) {
		let t8;
		if ($[12] !== classes.speedDialActionFab) {
			t8 = (action) => /* @__PURE__ */ React.createElement(SpeedDialAction, {
				id: "udpRecord-ActionSpeedDial-" + action.name,
				udprecordid: "udpRecord-ActionSpeedDial-" + action.name,
				key: action.name,
				icon: /* @__PURE__ */ React.createElement(UnityFluentIcon, {
					type: action.icon.type,
					icon: action.icon.type === "unity" ? getUnityIconFromName(action.icon.name) : getIconFromName(action.icon.name)
				}),
				open: false,
				onClick: (e) => action.onClick(e),
				classes: { fab: classes.speedDialActionFab },
				tooltipTitle: action.name
			});
			$[12] = classes.speedDialActionFab;
			$[13] = t8;
		} else t8 = $[13];
		t7 = actions.map(t8);
		$[9] = actions;
		$[10] = classes.speedDialActionFab;
		$[11] = t7;
	} else t7 = $[11];
	let t8;
	if ($[14] !== classes.speedDial || $[15] !== expanded || $[16] !== otherProps || $[17] !== t3 || $[18] !== t7) {
		t8 = /* @__PURE__ */ React.createElement(SpeedDial, {
			id: "udpRecord-ActionSpeedDial",
			udprecordid: "udpRecord-ActionSpeedDial",
			className: t1,
			ariaLabel: "Fluent Speed Dial",
			classes: t3,
			icon: t4,
			onClose: t5,
			onOpen: t6,
			open: expanded,
			...otherProps
		}, t7);
		$[14] = classes.speedDial;
		$[15] = expanded;
		$[16] = otherProps;
		$[17] = t3;
		$[18] = t7;
		$[19] = t8;
	} else t8 = $[19];
	let t9;
	if ($[20] !== classes.wrapper || $[21] !== t8) {
		t9 = /* @__PURE__ */ React.createElement("div", { className: t0 }, t8);
		$[20] = classes.wrapper;
		$[21] = t8;
		$[22] = t9;
	} else t9 = $[22];
	return t9;
};
//#endregion
export { ActionSpeedDial };

//# sourceMappingURL=ActionSpeedDial.mjs.map