import { n as I18nConfig } from "./index-DFrWGSeW.js";
import { D as LoaderOutput, T as LoaderConfig } from "./index-Dyo_baWl.js";
import { n as StructuredData } from "./remark-structure-CV606E7e.js";
import { t as Awaitable } from "./types-Dvkw0Kd0.js";
import { r as SortedResult } from "./index-BlFx9iJj.js";
import { Language, RawData, SearchParams, TypedDocument, ZBSearch, create } from "zbsearch";
type SimpleDocument = TypedDocument<ZBSearch<typeof simpleSchema>>;
declare const simpleSchema: {
  readonly url: 'string';
  readonly title: 'string';
  readonly breadcrumbs: 'string[]';
  readonly description: 'string';
  readonly content: 'string';
  readonly keywords: 'string';
  readonly locale: 'enum';
};
type AdvancedDocument = TypedDocument<ZBSearch<typeof advancedSchema>>;
declare const advancedSchema: {
  readonly content: 'string';
  readonly page_id: 'string';
  readonly type: 'string';
  readonly breadcrumbs: 'string[]';
  readonly tags: 'enum[]';
  readonly url: 'string';
  readonly locale: 'enum';
  readonly embeddings: 'vector[512]';
};
interface SharedIndex {
  /** unique among pages, without `#` */
  id: string;
  title: string;
  description?: string;
  breadcrumbs?: string[];
  /**
   * Locale of content (for i18n)
   */
  locale?: string;
  /**
   * Required if tag filter is enabled
   */
  tag?: string | string[];
  /**
   * preprocess mdx content with `structure`
   */
  structuredData: StructuredData;
  url: string;
}
type CreateInput = NonNullable<Parameters<typeof create>[0]>;
interface SharedOptions extends Pick<CreateInput, 'sort' | 'components' | 'plugins'> {
  /**
   * Tokenizer language.
   *
   * @defaultValue 'multilingual' - works with every language, zero config needed.
   */
  language?: string;
  tokenizer?: Required<CreateInput>['components']['tokenizer'];
  /**
   * Filter search results by the `locale` query option, requires indexes to include a `locale` property.
   *
   * Enabled automatically by i18n search servers.
   */
  localeFilter?: boolean;
}
interface EngineQueryOptions extends QueryOptions {
  mode?: 'full' | 'vector';
}
/**
 * Resolve indexes dynamically
 */
type Dynamic<T> = () => Awaitable<T[]>;
interface SimpleOptions extends SharedOptions {
  indexes: Index[] | Dynamic<Index>;
  /**
   * Customize search options on server
   */
  search?: Partial<SearchParams<ZBSearch<typeof simpleSchema>, SimpleDocument>>;
}
interface AdvancedOptions extends SharedOptions {
  indexes: AdvancedIndex[] | Dynamic<AdvancedIndex>;
  /**
   * Customize search options on server
   */
  search?: Partial<SearchParams<ZBSearch<typeof advancedSchema>, AdvancedDocument>>;
}
interface Index {
  title: string;
  description?: string;
  breadcrumbs?: string[];
  content: string;
  url: string;
  keywords?: string;
  locale?: string;
}
type ExportedData = (RawData & {
  type: 'simple' | 'advanced';
  i18n?: boolean;
}) | {
  type: 'i18n';
  data: Record<string, RawData & {
    type: 'simple' | 'advanced';
  }>;
};
declare function initSimpleSearch(options: SimpleOptions): SearchServer<EngineQueryOptions>;
type AdvancedIndex = SharedIndex;
declare function initAdvancedSearch(options: AdvancedOptions): SearchServer<EngineQueryOptions>;
declare function createSearchAPI(type: 'simple', options: SimpleOptions): SearchAPI<EngineQueryOptions>;
declare function createSearchAPI(type: 'advanced', options: AdvancedOptions): SearchAPI<EngineQueryOptions>;
type I18nOptions<O extends SimpleOptions | AdvancedOptions, Idx> = Omit<O, 'language' | 'indexes'> & {
  i18n: I18nConfig;
  /**
   * Map locale name from i18n config to a compatible `language` or options.
   *
   * @deprecated No longer needed - the default `multilingual` tokenizer supports every language with zero config.
   * When specified, a separate database is created for each locale (legacy behaviour).
   */
  localeMap?: Record<string, Language | Partial<O> | undefined>;
  indexes: WithLocale<Idx>[] | Dynamic<WithLocale<Idx>>;
};
type I18nSimpleOptions = I18nOptions<SimpleOptions, Index>;
type I18nAdvancedOptions = I18nOptions<AdvancedOptions, AdvancedIndex>;
type WithLocale<T> = T & {
  locale: string;
};
declare function createI18nSearchAPI(type: 'simple', options: I18nSimpleOptions): SearchAPI<EngineQueryOptions>;
declare function createI18nSearchAPI(type: 'advanced', options: I18nAdvancedOptions): SearchAPI<EngineQueryOptions>;
interface Options<C extends LoaderConfig> extends Omit<AdvancedOptions, 'indexes'> {
  /**
   * @deprecated No longer needed - the default `multilingual` tokenizer supports every language with zero config.
   */
  localeMap?: { [K in C['i18n'] extends I18nConfig<infer Languages> ? Languages : string]?: Partial<AdvancedOptions> | Language; };
  buildIndex?: (page: C['page']) => Awaitable<AdvancedIndex>;
}
/**
 * create server from loader, if passed as function, the server will re-index all records once a different instance of loader is returned.
 */
declare function createFromSource<C extends LoaderConfig = LoaderConfig>(loader: LoaderOutput<C> | (() => Awaitable<LoaderOutput<C>>), options?: Options<C>): SearchAPI<EngineQueryOptions>;
interface QueryOptions {
  locale?: string | null;
  tag?: string | string[];
  limit?: number;
}
interface SearchServer<Q extends QueryOptions = QueryOptions> {
  search: (query: string, options?: Q) => Promise<SortedResult[]>;
  /**
   * Export the database
   *
   * You can reference the exported database to implement client-side search
   */
  export: () => Promise<unknown>;
}
interface SearchAPI<Q extends QueryOptions = QueryOptions> extends SearchServer<Q> {
  GET: (request: Request) => Promise<Response>;
  /**
   * `GET` route handler that exports search indexes for static search.
   */
  staticGET: () => Promise<Response>;
}
export { AdvancedOptions as a, SimpleOptions as c, createSearchAPI as d, initAdvancedSearch as f, AdvancedIndex as i, createFromSource as l, SharedIndex as m, SearchAPI as n, ExportedData as o, initSimpleSearch as p, SearchServer as r, Index as s, QueryOptions as t, createI18nSearchAPI as u };