import { c } from "react-compiler-runtime";
import React, { forwardRef } from "react";
import { ListItem } from "@material-ui/core";
import { NavLink } from "react-router-dom";
//#region src/UI/navigation/menus/AppMenuItemComponent.jsx
const ListItemLinkComponent = forwardRef((props, ref) => {
	const $ = c(3);
	let t0;
	if ($[0] !== props || $[1] !== ref) {
		t0 = /* @__PURE__ */ React.createElement(NavLink, {
			exact: true,
			...props,
			innerRef: ref
		});
		$[0] = props;
		$[1] = ref;
		$[2] = t0;
	} else t0 = $[2];
	return t0;
});
ListItemLinkComponent.displayName = "ListItemLinkComponent";
const AppMenuItemComponent = (props) => {
	const $ = c(20);
	let link;
	let other;
	let params;
	let tenantHref;
	if ($[0] !== props) {
		const { link: t0, tenantHref: t1, params: t2, isChild, ...t3 } = props;
		link = t0;
		tenantHref = t1;
		params = t2;
		other = t3;
		$[0] = props;
		$[1] = link;
		$[2] = other;
		$[3] = params;
		$[4] = tenantHref;
	} else {
		link = $[1];
		other = $[2];
		params = $[3];
		tenantHref = $[4];
	}
	if (!link || typeof link !== "string") {
		let t0;
		if ($[5] !== other) {
			t0 = /* @__PURE__ */ React.createElement(ListItem, {
				button: true,
				...other,
				dense: true
			});
			$[5] = other;
			$[6] = t0;
		} else t0 = $[6];
		return t0;
	}
	let t0;
	if ($[7] !== tenantHref) {
		t0 = (e) => {
			if (!tenantHref) return;
			if (e.button === 1 || e.button === 2 || e.ctrlKey || e.metaKey) e.currentTarget.setAttribute("href", tenantHref);
		};
		$[7] = tenantHref;
		$[8] = t0;
	} else t0 = $[8];
	const swapHrefForNewTab = t0;
	let t1;
	if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
		t1 = /\s+/g;
		$[9] = t1;
	} else t1 = $[9];
	const t2 = "udpRecord-AppMenuItemComponent-" + params.label.replace(t1, "");
	let t3;
	if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
		t3 = /\s+/g;
		$[10] = t3;
	} else t3 = $[10];
	const t4 = "udpRecord-AppMenuItemComponent-" + params.label.replace(t3, "");
	let t5;
	if ($[11] !== link || $[12] !== params) {
		t5 = {
			pathname: link,
			state: params
		};
		$[11] = link;
		$[12] = params;
		$[13] = t5;
	} else t5 = $[13];
	const t6 = tenantHref ? swapHrefForNewTab : void 0;
	let t7;
	if ($[14] !== other || $[15] !== t2 || $[16] !== t4 || $[17] !== t5 || $[18] !== t6) {
		t7 = /* @__PURE__ */ React.createElement(ListItem, {
			id: t2,
			udprecordid: t4,
			button: true,
			component: ListItemLinkComponent,
			to: t5,
			onMouseDown: t6,
			...other,
			onClick: void 0,
			dense: true
		});
		$[14] = other;
		$[15] = t2;
		$[16] = t4;
		$[17] = t5;
		$[18] = t6;
		$[19] = t7;
	} else t7 = $[19];
	return t7;
};
//#endregion
export { AppMenuItemComponent };

//# sourceMappingURL=AppMenuItemComponent.mjs.map