import { jsx as r } from "../../../../../../../external/.pnpm/preact@10.28.2/node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js";
import { useWizardFormContext as y } from "../../../../../../../hooks/form/wizard/WizardFormContext.js";
import { useCallback as c } from "../../../../../../../external/.pnpm/preact@10.28.2/node_modules/preact/hooks/dist/hooks.module.js";
import u from "../../../../../../internal/Typography/Typography.js";
import { TypographyVariant as A, TypographyElement as g } from "../../../../../../internal/Typography/types.js";
import p from "../../../../../../../core/Context/preact/useCoreContext.js";
import { Icon as t } from "../../../../../../internal/Icon/Icon.js";
import { uuid as b } from "../../../../../../../utils/random/uuid.js";
const B = ({
  isSameAddress: n,
  setIsSameAddress: s,
  showBillingFirst: l = !1
}) => {
  const { i18n: a } = p(), { setValue: e, getValues: d } = y(), o = b(), m = c(() => {
    s((i) => (l ? (e("deliveryAddress.street", i ? void 0 : d("billingAddress.street")), e("deliveryAddress.houseNumberOrName", i ? void 0 : d("billingAddress.houseNumberOrName")), e("deliveryAddress.postalCode", i ? void 0 : d("billingAddress.postalCode")), e("deliveryAddress.city", i ? void 0 : d("billingAddress.city")), e("deliveryAddress.country", i ? void 0 : d("billingAddress.country"))) : (e("billingAddress.street", i ? void 0 : d("deliveryAddress.street")), e("billingAddress.houseNumberOrName", i ? void 0 : d("deliveryAddress.houseNumberOrName")), e("billingAddress.postalCode", i ? void 0 : d("deliveryAddress.postalCode")), e("billingAddress.city", i ? void 0 : d("deliveryAddress.city")), e("billingAddress.country", i ? void 0 : d("deliveryAddress.country"))), !i));
  }, [d, s, e, l]);
  return /* @__PURE__ */ r("div", { children: [
    /* @__PURE__ */ r("input", { type: "checkbox", className: "adyen-pe-visually-hidden", id: o, onInput: m }),
    /* @__PURE__ */ r("label", { className: "adyen-pe-payment-link-creation-form__field-checkbox", htmlFor: o, children: [
      n ? /* @__PURE__ */ r(t, { name: "checkmark-square-fill" }) : /* @__PURE__ */ r(t, { name: "square" }),
      /* @__PURE__ */ r(u, { el: g.SPAN, variant: A.BODY, children: a.get("payByLink.creation.fields.shippingAndBillingSameAddress.label") })
    ] })
  ] });
};
export {
  B as BillingAndShippingCheckboxField
};
