// ../src/helpers/formatClassString.ts
var formatClassString = (classesArray) => {
  return classesArray.filter((x) => !!x).join(" ");
};

// ../src/components/image-caption/image-caption.tsx
import { jsx, jsxs } from "preact/jsx-runtime";
var ImageCaption = ({ caption, author, imageType, classNames, attributes, forcePx }) => {
  const classes = formatClassString(["ds-image-caption", forcePx && "ds-force-px", classNames]);
  const authorText = imageType && author ? `${imageType.charAt(0).toUpperCase() + imageType.slice(1)}: ${author}` : author;
  const authorClasses = [
    "ds-article-image__credits",
    authorText && authorText.length >= 27 && authorText.length < 60 ? "ds-article-image__credits--nowrap-bigscreen" : authorText && authorText.length < 27 ? "ds-article-image__credits--nowrap" : null
  ].filter(Boolean).join(" ");
  return /* @__PURE__ */ jsxs("figcaption", { className: classes, "aria-hidden": "true", ...attributes, children: [
    caption && /* @__PURE__ */ jsx("span", { children: caption }),
    " ",
    authorText && /* @__PURE__ */ jsx("span", { className: authorClasses, children: authorText })
  ] });
};
export {
  ImageCaption
};
//# sourceMappingURL=image-caption.js.map
