import React from "react";
import { Node_Type } from "./../../ricos-types/index.js";
import classes from "./viewer-figure-scss.js";
const ViewerFigure = ({
  node,
  nodeIndex,
  NodeViewContainer,
  RicosNodesRenderer,
  children
}) => {
  const nodes = node.imageData?.caption && !node.nodes?.length ? [
    {
      type: Node_Type.CAPTION,
      id: `${node.id ?? ""}-caption`,
      nodes: [
        {
          type: Node_Type.TEXT,
          id: "",
          nodes: [],
          textData: {
            text: node.imageData.caption,
            decorations: []
          }
        }
      ]
    }
  ] : node.nodes ?? [];
  return /* @__PURE__ */ React.createElement(NodeViewContainer, { node, nodeIndex }, ({ ContainerElement, SpoilerWrapper, LinkWrapper }) => {
    return /* @__PURE__ */ React.createElement(ContainerElement, null, /* @__PURE__ */ React.createElement("figure", { className: classes.figure, "data-hook": `figure-${node.type}` }, /* @__PURE__ */ React.createElement(LinkWrapper, null, /* @__PURE__ */ React.createElement(SpoilerWrapper, null, children)), /* @__PURE__ */ React.createElement(RicosNodesRenderer, { nodes })));
  });
};
export {
  ViewerFigure
};
//# sourceMappingURL=viewer-figure.js.map
