/* 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;

/**
 * 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>;

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

/**
 * 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;

/**
 * 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
 * - `chunk_max_size` (number, optional): maximum chunk size in bytes (default: 1500)
 */
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;

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 download: (a: number, b: number) => void;
    readonly downloadAll: (a: number) => void;
    readonly downloadedLanguages: (a: number) => void;
    readonly freeTree: (a: number) => void;
    readonly getLanguagePtr: (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 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>;
