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

export type ReadableStreamType = "bytes";

/**
 * JS HTTP client callbacks. Implement using fetch() or any HTTP library.
 */
export interface JsHttpClientConfig {
    execute(url: string, method: string, headers: Record<string, string>, body: Uint8Array | null): Promise<{ statusCode: number; body: Uint8Array }>;
}



/**
 * JS transport callbacks for WebSocket management.
 *
 * Passed to `createWhatsAppClient` as the transport config.
 *
 * `connect(handle)` is called when the client needs a connection:
 *   - Create a WebSocket
 *   - Wire ws.onopen → handle.onConnected()
 *   - Wire ws.onmessage → handle.onData(data)
 *   - Wire ws.onclose → handle.onDisconnected()
 *
 * `send(data)` sends raw bytes over the active WebSocket.
 * `disconnect()` closes the WebSocket.
 */
export interface JsTransportHandle {
    onConnected(): void;
    onData(data: Uint8Array): void;
    onDisconnected(): void;
}

export interface JsTransportCallbacks {
    connect(handle: JsTransportHandle): void | Promise<void>;
    send(data: Uint8Array): void | Promise<void>;
    disconnect(): void | Promise<void>;
}



/**
 * Native crypto callbacks installed via `initWasmEngine`.
 * Pass `makeNativeCryptoProvider()` from the baileyrs host wrapper.
 */
export interface JsCryptoCallbacks {
    aesCbc256Encrypt(key: Uint8Array, iv: Uint8Array, plaintext: Uint8Array): Uint8Array;
    aesCbc256Decrypt(key: Uint8Array, iv: Uint8Array, ciphertext: Uint8Array): Uint8Array;
    aesGcm256Encrypt(key: Uint8Array, nonce: Uint8Array, aad: Uint8Array, plaintext: Uint8Array): Uint8Array;
    aesGcm256Decrypt(key: Uint8Array, nonce: Uint8Array, aad: Uint8Array, ciphertextWithTag: Uint8Array): Uint8Array;
    hmacSha256(key: Uint8Array, data: Uint8Array): Uint8Array;
}



/**
 * Participant info as carried inside an event-time `GroupNotificationAction`.
 * Distinct from `GroupMetadataParticipant` (returned by `getGroupMetadata`,
 * which carries stringified `jid`/`phoneNumber` plus `isAdmin`).
 */
export interface GroupParticipantInfo {
    jid: Jid;
    phone_number?: Jid | null;
}



/**
 * Server-pushed MEX (GraphQL) update, e.g.
 * `NotificationUserReachoutTimelockUpdate`. Routed by `op_name`.
 */
export interface MexNotification {
    op_name: string;
    from?: Jid | null;
    stanza_id?: string | null;
    offline: boolean;
    payload: Record<string, unknown>;
}

/** GraphQL error returned inside a MEX response's `errors` array. */
export interface MexGraphQLError {
    message: string;
    extensions?: {
        error_code?: number | null;
        severity?: string | null;
        is_retryable?: boolean | null;
    } | null;
}

/** Response from `mexQuery`. `data` is the GraphQL payload (op-specific). */
export interface MexResponse {
    data: Record<string, unknown> | null;
    errors: MexGraphQLError[] | null;
}



/** One audio codec advertised inside a call `<offer>` child. */
export interface CallAudioCodec {
    enc: string;
    rate: number;
}

/**
 * Lifecycle action carried inside an inbound `<call>` stanza. The discriminant
 * (`type`) matches the stanza child name; `pre_accept` is the snake_case form
 * of `<pre-accept>`.
 */
export type CallAction =
| {
    type: "offer";
    call_id: string;
    call_creator: Jid;
    caller_pn?: Jid | null;
    caller_country_code?: string | null;
    device_class?: string | null;
    joinable: boolean;
    is_video: boolean;
    audio: CallAudioCodec[];
}
| { type: "pre_accept"; call_id: string; call_creator: Jid }
| { type: "accept"; call_id: string; call_creator: Jid }
| { type: "reject"; call_id: string; call_creator: Jid }
| {
    type: "terminate";
    call_id: string;
    call_creator: Jid;
    duration?: number | null;
    audio_duration?: number | null;
};

/**
 * Inbound `<call>` stanza parsed into a typed event. `timestamp` is unix
 * seconds (not ISO) because the core serializes via
 * `chrono::serde::ts_seconds`.
 */
export interface IncomingCall {
    from: Jid;
    /** Stanza-level `id`; distinct from `CallAction.call_id`. */
    stanza_id: string;
    notify?: string | null;
    platform?: string | null;
    version?: string | null;
    timestamp: number;
    offline: boolean;
    action: CallAction;
}



/** WhatsApp JID (Jabber ID) — identifies a user, group, or device. */
export interface Jid {
    user: string;
    server: string;
    agent: number;
    device: number;
    integrator: number;
}

/** Addressing mode for a group (phone number vs LID). */
export type AddressingMode = "pn" | "lid";

/** App state synchronization key for WhatsApp's app state protocol. */
export interface AppStateSyncKey {
    key_data: Uint8Array;
    fingerprint: Uint8Array;
    timestamp: number;
}

export interface ArchiveUpdate {
    /** The chat being archived or unarchived. */
    jid: Jid;
    timestamp: number;
    action: ArchiveChatAction;
    from_full_sync: boolean;
}

/** Action to perform on a blocklist entry. */
export type BlocklistAction = "block" | "unblock";

export type BotEditType = "first" | "inner" | "last";

export type BusinessHourMode = "open_24h" | "specific_hours" | "appointment_only" | string;

/** Parsed `<notification type="business">` stanza. */
export interface BusinessNotification {
    from: Jid;
    stanza_id: string;
    timestamp: number;
    notification_type: BusinessNotificationType;
    jid?: Jid | null;
    hash?: string | null;
    verified_name?: VerifiedName | null;
    product_ids: string[];
    collection_ids: string[];
    subscriptions: BusinessSubscription[];
}

/** Business notification type based on child element. */
export type BusinessNotificationType = "remove_jid" | "remove_hash" | "verified_name_jid" | "verified_name_hash" | "profile" | "profile_hash" | "product" | "collection" | "subscriptions" | "unknown";

/** Business status update notification. */
export interface BusinessStatusUpdate {
    /** The business account whose status changed. */
    jid: Jid;
    update_type: BusinessUpdateType;
    timestamp: number;
    target_jid?: Jid | null;
    hash?: string | null;
    verified_name?: string | null;
    product_ids: string[];
    collection_ids: string[];
    subscriptions: BusinessSubscription[];
}

/** Business subscription information (SMB features). */
export interface BusinessSubscription {
    id: string;
    status: string;
    expiration_date?: number | null;
    creation_time?: number | null;
}

/** Type of business status update. */
export type BusinessUpdateType = "removed_as_business" | "verified_name_changed" | "profile_updated" | "products_updated" | "collections_updated" | "subscriptions_updated" | "unknown";

/** Minimal cached form of a Noise certificate. Mirrors the JSON shape WA Web persists in `waNoiseInfo.certificateChainBuffer` (only `key` plus the validity window — signatures and issuer_serial are intentionally dropped). */
export interface CachedNoiseCert {
    /** 32-byte X25519 public key from `NoiseCertificate.Details.key`. */
    key: any;
    /** Unix epoch seconds. Validation window from `NoiseCertificate.Details`. */
    not_before: number;
    not_after: number;
}

/** Cached form of the server's two-cert chain. `leaf.key` is the server static public key consumed by Noise IK; the intermediate is kept solely to mirror WA Web's expiry checks. */
export interface CachedServerCertChain {
    intermediate: CachedNoiseCert;
    leaf: CachedNoiseCert;
}

/** Fields kept per-variant (not a shared `BasicCallMeta`) so the `serde` shape mirrors the stanza 1:1 for downstream JS consumers. */
export type CallAction =
| { type: "offer"; call_id: string; call_creator: Jid; caller_pn?: Jid | null; caller_country_code?: string | null; device_class?: string | null; joinable: boolean; is_video: boolean; audio: CallAudioCodec[]; group_jid?: Jid | null }
| { type: "offer_notice"; call_id: string; call_creator: Jid; is_video: boolean; is_group: boolean }
| { type: "pre_accept"; call_id: string; call_creator: Jid }
| { type: "accept"; call_id: string; call_creator: Jid }
| { type: "reject"; call_id: string; call_creator: Jid }
| { type: "terminate"; call_id: string; call_creator: Jid; duration?: number | null; audio_duration?: number | null };

export interface CallAudioCodec {
    enc: string;
    rate: number;
}

/** Identifies a specific message within a chat. */
export interface ChatMessageId {
    chat: Jid;
    id: string;
}

export type ChatPresence = "composing" | "paused";

export type ChatPresenceMedia = "" | "audio";

export interface ChatPresenceUpdate {
    source: MessageSource;
    state: ChatPresence;
    media: ChatPresenceMedia;
}

/** Chat state type for typing indicators. */
export type ChatStateType = "composing" | "recording" | "paused";

export interface ConnectFailure {
    reason: ConnectFailureReason;
    message: string;
    raw?: any | null;
}

/** Wire codes: 400=Generic, 401=LoggedOut, 402=TempBanned, 403=AccountLocked, 406=UnknownLogout, 405=ClientOutdated, 409=BadUserAgent, 413=CatExpired, 414=CatInvalid, 415=NotFound, 418=ClientUnknown, 500=InternalServerError, 501=Experimental, 503=ServiceUnavailable */
export type ConnectFailureReason = number;

/** A contact changed their phone number.  Emitted from `<notification type="contacts"><modify old="..." new="..." old_lid="..." new_lid="..."/>`.  The library updates the global LID-PN cache when both `old_lid` and `new_lid` are present, mirroring `WAWebDBCreateLidPnMappings`. No Signal session is wiped (WA Web `WAWebHandleContactNotification` also leaves sessions intact). Group participant updates arrive via separate `w:gp2` notifications, so per-group caches are not touched here. Consumers can subscribe and refresh their own caches if needed. */
export interface ContactNumberChanged {
    /** Old phone number JID. */
    old_jid: Jid;
    /** New phone number JID. */
    new_jid: Jid;
    /** Old LID (if provided by server). */
    old_lid?: Jid | null;
    /** New LID (if provided by server). */
    new_lid?: Jid | null;
    timestamp: number;
}

/** Server requests a full contact re-sync.  Emitted from `<notification type="contacts"><sync after="..."/>`. */
export interface ContactSyncRequested {
    after?: number | null;
    timestamp: number;
}

export interface ContactUpdate {
    /** The chat/contact this sync action applies to. */
    jid: Jid;
    timestamp: number;
    action: ContactAction;
    from_full_sync: boolean;
}

/** A contact's profile changed (server notification).  Emitted from `<notification type="contacts"><update jid="..."/>`. WA Web resets cached presence and refreshes the profile picture on this event — consumers should invalidate any cached presence/profile data.  Not to be confused with [`ContactUpdate`] which comes from app-state sync mutations (different source, different payload). */
export interface ContactUpdated {
    /** The contact whose profile was updated. */
    jid: Jid;
    timestamp: number;
}

export type DayOfWeek = "sun" | "mon" | "tue" | "wed" | "thu" | "fri" | "sat" | string;

export type DecryptFailMode = "show" | "hide";

export interface DeleteChatUpdate {
    /** The chat being deleted. */
    jid: Jid;
    /** From the index, not the proto — DeleteChatAction only has messageRange. */
    delete_media: boolean;
    timestamp: number;
    action: DeleteChatAction;
    from_full_sync: boolean;
}

export interface DeleteMessageForMeUpdate {
    /** The chat containing the deleted message. */
    chat_jid: Jid;
    participant_jid?: Jid | null;
    message_id: string;
    from_me: boolean;
    timestamp: number;
    action: DeleteMessageForMeAction;
    from_full_sync: boolean;
}

