export const camelCaseToDisplay = (camelCaseString) => {
    return (camelCaseString.charAt(0).toUpperCase() + camelCaseString.slice(1)).replace(/([A-Z])/g, ' $1').trim();
};
export const snakeCaseToDisplay = (snakeCaseString) => {
    return snakeCaseString.charAt(0).toUpperCase() + snakeCaseString.slice(1).replace('_', ' ').trim();
};
export const jsonPrettyPrint = (obj) => {
    return JSON.stringify(obj, null, 2);
};
export const EmailRegexString = '(([^<>()[\\].,;:\\s@\\"]+(\\.[^<>()[\\]\\.,;:\\s@\\"]+)*)|(\\".+\\"))@(([^<>()[\\]\\.,;:\\s@\\"]+\\.)+[^<>()[\\]\\.,;:\\s@\\"]{2,})';
const EmailRegexComplete = new RegExp(`^${EmailRegexString}$`);
export const validateEmail = (email) => {
    return EmailRegexComplete.test(email);
};
export const getNextEntityName = (prefix, existingNames, separator = '_') => {
    const cleanName = (name) => {
        return (name
            // eslint-disable-next-line no-useless-escape
            .replace(/[\[\]\(\)\s]/g, separator)
            .replace(/^a-zA-Z0-9+/g, '')
            .replace(new RegExp(`${separator}+`, 'g'), separator));
    };
    const formattedPrefix = cleanName(prefix);
    const cleanedNames = existingNames.map((name) => cleanName(name.trim()));
    const regex = new RegExp(`^${formattedPrefix}(\\d+)$`);
    const usedIndices = cleanedNames.map((name) => {
        if (name && regex.test(name)) {
            const matches = name.match(regex);
            const ind = matches && Array.isArray(matches) ? parseInt(matches[1], 10) : 0;
            return Number.isNaN(ind) ? 0 : ind;
        }
        return 0;
    });
    const lastIndex = Math.max(...usedIndices, ...[0]);
    return `${formattedPrefix}${lastIndex + 1}`;
};
//# sourceMappingURL=string.js.map