"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
Object.defineProperty(exports, "RenderTarget", {
    enumerable: true,
    get: function() {
        return RenderTarget;
    }
});
const _react = /*#__PURE__*/ _interop_require_default(require("react"));
function _interop_require_default(obj) {
    return obj && obj.__esModule ? obj : {
        default: obj
    };
}
const RenderTarget = ({ multiselect, value, opened, renderTarget, valueToItemMap, inputWrapperRef })=>{
    let content;
    if (multiselect) {
        const selectedItems = value.map((itemValue)=>valueToItemMap.get(itemValue)).filter((item)=>Boolean(item));
        content = renderTarget(selectedItems, opened);
    } else {
        const selectedItem = valueToItemMap.get(value) ?? null;
        content = renderTarget(selectedItem, opened);
    }
    return /*#__PURE__*/ _react.default.createElement("div", {
        ref: inputWrapperRef
    }, content);
};
