{"version":3,"file":"read-output.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/read-output.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,MAAM,WAAW,iBAAiB;IACjC,mDAAmD;IACnD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2DAA2D;IAC3D,SAAS,CAAC,EAAE,OAAO,CAAC;CACpB;AAUD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,iBAAsB,GAAG,MAAM,EAAE,CAe3F","sourcesContent":["/**\n * Render read tool output with line numbers, matching the edit tool's visual style.\n *\n * The diff tool shows line numbers as: ` ${lineNum} content`\n * This component applies the same pattern to plain file reads.\n */\n\nimport { theme } from \"../theme/theme.js\";\n\nexport interface ReadOutputOptions {\n\t/** Starting line number (1-indexed). Default: 1 */\n\tstartLine?: number;\n\t/** Whether to apply syntax highlighting. Default: false */\n\thighlight?: boolean;\n}\n\n/**\n * Format a line number with consistent width alignment.\n * Matches the diff tool's visual style: right-aligned, dim color.\n */\nfunction formatLineNumber(num: number, maxDigits: number): string {\n\treturn num.toString().padStart(maxDigits);\n}\n\n/**\n * Render file content with line numbers.\n *\n * @param content - The file content string\n * @param options - Rendering options\n * @returns Array of styled lines\n */\nexport function renderReadOutput(content: string, options: ReadOutputOptions = {}): string[] {\n\tconst { startLine = 1 } = options;\n\tconst lines = content.split(\"\\n\");\n\n\t// Calculate the maximum line number to determine padding width\n\tconst endLine = startLine + lines.length - 1;\n\tconst maxDigits = Math.max(2, endLine.toString().length);\n\n\t// Render each line with line numbers matching the diff tool's style\n\treturn lines.map((line, index) => {\n\t\tconst lineNum = startLine + index;\n\t\tconst paddedNum = formatLineNumber(lineNum, maxDigits);\n\t\t// Style matches diff.ts: dim color for line numbers, followed by content\n\t\treturn `${theme.fg(\"dim\", paddedNum)} ${theme.fg(\"toolOutput\", line)}`;\n\t});\n}\n"]}