reactjs-tiptap-editor 1.0.22 → 1.0.24

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 (159) hide show
  1. package/lib/{ActionMenuButton-BBDqKvKg.cjs → ActionMenuButton-B8NhVw5m.cjs} +1 -1
  2. package/lib/{ActionMenuButton-B1067mIC.js → ActionMenuButton-HYlhmRvw.js} +1 -1
  3. package/lib/Attachment.cjs +1 -1
  4. package/lib/Attachment.js +4 -4
  5. package/lib/Blockquote.cjs +1 -1
  6. package/lib/Blockquote.js +2 -2
  7. package/lib/Bold.cjs +1 -1
  8. package/lib/Bold.js +2 -2
  9. package/lib/BulletList.cjs +1 -1
  10. package/lib/BulletList.js +2 -2
  11. package/lib/{Callout-lBlBlK_w.cjs → Callout-B-S2f0Qo.cjs} +1 -1
  12. package/lib/{Callout-V2mO6s2Y.js → Callout-CF7Y9yJ7.js} +4 -4
  13. package/lib/Callout.cjs +1 -1
  14. package/lib/Callout.js +4 -4
  15. package/lib/Clear.cjs +1 -1
  16. package/lib/Clear.js +2 -2
  17. package/lib/Code.cjs +1 -1
  18. package/lib/Code.js +6 -6
  19. package/lib/CodeBlock.cjs +1 -1
  20. package/lib/CodeBlock.js +27 -27
  21. package/lib/CodeView.cjs +1 -1
  22. package/lib/CodeView.js +2 -2
  23. package/lib/Color.cjs +1 -1
  24. package/lib/Color.js +3 -3
  25. package/lib/Column.cjs +1 -1
  26. package/lib/Column.js +7 -7
  27. package/lib/{Drawer-Cyv27orn.js → Drawer-CaXVhxo4.js} +21 -21
  28. package/lib/{Drawer-BeYo9jAG.cjs → Drawer-Was4hxYH.cjs} +1 -1
  29. package/lib/Drawer.cjs +1 -1
  30. package/lib/Drawer.js +4 -4
  31. package/lib/Emoji.cjs +1 -1
  32. package/lib/Emoji.js +4312 -1860
  33. package/lib/Excalidraw.cjs +1 -1
  34. package/lib/Excalidraw.js +3 -3
  35. package/lib/ExportPdf.cjs +1 -1
  36. package/lib/ExportPdf.js +2 -2
  37. package/lib/ExportWord.cjs +1 -1
  38. package/lib/ExportWord.js +2 -2
  39. package/lib/FontFamily.cjs +1 -1
  40. package/lib/FontFamily.js +5 -5
  41. package/lib/FontSize.cjs +1 -1
  42. package/lib/FontSize.js +9 -9
  43. package/lib/Heading.cjs +1 -1
  44. package/lib/Heading.js +5 -5
  45. package/lib/Highlight.cjs +1 -1
  46. package/lib/Highlight.js +69 -46
  47. package/lib/History.cjs +1 -1
  48. package/lib/History.js +556 -418
  49. package/lib/HorizontalRule.cjs +1 -1
  50. package/lib/HorizontalRule.js +2 -2
  51. package/lib/{Iframe-Bx-VDxSB.cjs → Iframe-BI0sq6pd.cjs} +1 -1
  52. package/lib/{Iframe-D9JVKzO0.js → Iframe-Bp986fj0.js} +3 -3
  53. package/lib/Iframe.cjs +1 -1
  54. package/lib/Iframe.js +3 -3
  55. package/lib/Image.cjs +1 -1
  56. package/lib/Image.js +3 -3
  57. package/lib/ImageGif.cjs +1 -1
  58. package/lib/ImageGif.js +47 -47
  59. package/lib/ImportWord.cjs +1 -1
  60. package/lib/ImportWord.js +3 -3
  61. package/lib/{Indent-B5tQ5Wfg.js → Indent-E6B8DkyN.js} +4 -4
  62. package/lib/{Indent-CCLO0KpG.cjs → Indent-FvM52kjA.cjs} +1 -1
  63. package/lib/Indent.cjs +1 -1
  64. package/lib/Indent.js +2 -2
  65. package/lib/Italic.cjs +1 -1
  66. package/lib/Italic.js +2 -2
  67. package/lib/{Katex-rtfVV2pl.cjs → Katex-DP6EjdKz.cjs} +1 -1
  68. package/lib/{Katex-w_c6vAMd.js → Katex-pzwyyiFJ.js} +5 -5
  69. package/lib/Katex.cjs +1 -1
  70. package/lib/Katex.js +3 -3
  71. package/lib/LineHeight.cjs +1 -1
  72. package/lib/LineHeight.js +4 -4
  73. package/lib/Link.cjs +1 -1
  74. package/lib/Link.js +2 -2
  75. package/lib/LinkEditBlock-Cmkmp2fW.cjs +5 -0
  76. package/lib/{LinkEditBlock-CTlU8YnO.js → LinkEditBlock-OjN4F2rM.js} +222 -224
  77. package/lib/MarkdownPaste.cjs +1 -1
  78. package/lib/MarkdownPaste.js +1 -1
  79. package/lib/Mention.cjs +1 -1
  80. package/lib/Mention.js +8 -8
  81. package/lib/Mermaid.cjs +1 -1
  82. package/lib/Mermaid.js +34 -34
  83. package/lib/MoreMark.cjs +1 -1
  84. package/lib/MoreMark.js +3 -3
  85. package/lib/OrderedList.cjs +1 -1
  86. package/lib/OrderedList.js +2 -2
  87. package/lib/SearchAndReplace.cjs +1 -1
  88. package/lib/SearchAndReplace.js +4 -4
  89. package/lib/SlashCommand.cjs +1 -1
  90. package/lib/SlashCommand.js +7 -7
  91. package/lib/{SlashCommandNodeView-CVKjpS6r.cjs → SlashCommandNodeView-DarAytvt.cjs} +1 -1
  92. package/lib/{SlashCommandNodeView-DNkpJuM3.js → SlashCommandNodeView-o323V8li.js} +2 -2
  93. package/lib/Strike.cjs +1 -1
  94. package/lib/Strike.js +2 -2
  95. package/lib/Table-CC9uNHPL.js +1984 -0
  96. package/lib/Table-Clnz-i4l.cjs +9 -0
  97. package/lib/Table.cjs +1 -1
  98. package/lib/Table.js +1 -1
  99. package/lib/TaskList.cjs +1 -1
  100. package/lib/TaskList.js +2 -2
  101. package/lib/TextAlign.cjs +1 -1
  102. package/lib/TextAlign.js +3 -3
  103. package/lib/TextDirection.cjs +1 -1
  104. package/lib/TextDirection.js +3 -3
  105. package/lib/TextUnderline.cjs +1 -1
  106. package/lib/TextUnderline.js +2 -2
  107. package/lib/{Twitter-BJjt8vv_.cjs → Twitter-0kmrijjL.cjs} +1 -1
  108. package/lib/{Twitter-CKm0M53B.js → Twitter-BVnXL8we.js} +5 -5
  109. package/lib/Twitter.cjs +1 -1
  110. package/lib/Twitter.js +3 -3
  111. package/lib/Video.cjs +1 -1
  112. package/lib/Video.js +3 -3
  113. package/lib/bubble.cjs +6 -6
  114. package/lib/bubble.js +1573 -1561
  115. package/lib/{clsx-Bg-2aTKh.js → clsx-0OU6n9va.js} +379 -353
  116. package/lib/clsx-D6gYQn3o.cjs +33 -0
  117. package/lib/{dropdown-menu-Dre693DD.cjs → dropdown-menu-BIGvxqiu.cjs} +1 -1
  118. package/lib/{dropdown-menu-AhMKS9PQ.js → dropdown-menu-BW2M6saA.js} +1 -1
  119. package/lib/index-BAb_UADw.cjs +1 -0
  120. package/lib/index-BF3EVCB1.cjs +2 -0
  121. package/lib/{index-D0EmqTpe.js → index-BblvcbTH.js} +1130 -1064
  122. package/lib/index-Bcj8cyOO.cjs +24 -0
  123. package/lib/{index-BfHAqkoX.js → index-BrsJsbds.js} +3 -3
  124. package/lib/index-CGjT-a9h.js +1377 -0
  125. package/lib/index-CPTpXLfX.cjs +11 -0
  126. package/lib/{index-C3dgmjIF.cjs → index-CUvjYuRp.cjs} +1 -1
  127. package/lib/{index-C4aGVY2E.cjs → index-CWw4s87s.cjs} +1 -1
  128. package/lib/{index-DXtVL0al.js → index-Cal5SPfB.js} +189 -134
  129. package/lib/{index-CjLxMm5d.js → index-D-Ouz0vF.js} +1 -1
  130. package/lib/{index-83hp1lZH.cjs → index-deubsx3z.cjs} +1 -1
  131. package/lib/{index-DtVRewGA.js → index-oj858lQO.js} +229 -31
  132. package/lib/{index-CbkpBnTX.js → index-zw-Kd38i.js} +47 -50
  133. package/lib/index.cjs +1 -1
  134. package/lib/index.js +2 -2
  135. package/lib/locale-bundle.cjs +1 -1
  136. package/lib/locale-bundle.js +7 -6
  137. package/lib/locales/index.d.ts +199 -1
  138. package/lib/locales/ja.d.ts +198 -0
  139. package/lib/{popover-B1ptDngu.js → popover-BIVHT1W9.js} +1 -1
  140. package/lib/{popover-D7w_FVSV.cjs → popover-DoSfJsFS.cjs} +1 -1
  141. package/lib/{renderNodeView-CbxCTni3.js → renderNodeView-CfWJK4rG.js} +2 -2
  142. package/lib/{renderNodeView-DFVrJy0l.cjs → renderNodeView-D--fDFov.cjs} +1 -1
  143. package/lib/{separator-C_7KkuoG.cjs → separator-SRbPfmGa.cjs} +1 -1
  144. package/lib/{separator-CDoF4Z4Z.js → separator-b-qOPJmp.js} +3 -3
  145. package/lib/{textarea-CNzZnjjW.js → textarea-CpxXPky_.js} +1 -1
  146. package/lib/{textarea-CEtXap1b.cjs → textarea-DbGw9oCU.cjs} +1 -1
  147. package/lib/updatePosition-BwzAsiY0.js +16 -0
  148. package/lib/{updatePosition-CQE1ct18.cjs → updatePosition-DGPtRfWN.cjs} +1 -1
  149. package/package.json +60 -60
  150. package/lib/LinkEditBlock-_41zgSyl.cjs +0 -5
  151. package/lib/Table-BFiU40iW.cjs +0 -9
  152. package/lib/Table-yZtD5Qo1.js +0 -1945
  153. package/lib/clsx-DSAWW32g.cjs +0 -33
  154. package/lib/index-C4WLt4NA.cjs +0 -24
  155. package/lib/index-DlxZt4_j.cjs +0 -1
  156. package/lib/index-P5_MyY0i.js +0 -1362
  157. package/lib/index-TcJ2UKnv.cjs +0 -1
  158. package/lib/index-fbGGohBT.cjs +0 -12
  159. package/lib/updatePosition-BGD41Hbg.js +0 -16
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "reactjs-tiptap-editor",
3
- "version": "1.0.22",
3
+ "version": "1.0.24",
4
4
  "description": "A modern WYSIWYG rich text editor based on tiptap and shadcn ui for React",
5
5
  "keywords": [
6
6
  "editor",
@@ -722,7 +722,7 @@
722
722
  "gen-contributors": "contributorkit"
723
723
  },
