"use strict";Object.defineProperty(exports, "__esModule", {value: true});

var _chunkR4F2K4UAjs = require('./chunk-R4F2K4UA.js');

// tmp-babel/navigations/web/Header/AccountMenu/index.js
var _authentication = require('@baseapp-frontend/authentication');
var _material = require('@mui/material');
var _jsxruntime = require('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 AccountMenu = function AccountMenu2(_ref) {
  var _ref$AccountPopoverPr = _ref.AccountPopoverProps, AccountPopoverProps = _ref$AccountPopoverPr === void 0 ? {} : _ref$AccountPopoverPr, additionalComponent = _ref.additionalComponent, children = _ref.children, _ref$loginButtonLabel = _ref.loginButtonLabel, loginButtonLabel = _ref$loginButtonLabel === void 0 ? "Login" : _ref$loginButtonLabel, loginButtonProps = _ref.loginButtonProps, onLoginClick = _ref.onLoginClick, onRegisterClick = _ref.onRegisterClick, _ref$registerButtonLa = _ref.registerButtonLabel, registerButtonLabel = _ref$registerButtonLa === void 0 ? "Register" : _ref$registerButtonLa, registerButtonProps = _ref.registerButtonProps;
  var _useJWTUser = _authentication.useJWTUser.call(void 0, ), user = _useJWTUser.user;
  var renderAdditionalComponent = function renderAdditionalComponent2() {
    if (additionalComponent) return additionalComponent;
    return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {});
  };
  var renderHeaderContent = function renderHeaderContent2() {
    if (children) return children;
    return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {});
  };
  if (!user) {
    return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", {
      className: "grid w-full grid-cols-[1fr_max-content_max-content] items-center justify-center gap-1 min-lg:gap-2",
      children: [renderHeaderContent(), onRegisterClick && onLoginClick && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, {
        children: [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Button, _objectSpread(_objectSpread({
          onClick: onRegisterClick,
          variant: "outlined",
          color: "inherit",
          sx: {
            width: "fit-content"
          }
        }, registerButtonProps), {}, {
          children: registerButtonLabel
        })), /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Button, _objectSpread(_objectSpread({
          onClick: onLoginClick,
          sx: {
            width: "fit-content"
          }
        }, loginButtonProps), {}, {
          children: loginButtonLabel
        }))]
      })]
    });
  }
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", {
    className: "grid w-full grid-cols-[1fr_40px_40px] items-center justify-center gap-1 min-lg:gap-2",
    children: [renderHeaderContent(), renderAdditionalComponent(), /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR4F2K4UAjs.AccountPopover_default, _objectSpread({}, AccountPopoverProps))]
  });
};
var AccountMenu_default = AccountMenu;



exports.AccountMenu_default = AccountMenu_default;
//# sourceMappingURL=chunk-VVFL6ADE.js.map