/**
 * This module includes classes and functions to work with Container types.
 *
 * @module collections
 */
import { compare } from '../operators/index.js';
import { Iteratee } from '../types';
export * from './abc.js';
export * from './BTree.js';
export * from './deque.js';
export * from './frozenset.js';
export * from './Heap.js';
export * from './LRUCache.js';
export * from './SortedMap.js';
export * from './SortedSet.js';
export * from './SortedTree.js';
export * from './SplayTree.js';
export * from './Trie.js';
/**
 * Creates a new array with all falsy and empty values removed.
 * @param arr The array to compact
 * @example
```js
compact([0, 1, false, 2, '', 3])
// [1, 2, 3]
```
 * @returns A new array with the filtered values
 */
export declare function compact<T>(arr: T[]): T[];
export declare function compact<T>(arr: T): Partial<T>;
/**
 * Creates an object composed of keys from the results of running elements of `collection` thru `iteratee`. The corresponding value of each key is the number of times the key was returned by `iteratee`.
 * @param iterable
 * @param func
 * @returns {Object} Returns an Object with the frequency values
 * @example
```js
count([6.1, 4.2, 6.3], Math.floor);
// { '4': 1, '6': 2 }

// property iteratee shorthand.
count(['one', 'two', 'three'], x => x.length);
// { '3': 2, '5': 1 }
```
 */
export declare function count<T>(obj: T[], fn: Iteratee<T>): Record<string, number>;
export declare function count<T>(obj: Object, fn: Iteratee<T>): Record<string, number>;
/**
 * Iterates over elements of collection, returning an array of all elements where predicate returns truthy value.
 *
 * The predicate is invoked with three arguments: `(value, index|key, arr)`.
 *
 * @example
```js
let users = [
  { 'user': 'barney', 'age': 36, 'active': true },
  { 'user': 'fred',   'age': 40, 'active': false }
]

filter(users, o => !o.active)
 // objects for ['fred']

// The shape iteratee shorthand.
filter(users, { age: 36, active: true })
// objects for ['barney']

// The property iteratee shorthand.
filter(users, 'active')
// objects for ['barney']
```
 * @param {Array} arr The collection to iterate over
 * @param {Function} fn The predicate function invoked for each item
 * @returns {Array} The new filtered array
 */
export declare function filter<T>(arr: T[], fn?: Iteratee<T>): T[];
export declare function filter<T>(arr: T[], fn?: Object): T[];
export declare function filter<T>(arr: Object, fn?: Iteratee<T>): T[];
export declare function filter<T>(arr: Object, fn?: Object): T[];
/**
 * Iterates over elements of collection, returning the first element where predicate returns truthy value. The predicate is invoked with three arguments: `(value, index|key, collection)`.
 * @example
```js
let users = [
  { 'user': 'barney',  'age': 36, 'active': true },
  { 'user': 'fred',    'age': 40, 'active': false },
  { 'user': 'pebbles', 'age': 1,  'active': true }
]

find(users, (o) => o.age < 40)
// object for 'barney'

// The shape iteratee shorthand.
find(users, { 'age': 1, 'active': true })
// object for 'pebbles'

// The `property` iteratee shorthand.
find(users, 'active')
// object for 'barney'
```
 * @param {Array} arr The collection to iterate over.
 * @param {Function} fn The function invoked per iteration.
 * @returns {*} The matched element, else `undefined`.
 * @see {@link findLast}
 */
export declare function find<T>(arr: T[], fn: Iteratee<T>): T | undefined;
export declare function find<T>(arr: T[], fn: Object): T | undefined;
export declare function find<T>(arr: T[], fn: PropertyKey): T | undefined;
export declare function find<T>(arr: Object, fn: Iteratee<T>): T | undefined;
export declare function find<T>(arr: Object, fn: Object): T | undefined;
export declare function find<T>(arr: Object, fn: PropertyKey): T | undefined;
/**
 * Performs an efficient array insert operation in the given array. If the index or the array is invalid, it just returns the given array.
 *
 * **Note:** Uses the same behavior as `Array.splice`.
 *
 * @param {Array<*>} arr The given array to insert into
 * @param {number} index The index of the array insert operation.
 * @param {*} value The value to insert in the array at the given `index`.
 * @returns {Array<*>} The given array.
 */