724
724
  "dependencies": {
725
- "@excalidraw/excalidraw": "^0.18.0",
725
+ "@excalidraw/excalidraw": "^0.18.1",
726
726
  "@floating-ui/dom": "^1.7.6",
727
727
  "@hocuspocus/provider": "^3.4.4",
728
728
  "@radix-ui/react-checkbox": "^1.3.3",
@@ -739,101 +739,101 @@
739
739
  "@radix-ui/react-toast": "^1.2.15",
740
740
  "@radix-ui/react-toggle": "^1.1.10",
741
741
  "@radix-ui/react-tooltip": "^1.2.8",
742
- "@tiptap/core": "^3.20.0",
743
- "@tiptap/extension-blockquote": "^3.20.0",
744
- "@tiptap/extension-bold": "^3.20.0",
745
- "@tiptap/extension-bullet-list": "^3.20.0",
746
- "@tiptap/extension-code": "^3.20.0",
747
- "@tiptap/extension-code-block-lowlight": "^3.22.1",
748
- "@tiptap/extension-collaboration": "^3.20.0",
749
- "@tiptap/extension-collaboration-caret": "^3.20.0",
750
- "@tiptap/extension-document": "^3.20.0",
751
- "@tiptap/extension-drag-handle": "^3.20.0",
752
- "@tiptap/extension-drag-handle-react": "^3.20.0",
753
- "@tiptap/extension-emoji": "^3.20.0",
754
- "@tiptap/extension-hard-break": "^3.20.0",
755
- "@tiptap/extension-heading": "^3.20.0",
756
- "@tiptap/extension-highlight": "^2.27.2",
757
- "@tiptap/extension-horizontal-rule": "^3.20.0",
758
- "@tiptap/extension-image": "^3.20.0",
759
- "@tiptap/extension-italic": "^3.20.0",
760
- "@tiptap/extension-link": "^3.20.0",
761
- "@tiptap/extension-list": "^3.20.0",
762
- "@tiptap/extension-list-item": "^3.20.0",
763
- "@tiptap/extension-mention": "^3.20.0",
764
- "@tiptap/extension-node-range": "^3.20.0",
765
- "@tiptap/extension-ordered-list": "^3.20.0",
766
- "@tiptap/extension-paragraph": "^3.20.0",
767
- "@tiptap/extension-strike": "^3.20.0",
768
- "@tiptap/extension-subscript": "^3.20.0",
769
- "@tiptap/extension-superscript": "^3.20.0",
770
- "@tiptap/extension-table": "^3.20.0",
771
- "@tiptap/extension-task-item": "^3.20.0",
772
- "@tiptap/extension-task-list": "^3.20.0",
773
- "@tiptap/extension-text": "^3.20.0",
774
- "@tiptap/extension-text-align": "^3.20.0",
775
- "@tiptap/extension-text-style": "^3.20.0",
776
- "@tiptap/extension-underline": "^3.20.0",
777
- "@tiptap/extensions": "^3.20.0",
778
- "@tiptap/pm": "^3.20.0",
779
- "@tiptap/react": "^3.20.0",
780
- "@tiptap/suggestion": "^3.20.0",
781
- "@tiptap/y-tiptap": "^3.0.2",
742
+ "@tiptap/core": "^3.23.6",
743
+ "@tiptap/extension-blockquote": "^3.23.6",
744
+ "@tiptap/extension-bold": "^3.23.6",
745
+ "@tiptap/extension-bullet-list": "^3.23.6",
746
+ "@tiptap/extension-code": "^3.23.6",
747
+ "@tiptap/extension-code-block-lowlight": "^3.23.6",
748
+ "@tiptap/extension-collaboration": "^3.23.6",
749
+ "@tiptap/extension-collaboration-caret": "^3.23.6",
750
+ "@tiptap/extension-document": "^3.23.6",
751
+ "@tiptap/extension-drag-handle": "^3.23.6",
752
+ "@tiptap/extension-drag-handle-react": "^3.23.6",
753
+ "@tiptap/extension-emoji": "^3.23.6",
754
+ "@tiptap/extension-hard-break": "^3.23.6",
755
+ "@tiptap/extension-heading": "^3.23.6",
756
+ "@tiptap/extension-highlight": "^3.23.6",
757
+ "@tiptap/extension-horizontal-rule": "^3.23.6",
758
+ "@tiptap/extension-image": "^3.23.6",
759
+ "@tiptap/extension-italic": "^3.23.6",
760
+ "@tiptap/extension-link": "^3.23.6",
761
+ "@tiptap/extension-list": "^3.23.6",
762
+ "@tiptap/extension-list-item": "^3.23.6",
763
+ "@tiptap/extension-mention": "^3.23.6",
764
+ "@tiptap/extension-node-range": "^3.23.6",
765
+ "@tiptap/extension-ordered-list": "^3.23.6",
766
+ "@tiptap/extension-paragraph": "^3.23.6",
767
+ "@tiptap/extension-strike": "^3.23.6",
768
+ "@tiptap/extension-subscript": "^3.23.6",
769
+ "@tiptap/extension-superscript": "^3.23.6",
770
+ "@tiptap/extension-table": "^3.23.6",
771
+ "@tiptap/extension-task-item": "^3.23.6",
772
+ "@tiptap/extension-task-list": "^3.23.6",
773
+ "@tiptap/extension-text": "^3.23.6",
774
+ "@tiptap/extension-text-align": "^3.23.6",
775
+ "@tiptap/extension-text-style": "^3.23.6",
776
+ "@tiptap/extension-underline": "^3.23.6",
777
+ "@tiptap/extensions": "^3.23.6",
778
+ "@tiptap/pm": "^3.23.6",
779
+ "@tiptap/react": "^3.23.6",
780
+ "@tiptap/suggestion": "^3.23.6",
781
+ "@tiptap/y-tiptap": "^3.0.3",
782
782
  "class-variance-authority": "^0.7.1",
783
783
  "clsx": "^2.1.1",
784
784
  "deep-equal": "^2.2.3",
785
- "docx": "^9.6.0",
785
+ "docx": "^9.6.1",
786
786
  "easydrawer": "^0.0.15",
787
787
  "frimousse": "^0.3.0",
788
788
  "highlight.js": "^11.11.1",
789
- "katex": "^0.16.33",
790
- "lodash-es": "^4.17.23",
789
+ "katex": "^0.16.47",
790
+ "lodash-es": "^4.18.1",
791
791
  "lowlight": "^3.3.0",
792
792
  "lucide-react": "^0.427.0",
793
- "marked": "^15.0.0",
794
- "mermaid": "^11.12.3",
793
+ "marked": "^15.0.12",
794
+ "mermaid": "^11.15.0",
795
795
  "prosemirror-docx": "^0.2.1",
796
796
  "re-resizable": "^6.11.2",
797
- "react-colorful": "^5.6.1",
797
+ "react-colorful": "^5.7.0",
798
798
  "react-image-crop": "^11.0.10",
799
799
  "react-tweet": "^3.3.0",
800
800
  "reactjs-signal": "^2.0.4",
801
801
  "scroll-into-view-if-needed": "^3.1.0",
802
802
  "svg64": "^2.0.0",
803
803
  "y-protocols": "^1.0.7",
804
- "yjs": "^13.6.29"
804
+ "yjs": "^13.6.30"
805
805
  },
806
806
  "devDependencies": {
807
807
  "@types/deep-equal": "^1.0.4",
808
808
  "@types/katex": "^0.16.8",
809
809
  "@types/lodash-es": "^4.17.12",
810
- "@types/node": "^24.11.0",
811
- "@types/react": "^19.2.14",
810
+ "@types/node": "^24.12.4",
811
+ "@types/react": "^19.2.15",
812
812
  "@types/react-dom": "^19.2.3",
813
- "@vitejs/plugin-react": "^5.1.4",
814
- "autoprefixer": "^10.4.27",
813
+ "@vitejs/plugin-react": "^5.2.0",
814
+ "autoprefixer": "^10.5.0",
815
815
  "bumpp": "^10.4.1",
816
816
  "contributorkit": "^0.0.4",
817
817
  "esno": "^4.8.0",
818
818
  "execa": "^9.6.1",
819
819
  "git-scm-hooks": "^0.2.0",
820
820
  "globby": "^14.1.0",
821
- "mammoth": "^1.11.0",
821
+ "mammoth": "^1.12.0",
822
822
  "md5": "^2.3.0",
823
823
  "oxfmt": "^0.26.0",
824
- "oxlint": "^1.51.0",
825
- "postcss": "^8.5.8",
824
+ "oxlint": "^1.66.0",
825
+ "postcss": "^8.5.15",
826
826
  "postcss-replace": "^2.0.1",
827
827
  "postcss-scss": "^4.0.9",
828
- "react": "^19.2.4",
829
- "react-dom": "^19.2.4",
830
- "sass": "^1.97.3",
828
+ "react": "^19.2.6",
829
+ "react-dom": "^19.2.6",
830
+ "sass": "^1.100.0",
831
831
  "tailwind-merge": "^2.6.1",
832
832
  "tailwindcss": "^3.4.19",
833
833
  "typescript": "^5.9.3",
834
834
  "unplugin-dts": "1.0.0-beta.6",
835
835
  "verify-commit-msg": "^0.1.0",
836
- "vite": "^6.4.1"
836
+ "vite": "^6.4.2"
837
837
  },
