import { useUser } from "../../../utilities/auth/useUser.mjs";
import { useTenant } from "../../../utilities/tenant/useTenant.mjs";
import { c } from "react-compiler-runtime";
import React, { useEffect, useState } from "react";
import { UdpFormsBuilder } from "udp-react-stencil-component-library";
import { useSnackbar } from "notistack";
import { useHistory, useLocation } from "react-router-dom";
//#region src/udp/pages/UdpFormsBuilderPage/UdpFormsBuilderPage.jsx
const UdpFormsBuilderPage = (props) => {
	const $ = c(22);
	const user = useUser();
	const tenant = useTenant();
	const location = useLocation();
	const history = useHistory();
	const { enqueueSnackbar, closeSnackbar } = useSnackbar();
	let t0;
	if ($[0] !== location.search) {
		t0 = () => new URLSearchParams(location.search);
		$[0] = location.search;
		$[1] = t0;
	} else t0 = $[1];
	const [searchParams, setSearchParams] = useState(t0);
	let t1;
	let t2;
	if ($[2] !== location.search) {
		t1 = () => {
			setSearchParams(new URLSearchParams(location.search));
		};
		t2 = [location.search];
		$[2] = location.search;
		$[3] = t1;
		$[4] = t2;
	} else {
		t1 = $[3];
		t2 = $[4];
	}
	useEffect(t1, t2);
	let t3;
	if ($[5] !== searchParams) {
		t3 = searchParams.get("udpf_formId");
		$[5] = searchParams;
		$[6] = t3;
	} else t3 = $[6];
	const formId = t3;
	let t4;
	if ($[7] !== searchParams) {
		t4 = searchParams.get("udpf_formVersion");
		$[7] = searchParams;
		$[8] = t4;
	} else t4 = $[8];
	const version = t4;
	searchParams.get("udpf_callback_url");
	let t5;
	if ($[9] !== user) {
		t5 = () => user;
		$[9] = user;
		$[10] = t5;
	} else t5 = $[10];
	let t6;
	if ($[11] !== tenant) {
		t6 = () => tenant;
		$[11] = tenant;
		$[12] = t6;
	} else t6 = $[12];
	let t7;
	if ($[13] !== closeSnackbar || $[14] !== enqueueSnackbar || $[15] !== formId || $[16] !== history || $[17] !== props || $[18] !== t5 || $[19] !== t6 || $[20] !== version) {
		t7 = /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(UdpFormsBuilder, {
			formId,
			version,
			history,
			getUserCallback: t5,
			getTenantCallback: t6,
			enqueueSnackbar,
			closeSnackbar,
			isPublicFormConfigOn: true,
			isCommentingConfigOn: true,
			isFollowUpFormConfigOn: false,
			...props
		}));
		$[13] = closeSnackbar;
		$[14] = enqueueSnackbar;
		$[15] = formId;
		$[16] = history;
		$[17] = props;
		$[18] = t5;
		$[19] = t6;
		$[20] = version;
		$[21] = t7;
	} else t7 = $[21];
	return t7;
};
//#endregion
export { UdpFormsBuilderPage as default };

//# sourceMappingURL=UdpFormsBuilderPage.mjs.map