/* tslint:disable */
/* eslint-disable */
/**
 * Export patches as JSON string (for debugging)
 */
export function patchesToJson(patches: any): string;
/**
 * Parse Hypen DSL and return AST as JSON
 */
export function parseToJson(source: string): string;
export function main(): void;
/**
 * WASM-exported engine instance for JavaScript runtimes
 * Uses Rc<RefCell<>> instead of Send+Sync for WASM single-threaded environment
 */
export class WasmEngine {
  free(): void;
  [Symbol.dispose](): void;
  /**
   * Create a new engine instance
   */
  constructor();
  /**
   * Parse and render Hypen DSL source code
   */
  renderSource(source: string): void;
  /**
   * Set the render callback that receives patches
   */
  setRenderCallback(callback: Function): void;
  /**
   * Set the component resolver callback
   * The resolver receives (componentName, contextPath) and should return
   * { source: string, path: string } or null
   *
   * contextPath is the path of the component that's referencing this component
   * The returned path should be the resolved absolute path to the component file
   */
  setComponentResolver(resolver: Function): void;
  /**
   * Register a primitive element (like Text, Button, etc.) to skip component resolution
   * This prevents unnecessary resolver calls for built-in DOM elements
   */
  registerPrimitive(name: string): void;
  /**
   * Render a component source (for lazy loading routes)
   * This allows rendering a component on-demand
   */
  renderLazyComponent(source: string): void;
  /**
   * Render a component into a specific parent node (subtree rendering)
   * This is used for lazy routing where components are rendered on-demand into route containers
   *
   * # Arguments
   * * `source` - The Hypen DSL source to parse and render
   * * `parent_node_id_str` - The serialized node ID string of the parent element
   * * `state_js` - The state to use for rendering (as JsValue)
   */
  renderInto(source: string, parent_node_id_str: string, state_js: any): void;
  /**
   * Update state from JavaScript
   */
  updateState(state_patch: any): void;
  /**
   * Update state using sparse path-value pairs
   * More efficient than updateState for large state objects when only a few paths changed
   *
   * # Arguments
   * * `paths_js` - Array of changed paths (e.g., ["user.name", "count"])
   * * `values_js` - Object mapping paths to their new values (e.g., { "user.name": "Bob", "count": 42 })
   */
  updateStateSparse(paths_js: any, values_js: any): void;
  /**
   * Dispatch an action
   */
  dispatchAction(name: string, payload: any): void;
  /**
   * Register an action handler
   */
  onAction(action_name: string, handler: Function): void;
  /**
   * Clear the engine tree (useful when switching samples)
   */
  clearTree(): void;
  /**
   * Debug method to inspect parsed components
   */
  debugParseComponent(source: string): string;
  /**
   * Initialize a module
   */
  setModule(name: string, actions: string[], state_keys: string[], initial_state: any): void;
  /**
   * Get the current revision number
   */
  getRevision(): bigint;
}

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

export interface InitOutput {
  readonly memory: WebAssembly.Memory;
  readonly __wbg_wasmengine_free: (a: number, b: number) => void;
  readonly wasmengine_new: () => number;
  readonly wasmengine_setRenderCallback: (a: number, b: any) => void;
  readonly wasmengine_setComponentResolver: (a: number, b: any) => void;
  readonly wasmengine_registerPrimitive: (a: number, b: number, c: number) => void;
  readonly wasmengine_renderLazyComponent: (a: number, b: number, c: number) => [number, number];
  readonly wasmengine_renderInto: (a: number, b: number, c: number, d: number, e: number, f: any) => [number, number];
  readonly wasmengine_updateState: (a: number, b: any) => [number, number];
  readonly wasmengine_updateStateSparse: (a: number, b: any, c: any) => [number, number];
  readonly wasmengine_dispatchAction: (a: number, b: number, c: number, d: any) => [number, number];
  readonly wasmengine_onAction: (a: number, b: number, c: number, d: any) => void;
  readonly wasmengine_clearTree: (a: number) => void;
  readonly wasmengine_debugParseComponent: (a: number, b: number, c: number) => [number, number, number, number];
  readonly wasmengine_setModule: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: any) => [number, number];
  readonly wasmengine_getRevision: (a: number) => bigint;
  readonly patchesToJson: (a: any) => [number, number, number, number];
  readonly parseToJson: (a: number, b: number) => [number, number, number, number];
  readonly main: () => void;
  readonly wasmengine_renderSource: (a: number, b: number, c: number) => [number, number];
  readonly __wbindgen_exn_store: (a: number) => void;
  readonly __externref_table_alloc: () => number;
  readonly __wbindgen_export_2: WebAssembly.Table;
  readonly __wbindgen_malloc: (a: number, b: number) => number;
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
  readonly __externref_table_dealloc: (a: number) => void;
  readonly __wbindgen_free: (a: number, b: number, c: number) => void;
  readonly __wbindgen_start: () => 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>;
