import { _ExportHelper } from './xfdf-document';
import { PdfDocument } from './../pdf-document';
import { PdfAnnotation } from './../annotations/annotation';
import { _PdfDictionary } from './../pdf-primitives';
import { _PdfContentStream } from './../base-stream';
/**
 * Provides JSON based export and import utilities for annotations and form fields and manages serialization details.
 *
 * @private
 */
export declare class _JsonDocument extends _ExportHelper {
    /**
     * Indicates whether the document is being imported from JSON
     * instead of being exported to JSON.
     *
     * @private
     */
    _isImport: boolean;
    /**
     * Indicates whether color-space values are included or processed
     * in the JSON structure.
     *
     * @private
     */
    _isColorSpace: boolean;
    /**
     * Indicates whether duplicate fields or nodes have been detected
     * during JSON import/export operations.
     *
     * @private
     */
    _isDuplicate: boolean;
    /**
     * Indicates whether grouping behavior is supported during
     * JSON export.
     *
     * @private
     */
    _isGroupingSupport: boolean;
    /**
     * Initializes the JSON helper with optional file name for export context.
     *
     * @private
     * @param {string} [fileName] Source or target file name used in JSON payload.
     */
    constructor(fileName?: string);
    /**
     * Prepares and exports annotations from the document as a JSON byte array.
     *
     * @private
     * @param {PdfDocument} document Source PDF document to read annotations.
     * @returns {Uint8Array} Generated JSON payload containing exported annotations.
     */
    _exportAnnotations(document: PdfDocument): Uint8Array;
    /**
     * Prepares and exports form fields from the document as a JSON byte array.
     *
     * @private
     * @param {PdfDocument} document Source PDF document to read form fields.
     * @returns {Uint8Array} Generated JSON payload containing exported form fields.
     */
    _exportFormFields(document: PdfDocument): Uint8Array;
    /**
     * Finalizes JSON serialization and returns the composed byte array.
     *
     * @private
     * @returns {Uint8Array} Serialized JSON data representing the current export.
     */
    _save(): Uint8Array;
    /**
     * Writes accumulated form field entries into the JSON buffer using a flat key to value structure.
     *
     * @private
     * @returns {void}
     */
    _writeFormFieldData(): void;
    /**
     * Iterates document pages collects exportable annotations and writes the JSON structure.
     *
     * @private
     * @param {PdfDocument} document Source document providing pages and annotations.
     * @param {number} pageCount Number of pages to process from the document.
     * @returns {void}
     */
    _exportAnnotationData(document: PdfDocument, pageCount: number): void;
    /**
     * Extracts annotation properties and places them into the working table for JSON emission.
     *
     * @private
     * @param {PdfAnnotation} annotation Annotation to export.
     * @param {number} index Page index where the annotation resides.
     * @returns {void}
     */
    _exportAnnotation(annotation: PdfAnnotation, index: number): void;
    /**
     * Walks a dictionary and writes supported attributes into the working table honoring appearance and page filters.
     *
     * @private
     * @param {_PdfDictionary} dictionary Dictionary to read properties from.
     * @param {number} pageIndex Page index used for appearance handling.
     * @param {boolean} hasAppearance Indicates whether appearance streams should be included.
     * @returns {void}
     */
    _writeDictionary(dictionary: _PdfDictionary, pageIndex: number, hasAppearance: boolean): void;
    /**
     * Writes color related attributes into the working table optionally emitting a tagged numeric component.
     *
     * @private
     * @param {any} primitive Source color primitive array name or number.
     * @param {string} attribute Target attribute key to store the color string.
     * @param {string} [tag] Optional key for an additional numeric component.
     * @returns {void}
     */
    _writeColor(primitive: any, attribute: string, tag?: string): void;
    /**
     * Writes a simple attribute string into the working table with optional lowercase normalization.
     *
     * @private
     * @param {string} attribute Target attribute key.
     * @param {any} primitive Source primitive value.
     * @param {boolean} [isLowerCase=false] When true converts the value to lowercase.
     * @returns {void}
     */
    _writeAttributeString(attribute: string, primitive: any, isLowerCase?: boolean): void;
    /**
     * Maps a dictionary entry to one or more JSON attributes handling special cases and conversions.
     *
     * @private
     * @param {string} key Dictionary key being processed.
     * @param {any} primitive Source primitive value or reference.
     * @param {_PdfDictionary} dictionary Owning dictionary for lookups.
     * @returns {void}
     */
    _writeAttribute(key: string, primitive: any, dictionary: _PdfDictionary): void;
    /**
     * Serializes vertices data into a compact string and stores it in the working table.
     *
     * @private
     * @param {_PdfDictionary} dictionary Dictionary containing the Vertices entry.
     * @returns {void}
     */
    _writeVertices(dictionary: _PdfDictionary): void;
    /**
     * Serializes ink list data into JSON and stores it in the working table.
     *
     * @private
     * @param {_PdfDictionary} dictionary Dictionary containing the InkList entry.
     * @returns {void}
     */
    _writeInkList(dictionary: _PdfDictionary): void;
    /**
     * Exports a measurement sub dictionary and stores it under the given key.
     *
     * @private
     * @param {_PdfDictionary} dictionary Target key name to store the formatted dictionary.
     * @returns {void}
     */
    _exportMeasureDictionary(dictionary: _PdfDictionary): void;
    /**
     * Exports a measurement sub dictionary and stores it under the given key.
     *
     * @private
     * @param {string} key Target key name to store the formatted dictionary.
     * @param {_PdfDictionary} measurementDetails Source measurement details dictionary.
     * @returns {void}
     */
    _exportMeasureFormatDetails(key: string, measurementDetails: _PdfDictionary): void;
    /**
     * Builds a JSON encoded appearance object from the appearance dictionary.
     *
     * @private
     * @param {_PdfDictionary} appearance Appearance dictionary to serialize.
     * @returns {Uint8Array} UTF8 encoded JSON bytes representing appearance content.
     */
    _getAppearanceString(appearance: _PdfDictionary): Uint8Array;
    /**
     * Writes an appearance dictionary into a flat key to value map suitable for JSON serialization.
     *
     * @private
     * @param {Map<string, string>} table Destination table to receive serialized entries.
     * @param {_PdfDictionary} dictionary Source dictionary to traverse.
     * @returns {void}
     */
    _writeAppearanceDictionary(table: Map<string, string>, dictionary: _PdfDictionary): void;
    /**
     * Writes a PDF primitive into table or array using a typed envelope and handles references and streams.
     *
     * @private
     * @param {Map<string, string>} [table] Destination table for dictionary context.
     * @param {any} [value] Primitive value to serialize.
     * @param {_PdfDictionary} [dictionary] Current dictionary for reference resolution.
     * @param {string} [key] Current key when writing into a table.
     * @param {Map<string, string>[]} [array] Destination array for array context.
     * @param {boolean} [isColorSpace=false] Marks color space processing mode for unicode handling.
     * @param {boolean} [isNewReference=false] Marks a newly created reference for image stream decisions.
     * @returns {void}
     */
    _writeObject(table?: Map<string, string>, value?: any, dictionary?: _PdfDictionary, key?: string, array?: Map<string, string>[], isColorSpace?: boolean, isNewReference?: boolean): void;
    /**
     * Writes a single table entry or pushes into an array using a typed envelope.
     *
     * @private
     * @param {string} tableKey Envelope type key such as name int fixed boolean dict array stream string unicodeData null.
     * @param {string} value Serialized value to store.
     * @param {Map<string, string>} table Destination table for key based storage.
     * @param {string} key Entry key when targeting a table.
     * @param {Map<string, string>[]} array Destination array when targeting an array.
     * @returns {void}
     */
    _writeTable(tableKey: string, value: string, table: Map<string, string>, key: string, array: Map<string, string>[]): void;
    /**
     * Serializes an array of primitives into typed envelopes and appends them to the destination array.
     *
     * @private
     * @param {Map<string, string>[]} array Destination array of typed entries.
     * @param {any[]} value Source array of primitives to serialize.
     * @param {_PdfDictionary} dictionary Current dictionary for reference resolution.
     * @param {boolean} [isColorSpace=false] Marks color space processing mode for unicode handling.
     * @returns {void}
     */
    _writeArray(array: Map<string, string>[], value: any[], dictionary: _PdfDictionary, isColorSpace?: boolean): void;
    /**
     * Converts a table into a JSON object string preserving pre formatted values.
     *
     * @private
     * @param {Map<string, string>} table Source table to convert.
     * @returns {string} JSON string representing the table.
     */
    _convertToJson(table: Map<string, string>): string;
    /**
     * Validates whether a string value is a well formed JSON array.
     *
     * @private
     * @param {string} value The string to validate as a JSON array.
     * @returns {boolean} True when the value is a valid JSON array, otherwise false.
     */
    private _isValidJsonArray;
    /**
     * Converts an array of tables into a JSON array string.
     *
     * @private
     * @param {Map<string, string>[]} array Source array of tables.
     * @returns {string} JSON string representing the array of objects.
     */
    _convertToJsonArray(array: Map<string, string>[]): string;
    /**
     * Parses a JSON byte array into a JavaScript value after trimming incomplete endings.
     *
     * @private
     * @param {PdfDocument} document Target document to initialize context.
     * @param {Uint8Array} data UTF8 encoded JSON bytes.
     * @returns {any} Parsed JSON value.
     */
    _parseJson(document: PdfDocument, data: Uint8Array): any;
    /**
     * Imports form field values from a JSON byte array into the document form.
     *
     * @private
     * @param {PdfDocument} document Target PDF document to receive form values.
     * @param {Uint8Array} data UTF8 encoded JSON bytes with form entries.
     * @returns {void}
     */
    _importFormData(document: PdfDocument, data: Uint8Array): void;
    /**
     * Imports annotations from a JSON byte array and adds them to the target document pages.
     *
     * @private
     * @param {PdfDocument} document Target PDF document to receive annotations.
     * @param {Uint8Array} data UTF8 encoded JSON bytes with annotation entries.
     * @returns {void}
     */
    _importAnnotations(document: PdfDocument, data: Uint8Array): void;
    /**
     * Populates a new annotation dictionary from parsed JSON values and queues related streams and references.
     *
     * @private
     * @param {_PdfDictionary} dictionary Destination annotation dictionary to update.
     * @param {any} annotation Parsed annotation object.
     * @param {string[]} annotationKeys Keys present in the parsed annotation object.
     * @returns {void}
     */
    _addAnnotationData(dictionary: _PdfDictionary, annotation: any, annotationKeys: string[]): void;
    /**
     * Parses a comma separated coordinate pair string and appends numeric values to the accumulator.
     *
     * @private
     * @param {string} value Comma separated coordinate pair.
     * @param {number[]} linePoints Accumulator receiving parsed numbers.
     * @returns {void}
     */
    _addLinePoints(value: string, linePoints: number[]): void;
    /**
     * Updates a dictionary with a string value when present.
     *
     * @private
     * @param {_PdfDictionary} dictionary Destination dictionary to update.
     * @param {string} key Entry key to set.
     * @param {string} value String value to store.
     * @returns {void}
     */
    _addString(dictionary: _PdfDictionary, key: string, value: string): void;
    /**
     * Updates a dictionary with a boolean value derived from a yes or true string.
     *
     * @private
     * @param {_PdfDictionary} dictionary Destination dictionary to update.
     * @param {string} key Entry key to set.
     * @param {string} value Source string representing a boolean.
     * @returns {void}
     */
    _addBoolean(dictionary: _PdfDictionary, key: string, value: string): void;
    /**
     * Applies border style properties to border and effect dictionaries based on style width intensity and dashes.
     *
     * @private
     * @param {string} key Property key such as width intensity or dashes.
     * @param {any} value Source value to convert and set.
     * @param {_PdfDictionary} borderEffectDictionary Destination effect dictionary.
     * @param {_PdfDictionary} borderStyleDictionary Destination border style dictionary.
     * @returns {void}
     */
    _addBorderStyle(key: string, value: any, borderEffectDictionary: _PdfDictionary, borderStyleDictionary: _PdfDictionary): void;
    /**
     * Parses a comma separated list into an array of floating point numbers.
     *
     * @private
     * @param {string} value Comma separated numeric list.
     * @returns {number[]} Array of parsed numbers.
     */
    _parseFloatPoints(value: string): number[];
    /**
     * Updates a dictionary with an array of numeric values when available.
     *
     * @private
     * @param {_PdfDictionary} dictionary Destination dictionary to update.
     * @param {string} key Entry key to set.
     * @param {number[]} value Numeric array to store.
     * @returns {void}
     */
    _addFloatPoints(dictionary: _PdfDictionary, key: string, value: number[]): void;
    /**
     * Builds and attaches a measure dictionary reference based on parsed annotation values.
     *
     * @private
     * @param {_PdfDictionary} dictionary Destination annotation dictionary.
     * @param {any} annotation Parsed annotation object.
     * @param {string[]} annotationKeys Keys present in the parsed annotation object.
     * @returns {void}
     */
    _addMeasureDictionary(dictionary: _PdfDictionary, annotation: any, annotationKeys: string[]): void;
    /**
     * Creates a PDF dictionary from a plain object of measurement elements.
     *
     * @private
     * @param {any} elements Plain object containing measurement properties.
     * @returns {_PdfDictionary} Constructed PDF dictionary with mapped entries.
     */
    _readDictionaryElements(elements: any): _PdfDictionary;
    /**
     * Adds binary stream data such as sound or embedded files to the annotation and updates related dictionaries.
     *
     * @private
     * @param {_PdfDictionary} dictionary Destination annotation dictionary.
     * @param {Map<string, string>} data Table containing stream metadata.
     * @param {string} values Hexadecimal string representing stream bytes.
     * @returns {void}
     */
    _addStreamData(dictionary: _PdfDictionary, data: Map<string, string>, values: string): void;
    /**
     * Decodes an encoded appearance string and applies the resulting appearance resources to the annotation.
     *
     * @private
     * @param {_PdfDictionary} dictionary Destination annotation dictionary to update.
     * @param {string} data Encoded appearance string.
     * @returns {void}
     */
    _addAppearanceData(dictionary: _PdfDictionary, data: string): void;
    /**
     * Parses a typed appearance wrapper into a PDF primitive value including names numbers strings arrays dictionaries streams and unicode strings.
     *
     * @private
     * @param {any} element Typed wrapper to parse.
     * @returns {any} Parsed primitive or reference.
     */
    _parseAppearance(element: any): any;
    /**
     * Converts a plain object with typed wrappers into a PDF dictionary.
     *
     * @private
     * @param {any} element Plain object containing typed wrappers.
     * @returns {_PdfDictionary} Constructed PDF dictionary.
     */
    _parseDictionary(element: any): _PdfDictionary;
    /**
     * Converts a typed stream wrapper into a PDF content stream and defers or applies dictionary resources.
     *
     * @private
     * @param {any} element Typed stream wrapper containing data and dictionary.
     * @returns {_PdfContentStream} Constructed PDF content stream.
     */
    _parseStream(element: any): _PdfContentStream;
    /**
     * Applies dictionary resources and compression flags to a content stream considering import context.
     *
     * @private
     * @param {_PdfContentStream} stream Target content stream to update.
     * @param {any} [element] Optional typed wrapper used when pending resources are present.
     * @returns {void}
     */
    _parseStreamElements(stream: _PdfContentStream, element?: any): void;
    /**
     * Escapes special characters for safe inclusion in JSON strings.
     *
     * @private
     * @param {string} value Input string to sanitize.
     * @returns {string} Sanitized string with escapes applied.
     */
    _getValidString(value: string): string;
}
