Greasy Fork is available in English.

Core

CoreCode

This script should not be not be installed directly. It is a library for other scripts to include with the meta directive // @require https://update.greatest.deepsurf.us/scripts/38751/253184/Core.js

  1. (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.linkifyPlusPlusCore = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
  2. var _require = require("./lib/url-matcher"),
  3. UrlMatcher = _require.UrlMatcher,
  4. _require2 = require("./lib/linkifier"),
  5. INVALID_TAGS = _require2.INVALID_TAGS,
  6. Linkifier = _require2.Linkifier,
  7. linkify = _require2.linkify;
  8.  
  9. module.exports = {
  10. UrlMatcher,
  11. Linkifier,
  12. INVALID_TAGS,
  13. linkify
  14. };
  15.  
  16. },{"./lib/linkifier":2,"./lib/url-matcher":4}],2:[function(require,module,exports){
  17. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  18.  
  19. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  20.  
  21. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  22.  
  23. /* eslint-env browser */
  24.  
  25. var Events = require("event-lite");
  26.  
  27. var INVALID_TAGS = {
  28. A: true,
  29. NOSCRIPT: true,
  30. OPTION: true,
  31. SCRIPT: true,
  32. STYLE: true,
  33. TEXTAREA: true,
  34. SVG: true,
  35. CANVAS: true,
  36. BUTTON: true,
  37. SELECT: true,
  38. TEMPLATE: true,
  39. METER: true,
  40. PROGRESS: true,
  41. MATH: true,
  42. TIME: true
  43. };
  44.  
  45. var Pos = function () {
  46. function Pos(container, offset) {
  47. var i = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  48.  
  49. _classCallCheck(this, Pos);
  50.  
  51. this.container = container;
  52. this.offset = offset;
  53. this.i = i;
  54. }
  55.  
  56. Pos.prototype.add = function add(change) {
  57. var cont = this.container,
  58. offset = this.offset;
  59.  
  60. this.i += change;
  61.  
  62. // If the container is #text.parentNode
  63. if (cont.childNodes.length) {
  64. cont = cont.childNodes[offset];
  65. offset = 0;
  66. }
  67.  
  68. // If the container is #text
  69. while (cont) {
  70. if (cont.nodeType == 3) {
  71. if (!cont.LEN) {
  72. cont.LEN = cont.nodeValue.length;
  73. }
  74. if (offset + change <= cont.LEN) {
  75. this.container = cont;
  76. this.offset = offset + change;
  77. return;
  78. }
  79. change = offset + change - cont.LEN;
  80. offset = 0;
  81. }
  82. cont = cont.nextSibling;
  83. }
  84. };
  85.  
  86. Pos.prototype.moveTo = function moveTo(offset) {
  87. this.add(offset - this.i);
  88. };
  89.  
  90. return Pos;
  91. }();
  92.  
  93. function cloneContents(range) {
  94. if (range.startContainer == range.endContainer) {
  95. return document.createTextNode(range.toString());
  96. }
  97. return range.cloneContents();
  98. }
  99.  
  100. var DEFAULT_OPTIONS = {
  101. maxRunTime: 100,
  102. timeout: 10000,
  103. newTab: true,
  104. noOpener: true,
  105. embedImage: true
  106. };
  107.  
  108. var Linkifier = function (_Events) {
  109. _inherits(Linkifier, _Events);
  110.  
  111. function Linkifier(root) {
  112. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  113.  
  114. _classCallCheck(this, Linkifier);
  115.  
  116. var _this = _possibleConstructorReturn(this, _Events.call(this));
  117.  
  118. if (!(root instanceof Node)) {
  119. options = root;
  120. root = options.root;
  121. }
  122. _this.root = root;
  123. _this.options = Object.assign({}, DEFAULT_OPTIONS, options);
  124. _this.aborted = false;
  125. return _this;
  126. }
  127.  
  128. Linkifier.prototype.start = function start() {
  129. var time = Date.now,
  130. startTime = time(),
  131. chunks = this.generateChunks();
  132.  
  133. var next = () => {
  134. if (this.aborted) {
  135. this.emit("error", new Error("Aborted"));
  136. return;
  137. }
  138. var chunkStart = time(),
  139. now;
  140.  
  141. do {
  142. if (chunks.next().done) {
  143. this.emit("complete", time() - startTime);
  144. return;
  145. }
  146. } while ((now = time()) - chunkStart < this.options.maxRunTime);
  147.  
  148. if (now - startTime > this.options.timeout) {
  149. this.emit("error", new Error(`max execution time exceeded: ${now - startTime}, on ${this.root}`));
  150. return;
  151. }
  152.  
  153. setTimeout(next);
  154. };
  155.  
  156. setTimeout(next);
  157. };
  158.  
  159. Linkifier.prototype.abort = function abort() {
  160. this.aborted = true;
  161. };
  162.  
  163. Linkifier.prototype.generateRanges = function* generateRanges() {
  164. var validator = this.options.validator;
  165.  
  166. var filter = {
  167. acceptNode: function (node) {
  168. if (validator && !validator(node)) {
  169. return NodeFilter.FILTER_REJECT;
  170. }
  171. if (INVALID_TAGS[node.nodeName]) {
  172. return NodeFilter.FILTER_REJECT;
  173. }
  174. if (node.nodeName == "WBR") {
  175. return NodeFilter.FILTER_ACCEPT;
  176. }
  177. if (node.nodeType == 3) {
  178. return NodeFilter.FILTER_ACCEPT;
  179. }
  180. return NodeFilter.FILTER_SKIP;
  181. }
  182. };
  183. // Generate linkified ranges.
  184. var walker = document.createTreeWalker(this.root, NodeFilter.SHOW_TEXT + NodeFilter.SHOW_ELEMENT, filter),
  185. start,
  186. end,
  187. current,
  188. range;
  189.  
  190. end = start = walker.nextNode();
  191. if (!start) {
  192. return;
  193. }
  194. range = document.createRange();
  195. range.setStartBefore(start);
  196. while (current = walker.nextNode()) {
  197. if (end.nextSibling == current) {
  198. end = current;
  199. continue;
  200. }
  201. range.setEndAfter(end);
  202. yield range;
  203.  
  204. end = start = current;
  205. range.setStartBefore(start);
  206. }
  207. range.setEndAfter(end);
  208. yield range;
  209. };
  210.  
  211. Linkifier.prototype.generateChunks = function* generateChunks() {
  212. var matcher = this.options.matcher;
  213.  
  214. for (var range of this.generateRanges()) {
  215. var frag = null,
  216. pos = null,
  217. text = range.toString(),
  218. textRange = null;
  219. for (var result of matcher.match(text)) {
  220. if (!frag) {
  221. frag = document.createDocumentFragment();
  222. pos = new Pos(range.startContainer, range.startOffset);
  223. textRange = range.cloneRange();
  224. }
  225. // clone text
  226. pos.moveTo(result.start);
  227. textRange.setEnd(pos.container, pos.offset);
  228. frag.appendChild(cloneContents(textRange));
  229.  
  230. // clone link
  231. textRange.collapse();
  232. pos.moveTo(result.end);
  233. textRange.setEnd(pos.container, pos.offset);
  234.  
  235. var content = cloneContents(textRange),
  236. link = this.buildLink(result, content);
  237.  
  238. textRange.collapse();
  239.  
  240. frag.appendChild(link);
  241. this.emit("link", { link, range, result, content });
  242. }
  243. if (pos) {
  244. pos.moveTo(text.length);
  245. textRange.setEnd(pos.container, pos.offset);
  246. frag.appendChild(cloneContents(textRange));
  247.  
  248. range.deleteContents();
  249. range.insertNode(frag);
  250. }
  251. yield;
  252. }
  253. };
  254.  
  255. Linkifier.prototype.buildLink = function buildLink(result, content) {
  256. var _options = this.options,
  257. newTab = _options.newTab,
  258. embedImage = _options.embedImage,
  259. noOpener = _options.noOpener;
  260.  
  261. var link = document.createElement("a");
  262. link.href = result.url;
  263. link.title = "Linkify Plus Plus";
  264. link.className = "linkifyplus";
  265. if (newTab) {
  266. link.target = "_blank";
  267. }
  268. if (noOpener) {
  269. link.rel = "noopener";
  270. }
  271. var child;
  272. if (embedImage && /^[^?#]+\.(?:jpg|png|gif|jpeg|svg)(?:$|[?#])/i.test(result.url)) {
  273. child = new Image();
  274. child.src = result.url;
  275. child.alt = result.text;
  276. } else {
  277. child = content;
  278. }
  279. link.appendChild(child);
  280. return link;
  281. };
  282.  
  283. return Linkifier;
  284. }(Events);
  285.  
  286. function linkify() {
  287. for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
  288. args[_key] = arguments[_key];
  289. }
  290.  
  291. return new Promise((resolve, reject) => {
  292. var linkifier = new Linkifier(...args);
  293. linkifier.on("error", reject);
  294. linkifier.on("complete", resolve);
  295. for (var key of Object.keys(linkifier.options)) {
  296. if (key.startsWith("on")) {
  297. linkifier.on(key.slice(2), linkifier.options[key]);
  298. }
  299. }
  300. linkifier.start();
  301. });
  302. }
  303.  
  304. module.exports = {
  305. INVALID_TAGS,
  306. Linkifier,
  307. linkify
  308. };
  309.  
  310. },{"event-lite":5}],3:[function(require,module,exports){
  311. module.exports={
  312. "maxLength": 22,
  313. "chars": "ã‚»ãƒ¼ãƒ«ä½›å±±à²­à²¾à²°à²¤æ…ˆå–„é›†å›¢åœ¨çº¿í•œêµ­à¬­à¬¾à¬°à¬¤à¦­à¦¾à§°à¦¤å…«å¦Ù…ÙˆÙ‚Ø¹à¦¬à¦‚à¦²å…¬ç›Šå¸é¦™æ ¼é‡Œæ‹‰ç½‘ç«™ç§»åŠ¨æˆ‘çˆ±ä½ Ð¼Ð¾ÑÐºÐ²Ð°Ò›Ð·Ð½Ð»Ð¹Ñ‚Ñ€Ð±Ð³Ðµãƒ•ã‚¡ãƒƒã‚·ãƒ§ãƒ³ã‚¹ãƒˆã‚¢ì‚¼ì„±à®šà®¿à®™à¯à®•à®ªà¯‚à®°å•†æ ‡åº—åŸŽÐ´Ð¸ÑŽæ–°é—»å®¶é›»ä¸­æ–‡ä¿¡å›½åœ‹å¨±ä¹à°­à°¾à°°à°¤à±à¶½à¶‚à¶šà·ã‚¯ãƒ©ã‚¦ãƒ‰à¤­à¤¾à¤°à¤¤à¤®à¥à¥‹à¤¸à¤‚à¤—à¤ à¤¨é¤åŽ…ç»œÑƒæ¸¯é£Ÿå“é£žåˆ©æµ¦å°æ¹¾ç£æ‰‹æœºØ§Ù„Ø¬Ø²Ø¦Ø±Ù†ÛŒØªØ¨Ù¾Ú©Ø³Ø¯ÙŠØ©Ú€æ¾³é–€ë‹·ì»´Ø´Ùƒáƒ’áƒ”æž„å¥åº·à¹„à¸—à¸¢Ñ„ã¿ã‚“ãªÎµÎ»ä¸–ç•Œæ›¸ç±à´­à´¾à´°à´¤à´‚å€ë„·ã‚³ãƒ æ¸¸æˆä¼ä¸šæ¯å˜‰å¤§é…’ØµØ·å¹¿ä¸œà®‡à®²à¯ˆà®¨à®¤à®¯à®¾Õ°Õ¡ÕµåŠ å¡Ùæ”¿åŠ¡",
  314. "table": {
  315. "aarp": true,
  316. "abb": true,
  317. "abbott": true,
  318. "abc": true,
  319. "abogado": true,
  320. "abudhabi": true,
  321. "ac": true,
  322. "academy": true,
  323. "accenture": true,
  324. "accountant": true,
  325. "accountants": true,
  326. "aco": true,
  327. "active": true,
  328. "actor": true,
  329. "ad": true,
  330. "adult": true,
  331. "ae": true,
  332. "aeg": true,
  333. "aero": true,
  334. "af": true,
  335. "afamilycompany": true,
  336. "afl": true,
  337. "africa": true,
  338. "ag": true,
  339. "agency": true,
  340. "ai": true,
  341. "aig": true,
  342. "airbus": true,
  343. "airforce": true,
  344. "al": true,
  345. "allstate": true,
  346. "alsace": true,
  347. "am": true,
  348. "amfam": true,
  349. "amica": true,
  350. "amsterdam": true,
  351. "analytics": true,
  352. "ao": true,
  353. "apartments": true,
  354. "aq": true,
  355. "aquarelle": true,
  356. "ar": true,
  357. "archi": true,
  358. "army": true,
  359. "art": true,
  360. "arte": true,
  361. "as": true,
  362. "asia": true,
  363. "associates": true,
  364. "at": true,
  365. "attorney": true,
  366. "au": true,
  367. "auction": true,
  368. "audi": true,
  369. "audio": true,
  370. "auspost": true,
  371. "auto": true,
  372. "autos": true,
  373. "aw": true,
  374. "aws": true,
  375. "ax": true,
  376. "axa": true,
  377. "az": true,
  378. "azure": true,
  379. "ba": true,
  380. "baby": true,
  381. "baidu": true,
  382. "band": true,
  383. "bank": true,
  384. "bar": true,
  385. "barcelona": true,
  386. "barclaycard": true,
  387. "barclays": true,
  388. "bargains": true,
  389. "basketball": true,
  390. "bayern": true,
  391. "bb": true,
  392. "bbva": true,
  393. "bd": true,
  394. "be": true,
  395. "beer": true,
  396. "bentley": true,
  397. "berlin": true,
  398. "best": true,
  399. "bet": true,
  400. "bf": true,
  401. "bg": true,
  402. "bh": true,
  403. "bi": true,
  404. "bible": true,
  405. "bid": true,
  406. "bike": true,
  407. "bing": true,
  408. "bingo": true,
  409. "bio": true,
  410. "biz": true,
  411. "bj": true,
  412. "black": true,
  413. "blackfriday": true,
  414. "blanco": true,
  415. "blog": true,
  416. "bloomberg": true,
  417. "blue": true,
  418. "bm": true,
  419. "bms": true,
  420. "bmw": true,
  421. "bn": true,
  422. "bnpparibas": true,
  423. "bo": true,
  424. "boats": true,
  425. "bosch": true,
  426. "bostik": true,
  427. "boston": true,
  428. "bot": true,
  429. "boutique": true,
  430. "br": true,
  431. "bradesco": true,
  432. "bridgestone": true,
  433. "broadway": true,
  434. "broker": true,
  435. "brother": true,
  436. "brussels": true,
  437. "bs": true,
  438. "bt": true,
  439. "bugatti": true,
  440. "build": true,
  441. "builders": true,
  442. "business": true,
  443. "buzz": true,
  444. "bw": true,
  445. "by": true,
  446. "bz": true,
  447. "bzh": true,
  448. "ca": true,
  449. "cab": true,
  450. "cafe": true,
  451. "cam": true,
  452. "camera": true,
  453. "camp": true,
  454. "cancerresearch": true,
  455. "canon": true,
  456. "capetown": true,
  457. "capital": true,
  458. "car": true,
  459. "cards": true,
  460. "care": true,
  461. "career": true,
  462. "careers": true,
  463. "cars": true,
  464. "casa": true,
  465. "cash": true,
  466. "casino": true,
  467. "cat": true,
  468. "catering": true,
  469. "catholic": true,
  470. "cba": true,
  471. "cc": true,
  472. "cd": true,
  473. "center": true,
  474. "ceo": true,
  475. "cern": true,
  476. "cf": true,
  477. "cfa": true,
  478. "cfd": true,
  479. "cg": true,
  480. "ch": true,
  481. "chanel": true,
  482. "chase": true,
  483. "chat": true,
  484. "cheap": true,
  485. "christmas": true,
  486. "church": true,
  487. "ci": true,
  488. "cisco": true,
  489. "citic": true,
  490. "city": true,
  491. "ck": true,
  492. "cl": true,
  493. "claims": true,
  494. "cleaning": true,
  495. "click": true,
  496. "clinic": true,
  497. "clothing": true,
  498. "cloud": true,
  499. "club": true,
  500. "clubmed": true,
  501. "cm": true,
  502. "cn": true,
  503. "co": true,
  504. "coach": true,
  505. "codes": true,
  506. "coffee": true,
  507. "college": true,
  508. "cologne": true,
  509. "com": true,
  510. "community": true,
  511. "company": true,
  512. "computer": true,
  513. "condos": true,
  514. "construction": true,
  515. "consulting": true,
  516. "contractors": true,
  517. "cooking": true,
  518. "cool": true,
  519. "coop": true,
  520. "corsica": true,
  521. "country": true,
  522. "coupons": true,
  523. "courses": true,
  524. "cr": true,
  525. "credit": true,
  526. "creditcard": true,
  527. "creditunion": true,
  528. "cricket": true,
  529. "crown": true,
  530. "crs": true,
  531. "cruises": true,
  532. "csc": true,
  533. "cu": true,
  534. "cuisinella": true,
  535. "cv": true,
  536. "cw": true,
  537. "cx": true,
  538. "cy": true,
  539. "cymru": true,
  540. "cz": true,
  541. "dabur": true,
  542. "dance": true,
  543. "date": true,
  544. "dating": true,
  545. "de": true,
  546. "deals": true,
  547. "degree": true,
  548. "delivery": true,
  549. "dell": true,
  550. "deloitte": true,
  551. "democrat": true,
  552. "dental": true,
  553. "dentist": true,
  554. "desi": true,
  555. "design": true,
  556. "dhl": true,
  557. "diamonds": true,
  558. "diet": true,
  559. "digital": true,
  560. "direct": true,
  561. "directory": true,
  562. "discount": true,
  563. "dj": true,
  564. "dk": true,
  565. "dm": true,
  566. "dnp": true,
  567. "do": true,
  568. "doctor": true,
  569. "dog": true,
  570. "domains": true,
  571. "download": true,
  572. "dubai": true,
  573. "duck": true,
  574. "durban": true,
  575. "dvag": true,
  576. "dz": true,
  577. "earth": true,
  578. "ec": true,
  579. "eco": true,
  580. "edeka": true,
  581. "edu": true,
  582. "education": true,
  583. "ee": true,
  584. "eg": true,
  585. "email": true,
  586. "emerck": true,
  587. "energy": true,
  588. "engineer": true,
  589. "engineering": true,
  590. "enterprises": true,
  591. "equipment": true,
  592. "er": true,
  593. "ericsson": true,
  594. "erni": true,
  595. "es": true,
  596. "estate": true,
  597. "et": true,
  598. "eu": true,
  599. "eurovision": true,
  600. "eus": true,
  601. "events": true,
  602. "everbank": true,
  603. "exchange": true,
  604. "expert": true,
  605. "exposed": true,
  606. "express": true,
  607. "extraspace": true,
  608. "fage": true,
  609. "fail": true,
  610. "fairwinds": true,
  611. "faith": true,
  612. "family": true,
  613. "fan": true,
  614. "fans": true,
  615. "farm": true,
  616. "fashion": true,
  617. "feedback": true,
  618. "ferrero": true,
  619. "fi": true,
  620. "film": true,
  621. "finance": true,
  622. "financial": true,
  623. "firmdale": true,
  624. "fish": true,
  625. "fishing": true,
  626. "fit": true,
  627. "fitness": true,
  628. "fj": true,
  629. "fk": true,
  630. "flights": true,
  631. "florist": true,
  632. "flowers": true,
  633. "fm": true,
  634. "fo": true,
  635. "foo": true,
  636. "football": true,
  637. "ford": true,
  638. "forex": true,
  639. "forsale": true,
  640. "forum": true,
  641. "foundation": true,
  642. "fox": true,
  643. "fr": true,
  644. "fresenius": true,
  645. "frl": true,
  646. "frogans": true,
  647. "fujitsu": true,
  648. "fujixerox": true,
  649. "fun": true,
  650. "fund": true,
  651. "furniture": true,
  652. "futbol": true,
  653. "fyi": true,
  654. "ga": true,
  655. "gal": true,
  656. "gallery": true,
  657. "game": true,
  658. "games": true,
  659. "garden": true,
  660. "gd": true,
  661. "gdn": true,
  662. "ge": true,
  663. "gea": true,
  664. "gent": true,
  665. "genting": true,
  666. "gf": true,
  667. "gg": true,
  668. "gh": true,
  669. "gi": true,
  670. "gift": true,
  671. "gifts": true,
  672. "gives": true,
  673. "gl": true,
  674. "glade": true,
  675. "glass": true,
  676. "global": true,
  677. "globo": true,
  678. "gm": true,
  679. "gmail": true,
  680. "gmbh": true,
  681. "gmo": true,
  682. "gn": true,
  683. "gold": true,
  684. "golf": true,
  685. "goo": true,
  686. "goog": true,
  687. "google": true,
  688. "gop": true,
  689. "gov": true,
  690. "gp": true,
  691. "gq": true,
  692. "gr": true,
  693. "graphics": true,
  694. "gratis": true,
  695. "green": true,
  696. "gripe": true,
  697. "group": true,
  698. "gs": true,
  699. "gt": true,
  700. "gu": true,
  701. "guardian": true,
  702. "gucci": true,
  703. "guide": true,
  704. "guitars": true,
  705. "guru": true,
  706. "gw": true,
  707. "gy": true,
  708. "hamburg": true,
  709. "haus": true,
  710. "health": true,
  711. "healthcare": true,
  712. "help": true,
  713. "here": true,
  714. "hiphop": true,
  715. "hisamitsu": true,
  716. "hitachi": true,
  717. "hiv": true,
  718. "hk": true,
  719. "hm": true,
  720. "hn": true,
  721. "hockey": true,
  722. "holdings": true,
  723. "holiday": true,
  724. "homes": true,
  725. "honda": true,
  726. "horse": true,
  727. "hospital": true,
  728. "host": true,
  729. "hosting": true,
  730. "hoteles": true,
  731. "hotmail": true,
  732. "house": true,
  733. "how": true,
  734. "hr": true,
  735. "hsbc": true,
  736. "ht": true,
  737. "hu": true,
  738. "ice": true,
  739. "id": true,
  740. "ie": true,
  741. "ifm": true,
  742. "ikano": true,
  743. "il": true,
  744. "im": true,
  745. "immo": true,
  746. "immobilien": true,
  747. "in": true,
  748. "industries": true,
  749. "info": true,
  750. "ink": true,
  751. "institute": true,
  752. "insurance": true,
  753. "insure": true,
  754. "int": true,
  755. "international": true,
  756. "investments": true,
  757. "io": true,
  758. "ipiranga": true,
  759. "iq": true,
  760. "ir": true,
  761. "irish": true,
  762. "is": true,
  763. "iselect": true,
  764. "ismaili": true,
  765. "ist": true,
  766. "istanbul": true,
  767. "it": true,
  768. "itv": true,
  769. "jaguar": true,
  770. "java": true,
  771. "jcb": true,
  772. "je": true,
  773. "jetzt": true,
  774. "jewelry": true,
  775. "jll": true,
  776. "jm": true,
  777. "jmp": true,
  778. "jnj": true,
  779. "jo": true,
  780. "jobs": true,
  781. "joburg": true,
  782. "jp": true,
  783. "jprs": true,
  784. "juegos": true,
  785. "kaufen": true,
  786. "ke": true,
  787. "kerryhotels": true,
  788. "kg": true,
  789. "kh": true,
  790. "ki": true,
  791. "kia": true,
  792. "kim": true,
  793. "kinder": true,
  794. "kitchen": true,
  795. "kiwi": true,
  796. "km": true,
  797. "kn": true,
  798. "koeln": true,
  799. "komatsu": true,
  800. "kp": true,
  801. "kpn": true,
  802. "kr": true,
  803. "krd": true,
  804. "kred": true,
  805. "kw": true,
  806. "ky": true,
  807. "kyoto": true,
  808. "kz": true,
  809. "la": true,
  810. "ladbrokes": true,
  811. "lamborghini": true,
  812. "lancaster": true,
  813. "land": true,
  814. "landrover": true,
  815. "lanxess": true,
  816. "lat": true,
  817. "latrobe": true,
  818. "law": true,
  819. "lawyer": true,
  820. "lb": true,
  821. "lc": true,
  822. "lease": true,
  823. "leclerc": true,
  824. "legal": true,
  825. "lego": true,
  826. "lexus": true,
  827. "lgbt": true,
  828. "li": true,
  829. "liaison": true,
  830. "lidl": true,
  831. "life": true,
  832. "lighting": true,
  833. "lilly": true,
  834. "limited": true,
  835. "limo": true,
  836. "linde": true,
  837. "link": true,
  838. "lipsy": true,
  839. "live": true,
  840. "lixil": true,
  841. "lk": true,
  842. "loan": true,
  843. "loans": true,
  844. "locus": true,
  845. "lol": true,
  846. "london": true,
  847. "lotto": true,
  848. "love": true,
  849. "lr": true,
  850. "ls": true,
  851. "lt": true,
  852. "ltd": true,
  853. "ltda": true,
  854. "lu": true,
  855. "lundbeck": true,
  856. "lupin": true,
  857. "luxury": true,
  858. "lv": true,
  859. "ly": true,
  860. "ma": true,
  861. "maif": true,
  862. "maison": true,
  863. "makeup": true,
  864. "man": true,
  865. "management": true,
  866. "mango": true,
  867. "market": true,
  868. "marketing": true,
  869. "markets": true,
  870. "marriott": true,
  871. "mba": true,
  872. "mc": true,
  873. "md": true,
  874. "me": true,
  875. "med": true,
  876. "media": true,
  877. "meet": true,
  878. "melbourne": true,
  879. "memorial": true,
  880. "men": true,
  881. "menu": true,
  882. "mg": true,
  883. "mh": true,
  884. "miami": true,
  885. "microsoft": true,
  886. "mil": true,
  887. "mini": true,
  888. "mk": true,
  889. "ml": true,
  890. "mlb": true,
  891. "mm": true,
  892. "mma": true,
  893. "mn": true,
  894. "mo": true,
  895. "mobi": true,
  896. "moda": true,
  897. "moe": true,
  898. "moi": true,
  899. "mom": true,
  900. "monash": true,
  901. "money": true,
  902. "mortgage": true,
  903. "moscow": true,
  904. "motorcycles": true,
  905. "movie": true,
  906. "mp": true,
  907. "mq": true,
  908. "mr": true,
  909. "ms": true,
  910. "mt": true,
  911. "mtn": true,
  912. "mtr": true,
  913. "mu": true,
  914. "museum": true,
  915. "mutual": true,
  916. "mv": true,
  917. "mw": true,
  918. "mx": true,
  919. "my": true,
  920. "mz": true,
  921. "na": true,
  922. "nab": true,
  923. "nadex": true,
  924. "nagoya": true,
  925. "name": true,
  926. "nationwide": true,
  927. "natura": true,
  928. "navy": true,
  929. "nc": true,
  930. "ne": true,
  931. "nec": true,
  932. "net": true,
  933. "network": true,
  934. "neustar": true,
  935. "new": true,
  936. "news": true,
  937. "next": true,
  938. "nextdirect": true,
  939. "nf": true,
  940. "ng": true,
  941. "ngo": true,
  942. "ni": true,
  943. "nico": true,
  944. "nikon": true,
  945. "ninja": true,
  946. "nissay": true,
  947. "nl": true,
  948. "no": true,
  949. "nokia": true,
  950. "norton": true,
  951. "np": true,
  952. "nr": true,
  953. "nra": true,
  954. "nrw": true,
  955. "ntt": true,
  956. "nu": true,
  957. "nyc": true,
  958. "nz": true,
  959. "obi": true,
  960. "observer": true,
  961. "off": true,
  962. "okinawa": true,
  963. "om": true,
  964. "omega": true,
  965. "one": true,
  966. "ong": true,
  967. "onl": true,
  968. "online": true,
  969. "onyourside": true,
  970. "ooo": true,
  971. "oracle": true,
  972. "orange": true,
  973. "org": true,
  974. "organic": true,
  975. "osaka": true,
  976. "otsuka": true,
  977. "ovh": true,
  978. "pa": true,
  979. "page": true,
  980. "paris": true,
  981. "partners": true,
  982. "parts": true,
  983. "party": true,
  984. "pe": true,
  985. "pet": true,
  986. "pf": true,
  987. "pg": true,
  988. "ph": true,
  989. "pharmacy": true,
  990. "philips": true,
  991. "photo": true,
  992. "photography": true,
  993. "photos": true,
  994. "physio": true,
  995. "pics": true,
  996. "pictet": true,
  997. "pictures": true,
  998. "pink": true,
  999. "pioneer": true,
  1000. "pizza": true,
  1001. "pk": true,
  1002. "pl": true,
  1003. "place": true,
  1004. "plumbing": true,
  1005. "plus": true,
  1006. "pm": true,
  1007. "pn": true,
  1008. "poker": true,
  1009. "porn": true,
  1010. "post": true,
  1011. "pr": true,
  1012. "praxi": true,
  1013. "press": true,
  1014. "pro": true,
  1015. "productions": true,
  1016. "promo": true,
  1017. "properties": true,
  1018. "property": true,
  1019. "protection": true,
  1020. "pru": true,
  1021. "prudential": true,
  1022. "ps": true,
  1023. "pt": true,
  1024. "pub": true,
  1025. "pw": true,
  1026. "py": true,
  1027. "qa": true,
  1028. "qpon": true,
  1029. "quebec": true,
  1030. "racing": true,
  1031. "radio": true,
  1032. "raid": true,
  1033. "re": true,
  1034. "realtor": true,
  1035. "realty": true,
  1036. "recipes": true,
  1037. "red": true,
  1038. "redstone": true,
  1039. "rehab": true,
  1040. "reise": true,
  1041. "reisen": true,
  1042. "reit": true,
  1043. "ren": true,
  1044. "rent": true,
  1045. "rentals": true,
  1046. "repair": true,
  1047. "report": true,
  1048. "republican": true,
  1049. "rest": true,
  1050. "restaurant": true,
  1051. "review": true,
  1052. "reviews": true,
  1053. "rexroth": true,
  1054. "rich": true,
  1055. "ricoh": true,
  1056. "rio": true,
  1057. "rip": true,
  1058. "ro": true,
  1059. "rocks": true,
  1060. "rodeo": true,
  1061. "rs": true,
  1062. "ru": true,
  1063. "ruhr": true,
  1064. "run": true,
  1065. "rw": true,
  1066. "rwe": true,
  1067. "ryukyu": true,
  1068. "sa": true,
  1069. "saarland": true,
  1070. "sale": true,
  1071. "salon": true,
  1072. "samsung": true,
  1073. "sandvik": true,
  1074. "sandvikcoromant": true,
  1075. "sanofi": true,
  1076. "sap": true,
  1077. "sarl": true,
  1078. "saxo": true,
  1079. "sb": true,
  1080. "sbi": true,
  1081. "sbs": true,
  1082. "sc": true,
  1083. "sca": true,
  1084. "scb": true,
  1085. "schmidt": true,
  1086. "school": true,
  1087. "schule": true,
  1088. "schwarz": true,
  1089. "science": true,
  1090. "scjohnson": true,
  1091. "scot": true,
  1092. "sd": true,
  1093. "se": true,
  1094. "seat": true,
  1095. "security": true,
  1096. "sener": true,
  1097. "services": true,
  1098. "ses": true,
  1099. "seven": true,
  1100. "sew": true,
  1101. "sex": true,
  1102. "sexy": true,
  1103. "sfr": true,
  1104. "sg": true,
  1105. "sh": true,
  1106. "shangrila": true,
  1107. "sharp": true,
  1108. "shell": true,
  1109. "shiksha": true,
  1110. "shoes": true,
  1111. "shop": true,
  1112. "shopping": true,
  1113. "show": true,
  1114. "shriram": true,
  1115. "si": true,
  1116. "singles": true,
  1117. "site": true,
  1118. "sk": true,
  1119. "ski": true,
  1120. "skin": true,
  1121. "sky": true,
  1122. "skype": true,
  1123. "sl": true,
  1124. "sm": true,
  1125. "smart": true,
  1126. "sn": true,
  1127. "sncf": true,
  1128. "so": true,
  1129. "soccer": true,
  1130. "social": true,
  1131. "software": true,
  1132. "sohu": true,
  1133. "solar": true,
  1134. "solutions": true,
  1135. "sony": true,
  1136. "soy": true,
  1137. "space": true,
  1138. "spreadbetting": true,
  1139. "sr": true,
  1140. "srl": true,
  1141. "st": true,
  1142. "stada": true,
  1143. "statefarm": true,
  1144. "statoil": true,
  1145. "stc": true,
  1146. "storage": true,
  1147. "store": true,
  1148. "stream": true,
  1149. "studio": true,
  1150. "study": true,
  1151. "style": true,
  1152. "su": true,
  1153. "sucks": true,
  1154. "supplies": true,
  1155. "supply": true,
  1156. "support": true,
  1157. "surf": true,
  1158. "surgery": true,
  1159. "suzuki": true,
  1160. "sv": true,
  1161. "swatch": true,
  1162. "swiss": true,
  1163. "sx": true,
  1164. "sy": true,
  1165. "sydney": true,
  1166. "symantec": true,
  1167. "systems": true,
  1168. "sz": true,
  1169. "taipei": true,
  1170. "tatamotors": true,
  1171. "tatar": true,
  1172. "tattoo": true,
  1173. "tax": true,
  1174. "taxi": true,
  1175. "tc": true,
  1176. "td": true,
  1177. "team": true,
  1178. "tech": true,
  1179. "technology": true,
  1180. "tel": true,
  1181. "tennis": true,
  1182. "teva": true,
  1183. "tf": true,
  1184. "tg": true,
  1185. "th": true,
  1186. "theater": true,
  1187. "theatre": true,
  1188. "tickets": true,
  1189. "tienda": true,
  1190. "tiffany": true,
  1191. "tips": true,
  1192. "tires": true,
  1193. "tirol": true,
  1194. "tj": true,
  1195. "tk": true,
  1196. "tl": true,
  1197. "tm": true,
  1198. "tn": true,
  1199. "to": true,
  1200. "today": true,
  1201. "tokyo": true,
  1202. "tools": true,
  1203. "top": true,
  1204. "toray": true,
  1205. "toshiba": true,
  1206. "total": true,
  1207. "tours": true,
  1208. "town": true,
  1209. "toyota": true,
  1210. "toys": true,
  1211. "tr": true,
  1212. "trade": true,
  1213. "trading": true,
  1214. "training": true,
  1215. "travel": true,
  1216. "travelers": true,
  1217. "trust": true,
  1218. "tt": true,
  1219. "tube": true,
  1220. "tv": true,
  1221. "tw": true,
  1222. "tz": true,
  1223. "ua": true,
  1224. "ubs": true,
  1225. "ug": true,
  1226. "uk": true,
  1227. "university": true,
  1228. "uno": true,
  1229. "uol": true,
  1230. "us": true,
  1231. "uy": true,
  1232. "uz": true,
  1233. "va": true,
  1234. "vacations": true,
  1235. "vanguard": true,
  1236. "vc": true,
  1237. "ve": true,
  1238. "vegas": true,
  1239. "ventures": true,
  1240. "versicherung": true,
  1241. "vet": true,
  1242. "vg": true,
  1243. "vi": true,
  1244. "viajes": true,
  1245. "video": true,
  1246. "vig": true,
  1247. "villas": true,
  1248. "vin": true,
  1249. "vip": true,
  1250. "vision": true,
  1251. "vistaprint": true,
  1252. "vlaanderen": true,
  1253. "vn": true,
  1254. "vodka": true,
  1255. "volkswagen": true,
  1256. "volvo": true,
  1257. "vote": true,
  1258. "voting": true,
  1259. "voto": true,
  1260. "voyage": true,
  1261. "vu": true,
  1262. "wales": true,
  1263. "walter": true,
  1264. "wang": true,
  1265. "warman": true,
  1266. "watch": true,
  1267. "webcam": true,
  1268. "weber": true,
  1269. "website": true,
  1270. "wed": true,
  1271. "wedding": true,
  1272. "weir": true,
  1273. "wf": true,
  1274. "whoswho": true,
  1275. "wien": true,
  1276. "wiki": true,
  1277. "williamhill": true,
  1278. "win": true,
  1279. "windows": true,
  1280. "wine": true,
  1281. "wme": true,
  1282. "woodside": true,
  1283. "work": true,
  1284. "works": true,
  1285. "world": true,
  1286. "ws": true,
  1287. "wtf": true,
  1288. "xbox": true,
  1289. "xerox": true,
  1290. "xin": true,
  1291. "xn--1ck2e1b": true,
  1292. "xn--1qqw23a": true,
  1293. "xn--2scrj9c": true,
  1294. "xn--30rr7y": true,
  1295. "xn--3bst00m": true,
  1296. "xn--3ds443g": true,
  1297. "xn--3e0b707e": true,
  1298. "xn--3hcrj9c": true,
  1299. "xn--45br5cyl": true,
  1300. "xn--45q11c": true,
  1301. "xn--4gbrim": true,
  1302. "xn--54b7fta0cc": true,
  1303. "xn--55qw42g": true,
  1304. "xn--55qx5d": true,
  1305. "xn--5su34j936bgsg": true,
  1306. "xn--5tzm5g": true,
  1307. "xn--6frz82g": true,
  1308. "xn--6qq986b3xl": true,
  1309. "xn--80adxhks": true,
  1310. "xn--80ao21a": true,
  1311. "xn--80asehdb": true,
  1312. "xn--80aswg": true,
  1313. "xn--90a3ac": true,
  1314. "xn--90ae": true,
  1315. "xn--90ais": true,
  1316. "xn--bck1b9a5dre4c": true,
  1317. "xn--c1avg": true,
  1318. "xn--cck2b3b": true,
  1319. "xn--cg4bki": true,
  1320. "xn--clchc0ea0b2g2a9gcd": true,
  1321. "xn--czr694b": true,
  1322. "xn--czrs0t": true,
  1323. "xn--czru2d": true,
  1324. "xn--d1acj3b": true,
  1325. "xn--d1alf": true,
  1326. "xn--e1a4c": true,
  1327. "xn--efvy88h": true,
  1328. "xn--fct429k": true,
  1329. "xn--fiq228c5hs": true,
  1330. "xn--fiq64b": true,
  1331. "xn--fiqs8s": true,
  1332. "xn--fiqz9s": true,
  1333. "xn--fjq720a": true,
  1334. "xn--fpcrj9c3d": true,
  1335. "xn--fzc2c9e2c": true,
  1336. "xn--gckr3f0f": true,
  1337. "xn--h2breg3eve": true,
  1338. "xn--h2brj9c": true,
  1339. "xn--h2brj9c8c": true,
  1340. "xn--hxt814e": true,
  1341. "xn--i1b6b1a6a2e": true,
  1342. "xn--imr513n": true,
  1343. "xn--io0a7i": true,
  1344. "xn--j1amh": true,
  1345. "xn--j6w193g": true,
  1346. "xn--jvr189m": true,
  1347. "xn--kcrx77d1x4a": true,
  1348. "xn--kprw13d": true,
  1349. "xn--kpry57d": true,
  1350. "xn--kput3i": true,
  1351. "xn--l1acc": true,
  1352. "xn--lgbbat1ad8j": true,
  1353. "xn--mgb9awbf": true,
  1354. "xn--mgba3a4f16a": true,
  1355. "xn--mgbaam7a8h": true,
  1356. "xn--mgbab2bd": true,
  1357. "xn--mgbai9azgqp6j": true,
  1358. "xn--mgbayh7gpa": true,
  1359. "xn--mgbbh1a": true,
  1360. "xn--mgberp4a5d4ar": true,
  1361. "xn--mgbgu82a": true,
  1362. "xn--mgbpl2fh": true,
  1363. "xn--mgbtx2b": true,
  1364. "xn--mix891f": true,
  1365. "xn--mk1bu44c": true,
  1366. "xn--ngbc5azd": true,
  1367. "xn--node": true,
  1368. "xn--nqv7f": true,
  1369. "xn--nyqy26a": true,
  1370. "xn--o3cw4h": true,
  1371. "xn--ogbpf8fl": true,
  1372. "xn--p1acf": true,
  1373. "xn--p1ai": true,
  1374. "xn--pgbs0dh": true,
  1375. "xn--q9jyb4c": true,
  1376. "xn--qxam": true,
  1377. "xn--rhqv96g": true,
  1378. "xn--rovu88b": true,
  1379. "xn--rvc1e0am3e": true,
  1380. "xn--ses554g": true,
  1381. "xn--t60b56a": true,
  1382. "xn--tckwe": true,
  1383. "xn--unup4y": true,
  1384. "xn--vhquv": true,
  1385. "xn--vuq861b": true,
  1386. "xn--w4r85el8fhu5dnra": true,
  1387. "xn--wgbh1c": true,
  1388. "xn--wgbl6a": true,
  1389. "xn--xhq521b": true,
  1390. "xn--xkc2al3hye2a": true,
  1391. "xn--xkc2dl3a5ee0h": true,
  1392. "xn--y9a3aq": true,
  1393. "xn--yfro4i67o": true,
  1394. "xn--ygbi2ammx": true,
  1395. "xn--zfr164b": true,
  1396. "xperia": true,
  1397. "xxx": true,
  1398. "xyz": true,
  1399. "yachts": true,
  1400. "yandex": true,
  1401. "ye": true,
  1402. "yoga": true,
  1403. "yokohama": true,
  1404. "yt": true,
  1405. "za": true,
  1406. "zm": true,
  1407. "zone": true,
  1408. "zw": true,
  1409. "セール": true,
  1410. "佛山": true,
  1411. "ಭಾರತ": true,
  1412. "慈善": true,
  1413. "集团": true,
  1414. "在线": true,
  1415. "한국": true,
  1416. "ଭାରତ": true,
  1417. "ভাৰত": true,
  1418. "八卦": true,
  1419. "موقع": true,
  1420. "বাংলা": true,
  1421. "公益": true,
  1422. "公司": true,
  1423. "é¦™æ ¼é‡Œæ‹‰": true,
  1424. "网站": true,
  1425. "移动": true,
  1426. "æˆ‘çˆ±ä½ ": true,
  1427. "москва": true,
  1428. "қаз": true,
  1429. "онлайн": true,
  1430. "сайт": true,
  1431. "срб": true,
  1432. "бг": true,
  1433. "бел": true,
  1434. "ファッション": true,
  1435. "орг": true,
  1436. "ストア": true,
  1437. "삼성": true,
  1438. "சிங்கப்பூர்": true,
  1439. "å•†æ ‡": true,
  1440. "商店": true,
  1441. "商城": true,
  1442. "дети": true,
  1443. "мкд": true,
  1444. "ею": true,
  1445. "æ–°é—»": true,
  1446. "å®¶é›»": true,
  1447. "中文网": true,
  1448. "中信": true,
  1449. "中国": true,
  1450. "中國": true,
  1451. "娱乐": true,
  1452. "భారత్": true,
  1453. "ලංකා": true,
  1454. "クラウド": true,
  1455. "भारतम्": true,
  1456. "भारत": true,
  1457. "भारोत": true,
  1458. "网店": true,
  1459. "संगठन": true,
  1460. "餐厅": true,
  1461. "网络": true,
  1462. "укр": true,
  1463. "香港": true,
  1464. "食品": true,
  1465. "飞利浦": true,
  1466. "台湾": true,
  1467. "台灣": true,
  1468. "手机": true,
  1469. "мон": true,
  1470. "الجزائر": true,
  1471. "عمان": true,
  1472. "ایران": true,
  1473. "امارات": true,
  1474. "بازار": true,
  1475. "پاکستان": true,
  1476. "الاردن": true,
  1477. "بارت": true,
  1478. "السعودية": true,
  1479. "ڀارت": true,
  1480. "سودان": true,
  1481. "عراق": true,
  1482. "澳門": true,
  1483. "ë‹·ì»´": true,
  1484. "شبكة": true,
  1485. "გე": true,
  1486. "机构": true,
  1487. "健康": true,
  1488. "ไทย": true,
  1489. "سورية": true,
  1490. "рус": true,
  1491. "рф": true,
  1492. "تونس": true,
  1493. "みんな": true,
  1494. "ελ": true,
  1495. "世界": true,
  1496. "書籍": true,
  1497. "ഭാരതം": true,
  1498. "网址": true,
  1499. "ë‹·ë„·": true,
  1500. "コム": true,
  1501. "游戏": true,
  1502. "企业": true,
  1503. "信息": true,
  1504. "嘉里大酒店": true,
  1505. "مصر": true,
  1506. "قطر": true,
  1507. "广东": true,
  1508. "இலங்கை": true,
  1509. "இந்தியா": true,
  1510. "Õ°Õ¡Õµ": true,
  1511. "æ–°åŠ å¡": true,
  1512. "فلسطين": true,
  1513. "政务": true
  1514. }
  1515. }
  1516. },{}],4:[function(require,module,exports){
  1517. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1518.  
  1519. var tlds = require("./tlds.json"),
  1520. RE = {
  1521. PROTOCOL: "([a-z][-a-z*]+://)?",
  1522. USER: "(?:([\\w:.+-]+)@)?",
  1523. DOMAIN_UNI: `([a-z0-9-.\\u00A0-\\uFFFF]+\\.[a-z0-9-${tlds.chars}]{1,${tlds.maxLength}})`,
  1524. DOMAIN: `([a-z0-9-.]+\\.[a-z0-9-]{1,${tlds.maxLength}})`,
  1525. PORT: "(:\\d+\\b)?",
  1526. PATH_UNI: "([/?#]\\S*)?",
  1527. PATH: "([/?#][\\w-.~!$&*+;=:@%/?#(),'\\[\\]]*)?"
  1528. },
  1529. TLD_TABLE = tlds.table;
  1530.  
  1531. function regexEscape(text) {
  1532. return text.replace(/[[\]\\^-]/g, "\\$&");
  1533. }
  1534.  
  1535. function buildRegex(_ref) {
  1536. var _ref$unicode = _ref.unicode,
  1537. unicode = _ref$unicode === undefined ? false : _ref$unicode,
  1538. _ref$customRules = _ref.customRules,
  1539. customRules = _ref$customRules === undefined ? [] : _ref$customRules,
  1540. _ref$standalone = _ref.standalone,
  1541. standalone = _ref$standalone === undefined ? false : _ref$standalone,
  1542. boundaryLeft = _ref.boundaryLeft,
  1543. boundaryRight = _ref.boundaryRight;
  1544.  
  1545. var pattern = RE.PROTOCOL + RE.USER;
  1546.  
  1547. if (unicode) {
  1548. pattern += RE.DOMAIN_UNI + RE.PORT + RE.PATH_UNI;
  1549. } else {
  1550. pattern += RE.DOMAIN + RE.PORT + RE.PATH;
  1551. }
  1552.  
  1553. if (customRules.length) {
  1554. pattern = "(?:" + pattern + "|(" + customRules.join("|") + "))";
  1555. } else {
  1556. pattern += "()";
  1557. }
  1558.  
  1559. var prefix, suffix, invalidSuffix;
  1560. if (standalone) {
  1561. if (boundaryLeft) {
  1562. prefix = "((?:^|\\s)[" + regexEscape(boundaryLeft) + "]*?)";
  1563. } else {
  1564. prefix = "(^|\\s)";
  1565. }
  1566. if (boundaryRight) {
  1567. suffix = "([" + regexEscape(boundaryRight) + "]*(?:$|\\s))";
  1568. } else {
  1569. suffix = "($|\\s)";
  1570. }
  1571. invalidSuffix = "[^\\s" + regexEscape(boundaryRight) + "]";
  1572. } else {
  1573. prefix = "(^|\\b|_)";
  1574. suffix = "()";
  1575. }
  1576.  
  1577. pattern = prefix + pattern + suffix;
  1578.  
  1579. return {
  1580. url: new RegExp(pattern, "igm"),
  1581. invalidSuffix: invalidSuffix && new RegExp(invalidSuffix),
  1582. mustache: /\{\{[\s\S]+?\}\}/g
  1583. };
  1584. }
  1585.  
  1586. function pathStrip(m, re, repl) {
  1587. var s = m.path.replace(re, repl);
  1588.  
  1589. if (s == m.path) return;
  1590.  
  1591. m.end -= m.path.length - s.length;
  1592. m.suffix = m.path.slice(s.length) + m.suffix;
  1593. m.path = s;
  1594. }
  1595.  
  1596. function pathStripQuote(m, c) {
  1597. var i = 0,
  1598. s = m.path,
  1599. end,
  1600. pos = 0;
  1601.  
  1602. if (!s.endsWith(c)) return;
  1603.  
  1604. while ((pos = s.indexOf(c, pos)) >= 0) {
  1605. if (i % 2) {
  1606. end = null;
  1607. } else {
  1608. end = pos;
  1609. }
  1610. pos++;
  1611. i++;
  1612. }
  1613.  
  1614. if (!end) return;
  1615.  
  1616. m.end -= s.length - end;
  1617. m.path = s.slice(0, end);
  1618. m.suffix = s.slice(end) + m.suffix;
  1619. }
  1620.  
  1621. function pathStripBrace(m, left, right) {
  1622. var str = m.path,
  1623. re = new RegExp("[\\" + left + "\\" + right + "]", "g"),
  1624. match,
  1625. count = 0,
  1626. end;
  1627.  
  1628. // Match loop
  1629. while (match = re.exec(str)) {
  1630. if (count % 2 == 0) {
  1631. end = match.index;
  1632. if (match[0] == right) {
  1633. break;
  1634. }
  1635. } else {
  1636. if (match[0] == left) {
  1637. break;
  1638. }
  1639. }
  1640. count++;
  1641. }
  1642.  
  1643. if (!match && count % 2 == 0) {
  1644. return;
  1645. }
  1646.  
  1647. m.end -= m.path.length - end;
  1648. m.path = str.slice(0, end);
  1649. m.suffix = str.slice(end) + m.suffix;
  1650. }
  1651.  
  1652. function isIP(s) {
  1653. var m, i;
  1654. if (!(m = s.match(/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/))) {
  1655. return false;
  1656. }
  1657. for (i = 1; i < m.length; i++) {
  1658. if (+m[i] > 255 || m[i].length > 1 && m[i][0] == "0") {
  1659. return false;
  1660. }
  1661. }
  1662. return true;
  1663. }
  1664.  
  1665. function isDomain(d) {
  1666. return (/^[^.-]/.test(d) && d.indexOf("..") < 0
  1667. );
  1668. }
  1669.  
  1670. function inTLDS(domain) {
  1671. var match = domain.match(/\.([^.]+)$/);
  1672. if (!match) {
  1673. return false;
  1674. }
  1675. var key = match[1].toLowerCase();
  1676. return TLD_TABLE.hasOwnProperty(key);
  1677. }
  1678.  
  1679. var UrlMatcher = function () {
  1680. function UrlMatcher() {
  1681. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  1682.  
  1683. _classCallCheck(this, UrlMatcher);
  1684.  
  1685. this.options = options;
  1686. this.regex = buildRegex(options);
  1687. }
  1688.  
  1689. UrlMatcher.prototype.match = function* match(text) {
  1690. var _options = this.options,
  1691. _options$fuzzyIp = _options.fuzzyIp,
  1692. fuzzyIp = _options$fuzzyIp === undefined ? true : _options$fuzzyIp,
  1693. _options$ignoreMustac = _options.ignoreMustache,
  1694. ignoreMustache = _options$ignoreMustac === undefined ? false : _options$ignoreMustac,
  1695. _regex = this.regex,
  1696. url = _regex.url,
  1697. invalidSuffix = _regex.invalidSuffix,
  1698. mustache = _regex.mustache,
  1699. urlLastIndex,
  1700. mustacheLastIndex;
  1701.  
  1702.  
  1703. mustache.lastIndex = 0;
  1704. url.lastIndex = 0;
  1705.  
  1706. var mustacheMatch, mustacheRange;
  1707. if (ignoreMustache) {
  1708. mustacheMatch = mustache.exec(text);
  1709. if (mustacheMatch) {
  1710. mustacheRange = {
  1711. start: mustacheMatch.index,
  1712. end: mustache.lastIndex
  1713. };
  1714. }
  1715. }
  1716.  
  1717. var urlMatch;
  1718. while (urlMatch = url.exec(text)) {
  1719. var result;
  1720. if (urlMatch[7]) {
  1721. // custom rules
  1722. result = {
  1723. start: urlMatch.index,
  1724. end: url.lastIndex,
  1725.  
  1726. text: urlMatch[0],
  1727. url: urlMatch[0],
  1728.  
  1729. custom: urlMatch[7]
  1730. };
  1731. } else {
  1732. result = {
  1733. start: urlMatch.index + urlMatch[1].length,
  1734. end: url.lastIndex - urlMatch[8].length,
  1735.  
  1736. text: null,
  1737. url: null,
  1738.  
  1739. prefix: urlMatch[1],
  1740. protocol: urlMatch[2],
  1741. auth: urlMatch[3] || "",
  1742. domain: urlMatch[4],
  1743. port: urlMatch[5] || "",
  1744. path: urlMatch[6] || "",
  1745. custom: urlMatch[7],
  1746. suffix: urlMatch[8]
  1747. };
  1748. }
  1749.  
  1750. if (mustacheRange && mustacheRange.end <= result.start) {
  1751. mustacheMatch = mustache.exec(text);
  1752. if (mustacheMatch) {
  1753. mustacheRange.start = mustacheMatch.index;
  1754. mustacheRange.end = mustache.lastIndex;
  1755. } else {
  1756. mustacheRange = null;
  1757. }
  1758. }
  1759.  
  1760. // ignore urls inside mustache pair
  1761. if (mustacheRange && result.start < mustacheRange.end && result.end >= mustacheRange.start) {
  1762. continue;
  1763. }
  1764.  
  1765. if (!result.custom) {
  1766. // adjust path and suffix
  1767. if (result.path) {
  1768. // Strip BBCode
  1769. pathStrip(result, /\[\/?(b|i|u|url|img|quote|code|size|color)\].*/i, "");
  1770.  
  1771. // Strip braces
  1772. pathStripBrace(result, "(", ")");
  1773. pathStripBrace(result, "[", "]");
  1774. pathStripBrace(result, "{", "}");
  1775.  
  1776. // Strip quotes
  1777. pathStripQuote(result, "'");
  1778. pathStripQuote(result, '"');
  1779.  
  1780. // Remove trailing ".,?"
  1781. pathStrip(result, /(^|[^-_])[.,?]+$/, "$1");
  1782. }
  1783.  
  1784. // check suffix
  1785. if (invalidSuffix && invalidSuffix.test(result.suffix)) {
  1786. if (/\s$/.test(result.suffix)) {
  1787. url.lastIndex--;
  1788. }
  1789. continue;
  1790. }
  1791.  
  1792. // check domain
  1793. if (isIP(result.domain)) {
  1794. if (!fuzzyIp && !result.protocol && !result.auth && !result.path) {
  1795. continue;
  1796. }
  1797. } else if (isDomain(result.domain)) {
  1798. if (!inTLDS(result.domain)) {
  1799. continue;
  1800. }
  1801. } else {
  1802. continue;
  1803. }
  1804.  
  1805. // mailto protocol
  1806. if (!result.protocol && result.auth) {
  1807. var matchMail = result.auth.match(/^mailto:(.+)/);
  1808. if (matchMail) {
  1809. result.protocol = "mailto:";
  1810. result.auth = matchMail[1];
  1811. }
  1812. }
  1813.  
  1814. // http alias
  1815. if (result.protocol && result.protocol.match(/^(hxxp|h\*\*p|ttp)/)) {
  1816. result.protocol = "http://";
  1817. }
  1818.  
  1819. // guess protocol
  1820. if (!result.protocol) {
  1821. var domainMatch;
  1822. if (domainMatch = result.domain.match(/^(ftp|irc)/)) {
  1823. result.protocol = domainMatch[0] + "://";
  1824. } else if (result.domain.match(/^(www|web)/)) {
  1825. result.protocol = "http://";
  1826. } else if (result.auth && result.auth.indexOf(":") < 0 && !result.path) {
  1827. result.protocol = "mailto:";
  1828. } else {
  1829. result.protocol = "http://";
  1830. }
  1831. }
  1832.  
  1833. // Create URL
  1834. result.url = result.protocol + (result.auth && result.auth + "@") + result.domain + result.port + result.path;
  1835. result.text = text.slice(result.start, result.end);
  1836. }
  1837.  
  1838. // since regex is shared with other parse generators, cache lastIndex position and restore later
  1839. mustacheLastIndex = mustache.lastIndex;
  1840. urlLastIndex = url.lastIndex;
  1841.  
  1842. yield result;
  1843.  
  1844. url.lastIndex = urlLastIndex;
  1845. mustache.lastIndex = mustacheLastIndex;
  1846. }
  1847. };
  1848.  
  1849. return UrlMatcher;
  1850. }();
  1851.  
  1852. module.exports = {
  1853. UrlMatcher
  1854. };
  1855.  
  1856. },{"./tlds.json":3}],5:[function(require,module,exports){
  1857. /**
  1858. * event-lite.js - Light-weight EventEmitter (less than 1KB when gzipped)
  1859. *
  1860. * @copyright Yusuke Kawasaki
  1861. * @license MIT
  1862. * @constructor
  1863. * @see https://github.com/kawanet/event-lite
  1864. * @see http://kawanet.github.io/event-lite/EventLite.html
  1865. * @example
  1866. * var EventLite = require("event-lite");
  1867. *
  1868. * function MyClass() {...} // your class
  1869. *
  1870. * EventLite.mixin(MyClass.prototype); // import event methods
  1871. *
  1872. * var obj = new MyClass();
  1873. * obj.on("foo", function() {...}); // add event listener
  1874. * obj.once("bar", function() {...}); // add one-time event listener
  1875. * obj.emit("foo"); // dispatch event
  1876. * obj.emit("bar"); // dispatch another event
  1877. * obj.off("foo"); // remove event listener
  1878. */
  1879.  
  1880. function EventLite() {
  1881. if (!(this instanceof EventLite)) return new EventLite();
  1882. }
  1883.  
  1884. (function(EventLite) {
  1885. // export the class for node.js
  1886. if ("undefined" !== typeof module) module.exports = EventLite;
  1887.  
  1888. // property name to hold listeners
  1889. var LISTENERS = "listeners";
  1890.  
  1891. // methods to export
  1892. var methods = {
  1893. on: on,
  1894. once: once,
  1895. off: off,
  1896. emit: emit
  1897. };
  1898.  
  1899. // mixin to self
  1900. mixin(EventLite.prototype);
  1901.  
  1902. // export mixin function
  1903. EventLite.mixin = mixin;
  1904.  
  1905. /**
  1906. * Import on(), once(), off() and emit() methods into target object.
  1907. *
  1908. * @function EventLite.mixin
  1909. * @param target {Prototype}
  1910. */
  1911.  
  1912. function mixin(target) {
  1913. for (var key in methods) {
  1914. target[key] = methods[key];
  1915. }
  1916. return target;
  1917. }
  1918.  
  1919. /**
  1920. * Add an event listener.
  1921. *
  1922. * @function EventLite.prototype.on
  1923. * @param type {string}
  1924. * @param func {Function}
  1925. * @returns {EventLite} Self for method chaining
  1926. */
  1927.  
  1928. function on(type, func) {
  1929. getListeners(this, type).push(func);
  1930. return this;
  1931. }
  1932.  
  1933. /**
  1934. * Add one-time event listener.
  1935. *
  1936. * @function EventLite.prototype.once
  1937. * @param type {string}
  1938. * @param func {Function}
  1939. * @returns {EventLite} Self for method chaining
  1940. */
  1941.  
  1942. function once(type, func) {
  1943. var that = this;
  1944. wrap.originalListener = func;
  1945. getListeners(that, type).push(wrap);
  1946. return that;
  1947.  
  1948. function wrap() {
  1949. off.call(that, type, wrap);
  1950. func.apply(this, arguments);
  1951. }
  1952. }
  1953.  
  1954. /**
  1955. * Remove an event listener.
  1956. *
  1957. * @function EventLite.prototype.off
  1958. * @param [type] {string}
  1959. * @param [func] {Function}
  1960. * @returns {EventLite} Self for method chaining
  1961. */
  1962.  
  1963. function off(type, func) {
  1964. var that = this;
  1965. var listners;
  1966. if (!arguments.length) {
  1967. delete that[LISTENERS];
  1968. } else if (!func) {
  1969. listners = that[LISTENERS];
  1970. if (listners) {
  1971. delete listners[type];
  1972. if (!Object.keys(listners).length) return off.call(that);
  1973. }
  1974. } else {
  1975. listners = getListeners(that, type, true);
  1976. if (listners) {
  1977. listners = listners.filter(ne);
  1978. if (!listners.length) return off.call(that, type);
  1979. that[LISTENERS][type] = listners;
  1980. }
  1981. }
  1982. return that;
  1983.  
  1984. function ne(test) {
  1985. return test !== func && test.originalListener !== func;
  1986. }
  1987. }
  1988.  
  1989. /**
  1990. * Dispatch (trigger) an event.
  1991. *
  1992. * @function EventLite.prototype.emit
  1993. * @param type {string}
  1994. * @param [value] {*}
  1995. * @returns {boolean} True when a listener received the event
  1996. */
  1997.  
  1998. function emit(type, value) {
  1999. var that = this;
  2000. var listeners = getListeners(that, type, true);
  2001. if (!listeners) return false;
  2002. var arglen = arguments.length;
  2003. if (arglen === 1) {
  2004. listeners.forEach(zeroarg);
  2005. } else if (arglen === 2) {
  2006. listeners.forEach(onearg);
  2007. } else {
  2008. var args = Array.prototype.slice.call(arguments, 1);
  2009. listeners.forEach(moreargs);
  2010. }
  2011. return !!listeners.length;
  2012.  
  2013. function zeroarg(func) {
  2014. func.call(that);
  2015. }
  2016.  
  2017. function onearg(func) {
  2018. func.call(that, value);
  2019. }
  2020.  
  2021. function moreargs(func) {
  2022. func.apply(that, args);
  2023. }
  2024. }
  2025.  
  2026. /**
  2027. * @ignore
  2028. */
  2029.  
  2030. function getListeners(that, type, readonly) {
  2031. if (readonly && !that[LISTENERS]) return;
  2032. var listeners = that[LISTENERS] || (that[LISTENERS] = {});
  2033. return listeners[type] || (listeners[type] = []);
  2034. }
  2035.  
  2036. })(EventLite);
  2037.  
  2038. },{}]},{},[1])(1)
  2039. });