import { c } from "react-compiler-runtime";
import React from "react";
import { Typography } from "@material-ui/core";
import { FormSpy } from "react-final-form";
//#region src/utilities/form/FormError.tsx
/**
* Displays form-wide validation and submit errors in a MUI Typography error element
*/
const FormError = (props) => {
	const $ = c(3);
	let t0;
	if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
		t0 = {
			error: true,
			submitError: true
		};
		$[0] = t0;
	} else t0 = $[0];
	let t1;
	if ($[1] !== props) {
		t1 = /* @__PURE__ */ React.createElement(FormSpy, { subscription: t0 }, (t2) => {
			const { error, submitError } = t2;
			if (error || submitError) return /* @__PURE__ */ React.createElement(Typography, {
				component: "p",
				paragraph: true,
				...props,
				color: "error"
			}, error || submitError);
			return null;
		});
		$[1] = props;
		$[2] = t1;
	} else t1 = $[2];
	return t1;
};
//#endregion
export { FormError };

//# sourceMappingURL=FormError.mjs.map