import Fuse, { IFuseOptions } from 'fuse.js'; import { I as IndexDocumentsOptions, U as UrlOrEntry, d as IndexedDocument, e as IndexedPdf } from './types-DZE2UBNA.js'; interface CreateFuseOptions extends IndexDocumentsOptions { urls: UrlOrEntry[]; fuseOptions?: IFuseOptions; } declare const DEFAULT_FUSE_OPTIONS: IFuseOptions; /** * Index a URL list and build a Fuse instance over the results. Mostly * useful from a Node prebuild script; in the browser, prefer constructing * Fuse directly from a fetched JSON index. * * Now multi-format (1.1+) — auto-detects PDF/DOCX/PPTX/XLSX from URL * extension. To preserve the 1.0.x PDF-only behavior, pass * `{ pdfOnly: true }` or use `createFusePdfIndex` (alias). */ declare function createFuseIndex(opts: CreateFuseOptions): Promise>; /** Back-compat: 1.0.x callers expecting PDF-only dispatch. */ declare function createFusePdfIndex(opts: CreateFuseOptions): Promise>; /** * Build a Fuse instance AND serialize its internal index for runtime * pre-parse. Returns both the index instance (for build-time queries if * needed) and the serialized index JSON (write this to disk alongside * your rows JSON; consumers load it via `Fuse.parseIndex` at runtime to * skip the in-browser build cost). * * Workflow: * * // Build time (Node) * const { rows, indexJson } = await prebuildFuseIndex(urls, fuseOptions); * writeFileSync('public/searchIndex.documents.json', JSON.stringify(rows)); * writeFileSync('public/searchIndex.fuse-index.json', indexJson); * * // Runtime (browser) * const [rows, indexJson] = await Promise.all([ * fetch('/searchIndex.documents.json').then(r => r.json()), * fetch('/searchIndex.fuse-index.json').then(r => r.json()), * ]); * const fuseIndex = Fuse.parseIndex(indexJson); * const fuse = new Fuse(rows, fuseOptions, fuseIndex); * * Cuts in-browser first-paint Fuse build time from ~10s (at 2K rows) to * ~200ms parse. For corpora < 1K rows the difference is barely visible; * for corpora > 1K rows it's a meaningful UX improvement. * * Added in 1.2. */ declare function prebuildFuseIndex(urls: UrlOrEntry[], options?: IndexDocumentsOptions & { fuseOptions?: IFuseOptions; }): Promise<{ rows: IndexedDocument[]; indexJson: string; }>; /** * Build the prebuilt Fuse index from already-extracted rows. Use this * when you've already produced `IndexedDocument[]` via `indexDocuments` * or an adapter and just want the serialized index. * * Added in 1.2. */ declare function serializeFuseIndex(rows: IndexedDocument[], fuseOptions?: IFuseOptions): string; export { type CreateFuseOptions, DEFAULT_FUSE_OPTIONS, createFuseIndex, createFusePdfIndex, prebuildFuseIndex, serializeFuseIndex };