"use strict";

exports.__esModule = true;
exports.default = exports.Selector = exports.SelectorPanel = exports.SearchInput = exports.InputBox = exports.Wrapper = void 0;

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

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

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

var _Input = _interopRequireDefault(require("../Input"));

var _Treeview = _interopRequireDefault(require("../Treeview"));

var _ScopeNode = _interopRequireDefault(require("./ScopeNode"));

var _Sidepanel = _interopRequireDefault(require("../Sidepanel"));

var _withClickOutside = _interopRequireDefault(require("../../hocs/withClickOutside"));

var _reactIntl = require("react-intl");

var _sharedMessages = _interopRequireDefault(require("./../../sharedMessages"));

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);
})();

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 Wrapper = (0, _withClickOutside.default)(_styledComponents.default.div.withConfig({
  displayName: "Selector__Wrapper",
  componentId: "sc-c95w8s-0"
})(["height:100%;width:100%;user-select:none;display:flex;flex-direction:column;"]));
exports.Wrapper = Wrapper;

var InputBox = _styledComponents.default.div.withConfig({
  displayName: "Selector__InputBox",
  componentId: "sc-c95w8s-1"
})(["border-bottom:1px solid #666;"]);

exports.InputBox = InputBox;
var SearchInput = (0, _styledComponents.default)(_Input.default).withConfig({
  displayName: "Selector__SearchInput",
  componentId: "sc-c95w8s-2"
})(["background-color:transparent;border-color:", ";color:", ";width:calc(100% - 40px);margin:20px;font-size:14px;"], (0, _utils.getThemeProp)(["colors", "border"], "#999999"), (0, _utils.getThemeProp)(["colors", "textMedium"], "#999999"));
exports.SearchInput = SearchInput;
var SelectorPanel = (0, _styledComponents.default)(_Sidepanel.default).withConfig({
  displayName: "Selector__SelectorPanel",
  componentId: "sc-c95w8s-3"
})(["top:90px;background-color:", ";color:#fff;z-index:1000;"], (0, _utils.getThemeProp)(["colors", "bgDark"], "#333333"));
exports.SelectorPanel = SelectorPanel;

var Selector = function Selector(_ref) {
  var name = _ref.name,
      show = _ref.show,
      reset = _ref.reset,
      getScope = _ref.getScope,
      currentScope = _ref.currentScope,
      defaultNodeState = _ref.defaultNodeState,
      filter = _ref.filter,
      updateFilter = _ref.updateFilter;

  var _useIntl = (0, _reactIntl.useIntl)(),
      formatMessage = _useIntl.formatMessage;

  return /*#__PURE__*/_react.default.createElement(SelectorPanel, {
    in: show,
    width: "27vw",
    timeout: 300
  }, /*#__PURE__*/_react.default.createElement(Wrapper, {
    onClickOutside: reset
  }, /*#__PURE__*/_react.default.createElement(InputBox, null, /*#__PURE__*/_react.default.createElement(SearchInput, {
    placeholder: formatMessage(_sharedMessages.default.scopeFilterPlaceholder),
    value: filter,
    onChange: updateFilter
  })), /*#__PURE__*/_react.default.createElement(_Treeview.default, {
    name: name,
    Content: _ScopeNode.default,
    rootId: "Global",
    getNode: getScope,
    selectedNodeId: currentScope && currentScope.id || null,
    openAll: !!filter,
    closeSelector: reset,
    dark: true,
    defaultNodeState: defaultNodeState
  })));
};

exports.Selector = Selector;

__signature__(Selector, "useIntl{{ formatMessage }}", function () {
  return [_reactIntl.useIntl];
});

__signature__(Selector, "useIntl{{ formatMessage }}", function () {
  return [_reactIntl.useIntl];
});

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

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

  if (!reactHotLoader) {
    return;
  }

  reactHotLoader.register(Wrapper, "Wrapper", "/home/vsts/work/1/s/src/components/Scope/Selector.js");
  reactHotLoader.register(InputBox, "InputBox", "/home/vsts/work/1/s/src/components/Scope/Selector.js");
  reactHotLoader.register(SearchInput, "SearchInput", "/home/vsts/work/1/s/src/components/Scope/Selector.js");
  reactHotLoader.register(SelectorPanel, "SelectorPanel", "/home/vsts/work/1/s/src/components/Scope/Selector.js");
  reactHotLoader.register(Selector, "Selector", "/home/vsts/work/1/s/src/components/Scope/Selector.js");
  reactHotLoader.register(_default, "default", "/home/vsts/work/1/s/src/components/Scope/Selector.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(Wrapper, "Wrapper", "/home/vsts/work/1/s/src/components/Scope/Selector.js");
  reactHotLoader.register(InputBox, "InputBox", "/home/vsts/work/1/s/src/components/Scope/Selector.js");
  reactHotLoader.register(SearchInput, "SearchInput", "/home/vsts/work/1/s/src/components/Scope/Selector.js");
  reactHotLoader.register(SelectorPanel, "SelectorPanel", "/home/vsts/work/1/s/src/components/Scope/Selector.js");
  reactHotLoader.register(Selector, "Selector", "/home/vsts/work/1/s/src/components/Scope/Selector.js");
  reactHotLoader.register(_default2, "default", "/home/vsts/work/1/s/src/components/Scope/Selector.js");
})();

;

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