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] = "58abf35d-e672-4372-bd73-6aa2dd68911c", e._sentryDebugIdIdentifier = "sentry-dbid-58abf35d-e672-4372-bd73-6aa2dd68911c");
} catch (e) {}
import { i as Typography } from "./translation-Br5wIPO-.js";
import { t as LegalEntityTypes } from "./legal-entity-type-VIfNYnJP.js";
import { t as localizeDateString } from "./localizeDateString-B7EYBFnd.js";
import { t as Currencies } from "./currency-CfIDpZh9.js";
import { jsx } from "preact/jsx-runtime";
//#region src/utils/formatCurrency.ts
var formatCurrency = (amount, currency, locale) => {
	const { format } = new Intl.NumberFormat(locale, currency ? {
		style: "currency",
		currency
	} : void 0);
	return format(amount);
};
var formatAmountWithCurrency = (amount, currency) => {
	const formattedAmount = formatCurrency(amount, currency, [
		"EUR",
		"BRL",
		"ARS",
		"CHF"
	].includes(currency.toUpperCase()) ? "de-DE" : "en-US");
	if (!formattedAmount) return;
	return `${formattedAmount} ${currency}`;
};
//#endregion
//#region src/components/EFP/tasks/SourceOfFundsDropin/types.ts
var additionalDataSchemaKeys = [
	"description",
	"dateOfFundsReceived",
	"purpose",
	"relationship",
	"originatorLegalEntityId",
	"amount",
	"financiers",
	"cryptocurrencyExchange",
	"dateOfSourceEvent",
	"website"
];
//#endregion
//#region src/components/EFP/tasks/SourceOfFundsDropin/utils.tsx
var allowedCurrencies = Object.entries(Currencies).map(([key]) => ({
	name: key,
	id: key
}));
var TODAY_DATE = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
var getSchemaForOriginator = (baseSchema, originatorType) => {
	if (originatorType === "organization") return [...baseSchema, "legalName"];
	if (originatorType === "individual") return [
		...baseSchema,
		"firstName",
		"lastName"
	];
	return baseSchema;
};
var getAdditionalDataSchemaKeys = (sourceOfFundsType, originatorType) => {
	switch (sourceOfFundsType) {
		case "business": return ["amount", "description"];
		case "donations": return getSchemaForOriginator([
			"dateOfFundsReceived",
			"purpose",
			"relationship",
			"country",
			"originatorType"
		], originatorType);
		case "inheritance": return getSchemaForOriginator([
			"dateOfFundsReceived",
			"amount",
			"relationship",
			"country",
			"originatorType"
		], originatorType);
		case "thirdPartyFunding": return ["financiers"];
		case "cryptocurrencyIncome": return ["cryptocurrencyExchange"];
		case "assetSale": return [
			"dateOfSourceEvent",
			"description",
			"amount"
		];
		case "gamblingWinnings": return [
			"dateOfSourceEvent",
			"website",
			"amount"
		];
		default: return [];
	}
};
var getServiceTranslation = (t, service) => {
	switch (service) {
		case "banking": return t(($) => $["businessBankAccounts"]);
		case "issuing": return t(($) => $["paymentCards"]);
		case "paymentProcessing": return t(($) => $["acceptingPayments"]);
		default: return t(($) => $["supportingDocuments"]);
	}
};
var getServiceTranslationSelectTitle = (t, service) => {
	switch (service) {
		case "banking": return t(($) => $["forYourBusinessBankAccounts"]);
		case "issuing": return t(($) => $["forYourPaymentCards"]);
		case "paymentProcessing": return t(($) => $["whenAcceptingPayments"]);
		default: return t(($) => $["supportingDocuments"]);
	}
};
var getServiceTranslationKey = (service) => {
	switch (service) {
		case "banking": return "bankingService";
		case "issuing": return "issuingService";
		case "paymentProcessing": return "paymentService";
		default: return "supportingDocuments";
	}
};
var getGettingStartedCardDetails = (sourceOfFundsType, t, data) => {
	const details = [];
	sourceOfFundsType?.forEach((type) => {
		switch (type) {
			case "amount":
				details.push({
					term: t(($) => $["amount"]),
					details: data?.amount?.currency && data?.amount?.value ? formatAmountWithCurrency(data.amount.value, data.amount.currency) : ""
				});
				break;
			case "description":
				details.push({
					term: t(($) => $["description"]),
					details: data?.description || ""
				});
				break;
			case "dateOfFundsReceived":
				details.push({
					term: t(($) => $["date"]),
					details: localizeDateString(data?.dateOfFundsReceived || "", navigator.language)
				});
				break;
			case "purpose":
				details.push({
					term: t(($) => $["reason"]),
					details: data?.purpose || ""
				});
				break;
			case "relationship":
				details.push({
					term: t(($) => $["relationship"]),
					details: data?.relationship || ""
				});
				break;
			case "originatorLegalEntityId":
				details.push({
					term: t(($) => $["benefactorDetails"]),
					details: [data?.legalName ? `${data?.legalName}` : `${data?.firstName} ${data?.lastName}`, /* @__PURE__ */ jsx(Typography, {
						color: "secondary",
						children: data?.country || ""
					}, "location")]
				});
				break;
			case "financiers":
				data?.financiers?.map((financier) => {
					return details.push({
						term: t(($) => $["investor"]),
						details: [
							`${financier?.firstName} ${financier?.lastName}`,
							/* @__PURE__ */ jsx(Typography, {
								color: "secondary",
								children: financier?.location || ""
							}, "location"),
							/* @__PURE__ */ jsx(Typography, {
								color: "secondary",
								children: financier?.amount?.currency && financier?.amount?.value ? formatAmountWithCurrency(financier.amount.value, financier.amount.currency) || "" : ""
							}, "value")
						]
					});
				});
				break;
			case "cryptocurrencyExchange":
				details.push({
					term: t(($) => $["cryptocurrencyExchange"]),
					details: data?.cryptocurrencyExchange || ""
				});
				break;
			case "dateOfSourceEvent":
				details.push({
					term: t(($) => $["dateOfSourceEvent"]),
					details: localizeDateString(data?.dateOfSourceEvent || "", navigator.language)
				});
				break;
			case "website":
				details.push({
					term: t(($) => $["website"]),
					details: data?.website || ""
				});
				break;
			default: break;
		}
	});
	return details;
};
var sourceOfFundsForms = {
	sourceOfFundsType: {
		formId: "sourceOfFundsType",
		formName: "selectASourceOfFunding",
		fields: ["type"]
	},
	additionalData: {
		formId: "additionalData",
		formName: "tellUsMoreAboutThisSource",
		fields: [...additionalDataSchemaKeys]
	}
};
var getSourceOfFundsRequiredFields = (data) => {
	const sourceOfFundsType = data?.sourceOfFundsType?.type;
	const originatorType = data?.additionalData?.originatorType;
	return {
		sourceOfFundsType: ["type"],
		additionalData: getAdditionalDataSchemaKeys(sourceOfFundsType, originatorType)
	};
};
var typesRequiringAdditionalData = [
	"business",
	"donations",
	"inheritance",
	"thirdPartyFunding",
	"cryptocurrencyIncome",
	"assetSale",
	"gamblingWinnings"
];
var getSourceOfFundsRequiredForms = (data) => {
	return Object.fromEntries(Object.entries(sourceOfFundsForms).filter(([form]) => {
		if (!data?.type || !typesRequiringAdditionalData.includes(data?.type)) return form !== sourceOfFundsForms.additionalData.formId;
		return form;
	}));
};
var getInputErrors = ({ formErrors, data, key, value }) => {
	const isEmpty = value === "" || value === null || value === void 0;
	let errors = { ...formErrors };
	if (isEmpty) errors = {
		...formErrors,
		[key]: "fieldIsRequired"
	};
	else errors = {
		...formErrors,
		[key]: void 0
	};
	if (["amount", "currency"].includes(key)) {
		if (data?.amount?.value && data?.amount?.currency) errors = {
			...formErrors,
			amount: void 0
		};
		if (!data?.amount?.currency) errors = {
			...formErrors,
			amount: "currencyIsRequired"
		};
		if (!data?.amount?.value) errors = {
			...formErrors,
			amount: "amountIsRequired"
		};
		else if (isNaN(data?.amount.value)) errors = {
			...formErrors,
			amount: "pleaseEnterAValidAmount"
		};
	}
	return errors;
};
var getPageHeadings = (type) => {
	switch (type) {
		case "cryptocurrencyIncome": return {
			heading: "cryptocurrencyProceedDetails",
			description: "tellUsMoreAboutTheCryptocurrency"
		};
		case "assetSale": return {
			heading: "propertySaleDetails",
			description: "tellUsMoreAboutTheProperty"
		};
		case "gamblingWinnings": return {
			heading: "gamblingProceedDetails",
			description: "tellUsMoreAboutTheGamblingProceeds"
		};
		case "business": return {
			heading: "businessEarningDetails",
			description: "tellUsMoreAboutThePreviousBusinessEarnings"
		};
		case "thirdPartyFunding": return {
			heading: "thirdPartyInvestmentDetails",
			description: "tellUsMoreAboutTheInvestors"
		};
		case "inheritance": return {
			heading: "inheritanceDetails",
			description: "tellUsMoreAboutTheInheritanceProceeds"
		};
		case "donations": return {
			heading: "giftOrDonationDetails",
			description: "tellUsMoreAboutTheGiftOrDonationProceeds"
		};
		default: return { heading: "tellUsMoreAboutThisSource" };
	}
};
var getDocumentRequirements = {
	loanAgreement: [
		"yourBusinessName",
		"lendersNameAndAddress",
		"principalAmount",
		"loanDate",
		"purposeOfLoan"
	],
	loanStatement: [
		"yourBusinessName",
		"lendersNameAndAddress",
		"principalAmount",
		"loanDate",
		"purposeOfLoan"
	],
	proofOfWalletOwnership: [
		"yourBusinessName",
		"nameOfTheCryptocurrencyExchange",
		"nameOfTheCoins",
		"issueDateWithinTheLast12Months"
	],
	transactionStatement: [
		"showsYourBusinessName",
		"showsTheNameOfTheCryptocurrencyExchange",
		"showsTheNameOfTheCoins",
		"issueDateWithinTheLast12Months"
	],
	taxFiling: [
		"showsYourBusinessName",
		"showsTheNameOfTheCryptocurrencyExchange",
		"showsTheNameOfTheCoins",
		"issueDateWithinTheLast12Months"
	],
	proofOfWinnings: [
		"winningProceedAmount",
		"dateOfWinning",
		"nameOfCasinoLottery"
	],
	winReport: [
		"winningProceedAmount",
		"dateOfWinning",
		"nameOfCasinoLottery"
	],
	winLossStatement: [
		"winningProceedAmount",
		"dateOfWinning",
		"nameOfCasinoLottery"
	],
	taxDeclaration: ["winningProceedAmount", "issuedWithinTheLast12Months"],
	annualStatements: [
		"yourBusinessName",
		"proofOfAnnualTurnoverAmount",
		"issueDateWithinTheLast12Months"
	],
	latestTaxFiling: [
		"yourBusinessName",
		"proofOfAnnualTurnoverAmount",
		"issueDateWithinTheLast12Months"
	],
	letterFromAccountant: [
		"yourBusinessName",
		"proofOfAnnualTurnoverAmount",
		"signatureAndDateWithinTheLast12Months"
	],
	recentInvoices: ["yourBusinessName", "invoicesFromThe3MostRecentMonths"],
	bankStatements: [
		"yourBusinessName",
		"issueDate",
		"banksLogoAndName",
		"allStatementsFrom3MostRecentMonths"
	],
	payslips: [
		"employersName",
		"issueDate",
		"banksLogoAndName",
		"allPayslipsFrom3MostRecentMonths"
	],
	contractSpecifyingDividends: [
		"theBusinessName",
		"termLengthAndDividendYield",
		"namesOfInvolvedParties"
	],
	latestTaxReturn: ["theBusinessName", "reportedDividendAmount"],
	investmentCertificate: ["theBusinessName", "termLengthAndDividendYield"],
	brokerStatements: [
		"theBrokerageName",
		"dividendAmount",
		"issueDateWithinTheLast3Months",
		"namesOfInvolvedParties"
	],
	investorContract: [
		"yourBusinessName",
		"nameAddressSignatureOfAllInvestors",
		"investmentAmount",
		"fundDepositDate"
	],
	investorMemo: [
		"yourBusinessName",
		"nameAddressSignatureOfAllInvestors",
		"investmentAmount",
		"fundDepositDate"
	],
	notarizedStatement: [
		"yourBusinessName",
		"nameAddressSignatureOfAllInvestors",
		"investmentAmount",
		"fundDepositDate"
	],
	partnershipAgreement: [
		"yourBusinessName",
		"nameAddressSignatureOfAllInvestors",
		"investmentAmount",
		"fundDepositDate"
	],
	proofOfOwnership: [
		"descriptionOfProperty",
		"netProceedAmount",
		"fundDepositDate",
		"propertyAddress"
	],
	letterFromAttorney: [
		"descriptionOfProperty",
		"netProceedAmount",
		"fundDepositDate",
		"propertyAddress"
	],
	saleContract: [
		"descriptionOfProperty",
		"netProceedAmount",
		"fundDepositDate",
		"propertyAddress"
	],
	taxDeclarationProperty: [
		"descriptionOfProperty",
		"netProceedAmount",
		"fundDepositDate",
		"propertyAddress"
	],
	titleDeed: [
		"descriptionOfProperty",
		"netProceedAmount",
		"fundDepositDate",
		"propertyAddress"
	],
	rentalAgreementOrLease: [
		"namesOfLandlordAndTenant",
		"propertyAddress",
		"rentAmount"
	],
	proofOfOwnershipRent: ["yourName", "propertyAddress"],
	giftOrDonationAgreement: [
		"donorsName",
		"fundTransferDate",
		"fundDepositAmount"
	],
	royaltyAgreement: [
		"descriptionOfIntellectualProperty",
		"royaltyAmount",
		"agreementPeriod"
	],
	taxDocuments: ["royaltyAmount", "provideMostRecentYearAvailable"],
	certificateOfInheritance: [
		"decedentsName",
		"inheritanceAmount",
		"fundDepositDate",
		"estateAttorneysName"
	],
	grantOfProbate: [
		"decedentsName",
		"inheritanceAmount",
		"fundDepositDate",
		"estateAttorneysName"
	],
	letterFromAttorneyOrNotary: [
		"decedentsName",
		"inheritanceAmount",
		"fundDepositDate",
		"estateAttorneysName"
	],
	signedCopyOfTheWill: [
		"decedentsName",
		"inheritanceAmount",
		"fundDepositDate",
		"estateAttorneysName"
	],
	pensionSlip: [
		"yourFullName",
		"previousEmployersName",
		"pensionPaymentAmount"
	],
	letterFromPreviousEmployer: [
		"yourFullName",
		"previousEmployersName",
		"pensionPaymentAmountOrTotalValue"
	],
	pensionStatement: [
		"yourFullName",
		"previousEmployersName",
		"pensionPaymentAmountOrTotalValue"
	],
	courtOrder: [
		"yourFullName",
		"totalSettlementAmount",
		"fundDepositDate"
	],
	letterFromAttorneyInsurance: [
		"yourFullName",
		"totalSettlementAmount",
		"fundDepositDate"
	],
	letterFromInsurer: [
		"yourFullName",
		"totalSettlementAmount",
		"fundDepositDate"
	],
	confirmationOfGrantOrSubsidy: [
		"benefactorsName",
		"subsidyOrGrantAmount",
		"timePeriodIfApplicable"
	]
};
var getDocumentLists = (sourceOfFundsType) => {
	switch (sourceOfFundsType) {
		case "loans": return ["loanAgreement", "loanStatement"];
		case "gamblingWinnings": return [
			"proofOfWinnings",
			"winReport",
			"winLossStatement",
			"taxDeclaration"
		];
		case "cryptocurrencyIncome": return [
			"proofOfWalletOwnership",
			"transactionStatement",
			"taxFiling"
		];
		case "business": return [
			"annualStatements",
			"latestTaxFiling",
			"letterFromAccountant",
			"recentInvoices"
		];
		case "employment": return ["bankStatements", "payslips"];
		case "dividendIncome": return [
			"contractSpecifyingDividends",
			"latestTaxReturn",
			"investmentCertificate",
			"brokerStatements"
		];
		case "thirdPartyFunding": return [
			"investorContract",
			"investorMemo",
			"notarizedStatement",
			"partnershipAgreement"
		];
		case "assetSale": return [
			"proofOfOwnership",
			"letterFromAttorney",
			"saleContract",
			"taxDeclarationProperty",
			"titleDeed"
		];
		case "rentalIncome": return ["rentalAgreementOrLease", "proofOfOwnership"];
		case "donations": return ["giftOrDonationAgreement"];
		case "royaltyIncome": return ["royaltyAgreement", "taxDocuments"];
		case "inheritance": return [
			"certificateOfInheritance",
			"grantOfProbate",
			"letterFromAttorneyOrNotary",
			"signedCopyOfTheWill"
		];
		case "pensionIncome": return [
			"pensionSlip",
			"letterFromPreviousEmployer",
			"pensionStatement"
		];
		case "insuranceSettlement": return [
			"courtOrder",
			"letterFromAttorneyInsurance",
			"letterFromInsurer"
		];
		case "financialAid": return ["confirmationOfGrantOrSubsidy"];
		default: return [];
	}
};
var parseSOFDocumentDescription = (t, documentDescription) => {
	if (!documentDescription || documentDescription.trim() === "" || !documentDescription.startsWith("$")) return;
	const [servicePart, typePart] = documentDescription.split("--");
	const selectedService = servicePart.split(":")[1];
	const documentType = typePart.split(":")[1];
	const parsed = {
		selectedService: getServiceTranslation(t, selectedService || ""),
		documentType: t(($) => $[documentType])
	};
	return `${parsed.selectedService} (${parsed.documentType})`;
};
var MISSING_DATA_SOF_UPLOAD_CODE = "2_8224";
var parseOriginatorDetails = (originatorDetails, businessLine) => {
	const copiedBusinessLine = { ...businessLine };
	if (copiedBusinessLine.sourceOfFunds) {
		if (originatorDetails.organization) {
			copiedBusinessLine.sourceOfFunds.legalName = originatorDetails.organization.legalName;
			copiedBusinessLine.sourceOfFunds.country = originatorDetails.organization?.registeredAddress?.country;
			copiedBusinessLine.sourceOfFunds.originatorType = "organization";
		}
		if (originatorDetails.individual) {
			copiedBusinessLine.sourceOfFunds.firstName = originatorDetails.individual.name?.firstName;
			copiedBusinessLine.sourceOfFunds.lastName = originatorDetails.individual.name?.lastName;
			copiedBusinessLine.sourceOfFunds.country = originatorDetails.individual.residentialAddress?.country;
			copiedBusinessLine.sourceOfFunds.originatorType = "individual";
		}
	}
	return copiedBusinessLine;
};
var getSourceOfFundsPayload = (sofType, additionalData) => {
	switch (sofType) {
		case "business": return {
			adyenProcessedFunds: false,
			type: "business",
			description: additionalData?.description,
			amount: {
				currency: additionalData?.amount?.currency ?? "USD",
				value: additionalData?.amount?.value ?? 0
			}
		};
		case "employment": return {
			adyenProcessedFunds: false,
			type: "employment"
		};
		case "donations": return {
			adyenProcessedFunds: false,
			type: "donations",
			dateOfFundsReceived: additionalData?.dateOfFundsReceived,
			purpose: additionalData?.purpose,
			relationship: additionalData?.relationship,
			originatorLegalEntityId: additionalData?.originatorLegalEntityId
		};
		case "inheritance": return {
			adyenProcessedFunds: false,
			type: "inheritance",
			dateOfFundsReceived: additionalData?.dateOfFundsReceived,
			amount: additionalData?.amount,
			relationship: additionalData?.relationship,
			originatorLegalEntityId: additionalData?.originatorLegalEntityId
		};
		case "financialAid": return {
			adyenProcessedFunds: false,
			type: "financialAid"
		};
		case "rentalIncome": return {
			adyenProcessedFunds: false,
			type: "rentalIncome"
		};
		case "dividendIncome": return {
			adyenProcessedFunds: false,
			type: "dividendIncome"
		};
		case "royaltyIncome": return {
			adyenProcessedFunds: false,
			type: "royaltyIncome"
		};
		case "pensionIncome": return {
			adyenProcessedFunds: false,
			type: "pensionIncome"
		};
		case "insuranceSettlement": return {
			adyenProcessedFunds: false,
			type: "insuranceSettlement"
		};
		case "thirdPartyFunding": return {
			adyenProcessedFunds: false,
			type: "thirdPartyFunding",
			financiers: additionalData?.financiers
		};
		case "cryptocurrencyIncome": return {
			adyenProcessedFunds: false,
			type: "cryptocurrencyIncome",
			cryptocurrencyExchange: additionalData?.cryptocurrencyExchange
		};
		case "assetSale": return {
			adyenProcessedFunds: false,
			type: "assetSale",
			cryptocurrencyExchange: additionalData?.cryptocurrencyExchange,
			dateOfSourceEvent: additionalData?.dateOfSourceEvent,
			description: additionalData?.description,
			amount: additionalData?.amount
		};
		case "loans": return {
			adyenProcessedFunds: false,
			type: "loans"
		};
		case "gamblingWinnings": return {
			adyenProcessedFunds: false,
			type: "gamblingWinnings",
			dateOfSourceEvent: additionalData?.dateOfSourceEvent,
			website: additionalData?.website && !additionalData.website.startsWith("http://") && !additionalData.website.startsWith("https://") ? `https://${additionalData.website}` : additionalData?.website,
			amount: additionalData?.amount
		};
		default: return { adyenProcessedFunds: true };
	}
};
var parseSofOriginatorPayload = (additionalData) => {
	let sofOriginator;
	if (additionalData?.originatorType === "individual") sofOriginator = {
		type: LegalEntityTypes.INDIVIDUAL,
		individual: {
			name: {
				firstName: additionalData?.firstName ?? "",
				lastName: additionalData?.lastName ?? ""
			},
			residentialAddress: { country: additionalData?.country }
		}
	};
	else sofOriginator = {
		type: LegalEntityTypes.ORGANIZATION,
		organization: {
			legalName: additionalData?.legalName ?? "",
			registeredAddress: { country: additionalData?.country }
		}
	};
	return sofOriginator;
};
var formatDateForInput = (isoDateString) => {
	if (!isoDateString) return "";
	try {
		const datePart = isoDateString.split("T")[0];
		if (/^\d{4}-\d{2}-\d{2}$/.test(datePart)) return datePart;
		return "";
	} catch {
		return "";
	}
};
var getSofCardDetails = (t, sourceOfFunds) => {
	if (!sourceOfFunds) return "";
	if (sourceOfFunds?.adyenProcessedFunds) return t(($) => $["transactionsOnThisPlatform"]);
	if (sourceOfFunds?.type) return sourceOfFunds?.type ? t(($) => $[sofCategoryItemMapper[sourceOfFunds.type]]) : "";
	return "";
};
var ALLOWED_SOF_SERVICES = ["issuing", "banking"];
/**
* Returns business lines that require SoF (based on ALLOWED_SOF_SERVICES)
*/
var getApplicableBusinessLines = (businessLines) => {
	return businessLines.filter((bl) => ALLOWED_SOF_SERVICES.includes(bl.service));
};
/**
* Deep comparison of SoF data.
* Returns true if all business-relevant fields are identical.
*/
var areSourceOfFundsEqual = (sof1, sof2) => {
	const type1 = sof1.sourceOfFundsType?.type;
	if (type1 !== sof2.sourceOfFundsType?.type) return false;
	if (type1 === "donations" || type1 === "inheritance") {
		const ad1 = sof1.additionalData || {};
		const ad2 = sof2.additionalData || {};
		if (ad1.originatorType !== ad2.originatorType) return false;
		if (ad1.originatorType === "individual") return ad1.firstName === ad2.firstName && ad1.lastName === ad2.lastName && ad1.country === ad2.country && ad1.relationship === ad2.relationship && ad1.purpose === ad2.purpose && ad1.dateOfFundsReceived === ad2.dateOfFundsReceived;
		else if (ad1.originatorType === "organization") return ad1.legalName === ad2.legalName && ad1.country === ad2.country && ad1.relationship === ad2.relationship && ad1.purpose === ad2.purpose && ad1.dateOfFundsReceived === ad2.dateOfFundsReceived;
		return false;
	}
	const ad1 = sof1.additionalData || {};
	const ad2 = sof2.additionalData || {};
	const keys1 = Object.keys(ad1);
	const keys2 = Object.keys(ad2);
	if (keys1.length !== keys2.length) return false;
	return keys1.every((key) => {
		const val1 = ad1[key];
		const val2 = ad2[key];
		return JSON.stringify(val1) === JSON.stringify(val2);
	});
};
var SOF_INVALID_INPUT_ERROR_CODES = ["1_93", "1_94"];
var getRelevantErrors = (problems, targetCodes) => {
	if (!problems) return false;
	return problems.flatMap((problem) => (problem.verificationErrors || []).filter((error) => targetCodes.includes(error.code) || (error.subErrors || []).some((sub) => targetCodes.includes(sub.code))));
};
var getUniqueRemediationActions = (error) => {
	return [...error.remediatingActions || [], ...error.subErrors?.flatMap((sub) => sub.remediatingActions || []) || []].filter((action, i, arr) => arr.findIndex((a) => a.code === action.code) === i);
};
var sofCategoryItemMapper = {
	business: "otherBusinessEarnings",
	employment: "employmentWages",
	cryptocurrencyIncome: "cryptocurrency",
	dividendIncome: "dividends",
	loans: "loans",
	financialAid: "financialAid",
	thirdPartyFunding: "thirdPartyFunding",
	rentalIncome: "rentalIncome",
	royaltyIncome: "royaltyIncome",
	gamblingWinnings: "gambling",
	inheritance: "inheritance",
	pensionIncome: "pensionIncome",
	insuranceSettlement: "insuranceSettlement",
	assetSale: "propertySale",
	donations: "giftOrDonation"
};
/**
* Prepares additional data for originator creation/update.
* When useSameAs is true, appends the originatorLegalEntityId from the source
* so that createOrUpdateOriginator can update the existing LE instead of creating a new one.
*/
var getAdditionalDataForOriginator = (additionalData, sourceAdditionalData, useSameAs) => {
	if (useSameAs) return {
		...additionalData,
		originatorLegalEntityId: sourceAdditionalData?.originatorLegalEntityId
	};
	return additionalData;
};
//#endregion
export { formatCurrency as A, getSourceOfFundsRequiredForms as C, parseSofOriginatorPayload as D, parseSOFDocumentDescription as E, sofCategoryItemMapper as O, getSourceOfFundsRequiredFields as S, parseOriginatorDetails as T, getServiceTranslation as _, allowedCurrencies as a, getSofCardDetails as b, getAdditionalDataForOriginator as c, getDocumentLists as d, getDocumentRequirements as f, getRelevantErrors as g, getPageHeadings as h, TODAY_DATE as i, formatAmountWithCurrency as k, getAdditionalDataSchemaKeys as l, getInputErrors as m, MISSING_DATA_SOF_UPLOAD_CODE as n, areSourceOfFundsEqual as o, getGettingStartedCardDetails as p, SOF_INVALID_INPUT_ERROR_CODES as r, formatDateForInput as s, ALLOWED_SOF_SERVICES as t, getApplicableBusinessLines as u, getServiceTranslationKey as v, getUniqueRemediationActions as w, getSourceOfFundsPayload as x, getServiceTranslationSelectTitle as y };
