"use strict";

function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;

var _react = _interopRequireWildcard(require("react"));

var _classnames = _interopRequireDefault(require("classnames"));

var _toast = _interopRequireDefault(require("../toast"));

var _bsGlobal = require("../../utils/bs-global");

var _request = require("../../utils/request");

var _appCenter = _interopRequireDefault(require("./components/app-center"));

var _userOwnMenu = _interopRequireDefault(require("./components/user-own-menu"));

var _guideTip = _interopRequireDefault(require("../guide-tip"));

var _menu = _interopRequireDefault(require("./components/menu"));

var _userMessage = _interopRequireDefault(require("./components/user-message"));

var _version = _interopRequireDefault(require("./components/version"));

var _useGlobalValue = _interopRequireDefault(require("./useGlobalValue"));

var _home = _interopRequireDefault(require("./images/home.svg"));

var _utils = require("./utils");

var _okrGuide = _interopRequireDefault(require("../okr-guide"));

var _createOkrModal = _interopRequireDefault(require("../create-okr-modal"));

var _bookDemo = _interopRequireDefault(require("../book-demo"));

var _interface = require("../../components/help-card/interface");

var _request2 = require("./request.apis");

var _auth = require("../../utils/auth");

var _getLocale = require("../../utils/getLocale");

var _invitePoint = _interopRequireDefault(require("./images/invite-point.png"));

var _tooltip = _interopRequireDefault(require("../tooltip"));

var _inviteTanhao = _interopRequireDefault(require("./images/invite-tanhao.png"));

var _platform = require("../../utils/platform");

require("./index.css");

var _getBSGlobal, _getTenantInfo, _getBSGlobal2;

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }

function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }

function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }

function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }

function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }

function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }

function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }

var Role = new _auth.MyRole();
var isTry = ((_getBSGlobal = (0, _bsGlobal.getBSGlobal)('tenantAuthentication')) === null || _getBSGlobal === void 0 ? void 0 : _getBSGlobal.Version) === 1;
var isPerformance = ((_getTenantInfo = (0, _bsGlobal.getTenantInfo)()) === null || _getTenantInfo === void 0 ? void 0 : _getTenantInfo.tenantType) == 2;
var noshowChangeVersion = (0, _platform.isFeishu)(true) && isPerformance;
var staffCount = (_getBSGlobal2 = (0, _bsGlobal.getBSGlobal)('tenantInfo')) === null || _getBSGlobal2 === void 0 ? void 0 : _getBSGlobal2.StaffCount;
var Logo = (0, _utils.getLogo)();
var newNavigation = (0, _bsGlobal.getBSGlobal)('newNavigation') || [];
var hasOKRApp = newNavigation.find(function (item) {
  return item.appId === 113;
});
var preCls = 'titaui-nav-top';

