import { IsNumericLiteral } from 'type-fest'; import { I as IterableContainer } from './IterableContainer-CtfinwiH.cjs'; type FlatArray = []> = Depth extends Iteration["length"] ? T : T extends readonly [] ? [ ] : T extends readonly [infer Item, ...infer Rest] ? [ ...(Item extends IterableContainer ? FlatArray : [ Item ]), ...FlatArray ] : Array>; type FlatSimpleArrayItems = [], IsDone extends boolean = false> = { done: T; recur: T extends ReadonlyArray ? FlatSimpleArrayItems : T; }[IsDone extends true ? "done" : "recur"]; /** * Creates a new array with all sub-array elements concatenated into it * recursively up to the specified depth. Equivalent to the built-in * `Array.prototype.flat` method. * * @param data - The items to flatten. * @param depth - The depth level specifying how deep a nested array structure * should be flattened. Defaults to 1. Non literal values (those typed as * `number`cannot be used. `Infinity`, `Number.POSITIVE_INFINITY` and * `Number.MAX_VALUE` are all typed as `number` and can't be used either. For * "unlimited" depth use a literal value that would exceed your expected * practical maximum nesting level. * @signature * R.flat(data) * R.flat(data, depth) * @example * R.flat([[1, 2], [3, 4], [5], [[6]]]); // => [1, 2, 3, 4, 5, [6]] * R.flat([[[1]], [[2]]], 2); // => [1, 2] * @dataFirst * @lazy * @category Array */ declare function flat(data: T, depth?: IsNumericLiteral extends true ? Depth : never): FlatArray; /** * Creates a new array with all sub-array elements concatenated into it * recursively up to the specified depth. Equivalent to the built-in * `Array.prototype.flat` method. * * @param depth - The depth level specifying how deep a nested array structure * should be flattened. Defaults to 1. * @signature * R.flat()(data) * R.flat(depth)(data) * @example * R.pipe([[1, 2], [3, 4], [5], [[6]]], R.flat()); // => [1, 2, 3, 4, 5, [6]] * R.pipe([[[1]], [[2]]], R.flat(2)); // => [1, 2] * @dataLast * @lazy * @category Array */ declare function flat(depth?: IsNumericLiteral extends true ? Depth : never): (data: T) => FlatArray; export { flat };