"use strict";
var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var react_1 = __importDefault(require("react"));
var prop_types_1 = __importDefault(require("prop-types"));
var utils_1 = require("../utils");
var Highlighter_1 = require("../../Highlighter");
var CommonListHighlight = /** @class */ (function (_super) {
    __extends(CommonListHighlight, _super);
    function CommonListHighlight() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    CommonListHighlight.prototype.render = function () {
        var _a = this.props, listHighlightType = _a.listHighlightType, containsRichText = _a.containsRichText, title = _a.title, textHighlightPattern = _a.textHighlightPattern, textFilterPattern = _a.textFilterPattern;
        if (containsRichText || listHighlightType === Highlighter_1.HIGHLIGHT_TYPE.BACKGROUND) {
            return (react_1.default.createElement(Highlighter_1.Highlighter, { title: title, listHighlightType: listHighlightType, highlightRegexp: textHighlightPattern, filterRegexp: textFilterPattern }, this.props.children));
        }
        return utils_1.highlight(textFilterPattern, this.props.children, title);
    };
    CommonListHighlight.HIGHLIGHT_TYPE_BACKGROUND = Highlighter_1.HIGHLIGHT_TYPE.BACKGROUND;
    CommonListHighlight.HIGHLIGHT_TYPE_BOLD = Highlighter_1.HIGHLIGHT_TYPE.BOLD;
    CommonListHighlight.propTypes = {
        children: prop_types_1.default.node,
        title: prop_types_1.default.string,
        textHighlightPattern: prop_types_1.default.object,
        textFilterPattern: prop_types_1.default.object,
        listHighlightType: prop_types_1.default.oneOf([Highlighter_1.HIGHLIGHT_TYPE.BACKGROUND, Highlighter_1.HIGHLIGHT_TYPE.BOLD]),
        containsRichText: prop_types_1.default.bool
    };
    CommonListHighlight.defaultProps = {
        children: null,
        title: null,
        textHighlightPattern: null,
        textFilterPattern: null,
        listHighlightType: Highlighter_1.HIGHLIGHT_TYPE.BOLD,
        containsRichText: false
    };
    return CommonListHighlight;
}(react_1.default.Component));
exports.CommonListHighlight = CommonListHighlight;
//# sourceMappingURL=CommonListHighlight.js.map