"use client";
import { isElement } from "../../core/utils/is-element/is-element.mjs";
import { getSpacing } from "../../core/utils/get-size/get-size.mjs";
import { createVarsResolver } from "../../core/styles-api/create-vars-resolver/create-vars-resolver.mjs";
import { useProps } from "../../core/MantineProvider/use-props/use-props.mjs";
import { useStyles } from "../../core/styles-api/use-styles/use-styles.mjs";
import { factory } from "../../core/factory/factory.mjs";
import { Box } from "../../core/Box/Box.mjs";
import Breadcrumbs_module_default from "./Breadcrumbs.module.mjs";
import { Children, cloneElement, createElement } from "react";
import { jsx } from "react/jsx-runtime";
//#region packages/@mantine/core/src/components/Breadcrumbs/Breadcrumbs.tsx
const defaultProps = { separator: "/" };
const varsResolver = createVarsResolver((_, { separatorMargin }) => ({ root: { "--bc-separator-margin": getSpacing(separatorMargin) } }));
const Breadcrumbs = factory((_props) => {
	const props = useProps("Breadcrumbs", defaultProps, _props);
	const { classNames, className, style, styles, unstyled, vars, children, separator, separatorMargin, attributes, ...others } = props;
	const getStyles = useStyles({
		name: "Breadcrumbs",
		classes: Breadcrumbs_module_default,
		props,
		className,
		style,
		classNames,
		styles,
		unstyled,
		attributes,
		vars,
		varsResolver
	});
	const items = Children.toArray(children).reduce((acc, child, index, array) => {
		const item = isElement(child) ? cloneElement(child, {
			...getStyles("breadcrumb", { className: child.props?.className }),
			key: index
		}) : /* @__PURE__ */ createElement("div", {
			...getStyles("breadcrumb"),
			key: index
		}, child);
		acc.push(item);
		if (index !== array.length - 1) acc.push(/* @__PURE__ */ createElement(Box, {
			...getStyles("separator"),
			key: `separator-${index}`
		}, separator));
		return acc;
	}, []);
	return /* @__PURE__ */ jsx(Box, {
		...getStyles("root"),
		...others,
		children: items
	});
});
Breadcrumbs.classes = Breadcrumbs_module_default;
Breadcrumbs.varsResolver = varsResolver;
Breadcrumbs.displayName = "@mantine/core/Breadcrumbs";
//#endregion
export { Breadcrumbs };

//# sourceMappingURL=Breadcrumbs.mjs.map