{"version":3,"sources":["../src/functions/compact/compact.ts","../src/functions/assert/assert.ts","../src/functions/assertNever/assertNever.ts","../src/functions/capitalize/capitalize.ts","../src/functions/camelCase/camelCase.ts","../src/functions/isArray/isArray.ts","../src/functions/castArrayIfDefined/castArrayIfDefined.ts","../src/functions/castArray/castArray.ts","../src/functions/chunk/chunk.ts","../src/functions/clamp/clamp.ts","../src/functions/constantCase/constantCase.ts","../src/functions/_internal/filterIterable/filterIterable.ts","../src/functions/count/count.ts","../src/functions/createTypeGuard/createTypeGuard.ts","../src/functions/debounce/debounce.ts","../src/functions/negate/negate.ts","../src/functions/difference/difference.ts","../src/functions/ensurePrefix/ensurePrefix.ts","../src/functions/ensureSuffix/ensureSuffix.ts","../src/functions/hasKey/hasKey.ts","../src/functions/get/get.ts","../src/functions/groupBy/groupBy.ts","../src/functions/identity/identity.ts","../src/functions/inRange/inRange.ts","../src/functions/intersection/intersection.ts","../src/functions/invert/invert.ts","../src/functions/isEmpty/isEmpty.ts","../src/functions/zip/zip.ts","../src/functions/isEqual/_internal/array/areArraysEqual.ts","../src/functions/isEqual/_internal/createIsCircularTypeEqualityComparator.ts","../src/functions/isEqual/_internal/date/areDatesEqual.ts","../src/functions/isEqual/_internal/date/dateTag.ts","../src/functions/isEqual/_internal/map/areMapsEqual.ts","../src/functions/isEqual/_internal/react/reactOwnerPropertyName.ts","../src/functions/isEqual/_internal/object/getObjectProperties.ts","../src/functions/isEqual/_internal/object/areObjectsEqual.ts","../src/functions/isEqual/_internal/primitiveWrappers/arePrimitiveWrappersEqual.ts","../src/functions/isEqual/_internal/regExp/areRegExpsEqual.ts","../src/functions/isEqual/_internal/regExp/regExpTag.ts","../src/functions/isEqual/_internal/set/areSetsEqual.ts","../src/functions/isEqual/_internal/set/setTag.ts","../src/functions/isEqual/_internal/typedArray/areTypedArraysEqual.ts","../src/functions/isEqual/_internal/typedArray/isTypedArray.ts","../src/functions/isEqual/_internal/comparator.ts","../src/functions/isEqual/_internal/createEqualityComparator.ts","../src/functions/isEqual/isEqual.ts","../src/functions/isNonNullable/isNonNullable.ts","../src/functions/join/join.ts","../src/functions/kebabCase/kebabCase.ts","../src/functions/keyBy/keyBy.ts","../src/functions/objectEntries/objectEntries.ts","../src/functions/objectFromEntries/objectFromEntries.ts","../src/functions/mapKeys/mapKeys.ts","../src/functions/mapValues/mapValues.ts","../src/functions/max/max.ts","../src/functions/memoize/memoize.ts","../src/functions/min/min.ts","../src/functions/noop/noop.ts","../src/functions/objectKeys/objectKeys.ts","../src/functions/_internal/filterObject/createObjectPredicate.ts","../src/functions/_internal/filterObject/filterObject.ts","../src/functions/omit/omit.ts","../src/functions/once/once.ts","../src/functions/orderBy/orderBy.ts","../src/functions/partition/partition.ts","../src/functions/pick/pick.ts","../src/functions/pipe/pipe.ts","../src/functions/range/range.ts","../src/functions/sample/sample.ts","../src/functions/_internal/isMaliciousObjectPath.ts","../src/functions/set/set.ts","../src/functions/single/single.ts","../src/functions/sum/sum.ts","../src/functions/take/take.ts","../src/functions/toObject/toObject.ts","../src/functions/unique/unique.ts","../src/functions/uniqueId/uniqueId.ts","../src/functions/without/without.ts"],"names":["range","min","max","isEqual","areArraysEqual","areDatesEqual","areMapsEqual","areObjectsEqual","arePrimitiveWrappersEqual","areRegExpsEqual","areSetsEqual","areTypedArraysEqual","count"],"mappings":";AAYO,SAAS,QAAW,OAA8C;AACvE,SAAQ,OAAO,OAAO,OAAO,KAAyB,CAAC;AACzD;;;ACSO,SAAS,OACd,WACA,SACmB;AACnB,MAAI,UAAU,WAAW,GAAG;AAC1B;AAAA,EACF;AAEA,MAAI,CAAC,WAAW;AACd,UAAM,IAAI,eAAe,OAAO;AAAA,EAClC;AACF;AAMO,IAAM,iBAAN,cAA6B,MAAM;AAAA,EACxC,YAAY,SAAkB;AAC5B;AAAA,MACE,QAAQ;AAAA,QACN;AAAA,QACA,UAAU,MAAM,OAAO,MAAM;AAAA,MAC/B,CAAC,EAAE,KAAK,EAAE;AAAA,IACZ;AAAA,EACF;A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AAE;AACxC;;;ACnCO,SAAS,QACd,OACA,gBACsB;AACtB,QAAM,kBAAkB,gBAAgB,cAAc;AACtD,SAAO,MAAM,OAAO,CAAC,SAAgC,CAAC,gBAAgB,IAAI,CAAC;AAC7E","sourcesContent":["import { Falsey, Maybe } from '../../types';\n\n/**\n * Creates an array with all falsey values removed.\n * The values `false`, `null`, `0`, `\"\"`, `undefined`, and `NaN` are falsey.\n * @param array The array to compact.\n * @returns The new array of filtered values.\n * @example\n * ```ts\n * compact([0, 1, false, 2, '', 3, null, 4, undefined]) // [1, 2, 3, 4]\n * ```\n */\nexport function compact<T>(array: Maybe<ReadonlyArray<T | Falsey>>): T[] {\n  return (array?.filter(Boolean) as T[] | undefined) ?? [];\n}\n","import { compact } from '../compact';\n\n/**\n * Asserts that a condition is true, throwing an Error if it is not.\n * @param condition A condition that should be true\n * @param message A message to use in the Error that will be thrown if the condition is falsy\n * @throws An `AssertionError` if the condition is falsy\n * @example\n * ```ts\n * function doWork(value: number | undefined) {\n *   assert(value !== undefined, 'value should be defined');\n *   // value is now narrowed to number\n *\n *   return value + 1;\n * }\n * ```\n * @example\n * ```ts\n * assert(1 === 1); // OK\n * assert(1 === 2); // throws AssertionError\n * assert(1 === 2, '1 should equal 2'); // throws AssertionError: 1 should equal 2\n * ```\n */\nexport function assert(\n  condition?: unknown,\n  message?: string\n): asserts condition {\n  if (arguments.length === 0) {\n    return;\n  }\n\n  if (!condition) {\n    throw new AssertionError(message);\n  }\n}\n\n/**\n * An error that is thrown when an assertion is not satisfied.\n * Thrown by {@link assert}.\n */\nexport class AssertionError extends Error {\n  constructor(message?: string) {\n    super(\n      compact([\n        `Assertion not satisfied`,\n        message ? `: \"${message}\"` : '',\n      ]).join('')\n    );\n  }\n}\n","/**\n * Throws an error if a value is of type `never`.\n * Used for exhaustive checks.\n * @param inclusive The value to check.\n * @param noThrow If `true`, returns `undefined` instead of throwing an error.\n * @returns This function never returns a value, but throws an error if `inclusive` is of type `never`.\n * @example\n * ```typescript\n * assertNever('foo' as never); // throws an error\n * assertNever('foo' as never, true); // returns undefined\n * ```\n */\nexport function assertNever(inclusive: never, noThrow = false): never {\n  if (noThrow) {\n    return undefined as never;\n  }\n\n  // eslint-disable-next-line @typescript-eslint/restrict-template-expressions -- this is unexpected to happen, but if it does, it's better to have the value.\n  throw new Error(`Unexpected inclusive value: ${inclusive}`);\n}\n","/**\n * Returns a new string with the first character capitalized.\n * @param string The input string to capitalize.\n * @returns A new string with the first character capitalized.\n * @example\n * ```ts\n * capitalize('foo'); // 'Foo'\n * capitalize(''); // ''\n * ```\n */\nexport function capitalize<S extends string>(string: S): Capitalize<S> {\n  return `${string.charAt(0).toUpperCase()}${string.slice(1)}` as Capitalize<S>;\n}\n","import type { CamelCase as CamelCaseImplementation } from 'type-fest';\n\nimport { capitalize } from '../capitalize';\n\n/**\n * Changes the casing of a string to kebab case.\n * @param string The input string to change the casing of.\n * @returns A new string with the casing changed to kebab case.\n * @example\n * ```ts\n * camelCase('fooBar') // 'fooFar'\n * camelCase('foo bar') // 'fooBar'\n * camelCase('foo-bar') // 'fooBar'\n * camelCase('fooBar42') // 'fooBar42'\n * ```\n */\nexport function camelCase<S extends string>(string: S): CamelCase<S> {\n  if (!/[a-z]+/i.test(string)) {\n    return string as CamelCase<S>;\n  }\n\n  const words = string.trim().split(wordsRegex);\n  return words\n    .map((word, index) => (index === 0 ? word.toLowerCase() : capitalize(word)))\n    .join('') as CamelCase<S>;\n}\n\n/**\n * Changes the casing of a string to camel case.\n * @see {@link camelCase}.\n */\nexport type CamelCase<S extends string> = CamelCaseImplementation<S>;\n\nconst wordsRegex = /[\\s_-]+|(?<=[a-z])(?=[A-Z])/;\n","import { Many, Maybe } from '../../types';\n\n// eslint-disable-next-line prefer-destructuring\nexport const isArray: IsArray = Array.isArray;\n\ninterface IsArray {\n  /**\n   * The same as `Array.isArray` but with a better type guard.\n   * @param value The value to check.\n   * @returns `true` if the value is an array, `false` otherwise.\n   * @example\n   * ```ts\n   * isArray([1, 2, 3]) // true\n   * isArray('foo') // false\n   * ```\n   */\n  <T>(value: Maybe<Array<ArrayElement<T>>>): value is NonNullable<typeof value>;\n  /**\n   * The same as `Array.isArray` but with a better type guard.\n   * @param value The value to check.\n   * @returns `true` if the value is an array, `false` otherwise.\n   * @example\n   * ```ts\n   * isArray([1, 2, 3]) // true\n   * isArray('foo') // false\n   * ```\n   */\n  <T>(\n    value: Maybe<ReadonlyArray<ArrayElement<T>>>\n  ): value is NonNullable<typeof value>;\n\n  /**\n   * The same as `Array.isArray` but with a better type guard.\n   * @param value The value to check.\n   * @returns `true` if the value is an array, `false` otherwise.\n   * @example\n   * ```ts\n   * isArray([1, 2, 3]) // true\n   * isArray('foo') // false\n   * ```\n   */\n  <T>(value: Maybe<Many<T>>): value is NonNullable<readonly T[]>;\n  /**\n   * The same as `Array.isArray` but with a better type guard.\n   * @param value The value to check.\n   * @returns `true` if the value is an array, `false` otherwise.\n   * @example\n   * ```ts\n   * isArray([1, 2, 3]) // true\n   * isArray('foo') // false\n   * ```\n   */\n  <T>(value: unknown): value is readonly T[];\n}\n\ntype ArrayElement<T> = T extends ReadonlyArray<infer U> ? U : never;\n","import { Many, Maybe } from '../../types';\nimport { isArray } from '../isArray';\n\n/**\n * Converts the given value to an array if it's not already one, or returns an value as-is if it's not defined (i.e. `null` or `undefined`).\n * @note If the value is already an array, it is returned as-is (same reference).\n * @param value The value to convert to an array if it's not already one.\n * @returns An array containing the input value, or the input value itself if it is already an array, or `null` or `undefined` if the input value is `null` or `undefined`.\n * @example\n * ```ts\n * castArrayIfDefined(null) // null\n * ```\n */\nexport function castArrayIfDefined(value: null): null;\n/**\n * Converts the given value to an array if it's not already one, or returns an value as-is if it's not defined (i.e. `null` or `undefined`).\n * @note If the value is already an array, it is returned as-is (same reference).\n * @param value The value to convert to an array if it's not already one.\n * @example\n * ```ts\n * castArrayIfDefined(undefined) // undefined\n * ```\n */\nexport function castArrayIfDefined(value: undefined): undefined;\n/**\n * Converts the given value to an array if it's not already one, or returns an value as-is if it's not defined (i.e. `null` or `undefined`).\n * @note If the value is already an array, it is returned as-is (same reference).\n * @param value The value to convert to an array if it's not already one.\n * @returns An array containing the input value, or the input value itself if it is already an array, or `null` or `undefined` if the input value is `null` or `undefined`.\n * @example\n * ```ts\n * castArrayIfDefined([1, 2, 3]) // [1, 2, 3]\n * ```\n */\nexport function castArrayIfDefined<T>(value: readonly T[]): readonly T[];\n/**\n * Converts the given value to an array if it's not already one, or returns an value as-is if it's not defined (i.e. `null` or `undefined`).\n * @note If the value is already an array, it is returned as-is (same reference).\n * @param value The value to convert to an array if it's not already one.\n * @returns An array containing the input value, or the input value itself if it is already an array, or `null` or `undefined` if the input value is `null` or `undefined`.\n * @example\n * ```ts\n * castArrayIfDefined([1, 2, 3]) // [1, 2, 3]\n * ```\n */\nexport function castArrayIfDefined<T>(value: T[]): T[];\n/**\n * Converts the given value to an array if it's not already one, or returns an value as-is if it's not defined (i.e. `null` or `undefined`).\n * @note If the value is already an array, it is returned as-is (same reference).\n * @param value The value to convert to an array if it's not already one.\n * @returns An array containing the input value, or the input value itself if it is already an array, or `null` or `undefined` if the input value is `null` or `undefined`.\n * @example\n * ```ts\n * castArrayIfDefined([1, 2, 3]) // [1, 2, 3]\n * castArrayIfDefined(42) // [42]\n * ```\n */\nexport function castArrayIfDefined<T>(value: NonNullable<T>): T[];\n/**\n * Converts the given value to an array if it's not already one, or returns an value as-is if it's not defined (i.e. `null` or `undefined`).\n * @note If the value is already an array, it is returned as-is (same reference).\n * @param value The value to convert to an array if it's not already one.\n * @returns An array containing the input value, or the input value itself if it is already an array, or `null` or `undefined` if the input value is `null` or `undefined`.\n * @example\n * ```ts\n * castArrayIfDefined([1, 2, 3]) // [1, 2, 3]\n * castArrayIfDefined(42) // [42]\n * ```\n */\nexport function castArrayIfDefined<T>(\n  value: Maybe<\n    Many<NonNullable<T>, 'mutable'> | Many<NonNullable<T>, 'immutable'>\n  >\n): Maybe<T[]>;\n/**\n * Implementation for all overloads.\n * @param value The value to convert to an array if it's not already one.\n * @returns An array containing the input value, or the input value itself if it is already an array, or `null` or `undefined` if the input value is `null` or `undefined`.\n */\nexport function castArrayIfDefined<T>(\n  value: Maybe<\n    Many<NonNullable<T>, 'mutable'> | Many<NonNullable<T>, 'immutable'>\n  >\n) {\n  if (value == null) {\n    return value;\n  }\n\n  if (isArray(value)) {\n    return value;\n  }\n\n  return [value];\n}\n","import { Many, Maybe } from '../../types';\nimport { castArrayIfDefined } from '../castArrayIfDefined';\n\n// NOTE: all JSDocs here are duplicated of one another since there's no way to inherit them at this time.\n// see https://github.com/microsoft/TypeScript/issues/407 for more info.\n\n/**\n * Casts the input value to an array if it is not already an array.\n * @param value The input value to cast to an array.\n * @returns An array containing the input value, or the input value itself if it is already an array.\n * @example\n * ```ts\n * castArray('foo'); // ['foo']\n * castArray(['foo']); // ['foo']\n * castArray(null); // []\n * castArray(undefined); // []\n * ```\n */\nexport function castArray<T>(value: null): T[];\n/**\n * Casts the input value to an array if it is not already an array.\n * @param value The input value to cast to an array.\n * @returns An array containing the input value, or the input value itself if it is already an array.\n * @example\n * ```ts\n * castArray('foo'); // ['foo']\n * castArray(['foo']); // ['foo']\n * castArray(null); // []\n * castArray(undefined); // []\n * ```\n */\nexport function castArray<T>(value: undefined): T[];\n/**\n * Casts the input value to an array if it is not already an array.\n * @param value The input value to cast to an array.\n * @returns An array containing the input value, or the input value itself if it is already an array.\n * @example\n * ```ts\n * castArray('foo'); // ['foo']\n * castArray(['foo']); // ['foo']\n * castArray(null); // []\n * castArray(undefined); // []\n * ```\n */\nexport function castArray<T>(value: readonly T[]): readonly T[];\n/**\n * Casts the input value to an array if it is not already an array.\n * @param value The input value to cast to an array.\n * @returns An array containing the input value, or the input value itself if it is already an array.\n * @example\n * ```ts\n * castArray('foo'); // ['foo']\n * castArray(['foo']); // ['foo']\n * castArray(null); // []\n * castArray(undefined); // []\n * ```\n */\nexport function castArray<T>(value: T[]): T[];\n/**\n * Casts the input value to an array if it is not already an array.\n * @param value The input value to cast to an array.\n * @returns An array containing the input value, or the input value itself if it is already an array.\n * @example\n * ```ts\n * castArray('foo'); // ['foo']\n * castArray(['foo']); // ['foo']\n * castArray(null); // []\n * castArray(undefined); // []\n * ```\n */\nexport function castArray<T>(\n  value: Maybe<\n    Many<NonNullable<T>, 'mutable'> | Many<NonNullable<T>, 'immutable'>\n  >\n): T[];\n/**\n * Casts the input value to an array if it is not already an array.\n * @param value The input value to cast to an array.\n * @returns An array containing the input value, or the input value itself if it is already an array.\n * @example\n * ```ts\n * castArray('foo'); // ['foo']\n * castArray(['foo']); // ['foo']\n * castArray(null); // []\n * castArray(undefined); // []\n * ```\n */\nexport function castArray<T>(value: NonNullable<T>): T[];\n/**\n * Implementation for all overloads.\n * @param value The input value to cast to an array.\n * @returns An array containing the input value, or the input value itself if it is already an array.\n * @example\n * ```ts\n * castArray('foo'); // ['foo']\n * castArray(['foo']); // ['foo']\n * castArray(null); // []\n * castArray(undefined); // []\n * ```\n */\nexport function castArray<T>(\n  value: Maybe<\n    Many<NonNullable<T>, 'mutable'> | Many<NonNullable<T>, 'immutable'>\n  >\n) {\n  return castArrayIfDefined(value ?? []);\n}\n","import { Maybe } from '../../types';\n\n/**\n * Splits an array into chunks of the given size.\n * @param array The array to split.\n * @param size The maximum size of each chunk.\n * @returns An array of arrays where each sub-array has at most `size` elements.\n * @example\n * ```ts\n * chunk([1, 2, 3, 4, 5], 2) // [[1, 2], [3, 4], [5]]\n * ```\n */\nexport function chunk<T>(array: Maybe<readonly T[]>, size: number): T[][] {\n  if (array == null) {\n    return [];\n  }\n\n  const chunks = [];\n  for (let index = 0; index < array.length; index += size) {\n    chunks.push(array.slice(index, index + size));\n  }\n\n  return chunks;\n}\n\n/**\n * Alias for {@link chunk}.\n */\nexport const chunkArray = chunk;\n","import { CastToString } from '../../types';\n\ninterface ClampOptions {\n  /**\n   * Whether the clamping should be inclusive of the range.\n   * @default true\n   */\n  inclusive?: boolean | 'min' | 'max';\n}\n\n/**\n * Clamps a number to a specified range.\n * @param value The number to clamp.\n * @param range The range to clamp to, as a tuple of min and max values.\n * @param options Optional parameters.\n * @param options.inclusive Whether the clamping should be inclusive of the min and/or max value.\n * - If `true`, the clamping is inclusive of both min and max.\n * - If `false`, the clamping is exclusive of both min and max.\n * - If `'min'`, the clamping is inclusive of the min value but exclusive of the max value.\n * - If `'max'`, the clamping is exclusive of the min value but inclusive of the max value.\n * @returns The clamped number.\n * @example\n * ```typescript\n * clamp(3, [1, 5]); // 3\n * clamp(5, [1, 5]); // 5\n * clamp(5, [1, 5], { inclusive: false }); // 4\n * clamp(1, [1, 5], { inclusive: 'max' }); // 5\n * ```\n */\n// eslint-disable-next-line consistent-return -- we have an exhaustive check, so we never get to the end of the function\nexport function clamp(\n  value: number,\n  range: readonly [min: number, max: number],\n  options?: ClampOptions\n): number {\n  const [min, max] = range;\n  if (min > max) {\n    throw new RangeError(`Invalid range: [${min},${max}]`);\n  }\n\n  const { inclusive = true } = options ?? {};\n\n  return {\n    true: () => Math.max(min, Math.min(max, value)),\n    false: () => Math.max(min + 1, Math.min(max - 1, value)),\n    min: () => Math.max(min, Math.min(max - 1, value)),\n    max: () => Math.max(min + 1, Math.min(max, value)),\n  }[inclusive as CastToString<typeof inclusive>]();\n}\n","/**\n * Changes the casing of a string to constant case.\n * @param string The input string to change the casing of.\n * @returns A new string with the casing changed to constant case.\n * @example\n * ```ts\n * constantCase('fooBar') // 'FOO_BAR'\n * constantCase('foo bar') // 'FOO_BAR'\n * constantCase('foo-bar') // 'FOO_BAR'\n * constantCase('fooBar42') // 'FOO_BAR42'\n * ```\n */\nexport function constantCase<S extends string>(string: S): ConstantCase<S> {\n  if (!/[a-z]+/i.test(string)) {\n    return '' as ConstantCase<S>;\n  }\n\n  return string\n    .replace(/([a-z])([A-Z])/g, '$1_$2')\n    .replace(/[\\s-]+/g, '_')\n    .toUpperCase() as ConstantCase<S>;\n}\n\n/**\n * Changes the casing of a string to constant case.\n * @see {@link constantCase}.\n */\nexport type ConstantCase<S extends string> = Uppercase<\n  S extends `${infer S1}${infer S2}`\n    ? `${S1 extends '-'\n        ? '_'\n        : S1 extends ' '\n          ? '_'\n          : S1 extends '_'\n            ? '_'\n            : S1 extends Capitalize<S1>\n              ? `_${Lowercase<S1>}`\n              : S1}${ConstantCase<S2>}`\n    : S\n>;\n","import { Maybe } from '../../../types';\n\nexport function filter<T>(source: Maybe<Iterable<T>>): T[] | undefined;\nexport function filter<T>(\n  source: Maybe<Iterable<T>>,\n  predicate?: (value: T, index: number) => boolean\n): T[] | undefined;\nexport function filter<T, S>(\n  source: Maybe<Iterable<T>>,\n  predicate?: (value: S, index: number) => value is S\n): S[] | undefined;\nexport function filter<T>(\n  source: Maybe<Iterable<T>>,\n  predicate?: (value: T, index: number) => boolean\n): T[] | undefined {\n  if (source == null) {\n    return undefined;\n  }\n\n  const relevantItems =\n    predicate == null\n      ? [...source]\n      : // eslint-disable-next-line unicorn/no-array-callback-reference -- this is fine, we want to use the same predicate\n        [...source].filter(predicate);\n\n  return relevantItems;\n}\n","import { Maybe } from '../../types';\nimport { filter } from '../_internal/filterIterable';\n\n/**\n * Returns the number of elements in an iterable.\n * @param source The iterable to count.\n * @returns The number of elements.\n * @example\n * ```ts\n * count([1, 2, 3]); // 3\n * count([]); // 0\n * count(null); // 0\n * ```\n */\nexport function count<T>(source: Maybe<Iterable<T>>): number;\n/**\n * Returns the number of elements in an iterable that satisfy a predicate.\n * @param source The iterable to count.\n * @param predicate The predicate function used to determine if an element is a match.\n * @returns The number of matching elements.\n * @example\n * ```ts\n * count([1, 2, 3], x => x % 2 === 0); // 1\n * count([1, 2, 3], x => x >= 2); // 2\n * count([], x => x >= 1); // 0\n * count(null, x => x >= 1); // 0\n * ```\n */\nexport function count<T>(\n  source: Maybe<Iterable<T>>,\n  predicate?: (value: T, index: number) => boolean\n): number;\n/**\n * Implementation for all overloads.\n * @param source The iterable to count.\n * @param predicate The predicate function used to determine if an element is a match.\n * @returns The number of matching elements.\n */\nexport function count<T>(\n  source: Maybe<Iterable<T>>,\n  predicate?: (value: T, index: number) => boolean\n): number {\n  const relevantItems = filter(source, predicate);\n  return relevantItems?.length ?? 0;\n}\n","/**\n * Creates a type guard that checks if the given type is assignable to the given type.\n * @param values The values to check against.\n * @template {TInput} The type to check against, `unknown` by default. Pass in if you want to have a narrowed type for the type predicate (e.g. `string`).\n * @returns A type guard that checks if the given type is assignable to the given type.\n * @example\n * ```ts\n * const isValidValue = createTypeGuard(['foo', 'bar']);\n *\n * const value: unknown = '...';\n * if (isValidValue(value)) {\n *   // ✅ value is of type `'foo' | 'bar'`\n * }\n * ```\n */\nexport function createTypeGuard<\n  const TKnownValue,\n  // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents -- without this we can't have a default type of `unknown`\n  TInput extends TKnownValue | unknown = unknown,\n>(values: Iterable<TKnownValue>): (v: TInput) => v is TInput & TKnownValue {\n  const setValues = new Set<unknown>(values);\n  return function predicate(v: unknown): v is TInput & TKnownValue {\n    return setValues.has(v);\n  };\n}\n","import { AnyFunction } from '../../types/_internal';\n\n/**\n * Creates a debounced function that delays invoking `func` until after `delay` milliseconds have elapsed since the last time the debounced function was invoked.\n * @param func The function to debounce.\n * @param delay The number of milliseconds to delay.\n * @param options Optional configuration options.\n * @param options.leading Whether to call the function on the leading edge of the timeout.\n * @returns A debounced function that can be called multiple times, but only invokes `func` once per `delay` milliseconds.\n */\nexport function debounce<TFunction extends AnyFunction<void | undefined>>(\n  func: TFunction,\n  delay: number,\n  options: {\n    /**\n     * Whether to call the function on the leading edge of the timeout.\n     * @default false\n     */\n    leading?: boolean;\n  } = {}\n): DebouncedFunction<TFunction> {\n  let timeoutId: ReturnType<typeof setTimeout> | null = null;\n  let isCalled = false;\n  let latestArguments: Parameters<TFunction>;\n\n  function debouncedFunction(...args: Parameters<TFunction>): void {\n    latestArguments = args;\n\n    if (options.leading && !isCalled) {\n      func(...args);\n      isCalled = true;\n    }\n\n    if (timeoutId !== null) {\n      clearTimeout(timeoutId);\n    }\n\n    timeoutId = setTimeout(() => {\n      if (!options.leading) {\n        func(...args);\n      }\n      isCalled = false;\n    }, delay);\n  }\n\n  debouncedFunction.flush = () => {\n    if (timeoutId !== null) {\n      clearTimeout(timeoutId);\n    }\n\n    func(...latestArguments);\n  };\n\n  debouncedFunction.clear = () => {\n    if (timeoutId !== null) {\n      clearTimeout(timeoutId);\n    }\n  };\n\n  return debouncedFunction;\n}\n\ninterface DebouncedFunction<TFunction extends AnyFunction<void | undefined>> {\n  (...args: Parameters<TFunction>): void;\n  clear(): void;\n  flush(): void;\n}\n","import { AnyFunction } from '../../types/_internal';\n\n/**\n * Returns a new function that negates the result of the input function.\n * @param func The input function to negate.\n * @returns A new function that negates the result of the input function.\n * @example\n * ```ts\n * const isEven = (num: number) => num % 2 === 0;\n * const isOdd = negate(isEven);\n * isOdd(1); // true\n * isOdd(2); // false\n * ```\n */\nexport function negate<Func extends AnyFunction<boolean>>(\n  func: Func\n): (...args: Parameters<Func>) => boolean {\n  return (...args: Parameters<Func>) => {\n    const result = func(...args);\n    return !result;\n  };\n}\n","import type { IsLiteral } from 'type-fest';\n\nimport { createTypeGuard } from '../createTypeGuard';\nimport { negate } from '../negate';\n\n/**\n * Gets the difference between two arrays.\n * @param array1 The first array.\n * @param array2 The second array.\n * @param comparator A function that determines whether two items are equal.\n * @returns An array with the difference between the two arrays - items that are in the first array but not in the second.\n * @example\n * ```ts\n * difference([1, 2, 3], [2, 3, 4]) // [2, 3]\n * ```\n */\nexport function difference<const T, const S extends T>(\n  array1: readonly T[],\n  array2: readonly S[],\n  comparator?: Comparator<T, S>\n): Array<IsLiteral<T> | IsLiteral<S> extends true ? Exclude<T, S> : T>;\n/**\n * Gets the difference between two arrays.\n * @param array1 The first array.\n * @param array2 The second array.\n * @param comparator A function that determines whether two items are equal.\n * @returns An array with the difference between the two arrays - items that are in the first array but not in the second.\n * @example\n * ```ts\n * difference([1, 2, 3], [2, 3, 4]) // [2, 3]\n * ```\n */\nexport function difference<T, S extends T>(\n  array1: readonly T[],\n  array2: readonly S[],\n  comparator?: Comparator<T, S>\n): Array<IsLiteral<T> | IsLiteral<S> extends true ? Exclude<T, S> : T>;\n// eslint-disable-next-line jsdoc/require-jsdoc -- implementation of the overload signatures\nexport function difference<T, S extends T>(\n  array1: readonly T[],\n  array2: readonly S[],\n  comparator?: Comparator<T, S>\n): Array<IsLiteral<T> | IsLiteral<S> extends true ? Exclude<T, S> : T> {\n  // no comparator provided - we can do a quicker check using `Object.is` via a Set.\n  if (!comparator) {\n    const isArray2Item = createTypeGuard(array2);\n    return array1.filter(negate(isArray2Item)) as Array<Exclude<T, S>>;\n  }\n\n  return array1.filter(\n    (a1): a1 is Exclude<T, S> => !array2.some((a2) => comparator(a1, a2))\n  );\n}\n\ntype Comparator<T, S extends T> =\n  | ((a: T, b: S) => a is Exclude<T, S>)\n  | ((a: T, b: S) => boolean);\n","/**\n * Ensures that the string starts with the given prefix.\n * @param string The string to ensure the prefix of.\n * @param prefix The prefix to ensure.\n * @returns The string with the given prefix.\n * @example\n * ```ts\n * ensurePrefix('foo', 'bar'); // 'barfoo'\n * ensurePrefix('foobar', 'foo'); // 'foobar'\n * ```\n */\nexport function ensurePrefix<S extends string, Prefix extends string>(\n  string: S,\n  prefix: Prefix\n): EnsurePrefix<S, Prefix> {\n  if (string.startsWith(prefix)) {\n    return string as EnsurePrefix<S, Prefix>;\n  }\n\n  return `${prefix}${string}` as EnsurePrefix<S, Prefix>;\n}\n\ntype EnsurePrefix<\n  S extends string,\n  Prefix extends string,\n  // eslint-disable-next-line @typescript-eslint/no-unused-vars\n> = S extends `${Prefix}${infer _Suffix}` ? S : `${Prefix}${S}`;\n","/**\n * Ensures that the string ends with the given suffix.\n * @param string The string to ensure the suffix of.\n * @param suffix The suffix to ensure.\n * @returns The string with the given suffix.\n * @example\n * ```ts\n * ensureSuffix('foo', 'bar'); // 'foobar'\n * ensureSuffix('foobar', 'bar'); // 'foobar'\n * ```\n */\nexport function ensureSuffix<S extends string, Suffix extends string>(\n  string: S,\n  suffix: Suffix\n): EnsureSuffix<S, Suffix> {\n  if (string.endsWith(suffix)) {\n    return string as EnsureSuffix<S, Suffix>;\n  }\n\n  return `${string}${suffix}` as EnsureSuffix<S, Suffix>;\n}\n\ntype EnsureSuffix<\n  S extends string,\n  Suffix extends string,\n  // eslint-disable-next-line @typescript-eslint/no-unused-vars\n> = S extends `${infer _Prefix}${Suffix}` ? S : `${S}${Suffix}`;\n","import { KeysOfUnion, StringWithAutocomplete } from '../../types';\n\n/**\n * Returns whether the input value has the specified key.\n * @param value The value to check.\n * @param key The key to check for.\n * @returns Whether the input value has the specified key.\n * @example\n * ```ts\n * hasKey({ a: 1 }, 'a') // true\n * hasKey({ a: 1 }, 'b') // false\n * ```\n */\nexport function hasKey<\n  T extends object,\n  K extends StringWithAutocomplete<KeysOfUnion<T> & string> | PropertyKey,\n>(value: T, key: K): value is T & Record<K, unknown> {\n  if (typeof value !== 'object' || value == null) {\n    return false;\n  }\n\n  return key in value;\n}\n","import type { Get } from 'type-fest';\n\nimport { Many, ObjectPath } from '../../types';\nimport { hasKey } from '../hasKey';\nimport { isArray } from '../isArray';\n\n/**\n * Gets the value at path of object.\n * Allows accessing properties in unions of objects and getting undefined if the property is not present.\n * @param object The object to query.\n * @param path The path of the property to get.\n * @returns The value at path of object.\n * @example\n * ```ts\n * get({ a: 1, b: 2, c: 3 }, 'b') // 2\n * get({\n *   name: \"John Doe\",\n *   address: {\n *     street: \"123 Main St\",\n *     city: \"Anytown\",\n *   }\n * }, 'address.city') // \"Anytown\"\n * ```\n */\nexport function get<T, Path extends ObjectPath<T>>(\n  object: T,\n  path: Path\n): Get<T, Path>;\n/**\n * Gets the value at path of object.\n * Allows accessing properties in unions of objects and getting undefined if the property is not present.\n * @param object The object to query.\n * @param path The path of the property to get.\n * @returns The value at path of object.\n * @example\n * ```ts\n * get({\n *   name: \"John Doe\",\n *   address: {\n *     street: \"123 Main St\",\n *     city: \"Anytown\",\n *   }\n * }, ['address', 'city']) // \"Anytown\"\n * ```\n */\nexport function get<T, Path extends Many<string>>(\n  object: T,\n  path: Path\n): Get<T, Path>;\n/**\n * Implementation of all overloads.\n * @param object The object to query.\n * @param path The path of the property to get.\n * @returns The value at path of object.\n */\nexport function get<T, Path extends ObjectPath<T> | Many<string>>(\n  object: T,\n  path: Path\n): Get<T, Path> {\n  const keys: readonly string[] = isArray(path) ? path : path.split('.');\n\n  return keys.reduce<unknown>((value, key) => {\n    if (hasKey(value as object, key)) {\n      return (value as Record<typeof key, unknown>)[key];\n    }\n\n    // eslint-disable-next-line unicorn/no-useless-undefined -- default value, explicitly declare it\n    return undefined;\n  }, object as object) as Get<T, Path>;\n}\n","import { Maybe } from '../../types';\n\n/**\n * Takes an array and returns an object with the keys of the array mapped to the items of the array.\n * @param array The array to iterate over.\n * @param getter The function used to extract the key from each element.\n * @returns An object with the keys mapped to the elements.\n * @example\n * ```ts\n * groupBy(\n *   [\n *     { id: 'a', value: 1 },\n *     { id: 'b', value: 1 },\n *     { id: 'c', value: 2 },\n *   ],\n *   (item) => item.value\n * )\n * // {\n * //   1: [\n * //     { id: 'a', value: 1 },\n * //     { id: 'b', value: 1 },\n * //   ],\n * //   2: [\n * //     { id: 'c', value: 2 },\n * //   ],\n * // }\n * ```\n */\nexport function groupBy<T, K extends string>(\n  array: Maybe<readonly T[]>,\n  getter: (item: T) => K\n): Partial<Record<K, T[]>> {\n  return (array ?? []).reduce(\n    (draftGroups, currentItem) => {\n      const key = getter(currentItem);\n\n      // eslint-disable-next-line no-param-reassign\n      draftGroups[key] ??= [];\n      // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n      draftGroups[key]!.push(currentItem);\n\n      return draftGroups;\n    },\n    {} as Partial<Record<K, T[]>>\n  );\n}\n","/**\n * Returns the input value.\n * @template T The type of the input value.\n * @param value The input value.\n * @returns The input value.\n * @example\n * ```ts\n * identity('foo') // 'foo'\n * identity(42) // 42\n * identity({ foo: 'bar' }) // { foo: 'bar' }\n * ```\n */\nexport function identity<T>(value: T): T {\n  return value;\n}\n","import { CastToString } from '../../types';\n\ninterface InRangeOptions {\n  /**\n   * Whether the range is inclusive of the end value.\n   * @default 'start'\n   */\n  inclusive?: boolean | 'start' | 'end';\n}\n\n/**\n * Checks if a number is within a specified range.\n * @param value The number to check.\n * @param range The range to check against, as a tuple of start and end values.\n * @param options Optional parameters.\n * @param options.inclusive Whether the range is inclusive of the start and/or end value.\n *  - If `true`, the range is inclusive of both start and end.\n *  - If `false`, the range is exclusive of both start and end.\n *  - If `'start'`, the range is inclusive of the start value but exclusive of the end value.\n *  - If `'end'`, the range is exclusive of the start value but inclusive of the end value.\n * @returns `true` if the number is within the range, `false` otherwise.\n * @example\n * ```typescript\n * inRange(3, [1, 5]); // true\n * inRange(5, [1, 5]); // false\n * inRange(5, [1, 5], { inclusive: true }); // true\n * inRange(1, [1, 5], { inclusive: 'end' }); // false\n * ```\n */\n// eslint-disable-next-line consistent-return -- we have an exhaustive check, so we never get to the end of the function\nexport function inRange(\n  value: number,\n  range: readonly [start: number, end: number],\n  options?: InRangeOptions\n): boolean {\n  const [start, end] = range;\n  const { inclusive = 'start' } = options ?? {};\n\n  if (start > end) {\n    throw new RangeError(`Invalid range: [${start},${end}]`);\n  }\n\n  return {\n    true: () => value >= start && value <= end,\n    false: () => value > start && value < end,\n    start: () => value >= start && value < end,\n    end: () => value > start && value <= end,\n  }[inclusive as CastToString<typeof inclusive>]();\n}\n","import { createTypeGuard } from '../createTypeGuard';\n\n/**\n * Gets the intersection between two arrays.\n * @param array1 The first array.\n * @param array2 The second array.\n * @param comparator A function that determines whether two items are equal.\n * @returns An array with the intersection between the two arrays.\n * @example\n * ```ts\n * intersection([1, 2, 3], [2, 3, 4]) // [2, 3]\n * ```\n */\nexport function intersection<const T, const S extends T>(\n  array1: readonly T[],\n  array2: readonly S[],\n  comparator?: Comparator<T, S>\n): S[];\n/**\n * Gets the intersection between two arrays.\n * @param array1 The first array.\n * @param array2 The second array.\n * @param comparator A function that determines whether two items are equal.\n * @returns An array with the intersection between the two arrays.\n * @example\n * ```ts\n * intersection([1, 2, 3], [2, 3, 4]) // [2, 3]\n * ```\n */\nexport function intersection<T, S extends T>(\n  array1: readonly T[],\n  array2: readonly S[],\n  comparator?: Comparator<T, S>\n): S[];\n// eslint-disable-next-line jsdoc/require-jsdoc -- implementation of the overload signatures\nexport function intersection<T, S extends T>(\n  array1: readonly T[],\n  array2: readonly S[],\n  comparator?: Comparator<T, S>\n): S[] {\n  // no comparator provided - we can do a quicker check using `Object.is` via a Set.\n  if (!comparator) {\n    const isArray2Item = createTypeGuard(array2);\n    // eslint-disable-next-line unicorn/no-array-callback-reference -- smaller bundle size, and we know that we're not using the other arguments in our implementation\n    return array1.filter(isArray2Item);\n  }\n\n  return array1.filter((a1): a1 is Extract<T, S> =>\n    array2.some((a2) => comparator(a1, a2))\n  );\n}\n\ntype Comparator<T, S extends T> =\n  | ((a: T, b: S) => a is S)\n  | ((a: T, b: S) => boolean);\n","import type { Writable } from 'type-fest';\n\n/**\n * Inverts the keys and values of an object.\n * @param object The object to invert.\n * @returns A new object with the keys and values inverted.\n *\n * If the object has duplicate values, the last key will be used.\n * @example\n * ```typescript\n * invert({\n *   a: 'x',\n *   b: 'y',\n *   c: 'z'\n * }); // { x: 'a', y: 'b', z: 'c' }\n * ```\n */\nexport function invert<\n  /* const generic is used to make sure we capture the value as a string literal */ const T extends\n    Record<PropertyKey, PropertyKey>,\n>(\n  object: T\n): // we run it through writeable to simplify the type and \"remove\" the effect of the const generic parameter.\nWritable<Inverted<T>> {\n  return Object.fromEntries(\n    Object.entries(object).map(([key, value]) => [value, key])\n  ) as Writable<Inverted<T>>;\n}\n\ntype Inverted<T extends Record<PropertyKey, PropertyKey>> = {\n  [K in keyof T as T[K]]: K;\n};\n","import { EmptyObject, Maybe } from '../../types';\nimport { isArray } from '../isArray';\n\n/**\n * Returns whether the input value is empty.\n * @param value The value to check.\n * @returns Whether the input value is empty.\n * @example\n * ```ts\n * isEmpty('') // true\n * isEmpty('abc') // false\n * ```\n */\nexport function isEmpty(value: string): value is '';\n/**\n * Returns whether the input value is empty.\n * @param value The value to check.\n * @returns Whether the input value is empty.\n * @example\n * ```ts\n * isEmpty(0) // true\n * isEmpty(1) // false\n * ```\n */\nexport function isEmpty(value: number): value is number;\n/**\n * Returns whether the input value is empty.\n * @param value The value to check.\n * @returns Whether the input value is empty.\n * @example\n * ```ts\n * isEmpty(new Map()) // true\n * isEmpty(new Map([['a', 1]])) // false\n *\n * isEmpty(new Set()) // true\n * isEmpty(new Set([1])) // false\n * ```\n */\nexport function isEmpty(\n  value: Maybe<ReadonlyMap<unknown, unknown> | ReadonlySet<unknown>>\n): boolean;\n/**\n * Returns whether the input value is empty.\n * @param value The value to check.\n * @returns Whether the input value is empty.\n * @example\n * ```ts\n * isEmpty([]) // true\n * isEmpty([1]) // false\n * ```\n */\nexport function isEmpty<T extends readonly unknown[] | EmptyArray>(\n  value: Maybe<T>\n): value is Maybe<T & EmptyArray>;\n/**\n * Returns whether the input value is empty.\n * @param value The value to check.\n * @returns Whether the input value is empty.\n * @example\n * ```ts\n * isEmpty({}) // true\n * isEmpty({ a: 1 }) // false\n * ```\n */\nexport function isEmpty<T extends object>(\n  value: Maybe<EmptyObject<T> | T>\n): value is T & Record<string, never>;\n/**\n * Returns whether the input value is empty.\n * @param value The value to check.\n * @returns Whether the input value is empty.\n * @example\n * ```ts\n * isEmpty(null) // true\n * isEmpty(undefined) // true\n * isEmpty(0) // true\n * isEmpty('') // true\n * isEmpty([]) // true\n * isEmpty({}) // true\n * isEmpty(new Map()) // true\n * isEmpty(new Set()) // true\n * isEmpty(false) // true\n *\n * isEmpty(true) // false\n * isEmpty(1) // false\n * isEmpty('abc') // false\n * isEmpty([1]) // false\n * isEmpty({ a: 1 }) // false\n * isEmpty(new Map([['a', 1]])) // false\n * isEmpty(new Set([1])) // false\n * ```\n */\nexport function isEmpty<T>(value: Maybe<T>): boolean;\n/**\n * Implementation for all overloads.\n * @param value The value to check.\n * @returns Whether the input value is empty.\n */\nexport function isEmpty<T>(value: Maybe<T>): boolean {\n  if (value == null) {\n    return true;\n  }\n\n  if (isArray(value) || typeof value === 'string') {\n    return value.length === 0;\n  }\n\n  if (value instanceof Map || value instanceof Set) {\n    return value.size === 0;\n  }\n\n  if (typeof value === 'number') {\n    return !value;\n  }\n\n  if (typeof value === 'object') {\n    return Object.keys(value).length === 0;\n  }\n\n  return false;\n}\n\ntype EmptyArray = [];\n","import type { TypedArray } from 'type-fest';\n\n/**\n * Zips two arrays together into an array of tuples.\n * @param first The first array to zip.\n * @param second The second array to zip.\n * @returns An array of tuples containing the zipped values.\n */\nexport function zip<T, U>(\n  first: readonly T[],\n  second: readonly U[]\n): Array<[T, U]>;\n/**\n * Zips two typed arrays together into an array of tuples.\n * @param first The first array to zip.\n * @param second The second array to zip.\n * @returns An array of tuples containing the zipped values.\n */\nexport function zip<T extends TypedArray, U extends TypedArray>(\n  first: T,\n  second: U\n): Array<[T[number], U[number]]>;\n/**\n * Implementation for all overloads.\n * @param first The first array to zip.\n * @param second The second array to zip.\n * @returns An array of tuples containing the zipped values.\n */\nexport function zip<\n  T extends readonly unknown[] | TypedArray,\n  U extends readonly unknown[] | TypedArray,\n>(first: T, second: U) {\n  const result: Array<[T[number], U[number]]> = [];\n\n  for (let index = 0; index < Math.min(first.length, second.length); index++) {\n    // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- we're getting the min length first\n    result.push([first[index]!, second[index]!]);\n  }\n\n  return result;\n}\n","import { zip } from '../../../zip';\nimport type { Context } from '../types';\n\n/**\n * Whether the arrays are equal in value.\n * @param array1 The first array.\n * @param array2 The second array.\n * @param context The context object.\n * @returns true if the two arrays are equal, false otherwise.\n */\nexport function areArraysEqual(\n  array1: readonly unknown[],\n  array2: readonly unknown[],\n  context: Context\n) {\n  if (array1.length !== array2.length) {\n    return false;\n  }\n\n  for (const [index, [element1, element2]] of zip(array1, array2).entries()) {\n    if (\n      !context.equals(element1, element2, index, index, array1, array2, context)\n    ) {\n      return false;\n    }\n  }\n\n  return true;\n}\n","import { Context, TypeEqualityComparator } from './types';\n\n/**\n * Wrap the provided `areItemsEqual` method to manage the circular state, allowing\n * for circular references to be safely included in the comparison without creating\n * stack overflows.\n * @param areItemsEqual The comparator to wrap.\n * @returns A comparator that can handle circular references.\n */\nexport function createIsCircularTypeEqualityComparator<T>(\n  areItemsEqual: TypeEqualityComparator<T>\n) {\n  return function isCircular(a: T, b: T, context: Context) {\n    if (!a || !b || typeof a !== 'object' || typeof b !== 'object') {\n      return areItemsEqual(a, b, context);\n    }\n\n    const { cache } = context;\n\n    const cachedA = cache.get(a);\n    const cachedB = cache.get(b);\n\n    if (cachedA && cachedB) {\n      return cachedA === b && cachedB === a;\n    }\n\n    cache.set(a, b);\n    cache.set(b, a);\n\n    const result = areItemsEqual(a, b, context);\n\n    cache.delete(a);\n    cache.delete(b);\n\n    return result;\n  };\n}\n","/**\n * Whether the dates passed are equal in value.\n * @param value1 The first date.\n * @param value2 The second date.\n * @returns true if the two dates are equal, false otherwise.\n */\nexport function areDatesEqual(value1: Date, value2: Date): boolean {\n  return Object.is(value1.getTime(), value2.getTime());\n}\n","export const DATE_TAG = '[object Date]';\n","import { Context } from '../types';\n\n/**\n * Whether the `Map`s are equal in value.\n * @param value1 The first `Map`.\n * @param value2 The second `Map`.\n * @param context The context object.\n * @returns true if the two `Map`s are equal, false otherwise.\n */\nexport function areMapsEqual(\n  value1: ReadonlyMap<unknown, unknown>,\n  value2: ReadonlyMap<unknown, unknown>,\n  context: Context\n): boolean {\n  if (value1.size !== value2.size) {\n    return false;\n  }\n\n  const matchedIndices: Record<number, true> = {};\n\n  let index = 0;\n\n  for (const [aKey, aValue] of value1) {\n    let hasMatch = false;\n    let matchIndex = 0;\n\n    for (const [bKey, bValue] of value2) {\n      if (\n        !hasMatch &&\n        !matchedIndices[matchIndex] &&\n        // eslint-disable-next-line no-cond-assign\n        (hasMatch =\n          context.equals(\n            aKey,\n            bKey,\n            index,\n            matchIndex,\n            value1,\n            value2,\n            context\n          ) &&\n          context.equals(aValue, bValue, aKey, bKey, value1, value2, context))\n      ) {\n        matchedIndices[matchIndex] = true;\n      }\n\n      matchIndex++;\n    }\n\n    if (!hasMatch) {\n      return false;\n    }\n\n    index++;\n  }\n\n  return true;\n}\n","/**\n * React-specific internal property that is used to track the component that created another component.\n * Provides us with simple circular reference detection and handling.\n */\nexport const REACT_OWNER_PROPERTY_NAME = '_owner';\n","import { Dictionary } from './Dictionary';\n\n/**\n * Get the properties to strictly examine, which include both own properties that are\n * not enumerable and symbol properties.\n * @param object The object to get the properties for.\n * @returns The properties to strictly examine.\n */\nexport function getObjectProperties(\n  object: Dictionary\n): Array<string | symbol> {\n  return [\n    ...Object.getOwnPropertyNames(object),\n    ...Object.getOwnPropertySymbols(object),\n  ];\n}\n","import { REACT_OWNER_PROPERTY_NAME } from '../react';\nimport { Context } from '../types/types';\n\nimport { Dictionary } from './Dictionary';\nimport { getObjectProperties } from './getObjectProperties';\n\n/**\n * Whether the objects are equal in value with strict property checking.\n * @param value1 The first object.\n * @param value2 The second object.\n * @param context The context object.\n * @returns true if the two objects are equal, false otherwise.\n */\nexport function areObjectsEqual(\n  value1: Dictionary,\n  value2: Dictionary,\n  context: Context\n): boolean {\n  const properties = getObjectProperties(value1);\n\n  if (getObjectProperties(value2).length !== properties.length) {\n    return false;\n  }\n\n  for (const property of properties) {\n    if (\n      property === REACT_OWNER_PROPERTY_NAME &&\n      (value1.$$typeof || value2.$$typeof) &&\n      value1.$$typeof !== value2.$$typeof\n    ) {\n      return false;\n    }\n\n    if (!Object.hasOwn(value2, property)) {\n      return false;\n    }\n\n    if (\n      !context.equals(\n        value1[property],\n        value2[property],\n        property,\n        property,\n        value1,\n        value2,\n        context\n      )\n    ) {\n      return false;\n    }\n  }\n\n  return true;\n}\n","/**\n * Whether the primitive wrappers passed are equal in value.\n * @param value1 The first primitive wrapper.\n * @param value2 The second primitive wrapper.\n * @returns true if the two primitive wrappers are equal, false otherwise.\n */\nexport function arePrimitiveWrappersEqual(\n  value1: PrimitiveWrapper,\n  value2: PrimitiveWrapper\n): boolean {\n  return Object.is(value1.valueOf(), value2.valueOf());\n}\n\n// eslint-disable-next-line @typescript-eslint/ban-types -- we explicitly check for primitive wrapper types\nexport type PrimitiveWrapper = Boolean | Number | String;\n","/**\n * Whether the regexps passed are equal in value.\n * @param value1 The first regexp.\n * @param value2 The second regexp.\n * @returns true if the two regexps are equal, false otherwise.\n */\nexport function areRegExpsEqual(value1: RegExp, value2: RegExp): boolean {\n  return value1.source === value2.source && value1.flags === value2.flags;\n}\n","export const REG_EXP_TAG = '[object RegExp]';\n","import { Context } from '../types';\n\n/**\n * Whether the `Set`s are equal in value.\n * @param set1 The first `Set`.\n * @param set2 The second `Set`.\n * @param context The context object.\n * @returns true if the two `Set`s are equal, false otherwise.\n */\nexport function areSetsEqual(\n  set1: ReadonlySet<unknown>,\n  set2: ReadonlySet<unknown>,\n  context: Context\n): boolean {\n  if (set1.size !== set2.size) {\n    return false;\n  }\n\n  const matchedIndices: Record<number, true> = {};\n\n  for (const element1 of set1) {\n    let hasMatch = false;\n    let matchIndex = 0;\n\n    for (const element2 of set2) {\n      if (\n        !hasMatch &&\n        !matchedIndices[matchIndex] &&\n        // eslint-disable-next-line no-cond-assign\n        (hasMatch = context.equals(\n          element1,\n          element2,\n          element1,\n          element2,\n          set1,\n          set2,\n          context\n        ))\n      ) {\n        matchedIndices[matchIndex] = true;\n      }\n\n      matchIndex++;\n    }\n\n    if (!hasMatch) {\n      return false;\n    }\n  }\n\n  return true;\n}\n","export const SET_TAG = '[object Set]';\n","import type { TypedArray } from 'type-fest';\n\nimport { zip } from '../../../zip';\n\n/**\n * Whether the TypedArray instances are equal in value.\n * @param array1 The first TypedArray instance.\n * @param array2 The second TypedArray instance.\n * @returns true if the two TypedArray instances are equal, false otherwise.\n */\nexport function areTypedArraysEqual(array1: TypedArray, array2: TypedArray) {\n  if (array1.length !== array2.length) {\n    return false;\n  }\n\n  for (const [element1, element2] of zip(array1, array2)) {\n    if (element1 !== element2) {\n      return false;\n    }\n  }\n\n  return true;\n}\n","export const isTypedArray =\n  typeof ArrayBuffer === 'function' && ArrayBuffer.isView\n    ? ArrayBuffer.isView\n    : null;\n","/* eslint-disable jsdoc/require-returns */\n/* eslint-disable jsdoc/require-param */\n\nimport { areArraysEqual } from './array';\nimport { createIsCircularTypeEqualityComparator } from './createIsCircularTypeEqualityComparator';\nimport { areDatesEqual } from './date';\nimport { areMapsEqual } from './map';\nimport { areObjectsEqual } from './object';\nimport { arePrimitiveWrappersEqual } from './primitiveWrappers';\nimport { areRegExpsEqual } from './regExp';\nimport { areSetsEqual } from './set';\nimport { areTypedArraysEqual } from './typedArray';\nimport type {\n  ComparatorConfig,\n  Context,\n  EqualityComparator,\n  InternalEqualityComparator,\n} from './types';\n\nexport const ARGUMENTS_TAG = '[object Arguments]';\nexport const BOOLEAN_TAG = '[object Boolean]';\nexport const MAP_TAG = '[object Map]';\nexport const NUMBER_TAG = '[object Number]';\nexport const OBJECT_TAG = '[object Object]';\nexport const STRING_TAG = '[object String]';\n\nexport const getTag = Object.prototype.toString.call.bind(\n  Object.prototype.toString\n) as (a: object) => string;\n\ninterface CreateIsEqualOptions {\n  comparator: EqualityComparator;\n  equals: InternalEqualityComparator;\n}\n\n/**\n * Create the configuration object used for building comparators.\n */\nexport function createEqualityComparatorConfig(): ComparatorConfig {\n  return {\n    areDatesEqual,\n    areRegExpsEqual,\n    arePrimitiveWrappersEqual,\n    areArraysEqual: createIsCircularTypeEqualityComparator(areArraysEqual),\n    areMapsEqual: createIsCircularTypeEqualityComparator(areMapsEqual),\n    areObjectsEqual: createIsCircularTypeEqualityComparator(areObjectsEqual),\n    areSetsEqual: createIsCircularTypeEqualityComparator(areSetsEqual),\n    areTypedArraysEqual,\n  };\n}\n\n/**\n * Default equality comparator pass-through, used as the standard `isEqual` creator for\n * use inside the built comparator.\n */\nexport function createInternalEqualityComparator(\n  compare: EqualityComparator\n): InternalEqualityComparator {\n  return function internalEqualityComparator(\n    value1: unknown,\n    value2: unknown,\n    _indexOrKeyA: unknown,\n    _indexOrKeyB: unknown,\n    _parentA: unknown,\n    _parentB: unknown,\n    context: Context\n  ) {\n    return compare(value1, value2, context);\n  };\n}\n\n/**\n * Create the `isEqual` function used by the consuming application.\n */\nexport function createIsEqual({ comparator, equals }: CreateIsEqualOptions) {\n  return function isEqual<T1, T2>(value1: T1, value2: T2): boolean {\n    return comparator(value1, value2, {\n      cache: new WeakMap(),\n      equals,\n    });\n  };\n}\n","/* eslint-disable @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access -- this entire file is basically unsafe at the type-level, but we check the types at runtime\n   and act accordingly. */\n\nimport type { TypedArray } from 'type-fest';\n\nimport { isArray } from '../../isArray';\n\nimport {\n  ARGUMENTS_TAG,\n  BOOLEAN_TAG,\n  getTag,\n  MAP_TAG,\n  NUMBER_TAG,\n  OBJECT_TAG,\n  STRING_TAG,\n} from './comparator';\nimport { DATE_TAG } from './date';\nimport { REG_EXP_TAG } from './regExp';\nimport { SET_TAG } from './set';\nimport { isTypedArray } from './typedArray';\nimport type { ComparatorConfig, Context, EqualityComparator } from './types';\n\n/**\n * Create a comparator method based on the type-specific equality comparators passed.\n * @param root0 The configuration object.\n * @param root0.areArraysEqual The array equality comparator.\n * @param root0.areDatesEqual The date equality comparator.\n * @param root0.areMapsEqual The map equality comparator.\n * @param root0.areObjectsEqual The object equality comparator.\n * @param root0.arePrimitiveWrappersEqual The primitive wrapper equality comparator.\n * @param root0.areRegExpsEqual The regular expression equality comparator.\n * @param root0.areSetsEqual The set equality comparator.\n * @param root0.areTypedArraysEqual The typed array equality comparator.\n * @returns The comparator method.\n */\nexport function createEqualityComparator({\n  areArraysEqual,\n  areDatesEqual,\n  areMapsEqual,\n  areObjectsEqual,\n  arePrimitiveWrappersEqual,\n  areRegExpsEqual,\n  areSetsEqual,\n  areTypedArraysEqual,\n}: ComparatorConfig): EqualityComparator {\n  /**\n   * compare the value of the two objects and return true if they are equivalent in values\n   * @param value1 the first value to compare\n   * @param value2 the second value to compare\n   * @param context the context object\n   * @returns true if the two values are equivalent in values\n   */\n  return function comparator(\n    // eslint-disable-next-line @typescript-eslint/no-explicit-any\n    value1: any,\n    // eslint-disable-next-line @typescript-eslint/no-explicit-any\n    value2: any,\n    context: Context\n  ): boolean {\n    // If the items are strictly equal, no need to do a value comparison.\n    if (Object.is(value1, value2) || value1 === value2) {\n      return true;\n    }\n\n    // Checks are listed in order of commonality of use-case:\n    //   1. Common complex object types (plain object, array)\n    //   2. Common data values (date, regexp)\n    //   3. Less-common complex object types (map, set)\n    //   4. Less-common data values (promise, primitive wrappers)\n    // Inherently this is both subjective and assumptive, however\n    // when reviewing comparable libraries in the wild this order\n    // appears to be generally consistent.\n    // Constructors should match, otherwise there is potential for false positives\n    // between class and subclass or custom object and POJO.\n    if (value1?.constructor !== value2?.constructor) {\n      return false;\n    }\n\n    // `isPlainObject` only checks against the object's own realm. Cross-realm\n    // comparisons are rare, and will be handled in the ultimate fallback, so\n    // we can avoid capturing the string tag.\n    if (value1.constructor === Object) {\n      return areObjectsEqual(value1, value2, context);\n    }\n\n    // `isArray()` works on subclasses and is cross-realm, so we can avoid capturing\n    // the string tag or doing an `instanceof` check.\n    if (isArray(value1)) {\n      return areArraysEqual(value1, value2, context);\n    }\n\n    // `isTypedArray()` works on all possible TypedArray classes, so we can avoid\n    // capturing the string tag or comparing against all possible constructors.\n    if (isTypedArray?.(value1)) {\n      return areTypedArraysEqual(value1 as TypedArray, value2, context);\n    }\n\n    // Try to fast-path equality checks for other complex object types in the\n    // same realm to avoid capturing the string tag. Strict equality is used\n    // instead of `instanceof` because it is more performant for the common\n    // use-case. If someone is subclassing a native class, it will be handled\n    // with the string tag comparison.\n    if (value1.constructor === Date) {\n      return areDatesEqual(value1, value2, context);\n    }\n\n    if (value1.constructor === RegExp) {\n      return areRegExpsEqual(value1, value2, context);\n    }\n\n    if (value1.constructor === Map) {\n      return areMapsEqual(value1, value2, context);\n    }\n\n    if (value1.constructor === Set) {\n      return areSetsEqual(value1, value2, context);\n    }\n\n    // Since this is a custom object, capture the string tag to determine its type.\n    const tag = getTag(value1);\n    switch (tag) {\n      case DATE_TAG: {\n        return areDatesEqual(value1, value2, context);\n      }\n      case REG_EXP_TAG: {\n        return areRegExpsEqual(value1, value2, context);\n      }\n      case MAP_TAG: {\n        return areMapsEqual(value1, value2, context);\n      }\n      case SET_TAG: {\n        return areSetsEqual(value1, value2, context);\n      }\n      case OBJECT_TAG: {\n        // The exception for value comparison is custom `Promise`-like class instances. These should\n        // be treated the same as standard `Promise` objects, which means strict equality, and if\n        // it reaches this point then that strict equality comparison has already failed.\n        return (\n          // eslint-disable-next-line unicorn/consistent-destructuring\n          // eslint-disable-next-line unicorn/consistent-destructuring\n          typeof value1.then !== 'function' &&\n          typeof value2.then !== 'function' &&\n          areObjectsEqual(value1, value2, context)\n        );\n      }\n      // If an arguments tag, it should be treated as a standard object.\n      case ARGUMENTS_TAG: {\n        return areObjectsEqual(value1, value2, context);\n      }\n      // As the penultimate fallback, check if the values passed are primitive wrappers. This\n      // is very rare in modern JS, which is why it is deprioritized compared to all other object\n      // types.\n      case BOOLEAN_TAG:\n      case NUMBER_TAG:\n      case STRING_TAG: {\n        return arePrimitiveWrappersEqual(value1, value2, context);\n      }\n      // If not matching any tags that require a specific type of comparison, then we hard-code false because\n      // the only thing remaining is strict equality, which has already been compared. This is for a few reasons:\n      //   - Certain types that cannot be introspected (e.g., `WeakMap`). For these types, this is the only\n      //     comparison that can be made.\n      //   - For types that can be introspected, but rarely have requirements to be compared\n      //     (`ArrayBuffer`, `DataView`, etc.), the cost is avoided to prioritize the common\n      //     use-cases (may be included in a future release, if requested enough).\n      //   - For types that can be introspected but do not have an objective definition of what\n      //     equality is (`Error`, etc.), the subjective decision is to be conservative and strictly compare.\n      // In all cases, these decisions should be reevaluated based on changes to the language and\n      // common development practices.\n      default: {\n        return false;\n      }\n    }\n  };\n}\n","/**\n * Slimmed down version of https://github.com/planttheidea/fast-equals\n * Without all the configuration options, and with a few tweaks to make it more readable (though a bit less performant)\n */\n\nimport {\n  createEqualityComparatorConfig,\n  createInternalEqualityComparator,\n  createIsEqual,\n} from './_internal/comparator';\nimport { createEqualityComparator } from './_internal/createEqualityComparator';\n\n/**\n * Compare two values to determine if they are deeply equivalent by value.\n * @param value1 The first value to compare.\n * @param value2 The second value to compare.\n * @returns `true` if the two values are equivalent, `false` otherwise.\n * @example\n * ```ts\n * isEqual(1, 1); // true\n * isEqual(1, '1'); // false\n * isEqual({ a: 1 }, { a: 1 }); // true\n * isEqual({ a: 1 }, { a: 2 }); // false\n * isEqual(new Date('2020-01-01'), new Date('2020-01-01')); // true\n * isEqual(new Set([1, 2, 3]), new Set([3, 2, 1])); // true\n */\nexport const isEqual = createCustomEqual();\n\n/**\n * Create a custom equality comparison method.\n *\n * This can be done to create very targeted comparisons in extreme hot-path scenarios\n * where the standard methods are not performant enough, but can also be used to provide\n * support for legacy environments that do not support expected features like\n * `RegExp.prototype.flags` out of the box.\n * @returns A function that can be used to compare values.\n */\nfunction createCustomEqual() {\n  const config = createEqualityComparatorConfig();\n  const comparator = createEqualityComparator(config);\n  const equals = createInternalEqualityComparator(comparator);\n\n  return createIsEqual({ comparator, equals });\n}\n","/**\n * Checks if a value is not null or undefined.\n * @param value The value to inspect.\n * @returns Returns `true` if the value is NOT `null` or `undefined`, or `false` otherwise.\n */\nexport function isNonNullable<T>(value: T): value is NonNullable<T> {\n  return value != null;\n}\n","import { NonFunction } from '../../types/_internal';\n\n/**\n * Same as `Array.prototype.join`, but allows specifying a non-`string` separator.\n * @param elements The elements to join.\n * @param separator The separator to use.\n * @returns An array with the elements joined by the separator.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any -- only used as generic constraints\nexport function join<T extends NonFunction<any>, U extends NonFunction<any>>(\n  elements: ReadonlyArray<NonNullable<T>>,\n  separator: U | ((index: number) => U)\n): Array<symbol | U | NonNullable<T>> {\n  const emptySeparator = Symbol('emptySeparator');\n\n  const separatorFunction =\n    typeof separator === 'function'\n      ? (separator as (index: number) => NonNullable<U>)\n      : () => separator;\n\n  return elements\n    .flatMap((element, index, array) => [\n      element,\n      index < array.length - 1 ? separatorFunction(index) : emptySeparator,\n    ])\n    .filter((item) => item !== emptySeparator);\n}\n","import type { KebabCase as KebabCaseImplementation } from 'type-fest';\n\n/**\n * Changes the casing of a string to kebab case.\n * @param string The input string to change the casing of.\n * @returns A new string with the casing changed to kebab case.\n * @example\n * ```ts\n * kebabCase('fooBar') // 'foo-bar'\n * kebabCase('foo bar') // 'foo-bar'\n * kebabCase('foo-bar') // 'foo-bar'\n * kebabCase('fooBar42') // 'foo-bar42'\n * ```\n */\nexport function kebabCase<S extends string>(string: S): KebabCase<S> {\n  if (!/[a-z]+/i.test(string)) {\n    return string as KebabCase<S>;\n  }\n\n  return string\n    .match(KEBAB_REGEX)\n    ?.map((x) => x.toLowerCase())\n    .join('-') as KebabCase<S>;\n}\n\nconst KEBAB_REGEX = /[A-Z]{2,}(?=[A-Z][a-z]+\\d*|\\b)|[A-Z]?[a-z]+\\d*|[A-Z]|\\d+/g;\n\n/**\n * Changes the casing of a string to kebab case.\n * @see {@link kebabCase}.\n */\nexport type KebabCase<S extends string> = TrimDashes<\n  ReduceDashes<KebabCaseImplementation<S>>\n>;\n\n/**\n * Reduces multiple dashes to a single dash.\n * @param S The input string.\n * @returns A new string with multiple dashes reduced to a single dash.\n * @example\n * ```ts\n * ReduceDashes<'foo--bar'> // 'foo-bar'\n * ReduceDashes<'foo-bar'> // 'foo-bar'\n * ReduceDashes<'foo---bar'> // 'foo-bar'\n * ```\n */\ntype ReduceDashes<S extends string> = S extends `${infer L}--${infer R}`\n  ? ReduceDashes<`${L}-${R}`>\n  : S extends `${infer L}${infer D}--${infer R}`\n    ? ReduceDashes<`${L}${D}-${R}`>\n    : S;\n\n/**\n * Trims dashes from the start and end of a string.\n * @param S The input string.\n * @returns A new string with dashes trimmed from the start and end.\n * @example\n * ```ts\n * TrimDashes<'-foo-bar-'> // 'foo-bar'\n * TrimDashes<'foo-bar-'> // 'foo-bar'\n * TrimDashes<'-foo-bar'> // 'foo-bar'\n * TrimDashes<'foo-bar'> // 'foo-bar'\n * ```\n */\ntype TrimDashes<S extends string> = S extends `-${infer R}`\n  ? TrimDashes<R>\n  : S extends `${infer L}-`\n    ? TrimDashes<L>\n    : S;\n","/**\n * Creates an object composed of keys generated from the results of running each element of `array` through `keyGetter`.\n * The corresponding value of each key is the last element responsible for generating the key.\n * @param array The array to iterate over.\n * @param keyGetter The function used to extract the key from each element.\n * @returns An object with the keys mapped to the elements.\n * @example\n * ```ts\n * keyBy(\n *  [\n *    { id: 'a', value: 1 },\n *    { id: 'b', value: 2 },\n *    { id: 'c', value: 3 },\n *  ],\n *  (item) => item.id\n * )\n * // {\n * //   a: { id: 'a', value: 1 },\n * //   b: { id: 'b', value: 2 },\n * //   c: { id: 'c', value: 3 }\n * // }\n * ```\n */\nexport function keyBy<T, K extends PropertyKey>(\n  array: readonly T[],\n  keyGetter: (item: T) => K\n): Partial<Record<K, T>> {\n  return array.reduce(\n    (draftObject, currentItem) => {\n      const key = keyGetter(currentItem);\n\n      // eslint-disable-next-line no-param-reassign\n      draftObject[key] = currentItem;\n\n      return draftObject;\n    },\n    {} as Partial<Record<K, T>>\n  );\n}\n","import { CastToString, KeysOfUnion } from '../../types';\n\nexport const objectEntries: ObjetEntries = Object.entries;\n\n/**\n * Returns an array of a given object's own enumerable string-keyed property [key, value] pairs, in the same order as that provided by a for...in loop. (The only important difference is that a for...in loop enumerates properties in the prototype chain as well.)\n * Same as `Object.entries()` but returns a typed array.\n * @param object An object whose enumerable own property [key, value] pairs are to be returned.\n * @returns An array of the given object's own enumerable string-keyed property [key, value] pairs.\n */\ntype ObjetEntries = <T extends object>(\n  object: T\n) => Array<[CastToString<KeysOfUnion<T>>, T[keyof T]]>;\n","export const objectFromEntries: ObjectFromEntries = Object.fromEntries;\n\n/**\n * Returns a new object from an iterable of key-value pairs.\n * Same as `Object.fromEntries()` but returns a typed object.\n * @param entries An iterable object that contains key-value entries.\n * @returns A new object from the given iterable of key-value pairs.\n * @example\n * ```ts\n * objectFromEntries([\n *   ['a', 1],\n *   ['b', 2],\n *   ['c', 3]\n * ]);\n * // { a: 1, b: 2, c: 3 }\n */\ntype ObjectFromEntries = <K extends PropertyKey, V>(\n  entries: Iterable<readonly [K, V]>\n) => Record<K, V>;\n","import { CastToString } from '../../types';\nimport { objectEntries } from '../objectEntries';\nimport { objectFromEntries } from '../objectFromEntries';\n\n/**\n * Returns a new object with the same values as the given object, but with each key mapped to a new key as returned by the given mapper function.\n * @param object The object to map the keys of.\n * @param mapperFunction The function to map the keys with.\n * @returns A new object with the mapped keys.\n */\nexport function mapKeys<T extends object, K extends PropertyKey>(\n  object: T,\n  mapperFunction: (\n    key: CastToString<keyof T>,\n    value: T[keyof T],\n    object: T\n  ) => K\n): Record<K, T[keyof T]> {\n  return objectFromEntries(\n    objectEntries(object).map(([key, value]) => [\n      mapperFunction(key, value, object),\n      value,\n    ])\n  );\n}\n","import { CastToString, KeysOfUnion } from '../../types';\nimport { objectEntries } from '../objectEntries';\nimport { objectFromEntries } from '../objectFromEntries';\n\n/**\n * Returns a new object with the same keys as the given object, but with each value mapped to a new value as returned by the given mapper function.\n * @param object The object to map.\n * @param mapperFunction The function used to map each value.\n * @returns A new object with the same keys as the given object, but with each value mapped to a new value as returned by the given mapper function.\n * @example\n * ```ts\n * mapValues({ a: 1, b: 2, c: 3 }, (value) => value * 2) // { a: 2, b: 4, c: 6 }\n * ```\n */\nexport function mapValues<T extends object, V>(\n  object: T,\n  mapperFunction: (value: T[keyof T], key: CastToString<KeysOfUnion<T>>) => V\n): Record<keyof T, V> {\n  return objectFromEntries(\n    objectEntries(object).map(([key, value]) => [\n      key,\n      mapperFunction(value, key),\n    ])\n  ) as Record<keyof T, V>;\n}\n","import { Maybe } from '../../types';\n\n/**\n * Computes the maximum value of array. If array is empty or nil, `undefined` is returned.\n * @param array The array to iterate over.\n * @returns The maximum value in the array, or `undefined` if the array is empty or nil.\n */\nexport function max<T>(array: Maybe<readonly T[]>): number;\n/**\n * Computes the maximum value of array. If array is empty or nil, `undefined` is returned.\n * @param array The array to iterate over.\n * @param valueExtractor An optional function used to extract a numeric value from each element.\n * @returns The maximum value in the array, or `undefined` if the array is empty or nil.\n */\nexport function max<T>(\n  array: Maybe<readonly T[]>,\n  valueExtractor?: (value: T) => number\n): number;\n/**\n * Implementation for all overloads.\n * @param array The array to iterate over.\n * @param valueExtractor The function used to extract a numeric value from each element.\n * @returns The maximum value in the array, or `undefined` if the array is empty or nil.\n */\nexport function max<T>(\n  array: Maybe<readonly T[]>,\n  valueExtractor: (value: T) => number = (value) => value as unknown as number\n): number | undefined {\n  if (array == null || array.length === 0) {\n    return undefined;\n  }\n\n  return Math.max(...array.map((element) => valueExtractor(element)));\n}\n","import { AnyFunction } from '../../types/_internal';\n\n/**\n * Memoizes a function.\n * @param fn The function to memoize.\n * @param cacheKeyResolver An optional function used to resolve the cache key. Defaults to the first argument in the function call.\n * @returns The memoized function.\n */\nexport function memoize<TFunction extends AnyFunction>(\n  // eslint-disable-next-line unicorn/prevent-abbreviations -- `function` is a reserved word\n  fn: TFunction,\n  cacheKeyResolver?: (...args: Parameters<TFunction>) => string\n): TFunction {\n  const cache = new Map<unknown, ReturnType<TFunction>>();\n\n  return function memoizedFunction(\n    ...args: Parameters<TFunction>\n  ): ReturnType<TFunction> {\n    const cacheKey: unknown = cacheKeyResolver\n      ? cacheKeyResolver(...args)\n      : args[0];\n\n    if (cache.has(cacheKey)) {\n      // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n      return cache.get(cacheKey)!;\n    }\n\n    const result = fn(...args) as ReturnType<TFunction>;\n    cache.set(cacheKey, result);\n\n    // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n    return result;\n  } as TFunction;\n}\n","import { Maybe } from '../../types';\n\n/**\n * Computes the maximum value of array. If array is empty or nil, `undefined` is returned.\n * @param array The array to iterate over.\n * @returns The maximum value in the array, or `undefined` if the array is empty or nil.\n */\nexport function min<T>(array: Maybe<readonly T[]>): number;\n/**\n * Computes the minimum value of array. If array is empty or nil, `undefined` is returned.\n * @param array The array to iterate over.\n * @param valueExtractor An optional function used to extract a numeric value from each element.\n * @returns The minimum value in the array, or `undefined` if the array is empty or nil.\n */\nexport function min<T>(\n  array: Maybe<readonly T[]>,\n  valueExtractor?: (value: T) => number\n): number;\n/**\n * Implementation for all overloads.\n * @param array The array to iterate over.\n * @param valueExtractor The function used to extract a numeric value from each element.\n * @returns The minimum value in the array, or `undefined` if the array is empty or nil.\n */\nexport function min<T>(\n  array: Maybe<readonly T[]>,\n  valueExtractor: (value: T) => number = (value) => value as unknown as number\n): number | undefined {\n  if (array == null || array.length === 0) {\n    return undefined;\n  }\n\n  return Math.min(...array.map((element) => valueExtractor(element)));\n}\n","/**\n * A no-operation function that returns `undefined` for any input.\n * @param args Any arguments.\n * @example\n * ```ts\n * noop() // undefined\n * noop(1, 2, 3) // undefined\n * ```\n */\n// eslint-disable-next-line @typescript-eslint/no-unused-vars -- this is the whole point of the function\nexport function noop(...args: readonly unknown[]): void {}\n","import type { StringKeyOf } from 'type-fest';\n\nimport { AnyFunction } from '../../types/_internal';\n\nexport const objectKeys: ObjectKeys = Object.keys;\n\n/**\n * Returns an array of a given object's own enumerable property names, iterated in the same order that a normal loop would.\n * Same as `Object.keys`, but with typed keys.\n * @param object An object to get the keys of.\n * @returns An array of strings that represent all the enumerable properties of the given object.\n * @note The type of the object is inferred from the type of the `object` parameter, so if that's incorrect/incomplete\n * more keys might be returned than actually exist on the object. See https://github.com/Microsoft/TypeScript/issues/12870 for more info.\n */\ntype ObjectKeys = <T extends object>(\n  object: Exclude<T, AnyFunction>\n) => Array<StringKeyOf<T>>;\n","import {\n  CastToString,\n  KeysOfUnion,\n  Many,\n  PropertyValueOfUnion,\n} from '../../../types';\nimport { castArray } from '../../castArray';\nimport { createTypeGuard } from '../../createTypeGuard';\n\nexport function createObjectPredicate<\n  T extends object,\n  const K extends keyof T | KeysOfUnion<T>,\n>(properties: Many<K>): ObjectPredicate<T>;\nexport function createObjectPredicate<T extends object>(\n  predicate: ObjectPredicate<T>\n): ObjectPredicate<T>;\nexport function createObjectPredicate<\n  T extends object,\n  const K extends keyof T | KeysOfUnion<T>,\n>(propertiesOrPredicate: Many<K> | ObjectPredicate<T>): ObjectPredicate<T>;\nexport function createObjectPredicate<\n  T extends object,\n  const K extends keyof T | KeysOfUnion<T>,\n>(propertiesOrPredicate: Many<K> | ObjectPredicate<T>): ObjectPredicate<T> {\n  return typeof propertiesOrPredicate === 'function'\n    ? propertiesOrPredicate\n    : createPropertiesPredicate(propertiesOrPredicate);\n}\n\nexport type ObjectPredicate<T extends object> = (\n  value: Exclude<PropertyValueOfUnion<T, KeysOfUnion<T>>, undefined>,\n  key: CastToString<KeysOfUnion<T>>,\n  object: T\n) => boolean;\n\nfunction createPropertiesPredicate<\n  T extends object,\n  const K extends keyof T | KeysOfUnion<T>,\n>(properties: Many<K>): ObjectPredicate<T> {\n  const isKnownProperty = createTypeGuard(castArray(properties));\n\n  return (_value, key) => isKnownProperty(key);\n}\n","import { KeysOfUnion, Maybe, PropertyValueOfUnion } from '../../../types';\nimport { objectEntries } from '../../objectEntries';\n\nimport { ObjectPredicate } from './createObjectPredicate';\n\nexport function filterObject<T extends object>(\n  object: Maybe<T>,\n  predicate: ObjectPredicate<T>\n) {\n  if (object == null) {\n    return {};\n  }\n\n  return Object.fromEntries(\n    objectEntries(object).filter(([key, value]) =>\n      predicate(\n        value as Exclude<PropertyValueOfUnion<T, KeysOfUnion<T>>, undefined>,\n        key,\n        object\n      )\n    )\n  );\n}\n","import { KeysOfUnion, Many, Maybe } from '../../types';\nimport {\n  createObjectPredicate,\n  filterObject,\n  ObjectPredicate,\n} from '../_internal/filterObject';\nimport { negate } from '../negate';\n\n/**\n * Returns a new object with all properties except the specified properties from the input object.\n * @param object The input object to omit properties from.\n * @param properties An array of property names to omit from the input object.\n * @returns A new object with all properties except the specified properties from the input object.\n */\nexport function omit<\n  T extends object,\n  const K extends keyof T | KeysOfUnion<T>,\n>(object: Maybe<T>, properties: Many<K>): Omit<T, K>;\n/**\n * Returns a new object with all properties except the properties that satisfy the predicate function from the input object.\n * @param object The input object to omit properties from.\n * @param predicate A function that takes a property value and its key and returns a boolean indicating whether to omit the property or not.\n * @returns A new object with all properties except the properties that satisfy the predicate function from the input object.\n */\nexport function omit<T extends object>(\n  object: Maybe<T>,\n  predicate: ObjectPredicate<T>\n): Partial<T>;\n/**\n * Implementation of the omit function.\n * @param object The input object to omit properties from.\n * @param propertiesOrPredicate Either an array of property names to omit from the input object, or a function that takes a property value and its key and returns a boolean indicating whether to omit the property or not.\n * @returns A new object with all properties except the specified properties from the input object.\n */\nexport function omit<\n  T extends object,\n  const K extends keyof T | KeysOfUnion<T>,\n>(object: T, propertiesOrPredicate: Many<K> | ObjectPredicate<T>) {\n  return filterObject(\n    object,\n    negate(createObjectPredicate(propertiesOrPredicate))\n  );\n}\n","import { AnyFunction } from '../../types/_internal';\n\n/**\n * Invokes the given function only once, no matter how many times it's called.\n * If it was already invoked before, returns the result from the first invocation.\n * @template TFunction The type of the function to be invoked.\n * @param fn The function to be invoked.\n * @returns The result of the first invocation of the function.\n */\nexport function once<TFunction extends AnyFunction>(\n  // eslint-disable-next-line unicorn/prevent-abbreviations -- `function` is a reserved word\n  fn: TFunction\n): TFunction {\n  let result: ReturnType<TFunction> | undefined;\n  let hasBeenCalled = false;\n\n  return ((...args: Parameters<TFunction>) => {\n    if (!hasBeenCalled) {\n      // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n      result = fn(...args);\n      hasBeenCalled = true;\n    }\n\n    // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n    return result;\n  }) as TFunction;\n}\n","import type { Primitive } from 'type-fest';\n\nimport { KeysOfUnion, Many, Maybe } from '../../types';\nimport { castArray } from '../castArray';\n\n/**\n * Sorts an array of objects by one or more properties, in ascending or descending order.\n * @param array The array of objects to sort.\n * @param iterators The property or properties to sort by. Can be a key of `TValue` or a function that returns a comparable value.\n * @param orders The order or orders to sort by. Can be \"asc\" or \"desc\". Defaults to \"asc\".\n * @returns A new array of objects sorted by the specified properties and orders.\n */\nexport function orderBy<TValue>(\n  array: Maybe<readonly TValue[]>,\n  iterators: Many<OrderByIterator<TValue>>,\n  orders?: Many<Order>\n): TValue[] {\n  if (array == null) return [];\n\n  const normalizedIteratees = castArray(iterators).map((iteratee) =>\n    typeof iteratee === 'function'\n      ? iteratee\n      : (value: TValue) => value[iteratee]\n  );\n\n  const normalizedOrders = castArray(orders);\n\n  return [...array].sort((a, b) => {\n    for (const [index, iteratee] of normalizedIteratees.entries()) {\n      const normalizedOrder = normalizedOrders[index] ?? 'asc';\n      const order = normalizedOrder === 'desc' ? -1 : 1;\n\n      const aValue = iteratee(a);\n      const bValue = iteratee(b);\n\n      /* eslint-disable @typescript-eslint/no-non-null-assertion -- JS can compare null and undefined using `<` and */\n      if (aValue! < bValue!) return -1 * order;\n      if (aValue! > bValue!) return 1 * order;\n      /* eslint-enable @typescript-eslint/no-non-null-assertion */\n    }\n\n    return 0;\n  });\n}\n\ntype Order = 'asc' | 'desc';\n\ntype OrderByIterator<TValue> =\n  | ((value: TValue) => ComparableValue)\n  | KeysOfUnion<TValue>;\n\ntype ComparableValue =\n  | Exclude<Primitive, symbol>\n  | { [Symbol.toPrimitive](): Primitive }\n  | { valueOf(): Primitive }\n  | { toString(): string }\n  | { [Symbol.toStringTag]: string };\n","import { Maybe } from '../../types';\n\n/**\n * Partitions an array into two arrays based on a predicate function.\n * @param array The input array to partition.\n * @param predicate A function that takes an array item and returns a boolean indicating whether the item should be included in the \"equals\" array or the \"notEquals\" array.\n * @returns A tuple containing two arrays: the \"equals\" array and the \"notEquals\" array.\n */\nexport function partition<T, S extends T>(\n  array: Maybe<readonly T[]>,\n  predicate: (item: T) => item is S\n): readonly [equals: S[], notEquals: Array<Exclude<T, S>>];\n/**\n * Partitions an array into two arrays based on a predicate function.\n * @param array The input array to partition.\n * @param predicate A function that takes an array item and returns a boolean indicating whether the item should be included in the \"equals\" array or the \"notEquals\" array.\n * @returns A tuple containing two arrays: the \"equals\" array and the \"notEquals\" array.\n */\nexport function partition<T>(\n  array: Maybe<readonly T[]>,\n  predicate: (item: T) => boolean\n): readonly [equals: T[], notEquals: T[]];\n/**\n * Implementation of all overloads.\n * @param array The input array to partition.\n * @param predicate A function that takes an array item and returns a boolean indicating whether the item should be included in the \"equals\" array or the \"notEquals\" array.\n * @returns A tuple containing two arrays: the \"equals\" array and the \"notEquals\" array.\n */\nexport function partition<T, S extends T>(\n  array: Maybe<readonly T[]>,\n  predicate: ((item: T) => item is S) | ((item: T) => boolean)\n): readonly [S[], Array<Exclude<T, S>>] {\n  if (array == null) {\n    return [[], []];\n  }\n\n  const equals: S[] = [];\n  const notEquals: Array<Exclude<T, S>> = [];\n\n  for (const item of array) {\n    if (predicate(item)) {\n      equals.push(item as S);\n    } else {\n      notEquals.push(item as Exclude<T, S>);\n    }\n  }\n\n  return [equals, notEquals];\n}\n","import { KeysOfUnion, Many, Maybe } from '../../types';\nimport {\n  createObjectPredicate,\n  filterObject,\n  ObjectPredicate,\n} from '../_internal/filterObject';\n\n/**\n * Returns a new object with only the specified properties from the input object.\n * @param object The input object to pick properties from.\n * @param properties An array of property names to pick from the input object.\n * @returns A new object with only the specified properties from the input object.\n */\nexport function pick<\n  T extends object,\n  const K extends keyof T | KeysOfUnion<T>,\n>(object: Maybe<T>, properties: Many<K>): Pick<T, K>;\n/**\n * Returns a new object with only the properties that satisfy the predicate function from the input object.\n * @param object The input object to pick properties from.\n * @param predicate A function that takes a property value and its key and returns a boolean indicating whether to pick the property or not.\n * @returns A new object with only the properties that satisfy the predicate function from the input object.\n */\nexport function pick<T extends object>(\n  object: Maybe<T>,\n  predicate: ObjectPredicate<T>\n): Partial<T>;\n/**\n * Implementation for all overloads.\n * @param object The input object to pick properties from.\n * @param propertiesOrPredicate Either an array of property names to pick from the input object or a function that takes a property value and its key and returns a boolean indicating whether to pick the property or not.\n * @returns A new object with only the specified properties from the input object.\n */\nexport function pick<\n  T extends object,\n  const K extends keyof T | KeysOfUnion<T>,\n>(object: Maybe<T>, propertiesOrPredicate: Many<K> | ObjectPredicate<T>) {\n  return filterObject(object, createObjectPredicate(propertiesOrPredicate));\n}\n","/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable unicorn/prevent-abbreviations */\nimport { Func } from './types/Func';\nimport { UnaryFunction } from './types/UnaryFunction';\n\n/**\n * Type-enforcing left-to-right function composition function.\n * The first parameter can be a function of any arity, but the remaining parameters must be unary functions.\n * The return type of one function must be compatible with the argument of next function in the argument list\n * @param f0 The first function in the composition\n * @note The types here are only inferred for the first 20 functions.\n * If you need more, you have to type the functions explicitly.\n * please open an issue, but this should be enough to cover most use cases.\n * @returns A function with the arguments of the *first* function in the argument list and a return type of the *last* function in the argument list\n */\nexport function pipe<TIn extends unknown[], TOut>(\n  f0: Func<TIn, TOut>\n): Func<TIn, TOut>;\nexport function pipe<TIn extends unknown[], T1, TOut>(\n  f0: Func<TIn, T1>,\n  f1: UnaryFunction<T1, TOut>\n): Func<TIn, TOut>;\nexport function pipe<TIn extends unknown[], T1, T2, TOut>(\n  f0: Func<TIn, T1>,\n  f1: UnaryFunction<T1, T2>,\n  f2: UnaryFunction<T2, TOut>\n): Func<TIn, TOut>;\nexport function pipe<TIn extends unknown[], T1, T2, T3, TOut>(\n  f0: Func<TIn, T1>,\n  f1: UnaryFunction<T1, T2>,\n  f2: UnaryFunction<T2, T3>,\n  f3: UnaryFunction<T3, TOut>\n): Func<TIn, TOut>;\nexport function pipe<TIn extends unknown[], T1, T2, T3, T4, TOut>(\n  f0: Func<TIn, T1>,\n  f1: UnaryFunction<T1, T2>,\n  f2: UnaryFunction<T2, T3>,\n  f3: UnaryFunction<T3, T4>,\n  f4: UnaryFunction<T4, TOut>\n): Func<TIn, TOut>;\nexport function pipe<TIn extends unknown[], T1, T2, T3, T4, T5, TOut>(\n  f0: Func<TIn, T1>,\n  f1: UnaryFunction<T1, T2>,\n  f2: UnaryFunction<T2, T3>,\n  f3: UnaryFunction<T3, T4>,\n  f4: UnaryFunction<T4, T5>,\n  f5: UnaryFunction<T5, TOut>\n): Func<TIn, TOut>;\nexport function pipe<TIn extends unknown[], T1, T2, T3, T4, T5, T6, TOut>(\n  f0: Func<TIn, T1>,\n  f1: UnaryFunction<T1, T2>,\n  f2: UnaryFunction<T2, T3>,\n  f3: UnaryFunction<T3, T4>,\n  f4: UnaryFunction<T4, T5>,\n  f5: UnaryFunction<T5, T6>,\n  f6: UnaryFunction<T6, TOut>\n): Func<TIn, TOut>;\nexport function pipe<TIn extends unknown[], T1, T2, T3, T4, T5, T6, T7, TOut>(\n  f0: Func<TIn, T1>,\n  f1: UnaryFunction<T1, T2>,\n  f2: UnaryFunction<T2, T3>,\n  f3: UnaryFunction<T3, T4>,\n  f4: UnaryFunction<T4, T5>,\n  f5: UnaryFunction<T5, T6>,\n  f6: UnaryFunction<T6, T7>,\n  f7: UnaryFunction<T7, TOut>\n): Func<TIn, TOut>;\nexport function pipe<\n  TIn extends unknown[],\n  T1,\n  T2,\n  T3,\n  T4,\n  T5,\n  T6,\n  T7,\n  T8,\n  TOut,\n>(\n  f0: Func<TIn, T1>,\n  f1: UnaryFunction<T1, T2>,\n  f2: UnaryFunction<T2, T3>,\n  f3: UnaryFunction<T3, T4>,\n  f4: UnaryFunction<T4, T5>,\n  f5: UnaryFunction<T5, T6>,\n  f6: UnaryFunction<T6, T7>,\n  f7: UnaryFunction<T7, T8>,\n  f8: UnaryFunction<T8, TOut>\n): Func<TIn, TOut>;\nexport function pipe<\n  TIn extends unknown[],\n  T1,\n  T2,\n  T3,\n  T4,\n  T5,\n  T6,\n  T7,\n  T8,\n  T9,\n  TOut,\n>(\n  f0: Func<TIn, T1>,\n  f1: UnaryFunction<T1, T2>,\n  f2: UnaryFunction<T2, T3>,\n  f3: UnaryFunction<T3, T4>,\n  f4: UnaryFunction<T4, T5>,\n  f5: UnaryFunction<T5, T6>,\n  f6: UnaryFunction<T6, T7>,\n  f7: UnaryFunction<T7, T8>,\n  f8: UnaryFunction<T8, T9>,\n  f9: UnaryFunction<T9, TOut>\n): Func<TIn, TOut>;\nexport function pipe<\n  TIn extends unknown[],\n  T1,\n  T2,\n  T3,\n  T4,\n  T5,\n  T6,\n  T7,\n  T8,\n  T9,\n  T10,\n  TOut,\n>(\n  f0: Func<TIn, T1>,\n  f1: UnaryFunction<T1, T2>,\n  f2: UnaryFunction<T2, T3>,\n  f3: UnaryFunction<T3, T4>,\n  f4: UnaryFunction<T4, T5>,\n  f5: UnaryFunction<T5, T6>,\n  f6: UnaryFunction<T6, T7>,\n  f7: UnaryFunction<T7, T8>,\n  f8: UnaryFunction<T8, T9>,\n  f9: UnaryFunction<T9, T10>,\n  f10: UnaryFunction<T10, TOut>\n): Func<TIn, TOut>;\nexport function pipe<\n  TIn extends unknown[],\n  T1,\n  T2,\n  T3,\n  T4,\n  T5,\n  T6,\n  T7,\n  T8,\n  T9,\n  T10,\n  T11,\n  TOut,\n>(\n  f0: Func<TIn, T1>,\n  f1: UnaryFunction<T1, T2>,\n  f2: UnaryFunction<T2, T3>,\n  f3: UnaryFunction<T3, T4>,\n  f4: UnaryFunction<T4, T5>,\n  f5: UnaryFunction<T5, T6>,\n  f6: UnaryFunction<T6, T7>,\n  f7: UnaryFunction<T7, T8>,\n  f8: UnaryFunction<T8, T9>,\n  f9: UnaryFunction<T9, T10>,\n  f10: UnaryFunction<T10, T11>,\n  f11: UnaryFunction<T11, TOut>\n): Func<TIn, TOut>;\nexport function pipe<\n  TIn extends unknown[],\n  T1,\n  T2,\n  T3,\n  T4,\n  T5,\n  T6,\n  T7,\n  T8,\n  T9,\n  T10,\n  T11,\n  T12,\n  TOut,\n>(\n  f0: Func<TIn, T1>,\n  f1: UnaryFunction<T1, T2>,\n  f2: UnaryFunction<T2, T3>,\n  f3: UnaryFunction<T3, T4>,\n  f4: UnaryFunction<T4, T5>,\n  f5: UnaryFunction<T5, T6>,\n  f6: UnaryFunction<T6, T7>,\n  f7: UnaryFunction<T7, T8>,\n  f8: UnaryFunction<T8, T9>,\n  f9: UnaryFunction<T9, T10>,\n  f10: UnaryFunction<T10, T11>,\n  f11: UnaryFunction<T11, T12>,\n  f12: UnaryFunction<T12, TOut>\n): Func<TIn, TOut>;\nexport function pipe<\n  TIn extends unknown[],\n  T1,\n  T2,\n  T3,\n  T4,\n  T5,\n  T6,\n  T7,\n  T8,\n  T9,\n  T10,\n  T11,\n  T12,\n  T13,\n  TOut,\n>(\n  f0: Func<TIn, T1>,\n  f1: UnaryFunction<T1, T2>,\n  f2: UnaryFunction<T2, T3>,\n  f3: UnaryFunction<T3, T4>,\n  f4: UnaryFunction<T4, T5>,\n  f5: UnaryFunction<T5, T6>,\n  f6: UnaryFunction<T6, T7>,\n  f7: UnaryFunction<T7, T8>,\n  f8: UnaryFunction<T8, T9>,\n  f9: UnaryFunction<T9, T10>,\n  f10: UnaryFunction<T10, T11>,\n  f11: UnaryFunction<T11, T12>,\n  f12: UnaryFunction<T12, T13>,\n  f13: UnaryFunction<T13, TOut>\n): Func<TIn, TOut>;\nexport function pipe<\n  TIn extends unknown[],\n  T1,\n  T2,\n  T3,\n  T4,\n  T5,\n  T6,\n  T7,\n  T8,\n  T9,\n  T10,\n  T11,\n  T12,\n  T13,\n  T14,\n  TOut,\n>(\n  f0: Func<TIn, T1>,\n  f1: UnaryFunction<T1, T2>,\n  f2: UnaryFunction<T2, T3>,\n  f3: UnaryFunction<T3, T4>,\n  f4: UnaryFunction<T4, T5>,\n  f5: UnaryFunction<T5, T6>,\n  f6: UnaryFunction<T6, T7>,\n  f7: UnaryFunction<T7, T8>,\n  f8: UnaryFunction<T8, T9>,\n  f9: UnaryFunction<T9, T10>,\n  f10: UnaryFunction<T10, T11>,\n  f11: UnaryFunction<T11, T12>,\n  f12: UnaryFunction<T12, T13>,\n  f13: UnaryFunction<T13, T14>,\n  f14: UnaryFunction<T14, TOut>\n): Func<TIn, TOut>;\nexport function pipe<\n  TIn extends unknown[],\n  T1,\n  T2,\n  T3,\n  T4,\n  T5,\n  T6,\n  T7,\n  T8,\n  T9,\n  T10,\n  T11,\n  T12,\n  T13,\n  T14,\n  T15,\n  TOut,\n>(\n  f0: Func<TIn, T1>,\n  f1: UnaryFunction<T1, T2>,\n  f2: UnaryFunction<T2, T3>,\n  f3: UnaryFunction<T3, T4>,\n  f4: UnaryFunction<T4, T5>,\n  f5: UnaryFunction<T5, T6>,\n  f6: UnaryFunction<T6, T7>,\n  f7: UnaryFunction<T7, T8>,\n  f8: UnaryFunction<T8, T9>,\n  f9: UnaryFunction<T9, T10>,\n  f10: UnaryFunction<T10, T11>,\n  f11: UnaryFunction<T11, T12>,\n  f12: UnaryFunction<T12, T13>,\n  f13: UnaryFunction<T13, T14>,\n  f14: UnaryFunction<T14, T15>,\n  f15: UnaryFunction<T15, TOut>\n): Func<TIn, TOut>;\nexport function pipe<\n  TIn extends unknown[],\n  T1,\n  T2,\n  T3,\n  T4,\n  T5,\n  T6,\n  T7,\n  T8,\n  T9,\n  T10,\n  T11,\n  T12,\n  T13,\n  T14,\n  T15,\n  T16,\n  TOut,\n>(\n  f0: Func<TIn, T1>,\n  f1: UnaryFunction<T1, T2>,\n  f2: UnaryFunction<T2, T3>,\n  f3: UnaryFunction<T3, T4>,\n  f4: UnaryFunction<T4, T5>,\n  f5: UnaryFunction<T5, T6>,\n  f6: UnaryFunction<T6, T7>,\n  f7: UnaryFunction<T7, T8>,\n  f8: UnaryFunction<T8, T9>,\n  f9: UnaryFunction<T9, T10>,\n  f10: UnaryFunction<T10, T11>,\n  f11: UnaryFunction<T11, T12>,\n  f12: UnaryFunction<T12, T13>,\n  f13: UnaryFunction<T13, T14>,\n  f14: UnaryFunction<T14, T15>,\n  f15: UnaryFunction<T15, T16>,\n  f16: UnaryFunction<T16, TOut>\n): Func<TIn, TOut>;\nexport function pipe<\n  TIn extends unknown[],\n  T1,\n  T2,\n  T3,\n  T4,\n  T5,\n  T6,\n  T7,\n  T8,\n  T9,\n  T10,\n  T11,\n  T12,\n  T13,\n  T14,\n  T15,\n  T16,\n  T17,\n  TOut,\n>(\n  f0: Func<TIn, T1>,\n  f1: UnaryFunction<T1, T2>,\n  f2: UnaryFunction<T2, T3>,\n  f3: UnaryFunction<T3, T4>,\n  f4: UnaryFunction<T4, T5>,\n  f5: UnaryFunction<T5, T6>,\n  f6: UnaryFunction<T6, T7>,\n  f7: UnaryFunction<T7, T8>,\n  f8: UnaryFunction<T8, T9>,\n  f9: UnaryFunction<T9, T10>,\n  f10: UnaryFunction<T10, T11>,\n  f11: UnaryFunction<T11, T12>,\n  f12: UnaryFunction<T12, T13>,\n  f13: UnaryFunction<T13, T14>,\n  f14: UnaryFunction<T14, T15>,\n  f15: UnaryFunction<T15, T16>,\n  f16: UnaryFunction<T16, T17>,\n  f17: UnaryFunction<T17, TOut>\n): Func<TIn, TOut>;\nexport function pipe<\n  TIn extends unknown[],\n  T1,\n  T2,\n  T3,\n  T4,\n  T5,\n  T6,\n  T7,\n  T8,\n  T9,\n  T10,\n  T11,\n  T12,\n  T13,\n  T14,\n  T15,\n  T16,\n  T17,\n  T18,\n  TOut,\n>(\n  f0: Func<TIn, T1>,\n  f1: UnaryFunction<T1, T2>,\n  f2: UnaryFunction<T2, T3>,\n  f3: UnaryFunction<T3, T4>,\n  f4: UnaryFunction<T4, T5>,\n  f5: UnaryFunction<T5, T6>,\n  f6: UnaryFunction<T6, T7>,\n  f7: UnaryFunction<T7, T8>,\n  f8: UnaryFunction<T8, T9>,\n  f9: UnaryFunction<T9, T10>,\n  f10: UnaryFunction<T10, T11>,\n  f11: UnaryFunction<T11, T12>,\n  f12: UnaryFunction<T12, T13>,\n  f13: UnaryFunction<T13, T14>,\n  f14: UnaryFunction<T14, T15>,\n  f15: UnaryFunction<T15, T16>,\n  f16: UnaryFunction<T16, T17>,\n  f17: UnaryFunction<T17, T18>,\n  f18: UnaryFunction<T18, TOut>\n): Func<TIn, TOut>;\nexport function pipe<\n  TIn extends unknown[],\n  T1,\n  T2,\n  T3,\n  T4,\n  T5,\n  T6,\n  T7,\n  T8,\n  T9,\n  T10,\n  T11,\n  T12,\n  T13,\n  T14,\n  T15,\n  T16,\n  T17,\n  T18,\n  T19,\n  TOut,\n>(\n  f0: Func<TIn, T1>,\n  f1: UnaryFunction<T1, T2>,\n  f2: UnaryFunction<T2, T3>,\n  f3: UnaryFunction<T3, T4>,\n  f4: UnaryFunction<T4, T5>,\n  f5: UnaryFunction<T5, T6>,\n  f6: UnaryFunction<T6, T7>,\n  f7: UnaryFunction<T7, T8>,\n  f8: UnaryFunction<T8, T9>,\n  f9: UnaryFunction<T9, T10>,\n  f10: UnaryFunction<T10, T11>,\n  f11: UnaryFunction<T11, T12>,\n  f12: UnaryFunction<T12, T13>,\n  f13: UnaryFunction<T13, T14>,\n  f14: UnaryFunction<T14, T15>,\n  f15: UnaryFunction<T15, T16>,\n  f16: UnaryFunction<T16, T17>,\n  f17: UnaryFunction<T17, T18>,\n  f18: UnaryFunction<T18, T19>,\n  f19: UnaryFunction<T19, TOut>\n): Func<TIn, TOut>;\nexport function pipe<\n  TIn extends unknown[],\n  T1,\n  T2,\n  T3,\n  T4,\n  T5,\n  T6,\n  T7,\n  T8,\n  T9,\n  T10,\n  T11,\n  T12,\n  T13,\n  T14,\n  T15,\n  T16,\n  T17,\n  T18,\n  T19,\n  T20,\n  TOut,\n>(\n  f0: Func<TIn, T1>,\n  f1: UnaryFunction<T1, T2>,\n  f2: UnaryFunction<T2, T3>,\n  f3: UnaryFunction<T3, T4>,\n  f4: UnaryFunction<T4, T5>,\n  f5: UnaryFunction<T5, T6>,\n  f6: UnaryFunction<T6, T7>,\n  f7: UnaryFunction<T7, T8>,\n  f8: UnaryFunction<T8, T9>,\n  f9: UnaryFunction<T9, T10>,\n  f10: UnaryFunction<T10, T11>,\n  f11: UnaryFunction<T11, T12>,\n  f12: UnaryFunction<T12, T13>,\n  f13: UnaryFunction<T13, T14>,\n  f14: UnaryFunction<T14, T15>,\n  f15: UnaryFunction<T15, T16>,\n  f16: UnaryFunction<T16, T17>,\n  f17: UnaryFunction<T17, T18>,\n  f18: UnaryFunction<T18, T19>,\n  f19: UnaryFunction<T19, T20>,\n  f20: UnaryFunction<T20, TOut>\n): Func<TIn, TOut>;\nexport function pipe<TIn extends unknown[], TOut>(\n  o1: Func<TIn, any>,\n  ...operations: Array<UnaryFunction<any, any>>\n): Func<TIn, TOut>;\n/**\n * Implementation of pipe function.\n * @param o1 first operation\n * @param operations rest of operations\n * @returns function that will execute all operations in order\n */\nexport function pipe<TIn extends unknown[], TOut>(\n  o1: Func<TIn, any>,\n  ...operations: Array<UnaryFunction<any, any>>\n): Func<TIn, TOut> {\n  // eslint-disable-next-line @typescript-eslint/no-unsafe-return -- this is untyped here, but we type it correctly in the overloads for consumers\n  return (...argsP: TIn) => operations.reduce((acc, f) => f(acc), o1(...argsP));\n}\n","/**\n * Returns an array of numbers from 0 to the specified end value (exclusive).\n * @param end The end value of the range.\n * @returns An array of numbers from 0 to the specified end value (exclusive).\n * @example\n * ```ts\n * range(5) // [0, 1, 2, 3, 4]\n * ```\n */\nexport function range(end: number): number[];\n/**\n * Returns an array of numbers from the specified start value to the specified end value (exclusive).\n * @param start The start value of the range.\n * @param end The end value of the range.\n * @param step The step between each value in the range.\n * @returns An array of numbers from the specified start value to the specified end value (exclusive).\n * @example\n * ```ts\n * range(2, 5) // [2, 3, 4]\n * range(2, 5, 2) // [2, 4]\n * ```\n */\nexport function range(start: number, end: number, step?: number): number[];\n/**\n * Implementation for all overloads.\n * @param startOrEnd The start value of the range, or the end value of the range if the `end` parameter is specified.\n * @param end The end value of the range.\n * @param step The step between each value in the range.\n * @returns An array of numbers from the specified start value to the specified end value (exclusive).\n */\nexport function range(startOrEnd: number, end?: number, step = 1): number[] {\n  if (step <= 0) {\n    return [];\n  }\n\n  const calculatedStart = end == null ? 0 : startOrEnd;\n  const calculatedEnd = end ?? startOrEnd;\n\n  const result = [];\n\n  for (let index = calculatedStart; index < calculatedEnd; index += step) {\n    result.push(index);\n  }\n\n  return result;\n}\n","import { Maybe } from '../../types';\n\n/**\n * Returns a random item from the input iterable.\n * @param source The iterable to get a random item from.\n * @returns A random item from the input iterable.\n * @example\n * ```ts\n * sample([1, 2, 3]) // 2\n * ```\n */\nexport function sample<const T>(source: Iterable<T>): T;\n/**\n * Returns N random items from the input iterable.\n * If the input iterable has less than N items, all items will be returned.\n * @param source The iterable to get a random item from.\n * @param count The number of items to return.\n * @returns A random item from the input iterable.\n * @example\n * ```ts\n * sample([1, 2, 3], 2) // [2, 3]\n * sample([1, 2, 3], 4) // [1, 2, 3]\n * sample([1, 2, 3], 0) // []\n * sample([1, 2, 3], -1) // []\n * ```\n */\nexport function sample<const T>(source: Iterable<T>, count: number): T[];\n/**\n * Returns a random item from the input iterable.\n * @param source The iterable to get a random item from.\n * @returns A random item from the input iterable.\n * @example\n * ```ts\n * sample(null) // undefined\n * sample(undefined) // undefined\n * ```\n */\nexport function sample<const T>(source: Maybe<Iterable<T>>): T | undefined;\n/**\n * Returns N random items from the input iterable.\n * If the input iterable has less than N items, all items will be returned.\n * @param source The iterable to get a random item from.\n * @param count The number of items to return.\n * @returns A random item from the input iterable.\n * @example\n * ```ts\n * sample([1, 2, 3], 2) // [2, 3]\n * sample([1, 2, 3], 4) // [1, 2, 3]\n * sample([1, 2, 3], 0) // []\n * sample([1, 2, 3], -1) // []\n * ```\n */\nexport function sample<const T>(\n  source: Maybe<Iterable<T>>,\n  count: number\n): T[] | undefined;\n/**\n * Implementation for all overloads.\n * @param source The iterable to get a random item from.\n * @param count The number of items to return.\n * @returns A random item from the input iterable.\n */\nexport function sample<const T>(\n  source: Maybe<Iterable<T>>,\n  count = 1\n): T | T[] | undefined {\n  if (source == null) {\n    return undefined;\n  }\n\n  const sourceArray = [...source];\n  if (sourceArray.length === 0) {\n    return undefined;\n  }\n\n  const sampleCount = Math.min(count, sourceArray.length);\n\n  const indices = new Set<number>();\n  while (indices.size < sampleCount) {\n    indices.add(Math.floor(Math.random() * sourceArray.length));\n  }\n\n  const result: T[] = [];\n\n  for (const index of indices) {\n    // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- we already know the index is valid because we generated to be within the bounds of the array\n    result.push(sourceArray[index]!);\n  }\n\n  if (result.length === 1) {\n    return result[0];\n  }\n\n  return result;\n}\n","import { createTypeGuard } from '../createTypeGuard';\n\n/**\n * Determines whether the given property name is malicious or not (e.g. `__proto__` or `constructor`).\n * @param propertyName The property name to check for maliciousness.\n * @returns true if the property name is malicious, false otherwise.\n * @example\n * ```ts\n * isMaliciousObjectProperty('constructor'); // returns true\n * isMaliciousObjectProperty('nonMaliciousPath'); // returns false\n * isMaliciousObjectProperty('__proto__'); // returns true\n * ```\n */\nexport const isMaliciousObjectProperty = createTypeGuard<string, string>(\n  Object.getOwnPropertyNames(Object.getPrototypeOf({}))\n);\n","import type { Get } from 'type-fest';\n\nimport { ObjectPath } from '../../types';\nimport { RequireKeysDeep } from '../../types/_internal';\nimport { isMaliciousObjectProperty } from '../_internal/isMaliciousObjectPath';\nimport { assert } from '../assert';\n\n/**\n * Sets a value at the specified (possibly nested) path in an object.\n * @template TObject The type of the object.\n * @template Path The type of the path.\n * @param object The object to set the value in.\n * @param path The path to set the value at.\n * @param value The value to set.\n * @example\n * ```ts\n * const object: {\n *   foo?: {\n *     bar?: {\n *       anArray: string[];\n *     };\n *   }\n * };\n *\n * set(object, 'foo.bar.anArray[0]', 'value');\n * object.foo.bar.anArray[0]; // 'value'\n */\nexport function set<\n  TObject extends Record<string, unknown>,\n  Path extends ObjectPath<TObject>,\n>(\n  object: TObject,\n  path: Path,\n  value: Get<TObject, Path>\n): asserts object is TObject & RequireKeysDeep<TObject, Path> {\n  const segments = path.match(pathSegmentsRegex);\n  assert(segments !== null, 'Invalid path');\n  assert(\n    segments.every((segment) => isMaliciousObjectProperty(segment) === false),\n    'Potentially malicious path'\n  );\n\n  // eslint-disable-next-line @typescript-eslint/no-explicit-any -- easier to work with, and we're trusting the compiler\n  let currentObject: any = object;\n  for (let index = 0; index < segments.length - 1; index++) {\n    // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- trust the compiler (and unit tests 😄).\n    const segment = segments[index]!;\n    if (segment in currentObject === false) {\n      // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access -- we're initializing the `segment` property\n      currentObject[segment] = {};\n    }\n    // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access\n    currentObject = currentObject[segment];\n  }\n\n  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-unsafe-member-access -- this is checked at the type-level\n  currentObject[segments.at(-1)!] = value;\n}\n\nconst pathSegmentsRegex = /[\\w-]+/g;\n","import { Maybe } from '../../types';\nimport { filter } from '../_internal/filterIterable';\n\n/**\n * Returns the single element of an iterable, or `undefined` if there are zero or multiple matches.\n * @param source The iterable to search.\n * @returns The single element, or `undefined` if there are zero or multiple matches.\n * @example\n * ```ts\n * single([1, 2, 3]); // undefined (because there are multiple elements in the array)\n * single([1]); // 1 (because there's only one element in the array)\n * ```\n */\nexport function single<T>(source: Maybe<Iterable<T>>): T | undefined;\n/**\n * Returns the single element of an iterable that satisfies a predicate.\n * @param source The iterable to search.\n * @param predicate The predicate function used to determine if an element is a match.\n * @returns The single matching element, or `undefined` if there are zero or multiple matches.\n * @example\n * ```ts\n * single([1, 2, 3], x => x % 2 === 0); // 2 (because there's only one even number in the array)\n * single([1, 2, 3], x => x >= 1); // undefined (because there are multiple matches for the predicate)\n * ```\n */\nexport function single<T>(\n  source: Maybe<Iterable<T>>,\n  predicate?: (value: T, index: number) => boolean\n): T | undefined;\n/**\n * Returns the single element of an iterable that satisfies a predicate.\n * @param source The iterable to search.\n * @param predicate The predicate function used to determine if an element is a match.\n * @returns The single matching element, or undefined if there are zero or multiple matches.\n * @example\n * ```ts\n * interface Person {\n *   name: string;\n *   age: number;\n * }\n *\n * const people: (Person | number)[] = [\n *   { name: 'Alice', age: 30 },\n *   50,\n * ];\n *\n * declare function isPerson(value: unknown): value is Person;\n *\n * const result = single(people, isPerson); // { name: 'Alice', age: 30 }\n * //     ^? Person | undefined\n * ```\n */\nexport function single<T, S>(\n  source: Maybe<Iterable<T>>,\n  predicate?: (value: S, index: number) => value is S\n): S | undefined;\n/**\n * Implementation for all overloads.\n * @param source The iterable to search.\n * @param predicate The predicate function used to determine if an element is a match.\n * @returns The single matching element, or undefined if there are zero or multiple matches.\n */\nexport function single<T>(\n  source: Maybe<Iterable<T>>,\n  predicate?: (value: T, index: number) => boolean\n): T | undefined {\n  const relevantItems = filter(source, predicate);\n  return relevantItems?.length === 1 ? relevantItems[0] : undefined;\n}\n","import { Maybe } from '../../types';\n\n/**\n * Computes the sum of all values in array. If array is empty or nil, `0` is returned.\n * `null` or `undefined` values are treated as `0`.\n * @param array The array to iterate over.\n * @returns The sum of all values in the array, or `0` if the array is empty or nil.\n * @example\n * ```ts\n * sum([1, 2, 3]); // 6\n * sum([]); // 0\n * sum(null); // 0\n * sum([1, 2, null, 3, undefined, 4]); // 10\n * ```\n */\nexport function sum(array: Maybe<ReadonlyArray<Maybe<number>>>): number;\n/**\n * Computes the sum of all values in array. If array is empty or nil, `0` is returned.\n * @param array The array to iterate over.\n * @param mapper The function used to extract a numeric value from each element.\n * @returns The sum of all values in the array, or `0` if the array is empty or nil.\n * @example\n * ```ts\n * sum([\n *   { value: 1 },\n *   { value: 2 },\n *   { value: 3 }\n * ], (element) => element.value); // 6\n * ```\n */\nexport function sum<T>(\n  array: Maybe<readonly T[]>,\n  mapper: ArrayIterator<T>\n): number;\n/**\n * Implementation for all overloads.\n * @param array The array to iterate over.\n * @param mapper The function used to extract a numeric value from each element.\n * @returns The sum of all values in the array, or `0` if the array is empty or nil.\n */\nexport function sum<T>(\n  array: Maybe<ReadonlyArray<Maybe<T>>>,\n  mapper?: ArrayIterator<Maybe<T>>\n): number {\n  if (array == null) {\n    return 0;\n  }\n\n  const numbers = array.map<number>((value, index, array_) => {\n    const result =\n      mapper?.(value, index, array_) ??\n      // if there's no iteratee, we're in the overload of `sum` that only takes an array of numbers\n      ((value ?? 0) as number);\n    return result;\n  });\n\n  return numbers.reduce((draft, value) => draft + value, 0);\n}\n\ntype ArrayIterator<T> = (\n  value: T,\n  index: number,\n  array: readonly T[]\n) => number;\n","import { Maybe } from '../../types';\n\n/**\n * Returns the first `count` items from `array`.\n * @param array The array to take items from.\n * @param count The number of items to take.\n * @returns The first `count` items from `array`.\n * @example\n * ```ts\n * take([1, 2, 3, 4, 5], 3) // [1, 2, 3]\n * ```\n */\nexport function take<const T extends readonly unknown[], C extends number>(\n  array: Maybe<T>,\n  count: C\n): Take<T, C> {\n  if (count <= 0) {\n    return [] as Take<T, C>;\n  }\n\n  return (array?.slice(0, count) ?? []) as Take<T, C>;\n}\n\ntype Take<\n  TArray extends readonly unknown[],\n  TCount extends number,\n> = TCount extends 0\n  ? []\n  : `${TCount}` extends `-${number}`\n    ? []\n    : TArray extends readonly unknown[]\n      ? TakeFromStart<TArray, TCount>\n      : [];\n\ntype TakeFromStart<\n  TArray extends readonly unknown[],\n  TCount extends number,\n  Taken extends unknown[] = [],\n> = TArray['length'] extends 0\n  ? Taken\n  : TCount extends Taken['length']\n    ? Taken\n    : TArray extends readonly [infer First, ...infer Rest]\n      ? TakeFromStart<Rest, TCount, [...Taken, First]>\n      : Array<TArray[number]>;\n","import { objectFromEntries } from '../objectFromEntries';\n\n/**\n * Converts an array of strings to an object with the same values as keys and values.\n * @param array The array to convert to an object.\n * @returns An object with the same values as keys and values.\n * @example\n * ```ts\n * toObject(['a', 'b']) // { a: 'a', b: 'b' }\n * ```\n */\nexport function toObject<T extends string>(array: readonly T[]): Record<T, T> {\n  return objectFromEntries(array.map((value) => [value, value]));\n}\n","import { Maybe } from '../../types';\n\n/**\n * Returns an array containing only the unique elements of the input iterable.\n * @note The order of the elements in the input matters, the first occurrence of an element (per the `comparator`) is the one that will be kept.\n * @param iterable The input iterable to extract unique elements from.\n * @param comparator An optional function that takes two elements and returns a boolean indicating whether they are equal. Defaults to the `Object.is` function.\n * @returns An array containing only the unique elements of the input iterable.\n * @example\n * unique([1, 2, 3, 2, 1, 4, 5, 4, 3]); // [1, 2, 3, 4, 5]\n * unique(['a', 'b', 'c', 'b', 'a']); // ['a', 'b', 'c']\n * unique([\n *     { id: 1, name: 'Alice' },\n *     { id: 2, name: 'Bob' },\n *     { id: 1, name: 'Alice', age: 42 },\n *   ],\n *   (a, b) => a.id === b.id\n * ) // [{ id: 1, name: 'Alice' }, { id: 2, name: 'Bob' }]\n */\nexport function unique<T>(\n  iterable: Maybe<Iterable<T>>,\n  comparator: Comparator<T> = defaultComparator\n): T[] {\n  if (comparator === defaultComparator) {\n    // we can get a performance boost for the default case, which is probably the most common.\n    return [...new Set(iterable)];\n  }\n\n  const result: T[] = [];\n\n  for (const value of iterable ?? []) {\n    if (!result.some((other) => comparator(value, other))) {\n      result.push(value);\n    }\n  }\n\n  return result;\n}\n\n/**\n * Checks if two values are equal.\n */\ntype Comparator<T> = (a: T, b: T) => boolean;\n\nconst defaultComparator: Comparator<unknown> = Object.is;\n","/**\n * Generates a unique identifier.\n *\n * If a `prefix` is provided, the resulting identifier will start with the prefix.\n * @param prefix A prefix for the identifier.\n * @returns A unique identifier.\n * @example\n * ```ts\n * uniqueId('prefix-') // 'prefix-1q2w3e4r5t'\n * ```\n */\nexport function uniqueId<Prefix extends string>(\n  prefix: Prefix\n): `${Prefix}${string}`;\n/**\n * Generates a unique identifier.\n *\n * If no `prefix` is provided, the resulting identifier will not have a prefix.\n * @param prefix An optional prefix for the identifier.\n * @returns A unique identifier.\n * @example\n * ```ts\n * uniqueId() // '1q2w3e4r5t'\n * uniqueId('prefix-') // 'prefix-1q2w3e4r5t'\n * ```\n */\nexport function uniqueId(prefix?: string): string;\n/**\n * Implementation for all overloads.\n * @param prefix An optional prefix for the identifier.\n * @returns A unique identifier.\n */\nexport function uniqueId(prefix = '') {\n  const suffix = generateUUID();\n  return `${prefix}${suffix}`;\n}\n\nfunction generateUUID() {\n  if (typeof crypto === 'object' && typeof crypto.randomUUID === 'function') {\n    return crypto.randomUUID();\n  }\n\n  return pseudoRandomUUID();\n}\n\nfunction pseudoRandomUUID(): string {\n  const random = Math.random();\n  return random.toString(36).slice(2, 11);\n}\n","import { createTypeGuard } from '../createTypeGuard';\n\n/**\n * Returns a new array containing all elements of the input array except the specified items to exclude.\n * @param array The input array to exclude items from.\n * @param itemsToExclude An iterable of items to exclude from the input array.\n * @returns A new array containing all elements of the input array except the specified items to exclude.\n * @example\n * ```ts\n * without([1, 2, 3], [2, 3]) // [1]\n * without(['a', 'b', 'c'], ['b', 'c']) // ['a']\n * without([1, 2, 3], []) // [1, 2, 3]\n */\nexport function without<T, const S extends T>(\n  array: readonly T[],\n  itemsToExclude: Iterable<S>\n): Array<Exclude<T, S>> {\n  const isItemToExclude = createTypeGuard(itemsToExclude);\n  return array.filter((item): item is Exclude<T, S> => !isItemToExclude(item));\n}\n"]}