@burdenoff/microfe-support 2026.1115.1 → 2026.1118.1

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 (90) hide show
  1. package/dist/support/components/careers/RichTextEditor.js +31 -31
  2. package/dist/support/components/careers/RichTextEditor.js.map +1 -1
  3. package/package.json +1 -1
  4. package/dist/_virtual/_rolldown/runtime.js +0 -6
  5. package/dist/node_modules/@tiptap/core/dist/index.js +0 -3491
  6. package/dist/node_modules/@tiptap/core/dist/index.js.map +0 -1
  7. package/dist/node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.js +0 -44
  8. package/dist/node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.js.map +0 -1
  9. package/dist/node_modules/@tiptap/core/dist/rolldown-runtime-D7D4PA-g.js +0 -12
  10. package/dist/node_modules/@tiptap/core/dist/rolldown-runtime-D7D4PA-g.js.map +0 -1
  11. package/dist/node_modules/@tiptap/extension-blockquote/dist/index.js +0 -75
  12. package/dist/node_modules/@tiptap/extension-blockquote/dist/index.js.map +0 -1
  13. package/dist/node_modules/@tiptap/extension-bold/dist/index.js +0 -73
  14. package/dist/node_modules/@tiptap/extension-bold/dist/index.js.map +0 -1
  15. package/dist/node_modules/@tiptap/extension-code/dist/index.js +0 -78
  16. package/dist/node_modules/@tiptap/extension-code/dist/index.js.map +0 -1
  17. package/dist/node_modules/@tiptap/extension-code-block/dist/index.js +0 -157
  18. package/dist/node_modules/@tiptap/extension-code-block/dist/index.js.map +0 -1
  19. package/dist/node_modules/@tiptap/extension-document/dist/index.js +0 -11
  20. package/dist/node_modules/@tiptap/extension-document/dist/index.js.map +0 -1
  21. package/dist/node_modules/@tiptap/extension-hard-break/dist/index.js +0 -50
  22. package/dist/node_modules/@tiptap/extension-hard-break/dist/index.js.map +0 -1
  23. package/dist/node_modules/@tiptap/extension-heading/dist/index.js +0 -70
  24. package/dist/node_modules/@tiptap/extension-heading/dist/index.js.map +0 -1
  25. package/dist/node_modules/@tiptap/extension-horizontal-rule/dist/index.js +0 -49
  26. package/dist/node_modules/@tiptap/extension-horizontal-rule/dist/index.js.map +0 -1
  27. package/dist/node_modules/@tiptap/extension-italic/dist/index.js +0 -70
  28. package/dist/node_modules/@tiptap/extension-italic/dist/index.js.map +0 -1
  29. package/dist/node_modules/@tiptap/extension-link/dist/index.js +0 -389
  30. package/dist/node_modules/@tiptap/extension-link/dist/index.js.map +0 -1
  31. package/dist/node_modules/@tiptap/extension-list/dist/index.js +0 -967
  32. package/dist/node_modules/@tiptap/extension-list/dist/index.js.map +0 -1
  33. package/dist/node_modules/@tiptap/extension-paragraph/dist/index.js +0 -46
  34. package/dist/node_modules/@tiptap/extension-paragraph/dist/index.js.map +0 -1
  35. package/dist/node_modules/@tiptap/extension-placeholder/dist/index.js +0 -6
  36. package/dist/node_modules/@tiptap/extension-placeholder/dist/index.js.map +0 -1
  37. package/dist/node_modules/@tiptap/extension-strike/dist/index.js +0 -55
  38. package/dist/node_modules/@tiptap/extension-strike/dist/index.js.map +0 -1
  39. package/dist/node_modules/@tiptap/extension-text/dist/index.js +0 -14
  40. package/dist/node_modules/@tiptap/extension-text/dist/index.js.map +0 -1
  41. package/dist/node_modules/@tiptap/extension-underline/dist/index.js +0 -72
  42. package/dist/node_modules/@tiptap/extension-underline/dist/index.js.map +0 -1
  43. package/dist/node_modules/@tiptap/extensions/dist/index.js +0 -457
  44. package/dist/node_modules/@tiptap/extensions/dist/index.js.map +0 -1
  45. package/dist/node_modules/@tiptap/react/dist/index.js +0 -332
  46. package/dist/node_modules/@tiptap/react/dist/index.js.map +0 -1
  47. package/dist/node_modules/@tiptap/starter-kit/dist/index.js +0 -28
  48. package/dist/node_modules/@tiptap/starter-kit/dist/index.js.map +0 -1
  49. package/dist/node_modules/fast-equals/dist/es/index.js +0 -298
  50. package/dist/node_modules/fast-equals/dist/es/index.js.map +0 -1
  51. package/dist/node_modules/linkifyjs/dist/linkify.js +0 -527
  52. package/dist/node_modules/linkifyjs/dist/linkify.js.map +0 -1
  53. package/dist/node_modules/orderedmap/dist/index.js +0 -68
  54. package/dist/node_modules/orderedmap/dist/index.js.map +0 -1
  55. package/dist/node_modules/prosemirror-commands/dist/index.js +0 -334
  56. package/dist/node_modules/prosemirror-commands/dist/index.js.map +0 -1
  57. package/dist/node_modules/prosemirror-dropcursor/dist/index.js +0 -112
  58. package/dist/node_modules/prosemirror-dropcursor/dist/index.js.map +0 -1
  59. package/dist/node_modules/prosemirror-gapcursor/dist/index.js +0 -168
  60. package/dist/node_modules/prosemirror-gapcursor/dist/index.js.map +0 -1
  61. package/dist/node_modules/prosemirror-history/dist/index.js +0 -219
  62. package/dist/node_modules/prosemirror-history/dist/index.js.map +0 -1
  63. package/dist/node_modules/prosemirror-keymap/dist/index.js +0 -51
  64. package/dist/node_modules/prosemirror-keymap/dist/index.js.map +0 -1
  65. package/dist/node_modules/prosemirror-model/dist/index.js +0 -1775
  66. package/dist/node_modules/prosemirror-model/dist/index.js.map +0 -1
  67. package/dist/node_modules/prosemirror-schema-list/dist/index.js +0 -77
  68. package/dist/node_modules/prosemirror-schema-list/dist/index.js.map +0 -1
  69. package/dist/node_modules/prosemirror-state/dist/index.js +0 -526
  70. package/dist/node_modules/prosemirror-state/dist/index.js.map +0 -1
  71. package/dist/node_modules/prosemirror-transform/dist/index.js +0 -1204
  72. package/dist/node_modules/prosemirror-transform/dist/index.js.map +0 -1
  73. package/dist/node_modules/prosemirror-view/dist/index.js +0 -3355
  74. package/dist/node_modules/prosemirror-view/dist/index.js.map +0 -1
  75. package/dist/node_modules/rope-sequence/dist/index.js +0 -84
  76. package/dist/node_modules/rope-sequence/dist/index.js.map +0 -1
  77. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js +0 -55
  78. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js.map +0 -1
  79. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.js +0 -53
  80. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.js.map +0 -1
  81. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js +0 -53
  82. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js.map +0 -1
  83. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js +0 -45
  84. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js.map +0 -1
  85. package/dist/node_modules/use-sync-external-store/shim/index.js +0 -11
  86. package/dist/node_modules/use-sync-external-store/shim/index.js.map +0 -1
  87. package/dist/node_modules/use-sync-external-store/shim/with-selector.js +0 -11
  88. package/dist/node_modules/use-sync-external-store/shim/with-selector.js.map +0 -1
  89. package/dist/node_modules/w3c-keyname/index.js +0 -89
  90. package/dist/node_modules/w3c-keyname/index.js.map +0 -1
