"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; // https://github.com/kevva/url-regex/blob/master/index.js var urlReg; var _default = exports.default = function _default() { if (urlReg) { return urlReg; } var word = '[a-fA-F\\d:]'; var b = function b(options) { return options && options.includeBoundaries ? "(?:(?<=\\s|^)(?=".concat(word, ")|(?<=").concat(word, ")(?=\\s|$))") : ''; }; var v4 = '(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}'; var v6seg = '[a-fA-F\\d]{1,4}'; var v6List = ["(?:".concat(v6seg, ":){7}(?:").concat(v6seg, "|:)"), // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8 "(?:".concat(v6seg, ":){6}(?:").concat(v4, "|:").concat(v6seg, "|:)"), // 1:2:3:4:5:6:: 1:2:3:4:5:6::8 1:2:3:4:5:6::8 1:2:3:4:5:6:: "(?:".concat(v6seg, ":){5}(?::").concat(v4, "|(?::").concat(v6seg, "){1,2}|:)"), // 1:2:3:4:5:: 1:2:3:4:5::7:8 1:2:3:4:5::8 1:2:3:4:5:: "(?:".concat(v6seg, ":){4}(?:(?::").concat(v6seg, "){0,1}:").concat(v4, "|(?::").concat(v6seg, "){1,3}|:)"), // 1:2:3:4:: 1:2:3:4::6:7:8 1:2:3:4::8 1:2:3:4:: "(?:".concat(v6seg, ":){3}(?:(?::").concat(v6seg, "){0,2}:").concat(v4, "|(?::").concat(v6seg, "){1,4}|:)"), // 1:2:3:: 1:2:3::5:6:7:8 1:2:3::8 1:2:3:: "(?:".concat(v6seg, ":){2}(?:(?::").concat(v6seg, "){0,3}:").concat(v4, "|(?::").concat(v6seg, "){1,5}|:)"), // 1:2:: 1:2::4:5:6:7:8 1:2::8 1:2:: "(?:".concat(v6seg, ":){1}(?:(?::").concat(v6seg, "){0,4}:").concat(v4, "|(?::").concat(v6seg, "){1,6}|:)"), // 1:: 1::3:4:5:6:7:8 1::8 1:: "(?::(?:(?::".concat(v6seg, "){0,5}:").concat(v4, "|(?::").concat(v6seg, "){1,7}|:))") // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 :: ]; var v6Eth0 = "(?:%[0-9a-zA-Z]{1,})?"; // %eth0 %1 var v6 = "(?:".concat(v6List.join('|'), ")").concat(v6Eth0); // Pre-compile only the exact regexes because adding a global flag make regexes stateful var v46Exact = new RegExp("(?:^".concat(v4, "$)|(?:^").concat(v6, "$)")); var v4exact = new RegExp("^".concat(v4, "$")); var v6exact = new RegExp("^".concat(v6, "$")); var ip = function ip(options) { return options && options.exact ? v46Exact : new RegExp("(?:".concat(b(options)).concat(v4).concat(b(options), ")|(?:").concat(b(options)).concat(v6).concat(b(options), ")"), 'g'); }; ip.v4 = function (options) { return options && options.exact ? v4exact : new RegExp("".concat(b(options)).concat(v4).concat(b(options)), 'g'); }; ip.v6 = function (options) { return options && options.exact ? v6exact : new RegExp("".concat(b(options)).concat(v6).concat(b(options)), 'g'); }; var protocol = "(?:(?:[a-z]+:)?//)"; var auth = '(?:\\S+(?::\\S*)?@)?'; var ipv4 = ip.v4().source; var ipv6 = ip.v6().source; var host = "(?:(?:[a-z\\u00a1-\\uffff0-9][-_]*)*[a-z\\u00a1-\\uffff0-9]+)"; var domain = "(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*"; var tld = "(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))"; var port = '(?::\\d{2,5})?'; var path = '(?:[/?#][^\\s"]*)?'; var regex = "(?:".concat(protocol, "|www\\.)").concat(auth, "(?:localhost|").concat(ipv4, "|").concat(ipv6, "|").concat(host).concat(domain).concat(tld, ")").concat(port).concat(path); urlReg = new RegExp("(?:^".concat(regex, "$)"), 'i'); return urlReg; };