"use strict";

exports.__esModule = true;
exports.default = exports.Logo = exports.EnhancedMenuItem = exports.MenuToggle = exports.Bar = void 0;

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

var _reactRedux = require("react-redux");

var _styledComponents = _interopRequireWildcard(require("styled-components"));

var _reactRouterDom = require("react-router-dom");

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

var _navigation = require("../../selectors/navigation");

var _MenuItem = _interopRequireDefault(require("./MenuItem"));

var _excluded = ["id"];

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 _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

(function () {
  var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;
  enterModule && enterModule(module);
})();

(function () {
  var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;
  enterModule && enterModule(module);
})();

function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }

function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }

function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }

var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
  return a;
};

var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
  return a;
};

var Bar = _styledComponents.default.div.withConfig({
  displayName: "Sidebar__Bar",
  componentId: "sc-9mojly-0"
})(["box-sizing:border-box;padding-top:60px;height:calc(100% - 40px);width:200px;display:flex;flex-direction:column;justify-content:flex-start;color:", ";"], (0, _utils.getThemeProp)(["colors", "textMedium"], "#999999"));

exports.Bar = Bar;
var MenuToggle = (0, _styledComponents.withTheme)(function (_ref) {
  var open = _ref.open,
      toggle = _ref.toggle,
      theme = _ref.theme;
  return /*#__PURE__*/_react.default.createElement(_MenuItem.default, {
    id: "sidebarMenuToggle",
    menuToggle: true,
    open: open,
    icon: (open ? (0, _utils.getThemeProp)(["icons", "sidebarOpen"], "layers") : (0, _utils.getThemeProp)(["icons", "sidebarClosed"], "menu"))({
      theme: theme
    }),
    onClick: toggle
  });
});
exports.MenuToggle = MenuToggle;

var useEnhancement = function useEnhancement(id) {
  var location = (0, _reactRouterDom.useLocation)();
  var prependHref = (0, _reactRedux.useSelector)(_navigation.selectPrependHrefConfig)(id);
  return {
    href: "".concat(prependHref).concat(id),
    active: location.pathname.startsWith("".concat(prependHref).concat(id)),
    id: id
  };
};

__signature__(useEnhancement, "useLocation{location}\nuseSelector{}", function () {
  return [_reactRouterDom.useLocation, _reactRedux.useSelector];
});

__signature__(useEnhancement, "useLocation{location}\nuseSelector{}", function () {
  return [_reactRouterDom.useLocation, _reactRedux.useSelector];
});

var EnhancedMenuItem = function EnhancedMenuItem(_ref2) {
  var id = _ref2.id,
      props = _objectWithoutProperties(_ref2, _excluded);

  return /*#__PURE__*/_react.default.createElement(_MenuItem.default, _extends({}, props, useEnhancement(id)));
};

exports.EnhancedMenuItem = EnhancedMenuItem;

__signature__(EnhancedMenuItem, "useEnhancement{}", function () {
  return [useEnhancement];
});

__signature__(EnhancedMenuItem, "useEnhancement{}", function () {
  return [useEnhancement];
});

var LogoSvg = _styledComponents.default.svg.withConfig({
  displayName: "Sidebar__LogoSvg",
  componentId: "sc-9mojly-1"
})(["flex:0 0 auto;margin:auto 12.5px 7px;height:25px;width:25px;fill-rule:evenodd;clip-rule:evenodd;fill:#666666;"]);

var Logo = function Logo() {
  return /*#__PURE__*/_react.default.createElement(LogoSvg, null, /*#__PURE__*/_react.default.createElement("path", {
    id: "orckestra-logo",
    d: "M10.3,3.8c-1.7,0-3.5,0.7-4.7,1.9L2.8,3c1.9-1.9,4.6-3,7.5-3c0.6,0,1.3,0.1,1.9,0.2 l-0.9,3.7C11,3.8,10.6,3.8,10.3,3.8L10.3,3.8z M16.1,7.5c-1.4-1.4-3.2-2.1-5.1-2.1c-2,0-3.9,0.8-5.3,2.3c-1.2,1.2-1.9,2.8-2,4.5H0 c0.1-2.7,1-4.9,3-7c0.2-0.2,0.5-0.5,0.7-0.7l1.8,1.8l0.1-0.1c1.2-1.2,2.9-1.9,4.6-1.9c0.4,0,0.8,0,1.2,0.1l0.2,0l0.6-2.5 c2.3,0.3,4.3,1.2,6,2.8l0.3,0.3c2,1.9,3.1,4.5,3.3,7.3h-3.6C18.1,10.4,17.3,8.7,16.1,7.5L16.1,7.5z M19.8,3.3 c2.9,2.8,4.4,6.8,4,10.8c-0.3,2.8-1.5,5.4-3.4,7.6L17,19.1c0.4-0.4,0.7-0.8,1-1.2c0.9-1.2,1.4-2.7,1.6-4.2c0-0.4,0.1-0.7,0-1.1h2.7 l0-0.2c-0.1-3-1.4-5.7-3.5-7.8l-0.2-0.2L19.8,3.3L19.8,3.3z M16.5,18.9l-0.2,0.2l2.6,2c-2.3,2.6-5.6,4-9.1,3.8l0-4 c0.2,0,0.4,0,0.6,0h0c2.6,0,5-1.4,6.4-3.6l0.7,0.5C17.2,18.2,16.9,18.6,16.5,18.9L16.5,18.9z"
  }));
};

