reactjs-tiptap-editor 1.0.17 → 1.0.18

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 (212) hide show
  1. package/lib/{ActionMenuButton-lsIBc9sU.js → ActionMenuButton-BOjCHFTA.js} +6 -6
  2. package/lib/ActionMenuButton-Df077oOH.cjs +1 -0
  3. package/lib/Attachment.cjs +2 -2
  4. package/lib/Attachment.js +40 -78
  5. package/lib/Blockquote.cjs +1 -1
  6. package/lib/Blockquote.js +2 -3
  7. package/lib/Bold.cjs +1 -1
  8. package/lib/Bold.js +2 -3
  9. package/lib/BulletList.cjs +1 -1
  10. package/lib/BulletList.js +2 -3
  11. package/lib/Callout.cjs +1 -1
  12. package/lib/Callout.js +105 -99
  13. package/lib/Clear.cjs +1 -1
  14. package/lib/Clear.js +2 -3
  15. package/lib/Code.cjs +1 -1
  16. package/lib/Code.js +2 -3
  17. package/lib/CodeBlock.cjs +38 -38
  18. package/lib/CodeBlock.js +1561 -1605
  19. package/lib/CodeView.cjs +1 -1
  20. package/lib/CodeView.js +2 -2
  21. package/lib/Color.cjs +1 -1
  22. package/lib/Color.js +46 -63
  23. package/lib/Column.cjs +1 -1
  24. package/lib/Column.js +24 -10
  25. package/lib/Drawer-DwrlY_lY.cjs +1 -0
  26. package/lib/Drawer-DxOoRiGQ.js +1099 -0
  27. package/lib/Drawer.cjs +1 -1
  28. package/lib/Drawer.js +6 -5
  29. package/lib/Emoji.cjs +1 -1
  30. package/lib/Emoji.js +69 -93
  31. package/lib/Excalidraw.cjs +1 -1
  32. package/lib/Excalidraw.js +99 -110
  33. package/lib/ExportPdf.cjs +4 -4
  34. package/lib/ExportPdf.js +4 -13
  35. package/lib/ExportWord.cjs +1 -1
  36. package/lib/ExportWord.js +9 -7
  37. package/lib/FontFamily.cjs +1 -1
  38. package/lib/FontFamily.js +12 -34
  39. package/lib/FontSize.cjs +1 -1
  40. package/lib/FontSize.js +12 -27
  41. package/lib/Heading.cjs +1 -1
  42. package/lib/Heading.js +34 -47
  43. package/lib/Highlight.cjs +1 -1
  44. package/lib/Highlight.js +39 -52
  45. package/lib/History.cjs +1 -1
  46. package/lib/History.js +318 -313
  47. package/lib/HorizontalRule.cjs +1 -1
  48. package/lib/HorizontalRule.js +2 -3
  49. package/lib/{Iframe-CTajPyzs.js → Iframe-AhNV5WH5.js} +25 -34
  50. package/lib/Iframe-C6pBw-AF.cjs +1 -0
  51. package/lib/Iframe.cjs +1 -1
  52. package/lib/Iframe.js +5 -4
  53. package/lib/Image.cjs +1 -1
  54. package/lib/Image.js +5 -4
  55. package/lib/ImageGif.cjs +1 -1
  56. package/lib/ImageGif.js +63 -91
  57. package/lib/ImportWord.cjs +1 -1
  58. package/lib/ImportWord.js +7 -11
  59. package/lib/{Indent-BGEHlRx_.js → Indent-DZ5PcJA4.js} +3 -7
  60. package/lib/Indent-Do-X0AsY.cjs +1 -0
  61. package/lib/Indent.cjs +1 -1
  62. package/lib/Indent.js +2 -2
  63. package/lib/Italic.cjs +1 -1
  64. package/lib/Italic.js +2 -3
  65. package/lib/Katex-CIC9ygbL.cjs +4 -0
  66. package/lib/{Katex-tMh4bfBb.js → Katex-bIgoenn_.js} +241 -255
  67. package/lib/Katex.cjs +1 -1
  68. package/lib/Katex.js +5 -4
  69. package/lib/LineHeight.cjs +1 -1
  70. package/lib/LineHeight.js +13 -21
  71. package/lib/Link.cjs +1 -1
  72. package/lib/Link.js +2 -2
  73. package/lib/LinkEditBlock-B0ZaACZO.cjs +5 -0
  74. package/lib/{LinkEditBlock-CA5NhP-m.js → LinkEditBlock-D_cF9fnc.js} +320 -370
  75. package/lib/MarkdownPaste.cjs +58 -0
  76. package/lib/MarkdownPaste.js +1656 -0
  77. package/lib/Mention.cjs +1 -1
  78. package/lib/Mention.js +22 -17
  79. package/lib/Mermaid.cjs +2 -2
  80. package/lib/Mermaid.js +118 -142
  81. package/lib/MoreMark.cjs +1 -1
  82. package/lib/MoreMark.js +10 -18
  83. package/lib/OrderedList.cjs +1 -1
  84. package/lib/OrderedList.js +2 -3
  85. package/lib/SearchAndReplace.cjs +1 -1
  86. package/lib/SearchAndReplace.js +68 -133
  87. package/lib/SlashCommand.cjs +1 -1
  88. package/lib/SlashCommand.js +15 -14
  89. package/lib/{SlashCommandNodeView-CZoM3ZlS.cjs → SlashCommandNodeView-Ba03hlVZ.cjs} +1 -1
  90. package/lib/{SlashCommandNodeView-DLuqbX2o.js → SlashCommandNodeView-cg0x3NRF.js} +15 -17
  91. package/lib/Strike.cjs +1 -1
  92. package/lib/Strike.js +2 -3
  93. package/lib/{Table-BC4Lbqzn.js → Table-KqLiT5wG.js} +95 -133
  94. package/lib/Table-ddU2LSc6.cjs +9 -0
  95. package/lib/Table.cjs +1 -1
  96. package/lib/Table.js +1 -1
  97. package/lib/TaskList.cjs +1 -1
  98. package/lib/TaskList.js +2 -3
  99. package/lib/TextAlign.cjs +1 -1
  100. package/lib/TextAlign.js +51 -60
  101. package/lib/TextDirection.cjs +1 -1
  102. package/lib/TextDirection.js +47 -69
  103. package/lib/TextUnderline.cjs +1 -1
  104. package/lib/TextUnderline.js +2 -3
  105. package/lib/Twitter-BIiR78Jh.cjs +1 -0
  106. package/lib/{Twitter-D8Cbgl7g.js → Twitter-C1Lzqc7u.js} +567 -593
  107. package/lib/Twitter.cjs +1 -1
  108. package/lib/Twitter.js +4 -3
  109. package/lib/Video.cjs +1 -1
  110. package/lib/Video.js +3 -3
  111. package/lib/bubble.cjs +6 -4
  112. package/lib/bubble.js +3712 -3023
  113. package/lib/clsx-BWE7vnna.cjs +33 -0
  114. package/lib/clsx-eGVyq7ot.js +1062 -0
  115. package/lib/components/ActionButton.d.ts +2 -2
  116. package/lib/components/ActionMenuButton.d.ts +1 -1
  117. package/lib/components/Bubble/formatBubble.d.ts +5 -5
  118. package/lib/components/ui/checkbox.d.ts +1 -1
  119. package/lib/components/ui/dialog.d.ts +1 -1
  120. package/lib/components/ui/dropdown-menu.d.ts +1 -1
  121. package/lib/components/ui/emoji-picker.d.ts +1 -1
  122. package/lib/components/ui/label.d.ts +1 -1
  123. package/lib/components/ui/popover.d.ts +1 -1
  124. package/lib/components/ui/select.d.ts +1 -1
  125. package/lib/components/ui/separator.d.ts +1 -1
  126. package/lib/components/ui/switch.d.ts +1 -1
  127. package/lib/components/ui/tabs.d.ts +1 -1
  128. package/lib/components/ui/toast.d.ts +1 -1
  129. package/lib/components/ui/toggle.d.ts +1 -1
  130. package/lib/components/ui/tooltip.d.ts +1 -1
  131. package/lib/{delete-node-IyVmiRbI.js → delete-node-eQHsyyhR.js} +3 -1
  132. package/lib/{dropdown-menu-q6RL_fkA.js → dropdown-menu-CexIkt_V.js} +8 -8
  133. package/lib/{dropdown-menu-C_F7LEy5.cjs → dropdown-menu-oSKIntXM.cjs} +1 -1
  134. package/lib/extensions/Blockquote/Blockquote.d.ts +1 -1
  135. package/lib/extensions/Bold/Bold.d.ts +1 -1
  136. package/lib/extensions/Code/Code.d.ts +1 -1
  137. package/lib/extensions/CodeView/CodeView.d.ts +2 -2
  138. package/lib/extensions/Heading/Heading.d.ts +1 -1
  139. package/lib/extensions/Highlight/Highlight.d.ts +1 -1
  140. package/lib/extensions/HorizontalRule/HorizontalRule.d.ts +1 -1
  141. package/lib/extensions/ImportWord/ImportWord.d.ts +2 -2
  142. package/lib/extensions/Italic/Italic.d.ts +1 -1
  143. package/lib/extensions/Link/Link.d.ts +1 -1
  144. package/lib/extensions/MarkdownPaste/MarkdownPaste.d.ts +5 -0
  145. package/lib/extensions/MarkdownPaste/index.d.ts +1 -0
  146. package/lib/extensions/Mermaid/Mermaid.d.ts +1 -1
  147. package/lib/extensions/MoreMark/MoreMark.d.ts +1 -1
  148. package/lib/extensions/Strike/Strike.d.ts +1 -1
  149. package/lib/extensions/Table/Table.d.ts +1 -1
  150. package/lib/extensions/TextAlign/TextAlign.d.ts +1 -1
  151. package/lib/extensions/TextUnderline/TextUnderline.d.ts +1 -1
  152. package/lib/index-BUTn2LY6.cjs +1 -0
  153. package/lib/{index-C07N8gA1.js → index-BlXGgvT-.js} +21 -18
  154. package/lib/{index-DqruLhsu.js → index-BnW6t8z6.js} +23 -23
  155. package/lib/{index-BsFvo9PG.cjs → index-BqL4vAWE.cjs} +1 -1
  156. package/lib/index-BtxvYLJ1.cjs +12 -0
  157. package/lib/{index-Do_dsOGB.js → index-C6xmkxrQ.js} +232 -217
  158. package/lib/index-CJ9pyCM4.cjs +1 -0
  159. package/lib/{index-neeeY2o7.cjs → index-D0lc95kr.cjs} +3 -3
  160. package/lib/{index-RcSPeQHn.js → index-DHUN85fV.js} +571 -657
  161. package/lib/index-DUpSE1Gb.cjs +1 -0
  162. package/lib/index-D_8P0LE5.js +1362 -0
  163. package/lib/{index-BDYJ8Ph2.js → index-RIXs7STX.js} +1 -1
  164. package/lib/index-mfGK4pFo.js +6469 -0
  165. package/lib/index-zig3Dj7A.cjs +22 -0
  166. package/lib/index.cjs +1 -1
  167. package/lib/index.js +26 -34
  168. package/lib/locale-bundle.cjs +1 -1
  169. package/lib/locale-bundle.js +1 -1
  170. package/lib/plugins/image-upload.d.ts +1 -1
  171. package/lib/popover-BYSZ3zBi.js +24 -0
  172. package/lib/popover-BcHDZqBt.cjs +1 -0
  173. package/lib/{renderNodeView-BEkECnnY.js → renderNodeView-BrM5kUj_.js} +2 -2
  174. package/lib/{renderNodeView-DfLmGrgA.cjs → renderNodeView-D1zydtli.cjs} +1 -1
  175. package/lib/{select-CmV5uTXr.js → select-C5SHDLFj.js} +8 -5
  176. package/lib/{select-CYyIeImH.cjs → select-DHjzKkcu.cjs} +1 -1
  177. package/lib/{separator-BLp6xpSY.cjs → separator-BmixLrnJ.cjs} +1 -1
  178. package/lib/separator-CFKVxAea.js +293 -0
  179. package/lib/store/editor.d.ts +1 -1
  180. package/lib/store/store.d.ts +1 -1
  181. package/lib/style.css +1 -1
  182. package/lib/{textarea-Cn75Cm2n.cjs → textarea-CasDcv3u.cjs} +1 -1
  183. package/lib/{textarea-CkVKMPqK.js → textarea-DNLrJoRl.js} +1 -1
  184. package/lib/theme.js +1 -1
  185. package/lib/types.d.ts +3 -3
  186. package/lib/updatePosition-CBRjbQMH.js +16 -0
  187. package/lib/updatePosition-CfmY5Trk.cjs +1 -0
  188. package/lib/utils/columns.d.ts +1 -1
  189. package/lib/utils/pdf.d.ts +1 -1
  190. package/lib/utils/utils.d.ts +1 -1
  191. package/package.json +262 -247
  192. package/lib/ActionMenuButton-B_E2mbAW.cjs +0 -1
  193. package/lib/Drawer-DQ4CxBwG.js +0 -1373
  194. package/lib/Drawer-FUeUKshi.cjs +0 -1
  195. package/lib/Iframe-EVWXCqe4.cjs +0 -1
  196. package/lib/Indent-q9cEWAa_.cjs +0 -1
  197. package/lib/Katex-ClqcEnN_.cjs +0 -4
  198. package/lib/LinkEditBlock-DZXk4ln_.cjs +0 -5
  199. package/lib/Table-BmDopO43.cjs +0 -9
  200. package/lib/Twitter-BbMD3Ybp.cjs +0 -1
  201. package/lib/clsx-CXbNJWDD.cjs +0 -54
  202. package/lib/clsx-DaPvp9ji.js +0 -7391
  203. package/lib/index-BCzvbrf5.cjs +0 -12
  204. package/lib/index-BnVcq33n.cjs +0 -1
  205. package/lib/index-CjhjjJsN.cjs +0 -1
  206. package/lib/index-Cs6cp0Y6.cjs +0 -1
  207. package/lib/index-Qcl3BG94.js +0 -1351
  208. package/lib/popover-CtinPbiy.js +0 -24
  209. package/lib/popover-DIMT3pae.cjs +0 -1
  210. package/lib/separator-C7luvaG8.js +0 -327
  211. package/lib/updatePosition-Cjuj2E26.cjs +0 -1
  212. package/lib/updatePosition-DRmKQBGm.js +0 -16
