/**
 * Utility functions for Query Suggestions components
 */
import { type CSSProperties, type ReactNode } from 'react';
import type { SuggestionFieldMapping, ProductFieldMapping, CategoryFieldMapping, BrandFieldMapping, DropdownThemeConfig, ProductDisplayConfig } from './types';
import type { ProductBadge, ProductOption, ProductVariant, PriceRange } from '@seekora-ai/ui-sdk-types';
/**
 * Get nested value from object using dot notation
 * @example getNestedValue({ a: { b: 'value' } }, 'a.b') => 'value'
 */
export declare const getNestedValue: (obj: any, path: string) => any;
/**
 * Extract suggestion fields from raw data
 */
export declare const extractSuggestion: (item: any, mapping?: SuggestionFieldMapping) => {
    query: any;
    count: any;
    id: any;
    categories: any;
    highlighted: any;
    _raw: any;
};
/**
 * Extract product fields from raw data
 */
export declare const extractProduct: (item: any, mapping?: ProductFieldMapping) => {
    id: any;
    title: any;
    image: any;
    price: any;
    comparePrice: any;
    url: any;
    brand: any;
    category: any;
    rating: any;
    reviewCount: any;
    discount: any;
    inStock: any;
    currency: any;
    images: any;
    originalPrice: any;
    available: any;
    options: any;
    variants: any;
    tags: any;
    _raw: any;
};
/**
 * Extract category fields from raw data
 */
export declare const extractCategory: (item: any, mapping?: CategoryFieldMapping) => {
    id: any;
    label: any;
    count: any;
    icon: any;
    image: any;
    _raw: any;
};
/**
 * Extract brand fields from raw data
 */
export declare const extractBrand: (item: any, mapping?: BrandFieldMapping) => {
    id: any;
    name: any;
    logo: any;
    count: any;
    _raw: any;
};
/**
 * Format price with currency
 */
export declare const formatPrice: (value: number | string | undefined, config?: Pick<ProductDisplayConfig, 'currency' | 'currencyPosition' | 'priceDecimals'>) => string;
/**
 * Format count with abbreviation (1.2K, 3.4M, etc.)
 */
export declare const formatCount: (count: number | undefined) => string;
/**
 * Calculate discount percentage
 */
export declare const calculateDiscount: (price: number | undefined, comparePrice: number | undefined) => number | undefined;
/**
 * Escape HTML special characters
 */
export declare const escapeHtml: (text: string) => string;
/**
 * Highlight matching text in a string
 */
export declare const highlightText: (text: string, query: string, options?: {
    tag?: string;
    className?: string;
    style?: CSSProperties;
}) => string;
/**
 * Safe React-based highlight rendering (no dangerouslySetInnerHTML).
 * Returns React nodes with matched text wrapped in the specified tag element.
 */
export declare const highlightTextReact: (text: string, query: string, options?: {
    tag?: string;
    className?: string;
    style?: CSSProperties;
}) => ReactNode;
/**
 * Truncate text to specified length
 */
export declare const truncateText: (text: string, maxLength: number, ellipsis?: string) => string;
/**
 * Extract badges from product tags (Shopify convention: "badge:new", "badge:limited")
 * and auto-generate sale/soldOut badges from product data.
 */
export declare const extractBadges: (tags?: string[], product?: {
    price?: number;
    original_price?: number;
    compare_at_price?: number;
    available?: boolean;
}) => ProductBadge[];
/**
 * Compute min/max price from variants. Returns null if all variants have the same price.
 */
export declare const getPriceRange: (variants?: ProductVariant[]) => PriceRange | null;
/**
 * Format a price range like "$54.00 - $72.00"
 */
export declare const formatPriceRange: (range: PriceRange, config?: Pick<ProductDisplayConfig, 'currency' | 'currencyPosition' | 'priceDecimals'>) => string;
/**
 * Given current selections, return which values for an option are still available
 * based on variant availability.
 */
