import { getRatio } from "./getRatio.mjs";
import { c } from "react-compiler-runtime";
import React from "react";
import { makeStyles } from "@material-ui/core";
//#region src/layout/GridUnit.jsx
const createRatio = (width, ratio1, ratio2) => {
	const x = width * ratio1 / ratio2;
	return Math.ceil(x / 8) * 8;
};
const useStyles = makeStyles((theme) => ({ root: {
	width: "100%",
	maxWidth: (props) => props.width,
	padding: theme.spacing(1)
} }));
const GridUnit = (props) => {
	const $ = c(11);
	const classes = useStyles(props);
	const { children, columnPadding, width, ratio } = props;
	let t0;
	let t1;
	if ($[0] !== classes.root || $[1] !== ratio || $[2] !== width) {
		const ratioArr = getRatio(ratio);
		t1 = classes.root;
		t0 = createRatio(width, ratioArr[0], ratioArr[1]);
		$[0] = classes.root;
		$[1] = ratio;
		$[2] = width;
		$[3] = t0;
		$[4] = t1;
	} else {
		t0 = $[3];
		t1 = $[4];
	}
	const t2 = t0 - (columnPadding || 8);
	let t3;
	if ($[5] !== t2) {
		t3 = { height: t2 };
		$[5] = t2;
		$[6] = t3;
	} else t3 = $[6];
	let t4;
	if ($[7] !== children || $[8] !== t1 || $[9] !== t3) {
		t4 = /* @__PURE__ */ React.createElement("div", {
			className: t1,
			style: t3
		}, children);
		$[7] = children;
		$[8] = t1;
		$[9] = t3;
		$[10] = t4;
	} else t4 = $[10];
	return t4;
};
//#endregion
export { GridUnit };

//# sourceMappingURL=GridUnit.mjs.map