// Generated, do not edit. sha256:ec3bd3327478b77670de174a8843f03ad4b292ec52893e4b4f0f49c508b72a5f import { CONFIG } from '../../shared/config.js'; export function omittedNote(omitted, max) { return ` ... en nog ${omitted} niet getoond (grens: ${max} per lijst).`; } export function limitRows(rows, max = CONFIG.AI.LIMITS.MAX_ROWS_PER_LIST) { const alle = Array.isArray(rows) ? rows : []; if (alle.length <= max) return { rows: alle, omitted: 0, capped: false }; return { rows: alle.slice(0, max), omitted: alle.length - max, capped: true }; } export function limitedList(rows, render, max = CONFIG.AI.LIMITS.MAX_ROWS_PER_LIST) { const { rows: zichtbaar, omitted, capped } = limitRows(rows, max); const regels = zichtbaar.map(render); if (capped) regels.push(omittedNote(omitted, max)); return { lines: regels, omitted, capped }; } export function limitText(text, max = CONFIG.AI.LIMITS.MAX_TEXT_CHARS) { const heel = String(text ?? ''); if (heel.length <= max) return { text: heel, omitted: 0, capped: false }; const markering = `\n[Afgekapt: dit antwoord was te lang en is ingekort op ${max} tekens.]`; const ruimte = Math.max(0, max - markering.length); return { text: heel.slice(0, ruimte) + markering.slice(0, max), omitted: heel.length - ruimte, capped: true, }; }