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

/**
 * Cut every link whose midpoint is within `radius` of (x, y). Returns links cut.
 */
export function cloth_cut(x: number, y: number, radius: number): number;

/**
 * Hold a grabbed particle at (x, y); a negative index does nothing.
 */
export function cloth_drag(index: number, x: number, y: number): void;

/**
 * Nearest particle within `radius` of (x, y), or -1.
 */
export function cloth_grab(x: number, y: number, radius: number): number;

/**
 * Intact links as particle index pairs a0, b0, a1, b1 …
 */
export function cloth_links(): Uint32Array;

/**
 * Create a cloth of `cols`×`rows` particles `spacing` pixels apart, centred at the top of
 * a `width`×`height` area; every `pin_every`-th particle of the top row (and the last
 * one) is fixed.
 */
export function cloth_new(cols: number, rows: number, spacing: number, width: number, height: number, pin_every: number): void;

/**
 * Particle positions, x0, y0, x1, y1 …
 */
export function cloth_positions(): Float32Array;

/**
 * Let go of a particle (it keeps moving with the velocity it had).
 */
export function cloth_release(index: number): void;

/**
 * Advance by `dt` seconds with `iterations` constraint passes. `tear` is the stretch
 * ratio at which a link breaks (0 = never). Returns the number of intact links.
 */
export function cloth_step(dt: number, iterations: number, gravity: number, wind: number, tear: number): number;

/**
 * Current length / rest length of each intact link (same order as `cloth_links`).
 */
export function cloth_stretch(): Float32Array;

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

export interface InitOutput {
    readonly memory: WebAssembly.Memory;
    readonly cloth_cut: (a: number, b: number, c: number) => number;
    readonly cloth_drag: (a: number, b: number, c: number) => void;
    readonly cloth_grab: (a: number, b: number, c: number) => number;
    readonly cloth_links: () => [number, number];
    readonly cloth_new: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
    readonly cloth_positions: () => [number, number];
    readonly cloth_release: (a: number) => void;
    readonly cloth_step: (a: number, b: number, c: number, d: number, e: number) => number;
    readonly cloth_stretch: () => [number, number];
    readonly __wbindgen_externrefs: WebAssembly.Table;
    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>;
