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

const AccordionItemComponent = forwardRef(
  ({ title, children, className, value, ...otherProps }, ref) => /* @__PURE__ */ jsxs(
    AccordionItem,
    {
      ref,
      value,
      className: cn(className),
      ...otherProps,
      children: [
        /* @__PURE__ */ jsx(AccordionTrigger, { children: title }),
        /* @__PURE__ */ jsx(AccordionContent, { children })
      ]
    }
  )
);
AccordionItemComponent.displayName = "Accordion.Item";
const Accordion = forwardRef(
  ({ className, children, type = "single", ...otherProps }, ref) => {
    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 /* @__PURE__ */ jsx(
      Accordion$1,
      {
        ref,
        type,
        className: cn(className),
        ...otherProps,
        children: enhancedChildren
      }
    );
  }
);
Accordion.displayName = "Accordion";
Accordion.Item = AccordionItemComponent;

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