// ../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 })
  ] });
};

// ../src/assets/article-image/article-image.tsx
import { jsx as jsx2, jsxs as jsxs2 } from "preact/jsx-runtime";
var ArticleImage = ({
  image,
  caption = "",
  author = "",
  imageType = "",
  fullWidth,
  forcePx,
  classNames,
  attributes
}) => {
  const componentClassName = "ds-article-image";
  const classes = formatClassString([componentClassName, forcePx && "ds-force-px", classNames]);
  const showCaption = !!caption || !!author;
  return /* @__PURE__ */ jsxs2("figure", { className: classes, ...attributes, children: [
    fullWidth ? /* @__PURE__ */ jsx2("div", { className: "ds-full-width-element", children: image }) : image,
    showCaption && /* @__PURE__ */ jsx2(ImageCaption, { caption, author, imageType, forcePx })
  ] });
};

// ../src/components/article-top-image/article-top-image.tsx
import { jsx as jsx3 } from "preact/jsx-runtime";
var ArticleTopImage = ({
  caption,
  imageType,
  author,
  image,
  forcePx,
  classNames,
  attributes
}) => {
  const classes = formatClassString(["ds-article-image--top", classNames]);
  const imageParams = {
    fullWidth: true,
    caption,
    imageType,
    author,
    image,
    forcePx,
    classNames: classes,
    attributes
  };
  return /* @__PURE__ */ jsx3(ArticleImage, { ...imageParams });
};
export {
  ArticleTopImage
};
//# sourceMappingURL=article-top-image.js.map