@@ -1,1775 +0,0 @@
1
- import e from "../../orderedmap/dist/index.js";
2
- // node_modules/prosemirror-model/dist/index.js
3
- function t(e, n, a) {
4
- for (let o = 0;; o++) {
5
- if (o == e.childCount || o == n.childCount) return e.childCount == n.childCount ? null : a;
6
- let s = e.child(o), c = n.child(o);
7
- if (s == c) a += s.nodeSize;
8
- else {
9
- if (!s.sameMarkup(c)) return a;
10
- if (s.isText && s.text != c.text) {
11
- let e = s.text, t = c.text, n = 0;
12
- for (; e[n] == t[n]; n++) a++;
13
- return n && n < e.length && n < t.length && i(e.charCodeAt(n - 1)) && r(e.charCodeAt(n)) && a--, a;
14
- }
15
- if (s.content.size || c.content.size) {
16
- let e = t(s.content, c.content, a + 1);
17
- if (e != null) return e;
18
- }
19
- a += s.nodeSize;
20
- }
21
- }
22
- }
23
- function n(e, t, a, o) {
24
- for (let s = e.childCount, c = t.childCount;;) {
25
- if (s == 0 || c == 0) return s == c ? null : {
26
- a,
27
- b: o
28
- };
29
- let l = e.child(--s), u = t.child(--c), d = l.nodeSize;
30
- if (l == u) a -= d, o -= d;
31
- else {
32
- if (!l.sameMarkup(u)) return {
33
- a,
34
- b: o
35
- };
36
- if (l.isText && l.text != u.text) {
37
- let e = l.text, t = u.text, n = e.length, s = t.length;
38
- for (; n > 0 && s > 0 && e[n - 1] == t[s - 1];) n--, s--, a--, o--;
39
- return n && s && n < e.length && i(e.charCodeAt(n - 1)) && r(e.charCodeAt(n)) && (a++, o++), {
40
- a,
41
- b: o
42
- };
43
- }
44
- if (l.content.size || u.content.size) {
45
- let e = n(l.content, u.content, a - 1, o - 1);
46
- if (e) return e;
47
- }
48
- a -= d, o -= d;
49
- }
50
- }
51
- }
52
- function r(e) {
53
- return e >= 56320 && e < 57344;
54
- }
55
- function i(e) {
56
- return e >= 55296 && e < 56320;
57
- }
58
- var a = class e {
59
- constructor(e, t) {
60
- if (this.content = e, this.size = t || 0, t == null) for (let t = 0; t < e.length; t++) this.size += e[t].nodeSize;
61
- }
62
- nodesBetween(e, t, n, r = 0, i) {
63
- for (let a = 0, o = 0; o < t; a++) {
64
- let s = this.content[a], c = o + s.nodeSize;
65
- if (c > e && n(s, r + o, i || null, a) !== !1 && s.content.size) {
66
- let i = o + 1;
67
- s.nodesBetween(Math.max(0, e - i), Math.min(s.content.size, t - i), n, r + i);
68
- }
69
- o = c;
70
- }
71
- }
72
- descendants(e) {
73
- this.nodesBetween(0, this.size, e);
74
- }
75
- textBetween(e, t, n, r) {
76
- let i = "", a = !0;
77
- return this.nodesBetween(e, t, (o, s) => {
78
- let c = o.isText ? o.text.slice(Math.max(e, s) - s, t - s) : o.isLeaf ? r ? typeof r == "function" ? r(o) : r : o.type.spec.leafText ? o.type.spec.leafText(o) : "" : "";
79
- o.isBlock && (o.isLeaf && c || o.isTextblock) && n && (a ? a = !1 : i += n), i += c;
80
- }, 0), i;
81
- }
82
- append(t) {
83
- if (!t.size) return this;
84
- if (!this.size) return t;
85
- let n = this.lastChild, r = t.firstChild, i = this.content.slice(), a = 0;
86
- for (n.isText && n.sameMarkup(r) && (i[i.length - 1] = n.withText(n.text + r.text), a = 1); a < t.content.length; a++) i.push(t.content[a]);
87
- return new e(i, this.size + t.size);
88
- }
89
- cut(t, n = this.size) {
90
- if (t == 0 && n == this.size) return this;
91
- let r = [], i = 0;
92
- if (n > t) for (let e = 0, a = 0; a < n; e++) {
93
- let o = this.content[e], s = a + o.nodeSize;
94
- s > t && ((a < t || s > n) && (o = o.isText ? o.cut(Math.max(0, t - a), Math.min(o.text.length, n - a)) : o.cut(Math.max(0, t - a - 1), Math.min(o.content.size, n - a - 1))), r.push(o), i += o.nodeSize), a = s;
95
- }
96
- return new e(r, i);
97
- }
98
- cutByIndex(t, n) {
99
- return t == n ? e.empty : t == 0 && n == this.content.length ? this : new e(this.content.slice(t, n));
100
- }
101
- replaceChild(t, n) {
102
- let r = this.content[t];
103
- if (r == n) return this;
104
- let i = this.content.slice(), a = this.size + n.nodeSize - r.nodeSize;
105
- return i[t] = n, new e(i, a);
106
- }
107
- addToStart(t) {
108
- return new e([t].concat(this.content), this.size + t.nodeSize);
109
- }
110
- addToEnd(t) {
111
- return new e(this.content.concat(t), this.size + t.nodeSize);
112
- }
113
- eq(e) {
114
- if (this.content.length != e.content.length) return !1;
115
- for (let t = 0; t < this.content.length; t++) if (!this.content[t].eq(e.content[t])) return !1;
116
- return !0;
117
- }
118
- get firstChild() {
119
- return this.content.length ? this.content[0] : null;
120
- }
121
- get lastChild() {
122
- return this.content.length ? this.content[this.content.length - 1] : null;
123
- }
124
- get childCount() {
125
- return this.content.length;
126
- }
127
- child(e) {
128
- let t = this.content[e];
129
- if (!t) throw RangeError("Index " + e + " out of range for " + this);
130
- return t;
131
- }
132
- maybeChild(e) {
133
- return this.content[e] || null;
134
- }
135
- forEach(e) {
136
- for (let t = 0, n = 0; t < this.content.length; t++) {
137
- let r = this.content[t];
138
- e(r, n, t), n += r.nodeSize;
139
- }
140
- }
141
- findDiffStart(e, n = 0) {
142
- return t(this, e, n);
143
- }
144
- findDiffEnd(e, t = this.size, r = e.size) {
145
- return n(this, e, t, r);
146
- }
147
- findIndex(e) {
148
- if (e == 0) return s(0, e);
149
- if (e == this.size) return s(this.content.length, e);
150
- if (e > this.size || e < 0) throw RangeError(`Position ${e} outside of fragment (${this})`);
151
- for (let t = 0, n = 0;; t++) {
152
- let r = this.child(t), i = n + r.nodeSize;
153
- if (i >= e) return i == e ? s(t + 1, i) : s(t, n);
154
- n = i;
155
- }
156
- }
157
- toString() {
158
- return "<" + this.toStringInner() + ">";
159
- }
160
- toStringInner() {
161
- return this.content.join(", ");
162
- }
163
- toJSON() {
164
- return this.content.length ? this.content.map((e) => e.toJSON()) : null;
165
- }
166
- static fromJSON(t, n) {
167
- if (!n) return e.empty;
168
- if (!Array.isArray(n)) throw RangeError("Invalid input for Fragment.fromJSON");
169
- return e.fromArray(n.map(t.nodeFromJSON));
170
- }
171
- static fromArray(t) {
172
- if (!t.length) return e.empty;
173
- let n, r = 0;
174
- for (let e = 0; e < t.length; e++) {
175
- let i = t[e];
176
- r += i.nodeSize, e && i.isText && t[e - 1].sameMarkup(i) ? (n ||= t.slice(0, e), n[n.length - 1] = i.withText(n[n.length - 1].text + i.text)) : n && n.push(i);
177
- }
178
- return new e(n || t, r);
179
- }
180
- static from(t) {
181
- if (!t) return e.empty;
182
- if (t instanceof e) return t;
183
- if (Array.isArray(t)) return this.fromArray(t);
184
- if (t.attrs) return new e([t], t.nodeSize);
185
- throw RangeError("Can not convert " + t + " to a Fragment" + (t.nodesBetween ? " (looks like multiple versions of prosemirror-model were loaded)" : ""));
186
- }
187
- };
188
- a.empty = new a([], 0);
189
- var o = {
190
- index: 0,
191
- offset: 0
192
- };
193
- function s(e, t) {
194
- return o.index = e, o.offset = t, o;
195
- }
196
- function c(e, t) {
197
- if (e === t) return !0;
198
- if (!(e && typeof e == "object") || !(t && typeof t == "object")) return !1;
199
- let n = Array.isArray(e);
200
- if (Array.isArray(t) != n) return !1;
201
- if (n) {
202
- if (e.length != t.length) return !1;
203
- for (let n = 0; n < e.length; n++) if (!c(e[n], t[n])) return !1;
204
- } else {
205
- for (let n in e) if (!(n in t) || !c(e[n], t[n])) return !1;
206
- for (let n in t) if (!(n in e)) return !1;
207
- }
208
- return !0;
209
- }
210
- var l = class e {
211
- constructor(e, t) {
212
- this.type = e, this.attrs = t;
213
- }
214
- addToSet(e) {
215
- let t, n = !1;
216
- for (let r = 0; r < e.length; r++) {
217
- let i = e[r];
218
- if (this.eq(i)) return e;
219
- if (this.type.excludes(i.type)) t ||= e.slice(0, r);
220
- else if (i.type.excludes(this.type)) return e;
221
- else !n && i.type.rank > this.type.rank && (t ||= e.slice(0, r), t.push(this), n = !0), t && t.push(i);
222
- }
223
- return t ||= e.slice(), n || t.push(this), t;
224
- }
225
- removeFromSet(e) {
226
- for (let t = 0; t < e.length; t++) if (this.eq(e[t])) return e.slice(0, t).concat(e.slice(t + 1));
227
- return e;
228
- }
229
- isInSet(e) {
230
- for (let t = 0; t < e.length; t++) if (this.eq(e[t])) return !0;
231
- return !1;
232
- }
233
- eq(e) {
234
- return this == e || this.type == e.type && c(this.attrs, e.attrs);
235
- }
236
- toJSON() {
237
- let e = { type: this.type.name };
238
- for (let t in this.attrs) {
239
- e.attrs = this.attrs;
240
- break;
241
- }
242
- return e;
243
- }
244
- static fromJSON(e, t) {
245
- if (!t) throw RangeError("Invalid input for Mark.fromJSON");
246
- let n = e.marks[t.type];
247
- if (!n) throw RangeError(`There is no mark type ${t.type} in this schema`);
248
- return n.create(t.attrs);
249
- }
250
- static sameSet(e, t) {
251
- if (e == t) return !0;
252
- if (e.length != t.length) return !1;
253
- for (let n = 0; n < e.length; n++) if (!e[n].eq(t[n])) return !1;
254
- return !0;
255
- }
256
- static setFrom(t) {
257
- if (!t || Array.isArray(t) && t.length == 0) return e.none;
258
- if (t instanceof e) return [t];
259
- let n = t.slice();
260
- return n.sort((e, t) => e.type.rank - t.type.rank), n;
261
- }
262
- };
263
- l.none = [];
264
- var u = class extends Error {}, d = class e {
265
- constructor(e, t, n) {
266
- this.content = e, this.openStart = t, this.openEnd = n;
267
- }
268
- get size() {
269
- return this.content.size - this.openStart - this.openEnd;
270
- }
271
- insertAt(t, n) {
272
- let r = p(this.content, t + this.openStart, n, this.openStart + 1, this.openEnd + 1);
273
- return r && new e(r, this.openStart, this.openEnd);
274
- }
275
- removeBetween(t, n) {
276
- return new e(f(this.content, t + this.openStart, n + this.openStart), this.openStart, this.openEnd);
277
- }
278
- eq(e) {
279
- return this.content.eq(e.content) && this.openStart == e.openStart && this.openEnd == e.openEnd;
280
- }
281
- toString() {
282
- return this.content + "(" + this.openStart + "," + this.openEnd + ")";
283
- }
284
- toJSON() {
285
- if (!this.content.size) return null;
286
- let e = { content: this.content.toJSON() };
287
- return this.openStart > 0 && (e.openStart = this.openStart), this.openEnd > 0 && (e.openEnd = this.openEnd), e;
288
- }
289
- static fromJSON(t, n) {
290
- if (!n) return e.empty;
291
- let r = n.openStart || 0, i = n.openEnd || 0;
292
- if (typeof r != "number" || typeof i != "number") throw RangeError("Invalid input for Slice.fromJSON");
293
- return new e(a.fromJSON(t, n.content), r, i);
294
- }
295
- static maxOpen(t, n = !0) {
296
- let r = 0, i = 0;
297
- for (let e = t.firstChild; e && !e.isLeaf && (n || !e.type.spec.isolating); e = e.firstChild) r++;
298
- for (let e = t.lastChild; e && !e.isLeaf && (n || !e.type.spec.isolating); e = e.lastChild) i++;
299
- return new e(t, r, i);
300
- }
301
- };
302
- d.empty = new d(a.empty, 0, 0);
303
- function f(e, t, n) {
304
- let { index: r, offset: i } = e.findIndex(t), a = e.maybeChild(r), { index: o, offset: s } = e.findIndex(n);
305
- if (i == t || a.isText) {
306
- if (s != n && !e.child(o).isText) throw RangeError("Removing non-flat range");
307
- return e.cut(0, t).append(e.cut(n));
308
- }
309
- if (r != o) throw RangeError("Removing non-flat range");
310
- return e.replaceChild(r, a.copy(f(a.content, t - i - 1, n - i - 1)));
311
- }
312
- function p(e, t, n, r, i, a) {
313
- let { index: o, offset: s } = e.findIndex(t), c = e.maybeChild(o);
314
- if (s == t || c.isText) return a && r <= 0 && i <= 0 && !a.canReplace(o, o, n) ? null : e.cut(0, t).append(n).append(e.cut(t));
315
- let l = p(c.content, t - s - 1, n, o == 0 ? r - 1 : 0, o == e.childCount - 1 ? i - 1 : 0, c);
316
- return l && e.replaceChild(o, c.copy(l));
317
- }
318
- function ee(e, t, n) {
319
- if (n.openStart > e.depth) throw new u("Inserted content deeper than insertion position");
320
- if (e.depth - n.openStart != t.depth - n.openEnd) throw new u("Inconsistent open depths");
321
- return m(e, t, n, 0);
322
- }
323
- function m(e, t, n, r) {
324
- let i = e.index(r), a = e.node(r);
325
- if (i == t.index(r) && r < e.depth - n.openStart) {
326
- let o = m(e, t, n, r + 1);
327
- return a.copy(a.content.replaceChild(i, o));
328
- }
329
- if (!n.content.size) return y(a, x(e, t, r));
330
- if (!n.openStart && !n.openEnd && e.depth == r && t.depth == r) {
331
- let r = e.parent, i = r.content;
332
- return y(r, i.cut(0, e.parentOffset).append(n.content).append(i.cut(t.parentOffset)));
333
- }
334
- {
335
- let { start: i, end: o } = te(n, e);
336
- return y(a, b(e, i, o, t, r));
337
- }
338
- }
339
- function h(e, t) {
340
- if (!t.type.compatibleContent(e.type)) throw new u("Cannot join " + t.type.name + " onto " + e.type.name);
341
- }
342
- function g(e, t, n) {
343
- let r = e.node(n);
344
- return h(r, t.node(n)), r;
345
- }
346
- function _(e, t) {
347
- let n = t.length - 1;
348
- n >= 0 && e.isText && e.sameMarkup(t[n]) ? t[n] = e.withText(t[n].text + e.text) : t.push(e);
349
- }
350
- function v(e, t, n, r) {
351
- let i = (t || e).node(n), a = 0, o = t ? t.index(n) : i.childCount;
352
- e && (a = e.index(n), e.depth > n ? a++ : e.textOffset && (_(e.nodeAfter, r), a++));
353
- for (let e = a; e < o; e++) _(i.child(e), r);
354
- t && t.depth == n && t.textOffset && _(t.nodeBefore, r);
355
- }
356
- function y(e, t) {
357
- if (!e.type.validContent(t)) throw new u("Invalid content for node " + e.type.name);
358
- return e.copy(t);
359
- }
360
- function b(e, t, n, r, i) {
361
- let o = e.depth > i && g(e, t, i + 1), s = r.depth > i && g(n, r, i + 1), c = [];
362
- return v(null, e, i, c), o && s && t.index(i) == n.index(i) ? (h(o, s), _(y(o, b(e, t, n, r, i + 1)), c)) : (o && _(y(o, x(e, t, i + 1)), c), v(t, n, i, c), s && _(y(s, x(n, r, i + 1)), c)), v(r, null, i, c), new a(c);
363
- }
364
- function x(e, t, n) {
365
- let r = [];
366
- return v(null, e, n, r), e.depth > n && _(y(g(e, t, n + 1), x(e, t, n + 1)), r), v(t, null, n, r), new a(r);
367
- }
368
- function te(e, t) {
369
- let n = t.depth - e.openStart, r = t.node(n).copy(e.content);
370
- for (let e = n - 1; e >= 0; e--) r = t.node(e).copy(a.from(r));
371
- return {
372
- start: r.resolveNoCache(e.openStart + n),
373
- end: r.resolveNoCache(r.content.size - e.openEnd - n)
374
- };
375
- }
376
- var S = class e {
377
- constructor(e, t, n) {
378
- this.pos = e, this.path = t, this.parentOffset = n, this.depth = t.length / 3 - 1;
379
- }
380
- resolveDepth(e) {
381
- return e == null ? this.depth : e < 0 ? this.depth + e : e;
382
- }
383
- get parent() {
384
- return this.node(this.depth);
385
- }
386
- get doc() {
387
- return this.node(0);
388
- }
389
- node(e) {
390
- return this.path[this.resolveDepth(e) * 3];
391
- }
392
- index(e) {
393
- return this.path[this.resolveDepth(e) * 3 + 1];
394
- }
395
- indexAfter(e) {
396
- return e = this.resolveDepth(e), this.index(e) + (e == this.depth && !this.textOffset ? 0 : 1);
397
- }
398
- start(e) {
399
- return e = this.resolveDepth(e), e == 0 ? 0 : this.path[e * 3 - 1] + 1;
400
- }
401
- end(e) {
402
- return e = this.resolveDepth(e), this.start(e) + this.node(e).content.size;
403
- }
404
- before(e) {
405
- if (e = this.resolveDepth(e), !e) throw RangeError("There is no position before the top-level node");
406
- return e == this.depth + 1 ? this.pos : this.path[e * 3 - 1];
407
- }
408
- after(e) {
409
- if (e = this.resolveDepth(e), !e) throw RangeError("There is no position after the top-level node");
410
- return e == this.depth + 1 ? this.pos : this.path[e * 3 - 1] + this.path[e * 3].nodeSize;
411
- }
412
- get textOffset() {
413
- return this.pos - this.path[this.path.length - 1];
414
- }
415
- get nodeAfter() {
416
- let e = this.parent, t = this.index(this.depth);
417
- if (t == e.childCount) return null;
418
- let n = this.pos - this.path[this.path.length - 1], r = e.child(t);
419
- return n ? e.child(t).cut(n) : r;
420
- }
421
- get nodeBefore() {
422
- let e = this.index(this.depth), t = this.pos - this.path[this.path.length - 1];
423
- return t ? this.parent.child(e).cut(0, t) : e == 0 ? null : this.parent.child(e - 1);
424
- }
425
- posAtIndex(e, t) {
426
- t = this.resolveDepth(t);
427
- let n = this.path[t * 3], r = t == 0 ? 0 : this.path[t * 3 - 1] + 1;
428
- for (let t = 0; t < e; t++) r += n.child(t).nodeSize;
429
- return r;
430
- }
431
- marks() {
432
- let e = this.parent, t = this.index();
433
- if (e.content.size == 0) return l.none;
434
- if (this.textOffset) return e.child(t).marks;
435
- let n = e.maybeChild(t - 1), r = e.maybeChild(t);
436
- if (!n) {
437
- let e = n;
438
- n = r, r = e;
439
- }
440
- let i = n.marks;
441
- for (var a = 0; a < i.length; a++) i[a].type.spec.inclusive !== !1 || r && i[a].isInSet(r.marks) || (i = i[a--].removeFromSet(i));
442
- return i;
443
- }
444
- marksAcross(e) {
445
- let t = this.parent.maybeChild(this.index());
446
- if (!t || !t.isInline) return null;
447
- let n = t.marks, r = e.parent.maybeChild(e.index());
448
- for (var i = 0; i < n.length; i++) n[i].type.spec.inclusive !== !1 || r && n[i].isInSet(r.marks) || (n = n[i--].removeFromSet(n));
449
- return n;
450
- }
451
- sharedDepth(e) {
452
- for (let t = this.depth; t > 0; t--) if (this.start(t) <= e && this.end(t) >= e) return t;
453
- return 0;
454
- }
455
- blockRange(e = this, t) {
456
- if (e.pos < this.pos) return e.blockRange(this);
457
- for (let n = this.depth - (this.parent.inlineContent || this.pos == e.pos ? 1 : 0); n >= 0; n--) if (e.pos <= this.end(n) && (!t || t(this.node(n)))) return new w(this, e, n);
458
- return null;
459
- }
460
- sameParent(e) {
461
- return this.pos - this.parentOffset == e.pos - e.parentOffset;
462
- }
463
- max(e) {
464
- return e.pos > this.pos ? e : this;
465
- }
466
- min(e) {
467
- return e.pos < this.pos ? e : this;
468
- }
469
- toString() {
470
- let e = "";
471
- for (let t = 1; t <= this.depth; t++) e += (e ? "/" : "") + this.node(t).type.name + "_" + this.index(t - 1);
472
- return e + ":" + this.parentOffset;
473
- }
474
- static resolve(t, n) {
475
- if (!(n >= 0 && n <= t.content.size)) throw RangeError("Position " + n + " out of range");
476
- let r = [], i = 0, a = n;
477
- for (let e = t;;) {
478
- let { index: t, offset: n } = e.content.findIndex(a), o = a - n;
479
- if (r.push(e, t, i + n), !o || (e = e.child(t), e.isText)) break;
480
- a = o - 1, i += n + 1;
481
- }
482
- return new e(n, r, a);
483
- }
484
- static resolveCached(t, n) {
485
- let r = C.get(t);
486
- if (r) for (let e = 0; e < r.elts.length; e++) {
487
- let t = r.elts[e];
488
- if (t.pos == n) return t;
489
- }
490
- else C.set(t, r = new ne());
491
- let i = r.elts[r.i] = e.resolve(t, n);
492
- return r.i = (r.i + 1) % re, i;
493
- }
494
- }, ne = class {
495
- constructor() {
496
- this.elts = [], this.i = 0;
497
- }
498
- }, re = 12, C = /* @__PURE__ */ new WeakMap(), w = class {
499
- constructor(e, t, n) {
500
- this.$from = e, this.$to = t, this.depth = n;
501
- }
502
- get start() {
503
- return this.$from.before(this.depth + 1);
504
- }
505
- get end() {
506
- return this.$to.after(this.depth + 1);
507
- }
508
- get parent() {
509
- return this.$from.node(this.depth);
510
- }
511
- get startIndex() {
512
- return this.$from.index(this.depth);
513
- }
514
- get endIndex() {
515
- return this.$to.indexAfter(this.depth);
516
- }
517
- }, ie = Object.create(null), T = class e {
518
- constructor(e, t, n, r = l.none) {
519
- this.type = e, this.attrs = t, this.marks = r, this.content = n || a.empty;
520
- }
521
- get children() {
522
- return this.content.content;
523
- }
524
- get nodeSize() {
525
- return this.isLeaf ? 1 : 2 + this.content.size;
526
- }
527
- get childCount() {
528
- return this.content.childCount;
529
- }
530
- child(e) {
531
- return this.content.child(e);
532
- }
533
- maybeChild(e) {
534
- return this.content.maybeChild(e);
535
- }
536
- forEach(e) {
537
- this.content.forEach(e);
538
- }
539
- nodesBetween(e, t, n, r = 0) {
540
- this.content.nodesBetween(e, t, n, r, this);
541
- }
542
- descendants(e) {
543
- this.nodesBetween(0, this.content.size, e);
544
- }
545
- get textContent() {
546
- return this.isLeaf && this.type.spec.leafText ? this.type.spec.leafText(this) : this.textBetween(0, this.content.size, "");
547
- }
548
- textBetween(e, t, n, r) {
549
- return this.content.textBetween(e, t, n, r);
550
- }
551
- get firstChild() {
552
- return this.content.firstChild;
553
- }
554
- get lastChild() {
555
- return this.content.lastChild;
556
- }
557
- eq(e) {
558
- return this == e || this.sameMarkup(e) && this.content.eq(e.content);
559
- }
560
- sameMarkup(e) {
561
- return this.hasMarkup(e.type, e.attrs, e.marks);
562
- }
563
- hasMarkup(e, t, n) {
564
- return this.type == e && c(this.attrs, t || e.defaultAttrs || ie) && l.sameSet(this.marks, n || l.none);
565
- }
566
- copy(t = null) {
567
- return t == this.content ? this : new e(this.type, this.attrs, t, this.marks);
568
- }
569
- mark(t) {
570
- return t == this.marks ? this : new e(this.type, this.attrs, this.content, t);
571
- }
572
- cut(e, t = this.content.size) {
573
- return e == 0 && t == this.content.size ? this : this.copy(this.content.cut(e, t));
574
- }
575
- slice(e, t = this.content.size, n = !1) {
576
- if (e == t) return d.empty;
577
- let r = this.resolve(e), i = this.resolve(t), a = n ? 0 : r.sharedDepth(t), o = r.start(a);
578
- return new d(r.node(a).content.cut(r.pos - o, i.pos - o), r.depth - a, i.depth - a);
579
- }
580
- replace(e, t, n) {
581
- return ee(this.resolve(e), this.resolve(t), n);
582
- }
583
- nodeAt(e) {
584
- for (let t = this;;) {
585
- let { index: n, offset: r } = t.content.findIndex(e);
586
- if (t = t.maybeChild(n), !t) return null;
587
- if (r == e || t.isText) return t;
588
- e -= r + 1;
589
- }
590
- }
591
- childAfter(e) {
592
- let { index: t, offset: n } = this.content.findIndex(e);
593
- return {
594
- node: this.content.maybeChild(t),
595
- index: t,
596
- offset: n
597
- };
598
- }
599
- childBefore(e) {
600
- if (e == 0) return {
601
- node: null,
602
- index: 0,
603
- offset: 0
604
- };
605
- let { index: t, offset: n } = this.content.findIndex(e);
606
- if (n < e) return {
607
- node: this.content.child(t),
608
- index: t,
609
- offset: n
610
- };
611
- let r = this.content.child(t - 1);
612
- return {
613
- node: r,
614
- index: t - 1,
615
- offset: n - r.nodeSize
616
- };
617
- }
618
- resolve(e) {
619
- return S.resolveCached(this, e);
620
- }
621
- resolveNoCache(e) {
622
- return S.resolve(this, e);
623
- }
624
- rangeHasMark(e, t, n) {
625
- let r = !1;
626
- return t > e && this.nodesBetween(e, t, (e) => (n.isInSet(e.marks) && (r = !0), !r)), r;
627
- }
628
- get isBlock() {
629
- return this.type.isBlock;
630
- }
631
- get isTextblock() {
632
- return this.type.isTextblock;
633
- }
634
- get inlineContent() {
635
- return this.type.inlineContent;
636
- }
637
- get isInline() {
638
- return this.type.isInline;
639
- }
640
- get isText() {
641
- return this.type.isText;
642
- }
643
- get isLeaf() {
644
- return this.type.isLeaf;
645
- }
646
- get isAtom() {
647
- return this.type.isAtom;
648
- }
649
- toString() {
650
- if (this.type.spec.toDebugString) return this.type.spec.toDebugString(this);
651
- let e = this.type.name;
652
- return this.content.size && (e += "(" + this.content.toStringInner() + ")"), E(this.marks, e);
653
- }
654
- contentMatchAt(e) {
655
- let t = this.type.contentMatch.matchFragment(this.content, 0, e);
656
- if (!t) throw Error("Called contentMatchAt on a node with invalid content");
657
- return t;
658
- }
659
- canReplace(e, t, n = a.empty, r = 0, i = n.childCount) {
660
- let o = this.contentMatchAt(e).matchFragment(n, r, i), s = o && o.matchFragment(this.content, t);
661
- if (!s || !s.validEnd) return !1;
662
- for (let e = r; e < i; e++) if (!this.type.allowsMarks(n.child(e).marks)) return !1;
663
- return !0;
664
- }
665
- canReplaceWith(e, t, n, r) {
666
- if (r && !this.type.allowsMarks(r)) return !1;
667
- let i = this.contentMatchAt(e).matchType(n), a = i && i.matchFragment(this.content, t);
668
- return a ? a.validEnd : !1;
669
- }
670
- canAppend(e) {
671
- return e.content.size ? this.canReplace(this.childCount, this.childCount, e.content) : this.type.compatibleContent(e.type);
672
- }
673
- check() {
674
- this.type.checkContent(this.content), D(this.type.attrs, this.attrs, "node", this.type.name);
675
- let e = l.none;
676
- for (let t = 0; t < this.marks.length; t++) {
677
- let n = this.marks[t];
678
- D(n.type.attrs, n.attrs, "mark", n.type.name), e = n.addToSet(e);
679
- }
680
- if (!l.sameSet(e, this.marks)) throw RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map((e) => e.type.name)}`);
681
- this.content.forEach((e) => e.check());
682
- }
683
- toJSON() {
684
- let e = { type: this.type.name };
685
- for (let t in this.attrs) {
686
- e.attrs = this.attrs;
687
- break;
688
- }
689
- return this.content.size && (e.content = this.content.toJSON()), this.marks.length && (e.marks = this.marks.map((e) => e.toJSON())), e;
690
- }
691
- static fromJSON(e, t) {
692
- if (!t) throw RangeError("Invalid input for Node.fromJSON");
693
- let n;
694
- if (t.marks) {
695
- if (!Array.isArray(t.marks)) throw RangeError("Invalid mark data for Node.fromJSON");
696
- n = t.marks.map(e.markFromJSON);
697
- }
698
- if (t.type == "text") {
699
- if (typeof t.text != "string") throw RangeError("Invalid text node in JSON");
700
- return e.text(t.text, n);
701
- }
702
- let r = a.fromJSON(e, t.content);
703
- return e.nodeType(t.type).create(t.attrs, r, n);
704
- }
705
- };
706
- T.prototype.text = void 0;
707
- var ae = class e extends T {
708
- constructor(e, t, n, r) {
709
- if (super(e, t, null, r), !n) throw RangeError("Empty text nodes are not allowed");
710
- this.text = n;
711
- }
712
- toString() {
713
- return this.type.spec.toDebugString ? this.type.spec.toDebugString(this) : E(this.marks, JSON.stringify(this.text));
714
- }
715
- get textContent() {
716
- return this.text;
717
- }
718
- textBetween(e, t) {
719
- return this.text.slice(e, t);
720
- }
721
- get nodeSize() {
722
- return this.text.length;
723
- }
724
- mark(t) {
725
- return t == this.marks ? this : new e(this.type, this.attrs, this.text, t);
726
- }
727
- withText(t) {
728
- return t == this.text ? this : new e(this.type, this.attrs, t, this.marks);
729
- }
730
- cut(e = 0, t = this.text.length) {
731
- return e == 0 && t == this.text.length ? this : this.withText(this.text.slice(e, t));
732
- }
733
- eq(e) {
734
- return this.sameMarkup(e) && this.text == e.text;
735
- }
736
- toJSON() {
737
- let e = super.toJSON();
738
- return e.text = this.text, e;
739
- }
740
- };
741
- function E(e, t) {
742
- for (let n = e.length - 1; n >= 0; n--) t = e[n].type.name + "(" + t + ")";
743
- return t;
744
- }
745
- function D(e, t, n, r) {
746
- for (let i in t) if (!(i in e)) throw RangeError(`Unsupported attribute ${i} for ${n} of type ${r}`);
747
- for (let n in e) e[n].validate && e[n].validate(t[n]);
748
- }
749
- var O = class e {
750
- constructor(e) {
751
- this.validEnd = e, this.next = [], this.wrapCache = [];
752
- }
753
- static parse(t, n) {
754
- let r = new oe(t, n);
755
- if (r.next == null) return e.empty;
756
- let i = k(r);
757
- r.next && r.err("Unexpected trailing text");
758
- let a = pe(fe(i));
759
- return me(a, r), a;
760
- }
761
- matchType(e) {
762
- for (let t = 0; t < this.next.length; t++) if (this.next[t].type == e) return this.next[t].next;
763
- return null;
764
- }
765
- matchFragment(e, t = 0, n = e.childCount) {
766
- let r = this;
767
- for (let i = t; r && i < n; i++) r = r.matchType(e.child(i).type);
768
- return r;
769
- }
770
- get inlineContent() {
771
- return this.next.length != 0 && this.next[0].type.isInline;
772
- }
773
- get defaultType() {
774
- for (let e = 0; e < this.next.length; e++) {
775
- let { type: t } = this.next[e];
776
- if (!(t.isText || t.hasRequiredAttrs())) return t;
777
- }
778
- return null;
779
- }
780
- compatible(e) {
781
- for (let t = 0; t < this.next.length; t++) for (let n = 0; n < e.next.length; n++) if (this.next[t].type == e.next[n].type) return !0;
782
- return !1;
783
- }
784
- fillBefore(e, t = !1, n = 0) {
785
- let r = [this];
786
- function i(o, s) {
787
- let c = o.matchFragment(e, n);
788
- if (c && (!t || c.validEnd)) return a.from(s.map((e) => e.createAndFill()));
789
- for (let e = 0; e < o.next.length; e++) {
790
- let { type: t, next: n } = o.next[e];
791
- if (!(t.isText || t.hasRequiredAttrs()) && r.indexOf(n) == -1) {
792
- r.push(n);
793
- let e = i(n, s.concat(t));
794
- if (e) return e;
795
- }
796
- }
797
- return null;
798
- }
799
- return i(this, []);
800
- }
801
- findWrapping(e) {
802
- for (let t = 0; t < this.wrapCache.length; t += 2) if (this.wrapCache[t] == e) return this.wrapCache[t + 1];
803
- let t = this.computeWrapping(e);
804
- return this.wrapCache.push(e, t), t;
805
- }
806
- computeWrapping(e) {
807
- let t = Object.create(null), n = [{
808
- match: this,
809
- type: null,
810
- via: null
811
- }];
812
- for (; n.length;) {
813
- let r = n.shift(), i = r.match;
814
- if (i.matchType(e)) {
815
- let e = [];
816
- for (let t = r; t.type; t = t.via) e.push(t.type);
817
- return e.reverse();
818
- }
819
- for (let e = 0; e < i.next.length; e++) {
820
- let { type: a, next: o } = i.next[e];
821
- a.isLeaf || a.hasRequiredAttrs() || a.name in t || r.type && !o.validEnd || (n.push({
822
- match: a.contentMatch,
823
- type: a,
824
- via: r
825
- }), t[a.name] = !0);
826
- }
827
- }
828
- return null;
829
- }
830
- get edgeCount() {
831
- return this.next.length;
832
- }
833
- edge(e) {
834
- if (e >= this.next.length) throw RangeError(`There's no ${e}th edge in this content match`);
835
- return this.next[e];
836
- }
837
- toString() {
838
- let e = [];
839
- function t(n) {
840
- e.push(n);
841
- for (let r = 0; r < n.next.length; r++) e.indexOf(n.next[r].next) == -1 && t(n.next[r].next);
842
- }
843
- return t(this), e.map((t, n) => {
844
- let r = n + (t.validEnd ? "*" : " ") + " ";
845
- for (let n = 0; n < t.next.length; n++) r += (n ? ", " : "") + t.next[n].type.name + "->" + e.indexOf(t.next[n].next);
846
- return r;
847
- }).join("\n");
848
- }
849
- };
850
- O.empty = new O(!0);
851
- var oe = class {
852
- constructor(e, t) {
853
- this.string = e, this.nodeTypes = t, this.inline = null, this.pos = 0, this.tokens = e.split(/\s*(?=\b|\W|$)/), this.tokens[this.tokens.length - 1] == "" && this.tokens.pop(), this.tokens[0] == "" && this.tokens.shift();
854
- }
855
- get next() {
856
- return this.tokens[this.pos];
857
- }
858
- eat(e) {
859
- return this.next == e && (this.pos++ || !0);
860
- }
861
- err(e) {
862
- throw SyntaxError(e + " (in content expression '" + this.string + "')");
863
- }
864
- };
865
- function k(e) {
866
- let t = [];
867
- do
868
- t.push(se(e));
869
- while (e.eat("|"));
870
- return t.length == 1 ? t[0] : {
871
- type: "choice",
872
- exprs: t
873
- };
874
- }
875
- function se(e) {
876
- let t = [];
877
- do
878
- t.push(ce(e));
879
- while (e.next && e.next != ")" && e.next != "|");
880
- return t.length == 1 ? t[0] : {
881
- type: "seq",
882
- exprs: t
883
- };
884
- }
885
- function ce(e) {
886
- let t = de(e);
887
- for (;;) if (e.eat("+")) t = {
888
- type: "plus",
889
- expr: t
890
- };
891
- else if (e.eat("*")) t = {
892
- type: "star",
893
- expr: t
894
- };
895
- else if (e.eat("?")) t = {
896
- type: "opt",
897
- expr: t
898
- };
899
- else if (e.eat("{")) t = le(e, t);
900
- else break;
901
- return t;
902
- }
903
- function A(e) {
904
- /\D/.test(e.next) && e.err("Expected number, got '" + e.next + "'");
905
- let t = Number(e.next);
906
- return e.pos++, t;
907
- }
908
- function le(e, t) {
909
- let n = A(e), r = n;
910
- return e.eat(",") && (r = e.next == "}" ? -1 : A(e)), e.eat("}") || e.err("Unclosed braced range"), {
911
- type: "range",
912
- min: n,
913
- max: r,
914
- expr: t
915
- };
916
- }
917
- function ue(e, t) {
918
- let n = e.nodeTypes, r = n[t];
919
- if (r) return [r];
920
- let i = [];
921
- for (let e in n) {
922
- let r = n[e];
923
- r.isInGroup(t) && i.push(r);
924
- }
925
- return i.length == 0 && e.err("No node type or group '" + t + "' found"), i;
926
- }
927
- function de(e) {
928
- if (e.eat("(")) {
929
- let t = k(e);
930
- return e.eat(")") || e.err("Missing closing paren"), t;
931
- }
932
- if (/\W/.test(e.next)) e.err("Unexpected token '" + e.next + "'");
933
- else {
934
- let t = ue(e, e.next).map((t) => (e.inline == null ? e.inline = t.isInline : e.inline != t.isInline && e.err("Mixing inline and block content"), {
935
- type: "name",
936
- value: t
937
- }));
938
- return e.pos++, t.length == 1 ? t[0] : {
939
- type: "choice",
940
- exprs: t
941
- };
942
- }
943
- }
944
- function fe(e) {
945
- let t = [[]];
946
- return i(a(e, 0), n()), t;
947
- function n() {
948
- return t.push([]) - 1;
949
- }
950
- function r(e, n, r) {
951
- let i = {
952
- term: r,
953
- to: n
954
- };
955
- return t[e].push(i), i;
956
- }
957
- function i(e, t) {
958
- e.forEach((e) => e.to = t);
959
- }
960
- function a(e, t) {
961
- if (e.type == "choice") return e.exprs.reduce((e, n) => e.concat(a(n, t)), []);
962
- if (e.type == "seq") for (let r = 0;; r++) {
963
- let o = a(e.exprs[r], t);
964
- if (r == e.exprs.length - 1) return o;
965
- i(o, t = n());
966
- }
967
- else if (e.type == "star") {
968
- let o = n();
969
- return r(t, o), i(a(e.expr, o), o), [r(o)];
970
- } else if (e.type == "plus") {
971
- let o = n();
972
- return i(a(e.expr, t), o), i(a(e.expr, o), o), [r(o)];
973
- } else if (e.type == "opt") return [r(t)].concat(a(e.expr, t));
974
- else if (e.type == "range") {
975
- let o = t;
976
- for (let t = 0; t < e.min; t++) {
977
- let t = n();
978
- i(a(e.expr, o), t), o = t;
979
- }
980
- if (e.max == -1) i(a(e.expr, o), o);
981
- else for (let t = e.min; t < e.max; t++) {
982
- let t = n();
983
- r(o, t), i(a(e.expr, o), t), o = t;
984
- }
985
- return [r(o)];
986
- } else if (e.type == "name") return [r(t, void 0, e.value)];
987
- else throw Error("Unknown expr type");
988
- }
989
- }
990
- function j(e, t) {
991
- return t - e;
992
- }
993
- function M(e, t) {
994
- let n = [];
995
- return r(t), n.sort(j);
996
- function r(t) {
997
- let i = e[t];
998
- if (i.length == 1 && !i[0].term) return r(i[0].to);
999
- n.push(t);
1000
- for (let e = 0; e < i.length; e++) {
1001
- let { term: t, to: a } = i[e];
1002
- !t && n.indexOf(a) == -1 && r(a);
1003
- }
1004
- }
1005
- }
1006
- function pe(e) {
1007
- let t = Object.create(null);
1008
- return n(M(e, 0));
1009
- function n(r) {
1010
- let i = [];
1011
- r.forEach((t) => {
1012
- e[t].forEach(({ term: t, to: n }) => {
1013
- if (!t) return;
1014
- let r;
1015
- for (let e = 0; e < i.length; e++) i[e][0] == t && (r = i[e][1]);
1016
- M(e, n).forEach((e) => {
1017
- r || i.push([t, r = []]), r.indexOf(e) == -1 && r.push(e);
1018
- });
1019
- });
1020
- });
1021
- let a = t[r.join(",")] = new O(r.indexOf(e.length - 1) > -1);
1022
- for (let e = 0; e < i.length; e++) {
1023
- let r = i[e][1].sort(j);
1024
- a.next.push({
1025
- type: i[e][0],
1026
- next: t[r.join(",")] || n(r)
1027
- });
1028
- }
1029
- return a;
1030
- }
1031
- }
1032
- function me(e, t) {
1033
- for (let n = 0, r = [e]; n < r.length; n++) {
1034
- let e = r[n], i = !e.validEnd, a = [];
1035
- for (let t = 0; t < e.next.length; t++) {
1036
- let { type: n, next: o } = e.next[t];
1037
- a.push(n.name), i && !(n.isText || n.hasRequiredAttrs()) && (i = !1), r.indexOf(o) == -1 && r.push(o);
1038
- }
1039
- i && t.err("Only non-generatable nodes (" + a.join(", ") + ") in a required position (see https://prosemirror.net/docs/guide/#generatable)");
1040
- }
1041
- }
1042
- function N(e) {
1043
- let t = Object.create(null);
1044
- for (let n in e) {
1045
- let r = e[n];
1046
- if (!r.hasDefault) return null;
1047
- t[n] = r.default;
1048
- }
1049
- return t;
1050
- }
1051
- function P(e, t) {
1052
- let n = Object.create(null);
1053
- for (let r in e) {
1054
- let i = e[r], a = t && t[r];
1055
- if (a === void 0) {
1056
- if (i.hasDefault) a = i.default;
1057
- else throw RangeError("No value supplied for attribute " + r);
1058
- } else i.validate && i.validate(a);
1059
- n[r] = a;
1060
- }
1061
- return n;
1062
- }
1063
- function F(e, t) {
1064
- let n = Object.create(null);
1065
- if (t) for (let r in t) n[r] = new ge(e, r, t[r]);
1066
- return n;
1067
- }
1068
- var I = class e {
1069
- constructor(e, t, n) {
1070
- this.name = e, this.schema = t, this.spec = n, this.markSet = null, this.groups = n.group ? n.group.split(" ") : [], this.attrs = F(e, n.attrs), this.defaultAttrs = N(this.attrs), this.contentMatch = null, this.inlineContent = null, this.isBlock = !(n.inline || e == "text"), this.isText = e == "text";
1071
- }
1072
- get isInline() {
1073
- return !this.isBlock;
1074
- }
1075
- get isTextblock() {
1076
- return this.isBlock && this.inlineContent;
1077
- }
1078
- get isLeaf() {
1079
- return this.contentMatch == O.empty;
1080
- }
1081
- get isAtom() {
1082
- return this.isLeaf || !!this.spec.atom;
1083
- }
1084
- isInGroup(e) {
1085
- return this.groups.indexOf(e) > -1;
1086
- }
1087
- get whitespace() {
1088
- return this.spec.whitespace || (this.spec.code ? "pre" : "normal");
1089
- }
1090
- hasRequiredAttrs() {
1091
- for (let e in this.attrs) if (this.attrs[e].isRequired) return !0;
1092
- return !1;
1093
- }
1094
- compatibleContent(e) {
1095
- return this == e || this.contentMatch.compatible(e.contentMatch);
1096
- }
1097
- computeAttrs(e) {
1098
- return !e && this.defaultAttrs ? this.defaultAttrs : P(this.attrs, e);
1099
- }
1100
- create(e = null, t, n) {
1101
- if (this.isText) throw Error("NodeType.create can't construct text nodes");
1102
- return new T(this, this.computeAttrs(e), a.from(t), l.setFrom(n));
1103
- }
1104
- createChecked(e = null, t, n) {
1105
- return t = a.from(t), this.checkContent(t), new T(this, this.computeAttrs(e), t, l.setFrom(n));
1106
- }
1107
- createAndFill(e = null, t, n) {
1108
- if (e = this.computeAttrs(e), t = a.from(t), t.size) {
1109
- let e = this.contentMatch.fillBefore(t);
1110
- if (!e) return null;
1111
- t = e.append(t);
1112
- }
1113
- let r = this.contentMatch.matchFragment(t), i = r && r.fillBefore(a.empty, !0);
1114
- return i ? new T(this, e, t.append(i), l.setFrom(n)) : null;
1115
- }
1116
- validContent(e) {
1117
- let t = this.contentMatch.matchFragment(e);
1118
- if (!t || !t.validEnd) return !1;
1119
- for (let t = 0; t < e.childCount; t++) if (!this.allowsMarks(e.child(t).marks)) return !1;
1120
- return !0;
1121
- }
1122
- checkContent(e) {
1123
- if (!this.validContent(e)) throw RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0, 50)}`);
1124
- }
1125
- checkAttrs(e) {}
1126
- allowsMarkType(e) {
1127
- return this.markSet == null || this.markSet.indexOf(e) > -1;
1128
- }
1129
- allowsMarks(e) {
1130
- if (this.markSet == null) return !0;
1131
- for (let t = 0; t < e.length; t++) if (!this.allowsMarkType(e[t].type)) return !1;
1132
- return !0;
1133
- }
1134
- allowedMarks(e) {
1135
- if (this.markSet == null) return e;
1136
- let t;
1137
- for (let n = 0; n < e.length; n++) this.allowsMarkType(e[n].type) ? t && t.push(e[n]) : t ||= e.slice(0, n);
1138
- return t ? t.length ? t : l.none : e;
1139
- }
1140
- static compile(t, n) {
1141
- let r = Object.create(null);
1142
- t.forEach((t, i) => r[t] = new e(t, n, i));
1143
- let i = n.spec.topNode || "doc";
1144
- if (!r[i]) throw RangeError("Schema is missing its top node type ('" + i + "')");
1145
- if (!r.text) throw RangeError("Every schema needs a 'text' type");
1146
- for (let e in r.text.attrs) throw RangeError("The text node type should not have attributes");
1147
- return r;
1148
- }
1149
- };
1150
- function he(e, t, n) {
1151
- let r = n.split("|");
1152
- return (n) => {
1153
- let i = n === null ? "null" : typeof n;
1154
- if (r.indexOf(i) < 0) throw RangeError(`Expected value of type ${r} for attribute ${t} on type ${e}, got ${i}`);
1155
- };
1156
- }
1157
- var ge = class {
1158
- constructor(e, t, n) {
1159
- this.hasDefault = Object.prototype.hasOwnProperty.call(n, "default"), this.default = n.default, this.validate = typeof n.validate == "string" ? he(e, t, n.validate) : n.validate;
1160
- }
1161
- get isRequired() {
1162
- return !this.hasDefault;
1163
- }
1164
- }, L = class e {
1165
- constructor(e, t, n, r) {
1166
- this.name = e, this.rank = t, this.schema = n, this.spec = r, this.attrs = F(e, r.attrs), this.excluded = null;
1167
- let i = N(this.attrs);
1168
- this.instance = i ? new l(this, i) : null;
1169
- }
1170
- create(e = null) {
1171
- return !e && this.instance ? this.instance : new l(this, P(this.attrs, e));
1172
- }
1173
- static compile(t, n) {
1174
- let r = Object.create(null), i = 0;
1175
- return t.forEach((t, a) => r[t] = new e(t, i++, n, a)), r;
1176
- }
1177
- removeFromSet(e) {
1178
- for (var t = 0; t < e.length; t++) e[t].type == this && (e = e.slice(0, t).concat(e.slice(t + 1)), t--);
1179
- return e;
1180
- }
1181
- isInSet(e) {
1182
- for (let t = 0; t < e.length; t++) if (e[t].type == this) return e[t];
1183
- }
1184
- excludes(e) {
1185
- return this.excluded.indexOf(e) > -1;
1186
- }
1187
- }, _e = class {
1188
- constructor(t) {
1189
- this.linebreakReplacement = null, this.cached = Object.create(null);
1190
- let n = this.spec = {};
1191
- for (let e in t) n[e] = t[e];
1192
- n.nodes = e.from(t.nodes), n.marks = e.from(t.marks || {}), this.nodes = I.compile(this.spec.nodes, this), this.marks = L.compile(this.spec.marks, this);
1193
- let r = Object.create(null);
1194
- for (let e in this.nodes) {
1195
- if (e in this.marks) throw RangeError(e + " can not be both a node and a mark");
1196
- let t = this.nodes[e], n = t.spec.content || "", i = t.spec.marks;
1197
- if (t.contentMatch = r[n] || (r[n] = O.parse(n, this.nodes)), t.inlineContent = t.contentMatch.inlineContent, t.spec.linebreakReplacement) {
1198
- if (this.linebreakReplacement) throw RangeError("Multiple linebreak nodes defined");
1199
- if (!t.isInline || !t.isLeaf) throw RangeError("Linebreak replacement nodes must be inline leaf nodes");
1200
- this.linebreakReplacement = t;
1201
- }
1202
- t.markSet = i == "_" ? null : i ? R(this, i.split(" ")) : i == "" || !t.inlineContent ? [] : null;
1203
- }
1204
- for (let e in this.marks) {
1205
- let t = this.marks[e], n = t.spec.excludes;
1206
- t.excluded = n == null ? [t] : n == "" ? [] : R(this, n.split(" "));
1207
- }
1208
- this.nodeFromJSON = (e) => T.fromJSON(this, e), this.markFromJSON = (e) => l.fromJSON(this, e), this.topNodeType = this.nodes[this.spec.topNode || "doc"], this.cached.wrappings = Object.create(null);
1209
- }
1210
- node(e, t = null, n, r) {
1211
- if (typeof e == "string") e = this.nodeType(e);
1212
- else if (!(e instanceof I)) throw RangeError("Invalid node type: " + e);
1213
- else if (e.schema != this) throw RangeError("Node type from different schema used (" + e.name + ")");
1214
- return e.createChecked(t, n, r);
1215
- }
1216
- text(e, t) {
1217
- let n = this.nodes.text;
1218
- return new ae(n, n.defaultAttrs, e, l.setFrom(t));
1219
- }
1220
- mark(e, t) {
1221
- return typeof e == "string" && (e = this.marks[e]), e.create(t);
1222
- }
1223
- nodeType(e) {
1224
- let t = this.nodes[e];
1225
- if (!t) throw RangeError("Unknown node type: " + e);
1226
- return t;
1227
- }
1228
- };
1229
- function R(e, t) {
1230
- let n = [];
1231
- for (let r = 0; r < t.length; r++) {
1232
- let i = t[r], a = e.marks[i], o = a;
1233
- if (a) n.push(a);
1234
- else for (let t in e.marks) {
1235
- let r = e.marks[t];
1236
- (i == "_" || r.spec.group && r.spec.group.split(" ").indexOf(i) > -1) && n.push(o = r);
1237
- }
1238
- if (!o) throw SyntaxError("Unknown mark type: '" + t[r] + "'");
1239
- }
1240
- return n;
1241
- }
1242
- function ve(e) {
1243
- return e.tag != null;
1244
- }
1245
- function ye(e) {
1246
- return e.style != null;
1247
- }
1248
- var be = class e {
1249
- constructor(e, t) {
1250
- this.schema = e, this.rules = t, this.tags = [], this.styles = [];
1251
- let n = this.matchedStyles = [];
1252
- t.forEach((e) => {
1253
- if (ve(e)) this.tags.push(e);
1254
- else if (ye(e)) {
1255
- let t = /[^=]*/.exec(e.style)[0];
1256
- n.indexOf(t) < 0 && n.push(t), this.styles.push(e);
1257
- }
1258
- }), this.normalizeLists = !this.tags.some((t) => {
1259
- if (!/^(ul|ol)\b/.test(t.tag) || !t.node) return !1;
1260
- let n = e.nodes[t.node];
1261
- return n.contentMatch.matchType(n);
1262
- });
1263
- }
1264
- parse(e, t = {}) {
1265
- let n = new K(this, t, !1);
1266
- return n.addAll(e, l.none, t.from, t.to), n.finish();
1267
- }
1268
- parseSlice(e, t = {}) {
1269
- let n = new K(this, t, !0);
1270
- return n.addAll(e, l.none, t.from, t.to), d.maxOpen(n.finish());
1271
- }
1272
- matchTag(e, t, n) {
1273
- for (let r = n ? this.tags.indexOf(n) + 1 : 0; r < this.tags.length; r++) {
1274
- let n = this.tags[r];
1275
- if (Ce(e, n.tag) && (n.namespace === void 0 || e.namespaceURI == n.namespace) && (!n.context || t.matchesContext(n.context))) {
1276
- if (n.getAttrs) {
1277
- let t = n.getAttrs(e);
1278
- if (t === !1) continue;
1279
- n.attrs = t || void 0;
1280
- }
1281
- return n;
1282
- }
1283
- }
1284
- }
1285
- matchStyle(e, t, n, r) {
1286
- for (let i = r ? this.styles.indexOf(r) + 1 : 0; i < this.styles.length; i++) {
1287
- let r = this.styles[i], a = r.style;
1288
- if (!(a.indexOf(e) != 0 || r.context && !n.matchesContext(r.context) || a.length > e.length && (a.charCodeAt(e.length) != 61 || a.slice(e.length + 1) != t))) {
1289
- if (r.getAttrs) {
1290
- let e = r.getAttrs(t);
1291
- if (e === !1) continue;
1292
- r.attrs = e || void 0;
1293
- }
1294
- return r;
1295
- }
1296
- }
1297
- }
1298
- static schemaRules(e) {
1299
- let t = [];
1300
- function n(e) {
1301
- let n = e.priority == null ? 50 : e.priority, r = 0;
1302
- for (; r < t.length; r++) {
1303
- let e = t[r];
1304
- if ((e.priority == null ? 50 : e.priority) < n) break;
1305
- }
1306
- t.splice(r, 0, e);
1307
- }
1308
- for (let t in e.marks) {
1309
- let r = e.marks[t].spec.parseDOM;
1310
- r && r.forEach((e) => {
1311
- n(e = q(e)), e.mark || e.ignore || e.clearMark || (e.mark = t);
1312
- });
1313
- }
1314
- for (let t in e.nodes) {
1315
- let r = e.nodes[t].spec.parseDOM;
1316
- r && r.forEach((e) => {
1317
- n(e = q(e)), e.node || e.ignore || e.mark || (e.node = t);
1318
- });
1319
- }
1320
- return t;
1321
- }
1322
- static fromSchema(t) {
1323
- return t.cached.domParser || (t.cached.domParser = new e(t, e.schemaRules(t)));
1324
- }
1325
- }, z = {
1326
- address: !0,
1327
- article: !0,
1328
- aside: !0,
1329
- blockquote: !0,
1330
- body: !0,
1331
- canvas: !0,
1332
- dd: !0,
1333
- div: !0,
1334
- dl: !0,
1335
- fieldset: !0,
1336
- figcaption: !0,
1337
- figure: !0,
1338
- footer: !0,
1339
- form: !0,
1340
- h1: !0,
1341
- h2: !0,
1342
- h3: !0,
1343
- h4: !0,
1344
- h5: !0,
1345
- h6: !0,
1346
- header: !0,
1347
- hgroup: !0,
1348
- hr: !0,
1349
- li: !0,
1350
- noscript: !0,
1351
- ol: !0,
1352
- output: !0,
1353
- p: !0,
1354
- pre: !0,
1355
- section: !0,
1356
- table: !0,
1357
- tfoot: !0,
1358
- ul: !0
1359
- }, xe = {
1360
- head: !0,
1361
- noscript: !0,
1362
- object: !0,
1363
- script: !0,
1364
- style: !0,
1365
- title: !0
1366
- }, B = {
1367
- ol: !0,
1368
- ul: !0
1369
- }, V = 1, H = 2, U = 4;
1370
- function W(e, t, n) {
1371
- return t == null ? e && e.whitespace == "pre" ? 3 : n & -5 : (t ? V : 0) | (t === "full" ? H : 0);
1372
- }
1373
- var G = class {
1374
- constructor(e, t, n, r, i, a) {
1375
- this.type = e, this.attrs = t, this.marks = n, this.solid = r, this.options = a, this.content = [], this.activeMarks = l.none, this.match = i || (a & U ? null : e.contentMatch);
1376
- }
1377
- findWrapping(e) {
1378
- if (!this.match) {
1379
- if (!this.type) return [];
1380
- let t = this.type.contentMatch.fillBefore(a.from(e));
1381
- if (t) this.match = this.type.contentMatch.matchFragment(t);
1382
- else {
1383
- let t = this.type.contentMatch, n;
1384
- return (n = t.findWrapping(e.type)) ? (this.match = t, n) : null;
1385
- }
1386
- }
1387
- return this.match.findWrapping(e.type);
1388
- }
1389
- finish(e) {
1390
- if (!(this.options & V)) {
1391
- let e = this.content[this.content.length - 1], t;
1392
- if (e && e.isText && (t = /[ \t\r\n\u000c]+$/.exec(e.text))) {
1393
- let n = e;
1394
- e.text.length == t[0].length ? this.content.pop() : this.content[this.content.length - 1] = n.withText(n.text.slice(0, n.text.length - t[0].length));
1395
- }
1396
- }
1397
- let t = a.from(this.content);
1398
- return !e && this.match && (t = t.append(this.match.fillBefore(a.empty, !0))), this.type ? this.type.create(this.attrs, t, this.marks) : t;
1399
- }
1400
- inlineContext(e) {
1401
- return this.type ? this.type.inlineContent : this.content.length ? this.content[0].isInline : e.parentNode && !z.hasOwnProperty(e.parentNode.nodeName.toLowerCase());
1402
- }
1403
- }, K = class {
1404
- constructor(e, t, n) {
1405
- this.parser = e, this.options = t, this.isOpen = n, this.open = 0, this.localPreserveWS = !1;
1406
- let r = t.topNode, i, a = W(null, t.preserveWhitespace, 0) | (n ? U : 0);
1407
- i = r ? new G(r.type, r.attrs, l.none, !0, t.topMatch || r.type.contentMatch, a) : n ? new G(null, null, l.none, !0, null, a) : new G(e.schema.topNodeType, null, l.none, !0, null, a), this.nodes = [i], this.find = t.findPositions, this.needsBlock = !1;
1408
- }
1409
- get top() {
1410
- return this.nodes[this.open];
1411
- }
1412
- addDOM(e, t) {
1413
- e.nodeType == 3 ? this.addTextNode(e, t) : e.nodeType == 1 && this.addElement(e, t);
1414
- }
1415
- addTextNode(e, t) {
1416
- let n = e.nodeValue, r = this.top, i = r.options & H ? "full" : this.localPreserveWS || (r.options & V) > 0, { schema: a } = this.parser;
1417
- if (i === "full" || r.inlineContext(e) || /[^ \t\r\n\u000c]/.test(n)) {
1418
- if (!i) {
1419
- if (n = n.replace(/[ \t\r\n\u000c]+/g, " "), /^[ \t\r\n\u000c]/.test(n) && this.open == this.nodes.length - 1) {
1420
- let t = r.content[r.content.length - 1], i = e.previousSibling;
1421
- (!t || i && i.nodeName == "BR" || t.isText && /[ \t\r\n\u000c]$/.test(t.text)) && (n = n.slice(1));
1422
- }
1423
- } else if (i === "full") n = n.replace(/\r\n?/g, "\n");
1424
- else if (a.linebreakReplacement && /[\r\n]/.test(n) && this.top.findWrapping(a.linebreakReplacement.create())) {
1425
- let e = n.split(/\r?\n|\r/);
1426
- for (let n = 0; n < e.length; n++) n && this.insertNode(a.linebreakReplacement.create(), t, !0), e[n] && this.insertNode(a.text(e[n]), t, !/\S/.test(e[n]));
1427
- n = "";
1428
- } else n = n.replace(/\r?\n|\r/g, " ");
1429
- n && this.insertNode(a.text(n), t, !/\S/.test(n)), this.findInText(e);
1430
- } else this.findInside(e);
1431
- }
1432
- addElement(e, t, n) {
1433
- let r = this.localPreserveWS, i = this.top;
1434
- (e.tagName == "PRE" || /pre/.test(e.style && e.style.whiteSpace)) && (this.localPreserveWS = !0);
1435
- let a = e.nodeName.toLowerCase(), o;
1436
- B.hasOwnProperty(a) && this.parser.normalizeLists && Se(e);
1437
- let s = this.options.ruleFromNode && this.options.ruleFromNode(e) || (o = this.parser.matchTag(e, this, n));
1438
- out: if (s ? s.ignore : xe.hasOwnProperty(a)) this.findInside(e), this.ignoreFallback(e, t);
1439
- else if (!s || s.skip || s.closeParent) {
1440
- s && s.closeParent ? this.open = Math.max(0, this.open - 1) : s && s.skip.nodeType && (e = s.skip);
1441
- let n, r = this.needsBlock;
1442
- if (z.hasOwnProperty(a)) i.content.length && i.content[0].isInline && this.open && (this.open--, i = this.top), n = !0, i.type || (this.needsBlock = !0);
1443
- else if (!e.firstChild) {
1444
- this.leafFallback(e, t);
1445
- break out;
1446
- }
1447
- let o = s && s.skip ? t : this.readStyles(e, t);
1448
- o && this.addAll(e, o), n && this.sync(i), this.needsBlock = r;
1449
- } else {
1450
- let n = this.readStyles(e, t);
1451
- n && this.addElementByRule(e, s, n, s.consuming === !1 ? o : void 0);
1452
- }
1453
- this.localPreserveWS = r;
1454
- }
1455
- leafFallback(e, t) {
1456
- e.nodeName == "BR" && this.top.type && this.top.type.inlineContent && this.addTextNode(e.ownerDocument.createTextNode("\n"), t);
1457
- }
1458
- ignoreFallback(e, t) {
1459
- e.nodeName != "BR" || this.top.type && this.top.type.inlineContent || this.findPlace(this.parser.schema.text("-"), t, !0);
1460
- }
1461
- readStyles(e, t) {
1462
- let n = e.style;
1463
- if (n && n.length) for (let e = 0; e < this.parser.matchedStyles.length; e++) {
1464
- let r = this.parser.matchedStyles[e], i = n.getPropertyValue(r);
1465
- if (i) for (let e;;) {
1466
- let n = this.parser.matchStyle(r, i, this, e);
1467
- if (!n) break;
1468
- if (n.ignore) return null;
1469
- if (t = n.clearMark ? t.filter((e) => !n.clearMark(e)) : t.concat(this.parser.schema.marks[n.mark].create(n.attrs)), n.consuming === !1) e = n;
1470
- else break;
1471
- }
1472
- }
1473
- return t;
1474
- }
1475
- addElementByRule(e, t, n, r) {
1476
- let i, a;
1477
- if (t.node) {
1478
- if (a = this.parser.schema.nodes[t.node], a.isLeaf) this.insertNode(a.create(t.attrs), n, e.nodeName == "BR") || this.leafFallback(e, n);
1479
- else {
1480
- let e = this.enter(a, t.attrs || null, n, t.preserveWhitespace);
1481
- e && (i = !0, n = e);
1482
- }
1483
- } else {
1484
- let e = this.parser.schema.marks[t.mark];
1485
- n = n.concat(e.create(t.attrs));
1486
- }
1487
- let o = this.top;
1488
- if (a && a.isLeaf) this.findInside(e);
1489
- else if (r) this.addElement(e, n, r);
1490
- else if (t.getContent) this.findInside(e), t.getContent(e, this.parser.schema).forEach((e) => this.insertNode(e, n, !1));
1491
- else {
1492
- let r = e;
1493
- typeof t.contentElement == "string" ? r = e.querySelector(t.contentElement) : typeof t.contentElement == "function" ? r = t.contentElement(e) : t.contentElement && (r = t.contentElement), this.findAround(e, r, !0), this.addAll(r, n), this.findAround(e, r, !1);
1494
- }
1495
- i && this.sync(o) && this.open--;
1496
- }
1497
- addAll(e, t, n, r) {
1498
- let i = n || 0;
1499
- for (let a = n ? e.childNodes[n] : e.firstChild, o = r == null ? null : e.childNodes[r]; a != o; a = a.nextSibling, ++i) this.findAtPoint(e, i), this.addDOM(a, t);
1500
- this.findAtPoint(e, i);
1501
- }
1502
- findPlace(e, t, n) {
1503
- let r, i;
1504
- for (let t = this.open, a = 0; t >= 0; t--) {
1505
- let o = this.nodes[t], s = o.findWrapping(e);
1506
- if (s && (!r || r.length > s.length + a) && (r = s, i = o, !s.length)) break;
1507
- if (o.solid) {
1508
- if (n) break;
1509
- a += 2;
1510
- }
1511
- }
1512
- if (!r) return null;
1513
- this.sync(i);
1514
- for (let e = 0; e < r.length; e++) t = this.enterInner(r[e], null, t, !1);
1515
- return t;
1516
- }
1517
- insertNode(e, t, n) {
1518
- if (e.isInline && this.needsBlock && !this.top.type) {
1519
- let e = this.textblockFromContext();
1520
- e && (t = this.enterInner(e, null, t));
1521
- }
1522
- let r = this.findPlace(e, t, n);
1523
- if (r) {
1524
- this.closeExtra();
1525
- let t = this.top;
1526
- t.match &&= t.match.matchType(e.type);
1527
- let n = l.none;
1528
- for (let i of r.concat(e.marks)) (t.type ? t.type.allowsMarkType(i.type) : J(i.type, e.type)) && (n = i.addToSet(n));
1529
- return t.content.push(e.mark(n)), !0;
1530
- }
1531
- return !1;
1532
- }
1533
- enter(e, t, n, r) {
1534
- let i = this.findPlace(e.create(t), n, !1);
1535
- return i &&= this.enterInner(e, t, n, !0, r), i;
1536
- }
1537
- enterInner(e, t, n, r = !1, i) {
1538
- this.closeExtra();
1539
- let a = this.top;
1540
- a.match = a.match && a.match.matchType(e);
1541
- let o = W(e, i, a.options);
1542
- a.options & U && a.content.length == 0 && (o |= U);
1543
- let s = l.none;
1544
- return n = n.filter((t) => !(a.type ? a.type.allowsMarkType(t.type) : J(t.type, e)) || (s = t.addToSet(s), !1)), this.nodes.push(new G(e, t, s, r, null, o)), this.open++, n;
1545
- }
1546
- closeExtra(e = !1) {
1547
- let t = this.nodes.length - 1;
1548
- if (t > this.open) {
1549
- for (; t > this.open; t--) this.nodes[t - 1].content.push(this.nodes[t].finish(e));
1550
- this.nodes.length = this.open + 1;
1551
- }
1552
- }
1553
- finish() {
1554
- return this.open = 0, this.closeExtra(this.isOpen), this.nodes[0].finish(!!(this.isOpen || this.options.topOpen));
1555
- }
1556
- sync(e) {
1557
- for (let t = this.open; t >= 0; t--) if (this.nodes[t] == e) return this.open = t, !0;
1558
- else this.localPreserveWS && (this.nodes[t].options |= V);
1559
- return !1;
1560
- }
1561
- get currentPos() {
1562
- this.closeExtra();
1563
- let e = 0;
1564
- for (let t = this.open; t >= 0; t--) {
1565
- let n = this.nodes[t].content;
1566
- for (let t = n.length - 1; t >= 0; t--) e += n[t].nodeSize;
1567
- t && e++;
1568
- }
1569
- return e;
1570
- }
1571
- findAtPoint(e, t) {
1572
- if (this.find) for (let n = 0; n < this.find.length; n++) this.find[n].node == e && this.find[n].offset == t && (this.find[n].pos = this.currentPos);
1573
- }
1574
- findInside(e) {
1575
- if (this.find) for (let t = 0; t < this.find.length; t++) this.find[t].pos == null && e.nodeType == 1 && e.contains(this.find[t].node) && (this.find[t].pos = this.currentPos);
1576
- }
1577
- findAround(e, t, n) {
1578
- if (e != t && this.find) for (let r = 0; r < this.find.length; r++) this.find[r].pos == null && e.nodeType == 1 && e.contains(this.find[r].node) && t.compareDocumentPosition(this.find[r].node) & (n ? 2 : 4) && (this.find[r].pos = this.currentPos);
1579
- }
1580
- findInText(e) {
1581
- if (this.find) for (let t = 0; t < this.find.length; t++) this.find[t].node == e && (this.find[t].pos = this.currentPos - (e.nodeValue.length - this.find[t].offset));
1582
- }
1583
- matchesContext(e) {
1584
- if (e.indexOf("|") > -1) return e.split(/\s*\|\s*/).some(this.matchesContext, this);
1585
- let t = e.split("/"), n = this.options.context, r = !this.isOpen && (!n || n.parent.type == this.nodes[0].type), i = -(n ? n.depth + 1 : 0) + +!r, a = (e, o) => {
1586
- for (; e >= 0; e--) {
1587
- let s = t[e];
1588
- if (s == "") {
1589
- if (e == t.length - 1 || e == 0) continue;
1590
- for (; o >= i; o--) if (a(e - 1, o)) return !0;
1591
- return !1;
1592
- }
1593
- {
1594
- let e = o > 0 || o == 0 && r ? this.nodes[o].type : n && o >= i ? n.node(o - i).type : null;
1595
- if (!e || e.name != s && !e.isInGroup(s)) return !1;
1596
- o--;
1597
- }
1598
- }
1599
- return !0;
1600
- };
1601
- return a(t.length - 1, this.open);
1602
- }
1603
- textblockFromContext() {
1604
- let e = this.options.context;
1605
- if (e) for (let t = e.depth; t >= 0; t--) {
1606
- let n = e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;
1607
- if (n && n.isTextblock && n.defaultAttrs) return n;
1608
- }
1609
- for (let e in this.parser.schema.nodes) {
1610
- let t = this.parser.schema.nodes[e];
1611
- if (t.isTextblock && t.defaultAttrs) return t;
1612
- }
1613
- }
1614
- };
1615
- function Se(e) {
1616
- for (let t = e.firstChild, n = null; t; t = t.nextSibling) {
1617
- let e = t.nodeType == 1 ? t.nodeName.toLowerCase() : null;
1618
- e && B.hasOwnProperty(e) && n ? (n.appendChild(t), t = n) : e == "li" ? n = t : e && (n = null);
1619
- }
1620
- }
1621
- function Ce(e, t) {
1622
- return (e.matches || e.msMatchesSelector || e.webkitMatchesSelector || e.mozMatchesSelector).call(e, t);
1623
- }
1624
- function q(e) {
1625
- let t = {};
1626
- for (let n in e) t[n] = e[n];
1627
- return t;
1628
- }
1629
- function J(e, t) {
1630
- let n = t.schema.nodes;
1631
- for (let r in n) {
1632
- let i = n[r];
1633
- if (!i.allowsMarkType(e)) continue;
1634
- let a = [], o = (e) => {
1635
- a.push(e);
1636
- for (let n = 0; n < e.edgeCount; n++) {
1637
- let { type: r, next: i } = e.edge(n);
1638
- if (r == t || a.indexOf(i) < 0 && o(i)) return !0;
1639
- }
1640
- };
1641
- if (o(i.contentMatch)) return !0;
1642
- }
1643
- }
1644
- var we = class e {
1645
- constructor(e, t) {
1646
- this.nodes = e, this.marks = t;
1647
- }
1648
- serializeFragment(e, t = {}, n) {
1649
- n ||= X(t).createDocumentFragment();
1650
- let r = n, i = [];
1651
- return e.forEach((e) => {
1652
- if (i.length || e.marks.length) {
1653
- let n = 0, a = 0;
1654
- for (; n < i.length && a < e.marks.length;) {
1655
- let t = e.marks[a];
1656
- if (!this.marks[t.type.name]) a++;
1657
- else {
1658
- if (!t.eq(i[n][0]) || t.type.spec.spanning === !1) break;
1659
- n++, a++;
1660
- }
1661
- }
1662
- for (; n < i.length;) r = i.pop()[1];
1663
- for (; a < e.marks.length;) {
1664
- let n = e.marks[a++], o = this.serializeMark(n, e.isInline, t);
1665
- o && (i.push([n, r]), r.appendChild(o.dom), r = o.contentDOM || o.dom);
1666
- }
1667
- }
1668
- r.appendChild(this.serializeNodeInner(e, t));
1669
- }), n;
1670
- }
1671
- serializeNodeInner(e, t) {
1672
- if (e.isText) return X(t).createTextNode(e.text);
1673
- let { dom: n, contentDOM: r } = $(X(t), this.nodes[e.type.name](e), null, e.attrs);
1674
- if (r) {
1675
- if (e.isLeaf) throw RangeError("Content hole not allowed in a leaf node spec");
1676
- this.serializeFragment(e.content, t, r);
1677
- }
1678
- return n;
1679
- }
1680
- serializeNode(e, t = {}) {
1681
- let n = this.serializeNodeInner(e, t);
1682
- for (let r = e.marks.length - 1; r >= 0; r--) {
1683
- let i = this.serializeMark(e.marks[r], e.isInline, t);
1684
- i && ((i.contentDOM || i.dom).appendChild(n), n = i.dom);
1685
- }
1686
- return n;
1687
- }
1688
- serializeMark(e, t, n = {}) {
1689
- let r = this.marks[e.type.name];
1690
- return r && $(X(n), r(e, t), null, e.attrs);
1691
- }
1692
- static renderSpec(e, t, n = null, r) {
1693
- return typeof t == "string" ? { dom: e.createTextNode(t) } : $(e, t, n, r);
1694
- }
1695
- static fromSchema(t) {
1696
- return t.cached.domSerializer || (t.cached.domSerializer = new e(this.nodesFromSchema(t), this.marksFromSchema(t)));
1697
- }
1698
- static nodesFromSchema(e) {
1699
- let t = Y(e.nodes);
1700
- return t.text ||= (e) => e.text, t;
1701
- }
1702
- static marksFromSchema(e) {
1703
- return Y(e.marks);
1704
- }
1705
- };
1706
- function Y(e) {
1707
- let t = {};
1708
- for (let n in e) {
1709
- let r = e[n].spec.toDOM;
1710
- r && (t[n] = r);
1711
- }
1712
- return t;
1713
- }
1714
- function X(e) {
1715
- return e.document || window.document;
1716
- }
1717
- var Z = /* @__PURE__ */ new WeakMap();
1718
- function Q(e) {
1719
- let t = Z.get(e);
1720
- return t === void 0 && Z.set(e, t = Te(e)), t;
1721
- }
1722
- function Te(e) {
1723
- let t = null;
1724
- function n(e) {
1725
- if (e && typeof e == "object") {
1726
- if (Array.isArray(e)) {
1727
- if (typeof e[0] == "string") t ||= [], t.push(e);
1728
- else for (let t = 0; t < e.length; t++) n(e[t]);
1729
- } else for (let t in e) n(e[t]);
1730
- }
1731
- }
1732
- return n(e), t;
1733
- }
1734
- function $(e, t, n, r) {
1735
- if (t.nodeType == 1) return { dom: t };
1736
- if (t.dom && t.dom.nodeType == 1) return t;
1737
- let i = t[0], a;
1738
- if (typeof i != "string") throw RangeError("Invalid array passed to renderSpec");
1739
- if (r && (a = Q(r)) && a.indexOf(t) > -1) throw RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");
1740
- let o = i.indexOf(" ");
1741
- o > 0 && (n = i.slice(0, o), i = i.slice(o + 1));
1742
- let s, c = n ? e.createElementNS(n, i) : e.createElement(i), l = t[1], u = 1;
1743
- if (l && typeof l == "object" && l.nodeType == null && !Array.isArray(l)) {
1744
- u = 2;
1745
- for (let e in l) if (l[e] != null) {
1746
- let t = e.indexOf(" ");
1747
- t > 0 ? c.setAttributeNS(e.slice(0, t), e.slice(t + 1), l[e]) : e == "style" && c.style ? c.style.cssText = l[e] : c.setAttribute(e, l[e]);
1748
- }
1749
- }
1750
- for (let i = u; i < t.length; i++) {
1751
- let a = t[i];
1752
- if (a === 0) {
1753
- if (i < t.length - 1 || i > u) throw RangeError("Content hole must be the only child of its parent node");
1754
- return {
1755
- dom: c,
1756
- contentDOM: c
1757
- };
1758
- }
1759
- if (typeof a == "string") c.appendChild(e.createTextNode(a));
1760
- else {
1761
- let { dom: t, contentDOM: i } = $(e, a, n, r);
1762
- if (c.appendChild(t), i) {
1763
- if (s) throw RangeError("Multiple content holes");
1764
- s = i;
1765
- }
1766
- }
1767
- }
1768
- return {
1769
- dom: c,
1770
- contentDOM: s
1771
- };
1772
- }
1773
- export { O as ContentMatch, be as DOMParser, we as DOMSerializer, a as Fragment, l as Mark, L as MarkType, T as Node, w as NodeRange, I as NodeType, u as ReplaceError, S as ResolvedPos, _e as Schema, d as Slice };
1774
-
1775
- //# sourceMappingURL=index.js.map