import { jsx as _jsx } from "react/jsx-runtime";
// @ts-nocheck — React compiler output, not on scroll critical path
import { c as _c } from "react/compiler-runtime";
/**
 * Bypass the <Ansi> → React tree → Yoga → squash → re-serialize roundtrip for
 * content that is already terminal-ready.
 *
 * Use this when an external renderer (e.g. the ColorDiff NAPI module) has
 * already produced ANSI-escaped, width-wrapped output. A normal <Ansi> mount
 * reparses that output into one React <Text> per style span, lays out each
 * span as a Yoga flex child, then walks the tree to re-emit the same escape
 * codes it was given. For a long transcript full of syntax-highlighted diffs
 * that roundtrip is the dominant cost of the render.
 *
 * This component emits a single Yoga leaf with a constant-time measure func
 * (width × lines.length) and hands the joined string straight to output.write(),
 * which already splits on '\n' and parses ANSI into the screen buffer.
 */
export function RawAnsi(t0) {
    const $ = _c(6);
    const { lines, width } = t0;
    if (lines.length === 0) {
        return null;
    }
    let t1;
    if ($[0] !== lines) {
        t1 = lines.join("\n");
        $[0] = lines;
        $[1] = t1;
    }
    else {
        t1 = $[1];
    }
    let t2;
    if ($[2] !== lines.length || $[3] !== t1 || $[4] !== width) {
        t2 = _jsx("ink-raw-ansi", { rawText: t1, rawWidth: width, rawHeight: lines.length });
        $[2] = lines.length;
        $[3] = t1;
        $[4] = width;
        $[5] = t2;
    }
    else {
        t2 = $[5];
    }
    return t2;
}
//# sourceMappingURL=RawAnsi.js.map