/**
 * Serialize state for client hydration
 * Called during server-side rendering
 */
export declare function serializeState(state: Partial<HydrationState>): string;
/**
 * Generate the state injection script for server-rendered HTML
 */
export declare function generateStateScript(state: Partial<HydrationState>): string;
/**
 * Generate event bindings data attribute
 */
export declare function generateEventBindings(events: EventBinding[]): string;
/**
 * Extract and parse state from server-rendered HTML
 */
export declare function extractState(): HydrationState | null;
/**
 * Generate the hydration runtime script for embedding in HTML
 */
export declare function generateHydrationScript(state?: Partial<HydrationState>): string;
/**
 * Get or create the hydration runtime
 */
export declare function getHydrationRuntime(options?: HydrationOptions): HydrationRuntime;
/**
 * Start hydration (convenience function)
 */
export declare function hydrate(options?: HydrationOptions): Promise<void>;
/**
 * Generate hydration CSS
 */
export declare function generateHydrationCSS(): string;
/* eslint-disable prefer-const, style/max-statements-per-line, no-super-linear-backtracking, regexp/no-unused-capturing-group */
/**
 * STX Hydration Runtime
 *
 * Comprehensive client-side hydration system that bridges server-rendered
 * HTML with client-side interactivity. Similar to React's hydrateRoot or
 * Vue's createSSRApp.
 *
 * ## Features
 *
 * - Full page hydration with state restoration
 * - Selective/partial hydration (islands architecture)
 * - Event handler binding from server-rendered HTML
 * - Integration with stx reactivity system
 * - Seamless SPA router integration
 * - Progressive enhancement support
 * - Error boundaries for hydration failures
 *
 * ## Usage
 *
 * Server-side (stx template):
 * ```html
 * <script>
 * const count = 0
 * const user = { name: 'Alice' }
 * </script>
 *
 * <button @click="count++">Count: {{ count }}</button>
 * <p>Hello, {{ user.name }}</p>
 * ```
 *
 * The framework automatically:
 * 1. Renders HTML on server
 * 2. Serializes state and embeds in HTML
 * 3. Client loads, hydrates, binds events
 * 4. Page becomes interactive
 *
 * @module hydration
 */
// =============================================================================
// Types
// =============================================================================
export declare interface HydrationState {
  refs: Record<string, unknown>
  reactive: Record<string, unknown>
  props: Record<string, unknown>
  routeParams: Record<string, string>
  stores: Record<string, unknown>
  meta: {
    title?: string
    description?: string
    url?: string
  }
  timestamp: number
  checksum?: string
}
export declare interface HydrationOptions {
  root?: string | HTMLElement
  strict?: boolean
  onHydrating?: () => void
  onHydrated?: () => void
  onError?: (error: Error) => void
  performance?: boolean
  timeout?: number
}
export declare interface EventBinding {
  type: string
  handler: string
  modifiers?: string[]
  preventDefault?: boolean
  stopPropagation?: boolean
}
export declare interface ComponentHydrationConfig {
  id: string
  name: string
  strategy: 'eager' | 'lazy' | 'idle' | 'visible' | 'interaction'
  props: Record<string, unknown>
  events: EventBinding[]
}
/**
 * Main hydration class
 */
export declare class HydrationRuntime {
  constructor(options?: HydrationOptions);
  hydrate(): Promise<void>;
  get hydrated(): boolean;
  getState(): HydrationState | null;
  hydrateById(componentId: string): Promise<void>;
}
// =============================================================================
// Exports
// =============================================================================
export default {
  HydrationRuntime,
  serializeState,
  generateStateScript,
  generateHydrationScript,
  generateHydrationCSS,
  extractState,
  getHydrationRuntime,
  hydrate,
};
