{"version":3,"file":"index.mjs","sources":[""],"sourcesContent":["export type TGetChunkedArrArgs = Parameters<typeof getChunkedArr>;\n\nexport type TGetChunkedArrReturn = ReturnType<typeof getChunkedArr>;\n\n/**\n * Splits an array into chunks of a fixed size without mutating the source.\n * @template T\n * @param {T[]} arr Source array\n * @param {number} size Maximum number of items in each chunk\n * @returns {T[][]} Array of chunks\n * @throws {TypeError} getChunkedArr: arr must be an array\n * @throws {TypeError} getChunkedArr: size must be a positive integer\n * @example\n * getChunkedArr([ 1, 2, 3, 4, 5 ], 2); // [ [ 1, 2 ], [ 3, 4 ], [ 5 ] ]\n * @example\n * // Split products into rows of three cards for a responsive grid\n * const productRows = getChunkedArr(products, 3);\n */\nexport const getChunkedArr = <T>(arr: T[], size: number): T[][] => {\n  if (!Array.isArray(arr)) {\n    throw new TypeError(\"getChunkedArr: arr must be an array\");\n  }\n  if (!Number.isInteger(size) || size <= 0) {\n    throw new TypeError(\"getChunkedArr: size must be a positive integer\");\n  }\n\n  const result: T[][] = [];\n  for (let index = 0; index < arr.length; index += size) {\n    result.push(arr.slice(index, index + size));\n  }\n  return result;\n};\n"],"names":["getChunkedArr","arr","size","Array","isArray","TypeError","Number","isInteger","result","index","length","push","slice"],"mappings":"MAkBaA,cAAgB,CAAIC,IAAUC,QACzC,IAAKC,MAAMC,QAAQH,KACjB,MAAM,IAAII,UAAU,uCAEtB,IAAKC,OAAOC,UAAUL,OAASA,MAAQ,EACrC,MAAM,IAAIG,UAAU,kDAGtB,MAAMG,OAAgB,GACtB,IAAK,IAAIC,MAAQ,EAAGA,MAAQR,IAAIS,OAAQD,OAASP,KAC/CM,OAAOG,KAAKV,IAAIW,MAAMH,MAAOA,MAAQP,OAEvC,OAAOM"}