@dialpad/dialtone-vue 3.223.0-next.1 → 3.223.0-next.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (116) hide show
  1. package/dist/MarkdownRenderer-D5XWsyQk.cjs.map +1 -1
  2. package/dist/{MarkdownRenderer-C3MZDB2I.js → MarkdownRenderer-NSSny0ID.js} +2 -2
  3. package/dist/{MarkdownRenderer-C3MZDB2I.js.map → MarkdownRenderer-NSSny0ID.js.map} +1 -1
  4. package/dist/{RichTextEditor-BX-5tCOx.cjs → RichTextEditor-B9NGgB03.cjs} +2 -2
  5. package/dist/{RichTextEditor-BX-5tCOx.cjs.map → RichTextEditor-B9NGgB03.cjs.map} +1 -1
  6. package/dist/{RichTextEditor-D8Kas5A3.js → RichTextEditor-DxbZSRop.js} +4 -4
  7. package/dist/{RichTextEditor-D8Kas5A3.js.map → RichTextEditor-DxbZSRop.js.map} +1 -1
  8. package/dist/component-documentation.json +1 -1
  9. package/dist/components/Banner/Banner.vue.d.ts +36 -1
  10. package/dist/components/Banner/Banner.vue.d.ts.map +1 -1
  11. package/dist/components/Checkbox/Checkbox.vue.d.ts +36 -1
  12. package/dist/components/Checkbox/Checkbox.vue.d.ts.map +1 -1
  13. package/dist/components/CheckboxGroup/CheckboxGroup.vue.d.ts +36 -1
  14. package/dist/components/ComboboxWithPopover/ComboboxWithPopover.vue.d.ts +9 -0
  15. package/dist/components/ComboboxWithPopover/ComboboxWithPopover.vue.d.ts.map +1 -1
  16. package/dist/components/Dropdown/Dropdown.vue.d.ts +9 -0
  17. package/dist/components/Dropdown/Dropdown.vue.d.ts.map +1 -1
  18. package/dist/components/EmojiPicker/EmojiPicker.vue.d.ts +36 -1
  19. package/dist/components/EmojiPicker/Modules/EmojiSearch.vue.d.ts +36 -1
  20. package/dist/components/EmojiPicker/Modules/EmojiSearch.vue.d.ts.map +1 -1
  21. package/dist/components/FilterPill/FilterPill.vue.d.ts +90 -2
  22. package/dist/components/FilterPill/FilterPill.vue.d.ts.map +1 -1
  23. package/dist/components/Hovercard/Hovercard.vue.d.ts +20 -0
  24. package/dist/components/Hovercard/Hovercard.vue.d.ts.map +1 -1
  25. package/dist/components/Input/Input.vue.d.ts +36 -1
  26. package/dist/components/Input/Input.vue.d.ts.map +1 -1
  27. package/dist/components/InputGroup/InputGroup.vue.d.ts +36 -1
  28. package/dist/components/InputGroup/InputGroup.vue.d.ts.map +1 -1
  29. package/dist/components/KeyboardShortcut/KeyboardShortcut.vue.d.ts +36 -1
  30. package/dist/components/Modal/Modal.vue.d.ts +36 -1
  31. package/dist/components/Modal/Modal.vue.d.ts.map +1 -1
  32. package/dist/components/Notice/Notice.vue.d.ts +36 -1
  33. package/dist/components/Notice/Notice.vue.d.ts.map +1 -1
  34. package/dist/components/Notice/NoticeContent.vue.d.ts +36 -1
  35. package/dist/components/Notice/NoticeContent.vue.d.ts.map +1 -1
  36. package/dist/components/Popover/Popover.vue.d.ts +9 -0
  37. package/dist/components/Popover/Popover.vue.d.ts.map +1 -1
  38. package/dist/components/Radio/Radio.vue.d.ts +36 -1
  39. package/dist/components/Radio/Radio.vue.d.ts.map +1 -1
  40. package/dist/components/RadioGroup/RadioGroup.vue.d.ts +36 -1
  41. package/dist/components/RichTextEditor/Extensions/Mentions/MentionSuggestion.vue.d.ts +36 -1
  42. package/dist/components/RichTextEditor/Extensions/SlashCommand/SlashCommandSuggestion.vue.d.ts +36 -1
  43. package/dist/components/RichTextEditor/Extensions/Variable/VariableComponent.vue.d.ts +45 -1
  44. package/dist/components/RichTextEditor/Extensions/Variable/VariableComponent.vue.d.ts.map +1 -1
  45. package/dist/components/SelectMenu/SelectMenu.vue.d.ts +36 -1
  46. package/dist/components/SelectMenu/SelectMenu.vue.d.ts.map +1 -1
  47. package/dist/components/SplitButton/SplitButton.vue.d.ts +9 -0
  48. package/dist/components/SplitButton/SplitButton.vue.d.ts.map +1 -1
  49. package/dist/components/Text/Text.vue.d.ts +36 -1
  50. package/dist/components/Text/Text.vue.d.ts.map +1 -1
  51. package/dist/components/Text/TextConstants.d.ts +53 -0
  52. package/dist/components/Text/TextConstants.d.ts.map +1 -1
  53. package/dist/components/Text/index.d.ts +1 -1
  54. package/dist/components/Toast/Layouts/ToastLayoutAlternate.vue.d.ts +36 -1
  55. package/dist/components/Toast/Layouts/ToastLayoutAlternate.vue.d.ts.map +1 -1
  56. package/dist/components/Toast/Layouts/ToastLayoutDefault.vue.d.ts +36 -1
  57. package/dist/components/Toast/Layouts/ToastLayoutDefault.vue.d.ts.map +1 -1
  58. package/dist/components/Toast/Toast.vue.d.ts +144 -4
  59. package/dist/components/Toast/Toast.vue.d.ts.map +1 -1
  60. package/dist/dialtone-vue.cjs +1 -1
  61. package/dist/dialtone-vue.js +142 -142
  62. package/dist/lib/editor/editor.cjs +1 -1
  63. package/dist/lib/editor/editor.js +1 -1
  64. package/dist/lib/hovercard/hovercard.cjs +1 -1
  65. package/dist/lib/hovercard/hovercard.cjs.map +1 -1
  66. package/dist/lib/hovercard/hovercard.js +2 -0
  67. package/dist/lib/hovercard/hovercard.js.map +1 -1
  68. package/dist/lib/message-input/index.cjs +1 -1
  69. package/dist/lib/message-input/index.js +1 -1
  70. package/dist/lib/message-input/message-input.cjs +1 -1
  71. package/dist/lib/message-input/message-input.js +1 -1
  72. package/dist/lib/popover/popover.cjs +1 -1
  73. package/dist/lib/popover/popover.cjs.map +1 -1
  74. package/dist/lib/popover/popover.js +7 -3
  75. package/dist/lib/popover/popover.js.map +1 -1
  76. package/dist/lib/rich-text-editor/index.cjs +1 -1
  77. package/dist/lib/rich-text-editor/index.js +1 -1
  78. package/dist/lib/rich-text-editor/markdown-renderer.js +1 -1
  79. package/dist/lib/rich-text-editor/rich-text-editor.cjs +1 -1
  80. package/dist/lib/rich-text-editor/rich-text-editor.js +1 -1
  81. package/dist/lib/text/index.cjs +1 -1
  82. package/dist/lib/text/index.js +3 -3
  83. package/dist/lib/text/text-constants.cjs +1 -1
  84. package/dist/lib/text/text-constants.cjs.map +1 -1
  85. package/dist/lib/text/text-constants.js +70 -21
  86. package/dist/lib/text/text-constants.js.map +1 -1
  87. package/dist/lib/text/text.cjs +1 -1
  88. package/dist/lib/text/text.cjs.map +1 -1
  89. package/dist/lib/text/text.js +72 -37
  90. package/dist/lib/text/text.js.map +1 -1
  91. package/dist/{message_input-dBQwgyjI.cjs → message_input-DMyIOe4y.cjs} +2 -2
  92. package/dist/{message_input-dBQwgyjI.cjs.map → message_input-DMyIOe4y.cjs.map} +1 -1
  93. package/dist/{message_input-CbQCd07F.js → message_input-DOE5NEU9.js} +2 -2
  94. package/dist/{message_input-CbQCd07F.js.map → message_input-DOE5NEU9.js.map} +1 -1
  95. package/dist/node_modules/@tiptap/vue-3.cjs.map +1 -1
  96. package/dist/node_modules/@tiptap/vue-3.js +1 -1
  97. package/dist/node_modules/@tiptap/vue-3.js.map +1 -1
  98. package/dist/recipes/buttons/callbar_button_with_dropdown/callbar_button_with_dropdown.vue.d.ts +9 -0
  99. package/dist/recipes/buttons/callbar_button_with_dropdown/callbar_button_with_dropdown.vue.d.ts.map +1 -1
  100. package/dist/recipes/buttons/callbar_button_with_popover/callbar_button_with_popover.vue.d.ts +9 -0
  101. package/dist/recipes/buttons/callbar_button_with_popover/callbar_button_with_popover.vue.d.ts.map +1 -1
  102. package/dist/recipes/cards/ivr_node/ivr_node.vue.d.ts +9 -0
  103. package/dist/recipes/cards/ivr_node/ivr_node.vue.d.ts.map +1 -1
  104. package/dist/recipes/conversation_view/editor/EditorToolbarDropdownButton.vue.d.ts +9 -0
  105. package/dist/recipes/conversation_view/editor/EditorToolbarDropdownButton.vue.d.ts.map +1 -1
  106. package/dist/recipes/conversation_view/editor/EditorToolbarPopoverButton.vue.d.ts +9 -0
  107. package/dist/recipes/conversation_view/editor/EditorToolbarPopoverButton.vue.d.ts.map +1 -1
  108. package/dist/recipes/conversation_view/editor/editor.vue.d.ts +63 -1
  109. package/dist/recipes/conversation_view/editor/editor.vue.d.ts.map +1 -1
  110. package/dist/recipes/conversation_view/message_input/message_input.vue.d.ts +198 -5
  111. package/dist/recipes/conversation_view/message_input/message_input.vue.d.ts.map +1 -1
  112. package/dist/recipes/conversation_view/message_input/message_input_button.vue.d.ts +36 -1
  113. package/dist/recipes/conversation_view/message_input/message_input_link.vue.d.ts +81 -2
  114. package/dist/recipes/conversation_view/message_input/message_input_link.vue.d.ts.map +1 -1
  115. package/dist/recipes/conversation_view/message_input/message_input_topbar.vue.d.ts +36 -1
  116. package/package.json +4 -4
