"use client";
'use strict';

var img = require('@page-speed/img');
var core = require('@page-speed/markdown-to-jsx/core');
var React = require('react');
var pressable = require('@page-speed/pressable');
var jsxRuntime = require('react/jsx-runtime');

function _interopNamespace(e) {
  if (e && e.__esModule) return e;
  var n = Object.create(null);
  if (e) {
    Object.keys(e).forEach(function (k) {
      if (k !== 'default') {
        var d = Object.getOwnPropertyDescriptor(e, k);
        Object.defineProperty(n, k, d.get ? d : {
          enumerable: true,
          get: function () { return e[k]; }
        });
      }
    });
  }
  n.default = e;
  return Object.freeze(n);
}

var React__namespace = /*#__PURE__*/_interopNamespace(React);

// components/ui/longform-content.tsx
function LongformContent({
  children,
  renderMode = "markdown",
  markdownString,
  optixFlowConfig,
  markdownStyles
}) {
  const shouldRenderMarkdown = React__namespace.useMemo(() => {
    return renderMode === "markdown" && typeof markdownString === "string" && markdownString.length > 0;
  }, [renderMode, markdownString]);
  if (shouldRenderMarkdown && markdownString) {
    return /* @__PURE__ */ jsxRuntime.jsx(
      core.Markdown,
      {
        markdownStyles,
        optixFlowConfig,
        overrides: {
          img: img.Img,
          a: pressable.Pressable
        },
        children: markdownString
      }
    );
  }
  if (children) {
    return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
  }
  return null;
}

exports.LongformContent = LongformContent;