export declare function insert<T>(arr: T[], index: number, value: T): T[];
/**
 * Creates a function that performs a partial deep comparison between a given object and `shape`, returning `true` if the given object has equivalent property values, else `false`.
 * @example
```js
let objects = [
  { a: 1, b: 2, c: 3 },
  { a: 4, b: 5, c: 6 }
]

filter(objects, matches({ a: 4, c: 6 }))
// [{ a: 4, b: 5, c: 6 }]
```
 * @param shape
 * @returns
 */
export declare function matches(shape: any): (obj: any) => boolean;
/**
 * Iterates over elements of collection and invokes `iteratee` for each element. The iteratee is invoked with three arguments: `(value, index|key, collection)`. Iteratee functions may exit iteration early by explicitly returning `false`.
 * @example
```js
forEach([1, 2], (value) => {
  console.log(value)
})
// Logs `1` then `2`.

forEach({ 'a': 1, 'b': 2 }, (value, key) => {
  console.log(key)
})
// Logs 'a' then 'b' (iteration order is not guaranteed).
```
 * @param {Array|Object} collection The collection to iterate over.
 * @param {Iteratee} fn The function invoked per iteration.
 * @returns {*} Returns `collection`.
 * @see {@link forEachRight}
 * @see {@link filter}
 * @see {@link map}
 */
export declare function forEach<T>(collection: Iterable<T>, fn: Iteratee<T>): void;
export declare function forEach<T>(collection: Object, fn: Iteratee<T>): void;
/**
 * This method is like {@link find} except that it iterates from right to left.
 * @example
```js
findLast([1, 2, 3, 4], (n) => n % 2 === 1)
//  => 3
```
 * @param {Array} arr The collection to iterate over.
 * @param {Function} fn The function invoked per iteration.
 * @returns {*} The matched element, else `undefined`.
 * @see {@link find}
 */
export declare function findLast<T>(arr: Iterable<T>, fn: Iteratee<T>): T | undefined;
export declare function findLast<T>(arr: Iterable<T>, fn: Object): T | undefined;
export declare function findLast<T>(arr: Object, fn: Iteratee<T>): T | undefined;
export declare function findLast<T>(arr: Object, fn: Object): T | undefined;
/**
 * This method is like {@link forEach} except that it iterates over the collection from right to left.

 * @example
```js
forEachRight([1, 2], (value) => {
  console.log(value)
})
// Logs `2` then `1`.
```
 * @param {Array|Object} collection The collection to iterate over.
 * @param {Iteratee} fn The function invoked per iteration.
 * @returns {*} Returns `collection`.
 * @see {@link forEach}
 * @see {@link filter}
 * @see {@link map}
 */
export declare function forEachRight<T>(collection: T[], fn: Iteratee<T>): void;
export declare function forEachRight<T>(collection: Object, fn: Iteratee<T>): void;
/**
 * Flattens an array or object. Arrays will be flattened recursively up to `depth` times. Objects will be flattened recursively.
 * @example
```js
flatten([1, [2, [3, [4]], 5]])
// [1, 2, [3, [4]], 5]

flatten({
  dates: {
    expiry_date: '30 sep 2018',
    available: '30 sep 2017',
    min_contract_period: [
      {
        id: 1,
        name: '1 month'
      }
    ]
  },
  price: {
    currency: 'RM',
    value: 1500
  }
})
// {
  'dates.expiry_date': '30 sep 2018',
  'dates.available': '30 sep 2017',
  'dates.min_contract_period[0].id': 1,
  'dates.min_contract_period[0].name': '1 month',
  'price.currency': 'RM',
  'price.value': 1500
}
```
 * @param {Array|Object} arr The array or object to flatten.
 * @param {number} [depth=1] The max recursion depth.
 * @returns {*} The new flattened array or object.
 * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/flat Array.flat()}
 */
