import { Writable } from 'node:stream';
import { DateTimeOptions, DateTime } from 'luxon';
import { AxiosInstance, AxiosError } from 'axios';

/**
 * Log levels in ascending order of severity.
 *
 * Levels allow filtering messages: when a specific level is set,
 * messages of that level and all higher levels will be logged.
 */
declare enum LogLevel {
    /**
     * Detailed debug information for developers.
     * Default level in development environment.
     */
    DEBUG = 0,
    /**
     * Informational messages about normal application operation.
     * Used for tracking business logic.
     */
    INFO = 1,
    /**
     * Important but non-critical events.
     * Examples: successful request processing, configuration changes.
     */
    NOTICE = 2,
    /**
     * Warnings about potential problems.
     * Application continues to run but attention is required.
     */
    WARNING = 3,
    /**
     * Runtime errors requiring intervention.
     * Some functionality is unavailable but the application is running.
     */
    ERROR = 4,
    /**
     * Critical errors disrupting component operation.
     * Require immediate intervention during working hours.
     */
    CRITICAL = 5,
    /**
     * Serious problems requiring immediate resolution.
     * Examples: database unavailable, disk space exhausted.
     */
    ALERT = 6,
    /**
     * System is unusable, requires urgent intervention.
     * Highest severity level.
     */
    EMERGENCY = 7
}
type LogLevelName = keyof typeof LogLevel;
interface LogRecord {
    channel: string;
    level: LogLevel;
    levelName: LogLevelName;
    message: string;
    context: Record<string, any>;
    extra: Record<string, any>;
    timestamp: Date;
}
interface Formatter {
    format(record: LogRecord): any;
}
interface HandlerOptions {
    bubble?: boolean;
    [key: string]: any;
}
interface Handler {
    /**
     * Handles a log record.
     *
     * @param {LogRecord} record - Log record to handle.
     * @returns {boolean}
     */
    handle(record: LogRecord): Promise<boolean>;
    isHandling(level: LogLevel): boolean;
    shouldBubble(): boolean;
    setFormatter(formatter: Formatter): void;
    getFormatter(): Formatter | null;
}
type Processor = (record: LogRecord) => LogRecord;
interface LoggerInterface {
    /**
     * Logs with an arbitrary level.
     */
    log(level: LogLevel, message: string, context?: Record<string, any>): Promise<void>;
    /**
     * Detailed debug information.
     */
    debug(message: string, context?: Record<string, any>): Promise<void>;
    /**
     * Interesting events.
     *
     * Example: User logs in, SQL logs.
     */
    info(message: string, context?: Record<string, any>): Promise<void>;
    /**
     * Normal but significant events.
     */
    notice(message: string, context?: Record<string, any>): Promise<void>;
    /**
     * Exceptional occurrences that are not errors.
     *
     * Example: Use of deprecated APIs, poor use of an API, undesirable things
     *          that are not necessarily wrong.
     */
    warning(message: string, context?: Record<string, any>): Promise<void>;
    /**
     * Runtime errors that do not require immediate action but should typically
     * be logged and monitored.
     */
    error(message: string, context?: Record<string, any>): Promise<void>;
    /**
     * Critical conditions
     *
     * Example: Application component unavailable, unexpected exception
     */
    critical(message: string, context?: Record<string, any>): Promise<void>;
    /**
     * Action must be taken immediately.
     *
     * Example: Entire website down, database unavailable, etc. This should
     *          trigger the SMS alerts and wake you up.
     */
    alert(message: string, context?: Record<string, any>): Promise<void>;
    /**
     * System is unusable.
     */
    emergency(message: string, context?: Record<string, any>): Promise<void>;
}

/**
 * Support date format:
 *  - `YYYY` - Full year (e.g., 2024)
 *  - `YY` - Two-digit year (e.g., 24)
 *  - `MMMM` - Full month name (e.g., "January")
 *  - `MMM` - Abbreviated month name (e.g., "Jan")
 *  - `MM` - Month with leading zero (01-12)
 *  - `M` - Month without leading zero (1-12)
 *  - `DD` - Day of month with leading zero (01-31)
 *  - `D` - Day of month without leading zero (1-31)
 *  - `HH` - Hour (24-hour) with leading zero (00-23)
 *  - `H` - Hour (24-hour) without leading zero (0-23)
 *  - `hh` - Hour (12-hour) with leading zero (00-11)
 *  - `h` - Hour (12-hour) without leading zero (0-11)
 *  - `mm` - Minutes with leading zero (00-59)
 *  - `m` - Minutes without leading zero (0-59)
 *  - `ss` - Seconds with leading zero (00-59)
 *  - `s` - Seconds without leading zero (0-59)
 *  - `SSS` - Milliseconds (000-999)
 *  - `a` - AM/PM lowercase (am/pm)
 *  - `A` - AM/PM uppercase (AM/PM)
 *  - `ZZZ` - Timezone (e.g., UTC)
 *  - `ZZ` - Timezone offset (e.g., +03:00)
 */
declare abstract class AbstractFormatter implements Formatter {
    protected dateFormat: string;
    constructor(dateFormat?: string);
    abstract format(record: LogRecord): string;
    protected _formatTimestamp(date: Date): string;
    protected _formatDate(date: Date): string;
}

/**
 * JsonFormatter
 *
 * @inheritDoc
 */
declare class JsonFormatter extends AbstractFormatter implements Formatter {
    constructor(dateFormat?: string);
    format(record: LogRecord): string;
}

/**
 * LineFormatter
 *
 * @inheritDoc
 */
declare class LineFormatter extends AbstractFormatter implements Formatter {
    protected formatString: string;
    constructor(formatString?: string, dateFormat?: string);
    format(record: LogRecord): string;
}

/**
 * TelegramFormatter
 *
 * Formats a log entry for sending to Telegram.
 * Supports HTML markup with escaped special characters.
 *
 * @link https://core.telegram.org/bots/api#html-style
 */
declare class TelegramFormatter extends AbstractFormatter implements Formatter {
    private useHtml;
    private maxMessageLength;
    constructor(useHtml?: boolean, dateFormat?: string, maxMessageLength?: number);
    format(record: LogRecord): string;
    protected _formatBaseMessage(record: LogRecord): string;
    protected _formatAdditionalInfo(record: LogRecord): string;
    protected _escapeHtml(text: string): string;
    protected _escapeMarkdownV2(text: string): string;
    /**
     * Set the use of HTML markup
     */
    setUseHtml(useHtml: boolean): this;
    /**
     * // Set the maximum message length
     */
    setMaxMessageLength(maxLength: number): this;
}

declare const pidProcessor: Processor;

declare const memoryUsageProcessor: Processor;

/**
 * Abstract Handler
 */
declare abstract class AbstractHandler implements Handler {
    protected level: LogLevel;
    protected formatter: Formatter | null;
    protected bubble: boolean;
    constructor(level?: LogLevel, bubble?: boolean);
    isHandling(level: LogLevel): boolean;
    shouldBubble(): boolean;
    setFormatter(formatter: Formatter): void;
    getFormatter(): Formatter | null;
    /**
     * @inheritDoc
     */
    abstract handle(record: LogRecord): Promise<boolean>;
}

interface ConsoleHandlerOptions extends HandlerOptions {
    useStyles?: boolean;
}
/**
 * Console Handler
 */
declare class ConsoleHandler extends AbstractHandler implements Handler {
    protected _styles: Map<LogLevel, string[]>;
    protected readonly _useStyles: boolean;
    constructor(level?: LogLevel, options?: ConsoleHandlerOptions);
    protected _initStyles(): void;
    /**
     * @inheritDoc
     */
    handle(record: LogRecord): Promise<boolean>;
    protected _getConsoleMethod(level: LogLevel): 'log' | 'info' | 'warn' | 'error' | 'trace';
}

/**
 * Console Handler V2
 */
declare class ConsoleV2Handler extends ConsoleHandler implements Handler {
    constructor(level?: LogLevel, options?: ConsoleHandlerOptions);
    /**
     * @inheritDoc
     */
    handle(record: LogRecord): Promise<boolean>;
}

interface MemoryHandlerOptions extends HandlerOptions {
    limit?: number;
}
/**
 * Memory Handler
 */
declare class MemoryHandler extends AbstractHandler implements Handler {
    private records;
    private readonly limit;
    constructor(level?: LogLevel, options?: MemoryHandlerOptions);
    /**
     * @inheritDoc
     */
    handle(record: LogRecord): Promise<boolean>;
    getRecords(): LogRecord[];
    clear(): void;
}

interface StreamHandlerOptions extends HandlerOptions {
    stream: Writable;
}
/**
 * Stream Handler
 *
 * Node.js stream handler for writing logs to streams.
 */
declare class StreamHandler extends AbstractHandler implements Handler {
    /**
     * Stream for writing logs.
     * @private
     */
    private stream;
    /**
     * Creates a StreamHandler instance.
     *
     * @param {LogLevel} level - Minimum log level.
     * @param options
     *     - `stream: Writable` - Stream to write to (e.g., `process.stdout`, `process.stderr`, `fs.WriteStream`)
     *     - `bubble?: boolean` - Determines whether the handler should bubble the record to the next handler.
     */
    constructor(level: LogLevel | undefined, options: StreamHandlerOptions);
    /**
     * @inheritDoc
     */
    handle(record: LogRecord): Promise<boolean>;
    /**
     * Closes the stream (if supported).
     *
     * @returns {Promise<void>}
     */
    close(): Promise<void>;
}

interface ConsolaAdapterOptions extends HandlerOptions {
    consolaInstance: any;
}
/**
 * Adapter for Consola
 *
 * @memo Consola has its own formatter
 * @link https://github.com/unjs/consola
 */
declare class ConsolaAdapter extends AbstractHandler implements Handler {
    private consolaInstance;
    constructor(level: LogLevel | undefined, options: ConsolaAdapterOptions);
    setFormatter(_formatter: Formatter): void;
    getFormatter(): Formatter | null;
    handle(record: LogRecord): Promise<boolean>;
}

interface WinstonAdapterOptions extends HandlerOptions {
    winstonLogger: any;
}
/**
 * Adapter for Winston
 *
 * @memo Winston has its own formatter
 * @link https://github.com/winstonjs/winston
 */
declare class WinstonAdapter extends AbstractHandler implements Handler {
    private winstonLogger;
    constructor(level: LogLevel | undefined, options: WinstonAdapterOptions);
    setFormatter(_formatter: Formatter): void;
    getFormatter(): Formatter | null;
    handle(record: LogRecord): Promise<boolean>;
}

/**
 * Define the environment
 */
declare enum Environment {
    UNKNOWN = "unknown",
    BROWSE = "browser",
    NODE = "node"
}
declare function getEnvironment(): Environment;

interface TelegramHandlerOptions extends HandlerOptions {
    botToken: string;
    chatId: string | number;
    parseMode?: 'HTML' | 'Markdown' | 'MarkdownV2';
    disableNotification?: boolean;
    disableWebPagePreview?: boolean;
    useStyles?: boolean;
    warnInBrowser?: boolean;
}
/**
 * Telegram Handler
 *
 * Sends logs to Telegram chat.
 * The browser displays a warning in the console.
 * In Node.js, sends a message via the Telegram Bot API.
 */
declare class TelegramHandler extends AbstractHandler implements Handler {
    protected botToken: string;
    protected chatId: string | number;
    protected parseMode: 'HTML' | 'Markdown' | 'MarkdownV2';
    protected disableNotification: boolean;
    protected disableWebPagePreview: boolean;
    protected readonly environment: Environment;
    protected warnInBrowser: boolean;
    constructor(level: LogLevel | undefined, options: TelegramHandlerOptions);
    /**
     * @inheritDoc
     */
    handle(record: LogRecord): Promise<boolean>;
    /**
     * Processing in the browser
     */
    protected _handleInBrowser(_message: string, record: LogRecord): Promise<boolean>;
    /**
     * Processing in Node.js
     */
    protected _handleInNode(message: string, _record: LogRecord): Promise<boolean>;
    /**
     * Fallback processing for unknown environments
     */
    protected _handleFallback(message: string): Promise<boolean>;
    updateSettings(options: Partial<TelegramHandlerOptions>): this;
    /**
     * Get current environment
     */
    getEnvironment(): Environment;
    /**
     * Check if the Telegram API is available
     */
    testConnection(): Promise<boolean>;
}

declare abstract class AbstractLogger implements LoggerInterface {
    /**
     * @inheritDoc
     */
    abstract log(_level: LogLevel, _message: string, _context?: Record<string, any>): Promise<void>;
    /**
     * @inheritDoc
     */
    debug(message: string, context?: Record<string, any>): Promise<void>;
    /**
     * @inheritDoc
     */
    info(message: string, context?: Record<string, any>): Promise<void>;
    /**
     * @inheritDoc
     */
    notice(message: string, context?: Record<string, any>): Promise<void>;
    /**
     * @inheritDoc
     */
    warning(message: string, context?: Record<string, any>): Promise<void>;
    /**
     * @inheritDoc
     */
    error(message: string, context: Record<string, any>): Promise<void>;
    /**
     * @inheritDoc
     */
    critical(message: string, context?: Record<string, any>): Promise<void>;
    /**
     * @inheritDoc
     */
    alert(message: string, context?: Record<string, any>): Promise<void>;
    /**
     * @inheritDoc
     */
    emergency(message: string, context?: Record<string, any>): Promise<void>;
}

/**
 * This Logger can be used to avoid conditional log calls.
 *
 * Logging should always be optional, and if no logger is provided to your
 * library creating a NullLogger instance to have something to throw logs at
 * is a good way to avoid littering your code with `if (this.logger) { }`
 * blocks.
 */
declare class NullLogger extends AbstractLogger implements LoggerInterface {
    static create(): NullLogger;
    /**
     * @inheritDoc
     */
    log(_level: LogLevel, _message: string, _context?: Record<string, any>): Promise<void>;
}

/**
 * A logger created according to the principles of `Monolog`
 *
 * @link https://github.com/Seldaek/monolog
 */
declare class Logger extends AbstractLogger implements LoggerInterface {
    private readonly channel;
    private handlers;
    private processors;
    constructor(channel: string);
    static create(channel: string): Logger;
    pushHandler(handler: Handler): this;
    popHandler(): Handler | null;
    setHandlers(handlers: Handler[]): this;
    pushProcessor(processor: Processor): this;
    /**
     * @inheritDoc
     */
    log(level: LogLevel, message: string, context?: Record<string, any>): Promise<void>;
}

declare class LoggerFactory {
    static createNullLogger(): LoggerInterface;
    static createForBrowser(channel: string, isDevMode?: boolean): LoggerInterface;
    static createForBrowserDevelopment(channel: string, level?: LogLevel): LoggerInterface;
    static createForBrowserProduction(channel: string, level?: LogLevel): LoggerInterface;
    static forcedLog(logger: LoggerInterface, action: 'debug' | 'info' | 'notice' | 'warning' | 'error' | 'critical' | 'alert' | 'emergency', message: string, context: Record<string, any>): Promise<void>;
}

/**
 * @deprecate This enum is deprecated and will be removed in version `2.0.0`
 */
declare enum LoggerType {
    desktop = "desktop",
    log = "log",
    info = "info",
    warn = "warn",
    error = "error",
    trace = "trace"
}
/**
 * LoggerBrowser
 *
 * @deprecate This class is deprecated and will be removed in version `2.0.0`
 *   - use {@link Logger `Logger`}
 *
 * @removed 2.0.0
 */
declare class LoggerBrowser implements LoggerInterface {
    #private;
    /**
     * Create a LoggerBrowser instance
     *
     * @deprecated This method is deprecated and will be removed in version `2.0.0`
     *
     * @removed 2.0.0
     */
    static build(title: string, isDevelopment?: boolean): LoggerBrowser;
    private constructor();
    /**
     * Set config
     *
     * @deprecated This method is deprecated and will be removed in version `2.0.0`
     *
     * @removed 2.0.0
     */
    setConfig(_types: Record<string | LoggerType, boolean>): void;
    /**
     * Set enable
     *
     * @deprecated This method is deprecated and will be removed in version `2.0.0`
     *
     * @removed 2.0.0
     */
    enable(_type: LoggerType): boolean;
    /**
     * Set disable
     *
     * @deprecated This method is deprecated and will be removed in version `2.0.0`
     *
     * @removed 2.0.0
     */
    disable(_type: LoggerType): boolean;
    /**
     * Test is enable
     *
     * @deprecated This method is deprecated and will be removed in version `2.0.0`
     *
     * @removed 2.0.0
     */
    isEnabled(_type: LoggerType): boolean;
    desktop(...params: any[]): Promise<void>;
    log(...params: any[]): Promise<void>;
    info(...params: any[]): Promise<void>;
    warn(...params: any[]): Promise<void>;
    error(...params: any[]): Promise<void>;
    trace(...params: any[]): Promise<void>;
    debug(...params: any[]): Promise<void>;
    notice(...params: any[]): Promise<void>;
    warning(...params: any[]): Promise<void>;
    critical(...params: any[]): Promise<void>;
    alert(...params: any[]): Promise<void>;
    emergency(...params: any[]): Promise<void>;
}

/**
 * String which is actually a number, like `'20.23'`
 */
type NumberString = string;
/**
 * Like `'2018-06-07T03:00:00+03:00'`
 */
type ISODate = string;
type BoolString = 'Y' | 'N';
type GenderString = 'M' | 'F' | '';
type PlacementViewMode = 'view' | 'edit';
type TextType = 'text' | 'html';
type Fields = {
    readonly [key: string]: {
        readonly type: string;
        readonly isRequired: boolean;
        readonly isReadOnly: boolean;
        readonly isImmutable: boolean;
        readonly isMultiple: boolean;
        readonly isDynamic: boolean;
        readonly title: string;
        readonly upperName?: string;
    };
};
type MultiField = {
    readonly ID: NumberString;
    readonly VALUE_TYPE: string;
    readonly VALUE: string;
    readonly TYPE_ID: string;
};
type MultiFieldArray = ReadonlyArray<Pick<MultiField, 'VALUE' | 'VALUE_TYPE'>>;
/**
 * Describes the inline settings in UF
 */
type UserFieldType = {
    USER_TYPE_ID: string;
    HANDLER: string;
    TITLE: string;
    DESCRIPTION: string;
    OPTIONS?: {
        height: number;
    };
};
/**
 * Data types
 * @link https://apidocs.bitrix24.ru/api-reference/data-types.html
 * @link https://dev.1c-bitrix.ru/rest_help/crm/dynamic/methodscrmitem/crm_item_fields.php
 */
declare enum DataType {
    undefined = "undefined",
    any = "any",
    integer = "integer",
    boolean = "boolean",
    double = "double",
    date = "date",
    datetime = "datetime",
    string = "string",
    text = "text",
    file = "file",
    array = "array",
    object = "object",
    user = "user",
    location = "location",
    crmCategory = "crm_category",
    crmStatus = "crm_status",
    crmCurrency = "crm_currency"
}

interface BlobLike {
    readonly size: number;
    readonly type: string;
    slice(start?: number, end?: number, contentType?: string): Blob;
}
interface FileLike extends BlobLike {
    name: string;
    lastModified?: number;
    lastModifiedDate?: object;
}
/**
 * The `Type` class is designed to check and determine data types
 *
 * @see bitrix/js/main/core/src/lib/type.js
 */
declare class TypeManager {
    getTag(value: any): string;
    /**
     * Checks that value is string
     * @param value
     * @return {boolean}
     *
     * @memo get from pull.client.Utils
     */
    isString(value: any): value is string;
    /**
     * Returns true if a value is not an empty string
     * @param value
     * @returns {boolean} Returns true if a value is not an empty string
     */
    isStringFilled(value: any): value is string;
    /**
     * Checks that value is function
     * @param value
     * @return {boolean}
     *
     * @memo get from pull.client.Utils
     */
    isFunction(value: any): value is Function;
    /**
     * Checks that value is an object
     * @param value
     * @return {boolean}
     */
    isObject(value: any): value is object | Function;
    /**
     * Checks that value is object like
     * @param value
     * @return {boolean}
     */
    isObjectLike<T>(value: any): value is T;
    /**
     * Checks that value is plain object
     * @param value
     * @return {boolean}
     */
    isPlainObject(value: any): value is Record<string | number, any>;
    isJsonRpcRequest(value: any): boolean;
    isJsonRpcResponse(value: any): boolean;
    /**
     * Checks that value is boolean
     * @param value
     * @return {boolean}
     */
    isBoolean(value: any): value is boolean;
    /**
     * Checks that value is number
     * @param value
     * @return {boolean}
     */
    isNumber(value: any): value is number;
    /**
     * Checks that value is integer
     * @param value
     * @return {boolean}
     */
    isInteger(value: any): value is number;
    /**
     * Checks that value is float
     * @param value
     * @return {boolean}
     */
    isFloat(value: any): value is number;
    /**
     * Checks that value is nil
     * @param value
     * @return {boolean}
     */
    isNil(value: any): value is null | undefined;
    /**
     * Checks that value is an array
     * @param value
     * @return {boolean}
     */
    isArray(value: any): value is any[];
    /**
     * Returns true if a value is an array, and it has at least one element
     * @param value
     * @returns {boolean} Returns true if a value is an array, and it has at least one element
     */
    isArrayFilled(value: any): value is any[];
    /**
     * Checks that value is array like
     * @param value
     * @return {boolean}
     */
    isArrayLike(value: any): value is ArrayLike<any>;
    /**
     * Checks that value is Date
     * @param value
     * @return {boolean}
     */
    isDate(value: any): value is Date;
    /**
     * Checks that is a DOM node
     * @param value
     * @return {boolean}
     */
    isDomNode(value: any): value is Node;
    /**
     * Checks that value is element node
     * @param value
     * @return {boolean}
     */
    isElementNode(value: any): value is HTMLElement;
    /**
     * Checks that value is a text node
     * @param value
     * @return {boolean}
     */
    isTextNode(value: any): value is Text;
    /**
     * Checks that value is Map
     * @param value
     * @return {boolean}
     */
    isMap(value: any): value is Map<unknown, unknown>;
    /**
     * Checks that value is Set
     * @param value
     * @return {boolean}
     */
    isSet(value: any): value is Set<unknown>;
    /**
     * Checks that value is WeakMap
     * @param value
     * @return {boolean}
     */
    isWeakMap(value: any): value is WeakMap<object, unknown>;
    /**
     * Checks that value is WeakSet
     * @param value
     * @return {boolean}
     */
    isWeakSet(value: any): value is WeakSet<object>;
    /**
     * Checks that value is prototype
     * @param value
     * @return {boolean}
     */
    isPrototype(value: any): value is object;
    /**
     * Checks that value is regexp
     * @param value
     * @return {boolean}
     */
    isRegExp(value: any): value is RegExp;
    /**
     * Checks that value is null
     * @param value
     * @return {boolean}
     */
    isNull(value: any): value is null;
    /**
     * Checks that value is undefined
     * @param value
     * @return {boolean}
     */
    isUndefined(value: any): value is undefined;
    /**
     * Checks that value is ArrayBuffer
     * @param value
     * @return {boolean}
     */
    isArrayBuffer(value: any): value is ArrayBuffer;
    /**
     * Checks that value is typed array
     * @param value
     * @return {boolean}
     */
    isTypedArray(value: any): value is Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array;
    /**
     * Checks that value is Blob
     * @param value
     * @return {boolean}
     */
    isBlob(value: any): value is BlobLike;
    /**
     * Checks that value is File
     * @param value
     * @return {boolean}
     */
    isFile(value: any): value is FileLike;
    /**
     * Checks that value is FormData
     * @param value
     * @return {boolean}
     */
    isFormData(value: any): value is FormData;
    clone(obj: any, bCopyObj?: boolean): any;
}
declare const Type: TypeManager;