export interface Device {
    pn?: Jid | null;
    lid?: Jid | null;
    registration_id: number;
    noise_key: KeyPair;
    identity_key: KeyPair;
    signed_pre_key: KeyPair;
    signed_pre_key_id: number;
    signed_pre_key_signature: any;
    adv_secret_key: any;
    account?: AdvSignedDeviceIdentity | null;
    push_name: string;
    app_version_primary: number;
    app_version_secondary: number;
    app_version_tertiary: number;
    app_version_last_fetched_ms: number;
    device_props: DeviceProps;
    /** Runtime-only. Set before `connect()` on every process start. */
    client_profile: ClientProfile;
    /** Edge routing info received from server, used for optimized reconnection. When present, this should be sent as a pre-intro before the Noise handshake. */
    edge_routing_info?: Uint8Array | null;
    /** Hash from the last props (A/B experiment config) fetch. Sent on subsequent connects to enable delta updates instead of full fetches. */
    props_hash?: string | null;
    /** Monotonically increasing counter for one-time pre-key ID generation. Matches WhatsApp Web's `NEXT_PK_ID` pattern: only increases, never resets. Prevents prekey ID collisions when prekeys are consumed non-sequentially. */
    next_pre_key_id: number;
    /** Persisted flag matching WA Web's `signal_sever_has_pre_keys` metadata. */
    server_has_prekeys: boolean;
    /** NCT salt provisioned by the server via app state sync or history sync. */
    nct_salt?: Uint8Array | null;
    /** Runtime-only marker that an authoritative nct_salt_sync mutation was seen. This prevents stale history sync data from resurrecting a cleared salt. */
    nct_salt_sync_seen: boolean;
    /** Server cert chain cached from the last successful XX (or XX-fallback) handshake. Enables Noise IK on the next connect by exposing `leaf.key` as the server's static public key, and lets us reject stale entries via `not_after` before even attempting IK. `None` forces XX on the next connect. */
    server_cert_chain?: CachedServerCertChain | null;
    /** Login counter sent as `ClientPayload.lc` on every login. WA Web's `WAWebUserPrefsGeneral.getLoginCounter()` reads (and bumps) this from localStorage on each connect; the server uses it as an anti-abuse signal. Persisted so it survives restarts. */
    login_counter: number;
}

/** Device element from notification.  Wire format: ```xml <device jid="185169143189667:75@lid" key-index="2" lid="..."/> ```  Device ID is extracted from the JID's device part (e.g., 75 from "user:75@lid").  Per WhatsApp Web: if both `jid` and `lid` attributes are present, the device IDs must match or the notification is rejected. */
export interface DeviceElement {
    /** Device JID (contains user and device ID) */
    jid: Jid;
    /** Optional key index */
    key_index?: number | null;
    /** Optional LID (device ID must match jid's device ID if present) */
    lid?: Jid | null;
}

/** Device information for registry tracking. */
export interface DeviceInfo {
    /** The device ID (0 = primary device, 1+ = companion devices) */
    device_id: number;
    /** The key index, if known */
    key_index?: number | null;
}

/** Device list record matching WhatsApp Web's DeviceListRecord structure. */
export interface DeviceListRecord {
    /** The user part of the JID (phone number or LID) */
    user: string;
    /** List of known devices for this user */
    devices: DeviceInfo[];
    /** Timestamp when this record was last updated */
    timestamp: number;
    /** Participant hash from usync, if available */
    phash?: string | null;
    /** ADV raw_id from `ADVKeyIndexList` — used to detect identity changes. When this changes, all sessions and sender keys for the user must be cleared. */
    raw_id?: number | null;
}

/** Device list update notification. Emitted when a user's device list changes (device added/removed/updated). */
export interface DeviceListUpdate {
    /** The user whose device list changed (from attribute) */
    user: Jid;
    /** Optional LID user (for LID-PN mapping) */
    lid_user?: Jid | null;
    /** Type of update (add/remove/update) */
    update_type: DeviceListUpdateType;
    /** Affected devices with detailed info */
    devices: DeviceNotificationInfo[];
    /** Key index info (for add/remove) */
    key_index?: KeyIndexInfo | null;
    /** Contact hash (for update - used for contact lookup) */
    contact_hash?: string | null;
}

/** Type of device list update notification. Matches WhatsApp Web's device notification types. */
export type DeviceListUpdateType = "add" | "remove" | "update";

/** Parsed device notification stanza.  Wire format: ```xml <notification from="185169143189667@lid" id="..." t="..." type="devices" lid="..."> <remove> <device jid="185169143189667:75@lid"/> <key-index-list ts="1769296600"/> </remove> </notification> ```  Reference: WhatsApp Web `WAWebHandleDeviceNotification` parser (5Yec01dI04o.js:23125-23183)  Per WhatsApp Web: Only ONE operation per notification is processed. Priority order: remove > add > update */
export interface DeviceNotification {
    /** User JID (from attribute) */
    from: Jid;
    /** Optional LID user (for LID-PN mapping learning) */
    lid_user?: Jid | null;
    /** Stanza ID (for ACK) */
    stanza_id: string;
    /** Timestamp */
    timestamp: number;
    /** The operation (one per notification, priority: remove > add > update) */
    operation: DeviceOperation;
}

/** Device information from notification. */
export interface DeviceNotificationInfo {
    /** Device ID (extracted from JID) */
    device_id: number;
    /** Optional key index */
    key_index?: number | null;
}

/** Device notification operation type.  Wire format: Child element tag of `<notification type="devices">` - `<add>` - Device was added - `<remove>` - Device was removed - `<update>` - Device info updated (hash-based lookup) */
export type DeviceNotificationType = "add" | "remove" | "update";

/** Operation content (add/remove/update child element).  Wire format per WhatsApp Web (5Yec01dI04o.js:23141-23180): ```xml <add> <device jid="user:75@lid" key-index="2"/> <key-index-list ts="...">SIGNED_BYTES</key-index-list> </add> <!-- OR --> <remove> <device jid="user:75@lid"/> <key-index-list ts="..."/>  <!-- ts required for remove --> </remove> <!-- OR --> <update hash="CONTACT_HASH"/> ```  Note: WhatsApp Web does NOT read any attributes from add/remove nodes. The `device_hash` attribute (if present) is not used by the official client. */
export interface DeviceOperation {
    /** Operation type (add/remove/update) */
    operation_type: DeviceNotificationType;
    /** Contact hash (for update only) - from `hash` attribute, used for contact lookup */
    contact_hash?: string | null;
    /** Device elements (for add/remove, single device per WhatsApp Web) */
    devices: DeviceElement[];
    /** Key index info (required for add/remove per WhatsApp Web) */
    key_index?: KeyIndexInfo | null;
}

export interface DeviceSentMeta {
    destination_jid: string;
    phash: string;
}

export type DirtyType = "account_sync" | "groups" | "syncd_app_state" | "newsletter_metadata" | string;

export type DisallowedListAction = "add" | "remove";

/** A contact's default disappearing messages setting changed.  Sent by the server as `<notification type="disappearing_mode">`. WA Web: `WAWebHandleDisappearingModeNotification` → `WAWebUpdateDisappearingModeForContact`. */
export interface DisappearingModeChanged {
    /** The contact whose setting changed. */
    from: Jid;
    /** New duration in seconds (0 = disabled, 86400 = 24h, etc.). */
    duration: number;
    /** When the setting was changed. Consumers should only apply this if it's newer than their stored value. */
    setting_timestamp: number;
}

export type EditAttribute = "" | "1" | "2" | "3" | "7" | "8" | string;

export interface GroupInfo {
    participants: Jid[];
    addressing_mode: AddressingMode;
}

/** All possible group notification action types.  Maps 1:1 to `GROUP_NOTIFICATION_TAG` child element tags from WhatsApp Web.  The `#[wire = "..."]` attribute is the SINGLE source of truth for each variant's wire tag: the JSON discriminator (via the auto-derived `Serialize`), the parser dispatch (via the auto-generated sibling `GroupNotificationActionTag` enum), and `wire_tag()` / `tag_name()` all read from the same table. */
export type GroupNotificationAction =
| { type: "add"; participants: GroupParticipantInfo[]; reason?: string | null }
| { type: "remove"; participants: GroupParticipantInfo[]; reason?: string | null }
| { type: "promote"; participants: GroupParticipantInfo[] }
| { type: "demote"; participants: GroupParticipantInfo[] }
| { type: "modify"; participants: GroupParticipantInfo[] }
| { type: "subject"; subject: string; subject_owner?: Jid | null; subject_time?: number | null }
| { type: "description"; id: string; description?: string | null }
| { type: "locked"; threshold?: string | null }
| { type: "unlocked" }
| { type: "announcement" }
| { type: "not_announcement" }
| { type: "ephemeral"; expiration: number; trigger?: number | null }
| { type: "membership_approval_mode"; enabled: boolean }
| { type: "membership_approval_request"; request_method: MembershipRequestMethod; parent_group_jid?: Jid | null }
| { type: "created_membership_requests"; request_method: MembershipRequestMethod; parent_group_jid?: Jid | null; requests: GroupParticipantInfo[] }
| { type: "revoked_membership_requests"; participants: Jid[] }
| { type: "member_add_mode"; mode: string }
| { type: "no_frequently_forwarded" }
| { type: "frequently_forwarded_ok" }
| { type: "invite"; code: string }
| { type: "revoke" }
| { type: "growth_locked"; expiration: number; lock_type: string }
| { type: "growth_unlocked" }
| { type: "create" }
| { type: "delete"; reason?: string | null }
| { type: "link"; link_type: string }
| { type: "unlink"; unlink_type: string; unlink_reason?: string | null }
| { type: "linked_group_promote"; participants: GroupParticipantInfo[] }
| { type: "linked_group_demote"; participants: GroupParticipantInfo[] }
| { type: "suspended" }
| { type: "unsuspended" }
| { type: "auto_add_disabled" }
| { type: "is_capi_hosted_group" }
| { type: "group_safety_check" }
| { type: "limit_sharing_enabled"; trigger?: number | null }
| { type: "allow_admin_reports" }
| { type: "not_allow_admin_reports" }
| { type: "reports" }
| { type: "allow_non_admin_sub_group_creation" }
| { type: "not_allow_non_admin_sub_group_creation" }
| { type: "created_sub_group_suggestion" }
| { type: "revoked_sub_group_suggestions" }
| { type: "change_number"; new_owner?: Jid | null; sub_group_suggestions: Jid[] }
| { type: string; tag: string };

/** Participant info extracted from `<participant>` child elements.  Wire format: ```xml <participant jid="..." type="..." lid="..." phone_number="..." username="..." display_name="..." join_time="..."/> ```  `display_name` is the server-rendered label (e.g. `"+55∙∙∙∙∙∙∙∙∙79"` when the requester is not in the participant's contacts). `type` flags admin/superadmin tier; LID-addressed groups also carry `lid` and `username`. WA Web's `WAWebHandleGroupNotification` y() reads all of these into the participant model so the UI can render notifications and patch admin caches without resolving the contact locally. */
export interface GroupParticipantInfo {
    jid: Jid;
    phone_number?: Jid | null;
    /** Server-provided display label for this participant. Only populated for `<participant>` children inside group notifications; `None` for `<requested_user>` (WA Web doesn't read it there either). */
    display_name?: string | null;
    /** Admin tier. Defaults to `Participant` when the attr is missing. */
    type?: GroupParticipantType | null;
    /** LID JID when this `<participant>` carries a separate `lid` attr. Distinct from `jid` which may already be a LID. */
    lid?: Jid | null;
    /** Username, gated by `WAWebUsernameGatingUtils`. Empty in classic PN-addressed groups. */
    username?: string | null;
    /** Unix seconds since the participant joined the group. Used by admin UI for tenure display. */
    join_time?: number | null;
}

/** Admin tier from `<participant type="...">`. Mirrors `GROUP_PARTICIPANT_TYPES` in `WAWebGroupApiConst`. */
export type GroupParticipantType = "participant" | "admin" | "superadmin";

/** Query request type. */
export type GroupQueryRequestType = "interactive";

/** Group update notification.  Emitted for each action in a `<notification type="w:gp2">` stanza. A single notification may produce multiple `GroupUpdate` events (one per action). */
export interface GroupUpdate {
    /** The group this update applies to */
    group_jid: Jid;
    /** The admin/user who triggered the change (`participant` attribute) */
    participant?: Jid | null;
    /** Phone number JID of the participant (for LID-addressed groups) */
    participant_pn?: Jid | null;
    /** When the change occurred */
    timestamp: number;
    /** Whether the group uses LID addressing mode */
    is_lid_addressing_mode: boolean;
    /** The specific action */
    action: GroupNotificationAction;
}

