import { E as EdgeSanityFetchOptions, Q as QueryParams } from './core-zsRjuWVw.js';
export { S as StegaConfig, h as buildStegaConfig, g as createEdgeSanityFetcher, s as default, e as detectStegaRequest, f as edgeSanityFetch, s as sanityFetch, c as sanityFetchAuthenticated, d as sanityFetchHybrid, b as sanityFetchStatic, a as sanityFetchWithFallback, i as shouldEnableStega, j as stegaClean } from './core-zsRjuWVw.js';

/**
 * @file enhanced.ts
 * @description Enhanced Sanity fetcher with retry and real-time capabilities
 * @author Invisible Cities Agency
 * @license MIT
 */

/**
 * Fetches data from Sanity with automatic retry support
 * Falls back to single attempt if p-retry not installed
 */
declare function edgeSanityFetchWithRetry<T>(options: EdgeSanityFetchOptions, retryOptions?: {
    retries?: number;
    minTimeout?: number;
    maxTimeout?: number;
}): Promise<T>;
/**
 * Creates a cached Sanity fetcher
 * Note: Use cachedSanityFetch from cache.ts for full caching support
 */
declare function createCachedSanityFetcher(dataset: string, _revalidate?: number, _tags?: string[]): <T>(query: string, params?: QueryParams) => Promise<T>;
/**
 * Creates an EventSource connection for real-time Sanity updates
 * Requires a server endpoint to handle SSE (see examples/vercel-sse.ts)
 */
declare function createSanityEventSource(query: string, dataset?: string, options?: {
    endpoint?: string;
    onMessage?: (data: unknown) => void;
    onError?: (error: Event) => void;
}): EventSource;
/**
 * Result type for batch fetching
 */
type BatchResult<T extends Record<string, unknown>> = {
    [K in keyof T]: T[K] | null;
};
/**
 * Batch fetcher for multiple queries in a single request
 * Reduces API calls and improves performance
 */
declare function batchSanityFetch<T extends Record<string, unknown>>(queries: Record<string, {
    query: string;
    params?: QueryParams;
}>, dataset: string, options?: {
    useAuth?: boolean;
    useCdn?: boolean;
}): Promise<BatchResult<T>>;

/**
 * @file cache.ts
 * @description Multi-layer caching for Sanity Edge Fetcher
 * @author Invisible Cities Agency
 * @license MIT
 */

interface CachedFetchOptions extends EdgeSanityFetchOptions {
    /** Cache configuration */
    cache?: {
        /** Time to live in seconds */
        ttl?: number;
        /** Cache key prefix */
        prefix?: string;
        /** Force cache refresh */
        force?: boolean;
        /** Enable Redis caching if available */
        useRedis?: boolean;
        /** Enable Next.js cache */
        useNextCache?: boolean;
    };
}
/**
 * Fetches data from Sanity with multi-layer caching
 *
 * Cache layers (in order):
 * 1. In-memory LRU cache (fastest, ~1ms)
 * 2. Upstash Redis (if configured, ~10-30ms)
 * 3. Origin fetch with Next.js cache
 */
declare function cachedSanityFetch<T>(options: CachedFetchOptions): Promise<T>;
/**
 * Create a cached fetcher with default options
 */
declare function createCachedFetcher(dataset: string, defaultCacheOptions?: CachedFetchOptions['cache']): <T>(query: string, params?: QueryParams, cacheOverrides?: CachedFetchOptions["cache"]) => Promise<T>;
/**
 * Clear caches for a specific dataset or pattern
 */
declare function clearSanityCache(options?: {
    dataset?: string;
    pattern?: string;
    clearMemory?: boolean;
    clearRedis?: boolean;
}): Promise<void>;
/**
 * Warm cache by pre-fetching common queries
 */
declare function warmSanityCache(queries: Array<{
    dataset: string;
    query: string;
    params?: QueryParams;
    ttl?: number;
}>): Promise<void>;
declare function getCacheStatus(): {
    memory: {
        available: boolean;
        size: number;
    };
    redis: {
        available: boolean;
        configured: boolean;
        url: string | null;
    };
    nextCache: {
        available: boolean;
    };
};

export { EdgeSanityFetchOptions, QueryParams, batchSanityFetch, cachedSanityFetch, clearSanityCache, createCachedFetcher, createCachedSanityFetcher, createSanityEventSource, edgeSanityFetchWithRetry, getCacheStatus, warmSanityCache };
