"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = getCodeFromTerminal;
const prompt_1 = __importDefault(require("prompt"));
async function getCodeFromTerminal(url) {
    console.log(`Open browser: ${url}`);
    prompt_1.default.start();
    const result = await prompt_1.default.get(['copy-URL']);
    const codeUrl = result['copy-URL'];
    if (!codeUrl)
        return null;
    const codeMatch = codeUrl.split("code=")[1]?.split("&")[0];
    return codeMatch || null;
}