export type HostType = "primary" | "fallback" | string;

/** Identity key changed for a user (e.g., user reinstalled WhatsApp). Emitted after device record cleanup so sessions and sender keys are cleared. */
export interface IdentityChange {
    /** The user whose identity changed */
    user: Jid;
    /** Optional LID for the user */
    lid_user?: Jid | null;
}

export interface IncomingCall {
    from: Jid;
    /** Stanza id; distinct from `CallAction::call_id`. */
    stanza_id: string;
    notify?: string | null;
    platform?: string | null;
    version?: string | null;
    timestamp: number;
    offline: boolean;
    action: CallAction;
}

/** IQ request type for WhatsApp protocol queries. */
export type InfoQueryType = "set" | "get";

/** Key index information from `<key-index-list>` element.  Wire format: ```xml <!-- For add: has signed bytes content --> <key-index-list ts="1769296600">SIGNED_BYTES</key-index-list> <!-- For remove: empty, ts required --> <key-index-list ts="1769296600"/> ```  Required for add/remove operations per WhatsApp Web. */
export interface KeyIndexInfo {
    /** Timestamp (required for remove per WhatsApp Web) */
    timestamp: number;
    /** Signed key index bytes (only present for add) */
    signed_bytes?: Uint8Array | null;
}

/** The source from which a LID-PN mapping was learned. Different sources have different trust levels and handling for identity changes. */
export type LearningSource = "usync" | "peer_pn_message" | "peer_lid_message" | "recipient_latest_lid" | "migration_sync_latest" | "migration_sync_old" | "blocklist_active" | "blocklist_inactive" | "pairing" | "device_notification" | "other";

/** An entry in the LID-PN cache containing the full mapping information. */
export interface LidPnEntry {
    /** The LID user part (e.g., "100000012345678") */
    lid: string;
    /** The phone number user part (e.g., "559980000001") */
    phone_number: string;
    /** Unix timestamp when the mapping was first learned */
    created_at: number;
    /** The source from which this mapping was learned */
    learning_source: LearningSource;
}

/** Entry representing a LID to Phone Number mapping. */
export interface LidPnMappingEntry {
    /** The LID user part (e.g., "100000012345678") */
    lid: string;
    /** The phone number user part (e.g., "559980000001") */
    phone_number: string;
    /** Unix timestamp when the mapping was first learned */
    created_at: number;
    /** Unix timestamp when the mapping was last updated */
    updated_at: number;
    /** The source from which this mapping was learned (e.g., "usync", "peer_pn_message") */
    learning_source: string;
}

export interface LoggedOut {
    on_connect: boolean;
    reason: ConnectFailureReason;
}

export interface MarkChatAsReadUpdate {
    /** The chat being marked as read or unread. */
    jid: Jid;
    timestamp: number;
    action: MarkChatAsReadAction;
    from_full_sync: boolean;
}

/** Member link mode for group invite links. */
export type MemberLinkMode = "admin_link" | "all_member_link";

/** Who can share message history with new members. */
export type MemberShareHistoryMode = "admin_share" | "all_member_share";

/** How a membership request was initiated.  Maps to `WAWebRequestMethodType` in WhatsApp Web JS. */
export type MembershipRequestMethod = "invite_link" | "linked_group_join" | "non_admin_add";

export type MessageCategory = "" | "peer" | string;

export interface MessageInfo {
    source: MessageSource;
    id: string;
    server_id: number;
    type: string;
    push_name: string;
    timestamp: number;
    category: MessageCategory;
    multicast: boolean;
    media_type: string;
    edit: EditAttribute;
    bot_info?: MsgBotInfo | null;
    meta_info: MsgMetaInfo;
    verified_name?: VerifiedNameCertificate | null;
    device_sent_meta?: DeviceSentMeta | null;
    /** Ephemeral duration in seconds, extracted from `contextInfo.expiration`. */
    ephemeral_expiration?: number | null;
    /** Whether this message was delivered during offline sync. */
    is_offline: boolean;
    /** Set when this message was recovered via PDO rather than normal decryption. Contains the PDO request message ID. */
    unavailable_request_id?: string | null;
    /** Server-store timestamp in microseconds (envelope `sts` attr). Used by WA Web for read-self watermark ordering across companion devices. */
    server_timestamp_us?: number | null;
    /** Envelope `verified_level` attr (e.g. "unknown"/"low"/"high"). For business messages this is the server-asserted verification tier; for regular messages it is absent. */
    verified_level?: string | null;
    /** Envelope `verified_name` int attr (business name certificate serial). Separate from the `verified_name` child cert bytes already on this struct. */
    verified_name_serial?: number | null;
    /** Envelope `peer_recipient_pn` attr. Present on companion-device self-synced DM stanzas to identify the peer's PN (so the receipt goes to the right routing target). */
    peer_recipient_pn?: Jid | null;
    /** Broadcast-contact-list recipients from `<participants><to jid>` on an incoming broadcast/status stanza. Populated only for broadcasts; used to validate a `deviceSentMessage.phash` (WA Web `validateBclHash`). Empty otherwise. */
    bcl_participants: Jid[];
}

export interface MessageSource {
    chat: Jid;
    sender: Jid;
    is_from_me: boolean;
    is_group: boolean;
    addressing_mode?: AddressingMode | null;
    sender_alt?: Jid | null;
    recipient_alt?: Jid | null;
    broadcast_list_owner?: Jid | null;
    recipient?: Jid | null;
}

/** MEX GraphQL error extensions. */
export interface MexErrorExtensions {
    error_code?: number | null;
    is_summary?: boolean | null;
    is_retryable?: boolean | null;
    severity?: string | null;
}

/** MEX GraphQL error. */
export interface MexGraphQLError {
    message: string;
    extensions?: MexErrorExtensions | null;
}

/** `payload` shape depends on `op_name`. `offline` mirrors the raw string the server sets when replaying backlog (often a timestamp); presence alone signals backlog vs live. */
export interface MexNotification {
    op_name: string;
    from?: Jid | null;
    stanza_id?: string | null;
    offline?: string | null;
    payload: Value;
}

/** MEX GraphQL response. */
export interface MexResponse {
    data?: Value | null;
    errors?: MexGraphQLError[] | null;
}

export interface MsgBotInfo {
    edit_type?: BotEditType | null;
    edit_target_id?: string | null;
    edit_sender_timestamp_ms?: number | null;
}

export interface MsgMetaInfo {
    target_id?: string | null;
    target_sender?: Jid | null;
    /** `<meta target_chat_jid="…">` — present when the bot reply addresses a chat distinct from the stanza-level `from` (used for msmsg secret lookup; see WA Web `decryptMsmsgBotMessage`). */
    target_chat?: Jid | null;
    deprecated_lid_session?: boolean | null;
    thread_message_id?: string | null;
    thread_message_sender_jid?: Jid | null;
    /** `<meta content_type=...>` attr. Server marks reactions/edits as `"add_on"`; mirrors `WAWebHandleMsgParser` b()'s metadata read. */
    content_type?: string | null;
    /** `<meta appdata=...>` attr. `"default"` is the only observed value. */
    appdata?: string | null;
    /** `<reporting><reporting_tag>` content bytes (16 or 20). Pre-requisite for the server-side report-abuse flow. */
    reporting_tag?: Uint8Array | null;
    /** `<reporting><reporting_token>` content bytes (16). Pre-requisite for the server-side report-abuse flow. */
    reporting_token?: Uint8Array | null;
    /** `v` attr on `<reporting_token>`. WA Web defaults to 1 when missing. */
    reporting_token_version?: number | null;
}

/** Message-secret write entry keyed by chat, sender, and message ID. */
export interface MsgSecretEntry {
    chat: string;
    sender: string;
    msg_id: string;
    secret: Uint8Array;
    /** Absolute unix-seconds retention deadline. `0` means never expire. Computed by the caller from the parent message's event time plus a per-add-on-kind horizon (see `MsgSecretRetention`). The store prunes rows whose deadline has passed; it does not know the horizon itself. */
    expires_at: number;
    /** Parent message event time (unix seconds), or `0` when unknown. Kept so the receive path can enforce the edit-processing window (`editTs < message_ts + window`) the same way WhatsApp Web does. */
    message_ts: number;
}

export interface MuteUpdate {
    /** The chat being muted or unmuted. */
    jid: Jid;
    timestamp: number;
    action: MuteAction;
    from_full_sync: boolean;
}

/** Wire codes: 421=StaleGroupAddressingMode, 475=NewChatMessagesCapped, 487=ParsingError, 488=UnrecognizedStanza, 489=UnrecognizedStanzaClass, 490=UnrecognizedStanzaType, 491=InvalidProtobuf, 493=InvalidHostedCompanionStanza, 495=MissingMessageSecret, 496=SignalErrorOldCounter, 499=MessageDeletedOnPeer, 500=UnhandledError, 550=UnsupportedAdminRevoke, 551=UnsupportedLIDGroup, 552=DBOperationFailed */
export type NackReason = number;

/** A newsletter live update notification, typically containing updated reaction counts for one or more messages. */
export interface NewsletterLiveUpdate {
    /** The newsletter channel this update belongs to. */
    newsletter_jid: Jid;
    messages: NewsletterLiveUpdateMessage[];
}

/** A single message entry in a newsletter live update. */
export interface NewsletterLiveUpdateMessage {
    server_id: number;
    reactions: NewsletterLiveUpdateReaction[];
}

/** A reaction count in a newsletter live update. */
export interface NewsletterLiveUpdateReaction {
    code: string;
    count: number;
}

export type NewsletterMessageType = "text" | "media" | "reaction" | "revoke" | "poll_creation" | "poll_vote" | "edit" | string;

export interface OfflineSyncCompleted {
    count: number;
}

export interface OfflineSyncPreview {
    total: number;
    app_data_changes: number;
    messages: number;
    notifications: number;
    receipts: number;
}

export interface PairError {
    id: Jid;
    lid: Jid;
    business_name: string;
    platform: string;
    error: string;
}

export interface PairSuccess {
    id: Jid;
    lid: Jid;
    business_name: string;
    platform: string;
}

/** Participant type (admin level). */
export type ParticipantType = "member" | "admin" | "superadmin";

export interface PictureUpdate {
    /** The JID whose picture changed (user or group). */
    jid: Jid;
    /** The user who made the change. Present for group picture changes (the admin who changed it). `None` for personal picture updates. */
    author?: Jid | null;
    timestamp: number;
    /** Whether the picture was removed (true) or set/updated (false). */
    removed: boolean;
    /** The server-assigned picture ID (from `<set id="..."/>`). `None` for deletions. */
    picture_id?: string | null;
}

export interface PinUpdate {
    /** The chat being pinned or unpinned. */
    jid: Jid;
    timestamp: number;
    action: PinAction;
    from_full_sync: boolean;
}

export type PreKeyFetchReason = "identity" | "retry" | string;

export type Presence = "available" | "unavailable";

export interface PresenceUpdate {
    /** The contact whose presence changed. */
    from: Jid;
    unavailable: boolean;
    last_seen?: number | null;
}

export type PrivacyCategory = "last" | "online" | "profile" | "status" | "groupadd" | "readreceipts" | "calladd" | "messages" | "defense" | string;

export type PrivacySensitiveType = "1";

export type PrivacySetting = "all" | "contacts" | "contact_blacklist" | "match_last_seen" | "known" | "none" | "undefined";

export type PrivacySettingType = "group_add" | "last" | "status" | "profile" | "read_receipts" | "online" | "call_add";

export interface PrivacySettings {
    group_add?: PrivacySetting | null;
    last_seen?: PrivacySetting | null;
    status?: PrivacySetting | null;
    profile?: PrivacySetting | null;
    read_receipts?: PrivacySetting | null;
    call_add?: PrivacySetting | null;
    online?: PrivacySetting | null;
}

export type PrivacyValue = "all" | "contacts" | "none" | "contact_blacklist" | "match_last_seen" | "known" | "off" | "on_standard" | string;

/** Profile picture type (preview thumbnail or full-size). */
export type ProfilePictureType = "preview" | "image";