var NavTop = function NavTop() {
  var _getTenantInfo2, _getTenantInfo3, _classNames4;

  var isUseNewMenu = window.BSGlobal.isUseNewMenu;

  var _useState = (0, _react.useState)(function () {
    if (isUseNewMenu) return [];
    return (0, _utils.getMenus)();
  }),
      _useState2 = _slicedToArray(_useState, 2),
      menu = _useState2[0],
      setMenu = _useState2[1];

  var versionInfo = (0, _bsGlobal.getBSGlobal)('tenantAuthentication');

  var _useState3 = (0, _react.useState)(-1),
      _useState4 = _slicedToArray(_useState3, 2),
      activeMenuId = _useState4[0],
      setActiveMenuId = _useState4[1];

  var _useState5 = (0, _react.useState)(false),
      _useState6 = _slicedToArray(_useState5, 2),
      appCenterVisible = _useState6[0],
      setAppCenterVisible = _useState6[1];

  var _useState7 = (0, _react.useState)(false),
      _useState8 = _slicedToArray(_useState7, 2),
      appCenterPosition = _useState8[0],
      setAppCenterPosition = _useState8[1];

  var _useState9 = (0, _react.useState)(false),
      _useState10 = _slicedToArray(_useState9, 2),
      summaryGuideVisible = _useState10[0],
      setSummaryGuideVisible = _useState10[1];

  var _useState11 = (0, _react.useState)(false),
      _useState12 = _slicedToArray(_useState11, 2),
      versionGuideVisible = _useState12[0],
      setVersionGuideVisible = _useState12[1];

  var _useState13 = (0, _react.useState)(false),
      _useState14 = _slicedToArray(_useState13, 2),
      okrGuideVisible = _useState14[0],
      setOkrGuideVisible = _useState14[1];

  var _useState15 = (0, _react.useState)(false),
      _useState16 = _slicedToArray(_useState15, 2),
      createOkrModalVisible = _useState16[0],
      setCreateokrModalVisible = _useState16[1];

  var _useState17 = (0, _react.useState)(20220602),
      _useState18 = _slicedToArray(_useState17, 2),
      bookDemoSource = _useState18[0],
      setBookDemoSource = _useState18[1];

  var _useState19 = (0, _react.useState)(false),
      _useState20 = _slicedToArray(_useState19, 2),
      bookDemoVisible = _useState20[0],
      setBookDemoVisible = _useState20[1];

  var _useState21 = (0, _react.useState)(true),
      _useState22 = _slicedToArray(_useState21, 2),
      inviteVisible = _useState22[0],
      setInviteVisible = _useState22[1];

  var _useState23 = (0, _react.useState)(true),
      _useState24 = _slicedToArray(_useState23, 2),
      inviteAuth = _useState24[0],
      setInviteAuth = _useState24[1];

  var ua = navigator.userAgent.toLowerCase();
  var showWxInvite = ((_getTenantInfo2 = (0, _bsGlobal.getTenantInfo)()) === null || _getTenantInfo2 === void 0 ? void 0 : _getTenantInfo2.mainCorpId) && ua.indexOf('micromessenger') !== -1;
  var showMangeAdd = !((_getTenantInfo3 = (0, _bsGlobal.getTenantInfo)()) !== null && _getTenantInfo3 !== void 0 && _getTenantInfo3.mainCorpId) && ua.indexOf('micromessenger') !== -1 && isTry && Role.isSuperManager; // const canShowInvite = getTenantInfo()?.mainCorpId || Role.isSuperManager
  // const showWxInvite =
  //   getTenantInfo()?.Source === 860 &&
  //   ua.indexOf('micromessenger') !== -1 &&
  //   isTry && canShowInvite

  var manageAdd = (0, _react.useCallback)(function () {
    if (window.WeixinJSBridge !== undefined) {
      window.WeixinJSBridge.invoke('openAppManage', {}, function (res) {
        console.log(res.err_msg);

        if (res.err_msg == 'openAppManage:ok') {
          // 调用成功
          if (window.titaTracker) {
            window.titaTracker("action").record({
              productName: "邀请同事",
              actionGroup: "PC",
              actionName: "\u7BA1\u7406\u5458\u70B9\u51FB\u8FDB\u5165\u4F01\u4E1A\u5FAE\u4FE1\u540E\u53F0"
            });
          }
        } else {
          if (!inviteVisible) {
            setInviteVisible(true);
          }

          setInviteAuth(false);

          if (window.titaTracker) {
            window.titaTracker("action").record({
              productName: "邀请同事",
              actionGroup: "PC",
              actionName: "\u7BA1\u7406\u5458\u70B9\u51FB\u8FDB\u5165\u4F01\u4E1A\u5FAE\u4FE1\u540E\u53F0\u663E\u793A\u6CA1\u6743\u9650"
            });
          }
        }
      });
    }
  }, [inviteVisible]);
  var openWxInvite = (0, _react.useCallback)(function () {
    if (window.WeixinJSBridge !== undefined) {
      window.WeixinJSBridge.invoke('selectPrivilegedContact', {
        fromDepartmentId: -1,
        // 必填，表示打开的通讯录从指定的部门开始展示，-1表示自己所在部门开始, 0表示从最上层开始
        mode: 'multi',
        // 必填，选择模式，single表示单选，multi表示多选
        selectedContextContact: 0 // 是否勾选当前环境的参与者。例如在群+号聊天附件栏打开，默认勾选当前群成员。

      }, function (res) {
        if (res.err_msg === 'selectPrivilegedContact:ok') {
          var selectedTicket = res.result.selectedTicket.replace(/['"]/g, ''); // 已选的集合Ticket

          (0, _request.rpost)('v1')("wx/send/templateMessage?selectedTickets=".concat(selectedTicket)).then(function () {
            _toast["default"].Success('邀请成功');
          })["catch"](function () {
            _toast["default"].Error('邀请失败');
          });
        } else {// console.log(res);
        }

        if (window.titaTracker) {
          window.titaTracker("action").record({
            productName: "邀请同事",
            actionGroup: "PC",
            actionName: "\u666E\u901A\u5458\u5DE5\u81EA\u5EFA\u5E94\u7528\u9080\u8BF7\u540C\u4E8B"
          });
        }
      });
    }
  }, []);

  var handleHashChange = function handleHashChange() {
    setAppCenterVisible(false);
    var hash = window.location.hash.split('?')[0] || '';

    if (hash) {
      var _isUseNewMenu = window.BSGlobal.isUseNewMenu;
      var activeMenu;

      if (!_isUseNewMenu) {
        // 老版本的menu
        activeMenu = menu.find(function (item) {
          var _item$href$split, _item$href$split$, _item$href$split$$spl, _item$href$split$$spl2, _item$href$split$$spl3, _item$href$split2, _item$href$split2$, _item$href$split2$$sp, _item$href$split2$$sp2, _item$href$split2$$sp3;

          return hash.includes(item.href.startsWith("#/") ? (_item$href$split = item.href.split('#/')) === null || _item$href$split === void 0 ? void 0 : (_item$href$split$ = _item$href$split[1]) === null || _item$href$split$ === void 0 ? void 0 : (_item$href$split$$spl = _item$href$split$.split('?')) === null || _item$href$split$$spl === void 0 ? void 0 : (_item$href$split$$spl2 = _item$href$split$$spl[0]) === null || _item$href$split$$spl2 === void 0 ? void 0 : (_item$href$split$$spl3 = _item$href$split$$spl2.split('/')) === null || _item$href$split$$spl3 === void 0 ? void 0 : _item$href$split$$spl3[0] : (_item$href$split2 = item.href.split('#')) === null || _item$href$split2 === void 0 ? void 0 : (_item$href$split2$ = _item$href$split2[1]) === null || _item$href$split2$ === void 0 ? void 0 : (_item$href$split2$$sp = _item$href$split2$.split('?')) === null || _item$href$split2$$sp === void 0 ? void 0 : (_item$href$split2$$sp2 = _item$href$split2$$sp[0]) === null || _item$href$split2$$sp2 === void 0 ? void 0 : (_item$href$split2$$sp3 = _item$href$split2$$sp2.split('/')) === null || _item$href$split2$$sp3 === void 0 ? void 0 : _item$href$split2$$sp3[0]);
        });
      } else {
        //新版本menu
        activeMenu = menu.find(function (item) {
          var _item$href$split3, _item$href$split3$, _item$href$split3$$sp, _item$href$split4, _item$href$split4$, _item$href$split4$$sp;

          return hash.includes(item.href.startsWith("#/") ? (_item$href$split3 = item.href.split('#/')) === null || _item$href$split3 === void 0 ? void 0 : (_item$href$split3$ = _item$href$split3[1]) === null || _item$href$split3$ === void 0 ? void 0 : (_item$href$split3$$sp = _item$href$split3$.split('?')) === null || _item$href$split3$$sp === void 0 ? void 0 : _item$href$split3$$sp[0] : (_item$href$split4 = item.href.split('#')) === null || _item$href$split4 === void 0 ? void 0 : (_item$href$split4$ = _item$href$split4[1]) === null || _item$href$split4$ === void 0 ? void 0 : (_item$href$split4$$sp = _item$href$split4$.split('?')) === null || _item$href$split4$$sp === void 0 ? void 0 : _item$href$split4$$sp[0]);
        }) || menu.find(function (item) {
          var _item$href$split5, _item$href$split5$1$s, _item$href$split5$1$s2, _item$href$split5$1$s3, _item$href$split6, _item$href$split6$, _item$href$split6$$sp, _item$href$split6$$sp2, _item$href$split6$$sp3;

          return hash.includes(item.href.startsWith("#/") ? (_item$href$split5 = item.href.split('#/')) === null || _item$href$split5 === void 0 ? void 0 : (_item$href$split5$1$s = _item$href$split5[1].split('?')) === null || _item$href$split5$1$s === void 0 ? void 0 : (_item$href$split5$1$s2 = _item$href$split5$1$s[0]) === null || _item$href$split5$1$s2 === void 0 ? void 0 : (_item$href$split5$1$s3 = _item$href$split5$1$s2.split('/')) === null || _item$href$split5$1$s3 === void 0 ? void 0 : _item$href$split5$1$s3[0] : (_item$href$split6 = item.href.split('#')) === null || _item$href$split6 === void 0 ? void 0 : (_item$href$split6$ = _item$href$split6[1]) === null || _item$href$split6$ === void 0 ? void 0 : (_item$href$split6$$sp = _item$href$split6$.split('?')) === null || _item$href$split6$$sp === void 0 ? void 0 : (_item$href$split6$$sp2 = _item$href$split6$$sp[0]) === null || _item$href$split6$$sp2 === void 0 ? void 0 : (_item$href$split6$$sp3 = _item$href$split6$$sp2.split('/')) === null || _item$href$split6$$sp3 === void 0 ? void 0 : _item$href$split6$$sp3[0]);
        });
      }

      if (hash.includes('homepage')) {
        setActiveMenuId(99999);
        return;
      }

      if (activeMenu) {
        setActiveMenuId(activeMenu.id);
      } else {
        setActiveMenuId(-1);
      }
    }
  };

  (0, _react.useEffect)(function () {
    handleHashChange();
    window.addEventListener('hashchange', handleHashChange);
    return function () {
      window.removeEventListener('hashchange', handleHashChange);
    };
  }, [menu]);
  (0, _react.useEffect)(function () {
    var _window$BSGlobal$logi;

    if (noshowChangeVersion) return;
    var cacheIsKonw = localStorage.getItem("NewAppCenterGuide_".concat((_window$BSGlobal$logi = window.BSGlobal.loginUserInfo) === null || _window$BSGlobal$logi === void 0 ? void 0 : _window$BSGlobal$logi.Id));

    if (cacheIsKonw) {
      setSummaryGuideVisible(false);
    } else {
      setSummaryGuideVisible(true);
    }
  }, []); // 为了处理应用中心收起时 还没收起时 层级就消失了

  (0, _react.useEffect)(function () {
    if (appCenterVisible) {
      setAppCenterPosition(true);
    } else {
      setTimeout(function () {
        setAppCenterPosition(false);
      }, 500);
    }
  }, [appCenterVisible]);

  var handleCloseInviteGuide = function handleCloseInviteGuide() {
    setInviteVisible(false);

    if (!inviteAuth) {
      setInviteAuth(true);
    }
  };

  var handleCloseSummaryGuide = function handleCloseSummaryGuide() {
    var _BSGlobal$loginUserIn;

    setSummaryGuideVisible(false);
    var loginUserId = (_BSGlobal$loginUserIn = BSGlobal.loginUserInfo) === null || _BSGlobal$loginUserIn === void 0 ? void 0 : _BSGlobal$loginUserIn.Id;
    var cacheIsKonw = localStorage.getItem("NewAppCenterGuide_".concat(loginUserId));

    if (!cacheIsKonw) {
      localStorage.setItem("NewAppCenterGuide_".concat(loginUserId), "".concat(loginUserId));
    }
  };

  var handleCloseVersionGuide = function handleCloseVersionGuide() {
    var _BSGlobal$loginUserIn2;

    setVersionGuideVisible(false);
    var loginUserId = (_BSGlobal$loginUserIn2 = BSGlobal.loginUserInfo) === null || _BSGlobal$loginUserIn2 === void 0 ? void 0 : _BSGlobal$loginUserIn2.Id;
    var cacheIsKonw = localStorage.getItem("VersionGuide_".concat(loginUserId));

    if (!cacheIsKonw) {
      localStorage.setItem("VersionGuide_".concat(loginUserId), "".concat(loginUserId));
    }
  };

  var handlerOnclickCreatOkr = function handlerOnclickCreatOkr() {
    setOkrGuideVisible(false);
    var newNavigation = (0, _bsGlobal.getBSGlobal)('newNavigation');
    var okrMenuCode;
    newNavigation.forEach(function (item) {
      if (item.code === 'okr') {
        okrMenuCode = item.children[0].id;
      }
    });
    window.open('#/okr/manage?relation=1', '_self');
    setActiveMenuId(okrMenuCode);
    setCreateokrModalVisible(true);
  };

  var getBookDemoVersion = function getBookDemoVersion() {
    var _window$BSGlobal$tena;

    var menuVersion = (_window$BSGlobal$tena = window.BSGlobal.tenantAuthentication) === null || _window$BSGlobal$tena === void 0 ? void 0 : _window$BSGlobal$tena.MenuVersion;

    if (menuVersion === _interface.ETrialVersion.OKR) {
      return _bookDemo["default"].DemoType.TryOKR;
    }

    if (menuVersion === _interface.ETrialVersion.Performance) {
      return _bookDemo["default"].DemoType.TryPerformance;
    }

    return _bookDemo["default"].DemoType.UniversalBookDemo;
  };

  var asyncOpenBookDemoFun = function asyncOpenBookDemoFun() {
    var _window$BSGlobal$logi2;

    setTimeout(function () {
      setBookDemoVisible(true);
    }, 1000 * 30);
    var cacheIsKonw = localStorage.getItem("VersionGuide_".concat((_window$BSGlobal$logi2 = window.BSGlobal.loginUserInfo) === null || _window$BSGlobal$logi2 === void 0 ? void 0 : _window$BSGlobal$logi2.Id));

    if (cacheIsKonw) {
      setVersionGuideVisible(false);
    } else {
      setVersionGuideVisible(true);
    }
  };

  var renderInviteContent = (0, _react.useCallback)(function () {
    if (!inviteVisible) return;
    var title = (0, _getLocale.getLocale)('TopMenu_tips_ManageCompany');
    if (!inviteAuth) return /*#__PURE__*/_react["default"].createElement("div", {
      className: "".concat(preCls, "__invite-guide-content")
    }, /*#__PURE__*/_react["default"].createElement("img", {
      src: _inviteTanhao["default"],
      alt: "",
      className: "".concat(preCls, "__invite-guide-content-waring")
    }), /*#__PURE__*/_react["default"].createElement("div", {
      className: "".concat(preCls, "__invite-guide-content-right")
    }, /*#__PURE__*/_react["default"].createElement("div", {
      className: "".concat(preCls, "__invite-guide-content-title")
    }, title)));
    title = showMangeAdd ? (0, _getLocale.getLocale)('TopMenu_Title_ManageCompany') : (0, _getLocale.getLocale)('TopMenu_Title_InviteColleagues');
    var subtitle = (0, _getLocale.getLocale)('TopMenu_Content_InviteColleagues');
    return /*#__PURE__*/_react["default"].createElement("div", {
      className: "".concat(preCls, "__invite-guide-content")
    }, /*#__PURE__*/_react["default"].createElement("img", {
      src: _invitePoint["default"],
      alt: "",
      className: "".concat(preCls, "__invite-guide-content-point")
    }), /*#__PURE__*/_react["default"].createElement("div", {
      className: "".concat(preCls, "__invite-guide-content-right")
    }, /*#__PURE__*/_react["default"].createElement("div", {
      className: "".concat(preCls, "__invite-guide-content-title")
    }, title), /*#__PURE__*/_react["default"].createElement("div", {
      className: "".concat(preCls, "__invite-guide-content-subTitle")
    }, subtitle)));
  }, [inviteAuth]);

  var isHasOkr = function isHasOkr() {
    //判断是否安装了OKR
    var okrIndex = (0, _bsGlobal.getBSGlobal)('WebHead').AppHead.findIndex(function (item) {
      return item.AppId === '113';
    });
    var newNavigation = (0, _bsGlobal.getBSGlobal)('newNavigation');
    return newNavigation.findIndex(function (v) {
      return v.appId === 113;
    }) !== -1 && okrIndex;
  };

  (0, _react.useEffect)(function () {
    var version = (0, _bsGlobal.getBSGlobal)('tenantAuthentication').Version;
    if (localStorage.getItem("cycle_setting_stop_show".concat((0, _bsGlobal.getUserInfo)().Id)) === 'true') return;
    localStorage.removeItem('OKR_CYCLE_SETTING');
    (0, _request2.getCycleSetting)().then(function (res) {
      localStorage.setItem('OKR_CYCLE_SETTING', JSON.stringify(res || {}));
      var hasSetting = res.hasSetting;

      if (version === 1 && isHasOkr() && !hasSetting) {
        setOkrGuideVisible(true);
      }
    });
  }, []);
  return /*#__PURE__*/_react["default"].createElement("div", {
    className: (0, _classnames["default"])(preCls, _defineProperty({}, "".concat(preCls, "--position"), appCenterPosition), _defineProperty({}, "".concat(preCls, "-no-shadow"), appCenterVisible))
  }, /*#__PURE__*/_react["default"].createElement(_okrGuide["default"], {
    visible: okrGuideVisible,
    handlerOnclickCreatOkr: handlerOnclickCreatOkr
  }), /*#__PURE__*/_react["default"].createElement(_createOkrModal["default"], {
    visible: createOkrModalVisible,
    asyncOpenBookDemoFun: asyncOpenBookDemoFun
  }), /*#__PURE__*/_react["default"].createElement(_bookDemo["default"].BookDemoPC, {
    visible: bookDemoVisible,
    source: bookDemoSource,
    type: getBookDemoVersion()
  }), /*#__PURE__*/_react["default"].createElement("a", {
    className: "".concat(preCls, "__left"),
    href: "#dynamic"
  }, /*#__PURE__*/_react["default"].createElement("img", {
    alt: "logo",
    src: Logo,
    className: "".concat(preCls, "__left-logo")
  })), isUseNewMenu && /*#__PURE__*/_react["default"].createElement(_guideTip["default"], {
    visible: summaryGuideVisible,
    content: /*#__PURE__*/_react["default"].createElement("span", {
      className: "".concat(preCls, "__app-guide-content")
    }, "\uD83D\uDC46\u70B9\u51FB\u8FD9\u91CC\u53D1\u73B0\u66F4\u591A\u5E94\u7528"),
    type: "button",
    popupPlacement: "bottom",
    classnames: "".concat(preCls, "__app-guide"),
    onClickClose: handleCloseSummaryGuide,
    width: 197
  }, /*#__PURE__*/_react["default"].createElement("span", {
    className: (0, _classnames["default"])("".concat(preCls, "__left-app-center"), 'document-mouse-event-ignore', _defineProperty({}, "".concat(preCls, "__left-app-center--active"), appCenterVisible)),
    onClick: function onClick() {
      return setAppCenterVisible(!appCenterVisible);
    }
  })), /*#__PURE__*/_react["default"].createElement("div", {
    className: (0, _classnames["default"])("".concat(preCls, "__line"))
  }), /*#__PURE__*/_react["default"].createElement("div", {
    className: (0, _classnames["default"])("".concat(preCls, "__middle"))
  }, /*#__PURE__*/_react["default"].createElement(_menu["default"], {
    menus: menu,
    activeMenuId: activeMenuId
  })), showWxInvite && (staffCount > 3 ? /*#__PURE__*/_react["default"].createElement(_tooltip["default"], {
    overlay: (0, _getLocale.getLocale)('TopMenu_tips_InvitColleagues'),
    placement: "bottom",
    align: {
      offset: [0, 5]
    }
  }, /*#__PURE__*/_react["default"].createElement("div", {
    className: "".concat(preCls, "__invite"),
    onClick: openWxInvite
  }, /*#__PURE__*/_react["default"].createElement("i", {
    className: (0, _classnames["default"])('tu-icon-add-people', "".concat(preCls, "__invite-icon"))
  }))) : /*#__PURE__*/_react["default"].createElement(_guideTip["default"], {
    visible: inviteVisible,
    content: renderInviteContent(),
    type: inviteAuth ? 'default' : 'button',
    popupPlacement: "bottom",
    classnames: inviteAuth ? "".concat(preCls, "__invite-guide") : '',
    onClickClose: handleCloseInviteGuide,
    popupAlign: {
      offset: [0, 5]
    },
    zIndex: 1000,
    width: 308
  }, /*#__PURE__*/_react["default"].createElement("div", {
    className: "".concat(preCls, "__invite"),
    onClick: openWxInvite
  }, /*#__PURE__*/_react["default"].createElement("i", {
    className: (0, _classnames["default"])('tu-icon-add-people', "".concat(preCls, "__invite-icon"))
  })))), showMangeAdd && (staffCount > 3 && inviteAuth ? /*#__PURE__*/_react["default"].createElement(_tooltip["default"], {
    overlay: (0, _getLocale.getLocale)('TopMenu_tips_AddEmployees'),
    placement: "bottom",
    align: {
      offset: [0, 5]
    }
  }, /*#__PURE__*/_react["default"].createElement("div", {
    className: "".concat(preCls, "__invite"),
    onClick: manageAdd
  }, /*#__PURE__*/_react["default"].createElement("i", {
    className: (0, _classnames["default"])('tu-icon-add-people', "".concat(preCls, "__invite-icon"))
  }))) : /*#__PURE__*/_react["default"].createElement(_guideTip["default"], {
    visible: inviteVisible,
    content: renderInviteContent(),
    type: inviteAuth ? 'default' : 'button',
    popupPlacement: "bottom",
    classnames: inviteAuth ? "".concat(preCls, "__invite-guide") : '',
    onClickClose: handleCloseInviteGuide,
    popupAlign: {
      offset: [0, 5]
    },
    zIndex: 1000,
    width: 308
  }, /*#__PURE__*/_react["default"].createElement("div", {
    className: "".concat(preCls, "__invite"),
    onClick: manageAdd
  }, /*#__PURE__*/_react["default"].createElement("i", {
    className: (0, _classnames["default"])('tu-icon-add-people', "".concat(preCls, "__invite-icon"))
  })))), hasOKRApp && /*#__PURE__*/_react["default"].createElement("div", {
    className: (0, _classnames["default"])("".concat(preCls, "__left-home"), (_classNames4 = {}, _defineProperty(_classNames4, "".concat(preCls, "__left-home--active"), activeMenuId === 99999), _defineProperty(_classNames4, "".concat(preCls, "__left-home--hover"), hasOKRApp), _classNames4))
  }, /*#__PURE__*/_react["default"].createElement("a", {
    href: "#homepage"
  }, /*#__PURE__*/_react["default"].createElement("img", {
    alt: "home-img",
    src: _home["default"],
    className: "".concat(preCls, "__left-home-img")
  }))), /*#__PURE__*/_react["default"].createElement("div", {
    className: "".concat(preCls, "__msg")
  }, /*#__PURE__*/_react["default"].createElement(_userMessage["default"], null)), versionInfo.Version === 1 && !noshowChangeVersion && /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(_guideTip["default"], {
    visible: versionGuideVisible,
    content: /*#__PURE__*/_react["default"].createElement("span", {
      className: "".concat(preCls, "__app-guide-version-content")
    }, "\uD83D\uDC46\u70B9\u51FB\u8FD9\u91CC\u5207\u6362\u7248\u672C"),
    type: "button",
    popupPlacement: "bottom",
    classnames: "".concat(preCls, "__app-guide"),
    onClickClose: handleCloseVersionGuide,
    width: 180
  }, /*#__PURE__*/_react["default"].createElement(_version["default"], null))), /*#__PURE__*/_react["default"].createElement("div", {
    className: "".concat(preCls, "__photo")
  }, /*#__PURE__*/_react["default"].createElement(_userOwnMenu["default"], null)), isUseNewMenu && /*#__PURE__*/_react["default"].createElement(_appCenter["default"], {
    appCenterVisible: appCenterVisible,
    closeAppCenter: function closeAppCenter() {
      return setAppCenterVisible(false);
    },
    setMenu: setMenu
  }));
};

var _default = NavTop; // @ts-ignore

exports["default"] = _default;
NavTop.useGlobalValue = _useGlobalValue["default"];