"use strict";

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

var _configProvider = _interopRequireDefault(require("../config-provider"));

var _select = _interopRequireDefault(require("./select"));

var _autoComplete = _interopRequireDefault(require("./auto-complete"));

var _option = _interopRequireDefault(require("./option"));

var _optionGroup = _interopRequireDefault(require("./option-group"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

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

_select["default"].AutoComplete = _configProvider["default"].config(_autoComplete["default"], {
  componentName: 'Select'
});
_select["default"].Option = _option["default"];
_select["default"].OptionGroup = _optionGroup["default"]; // compatible with 0.x version

/* istanbul ignore next */

function _transform(props, deprecated) {
  var shape = props.shape,
      container = props.container,
      multiple = props.multiple,
      filterBy = props.filterBy,
      overlay = props.overlay,
      safeNode = props.safeNode,
      noFoundContent = props.noFoundContent,
      others = _objectWithoutProperties(props, ["shape", "container", "multiple", "filterBy", "overlay", "safeNode", "noFoundContent"]);

  var newprops = others;

  if (shape === 'arrow-only') {
    deprecated('shape=arrow-only', 'hasBorder=false', 'Select');
    newprops.hasBorder = false;
  }

  if (container) {
    deprecated('container', 'popupContainer', 'Select');
    newprops.popupContainer = container;
  }

  if (multiple) {
    deprecated('multiple', 'mode=multiple', 'Select');
    newprops.mode = 'multiple';
  }

  if (filterBy) {
    deprecated('filterBy', 'filter', 'Select');
    newprops.filter = filterBy;
  }

  if (overlay) {
    deprecated('overlay', 'popupContent', 'Select');
    newprops.popupContent = overlay;
    newprops.autoWidth = false;
  }

  if (noFoundContent) {
    deprecated('noFoundContent', 'notFoundContent', 'Select');
    newprops.notFoundContent = noFoundContent;
  }

  if (safeNode) {
    deprecated('safeNode', 'popupProps={safeNode}', 'Select');
    newprops.popupProps = {
      safeNode: safeNode
    };
  }

  return newprops;
} // compatible with 0.x version: Select.Combobox


_select["default"].Combobox = _configProvider["default"].config(_select["default"], {
  transform:
  /* istanbul ignore next */
  function transform(props, deprecated) {
    deprecated('Select.Combobox', '<Select showSearch={true}/>', 'Select');

    var newprops = _transform(props, deprecated);

    if (props.onInputUpdate) {
      newprops.onSearch = props.onInputUpdate;
      newprops.showSearch = true;
    }

    return newprops;
  }
});

var _default = _configProvider["default"].config(_select["default"], {
  transform: _transform,
  exportNames: ['focusInput', 'handleSearchClear']
});

exports["default"] = _default;