export interface PushNameUpdate {
    /** The contact who changed their push name. */
    jid: Jid;
    message: MessageInfo;
    old_push_name: string;
    new_push_name: string;
}

export type PushPriority = "high" | "high_force";

export interface Receipt {
    source: MessageSource;
    message_ids: string[];
    timestamp: number;
    type: ReceiptType;
}

export type ReceiptType =
| { type: "delivered" }
| { type: "sender" }
| { type: "retry" }
| { type: "enc_rekey_retry" }
| { type: "read" }
| { type: "read_self" }
| { type: "played" }
| { type: "played_self" }
| { type: "server_error" }
| { type: "inactive" }
| { type: "peer_msg" }
| { type: "history_sync" }
| { type: "other"; data: string };

/** Chat state type as received from incoming stanzas.  Aligned with WhatsApp Web's `WAChatState` constants: - `typing` = ACTIVE_CHAT_STATE_TYPE.TYPING - `recording_audio` = ACTIVE_CHAT_STATE_TYPE.RECORDING_AUDIO - `idle` = IDLE_CHAT_STATE_TYPE.IDLE */
export type ReceivedChatState = "typing" | "recording_audio" | "idle";

export interface SelfPushNameUpdated {
    from_server: boolean;
    old_name: string;
    new_name: string;
}

/** The type of spam flow indicating the source of the report. */
export type SpamFlow = "GroupSpamBannerReport" | "GroupInfoReport" | "MessageMenu" | "ContactInfo" | "StatusReport";

export interface StarUpdate {
    /** The chat containing the starred or unstarred message. */
    chat_jid: Jid;
    /** The participant who sent the message. `Some` for group messages from others, `None` for self-authored or 1-on-1 messages (wire value `"0"`). */
    participant_jid?: Jid | null;
    message_id: string;
    from_me: boolean;
    timestamp: number;
    action: StarAction;
    from_full_sync: boolean;
}

/** Privacy setting sent in the `<meta>` node of the status stanza. Matches WhatsApp Web's `status_setting` attribute. */
export type StatusPrivacySetting = "contacts" | "allowlist" | "denylist";

export interface StreamError {
    code: string;
    raw?: any | null;
}

/** Trusted contact privacy token entry.  Matches WhatsApp Web's Chat.tcToken / tcTokenTimestamp / tcTokenSenderTimestamp. */
export interface TcTokenEntry {
    /** Raw token bytes received from the server. */
    token: Uint8Array;
    /** Unix timestamp (seconds) when the token was received. */
    token_timestamp: number;
    /** Unix timestamp (seconds) when we last issued our token to this contact. */
    sender_timestamp?: number | null;
}

/** Wire codes: 101=SentToTooManyPeople, 102=BlockedByUsers, 103=CreatedTooManyGroups, 104=SentTooManySameMessage, 106=BroadcastList */
export type TempBanReason = number;

export interface TemporaryBan {
    code: TempBanReason;
    expire: number;
}

export type UnavailableType = "unknown" | "view_once";

export interface UndecryptableMessage {
    info: MessageInfo;
    is_unavailable: boolean;
    unavailable_type: UnavailableType;
    decrypt_fail_mode: DecryptFailMode;
}

export interface UserAboutUpdate {
    /** The contact whose about text changed. */
    jid: Jid;
    status: string;
    timestamp: number;
}

/** Usync context. */
export type UsyncContext = "interactive" | "background" | "message";

/** Usync mode. */
export type UsyncMode = "query" | "full";

/** Verified name certificate information. */
export interface VerifiedName {
    name?: string | null;
    serial?: string | null;
    issuer?: string | null;
    certificate?: Uint8Array | null;
}



export interface ILogger {
    level: string;
    trace(obj: object, msg?: string): void;
    debug(obj: object, msg?: string): void;
    info(obj: object, msg?: string): void;
    warn(obj: object, msg?: string): void;
    error(obj: object, msg?: string): void;
}



export interface WhatsAppClientConfig {
    transport: JsTransportCallbacks;
    httpClient: JsHttpClientConfig;
    onEvent?: (event: WhatsAppEvent) => void;
}

/**
 * JS storage callbacks for the persistent backend.
 *
 * The boundary is a two-level namespaced key/value store: `store` is one of the
 * fixed STORE_* namespaces (e.g. "session", "msg_secret", "lid_mapping") and
 * `key` is an opaque, namespace-scoped id; values are raw bytes.
 *
 * Only `get`/`set`/`delete` are MANDATORY — a 3-method store keeps working
 * exactly as before. The remaining methods are OPTIONAL performance/structural
 * primitives the core feature-detects (by handle presence) and uses when the
 * host provides them:
 *   - `setMany`/`deleteMany` collapse N per-key FFI crossings into one (this is
 *     what turns a ~20k-secret history-sync write from 20k awaits into a single
 *     batched call).
 *   - `listKeys`/`listEntries` let the core enumerate a namespace directly,
 *     which lets it DROP its hand-maintained meta-index lists (msg_secret_keys,
 *     tc_token_jids, …). A host that cannot enumerate a category (e.g. an
 *     id-addressed Baileys keyStore) simply omits them; the core then keeps its
 *     self-maintained index for that backend.
 *   - `deletePrefix` accelerates unconditional bulk clears.
 *
 * `capabilities` is read ONCE at init. Omit it (or a field) and the core treats
 * the corresponding primitive as absent. A capability declared `true` MUST have
 * its method(s) present and working.
 */
export interface JsStoreCallbacks {
    /** Read one value by (store, key). Null/undefined if absent. MANDATORY. */
    get(store: string, key: string): Promise<Uint8Array | null>;
    /** Write one value by (store, key). MANDATORY. */
    set(store: string, key: string, value: Uint8Array): Promise<void>;
    /** Delete one key. No-op if absent. MANDATORY. */
    delete(store: string, key: string): Promise<void>;

    /**
     * Write many [key, value] pairs into ONE store in a single call. Entries are
     * tuples (so keys may contain any character). Best-effort: if the medium has
     * no cross-key atomicity (file-per-key) it MUST still apply every entry and
     * fail-fast on error so the core can retry (writes are idempotent by key).
     * Empty array is a valid no-op.
     */
    setMany?(store: string, entries: [key: string, value: Uint8Array][]): Promise<void>;

    /** Read many keys from ONE store; one entry per FOUND key, any order. */
    getMany?(store: string, keys: string[]): Promise<[key: string, value: Uint8Array][]>;

    /** Delete many keys from ONE store in a single call. Missing keys ignored. */
    deleteMany?(store: string, keys: string[]): Promise<void>;

    /** Enumerate live keys in `store` (optionally prefix-filtered). Unordered. */
    listKeys?(store: string, prefix?: string): Promise<string[]>;

    /**
     * Like listKeys but returns [key, value] pairs, so the core can inspect the
     * embedded timestamp prefix for delete-expired sweeps without N follow-up
     * gets. If absent but listKeys exists, the core falls back to listKeys+getMany.
     */
    listEntries?(store: string, prefix?: string): Promise<[key: string, value: Uint8Array][]>;

    /** Delete every key in `store` starting with `prefix`. Returns count removed. */
    deletePrefix?(store: string, prefix: string): Promise<number>;

    /** Static capability declaration, read once at init. Omitted => all false. */
    capabilities?: {
        /** setMany/getMany/deleteMany are implemented. */
        batch?: boolean;
        /** listKeys/listEntries reliably enumerate a namespace. */
        enumerate?: boolean;
        /** deletePrefix is implemented. */
        prefixDelete?: boolean;
        /**
         * Opt-in write-back: the bridge buffers writes in WASM and crosses to this
         * store only on flush (disconnect/shutdown). Declare it ONLY for EPHEMERAL
         * stores (a crash before flush loses un-flushed writes) — it keeps the
         * per-message Signal-state persistence off the JS↔WASM boundary.
         */
        writeBack?: boolean;
    };

    /** Optional durability barrier (flush pending writes). */
    flush?(): Promise<void>;
}

/**
 * Initialize the WASM engine. Call once before creating clients.
 * @param logger Optional pino-compatible logger.
 * @param crypto Optional native crypto callbacks — when provided, AES/HMAC
 *               primitives delegate to the host (e.g. `node:crypto`). Falls
 *               back to the Rust-soft implementation if omitted.
 */
export function initWasmEngine(logger?: any, crypto?: JsCryptoCallbacks): void;

/**
 * Create a full WhatsApp client running in WASM.
 *
 * @param transport_config WebSocket transport callbacks (connect/send/disconnect)
 * @param http_config HTTP client callbacks (execute via fetch)
 * @param on_event Optional event callback — receives typed WhatsApp events in order
 * @param store Optional JS storage callbacks — if provided, enables persistent storage
 */
export function createWhatsAppClient(
transport_config: JsTransportCallbacks,
http_config: JsHttpClientConfig,
on_event?: ((event: WhatsAppEvent) => void) | null,
store?: JsStoreCallbacks | null,
cache_config?: CacheConfig | null,
): Promise<WasmWhatsAppClient>;

/** Cache entry configuration. */
export interface CacheEntryConfig {
    ttlSecs?: number;
    capacity?: number;
    store?: JsCacheStore;
}

/** Custom cache backend. */
export interface JsCacheStore {
    get(namespace: string, key: string): Promise<Uint8Array | null>;
    set(namespace: string, key: string, value: Uint8Array, ttlSecs?: number): Promise<void>;
    delete(namespace: string, key: string): Promise<void>;
    clear(namespace: string): Promise<void>;
}

/** Cache configuration — all fields optional. */
export interface CacheConfig {
    store?: JsCacheStore;
    group?: CacheEntryConfig;
    device?: CacheEntryConfig;
    deviceRegistry?: CacheEntryConfig;
    lidPn?: CacheEntryConfig;
    retriedGroupMessages?: CacheEntryConfig;
    recentMessages?: CacheEntryConfig;
    messageRetry?: CacheEntryConfig;
}

// Augment WasmWhatsAppClient with methods that need skip_typescript
// (Record returns can't be expressed by wasm-bindgen)
interface WasmWhatsAppClient {
    /** Fetch all groups the user is participating in. */
    groupFetchAllParticipating(): Promise<Record<string, GroupMetadataResult>>;
    /** Fetch user info for one or more JIDs. */
    fetchUserInfo(jids: string[]): Promise<Record<string, UserInfoResult>>;
}


/**
 * A message key for `readMessages`.
 */
export interface ReadMessageKey {
    remoteJid: string;
    id: string;
    participant?: string;
}

/**
 * A participant change result from `groupParticipantsUpdate`.
 */
export interface ParticipantChangeResult {
    jid: string;
    status?: string;
    error?: string;
}

/**
 * A single entry from `fetchBlocklist`.
 */
export interface BlocklistEntryResult {
    jid: string;
    timestamp?: number;
}

/**
 * A single entry from `fetchUserInfo`.
 */
export interface UserInfoResult {
    jid: string;
    lid?: string;
    status?: string;
    pictureId?: string;
    isBusiness: boolean;
}

/**
 * A single media host from `getMediaConn`.
 */
export interface MediaHost {
    hostname: string;
}

/**
 * A single voter entry for `getAggregateVotesInPollMessage`.
 */
export interface PollVoterEntry {
    voter: string;
    encPayload: Uint8Array;
    encIv: Uint8Array;
}

/**
 * Block/unblock action.
 */
export type BlockAction = "block" | "unblock";

/**
 * Business category info.
 */
export interface BusinessCategoryResult {
    id: string;
    name: string;
}

/**
 * Business hours config for a day.
 */
export interface BusinessHoursConfigResult {
    dayOfWeek: string;
    mode: string;
    openTime: number;
    closeTime: number;
}

/**
 * Business hours.
 */
export interface BusinessHoursResult {
    timezone?: string;
    businessConfig?: BusinessHoursConfigResult[];
}

/**
 * Chat state (typing indicator).
 */
export type ChatState = "composing" | "recording" | "paused";

/**
 * Enabled features in this build.
 * Use this to check feature availability at runtime before calling feature-gated functions.
 */
export interface EnabledFeatures {
    /**
     * Audio processing support (waveform generation, duration detection)
     */
    audio: boolean;
    /**
     * Image processing support (thumbnails, profile pictures, format conversion)
     */
    image: boolean;
    /**
     * Sticker metadata support (WebP EXIF for WhatsApp stickers)
     */
    sticker: boolean;
}