export declare function flatten<T>(arr: T[], depth?: boolean | number): T[];
export declare function flatten<T>(arr: Object, depth?: boolean | number): Object;
/**
 * Creates an array of values by running each element in collection thru iteratee. The iteratee is invoked with three arguments: `(value, index|key, collection)`.
 * @example
```js
function square(n) {
  return n * n
}

map([4, 8], square)
// [16, 64]

map({ a: 4, b: 8 }, square)
// [16, 64] (iteration order is not guaranteed)

let users = [
  { user: 'barney' },
  { user: 'fred' }
]

// The `property` iteratee shorthand.
map(users, 'user')
// ['barney', 'fred']
```
 * @param {Array|Object} arr The collection to iterate over.
 * @param {Iteratee} fn The function invoked per iteration.
 * @returns Returns the new mapped array.
 * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map Array.map()}
 */
export declare function map<T, TResult>(arr: T[], fn: Iteratee<T, PropertyKey, TResult>): TResult[];
export declare function map<T, TResult>(arr: T[], fn: PropertyKey): TResult[];
export declare function map<T, TResult>(arr: Object, fn: Iteratee<T, PropertyKey, TResult>): TResult[];
export declare function map<T, TResult>(arr: Object, fn: PropertyKey): TResult[];
/**
 * Creates an object composed of the picked object properties.
 * @param {Object} obj The source object.
 * @param {Iteratee|PropertyKey[]} paths The properties to pick. If `paths` is a function, it will be invoked per property with two values `(value, key)`.
 * @returns A new object with the properties.
 * @example
```js
let object = { a: 1, b: '2', c: 3 }

pick(object, ['a', 'c'])
// { a: 1, c: 3 }

pick(object, (x) => isNumber(x))
// { a: 1, c: 3 }
```
 *
 * @see {@link omit}
 */
export declare function pick<T>(obj: T, paths: Iteratee): Partial<T>;
export declare function pick<T>(obj: T, paths: PropertyKey[]): Partial<T>;
/**
 * The opposite of {@link pick} - this method creates an object composed of the own and inherited enumerable property paths of `object` that are not omitted.
 * @example
```js
let object = { 'a': 1, 'b': '2', 'c': 3 }

omit(object, ['a', 'c'])
// { 'b': '2' }

omit(object, (x) => isNumber(x))
// { 'b': '2' }
```
 * @param {Object} obj The source object.
 * @param {Iteratee|PropertyKey[]} paths The property paths to omit.
 * @returns {Object} Returns the new object.
 * @see {@link pick}
 */
export declare function omit<T>(obj: T, paths: Iteratee): Partial<T>;
export declare function omit<T>(obj: T, paths: PropertyKey[]): Partial<T>;
/**
 * This method is like {@link find} except that it returns the index of the first element `predicate` returns truthy for instead of the element itself.
 * @param {Array} obj The array to inspect.
 * @param {string|Object|Iteratee} fn The predicate function
 * @param {number} [start=0] The index to search from.
 * @returns {number} The index of the found value, else -1
 * @example
```js
let users = [
  { 'user': 'barney',  'active': false },
  { 'user': 'fred',    'active': false },
  { 'user': 'pebbles', 'active': true }
]

findIndex(users, (o) => o.user == 'barney')
// 0

// The `shape` iteratee shorthand.
findIndex(users, { 'user': 'fred', 'active': false })
// 1

// The `property` iteratee shorthand.
findIndex(users, 'active')
// 2
```
 * @see {@link indexOf}
 * @see {@link findLastIndex}
 *
 */
export declare function findIndex<T>(obj: T[], fn: Iteratee<T>, start?: number): number;
export declare function findIndex<T>(obj: T[], fn: Object, start?: number): number;
export declare function findIndex<T>(obj: T[], fn: PropertyKey, start?: number): number;
/**
 * This method is like {@link findIndex} except that it searches for a given value directly, instead of using a predicate function.
 * @param {Array} obj The array to inspect.
 * @param {*} value The value to find
 * @param {number} [start=0] The index to search from.
 * @returns {number} The index of the found value, else -1
 * @example
```js
indexOf([1, 2, 1, 2], 2)
// 1

// Search from a `start` index.
indexOf([1, 2, 1, 2], 2, 2)
// 3
```
 * @see {@link findIndex}
 * @see {@link lastIndexOf}
 */
