import { type MergeRecordsOptions, type MergeRecordsResult, type ParseDataSourceOptions, type Template } from "@pixerate/editor"; export interface MergePreviewOptions { /** The prompt merged with each record. */ template: string; templates?: Template[]; bindings?: Record; /** How to read the data source text. */ parseOptions?: ParseDataSourceOptions; /** Passed to `mergeRecords` by `merge()`. */ skipIf?: MergeRecordsOptions["skipIf"]; separator?: string; maxOutputs?: number; } /** * Reactive mail-merge preview state for Svelte 5 (the counterpart of React's * `useMergePreview`): parses a pasted or loaded data source, matches its * fields to the template's variables (editable), steps through records and * merges them all with `mergeRecords`. * * `getOptions` is read reactively, so pass `() => ({ template, templates })` * built from props or state. */ export declare function createMergePreview(getOptions: () => MergePreviewOptions, initialSource?: string): { sourceText: string; setSourceText: (text: string) => void; /** Reads a picked file (CSV, TSV or JSON) into `sourceText`. */ loadFile(file: Blob): Promise; readonly source: import("@pixerate/editor").MergeDataSource; /** Variable names the template uses, in order. */ readonly variables: string[]; /** Variable → field: automatic matches with the user's overrides applied. */ readonly mapping: Record; setFieldMapping(variable: string, field: string | null): void; resetMapping(): void; /** 0-based index of the previewed record. */ readonly index: number; readonly count: number; setIndex: (next: number) => void; next(): void; prev(): void; readonly record: import("@pixerate/editor").MergeRecord; /** Prompt values for the previewed record. */ readonly values: import("@pixerate/editor").PromptValues; /** Merges every record with the current mapping and stores the result. */ merge(): MergeRecordsResult; readonly result: MergeRecordsResult | null; /** The last merge's outputs as text or JSON. */ serialize(format: "text" | "json"): string; }; export type MergePreviewState = ReturnType;