/**
 * Group join request action.
 */
export type GroupRequestAction = "approve" | "reject";

/**
 * Group member add mode.
 */
export type MemberAddMode = "admin_add" | "all_member_add";

/**
 * Group participant action.
 */
export type GroupParticipantAction = "add" | "remove" | "promote" | "demote";

/**
 * Group participant info as returned from `getGroupMetadata` / cached group
 * state. Distinct from `wacore::stanza::groups::GroupParticipantInfo` (the
 * event-time variant that carries `Jid` objects on the wire); naming it
 * separately avoids the TypeScript collision that forced consumers to cast.
 */
export interface GroupMetadataParticipant {
    jid: string;
    phoneNumber?: string;
    isAdmin: boolean;
}

/**
 * Group setting type.
 */
export type GroupSetting = "locked" | "announce" | "membership_approval";

/**
 * Media type for upload/download operations.
 */
export type MediaType = "image" | "video" | "audio" | "document" | "sticker" | "thumbnail-link" | "md-msg-hist" | "md-app-state" | "product-catalog-image";

/**
 * Mirrors `device_props.HistorySyncConfig`. Only fields a consumer would
 * realistically tune are exposed individually; partial overrides merge into
 * `wacore::store::default_history_sync_config()` so callers don\'t accidentally
 * drop the WA-Web-aligned support_* claims by setting just one field.
 */
export interface DeviceHistorySyncConfig {
    fullSyncDaysLimit?: number;
    fullSyncSizeMbLimit?: number;
    storageQuotaMb?: number;
    recentSyncDaysLimit?: number;
    supportCallLogHistory?: boolean;
    supportGroupHistory?: boolean;
    onDemandReady?: boolean;
    thumbnailSyncDaysLimit?: number;
    initialSyncMaxMessagesPerChat?: number;
}

/**
 * Mirrors `device_props.PlatformType`. The display value the phone shows in
 * \"Linked Devices\" — and the type WhatsApp\'s server uses to decide whether
 * features like view-once are deliverable as payload or as `absent` stub.
 * Variant names render as `SCREAMING_SNAKE_CASE` in TS to match the proto
 * enum identifiers callers see in WhatsApp documentation / wire dumps.
 */
export type DevicePlatformType = "UNKNOWN" | "CHROME" | "FIREFOX" | "IE" | "OPERA" | "SAFARI" | "EDGE" | "DESKTOP" | "IPAD" | "ANDROID_TABLET" | "OHANA" | "ALOHA" | "CATALINA" | "TCL_TV" | "IOS_PHONE" | "IOS_CATALYST" | "ANDROID_PHONE" | "ANDROID_AMBIGUOUS" | "WEAR_OS" | "AR_WRIST" | "AR_DEVICE" | "UWP" | "VR" | "CLOUD_API" | "SMARTGLASSES";

/**
 * Optional Noise-payload overrides applied on top of every preset.
 * Leaving any field `None` preserves wacore\'s default, which matches
 * WA Web (notably `phoneId` stays unset on the wire).
 */
export interface ClientProfileOverrides {
    phoneId?: string | undefined;
    localeLanguage?: string | undefined;
    localeCountry?: string | undefined;
    passiveLogin?: boolean | undefined;
}

/**
 * Picture type for profile picture URL.
 */
export type PictureType = "preview" | "image";

/**
 * Presence status.
 */
export type PresenceStatus = "available" | "unavailable";

/**
 * Public error shape that crosses the WASM→JS boundary.
 *
 * Variants are intentionally flat — no `#[from]` on enum variants, no
 * `#[serde(flatten)]`. Translation from the core\'s typed errors happens in
 * `From` impls below by walking the source chain. This keeps the JS object
 * shape predictable and the codegen / `Tsify` output simple.
 */
export type BridgeError = { kind: "server"; serverCode: number; serverText: string } | { kind: "timeout" } | { kind: "not-connected" } | { kind: "disconnected"; reason: string } | { kind: "invalid-argument"; field: string; reason: string } | { kind: "protocol-violation"; reason: string } | { kind: "crypto"; operation: string } | { kind: "storage"; operation: string } | { kind: "internal"; message: string };

/**
 * Result from `createPoll`.
 */
export interface CreatePollResult {
    messageId: string;
    messageSecret: Uint8Array;
}

/**
 * Result from `encryptMediaStream`.
 */
export interface EncryptMediaResult {
    mediaKey: Uint8Array;
    fileSha256: Uint8Array;
    fileEncSha256: Uint8Array;
    fileLength: number;
}

/**
 * Result from `fetchStatus`.
 */
export interface FetchStatusResult {
    jid: string;
    status?: string;
}

/**
 * Result from `getAggregateVotesInPollMessage`.
 */
export interface PollAggregateResult {
    name: string;
    voters: string[];
}

/**
 * Result from `getBusinessProfile`.
 */
export interface BusinessProfileResult {
    wid?: string;
    description: string;
    email?: string;
    website: string[];
    categories: BusinessCategoryResult[];
    address?: string;
    businessHours: BusinessHoursResult;
}

/**
 * Result from `getGroupMetadata`.
 */
export interface GroupMetadataResult {
    id: string;
    subject: string;
    participants: GroupMetadataParticipant[];
    addressingMode: string;
    creator?: string;
    creationTime?: number;
    subjectTime?: number;
    subjectOwner?: string;
    description?: string;
    descriptionId?: string;
    isLocked: boolean;
    isAnnouncement: boolean;
    ephemeralExpiration: number;
    membershipApproval: boolean;
    memberAddMode?: string;
    memberLinkMode?: string;
    size?: number;
    isParentGroup: boolean;
    parentGroupJid?: string;
    isDefaultSubGroup: boolean;
    isGeneralChat: boolean;
    allowNonAdminSubGroupCreation: boolean;
}

/**
 * Result from `getMediaConn`.
 */
export interface MediaConnResult {
    auth: string;
    ttl: number;
    hosts: MediaHost[];
}

/**
 * Result from `getMemoryDiagnostics`.
 */
export interface MemoryDiagnosticsResult {
    groupCache: number;
    deviceRegistryCache: number;
    senderKeyDeviceCache: number;
    lidPnLidEntries: number;
    lidPnPnEntries: number;
    recentMessages: number;
    messageRetryCounts: number;
    pdoPendingRequests: number;
    sessionLocks: number;
    chatLanes: number;
    responseWaiters: number;
    nodeWaiters: number;
    pendingRetries: number;
    presenceSubscriptions: number;
    appStateKeyRequests: number;
    appStateSyncing: number;
    signalCacheSessions: number;
    signalCacheIdentities: number;
    signalCacheSenderKeys: number;
    chatstateHandlers: number;
    customEncHandlers: number;
}

/**
 * Result from `groupRequestParticipantsList`.
 */
export interface MembershipRequestResult {
    jid: string;
    requestTime?: number;
}

/**
 * Result from `isOnWhatsApp`.
 *
 * Mirrors the core `IsOnWhatsAppResult` so callers get the LID/PN counterpart
 * and business flag from the same usync round trip — no follow-up
 * `fetchUserInfo` IQ needed for the common \"check + enrich\" flow.
 */
export interface IsOnWhatsAppResult {
    jid: string;
    isRegistered: boolean;
    /**
     * LID counterpart of `jid` when the input was a PN, populated from the
     * usync `<lid>` attribute (or the local LID/PN cache).
     */
    lid?: string;
    /**
     * PN counterpart, set when the server responds with a LID as primary JID.
     */
    pnJid?: string;
    isBusiness: boolean;
}

/**
 * Result from `profilePictureUrl`.
 */
export interface ProfilePictureInfo {
    id: string;
    url: string;
    directPath?: string;
    hash?: string;
}

/**
 * Result from `updateProfilePicture` or `removeProfilePicture`.
 */
export interface ProfilePictureResult {
    id: string;
}

/**
 * Result from `uploadMedia`.
 */
export interface UploadMediaResult {
    url: string;
    directPath: string;
    mediaKey: Uint8Array;
    fileSha256: Uint8Array;
    fileEncSha256: Uint8Array;
    fileLength: number;
}

/**
 * Result from newsletter methods.
 */
export interface NewsletterMetadataResult {
    jid: string;
    name: string;
    description?: string;
    subscriberCount: number;
    verification: string;
    state: string;
    pictureUrl?: string;
    previewUrl?: string;
    inviteCode?: string;
    role?: string;
    creationTime?: number;
}

/**
 * Selects which `ClientProfile` preset to use for the noise-handshake
 * `ClientPayload.UserAgent`. Independent of `DeviceProps`: `setDeviceProps`
 * controls the \"Linked Devices\" display on the phone, this controls what
 * the server sees in the noise layer.
 *
 * Use `{ preset: \'android\', osVersion: \'13\' }` to mirror the upstream
 * Baileys `Browsers.android(\'13\')` behavior (UserAgent.platform = ANDROID,
 * `web_info` omitted).
 *
 * Every variant flattens the [`ClientProfileOverrides`] fields, so the
 * JS literal is flat (e.g. `{ preset: \'web\', phoneId: \'fixed-id\' }`).
 */
export type ClientProfileInput = ({ preset: "web" } & {} & ClientProfileOverrides) | ({ preset: "android" } & { osVersion: string } & ClientProfileOverrides) | ({ preset: "smbAndroid" } & { osVersion: string } & ClientProfileOverrides) | ({ preset: "ios" } & { osVersion: string } & ClientProfileOverrides) | ({ preset: "macos" } & { osVersion: string } & ClientProfileOverrides) | ({ preset: "windows" } & { osVersion: string } & ClientProfileOverrides);

export interface DeviceAppVersion {
    primary?: number;
    secondary?: number;
    tertiary?: number;
    quaternary?: number;
}

export interface DevicePropsInput {
    os?: string;
    platformType?: DevicePlatformType;
    version?: DeviceAppVersion;
    historySyncConfig?: DeviceHistorySyncConfig;
}

export type WhatsAppEvent =
| { type: 'receipt'; data: Receipt }
| { type: 'undecryptable_message'; data: UndecryptableMessage }
| { type: 'chat_presence'; data: ChatPresenceUpdate }
| { type: 'presence'; data: PresenceUpdate }
| { type: 'picture_update'; data: PictureUpdate }
| { type: 'user_about_update'; data: UserAboutUpdate }
| { type: 'contact_updated'; data: ContactUpdated }
| { type: 'contact_number_changed'; data: ContactNumberChanged }
| { type: 'contact_sync_requested'; data: ContactSyncRequested }
| { type: 'group_update'; data: GroupUpdate }
| { type: 'contact_update'; data: ContactUpdate }
| { type: 'push_name_update'; data: PushNameUpdate }
| { type: 'self_push_name_updated'; data: SelfPushNameUpdated }
| { type: 'pin_update'; data: PinUpdate }
| { type: 'mute_update'; data: MuteUpdate }
| { type: 'archive_update'; data: ArchiveUpdate }
| { type: 'star_update'; data: StarUpdate }
| { type: 'mark_chat_as_read_update'; data: MarkChatAsReadUpdate }
| { type: 'delete_chat_update'; data: DeleteChatUpdate }
| { type: 'delete_message_for_me_update'; data: DeleteMessageForMeUpdate }
| { type: 'offline_sync_preview'; data: OfflineSyncPreview }
| { type: 'offline_sync_completed'; data: OfflineSyncCompleted }
| { type: 'device_list_update'; data: DeviceListUpdate }
| { type: 'identity_change'; data: IdentityChange }
| { type: 'business_status_update'; data: BusinessStatusUpdate }
| { type: 'temporary_ban'; data: TemporaryBan }
| { type: 'connect_failure'; data: ConnectFailure }
| { type: 'stream_error'; data: StreamError }
| { type: 'disappearing_mode_changed'; data: DisappearingModeChanged }
| { type: 'newsletter_live_update'; data: NewsletterLiveUpdate }
| { type: 'incoming_call'; data: IncomingCall }
| { type: 'mex_notification'; data: MexNotification }
| { type: 'connected'; data: Record<string, never> }
| { type: 'disconnected'; data: Record<string, never> }
| { type: 'qr'; data: { code: string; timeout: number } }
| { type: 'pairing_code'; data: { code: string; timeout: number } }
| { type: 'pair_success'; data: { id: string; lid: string; business_name: string; platform: string } }
| { type: 'pair_error'; data: { id: string; lid: string; business_name: string; platform: string; error: string } }
| { type: 'logged_out'; data: { on_connect: boolean; reason: string } }
| { type: 'message'; data: { message: Record<string, unknown>; info: MessageInfo & { is_view_once: boolean } } }
| { type: 'notification'; data: { tag: string; attrs: Record<string, string>; content?: unknown } }
| { type: 'stream_replaced'; data: Record<string, never> }
| { type: 'qr_scanned_without_multidevice'; data: Record<string, never> }
| { type: 'client_outdated'; data: Record<string, never> }
| { type: 'raw_node'; data: { tag: string; attrs: Record<string, string>; content?: unknown } }
| { type: 'history_sync'; data: import('./proto-types').proto.IHistorySync & { syncType: number; chunkOrder?: number; progress?: number; peerDataRequestSessionId?: string } }
;



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>;
}