exports.Logo = Logo;

var Sidebar = function Sidebar(_ref3) {
  var open = _ref3.open,
      toggle = _ref3.toggle,
      _ref3$modules = _ref3.modules,
      modules = _ref3$modules === void 0 ? [] : _ref3$modules,
      _ref3$activeModules = _ref3.activeModules,
      activeModules = _ref3$activeModules === void 0 ? [] : _ref3$activeModules;
  return /*#__PURE__*/_react.default.createElement(Bar, {
    open: open
  }, /*#__PURE__*/_react.default.createElement(MenuToggle, {
    open: open,
    toggle: toggle
  }), modules.map(function (item) {
    return /*#__PURE__*/_react.default.createElement(EnhancedMenuItem, _extends({
      key: item.id,
      title: item.label
    }, item, {
      open: open,
      alert: activeModules[item.id] || false
    }));
  }), /*#__PURE__*/_react.default.createElement(Logo, null));
};

var _default = Sidebar;
var _default2 = _default;
var _default3 = _default2;
exports.default = _default3;
;

(function () {
  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;

  if (!reactHotLoader) {
    return;
  }

  reactHotLoader.register(Bar, "Bar", "/home/vsts/work/1/s/src/components/AppFrame/Sidebar.js");
  reactHotLoader.register(MenuToggle, "MenuToggle", "/home/vsts/work/1/s/src/components/AppFrame/Sidebar.js");
  reactHotLoader.register(useEnhancement, "useEnhancement", "/home/vsts/work/1/s/src/components/AppFrame/Sidebar.js");
  reactHotLoader.register(EnhancedMenuItem, "EnhancedMenuItem", "/home/vsts/work/1/s/src/components/AppFrame/Sidebar.js");
  reactHotLoader.register(LogoSvg, "LogoSvg", "/home/vsts/work/1/s/src/components/AppFrame/Sidebar.js");
  reactHotLoader.register(Logo, "Logo", "/home/vsts/work/1/s/src/components/AppFrame/Sidebar.js");
  reactHotLoader.register(Sidebar, "Sidebar", "/home/vsts/work/1/s/src/components/AppFrame/Sidebar.js");
  reactHotLoader.register(_default, "default", "/home/vsts/work/1/s/src/components/AppFrame/Sidebar.js");
})();

;

(function () {
  var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;
  leaveModule && leaveModule(module);
})();

;

(function () {
  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;

  if (!reactHotLoader) {
    return;
  }

  reactHotLoader.register(Bar, "Bar", "/home/vsts/work/1/s/src/components/AppFrame/Sidebar.js");
  reactHotLoader.register(MenuToggle, "MenuToggle", "/home/vsts/work/1/s/src/components/AppFrame/Sidebar.js");
  reactHotLoader.register(useEnhancement, "useEnhancement", "/home/vsts/work/1/s/src/components/AppFrame/Sidebar.js");
  reactHotLoader.register(EnhancedMenuItem, "EnhancedMenuItem", "/home/vsts/work/1/s/src/components/AppFrame/Sidebar.js");
  reactHotLoader.register(LogoSvg, "LogoSvg", "/home/vsts/work/1/s/src/components/AppFrame/Sidebar.js");
  reactHotLoader.register(Logo, "Logo", "/home/vsts/work/1/s/src/components/AppFrame/Sidebar.js");
  reactHotLoader.register(Sidebar, "Sidebar", "/home/vsts/work/1/s/src/components/AppFrame/Sidebar.js");
  reactHotLoader.register(_default2, "default", "/home/vsts/work/1/s/src/components/AppFrame/Sidebar.js");
})();

;

(function () {
  var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;
  leaveModule && leaveModule(module);
})();