import { getPathObject, getPrimaryKeyValues } from "../../../utilities/maintenanceEngine/CrudBrowserUtilities.mjs";
import { ConfigService } from "../../../configService/index.mjs";
import { CardinalityTypeEnums } from "../../../enums/unitySystemEnums.mjs";
import { useHandleAxiosSnackbar } from "../../../utilities/apiHelpers.mjs";
import { apiMutate } from "../../../utilities/useAxiosMutate.mjs";
import { toLowerFirstChar, toUpperFirstChar } from "../../../utilities/input/StringUtilities.mjs";
import { getSearchObject } from "../../../utilities/search/SearchUtilities.mjs";
import { mapNodeObjValuesToSearchParameters } from "../../../utilities/tree/TreeUtilities.mjs";
import { useAxiosGet } from "../../../utilities/useAxiosGet.mjs";
import { usePromotedMethodEntity } from "../../../hooks/usePromotedMethodEntity.mjs";
import { executeQueryAdHoc } from "../../utilities/methodUtils.mjs";
import { useQueryExecutors } from "../../../hooks/useQueryExecutors.mjs";
import { useSearchFilterParamsMap } from "../../../hooks/useSearchFilterParamsMap.mjs";
import { useAuthedUser } from "../../../utilities/auth/useAuthedUser.mjs";
import { DataBrowserContainer } from "../../../dataBrowser/DataBrowserContainer.mjs";
import { c } from "react-compiler-runtime";
import React, { memo, useEffect, useState } from "react";
import { useLocation } from "react-router-dom";
import "@fluentui/react-icons";
import { useTranslation } from "react-i18next";
import { v4 } from "uuid";
import { Alert } from "@material-ui/lab";
//#region src/udp/pages/UdpDataBrowserPage/UdpDataBrowserPage.jsx
const UdpDataBrowserPage = (props) => {
	const $ = c(134);
	const { queryId, params } = props;
	const user = useAuthedUser();
	const { t } = useTranslation();
	let t0;
	if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
		t0 = [];
		$[0] = t0;
	} else t0 = $[0];
	const [entityData] = useState(t0);
	const [gridApi, setGridApi] = useState(null);
	let t1;
	if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
		t1 = [];
		$[1] = t1;
	} else t1 = $[1];
	const [alertWarnings, setAlertWarnings] = useState(t1);
	const location = useLocation();
	const state = location.state;
	const searchParamStr = location.search;
	let t2;
	if ($[2] !== searchParamStr || $[3] !== state) {
		const searchParams = new URLSearchParams(searchParamStr);
		t2 = state?.queryId ? state.queryId : searchParams.has("queryId") === true ? toUpperFirstChar(searchParams.get("queryId")) : "";
		$[2] = searchParamStr;
		$[3] = state;
		$[4] = t2;
	} else t2 = $[4];
	const searchParamsQueryId = t2;
	const { handleErrorSnackbar, handleSuccessSnackbar } = useHandleAxiosSnackbar();
	const { getCleanData } = useQueryExecutors();
	const udpQueryId = params?.queryId || queryId || searchParamsQueryId || "";
	const udpTagId = params?.udpTagId || "";
	const [selectedEntity, setSelectedEntity] = useState(null);
	const [foreignKeyData, setForeignKeyData] = useState(null);
	const [udpFieldSearchApiId, setUdpFieldSearchApiId] = useState(null);
	const [loading, setLoading] = useState(false);
	const [apiCatalogId, setApiCatalogId] = useState(null);
	const [entityName, setEntityName] = useState(null);
	const [enteredFromConfig, setEnteredFromConfig] = useState(false);
	const { data: udpOjectFieldInfo } = usePromotedMethodEntity("UdpObjectFieldInfo", true);
	const { getQueryFilterElements } = useSearchFilterParamsMap();
	let t3;
	if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
		t3 = {};
		$[5] = t3;
	} else t3 = $[5];
	const [t4] = useAxiosGet(ConfigService.integrationV1ApiUrl, `tenantProductApiCatalogBase/tenant/${user?.currentTenantId}/product/${ConfigService.config.UNITY_PRODUCT_ID}`, t3, !!!user, false);
	const { data: tpacb, loading: tpacbLoading, error: tpacbError } = t4;
	let t5;
	if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
		t5 = {};
		$[6] = t5;
	} else t5 = $[6];
	const [t6] = useAxiosGet(ConfigService.integrationV1ApiUrl, `apiMethodInstance/${udpQueryId}`, t5, !!!udpQueryId, false);
	const { data: apiMethodInstance } = t6;
	let t7;
	if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
		t7 = {};
		$[7] = t7;
	} else t7 = $[7];
	const [t8] = useAxiosGet(ConfigService.integrationV1ApiUrl, `apiMethod/${apiMethodInstance?.apiMethodId}`, t7, !!!apiMethodInstance?.apiMethodId, false);
	const { data: apiMethod } = t8;
	const udpCatalogKey = apiMethod?.entityName || "";
	let t9;
	if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
		t9 = {};
		$[8] = t9;
	} else t9 = $[8];
	const [t10] = useAxiosGet(ConfigService.integrationV2ApiUrl, `apiCatalog/${apiCatalogId}/catalogObject/${entityName}`, t9, !!!apiCatalogId || !!!entityName, false);
	const { data: catalogObject } = t10;
	const { data: promotedMethodEntities, loading: promotedMethodsLoading } = usePromotedMethodEntity(entityName);
	let t11;
	if ($[9] !== selectedEntity?.unityBaseCreateMethod?.apiMethodId) {
		t11 = async (data) => apiMutate(ConfigService.integrationV1ApiUrl, `apimethod/executeQueryWithParameters/${selectedEntity?.unityBaseCreateMethod?.apiMethodId}`, { method: "post" }, data);
		$[9] = selectedEntity?.unityBaseCreateMethod?.apiMethodId;
		$[10] = t11;
	} else t11 = $[10];
	const executeCreate = t11;
	let t12;
	if ($[11] !== selectedEntity?.unityBaseUpdateMethod?.apiMethodId) {
		t12 = async (data_0) => apiMutate(ConfigService.integrationV1ApiUrl, `apimethod/executeQueryWithParameters/${selectedEntity?.unityBaseUpdateMethod?.apiMethodId}`, { method: "post" }, data_0);
		$[11] = selectedEntity?.unityBaseUpdateMethod?.apiMethodId;
		$[12] = t12;
	} else t12 = $[12];
	const executeUpdate = t12;
	let t13;
	if ($[13] !== selectedEntity?.unityBaseDeleteMethod?.apiMethodId) {
		t13 = async (data_1) => apiMutate(ConfigService.integrationV1ApiUrl, `apimethod/executeQueryWithParameters/${selectedEntity?.unityBaseDeleteMethod?.apiMethodId}`, { method: "post" }, data_1);
		$[13] = selectedEntity?.unityBaseDeleteMethod?.apiMethodId;
		$[14] = t13;
	} else t13 = $[14];
	const executeDelete = t13;
	let t14;
	if ($[15] !== executeCreate) {
		t14 = async (data_2) => await executeCreate(data_2);
		$[15] = executeCreate;
		$[16] = t14;
	} else t14 = $[16];
	const onCreate = t14;
	let t15;
	if ($[17] !== executeUpdate) {
		t15 = async (data_3) => await executeUpdate(data_3);
		$[17] = executeUpdate;
		$[18] = t15;
	} else t15 = $[18];
	const onUpdate = t15;
	let t16;
	if ($[19] !== executeDelete) {
		t16 = async (data_4) => await executeDelete(data_4);
		$[19] = executeDelete;
		$[20] = t16;
	} else t16 = $[20];
	const onDelete = t16;
	let t17;
	bb0: {
		if (!apiMethodInstance) {
			let t18;
			if ($[21] === Symbol.for("react.memo_cache_sentinel")) {
				t18 = [];
				$[21] = t18;
			} else t18 = $[21];
			t17 = t18;
			break bb0;
		}
		let t18;
		if ($[22] === Symbol.for("react.memo_cache_sentinel")) {
			t18 = [];
			$[22] = t18;
		} else t18 = $[22];
		let catalogMods = t18;
		try {
			const catalogModificationStr = apiMethodInstance.catalogModification;
			let t19;
			if ($[23] !== catalogModificationStr) {
				t19 = JSON.parse(catalogModificationStr);
				$[23] = catalogModificationStr;
				$[24] = t19;
			} else t19 = $[24];
			catalogMods = t19;
		} catch {
			console.warn("Error parsing apiMethodInstance catalogModification");
		}
		t17 = catalogMods;
	}
	const queryColumnsData = t17;
	let t18;
	bb1: {
		if (!queryColumnsData.length) {
			t18 = null;
			break bb1;
		}
		let map;
		if ($[25] !== queryColumnsData) {
			map = {};
			queryColumnsData.filter(_temp).forEach((lc) => {
				map[lc.name] = {
					lookupKeyName: lc.extendedProperties?.lookupKeyName || "",
					lookupValueName: lc.extendedProperties?.lookupKeyName || "",
					value: lc.extendedProperties?.lookup || "",
					filterOn: !!lc.filterOn || false
				};
			});
			$[25] = queryColumnsData;
			$[26] = map;
		} else map = $[26];
		t18 = map;
	}
	const lookupsMap = t18;
	let filterParams;
	if ($[27] !== params) {
		filterParams = [];
		if (params?.nodeObj && params?.queryParamMapping) {
			const mappedParameters = mapNodeObjValuesToSearchParameters(params.nodeObj, params.queryParamMapping);
			if (Object.keys(mappedParameters).length) Object.keys(mappedParameters).forEach((key) => {
				filterParams.push({
					name: key,
					value: mappedParameters[key],
					type: "string"
				});
			});
		}
		$[27] = params;
		$[28] = filterParams;
	} else filterParams = $[28];
	const nodeFilterParams = filterParams;
	let filterElements;
	if ($[29] !== enteredFromConfig || $[30] !== udpTagId) {
		filterElements = [];
		if (!enteredFromConfig && udpTagId) {
			let t19;
			if ($[32] !== udpTagId) {
				t19 = {
					searchField: "UdpTags.UdpTagAssociationUdpTag.Id",
					searchOperator: "=",
					searchValue: udpTagId
				};
				$[32] = udpTagId;
				$[33] = t19;
			} else t19 = $[33];
			filterElements.push(t19);
		}
		$[29] = enteredFromConfig;
		$[30] = udpTagId;
		$[31] = filterElements;
	} else filterElements = $[31];
	let t19;
	if ($[34] !== apiMethodInstance || $[35] !== getQueryFilterElements || $[36] !== nodeFilterParams) {
		t19 = getQueryFilterElements(apiMethodInstance, nodeFilterParams);
		$[34] = apiMethodInstance;
		$[35] = getQueryFilterElements;
		$[36] = nodeFilterParams;
		$[37] = t19;
	} else t19 = $[37];
	const queryFilterElements = t19;
	let t20;
	if ($[38] !== filterElements || $[39] !== queryFilterElements) {
		t20 = filterElements.concat(queryFilterElements);
		$[38] = filterElements;
		$[39] = queryFilterElements;
		$[40] = t20;
	} else t20 = $[40];
	const searchFilterElements = t20;
	let t21;
	if ($[41] !== catalogObject?.properties) {
		t21 = catalogObject?.properties || [];
		$[41] = catalogObject?.properties;
		$[42] = t21;
	} else t21 = $[42];
	const entityAttributes = t21;
	let t22;
	if ($[43] !== udpFieldSearchApiId) {
		t22 = async (entityName_0) => {
			let fieldInfos = [];
			if (udpFieldSearchApiId) executeQueryAdHoc({ data: getSearchObject([{
				searchField: "ObjectInfo.SanitizedName",
				searchOperator: "=",
				searchValue: entityName_0
			}], 1, 50, true) }, udpFieldSearchApiId).then((resp) => {
				fieldInfos = resp.data?.pageList;
			});
			return fieldInfos;
		};
		$[43] = udpFieldSearchApiId;
		$[44] = t22;
	} else t22 = $[44];
	const getMetaDataForUdpField = t22;
	let t23;
	if ($[45] !== apiCatalogId) {
		t23 = async (attributes) => {
			if (!attributes) return [];
			const fkMethods = [];
			for (const attr of attributes) if (attr?.extendedProperties?.childEntity) {
				const ceFieldsArr = [];
				Object.keys(attr.extendedProperties.childEntityAssoc || {}).length && (attr.extendedProperties.childEntityAssoc.Cardinality === CardinalityTypeEnums.Many_To_Many || attr.extendedProperties.childEntityAssoc.Cardinality === CardinalityTypeEnums.One_To_Many) && !attr.extendedProperties.childEntityAssoc.UdpType && attr.extendedProperties.childEntityAssoc.Keys.forEach((value, i) => {
					const name = value.split(",")[0];
					if (name) ceFieldsArr.push({
						idx: i,
						name: /^[A-Z]*$/.test(name) ? name.toLowerCase() : toLowerFirstChar(name)
					});
				});
				const ceAttr = attributes.find((p) => ceFieldsArr.find((cef) => cef.name === p.name));
				if (ceAttr) await apiMutate(ConfigService.integrationV1ApiUrl, `apicatalog/${apiCatalogId}/promotedMethodEntities/${attr.reference}/product/${ConfigService.config.UNITY_PRODUCT_ID}`, { method: "get" }, {}).then((resp_0) => {
					if (resp_0 && resp_0.data) fkMethods.push({
						entityAttribute: ceAttr,
						entity: resp_0.data
					});
				});
			}
			return fkMethods;
		};
		$[45] = apiCatalogId;
		$[46] = t23;
	} else t23 = $[46];
	const getFKMethodEntities = t23;
	let t24;
	if ($[47] !== getMetaDataForUdpField) {
		t24 = async (entityName_1) => {
			let fieldsInfo;
			fieldsInfo = await getMetaDataForUdpField(entityName_1);
			if (fieldsInfo?.length <= 0) return "";
			return (fieldsInfo?.find(_temp2))?.name;
		};
		$[47] = getMetaDataForUdpField;
		$[48] = t24;
	} else t24 = $[48];
	const getFKAssociationLabel = t24;
	const getDataByKey = _temp3;
	let t25;
	if ($[49] !== entityAttributes || $[50] !== getFKAssociationLabel || $[51] !== getFKMethodEntities) {
		t25 = async () => {
			if (!entityAttributes?.length) return null;
			const fkMethods_0 = await getFKMethodEntities(entityAttributes);
			if (!fkMethods_0?.length) {
				setForeignKeyData([]);
				return [];
			}
			const fkData = [];
			const promises = [];
			const promiseDetails = [];
			const warnings = [];
			for (const method of fkMethods_0) if (method && method?.entity?.unityBaseGetAllMethod) {
				const associationLabel = await getFKAssociationLabel(method.entity.entityName);
				promiseDetails.push({
					url: ConfigService.integrationV1ApiUrl + `/apimethod/executeQueryWithParameters/${method?.entity?.unityBaseGetAllMethod?.apiMethodId}`,
					fieldName: method.entityAttribute.name,
					name: method.entity.entityName,
					associationLabel
				});
				promises.push(apiMutate(ConfigService.integrationV1ApiUrl, `apimethod/executeQueryWithParameters/${method?.entity?.unityBaseGetAllMethod?.apiMethodId}`, { method: "post" }, { data: {} }));
			} else warnings.push({
				id: v4(),
				message: `${method.entity.entityName}'s Get-All method needs to be promoted`
			});
			setAlertWarnings(warnings);
			Promise.all(promises).then((resp_1) => {
				resp_1.forEach((response, index) => {
					if (response.status === 200) {
						if (response?.data) {
							const respData = [];
							const promiseDetail = promiseDetails.find((p_0) => p_0.url === response?.config?.url && !fkData.find((fd) => fd.entityName === p_0.Name && fd.fieldName === p_0.fieldName));
							response.data.forEach((d) => {
								const id = getDataByKey(d, promiseDetail?.fieldName && d[promiseDetail.fieldName] ? promiseDetail.fieldName : "id");
								const name_0 = getDataByKey(d, toLowerFirstChar(promiseDetail.associationLabel) || "name");
								respData.push({
									id,
									name: name_0 ?? id
								});
							});
							fkData.push({
								fieldName: promiseDetail.fieldName,
								entityName: promiseDetail.name,
								name: promiseDetail.fieldName,
								data: respData
							});
						}
					}
				});
				setForeignKeyData(fkData);
			});
		};
		$[49] = entityAttributes;
		$[50] = getFKAssociationLabel;
		$[51] = getFKMethodEntities;
		$[52] = t25;
	} else t25 = $[52];
	const getFKData = t25;
	let t26;
	if ($[53] !== gridApi || $[54] !== handleErrorSnackbar || $[55] !== handleSuccessSnackbar || $[56] !== onCreate || $[57] !== selectedEntity || $[58] !== t) {
		t26 = async (values) => {
			if (selectedEntity) {
				const entityName_2 = selectedEntity?.entityName;
				if (selectedEntity?.unityBaseCreateMethod) {
					const response_0 = await onCreate({ data: { requestBody: values } }).catch((res) => {
						handleErrorSnackbar(res);
					});
					if (response_0?.status === 200) {
						handleSuccessSnackbar(entityName_2 ? t(`${entityName_2} has been created`) : t("Entity has been created"));
						gridApi?.refreshServerSide();
						return response_0;
					}
				}
			}
		};
		$[53] = gridApi;
		$[54] = handleErrorSnackbar;
		$[55] = handleSuccessSnackbar;
		$[56] = onCreate;
		$[57] = selectedEntity;
		$[58] = t;
		$[59] = t26;
	} else t26 = $[59];
	const handleOnCreate = t26;
	let t27;
	if ($[60] !== gridApi || $[61] !== handleErrorSnackbar || $[62] !== handleSuccessSnackbar || $[63] !== onUpdate || $[64] !== selectedEntity || $[65] !== t) {
		t27 = async (values_0, primaryKeyValues) => {
			if (selectedEntity) {
				const entityName_3 = selectedEntity?.entityName;
				if (selectedEntity?.unityBaseUpdateMethod) {
					const pathObject = getPathObject(selectedEntity.unityBaseUpdateMethod.pathParameters, primaryKeyValues);
					let data_6 = { requestBody: values_0 };
					if (Array.isArray(pathObject)) pathObject.forEach((po) => {
						data_6[Object.keys(po)[0]] = po[Object.keys(po)[0]];
					});
					else data_6 = {
						...pathObject,
						requestBody: values_0
					};
					if ((await onUpdate({ data: data_6 }).catch((res_0) => {
						handleErrorSnackbar(res_0);
					}))?.status === 200) {
						handleSuccessSnackbar(entityName_3 ? t(`${entityName_3} has been updated`) : t("Entity has been updated"));
						gridApi?.refreshServerSide();
					}
				}
			}
		};
		$[60] = gridApi;
		$[61] = handleErrorSnackbar;
		$[62] = handleSuccessSnackbar;
		$[63] = onUpdate;
		$[64] = selectedEntity;
		$[65] = t;
		$[66] = t27;
	} else t27 = $[66];
	const handleOnUpdate = t27;
	let t28;
	if ($[67] !== entityAttributes || $[68] !== getCleanData || $[69] !== gridApi || $[70] !== handleErrorSnackbar || $[71] !== handleSuccessSnackbar || $[72] !== lookupsMap || $[73] !== onDelete || $[74] !== selectedEntity || $[75] !== t) {
		t28 = async (value_0) => {
			value_0 = getCleanData(value_0, lookupsMap);
			if (selectedEntity) {
				const entityName_4 = selectedEntity?.entityName;
				if (selectedEntity?.unityBaseDeleteMethod) {
					const primaryKeyValues_0 = getPrimaryKeyValues(entityAttributes, value_0);
					const pathObject_0 = getPathObject(selectedEntity?.unityBaseDeleteMethod.pathParameters, primaryKeyValues_0);
					let data_7 = {};
					if (Array.isArray(pathObject_0)) pathObject_0.forEach((po_0) => {
						data_7[Object.keys(po_0)[0]] = po_0[Object.keys(po_0)[0]];
					});
					else data_7 = { ...pathObject_0 };
					if ((await onDelete({ data: data_7 }).catch((res_1) => {
						handleErrorSnackbar(res_1);
					}))?.status === 200) {
						handleSuccessSnackbar(entityName_4 ? t(`${entityName_4} has been deleted`) : t("Entity has been deleted"));
						gridApi?.refreshServerSide();
					}
				}
			}
		};
		$[67] = entityAttributes;
		$[68] = getCleanData;
		$[69] = gridApi;
		$[70] = handleErrorSnackbar;
		$[71] = handleSuccessSnackbar;
		$[72] = lookupsMap;
		$[73] = onDelete;
		$[74] = selectedEntity;
		$[75] = t;
		$[76] = t28;
	} else t28 = $[76];
	const handleOnDelete = t28;
	let t29;
	if ($[77] === Symbol.for("react.memo_cache_sentinel")) {
		t29 = (entityName_5) => {
			setAlertWarnings([]);
			setEntityName(entityName_5);
			setEnteredFromConfig(true);
		};
		$[77] = t29;
	} else t29 = $[77];
	const handleEntitySelect = t29;
	let t30;
	if ($[78] !== alertWarnings) {
		t30 = (id_0) => {
			setAlertWarnings(alertWarnings.filter((warning) => warning.id !== id_0));
		};
		$[78] = alertWarnings;
		$[79] = t30;
	} else t30 = $[79];
	const removeWarning = t30;
	let t31;
	let t32;
	if ($[80] !== entityAttributes || $[81] !== getFKData || $[82] !== udpFieldSearchApiId) {
		t31 = () => {
			const setFrKeyData = async () => {
				await getFKData();
			};
			if (entityAttributes && udpFieldSearchApiId !== null) setFrKeyData();
		};
		t32 = [
			entityAttributes,
			getFKData,
			udpFieldSearchApiId
		];
		$[80] = entityAttributes;
		$[81] = getFKData;
		$[82] = udpFieldSearchApiId;
		$[83] = t31;
		$[84] = t32;
	} else {
		t31 = $[83];
		t32 = $[84];
	}
	useEffect(t31, t32);
	let t33;
	let t34;
	if ($[85] !== promotedMethodEntities) {
		t33 = () => {
			if (promotedMethodEntities) setSelectedEntity(promotedMethodEntities);
		};
		t34 = [promotedMethodEntities];
		$[85] = promotedMethodEntities;
		$[86] = t33;
		$[87] = t34;
	} else {
		t33 = $[86];
		t34 = $[87];
	}
	useEffect(t33, t34);
	let t35;
	let t36;
	if ($[88] !== udpOjectFieldInfo) {
		t35 = () => {
			if (udpOjectFieldInfo) setUdpFieldSearchApiId(udpOjectFieldInfo?.unityBaseSearchMethod?.apiMethodId || "");
		};
		t36 = [udpOjectFieldInfo];
		$[88] = udpOjectFieldInfo;
		$[89] = t35;
		$[90] = t36;
	} else {
		t35 = $[89];
		t36 = $[90];
	}
	useEffect(t35, t36);
	let t37;
	let t38;
	if ($[91] !== udpCatalogKey) {
		t37 = () => {
			setAlertWarnings([]);
			if (udpCatalogKey) setEntityName(udpCatalogKey);
		};
		t38 = [udpCatalogKey];
		$[91] = udpCatalogKey;
		$[92] = t37;
		$[93] = t38;
	} else {
		t37 = $[92];
		t38 = $[93];
	}
	useEffect(t37, t38);
	let t39;
	let t40;
	if ($[94] !== tpacb) {
		t39 = () => {
			if (tpacb) setApiCatalogId(tpacb.apiCatalogId);
		};
		t40 = [tpacb];
		$[94] = tpacb;
		$[95] = t39;
		$[96] = t40;
	} else {
		t39 = $[95];
		t40 = $[96];
	}
	useEffect(t39, t40);
	let t41;
	let t42;
	if ($[97] !== promotedMethodsLoading || $[98] !== tpacbLoading) {
		t41 = () => {
			setLoading(tpacbLoading || promotedMethodsLoading);
		};
		t42 = [tpacbLoading, promotedMethodsLoading];
		$[97] = promotedMethodsLoading;
		$[98] = tpacbLoading;
		$[99] = t41;
		$[100] = t42;
	} else {
		t41 = $[99];
		t42 = $[100];
	}
	useEffect(t41, t42);
	if (tpacbError) {
		let t43;
		if ($[101] !== t) {
			t43 = t("There is no Api Catalog associated with your tenant and product");
			$[101] = t;
			$[102] = t43;
		} else t43 = $[102];
		let t44;
		if ($[103] !== t43) {
			t44 = /* @__PURE__ */ React.createElement(Alert, { severity: "error" }, t43);
			$[103] = t43;
			$[104] = t44;
		} else t44 = $[104];
		return t44;
	}
	let t43;
	if ($[105] !== alertWarnings || $[106] !== removeWarning) {
		let t44;
		if ($[108] !== removeWarning) {
			t44 = (warning_0, idx) => /* @__PURE__ */ React.createElement(Alert, {
				onClose: () => removeWarning(warning_0.id),
				severity: "warning",
				key: idx
			}, warning_0.message || "");
			$[108] = removeWarning;
			$[109] = t44;
		} else t44 = $[109];
		t43 = alertWarnings.map(t44);
		$[105] = alertWarnings;
		$[106] = removeWarning;
		$[107] = t43;
	} else t43 = $[107];
	const t44 = params?.loadInquiryNode && params?.displayLoadNodeButton ? params.loadInquiryNode : null;
	let t45;
	if ($[110] !== apiCatalogId || $[111] !== entityName) {
		t45 = {
			apiCatalogId,
			entityName
		};
		$[110] = apiCatalogId;
		$[111] = entityName;
		$[112] = t45;
	} else t45 = $[112];
	let t46;
	if ($[113] !== enteredFromConfig) {
		t46 = enteredFromConfig ? () => handleEntitySelect(null) : null;
		$[113] = enteredFromConfig;
		$[114] = t46;
	} else t46 = $[114];
	const t47 = !params?.loadInquiryNode;
	let t48;
	if ($[115] !== entityAttributes || $[116] !== entityData || $[117] !== foreignKeyData || $[118] !== handleOnCreate || $[119] !== handleOnDelete || $[120] !== handleOnUpdate || $[121] !== loading || $[122] !== lookupsMap || $[123] !== queryColumnsData || $[124] !== searchFilterElements || $[125] !== selectedEntity || $[126] !== t44 || $[127] !== t45 || $[128] !== t46 || $[129] !== t47) {
		t48 = /* @__PURE__ */ React.createElement(DataBrowserContainer, {
			entityData,
			onCreate: handleOnCreate,
			onUpdate: handleOnUpdate,
			onDelete: handleOnDelete,
			onLoadInquiryNode: t44,
			entityAttributes,
			foreignKeyData,
			loading,
			promotedEntity: selectedEntity,
			isServerSide: true,
			apiMethod: t45,
			setGridApi,
			filterElements: searchFilterElements,
			backToConfigPage: t46,
			queryColumnsData,
			lookupsMap,
			disableRowSelction: t47
		});
		$[115] = entityAttributes;
		$[116] = entityData;
		$[117] = foreignKeyData;
		$[118] = handleOnCreate;
		$[119] = handleOnDelete;
		$[120] = handleOnUpdate;
		$[121] = loading;
		$[122] = lookupsMap;
		$[123] = queryColumnsData;
		$[124] = searchFilterElements;
		$[125] = selectedEntity;
		$[126] = t44;
		$[127] = t45;
		$[128] = t46;
		$[129] = t47;
		$[130] = t48;
	} else t48 = $[130];
	let t49;
	if ($[131] !== t43 || $[132] !== t48) {
		t49 = /* @__PURE__ */ React.createElement(React.Fragment, null, t43, t48);
		$[131] = t43;
		$[132] = t48;
		$[133] = t49;
	} else t49 = $[133];
	return t49;
};
var UdpDataBrowserPage_default = memo(UdpDataBrowserPage);
function _temp(column) {
	return !!column.extendedProperties?.lookup;
}
function _temp2(fi) {
	return fi.properties?.maintainenceConfig?.associationLabel === "true";
}
function _temp3(obj, k) {
	if (!obj) return null;
	let val = obj[k] ?? null;
	if (!val) {
		const key_0 = Object.keys(obj).find((objKey) => objKey.toLowerCase().includes(k));
		if (key_0) val = obj[key_0];
	}
	return val;
}
//#endregion
export { UdpDataBrowserPage, UdpDataBrowserPage_default as default };

//# sourceMappingURL=UdpDataBrowserPage.mjs.map