/**
 * Opaque handle to the WhatsApp client.
 */
export class WasmWhatsAppClient {
    private constructor();
    free(): void;
    [Symbol.dispose](): void;
    /**
     * Archive or unarchive a chat.
     */
    archiveChat(jid: string, archive: boolean): Promise<void>;
    /**
     * Ensure E2E Signal sessions exist for the given JIDs.
     * Returns true after sessions are established.
     */
    assertSessions(jids: string[], _force: boolean): Promise<boolean>;
    /**
     * Connect to WhatsApp servers (single connection, no auto-reconnect).
     */
    connect(): Promise<void>;
    /**
     * Create a new group.
     *
     * Returns the full `GroupMetadataResult` parsed directly from the
     * server's create response — no follow-up `getGroupMetadata` IQ
     * needed. Mirrors WhatsApp Web / upstream Baileys: the create reply
     * already carries the complete `<group>` node (id, subject,
     * creation, creator, participants, …).
     */
    createGroup(subject: string, participants: string[]): Promise<GroupMetadataResult>;
    /**
     * Create encrypted participant `<to>` nodes for recipient JIDs.
     * Returns `{ nodes: [...], shouldIncludeDeviceIdentity: boolean }`.
     * Use `encodeProto('Message', obj)` on the JS side to produce the bytes.
     */
    createParticipantNodesBytes(jids: string[], bytes: Uint8Array, _extra_attrs: any): Promise<any>;
    /**
     * Create and send a poll. Returns `{ messageId, messageSecret }`.
     *
     * The `messageSecret` (32 bytes) is needed to decrypt votes later.
     */
    createPoll(jid: string, name: string, options: string[], selectable_count: number): Promise<CreatePollResult>;
    /**
     * Delete a chat via app state mutation.
     */
    deleteChat(jid: string): Promise<void>;
    /**
     * Delete a message for self (not for everyone).
     */
    deleteMessageForMe(jid: string, message_id: string, from_me: boolean): Promise<void>;
    /**
     * Disconnect the client and flush pending state to storage.
     */
    disconnect(): Promise<void>;
    /**
     * Download and decrypt media from raw parameters.
     *
     * Handles CDN failover, auth refresh, HMAC-SHA256 verification, and
     * AES-256-CBC decryption internally. Returns decrypted media bytes.
     */
    downloadMedia(direct_path: string, media_key: Uint8Array, file_sha256: Uint8Array, file_enc_sha256: Uint8Array, file_length: number, media_type: MediaType): Promise<Uint8Array>;
    /**
     * Download, decrypt, and return a Web ReadableStream of decrypted chunks.
     *
     * Same as `downloadMedia` but returns a `ReadableStream` instead of buffering
     * the entire file. In Node.js, consume with `Readable.fromWeb(stream)`.
     */
    downloadMediaStream(direct_path: string, media_key: Uint8Array, file_sha256: Uint8Array, file_enc_sha256: Uint8Array, file_length: number, media_type: MediaType): ReadableStream;
    /**
     * Edit a previously sent message from protobuf bytes.
     */
    editMessageBytes(jid: string, message_id: string, bytes: Uint8Array): Promise<string>;
    /**
     * True streaming encrypt via `MediaEncryptor`: processes plaintext chunk-by-chunk
     * from JS ReadableStream, encrypts with AES-256-CBC, writes ciphertext to JS WritableStream.
     *
     * Peak memory: ~130KB (copy buffer + flush buffer + crypto state).
     */
    encryptMediaStream(input: ReadableStream, output: WritableStream, media_type: MediaType): Promise<EncryptMediaResult>;
    /**
     * Fetch the full blocklist.
     */
    fetchBlocklist(): Promise<BlocklistEntryResult[]>;
    /**
     * Request on-demand message history from the primary phone.
     * Returns the message ID of the PDO request.
     * Results will arrive as history_sync events.
     */
    fetchMessageHistory(count: number, chat_jid: string, oldest_msg_id: string, oldest_msg_from_me: boolean, oldest_msg_timestamp_ms: number): Promise<string>;
    /**
     * Fetch all privacy settings.
     */
    fetchPrivacySettings(): Promise<any>;
    /**
     * Fetch the account's reachout-timelock state.
     *
     * Wraps the `WAWebMexFetchReachoutTimelockJobQuery` MEX persisted
     * query (id sourced from `wacore::iq::mex_ids::reachout_timelock::FETCH`)
     * and returns the `xwa2_fetch_account_reachout_timelock` payload as a
     * raw JSON object — typically:
     *
     * ```json
     * { "is_active": true,
     *   "time_enforcement_ends": "1734567890",
     *   "enforcement_type": "BIZ_COMMERCE_VIOLATION_…" }
     * ```
     *
     * Returns `null` when the server has no timelock for this account.
     * Callers map snake_case → idiomatic shape themselves.
     */
    fetchReachoutTimelock(): Promise<any>;
    /**
     * Fetch user status/about text for one or more JIDs.
     */
    fetchStatus(jids: string[]): Promise<FetchStatusResult[]>;
    /**
     * Get the ADV signed device identity (account), if available.
     * Used by upstream Baileys consumers that access `authState.creds.account`.
     */
    getAccount(): Promise<any>;
    /**
     * Get business profile information for a JID.
     */
    getBusinessProfile(jid: string): Promise<BusinessProfileResult | undefined>;
    /**
     * Get metadata for a group.
     */
    getGroupMetadata(jid: string): Promise<GroupMetadataResult>;
    /**
     * Get the own JID (phone number JID) if logged in.
     *
     * Returns the non-AD JID (without device suffix), e.g. "559980000014@s.whatsapp.net".
     * This is the JID used for addressing in messages.
     */
    getJid(): Promise<string | undefined>;
    /**
     * Get the own LID (linked identity) if available.
     *
     * Returns the non-AD LID (without device suffix), e.g. "100000012345678@lid".
     */
    getLid(): Promise<string | undefined>;
    /**
     * Get media connection info (auth token + upload hosts).
     *
     * Returns `{ auth: string, ttl: number, hosts: [{hostname: string, maxContentLengthBytes: number}] }`.
     */
    getMediaConn(force: boolean): Promise<MediaConnResult>;
    /**
     * Returns a snapshot of internal memory diagnostics (cache sizes, session counts, etc.).
     */
    getMemoryDiagnostics(): Promise<MemoryDiagnosticsResult>;
    /**
     * Get the current push name.
     */
    getPushName(): Promise<string>;
    /**
     * Get the list of known devices for the given user JIDs via usync query.
     * Returns an array of JID strings (one per device).
     */
    getUSyncDevices(jids: string[], _use_cache: boolean, _ignore_zero_devices: boolean): Promise<any>;
    /**
     * Join a group using an invite code.
     */
    groupAcceptInvite(code: string): Promise<string>;
    /**
     * Join a group via a GroupInviteMessage (V4 invite).
     */
    groupAcceptInviteV4(group_jid: string, code: string, expiration: number, admin_jid: string): Promise<string>;
    /**
     * Get group info from an invite code (without joining).
     * Returns the same shape as groupMetadata.
     */
    groupGetInviteInfo(code: string): Promise<GroupMetadataResult>;
    /**
     * Get the invite link for a group.
     */
    groupInviteCode(jid: string): Promise<string>;
    /**
     * Leave a group.
     */
    groupLeave(jid: string): Promise<void>;
    /**
     * Set who can add members to a group.
     */
    groupMemberAddMode(jid: string, mode: MemberAddMode): Promise<void>;
    /**
     * Update group participants (add, remove, promote, demote).
     */
    groupParticipantsUpdate(jid: string, participants: string[], action: GroupParticipantAction): Promise<ParticipantChangeResult[]>;
    /**
     * Get list of pending join requests for a group.
     */
    groupRequestParticipantsList(jid: string): Promise<MembershipRequestResult[]>;
    /**
     * Approve or reject pending join requests.
     */
    groupRequestParticipantsUpdate(jid: string, participants: string[], action: GroupRequestAction): Promise<void>;
    /**
     * Revoke a group's invite link (generates new one).
     */
    groupRevokeInvite(jid: string): Promise<string>;
    /**
     * Update a group setting (locked, announce, membership_approval).
     */
    groupSettingUpdate(jid: string, setting: GroupSetting, value: boolean): Promise<void>;
    /**
     * Set disappearing messages timer for a group (0 to disable).
     */
    groupToggleEphemeral(jid: string, expiration: number): Promise<void>;
    /**
     * Update a group's description. Pass null/undefined to remove.
     */
    groupUpdateDescription(jid: string, description?: string | null): Promise<void>;
    /**
     * Update a group's subject (name).
     */
    groupUpdateSubject(jid: string, subject: string): Promise<void>;
    /**
     * Check if the client is connected.
     */
    isConnected(): boolean;
    /**
     * Check if the client is logged in (paired).
     */
    isLoggedIn(): boolean;
    /**
     * Check if one or more phone numbers / JIDs are registered on WhatsApp.
     *
     * Accepts either bare phone numbers (treated as PN JIDs) or full JIDs
     * (`@s.whatsapp.net` for PN, `@lid` for LID). Mixed PN/LID inputs are
     * transparently split into the two underlying usync queries by the core,
     * so a single call is at most two IQs regardless of input size.
     *
     * Returns one `IsOnWhatsAppResult` per server hit — including the LID
     * counterpart and business flag — eliminating the follow-up `fetchUserInfo`
     * round trip the previous single-phone API forced callers into.
     */
    isOnWhatsApp(phones: string[]): Promise<IsOnWhatsAppResult[]>;
    /**
     * Convert a JID string to its Signal protocol address representation.
     */
    jidToSignalProtocolAddress(jid: string): string;
    /**
     * Look up the LID JID corresponding to a given phone number JID.
     *
     * Accepts a bare phone number (treated as PN), a `<phone>@s.whatsapp.net`
     * JID, or any LID/PN JID. Returns the full LID JID string (e.g.
     * `100000012345678@lid`) or `null` when no mapping is known. Backed by
     * the core's cache-aside `get_lid_pn_entry`: hits the in-memory cache
     * first, then falls through to `backend.get_pn_mapping(user)` so a JS
     * `JsStoreCallbacks` backend without a list primitive still resolves
     * every persisted mapping without an extra usync round trip.
     */
    lidForPn(jid: string): Promise<string | undefined>;
    /**
     * Logout from WhatsApp — deregisters this companion device and disconnects.
     *
     * Sends `remove-companion-device` IQ to the server (best-effort),
     * then disconnects. Does NOT clear stored keys — the caller should
     * delete the store to fully clear credentials.
     */
    logout(): Promise<void>;
    /**
     * Mark a chat as read or unread via app state mutation.
     * Different from readMessages (which sends read receipts).
     */
    markChatAsRead(jid: string, read: boolean): Promise<void>;
    /**
     * Run a MEX (GraphQL) persisted query against the server.
     *
     * The numeric `doc_id` rotates with the WA Web bundle, so callers
     * supply both the human-readable `op_name` (stable, used for error
     * diagnostics) and the current `id`. Variables are passed as a JSON
     * string for transparency on the JS boundary.
     *
     * Returns the raw `MexResponse` (`data` + `errors`). Domain mapping is
     * the consumer's job — keeps the bridge insulated from WA Web shape
     * churn.
     */
    mexQuery(op_name: string, doc_id: string, variables_json: string): Promise<any>;
    /**
     * Mute or unmute a chat.
     *
     * Pass a positive timestamp (ms) to mute until that time, or null/undefined to unmute.
     */
    muteChat(jid: string, mute_until?: number | null): Promise<void>;
    /**
     * Create a new newsletter (channel).
     */
    newsletterCreate(name: string, description?: string | null): Promise<NewsletterMetadataResult>;
    /**
     * Fetch metadata for a newsletter by JID.
     */
    newsletterMetadata(jid: string): Promise<NewsletterMetadataResult>;
    /**
     * Send a reaction to a newsletter message.
     *
     * `server_id` is the server-assigned message ID (passed as string to avoid
     * JS number precision issues). `reaction` is the emoji code, or null/empty
     * to remove a reaction.
     */
    newsletterReactMessage(jid: string, server_id: string, reaction?: string | null): Promise<void>;
    /**
     * Subscribe (join) a newsletter.
     */
    newsletterSubscribe(jid: string): Promise<NewsletterMetadataResult>;
    /**
     * Unsubscribe (leave) a newsletter.
     */
    newsletterUnsubscribe(jid: string): Promise<void>;
    /**
     * Pin or unpin a chat.
     */
    pinChat(jid: string, pin: boolean): Promise<void>;
    /**
     * Look up the phone number JID corresponding to a given LID JID.
     *
     * Accepts a bare LID user-part, a `<user>@lid` JID, or any LID/PN JID.
     * Returns the full PN JID string (e.g. `559980000001@s.whatsapp.net`) or
     * `null` when no mapping is known. Same cache-aside semantics as
     * `lidForPn` — see that doc.
     */
    pnForLid(jid: string): Promise<string | undefined>;
    /**
     * Subscribe to a contact's presence updates.
     */
    presenceSubscribe(jid: string): Promise<void>;
    /**
     * Get the profile picture URL for a user or group.
     *
     * `picture_type` should be "preview" or "image".
     */
    profilePictureUrl(jid: string, picture_type: PictureType): Promise<ProfilePictureInfo | undefined>;
    /**
     * Mark messages as read by sending read receipts.
     */
    readMessages(keys: ReadMessageKey[]): Promise<void>;
    /**
     * Drop the current connection and reconnect immediately, picking up
     * any profile changes (e.g. `setClientProfile`) on the new handshake.
     * The `run()` loop continues — only the in-flight WebSocket is reset.
     */
    reconnect(): Promise<void>;
    /**
     * Reject an incoming call.
     */
    rejectCall(call_id: string, call_from: string): Promise<void>;
    /**
     * Low-level message relay from protobuf binary bytes.
     */
    relayMessageBytes(jid: string, bytes: Uint8Array, message_id?: string | null): Promise<string>;
    /**
     * Remove a group's profile picture.
     */
    removeGroupProfilePicture(group_jid: string): Promise<ProfilePictureResult>;
    /**
     * Remove the profile picture for the logged-in user.
     */
    removeProfilePicture(): Promise<ProfilePictureResult>;
    /**
     * Request the server to re-upload expired media.
     *
     * Returns the new `directPath` on success.
     * Throws on failure (not found, decryption error, timeout, etc.).
     */
    requestMediaReupload(msg_id: string, chat_jid: string, media_key: Uint8Array, is_from_me: boolean, participant?: string | null): Promise<string>;
    /**
     * Request a pairing code for phone number login (alternative to QR).
     *
     * Returns the 8-character pairing code to enter on the phone. On error,
     * throws a `WhatsAppError` with structured fields (`kind`, `serverCode`,
     * `serverText`, etc.) — see `errors::BridgeError`.
     */
    requestPairingCode(phone_number: string, custom_code?: string | null): Promise<string>;
    /**
     * Revoke (delete) a sent message.
     */
    revokeMessage(jid: string, message_id: string, participant?: string | null): Promise<void>;
    /**
     * Start the main client loop in the background.
     *
     * Spawns the connection loop (connect, handshake, message loop, reconnect)
     * as a background task and returns immediately. The loop runs until `disconnect()`
     * is called.
     *
     * Not `async` to avoid holding a wasm-bindgen borrow on `self` that would
     * prevent calling other methods (disconnect, etc.).
     */
    run(): void;
    /**
     * Send a chat state update (typing indicator).
     */
    sendChatState(jid: string, state: ChatState): Promise<void>;
    /**
     * Send an E2E encrypted message from protobuf bytes.
     * Use `encodeProto('Message', obj)` on the JS side to produce the bytes.
     */
    sendMessageBytes(jid: string, bytes: Uint8Array): Promise<string>;
    /**
     * Send a raw binary node stanza to WhatsApp servers.
     * Accepts a JS object matching `{ tag: string, attrs: Record<string, string>, content?: ... }`.
     */
    sendNode(node_js: any): Promise<void>;
    /**
     * Send presence status ("available" or "unavailable").
     */
    sendPresence(status: PresenceStatus): Promise<void>;
    /**
     * Send pre-marshaled bytes through the noise socket.
     */
    sendRawMessage(data: Uint8Array): Promise<void>;
    /**
     * Send a status/story message to specified recipients.
     * Use `encodeProto('Message', obj)` on the JS side to produce the bytes.
     */
    sendStatusMessageBytes(bytes: Uint8Array, recipients: string[]): Promise<string>;
    /**
     * Enable or disable automatic reconnection on disconnect.
     * Enabled by default. When disabled, the client will not attempt
     * to reconnect after an unexpected disconnection.
     */
    setAutoReconnect(enabled: boolean): void;
    /**
     * Override the noise-handshake `ClientPayload` profile (UserAgent
     * platform/device/os_version/manufacturer + `web_info` presence).
     *
     * Independent of `setDeviceProps`: that one drives the "Linked Devices"
     * display on the phone; this one drives what the server sees during the
     * noise handshake. Use `{ preset: 'android', osVersion: '13' }` to
     * mirror Baileys' `Browsers.android('13')` (sets `UserAgent.platform =
     * ANDROID` and omits `web_info`).
     *
     * Runtime-only — the field is `#[serde(skip)]` in the persisted Device,
     * so re-apply on every fresh process before `connect()`.
     */
    setClientProfile(input: ClientProfileInput): Promise<void>;
    /**
     * Override `DeviceProps` before initial pairing. Only takes effect on
     * the registration node — for already paired sessions this is a no-op
     * on the wire and the core logs a warning.
     *
     * Setting `platformType: 'ANDROID_PHONE'` flips the phone's "Linked
     * Devices" display to Android and unlocks server-side feature gating
     * (e.g. view-once delivered as payload instead of `absent` stub) WITHOUT
     * switching the underlying transport — the client still speaks the web
     * protocol. Real Android companion mode (CRSC v2/v3, TEE attestation)
     * is NOT implemented; if the server starts enforcing companion-type
     * crypto, those connections may break.
     */
    setDeviceProps(input: DevicePropsInput): Promise<void>;
    /**
     * Set the profile picture for a group the user administers.
     *
     * Mirrors the core `SetProfilePictureSpec::set_group` path — same IQ as
     * the self update, just routed at the JID level so admins can change a
     * group's avatar from JS without an extra capability check.
     */
    setGroupProfilePicture(group_jid: string, img_data: Uint8Array): Promise<ProfilePictureResult>;
    /**
     * Set the user's push name (display name).
     */
    setPushName(name: string): Promise<void>;
    /**
     * Enable or disable raw node forwarding. When enabled, a `raw_node` event
     * is emitted for every decoded stanza before internal dispatch.
     */
    setRawNodeForwarding(enabled: boolean): void;
    /**
     * Decrypt a group (sender-key) message.
     */
    signalDecryptGroupMessage(group_jid: string, author_jid: string, msg: Uint8Array): Promise<Uint8Array>;
    /**
     * Decrypt a Signal protocol message. `msg_type` is "msg", "pkmsg", or "skmsg".
     */
    signalDecryptMessage(jid: string, msg_type: string, ciphertext: Uint8Array): Promise<Uint8Array>;
    /**
     * Delete Signal sessions for the given JIDs.
     */
    signalDeleteSessions(jids: string[]): Promise<void>;
    /**
     * Encrypt plaintext for a group (sender key).
     * Returns `{ senderKeyDistributionMessage: Uint8Array, ciphertext: Uint8Array }`.
     */
    signalEncryptGroupMessage(group_jid: string, data: Uint8Array, _me_id: string): Promise<any>;
    /**
     * Encrypt plaintext for a single recipient.
     * Returns `{ type: "msg"|"pkmsg", ciphertext: Uint8Array }`.
     */
    signalEncryptMessage(jid: string, data: Uint8Array): Promise<any>;
    /**
     * Check whether a Signal session exists for the given JID.
     */
    signalValidateSession(jid: string): Promise<boolean>;
    /**
     * Star or unstar a message.
     */
    starMessage(jid: string, message_id: string, star: boolean): Promise<void>;
    /**
     * Block or unblock a contact.
     */
    updateBlockStatus(jid: string, action: BlockAction): Promise<void>;
    /**
     * Set default disappearing messages duration (seconds). 0 to disable.
     */
    updateDefaultDisappearingMode(duration: number): Promise<void>;
    /**
     * Set or clear the bot's per-group "member label" — the small tag rendered
     * under the bot's display name inside that group's UI. Empty `label`
     * clears the label. The core sends this as a `ProtocolMessage` over the
     * normal message path (not an IQ), matching WA Web's behavior.
     */
    updateMemberLabel(group_jid: string, label: string): Promise<void>;
    /**
     * Update a single privacy setting.
     */
    updatePrivacySetting(category: string, value: string): Promise<void>;
    /**
     * Set the profile picture for the logged-in user.
     */
    updateProfilePicture(img_data: Uint8Array): Promise<ProfilePictureResult>;
    /**
     * Update the user's status text (about).
     */
    updateProfileStatus(status: string): Promise<void>;
    /**
     * Upload pre-encrypted media with streaming body.
     *
     * `get_body` is a JS function `() => ReadableStream<Uint8Array>` — called
     * for each upload attempt (retry creates a fresh stream).
     * Handles CDN failover, auth refresh, and resumable upload (>=5MB).
     */
    uploadEncryptedMediaStream(get_body: Function, media_key: Uint8Array, file_sha256: Uint8Array, file_enc_sha256: Uint8Array, file_length: number, media_type: MediaType): Promise<UploadMediaResult>;
    /**
     * Upload media: encrypt in memory + upload with CDN failover and retry.
     *
     * Takes raw plaintext bytes. Handles AES-256-CBC encryption, HMAC-SHA256
     * signing, multi-host CDN upload, auth refresh, and resumable upload (>=5MB).
     */
    uploadMedia(data: Uint8Array, media_type: MediaType): Promise<UploadMediaResult>;
    /**
     * Vote on a poll. Returns message ID.
     */
    votePoll(chat_jid: string, poll_msg_id: string, poll_creator_jid: string, message_secret: Uint8Array, option_names: string[]): Promise<string>;
}