export declare function indexOf<T>(obj: T[], value: T, start?: number): number;
/**
 * This method is like {@link findIndex} except that it iterates the collection from right to left.
 * @param {Array} arr The array to inspect.
 * @param {string|Iteratee|Object} fn The function invoked per iteration.
 * @param {number} [start] The index to search from.
 * @returns {number} The index of the found value, else -1
 * @example
```js
let users = [
  { 'user': 'barney',  'active': true },
  { 'user': 'fred',    'active': false },
  { 'user': 'pebbles', 'active': false }
]

findLastIndex(users, (o) => o.user == 'pebbles')
// 2

// The `shape` iteratee shorthand.
findLastIndex(users, { 'user': 'barney', 'active': true })
// 0

// The `property` iteratee shorthand.
findLastIndex(users, 'active')
// 0
```
 * @see {@link findIndex}
 * @see {@link lastIndexOf}
 */
export declare function findLastIndex<T>(arr: T[], fn: Iteratee<T>, start?: number): number;
export declare function findLastIndex<T>(arr: T[], fn: Object, start?: number): number;
export declare function findLastIndex<T>(arr: T[], fn: PropertyKey, start?: number): number;
/**
 * This method is like {@link indexOf} except that it iterates the collection from right to left.
 * @param {Array} obj The array to inspect.
 * @param {*} value The value to find
 * @param {number} [start] The index to search from.
 * @returns {number} The index of the found value, else -1
 * @example
```js
lastIndexOf([1, 2, 1, 2], 2)
// 3

// Search from the `fromIndex`.
lastIndexOf([1, 2, 1, 2], 2, 2)
// 1
```
 * @see {@link findLastIndex}
 * @see {@link indexOf}
 */
export declare function lastIndexOf<T>(obj: T[], value: T, start?: number): number;
/**
 * Creates a shallow clone of `value`. If `deep` is `true` it will clone it recursively.
 * @param {*} value
 * @param {boolean} [deep=false]
 * @return The clone value
 * @see {@link cloneArray}
 * @see {@link cloneTypedArray}
 */
export declare function clone<T>(value: T, deep?: boolean): T;
export declare function clone<T>(value: T[], deep?: boolean): T[];
/**
 * Clones an array. If `deep` is `false` (default) the clone will be shallow. Otherwise {@link https://developer.mozilla.org/en-US/docs/Web/API/structuredClone structuredClone} is used.
 * @param arr The array to clone
 * @param [deep=false] Creates a deep clone using `structuredClone` if true.
 * @returns The new array
 * @see {@link clone}
 */
export declare function cloneArray<T>(arr: T[], deep?: boolean): T[];
/**
 * Clones a typed array. If `deep` is `false` (default) the clone will be shallow. Otherwise {@link https://developer.mozilla.org/en-US/docs/Web/API/structuredClone structuredClone} is used.
 * @param arr The array to clone
 * @param [deep=false] Creates a deep clone using `structuredClone` if true.
 * @returns The new array
 * @see {@link clone}
 */
export declare function cloneTypedArray(typedArray: any, isDeep?: boolean): any;
/**
 * Creates a duplicate-free version of an array, using a `Set` for equality comparisons, in which only the first occurrence of each element is kept. The order of result values is not guaranteed.
 * @param arr The array containing duplicated elements
 * @param fn The iteratee invoked per element.
 * @returns Returns the new duplicate free array.
 * @example
```js
uniq([2, 1, 2])
// [2, 1]

uniq([2.1, 1.2, 2.3], Math.floor)
// [2.1, 1.2]
```
 *
 * @see {@link sortedUniq}
 */