@@ -1 +1 @@
1
- {"version":3,"file":"MarkdownRenderer-D5XWsyQk.cjs","names":["Node"],"sources":["../../../node_modules/.pnpm/@tiptap+static-renderer@3.19.0_@tiptap+core@3.19.0_@tiptap+pm@3.19.0__@tiptap+pm@3.19.0_react_4n7lapq7bmfej5hsrzhdkukr6e/node_modules/@tiptap/static-renderer/dist/pm/markdown/index.js","../components/RichTextEditor/MarkdownRenderer.js"],"sourcesContent":["// src/pm/extensionRenderer.ts\nimport {\n getAttributesFromExtensions,\n getExtensionField,\n getSchemaByResolvedExtensions,\n resolveExtensions,\n splitExtensions\n} from \"@tiptap/core\";\nimport { Node } from \"@tiptap/pm/model\";\n\n// src/helpers.ts\nimport { mergeAttributes } from \"@tiptap/core\";\nfunction getAttributes(nodeOrMark, extensionAttributes, onlyRenderedAttributes) {\n const nodeOrMarkAttributes = nodeOrMark.attrs;\n if (!nodeOrMarkAttributes) {\n return {};\n }\n return extensionAttributes.filter((item) => {\n if (item.type !== (typeof nodeOrMark.type === \"string\" ? nodeOrMark.type : nodeOrMark.type.name)) {\n return false;\n }\n if (onlyRenderedAttributes) {\n return item.attribute.rendered;\n }\n return true;\n }).map((item) => {\n if (!item.attribute.renderHTML) {\n return {\n [item.name]: item.name in nodeOrMarkAttributes ? nodeOrMarkAttributes[item.name] : item.attribute.default\n };\n }\n return item.attribute.renderHTML(nodeOrMarkAttributes) || {\n [item.name]: item.name in nodeOrMarkAttributes ? nodeOrMarkAttributes[item.name] : item.attribute.default\n };\n }).reduce((attributes, attribute) => mergeAttributes(attributes, attribute), {});\n}\nfunction getHTMLAttributes(nodeOrMark, extensionAttributes) {\n return getAttributes(nodeOrMark, extensionAttributes, true);\n}\n\n// src/pm/extensionRenderer.ts\nfunction mapNodeExtensionToReactNode(domOutputSpecToElement, extension, extensionAttributes, options) {\n const context = {\n name: extension.name,\n options: extension.options,\n storage: extension.storage,\n parent: extension.parent\n };\n const renderToHTML = getExtensionField(extension, \"renderHTML\", context);\n if (!renderToHTML) {\n if (options == null ? void 0 : options.unhandledNode) {\n return [extension.name, options.unhandledNode];\n }\n return [\n extension.name,\n () => {\n throw new Error(\n `[tiptap error]: Node ${extension.name} cannot be rendered, it is missing a \"renderToHTML\" method, please implement it or override the corresponding \"nodeMapping\" method to have a custom rendering`\n );\n }\n ];\n }\n return [\n extension.name,\n ({ node, children }) => {\n try {\n return domOutputSpecToElement(\n renderToHTML({\n node,\n HTMLAttributes: getHTMLAttributes(node, extensionAttributes)\n })\n )(children);\n } catch (e) {\n throw new Error(\n `[tiptap error]: Node ${extension.name} cannot be rendered, it's \"renderToHTML\" method threw an error: ${e.message}`,\n { cause: e }\n );\n }\n }\n ];\n}\nfunction mapMarkExtensionToReactNode(domOutputSpecToElement, extension, extensionAttributes, options) {\n const context = {\n name: extension.name,\n options: extension.options,\n storage: extension.storage,\n parent: extension.parent\n };\n const renderToHTML = getExtensionField(extension, \"renderHTML\", context);\n if (!renderToHTML) {\n if (options == null ? void 0 : options.unhandledMark) {\n return [extension.name, options.unhandledMark];\n }\n return [\n extension.name,\n () => {\n throw new Error(`Node ${extension.name} cannot be rendered, it is missing a \"renderToHTML\" method`);\n }\n ];\n }\n return [\n extension.name,\n ({ mark, children }) => {\n try {\n return domOutputSpecToElement(\n renderToHTML({\n mark,\n HTMLAttributes: getHTMLAttributes(mark, extensionAttributes)\n })\n )(children);\n } catch (e) {\n throw new Error(\n `[tiptap error]: Mark ${extension.name} cannot be rendered, it's \"renderToHTML\" method threw an error: ${e.message}`,\n { cause: e }\n );\n }\n }\n ];\n}\nfunction renderToElement({\n renderer,\n domOutputSpecToElement,\n mapDefinedTypes,\n content,\n extensions,\n options\n}) {\n extensions = resolveExtensions(extensions);\n const extensionAttributes = getAttributesFromExtensions(extensions);\n const { nodeExtensions, markExtensions } = splitExtensions(extensions);\n if (!(content instanceof Node)) {\n content = Node.fromJSON(getSchemaByResolvedExtensions(extensions), content);\n }\n return renderer({\n ...options,\n nodeMapping: {\n ...Object.fromEntries(\n nodeExtensions.filter((e) => {\n if (e.name in mapDefinedTypes) {\n return false;\n }\n if (options == null ? void 0 : options.nodeMapping) {\n return !(e.name in options.nodeMapping);\n }\n return true;\n }).map(\n (nodeExtension) => mapNodeExtensionToReactNode(domOutputSpecToElement, nodeExtension, extensionAttributes, options)\n )\n ),\n ...mapDefinedTypes,\n ...options == null ? void 0 : options.nodeMapping\n },\n markMapping: {\n ...Object.fromEntries(\n markExtensions.filter((e) => {\n if (options == null ? void 0 : options.markMapping) {\n return !(e.name in options.markMapping);\n }\n return true;\n }).map((mark) => mapMarkExtensionToReactNode(domOutputSpecToElement, mark, extensionAttributes, options))\n ),\n ...options == null ? void 0 : options.markMapping\n }\n })({ content });\n}\n\n// src/json/renderer.ts\nfunction TiptapStaticRenderer(renderComponent, {\n nodeMapping,\n markMapping,\n unhandledNode,\n unhandledMark\n}) {\n return function renderContent({\n content,\n parent\n }) {\n var _a;\n const nodeType = typeof content.type === \"string\" ? content.type : content.type.name;\n const NodeHandler = (_a = nodeMapping[nodeType]) != null ? _a : unhandledNode;\n if (!NodeHandler) {\n throw new Error(`missing handler for node type ${nodeType}`);\n }\n const nodeContent = renderComponent({\n component: NodeHandler,\n props: {\n node: content,\n parent,\n renderElement: renderContent,\n // Lazily compute the children to avoid unnecessary recursion\n get children() {\n const children = [];\n if (content.content) {\n content.content.forEach((child) => {\n children.push(\n renderContent({\n content: child,\n parent: content\n })\n );\n });\n }\n return children;\n }\n }\n });\n const markedContent = content.marks ? content.marks.reduce((acc, mark) => {\n var _a2;\n const markType = typeof mark.type === \"string\" ? mark.type : mark.type.name;\n const MarkHandler = (_a2 = markMapping[markType]) != null ? _a2 : unhandledMark;\n if (!MarkHandler) {\n throw new Error(`missing handler for mark type ${markType}`);\n }\n return renderComponent({\n component: MarkHandler,\n props: {\n mark,\n parent,\n node: content,\n children: acc\n }\n });\n }, nodeContent) : nodeContent;\n return markedContent;\n };\n}\n\n// src/json/html-string/string.ts\nfunction renderJSONContentToString(options) {\n return TiptapStaticRenderer((ctx) => {\n return ctx.component(ctx.props);\n }, options);\n}\nfunction serializeAttrsToHTMLString(attrs) {\n const output = Object.entries(attrs || {}).map(([key, value]) => `${key.split(\" \").at(-1)}=${JSON.stringify(value)}`).join(\" \");\n return output ? ` ${output}` : \"\";\n}\nfunction serializeChildrenToHTMLString(children) {\n return [].concat(children || \"\").filter(Boolean).join(\"\");\n}\n\n// src/pm/html-string/html-string.ts\nvar NON_SELF_CLOSING_TAGS = /* @__PURE__ */ new Set([\"iframe\", \"script\", \"style\", \"title\", \"textarea\", \"div\", \"span\", \"a\", \"button\"]);\nfunction domOutputSpecToHTMLString(content) {\n if (typeof content === \"string\") {\n return () => content;\n }\n if (typeof content === \"object\" && \"length\" in content) {\n const [_tag, attrs, children, ...rest] = content;\n let tag = _tag;\n const parts = tag.split(\" \");\n if (parts.length > 1) {\n tag = `${parts[1]} xmlns=\"${parts[0]}\"`;\n }\n if (attrs === void 0) {\n return () => `<${tag}/>`;\n }\n if (attrs === 0) {\n return (child) => `<${tag}>${serializeChildrenToHTMLString(child)}</${tag}>`;\n }\n if (typeof attrs === \"object\") {\n if (Array.isArray(attrs)) {\n if (children === void 0) {\n return (child) => `<${tag}>${domOutputSpecToHTMLString(attrs)(child)}</${tag}>`;\n }\n if (children === 0) {\n return (child) => `<${tag}>${domOutputSpecToHTMLString(attrs)(child)}</${tag}>`;\n }\n return (child) => `<${tag}>${domOutputSpecToHTMLString(attrs)(child)}${[children].concat(rest).map((a) => domOutputSpecToHTMLString(a)(child))}</${tag}>`;\n }\n if (children === void 0) {\n if (NON_SELF_CLOSING_TAGS.has(tag)) {\n return () => `<${tag}${serializeAttrsToHTMLString(attrs)}></${tag}>`;\n }\n return () => `<${tag}${serializeAttrsToHTMLString(attrs)}/>`;\n }\n if (children === 0) {\n return (child) => `<${tag}${serializeAttrsToHTMLString(attrs)}>${serializeChildrenToHTMLString(child)}</${tag}>`;\n }\n return (child) => `<${tag}${serializeAttrsToHTMLString(attrs)}>${[children].concat(rest).map((a) => domOutputSpecToHTMLString(a)(child)).join(\"\")}</${tag}>`;\n }\n }\n throw new Error(\n \"[tiptap error]: Unsupported DomOutputSpec type, check the `renderHTML` method output or implement a node mapping\",\n {\n cause: content\n }\n );\n}\nfunction renderToHTMLString({\n content,\n extensions,\n options\n}) {\n return renderToElement({\n renderer: renderJSONContentToString,\n domOutputSpecToElement: domOutputSpecToHTMLString,\n mapDefinedTypes: {\n // Map a doc node to concatenated children\n doc: ({ children }) => serializeChildrenToHTMLString(children),\n // Map a text node to its text content\n text: ({ node }) => {\n var _a;\n return (_a = node.text) != null ? _a : \"\";\n }\n },\n content,\n extensions,\n options\n });\n}\n\n// src/pm/markdown/markdown.ts\nfunction renderToMarkdown({\n content,\n extensions,\n options\n}) {\n return renderToHTMLString({\n content,\n extensions,\n options: {\n ...options,\n nodeMapping: {\n bulletList({ children }) {\n return `\n${serializeChildrenToHTMLString(children)}`;\n },\n orderedList({ children }) {\n return `\n${serializeChildrenToHTMLString(children)}`;\n },\n listItem({ node, children, parent }) {\n if ((parent == null ? void 0 : parent.type.name) === \"bulletList\") {\n return `- ${serializeChildrenToHTMLString(children).trim()}\n`;\n }\n if ((parent == null ? void 0 : parent.type.name) === \"orderedList\") {\n let number = parent.attrs.start || 1;\n parent.forEach((parentChild, _offset, index) => {\n if (node === parentChild) {\n number = index + 1;\n }\n });\n return `${number}. ${serializeChildrenToHTMLString(children).trim()}\n`;\n }\n return serializeChildrenToHTMLString(children);\n },\n paragraph({ children }) {\n return `\n${serializeChildrenToHTMLString(children)}\n`;\n },\n heading({ node, children }) {\n const level = node.attrs.level;\n return `${new Array(level).fill(\"#\").join(\"\")} ${children}\n`;\n },\n codeBlock({ node, children }) {\n return `\n\\`\\`\\`${node.attrs.language}\n${serializeChildrenToHTMLString(children)}\n\\`\\`\\`\n`;\n },\n blockquote({ children }) {\n return `\n${serializeChildrenToHTMLString(children).trim().split(\"\\n\").map((a) => `> ${a}`).join(\"\\n\")}`;\n },\n image({ node }) {\n return `![${node.attrs.alt}](${node.attrs.src})`;\n },\n hardBreak() {\n return \"\\n\";\n },\n horizontalRule() {\n return \"\\n---\\n\";\n },\n table({ children, node }) {\n if (!Array.isArray(children)) {\n return `\n${serializeChildrenToHTMLString(children)}\n`;\n }\n const columnCount = node.children[0].childCount;\n return `\n${serializeChildrenToHTMLString(children[0])}| ${new Array(columnCount).fill(\"---\").join(\" | \")} |\n${serializeChildrenToHTMLString(children.slice(1))}\n`;\n },\n tableRow({ children }) {\n if (Array.isArray(children)) {\n return `| ${children.join(\" | \")} |\n`;\n }\n return `${serializeChildrenToHTMLString(children)}\n`;\n },\n tableHeader({ children }) {\n return serializeChildrenToHTMLString(children).trim();\n },\n tableCell({ children }) {\n return serializeChildrenToHTMLString(children).trim();\n },\n ...options == null ? void 0 : options.nodeMapping\n },\n markMapping: {\n bold({ children }) {\n return `**${serializeChildrenToHTMLString(children)}**`;\n },\n italic({ children, node }) {\n let isBoldToo = false;\n if (node == null ? void 0 : node.marks.some((m) => m.type.name === \"bold\")) {\n isBoldToo = true;\n }\n if (isBoldToo) {\n return `*${serializeChildrenToHTMLString(children)}*`;\n }\n return `_${serializeChildrenToHTMLString(children)}_`;\n },\n code({ children }) {\n return `\\`${serializeChildrenToHTMLString(children)}\\``;\n },\n strike({ children }) {\n return `~~${serializeChildrenToHTMLString(children)}~~`;\n },\n underline({ children }) {\n return `<u>${serializeChildrenToHTMLString(children)}</u>`;\n },\n subscript({ children }) {\n return `<sub>${serializeChildrenToHTMLString(children)}</sub>`;\n },\n superscript({ children }) {\n return `<sup>${serializeChildrenToHTMLString(children)}</sup>`;\n },\n link({ mark, children }) {\n return `[${serializeChildrenToHTMLString(children)}](${mark.attrs.href})`;\n },\n highlight({ children }) {\n return `==${serializeChildrenToHTMLString(children)}==`;\n },\n ...options == null ? void 0 : options.markMapping\n }\n }\n });\n}\nexport {\n mapMarkExtensionToReactNode,\n mapNodeExtensionToReactNode,\n renderToElement,\n renderToMarkdown\n};\n//# sourceMappingURL=index.js.map","import { renderToMarkdown } from '@tiptap/static-renderer/pm/markdown';\n\n// The pm/markdown renderer passes children as string[] (one entry per child node),\n// not as a pre-joined string. Normalize to a string before processing.\nconst joinChildren = (children) => Array.isArray(children) ? children.join('') : (children || '');\n\n// Move leading/trailing spaces outside mark delimiters so parsers like CommonMark\n// don't reject them (e.g. \"** bold **\" → \" **bold** \").\nconst wrapMark = (text, open, close) => {\n const trimmed = text.trim();\n if (!trimmed) return text;\n const leading = text.slice(0, text.length - text.trimStart().length);\n const trailing = text.slice(text.trimEnd().length);\n return `${leading}${open}${trimmed}${close}${trailing}`;\n};\n\n/**\n * Renders a TipTap/ProseMirror JSON document to a markdown string.\n *\n * Uses @tiptap/static-renderer with custom mappings to preserve the output\n * format of the legacy jsonToMarkdownConverter, including Dialtone-specific\n * node types (mention, channel, emoji, variable, slash-commands).\n *\n * @param {import('@tiptap/core').JSONContent} jsonContent - TipTap JSON document\n * @param {import('@tiptap/core').Extensions} extensions - Active editor extensions\n * @returns {string}\n */\nexport function renderEditorToMarkdown (jsonContent, extensions) {\n const output = renderToMarkdown({\n extensions,\n content: jsonContent,\n options: {\n nodeMapping: {\n // Override blockquote: built-in omits trailing newline (causes lazy continuation).\n // Since we replace the built-in entirely, we must add the '> ' prefix ourselves.\n blockquote ({ children }) {\n const text = joinChildren(children).trim();\n const quoted = text\n .split('\\n')\n .map(line => line ? `> ${line}` : '>')\n .join('\\n');\n return quoted + '\\n';\n },\n\n // Override codeBlock: built-in passes null language through literally\n codeBlock ({ node, children }) {\n const lang = node.attrs?.language || '';\n return `\\`\\`\\`${lang}\\n${joinChildren(children)}\\n\\`\\`\\`\\n`;\n },\n\n // Custom Dialtone node types\n mention ({ node }) {\n const id = node.attrs?.id || '';\n const contactKey = node.attrs?.contactKey || '';\n const name = node.attrs?.name || '';\n return `<!-- @mention: {\"id\": \"${id}\", \"contactKey\": \"${contactKey}\", \"name\": \"${name}\"} -->`;\n },\n\n channel ({ node }) {\n const id = node.attrs?.id || '';\n const channelKey = node.attrs?.channelKey || '';\n const name = node.attrs?.name || '';\n const locked = String(node.attrs?.locked ?? '');\n return `<!-- @channel: {\"id\": \"${id}\", \"channelKey\": \"${channelKey}\", \"name\": \"${name}\", \"locked\": \"${locked}\"} -->`;\n },\n\n 'slash-commands' ({ node }) {\n return `/${node.attrs?.command || ''}`;\n },\n\n emoji ({ node }) {\n return node.attrs?.code || '';\n },\n\n variable ({ node }) {\n const id = node.attrs?.id || '';\n const altText = node.attrs?.altText || '';\n return `{{${id}=${altText}}}`;\n },\n },\n\n markMapping: {\n bold ({ children }) {\n return wrapMark(joinChildren(children), '**', '**');\n },\n\n // Override italic: use * instead of built-in _ and fix boundary spaces\n italic ({ children }) {\n return wrapMark(joinChildren(children), '*', '*');\n },\n\n strike ({ children }) {\n return wrapMark(joinChildren(children), '~~', '~~');\n },\n\n code ({ children }) {\n return wrapMark(joinChildren(children), '`', '`');\n },\n\n link ({ mark, children }) {\n const text = joinChildren(children);\n const href = mark.attrs?.href || '';\n const trimmed = text.trim();\n const leading = text.slice(0, text.length - text.trimStart().length);\n const trailing = text.slice(text.trimEnd().length);\n return `${leading}[${trimmed}](${href})${trailing}`;\n },\n\n // Override underline: pass-through (no markdown equivalent, matches legacy no-op)\n underline ({ children }) {\n return joinChildren(children);\n },\n },\n },\n });\n // Collapse 3+ consecutive newlines to 2 (CommonMark ignores extra blank\n // lines between blocks), and strip the leading newline that the built-in\n // paragraph renderer always prepends to the first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vE,OAAO,EAAK,OAAO,QAAU,GAAG,CAC8D,SAG/G,iBAAkB,CAAE,QAAQ,CAC1B,MAAO,IAAI,EAAK,OAAO,SAAW,MAGpC,MAAO,CAAE,QAAQ,CACf,OAAO,EAAK,OAAO,MAAQ,IAG7B,SAAU,CAAE,QAAQ,CAGlB,MAAO,KAFI,EAAK,OAAO,IAAM,GAEd,GADC,EAAK,OAAO,SAAW,GACb,KAE7B,CAED,YAAa,CACX,KAAM,CAAE,YAAY,CAClB,OAAO,EAAS,EAAa,EAAS,CAAE,KAAM,KAAK,EAIrD,OAAQ,CAAE,YAAY,CACpB,OAAO,EAAS,EAAa,EAAS,CAAE,IAAK,IAAI,EAGnD,OAAQ,CAAE,YAAY,CACpB,OAAO,EAAS,EAAa,EAAS,CAAE,KAAM,KAAK,EAGrD,KAAM,CAAE,YAAY,CAClB,OAAO,EAAS,EAAa,EAAS,CAAE,IAAK,IAAI,EAGnD,KAAM,CAAE,OAAM,YAAY,CACxB,IAAM,EAAO,EAAa,EAAS,CAC7B,EAAO,EAAK,OAAO,MAAQ,GAC3B,EAAU,EAAK,MAAM,CAG3B,MAAO,GAFS,EAAK,MAAM,EAAG,EAAK,OAAS,EAAK,WAAW,CAAC,OAAO,CAElD,GAAG,EAAQ,IAAI,EAAK,GADrB,EAAK,MAAM,EAAK,SAAS,CAAC,OAAO,IAKpD,UAAW,CAAE,YAAY,CACvB,OAAO,EAAa,EAAS,EAEhC,CACF,CACF,CAAC,CAIY,QAAQ,UAAW;;EAAO,CAAC,QAAQ,aAAc,GAAG"}
1
+ {"version":3,"file":"MarkdownRenderer-D5XWsyQk.cjs","names":["Node"],"sources":["../../../node_modules/.pnpm/@tiptap+static-renderer@3.19.0_@tiptap+core@3.19.0_@tiptap+pm@3.19.0__@tiptap+pm@3.19.0_9606d4b01b88c88c850636a0b274a958/node_modules/@tiptap/static-renderer/dist/pm/markdown/index.js","../components/RichTextEditor/MarkdownRenderer.js"],"sourcesContent":["// src/pm/extensionRenderer.ts\nimport {\n getAttributesFromExtensions,\n getExtensionField,\n getSchemaByResolvedExtensions,\n resolveExtensions,\n splitExtensions\n} from \"@tiptap/core\";\nimport { Node } from \"@tiptap/pm/model\";\n\n// src/helpers.ts\nimport { mergeAttributes } from \"@tiptap/core\";\nfunction getAttributes(nodeOrMark, extensionAttributes, onlyRenderedAttributes) {\n const nodeOrMarkAttributes = nodeOrMark.attrs;\n if (!nodeOrMarkAttributes) {\n return {};\n }\n return extensionAttributes.filter((item) => {\n if (item.type !== (typeof nodeOrMark.type === \"string\" ? nodeOrMark.type : nodeOrMark.type.name)) {\n return false;\n }\n if (onlyRenderedAttributes) {\n return item.attribute.rendered;\n }\n return true;\n }).map((item) => {\n if (!item.attribute.renderHTML) {\n return {\n [item.name]: item.name in nodeOrMarkAttributes ? nodeOrMarkAttributes[item.name] : item.attribute.default\n };\n }\n return item.attribute.renderHTML(nodeOrMarkAttributes) || {\n [item.name]: item.name in nodeOrMarkAttributes ? nodeOrMarkAttributes[item.name] : item.attribute.default\n };\n }).reduce((attributes, attribute) => mergeAttributes(attributes, attribute), {});\n}\nfunction getHTMLAttributes(nodeOrMark, extensionAttributes) {\n return getAttributes(nodeOrMark, extensionAttributes, true);\n}\n\n// src/pm/extensionRenderer.ts\nfunction mapNodeExtensionToReactNode(domOutputSpecToElement, extension, extensionAttributes, options) {\n const context = {\n name: extension.name,\n options: extension.options,\n storage: extension.storage,\n parent: extension.parent\n };\n const renderToHTML = getExtensionField(extension, \"renderHTML\", context);\n if (!renderToHTML) {\n if (options == null ? void 0 : options.unhandledNode) {\n return [extension.name, options.unhandledNode];\n }\n return [\n extension.name,\n () => {\n throw new Error(\n `[tiptap error]: Node ${extension.name} cannot be rendered, it is missing a \"renderToHTML\" method, please implement it or override the corresponding \"nodeMapping\" method to have a custom rendering`\n );\n }\n ];\n }\n return [\n extension.name,\n ({ node, children }) => {\n try {\n return domOutputSpecToElement(\n renderToHTML({\n node,\n HTMLAttributes: getHTMLAttributes(node, extensionAttributes)\n })\n )(children);\n } catch (e) {\n throw new Error(\n `[tiptap error]: Node ${extension.name} cannot be rendered, it's \"renderToHTML\" method threw an error: ${e.message}`,\n { cause: e }\n );\n }\n }\n ];\n}\nfunction mapMarkExtensionToReactNode(domOutputSpecToElement, extension, extensionAttributes, options) {\n const context = {\n name: extension.name,\n options: extension.options,\n storage: extension.storage,\n parent: extension.parent\n };\n const renderToHTML = getExtensionField(extension, \"renderHTML\", context);\n if (!renderToHTML) {\n if (options == null ? void 0 : options.unhandledMark) {\n return [extension.name, options.unhandledMark];\n }\n return [\n extension.name,\n () => {\n throw new Error(`Node ${extension.name} cannot be rendered, it is missing a \"renderToHTML\" method`);\n }\n ];\n }\n return [\n extension.name,\n ({ mark, children }) => {\n try {\n return domOutputSpecToElement(\n renderToHTML({\n mark,\n HTMLAttributes: getHTMLAttributes(mark, extensionAttributes)\n })\n )(children);\n } catch (e) {\n throw new Error(\n `[tiptap error]: Mark ${extension.name} cannot be rendered, it's \"renderToHTML\" method threw an error: ${e.message}`,\n { cause: e }\n );\n }\n }\n ];\n}\nfunction renderToElement({\n renderer,\n domOutputSpecToElement,\n mapDefinedTypes,\n content,\n extensions,\n options\n}) {\n extensions = resolveExtensions(extensions);\n const extensionAttributes = getAttributesFromExtensions(extensions);\n const { nodeExtensions, markExtensions } = splitExtensions(extensions);\n if (!(content instanceof Node)) {\n content = Node.fromJSON(getSchemaByResolvedExtensions(extensions), content);\n }\n return renderer({\n ...options,\n nodeMapping: {\n ...Object.fromEntries(\n nodeExtensions.filter((e) => {\n if (e.name in mapDefinedTypes) {\n return false;\n }\n if (options == null ? void 0 : options.nodeMapping) {\n return !(e.name in options.nodeMapping);\n }\n return true;\n }).map(\n (nodeExtension) => mapNodeExtensionToReactNode(domOutputSpecToElement, nodeExtension, extensionAttributes, options)\n )\n ),\n ...mapDefinedTypes,\n ...options == null ? void 0 : options.nodeMapping\n },\n markMapping: {\n ...Object.fromEntries(\n markExtensions.filter((e) => {\n if (options == null ? void 0 : options.markMapping) {\n return !(e.name in options.markMapping);\n }\n return true;\n }).map((mark) => mapMarkExtensionToReactNode(domOutputSpecToElement, mark, extensionAttributes, options))\n ),\n ...options == null ? void 0 : options.markMapping\n }\n })({ content });\n}\n\n// src/json/renderer.ts\nfunction TiptapStaticRenderer(renderComponent, {\n nodeMapping,\n markMapping,\n unhandledNode,\n unhandledMark\n}) {\n return function renderContent({\n content,\n parent\n }) {\n var _a;\n const nodeType = typeof content.type === \"string\" ? content.type : content.type.name;\n const NodeHandler = (_a = nodeMapping[nodeType]) != null ? _a : unhandledNode;\n if (!NodeHandler) {\n throw new Error(`missing handler for node type ${nodeType}`);\n }\n const nodeContent = renderComponent({\n component: NodeHandler,\n props: {\n node: content,\n parent,\n renderElement: renderContent,\n // Lazily compute the children to avoid unnecessary recursion\n get children() {\n const children = [];\n if (content.content) {\n content.content.forEach((child) => {\n children.push(\n renderContent({\n content: child,\n parent: content\n })\n );\n });\n }\n return children;\n }\n }\n });\n const markedContent = content.marks ? content.marks.reduce((acc, mark) => {\n var _a2;\n const markType = typeof mark.type === \"string\" ? mark.type : mark.type.name;\n const MarkHandler = (_a2 = markMapping[markType]) != null ? _a2 : unhandledMark;\n if (!MarkHandler) {\n throw new Error(`missing handler for mark type ${markType}`);\n }\n return renderComponent({\n component: MarkHandler,\n props: {\n mark,\n parent,\n node: content,\n children: acc\n }\n });\n }, nodeContent) : nodeContent;\n return markedContent;\n };\n}\n\n// src/json/html-string/string.ts\nfunction renderJSONContentToString(options) {\n return TiptapStaticRenderer((ctx) => {\n return ctx.component(ctx.props);\n }, options);\n}\nfunction serializeAttrsToHTMLString(attrs) {\n const output = Object.entries(attrs || {}).map(([key, value]) => `${key.split(\" \").at(-1)}=${JSON.stringify(value)}`).join(\" \");\n return output ? ` ${output}` : \"\";\n}\nfunction serializeChildrenToHTMLString(children) {\n return [].concat(children || \"\").filter(Boolean).join(\"\");\n}\n\n// src/pm/html-string/html-string.ts\nvar NON_SELF_CLOSING_TAGS = /* @__PURE__ */ new Set([\"iframe\", \"script\", \"style\", \"title\", \"textarea\", \"div\", \"span\", \"a\", \"button\"]);\nfunction domOutputSpecToHTMLString(content) {\n if (typeof content === \"string\") {\n return () => content;\n }\n if (typeof content === \"object\" && \"length\" in content) {\n const [_tag, attrs, children, ...rest] = content;\n let tag = _tag;\n const parts = tag.split(\" \");\n if (parts.length > 1) {\n tag = `${parts[1]} xmlns=\"${parts[0]}\"`;\n }\n if (attrs === void 0) {\n return () => `<${tag}/>`;\n }\n if (attrs === 0) {\n return (child) => `<${tag}>${serializeChildrenToHTMLString(child)}</${tag}>`;\n }\n if (typeof attrs === \"object\") {\n if (Array.isArray(attrs)) {\n if (children === void 0) {\n return (child) => `<${tag}>${domOutputSpecToHTMLString(attrs)(child)}</${tag}>`;\n }\n if (children === 0) {\n return (child) => `<${tag}>${domOutputSpecToHTMLString(attrs)(child)}</${tag}>`;\n }\n return (child) => `<${tag}>${domOutputSpecToHTMLString(attrs)(child)}${[children].concat(rest).map((a) => domOutputSpecToHTMLString(a)(child))}</${tag}>`;\n }\n if (children === void 0) {\n if (NON_SELF_CLOSING_TAGS.has(tag)) {\n return () => `<${tag}${serializeAttrsToHTMLString(attrs)}></${tag}>`;\n }\n return () => `<${tag}${serializeAttrsToHTMLString(attrs)}/>`;\n }\n if (children === 0) {\n return (child) => `<${tag}${serializeAttrsToHTMLString(attrs)}>${serializeChildrenToHTMLString(child)}</${tag}>`;\n }\n return (child) => `<${tag}${serializeAttrsToHTMLString(attrs)}>${[children].concat(rest).map((a) => domOutputSpecToHTMLString(a)(child)).join(\"\")}</${tag}>`;\n }\n }\n throw new Error(\n \"[tiptap error]: Unsupported DomOutputSpec type, check the `renderHTML` method output or implement a node mapping\",\n {\n cause: content\n }\n );\n}\nfunction renderToHTMLString({\n content,\n extensions,\n options\n}) {\n return renderToElement({\n renderer: renderJSONContentToString,\n domOutputSpecToElement: domOutputSpecToHTMLString,\n mapDefinedTypes: {\n // Map a doc node to concatenated children\n doc: ({ children }) => serializeChildrenToHTMLString(children),\n // Map a text node to its text content\n text: ({ node }) => {\n var _a;\n return (_a = node.text) != null ? _a : \"\";\n }\n },\n content,\n extensions,\n options\n });\n}\n\n// src/pm/markdown/markdown.ts\nfunction renderToMarkdown({\n content,\n extensions,\n options\n}) {\n return renderToHTMLString({\n content,\n extensions,\n options: {\n ...options,\n nodeMapping: {\n bulletList({ children }) {\n return `\n${serializeChildrenToHTMLString(children)}`;\n },\n orderedList({ children }) {\n return `\n${serializeChildrenToHTMLString(children)}`;\n },\n listItem({ node, children, parent }) {\n if ((parent == null ? void 0 : parent.type.name) === \"bulletList\") {\n return `- ${serializeChildrenToHTMLString(children).trim()}\n`;\n }\n if ((parent == null ? void 0 : parent.type.name) === \"orderedList\") {\n let number = parent.attrs.start || 1;\n parent.forEach((parentChild, _offset, index) => {\n if (node === parentChild) {\n number = index + 1;\n }\n });\n return `${number}. ${serializeChildrenToHTMLString(children).trim()}\n`;\n }\n return serializeChildrenToHTMLString(children);\n },\n paragraph({ children }) {\n return `\n${serializeChildrenToHTMLString(children)}\n`;\n },\n heading({ node, children }) {\n const level = node.attrs.level;\n return `${new Array(level).fill(\"#\").join(\"\")} ${children}\n`;\n },\n codeBlock({ node, children }) {\n return `\n\\`\\`\\`${node.attrs.language}\n${serializeChildrenToHTMLString(children)}\n\\`\\`\\`\n`;\n },\n blockquote({ children }) {\n return `\n${serializeChildrenToHTMLString(children).trim().split(\"\\n\").map((a) => `> ${a}`).join(\"\\n\")}`;\n },\n image({ node }) {\n return `![${node.attrs.alt}](${node.attrs.src})`;\n },\n hardBreak() {\n return \"\\n\";\n },\n horizontalRule() {\n return \"\\n---\\n\";\n },\n table({ children, node }) {\n if (!Array.isArray(children)) {\n return `\n${serializeChildrenToHTMLString(children)}\n`;\n }\n const columnCount = node.children[0].childCount;\n return `\n${serializeChildrenToHTMLString(children[0])}| ${new Array(columnCount).fill(\"---\").join(\" | \")} |\n${serializeChildrenToHTMLString(children.slice(1))}\n`;\n },\n tableRow({ children }) {\n if (Array.isArray(children)) {\n return `| ${children.join(\" | \")} |\n`;\n }\n return `${serializeChildrenToHTMLString(children)}\n`;\n },\n tableHeader({ children }) {\n return serializeChildrenToHTMLString(children).trim();\n },\n tableCell({ children }) {\n return serializeChildrenToHTMLString(children).trim();\n },\n ...options == null ? void 0 : options.nodeMapping\n },\n markMapping: {\n bold({ children }) {\n return `**${serializeChildrenToHTMLString(children)}**`;\n },\n italic({ children, node }) {\n let isBoldToo = false;\n if (node == null ? void 0 : node.marks.some((m) => m.type.name === \"bold\")) {\n isBoldToo = true;\n }\n if (isBoldToo) {\n return `*${serializeChildrenToHTMLString(children)}*`;\n }\n return `_${serializeChildrenToHTMLString(children)}_`;\n },\n code({ children }) {\n return `\\`${serializeChildrenToHTMLString(children)}\\``;\n },\n strike({ children }) {\n return `~~${serializeChildrenToHTMLString(children)}~~`;\n },\n underline({ children }) {\n return `<u>${serializeChildrenToHTMLString(children)}</u>`;\n },\n subscript({ children }) {\n return `<sub>${serializeChildrenToHTMLString(children)}</sub>`;\n },\n superscript({ children }) {\n return `<sup>${serializeChildrenToHTMLString(children)}</sup>`;\n },\n link({ mark, children }) {\n return `[${serializeChildrenToHTMLString(children)}](${mark.attrs.href})`;\n },\n highlight({ children }) {\n return `==${serializeChildrenToHTMLString(children)}==`;\n },\n ...options == null ? void 0 : options.markMapping\n }\n }\n });\n}\nexport {\n mapMarkExtensionToReactNode,\n mapNodeExtensionToReactNode,\n renderToElement,\n renderToMarkdown\n};\n//# sourceMappingURL=index.js.map","import { renderToMarkdown } from '@tiptap/static-renderer/pm/markdown';\n\n// The pm/markdown renderer passes children as string[] (one entry per child node),\n// not as a pre-joined string. Normalize to a string before processing.\nconst joinChildren = (children) => Array.isArray(children) ? children.join('') : (children || '');\n\n// Move leading/trailing spaces outside mark delimiters so parsers like CommonMark\n// don't reject them (e.g. \"** bold **\" → \" **bold** \").\nconst wrapMark = (text, open, close) => {\n const trimmed = text.trim();\n if (!trimmed) return text;\n const leading = text.slice(0, text.length - text.trimStart().length);\n const trailing = text.slice(text.trimEnd().length);\n return `${leading}${open}${trimmed}${close}${trailing}`;\n};\n\n/**\n * Renders a TipTap/ProseMirror JSON document to a markdown string.\n *\n * Uses @tiptap/static-renderer with custom mappings to preserve the output\n * format of the legacy jsonToMarkdownConverter, including Dialtone-specific\n * node types (mention, channel, emoji, variable, slash-commands).\n *\n * @param {import('@tiptap/core').JSONContent} jsonContent - TipTap JSON document\n * @param {import('@tiptap/core').Extensions} extensions - Active editor extensions\n * @returns {string}\n */\nexport function renderEditorToMarkdown (jsonContent, extensions) {\n const output = renderToMarkdown({\n extensions,\n content: jsonContent,\n options: {\n nodeMapping: {\n // Override blockquote: built-in omits trailing newline (causes lazy continuation).\n // Since we replace the built-in entirely, we must add the '> ' prefix ourselves.\n blockquote ({ children }) {\n const text = joinChildren(children).trim();\n const quoted = text\n .split('\\n')\n .map(line => line ? `> ${line}` : '>')\n .join('\\n');\n return quoted + '\\n';\n },\n\n // Override codeBlock: built-in passes null language through literally\n codeBlock ({ node, children }) {\n const lang = node.attrs?.language || '';\n return `\\`\\`\\`${lang}\\n${joinChildren(children)}\\n\\`\\`\\`\\n`;\n },\n\n // Custom Dialtone node types\n mention ({ node }) {\n const id = node.attrs?.id || '';\n const contactKey = node.attrs?.contactKey || '';\n const name = node.attrs?.name || '';\n return `<!-- @mention: {\"id\": \"${id}\", \"contactKey\": \"${contactKey}\", \"name\": \"${name}\"} -->`;\n },\n\n channel ({ node }) {\n const id = node.attrs?.id || '';\n const channelKey = node.attrs?.channelKey || '';\n const name = node.attrs?.name || '';\n const locked = String(node.attrs?.locked ?? '');\n return `<!-- @channel: {\"id\": \"${id}\", \"channelKey\": \"${channelKey}\", \"name\": \"${name}\", \"locked\": \"${locked}\"} -->`;\n },\n\n 'slash-commands' ({ node }) {\n return `/${node.attrs?.command || ''}`;\n },\n\n emoji ({ node }) {\n return node.attrs?.code || '';\n },\n\n variable ({ node }) {\n const id = node.attrs?.id || '';\n const altText = node.attrs?.altText || '';\n return `{{${id}=${altText}}}`;\n },\n },\n\n markMapping: {\n bold ({ children }) {\n return wrapMark(joinChildren(children), '**', '**');\n },\n\n // Override italic: use * instead of built-in _ and fix boundary spaces\n italic ({ children }) {\n return wrapMark(joinChildren(children), '*', '*');\n },\n\n strike ({ children }) {\n return wrapMark(joinChildren(children), '~~', '~~');\n },\n\n code ({ children }) {\n return wrapMark(joinChildren(children), '`', '`');\n },\n\n link ({ mark, children }) {\n const text = joinChildren(children);\n const href = mark.attrs?.href || '';\n const trimmed = text.trim();\n const leading = text.slice(0, text.length - text.trimStart().length);\n const trailing = text.slice(text.trimEnd().length);\n return `${leading}[${trimmed}](${href})${trailing}`;\n },\n\n // Override underline: pass-through (no markdown equivalent, matches legacy no-op)\n underline ({ children }) {\n return joinChildren(children);\n },\n },\n },\n });\n // Collapse 3+ consecutive newlines to 2 (CommonMark ignores extra blank\n // lines between blocks), and strip the leading newline that the built-in\n // paragraph renderer always prepends to the first node.\n return output.replace(/\\n{3,}/g, '\\n\\n').replace(/^\\n+|\\n+$/g, '');\n}\n"],"x_google_ignoreList":[0],"mappings":"4FAYA,SAAS,EAAc,EAAY,EAAqB,EAAwB,CAC9E,IAAM,EAAuB,EAAW,MAIxC,OAHK,EAGE,EAAoB,OAAQ,GAC7B,EAAK,QAAU,OAAO,EAAW,MAAS,SAAW,EAAW,KAAO,EAAW,KAAK,MAGvF,EACK,EAAK,UAAU,SAEjB,GALE,GAMT,CAAC,IAAK,GACD,EAAK,UAAU,YAKb,EAAK,UAAU,WAAW,EAAqB,EAJ7C,EACJ,EAAK,MAAO,EAAK,QAAQ,EAAuB,EAAqB,EAAK,MAAQ,EAAK,UAAU,QACnG,CAKH,CAAC,QAAQ,EAAY,KAAA,EAAA,EAAA,iBAA8B,EAAY,EAAU,CAAE,EAAE,CAAC,CAnBvE,EAAE,CAqBb,SAAS,EAAkB,EAAY,EAAqB,CAC1D,OAAO,EAAc,EAAY,EAAqB,G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IAAM,EAAO,EAAa,EAAS,CAC7B,EAAO,EAAK,OAAO,MAAQ,GAC3B,EAAU,EAAK,MAAM,CAG3B,MAAO,GAFS,EAAK,MAAM,EAAG,EAAK,OAAS,EAAK,WAAW,CAAC,OAAO,CAElD,GAAG,EAAQ,IAAI,EAAK,GADrB,EAAK,MAAM,EAAK,SAAS,CAAC,OAAO,IAKpD,UAAW,CAAE,YAAY,CACvB,OAAO,EAAa,EAAS,EAEhC,CACF,CACF,CAAC,CAIY,QAAQ,UAAW;;EAAO,CAAC,QAAQ,aAAc,GAAG"}
@@ -1,6 +1,6 @@
1
1
  import { getAttributesFromExtensions as e, getExtensionField as t, getSchemaByResolvedExtensions as n, mergeAttributes as r, resolveExtensions as i, splitExtensions as a } from "@tiptap/core";
2
2
  import { Node as o } from "@tiptap/pm/model";
3
- //#region ../../node_modules/.pnpm/@tiptap+static-renderer@3.19.0_@tiptap+core@3.19.0_@tiptap+pm@3.19.0__@tiptap+pm@3.19.0_react_4n7lapq7bmfej5hsrzhdkukr6e/node_modules/@tiptap/static-renderer/dist/pm/markdown/index.js
3
+ //#region ../../node_modules/.pnpm/@tiptap+static-renderer@3.19.0_@tiptap+core@3.19.0_@tiptap+pm@3.19.0__@tiptap+pm@3.19.0_9606d4b01b88c88c850636a0b274a958/node_modules/@tiptap/static-renderer/dist/pm/markdown/index.js
4
4
  function s(e, t, n) {
5
5
  let i = e.attrs;
6
6
  return i ? t.filter((t) => t.type === (typeof e.type == "string" ? e.type : e.type.name) ? n ? t.attribute.rendered : !0 : !1).map((e) => e.attribute.renderHTML && e.attribute.renderHTML(i) || { [e.name]: e.name in i ? i[e.name] : e.attribute.default }).reduce((e, t) => r(e, t), {}) : {};
@@ -319,4 +319,4 @@ function S(e, t) {
319
319
  //#endregion
320
320
  export { S as t };
321
321
 
322
- //# sourceMappingURL=MarkdownRenderer-C3MZDB2I.js.map
322
+ //# sourceMappingURL=MarkdownRenderer-NSSny0ID.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"MarkdownRenderer-C3MZDB2I.js","names":["Node"],"sources":["../../../node_modules/.pnpm/@tiptap+static-renderer@3.19.0_@tiptap+core@3.19.0_@tiptap+pm@3.19.0__@tiptap+pm@3.19.0_react_4n7lapq7bmfej5hsrzhdkukr6e/node_modules/@tiptap/static-renderer/dist/pm/markdown/index.js","../components/RichTextEditor/MarkdownRenderer.js"],"sourcesContent":["// src/pm/extensionRenderer.ts\nimport {\n getAttributesFromExtensions,\n getExtensionField,\n getSchemaByResolvedExtensions,\n resolveExtensions,\n splitExtensions\n} from \"@tiptap/core\";\nimport { Node } from \"@tiptap/pm/model\";\n\n// src/helpers.ts\nimport { mergeAttributes } from \"@tiptap/core\";\nfunction getAttributes(nodeOrMark, extensionAttributes, onlyRenderedAttributes) {\n const nodeOrMarkAttributes = nodeOrMark.attrs;\n if (!nodeOrMarkAttributes) {\n return {};\n }\n return extensionAttributes.filter((item) => {\n if (item.type !== (typeof nodeOrMark.type === \"string\" ? nodeOrMark.type : nodeOrMark.type.name)) {\n return false;\n }\n if (onlyRenderedAttributes) {\n return item.attribute.rendered;\n }\n return true;\n }).map((item) => {\n if (!item.attribute.renderHTML) {\n return {\n [item.name]: item.name in nodeOrMarkAttributes ? nodeOrMarkAttributes[item.name] : item.attribute.default\n };\n }\n return item.attribute.renderHTML(nodeOrMarkAttributes) || {\n [item.name]: item.name in nodeOrMarkAttributes ? nodeOrMarkAttributes[item.name] : item.attribute.default\n };\n }).reduce((attributes, attribute) => mergeAttributes(attributes, attribute), {});\n}\nfunction getHTMLAttributes(nodeOrMark, extensionAttributes) {\n return getAttributes(nodeOrMark, extensionAttributes, true);\n}\n\n// src/pm/extensionRenderer.ts\nfunction mapNodeExtensionToReactNode(domOutputSpecToElement, extension, extensionAttributes, options) {\n const context = {\n name: extension.name,\n options: extension.options,\n storage: extension.storage,\n parent: extension.parent\n };\n const renderToHTML = getExtensionField(extension, \"renderHTML\", context);\n if (!renderToHTML) {\n if (options == null ? void 0 : options.unhandledNode) {\n return [extension.name, options.unhandledNode];\n }\n return [\n extension.name,\n () => {\n throw new Error(\n `[tiptap error]: Node ${extension.name} cannot be rendered, it is missing a \"renderToHTML\" method, please implement it or override the corresponding \"nodeMapping\" method to have a custom rendering`\n );\n }\n ];\n }\n return [\n extension.name,\n ({ node, children }) => {\n try {\n return domOutputSpecToElement(\n renderToHTML({\n node,\n HTMLAttributes: getHTMLAttributes(node, extensionAttributes)\n })\n )(children);\n } catch (e) {\n throw new Error(\n `[tiptap error]: Node ${extension.name} cannot be rendered, it's \"renderToHTML\" method threw an error: ${e.message}`,\n { cause: e }\n );\n }\n }\n ];\n}\nfunction mapMarkExtensionToReactNode(domOutputSpecToElement, extension, extensionAttributes, options) {\n const context = {\n name: extension.name,\n options: extension.options,\n storage: extension.storage,\n parent: extension.parent\n };\n const renderToHTML = getExtensionField(extension, \"renderHTML\", context);\n if (!renderToHTML) {\n if (options == null ? void 0 : options.unhandledMark) {\n return [extension.name, options.unhandledMark];\n }\n return [\n extension.name,\n () => {\n throw new Error(`Node ${extension.name} cannot be rendered, it is missing a \"renderToHTML\" method`);\n }\n ];\n }\n return [\n extension.name,\n ({ mark, children }) => {\n try {\n return domOutputSpecToElement(\n renderToHTML({\n mark,\n HTMLAttributes: getHTMLAttributes(mark, extensionAttributes)\n })\n )(children);\n } catch (e) {\n throw new Error(\n `[tiptap error]: Mark ${extension.name} cannot be rendered, it's \"renderToHTML\" method threw an error: ${e.message}`,\n { cause: e }\n );\n }\n }\n ];\n}\nfunction renderToElement({\n renderer,\n domOutputSpecToElement,\n mapDefinedTypes,\n content,\n extensions,\n options\n}) {\n extensions = resolveExtensions(extensions);\n const extensionAttributes = getAttributesFromExtensions(extensions);\n const { nodeExtensions, markExtensions } = splitExtensions(extensions);\n if (!(content instanceof Node)) {\n content = Node.fromJSON(getSchemaByResolvedExtensions(extensions), content);\n }\n return renderer({\n ...options,\n nodeMapping: {\n ...Object.fromEntries(\n nodeExtensions.filter((e) => {\n if (e.name in mapDefinedTypes) {\n return false;\n }\n if (options == null ? void 0 : options.nodeMapping) {\n return !(e.name in options.nodeMapping);\n }\n return true;\n }).map(\n (nodeExtension) => mapNodeExtensionToReactNode(domOutputSpecToElement, nodeExtension, extensionAttributes, options)\n )\n ),\n ...mapDefinedTypes,\n ...options == null ? void 0 : options.nodeMapping\n },\n markMapping: {\n ...Object.fromEntries(\n markExtensions.filter((e) => {\n if (options == null ? void 0 : options.markMapping) {\n return !(e.name in options.markMapping);\n }\n return true;\n }).map((mark) => mapMarkExtensionToReactNode(domOutputSpecToElement, mark, extensionAttributes, options))\n ),\n ...options == null ? void 0 : options.markMapping\n }\n })({ content });\n}\n\n// src/json/renderer.ts\nfunction TiptapStaticRenderer(renderComponent, {\n nodeMapping,\n markMapping,\n unhandledNode,\n unhandledMark\n}) {\n return function renderContent({\n content,\n parent\n }) {\n var _a;\n const nodeType = typeof content.type === \"string\" ? content.type : content.type.name;\n const NodeHandler = (_a = nodeMapping[nodeType]) != null ? _a : unhandledNode;\n if (!NodeHandler) {\n throw new Error(`missing handler for node type ${nodeType}`);\n }\n const nodeContent = renderComponent({\n component: NodeHandler,\n props: {\n node: content,\n parent,\n renderElement: renderContent,\n // Lazily compute the children to avoid unnecessary recursion\n get children() {\n const children = [];\n if (content.content) {\n content.content.forEach((child) => {\n children.push(\n renderContent({\n content: child,\n parent: content\n })\n );\n });\n }\n return children;\n }\n }\n });\n const markedContent = content.marks ? content.marks.reduce((acc, mark) => {\n var _a2;\n const markType = typeof mark.type === \"string\" ? mark.type : mark.type.name;\n const MarkHandler = (_a2 = markMapping[markType]) != null ? _a2 : unhandledMark;\n if (!MarkHandler) {\n throw new Error(`missing handler for mark type ${markType}`);\n }\n return renderComponent({\n component: MarkHandler,\n props: {\n mark,\n parent,\n node: content,\n children: acc\n }\n });\n }, nodeContent) : nodeContent;\n return markedContent;\n };\n}\n\n// src/json/html-string/string.ts\nfunction renderJSONContentToString(options) {\n return TiptapStaticRenderer((ctx) => {\n return ctx.component(ctx.props);\n }, options);\n}\nfunction serializeAttrsToHTMLString(attrs) {\n const output = Object.entries(attrs || {}).map(([key, value]) => `${key.split(\" \").at(-1)}=${JSON.stringify(value)}`).join(\" \");\n return output ? ` ${output}` : \"\";\n}\nfunction serializeChildrenToHTMLString(children) {\n return [].concat(children || \"\").filter(Boolean).join(\"\");\n}\n\n// src/pm/html-string/html-string.ts\nvar NON_SELF_CLOSING_TAGS = /* @__PURE__ */ new Set([\"iframe\", \"script\", \"style\", \"title\", \"textarea\", \"div\", \"span\", \"a\", \"button\"]);\nfunction domOutputSpecToHTMLString(content) {\n if (typeof content === \"string\") {\n return () => content;\n }\n if (typeof content === \"object\" && \"length\" in content) {\n const [_tag, attrs, children, ...rest] = content;\n let tag = _tag;\n const parts = tag.split(\" \");\n if (parts.length > 1) {\n tag = `${parts[1]} xmlns=\"${parts[0]}\"`;\n }\n if (attrs === void 0) {\n return () => `<${tag}/>`;\n }\n if (attrs === 0) {\n return (child) => `<${tag}>${serializeChildrenToHTMLString(child)}</${tag}>`;\n }\n if (typeof attrs === \"object\") {\n if (Array.isArray(attrs)) {\n if (children === void 0) {\n return (child) => `<${tag}>${domOutputSpecToHTMLString(attrs)(child)}</${tag}>`;\n }\n if (children === 0) {\n return (child) => `<${tag}>${domOutputSpecToHTMLString(attrs)(child)}</${tag}>`;\n }\n return (child) => `<${tag}>${domOutputSpecToHTMLString(attrs)(child)}${[children].concat(rest).map((a) => domOutputSpecToHTMLString(a)(child))}</${tag}>`;\n }\n if (children === void 0) {\n if (NON_SELF_CLOSING_TAGS.has(tag)) {\n return () => `<${tag}${serializeAttrsToHTMLString(attrs)}></${tag}>`;\n }\n return () => `<${tag}${serializeAttrsToHTMLString(attrs)}/>`;\n }\n if (children === 0) {\n return (child) => `<${tag}${serializeAttrsToHTMLString(attrs)}>${serializeChildrenToHTMLString(child)}</${tag}>`;\n }\n return (child) => `<${tag}${serializeAttrsToHTMLString(attrs)}>${[children].concat(rest).map((a) => domOutputSpecToHTMLString(a)(child)).join(\"\")}</${tag}>`;\n }\n }\n throw new Error(\n \"[tiptap error]: Unsupported DomOutputSpec type, check the `renderHTML` method output or implement a node mapping\",\n {\n cause: content\n }\n );\n}\nfunction renderToHTMLString({\n content,\n extensions,\n options\n}) {\n return renderToElement({\n renderer: renderJSONContentToString,\n domOutputSpecToElement: domOutputSpecToHTMLString,\n mapDefinedTypes: {\n // Map a doc node to concatenated children\n doc: ({ children }) => serializeChildrenToHTMLString(children),\n // Map a text node to its text content\n text: ({ node }) => {\n var _a;\n return (_a = node.text) != null ? _a : \"\";\n }\n },\n content,\n extensions,\n options\n });\n}\n\n// src/pm/markdown/markdown.ts\nfunction renderToMarkdown({\n content,\n extensions,\n options\n}) {\n return renderToHTMLString({\n content,\n extensions,\n options: {\n ...options,\n nodeMapping: {\n bulletList({ children }) {\n return `\n${serializeChildrenToHTMLString(children)}`;\n },\n orderedList({ children }) {\n return `\n${serializeChildrenToHTMLString(children)}`;\n },\n listItem({ node, children, parent }) {\n if ((parent == null ? void 0 : parent.type.name) === \"bulletList\") {\n return `- ${serializeChildrenToHTMLString(children).trim()}\n`;\n }\n if ((parent == null ? void 0 : parent.type.name) === \"orderedList\") {\n let number = parent.attrs.start || 1;\n parent.forEach((parentChild, _offset, index) => {\n if (node === parentChild) {\n number = index + 1;\n }\n });\n return `${number}. ${serializeChildrenToHTMLString(children).trim()}\n`;\n }\n return serializeChildrenToHTMLString(children);\n },\n paragraph({ children }) {\n return `\n${serializeChildrenToHTMLString(children)}\n`;\n },\n heading({ node, children }) {\n const level = node.attrs.level;\n return `${new Array(level).fill(\"#\").join(\"\")} ${children}\n`;\n },\n codeBlock({ node, children }) {\n return `\n\\`\\`\\`${node.attrs.language}\n${serializeChildrenToHTMLString(children)}\n\\`\\`\\`\n`;\n },\n blockquote({ children }) {\n return `\n${serializeChildrenToHTMLString(children).trim().split(\"\\n\").map((a) => `> ${a}`).join(\"\\n\")}`;\n },\n image({ node }) {\n return `![${node.attrs.alt}](${node.attrs.src})`;\n },\n hardBreak() {\n return \"\\n\";\n },\n horizontalRule() {\n return \"\\n---\\n\";\n },\n table({ children, node }) {\n if (!Array.isArray(children)) {\n return `\n${serializeChildrenToHTMLString(children)}\n`;\n }\n const columnCount = node.children[0].childCount;\n return `\n${serializeChildrenToHTMLString(children[0])}| ${new Array(columnCount).fill(\"---\").join(\" | \")} |\n${serializeChildrenToHTMLString(children.slice(1))}\n`;\n },\n tableRow({ children }) {\n if (Array.isArray(children)) {\n return `| ${children.join(\" | \")} |\n`;\n }\n return `${serializeChildrenToHTMLString(children)}\n`;\n },\n tableHeader({ children }) {\n return serializeChildrenToHTMLString(children).trim();\n },\n tableCell({ children }) {\n return serializeChildrenToHTMLString(children).trim();\n },\n ...options == null ? void 0 : options.nodeMapping\n },\n markMapping: {\n bold({ children }) {\n return `**${serializeChildrenToHTMLString(children)}**`;\n },\n italic({ children, node }) {\n let isBoldToo = false;\n if (node == null ? void 0 : node.marks.some((m) => m.type.name === \"bold\")) {\n isBoldToo = true;\n }\n if (isBoldToo) {\n return `*${serializeChildrenToHTMLString(children)}*`;\n }\n return `_${serializeChildrenToHTMLString(children)}_`;\n },\n code({ children }) {\n return `\\`${serializeChildrenToHTMLString(children)}\\``;\n },\n strike({ children }) {\n return `~~${serializeChildrenToHTMLString(children)}~~`;\n },\n underline({ children }) {\n return `<u>${serializeChildrenToHTMLString(children)}</u>`;\n },\n subscript({ children }) {\n return `<sub>${serializeChildrenToHTMLString(children)}</sub>`;\n },\n superscript({ children }) {\n return `<sup>${serializeChildrenToHTMLString(children)}</sup>`;\n },\n link({ mark, children }) {\n return `[${serializeChildrenToHTMLString(children)}](${mark.attrs.href})`;\n },\n highlight({ children }) {\n return `==${serializeChildrenToHTMLString(children)}==`;\n },\n ...options == null ? void 0 : options.markMapping\n }\n }\n });\n}\nexport {\n mapMarkExtensionToReactNode,\n mapNodeExtensionToReactNode,\n renderToElement,\n renderToMarkdown\n};\n//# sourceMappingURL=index.js.map","import { renderToMarkdown } from '@tiptap/static-renderer/pm/markdown';\n\n// The pm/markdown renderer passes children as string[] (one entry per child node),\n// not as a pre-joined string. Normalize to a string before processing.\nconst joinChildren = (children) => Array.isArray(children) ? children.join('') : (children || '');\n\n// Move leading/trailing spaces outside mark delimiters so parsers like CommonMark\n// don't reject them (e.g. \"** bold **\" → \" **bold** \").\nconst wrapMark = (text, open, close) => {\n const trimmed = text.trim();\n if (!trimmed) return text;\n const leading = text.slice(0, text.length - text.trimStart().length);\n const trailing = text.slice(text.trimEnd().length);\n return `${leading}${open}${trimmed}${close}${trailing}`;\n};\n\n/**\n * Renders a TipTap/ProseMirror JSON document to a markdown string.\n *\n * Uses @tiptap/static-renderer with custom mappings to preserve the output\n * format of the legacy jsonToMarkdownConverter, including Dialtone-specific\n * node types (mention, channel, emoji, variable, slash-commands).\n *\n * @param {import('@tiptap/core').JSONContent} jsonContent - TipTap JSON document\n * @param {import('@tiptap/core').Extensions} extensions - Active editor extensions\n * @returns {string}\n */\nexport function renderEditorToMarkdown (jsonContent, extensions) {\n const output = renderToMarkdown({\n extensions,\n content: jsonContent,\n options: {\n nodeMapping: {\n // Override blockquote: built-in omits trailing newline (causes lazy continuation).\n // Since we replace the built-in entirely, we must add the '> ' prefix ourselves.\n blockquote ({ children }) {\n const text = joinChildren(children).trim();\n const quoted = text\n .split('\\n')\n .map(line => line ? `> ${line}` : '>')\n .join('\\n');\n return quoted + '\\n';\n },\n\n // Override codeBlock: built-in passes null language through literally\n codeBlock ({ node, children }) {\n const lang = node.attrs?.language || '';\n return `\\`\\`\\`${lang}\\n${joinChildren(children)}\\n\\`\\`\\`\\n`;\n },\n\n // Custom Dialtone node types\n mention ({ node }) {\n const id = node.attrs?.id || '';\n const contactKey = node.attrs?.contactKey || '';\n const name = node.attrs?.name || '';\n return `<!-- @mention: {\"id\": \"${id}\", \"contactKey\": \"${contactKey}\", \"name\": \"${name}\"} -->`;\n },\n\n channel ({ node }) {\n const id = node.attrs?.id || '';\n const channelKey = node.attrs?.channelKey || '';\n const name = node.attrs?.name || '';\n const locked = String(node.attrs?.locked ?? '');\n return `<!-- @channel: {\"id\": \"${id}\", \"channelKey\": \"${channelKey}\", \"name\": \"${name}\", \"locked\": \"${locked}\"} -->`;\n },\n\n 'slash-commands' ({ node }) {\n return `/${node.attrs?.command || ''}`;\n },\n\n emoji ({ node }) {\n return node.attrs?.code || '';\n },\n\n variable ({ node }) {\n const id = node.attrs?.id || '';\n const altText = node.attrs?.altText || '';\n return `{{${id}=${altText}}}`;\n },\n },\n\n markMapping: {\n bold ({ children }) {\n return wrapMark(joinChildren(children), '**', '**');\n },\n\n // Override italic: use * instead of built-in _ and fix boundary spaces\n italic ({ children }) {\n return wrapMark(joinChildren(children), '*', '*');\n },\n\n strike ({ children }) {\n return wrapMark(joinChildren(children), '~~', '~~');\n },\n\n code ({ children }) {\n return wrapMark(joinChildren(children), '`', '`');\n },\n\n link ({ mark, children }) {\n const text = joinChildren(children);\n const href = mark.attrs?.href || '';\n const trimmed = text.trim();\n const leading = text.slice(0, text.length - text.trimStart().length);\n const trailing = text.slice(text.trimEnd().length);\n return `${leading}[${trimmed}](${href})${trailing}`;\n },\n\n // Override underline: pass-through (no markdown equivalent, matches legacy no-op)\n underline ({ children }) {\n return joinChildren(children);\n },\n },\n },\n });\n // Collapse 3+ consecutive newlines to 2 (CommonMark ignores extra blank\n // lines between blocks), and strip the leading newline that the built-in\n // paragraph renderer always prepends to the first node.\n return output.replace(/\\n{3,}/g, '\\n\\n').replace(/^\\n+|\\n+$/g, '');\n}\n"],"x_google_ignoreList":[0],"mappings":";;;AAYA,SAAS,EAAc,GAAY,GAAqB,GAAwB;CAC9E,IAAM,IAAuB,EAAW;AAIxC,QAHK,IAGE,EAAoB,QAAQ,MAC7B,EAAK,UAAU,OAAO,EAAW,QAAS,WAAW,EAAW,OAAO,EAAW,KAAK,QAGvF,IACK,EAAK,UAAU,WAEjB,KALE,GAMT,CAAC,KAAK,MACD,EAAK,UAAU,cAKb,EAAK,UAA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Q,EAAE,eAAY;AACpB,YAAO,EAAS,EAAa,EAAS,EAAE,KAAK,IAAI;;IAGnD,OAAQ,EAAE,eAAY;AACpB,YAAO,EAAS,EAAa,EAAS,EAAE,MAAM,KAAK;;IAGrD,KAAM,EAAE,eAAY;AAClB,YAAO,EAAS,EAAa,EAAS,EAAE,KAAK,IAAI;;IAGnD,KAAM,EAAE,SAAM,eAAY;KACxB,IAAM,IAAO,EAAa,EAAS,EAC7B,IAAO,EAAK,OAAO,QAAQ,IAC3B,IAAU,EAAK,MAAM;AAG3B,YAAO,GAFS,EAAK,MAAM,GAAG,EAAK,SAAS,EAAK,WAAW,CAAC,OAAO,CAElD,GAAG,EAAQ,IAAI,EAAK,GADrB,EAAK,MAAM,EAAK,SAAS,CAAC,OAAO;;IAKpD,UAAW,EAAE,eAAY;AACvB,YAAO,EAAa,EAAS;;IAEhC;GACF;EACF,CAAC,CAIY,QAAQ,WAAW,OAAO,CAAC,QAAQ,cAAc,GAAG"}
1
+ {"version":3,"file":"MarkdownRenderer-NSSny0ID.js","names":["Node"],"sources":["../../../node_modules/.pnpm/@tiptap+static-renderer@3.19.0_@tiptap+core@3.19.0_@tiptap+pm@3.19.0__@tiptap+pm@3.19.0_9606d4b01b88c88c850636a0b274a958/node_modules/@tiptap/static-renderer/dist/pm/markdown/index.js","../components/RichTextEditor/MarkdownRenderer.js"],"sourcesContent":["// src/pm/extensionRenderer.ts\nimport {\n getAttributesFromExtensions,\n getExtensionField,\n getSchemaByResolvedExtensions,\n resolveExtensions,\n splitExtensions\n} from \"@tiptap/core\";\nimport { Node } from \"@tiptap/pm/model\";\n\n// src/helpers.ts\nimport { mergeAttributes } from \"@tiptap/core\";\nfunction getAttributes(nodeOrMark, extensionAttributes, onlyRenderedAttributes) {\n const nodeOrMarkAttributes = nodeOrMark.attrs;\n if (!nodeOrMarkAttributes) {\n return {};\n }\n return extensionAttributes.filter((item) => {\n if (item.type !== (typeof nodeOrMark.type === \"string\" ? nodeOrMark.type : nodeOrMark.type.name)) {\n return false;\n }\n if (onlyRenderedAttributes) {\n return item.attribute.rendered;\n }\n return true;\n }).map((item) => {\n if (!item.attribute.renderHTML) {\n return {\n [item.name]: item.name in nodeOrMarkAttributes ? nodeOrMarkAttributes[item.name] : item.attribute.default\n };\n }\n return item.attribute.renderHTML(nodeOrMarkAttributes) || {\n [item.name]: item.name in nodeOrMarkAttributes ? nodeOrMarkAttributes[item.name] : item.attribute.default\n };\n }).reduce((attributes, attribute) => mergeAttributes(attributes, attribute), {});\n}\nfunction getHTMLAttributes(nodeOrMark, extensionAttributes) {\n return getAttributes(nodeOrMark, extensionAttributes, true);\n}\n\n// src/pm/extensionRenderer.ts\nfunction mapNodeExtensionToReactNode(domOutputSpecToElement, extension, extensionAttributes, options) {\n const context = {\n name: extension.name,\n options: extension.options,\n storage: extension.storage,\n parent: extension.parent\n };\n const renderToHTML = getExtensionField(extension, \"renderHTML\", context);\n if (!renderToHTML) {\n if (options == null ? void 0 : options.unhandledNode) {\n return [extension.name, options.unhandledNode];\n }\n return [\n extension.name,\n () => {\n throw new Error(\n `[tiptap error]: Node ${extension.name} cannot be rendered, it is missing a \"renderToHTML\" method, please implement it or override the corresponding \"nodeMapping\" method to have a custom rendering`\n );\n }\n ];\n }\n return [\n extension.name,\n ({ node, children }) => {\n try {\n return domOutputSpecToElement(\n renderToHTML({\n node,\n HTMLAttributes: getHTMLAttributes(node, extensionAttributes)\n })\n )(children);\n } catch (e) {\n throw new Error(\n `[tiptap error]: Node ${extension.name} cannot be rendered, it's \"renderToHTML\" method threw an error: ${e.message}`,\n { cause: e }\n );\n }\n }\n ];\n}\nfunction mapMarkExtensionToReactNode(domOutputSpecToElement, extension, extensionAttributes, options) {\n const context = {\n name: extension.name,\n options: extension.options,\n storage: extension.storage,\n parent: extension.parent\n };\n const renderToHTML = getExtensionField(extension, \"renderHTML\", context);\n if (!renderToHTML) {\n if (options == null ? void 0 : options.unhandledMark) {\n return [extension.name, options.unhandledMark];\n }\n return [\n extension.name,\n () => {\n throw new Error(`Node ${extension.name} cannot be rendered, it is missing a \"renderToHTML\" method`);\n }\n ];\n }\n return [\n extension.name,\n ({ mark, children }) => {\n try {\n return domOutputSpecToElement(\n renderToHTML({\n mark,\n HTMLAttributes: getHTMLAttributes(mark, extensionAttributes)\n })\n )(children);\n } catch (e) {\n throw new Error(\n `[tiptap error]: Mark ${extension.name} cannot be rendered, it's \"renderToHTML\" method threw an error: ${e.message}`,\n { cause: e }\n );\n }\n }\n ];\n}\nfunction renderToElement({\n renderer,\n domOutputSpecToElement,\n mapDefinedTypes,\n content,\n extensions,\n options\n}) {\n extensions = resolveExtensions(extensions);\n const extensionAttributes = getAttributesFromExtensions(extensions);\n const { nodeExtensions, markExtensions } = splitExtensions(extensions);\n if (!(content instanceof Node)) {\n content = Node.fromJSON(getSchemaByResolvedExtensions(extensions), content);\n }\n return renderer({\n ...options,\n nodeMapping: {\n ...Object.fromEntries(\n nodeExtensions.filter((e) => {\n if (e.name in mapDefinedTypes) {\n return false;\n }\n if (options == null ? void 0 : options.nodeMapping) {\n return !(e.name in options.nodeMapping);\n }\n return true;\n }).map(\n (nodeExtension) => mapNodeExtensionToReactNode(domOutputSpecToElement, nodeExtension, extensionAttributes, options)\n )\n ),\n ...mapDefinedTypes,\n ...options == null ? void 0 : options.nodeMapping\n },\n markMapping: {\n ...Object.fromEntries(\n markExtensions.filter((e) => {\n if (options == null ? void 0 : options.markMapping) {\n return !(e.name in options.markMapping);\n }\n return true;\n }).map((mark) => mapMarkExtensionToReactNode(domOutputSpecToElement, mark, extensionAttributes, options))\n ),\n ...options == null ? void 0 : options.markMapping\n }\n })({ content });\n}\n\n// src/json/renderer.ts\nfunction TiptapStaticRenderer(renderComponent, {\n nodeMapping,\n markMapping,\n unhandledNode,\n unhandledMark\n}) {\n return function renderContent({\n content,\n parent\n }) {\n var _a;\n const nodeType = typeof content.type === \"string\" ? content.type : content.type.name;\n const NodeHandler = (_a = nodeMapping[nodeType]) != null ? _a : unhandledNode;\n if (!NodeHandler) {\n throw new Error(`missing handler for node type ${nodeType}`);\n }\n const nodeContent = renderComponent({\n component: NodeHandler,\n props: {\n node: content,\n parent,\n renderElement: renderContent,\n // Lazily compute the children to avoid unnecessary recursion\n get children() {\n const children = [];\n if (content.content) {\n content.content.forEach((child) => {\n children.push(\n renderContent({\n content: child,\n parent: content\n })\n );\n });\n }\n return children;\n }\n }\n });\n const markedContent = content.marks ? content.marks.reduce((acc, mark) => {\n var _a2;\n const markType = typeof mark.type === \"string\" ? mark.type : mark.type.name;\n const MarkHandler = (_a2 = markMapping[markType]) != null ? _a2 : unhandledMark;\n if (!MarkHandler) {\n throw new Error(`missing handler for mark type ${markType}`);\n }\n return renderComponent({\n component: MarkHandler,\n props: {\n mark,\n parent,\n node: content,\n children: acc\n }\n });\n }, nodeContent) : nodeContent;\n return markedContent;\n };\n}\n\n// src/json/html-string/string.ts\nfunction renderJSONContentToString(options) {\n return TiptapStaticRenderer((ctx) => {\n return ctx.component(ctx.props);\n }, options);\n}\nfunction serializeAttrsToHTMLString(attrs) {\n const output = Object.entries(attrs || {}).map(([key, value]) => `${key.split(\" \").at(-1)}=${JSON.stringify(value)}`).join(\" \");\n return output ? ` ${output}` : \"\";\n}\nfunction serializeChildrenToHTMLString(children) {\n return [].concat(children || \"\").filter(Boolean).join(\"\");\n}\n\n// src/pm/html-string/html-string.ts\nvar NON_SELF_CLOSING_TAGS = /* @__PURE__ */ new Set([\"iframe\", \"script\", \"style\", \"title\", \"textarea\", \"div\", \"span\", \"a\", \"button\"]);\nfunction domOutputSpecToHTMLString(content) {\n if (typeof content === \"string\") {\n return () => content;\n }\n if (typeof content === \"object\" && \"length\" in content) {\n const [_tag, attrs, children, ...rest] = content;\n let tag = _tag;\n const parts = tag.split(\" \");\n if (parts.length > 1) {\n tag = `${parts[1]} xmlns=\"${parts[0]}\"`;\n }\n if (attrs === void 0) {\n return () => `<${tag}/>`;\n }\n if (attrs === 0) {\n return (child) => `<${tag}>${serializeChildrenToHTMLString(child)}</${tag}>`;\n }\n if (typeof attrs === \"object\") {\n if (Array.isArray(attrs)) {\n if (children === void 0) {\n return (child) => `<${tag}>${domOutputSpecToHTMLString(attrs)(child)}</${tag}>`;\n }\n if (children === 0) {\n return (child) => `<${tag}>${domOutputSpecToHTMLString(attrs)(child)}</${tag}>`;\n }\n return (child) => `<${tag}>${domOutputSpecToHTMLString(attrs)(child)}${[children].concat(rest).map((a) => domOutputSpecToHTMLString(a)(child))}</${tag}>`;\n }\n if (children === void 0) {\n if (NON_SELF_CLOSING_TAGS.has(tag)) {\n return () => `<${tag}${serializeAttrsToHTMLString(attrs)}></${tag}>`;\n }\n return () => `<${tag}${serializeAttrsToHTMLString(attrs)}/>`;\n }\n if (children === 0) {\n return (child) => `<${tag}${serializeAttrsToHTMLString(attrs)}>${serializeChildrenToHTMLString(child)}</${tag}>`;\n }\n return (child) => `<${tag}${serializeAttrsToHTMLString(attrs)}>${[children].concat(rest).map((a) => domOutputSpecToHTMLString(a)(child)).join(\"\")}</${tag}>`;\n }\n }\n throw new Error(\n \"[tiptap error]: Unsupported DomOutputSpec type, check the `renderHTML` method output or implement a node mapping\",\n {\n cause: content\n }\n );\n}\nfunction renderToHTMLString({\n content,\n extensions,\n options\n}) {\n return renderToElement({\n renderer: renderJSONContentToString,\n domOutputSpecToElement: domOutputSpecToHTMLString,\n mapDefinedTypes: {\n // Map a doc node to concatenated children\n doc: ({ children }) => serializeChildrenToHTMLString(children),\n // Map a text node to its text content\n text: ({ node }) => {\n var _a;\n return (_a = node.text) != null ? _a : \"\";\n }\n },\n content,\n extensions,\n options\n });\n}\n\n// src/pm/markdown/markdown.ts\nfunction renderToMarkdown({\n content,\n extensions,\n options\n}) {\n return renderToHTMLString({\n content,\n extensions,\n options: {\n ...options,\n nodeMapping: {\n bulletList({ children }) {\n return `\n${serializeChildrenToHTMLString(children)}`;\n },\n orderedList({ children }) {\n return `\n${serializeChildrenToHTMLString(children)}`;\n },\n listItem({ node, children, parent }) {\n if ((parent == null ? void 0 : parent.type.name) === \"bulletList\") {\n return `- ${serializeChildrenToHTMLString(children).trim()}\n`;\n }\n if ((parent == null ? void 0 : parent.type.name) === \"orderedList\") {\n let number = parent.attrs.start || 1;\n parent.forEach((parentChild, _offset, index) => {\n if (node === parentChild) {\n number = index + 1;\n }\n });\n return `${number}. ${serializeChildrenToHTMLString(children).trim()}\n`;\n }\n return serializeChildrenToHTMLString(children);\n },\n paragraph({ children }) {\n return `\n${serializeChildrenToHTMLString(children)}\n`;\n },\n heading({ node, children }) {\n const level = node.attrs.level;\n return `${new Array(level).fill(\"#\").join(\"\")} ${children}\n`;\n },\n codeBlock({ node, children }) {\n return `\n\\`\\`\\`${node.attrs.language}\n${serializeChildrenToHTMLString(children)}\n\\`\\`\\`\n`;\n },\n blockquote({ children }) {\n return `\n${serializeChildrenToHTMLString(children).trim().split(\"\\n\").map((a) => `> ${a}`).join(\"\\n\")}`;\n },\n image({ node }) {\n return `![${node.attrs.alt}](${node.attrs.src})`;\n },\n hardBreak() {\n return \"\\n\";\n },\n horizontalRule() {\n return \"\\n---\\n\";\n },\n table({ children, node }) {\n if (!Array.isArray(children)) {\n return `\n${serializeChildrenToHTMLString(children)}\n`;\n }\n const columnCount = node.children[0].childCount;\n return `\n${serializeChildrenToHTMLString(children[0])}| ${new Array(columnCount).fill(\"---\").join(\" | \")} |\n${serializeChildrenToHTMLString(children.slice(1))}\n`;\n },\n tableRow({ children }) {\n if (Array.isArray(children)) {\n return `| ${children.join(\" | \")} |\n`;\n }\n return `${serializeChildrenToHTMLString(children)}\n`;\n },\n tableHeader({ children }) {\n return serializeChildrenToHTMLString(children).trim();\n },\n tableCell({ children }) {\n return serializeChildrenToHTMLString(children).trim();\n },\n ...options == null ? void 0 : options.nodeMapping\n },\n markMapping: {\n bold({ children }) {\n return `**${serializeChildrenToHTMLString(children)}**`;\n },\n italic({ children, node }) {\n let isBoldToo = false;\n if (node == null ? void 0 : node.marks.some((m) => m.type.name === \"bold\")) {\n isBoldToo = true;\n }\n if (isBoldToo) {\n return `*${serializeChildrenToHTMLString(children)}*`;\n }\n return `_${serializeChildrenToHTMLString(children)}_`;\n },\n code({ children }) {\n return `\\`${serializeChildrenToHTMLString(children)}\\``;\n },\n strike({ children }) {\n return `~~${serializeChildrenToHTMLString(children)}~~`;\n },\n underline({ children }) {\n return `<u>${serializeChildrenToHTMLString(children)}</u>`;\n },\n subscript({ children }) {\n return `<sub>${serializeChildrenToHTMLString(children)}</sub>`;\n },\n superscript({ children }) {\n return `<sup>${serializeChildrenToHTMLString(children)}</sup>`;\n },\n link({ mark, children }) {\n return `[${serializeChildrenToHTMLString(children)}](${mark.attrs.href})`;\n },\n highlight({ children }) {\n return `==${serializeChildrenToHTMLString(children)}==`;\n },\n ...options == null ? void 0 : options.markMapping\n }\n }\n });\n}\nexport {\n mapMarkExtensionToReactNode,\n mapNodeExtensionToReactNode,\n renderToElement,\n renderToMarkdown\n};\n//# sourceMappingURL=index.js.map","import { renderToMarkdown } from '@tiptap/static-renderer/pm/markdown';\n\n// The pm/markdown renderer passes children as string[] (one entry per child node),\n// not as a pre-joined string. Normalize to a string before processing.\nconst joinChildren = (children) => Array.isArray(children) ? children.join('') : (children || '');\n\n// Move leading/trailing spaces outside mark delimiters so parsers like CommonMark\n// don't reject them (e.g. \"** bold **\" → \" **bold** \").\nconst wrapMark = (text, open, close) => {\n const trimmed = text.trim();\n if (!trimmed) return text;\n const leading = text.slice(0, text.length - text.trimStart().length);\n const trailing = text.slice(text.trimEnd().length);\n return `${leading}${open}${trimmed}${close}${trailing}`;\n};\n\n/**\n * Renders a TipTap/ProseMirror JSON document to a markdown string.\n *\n * Uses @tiptap/static-renderer with custom mappings to preserve the output\n * format of the legacy jsonToMarkdownConverter, including Dialtone-specific\n * node types (mention, channel, emoji, variable, slash-commands).\n *\n * @param {import('@tiptap/core').JSONContent} jsonContent - TipTap JSON document\n * @param {import('@tiptap/core').Extensions} extensions - Active editor extensions\n * @returns {string}\n */\nexport function renderEditorToMarkdown (jsonContent, extensions) {\n const output = renderToMarkdown({\n extensions,\n content: jsonContent,\n options: {\n nodeMapping: {\n // Override blockquote: built-in omits trailing newline (causes lazy continuation).\n // Since we replace the built-in entirely, we must add the '> ' prefix ourselves.\n blockquote ({ children }) {\n const text = joinChildren(children).trim();\n const quoted = text\n .split('\\n')\n .map(line => line ? `> ${line}` : '>')\n .join('\\n');\n return quoted + '\\n';\n },\n\n // Override codeBlock: built-in passes null language through literally\n codeBlock ({ node, children }) {\n const lang = node.attrs?.language || '';\n return `\\`\\`\\`${lang}\\n${joinChildren(children)}\\n\\`\\`\\`\\n`;\n },\n\n // Custom Dialtone node types\n mention ({ node }) {\n const id = node.attrs?.id || '';\n const contactKey = node.attrs?.contactKey || '';\n const name = node.attrs?.name || '';\n return `<!-- @mention: {\"id\": \"${id}\", \"contactKey\": \"${contactKey}\", \"name\": \"${name}\"} -->`;\n },\n\n channel ({ node }) {\n const id = node.attrs?.id || '';\n const channelKey = node.attrs?.channelKey || '';\n const name = node.attrs?.name || '';\n const locked = String(node.attrs?.locked ?? '');\n return `<!-- @channel: {\"id\": \"${id}\", \"channelKey\": \"${channelKey}\", \"name\": \"${name}\", \"locked\": \"${locked}\"} -->`;\n },\n\n 'slash-commands' ({ node }) {\n return `/${node.attrs?.command || ''}`;\n },\n\n emoji ({ node }) {\n return node.attrs?.code || '';\n },\n\n variable ({ node }) {\n const id = node.attrs?.id || '';\n const altText = node.attrs?.altText || '';\n return `{{${id}=${altText}}}`;\n },\n },\n\n markMapping: {\n bold ({ children }) {\n return wrapMark(joinChildren(children), '**', '**');\n },\n\n // Override italic: use * instead of built-in _ and fix boundary spaces\n italic ({ children }) {\n return wrapMark(joinChildren(children), '*', '*');\n },\n\n strike ({ children }) {\n return wrapMark(joinChildren(children), '~~', '~~');\n },\n\n code ({ children }) {\n return wrapMark(joinChildren(children), '`', '`');\n },\n\n link ({ mark, children }) {\n const text = joinChildren(children);\n const href = mark.attrs?.href || '';\n const trimmed = text.trim();\n const leading = text.slice(0, text.length - text.trimStart().length);\n const trailing = text.slice(text.trimEnd().length);\n return `${leading}[${trimmed}](${href})${trailing}`;\n },\n\n // Override underline: pass-through (no markdown equivalent, matches legacy no-op)\n underline ({ children }) {\n return joinChildren(children);\n },\n },\n },\n });\n // Collapse 3+ consecutive newlines to 2 (CommonMark ignores extra blank\n // lines between blocks), and strip the leading newline that the built-in\n // paragraph renderer always prepends to the first node.\n return output.replace(/\\n{3,}/g, '\\n\\n').replace(/^\\n+|\\n+$/g, '');\n}\n"],"x_google_ignoreList":[0],"mappings":";;;AAYA,SAAS,EAAc,GAAY,GAAqB,GAAwB;CAC9E,IAAM,IAAuB,EAAW;AAIxC,QAHK,IAGE,EAAoB,QAAQ,MAC7B,EAAK,UAAU,OAAO,EAAW,QAAS,WAAW,EAAW,OAAO,EAAW,KAAK,QAGvF,IACK,EAAK,UAAU,WAEjB,KALE,GAMT,CAAC,KAAK,MACD,EAAK,UAAU,cAKb,EAAK,UAAU,WAAW,EAAqB,IAJ7C,GACJ,EAAK,OAAO,EAAK,QAAQ,IAAuB,EAAqB,EAAK,QAAQ,EAAK,UAAU,SACnG,CAKH,CAAC,QAAQ,GAAY,MAAc,EAAgB,GAAY,EAAU,EAAE,EAAE,CAAC,GAnBvE,EAAE;;AAqBb,SAAS,EAAkB,GAAY,GAAqB;AAC1D,QAAO,EAAc,GAAY,GAAqB,GAAK;;AAI7D,SAAS,EAA4B,GAAwB,GAAW,GAAqB,GAAS;CAOpG,IAAM,IAAe,EAAkB,GAAW,cANlC;EACd,MAAM,EAAU;EAChB,SAAS,EAAU;EACnB,SAAS,EAAU;EACnB,QAAQ,EAAU;EACnB,CACuE;AAcxE,QAbK,IAaE,CACL,EAAU,OACT,EAAE,SAAM,kBAAe;AACtB,MAAI;AACF,UAAO,EACL,EAAa;IACX;IACA,gBAAgB,EAAkB,GAAM,EAAoB;IAC7D,CAAC,CACH,CAAC,EAAS;WACJ,GAAG;AACV,SAAU,MACR,wBAAwB,EA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 @@
1
1
  const e=require(`./chunk-Bmb41Sf3.cjs`),t=require(`./common/utils/index.cjs`),n=require(`./_plugin-vue_export-helper-D8jCH6HB.cjs`),r=require(`./common/emoji/index.cjs`),i=require(`./lib/avatar/avatar.cjs`),a=require(`./lib/badge/badge.cjs`),o=require(`./lib/text/text.cjs`),s=require(`./lib/link/link.cjs`),c=require(`./localization/index.cjs`),l=require(`./lib/button/button.cjs`),u=require(`./lib/list-item/list-item.cjs`),d=require(`./lib/stack/stack.cjs`),f=require(`./lib/popover/popover.cjs`),p=require(`./lib/emoji/emoji.cjs`),m=require(`./lib/input/input.cjs`),h=require(`./node_modules/@tiptap/vue-3.cjs`),g=require(`./lib/rich-text-editor/rich-text-editor-constants.cjs`),_=require(`./MarkdownRenderer-D5XWsyQk.cjs`);let v=require(`vue`),y=require(`@dialpad/dialtone-icons/vue`),b=require(`regex-combined-emojis`),x=require(`@tiptap/core`),S=require(`@tiptap/pm/state`),C=require(`@tiptap/pm/tables`),w=require(`@tiptap/extension-blockquote`);w=e.t(w);let T=require(`@tiptap/extension-code-block`);T=e.t(T);let E=require(`@tiptap/extension-code`);E=e.t(E);let D=require(`@tiptap/extension-document`);D=e.t(D);let O=require(`@tiptap/extensions`),ee=require(`@tiptap/extension-hard-break`);ee=e.t(ee);let k=require(`@tiptap/extension-paragraph`);k=e.t(k);let A=require(`@tiptap/extension-bold`);A=e.t(A);let j=require(`@tiptap/extension-list`),M=require(`@tiptap/extension-italic`);M=e.t(M);let te=require(`@tiptap/extension-link`);te=e.t(te);let ne=require(`@tiptap/extension-strike`);ne=e.t(ne);let re=require(`@tiptap/extension-underline`);re=e.t(re);let ie=require(`@tiptap/extension-text`);ie=e.t(ie);let ae=require(`@tiptap/extension-text-align`);ae=e.t(ae);let oe=require(`@tiptap/extension-table`),se=require(`@tiptap/extension-text-style`),ce=require(`@tiptap/suggestion`);ce=e.t(ce);let le=require(`@tiptap/extension-image`);le=e.t(le);let N=require(`@tiptap/extension-mention`);N=e.t(N);let ue=require(`@dialpad/dialtone-icons/vue/hash`);ue=e.t(ue);let de=require(`@dialpad/dialtone-icons/vue/lock`);de=e.t(de);let fe=require(`deep-equal`);fe=e.t(fe);var pe=[`top`,`right`,`bottom`,`left`],me=[`start`,`end`],he=pe.reduce((e,t)=>e.concat(t,t+`-`+me[0],t+`-`+me[1]),[]),P=Math.min,F=Math.max,ge=Math.round,I=e=>({x:e,y:e}),_e={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function ve(e,t,n){return F(e,P(t,n))}function L(e,t){return typeof e==`function`?e(t):e}function R(e){return e.split(`-`)[0]}function z(e){return e.split(`-`)[1]}function ye(e){return e===`x`?`y`:`x`}function be(e){return e===`y`?`height`:`width`}function B(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function xe(e){return ye(B(e))}function Se(e,t,n){n===void 0&&(n=!1);let r=z(e),i=xe(e),a=be(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=je(o)),[o,je(o)]}function Ce(e){let t=je(e);return[we(e),t,we(t)]}function we(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var Te=[`left`,`right`],Ee=[`right`,`left`],De=[`top`,`bottom`],Oe=[`bottom`,`top`];function ke(e,t,n){switch(e){case`top`:case`bottom`:return n?t?Ee:Te:t?Te:Ee;case`left`:case`right`:return t?De:Oe;default:return[]}}function Ae(e,t,n,r){let i=z(e),a=ke(R(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(we)))),a}function je(e){let t=R(e);return _e[t]+e.slice(t.length)}function Me(e){return{top:0,right:0,bottom:0,left:0,...e}}function Ne(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Me(e)}function V(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function Pe(e,t,n){let{reference:r,floating:i}=e,a=B(t),o=xe(t),s=be(o),c=R(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(z(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function Fe(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=L(t,e),p=Ne(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=V(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=V(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var Ie=50,Le=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:Fe},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=Pe(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<Ie&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=Pe(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},Re=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=L(e,t)||{};if(l==null)return{};let d=Ne(u),f={x:n,y:r},p=xe(i),m=be(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=P(d[_],T),D=P(d[v],T),O=E,ee=C-h[m]-D,k=C/2-h[m]/2+w,A=ve(O,k,ee),j=!c.arrow&&z(i)!=null&&k!==A&&a.reference[m]/2-(k<O?E:D)-h[m]/2<0,M=j?k<O?k-O:k-ee:0;return{[p]:f[p]+M,data:{[p]:A,centerOffset:k-A-M,...j&&{alignmentOffset:M}},reset:j}}});function ze(e,t,n){return(e?[...n.filter(t=>z(t)===e),...n.filter(t=>z(t)!==e)]:n.filter(e=>R(e)===e)).filter(n=>e?z(n)===e||(t?we(n)!==n:!1):!0)}var Be=function(e){return e===void 0&&(e={}),{name:`autoPlacement`,options:e,async fn(t){let{rects:n,middlewareData:r,placement:i,platform:a,elements:o}=t,{crossAxis:s=!1,alignment:c,allowedPlacements:l=he,autoAlignment:u=!0,...d}=L(e,t),f=c!==void 0||l===he?ze(c||null,u,l):l,p=await a.detectOverflow(t,d),m=r.autoPlacement?.index||0,h=f[m];if(h==null)return{};let g=Se(h,n,await(a.isRTL==null?void 0:a.isRTL(o.floating)));if(i!==h)return{reset:{placement:f[0]}};let _=[p[R(h)],p[g[0]],p[g[1]]],v=[...r.autoPlacement?.overflows||[],{placement:h,overflows:_}],y=f[m+1];if(y)return{data:{index:m+1,overflows:v},reset:{placement:y}};let b=v.map(e=>{let t=z(e.placement);return[e.placement,t&&s?e.overflows.slice(0,2).reduce((e,t)=>e+t,0):e.overflows[0],e.overflows]}).sort((e,t)=>e[1]-t[1]),x=b.filter(e=>e[2].slice(0,z(e[0])?2:3).every(e=>e<=0))[0]?.[0]||b[0][0];return x===i?{}:{data:{index:m+1,overflows:v},reset:{placement:x}}}}},Ve=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=L(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=R(r),_=B(o),v=R(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[je(o)]:Ce(o)),x=p!==`none`;!d&&x&&b.push(...Ae(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=Se(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==B(t))||T.every(e=>B(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=B(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function He(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Ue(e){return pe.some(t=>e[t]>=0)}var We=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=L(e,t);switch(i){case`referenceHidden`:{let e=He(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Ue(e)}}}case`escaped`:{let e=He(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Ue(e)}}}default:return{}}}}};function Ge(e){let t=P(...e.map(e=>e.left)),n=P(...e.map(e=>e.top)),r=F(...e.map(e=>e.right)),i=F(...e.map(e=>e.bottom));return{x:t,y:n,width:r-t,height:i-n}}function Ke(e){let t=e.slice().sort((e,t)=>e.y-t.y),n=[],r=null;for(let e=0;e<t.length;e++){let i=t[e];!r||i.y-r.y>r.height/2?n.push([i]):n[n.length-1].push(i),r=i}return n.map(e=>V(Ge(e)))}var qe=function(e){return e===void 0&&(e={}),{name:`inline`,options:e,async fn(t){let{placement:n,elements:r,rects:i,platform:a,strategy:o}=t,{padding:s=2,x:c,y:l}=L(e,t),u=Array.from(await(a.getClientRects==null?void 0:a.getClientRects(r.reference))||[]),d=Ke(u),f=V(Ge(u)),p=Ne(s);function m(){if(d.length===2&&d[0].left>d[1].right&&c!=null&&l!=null)return d.find(e=>c>e.left-p.left&&c<e.right+p.right&&l>e.top-p.top&&l<e.bottom+p.bottom)||f;if(d.length>=2){if(B(n)===`y`){let e=d[0],t=d[d.length-1],r=R(n)===`top`,i=e.top,a=t.bottom,o=r?e.left:t.left,s=r?e.right:t.right;return{top:i,bottom:a,left:o,right:s,width:s-o,height:a-i,x:o,y:i}}let e=R(n)===`left`,t=F(...d.map(e=>e.right)),r=P(...d.map(e=>e.left)),i=d.filter(n=>e?n.left===r:n.right===t),a=i[0].top,o=i[i.length-1].bottom,s=r,c=t;return{top:a,bottom:o,left:s,right:c,width:c-s,height:o-a,x:s,y:a}}return f}let h=await a.getElementRects({reference:{getBoundingClientRect:m},floating:r.floating,strategy:o});return i.reference.x!==h.reference.x||i.reference.y!==h.reference.y||i.reference.width!==h.reference.width||i.reference.height!==h.reference.height?{reset:{rects:h}}:{}}}},Je=new Set([`left`,`top`]);async function Ye(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=R(n),s=z(n),c=B(n)===`y`,l=Je.has(o)?-1:1,u=a&&c?-1:1,d=L(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var Xe=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await Ye(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},Ze=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=L(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=B(R(i)),p=ye(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=ve(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=ve(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},Qe=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=L(e,t),u=await o.detectOverflow(t,l),d=R(i),f=z(i),p=B(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=P(h-u[g],v),x=P(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=F(u.left,0),t=F(u.right,0),n=F(u.top,0),r=F(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:F(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:F(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function $e(){return typeof window<`u`}function H(e){return et(e)?(e.nodeName||``).toLowerCase():`#document`}function U(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function W(e){return((et(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function et(e){return $e()?e instanceof Node||e instanceof U(e).Node:!1}function G(e){return $e()?e instanceof Element||e instanceof U(e).Element:!1}function K(e){return $e()?e instanceof HTMLElement||e instanceof U(e).HTMLElement:!1}function tt(e){return!$e()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof U(e).ShadowRoot}function q(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=X(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function nt(e){return/^(table|td|th)$/.test(H(e))}function rt(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var it=/transform|translate|scale|rotate|perspective|filter/,at=/paint|layout|strict|content/,J=e=>!!e&&e!==`none`,ot;function st(e){let t=G(e)?X(e):e;return J(t.transform)||J(t.translate)||J(t.scale)||J(t.rotate)||J(t.perspective)||!lt()&&(J(t.backdropFilter)||J(t.filter))||it.test(t.willChange||``)||at.test(t.contain||``)}function ct(e){let t=Z(e);for(;K(t)&&!Y(t);){if(st(t))return t;if(rt(t))return null;t=Z(t)}return null}function lt(){return ot??(ot=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`)),ot}function Y(e){return/^(html|body|#document)$/.test(H(e))}function X(e){return U(e).getComputedStyle(e)}function ut(e){return G(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Z(e){if(H(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||tt(e)&&e.host||W(e);return tt(t)?t.host:t}function dt(e){let t=Z(e);return Y(t)?e.ownerDocument?e.ownerDocument.body:e.body:K(t)&&q(t)?t:dt(t)}function ft(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=dt(e),i=r===e.ownerDocument?.body,a=U(r);if(i){let e=pt(a);return t.concat(a,a.visualViewport||[],q(r)?r:[],e&&n?ft(e):[])}else return t.concat(r,ft(r,[],n))}function pt(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function mt(e){let t=X(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=K(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=ge(n)!==a||ge(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function ht(e){return G(e)?e:e.contextElement}function Q(e){let t=ht(e);if(!K(t))return I(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=mt(t),o=(a?ge(n.width):n.width)/r,s=(a?ge(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var gt=I(0);function _t(e){let t=U(e);return!lt()||!t.visualViewport?gt:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function vt(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==U(e)?!1:t}function yt(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=ht(e),o=I(1);t&&(r?G(r)&&(o=Q(r)):o=Q(e));let s=vt(a,n,r)?_t(a):I(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=U(a),t=r&&G(r)?U(r):r,n=e,i=pt(n);for(;i&&r&&t!==n;){let e=Q(i),t=i.getBoundingClientRect(),r=X(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=U(i),i=pt(n)}}return V({width:u,height:d,x:c,y:l})}function bt(e,t){let n=ut(e).scrollLeft;return t?t.left+n:yt(W(e)).left+n}function xt(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-bt(e,n),y:n.top+t.scrollTop}}function St(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=W(r),s=t?rt(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=I(1),u=I(0),d=K(r);if((d||!d&&!a)&&((H(r)!==`body`||q(o))&&(c=ut(r)),d)){let e=yt(r);l=Q(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?xt(o,c):I(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function Ct(e){return Array.from(e.getClientRects())}function wt(e){let t=W(e),n=ut(e),r=e.ownerDocument.body,i=F(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=F(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+bt(e),s=-n.scrollTop;return X(r).direction===`rtl`&&(o+=F(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var Tt=25;function Et(e,t){let n=U(e),r=W(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=lt();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=bt(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=Tt&&(a-=o)}else l<=Tt&&(a+=l);return{width:a,height:o,x:s,y:c}}function Dt(e,t){let n=yt(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=K(e)?Q(e):I(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Ot(e,t,n){let r;if(t===`viewport`)r=Et(e,n);else if(t===`document`)r=wt(W(e));else if(G(t))r=Dt(t,n);else{let n=_t(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return V(r)}function kt(e,t){let n=Z(e);return n===t||!G(n)||Y(n)?!1:X(n).position===`fixed`||kt(n,t)}function At(e,t){let n=t.get(e);if(n)return n;let r=ft(e,[],!1).filter(e=>G(e)&&H(e)!==`body`),i=null,a=X(e).position===`fixed`,o=a?Z(e):e;for(;G(o)&&!Y(o);){let t=X(o),n=st(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||q(o)&&!n&&kt(e,o))?r=r.filter(e=>e!==o):i=t,o=Z(o)}return t.set(e,r),r}function jt(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?rt(t)?[]:At(t,this._c):[].concat(n),r],o=Ot(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=Ot(t,a[e],i);s=F(n.top,s),c=P(n.right,c),l=P(n.bottom,l),u=F(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function Mt(e){let{width:t,height:n}=mt(e);return{width:t,height:n}}function Nt(e,t,n){let r=K(t),i=W(t),a=n===`fixed`,o=yt(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=I(0);function l(){c.x=bt(i)}if(r||!r&&!a)if((H(t)!==`body`||q(i))&&(s=ut(t)),r){let e=yt(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?xt(i,s):I(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function Pt(e){return X(e).position===`static`}function Ft(e,t){if(!K(e)||X(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return W(e)===n&&(n=n.ownerDocument.body),n}function It(e,t){let n=U(e);if(rt(e))return n;if(!K(e)){let t=Z(e);for(;t&&!Y(t);){if(G(t)&&!Pt(t))return t;t=Z(t)}return n}let r=Ft(e,t);for(;r&&nt(r)&&Pt(r);)r=Ft(r,t);return r&&Y(r)&&Pt(r)&&!st(r)?n:r||ct(e)||n}var Lt=async function(e){let t=this.getOffsetParent||It,n=this.getDimensions,r=await n(e.floating);return{reference:Nt(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Rt(e){return X(e).direction===`rtl`}var zt={convertOffsetParentRelativeRectToViewportRelativeRect:St,getDocumentElement:W,getClippingRect:jt,getOffsetParent:It,getElementRects:Lt,getClientRects:Ct,getDimensions:Mt,getScale:Q,isElement:G,isRTL:Rt},Bt=Xe,Vt=Be,Ht=Ze,Ut=Ve,Wt=Qe,Gt=We,Kt=Re,qt=qe,Jt=(e,t,n)=>{let r=new Map,i={platform:zt,...n},a={...i.platform,_c:r};return Le(e,t,{...i,platform:a})};function Yt(e,t){let n=Math.min(e.top,t.top),r=Math.max(e.bottom,t.bottom),i=Math.min(e.left,t.left),a=Math.max(e.right,t.right)-i,o=r-n;return new DOMRect(i,n,a,o)}var Xt=class{constructor({editor:e,element:t,view:n,updateDelay:r=250,resizeDelay:i=60,shouldShow:a,appendTo:o,getReferencedVirtualElement:s,options:c}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.floatingUIOptions={strategy:`absolute`,placement:`top`,offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1,onShow:void 0,onHide:void 0,onUpdate:void 0,onDestroy:void 0},this.shouldShow=({view:e,state:t,from:n,to:r})=>{let{doc:i,selection:a}=t,{empty:o}=a,s=!i.textBetween(n,r).length&&(0,x.isTextSelection)(t.selection),c=this.element.contains(document.activeElement);return!(!(e.hasFocus()||c)||o||s||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:e})=>{if(this.editor.isDestroyed){this.destroy();return}if(this.preventHide){this.preventHide=!1;return}e?.relatedTarget&&this.element.parentNode?.contains(e.relatedTarget)||e?.relatedTarget!==this.editor.view.dom&&this.hide()},this.handleDebouncedUpdate=(e,t)=>{let n=!t?.selection.eq(e.state.selection),r=!t?.doc.eq(e.state.doc);!n&&!r||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(e,n,r,t)},this.updateDelay))},this.updateHandler=(e,t,n,r)=>{let{composing:i}=e;if(!(i||!t&&!n)){if(!this.getShouldShow(r)){this.hide();return}this.updatePosition(),this.show()}},this.transactionHandler=({transaction:e})=>{let t=e.getMeta(`bubbleMenu`);t===`updatePosition`?this.updatePosition():t&&typeof t==`object`&&t.type===`updateOptions`&&this.updateOptions(t.options)},this.editor=e,this.element=t,this.view=n,this.updateDelay=r,this.resizeDelay=i,this.appendTo=o,this.scrollTarget=c?.scrollTarget??window,this.getReferencedVirtualElement=s,this.floatingUIOptions={...this.floatingUIOptions,...c},this.element.tabIndex=0,a&&(this.shouldShow=a),this.element.addEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener(`dragstart`,this.dragstartHandler),this.editor.on(`focus`,this.focusHandler),this.editor.on(`blur`,this.blurHandler),this.editor.on(`transaction`,this.transactionHandler),window.addEventListener(`resize`,this.resizeHandler),this.scrollTarget.addEventListener(`scroll`,this.resizeHandler),this.update(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(Ut(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(Ht(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(Bt(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(Kt(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(Wt(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(Vt(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(Gt(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(qt(typeof this.floatingUIOptions.inline==`boolean`?void 0:this.floatingUIOptions.inline)),e}get virtualElement(){let{selection:e}=this.editor.state,t=this.getReferencedVirtualElement?.call(this);if(t)return t;if(!this.view?.dom?.parentNode)return;let n=(0,x.posToDOMRect)(this.view,e.from,e.to),r={getBoundingClientRect:()=>n,getClientRects:()=>[n]};if(e instanceof S.NodeSelection){let t=this.view.nodeDOM(e.from),n=t.dataset.nodeViewWrapper?t:t.querySelector(`[data-node-view-wrapper]`);n&&(t=n),t&&(r={getBoundingClientRect:()=>t.getBoundingClientRect(),getClientRects:()=>[t.getBoundingClientRect()]})}if(e instanceof C.CellSelection){let{$anchorCell:t,$headCell:n}=e,i=t?t.pos:n.pos,a=n?n.pos:t.pos,o=this.view.nodeDOM(i),s=this.view.nodeDOM(a);if(!o||!s)return;let c=o===s?o.getBoundingClientRect():Yt(o.getBoundingClientRect(),s.getBoundingClientRect());r={getBoundingClientRect:()=>c,getClientRects:()=>[c]}}return r}updatePosition(){let e=this.virtualElement;e&&Jt(e,this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:e,y:t,strategy:n,middlewareData:r})=>{if(r.hide?.referenceHidden||r.hide?.escaped){this.element.style.visibility=`hidden`;return}this.element.style.visibility=`visible`,this.element.style.width=`max-content`,this.element.style.position=n,this.element.style.left=`${e}px`,this.element.style.top=`${t}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(e,t){let{state:n}=e,r=n.selection.from!==n.selection.to;if(this.updateDelay>0&&r){this.handleDebouncedUpdate(e,t);return}let i=!t?.selection.eq(e.state.selection),a=!t?.doc.eq(e.state.doc);this.updateHandler(e,i,a,t)}getShouldShow(e){let{state:t}=this.view,{selection:n}=t,{ranges:r}=n,i=Math.min(...r.map(e=>e.$from.pos)),a=Math.max(...r.map(e=>e.$to.pos));return this.shouldShow?.call(this,{editor:this.editor,element:this.element,view:this.view,state:t,oldState:e,from:i,to:a})||!1}show(){var e;this.isVisible||(this.element.style.visibility=`visible`,this.element.style.opacity=`1`,(e=(typeof this.appendTo==`function`?this.appendTo():this.appendTo)??this.view.dom.parentElement)==null||e.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0)}hide(){this.isVisible&&(this.element.style.visibility=`hidden`,this.element.style.opacity=`0`,this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}updateOptions(e){if(e.updateDelay!==void 0&&(this.updateDelay=e.updateDelay),e.resizeDelay!==void 0&&(this.resizeDelay=e.resizeDelay),e.appendTo!==void 0&&(this.appendTo=e.appendTo),e.getReferencedVirtualElement!==void 0&&(this.getReferencedVirtualElement=e.getReferencedVirtualElement),e.shouldShow!==void 0&&e.shouldShow&&(this.shouldShow=e.shouldShow),e.options!==void 0){let t=e.options.scrollTarget??window;t!==this.scrollTarget&&(this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.scrollTarget=t,this.scrollTarget.addEventListener(`scroll`,this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...e.options}}}destroy(){this.hide(),this.element.removeEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener(`dragstart`,this.dragstartHandler),window.removeEventListener(`resize`,this.resizeHandler),this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.editor.off(`focus`,this.focusHandler),this.editor.off(`blur`,this.blurHandler),this.editor.off(`transaction`,this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},Zt=e=>new S.Plugin({key:typeof e.pluginKey==`string`?new S.PluginKey(e.pluginKey):e.pluginKey,view:t=>new Xt({view:t,...e})}),Qt=(0,v.defineComponent)({name:`BubbleMenu`,inheritAttrs:!1,props:{pluginKey:{type:[String,Object],default:`bubbleMenu`},editor:{type:Object,required:!0},updateDelay:{type:Number,default:void 0},resizeDelay:{type:Number,default:void 0},options:{type:Object,default:()=>({})},appendTo:{type:[Object,Function],default:void 0},shouldShow:{type:Function,default:null},getReferencedVirtualElement:{type:Function,default:void 0}},setup(e,{slots:t,attrs:n}){let r=(0,v.ref)(null);return(0,v.onMounted)(()=>{let{editor:t,options:n,pluginKey:i,resizeDelay:a,appendTo:o,shouldShow:s,getReferencedVirtualElement:c,updateDelay:l}=e,u=r.value;u&&(u.style.visibility=`hidden`,u.style.position=`absolute`,u.remove(),(0,v.nextTick)(()=>{t.registerPlugin(Zt({editor:t,element:u,options:n,pluginKey:i,resizeDelay:a,appendTo:o,shouldShow:s,getReferencedVirtualElement:c,updateDelay:l}))}))}),(0,v.onBeforeUnmount)(()=>{let{pluginKey:t,editor:n}=e;n.unregisterPlugin(t)}),()=>(0,v.h)(`div`,{ref:r,...n},t.default?.call(t))}}),$t=class{constructor({editor:e,element:t,view:n,updateDelay:r=250,resizeDelay:i=60,options:a,appendTo:o,shouldShow:s}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.shouldShow=({view:e,state:t})=>{let{selection:n}=t,{$anchor:r,empty:i}=n,a=r.depth===1,o=r.parent.isTextblock&&!r.parent.type.spec.code&&!r.parent.textContent&&r.parent.childCount===0&&!this.getTextContent(r.parent);return!(!e.hasFocus()||!i||!a||!o||!this.editor.isEditable)},this.floatingUIOptions={strategy:`absolute`,placement:`right`,offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1},this.updateHandler=(e,t,n,r)=>{let{composing:i}=e;if(!(i||!t&&!n)){if(!this.getShouldShow(r)){this.hide();return}this.updatePosition(),this.show()}},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:e})=>{if(this.preventHide){this.preventHide=!1;return}e?.relatedTarget&&this.element.parentNode?.contains(e.relatedTarget)||e?.relatedTarget!==this.editor.view.dom&&this.hide()},this.transactionHandler=({transaction:e})=>{let t=e.getMeta(`floatingMenu`);t===`updatePosition`?this.updatePosition():t&&typeof t==`object`&&t.type===`updateOptions`&&this.updateOptions(t.options)},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.editor=e,this.element=t,this.view=n,this.updateDelay=r,this.resizeDelay=i,this.appendTo=o,this.scrollTarget=a?.scrollTarget??window,this.floatingUIOptions={...this.floatingUIOptions,...a},this.element.tabIndex=0,s&&(this.shouldShow=s),this.element.addEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),this.editor.on(`focus`,this.focusHandler),this.editor.on(`blur`,this.blurHandler),this.editor.on(`transaction`,this.transactionHandler),window.addEventListener(`resize`,this.resizeHandler),this.scrollTarget.addEventListener(`scroll`,this.resizeHandler),this.update(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}getTextContent(e){return(0,x.getText)(e,{textSerializers:(0,x.getTextSerializersFromSchema)(this.editor.schema)})}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(Ut(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(Ht(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(Bt(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(Kt(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(Wt(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(Vt(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(Gt(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(qt(typeof this.floatingUIOptions.inline==`boolean`?void 0:this.floatingUIOptions.inline)),e}getShouldShow(e){let{state:t}=this.view,{selection:n}=t,{ranges:r}=n,i=Math.min(...r.map(e=>e.$from.pos)),a=Math.max(...r.map(e=>e.$to.pos));return this.shouldShow?.call(this,{editor:this.editor,view:this.view,state:t,oldState:e,from:i,to:a})}updateOptions(e){if(e.updateDelay!==void 0&&(this.updateDelay=e.updateDelay),e.resizeDelay!==void 0&&(this.resizeDelay=e.resizeDelay),e.appendTo!==void 0&&(this.appendTo=e.appendTo),e.shouldShow!==void 0&&e.shouldShow&&(this.shouldShow=e.shouldShow),e.options!==void 0){let t=e.options.scrollTarget??window;t!==this.scrollTarget&&(this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.scrollTarget=t,this.scrollTarget.addEventListener(`scroll`,this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...e.options}}}updatePosition(){let{selection:e}=this.editor.state,t=(0,x.posToDOMRect)(this.view,e.from,e.to);Jt({getBoundingClientRect:()=>t,getClientRects:()=>[t]},this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:e,y:t,strategy:n,middlewareData:r})=>{if(r.hide?.referenceHidden||r.hide?.escaped){this.element.style.visibility=`hidden`;return}this.element.style.visibility=`visible`,this.element.style.width=`max-content`,this.element.style.position=n,this.element.style.left=`${e}px`,this.element.style.top=`${t}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(e,t){let n=!t?.selection.eq(e.state.selection),r=!t?.doc.eq(e.state.doc);this.updateHandler(e,n,r,t)}show(){var e;this.isVisible||(this.element.style.visibility=`visible`,this.element.style.opacity=`1`,(e=(typeof this.appendTo==`function`?this.appendTo():this.appendTo)??this.view.dom.parentElement)==null||e.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0)}hide(){this.isVisible&&(this.element.style.visibility=`hidden`,this.element.style.opacity=`0`,this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}destroy(){this.hide(),this.element.removeEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),window.removeEventListener(`resize`,this.resizeHandler),this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.editor.off(`focus`,this.focusHandler),this.editor.off(`blur`,this.blurHandler),this.editor.off(`transaction`,this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},en=e=>new S.Plugin({key:typeof e.pluginKey==`string`?new S.PluginKey(e.pluginKey):e.pluginKey,view:t=>new $t({view:t,...e})});(0,v.defineComponent)({name:`FloatingMenu`,inheritAttrs:!1,props:{pluginKey:{type:null,default:`floatingMenu`},editor:{type:Object,required:!0},updateDelay:{type:Number,default:void 0},resizeDelay:{type:Number,default:void 0},options:{type:Object,default:()=>({})},appendTo:{type:[Object,Function],default:void 0},shouldShow:{type:Function,default:null}},setup(e,{slots:t,attrs:n}){let r=(0,v.ref)(null);return(0,v.onMounted)(()=>{let{pluginKey:t,editor:n,updateDelay:i,resizeDelay:a,options:o,appendTo:s,shouldShow:c}=e,l=r.value;l&&(l.style.visibility=`hidden`,l.style.position=`absolute`,l.remove(),n.registerPlugin(en({pluginKey:t,editor:n,element:l,updateDelay:i,resizeDelay:a,options:o,appendTo:s,shouldShow:c})))}),(0,v.onBeforeUnmount)(()=>{let{pluginKey:t,editor:n}=e;n.unregisterPlugin(t)}),()=>(0,v.h)(`div`,{ref:r,...n},t.default?.call(t))}});var $=e=>({default:null,parseHTML:t=>t.getAttribute(e),renderHTML:t=>t[e]?{[e]:t[e]}:{}}),tn=()=>{let e=$(`style`);return e.renderHTML=e=>e.style?{style:nn(e.style)}:{},e};function nn(e){return e.replace(/(?<![a-z-])width\s*:\s*([^;]+);?/gi,(e,t)=>/^\s*0\s*[a-z%]*\s*(!important)?\s*$/i.test(t)?`width: 100%;`:e)}var rn=oe.Table.extend({addAttributes(){return{...this.parent?.(),border:$(`border`),cellpadding:$(`cellpadding`),cellspacing:$(`cellspacing`),style:tn()}},renderHTML({HTMLAttributes:e}){return[`table`,(0,x.mergeAttributes)(this.options.HTMLAttributes,e),[`tbody`,0]]}}),an=oe.TableRow.extend({addAttributes(){return{...this.parent?.(),style:$(`style`)}}}),on={style:$(`style`),valign:$(`valign`),width:$(`width`)},sn=oe.TableCell.extend({addAttributes(){return{...this.parent?.(),...on}}}),cn=oe.TableHeader.extend({addAttributes(){return{...this.parent?.(),...on}}}),ln=se.TextStyle.extend({parseHTML(){return[...this.parent?.()||[],{tag:`div`,consuming:!1,getAttrs:e=>e.hasAttribute(`style`)?{}:!1},{tag:`a`,consuming:!1,getAttrs:e=>e.hasAttribute(`style`)?{}:!1}]}}),un={name:`EmojiComponent`,components:{NodeViewWrapper:h.NodeViewWrapper,DtEmoji:p.default},props:h.nodeViewProps};function dn(e,t,n,r,i,a){let o=(0,v.resolveComponent)(`dt-emoji`),s=(0,v.resolveComponent)(`node-view-wrapper`);return(0,v.openBlock)(),(0,v.createBlock)(s,{class:`d-d-inline-block d-va-bottom d-lh0`},{default:(0,v.withCtx)(()=>[(0,v.createVNode)(o,{size:`500`,code:e.node.attrs.code},null,8,[`code`])]),_:1})}var fn=n.t(un,[[`render`,dn]]),pn={name:`SuggestionList`,components:{DtListItem:u.default},props:{items:{type:Array,required:!0},command:{type:Function,required:!0},itemComponent:{type:Object,required:!0},itemType:{type:String,required:!0}},data(){return{selectedIndex:0}},watch:{items(){this.selectedIndex=0}},methods:{onKeyDown({event:e}){return e.key===`ArrowUp`?(this.upHandler(),!0):e.key===`ArrowDown`?(this.downHandler(),!0):e.key===`Enter`||e.key===`Tab`?(this.selectHandler(),!0):!1},upHandler(){this.selectedIndex=(this.selectedIndex+this.items.length-1)%this.items.length,this.scrollActiveElementIntoView()},downHandler(){this.selectedIndex=(this.selectedIndex+1)%this.items.length,this.scrollActiveElementIntoView()},async scrollActiveElementIntoView(){await this.$nextTick();let e=this.$refs.suggestionList.querySelector(`.d-list-item--highlighted`);e&&e.scrollIntoView({behavior:`smooth`,block:`nearest`})},selectHandler(){this.selectItem(this.selectedIndex)},selectItem(e){let t=this.items[e];switch(this.itemType){case`emoji`:this.command(t);return;case`mention`:this.command({name:t.name,id:t.id,avatarSrc:t.avatarSrc,contactKey:t.contactKey});break;case`channel`:this.command({name:t.name,id:t.id,locked:t.locked,channelKey:t.channelKey});break;case`slash-command`:this.command({command:t.command});break}}}},mn={class:`d-popover__dialog d-suggestion-list__container`},hn={ref:`suggestionList`,class:`d-suggestion-list`};function gn(e,t,n,r,i,a){let o=(0,v.resolveComponent)(`dt-list-item`);return(0,v.openBlock)(),(0,v.createElementBlock)(`div`,mn,[(0,v.withDirectives)((0,v.createElementVNode)(`ul`,hn,[((0,v.openBlock)(!0),(0,v.createElementBlock)(v.Fragment,null,(0,v.renderList)(n.items,(e,t)=>((0,v.openBlock)(),(0,v.createBlock)(o,{key:e.id,class:(0,v.normalizeClass)([`d-suggestion-list__item`,{"d-list-item--highlighted":t===i.selectedIndex}]),"navigation-type":`arrow-keys`,onClick:e=>a.selectItem(t),onKeydown:(0,v.withModifiers)(a.onKeyDown,[`prevent`])},{default:(0,v.withCtx)(()=>[((0,v.openBlock)(),(0,v.createBlock)((0,v.resolveDynamicComponent)(n.itemComponent),{item:e},null,8,[`item`]))]),_:2},1032,[`class`,`onClick`,`onKeydown`]))),128))],512),[[v.vShow,n.items.length]])])}var _n=n.t(pn,[[`render`,gn]]),vn=`top-start`;function yn(){return{getBoundingClientRect:()=>({width:0,height:0,x:0,y:0,top:0,left:0,right:0,bottom:0})}}function bn(e){return{getBoundingClientRect:e}}async function xn(e,t,n={}){if(!e||!t?.getBoundingClientRect)return;let{placement:r=vn,middleware:i=[Bt(0),Ut(),Ht({padding:8})]}=n,{x:a,y:o}=await Jt(t,e,{placement:r,middleware:i});Object.assign(e.style,{left:`${a}px`,top:`${o}px`})}function Sn(e,t={}){let{zIndex:n=`650`}=t;e.style.position=`absolute`,e.style.zIndex=n,e.style.display=`none`}function Cn(e){e&&(e.style.display=`block`)}function wn(e){e&&(e.style.display=`none`)}function Tn(e,t){return n=>{n.key===`Escape`&&t()&&e()}}function En(e){document.addEventListener(`keydown`,e)}function Dn(e){document.removeEventListener(`keydown`,e)}function On(e,t,n,r){return new h.VueRenderer(e,{props:{itemComponent:(0,v.markRaw)(t),itemType:n,...r},editor:r.editor})}function kn(e){e.escHandler&&Dn(e.escHandler),e.floatingEl?.remove(),e.component?.destroy()}function An(e,t,n={}){let{listComponent:r=_n,placement:i=vn,zIndex:a=`650`}=n;return()=>{let n=null,o=null,s=!1,c=yn(),l=null;function u(){xn(o,c,{placement:i})}function d(){o&&(Cn(o),s=!0,u())}function f(){o&&(wn(o),s=!1)}return{onStart:i=>{n=On(r,e,t,i),i.clientRect&&(o=n.element,Sn(o,{zIndex:a}),document.body.appendChild(o),c=bn(i.clientRect),l=Tn(f,()=>s),En(l),i.items.length>0&&d())},onUpdate(e){n?.updateProps(e),e.items.length>0?d():f(),e.clientRect&&(c=bn(e.clientRect),u())},onKeyDown(e){if(s)return n?.ref?.onKeyDown(e)},onExit(){kn({escHandler:l,floatingEl:o,component:n}),l=null,o=null,n=null}}}}var jn={name:`EmojiSuggestion`,components:{DtEmoji:p.default,DtStack:d.default},props:{item:{type:Object,required:!0}}};function Mn(e,t,n,r,i,a){let o=(0,v.resolveComponent)(`dt-emoji`),s=(0,v.resolveComponent)(`dt-stack`);return(0,v.openBlock)(),(0,v.createBlock)(s,{direction:`row`,gap:`100`},{default:(0,v.withCtx)(()=>[(0,v.createVNode)(o,{size:`200`,code:n.item.code},null,8,[`code`]),(0,v.createTextVNode)(` `+(0,v.toDisplayString)(n.item.code),1)]),_:1})}var Nn=n.t(jn,[[`render`,Mn]]),Pn=20,Fn=(e,t,n)=>{let r=e.shortname?.replaceAll(`:`,``),i=t.shortname?.replaceAll(`:`,``),a=r.startsWith(n),o=i.startsWith(n);return a&&!o?-1:!a&&o?1:r.localeCompare(i)},In={items:({query:e})=>{if(e.length<2)return[];let t=Object.values(r.getEmojiData());return e=e.toLowerCase(),t.filter(t=>[t.name,t.shortname?.replaceAll(`:`,``),...t.keywords||[]].some(t=>t&&t.startsWith(e))).splice(0,Pn).sort((t,n)=>Fn(t,n,e)).map(e=>({code:e.shortname}))},command:({editor:e,range:t,props:n})=>{e.view.state.selection.$to.nodeAfter?.text?.startsWith(` `)&&(t.to+=1),e.chain().focus().insertContentAt(t,[{type:`emoji`,attrs:n}]).run(),window.getSelection()?.collapseToEnd()},render:An(Nn,`emoji`)},Ln=/(:\w+:)$/,Rn=RegExp(b.emojiPattern+`$`),zn=e=>{if(e&&r.codeToEmojiData(e[0]))return{text:e[2]||e[0]}},Bn=e=>[...e.matchAll(r.emojiShortCodeRegex)].filter(e=>r.codeToEmojiData(e[0])).map(e=>({index:e.index,text:e[0],match:e})),Vn=x.Node.create({name:`emoji`,addOptions(){return{HTMLAttributes:{}}},group:`inline`,inline:!0,selectable:!1,atom:!0,addNodeView(){return h.VueNodeViewRenderer(fn)},addAttributes(){return{code:{default:null}}},parseHTML(){return[{tag:`emoji-component`}]},renderText({node:e}){return r.stringToUnicode(r.codeToEmojiData(e.attrs.code).unicode_output)},renderHTML({HTMLAttributes:e}){return[`emoji-component`,(0,x.mergeAttributes)(this.options.HTMLAttributes,e)]},addInputRules(){return[new x.InputRule({find:e=>{let t=e.match(Ln)||e.match(Rn);if(t)return zn(t)},handler:({state:e,range:t,match:n})=>{let{tr:r}=e,i=t.from,a=t.to;r.replaceWith(i,a,this.type.create({code:n[0]}))}})]},addPasteRules(){return[(0,x.nodePasteRule)({find:Bn,type:this.type,getAttributes(e){return{code:e[0]}}}),(0,x.nodePasteRule)({find:r.emojiRegex,type:this.type,getAttributes(e){return{code:e[0]}}})]},addProseMirrorPlugins(){return[(0,ce.default)({char:`:`,pluginKey:new S.PluginKey(`emoji`),editor:this.editor,...this.options.suggestion,...In})]},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:e,state:t})=>{let n=!1,{selection:r}=t,{empty:i,anchor:a}=r;return i?(t.doc.nodesBetween(a-1,a,(t,r)=>{if(t.type.name===this.name)return n=!0,e.insertText(``,r,r+t.nodeSize),!1}),n):!1})}}});function Hn(e,t,n=()=>!0){let r=[];t.lastIndex=0;let i;for(;i=t.exec(e);)n(e,i)&&r.push(i);return r}function Un(e,t){return![`#`,`@`].includes(e.charAt(t.index))&&![`#`,`@`].includes(e.charAt(t.index-1))}function Wn(e){let t=RegExp(`(?:`+[`[!?.,:;'"]`,`(?:&|&amp;)(?:lt|gt|quot|apos|raquo|laquo|rsaquo|lsaquo);)+$`].join(`|`),`g`);return e.replace(t,``)}function Gn(e,t){let n=e.slice(0,t+1).search(/\S+\s*$/),r=e.slice(t).search(/\s/);if(r<0){let t=e.slice(n);return{text:t,from:n,to:n+t.length}}return{text:e.slice(n,r+t),from:n,to:r+t}}function Kn(e,t,n,r){let i=Gn(e,t);if(r.lastIndex=0,!r.test(i.text))return i;let a=n===`left`?i.from-1:i.to+1;return a<=0||a>=e.length||a===t?i:Kn(e,a,n,r)}function qn(e,t,n,r){let i=(0,x.getMarksBetween)(Math.max(e.from-1,0),Math.min(e.to+1,t.content.size),t);for(let e of i)e.mark.type===r&&n.removeMark(e.from,e.to,r)}var Jn=t.getPhoneNumberRegex(1,15);function Yn(e,n,r,i,a,o){if(!e)return;let s=r-n-1;s=s<0?0:s;let c=i-n,l=Kn(e,s,`left`,Jn),u=Kn(e,c,`right`,Jn);Hn(e.slice(l.from,u.to),t.linkRegex,Un).forEach(e=>{let t=Wn(e[0]),r=n+l.from+e.index+1,i=r+t.length;a.addMark(r,i,o.create())})}function Xn(e){let t=!1;return new S.Plugin({key:new S.PluginKey(`autolink`),appendTransaction:(n,r,i)=>{let a=n.some(e=>e.docChanged)&&!r.doc.eq(i.doc);if(t&&!a)return;let{tr:o}=i,{textContent:s}=i.doc;if(!t||!r.doc.textContent)return Yn(s,0,0,s.length,o,e.type),t=!0,o;t=!0;let c=(0,x.getChangedRanges)((0,x.combineTransactionSteps)(r.doc,[...n]));return c.length?(c.forEach(({oldRange:t,newRange:n})=>{if(n.from===n.to){Yn(s,0,0,s.length,o,e.type);return}qn(n,i.doc,o,e.type),(0,x.findChildrenInRange)(i.doc,n,e=>e.isTextblock).forEach(({node:r,pos:i})=>{Yn(r.textContent,i,t.from,n.to,o,e.type)})}),o):(Yn(s,0,0,s.length,o,e.type),o)}})}var Zn={class:`d-link d-c-text d-d-inline-block d-wb-break-all`,rel:`noopener noreferrer nofollow`},Qn=x.Mark.create({name:`CustomLink`,renderHTML({HTMLAttributes:e}){return[`a`,(0,x.mergeAttributes)(this.options.HTMLAttributes,e,Zn)]},renderText({node:e}){return e.attrs.text},addProseMirrorPlugins(){return[Xn({type:this.type})]}}),$n=x.Mark.create({name:`LinkPhoneNumbers`,renderHTML({HTMLAttributes:e}){return[`a`,(0,x.mergeAttributes)(e,{class:`d-link d-c-pointer d-d-inline-block d-wb-break-all`,rel:`noopener noreferrer nofollow`})]},addProseMirrorPlugins(){let e=this.editor,t=this.type;return[new S.Plugin({key:new S.PluginKey(`phoneClick`),props:{handleClick(n,r,i){let{state:a}=n,o=a.doc.resolve(r);if(!o.marks().some(e=>e.type===t))return!1;let s=(0,x.getMarkRange)(o,t),c=s?a.doc.textBetween(s.from,s.to):``;return i.preventDefault(),e.emit(`phone-click`,{phoneNumber:c}),!0}}})]}}),er=le.default.extend({name:`ConfigurableImage`,addAttributes(){return{src:{default:``},alt:{default:void 0},title:{default:void 0},width:{default:void 0},height:{default:void 0},style:{default:void 0}}}}).configure({inline:!0,allowBase64:!0}),tr=new Set(`address.article.aside.blockquote.dd.details.dialog.div.dl.dt.fieldset.figcaption.figure.footer.form.h1.h2.h3.h4.h5.h6.header.hgroup.hr.li.main.nav.ol.p.pre.section.table.ul`.split(`.`)),nr=k.default.extend({parseHTML(){return[{tag:`div`,getAttrs:e=>{for(let t of e.children)if(tr.has(t.tagName.toLowerCase()))return!1;return null}}]},renderHTML({HTMLAttributes:e}){return[`div`,(0,x.mergeAttributes)(this.options.HTMLAttributes,e),0]}}),rr={name:`MentionComponent`,components:{NodeViewWrapper:h.NodeViewWrapper,DtLink:s.default},props:h.nodeViewProps,computed:{text(){return`@`+this.$props.node.attrs.name}},methods:{getMentionData(){return{name:this.$props.node.attrs.name,id:this.$props.node.attrs.id,avatarSrc:this.$props.node.attrs.avatarSrc,contactKey:this.$props.node.attrs.contactKey}},handleClick(){this.$props.editor.emit(`mention-click`,this.getMentionData())},handleMouseEnter(e){this.$props.editor.emit(`mention-hover`,{...this.getMentionData(),event:e})},handleMouseLeave(e){this.$props.editor.emit(`mention-leave`,{...this.getMentionData(),event:e})}}};function ir(e,t,n,r,i,a){let o=(0,v.resolveComponent)(`dt-link`),s=(0,v.resolveComponent)(`node-view-wrapper`);return(0,v.openBlock)(),(0,v.createBlock)(s,{class:`d-d-inline-block`},{default:(0,v.withCtx)(()=>[(0,v.createVNode)(o,{kind:`mention`,onClick:(0,v.withModifiers)(a.handleClick,[`prevent`]),onMouseenter:a.handleMouseEnter,onMouseleave:a.handleMouseLeave,onFocusin:a.handleMouseEnter,onFocusout:a.handleMouseLeave},{default:(0,v.withCtx)(()=>[(0,v.createTextVNode)((0,v.toDisplayString)(a.text),1)]),_:1},8,[`onClick`,`onMouseenter`,`onMouseleave`,`onFocusin`,`onFocusout`])]),_:1})}var ar=n.t(rr,[[`render`,ir]]),or=N.default.extend({addNodeView(){return h.VueNodeViewRenderer(ar)},parseHTML(){return[{tag:`mention-component`}]},addAttributes(){return{name:{default:``},avatarSrc:{default:``},id:{default:``},contactKey:{default:``}}},renderText({node:e}){return`@${e.attrs.id}`},renderHTML({HTMLAttributes:e}){return[`mention-component`,(0,x.mergeAttributes)(this.options.HTMLAttributes,e)]}}).configure({suggestion:{char:`@`,pluginKey:new S.PluginKey(`mentionSuggestion`)}}),sr={name:`ChannelComponent`,components:{NodeViewWrapper:h.NodeViewWrapper,DtLink:s.default,DtIconLock:y.DtIconLock,DtStack:d.default},props:h.nodeViewProps,computed:{text(){return this.$props.node.attrs.locked?this.$props.node.attrs.name:`#`+this.$props.node.attrs.name}},methods:{handleClick(){let e={name:this.$props.node.attrs.name,id:this.$props.node.attrs.id,locked:this.$props.node.attrs.locked,channelKey:this.$props.node.attrs.channelKey};this.$props.editor.emit(`channel-click`,e)}}};function cr(e,t,n,r,i,a){let o=(0,v.resolveComponent)(`dt-icon-lock`),s=(0,v.resolveComponent)(`dt-stack`),c=(0,v.resolveComponent)(`dt-link`),l=(0,v.resolveComponent)(`node-view-wrapper`);return(0,v.openBlock)(),(0,v.createBlock)(l,{class:`d-d-inline-block`},{default:(0,v.withCtx)(()=>[(0,v.createVNode)(c,{kind:`mention`,onClick:(0,v.withModifiers)(a.handleClick,[`prevent`])},{default:(0,v.withCtx)(()=>[(0,v.createVNode)(s,{direction:`row`,gap:`0`},{default:(0,v.withCtx)(()=>[e.$props.node.attrs.locked?((0,v.openBlock)(),(0,v.createBlock)(o,{key:0,size:`200`})):(0,v.createCommentVNode)(``,!0),(0,v.createElementVNode)(`span`,null,(0,v.toDisplayString)(a.text),1)]),_:1})]),_:1},8,[`onClick`])]),_:1})}var lr=n.t(sr,[[`render`,cr]]),ur=N.default.extend({name:`channel`,addNodeView(){return h.VueNodeViewRenderer(lr)},parseHTML(){return[{tag:`channel-component`}]},addAttributes(){return{name:{default:``},id:{default:``},locked:{default:!1},channelKey:{default:``}}},renderText({node:e}){return`#${e.attrs.id}`},renderHTML({HTMLAttributes:e}){return[`channel-component`,(0,x.mergeAttributes)(this.options.HTMLAttributes,e)]}}).configure({suggestion:{char:`#`,pluginKey:new S.PluginKey(`channelSuggestion`)}}),dr={name:`SlashCommandsComponent`,components:{NodeViewWrapper:h.NodeViewWrapper},props:{...h.nodeViewProps},emits:[`selected-command`],computed:{text(){return`/`+this.$props.node.attrs.command}},created(){let e=this.$props.node.attrs.command;this.$emit(`selected-command`,e);let t=this.editor?.storage?.[`slash-commands`]?.onSelectedCommand;t&&typeof t==`function`&&t(e)}};function fr(e,t,n,r,i,a){let o=(0,v.resolveComponent)(`node-view-wrapper`);return(0,v.openBlock)(),(0,v.createBlock)(o,{class:`d-d-inline-block`},{default:(0,v.withCtx)(()=>[(0,v.createTextVNode)((0,v.toDisplayString)(a.text),1)]),_:1})}var pr=n.t(dr,[[`render`,fr]]),mr=(e,t)=>[...e.matchAll(t)].map(e=>{let t=e[2];return t.endsWith(` `)||(t+=` `),{index:e.index,text:t,match:e}}),hr=N.default.extend({name:`slash-commands`,group:`inline`,inline:!0,addOptions(){return{...this.parent?.(),onSelectedCommand:null}},addStorage(){return{onSelectedCommand:this.options.onSelectedCommand}},addNodeView(){return h.VueNodeViewRenderer(pr)},parseHTML(){return[{tag:`command-component`}]},addAttributes(){return{command:{default:``},parametersExample:{default:``},description:{default:``}}},renderText({node:e}){return`/${e.attrs.command}`},renderHTML({HTMLAttributes:e}){return[`command-component`,(0,x.mergeAttributes)(this.options.HTMLAttributes,e)]},addInputRules(){let e=this.options.suggestion?.items({query:``}).map(e=>e.command);return[(0,x.nodeInputRule)({find:RegExp(`^((?:\\/)(${e.join(`|`)})) $`),type:this.type,getAttributes(e){return{command:e[2]}}})]},addPasteRules(){let e=this.options.suggestion?.items({query:``}).map(e=>e.command),t=RegExp(`^((?:\\/)(${e.join(`|`)})) ?$`,`g`);return[(0,x.nodePasteRule)({find:e=>mr(e,t),type:this.type,getAttributes(e){return{command:e[0].trim()}}})]}}).configure({suggestion:{char:`/`,pluginKey:new S.PluginKey(`slashCommandSuggestion`)}}),gr=100,_r={name:`VariableComponent`,components:{DtBadge:a.default,DtButton:l.default,DtPopover:f.default,DtInput:m.default,NodeViewWrapper:h.NodeViewWrapper},props:h.nodeViewProps,data(){return{i18n:new c.DialtoneLocalization,MAX_VARIABLE_ALT_LENGTH:gr}},computed:{altText:{get(){return this.node?.attrs?.altText||``},set(e){this.updateAttributes({altText:e})}},variableId(){return this.node?.attrs?.id},placeholder(){return this.variableData?.placeholder||``},variableItems(){return this.extension?.options?.variableItems||[]},variableData(){return this.variableItems.find(e=>e.id===this.variableId)},enableAltText(){return this.node?.attrs?.enableAltText},badgeLabel(){return`{} ${this.placeholder}`},placeholderText(){return`Replaces ${this.placeholder}`}}};function vr(e,t,n,r,i,a){let o=(0,v.resolveComponent)(`dt-badge`),s=(0,v.resolveComponent)(`dt-button`),c=(0,v.resolveComponent)(`dt-input`),l=(0,v.resolveComponent)(`dt-popover`),u=(0,v.resolveComponent)(`node-view-wrapper`);return(0,v.openBlock)(),(0,v.createBlock)(u,{class:`d-d-inline-block`},{default:(0,v.withCtx)(()=>[a.enableAltText?((0,v.openBlock)(),(0,v.createBlock)(l,{key:0,padding:`small`,"navigation-type":`arrow-keys`,placement:`top-start`,modal:!1},{anchor:(0,v.withCtx)(({attrs:e})=>[(0,v.createVNode)(s,(0,v.mergeProps)(e,{kind:`unstyled`}),{default:(0,v.withCtx)(()=>[(0,v.createVNode)(o,{text:a.badgeLabel,contenteditable:`false`},null,8,[`text`])]),_:1},16)]),content:(0,v.withCtx)(({close:e})=>[(0,v.createVNode)(c,{modelValue:a.altText,"onUpdate:modelValue":t[0]||(t[0]=e=>a.altText=e),class:`d-p-100 d-w332`,label:i.i18n.$t(`DIALTONE_EDITOR_VARIABLE_LABEL`),placeholder:a.placeholderText,validate:{length:{description:i.i18n.$t(`DIALTONE_EDITOR_VARIABLE_VALIDATE_DESCRIPTION`),message:i.i18n.$t(`DIALTONE_EDITOR_VARIABLE_VALIDATE_MESSAGE`),max:i.MAX_VARIABLE_ALT_LENGTH,warn:i.MAX_VARIABLE_ALT_LENGTH,limitMaxLength:!0}},onKeyup:(0,v.withKeys)(t=>e(),[`enter`])},null,8,[`modelValue`,`label`,`placeholder`,`validate`,`onKeyup`])]),_:1})):((0,v.openBlock)(),(0,v.createBlock)(o,{key:1,text:a.badgeLabel,contenteditable:`false`},null,8,[`text`]))]),_:1})}var yr=n.t(_r,[[`render`,vr]]),br=x.Node.create({name:`variable`,group:`inline`,inline:!0,selectable:!0,atom:!0,addOptions(){return{HTMLAttributes:{},variableItems:[]}},addNodeView(){return h.VueNodeViewRenderer(yr)},addAttributes(){return{id:{default:null,parseHTML:e=>e.getAttribute(`data-variable-id`),renderHTML:e=>e.id?{"data-variable-id":e.id}:{}},altText:{default:``,parseHTML:e=>e.getAttribute(`data-alt-text`),renderHTML:e=>e.altText?{"data-alt-text":e.altText}:{}},enableAltText:{default:!0,parseHTML:e=>e.getAttribute(`data-enable-alt-text`)===`true`,renderHTML:e=>({"data-enable-alt-text":String(e.enableAltText)})}}},parseHTML(){return[{tag:`variable`}]},renderText({node:e}){return e.attrs.altText},renderHTML({node:e,HTMLAttributes:t}){return[`variable`,(0,x.mergeAttributes)(this.options.HTMLAttributes,t,{"data-variable-id":e.attrs.id,"data-alt-text":e.attrs.altText,"data-enable-alt-text":String(e.attrs.enableAltText)})]},addCommands(){return{insertVariable:(e={})=>({commands:t})=>t.insertContent({type:this.name,attrs:{id:e.id||null,altText:e.altText||``,enableAltText:e.enableAltText}})}}}),xr={name:`MentionSuggestion`,components:{DtAvatar:i.default,DtStack:d.default,DtText:o.default},props:{item:{type:Object,required:!0}},computed:{name(){return this.item.name},avatarSrc(){return this.item.avatarSrc},presence(){return this.item.presence},status(){return this.item.status},presenceText(){return this.item.presenceText},presenceFontColorClass(){return{active:`d-recipe-contact-row--active`,busy:`d-recipe-contact-row--busy`,away:`d-recipe-contact-row--away`,offline:`d-recipe-contact-row--busy`}[this.presence]},showDetails(){return this.item.showDetails}}},Sr={class:`d-mention-suggestion__name`};function Cr(e,t,n,r,i,a){let o=(0,v.resolveComponent)(`dt-avatar`),s=(0,v.resolveComponent)(`dt-text`),c=(0,v.resolveComponent)(`dt-stack`);return(0,v.openBlock)(),(0,v.createBlock)(c,{direction:`row`,class:`d-mention-suggestion__container`,gap:`100`},{default:(0,v.withCtx)(()=>[(0,v.createVNode)(o,{"full-name":a.name,"image-src":a.avatarSrc,"image-alt":a.name,"show-presence":a.showDetails,presence:a.presence,size:200},null,8,[`full-name`,`image-src`,`image-alt`,`show-presence`,`presence`]),(0,v.createVNode)(c,{class:`d-mention-suggestion__details-container`,gap:`1`},{default:(0,v.withCtx)(()=>[(0,v.createElementVNode)(`span`,Sr,(0,v.toDisplayString)(a.name),1),a.showDetails?((0,v.openBlock)(),(0,v.createBlock)(c,{key:0,direction:`row`,gap:`50`},{default:(0,v.withCtx)(()=>[a.presenceText?((0,v.openBlock)(),(0,v.createBlock)(s,{key:0,kind:`label`,size:200,strength:`normal`,class:(0,v.normalizeClass)([`d-mention-suggestion__presence`,[a.presenceFontColorClass]])},{default:(0,v.withCtx)(()=>[(0,v.createTextVNode)((0,v.toDisplayString)(a.presenceText),1)]),_:1},8,[`class`])):(0,v.createCommentVNode)(``,!0),a.status&&a.presenceText?((0,v.openBlock)(),(0,v.createBlock)(s,{key:1,kind:`label`,size:200,strength:`normal`,as:`div`,class:`d-mention-suggestion__divider`},{default:(0,v.withCtx)(()=>[...t[0]||(t[0]=[(0,v.createTextVNode)(` • `,-1)])]),_:1})):(0,v.createCommentVNode)(``,!0),a.status?((0,v.openBlock)(),(0,v.createBlock)(s,{key:2,kind:`label`,size:200,strength:`normal`,as:`div`,class:`d-mention-suggestion__status`},{default:(0,v.withCtx)(()=>[(0,v.createTextVNode)((0,v.toDisplayString)(a.status),1)]),_:1})):(0,v.createCommentVNode)(``,!0)]),_:1})):(0,v.createCommentVNode)(``,!0)]),_:1})]),_:1})}var wr={allowSpaces:!0,render:An(n.t(xr,[[`render`,Cr]]),`mention`)},Tr={name:`ChannelSuggestion`,components:{DtStack:d.default,DtIconHash:ue.default,DtIconLock:de.default},props:{item:{type:Object,required:!0}},computed:{name(){return this.item.name}}};function Er(e,t,n,r,i,a){let o=(0,v.resolveComponent)(`dt-icon-hash`),s=(0,v.resolveComponent)(`dt-icon-lock`),c=(0,v.resolveComponent)(`dt-stack`);return(0,v.openBlock)(),(0,v.createBlock)(c,{direction:`row`,gap:`400`},{default:(0,v.withCtx)(()=>[n.item.locked?((0,v.openBlock)(),(0,v.createBlock)(s,{key:1,size:`300`})):((0,v.openBlock)(),(0,v.createBlock)(o,{key:0,size:`300`})),(0,v.createElementVNode)(`span`,null,(0,v.toDisplayString)(a.name),1)]),_:1})}var Dr={allowSpaces:!0,render:An(n.t(Tr,[[`render`,Er]]),`channel`)},Or={name:`SlashCommandSuggestion`,components:{DtText:o.default},props:{item:{type:Object,required:!0}},computed:{command(){return this.item.command},description(){return this.item.description},parametersExample(){return this.item.parametersExample}}},kr={key:0};function Ar(e,t,n,r,i,a){let o=(0,v.resolveComponent)(`dt-text`);return(0,v.openBlock)(),(0,v.createElementBlock)(`div`,null,[(0,v.createVNode)(o,{kind:`body`,size:300,density:300,as:`div`},{default:(0,v.withCtx)(()=>[(0,v.createElementVNode)(`span`,null,`/`+(0,v.toDisplayString)(a.command),1),a.parametersExample?((0,v.openBlock)(),(0,v.createElementBlock)(`span`,kr,(0,v.toDisplayString)(a.parametersExample),1)):(0,v.createCommentVNode)(``,!0)]),_:1}),(0,v.createVNode)(o,{kind:`body`,size:200,tone:`tertiary`,as:`div`},{default:(0,v.withCtx)(()=>[(0,v.createTextVNode)((0,v.toDisplayString)(a.description),1)]),_:1})])}var jr={allowSpaces:!0,startOfLine:!0,render:An(n.t(Or,[[`render`,Ar]]),`slash-command`)},Mr={name:`DtRichTextEditor`,components:{EditorContent:h.EditorContent,BubbleMenu:Qt,DtButton:l.default,DtStack:d.default},props:{modelValue:{type:[Object,String],default:``},editable:{type:Boolean,default:!0},allowTyping:{type:Boolean,default:!0},pasteRichText:{type:Boolean,default:!0},allowLineBreaks:{type:Boolean,default:!1},inputAriaLabel:{type:String,required:!0},inputClass:{type:String,default:``},autoFocus:{type:[Boolean,String,Number],default:!1,validator(e){return typeof e==`string`?g.RICH_TEXT_EDITOR_AUTOFOCUS_TYPES.includes(e):!0}},outputFormat:{type:String,default:`html`,validator(e){return g.RICH_TEXT_EDITOR_OUTPUT_FORMATS.includes(e)}},placeholder:{type:String,default:``},link:{type:[Boolean,Object],default:!1},customLink:{type:[Boolean,Object],default:!1},linkPhoneNumbers:{type:Array,default:null},mentionSuggestion:{type:Object,default:null},channelSuggestion:{type:Object,default:null},slashCommandSuggestion:{type:Object,default:null},allowBlockquote:{type:Boolean,default:!0},allowBold:{type:Boolean,default:!0},allowBulletList:{type:Boolean,default:!0},allowItalic:{type:Boolean,default:!0},allowStrike:{type:Boolean,default:!0},allowUnderline:{type:Boolean,default:!0},allowCode:{type:Boolean,default:!0},allowCodeblock:{type:Boolean,default:!0},allowInlineImages:{type:Boolean,default:!1},allowFontColor:{type:Boolean,default:!1},allowBackgroundColor:{type:Boolean,default:!1},allowFontSize:{type:Boolean,default:!1},allowFontFamily:{type:Boolean,default:!1},allowLineHeight:{type:Boolean,default:!1},allowVariable:{type:Boolean,default:!1},variableItems:{type:Array,default:()=>[]},additionalExtensions:{type:Array,default:()=>[]},showLinkBubbleMenu:{type:Boolean,default:!0},preserveWhitespace:{type:[Boolean,String],default:`full`},useDivTags:{type:Boolean,default:!1},allowTables:{type:Boolean,default:!1},allowTextAlign:{type:Boolean,default:!0},allowImageResize:{type:Boolean,default:!1}},emits:[`update:modelValue`,`json-input`,`html-input`,`text-input`,`markdown-input`,`blur`,`focus`,`enter`,`edit-link`,`selected`,`selected-command`,`mention-click`,`mention-hover`,`mention-leave`,`channel-click`,`phone-click`],data(){return{editor:null,appendTo:()=>t.returnFirstEl(this.$refs.editor.$el).getRootNode()?.querySelector(`body`),floatingOptions:{placement:`top-start`},i18n:new c.DialtoneLocalization}},computed:{attrs(){return{...this.$attrs,onInput:()=>{},onFocus:()=>{},onBlur:()=>{}}},extensions(){let e=[D.default,ie.default,O.UndoRedo,ee.default];e.push(this.useDivTags?nr:k.default),this.allowBold&&e.push(A.default),this.allowBlockquote&&e.push(w.default),this.allowBulletList&&(e.push(j.BulletList),e.push(j.ListItem.extend({renderText({node:e}){return e.textContent}})),e.push(j.OrderedList)),this.allowItalic&&e.push(M.default),this.allowStrike&&e.push(ne.default),this.allowUnderline&&e.push(re.default),this.placeholder&&e.push(O.Placeholder.configure({placeholder:this.placeholder}));let t=this,n=x.Extension.create({addKeyboardShortcuts(){return{"Shift-Enter":({editor:e})=>t.allowLineBreaks?!1:(e.commands.first(({commands:e})=>[()=>e.newlineInCode(),()=>t.allowBulletList&&e.splitListItem(`listItem`),()=>e.createParagraphNear(),()=>e.liftEmptyBlock(),()=>e.splitBlock()]),!0),Enter:()=>t.allowLineBreaks?!1:(t.$emit(`enter`),!0)}}});if(e.push(n),this.link&&e.push(te.default.extend({inclusive:!1,addKeyboardShortcuts(){return{"Mod-k":()=>(t.$emit(`edit-link`),!0)}}}).configure({HTMLAttributes:{class:`d-link d-wb-break-all`},openOnClick:!1,autolink:!this.customLink,protocols:g.RICH_TEXT_EDITOR_SUPPORTED_LINK_PROTOCOLS})),this.customLink&&e.push(this.getExtension(Qn,this.customLink)),this.linkPhoneNumbers!==null&&e.push($n),this.mentionSuggestion){let t={...this.mentionSuggestion,...wr};e.push(or.configure({suggestion:t}))}if(this.channelSuggestion){let t={...this.channelSuggestion,...Dr};e.push(ur.configure({suggestion:t}))}if(this.slashCommandSuggestion){let t={...this.slashCommandSuggestion,...jr};e.push(hr.configure({suggestion:t,onSelectedCommand:e=>{this.$emit(`selected-command`,e)}}))}return this.allowVariable&&e.push(br.configure({variableItems:this.variableItems})),e.push(Vn),this.allowTextAlign&&e.push(ae.default.configure({types:[`paragraph`]})),this.allowCode&&e.push(E.default),this.allowCodeblock&&e.push(T.default.extend({renderText({node:e,pos:t,range:n}){let r=n?.from??0,i=n?.to??t+e.nodeSize;if(r<=t&&i>=t+e.nodeSize)return`\`\`\`\n${e.textContent}\n\`\`\``;let a=Math.max(0,r-t-1),o=Math.min(e.textContent.length,i-t-1);return e.textContent.slice(a,o)},addCommands(){return{...this.parent?.(),toggleCodeBlock:(e={})=>({state:t,chain:n,commands:r})=>{let i=t.schema.nodes[this.name],{$from:a}=t.selection;if(a.parent.type===i){let e=t.schema.nodes.paragraph,r=a.parent.textContent.split(`
2
2
  `),i=a.before(),o=a.parent;return n().command(({tr:n})=>{let a=r.map(n=>e.create({},n?[t.schema.text(n)]:[]));return n.replaceWith(i,i+o.nodeSize,a),!0}).run()}let{from:o,to:s}=t.selection,c=[];if(t.doc.nodesBetween(o,s,(e,t)=>{if(e.isTextblock)return c.push({node:e,pos:t}),!1}),c.length<=1)return r.setNode(this.name,e);let l=c.map(({node:e})=>e.textContent).join(`
3
- `),u=c[0].pos,d=c[c.length-1],f=d.pos+d.node.nodeSize;return n().command(({tr:n})=>{let r=l.length?[t.schema.text(l)]:[];return n.replaceWith(u,f,i.create(e,r)),!0}).run()}}}}).configure({HTMLAttributes:{class:`d-rich-text-editor__code-block`}})),this.allowInlineImages&&e.push(er.configure({resize:{enabled:this.allowImageResize,alwaysPreserveAspectRatio:!0}})),(this.allowFontFamily||this.allowFontColor||this.allowFontSize||this.allowBackgroundColor||this.allowLineHeight)&&(e.push(se.TextStyleKit.configure({color:this.allowFontColor,backgroundColor:this.allowBackgroundColor,fontFamily:this.allowFontFamily,fontSize:this.allowFontSize,lineHeight:this.allowLineHeight})),e.push(ln)),this.additionalExtensions.length&&e.push(...this.additionalExtensions),this.allowTables&&e.push(rn.configure({resizable:!0}),an,cn,sn,O.Gapcursor),e},inputAttrs(){let e={"aria-label":this.inputAriaLabel,"aria-multiline":!0,role:`textbox`};return this.editable||(e[`aria-readonly`]=!0),e}},watch:{editable(e){this.editor.setEditable(e),this.updateEditorAttributes({"aria-readonly":!e})},inputClass(e){this.updateEditorAttributes({class:e})},inputAriaLabel(e){this.updateEditorAttributes({"aria-label":e})},extensions(){this.destroyEditor(),this.createEditor()},modelValue(e){this.processValue(e)},linkPhoneNumbers(){this._applyPhoneMarks()}},created(){this.createEditor()},beforeUnmount(){this.destroyEditor()},mounted(){t.warnIfUnmounted(t.returnFirstEl(this.$el),this.$options.name),this.processValue(this.modelValue,!1)},methods:{createEditor(){this.editor=new h.Editor({autofocus:this.autoFocus,content:this.modelValue,editable:this.editable,extensions:this.extensions,shouldRerenderOnTransaction:!1,parseOptions:{preserveWhitespace:this.preserveWhitespace},editorProps:{attributes:{...this.inputAttrs,class:this.inputClass},handleKeyDown:(e,t)=>{if(this.allowTyping)return!1;let n=[`Backspace`];return!this.allowLineBreaks&&!t.shiftKey&&n.push(`Enter`),!n.includes(t.key)},handlePaste:(e,t)=>{let n=t.clipboardData||window.clipboardData,r=n.getData(`text/plain`),i=n.getData(`text/html`);return this.processPasteData(e,r,i)},transformPastedHTML(e){return e.replace(/<hr[^>]*\/?>/gi,`<p><br></p>`).replace(/(<\/\w+>)((<br \/>)+)/g,`$2$1`)}}}),this.addEditorListeners()},bubbleMenuShouldShow({editor:e}){return this.showLinkBubbleMenu&&e.isActive(`link`)},getSelectedLinkText(e){let{view:t,state:n}=e,{from:r,to:i}=t.state.selection,a=n.doc.textBetween(r,i,``),o=this.editor.state.doc.nodeAt(r);return o&&o.marks?.at(0)?.type?.name===`link`?o.textContent:a},editLink(){let e=this.getSelectedLinkText(this.editor),t={href:this.editor.getAttributes(`link`).href,text:e};this.$emit(`edit-link`,t)},removeLink(){this.editor?.chain()?.focus()?.unsetLink()?.run()},openLink(){this.editor?.chain()?.focus();let e=this.editor.getAttributes(`link`).href;window.open(e,`_blank`)},setLink(e,t,n,r=g.RICH_TEXT_EDITOR_SUPPORTED_LINK_PROTOCOLS,i){if(!e){this.removeLink();return}r.find(t=>t.test(e))||(e=`${i}${e}`),this.editor.chain().focus().extendMarkRange(`link`).run();let a=this.editor?.view?.state?.selection,o=t||e;this.editor.chain().focus().insertContent(o).setTextSelection({from:a.from,to:a.from+o.length}).setLink({href:e,class:n.class}).run()},processValue(e,t=!0){if(!this.editor)return;let n=this.getOutput();if(!(t&&(0,fe.default)(e,n))){if(typeof e==`string`&&this.outputFormat===`text`){let t=RegExp(`(${b.emojiPattern})`,`g`);e=e?.replace(t,`<emoji-component code="$1"></emoji-component>`)}this.editor.commands.setContent(e,{emitUpdate:!1,parseOptions:{preserveWhitespace:this.preserveWhitespace}}),this._applyPhoneMarks()}},_applyPhoneMarks(){if(!this.editor)return;let e=this.editor.schema.marks.LinkPhoneNumbers;if(!e)return;let{tr:t,doc:n}=this.editor.state;t.removeMark(0,n.content.size,e),this.linkPhoneNumbers?.length&&n.descendants((n,r)=>{if(!(!n.isText||!n.text))for(let i of this.linkPhoneNumbers){let a=0,o;for(;(o=n.text.indexOf(i,a))!==-1;)t.addMark(r+o,r+o+i.length,e.create()),a=o+i.length}}),this.editor.view.dispatch(t)},destroyEditor(){this.editor.destroy()},insertPlainTextWithHardBreaks(e,t){let n=(this.pasteRichText?t:t.replace(/\r\n/g,`
3
+ `),u=c[0].pos,d=c[c.length-1],f=d.pos+d.node.nodeSize;return n().command(({tr:n})=>{let r=l.length?[t.schema.text(l)]:[];return n.replaceWith(u,f,i.create(e,r)),!0}).run()}}}}).configure({HTMLAttributes:{class:`d-rich-text-editor__code-block`}})),this.allowInlineImages&&e.push(er.configure({resize:{enabled:this.allowImageResize,alwaysPreserveAspectRatio:!0}})),(this.allowFontFamily||this.allowFontColor||this.allowFontSize||this.allowBackgroundColor||this.allowLineHeight)&&(e.push(se.TextStyleKit.configure({color:this.allowFontColor,backgroundColor:this.allowBackgroundColor,fontFamily:this.allowFontFamily,fontSize:this.allowFontSize,lineHeight:this.allowLineHeight})),e.push(ln)),this.additionalExtensions.length&&e.push(...this.additionalExtensions),this.allowTables&&e.push(rn.configure({resizable:!0}),an,cn,sn,O.Gapcursor),e},inputAttrs(){let e={"aria-label":this.inputAriaLabel,"aria-multiline":!0,role:`textbox`};return this.editable||(e[`aria-readonly`]=!0),e}},watch:{editable(e){this.editor.setEditable(e),this.updateEditorAttributes({"aria-readonly":!e})},inputClass(e){this.updateEditorAttributes({class:e})},inputAriaLabel(e){this.updateEditorAttributes({"aria-label":e})},extensions(){this.destroyEditor(),this.createEditor()},modelValue(e){this.processValue(e)},linkPhoneNumbers(){this._applyPhoneMarks()}},created(){this.createEditor()},beforeUnmount(){this.destroyEditor()},mounted(){t.warnIfUnmounted(t.returnFirstEl(this.$el),this.$options.name),this.processValue(this.modelValue,!1)},methods:{createEditor(){this.editor=new h.Editor({autofocus:this.autoFocus,content:this.modelValue,editable:this.editable,extensions:this.extensions,shouldRerenderOnTransaction:!1,parseOptions:{preserveWhitespace:this.preserveWhitespace},editorProps:{attributes:{...this.inputAttrs,class:this.inputClass},handleKeyDown:(e,t)=>{if(this.allowTyping)return!1;let n=[`Backspace`];return!this.allowLineBreaks&&!t.shiftKey&&n.push(`Enter`),!n.includes(t.key)},handlePaste:(e,t)=>{let n=t.clipboardData||window.clipboardData,r=n.getData(`text/plain`),i=n.getData(`text/html`);return this.processPasteData(e,r,i)},transformPastedHTML(e){return e.replace(/<hr[^>]*\/?>/gi,`<p><br></p>`).replace(/(<\/\w+>)((<br \/>)+)/g,`$2$1`).replace(/(<br[^>]*>\s*)+<\/p>(\s*)$/i,`</p>$2`)}}}),this.addEditorListeners()},bubbleMenuShouldShow({editor:e}){return this.showLinkBubbleMenu&&e.isActive(`link`)},getSelectedLinkText(e){let{view:t,state:n}=e,{from:r,to:i}=t.state.selection,a=n.doc.textBetween(r,i,``),o=this.editor.state.doc.nodeAt(r);return o&&o.marks?.at(0)?.type?.name===`link`?o.textContent:a},editLink(){let e=this.getSelectedLinkText(this.editor),t={href:this.editor.getAttributes(`link`).href,text:e};this.$emit(`edit-link`,t)},removeLink(){this.editor?.chain()?.focus()?.unsetLink()?.run()},openLink(){this.editor?.chain()?.focus();let e=this.editor.getAttributes(`link`).href;window.open(e,`_blank`)},setLink(e,t,n,r=g.RICH_TEXT_EDITOR_SUPPORTED_LINK_PROTOCOLS,i){if(!e){this.removeLink();return}r.find(t=>t.test(e))||(e=`${i}${e}`),this.editor.chain().focus().extendMarkRange(`link`).run();let a=this.editor?.view?.state?.selection,o=t||e;this.editor.chain().focus().insertContent(o).setTextSelection({from:a.from,to:a.from+o.length}).setLink({href:e,class:n.class}).run()},processValue(e,t=!0){if(!this.editor)return;let n=this.getOutput();if(!(t&&(0,fe.default)(e,n))){if(typeof e==`string`&&this.outputFormat===`text`){let t=RegExp(`(${b.emojiPattern})`,`g`);e=e?.replace(t,`<emoji-component code="$1"></emoji-component>`)}this.editor.commands.setContent(e,{emitUpdate:!1,parseOptions:{preserveWhitespace:this.preserveWhitespace}}),this._applyPhoneMarks()}},_applyPhoneMarks(){if(!this.editor)return;let e=this.editor.schema.marks.LinkPhoneNumbers;if(!e)return;let{tr:t,doc:n}=this.editor.state;t.removeMark(0,n.content.size,e),this.linkPhoneNumbers?.length&&n.descendants((n,r)=>{if(!(!n.isText||!n.text))for(let i of this.linkPhoneNumbers){let a=0,o;for(;(o=n.text.indexOf(i,a))!==-1;)t.addMark(r+o,r+o+i.length,e.create()),a=o+i.length}}),this.editor.view.dispatch(t)},destroyEditor(){this.editor.destroy()},insertPlainTextWithHardBreaks(e,t){let n=(this.pasteRichText?t:t.replace(/\r\n/g,`
4
4
  `).replace(/\n\n/g,`
5
5
  `)).replace(/[\r\n]+$/,``).split(/\r?\n/),r=[];for(let e=0;e<n.length;e++)e>0&&r.push({type:`hardBreak`}),n[e]&&r.push({type:`text`,text:n[e]});this.editor.chain().focus().insertContent(r).run()},shouldPreserveLineBreaks(e,t){return this.pasteRichText?!t&&e&&this.hasBlankLines(e):!!e},processPasteData(e,t,n){if(this.shouldPreserveLineBreaks(t,n))return this.insertPlainTextWithHardBreaks(e,t),!0;if(this.shouldHandlePreformattedHTML(n)){let t=this.extractPreformattedText(n);if(t&&t.includes(`
6
6
  `))return this.insertPlainTextWithHardBreaks(e,t),!0}return!1},shouldHandlePreformattedHTML(e){return this.pasteRichText&&e&&this.containsPreformattedContent(e)},containsPreformattedContent(e){let t=document.createElement(`div`);t.innerHTML=e;let n=t.querySelectorAll(`*`);for(let e of n)if(this.hasPreWhitespace(e)&&this.hasLineBreaks(e))return!0;return!1},hasPreWhitespace(e){let t=e.getAttribute(`style`)||``,n=e.style.whiteSpace||``,r=n===`pre`||n===`pre-wrap`,i=t.includes(`white-space: pre`);return r||i},hasLineBreaks(e){return e.textContent&&e.textContent.includes(`
@@ -9,4 +9,4 @@ const e=require(`./chunk-Bmb41Sf3.cjs`),t=require(`./common/utils/index.cjs`),n=
9
9
  `)||/\n\s*\n/.test(e)},extractPreformattedText(e){let t=document.createElement(`div`);return t.innerHTML=e,this.walkAndExtractText(t)},walkAndExtractText(e){let t=``;if(e.nodeType===Node.TEXT_NODE)t+=e.textContent;else if(e.nodeType===Node.ELEMENT_NODE)if(this.hasPreWhitespace(e))t+=e.textContent;else for(let n of e.childNodes)t+=this.walkAndExtractText(n);return t},triggerInputChangeEvents(){let e=this.getOutput();this.$emit(`update:modelValue`,e);let t=this.editor.getJSON();this.$emit(`json-input`,t);let n=this.editor.getHTML();this.$emit(`html-input`,n);let r=this.editor.getText({blockSeparator:`
10
10
  `});this.$emit(`text-input`,r);let i=_.t(t,this.extensions);this.$emit(`markdown-input`,i)},addEditorListeners(){this.editor.on(`create`,()=>{this.triggerInputChangeEvents()}),this.editor.on(`update`,()=>{this.triggerInputChangeEvents()}),this.editor.on(`selectionUpdate`,({editor:e})=>{this.$emit(`selected`,this.getSelectedLinkText(e))}),this.editor.on(`focus`,({event:e})=>{this.$emit(`focus`,e)}),this.editor.on(`blur`,({event:e})=>{this.$emit(`blur`,e)}),this.editor.on(`mention-click`,e=>{this.$emit(`mention-click`,e)}),this.editor.on(`mention-hover`,e=>{this.$emit(`mention-hover`,e)}),this.editor.on(`mention-leave`,e=>{this.$emit(`mention-leave`,e)}),this.editor.on(`channel-click`,e=>{this.$emit(`channel-click`,e)}),this.editor.on(`phone-click`,e=>{this.$emit(`phone-click`,e)})},getOutput(){switch(this.outputFormat){case`json`:return this.editor.getJSON();case`html`:return this.editor.getHTML();case`markdown`:return _.t(this.editor.getJSON(),this.extensions);default:return this.editor.getText({blockSeparator:`
11
11
  `})}},getExtension(e,t){return typeof t==`boolean`?e:e.configure?.(t)},updateEditorAttributes(e){this.editor.setOptions({editorProps:{attributes:{...this.inputAttrs,class:this.inputClass,...e}}})},focusEditor(){this.editor.commands.focus()}}},Nr={class:`d-popover__dialog`};function Pr(e,t,n,r,i,a){let o=(0,v.resolveComponent)(`dt-button`),s=(0,v.resolveComponent)(`dt-stack`),c=(0,v.resolveComponent)(`bubble-menu`),l=(0,v.resolveComponent)(`editor-content`);return(0,v.openBlock)(),(0,v.createElementBlock)(`div`,null,[i.editor&&n.link?((0,v.openBlock)(),(0,v.createBlock)(c,{key:0,editor:i.editor,"should-show":a.bubbleMenuShouldShow,options:i.floatingOptions,"append-to":i.appendTo,style:{visibility:`visible`}},{default:(0,v.withCtx)(()=>[(0,v.createElementVNode)(`div`,Nr,[(0,v.createVNode)(s,{direction:`row`,class:`d-rich-text-editor-bubble-menu__button-stack`,gap:`0`},{default:(0,v.withCtx)(()=>[(0,v.createVNode)(o,{kind:`muted`,importance:`clear`,onClick:a.editLink},{default:(0,v.withCtx)(()=>[(0,v.createTextVNode)((0,v.toDisplayString)(i.i18n.$t(`DIALTONE_RICH_TEXT_EDITOR_EDIT_BUTTON_LABEL`)),1)]),_:1},8,[`onClick`]),(0,v.createVNode)(o,{kind:`muted`,importance:`clear`,onClick:a.openLink},{default:(0,v.withCtx)(()=>[(0,v.createTextVNode)((0,v.toDisplayString)(i.i18n.$t(`DIALTONE_RICH_TEXT_EDITOR_OPEN_LINK_BUTTON_LABEL`)),1)]),_:1},8,[`onClick`]),(0,v.createVNode)(o,{kind:`critical`,importance:`clear`,onClick:a.removeLink},{default:(0,v.withCtx)(()=>[(0,v.createTextVNode)((0,v.toDisplayString)(i.i18n.$t(`DIALTONE_RICH_TEXT_EDITOR_REMOVE_BUTTON_LABEL`)),1)]),_:1},8,[`onClick`])]),_:1})])]),_:1},8,[`editor`,`should-show`,`options`,`append-to`])):(0,v.createCommentVNode)(``,!0),(0,v.createVNode)(l,(0,v.mergeProps)({ref:`editor`,editor:i.editor,class:`d-rich-text-editor`,"data-qa":`dt-rich-text-editor`},a.attrs),null,16,[`editor`])])}var Fr=n.t(Mr,[[`render`,Pr]]);Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return Fr}});
12
- //# sourceMappingURL=RichTextEditor-BX-5tCOx.cjs.map
12
+ //# sourceMappingURL=RichTextEditor-B9NGgB03.cjs.map