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] = "b5e2bac3-8550-4638-8585-ec7523207bb9", e._sentryDebugIdIdentifier = "sentry-dbid-b5e2bac3-8550-4638-8585-ec7523207bb9");
} catch (e) {}
import { t as LegalEntityTypes } from "./legal-entity-type-VIfNYnJP.js";
import { t as CountryCodes } from "./country-code-D3oCpE4i.js";
import { i as getDirectEntityAssociations } from "./entityAssociationUtil-C0gX4Ewv.js";
import { n as getDecisionMakers } from "./decisionMakerRoles-wy4KpDQg.js";
import { n as TrustMemberGuidanceLabels, r as TrustMemberTypes } from "./trustMemberGuidance-paR1FXfI.js";
//#region src/components/Trust/forms/TrustRegistrationDetails/types.ts
var nzSpecificTrustTypes = [
	"discretionaryTrust",
	"familyTrust",
	"charitableTrust",
	"businessTrust",
	"otherTrust"
];
var auSpecificTrustTypes = [
	"cashManagementTrust",
	"corporateUnitTrust",
	"deceasedEstate",
	"discretionaryInvestmentTrust",
	"discretionaryServicesManagementTrust",
	"discretionaryTradingTrust",
	"firstHomeSaverAccountsTrust",
	"fixedTrust",
	"fixedUnitTrust",
	"hybridTrust",
	"listedPublicUnitTrust",
	"otherTrust",
	"pooledSuperannuationTrust",
	"publicTradingTrust",
	"unlistedPublicUnitTrust"
];
var countryToTrustTypes = {
	[CountryCodes.Australia]: auSpecificTrustTypes,
	[CountryCodes.NewZealand]: nzSpecificTrustTypes
};
//#endregion
//#region src/components/Trust/utils/trustMemberRequirements.ts
var DEFAULT_TRUST_MEMBER_REQUIREMENTS = [
	{
		roleTypes: [TrustMemberTypes.SETTLOR],
		min: 1,
		max: 1,
		label: TrustMemberGuidanceLabels.SETTLOR
	},
	{
		roleTypes: [TrustMemberTypes.DEFINED_BENEFICIARY, TrustMemberTypes.UNDEFINED_BENEFICIARY],
		min: 1,
		max: Infinity,
		label: TrustMemberGuidanceLabels.BENEFICIARY
	},
	{
		roleTypes: [TrustMemberTypes.PROTECTOR],
		min: 0,
		max: Infinity,
		label: TrustMemberGuidanceLabels.PROTECTOR
	},
	{
		roleTypes: [TrustMemberTypes.TRUSTEE],
		min: 1,
		max: Infinity,
		label: TrustMemberGuidanceLabels.TRUSTEE
	}
];
//#endregion
//#region src/components/Trust/utils/trustUtil.ts
var isPartOfTrustFromLegalEntity = (legalEntity) => legalEntity?.entityAssociations?.some((ea) => ea.entityType === LegalEntityTypes.TRUST && ea.associatorId === legalEntity.id);
var getOwnTrustMembersLegalEntityIds = (rootLegalEntity) => {
	const trustLegalEntityId = getOwnTrustLegalEntityId(rootLegalEntity);
	if (!trustLegalEntityId) return [];
	const trustMemberIds = getDirectEntityAssociations(rootLegalEntity, trustLegalEntityId).map((association) => association.legalEntityId).filter((id) => id !== void 0);
	return [...trustMemberIds, ...trustMemberIds.flatMap((trustMemberId) => getTrustMemberCompanyDecisionMakerIds(rootLegalEntity, trustMemberId))];
};
var getTrustMemberCompanyDecisionMakerIds = (rootLegalEntity, trustMemberCompanyId) => {
	return getDecisionMakers(rootLegalEntity, trustMemberCompanyId).map((association) => association.legalEntityId).filter((id) => id !== void 0);
};
var getOwnTrustLegalEntityId = (legalEntity) => legalEntity?.entityAssociations?.find((ea) => ea.entityType === LegalEntityTypes.TRUST && ea.associatorId === legalEntity.id)?.legalEntityId;
var getOwnTrustLegalEntityIdAsArray = (legalEntity) => {
	const trustLegalEntityId = getOwnTrustLegalEntityId(legalEntity);
	return trustLegalEntityId ? [trustLegalEntityId] : [];
};
var getOwnTrustProblems = (legalEntity, capabilityProblems) => {
	const trustLegalEntityId = getOwnTrustLegalEntityId(legalEntity);
	if (trustLegalEntityId) return capabilityProblems?.LegalEntity?.[trustLegalEntityId];
};
var hasRequiredTrustMemberCount = (trustMembers) => {
	if (!trustMembers.length) return false;
	return DEFAULT_TRUST_MEMBER_REQUIREMENTS.every(({ roleTypes, min }) => {
		if (min === 0) return true;
		return (trustMembers.filter(({ roles }) => roleTypes.some((label) => roles.includes(label)))?.length ?? 0) >= min;
	});
};
var getCountrySpecificTrustTypeOptions = (country) => {
	return countryToTrustTypes[country] || [];
};
//#endregion
export { hasRequiredTrustMemberCount as a, getOwnTrustProblems as i, getOwnTrustLegalEntityIdAsArray as n, isPartOfTrustFromLegalEntity as o, getOwnTrustMembersLegalEntityIds as r, DEFAULT_TRUST_MEMBER_REQUIREMENTS as s, getCountrySpecificTrustTypeOptions as t };
