import { jsxs, jsx } from 'react/jsx-runtime';
import React__default, { forwardRef, Children } from 'react';
import { c as cn } from './utils-DdHUxIdC.js';
import { AccordionItem, AccordionTrigger, AccordionContent, Accordion as Accordion$1 } from './primitives/Accordion.js';

const AccordionItemComponent = forwardRef(({ title, children, className, value, ...otherProps }, ref) => (jsxs(AccordionItem, { ref: ref, value: value, className: cn(className), ...otherProps, children: [jsx(AccordionTrigger, { children: title }), jsx(AccordionContent, { children: children })] })));
AccordionItemComponent.displayName = "Accordion.Item";
const Accordion = forwardRef(({ className, children, type = "single", ...otherProps }, ref) => {
    // Auto-generate value props for items that don't have one
    const enhancedChildren = Children.map(children, (child, index) => {
        if (!React__default.isValidElement(child))
            return child;
        const childValue = child.props.value ?? `item-${index}`;
        return React__default.cloneElement(child, { value: childValue });
    });
    return (jsx(Accordion$1, { ref: ref, type: type, className: cn(className), ...otherProps, children: enhancedChildren }));
});
Accordion.displayName = "Accordion";
Accordion.Item = AccordionItemComponent;

export { Accordion as A };
//# sourceMappingURL=Accordion-Ch9S_qd3.js.map
