// packages/block-library/src/gallery/gallery.js
import clsx from "clsx";
import { __ } from "@wordpress/i18n";
import { View } from "@wordpress/primitives";
import { Caption } from "../utils/caption";
import { jsx, jsxs } from "react/jsx-runtime";
function Gallery(props) {
  const {
    attributes,
    isSelected,
    setAttributes,
    mediaPlaceholder,
    insertBlocksAfter,
    blockProps,
    __unstableLayoutClassNames: layoutClassNames,
    isContentLocked,
    multiGallerySelection
  } = props;
  const { align, columns, imageCrop } = attributes;
  return /* @__PURE__ */ jsxs(
    "figure",
    {
      ...blockProps,
      className: clsx(
        blockProps.className,
        layoutClassNames,
        "blocks-gallery-grid",
        {
          [`align${align}`]: align,
          [`columns-${columns}`]: columns !== void 0,
          [`columns-default`]: columns === void 0,
          "is-cropped": imageCrop
        }
      ),
      children: [
        blockProps.children,
        isSelected && !blockProps.children && /* @__PURE__ */ jsx(View, { className: "blocks-gallery-media-placeholder-wrapper", children: mediaPlaceholder }),
        /* @__PURE__ */ jsx(
          Caption,
          {
            attributes,
            setAttributes,
            isSelected,
            insertBlocksAfter,
            showToolbarButton: !multiGallerySelection && !isContentLocked,
            className: "blocks-gallery-caption",
            label: __("Gallery caption text"),
            placeholder: __("Add gallery caption")
          }
        )
      ]
    }
  );
}
export {
  Gallery as default
};
//# sourceMappingURL=gallery.js.map
