"use strict";
var __webpack_require__ = {};
(()=>{
    __webpack_require__.d = (exports1, definition)=>{
        for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
            enumerable: true,
            get: definition[key]
        });
    };
})();
(()=>{
    __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
})();
(()=>{
    __webpack_require__.r = (exports1)=>{
        if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
            value: 'Module'
        });
        Object.defineProperty(exports1, '__esModule', {
            value: true
        });
    };
})();
var __webpack_exports__ = {};
__webpack_require__.r(__webpack_exports__);
__webpack_require__.d(__webpack_exports__, {
    renderFacetValue: ()=>renderFacetValue
});
const field_utils_cjs_namespaceObject = require("../../../../utils/field-utils.cjs");
const facet_value_box_cjs_namespaceObject = require("../facet-value-box/facet-value-box.cjs");
const facet_value_checkbox_cjs_namespaceObject = require("../facet-value-checkbox/facet-value-checkbox.cjs");
const facet_value_label_highlight_cjs_namespaceObject = require("../facet-value-label-highlight/facet-value-label-highlight.cjs");
const facet_value_link_cjs_namespaceObject = require("../facet-value-link/facet-value-link.cjs");
const renderFacetValue = ({ props: { facetSearchQuery, displayValuesAs, enableExclusion, facetCount, facetState, facetValue, field, i18n, onExclude, onSelect, setRef } })=>{
    const displayValue = (0, field_utils_cjs_namespaceObject.getFieldValueCaption)(field, facetValue, i18n);
    const isSelected = 'selected' === facetState;
    const isExcluded = 'excluded' === facetState;
    const triStateProps = enableExclusion ? {
        onExclude,
        state: facetState
    } : {};
    switch(displayValuesAs){
        case 'checkbox':
            return (0, facet_value_checkbox_cjs_namespaceObject.renderFacetValueCheckbox)({
                props: {
                    ...triStateProps,
                    displayValue,
                    numberOfResults: facetCount,
                    isSelected,
                    i18n,
                    onClick: onSelect,
                    searchQuery: facetSearchQuery,
                    buttonRef: (element)=>{
                        setRef?.(element);
                    }
                }
            })((0, facet_value_label_highlight_cjs_namespaceObject.renderFacetValueLabelHighlight)({
                props: {
                    displayValue,
                    isSelected,
                    isExcluded,
                    searchQuery: facetSearchQuery
                }
            }));
        case 'link':
            return (0, facet_value_link_cjs_namespaceObject.renderFacetValueLink)({
                props: {
                    displayValue,
                    numberOfResults: facetCount,
                    isSelected,
                    i18n,
                    onClick: onSelect,
                    searchQuery: facetSearchQuery,
                    buttonRef: (element)=>{
                        setRef?.(element);
                    }
                }
            })((0, facet_value_label_highlight_cjs_namespaceObject.renderFacetValueLabelHighlight)({
                props: {
                    displayValue,
                    isSelected,
                    searchQuery: facetSearchQuery
                }
            }));
        case 'box':
            return (0, facet_value_box_cjs_namespaceObject.renderFacetValueBox)({
                props: {
                    displayValue,
                    numberOfResults: facetCount,
                    isSelected,
                    i18n,
                    onClick: onSelect,
                    searchQuery: facetSearchQuery,
                    buttonRef: (element)=>{
                        setRef?.(element);
                    }
                }
            })((0, facet_value_label_highlight_cjs_namespaceObject.renderFacetValueLabelHighlight)({
                props: {
                    displayValue,
                    isSelected,
                    searchQuery: facetSearchQuery
                }
            }));
    }
};
exports.renderFacetValue = __webpack_exports__.renderFacetValue;
for(var __rspack_i in __webpack_exports__)if (-1 === [
    "renderFacetValue"
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
Object.defineProperty(exports, '__esModule', {
    value: true
});