@@ -0,0 +1,1062 @@
1
+ import w, { createContext as G, useContext as U, createRef as de, memo as fe, createElement as he, version as $, useState as pe, useDebugValue as me, useLayoutEffect as Ee, useEffect as ye, forwardRef as ve, useMemo as k } from "react";
2
+ import Se, { flushSync as _e } from "react-dom";
3
+ import { jsx as A, jsxs as Oe, Fragment as ie } from "react/jsx-runtime";
4
+ import { Y as ge, g as be } from "./index-mfGK4pFo.js";
5
+ var D = { exports: {} }, M = {};
6
+ /**
7
+ * @license React
8
+ * use-sync-external-store-shim.production.js
9
+ *
10
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
11
+ *
12
+ * This source code is licensed under the MIT license found in the
13
+ * LICENSE file in the root directory of this source tree.
14
+ */
15
+ var H;
16
+ function we() {
17
+ if (H) return M;
18
+ H = 1;
19
+ var e = w;
20
+ function t(h, v) {
21
+ return h === v && (h !== 0 || 1 / h === 1 / v) || h !== h && v !== v;
22
+ }
23
+ var r = typeof Object.is == "function" ? Object.is : t, n = e.useState, o = e.useEffect, s = e.useLayoutEffect, i = e.useDebugValue;
24
+ function u(h, v) {
25
+ var c = v(), f = n({ inst: { value: c, getSnapshot: v } }), m = f[0].inst, a = f[1];
26
+ return s(
27
+ function() {
28
+ m.value = c, m.getSnapshot = v, d(m) && a({ inst: m });
29
+ },
30
+ [h, c, v]
31
+ ), o(
32
+ function() {
33
+ return d(m) && a({ inst: m }), h(function() {
34
+ d(m) && a({ inst: m });
35
+ });
36
+ },
37
+ [h]
38
+ ), i(c), c;
39
+ }
40
+ function d(h) {
41
+ var v = h.getSnapshot;
42
+ h = h.value;
43
+ try {
44
+ var c = v();
45
+ return !r(h, c);
46
+ } catch {
47
+ return !0;
48
+ }
49
+ }
50
+ function E(h, v) {
51
+ return v();
52
+ }
53
+ var p = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? E : u;
54
+ return M.useSyncExternalStore = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : p, M;
55
+ }
56
+ var I = {};
57
+ /**
58
+ * @license React
59
+ * use-sync-external-store-shim.development.js
60
+ *
61
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
62
+ *
63
+ * This source code is licensed under the MIT license found in the
64
+ * LICENSE file in the root directory of this source tree.
65
+ */
66
+ var K;
67
+ function Ae() {
68
+ return K || (K = 1, process.env.NODE_ENV !== "production" && (function() {
69
+ function e(c, f) {
70
+ return c === f && (c !== 0 || 1 / c === 1 / f) || c !== c && f !== f;
71
+ }
72
+ function t(c, f) {
73
+ p || o.startTransition === void 0 || (p = !0, console.error(
74
+ "You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."
75
+ ));
76
+ var m = f();
77
+ if (!h) {
78
+ var a = f();
79
+ s(m, a) || (console.error(
80
+ "The result of getSnapshot should be cached to avoid an infinite loop"
81
+ ), h = !0);
82
+ }
83
+ a = i({
84
+ inst: { value: m, getSnapshot: f }
85
+ });
86
+ var l = a[0].inst, y = a[1];
87
+ return d(
88
+ function() {
89
+ l.value = m, l.getSnapshot = f, r(l) && y({ inst: l });
90
+ },
91
+ [c, m, f]
92
+ ), u(
93
+ function() {
94
+ return r(l) && y({ inst: l }), c(function() {
95
+ r(l) && y({ inst: l });
96
+ });
97
+ },
98
+ [c]
99
+ ), E(m), m;
100
+ }
101
+ function r(c) {
102
+ var f = c.getSnapshot;
103
+ c = c.value;
104
+ try {
105
+ var m = f();
106
+ return !s(c, m);
107
+ } catch {
108
+ return !0;
109
+ }
110
+ }
111
+ function n(c, f) {
112
+ return f();
113
+ }
114
+ typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
115
+ var o = w, s = typeof Object.is == "function" ? Object.is : e, i = o.useState, u = o.useEffect, d = o.useLayoutEffect, E = o.useDebugValue, p = !1, h = !1, v = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? n : t;
116
+ I.useSyncExternalStore = o.useSyncExternalStore !== void 0 ? o.useSyncExternalStore : v, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
117
+ })()), I;
118
+ }
119
+ var F;
120
+ function W() {
121
+ return F || (F = 1, process.env.NODE_ENV === "production" ? D.exports = we() : D.exports = Ae()), D.exports;
122
+ }
123
+ var Re = W();
124
+ const { getOwnPropertyNames: Ce, getOwnPropertySymbols: Te } = Object, { hasOwnProperty: Ne } = Object.prototype;
125
+ function V(e, t) {
126
+ return function(n, o, s) {
127
+ return e(n, o, s) && t(n, o, s);
128
+ };
129
+ }
130
+ function j(e) {
131
+ return function(r, n, o) {
132
+ if (!r || !n || typeof r != "object" || typeof n != "object")
133
+ return e(r, n, o);
134
+ const { cache: s } = o, i = s.get(r), u = s.get(n);
135
+ if (i && u)
136
+ return i === n && u === r;
137
+ s.set(r, n), s.set(n, r);
138
+ const d = e(r, n, o);
139
+ return s.delete(r), s.delete(n), d;
140
+ };
141
+ }
142
+ function De(e) {
143
+ return e != null ? e[Symbol.toStringTag] : void 0;
144
+ }
145
+ function Y(e) {
146
+ return Ce(e).concat(Te(e));
147
+ }
148
+ const je = (
149
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
150
+ Object.hasOwn || ((e, t) => Ne.call(e, t))
151
+ );
152
+ function C(e, t) {
153
+ return e === t || !e && !t && e !== e && t !== t;
154
+ }
155
+ const Le = "__v", xe = "__o", Me = "_owner", { getOwnPropertyDescriptor: J, keys: X } = Object;
156
+ function Ie(e, t) {
157
+ return e.byteLength === t.byteLength && x(new Uint8Array(e), new Uint8Array(t));
158
+ }
159
+ function Ve(e, t, r) {
160
+ let n = e.length;
161
+ if (t.length !== n)
162
+ return !1;
163
+ for (; n-- > 0; )
164
+ if (!r.equals(e[n], t[n], n, n, e, t, r))
165
+ return !1;
166
+ return !0;
167
+ }
168
+ function qe(e, t) {
169
+ return e.byteLength === t.byteLength && x(new Uint8Array(e.buffer, e.byteOffset, e.byteLength), new Uint8Array(t.buffer, t.byteOffset, t.byteLength));
170
+ }
171
+ function Pe(e, t) {
172
+ return C(e.getTime(), t.getTime());
173
+ }
174
+ function Ge(e, t) {
175
+ return e.name === t.name && e.message === t.message && e.cause === t.cause && e.stack === t.stack;
176
+ }
177
+ function Ue(e, t) {
178
+ return e === t;
179
+ }
180
+ function Z(e, t, r) {
181
+ const n = e.size;
182
+ if (n !== t.size)
183
+ return !1;
184
+ if (!n)
185
+ return !0;
186
+ const o = new Array(n), s = e.entries();
187
+ let i, u, d = 0;
188
+ for (; (i = s.next()) && !i.done; ) {
189
+ const E = t.entries();
190
+ let p = !1, h = 0;
191
+ for (; (u = E.next()) && !u.done; ) {
192
+ if (o[h]) {
193
+ h++;
194
+ continue;
195
+ }
196
+ const v = i.value, c = u.value;
197
+ if (r.equals(v[0], c[0], d, h, e, t, r) && r.equals(v[1], c[1], v[0], c[0], e, t, r)) {
198
+ p = o[h] = !0;
199
+ break;
200
+ }
201
+ h++;
202
+ }
203
+ if (!p)
204
+ return !1;
205
+ d++;
206
+ }
207
+ return !0;
208
+ }
209
+ const We = C;
210
+ function Be(e, t, r) {
211
+ const n = X(e);
212
+ let o = n.length;
213
+ if (X(t).length !== o)
214
+ return !1;
215
+ for (; o-- > 0; )
216
+ if (!se(e, t, r, n[o]))
217
+ return !1;
218
+ return !0;
219
+ }
220
+ function N(e, t, r) {
221
+ const n = Y(e);
222
+ let o = n.length;
223
+ if (Y(t).length !== o)
224
+ return !1;
225
+ let s, i, u;
226
+ for (; o-- > 0; )
227
+ if (s = n[o], !se(e, t, r, s) || (i = J(e, s), u = J(t, s), (i || u) && (!i || !u || i.configurable !== u.configurable || i.enumerable !== u.enumerable || i.writable !== u.writable)))
228
+ return !1;
229
+ return !0;
230
+ }
231
+ function ze(e, t) {
232
+ return C(e.valueOf(), t.valueOf());
233
+ }
234
+ function $e(e, t) {
235
+ return e.source === t.source && e.flags === t.flags;
236
+ }
237
+ function Q(e, t, r) {
238
+ const n = e.size;
239
+ if (n !== t.size)
240
+ return !1;
241
+ if (!n)
242
+ return !0;
243
+ const o = new Array(n), s = e.values();
244
+ let i, u;
245
+ for (; (i = s.next()) && !i.done; ) {
246
+ const d = t.values();
247
+ let E = !1, p = 0;
248
+ for (; (u = d.next()) && !u.done; ) {
249
+ if (!o[p] && r.equals(i.value, u.value, i.value, u.value, e, t, r)) {
250
+ E = o[p] = !0;
251
+ break;
252
+ }
253
+ p++;
254
+ }
255
+ if (!E)
256
+ return !1;
257
+ }
258
+ return !0;
259
+ }
260
+ function x(e, t) {
261
+ let r = e.byteLength;
262
+ if (t.byteLength !== r || e.byteOffset !== t.byteOffset)
263
+ return !1;
264
+ for (; r-- > 0; )
265
+ if (e[r] !== t[r])
266
+ return !1;
267
+ return !0;
268
+ }
269
+ function ke(e, t) {
270
+ return e.hostname === t.hostname && e.pathname === t.pathname && e.protocol === t.protocol && e.port === t.port && e.hash === t.hash && e.username === t.username && e.password === t.password;
271
+ }
272
+ function se(e, t, r, n) {
273
+ return (n === Me || n === xe || n === Le) && (e.$$typeof || t.$$typeof) ? !0 : je(t, n) && r.equals(e[n], t[n], n, n, e, t, r);
274
+ }
275
+ const He = "[object ArrayBuffer]", Ke = "[object Arguments]", Fe = "[object Boolean]", Ye = "[object DataView]", Je = "[object Date]", Xe = "[object Error]", Ze = "[object Map]", Qe = "[object Number]", et = "[object Object]", tt = "[object RegExp]", rt = "[object Set]", nt = "[object String]", ot = {
276
+ "[object Int8Array]": !0,
277
+ "[object Uint8Array]": !0,
278
+ "[object Uint8ClampedArray]": !0,
279
+ "[object Int16Array]": !0,
280
+ "[object Uint16Array]": !0,
281
+ "[object Int32Array]": !0,
282
+ "[object Uint32Array]": !0,
283
+ "[object Float16Array]": !0,
284
+ "[object Float32Array]": !0,
285
+ "[object Float64Array]": !0,
286
+ "[object BigInt64Array]": !0,
287
+ "[object BigUint64Array]": !0
288
+ }, it = "[object URL]", st = Object.prototype.toString;
289
+ function at({ areArrayBuffersEqual: e, areArraysEqual: t, areDataViewsEqual: r, areDatesEqual: n, areErrorsEqual: o, areFunctionsEqual: s, areMapsEqual: i, areNumbersEqual: u, areObjectsEqual: d, arePrimitiveWrappersEqual: E, areRegExpsEqual: p, areSetsEqual: h, areTypedArraysEqual: v, areUrlsEqual: c, unknownTagComparators: f }) {
290
+ return function(a, l, y) {
291
+ if (a === l)
292
+ return !0;
293
+ if (a == null || l == null)
294
+ return !1;
295
+ const b = typeof a;
296
+ if (b !== typeof l)
297
+ return !1;
298
+ if (b !== "object")
299
+ return b === "number" ? u(a, l, y) : b === "function" ? s(a, l, y) : !1;
300
+ const O = a.constructor;
301
+ if (O !== l.constructor)
302
+ return !1;
303
+ if (O === Object)
304
+ return d(a, l, y);
305
+ if (Array.isArray(a))
306
+ return t(a, l, y);
307
+ if (O === Date)
308
+ return n(a, l, y);
309
+ if (O === RegExp)
310
+ return p(a, l, y);
311
+ if (O === Map)
312
+ return i(a, l, y);
313
+ if (O === Set)
314
+ return h(a, l, y);
315
+ const _ = st.call(a);
316
+ if (_ === Je)
317
+ return n(a, l, y);
318
+ if (_ === tt)
319
+ return p(a, l, y);
320
+ if (_ === Ze)
321
+ return i(a, l, y);
322
+ if (_ === rt)
323
+ return h(a, l, y);
324
+ if (_ === et)
325
+ return typeof a.then != "function" && typeof l.then != "function" && d(a, l, y);
326
+ if (_ === it)
327
+ return c(a, l, y);
328
+ if (_ === Xe)
329
+ return o(a, l, y);
330
+ if (_ === Ke)
331
+ return d(a, l, y);
332
+ if (ot[_])
333
+ return v(a, l, y);
334
+ if (_ === He)
335
+ return e(a, l, y);
336
+ if (_ === Ye)
337
+ return r(a, l, y);
338
+ if (_ === Fe || _ === Qe || _ === nt)
339
+ return E(a, l, y);
340
+ if (f) {
341
+ let S = f[_];
342
+ if (!S) {
343
+ const g = De(a);
344
+ g && (S = f[g]);
345
+ }
346
+ if (S)
347
+ return S(a, l, y);
348
+ }
349
+ return !1;
350
+ };
351
+ }
352
+ function ut({ circular: e, createCustomConfig: t, strict: r }) {
353
+ let n = {
354
+ areArrayBuffersEqual: Ie,
355
+ areArraysEqual: r ? N : Ve,
356
+ areDataViewsEqual: qe,
357
+ areDatesEqual: Pe,
358
+ areErrorsEqual: Ge,
359
+ areFunctionsEqual: Ue,
360
+ areMapsEqual: r ? V(Z, N) : Z,
361
+ areNumbersEqual: We,
362
+ areObjectsEqual: r ? N : Be,
363
+ arePrimitiveWrappersEqual: ze,
364
+ areRegExpsEqual: $e,
365
+ areSetsEqual: r ? V(Q, N) : Q,
366
+ areTypedArraysEqual: r ? V(x, N) : x,
367
+ areUrlsEqual: ke,
368
+ unknownTagComparators: void 0
369
+ };
370
+ if (t && (n = Object.assign({}, n, t(n))), e) {
371
+ const o = j(n.areArraysEqual), s = j(n.areMapsEqual), i = j(n.areObjectsEqual), u = j(n.areSetsEqual);
372
+ n = Object.assign({}, n, {
373
+ areArraysEqual: o,
374
+ areMapsEqual: s,
375
+ areObjectsEqual: i,
376
+ areSetsEqual: u
377
+ });
378
+ }
379
+ return n;
380
+ }
381
+ function ct(e) {
382
+ return function(t, r, n, o, s, i, u) {
383
+ return e(t, r, u);
384
+ };
385
+ }
386
+ function lt({ circular: e, comparator: t, createState: r, equals: n, strict: o }) {
387
+ if (r)
388
+ return function(u, d) {
389
+ const { cache: E = e ? /* @__PURE__ */ new WeakMap() : void 0, meta: p } = r();
390
+ return t(u, d, {
391
+ cache: E,
392
+ equals: n,
393
+ meta: p,
394
+ strict: o
395
+ });
396
+ };
397
+ if (e)
398
+ return function(u, d) {
399
+ return t(u, d, {
400
+ cache: /* @__PURE__ */ new WeakMap(),
401
+ equals: n,
402
+ meta: void 0,
403
+ strict: o
404
+ });
405
+ };
406
+ const s = {
407
+ cache: void 0,
408
+ equals: n,
409
+ meta: void 0,
410
+ strict: o
411
+ };
412
+ return function(u, d) {
413
+ return t(u, d, s);
414
+ };
415
+ }
416
+ const dt = R();
417
+ R({ strict: !0 });
418
+ R({ circular: !0 });
419
+ R({
420
+ circular: !0,
421
+ strict: !0
422
+ });
423
+ R({
424
+ createInternalComparator: () => C
425
+ });
426
+ R({
427
+ strict: !0,
428
+ createInternalComparator: () => C
429
+ });
430
+ R({
431
+ circular: !0,
432
+ createInternalComparator: () => C
433
+ });
434
+ R({
435
+ circular: !0,
436
+ createInternalComparator: () => C,
437
+ strict: !0
438
+ });
439
+ function R(e = {}) {
440
+ const { circular: t = !1, createInternalComparator: r, createState: n, strict: o = !1 } = e, s = ut(e), i = at(s), u = r ? r(i) : ct(i);
441
+ return lt({ circular: t, comparator: i, createState: n, equals: u, strict: o });
442
+ }
443
+ var L = { exports: {} }, q = {};
444
+ /**
445
+ * @license React
446
+ * use-sync-external-store-shim/with-selector.production.js
447
+ *
448
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
449
+ *
450
+ * This source code is licensed under the MIT license found in the
451
+ * LICENSE file in the root directory of this source tree.
452
+ */
453
+ var ee;
454
+ function ft() {
455
+ if (ee) return q;
456
+ ee = 1;
457
+ var e = w, t = W();
458
+ function r(E, p) {
459
+ return E === p && (E !== 0 || 1 / E === 1 / p) || E !== E && p !== p;
460
+ }
461
+ var n = typeof Object.is == "function" ? Object.is : r, o = t.useSyncExternalStore, s = e.useRef, i = e.useEffect, u = e.useMemo, d = e.useDebugValue;
462
+ return q.useSyncExternalStoreWithSelector = function(E, p, h, v, c) {
463
+ var f = s(null);
464
+ if (f.current === null) {
465
+ var m = { hasValue: !1, value: null };
466
+ f.current = m;
467
+ } else m = f.current;
468
+ f = u(
469
+ function() {
470
+ function l(S) {
471
+ if (!y) {
472
+ if (y = !0, b = S, S = v(S), c !== void 0 && m.hasValue) {
473
+ var g = m.value;
474
+ if (c(g, S))
475
+ return O = g;
476
+ }
477
+ return O = S;
478
+ }
479
+ if (g = O, n(b, S)) return g;
480
+ var T = v(S);
481
+ return c !== void 0 && c(g, T) ? (b = S, g) : (b = S, O = T);
482
+ }
483
+ var y = !1, b, O, _ = h === void 0 ? null : h;
484
+ return [
485
+ function() {
486
+ return l(p());
487
+ },
488
+ _ === null ? void 0 : function() {
489
+ return l(_());
490
+ }
491
+ ];
492
+ },
493
+ [p, h, v, c]
494
+ );
495
+ var a = o(E, f[0], f[1]);
496
+ return i(
497
+ function() {
498
+ m.hasValue = !0, m.value = a;
499
+ },
500
+ [a]
501
+ ), d(a), a;
502
+ }, q;
503
+ }
504
+ var P = {};
505
+ /**
506
+ * @license React
507
+ * use-sync-external-store-shim/with-selector.development.js
508
+ *
509
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
510
+ *
511
+ * This source code is licensed under the MIT license found in the
512
+ * LICENSE file in the root directory of this source tree.
513
+ */
514
+ var te;
515
+ function ht() {
516
+ return te || (te = 1, process.env.NODE_ENV !== "production" && (function() {
517
+ function e(E, p) {
518
+ return E === p && (E !== 0 || 1 / E === 1 / p) || E !== E && p !== p;
519
+ }
520
+ typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
521
+ var t = w, r = W(), n = typeof Object.is == "function" ? Object.is : e, o = r.useSyncExternalStore, s = t.useRef, i = t.useEffect, u = t.useMemo, d = t.useDebugValue;
522
+ P.useSyncExternalStoreWithSelector = function(E, p, h, v, c) {
523
+ var f = s(null);
524
+ if (f.current === null) {
525
+ var m = { hasValue: !1, value: null };
526
+ f.current = m;
527
+ } else m = f.current;
528
+ f = u(
529
+ function() {
530
+ function l(S) {
531
+ if (!y) {
532
+ if (y = !0, b = S, S = v(S), c !== void 0 && m.hasValue) {
533
+ var g = m.value;
534
+ if (c(g, S))
535
+ return O = g;
536
+ }
537
+ return O = S;
538
+ }
539
+ if (g = O, n(b, S))
540
+ return g;
541
+ var T = v(S);
542
+ return c !== void 0 && c(g, T) ? (b = S, g) : (b = S, O = T);
543
+ }
544
+ var y = !1, b, O, _ = h === void 0 ? null : h;
545
+ return [
546
+ function() {
547
+ return l(p());
548
+ },
549
+ _ === null ? void 0 : function() {
550
+ return l(_());
551
+ }
552
+ ];
553
+ },
554
+ [p, h, v, c]
555
+ );
556
+ var a = o(E, f[0], f[1]);
557
+ return i(
558
+ function() {
559
+ m.hasValue = !0, m.value = a;
560
+ },
561
+ [a]
562
+ ), d(a), a;
563
+ }, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
564
+ })()), P;
565
+ }
566
+ var re;
567
+ function pt() {
568
+ return re || (re = 1, process.env.NODE_ENV === "production" ? L.exports = ft() : L.exports = ht()), L.exports;
569
+ }
570
+ var mt = pt(), Et = (...e) => (t) => {
571
+ e.forEach((r) => {
572
+ typeof r == "function" ? r(t) : r && (r.current = t);
573
+ });
574
+ }, yt = ({ contentComponent: e }) => {
575
+ const t = Re.useSyncExternalStore(
576
+ e.subscribe,
577
+ e.getSnapshot,
578
+ e.getServerSnapshot
579
+ );
580
+ return /* @__PURE__ */ A(ie, { children: Object.values(t) });
581
+ };
582
+ function vt() {
583
+ const e = /* @__PURE__ */ new Set();
584
+ let t = {};
585
+ return {
586
+ /**
587
+ * Subscribe to the editor instance's changes.
588
+ */
589
+ subscribe(r) {
590
+ return e.add(r), () => {
591
+ e.delete(r);
592
+ };
593
+ },
594
+ getSnapshot() {
595
+ return t;
596
+ },
597
+ getServerSnapshot() {
598
+ return t;
599
+ },
600
+ /**
601
+ * Adds a new NodeView Renderer to the editor.
602
+ */
603
+ setRenderer(r, n) {
604
+ t = {
605
+ ...t,
606
+ [r]: Se.createPortal(n.reactElement, n.element, r)
607
+ }, e.forEach((o) => o());
608
+ },
609
+ /**
610
+ * Removes a NodeView Renderer from the editor.
611
+ */
612
+ removeRenderer(r) {
613
+ const n = { ...t };
614
+ delete n[r], t = n, e.forEach((o) => o());
615
+ }
616
+ };
617
+ }
618
+ var St = class extends w.Component {
619
+ constructor(e) {
620
+ var t;
621
+ super(e), this.editorContentRef = w.createRef(), this.initialized = !1, this.state = {
622
+ hasContentComponentInitialized: !!((t = e.editor) != null && t.contentComponent)
623
+ };
624
+ }
625
+ componentDidMount() {
626
+ this.init();
627
+ }
628
+ componentDidUpdate() {
629
+ this.init();
630
+ }
631
+ init() {
632
+ var e;
633
+ const t = this.props.editor;
634
+ if (t && !t.isDestroyed && ((e = t.view.dom) != null && e.parentNode)) {
635
+ if (t.contentComponent)
636
+ return;
637
+ const r = this.editorContentRef.current;
638
+ r.append(...t.view.dom.parentNode.childNodes), t.setOptions({
639
+ element: r
640
+ }), t.contentComponent = vt(), this.state.hasContentComponentInitialized || (this.unsubscribeToContentComponent = t.contentComponent.subscribe(() => {
641
+ this.setState((n) => n.hasContentComponentInitialized ? n : {
642
+ hasContentComponentInitialized: !0
643
+ }), this.unsubscribeToContentComponent && this.unsubscribeToContentComponent();
644
+ })), t.createNodeViews(), this.initialized = !0;
645
+ }
646
+ }
647
+ componentWillUnmount() {
648
+ var e;
649
+ const t = this.props.editor;
650
+ if (t) {
651
+ this.initialized = !1, t.isDestroyed || t.view.setProps({
652
+ nodeViews: {}
653
+ }), this.unsubscribeToContentComponent && this.unsubscribeToContentComponent(), t.contentComponent = null;
654
+ try {
655
+ if (!((e = t.view.dom) != null && e.parentNode))
656
+ return;
657
+ const r = document.createElement("div");
658
+ r.append(...t.view.dom.parentNode.childNodes), t.setOptions({
659
+ element: r
660
+ });
661
+ } catch {
662
+ }
663
+ }
664
+ }
665
+ render() {
666
+ const { editor: e, innerRef: t, ...r } = this.props;
667
+ return /* @__PURE__ */ Oe(ie, { children: [
668
+ /* @__PURE__ */ A("div", { ref: Et(t, this.editorContentRef), ...r }),
669
+ (e == null ? void 0 : e.contentComponent) && /* @__PURE__ */ A(yt, { contentComponent: e.contentComponent })
670
+ ] });
671
+ }
672
+ }, _t = ve(
673
+ (e, t) => {
674
+ const r = w.useMemo(() => Math.floor(Math.random() * 4294967295).toString(), [e.editor]);
675
+ return w.createElement(St, {
676
+ key: r,
677
+ innerRef: t,
678
+ ...e
679
+ });
680
+ }
681
+ ), Ot = w.memo(_t), gt = typeof window < "u" ? Ee : ye, bt = class {
682
+ constructor(e) {
683
+ this.transactionNumber = 0, this.lastTransactionNumber = 0, this.subscribers = /* @__PURE__ */ new Set(), this.editor = e, this.lastSnapshot = { editor: e, transactionNumber: 0 }, this.getSnapshot = this.getSnapshot.bind(this), this.getServerSnapshot = this.getServerSnapshot.bind(this), this.watch = this.watch.bind(this), this.subscribe = this.subscribe.bind(this);
684
+ }
685
+ /**
686
+ * Get the current editor instance.
687
+ */
688
+ getSnapshot() {
689
+ return this.transactionNumber === this.lastTransactionNumber ? this.lastSnapshot : (this.lastTransactionNumber = this.transactionNumber, this.lastSnapshot = { editor: this.editor, transactionNumber: this.transactionNumber }, this.lastSnapshot);
690
+ }
691
+ /**
692
+ * Always disable the editor on the server-side.
693
+ */
694
+ getServerSnapshot() {
695
+ return { editor: null, transactionNumber: 0 };
696
+ }
697
+ /**
698
+ * Subscribe to the editor instance's changes.
699
+ */
700
+ subscribe(e) {
701
+ return this.subscribers.add(e), () => {
702
+ this.subscribers.delete(e);
703
+ };
704
+ }
705
+ /**
706
+ * Watch the editor instance for changes.
707
+ */
708
+ watch(e) {
709
+ if (this.editor = e, this.editor) {
710
+ const t = () => {
711
+ this.transactionNumber += 1, this.subscribers.forEach((n) => n());
712
+ }, r = this.editor;
713
+ return r.on("transaction", t), () => {
714
+ r.off("transaction", t);
715
+ };
716
+ }
717
+ }
718
+ };
719
+ function It(e) {
720
+ var t;
721
+ const [r] = pe(() => new bt(e.editor)), n = mt.useSyncExternalStoreWithSelector(
722
+ r.subscribe,
723
+ r.getSnapshot,
724
+ r.getServerSnapshot,
725
+ e.selector,
726
+ (t = e.equalityFn) != null ? t : dt
727
+ );
728
+ return gt(() => r.watch(e.editor), [e.editor, r]), me(n), n;
729
+ }
730
+ process.env.NODE_ENV;
731
+ var B = G({
732
+ editor: null
733
+ });
734
+ B.Consumer;
735
+ var Vt = () => U(B), ae = G({
736
+ onDragStart: () => {
737
+ },
738
+ nodeViewContentChildren: void 0,
739
+ nodeViewContentRef: () => {
740
+ }
741
+ }), wt = () => U(ae), qt = w.forwardRef((e, t) => {
742
+ const { onDragStart: r } = wt(), n = e.as || "div";
743
+ return (
744
+ // @ts-ignore
745
+ /* @__PURE__ */ A(
746
+ n,
747
+ {
748
+ ...e,
749
+ ref: t,
750
+ "data-node-view-wrapper": "",
751
+ onDragStart: r,
752
+ style: {
753
+ whiteSpace: "normal",
754
+ ...e.style
755
+ }
756
+ }
757
+ )
758
+ );
759
+ });
760
+ function ne(e) {
761
+ return !!(typeof e == "function" && e.prototype && e.prototype.isReactComponent);
762
+ }
763
+ function oe(e) {
764
+ return !!(typeof e == "object" && e.$$typeof && (e.$$typeof.toString() === "Symbol(react.forward_ref)" || e.$$typeof.description === "react.forward_ref"));
765
+ }
766
+ function At(e) {
767
+ return !!(typeof e == "object" && e.$$typeof && (e.$$typeof.toString() === "Symbol(react.memo)" || e.$$typeof.description === "react.memo"));
768
+ }
769
+ function Rt(e) {
770
+ if (ne(e) || oe(e))
771
+ return !0;
772
+ if (At(e)) {
773
+ const t = e.type;
774
+ if (t)
775
+ return ne(t) || oe(t);
776
+ }
777
+ return !1;
778
+ }
779
+ function Ct() {
780
+ try {
781
+ if ($)
782
+ return parseInt($.split(".")[0], 10) >= 19;
783
+ } catch {
784
+ }
785
+ return !1;
786
+ }
787
+ var Tt = class {
788
+ /**
789
+ * Immediately creates element and renders the provided React component.
790
+ */
791
+ constructor(e, { editor: t, props: r = {}, as: n = "div", className: o = "" }) {
792
+ this.ref = null, this.destroyed = !1, this.id = Math.floor(Math.random() * 4294967295).toString(), this.component = e, this.editor = t, this.props = r, this.element = document.createElement(n), this.element.classList.add("react-renderer"), o && this.element.classList.add(...o.split(" ")), this.editor.isInitialized ? _e(() => {
793
+ this.render();
794
+ }) : queueMicrotask(() => {
795
+ this.destroyed || this.render();
796
+ });
797
+ }
798
+ /**
799
+ * Render the React component.
800
+ */
801
+ render() {
802
+ var e;
803
+ if (this.destroyed)
804
+ return;
805
+ const t = this.component, r = this.props, n = this.editor, o = Ct(), s = Rt(t), i = { ...r };
806
+ i.ref && !(o || s) && delete i.ref, !i.ref && (o || s) && (i.ref = (u) => {
807
+ this.ref = u;
808
+ }), this.reactElement = /* @__PURE__ */ A(t, { ...i }), (e = n == null ? void 0 : n.contentComponent) == null || e.setRenderer(this.id, this);
809
+ }
810
+ /**
811
+ * Re-renders the React component with new props.
812
+ */
813
+ updateProps(e = {}) {
814
+ this.destroyed || (this.props = {
815
+ ...this.props,
816
+ ...e
817
+ }, this.render());
818
+ }
819
+ /**
820
+ * Destroy the React component.
821
+ */
822
+ destroy() {
823
+ var e;
824
+ this.destroyed = !0;
825
+ const t = this.editor;
826
+ (e = t == null ? void 0 : t.contentComponent) == null || e.removeRenderer(this.id);
827
+ try {
828
+ this.element && this.element.parentNode && this.element.parentNode.removeChild(this.element);
829
+ } catch {
830
+ }
831
+ }
832
+ /**
833
+ * Update the attributes of the element that holds the React component.
834
+ */
835
+ updateAttributes(e) {
836
+ Object.keys(e).forEach((t) => {
837
+ this.element.setAttribute(t, e[t]);
838
+ });
839
+ }
840
+ };
841
+ w.createContext({
842
+ markViewContentRef: () => {
843
+ }
844
+ });
845
+ var Nt = class extends ge {
846
+ constructor(e, t, r) {
847
+ if (super(e, t, r), this.selectionRafId = null, this.cachedExtensionWithSyncedStorage = null, !this.node.isLeaf) {
848
+ this.options.contentDOMElementTag ? this.contentDOMElement = document.createElement(this.options.contentDOMElementTag) : this.contentDOMElement = document.createElement(this.node.isInline ? "span" : "div"), this.contentDOMElement.dataset.nodeViewContentReact = "", this.contentDOMElement.dataset.nodeViewWrapper = "", this.contentDOMElement.style.whiteSpace = "inherit";
849
+ const n = this.dom.querySelector("[data-node-view-content]");
850
+ if (!n)
851
+ return;
852
+ n.appendChild(this.contentDOMElement);
853
+ }
854
+ }
855
+ /**
856
+ * Returns a proxy of the extension that redirects storage access to the editor's mutable storage.
857
+ * This preserves the original prototype chain (instanceof checks, methods like configure/extend work).
858
+ * Cached to avoid proxy creation on every update.
859
+ */
860
+ get extensionWithSyncedStorage() {
861
+ if (!this.cachedExtensionWithSyncedStorage) {
862
+ const e = this.editor, t = this.extension;
863
+ this.cachedExtensionWithSyncedStorage = new Proxy(t, {
864
+ get(r, n, o) {
865
+ var s;
866
+ return n === "storage" ? (s = e.storage[t.name]) != null ? s : {} : Reflect.get(r, n, o);
867
+ }
868
+ });
869
+ }
870
+ return this.cachedExtensionWithSyncedStorage;
871
+ }
872
+ /**
873
+ * Setup the React component.
874
+ * Called on initialization.
875
+ */
876
+ mount() {
877
+ const e = {
878
+ editor: this.editor,
879
+ node: this.node,
880
+ decorations: this.decorations,
881
+ innerDecorations: this.innerDecorations,
882
+ view: this.view,
883
+ selected: !1,
884
+ extension: this.extensionWithSyncedStorage,
885
+ HTMLAttributes: this.HTMLAttributes,
886
+ getPos: () => this.getPos(),
887
+ updateAttributes: (d = {}) => this.updateAttributes(d),
888
+ deleteNode: () => this.deleteNode(),
889
+ ref: de()
890
+ };
891
+ if (!this.component.displayName) {
892
+ const d = (E) => E.charAt(0).toUpperCase() + E.substring(1);
893
+ this.component.displayName = d(this.extension.name);
894
+ }
895
+ const n = { onDragStart: this.onDragStart.bind(this), nodeViewContentRef: (d) => {
896
+ d && this.contentDOMElement && d.firstChild !== this.contentDOMElement && (d.hasAttribute("data-node-view-wrapper") && d.removeAttribute("data-node-view-wrapper"), d.appendChild(this.contentDOMElement));
897
+ } }, o = this.component, s = fe((d) => /* @__PURE__ */ A(ae.Provider, { value: n, children: he(o, d) }));
898
+ s.displayName = "ReactNodeView";
899
+ let i = this.node.isInline ? "span" : "div";
900
+ this.options.as && (i = this.options.as);
901
+ const { className: u = "" } = this.options;
902
+ this.handleSelectionUpdate = this.handleSelectionUpdate.bind(this), this.renderer = new Tt(s, {
903
+ editor: this.editor,
904
+ props: e,
905
+ as: i,
906
+ className: `node-${this.node.type.name} ${u}`.trim()
907
+ }), this.editor.on("selectionUpdate", this.handleSelectionUpdate), this.updateElementAttributes();
908
+ }
909
+ /**
910
+ * Return the DOM element.
911
+ * This is the element that will be used to display the node view.
912
+ */
913
+ get dom() {
914
+ var e;
915
+ if (this.renderer.element.firstElementChild && !((e = this.renderer.element.firstElementChild) != null && e.hasAttribute("data-node-view-wrapper")))
916
+ throw Error("Please use the NodeViewWrapper component for your node view.");
917
+ return this.renderer.element;
918
+ }
919
+ /**
920
+ * Return the content DOM element.
921
+ * This is the element that will be used to display the rich-text content of the node.
922
+ */
923
+ get contentDOM() {
924
+ return this.node.isLeaf ? null : this.contentDOMElement;
925
+ }
926
+ /**
927
+ * On editor selection update, check if the node is selected.
928
+ * If it is, call `selectNode`, otherwise call `deselectNode`.
929
+ */
930
+ handleSelectionUpdate() {
931
+ this.selectionRafId && (cancelAnimationFrame(this.selectionRafId), this.selectionRafId = null), this.selectionRafId = requestAnimationFrame(() => {
932
+ this.selectionRafId = null;
933
+ const { from: e, to: t } = this.editor.state.selection, r = this.getPos();
934
+ if (typeof r == "number")
935
+ if (e <= r && t >= r + this.node.nodeSize) {
936
+ if (this.renderer.props.selected)
937
+ return;
938
+ this.selectNode();
939
+ } else {
940
+ if (!this.renderer.props.selected)
941
+ return;
942
+ this.deselectNode();
943
+ }
944
+ });
945
+ }
946
+ /**
947
+ * On update, update the React component.
948
+ * To prevent unnecessary updates, the `update` option can be used.
949
+ */
950
+ update(e, t, r) {
951
+ const n = (o) => {
952
+ this.renderer.updateProps(o), typeof this.options.attrs == "function" && this.updateElementAttributes();
953
+ };
954
+ if (e.type !== this.node.type)
955
+ return !1;
956
+ if (typeof this.options.update == "function") {
957
+ const o = this.node, s = this.decorations, i = this.innerDecorations;
958
+ return this.node = e, this.decorations = t, this.innerDecorations = r, this.options.update({
959
+ oldNode: o,
960
+ oldDecorations: s,
961
+ newNode: e,
962
+ newDecorations: t,
963
+ oldInnerDecorations: i,
964
+ innerDecorations: r,
965
+ updateProps: () => n({ node: e, decorations: t, innerDecorations: r, extension: this.extensionWithSyncedStorage })
966
+ });
967
+ }
968
+ return e === this.node && this.decorations === t && this.innerDecorations === r || (this.node = e, this.decorations = t, this.innerDecorations = r, n({ node: e, decorations: t, innerDecorations: r, extension: this.extensionWithSyncedStorage })), !0;
969
+ }
970
+ /**
971
+ * Select the node.
972
+ * Add the `selected` prop and the `ProseMirror-selectednode` class.
973
+ */
974
+ selectNode() {
975
+ this.renderer.updateProps({
976
+ selected: !0
977
+ }), this.renderer.element.classList.add("ProseMirror-selectednode");
978
+ }
979
+ /**
980
+ * Deselect the node.
981
+ * Remove the `selected` prop and the `ProseMirror-selectednode` class.
982
+ */
983
+ deselectNode() {
984
+ this.renderer.updateProps({
985
+ selected: !1
986
+ }), this.renderer.element.classList.remove("ProseMirror-selectednode");
987
+ }
988
+ /**
989
+ * Destroy the React component instance.
990
+ */
991
+ destroy() {
992
+ this.renderer.destroy(), this.editor.off("selectionUpdate", this.handleSelectionUpdate), this.contentDOMElement = null, this.selectionRafId && (cancelAnimationFrame(this.selectionRafId), this.selectionRafId = null);
993
+ }
994
+ /**
995
+ * Update the attributes of the top-level element that holds the React component.
996
+ * Applying the attributes defined in the `attrs` option.
997
+ */
998
+ updateElementAttributes() {
999
+ if (this.options.attrs) {
1000
+ let e = {};
1001
+ if (typeof this.options.attrs == "function") {
1002
+ const t = this.editor.extensionManager.attributes, r = be(this.node, t);
1003
+ e = this.options.attrs({ node: this.node, HTMLAttributes: r });
1004
+ } else
1005
+ e = this.options.attrs;
1006
+ this.renderer.updateAttributes(e);
1007
+ }
1008
+ }
1009
+ };
1010
+ function Pt(e, t) {
1011
+ return (r) => r.editor.contentComponent ? new Nt(e, r, t) : {};
1012
+ }
1013
+ var z = G({
1014
+ get editor() {
1015
+ throw new Error("useTiptap must be used within a <Tiptap> provider");
1016
+ }
1017
+ });
1018
+ z.displayName = "TiptapContext";
1019
+ var Dt = () => U(z);
1020
+ function ue({ editor: e, instance: t, children: r }) {
1021
+ const n = e ?? t;
1022
+ if (!n)
1023
+ throw new Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");
1024
+ const o = k(() => ({ editor: n }), [n]), s = k(() => ({ editor: n }), [n]);
1025
+ return /* @__PURE__ */ A(B.Provider, { value: s, children: /* @__PURE__ */ A(z.Provider, { value: o, children: r }) });
1026
+ }
1027
+ ue.displayName = "Tiptap";
1028
+ function ce({ ...e }) {
1029
+ const { editor: t } = Dt();
1030
+ return /* @__PURE__ */ A(Ot, { editor: t, ...e });
1031
+ }
1032
+ ce.displayName = "Tiptap.Content";
1033
+ Object.assign(ue, {
1034
+ /**
1035
+ * The Tiptap Content component that renders the EditorContent with the editor instance from the context.
1036
+ * @see TiptapContent
1037
+ */
1038
+ Content: ce
1039
+ });
1040
+ function le(e) {
1041
+ var t, r, n = "";
1042
+ if (typeof e == "string" || typeof e == "number") n += e;
1043
+ else if (typeof e == "object") if (Array.isArray(e)) {
1044
+ var o = e.length;
1045
+ for (t = 0; t < o; t++) e[t] && (r = le(e[t])) && (n && (n += " "), n += r);
1046
+ } else for (r in e) e[r] && (n && (n += " "), n += r);
1047
+ return n;
1048
+ }
1049
+ function Gt() {
1050
+ for (var e, t, r = 0, n = "", o = arguments.length; r < o; r++) (e = arguments[r]) && (t = le(e)) && (n && (n += " "), n += t);
1051
+ return n;
1052
+ }
1053
+ export {
1054
+ B as E,
1055
+ qt as N,
1056
+ Tt as R,
1057
+ Pt as a,
1058
+ It as b,
1059
+ Gt as c,
1060
+ Re as s,
1061
+ Vt as u
1062
+ };