import { jsx as e, jsxs as u } from "react/jsx-runtime";
import { a as k } from "./index.CfQlFjZU.js";
import { useEffect as w } from "react";
import { S as d } from "./shared.EdGf6tcG.js";
import { c as y } from "./index.dWlEA7uO.js";
import { a as v, B as E } from "./Button.CpTwUWVr.js";
import { u as R } from "./useId.7P31viIO.js";
import { u as x, M as B } from "./modal.BZAvb1Nx.js";
import { A as O } from "./AffiliateCommissionTag.CT1MTbyb.js";
import { c as P } from "./index.CfM2L_w0.js";
const T = "creator_container_LwOAv", j = "creator_thumbnail_UlSMp", q = "creator_square_KZwpl", U = "creator_product_K1PGw", Y = "creator_description_EL5r-", g = "creator_openLink_pXRLh", z = "creator_price_jnbb2", a = { container: T, thumbnail: j, square: q, product: U, description: Y, openLink: g, price: z }, K = ({
  onSubmit: n,
  disabled: c = !1,
  visible: o = !0,
  squared: l = !1,
  ...m
}) => {
  const p = R(), { Modal: t, openModal: r, closeModal: i } = x();
  return w(() => {
    o ? r() : i();
  }, [o, r, i]), {
    onSubmit: (s) => {
      s.preventDefault(), n(s);
    },
    formId: p,
    disabled: c,
    containerClassName: a.container,
    thumbnailClassName: P(a.thumbnail, {
      [a.square]: l
    }),
    productClassName: a.product,
    openLinkClassName: a.openLink,
    priceClassName: a.price,
    descriptionClassName: a.description,
    Modal: t,
    ...m
  };
}, V = ({
  onSubmit: n,
  onPrevious: c,
  onClose: o,
  onClickOpenLink: l,
  heading: m,
  disabled: p,
  productName: t,
  imageUrl: r,
  price: i,
  currency: s,
  description: N,
  openLinkDescription: _,
  commissionRate: A,
  commissionType: M,
  formId: f,
  containerClassName: C,
  thumbnailClassName: b,
  productClassName: h,
  priceClassName: D,
  descriptionClassName: I,
  openLinkClassName: S,
  Modal: L
}) => /* @__PURE__ */ e(
  L,
  {
    type: B.ADVANCED,
    heading: m,
    buttons: [
      {
        label: "Add Product",
        semantic: d.PRIMARY,
        type: v.SUBMIT,
        form: f,
        disabled: p
      },
      {
        label: "Previous",
        semantic: d.SECONDARY,
        onClick: () => c()
      }
    ],
    onDismiss: () => o(),
    children: /* @__PURE__ */ u("form", { id: f, className: C, onSubmit: n, children: [
      /* @__PURE__ */ e("img", { className: b, alt: t, src: r }),
      /* @__PURE__ */ e("div", { className: h, children: t }),
      /* @__PURE__ */ u("div", { className: D, children: [
        new Intl.NumberFormat("en-US", {
          style: "currency",
          currency: s
        }).format(i),
        /* @__PURE__ */ e(
          O,
          {
            currency: s,
            commissionRate: A,
            commissionType: M
          }
        )
      ] }),
      /* @__PURE__ */ e("div", { className: I, children: N }),
      /* @__PURE__ */ e(
        E,
        {
          className: S,
          size: "small",
          label: _,
          semantic: d.SECONDARY,
          suffixIcon: /* @__PURE__ */ e(y, { size: 24 }),
          onClick: () => l()
        }
      )
    ] })
  }
), ae = k(
  V,
  K
);
export {
  ae as A
};
