import { jsx as e } from "../../../../../../external/.pnpm/preact@10.28.2/node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js";
import { useCallback as g, useEffect as h } from "../../../../../../external/.pnpm/preact@10.28.2/node_modules/preact/hooks/dist/hooks.module.js";
import i from "../../../../../internal/Typography/Typography.js";
import { TypographyVariant as s } from "../../../../../internal/Typography/types.js";
import { useTermsRequirementsConfig as q } from "./useTermsRequirementsConfig.js";
/* empty css                  */
import { ButtonVariant as p } from "../../../../../internal/Button/types.js";
import k from "../../../../../../core/Context/preact/useCoreContext.js";
import d from "../../../../../internal/Button/Button.js";
import v from "../../../../../internal/Modal/Modal.js";
const Y = ({
  onGoBack: r,
  acceptRequirements: a,
  termsAndConditionsURL: u,
  embeddedInOverview: y = !1
}) => {
  const { termsRequirementsConfig: m, getTermsRequirementsConfig: o } = q(), { i18n: n } = k(), f = g(() => {
    a(), r();
  }, [a, r]);
  h(() => {
    o();
  }, [o]);
  const l = /* @__PURE__ */ e("div", { className: "adyen-pe-payment-link-requirements", children: [
    /* @__PURE__ */ e(i, { variant: s.SUBTITLE, stronger: !0, children: n.get(m.titleKey) }),
    /* @__PURE__ */ e("div", { className: "adyen-pe-payment-link-requirements__sections-container", children: m.sections.map((t) => /* @__PURE__ */ e("div", { className: "adyen-pe-payment-link-requirements__section", children: [
      /* @__PURE__ */ e(i, { variant: s.SUBTITLE, stronger: !0, children: n.get(t.titleKey) }),
      /* @__PURE__ */ e("div", { className: "adyen-pe-payment-link-requirements__section-content", children: [
        /* @__PURE__ */ e(i, { className: "adyen-pe-payment-link-requirements__description", variant: s.BODY, children: n.get(t.descriptionKey) }),
        /* @__PURE__ */ e("ul", { className: "adyen-pe-payment-link-requirements__list", children: t.items.map((c) => /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(i, { variant: s.BODY, children: n.get(c.key) }) }, c.key)) })
      ] })
    ] }, t.id)) }),
    /* @__PURE__ */ e("div", { className: "adyen-pe-payment-link-requirements__buttons-container", children: [
      /* @__PURE__ */ e(d, { variant: p.SECONDARY, onClick: r, children: n.get("payByLink.settings.terms.requirements.actions.goBack") }),
      u && /* @__PURE__ */ e(d, { variant: p.PRIMARY, onClick: f, children: n.get("payByLink.settings.terms.requirements.actions.confirmRequirements") })
    ] })
  ] });
  return y ? l : /* @__PURE__ */ e(v, { isOpen: !0, onClose: r, isDismissible: !0, headerWithBorder: !1, size: "large", children: l });
};
export {
  Y as Requirements
};
