@vc-shell/framework 1.1.81 → 1.1.82

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 (106) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/core/plugins/signalR/index.ts +1 -1
  3. package/dist/assets/{b291dc35a17511f7.woff → 105efd028edc1dfe.woff} +0 -0
  4. package/dist/assets/19275e398ae57130.woff2 +0 -0
  5. package/dist/assets/3d892965ab4f1cbb.woff2 +0 -0
  6. package/dist/assets/{327511cd4a7ba7f9.woff → 489710fb710e73f0.woff} +0 -0
  7. package/dist/assets/{a617e11804bbacb7.woff → 54cda5482c6c9218.woff} +0 -0
  8. package/dist/assets/550f52072e8ccafe.woff2 +0 -0
  9. package/dist/assets/686d4077c1e26876.woff2 +0 -0
  10. package/dist/assets/{91eee1aa81f72683.woff → 91fe94e424323d61.woff} +0 -0
  11. package/dist/assets/{f276d55184e05a07.woff → a03cdcd8da5bb987.woff} +0 -0
  12. package/dist/assets/c9191b638a10f67b.woff2 +0 -0
  13. package/dist/assets/{fcb1c1ffb5640194.woff → dceaf3b39091e6a4.woff} +0 -0
  14. package/dist/assets/{a47034e65dbcc3d7.woff → e2ad5b3428289141.woff} +0 -0
  15. package/dist/assets/f239394367fcf005.woff2 +0 -0
  16. package/dist/assets/fc829e3f399b70e0.woff2 +0 -0
  17. package/dist/framework.js +27 -26
  18. package/dist/index.css +1 -1
  19. package/dist/tsconfig.tsbuildinfo +1 -1
  20. package/dist/{vendor-core-js-DFA7rceR.js → vendor-core-js-azBmvlGv.js} +10 -10
  21. package/dist/{vendor-cypress-signalr-mock-CdKwIhWw.js → vendor-cypress-signalr-mock-DjBxJHA6.js} +15 -15
  22. package/dist/vendor-dompurify-C-JbJ3KX.js +536 -0
  23. package/dist/vendor-floating-ui-core-Cl9nBI4j.js +349 -0
  24. package/dist/vendor-floating-ui-dom-3z44E4mf.js +395 -0
  25. package/dist/vendor-floating-ui-vue-ClrgkeO5.js +107 -0
  26. package/dist/{vendor-headlessui-vue-Dg0Llidi.js → vendor-headlessui-vue-D7tzx4PC.js} +2 -2
  27. package/dist/{vendor-intlify-core-base-txnziOTW.js → vendor-intlify-core-base-Da62SG4M.js} +6 -6
  28. package/dist/{vendor-intlify-message-compiler-XquMv3aB.js → vendor-intlify-message-compiler-CHvGSH2u.js} +236 -231
  29. package/dist/{vendor-intlify-shared-CE1Dfvjf.js → vendor-intlify-shared-jWBPd9WB.js} +1 -1
  30. package/dist/{vendor-lodash-es-CrYlgAi8.js → vendor-lodash-es-BqkGj3Jl.js} +14 -14
  31. package/dist/{vendor-markdown-it-RJo-N9ov.js → vendor-markdown-it-Czg9qJTh.js} +1 -1
  32. package/dist/{vendor-microsoft-applicationinsights-analytics-js-CauId95v.js → vendor-microsoft-applicationinsights-analytics-js-BNSkz9ia.js} +20 -20
  33. package/dist/{vendor-microsoft-applicationinsights-cfgsync-js-DGfB75It.js → vendor-microsoft-applicationinsights-cfgsync-js-Dp8OU6ZE.js} +5 -5
  34. package/dist/{vendor-microsoft-applicationinsights-channel-js-B4PYlGv8.js → vendor-microsoft-applicationinsights-channel-js-Bc73N-5y.js} +18 -18
  35. package/dist/{vendor-microsoft-applicationinsights-common-Bj6sQeoz.js → vendor-microsoft-applicationinsights-common-DcnOqpgL.js} +25 -25
  36. package/dist/{vendor-microsoft-applicationinsights-core-js-Cga21Mpw.js → vendor-microsoft-applicationinsights-core-js-CX4NA2hM.js} +21 -21
  37. package/dist/{vendor-microsoft-applicationinsights-dependencies-js-CH87Sln6.js → vendor-microsoft-applicationinsights-dependencies-js-C_DhEOae.js} +10 -10
  38. package/dist/{vendor-microsoft-applicationinsights-properties-js-CLE2OEt_.js → vendor-microsoft-applicationinsights-properties-js-COczDd7b.js} +24 -24
  39. package/dist/{vendor-microsoft-applicationinsights-web-8IaeIl22.js → vendor-microsoft-applicationinsights-web-DtOQojwf.js} +10 -10
  40. package/dist/{vendor-microsoft-signalr-qIrag5xx.js → vendor-microsoft-signalr-Bgpbb4fW.js} +1 -1
  41. package/dist/{vendor-moment-CwOqp704.js → vendor-moment-DMLRxgRE.js} +8 -8
  42. package/dist/{vendor-nevware21-ts-async-DadHEt7N.js → vendor-nevware21-ts-async-DFUnZ_sN.js} +2 -2
  43. package/dist/{vendor-prettier-DaiSFsWE.js → vendor-prettier-cZc5sCiS.js} +2 -2
  44. package/dist/{vendor-prosemirror-commands-DKHyfRYE.js → vendor-prosemirror-commands-DlSOsoOz.js} +3 -3
  45. package/dist/{vendor-prosemirror-dropcursor-Dro-INCI.js → vendor-prosemirror-dropcursor-CqLA3EZY.js} +2 -2
  46. package/dist/{vendor-prosemirror-gapcursor-BgyglWtH.js → vendor-prosemirror-gapcursor-3PaVPyUV.js} +4 -4
  47. package/dist/{vendor-prosemirror-history-B4ei16kP.js → vendor-prosemirror-history-DzP74u0n.js} +3 -3
  48. package/dist/{vendor-prosemirror-keymap-21y6bXc_.js → vendor-prosemirror-keymap-CN6Hkrq2.js} +1 -1
  49. package/dist/{vendor-prosemirror-markdown-CuzWQ2N6.js → vendor-prosemirror-markdown-BBPyARPh.js} +2 -2
  50. package/dist/{vendor-prosemirror-model-CVTn1Stc.js → vendor-prosemirror-model-CiCy9gkA.js} +2 -2
  51. package/dist/{vendor-prosemirror-schema-list-Dmi4oPas.js → vendor-prosemirror-schema-list-asS28-n3.js} +2 -2
  52. package/dist/{vendor-prosemirror-state-6jGEPgrP.js → vendor-prosemirror-state-DUZYoLys.js} +2 -2
  53. package/dist/{vendor-prosemirror-tables-U7ypaxJu.js → vendor-prosemirror-tables-CezTPhzU.js} +5 -5
  54. package/dist/{vendor-prosemirror-transform-Dk6c_eg4.js → vendor-prosemirror-transform-BOkRqJ32.js} +1 -1
  55. package/dist/vendor-prosemirror-view-CzsD5m3e.js +3750 -0
  56. package/dist/vendor-punycode-js-CgGegfA_.js +133 -0
  57. package/dist/{vendor-rope-sequence-sEGCUMi8.js → vendor-rope-sequence-BWC2FSrq.js} +4 -4
  58. package/dist/{vendor-semver-FuwqpOls.js → vendor-semver-B87_S22g.js} +2 -2
  59. package/dist/{vendor-tiptap-core-CtNT-ozM.js → vendor-tiptap-core-rgc3Sj5Y.js} +258 -250
  60. package/dist/{vendor-tiptap-extension-blockquote-25QerT8O.js → vendor-tiptap-extension-blockquote-DgzMeNpc.js} +1 -1
  61. package/dist/{vendor-tiptap-extension-bold-B-B75KIy.js → vendor-tiptap-extension-bold-DZbX5Qiw.js} +1 -1
  62. package/dist/{vendor-tiptap-extension-code-CEZA5x7I.js → vendor-tiptap-extension-code-BcakHaXe.js} +1 -1
  63. package/dist/{vendor-tiptap-extension-code-block-BFDiCj59.js → vendor-tiptap-extension-code-block-B0U7g1XA.js} +2 -2
  64. package/dist/{vendor-tiptap-extension-document-C8JdW_kC.js → vendor-tiptap-extension-document-BBhadLNS.js} +1 -1
  65. package/dist/{vendor-tiptap-extension-hard-break-D9Nzegu6.js → vendor-tiptap-extension-hard-break-eyl10A9U.js} +1 -1
  66. package/dist/{vendor-tiptap-extension-heading-TmkrHpE2.js → vendor-tiptap-extension-heading-BmX_Abvh.js} +1 -1
  67. package/dist/{vendor-tiptap-extension-horizontal-rule-BC1YMUau.js → vendor-tiptap-extension-horizontal-rule-DyYIWV6W.js} +2 -2
  68. package/dist/{vendor-tiptap-extension-image-BQnBpg7z.js → vendor-tiptap-extension-image-C06iDyEi.js} +1 -1
  69. package/dist/{vendor-tiptap-extension-italic-mSCwLnXY.js → vendor-tiptap-extension-italic-B2YDHBEe.js} +1 -1
  70. package/dist/{vendor-tiptap-extension-link-CQ0Mw6gd.js → vendor-tiptap-extension-link-Bw8_3Rr4.js} +2 -2
  71. package/dist/{vendor-tiptap-extension-list-BwidYizT.js → vendor-tiptap-extension-list-qHzpj6eq.js} +1 -1
  72. package/dist/{vendor-tiptap-extension-paragraph-C_OQHUNe.js → vendor-tiptap-extension-paragraph-BnCRfXCL.js} +1 -1
  73. package/dist/vendor-tiptap-extension-placeholder-BVZ1jBA2.js +1 -0
  74. package/dist/{vendor-tiptap-extension-strike-Bfc-eud8.js → vendor-tiptap-extension-strike-Naksm43m.js} +1 -1
  75. package/dist/{vendor-tiptap-extension-table-D26aUVrb.js → vendor-tiptap-extension-table-Cguez3tu.js} +3 -3
  76. package/dist/vendor-tiptap-extension-table-cell-lniviH1T.js +1 -0
  77. package/dist/vendor-tiptap-extension-table-header-lniviH1T.js +1 -0
  78. package/dist/vendor-tiptap-extension-table-row-lniviH1T.js +1 -0
  79. package/dist/{vendor-tiptap-extension-text-DrXC1h34.js → vendor-tiptap-extension-text-CixjyWfN.js} +1 -1
  80. package/dist/{vendor-tiptap-extension-text-style-vv6u__7g.js → vendor-tiptap-extension-text-style-CVsjuWJ4.js} +1 -1
  81. package/dist/{vendor-tiptap-extension-underline-BfygI164.js → vendor-tiptap-extension-underline-Rwkvga0F.js} +1 -1
  82. package/dist/{vendor-tiptap-extensions-_4zopegS.js → vendor-tiptap-extensions-F9A02hii.js} +6 -6
  83. package/dist/{vendor-tiptap-markdown-pGf8MOss.js → vendor-tiptap-markdown-BSUpswXr.js} +5 -5
  84. package/dist/vendor-tiptap-pm-BUxx7nt1.js +1 -0
  85. package/dist/{vendor-tiptap-starter-kit-DPG4_B0q.js → vendor-tiptap-starter-kit-BUgq7S1_.js} +17 -17
  86. package/dist/{vendor-tiptap-vue-3-Ctgrxv1U.js → vendor-tiptap-vue-3-UHrHfZLG.js} +1 -1
  87. package/dist/{vendor-vue-i18n-BeXi5L3e.js → vendor-vue-i18n-CO5LWKE0.js} +6 -6
  88. package/dist/{vendor-vue3-application-insights-C8xbxXXX.js → vendor-vue3-application-insights-CE6eo4vj.js} +2 -2
  89. package/dist/{vendor-vue3-touch-events-8Pa3HHlV.js → vendor-vue3-touch-events-DqysuuWh.js} +2 -2
  90. package/package.json +4 -4
  91. package/dist/assets/42df4e2d6fa3fd2a.woff2 +0 -0
  92. package/dist/assets/52610491f372cb0c.woff2 +0 -0
  93. package/dist/assets/5b3661be8be679d0.woff2 +0 -0
  94. package/dist/assets/5d96cfcc5bedd917.woff2 +0 -0
  95. package/dist/assets/6619e9e10beea0e7.woff2 +0 -0
  96. package/dist/assets/bfbe205759295eca.woff2 +0 -0
  97. package/dist/assets/d80b05788e407de7.woff2 +0 -0
  98. package/dist/vendor-dompurify-eYFoHPwR.js +0 -528
  99. package/dist/vendor-floating-ui-vue-C1Zscv9o.js +0 -836
  100. package/dist/vendor-prosemirror-view-Bfe9EVLy.js +0 -1489
  101. package/dist/vendor-punycode-js-CNI-zL6U.js +0 -133
  102. package/dist/vendor-tiptap-extension-placeholder-BIojfRhh.js +0 -1
  103. package/dist/vendor-tiptap-extension-table-cell-DuWy52BP.js +0 -1
  104. package/dist/vendor-tiptap-extension-table-header-DuWy52BP.js +0 -1
  105. package/dist/vendor-tiptap-extension-table-row-DuWy52BP.js +0 -1
  106. package/dist/vendor-tiptap-pm-B2DY8bDS.js +0 -7681
