reactjs-tiptap-editor 0.3.19 → 0.3.21

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 (244) hide show
  1. package/lib/{ActionMenuButton-BPq-R8E7.cjs → ActionMenuButton-BTFBZyG2.cjs} +1 -1
  2. package/lib/{ActionMenuButton-DCACoSG3.js → ActionMenuButton-DXwnYZhJ.js} +1 -1
  3. package/lib/Attachment.cjs +1 -1
  4. package/lib/Attachment.d.cts +28 -28
  5. package/lib/Attachment.d.ts +28 -28
  6. package/lib/Attachment.js +3 -3
  7. package/lib/Blockquote.cjs +1 -1
  8. package/lib/Blockquote.d.cts +28 -28
  9. package/lib/Blockquote.d.ts +28 -28
  10. package/lib/Blockquote.js +2 -2
  11. package/lib/Bold.cjs +1 -1
  12. package/lib/Bold.d.cts +28 -28
  13. package/lib/Bold.d.ts +28 -28
  14. package/lib/Bold.js +2 -2
  15. package/lib/BulletList.cjs +1 -1
  16. package/lib/BulletList.d.cts +28 -28
  17. package/lib/BulletList.d.ts +28 -28
  18. package/lib/BulletList.js +2 -2
  19. package/lib/Clear.cjs +1 -1
  20. package/lib/Clear.d.cts +28 -28
  21. package/lib/Clear.d.ts +28 -28
  22. package/lib/Clear.js +2 -2
  23. package/lib/Code.cjs +1 -1
  24. package/lib/Code.d.cts +28 -28
  25. package/lib/Code.d.ts +28 -28
  26. package/lib/Code.js +2 -2
  27. package/lib/CodeBlock.cjs +1 -1
  28. package/lib/CodeBlock.d.cts +28 -28
  29. package/lib/CodeBlock.d.ts +28 -28
  30. package/lib/CodeBlock.js +3 -3
  31. package/lib/CodeView.cjs +1 -1
  32. package/lib/CodeView.d.cts +28 -28
  33. package/lib/CodeView.d.ts +28 -28
  34. package/lib/CodeView.js +2 -2
  35. package/lib/Color.cjs +1 -1
  36. package/lib/Color.d.cts +28 -28
  37. package/lib/Color.d.ts +28 -28
  38. package/lib/Color.js +3 -3
  39. package/lib/Document.cjs +1 -1
  40. package/lib/Document.d.cts +28 -28
  41. package/lib/Document.d.ts +28 -28
  42. package/lib/Document.js +1 -1
  43. package/lib/{Drawer-Dwx9V0Xb.cjs → Drawer-BrHHs2E9.cjs} +1 -1
  44. package/lib/{Drawer-Qh1zEBl3.js → Drawer-CVuwyG50.js} +3 -3
  45. package/lib/Drawer.cjs +1 -1
  46. package/lib/Drawer.d.cts +28 -28
  47. package/lib/Drawer.d.ts +28 -28
  48. package/lib/Drawer.js +4 -4
  49. package/lib/Emoji.cjs +1 -1
  50. package/lib/Emoji.d.cts +28 -28
  51. package/lib/Emoji.d.ts +28 -28
  52. package/lib/Emoji.js +4 -4
  53. package/lib/{Excalidraw-BP_-zWZH.cjs → Excalidraw-Be_GDV4Q.cjs} +1 -1
  54. package/lib/{Excalidraw-DD3P3ClH.js → Excalidraw-frMX4K62.js} +3 -3
  55. package/lib/Excalidraw.cjs +1 -1
  56. package/lib/Excalidraw.d.cts +28 -28
  57. package/lib/Excalidraw.d.ts +28 -28
  58. package/lib/Excalidraw.js +3 -3
  59. package/lib/ExportPdf.cjs +1 -1
  60. package/lib/ExportPdf.d.cts +28 -28
  61. package/lib/ExportPdf.d.ts +28 -28
  62. package/lib/ExportPdf.js +2 -2
  63. package/lib/ExportWord.cjs +1 -1
  64. package/lib/ExportWord.d.cts +28 -28
  65. package/lib/ExportWord.d.ts +28 -28
  66. package/lib/ExportWord.js +2 -2
  67. package/lib/FontFamily.cjs +1 -1
  68. package/lib/FontFamily.d.cts +28 -28
  69. package/lib/FontFamily.d.ts +28 -28
  70. package/lib/FontFamily.js +4 -4
  71. package/lib/FontSize.cjs +1 -1
  72. package/lib/FontSize.d.cts +28 -28
  73. package/lib/FontSize.d.ts +28 -28
  74. package/lib/FontSize.js +3 -3
  75. package/lib/FormatPainter.cjs +1 -1
  76. package/lib/FormatPainter.d.cts +28 -28
  77. package/lib/FormatPainter.d.ts +28 -28
  78. package/lib/FormatPainter.js +2 -2
  79. package/lib/Heading.cjs +1 -1
  80. package/lib/Heading.d.cts +28 -28
  81. package/lib/Heading.d.ts +28 -28
  82. package/lib/Heading.js +3 -3
  83. package/lib/Highlight.cjs +1 -1
  84. package/lib/Highlight.d.cts +28 -28
  85. package/lib/Highlight.d.ts +28 -28
  86. package/lib/Highlight.js +2 -2
  87. package/lib/History.cjs +1 -1
  88. package/lib/History.d.cts +28 -28
  89. package/lib/History.d.ts +28 -28
  90. package/lib/History.js +2 -2
  91. package/lib/HorizontalRule.cjs +1 -1
  92. package/lib/HorizontalRule.d.cts +28 -28
  93. package/lib/HorizontalRule.d.ts +28 -28
  94. package/lib/HorizontalRule.js +2 -2
  95. package/lib/Iframe.cjs +1 -1
  96. package/lib/Iframe.d.cts +28 -28
  97. package/lib/Iframe.d.ts +28 -28
  98. package/lib/Iframe.js +3 -3
  99. package/lib/Image.cjs +1 -1
  100. package/lib/Image.d.cts +28 -28
  101. package/lib/Image.d.ts +28 -28
  102. package/lib/Image.js +3 -3
  103. package/lib/ImageGif.cjs +1 -1
  104. package/lib/ImageGif.d.cts +28 -28
  105. package/lib/ImageGif.d.ts +28 -28
  106. package/lib/ImageGif.js +3 -3
  107. package/lib/ImportWord.cjs +74 -74
  108. package/lib/ImportWord.d.cts +28 -28
  109. package/lib/ImportWord.d.ts +28 -28
  110. package/lib/ImportWord.js +5015 -4998
  111. package/lib/Indent.cjs +1 -1
  112. package/lib/Indent.d.cts +28 -28
  113. package/lib/Indent.d.ts +28 -28
  114. package/lib/Indent.js +2 -2
  115. package/lib/Italic.cjs +1 -1
  116. package/lib/Italic.d.cts +28 -28
  117. package/lib/Italic.d.ts +28 -28
  118. package/lib/Italic.js +2 -2
  119. package/lib/Katex.cjs +1 -1
  120. package/lib/Katex.d.cts +28 -28
  121. package/lib/Katex.d.ts +28 -28
  122. package/lib/Katex.js +4 -4
  123. package/lib/LineHeight.cjs +1 -1
  124. package/lib/LineHeight.d.cts +28 -28
  125. package/lib/LineHeight.d.ts +28 -28
  126. package/lib/LineHeight.js +2 -2
  127. package/lib/Link.cjs +1 -1
  128. package/lib/Link.d.cts +28 -28
  129. package/lib/Link.d.ts +28 -28
  130. package/lib/Link.js +2 -2
  131. package/lib/ListItem.cjs +1 -1
  132. package/lib/ListItem.d.cts +28 -28
  133. package/lib/ListItem.d.ts +28 -28
  134. package/lib/ListItem.js +1 -1
  135. package/lib/Mention.cjs +1 -1
  136. package/lib/Mention.d.cts +28 -28
  137. package/lib/Mention.d.ts +28 -28
  138. package/lib/Mention.js +123 -91
  139. package/lib/Mermaid.cjs +1 -1
  140. package/lib/Mermaid.d.cts +28 -28
  141. package/lib/Mermaid.d.ts +28 -28
  142. package/lib/Mermaid.js +4 -4
  143. package/lib/MoreMark.cjs +1 -1
  144. package/lib/MoreMark.d.cts +28 -28
  145. package/lib/MoreMark.d.ts +28 -28
  146. package/lib/MoreMark.js +3 -3
  147. package/lib/MultiColumn.cjs +1 -1
  148. package/lib/MultiColumn.d.cts +28 -28
  149. package/lib/MultiColumn.d.ts +28 -28
  150. package/lib/MultiColumn.js +2 -2
  151. package/lib/OrderedList.cjs +1 -1
  152. package/lib/OrderedList.d.cts +28 -28
  153. package/lib/OrderedList.d.ts +28 -28
  154. package/lib/OrderedList.js +2 -2
  155. package/lib/RichTextEditor-CAxwVWUE.cjs +137 -0
  156. package/lib/{RichTextEditor-DIvPROxl.js → RichTextEditor-DjTnd5Uu.js} +1607 -1603
  157. package/lib/SearchAndReplace.cjs +1 -1
  158. package/lib/SearchAndReplace.d.cts +28 -28
  159. package/lib/SearchAndReplace.d.ts +28 -28
  160. package/lib/SearchAndReplace.js +2 -2
  161. package/lib/Selection.cjs +1 -1
  162. package/lib/Selection.d.cts +28 -28
  163. package/lib/Selection.d.ts +28 -28
  164. package/lib/Selection.js +1 -1
  165. package/lib/SlashCommand.cjs +1 -1
  166. package/lib/SlashCommand.d.cts +28 -28
  167. package/lib/SlashCommand.d.ts +28 -28
  168. package/lib/SlashCommand.js +4 -4
  169. package/lib/Strike.cjs +1 -1
  170. package/lib/Strike.d.cts +28 -28
  171. package/lib/Strike.d.ts +28 -28
  172. package/lib/Strike.js +2 -2
  173. package/lib/SubAndSuperScript.cjs +1 -1
  174. package/lib/SubAndSuperScript.d.cts +28 -28
  175. package/lib/SubAndSuperScript.d.ts +28 -28
  176. package/lib/SubAndSuperScript.js +3 -3
  177. package/lib/Table.cjs +1 -1
  178. package/lib/Table.d.cts +28 -28
  179. package/lib/Table.d.ts +28 -28
  180. package/lib/Table.js +2 -2
  181. package/lib/TableOfContent.cjs +1 -1
  182. package/lib/TableOfContent.d.cts +28 -28
  183. package/lib/TableOfContent.d.ts +28 -28
  184. package/lib/TableOfContent.js +3 -3
  185. package/lib/TaskList.cjs +1 -1
  186. package/lib/TaskList.d.cts +28 -28
  187. package/lib/TaskList.d.ts +28 -28
  188. package/lib/TaskList.js +37 -33
  189. package/lib/TextAlign.cjs +1 -1
  190. package/lib/TextAlign.d.cts +28 -28
  191. package/lib/TextAlign.d.ts +28 -28
  192. package/lib/TextAlign.js +2 -2
  193. package/lib/TextBubble.cjs +1 -1
  194. package/lib/TextBubble.d.cts +28 -28
  195. package/lib/TextBubble.d.ts +28 -28
  196. package/lib/TextBubble.js +2 -2
  197. package/lib/TextDirection.cjs +1 -1
  198. package/lib/TextDirection.d.cts +28 -28
  199. package/lib/TextDirection.d.ts +28 -28
  200. package/lib/TextDirection.js +2 -2
  201. package/lib/TextUnderline.cjs +1 -1
  202. package/lib/TextUnderline.d.cts +28 -28
  203. package/lib/TextUnderline.d.ts +28 -28
  204. package/lib/TextUnderline.js +2 -2
  205. package/lib/TrailingNode.cjs +1 -1
  206. package/lib/TrailingNode.d.cts +28 -28
  207. package/lib/TrailingNode.d.ts +28 -28
  208. package/lib/TrailingNode.js +1 -1
  209. package/lib/{Twitter-Bl5HyIX0.cjs → Twitter-V0OzBT_E.cjs} +1 -1
  210. package/lib/{Twitter-raSi7ATg.js → Twitter-dRxbZOad.js} +3 -3
  211. package/lib/Twitter.cjs +1 -1
  212. package/lib/Twitter.d.cts +28 -28
  213. package/lib/Twitter.d.ts +28 -28
  214. package/lib/Twitter.js +3 -3
  215. package/lib/Video.cjs +1 -1
  216. package/lib/Video.d.cts +28 -28
  217. package/lib/Video.d.ts +28 -28
  218. package/lib/Video.js +2 -2
  219. package/lib/bubble-extra.cjs +2 -2
  220. package/lib/bubble-extra.d.cts +28 -28
  221. package/lib/bubble-extra.d.ts +28 -28
  222. package/lib/bubble-extra.js +25 -25
  223. package/lib/{dom-dataset-Cuy-pIfj.cjs → dom-dataset-Byuf1YmW.cjs} +5 -5
  224. package/lib/{dom-dataset-CHDbKz5J.js → dom-dataset-Di3tIRrR.js} +94 -83
  225. package/lib/index-BI-IcZcN.cjs +1 -0
  226. package/lib/{index-CSvnpArE.cjs → index-ByRfqzMr.cjs} +2 -2
  227. package/lib/{index-DIPntess.js → index-C1fzuXpN.js} +1 -1
  228. package/lib/index-CbQQFj2T.js +133 -0
  229. package/lib/{index-BWx1Mchx.js → index-DI9T3iLd.js} +243 -243
  230. package/lib/{index-CrxasX7b.cjs → index-DclQSrIx.cjs} +1 -1
  231. package/lib/{index-DEFQHExY.js → index-LUL9mqY4.js} +1 -1
  232. package/lib/{index-h9_SDuwc.cjs → index-Z4b9rzn-.cjs} +1 -1
  233. package/lib/index.cjs +1 -1
  234. package/lib/index.d.cts +28 -28
  235. package/lib/index.d.ts +28 -28
  236. package/lib/index.js +5 -5
  237. package/lib/locale-bundle.d.cts +28 -28
  238. package/lib/locale-bundle.d.ts +28 -28
  239. package/lib/{textarea-DnBlTntN.js → textarea-6c8drwXJ.js} +1 -1
  240. package/lib/{textarea-DgXP0XRK.cjs → textarea-BsJTSgT-.cjs} +1 -1
  241. package/package.json +67 -67
  242. package/lib/RichTextEditor-DszaQdvS.cjs +0 -141
  243. package/lib/index-Cyh1yoFk.cjs +0 -1
  244. package/lib/index-oQutU45z.js +0 -129
