'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var React = require('react');

function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }

var React__default = /*#__PURE__*/_interopDefault(React);

var RenderTarget = function RenderTarget(_ref) {
  var multiselect = _ref.multiselect,
    value = _ref.value,
    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);
  } else {
    var selectedItem = valueToItemMap.get(value);
    content = selectedItem ? renderTarget(selectedItem) : null;
  }
  return /*#__PURE__*/React__default.default.createElement("div", {
    ref: inputWrapperRef
  }, content);
};

exports.RenderTarget = RenderTarget;