/**
 * @todo add docs
 */
declare function pick<Data extends object, Keys extends keyof Data>(data: Data, keys: Keys[]): Pick<Data, Keys>;
/**
 * @todo add docs
 */
declare function omit<Data extends object, Keys extends keyof Data>(data: Data, keys: Keys[]): Omit<Data, Keys>;
/**
 * @todo add docs
 */
declare function isArrayOfArray<A>(item: A[] | A[][]): item is A[][];
/**
 * @todo add docs
 *
 * @example
 * const result = getEnumValue(EnumBizprocDocumentType, 'CCrmDocumentSmartOrder')
 */
declare function getEnumValue<T extends Record<string, string | number>>(enumObj: T, value: string | number): T[keyof T] | undefined;

/**
 * The `Text` class provides a set of utility methods for working with text data.
 * It includes functions for encoding and decoding HTML entities, generating random strings,
 * converting values to different data types, and changing the case and format of strings
 *
 * @see bitrix/js/main/core/src/lib/text.js
 */
declare class TextManager {
    getRandom(length?: number): string;
    /**
     * Generates UUID
     */
    getUniqId(): string;
    /**
     * Generate uuid v7
     * @return {string}
     */
    getUuidRfc4122(): string;
    /**
     * Encodes all unsafe entities
     * @param {string} value
     * @return {string}
     */
    encode(value: string): string;
    /**
     * Decodes all encoded entities
     * @param {string} value
     * @return {string}
     */
    decode(value: string): string;
    toNumber(value: any): number;
    toInteger(value: any): number;
    toBoolean(value: any, trueValues?: string[]): boolean;
    toCamelCase(str: string): string;
    toPascalCase(str: string): string;
    toKebabCase(str: string): string;
    capitalize(str: string): string;
    numberFormat(number: number, decimals?: number, decPoint?: string, thousandsSep?: string): string;
    /**
     * Convert string to DateTime from ISO 8601 or self template
     *
     * @param {string} dateString
     * @param {string} template
     * @param opts
     * @returns {DateTime} Convert string to DateTime from ISO 8601 or self template
     *
     * @link https://moment.github.io/luxon/#/parsing?id=parsing-technical-formats
     */
    toDateTime(dateString: string, template?: string, opts?: DateTimeOptions): DateTime;
    /**
     * Convert Date to Bitrix24 REST API FORMAT Y-m-d\TH:i:sP
     * @param date
     */
    toB24Format(date: string | DateTime | Date): string;
    getDateForLog(): string;
    buildQueryString(params: any): string;
}
declare const Text$1: TextManager;

/**
 * @see bitrix/js/main/core/src/lib/browser.js
 */
declare class BrowserManager {
    isOpera(): boolean;
    isIE(): boolean;
    isIE6(): boolean;
    isIE7(): boolean;
    isIE8(): boolean;
    isIE9(): boolean;
    isIE10(): boolean;
    isSafari(): boolean;
    isFirefox(): boolean;
    isChrome(): boolean;
    detectIEVersion(): number;
    isIE11(): boolean;
    isMac(): boolean;
    isWin(): boolean;
    isLinux(): boolean;
    isAndroid(): boolean;
    isIPad(): boolean;
    isIPhone(): boolean;
    isIOS(): boolean;
    isMobile(): boolean;
    isRetina(): boolean;
    isTouchDevice(): boolean;
    isDoctype(target: any): boolean;
    isLocalStorageSupported(): boolean;
    detectAndroidVersion(): number;
}
declare const Browser: BrowserManager;

/**
 * Interface defining the structure and methods of a Result object.
 */
interface IResult<T = any> {
    /**
     * Indicates whether the operation resulted in success (no errors).
     */
    readonly isSuccess: boolean;
    /**
     * Collection of errors
     */
    readonly errors: Map<string, Error>;
    /**
     * Sets the data associated with the result.
     *
     * @param data The data to be stored in the result.
     * @returns The current Result object for chaining methods.
     */
    setData: (data: T) => IResult<T>;
    /**
     * Retrieves the data associated with the result.
     *
     * @returns The data stored in the result, if any.
     */
    getData: () => T | null | undefined;
    /**
     * Adds an error message or Error object to the result.
     * @param error The error message or Error object to be added.
     * @param key Error key. You can leave it blank. Then it will be generated automatically.
     * @returns {IResult} The current Result object for chaining methods.
     */
    addError: (error: Error | string, key?: string) => IResult;
    /**
     * Adds multiple errors to the result in a single call.
     *
     * @param errors An array of errors or strings that will be converted to errors.
     * @returns {IResult} The current Result object for chaining methods.
     */
    addErrors: (errors: (Error | string)[]) => IResult;
    /**
     * Retrieves an iterator for the errors collected in the result.
     *
     * @returns {IterableIterator<Error>} An iterator over the stored Error objects.
     */
    getErrors: () => IterableIterator<Error>;
    /**
     * Retrieves an array of error messages from the collected errors.
     *
     * @returns {string[]} An array of strings representing the error messages.
     */
    getErrorMessages: () => string[];
    /**
     * Checks for an error in a collection by key
     * @param key - Error key
     */
    hasError(key: string): boolean;
    /**
     * Converts the Result object to a string.
     *
     * @returns {string} Returns a string representation of the result operation
     */
    toString: () => string;
}
/**
 * A class representing an operation result with success/failure status, data, and errors.
 * Similar to \Bitrix\Main\Result from Bitrix Framework.
 * @link https://dev.1c-bitrix.ru/api_d7/bitrix/main/result/index.php
 */
declare class Result<T = any> implements IResult<T> {
    protected _errors: Map<string, Error>;
    protected _data: T | null | undefined;
    constructor(data?: T);
    get isSuccess(): boolean;
    get errors(): Map<string, Error>;
    setData(data: T | null | undefined): Result<T>;
    getData(): T | null | undefined;
    addError(error: Error | string, key?: string): Result<T>;
    addErrors(errors: (Error | string)[]): Result<T>;
    getErrors(): IterableIterator<Error>;
    hasError(key: string): boolean;
    /**
     * Retrieves an array of error messages from the collected errors.
     *
     * @returns An array of strings representing the error messages. Each string
     *          contains the message of a corresponding error object.
     */
    getErrorMessages(): string[];
    /**
     * Converts the Result object to a string.
     *
     * @returns {string} Returns a string representation of the result operation
     */
    toString(): string;
    private safeStringify;
    private replacer;
    static ok<U>(data?: U): Result<U>;
    static fail<U>(error: Error | string, key?: string): Result<U>;
}

/**
 * Special cases of data passed to handlers
 * @todo add docs
 */
interface HandlerAuthParams {
    access_token: string;
    expires: string;
    expires_in: string;
    scope: string;
    domain: string;
    server_endpoint: string;
    status: string;
    client_endpoint: string;
    member_id: string;
    user_id: string;
    refresh_token: string;
    application_token: string;
}
type PayloadOAuthToken = Pick<HandlerAuthParams, 'access_token' | 'refresh_token' | 'expires' | 'expires_in' | 'client_endpoint' | 'server_endpoint' | 'member_id' | 'status' | 'user_id'>;

declare enum LoadDataType {
    App = "app",
    Profile = "profile",
    Currency = "currency",
    AppOptions = "appOptions",
    UserOptions = "userOptions"
}
type TypeUser = {
    readonly isAdmin: boolean;
    readonly id: null | number;
    readonly lastName: null | string;
    readonly name: null | string;
    readonly gender: GenderString;
    readonly photo: null | string;
    readonly TimeZone: null | string;
    readonly TimeZoneOffset: null | number;
};
declare const EnumAppStatus: {
    readonly Free: "F";
    readonly Demo: "D";
    readonly Trial: "T";
    readonly Paid: "P";
    readonly Local: "L";
    readonly Subscription: "S";
};
declare const StatusDescriptions: Record<(typeof EnumAppStatus)[keyof typeof EnumAppStatus], string>;
type TypeEnumAppStatus = keyof typeof EnumAppStatus;
/**
 * @link https://dev.1c-bitrix.ru/rest_help/general/app_info.php
 */
type TypeApp = {
    /**
     * Local application identifier on the portal
     */
    readonly id: number;
    /**
     * application code
     */
    readonly code: string;
    /**
     * installed version of the application
     */
    readonly version: number;
    /**
     * application status
     */
    readonly status: TypeEnumAppStatus;
    /**
     * application installed flag
     */
    readonly isInstalled: boolean;
};
/**
 * @link https://dev.1c-bitrix.ru/rest_help/general/app_info.php
 */
type TypePayment = {
    /**
     * flag indicating whether the paid period or trial period has expired
     */
    readonly isExpired: boolean;
    /**
     * number of days remaining until the end of the paid period or trial period
     */
    readonly days: number;
};
/**
 * @link https://dev.1c-bitrix.ru/rest_help/general/app_info.php
 */
type TypeLicense = {
    /**
     * language code designation
     */
    readonly languageId: null | string;
    /**
     * tariff designation with indication of the region as a prefix
     */
    readonly license: null | string;
    /**
     * internal tariff designation without indication of region
     */
    readonly licenseType: null | string;
    /**
     * past meaning of license
     */
    readonly licensePrevious: null | string;
    /**
     * Tariff designation without specifying the region.
     */
    readonly licenseFamily: null | string;
    /**
     * flag indicating whether it is a box (true) or a cloud (false)
     */
    readonly isSelfHosted: boolean;
};
declare const TypeSpecificUrl: {
    readonly MainSettings: "MainSettings";
    readonly UfList: "UfList";
    readonly UfPage: "UfPage";
};
type TypeB24Form = {
    readonly app_code: string;
    readonly app_status: string;
    readonly payment_expired: BoolString;
    readonly days: number;
    /**
     * B24 tariff plan identifier (if cloud)
     */
    readonly b24_plan: string;
    readonly c_name: string;
    readonly c_last_name: string;
    readonly hostname: string;
};
type CurrencyFormat = {
    decimals: number;
    decPoint: string;
    formatString: string;
    fullName: string;
    isHideZero: boolean;
    thousandsSep?: string;
    thousandsVariant?: 'N' | 'D' | 'C' | 'S' | 'B' | 'OWN' | string;
};
type Currency = {
    amount: number;
    amountCnt: number;
    isBase: boolean;
    currencyCode: string;
    dateUpdate: DateTime;
    decimals: number;
    decPoint: string;
    formatString: string;
    fullName: string;
    lid: string;
    sort: number;
    thousandsSep?: string;
    lang: Record<string, CurrencyFormat>;
};
declare enum TypeOption {
    NotSet = "notSet",
    JsonArray = "jsonArray",
    JsonObject = "jsonObject",
    FloatVal = "float",
    IntegerVal = "integer",
    BoolYN = "boolYN",
    StringVal = "string"
}

/**
 * @todo docs
 */
/**
 * Settings for operating limiting
 */
interface OperatingLimitConfig {
    /**
     * Operating limit time period in milliseconds
     * Default: 10 minutes (600_000 ms)
     */
    windowMs: number;
    /**
     * Maximum total execution time (operating) in milliseconds
     * Default: 480 seconds (480_000 ms)
     * When calculating the operating limit, we will use 5 seconds less
     * @see Http.getTimeToFree
     */
    limitMs: number;
    /**
     * Threshold for notifications about heavy queries (%)
     */
    heavyPercent: number;
}
/**
 * Adaptive pause settings
 */
interface AdaptiveConfig {
    /**
     * Threshold for heavy queries (%)
     * Default: 80% - this means that `operating >= 384`
     * Specifies what % of `operatingLimit.limitMs` in `operating` should pause.
     */
    thresholdPercent: number;
    /**
     * Pause multiplier
     * Default: 0.01 - 0.002 will result in a 1.2-second pause with increasing load
     * If: operating_reset_at > Date.now()
     * Then: Pause = (operating_reset_at - Date.now()) * coefficient
     * Otherwise: Pause = 7_000
     * There's no point in specifying a value close to 1, as this will create unnecessary delays.
     * In other words: if coefficient === 1, the pause will last until the blocking is unblocked, and our code hasn't yet reached the limits.
     * It's important to understand that the goal of adaptive blocking is to smoothly reduce the 'operating' of heavy queries.
     */
    coefficient: number;
    /**
     * Maximum pause (ms)
     * Default: 7_000 ms
     * Limits the maximum estimated pause time
     */
    maxDelay: number;
    /**
     * Whether adaptive pause is enabled
     * Default: true
     */
    enabled: boolean;
}
/**
 * Rate limiting settings (Leaky Bucket)
 */
interface RateLimitConfig {
    /**
     * X - limit before blocking (bucket capacity)
     * For standard plans: 50
     * For Enterprise: 250
     */
    burstLimit: number;
    /**
     * Y - leak rate (requests per second)
     * For standard plans: 2
     * For Enterprise: 5
     */
    drainRate: number;
    /**
     * Whether adaptive control is enabled
     * Default: true
     */
    adaptiveEnabled: boolean;
}
/**
 * Parameters for managing all types of restrictions
 */
interface RestrictionParams {
    rateLimit?: RateLimitConfig;
    operatingLimit?: OperatingLimitConfig;
    adaptiveConfig?: AdaptiveConfig;
    /**
     * Maximum number of retries
     * Default: 3
     */
    maxRetries?: number;
    /**
     * Base delay between retries (ms)
     * Default: 1_000
     */
    retryDelay?: number;
}
/**
 * Limiter operation statistics
 */
interface RestrictionManagerStats {
    /** Retries */
    retries: number;
    /** Consecutive errors */
    consecutiveErrors: number;
    /** Limit hits */
    limitHits: number;
    /** Current number of tokens */
    tokens: number;
    /** Adaptive delays */
    adaptiveDelays: number;
    /** Total time of adaptive delays */
    totalAdaptiveDelay: number;
    /** Heavy requests */
    heavyRequestCount: number;
    /** Method statistics in seconds */
    operatingStats: {
        [method: string]: number;
    };
}
interface ILimiter {
    getTitle(): string;
    setConfig(config: any): Promise<void>;
    setLogger(logger: LoggerInterface): void;
    getLogger(): LoggerInterface;
    canProceed(requestId: string, method: string, params?: any): Promise<boolean>;
    waitIfNeeded(requestId: string, method: string, params?: any): Promise<number>;
    updateStats(requestId: string, method: string, data: any): Promise<void>;
    reset(): Promise<void>;
    getStats(): Record<string, any>;
}

/**
 * Abstract Class for working with actions
 */
type ActionOptions = {
    [key: string]: any;
};
declare abstract class AbstractAction {
    protected _b24: TypeB24;
    protected _logger: LoggerInterface;
    constructor(b24: TypeB24, logger: LoggerInterface);
    abstract make(options?: ActionOptions): AsyncGenerator | Promise<unknown>;
}

type ActionCallV2 = ActionOptions & {
    method: string;
    params?: TypeCallParams;
    requestId?: string;
};
/**
 * Calls the Bitrix24 REST API method `restApi:v2`
 *
 * @todo add docs
 */
declare class CallV2 extends AbstractAction {
    /**
     * Calls the Bitrix24 REST API method.
     *
     * @template T - The expected data type in the response (default is `unknown`).
     *
     * @param {ActionCallV2} options - parameters for executing the request.
     *     - `method: string` - REST API method name (eg: `crm.item.get`)
     *     - `params?: TypeCallParams` - Parameters for calling the method.
     *     - `requestId?: string` - Unique request identifier for tracking. Used for query deduplication and debugging.
     *
     * @returns {Promise<AjaxResult<T>>} A promise that resolves to the result of an REST API call.
     *
     * @example
     * import { EnumCrmEntityTypeId } from '@bitrix24/b24jssdk'
     *
     * interface CrmItem { id: number, name: string, lastName: string }
     * const response = await b24.actions.v2.call.make<{ item: CrmItem }>({
     *   method: 'crm.item.get',
     *   params: {
     *     entityTypeId: EnumCrmEntityTypeId.contact,
     *     id: 123
     *   },
     *   requestId: 'item-123'
     * })
     * if (!response.isSuccess) {
     *   throw new Error(`Problem: ${response.getErrorMessages().join('; ')}`)
     * }
     * console.log(response.getData().result.item.name)
     */
    make<T = unknown>(options: ActionCallV2): Promise<AjaxResult<T>>;
}

type ActionCallListV2 = ActionOptions & {
    method: string;
    params?: Omit<TypeCallParams, 'start'>;
    idKey?: string;
    customKeyForResult?: string;
    requestId?: string;
};
/**
 * Fast data retrieval without counting the total number of records. `restApi:v2`
 *
 * @todo add docs
 */
declare class CallListV2 extends AbstractAction {
    /**
     * Fast data retrieval without counting the total number of records.
     *
     * @template T - The type of the elements of the returned array (default is `unknown`).
     *
     * @param {ActionCallListV2} options - parameters for executing the request.
     *     - `method: string` - The name of the REST API method that returns a list of data (for example: `crm.item.list`, `tasks.task.list`)
     *     - `params?: Omit<TypeCallParams, 'start'>` - Request parameters, excluding the `start` parameter,
     *         since the method is designed to obtain all data in one call.
     *         Note: Use `filter`, `order`, and `select` to control the selection.
     *     - `idKey?: string` - The name of the field containing the unique identifier of the element.
     *         Default is 'ID' (uppercase). Alternatively, it can be 'id' (lowercase).
     *         or another field, depending on the REST API data structure.
     *     - `customKeyForResult?: string` - A custom key indicating that the response REST API will be
     *        grouped by this field.
     *        Example: `items` to group a list of CRM items.
     *    - `requestId?: string` - Unique request identifier for tracking. Used for query deduplication and debugging.
     *
     * @returns {Promise<Result<T[]>>} A promise that resolves to the result of an REST API call.
     *
     * @example
     * import { EnumCrmEntityTypeId, Text } from '@bitrix24/b24jssdk'
     *
     * interface CrmItem { id: number, title: string }
     * const sixMonthAgo = new Date()
     * sixMonthAgo.setMonth((new Date()).getMonth() - 6)
     * sixMonthAgo.setHours(0, 0, 0)
     * const response = await b24.actions.v2.callList.make<CrmItem>({
     *   method: 'crm.item.list',
     *   params: {
     *     entityTypeId:  EnumCrmEntityTypeId.company,
     *     filter: {
     *       '=%title': 'A%',
     *       '>=createdTime': Text.toB24Format(sixMonthAgo) // created at least 6 months ago
     *     },
     *     select: ['id', 'title']
     *   },
     *   idKey: 'id',
     *   customKeyForResult: 'items',
     *   requestId: 'list-123'
     * })
     * if (!response.isSuccess) {
     *   throw new Error(`Problem: ${response.getErrorMessages().join('; ')}`)
     * }
     * const list = response.getData()
     * console.log(`Result: ${list?.length}`) // Number of items received
     */
    make<T = unknown>(options: ActionCallListV2): Promise<Result<T[]>>;
}

type ActionFetchListV2 = ActionOptions & {
    method: string;
    params?: Omit<TypeCallParams, 'start'>;
    idKey?: string;
    customKeyForResult?: string;
    requestId?: string;
};
/**
 * Calls a REST API list method and returns an async generator for efficient large data retrieval. `restApi:v2`
 *
 * @todo add docs
 */
declare class FetchListV2 extends AbstractAction {
    /**
     * Calls a REST API list method and returns an async generator for efficient large data retrieval.
     * Implements the fast algorithm for iterating over large datasets without loading all data into memory at once.
     *
     * @template T - The type of items in the returned arrays (default is `unknown`).
     *
     * @param {ActionFetchListV2} options - parameters for executing the request.
     *     - `method: string` - The name of the REST API method that returns a list of data (for example: `crm.item.list`, `tasks.task.list`)
     *     - `params?: Omit<TypeCallParams, 'start'>` - Request parameters, excluding the `start` parameter,
     *         since the method is designed to obtain all data in one call.
     *         Note: Use `filter`, `order`, and `select` to control the selection.
     *     - `idKey?: string` - The name of the field containing the unique identifier of the element.
     *         Default is 'ID' (uppercase). Alternatively, it can be 'id' (lowercase).
     *         or another field, depending on the REST API data structure.
     *     - `customKeyForResult?: string` - A custom key indicating that the response REST API will be
     *        grouped by this field.
     *        Example: `items` to group a list of CRM items.
     *    - `requestId?: string` - Unique request identifier for tracking. Used for query deduplication and debugging.
     *
     * @returns {AsyncGenerator<T[]>} An async generator that yields chunks of data as arrays of type `T`.
     *     Each iteration returns the next page/batch of results until all data is fetched.
     *
     * @example
     * import { EnumCrmEntityTypeId, Text } from '@bitrix24/b24jssdk'
     *
     * interface CrmItem { id: number, title: string }
     * const sixMonthAgo = new Date()
     * sixMonthAgo.setMonth((new Date()).getMonth() - 6)
     * sixMonthAgo.setHours(0, 0, 0)
     * const generator = b24.actions.v2.fetchList.make<CrmItem>({
     *   method: 'crm.item.list',
     *   params: {
     *     entityTypeId: EnumCrmEntityTypeId.company,
     *     filter: {
     *       '=%title': 'A%',
     *       '>=createdTime': Text.toB24Format(sixMonthAgo) // created at least 6 months ago
     *     },
     *     select: ['id', 'title']
     *   },
     *   idKey: 'id',
     *   customKeyForResult: 'items',
     *   requestId: 'list-123'
     * })
     *
     * for await (const chunk of generator) {
     *   // Process chunk (e.g., save to database, analyze, etc.)
     *   console.log(`Processing ${chunk.length} items`)
     * }
     *
     * @see {@link https://apidocs.bitrix24.com/settings/performance/huge-data.html Bitrix24: Fast algorithm for large data}
     */
    make<T = unknown>(options: ActionFetchListV2): AsyncGenerator<T[]>;
}

declare abstract class AbstractBatch extends AbstractAction {
    protected _addBatchErrorsIfAny(response: Result<ICallBatchResult<any>>, result: Result): void;
    protected _processBatchResponse<T>(response: Result<ICallBatchResult<T>>, calls: BatchCommandsArrayUniversal | BatchCommandsObjectUniversal | BatchNamedCommandsUniversal, options: IB24BatchOptions): CallBatchResult<T>;
    protected _createBatchResultWithAjax<T>(response: Result<ICallBatchResult<T>>, isArrayCall: boolean): CallBatchResult<T>;
    protected _createBatchArrayResult<T>(response: Result<ICallBatchResult<T>>): Result<AjaxResult<T>[]>;
    protected _createBatchObjectResult<T>(response: Result<ICallBatchResult<T>>): Result<Record<string | number, AjaxResult<T>>>;
    protected _createBatchResultSimple<T>(response: Result<ICallBatchResult<T>>, isArrayCall: boolean): CallBatchResult<T>;
    protected _extractBatchSimpleData<T>(response: Result<ICallBatchResult<T>>, isArrayCall: boolean): T;
    chunkArray<T = unknown>(array: Array<T>, chunkSize?: number): T[][];
}

