import React from "react";
const HighlightText = ({ text, children }) => {
    const textIndex = children
        .toLocaleLowerCase()
        .indexOf(text.toLocaleLowerCase());
    if (textIndex === -1) {
        return children;
    }
    const start = children.substring(0, textIndex);
    const match = children.substring(textIndex, textIndex + text.length);
    const end = children.substring(textIndex + text.length);
    return (React.createElement("span", { "aria-label": children },
        start,
        match && React.createElement("mark", null, match),
        end));
};
export { HighlightText };
//# sourceMappingURL=HighlightText.js.map