"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const require$$0 = require("react/jsx-runtime");
const index$1 = require("../../code-block/index.cjs");
const index = require("../utils/index.cjs");
const tv = require("../tv.cjs");
const mermaidBlock = require("./mermaid-block.cjs");
const codeBlockCode = require("../../code-block/components/code-block-code.cjs");
const createComponents = (tv2) => ({
  // Typography
  p: ({ children }) => /* @__PURE__ */ require$$0.jsx("p", { className: tv2.paragraph(), children }),
  h1: ({ children }) => /* @__PURE__ */ require$$0.jsx("h1", { className: tv2.h1(), children }),
  h2: ({ children }) => /* @__PURE__ */ require$$0.jsx("h2", { className: tv2.h2(), children }),
  h3: ({ children }) => /* @__PURE__ */ require$$0.jsx("h3", { className: tv2.h3(), children }),
  h4: ({ children }) => /* @__PURE__ */ require$$0.jsx("h4", { className: tv2.h4(), children }),
  h5: ({ children }) => /* @__PURE__ */ require$$0.jsx("h5", { className: tv2.h5(), children }),
  h6: ({ children }) => /* @__PURE__ */ require$$0.jsx("h6", { className: tv2.h6(), children }),
  // Lists
  ul: ({ children }) => /* @__PURE__ */ require$$0.jsx("ul", { className: tv2.ul(), children }),
  ol: ({ children }) => /* @__PURE__ */ require$$0.jsx("ol", { className: tv2.ol(), children }),
  li: ({ children }) => /* @__PURE__ */ require$$0.jsx("li", { className: tv2.li(), children }),
  // Blockquote
  blockquote: ({ children }) => /* @__PURE__ */ require$$0.jsx("blockquote", { className: tv2.blockquote(), children }),
  // Horizontal rule
  hr: () => /* @__PURE__ */ require$$0.jsx("hr", { className: tv2.hr() }),
  // Links
  a: ({ href, children }) => /* @__PURE__ */ require$$0.jsx(
    "a",
    {
      href,
      target: "_blank",
      rel: "noopener noreferrer",
      className: tv2.a(),
      children
    }
  ),
  // Code
  code: function CodeComponent({ className, children, ...props }) {
    const isInline = !props.node?.position?.start.line || props.node?.position?.start.line === props.node?.position?.end.line;
    if (isInline) {
      return /* @__PURE__ */ require$$0.jsx(
        "code",
        {
          className: tv2.code(),
          ...props,
          children
        }
      );
    }
    const language = index.extractLanguage(className);
    if (language === "mermaid") {
      return null;
    }
    return /* @__PURE__ */ require$$0.jsx(index$1.CodeBlock, { className, children: /* @__PURE__ */ require$$0.jsx(
      codeBlockCode.CodeBlockCode,
      {
        code: children,
        language
      }
    ) });
  },
  pre: function PreComponent({ children }) {
    if (children && typeof children === "object" && "props" in children) {
      const props = children.props;
      if (props?.className?.includes("language-mermaid")) {
        const code = props.children;
        if (typeof code === "string") {
          return /* @__PURE__ */ require$$0.jsx(mermaidBlock.MermaidBlock, { code });
        }
      }
    }
    return /* @__PURE__ */ require$$0.jsx("pre", { className: tv2.pre(), children });
  },
  // Tables
  table: ({ children }) => /* @__PURE__ */ require$$0.jsx("div", { className: tv2.tableWrapper(), children: /* @__PURE__ */ require$$0.jsx("table", { className: tv2.table(), children }) }),
  thead: ({ children }) => /* @__PURE__ */ require$$0.jsx("thead", { className: tv2.thead(), children }),
  tbody: ({ children }) => /* @__PURE__ */ require$$0.jsx("tbody", { className: tv2.tbody(), children }),
  tr: ({ children }) => /* @__PURE__ */ require$$0.jsx("tr", { className: tv2.tr(), children }),
  th: ({ children }) => /* @__PURE__ */ require$$0.jsx("th", { className: tv2.th(), children }),
  td: ({ children }) => /* @__PURE__ */ require$$0.jsx("td", { className: tv2.td(), children }),
  // Typography elements
  strong: ({ children }) => /* @__PURE__ */ require$$0.jsx("strong", { className: tv2.strong(), children }),
  em: ({ children }) => /* @__PURE__ */ require$$0.jsx("em", { className: tv2.em(), children }),
  del: ({ children }) => /* @__PURE__ */ require$$0.jsx("del", { className: tv2.del(), children }),
  // Images
  img: ({ src, alt }) => /* @__PURE__ */ require$$0.jsx(
    "img",
    {
      src,
      alt,
      className: tv2.img()
    }
  ),
  // Checkbox (for task lists)
  input: ({ type, checked, ...props }) => {
    if (type === "checkbox") {
      return /* @__PURE__ */ require$$0.jsx(
        "input",
        {
          type: "checkbox",
          checked,
          className: tv2.checkbox(),
          ...props
        }
      );
    }
    return /* @__PURE__ */ require$$0.jsx(
      "input",
      {
        type,
        ...props
      }
    );
  }
});
createComponents(tv.mdTv());
exports.createComponents = createComponents;
//# sourceMappingURL=markdown-renderers.cjs.map
