import "@johnlindquist/kit";
function chunkify(text, chunkSize) {
const chunks = [];
let index = 0;
while (index < text.length) {
let end = index + chunkSize;
while (end > index && text[end] !== "\n") {
end--;
}
if (end === index) {
end = index + chunkSize;