type ActionBatchV2 = ActionOptions & {
    calls: BatchCommandsArrayUniversal | BatchCommandsObjectUniversal | BatchNamedCommandsUniversal;
    options?: IB24BatchOptions;
};
/**
 * Executes a batch request to the Bitrix24 REST API with a maximum number of commands of no more than 50. `restApi:v2`
 * Allows you to execute multiple requests in a single API call, significantly improving performance.
 *
 * @todo add docs
 */
declare class BatchV2 extends AbstractBatch {
    /**
     * Executes a batch request to the Bitrix24 REST API with a maximum number of commands of no more than 50.
     * Allows you to execute multiple requests in a single API call, significantly improving performance.
     *
     * @template T - The data type returned by batch query commands (default is `unknown`)
     *
     * @param {ActionBatchV2} options - parameters for executing the request.
     *     - `calls: BatchCommandsArrayUniversal | BatchCommandsObjectUniversal | BatchNamedCommandsUniversal` - Commands to execute in a batch.
     *        Supports several formats:
     *        1. Array of tuples: `[['method1', params1], ['method2', params2], ...]`
     *        2. Array of objects: `[{ method: 'method1', params: params1 }, { method: 'method2', params: params2 }, ...]`
     *        3. An object with named commands: `{ cmd1: { method: 'method1', params: params1 }, cmd2: ['method2', params2], ...}`
     *     - `options?: IB24BatchOptions` - Additional options for executing a batch request.
     *        - `isHaltOnError?: boolean` - Whether to stop execution on the first error (default: true)
     *        - `requestId?: string` - Unique request identifier for tracking. Used for query deduplication and debugging (default: undefined)
     *        - `returnAjaxResult?: boolean` - Whether to return an AjaxResult object instead of data (default: false)
     *
     * @returns {Promise<CallBatchResult<T>>} A promise that is resolved by the result of executing a batch request:
     *     - On success: a `Result` object with the command execution results
     *     - The structure of the results depends on the format of the `calls` input data:
     *          - For an array of commands, an array of results in the same order
     *          - For named commands, an object with keys corresponding to the command names
     *
     * @example
     * import { EnumCrmEntityTypeId } from '@bitrix24/b24jssdk'
     *
     * interface Contact { id: number, name: string }
     * const response = await b24.actions.v2.batch.make<{ item: Contact }>({
     *   calls: [
     *     ['crm.item.get', { entityTypeId: EnumCrmEntityTypeId.contact, id: 1 }],
     *     ['crm.item.get', { entityTypeId: EnumCrmEntityTypeId.contact, id: 2 }],
     *     ['crm.item.get', { entityTypeId: EnumCrmEntityTypeId.contact, id: 3 }]
     *   ],
     *   options: {
     *     isHaltOnError: true,
     *     returnAjaxResult: true,
     *     requestId: 'batch-123'
     *   }
     * })
     * if (!response.isSuccess) {
     *   throw new Error(`Problem: ${response.getErrorMessages().join('; ')}`)
     * }
     *
     * const resultData = (response as Result<AjaxResult<{ item: Contact }>[]>).getData()
     * resultData.forEach((resultRow, index) => {
     *   if (resultRow.isSuccess) {
     *    console.log(`Item ${index + 1}:`, resultRow.getData().result.item)
     *   }
     * })
     *
     * @example
     * import { EnumCrmEntityTypeId } from '@bitrix24/b24jssdk'
     *
     * const response = await b24.actions.v2.batch.make({
     *   calls: [
     *     { method: 'crm.item.get', params: { entityTypeId: EnumCrmEntityTypeId.contact, id: 1 } },
     *     { method: 'crm.item.get', params: { entityTypeId: EnumCrmEntityTypeId.contact, id: 2 } }
     *   ],
     *   options: {
     *     isHaltOnError: true,
     *     returnAjaxResult: true,
     *     requestId: 'batch-123'
     *   }
     * })
     * if (!response.isSuccess) {
     *   throw new Error(`Problem: ${response.getErrorMessages().join('; ')}`)
     * }
     *
     * @example
     * import { EnumCrmEntityTypeId } from '@bitrix24/b24jssdk'
     *
     * interface Contact { id: number, name: string }
     * interface Deal { id: number, title: string }
     * const response = await b24.actions.v2.batch.make<{ item: Contact } | { item: Deal }>({
     *   calls: {
     *     Contact: { method: 'crm.item.get', params: { entityTypeId: EnumCrmEntityTypeId.contact, id: 1 } },
     *     Deal: ['crm.item.get', { entityTypeId: EnumCrmEntityTypeId.deal, id: 2 }]
     *   },
     *   options: {
     *     isHaltOnError: true,
     *     returnAjaxResult: true,
     *     requestId: 'batch-123'
     *   }
     * })
     * if (!response.isSuccess) {
     *   throw new Error(`Problem: ${response.getErrorMessages().join('; ')}`)
     * }
     *
     * const results = response.getData() as Record<string, AjaxResult<{ item: Contact } | { item: Deal }>>
     * console.log('Contact:', results.Contact.getData().result.item as Contact)
     * console.log('Deal:', results.Deal.getData().result.item as Deal)
     *
     * @warning The maximum number of commands in one batch request is 50.
     * @note A batch request executes faster than sequential single calls,
     *     but if one command fails, the entire batch may fail
     *     (depending on API settings and options).
     */
    make<T = unknown>(options: ActionBatchV2): Promise<CallBatchResult<T>>;
}

type ActionBatchByChunkV2 = ActionOptions & {
    calls: BatchCommandsArrayUniversal | BatchCommandsObjectUniversal;
    options?: Omit<IB24BatchOptions, 'returnAjaxResult'>;
};
/**
 * Executes a batch request with automatic chunking for any number of commands. `restApi:v2`
 *
 * @todo add docs
 */
declare class BatchByChunkV2 extends AbstractBatch {
    /**
     * Executes a batch request with automatic chunking for any number of commands.
     * Unlike `BatchV2`, which is limited to 50 commands, this method automatically splits
     * a large set of commands into multiple batches and executes them sequentially.
     *
     * @template T - The data type returned by commands (default: `unknown`)
     *
     * @param {ActionBatchByChunkV2} options - parameters for executing the request.
     *     - `calls: BatchCommandsArrayUniversal | BatchCommandsObjectUniversal` - Commands to execute in a batch.
     *        Supports several formats:
     *        1. Array of tuples: `[['method1', params1], ['method2', params2], ...]`
     *        2. Array of objects: `[{ method: 'method1', params: params1 }, { method: 'method2', params: params2 }, ...]`
     *        - Note: Named commands are not supported as they are difficult to process when chunking.
     *     - `options?: Omit<IB24BatchOptions, 'returnAjaxResult'>` - Additional options for executing a batch request.
     *        - `isHaltOnError?: boolean` - Whether to stop execution on the first error (default: true)
     *        - `requestId?: string` - Unique request identifier for tracking. Used for query deduplication and debugging (default: undefined)
     *
     * @returns {Promise<Result<T[]>>} A promise that is resolved by the result of executing all commands.
     *
     * @example
     * import { EnumCrmEntityTypeId, Text } from '@bitrix24/b24jssdk'
     *
     * interface Contact { id: number, name: string }
     * const commands = Array.from({ length: 150 }, (_, i) =>
     *   ['crm.item.get', { entityTypeId: EnumCrmEntityTypeId.contact, id: i + 1 }]
     * )
     *
     * const response = await b24.actions.v2.batchByChunk.make<{ item: Contact }>({
     *   calls: commands,
     *   options: {
     *     isHaltOnError: false,
     *     requestId: 'batch-by-chunk-123'
     *   }
     * })
     *
     * if (!response.isSuccess) {
     *   throw new Error(`Problem: ${response.getErrorMessages().join('; ')}`)
     * }
     *
     * const resultData = response.getData()
     * const items: Contact[] = []
     * resultData.forEach((chunkRow) => {
     *   items.push(chunkRow.item)
     * })
     * console.log(`Successfully retrieved ${items.length} items`)
     *
     * @tip For very large command sets, consider using server-side task queues instead of bulk batch requests.
     */
    make<T = unknown>(options: ActionBatchByChunkV2): Promise<Result<T[]>>;
}

/**
 * Some actions for TypeB24 by Api:v2
 */
declare class ActionsManagerV2 {
    protected _b24: TypeB24;
    protected _logger: LoggerInterface;
    protected _mapActions: Map<symbol, AbstractAction>;
    constructor(b24: TypeB24);
    setLogger(logger: LoggerInterface): void;
    getLogger(): LoggerInterface;
    get call(): CallV2;
    get callList(): CallListV2;
    get fetchList(): FetchListV2;
    get batch(): BatchV2;
    get batchByChunk(): BatchByChunkV2;
}

type ActionCallV3 = ActionOptions & {
    method: string;
    params?: TypeCallParams;
    requestId?: string;
};
/**
 * Calls the Bitrix24 REST API method `restApi:v3`
 *
 * @todo add docs
 */
declare class CallV3 extends AbstractAction {
    /**
     * Calls the Bitrix24 REST API method.
     *
     * @template T - The expected data type in the response (default is `unknown`).
     *
     * @param {ActionCallV3} options - parameters for executing the request.
     *     - `method: string` - REST API method name (eg: `crm.item.get`)
     *     - `params?: TypeCallParams` - Parameters for calling the method.
     *     - `requestId?: string` - Unique request identifier for tracking. Used for query deduplication and debugging.
     *
     * @returns {Promise<AjaxResult<T>>} A promise that resolves to the result of an REST API call.
     *
     * @example
     * interface TaskItem { id: number, title: string }
     * const response = await b24.actions.v3.call.make<{ item: TaskItem }>({
     *   method: 'tasks.task.get',
     *   params: { id: 123, select: ['id', 'title'] },
     *   requestId: 'task-123'
     * })
     * if (!response.isSuccess) {
     *   throw new Error(`Problem: ${response.getErrorMessages().join('; ')}`)
     * }
     * console.log(response.getData().result.item.title)
     */
    make<T = unknown>(options: ActionCallV3): Promise<AjaxResult<T>>;
}

type ActionCallListV3 = ActionOptions & {
    method: string;
    params?: Omit<TypeCallParams, 'pagination'>;
    idKey?: string;
    customKeyForResult: string;
    requestId?: string;
    limit?: number;
};
/**
 * Fast data retrieval without counting the total number of records. `restApi:v3`
 *
 * @todo add docs
 */
declare class CallListV3 extends AbstractAction {
    /**
     * Fast data retrieval without counting the total number of records.
     *
     * @template T - The type of the elements of the returned array (default is `unknown`).
     *
     * @param {ActionCallListV3} options - parameters for executing the request.
     *     - `method: string` - The name of the REST API method that returns a list of data (for example: `crm.item.list`, `tasks.task.list`)
     *     - `params?: Omit<TypeCallParams, 'pagination'>` - Request parameters, excluding the `pagination` parameter,
     *         since the method is designed to obtain all data in one call.
     *         Note: Use `filter`, `order`, and `select` to control the selection.
     *     - `idKey?: string` - The name of the field containing the unique identifier of the element.
     *         Default is 'id'. Alternatively, it can be another field, depending on the REST API data structure.
     *     - `customKeyForResult: string` - A custom key indicating that the response REST API will be
     *        grouped by this field.
     *        Example: `items` to group a list of CRM items.
     *    - `requestId?: string` - Unique request identifier for tracking. Used for query deduplication and debugging.
     *    - `limit?: number` - How many records to retrieve at a time. Default is `50`. Maximum is `1000`.
     *
     * @returns {Promise<Result<T[]>>} A promise that resolves to the result of an REST API call.
     *
     * @example
     * import { Text } from '@bitrix24/b24jssdk'
     *
     * interface MainEventLogItem { id: number, userId: number }
     * const sixMonthAgo = new Date()
     * sixMonthAgo.setMonth((new Date()).getMonth() - 6)
     * sixMonthAgo.setHours(0, 0, 0)
     * const response = await b24.actions.v3.callList.make<MainEventLogItem>({
     *   method: 'main.eventlog.list',
     *   params: {
     *     filter: [
     *       ['timestampX', '>=', Text.toB24Format(sixMonthAgo)] // created at least 6 months ago
     *     ],
     *     select: ['id', 'userId']
     *   },
     *   idKey: 'id',
     *   customKeyForResult: 'items',
     *   requestId: 'eventlog-123',
     *   limit: 60
     * })
     * if (!response.isSuccess) {
     *   throw new Error(`Problem: ${response.getErrorMessages().join('; ')}`)
     * }
     * const list = response.getData()
     * console.log(`Result: ${list?.length}`) // Number of items received
     */
    make<T = unknown>(options: ActionCallListV3): Promise<Result<T[]>>;
}

type ActionFetchListV3 = ActionOptions & {
    method: string;
    params?: Omit<TypeCallParams, 'pagination'>;
    idKey?: string;
    customKeyForResult: string;
    requestId?: string;
    limit?: number;
};
/**
 * Calls a REST API list method and returns an async generator for efficient large data retrieval. `restApi:v3`
 *
 * @todo add docs
 */
declare class FetchListV3 extends AbstractAction {
    /**
     * Calls a REST API list method and returns an async generator for efficient large data retrieval.
     * Implements the fast algorithm for iterating over large datasets without loading all data into memory at once.
     *
     * @template T - The type of items in the returned arrays (default is `unknown`).
     *
     * @param {ActionFetchListV3} options - parameters for executing the request.
     *     - `method: string` - The name of the REST API method that returns a list of data (for example: `crm.item.list`, `tasks.task.list`)
     *     - `params?: Omit<TypeCallParams, 'pagination'>` - Request parameters, excluding the `pagination` parameter,
     *         since the method is designed to obtain all data in one call.
     *         Note: Use `filter`, `order`, and `select` to control the selection.
     *     - `idKey?: string` - The name of the field containing the unique identifier of the element.
     *         Default is 'id'. Alternatively, it can be another field, depending on the REST API data structure.
     *     - `customKeyForResult: string` - A custom key indicating that the response REST API will be
     *        grouped by this field.
     *        Example: `items` to group a list of CRM items.
     *    - `requestId?: string` - Unique request identifier for tracking. Used for query deduplication and debugging.
     *    - `limit?: number` - How many records to retrieve at a time. Default is `50`. Maximum is `1000`.
     *
     * @returns {AsyncGenerator<T[]>} An async generator that yields chunks of data as arrays of type `T`.
     *     Each iteration returns the next page/batch of results until all data is fetched.
     *
     * @example
     * import { Text } from '@bitrix24/b24jssdk'
     *
     * interface MainEventLogItem { id: number, userId: number }
     * const sixMonthAgo = new Date()
     * sixMonthAgo.setMonth((new Date()).getMonth() - 6)
     * sixMonthAgo.setHours(0, 0, 0)
     * const generator = b24.actions.v3.fetchList.make<MainEventLogItem>({
     *   method: 'main.eventlog.list',
     *   params: {
     *     filter: [
     *      ['timestampX', '>=', Text.toB24Format(sixMonthAgo)] // created at least 6 months ago
     *     ],
     *     select: ['id', 'userId']
     *   },
     *   idKey: 'id',
     *   customKeyForResult: 'items',
     *   requestId: 'eventlog-123',
     *   limit: 60
     * })
     *
     * for await (const chunk of generator) {
     *   // Process chunk (e.g., save to database, analyze, etc.)
     *   console.log(`Processing ${chunk.length} items`)
     * }
     */
    make<T = unknown>(options: ActionFetchListV3): AsyncGenerator<T[]>;
}

type ActionBatchV3 = ActionOptions & {
    calls: BatchCommandsArrayUniversal | BatchCommandsObjectUniversal | BatchNamedCommandsUniversal;
    options?: IB24BatchOptions;
};
/**
 * Executes a batch request to the Bitrix24 REST API with a maximum number of commands of no more than 50. `restApi:v3`
 * Allows you to execute multiple requests in a single API call, significantly improving performance.
 *
 * @todo add docs
 */
declare class BatchV3 extends AbstractBatch {
    /**
     * Executes a batch request to the Bitrix24 REST API with a maximum number of commands of no more than 50.
     * Allows you to execute multiple requests in a single API call, significantly improving performance.
     *
     * @template T - The data type returned by batch query commands (default is `unknown`)
     *
     * @param {ActionBatchV3} options - parameters for executing the request.
     *     - `calls: BatchCommandsArrayUniversal | BatchCommandsObjectUniversal | BatchNamedCommandsUniversal` - Commands to execute in a batch.
     *        Supports several formats:
     *        1. Array of tuples: `[['method1', params1], ['method2', params2], ...]`
     *        2. Array of objects: `[{ method: 'method1', params: params1 }, { method: 'method2', params: params2 }, ...]`
     *        3. An object with named commands: `{ cmd1: { method: 'method1', params: params1 }, cmd2: ['method2', params2], ...}`
     *     - `options?: IB24BatchOptions` - Additional options for executing a batch request.
     *        - `isHaltOnError?: boolean` - Whether to stop execution on the first error (default: true)
     *        - `requestId?: string` - Unique request identifier for tracking. Used for query deduplication and debugging (default: undefined)
     *        - `returnAjaxResult?: boolean` - Whether to return an AjaxResult object instead of data (default: false)
     *
     * @returns {Promise<CallBatchResult<T>>} A promise that is resolved by the result of executing a batch request:
     *     - On success: a `Result` object with the command execution results
     *     - The structure of the results depends on the format of the `calls` input data:
     *          - For an array of commands, an array of results in the same order
     *          - For named commands, an object with keys corresponding to the command names
     *
     * @example
     * interface TaskItem { id: number, title: string }
     * const response = await b24.actions.v3.batch.make<{ item: TaskItem }>({
     *   calls: [
     *     ['tasks.task.get', { id: 1, select: ['id', 'title'] }],
     *     ['tasks.task.get', { id: 2, select: ['id', 'title'] }],
     *     ['tasks.task.get', { id: 3, select: ['id', 'title'] }]
     *   ],
     *   options: {
     *     isHaltOnError: true,
     *     returnAjaxResult: true,
     *     requestId: 'batch-123'
     *   }
     * })
     * if (!response.isSuccess) {
     *   throw new Error(`Problem: ${response.getErrorMessages().join('; ')}`)
     * }
     *
     * const resultData = (response as Result<AjaxResult<{ item: TaskItem }>[]>).getData()
     * resultData.forEach((resultRow, index) => {
     *   if (resultRow.isSuccess) {
     *    console.log(`Item ${index + 1}:`, resultRow.getData().result.item)
     *   }
     * })
     *
     * @example
     * const response = await b24.actions.v3.batch.make({
     *   calls: [
     *     { method: 'tasks.task.get', params: { id: 1, select: ['id', 'title'] } },
     *     { method: 'tasks.task.get', params: { id: 2, select: ['id', 'title'] } }
     *   ],
     *   options: {
     *     isHaltOnError: true,
     *     returnAjaxResult: true,
     *     requestId: 'batch-123'
     *   }
     * })
     * if (!response.isSuccess) {
     *   throw new Error(`Problem: ${response.getErrorMessages().join('; ')}`)
     * }
     *
     * @example
     * interface TaskItem { id: number, title: string }
     * interface MainEventLogItem { id: number, userId: number }
     * const response = await b24.actions.v3.batch.make<{ item: TaskItem } | { items: MainEventLogItem[] }>({
     *   calls: {
     *     Task: { method: 'tasks.task.get', params: { id: 1, select: ['id', 'title'] } },
     *     MainEventLog: ['main.eventlog.list', { select: ['id', 'userId'], pagination: { limit: 5 } }]
     *   },
     *   options: {
     *     isHaltOnError: true,
     *     returnAjaxResult: true,
     *     requestId: 'batch-123'
     *   }
     * })
     * if (!response.isSuccess) {
     *   throw new Error(`Problem: ${response.getErrorMessages().join('; ')}`)
     * }
     *
     * const results = response.getData() as Record<string, AjaxResult<{ item: TaskItem } | { items: MainEventLogItem[] }>>
     * console.log('Task:', results.Task.getData().result.item as TaskItem)
     * console.log('MainEventLog:', results.MainEventLog.getData().result.items as MainEventLogItem[])
     *
     * @warning The maximum number of commands in one batch request is 50.
     * @note A batch request executes faster than sequential single calls,
     *     but if one command fails, the entire batch may fail
     *     (depending on API settings and options).
     */
    make<T = unknown>(options: ActionBatchV3): Promise<CallBatchResult<T>>;
}

type ActionBatchByChunkV3 = ActionOptions & {
    calls: BatchCommandsArrayUniversal | BatchCommandsObjectUniversal;
    options?: Omit<IB24BatchOptions, 'returnAjaxResult'>;
};
/**
 * Executes a batch request with automatic chunking for any number of commands. `restApi:v3`
 *
 * @todo add docs
 */
declare class BatchByChunkV3 extends AbstractBatch {
    /**
     * Executes a batch request with automatic chunking for any number of commands.
     * Unlike `BatchV3`, which is limited to 50 commands, this method automatically splits
     * a large set of commands into multiple batches and executes them sequentially.
     *
     * @template T - The data type returned by commands (default: `unknown`)
     *
     * @param {ActionBatchByChunkV3} options - parameters for executing the request.
     *     - `calls: BatchCommandsArrayUniversal | BatchCommandsObjectUniversal` - Commands to execute in a batch.
     *        Supports several formats:
     *        1. Array of tuples: `[['method1', params1], ['method2', params2], ...]`
     *        2. Array of objects: `[{ method: 'method1', params: params1 }, { method: 'method2', params: params2 }, ...]`
     *        - Note: Named commands are not supported as they are difficult to process when chunking.
     *     - `options?: Omit<IB24BatchOptions, 'returnAjaxResult'>` - Additional options for executing a batch request.
     *        - `isHaltOnError?: boolean` - Whether to stop execution on the first error (default: true)
     *        - `requestId?: string` - Unique request identifier for tracking. Used for query deduplication and debugging (default: undefined)
     *
     * @returns {Promise<Result<T[]>>} A promise that is resolved by the result of executing all commands.
     *
     * @example
     * interface TaskItem { id: number, title: string }
     * const commands: BatchCommandsArrayUniversal = Array.from({ length: 150 }, (_, i) =>
     *   ['tasks.task.get', { id: i + 1, select: ['id', 'title'] }]
     * )
     *
     * const response = await b24.actions.v3.batchByChunk.make<{ item: TaskItem }>({
     *   calls: commands,
     *   options: {
     *     isHaltOnError: false,
     *     requestId: 'batch-by-chunk-123'
     *   }
     * })
     *
     * if (!response.isSuccess) {
     *   throw new Error(`Problem: ${response.getErrorMessages().join('; ')}`)
     * }
     *
     * const resultData = response.getData()
     * const items: TaskItem[] = []
     * resultData.forEach((chunkRow) => {
     *   items.push(chunkRow.item)
     * })
     * console.log(`Successfully retrieved ${items.length} items`)
     *
     * @tip For very large command sets, consider using server-side task queues instead of bulk batch requests.
     */
    make<T = unknown>(options: ActionBatchByChunkV3): Promise<Result<T[]>>;
}

