function toSrcPath(str) {
    const indexOfSrc = str.indexOf("src");
    const modName = indexOfSrc === -1 ? str : str.slice(indexOfSrc);
    return modName.replace("appclientecmascript", "");
}
/**
 * Creates an data-testid map generator instance based on the module name or arbitrary id
 * @returns A function to set the IDs that this created instance will provide
 */
/**
 * Creates a data-testid map generator for use in end-to-end tests.
 */
export function testIDFactory(moduleOrId) {
    const moduleId = typeof moduleOrId === "string" ? moduleOrId : moduleOrId.id;
    return (idsArr) => [idsArr].reduce((acc, ids) => ({
        ...acc,
        ...ids.reduce((map, id) => ({
            ...map,
            [typeof id === "string" ? id : id[0]]: typeof id === "string"
                ? `${toSrcPath(moduleId.toLowerCase().replace(/[^a-z]/g, ""))}-${id}`
                : (i) => `${toSrcPath(moduleId.toLowerCase().replace(/[^a-z]/g, ""))}-${id[1](i)}`,
        }), {}),
    }), {});
}
//# sourceMappingURL=e2e.js.map