"use strict";

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

var _menus = require("./menus");

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }

function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }

var _default = /*#__PURE__*/function () {
  function _default(history) {
    _classCallCheck(this, _default);

    this.history = null;
    this.history = history;
  }

  _createClass(_default, [{
    key: "highlight",
    value: function highlight(cb) {
      if (this.isALLSummary()) {
        cb(_menus.PAGE_SUMMARY_ALl);
      } else if (this.isMySummary()) {
        cb(_menus.PAGE_SUMMARY_MY);
      } else if (this.isSummaryChart()) {
        cb(_menus.PAGE_SUMMARY_CHART);
      } else if (this.isShare()) {
        cb(_menus.PAGE_SUMMARY_SHARE);
      } else if (this.isTongji()) {
        cb(_menus.PAGE_SUMMARY_TONGJI);
      } else if (this.isSubordinatesSummary()) {
        cb(_menus.PAGE_SUMMARY_SUBORDINATE);
      } else if (this.isSummaryDashboard()) {
        cb(_menus.PAGE_SUMMARY_DASHBOARD);
      } else if (this.isSummaryTemplate()) {
        cb(_menus.PAGE_SUMMARY_TEMPLATE);
      }

      return null;
    }
  }, {
    key: "isALLSummary",
    value: function isALLSummary() {
      var pathname = this.history.location.pathname;
      return pathname.match(/summary\/all/);
    }
  }, {
    key: "isMySummary",
    value: function isMySummary() {
      var pathname = this.history.location.pathname;
      return pathname.match(/summary\/my/);
    }
  }, {
    key: "isSubordinatesSummary",
    value: function isSubordinatesSummary() {
      var pathname = this.history.location.pathname;
      return pathname.match(/summary\/subordinates/);
    }
  }, {
    key: "isShare",
    value: function isShare() {
      var pathname = this.history.location.pathname;
      return pathname.match(/summary\/share/);
    }
  }, {
    key: "isTongji",
    value: function isTongji() {
      var pathname = this.history.location.pathname;
      return pathname.match(/summary\/tongji/);
    }
  }, {
    key: "isSummaryChart",
    value: function isSummaryChart() {
      var pathname = this.history.location.pathname;
      return pathname.match(/summary\/chart/);
    }
  }, {
    key: "isSummaryDashboard",
    value: function isSummaryDashboard() {
      var pathname = this.history.location.pathname;
      return pathname.match(/summary\/dashboard/);
    }
  }, {
    key: "isSummaryTemplate",
    value: function isSummaryTemplate() {
      var pathname = this.history.location.pathname;
      return pathname.match(/summary\/template\/page/);
    }
  }]);

  return _default;
}();

exports["default"] = _default;