/**
 * Some actions for TypeB24 by Api:v3
 */
declare class ActionsManagerV3 {
    protected _b24: TypeB24;
    protected _logger: LoggerInterface;
    protected _mapActions: Map<symbol, AbstractAction>;
    constructor(b24: TypeB24);
    setLogger(logger: LoggerInterface): void;
    getLogger(): LoggerInterface;
    get call(): CallV3;
    get callList(): CallListV3;
    get fetchList(): FetchListV3;
    get batch(): BatchV3;
    get batchByChunk(): BatchByChunkV3;
}

/**
 * Some actions for TypeB24
 */
declare class ActionsManager {
    protected _b24: TypeB24;
    protected _logger: LoggerInterface;
    protected _mapActions: Map<symbol, any>;
    constructor(b24: TypeB24);
    setLogger(logger: LoggerInterface): void;
    getLogger(): LoggerInterface;
    get v2(): ActionsManagerV2;
    get v3(): ActionsManagerV3;
}

/**
 * Abstract Class for working with tools
 */
type ToolOptions = {
    [key: string]: any;
};
declare abstract class AbstractTool {
    protected _b24: TypeB24;
    protected _logger: LoggerInterface;
    constructor(b24: TypeB24, logger: LoggerInterface);
    abstract make(options?: ToolOptions): Promise<unknown>;
}

/**
 * Ping `restApi:v2`
 *
 * @todo use apiVer3
 */
declare class Ping extends AbstractTool {
    /**
     * Measures the response speed of the Bitrix24 REST API.
     * Performs a test request and returns the response time in milliseconds.
     * Useful for performance monitoring and diagnosing latency issues.
     *
     * @note The method uses a minimal API request (`server.time`) to check availability.
     *   Does not overload the server with large amounts of data.
     *
     * @warning Response time may vary depending on server load, network conditions
     *     and HTTP client settings (timeouts, retries).
     *
     * @tip For consistent results, it is recommended to perform multiple measurements
     *     and use the median value.
     *
     * @param options Some options for executing
     *   - `requestId?: string` - Unique request identifier for tracking. Used for query deduplication and debugging (default: undefined)
     *
     * @returns {Promise<number>} Promise that resolves to a response time in milliseconds:
     *   - Positive number: time from sending the request to receiving the response
     *   - In case of an error or timeout: `-1`
     *
     * @see {@link HealthCheck} To check API availability
     */
    make(options?: ToolOptions & {
        requestId?: string;
    }): Promise<number>;
}

/**
 * HealthCheck `restApi:v2`
 *
 * @todo use apiVer3
 */
declare class HealthCheck extends AbstractTool {
    /**
     * Checks the availability of the Bitrix24 REST API.
     * Performs a simple request to the API to verify the service is operational and that the required access rights are present.
     *
     * @note The method uses a minimal API request (`server.time`) to check availability.
     *   Does not overload the server with large amounts of data.
     *
     * @param options Some options for executing
     *   - `requestId?: string` - Unique request identifier for tracking. Used for query deduplication and debugging (default: undefined)
     *
     * @returns {Promise<false>} Promise that resolves to a Boolean value:
     *   - `true`: the API is available and responding
     *   - `false`: the API is unavailable, an error occurred, or the required access rights are missing
     *
     * @see {@link Ping} To measure API response speed
     */
    make(options?: ToolOptions & {
        requestId?: string;
    }): Promise<boolean>;
}

/**
 * Some tools for TypeB24
 * @todo add docs
 */
declare class ToolsManager {
    protected _b24: TypeB24;
    protected _logger: LoggerInterface;
    protected _mapTools: Map<symbol, AbstractTool>;
    constructor(b24: TypeB24);
    setLogger(logger: LoggerInterface): void;
    getLogger(): LoggerInterface;
    get ping(): Ping;
    get healthCheck(): HealthCheck;
}

/**
 * @todo docs
 */
declare enum ApiVersion {
    v3 = "v3",
    v2 = "v2"
}
/**
 * Options for batch calls
 */
interface IB24BatchOptions extends ICallBatchOptions {
    /**
     * Api Version
     * If the option is empty, then automatic detection is performed using the specified methods.
     */
    apiVersion?: ApiVersion;
    /**
     * Whether to return an AjaxResult object instead of data
     * @default false
     */
    returnAjaxResult?: boolean;
}
type CallBatchResult<T> = Result<Record<string | number, AjaxResult<T>>> | Result<AjaxResult<T>[]> | Result<T>;
type TypeB24 = {
    /**
     * @see {https://bitrix24.github.io/b24jssdk/docs/hook/ Js SDK documentation}
     * @see {https://apidocs.bitrix24.com/sdk/bx24-js-sdk/system-functions/bx24-init.html Bitrix24 REST API documentation}
     */
    readonly isInit: boolean;
    init(): Promise<void>;
    destroy(): void;
    getLogger(): LoggerInterface;
    setLogger(logger: LoggerInterface): void;
    /**
     * Returns the AuthActions interface for handling authorization.
     */
    get auth(): AuthActions;
    /**
     * Returns the ActionsManager interface for working with Bitrix24 methods. Dependent on the REST API version.
     */
    get actions(): ActionsManager;
    /**
     * Returns the ToolsManager interface for access to Bitrix24 utilities independent of the REST API version.
     */
    get tools(): ToolsManager;
    /**
     * Sets the restriction parameters
     */
    setRestrictionManagerParams(params: RestrictionParams): Promise<void>;
    /**
     * Get the account address Bitrix24 ( `https://your_domain.bitrix24.com` )
     */
    getTargetOrigin(): string;
    /**
     * Get the account address Bitrix24 with path
     *  - `restApi:v3` `https://your_domain.bitrix24.com/rest/api/`
     *  - `restApi:v2` `https://your_domain.bitrix24.com/rest/`
     */
    getTargetOriginWithPath(): Map<ApiVersion, string>;
    /**
     * Calls the Bitrix24 REST API method.
     *
     * @deprecated This method is deprecated and will be removed in version `2.0.0`
     *   - for `restApi:v3` use {@link CallV3.make `b24.actions.v3.call.make(options)`}
     *   - for `restApi:v2` use {@link CallV2.make `b24.actions.v2.call.make(options)`}
     *
     * @removed 2.0.0
     */
    callMethod(method: string, params?: object, start?: number): Promise<AjaxResult>;
    /**
     * Calls a Bitrix24 REST API list method to retrieve all data.
     *
     * @deprecated This method is deprecated and will be removed in version `2.0.0`
     *   - for `restApi:v3` use {@link CallListV3.make `b24.actions.v3.callList.make(options)`}
     *   - for `restApi:v2` use {@link CallListV2.make `b24.actions.v2.callList.make(options)`}
     *
     * @removed 2.0.0
     */
    callListMethod(method: string, params?: object, progress?: null | ((progress: number) => void), customKeyForResult?: string | null): Promise<Result>;
    /**
     * Calls a Bitrix24 REST API list method and returns an async generator.
     *
     * @deprecated This method is deprecated and will be removed in version `2.0.0`
     *   - for `restApi:v3` use {@link FetchListV3.make `b24.actions.v3.fetchList.make(options)`}
     *   - for `restApi:v2` use {@link FetchListV2.make `b24.actions.v2.fetchList.make(options)`}
     *
     * @removed 2.0.0
     */
    fetchListMethod(method: string, params?: any, idKey?: string, customKeyForResult?: string | null): AsyncGenerator<any[]>;
    /**
     * Executes a batch request to the Bitrix24 REST API
     *
     * @deprecated This method is deprecated and will be removed in version `2.0.0`
     *   - for `restApi:v3` use {@link BatchV3.make `b24.actions.v3.batch.make(options)`}
     *   - for `restApi:v2` use {@link BatchV2.make `b24.actions.v2.batch.make(options)`}
     *
     * @removed 2.0.0
     */
    callBatch(calls: Array<any> | object, isHaltOnError?: boolean, returnAjaxResult?: boolean): Promise<Result>;
    /**
     * Executes a batch request to the Bitrix24 REST API with automatic chunking for any number of commands.
     *
     * @deprecated This method is deprecated and will be removed in version `2.0.0`
     *   - for `restApi:v3` use {@link BatchByChunkV3.make `b24.actions.v3.batchByChunk.make(options)`}
     *   - for `restApi:v2` use {@link BatchByChunkV2.make `b24.actions.v2.batchByChunk.make(options)`}
     *
     * @removed 2.0.0
     */
    callBatchByChunk(calls: Array<any>, isHaltOnError: boolean): Promise<Result>;
    /**
     * Returns the HTTP client to perform the request.
     */
    getHttpClient(version: ApiVersion): TypeHttp;
    /**
     * Set HTTP client
     */
    setHttpClient(version: ApiVersion, client: TypeHttp): void;
};

/**
 * @link https://apidocs.bitrix24.com/api-reference/rest-v3/index.html#structure-of-an-unsuccessful-response
 *
 * @todo ! move to packages/jssdk/src/types/payloads.ts
 */
type TypeDescriptionErrorV3 = {
    readonly error: {
        code: string;
        message: string;
        validation?: {
            message?: string;
            field?: string;
            [key: string]: any;
        }[];
    };
};
type TypeDescriptionError = {
    readonly error: 'invalid_token' | 'expired_token' | string;
    readonly error_description?: string;
};
/**
 * Parameters for hook
 */
type B24HookParams = {
    /**
     * https://your-bitrix-portal.bitrix24.com
     */
    b24Url: string;
    userId: number;
    secret: string;
};
/**
 * Parameters passed in the GET request from the B24 parent window to the application
 */
type B24FrameQueryParams = {
    DOMAIN: string | null | undefined;
    PROTOCOL: boolean | null | undefined;
    LANG: string | null | undefined;
    APP_SID: string | null | undefined;
};
/**
 * Parameters for application for OAuth
 */
type B24OAuthSecret = {
    clientId: string;
    clientSecret: string;
};
/**
 * Parameters for OAuth
 * @memo We get from b24 event this data
 */
interface B24OAuthParams {
    /**
     * @example '1xxxxx1694'
     */
    applicationToken: string;
    /**
     * @example 1
     */
    userId: number;
    /**
     * @example '3xx2030386cyy1b'
     */
    memberId: string;
    /**
     * @example '1xxxxx1694'
     */
    accessToken: string;
    /**
     * @example '0xxxx4e000011e700000001000000260dc83b47c40e9b5fd501093674c4f5'
     */
    refreshToken: string;
    /**
     * @example 1745997853
     */
    expires: number;
    /**
     * @example 3600
     */
    expiresIn: number;
    /**
     * @example 'crm,catalog,bizproc,placement,user_brief'
     */
    scope: string;
    /**
     * @example 'xxx.bitrix24.com'
     */
    domain: string;
    /**
     * @example 'https://xxx.bitrix24.com/rest/'
     */
    clientEndpoint: string;
    /**
     * @example 'https://oauth.bitrix.info/rest/'
     */
    serverEndpoint: string;
    /**
     * @example 'L'
     */
    status: typeof EnumAppStatus[keyof typeof EnumAppStatus];
    issuer?: 'request' | 'store' | string;
}
type HandlerRefreshAuth = Pick<HandlerAuthParams, 'access_token' | 'refresh_token' | 'expires' | 'expires_in' | 'client_endpoint' | 'server_endpoint' | 'member_id' | 'scope' | 'status' | 'domain'>;
/**
 * Callback called when OAuth authorization is updated
 */
type CallbackRefreshAuth = (params: {
    authData: AuthData;
    b24OAuthParams: B24OAuthParams;
}) => Promise<void>;
/**
 * Use for custom get new refresh token for OAuth
 */
type CustomRefreshAuth = () => Promise<HandlerRefreshAuth>;
/**
 * Parameters passed from the parent window when calling refreshAuth
 */
type RefreshAuthData = {
    AUTH_ID: string;
    REFRESH_ID: string;
    AUTH_EXPIRES: NumberString;
};
/**
 * Parameters passed from the parent window when calling getInitData
 */
type MessageInitData = RefreshAuthData & {
    DOMAIN: string;
    PROTOCOL: string;
    PATH: string;
    LANG: string;
    MEMBER_ID: string;
    IS_ADMIN: boolean;
    APP_OPTIONS: Record<string, any>;
    USER_OPTIONS: Record<string, any>;
    PLACEMENT: string;
    PLACEMENT_OPTIONS: Record<string, any>;
    INSTALL: boolean;
    FIRST_RUN: boolean;
};
/**
 * Parameters for OAuth authorization
 */
type AuthData = {
    access_token: string;
    refresh_token: string;
    expires: number;
    expires_in: number;
    domain: string;
    member_id: string;
    [key: string]: any;
};
/**
 * Interface for updating authorization
 */
interface AuthActions {
    getAuthData: () => false | AuthData;
    refreshAuth: () => Promise<AuthData>;
    getUniq: (prefix: string) => string;
    isAdmin: boolean;
    /**
     * Get the account address BX24 ( `https://your_domain.bitrix24.com` )
     */
    getTargetOrigin(): string;
    /**
     * Get the account address BX24 with path
     *   - ver2 `https://your_domain.bitrix24.com/rest/`
     *   - ver3` https://your_domain.bitrix24.com/rest/api/`
     */
    getTargetOriginWithPath(): Map<ApiVersion, string>;
}

type PayloadTime = {
    readonly start: number;
    readonly finish: number;
    readonly duration: number;
    readonly processing: number;
    readonly date_start: ISODate;
    readonly date_finish: ISODate;
    /**
     * timestamp - when part of the limit for this method will be released.
     */
    readonly operating_reset_at: number;
    /**
     * indicates the execution time of a request to a specific method.
     */
    readonly operating: number;
};
type GetPayload<P> = {
    readonly result: P;
    readonly time: PayloadTime;
};
type ListPayload<P> = {
    readonly result: P[];
    readonly total: number;
    readonly next?: number;
    readonly time: PayloadTime;
};
type BatchPayloadResult<C> = {
    readonly result: {
        readonly [P in keyof C]?: C[P];
    } | ReadonlyArray<C[keyof C]>;
    readonly result_error: {
        readonly [P in keyof C]?: string;
    } | readonly string[];
    readonly result_total: {
        readonly [P in keyof C]?: number;
    } | readonly number[];
    readonly result_next: {
        readonly [P in keyof C]?: number;
    } | readonly number[];
    readonly result_time: {
        readonly [P in keyof C]?: PayloadTime;
    } | readonly PayloadTime[];
};
type BatchPayload<C> = {
    readonly result: BatchPayloadResult<C>;
    readonly time: PayloadTime;
};
type Payload<P> = TypeDescriptionErrorV3 | TypeDescriptionError | GetPayload<P> | ListPayload<P> | BatchPayload<P>;
type SuccessPayload<P> = Exclude<Payload<P>, TypeDescriptionErrorV3 | TypeDescriptionError>;

type AjaxQuery = Readonly<{
    method: string;
    params: TypeCallParams;
    requestId: string;
}>;
type AjaxResultOptions<T> = Readonly<{
    answer: Payload<T>;
    query: AjaxQuery;
    status: number;
}>;
/**
 * Result of request to Rest Api
 *
 * @todo docs
 */
declare class AjaxResult<T = unknown> extends Result<Payload<T>> implements IResult<Payload<T>> {
    #private;
    private readonly _status;
    private readonly _query;
    protected _data: Payload<T> | null | undefined;
    constructor(options: AjaxResultOptions<T>);
    get isSuccess(): boolean;
    getData(): undefined | SuccessPayload<T>;
    /**
     * Alias for isMore
     */
    hasMore(): boolean;
    isMore(): boolean;
    getTotal(): number;
    getStatus(): number;
    getQuery(): Readonly<AjaxQuery>;
    /**
     * Alias for getNext
     * @param http
     *
     * @todo !fix api version
     */
    fetchNext(http: TypeHttp): Promise<AjaxResult<T> | null>;
    getNext(http: TypeHttp): Promise<AjaxResult<T> | false>;
    setData(): never;
}

/**
 * @todo fix docs
 */
type TypeCallParams = {
    order?: Record<string, 'ASC' | 'DESC' | 'asc' | 'desc' | string>;
    filter?: any;
    select?: string[];
    params?: any;
    /**
     * Used only in Api:V2
     */
    start?: number;
    /**
     * Used only in Api:V3
     */
    pagination?: {
        limit?: number;
        /**
         * Minimum 1
         */
        page?: number;
        /**
         * You need to use either `page` or `offset`. There's no point in using both.
         */
        offset?: number;
    };
    /**
     * Used only in Api:V3
     */
    cursor?: {
        field: string;
        value: number;
        order: 'ASC' | 'DESC' | 'asc' | 'desc' | string;
    };
    [key: string]: any;
};
/**
 * Options for batch calls
 */
interface ICallBatchOptions {
    /**
     * Whether to stop execution on the first error
     * @default true
     */
    isHaltOnError?: boolean;
    /**
     * Unique request identifier for tracking. Used for query deduplication and debugging.
     */
    requestId?: string;
}
/**
 * Result of the batch call
 */
interface ICallBatchResult<T = unknown> {
    result?: Map<string | number, AjaxResult<T>>;
    time?: PayloadTime;
}
type BatchCommandV3 = {
    method: string;
    query?: Record<string, unknown>;
    as?: string;
    parallel?: boolean;
};
type CommandTuple<M extends string = string, P = undefined | TypeCallParams> = [M, P?];
/**
 * @todo add docs - api v3 only use this ??
 */
interface CommandObject<M extends string = string, P = undefined | TypeCallParams> {
    method: M;
    params?: P;
    as?: string;
    parallel?: boolean;
}
type CommandUniversal<M extends string = string, P = undefined | TypeCallParams> = CommandTuple<M, P> | CommandObject<M, P>;
type BatchCommandsArrayUniversal<M extends string = string, P = undefined | TypeCallParams> = CommandTuple<M, P>[];
type BatchCommandsObjectUniversal<M extends string = string, P = undefined | TypeCallParams> = CommandObject<M, P>[];
type BatchNamedCommandsUniversal<K extends string | number | symbol = string, M extends string = string, P = undefined | TypeCallParams> = Record<K, CommandObject<M, P> | CommandTuple<M, P>>;
type BatchCommandsUniversal<M extends string = string, P = undefined | TypeCallParams> = CommandUniversal<M, P>[];
/**
 * Interface for Request id generator
 */
interface IRequestIdGenerator {
    getRequestId(): string;
    getHeaderFieldName(): string;
    getQueryStringParameterName(): string;
    getQueryStringSdkParameterName(): string;
}
/**
 * Interface for HTTP client
 */
type TypeHttp = {
    apiVersion: ApiVersion;
    ajaxClient: AxiosInstance | any;
    setLogger(logger: LoggerInterface): void;
    getLogger(): LoggerInterface;
    /**
     * Executing batch queries
     */
    batch<T = unknown>(calls: BatchCommandsArrayUniversal | BatchCommandsObjectUniversal | BatchNamedCommandsUniversal, options?: ICallBatchOptions): Promise<Result<ICallBatchResult<T>>>;
    /**
     * Calling the RestApi function
     * @param method - REST API method name
     * @param params - Parameters for the method.
     * @param requestId - Request id
     * @returns Promise with AjaxResult
     */
    call<T = unknown>(method: string, params: TypeCallParams, requestId?: string): Promise<AjaxResult<T>>;
    /**
     * Sets the restriction parameters
     */
    setRestrictionManagerParams(params: RestrictionParams): Promise<void>;
    /**
     * Returns the current constraint settings
     */
    getRestrictionManagerParams(): RestrictionParams;
    /**
     * Returns job statistics
     */
    getStats(): RestrictionManagerStats & {
        adaptiveDelayAvg: number;
        errorCounts: Record<string, number>;
        totalRequests: number;
        successfulRequests: number;
        failedRequests: number;
        totalDuration: number;
        byMethod: Map<string, {
            count: number;
            totalDuration: number;
        }>;
        lastErrors: {
            method: string;
            error: string;
            timestamp: number;
        }[];
    };
    /**
     * Resets limiters and statistics
     */
    reset(): Promise<void>;
    /**
     * On|Off warning about client-side query execution
     * @param {boolean} value
     * @param {string} message
     */
    setClientSideWarning(value: boolean, message: string): void;
};

/**
 * User fields for scope:user_brief
 * @link https://dev.1c-bitrix.ru/rest_help/users/index.php
 */
type UserBrief = {
    readonly [key: string]: string | boolean | null | readonly number[];
    readonly ID: NumberString;
    readonly XML_ID: string | null;
    readonly ACTIVE: boolean;
    readonly NAME: string | null;
    readonly LAST_NAME: string | null;
    readonly SECOND_NAME: string | null;
    readonly TITLE: string | null;
    readonly IS_ONLINE: BoolString;
    readonly TIME_ZONE: string | null;
    readonly TIME_ZONE_OFFSET: NumberString | null;
    readonly TIMESTAMP_X: string;
    readonly DATE_REGISTER: ISODate;
    readonly PERSONAL_PROFESSION: string | null;
    readonly PERSONAL_GENDER: GenderString;
    readonly PERSONAL_BIRTHDAY: string | null;
    readonly PERSONAL_PHOTO: string | null;
    readonly PERSONAL_CITY: string | null;
    readonly PERSONAL_STATE: string | null;
    readonly PERSONAL_COUNTRY: string | null;
    readonly WORK_POSITION: string | null;
    readonly WORK_CITY: string | null;
    readonly WORK_STATE: string | null;
    readonly WORK_COUNTRY: string | null;
    readonly LAST_ACTIVITY_DATE: string;
    readonly UF_EMPLOYMENT_DATE: ISODate | string;
    readonly UF_TIMEMAN: string | null;
    readonly UF_SKILLS: string | null;
    readonly UF_INTERESTS: string | null;
    readonly UF_DEPARTMENT: readonly number[];
    readonly UF_PHONE_INNER: NumberString | null;
};
/**
 * User fields for scope:user_basic
 */
type UserBasic = UserBrief & {
    readonly EMAIL: string | null;
    readonly PERSONAL_WWW: string | null;
    readonly PERSONAL_ICQ: string | null;
    readonly PERSONAL_PHONE: string | null;
    readonly PERSONAL_FAX: string | null;
    readonly PERSONAL_MOBILE: string | null;
    readonly PERSONAL_PAGER: string | null;
    readonly PERSONAL_STREET: string | null;
    readonly PERSONAL_ZIP: string | null;
    readonly WORK_COMPANY: string | null;
    readonly WORK_PHONE: string | null;
    readonly UF_SKILLS: string | null;
    readonly UF_WEB_SITES: string | null;
    readonly UF_XING: string | null;
    readonly UF_LINKEDIN: string | null;
    readonly UF_FACEBOOK: string | null;
    readonly UF_TWITTER: string | null;
    readonly UF_SKYPE: string | null;
    readonly UF_DISTRICT: string | null;
    readonly USER_TYPE: 'employee';
};

type StatusClose = {
    isOpenAtNewWindow: boolean;
    isClose: boolean;
};

/**
 * CRM Entity Types
 * @link https://dev.1c-bitrix.ru/rest_help/crm/constants.php
 */