/**
 * Decrypt a poll vote. Returns selected option names as a string array.
 */
export function decryptPollVote(enc_payload: Uint8Array, enc_iv: Uint8Array, message_secret: Uint8Array, poll_msg_id: string, poll_creator_jid: string, voter_jid: string, option_names: string[]): string[];

/**
 * Aggregate all votes for a poll. Returns `[{ name: string, voters: string[] }]`.
 */
export function getAggregateVotesInPollMessage(option_names: string[], voters: PollVoterEntry[], message_secret: Uint8Array, poll_msg_id: string, poll_creator_jid: string): PollAggregateResult[];

/**
 * Returns which optional features are enabled in this build.
 * Use this to conditionally call feature-gated functions.
 */
export function getEnabledFeatures(): EnabledFeatures;

/**
 * Returns current WASM linear memory usage in bytes.
 *
 * This is the total memory reserved by the WASM instance (pages × 64KB).
 * Useful for monitoring memory pressure during media operations.
 *
 * Note: this includes free space managed by the allocator — it's the
 * total memory footprint, not the amount currently in use.
 */
export function getWasmMemoryBytes(): number;

export function hasLogger(): boolean;

export function logMessage(level: string, message: string): void;

export function setLogger(logger: ILogger): void;

export function updateLogger(logger: ILogger): void;

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

