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] = "5cf436b9-8926-44af-8bc5-cc2c99a87b88", e._sentryDebugIdIdentifier = "sentry-dbid-5cf436b9-8926-44af-8bc5-cc2c99a87b88");
} catch (e) {}
import { t as LegalEntityTypes } from "./legal-entity-type-VIfNYnJP.js";
import { c as entriesOf, n as cloneObject } from "./AnalyticsContext-C0HNdPss.js";
import { i as TaskStatuses, r as TASK_STATUS_PRIORITY } from "./taskStatus-CvMqhrOK.js";
//#region src/core/models/api/verification-error.ts
var VerificationErrorTypes = {
	DATA_MISSING: "dataMissing",
	INVALID_INPUT: "invalidInput",
	PENDING_STATUS: "pendingStatus",
	DATA_REVIEW: "dataReview",
	REJECTED: "rejected"
};
//#endregion
//#region src/core/errorMapping.ts
/**
* Mapping of remediation code to impacted api field path
*/
var invalidInputRemediationActionMappings = {
	"1_100": [],
	"1_101": [],
	"1_102": [{ key: "documents" }],
	"1_300": [
		{ key: "individual.birthData.dateOfBirth" },
		{ key: "individual.identificationData.number" },
		{ key: "individual.name.firstName" },
		{ key: "individual.name.lastName" },
		{ key: "individual.residentialAddress" }
	],
	"1_301": [{ key: "passport" }, { key: "idVerificationMethod" }],
	"1_302": [{ key: "passport" }, { key: "idVerificationMethod" }],
	"1_303": [{ key: "passport" }, { key: "idVerificationMethod" }],
	"1_304": [{ key: "proofOfResidency" }],
	"1_305": [{ key: "proofOfResidency" }],
	"1_306": [{ key: "proofOfResidency" }],
	"1_307": [{ key: "proofOfNationalIdNumber" }],
	"1_308": [{ key: "proofOfNationalIdNumber" }],
	"1_309": [{ key: "proofOfNationalIdNumber" }],
	"1_316": [{ key: "individual.identificationData.number" }],
	"1_319": [{ key: "individual.residentialAddress" }],
	"1_320": [{ key: "proofOfResidency" }],
	"1_321": [{ key: "individual.residentialAddress.street" }],
	"1_500": [
		{ key: "organization.legalName" },
		{ key: "organization.registrationNumber" },
		{ key: "organization.taxId" },
		{ key: "organization.registeredAddress" }
	],
	"1_501": [{ key: "registrationDocument" }],
	"1_502": [{ key: "registrationDocument" }],
	"1_503": [{ key: "vatDocument" }],
	"1_504": [{ key: "vatDocument" }],
	"1_505": [{ key: "proofOfAddress" }],
	"1_506": [{ key: "proofOfAddress" }],
	"1_507": [{ key: "proofOfOwnership" }],
	"1_508": [{ key: "proofOfOwnership" }],
	"1_512": [{ key: "vatDocument" }, { key: "organization.vatNumber" }],
	"1_513": [{ key: "vatDocument" }, { key: "organization.vatNumber" }],
	"1_524": [{ key: "organization.registeredAddress.street" }],
	"1_600": [{ key: "soleProprietorship.name" }, { key: "soleProprietorship.registeredAddress" }],
	"1_601": [{ key: "constitutionalDocument" }],
	"1_602": [{ key: "constitutionalDocument" }],
	"1_603": [{ key: "constitutionalDocument" }],
	"1_700": [{ key: "bankAccount" }],
	"1_701": [{ key: "bankAccount" }],
	"1_702": [{ key: "bankAccount" }],
	"1_703": [{ key: "bankStatement" }],
	"1_704": [{ key: "bankStatement" }],
	"1_705": [{ key: "bankStatement" }],
	"1_803": [{ key: "proofOfDirector" }],
	"1_804": [{ key: "proofOfDirector" }],
	"1_800": [{ key: "proofOfSignatory" }],
	"1_801": [{ key: "proofOfSignatory" }],
	"1_802": [{ key: "proofOfSignatory" }],
	"1_3083": [{ key: "proofOfResidency" }],
	"2_243": [{ key: "organization.support.phone" }, { key: "individual.support.phone" }],
	"2_215": [{ key: "passport" }, { key: "idVerificationMethod.idDocument" }]
};
var dataMissingRemediationsToFieldsMap = {
	"1_301": ["passport", "idVerificationMethod"],
	"1_501": ["registrationDocument"],
	"1_503": ["proofOfOrganizationTaxInfo"],
	"1_512": ["vatDocument"],
	"1_803": ["proofOfDirector"],
	"1_800": ["proofOfSignatory"],
	"2_117": ["organization.registrationNumber"],
	"2_118": ["organization.taxId"],
	"2_125": ["organization.type"],
	"2_133": ["organization.doingBusinessAs"],
	"2_153": ["phoneNumber"],
	"2_158": ["vatNumber"],
	"2_170": ["organization.taxInformation"],
	"2_184": ["constitutionalDocument"],
	"2_188": ["proofOfOwnership"],
	"2_194": ["organization.registeredAddress.postalCode"],
	"2_206": ["organization.registeredAddress.street"],
	"2_208": ["organization.registeredAddress.city"],
	"2_214": ["proofOfFundingOrWealthSource"],
	"2_222": ["proofOfRelationship"],
	"2_225": ["organization.financialReports"]
};
var CUSTOMER_SUPPORT_DATA_MISSING_ERROR_CODES = [
	"2_8247",
	"2_8248",
	"2_8249",
	"2_8250"
];
var DATA_MISSING_DECISION_MAKER_ERROR_CODE_MAPPING = {
	"2_8064": "2_123",
	"2_8067": "2_124",
	"2_8189": "2_151",
	"2_8193": "2_185"
};
var OVERRIDE_REMEDIATION_CODE = {
	"1_501": {
		code: "1_503",
		message: "Upload a tax document"
	},
	"1_502": {
		code: "1_504",
		message: "Upload a different tax document"
	}
};
var OVERRIDE_SUB_ERROR_REMEDIATING_ACTIONS = {
	"1_3083": [{
		code: "1_319",
		message: "Update individual details"
	}, {
		code: "1_320",
		message: "Upload proof of residency"
	}],
	"1_3072": [{
		code: "1_300",
		message: "Update individual details"
	}, {
		code: "1_302",
		message: "Upload a different ID document"
	}],
	"1_5012": [OVERRIDE_REMEDIATION_CODE["1_501"], {
		code: "1_500",
		message: "Update organization details"
	}],
	"1_5013": [OVERRIDE_REMEDIATION_CODE["1_501"], {
		code: "1_500",
		message: "Update organization details"
	}],
	"1_5015": [OVERRIDE_REMEDIATION_CODE["1_501"], {
		code: "1_500",
		message: "Update organization details"
	}],
	"1_5017": [OVERRIDE_REMEDIATION_CODE["1_501"], {
		code: "1_500",
		message: "Update organization details"
	}],
	"1_5020": [OVERRIDE_REMEDIATION_CODE["1_501"]],
	"1_5021": [OVERRIDE_REMEDIATION_CODE["1_502"]],
	"1_5022": [OVERRIDE_REMEDIATION_CODE["1_502"]],
	"1_5024": [OVERRIDE_REMEDIATION_CODE["1_502"], {
		code: "1_500",
		message: "Update organization details"
	}],
	"1_5035": [OVERRIDE_REMEDIATION_CODE["1_502"], {
		code: "1_500",
		message: "Update organization details"
	}]
};
var OVERRIDE_SUB_ERROR = {
	"1_3083": {
		code: "1_3083",
		message: "The name or residential address couldn't be verified.",
		type: VerificationErrorTypes.INVALID_INPUT,
		remediatingActions: OVERRIDE_SUB_ERROR_REMEDIATING_ACTIONS["1_3083"]
	},
	"1_5012": {
		code: "1_5012",
		message: "The submitted company type didn't match the one on the registry",
		type: VerificationErrorTypes.INVALID_INPUT,
		remediatingActions: OVERRIDE_SUB_ERROR_REMEDIATING_ACTIONS["1_5012"]
	},
	"1_5013": {
		code: "1_5013",
		message: "The company was not found in the database",
		type: VerificationErrorTypes.INVALID_INPUT,
		remediatingActions: OVERRIDE_SUB_ERROR_REMEDIATING_ACTIONS["1_5013"]
	},
	"1_5015": {
		code: "1_5017",
		message: "The tax ID number didn't match the legal business name",
		type: VerificationErrorTypes.INVALID_INPUT,
		remediatingActions: OVERRIDE_SUB_ERROR_REMEDIATING_ACTIONS["1_5015"]
	},
	"1_5017": {
		code: "1_5017",
		message: "The tax ID number didn't match the legal business name",
		type: VerificationErrorTypes.INVALID_INPUT,
		remediatingActions: OVERRIDE_SUB_ERROR_REMEDIATING_ACTIONS["1_5017"]
	},
	"1_5020": {
		code: "1_5036",
		message: "Tax document is missing.",
		type: VerificationErrorTypes.INVALID_INPUT,
		remediatingActions: OVERRIDE_SUB_ERROR_REMEDIATING_ACTIONS["1_5020"]
	},
	"1_5021": {
		code: "1_5039",
		message: "The tax document was too low quality.",
		type: VerificationErrorTypes.INVALID_INPUT,
		remediatingActions: OVERRIDE_SUB_ERROR_REMEDIATING_ACTIONS["1_5021"]
	},
	"1_5022": {
		code: "1_5040",
		message: "The tax document was too old.",
		type: VerificationErrorTypes.INVALID_INPUT,
		remediatingActions: OVERRIDE_SUB_ERROR_REMEDIATING_ACTIONS["1_5022"]
	},
	"1_5024": {
		code: "1_5024",
		message: "The registration document did not show the company type",
		type: VerificationErrorTypes.INVALID_INPUT,
		remediatingActions: OVERRIDE_SUB_ERROR_REMEDIATING_ACTIONS["1_5024"]
	},
	"1_5035": {
		code: "1_5038",
		message: "The tax document wasn't a supported document type.",
		type: VerificationErrorTypes.INVALID_INPUT,
		remediatingActions: OVERRIDE_SUB_ERROR_REMEDIATING_ACTIONS["1_5035"]
	}
};
var OVERRIDE_DATA_MISSING_ERROR = {
	"2_8141": {
		code: "2_8162",
		message: "'proofOfOrganizationTaxInfo' was missing",
		type: VerificationErrorTypes.DATA_MISSING,
		remediatingActions: [OVERRIDE_REMEDIATION_CODE["1_501"]]
	},
	"1_3083": {
		code: "1_3083",
		message: "The name or residential address couldn't be verified.",
		type: VerificationErrorTypes.INVALID_INPUT,
		subErrors: [{
			code: "1_3083",
			message: "Individual details didn't match the ID document",
			type: VerificationErrorTypes.INVALID_INPUT,
			remediatingActions: OVERRIDE_SUB_ERROR_REMEDIATING_ACTIONS["1_3083"]
		}]
	}
};
/**
* This is a temporary fix for CORE-7011
*
* We are remapping error/remediation codes for US organizations to ensure we ask for a tax document instead of a registration document.
* This will be removed once we complete the refactor in KYC to return the approriate codes.
*
* https://docs.adyen.com/platforms/kyc-verification-codes/general-verification-errors/#organization-check
*/
var overrideError = (verificationError) => {
	switch (verificationError.type) {
		case VerificationErrorTypes.DATA_MISSING: switch (verificationError.code) {
			case "2_8141": return OVERRIDE_DATA_MISSING_ERROR["2_8141"];
			case "1_3083": return {
				...OVERRIDE_DATA_MISSING_ERROR["1_3083"],
				subErrors: [OVERRIDE_SUB_ERROR["1_3083"]]
			};
			default: return verificationError;
		}
		case VerificationErrorTypes.INVALID_INPUT: switch (verificationError.code) {
			case "1_50": return {
				...verificationError,
				subErrors: verificationError.subErrors?.map((subError) => OVERRIDE_SUB_ERROR[subError.code] ?? subError)
			};
			case "1_52": return {
				...verificationError,
				code: "1_53",
				message: "Tax document didn't meet requirements",
				remediatingActions: verificationError.remediatingActions?.map((remediation) => OVERRIDE_REMEDIATION_CODE[remediation.code] ?? remediation),
				subErrors: verificationError.subErrors?.map((subError) => OVERRIDE_SUB_ERROR[subError.code] ?? subError)
			};
			default: return verificationError;
		}
		default: return verificationError;
	}
};
//#endregion
//#region src/core/models/api/entity-type.ts
var EntityTypes = {
	BANK_ACCOUNT: "BankAccount",
	LEGAL_ENTITY: "LegalEntity"
};
var customerSupportRemediationKeyMapping = {
	"organization.support.email": "customerSupport.email",
	"individual.support.email": "customerSupport.email",
	"organization.support.phone": "customerSupport.phoneNumber.number",
	"individual.support.phone": "customerSupport.phoneNumber.number"
};
//#endregion
//#region src/components/BankAccount/mapping/payoutKeyMappings.ts
/**
* **ComponentsKeyMapping -> Use it in formatObject function to create componentSchema object from API object
* **ApiKeyMapping -> Use it in formatObject function to create API Schema object from component data
*/
var payoutBaseMapping = {
	id: "payoutAccountDetails.transferInstrumentId",
	"bankAccount.bankName": "payoutAccountDetails.bankName",
	"bankAccount.countryCode": "payoutVerificationMethod.bankCountry",
	"bankAccount.accountIdentification.iban": "payoutAccountDetails.iban",
	"bankAccount.accountIdentification.accountNumber": "payoutAccountDetails.bankAccountNumber",
	"bankAccount.accountIdentification.bsbCode": "payoutAccountDetails.branchCode",
	"bankAccount.accountIdentification.institutionNumber": "payoutAccountDetails.bankCode",
	"bankAccount.accountIdentification.transitNumber": "payoutAccountDetails.branchCode",
	"bankAccount.accountIdentification.bankCode": "payoutAccountDetails.bankCode",
	"bankAccount.accountIdentification.clearingCode": "payoutAccountDetails.bankCode",
	"bankAccount.accountIdentification.clearingNumber": "payoutAccountDetails.branchCode",
	"bankAccount.accountIdentification.bic": "payoutAccountDetails.swiftCode",
	"bankAccount.accountIdentification.sortCode": "payoutAccountDetails.branchCode",
	"bankAccount.accountIdentification.routingNumber": "payoutAccountDetails.branchCode"
};
var crossBorderMapping = {
	"bankAccount.countryCode": "payoutCountryDetails.bankCountry",
	"bankAccount.preferredCurrencyCode": "payoutCountryDetails.preferredCurrency"
};
var payoutComponentKeyMapping = { ...payoutBaseMapping };
var remediationPayoutApiKeyMapping = {
	[EntityTypes.BANK_ACCOUNT]: "payoutAccountDetails",
	...payoutComponentKeyMapping,
	["bankStatement"]: "payoutAccountDocuments.bankStatementDocument"
};
//#endregion
//#region src/utils/mapping/reverseMapping.ts
/**
* Reverses a {@link MappingRecord}.
*
* @example
* ```ts
* const mapping = {a:1, b:2,c:3};
* reverseMapping(mapping); => {1:'a', 2: 'b', 3: 'c'}
* ```
*/
function reverseMapping(mapping) {
	return Object.fromEntries(Object.entries(mapping).map(([key, value]) => [value, key]));
}
//#endregion
//#region src/components/Business/mapping/businessDetails/businessDetailsKeyMappings.ts
var businessDetailsBaseMapping = {
	"basicInformation.country": "organization.registeredAddress.country",
	"basicInformation.legalCompanyName": "organization.legalName",
	"basicInformation.stateOrProvince": "organization.registeredAddress.stateOrProvince",
	"basicInformation.registrationNumber": "organization.registrationNumber",
	"basicInformation.taxInformation": "organization.taxInformation",
	"basicInformation.countryOfGoverningLaw": "organization.countryOfGoverningLaw",
	"companyStructure.entityType": "organization.type",
	"additionalInformation.legalFormDescription": "organization.legalFormDescription",
	"additionalInformation.doingBusinessAs": "organization.doingBusinessAs",
	"additionalInformation.hasDoingBusinessAs": "organization.doingBusinessAsAbsent",
	"additionalInformation.registrationNumber": "organization.registrationNumber",
	"additionalInformation.exemptedFromRegistrationNumber": "organization.registrationNumberAbsent",
	"additionalInformation.taxInformation": "organization.taxInformation",
	"additionalInformation.vatNumber": "organization.vatNumber",
	"additionalInformation.vatAbsenceReason": "organization.vatAbsenceReason",
	"additionalInformation.dateOfIncorporation": "organization.dateOfIncorporation",
	"additionalInformation.stockExchangeMIC": "organization.stockData.marketIdentifier",
	"additionalInformation.stockISIN": "organization.stockData.stockNumber",
	"additionalInformation.stockTickerSymbol": "organization.stockData.tickerSymbol",
	"additionalInformation.registrationAddress.city": "organization.registeredAddress.city",
	"additionalInformation.registrationAddress.country": "organization.registeredAddress.country",
	"additionalInformation.registrationAddress.postalCode": "organization.registeredAddress.postalCode",
	"additionalInformation.registrationAddress.stateOrProvince": "organization.registeredAddress.stateOrProvince",
	"additionalInformation.registrationAddress.address": "organization.registeredAddress.street",
	"additionalInformation.registrationAddress.otherAddressInformation": "organization.registeredAddress.street2",
	"additionalInformation.operationalAddress.city": "organization.principalPlaceOfBusiness.city",
	"additionalInformation.operationalAddress.country": "organization.principalPlaceOfBusiness.country",
	"additionalInformation.operationalAddress.postalCode": "organization.principalPlaceOfBusiness.postalCode",
	"additionalInformation.operationalAddress.stateOrProvince": "organization.principalPlaceOfBusiness.stateOrProvince",
	"additionalInformation.operationalAddress.address": "organization.principalPlaceOfBusiness.street",
	"additionalInformation.operationalAddress.otherAddressInformation": "organization.principalPlaceOfBusiness.street2",
	"additionalInformation.eInvoicingCode": "organization.eInvoicingCode",
	"additionalInformation.legalForm": "organization.legalForm"
};
var businessDetailsComponentsKeyMapping = {
	"additionalInformation.exemptedFromVat": "organization.vatAbsenceReason",
	...businessDetailsBaseMapping
};
var businessDetailsApiKeyMapping = { ...reverseMapping(businessDetailsBaseMapping) };
/**
* Base api mappings do not contain document mappings as the api used for document upload is different
* For remediation mappings adding document mapping additionally along with the apiKeyMapping
*/
var businessDetailsDocumentMapping = {
	["registrationDocument"]: "companyRegistrationDocument.registrationDocument",
	["vatDocument"]: "companyTaxDocument.taxDocument",
	["proofOfOrganizationTaxInfo"]: "companyTaxDocument.taxDocument",
	["proofOfDirector"]: "companyProofOfDirectorDocument.proofOfDirector",
	["proofOfSignatory"]: "companyProofOfSignatoryDocument.proofOfSignatory",
	["proofOfOwnership"]: "companyProofOfOwnershipDocument.proofOfOwnership"
};
var remediationBusinessDetailsApiKeyMapping = {
	...businessDetailsApiKeyMapping,
	...businessDetailsDocumentMapping
};
//#endregion
//#region src/components/Business/mapping/businessDetails/solePropBusinessDetailsKeyMappings.ts
var solePropBusinessDetailsBaseMapping = {
	"basicInformation.country": "soleProprietorship.countryOfGoverningLaw",
	"basicInformation.legalCompanyName": "soleProprietorship.name",
	"basicInformation.stateOrProvince": "soleProprietorship.registeredAddress.stateOrProvince",
	"basicInformation.countryOfGoverningLaw": "soleProprietorship.countryOfGoverningLaw",
	"additionalInformation.hasDoingBusinessAs": "soleProprietorship.doingBusinessAsAbsent",
	"additionalInformation.doingBusinessAs": "soleProprietorship.doingBusinessAs",
	"additionalInformation.registrationNumber": "soleProprietorship.registrationNumber",
	"additionalInformation.vatNumber": "soleProprietorship.vatNumber",
	"additionalInformation.vatAbsenceReason": "soleProprietorship.vatAbsenceReason",
	"additionalInformation.taxInformation": "soleProprietorship.taxInformation",
	"additionalInformation.exemptedFromTax": "soleProprietorship.taxAbsent",
	"additionalInformation.dateOfIncorporation": "soleProprietorship.dateOfIncorporation",
	"additionalInformation.registrationAddress.city": "soleProprietorship.registeredAddress.city",
	"additionalInformation.registrationAddress.country": "soleProprietorship.registeredAddress.country",
	"additionalInformation.registrationAddress.postalCode": "soleProprietorship.registeredAddress.postalCode",
	"additionalInformation.registrationAddress.stateOrProvince": "soleProprietorship.registeredAddress.stateOrProvince",
	"additionalInformation.registrationAddress.address": "soleProprietorship.registeredAddress.street",
	"additionalInformation.registrationAddress.otherAddressInformation": "soleProprietorship.registeredAddress.street2",
	"additionalInformation.operationalAddress.city": "soleProprietorship.principalPlaceOfBusiness.city",
	"additionalInformation.operationalAddress.country": "soleProprietorship.principalPlaceOfBusiness.country",
	"additionalInformation.operationalAddress.postalCode": "soleProprietorship.principalPlaceOfBusiness.postalCode",
	"additionalInformation.operationalAddress.stateOrProvince": "soleProprietorship.principalPlaceOfBusiness.stateOrProvince",
	"additionalInformation.operationalAddress.address": "soleProprietorship.principalPlaceOfBusiness.street",
	"additionalInformation.operationalAddress.otherAddressInformation": "soleProprietorship.principalPlaceOfBusiness.street2"
};
var solePropBusinessDetailsKeyMapping = {
	"additionalInformation.exemptedFromVat": "soleProprietorship.vatAbsenceReason",
	...solePropBusinessDetailsBaseMapping
};
var solePropBusinessDetailsApiKeyMapping = { ...reverseMapping(solePropBusinessDetailsBaseMapping) };
var solePropBusinessDetailsDocumentMapping = { ["constitutionalDocument"]: "companyConstitutionalDocument.constitutionalDocument" };
var remediationSolePropBusinessDetailsApiKeyMapping = {
	...solePropBusinessDetailsApiKeyMapping,
	...solePropBusinessDetailsDocumentMapping
};
//#endregion
//#region src/components/Individual/mapping/individualKeyMappings.ts
var individualObscuredFields = ["additionalPersonalDetails.idNumber", "additionalPersonalDetails.idNumberExempt"];
var individualBaseMapping = {
	"basicDetails.firstName": "individual.name.firstName",
	"basicDetails.lastName": "individual.name.lastName",
	"basicDetails.phoneNumber.number": "individual.phone.number",
	"basicDetails.phoneNumber.phoneCountryCode": "individual.phone.phoneCountryCode",
	"basicDetails.phoneNumber.type": "individual.phone.type",
	"basicDetails.email": "individual.email",
	"additionalPersonalDetails.placeOfBirth": "individual.birthData.placeOfBirth",
	"additionalPersonalDetails.birthDate": "individual.birthData.dateOfBirth",
	"additionalPersonalDetails.idNumber": "individual.identificationData.number",
	"additionalPersonalDetails.idNumberExempt": "individual.identificationData.nationalIdExempt",
	"additionalPersonalDetails.typeOfIdentity": "individual.identificationData.type",
	"additionalPersonalDetails.issuerState": "individual.identificationData.issuerState",
	"additionalPersonalDetails.licenseCardNumber": "individual.identificationData.cardNumber",
	"additionalPersonalDetails.expiryDate": "individual.identificationData.expiryDate",
	"additionalPersonalDetails.nationality": "individual.nationality",
	"additionalPersonalDetails.taxInformation": "individual.taxInformation",
	"additionalPersonalDetails.city": "individual.residentialAddress.city",
	"additionalPersonalDetails.country": "individual.residentialAddress.country",
	"additionalPersonalDetails.postalCode": "individual.residentialAddress.postalCode",
	"additionalPersonalDetails.stateOrProvince": "individual.residentialAddress.stateOrProvince",
	"additionalPersonalDetails.address": "individual.residentialAddress.street",
	"additionalPersonalDetails.otherAddressInformation": "individual.residentialAddress.street2"
};
var individualApiKeyMapping = { ...reverseMapping(individualBaseMapping) };
var individualDocumentMapping = {
	["passport"]: "idVerificationMethod.idDocument",
	["proofOfResidency"]: "proofOfResidency.proofOfResidency",
	["proofOfNationalIdNumber"]: "proofOfNationalId.proofOfNationalId",
	["proofOfRelationship"]: "proofOfRelationship.proofOfRelationship"
};
var remediationIndividualApiKeyMapping = {
	...individualApiKeyMapping,
	...individualDocumentMapping
};
//#endregion
//#region src/components/Trust/mapping/trustKeyMappings.ts
var trustBaseMapping = {
	"trustRegistrationDetails.trustType": "trust.type",
	"trustRegistrationDetails.legalName": "trust.name",
	"trustRegistrationDetails.doingBusinessAs": "trust.doingBusinessAs",
	"trustRegistrationDetails.hasDoingBusinessAs": "trust.doingBusinessAsAbsent",
	"trustRegistrationDetails.country": "trust.countryOfGoverningLaw",
	"trustRegistrationDetails.registrationNumber": "trust.registrationNumber",
	"trustRegistrationDetails.taxInformation": "trust.taxInformation",
	"trustRegistrationAddress.registrationAddress.city": "trust.registeredAddress.city",
	"trustRegistrationAddress.registrationAddress.country": "trust.registeredAddress.country",
	"trustRegistrationAddress.registrationAddress.postalCode": "trust.registeredAddress.postalCode",
	"trustRegistrationAddress.registrationAddress.stateOrProvince": "trust.registeredAddress.stateOrProvince",
	"trustRegistrationAddress.registrationAddress.address": "trust.registeredAddress.street",
	"trustRegistrationAddress.registrationAddress.otherAddressInformation": "trust.registeredAddress.street2",
	"trustRegistrationAddress.operationalAddress.city": "trust.principalPlaceOfBusiness.city",
	"trustRegistrationAddress.operationalAddress.country": "trust.principalPlaceOfBusiness.country",
	"trustRegistrationAddress.operationalAddress.postalCode": "trust.principalPlaceOfBusiness.postalCode",
	"trustRegistrationAddress.operationalAddress.stateOrProvince": "trust.principalPlaceOfBusiness.stateOrProvince",
	"trustRegistrationAddress.operationalAddress.address": "trust.principalPlaceOfBusiness.street",
	"trustRegistrationAddress.operationalAddress.otherAddressInformation": "trust.principalPlaceOfBusiness.street2"
};
var trustComponentsKeyMapping = { ...trustBaseMapping };
var trustApiKeyMapping = { ...reverseMapping(trustBaseMapping) };
var trustDocumentMapping = { ["constitutionalDocument"]: "trustConstitutionalDocument.constitutionalDocument" };
var remediationTrustKeyMapping = {
	...trustApiKeyMapping,
	...trustDocumentMapping
};
//#endregion
//#region src/utils/api/processCapabilities.ts
/**
* An array of verification error codes that are attached to the main LegalEntity however they are
* unrelated to the task status so should be omitted from the processing of the capabilities.
*
* List of Adyen error codes can be found here @see {@link https://docs.adyen.com/platforms/kyc-verification-codes/general-verification-errors/}
*/
var UNRELATED_DATA_MISSING_ERROR_CODES = [
	"2_8036",
	"2_8064",
	"2_8067",
	"2_8183",
	"2_8189",
	"2_8190",
	"2_8191",
	"2_8193",
	"2_8247",
	"2_8249",
	"2_8248",
	"2_8250"
];
var UNRELATED_INVALID_INPUT_ERROR_CODES = [
	"1_14",
	"2_901",
	"2_902"
];
/**
* Whitelist of dataMissing error codes that should be displayed on the Summary page
* alongside invalidInput errors.

* Requirements for whitelisted errors:
* - Must be a dataMissing error type
* - RemediatingActions must be mapped in the appropriate key mapping files
*/
var WHITELISTED_DATA_MISSING_ERROR_CODES = ["2_8210"];
/** *
* Processes the capability problems and parses the problems into below form
* The resulting object segregates the errors based on form and fields they are mapped to
* and maps them to a task item. Also provides the errorCounts per entity and per form.
*
* @example
* ```
* {
*   BankAccount: { // Group errors based on supporting entity type
*       [id]: {
*           errors: {
*               [formId]: {
*                   [parentErrorCode]: {
*                       [subErrorCode]: [
*                           {
*                               { code: '1_300', forms: ['personalDetails'], fields: ['firstName', 'lastName'] }
*                           }
*                       ]
*                   }
*               },
*           },
*           remediationActions: {
*               '1_300': { code: '1_300', forms: ['personalDetails'], fields: ['firstName', 'lastName'] }
*           }
*       }
*   },
*   LegalEntity: {  // will contain main entity as well as associated entity Problems
*       [id]: {
*          errors: {
*               [formId]: {
*                   [parentErrorCode]: {
*                       [subErrorCode]: [
*                           {
*                               { code: '1_300', forms: ['personalDetails'], fields: ['firstName', 'lastName'] }
*                           }
*                       ]
*                   }
*               },
*           },
*           remediationActions: {
*               '1_300': { code: '1_300', forms: ['personalDetails'], fields: ['firstName', 'lastName'] }
*           }
*       }
*   }
*};
* ```
*
* */
var getComponentMappingFromLEFieldPath = (context, entityType) => {
	if (!context?.key) return;
	if (context.key === "idVerificationMethod") return "idVerificationMethod.idVerificationMethod";
	const individualRemediationKeyMapping = remediationIndividualApiKeyMapping;
	if (context.key in customerSupportRemediationKeyMapping) return customerSupportRemediationKeyMapping[context.key];
	switch (entityType) {
		case LegalEntityTypes.INDIVIDUAL: return context.key in individualRemediationKeyMapping ? individualRemediationKeyMapping[context.key] : void 0;
		case LegalEntityTypes.ORGANIZATION: return context.key in remediationBusinessDetailsApiKeyMapping ? remediationBusinessDetailsApiKeyMapping[context.key] : void 0;
		case EntityTypes.BANK_ACCOUNT: return context.key in remediationPayoutApiKeyMapping ? remediationPayoutApiKeyMapping[context.key] : void 0;
		case LegalEntityTypes.SOLE_PROPRIETORSHIP: return context.key in remediationSolePropBusinessDetailsApiKeyMapping ? remediationSolePropBusinessDetailsApiKeyMapping[context.key] : void 0;
		case LegalEntityTypes.TRUST:
		default: return context.key in remediationTrustKeyMapping ? remediationTrustKeyMapping[context.key] : void 0;
	}
};
var FIELDS_WITH_LINKED_DATA = ["vatNumber"];
var getLinkedRemedidationFormFields = (accFormsAndFields, field) => {
	switch (field) {
		case "vatNumber":
			accFormsAndFields.fields.add("vatAbsenceReason");
			accFormsAndFields.fields.add("exemptedFromVat");
			break;
		default: return;
	}
};
var getRemediationsWithFormsAndFields = (remediatingActions, entityType) => {
	const mappedRemediations = remediatingActions.reduce((acc, { code: remediationCode }) => {
		/**
		* Map the remediation action code to get the field for context
		*/
		const apiFieldPathToRemediate = invalidInputRemediationActionMappings[remediationCode];
		if (!apiFieldPathToRemediate) return acc;
		/**
		* Translate the LEM context into the UI component context
		*/
		const componentFieldPathsToRemediate = apiFieldPathToRemediate.map((context) => getComponentMappingFromLEFieldPath(context, entityType)).filter(Boolean);
		if (!componentFieldPathsToRemediate) return acc;
		/**
		* Split up component field paths(formName.fieldName) to get form and field
		* Forms related to the single remediation
		*/
		const { forms, fields } = componentFieldPathsToRemediate.reduce((accFormsAndFields, fullFieldPath) => {
			if (!fullFieldPath) return accFormsAndFields;
			const [form, field] = fullFieldPath.split(/\.(.+)/, 2);
			if (FIELDS_WITH_LINKED_DATA.includes(field)) getLinkedRemedidationFormFields(accFormsAndFields, field);
			accFormsAndFields.forms.add(form);
			accFormsAndFields.fields.add(field);
			return accFormsAndFields;
		}, {
			forms: /* @__PURE__ */ new Set(),
			fields: /* @__PURE__ */ new Set()
		});
		acc.remediationsWithFormsAndFields.push({
			code: remediationCode,
			forms: Array.from(forms),
			fields: Array.from(fields)
		});
		/**
		* Forms related to all the remediations in the subError
		*/
		forms.forEach((formId) => acc.forms.add(formId));
		return acc;
	}, {
		forms: /* @__PURE__ */ new Set(),
		remediationsWithFormsAndFields: []
	});
	return {
		forms: Array.from(mappedRemediations.forms),
		remediationsWithFormsAndFields: mappedRemediations.remediationsWithFormsAndFields
	};
};
var isUnRelatedErrorCode = (error) => UNRELATED_DATA_MISSING_ERROR_CODES.includes(error?.code) || UNRELATED_INVALID_INPUT_ERROR_CODES.includes(error?.code);
/**
* Processes a dataMissing verification error that has top-level remediatingActions (no subErrors).
* Maps each remediation action to its affected UI forms/fields, then produces two outputs:
*   1. verificationErrors — keyed by formId, nesting the parent error code and its child remediation details
*   2. remediationActions — a flat lookup from remediation code to its forms/fields
*
* Because dataMissing errors lack the parent→child hierarchy of invalidInput errors,
* the parent error code is used as both the parent key and the child key so the
* resulting shape matches the invalidInput errors.
*/
var getDataMissingError = (parentVerificationError, entityType) => {
	const remediatingActions = parentVerificationError.remediatingActions ?? [];
	if (!remediatingActions.length) return {
		verificationErrors: {},
		remediationActions: {}
	};
	const { forms, remediationsWithFormsAndFields } = getRemediationsWithFormsAndFields(remediatingActions, entityType);
	const childErrorsWithRemActions = { [parentVerificationError.code]: remediationsWithFormsAndFields };
	return {
		verificationErrors: Array.from(forms).reduce((acc, formId) => {
			acc = {
				...acc,
				[formId]: { [parentVerificationError.code]: childErrorsWithRemActions }
			};
			return acc;
		}, {}),
		remediationActions: remediationsWithFormsAndFields.reduce((remediationActionsacc, remediationWithFormsAndFields) => ({
			...remediationActionsacc,
			[remediationWithFormsAndFields.code]: remediationWithFormsAndFields
		}), {})
	};
};
/**
* Iterates of the verification subErrors's remediationAction to discover associated forms and fields (using mappings).
* @param parentVerificationError - Parent verification
* @param entityType - type of entity
* @param country
* @param isFeatureEnabled
*/
var getInvalidInputError = (parentVerificationError, entityType) => {
	/**
	* Process subErrors in each verificationError
	*/
	const { allForms, childErrorsWithRemActions } = (parentVerificationError.subErrors ?? [parentVerificationError]).reduce((acc, { code: errorCode, remediatingActions }) => {
		if (!remediatingActions?.length) return acc;
		/**
		* Process remediations of each subError
		*/
		const { forms, remediationsWithFormsAndFields } = getRemediationsWithFormsAndFields(remediatingActions, entityType);
		acc.childErrorsWithRemActions[errorCode] = remediationsWithFormsAndFields;
		forms.forEach((formId) => acc.allForms.add(formId));
		return acc;
	}, {
		allForms: /* @__PURE__ */ new Set(),
		childErrorsWithRemActions: {}
	});
	return {
		verificationErrors: Array.from(allForms).reduce((acc, formId) => {
			acc = {
				...acc,
				[formId]: { [parentVerificationError.code]: childErrorsWithRemActions }
			};
			return acc;
		}, {}),
		remediationActions: Object.values(childErrorsWithRemActions).flatMap((remediationsWithFormsAndFields) => remediationsWithFormsAndFields).reduce((remediationActionsacc, remediationWithFormsAndFields) => ({
			...remediationActionsacc,
			[remediationWithFormsAndFields.code]: remediationWithFormsAndFields
		}), {})
	};
};
/**
* Merge form verification errors
* @param existingFormVerificationErrors
* @param newFormVerificationErrors
*/
var mergeFormLevelErrors = (existingFormVerificationErrors, newFormVerificationErrors) => {
	const mergedFormVerificationErrors = Object.entries(newFormVerificationErrors ?? {}).reduce((acc, [formId, formVerificationErrors]) => {
		acc = {
			...acc,
			[formId]: {
				...existingFormVerificationErrors?.[formId],
				...formVerificationErrors
			}
		};
		return acc;
	}, {});
	return {
		...existingFormVerificationErrors,
		...mergedFormVerificationErrors
	};
};
/**
* newStatus is set in the entityProblems only if the  newStatus has higher priority than
* existing status. This is because a legalentity can have different status for each capability.
* Status of the legalEntity should be the one with highest priority defined in Taskstatus enum.
* @param entityProblems - entityProblems
* @param newStatusWithReason - new status to set
*/
function getPriorityStatus(entityProblems, newStatusWithReason) {
	if (!entityProblems.statusWithReason || TASK_STATUS_PRIORITY[entityProblems.statusWithReason.status] < TASK_STATUS_PRIORITY[newStatusWithReason.status]) return newStatusWithReason;
	return entityProblems.statusWithReason;
}
function getMissingDataError(verificationError, entityProblems) {
	return entityProblems.missingData ? [...entityProblems.missingData, verificationError] : [verificationError];
}
function getEntityProblems(verificationErrors, entityType) {
	return verificationErrors.reduce((entityProblems, verificationError) => {
		const currEntityProblems = cloneObject(entityProblems);
		switch (verificationError.type) {
			case VerificationErrorTypes.INVALID_INPUT:
				if (!isUnRelatedErrorCode(verificationError)) {
					const { verificationErrors: newVerificationErrors, remediationActions } = getInvalidInputError(verificationError, entityType);
					currEntityProblems.verificationErrors = mergeFormLevelErrors(currEntityProblems.verificationErrors, newVerificationErrors);
					currEntityProblems.remediationActions = remediationActions;
					currEntityProblems.statusWithReason = getPriorityStatus(entityProblems, {
						status: TaskStatuses.ERROR,
						reason: "invalidInputError",
						details: { verificationError }
					});
				}
				break;
			case VerificationErrorTypes.DATA_MISSING:
				currEntityProblems.missingData = getMissingDataError(verificationError, currEntityProblems);
				if (WHITELISTED_DATA_MISSING_ERROR_CODES.includes(verificationError.code)) {
					const { verificationErrors: newVerificationErrors, remediationActions } = verificationError.subErrors ? getInvalidInputError(verificationError, entityType) : getDataMissingError(verificationError, entityType);
					currEntityProblems.verificationErrors = mergeFormLevelErrors(currEntityProblems.verificationErrors, newVerificationErrors);
					currEntityProblems.remediationActions = {
						...currEntityProblems.remediationActions,
						...remediationActions
					};
				}
				if (!isUnRelatedErrorCode(verificationError)) currEntityProblems.statusWithReason = getPriorityStatus(entityProblems, {
					status: TaskStatuses.DETAILS_REQUIRED,
					reason: "dataMissingError",
					details: { verificationError }
				});
				break;
			case VerificationErrorTypes.DATA_REVIEW:
				currEntityProblems.isReviewRequired = true;
				currEntityProblems.verificationErrors = {
					...currEntityProblems.verificationErrors,
					review: { [verificationError.code]: verificationError.remediatingActions }
				};
				currEntityProblems.statusWithReason = getPriorityStatus(entityProblems, {
					status: TaskStatuses.SUBMIT,
					reason: "dataReviewNeeded"
				});
				break;
			case VerificationErrorTypes.PENDING_STATUS:
				currEntityProblems.statusWithReason = getPriorityStatus(entityProblems, {
					status: TaskStatuses.PROCESSING,
					reason: "pendingStatusError"
				});
				break;
			case VerificationErrorTypes.REJECTED: break;
		}
		return currEntityProblems;
	}, {});
}
var aggregateProblemsByEntity = (problems, entity) => problems.reduce((errorsByEntity, problem) => {
	if (!problem.entity?.type || !problem.entity.id || !problem.verificationErrors?.length) return errorsByEntity;
	const { type: baseEntityType, id: entityId } = problem.entity;
	const existingErrorsForEntity = errorsByEntity[entityId];
	const aggregatedErrors = {
		...errorsByEntity,
		[entityId]: {
			baseEntityType,
			exactEntityType: void 0,
			verificationErrors: [...existingErrorsForEntity?.verificationErrors ?? [], ...problem.verificationErrors]
		}
	};
	/**
	*  using switch to discriminate union types based on entity type
	*/
	switch (entity.type) {
		case "bankAccount":
		case "recurringDetail":
			aggregatedErrors[entityId].exactEntityType = EntityTypes.BANK_ACCOUNT;
			return aggregatedErrors;
		default:
			aggregatedErrors[entityId].exactEntityType = getEntityType(baseEntityType, entity, entityId);
			return aggregatedErrors;
	}
}, {});
var overrideVerificationErrors = (verificationErrors, country) => verificationErrors.map((verificationError) => {
	if (country === "US" || verificationError.code === "1_3083") return overrideError(verificationError);
	return verificationError;
});
function getCapabilityProblems(entity, country) {
	return entriesOf(aggregateProblemsByEntity(entity?.problems ?? [], entity)).reduce((capabilityProblems, [entityId, { verificationErrors, exactEntityType, baseEntityType }]) => ({
		...capabilityProblems,
		[baseEntityType]: {
			...capabilityProblems[baseEntityType],
			[entityId]: getEntityProblems(overrideVerificationErrors(verificationErrors, country), exactEntityType)
		}
	}), {});
}
var remediationHasFileUploadField = (remediation) => {
	return remediation?.forms?.some((form) => form === "idVerificationMethod" || form === "manualIdUpload" || form === "proofOfResidency" || form === "proofOfNationalId" || form === "companyRegistrationDocument" || form === "companyTaxDocument" || form === "companyProofOfDirectorDocument" || form === "companyProofOfSignatoryDocument" || form === "companyProofOfOwnershipDocument" || form === "companyConstitutionalDocument" || form === "payoutAccountDocuments" || form === "trustConstitutionalDocument");
};
var getEntityType = (baseEntityType, legalEntity, legalEntityId) => {
	if (baseEntityType !== EntityTypes.LEGAL_ENTITY) return baseEntityType;
	if (legalEntityId === legalEntity.id) return legalEntity.type;
	return legalEntity.entityAssociations?.find((associations) => legalEntityId === associations.legalEntityId)?.entityType;
};
var getCapabilities = (legalEntity) => Object.keys(legalEntity?.capabilities ?? {});
//#endregion
export { EntityTypes as C, dataMissingRemediationsToFieldsMap as E, remediationPayoutApiKeyMapping as S, DATA_MISSING_DECISION_MAKER_ERROR_CODE_MAPPING as T, businessDetailsDocumentMapping as _, trustComponentsKeyMapping as a, crossBorderMapping as b, individualBaseMapping as c, remediationIndividualApiKeyMapping as d, solePropBusinessDetailsApiKeyMapping as f, businessDetailsComponentsKeyMapping as g, businessDetailsApiKeyMapping as h, trustApiKeyMapping as i, individualDocumentMapping as l, solePropBusinessDetailsKeyMapping as m, getCapabilityProblems as n, trustDocumentMapping as o, solePropBusinessDetailsDocumentMapping as p, remediationHasFileUploadField as r, individualApiKeyMapping as s, getCapabilities as t, individualObscuredFields as u, remediationBusinessDetailsApiKeyMapping as v, CUSTOMER_SUPPORT_DATA_MISSING_ERROR_CODES as w, payoutComponentKeyMapping as x, reverseMapping as y };
