import { createSplitProps } from "../../utils/create-split-props.js";
import { useHighlight } from "./use-highlight.js";
import { Fragment } from "react";
import { jsx } from "react/jsx-runtime";
//#region src/components/highlight/highlight.tsx
var splitHighlightBaseProps = createSplitProps();
var Highlight = (props) => {
	if (typeof props.text !== "string") throw new Error("[ark-ui/highlight] text must be a string");
	const [highlightProps, localProps] = splitHighlightBaseProps(props, [
		"query",
		"text",
		"ignoreCase",
		"matchAll",
		"exactMatch"
	]);
	return /* @__PURE__ */ jsx(Fragment, { children: useHighlight(highlightProps).map(({ text, match }, i) => match ? /* @__PURE__ */ jsx("mark", {
		...localProps,
		children: text
	}, i) : /* @__PURE__ */ jsx(Fragment, { children: text }, i)) });
};
//#endregion
export { Highlight };
