/** * WASM escape hatch -- capability detection, module loading, and dispatch. * * Detects WebAssembly availability, loads the czap-compute WASM module, * and provides a unified kernel interface that transparently falls back * to pure TypeScript implementations when WASM is unavailable. * * Usage: * const kernels = WASMDispatch.kernels(); // TS fallbacks * await WASMDispatch.load(wasmUrl); // upgrade to WASM * const kernels2 = WASMDispatch.kernels(); // now WASM-backed * * @module */ /** Kernel functions available from both WASM and TS fallback. */ export interface WASMKernels { /** * Sample a spring easing at `samples` evenly-spaced points in [0, 1]. * Returns Float32Array of length `samples + 1`. */ springCurve(stiffness: number, damping: number, mass: number, samples: number): Float32Array; /** * Batch boundary evaluation. For each value, returns the index of the * highest threshold where `value >= threshold`. * Thresholds must be sorted ascending. */ batchBoundaryEval(thresholds: Float64Array, values: Float64Array): Uint32Array; /** * Normalize weights in-place so positive values sum to 1.0. * Negative weights clamped to 0. Returns the (modified) input array. */ blendNormalize(weights: Float32Array): Float32Array; } /** * Public API of the {@link WASMDispatch} singleton: probe for WebAssembly, * asynchronously load the Rust compute module, and hand back either WASM or * {@link fallbackKernels} via {@link WASMDispatchAPI.kernels}. */ export interface WASMDispatchAPI { detect(): boolean; load(wasmUrl: string | ArrayBuffer): Promise; kernels(): WASMKernels; isLoaded(): boolean; unload(): void; } /** * WASMDispatch — singleton that wires the Rust compute crate (spring, boundary, * blend kernels) into the runtime, falling back to {@link fallbackKernels} * when WebAssembly is unavailable or the module fails to load. */ export declare const WASMDispatch: WASMDispatchAPI; //# sourceMappingURL=wasm-dispatch.d.ts.map