import { a as TypedObject, i as HtmlParser, n as DeserializerRule, o as ImageSchemaMatcher, r as HtmlDeserializerOptions, s as SchemaMatchers, t as ArbitraryTypedObject } from "./_chunks-dts/types.js";
import * as _portabletext_schema1 from "@portabletext/schema";
import { PortableTextBlock, PortableTextObject, PortableTextSpan, PortableTextSpan as PortableTextSpan$1, PortableTextTextBlock, PortableTextTextBlock as PortableTextTextBlock$1, Schema } from "@portabletext/schema";
import { ArraySchemaType } from "@sanity/types";
/**
 * Block normalization options
 *
 * @public
 */
interface BlockNormalizationOptions {
  /**
   * Decorator names that are allowed within portable text blocks, eg `em`, `strong`
   */
  allowedDecorators?: string[];
  /**
   * Name of the portable text block type, if not `block`
   */
  blockTypeName?: string;
  /**
   * Custom key generator function
   */
  keyGenerator?: () => string;
}
/**
 * Normalizes a block by ensuring it has a `_key` property. If the block is a
 * portable text block, additional normalization is applied:
 *
 * - Ensures it has `children` and `markDefs` properties
 * - Ensures it has at least one child (adds an empty span if empty)
 * - Joins sibling spans that has the same marks
 * - Removes decorators that are not allowed according to the schema
 * - Removes marks that have no annotation definition
 *
 * @param node - The block to normalize
 * @param options - Options for normalization process. See {@link BlockNormalizationOptions}
 * @returns Normalized block
 * @public
 */
declare function normalizeBlock(node: TypedObject, options?: BlockNormalizationOptions): Omit<TypedObject | PortableTextTextBlock$1<TypedObject | PortableTextSpan$1>, '_key'> & {
  _key: string;
};
/**
 * Generate a random key of the given length
 *
 * @param length - Length of string to generate
 * @returns A string of the given length
 * @public
 */
declare function randomKey(length: number): string;
/**
 * Convert HTML to blocks respecting the block content type's schema
 *
 * @param html - The HTML to convert to blocks
 * @param schemaType - A compiled version of the schema type for the block content
 * @param options - Options for deserializing HTML to blocks
 * @returns Array of blocks
 * @public
 */
declare function htmlToBlocks(html: string, schemaType: ArraySchemaType | Schema, options?: HtmlDeserializerOptions): (Omit<TypedObject | _portabletext_schema1.PortableTextTextBlock<TypedObject | _portabletext_schema1.PortableTextSpan>, "_key"> & {
  _key: string;
})[];
export { type ArbitraryTypedObject, type BlockNormalizationOptions, type DeserializerRule, type HtmlDeserializerOptions, type HtmlParser, type ImageSchemaMatcher, type PortableTextBlock, type PortableTextObject, type PortableTextSpan, type PortableTextTextBlock, type SchemaMatchers, type TypedObject, htmlToBlocks, normalizeBlock, randomKey };