import { jsxs as d, jsx as e } from "react/jsx-runtime";
import { useState as h } from "react";
import { noop as l } from "es-toolkit/function";
import n from "../../utils/classNames.js";
import $ from "../collapse/Collapse.js";
const G = (N) => {
  const {
    open: a = !1,
    iconLeft: f = !1,
    bsStyle: t = "blank",
    title: C,
    headerClassName: i,
    titleClassName: r,
    bodyClassName: c,
    iconClassName: g,
    unmountOnExit: u = !0,
    onEntered: b = l,
    onExited: x = l,
    onAnimationStart: v = l,
    onToggle: y = l,
    className: O,
    trackingAttributes: S,
    children: s,
    ...k
  } = N, [o, p] = h(a), [E, w] = h(a);
  E !== a && (p(a), w(a));
  const A = () => {
    const m = !o;
    p(m), y(m);
  }, P = n("expander-panel panel", `panel-${t}`, O), j = n("expander-icon", g, "rioglyph", "rioglyph-chevron-down"), T = n(
    "panel-heading",
    o && "open",
    f && "icon-left",
    i && i
  ), I = n("title", r && r), L = n("panel-body", c && c), R = s && typeof s == "function";
  return /* @__PURE__ */ d("div", { ...k, className: P, "aria-label": "expander panel", children: [
    /* @__PURE__ */ d("div", { className: T, onClick: A, "aria-label": "panel heading", ...S, children: [
      /* @__PURE__ */ e("span", { className: I, children: C }),
      /* @__PURE__ */ e("span", { className: j }),
      t === "separator" && /* @__PURE__ */ e("div", { className: "separator", children: /* @__PURE__ */ e("hr", {}) })
    ] }),
    /* @__PURE__ */ e(
      $,
      {
        open: o,
        unmountOnExit: u,
        onEntered: b,
        onExited: x,
        onAnimationStart: () => v(),
        children: /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e("div", { className: L, children: R ? s(o) : s }) })
      }
    )
  ] });
};
export {
  G as default
};
//# sourceMappingURL=ExpanderPanel.js.map