declare enum EnumCrmEntityType {
    undefined = "UNDEFINED",
    lead = "CRM_LEAD",
    deal = "CRM_DEAL",
    contact = "CRM_CONTACT",
    company = "CRM_COMPANY",
    oldInvoice = "CRM_INVOICE",
    invoice = "CRM_SMART_INVOICE",
    quote = "CRM_QUOTE",
    requisite = "CRM_REQUISITE",
    order = "ORDER"
}
declare enum EnumCrmEntityTypeId {
    undefined = 0,
    lead = 1,
    deal = 2,
    contact = 3,
    company = 4,
    oldInvoice = 5,
    invoice = 31,
    quote = 7,
    requisite = 8,
    order = 14
}
declare enum EnumCrmEntityTypeShort {
    undefined = "?",
    lead = "L",
    deal = "D",
    contact = "C",
    company = "CO",
    oldInvoice = "I",
    invoice = "SI",
    quote = "Q",
    requisite = "RQ",
    order = "O"
}
/**
 * @todo add docs
 */
declare function getEnumCrmEntityTypeShort(id: EnumCrmEntityTypeId): EnumCrmEntityTypeShort;

/**
 * Data Types and Object Structure in the REST API Catalog
 * @link https://apidocs.bitrix24.com/api-reference/catalog/data-types.html
 */
declare enum CatalogProductType {
    undefined = 0,
    product = 1,
    service = 7,
    sku = 3,
    skuEmpty = 6,
    offer = 4,
    offerEmpty = 5
}
declare enum CatalogProductImageType {
    undefined = "UNDEFINED",
    detail = "DETAIL_PICTURE",
    preview = "PREVIEW_PICTURE",
    morePhoto = "MORE_PHOTO"
}
declare enum CatalogRoundingRuleType {
    undefined = 0,
    mathematical = 1,
    roundingUp = 2,
    roundingDown = 4
}
interface CatalogCatalog {
    id: number;
    iblockId: number;
    iblockTypeId: string | 'CRM_PRODUCT_CATALOG';
    lid: string;
    name: string;
    productIblockId?: number;
    skuPropertyId?: number;
    subscription?: BoolString;
    vatId: number;
}
interface BaseProduct {
    id: number;
    iblockId: number;
    sort: number;
    name: string;
    active: BoolString;
    available: BoolString;
    code: string;
    xmlId: string;
    barcodeMulti: BoolString;
    bundle: BoolString;
    canBuyZero?: BoolString;
    type: number;
    vatId: number;
    vatIncluded: BoolString;
    weight?: number;
    height?: number;
    length?: number;
    width?: number;
    createdBy: number;
    modifiedBy: number;
    dateActiveFrom?: ISODate;
    dateActiveTo?: ISODate;
    dateCreate: ISODate;
    timestampX: ISODate;
    iblockSectionId?: number;
    measure?: number;
    previewText?: string;
    previewTextType?: TextType;
    detailText?: string;
    detailTextType?: TextType;
    previewPicture?: object;
    detailPicture?: object;
    subscribe: 'Y' | 'N' | 'D';
    quantityTrace: 'Y' | 'N' | 'D';
    purchasingCurrency: string;
    purchasingPrice: number;
    quantity: number;
    quantityReserved: number;
    [key: string]: any;
}
interface CatalogProduct extends BaseProduct {
    type: CatalogProductType.product;
}
interface CatalogProductSku extends BaseProduct {
    type: CatalogProductType.sku | CatalogProductType.skuEmpty;
}
interface CatalogProductOffer extends BaseProduct {
    type: CatalogProductType.offer | CatalogProductType.offerEmpty;
}
interface CatalogProductService extends Omit<BaseProduct, 'quantityReserved' | 'quantity' | 'purchasingPrice' | 'purchasingCurrency' | 'quantityTrace' | 'subscribe' | 'weight' | 'height' | 'length' | 'width' | 'canBuyZero' | 'barcodeMulti'> {
    type: CatalogProductType.service;
}
interface CatalogSection {
    id: number;
    xmlId: string;
    code: string;
    iblockId: number;
    sort: number;
    iblockSectionId: number;
    name: string;
    active: BoolString;
    description: string;
    descriptionType: TextType;
}
interface CatalogProductImage {
    id: number;
    name: string;
    productId: number;
    type: typeof CatalogProductImageType[keyof typeof CatalogProductImageType];
    createTime?: ISODate;
    downloadUrl?: string;
    detailUrl?: string;
}
interface CatalogStore {
    id: number;
    code: string;
    xmlId: string;
    sort: number;
    address: string;
    title: string;
    active: BoolString;
    description?: string;
    gpsN: number;
    gpsS: number;
    imageId: object;
    dateModify: ISODate;
    dateCreate: ISODate;
    userId: number;
    modifiedBy: number;
    phone: string;
    email: string;
    schedule: string;
    issuingCenter: BoolString;
}
interface CatalogMeasure {
    id: number;
    code: string;
    isDefault: BoolString;
    measureTitle: string;
    symbol: string;
    symbolIntl: string;
    symbolLetterIntl: string;
}
interface CatalogRatio {
    id: number;
    productId: number;
    ratio: number;
    isDefault: BoolString;
}
interface CatalogPriceType {
    id: number;
    xmlId: string;
    sort: number;
    name: string;
    base: BoolString;
    createdBy: number;
    modifiedBy: number;
    dateCreate: ISODate;
    timestampX: ISODate;
}
interface CatalogVat {
    id: number;
    name: string;
    active: BoolString;
    rate: number;
    sort: number;
    timestampX: ISODate;
}
interface CatalogPriceTypeLang {
    id: number;
    catalogGroupId: number;
    name: string;
    lang: string;
}
interface CatalogLanguage {
    lid: string;
    name: string;
    active: BoolString;
}
interface CatalogRoundingRule {
    id: number;
    catalogGroupId: number;
    price: number;
    roundType: typeof CatalogRoundingRuleType[keyof typeof CatalogRoundingRuleType];
    roundPrecision: number;
    createdBy: number;
    modifiedBy: number;
    dateCreate: ISODate;
    dateModify: ISODate;
}
interface CatalogExtra {
    id: number;
    name: string;
    percentage: number;
}

declare enum ProductRowDiscountTypeId {
    undefined = 0,
    absolute = 1,
    percentage = 2
}
interface CrmItemProductRow {
    id: number;
    ownerId: number;
    ownerType: typeof EnumCrmEntityTypeShort[keyof typeof EnumCrmEntityTypeShort];
    productId: number;
    productName: string;
    sort: number;
    price: number;
    priceAccount: number;
    priceExclusive: number;
    priceNetto: number;
    priceBrutto: number;
    customized: BoolString;
    quantity: number;
    measureCode: string;
    measureName: string;
    taxRate: number | null;
    taxIncluded: BoolString;
    discountRate: number;
    discountSum: number;
    discountTypeId: typeof ProductRowDiscountTypeId[keyof typeof ProductRowDiscountTypeId];
    xmlId: string;
    type: typeof CatalogProductType[keyof typeof CatalogProductType];
    storeId: number;
}

interface CrmItemDelivery {
    id: number;
    accountNumber: string;
    deducted: BoolString;
    dateDeducted?: ISODate;
    deliveryId: number;
    deliveryName: string;
    priceDelivery: number;
}

interface CrmItemPayment {
    id: number;
    accountNumber: string;
    paid: BoolString;
    datePaid?: ISODate;
    empPaidId?: number;
    sum: number;
    currency: string;
    paySystemId: number;
    paySystemName: string;
}

/**
 * UF embedding properties interface
 *
 * @link https://dev.1c-bitrix.ru/learning/course/index.php?COURSE_ID=99&LESSON_ID=8633
 */
interface IPlacementUF {
    /**
     * UF ID
     */
    FIELD_NAME: string;
    /**
     * The identifier of the entity to which the field is bound
     */
    ENTITY_ID: EnumCrmEntityType;
    /**
     * The identifier of the entity element whose field value is being edited
     */
    ENTITY_VALUE_ID: NumberString;
    /**
     * The mode in which the field is called
     */
    MODE: PlacementViewMode;
    /**
     * Field Requirement Flag
     */
    MANDATORY: BoolString;
    /**
     * Field multiplicity flag
     */
    MULTIPLE: BoolString;
    /**
     * Current value of the field. For a multiple field, an array of values.
     */
    VALUE: any;
    /**
     * External field code
     */
    XML_ID: string;
}

/**
 * List of supported languages in B24.Cloud
 *
 * It is worth remembering that there will be 1-2 languages for the B24.Box
 */
declare enum B24LangList {
    ru = "ru",
    id = "id",
    ms = "ms",
    de = "de",
    en = "en",
    la = "la",
    fr = "fr",
    in = "in",
    it = "it",
    pl = "pl",
    br = "br",
    vn = "vn",
    tr = "tr",
    kz = "kz",
    ua = "ua",
    ar = "ar",
    th = "th",
    sc = "sc",
    tc = "tc",
    ja = "ja"
}
declare const B24LocaleMap: Record<B24LangList, string>;

/**
 * Data Types and Object Structure in the REST API bizproc activity and robot
 * @link https://apidocs.bitrix24.com/api-reference/bizproc/bizproc-activity/index.html
 * @link https://apidocs.bitrix24.com/api-reference/bizproc/bizproc-robot/index.html
 *
 * @todo add docs
 */

interface ActivityHandlerParams {
    event_token: string;
    workflow_id: string;
    code: string;
    document_id: string[];
    document_type: string[];
    properties?: Record<string, string>;
    use_subscription: BoolString;
    timeout_duration: string;
    ts: string;
    [key: string]: any;
    auth: HandlerAuthParams;
}
type ActivityPropertyType = 'bool' | 'date' | 'datetime' | 'double' | 'int' | 'select' | 'string' | 'text' | 'user';
interface ActivityProperty {
    Name: string | Partial<Record<B24LangList, string>>;
    Description?: string | Record<string, string>;
    Type: ActivityPropertyType;
    Options?: Record<string | number, string>;
    Required?: BoolString;
    Multiple?: BoolString;
    Default?: any;
}
interface ActivityConfig {
    CODE: string;
    HANDLER: string;
    NAME: string | Partial<Record<B24LangList, string>>;
    DESCRIPTION?: string | Partial<Record<B24LangList, string>>;
    DOCUMENT_TYPE?: [string, string, string];
    PROPERTIES?: Record<string, ActivityProperty>;
    RETURN_PROPERTIES?: Record<string, ActivityProperty>;
    FILTER?: {
        INCLUDE?: Array<string | string[]>;
        EXCLUDE?: Array<string | string[]>;
    };
    USE_PLACEMENT?: BoolString;
    PLACEMENT_HANDLER?: string;
    USE_SUBSCRIPTION?: BoolString;
    AUTH_USER_ID?: number;
}
interface ActivityOrRobotConfig extends Omit<ActivityConfig, 'HANDLER' | 'PLACEMENT_HANDLER' | 'NAME'> {
    type: 'activity' | 'robot';
    NAME?: ActivityConfig['NAME'];
    HANDLER?: ActivityConfig['HANDLER'];
    PLACEMENT_HANDLER?: ActivityConfig['PLACEMENT_HANDLER'];
}

/**
 * Data Types and Object Structure in the REST API bizproc
 * @link https://apidocs.bitrix24.com/api-reference/bizproc/bizproc-activity/bizproc-activity-add.html
 * @link https://apidocs.bitrix24.com/api-reference/bizproc/bizproc-robot/bizproc-robot-add.html
 * @todo add docs
 */

/**
 * @link https://apidocs.bitrix24.com/api-reference/bizproc/bizproc-activity/bizproc-activity-add.html
 */
declare enum EnumBitrix24Edition {
    undefined = "undefined",
    b24 = "b24",
    box = "box"
}
declare enum EnumBizprocBaseType {
    undefined = "undefined",
    crm = "crm",
    disk = "disk",
    lists = "lists"
}
/**
 * @link https://apidocs.bitrix24.com/api-reference/bizproc/bizproc-workflow-start.html
 */
declare enum EnumBizprocDocumentType {
    undefined = "undefined",
    lead = "CCrmDocumentLead",
    company = "CCrmDocumentCompany",
    contact = "CCrmDocumentContact",
    deal = "CCrmDocumentDeal",
    invoice = "Bitrix\\Crm\\Integration\\BizProc\\Document\\SmartInvoice",
    quote = "Bitrix\\Crm\\Integration\\BizProc\\Document\\Quote",
    order = "Bitrix\\Crm\\Integration\\BizProc\\Document\\Order",
    dynamic = "Bitrix\\Crm\\Integration\\BizProc\\Document\\Dynamic",
    disk = "Bitrix\\Disk\\BizProcDocument",
    lists = "BizprocDocument",
    listsList = "Bitrix\\Lists\\BizprocDocumentLists"
}
declare function convertBizprocDocumentTypeToCrmEntityTypeId(documentType: EnumBizprocDocumentType): EnumCrmEntityTypeId;
/**
 * @link https://apidocs.bitrix24.com/api-reference/bizproc/bizproc-activity/bizproc-activity-add.html
 */
declare function getDocumentType(documentType: EnumBizprocDocumentType, entityId?: number): string[];
/**
 * @link https://apidocs.bitrix24.com/api-reference/bizproc/bizproc-workflow-start.html
 */
declare function getDocumentId(documentType: EnumBizprocDocumentType, id: number, dynamicId?: number): string[];
/**
 * @link https://apidocs.bitrix24.com/api-reference/bizproc/bizproc-workflow-start.html
 */
declare function getDocumentTypeForFilter(documentType: EnumBizprocDocumentType): string[];

/**
 * Data Types and Object Structure in the REST API event handler
 * @link https://apidocs.bitrix24.com/api-reference/events/index.html
 * @todo add docs
 */

interface EventHandlerParams {
    event: string;
    event_handler_id: string;
    ts: string;
    [key: string]: any;
    auth?: HandlerAuthParams;
}
interface EventOnAppInstallHandlerParams extends EventHandlerParams {
    data: {
        VERSION: string;
        ACTIVE: BoolString;
        INSTALLED: BoolString;
        LANGUAGE_ID: string;
    };
    auth: HandlerAuthParams;
}
/**
 * @todo fix this application_token
 * @see https://apidocs.bitrix24.com/api-reference/events/safe-event-handlers.html
 */
interface EventOnAppUnInstallHandlerParams {
    event: string;
    event_handler_id: string;
    ts: string;
    [key: string]: any;
    auth: {
        domain: string;
        client_endpoint: string;
        server_endpoint: string;
        member_id: string;
        application_token: string;
    };
}

type TypePullMessage = {
    command: string;
    params: Record<string, any>;
    extra: Record<string, any>;
};
type TypePullClientMessageBody = {
    module_id: string;
    command: string;
    params: any;
    extra?: {
        revision_web?: number;
        sender?: {
            type: SenderType;
        };
        server_time_unix?: number;
        server_time_ago?: number;
    };
};
declare enum ConnectionType {
    Undefined = "undefined",
    WebSocket = "webSocket",
    LongPolling = "longPolling"
}
type TypeConnector = {
    setLogger(logger: LoggerInterface): void;
    destroy(): void;
    connect(): void;
    disconnect(code: number, reason: string): void;
    send(buffer: ArrayBuffer | string): boolean;
    connected: boolean;
    connectionPath: string;
};
type ConnectorParent = {
    session: TypePullClientSession;
    getConnectionPath(connectionType: ConnectionType): string;
    getPublicationPath(): string;
    setLastMessageId(lastMessageId: string): void;
    isProtobufSupported(): boolean;
    isJsonRpc(): boolean;
};
type ConnectorCallbacks = {
    onOpen: () => void;
    onDisconnect: (response: {
        code: number;
        reason: string;
    }) => void;
    onError: (error: Error) => void;
    onMessage: (response: string | ArrayBuffer) => void;
};
type ConnectorConfig = {
    parent: ConnectorParent;
    onOpen?: () => void;
    onDisconnect?: (response: {
        code: number;
        reason: string;
    }) => void;
    onError?: (error: Error) => void;
    onMessage?: (response: string | ArrayBuffer) => void;
};
type StorageManagerParams = {
    userId?: number;
    siteId?: string;
};
type TypeStorageManager = {
    setLogger(logger: LoggerInterface): void;
    getLogger(): LoggerInterface;
    set(name: string, value: any): void;
    get(name: string, defaultValue: any): any;
    remove(name: string): void;
    compareKey(eventKey: string, userKey: string): boolean;
};
declare enum LsKeys {
    PullConfig = "bx-pull-config",
    WebsocketBlocked = "bx-pull-websocket-blocked",
    LongPollingBlocked = "bx-pull-longpolling-blocked",
    LoggingEnabled = "bx-pull-logging-enabled"
}
type SharedConfigCallbacks = {
    onWebSocketBlockChanged: (response: {
        isWebSocketBlocked: boolean;
    }) => void;
};
type SharedConfigParams = {
    storage?: TypeStorageManager;
    onWebSocketBlockChanged?: (response: {
        isWebSocketBlocked: boolean;
    }) => void;
};
declare enum PullStatus {
    Online = "online",
    Offline = "offline",
    Connecting = "connect"
}
declare enum SenderType {
    Unknown = 0,
    Client = 1,
    Backend = 2
}
declare enum SubscriptionType {
    Server = "server",
    Client = "client",
    Online = "online",
    Status = "status",
    Revision = "revision"
}
type TypeSubscriptionOptions = {
    /**
     * Subscription type
     */
    type?: SubscriptionType;
    /**
     * Name of the module
     */
    moduleId?: string;
    /**
     * Name of the command
     */
    command?: null | string;
    /**
     * Function, that will be called for incoming messages
     */
    callback: Function;
};
interface UserStatusCallback {
    (params: {
        userId: number;
        isOnline: boolean;
    }): void;
}
interface CommandHandlerFunctionV1 {
    (data: Record<string, any>, info?: {
        type: SubscriptionType;
        moduleId?: string;
    }): void;
}
interface CommandHandlerFunctionV2 {
    (params: Record<string, any>, extra: Record<string, any>, command: string, info?: {
        type: SubscriptionType;
        moduleId: string;
    }): void;
}
interface TypeSubscriptionCommandHandler {
    getModuleId: () => string;
    getSubscriptionType?: () => SubscriptionType;
    getMap?: () => Record<string, CommandHandlerFunctionV2>;
    [key: string]: CommandHandlerFunctionV2 | undefined;
}
type TypePullClientEmitConfig = {
    type: SubscriptionType;
    moduleId?: string;
    data?: Record<string, any>;
};
declare enum CloseReasons {
    NORMAL_CLOSURE = 1000,
    SERVER_DIE = 1001,
    CONFIG_REPLACED = 3000,
    CHANNEL_EXPIRED = 3001,
    SERVER_RESTARTED = 3002,
    CONFIG_EXPIRED = 3003,
    MANUAL = 3004,
    STUCK = 3005,
    WRONG_CHANNEL_ID = 4010
}
declare enum SystemCommands {
    CHANNEL_EXPIRE = "CHANNEL_EXPIRE",
    CONFIG_EXPIRE = "CONFIG_EXPIRE",
    SERVER_RESTART = "SERVER_RESTART"
}
declare enum ServerMode {
    Shared = "shared",
    Personal = "personal"
}
type RpcError = {
    code: number;
    message: string;
};
declare const ListRpcError: {
    readonly Parse: RpcError;
    readonly InvalidRequest: RpcError;
    readonly MethodNotFound: RpcError;
    readonly InvalidParams: RpcError;
    readonly Internal: RpcError;
};
type JsonRpcRequest = {
    method: string;
    params: any;
    id: number;
};
type RpcCommand = {
    jsonrpc: string;
    method: string;
    params: any;
    id: number;
};
type RpcRequest = RpcCommand & {};
type RpcCommandResult = {
    jsonrpc?: string;
    id?: number;
    /**
     * @fix this TypeRpcResponseAwaiters.resolve(response)
     */
    result?: any;
    error?: RpcError;
};
declare enum RpcMethod {
    Publish = "publish",
    GetUsersLastSeen = "getUsersLastSeen",
    Ping = "ping",
    ListChannels = "listChannels",
    SubscribeStatusChange = "subscribeStatusChange",
    UnsubscribeStatusChange = "unsubscribeStatusChange"
}
type TypeRpcResponseAwaiters = {
    /**
     * @fix this RpcCommandResult.result
     */
    resolve: (response: any) => void;
    reject: (error: string | RpcError) => void;
    timeout: number;
};
type TypeJsonRpcConfig = {
    connector: TypeConnector;
    handlers: Record<string, (params: any) => RpcCommandResult>;
};
type TypePublicIdDescriptor = {
    id?: string;
    user_id?: NumberString;
    public_id?: string;
    signature?: string;
    start: ISODate;
    end: ISODate;
    type?: string;
};
type TypeChanel = {
    userId: number;
    publicId: string;
    signature: string;
    start: Date;
    end: Date;
};
type TypeChannelManagerParams = {
    b24: TypeB24;
    getPublicListMethod: string;
};
type TypePullClientSession = {
    mid: null | string;
    tag: null | string;
    time: null | number;
    history: any;
    lastMessageIds: string[];
    messageCount: number;
};
type TypeSessionEvent = {
    mid: string;
    tag?: string;
    time?: number;
    text: Record<string, any> | TypePullClientMessageBody;
};
type TypePullClientParams = {
    b24: TypeB24;
    skipCheckRevision?: boolean;
    restApplication?: string;
    siteId?: string;
    guestMode?: boolean;
    guestUserId?: number;
    userId?: number;
    serverEnabled?: boolean;
    configGetMethod?: string;
    getPublicListMethod?: string;
    skipStorageInit?: boolean;
    configTimestamp?: number;
};
type TypePullClientConfig = {
    /**
     * @fix this
     */
    clientId: null;
    api: {
        revision_mobile: number;
        revision_web: number;
    };
    channels: {
        private?: TypePublicIdDescriptor;
        shared?: TypePublicIdDescriptor;
    };
    publicChannels: Record<string, TypePublicIdDescriptor>;
    server: {
        timeShift: number;
        config_timestamp: number;
        long_polling: string;
        long_pooling_secure: string;
        mode: string;
        publish: string;
        publish_enabled: boolean;
        publish_secure: string;
        server_enabled: boolean;
        version: number;
        websocket: string;
        websocket_enabled: boolean;
        websocket_secure: string;
    };
    jwt: null | string;
    exp: number;
};
type TypePullClientMessageBatch = {
    userList?: number[];
    channelList?: (string | {
        publicId: string;
        signature: string;
    })[];
    body: TypePullClientMessageBody;
    expiry?: number;
};

type SdkErrorDetails = {
    code: string;
    description?: string;
    status: number;
    originalError?: unknown;
};
/**
 * Error in Sdk
 */
declare class SdkError extends Error {
    readonly code: string;
    protected _status: number;
    readonly timestamp: Date;
    readonly originalError?: unknown;
    constructor(params: SdkErrorDetails);
    get status(): number;
    /**
     * Creates SdkError from exception
     */
    static fromException(error: unknown, context?: {
        code?: string;
        status?: number;
    }): SdkError;
    /**
     * Serializes error for logging and debugging
     */
    toJSON(): {
        name: string;
        code: string;
        message: string;
        status: number;
        timestamp: string;
        stack: string | undefined;
    };
    /**
     * Formats error information for human-readable output
     */
    toString(): string;
    protected static formatErrorMessage(params: SdkErrorDetails): string;
    protected cleanErrorStack(): void;
}

