| 1097 | export const OSC8_PREFIX = `${ESC}]8${SEP}` |
| 1098 | |
| 1099 | export function extractHyperlinkFromStyles( |
| 1100 | styles: AnsiCode[], |
| 1101 | ): Hyperlink | null { |
| 1102 | for (const style of styles) { |
| 1103 | const code = style.code |
| 1104 | if (code.length < 5 || !code.startsWith(OSC8_PREFIX)) continue |
| 1105 | const match = code.match(OSC8_REGEX) |
| 1106 | if (match) { |
| 1107 | return match[1] || null |
| 1108 | } |
| 1109 | } |
| 1110 | return null |
| 1111 | } |
| 1112 | |
| 1113 | export function filterOutHyperlinkStyles(styles: AnsiCode[]): AnsiCode[] { |
| 1114 | return styles.filter( |