import { useUser } from "../../../utilities/auth/useUser.mjs";
import { useActions } from "../../../hooks/useActions.mjs";
import { useTenant } from "../../../utilities/tenant/useTenant.mjs";
import { UdpFormRenderer } from "./UdpFormRenderer.mjs";
import { useUdpFormParameters } from "../UdpFormsUtils/Utils.mjs";
import { c } from "react-compiler-runtime";
import React from "react";
import { useSnackbar } from "notistack";
import { useHistory } from "react-router-dom";
//#region src/udp/pages/UdpFormsPrivateForm/UdpPrivateForm.jsx
const UdpPrivateForm = (props) => {
	const $ = c(19);
	const user = useUser();
	const tenant = useTenant();
	const history = useHistory();
	const { enqueueSnackbar, closeSnackbar } = useSnackbar();
	const { triggerAction } = useActions();
	const { formId, formVersion, submissionId, urlContext } = useUdpFormParameters();
	const t0 = props.generic1 || urlContext.generic1;
	const t1 = props.generic2 || urlContext.generic2;
	const t2 = props.generic3 || urlContext.generic3;
	let t3;
	if ($[0] !== t0 || $[1] !== t1 || $[2] !== t2 || $[3] !== urlContext) {
		t3 = {
			...urlContext,
			generic1: t0,
			generic2: t1,
			generic3: t2
		};
		$[0] = t0;
		$[1] = t1;
		$[2] = t2;
		$[3] = urlContext;
		$[4] = t3;
	} else t3 = $[4];
	const mergedContext = t3;
	const t4 = tenant?.id;
	let t5;
	if ($[5] !== user) {
		t5 = () => user;
		$[5] = user;
		$[6] = t5;
	} else t5 = $[6];
	let t6;
	if ($[7] !== closeSnackbar || $[8] !== enqueueSnackbar || $[9] !== formId || $[10] !== formVersion || $[11] !== history || $[12] !== mergedContext || $[13] !== props || $[14] !== submissionId || $[15] !== t4 || $[16] !== t5 || $[17] !== triggerAction) {
		t6 = /* @__PURE__ */ React.createElement(UdpFormRenderer, {
			isPublicMode: false,
			formId,
			formVersion,
			submissionId,
			tenantId: t4,
			urlContext: mergedContext,
			callbackUrl: null,
			triggerAction,
			history,
			getUserCallback: t5,
			enqueueSnackbar,
			closeSnackbar,
			...props
		});
		$[7] = closeSnackbar;
		$[8] = enqueueSnackbar;
		$[9] = formId;
		$[10] = formVersion;
		$[11] = history;
		$[12] = mergedContext;
		$[13] = props;
		$[14] = submissionId;
		$[15] = t4;
		$[16] = t5;
		$[17] = triggerAction;
		$[18] = t6;
	} else t6 = $[18];
	return t6;
};
//#endregion
export { UdpPrivateForm };

//# sourceMappingURL=UdpPrivateForm.mjs.map