type AnswerError = {
    error: string;
    errorDescription: string;
};
type AjaxErrorParams = {
    status: number;
    answerError: AnswerError;
    cause?: Error;
};
type AjaxErrorDetails = SdkErrorDetails & {
    requestInfo?: Partial<AjaxQuery> & {
        url?: string;
    };
};
/**
 * Error requesting RestApi
 */
declare class AjaxError extends SdkError {
    readonly requestInfo?: AjaxErrorDetails['requestInfo'];
    constructor(params: AjaxErrorDetails);
    /**
     * Creates AjaxError from HTTP response
     * @todo add support v3
     */
    static fromResponse(response: {
        status: number;
        data?: {
            error?: string;
            error_description?: string;
        };
        config?: AjaxErrorDetails['requestInfo'];
    }): AjaxError;
    /**
     * @inheritDoc
     */
    static fromException(error: unknown, context?: {
        code?: string;
        status?: number;
        requestInfo?: AjaxErrorDetails['requestInfo'];
    }): AjaxError;
    /**
     * @inheritDoc
     */
    toJSON(): {
        name: string;
        code: string;
        message: string;
        status: number;
        timestamp: string;
        requestInfo: (Partial<Readonly<{
            method: string;
            params: TypeCallParams;
            requestId: string;
        }>> & {
            url?: string;
        }) | undefined;
        stack: string | undefined;
    };
    /**
     * @inheritDoc
     */
    toString(): string;
    /**
     * @inheritDoc
     */
    protected static formatErrorMessage(params: AjaxErrorDetails): string;
    /**
     * @inheritDoc
     */
    protected cleanErrorStack(): void;
}

/**
 * Factory for creating constraint parameters
 */
declare class ParamsFactory {
    /**
     * Default parameters for regular tariffs
     *
     * @see Http.#restrictionParams
     */
    static getDefault(): RestrictionParams;
    /**
     * Parameters for the Enterprise plan
     */
    static getEnterprise(): RestrictionParams;
    /**
     * Parameters for bulk data processing
     */
    static getBatchProcessing(): RestrictionParams;
    /**
     * Real-time parameters
     */
    static getRealtime(): RestrictionParams;
    /**
     * Tariff plan based parameters
     */
    static fromTariffPlan(plan: string): RestrictionParams;
}

/**
 * Rate limiting (Leaky Bucket) with adaptive control
 */
declare class RateLimiter implements ILimiter {
    #private;
    private _logger;
    constructor(config: RateLimitConfig);
    getTitle(): string;
    setLogger(logger: LoggerInterface): void;
    getLogger(): LoggerInterface;
    /**
     * @inheritDoc
     */
    canProceed(requestId: string, _method: string, _params?: any): Promise<boolean>;
    /**
     * @inheritDoc
     */
    waitIfNeeded(requestId: string, _method: string, _params?: any): Promise<number>;
    /**
     * Error handler.
     * If there are a lot of errors, we'll lower the limits.
     */
    handleExceeded(requestId: string): Promise<number>;
    /**
     * Successful request handler.
     * If everything is OK, we'll restore the limits.
     */
    updateStats(requestId: string, method: string, _data: any): Promise<void>;
    /**
     * @inheritDoc
     */
    reset(): Promise<void>;
    /**
     * @inheritDoc
     */
    getStats(): {
        tokens: number;
        burstLimit: number;
        originalBurstLimit: number;
        drainRate: number;
        originalDrainRate: number;
        refillIntervalMs: number;
        lastRefill: number;
        pendingRequests: number;
        recentErrors: number;
        recentSuccesses: number;
    };
    /**
     * @inheritDoc
     */
    setConfig(config: RateLimitConfig): Promise<void>;
}

interface OperatingStats {
    operating: number;
    /**
     * reset time (timestamp in ms)
     */
    operating_reset_at: number;
    lastUpdated: number;
}
/**
 * Operating limiting
 *
 * @todo docs
 */
declare class OperatingLimiter implements ILimiter {
    #private;
    private _logger;
    getTitle(): string;
    constructor(config: OperatingLimitConfig);
    setLogger(logger: LoggerInterface): void;
    getLogger(): LoggerInterface;
    get limitMs(): number;
    getMethodStat(method: string): undefined | OperatingStats;
    canProceed(requestId: string, method: string, params?: any): Promise<boolean>;
    waitIfNeeded(requestId: string, method: string, params?: any): Promise<number>;
    /**
     * Returns the time until the method's operating limit is released (in ms)
     * The analysis is based on the previous function call.
     * It's important to understand that we're talking about locks of up to 10 minutes.
     * This is a fairly strict lock based on the limit:
     *   - not reached - no lock
     *   - reached - lock until the unlock time + 1 second
     */
    getTimeToFree(requestId: string, method: string, params?: any, _error?: any): Promise<number>;
    /**
     * Updates operating time statistics for the method
     */
    updateStats(requestId: string, method: string, data: PayloadTime): Promise<void>;
    reset(): Promise<void>;
    getStats(): {
        heavyRequestCount: number;
        operatingStats: {
            [method: string]: number;
        };
    };
    setConfig(config: OperatingLimitConfig): Promise<void>;
}

/**
 * Adaptive delayer
 *
 * @todo docs
 */
declare class AdaptiveDelayer implements ILimiter {
    #private;
    private _logger;
    getTitle(): string;
    constructor(config: AdaptiveConfig, operatingLimiter: OperatingLimiter);
    setLogger(logger: LoggerInterface): void;
    getLogger(): LoggerInterface;
    canProceed(_requestId: string, _method: string, _params?: any): Promise<boolean>;
    /**
     * Returns an adaptive delay based on previous experience
     */
    waitIfNeeded(requestId: string, method: string, params?: any): Promise<number>;
    updateStats(_requestId: string, _method: string, _data: any): Promise<void>;
    reset(): Promise<void>;
    getStats(): {
        adaptiveDelays: number;
        totalAdaptiveDelay: number;
        adaptiveDelayAvg: number;
    };
    setConfig(config: AdaptiveConfig): Promise<void>;
    incrementAdaptiveDelays(): void;
}

/**
 * Delay Management Manager
 *
 * @todo docs
 */
declare class RestrictionManager {
    #private;
    private _logger;
    constructor(params: RestrictionParams);
    setLogger(logger: LoggerInterface): void;
    getLogger(): LoggerInterface;
    applyOperatingLimits(requestId: string, method: string, params?: any): Promise<void>;
    /**
     * Checks and waits for the rate limit
     * The loop is needed for parallel requests (Promise.all())
     */
    checkRateLimit(requestId: string, method: string): Promise<void>;
    updateStats(requestId: string, method: string, timeData: any): Promise<void>;
    handleError(requestId: string, method: string, params: any, error: any, attempt: number): Promise<number>;
    /**
     * These exceptions will be thrown
     */
    get exceptionCodeForHard(): string[];
    /**
     * These exceptions will be thrown into `AjaxResult` as `AjaxError`
     */
    get exceptionCodeForSoft(): string[];
    incrementError(method: string): void;
    resetErrors(method: string): void;
    incrementStats(stat: keyof Pick<RestrictionManagerStats, 'retries' | 'consecutiveErrors' | 'limitHits'>): void;
    /**
     * Returns job statistics
     */
    getStats(): RestrictionManagerStats & {
        adaptiveDelayAvg: number;
        errorCounts: Record<string, number>;
    };
    /**
     * Resets limiters and statistics
     */
    reset(): Promise<void>;
    setConfig(params: RestrictionParams): Promise<void>;
    getParams(): RestrictionParams;
    /**
     * Public access to the delay function
     */
    waiteDelay(ms: number): Promise<void>;
}

/**
 * @todo add docs ??
 */
declare class VersionManager {
    #private;
    constructor();
    static create(): VersionManager;
    /**
     * List of supported API versions
     * The highest version must be first
     */
    getAllApiVersions(): ApiVersion[];
    isSupport(version: ApiVersion, method: string): boolean;
    /**
     * Automatically obtain the API version
     */
    automaticallyObtainApiVersion(method: string): ApiVersion;
    /**
     * Automatically obtain the API version for Batch
     *
     * @todo test methods
     *   `[['crm.item.get', { entityTypeId: 3, id: 1 }]]`
     *   `[{ method: 'crm.item.get', params: { entityTypeId: 3, id: 1 } }]`
     *   `{ cmd1: { method: 'crm.item.get', params: { entityTypeId: 3, id: 1 } }, cmd2: ['crm.item.get', { entityTypeId: 2, id: 2 }] }`
     */
    automaticallyObtainApiVersionForBatch(calls: BatchCommandsArrayUniversal | BatchCommandsObjectUniversal | BatchNamedCommandsUniversal): ApiVersion;
}
declare const versionManager: VersionManager;

/**
 * @todo docs
 */
declare abstract class AbstractB24 implements TypeB24 {
    /**
     * Maximum length for batch response.
     *
     * @deprecated This const is deprecated and will be removed in version `2.0.0`
     * @removed 2.0.0
     */
    static readonly batchSize = 50;
    protected _isInit: boolean;
    protected _httpV2: null | TypeHttp;
    protected _httpV3: null | TypeHttp;
    protected _logger: LoggerInterface;
    protected _actionsManager: ActionsManager;
    protected _toolsManager: ToolsManager;
    protected constructor();
    /**
     * @inheritDoc
     */
    get isInit(): boolean;
    init(): Promise<void>;
    destroy(): void;
    abstract get auth(): AuthActions;
    get actions(): ActionsManager;
    get tools(): ToolsManager;
    /**
     * @inheritDoc
     */
    abstract getTargetOrigin(): string;
    /**
     * @inheritDoc
     */
    abstract getTargetOriginWithPath(): Map<ApiVersion, string>;
    /**
     * Calls the Bitrix24 REST API method.
     *
     * @deprecated This method is deprecated and will be removed in version `2.0.0`
     *   - for `restApi:v3` use {@link CallV3.make `b24.actions.v3.call.make(options)`}
     *   - for `restApi:v2` use {@link CallV2.make `b24.actions.v2.call.make(options)`}
     *
     * @removed 2.0.0
     * @memo Only for `restApi:v2`
     */
    callMethod(method: string, params?: object, start?: number): Promise<AjaxResult>;
    /**
     * Calls a Bitrix24 REST API list method to retrieve all data.
     *
     * @deprecated This method is deprecated and will be removed in version `2.0.0`
     *   - for `restApi:v3` use {@link CallListV3.make `b24.actions.v3.callList.make(options)`}
     *   - for `restApi:v2` use {@link CallListV2.make `b24.actions.v2.callList.make(options)`}
     *
     * @removed 2.0.0
     * @memo Only for `restApi:v2`
     */
    callListMethod(method: string, params?: object, progress?: null | ((progress: number) => void), customKeyForResult?: string | null): Promise<Result>;
    /**
     * Calls a Bitrix24 REST API list method and returns an async generator.
     *
     * @deprecated This method is deprecated and will be removed in version `2.0.0`
     *   - for `restApi:v3` use {@link FetchListV3.make `b24.actions.v3.fetchList.make(options)`}
     *   - for `restApi:v2` use {@link FetchListV2.make `b24.actions.v2.fetchList.make(options)`}
     *
     * @removed 2.0.0
     * @memo Only for `restApi:v2`
     */
    fetchListMethod(method: string, params?: any, idKey?: string, customKeyForResult?: string | null): AsyncGenerator<any[]>;
    /**
     * Executes a batch request to the Bitrix24 REST API.
     *
     * @deprecated This method is deprecated and will be removed in version `2.0.0`
     *   - for `restApi:v3` use {@link BatchV3.make `b24.actions.v3.batch.make(options)`}
     *   - for `restApi:v2` use {@link BatchV2.make `b24.actions.v2.batch.make(options)`}
     *
     * @removed 2.0.0
     * @memo Only for `restApi:v2`
     */
    callBatch(calls: Array<any> | object, isHaltOnError?: boolean, returnAjaxResult?: boolean): Promise<Result>;
    /**
     * Executes a batch request to the Bitrix24 REST API with automatic chunking for any number of commands.
     *
     * @deprecated This method is deprecated and will be removed in version `2.0.0`
     *   - for `restApi:v3` use {@link BatchByChunkV3.make `b24.actions.v3.batchByChunk.make(options)`}
     *   - for `restApi:v2` use {@link BatchByChunkV2.make `b24.actions.v2.batchByChunk.make(options)`}
     *
     * @removed 2.0.0
     * @memo Only for `restApi:v2`
     */
    callBatchByChunk(calls: Array<any>, isHaltOnError: boolean): Promise<Result>;
    /**
     * @inheritDoc
     */
    getHttpClient(version: ApiVersion): TypeHttp;
    /**
     * @inheritDoc
     */
    setHttpClient(version: ApiVersion, client: TypeHttp): void;
    setLogger(logger: LoggerInterface): void;
    getLogger(): LoggerInterface;
    /**
     * @inheritDoc
     */
    setRestrictionManagerParams(params: RestrictionParams): Promise<void>;
    /**
     * Returns settings for http connection
     * @protected
     */
    protected _getHttpOptions(): null | object;
    /**
     * Generates an object not initialized error
     * @protected
     */
    protected _ensureInitialized(): void;
}

declare class RequestIdGenerator implements IRequestIdGenerator {
    getQueryStringParameterName(): string;
    getQueryStringSdkParameterName(): string;
    getQueryStringSdkTypeParameterName(): string;
    private generate;
    getRequestId(): string;
    getHeaderFieldName(): string;
}

type AjaxResponse<T = unknown> = {
    status: number;
    payload: SuccessPayload<T>;
};
type TypePrepareParams = TypeCallParams & {
    data?: Record<string, any>;
    auth?: string;
};
/**
 * Abstract Class for working with RestApi requests via http
 *
 * @link https://bitrix24.github.io/b24jssdk/
 *
 * @todo docs
 */
declare abstract class AbstractHttp implements TypeHttp {
    protected _clientAxios: AxiosInstance;
    protected _authActions: AuthActions;
    protected _requestIdGenerator: RequestIdGenerator;
    protected _restrictionManager: RestrictionManager;
    protected _logger: LoggerInterface;
    protected _isClientSideWarning: boolean;
    protected _clientSideWarningMessage: string;
    protected _version: ApiVersion;
    protected _metrics: {
        totalRequests: number;
        successfulRequests: number;
        failedRequests: number;
        totalDuration: number;
        byMethod: Map<string, {
            count: number;
            totalDuration: number;
        }>;
        lastErrors: Array<{
            method: string;
            error: string;
            timestamp: number;
        }>;
    };
    constructor(authActions: AuthActions, options?: null | object, restrictionParams?: Partial<RestrictionParams>);
    get apiVersion(): ApiVersion;
    get ajaxClient(): AxiosInstance;
    setLogger(logger: LoggerInterface): void;
    getLogger(): LoggerInterface;
    setRestrictionManagerParams(params: RestrictionParams): Promise<void>;
    getRestrictionManagerParams(): RestrictionParams;
    /**
     * @inheritDoc
     */
    getStats(): RestrictionManagerStats & {
        adaptiveDelayAvg: number;
        errorCounts: Record<string, number>;
        totalRequests: number;
        successfulRequests: number;
        failedRequests: number;
        totalDuration: number;
        byMethod: Map<string, {
            count: number;
            totalDuration: number;
        }>;
        lastErrors: {
            method: string;
            error: string;
            timestamp: number;
        }[];
    };
    /**
     * @inheritDoc
     */
    reset(): Promise<void>;
    protected _updateMetrics(method: string, isSuccess: boolean, duration: number, error?: unknown): void;
    abstract batch<T = unknown>(calls: BatchCommandsArrayUniversal | BatchCommandsObjectUniversal | BatchNamedCommandsUniversal, options?: ICallBatchOptions): Promise<Result<ICallBatchResult<T>>>;
    protected _validateParams(requestId: string, method: string, params: TypeCallParams): void;
    /**
     * Calling the RestApi function
     * @param method - REST API method name
     * @param params - Parameters for the method.
     * @param requestId - Request id
     * @returns Promise with AjaxResult
     */
    call<T = unknown>(method: string, params: TypeCallParams, requestId?: string): Promise<AjaxResult<T>>;
    protected _convertToAjaxError(requestId: string, error: unknown, method: string, params: TypeCallParams): AjaxError;
    protected _convertAxiosErrorToAjaxError(requestId: string, axiosError: AxiosError, method: string, params: TypeCallParams): AjaxError;
    protected _convertUnknownErrorToAjaxError(requestId: string, error: unknown, method: string, params: TypeCallParams): AjaxError;
    /**
     * Performs a single call with
     * - 401 error handling
     * - rate limit check
     * - updating operating statistics
     */
    protected _executeSingleCall<T = unknown>(requestId: string, method: string, params: TypeCallParams): Promise<AjaxResult<T>>;
    protected _ensureAuth(requestId: string): Promise<AuthData>;
    protected _makeRequestWithAuthRetry<T>(requestId: string, method: string, params: TypeCallParams, authData: AuthData): Promise<AjaxResponse<T>>;
    protected _makeAxiosRequest<T>(requestId: string, method: string, params: TypeCallParams, authData: AuthData): Promise<AjaxResponse<T>>;
    protected _isAuthError(error: unknown): boolean;
    protected _createAjaxResultFromResponse<T>(response: AjaxResponse<T>, requestId: string, method: string, params: TypeCallParams): Promise<AjaxResult<T>>;
    /**
     * This works in conjunction with the AbstractHttp._convertAxiosErrorToAjaxError function
     */
    protected _createAjaxResultWithErrorFromResponse<T>(ajaxError: AjaxError, requestId: string, method: string, params: TypeCallParams): AjaxResult<T>;
    /**
     * Makes the function name safe and adds JSON format
     */
    protected abstract _prepareMethod(requestId: string, method: string, baseUrl: string): string;
    /**
     * Processes function parameters and adds authorization
     */
    protected _prepareParams(authData: AuthData, params: TypeCallParams): TypePrepareParams;
    /**
     * @inheritDoc
     */
    setClientSideWarning(value: boolean, message: string): void;
    /**
     * Tests whether the code is executed on the client side
     * @return {boolean}
     * @protected
     */
    protected isServerSide(): boolean;
    /**
     * Get the BX24 account address with the path based on the API version
     */
    getBaseUrl(): string;
    protected _sanitizeParams(params: TypeCallParams): Record<string, unknown>;
    protected _logRequest(requestId: string, method: string, params: TypeCallParams): void;
    protected _logAttempt(requestId: string, method: string, attempt: number, maxRetries: number): void;
    protected _logRefreshingAuthToken(requestId: string): void;
    protected _logAuthErrorDetected(requestId: string): void;
    protected _logSuccessfulRequest(requestId: string, method: string, duration: number): void;
    protected _logFailedRequest(requestId: string, method: string, attempt: number, maxRetries: number, error: AjaxError): void;
    protected _logAttemptRetryWaiteDelay(requestId: string, method: string, wait: number, attempt: number, maxRetries: number): void;
    protected _logAllAttemptsExhausted(requestId: string, method: string, attempt: number, maxRetries: number): void;
    protected _logBatchStart(requestId: string, calls: BatchCommandsArrayUniversal | BatchCommandsObjectUniversal | BatchNamedCommandsUniversal, options: ICallBatchOptions): void;
    protected _logBatchCompletion(requestId: string, total: number, errors: number): void;
    protected _checkClientSideWarning(requestId: string): void;
}

/**
 * Class for working with RestApi v2 requests via http
 *
 * @link https://bitrix24.github.io/b24jssdk/
 *
 * @todo docs
 */
declare class HttpV2 extends AbstractHttp implements TypeHttp {
    constructor(authActions: AuthActions, options?: null | object, restrictionParams?: Partial<RestrictionParams>);
    batch<T = unknown>(calls: BatchCommandsArrayUniversal | BatchCommandsObjectUniversal | BatchNamedCommandsUniversal, options?: ICallBatchOptions): Promise<Result<ICallBatchResult<T>>>;
    /**
     * @inheritDoc
     */
    protected _prepareMethod(requestId: string, method: string, baseUrl: string): string;
}

/**
 * Class for working with RestApi v3 requests via http
 *
 * @link https://bitrix24.github.io/b24jssdk/
 * @link https://apidocs.bitrix24.com/api-reference/rest-v3/index.html
 *
 * @todo docs
 */
declare class HttpV3 extends AbstractHttp implements TypeHttp {
    constructor(authActions: AuthActions, options?: null | object, restrictionParams?: Partial<RestrictionParams>);
    batch<T = unknown>(calls: BatchCommandsArrayUniversal | BatchCommandsObjectUniversal | BatchNamedCommandsUniversal, options?: ICallBatchOptions): Promise<Result<ICallBatchResult<T>>>;
    /**
     * @inheritDoc
     */
    protected _prepareMethod(requestId: string, method: string, baseUrl: string): string;
}

declare class FormatterNumbers {
    private static isInternalConstructing;
    private static instance;
    private _defLocale;
    private constructor();
    /**
     * @return FormatterNumbers
     */
    static getInstance(): FormatterNumbers;
    setDefLocale(locale: string): void;
    format(value: number, locale?: string): string;
}

