import { setAttendee } from "./set-attendee.js";
export async function createAttendeeReferences(input) {
    const attendeeInput = parseAttendeeReferences(input);
    return attendeeInput.length ? await Promise.all(attendeeInput.map(setAttendee)) : [];
}
export function getAttendeeReferenceMap(attendees) {
    return new Map(attendees.map(attendee => [attendee.reference, attendee]));
}
export function parseAttendeeReferences(attendees) {
    return [
        ...(attendees ?? []).map(attendee => {
            if (typeof attendee === "string") {
                return { reference: attendee };
            }
            return attendee;
        })
    ]
        .filter((value, index, array) => {
        const before = array.slice(0, index);
        return !before.find(other => other.reference === value.reference);
    });
}
//# sourceMappingURL=get-referenced-attendees.js.map