| 1001 | ); |
| 1002 | } |
| 1003 | link(e) { |
| 1004 | let t = this.rules.inline.link.exec(e); |
| 1005 | if (t) { |
| 1006 | let n = t[2].trim(); |
| 1007 | if ( |
| 1008 | !this.options.pedantic && |
| 1009 | this.rules.other.startAngleBracket.test(n) |
| 1010 | ) { |
| 1011 | if (!this.rules.other.endAngleBracket.test(n)) return; |
| 1012 | let r = A(n.slice(0, -1), "\\"); |
| 1013 | if ((n.length - r.length) % 2 === 0) return; |
| 1014 | } else { |
| 1015 | let r = de(t[2], "()"); |
| 1016 | if (r === -2) return; |
| 1017 | if (r > -1) { |
| 1018 | let a = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length + r; |
| 1019 | ((t[2] = t[2].substring(0, r)), |
| 1020 | (t[0] = t[0].substring(0, a).trim()), |
| 1021 | (t[3] = "")); |
| 1022 | } |
| 1023 | } |
| 1024 | let s = t[2], |
| 1025 | i = ""; |
| 1026 | if (this.options.pedantic) { |
| 1027 | let r = this.rules.other.pedanticHrefTitle.exec(s); |
| 1028 | r && ((s = r[1]), (i = r[3])); |
| 1029 | } else i = t[3] ? t[3].slice(1, -1) : ""; |
| 1030 | return ( |
| 1031 | (s = s.trim()), |
| 1032 | this.rules.other.startAngleBracket.test(s) && |
| 1033 | (this.options.pedantic && |
| 1034 | !this.rules.other.endAngleBracket.test(n) |
| 1035 | ? (s = s.slice(1)) |
| 1036 | : (s = s.slice(1, -1))), |
| 1037 | me( |
| 1038 | t, |
| 1039 | { |
| 1040 | href: s && s.replace(this.rules.inline.anyPunctuation, "$1"), |
| 1041 | title: i && i.replace(this.rules.inline.anyPunctuation, "$1"), |
| 1042 | }, |
| 1043 | t[0], |
| 1044 | this.lexer, |
| 1045 | this.rules, |
| 1046 | ) |
| 1047 | ); |
| 1048 | } |
| 1049 | } |
| 1050 | reflink(e, t) { |
| 1051 | let n; |
| 1052 | if ( |