import {
  MenuItems_default
} from "./chunk-3NAERPFL.mjs";
import {
  CurrentUser_default
} from "./chunk-O2URELIU.mjs";
import {
  CurrentProfile_default
} from "./chunk-NH7KZ2QM.mjs";
import {
  SwitchProfileMenu_default
} from "./chunk-CE2ARI5I.mjs";

// tmp-babel/navigations/web/Header/AccountMenu/AccountPopover/CurrentProfileMenu/index.js
import { useCurrentProfile } from "@baseapp-frontend/authentication";
import { Divider } from "@mui/material";
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
function _typeof(o) {
  "@babel/helpers - typeof";
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
    return typeof o2;
  } : function(o2) {
    return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
  }, _typeof(o);
}
function ownKeys(e, r) {
  var t = Object.keys(e);
  if (Object.getOwnPropertySymbols) {
    var o = Object.getOwnPropertySymbols(e);
    r && (o = o.filter(function(r2) {
      return Object.getOwnPropertyDescriptor(e, r2).enumerable;
    })), t.push.apply(t, o);
  }
  return t;
}
function _objectSpread(e) {
  for (var r = 1; r < arguments.length; r++) {
    var t = null != arguments[r] ? arguments[r] : {};
    r % 2 ? ownKeys(Object(t), true).forEach(function(r2) {
      _defineProperty(e, r2, t[r2]);
    }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r2) {
      Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
    });
  }
  return e;
}
function _defineProperty(e, r, t) {
  return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
}
function _toPropertyKey(t) {
  var i = _toPrimitive(t, "string");
  return "symbol" == _typeof(i) ? i : i + "";
}
function _toPrimitive(t, r) {
  if ("object" != _typeof(t) || !t) return t;
  var e = t[Symbol.toPrimitive];
  if (void 0 !== e) {
    var i = e.call(t, r || "default");
    if ("object" != _typeof(i)) return i;
    throw new TypeError("@@toPrimitive must return a primitive value.");
  }
  return ("string" === r ? String : Number)(t);
}
var CurrentProfileMenu = function CurrentProfileMenu2(_ref) {
  var _MenuItemsProps$menuI;
  var _ref$CurrentUser = _ref.CurrentUser, CurrentUser = _ref$CurrentUser === void 0 ? CurrentUser_default : _ref$CurrentUser, _ref$CurrentProfile = _ref.CurrentProfile, CurrentProfile = _ref$CurrentProfile === void 0 ? CurrentProfile_default : _ref$CurrentProfile, _ref$SwitchProfileMen = _ref.SwitchProfileMenu, SwitchProfileMenu = _ref$SwitchProfileMen === void 0 ? SwitchProfileMenu_default : _ref$SwitchProfileMen, _ref$SwitchProfileMen2 = _ref.SwitchProfileMenuProps, SwitchProfileMenuProps = _ref$SwitchProfileMen2 === void 0 ? {} : _ref$SwitchProfileMen2, _ref$MenuItems = _ref.MenuItems, MenuItems = _ref$MenuItems === void 0 ? MenuItems_default : _ref$MenuItems, _ref$MenuItemsProps = _ref.MenuItemsProps, MenuItemsProps = _ref$MenuItemsProps === void 0 ? {} : _ref$MenuItemsProps, handlePopoverOnClose = _ref.handlePopoverOnClose, setOpenProfilesList = _ref.setOpenProfilesList;
  var _useCurrentProfile = useCurrentProfile(), profile = _useCurrentProfile.currentProfile;
  var loadCurrentProfile = Boolean(CurrentProfile) && Boolean(profile);
  var loadCurrentUser = !loadCurrentProfile && Boolean(CurrentUser);
  var shouldShowDivider = Boolean(loadCurrentProfile || loadCurrentUser || Boolean(SwitchProfileMenu));
  return /* @__PURE__ */ _jsxs(_Fragment, {
    children: [loadCurrentProfile && /* @__PURE__ */ _jsx(CurrentProfile, {}), loadCurrentUser && /* @__PURE__ */ _jsx(CurrentUser, {}), loadCurrentProfile && Boolean(SwitchProfileMenu) && /* @__PURE__ */ _jsx(SwitchProfileMenu, _objectSpread({
      openProfilesList: function openProfilesList() {
        return setOpenProfilesList(true);
      }
    }, SwitchProfileMenuProps)), Boolean(MenuItemsProps === null || MenuItemsProps === void 0 || (_MenuItemsProps$menuI = MenuItemsProps.menuItems) === null || _MenuItemsProps$menuI === void 0 ? void 0 : _MenuItemsProps$menuI.length) && /* @__PURE__ */ _jsxs(_Fragment, {
      children: [shouldShowDivider && /* @__PURE__ */ _jsx(Divider, {
        sx: {
          borderStyle: "solid"
        }
      }), /* @__PURE__ */ _jsx(MenuItems, _objectSpread({
        handlePopoverOnClose
      }, MenuItemsProps))]
    })]
  });
};
var CurrentProfileMenu_default = CurrentProfileMenu;

export {
  CurrentProfileMenu_default
};
//# sourceMappingURL=chunk-ZHR3K6NM.mjs.map