declare class IbanSpecification {
    /**
     * the code of the country
     */
    readonly countryCode: string;
    /**
     * the length of the IBAN
     */
    readonly length: number;
    /**
     * the structure of the underlying BBAN (for validation and formatting)
     */
    readonly structure: string;
    /**
     * an example valid IBAN
     */
    readonly example: string;
    private _cachedRegex;
    constructor(countryCode: string, length: number, structure: string, example: string);
    /**
     * Check if the passed iban is valid, according to this specification.
     *
     * @param {string} iban the iban to validate
     * @returns {boolean} true if valid, false otherwise
     */
    isValid(iban: string): boolean;
    /**
     * Convert the passed IBAN to a country-specific BBAN.
     *
     * @param iban the IBAN to convert
     * @param separator the separator to use between BBAN blocks
     * @returns {string} the BBAN
     */
    toBBAN(iban: string, separator: string): string;
    /**
     * Convert the passed BBAN to an IBAN for this country specification.
     * Please note that <i>"generation of the IBAN shall be the exclusive responsibility of the bank/branch servicing the account"</i>.
     * This method implements the preferred algorithm described in http://en.wikipedia.org/wiki/International_Bank_Account_Number#Generating_IBAN_check_digits
     *
     * @param bban the BBAN to convert to IBAN
     * @returns {string} the IBAN
     */
    fromBBAN(bban: string): string;
    /**
     * Check of the passed BBAN is valid.
     * This function only checks the format of the BBAN (length and compliance with alphanumeric specifications) but does not
     * verify the check digit.
     *
     * @param bban the BBAN to validate
     * @returns {boolean} true if the passed bban is a valid BBAN, according to this specification, false otherwise
     */
    isValidBBAN(bban: string): boolean;
    /**
     * Lazy-loaded regex (parse the structure and construct the regular expression the first time we need it for validation)
     */
    private _regex;
    /**
     * Parse the BBAN structure used to configure each IBAN Specification and returns a matching regular expression.
     * A structure is composed of blocks of three characters (one letter and two digits).
     * Each block represents
     * a logical group in the typical representation of the BBAN.
     * For each group, the letter indicates which characters
     * are allowed in this group, and the following 2-digits number tells the length of the group.
     *
     * @param {string} structure the structure to parse
     * @returns {RegExp}
     */
    private _parseStructure;
    /**
     * Prepare an IBAN for mod 97 computation by moving the first 4 chars to the end and transforming the letters to
     * numbers (A = 10, B = 11, ..., Z = 35), as specified in ISO13616.
     *
     * @param {string} iban the IBAN
     * @returns {string} the prepared IBAN
     */
    private _iso13616Prepare;
    /**
     * Calculates MOD 97 10 of the passed IBAN as specified in ISO7064.
     *
     * @param iban
     * @returns {number} MOD
     */
    private _iso7064Mod9710;
}
declare class FormatterIban {
    private static isInternalConstructing;
    private static instance;
    private _countries;
    private constructor();
    /**
     * @return FormatterIban
     */
    static getInstance(): FormatterIban;
    addSpecification(IBAN: IbanSpecification): void;
    /**
     * Check if an IBAN is valid.
     *
     * @param {string} iban the IBAN to validate.
     * @returns {boolean} true if the passed IBAN is valid, false otherwise
     */
    isValid(iban: string): boolean;
    printFormat(iban: string, separator?: string): string;
    electronicFormat(iban: string): string;
    /**
     * Convert an IBAN to a BBAN.
     *
     * @param iban
     * @param {string} [separator] the separator to use between the blocks of the BBAN, defaults to ' '
     * @returns {string|*} Convert an IBAN to a BBAN.
     */
    toBBAN(iban: string, separator?: string): string;
    /**
     * Convert the passed BBAN to an IBAN for this country specification.
     * Please note that <i>"generation of the IBAN shall be the exclusive responsibility of the bank/branch servicing the account"</i>.
     * This method implements the preferred algorithm described in http://en.wikipedia.org/wiki/International_Bank_Account_Number#Generating_IBAN_check_digits
     *
     * @param countryCode the country of the BBAN
     * @param bban the BBAN to convert to IBAN
     * @returns {string} the IBAN
     */
    fromBBAN(countryCode: string, bban: string): string;
    /**
     * Check the validity of the passed BBAN.
     *
     * @param countryCode the country of the BBAN
     * @param bban the BBAN to check the validity of
     */
    isValidBBAN(countryCode: string, bban: string): boolean;
}

declare const useFormatter: () => {
    formatterNumber: FormatterNumbers;
    formatterIban: FormatterIban;
};

/**
 * B24.Hook Manager.
 *
 * @link https://bitrix24.github.io/b24jssdk/docs/hook/
 *
 * @todo docs
 */
declare class B24Hook extends AbstractB24 implements TypeB24 {
    #private;
    constructor(b24HookParams: B24HookParams, options?: {
        restrictionParams?: Partial<RestrictionParams>;
    });
    get auth(): AuthActions;
    /**
     * Disables warning about client-side query execution
     */
    offClientSideWarning(): void;
    /**
     * @inheritDoc
     */
    getTargetOrigin(): string;
    /**
     * @inheritDoc
     */
    getTargetOriginWithPath(): Map<ApiVersion, string>;
    /**
     * Init Webhook from url
     *   - ver2 `https://your_domain.bitrix24.com/rest/{id}/{webhook}`
     *   - ver3 `https://your_domain.bitrix24.com/rest/api/{id}/{webhook}`
     *
     * @todo docs
     */
    static fromWebhookUrl(url: string, options?: {
        restrictionParams?: Partial<RestrictionParams>;
    }): B24Hook;
}

/**
 * Authorization Manager
 */
declare class AuthHookManager implements AuthActions {
    #private;
    constructor(b24HookParams: B24HookParams);
    /**
     * @see Http.#prepareParams
     */
    getAuthData(): false | AuthData;
    refreshAuth(): Promise<AuthData>;
    getUniq(prefix: string): string;
    /**
     * @inheritDoc
     */
    getTargetOrigin(): string;
    /**
     * Get the account address BX24 with path
     *   - ver2 `https://your_domain.bitrix24.com/rest/{id}/{webhook}`
     *   - ver3` https://your_domain.bitrix24.com/rest/api/{id}/{webhook}`
     */
    getTargetOriginWithPath(): Map<ApiVersion, string>;
    /**
     * We believe that hooks are created only by the admin
     */
    get isAdmin(): boolean;
}

/**
 * List of commands for the B24 parent window
 */
declare enum MessageCommands {
    getInitData = "getInitData",
    setInstallFinish = "setInstallFinish",
    setInstall = "setInstall",
    refreshAuth = "refreshAuth",
    setAppOption = "setAppOption",
    setUserOption = "setUserOption",
    resizeWindow = "resizeWindow",
    reloadWindow = "reloadWindow",
    setTitle = "setTitle",
    setScroll = "setScroll",
    openApplication = "openApplication",
    closeApplication = "closeApplication",
    openPath = "openPath",
    imCallTo = "imCallTo",
    imPhoneTo = "imPhoneTo",
    imOpenMessenger = "imOpenMessenger",
    imOpenHistory = "imOpenHistory",
    selectUser = "selectUser",
    selectAccess = "selectAccess",
    selectCRM = "selectCRM",
    /**
     * @memo this not work. Need test
     */
    showAppForm = "showAppForm",
    getInterface = "getInterface",
    placementBindEvent = "placementBindEvent"
}

/**
 * Application Frame Data Manager
 */
declare class AppFrame {
    #private;
    constructor(queryParams: B24FrameQueryParams);
    /**
     * Initializes the data received from the parent window message.
     * @param data
     */
    initData(data: MessageInitData): AppFrame;
    /**
     * Returns the sid of the application relative to the parent window like this `9c33468728e1d2c8c97562475edfd96`
     */
    getAppSid(): string;
    /**
     * Get the account address BX24 (https://your_domain.bitrix24.com)
     */
    getTargetOrigin(): string;
    /**
     * Get the account address BX24 with path
     *   - ver2 `https://your_domain.bitrix24.com/rest/`
     *   - ver3` https://your_domain.bitrix24.com/rest/api/`
     */
    getTargetOriginWithPath(): Map<ApiVersion, string>;
    /**
     * Returns the localization of the B24 interface
     * @return {B24LangList} - default `B24LangList.en`
     *
     * @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/bx24-get-lang.html
     */
    getLang(): B24LangList;
}

/**
 * Parent Window Request Parameters
 * - `isRawValue?: boolean` if true then JSON.stringify will not be executed
 * - `isSafely?: boolean` auto completion mode Promise.resolve()
 * - `safelyTime?: number` after what time (900 ms) should it be automatically resolved Promise
 * - `callBack?: () => void` for placement event
 * - `requestId?: string` Unique request identifier for tracking. Used for query deduplication and debugging.
 */
interface SendParams {
    isRawValue?: boolean;
    isSafely?: boolean;
    safelyTime?: number;
    callBack?: (...args: any[]) => void;
    requestId?: string;
    [index: string]: any;
}
/**
 * Parent Window Communication Manager at B24
 */
declare class MessageManager {
    #private;
    protected _logger: LoggerInterface;
    private readonly runCallbackHandler;
    constructor(appFrame: AppFrame);
    setLogger(logger: LoggerInterface): void;
    getLogger(): LoggerInterface;
    /**
     * Subscribe to the onMessage event of the parent window
     */
    subscribe(): void;
    /**
     * Unsubscribe from the onMessage event of the parent window
     */
    unsubscribe(): void;
    /**
     * Send message to parent window
     * The answer (if) we will get in _runCallback
     *
     * @param command
     * @param params
     */
    send(command: string | MessageCommands, params?: null | SendParams): Promise<any>;
    /**
     * Fulfilling a promise based on messages from the parent window
     *
     * @param event
     * @private
     */
    _runCallback(event: MessageEvent): void;
}

/**
 * Parent window manager
 *
 * @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/
 */
declare class ParentManager {
    #private;
    constructor(messageManager: MessageManager);
    get message(): MessageManager;
    /**
     * The method closes the open modal window with the application
     *
     * @return {Promise<void>}
     *
     * @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/bx24-close-application.html
     */
    closeApplication(): Promise<void>;
    /**
     * Sets the size of the frame containing the application to the size of the frame's content.
     *
     * @return {Promise<void>}
     *
     * @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/bx24-fit-window.html
     *
     * @memo in certain situations it may not be executed (placement of the main window after installing the application), in this case isSafely mode will work
     */
    fitWindow(): Promise<any>;
    /**
     * Sets the size of the frame containing the application to the size of the frame's content.
     *
     * @param {number} width
     * @param {number} height
     *
     * @return {Promise<void>}
     *
     * @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/bx24-resize-window.html
     *
     * @memo in certain situations it may not be executed, in this case isSafely mode will be triggered
     */
    resizeWindow(width: number, height: number): Promise<void>;
    /**
     * Automatically resize `document.body` of frame with application according to frame content dimensions
     * If you pass appNode, the height will be calculated relative to it
     *
     * @param {HTMLElement|null} appNode
     * @param {number} minHeight
     * @param {number} minWidth
     *
     * @return {Promise<void>}
     */
    resizeWindowAuto(appNode?: null | HTMLElement, minHeight?: number, minWidth?: number): Promise<void>;
    /**
     * This function returns the inner dimensions of the application frame
     *
     * @return {Promise<{scrollWidth: number; scrollHeight: number}>}
     *
     * @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/bx24-get-scroll-size.html
     */
    getScrollSize(): {
        scrollWidth: number;
        scrollHeight: number;
    };
    /**
     * Scrolls the parent window
     *
     * @param {number} scroll should specify the vertical scrollbar position (0 - scroll to the very top)
     * @return {Promise<void>}
     *
     * @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/bx24-scroll-parent-window.html
     */
    scrollParentWindow(scroll: number): Promise<void>;
    /**
     * Reload the page with the application (the whole page, not just the frame).
     *
     * @return {Promise<void>}
     *
     * @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/bx24-reload-window.html
     */
    reloadWindow(): Promise<void>;
    /**
     * Set Page Title
     *
     * @param {string} title
     *
     * @return {Promise<void>}
     *
     * @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/bx24-set-title.html
     */
    setTitle(title: string): Promise<void>;
    /**
     * Initiates a call via internal communication
     *
     * @param {number} userId The identifier of the account user
     * @param {boolean} isVideo true - video call, false - audio call. Optional parameter.
     *
     * @return {Promise<void>}
     *
     * @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/bx24-im-call-to.html
     */
    imCallTo(userId: number, isVideo?: boolean): Promise<void>;
    /**
     * Makes a call to the phone number
     *
     * @param {string} phone Phone number. The number can be in the format: `+44 20 1234 5678` or `x (xxx) xxx-xx-xx`
     *
     * @return {Promise<void>}
     *
     * @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/bx24-im-phone-to.html
     */
    imPhoneTo(phone: string): Promise<void>;
    /**
     * Opens the messenger window
     * userId or chatXXX - chat, where XXX is the chat identifier, which can simply be a number.
     * sgXXX - group chat, where XXX is the social network group number (the chat must be enabled in this group).
     *
     * XXXX** - open line, where XXX is the code obtained via the Rest method imopenlines.network.join.
     *
     * If nothing is passed, the chat interface will open with the last opened dialog.
     *
     * @param {number|`chat${number}`|`sg${number}`|`imol|${number}`|undefined} dialogId
     *
     * @return {Promise<void>}
     *
     * @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/bx24-im-open-messenger.html
     * @link https://dev.1c-bitrix.ru/learning/course/index.php?COURSE_ID=93&LESSON_ID=20152&LESSON_PATH=7657.7883.8025.20150.20152
     *
     */
    imOpenMessenger(dialogId: number | `chat${number}` | `sg${number}` | `imol|${number}` | undefined): Promise<void>;
    /**
     * Opens the history window
     * Identifier of the dialog:
     *
     * userId or chatXXX - chat, where XXX is the chat identifier, which can simply be a number.
     * imol|XXXX - open line, where XXX is the session number of the open line.
     *
     * @param {number|`chat${number}`|`imol|${number}`} dialogId
     *
     * @return {Promise<void>}
     *
     * @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/bx24-im-open-history.html
     */
    imOpenHistory(dialogId: number | `chat${number}` | `imol|${number}`): Promise<void>;
}

/**
 * Manager for working with application settings via communication with the parent window
 *
 * @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/options/index.html
 */
declare class OptionsManager$1 {
    #private;
    constructor(messageManager: MessageManager);
    /**
     * Initializes the data received from the parent window message.
     * @param data
     */
    initData(data: MessageInitData): OptionsManager$1;
    /**
     * Getting application option
     *
     * @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/options/bx24-app-option-get.html
     */
    appGet(option: string): any;
    /**
     * Updates application data through the parent window
     *
     * @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/options/bx24-app-option-set.html
     */
    appSet(option: string, value: any): Promise<void>;
    /**
     * Getting user option
     *
     * @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/options/bx24-user-option-get.html
     */
    userGet(option: string): any;
    /**
     * Updates user data through the parent window
     *
     * @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/options/bx24-user-option-set.html
     */
    userSet(option: string, value: any): Promise<void>;
}

type SelectedUser = {
    /**
     * user identifier
     */
    id: NumberString;
    /**
     * formatted username
     */
    name: string;
    photo: string;
    position: string;
    url: string;
    /**
     * The flag indicates that the selected user is a subordinate of the current user
     */
    sub: boolean;
    /**
     * The flag indicates that the selected user is the manager of the current user
     */
    sup: boolean;
};
type SelectedAccess = {
    /**
     * access permission identifier. Examples of identifiers:
     * - U1 — user with identifier 1
     * - IU1 — employees with identifier 1
     * - DR2 — all department and subdepartment employees with identifier 2
     * - D6 — all department employees with identifier 6
     * - G2 — group with identifier 2 (all visitors)
     * - SG4 — social network group with identifier 4
     * - AU — all authorized users
     * - CR — current user
     */
    id: `AU` | `CR` | `U${number}` | `IU${number}` | `DR${number}` | `D${number}` | `G${number}` | `SG${number}`;
    /**
     * name of the access permission
     */
    name: string;
};
type SelectCRMParamsEntityType = 'lead' | 'contact' | 'company' | 'deal' | 'quote';
type SelectCRMParamsValue = {
    lead?: number[];
    contact?: number[];
    company?: number[];
    deal?: number[];
    quote?: number[];
};
type SelectCRMParams = {
    /**
     * Which types of objects to display in the dialog. Possible values:
     * - lead — Leads
     * - contact — Contacts
     * - company — Companies
     * - deal — Deals
     * - quote — Estimates
     */
    entityType: SelectCRMParamsEntityType[];
    /**
     * Whether multiple objects can be selected. Default is `false`
     */
    multiple: boolean;
    /**
     * Which objects to initially add to the selected in the dialog. Works only if `multiple = true`
     */
    value?: SelectCRMParamsValue;
};
type SelectedCRMEntity = {
    id: string;
    type: SelectCRMParamsEntityType;
    place: string;
    title: string;
    desc: string;
    url: string;
};
type SelectedCRM = {
    lead?: (SelectedCRMEntity & {
        id: `L_${number}`;
    })[];
    contact?: (SelectedCRMEntity & {
        id: `C_${number}`;
        image: string;
    })[];
    company?: (SelectedCRMEntity & {
        id: `CO_${number}`;
        image: string;
    })[];
    deal?: (SelectedCRMEntity & {
        id: `D_${number}`;
    })[];
    quote?: (SelectedCRMEntity & {
        id: `Q_${number}`;
    })[];
};
/**
 * Select dialog manager
 *
 * @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/system-dialogues/index.html
 */
declare class DialogManager {
    #private;
    constructor(messageManager: MessageManager);
    /**
     * Method displays the standard single user selection dialog
     * It only shows company employees
     *
     * @return {Promise<null|SelectedUser>}
     *
     * @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/system-dialogues/bx24-select-user.html
     */
    selectUser(): Promise<null | SelectedUser>;
    /**
     * Method displays the standard multiple user selection dialog
     * It only shows company employees
     *
     * @return {Promise<SelectedUser[]>}
     *
     * @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/system-dialogues/bx24-select-users.html
     */
    selectUsers(): Promise<SelectedUser[]>;
    /**
     * Method displays a standard access permission selection dialog
     *
     * @param {string[]} blockedAccessPermissions
     * @return {Promise<SelectedAccess[]>}
     *
     * @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/system-dialogues/bx24-select-access.html
     */
    selectAccess(blockedAccessPermissions?: string[]): Promise<SelectedAccess[]>;
    /**
     * Method invokes the system dialog for selecting a CRM entity
     *
     * @param {SelectCRMParams} params
     * @return {Promise<SelectedCRM>}
     *
     * @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/system-dialogues/bx24-select-crm.html
     */
    selectCRM(params?: SelectCRMParams): Promise<SelectedCRM>;
}

/**
 * Sliders Manager
 */
declare class SliderManager {
    #private;
    constructor(appFrame: AppFrame, messageManager: MessageManager);
    /**
     * Returns the URL relative to the domain name and path
     */
    getUrl(path?: string): URL;
    /**
     * Get the account address BX24
     */
    getTargetOrigin(): string;
    /**
     * When the method is called, a pop-up window with the application frame will be opened.
     *
     * @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/bx24-open-application.html
     */
    openSliderAppPage(params?: any): Promise<any>;
    /**
     * The method closes the open modal window with the application
     *
     * @return {Promise<void>}
     *
     * @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/bx24-close-application.html
     */
    closeSliderAppPage(): Promise<void>;
    /**
     * Opens the specified path inside the portal in the slider.
     * @param {URL} url
     * @param {number} width - Number in the range from 1640 to 1200, from 1200 to 950, from 950 to 900, from 900 ...
     * @return {Promise<StatusClose>}
     *
     * @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/bx24-open-path.html
     * @memo /^\/(crm\/(deal|lead|contact|company|type)|marketplace|company\/personal\/user\/[0-9]+|workgroups\/group\/[0-9]+)\//
     */
    openPath(url: URL, width?: number): Promise<StatusClose>;
}

/**
 * Placement Manager
 *
 * @see https://apidocs.bitrix24.com/api-reference/widgets/ui-interaction/index.html
 */
declare class PlacementManager {
    #private;
    constructor(messageManager: MessageManager);
    /**
     * Initializes the data received from the parent window message.
     * @param data
     */
    initData(data: MessageInitData): PlacementManager;
    /**
     * Symlink on `placement`
     * For backward compatibility
     */
    get title(): string;
    get placement(): string;
    get isDefault(): boolean;
    get options(): any;
    get isSliderMode(): boolean;
    /**
     * Get Information About the JS Interface of the Current Embedding Location
     *
     * @return {Promise<any>}
     *
     * @link https://apidocs.bitrix24.com/api-reference/widgets/ui-interaction/bx24-placement-get-interface.html
     */
    getInterface(): Promise<any>;
    /**
     * Set Up the Interface Event Handler
     * @param {string} eventName
     * @param {(...args: any[]) => void} callBack
     * @return {Promise<any>}
     *
     * @link https://apidocs.bitrix24.com/api-reference/widgets/ui-interaction/bx24-placement-bind-event.html
     */
    bindEvent(eventName: string, callBack: (...args: any[]) => void): Promise<any>;
    /**
     * Call the Registered Interface Command
     * @param { string } command
     * @param { Record<string, any> } parameters
     * @return { Promise<any> }
     *
     * @link https://apidocs.bitrix24.com/api-reference/widgets/ui-interaction/bx24-placement-call.html
     * @memo For the `setValue` command, use the following parameters { value: string }
     */
    call(command: string, parameters?: Record<string, any>): Promise<any>;
    /**
     * Set Up the Interface Event Handler
     * @param {string} command
     * @param {null | string | Record<string, any>} parameters
     * @param {(...args: any[]) => void} callBack
     *
     * @return {Promise<any>}
     */
    callCustomBind(command: string, parameters: (null | string | Record<string, any>) | undefined, callBack: (...args: any[]) => void): Promise<any>;
}

/**
 * B24 Manager. Replacement api.bitrix24.com
 *
 * @link https://api.bitrix24.com/api/v1/
 * @link https://bitrix24.github.io/b24jssdk/docs/frame/
 * @see /bitrix/js/rest/applayout.js
 *
 * @todo add docs
 */
declare class B24Frame extends AbstractB24 implements TypeB24 {
    #private;
    constructor(queryParams: B24FrameQueryParams, options?: {
        restrictionParams?: Partial<RestrictionParams>;
    });
    setLogger(logger: LoggerInterface): void;
    get isFirstRun(): boolean;
    get isInstallMode(): boolean;
    get parent(): ParentManager;
    get auth(): AuthActions;
    get slider(): SliderManager;
    get placement(): PlacementManager;
    get options(): OptionsManager$1;
    get dialog(): DialogManager;
    init(): Promise<void>;
    /**
     * Destructor.
     * Removes an event subscription
     */
    destroy(): void;
    /**
     * Signals that the installer or application setup has finished running.
     *
     * @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/system-functions/bx24-install-finish.html
     */
    installFinish(): Promise<any>;
    /**
     * @inheritDoc
     */
    getTargetOrigin(): string;
    /**
     * @inheritDoc
     */
    getTargetOriginWithPath(): Map<ApiVersion, string>;
    /**
     * Returns the sid of the application relative to the parent window like this `9c33468728e1d2c8c97562475edfd96`
     */
    getAppSid(): string;
    /**
     * Returns the localization of the B24 interface
     *
     * @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/bx24-get-lang.html
     */
    getLang(): B24LangList;
}

/**
 * Authorization Manager
 */
declare class AuthManager implements AuthActions {
    #private;
    constructor(appFrame: AppFrame, messageManager: MessageManager);
    /**
     * Initializes the data received from the parent window message.
     * @param data
     */
    initData(data: MessageInitData): AuthManager;
    /**
     * Returns authorization data
     *
     * @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/system-functions/bx24-get-auth.html
     */
    getAuthData(): false | AuthData;
    /**
     * Updates authorization data through the parent window
     *
     * @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/system-functions/bx24-refresh-auth.html
     */
    refreshAuth(): Promise<AuthData>;
    getUniq(prefix: string): string;
    /**
     * Determines whether the current user has administrator rights
     *
     * @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/bx24-is-admin.html
     */
    get isAdmin(): boolean;
    /**
     * @inheritDoc
     */
    getTargetOrigin(): string;
    /**
     * @inheritDoc
     */
    getTargetOriginWithPath(): Map<ApiVersion, string>;
}

declare class RefreshTokenError extends SdkError {
}

/**
 * OAuth Authorization Manager
 *
 * @link https://apidocs.bitrix24.com/settings/oauth/index.html
 * @link https://bitrix24.github.io/b24jssdk/docs/oauth/
 */
