{"version":3,"file":"index.mjs","names":[],"sources":["../src/rebuilder.ts","../src/linkifyit.ts"],"sourcesContent":["/* eslint-disable no-return-assign, prefer-regex-literals */\n\nimport { Any, Cc, Z, P } from 'uc.micro'\n\n/**\n * @category types\n */\nexport interface REBuilderOptions {\n  '---'?: boolean\n  fuzzyIP?: boolean\n  schema_names?: string[]\n  tlds?: string[]\n  urlAuth?: boolean\n  maxLength?: number\n}\n\nexport class REBuilder {\n  src_Any = Any.source\n  src_Cc = Cc.source\n  src_Z = Z.source\n  src_P = P.source\n  // \\p{\\Z\\P\\Cc\\CF} (white spaces + control + format + punctuation)\n  src_ZPCc = [this.src_Z, this.src_P, this.src_Cc].join('|')\n  // \\p{\\Z\\Cc} (white spaces + control)\n  src_ZCc = [this.src_Z, this.src_Cc].join('|')\n  cache: Record<string, RegExp | undefined> = {}\n  opts: REBuilderOptions = { maxLength: 10000, urlAuth: false, schema_names: [] }\n\n  constructor (opts: REBuilderOptions = {}) {\n    this.opts = { ...this.opts, ...opts }\n  }\n\n  set (opts: REBuilderOptions = {}) {\n    this.opts = { ...this.opts, ...opts }\n\n    this.cache = {}\n    return this\n  }\n\n  escapeRE (str: string) { return str.replace(/[.?*+^$[\\]\\\\(){}|-]/g, '\\\\$&') }\n\n  nestedPairRE (open: string, close: string, depth = 4) {\n    const openRE = this.escapeRE(open)\n    const closeRE = this.escapeRE(close)\n    const atom = `(?:(?!${this.src_ZCc}|${openRE}|${closeRE}).)`\n\n    let pair = `${openRE}${atom}{0,1000}${closeRE}`\n\n    for (let level = 2; level <= depth; level++) {\n      pair = `${openRE}(?:${atom}|${pair}){0,1000}${closeRE}`\n    }\n\n    return pair\n  }\n\n  // Partials\n\n  get_text_separators () {\n    // Experimental. List of chars, completely prohibited in links\n    // because can separate it from other part of text\n    return this.cache.text_separators ??= /[><\\uff5c]/\n  }\n\n  get_pseudo_letter () {\n    return this.cache.src_pseudo_letter ??= new RegExp(\n      // All possible word characters (everything without punctuation, spaces & controls)\n      // Defined via punctuation & spaces to save space\n      // Should be something like \\p{\\L\\N\\S\\M} (\\w but without `_`)\n      `(?:(?!${this.get_text_separators().source}|${this.src_ZPCc})${this.src_Any})`\n    )\n  }\n\n  get_ipv4_addr () {\n    return this.cache.src_ip4 ??= new RegExp(\n      '(?:' +\n        '(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])[.]' +\n      '){3}' +\n      '(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])'\n    )\n  }\n\n  get_ipv6_addr () {\n    const h16 = '[0-9A-Fa-f]{1,4}'\n    const ls32 = `(?:(?:${h16}:${h16})|${this.get_ipv4_addr().source})`\n\n    return this.cache.src_ip6_addr ??= new RegExp(\n      '(?:' +\n        `(?:${h16}:){6}${ls32}|` +\n        `::(?:${h16}:){5}${ls32}|` +\n        `(?:${h16})?::(?:${h16}:){4}${ls32}|` +\n        `(?:(?:${h16}:){0,1}${h16})?::(?:${h16}:){3}${ls32}|` +\n        `(?:(?:${h16}:){0,2}${h16})?::(?:${h16}:){2}${ls32}|` +\n        `(?:(?:${h16}:){0,3}${h16})?::${h16}:${ls32}|` +\n        `(?:(?:${h16}:){0,4}${h16})?::${ls32}|` +\n        `(?:(?:${h16}:){0,5}${h16})?::${h16}|` +\n        `(?:(?:${h16}:){0,6}${h16})?::` +\n      ')'\n    )\n  }\n\n  get_ipv6_url_host () {\n    return this.cache.src_ip6_host ??= new RegExp(\n      `\\\\[${this.get_ipv6_addr().source}\\\\]`\n    )\n  }\n\n  get_ipv6_mail_host () {\n    return this.cache.src_ipv6_mail_host ??= new RegExp(\n      `\\\\[IPv6:${this.get_ipv6_addr().source}\\\\]`\n    )\n  }\n\n  get_auth () {\n    return this.cache.src_auth ??= new RegExp(\n      // Prohibit any of \"@/[]()\" in user/pass to avoid wrong domain fetch.\n      // Length is capped to exclude possible rescans till the end and avoid O(n^2)\n      // DoS. No standard limit, just take something reasonable.\n      `(?:(?:(?!${this.src_ZCc}|[@/\\\\[\\\\]()]).){1,50}@)?`\n    )\n  }\n\n  get_port () {\n    return this.cache.src_port ??= new RegExp(\n      '(?::(?:6(?:[0-4]\\\\d{3}|5(?:[0-4]\\\\d{2}|5(?:[0-2]\\\\d|3[0-5])))|[1-5]?\\\\d{1,4}))?'\n    )\n  }\n\n  get_host_terminator () {\n    // Force greedy fetch, we should not stop earlier than host part is fully fetched.\n    return this.cache.src_host_terminator ??= new RegExp(\n      `(?=$|${this.get_text_separators().source}|${this.src_ZPCc})` +\n      `(?!${this.opts['---'] ? '-(?!--)|' : '-|'}_|:\\\\d|\\\\.-|\\\\.(?!$|${this.src_ZPCc}))`\n    )\n  }\n\n  get_path_terminator () {\n    return this.cache.src_path_terminator ??= new RegExp(\n      `${this.src_ZPCc}|${this.get_text_separators().source}`\n      // `${this.src_ZCc}|${this.get_text_separators().source}|[()[\\\\]{}.,\"'?!\\\\-;]`\n    )\n  }\n\n  get_path () {\n    return this.cache.src_path ??= new RegExp(\n      '(?:' +\n        '[/?#]' +\n          '(?:' +\n            `${this.nestedPairRE('[', ']')}|` +\n            `${this.nestedPairRE('(', ')')}|` +\n            `${this.nestedPairRE('{', '}')}|` +\n            `\\\\\"(?:(?!${this.src_ZCc}|[\"]).){1,100}\\\\\"|` +\n            `\\\\'(?:(?!${this.src_ZCc}|[']).){1,100}\\\\'|` +\n\n            // allow `I'm_king` if no pair found\n            `\\\\'(?=${this.get_pseudo_letter().source}|[-])|` +\n\n            // 1. google has many dots in \"google search\" links (#66, #81).\n            // github has ... in commit range links,\n            // Restrict to\n            // - english\n            // - percent-encoded\n            // - parts of file path\n            // - params separator\n            // until more examples found.\n            //\n            // 2. Allow `..:XX` for Odysee links (optional `:`), #100\n            // This may be narrowed down later via separate rule.\n            '\\\\.{2,20}[:]?[a-zA-Z0-9%/&]|' +\n\n            `\\\\.(?!${this.src_ZCc}|[.]|$)|` +\n            (this.opts['---']\n              ? '\\\\-(?!--(?:[^-]|$))(?:-{0,19})|' // `---` => long dash, terminate\n              : '\\\\-{1,20}|'\n            ) +\n            // allow `,,,` in paths\n            `,(?!${this.src_ZCc}|$)|` +\n\n            // allow `;` if not followed by space-like char\n            `;(?!${this.src_ZCc}|$)|` +\n\n            // allow `!!!` in paths, but not at the end\n            `\\\\!{1,20}(?!${this.src_ZCc}|[!]|$)|` +\n\n            `\\\\?(?!${this.src_ZCc}|[?]|$)|` +\n\n            this.get_path_extra().source +\n\n            // allowed punctuation chars in path.\n            '[\\\\\\\\/:%@#&=_~*]|' +\n\n            // if no special rules matched, consume all chars except terminators.\n            `(?!${this.get_path_terminator().source}).` +\n          `){1,${this.opts.maxLength}}` +\n        '|\\\\/' +\n      ')?'\n    )\n  }\n\n  get_mail_name () {\n    return this.cache.src_mail_name ??= new RegExp(\n      // RFC 5321 dot-string only (no quoted-string), max 64 ASCII characters.\n      \"[-!#$%&'*+/=?^_`{|}~a-zA-Z0-9](?:[-!#$%&'*+/=?^_`{|}~a-zA-Z0-9]|[.](?=[-!#$%&'*+/=?^_`{|}~a-zA-Z0-9])){0,63}\"\n    )\n  }\n\n  get_xn () {\n    return this.cache.src_xn ??= new RegExp(\n      'xn--[a-z0-9\\\\-]{1,59}'\n    )\n  }\n\n  get_tld () {\n    if (this.cache.tld) return this.cache.tld\n\n    const tlds_src = [...new Set(this.opts.tlds || [])].sort().reverse()\n      .join('|')\n\n    this.cache.tld = new RegExp(\n      `${tlds_src || '$#none#$'}|${this.get_xn().source}`\n    )\n    return this.cache.tld\n  }\n\n  get_domain_root () {\n    return this.cache.src_domain_root ??= new RegExp(\n      // More to read about domain names\n      // http://serverfault.com/questions/638260/\n\n      // Allow letters & digits (http://test1)\n      '(?:' +\n        this.get_xn().source +\n        '|' +\n        `${this.get_pseudo_letter().source}{1,63}` +\n      ')'\n    )\n  }\n\n  get_domain () {\n    return this.cache.src_domain ??= new RegExp(\n      '(?:' +\n        this.get_xn().source +\n        '|' +\n        `(?:${this.get_pseudo_letter().source})` +\n        '|' +\n        `(?:${this.get_pseudo_letter().source}(?:-|${this.get_pseudo_letter().source}){0,61}${this.get_pseudo_letter().source})` +\n      ')'\n    )\n  }\n\n  // Host rules, depending on the type\n\n  get_url_host_port () {\n    return this.cache.url_host_port ??= new RegExp(\n      '(?:' +\n        // Don't need IP v4 check, because digits are already allowed\n        // in normal domain names\n        this.get_ipv6_url_host().source +\n        '|' +\n        `(?:(?:(?:${this.get_domain().source})\\\\.){0,10}${this.get_domain().source})`/* _root */ +\n      ')' +\n      this.get_port().source +\n      this.get_host_terminator().source\n    )\n  }\n\n  get_fuzzy_url_host_port () {\n    // - TLD as anchor\n    // - No local domains\n    return this.cache.fuzzy_url_host_port ??= new RegExp(\n      '(?:' +\n        (this.opts.fuzzyIP ? this.get_ipv4_addr().source + '|' : '') +\n        `(?:(?:(?:${this.get_domain().source})\\\\.){1,10}(?:${this.get_tld().source}))` +\n      ')' +\n      // No port in fuzzy links to reduce search\n      this.get_host_terminator().source\n    )\n  }\n\n  get_mail_host () {\n    // Similar to normal url host, but\n    // - with different ipv6 format (and without port).\n    // - with reduced max subdomains\n    return this.cache.src_mail_host ??= new RegExp(\n      '(?:' +\n        this.get_ipv6_mail_host().source +\n        '|' +\n        `(?:(?:(?:${this.get_domain().source})\\\\.){0,4}${this.get_domain().source})` +\n      ')' +\n      this.get_host_terminator().source\n    )\n  }\n\n  get_fuzzy_mail_host () {\n    // Similar to normal mail host, but without local domains.\n    return this.cache.src_fuzzy_mail_host ??= new RegExp(\n      '(?:' +\n        this.get_ipv6_mail_host().source +\n        '|' +\n        `(?:(?:(?:${this.get_domain().source})[.]){1,4}${this.get_domain_root().source})` +\n      ')' +\n      this.get_host_terminator().source\n    )\n  }\n\n  // Hooks\n\n  get_path_extra () {\n    return this.cache.src_path_extra ??= new RegExp('')\n  }\n\n  // \"Public\" rules\n\n  get_fuzzy_mail_host_search () {\n    return this.cache.mail_fuzzy_host_search ??= new RegExp(\n      `@${this.get_fuzzy_mail_host().source}`,\n      'ig'\n    )\n  }\n\n  get_fuzzy_link_search () {\n    return this.cache.link_fuzzy_search ??= new RegExp(\n        // Fuzzy link can't be prepended with .:/\\- and non punctuation.\n        // but can start with > (markdown blockquote)\n        `(^|(?![.:/\\\\-_@])(?:[$+<=>^\\`|\\uff5c]|${this.src_ZPCc}))` +\n        `(?:(?![$+<=>^\\`|\\uff5c])${this.get_fuzzy_url_host_port().source}${this.get_path().source})`,\n      'ig'\n    )\n  }\n\n  get_http_validator () {\n    return this.cache.http_validator ??= new RegExp(\n      '\\\\/\\\\/' +\n      (this.opts.urlAuth ? this.get_auth().source : '') +\n      this.get_url_host_port().source +\n      this.get_path().source,\n      'iy'\n    )\n  }\n\n  get_relative_proto_validator () {\n    return this.cache.relative_proto_validator ??= new RegExp(\n      (this.opts.urlAuth ? this.get_auth().source : '') +\n      // Don't allow single-level domains, because of false positives like '//test'\n      // with code comments.\n      `(?:localhost|${this.get_ipv6_url_host().source}|(?:(?:${this.get_domain().source})[.]){1,10}${this.get_domain_root().source})` +\n      this.get_port().source +\n      this.get_host_terminator().source +\n      this.get_path().source,\n\n      'iy'\n    )\n  }\n\n  get_mail_name_validator () {\n    return this.cache.mail_name_validator ??= new RegExp(\n      `(?:^|${this.get_text_separators().source}|\"|\\\\(|${this.src_ZCc})` +\n      `(${this.get_mail_name().source})$`\n    )\n  }\n\n  get_mailto_validator () {\n    return this.cache.mailto_validator ??= new RegExp(\n      `${this.get_mail_name().source}@${this.get_mail_host().source}`,\n      'iy'\n    )\n  }\n\n  get_schema_names () {\n    return this.cache.schema_names ??= new RegExp((this.opts.schema_names || []).map(name => this.escapeRE(name)).join('|'))\n  }\n\n  get_schema_search () {\n    return this.cache.schema_search ??= new RegExp(\n      `(^|(?!_)(?:[><\\uff5c]|${this.src_ZPCc}))(${this.get_schema_names().source})`,\n      'ig'\n    )\n  }\n\n  get_schema_at_start () {\n    return this.cache.schema_at_start ??= new RegExp(\n      `^${this.get_schema_search().source}`,\n      'i'\n    )\n  }\n}\n","import { REBuilder } from './rebuilder.ts'\n\n//\n\n/**\n * Recognition options for schemaless links.\n *\n * @category types\n */\nexport interface LinkifyOptions {\n  /** Recognize URLs without `http(s)://` prefix. Default `false`. */\n  fuzzyLink?: boolean\n  /** Recognize emails without `mailto:` prefix. Default `true`. */\n  fuzzyEmail?: boolean\n  /**\n   * Allow IPs in fuzzy links. Can conflict with some texts, like version\n   * numbers. Default `false`.\n   */\n  fuzzyIP?: boolean\n  /**\n   * Terminate link with `---` if it is considered a long dash. Default `false`.\n   */\n  '---'?: boolean\n  /** Allowed TLDs list for fuzzy links. Replaces the default list when set. */\n  tlds?: string[]\n  /** Recognize authentication data in URLs. Default `false`. */\n  urlAuth?: boolean\n  /** Maximum link length. Default `10000`. */\n  maxLength?: number\n}\n\nexport interface LinkifyConstructorOptions extends LinkifyOptions {\n  /** Custom regular expression builder. */\n  rebuilder?: REBuilder\n}\n\n/**\n * Custom schema definition.\n *\n * @category types\n */\nexport interface SchemaOpts {\n  /**\n   * Checks text after the schema prefix. Should return matched tail length on\n   * success, or `0` on fail.\n   */\n  validate: (text: string, pos: number, self: LinkifyIt) => number\n  /**\n   * Optional function to normalize `text` and `url` of matched result, for\n   * example for `@twitter` mentions.\n   */\n  normalize?: (match: Match, self: LinkifyIt) => void\n}\n\ntype Schema = Required<SchemaOpts>\n\ninterface MatchCandidate {\n  schema: string\n  index: number\n  lastIndex: number\n}\n\nconst web_schema: Schema = {\n  validate: (text: string, pos: number, self: LinkifyIt) => {\n    const re = self.re.get_http_validator()\n    re.lastIndex = pos\n\n    const m = re.exec(text)\n    return m ? m[0].length : 0\n  },\n  normalize: (match: Match, self: LinkifyIt) => self.normalize(match)\n}\n\nconst defaultSchemas: Record<string, Schema> = {\n  'http:': web_schema,\n  'https:': web_schema,\n  'ftp:': web_schema,\n  '//': {\n    validate: function (text: string, pos: number, self: LinkifyIt) {\n      const re = self.re.get_relative_proto_validator()\n      re.lastIndex = pos\n\n      const m = re.exec(text)\n      if (m) {\n        // should not be `://` & `///`, that protects from errors in protocol name\n        if (pos >= 3 && text[pos - 3] === ':') { return 0 }\n        if (pos >= 3 && text[pos - 3] === '/') { return 0 }\n        return m[0].length\n      }\n      return 0\n    },\n    normalize: (match: Match, self: LinkifyIt) => self.normalize(match)\n  },\n  'mailto:': {\n    validate: function (text: string, pos: number, self: LinkifyIt) {\n      const re = self.re.get_mailto_validator()\n      re.lastIndex = pos\n\n      const m = re.exec(text)\n      return m ? m[0].length : 0\n    },\n    normalize: (match: Match, self: LinkifyIt) => self.normalize(match)\n  }\n}\n\n// List of 2-character tlds (autogenerated by ./support/tlds_2char_gen.js)\nconst tlds_2ch = 'a:cdefgilmnoqrstuwxz|b:abdefghijmnorstvwyz|c:acdfghiklmnoruvwxyz|d:ejkmoz|e:cegrstu|f:ijkmor|g:abdefghilmnpqrstuwy|h:kmnrtu|i:delmnoqrst|j:emop|k:eghimnprwyz|l:abcikrstuvy|m:acdeghklmnopqrstuvwxyz|n:acefgilopruz|o:m|p:aefghklmnrstwy|q:a|r:eosuw|s:abcdeghijklmnortuvxyz|t:cdfghjklmnortvwz|u:agksyz|v:aceginu|w:fs|y:et|z:amw'\n\n// DON'T try to make PRs with changes. Extend TLDs with LinkifyIt.tlds() instead\nconst tlds_default = 'biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф'\n\nfunction unpackTlds (): string[] {\n  const result = tlds_default.split('|')\n\n  tlds_2ch.split('|').forEach((item) => {\n    const sep = item.indexOf(':')\n\n    const prefix = item.slice(0, sep)\n\n    for (const suffix of item.slice(sep + 1)) {\n      result.push(prefix + suffix)\n    }\n  })\n\n  return result\n}\n\nconst defaultOptions: Required<LinkifyOptions> = {\n  fuzzyLink: false,\n  fuzzyEmail: true,\n  fuzzyIP: false,\n  '---': false,\n  tlds: unpackTlds(),\n  urlAuth: false,\n  maxLength: 10000\n}\n\n/**\n * Match result returned by {@link LinkifyIt.match} and\n * {@link LinkifyIt.matchAtStart}.\n *\n * @category types\n */\nexport class Match {\n  /** Prefix (protocol) for matched string. Empty for fuzzy links. */\n  schema: string\n  /** First position of matched string. */\n  index: number\n  /** Next position after matched string. */\n  lastIndex: number\n  /** Matched string. */\n  raw: string\n  /** Normalized text of matched string. */\n  text: string\n  /** Normalized URL of matched string. */\n  url: string\n\n  constructor (text: string, schema: string, index: number, lastIndex: number) {\n    const raw = text.slice(index, lastIndex)\n\n    this.schema = schema.toLowerCase()\n    this.index = index\n    this.lastIndex = lastIndex\n    this.raw = raw\n    this.text = raw\n    this.url = raw\n  }\n}\n\n/** Linkifier instance. */\nexport class LinkifyIt {\n  __opts__: Required<LinkifyOptions>\n  private __schemas__: Record<string, Schema>\n  re: REBuilder\n\n  /**\n   * Creates new linkifier instance.\n   *\n   * By default understands:\n   *\n   * - `http(s)://...` , `ftp://...`, `mailto:...` & `//...` links\n   * - \"fuzzy\" emails (foo@bar.com).\n   *\n   * See {@link LinkifyConstructorOptions} for available options.\n   *\n   * @param options Recognition options.\n   *\n   * @example\n   * ```javascript\n   * import { LinkifyIt } from 'linkify-it'\n   *\n   * const linkify = new LinkifyIt({ fuzzyLink: true })\n   *\n   * linkify\n   *   .tlds(require('tlds'))       // Reload with full TLD list\n   *   .tlds('onion', true)         // Add unofficial `.onion` domain\n   *   .add('ftp:', null)           // Disable `ftp:` protocol\n   *   .set({ fuzzyIP: true })      // Enable IPs in fuzzy links\n   *\n   * console.log(linkify.test('Site github.com!')) // true\n   * console.log(linkify.match('Site github.com!'))\n   * ```\n   */\n  constructor (options: LinkifyConstructorOptions = {}) {\n    const { rebuilder, ...linkifyOptions } = options\n\n    this.__opts__ = { ...defaultOptions, ...linkifyOptions }\n\n    this.__schemas__ = { ...defaultSchemas }\n\n    this.re = rebuilder || new REBuilder()\n    this.re.set({\n      ...this.__opts__,\n      schema_names: Object.keys(this.__schemas__)\n    })\n  }\n\n  /**\n   * Add new rule definition.\n   *\n   * `schema` is a link prefix (usually, protocol name with `:` at the end,\n   * `skype:` for example). `linkify-it` makes sure that prefix is not\n   * preceded with alphanumeric char and symbols. Only whitespaces and\n   * punctuation allowed.\n   *\n   * `definition` is a rule to check tail after link prefix. To disable an\n   * existing rule, pass `null`.\n   *\n   * @param schema Rule name (fixed pattern prefix).\n   * @param definition Schema definition, or `null` to disable the rule.\n   *\n   * See [twitter mentions example](https://github.com/markdown-it/linkify-it/blob/master/examples/twitter.mjs).\n   */\n  add (schema: string, definition: SchemaOpts | null = null): this {\n    if (!definition) {\n      delete this.__schemas__[schema]\n    } else {\n      const def = {\n        normalize: (match: Match, self: LinkifyIt) => self.normalize(match),\n        ...definition\n      }\n      this.__schemas__[schema] = def\n    }\n\n    this.re.set({\n      ...this.__opts__,\n      schema_names: Object.keys(this.__schemas__)\n    })\n    return this\n  }\n\n  /**\n   * Set recognition options for links without schema.\n   *\n   * @param options Recognition options.\n   */\n  set (options: LinkifyOptions = {}): this {\n    this.__opts__ = { ...this.__opts__, ...options }\n    this.re.set({\n      ...this.__opts__,\n      schema_names: Object.keys(this.__schemas__)\n    })\n    return this\n  }\n\n  /**\n   * Searches linkifiable pattern and returns `true` on success or `false` on fail.\n   *\n   * @param text Text to scan.\n   */\n  test (text: string): boolean {\n    if (!text.length) { return false }\n\n    let m, re\n\n    // try to scan for link with schema - that's the most simple rule\n    re = this.re.get_schema_search()\n    re.lastIndex = 0\n    while ((m = re.exec(text)) !== null) {\n      if (this.testSchemaAt(text, m[2], re.lastIndex)) { return true }\n    }\n\n    if (this.__opts__.fuzzyLink && this.__schemas__['http:']) {\n      // guess schemaless links\n      re = this.re.get_fuzzy_link_search()\n      re.lastIndex = 0\n      if (re.exec(text) !== null) { return true }\n    }\n\n    if (this.__opts__.fuzzyEmail && this.__schemas__['mailto:']) {\n      // guess schemaless emails\n      if (text.indexOf('@') >= 0) {\n        // We can't skip this check, because this cases are possible:\n        // 192.168.1.1@gmail.com, my.in@example.com\n        const mailHostRe = this.re.get_fuzzy_mail_host_search()\n        const mailNameRe = this.re.get_mail_name_validator()\n        mailHostRe.lastIndex = 0\n\n        while ((m = mailHostRe.exec(text)) !== null) {\n          const name = text.slice(Math.max(0, m.index - 65), m.index)\n          if (mailNameRe.test(name)) { return true }\n        }\n      }\n    }\n\n    return false\n  }\n\n  /**\n   * Similar to {@link LinkifyIt.test} but checks only specific protocol tail exactly\n   * at given position. Returns length of found pattern (0 on fail).\n   *\n   * @param text Text to scan.\n   * @param schema Rule (schema) name.\n   * @param pos Text offset to check from.\n   */\n  testSchemaAt (text: string, schema: string, pos: number): number {\n    // If not supported schema check requested - terminate\n    if (!this.__schemas__[schema.toLowerCase()]) { return 0 }\n\n    return this.__schemas__[schema.toLowerCase()].validate(\n      text.slice(0, pos + this.__opts__.maxLength),\n      pos,\n      this\n    )\n  }\n\n  /**\n   * Returns array of found link descriptions or `null` on fail. We strongly\n   * recommend to use {@link LinkifyIt.test} first, for best speed.\n   *\n   * @param text Text to scan.\n   */\n  match (text: string): Match[] | null {\n    const result: Match[] = []\n    const schemaRe = this.re.get_schema_search()\n    let fuzzyLinkRe: RegExp | undefined\n    let mailHostRe: RegExp | undefined\n    let mailNameRe: RegExp | undefined\n    let fuzzyLinkCandidate: MatchCandidate | undefined\n    let fuzzyEmailCandidate: MatchCandidate | undefined\n    let schemaPrefix: MatchCandidate | undefined\n    let schemaDone = false\n    let fuzzyLinkDone = false\n    let fuzzyEmailDone = false\n    let pos = 0\n\n    if (!text.length) { return null }\n\n    schemaRe.lastIndex = 0\n\n    if (this.__opts__.fuzzyLink && this.__schemas__['http:']) {\n      fuzzyLinkRe = this.re.get_fuzzy_link_search()\n      fuzzyLinkRe.lastIndex = 0\n    }\n\n    if (this.__opts__.fuzzyEmail && this.__schemas__['mailto:']) {\n      mailHostRe = this.re.get_fuzzy_mail_host_search()\n      mailHostRe.lastIndex = 0\n      mailNameRe = this.re.get_mail_name_validator()\n    }\n\n    for (;;) {\n      const scanFrom = Math.max(pos - 1, 0)\n\n      if (mailHostRe && mailNameRe && !fuzzyEmailDone && (!fuzzyEmailCandidate || fuzzyEmailCandidate.index < pos)) {\n        if (mailHostRe.lastIndex < scanFrom) { mailHostRe.lastIndex = scanFrom }\n\n        for (;;) {\n          const m = mailHostRe.exec(text)\n          if (!m) {\n            fuzzyEmailDone = true\n            fuzzyEmailCandidate = undefined\n            break\n          }\n\n          const name = mailNameRe.exec(text.slice(Math.max(0, m.index - 65), m.index))\n          if (!name) { continue }\n\n          fuzzyEmailCandidate = {\n            schema: 'mailto:',\n            index: m.index - name[1].length,\n            lastIndex: m.index + m[0].length\n          }\n\n          if (fuzzyEmailCandidate.index >= pos) { break }\n          if (mailHostRe.lastIndex < scanFrom) { mailHostRe.lastIndex = scanFrom }\n        }\n      }\n\n      if (fuzzyLinkRe && !fuzzyLinkDone && (!fuzzyLinkCandidate || fuzzyLinkCandidate.index < pos)) {\n        if (fuzzyLinkRe.lastIndex < scanFrom) { fuzzyLinkRe.lastIndex = scanFrom }\n\n        for (;;) {\n          const m = fuzzyLinkRe.exec(text)\n          if (!m) {\n            fuzzyLinkDone = true\n            fuzzyLinkCandidate = undefined\n            break\n          }\n\n          fuzzyLinkCandidate = {\n            schema: '',\n            index: m.index + m[1].length,\n            lastIndex: m.index + m[0].length\n          }\n\n          if (fuzzyLinkCandidate.index >= pos) { break }\n          if (fuzzyLinkRe.lastIndex < scanFrom) { fuzzyLinkRe.lastIndex = scanFrom }\n        }\n      }\n\n      let fuzzyCandidate = fuzzyEmailCandidate\n      if (!fuzzyCandidate ||\n        (fuzzyLinkCandidate &&\n          (fuzzyLinkCandidate.index < fuzzyCandidate.index ||\n            (fuzzyLinkCandidate.index === fuzzyCandidate.index && fuzzyLinkCandidate.lastIndex > fuzzyCandidate.lastIndex)))) {\n        fuzzyCandidate = fuzzyLinkCandidate\n      }\n\n      let schemaCandidate: MatchCandidate | undefined\n\n      if (!schemaDone) {\n        for (;;) {\n          if (!schemaPrefix) {\n            if (schemaRe.lastIndex < scanFrom) { schemaRe.lastIndex = scanFrom }\n\n            const m = schemaRe.exec(text)\n            if (!m) {\n              schemaDone = true\n              break\n            }\n\n            schemaPrefix = {\n              schema: m[2],\n              index: m.index + m[1].length,\n              lastIndex: m.index + m[0].length\n            }\n          }\n\n          if (schemaPrefix.index < pos) {\n            schemaPrefix = undefined\n            continue\n          }\n\n          if (fuzzyCandidate && schemaPrefix.index > fuzzyCandidate.index) { break }\n\n          const prefix = schemaPrefix\n          schemaPrefix = undefined\n\n          const len = this.testSchemaAt(text, prefix.schema, prefix.lastIndex)\n          if (len) {\n            schemaCandidate = {\n              schema: prefix.schema,\n              index: prefix.index,\n              lastIndex: prefix.lastIndex + len\n            }\n            break\n          }\n        }\n      }\n\n      let candidate = schemaCandidate\n      if (!candidate ||\n        (fuzzyEmailCandidate &&\n          (fuzzyEmailCandidate.index < candidate.index ||\n            (fuzzyEmailCandidate.index === candidate.index && fuzzyEmailCandidate.lastIndex > candidate.lastIndex)))) {\n        candidate = fuzzyEmailCandidate\n      }\n      if (!candidate ||\n        (fuzzyLinkCandidate &&\n          (fuzzyLinkCandidate.index < candidate.index ||\n            (fuzzyLinkCandidate.index === candidate.index && fuzzyLinkCandidate.lastIndex > candidate.lastIndex)))) {\n        candidate = fuzzyLinkCandidate\n      }\n\n      if (!candidate) { break }\n\n      if (candidate === fuzzyEmailCandidate) {\n        fuzzyEmailCandidate = undefined\n      } else if (candidate === fuzzyLinkCandidate) {\n        fuzzyLinkCandidate = undefined\n      }\n\n      const match = new Match(text, candidate.schema, candidate.index, candidate.lastIndex)\n      if (match.schema) {\n        this.__schemas__[match.schema].normalize(match, this)\n      } else {\n        this.normalize(match)\n      }\n      result.push(match)\n      pos = candidate.lastIndex\n    }\n\n    if (result.length) {\n      return result\n    }\n\n    return null\n  }\n\n  /**\n   * Returns fully-formed (not fuzzy) link if it starts at the beginning\n   * of the string, and null otherwise.\n   *\n   * @param text Text to scan.\n   */\n  matchAtStart (text: string): Match | null {\n    if (!text.length) return null\n\n    const m = this.re.get_schema_at_start().exec(text)\n    if (!m) return null\n\n    const len = this.testSchemaAt(text, m[2], m[0].length)\n    if (!len) return null\n\n    const match = new Match(text, m[2], m.index + m[1].length, m.index + m[0].length + len)\n\n    this.__schemas__[match.schema].normalize(match, this)\n    return match\n  }\n\n  /**\n   * Load (or merge) new TLDs list. Those are used for fuzzy links (without\n   * prefix) to avoid false positives. By default this algorithm is used:\n   *\n   * - hostname with any 2-letter root zones are ok.\n   * - biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф\n   *   are ok.\n   * - encoded (`xn--...`) root zones are ok.\n   *\n   * If list is replaced, then exact match for 2-chars root zones will be checked.\n   *\n   * @param list List of TLDs.\n   * @param keepOld Merge with current list if `true` (`false` by default).\n   */\n  tlds (list: string | string[], keepOld = false): this {\n    list = Array.isArray(list) ? list : [list]\n\n    if (!keepOld) {\n      this.__opts__.tlds = list\n    } else {\n      this.__opts__.tlds = this.__opts__.tlds.concat(list)\n    }\n\n    this.re.set({\n      ...this.__opts__,\n      schema_names: Object.keys(this.__schemas__)\n    })\n    return this\n  }\n\n  /**\n   * Default normalizer (if schema does not define its own).\n   *\n   * @param match Match to normalize.\n   */\n  normalize (match: Match): void {\n    // Do minimal possible changes by default. Need to collect feedback prior\n    // to move forward https://github.com/markdown-it/linkify-it/issues/1\n\n    if (!match.schema) { match.url = `http://${match.url}` }\n\n    if (match.schema === 'mailto:' && !/^mailto:/i.test(match.url)) {\n      match.url = `mailto:${match.url}`\n    }\n  }\n}\n\nfunction linkifyit (options: LinkifyConstructorOptions = {}): LinkifyIt {\n  return new LinkifyIt(options)\n}\n\nexport { linkifyit }\n"],"mappings":";;AAgBA,IAAa,YAAb,MAAuB;CACrB,UAAU,IAAI;CACd,SAAS,GAAG;CACZ,QAAQ,EAAE;CACV,QAAQ,EAAE;CAEV,WAAW;EAAC,KAAK;EAAO,KAAK;EAAO,KAAK;CAAM,CAAC,CAAC,KAAK,GAAG;CAEzD,UAAU,CAAC,KAAK,OAAO,KAAK,MAAM,CAAC,CAAC,KAAK,GAAG;CAC5C,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