import { j as a } from "./jsx-runtime-B6kdoens.js";
import { A as u, g as d } from "./aggregator-BpQMir30.js";
import { createContext as v, useContext as j, isValidElement as f, Fragment as h } from "react";
import { S as m } from "./Pack-l3j3YWpE.js";
import { I as B, p as C, B as S, W as b } from "./Toggle-3WohopP9.js";
import { C as n } from "./css-CiSR0WsA.js";
const x = v({
  divided: !1,
  level: "h1"
}), i = () => j(x), g = ({
  children: s,
  className: r,
  level: e = "h1",
  divided: o = !1,
  ...t
}) => /* @__PURE__ */ a.jsx(x.Provider, { value: { level: e, divided: o }, children: /* @__PURE__ */ a.jsx(
  m,
  {
    el: "header",
    direction: "x",
    justify: "spaceBetween",
    className: n(
      n.B("header"),
      n.bordered("bottom"),
      o && n.BM("header", "divided"),
      r
    ),
    ...t,
    children: s
  }
) }), z = ({ children: s = [] }) => {
  const { level: r, divided: e } = i();
  return /* @__PURE__ */ a.jsx(
    m,
    {
      direction: "x",
      size: "small",
      align: "center",
      className: n.BE("header", "actions"),
      children: u(s).map((o, t) => /* @__PURE__ */ a.jsx(A, { index: t, level: r, divided: e, children: o }, t))
    }
  );
}, A = ({ index: s, level: r, children: e, divided: o }) => {
  let t = e;
  if (!f(e)) {
    const { onClick: l, ...p } = e;
    t = /* @__PURE__ */ a.jsx(
      B,
      {
        onClick: (c) => {
          c.stopPropagation(), c.preventDefault(), l == null || l(c);
        },
        size: d[r],
        ...p
      },
      s
    );
  }
  return /* @__PURE__ */ a.jsxs(h, { children: [
    o && /* @__PURE__ */ a.jsx(C, {}),
    t
  ] }, s);
}, E = ({
  children: s = "",
  className: r,
  onClick: e,
  ...o
}) => {
  const { level: t } = i();
  return /* @__PURE__ */ a.jsx(
    S,
    {
      variant: "text",
      size: d[t],
      onClick: e,
      className: n(n.B("header-button-title"), r),
      sharp: !0,
      ...o,
      children: s
    }
  );
}, N = ({
  className: s,
  level: r,
  ...e
}) => {
  const { level: o, divided: t } = i();
  return /* @__PURE__ */ a.jsx(
    b,
    {
      className: n(n.BE("header", "text"), s),
      level: r ?? o,
      divided: t,
      size: 1.5,
      ...e
    }
  );
}, H = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  Actions: z,
  ButtonTitle: E,
  Header: g,
  Title: N,
  useContext: i
}, Symbol.toStringTag, { value: "Module" }));
export {
  z as A,
  E as B,
  g as H,
  H as e
};
