import { useMemo as m, useCallback as p } from "../../../../../../external/.pnpm/preact@10.28.2/node_modules/preact/hooks/dist/hooks.module.js";
import { useWizardFormContext as D } from "../../../../../../hooks/form/wizard/WizardFormContext.js";
import { useWatch as s } from "../../../../../../hooks/form/useWatch.js";
const C = [
  "deliveryAddress.street",
  "deliveryAddress.houseNumberOrName",
  "deliveryAddress.country",
  "deliveryAddress.city",
  "deliveryAddress.postalCode"
], N = [
  "billingAddress.street",
  "billingAddress.houseNumberOrName",
  "billingAddress.country",
  "billingAddress.city",
  "billingAddress.postalCode"
], I = () => {
  const { control: e } = D(), i = s(e, "deliveryAddress.street"), l = s(e, "deliveryAddress.houseNumberOrName"), t = s(e, "deliveryAddress.country"), o = s(e, "deliveryAddress.city"), n = s(e, "deliveryAddress.postalCode"), u = s(e, "billingAddress.street"), c = s(e, "billingAddress.houseNumberOrName"), y = s(e, "billingAddress.country"), A = s(e, "billingAddress.city"), b = s(e, "billingAddress.postalCode"), v = m(
    () => ({
      "deliveryAddress.street": i,
      "deliveryAddress.houseNumberOrName": l,
      "deliveryAddress.country": t,
      "deliveryAddress.city": o,
      "deliveryAddress.postalCode": n
    }),
    [i, l, t, o, n]
  ), a = m(
    () => ({
      "billingAddress.street": u,
      "billingAddress.houseNumberOrName": c,
      "billingAddress.country": y,
      "billingAddress.city": A,
      "billingAddress.postalCode": b
    }),
    [u, c, y, A, b]
  );
  return { isAddressFieldRequired: p(
    (g) => C.includes(g) ? C.some((d) => {
      const r = v[d];
      return r !== void 0 && r !== "";
    }) : N.includes(g) ? N.some((d) => {
      const r = a[d];
      return r !== void 0 && r !== "";
    }) : !1,
    [v, a]
  ) };
};
export {
  I as useAddressChecker
};
