import type { BaseElement, DeviceAction, ElementTreeNode, MidsceneYamlFlowItem, PlanningAction, Rect, Size } from './types';
import type { ChatCompletionMessageParam } from 'openai/resources/index';
import type { PlanningLocateParam } from './types';
import type { TModelFamily } from '@midscene/shared/env';
import { z } from 'zod';
export type AIArgs = ChatCompletionMessageParam[];
type AdaptBboxInput = number[] | string[] | string | (number[] | string[])[];
/**
 * Convert a point coordinate [0, 1000] to a small bbox [0, 1000]
 * Creates a small bbox around the center point in the same coordinate space
 *
 * @param x - X coordinate in [0, 1000] range
 * @param y - Y coordinate in [0, 1000] range
 * @param bboxSize - Size of the bbox to create (default: 20)
 * @returns [x1, y1, x2, y2] bbox in [0, 1000] coordinate space
 */
export declare function pointToBbox(x: number, y: number, bboxSize?: number): [number, number, number, number];
export declare function fillBboxParam(locate: PlanningLocateParam, width: number, height: number, modelFamily: TModelFamily | undefined): PlanningLocateParam;
export declare function adaptQwen2_5Bbox(bbox: number[]): [number, number, number, number];
export declare function adaptDoubaoBbox(bbox: string[] | number[] | string, width: number, height: number): [number, number, number, number];
export declare function adaptBbox(bbox: AdaptBboxInput, width: number, height: number, modelFamily: TModelFamily | undefined): [number, number, number, number];
export declare function normalized01000(bbox: number[], width: number, height: number): [number, number, number, number];
export declare function adaptGeminiBbox(bbox: number[], width: number, height: number): [number, number, number, number];
export declare function adaptBboxToRect(bbox: number[], width: number, height: number, offsetX?: number, offsetY?: number, rightLimit?: number, bottomLimit?: number, modelFamily?: TModelFamily | undefined, scale?: number): Rect;
export declare function mergeRects(rects: Rect[]): {
    left: number;
    top: number;
    width: number;
    height: number;
};
/**
 * Expand the search area to at least 400 x 400 pixels
 *
 * Step 1: Extend 100px on each side (top, right, bottom, left)
 * - If the element is near a boundary, expansion on that side will be limited
 * - No compensation is made for boundary limitations (this is intentional)
 *
 * Step 2: Ensure the area is at least 400x400 pixels
 * - Scale up proportionally from the center if needed
 * - Final result is clamped to screen boundaries
 */
export declare function expandSearchArea(rect: Rect, screenSize: Size): Rect;
export declare function markupImageForLLM(screenshotBase64: string, tree: ElementTreeNode<BaseElement>, size: Size): Promise<string>;
export declare function buildYamlFlowFromPlans(plans: PlanningAction[], actionSpace: DeviceAction<any>[]): MidsceneYamlFlowItem[];
export declare const PointSchema: z.ZodObject<{
    left: z.ZodNumber;
    top: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
    left: number;
    top: number;
}, {
    left: number;
    top: number;
}>;
export declare const SizeSchema: z.ZodObject<{
    width: z.ZodNumber;
    height: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
    width: number;
    height: number;
}, {
    width: number;
    height: number;
}>;
export declare const RectSchema: z.ZodIntersection<z.ZodIntersection<z.ZodObject<{
    left: z.ZodNumber;
    top: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
    left: number;
    top: number;
}, {
    left: number;
    top: number;
}>, z.ZodObject<{
    width: z.ZodNumber;
    height: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
    width: number;
    height: number;
}, {
    width: number;
    height: number;
}>>, z.ZodObject<{
    zoom: z.ZodOptional<z.ZodNumber>;
}, "strip", z.ZodTypeAny, {
    zoom?: number | undefined;
}, {
    zoom?: number | undefined;
}>>;
export declare const TMultimodalPromptSchema: z.ZodObject<{
    images: z.ZodOptional<z.ZodArray<z.ZodObject<{
        name: z.ZodString;
        url: z.ZodString;
    }, "strip", z.ZodTypeAny, {
        name: string;
        url: string;
    }, {
        name: string;
        url: string;
    }>, "many">>;
    convertHttpImage2Base64: z.ZodOptional<z.ZodBoolean>;
}, "strip", z.ZodTypeAny, {
    images?: {
        name: string;
        url: string;
    }[] | undefined;
    convertHttpImage2Base64?: boolean | undefined;
}, {
    images?: {
        name: string;
        url: string;
    }[] | undefined;
    convertHttpImage2Base64?: boolean | undefined;
}>;
export declare const TUserPromptSchema: z.ZodUnion<[z.ZodString, z.ZodIntersection<z.ZodObject<{
    prompt: z.ZodString;
}, "strip", z.ZodTypeAny, {
    prompt: string;
}, {
    prompt: string;
}>, z.ZodObject<{
    images: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodObject<{
        name: z.ZodString;
        url: z.ZodString;
    }, "strip", z.ZodTypeAny, {
        name: string;
        url: string;
    }, {
        name: string;
        url: string;
    }>, "many">>>;
    convertHttpImage2Base64: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
}, "strip", z.ZodTypeAny, {
    images?: {
        name: string;
        url: string;
    }[] | undefined;
    convertHttpImage2Base64?: boolean | undefined;
}, {
    images?: {
        name: string;
        url: string;
    }[] | undefined;
    convertHttpImage2Base64?: boolean | undefined;
}>>]>;
export type TMultimodalPrompt = z.infer<typeof TMultimodalPromptSchema>;
export type TUserPrompt = z.infer<typeof TUserPromptSchema>;
/**
 * Returns the schema for locator fields.
 * This now returns the input schema which is more permissive and suitable for validation.
 */
