/* tslint:disable */
/* eslint-disable */
/**
 * The `ReadableStreamType` enum.
 *
 * *This API requires the following crate features to be activated: `ReadableStreamType`*
 */

export type ReadableStreamType = "bytes";

export class IntoUnderlyingByteSource {
    private constructor();
    free(): void;
    [Symbol.dispose](): void;
    cancel(): void;
    pull(controller: ReadableByteStreamController): Promise<any>;
    start(controller: ReadableByteStreamController): void;
    readonly autoAllocateChunkSize: number;
    readonly type: ReadableStreamType;
}

export class IntoUnderlyingSink {
    private constructor();
    free(): void;
    [Symbol.dispose](): void;
    abort(reason: any): Promise<any>;
    close(): Promise<any>;
    write(chunk: any): Promise<any>;
}

export class IntoUnderlyingSource {
    private constructor();
    free(): void;
    [Symbol.dispose](): void;
    cancel(): void;
    pull(controller: ReadableStreamDefaultController): Promise<any>;
}

/**
 * Browser-side Teamtype peer. Owns the command channels and spawns the three
 * services (node, connection, document) on construction.
 */
export class TeamtypeClient {
    free(): void;
    [Symbol.dispose](): void;
    /**
     * Apply an edit to a file.
     */
    applyEdit(file_name: string, delta: any): void;
    /**
     * Connect to a peer using a secret address (`<node_id>#<passphrase>`).
     */
    connectByAddress(address: string): void;
    /**
     * Connect to a peer using a wormhole join code.
     */
    connectByJoinCode(join_code: string): void;
    /**
     * Bind an iroh endpoint and start the service tasks.
     */
    constructor();
    /**
     * Gets our own node info (`{ nodeId, passphrase }`), or `null` until ready.
     */
    nodeInfo(): any;
    /**
     * Register `disconnect(reason: DisconnectReason)`.
     */
    onDisconnect(callback: Function): void;
    /**
     * Register `onEdit(fileName: string, delta)`.
     */
    onEdit(callback: Function): void;
    /**
     * Register `onEphemeral(message: EphemeralMessage)`.
     */
    onEphemeral(callback: Function): void;
    /**
     * Register `onEphemeralRemoved(cursorId: string)`.
     */
    onEphemeralRemoved(callback: Function): void;
    /**
     * Register `onFileContent(fileName: string, content: string)`.
     */
    onFileContent(callback: Function): void;
    /**
     * Register `onFiles(files: string[])`.
     */
    onFiles(callback: Function): void;
    /**
     * Register `onLog(message: string)`.
     */
    onLog(callback: Function): void;
    /**
     * Register `onPeers(peers: string[])`.
     */
    onPeers(callback: Function): void;
    /**
     * Request the content of a file. The result will be returned asynchronously through
     * `onFileContent` callback.
     */
    selectFile(file_name: string): void;
    /**
     * Broadcast cursor.
     */
    setCursor(file_name: string, ranges: any): void;
    /**
     * Set our display name.
     */
    setName(name: string): void;
}

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

