//#region src/utils/billingPlanSeats.ts
/**
* Given a plan, return the unit price for seats.
*/
const getSeatUnitPrice = (plan) => {
	if (!plan.unitPrices?.length) return null;
	const seatUnitPrice = plan.unitPrices.find((unitPrice) => unitPrice.name === "seats");
	if (seatUnitPrice) return seatUnitPrice;
	return null;
};
/**
* Given a plan, return the seat limit for the plan, or undefined if the plan does not have a seat limit.
*/
const getPlanSeatLimit = (plan) => {
	const seatUnitPrice = getSeatUnitPrice(plan);
	if (!seatUnitPrice?.tiers.length) return;
	return seatUnitPrice.tiers[seatUnitPrice.tiers.length - 1]?.endsAfterBlock;
};
/**
* Given a plan and an organization, return true if the organization exceeds the seat limit for the plan.
*/
const organizationExceedsPlanSeatLimit = (plan, organization) => {
	const seatLimit = getPlanSeatLimit(plan);
	if (seatLimit === void 0 || seatLimit === null) return false;
	return organization.membersCount + organization.pendingInvitationsCount > seatLimit;
};

//#endregion
export { getPlanSeatLimit, getSeatUnitPrice, organizationExceedsPlanSeatLimit };
//# sourceMappingURL=billingPlanSeats.js.map