{"version":3,"file":"util.extract-blocks.cjs","sources":["../../../../src/rules/limit-multi-line-comments/util.extract-blocks.ts"],"sourcesContent":["import type { Context } from \"../../typings.context.js\";\n\nimport type { MultilineBlock } from \"./typings.block.js\";\nimport { captureNextBlock } from \"./util.capture-next-block.js\";\nimport { mergeLines } from \"./util.merge-lines.js\";\n\nexport function extractBlocksFromMultilineComment(context: Context) {\n  const blocks = [] as MultilineBlock[];\n\n  let ignoreFollowingLines = false;\n\n  // Processing multi-line comments becomes a tad more difficult than simply\n  // parsing single-line comments since a single comment may contain\n  // multiple logical comment blocks which should be handled individually.\n  //\n  // Thus our first step is to take a multi-line comment and convert it into\n  // logical blocks\n  for (let i = 0; i < context.comment.lines.length; i++) {\n    if (i <= (blocks[blocks.length - 1]?.endIndex ?? -1)) {\n      continue;\n    }\n\n    const [block, ignoreLines] = captureNextBlock(\n      ignoreFollowingLines,\n      i,\n      context,\n    );\n    blocks.push({\n      ...block,\n      value: block.lines.reduce((acc, curr) => mergeLines(acc, curr)),\n    });\n    ignoreFollowingLines = ignoreLines;\n  }\n\n  return blocks;\n}\n"],"names":["captureNextBlock","mergeLines"],"mappings":";;;;;AAMO,SAAS,kCAAkC,OAAA,EAAkB;AAClE,EAAA,MAAM,SAAS,EAAC;AAEhB,EAAA,IAAI,oBAAA,GAAuB,KAAA;AAQ3B,EAAA,KAAA,IAAS,IAAI,CAAA,EAAG,CAAA,GAAI,QAAQ,OAAA,CAAQ,KAAA,CAAM,QAAQ,CAAA,EAAA,EAAK;AACrD,IAAA,IAAI,MAAM,MAAA,CAAO,MAAA,CAAO,SAAS,CAAC,CAAA,EAAG,YAAY,EAAA,CAAA,EAAK;AACpD,MAAA;AAAA,IACF;AAEA,IAAA,MAAM,CAAC,KAAA,EAAO,WAAW,CAAA,GAAIA,sCAAA;AAAA,MAC3B,oBAAA;AAAA,MACA,CAAA;AAAA,MACA;AAAA,KACF;AACA,IAAA,MAAA,CAAO,IAAA,CAAK;AAAA,MACV,GAAG,KAAA;AAAA,MACH,KAAA,EAAO,KAAA,CAAM,KAAA,CAAM,MAAA,CAAO,CAAC,KAAK,IAAA,KAASC,0BAAA,CAAW,GAAA,EAAK,IAAI,CAAC;AAAA,KAC/D,CAAA;AACD,IAAA,oBAAA,GAAuB,WAAA;AAAA,EACzB;AAEA,EAAA,OAAO,MAAA;AACT;;;;"}