/* tslint:disable */
/* eslint-disable */

export class WasmTree {
    private constructor();
    free(): void;
    [Symbol.dispose](): void;
}

/**
 * Returns an array of all available language names.
 */
export function availableLanguages(): any[];

/**
 * Get cache directory (not supported in WASM).
 */
export function cacheDir(): string;

/**
 * Clean cache (stub for WASM).
 * WASM has no persistent cache, so this is a no-op.
 */
export function cleanCache(): void;

/**
 * Configure the language pack (stub for WASM).
 * WASM cannot perform network I/O, so download functions are not supported.
 */
export function configure(_config: string): void;

/**
 * Detect language name from a file path or extension.
 * Returns null if the extension is not recognized.
 */
export function detectLanguage(path: string): string | undefined;

/**
 * Detect language name from file content (shebang-based detection).
 * Returns null if the content does not contain a recognized shebang.
 */
export function detectLanguageFromContent(content: string): string | undefined;

/**
 * Detect language name from a file extension (without leading dot).
 * Returns null if the extension is not recognized.
 */
export function detectLanguageFromExtension(ext: string): string | undefined;

/**
 * Detect language name from a file path.
 * Returns null if the path has no extension or the extension is not recognized.
 */
export function detectLanguageFromPath(path: string): string | undefined;

/**
 * Download specific languages (not supported in WASM).
 */
export function download(_languages: Array<any>): number;

/**
 * Download all languages (not supported in WASM).
 */
export function downloadAll(): number;

/**
 * Get downloaded languages (stub for WASM).
 * Returns empty array since WASM has no persistent cache.
 */
export function downloadedLanguages(): Array<any>;

/**
 * Returns extension ambiguity information for the given file extension as a JSON string.
 * Returns null if the extension is not ambiguous.
 * When non-null, parses to an object with "assigned" (string) and "alternatives" (string[]) fields.
 */
export function extensionAmbiguity(ext: string): string | undefined;

/**
 * Extract patterns from source code using a JavaScript config object.
 *
 * `config` is a JS object with fields:
 * - `language` (string, required): the language name
 * - `patterns` (object, required): named patterns to extract
 *
 * Accepts both camelCase and snake_case config keys.
 * Returns camelCase keys in the result for JavaScript convention.
 */
export function extract(source: string, config: any): any;

/**
 * Free the tree handle (called automatically by JS GC, but can be called manually).
 */
export function freeTree(_tree: WasmTree): void;

/**
 * Returns the bundled highlights query for the given language, or null.
 */
export function getHighlightsQuery(language: string): string | undefined;

/**
 * Returns the bundled injections query for the given language, or null.
 */
export function getInjectionsQuery(language: string): string | undefined;

/**
 * Returns the raw TSLanguage pointer as a u32 for wasm32 interop.
 *
 * Throws an error if the language is not found.
 */
export function getLanguagePtr(name: string): number;

/**
 * Returns the bundled locals query for the given language, or null.
 */
export function getLocalsQuery(language: string): string | undefined;

/**
 * Checks whether a language with the given name is available.
 */
export function hasLanguage(name: string): boolean;

/**
 * Initialize the language pack (stub for WASM).
 * WASM cannot perform network I/O, so download functions are not supported.
 */
export function init(_config: string): void;

/**
 * Returns the number of available languages.
 */
export function languageCount(): number;

/**
 * Get manifest languages (not supported in WASM).
 */
export function manifestLanguages(): Array<any>;

/**
 * Parse a source string using the named language and return an opaque tree handle.
 *
 * Throws an error if the language is not found or parsing fails.
 */
export function parseString(language: string, source: string): WasmTree;

/**
 * Process source code and extract metadata + chunks as a JavaScript object.
 *
 * `config` is a JS object with fields:
 * - `language` (string, required): the language name
 * - `chunkMaxSize` (number, optional): maximum chunk size in bytes (default: 1500)
 *
 * Accepts both camelCase and snake_case config keys (auto-normalized to snake_case).
 * Returns camelCase keys in the result for JavaScript convention.
 */
