import { type Params } from 'react-router';
import { type Snapshot } from 'recoil';
import * as z from 'zod/v4';
import { type Deferred, type DerivedResult } from '../shared';
import { ActionImpl, type ComponentInstance, type DerivedVariable, type NormalizedPayload, type PyComponentInstance, type RouteDefinition } from '../types';
export declare const TemplateChunk: z.ZodObject<{
    type: z.ZodLiteral<"template">;
    template: z.ZodObject<{
        data: z.ZodAny;
        lookup: z.ZodRecord<z.ZodString, z.ZodAny>;
    }, z.core.$strip>;
}, z.core.$strip>;
export type TemplateChunk = z.infer<typeof TemplateChunk>;
export declare const ActionChunk: z.ZodObject<{
    type: z.ZodLiteral<"actions">;
    actions: z.ZodRecord<z.ZodString, z.ZodArray<z.ZodObject<{
        name: z.ZodString;
        __typename: z.ZodLiteral<"ActionImpl">;
    }, z.core.$loose>>>;
}, z.core.$strip>;
export type ActionChunk = z.infer<typeof ActionChunk>;
export declare const DerivedVariableChunk: z.ZodObject<{
    type: z.ZodLiteral<"derived_variable">;
    uid: z.ZodString;
    result: z.ZodObject<{
        ok: z.ZodBoolean;
        value: z.ZodAny;
    }, z.core.$strip>;
}, z.core.$strip>;
export type DerivedVariableChunk = z.infer<typeof DerivedVariableChunk>;
export declare const PyComponentChunk: z.ZodObject<{
    type: z.ZodLiteral<"py_component">;
    uid: z.ZodString;
    result: z.ZodObject<{
        ok: z.ZodBoolean;
        value: z.ZodAny;
    }, z.core.$strip>;
}, z.core.$strip>;
export type PyComponentChunk = z.infer<typeof PyComponentChunk>;
export declare const ResponseChunk: z.ZodUnion<readonly [z.ZodObject<{
    type: z.ZodLiteral<"template">;
    template: z.ZodObject<{
        data: z.ZodAny;
        lookup: z.ZodRecord<z.ZodString, z.ZodAny>;
    }, z.core.$strip>;
}, z.core.$strip>, z.ZodObject<{
    type: z.ZodLiteral<"actions">;
    actions: z.ZodRecord<z.ZodString, z.ZodArray<z.ZodObject<{
        name: z.ZodString;
        __typename: z.ZodLiteral<"ActionImpl">;
    }, z.core.$loose>>>;
}, z.core.$strip>, z.ZodObject<{
    type: z.ZodLiteral<"derived_variable">;
    uid: z.ZodString;
    result: z.ZodObject<{
        ok: z.ZodBoolean;
        value: z.ZodAny;
    }, z.core.$strip>;
}, z.core.$strip>, z.ZodObject<{
    type: z.ZodLiteral<"py_component">;
    uid: z.ZodString;
    result: z.ZodObject<{
        ok: z.ZodBoolean;
        value: z.ZodAny;
    }, z.core.$strip>;
}, z.core.$strip>]>;
export type ResponseChunk = z.infer<typeof ResponseChunk>;
interface DerivedVariablePayload {
    uid: string;
    values: NormalizedPayload<any[]>;
}
interface PyComponentPayload {
    uid: string;
    name: string;
    values: NormalizedPayload<Record<string, any>>;
}
interface DerivedVariableHandle {
    dv: DerivedVariable;
    result: DerivedResult;
    handle: Deferred<any>;
    payload: DerivedVariablePayload;
}
interface PyComponentHandle {
    py: PyComponentInstance;
    result: DerivedResult;
    handle: Deferred<any>;
    payload: PyComponentPayload;
}
export interface LoaderData {
    template: ComponentInstance;
    on_load: ActionImpl[];
    route_definition: RouteDefinition;
    derived_variables: DerivedVariableHandle[];
    py_components: PyComponentHandle[];
}
/**
 * Fetch route data from the server.
 *
 * Collects payloads for `on_load` actions as wel as `derived_variable`s and `py_component`s on the page and sends them in the same request.
 */
export declare function fetchRouteData(route: RouteDefinition, params: Params<string>, snapshot: Snapshot, signal?: AbortSignal): Promise<LoaderData>;
/**
 * Retrieve route data from the preload cache.
 *
 * @param routeId route ID
 * @param params current route params
 */
export declare function getFromPreloadCache(routeId: string, params: Params<string>): LoaderData | Promise<LoaderData> | undefined;
/**
 * Provides a function to preload data for all routes matching a given URL.
 * Checks the preload cache first, and if not found, fetches the data from the server.
 */
export declare function usePreloadRoute(): (url: Partial<Location> | string) => void;
export {};
//# sourceMappingURL=fetching.d.ts.map