"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var _chunkAGIM6BKCcjs = require('./chunk-AGIM6BKC.cjs');


var _chunkMQYA7D6Fcjs = require('./chunk-MQYA7D6F.cjs');

// src/components/documentation/DocsHeadline.tsx
var _react = require('react'); var _react2 = _interopRequireDefault(_react);
var _jsxruntime = require('@emotion/react/jsx-runtime');
var getHeadlineText = (element) => {
  if (typeof element === "string") {
    return element;
  }
  if (Array.isArray(element)) {
    return getHeadlineText(element[0]);
  }
  if (_chunkAGIM6BKCcjs.isReactNodeWithChildren.call(void 0, element)) {
    return getHeadlineText(element.props.children);
  }
  throw new Error(
    "Could not find text in Headline element: " + (element == null ? void 0 : element.toString())
  );
};
var getHeaderId = (element) => {
  if (_react2.default.isValidElement(element) && (element == null ? void 0 : element.type) === "a" && "href" in element.props) {
    const props = element.props;
    return getHeaderId(props.href);
  }
  if (typeof element === "string") {
    return element.replace("#", "");
  }
  if (Array.isArray(element)) {
    return getHeaderId(element[0]);
  }
  if (_chunkAGIM6BKCcjs.isReactNodeWithChildren.call(void 0, element)) {
    return getHeaderId(element.props.children);
  }
  throw new Error(
    "Could not find text in Headline element: " + (element == null ? void 0 : element.toString())
  );
};
var toKebabCase = (str) => {
  return str.replaceAll(" ", "-").toLowerCase();
};
var DocsHeadline = ({
  children,
  color,
  size = "Medium",
  heading = "h1",
  onClick,
  textAlign,
  underline = false
}) => {
  const id = toKebabCase(getHeaderId(children));
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, 
    _chunkMQYA7D6Fcjs.StyledHeadline,
    {
      as: heading,
      id,
      size,
      colorProp: color,
      displayProp: "block",
      hideOverflow: false,
      textAlign,
      onClick,
      underline,
      block: true,
      children
    }
  );
};




exports.getHeadlineText = getHeadlineText; exports.DocsHeadline = DocsHeadline;