@@ -1,1489 +0,0 @@
1
- import { T as S, N as m, S as G, A as lt } from "./vendor-prosemirror-state-6jGEPgrP.js";
2
- import { S as M, D as Ve, F as z, d as st } from "./vendor-prosemirror-model-CVTn1Stc.js";
3
- import { d as it } from "./vendor-prosemirror-transform-Dk6c_eg4.js";
4
- const L = function(e) {
5
- for (var n = 0; ; n++)
6
- if (e = e.previousSibling, !e)
7
- return n;
8
- }, Ke = function(e, n, t, r) {
9
- return t && (Se(e, n, t, r, -1) || Se(e, n, t, r, 1));
10
- }, at = /^(img|br|input|textarea|hr)$/i;
11
- function Se(e, n, t, r, o) {
12
- for (var l; ; ) {
13
- if (e == t && n == r)
14
- return !0;
15
- if (n == (o < 0 ? 0 : Q(e))) {
16
- let s = e.parentNode;
17
- if (!s || s.nodeType != 1 || ue(e) || at.test(e.nodeName) || e.contentEditable == "false")
18
- return !1;
19
- n = L(e) + (o < 0 ? 0 : 1), e = s;
20
- } else if (e.nodeType == 1) {
21
- let s = e.childNodes[n + (o < 0 ? -1 : 0)];
22
- if (s.nodeType == 1 && s.contentEditable == "false")
23
- if (!((l = s.pmViewDesc) === null || l === void 0) && l.ignoreForSelection)
24
- n += o;
25
- else
26
- return !1;
27
- else
28
- e = s, n = o < 0 ? Q(e) : 0;
29
- } else
30
- return !1;
31
- }
32
- }
33
- function Q(e) {
34
- return e.nodeType == 3 ? e.nodeValue.length : e.childNodes.length;
35
- }
36
- function ct(e, n, t) {
37
- for (let r = n == 0, o = n == Q(e); r || o; ) {
38
- if (e == t)
39
- return !0;
40
- let l = L(e);
41
- if (e = e.parentNode, !e)
42
- return !1;
43
- r = r && l == 0, o = o && l == Q(e);
44
- }
45
- }
46
- function ue(e) {
47
- let n;
48
- for (let t = e; t && !(n = t.pmViewDesc); t = t.parentNode)
49
- ;
50
- return n && n.node && n.node.isBlock && (n.dom == e || n.contentDOM == e);
51
- }
52
- const ze = function(e) {
53
- return e.focusNode && Ke(e.focusNode, e.focusOffset, e.anchorNode, e.anchorOffset);
54
- };
55
- function Le(e, n) {
56
- let t = document.createEvent("Event");
57
- return t.initEvent("keydown", !0, !0), t.keyCode = e, t.key = t.code = n, t;
58
- }
59
- const k = typeof navigator < "u" ? navigator : null, De = typeof document < "u" ? document : null, $ = k && k.userAgent || "", oe = /Edge\/(\d+)/.exec($), Fe = /MSIE \d/.exec($), le = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec($), X = !!(Fe || le || oe), Be = Fe ? document.documentMode : le ? +le[1] : oe ? +oe[1] : 0, ee = !X && /gecko\/(\d+)/i.test($);
60
- ee && +(/Firefox\/(\d+)/.exec($) || [0, 0])[1];
61
- const se = !X && /Chrome\/(\d+)/.exec($), I = !!se, qe = se ? +se[1] : 0, F = !X && !!k && /Apple Computer/.test(k.vendor), de = F && (/Mobile\/\w+/.test($) || !!k && k.maxTouchPoints > 2), C = de || (k ? /Mac/.test(k.platform) : !1), ft = k ? /Win/.test(k.platform) : !1, Y = /Android \d/.test($), pe = !!De && "webkitFontSmoothing" in De.documentElement.style, ut = pe ? +(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent) || [0, 0])[1] : 0;
62
- function dt(e, n = null) {
63
- let t = e.domSelectionRange(), r = e.state.doc;
64
- if (!t.focusNode)
65
- return null;
66
- let o = e.docView.nearestDesc(t.focusNode), l = o && o.size == 0, s = e.docView.posFromDOM(t.focusNode, t.focusOffset, 1);
67
- if (s < 0)
68
- return null;
69
- let i = r.resolve(s), a, c;
70
- if (ze(t)) {
71
- for (a = s; o && !o.node; )
72
- o = o.parent;
73
- let u = o.node;
74
- if (o && u.isAtom && m.isSelectable(u) && o.parent && !(u.isInline && ct(t.focusNode, t.focusOffset, o.dom))) {
75
- let d = o.posBefore;
76
- c = new m(s == d ? i : r.resolve(d));
77
- }
78
- } else {
79
- if (t instanceof e.dom.ownerDocument.defaultView.Selection && t.rangeCount > 1) {
80
- let u = s, d = s;
81
- for (let p = 0; p < t.rangeCount; p++) {
82
- let h = t.getRangeAt(p);
83
- u = Math.min(u, e.docView.posFromDOM(h.startContainer, h.startOffset, 1)), d = Math.max(d, e.docView.posFromDOM(h.endContainer, h.endOffset, -1));
84
- }
85
- if (u < 0)
86
- return null;
87
- [a, s] = d == e.state.selection.anchor ? [d, u] : [u, d], i = r.resolve(s);
88
- } else
89
- a = e.docView.posFromDOM(t.anchorNode, t.anchorOffset, 1);
90
- if (a < 0)
91
- return null;
92
- }
93
- let f = r.resolve(a);
94
- if (!c) {
95
- let u = n == "pointer" || e.state.selection.head < i.pos && !l ? 1 : -1;
96
- c = We(e, f, i, u);
97
- }
98
- return c;
99
- }
100
- function He(e) {
101
- return e.editable ? e.hasFocus() : gt(e) && document.activeElement && document.activeElement.contains(e.dom);
102
- }
103
- function he(e, n = !1) {
104
- let t = e.state.selection;
105
- if (mt(e, t), !!He(e)) {
106
- if (!n && e.input.mouseDown && e.input.mouseDown.allowDefault && I) {
107
- let r = e.domSelectionRange(), o = e.domObserver.currentSelection;
108
- if (r.anchorNode && o.anchorNode && Ke(r.anchorNode, r.anchorOffset, o.anchorNode, o.anchorOffset)) {
109
- e.input.mouseDown.delayedSelectionSync = !0, e.domObserver.setCurSelection();
110
- return;
111
- }
112
- }
113
- if (e.domObserver.disconnectSelection(), e.cursorWrapper)
114
- ht(e);
115
- else {
116
- let { anchor: r, head: o } = t, l, s;
117
- Ne && !(t instanceof S) && (t.$from.parent.inlineContent || (l = Te(e, t.from)), !t.empty && !t.$from.parent.inlineContent && (s = Te(e, t.to))), e.docView.setSelection(r, o, e, n), Ne && (l && ke(l), s && ke(s)), t.visible ? e.dom.classList.remove("ProseMirror-hideselection") : (e.dom.classList.add("ProseMirror-hideselection"), "onselectionchange" in document && pt(e));
118
- }
119
- e.domObserver.setCurSelection(), e.domObserver.connectSelection();
120
- }
121
- }
122
- const Ne = F || I && qe < 63;
123
- function Te(e, n) {
124
- let { node: t, offset: r } = e.docView.domFromPos(n, 0), o = r < t.childNodes.length ? t.childNodes[r] : null, l = r ? t.childNodes[r - 1] : null;
125
- if (F && o && o.contentEditable == "false")
126
- return ne(o);
127
- if ((!o || o.contentEditable == "false") && (!l || l.contentEditable == "false")) {
128
- if (o)
129
- return ne(o);
130
- if (l)
131
- return ne(l);
132
- }
133
- }
134
- function ne(e) {
135
- return e.contentEditable = "true", F && e.draggable && (e.draggable = !1, e.wasDraggable = !0), e;
136
- }
137
- function ke(e) {
138
- e.contentEditable = "false", e.wasDraggable && (e.draggable = !0, e.wasDraggable = null);
139
- }
140
- function pt(e) {
141
- let n = e.dom.ownerDocument;
142
- n.removeEventListener("selectionchange", e.input.hideSelectionGuard);
143
- let t = e.domSelectionRange(), r = t.anchorNode, o = t.anchorOffset;
144
- n.addEventListener("selectionchange", e.input.hideSelectionGuard = () => {
145
- (t.anchorNode != r || t.anchorOffset != o) && (n.removeEventListener("selectionchange", e.input.hideSelectionGuard), setTimeout(() => {
146
- (!He(e) || e.state.selection.visible) && e.dom.classList.remove("ProseMirror-hideselection");
147
- }, 20));
148
- });
149
- }
150
- function ht(e) {
151
- let n = e.domSelection(), t = document.createRange();
152
- if (!n)
153
- return;
154
- let r = e.cursorWrapper.dom, o = r.nodeName == "IMG";
155
- o ? t.setStart(r.parentNode, L(r) + 1) : t.setStart(r, 0), t.collapse(!0), n.removeAllRanges(), n.addRange(t), !o && !e.state.selection.visible && X && Be <= 11 && (r.disabled = !0, r.disabled = !1);
156
- }
157
- function mt(e, n) {
158
- if (n instanceof m) {
159
- let t = e.docView.descAt(n.from);
160
- t != e.lastSelectedViewDesc && (xe(e), t && t.selectNode(), e.lastSelectedViewDesc = t);
161
- } else
162
- xe(e);
163
- }
164
- function xe(e) {
165
- e.lastSelectedViewDesc && (e.lastSelectedViewDesc.parent && e.lastSelectedViewDesc.deselectNode(), e.lastSelectedViewDesc = void 0);
166
- }
167
- function We(e, n, t, r) {
168
- return e.someProp("createSelectionBetween", (o) => o(e, n, t)) || S.between(n, t, r);
169
- }
170
- function gt(e) {
171
- let n = e.domSelectionRange();
172
- if (!n.anchorNode)
173
- return !1;
174
- try {
175
- return e.dom.contains(n.anchorNode.nodeType == 3 ? n.anchorNode.parentNode : n.anchorNode) && (e.editable || e.dom.contains(n.focusNode.nodeType == 3 ? n.focusNode.parentNode : n.focusNode));
176
- } catch {
177
- return !1;
178
- }
179
- }
180
- function ie(e, n) {
181
- let { $anchor: t, $head: r } = e.selection, o = n > 0 ? t.max(r) : t.min(r), l = o.parent.inlineContent ? o.depth ? e.doc.resolve(n > 0 ? o.after() : o.before()) : null : o;
182
- return l && G.findFrom(l, n);
183
- }
184
- function O(e, n) {
185
- return e.dispatch(e.state.tr.setSelection(n).scrollIntoView()), !0;
186
- }
187
- function Ee(e, n, t) {
188
- let r = e.state.selection;
189
- if (r instanceof S)
190
- if (t.indexOf("s") > -1) {
191
- let { $head: o } = r, l = o.textOffset ? null : n < 0 ? o.nodeBefore : o.nodeAfter;
192
- if (!l || l.isText || !l.isLeaf)
193
- return !1;
194
- let s = e.state.doc.resolve(o.pos + l.nodeSize * (n < 0 ? -1 : 1));
195
- return O(e, new S(r.$anchor, s));
196
- } else if (r.empty) {
197
- if (e.endOfTextblock(n > 0 ? "forward" : "backward")) {
198
- let o = ie(e.state, n);
199
- return o && o instanceof m ? O(e, o) : !1;
200
- } else if (!(C && t.indexOf("m") > -1)) {
201
- let o = r.$head, l = o.textOffset ? null : n < 0 ? o.nodeBefore : o.nodeAfter, s;
202
- if (!l || l.isText)
203
- return !1;
204
- let i = n < 0 ? o.pos - l.nodeSize : o.pos;
205
- return l.isAtom || (s = e.docView.descAt(i)) && !s.contentDOM ? m.isSelectable(l) ? O(e, new m(n < 0 ? e.state.doc.resolve(o.pos - l.nodeSize) : o)) : pe ? O(e, new S(e.state.doc.resolve(n < 0 ? i : i + l.nodeSize))) : !1 : !1;
206
- }
207
- } else return !1;
208
- else {
209
- if (r instanceof m && r.node.isInline)
210
- return O(e, new S(n > 0 ? r.$to : r.$from));
211
- {
212
- let o = ie(e.state, n);
213
- return o ? O(e, o) : !1;
214
- }
215
- }
216
- }
217
- function Z(e) {
218
- return e.nodeType == 3 ? e.nodeValue.length : e.childNodes.length;
219
- }
220
- function W(e, n) {
221
- let t = e.pmViewDesc;
222
- return t && t.size == 0 && (n < 0 || e.nextSibling || e.nodeName != "BR");
223
- }
224
- function B(e, n) {
225
- return n < 0 ? bt(e) : yt(e);
226
- }
227
- function bt(e) {
228
- let n = e.domSelectionRange(), t = n.focusNode, r = n.focusOffset;
229
- if (!t)
230
- return;
231
- let o, l, s = !1;
232
- for (ee && t.nodeType == 1 && r < Z(t) && W(t.childNodes[r], -1) && (s = !0); ; )
233
- if (r > 0) {
234
- if (t.nodeType != 1)
235
- break;
236
- {
237
- let i = t.childNodes[r - 1];
238
- if (W(i, -1))
239
- o = t, l = --r;
240
- else if (i.nodeType == 3)
241
- t = i, r = t.nodeValue.length;
242
- else
243
- break;
244
- }
245
- } else {
246
- if (je(t))
247
- break;
248
- {
249
- let i = t.previousSibling;
250
- for (; i && W(i, -1); )
251
- o = t.parentNode, l = L(i), i = i.previousSibling;
252
- if (i)
253
- t = i, r = Z(t);
254
- else {
255
- if (t = t.parentNode, t == e.dom)
256
- break;
257
- r = 0;
258
- }
259
- }
260
- }
261
- s ? ae(e, t, r) : o && ae(e, o, l);
262
- }
263
- function yt(e) {
264
- let n = e.domSelectionRange(), t = n.focusNode, r = n.focusOffset;
265
- if (!t)
266
- return;
267
- let o = Z(t), l, s;
268
- for (; ; )
269
- if (r < o) {
270
- if (t.nodeType != 1)
271
- break;
272
- let i = t.childNodes[r];
273
- if (W(i, 1))
274
- l = t, s = ++r;
275
- else
276
- break;
277
- } else {
278
- if (je(t))
279
- break;
280
- {
281
- let i = t.nextSibling;
282
- for (; i && W(i, 1); )
283
- l = i.parentNode, s = L(i) + 1, i = i.nextSibling;
284
- if (i)
285
- t = i, r = 0, o = Z(t);
286
- else {
287
- if (t = t.parentNode, t == e.dom)
288
- break;
289
- r = o = 0;
290
- }
291
- }
292
- }
293
- l && ae(e, l, s);
294
- }
295
- function je(e) {
296
- let n = e.pmViewDesc;
297
- return n && n.node && n.node.isBlock;
298
- }
299
- function Ct(e, n) {
300
- for (; e && n == e.childNodes.length && !ue(e); )
301
- n = L(e) + 1, e = e.parentNode;
302
- for (; e && n < e.childNodes.length; ) {
303
- let t = e.childNodes[n];
304
- if (t.nodeType == 3)
305
- return t;
306
- if (t.nodeType == 1 && t.contentEditable == "false")
307
- break;
308
- e = t, n = 0;
309
- }
310
- }
311
- function St(e, n) {
312
- for (; e && !n && !ue(e); )
313
- n = L(e), e = e.parentNode;
314
- for (; e && n; ) {
315
- let t = e.childNodes[n - 1];
316
- if (t.nodeType == 3)
317
- return t;
318
- if (t.nodeType == 1 && t.contentEditable == "false")
319
- break;
320
- e = t, n = e.childNodes.length;
321
- }
322
- }
323
- function ae(e, n, t) {
324
- if (n.nodeType != 3) {
325
- let l, s;
326
- (s = Ct(n, t)) ? (n = s, t = 0) : (l = St(n, t)) && (n = l, t = l.nodeValue.length);
327
- }
328
- let r = e.domSelection();
329
- if (!r)
330
- return;
331
- if (ze(r)) {
332
- let l = document.createRange();
333
- l.setEnd(n, t), l.setStart(n, t), r.removeAllRanges(), r.addRange(l);
334
- } else r.extend && r.extend(n, t);
335
- e.domObserver.setCurSelection();
336
- let { state: o } = e;
337
- setTimeout(() => {
338
- e.state == o && he(e);
339
- }, 50);
340
- }
341
- function Oe(e, n) {
342
- let t = e.state.doc.resolve(n);
343
- if (!(I || ft) && t.parent.inlineContent) {
344
- let o = e.coordsAtPos(n);
345
- if (n > t.start()) {
346
- let l = e.coordsAtPos(n - 1), s = (l.top + l.bottom) / 2;
347
- if (s > o.top && s < o.bottom && Math.abs(l.left - o.left) > 1)
348
- return l.left < o.left ? "ltr" : "rtl";
349
- }
350
- if (n < t.end()) {
351
- let l = e.coordsAtPos(n + 1), s = (l.top + l.bottom) / 2;
352
- if (s > o.top && s < o.bottom && Math.abs(l.left - o.left) > 1)
353
- return l.left > o.left ? "ltr" : "rtl";
354
- }
355
- }
356
- return getComputedStyle(e.dom).direction == "rtl" ? "rtl" : "ltr";
357
- }
358
- function Ae(e, n, t) {
359
- let r = e.state.selection;
360
- if (r instanceof S && !r.empty || t.indexOf("s") > -1 || C && t.indexOf("m") > -1)
361
- return !1;
362
- let { $from: o, $to: l } = r;
363
- if (!o.parent.inlineContent || e.endOfTextblock(n < 0 ? "up" : "down")) {
364
- let s = ie(e.state, n);
365
- if (s && s instanceof m)
366
- return O(e, s);
367
- }
368
- if (!o.parent.inlineContent) {
369
- let s = n < 0 ? o : l, i = r instanceof lt ? G.near(s, n) : G.findFrom(s, n);
370
- return i ? O(e, i) : !1;
371
- }
372
- return !1;
373
- }
374
- function Me(e, n) {
375
- if (!(e.state.selection instanceof S))
376
- return !0;
377
- let { $head: t, $anchor: r, empty: o } = e.state.selection;
378
- if (!t.sameParent(r))
379
- return !0;
380
- if (!o)
381
- return !1;
382
- if (e.endOfTextblock(n > 0 ? "forward" : "backward"))
383
- return !0;
384
- let l = !t.textOffset && (n < 0 ? t.nodeBefore : t.nodeAfter);
385
- if (l && !l.isText) {
386
- let s = e.state.tr;
387
- return n < 0 ? s.delete(t.pos - l.nodeSize, t.pos) : s.delete(t.pos, t.pos + l.nodeSize), e.dispatch(s), !0;
388
- }
389
- return !1;
390
- }
391
- function Pe(e, n, t) {
392
- e.domObserver.stop(), n.contentEditable = t, e.domObserver.start();
393
- }
394
- function Dt(e) {
395
- if (!F || e.state.selection.$head.parentOffset > 0)
396
- return !1;
397
- let { focusNode: n, focusOffset: t } = e.domSelectionRange();
398
- if (n && n.nodeType == 1 && t == 0 && n.firstChild && n.firstChild.contentEditable == "false") {
399
- let r = n.firstChild;
400
- Pe(e, r, "true"), setTimeout(() => Pe(e, r, "false"), 20);
401
- }
402
- return !1;
403
- }
404
- function Nt(e) {
405
- let n = "";
406
- return e.ctrlKey && (n += "c"), e.metaKey && (n += "m"), e.altKey && (n += "a"), e.shiftKey && (n += "s"), n;
407
- }
408
- function Tt(e, n) {
409
- let t = n.keyCode, r = Nt(n);
410
- if (t == 8 || C && t == 72 && r == "c")
411
- return Me(e, -1) || B(e, -1);
412
- if (t == 46 && !n.shiftKey || C && t == 68 && r == "c")
413
- return Me(e, 1) || B(e, 1);
414
- if (t == 13 || t == 27)
415
- return !0;
416
- if (t == 37 || C && t == 66 && r == "c") {
417
- let o = t == 37 ? Oe(e, e.state.selection.from) == "ltr" ? -1 : 1 : -1;
418
- return Ee(e, o, r) || B(e, o);
419
- } else if (t == 39 || C && t == 70 && r == "c") {
420
- let o = t == 39 ? Oe(e, e.state.selection.from) == "ltr" ? 1 : -1 : 1;
421
- return Ee(e, o, r) || B(e, o);
422
- } else {
423
- if (t == 38 || C && t == 80 && r == "c")
424
- return Ae(e, -1, r) || B(e, -1);
425
- if (t == 40 || C && t == 78 && r == "c")
426
- return Dt(e) || Ae(e, 1, r) || B(e, 1);
427
- if (r == (C ? "m" : "c") && (t == 66 || t == 73 || t == 89 || t == 90))
428
- return !0;
429
- }
430
- return !1;
431
- }
432
- function Ue(e, n) {
433
- e.someProp("transformCopied", (p) => {
434
- n = p(n, e);
435
- });
436
- let t = [], { content: r, openStart: o, openEnd: l } = n;
437
- for (; o > 1 && l > 1 && r.childCount == 1 && r.firstChild.childCount == 1; ) {
438
- o--, l--;
439
- let p = r.firstChild;
440
- t.push(p.type.name, p.attrs != p.type.defaultAttrs ? p.attrs : null), r = p.content;
441
- }
442
- let s = e.someProp("clipboardSerializer") || Ve.fromSchema(e.state.schema), i = Ze(), a = i.createElement("div");
443
- a.appendChild(s.serializeFragment(r, { document: i }));
444
- let c = a.firstChild, f, u = 0;
445
- for (; c && c.nodeType == 1 && (f = Qe[c.nodeName.toLowerCase()]); ) {
446
- for (let p = f.length - 1; p >= 0; p--) {
447
- let h = i.createElement(f[p]);
448
- for (; a.firstChild; )
449
- h.appendChild(a.firstChild);
450
- a.appendChild(h), u++;
451
- }
452
- c = a.firstChild;
453
- }
454
- c && c.nodeType == 1 && c.setAttribute("data-pm-slice", `${o} ${l}${u ? ` -${u}` : ""} ${JSON.stringify(t)}`);
455
- let d = e.someProp("clipboardTextSerializer", (p) => p(n, e)) || n.content.textBetween(0, n.content.size, `
456
-
457
- `);
458
- return { dom: a, text: d, slice: n };
459
- }
460
- function Xe(e, n, t, r, o) {
461
- let l = o.parent.type.spec.code, s, i;
462
- if (!t && !n)
463
- return null;
464
- let a = n && (r || l || !t);
465
- if (a) {
466
- if (e.someProp("transformPastedText", (d) => {
467
- n = d(n, l || r, e);
468
- }), l)
469
- return n ? new M(z.from(e.state.schema.text(n.replace(/\r\n?/g, `
470
- `))), 0, 0) : M.empty;
471
- let u = e.someProp("clipboardTextParser", (d) => d(n, o, r, e));
472
- if (u)
473
- i = u;
474
- else {
475
- let d = o.marks(), { schema: p } = e.state, h = Ve.fromSchema(p);
476
- s = document.createElement("div"), n.split(/(?:\r\n?|\n)+/).forEach((E) => {
477
- let D = s.appendChild(document.createElement("p"));
478
- E && D.appendChild(h.serializeNode(p.text(E, d)));
479
- });
480
- }
481
- } else
482
- e.someProp("transformPastedHTML", (u) => {
483
- t = u(t, e);
484
- }), s = Ot(t), pe && At(s);
485
- let c = s && s.querySelector("[data-pm-slice]"), f = c && /^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice") || "");
486
- if (f && f[3])
487
- for (let u = +f[3]; u > 0; u--) {
488
- let d = s.firstChild;
489
- for (; d && d.nodeType != 1; )
490
- d = d.nextSibling;
491
- if (!d)
492
- break;
493
- s = d;
494
- }
495
- if (i || (i = (e.someProp("clipboardParser") || e.someProp("domParser") || st.fromSchema(e.state.schema)).parseSlice(s, {
496
- preserveWhitespace: !!(a || f),
497
- context: o,
498
- ruleFromNode(d) {
499
- return d.nodeName == "BR" && !d.nextSibling && d.parentNode && !kt.test(d.parentNode.nodeName) ? { ignore: !0 } : null;
500
- }
501
- })), f)
502
- i = Mt($e(i, +f[1], +f[2]), f[4]);
503
- else if (i = M.maxOpen(xt(i.content, o), !0), i.openStart || i.openEnd) {
504
- let u = 0, d = 0;
505
- for (let p = i.content.firstChild; u < i.openStart && !p.type.spec.isolating; u++, p = p.firstChild)
506
- ;
507
- for (let p = i.content.lastChild; d < i.openEnd && !p.type.spec.isolating; d++, p = p.lastChild)
508
- ;
509
- i = $e(i, u, d);
510
- }
511
- return e.someProp("transformPasted", (u) => {
512
- i = u(i, e);
513
- }), i;
514
- }
515
- const kt = /^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;
516
- function xt(e, n) {
517
- if (e.childCount < 2)
518
- return e;
519
- for (let t = n.depth; t >= 0; t--) {
520
- let o = n.node(t).contentMatchAt(n.index(t)), l, s = [];
521
- if (e.forEach((i) => {
522
- if (!s)
523
- return;
524
- let a = o.findWrapping(i.type), c;
525
- if (!a)
526
- return s = null;
527
- if (c = s.length && l.length && Je(a, l, i, s[s.length - 1], 0))
528
- s[s.length - 1] = c;
529
- else {
530
- s.length && (s[s.length - 1] = Ge(s[s.length - 1], l.length));
531
- let f = Ye(i, a);
532
- s.push(f), o = o.matchType(f.type), l = a;
533
- }
534
- }), s)
535
- return z.from(s);
536
- }
537
- return e;
538
- }
539
- function Ye(e, n, t = 0) {
540
- for (let r = n.length - 1; r >= t; r--)
541
- e = n[r].create(null, z.from(e));
542
- return e;
543
- }
544
- function Je(e, n, t, r, o) {
545
- if (o < e.length && o < n.length && e[o] == n[o]) {
546
- let l = Je(e, n, t, r.lastChild, o + 1);
547
- if (l)
548
- return r.copy(r.content.replaceChild(r.childCount - 1, l));
549
- if (r.contentMatchAt(r.childCount).matchType(o == e.length - 1 ? t.type : e[o + 1]))
550
- return r.copy(r.content.append(z.from(Ye(t, e, o + 1))));
551
- }
552
- }
553
- function Ge(e, n) {
554
- if (n == 0)
555
- return e;
556
- let t = e.content.replaceChild(e.childCount - 1, Ge(e.lastChild, n - 1)), r = e.contentMatchAt(e.childCount).fillBefore(z.empty, !0);
557
- return e.copy(t.append(r));
558
- }
559
- function ce(e, n, t, r, o, l) {
560
- let s = n < 0 ? e.firstChild : e.lastChild, i = s.content;
561
- return e.childCount > 1 && (l = 0), o < r - 1 && (i = ce(i, n, t, r, o + 1, l)), o >= t && (i = n < 0 ? s.contentMatchAt(0).fillBefore(i, l <= o).append(i) : i.append(s.contentMatchAt(s.childCount).fillBefore(z.empty, !0))), e.replaceChild(n < 0 ? 0 : e.childCount - 1, s.copy(i));
562
- }
563
- function $e(e, n, t) {
564
- return n < e.openStart && (e = new M(ce(e.content, -1, n, e.openStart, 0, e.openEnd), n, e.openEnd)), t < e.openEnd && (e = new M(ce(e.content, 1, t, e.openEnd, 0, 0), e.openStart, t)), e;
565
- }
566
- const Qe = {
567
- thead: ["table"],
568
- tbody: ["table"],
569
- tfoot: ["table"],
570
- caption: ["table"],
571
- colgroup: ["table"],
572
- col: ["table", "colgroup"],
573
- tr: ["table", "tbody"],
574
- td: ["table", "tbody", "tr"],
575
- th: ["table", "tbody", "tr"]
576
- };
577
- let Ie = null;
578
- function Ze() {
579
- return Ie || (Ie = document.implementation.createHTMLDocument("title"));
580
- }
581
- let re = null;
582
- function Et(e) {
583
- let n = window.trustedTypes;
584
- return n ? (re || (re = n.defaultPolicy || n.createPolicy("ProseMirrorClipboard", { createHTML: (t) => t })), re.createHTML(e)) : e;
585
- }
586
- function Ot(e) {
587
- let n = /^(\s*<meta [^>]*>)*/.exec(e);
588
- n && (e = e.slice(n[0].length));
589
- let t = Ze().createElement("div"), r = /<([a-z][^>\s]+)/i.exec(e), o;
590
- if ((o = r && Qe[r[1].toLowerCase()]) && (e = o.map((l) => "<" + l + ">").join("") + e + o.map((l) => "</" + l + ">").reverse().join("")), t.innerHTML = Et(e), o)
591
- for (let l = 0; l < o.length; l++)
592
- t = t.querySelector(o[l]) || t;
593
- return t;
594
- }
595
- function At(e) {
596
- let n = e.querySelectorAll(I ? "span:not([class]):not([style])" : "span.Apple-converted-space");
597
- for (let t = 0; t < n.length; t++) {
598
- let r = n[t];
599
- r.childNodes.length == 1 && r.textContent == " " && r.parentNode && r.parentNode.replaceChild(e.ownerDocument.createTextNode(" "), r);
600
- }
601
- }
602
- function Mt(e, n) {
603
- if (!e.size)
604
- return e;
605
- let t = e.content.firstChild.type.schema, r;
606
- try {
607
- r = JSON.parse(n);
608
- } catch {
609
- return e;
610
- }
611
- let { content: o, openStart: l, openEnd: s } = e;
612
- for (let i = r.length - 2; i >= 0; i -= 2) {
613
- let a = t.nodes[r[i]];
614
- if (!a || a.hasRequiredAttrs())
615
- break;
616
- o = z.from(a.create(r[i + 1], o)), l++, s++;
617
- }
618
- return new M(o, l, s);
619
- }
620
- const T = {}, y = {};
621
- function A(e, n) {
622
- e.input.lastSelectionOrigin = n, e.input.lastSelectionTime = Date.now();
623
- }
624
- y.keydown = (e, n) => {
625
- let t = n;
626
- if (e.input.shiftKey = t.keyCode == 16 || t.shiftKey, !ve(e, t) && (e.input.lastKeyCode = t.keyCode, e.input.lastKeyCodeTime = Date.now(), !(Y && I && t.keyCode == 13)))
627
- if (t.keyCode != 229 && e.domObserver.forceFlush(), de && t.keyCode == 13 && !t.ctrlKey && !t.altKey && !t.metaKey) {
628
- let r = Date.now();
629
- e.input.lastIOSEnter = r, e.input.lastIOSEnterFallbackTimeout = setTimeout(() => {
630
- e.input.lastIOSEnter == r && (e.someProp("handleKeyDown", (o) => o(e, Le(13, "Enter"))), e.input.lastIOSEnter = 0);
631
- }, 200);
632
- } else e.someProp("handleKeyDown", (r) => r(e, t)) || Tt(e, t) ? t.preventDefault() : A(e, "key");
633
- };
634
- y.keyup = (e, n) => {
635
- n.keyCode == 16 && (e.input.shiftKey = !1);
636
- };
637
- y.keypress = (e, n) => {
638
- let t = n;
639
- if (ve(e, t) || !t.charCode || t.ctrlKey && !t.altKey || C && t.metaKey)
640
- return;
641
- if (e.someProp("handleKeyPress", (o) => o(e, t))) {
642
- t.preventDefault();
643
- return;
644
- }
645
- let r = e.state.selection;
646
- if (!(r instanceof S) || !r.$from.sameParent(r.$to)) {
647
- let o = String.fromCharCode(t.charCode), l = () => e.state.tr.insertText(o).scrollIntoView();
648
- !/[\r\n]/.test(o) && !e.someProp("handleTextInput", (s) => s(e, r.$from.pos, r.$to.pos, o, l)) && e.dispatch(l()), t.preventDefault();
649
- }
650
- };
651
- function te(e) {
652
- return { left: e.clientX, top: e.clientY };
653
- }
654
- function Pt(e, n) {
655
- let t = n.x - e.clientX, r = n.y - e.clientY;
656
- return t * t + r * r < 100;
657
- }
658
- function me(e, n, t, r, o) {
659
- if (r == -1)
660
- return !1;
661
- let l = e.state.doc.resolve(r);
662
- for (let s = l.depth + 1; s > 0; s--)
663
- if (e.someProp(n, (i) => s > l.depth ? i(e, t, l.nodeAfter, l.before(s), o, !0) : i(e, t, l.node(s), l.before(s), o, !1)))
664
- return !0;
665
- return !1;
666
- }
667
- function H(e, n, t) {
668
- if (e.focused || e.focus(), e.state.selection.eq(n))
669
- return;
670
- let r = e.state.tr.setSelection(n);
671
- r.setMeta("pointer", !0), e.dispatch(r);
672
- }
673
- function $t(e, n) {
674
- if (n == -1)
675
- return !1;
676
- let t = e.state.doc.resolve(n), r = t.nodeAfter;
677
- return r && r.isAtom && m.isSelectable(r) ? (H(e, new m(t)), !0) : !1;
678
- }
679
- function It(e, n) {
680
- if (n == -1)
681
- return !1;
682
- let t = e.state.selection, r, o;
683
- t instanceof m && (r = t.node);
684
- let l = e.state.doc.resolve(n);
685
- for (let s = l.depth + 1; s > 0; s--) {
686
- let i = s > l.depth ? l.nodeAfter : l.node(s);
687
- if (m.isSelectable(i)) {
688
- r && t.$from.depth > 0 && s >= t.$from.depth && l.before(t.$from.depth + 1) == t.$from.pos ? o = l.before(t.$from.depth) : o = l.before(s);
689
- break;
690
- }
691
- }
692
- return o != null ? (H(e, m.create(e.state.doc, o)), !0) : !1;
693
- }
694
- function Rt(e, n, t, r, o) {
695
- return me(e, "handleClickOn", n, t, r) || e.someProp("handleClick", (l) => l(e, n, r)) || (o ? It(e, t) : $t(e, t));
696
- }
697
- function Vt(e, n, t, r) {
698
- return me(e, "handleDoubleClickOn", n, t, r) || e.someProp("handleDoubleClick", (o) => o(e, n, r));
699
- }
700
- function Kt(e, n, t, r) {
701
- return me(e, "handleTripleClickOn", n, t, r) || e.someProp("handleTripleClick", (o) => o(e, n, r)) || zt(e, t, r);
702
- }
703
- function zt(e, n, t) {
704
- if (t.button != 0)
705
- return !1;
706
- let r = e.state.doc;
707
- if (n == -1)
708
- return r.inlineContent ? (H(e, S.create(r, 0, r.content.size)), !0) : !1;
709
- let o = r.resolve(n);
710
- for (let l = o.depth + 1; l > 0; l--) {
711
- let s = l > o.depth ? o.nodeAfter : o.node(l), i = o.before(l);
712
- if (s.inlineContent)
713
- H(e, S.create(r, i + 1, i + 1 + s.content.size));
714
- else if (m.isSelectable(s))
715
- H(e, m.create(r, i));
716
- else
717
- continue;
718
- return !0;
719
- }
720
- }
721
- function ge(e) {
722
- return _(e);
723
- }
724
- const _e = C ? "metaKey" : "ctrlKey";
725
- T.mousedown = (e, n) => {
726
- let t = n;
727
- e.input.shiftKey = t.shiftKey;
728
- let r = ge(e), o = Date.now(), l = "singleClick";
729
- o - e.input.lastClick.time < 500 && Pt(t, e.input.lastClick) && !t[_e] && e.input.lastClick.button == t.button && (e.input.lastClick.type == "singleClick" ? l = "doubleClick" : e.input.lastClick.type == "doubleClick" && (l = "tripleClick")), e.input.lastClick = { time: o, x: t.clientX, y: t.clientY, type: l, button: t.button };
730
- let s = e.posAtCoords(te(t));
731
- s && (l == "singleClick" ? (e.input.mouseDown && e.input.mouseDown.done(), e.input.mouseDown = new Lt(e, s, t, !!r)) : (l == "doubleClick" ? Vt : Kt)(e, s.pos, s.inside, t) ? t.preventDefault() : A(e, "pointer"));
732
- };
733
- class Lt {
734
- constructor(n, t, r, o) {
735
- this.view = n, this.pos = t, this.event = r, this.flushed = o, this.delayedSelectionSync = !1, this.mightDrag = null, this.startDoc = n.state.doc, this.selectNode = !!r[_e], this.allowDefault = r.shiftKey;
736
- let l, s;
737
- if (t.inside > -1)
738
- l = n.state.doc.nodeAt(t.inside), s = t.inside;
739
- else {
740
- let f = n.state.doc.resolve(t.pos);
741
- l = f.parent, s = f.depth ? f.before() : 0;
742
- }
743
- const i = o ? null : r.target, a = i ? n.docView.nearestDesc(i, !0) : null;
744
- this.target = a && a.dom.nodeType == 1 ? a.dom : null;
745
- let { selection: c } = n.state;
746
- (r.button == 0 && l.type.spec.draggable && l.type.spec.selectable !== !1 || c instanceof m && c.from <= s && c.to > s) && (this.mightDrag = {
747
- node: l,
748
- pos: s,
749
- addAttr: !!(this.target && !this.target.draggable),
750
- setUneditable: !!(this.target && ee && !this.target.hasAttribute("contentEditable"))
751
- }), this.target && this.mightDrag && (this.mightDrag.addAttr || this.mightDrag.setUneditable) && (this.view.domObserver.stop(), this.mightDrag.addAttr && (this.target.draggable = !0), this.mightDrag.setUneditable && setTimeout(() => {
752
- this.view.input.mouseDown == this && this.target.setAttribute("contentEditable", "false");
753
- }, 20), this.view.domObserver.start()), n.root.addEventListener("mouseup", this.up = this.up.bind(this)), n.root.addEventListener("mousemove", this.move = this.move.bind(this)), A(n, "pointer");
754
- }
755
- done() {
756
- this.view.root.removeEventListener("mouseup", this.up), this.view.root.removeEventListener("mousemove", this.move), this.mightDrag && this.target && (this.view.domObserver.stop(), this.mightDrag.addAttr && this.target.removeAttribute("draggable"), this.mightDrag.setUneditable && this.target.removeAttribute("contentEditable"), this.view.domObserver.start()), this.delayedSelectionSync && setTimeout(() => he(this.view)), this.view.input.mouseDown = null;
757
- }
758
- up(n) {
759
- if (this.done(), !this.view.dom.contains(n.target))
760
- return;
761
- let t = this.pos;
762
- this.view.state.doc != this.startDoc && (t = this.view.posAtCoords(te(n))), this.updateAllowDefault(n), this.allowDefault || !t ? A(this.view, "pointer") : Rt(this.view, t.pos, t.inside, n, this.selectNode) ? n.preventDefault() : n.button == 0 && (this.flushed || // Safari ignores clicks on draggable elements
763
- F && this.mightDrag && !this.mightDrag.node.isAtom || // Chrome will sometimes treat a node selection as a
764
- // cursor, but still report that the node is selected
765
- // when asked through getSelection. You'll then get a
766
- // situation where clicking at the point where that
767
- // (hidden) cursor is doesn't change the selection, and
768
- // thus doesn't get a reaction from ProseMirror. This
769
- // works around that.
770
- I && !this.view.state.selection.visible && Math.min(Math.abs(t.pos - this.view.state.selection.from), Math.abs(t.pos - this.view.state.selection.to)) <= 2) ? (H(this.view, G.near(this.view.state.doc.resolve(t.pos))), n.preventDefault()) : A(this.view, "pointer");
771
- }
772
- move(n) {
773
- this.updateAllowDefault(n), A(this.view, "pointer"), n.buttons == 0 && this.done();
774
- }
775
- updateAllowDefault(n) {
776
- !this.allowDefault && (Math.abs(this.event.x - n.clientX) > 4 || Math.abs(this.event.y - n.clientY) > 4) && (this.allowDefault = !0);
777
- }
778
- }
779
- T.touchstart = (e) => {
780
- e.input.lastTouch = Date.now(), ge(e), A(e, "pointer");
781
- };
782
- T.touchmove = (e) => {
783
- e.input.lastTouch = Date.now(), A(e, "pointer");
784
- };
785
- T.contextmenu = (e) => ge(e);
786
- function ve(e, n) {
787
- return e.composing ? !0 : F && Math.abs(n.timeStamp - e.input.compositionEndedAt) < 500 ? (e.input.compositionEndedAt = -2e8, !0) : !1;
788
- }
789
- const Ft = Y ? 5e3 : -1;
790
- y.compositionstart = y.compositionupdate = (e) => {
791
- if (!e.composing) {
792
- e.domObserver.flush();
793
- let { state: n } = e, t = n.selection.$to;
794
- if (n.selection instanceof S && (n.storedMarks || !t.textOffset && t.parentOffset && t.nodeBefore.marks.some((r) => r.type.spec.inclusive === !1)))
795
- e.markCursor = e.state.storedMarks || t.marks(), _(e, !0), e.markCursor = null;
796
- else if (_(e, !n.selection.empty), ee && n.selection.empty && t.parentOffset && !t.textOffset && t.nodeBefore.marks.length) {
797
- let r = e.domSelectionRange();
798
- for (let o = r.focusNode, l = r.focusOffset; o && o.nodeType == 1 && l != 0; ) {
799
- let s = l < 0 ? o.lastChild : o.childNodes[l - 1];
800
- if (!s)
801
- break;
802
- if (s.nodeType == 3) {
803
- let i = e.domSelection();
804
- i && i.collapse(s, s.nodeValue.length);
805
- break;
806
- } else
807
- o = s, l = -1;
808
- }
809
- }
810
- e.input.composing = !0;
811
- }
812
- we(e, Ft);
813
- };
814
- y.compositionend = (e, n) => {
815
- e.composing && (e.input.composing = !1, e.input.compositionEndedAt = n.timeStamp, e.input.compositionPendingChanges = e.domObserver.pendingRecords().length ? e.input.compositionID : 0, e.input.compositionNode = null, e.input.compositionPendingChanges && Promise.resolve().then(() => e.domObserver.flush()), e.input.compositionID++, we(e, 20));
816
- };
817
- function we(e, n) {
818
- clearTimeout(e.input.composingTimeout), n > -1 && (e.input.composingTimeout = setTimeout(() => _(e), n));
819
- }
820
- function Bt(e) {
821
- for (e.composing && (e.input.composing = !1, e.input.compositionEndedAt = qt()); e.input.compositionNodes.length > 0; )
822
- e.input.compositionNodes.pop().markParentsDirty();
823
- }
824
- function qt() {
825
- let e = document.createEvent("Event");
826
- return e.initEvent("event", !0, !0), e.timeStamp;
827
- }
828
- function _(e, n = !1) {
829
- if (!(Y && e.domObserver.flushingSoon >= 0)) {
830
- if (e.domObserver.forceFlush(), Bt(e), n || e.docView && e.docView.dirty) {
831
- let t = dt(e), r = e.state.selection;
832
- return t && !t.eq(r) ? e.dispatch(e.state.tr.setSelection(t)) : (e.markCursor || n) && !r.$from.node(r.$from.sharedDepth(r.to)).inlineContent ? e.dispatch(e.state.tr.deleteSelection()) : e.updateState(e.state), !0;
833
- }
834
- return !1;
835
- }
836
- }
837
- function Ht(e, n) {
838
- if (!e.dom.parentNode)
839
- return;
840
- let t = e.dom.parentNode.appendChild(document.createElement("div"));
841
- t.appendChild(n), t.style.cssText = "position: fixed; left: -10000px; top: 10px";
842
- let r = getSelection(), o = document.createRange();
843
- o.selectNodeContents(n), e.dom.blur(), r.removeAllRanges(), r.addRange(o), setTimeout(() => {
844
- t.parentNode && t.parentNode.removeChild(t), e.focus();
845
- }, 50);
846
- }
847
- const j = X && Be < 15 || de && ut < 604;
848
- T.copy = y.cut = (e, n) => {
849
- let t = n, r = e.state.selection, o = t.type == "cut";
850
- if (r.empty)
851
- return;
852
- let l = j ? null : t.clipboardData, s = r.content(), { dom: i, text: a } = Ue(e, s);
853
- l ? (t.preventDefault(), l.clearData(), l.setData("text/html", i.innerHTML), l.setData("text/plain", a)) : Ht(e, i), o && e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent", "cut"));
854
- };
855
- function Wt(e) {
856
- return e.openStart == 0 && e.openEnd == 0 && e.content.childCount == 1 ? e.content.firstChild : null;
857
- }
858
- function jt(e, n) {
859
- if (!e.dom.parentNode)
860
- return;
861
- let t = e.input.shiftKey || e.state.selection.$from.parent.type.spec.code, r = e.dom.parentNode.appendChild(document.createElement(t ? "textarea" : "div"));
862
- t || (r.contentEditable = "true"), r.style.cssText = "position: fixed; left: -10000px; top: 10px", r.focus();
863
- let o = e.input.shiftKey && e.input.lastKeyCode != 45;
864
- setTimeout(() => {
865
- e.focus(), r.parentNode && r.parentNode.removeChild(r), t ? fe(e, r.value, null, o, n) : fe(e, r.textContent, r.innerHTML, o, n);
866
- }, 50);
867
- }
868
- function fe(e, n, t, r, o) {
869
- let l = Xe(e, n, t, r, e.state.selection.$from);
870
- if (e.someProp("handlePaste", (a) => a(e, o, l || M.empty)))
871
- return !0;
872
- if (!l)
873
- return !1;
874
- let s = Wt(l), i = s ? e.state.tr.replaceSelectionWith(s, r) : e.state.tr.replaceSelection(l);
875
- return e.dispatch(i.scrollIntoView().setMeta("paste", !0).setMeta("uiEvent", "paste")), !0;
876
- }
877
- function et(e) {
878
- let n = e.getData("text/plain") || e.getData("Text");
879
- if (n)
880
- return n;
881
- let t = e.getData("text/uri-list");
882
- return t ? t.replace(/\r?\n/g, " ") : "";
883
- }
884
- y.paste = (e, n) => {
885
- let t = n;
886
- if (e.composing && !Y)
887
- return;
888
- let r = j ? null : t.clipboardData, o = e.input.shiftKey && e.input.lastKeyCode != 45;
889
- r && fe(e, et(r), r.getData("text/html"), o, t) ? t.preventDefault() : jt(e, t);
890
- };
891
- class Ut {
892
- constructor(n, t, r) {
893
- this.slice = n, this.move = t, this.node = r;
894
- }
895
- }
896
- const Xt = C ? "altKey" : "ctrlKey";
897
- function tt(e, n) {
898
- let t = e.someProp("dragCopies", (r) => !r(n));
899
- return t ?? !n[Xt];
900
- }
901
- T.dragstart = (e, n) => {
902
- let t = n, r = e.input.mouseDown;
903
- if (r && r.done(), !t.dataTransfer)
904
- return;
905
- let o = e.state.selection, l = o.empty ? null : e.posAtCoords(te(t)), s;
906
- if (!(l && l.pos >= o.from && l.pos <= (o instanceof m ? o.to - 1 : o.to))) {
907
- if (r && r.mightDrag)
908
- s = m.create(e.state.doc, r.mightDrag.pos);
909
- else if (t.target && t.target.nodeType == 1) {
910
- let u = e.docView.nearestDesc(t.target, !0);
911
- u && u.node.type.spec.draggable && u != e.docView && (s = m.create(e.state.doc, u.posBefore));
912
- }
913
- }
914
- let i = (s || e.state.selection).content(), { dom: a, text: c, slice: f } = Ue(e, i);
915
- (!t.dataTransfer.files.length || !I || qe > 120) && t.dataTransfer.clearData(), t.dataTransfer.setData(j ? "Text" : "text/html", a.innerHTML), t.dataTransfer.effectAllowed = "copyMove", j || t.dataTransfer.setData("text/plain", c), e.dragging = new Ut(f, tt(e, t), s);
916
- };
917
- T.dragend = (e) => {
918
- let n = e.dragging;
919
- window.setTimeout(() => {
920
- e.dragging == n && (e.dragging = null);
921
- }, 50);
922
- };
923
- y.dragover = y.dragenter = (e, n) => n.preventDefault();
924
- y.drop = (e, n) => {
925
- let t = n, r = e.dragging;
926
- if (e.dragging = null, !t.dataTransfer)
927
- return;
928
- let o = e.posAtCoords(te(t));
929
- if (!o)
930
- return;
931
- let l = e.state.doc.resolve(o.pos), s = r && r.slice;
932
- s ? e.someProp("transformPasted", (h) => {
933
- s = h(s, e);
934
- }) : s = Xe(e, et(t.dataTransfer), j ? null : t.dataTransfer.getData("text/html"), !1, l);
935
- let i = !!(r && tt(e, t));
936
- if (e.someProp("handleDrop", (h) => h(e, t, s || M.empty, i))) {
937
- t.preventDefault();
938
- return;
939
- }
940
- if (!s)
941
- return;
942
- t.preventDefault();
943
- let a = s ? it(e.state.doc, l.pos, s) : l.pos;
944
- a == null && (a = l.pos);
945
- let c = e.state.tr;
946
- if (i) {
947
- let { node: h } = r;
948
- h ? h.replace(c) : c.deleteSelection();
949
- }
950
- let f = c.mapping.map(a), u = s.openStart == 0 && s.openEnd == 0 && s.content.childCount == 1, d = c.doc;
951
- if (u ? c.replaceRangeWith(f, f, s.content.firstChild) : c.replaceRange(f, f, s), c.doc.eq(d))
952
- return;
953
- let p = c.doc.resolve(f);
954
- if (u && m.isSelectable(s.content.firstChild) && p.nodeAfter && p.nodeAfter.sameMarkup(s.content.firstChild))
955
- c.setSelection(new m(p));
956
- else {
957
- let h = c.mapping.map(a);
958
- c.mapping.maps[c.mapping.maps.length - 1].forEach((E, D, N, J) => h = J), c.setSelection(We(e, p, c.doc.resolve(h)));
959
- }
960
- e.focus(), e.dispatch(c.setMeta("uiEvent", "drop"));
961
- };
962
- T.focus = (e) => {
963
- e.input.lastFocus = Date.now(), e.focused || (e.domObserver.stop(), e.dom.classList.add("ProseMirror-focused"), e.domObserver.start(), e.focused = !0, setTimeout(() => {
964
- e.docView && e.hasFocus() && !e.domObserver.currentSelection.eq(e.domSelectionRange()) && he(e);
965
- }, 20));
966
- };
967
- T.blur = (e, n) => {
968
- let t = n;
969
- e.focused && (e.domObserver.stop(), e.dom.classList.remove("ProseMirror-focused"), e.domObserver.start(), t.relatedTarget && e.dom.contains(t.relatedTarget) && e.domObserver.currentSelection.clear(), e.focused = !1);
970
- };
971
- T.beforeinput = (e, n) => {
972
- if (I && Y && n.inputType == "deleteContentBackward") {
973
- e.domObserver.flushSoon();
974
- let { domChangeCount: r } = e.input;
975
- setTimeout(() => {
976
- if (e.input.domChangeCount != r || (e.dom.blur(), e.focus(), e.someProp("handleKeyDown", (l) => l(e, Le(8, "Backspace")))))
977
- return;
978
- let { $cursor: o } = e.state.selection;
979
- o && o.pos > 0 && e.dispatch(e.state.tr.delete(o.pos - 1, o.pos).scrollIntoView());
980
- }, 50);
981
- }
982
- };
983
- for (let e in y)
984
- T[e] = y[e];
985
- function U(e, n) {
986
- if (e == n)
987
- return !0;
988
- for (let t in e)
989
- if (e[t] !== n[t])
990
- return !1;
991
- for (let t in n)
992
- if (!(t in e))
993
- return !1;
994
- return !0;
995
- }
996
- class v {
997
- constructor(n, t) {
998
- this.toDOM = n, this.spec = t || V, this.side = this.spec.side || 0;
999
- }
1000
- map(n, t, r, o) {
1001
- let { pos: l, deleted: s } = n.mapResult(t.from + o, this.side < 0 ? -1 : 1);
1002
- return s ? null : new x(l - r, l - r, this);
1003
- }
1004
- valid() {
1005
- return !0;
1006
- }
1007
- eq(n) {
1008
- return this == n || n instanceof v && (this.spec.key && this.spec.key == n.spec.key || this.toDOM == n.toDOM && U(this.spec, n.spec));
1009
- }
1010
- destroy(n) {
1011
- this.spec.destroy && this.spec.destroy(n);
1012
- }
1013
- }
1014
- class P {
1015
- constructor(n, t) {
1016
- this.attrs = n, this.spec = t || V;
1017
- }
1018
- map(n, t, r, o) {
1019
- let l = n.map(t.from + o, this.spec.inclusiveStart ? -1 : 1) - r, s = n.map(t.to + o, this.spec.inclusiveEnd ? 1 : -1) - r;
1020
- return l >= s ? null : new x(l, s, this);
1021
- }
1022
- valid(n, t) {
1023
- return t.from < t.to;
1024
- }
1025
- eq(n) {
1026
- return this == n || n instanceof P && U(this.attrs, n.attrs) && U(this.spec, n.spec);
1027
- }
1028
- static is(n) {
1029
- return n.type instanceof P;
1030
- }
1031
- destroy() {
1032
- }
1033
- }
1034
- class be {
1035
- constructor(n, t) {
1036
- this.attrs = n, this.spec = t || V;
1037
- }
1038
- map(n, t, r, o) {
1039
- let l = n.mapResult(t.from + o, 1);
1040
- if (l.deleted)
1041
- return null;
1042
- let s = n.mapResult(t.to + o, -1);
1043
- return s.deleted || s.pos <= l.pos ? null : new x(l.pos - r, s.pos - r, this);
1044
- }
1045
- valid(n, t) {
1046
- let { index: r, offset: o } = n.content.findIndex(t.from), l;
1047
- return o == t.from && !(l = n.child(r)).isText && o + l.nodeSize == t.to;
1048
- }
1049
- eq(n) {
1050
- return this == n || n instanceof be && U(this.attrs, n.attrs) && U(this.spec, n.spec);
1051
- }
1052
- destroy() {
1053
- }
1054
- }
1055
- class x {
1056
- /**
1057
- @internal
1058
- */
1059
- constructor(n, t, r) {
1060
- this.from = n, this.to = t, this.type = r;
1061
- }
1062
- /**
1063
- @internal
1064
- */
1065
- copy(n, t) {
1066
- return new x(n, t, this.type);
1067
- }
1068
- /**
1069
- @internal
1070
- */
1071
- eq(n, t = 0) {
1072
- return this.type.eq(n.type) && this.from + t == n.from && this.to + t == n.to;
1073
- }
1074
- /**
1075
- @internal
1076
- */
1077
- map(n, t, r) {
1078
- return this.type.map(n, this, t, r);
1079
- }
1080
- /**
1081
- Creates a widget decoration, which is a DOM node that's shown in
1082
- the document at the given position. It is recommended that you
1083
- delay rendering the widget by passing a function that will be
1084
- called when the widget is actually drawn in a view, but you can
1085
- also directly pass a DOM node. `getPos` can be used to find the
1086
- widget's current document position.
1087
- */
1088
- static widget(n, t, r) {
1089
- return new x(n, n, new v(t, r));
1090
- }
1091
- /**
1092
- Creates an inline decoration, which adds the given attributes to
1093
- each inline node between `from` and `to`.
1094
- */
1095
- static inline(n, t, r, o) {
1096
- return new x(n, t, new P(r, o));
1097
- }
1098
- /**
1099
- Creates a node decoration. `from` and `to` should point precisely
1100
- before and after a node in the document. That node, and only that
1101
- node, will receive the given attributes.
1102
- */
1103
- static node(n, t, r, o) {
1104
- return new x(n, t, new be(r, o));
1105
- }
1106
- /**
1107
- The spec provided when creating this decoration. Can be useful
1108
- if you've stored extra information in that object.
1109
- */
1110
- get spec() {
1111
- return this.type.spec;
1112
- }
1113
- /**
1114
- @internal
1115
- */
1116
- get inline() {
1117
- return this.type instanceof P;
1118
- }
1119
- /**
1120
- @internal
1121
- */
1122
- get widget() {
1123
- return this.type instanceof v;
1124
- }
1125
- }
1126
- const q = [], V = {};
1127
- class g {
1128
- /**
1129
- @internal
1130
- */
1131
- constructor(n, t) {
1132
- this.local = n.length ? n : q, this.children = t.length ? t : q;
1133
- }
1134
- /**
1135
- Create a set of decorations, using the structure of the given
1136
- document. This will consume (modify) the `decorations` array, so
1137
- you must make a copy if you want need to preserve that.
1138
- */
1139
- static create(n, t) {
1140
- return t.length ? w(t, n, 0, V) : b;
1141
- }
1142
- /**
1143
- Find all decorations in this set which touch the given range
1144
- (including decorations that start or end directly at the
1145
- boundaries) and match the given predicate on their spec. When
1146
- `start` and `end` are omitted, all decorations in the set are
1147
- considered. When `predicate` isn't given, all decorations are
1148
- assumed to match.
1149
- */
1150
- find(n, t, r) {
1151
- let o = [];
1152
- return this.findInner(n ?? 0, t ?? 1e9, o, 0, r), o;
1153
- }
1154
- findInner(n, t, r, o, l) {
1155
- for (let s = 0; s < this.local.length; s++) {
1156
- let i = this.local[s];
1157
- i.from <= t && i.to >= n && (!l || l(i.spec)) && r.push(i.copy(i.from + o, i.to + o));
1158
- }
1159
- for (let s = 0; s < this.children.length; s += 3)
1160
- if (this.children[s] < t && this.children[s + 1] > n) {
1161
- let i = this.children[s] + 1;
1162
- this.children[s + 2].findInner(n - i, t - i, r, o + i, l);
1163
- }
1164
- }
1165
- /**
1166
- Map the set of decorations in response to a change in the
1167
- document.
1168
- */
1169
- map(n, t, r) {
1170
- return this == b || n.maps.length == 0 ? this : this.mapInner(n, t, 0, 0, r || V);
1171
- }
1172
- /**
1173
- @internal
1174
- */
1175
- mapInner(n, t, r, o, l) {
1176
- let s;
1177
- for (let i = 0; i < this.local.length; i++) {
1178
- let a = this.local[i].map(n, r, o);
1179
- a && a.type.valid(t, a) ? (s || (s = [])).push(a) : l.onRemove && l.onRemove(this.local[i].spec);
1180
- }
1181
- return this.children.length ? Yt(this.children, s || [], n, t, r, o, l) : s ? new g(s.sort(K), q) : b;
1182
- }
1183
- /**
1184
- Add the given array of decorations to the ones in the set,
1185
- producing a new set. Consumes the `decorations` array. Needs
1186
- access to the current document to create the appropriate tree
1187
- structure.
1188
- */
1189
- add(n, t) {
1190
- return t.length ? this == b ? g.create(n, t) : this.addInner(n, t, 0) : this;
1191
- }
1192
- addInner(n, t, r) {
1193
- let o, l = 0;
1194
- n.forEach((i, a) => {
1195
- let c = a + r, f;
1196
- if (f = rt(t, i, c)) {
1197
- for (o || (o = this.children.slice()); l < o.length && o[l] < a; )
1198
- l += 3;
1199
- o[l] == a ? o[l + 2] = o[l + 2].addInner(i, f, c + 1) : o.splice(l, 0, a, a + i.nodeSize, w(f, i, c + 1, V)), l += 3;
1200
- }
1201
- });
1202
- let s = nt(l ? ot(t) : t, -r);
1203
- for (let i = 0; i < s.length; i++)
1204
- s[i].type.valid(n, s[i]) || s.splice(i--, 1);
1205
- return new g(s.length ? this.local.concat(s).sort(K) : this.local, o || this.children);
1206
- }
1207
- /**
1208
- Create a new set that contains the decorations in this set, minus
1209
- the ones in the given array.
1210
- */
1211
- remove(n) {
1212
- return n.length == 0 || this == b ? this : this.removeInner(n, 0);
1213
- }
1214
- removeInner(n, t) {
1215
- let r = this.children, o = this.local;
1216
- for (let l = 0; l < r.length; l += 3) {
1217
- let s, i = r[l] + t, a = r[l + 1] + t;
1218
- for (let f = 0, u; f < n.length; f++)
1219
- (u = n[f]) && u.from > i && u.to < a && (n[f] = null, (s || (s = [])).push(u));
1220
- if (!s)
1221
- continue;
1222
- r == this.children && (r = this.children.slice());
1223
- let c = r[l + 2].removeInner(s, i + 1);
1224
- c != b ? r[l + 2] = c : (r.splice(l, 3), l -= 3);
1225
- }
1226
- if (o.length) {
1227
- for (let l = 0, s; l < n.length; l++)
1228
- if (s = n[l])
1229
- for (let i = 0; i < o.length; i++)
1230
- o[i].eq(s, t) && (o == this.local && (o = this.local.slice()), o.splice(i--, 1));
1231
- }
1232
- return r == this.children && o == this.local ? this : o.length || r.length ? new g(o, r) : b;
1233
- }
1234
- forChild(n, t) {
1235
- if (this == b)
1236
- return this;
1237
- if (t.isLeaf)
1238
- return g.empty;
1239
- let r, o;
1240
- for (let i = 0; i < this.children.length; i += 3)
1241
- if (this.children[i] >= n) {
1242
- this.children[i] == n && (r = this.children[i + 2]);
1243
- break;
1244
- }
1245
- let l = n + 1, s = l + t.content.size;
1246
- for (let i = 0; i < this.local.length; i++) {
1247
- let a = this.local[i];
1248
- if (a.from < s && a.to > l && a.type instanceof P) {
1249
- let c = Math.max(l, a.from) - l, f = Math.min(s, a.to) - l;
1250
- c < f && (o || (o = [])).push(a.copy(c, f));
1251
- }
1252
- }
1253
- if (o) {
1254
- let i = new g(o.sort(K), q);
1255
- return r ? new R([i, r]) : i;
1256
- }
1257
- return r || b;
1258
- }
1259
- /**
1260
- @internal
1261
- */
1262
- eq(n) {
1263
- if (this == n)
1264
- return !0;
1265
- if (!(n instanceof g) || this.local.length != n.local.length || this.children.length != n.children.length)
1266
- return !1;
1267
- for (let t = 0; t < this.local.length; t++)
1268
- if (!this.local[t].eq(n.local[t]))
1269
- return !1;
1270
- for (let t = 0; t < this.children.length; t += 3)
1271
- if (this.children[t] != n.children[t] || this.children[t + 1] != n.children[t + 1] || !this.children[t + 2].eq(n.children[t + 2]))
1272
- return !1;
1273
- return !0;
1274
- }
1275
- /**
1276
- @internal
1277
- */
1278
- locals(n) {
1279
- return ye(this.localsInner(n));
1280
- }
1281
- /**
1282
- @internal
1283
- */
1284
- localsInner(n) {
1285
- if (this == b)
1286
- return q;
1287
- if (n.inlineContent || !this.local.some(P.is))
1288
- return this.local;
1289
- let t = [];
1290
- for (let r = 0; r < this.local.length; r++)
1291
- this.local[r].type instanceof P || t.push(this.local[r]);
1292
- return t;
1293
- }
1294
- forEachSet(n) {
1295
- n(this);
1296
- }
1297
- }
1298
- g.empty = new g([], []);
1299
- g.removeOverlap = ye;
1300
- const b = g.empty;
1301
- class R {
1302
- constructor(n) {
1303
- this.members = n;
1304
- }
1305
- map(n, t) {
1306
- const r = this.members.map((o) => o.map(n, t, V));
1307
- return R.from(r);
1308
- }
1309
- forChild(n, t) {
1310
- if (t.isLeaf)
1311
- return g.empty;
1312
- let r = [];
1313
- for (let o = 0; o < this.members.length; o++) {
1314
- let l = this.members[o].forChild(n, t);
1315
- l != b && (l instanceof R ? r = r.concat(l.members) : r.push(l));
1316
- }
1317
- return R.from(r);
1318
- }
1319
- eq(n) {
1320
- if (!(n instanceof R) || n.members.length != this.members.length)
1321
- return !1;
1322
- for (let t = 0; t < this.members.length; t++)
1323
- if (!this.members[t].eq(n.members[t]))
1324
- return !1;
1325
- return !0;
1326
- }
1327
- locals(n) {
1328
- let t, r = !0;
1329
- for (let o = 0; o < this.members.length; o++) {
1330
- let l = this.members[o].localsInner(n);
1331
- if (l.length)
1332
- if (!t)
1333
- t = l;
1334
- else {
1335
- r && (t = t.slice(), r = !1);
1336
- for (let s = 0; s < l.length; s++)
1337
- t.push(l[s]);
1338
- }
1339
- }
1340
- return t ? ye(r ? t : t.sort(K)) : q;
1341
- }
1342
- // Create a group for the given array of decoration sets, or return
1343
- // a single set when possible.
1344
- static from(n) {
1345
- switch (n.length) {
1346
- case 0:
1347
- return b;
1348
- case 1:
1349
- return n[0];
1350
- default:
1351
- return new R(n.every((t) => t instanceof g) ? n : n.reduce((t, r) => t.concat(r instanceof g ? r : r.members), []));
1352
- }
1353
- }
1354
- forEachSet(n) {
1355
- for (let t = 0; t < this.members.length; t++)
1356
- this.members[t].forEachSet(n);
1357
- }
1358
- }
1359
- function Yt(e, n, t, r, o, l, s) {
1360
- let i = e.slice();
1361
- for (let c = 0, f = l; c < t.maps.length; c++) {
1362
- let u = 0;
1363
- t.maps[c].forEach((d, p, h, E) => {
1364
- let D = E - h - (p - d);
1365
- for (let N = 0; N < i.length; N += 3) {
1366
- let J = i[N + 1];
1367
- if (J < 0 || d > J + f - u)
1368
- continue;
1369
- let Ce = i[N] + f - u;
1370
- p >= Ce ? i[N + 1] = d <= Ce ? -2 : -1 : d >= f && D && (i[N] += D, i[N + 1] += D);
1371
- }
1372
- u += D;
1373
- }), f = t.maps[c].map(f, -1);
1374
- }
1375
- let a = !1;
1376
- for (let c = 0; c < i.length; c += 3)
1377
- if (i[c + 1] < 0) {
1378
- if (i[c + 1] == -2) {
1379
- a = !0, i[c + 1] = -1;
1380
- continue;
1381
- }
1382
- let f = t.map(e[c] + l), u = f - o;
1383
- if (u < 0 || u >= r.content.size) {
1384
- a = !0;
1385
- continue;
1386
- }
1387
- let d = t.map(e[c + 1] + l, -1), p = d - o, { index: h, offset: E } = r.content.findIndex(u), D = r.maybeChild(h);
1388
- if (D && E == u && E + D.nodeSize == p) {
1389
- let N = i[c + 2].mapInner(t, D, f + 1, e[c] + l + 1, s);
1390
- N != b ? (i[c] = u, i[c + 1] = p, i[c + 2] = N) : (i[c + 1] = -2, a = !0);
1391
- } else
1392
- a = !0;
1393
- }
1394
- if (a) {
1395
- let c = Jt(i, e, n, t, o, l, s), f = w(c, r, 0, s);
1396
- n = f.local;
1397
- for (let u = 0; u < i.length; u += 3)
1398
- i[u + 1] < 0 && (i.splice(u, 3), u -= 3);
1399
- for (let u = 0, d = 0; u < f.children.length; u += 3) {
1400
- let p = f.children[u];
1401
- for (; d < i.length && i[d] < p; )
1402
- d += 3;
1403
- i.splice(d, 0, f.children[u], f.children[u + 1], f.children[u + 2]);
1404
- }
1405
- }
1406
- return new g(n.sort(K), i);
1407
- }
1408
- function nt(e, n) {
1409
- if (!n || !e.length)
1410
- return e;
1411
- let t = [];
1412
- for (let r = 0; r < e.length; r++) {
1413
- let o = e[r];
1414
- t.push(new x(o.from + n, o.to + n, o.type));
1415
- }
1416
- return t;
1417
- }
1418
- function Jt(e, n, t, r, o, l, s) {
1419
- function i(a, c) {
1420
- for (let f = 0; f < a.local.length; f++) {
1421
- let u = a.local[f].map(r, o, c);
1422
- u ? t.push(u) : s.onRemove && s.onRemove(a.local[f].spec);
1423
- }
1424
- for (let f = 0; f < a.children.length; f += 3)
1425
- i(a.children[f + 2], a.children[f] + c + 1);
1426
- }
1427
- for (let a = 0; a < e.length; a += 3)
1428
- e[a + 1] == -1 && i(e[a + 2], n[a] + l + 1);
1429
- return t;
1430
- }
1431
- function rt(e, n, t) {
1432
- if (n.isLeaf)
1433
- return null;
1434
- let r = t + n.nodeSize, o = null;
1435
- for (let l = 0, s; l < e.length; l++)
1436
- (s = e[l]) && s.from > t && s.to < r && ((o || (o = [])).push(s), e[l] = null);
1437
- return o;
1438
- }
1439
- function ot(e) {
1440
- let n = [];
1441
- for (let t = 0; t < e.length; t++)
1442
- e[t] != null && n.push(e[t]);
1443
- return n;
1444
- }
1445
- function w(e, n, t, r) {
1446
- let o = [], l = !1;
1447
- n.forEach((i, a) => {
1448
- let c = rt(e, i, a + t);
1449
- if (c) {
1450
- l = !0;
1451
- let f = w(c, i, t + a + 1, r);
1452
- f != b && o.push(a, a + i.nodeSize, f);
1453
- }
1454
- });
1455
- let s = nt(l ? ot(e) : e, -t).sort(K);
1456
- for (let i = 0; i < s.length; i++)
1457
- s[i].type.valid(n, s[i]) || (r.onRemove && r.onRemove(s[i].spec), s.splice(i--, 1));
1458
- return s.length || o.length ? new g(s, o) : b;
1459
- }
1460
- function K(e, n) {
1461
- return e.from - n.from || e.to - n.to;
1462
- }
1463
- function ye(e) {
1464
- let n = e;
1465
- for (let t = 0; t < n.length - 1; t++) {
1466
- let r = n[t];
1467
- if (r.from != r.to)
1468
- for (let o = t + 1; o < n.length; o++) {
1469
- let l = n[o];
1470
- if (l.from == r.from) {
1471
- l.to != r.to && (n == e && (n = e.slice()), n[o] = l.copy(l.from, r.to), Re(n, o + 1, l.copy(r.to, l.to)));
1472
- continue;
1473
- } else {
1474
- l.from < r.to && (n == e && (n = e.slice()), n[t] = r.copy(r.from, l.from), Re(n, o, r.copy(l.from, r.to)));
1475
- break;
1476
- }
1477
- }
1478
- }
1479
- return n;
1480
- }
1481
- function Re(e, n, t) {
1482
- for (; n < e.length && K(t, e[n]) > 0; )
1483
- n++;
1484
- e.splice(n, 0, t);
1485
- }
1486
- export {
1487
- g as D,
1488
- x as a
1489
- };