"use strict";

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

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

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

var userId = (0, _bsGlobal.getUserInfo)().Id;
var apiServer = (0, _bsGlobal.getBSGlobal)("apiPath");
var i18nInfo = (0, _bsGlobal.getBSGlobal)("I18NInfo");
var tm = (0, _bsGlobal.getBSGlobal)("tm");
var isTestCompanyManageRule = /gift/g.test(apiServer);

var getOwnhandle = function getOwnhandle() {
  return [{
    id: "ownHome",
    icon: "tu-icon-myhome",
    title: (0, _getLocale.getLocale)("Per_Menu_Perinfo"),
    objUrl: "".concat(apiServer, "/u/").concat(userId, "/Home/#user-info"),
    otherInfo: {}
  }, {
    id: "ownSet",
    icon: "tu-icon-APP-shezhi",
    title: (0, _getLocale.getLocale)("Per_Menu_MySettings"),
    objUrl: "".concat(apiServer, "/u/").concat(userId, "/Home/#setting"),
    otherInfo: {}
  }];
};

var getExit = function getExit() {
  return [{
    id: "Logout",
    icon: "tu-icon-tuichu",
    title: (0, _getLocale.getLocale)("Per_Menu_Logout"),
    objUrl: "".concat(apiServer, "/Account/Logout"),
    otherInfo: {}
  }];
};

var getLimit = function getLimit() {
  return [{
    id: "manage",
    icon: "tu-icon-myqyht",
    title: (0, _getLocale.getLocale)("Per_Menu_Admin"),
    objUrl: "".concat(apiServer, "/").concat(userId, "/tmHome"),
    otherInfo: {}
  }, {
    id: "open",
    icon: "tu-icon-my-gjgn",
    title: (0, _getLocale.getLocale)("Per_Menu_AdvancedFeatures"),
    objUrl: "".concat(apiServer, "/").concat(userId, "/tmHome#?iTalentFrameType=iframe&iTalentFrame=").concat(apiServer, "/").concat(userId, "/indexV2#/advancedSettings"),
    otherInfo: {}
  }, {
    id: "role",
    icon: "tu-icon-gongsi",
    title: (0, _getLocale.getLocale)("Per_Menu_ManRegu"),
    objUrl: "".concat(apiServer, "/u/").concat(userId, "/Home#/enterprise/manage?reactRouterName=okr"),
    otherInfo: {}
  }];
};

var getLang = function getLang() {
  return [{
    id: "i18n",
    icon: "tu-icon-yuyan",
    title: (0, _getLocale.getLocale)("Per_Menu_language"),
    objUrl: "",
    otherInfo: {
      lang: i18nInfo.I18NUserLang
    }
  }];
};

var getOwnSet = function getOwnSet() {
  var newOwnSet = [];
  newOwnSet.push(getOwnhandle());
  var role = (0, _bsGlobal.getUserInfo)().Role;

  if (role === 2 || role === 4) {
    newOwnSet.push(getLimit());
  }

  if (i18nInfo && i18nInfo.I18NOpen === "true") {
    newOwnSet.push(getLang());
  }

  newOwnSet.push(getExit());
  return newOwnSet;
};

exports.getOwnSet = getOwnSet;