/**
 * URL utility functions for the editor
 */
/**
 * Normalizes a URL by adding https:// protocol if missing for domain-like strings
 * @param text - The text to normalize
 * @returns The normalized URL
 */
export const normalizeUrl = (text) => {
    if (!text)
        return text;
    try {
        new URL(text);
        return text; // Already a valid URL
    }
    catch {
        // Check if it looks like a domain without protocol
        const domainPattern = /^([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}(\/.*)?$/;
        if (domainPattern.test(text)) {
            return `https://${text}`;
        }
        return text; // Return as is if not a recognizable domain
    }
};
//# sourceMappingURL=urlUtils.js.map