import { Cell } from "../types/cells";
import { ChartStyle } from "../types/chart";
import { SearchOptions } from "../types/find_and_replace";
import { Getters } from "../types/getters";
import { CellPosition, ConsecutiveIndexes, DebouncedFunction, Lazy, Style, UID } from "../types/misc";
/**
 * Escapes a string to use as a literal string in a RegExp.
 * @url https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#Escaping
 */
export declare function escapeRegExp(str: string): string;
/**
 * Deep copy arrays, plain objects and primitive values.
 * Throws an error for other types such as class instances.
 * Sparse arrays remain sparse.
 */
export declare function deepCopy<T>(obj: T): T;
/**
 * Sanitize the name of a sheet, by eventually removing quotes.
 */
export declare function getUnquotedSheetName(sheetName: string): string;
/**
 * Remove quotes from a quoted string.
 */
export declare function unquote(string: string, quoteChar?: "'" | '"'): string;
/**
 * Add quotes around the sheet name or any symbol name if it contains at least one non alphanumeric character.
 */
export declare function getCanonicalSymbolName(symbolName: string): string;
/** Replace the excel-excluded characters of a sheetName */
export declare function sanitizeSheetName(sheetName: string, replacementChar?: string): string;
export declare function clip(val: number, min: number, max: number): number;
/**
 * Create a range from start (included) to end (excluded).
 * range(10, 13) => [10, 11, 12]
 * range(2, 8, 2) => [2, 4, 6]
 */
export declare function range(start: number, end: number, step?: number): number[];
/**
 * Groups consecutive numbers.
 * The input array is assumed to be sorted
 * @param numbers
 */
export declare function groupConsecutive(numbers: number[]): ConsecutiveIndexes[];
/**
 * Create one generator from two generators by linking
 * each item of the first generator to the next item of
 * the second generator.
 *
 * Let's say generator G1 yields A, B, C and generator G2 yields X, Y, Z.
 * The resulting generator of `linkNext(G1, G2)` will yield A', B', C'
 * where `A' = A & {next: Y}`, `B' = B & {next: Z}` and `C' = C & {next: undefined}`
 * @param generator
 * @param nextGenerator
 */
export declare function linkNext<T>(generator: Generator<T>, nextGenerator: Generator<T>): Generator<T & {
    next?: T;
}>;
export declare function isBoolean(str: string): boolean;
export declare function isMarkdownLink(str: string): boolean;
/**
 * Check if the string is a web link.
 * e.g. http://odoo.com
 */
export declare function isWebLink(str: string): boolean;
/**
 * Build a markdown link from a label and an url
 */
export declare function markdownLink(label: string, url: string): string;
export declare function parseMarkdownLink(str: string): {
    url: string;
    label: string;
};
export declare function isSheetUrl(url: string): boolean;
export declare function buildSheetLink(sheetId: UID): string;
/**
 * Parse a sheet link and return the sheet id
 */
export declare function parseSheetUrl(sheetLink: string): string;
/**
 * This helper function can be used as a type guard when filtering arrays.
 * const foo: number[] = [1, 2, undefined, 4].filter(isDefined)
 */
export declare function isDefined<T>(argument: T | undefined): argument is T;
export declare function isNotNull<T>(argument: T | null): argument is T;
/**
 * Check if all the values of an object, and all the values of the objects inside of it, are undefined.
 */
export declare function isObjectEmptyRecursive<T extends object>(argument: T | undefined): boolean;
/**
 * Returns a function, that, as long as it continues to be invoked, will not
 * be triggered. The function will be called after it stops being called for
 * N milliseconds. If `immediate` is passed,  the function is called is called
 * immediately on the first call and the debouncing is triggered starting the second
 * call in the defined time window.
 *
 * Example:
 * debouncedFunction = debounce(() => console.log('Hello!'), 250);
 * debouncedFunction(); debouncedFunction(); // Will log 'Hello!' after 250ms
 *
 * debouncedFunction = debounce(() => console.log('Hello!'), 250, true);
 * debouncedFunction(); debouncedFunction(); // Will log 'Hello!' and relog it after 250ms
 *
 *
 * Also decorate the argument function with two methods: stopDebounce and isDebouncePending.
 *
 * Inspired by https://davidwalsh.name/javascript-debounce-function
 */
export declare function debounce<T extends (...args: any) => void>(func: T, wait: number, immediate?: boolean): DebouncedFunction<T>;
/**
 * Creates a batched version of a callback so that all calls to it in the same
 * microtick will only call the original callback once.
 *
 * @param callback the callback to batch
 * @returns a batched version of the original callback
 *
 * Copied from odoo/owl repo.
 */