export interface InitOutput {
    readonly memory: WebAssembly.Memory;
    readonly __wbg_wasmwhatsappclient_free: (a: number, b: number) => void;
    readonly createWhatsAppClient: (a: number, b: number, c: number, d: number, e: number, f: number) => number;
    readonly decryptPollVote: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number) => void;
    readonly getAggregateVotesInPollMessage: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number) => void;
    readonly getEnabledFeatures: () => number;
    readonly hasLogger: () => number;
    readonly initWasmEngine: (a: number, b: number) => void;
    readonly logMessage: (a: number, b: number, c: number, d: number) => void;
    readonly setLogger: (a: number, b: number) => void;
    readonly updateLogger: (a: number) => void;
    readonly wasmwhatsappclient_archiveChat: (a: number, b: number, c: number, d: number) => number;
    readonly wasmwhatsappclient_assertSessions: (a: number, b: number, c: number, d: number) => number;
    readonly wasmwhatsappclient_connect: (a: number) => number;
    readonly wasmwhatsappclient_createGroup: (a: number, b: number, c: number, d: number, e: number) => number;
    readonly wasmwhatsappclient_createParticipantNodesBytes: (a: number, b: number, c: number, d: number, e: number, f: number) => number;
    readonly wasmwhatsappclient_createPoll: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
    readonly wasmwhatsappclient_deleteChat: (a: number, b: number, c: number) => number;
    readonly wasmwhatsappclient_deleteMessageForMe: (a: number, b: number, c: number, d: number, e: number, f: number) => number;
    readonly wasmwhatsappclient_disconnect: (a: number) => number;
    readonly wasmwhatsappclient_downloadMedia: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number) => number;
    readonly wasmwhatsappclient_downloadMediaStream: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number) => void;
    readonly wasmwhatsappclient_editMessageBytes: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => number;
    readonly wasmwhatsappclient_encryptMediaStream: (a: number, b: number, c: number, d: number) => number;
    readonly wasmwhatsappclient_fetchBlocklist: (a: number) => number;
    readonly wasmwhatsappclient_fetchMessageHistory: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
    readonly wasmwhatsappclient_fetchPrivacySettings: (a: number) => number;
    readonly wasmwhatsappclient_fetchReachoutTimelock: (a: number) => number;
    readonly wasmwhatsappclient_fetchStatus: (a: number, b: number, c: number) => number;
    readonly wasmwhatsappclient_fetchUserInfo: (a: number, b: number, c: number) => number;
    readonly wasmwhatsappclient_getAccount: (a: number) => number;
    readonly wasmwhatsappclient_getBusinessProfile: (a: number, b: number, c: number) => number;
    readonly wasmwhatsappclient_getGroupMetadata: (a: number, b: number, c: number) => number;
    readonly wasmwhatsappclient_getJid: (a: number) => number;
    readonly wasmwhatsappclient_getLid: (a: number) => number;
    readonly wasmwhatsappclient_getMediaConn: (a: number, b: number) => number;
    readonly wasmwhatsappclient_getMemoryDiagnostics: (a: number) => number;
    readonly wasmwhatsappclient_getPushName: (a: number) => number;
    readonly wasmwhatsappclient_getUSyncDevices: (a: number, b: number, c: number, d: number, e: number) => number;
    readonly wasmwhatsappclient_groupAcceptInvite: (a: number, b: number, c: number) => number;
    readonly wasmwhatsappclient_groupAcceptInviteV4: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
    readonly wasmwhatsappclient_groupFetchAllParticipating: (a: number) => number;
    readonly wasmwhatsappclient_groupGetInviteInfo: (a: number, b: number, c: number) => number;
    readonly wasmwhatsappclient_groupInviteCode: (a: number, b: number, c: number) => number;
    readonly wasmwhatsappclient_groupLeave: (a: number, b: number, c: number) => number;
    readonly wasmwhatsappclient_groupMemberAddMode: (a: number, b: number, c: number, d: number) => number;
    readonly wasmwhatsappclient_groupParticipantsUpdate: (a: number, b: number, c: number, d: number, e: number, f: number) => number;
    readonly wasmwhatsappclient_groupRequestParticipantsList: (a: number, b: number, c: number) => number;
    readonly wasmwhatsappclient_groupRequestParticipantsUpdate: (a: number, b: number, c: number, d: number, e: number, f: number) => number;
    readonly wasmwhatsappclient_groupRevokeInvite: (a: number, b: number, c: number) => number;
    readonly wasmwhatsappclient_groupSettingUpdate: (a: number, b: number, c: number, d: number, e: number) => number;
    readonly wasmwhatsappclient_groupToggleEphemeral: (a: number, b: number, c: number, d: number) => number;
    readonly wasmwhatsappclient_groupUpdateDescription: (a: number, b: number, c: number, d: number, e: number) => number;
    readonly wasmwhatsappclient_groupUpdateSubject: (a: number, b: number, c: number, d: number, e: number) => number;
    readonly wasmwhatsappclient_isConnected: (a: number) => number;
    readonly wasmwhatsappclient_isLoggedIn: (a: number) => number;
    readonly wasmwhatsappclient_isOnWhatsApp: (a: number, b: number, c: number) => number;
    readonly wasmwhatsappclient_jidToSignalProtocolAddress: (a: number, b: number, c: number, d: number) => void;
    readonly wasmwhatsappclient_lidForPn: (a: number, b: number, c: number) => number;
    readonly wasmwhatsappclient_logout: (a: number) => number;
    readonly wasmwhatsappclient_markChatAsRead: (a: number, b: number, c: number, d: number) => number;
    readonly wasmwhatsappclient_mexQuery: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => number;
    readonly wasmwhatsappclient_muteChat: (a: number, b: number, c: number, d: number, e: number) => number;
    readonly wasmwhatsappclient_newsletterCreate: (a: number, b: number, c: number, d: number, e: number) => number;
    readonly wasmwhatsappclient_newsletterMetadata: (a: number, b: number, c: number) => number;
    readonly wasmwhatsappclient_newsletterReactMessage: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => number;
    readonly wasmwhatsappclient_newsletterSubscribe: (a: number, b: number, c: number) => number;
    readonly wasmwhatsappclient_newsletterUnsubscribe: (a: number, b: number, c: number) => number;
    readonly wasmwhatsappclient_pinChat: (a: number, b: number, c: number, d: number) => number;
    readonly wasmwhatsappclient_pnForLid: (a: number, b: number, c: number) => number;
    readonly wasmwhatsappclient_presenceSubscribe: (a: number, b: number, c: number) => number;
    readonly wasmwhatsappclient_profilePictureUrl: (a: number, b: number, c: number, d: number) => number;
    readonly wasmwhatsappclient_readMessages: (a: number, b: number, c: number) => number;
    readonly wasmwhatsappclient_reconnect: (a: number) => number;
    readonly wasmwhatsappclient_rejectCall: (a: number, b: number, c: number, d: number, e: number) => number;
    readonly wasmwhatsappclient_relayMessageBytes: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => number;
    readonly wasmwhatsappclient_removeGroupProfilePicture: (a: number, b: number, c: number) => number;
    readonly wasmwhatsappclient_removeProfilePicture: (a: number) => number;
    readonly wasmwhatsappclient_requestMediaReupload: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => number;
    readonly wasmwhatsappclient_requestPairingCode: (a: number, b: number, c: number, d: number, e: number) => number;
    readonly wasmwhatsappclient_revokeMessage: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => number;
    readonly wasmwhatsappclient_run: (a: number, b: number) => void;
    readonly wasmwhatsappclient_sendChatState: (a: number, b: number, c: number, d: number) => number;
    readonly wasmwhatsappclient_sendMessageBytes: (a: number, b: number, c: number, d: number, e: number) => number;
    readonly wasmwhatsappclient_sendNode: (a: number, b: number) => number;
    readonly wasmwhatsappclient_sendPresence: (a: number, b: number) => number;
    readonly wasmwhatsappclient_sendRawMessage: (a: number, b: number, c: number) => number;
    readonly wasmwhatsappclient_sendStatusMessageBytes: (a: number, b: number, c: number, d: number, e: number) => number;
    readonly wasmwhatsappclient_setAutoReconnect: (a: number, b: number) => void;
    readonly wasmwhatsappclient_setClientProfile: (a: number, b: number) => number;
    readonly wasmwhatsappclient_setDeviceProps: (a: number, b: number) => number;
    readonly wasmwhatsappclient_setGroupProfilePicture: (a: number, b: number, c: number, d: number, e: number) => number;
    readonly wasmwhatsappclient_setPushName: (a: number, b: number, c: number) => number;
    readonly wasmwhatsappclient_setRawNodeForwarding: (a: number, b: number) => void;
    readonly wasmwhatsappclient_signalDecryptGroupMessage: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => number;
    readonly wasmwhatsappclient_signalDecryptMessage: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => number;
    readonly wasmwhatsappclient_signalDeleteSessions: (a: number, b: number, c: number) => number;
    readonly wasmwhatsappclient_signalEncryptGroupMessage: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => number;
    readonly wasmwhatsappclient_signalEncryptMessage: (a: number, b: number, c: number, d: number, e: number) => number;
    readonly wasmwhatsappclient_signalValidateSession: (a: number, b: number, c: number) => number;
    readonly wasmwhatsappclient_starMessage: (a: number, b: number, c: number, d: number, e: number, f: number) => number;
    readonly wasmwhatsappclient_updateBlockStatus: (a: number, b: number, c: number, d: number) => number;
    readonly wasmwhatsappclient_updateDefaultDisappearingMode: (a: number, b: number) => number;
    readonly wasmwhatsappclient_updateMemberLabel: (a: number, b: number, c: number, d: number, e: number) => number;
    readonly wasmwhatsappclient_updatePrivacySetting: (a: number, b: number, c: number, d: number, e: number) => number;
    readonly wasmwhatsappclient_updateProfilePicture: (a: number, b: number, c: number) => number;
    readonly wasmwhatsappclient_updateProfileStatus: (a: number, b: number, c: number) => number;
    readonly wasmwhatsappclient_uploadEncryptedMediaStream: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => number;
    readonly wasmwhatsappclient_uploadMedia: (a: number, b: number, c: number, d: number) => number;
    readonly wasmwhatsappclient_votePoll: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number) => number;
    readonly getWasmMemoryBytes: () => number;
    readonly __wbg_intounderlyingbytesource_free: (a: number, b: number) => void;
    readonly __wbg_intounderlyingsink_free: (a: number, b: number) => void;
    readonly __wbg_intounderlyingsource_free: (a: number, b: number) => void;
    readonly intounderlyingbytesource_autoAllocateChunkSize: (a: number) => number;
    readonly intounderlyingbytesource_cancel: (a: number) => void;
    readonly intounderlyingbytesource_pull: (a: number, b: number) => number;
    readonly intounderlyingbytesource_start: (a: number, b: number) => void;
    readonly intounderlyingbytesource_type: (a: number) => number;
    readonly intounderlyingsink_abort: (a: number, b: number) => number;
    readonly intounderlyingsink_close: (a: number) => number;
    readonly intounderlyingsink_write: (a: number, b: number) => number;
    readonly intounderlyingsource_cancel: (a: number) => void;
    readonly intounderlyingsource_pull: (a: number, b: number) => number;
    readonly __wasm_bindgen_func_elem_20591: (a: number, b: number, c: number, d: number) => void;
    readonly __wasm_bindgen_func_elem_20593: (a: number, b: number, c: number, d: number) => void;
    readonly __wasm_bindgen_func_elem_6706: (a: number, b: number, c: number) => void;
    readonly __wasm_bindgen_func_elem_2634: (a: number, b: number, c: number) => void;
    readonly __wasm_bindgen_func_elem_2633: (a: number, b: number) => void;
    readonly __wbindgen_export: (a: number, b: number) => number;
    readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
    readonly __wbindgen_export3: (a: number) => void;
    readonly __wbindgen_export4: (a: number, b: number, c: number) => void;
    readonly __wbindgen_export5: (a: number, b: number) => void;
    readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
}

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>;
