/**
 * ID generation utilities
 */
/**
 * Generate a unique ID with optional prefix
 */
export function generate_unique_id(prefix = 'id') {
    const timestamp = Date.now().toString(36);
    const random = Math.random().toString(36).substring(2, 7);
    return `${prefix}_${timestamp}_${random}`;
}
/**
 * Generate a short unique ID (for temporary use)
 */
export function generate_short_id() {
    return Math.random().toString(36).substring(2, 9);
}
/**
 * Sanitize a string to be a valid ID
 * - Lowercase
 * - Replace spaces with underscores
 * - Remove special characters
 */
export function sanitize_id(input) {
    return input
        .toLowerCase()
        .trim()
        .replace(/\s+/g, '_')
        .replace(/[^a-z0-9_]/g, '')
        .replace(/_+/g, '_')
        .replace(/^_|_$/g, '');
}
/**
 * Generate an ID from a label
 */
export function label_to_id(label) {
    const sanitized = sanitize_id(label);
    return sanitized || generate_unique_id('field');
}
//# sourceMappingURL=id_generator.js.map