import { LayoutUnit } from "../layout/LayoutUnit.mjs";
import { c } from "react-compiler-runtime";
import React from "react";
import { Typography, makeStyles } from "@material-ui/core";
//#region src/inquiry/NodeDetails.jsx
const useStyles = makeStyles((theme) => ({
	root: { marginLeft: theme.spacing(2) },
	wrapper: {},
	columnOne: {
		height: 164,
		overflowX: "auto",
		display: "flex",
		flexDirection: "column",
		flexWrap: "wrap"
	},
	listItem: { marginRight: theme.spacing(1) }
}));
const ListItem$1 = (props) => {
	const $ = c(9);
	const { label, value } = props;
	const classes = useStyles();
	let t0;
	if ($[0] !== label) {
		t0 = /* @__PURE__ */ React.createElement(Typography, {
			color: "secondary",
			variant: "caption"
		}, label);
		$[0] = label;
		$[1] = t0;
	} else t0 = $[1];
	let t1;
	if ($[2] !== value) {
		t1 = /* @__PURE__ */ React.createElement(Typography, null, value);
		$[2] = value;
		$[3] = t1;
	} else t1 = $[3];
	let t2;
	if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
		t2 = /* @__PURE__ */ React.createElement(LayoutUnit, { unit: "xxs" });
		$[4] = t2;
	} else t2 = $[4];
	let t3;
	if ($[5] !== classes.listItem || $[6] !== t0 || $[7] !== t1) {
		t3 = /* @__PURE__ */ React.createElement("div", { className: classes.listItem }, t0, t1, t2);
		$[5] = classes.listItem;
		$[6] = t0;
		$[7] = t1;
		$[8] = t3;
	} else t3 = $[8];
	return t3;
};
const NodeDetails = (props) => {
	const $ = c(16);
	const { node } = props;
	const classes = useStyles();
	let t0;
	bb0: {
		if (!node || !node?.nodeObj || !node?.properties?.pageHeaderConfiguration) {
			let t1;
			if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
				t1 = [];
				$[0] = t1;
			} else t1 = $[0];
			t0 = t1;
			break bb0;
		}
		let list;
		if ($[1] !== node.nodeObj || $[2] !== node.properties.catalogObjectKey || $[3] !== node.properties.pageHeaderConfiguration) {
			const shownPageHeaderConfigurations = node.properties.pageHeaderConfiguration.filter(_temp);
			list = [];
			shownPageHeaderConfigurations.forEach((sphc) => {
				const propertyName = sphc.propertyName;
				const property = sphc.property;
				let value = node.nodeObj[propertyName];
				if (sphc.joiningEntityKey) if (sphc.joiningEntityKey === node.properties?.catalogObjectKey) value = node.nodeObj[property ? property : propertyName];
				else {
					const valueObj = node.nodeObj[sphc.joiningEntityKey];
					if (valueObj) value = valueObj[property ? property : propertyName];
					if (!value) value = node.nodeObj[property ? property : propertyName];
				}
				const item = {
					label: sphc.name,
					value: value ? value.toString() : "N/A"
				};
				list.push(item);
			});
			$[1] = node.nodeObj;
			$[2] = node.properties.catalogObjectKey;
			$[3] = node.properties.pageHeaderConfiguration;
			$[4] = list;
		} else list = $[4];
		t0 = list;
	}
	const details = t0;
	const t1 = classes.root;
	const t2 = classes.wrapper;
	const t3 = classes.columnOne;
	let t4;
	if ($[5] !== details) {
		t4 = details.map(_temp2);
		$[5] = details;
		$[6] = t4;
	} else t4 = $[6];
	let t5;
	if ($[7] !== classes.columnOne || $[8] !== t4) {
		t5 = /* @__PURE__ */ React.createElement("div", { className: t3 }, t4);
		$[7] = classes.columnOne;
		$[8] = t4;
		$[9] = t5;
	} else t5 = $[9];
	let t6;
	if ($[10] !== classes.wrapper || $[11] !== t5) {
		t6 = /* @__PURE__ */ React.createElement("div", { className: t2 }, t5);
		$[10] = classes.wrapper;
		$[11] = t5;
		$[12] = t6;
	} else t6 = $[12];
	let t7;
	if ($[13] !== classes.root || $[14] !== t6) {
		t7 = /* @__PURE__ */ React.createElement("div", { className: t1 }, t6);
		$[13] = classes.root;
		$[14] = t6;
		$[15] = t7;
	} else t7 = $[15];
	return t7;
};
function _temp(phc) {
	return phc.isShown;
}
function _temp2(item_0) {
	return /* @__PURE__ */ React.createElement(ListItem$1, {
		key: item_0.label,
		label: item_0.label,
		value: item_0.value
	});
}
//#endregion
export { NodeDetails };

//# sourceMappingURL=NodeDetails.mjs.map