"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const jsxRuntime = require("react/jsx-runtime");
require("react");
require("clsx");
const useProps = require("../../core/MantineProvider/use-props/use-props.cjs");
const polymorphicFactory = require("../../core/factory/polymorphic-factory.cjs");
const Mark = require("../Mark/Mark.cjs");
const Text = require("../Text/Text.cjs");
const highlighter = require("./highlighter/highlighter.cjs");
const defaultProps = {};
const Highlight = polymorphicFactory.polymorphicFactory((props, ref) => {
  const { unstyled, children, highlight, highlightStyles, color, ...others } = useProps.useProps(
    "Highlight",
    defaultProps,
    props
  );
  const highlightChunks = highlighter.highlighter(children, highlight);
  return /* @__PURE__ */ jsxRuntime.jsx(Text.Text, { unstyled, ref, ...others, __staticSelector: "Highlight", children: highlightChunks.map(
    ({ chunk, highlighted }, i) => highlighted ? /* @__PURE__ */ jsxRuntime.jsx(
      Mark.Mark,
      {
        unstyled,
        color,
        style: highlightStyles,
        "data-highlight": chunk,
        children: chunk
      },
      i
    ) : /* @__PURE__ */ jsxRuntime.jsx("span", { children: chunk }, i)
  ) });
});
Highlight.classes = Text.Text.classes;
Highlight.displayName = "@mantine/core/Highlight";
exports.Highlight = Highlight;