export declare function uniq<T>(arr: Iterable<T>, fn?: Iteratee<T>): T[];
export declare function uniq<T>(arr: Iterable<T>, fn?: PropertyKey): T[];
/**
 * This method is like {@link uniq} except that it sorts the results in ascending order
 * @param arr The array containing duplicated elements
 * @param fn The iteratee invoked per element.
 * @returns Returns the new duplicate free array
 * @example
```js
uniq([2, 1, 2])
// [1, 2]
```
 * @see {@link uniq}
 */
export declare function sortedUniq<T>(arr: Iterable<T>, fn?: Iteratee<T>): T[];
export declare function sortedUniq<T>(arr: Iterable<T>, fn?: PropertyKey): T[];
/**
 * Recursively merges own and inherited enumerable string keyed properties of source objects into the destination object. Source properties that resolve to `undefined` are skipped if a destination value exists. Array and plain object properties are merged recursively. Other objects and value types are overridden by assignment. Source objects are applied from left to right. Subsequent sources overwrite property assignments of previous sources.
 *
 * Note: this method mutates `object`
 *
 *
 * @param {Object} object The destination object.
 * @param {...Object} sources The source objects.
 * @returns Returns `object`.
 *
 * @example
```js
let object = {
  'a': [{ 'b': 2 }, { 'd': 4 }]
}

let other = {
  'a': [{ 'c': 3 }, { 'e': 5 }]
}

merge(object, other)
// { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
```
 */
export declare function merge(object: Object, ...sources: Object[]): Object;
/**
 * Assigns own and inherited enumerable string keyed properties of source objects to the destination object for all destination properties that resolve to `undefined`. Source objects are applied from left to right. Once a property is set, additional values of the same property are ignored.
 * **Note:** This method mutates `object`.

 * @param {Object} object The destination object.
 * @param {...Object} [sources] The source objects.
 * @returns Returns `object`.
 * @example
```js
defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 })
// { 'a': 1, 'b': 2 }
```
 */
export declare function defaults(object: Object, ...sources: Object[]): Object;
/**
 * Returns a generator of array values not included in the other given arrays using a `Set` for equality comparisons. The order and references of result values are not guaranteed.
 * @param args The initial arrays
 * @example
```js
[...difference([2, 1], [2, 3])]
// [1]
```
 * @see {@link union}
 * @see {@link intersection}
 */
export declare function difference<T>(...args: Array<Iterable<T>>): Generator<T, void, unknown>;
/**
 * Creates a generator of unique values that are included in all given arrays.
 * @param args The arrays to inspect
 * @example
```js
[...intersection([2, 1], [2, 3])]
// [2]
```
* @see {@link difference}
 * @see {@link union}
 */
export declare function intersection<T>(...args: Array<Iterable<T>>): Generator<T, void, unknown>;
/**
 * Creates a generator of unique values from all given arrays using `Set` for equality comparisons.
 * @param args The arrays to perform union on.
 * @example
```js
[...union([2], [1, 2])]
// [2, 1]
```
 * @see {@link difference}
 * @see {@link intersection}
 */
export declare function union<T>(...args: Array<Iterable<T>>): Generator<T, void, unknown>;
/**
 * Creates an object composed of keys generated from the results of running each element of `arr` thru `func`. The order of grouped values is determined by the order they occur in `arr`. The corresponding value of each key is an array of elements responsible for generating the key.
 *
 * @param arr The collection to iterate over.
 * @param [func=id] The iteratee to transform keys.
 * @returns Returns the aggregated object.
 *
 * @example
```js
groupBy([6.1, 4.2, 6.3], Math.floor)
// { '4': [4.2], '6': [6.1, 6.3] }

// The `property` iteratee shorthand.
groupBy(['one', 'two', 'three'], 'length')
// { '3': ['one', 'two'], '5': ['three'] }
```
 */