export function process(source: string, config: any): any;

/**
 * Check whether any node in the tree has the given type name.
 */
export function treeContainsNodeType(tree: WasmTree, node_type: string): boolean;

/**
 * Check whether the tree contains any ERROR or MISSING nodes.
 */
export function treeHasErrorNodes(tree: WasmTree): boolean;

/**
 * Get the number of named children of the root node.
 */
export function treeRootChildCount(tree: WasmTree): number;

/**
 * Get the type name of the root node.
 */
export function treeRootNodeType(tree: WasmTree): string;

/**
 * Validate extraction patterns without running them.
 *
 * `config` is a JS object with the same shape as for `extract`.
 *
 * Accepts both camelCase and snake_case config keys.
 * Returns camelCase keys in the result for JavaScript convention.
 */
export function validateExtraction(config: any): any;

export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;

export interface InitOutput {
    readonly memory: WebAssembly.Memory;
    readonly __wbg_wasmtree_free: (a: number, b: number) => void;
    readonly availableLanguages: (a: number) => void;
    readonly cacheDir: (a: number) => void;
    readonly cleanCache: (a: number) => void;
    readonly configure: (a: number, b: number, c: number) => void;
    readonly detectLanguage: (a: number, b: number, c: number) => void;
    readonly detectLanguageFromContent: (a: number, b: number, c: number) => void;
    readonly detectLanguageFromExtension: (a: number, b: number, c: number) => void;
    readonly download: (a: number, b: number) => void;
    readonly downloadAll: (a: number) => void;
    readonly downloadedLanguages: (a: number) => void;
    readonly extensionAmbiguity: (a: number, b: number, c: number) => void;
    readonly extract: (a: number, b: number, c: number, d: number) => void;
    readonly freeTree: (a: number) => void;
    readonly getHighlightsQuery: (a: number, b: number, c: number) => void;
    readonly getInjectionsQuery: (a: number, b: number, c: number) => void;
    readonly getLanguagePtr: (a: number, b: number, c: number) => void;
    readonly getLocalsQuery: (a: number, b: number, c: number) => void;
    readonly hasLanguage: (a: number, b: number) => number;
    readonly init: (a: number, b: number, c: number) => void;
    readonly iswalnum: (a: number) => number;
    readonly iswalpha: (a: number) => number;
    readonly iswspace: (a: number) => number;
    readonly manifestLanguages: (a: number) => void;
    readonly parseString: (a: number, b: number, c: number, d: number, e: number) => void;
    readonly process: (a: number, b: number, c: number, d: number) => void;
    readonly towupper: (a: number) => number;
    readonly treeContainsNodeType: (a: number, b: number, c: number, d: number) => void;
    readonly treeHasErrorNodes: (a: number, b: number) => void;
    readonly treeRootChildCount: (a: number, b: number) => void;
    readonly treeRootNodeType: (a: number, b: number) => void;
    readonly validateExtraction: (a: number, b: number) => void;
    readonly detectLanguageFromPath: (a: number, b: number, c: number) => void;
    readonly languageCount: () => number;
    readonly __wbindgen_export: (a: number, b: number) => number;
    readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
    readonly __wbindgen_export3: (a: number) => void;
    readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
    readonly __wbindgen_export4: (a: number, b: number, c: number) => void;
}

export type SyncInitInput = BufferSource | WebAssembly.Module;

/**
 * Instantiates the given `module`, which can either be bytes or
 * a precompiled `WebAssembly.Module`.
 *
 * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
 *
 * @returns {InitOutput}
 */
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;

/**
 * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
 * for everything else, calls `WebAssembly.instantiate` directly.
 *
 * @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
 *
 * @returns {Promise<InitOutput>}
 */
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