export declare function batched(callback: () => void): () => void;
/** Returns a copy of the function `callback` that can only be called
 * at most once every `delay` milliseconds.
 */
export declare function throttle<T extends (...args: any[]) => any>(callback: T, delay: number): (...args: Parameters<T>) => ReturnType<T>;
export declare function concat(chars: string[]): string;
/**
 * Lazy value computed by the provided function.
 */
export declare function lazy<T>(fn: (() => T) | T): Lazy<T>;
/**
 * Find the next defined value after the given index in an array of strings. If there is no defined value
 * after the index, return the closest defined value before the index. Return an empty string if no
 * defined value was found.
 *
 */
export declare function findNextDefinedValue(arr: string[], index: number): string;
/** Get index of first header added by an ADD_COLUMNS_ROWS command */
export declare function getAddHeaderStartIndex(position: "before" | "after", base: number): number;
/**
 * Compares n objects.
 */
export declare function deepEquals(...o: any[]): boolean;
/**
 * Compares two arrays.
 * For performance reasons, this function is to be preferred
 * to 'deepEquals' in the case we know that the inputs are arrays.
 */
export declare function deepEqualsArray(arr1: unknown[], arr2: unknown[]): boolean;
/**
 * Check if the given array contains all the values of the other array.
 * It makes the assumption that both array do not contain duplicates.
 */
export declare function includesAll<T>(arr: T[], values: T[]): boolean;
/**
 * Return an object with all the keys in the object that have a falsy value removed.
 */
export declare function removeFalsyAttributes<T extends Object | undefined | null>(obj: T): T;
export declare const specialWhiteSpaceRegexp: RegExp;
export declare const whiteSpaceCharacters: string[];
/**
 * Replace all different newlines characters by \n.
 */
export declare function replaceNewLines(text: string | undefined): string;
/**
 * Determine if the numbers are consecutive.
 */
export declare function isConsecutive(iterable: Iterable<number>): boolean;
/**
 * Creates a version of the function that's memoized on the value of its first argument, if any.
 */
export declare function memoize<T extends any[], U>(func: (...args: T) => U): (...args: T) => U;
/**
 * Removes the specified indexes from the array.
 * Sparse (empty) elements are transformed to undefined (unless their index is explicitly removed).
 */
export declare function removeIndexesFromArray<T>(array: readonly T[], indexes: number[]): T[];
export declare function insertItemsAtIndex<T>(array: readonly T[], items: T[], index: number): T[];
export declare function replaceItemAtIndex<T>(array: readonly T[], newItem: T, index: number): T[];
export declare function trimContent(content: string): string;
export declare function isNumberBetween(value: number, min: number, max: number): boolean;
/**
 * Get a Regex for the find & replace that matches the given search string and options.
 */
export declare function getSearchRegex(searchStr: string, searchOptions: SearchOptions): RegExp;
/**
 * Alternative to Math.max that works with large arrays.
 * Typically useful for arrays bigger than 100k elements.
 */
export declare function largeMax(array: number[]): number;
/**
 * Alternative to Math.min that works with large arrays.
 * Typically useful for arrays bigger than 100k elements.
 */
export declare function largeMin(array: number[]): number;
export declare class TokenizingChars {
    private readonly text;
    private currentIndex;
    current: string;
    constructor(text: string);
    shift(): string;
    advanceBy(length: number): void;
    isOver(): boolean;
    remaining(): string;
    currentStartsWith(str: string): boolean;
}
/**
 * Remove duplicates from an array.
 *
 * @param array The array to remove duplicates from.
 * @param cb A callback to get an element value.
 */
export declare function removeDuplicates<T>(array: T[], cb?: (a: T) => any): T[];
/**
 * Similar to transposing and array, but with POJOs instead of arrays. Useful, for example, when manipulating
 * a POJO grid[col][row] and you want to transpose it to grid[row][col].
 *
 * The resulting object is created such as result[key1][key2] = pojo[key2][key1]
 */
export declare function transpose2dPOJO<T>(pojo: Record<string, Record<string, T>>): Record<string, Record<string, T>>;
export declare function getUniqueText(text: string, texts: string[], options?: {
    compute?: (text: string, increment: number) => string;
    start?: number;
    computeFirstOne?: boolean;
}): string;
export declare function isFormula(content: string): boolean;
export declare function chartStyleToCellStyle(style: ChartStyle): Style;
export declare function doesCellContainFunction(cell: Cell, formula: string): boolean;
/** Return the number of cols/rows missing for result of the formula to be able to spread */
export declare function getMissingHeadersForSpreadResult(getters: Getters, position: CellPosition, formula: string): {
    missingRows: number;
    missingCols: number;
} | undefined;