export declare function groupBy<T>(arr: Iterable<T>, fn: Iteratee<T>): Record<PropertyKey, T[]>;
export declare function groupBy<T>(arr: Iterable<T>, fn: PropertyKey): Record<PropertyKey, T[]>;
export declare function groupBy<T>(arr: Object, fn: Iteratee<T>): Record<PropertyKey, T[]>;
export declare function groupBy<T>(arr: Object, fn: PropertyKey): Record<PropertyKey, T[]>;
/**
 * Similar to {@link groupBy} but it returns a {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map Map} object with the results.
 *
 * @param arr The collection to iterate over.
 * @param {Function | PropertyKey} [func=id] The iteratee to transform keys.
 * @returns {Map} Returns the aggregated map object.
 * @template K, V
 *
 * @example
```js
groupByMap([6.1, 4.2, 6.3], Math.floor)
// Map { 4: [4.2], 6: [6.1, 6.3] }

// The `property` iteratee shorthand.
groupByMap(['one', 'two', 'three'], 'length')
// Map { 3: ['one', 'two'], 5: ['three'] }
```
 */
export declare function groupByMap<V>(arr: Iterable<V>, fn: Iteratee<V>): Map<any, V[]>;
export declare function groupByMap<V>(arr: Iterable<V>, fn: PropertyKey): Map<any, V[]>;
export declare function groupByMap<V>(arr: Object, fn: Iteratee<V>): Map<any, V[]>;
export declare function groupByMap<V>(arr: Object, fn: PropertyKey): Map<any, V[]>;
/**
 * Removes all elements from array that `func` returns truthy for and returns an array of the removed elements.
 * @param arr The array to remove from.
 * @param func The function invoked per iteration or value(s) or value to remove.
 * @returns
 */
export declare function remove<T>(arr: T[], func: T): T[];
export declare function remove<T>(arr: T[], func: T[]): T[];
export declare function remove<T>(arr: T[], func: Iteratee<T>): T[];
/**
 * Returns the index of `x` in a **sorted** array if found, in `O(log n)` using binary search.
 * If the element is not found, returns a negative integer.
 * @param arr The array to sort
 * @param x The element to find
 * @param lo The starting index
 * @param hi The end index to search within
 * @param comp The compare function to check for `x`
 * @returns {number} The index if the element is found or a negative integer.
 */
export declare function binarySearch(arr: any[], x: any, lo?: number, hi?: any, comp?: typeof compare): number;
/**
 * Returns an insertion index which comes after any existing entries of `x` in a **sorted** array, using binary search.
 * @param arr The array to sort
 * @param x The element to find
 * @param lo The starting index
 * @param hi The end index to search within
 * @param comp The compare function to check for `x`
 * @returns {number}
 */
export declare function bisect(arr: any[], x: any, lo?: number, hi?: any, comp?: typeof compare): number;
/**
 * Returns an insertion index which comes before any existing entries of `x` in a **sorted** array, using binary search.
 * @param arr The array to sort
 * @param x The element to find
 * @param lo The starting index
 * @param hi The end index to search within
 * @param comp The compare function to check for `x`
 * @returns {number}
 */
export declare function bisectLeft(arr: any[], x: any, lo?: number, hi?: any, comp?: typeof compare): number;
/**
 * Runs {@link bisect} first to locate an insertion point, and inserts the value `x` in the sorted array after any existing entries of `x` to maintain sort order.
 * Please note this method is `O(n)` because insertion resizes the array.
 * @param arr The array to insert into
 * @param x The element to insert
 * @param lo The starting index
 * @param hi The end index to search within
 * @param comp The compare function to check for `x`
 * @returns {Array}
 */
export declare function insort<T>(arr: T[], x: any, lo?: number, hi?: any, comp?: typeof compare): T[];
/**
 * Runs {@link bisectLeft} first to locate an insertion point, and inserts the value `x` in the sorted array before any existing entries of `x` to maintain sort order.
 * Please note this method is `O(n)` because insertion resizes the array.
 * @param arr The array to insert into
 * @param x The element to insert
 * @param lo The starting index
 * @param hi The end index to search within
 * @param comp The compare function to check for `x`
 * @returns {Array}
 */
export declare function insortLeft<T>(arr: T[], x: any, lo?: number, hi?: any, comp?: typeof compare): T[];