export interface InitOutput {
    readonly memory: WebAssembly.Memory;
    readonly __wbg_teamtypeclient_free: (a: number, b: number) => void;
    readonly teamtypeclient_applyEdit: (a: number, b: number, c: number, d: any) => void;
    readonly teamtypeclient_connectByAddress: (a: number, b: number, c: number) => void;
    readonly teamtypeclient_connectByJoinCode: (a: number, b: number, c: number) => void;
    readonly teamtypeclient_new: () => number;
    readonly teamtypeclient_nodeInfo: (a: number) => any;
    readonly teamtypeclient_onDisconnect: (a: number, b: any) => void;
    readonly teamtypeclient_onEdit: (a: number, b: any) => void;
    readonly teamtypeclient_onEphemeral: (a: number, b: any) => void;
    readonly teamtypeclient_onEphemeralRemoved: (a: number, b: any) => void;
    readonly teamtypeclient_onFileContent: (a: number, b: any) => void;
    readonly teamtypeclient_onFiles: (a: number, b: any) => void;
    readonly teamtypeclient_onLog: (a: number, b: any) => void;
    readonly teamtypeclient_onPeers: (a: number, b: any) => void;
    readonly teamtypeclient_selectFile: (a: number, b: number, c: number) => void;
    readonly teamtypeclient_setCursor: (a: number, b: number, c: number, d: any) => void;
    readonly teamtypeclient_setName: (a: number, b: number, c: number) => void;
    readonly __wbg_intounderlyingsource_free: (a: number, b: number) => void;
    readonly intounderlyingsource_cancel: (a: number) => void;
    readonly intounderlyingsource_pull: (a: number, b: any) => any;
    readonly __wbg_intounderlyingbytesource_free: (a: number, b: number) => void;
    readonly intounderlyingbytesource_autoAllocateChunkSize: (a: number) => number;
    readonly intounderlyingbytesource_cancel: (a: number) => void;
    readonly intounderlyingbytesource_pull: (a: number, b: any) => any;
    readonly intounderlyingbytesource_start: (a: number, b: any) => void;
    readonly intounderlyingbytesource_type: (a: number) => number;
    readonly __wbg_intounderlyingsink_free: (a: number, b: number) => void;
    readonly intounderlyingsink_abort: (a: number, b: any) => any;
    readonly intounderlyingsink_close: (a: number) => any;
    readonly intounderlyingsink_write: (a: number, b: any) => any;
    readonly ring_core_0_17_14__bn_mul_mont: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
    readonly wasm_bindgen_a1427d1cfc54b76a___convert__closures_____invoke___wasm_bindgen_a1427d1cfc54b76a___JsValue__core_c09542a5c46f04b6___result__Result_____wasm_bindgen_a1427d1cfc54b76a___JsError___true_: (a: number, b: number, c: any) => [number, number];
    readonly wasm_bindgen_a1427d1cfc54b76a___convert__closures_____invoke___js_sys_bee433b15c647e3e___Function_fn_wasm_bindgen_a1427d1cfc54b76a___JsValue_____wasm_bindgen_a1427d1cfc54b76a___sys__Undefined___js_sys_bee433b15c647e3e___Function_fn_wasm_bindgen_a1427d1cfc54b76a___JsValue_____wasm_bindgen_a1427d1cfc54b76a___sys__Undefined_______true_: (a: number, b: number, c: any, d: any) => void;
    readonly wasm_bindgen_a1427d1cfc54b76a___convert__closures_____invoke___wasm_bindgen_a1427d1cfc54b76a___JsValue______true_: (a: number, b: number, c: any) => void;
    readonly wasm_bindgen_a1427d1cfc54b76a___convert__closures_____invoke___web_sys_9299a82c88baa8d___features__gen_CloseEvent__CloseEvent______true_: (a: number, b: number, c: any) => void;
    readonly wasm_bindgen_a1427d1cfc54b76a___convert__closures_____invoke___web_sys_9299a82c88baa8d___features__gen_MessageEvent__MessageEvent______true_: (a: number, b: number, c: any) => void;
    readonly wasm_bindgen_a1427d1cfc54b76a___convert__closures_____invoke_______true_: (a: number, b: number) => void;
    readonly wasm_bindgen_a1427d1cfc54b76a___convert__closures_____invoke_______true__1_: (a: number, b: number) => void;
    readonly wasm_bindgen_a1427d1cfc54b76a___convert__closures_____invoke_______true__2_: (a: number, b: number) => void;
    readonly __wbindgen_malloc: (a: number, b: number) => number;
    readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
    readonly __wbindgen_exn_store: (a: number) => void;
    readonly __externref_table_alloc: () => number;
    readonly __wbindgen_externrefs: WebAssembly.Table;
    readonly __wbindgen_destroy_closure: (a: number, b: number) => void;
    readonly __externref_table_dealloc: (a: 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>;
