import { jsx as c } from "../../../../../../../external/.pnpm/preact@10.28.2/node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js";
import v from "../../context/context.js";
import { useResponsiveContainer as C, containerQueries as E } from "../../../../../../../hooks/useResponsiveContainer.js";
import { ButtonActionsLayoutBasic as N, ButtonActionsLayout as x } from "../../../../../../internal/Button/ButtonActions/types.js";
import I from "../../../../../../internal/Button/ButtonActions/ButtonActions.js";
import { useMemo as o } from "../../../../../../../external/.pnpm/preact@10.28.2/node_modules/preact/hooks/dist/hooks.module.js";
/* empty css                          */
import { ButtonVariant as S } from "../../../../../../internal/Button/types.js";
import B from "classnames";
import { useSettingsPermission as M } from "../../../../hooks/useSettingsPermission.js";
import R from "../../../../../../../core/Context/preact/useCoreContext.js";
import { Icon as T } from "../../../../../../internal/Icon/Icon.js";
import { boolOrFalse as u } from "../../../../../../../utils/value/bool.js";
import { noop as k } from "../../../../../../../utils/common.js";
const H = ({ navigateBack: t, closeContent: s }) => {
  const { i18n: i } = R(), { activeMenuItem: p, onSave: d, isSaving: r, isLoadingContent: b, isLoadingStores: A, isSaveSuccess: e } = v(), { themeEnabled: l, termsAndConditionsEnabled: _ } = M(), n = C(E.down.xs), m = b || A, f = o(() => p ? !l || u(r || m || t && e) : !1, [p, _, l, r, m, t, e]), a = o(() => ({
    disabled: f,
    event: d,
    iconLeft: t && e ? /* @__PURE__ */ c(T, { className: "adyen-pe-payment-link-settings-save-success__cta-icon", name: "checkmark" }) : void 0,
    title: i.get("payByLink.settings.common.action.save"),
    variant: S.PRIMARY,
    state: u(r && !(t && e)) ? "loading" : "default",
    classNames: n ? ["adyen-pe-payment-link-settings__cta--mobile"] : []
  }), [i, d, r, n, t, e, f]), y = o(() => ({
    disabled: u(m),
    event: t ?? s ?? k,
    title: i.get("payByLink.common.actions.goBack"),
    variant: S.SECONDARY,
    classNames: n ? ["adyen-pe-payment-link-settings__cta--mobile"] : []
  }), [t, i, n, s, m]), g = o(() => !t && !s ? [a] : [a, y], [a, y, t, s]), L = o(() => n ? x.VERTICAL_STACK : N.BUTTONS_END, [n]);
  return /* @__PURE__ */ c(
    "div",
    {
      className: B("adyen-pe-payment-link-settings__cta-container", {
        "adyen-pe-payment-link-settings__cta-container--mobile": n
      }),
      children: /* @__PURE__ */ c(I, { actions: g, layout: L })
    }
  );
};
export {
  H as default
};
