import React__default from 'react';

var RenderTarget = function RenderTarget(_ref) {
  var multiselect = _ref.multiselect,
    value = _ref.value,
    opened = _ref.opened,
    renderTarget = _ref.renderTarget,
    valueToItemMap = _ref.valueToItemMap,
    inputWrapperRef = _ref.inputWrapperRef;
  var content;
  if (multiselect) {
    var selectedItems = value.map(function (itemValue) {
      return valueToItemMap.get(itemValue);
    }).filter(function (item) {
      return Boolean(item);
    });
    content = renderTarget(selectedItems, opened);
  } else {
    var _valueToItemMap$get;
    var selectedItem = (_valueToItemMap$get = valueToItemMap.get(value)) !== null && _valueToItemMap$get !== void 0 ? _valueToItemMap$get : null;
    content = renderTarget(selectedItem, opened);
  }
  return /*#__PURE__*/React__default.createElement("div", {
    ref: inputWrapperRef
  }, content);
};

export { RenderTarget };
