{"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,OAAkB,EAAA;AAClE,EAAA,MAAM,SAAS,EAAC,CAAA;AAEhB,EAAA,IAAI,oBAAuB,GAAA,KAAA,CAAA;AAQ3B,EAAA,KAAA,IAAS,IAAI,CAAG,EAAA,CAAA,GAAI,QAAQ,OAAQ,CAAA,KAAA,CAAM,QAAQ,CAAK,EAAA,EAAA;AACrD,IAAA,IAAI,MAAM,MAAO,CAAA,MAAA,CAAO,SAAS,CAAC,CAAA,EAAG,YAAY,CAAK,CAAA,CAAA,EAAA;AACpD,MAAA,SAAA;AAAA,KACF;AAEA,IAAM,MAAA,CAAC,KAAO,EAAA,WAAW,CAAI,GAAAA,sCAAA;AAAA,MAC3B,oBAAA;AAAA,MACA,CAAA;AAAA,MACA,OAAA;AAAA,KACF,CAAA;AACA,IAAA,MAAA,CAAO,IAAK,CAAA;AAAA,MACV,GAAG,KAAA;AAAA,MACH,KAAA,EAAO,KAAM,CAAA,KAAA,CAAM,MAAO,CAAA,CAAC,KAAK,IAAS,KAAAC,0BAAA,CAAW,GAAK,EAAA,IAAI,CAAC,CAAA;AAAA,KAC/D,CAAA,CAAA;AACD,IAAuB,oBAAA,GAAA,WAAA,CAAA;AAAA,GACzB;AAEA,EAAO,OAAA,MAAA,CAAA;AACT;;;;"}