export declare const getAvailableValuesForOption: (optionName: string, options: ProductOption[], variants: ProductVariant[], selections: Record<string, string>) => {
    value: string;
    available: boolean;
}[];
/**
 * Find the exact variant matching all selected options.
 */
export declare const findVariantBySelections: (options: ProductOption[], variants: ProductVariant[], selections: Record<string, string>) => ProductVariant | null;
/**
 * Generate CSS variables from theme config
 */
export declare const generateCSSVariables: (theme: DropdownThemeConfig, prefix?: string) => Record<string, string>;
/**
 * Merge class names, filtering out falsy values
 */
export declare const cx: (...classes: (string | undefined | null | false)[]) => string;
/**
 * Merge styles, filtering out undefined values
 */
export declare const mergeStyles: (...styles: (CSSProperties | undefined)[]) => CSSProperties;
interface AnimationState {
    opacity: number;
    transform?: string;
}
interface AnimationConfig {
    initial: AnimationState;
    animate: AnimationState;
    exit: AnimationState;
}
export declare const animations: Record<'fade' | 'slide' | 'scale' | 'spring', AnimationConfig>;
/**
 * Get animation keyframes CSS
 */
export declare const getAnimationCSS: (type: 'fade' | 'slide' | 'scale' | 'spring' | 'none', duration?: number) => string;
/**
 * Create keyboard handler for dropdown navigation
 */
export declare const createKeyboardHandler: (handlers: {
    onUp?: () => void;
    onDown?: () => void;
    onLeft?: () => void;
    onRight?: () => void;
    onEnter?: () => void;
    onEscape?: () => void;
    onTab?: (shift: boolean) => void;
}) => (event: React.KeyboardEvent) => void;
export declare const getRecentSearches: (storeId?: string) => string[];
export declare const addRecentSearch: (query: string, storeId?: string) => string[];
export declare const removeRecentSearch: (query: string, storeId?: string) => string[];
export declare const clearRecentSearches: (storeId?: string) => void;
/**
 * Debounce function
 */
export declare const debounce: <T extends (...args: any[]) => any>(fn: T, delay: number) => ((...args: Parameters<T>) => void) & {
    cancel: () => void;
};
/**
 * Generate unique ID
 */
export declare const generateId: (prefix?: string) => string;
/**
 * Check if element is in viewport
 */
export declare const isInViewport: (element: HTMLElement) => boolean;
/**
 * Scroll element into view if needed
 */
export declare const scrollIntoViewIfNeeded: (element: HTMLElement, container: HTMLElement) => void;
/**
 * Simple in-memory cache with TTL support for suggestions
 * Reduces API calls by caching results for quick repeated queries
 */
declare class SuggestionsCache {
    private cache;
    private maxSize;
    private defaultTtl;
    constructor(options?: {
        maxSize?: number;
        defaultTtlMs?: number;
    });
    /**
     * Generate a cache key from query and options
     */
    generateKey(query: string, options?: Record<string, any>): string;
    /**
     * Get cached data if valid (not expired)
     */
    get<T>(key: string): T | null;
    /**
     * Store data in cache
     */
    set<T>(key: string, data: T, ttlMs?: number): void;
    /**
     * Check if key exists and is valid
     */
    has(key: string): boolean;
    /**
     * Clear all cached entries
     */
    clear(): void;
    /**
     * Clear expired entries
     */
    cleanup(): void;
    /**
     * Get cache statistics
     */
    getStats(): {
        size: number;
        maxSize: number;
    };
}
/**
 * Get the global suggestions cache instance
 */
export declare const getSuggestionsCache: (options?: {
    maxSize?: number;
    defaultTtlMs?: number;
}) => SuggestionsCache;
/**
 * Create a new cache instance (for isolated caching per component)
 */
export declare const createSuggestionsCache: (options?: {
    maxSize?: number;
    defaultTtlMs?: number;
}) => SuggestionsCache;
/**
 * Clear the global cache
 */
export declare const clearSuggestionsCache: () => void;
export { SuggestionsCache };
//# sourceMappingURL=utils.d.ts.map