/**
 * Splits an array into an array of arrays maximizing the size of the smallest chunk.
 */
export function chunkifyMaximizeChunkSize(arr, minPerChunk) {
    const chunkCount = Math.floor(arr.length / minPerChunk);
    if (chunkCount <= 1) {
        return [arr];
    }
    // Prefer less chunks of bigger size
    const perChunk = Math.ceil(arr.length / chunkCount);
    const arrArr = [];
    for (let i = 0; i < arr.length; i += perChunk) {
        arrArr.push(arr.slice(i, i + perChunk));
    }
    return arrArr;
}
//# sourceMappingURL=utils.js.map