import { Image as s } from "../Image/Image.es.js";
import r, { useState as d } from "react";
import "./ImageGallery.es2.js";
import { Button as u } from "../../node_modules/@frontify/fondue/dist/components/Button/Button.es.es.js";
import _ from "../../node_modules/@frontify/fondue/dist/foundation/Icon/Generated/IconArrowRight16.es.es.js";
const O = ({ onAssetsChosen: g, asset: a, size: t, actionLabel: c = "Upload" }) => {
  const [e, m] = d([]), y = (n) => {
    if (!(e != null && e.find((l) => JSON.stringify(l) === JSON.stringify(n))))
      m([n, ...e]);
    else {
      const l = e == null ? void 0 : e.reduce(
        (o, i) => JSON.stringify(i) !== JSON.stringify(n) ? [i, ...o] : o,
        []
      );
      m(l);
    }
  }, f = e.length <= 0;
  return /* @__PURE__ */ r.createElement("div", {
    className: t ? `image-gallery--${t}` : "image-gallery"
  }, /* @__PURE__ */ r.createElement("div", {
    className: t ? `image-gallery__container--${t}` : "image-gallery__container"
  }, a == null ? void 0 : a.map((n, l) => /* @__PURE__ */ r.createElement(s, {
    size: t,
    onImageClick: y,
    ...n,
    key: l + JSON.stringify(n)
  }))), /* @__PURE__ */ r.createElement("div", {
    className: t ? `image-gallery__success-button--${t}` : "image-gallery__success-button"
  }, /* @__PURE__ */ r.createElement(u, {
    onClick: () => {
      m([]), g(e);
    },
    icon: /* @__PURE__ */ r.createElement(_, null),
    disabled: f
  }, c, " ", e.length, " Asset", e.length > 1 && "s")));
};
export {
  O as ImageGallery
};
//# sourceMappingURL=ImageGallery.es.js.map
