import { n as TypedObject, t as DeserializerRule } from "./types-DlDb6U1D.js";
import { PortableTextObject, Schema, SchemaDefinition } from "@portabletext/schema";
/**
 * Matcher function for mapping HTML objects to Portable Text block or inline objects.
 *
 * @public
 */
type ObjectMatcher<TValue extends Record<string, unknown> = Record<string, never>> = ({ context, value, isInline }: {
  context: {
    schema: Schema;
    keyGenerator: () => string;
  };
  value: TValue;
  isInline: boolean;
}) => PortableTextObject | undefined;
/**
 * @public
 */
declare function buildObjectMatcher<TDefinition extends {
  name: string;
}>(definition: TDefinition): ObjectMatcher<ExtractValue<TDefinition>>;
/**
 * @public
 */
type ExtractValue<TDefinition extends NonNullable<SchemaDefinition['blockObjects']>[0]> = TDefinition extends {
  fields: ReadonlyArray<{
    name: infer TNames;
  }>;
} ? Record<TNames & string, unknown> : Record<string, never>;
/**
 * Options for converting HTML to Portable Text
 *
 * @public
 */
type HtmlToPortableTextOptions = {
  schema?: Schema;
  keyGenerator?: () => string;
  parseHtml?: (html: string) => Document;
  rules?: DeserializerRule[];
  whitespaceMode?: 'preserve' | 'remove' | 'normalize';
  types?: {
    image?: ObjectMatcher<{
      src?: string;
      alt?: string;
    }>;
    code?: ObjectMatcher<{
      language: string | undefined;
      code: string;
    }>;
  };
};
/**
 * Convert HTML to Portable Text
 *
 * @param html - The HTML string to convert
 * @param options - Options for the conversion
 * @returns Array of Portable Text blocks
 * @public
 */
declare function htmlToPortableText(html: string, options?: HtmlToPortableTextOptions): (Omit<import("@portabletext/schema").PortableTextTextBlock<import("@portabletext/schema").PortableTextSpan | TypedObject> | TypedObject, "_key"> & {
  _key: string;
})[];
/**
 * The default schema for converting HTML to Portable Text.
 *
 * @public
 */
declare const defaultSchema: import("@portabletext/schema").Schema;
export { type DeserializerRule, type HtmlToPortableTextOptions, type ObjectMatcher, buildObjectMatcher, defaultSchema, htmlToPortableText };
//# sourceMappingURL=index.d.ts.map