"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.tsLocationToBabelLocation = exports.createFrame = void 0;
const os_1 = __importDefault(require("os"));
const code_frame_1 = require("@babel/code-frame");
function createFrame({ source, location, }) {
    const frame = (0, code_frame_1.codeFrameColumns)(source, location, {
        highlightCode: true,
    })
        .split('\n')
        .map((line) => '  ' + line)
        .join(os_1.default.EOL);
    return frame;
}
exports.createFrame = createFrame;
function tsLocationToBabelLocation(tsLoc) {
    return {
        start: { line: tsLoc.start.line + 1, column: tsLoc.start.character + 1 },
        end: { line: tsLoc.end.line + 1, column: tsLoc.end.character + 1 },
    };
}
exports.tsLocationToBabelLocation = tsLocationToBabelLocation;
