{"version":3,"file":"auto-links.mjs","sources":["../../../src/slate/plugins/auto-links.ts"],"sourcesContent":["import type { NodeEntry } from \"slate\";\nimport { Editor, Element, Node, Path, Range, Text, Transforms } from \"slate\";\n\nimport type { ComposerBodyAutoLink } from \"../../types\";\n\n/**\n * This implementation is inspired by Lexical's AutoLink plugin.\n * Additional modifications and features were added to adapt it to our specific needs.\n *\n * Original Lexical AutoLink plugin can be found at [Lexical's Github Repository](https://github.com/facebook/lexical/blob/main/packages/lexical-react/src/LexicalAutoLinkPlugin.ts)\n */\nexport function withAutoLinks(editor: Editor): Editor {\n  const { isInline, normalizeNode, deleteBackward } = editor;\n\n  editor.isInline = (element) => {\n    return element.type === \"auto-link\" ? true : isInline(element);\n  };\n\n  editor.normalizeNode = (entry) => {\n    const [node, path] = entry;\n\n    if (Text.isText(node)) {\n      const parentNode = Node.parent(editor, path);\n\n      if (isComposerBodyAutoLink(parentNode)) {\n        const parentPath = Path.parent(path);\n        handleLinkEdit(editor, [parentNode, parentPath]);\n      } else {\n        handleLinkCreate(editor, [node, path]);\n        handleNeighbours(editor, [node, path]);\n      }\n    }\n\n    normalizeNode(entry);\n  };\n\n  editor.deleteBackward = (unit) => {\n    deleteBackward(unit);\n    const { selection } = editor;\n    if (!selection) return;\n\n    if (!Range.isCollapsed(selection)) return;\n\n    const [match] = Editor.nodes(editor, {\n      at: selection,\n      match: isComposerBodyAutoLink,\n      mode: \"lowest\",\n    });\n\n    if (!match) return;\n\n    Transforms.unwrapNodes(editor, {\n      match: isComposerBodyAutoLink,\n    });\n  };\n\n  return editor;\n}\n\nexport function isComposerBodyAutoLink(\n  node: Node\n): node is ComposerBodyAutoLink {\n  return Element.isElement(node) && node.type === \"auto-link\";\n}\n\n/**\n * 1. ((https?:\\/\\/(www\\.)?)|(www\\.))\n * - Matches 'http://' or 'https://' optionally followed by 'www.', or just 'www.'\n *\n * 2. [-a-zA-Z0-9@:%._+~#=]{1,256}\n * - Matches any character in the set [-a-zA-Z0-9@:%._+~#=] between 1 and 256 times, often found in the domain and subdomain part of the URL\n *\n * 3. \\.[a-zA-Z0-9()]{1,6}\n * - Matches a period followed by any character in the set [a-zA-Z0-9()] between 1 and 6 times, usually indicating the domain extension like .com, .org, etc.\n *\n * 4. \\b\n * - Represents a word boundary, ensuring that the characters following cannot be part of a different word\n *\n * 5. ([-a-zA-Z0-9().@:%_+~#?&//=]*)\n * - Matches any character in the set [-a-zA-Z0-9().@:%_+~#?&//=] between 0 and unlimited times, often found in the path, query parameters, or anchor part of the URL\n *\n * Matching URLs:\n * - http://www.example.com\n * - https://www.example.com\n * - www.example.com\n * - https://example.com/path?query=param#anchor\n *\n * Non-Matching URLs:\n * - http:/example.com (malformed scheme)\n * - example (missing scheme and domain extension)\n * - ftp://example.com (ftp scheme is not supported)\n * - example.com (missing scheme)\n */\nconst URL_REGEX =\n  /((https?:\\/\\/(www\\.)?)|(www\\.))[-a-zA-Z0-9@:%._+~#=]{1,256}\\.[a-zA-Z0-9()]{1,6}\\b([-a-zA-Z0-9().@:%_+~#?&//=]*)/;\n\nconst PUNCTUATION_OR_SPACE = /[.,;!?\\s]/;\n\nconst PERIOD_OR_QUESTION_MARK_FOLLOWED_BY_ALPHANUMERIC = /^[.?][a-zA-Z0-9]+/;\n\n/**\n * Helper function to check if a character is a separator (punctuation or space)\n * @param char The character to check\n * @returns Whether the character is a separator or not\n */\nfunction isSeparator(char: string): boolean {\n  return PUNCTUATION_OR_SPACE.test(char);\n}\n\n/**\n * Helper function to check if a text content ends with a separator (punctuation or space)\n * @param textContent The text content to check\n * @returns Whether the text content ends with a separator or not\n */\nfunction endsWithSeparator(textContent: string): boolean {\n  return isSeparator(textContent[textContent.length - 1]);\n}\n\n/**\n * Helper function to check if a text content starts with a separator (punctuation or space)\n * @param textContent The text content to check\n * @returns Whether the text content starts with a separator or not\n */\nfunction startsWithSeparator(textContent: string): boolean {\n  return isSeparator(textContent[0]);\n}\n\n/**\n * Helper function to check if a text content ends with a period or question mark\n * @param textContent The text content to check\n * @returns Whether the text content ends with a period or not\n */\nfunction endsWithPeriodOrQuestionMark(textContent: string): boolean {\n  return (\n    textContent[textContent.length - 1] === \".\" ||\n    textContent[textContent.length - 1] === \"?\"\n  );\n}\n\n/**\n * Helper function to check if the previous node is valid (text node that ends with a separator or is empty)\n */\nfunction isPreviousNodeValid(editor: Editor, path: Path): boolean {\n  const entry = Editor.previous(editor, { at: path });\n  if (!entry) return true;\n\n  return (\n    Text.isText(entry[0]) &&\n    (endsWithSeparator(entry[0].text) || entry[0].text === \"\")\n  );\n}\n\n/**\n * Helper function to check if the next node is valid (text node that starts with a separator or is empty)\n */\nfunction isNextNodeValid(editor: Editor, path: Path): boolean {\n  const entry = Editor.next(editor, { at: path });\n  if (!entry) return true;\n\n  return (\n    Text.isText(entry[0]) &&\n    (startsWithSeparator(entry[0].text) || entry[0].text === \"\")\n  );\n}\n\n/**\n * Helper function to check if the content around a text node is valid.\n * @param editor\n * @param entry\n * @param start\n * @param end\n * @returns\n */\nfunction isContentAroundValid(\n  editor: Editor,\n  entry: NodeEntry<Text>,\n  start: number,\n  end: number\n): boolean {\n  const [node, path] = entry;\n  const text = node.text;\n\n  const contentBeforeIsValid =\n    start > 0\n      ? isSeparator(text[start - 1])\n      : isPreviousNodeValid(editor, path);\n\n  const contentAfterIsValid =\n    end < text.length ? isSeparator(text[end]) : isNextNodeValid(editor, path);\n\n  return contentBeforeIsValid && contentAfterIsValid;\n}\n\nconst handleLinkEdit = (\n  editor: Editor,\n  entry: NodeEntry<ComposerBodyAutoLink>\n) => {\n  const [node, path] = entry;\n\n  // Step 1: Ensure that the Link node only contains text nodes as children\n  const children = Node.children(editor, path);\n  for (const [child] of children) {\n    if (Text.isText(child)) continue;\n    Transforms.unwrapNodes(editor, { at: path });\n    return;\n  }\n  // Attempt to match the text content (of the Link node) against the URL regex\n  const text = Node.string(node);\n  const match = URL_REGEX.exec(text);\n\n  // Step 2: Ensure that the text content of the Link node matches the URL regex and is identical to the match\n  if (!match || match[0] !== text) {\n    Transforms.unwrapNodes(editor, { at: path });\n    return;\n  }\n\n  // Step 3: Ensure that if the text content of the Link node ends with a period, we unwrap the Link node and wrap the text before the period in a new Link node\n  if (endsWithPeriodOrQuestionMark(text)) {\n    Transforms.unwrapNodes(editor, { at: path });\n\n    const textBeforePeriod = text.slice(0, text.length - 1);\n\n    // Remove the last character from the link text and wrap the remaining text in a new link node\n    Transforms.wrapNodes<ComposerBodyAutoLink>(\n      editor,\n      {\n        type: \"auto-link\",\n        url: textBeforePeriod,\n        children: [],\n      },\n      {\n        at: {\n          anchor: { path, offset: 0 },\n          focus: { path, offset: textBeforePeriod.length },\n        },\n        split: true,\n      }\n    );\n    return;\n  }\n\n  // Step 4: Ensure that the text content of the Link node is surrounded by separators or the start/end of the text content\n  if (!isPreviousNodeValid(editor, path) || !isNextNodeValid(editor, path)) {\n    Transforms.unwrapNodes(editor, { at: path });\n    return;\n  }\n\n  // Step 5: Ensure that the url attribute of the Link node is identical to its text content\n  if (node.url !== text) {\n    Transforms.setNodes(editor, { url: match[0] }, { at: path });\n    return;\n  }\n};\n\nconst handleLinkCreate = (editor: Editor, entry: NodeEntry<Text>) => {\n  const [node, path] = entry;\n\n  // Step 1: Ensure that the text content of the node matches the URL regex\n  const match = URL_REGEX.exec(node.text);\n  if (!match) return;\n\n  const start = match.index;\n  const end = start + match[0].length;\n\n  // Step 2: Ensure that the content around the node is valid\n  if (!isContentAroundValid(editor, entry, start, end)) return;\n\n  Transforms.wrapNodes<ComposerBodyAutoLink>(\n    editor,\n    {\n      type: \"auto-link\",\n      url: match[0],\n      children: [],\n    },\n    {\n      at: {\n        anchor: { path, offset: start },\n        focus: { path, offset: end },\n      },\n      split: true,\n    }\n  );\n  return;\n};\n\nconst handleNeighbours = (editor: Editor, entry: NodeEntry<Text>) => {\n  const [node, path] = entry;\n  const text = node.text;\n\n  const previousSibling = Editor.previous(editor, { at: path });\n\n  if (previousSibling && isComposerBodyAutoLink(previousSibling[0])) {\n    if (PERIOD_OR_QUESTION_MARK_FOLLOWED_BY_ALPHANUMERIC.test(text)) {\n      Transforms.unwrapNodes(editor, { at: previousSibling[1] });\n      Transforms.mergeNodes(editor, { at: path });\n      return;\n    }\n\n    if (!startsWithSeparator(text)) {\n      Transforms.unwrapNodes(editor, { at: previousSibling[1] });\n      return;\n    }\n  }\n\n  const nextSibling = Editor.next(editor, { at: path });\n  if (\n    nextSibling &&\n    isComposerBodyAutoLink(nextSibling[0]) &&\n    !endsWithSeparator(text)\n  ) {\n    Transforms.unwrapNodes(editor, { at: nextSibling[1] });\n    return;\n  }\n};\n"],"names":[],"mappings":";;AAWO,SAAS,cAAc,MAAwB,EAAA;AACpD,EAAA,MAAM,EAAE,QAAA,EAAU,aAAe,EAAA,cAAA,EAAmB,GAAA,MAAA,CAAA;AAEpD,EAAO,MAAA,CAAA,QAAA,GAAW,CAAC,OAAY,KAAA;AAC7B,IAAA,OAAO,OAAQ,CAAA,IAAA,KAAS,WAAc,GAAA,IAAA,GAAO,SAAS,OAAO,CAAA,CAAA;AAAA,GAC/D,CAAA;AAEA,EAAO,MAAA,CAAA,aAAA,GAAgB,CAAC,KAAU,KAAA;AAChC,IAAM,MAAA,CAAC,IAAM,EAAA,IAAI,CAAI,GAAA,KAAA,CAAA;AAErB,IAAI,IAAA,IAAA,CAAK,MAAO,CAAA,IAAI,CAAG,EAAA;AACrB,MAAA,MAAM,UAAa,GAAA,IAAA,CAAK,MAAO,CAAA,MAAA,EAAQ,IAAI,CAAA,CAAA;AAE3C,MAAI,IAAA,sBAAA,CAAuB,UAAU,CAAG,EAAA;AACtC,QAAM,MAAA,UAAA,GAAa,IAAK,CAAA,MAAA,CAAO,IAAI,CAAA,CAAA;AACnC,QAAA,cAAA,CAAe,MAAQ,EAAA,CAAC,UAAY,EAAA,UAAU,CAAC,CAAA,CAAA;AAAA,OAC1C,MAAA;AACL,QAAA,gBAAA,CAAiB,MAAQ,EAAA,CAAC,IAAM,EAAA,IAAI,CAAC,CAAA,CAAA;AACr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