import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { Text, Box } from 'ink';
import { Colors, SemanticColors } from '../../colors.js';
import { createOsc8Link } from '../../utils/terminalLinks.js';
export const OAuthUrlMessage = ({ text, url, }) => {
    const prefix = '[OAUTH] ';
    const prefixWidth = prefix.length;
    // Extract provider name from text if available
    const providerMatch = text.match(/authorize with ([^\n:]+)/i);
    const provider = providerMatch ? providerMatch[1] : 'the service';
    const osc8Link = createOsc8Link(`Click here to authorize with ${provider}`, url);
    return (_jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [_jsxs(Box, { flexDirection: "row", marginBottom: 1, children: [_jsx(Box, { width: prefixWidth, children: _jsx(Text, { color: Colors.AccentBlue, children: prefix }) }), _jsx(Box, { flexGrow: 1, children: _jsx(Text, { color: Colors.AccentBlue, children: _jsxs(Text, { bold: true, children: ["OAuth Authentication Required for ", provider] }) }) })] }), _jsxs(Box, { flexDirection: "column", paddingLeft: prefixWidth + 1, children: [_jsx(Box, { marginBottom: 1, children: _jsx(Text, { color: SemanticColors.text.link, children: osc8Link }) }), _jsx(Box, { children: _jsxs(Text, { color: Colors.Comment, dimColor: true, wrap: "wrap", children: ["Or copy this URL: ", url] }) }), _jsx(Box, { children: _jsx(Text, { color: Colors.Comment, dimColor: true, wrap: "wrap", children: "Tip: when mouse scrolling is enabled, drag to select and it will be copied to your clipboard. For terminal selection, run /mouse off (Ctrl+\\)." }) })] })] }));
};
//# sourceMappingURL=OAuthUrlMessage.js.map