@@ -1,4 +1,4 @@
1
- "use strict";const C=require("./index-CSvnpArE.cjs"),ie=require("tippy.js"),d=require("react"),X=require("react-dom");class oe{constructor({editor:e,element:t,view:r,tippyOptions:i={},updateDelay:o=250,shouldShow:f}){this.preventHide=!1,this.shouldShow=({view:s,state:p,from:l,to:c})=>{const{doc:u,selection:m}=p,{empty:v}=m,E=!u.textBetween(l,c).length&&C.isTextSelection(p.selection),y=this.element.contains(document.activeElement);return!(!(s.hasFocus()||y)||v||E||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:s})=>{var p;if(this.preventHide){this.preventHide=!1;return}s!=null&&s.relatedTarget&&(!((p=this.element.parentNode)===null||p===void 0)&&p.contains(s.relatedTarget))||(s==null?void 0:s.relatedTarget)!==this.editor.view.dom&&this.hide()},this.tippyBlurHandler=s=>{this.blurHandler({event:s})},this.handleDebouncedUpdate=(s,p)=>{const l=!(p!=null&&p.selection.eq(s.state.selection)),c=!(p!=null&&p.doc.eq(s.state.doc));!l&&!c||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(s,l,c,p)},this.updateDelay))},this.updateHandler=(s,p,l,c)=>{var u,m,v;const{state:E,composing:y}=s,{selection:_}=E;if(y||!p&&!l)return;this.createTooltip();const{ranges:D}=_,S=Math.min(...D.map(a=>a.$from.pos)),h=Math.max(...D.map(a=>a.$to.pos));if(!((u=this.shouldShow)===null||u===void 0?void 0:u.call(this,{editor:this.editor,element:this.element,view:s,state:E,oldState:c,from:S,to:h}))){this.hide();return}(m=this.tippy)===null||m===void 0||m.setProps({getReferenceClientRect:((v=this.tippyOptions)===null||v===void 0?void 0:v.getReferenceClientRect)||(()=>{if(C.isNodeSelection(E.selection)){let a=s.nodeDOM(S);if(a){const g=a.dataset.nodeViewWrapper?a:a.querySelector("[data-node-view-wrapper]");if(g&&(a=g.firstChild),a)return a.getBoundingClientRect()}}return C.posToDOMRect(s,S,h)})}),this.show()},this.editor=e,this.element=t,this.view=r,this.updateDelay=o,f&&(this.shouldShow=f),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.tippyOptions=i,this.element.remove(),this.element.style.visibility="visible"}createTooltip(){const{element:e}=this.editor.options,t=!!e.parentElement;this.tippy||!t||(this.tippy=ie(e,{duration:0,getReferenceClientRect:null,content:this.element,interactive:!0,trigger:"manual",placement:"top",hideOnClick:"toggle",...this.tippyOptions}),this.tippy.popper.firstChild&&this.tippy.popper.firstChild.addEventListener("blur",this.tippyBlurHandler))}update(e,t){const{state:r}=e,i=r.selection.from!==r.selection.to;if(this.updateDelay>0&&i){this.handleDebouncedUpdate(e,t);return}const o=!(t!=null&&t.selection.eq(e.state.selection)),f=!(t!=null&&t.doc.eq(e.state.doc));this.updateHandler(e,o,f,t)}show(){var e;(e=this.tippy)===null||e===void 0||e.show()}hide(){var e;(e=this.tippy)===null||e===void 0||e.hide()}destroy(){var e,t;!((e=this.tippy)===null||e===void 0)&&e.popper.firstChild&&this.tippy.popper.firstChild.removeEventListener("blur",this.tippyBlurHandler),(t=this.tippy)===null||t===void 0||t.destroy(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener("dragstart",this.dragstartHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler)}}const Z=n=>new C.Plugin({key:typeof n.pluginKey=="string"?new C.PluginKey(n.pluginKey):n.pluginKey,view:e=>new oe({view:e,...n})});C.Extension.create({name:"bubbleMenu",addOptions(){return{element:null,tippyOptions:{},pluginKey:"bubbleMenu",updateDelay:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[Z({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,tippyOptions:this.options.tippyOptions,updateDelay:this.options.updateDelay,shouldShow:this.options.shouldShow})]:[]}});function se(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var U={exports:{}},H={};/**
1
+ "use strict";const C=require("./index-ByRfqzMr.cjs"),ie=require("tippy.js"),d=require("react"),X=require("react-dom");class oe{constructor({editor:e,element:t,view:r,tippyOptions:i={},updateDelay:o=250,shouldShow:f}){this.preventHide=!1,this.shouldShow=({view:s,state:p,from:c,to:l})=>{const{doc:u,selection:m}=p,{empty:v}=m,E=!u.textBetween(c,l).length&&C.isTextSelection(p.selection),y=this.element.contains(document.activeElement);return!(!(s.hasFocus()||y)||v||E||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:s})=>{var p;if(this.preventHide){this.preventHide=!1;return}s!=null&&s.relatedTarget&&(!((p=this.element.parentNode)===null||p===void 0)&&p.contains(s.relatedTarget))||(s==null?void 0:s.relatedTarget)!==this.editor.view.dom&&this.hide()},this.tippyBlurHandler=s=>{this.blurHandler({event:s})},this.handleDebouncedUpdate=(s,p)=>{const c=!(p!=null&&p.selection.eq(s.state.selection)),l=!(p!=null&&p.doc.eq(s.state.doc));!c&&!l||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(s,c,l,p)},this.updateDelay))},this.updateHandler=(s,p,c,l)=>{var u,m,v;const{state:E,composing:y}=s,{selection:_}=E;if(y||!p&&!c)return;this.createTooltip();const{ranges:D}=_,S=Math.min(...D.map(a=>a.$from.pos)),h=Math.max(...D.map(a=>a.$to.pos));if(!((u=this.shouldShow)===null||u===void 0?void 0:u.call(this,{editor:this.editor,element:this.element,view:s,state:E,oldState:l,from:S,to:h}))){this.hide();return}(m=this.tippy)===null||m===void 0||m.setProps({getReferenceClientRect:((v=this.tippyOptions)===null||v===void 0?void 0:v.getReferenceClientRect)||(()=>{if(C.isNodeSelection(E.selection)){let a=s.nodeDOM(S);if(a){const g=a.dataset.nodeViewWrapper?a:a.querySelector("[data-node-view-wrapper]");if(g&&(a=g.firstChild),a)return a.getBoundingClientRect()}}return C.posToDOMRect(s,S,h)})}),this.show()},this.editor=e,this.element=t,this.view=r,this.updateDelay=o,f&&(this.shouldShow=f),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.tippyOptions=i,this.element.remove(),this.element.style.visibility="visible"}createTooltip(){const{element:e}=this.editor.options,t=!!e.parentElement;this.element.tabIndex=0,!(this.tippy||!t)&&(this.tippy=ie(e,{duration:0,getReferenceClientRect:null,content:this.element,interactive:!0,trigger:"manual",placement:"top",hideOnClick:"toggle",...this.tippyOptions}),this.tippy.popper.firstChild&&this.tippy.popper.firstChild.addEventListener("blur",this.tippyBlurHandler))}update(e,t){const{state:r}=e,i=r.selection.from!==r.selection.to;if(this.updateDelay>0&&i){this.handleDebouncedUpdate(e,t);return}const o=!(t!=null&&t.selection.eq(e.state.selection)),f=!(t!=null&&t.doc.eq(e.state.doc));this.updateHandler(e,o,f,t)}show(){var e;(e=this.tippy)===null||e===void 0||e.show()}hide(){var e;(e=this.tippy)===null||e===void 0||e.hide()}destroy(){var e,t;!((e=this.tippy)===null||e===void 0)&&e.popper.firstChild&&this.tippy.popper.firstChild.removeEventListener("blur",this.tippyBlurHandler),(t=this.tippy)===null||t===void 0||t.destroy(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener("dragstart",this.dragstartHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler)}}const Z=n=>new C.Plugin({key:typeof n.pluginKey=="string"?new C.PluginKey(n.pluginKey):n.pluginKey,view:e=>new oe({view:e,...n})});C.Extension.create({name:"bubbleMenu",addOptions(){return{element:null,tippyOptions:{},pluginKey:"bubbleMenu",updateDelay:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[Z({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,tippyOptions:this.options.tippyOptions,updateDelay:this.options.updateDelay,shouldShow:this.options.shouldShow})]:[]}});function se(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var U={exports:{}},H={};/**
2
2
  * @license React
3
3
  * use-sync-external-store-shim.production.min.js
4
4
  *
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var W;function ue(){if(W)return H;W=1;var n=d;function e(u,m){return u===m&&(u!==0||1/u===1/m)||u!==u&&m!==m}var t=typeof Object.is=="function"?Object.is:e,r=n.useState,i=n.useEffect,o=n.useLayoutEffect,f=n.useDebugValue;function s(u,m){var v=m(),E=r({inst:{value:v,getSnapshot:m}}),y=E[0].inst,_=E[1];return o(function(){y.value=v,y.getSnapshot=m,p(y)&&_({inst:y})},[u,v,m]),i(function(){return p(y)&&_({inst:y}),u(function(){p(y)&&_({inst:y})})},[u]),f(v),v}function p(u){var m=u.getSnapshot;u=u.value;try{var v=m();return!t(u,v)}catch{return!0}}function l(u,m){return m()}var c=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?l:s;return H.useSyncExternalStore=n.useSyncExternalStore!==void 0?n.useSyncExternalStore:c,H}var B={};/**
9
+ */var F;function ue(){if(F)return H;F=1;var n=d;function e(u,m){return u===m&&(u!==0||1/u===1/m)||u!==u&&m!==m}var t=typeof Object.is=="function"?Object.is:e,r=n.useState,i=n.useEffect,o=n.useLayoutEffect,f=n.useDebugValue;function s(u,m){var v=m(),E=r({inst:{value:v,getSnapshot:m}}),y=E[0].inst,_=E[1];return o(function(){y.value=v,y.getSnapshot=m,p(y)&&_({inst:y})},[u,v,m]),i(function(){return p(y)&&_({inst:y}),u(function(){p(y)&&_({inst:y})})},[u]),f(v),v}function p(u){var m=u.getSnapshot;u=u.value;try{var v=m();return!t(u,v)}catch{return!0}}function c(u,m){return m()}var l=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:s;return H.useSyncExternalStore=n.useSyncExternalStore!==void 0?n.useSyncExternalStore:l,H}var B={};/**
10
10
  * @license React
11
11
  * use-sync-external-store-shim.development.js
12
12
  *
@@ -14,7 +14,7 @@
14
14
  *
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
- */var q;function ae(){return q||(q=1,process.env.NODE_ENV!=="production"&&function(){typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var n=d,e=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function t(S){{for(var h=arguments.length,b=new Array(h>1?h-1:0),a=1;a<h;a++)b[a-1]=arguments[a];r("error",S,b)}}function r(S,h,b){{var a=e.ReactDebugCurrentFrame,g=a.getStackAddendum();g!==""&&(h+="%s",b=b.concat([g]));var w=b.map(function(O){return String(O)});w.unshift("Warning: "+h),Function.prototype.apply.call(console[S],console,w)}}function i(S,h){return S===h&&(S!==0||1/S===1/h)||S!==S&&h!==h}var o=typeof Object.is=="function"?Object.is:i,f=n.useState,s=n.useEffect,p=n.useLayoutEffect,l=n.useDebugValue,c=!1,u=!1;function m(S,h,b){c||n.startTransition!==void 0&&(c=!0,t("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var a=h();if(!u){var g=h();o(a,g)||(t("The result of getSnapshot should be cached to avoid an infinite loop"),u=!0)}var w=f({inst:{value:a,getSnapshot:h}}),O=w[0].inst,T=w[1];return p(function(){O.value=a,O.getSnapshot=h,v(O)&&T({inst:O})},[S,a,h]),s(function(){v(O)&&T({inst:O});var A=function(){v(O)&&T({inst:O})};return S(A)},[S]),l(a),a}function v(S){var h=S.getSnapshot,b=S.value;try{var a=h();return!o(b,a)}catch{return!0}}function E(S,h,b){return h()}var y=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",_=!y,R=_?E:m,D=n.useSyncExternalStore!==void 0?n.useSyncExternalStore:R;B.useSyncExternalStore=D,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),B}process.env.NODE_ENV==="production"?U.exports=ue():U.exports=ae();var L=U.exports;const de=(...n)=>e=>{n.forEach(t=>{typeof t=="function"?t(e):t&&(t.current=e)})},ce=({contentComponent:n})=>{const e=L.useSyncExternalStore(n.subscribe,n.getSnapshot,n.getServerSnapshot);return d.createElement(d.Fragment,null,Object.values(e))};function le(){const n=new Set;let e={};return{subscribe(t){return n.add(t),()=>{n.delete(t)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(t,r){e={...e,[t]:X.createPortal(r.reactElement,r.element,t)},n.forEach(i=>i())},removeRenderer(t){const r={...e};delete r[t],e=r,n.forEach(i=>i())}}}class he extends d.Component{constructor(e){var t;super(e),this.editorContentRef=d.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!(!((t=e.editor)===null||t===void 0)&&t.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){const e=this.props.editor;if(e&&!e.isDestroyed&&e.options.element){if(e.contentComponent)return;const t=this.editorContentRef.current;t.append(...e.options.element.childNodes),e.setOptions({element:t}),e.contentComponent=le(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=e.contentComponent.subscribe(()=>{this.setState(r=>r.hasContentComponentInitialized?r:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),e.createNodeViews(),this.initialized=!0}}componentWillUnmount(){const e=this.props.editor;if(!e||(this.initialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),e.contentComponent=null,!e.options.element.firstChild))return;const t=document.createElement("div");t.append(...e.options.element.childNodes),e.setOptions({element:t})}render(){const{editor:e,innerRef:t,...r}=this.props;return d.createElement(d.Fragment,null,d.createElement("div",{ref:de(t,this.editorContentRef),...r}),(e==null?void 0:e.contentComponent)&&d.createElement(ce,{contentComponent:e.contentComponent}))}}const fe=d.forwardRef((n,e)=>{const t=d.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[n.editor]);return d.createElement(he,{key:t,innerRef:e,...n})}),pe=d.memo(fe);var me=function n(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor!==t.constructor)return!1;var r,i,o;if(Array.isArray(e)){if(r=e.length,r!=t.length)return!1;for(i=r;i--!==0;)if(!n(e[i],t[i]))return!1;return!0}if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(i of e.entries())if(!t.has(i[0]))return!1;for(i of e.entries())if(!n(i[1],t.get(i[0])))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(i of e.entries())if(!t.has(i[0]))return!1;return!0}if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)){if(r=e.length,r!=t.length)return!1;for(i=r;i--!==0;)if(e[i]!==t[i])return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===t.toString();if(o=Object.keys(e),r=o.length,r!==Object.keys(t).length)return!1;for(i=r;i--!==0;)if(!Object.prototype.hasOwnProperty.call(t,o[i]))return!1;for(i=r;i--!==0;){var f=o[i];if(!(f==="_owner"&&e.$$typeof)&&!n(e[f],t[f]))return!1}return!0}return e!==e&&t!==t},ve=se(me),$={exports:{}},j={};/**
17
+ */var K;function ae(){return K||(K=1,process.env.NODE_ENV!=="production"&&function(){typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var n=d,e=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function t(S){{for(var h=arguments.length,b=new Array(h>1?h-1:0),a=1;a<h;a++)b[a-1]=arguments[a];r("error",S,b)}}function r(S,h,b){{var a=e.ReactDebugCurrentFrame,g=a.getStackAddendum();g!==""&&(h+="%s",b=b.concat([g]));var w=b.map(function(O){return String(O)});w.unshift("Warning: "+h),Function.prototype.apply.call(console[S],console,w)}}function i(S,h){return S===h&&(S!==0||1/S===1/h)||S!==S&&h!==h}var o=typeof Object.is=="function"?Object.is:i,f=n.useState,s=n.useEffect,p=n.useLayoutEffect,c=n.useDebugValue,l=!1,u=!1;function m(S,h,b){l||n.startTransition!==void 0&&(l=!0,t("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var a=h();if(!u){var g=h();o(a,g)||(t("The result of getSnapshot should be cached to avoid an infinite loop"),u=!0)}var w=f({inst:{value:a,getSnapshot:h}}),O=w[0].inst,T=w[1];return p(function(){O.value=a,O.getSnapshot=h,v(O)&&T({inst:O})},[S,a,h]),s(function(){v(O)&&T({inst:O});var L=function(){v(O)&&T({inst:O})};return S(L)},[S]),c(a),a}function v(S){var h=S.getSnapshot,b=S.value;try{var a=h();return!o(b,a)}catch{return!0}}function E(S,h,b){return h()}var y=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",_=!y,R=_?E:m,D=n.useSyncExternalStore!==void 0?n.useSyncExternalStore:R;B.useSyncExternalStore=D,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),B}process.env.NODE_ENV==="production"?U.exports=ue():U.exports=ae();var A=U.exports;const de=(...n)=>e=>{n.forEach(t=>{typeof t=="function"?t(e):t&&(t.current=e)})},ce=({contentComponent:n})=>{const e=A.useSyncExternalStore(n.subscribe,n.getSnapshot,n.getServerSnapshot);return d.createElement(d.Fragment,null,Object.values(e))};function le(){const n=new Set;let e={};return{subscribe(t){return n.add(t),()=>{n.delete(t)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(t,r){e={...e,[t]:X.createPortal(r.reactElement,r.element,t)},n.forEach(i=>i())},removeRenderer(t){const r={...e};delete r[t],e=r,n.forEach(i=>i())}}}class he extends d.Component{constructor(e){var t;super(e),this.editorContentRef=d.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!(!((t=e.editor)===null||t===void 0)&&t.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){const e=this.props.editor;if(e&&!e.isDestroyed&&e.options.element){if(e.contentComponent)return;const t=this.editorContentRef.current;t.append(...e.options.element.childNodes),e.setOptions({element:t}),e.contentComponent=le(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=e.contentComponent.subscribe(()=>{this.setState(r=>r.hasContentComponentInitialized?r:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),e.createNodeViews(),this.initialized=!0}}componentWillUnmount(){const e=this.props.editor;if(!e||(this.initialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),e.contentComponent=null,!e.options.element.firstChild))return;const t=document.createElement("div");t.append(...e.options.element.childNodes),e.setOptions({element:t})}render(){const{editor:e,innerRef:t,...r}=this.props;return d.createElement(d.Fragment,null,d.createElement("div",{ref:de(t,this.editorContentRef),...r}),(e==null?void 0:e.contentComponent)&&d.createElement(ce,{contentComponent:e.contentComponent}))}}const fe=d.forwardRef((n,e)=>{const t=d.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[n.editor]);return d.createElement(he,{key:t,innerRef:e,...n})}),pe=d.memo(fe);var me=function n(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor!==t.constructor)return!1;var r,i,o;if(Array.isArray(e)){if(r=e.length,r!=t.length)return!1;for(i=r;i--!==0;)if(!n(e[i],t[i]))return!1;return!0}if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(i of e.entries())if(!t.has(i[0]))return!1;for(i of e.entries())if(!n(i[1],t.get(i[0])))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(i of e.entries())if(!t.has(i[0]))return!1;return!0}if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)){if(r=e.length,r!=t.length)return!1;for(i=r;i--!==0;)if(e[i]!==t[i])return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===t.toString();if(o=Object.keys(e),r=o.length,r!==Object.keys(t).length)return!1;for(i=r;i--!==0;)if(!Object.prototype.hasOwnProperty.call(t,o[i]))return!1;for(i=r;i--!==0;){var f=o[i];if(!(f==="_owner"&&e.$$typeof)&&!n(e[f],t[f]))return!1}return!0}return e!==e&&t!==t},ve=se(me),q={exports:{}},j={};/**
18
18
  * @license React
19
19
  * use-sync-external-store-shim/with-selector.production.min.js
20
20
  *
@@ -22,7 +22,7 @@
22
22
  *
23
23
  * This source code is licensed under the MIT license found in the
24
24
  * LICENSE file in the root directory of this source tree.
25
- */var z;function Se(){if(z)return j;z=1;var n=d,e=L;function t(l,c){return l===c&&(l!==0||1/l===1/c)||l!==l&&c!==c}var r=typeof Object.is=="function"?Object.is:t,i=e.useSyncExternalStore,o=n.useRef,f=n.useEffect,s=n.useMemo,p=n.useDebugValue;return j.useSyncExternalStoreWithSelector=function(l,c,u,m,v){var E=o(null);if(E.current===null){var y={hasValue:!1,value:null};E.current=y}else y=E.current;E=s(function(){function R(a){if(!D){if(D=!0,S=a,a=m(a),v!==void 0&&y.hasValue){var g=y.value;if(v(g,a))return h=g}return h=a}if(g=h,r(S,a))return g;var w=m(a);return v!==void 0&&v(g,w)?g:(S=a,h=w)}var D=!1,S,h,b=u===void 0?null:u;return[function(){return R(c())},b===null?void 0:function(){return R(b())}]},[c,u,m,v]);var _=i(l,E[0],E[1]);return f(function(){y.hasValue=!0,y.value=_},[_]),p(_),_},j}var P={};/**
25
+ */var z;function Se(){if(z)return j;z=1;var n=d,e=A;function t(c,l){return c===l&&(c!==0||1/c===1/l)||c!==c&&l!==l}var r=typeof Object.is=="function"?Object.is:t,i=e.useSyncExternalStore,o=n.useRef,f=n.useEffect,s=n.useMemo,p=n.useDebugValue;return j.useSyncExternalStoreWithSelector=function(c,l,u,m,v){var E=o(null);if(E.current===null){var y={hasValue:!1,value:null};E.current=y}else y=E.current;E=s(function(){function R(a){if(!D){if(D=!0,S=a,a=m(a),v!==void 0&&y.hasValue){var g=y.value;if(v(g,a))return h=g}return h=a}if(g=h,r(S,a))return g;var w=m(a);return v!==void 0&&v(g,w)?g:(S=a,h=w)}var D=!1,S,h,b=u===void 0?null:u;return[function(){return R(l())},b===null?void 0:function(){return R(b())}]},[l,u,m,v]);var _=i(c,E[0],E[1]);return f(function(){y.hasValue=!0,y.value=_},[_]),p(_),_},j}var P={};/**
26
26
  * @license React
27
27
  * use-sync-external-store-shim/with-selector.development.js
28
28
  *
@@ -30,4 +30,4 @@
30
30
  *
31
31
  * This source code is licensed under the MIT license found in the
32
32
  * LICENSE file in the root directory of this source tree.
33
- */var G;function ye(){return G||(G=1,process.env.NODE_ENV!=="production"&&function(){typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var n=d,e=L;function t(c,u){return c===u&&(c!==0||1/c===1/u)||c!==c&&u!==u}var r=typeof Object.is=="function"?Object.is:t,i=e.useSyncExternalStore,o=n.useRef,f=n.useEffect,s=n.useMemo,p=n.useDebugValue;function l(c,u,m,v,E){var y=o(null),_;y.current===null?(_={hasValue:!1,value:null},y.current=_):_=y.current;var R=s(function(){var b=!1,a,g,w=function(M){if(!b){b=!0,a=M;var x=v(M);if(E!==void 0&&_.hasValue){var N=_.value;if(E(N,x))return g=N,N}return g=x,x}var re=a,V=g;if(r(re,M))return V;var I=v(M);return E!==void 0&&E(V,I)?V:(a=M,g=I,I)},O=m===void 0?null:m,T=function(){return w(u())},A=O===null?void 0:function(){return w(O())};return[T,A]},[u,m,v,E]),D=R[0],S=R[1],h=i(c,D,S);return f(function(){_.hasValue=!0,_.value=h},[h]),p(h),h}P.useSyncExternalStoreWithSelector=l,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),P}process.env.NODE_ENV==="production"?$.exports=Se():$.exports=ye();var Ee=$.exports;const _e=typeof window<"u"?d.useLayoutEffect:d.useEffect;class ge{constructor(e){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=e,this.lastSnapshot={editor:e,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}watch(e){if(this.editor=e,this.editor){const t=()=>{this.transactionNumber+=1,this.subscribers.forEach(i=>i())},r=this.editor;return r.on("transaction",t),()=>{r.off("transaction",t)}}}}function be(n){var e;const[t]=d.useState(()=>new ge(n.editor)),r=Ee.useSyncExternalStoreWithSelector(t.subscribe,t.getSnapshot,t.getServerSnapshot,n.selector,(e=n.equalityFn)!==null&&e!==void 0?e:ve);return _e(()=>t.watch(n.editor),[n.editor,t]),d.useDebugValue(r),r}const J=process.env.NODE_ENV!=="production",F=typeof window>"u",Oe=F||!!(typeof window<"u"&&window.next);class K{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(t=>t())}getInitialEditor(){if(this.options.current.immediatelyRender===void 0)return F||Oe?(J&&console.warn("Tiptap Error: SSR has been detected, please set `immediatelyRender` explicitly to `false` to avoid hydration mismatches."),null):this.createEditor();if(this.options.current.immediatelyRender&&F&&J)throw new Error("Tiptap Error: SSR has been detected, and `immediatelyRender` has been set to `true` this is an unsupported configuration that may result in errors, explicitly set `immediatelyRender` to `false` to avoid hydration mismatches.");return this.options.current.immediatelyRender?this.createEditor():null}createEditor(){const e={...this.options.current,onBeforeCreate:(...r)=>{var i,o;return(o=(i=this.options.current).onBeforeCreate)===null||o===void 0?void 0:o.call(i,...r)},onBlur:(...r)=>{var i,o;return(o=(i=this.options.current).onBlur)===null||o===void 0?void 0:o.call(i,...r)},onCreate:(...r)=>{var i,o;return(o=(i=this.options.current).onCreate)===null||o===void 0?void 0:o.call(i,...r)},onDestroy:(...r)=>{var i,o;return(o=(i=this.options.current).onDestroy)===null||o===void 0?void 0:o.call(i,...r)},onFocus:(...r)=>{var i,o;return(o=(i=this.options.current).onFocus)===null||o===void 0?void 0:o.call(i,...r)},onSelectionUpdate:(...r)=>{var i,o;return(o=(i=this.options.current).onSelectionUpdate)===null||o===void 0?void 0:o.call(i,...r)},onTransaction:(...r)=>{var i,o;return(o=(i=this.options.current).onTransaction)===null||o===void 0?void 0:o.call(i,...r)},onUpdate:(...r)=>{var i,o;return(o=(i=this.options.current).onUpdate)===null||o===void 0?void 0:o.call(i,...r)},onContentError:(...r)=>{var i,o;return(o=(i=this.options.current).onContentError)===null||o===void 0?void 0:o.call(i,...r)},onDrop:(...r)=>{var i,o;return(o=(i=this.options.current).onDrop)===null||o===void 0?void 0:o.call(i,...r)},onPaste:(...r)=>{var i,o;return(o=(i=this.options.current).onPaste)===null||o===void 0?void 0:o.call(i,...r)}};return new C.Editor(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,t){return Object.keys(e).every(r=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(r)?!0:r==="extensions"&&e.extensions&&t.extensions?e.extensions.length!==t.extensions.length?!1:e.extensions.every((i,o)=>{var f;return i===((f=t.extensions)===null||f===void 0?void 0:f[o])}):e[r]===t[r])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?K.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(e),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((r,i)=>r===e[i]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){const e=this.instanceId,t=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){t&&t.setOptions(this.options.current);return}t&&!t.isDestroyed&&(t.destroy(),this.instanceId===e&&this.setEditor(null))},1)}}function we(n={},e=[]){const t=d.useRef(n);t.current=n;const[r]=d.useState(()=>new K(t)),i=L.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return d.useDebugValue(i),d.useEffect(r.onRender(e)),be({editor:i,selector:({transactionNumber:o})=>n.shouldRerenderOnTransaction===!1?null:n.immediatelyRender&&o===0?0:o+1}),i}const k=d.createContext({editor:null});k.Consumer;const De=()=>d.useContext(k),Ce=n=>{const[e,t]=d.useState(null),{editor:r}=De();return d.useEffect(()=>{var i;if(!e||!((i=n.editor)===null||i===void 0)&&i.isDestroyed||r!=null&&r.isDestroyed)return;const{pluginKey:o="bubbleMenu",editor:f,tippyOptions:s={},updateDelay:p,shouldShow:l=null}=n,c=f||r;if(!c){console.warn("BubbleMenu component is not rendered inside of an editor component or does not have editor prop.");return}const u=Z({updateDelay:p,editor:c,element:e,pluginKey:o,shouldShow:l,tippyOptions:s});return c.registerPlugin(u),()=>{c.unregisterPlugin(o)}},[n.editor,r,e]),d.createElement("div",{ref:t,className:n.className,style:{visibility:"hidden"}},n.children)},ee=d.createContext({onDragStart:void 0}),Re=()=>d.useContext(ee),Te=d.forwardRef((n,e)=>{const{onDragStart:t}=Re(),r=n.as||"div";return d.createElement(r,{...n,ref:e,"data-node-view-wrapper":"",onDragStart:t,style:{whiteSpace:"normal",...n.style}})});function Y(n){return!!(typeof n=="function"&&n.prototype&&n.prototype.isReactComponent)}function Q(n){return!!(typeof n=="object"&&n.$$typeof&&(n.$$typeof.toString()==="Symbol(react.forward_ref)"||n.$$typeof.description==="react.forward_ref"))}function Me(n){return!!(typeof n=="object"&&n.$$typeof&&(n.$$typeof.toString()==="Symbol(react.memo)"||n.$$typeof.description==="react.memo"))}function Le(n){if(Y(n)||Q(n))return!0;if(Me(n)){const e=n.type;if(e)return Y(e)||Q(e)}return!1}function Ae(){try{if(d.version)return parseInt(d.version.split(".")[0],10)>=19}catch{}return!1}class te{constructor(e,{editor:t,props:r={},as:i="div",className:o=""}){this.ref=null,this.id=Math.floor(Math.random()*4294967295).toString(),this.component=e,this.editor=t,this.props=r,this.element=document.createElement(i),this.element.classList.add("react-renderer"),o&&this.element.classList.add(...o.split(" ")),this.editor.isInitialized?X.flushSync(()=>{this.render()}):this.render()}render(){var e;const t=this.component,r=this.props,i=this.editor,o=Ae(),f=Le(t),s={...r};s.ref&&!(o||f)&&delete s.ref,!s.ref&&(o||f)&&(s.ref=p=>{this.ref=p}),this.reactElement=d.createElement(t,{...s}),(e=i==null?void 0:i.contentComponent)===null||e===void 0||e.setRenderer(this.id,this)}updateProps(e={}){this.props={...this.props,...e},this.render()}destroy(){var e;const t=this.editor;(e=t==null?void 0:t.contentComponent)===null||e===void 0||e.removeRenderer(this.id)}updateAttributes(e){Object.keys(e).forEach(t=>{this.element.setAttribute(t,e[t])})}}class xe extends C.NodeView{mount(){const e={editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,extension:this.extension,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(l={})=>this.updateAttributes(l),deleteNode:()=>this.deleteNode(),ref:d.createRef()};if(!this.component.displayName){const l=c=>c.charAt(0).toUpperCase()+c.substring(1);this.component.displayName=l(this.extension.name)}const i={onDragStart:this.onDragStart.bind(this),nodeViewContentRef:l=>{l&&this.contentDOMElement&&l.firstChild!==this.contentDOMElement&&l.appendChild(this.contentDOMElement)}},o=this.component,f=d.memo(l=>d.createElement(ee.Provider,{value:i},d.createElement(o,l)));f.displayName="ReactNodeView",this.node.isLeaf?this.contentDOMElement=null:this.options.contentDOMElementTag?this.contentDOMElement=document.createElement(this.options.contentDOMElementTag):this.contentDOMElement=document.createElement(this.node.isInline?"span":"div"),this.contentDOMElement&&(this.contentDOMElement.dataset.nodeViewContentReact="",this.contentDOMElement.style.whiteSpace="inherit");let s=this.node.isInline?"span":"div";this.options.as&&(s=this.options.as);const{className:p=""}=this.options;this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.renderer=new te(f,{editor:this.editor,props:e,as:s,className:`node-${this.node.type.name} ${p}`.trim()}),this.editor.on("selectionUpdate",this.handleSelectionUpdate),this.updateElementAttributes()}get dom(){var e;if(this.renderer.element.firstElementChild&&!(!((e=this.renderer.element.firstElementChild)===null||e===void 0)&&e.hasAttribute("data-node-view-wrapper")))throw Error("Please use the NodeViewWrapper component for your node view.");return this.renderer.element}get contentDOM(){return this.node.isLeaf?null:this.contentDOMElement}handleSelectionUpdate(){const{from:e,to:t}=this.editor.state.selection,r=this.getPos();if(typeof r=="number")if(e<=r&&t>=r+this.node.nodeSize){if(this.renderer.props.selected)return;this.selectNode()}else{if(!this.renderer.props.selected)return;this.deselectNode()}}update(e,t,r){const i=o=>{this.renderer.updateProps(o),typeof this.options.attrs=="function"&&this.updateElementAttributes()};if(e.type!==this.node.type)return!1;if(typeof this.options.update=="function"){const o=this.node,f=this.decorations,s=this.innerDecorations;return this.node=e,this.decorations=t,this.innerDecorations=r,this.options.update({oldNode:o,oldDecorations:f,newNode:e,newDecorations:t,oldInnerDecorations:s,innerDecorations:r,updateProps:()=>i({node:e,decorations:t,innerDecorations:r})})}return e===this.node&&this.decorations===t&&this.innerDecorations===r||(this.node=e,this.decorations=t,this.innerDecorations=r,i({node:e,decorations:t,innerDecorations:r})),!0}selectNode(){this.renderer.updateProps({selected:!0}),this.renderer.element.classList.add("ProseMirror-selectednode")}deselectNode(){this.renderer.updateProps({selected:!1}),this.renderer.element.classList.remove("ProseMirror-selectednode")}destroy(){this.renderer.destroy(),this.editor.off("selectionUpdate",this.handleSelectionUpdate),this.contentDOMElement=null}updateElementAttributes(){if(this.options.attrs){let e={};if(typeof this.options.attrs=="function"){const t=this.editor.extensionManager.attributes,r=C.getRenderedAttributes(this.node,t);e=this.options.attrs({node:this.node,HTMLAttributes:r})}else e=this.options.attrs;this.renderer.updateAttributes(e)}}}function Ne(n,e){return t=>t.editor.contentComponent?new xe(n,t,e):{}}function ne(n){var e,t,r="";if(typeof n=="string"||typeof n=="number")r+=n;else if(typeof n=="object")if(Array.isArray(n)){var i=n.length;for(e=0;e<i;e++)n[e]&&(t=ne(n[e]))&&(r&&(r+=" "),r+=t)}else for(t in n)n[t]&&(r&&(r+=" "),r+=t);return r}function Ve(){for(var n,e,t=0,r="",i=arguments.length;t<i;t++)(n=arguments[t])&&(e=ne(n))&&(r&&(r+=" "),r+=e);return r}function Ie(n){try{return JSON.stringify(n)}catch{return JSON.stringify({})}}function He(n,e=!1){return t=>{const r=n.startsWith("data-")?n:`data-${n}`;let i=decodeURIComponent(t.getAttribute(r));if(i==null||typeof i=="string"&&i==="null")try{const s=t.outerHTML.match(/([\S\s])+?="([\S\s])+?"/g);s&&s.length>0&&(i=(s.map(l=>l.trim()).reduce((l,c)=>{const u=c.indexOf("="),m=[c.slice(0,u),c.slice(u+1).slice(1,-1)];return l[m[0]]=m[1],l},{})[n.toLowerCase()]||"").replaceAll("&quot;",'"'))}catch(f){console.error("Error getDatasetAttribute ",f.message,t)}if(e)try{return JSON.parse(i)}catch{return{}}if(i.includes("%")||i.includes("auto"))return i;const o=Number.parseInt(i);return o!==o?i:o}}function Be(n){const{attrs:e}=n;return Object.keys(e).reduce((t,r)=>{const i=e[r];if(i==null)return t;let o="";return typeof i=="object"?o=Ie(i):o=i,t[r]=o,t},Object.create(null))}exports.BubbleMenu=Ce;exports.EditorContent=pe;exports.NodeViewWrapper=Te;exports.ReactNodeViewRenderer=Ne;exports.ReactRenderer=te;exports.clsx=Ve;exports.getDatasetAttribute=He;exports.nodeAttrsToDataset=Be;exports.useEditor=we;
33
+ */var G;function ye(){return G||(G=1,process.env.NODE_ENV!=="production"&&function(){typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var n=d,e=A;function t(l,u){return l===u&&(l!==0||1/l===1/u)||l!==l&&u!==u}var r=typeof Object.is=="function"?Object.is:t,i=e.useSyncExternalStore,o=n.useRef,f=n.useEffect,s=n.useMemo,p=n.useDebugValue;function c(l,u,m,v,E){var y=o(null),_;y.current===null?(_={hasValue:!1,value:null},y.current=_):_=y.current;var R=s(function(){var b=!1,a,g,w=function(M){if(!b){b=!0,a=M;var x=v(M);if(E!==void 0&&_.hasValue){var N=_.value;if(E(N,x))return g=N,N}return g=x,x}var re=a,V=g;if(r(re,M))return V;var I=v(M);return E!==void 0&&E(V,I)?V:(a=M,g=I,I)},O=m===void 0?null:m,T=function(){return w(u())},L=O===null?void 0:function(){return w(O())};return[T,L]},[u,m,v,E]),D=R[0],S=R[1],h=i(l,D,S);return f(function(){_.hasValue=!0,_.value=h},[h]),p(h),h}P.useSyncExternalStoreWithSelector=c,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),P}process.env.NODE_ENV==="production"?q.exports=Se():q.exports=ye();var Ee=q.exports;const _e=typeof window<"u"?d.useLayoutEffect:d.useEffect;class ge{constructor(e){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=e,this.lastSnapshot={editor:e,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}watch(e){if(this.editor=e,this.editor){const t=()=>{this.transactionNumber+=1,this.subscribers.forEach(i=>i())},r=this.editor;return r.on("transaction",t),()=>{r.off("transaction",t)}}}}function be(n){var e;const[t]=d.useState(()=>new ge(n.editor)),r=Ee.useSyncExternalStoreWithSelector(t.subscribe,t.getSnapshot,t.getServerSnapshot,n.selector,(e=n.equalityFn)!==null&&e!==void 0?e:ve);return _e(()=>t.watch(n.editor),[n.editor,t]),d.useDebugValue(r),r}const J=process.env.NODE_ENV!=="production",W=typeof window>"u",Oe=W||!!(typeof window<"u"&&window.next);class ${constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(t=>t())}getInitialEditor(){if(this.options.current.immediatelyRender===void 0)return W||Oe?(J&&console.warn("Tiptap Error: SSR has been detected, please set `immediatelyRender` explicitly to `false` to avoid hydration mismatches."),null):this.createEditor();if(this.options.current.immediatelyRender&&W&&J)throw new Error("Tiptap Error: SSR has been detected, and `immediatelyRender` has been set to `true` this is an unsupported configuration that may result in errors, explicitly set `immediatelyRender` to `false` to avoid hydration mismatches.");return this.options.current.immediatelyRender?this.createEditor():null}createEditor(){const e={...this.options.current,onBeforeCreate:(...r)=>{var i,o;return(o=(i=this.options.current).onBeforeCreate)===null||o===void 0?void 0:o.call(i,...r)},onBlur:(...r)=>{var i,o;return(o=(i=this.options.current).onBlur)===null||o===void 0?void 0:o.call(i,...r)},onCreate:(...r)=>{var i,o;return(o=(i=this.options.current).onCreate)===null||o===void 0?void 0:o.call(i,...r)},onDestroy:(...r)=>{var i,o;return(o=(i=this.options.current).onDestroy)===null||o===void 0?void 0:o.call(i,...r)},onFocus:(...r)=>{var i,o;return(o=(i=this.options.current).onFocus)===null||o===void 0?void 0:o.call(i,...r)},onSelectionUpdate:(...r)=>{var i,o;return(o=(i=this.options.current).onSelectionUpdate)===null||o===void 0?void 0:o.call(i,...r)},onTransaction:(...r)=>{var i,o;return(o=(i=this.options.current).onTransaction)===null||o===void 0?void 0:o.call(i,...r)},onUpdate:(...r)=>{var i,o;return(o=(i=this.options.current).onUpdate)===null||o===void 0?void 0:o.call(i,...r)},onContentError:(...r)=>{var i,o;return(o=(i=this.options.current).onContentError)===null||o===void 0?void 0:o.call(i,...r)},onDrop:(...r)=>{var i,o;return(o=(i=this.options.current).onDrop)===null||o===void 0?void 0:o.call(i,...r)},onPaste:(...r)=>{var i,o;return(o=(i=this.options.current).onPaste)===null||o===void 0?void 0:o.call(i,...r)}};return new C.Editor(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,t){return Object.keys(e).every(r=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(r)?!0:r==="extensions"&&e.extensions&&t.extensions?e.extensions.length!==t.extensions.length?!1:e.extensions.every((i,o)=>{var f;return i===((f=t.extensions)===null||f===void 0?void 0:f[o])}):e[r]===t[r])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?$.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(e),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((r,i)=>r===e[i]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){const e=this.instanceId,t=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){t&&t.setOptions(this.options.current);return}t&&!t.isDestroyed&&(t.destroy(),this.instanceId===e&&this.setEditor(null))},1)}}function we(n={},e=[]){const t=d.useRef(n);t.current=n;const[r]=d.useState(()=>new $(t)),i=A.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return d.useDebugValue(i),d.useEffect(r.onRender(e)),be({editor:i,selector:({transactionNumber:o})=>n.shouldRerenderOnTransaction===!1?null:n.immediatelyRender&&o===0?0:o+1}),i}const k=d.createContext({editor:null});k.Consumer;const De=()=>d.useContext(k),Ce=n=>{const[e,t]=d.useState(null),{editor:r}=De();return d.useEffect(()=>{var i;if(!e||!((i=n.editor)===null||i===void 0)&&i.isDestroyed||r!=null&&r.isDestroyed)return;const{pluginKey:o="bubbleMenu",editor:f,tippyOptions:s={},updateDelay:p,shouldShow:c=null}=n,l=f||r;if(!l){console.warn("BubbleMenu component is not rendered inside of an editor component or does not have editor prop.");return}const u=Z({updateDelay:p,editor:l,element:e,pluginKey:o,shouldShow:c,tippyOptions:s});return l.registerPlugin(u),()=>{l.unregisterPlugin(o)}},[n.editor,r,e]),d.createElement("div",{ref:t,className:n.className,style:{visibility:"hidden"}},n.children)},ee=d.createContext({onDragStart:void 0}),Re=()=>d.useContext(ee),Te=d.forwardRef((n,e)=>{const{onDragStart:t}=Re(),r=n.as||"div";return d.createElement(r,{...n,ref:e,"data-node-view-wrapper":"",onDragStart:t,style:{whiteSpace:"normal",...n.style}})});function Y(n){return!!(typeof n=="function"&&n.prototype&&n.prototype.isReactComponent)}function Q(n){return!!(typeof n=="object"&&n.$$typeof&&(n.$$typeof.toString()==="Symbol(react.forward_ref)"||n.$$typeof.description==="react.forward_ref"))}function Me(n){return!!(typeof n=="object"&&n.$$typeof&&(n.$$typeof.toString()==="Symbol(react.memo)"||n.$$typeof.description==="react.memo"))}function Ae(n){if(Y(n)||Q(n))return!0;if(Me(n)){const e=n.type;if(e)return Y(e)||Q(e)}return!1}function Le(){try{if(d.version)return parseInt(d.version.split(".")[0],10)>=19}catch{}return!1}class te{constructor(e,{editor:t,props:r={},as:i="div",className:o=""}){this.ref=null,this.id=Math.floor(Math.random()*4294967295).toString(),this.component=e,this.editor=t,this.props=r,this.element=document.createElement(i),this.element.classList.add("react-renderer"),o&&this.element.classList.add(...o.split(" ")),this.editor.isInitialized?X.flushSync(()=>{this.render()}):queueMicrotask(()=>{this.render()})}render(){var e;const t=this.component,r=this.props,i=this.editor,o=Le(),f=Ae(t),s={...r};s.ref&&!(o||f)&&delete s.ref,!s.ref&&(o||f)&&(s.ref=p=>{this.ref=p}),this.reactElement=d.createElement(t,{...s}),(e=i==null?void 0:i.contentComponent)===null||e===void 0||e.setRenderer(this.id,this)}updateProps(e={}){this.props={...this.props,...e},this.render()}destroy(){var e;const t=this.editor;(e=t==null?void 0:t.contentComponent)===null||e===void 0||e.removeRenderer(this.id)}updateAttributes(e){Object.keys(e).forEach(t=>{this.element.setAttribute(t,e[t])})}}class xe extends C.NodeView{constructor(e,t,r){if(super(e,t,r),!this.node.isLeaf){this.options.contentDOMElementTag?this.contentDOMElement=document.createElement(this.options.contentDOMElementTag):this.contentDOMElement=document.createElement(this.node.isInline?"span":"div"),this.contentDOMElement.dataset.nodeViewContentReact="",this.contentDOMElement.dataset.nodeViewWrapper="",this.contentDOMElement.style.whiteSpace="inherit";const i=this.dom.querySelector("[data-node-view-content]");if(!i)return;i.appendChild(this.contentDOMElement)}}mount(){const e={editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,extension:this.extension,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(c={})=>this.updateAttributes(c),deleteNode:()=>this.deleteNode(),ref:d.createRef()};if(!this.component.displayName){const c=l=>l.charAt(0).toUpperCase()+l.substring(1);this.component.displayName=c(this.extension.name)}const i={onDragStart:this.onDragStart.bind(this),nodeViewContentRef:c=>{c&&this.contentDOMElement&&c.firstChild!==this.contentDOMElement&&(c.hasAttribute("data-node-view-wrapper")&&c.removeAttribute("data-node-view-wrapper"),c.appendChild(this.contentDOMElement))}},o=this.component,f=d.memo(c=>d.createElement(ee.Provider,{value:i},d.createElement(o,c)));f.displayName="ReactNodeView";let s=this.node.isInline?"span":"div";this.options.as&&(s=this.options.as);const{className:p=""}=this.options;this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.renderer=new te(f,{editor:this.editor,props:e,as:s,className:`node-${this.node.type.name} ${p}`.trim()}),this.editor.on("selectionUpdate",this.handleSelectionUpdate),this.updateElementAttributes()}get dom(){var e;if(this.renderer.element.firstElementChild&&!(!((e=this.renderer.element.firstElementChild)===null||e===void 0)&&e.hasAttribute("data-node-view-wrapper")))throw Error("Please use the NodeViewWrapper component for your node view.");return this.renderer.element}get contentDOM(){return this.node.isLeaf?null:this.contentDOMElement}handleSelectionUpdate(){const{from:e,to:t}=this.editor.state.selection,r=this.getPos();if(typeof r=="number")if(e<=r&&t>=r+this.node.nodeSize){if(this.renderer.props.selected)return;this.selectNode()}else{if(!this.renderer.props.selected)return;this.deselectNode()}}update(e,t,r){const i=o=>{this.renderer.updateProps(o),typeof this.options.attrs=="function"&&this.updateElementAttributes()};if(e.type!==this.node.type)return!1;if(typeof this.options.update=="function"){const o=this.node,f=this.decorations,s=this.innerDecorations;return this.node=e,this.decorations=t,this.innerDecorations=r,this.options.update({oldNode:o,oldDecorations:f,newNode:e,newDecorations:t,oldInnerDecorations:s,innerDecorations:r,updateProps:()=>i({node:e,decorations:t,innerDecorations:r})})}return e===this.node&&this.decorations===t&&this.innerDecorations===r||(this.node=e,this.decorations=t,this.innerDecorations=r,i({node:e,decorations:t,innerDecorations:r})),!0}selectNode(){this.renderer.updateProps({selected:!0}),this.renderer.element.classList.add("ProseMirror-selectednode")}deselectNode(){this.renderer.updateProps({selected:!1}),this.renderer.element.classList.remove("ProseMirror-selectednode")}destroy(){this.renderer.destroy(),this.editor.off("selectionUpdate",this.handleSelectionUpdate),this.contentDOMElement=null}updateElementAttributes(){if(this.options.attrs){let e={};if(typeof this.options.attrs=="function"){const t=this.editor.extensionManager.attributes,r=C.getRenderedAttributes(this.node,t);e=this.options.attrs({node:this.node,HTMLAttributes:r})}else e=this.options.attrs;this.renderer.updateAttributes(e)}}}function Ne(n,e){return t=>t.editor.contentComponent?new xe(n,t,e):{}}function ne(n){var e,t,r="";if(typeof n=="string"||typeof n=="number")r+=n;else if(typeof n=="object")if(Array.isArray(n)){var i=n.length;for(e=0;e<i;e++)n[e]&&(t=ne(n[e]))&&(r&&(r+=" "),r+=t)}else for(t in n)n[t]&&(r&&(r+=" "),r+=t);return r}function Ve(){for(var n,e,t=0,r="",i=arguments.length;t<i;t++)(n=arguments[t])&&(e=ne(n))&&(r&&(r+=" "),r+=e);return r}function Ie(n){try{return JSON.stringify(n)}catch{return JSON.stringify({})}}function He(n,e=!1){return t=>{const r=n.startsWith("data-")?n:`data-${n}`;let i=decodeURIComponent(t.getAttribute(r));if(i==null||typeof i=="string"&&i==="null")try{const s=t.outerHTML.match(/([\S\s])+?="([\S\s])+?"/g);s&&s.length>0&&(i=(s.map(c=>c.trim()).reduce((c,l)=>{const u=l.indexOf("="),m=[l.slice(0,u),l.slice(u+1).slice(1,-1)];return c[m[0]]=m[1],c},{})[n.toLowerCase()]||"").replaceAll("&quot;",'"'))}catch(f){console.error("Error getDatasetAttribute ",f.message,t)}if(e)try{return JSON.parse(i)}catch{return{}}if(i.includes("%")||i.includes("auto"))return i;const o=Number.parseInt(i);return o!==o?i:o}}function Be(n){const{attrs:e}=n;return Object.keys(e).reduce((t,r)=>{const i=e[r];if(i==null)return t;let o="";return typeof i=="object"?o=Ie(i):o=i,t[r]=o,t},Object.create(null))}exports.BubbleMenu=Ce;exports.EditorContent=pe;exports.NodeViewWrapper=Te;exports.ReactNodeViewRenderer=Ne;exports.ReactRenderer=te;exports.clsx=Ve;exports.getDatasetAttribute=He;exports.nodeAttrsToDataset=Be;exports.useEditor=we;
@@ -1,11 +1,11 @@
1
- import { P as ue, a as ae, j as de, i as le, p as ce, E as he, k as fe, l as pe, o as me } from "./index-BWx1Mchx.js";
1
+ import { P as ue, a as ae, j as de, i as ce, p as le, E as he, k as fe, l as pe, o as me } from "./index-DI9T3iLd.js";
2
2
  import ve from "tippy.js";
3
- import g, { useRef as Se, useState as F, useDebugValue as k, useEffect as K, forwardRef as ye, useLayoutEffect as Ee, useContext as ee, createContext as te, createRef as _e, memo as ge, createElement as be, version as q } from "react";
3
+ import g, { useRef as Se, useState as F, useDebugValue as Z, useEffect as K, forwardRef as ye, useLayoutEffect as Ee, useContext as ee, createContext as te, createRef as _e, memo as ge, createElement as be, version as q } from "react";
4
4
  import Oe, { flushSync as we } from "react-dom";
5
5
  class De {
6
6
  constructor({ editor: e, element: t, view: r, tippyOptions: i = {}, updateDelay: o = 250, shouldShow: h }) {
7
- this.preventHide = !1, this.shouldShow = ({ view: s, state: f, from: l, to: d }) => {
8
- const { doc: u, selection: p } = f, { empty: m } = p, y = !u.textBetween(l, d).length && de(f.selection), S = this.element.contains(document.activeElement);
7
+ this.preventHide = !1, this.shouldShow = ({ view: s, state: f, from: d, to: c }) => {
8
+ const { doc: u, selection: p } = f, { empty: m } = p, y = !u.textBetween(d, c).length && de(f.selection), S = this.element.contains(document.activeElement);
9
9
  return !(!(s.hasFocus() || S) || m || y || !this.editor.isEditable);
10
10
  }, this.mousedownHandler = () => {
11
11
  this.preventHide = !0;
@@ -23,32 +23,32 @@ class De {
23
23
  }, this.tippyBlurHandler = (s) => {
24
24
  this.blurHandler({ event: s });
25
25
  }, this.handleDebouncedUpdate = (s, f) => {
26
- const l = !(f != null && f.selection.eq(s.state.selection)), d = !(f != null && f.doc.eq(s.state.doc));
27
- !l && !d || (this.updateDebounceTimer && clearTimeout(this.updateDebounceTimer), this.updateDebounceTimer = window.setTimeout(() => {
28
- this.updateHandler(s, l, d, f);
26
+ const d = !(f != null && f.selection.eq(s.state.selection)), c = !(f != null && f.doc.eq(s.state.doc));
27
+ !d && !c || (this.updateDebounceTimer && clearTimeout(this.updateDebounceTimer), this.updateDebounceTimer = window.setTimeout(() => {
28
+ this.updateHandler(s, d, c, f);
29
29
  }, this.updateDelay));
30
- }, this.updateHandler = (s, f, l, d) => {
30
+ }, this.updateHandler = (s, f, d, c) => {
31
31
  var u, p, m;
32
32
  const { state: y, composing: S } = s, { selection: E } = y;
33
- if (S || !f && !l)
33
+ if (S || !f && !d)
34
34
  return;
35
35
  this.createTooltip();
36
- const { ranges: D } = E, v = Math.min(...D.map((a) => a.$from.pos)), c = Math.max(...D.map((a) => a.$to.pos));
36
+ const { ranges: D } = E, v = Math.min(...D.map((a) => a.$from.pos)), l = Math.max(...D.map((a) => a.$to.pos));
37
37
  if (!((u = this.shouldShow) === null || u === void 0 ? void 0 : u.call(this, {
38
38
  editor: this.editor,
39
39
  element: this.element,
40
40
  view: s,
41
41
  state: y,
42
- oldState: d,
42
+ oldState: c,
43
43
  from: v,
44
- to: c
44
+ to: l
45
45
  }))) {
46
46
  this.hide();
47
47
  return;
48
48
  }
49
49
  (p = this.tippy) === null || p === void 0 || p.setProps({
50
50
  getReferenceClientRect: ((m = this.tippyOptions) === null || m === void 0 ? void 0 : m.getReferenceClientRect) || (() => {
51
- if (le(y.selection)) {
51
+ if (ce(y.selection)) {
52
52
  let a = s.nodeDOM(v);
53
53
  if (a) {
54
54
  const _ = a.dataset.nodeViewWrapper ? a : a.querySelector("[data-node-view-wrapper]");
@@ -56,14 +56,14 @@ class De {
56
56
  return a.getBoundingClientRect();
57
57
  }
58
58
  }
59
- return ce(s, v, c);
59
+ return le(s, v, l);
60
60
  })
61
61
  }), this.show();
62
62
  }, this.editor = e, this.element = t, this.view = r, this.updateDelay = o, h && (this.shouldShow = h), 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.tippyOptions = i, this.element.remove(), this.element.style.visibility = "visible";
63
63
  }
64
64
  createTooltip() {
65
65
  const { element: e } = this.editor.options, t = !!e.parentElement;
66
- this.tippy || !t || (this.tippy = ve(e, {
66
+ this.element.tabIndex = 0, !(this.tippy || !t) && (this.tippy = ve(e, {
67
67
  duration: 0,
68
68
  getReferenceClientRect: null,
69
69
  content: this.element,
@@ -166,11 +166,11 @@ function Re() {
166
166
  return !0;
167
167
  }
168
168
  }
169
- function l(u, p) {
169
+ function d(u, p) {
170
170
  return p();
171
171
  }
172
- var d = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? l : s;
173
- return I.useSyncExternalStore = n.useSyncExternalStore !== void 0 ? n.useSyncExternalStore : d, I;
172
+ var c = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? d : s;
173
+ return I.useSyncExternalStore = n.useSyncExternalStore !== void 0 ? n.useSyncExternalStore : c, I;
174
174
  }
175
175
  var H = {};
176
176
  /**
@@ -189,43 +189,43 @@ function Te() {
189
189
  var n = g, e = n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
190
190
  function t(v) {
191
191
  {
192
- for (var c = arguments.length, b = new Array(c > 1 ? c - 1 : 0), a = 1; a < c; a++)
192
+ for (var l = arguments.length, b = new Array(l > 1 ? l - 1 : 0), a = 1; a < l; a++)
193
193
  b[a - 1] = arguments[a];
194
194
  r("error", v, b);
195
195
  }
196
196
  }
197
- function r(v, c, b) {
197
+ function r(v, l, b) {
198
198
  {
199
199
  var a = e.ReactDebugCurrentFrame, _ = a.getStackAddendum();
200
- _ !== "" && (c += "%s", b = b.concat([_]));
200
+ _ !== "" && (l += "%s", b = b.concat([_]));
201
201
  var w = b.map(function(O) {
202
202
  return String(O);
203
203
  });
204
- w.unshift("Warning: " + c), Function.prototype.apply.call(console[v], console, w);
204
+ w.unshift("Warning: " + l), Function.prototype.apply.call(console[v], console, w);
205
205
  }
206
206
  }
207
- function i(v, c) {
208
- return v === c && (v !== 0 || 1 / v === 1 / c) || v !== v && c !== c;
207
+ function i(v, l) {
208
+ return v === l && (v !== 0 || 1 / v === 1 / l) || v !== v && l !== l;
209
209
  }
210
- var o = typeof Object.is == "function" ? Object.is : i, h = n.useState, s = n.useEffect, f = n.useLayoutEffect, l = n.useDebugValue, d = !1, u = !1;
211
- function p(v, c, b) {
212
- d || n.startTransition !== void 0 && (d = !0, t("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));
213
- var a = c();
210
+ var o = typeof Object.is == "function" ? Object.is : i, h = n.useState, s = n.useEffect, f = n.useLayoutEffect, d = n.useDebugValue, c = !1, u = !1;
211
+ function p(v, l, b) {
212
+ c || n.startTransition !== void 0 && (c = !0, t("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));
213
+ var a = l();
214
214
  if (!u) {
215
- var _ = c();
215
+ var _ = l();
216
216
  o(a, _) || (t("The result of getSnapshot should be cached to avoid an infinite loop"), u = !0);
217
217
  }
218
218
  var w = h({
219
219
  inst: {
220
220
  value: a,
221
- getSnapshot: c
221
+ getSnapshot: l
222
222
  }
223
223
  }), O = w[0].inst, R = w[1];
224
224
  return f(function() {
225
- O.value = a, O.getSnapshot = c, m(O) && R({
225
+ O.value = a, O.getSnapshot = l, m(O) && R({
226
226
  inst: O
227
227
  });
228
- }, [v, a, c]), s(function() {
228
+ }, [v, a, l]), s(function() {
229
229
  m(O) && R({
230
230
  inst: O
231
231
  });
@@ -235,19 +235,19 @@ function Te() {
235
235
  });
236
236
  };
237
237
  return v(L);
238
- }, [v]), l(a), a;
238
+ }, [v]), d(a), a;
239
239
  }
240
240
  function m(v) {
241
- var c = v.getSnapshot, b = v.value;
241
+ var l = v.getSnapshot, b = v.value;
242
242
  try {
243
- var a = c();
243
+ var a = l();
244
244
  return !o(b, a);
245
245
  } catch {
246
246
  return !0;
247
247
  }
248
248
  }
249
- function y(v, c, b) {
250
- return c();
249
+ function y(v, l, b) {
250
+ return l();
251
251
  }
252
252
  var S = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u", E = !S, C = E ? y : p, D = n.useSyncExternalStore !== void 0 ? n.useSyncExternalStore : C;
253
253
  H.useSyncExternalStore = D, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
@@ -416,11 +416,11 @@ function He() {
416
416
  if (J) return B;
417
417
  J = 1;
418
418
  var n = g, e = M;
419
- function t(l, d) {
420
- return l === d && (l !== 0 || 1 / l === 1 / d) || l !== l && d !== d;
419
+ function t(d, c) {
420
+ return d === c && (d !== 0 || 1 / d === 1 / c) || d !== d && c !== c;
421
421
  }
422
422
  var r = typeof Object.is == "function" ? Object.is : t, i = e.useSyncExternalStore, o = n.useRef, h = n.useEffect, s = n.useMemo, f = n.useDebugValue;
423
- return B.useSyncExternalStoreWithSelector = function(l, d, u, p, m) {
423
+ return B.useSyncExternalStoreWithSelector = function(d, c, u, p, m) {
424
424
  var y = o(null);
425
425
  if (y.current === null) {
426
426
  var S = { hasValue: !1, value: null };
@@ -431,22 +431,22 @@ function He() {
431
431
  if (!D) {
432
432
  if (D = !0, v = a, a = p(a), m !== void 0 && S.hasValue) {
433
433
  var _ = S.value;
434
- if (m(_, a)) return c = _;
434
+ if (m(_, a)) return l = _;
435
435
  }
436
- return c = a;
436
+ return l = a;
437
437
  }
438
- if (_ = c, r(v, a)) return _;
438
+ if (_ = l, r(v, a)) return _;
439
439
  var w = p(a);
440
- return m !== void 0 && m(_, w) ? _ : (v = a, c = w);
440
+ return m !== void 0 && m(_, w) ? _ : (v = a, l = w);
441
441
  }
442
- var D = !1, v, c, b = u === void 0 ? null : u;
442
+ var D = !1, v, l, b = u === void 0 ? null : u;
443
443
  return [function() {
444
- return C(d());
444
+ return C(c());
445
445
  }, b === null ? void 0 : function() {
446
446
  return C(b());
447
447
  }];
448
- }, [d, u, p, m]);
449
- var E = i(l, y[0], y[1]);
448
+ }, [c, u, p, m]);
449
+ var E = i(d, y[0], y[1]);
450
450
  return h(function() {
451
451
  S.hasValue = !0, S.value = E;
452
452
  }, [E]), f(E), E;
@@ -467,11 +467,11 @@ function Be() {
467
467
  return Y || (Y = 1, process.env.NODE_ENV !== "production" && function() {
468
468
  typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
469
469
  var n = g, e = M;
470
- function t(d, u) {
471
- return d === u && (d !== 0 || 1 / d === 1 / u) || d !== d && u !== u;
470
+ function t(c, u) {
471
+ return c === u && (c !== 0 || 1 / c === 1 / u) || c !== c && u !== u;
472
472
  }
473
473
  var r = typeof Object.is == "function" ? Object.is : t, i = e.useSyncExternalStore, o = n.useRef, h = n.useEffect, s = n.useMemo, f = n.useDebugValue;
474
- function l(d, u, p, m, y) {
474
+ function d(c, u, p, m, y) {
475
475
  var S = o(null), E;
476
476
  S.current === null ? (E = {
477
477
  hasValue: !1,
@@ -500,12 +500,12 @@ function Be() {
500
500
  return w(O());
501
501
  };
502
502
  return [R, L];
503
- }, [u, p, m, y]), D = C[0], v = C[1], c = i(d, D, v);
503
+ }, [u, p, m, y]), D = C[0], v = C[1], l = i(c, D, v);
504
504
  return h(function() {
505
- E.hasValue = !0, E.value = c;
506
- }, [c]), f(c), c;
505
+ E.hasValue = !0, E.value = l;
506
+ }, [l]), f(l), l;
507
507
  }
508
- j.useSyncExternalStoreWithSelector = l, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
508
+ j.useSyncExternalStoreWithSelector = d, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
509
509
  }()), j;
510
510
  }
511
511
  process.env.NODE_ENV === "production" ? U.exports = He() : U.exports = Be();
@@ -552,9 +552,9 @@ class Ue {
552
552
  function $e(n) {
553
553
  var e;
554
554
  const [t] = F(() => new Ue(n.editor)), r = je.useSyncExternalStoreWithSelector(t.subscribe, t.getSnapshot, t.getServerSnapshot, n.selector, (e = n.equalityFn) !== null && e !== void 0 ? e : Ie);
555
- return Pe(() => t.watch(n.editor), [n.editor, t]), k(r), r;
555
+ return Pe(() => t.watch(n.editor), [n.editor, t]), Z(r), r;
556
556
  }
557
- const Q = process.env.NODE_ENV !== "production", $ = typeof window > "u", Fe = $ || !!(typeof window < "u" && window.next);
557
+ const k = process.env.NODE_ENV !== "production", $ = typeof window > "u", Fe = $ || !!(typeof window < "u" && window.next);
558
558
  class W {
559
559
  constructor(e) {
560
560
  this.editor = null, this.subscriptions = /* @__PURE__ */ new Set(), this.isComponentMounted = !1, this.previousDeps = null, this.instanceId = "", this.options = e, this.subscriptions = /* @__PURE__ */ new Set(), this.setEditor(this.getInitialEditor()), this.scheduleDestroy(), this.getEditor = this.getEditor.bind(this), this.getServerSnapshot = this.getServerSnapshot.bind(this), this.subscribe = this.subscribe.bind(this), this.refreshEditorInstance = this.refreshEditorInstance.bind(this), this.scheduleDestroy = this.scheduleDestroy.bind(this), this.onRender = this.onRender.bind(this), this.createEditor = this.createEditor.bind(this);
@@ -564,8 +564,8 @@ class W {
564
564
  }
565
565
  getInitialEditor() {
566
566
  if (this.options.current.immediatelyRender === void 0)
567
- return $ || Fe ? (Q && console.warn("Tiptap Error: SSR has been detected, please set `immediatelyRender` explicitly to `false` to avoid hydration mismatches."), null) : this.createEditor();
568
- if (this.options.current.immediatelyRender && $ && Q)
567
+ return $ || Fe ? (k && console.warn("Tiptap Error: SSR has been detected, please set `immediatelyRender` explicitly to `false` to avoid hydration mismatches."), null) : this.createEditor();
568
+ if (this.options.current.immediatelyRender && $ && k)
569
569
  throw new Error("Tiptap Error: SSR has been detected, and `immediatelyRender` has been set to `true` this is an unsupported configuration that may result in errors, explicitly set `immediatelyRender` to `false` to avoid hydration mismatches.");
570
570
  return this.options.current.immediatelyRender ? this.createEditor() : null;
571
571
  }
@@ -696,7 +696,7 @@ function nt(n = {}, e = []) {
696
696
  const t = Se(n);
697
697
  t.current = n;
698
698
  const [r] = F(() => new W(t)), i = M.useSyncExternalStore(r.subscribe, r.getEditor, r.getServerSnapshot);
699
- return k(i), K(r.onRender(e)), $e({
699
+ return Z(i), K(r.onRender(e)), $e({
700
700
  editor: i,
701
701
  selector: ({ transactionNumber: o }) => n.shouldRerenderOnTransaction === !1 ? null : n.immediatelyRender && o === 0 ? 0 : o + 1
702
702
  }), i;
@@ -711,21 +711,21 @@ const Ke = () => ee(re), rt = (n) => {
711
711
  var i;
712
712
  if (!e || !((i = n.editor) === null || i === void 0) && i.isDestroyed || r != null && r.isDestroyed)
713
713
  return;
714
- const { pluginKey: o = "bubbleMenu", editor: h, tippyOptions: s = {}, updateDelay: f, shouldShow: l = null } = n, d = h || r;
715
- if (!d) {
714
+ const { pluginKey: o = "bubbleMenu", editor: h, tippyOptions: s = {}, updateDelay: f, shouldShow: d = null } = n, c = h || r;
715
+ if (!c) {
716
716
  console.warn("BubbleMenu component is not rendered inside of an editor component or does not have editor prop.");
717
717
  return;
718
718
  }
719
719
  const u = ne({
720
720
  updateDelay: f,
721
- editor: d,
721
+ editor: c,
722
722
  element: e,
723
723
  pluginKey: o,
724
- shouldShow: l,
724
+ shouldShow: d,
725
725
  tippyOptions: s
726
726
  });
727
- return d.registerPlugin(u), () => {
728
- d.unregisterPlugin(o);
727
+ return c.registerPlugin(u), () => {
728
+ c.unregisterPlugin(o);
729
729
  };
730
730
  }, [n.editor, r, e]), g.createElement("div", { ref: t, className: n.className, style: { visibility: "hidden" } }, n.children);
731
731
  }, ie = te({
@@ -740,22 +740,22 @@ const Ke = () => ee(re), rt = (n) => {
740
740
  } })
741
741
  );
742
742
  });
743
- function X(n) {
743
+ function Q(n) {
744
744
  return !!(typeof n == "function" && n.prototype && n.prototype.isReactComponent);
745
745
  }
746
- function Z(n) {
746
+ function X(n) {
747
747
  return !!(typeof n == "object" && n.$$typeof && (n.$$typeof.toString() === "Symbol(react.forward_ref)" || n.$$typeof.description === "react.forward_ref"));
748
748
  }
749
749
  function qe(n) {
750
750
  return !!(typeof n == "object" && n.$$typeof && (n.$$typeof.toString() === "Symbol(react.memo)" || n.$$typeof.description === "react.memo"));
751
751
  }
752
752
  function ze(n) {
753
- if (X(n) || Z(n))
753
+ if (Q(n) || X(n))
754
754
  return !0;
755
755
  if (qe(n)) {
756
756
  const e = n.type;
757
757
  if (e)
758
- return X(e) || Z(e);
758
+ return Q(e) || X(e);
759
759
  }
760
760
  return !1;
761
761
  }
@@ -774,7 +774,9 @@ class Je {
774
774
  constructor(e, { editor: t, props: r = {}, as: i = "div", className: o = "" }) {
775
775
  this.ref = null, this.id = Math.floor(Math.random() * 4294967295).toString(), this.component = e, this.editor = t, this.props = r, this.element = document.createElement(i), this.element.classList.add("react-renderer"), o && this.element.classList.add(...o.split(" ")), this.editor.isInitialized ? we(() => {
776
776
  this.render();
777
- }) : this.render();
777
+ }) : queueMicrotask(() => {
778
+ this.render();
779
+ });
778
780
  }
779
781
  /**
780
782
  * Render the React component.
@@ -813,6 +815,15 @@ class Je {
813
815
  }
814
816
  }
815
817
  class Ye extends pe {
818
+ constructor(e, t, r) {
819
+ if (super(e, t, r), !this.node.isLeaf) {
820
+ this.options.contentDOMElementTag ? this.contentDOMElement = document.createElement(this.options.contentDOMElementTag) : this.contentDOMElement = document.createElement(this.node.isInline ? "span" : "div"), this.contentDOMElement.dataset.nodeViewContentReact = "", this.contentDOMElement.dataset.nodeViewWrapper = "", this.contentDOMElement.style.whiteSpace = "inherit";
821
+ const i = this.dom.querySelector("[data-node-view-content]");
822
+ if (!i)
823
+ return;
824
+ i.appendChild(this.contentDOMElement);
825
+ }
826
+ }
816
827
  /**
817
828
  * Setup the React component.
818
829
  * Called on initialization.
@@ -828,18 +839,18 @@ class Ye extends pe {
828
839
  extension: this.extension,
829
840
  HTMLAttributes: this.HTMLAttributes,
830
841
  getPos: () => this.getPos(),
831
- updateAttributes: (l = {}) => this.updateAttributes(l),
842
+ updateAttributes: (d = {}) => this.updateAttributes(d),
832
843
  deleteNode: () => this.deleteNode(),
833
844
  ref: _e()
834
845
  };
835
846
  if (!this.component.displayName) {
836
- const l = (d) => d.charAt(0).toUpperCase() + d.substring(1);
837
- this.component.displayName = l(this.extension.name);
847
+ const d = (c) => c.charAt(0).toUpperCase() + c.substring(1);
848
+ this.component.displayName = d(this.extension.name);
838
849
  }
839
- const i = { onDragStart: this.onDragStart.bind(this), nodeViewContentRef: (l) => {
840
- l && this.contentDOMElement && l.firstChild !== this.contentDOMElement && l.appendChild(this.contentDOMElement);
841
- } }, o = this.component, h = ge((l) => g.createElement(ie.Provider, { value: i }, be(o, l)));
842
- h.displayName = "ReactNodeView", this.node.isLeaf ? this.contentDOMElement = null : this.options.contentDOMElementTag ? this.contentDOMElement = document.createElement(this.options.contentDOMElementTag) : this.contentDOMElement = document.createElement(this.node.isInline ? "span" : "div"), this.contentDOMElement && (this.contentDOMElement.dataset.nodeViewContentReact = "", this.contentDOMElement.style.whiteSpace = "inherit");
850
+ const i = { onDragStart: this.onDragStart.bind(this), nodeViewContentRef: (d) => {
851
+ d && this.contentDOMElement && d.firstChild !== this.contentDOMElement && (d.hasAttribute("data-node-view-wrapper") && d.removeAttribute("data-node-view-wrapper"), d.appendChild(this.contentDOMElement));
852
+ } }, o = this.component, h = ge((d) => g.createElement(ie.Provider, { value: i }, be(o, d)));
853
+ h.displayName = "ReactNodeView";
843
854
  let s = this.node.isInline ? "span" : "div";
844
855
  this.options.as && (s = this.options.as);
845
856
  const { className: f = "" } = this.options;
@@ -964,7 +975,7 @@ function st() {
964
975
  for (var n, e, t = 0, r = "", i = arguments.length; t < i; t++) (n = arguments[t]) && (e = oe(n)) && (r && (r += " "), r += e);
965
976
  return r;
966
977
  }
967
- function Qe(n) {
978
+ function ke(n) {
968
979
  try {
969
980
  return JSON.stringify(n);
970
981
  } catch {
@@ -978,9 +989,9 @@ function ut(n, e = !1) {
978
989
  if (i == null || typeof i == "string" && i === "null")
979
990
  try {
980
991
  const s = t.outerHTML.match(/([\S\s])+?="([\S\s])+?"/g);
981
- s && s.length > 0 && (i = (s.map((l) => l.trim()).reduce((l, d) => {
982
- const u = d.indexOf("="), p = [d.slice(0, u), d.slice(u + 1).slice(1, -1)];
983
- return l[p[0]] = p[1], l;
992
+ s && s.length > 0 && (i = (s.map((d) => d.trim()).reduce((d, c) => {
993
+ const u = c.indexOf("="), p = [c.slice(0, u), c.slice(u + 1).slice(1, -1)];
994
+ return d[p[0]] = p[1], d;
984
995
  }, {})[n.toLowerCase()] || "").replaceAll("&quot;", '"'));
985
996
  } catch (h) {
986
997
  console.error("Error getDatasetAttribute ", h.message, t);
@@ -1004,7 +1015,7 @@ function at(n) {
1004
1015
  if (i == null)
1005
1016
  return t;
1006
1017
  let o = "";
1007
- return typeof i == "object" ? o = Qe(i) : o = i, t[r] = o, t;
1018
+ return typeof i == "object" ? o = ke(i) : o = i, t[r] = o, t;
1008
1019
  }, /* @__PURE__ */ Object.create(null));
1009
1020
  }
1010
1021
  export {
@@ -0,0 +1 @@
1
+ "use strict";const _=require("./index-ByRfqzMr.cjs");function L(D){var a;const{char:E,allowSpaces:M,allowToIncludeChar:I,allowedPrefixes:g,startOfLine:k,$position:f}=D,R=M&&!I,v=_.escapeForRegEx(E),A=new RegExp(`\\s${v}$`),P=k?"^":"",B=I?"":v,y=R?new RegExp(`${P}${v}.*?(?=\\s${B}|$)`,"gm"):new RegExp(`${P}(?:^)?${v}[^\\s${B}]*`,"gm"),p=((a=f.nodeBefore)===null||a===void 0?void 0:a.isText)&&f.nodeBefore.text;if(!p)return null;const K=f.pos-p.length,n=Array.from(p.matchAll(y)).pop();if(!n||n.input===void 0||n.index===void 0)return null;const e=n.input.slice(Math.max(0,n.index-1),n.index),h=new RegExp(`^[${g==null?void 0:g.join("")}\0]?$`).test(e);if(g!==null&&!h)return null;const o=K+n.index;let i=o+n[0].length;return R&&A.test(p.slice(i-1,i+1))&&(n[0]+=" ",i+=1),o<f.pos&&i>=f.pos?{range:{from:o,to:i},query:n[0].slice(E.length),text:n[0]}:null}const z=new _.PluginKey("suggestion");function G({pluginKey:D=z,editor:a,char:E="@",allowSpaces:M=!1,allowToIncludeChar:I=!1,allowedPrefixes:g=[" "],startOfLine:k=!1,decorationTag:f="span",decorationClass:R="suggestion",decorationContent:v="",decorationEmptyClass:A="is-empty",command:P=()=>null,items:B=()=>[],render:y=()=>({}),allow:p=()=>!0,findSuggestionMatch:K=L}){let n;const e=y==null?void 0:y(),h=new _.Plugin({key:D,view(){return{update:async(o,i)=>{var s,r,c,u,d,S,m;const t=(s=this.key)===null||s===void 0?void 0:s.getState(i),l=(r=this.key)===null||r===void 0?void 0:r.getState(o.state),$=t.active&&l.active&&t.range.from!==l.range.from,F=!t.active&&l.active,O=t.active&&!l.active,N=!F&&!O&&t.query!==l.query,q=F||$&&N,C=N||$,b=O||$&&N;if(!q&&!C&&!b)return;const x=b&&!q?t:l,T=o.dom.querySelector(`[data-decoration-id="${x.decorationId}"]`);n={editor:a,range:x.range,query:x.query,text:x.text,items:[],command:w=>P({editor:a,range:x.range,props:w}),decorationNode:T,clientRect:T?()=>{var w;const{decorationId:U}=(w=this.key)===null||w===void 0?void 0:w.getState(a.state),j=o.dom.querySelector(`[data-decoration-id="${U}"]`);return(j==null?void 0:j.getBoundingClientRect())||null}:null},q&&((c=e==null?void 0:e.onBeforeStart)===null||c===void 0||c.call(e,n)),C&&((u=e==null?void 0:e.onBeforeUpdate)===null||u===void 0||u.call(e,n)),(C||q)&&(n.items=await B({editor:a,query:x.query})),b&&((d=e==null?void 0:e.onExit)===null||d===void 0||d.call(e,n)),C&&((S=e==null?void 0:e.onUpdate)===null||S===void 0||S.call(e,n)),q&&((m=e==null?void 0:e.onStart)===null||m===void 0||m.call(e,n))},destroy:()=>{var o;n&&((o=e==null?void 0:e.onExit)===null||o===void 0||o.call(e,n))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(o,i,s,r){const{isEditable:c}=a,{composing:u}=a.view,{selection:d}=o,{empty:S,from:m}=d,t={...i};if(t.composing=u,c&&(S||a.view.composing)){(m<i.range.from||m>i.range.to)&&!u&&!i.composing&&(t.active=!1);const l=K({char:E,allowSpaces:M,allowToIncludeChar:I,allowedPrefixes:g,startOfLine:k,$position:d.$from}),$=`id_${Math.floor(Math.random()*4294967295)}`;l&&p({editor:a,state:r,range:l.range,isActive:i.active})?(t.active=!0,t.decorationId=i.decorationId?i.decorationId:$,t.range=l.range,t.query=l.query,t.text=l.text):t.active=!1}else t.active=!1;return t.active||(t.decorationId=null,t.range={from:0,to:0},t.query=null,t.text=null),t}},props:{handleKeyDown(o,i){var s;const{active:r,range:c}=h.getState(o.state);return r&&((s=e==null?void 0:e.onKeyDown)===null||s===void 0?void 0:s.call(e,{view:o,event:i,range:c}))||!1},decorations(o){const{active:i,range:s,decorationId:r,query:c}=h.getState(o);if(!i)return null;const u=!(c!=null&&c.length),d=[R];return u&&d.push(A),_.DecorationSet.create(o.doc,[_.Decoration.inline(s.from,s.to,{nodeName:f,class:d.join(" "),"data-decoration-id":r,"data-decoration-content":v})])}}});return h}exports.Suggestion=G;