import { SiteHeaderRightComponentTarget } from "./SiteHeaderRightComponent.mjs";
import { useBuildEnvironment } from "./useBuildEnvironment.mjs";
import { BreadCrumbMenu } from "../../UI/inputs/link/BreadCrumbMenu.mjs";
import { AmbientProjectSwitcher } from "./AmbientProjectSwitcher.mjs";
import ShellDropdown from "./ShellDropdown.mjs";
import { LanguageSwitcher } from "./LanguageSwitcher.mjs";
import { HelpCenter } from "./HelpCenter.mjs";
import { EnvironmentRibbon } from "./EnvironmentRibbon.mjs";
import { c } from "react-compiler-runtime";
import React from "react";
import { AppBar, IconButton, Toolbar, Typography, makeStyles, useMediaQuery, useTheme } from "@material-ui/core";
import clsx from "clsx";
import { CollapseMenuIcon, WaffleIcon } from "@fluentui/react-icons";
import PropTypes from "prop-types";
//#region src/shell/ui/SiteHeader.jsx
const useStyles = makeStyles((theme) => ({
	root: {
		color: theme?.palette?.appBar?.contrastText,
		zIndex: theme?.zIndex?.drawer + 1
	},
	spacer: { flex: 1 },
	headerSpacer: {
		padding: 0,
		minHeight: ({ appRibbonSpace }) => 56 + appRibbonSpace
	},
	toolbar: {
		padding: 0,
		minHeight: theme.spacing(6)
	},
	appLaunch: { color: theme?.palette?.getContrastText(theme?.palette?.primary?.main) },
	avatar: {
		width: 25,
		height: 25,
		backgroundColor: theme?.palette?.secondary?.main
	},
	search: {
		marginLeft: theme.spacing(2),
		marginTop: theme.spacing(-1.35)
	},
	children: {
		flex: 1,
		minWidth: 5
	}
}), { name: "SiteHeader" });
/**
* A spacing component with the same height as the SiteHeader
*/
const SiteHeaderSpacer = (props) => {
	const $ = c(7);
	const t0 = useBuildEnvironment() ? 25 : 0;
	let t1;
	if ($[0] !== t0) {
		t1 = { appRibbonSpace: t0 };
		$[0] = t0;
		$[1] = t1;
	} else t1 = $[1];
	const classes = useStyles(t1);
	const { className } = props;
	let t2;
	if ($[2] !== className || $[3] !== classes.headerSpacer) {
		t2 = clsx(className, classes.headerSpacer);
		$[2] = className;
		$[3] = classes.headerSpacer;
		$[4] = t2;
	} else t2 = $[4];
	let t3;
	if ($[5] !== t2) {
		t3 = /* @__PURE__ */ React.createElement("div", { className: t2 });
		$[5] = t2;
		$[6] = t3;
	} else t3 = $[6];
	return t3;
};
/**
* Site header including app bar
*/
const SiteHeader = (props) => {
	const $ = c(88);
	const classes = useStyles(props);
	let appContent;
	let backgroundColor;
	let breadCrumbAltLabelList;
	let className;
	let hideAppLaunch;
	let languages;
	let other;
	let selectedItem;
	let setAppSwitcherOpen;
	let siteName;
	let switcherData;
	let switcherWidth;
	let t0;
	let t1;
	let t2;
	let t3;
	let userAvatar;
	if ($[0] !== props) {
		const { className: t4, returnTo, appContent: t5, userAvatar: t6, siteName: t7, breadCrumbRoot: t8, color: t9, setAppSwitcherOpen: t10, breadCrumbAltLabelList: t11, currentLocation, switcherData: t12, selectedItem: t13, switcherWidth: t14, hideAppLaunch: t15, languages: t16, backgroundColor: t17, hideLanguageSwitcher: t18, hideHelpCenter: t19, ...t20 } = props;
		className = t4;
		appContent = t5;
		userAvatar = t6;
		siteName = t7;
		t0 = t8;
		t1 = t9;
		setAppSwitcherOpen = t10;
		breadCrumbAltLabelList = t11;
		switcherData = t12;
		selectedItem = t13;
		switcherWidth = t14;
		hideAppLaunch = t15;
		languages = t16;
		backgroundColor = t17;
		t2 = t18;
		t3 = t19;
		other = t20;
		$[0] = props;
		$[1] = appContent;
		$[2] = backgroundColor;
		$[3] = breadCrumbAltLabelList;
		$[4] = className;
		$[5] = hideAppLaunch;
		$[6] = languages;
		$[7] = other;
		$[8] = selectedItem;
		$[9] = setAppSwitcherOpen;
		$[10] = siteName;
		$[11] = switcherData;
		$[12] = switcherWidth;
		$[13] = t0;
		$[14] = t1;
		$[15] = t2;
		$[16] = t3;
		$[17] = userAvatar;
	} else {
		appContent = $[1];
		backgroundColor = $[2];
		breadCrumbAltLabelList = $[3];
		className = $[4];
		hideAppLaunch = $[5];
		languages = $[6];
		other = $[7];
		selectedItem = $[8];
		setAppSwitcherOpen = $[9];
		siteName = $[10];
		switcherData = $[11];
		switcherWidth = $[12];
		t0 = $[13];
		t1 = $[14];
		t2 = $[15];
		t3 = $[16];
		userAvatar = $[17];
	}
	const breadCrumbRoot = t0 === void 0 ? "home" : t0;
	const color = t1 === void 0 ? "primary" : t1;
	const hideLanguageSwitcher = t2 === void 0 ? false : t2;
	const hideHelpCenter = t3 === void 0 ? false : t3;
	const theme = useTheme();
	let t4;
	if ($[18] !== theme.breakpoints) {
		t4 = theme.breakpoints.up("sm");
		$[18] = theme.breakpoints;
		$[19] = t4;
	} else t4 = $[19];
	const mobile = useMediaQuery(t4);
	let t5;
	if ($[20] !== classes.root) {
		t5 = { root: classes.root };
		$[20] = classes.root;
		$[21] = t5;
	} else t5 = $[21];
	let t6;
	if ($[22] === Symbol.for("react.memo_cache_sentinel")) {
		t6 = /* @__PURE__ */ React.createElement(EnvironmentRibbon, null);
		$[22] = t6;
	} else t6 = $[22];
	let t7;
	if ($[23] !== classes.appLaunch || $[24] !== hideAppLaunch || $[25] !== mobile || $[26] !== setAppSwitcherOpen) {
		t7 = mobile && !hideAppLaunch && /* @__PURE__ */ React.createElement(IconButton, {
			className: classes.appLaunch,
			"aria-label": "App Launcher Menu",
			onClick: () => setAppSwitcherOpen("desktop", true)
		}, /* @__PURE__ */ React.createElement(WaffleIcon, null));
		$[23] = classes.appLaunch;
		$[24] = hideAppLaunch;
		$[25] = mobile;
		$[26] = setAppSwitcherOpen;
		$[27] = t7;
	} else t7 = $[27];
	let t8;
	if ($[28] !== classes.appLaunch || $[29] !== mobile || $[30] !== setAppSwitcherOpen) {
		t8 = !mobile && /* @__PURE__ */ React.createElement(IconButton, {
			className: classes.appLaunch,
			"aria-label": "App Launcher Menu",
			onClick: () => setAppSwitcherOpen("desktop", true)
		}, /* @__PURE__ */ React.createElement(CollapseMenuIcon, null));
		$[28] = classes.appLaunch;
		$[29] = mobile;
		$[30] = setAppSwitcherOpen;
		$[31] = t8;
	} else t8 = $[31];
	const t9 = hideAppLaunch && 16;
	let t10;
	if ($[32] !== t9) {
		t10 = { marginLeft: t9 };
		$[32] = t9;
		$[33] = t10;
	} else t10 = $[33];
	let t11;
	if ($[34] !== siteName || $[35] !== t10) {
		t11 = /* @__PURE__ */ React.createElement(Typography, {
			component: "h1",
			variant: "h6",
			style: t10
		}, siteName);
		$[34] = siteName;
		$[35] = t10;
		$[36] = t11;
	} else t11 = $[36];
	let t12;
	if ($[37] !== breadCrumbAltLabelList || $[38] !== breadCrumbRoot || $[39] !== mobile) {
		t12 = mobile && /* @__PURE__ */ React.createElement("div", { style: { marginLeft: 70 } }, React.isValidElement(breadCrumbRoot) ? breadCrumbRoot : breadCrumbRoot && typeof breadCrumbRoot === "object" && (breadCrumbRoot.data || breadCrumbRoot.componentName) ? /* @__PURE__ */ React.createElement(ShellDropdown, {
			componentName: breadCrumbRoot.componentName,
			data: breadCrumbRoot.data,
			value: breadCrumbRoot.value,
			onChange: breadCrumbRoot.onChange,
			optionLabelDisplayFunction: breadCrumbRoot.optionLabelDisplayFunction,
			groupBy: breadCrumbRoot.groupBy,
			placeholder: breadCrumbRoot.placeholder,
			className: breadCrumbRoot.className,
			classProps: breadCrumbRoot.classProps
		}) : /* @__PURE__ */ React.createElement(BreadCrumbMenu, {
			color: "primary",
			root: breadCrumbRoot,
			breadCrumbAltLabelList
		}));
		$[37] = breadCrumbAltLabelList;
		$[38] = breadCrumbRoot;
		$[39] = mobile;
		$[40] = t12;
	} else t12 = $[40];
	let t13;
	if ($[41] !== appContent || $[42] !== classes.children) {
		t13 = /* @__PURE__ */ React.createElement("div", { className: classes.children }, appContent);
		$[41] = appContent;
		$[42] = classes.children;
		$[43] = t13;
	} else t13 = $[43];
	let t14;
	if ($[44] !== backgroundColor || $[45] !== selectedItem || $[46] !== switcherData || $[47] !== switcherWidth) {
		t14 = switcherData && /* @__PURE__ */ React.createElement(AmbientProjectSwitcher, {
			data: switcherData,
			selectedItem,
			width: switcherWidth,
			backgroundColor
		});
		$[44] = backgroundColor;
		$[45] = selectedItem;
		$[46] = switcherData;
		$[47] = switcherWidth;
		$[48] = t14;
	} else t14 = $[48];
	let t15;
	if ($[49] !== classes.appLaunch || $[50] !== hideAppLaunch || $[51] !== mobile || $[52] !== setAppSwitcherOpen) {
		t15 = !mobile && !hideAppLaunch && /* @__PURE__ */ React.createElement(IconButton, {
			className: classes.appLaunch,
			"aria-label": "App Launcher Menu",
			onClick: () => setAppSwitcherOpen("mobile", true)
		}, /* @__PURE__ */ React.createElement(WaffleIcon, null));
		$[49] = classes.appLaunch;
		$[50] = hideAppLaunch;
		$[51] = mobile;
		$[52] = setAppSwitcherOpen;
		$[53] = t15;
	} else t15 = $[53];
	let t16;
	if ($[54] === Symbol.for("react.memo_cache_sentinel")) {
		t16 = /* @__PURE__ */ React.createElement(SiteHeaderRightComponentTarget, null);
		$[54] = t16;
	} else t16 = $[54];
	let t17;
	if ($[55] !== classes.additionalRightComponent) {
		t17 = /* @__PURE__ */ React.createElement("div", { className: classes.additionalRightComponent }, t16);
		$[55] = classes.additionalRightComponent;
		$[56] = t17;
	} else t17 = $[56];
	let t18;
	if ($[57] !== hideHelpCenter) {
		t18 = !hideHelpCenter && /* @__PURE__ */ React.createElement(HelpCenter, null);
		$[57] = hideHelpCenter;
		$[58] = t18;
	} else t18 = $[58];
	let t19;
	if ($[59] !== hideLanguageSwitcher || $[60] !== languages) {
		t19 = !hideLanguageSwitcher && /* @__PURE__ */ React.createElement(LanguageSwitcher, { languages });
		$[59] = hideLanguageSwitcher;
		$[60] = languages;
		$[61] = t19;
	} else t19 = $[61];
	let t20;
	if ($[62] !== userAvatar) {
		t20 = /* @__PURE__ */ React.createElement("div", null, userAvatar);
		$[62] = userAvatar;
		$[63] = t20;
	} else t20 = $[63];
	let t21;
	if ($[64] !== classes.toolbar || $[65] !== t11 || $[66] !== t12 || $[67] !== t13 || $[68] !== t14 || $[69] !== t15 || $[70] !== t17 || $[71] !== t18 || $[72] !== t19 || $[73] !== t20 || $[74] !== t7 || $[75] !== t8) {
		t21 = /* @__PURE__ */ React.createElement(Toolbar, { className: classes.toolbar }, t7, t8, t11, t12, t13, t14, t15, t17, t18, t19, t20);
		$[64] = classes.toolbar;
		$[65] = t11;
		$[66] = t12;
		$[67] = t13;
		$[68] = t14;
		$[69] = t15;
		$[70] = t17;
		$[71] = t18;
		$[72] = t19;
		$[73] = t20;
		$[74] = t7;
		$[75] = t8;
		$[76] = t21;
	} else t21 = $[76];
	let t22;
	if ($[77] !== className || $[78] !== color || $[79] !== other || $[80] !== t21 || $[81] !== t5) {
		t22 = /* @__PURE__ */ React.createElement(AppBar, {
			elevation: 0,
			position: "fixed",
			color,
			...other,
			className,
			classes: t5
		}, t6, t21);
		$[77] = className;
		$[78] = color;
		$[79] = other;
		$[80] = t21;
		$[81] = t5;
		$[82] = t22;
	} else t22 = $[82];
	let t23;
	if ($[83] !== className) {
		t23 = /* @__PURE__ */ React.createElement(SiteHeaderSpacer, { className });
		$[83] = className;
		$[84] = t23;
	} else t23 = $[84];
	let t24;
	if ($[85] !== t22 || $[86] !== t23) {
		t24 = /* @__PURE__ */ React.createElement(React.Fragment, null, t22, t23);
		$[85] = t22;
		$[86] = t23;
		$[87] = t24;
	} else t24 = $[87];
	return t24;
};
SiteHeader.propTypes = {
	breadCrumbRoot: PropTypes.oneOfType([
		PropTypes.string,
		PropTypes.element,
		PropTypes.node,
		PropTypes.object
	]),
	backgroundColor: PropTypes.string
};
//#endregion
export { SiteHeader as default };

//# sourceMappingURL=SiteHeader.mjs.map