import _objectSpread from "@babel/runtime/helpers/objectSpread2";
import React from "react";
import styled from "styled-components";
import { connect } from "../../redux";
import { getPlugins } from "../../../plugins";
import { getUi } from "../../selectors";
import { css } from 'emotion';
var settingStyle = /*#__PURE__*/css({
  width: '18rem',
  '> div': {
    height: '100%',
    '> .ant-tabs-content': {
      height: 'calc(100% - 44px)',
      '> div': {
        overflowY: 'auto',
        height: '100%'
      }
    }
  }
}, "label:settingStyle;");
var SettingDiv = /*#__PURE__*/React.memo( /*#__PURE__*/styled("div", {
  target: "e157d5bc0",
  label: "SettingDiv"
})(function (_ref) {
  var pluginBar = _ref.pluginBar;
  var style = {
    transition: 'width .20s',
    '> div': {
      height: '100%',
      '> .ant-tabs-content': {
        height: 'calc(100% - 44px)',
        '> div': {
          overflowY: 'auto',
          height: '100%'
        }
      }
    }
  };
  style.width = pluginBar ? '18rem' : 0;
  return style;
}));

var Setting = function Setting(props) {
  var isHelp = props.isHelp;
  var plugins = getPlugins("pb-editor-bar");
  var pluginBar = null;

  for (var i = 0; i < plugins.length; i++) {
    var plugin = plugins[i];
    var activeElement = plugin.shouldRender(props);

    if (activeElement) {
      pluginBar = plugin.render({
        activeElement: activeElement,
        isHelp: isHelp
      });
      break;
    }
  }

  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(SettingDiv, {
    className: "w-full h-full relative webiny-ui-element-setting-bar",
    pluginBar: pluginBar
  }, pluginBar ? pluginBar : /*#__PURE__*/React.createElement("div", {
    className: "pagebuilder-property-header"
  })));
};

var stateToProps = function stateToProps(state) {
  return _objectSpread({}, getUi(state));
};

export default connect(stateToProps)( /*#__PURE__*/React.memo(Setting));
//# sourceMappingURL=Setting.js.map