import { jsxs as C, jsx as o, Fragment as I } from "react/jsx-runtime";
/* empty css                     */
import { classNames as t } from "./index-classNames.js";
import { useState as N, useEffect as g } from "react";
import { Icon as E, IconSize as v } from "./index-Icon.js";
import { IconNames as b } from "./index-IconNames.js";
import j from "./index-Accordion2.js";
import w from "./index-AccordionSummary.js";
import z from "./index-AccordionDetails.js";
const J = (d) => {
  const {
    accordionId: i,
    summaryChildren: r,
    detailsChildren: m,
    disableGutters: l,
    variant: p,
    expanded: e,
    iconSize: f,
    iconName: u,
    summaryCustomStyle: y,
    baseCustomStyle: x,
    detailsCustomStyle: h,
    onExpandedChange: a,
    reverse: A = !1
  } = d, [n, c] = N(e ?? !1);
  g(() => {
    n !== e && c(e ?? !1);
  }, [e]);
  const S = () => {
    const s = !n;
    c(s), a && a(s);
  };
  return C(j, {
    expanded: n,
    disableGutters: l,
    variant: p,
    className: t("Accordion-container", A ? "Accordion-reverse" : ""),
    style: x,
    children: [o(w, {
      onClick: S,
      expandIcon: r ? o(E, {
        className: "Accordion-icon",
        type: f ?? v.large,
        children: u ?? b.caretDown
      }) : void 0,
      className: t(r ? "" : "AccordionSummary-hide"),
      style: y,
      id: i,
      "aria-controls": i,
      children: r ?? o(I, {})
    }), o(z, {
      style: h,
      children: m
    })]
  });
};
export {
  J as Accordion
};
