;
{
  try {
    let e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
    n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "4ea29964-505e-4385-9972-acbf1f4cb001", e._sentryDebugIdIdentifier = "sentry-dbid-4ea29964-505e-4385-9972-acbf1f4cb001");
  } catch (e) {
  }
}
;
import { au as hasText } from "./StoreProvider-CqQrndhS.js";
const validateLegalEntityIdentifier = (legalEntityIdentifier) => {
  if (!legalEntityIdentifier) {
    return true;
  }
  const isValidLength = legalEntityIdentifier ? legalEntityIdentifier.length === 20 : false;
  const hasLettersAndNumbers = legalEntityIdentifier ? /[a-zA-Z]/.test(legalEntityIdentifier) && /[0-9]/.test(legalEntityIdentifier) : false;
  return isValidLength && hasLettersAndNumbers;
};
const validateDateNotInTheFuture = (selectedDate) => {
  if (!selectedDate) return true;
  return new Date(selectedDate) <= /* @__PURE__ */ new Date();
};
const businessFinancingCompanyDetailsValidations = {
  numberOfEmployees: {
    modes: ["blur"],
    validate: (numberOfEmployees) => Number.isInteger(Number(numberOfEmployees)) && Number(numberOfEmployees) > 0,
    errorMessage: "atLeastOneEmployeeIsRequired"
  },
  netAssets: {
    modes: ["blur"],
    validate: (value) => !Number.isNaN(Number(value)),
    errorMessage: "pleaseEnterAValidNumber"
  },
  annualTurnover: {
    modes: ["blur"],
    validate: (value) => !Number.isNaN(Number(value)),
    errorMessage: "pleaseEnterAValidNumber"
  },
  financialReportingDate: {
    modes: ["blur"],
    validate: (value) => validateDateNotInTheFuture(value),
    errorMessage: "dateCannotBeInTheFuture"
  },
  legalEntityIdentifier: {
    modes: ["blur"],
    validate: (legalEntityIdentifier) => validateLegalEntityIdentifier(legalEntityIdentifier),
    errorMessage: "invalidFormat"
  },
  legalProceedingsDate: {
    modes: ["blur"],
    validate: (value) => validateDateNotInTheFuture(value),
    errorMessage: "dateCannotBeInTheFuture"
  }
};
const businessFinancingParentCompanyDetailsValidations = {
  numberOfEmployees: {
    modes: ["blur"],
    validate: (numberOfEmployees) => Number.isInteger(Number(numberOfEmployees)) && Number(numberOfEmployees) > 0,
    errorMessage: "atLeastOneEmployeeIsRequired"
  },
  legalEntityIdentifier: {
    modes: ["blur"],
    validate: (legalEntityIdentifier) => validateLegalEntityIdentifier(legalEntityIdentifier),
    errorMessage: "invalidFormat"
  },
  netAssets: {
    modes: ["blur"],
    validate: (value) => !Number.isNaN(Number(value)),
    errorMessage: "pleaseEnterAValidNumber"
  },
  annualTurnover: {
    modes: ["blur"],
    validate: (value) => !Number.isNaN(Number(value)),
    errorMessage: "pleaseEnterAValidNumber"
  },
  financialReportingDate: {
    modes: ["blur"],
    validate: (value) => validateDateNotInTheFuture(value),
    errorMessage: "dateCannotBeInTheFuture"
  },
  legalProceedingsDate: {
    modes: ["blur"],
    validate: (legalProceedingsDate) => validateDateNotInTheFuture(legalProceedingsDate),
    errorMessage: "dateCannotBeInTheFuture"
  },
  registrationAddress: {
    modes: ["blur"],
    validate: (registrationAddress) => hasText(registrationAddress?.address),
    errorMessage: "fieldIsRequired"
  }
};
const businessFinancingSoleProprietorValidations = {
  legalProceedingsDate: {
    modes: ["blur"],
    validate: (value) => validateDateNotInTheFuture(value),
    errorMessage: "dateCannotBeInTheFuture"
  }
};
const businessFinancingMultiformRules = {
  company: businessFinancingCompanyDetailsValidations,
  soleProprietor: businessFinancingSoleProprietorValidations,
  parentCompany: businessFinancingParentCompanyDetailsValidations,
  ultimateParentCompany: businessFinancingParentCompanyDetailsValidations
};
export {
  businessFinancingMultiformRules as b,
  validateDateNotInTheFuture as v
};