declare class AuthOAuthManager implements AuthActions {
    #private;
    constructor(b24OAuthParams: B24OAuthParams, oAuthSecret: B24OAuthSecret);
    /**
     * Returns authorization data
     * @see Http.#prepareParams
     */
    getAuthData(): false | AuthData;
    /**
     * Updates authorization data
     */
    refreshAuth(): Promise<AuthData>;
    setCallbackRefreshAuth(cb: CallbackRefreshAuth): void;
    removeCallbackRefreshAuth(): void;
    setCustomRefreshAuth(cb: CustomRefreshAuth): void;
    removeCustomRefreshAuth(): void;
    getUniq(prefix: string): string;
    /**
     * @inheritDoc
     */
    getTargetOrigin(): string;
    /**
     * @inheritDoc
     */
    getTargetOriginWithPath(): Map<ApiVersion, string>;
    /**
     * Determines whether the current user has administrator rights
     */
    get isAdmin(): boolean;
    initIsAdmin(http: TypeHttp, requestId?: string): Promise<void>;
}

/**
 * B24.OAuth Manager
 *
 * @link https://apidocs.bitrix24.com/settings/oauth/index.html
 * @link https://bitrix24.github.io/b24jssdk/docs/oauth/
 *
 * @todo add docs
 */
declare class B24OAuth extends AbstractB24 implements TypeB24 {
    #private;
    constructor(authOptions: B24OAuthParams, oAuthSecret: B24OAuthSecret, options?: {
        restrictionParams?: Partial<RestrictionParams>;
    });
    /**
     * Used to initialize information about the current user.
     *
     * @todo test this
     */
    initIsAdmin(requestId?: string): Promise<void>;
    /**
     * Sets an asynchronous Callback to receive updated authorization data
     * @param cb
     */
    setCallbackRefreshAuth(cb: CallbackRefreshAuth): void;
    /**
     * Removes Callback to receive updated authorization data
     */
    removeCallbackRefreshAuth(): void;
    /**
     * Sets an asynchronous function for custom get new refresh token
     * @param cb
     */
    setCustomRefreshAuth(cb: CustomRefreshAuth): void;
    /**
     * Removes function for custom get new refresh token
     */
    removeCustomRefreshAuth(): void;
    /**
     * Disables warning about client-side query execution
     */
    offClientSideWarning(): void;
    get auth(): AuthActions;
    /**
     * @inheritDoc
     */
    getTargetOrigin(): string;
    /**
     * @inheritDoc
     */
    getTargetOriginWithPath(): Map<ApiVersion, string>;
}

declare abstract class AbstractHelper {
    protected _b24: TypeB24;
    protected _data: any;
    protected _logger: LoggerInterface;
    constructor(b24: TypeB24);
    setLogger(logger: LoggerInterface): void;
    getLogger(): LoggerInterface;
    /**
     * Initializes the data received
     */
    initData(_data: any): Promise<void>;
    abstract get data(): any;
}

declare class ProfileManager extends AbstractHelper {
    protected _data: null | TypeUser;
    /**
     * @inheritDoc
     */
    initData(data: TypeUser): Promise<void>;
    get data(): TypeUser;
}

declare class AppManager extends AbstractHelper {
    protected _data: null | TypeApp;
    /**
     * @inheritDoc
     */
    initData(data: TypeApp): Promise<void>;
    get data(): TypeApp;
    get statusCode(): string;
}

declare class PaymentManager extends AbstractHelper {
    protected _data: null | TypePayment;
    /**
     * @inheritDoc
     */
    initData(data: TypePayment): Promise<void>;
    get data(): TypePayment;
}

declare class LicenseManager extends AbstractHelper {
    protected _data: null | TypeLicense;
    /**
     * @inheritDoc
     */
    initData(data: TypeLicense): Promise<void>;
    get data(): TypeLicense;
    /**
     * Set RestrictionManager params by license
     * @link https://apidocs.bitrix24.com/api-reference/common/system/app-info.html
     */
    makeRestrictionManagerParams(): Promise<void>;
}

type CurrencyFormatInit = {
    DECIMALS: NumberString;
    DEC_POINT: string;
    FORMAT_STRING: string;
    FULL_NAME: string;
    HIDE_ZERO: BoolString;
    THOUSANDS_SEP?: string;
    THOUSANDS_VARIANT: string;
};
type CurrencyInit = {
    AMOUNT: NumberString;
    AMOUNT_CNT: NumberString;
    BASE: BoolString;
    CURRENCY: string;
    DATE_UPDATE: ISODate;
    DECIMALS: NumberString;
    DEC_POINT: string;
    FORMAT_STRING: string;
    FULL_NAME: string;
    LID: string;
    SORT: NumberString;
    THOUSANDS_SEP?: string;
    LANG?: Record<string, CurrencyFormatInit>;
};
type CurrencyInitData = {
    currencyBase: string;
    currencyList: CurrencyInit[];
};
type CurrencyData = {
    currencyBase: string;
    currencyList: Map<string, Currency>;
};
declare class CurrencyManager extends AbstractHelper {
    /**
     * @inheritDoc
     */
    initData(data: CurrencyInitData): Promise<void>;
    loadData(): Promise<void>;
    get data(): CurrencyData;
    setBaseCurrency(currencyBase: string): void;
    get baseCurrency(): string;
    setCurrencyList(list?: CurrencyInit[]): void;
    getCurrencyFullName(currencyCode: string, langCode: string): string;
    getCurrencyLiteral(currencyCode: string, langCode?: string): string;
    get currencyList(): string[];
    format(value: number, currencyCode: string, langCode: string): string;
}

declare class OptionsManager extends AbstractHelper {
    protected _data: Map<string, any>;
    protected _type: 'app' | 'user';
    static getSupportTypes(): TypeOption[];
    static prepareArrayList(list: any): any[];
    constructor(b24: TypeB24, type: 'app' | 'user');
    get data(): Map<string, any>;
    reset(): void;
    /**
     * @inheritDoc
     */
    initData(data: any): Promise<void>;
    getJsonArray(key: string, defValue?: any[]): any[];
    getJsonObject(key: string, defValue?: object): object;
    getFloat(key: string, defValue?: number): number;
    getInteger(key: string, defValue?: number): number;
    getBoolYN(key: string, defValue?: boolean): boolean;
    getBoolNY(key: string, defValue?: boolean): boolean;
    getString(key: string, defValue?: string): string;
    getDate(key: string, defValue?: null | DateTime): null | DateTime;
    encode(value: any): string;
    decode(data: string, defaultValue: any): any;
    protected getMethodSave(): string;
    save(options: any, optionsPull?: {
        moduleId: string;
        command: string;
        params: any;
    }, requestId?: string): Promise<Result>;
}

/**
 * A universal class that is used to manage the initial application data
 */
declare class B24HelperManager {
    private readonly _b24;
    private _isInit;
    private _profile;
    private _app;
    private _payment;
    private _license;
    private _currency;
    private _appOptions;
    private _userOptions;
    private _b24PullClient;
    private _pullClientUnSubscribe;
    private _pullClientModuleId;
    protected _logger: LoggerInterface;
    constructor(b24: TypeB24);
    setLogger(logger: LoggerInterface): void;
    getLogger(): LoggerInterface;
    destroy(): void;
    loadData(dataTypes?: LoadDataType[], requestId?: string): Promise<void>;
    private parseUserData;
    private parseAppData;
    private parsePaymentData;
    private parseLicenseData;
    private parseCurrencyData;
    private parseOptionsData;
    get isInit(): boolean;
    get forB24Form(): TypeB24Form;
    /**
     * Get the account address BX24 (https://your_domain.bitrix24.com)
     */
    get hostName(): string;
    get profileInfo(): ProfileManager;
    get appInfo(): AppManager;
    get paymentInfo(): PaymentManager;
    get licenseInfo(): LicenseManager;
    get currency(): CurrencyManager;
    get appOptions(): OptionsManager;
    get userOptions(): OptionsManager;
    get isSelfHosted(): boolean;
    /**
     * Returns the increment step of fields of type ID
     * @memo in a cloud step = 2 in box step = 1
     *
     * @returns {number}
     */
    get primaryKeyIncrementValue(): number;
    /**
     * Defines specific URLs for a Bitrix24 box or cloud
     */
    get b24SpecificUrl(): Record<keyof typeof TypeSpecificUrl, string>;
    usePullClient(prefix?: string, userId?: number): B24HelperManager;
    private initializePullClient;
    subscribePullClient(callback: (message: TypePullMessage) => void, moduleId?: string): B24HelperManager;
    startPullClient(): void;
    getModuleIdPullClient(): string;
    private _destroyPullClient;
    private ensureInitialized;
}

declare const useB24Helper: () => {
    initB24Helper: ($b24: TypeB24, dataTypes?: LoadDataType[], requestId?: string) => Promise<B24HelperManager>;
    isInitB24Helper: () => boolean;
    destroyB24Helper: () => void;
    getB24Helper: () => B24HelperManager;
    usePullClient: () => void;
    useSubscribePullClient: (callback: (message: TypePullMessage) => void, moduleId?: string) => void;
    startPullClient: () => void;
};

declare class PullClient implements ConnectorParent {
    private _logger;
    private _restClient;
    private _status;
    private _context;
    private readonly _guestMode;
    private readonly _guestUserId;
    private _userId;
    private _configGetMethod;
    private _getPublicListMethod;
    private _siteId;
    private _enabled;
    private _unloading;
    private _starting;
    private _debug;
    private _connectionAttempt;
    private _connectionType;
    private _skipStorageInit;
    private _skipCheckRevision;
    private _subscribers;
    private _watchTagsQueue;
    private _watchUpdateInterval;
    private _watchForceUpdateInterval;
    private _configTimestamp;
    private _session;
    private _connectors;
    private _isSecure;
    private _config;
    private _storage;
    private _sharedConfig;
    private _channelManager;
    private _jsonRpcAdapter;
    /**
     * @depricate
     */
    private _reconnectTimeout;
    private _restartTimeout;
    private _restoreWebSocketTimeout;
    private _checkInterval;
    private _offlineTimeout;
    private _watchUpdateTimeout;
    private _pingWaitTimeout;
    private _isManualDisconnect;
    private _loggingEnabled;
    private _onPingTimeoutHandler;
    private _userStatusCallbacks;
    private _connectPromise;
    private _startingPromise;
    /**
     * @param params
     */
    constructor(params: TypePullClientParams);
    setLogger(logger: LoggerInterface): void;
    getLogger(): LoggerInterface;
    destroy(): void;
    private init;
    get connector(): null | TypeConnector;
    get status(): PullStatus;
    /**
     * @param status
     */
    set status(status: PullStatus);
    get session(): TypePullClientSession;
    /**
     * Creates a subscription to incoming messages.
     *
     * @param {TypeSubscriptionOptions | TypeSubscriptionCommandHandler} params
     * @returns { () => void } - Unsubscribe callback function
     */
    subscribe(params: TypeSubscriptionOptions | TypeSubscriptionCommandHandler): () => void;
    /**
     * @param {TypeSubscriptionCommandHandler} handler
     * @returns {() => void} - Unsubscribe callback function
     */
    private attachCommandHandler;
    /**
     * @param config
     */
    start(config?: null | (TypePullClientConfig & {
        skipReconnectToLastSession?: boolean;
    })): Promise<boolean>;
    /**
     * @param disconnectCode
     * @param disconnectReason
     */
    restart(disconnectCode?: number | CloseReasons, disconnectReason?: string): void;
    stop(disconnectCode?: number | CloseReasons, disconnectReason?: string): void;
    reconnect(disconnectCode: number | CloseReasons, disconnectReason: string, delay?: number): void;
    /**
     * @param lastMessageId
     */
    setLastMessageId(lastMessageId: string): void;
    /**
     * Send a single message to the specified users.
     *
     * @param users User ids of the message receivers.
     * @param moduleId Name of the module to receive a message,
     * @param command Command name.
     * @param {object} params Command parameters.
     * @param [expiry] Message expiry time in seconds.
     * @return {Promise}
     */
    sendMessage(users: number[], moduleId: string, command: string, params: any, expiry?: number): Promise<any>;
    /**
     * Send a single message to the specified public channels.
     *
     * @param  publicChannels Public ids of the channels to receive a message.
     * @param moduleId Name of the module to receive a message,
     * @param command Command name.
     * @param {object} params Command parameters.
     * @param [expiry] Message expiry time in seconds.
     * @return {Promise}
     */
    sendMessageToChannels(publicChannels: string[], moduleId: string, command: string, params: any, expiry?: number): Promise<any>;
    /**
     * @param debugFlag
     */
    capturePullEvent(debugFlag?: boolean): void;
    /**
     * @param loggingFlag
     */
    enableLogging(loggingFlag?: boolean): void;
    /**
     * Returns list channels that the connection is subscribed to.
     *
     * @returns {Promise}
     */
    listChannels(): Promise<any>;
    /**
     * Returns "last seen" time in seconds for the users.
     * Result format: Object{userId: int}
     * If the user is currently connected - will return 0.
     * If the user is offline - will return the diff between the current timestamp and the last seen timestamp in seconds.
     * If the user was never online - the record for the user will be missing from the result object.
     *
     * @param {integer[]} userList List of user ids.
     * @returns {Promise}
     */
    getUsersLastSeen(userList: number[]): Promise<Record<number, number>>;
    /**
     * Pings server.
     * In case of success promise will be resolved, otherwise - rejected.
     *
     * @param {number} timeout Request timeout in seconds
     * @returns {Promise}
     */
    ping(timeout?: number): Promise<void>;
    /**
     * @param userId {number}
     * @param callback {UserStatusCallback}
     * @returns {Promise}
     */
    subscribeUserStatusChange(userId: number, callback: UserStatusCallback): Promise<void>;
    /**
     * @param {number} userId
     * @param {UserStatusCallback} callback
     * @returns {Promise}
     */
    unsubscribeUserStatusChange(userId: number, callback: UserStatusCallback): Promise<void>;
    getRevision(): number | null;
    getServerVersion(): number;
    getServerMode(): string | null;
    getConfig(): null | TypePullClientConfig;
    getDebugInfo(): any;
    /**
     * @process
     * @param connectionType
     */
    getConnectionPath(connectionType: ConnectionType): string;
    /**
     * @process
     */
    getPublicationPath(): string;
    isConnected(): boolean;
    isWebSocketSupported(): boolean;
    isWebSocketAllowed(): boolean;
    isWebSocketEnabled(): boolean;
    isPublishingSupported(): boolean;
    isPublishingEnabled(): boolean;
    isProtobufSupported(): boolean;
    isJsonRpc(): boolean;
    isSharedMode(): boolean;
    /**
     * @param {TypePullClientEmitConfig} params
     * @returns {boolean}
     */
    private emit;
    /**
     * @process
     *
     * @param message
     */
    private broadcastMessage;
    /**
     * @process
     *
     * @param messages
     */
    private broadcastMessages;
    /**
     * Sends batch of messages to the multiple public channels.
     *
     * @param messageBatchList Array of messages to send.
     * @return void
     */
    private sendMessageBatch;
    /**
     * @param messageBatchList
     * @param publicIds
     */
    private encodeMessageBatch;
    /**
     * @memo fix return type
     * @param users
     * @param publicIds
     */
    private createMessageReceivers;
    /**
     * @param userId
     * @param isOnline
     */
    private emitUserStatusChange;
    private restoreUserStatusSubscription;
    private loadConfig;
    /**
     * @param config
     */
    private isConfigActual;
    private startCheckConfig;
    private stopCheckConfig;
    private checkConfig;
    /**
     * @param config
     * @param allowCaching
     */
    private setConfig;
    private setPublicIds;
    /**
     * @param serverRevision
     */
    private checkRevision;
    private disconnect;
    private restoreWebSocketConnection;
    /**
     * @param connectionDelay
     */
    private scheduleReconnect;
    private scheduleRestoreWebSocketConnection;
    /**
     * @returns {Promise}
     */
    private connect;
    /**
     * @param disconnectCode
     * @param disconnectReason
     * @param restartDelay
     */
    private scheduleRestart;
    /**
     * @param messageFields
     */
    private handleRpcIncomingMessage;
    /**
     * @param events
     */
    private handleIncomingEvents;
    /**
     * @param event
     */
    private updateSessionFromEvent;
    /**
     * @process
     *
     * @param command
     * @param message
     */
    private handleInternalPullEvent;
    /**
     * @param response
     */
    private onIncomingMessage;
    private onLongPollingOpen;
    /**
     * @param response
     */
    private onLongPollingDisconnect;
    /**
     * @param error
     */
    private onLongPollingError;
    /**
     * @param response
     */
    private onWebSocketBlockChanged;
    private onWebSocketOpen;
    /**
     * @param response
     */
    private onWebSocketDisconnect;
    /**
     * @param error
     */
    private onWebSocketError;
    /**
     * @param pullEvent
     */
    private extractMessages;
    /**
     * @param pullEvent
     */
    private extractProtobufMessages;
    /**
     * @param pullEvent
     */
    private extractPlainTextMessages;
    /**
     * Converts message id from byte[] to string
     * @param {Uint8Array} encodedId
     * @return {string}
     */
    private decodeId;
    /**
     * Converts message id from hex-encoded string to byte[]
     * @param {string} id Hex-encoded string.
     * @return {Uint8Array}
     */
    private encodeId;
    private onOffline;
    private onOnline;
    private onBeforeUnload;
    /**
     * @param status
     * @param delay
     */
    private sendPullStatusDelayed;
    /**
     * @param status
     */
    private sendPullStatus;
    /**
     * @memo if private?
     * @param tagId
     * @param force
     */
    private extendWatch;
    /**
     * @param force
     */
    private updateWatch;
    /**
     * @param tagId
     */
    private clearWatch;
    private onJsonRpcPing;
    private updatePingWaitTimeout;
    private clearPingWaitTimeout;
    private onPingTimeout;
    /**
     * Returns reconnect delay in seconds
     *
     * @param attemptNumber
     * @return {number}
     */
    private getConnectionAttemptDelay;
    /**
     * @param mid
     */
    private checkDuplicate;
    private trimDuplicates;
    /**
     * @param message
     */
    private logMessage;
    /**
     * @param message
     * @param force
     */
    private logToConsole;
    /**
     * @param message
     */
    private addMessageToStat;
    /**
     * @param text
     */
    private showNotification;
    /**
     * @memo may be need to use onCustomEvent
     * @memo ? force
     */
    private onCustomEvent;
}

declare function initializeB24Frame(options?: {
    version?: ApiVersion;
    restrictionParams?: Partial<RestrictionParams>;
}): Promise<B24Frame>;

export { AbstractB24, AbstractLogger, AdaptiveDelayer, AjaxError, AjaxResult, ApiVersion, AppFrame, AuthHookManager, AuthManager, AuthOAuthManager, B24Frame, B24Hook, B24LangList, B24LocaleMap, B24OAuth, PullClient as B24PullClientManager, Browser, CatalogProductImageType, CatalogProductType, CatalogRoundingRuleType, CloseReasons, ConnectionType, ConsolaAdapter, ConsoleHandler, ConsoleV2Handler, DataType, DialogManager, EnumAppStatus, EnumBitrix24Edition, EnumBizprocBaseType, EnumBizprocDocumentType, EnumCrmEntityType, EnumCrmEntityTypeId, EnumCrmEntityTypeShort, Environment, HttpV2, HttpV3, JsonFormatter, LineFormatter, ListRpcError, LoadDataType, LogLevel, Logger, LoggerBrowser, LoggerFactory, LoggerType, LsKeys, MemoryHandler, MessageCommands, MessageManager, NullLogger, OperatingLimiter, OptionsManager$1 as OptionsManager, ParamsFactory, ParentManager, PlacementManager, ProductRowDiscountTypeId, PullStatus, RateLimiter, RefreshTokenError, RestrictionManager, Result, RpcMethod, SdkError, SenderType, ServerMode, SliderManager, StatusDescriptions, StreamHandler, SubscriptionType, SystemCommands, TelegramFormatter, TelegramHandler, Text$1 as Text, Type, TypeOption, TypeSpecificUrl, WinstonAdapter, convertBizprocDocumentTypeToCrmEntityTypeId, getDocumentId, getDocumentType, getDocumentTypeForFilter, getEnumCrmEntityTypeShort, getEnumValue, getEnvironment, initializeB24Frame, isArrayOfArray, memoryUsageProcessor, omit, pick, pidProcessor, useB24Helper, useFormatter, versionManager };
export type { ActivityConfig, ActivityHandlerParams, ActivityOrRobotConfig, ActivityProperty, ActivityPropertyType, AdaptiveConfig, AjaxErrorParams, AjaxQuery, AnswerError, AuthActions, AuthData, B24FrameQueryParams, B24HookParams, B24OAuthParams, B24OAuthSecret, BatchCommandV3, BatchCommandsArrayUniversal, BatchCommandsObjectUniversal, BatchCommandsUniversal, BatchNamedCommandsUniversal, BatchPayload, BatchPayloadResult, BoolString, CallBatchResult, CallbackRefreshAuth, CatalogCatalog, CatalogExtra, CatalogLanguage, CatalogMeasure, CatalogPriceType, CatalogPriceTypeLang, CatalogProduct, CatalogProductImage, CatalogProductOffer, CatalogProductService, CatalogProductSku, CatalogRatio, CatalogRoundingRule, CatalogSection, CatalogStore, CatalogVat, CommandHandlerFunctionV1, CommandHandlerFunctionV2, CommandObject, CommandTuple, CommandUniversal, ConnectorCallbacks, ConnectorConfig, ConnectorParent, ConsolaAdapterOptions, ConsoleHandlerOptions, CrmItemDelivery, CrmItemPayment, CrmItemProductRow, Currency, CurrencyFormat, CustomRefreshAuth, EventHandlerParams, EventOnAppInstallHandlerParams, EventOnAppUnInstallHandlerParams, Fields, Formatter, GenderString, GetPayload, Handler, HandlerAuthParams, HandlerOptions, HandlerRefreshAuth, IB24BatchOptions, ICallBatchOptions, ICallBatchResult, ILimiter, IPlacementUF, IRequestIdGenerator, IResult, ISODate, JsonRpcRequest, ListPayload, LogLevelName, LogRecord, LoggerInterface, MemoryHandlerOptions, MessageInitData, MultiField, MultiFieldArray, NumberString, OperatingLimitConfig, Payload, PayloadOAuthToken, PayloadTime, PlacementViewMode, Processor, RateLimitConfig, RefreshAuthData, RestrictionManagerStats, RestrictionParams, RpcCommand, RpcCommandResult, RpcError, RpcRequest, SdkErrorDetails, SelectCRMParams, SelectCRMParamsEntityType, SelectCRMParamsValue, SelectedAccess, SelectedCRM, SelectedCRMEntity, SelectedUser, SendParams, SharedConfigCallbacks, SharedConfigParams, StatusClose, StorageManagerParams, StreamHandlerOptions, SuccessPayload, TelegramHandlerOptions, TextType, TypeApp, TypeB24, TypeB24Form, TypeCallParams, TypeChanel, TypeChannelManagerParams, TypeConnector, TypeDescriptionError, TypeDescriptionErrorV3, TypeEnumAppStatus, TypeHttp, TypeJsonRpcConfig, TypeLicense, TypePayment, TypePublicIdDescriptor, TypePullClientConfig, TypePullClientEmitConfig, TypePullClientMessageBatch, TypePullClientMessageBody, TypePullClientParams, TypePullClientSession, TypePullMessage, TypeRpcResponseAwaiters, TypeSessionEvent, TypeStorageManager, TypeSubscriptionCommandHandler, TypeSubscriptionOptions, TypeUser, UserBasic, UserBrief, UserFieldType, UserStatusCallback, WinstonAdapterOptions };