export declare const getMidsceneLocationSchema: () => z.ZodObject<{
    prompt: z.ZodUnion<[z.ZodString, z.ZodIntersection<z.ZodObject<{
        prompt: z.ZodString;
    }, "strip", z.ZodTypeAny, {
        prompt: string;
    }, {
        prompt: string;
    }>, z.ZodObject<{
        images: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodObject<{
            name: z.ZodString;
            url: z.ZodString;
        }, "strip", z.ZodTypeAny, {
            name: string;
            url: string;
        }, {
            name: string;
            url: string;
        }>, "many">>>;
        convertHttpImage2Base64: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
    }, "strip", z.ZodTypeAny, {
        images?: {
            name: string;
            url: string;
        }[] | undefined;
        convertHttpImage2Base64?: boolean | undefined;
    }, {
        images?: {
            name: string;
            url: string;
        }[] | undefined;
        convertHttpImage2Base64?: boolean | undefined;
    }>>]>;
    deepThink: z.ZodOptional<z.ZodBoolean>;
    cacheable: z.ZodOptional<z.ZodBoolean>;
    xpath: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodBoolean]>>;
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
    prompt: z.ZodUnion<[z.ZodString, z.ZodIntersection<z.ZodObject<{
        prompt: z.ZodString;
    }, "strip", z.ZodTypeAny, {
        prompt: string;
    }, {
        prompt: string;
    }>, z.ZodObject<{
        images: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodObject<{
            name: z.ZodString;
            url: z.ZodString;
        }, "strip", z.ZodTypeAny, {
            name: string;
            url: string;
        }, {
            name: string;
            url: string;
        }>, "many">>>;
        convertHttpImage2Base64: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
    }, "strip", z.ZodTypeAny, {
        images?: {
            name: string;
            url: string;
        }[] | undefined;
        convertHttpImage2Base64?: boolean | undefined;
    }, {
        images?: {
            name: string;
            url: string;
        }[] | undefined;
        convertHttpImage2Base64?: boolean | undefined;
    }>>]>;
    deepThink: z.ZodOptional<z.ZodBoolean>;
    cacheable: z.ZodOptional<z.ZodBoolean>;
    xpath: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodBoolean]>>;
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
    prompt: z.ZodUnion<[z.ZodString, z.ZodIntersection<z.ZodObject<{
        prompt: z.ZodString;
    }, "strip", z.ZodTypeAny, {
        prompt: string;
    }, {
        prompt: string;
    }>, z.ZodObject<{
        images: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodObject<{
            name: z.ZodString;
            url: z.ZodString;
        }, "strip", z.ZodTypeAny, {
            name: string;
            url: string;
        }, {
            name: string;
            url: string;
        }>, "many">>>;
        convertHttpImage2Base64: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
    }, "strip", z.ZodTypeAny, {
        images?: {
            name: string;
            url: string;
        }[] | undefined;
        convertHttpImage2Base64?: boolean | undefined;
    }, {
        images?: {
            name: string;
            url: string;
        }[] | undefined;
        convertHttpImage2Base64?: boolean | undefined;
    }>>]>;
    deepThink: z.ZodOptional<z.ZodBoolean>;
    cacheable: z.ZodOptional<z.ZodBoolean>;
    xpath: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodBoolean]>>;
}, z.ZodTypeAny, "passthrough">>;
export declare const ifMidsceneLocatorField: (field: any) => boolean;
export declare const dumpMidsceneLocatorField: (field: any) => string;
export declare const findAllMidsceneLocatorField: (zodType?: z.ZodType<any>, requiredOnly?: boolean) => string[];
export declare const dumpActionParam: (jsonObject: Record<string, any>, zodSchema: z.ZodType<any>) => Record<string, any>;
/**
 * Parse and validate action parameters using Zod schema.
 * All fields are validated through Zod, EXCEPT locator fields which are skipped.
 * Default values defined in the schema are automatically applied.
 *
 * Locator fields are special business logic fields with complex validation requirements,
 * so they are intentionally excluded from Zod parsing and use existing validation logic.
 */
export declare const parseActionParam: (rawParam: Record<string, any> | undefined, zodSchema?: z.ZodType<any>) => Record<string, any> | undefined;
export declare const finalizeActionName = "Finalize";
/**
 * Get a readable time string for a given timestamp or the current time
 * @param format - Optional format string. Supports: YYYY, MM, DD, HH, mm, ss. Default: 'YYYY-MM-DD HH:mm:ss'
 * @param timestamp - Optional timestamp in milliseconds. If not provided, uses current system time.
 * @returns A formatted time string with format label
 */
export declare const getReadableTimeString: (format?: string, timestamp?: number) => string;
export {};
