import type { QualifiedAttribute } from 'sax';
import { Readable, Transform, type TransformOptions, type TransformCallback } from 'node:stream';
import { type IndexItem, type XMLToSitemapIndexItemStreamOptions } from './types.js';
import { SaxParserStream } from './sax-parser-stream.js';
export type { XMLToSitemapIndexItemStreamOptions };
/**
 * Takes a stream of xml and transforms it into a stream of IndexItems
 * Use this to parse existing sitemap indices into config options compatible with this library
 *
 * Emits `'maxEntriesExceeded'` (with the cap) once, when the first entry past
 * `maxEntries` is seen. If nothing listens for that event, the stream logs the
 * overflow through its logger instead.
 */
export declare class XMLToSitemapIndexStream extends SaxParserStream<IndexItem> {
    private currentItem;
    constructor(opts?: XMLToSitemapIndexItemStreamOptions);
    protected onCharData(tag: string, text: string): void;
    protected onAttribute(currentTag: string, attr: QualifiedAttribute): void;
    protected onCloseTag(tag: string): void;
}
/**
  Read xml and resolve with the configuration that would produce it or reject with
  an error
  ```
  import { createReadStream } from 'fs'
  import { Readable } from 'stream'
  import { parseSitemapIndex, SitemapIndexStream, streamToPromise } from 'sitemap'
  const items = await parseSitemapIndex(createReadStream('./example-index.xml'))
  // produces the same xml
  // you can, of course, more practically modify it or store it
  const smis = new SitemapIndexStream()
  Readable.from(items).pipe(smis)
  console.log((await streamToPromise(smis)).toString())
  ```
  @param {Readable} xml what to parse
  @param {number} maxEntries Maximum number of sitemap entries to parse (default: 50,000 per sitemaps.org spec).
    Values above 50,000 have no effect: the spec caps a sitemap index at 50,000 entries, and larger sets must be split.
    0 rejects on the first entry. Anything other than a non-negative integer or Infinity rejects immediately.
  @return {Promise<IndexItem[]>} resolves with list of index items that can be fed into a SitemapIndexStream. Rejects with an Error object.
 */
export declare function parseSitemapIndex(xml: Readable, maxEntries?: number): Promise<IndexItem[]>;
export interface IndexObjectStreamToJSONOptions extends TransformOptions {
    lineSeparated: boolean;
}
/**
 * A Transform that converts a stream of objects into a JSON Array or a line
 * separated stringified JSON
 * @param [lineSeparated=false] whether to separate entries by a new line or comma
 */
export declare class IndexObjectStreamToJSON extends Transform {
    lineSeparated: boolean;
    firstWritten: boolean;
    constructor(opts?: IndexObjectStreamToJSONOptions);
    _transform(chunk: IndexItem, encoding: string, cb: TransformCallback): void;
    _flush(cb: TransformCallback): void;
}