838
838
  "browserslist": [
839
839
  ">0.3%",
@@ -1,5 +0,0 @@
1
- "use strict";const k=require("react/jsx-runtime"),F=require("react"),R=require("./index-83hp1lZH.cjs");require("./theme.cjs");const I=require("./index-C4WLt4NA.cjs"),_=require("@tiptap/pm/state"),we=require("./index-C4aGVY2E.cjs"),Wt=require("./popover-D7w_FVSV.cjs"),He="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",je="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",Qt="numeric",Jt="ascii",Yt="alpha",Y="asciinumeric",J="alphanumeric",Vt="domain",xe="emoji",Me="scheme",De="slashscheme",Ft="whitespace";function Ue(t,n){return t in n||(n[t]=[]),n[t]}function z(t,n,e){n[Qt]&&(n[Y]=!0,n[J]=!0),n[Jt]&&(n[Y]=!0,n[Yt]=!0),n[Y]&&(n[J]=!0),n[Yt]&&(n[J]=!0),n[J]&&(n[Vt]=!0),n[xe]&&(n[Vt]=!0);for(const i in n){const s=Ue(i,e);s.indexOf(t)<0&&s.push(t)}}function Be(t,n){const e={};for(const i in n)n[i].indexOf(t)>=0&&(e[i]=!0);return e}function y(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}y.groups={};y.prototype={accepts(){return!!this.t},go(t){const n=this,e=n.j[t];if(e)return e;for(let i=0;i<n.jr.length;i++){const s=n.jr[i][0],o=n.jr[i][1];if(o&&s.test(t))return o}return n.jd},has(t,n=!1){return n?t in this.j:!!this.go(t)},ta(t,n,e,i){for(let s=0;s<t.length;s++)this.tt(t[s],n,e,i)},tr(t,n,e,i){i=i||y.groups;let s;return n&&n.j?s=n:(s=new y(n),e&&i&&z(n,e,i)),this.jr.push([t,s]),s},ts(t,n,e,i){let s=this;const o=t.length;if(!o)return s;for(let r=0;r<o-1;r++)s=s.tt(t[r]);return s.tt(t[o-1],n,e,i)},tt(t,n,e,i){i=i||y.groups;const s=this;if(n&&n.j)return s.j[t]=n,n;const o=n;let r,l=s.go(t);if(l?(r=new y,Object.assign(r.j,l.j),r.jr.push.apply(r.jr,l.jr),r.jd=l.jd,r.t=l.t):r=new y,o){if(i)if(r.t&&typeof r.t=="string"){const u=Object.assign(Be(r.t,i),e);z(o,u,i)}else e&&z(o,e,i);r.t=o}return s.j[t]=r,r}};const f=(t,n,e,i,s)=>t.ta(n,e,i,s),x=(t,n,e,i,s)=>t.tr(n,e,i,s),me=(t,n,e,i,s)=>t.ts(n,e,i,s),a=(t,n,e,i,s)=>t.tt(n,e,i,s),j="WORD",Xt="UWORD",Te="ASCIINUMERICAL",Ce="ALPHANUMERICAL",nt="LOCALHOST",Zt="TLD",te="UTLD",ct="SCHEME",K="SLASH_SCHEME",ne="NUM",ee="WS",ie="NL",V="OPENBRACE",X="CLOSEBRACE",ut="OPENBRACKET",dt="CLOSEBRACKET",ht="OPENPAREN",ft="CLOSEPAREN",mt="OPENANGLEBRACKET",gt="CLOSEANGLEBRACKET",pt="FULLWIDTHLEFTPAREN",Et="FULLWIDTHRIGHTPAREN",kt="LEFTCORNERBRACKET",At="RIGHTCORNERBRACKET",Lt="LEFTWHITECORNERBRACKET",xt="RIGHTWHITECORNERBRACKET",Tt="FULLWIDTHLESSTHAN",Ct="FULLWIDTHGREATERTHAN",bt="AMPERSAND",Rt="APOSTROPHE",yt="ASTERISK",D="AT",Ot="BACKSLASH",St="BACKTICK",vt="CARET",U="COLON",se="COMMA",Nt="DOLLAR",v="DOT",It="EQUALS",oe="EXCLAMATION",S="HYPHEN",Z="PERCENT",Pt="PIPE",wt="PLUS",Ht="POUND",tt="QUERY",re="QUOTE",be="FULLWIDTHMIDDLEDOT",ae="SEMI",N="SLASH",et="TILDE",jt="UNDERSCORE",Re="EMOJI",Mt="SYM";var ye=Object.freeze({__proto__:null,ALPHANUMERICAL:Ce,AMPERSAND:bt,APOSTROPHE:Rt,ASCIINUMERICAL:Te,ASTERISK:yt,AT:D,BACKSLASH:Ot,BACKTICK:St,CARET:vt,CLOSEANGLEBRACKET:gt,CLOSEBRACE:X,CLOSEBRACKET:dt,CLOSEPAREN:ft,COLON:U,COMMA:se,DOLLAR:Nt,DOT:v,EMOJI:Re,EQUALS:It,EXCLAMATION:oe,FULLWIDTHGREATERTHAN:Ct,FULLWIDTHLEFTPAREN:pt,FULLWIDTHLESSTHAN:Tt,FULLWIDTHMIDDLEDOT:be,FULLWIDTHRIGHTPAREN:Et,HYPHEN:S,LEFTCORNERBRACKET:kt,LEFTWHITECORNERBRACKET:Lt,LOCALHOST:nt,NL:ie,NUM:ne,OPENANGLEBRACKET:mt,OPENBRACE:V,OPENBRACKET:ut,OPENPAREN:ht,PERCENT:Z,PIPE:Pt,PLUS:wt,POUND:Ht,QUERY:tt,QUOTE:re,RIGHTCORNERBRACKET:At,RIGHTWHITECORNERBRACKET:xt,SCHEME:ct,SEMI:ae,SLASH:N,SLASH_SCHEME:K,SYM:Mt,TILDE:et,TLD:Zt,UNDERSCORE:jt,UTLD:te,UWORD:Xt,WORD:j,WS:ee});const w=/[a-z]/,Q=new RegExp("\\p{L}","u"),Kt=new RegExp("\\p{Emoji}","u"),H=/\d/,_t=/\s/,ge="\r",$t=`
2
- `,ze="️",We="‍",Gt="";let rt=null,at=null;function Fe(t=[]){const n={};y.groups=n;const e=new y;rt==null&&(rt=pe(He)),at==null&&(at=pe(je)),a(e,"'",Rt),a(e,"{",V),a(e,"}",X),a(e,"[",ut),a(e,"]",dt),a(e,"(",ht),a(e,")",ft),a(e,"<",mt),a(e,">",gt),a(e,"(",pt),a(e,")",Et),a(e,"「",kt),a(e,"」",At),a(e,"『",Lt),a(e,"』",xt),a(e,"<",Tt),a(e,">",Ct),a(e,"&",bt),a(e,"*",yt),a(e,"@",D),a(e,"`",St),a(e,"^",vt),a(e,":",U),a(e,",",se),a(e,"$",Nt),a(e,".",v),a(e,"=",It),a(e,"!",oe),a(e,"-",S),a(e,"%",Z),a(e,"|",Pt),a(e,"+",wt),a(e,"#",Ht),a(e,"?",tt),a(e,'"',re),a(e,"/",N),a(e,";",ae),a(e,"~",et),a(e,"_",jt),a(e,"\\",Ot),a(e,"・",be);const i=x(e,H,ne,{[Qt]:!0});x(i,H,i);const s=x(i,w,Te,{[Y]:!0}),o=x(i,Q,Ce,{[J]:!0}),r=x(e,w,j,{[Jt]:!0});x(r,H,s),x(r,w,r),x(s,H,s),x(s,w,s);const l=x(e,Q,Xt,{[Yt]:!0});x(l,w),x(l,H,o),x(l,Q,l),x(o,H,o),x(o,w),x(o,Q,o);const u=a(e,$t,ie,{[Ft]:!0}),d=a(e,ge,ee,{[Ft]:!0}),c=x(e,_t,ee,{[Ft]:!0});a(e,Gt,c),a(d,$t,u),a(d,Gt,c),x(d,_t,c),a(c,ge),a(c,$t),x(c,_t,c),a(c,Gt,c);const h=x(e,Kt,Re,{[xe]:!0});a(h,"#"),x(h,Kt,h),a(h,ze,h);const g=a(h,We);a(g,"#"),x(g,Kt,h);const p=[[w,r],[H,s]],b=[[w,null],[Q,l],[H,o]];for(let E=0;E<rt.length;E++)M(e,rt[E],Zt,j,p);for(let E=0;E<at.length;E++)M(e,at[E],te,Xt,b);z(Zt,{tld:!0,ascii:!0},n),z(te,{utld:!0,alpha:!0},n),M(e,"file",ct,j,p),M(e,"mailto",ct,j,p),M(e,"http",K,j,p),M(e,"https",K,j,p),M(e,"ftp",K,j,p),M(e,"ftps",K,j,p),z(ct,{scheme:!0,ascii:!0},n),z(K,{slashscheme:!0,ascii:!0},n),t=t.sort((E,T)=>E[0]>T[0]?1:-1);for(let E=0;E<t.length;E++){const T=t[E][0],L=t[E][1]?{[Me]:!0}:{[De]:!0};T.indexOf("-")>=0?L[Vt]=!0:w.test(T)?H.test(T)?L[Y]=!0:L[Jt]=!0:L[Qt]=!0,me(e,T,T,L)}return me(e,"localhost",nt,{ascii:!0}),e.jd=new y(Mt),{start:e,tokens:Object.assign({groups:n},ye)}}function Oe(t,n){const e=Ke(n.replace(/[A-Z]/g,l=>l.toLowerCase())),i=e.length,s=[];let o=0,r=0;for(;r<i;){let l=t,u=null,d=0,c=null,h=-1,g=-1;for(;r<i&&(u=l.go(e[r]));)l=u,l.accepts()?(h=0,g=0,c=l):h>=0&&(h+=e[r].length,g++),d+=e[r].length,o+=e[r].length,r++;o-=h,r-=g,d-=h,s.push({t:c.t,v:n.slice(o-d,o),s:o-d,e:o})}return s}function Ke(t){const n=[],e=t.length;let i=0;for(;i<e;){let s=t.charCodeAt(i),o,r=s<55296||s>56319||i+1===e||(o=t.charCodeAt(i+1))<56320||o>57343?t[i]:t.slice(i,i+2);n.push(r),i+=r.length}return n}function M(t,n,e,i,s){let o;const r=n.length;for(let l=0;l<r-1;l++){const u=n[l];t.j[u]?o=t.j[u]:(o=new y(i),o.jr=s.slice(),t.j[u]=o),t=o}return o=new y(e),o.jr=s.slice(),t.j[n[r-1]]=o,o}function pe(t){const n=[],e=[];let i=0,s="0123456789";for(;i<t.length;){let o=0;for(;s.indexOf(t[i+o])>=0;)o++;if(o>0){n.push(e.join(""));for(let r=parseInt(t.substring(i,i+o),10);r>0;r--)e.pop();i+=o}else e.push(t[i]),i++}return n}const it={defaultProtocol:"http",events:null,format:Ee,formatHref:Ee,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function le(t,n=null){let e=Object.assign({},it);t&&(e=Object.assign(e,t instanceof le?t.o:t));const i=e.ignoreTags,s=[];for(let o=0;o<i.length;o++)s.push(i[o].toUpperCase());this.o=e,n&&(this.defaultRender=n),this.ignoreTags=s}le.prototype={o:it,ignoreTags:[],defaultRender(t){return t},check(t){return this.get("validate",t.toString(),t)},get(t,n,e){const i=n!=null;let s=this.o[t];return s&&(typeof s=="object"?(s=e.t in s?s[e.t]:it[t],typeof s=="function"&&i&&(s=s(n,e))):typeof s=="function"&&i&&(s=s(n,e.t,e)),s)},getObj(t,n,e){let i=this.o[t];return typeof i=="function"&&n!=null&&(i=i(n,e.t,e)),i},render(t){const n=t.render(this);return(this.get("render",null,t)||this.defaultRender)(n,t.t,t)}};function Ee(t){return t}function Se(t,n){this.t="token",this.v=t,this.tk=n}Se.prototype={isLink:!1,toString(){return this.v},toHref(t){return this.toString()},toFormattedString(t){const n=this.toString(),e=t.get("truncate",n,this),i=t.get("format",n,this);return e&&i.length>e?i.substring(0,e)+"…":i},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t=it.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const n=this,e=this.toHref(t.get("defaultProtocol")),i=t.get("formatHref",e,this),s=t.get("tagName",e,n),o=this.toFormattedString(t),r={},l=t.get("className",e,n),u=t.get("target",e,n),d=t.get("rel",e,n),c=t.getObj("attributes",e,n),h=t.getObj("events",e,n);return r.href=i,l&&(r.class=l),u&&(r.target=u),d&&(r.rel=d),c&&Object.assign(r,c),{tagName:s,attributes:r,content:o,eventListeners:h}}};function Dt(t,n){class e extends Se{constructor(s,o){super(s,o),this.t=t}}for(const i in n)e.prototype[i]=n[i];return e.t=t,e}const ke=Dt("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),Ae=Dt("text"),_e=Dt("nl"),lt=Dt("url",{isLink:!0,toHref(t=it.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==nt&&t[1].t===U}}),O=t=>new y(t);function $e({groups:t}){const n=t.domain.concat([bt,yt,D,Ot,St,vt,Nt,It,S,ne,Z,Pt,wt,Ht,N,Mt,et,jt]),e=[Rt,U,se,v,oe,Z,tt,re,ae,mt,gt,V,X,dt,ut,ht,ft,pt,Et,kt,At,Lt,xt,Tt,Ct],i=[bt,Rt,yt,Ot,St,vt,Nt,It,S,V,X,Z,Pt,wt,Ht,tt,N,Mt,et,jt],s=O(),o=a(s,et);f(o,i,o),f(o,t.domain,o);const r=O(),l=O(),u=O();f(s,t.domain,r),f(s,t.scheme,l),f(s,t.slashscheme,u),f(r,i,o),f(r,t.domain,r);const d=a(r,D);a(o,D,d),a(l,D,d),a(u,D,d);const c=a(o,v);f(c,i,o),f(c,t.domain,o);const h=O();f(d,t.domain,h),f(h,t.domain,h);const g=a(h,v);f(g,t.domain,h);const p=O(ke);f(g,t.tld,p),f(g,t.utld,p),a(d,nt,p);const b=a(h,S);a(b,S,b),f(b,t.domain,h),f(p,t.domain,h),a(p,v,g),a(p,S,b);const E=a(p,U);f(E,t.numeric,ke);const T=a(r,S),m=a(r,v);a(T,S,T),f(T,t.domain,r),f(m,i,o),f(m,t.domain,r);const L=O(lt);f(m,t.tld,L),f(m,t.utld,L),f(L,t.domain,r),f(L,i,o),a(L,v,m),a(L,S,T),a(L,D,d);const st=a(L,U),$=O(lt);f(st,t.numeric,$);const C=O(lt),P=O();f(C,n,C),f(C,e,P),f(P,n,C),f(P,e,P),a(L,N,C),a($,N,C);const G=a(l,U),Ie=a(u,U),Pe=a(Ie,N),Ut=a(Pe,N);f(l,t.domain,r),a(l,v,m),a(l,S,T),f(u,t.domain,r),a(u,v,m),a(u,S,T),f(G,t.domain,C),a(G,N,C),a(G,tt,C),f(Ut,t.domain,C),f(Ut,n,C),a(Ut,N,C);const he=[[V,X],[ut,dt],[ht,ft],[mt,gt],[pt,Et],[kt,At],[Lt,xt],[Tt,Ct]];for(let Bt=0;Bt<he.length;Bt++){const[fe,zt]=he[Bt],ot=a(C,fe);a(P,fe,ot),a(ot,zt,C);const W=O(lt);f(ot,n,W);const q=O();f(ot,e),f(W,n,W),f(W,e,q),f(q,n,W),f(q,e,q),a(W,zt,C),a(q,zt,C)}return a(s,nt,L),a(s,ie,_e),{start:s,tokens:ye}}function Ge(t,n,e){let i=e.length,s=0,o=[],r=[];for(;s<i;){let l=t,u=null,d=null,c=0,h=null,g=-1;for(;s<i&&!(u=l.go(e[s].t));)r.push(e[s++]);for(;s<i&&(d=u||l.go(e[s].t));)u=null,l=d,l.accepts()?(g=0,h=l):g>=0&&g++,s++,c++;if(g<0)s-=c,s<i&&(r.push(e[s]),s++);else{r.length>0&&(o.push(qt(Ae,n,r)),r=[]),s-=g,c-=g;const p=h.t,b=e.slice(s-c,s);o.push(qt(p,n,b))}}return r.length>0&&o.push(qt(Ae,n,r)),o}function qt(t,n,e){const i=e[0].s,s=e[e.length-1].e,o=n.slice(i,s);return new t(o,e)}const qe=typeof console<"u"&&console&&console.warn||(()=>{}),Qe="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",A={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function Je(){return y.groups={},A.scanner=null,A.parser=null,A.tokenQueue=[],A.pluginQueue=[],A.customSchemes=[],A.initialized=!1,A}function Le(t,n=!1){if(A.initialized&&qe(`linkifyjs: already initialized - will not register custom scheme "${t}" ${Qe}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
3
- 1. Must only contain digits, lowercase ASCII letters or "-"
4
- 2. Cannot start or end with "-"
5
- 3. "-" cannot repeat`);A.customSchemes.push([t,n])}function Ye(){A.scanner=Fe(A.customSchemes);for(let t=0;t<A.tokenQueue.length;t++)A.tokenQueue[t][1]({scanner:A.scanner});A.parser=$e(A.scanner.tokens);for(let t=0;t<A.pluginQueue.length;t++)A.pluginQueue[t][1]({scanner:A.scanner,parser:A.parser});return A.initialized=!0,A}function ce(t){return A.initialized||Ye(),Ge(A.parser.start,t,Oe(A.scanner.start,t))}ce.scan=Oe;function ve(t,n=null,e=null){if(n&&typeof n=="object"){if(e)throw Error(`linkifyjs: Invalid link type ${n}; must be a string`);e=n,n=null}const i=new le(e),s=ce(t),o=[];for(let r=0;r<s.length;r++){const l=s[r];l.isLink&&(!n||l.t===n)&&i.check(l)&&o.push(l.toFormattedObject(i))}return o}var ue="[\0-   ᠎ -\u2029  ]",Ve=new RegExp(ue),Xe=new RegExp(`${ue}$`),Ze=new RegExp(ue,"g");function tn(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function en(t){return new _.Plugin({key:new _.PluginKey("autolink"),appendTransaction:(n,e,i)=>{const s=n.some(d=>d.docChanged)&&!e.doc.eq(i.doc),o=n.some(d=>d.getMeta("preventAutolink"));if(!s||o)return;const{tr:r}=i,l=I.combineTransactionSteps(e.doc,[...n]);if(I.getChangedRanges(l).forEach(({newRange:d})=>{const c=I.findChildrenInRange(i.doc,d,p=>p.isTextblock);let h,g;if(c.length>1)h=c[0],g=i.doc.textBetween(h.pos,h.pos+h.node.nodeSize,void 0," ");else if(c.length){const p=i.doc.textBetween(d.from,d.to," "," ");if(!Xe.test(p))return;h=c[0],g=i.doc.textBetween(h.pos,d.to,void 0," ")}if(h&&g){const p=g.split(Ve).filter(Boolean);if(p.length<=0)return!1;const b=p[p.length-1],E=h.pos+g.lastIndexOf(b);if(!b)return!1;const T=ce(b).map(m=>m.toObject(t.defaultProtocol));if(!tn(T))return!1;T.filter(m=>m.isLink).map(m=>({...m,from:E+m.start+1,to:E+m.end+1})).filter(m=>i.schema.marks.code?!i.doc.rangeHasMark(m.from,m.to,i.schema.marks.code):!0).filter(m=>t.validate(m.value)).filter(m=>t.shouldAutoLink(m.value)).forEach(m=>{I.getMarksBetween(m.from,m.to,i.doc).some(L=>L.mark.type===t.type)||r.addMark(m.from,m.to,t.type.create({href:m.href}))})}}),!!r.steps.length)return r}})}function nn(t){return new _.Plugin({key:new _.PluginKey("handleClickLink"),props:{handleClick:(n,e,i)=>{var s,o;if(i.button!==0||!n.editable)return!1;let r=null;if(i.target instanceof HTMLAnchorElement)r=i.target;else{const u=i.target;if(!u)return!1;const d=t.editor.view.dom;r=u.closest("a"),r&&!d.contains(r)&&(r=null)}if(!r)return!1;let l=!1;if(t.enableClickSelection&&(l=t.editor.commands.extendMarkRange(t.type.name)),t.openOnClick){const u=I.getAttributes(n.state,t.type.name),d=(s=r.href)!=null?s:u.href,c=(o=r.target)!=null?o:u.target;d&&(window.open(d,c),l=!0)}return l}}})}function sn(t){return new _.Plugin({key:new _.PluginKey("handlePasteLink"),props:{handlePaste:(n,e,i)=>{const{shouldAutoLink:s}=t,{state:o}=n,{selection:r}=o,{empty:l}=r;if(l)return!1;let u="";i.content.forEach(c=>{u+=c.textContent});const d=ve(u,{defaultProtocol:t.defaultProtocol}).find(c=>c.isLink&&c.value===u);return!u||!d||s!==void 0&&!s(d.value)?!1:t.editor.commands.setMark(t.type,{href:d.href})}}})}function B(t,n){const e=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return n&&n.forEach(i=>{const s=typeof i=="string"?i:i.scheme;s&&e.push(s)}),!t||t.replace(Ze,"").match(new RegExp(`^(?:(?:${e.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var on=I.Mark.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(t=>{if(typeof t=="string"){Le(t);return}Le(t.scheme,t.optionalSlashes)})},onDestroy(){Je()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,n)=>!!B(t,n.protocols),validate:t=>!!t,shouldAutoLink:t=>{const n=/^[a-z][a-z0-9+.-]*:\/\//i.test(t),e=/^[a-z][a-z0-9+.-]*:/i.test(t);if(n||e&&!t.includes("@"))return!0;const s=(t.includes("@")?t.split("@").pop():t).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(s)||!/\./.test(s))}}},addAttributes(){return{href:{default:null,parseHTML(t){return t.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class},title:{default:null}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const n=t.getAttribute("href");return!n||!this.options.isAllowedUri(n,{defaultValidate:e=>!!B(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:n=>!!B(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",I.mergeAttributes(this.options.HTMLAttributes,t),0]:["a",I.mergeAttributes(this.options.HTMLAttributes,{...t,href:""}),0]},markdownTokenName:"link",parseMarkdown:(t,n)=>n.applyMark("link",n.parseInline(t.tokens||[]),{href:t.href,title:t.title||null}),renderMarkdown:(t,n)=>{var e,i,s,o;const r=(i=(e=t.attrs)==null?void 0:e.href)!=null?i:"",l=(o=(s=t.attrs)==null?void 0:s.title)!=null?o:"",u=n.renderChildren(t);return l?`[${u}](${r} "${l}")`:`[${u}](${r})`},addCommands(){return{setLink:t=>({chain:n})=>{const{href:e}=t;return this.options.isAllowedUri(e,{defaultValidate:i=>!!B(i,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?n().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:n})=>{const{href:e}=t||{};return e&&!this.options.isAllowedUri(e,{defaultValidate:i=>!!B(i,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:n().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[I.markPasteRule({find:t=>{const n=[];if(t){const{protocols:e,defaultProtocol:i}=this.options,s=ve(t).filter(o=>o.isLink&&this.options.isAllowedUri(o.value,{defaultValidate:r=>!!B(r,e),protocols:e,defaultProtocol:i}));s.length&&s.forEach(o=>{this.options.shouldAutoLink(o.value)&&n.push({text:o.value,data:{href:o.href},index:o.start})})}return n},type:this.type,getAttributes:t=>{var n;return{href:(n=t.data)==null?void 0:n.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:n,defaultProtocol:e}=this.options;return this.options.autolink&&t.push(en({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:i=>this.options.isAllowedUri(i,{defaultValidate:s=>!!B(s,n),protocols:n,defaultProtocol:e}),shouldAutoLink:this.options.shouldAutoLink})),t.push(nn({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(sn({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),t}});function rn(){const[t,n]=F.useState(!1),e=R.useEditorInstance(),i=R.useButtonProps(de.name),{isActive:s,icon:o,tooltip:r,target:l,action:u}=(i==null?void 0:i.componentProps)??{},{dataState:d,editorDisabled:c,update:h}=R.useToggleActive(s);function g(p,b,E){c||u&&(u({link:p,text:b,openInNewTab:E}),n(!1),h())}return i?k.jsxs(Wt.Popover,{modal:!0,onOpenChange:n,open:t,children:[k.jsx(Wt.PopoverTrigger,{asChild:!0,"data-state":d?"on":"off",disabled:c,children:k.jsx(R.ActionButton,{dataState:d,disabled:c,tooltip:r,children:k.jsx(R.IconComponent,{name:o})})}),k.jsx(Wt.PopoverContent,{align:"start",className:"richtext-w-full",hideWhenDetached:!0,side:"bottom",children:k.jsx(Ne,{editor:e,onSetLink:g,open:t,target:l})})]}):k.jsx(k.Fragment,{})}const de=on.extend({inclusive:!1,parseHTML(){return[{tag:'a[href]:not([data-type="button"]):not([href *= "javascript:" i])'}]},renderHTML({HTMLAttributes:t}){return["a",I.mergeAttributes(this.options.HTMLAttributes,t,{class:"link"}),0]},addOptions(){var e,i;const t=((e=this.parent)==null?void 0:e.call(this))||{},n=(i=t.HTMLAttributes)==null?void 0:i.target;return{...t,openOnClick:!1,button:({editor:s,t:o})=>({componentProps:{action:r=>{const{link:l,text:u,openInNewTab:d}=r;if(!l){s.chain().extendMarkRange("link").unsetLink().run();return}s.isActive("link")&&s.chain().extendMarkRange("link").run();const{from:c}=s.state.selection,h=u.length;s.chain().insertContent({type:"text",text:u,marks:[{type:"link",attrs:{href:/^https?:\/\//i.test(l)?l:`http://${l}`,target:n??(d?"_blank":"")}}]}).setLink({href:l}).setTextSelection({from:c,to:c+h}).focus().run()},isActive:()=>s.isActive("link"),disabled:!s.can().setLink({href:""}),icon:"Link",tooltip:o("editor.link.tooltip"),target:n}})}}});function Ne(t){const{t:n}=we.useLocale(),[e,i]=F.useState({text:"",link:""}),[s,o]=F.useState(!1),r=F.useRef(null),l=F.useRef(null),u=R.useExtension(de.name);F.useEffect(()=>{const c=()=>{var st,$,C;const{from:h,to:g,empty:p}=t.editor.state.selection,b=u==null?void 0:u.options;let E="",T="",m=(st=b==null?void 0:b.HTMLAttributes)==null?void 0:st.target;const L=t.editor.state.doc.nodeAt(h);if(L){const P=L.marks.find(G=>G.type.name==="link");P?(T=P.attrs.href||"",m=P.attrs.target,p?E=L.text||"":E=t.editor.state.doc.textBetween(h,g," ")):E=t.editor.state.doc.textBetween(h,g," ")}L||(E=t.editor.state.doc.textBetween(h,g," ")),i({link:T,text:E}),o(t.target?t.target==="_blank":m==="_blank"),t.open&&(E===""?($=r.current)==null||$.focus():(C=l.current)==null||C.focus())};return c(),t.editor.on("selectionUpdate",c),()=>{t.editor.off("selectionUpdate",c)}},[t.editor,u,t.open]);function d(c){c.preventDefault(),c.stopPropagation(),t==null||t.onSetLink(e.link,e.text,s),i({text:"",link:""})}return k.jsxs("div",{className:"richtext-flex richtext-flex-col richtext-gap-2",children:[k.jsx(R.Label,{className:"mb-[6px]",children:n("editor.link.dialog.text")}),k.jsx("div",{className:"richtext-mb-[10px] richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5",children:k.jsx("div",{className:"richtext-relative richtext-w-full richtext-max-w-sm richtext-items-center",children:k.jsx(R.Input,{className:"richtext-w-80",onChange:c=>i({...e,text:c.target.value}),placeholder:"Text",ref:r,required:!0,type:"text",value:e.text})})}),k.jsx(R.Label,{className:"mb-[6px]",children:n("editor.link.dialog.link")}),k.jsx("div",{className:"richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5",children:k.jsxs("div",{className:"richtext-relative richtext-w-full richtext-max-w-sm richtext-items-center",children:[k.jsx(R.Input,{className:"richtext-pl-10",onChange:c=>i({...e,link:c.target.value}),ref:l,required:!0,type:"url",value:e.link}),k.jsx("span",{className:"richtext-absolute richtext-inset-y-0 richtext-start-0 richtext-flex richtext-items-center richtext-justify-center richtext-px-2",children:k.jsx(R.IconComponent,{className:"richtext-size-5 richtext-text-muted-foreground",name:"Link"})})]})}),!t.target&&k.jsxs("div",{className:"richtext-flex richtext-items-center richtext-gap-1",children:[k.jsx(R.Checkbox,{checked:s,onCheckedChange:c=>{o(c)}}),k.jsx(R.Label,{children:n("editor.link.dialog.openInNewTab")})]}),k.jsxs("div",{className:"richtext-mt-2 richtext-flex richtext-items-center richtext-justify-end richtext-gap-2",children:[(t==null?void 0:t.onClose)&&k.jsx(R.Button,{onClick:t==null?void 0:t.onClose,type:"button",children:n("editor.link.dialog.button.cancel")}),k.jsx(R.Button,{onClick:d,type:"button",children:n("editor.link.dialog.button.apply")})]})]})}exports.Link=de;exports.LinkEditBlock=Ne;exports.RichTextLink=rn;
@@ -1,9 +0,0 @@
1
- "use strict";const g=require("./index-C4WLt4NA.cjs"),_e=require("@tiptap/pm/state"),D=require("./index-C3dgmjIF.cjs"),A=require("react/jsx-runtime"),W=require("./index-83hp1lZH.cjs"),F=require("react");require("./theme.cjs");const v=require("./index-C4aGVY2E.cjs"),Z=require("./popover-D7w_FVSV.cjs");let J,Y;if(typeof WeakMap<"u"){let t=new WeakMap;J=e=>t.get(e),Y=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;J=o=>{for(let l=0;l<t.length;l+=2)if(t[l]==o)return t[l+1]},Y=(o,l)=>(n==10&&(n=0),t[n++]=o,t[n++]=l)}var y=class{constructor(t,e,n,o){this.width=t,this.height=e,this.map=n,this.problems=o}findCell(t){for(let e=0;e<this.map.length;e++){const n=this.map[e];if(n!=t)continue;const o=e%this.width,l=e/this.width|0;let r=o+1,s=l+1;for(let i=1;r<this.width&&this.map[e+i]==n;i++)r++;for(let i=1;s<this.height&&this.map[e+this.width*i]==n;i++)s++;return{left:o,top:l,right:r,bottom:s}}throw new RangeError(`No cell with offset ${t} found`)}colCount(t){for(let e=0;e<this.map.length;e++)if(this.map[e]==t)return e%this.width;throw new RangeError(`No cell with offset ${t} found`)}nextCell(t,e,n){const{left:o,right:l,top:r,bottom:s}=this.findCell(t);return e=="horiz"?(n<0?o==0:l==this.width)?null:this.map[r*this.width+(n<0?o-1:l)]:(n<0?r==0:s==this.height)?null:this.map[o+this.width*(n<0?r-1:s)]}rectBetween(t,e){const{left:n,right:o,top:l,bottom:r}=this.findCell(t),{left:s,right:i,top:c,bottom:a}=this.findCell(e);return{left:Math.min(n,s),top:Math.min(l,c),right:Math.max(o,i),bottom:Math.max(r,a)}}cellsInRect(t){const e=[],n={};for(let o=t.top;o<t.bottom;o++)for(let l=t.left;l<t.right;l++){const r=o*this.width+l,s=this.map[r];n[s]||(n[s]=!0,!(l==t.left&&l&&this.map[r-1]==s||o==t.top&&o&&this.map[r-this.width]==s)&&e.push(s))}return e}positionAt(t,e,n){for(let o=0,l=0;;o++){const r=l+n.child(o).nodeSize;if(o==t){let s=e+t*this.width;const i=(t+1)*this.width;for(;s<i&&this.map[s]<l;)s++;return s==i?r-1:this.map[s]}l=r}}static get(t){return J(t)||Y(t,Ie(t))}};function Ie(t){if(t.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+t.type.name);const e=Be(t),n=t.childCount,o=[];let l=0,r=null;const s=[];for(let a=0,d=e*n;a<d;a++)o[a]=0;for(let a=0,d=0;a<n;a++){const u=t.child(a);d++;for(let p=0;;p++){for(;l<o.length&&o[l]!=0;)l++;if(p==u.childCount)break;const m=u.child(p),{colspan:b,rowspan:w,colwidth:x}=m.attrs;for(let R=0;R<w;R++){if(R+a>=n){(r||(r=[])).push({type:"overlong_rowspan",pos:d,n:w-R});break}const L=l+R*e;for(let M=0;M<b;M++){o[L+M]==0?o[L+M]=d:(r||(r=[])).push({type:"collision",row:a,pos:d,n:b-M});const $=x&&x[M];if($){const I=(L+M)%e*2,X=s[I];X==null||X!=$&&s[I+1]==1?(s[I]=$,s[I+1]=1):X==$&&s[I+1]++}}}l+=b,d+=m.nodeSize}const f=(a+1)*e;let h=0;for(;l<f;)o[l++]==0&&h++;h&&(r||(r=[])).push({type:"missing",row:a,n:h}),d++}(e===0||n===0)&&(r||(r=[])).push({type:"zero_sized"});const i=new y(e,n,o,r);let c=!1;for(let a=0;!c&&a<s.length;a+=2)s[a]!=null&&s[a+1]<n&&(c=!0);return c&&$e(i,s,t),i}function Be(t){let e=-1,n=!1;for(let o=0;o<t.childCount;o++){const l=t.child(o);let r=0;if(n)for(let s=0;s<o;s++){const i=t.child(s);for(let c=0;c<i.childCount;c++){const a=i.child(c);s+a.attrs.rowspan>o&&(r+=a.attrs.colspan)}}for(let s=0;s<l.childCount;s++){const i=l.child(s);r+=i.attrs.colspan,i.attrs.rowspan>1&&(n=!0)}e==-1?e=r:e!=r&&(e=Math.max(e,r))}return e}function $e(t,e,n){t.problems||(t.problems=[]);const o={};for(let l=0;l<t.map.length;l++){const r=t.map[l];if(o[r])continue;o[r]=!0;const s=n.nodeAt(r);if(!s)throw new RangeError(`No cell with offset ${r} found`);let i=null;const c=s.attrs;for(let a=0;a<c.colspan;a++){const d=e[(l+a)%t.width*2];d!=null&&(!c.colwidth||c.colwidth[a]!=d)&&((i||(i=We(c)))[a]=d)}i&&t.problems.unshift({type:"colwidth mismatch",pos:r,colwidth:i})}}function We(t){if(t.colwidth)return t.colwidth.slice();const e=[];for(let n=0;n<t.colspan;n++)e.push(0);return e}function S(t){let e=t.cached.tableNodeTypes;if(!e){e=t.cached.tableNodeTypes={};for(const n in t.nodes){const o=t.nodes[n],l=o.spec.tableRole;l&&(e[l]=o)}}return e}const z=new g.PluginKey("selectingCells");function H(t){for(let e=t.depth-1;e>0;e--)if(t.node(e).type.spec.tableRole=="row")return t.node(0).resolve(t.before(e+1));return null}function Fe(t){for(let e=t.depth;e>0;e--){const n=t.node(e).type.spec.tableRole;if(n==="cell"||n==="header_cell")return t.node(e)}return null}function E(t){const e=t.selection.$head;for(let n=e.depth;n>0;n--)if(e.node(n).type.spec.tableRole=="row")return!0;return!1}function q(t){const e=t.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const n=H(e.$head)||Pe(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function Pe(t){for(let e=t.nodeAfter,n=t.pos;e;e=e.firstChild,n++){const o=e.type.spec.tableRole;if(o=="cell"||o=="header_cell")return t.doc.resolve(n)}for(let e=t.nodeBefore,n=t.pos;e;e=e.lastChild,n--){const o=e.type.spec.tableRole;if(o=="cell"||o=="header_cell")return t.doc.resolve(n-e.nodeSize)}}function Q(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function je(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function oe(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function Se(t,e,n){const o=t.node(-1),l=y.get(o),r=t.start(-1),s=l.nextCell(t.pos-r,e,n);return s==null?null:t.node(0).resolve(r+s)}function _(t,e,n=1){const o={...t,colspan:t.colspan-n};return o.colwidth&&(o.colwidth=o.colwidth.slice(),o.colwidth.splice(e,n),o.colwidth.some(l=>l>0)||(o.colwidth=null)),o}function xe(t,e,n=1){const o={...t,colspan:t.colspan+n};if(o.colwidth){o.colwidth=o.colwidth.slice();for(let l=0;l<n;l++)o.colwidth.splice(e,0,0)}return o}function Oe(t,e,n){const o=S(e.type.schema).header_cell;for(let l=0;l<t.height;l++)if(e.nodeAt(t.map[n+l*t.width]).type!=o)return!1;return!0}var C=class k extends g.Selection{constructor(e,n=e){const o=e.node(-1),l=y.get(o),r=e.start(-1),s=l.rectBetween(e.pos-r,n.pos-r),i=e.node(0),c=l.cellsInRect(s).filter(d=>d!=n.pos-r);c.unshift(n.pos-r);const a=c.map(d=>{const u=o.nodeAt(d);if(!u)throw new RangeError(`No cell with offset ${d} found`);const f=r+d+1;return new g.SelectionRange(i.resolve(f),i.resolve(f+u.content.size))});super(a[0].$from,a[0].$to,a),this.$anchorCell=e,this.$headCell=n}map(e,n){const o=e.resolve(n.map(this.$anchorCell.pos)),l=e.resolve(n.map(this.$headCell.pos));if(Q(o)&&Q(l)&&oe(o,l)){const r=this.$anchorCell.node(-1)!=o.node(-1);return r&&this.isRowSelection()?k.rowSelection(o,l):r&&this.isColSelection()?k.colSelection(o,l):new k(o,l)}return g.TextSelection.between(o,l)}content(){const e=this.$anchorCell.node(-1),n=y.get(e),o=this.$anchorCell.start(-1),l=n.rectBetween(this.$anchorCell.pos-o,this.$headCell.pos-o),r={},s=[];for(let c=l.top;c<l.bottom;c++){const a=[];for(let d=c*n.width+l.left,u=l.left;u<l.right;u++,d++){const f=n.map[d];if(r[f])continue;r[f]=!0;const h=n.findCell(f);let p=e.nodeAt(f);if(!p)throw new RangeError(`No cell with offset ${f} found`);const m=l.left-h.left,b=h.right-l.right;if(m>0||b>0){let w=p.attrs;if(m>0&&(w=_(w,0,m)),b>0&&(w=_(w,w.colspan-b,b)),h.left<l.left){if(p=p.type.createAndFill(w),!p)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(w)}`)}else p=p.type.create(w,p.content)}if(h.top<l.top||h.bottom>l.bottom){const w={...p.attrs,rowspan:Math.min(h.bottom,l.bottom)-Math.max(h.top,l.top)};h.top<l.top?p=p.type.createAndFill(w):p=p.type.create(w,p.content)}a.push(p)}s.push(e.child(c).copy(g.Fragment.from(a)))}const i=this.isColSelection()&&this.isRowSelection()?e:s;return new g.Slice(g.Fragment.from(i),1,1)}replace(e,n=g.Slice.empty){const o=e.steps.length,l=this.ranges;for(let s=0;s<l.length;s++){const{$from:i,$to:c}=l[s],a=e.mapping.slice(o);e.replace(a.map(i.pos),a.map(c.pos),s?g.Slice.empty:n)}const r=g.Selection.findFrom(e.doc.resolve(e.mapping.slice(o).map(this.to)),-1);r&&e.setSelection(r)}replaceWith(e,n){this.replace(e,new g.Slice(g.Fragment.from(n),0,0))}forEachCell(e){const n=this.$anchorCell.node(-1),o=y.get(n),l=this.$anchorCell.start(-1),r=o.cellsInRect(o.rectBetween(this.$anchorCell.pos-l,this.$headCell.pos-l));for(let s=0;s<r.length;s++)e(n.nodeAt(r[s]),l+r[s])}isColSelection(){const e=this.$anchorCell.index(-1),n=this.$headCell.index(-1);if(Math.min(e,n)>0)return!1;const o=e+this.$anchorCell.nodeAfter.attrs.rowspan,l=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(o,l)==this.$headCell.node(-1).childCount}static colSelection(e,n=e){const o=e.node(-1),l=y.get(o),r=e.start(-1),s=l.findCell(e.pos-r),i=l.findCell(n.pos-r),c=e.node(0);return s.top<=i.top?(s.top>0&&(e=c.resolve(r+l.map[s.left])),i.bottom<l.height&&(n=c.resolve(r+l.map[l.width*(l.height-1)+i.right-1]))):(i.top>0&&(n=c.resolve(r+l.map[i.left])),s.bottom<l.height&&(e=c.resolve(r+l.map[l.width*(l.height-1)+s.right-1]))),new k(e,n)}isRowSelection(){const e=this.$anchorCell.node(-1),n=y.get(e),o=this.$anchorCell.start(-1),l=n.colCount(this.$anchorCell.pos-o),r=n.colCount(this.$headCell.pos-o);if(Math.min(l,r)>0)return!1;const s=l+this.$anchorCell.nodeAfter.attrs.colspan,i=r+this.$headCell.nodeAfter.attrs.colspan;return Math.max(s,i)==n.width}eq(e){return e instanceof k&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const o=e.node(-1),l=y.get(o),r=e.start(-1),s=l.findCell(e.pos-r),i=l.findCell(n.pos-r),c=e.node(0);return s.left<=i.left?(s.left>0&&(e=c.resolve(r+l.map[s.top*l.width])),i.right<l.width&&(n=c.resolve(r+l.map[l.width*(i.top+1)-1]))):(i.left>0&&(n=c.resolve(r+l.map[i.top*l.width])),s.right<l.width&&(e=c.resolve(r+l.map[l.width*(s.top+1)-1]))),new k(e,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,n){return new k(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,o=n){return new k(e.resolve(n),e.resolve(o))}getBookmark(){return new Ge(this.$anchorCell.pos,this.$headCell.pos)}};C.prototype.visible=!1;g.Selection.jsonID("cell",C);var Ge=class Ae{constructor(e,n){this.anchor=e,this.head=n}map(e){return new Ae(e.map(this.anchor),e.map(this.head))}resolve(e){const n=e.resolve(this.anchor),o=e.resolve(this.head);return n.parent.type.spec.tableRole=="row"&&o.parent.type.spec.tableRole=="row"&&n.index()<n.parent.childCount&&o.index()<o.parent.childCount&&oe(n,o)?new C(n,o):g.Selection.near(o,1)}};function Ve(t){if(!(t.selection instanceof C))return null;const e=[];return t.selection.forEachCell((n,o)=>{e.push(D.Decoration.node(o,o+n.nodeSize,{class:"selectedCell"}))}),D.DecorationSet.create(t.doc,e)}function Ke({$from:t,$to:e}){if(t.pos==e.pos||t.pos<e.pos-6)return!1;let n=t.pos,o=e.pos,l=t.depth;for(;l>=0&&!(t.after(l+1)<t.end(l));l--,n++);for(let r=e.depth;r>=0&&!(e.before(r+1)>e.start(r));r--,o--);return n==o&&/row|table/.test(t.node(l).type.spec.tableRole)}function qe({$from:t,$to:e}){let n,o;for(let l=t.depth;l>0;l--){const r=t.node(l);if(r.type.spec.tableRole==="cell"||r.type.spec.tableRole==="header_cell"){n=r;break}}for(let l=e.depth;l>0;l--){const r=e.node(l);if(r.type.spec.tableRole==="cell"||r.type.spec.tableRole==="header_cell"){o=r;break}}return n!==o&&e.parentOffset===0}function Xe(t,e,n){const o=(e||t).selection,l=(e||t).doc;let r,s;if(o instanceof g.NodeSelection&&(s=o.node.type.spec.tableRole)){if(s=="cell"||s=="header_cell")r=C.create(l,o.from);else if(s=="row"){const i=l.resolve(o.from+1);r=C.rowSelection(i,i)}else if(!n){const i=y.get(o.node),c=o.from+1,a=c+i.map[i.width*i.height-1];r=C.create(l,c+1,a)}}else o instanceof g.TextSelection&&Ke(o)?r=g.TextSelection.create(l,o.from):o instanceof g.TextSelection&&qe(o)&&(r=g.TextSelection.create(l,o.$from.start(),o.$from.end()));return r&&(e||(e=t.tr)).setSelection(r),e}const Ze=new g.PluginKey("fix-tables");function Te(t,e,n,o){const l=t.childCount,r=e.childCount;e:for(let s=0,i=0;s<r;s++){const c=e.child(s);for(let a=i,d=Math.min(l,s+3);a<d;a++)if(t.child(a)==c){i=a+1,n+=c.nodeSize;continue e}o(c,n),i<l&&t.child(i).sameMarkup(c)?Te(t.child(i),c,n+1,o):c.nodesBetween(0,c.content.size,o,n+1),n+=c.nodeSize}}function Re(t,e){let n;const o=(l,r)=>{l.type.spec.tableRole=="table"&&(n=Ue(t,l,r,n))};return e?e.doc!=t.doc&&Te(e.doc,t.doc,0,o):t.doc.descendants(o),n}function Ue(t,e,n,o){const l=y.get(e);if(!l.problems)return o;o||(o=t.tr);const r=[];for(let c=0;c<l.height;c++)r.push(0);for(let c=0;c<l.problems.length;c++){const a=l.problems[c];if(a.type=="collision"){const d=e.nodeAt(a.pos);if(!d)continue;const u=d.attrs;for(let f=0;f<u.rowspan;f++)r[a.row+f]+=a.n;o.setNodeMarkup(o.mapping.map(n+1+a.pos),null,_(u,u.colspan-a.n,a.n))}else if(a.type=="missing")r[a.row]+=a.n;else if(a.type=="overlong_rowspan"){const d=e.nodeAt(a.pos);if(!d)continue;o.setNodeMarkup(o.mapping.map(n+1+a.pos),null,{...d.attrs,rowspan:d.attrs.rowspan-a.n})}else if(a.type=="colwidth mismatch"){const d=e.nodeAt(a.pos);if(!d)continue;o.setNodeMarkup(o.mapping.map(n+1+a.pos),null,{...d.attrs,colwidth:a.colwidth})}else if(a.type=="zero_sized"){const d=o.mapping.map(n);o.delete(d,d+e.nodeSize)}}let s,i;for(let c=0;c<r.length;c++)r[c]&&(s==null&&(s=c),i=c);for(let c=0,a=n+1;c<l.height;c++){const d=e.child(c),u=a+d.nodeSize,f=r[c];if(f>0){let h="cell";d.firstChild&&(h=d.firstChild.type.spec.tableRole);const p=[];for(let b=0;b<f;b++){const w=S(t.schema)[h].createAndFill();w&&p.push(w)}const m=(c==0||s==c-1)&&i==c?a+1:u-1;o.insert(o.mapping.map(m),p)}a=u}return o.setMeta(Ze,{fixTables:!0})}function N(t){const e=t.selection,n=q(t),o=n.node(-1),l=n.start(-1),r=y.get(o);return{...e instanceof C?r.rectBetween(e.$anchorCell.pos-l,e.$headCell.pos-l):r.findCell(n.pos-l),tableStart:l,map:r,table:o}}function ve(t,{map:e,tableStart:n,table:o},l){let r=l>0?-1:0;Oe(e,o,l+r)&&(r=l==0||l==e.width?null:0);for(let s=0;s<e.height;s++){const i=s*e.width+l;if(l>0&&l<e.width&&e.map[i-1]==e.map[i]){const c=e.map[i],a=o.nodeAt(c);t.setNodeMarkup(t.mapping.map(n+c),null,xe(a.attrs,l-e.colCount(c))),s+=a.attrs.rowspan-1}else{const c=r==null?S(o.type.schema).cell:o.nodeAt(e.map[i+r]).type,a=e.positionAt(s,l,o);t.insert(t.mapping.map(n+a),c.createAndFill())}}return t}function Je(t,e){if(!E(t))return!1;if(e){const n=N(t);e(ve(t.tr,n,n.left))}return!0}function Ye(t,e){if(!E(t))return!1;if(e){const n=N(t);e(ve(t.tr,n,n.right))}return!0}function Qe(t,{map:e,table:n,tableStart:o},l){const r=t.mapping.maps.length;for(let s=0;s<e.height;){const i=s*e.width+l,c=e.map[i],a=n.nodeAt(c),d=a.attrs;if(l>0&&e.map[i-1]==c||l<e.width-1&&e.map[i+1]==c)t.setNodeMarkup(t.mapping.slice(r).map(o+c),null,_(d,l-e.colCount(c)));else{const u=t.mapping.slice(r).map(o+c);t.delete(u,u+a.nodeSize)}s+=d.rowspan}}function et(t,e){if(!E(t))return!1;if(e){const n=N(t),o=t.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let l=n.right-1;Qe(o,n,l),l!=n.left;l--){const r=n.tableStart?o.doc.nodeAt(n.tableStart-1):o.doc;if(!r)throw new RangeError("No table found");n.table=r,n.map=y.get(r)}e(o)}return!0}function tt(t,e,n){var o;const l=S(e.type.schema).header_cell;for(let r=0;r<t.width;r++)if(((o=e.nodeAt(t.map[r+n*t.width]))===null||o===void 0?void 0:o.type)!=l)return!1;return!0}function Me(t,{map:e,tableStart:n,table:o},l){let r=n;for(let a=0;a<l;a++)r+=o.child(a).nodeSize;const s=[];let i=l>0?-1:0;tt(e,o,l+i)&&(i=l==0||l==e.height?null:0);for(let a=0,d=e.width*l;a<e.width;a++,d++)if(l>0&&l<e.height&&e.map[d]==e.map[d-e.width]){const u=e.map[d],f=o.nodeAt(u).attrs;t.setNodeMarkup(n+u,null,{...f,rowspan:f.rowspan+1}),a+=f.colspan-1}else{var c;const u=i==null?S(o.type.schema).cell:(c=o.nodeAt(e.map[d+i*e.width]))===null||c===void 0?void 0:c.type,f=u==null?void 0:u.createAndFill();f&&s.push(f)}return t.insert(r,S(o.type.schema).row.create(null,s)),t}function nt(t,e){if(!E(t))return!1;if(e){const n=N(t);e(Me(t.tr,n,n.top))}return!0}function ot(t,e){if(!E(t))return!1;if(e){const n=N(t);e(Me(t.tr,n,n.bottom))}return!0}function lt(t,{map:e,table:n,tableStart:o},l){let r=0;for(let a=0;a<l;a++)r+=n.child(a).nodeSize;const s=r+n.child(l).nodeSize,i=t.mapping.maps.length;t.delete(r+o,s+o);const c=new Set;for(let a=0,d=l*e.width;a<e.width;a++,d++){const u=e.map[d];if(!c.has(u)){if(c.add(u),l>0&&u==e.map[d-e.width]){const f=n.nodeAt(u).attrs;t.setNodeMarkup(t.mapping.slice(i).map(u+o),null,{...f,rowspan:f.rowspan-1}),a+=f.colspan-1}else if(l<e.height&&u==e.map[d+e.width]){const f=n.nodeAt(u),h=f.attrs,p=f.type.create({...h,rowspan:f.attrs.rowspan-1},f.content),m=e.positionAt(l+1,a,n);t.insert(t.mapping.slice(i).map(o+m),p),a+=h.colspan-1}}}}function rt(t,e){if(!E(t))return!1;if(e){const n=N(t),o=t.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let l=n.bottom-1;lt(o,n,l),l!=n.top;l--){const r=n.tableStart?o.doc.nodeAt(n.tableStart-1):o.doc;if(!r)throw new RangeError("No table found");n.table=r,n.map=y.get(n.table)}e(o)}return!0}function le(t){const e=t.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function st({width:t,height:e,map:n},o){let l=o.top*t+o.left,r=l,s=(o.bottom-1)*t+o.left,i=l+(o.right-o.left-1);for(let c=o.top;c<o.bottom;c++){if(o.left>0&&n[r]==n[r-1]||o.right<t&&n[i]==n[i+1])return!0;r+=t,i+=t}for(let c=o.left;c<o.right;c++){if(o.top>0&&n[l]==n[l-t]||o.bottom<e&&n[s]==n[s+t])return!0;l++,s++}return!1}function re(t,e){const n=t.selection;if(!(n instanceof C)||n.$anchorCell.pos==n.$headCell.pos)return!1;const o=N(t),{map:l}=o;if(st(l,o))return!1;if(e){const r=t.tr,s={};let i=g.Fragment.empty,c,a;for(let d=o.top;d<o.bottom;d++)for(let u=o.left;u<o.right;u++){const f=l.map[d*l.width+u],h=o.table.nodeAt(f);if(!(s[f]||!h))if(s[f]=!0,c==null)c=f,a=h;else{le(h)||(i=i.append(h.content));const p=r.mapping.map(f+o.tableStart);r.delete(p,p+h.nodeSize)}}if(c==null||a==null)return!0;if(r.setNodeMarkup(c+o.tableStart,null,{...xe(a.attrs,a.attrs.colspan,o.right-o.left-a.attrs.colspan),rowspan:o.bottom-o.top}),i.size>0){const d=c+1+a.content.size,u=le(a)?c+1:d;r.replaceWith(u+o.tableStart,d+o.tableStart,i)}r.setSelection(new C(r.doc.resolve(c+o.tableStart))),e(r)}return!0}function se(t,e){const n=S(t.schema);return it(({node:o})=>n[o.type.spec.tableRole])(t,e)}function it(t){return(e,n)=>{const o=e.selection;let l,r;if(o instanceof C){if(o.$anchorCell.pos!=o.$headCell.pos)return!1;l=o.$anchorCell.nodeAfter,r=o.$anchorCell.pos}else{var s;if(l=Fe(o.$from),!l)return!1;r=(s=H(o.$from))===null||s===void 0?void 0:s.pos}if(l==null||r==null||l.attrs.colspan==1&&l.attrs.rowspan==1)return!1;if(n){let i=l.attrs;const c=[],a=i.colwidth;i.rowspan>1&&(i={...i,rowspan:1}),i.colspan>1&&(i={...i,colspan:1});const d=N(e),u=e.tr;for(let h=0;h<d.right-d.left;h++)c.push(a?{...i,colwidth:a&&a[h]?[a[h]]:null}:i);let f;for(let h=d.top;h<d.bottom;h++){let p=d.map.positionAt(h,d.left,d.table);h==d.top&&(p+=l.nodeSize);for(let m=d.left,b=0;m<d.right;m++,b++)m==d.left&&h==d.top||u.insert(f=u.mapping.map(p+d.tableStart,1),t({node:l,row:h,col:m}).createAndFill(c[b]))}u.setNodeMarkup(r,t({node:l,row:d.top,col:d.left}),c[0]),o instanceof C&&u.setSelection(new C(u.doc.resolve(o.$anchorCell.pos),f?u.doc.resolve(f):void 0)),n(u)}return!0}}function ct(t,e){return function(n,o){if(!E(n))return!1;const l=q(n);if(l.nodeAfter.attrs[t]===e)return!1;if(o){const r=n.tr;n.selection instanceof C?n.selection.forEachCell((s,i)=>{s.attrs[t]!==e&&r.setNodeMarkup(i,null,{...s.attrs,[t]:e})}):r.setNodeMarkup(l.pos,null,{...l.nodeAfter.attrs,[t]:e}),o(r)}return!0}}function at(t){return function(e,n){if(!E(e))return!1;if(n){const o=S(e.schema),l=N(e),r=e.tr,s=l.map.cellsInRect(t=="column"?{left:l.left,top:0,right:l.right,bottom:l.map.height}:t=="row"?{left:0,top:l.top,right:l.map.width,bottom:l.bottom}:l),i=s.map(c=>l.table.nodeAt(c));for(let c=0;c<s.length;c++)i[c].type==o.header_cell&&r.setNodeMarkup(l.tableStart+s[c],o.cell,i[c].attrs);if(r.steps.length===0)for(let c=0;c<s.length;c++)r.setNodeMarkup(l.tableStart+s[c],o.header_cell,i[c].attrs);n(r)}return!0}}function ie(t,e,n){const o=e.map.cellsInRect({left:0,top:0,right:t=="row"?e.map.width:1,bottom:t=="column"?e.map.height:1});for(let l=0;l<o.length;l++){const r=e.table.nodeAt(o[l]);if(r&&r.type!==n.header_cell)return!1}return!0}function B(t,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?at(t):function(n,o){if(!E(n))return!1;if(o){const l=S(n.schema),r=N(n),s=n.tr,i=ie("row",r,l),c=ie("column",r,l),a=(t==="column"?i:t==="row"&&c)?1:0,d=t=="column"?{left:0,top:a,right:1,bottom:r.map.height}:t=="row"?{left:a,top:0,right:r.map.width,bottom:1}:r,u=t=="column"?c?l.cell:l.header_cell:t=="row"?i?l.cell:l.header_cell:l.cell;r.map.cellsInRect(d).forEach(f=>{const h=f+r.tableStart,p=s.doc.nodeAt(h);p&&s.setNodeMarkup(h,u,p.attrs)}),o(s)}return!0}}B("row",{useDeprecatedLogic:!0});B("column",{useDeprecatedLogic:!0});const dt=B("cell",{useDeprecatedLogic:!0});function ut(t,e){if(e<0){const n=t.nodeBefore;if(n)return t.pos-n.nodeSize;for(let o=t.index(-1)-1,l=t.before();o>=0;o--){const r=t.node(-1).child(o),s=r.lastChild;if(s)return l-1-s.nodeSize;l-=r.nodeSize}}else{if(t.index()<t.parent.childCount-1)return t.pos+t.nodeAfter.nodeSize;const n=t.node(-1);for(let o=t.indexAfter(-1),l=t.after();o<n.childCount;o++){const r=n.child(o);if(r.childCount)return l+1;l+=r.nodeSize}}return null}function ce(t){return function(e,n){if(!E(e))return!1;const o=ut(q(e),t);if(o==null)return!1;if(n){const l=e.doc.resolve(o);n(e.tr.setSelection(g.TextSelection.between(l,je(l))).scrollIntoView())}return!0}}function ft(t,e){const n=t.selection.$anchor;for(let o=n.depth;o>0;o--)if(n.node(o).type.spec.tableRole=="table")return e&&e(t.tr.delete(n.before(o),n.after(o)).scrollIntoView()),!0;return!1}function P(t,e){const n=t.selection;if(!(n instanceof C))return!1;if(e){const o=t.tr,l=S(t.schema).cell.createAndFill().content;n.forEachCell((r,s)=>{r.content.eq(l)||o.replace(o.mapping.map(s+1),o.mapping.map(s+r.nodeSize-1),new g.Slice(l,0,0))}),o.docChanged&&e(o)}return!0}function ht(t){if(t.size===0)return null;let{content:e,openStart:n,openEnd:o}=t;for(;e.childCount==1&&(n>0&&o>0||e.child(0).type.spec.tableRole=="table");)n--,o--,e=e.child(0).content;const l=e.child(0),r=l.type.spec.tableRole,s=l.type.schema,i=[];if(r=="row")for(let c=0;c<e.childCount;c++){let a=e.child(c).content;const d=c?0:Math.max(0,n-1),u=c<e.childCount-1?0:Math.max(0,o-1);(d||u)&&(a=ee(S(s).row,new g.Slice(a,d,u)).content),i.push(a)}else if(r=="cell"||r=="header_cell")i.push(n||o?ee(S(s).row,new g.Slice(e,n,o)).content:e);else return null;return pt(s,i)}function pt(t,e){const n=[];for(let l=0;l<e.length;l++){const r=e[l];for(let s=r.childCount-1;s>=0;s--){const{rowspan:i,colspan:c}=r.child(s).attrs;for(let a=l;a<l+i;a++)n[a]=(n[a]||0)+c}}let o=0;for(let l=0;l<n.length;l++)o=Math.max(o,n[l]);for(let l=0;l<n.length;l++)if(l>=e.length&&e.push(g.Fragment.empty),n[l]<o){const r=S(t).cell.createAndFill(),s=[];for(let i=n[l];i<o;i++)s.push(r);e[l]=e[l].append(g.Fragment.from(s))}return{height:e.length,width:o,rows:e}}function ee(t,e){const n=t.createAndFill();return new g.Transform(n).replace(0,n.content.size,e).doc}function mt({width:t,height:e,rows:n},o,l){if(t!=o){const r=[],s=[];for(let i=0;i<n.length;i++){const c=n[i],a=[];for(let d=r[i]||0,u=0;d<o;u++){let f=c.child(u%c.childCount);d+f.attrs.colspan>o&&(f=f.type.createChecked(_(f.attrs,f.attrs.colspan,d+f.attrs.colspan-o),f.content)),a.push(f),d+=f.attrs.colspan;for(let h=1;h<f.attrs.rowspan;h++)r[i+h]=(r[i+h]||0)+f.attrs.colspan}s.push(g.Fragment.from(a))}n=s,t=o}if(e!=l){const r=[];for(let s=0,i=0;s<l;s++,i++){const c=[],a=n[i%e];for(let d=0;d<a.childCount;d++){let u=a.child(d);s+u.attrs.rowspan>l&&(u=u.type.create({...u.attrs,rowspan:Math.max(1,l-u.attrs.rowspan)},u.content)),c.push(u)}r.push(g.Fragment.from(c))}n=r,e=l}return{width:t,height:e,rows:n}}function gt(t,e,n,o,l,r,s){const i=t.doc.type.schema,c=S(i);let a,d;if(l>e.width)for(let u=0,f=0;u<e.height;u++){const h=n.child(u);f+=h.nodeSize;const p=[];let m;h.lastChild==null||h.lastChild.type==c.cell?m=a||(a=c.cell.createAndFill()):m=d||(d=c.header_cell.createAndFill());for(let b=e.width;b<l;b++)p.push(m);t.insert(t.mapping.slice(s).map(f-1+o),p)}if(r>e.height){const u=[];for(let p=0,m=(e.height-1)*e.width;p<Math.max(e.width,l);p++){const b=p>=e.width?!1:n.nodeAt(e.map[m+p]).type==c.header_cell;u.push(b?d||(d=c.header_cell.createAndFill()):a||(a=c.cell.createAndFill()))}const f=c.row.create(null,g.Fragment.from(u)),h=[];for(let p=e.height;p<r;p++)h.push(f);t.insert(t.mapping.slice(s).map(o+n.nodeSize-2),h)}return!!(a||d)}function ae(t,e,n,o,l,r,s,i){if(s==0||s==e.height)return!1;let c=!1;for(let a=l;a<r;a++){const d=s*e.width+a,u=e.map[d];if(e.map[d-e.width]==u){c=!0;const f=n.nodeAt(u),{top:h,left:p}=e.findCell(u);t.setNodeMarkup(t.mapping.slice(i).map(u+o),null,{...f.attrs,rowspan:s-h}),t.insert(t.mapping.slice(i).map(e.positionAt(s,p,n)),f.type.createAndFill({...f.attrs,rowspan:h+f.attrs.rowspan-s})),a+=f.attrs.colspan-1}}return c}function de(t,e,n,o,l,r,s,i){if(s==0||s==e.width)return!1;let c=!1;for(let a=l;a<r;a++){const d=a*e.width+s,u=e.map[d];if(e.map[d-1]==u){c=!0;const f=n.nodeAt(u),h=e.colCount(u),p=t.mapping.slice(i).map(u+o);t.setNodeMarkup(p,null,_(f.attrs,s-h,f.attrs.colspan-(s-h))),t.insert(p+f.nodeSize,f.type.createAndFill(_(f.attrs,0,s-h))),a+=f.attrs.rowspan-1}}return c}function ue(t,e,n,o,l){let r=n?t.doc.nodeAt(n-1):t.doc;if(!r)throw new Error("No table found");let s=y.get(r);const{top:i,left:c}=o,a=c+l.width,d=i+l.height,u=t.tr;let f=0;function h(){if(r=n?u.doc.nodeAt(n-1):u.doc,!r)throw new Error("No table found");s=y.get(r),f=u.mapping.maps.length}gt(u,s,r,n,a,d,f)&&h(),ae(u,s,r,n,c,a,i,f)&&h(),ae(u,s,r,n,c,a,d,f)&&h(),de(u,s,r,n,i,d,c,f)&&h(),de(u,s,r,n,i,d,a,f)&&h();for(let p=i;p<d;p++){const m=s.positionAt(p,c,r),b=s.positionAt(p,a,r);u.replace(u.mapping.slice(f).map(m+n),u.mapping.slice(f).map(b+n),new g.Slice(l.rows[p-i],0,0))}h(),u.setSelection(new C(u.doc.resolve(n+s.positionAt(i,c,r)),u.doc.resolve(n+s.positionAt(d-1,a-1,r)))),e(u)}const bt=D.keydownHandler({ArrowLeft:j("horiz",-1),ArrowRight:j("horiz",1),ArrowUp:j("vert",-1),ArrowDown:j("vert",1),"Shift-ArrowLeft":O("horiz",-1),"Shift-ArrowRight":O("horiz",1),"Shift-ArrowUp":O("vert",-1),"Shift-ArrowDown":O("vert",1),Backspace:P,"Mod-Backspace":P,Delete:P,"Mod-Delete":P});function V(t,e,n){return n.eq(t.selection)?!1:(e&&e(t.tr.setSelection(n).scrollIntoView()),!0)}function j(t,e){return(n,o,l)=>{if(!l)return!1;const r=n.selection;if(r instanceof C)return V(n,o,g.Selection.near(r.$headCell,e));if(t!="horiz"&&!r.empty)return!1;const s=Ee(l,t,e);if(s==null)return!1;if(t=="horiz")return V(n,o,g.Selection.near(n.doc.resolve(r.head+e),e));{const i=n.doc.resolve(s),c=Se(i,t,e);let a;return c?a=g.Selection.near(c,1):e<0?a=g.Selection.near(n.doc.resolve(i.before(-1)),-1):a=g.Selection.near(n.doc.resolve(i.after(-1)),1),V(n,o,a)}}}function O(t,e){return(n,o,l)=>{if(!l)return!1;const r=n.selection;let s;if(r instanceof C)s=r;else{const c=Ee(l,t,e);if(c==null)return!1;s=new C(n.doc.resolve(c))}const i=Se(s.$headCell,t,e);return i?V(n,o,new C(s.$anchorCell,i)):!1}}function wt(t,e){const n=t.state.doc,o=H(n.resolve(e));return o?(t.dispatch(t.state.tr.setSelection(new C(o))),!0):!1}function Ct(t,e,n){if(!E(t.state))return!1;let o=ht(n);const l=t.state.selection;if(l instanceof C){o||(o={width:1,height:1,rows:[g.Fragment.from(ee(S(t.state.schema).cell,n))]});const r=l.$anchorCell.node(-1),s=l.$anchorCell.start(-1),i=y.get(r).rectBetween(l.$anchorCell.pos-s,l.$headCell.pos-s);return o=mt(o,i.right-i.left,i.bottom-i.top),ue(t.state,t.dispatch,s,i,o),!0}else if(o){const r=q(t.state),s=r.start(-1);return ue(t.state,t.dispatch,s,y.get(r.node(-1)).findCell(r.pos-s),o),!0}else return!1}function yt(t,e){var n;if(e.button!=0||e.ctrlKey||e.metaKey)return;const o=fe(t,e.target);let l;if(e.shiftKey&&t.state.selection instanceof C)r(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&o&&(l=H(t.state.selection.$anchor))!=null&&((n=U(t,e))===null||n===void 0?void 0:n.pos)!=l.pos)r(l,e),e.preventDefault();else if(!o)return;function r(c,a){let d=U(t,a);const u=z.getState(t.state)==null;if(!d||!oe(c,d))if(u)d=c;else return;const f=new C(c,d);if(u||!t.state.selection.eq(f)){const h=t.state.tr.setSelection(f);u&&h.setMeta(z,c.pos),t.dispatch(h)}}function s(){t.root.removeEventListener("mouseup",s),t.root.removeEventListener("dragstart",s),t.root.removeEventListener("mousemove",i),z.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(z,-1))}function i(c){const a=c,d=z.getState(t.state);let u;if(d!=null)u=t.state.doc.resolve(d);else if(fe(t,a.target)!=o&&(u=U(t,e),!u))return s();u&&r(u,a)}t.root.addEventListener("mouseup",s),t.root.addEventListener("dragstart",s),t.root.addEventListener("mousemove",i)}function Ee(t,e,n){if(!(t.state.selection instanceof g.TextSelection))return null;const{$head:o}=t.state.selection;for(let l=o.depth-1;l>=0;l--){const r=o.node(l);if((n<0?o.index(l):o.indexAfter(l))!=(n<0?0:r.childCount))return null;if(r.type.spec.tableRole=="cell"||r.type.spec.tableRole=="header_cell"){const s=o.before(l),i=e=="vert"?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(i)?s:null}}return null}function fe(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function U(t,e){const n=t.posAtCoords({left:e.clientX,top:e.clientY});if(!n)return null;let{inside:o,pos:l}=n;return o>=0&&H(t.state.doc.resolve(o))||H(t.state.doc.resolve(l))}var St=class{constructor(e,n){this.node=e,this.defaultCellMinWidth=n,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${n}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),te(e,this.colgroup,this.table,n),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!=this.node.type?!1:(this.node=e,te(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function te(t,e,n,o,l,r){let s=0,i=!0,c=e.firstChild;const a=t.firstChild;if(a){for(let u=0,f=0;u<a.childCount;u++){const{colspan:h,colwidth:p}=a.child(u).attrs;for(let m=0;m<h;m++,f++){const b=l==f?r:p&&p[m],w=b?b+"px":"";if(s+=b||o,b||(i=!1),c)c.style.width!=w&&(c.style.width=w),c=c.nextSibling;else{const x=document.createElement("col");x.style.width=w,e.appendChild(x)}}}for(;c;){var d;const u=c.nextSibling;(d=c.parentNode)===null||d===void 0||d.removeChild(c),c=u}i?(n.style.width=s+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=s+"px")}}const T=new g.PluginKey("tableColumnResizing");function xt({handleWidth:t=5,cellMinWidth:e=25,defaultCellMinWidth:n=100,View:o=St,lastColumnResizable:l=!0}={}){const r=new g.Plugin({key:T,state:{init(s,i){var c;const a=(c=r.spec)===null||c===void 0||(c=c.props)===null||c===void 0?void 0:c.nodeViews,d=S(i.schema).table.name;return o&&a&&(a[d]=(u,f)=>new o(u,n,f)),new At(-1,!1)},apply(s,i){return i.apply(s)}},props:{attributes:s=>{const i=T.getState(s);return i&&i.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(s,i)=>{Tt(s,i,t,l)},mouseleave:s=>{Rt(s)},mousedown:(s,i)=>{vt(s,i,e,n)}},decorations:s=>{const i=T.getState(s);if(i&&i.activeHandle>-1)return Lt(s,i.activeHandle)},nodeViews:{}}});return r}var At=class K{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){const n=this,o=e.getMeta(T);if(o&&o.setHandle!=null)return new K(o.setHandle,!1);if(o&&o.setDragging!==void 0)return new K(n.activeHandle,o.setDragging);if(n.activeHandle>-1&&e.docChanged){let l=e.mapping.map(n.activeHandle,-1);return Q(e.doc.resolve(l))||(l=-1),new K(l,n.dragging)}return n}};function Tt(t,e,n,o){if(!t.editable)return;const l=T.getState(t.state);if(l&&!l.dragging){const r=Et(e.target);let s=-1;if(r){const{left:i,right:c}=r.getBoundingClientRect();e.clientX-i<=n?s=he(t,e,"left",n):c-e.clientX<=n&&(s=he(t,e,"right",n))}if(s!=l.activeHandle){if(!o&&s!==-1){const i=t.state.doc.resolve(s),c=i.node(-1),a=y.get(c),d=i.start(-1);if(a.colCount(i.pos-d)+i.nodeAfter.attrs.colspan-1==a.width-1)return}Ne(t,s)}}}function Rt(t){if(!t.editable)return;const e=T.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&Ne(t,-1)}function vt(t,e,n,o){var l;if(!t.editable)return!1;const r=(l=t.dom.ownerDocument.defaultView)!==null&&l!==void 0?l:window,s=T.getState(t.state);if(!s||s.activeHandle==-1||s.dragging)return!1;const i=t.state.doc.nodeAt(s.activeHandle),c=Mt(t,s.activeHandle,i.attrs);t.dispatch(t.state.tr.setMeta(T,{setDragging:{startX:e.clientX,startWidth:c}}));function a(u){r.removeEventListener("mouseup",a),r.removeEventListener("mousemove",d);const f=T.getState(t.state);f!=null&&f.dragging&&(Nt(t,f.activeHandle,pe(f.dragging,u,n)),t.dispatch(t.state.tr.setMeta(T,{setDragging:null})))}function d(u){if(!u.which)return a(u);const f=T.getState(t.state);if(f&&f.dragging){const h=pe(f.dragging,u,n);me(t,f.activeHandle,h,o)}}return me(t,s.activeHandle,c,o),r.addEventListener("mouseup",a),r.addEventListener("mousemove",d),e.preventDefault(),!0}function Mt(t,e,{colspan:n,colwidth:o}){const l=o&&o[o.length-1];if(l)return l;const r=t.domAtPos(e);let s=r.node.childNodes[r.offset].offsetWidth,i=n;if(o)for(let c=0;c<n;c++)o[c]&&(s-=o[c],i--);return s/i}function Et(t){for(;t&&t.nodeName!="TD"&&t.nodeName!="TH";)t=t.classList&&t.classList.contains("ProseMirror")?null:t.parentNode;return t}function he(t,e,n,o){const l=n=="right"?-o:o,r=t.posAtCoords({left:e.clientX+l,top:e.clientY});if(!r)return-1;const{pos:s}=r,i=H(t.state.doc.resolve(s));if(!i)return-1;if(n=="right")return i.pos;const c=y.get(i.node(-1)),a=i.start(-1),d=c.map.indexOf(i.pos-a);return d%c.width==0?-1:a+c.map[d-1]}function pe(t,e,n){const o=e.clientX-t.startX;return Math.max(n,t.startWidth+o)}function Ne(t,e){t.dispatch(t.state.tr.setMeta(T,{setHandle:e}))}function Nt(t,e,n){const o=t.state.doc.resolve(e),l=o.node(-1),r=y.get(l),s=o.start(-1),i=r.colCount(o.pos-s)+o.nodeAfter.attrs.colspan-1,c=t.state.tr;for(let a=0;a<r.height;a++){const d=a*r.width+i;if(a&&r.map[d]==r.map[d-r.width])continue;const u=r.map[d],f=l.nodeAt(u).attrs,h=f.colspan==1?0:i-r.colCount(u);if(f.colwidth&&f.colwidth[h]==n)continue;const p=f.colwidth?f.colwidth.slice():kt(f.colspan);p[h]=n,c.setNodeMarkup(s+u,null,{...f,colwidth:p})}c.docChanged&&t.dispatch(c)}function me(t,e,n,o){const l=t.state.doc.resolve(e),r=l.node(-1),s=l.start(-1),i=y.get(r).colCount(l.pos-s)+l.nodeAfter.attrs.colspan-1;let c=t.domAtPos(l.start(-1)).node;for(;c&&c.nodeName!="TABLE";)c=c.parentNode;c&&te(r,c.firstChild,c,o,i,n)}function kt(t){return Array(t).fill(0)}function Lt(t,e){const n=[],o=t.doc.resolve(e),l=o.node(-1);if(!l)return D.DecorationSet.empty;const r=y.get(l),s=o.start(-1),i=r.colCount(o.pos-s)+o.nodeAfter.attrs.colspan-1;for(let a=0;a<r.height;a++){const d=i+a*r.width;if((i==r.width-1||r.map[d]!=r.map[d+1])&&(a==0||r.map[d]!=r.map[d-r.width])){var c;const u=r.map[d],f=s+u+l.nodeAt(u).nodeSize-1,h=document.createElement("div");h.className="column-resize-handle",!((c=T.getState(t))===null||c===void 0)&&c.dragging&&n.push(D.Decoration.node(s+u,s+u+l.nodeAt(u).nodeSize,{class:"column-resize-dragging"})),n.push(D.Decoration.widget(f,h))}}return D.DecorationSet.create(t.doc,n)}function zt({allowTableNodeSelection:t=!1}={}){return new g.Plugin({key:z,state:{init(){return null},apply(e,n){const o=e.getMeta(z);if(o!=null)return o==-1?null:o;if(n==null||!e.docChanged)return n;const{deleted:l,pos:r}=e.mapping.mapResult(n);return l?null:r}},props:{decorations:Ve,handleDOMEvents:{mousedown:yt},createSelectionBetween(e){return z.getState(e.state)!=null?e.state.selection:null},handleTripleClick:wt,handleKeyDown:bt,handlePaste:Ct},appendTransaction(e,n,o){return Xe(o,Re(o,n),t)}})}var ke=g.Node3.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{var e,n;const o=t.getAttribute("colwidth"),l=o?o.split(",").map(r=>parseInt(r,10)):null;if(!l){const r=(e=t.closest("table"))==null?void 0:e.querySelectorAll("colgroup > col"),s=Array.from(((n=t.parentElement)==null?void 0:n.children)||[]).indexOf(t);if(s&&s>-1&&r&&r[s]){const i=r[s].getAttribute("width");return i?[parseInt(i,10)]:null}}return l}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:t}){return["td",g.mergeAttributes(this.options.HTMLAttributes,t),0]}}),Le=g.Node3.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(o=>parseInt(o,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:t}){return["th",g.mergeAttributes(this.options.HTMLAttributes,t),0]}}),ze=g.Node3.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",g.mergeAttributes(this.options.HTMLAttributes,t),0]}});function ne(t,e){return e?["width",`${Math.max(e,t)}px`]:["min-width",`${t}px`]}function ge(t,e,n,o,l,r){var s;let i=0,c=!0,a=e.firstChild;const d=t.firstChild;if(d!==null)for(let f=0,h=0;f<d.childCount;f+=1){const{colspan:p,colwidth:m}=d.child(f).attrs;for(let b=0;b<p;b+=1,h+=1){const w=l===h?r:m&&m[b],x=w?`${w}px`:"";if(i+=w||o,w||(c=!1),a){if(a.style.width!==x){const[R,L]=ne(o,w);a.style.setProperty(R,L)}a=a.nextSibling}else{const R=document.createElement("col"),[L,M]=ne(o,w);R.style.setProperty(L,M),e.appendChild(R)}}}for(;a;){const f=a.nextSibling;(s=a.parentNode)==null||s.removeChild(a),a=f}const u=t.attrs.style&&typeof t.attrs.style=="string"&&/\bwidth\s*:/i.test(t.attrs.style);c&&!u?(n.style.width=`${i}px`,n.style.minWidth=""):(n.style.width="",n.style.minWidth=`${i}px`)}var Dt=class{constructor(t,e){this.node=t,this.cellMinWidth=e,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),t.attrs.style&&(this.table.style.cssText=t.attrs.style),this.colgroup=this.table.appendChild(document.createElement("colgroup")),ge(t,this.colgroup,this.table,e),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(t){return t.type!==this.node.type?!1:(this.node=t,ge(t,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(t){const e=t.target,n=this.dom.contains(e),o=this.contentDOM.contains(e);return!!(n&&!o&&(t.type==="attributes"||t.type==="childList"||t.type==="characterData"))}};function Ht(t,e,n,o){let l=0,r=!0;const s=[],i=t.firstChild;if(!i)return{};for(let u=0,f=0;u<i.childCount;u+=1){const{colspan:h,colwidth:p}=i.child(u).attrs;for(let m=0;m<h;m+=1,f+=1){const b=n===f?o:p&&p[m];l+=b||e,b||(r=!1);const[w,x]=ne(e,b);s.push(["col",{style:`${w}: ${x}`}])}}const c=r?`${l}px`:"",a=r?"":`${l}px`;return{colgroup:["colgroup",{},...s],tableWidth:c,tableMinWidth:a}}function be(t,e){return t.createAndFill()}function _t(t){if(t.cached.tableNodeTypes)return t.cached.tableNodeTypes;const e={};return Object.keys(t.nodes).forEach(n=>{const o=t.nodes[n];o.spec.tableRole&&(e[o.spec.tableRole]=o)}),t.cached.tableNodeTypes=e,e}function It(t,e,n,o,l){const r=_t(t),s=[],i=[];for(let a=0;a<n;a+=1){const d=be(r.cell);if(d&&i.push(d),o){const u=be(r.header_cell);u&&s.push(u)}}const c=[];for(let a=0;a<e;a+=1)c.push(r.row.createChecked(null,o&&a===0?s:i));return r.table.createChecked(null,c)}function Bt(t){return t instanceof C}var G=({editor:t})=>{const{selection:e}=t.state;if(!Bt(e))return!1;let n=0;const o=g.findParentNodeClosestToPos(e.ranges[0].$from,r=>r.type.name==="table");return o==null||o.node.descendants(r=>{if(r.type.name==="table")return!1;["tableCell","tableHeader"].includes(r.type.name)&&(n+=1)}),n===e.ranges.length?(t.commands.deleteTable(),!0):!1},$t="";function Wt(t){return(t||"").replace(/\s+/g," ").trim()}function Ft(t,e,n={}){var o;const l=(o=n.cellLineSeparator)!=null?o:$t;if(!t||!t.content||t.content.length===0)return"";const r=[];t.content.forEach(p=>{const m=[];p.content&&p.content.forEach(b=>{let w="";b.content&&Array.isArray(b.content)&&b.content.length>1?w=b.content.map(M=>e.renderChildren(M)).join(l):w=b.content?e.renderChildren(b.content):"";const x=Wt(w),R=b.type==="tableHeader";m.push({text:x,isHeader:R})}),r.push(m)});const s=r.reduce((p,m)=>Math.max(p,m.length),0);if(s===0)return"";const i=new Array(s).fill(0);r.forEach(p=>{var m;for(let b=0;b<s;b+=1){const x=(((m=p[b])==null?void 0:m.text)||"").length;x>i[b]&&(i[b]=x),i[b]<3&&(i[b]=3)}});const c=(p,m)=>p+" ".repeat(Math.max(0,m-p.length)),a=r[0],d=a.some(p=>p.isHeader);let u=`
2
- `;const f=new Array(s).fill(0).map((p,m)=>d&&a[m]&&a[m].text||"");return u+=`| ${f.map((p,m)=>c(p,i[m])).join(" | ")} |
3
- `,u+=`| ${i.map(p=>"-".repeat(Math.max(3,p))).join(" | ")} |
4
- `,(d?r.slice(1):r).forEach(p=>{u+=`| ${new Array(s).fill(0).map((m,b)=>c(p[b]&&p[b].text||"",i[b])).join(" | ")} |
5
- `}),u}var Pt=Ft,De=g.Node3.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:Dt,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:t,HTMLAttributes:e}){const{colgroup:n,tableWidth:o,tableMinWidth:l}=Ht(t,this.options.cellMinWidth),r=e.style;function s(){return r||(o?`width: ${o}`:`min-width: ${l}`)}const i=["table",g.mergeAttributes(this.options.HTMLAttributes,e,{style:s()}),n,["tbody",0]];return this.options.renderWrapper?["div",{class:"tableWrapper"},i]:i},parseMarkdown:(t,e)=>{const n=[];if(t.header){const o=[];t.header.forEach(l=>{o.push(e.createNode("tableHeader",{},[{type:"paragraph",content:e.parseInline(l.tokens)}]))}),n.push(e.createNode("tableRow",{},o))}return t.rows&&t.rows.forEach(o=>{const l=[];o.forEach(r=>{l.push(e.createNode("tableCell",{},[{type:"paragraph",content:e.parseInline(r.tokens)}]))}),n.push(e.createNode("tableRow",{},l))}),e.createNode("table",void 0,n)},renderMarkdown:(t,e)=>Pt(t,e),addCommands(){return{insertTable:({rows:t=3,cols:e=3,withHeaderRow:n=!0}={})=>({tr:o,dispatch:l,editor:r})=>{const s=It(r.schema,t,e,n);if(l){const i=o.selection.from+1;o.replaceSelectionWith(s).scrollIntoView().setSelection(_e.TextSelection.near(o.doc.resolve(i)))}return!0},addColumnBefore:()=>({state:t,dispatch:e})=>Je(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>Ye(t,e),deleteColumn:()=>({state:t,dispatch:e})=>et(t,e),addRowBefore:()=>({state:t,dispatch:e})=>nt(t,e),addRowAfter:()=>({state:t,dispatch:e})=>ot(t,e),deleteRow:()=>({state:t,dispatch:e})=>rt(t,e),deleteTable:()=>({state:t,dispatch:e})=>ft(t,e),mergeCells:()=>({state:t,dispatch:e})=>re(t,e),splitCell:()=>({state:t,dispatch:e})=>se(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>B("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>B("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>dt(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>re(t,e)?!0:se(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:o})=>ct(t,e)(n,o),goToNextCell:()=>({state:t,dispatch:e})=>ce(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>ce(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&Re(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){const o=C.create(e.doc,t.anchorCell,t.headCell);e.setSelection(o)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:G,"Mod-Backspace":G,Delete:G,"Mod-Delete":G}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[xt({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],zt({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(t){const e={name:t.name,options:t.options,storage:t.storage};return{tableRole:g.callOrReturn(g.getExtensionField(t,"tableRole",e))}}});g.Extension.create({name:"tableKit",addExtensions(){const t=[];return this.options.table!==!1&&t.push(De.configure(this.options.table)),this.options.tableCell!==!1&&t.push(ke.configure(this.options.tableCell)),this.options.tableHeader!==!1&&t.push(Le.configure(this.options.tableHeader)),this.options.tableRow!==!1&&t.push(ze.configure(this.options.tableRow)),t}});function jt(t,e,n){if(!t.doc)return t;const o=t.doc.nodeAt(e);if(!o||n===o.attrs.backgroundColor)return t;const l={...o.attrs,backgroundColor:n};return t.setNodeMarkup(e,o.type,l,o.marks)}function Ot(t,e,n){const{doc:o,selection:l}=t;return!o||!l||!(l instanceof C)||l.forEachCell((r,s)=>{t=jt(t,s,n)}),t}function we(t,e){return({tr:n,state:o,dispatch:l})=>{const{selection:r}=o;return n=n.setSelection(r),n=Ot(n,e,t),n.docChanged?(l==null||l(n),!0):!1}}const Gt=g.Extension.create({name:"tableCellBackground",addOptions(){return{types:["tableCell"],HTMLAttributes:{}}},addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{parseHTML:t=>t.style.backgroundColor||"",renderHTML:t=>!t.backgroundColor||t.backgroundColor===""?{}:{style:`background-color: ${t.backgroundColor}`}}}}]},addCommands(){return{setTableCellBackground:t=>we(t,this.options),unsetTableCellBackground:()=>we("",this.options)}}}),Vt=/(android|bb\d+|meego).+mobile|armv7l|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series[46]0|samsungbrowser.*mobile|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i,Kt=/CrOS/,qt=/android|ipad|playbook|silk/i;function Ce(t={}){let e=t.ua||typeof navigator<"u"&&navigator.userAgent;return e&&typeof e=="object"&&e.headers&&typeof e.headers["user-agent"]=="string"&&(e=e.headers["user-agent"]),typeof e!="string"?!1:!!(Vt.test(e)&&!Kt.test(e)||t.tablet&&qt.test(e)||t.tablet&&t.featureDetect&&navigator&&navigator.maxTouchPoints>1&&e.includes("Macintosh")&&e.includes("Safari"))}const ye=t=>Array.from({length:t}).map((e,n)=>n+1);function Xt(t){var f;const[e,n]=F.useState(!1),[o,l]=F.useState(!0),[r,s]=F.useState({rows:Ce()?v.TABLE_MAX_GRID_SIZE:v.TABLE_INIT_GRID_SIZE,cols:Ce()?v.TABLE_MAX_GRID_SIZE:v.TABLE_INIT_GRID_SIZE}),[i,c]=F.useState({rows:v.TABLE_DEFAULT_SELECTED_GRID_SIZE,cols:v.TABLE_DEFAULT_SELECTED_GRID_SIZE});function a(h,p){h===r.rows&&s(m=>({...m,rows:Math.min(h+1,v.TABLE_MAX_GRID_SIZE)})),p===r.cols&&s(m=>({...m,cols:Math.min(p+1,v.TABLE_MAX_GRID_SIZE)})),c({rows:h,cols:p})}function d(h,p){t==null||t.createTable({rows:h,cols:p,withHeaderRow:o}),u(),n(!1)}function u(){l(!1),s({rows:v.TABLE_INIT_GRID_SIZE,cols:v.TABLE_INIT_GRID_SIZE}),c({rows:v.TABLE_DEFAULT_SELECTED_GRID_SIZE,cols:v.TABLE_DEFAULT_SELECTED_GRID_SIZE})}return A.jsxs(Z.Popover,{modal:!0,onOpenChange:n,open:e,children:[A.jsx(Z.PopoverTrigger,{asChild:!0,"data-state":t!=null&&t.dataState?"on":"off",children:t==null?void 0:t.children}),A.jsx(Z.PopoverContent,{align:"start",className:"richtext-w-full !richtext-p-2",side:"bottom",children:A.jsxs("div",{className:"table-grid-size-editor richtext-p-0",children:[A.jsx("div",{className:"richtext-flex richtext-flex-col richtext-flex-wrap richtext-justify-between richtext-gap-1",children:(f=ye(r==null?void 0:r.rows))==null?void 0:f.map(h=>{var p;return A.jsx("div",{className:"richtext-flex richtext-gap-1",children:(p=ye(r==null?void 0:r.cols))==null?void 0:p.map(m=>A.jsx("div",{onMouseDown:()=>d(h,m),onMouseOver:()=>a(h,m),className:`richtext-cursor-pointer richtext-border-border ${m<=i.cols&&h<=i.rows&&"tableCellActive !richtext-bg-foreground"}`,children:A.jsx("div",{className:"richtext-box-border richtext-size-4 richtext-rounded-[2px] !richtext-border richtext-border-solid !richtext-border-border richtext-p-1"})},`richtext-table-col-${m}`))},`richtext-table-row-${h}`)})}),A.jsxs("div",{className:"richtext-mt-2 richtext-text-center richtext-text-sm richtext-text-foreground",children:[i.rows,"x",i.cols]})]})})]})}function Zt(){const t=W.useEditorInstance(),e=W.useButtonProps(He.name),{icon:n=void 0,tooltip:o=void 0,action:l=void 0,isActive:r=void 0,color:s}=(e==null?void 0:e.componentProps)??{},{dataState:i,disabled:c}=W.useToggleActive(r);if(!e)return A.jsx(A.Fragment,{});function a(d){t.chain().focus().insertTable({...d,withHeaderRow:!1}).run()}return A.jsx(Xt,{createTable:a,dataState:i,children:A.jsx(W.ActionButton,{action:l,color:s,dataState:i,icon:n,isActive:r,tooltip:o,disabled:c})})}const He=De.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),HTMLAttributes:{style:`
6
- border: 1px solid #000;
7
- border-collapse: collapse;
8
- width: 100%;
9
- `},resizable:!0,lastColumnResizable:!0,allowTableNodeSelection:!1,button:({editor:e,t:n})=>({componentProps:{isActive:()=>e.isActive("table"),icon:"Table",tooltip:n("editor.table.tooltip")}})}},addExtensions(){return[ze.configure(this.options.tableRow),Le.configure(this.options.tableHeader),ke.configure(this.options.tableCell),Gt.configure(this.options.tableCellBackground)]}});exports.CellSelection=C;exports.RichTextTable=Zt;exports.Table=He;