import { P as PageOutline, S as SdkCustomBlock } from './schema-Bpy9N5ZI.js';
import { P as PrefetchContext, R as ResolvedBlockData, D as DataLoaderOverrides } from './types-DSFvXKhO.js';
export { B as BlockLoaderMap, a as DataLoaderContext, b as DataLoaderFn } from './types-DSFvXKhO.js';
import { R as RiverbankClient } from './types-CAnC529E.js';
import 'zod';
import './blockKinds-B6MWzNWp.js';
import './types-5XdVD2J1.js';
import '@riverbankcms/ai';
import '@riverbankcms/media-storage-supabase';
import '@riverbankcms/db';

/**
 * SDK wrapper for block data prefetching.
 * Uses the shared core implementation from @riverbankcms/blocks with the SDK client.
 */

/**
 * Supported loader endpoints for SDK data fetching.
 * Only these endpoints can be used in block data loaders when using the SDK.
 *
 * This is the SINGLE SOURCE OF TRUTH for whitelisted endpoints.
 * - Zod validation schema derives from this array
 * - TypeScript types derive from this array
 * - Runtime validation uses this array
 */
declare const SUPPORTED_LOADER_ENDPOINTS: readonly ["listPublishedEntries", "getPublishedEntryPreview", "listPublicEvents", "getPublicFormById", "getPublicBookingServices"];
/**
 * Union type of all supported loader endpoints.
 * Derived from SUPPORTED_LOADER_ENDPOINTS array.
 */
type SupportedLoaderEndpoint = typeof SUPPORTED_LOADER_ENDPOINTS[number];
/**
 * Options for SDK block data prefetching.
 */
type SdkPrefetchOptions = {
    /**
     * SDK custom blocks from site config.
     * Used to look up data loaders for custom.* blocks.
     */
    customBlocks?: SdkCustomBlock[];
};
/**
 * Prefetch block data for SDK-based applications.
 * Maps loader endpoints to corresponding SDK client methods.
 *
 * Supports both system blocks and SDK custom blocks with data loaders.
 *
 * @example
 * ```typescript
 * import { createRiverbankClient } from '@riverbankcms/sdk';
 * import { prefetchBlockData } from '@riverbankcms/sdk/data';
 *
 * const client = createRiverbankClient({ apiKey, baseUrl });
 * const page = await client.getPage({ siteId, path: '/' });
 *
 * // Basic usage (system blocks only)
 * const blockData = await prefetchBlockData(page.outline, {
 *   siteId: page.siteId,
 *   pageId: page.id,
 * }, client);
 *
 * // With custom blocks from SDK config
 * const blockData = await prefetchBlockData(page.outline, context, client, {
 *   customBlocks: site.sdkConfig?.customBlocks,
 * });
 * ```
 */
declare function prefetchBlockData(page: PageOutline, context: PrefetchContext, client: RiverbankClient, options?: SdkPrefetchOptions): Promise<ResolvedBlockData>;

/**
 * Execute code-based data loaders for SDK custom blocks.
 *
 * Code loaders are user-defined async functions that can fetch data
 * from any API (not just whitelisted CMS endpoints). They run
 * server-side during loadPage().
 */

/**
 * Execute code-based data loaders for blocks on a page.
 *
 * Iterates through page blocks and executes any registered loader
 * functions for matching block kinds. Runs all loaders in parallel.
 *
 * @param page - Page outline with blocks to process
 * @param context - Prefetch context (siteId, pageId, previewStage)
 * @param overrides - Map of block kinds to loader functions
 * @returns Resolved data keyed by blockId, then loader key
 *
 * @example
 * ```typescript
 * const codeData = await executeCodeLoaders(page, context, {
 *   'custom.featured-products': {
 *     products: async (ctx) => fetchProducts(ctx.content.categoryId),
 *   },
 * });
 * // codeData: { 'block-123': { products: [...] } }
 * ```
 */
declare function executeCodeLoaders(page: PageOutline, context: PrefetchContext, overrides: DataLoaderOverrides): Promise<ResolvedBlockData>;
/**
 * Merge resolved data from config loaders and code loaders.
 *
 * Code loader results take precedence on key conflicts.
 *
 * @param configResults - Data from config-based loaders (CMS endpoints)
 * @param codeResults - Data from code-based loaders (external APIs)
 * @returns Merged data with code results overwriting config on conflicts
 */
declare function mergeLoaderResults(configResults: ResolvedBlockData, codeResults: ResolvedBlockData): ResolvedBlockData;

export { DataLoaderOverrides, PrefetchContext, ResolvedBlockData, SUPPORTED_LOADER_ENDPOINTS, type SdkPrefetchOptions, type SupportedLoaderEndpoint, executeCodeLoaders, mergeLoaderResults, prefetchBlockData };
