import { Form } from "../../../../utilities/form/Form.mjs";
import { Field } from "../../../../utilities/form/Field.mjs";
import { FluentTextField } from "../../../../UI/inputs/textField/FluentTextField.mjs";
import { c } from "react-compiler-runtime";
import React, { forwardRef, useImperativeHandle, useRef } from "react";
import { useTranslation } from "react-i18next";
//#region src/udp/pages/UdpTransactionTypesPage/forms/UdpTransactionAttachmentTypeForm.jsx
const UdpTransactionAttachmentTypeForm = (props, ref) => {
	const $ = c(10);
	const { onSubmit, initialData } = props;
	const handleSubmitRef = useRef();
	const { t } = useTranslation();
	let t0;
	if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
		t0 = () => ({ submit: () => {
			handleSubmitRef?.current();
		} });
		$[0] = t0;
	} else t0 = $[0];
	useImperativeHandle(ref, t0);
	let t1;
	if ($[1] !== initialData || $[2] !== onSubmit) {
		t1 = (formData) => {
			onSubmit(formData, initialData);
		};
		$[1] = initialData;
		$[2] = onSubmit;
		$[3] = t1;
	} else t1 = $[3];
	const handleSubmit = t1;
	let t2;
	if ($[4] !== initialData?.name || $[5] !== t) {
		t2 = (t3) => {
			const { handleSubmit: handleSubmit_0 } = t3;
			handleSubmitRef.current = handleSubmit_0;
			return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Field, {
				component: FluentTextField,
				label: t("Name"),
				id: "name",
				name: "name",
				fullWidth: true,
				variant: "outlined",
				margin: "normal",
				size: "small",
				required: true,
				initialValue: initialData?.name || ""
			}));
		};
		$[4] = initialData?.name;
		$[5] = t;
		$[6] = t2;
	} else t2 = $[6];
	let t3;
	if ($[7] !== handleSubmit || $[8] !== t2) {
		t3 = /* @__PURE__ */ React.createElement(Form, {
			onSubmit: handleSubmit,
			render: t2
		});
		$[7] = handleSubmit;
		$[8] = t2;
		$[9] = t3;
	} else t3 = $[9];
	return t3;
};
var UdpTransactionAttachmentTypeForm_default = forwardRef(UdpTransactionAttachmentTypeForm);
//#endregion
export { UdpTransactionAttachmentTypeForm_default as default };

//# sourceMappingURL=UdpTransactionAttachmentTypeForm.mjs.map