{"version":3,"sources":["../../src/array.mts"],"sourcesContent":["/**\n * Intersperses a separator element between each element of an array.\n *\n * Takes an array and a separator value, and returns a new array where the separator\n * is inserted between each pair of adjacent elements from the original array.\n * The separator is not added before the first element or after the last element.\n *\n * @template T - The type of elements in the input array\n * @template S - The type of the separator element\n * @param arr - The input array to intersperse\n * @param sep - The separator element to insert between array elements\n * @returns A new array with separator elements interspersed between original elements\n *\n * @example\n * ```typescript\n * intersperse([1, 2, 3], 0)\n * // Returns: [1, 0, 2, 0, 3]\n *\n * intersperse(['a', 'b', 'c'], '-')\n * // Returns: ['a', '-', 'b', '-', 'c']\n *\n * intersperse([1], 0)\n * // Returns: [1]\n *\n * intersperse([], 0)\n * // Returns: []\n * ```\n */\nexport function intersperse<T, S>(arr: T[], sep: S): (T | S)[] {\n  return arr.flatMap((v, i) => (i < arr.length - 1 ? [v, sep] : [v]));\n}\n\n/**\n * Flattens a nested array by one level.\n *\n * Takes an array of arrays and returns a new array with all sub-arrays\n * concatenated into a single level. Only flattens one level deep.\n *\n * @template T - The type of elements in the nested arrays\n * @param arr - The array of arrays to flatten\n * @returns A new flattened array containing all elements from the sub-arrays\n *\n * @example\n * ```typescript\n * flatten([[1, 2], [3, 4], [5]])\n * // Returns: [1, 2, 3, 4, 5]\n *\n * flatten([['a', 'b'], ['c'], ['d', 'e']])\n * // Returns: ['a', 'b', 'c', 'd', 'e']\n *\n * flatten([])\n * // Returns: []\n *\n * flatten([[], [1, 2], []])\n * // Returns: [1, 2]\n * ```\n */\nexport function flatten<T>(arr: T[][]): T[] {\n  return arr.reduce((acc, val) => acc.concat(val), []);\n}\n\n/**\n * Creates a cross join (Cartesian product) of two arrays.\n *\n * Takes two arrays and returns an array of tuples representing all possible\n * combinations where the first element comes from the first array and the\n * second element comes from the second array.\n *\n * @template T - The type of elements in the first array\n * @template U - The type of elements in the second array\n * @param arr1 - The first array\n * @param arr2 - The second array\n * @returns An array of tuples representing all combinations\n *\n * @example\n * ```typescript\n * crossJoin([1, 2], ['a', 'b'])\n * // Returns: [[1, 'a'], [1, 'b'], [2, 'a'], [2, 'b']]\n *\n * crossJoin(['x'], [1, 2, 3])\n * // Returns: [['x', 1], ['x', 2], ['x', 3]]\n *\n * crossJoin([], [1, 2])\n * // Returns: []\n *\n * crossJoin([1], [])\n * // Returns: []\n * ```\n */\nexport function crossJoin<T, U>(arr1: T[], arr2: U[]): [T, U][] {\n  const result: [T, U][] = [];\n  for (const item1 of arr1) {\n    for (const item2 of arr2) {\n      result.push([item1, item2]);\n    }\n  }\n  return result;\n}\n\n/**\n * Gets an element from an array at the specified index.\n *\n * Retrieves an element at the given index. Supports negative indices to count\n * from the end of the array. Returns the default value if the index is out of bounds.\n *\n * @template T - The type of elements in the array\n * @template D - The type of the default value\n * @param arr - The array to get the element from\n * @param index - The index to get, negative values count from the end\n * @param defaultValue - The value to return if index is out of bounds\n * @returns The element at the specified index or the default value\n *\n * @example\n * ```typescript\n * get([1, 2, 3, 4], 1)\n * // Returns: 2\n *\n * get([1, 2, 3, 4], -1)\n * // Returns: 4\n *\n * get([1, 2, 3], 10, 'default')\n * // Returns: 'default'\n *\n * get([], 0, 'empty')\n * // Returns: 'empty'\n * ```\n */\nexport function get<T, D = T>(arr: T[], index: number, defaultValue?: D): T | D | undefined {\n  if (arr.length === 0) return defaultValue;\n\n  const actualIndex = index < 0 ? arr.length + index : index;\n\n  if (actualIndex < 0 || actualIndex >= arr.length) {\n    return defaultValue;\n  }\n\n  return arr[actualIndex];\n}\n\n/**\n * Gets the first element of an array.\n *\n * Returns the first element of the array, or the default value if the array is empty.\n *\n * @template T - The type of elements in the array\n * @template D - The type of the default value\n * @param arr - The array to get the first element from\n * @param defaultValue - The value to return if array is empty\n * @returns The first element or the default value\n *\n * @example\n * ```typescript\n * first([1, 2, 3])\n * // Returns: 1\n *\n * first(['a', 'b', 'c'])\n * // Returns: 'a'\n *\n * first([], 'default')\n * // Returns: 'default'\n *\n * first([])\n * // Returns: undefined\n * ```\n */\nexport function first<T, D = T>(arr: T[], defaultValue?: D): T | D | undefined {\n  return arr.length > 0 ? arr[0] : defaultValue;\n}\n\n/**\n * Gets the last element of an array.\n *\n * Returns the last element of the array, or the default value if the array is empty.\n *\n * @template T - The type of elements in the array\n * @template D - The type of the default value\n * @param arr - The array to get the last element from\n * @param defaultValue - The value to return if array is empty\n * @returns The last element or the default value\n *\n * @example\n * ```typescript\n * last([1, 2, 3])\n * // Returns: 3\n *\n * last(['a', 'b', 'c'])\n * // Returns: 'c'\n *\n * last([], 'default')\n * // Returns: 'default'\n *\n * last([])\n * // Returns: undefined\n * ```\n */\nexport function last<T, D = T>(arr: T[], defaultValue?: D): T | D | undefined {\n  return arr.length > 0 ? arr[arr.length - 1] : defaultValue;\n}\n\n/**\n * Splits an array into chunks based on size or a predicate function.\n *\n * If a number is provided, splits the array into chunks of that size.\n * If a function is provided, splits the array at positions where the function returns true.\n *\n * @template T - The type of elements in the array\n * @param arr - The array to split\n * @param sizeOrFunc - Either the chunk size (number) or a predicate function\n * @returns An array of arrays representing the chunks\n *\n * @example\n * ```typescript\n * split([1, 2, 3, 4, 5, 6], 2)\n * // Returns: [[1, 2], [3, 4], [5, 6]]\n *\n * split([1, 2, 3, 4, 5], 2)\n * // Returns: [[1, 2], [3, 4], [5]]\n *\n * split([1, 2, 3, 4, 5], (item, index) => item % 3 === 0)\n * // Returns: [[1, 2], [3], [4, 5]]\n *\n * split([], 2)\n * // Returns: []\n * ```\n */\nexport function split<T>(\n  arr: T[],\n  sizeOrFunc: number | ((item: T, index: number) => boolean)\n): T[][] {\n  if (arr.length === 0) return [];\n\n  if (typeof sizeOrFunc === 'number') {\n    const size = sizeOrFunc;\n    const result: T[][] = [];\n    for (let i = 0; i < arr.length; i += size) {\n      result.push(arr.slice(i, i + size));\n    }\n    return result;\n  } else {\n    const predicate = sizeOrFunc;\n    const result: T[][] = [];\n    let current: T[] = [];\n\n    for (let i = 0; i < arr.length; i++) {\n      const item = arr[i];\n\n      if (predicate(item, i) && current.length > 0) {\n        result.push(current);\n        current = [item];\n      } else {\n        current.push(item);\n      }\n    }\n\n    if (current.length > 0) {\n      result.push(current);\n    }\n\n    return result;\n  }\n}\n\n/**\n * Returns a random element from an array.\n *\n * Selects and returns a random element from the array. Returns undefined if the array is empty.\n *\n * @template T - The type of elements in the array\n * @param arr - The array to select a random element from\n * @returns A random element from the array or undefined if empty\n *\n * @example\n * ```typescript\n * random([1, 2, 3, 4, 5])\n * // Returns: any element from the array (e.g., 3)\n *\n * random(['apple', 'banana', 'cherry'])\n * // Returns: any string from the array (e.g., 'banana')\n *\n * random([])\n * // Returns: undefined\n *\n * random(['single'])\n * // Returns: 'single'\n * ```\n */\nexport function random<T>(arr: T[]): T | undefined {\n  if (arr.length === 0) return undefined;\n  const randomIndex = Math.floor(Math.random() * arr.length);\n  return arr[randomIndex];\n}\n\n/**\n * Returns a new array with elements shuffled in random order.\n *\n * Creates a new array with the same elements as the input array but in a random order.\n * Uses the Fisher-Yates shuffle algorithm for uniform distribution.\n *\n * @template T - The type of elements in the array\n * @param arr - The array to shuffle\n * @returns A new array with elements in random order\n *\n * @example\n * ```typescript\n * shuffle([1, 2, 3, 4, 5])\n * // Returns: [3, 1, 5, 2, 4] (example, actual order will be random)\n *\n * shuffle(['a', 'b', 'c'])\n * // Returns: ['c', 'a', 'b'] (example, actual order will be random)\n *\n * shuffle([])\n * // Returns: []\n *\n * shuffle(['single'])\n * // Returns: ['single']\n * ```\n */\nexport function shuffle<T>(arr: T[]): T[] {\n  const result = [...arr];\n\n  for (let i = result.length - 1; i > 0; i--) {\n    const j = Math.floor(Math.random() * (i + 1));\n    [result[i], result[j]] = [result[j], result[i]];\n  }\n\n  return result;\n}\n\n/**\n * Creates a deep clone of an object or array.\n *\n * Performs a deep copy by recursively iterating through objects and arrays,\n * creating new instances with copied primitive values. Uncloneable types\n * (functions, symbols, etc.) are converted to undefined. Handles circular\n * references to prevent infinite loops.\n *\n * @param obj - The object or array to clone\n * @param visited - Internal WeakMap for tracking visited objects (used for circular reference detection)\n * @returns A deep clone of the input\n *\n * @example\n * ```typescript\n * deepClone({ a: 1, b: { c: 2 } })\n * // Returns: { a: 1, b: { c: 2 } } (new object)\n *\n * const original = { x: [1, 2, 3], y: { z: 4 } };\n * const cloned = deepClone(original);\n * cloned.x.push(4);\n * // original.x is still [1, 2, 3]\n *\n * deepClone({ fn: () => {}, num: 42 })\n * // Returns: { fn: undefined, num: 42 }\n * ```\n */\nexport function deepClone<T = any>(obj: T, visited = new WeakMap()): T {\n  // Handle null or undefined\n  if (obj === null || obj === undefined) {\n    return obj;\n  }\n\n  // Handle primitive\n  if (typeof obj === 'number' || typeof obj === 'string' || typeof obj === 'boolean') {\n    return obj;\n  }\n\n  if (typeof obj === 'function') {\n    return obj;\n  }\n\n  if (obj instanceof Promise) {\n    return obj;\n  }\n\n  if (typeof obj === 'symbol') {\n    // @ts-expect-error\n    return Symbol(obj.description);\n  }\n\n  // Handle circular references\n  if (visited.has(obj as any)) {\n    return visited.get(obj as any);\n  }\n\n  // Handle Date\n  if (obj instanceof Date) {\n    return new Date(obj.getTime()) as T;\n  }\n\n  // Handle Array\n  if (Array.isArray(obj)) {\n    const arrCopy: any[] = [];\n    visited.set(obj as any, arrCopy);\n    for (let i = 0; i < obj.length; i++) {\n      arrCopy[i] = deepClone(obj[i], visited);\n    }\n    return arrCopy as T;\n  }\n\n  // Handle plain objects\n  if (Object.prototype.toString.call(obj) === '[object Object]') {\n    const objCopy: Record<string, any> = {};\n    visited.set(obj as any, objCopy);\n\n    for (const key in obj) {\n      if (Object.hasOwn(obj, key)) {\n        const value = (obj as any)[key];\n        objCopy[key] = deepClone(value, visited);\n      }\n    }\n    return objCopy as T;\n  }\n\n  //clonable Objects\n  // @ts-expect-error\n  if (typeof obj === 'object' && typeof obj?.clone === 'function') {\n    // @ts-expect-error\n    return obj.clone();\n  }\n\n  // For other object types (Map, Set, RegExp, custom classes, etc.)\n  // that we don't handle, return undefined\n  return undefined as T;\n}\n\n/**\n * Deeply merges two objects based on these rules.\n * - for every given object key:\n *  - if firstObject has the key but secondObject doesn't, firstObject's value is used\n *  - if secondObject has the key but firstObject doesn't, secondObject's value is used\n *  - if both values are primitive, the secondObject's value will be used\n *  - if both values are objects, they are merged recursively\n *  - if both values are arrays, they are merged based on the arrayMergeStrategy option\n *  - if the values are of different types, the second value will be used\n *\n * @param firstObj First object to merge from\n * @param secondObj Second object to merge into\n * @param options - Options for merging behavior\n * @param options.arrayMergeStrategy - Strategy for merging arrays: 'replace' (default) or 'concat'\n * @returns The merged object\n */\nexport function deepMerge(\n  firstObj: Record<string, any>,\n  secondObj: Record<string, any>,\n  options: { arrayMergeStrategy?: 'replace' | 'concat' } = { arrayMergeStrategy: 'replace' }\n): Record<string, any> {\n  const result: Record<string, any> = deepClone(firstObj);\n\n  for (const key in secondObj) {\n    if (!Object.hasOwn(secondObj, key)) {\n      continue;\n    }\n    const secondValue = secondObj[key];\n    const firstValue = result[key];\n\n    // If firstObj doesn't have the key, use secondObj's value\n    if (!(key in result)) {\n      result[key] = secondValue;\n      continue;\n    }\n\n    // Check if both values are plain objects (not arrays, null, or other objects)\n    const isSecondObject =\n      secondValue !== null && typeof secondValue === 'object' && !Array.isArray(secondValue);\n    const isFirstObject =\n      firstValue !== null && typeof firstValue === 'object' && !Array.isArray(firstValue);\n\n    if (isFirstObject && isSecondObject) {\n      // Both are objects - merge recursively\n      result[key] = deepMerge(firstValue, secondValue, options);\n    } else if (Array.isArray(firstValue) && Array.isArray(secondValue)) {\n      // Both are arrays - handle based on strategy\n      if (options.arrayMergeStrategy === 'concat') {\n        result[key] = firstValue.concat(secondValue);\n      } else {\n        // Default to 'replace' strategy\n        result[key] = secondValue;\n      }\n    } else {\n      // For primitives, arrays, or mismatched types - use secondObj's value\n      result[key] = secondValue;\n    }\n  }\n\n  return result;\n}\n\n/**\n * Recursively evaluates all nodes in an object using the provided async function.\n *\n * Traverses the object and applies the async function to each non-object value,\n * returning a new object with the evaluated values. If a value is a Promise,\n * it will be awaited before applying the function. Objects and arrays are processed\n * recursively.\n *\n * @param obj - The object to evaluate\n * @param func - The async function to apply to each non-object value\n * @returns A promise that resolves to the new object with evaluated values\n *\n * @example\n * ```typescript\n * const input = {\n *   a: 1,\n *   b: {\n *     c: 2,\n *     d: [3, 4]\n *   }\n * };\n *\n * const result = await evaluateAllNodes(input, async (value) => value * 2);\n * // result is:\n * // {\n * //   a: 2,\n * //   b: {\n * //     c: 4,\n * //     d: [6, 8]\n * //   }\n * // }\n * ```\n */\nexport async function evaluateAllNodes<T>(\n  obj: Record<string, any>,\n  func: (node: any) => any\n): Promise<Record<string, any>> {\n  const rc: Record<string, any> = Array.isArray(obj) ? [] : {};\n\n  for (const key in obj) {\n    const value = obj[key];\n\n    if (value instanceof Promise) {\n      rc[key] = await func(await value);\n    } else if (value !== null && typeof value === 'object') {\n      rc[key] = await evaluateAllNodes(value, func);\n    } else {\n      rc[key] = await func(value);\n    }\n  }\n\n  return rc;\n}\n\n/**\n * traverse an object and apply a function to all branches (objects and arrays)\n * @param obj object to be traversed\n * @param func function to be applied to each branch\n * @returns traversed object\n */\nexport async function evaluateAllBranches(\n  obj: Record<string, any>,\n  func: (node: any) => any\n): Promise<Record<string, any>> {\n  const rc: Record<string, any> = Array.isArray(obj) ? [] : {};\n\n  for (const key in obj) {\n    const value = obj[key];\n\n    if (value instanceof Promise) {\n      rc[key] = await func(await value);\n    } else if (value !== null && (typeof value === 'object' || Array.isArray(value))) {\n      rc[key] = await func(await evaluateAllBranches(value, func));\n    } else {\n      rc[key] = value;\n    }\n  }\n\n  return await func(rc);\n}\n"],"mappings":";;AA4BO,SAAS,YAAkB,KAAU,KAAmB;AAC7D,SAAO,IAAI,QAAQ,CAAC,GAAG,MAAO,IAAI,IAAI,SAAS,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,CAAC,CAAE;AACpE;AAFgB;AA6BT,SAAS,QAAW,KAAiB;AAC1C,SAAO,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,OAAO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