"use client";
import { j as e } from "./index.esm38.js";
import { forwardRef as g } from "react";
import d from "./index.esm40.js";
import a from "./index.esm75.js";
import { HashIcon as x } from "./index.esm47.js";
import { Typography as j } from "./index.esm9.js";
const y = g(
  ({
    variant: s = "h2",
    size: p,
    color: c,
    anchorId: t,
    children: r,
    className: n,
    id: l,
    ...o
  }, i) => {
    const h = l ?? t, u = !!t, m = /* @__PURE__ */ e.jsx(j, { variant: s, size: p, color: c, as: "span", children: r });
    if (u)
      return /* @__PURE__ */ e.jsxs(
        "a",
        {
          ref: i,
          href: `#${t}`,
          id: h,
          "data-atme-ui": !0,
          "data-heading-anchor": !0,
          className: d(a.heading, a.headingAnchor, n),
          "aria-label": `Ссылка на раздел: ${typeof r == "string" ? r : t}`,
          ...o,
          children: [
            /* @__PURE__ */ e.jsx("span", { className: a.headingText, children: m }),
            /* @__PURE__ */ e.jsx("span", { className: a.hashIcon, "data-hash-icon-wrapper": !0, "aria-hidden": !0, children: /* @__PURE__ */ e.jsx(x, { decorative: !0 }) })
          ]
        }
      );
    const f = s.startsWith("h") ? s : "h2";
    return /* @__PURE__ */ e.jsx(
      f,
      {
        ref: i,
        id: h,
        "data-atme-ui": !0,
        className: d(a.heading, n),
        ...o,
        children: m
      }
    );
  }
);
y.displayName = "Heading";
export {
  y as Heading
};
//# sourceMappingURL=index.esm10.js.map
