@vonage/vivid 5.7.0 → 5.9.0

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 (123) hide show
  1. package/bundled/data-grid.options.cjs +1 -0
  2. package/bundled/data-grid.options.js +29 -0
  3. package/bundled/definition19.cjs +3 -4
  4. package/bundled/definition19.js +35 -52
  5. package/bundled/definition2.cjs +1 -1
  6. package/bundled/definition2.js +1 -1
  7. package/bundled/definition3.cjs +1 -1
  8. package/bundled/definition3.js +1 -1
  9. package/bundled/definition8.cjs +1 -1
  10. package/bundled/definition8.js +1 -1
  11. package/bundled/definition9.cjs +9 -9
  12. package/bundled/definition9.js +113 -1342
  13. package/bundled/feature.cjs +4 -0
  14. package/bundled/feature.js +2886 -0
  15. package/bundled/floating-ui.dom.cjs +1 -0
  16. package/bundled/floating-ui.dom.js +1242 -0
  17. package/bundled/listbox.cjs +1 -1
  18. package/bundled/listbox.js +49 -22
  19. package/bundled/localized.cjs +1 -1
  20. package/bundled/localized.js +15 -13
  21. package/bundled/vivid-element.cjs +3 -3
  22. package/bundled/vivid-element.js +89 -69
  23. package/checkbox/definition.cjs +1 -1
  24. package/checkbox/definition.js +1 -1
  25. package/combobox/definition.cjs +14 -15
  26. package/combobox/definition.js +15 -16
  27. package/combobox/index.cjs +4 -4
  28. package/combobox/index.js +82 -87
  29. package/contextual-help/definition.cjs +1 -0
  30. package/contextual-help/definition.js +1 -1
  31. package/custom-elements.json +5145 -3781
  32. package/data-grid/definition.cjs +23 -49
  33. package/data-grid/definition.js +1 -27
  34. package/data-grid/index.cjs +27 -27
  35. package/data-grid/index.js +44 -64
  36. package/data-table/definition.cjs +204 -0
  37. package/data-table/definition.js +188 -0
  38. package/data-table/index.cjs +37 -0
  39. package/data-table/index.js +143 -0
  40. package/file-picker/definition.cjs +10 -8
  41. package/file-picker/definition.js +10 -8
  42. package/file-picker/index.cjs +5 -5
  43. package/file-picker/index.js +12 -12
  44. package/icon/definition.cjs +1 -1
  45. package/icon/definition.js +1 -1
  46. package/index.cjs +26 -0
  47. package/index.js +4 -0
  48. package/lib/components.d.ts +4 -0
  49. package/lib/contextual-help/definition.d.ts +2 -0
  50. package/lib/data-table/definition.d.ts +8 -0
  51. package/lib/data-table/table-body.d.ts +3 -0
  52. package/lib/data-table/table-body.template.d.ts +3 -0
  53. package/lib/data-table/table-cell.d.ts +381 -0
  54. package/lib/data-table/table-cell.template.d.ts +3 -0
  55. package/lib/data-table/table-head.d.ts +3 -0
  56. package/lib/data-table/table-head.template.d.ts +3 -0
  57. package/lib/data-table/table-header-cell.d.ts +381 -0
  58. package/lib/data-table/table-header-cell.template.d.ts +3 -0
  59. package/lib/data-table/table-row.d.ts +381 -0
  60. package/lib/data-table/table-row.template.d.ts +3 -0
  61. package/lib/data-table/table.d.ts +3 -0
  62. package/lib/data-table/table.template.d.ts +3 -0
  63. package/lib/popover/definition.d.ts +4 -0
  64. package/lib/popover/locale.d.ts +3 -0
  65. package/lib/popover/popover.d.ts +781 -0
  66. package/lib/popover/popover.template.d.ts +3 -0
  67. package/lib/rich-text-editor/locale.d.ts +0 -1
  68. package/lib/rich-text-editor/rte/config.d.ts +3 -0
  69. package/lib/rich-text-editor/rte/document.d.ts +2 -0
  70. package/lib/rich-text-editor/rte/exports.d.ts +1 -0
  71. package/lib/rich-text-editor/rte/view.d.ts +30 -0
  72. package/lib/rich-text-view/definition.d.ts +4 -0
  73. package/lib/rich-text-view/rich-text-view.d.ts +15 -0
  74. package/lib/rich-text-view/rich-text-view.template.d.ts +3 -0
  75. package/lib/tag-name-map.d.ts +10 -1
  76. package/locales/de-DE.cjs +3 -1
  77. package/locales/de-DE.js +3 -1
  78. package/locales/en-GB.cjs +3 -1
  79. package/locales/en-GB.js +3 -1
  80. package/locales/en-US.cjs +3 -1
  81. package/locales/en-US.js +3 -1
  82. package/locales/ja-JP.cjs +3 -1
  83. package/locales/ja-JP.js +3 -1
  84. package/locales/zh-CN.cjs +3 -1
  85. package/locales/zh-CN.js +3 -1
  86. package/package.json +8 -12
  87. package/popover/definition.cjs +363 -0
  88. package/popover/definition.js +357 -0
  89. package/popover/index.cjs +27 -0
  90. package/popover/index.js +263 -0
  91. package/rich-text-editor/definition.cjs +328 -3882
  92. package/rich-text-editor/definition.js +143 -3697
  93. package/rich-text-editor/index.cjs +12 -15
  94. package/rich-text-editor/index.js +3489 -6291
  95. package/rich-text-view/definition.cjs +159 -0
  96. package/rich-text-view/definition.js +153 -0
  97. package/rich-text-view/index.cjs +1 -0
  98. package/rich-text-view/index.js +95 -0
  99. package/select/definition.cjs +27 -15
  100. package/select/definition.js +27 -15
  101. package/shared/foundation/listbox/listbox.d.ts +0 -1
  102. package/shared/localization/Locale.d.ts +2 -0
  103. package/tag/definition.cjs +1 -1
  104. package/tag/definition.js +1 -1
  105. package/tag/index.cjs +1 -1
  106. package/tag/index.js +1 -1
  107. package/unbundled/_commonjsHelpers.cjs +26 -0
  108. package/unbundled/_commonjsHelpers.js +26 -1
  109. package/unbundled/data-grid.options.cjs +34 -0
  110. package/unbundled/data-grid.options.js +28 -0
  111. package/unbundled/definition.cjs +1 -1
  112. package/unbundled/definition.js +1 -1
  113. package/unbundled/feature.cjs +3678 -0
  114. package/unbundled/feature.js +3662 -0
  115. package/unbundled/listbox.cjs +29 -2
  116. package/unbundled/listbox.js +29 -2
  117. package/unbundled/vivid-element.cjs +1 -1
  118. package/unbundled/vivid-element.js +1 -1
  119. package/video-player/definition.cjs +11 -1
  120. package/video-player/definition.js +12 -2
  121. package/video-player/index.cjs +30 -30
  122. package/video-player/index.js +705 -702
  123. package/vivid.api.json +1478 -39
@@ -0,0 +1,2886 @@
1
+ function d(s) {
2
+ this.content = s;
3
+ }
4
+ d.prototype = {
5
+ constructor: d,
6
+ find: function(s) {
7
+ for (var t = 0; t < this.content.length; t += 2)
8
+ if (this.content[t] === s) return t;
9
+ return -1;
10
+ },
11
+ // :: (string) → ?any
12
+ // Retrieve the value stored under `key`, or return undefined when
13
+ // no such key exists.
14
+ get: function(s) {
15
+ var t = this.find(s);
16
+ return t == -1 ? void 0 : this.content[t + 1];
17
+ },
18
+ // :: (string, any, ?string) → OrderedMap
19
+ // Create a new map by replacing the value of `key` with a new
20
+ // value, or adding a binding to the end of the map. If `newKey` is
21
+ // given, the key of the binding will be replaced with that key.
22
+ update: function(s, t, e) {
23
+ var n = e && e != s ? this.remove(e) : this, i = n.find(s), r = n.content.slice();
24
+ return i == -1 ? r.push(e || s, t) : (r[i + 1] = t, e && (r[i] = e)), new d(r);
25
+ },
26
+ // :: (string) → OrderedMap
27
+ // Return a map with the given key removed, if it existed.
28
+ remove: function(s) {
29
+ var t = this.find(s);
30
+ if (t == -1) return this;
31
+ var e = this.content.slice();
32
+ return e.splice(t, 2), new d(e);
33
+ },
34
+ // :: (string, any) → OrderedMap
35
+ // Add a new key to the start of the map.
36
+ addToStart: function(s, t) {
37
+ return new d([s, t].concat(this.remove(s).content));
38
+ },
39
+ // :: (string, any) → OrderedMap
40
+ // Add a new key to the end of the map.
41
+ addToEnd: function(s, t) {
42
+ var e = this.remove(s).content.slice();
43
+ return e.push(s, t), new d(e);
44
+ },
45
+ // :: (string, string, any) → OrderedMap
46
+ // Add a key after the given key. If `place` is not found, the new
47
+ // key is added to the end.
48
+ addBefore: function(s, t, e) {
49
+ var n = this.remove(t), i = n.content.slice(), r = n.find(s);
50
+ return i.splice(r == -1 ? i.length : r, 0, t, e), new d(i);
51
+ },
52
+ // :: ((key: string, value: any))
53
+ // Call the given function for each key/value pair in the map, in
54
+ // order.
55
+ forEach: function(s) {
56
+ for (var t = 0; t < this.content.length; t += 2)
57
+ s(this.content[t], this.content[t + 1]);
58
+ },
59
+ // :: (union<Object, OrderedMap>) → OrderedMap
60
+ // Create a new map by prepending the keys in this map that don't
61
+ // appear in `map` before the keys in `map`.
62
+ prepend: function(s) {
63
+ return s = d.from(s), s.size ? new d(s.content.concat(this.subtract(s).content)) : this;
64
+ },
65
+ // :: (union<Object, OrderedMap>) → OrderedMap
66
+ // Create a new map by appending the keys in this map that don't
67
+ // appear in `map` after the keys in `map`.
68
+ append: function(s) {
69
+ return s = d.from(s), s.size ? new d(this.subtract(s).content.concat(s.content)) : this;
70
+ },
71
+ // :: (union<Object, OrderedMap>) → OrderedMap
72
+ // Create a map containing all the keys in this map that don't
73
+ // appear in `map`.
74
+ subtract: function(s) {
75
+ var t = this;
76
+ s = d.from(s);
77
+ for (var e = 0; e < s.content.length; e += 2)
78
+ t = t.remove(s.content[e]);
79
+ return t;
80
+ },
81
+ // :: () → Object
82
+ // Turn ordered map into a plain object.
83
+ toObject: function() {
84
+ var s = {};
85
+ return this.forEach(function(t, e) {
86
+ s[t] = e;
87
+ }), s;
88
+ },
89
+ // :: number
90
+ // The amount of keys in this map.
91
+ get size() {
92
+ return this.content.length >> 1;
93
+ }
94
+ };
95
+ d.from = function(s) {
96
+ if (s instanceof d) return s;
97
+ var t = [];
98
+ if (s) for (var e in s) t.push(e, s[e]);
99
+ return new d(t);
100
+ };
101
+ function Z(s, t, e) {
102
+ for (let n = 0; ; n++) {
103
+ if (n == s.childCount || n == t.childCount)
104
+ return s.childCount == t.childCount ? null : e;
105
+ let i = s.child(n), r = t.child(n);
106
+ if (i == r) {
107
+ e += i.nodeSize;
108
+ continue;
109
+ }
110
+ if (!i.sameMarkup(r))
111
+ return e;
112
+ if (i.isText && i.text != r.text) {
113
+ for (let l = 0; i.text[l] == r.text[l]; l++)
114
+ e++;
115
+ return e;
116
+ }
117
+ if (i.content.size || r.content.size) {
118
+ let l = Z(i.content, r.content, e + 1);
119
+ if (l != null)
120
+ return l;
121
+ }
122
+ e += i.nodeSize;
123
+ }
124
+ }
125
+ function K(s, t, e, n) {
126
+ for (let i = s.childCount, r = t.childCount; ; ) {
127
+ if (i == 0 || r == 0)
128
+ return i == r ? null : { a: e, b: n };
129
+ let l = s.child(--i), o = t.child(--r), h = l.nodeSize;
130
+ if (l == o) {
131
+ e -= h, n -= h;
132
+ continue;
133
+ }
134
+ if (!l.sameMarkup(o))
135
+ return { a: e, b: n };
136
+ if (l.isText && l.text != o.text) {
137
+ let a = 0, f = Math.min(l.text.length, o.text.length);
138
+ for (; a < f && l.text[l.text.length - a - 1] == o.text[o.text.length - a - 1]; )
139
+ a++, e--, n--;
140
+ return { a: e, b: n };
141
+ }
142
+ if (l.content.size || o.content.size) {
143
+ let a = K(l.content, o.content, e - 1, n - 1);
144
+ if (a)
145
+ return a;
146
+ }
147
+ e -= h, n -= h;
148
+ }
149
+ }
150
+ class c {
151
+ /**
152
+ @internal
153
+ */
154
+ constructor(t, e) {
155
+ if (this.content = t, this.size = e || 0, e == null)
156
+ for (let n = 0; n < t.length; n++)
157
+ this.size += t[n].nodeSize;
158
+ }
159
+ /**
160
+ Invoke a callback for all descendant nodes between the given two
161
+ positions (relative to start of this fragment). Doesn't descend
162
+ into a node when the callback returns `false`.
163
+ */
164
+ nodesBetween(t, e, n, i = 0, r) {
165
+ for (let l = 0, o = 0; o < e; l++) {
166
+ let h = this.content[l], a = o + h.nodeSize;
167
+ if (a > t && n(h, i + o, r || null, l) !== !1 && h.content.size) {
168
+ let f = o + 1;
169
+ h.nodesBetween(Math.max(0, t - f), Math.min(h.content.size, e - f), n, i + f);
170
+ }
171
+ o = a;
172
+ }
173
+ }
174
+ /**
175
+ Call the given callback for every descendant node. `pos` will be
176
+ relative to the start of the fragment. The callback may return
177
+ `false` to prevent traversal of a given node's children.
178
+ */
179
+ descendants(t) {
180
+ this.nodesBetween(0, this.size, t);
181
+ }
182
+ /**
183
+ Extract the text between `from` and `to`. See the same method on
184
+ [`Node`](https://prosemirror.net/docs/ref/#model.Node.textBetween).
185
+ */
186
+ textBetween(t, e, n, i) {
187
+ let r = "", l = !0;
188
+ return this.nodesBetween(t, e, (o, h) => {
189
+ let a = o.isText ? o.text.slice(Math.max(t, h) - h, e - h) : o.isLeaf ? i ? typeof i == "function" ? i(o) : i : o.type.spec.leafText ? o.type.spec.leafText(o) : "" : "";
190
+ o.isBlock && (o.isLeaf && a || o.isTextblock) && n && (l ? l = !1 : r += n), r += a;
191
+ }, 0), r;
192
+ }
193
+ /**
194
+ Create a new fragment containing the combined content of this
195
+ fragment and the other.
196
+ */
197
+ append(t) {
198
+ if (!t.size)
199
+ return this;
200
+ if (!this.size)
201
+ return t;
202
+ let e = this.lastChild, n = t.firstChild, i = this.content.slice(), r = 0;
203
+ for (e.isText && e.sameMarkup(n) && (i[i.length - 1] = e.withText(e.text + n.text), r = 1); r < t.content.length; r++)
204
+ i.push(t.content[r]);
205
+ return new c(i, this.size + t.size);
206
+ }
207
+ /**
208
+ Cut out the sub-fragment between the two given positions.
209
+ */
210
+ cut(t, e = this.size) {
211
+ if (t == 0 && e == this.size)
212
+ return this;
213
+ let n = [], i = 0;
214
+ if (e > t)
215
+ for (let r = 0, l = 0; l < e; r++) {
216
+ let o = this.content[r], h = l + o.nodeSize;
217
+ h > t && ((l < t || h > e) && (o.isText ? o = o.cut(Math.max(0, t - l), Math.min(o.text.length, e - l)) : o = o.cut(Math.max(0, t - l - 1), Math.min(o.content.size, e - l - 1))), n.push(o), i += o.nodeSize), l = h;
218
+ }
219
+ return new c(n, i);
220
+ }
221
+ /**
222
+ @internal
223
+ */
224
+ cutByIndex(t, e) {
225
+ return t == e ? c.empty : t == 0 && e == this.content.length ? this : new c(this.content.slice(t, e));
226
+ }
227
+ /**
228
+ Create a new fragment in which the node at the given index is
229
+ replaced by the given node.
230
+ */
231
+ replaceChild(t, e) {
232
+ let n = this.content[t];
233
+ if (n == e)
234
+ return this;
235
+ let i = this.content.slice(), r = this.size + e.nodeSize - n.nodeSize;
236
+ return i[t] = e, new c(i, r);
237
+ }
238
+ /**
239
+ Create a new fragment by prepending the given node to this
240
+ fragment.
241
+ */
242
+ addToStart(t) {
243
+ return new c([t].concat(this.content), this.size + t.nodeSize);
244
+ }
245
+ /**
246
+ Create a new fragment by appending the given node to this
247
+ fragment.
248
+ */
249
+ addToEnd(t) {
250
+ return new c(this.content.concat(t), this.size + t.nodeSize);
251
+ }
252
+ /**
253
+ Compare this fragment to another one.
254
+ */
255
+ eq(t) {
256
+ if (this.content.length != t.content.length)
257
+ return !1;
258
+ for (let e = 0; e < this.content.length; e++)
259
+ if (!this.content[e].eq(t.content[e]))
260
+ return !1;
261
+ return !0;
262
+ }
263
+ /**
264
+ The first child of the fragment, or `null` if it is empty.
265
+ */
266
+ get firstChild() {
267
+ return this.content.length ? this.content[0] : null;
268
+ }
269
+ /**
270
+ The last child of the fragment, or `null` if it is empty.
271
+ */
272
+ get lastChild() {
273
+ return this.content.length ? this.content[this.content.length - 1] : null;
274
+ }
275
+ /**
276
+ The number of child nodes in this fragment.
277
+ */
278
+ get childCount() {
279
+ return this.content.length;
280
+ }
281
+ /**
282
+ Get the child node at the given index. Raise an error when the
283
+ index is out of range.
284
+ */
285
+ child(t) {
286
+ let e = this.content[t];
287
+ if (!e)
288
+ throw new RangeError("Index " + t + " out of range for " + this);
289
+ return e;
290
+ }
291
+ /**
292
+ Get the child node at the given index, if it exists.
293
+ */
294
+ maybeChild(t) {
295
+ return this.content[t] || null;
296
+ }
297
+ /**
298
+ Call `f` for every child node, passing the node, its offset
299
+ into this parent node, and its index.
300
+ */
301
+ forEach(t) {
302
+ for (let e = 0, n = 0; e < this.content.length; e++) {
303
+ let i = this.content[e];
304
+ t(i, n, e), n += i.nodeSize;
305
+ }
306
+ }
307
+ /**
308
+ Find the first position at which this fragment and another
309
+ fragment differ, or `null` if they are the same.
310
+ */
311
+ findDiffStart(t, e = 0) {
312
+ return Z(this, t, e);
313
+ }
314
+ /**
315
+ Find the first position, searching from the end, at which this
316
+ fragment and the given fragment differ, or `null` if they are
317
+ the same. Since this position will not be the same in both
318
+ nodes, an object with two separate positions is returned.
319
+ */
320
+ findDiffEnd(t, e = this.size, n = t.size) {
321
+ return K(this, t, e, n);
322
+ }
323
+ /**
324
+ Find the index and inner offset corresponding to a given relative
325
+ position in this fragment. The result object will be reused
326
+ (overwritten) the next time the function is called. @internal
327
+ */
328
+ findIndex(t) {
329
+ if (t == 0)
330
+ return O(0, t);
331
+ if (t == this.size)
332
+ return O(this.content.length, t);
333
+ if (t > this.size || t < 0)
334
+ throw new RangeError(`Position ${t} outside of fragment (${this})`);
335
+ for (let e = 0, n = 0; ; e++) {
336
+ let i = this.child(e), r = n + i.nodeSize;
337
+ if (r >= t)
338
+ return r == t ? O(e + 1, r) : O(e, n);
339
+ n = r;
340
+ }
341
+ }
342
+ /**
343
+ Return a debugging string that describes this fragment.
344
+ */
345
+ toString() {
346
+ return "<" + this.toStringInner() + ">";
347
+ }
348
+ /**
349
+ @internal
350
+ */
351
+ toStringInner() {
352
+ return this.content.join(", ");
353
+ }
354
+ /**
355
+ Create a JSON-serializeable representation of this fragment.
356
+ */
357
+ toJSON() {
358
+ return this.content.length ? this.content.map((t) => t.toJSON()) : null;
359
+ }
360
+ /**
361
+ Deserialize a fragment from its JSON representation.
362
+ */
363
+ static fromJSON(t, e) {
364
+ if (!e)
365
+ return c.empty;
366
+ if (!Array.isArray(e))
367
+ throw new RangeError("Invalid input for Fragment.fromJSON");
368
+ return new c(e.map(t.nodeFromJSON));
369
+ }
370
+ /**
371
+ Build a fragment from an array of nodes. Ensures that adjacent
372
+ text nodes with the same marks are joined together.
373
+ */
374
+ static fromArray(t) {
375
+ if (!t.length)
376
+ return c.empty;
377
+ let e, n = 0;
378
+ for (let i = 0; i < t.length; i++) {
379
+ let r = t[i];
380
+ n += r.nodeSize, i && r.isText && t[i - 1].sameMarkup(r) ? (e || (e = t.slice(0, i)), e[e.length - 1] = r.withText(e[e.length - 1].text + r.text)) : e && e.push(r);
381
+ }
382
+ return new c(e || t, n);
383
+ }
384
+ /**
385
+ Create a fragment from something that can be interpreted as a
386
+ set of nodes. For `null`, it returns the empty fragment. For a
387
+ fragment, the fragment itself. For a node or array of nodes, a
388
+ fragment containing those nodes.
389
+ */
390
+ static from(t) {
391
+ if (!t)
392
+ return c.empty;
393
+ if (t instanceof c)
394
+ return t;
395
+ if (Array.isArray(t))
396
+ return this.fromArray(t);
397
+ if (t.attrs)
398
+ return new c([t], t.nodeSize);
399
+ throw new RangeError("Can not convert " + t + " to a Fragment" + (t.nodesBetween ? " (looks like multiple versions of prosemirror-model were loaded)" : ""));
400
+ }
401
+ }
402
+ c.empty = new c([], 0);
403
+ const R = { index: 0, offset: 0 };
404
+ function O(s, t) {
405
+ return R.index = s, R.offset = t, R;
406
+ }
407
+ function v(s, t) {
408
+ if (s === t)
409
+ return !0;
410
+ if (!(s && typeof s == "object") || !(t && typeof t == "object"))
411
+ return !1;
412
+ let e = Array.isArray(s);
413
+ if (Array.isArray(t) != e)
414
+ return !1;
415
+ if (e) {
416
+ if (s.length != t.length)
417
+ return !1;
418
+ for (let n = 0; n < s.length; n++)
419
+ if (!v(s[n], t[n]))
420
+ return !1;
421
+ } else {
422
+ for (let n in s)
423
+ if (!(n in t) || !v(s[n], t[n]))
424
+ return !1;
425
+ for (let n in t)
426
+ if (!(n in s))
427
+ return !1;
428
+ }
429
+ return !0;
430
+ }
431
+ class u {
432
+ /**
433
+ @internal
434
+ */
435
+ constructor(t, e) {
436
+ this.type = t, this.attrs = e;
437
+ }
438
+ /**
439
+ Given a set of marks, create a new set which contains this one as
440
+ well, in the right position. If this mark is already in the set,
441
+ the set itself is returned. If any marks that are set to be
442
+ [exclusive](https://prosemirror.net/docs/ref/#model.MarkSpec.excludes) with this mark are present,
443
+ those are replaced by this one.
444
+ */
445
+ addToSet(t) {
446
+ let e, n = !1;
447
+ for (let i = 0; i < t.length; i++) {
448
+ let r = t[i];
449
+ if (this.eq(r))
450
+ return t;
451
+ if (this.type.excludes(r.type))
452
+ e || (e = t.slice(0, i));
453
+ else {
454
+ if (r.type.excludes(this.type))
455
+ return t;
456
+ !n && r.type.rank > this.type.rank && (e || (e = t.slice(0, i)), e.push(this), n = !0), e && e.push(r);
457
+ }
458
+ }
459
+ return e || (e = t.slice()), n || e.push(this), e;
460
+ }
461
+ /**
462
+ Remove this mark from the given set, returning a new set. If this
463
+ mark is not in the set, the set itself is returned.
464
+ */
465
+ removeFromSet(t) {
466
+ for (let e = 0; e < t.length; e++)
467
+ if (this.eq(t[e]))
468
+ return t.slice(0, e).concat(t.slice(e + 1));
469
+ return t;
470
+ }
471
+ /**
472
+ Test whether this mark is in the given set of marks.
473
+ */
474
+ isInSet(t) {
475
+ for (let e = 0; e < t.length; e++)
476
+ if (this.eq(t[e]))
477
+ return !0;
478
+ return !1;
479
+ }
480
+ /**
481
+ Test whether this mark has the same type and attributes as
482
+ another mark.
483
+ */
484
+ eq(t) {
485
+ return this == t || this.type == t.type && v(this.attrs, t.attrs);
486
+ }
487
+ /**
488
+ Convert this mark to a JSON-serializeable representation.
489
+ */
490
+ toJSON() {
491
+ let t = { type: this.type.name };
492
+ for (let e in this.attrs) {
493
+ t.attrs = this.attrs;
494
+ break;
495
+ }
496
+ return t;
497
+ }
498
+ /**
499
+ Deserialize a mark from JSON.
500
+ */
501
+ static fromJSON(t, e) {
502
+ if (!e)
503
+ throw new RangeError("Invalid input for Mark.fromJSON");
504
+ let n = t.marks[e.type];
505
+ if (!n)
506
+ throw new RangeError(`There is no mark type ${e.type} in this schema`);
507
+ let i = n.create(e.attrs);
508
+ return n.checkAttrs(i.attrs), i;
509
+ }
510
+ /**
511
+ Test whether two sets of marks are identical.
512
+ */
513
+ static sameSet(t, e) {
514
+ if (t == e)
515
+ return !0;
516
+ if (t.length != e.length)
517
+ return !1;
518
+ for (let n = 0; n < t.length; n++)
519
+ if (!t[n].eq(e[n]))
520
+ return !1;
521
+ return !0;
522
+ }
523
+ /**
524
+ Create a properly sorted mark set from null, a single mark, or an
525
+ unsorted array of marks.
526
+ */
527
+ static setFrom(t) {
528
+ if (!t || Array.isArray(t) && t.length == 0)
529
+ return u.none;
530
+ if (t instanceof u)
531
+ return [t];
532
+ let e = t.slice();
533
+ return e.sort((n, i) => n.type.rank - i.type.rank), e;
534
+ }
535
+ }
536
+ u.none = [];
537
+ class D extends Error {
538
+ }
539
+ class g {
540
+ /**
541
+ Create a slice. When specifying a non-zero open depth, you must
542
+ make sure that there are nodes of at least that depth at the
543
+ appropriate side of the fragment—i.e. if the fragment is an
544
+ empty paragraph node, `openStart` and `openEnd` can't be greater
545
+ than 1.
546
+
547
+ It is not necessary for the content of open nodes to conform to
548
+ the schema's content constraints, though it should be a valid
549
+ start/end/middle for such a node, depending on which sides are
550
+ open.
551
+ */
552
+ constructor(t, e, n) {
553
+ this.content = t, this.openStart = e, this.openEnd = n;
554
+ }
555
+ /**
556
+ The size this slice would add when inserted into a document.
557
+ */
558
+ get size() {
559
+ return this.content.size - this.openStart - this.openEnd;
560
+ }
561
+ /**
562
+ @internal
563
+ */
564
+ insertAt(t, e) {
565
+ let n = $(this.content, t + this.openStart, e);
566
+ return n && new g(n, this.openStart, this.openEnd);
567
+ }
568
+ /**
569
+ @internal
570
+ */
571
+ removeBetween(t, e) {
572
+ return new g(_(this.content, t + this.openStart, e + this.openStart), this.openStart, this.openEnd);
573
+ }
574
+ /**
575
+ Tests whether this slice is equal to another slice.
576
+ */
577
+ eq(t) {
578
+ return this.content.eq(t.content) && this.openStart == t.openStart && this.openEnd == t.openEnd;
579
+ }
580
+ /**
581
+ @internal
582
+ */
583
+ toString() {
584
+ return this.content + "(" + this.openStart + "," + this.openEnd + ")";
585
+ }
586
+ /**
587
+ Convert a slice to a JSON-serializable representation.
588
+ */
589
+ toJSON() {
590
+ if (!this.content.size)
591
+ return null;
592
+ let t = { content: this.content.toJSON() };
593
+ return this.openStart > 0 && (t.openStart = this.openStart), this.openEnd > 0 && (t.openEnd = this.openEnd), t;
594
+ }
595
+ /**
596
+ Deserialize a slice from its JSON representation.
597
+ */
598
+ static fromJSON(t, e) {
599
+ if (!e)
600
+ return g.empty;
601
+ let n = e.openStart || 0, i = e.openEnd || 0;
602
+ if (typeof n != "number" || typeof i != "number")
603
+ throw new RangeError("Invalid input for Slice.fromJSON");
604
+ return new g(c.fromJSON(t, e.content), n, i);
605
+ }
606
+ /**
607
+ Create a slice from a fragment by taking the maximum possible
608
+ open value on both side of the fragment.
609
+ */
610
+ static maxOpen(t, e = !0) {
611
+ let n = 0, i = 0;
612
+ for (let r = t.firstChild; r && !r.isLeaf && (e || !r.type.spec.isolating); r = r.firstChild)
613
+ n++;
614
+ for (let r = t.lastChild; r && !r.isLeaf && (e || !r.type.spec.isolating); r = r.lastChild)
615
+ i++;
616
+ return new g(t, n, i);
617
+ }
618
+ }
619
+ g.empty = new g(c.empty, 0, 0);
620
+ function _(s, t, e) {
621
+ let { index: n, offset: i } = s.findIndex(t), r = s.maybeChild(n), { index: l, offset: o } = s.findIndex(e);
622
+ if (i == t || r.isText) {
623
+ if (o != e && !s.child(l).isText)
624
+ throw new RangeError("Removing non-flat range");
625
+ return s.cut(0, t).append(s.cut(e));
626
+ }
627
+ if (n != l)
628
+ throw new RangeError("Removing non-flat range");
629
+ return s.replaceChild(n, r.copy(_(r.content, t - i - 1, e - i - 1)));
630
+ }
631
+ function $(s, t, e, n) {
632
+ let { index: i, offset: r } = s.findIndex(t), l = s.maybeChild(i);
633
+ if (r == t || l.isText)
634
+ return n && !n.canReplace(i, i, e) ? null : s.cut(0, t).append(e).append(s.cut(t));
635
+ let o = $(l.content, t - r - 1, e, l);
636
+ return o && s.replaceChild(i, l.copy(o));
637
+ }
638
+ function dt(s, t, e) {
639
+ if (e.openStart > s.depth)
640
+ throw new D("Inserted content deeper than insertion position");
641
+ if (s.depth - e.openStart != t.depth - e.openEnd)
642
+ throw new D("Inconsistent open depths");
643
+ return tt(s, t, e, 0);
644
+ }
645
+ function tt(s, t, e, n) {
646
+ let i = s.index(n), r = s.node(n);
647
+ if (i == t.index(n) && n < s.depth - e.openStart) {
648
+ let l = tt(s, t, e, n + 1);
649
+ return r.copy(r.content.replaceChild(i, l));
650
+ } else if (e.content.size)
651
+ if (!e.openStart && !e.openEnd && s.depth == n && t.depth == n) {
652
+ let l = s.parent, o = l.content;
653
+ return w(l, o.cut(0, s.parentOffset).append(e.content).append(o.cut(t.parentOffset)));
654
+ } else {
655
+ let { start: l, end: o } = gt(e, s);
656
+ return w(r, nt(s, l, o, t, n));
657
+ }
658
+ else return w(r, N(s, t, n));
659
+ }
660
+ function et(s, t) {
661
+ if (!t.type.compatibleContent(s.type))
662
+ throw new D("Cannot join " + t.type.name + " onto " + s.type.name);
663
+ }
664
+ function P(s, t, e) {
665
+ let n = s.node(e);
666
+ return et(n, t.node(e)), n;
667
+ }
668
+ function m(s, t) {
669
+ let e = t.length - 1;
670
+ e >= 0 && s.isText && s.sameMarkup(t[e]) ? t[e] = s.withText(t[e].text + s.text) : t.push(s);
671
+ }
672
+ function S(s, t, e, n) {
673
+ let i = (t || s).node(e), r = 0, l = t ? t.index(e) : i.childCount;
674
+ s && (r = s.index(e), s.depth > e ? r++ : s.textOffset && (m(s.nodeAfter, n), r++));
675
+ for (let o = r; o < l; o++)
676
+ m(i.child(o), n);
677
+ t && t.depth == e && t.textOffset && m(t.nodeBefore, n);
678
+ }
679
+ function w(s, t) {
680
+ return s.type.checkContent(t), s.copy(t);
681
+ }
682
+ function nt(s, t, e, n, i) {
683
+ let r = s.depth > i && P(s, t, i + 1), l = n.depth > i && P(e, n, i + 1), o = [];
684
+ return S(null, s, i, o), r && l && t.index(i) == e.index(i) ? (et(r, l), m(w(r, nt(s, t, e, n, i + 1)), o)) : (r && m(w(r, N(s, t, i + 1)), o), S(t, e, i, o), l && m(w(l, N(e, n, i + 1)), o)), S(n, null, i, o), new c(o);
685
+ }
686
+ function N(s, t, e) {
687
+ let n = [];
688
+ if (S(null, s, e, n), s.depth > e) {
689
+ let i = P(s, t, e + 1);
690
+ m(w(i, N(s, t, e + 1)), n);
691
+ }
692
+ return S(t, null, e, n), new c(n);
693
+ }
694
+ function gt(s, t) {
695
+ let e = t.depth - s.openStart, i = t.node(e).copy(s.content);
696
+ for (let r = e - 1; r >= 0; r--)
697
+ i = t.node(r).copy(c.from(i));
698
+ return {
699
+ start: i.resolveNoCache(s.openStart + e),
700
+ end: i.resolveNoCache(i.content.size - s.openEnd - e)
701
+ };
702
+ }
703
+ class C {
704
+ /**
705
+ @internal
706
+ */
707
+ constructor(t, e, n) {
708
+ this.pos = t, this.path = e, this.parentOffset = n, this.depth = e.length / 3 - 1;
709
+ }
710
+ /**
711
+ @internal
712
+ */
713
+ resolveDepth(t) {
714
+ return t == null ? this.depth : t < 0 ? this.depth + t : t;
715
+ }
716
+ /**
717
+ The parent node that the position points into. Note that even if
718
+ a position points into a text node, that node is not considered
719
+ the parent—text nodes are ‘flat’ in this model, and have no content.
720
+ */
721
+ get parent() {
722
+ return this.node(this.depth);
723
+ }
724
+ /**
725
+ The root node in which the position was resolved.
726
+ */
727
+ get doc() {
728
+ return this.node(0);
729
+ }
730
+ /**
731
+ The ancestor node at the given level. `p.node(p.depth)` is the
732
+ same as `p.parent`.
733
+ */
734
+ node(t) {
735
+ return this.path[this.resolveDepth(t) * 3];
736
+ }
737
+ /**
738
+ The index into the ancestor at the given level. If this points
739
+ at the 3rd node in the 2nd paragraph on the top level, for
740
+ example, `p.index(0)` is 1 and `p.index(1)` is 2.
741
+ */
742
+ index(t) {
743
+ return this.path[this.resolveDepth(t) * 3 + 1];
744
+ }
745
+ /**
746
+ The index pointing after this position into the ancestor at the
747
+ given level.
748
+ */
749
+ indexAfter(t) {
750
+ return t = this.resolveDepth(t), this.index(t) + (t == this.depth && !this.textOffset ? 0 : 1);
751
+ }
752
+ /**
753
+ The (absolute) position at the start of the node at the given
754
+ level.
755
+ */
756
+ start(t) {
757
+ return t = this.resolveDepth(t), t == 0 ? 0 : this.path[t * 3 - 1] + 1;
758
+ }
759
+ /**
760
+ The (absolute) position at the end of the node at the given
761
+ level.
762
+ */
763
+ end(t) {
764
+ return t = this.resolveDepth(t), this.start(t) + this.node(t).content.size;
765
+ }
766
+ /**
767
+ The (absolute) position directly before the wrapping node at the
768
+ given level, or, when `depth` is `this.depth + 1`, the original
769
+ position.
770
+ */
771
+ before(t) {
772
+ if (t = this.resolveDepth(t), !t)
773
+ throw new RangeError("There is no position before the top-level node");
774
+ return t == this.depth + 1 ? this.pos : this.path[t * 3 - 1];
775
+ }
776
+ /**
777
+ The (absolute) position directly after the wrapping node at the
778
+ given level, or the original position when `depth` is `this.depth + 1`.
779
+ */
780
+ after(t) {
781
+ if (t = this.resolveDepth(t), !t)
782
+ throw new RangeError("There is no position after the top-level node");
783
+ return t == this.depth + 1 ? this.pos : this.path[t * 3 - 1] + this.path[t * 3].nodeSize;
784
+ }
785
+ /**
786
+ When this position points into a text node, this returns the
787
+ distance between the position and the start of the text node.
788
+ Will be zero for positions that point between nodes.
789
+ */
790
+ get textOffset() {
791
+ return this.pos - this.path[this.path.length - 1];
792
+ }
793
+ /**
794
+ Get the node directly after the position, if any. If the position
795
+ points into a text node, only the part of that node after the
796
+ position is returned.
797
+ */
798
+ get nodeAfter() {
799
+ let t = this.parent, e = this.index(this.depth);
800
+ if (e == t.childCount)
801
+ return null;
802
+ let n = this.pos - this.path[this.path.length - 1], i = t.child(e);
803
+ return n ? t.child(e).cut(n) : i;
804
+ }
805
+ /**
806
+ Get the node directly before the position, if any. If the
807
+ position points into a text node, only the part of that node
808
+ before the position is returned.
809
+ */
810
+ get nodeBefore() {
811
+ let t = this.index(this.depth), e = this.pos - this.path[this.path.length - 1];
812
+ return e ? this.parent.child(t).cut(0, e) : t == 0 ? null : this.parent.child(t - 1);
813
+ }
814
+ /**
815
+ Get the position at the given index in the parent node at the
816
+ given depth (which defaults to `this.depth`).
817
+ */
818
+ posAtIndex(t, e) {
819
+ e = this.resolveDepth(e);
820
+ let n = this.path[e * 3], i = e == 0 ? 0 : this.path[e * 3 - 1] + 1;
821
+ for (let r = 0; r < t; r++)
822
+ i += n.child(r).nodeSize;
823
+ return i;
824
+ }
825
+ /**
826
+ Get the marks at this position, factoring in the surrounding
827
+ marks' [`inclusive`](https://prosemirror.net/docs/ref/#model.MarkSpec.inclusive) property. If the
828
+ position is at the start of a non-empty node, the marks of the
829
+ node after it (if any) are returned.
830
+ */
831
+ marks() {
832
+ let t = this.parent, e = this.index();
833
+ if (t.content.size == 0)
834
+ return u.none;
835
+ if (this.textOffset)
836
+ return t.child(e).marks;
837
+ let n = t.maybeChild(e - 1), i = t.maybeChild(e);
838
+ if (!n) {
839
+ let o = n;
840
+ n = i, i = o;
841
+ }
842
+ let r = n.marks;
843
+ for (var l = 0; l < r.length; l++)
844
+ r[l].type.spec.inclusive === !1 && (!i || !r[l].isInSet(i.marks)) && (r = r[l--].removeFromSet(r));
845
+ return r;
846
+ }
847
+ /**
848
+ Get the marks after the current position, if any, except those
849
+ that are non-inclusive and not present at position `$end`. This
850
+ is mostly useful for getting the set of marks to preserve after a
851
+ deletion. Will return `null` if this position is at the end of
852
+ its parent node or its parent node isn't a textblock (in which
853
+ case no marks should be preserved).
854
+ */
855
+ marksAcross(t) {
856
+ let e = this.parent.maybeChild(this.index());
857
+ if (!e || !e.isInline)
858
+ return null;
859
+ let n = e.marks, i = t.parent.maybeChild(t.index());
860
+ for (var r = 0; r < n.length; r++)
861
+ n[r].type.spec.inclusive === !1 && (!i || !n[r].isInSet(i.marks)) && (n = n[r--].removeFromSet(n));
862
+ return n;
863
+ }
864
+ /**
865
+ The depth up to which this position and the given (non-resolved)
866
+ position share the same parent nodes.
867
+ */
868
+ sharedDepth(t) {
869
+ for (let e = this.depth; e > 0; e--)
870
+ if (this.start(e) <= t && this.end(e) >= t)
871
+ return e;
872
+ return 0;
873
+ }
874
+ /**
875
+ Returns a range based on the place where this position and the
876
+ given position diverge around block content. If both point into
877
+ the same textblock, for example, a range around that textblock
878
+ will be returned. If they point into different blocks, the range
879
+ around those blocks in their shared ancestor is returned. You can
880
+ pass in an optional predicate that will be called with a parent
881
+ node to see if a range into that parent is acceptable.
882
+ */
883
+ blockRange(t = this, e) {
884
+ if (t.pos < this.pos)
885
+ return t.blockRange(this);
886
+ for (let n = this.depth - (this.parent.inlineContent || this.pos == t.pos ? 1 : 0); n >= 0; n--)
887
+ if (t.pos <= this.end(n) && (!e || e(this.node(n))))
888
+ return new mt(this, t, n);
889
+ return null;
890
+ }
891
+ /**
892
+ Query whether the given position shares the same parent node.
893
+ */
894
+ sameParent(t) {
895
+ return this.pos - this.parentOffset == t.pos - t.parentOffset;
896
+ }
897
+ /**
898
+ Return the greater of this and the given position.
899
+ */
900
+ max(t) {
901
+ return t.pos > this.pos ? t : this;
902
+ }
903
+ /**
904
+ Return the smaller of this and the given position.
905
+ */
906
+ min(t) {
907
+ return t.pos < this.pos ? t : this;
908
+ }
909
+ /**
910
+ @internal
911
+ */
912
+ toString() {
913
+ let t = "";
914
+ for (let e = 1; e <= this.depth; e++)
915
+ t += (t ? "/" : "") + this.node(e).type.name + "_" + this.index(e - 1);
916
+ return t + ":" + this.parentOffset;
917
+ }
918
+ /**
919
+ @internal
920
+ */
921
+ static resolve(t, e) {
922
+ if (!(e >= 0 && e <= t.content.size))
923
+ throw new RangeError("Position " + e + " out of range");
924
+ let n = [], i = 0, r = e;
925
+ for (let l = t; ; ) {
926
+ let { index: o, offset: h } = l.content.findIndex(r), a = r - h;
927
+ if (n.push(l, o, i + h), !a || (l = l.child(o), l.isText))
928
+ break;
929
+ r = a - 1, i += h + 1;
930
+ }
931
+ return new C(e, n, r);
932
+ }
933
+ /**
934
+ @internal
935
+ */
936
+ static resolveCached(t, e) {
937
+ let n = L.get(t);
938
+ if (n)
939
+ for (let r = 0; r < n.elts.length; r++) {
940
+ let l = n.elts[r];
941
+ if (l.pos == e)
942
+ return l;
943
+ }
944
+ else
945
+ L.set(t, n = new yt());
946
+ let i = n.elts[n.i] = C.resolve(t, e);
947
+ return n.i = (n.i + 1) % xt, i;
948
+ }
949
+ }
950
+ class yt {
951
+ constructor() {
952
+ this.elts = [], this.i = 0;
953
+ }
954
+ }
955
+ const xt = 12, L = /* @__PURE__ */ new WeakMap();
956
+ class mt {
957
+ /**
958
+ Construct a node range. `$from` and `$to` should point into the
959
+ same node until at least the given `depth`, since a node range
960
+ denotes an adjacent set of nodes in a single parent node.
961
+ */
962
+ constructor(t, e, n) {
963
+ this.$from = t, this.$to = e, this.depth = n;
964
+ }
965
+ /**
966
+ The position at the start of the range.
967
+ */
968
+ get start() {
969
+ return this.$from.before(this.depth + 1);
970
+ }
971
+ /**
972
+ The position at the end of the range.
973
+ */
974
+ get end() {
975
+ return this.$to.after(this.depth + 1);
976
+ }
977
+ /**
978
+ The parent node that the range points into.
979
+ */
980
+ get parent() {
981
+ return this.$from.node(this.depth);
982
+ }
983
+ /**
984
+ The start index of the range in the parent node.
985
+ */
986
+ get startIndex() {
987
+ return this.$from.index(this.depth);
988
+ }
989
+ /**
990
+ The end index of the range in the parent node.
991
+ */
992
+ get endIndex() {
993
+ return this.$to.indexAfter(this.depth);
994
+ }
995
+ }
996
+ const wt = /* @__PURE__ */ Object.create(null);
997
+ class x {
998
+ /**
999
+ @internal
1000
+ */
1001
+ constructor(t, e, n, i = u.none) {
1002
+ this.type = t, this.attrs = e, this.marks = i, this.content = n || c.empty;
1003
+ }
1004
+ /**
1005
+ The array of this node's child nodes.
1006
+ */
1007
+ get children() {
1008
+ return this.content.content;
1009
+ }
1010
+ /**
1011
+ The size of this node, as defined by the integer-based [indexing
1012
+ scheme](https://prosemirror.net/docs/guide/#doc.indexing). For text nodes, this is the
1013
+ amount of characters. For other leaf nodes, it is one. For
1014
+ non-leaf nodes, it is the size of the content plus two (the
1015
+ start and end token).
1016
+ */
1017
+ get nodeSize() {
1018
+ return this.isLeaf ? 1 : 2 + this.content.size;
1019
+ }
1020
+ /**
1021
+ The number of children that the node has.
1022
+ */
1023
+ get childCount() {
1024
+ return this.content.childCount;
1025
+ }
1026
+ /**
1027
+ Get the child node at the given index. Raises an error when the
1028
+ index is out of range.
1029
+ */
1030
+ child(t) {
1031
+ return this.content.child(t);
1032
+ }
1033
+ /**
1034
+ Get the child node at the given index, if it exists.
1035
+ */
1036
+ maybeChild(t) {
1037
+ return this.content.maybeChild(t);
1038
+ }
1039
+ /**
1040
+ Call `f` for every child node, passing the node, its offset
1041
+ into this parent node, and its index.
1042
+ */
1043
+ forEach(t) {
1044
+ this.content.forEach(t);
1045
+ }
1046
+ /**
1047
+ Invoke a callback for all descendant nodes recursively between
1048
+ the given two positions that are relative to start of this
1049
+ node's content. The callback is invoked with the node, its
1050
+ position relative to the original node (method receiver),
1051
+ its parent node, and its child index. When the callback returns
1052
+ false for a given node, that node's children will not be
1053
+ recursed over. The last parameter can be used to specify a
1054
+ starting position to count from.
1055
+ */
1056
+ nodesBetween(t, e, n, i = 0) {
1057
+ this.content.nodesBetween(t, e, n, i, this);
1058
+ }
1059
+ /**
1060
+ Call the given callback for every descendant node. Doesn't
1061
+ descend into a node when the callback returns `false`.
1062
+ */
1063
+ descendants(t) {
1064
+ this.nodesBetween(0, this.content.size, t);
1065
+ }
1066
+ /**
1067
+ Concatenates all the text nodes found in this fragment and its
1068
+ children.
1069
+ */
1070
+ get textContent() {
1071
+ return this.isLeaf && this.type.spec.leafText ? this.type.spec.leafText(this) : this.textBetween(0, this.content.size, "");
1072
+ }
1073
+ /**
1074
+ Get all text between positions `from` and `to`. When
1075
+ `blockSeparator` is given, it will be inserted to separate text
1076
+ from different block nodes. If `leafText` is given, it'll be
1077
+ inserted for every non-text leaf node encountered, otherwise
1078
+ [`leafText`](https://prosemirror.net/docs/ref/#model.NodeSpec.leafText) will be used.
1079
+ */
1080
+ textBetween(t, e, n, i) {
1081
+ return this.content.textBetween(t, e, n, i);
1082
+ }
1083
+ /**
1084
+ Returns this node's first child, or `null` if there are no
1085
+ children.
1086
+ */
1087
+ get firstChild() {
1088
+ return this.content.firstChild;
1089
+ }
1090
+ /**
1091
+ Returns this node's last child, or `null` if there are no
1092
+ children.
1093
+ */
1094
+ get lastChild() {
1095
+ return this.content.lastChild;
1096
+ }
1097
+ /**
1098
+ Test whether two nodes represent the same piece of document.
1099
+ */
1100
+ eq(t) {
1101
+ return this == t || this.sameMarkup(t) && this.content.eq(t.content);
1102
+ }
1103
+ /**
1104
+ Compare the markup (type, attributes, and marks) of this node to
1105
+ those of another. Returns `true` if both have the same markup.
1106
+ */
1107
+ sameMarkup(t) {
1108
+ return this.hasMarkup(t.type, t.attrs, t.marks);
1109
+ }
1110
+ /**
1111
+ Check whether this node's markup correspond to the given type,
1112
+ attributes, and marks.
1113
+ */
1114
+ hasMarkup(t, e, n) {
1115
+ return this.type == t && v(this.attrs, e || t.defaultAttrs || wt) && u.sameSet(this.marks, n || u.none);
1116
+ }
1117
+ /**
1118
+ Create a new node with the same markup as this node, containing
1119
+ the given content (or empty, if no content is given).
1120
+ */
1121
+ copy(t = null) {
1122
+ return t == this.content ? this : new x(this.type, this.attrs, t, this.marks);
1123
+ }
1124
+ /**
1125
+ Create a copy of this node, with the given set of marks instead
1126
+ of the node's own marks.
1127
+ */
1128
+ mark(t) {
1129
+ return t == this.marks ? this : new x(this.type, this.attrs, this.content, t);
1130
+ }
1131
+ /**
1132
+ Create a copy of this node with only the content between the
1133
+ given positions. If `to` is not given, it defaults to the end of
1134
+ the node.
1135
+ */
1136
+ cut(t, e = this.content.size) {
1137
+ return t == 0 && e == this.content.size ? this : this.copy(this.content.cut(t, e));
1138
+ }
1139
+ /**
1140
+ Cut out the part of the document between the given positions, and
1141
+ return it as a `Slice` object.
1142
+ */
1143
+ slice(t, e = this.content.size, n = !1) {
1144
+ if (t == e)
1145
+ return g.empty;
1146
+ let i = this.resolve(t), r = this.resolve(e), l = n ? 0 : i.sharedDepth(e), o = i.start(l), a = i.node(l).content.cut(i.pos - o, r.pos - o);
1147
+ return new g(a, i.depth - l, r.depth - l);
1148
+ }
1149
+ /**
1150
+ Replace the part of the document between the given positions with
1151
+ the given slice. The slice must 'fit', meaning its open sides
1152
+ must be able to connect to the surrounding content, and its
1153
+ content nodes must be valid children for the node they are placed
1154
+ into. If any of this is violated, an error of type
1155
+ [`ReplaceError`](https://prosemirror.net/docs/ref/#model.ReplaceError) is thrown.
1156
+ */
1157
+ replace(t, e, n) {
1158
+ return dt(this.resolve(t), this.resolve(e), n);
1159
+ }
1160
+ /**
1161
+ Find the node directly after the given position.
1162
+ */
1163
+ nodeAt(t) {
1164
+ for (let e = this; ; ) {
1165
+ let { index: n, offset: i } = e.content.findIndex(t);
1166
+ if (e = e.maybeChild(n), !e)
1167
+ return null;
1168
+ if (i == t || e.isText)
1169
+ return e;
1170
+ t -= i + 1;
1171
+ }
1172
+ }
1173
+ /**
1174
+ Find the (direct) child node after the given offset, if any,
1175
+ and return it along with its index and offset relative to this
1176
+ node.
1177
+ */
1178
+ childAfter(t) {
1179
+ let { index: e, offset: n } = this.content.findIndex(t);
1180
+ return { node: this.content.maybeChild(e), index: e, offset: n };
1181
+ }
1182
+ /**
1183
+ Find the (direct) child node before the given offset, if any,
1184
+ and return it along with its index and offset relative to this
1185
+ node.
1186
+ */
1187
+ childBefore(t) {
1188
+ if (t == 0)
1189
+ return { node: null, index: 0, offset: 0 };
1190
+ let { index: e, offset: n } = this.content.findIndex(t);
1191
+ if (n < t)
1192
+ return { node: this.content.child(e), index: e, offset: n };
1193
+ let i = this.content.child(e - 1);
1194
+ return { node: i, index: e - 1, offset: n - i.nodeSize };
1195
+ }
1196
+ /**
1197
+ Resolve the given position in the document, returning an
1198
+ [object](https://prosemirror.net/docs/ref/#model.ResolvedPos) with information about its context.
1199
+ */
1200
+ resolve(t) {
1201
+ return C.resolveCached(this, t);
1202
+ }
1203
+ /**
1204
+ @internal
1205
+ */
1206
+ resolveNoCache(t) {
1207
+ return C.resolve(this, t);
1208
+ }
1209
+ /**
1210
+ Test whether a given mark or mark type occurs in this document
1211
+ between the two given positions.
1212
+ */
1213
+ rangeHasMark(t, e, n) {
1214
+ let i = !1;
1215
+ return e > t && this.nodesBetween(t, e, (r) => (n.isInSet(r.marks) && (i = !0), !i)), i;
1216
+ }
1217
+ /**
1218
+ True when this is a block (non-inline node)
1219
+ */
1220
+ get isBlock() {
1221
+ return this.type.isBlock;
1222
+ }
1223
+ /**
1224
+ True when this is a textblock node, a block node with inline
1225
+ content.
1226
+ */
1227
+ get isTextblock() {
1228
+ return this.type.isTextblock;
1229
+ }
1230
+ /**
1231
+ True when this node allows inline content.
1232
+ */
1233
+ get inlineContent() {
1234
+ return this.type.inlineContent;
1235
+ }
1236
+ /**
1237
+ True when this is an inline node (a text node or a node that can
1238
+ appear among text).
1239
+ */
1240
+ get isInline() {
1241
+ return this.type.isInline;
1242
+ }
1243
+ /**
1244
+ True when this is a text node.
1245
+ */
1246
+ get isText() {
1247
+ return this.type.isText;
1248
+ }
1249
+ /**
1250
+ True when this is a leaf node.
1251
+ */
1252
+ get isLeaf() {
1253
+ return this.type.isLeaf;
1254
+ }
1255
+ /**
1256
+ True when this is an atom, i.e. when it does not have directly
1257
+ editable content. This is usually the same as `isLeaf`, but can
1258
+ be configured with the [`atom` property](https://prosemirror.net/docs/ref/#model.NodeSpec.atom)
1259
+ on a node's spec (typically used when the node is displayed as
1260
+ an uneditable [node view](https://prosemirror.net/docs/ref/#view.NodeView)).
1261
+ */
1262
+ get isAtom() {
1263
+ return this.type.isAtom;
1264
+ }
1265
+ /**
1266
+ Return a string representation of this node for debugging
1267
+ purposes.
1268
+ */
1269
+ toString() {
1270
+ if (this.type.spec.toDebugString)
1271
+ return this.type.spec.toDebugString(this);
1272
+ let t = this.type.name;
1273
+ return this.content.size && (t += "(" + this.content.toStringInner() + ")"), it(this.marks, t);
1274
+ }
1275
+ /**
1276
+ Get the content match in this node at the given index.
1277
+ */
1278
+ contentMatchAt(t) {
1279
+ let e = this.type.contentMatch.matchFragment(this.content, 0, t);
1280
+ if (!e)
1281
+ throw new Error("Called contentMatchAt on a node with invalid content");
1282
+ return e;
1283
+ }
1284
+ /**
1285
+ Test whether replacing the range between `from` and `to` (by
1286
+ child index) with the given replacement fragment (which defaults
1287
+ to the empty fragment) would leave the node's content valid. You
1288
+ can optionally pass `start` and `end` indices into the
1289
+ replacement fragment.
1290
+ */
1291
+ canReplace(t, e, n = c.empty, i = 0, r = n.childCount) {
1292
+ let l = this.contentMatchAt(t).matchFragment(n, i, r), o = l && l.matchFragment(this.content, e);
1293
+ if (!o || !o.validEnd)
1294
+ return !1;
1295
+ for (let h = i; h < r; h++)
1296
+ if (!this.type.allowsMarks(n.child(h).marks))
1297
+ return !1;
1298
+ return !0;
1299
+ }
1300
+ /**
1301
+ Test whether replacing the range `from` to `to` (by index) with
1302
+ a node of the given type would leave the node's content valid.
1303
+ */
1304
+ canReplaceWith(t, e, n, i) {
1305
+ if (i && !this.type.allowsMarks(i))
1306
+ return !1;
1307
+ let r = this.contentMatchAt(t).matchType(n), l = r && r.matchFragment(this.content, e);
1308
+ return l ? l.validEnd : !1;
1309
+ }
1310
+ /**
1311
+ Test whether the given node's content could be appended to this
1312
+ node. If that node is empty, this will only return true if there
1313
+ is at least one node type that can appear in both nodes (to avoid
1314
+ merging completely incompatible nodes).
1315
+ */
1316
+ canAppend(t) {
1317
+ return t.content.size ? this.canReplace(this.childCount, this.childCount, t.content) : this.type.compatibleContent(t.type);
1318
+ }
1319
+ /**
1320
+ Check whether this node and its descendants conform to the
1321
+ schema, and raise an exception when they do not.
1322
+ */
1323
+ check() {
1324
+ this.type.checkContent(this.content), this.type.checkAttrs(this.attrs);
1325
+ let t = u.none;
1326
+ for (let e = 0; e < this.marks.length; e++) {
1327
+ let n = this.marks[e];
1328
+ n.type.checkAttrs(n.attrs), t = n.addToSet(t);
1329
+ }
1330
+ if (!u.sameSet(t, this.marks))
1331
+ throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map((e) => e.type.name)}`);
1332
+ this.content.forEach((e) => e.check());
1333
+ }
1334
+ /**
1335
+ Return a JSON-serializeable representation of this node.
1336
+ */
1337
+ toJSON() {
1338
+ let t = { type: this.type.name };
1339
+ for (let e in this.attrs) {
1340
+ t.attrs = this.attrs;
1341
+ break;
1342
+ }
1343
+ return this.content.size && (t.content = this.content.toJSON()), this.marks.length && (t.marks = this.marks.map((e) => e.toJSON())), t;
1344
+ }
1345
+ /**
1346
+ Deserialize a node from its JSON representation.
1347
+ */
1348
+ static fromJSON(t, e) {
1349
+ if (!e)
1350
+ throw new RangeError("Invalid input for Node.fromJSON");
1351
+ let n;
1352
+ if (e.marks) {
1353
+ if (!Array.isArray(e.marks))
1354
+ throw new RangeError("Invalid mark data for Node.fromJSON");
1355
+ n = e.marks.map(t.markFromJSON);
1356
+ }
1357
+ if (e.type == "text") {
1358
+ if (typeof e.text != "string")
1359
+ throw new RangeError("Invalid text node in JSON");
1360
+ return t.text(e.text, n);
1361
+ }
1362
+ let i = c.fromJSON(t, e.content), r = t.nodeType(e.type).create(e.attrs, i, n);
1363
+ return r.type.checkAttrs(r.attrs), r;
1364
+ }
1365
+ }
1366
+ x.prototype.text = void 0;
1367
+ class A extends x {
1368
+ /**
1369
+ @internal
1370
+ */
1371
+ constructor(t, e, n, i) {
1372
+ if (super(t, e, null, i), !n)
1373
+ throw new RangeError("Empty text nodes are not allowed");
1374
+ this.text = n;
1375
+ }
1376
+ toString() {
1377
+ return this.type.spec.toDebugString ? this.type.spec.toDebugString(this) : it(this.marks, JSON.stringify(this.text));
1378
+ }
1379
+ get textContent() {
1380
+ return this.text;
1381
+ }
1382
+ textBetween(t, e) {
1383
+ return this.text.slice(t, e);
1384
+ }
1385
+ get nodeSize() {
1386
+ return this.text.length;
1387
+ }
1388
+ mark(t) {
1389
+ return t == this.marks ? this : new A(this.type, this.attrs, this.text, t);
1390
+ }
1391
+ withText(t) {
1392
+ return t == this.text ? this : new A(this.type, this.attrs, t, this.marks);
1393
+ }
1394
+ cut(t = 0, e = this.text.length) {
1395
+ return t == 0 && e == this.text.length ? this : this.withText(this.text.slice(t, e));
1396
+ }
1397
+ eq(t) {
1398
+ return this.sameMarkup(t) && this.text == t.text;
1399
+ }
1400
+ toJSON() {
1401
+ let t = super.toJSON();
1402
+ return t.text = this.text, t;
1403
+ }
1404
+ }
1405
+ function it(s, t) {
1406
+ for (let e = s.length - 1; e >= 0; e--)
1407
+ t = s[e].type.name + "(" + t + ")";
1408
+ return t;
1409
+ }
1410
+ class k {
1411
+ /**
1412
+ @internal
1413
+ */
1414
+ constructor(t) {
1415
+ this.validEnd = t, this.next = [], this.wrapCache = [];
1416
+ }
1417
+ /**
1418
+ @internal
1419
+ */
1420
+ static parse(t, e) {
1421
+ let n = new kt(t, e);
1422
+ if (n.next == null)
1423
+ return k.empty;
1424
+ let i = rt(n);
1425
+ n.next && n.err("Unexpected trailing text");
1426
+ let r = Mt(Tt(i));
1427
+ return vt(r, n), r;
1428
+ }
1429
+ /**
1430
+ Match a node type, returning a match after that node if
1431
+ successful.
1432
+ */
1433
+ matchType(t) {
1434
+ for (let e = 0; e < this.next.length; e++)
1435
+ if (this.next[e].type == t)
1436
+ return this.next[e].next;
1437
+ return null;
1438
+ }
1439
+ /**
1440
+ Try to match a fragment. Returns the resulting match when
1441
+ successful.
1442
+ */
1443
+ matchFragment(t, e = 0, n = t.childCount) {
1444
+ let i = this;
1445
+ for (let r = e; i && r < n; r++)
1446
+ i = i.matchType(t.child(r).type);
1447
+ return i;
1448
+ }
1449
+ /**
1450
+ @internal
1451
+ */
1452
+ get inlineContent() {
1453
+ return this.next.length != 0 && this.next[0].type.isInline;
1454
+ }
1455
+ /**
1456
+ Get the first matching node type at this match position that can
1457
+ be generated.
1458
+ */
1459
+ get defaultType() {
1460
+ for (let t = 0; t < this.next.length; t++) {
1461
+ let { type: e } = this.next[t];
1462
+ if (!(e.isText || e.hasRequiredAttrs()))
1463
+ return e;
1464
+ }
1465
+ return null;
1466
+ }
1467
+ /**
1468
+ @internal
1469
+ */
1470
+ compatible(t) {
1471
+ for (let e = 0; e < this.next.length; e++)
1472
+ for (let n = 0; n < t.next.length; n++)
1473
+ if (this.next[e].type == t.next[n].type)
1474
+ return !0;
1475
+ return !1;
1476
+ }
1477
+ /**
1478
+ Try to match the given fragment, and if that fails, see if it can
1479
+ be made to match by inserting nodes in front of it. When
1480
+ successful, return a fragment of inserted nodes (which may be
1481
+ empty if nothing had to be inserted). When `toEnd` is true, only
1482
+ return a fragment if the resulting match goes to the end of the
1483
+ content expression.
1484
+ */
1485
+ fillBefore(t, e = !1, n = 0) {
1486
+ let i = [this];
1487
+ function r(l, o) {
1488
+ let h = l.matchFragment(t, n);
1489
+ if (h && (!e || h.validEnd))
1490
+ return c.from(o.map((a) => a.createAndFill()));
1491
+ for (let a = 0; a < l.next.length; a++) {
1492
+ let { type: f, next: p } = l.next[a];
1493
+ if (!(f.isText || f.hasRequiredAttrs()) && i.indexOf(p) == -1) {
1494
+ i.push(p);
1495
+ let y = r(p, o.concat(f));
1496
+ if (y)
1497
+ return y;
1498
+ }
1499
+ }
1500
+ return null;
1501
+ }
1502
+ return r(this, []);
1503
+ }
1504
+ /**
1505
+ Find a set of wrapping node types that would allow a node of the
1506
+ given type to appear at this position. The result may be empty
1507
+ (when it fits directly) and will be null when no such wrapping
1508
+ exists.
1509
+ */
1510
+ findWrapping(t) {
1511
+ for (let n = 0; n < this.wrapCache.length; n += 2)
1512
+ if (this.wrapCache[n] == t)
1513
+ return this.wrapCache[n + 1];
1514
+ let e = this.computeWrapping(t);
1515
+ return this.wrapCache.push(t, e), e;
1516
+ }
1517
+ /**
1518
+ @internal
1519
+ */
1520
+ computeWrapping(t) {
1521
+ let e = /* @__PURE__ */ Object.create(null), n = [{ match: this, type: null, via: null }];
1522
+ for (; n.length; ) {
1523
+ let i = n.shift(), r = i.match;
1524
+ if (r.matchType(t)) {
1525
+ let l = [];
1526
+ for (let o = i; o.type; o = o.via)
1527
+ l.push(o.type);
1528
+ return l.reverse();
1529
+ }
1530
+ for (let l = 0; l < r.next.length; l++) {
1531
+ let { type: o, next: h } = r.next[l];
1532
+ !o.isLeaf && !o.hasRequiredAttrs() && !(o.name in e) && (!i.type || h.validEnd) && (n.push({ match: o.contentMatch, type: o, via: i }), e[o.name] = !0);
1533
+ }
1534
+ }
1535
+ return null;
1536
+ }
1537
+ /**
1538
+ The number of outgoing edges this node has in the finite
1539
+ automaton that describes the content expression.
1540
+ */
1541
+ get edgeCount() {
1542
+ return this.next.length;
1543
+ }
1544
+ /**
1545
+ Get the _n_​th outgoing edge from this node in the finite
1546
+ automaton that describes the content expression.
1547
+ */
1548
+ edge(t) {
1549
+ if (t >= this.next.length)
1550
+ throw new RangeError(`There's no ${t}th edge in this content match`);
1551
+ return this.next[t];
1552
+ }
1553
+ /**
1554
+ @internal
1555
+ */
1556
+ toString() {
1557
+ let t = [];
1558
+ function e(n) {
1559
+ t.push(n);
1560
+ for (let i = 0; i < n.next.length; i++)
1561
+ t.indexOf(n.next[i].next) == -1 && e(n.next[i].next);
1562
+ }
1563
+ return e(this), t.map((n, i) => {
1564
+ let r = i + (n.validEnd ? "*" : " ") + " ";
1565
+ for (let l = 0; l < n.next.length; l++)
1566
+ r += (l ? ", " : "") + n.next[l].type.name + "->" + t.indexOf(n.next[l].next);
1567
+ return r;
1568
+ }).join(`
1569
+ `);
1570
+ }
1571
+ }
1572
+ k.empty = new k(!0);
1573
+ class kt {
1574
+ constructor(t, e) {
1575
+ this.string = t, this.nodeTypes = e, this.inline = null, this.pos = 0, this.tokens = t.split(/\s*(?=\b|\W|$)/), this.tokens[this.tokens.length - 1] == "" && this.tokens.pop(), this.tokens[0] == "" && this.tokens.shift();
1576
+ }
1577
+ get next() {
1578
+ return this.tokens[this.pos];
1579
+ }
1580
+ eat(t) {
1581
+ return this.next == t && (this.pos++ || !0);
1582
+ }
1583
+ err(t) {
1584
+ throw new SyntaxError(t + " (in content expression '" + this.string + "')");
1585
+ }
1586
+ }
1587
+ function rt(s) {
1588
+ let t = [];
1589
+ do
1590
+ t.push(St(s));
1591
+ while (s.eat("|"));
1592
+ return t.length == 1 ? t[0] : { type: "choice", exprs: t };
1593
+ }
1594
+ function St(s) {
1595
+ let t = [];
1596
+ do
1597
+ t.push(Et(s));
1598
+ while (s.next && s.next != ")" && s.next != "|");
1599
+ return t.length == 1 ? t[0] : { type: "seq", exprs: t };
1600
+ }
1601
+ function Et(s) {
1602
+ let t = Ot(s);
1603
+ for (; ; )
1604
+ if (s.eat("+"))
1605
+ t = { type: "plus", expr: t };
1606
+ else if (s.eat("*"))
1607
+ t = { type: "star", expr: t };
1608
+ else if (s.eat("?"))
1609
+ t = { type: "opt", expr: t };
1610
+ else if (s.eat("{"))
1611
+ t = Ct(s, t);
1612
+ else
1613
+ break;
1614
+ return t;
1615
+ }
1616
+ function W(s) {
1617
+ /\D/.test(s.next) && s.err("Expected number, got '" + s.next + "'");
1618
+ let t = Number(s.next);
1619
+ return s.pos++, t;
1620
+ }
1621
+ function Ct(s, t) {
1622
+ let e = W(s), n = e;
1623
+ return s.eat(",") && (s.next != "}" ? n = W(s) : n = -1), s.eat("}") || s.err("Unclosed braced range"), { type: "range", min: e, max: n, expr: t };
1624
+ }
1625
+ function bt(s, t) {
1626
+ let e = s.nodeTypes, n = e[t];
1627
+ if (n)
1628
+ return [n];
1629
+ let i = [];
1630
+ for (let r in e) {
1631
+ let l = e[r];
1632
+ l.isInGroup(t) && i.push(l);
1633
+ }
1634
+ return i.length == 0 && s.err("No node type or group '" + t + "' found"), i;
1635
+ }
1636
+ function Ot(s) {
1637
+ if (s.eat("(")) {
1638
+ let t = rt(s);
1639
+ return s.eat(")") || s.err("Missing closing paren"), t;
1640
+ } else if (/\W/.test(s.next))
1641
+ s.err("Unexpected token '" + s.next + "'");
1642
+ else {
1643
+ let t = bt(s, s.next).map((e) => (s.inline == null ? s.inline = e.isInline : s.inline != e.isInline && s.err("Mixing inline and block content"), { type: "name", value: e }));
1644
+ return s.pos++, t.length == 1 ? t[0] : { type: "choice", exprs: t };
1645
+ }
1646
+ }
1647
+ function Tt(s) {
1648
+ let t = [[]];
1649
+ return i(r(s, 0), e()), t;
1650
+ function e() {
1651
+ return t.push([]) - 1;
1652
+ }
1653
+ function n(l, o, h) {
1654
+ let a = { term: h, to: o };
1655
+ return t[l].push(a), a;
1656
+ }
1657
+ function i(l, o) {
1658
+ l.forEach((h) => h.to = o);
1659
+ }
1660
+ function r(l, o) {
1661
+ if (l.type == "choice")
1662
+ return l.exprs.reduce((h, a) => h.concat(r(a, o)), []);
1663
+ if (l.type == "seq")
1664
+ for (let h = 0; ; h++) {
1665
+ let a = r(l.exprs[h], o);
1666
+ if (h == l.exprs.length - 1)
1667
+ return a;
1668
+ i(a, o = e());
1669
+ }
1670
+ else if (l.type == "star") {
1671
+ let h = e();
1672
+ return n(o, h), i(r(l.expr, h), h), [n(h)];
1673
+ } else if (l.type == "plus") {
1674
+ let h = e();
1675
+ return i(r(l.expr, o), h), i(r(l.expr, h), h), [n(h)];
1676
+ } else {
1677
+ if (l.type == "opt")
1678
+ return [n(o)].concat(r(l.expr, o));
1679
+ if (l.type == "range") {
1680
+ let h = o;
1681
+ for (let a = 0; a < l.min; a++) {
1682
+ let f = e();
1683
+ i(r(l.expr, h), f), h = f;
1684
+ }
1685
+ if (l.max == -1)
1686
+ i(r(l.expr, h), h);
1687
+ else
1688
+ for (let a = l.min; a < l.max; a++) {
1689
+ let f = e();
1690
+ n(h, f), i(r(l.expr, h), f), h = f;
1691
+ }
1692
+ return [n(h)];
1693
+ } else {
1694
+ if (l.type == "name")
1695
+ return [n(o, void 0, l.value)];
1696
+ throw new Error("Unknown expr type");
1697
+ }
1698
+ }
1699
+ }
1700
+ }
1701
+ function st(s, t) {
1702
+ return t - s;
1703
+ }
1704
+ function j(s, t) {
1705
+ let e = [];
1706
+ return n(t), e.sort(st);
1707
+ function n(i) {
1708
+ let r = s[i];
1709
+ if (r.length == 1 && !r[0].term)
1710
+ return n(r[0].to);
1711
+ e.push(i);
1712
+ for (let l = 0; l < r.length; l++) {
1713
+ let { term: o, to: h } = r[l];
1714
+ !o && e.indexOf(h) == -1 && n(h);
1715
+ }
1716
+ }
1717
+ }
1718
+ function Mt(s) {
1719
+ let t = /* @__PURE__ */ Object.create(null);
1720
+ return e(j(s, 0));
1721
+ function e(n) {
1722
+ let i = [];
1723
+ n.forEach((l) => {
1724
+ s[l].forEach(({ term: o, to: h }) => {
1725
+ if (!o)
1726
+ return;
1727
+ let a;
1728
+ for (let f = 0; f < i.length; f++)
1729
+ i[f][0] == o && (a = i[f][1]);
1730
+ j(s, h).forEach((f) => {
1731
+ a || i.push([o, a = []]), a.indexOf(f) == -1 && a.push(f);
1732
+ });
1733
+ });
1734
+ });
1735
+ let r = t[n.join(",")] = new k(n.indexOf(s.length - 1) > -1);
1736
+ for (let l = 0; l < i.length; l++) {
1737
+ let o = i[l][1].sort(st);
1738
+ r.next.push({ type: i[l][0], next: t[o.join(",")] || e(o) });
1739
+ }
1740
+ return r;
1741
+ }
1742
+ }
1743
+ function vt(s, t) {
1744
+ for (let e = 0, n = [s]; e < n.length; e++) {
1745
+ let i = n[e], r = !i.validEnd, l = [];
1746
+ for (let o = 0; o < i.next.length; o++) {
1747
+ let { type: h, next: a } = i.next[o];
1748
+ l.push(h.name), r && !(h.isText || h.hasRequiredAttrs()) && (r = !1), n.indexOf(a) == -1 && n.push(a);
1749
+ }
1750
+ r && t.err("Only non-generatable nodes (" + l.join(", ") + ") in a required position (see https://prosemirror.net/docs/guide/#generatable)");
1751
+ }
1752
+ }
1753
+ function lt(s) {
1754
+ let t = /* @__PURE__ */ Object.create(null);
1755
+ for (let e in s) {
1756
+ let n = s[e];
1757
+ if (!n.hasDefault)
1758
+ return null;
1759
+ t[e] = n.default;
1760
+ }
1761
+ return t;
1762
+ }
1763
+ function ot(s, t) {
1764
+ let e = /* @__PURE__ */ Object.create(null);
1765
+ for (let n in s) {
1766
+ let i = t && t[n];
1767
+ if (i === void 0) {
1768
+ let r = s[n];
1769
+ if (r.hasDefault)
1770
+ i = r.default;
1771
+ else
1772
+ throw new RangeError("No value supplied for attribute " + n);
1773
+ }
1774
+ e[n] = i;
1775
+ }
1776
+ return e;
1777
+ }
1778
+ function ht(s, t, e, n) {
1779
+ for (let i in t)
1780
+ if (!(i in s))
1781
+ throw new RangeError(`Unsupported attribute ${i} for ${e} of type ${i}`);
1782
+ for (let i in s) {
1783
+ let r = s[i];
1784
+ r.validate && r.validate(t[i]);
1785
+ }
1786
+ }
1787
+ function at(s, t) {
1788
+ let e = /* @__PURE__ */ Object.create(null);
1789
+ if (t)
1790
+ for (let n in t)
1791
+ e[n] = new At(s, n, t[n]);
1792
+ return e;
1793
+ }
1794
+ class z {
1795
+ /**
1796
+ @internal
1797
+ */
1798
+ constructor(t, e, n) {
1799
+ this.name = t, this.schema = e, this.spec = n, this.markSet = null, this.groups = n.group ? n.group.split(" ") : [], this.attrs = at(t, n.attrs), this.defaultAttrs = lt(this.attrs), this.contentMatch = null, this.inlineContent = null, this.isBlock = !(n.inline || t == "text"), this.isText = t == "text";
1800
+ }
1801
+ /**
1802
+ True if this is an inline type.
1803
+ */
1804
+ get isInline() {
1805
+ return !this.isBlock;
1806
+ }
1807
+ /**
1808
+ True if this is a textblock type, a block that contains inline
1809
+ content.
1810
+ */
1811
+ get isTextblock() {
1812
+ return this.isBlock && this.inlineContent;
1813
+ }
1814
+ /**
1815
+ True for node types that allow no content.
1816
+ */
1817
+ get isLeaf() {
1818
+ return this.contentMatch == k.empty;
1819
+ }
1820
+ /**
1821
+ True when this node is an atom, i.e. when it does not have
1822
+ directly editable content.
1823
+ */
1824
+ get isAtom() {
1825
+ return this.isLeaf || !!this.spec.atom;
1826
+ }
1827
+ /**
1828
+ Return true when this node type is part of the given
1829
+ [group](https://prosemirror.net/docs/ref/#model.NodeSpec.group).
1830
+ */
1831
+ isInGroup(t) {
1832
+ return this.groups.indexOf(t) > -1;
1833
+ }
1834
+ /**
1835
+ The node type's [whitespace](https://prosemirror.net/docs/ref/#model.NodeSpec.whitespace) option.
1836
+ */
1837
+ get whitespace() {
1838
+ return this.spec.whitespace || (this.spec.code ? "pre" : "normal");
1839
+ }
1840
+ /**
1841
+ Tells you whether this node type has any required attributes.
1842
+ */
1843
+ hasRequiredAttrs() {
1844
+ for (let t in this.attrs)
1845
+ if (this.attrs[t].isRequired)
1846
+ return !0;
1847
+ return !1;
1848
+ }
1849
+ /**
1850
+ Indicates whether this node allows some of the same content as
1851
+ the given node type.
1852
+ */
1853
+ compatibleContent(t) {
1854
+ return this == t || this.contentMatch.compatible(t.contentMatch);
1855
+ }
1856
+ /**
1857
+ @internal
1858
+ */
1859
+ computeAttrs(t) {
1860
+ return !t && this.defaultAttrs ? this.defaultAttrs : ot(this.attrs, t);
1861
+ }
1862
+ /**
1863
+ Create a `Node` of this type. The given attributes are
1864
+ checked and defaulted (you can pass `null` to use the type's
1865
+ defaults entirely, if no required attributes exist). `content`
1866
+ may be a `Fragment`, a node, an array of nodes, or
1867
+ `null`. Similarly `marks` may be `null` to default to the empty
1868
+ set of marks.
1869
+ */
1870
+ create(t = null, e, n) {
1871
+ if (this.isText)
1872
+ throw new Error("NodeType.create can't construct text nodes");
1873
+ return new x(this, this.computeAttrs(t), c.from(e), u.setFrom(n));
1874
+ }
1875
+ /**
1876
+ Like [`create`](https://prosemirror.net/docs/ref/#model.NodeType.create), but check the given content
1877
+ against the node type's content restrictions, and throw an error
1878
+ if it doesn't match.
1879
+ */
1880
+ createChecked(t = null, e, n) {
1881
+ return e = c.from(e), this.checkContent(e), new x(this, this.computeAttrs(t), e, u.setFrom(n));
1882
+ }
1883
+ /**
1884
+ Like [`create`](https://prosemirror.net/docs/ref/#model.NodeType.create), but see if it is
1885
+ necessary to add nodes to the start or end of the given fragment
1886
+ to make it fit the node. If no fitting wrapping can be found,
1887
+ return null. Note that, due to the fact that required nodes can
1888
+ always be created, this will always succeed if you pass null or
1889
+ `Fragment.empty` as content.
1890
+ */
1891
+ createAndFill(t = null, e, n) {
1892
+ if (t = this.computeAttrs(t), e = c.from(e), e.size) {
1893
+ let l = this.contentMatch.fillBefore(e);
1894
+ if (!l)
1895
+ return null;
1896
+ e = l.append(e);
1897
+ }
1898
+ let i = this.contentMatch.matchFragment(e), r = i && i.fillBefore(c.empty, !0);
1899
+ return r ? new x(this, t, e.append(r), u.setFrom(n)) : null;
1900
+ }
1901
+ /**
1902
+ Returns true if the given fragment is valid content for this node
1903
+ type.
1904
+ */
1905
+ validContent(t) {
1906
+ let e = this.contentMatch.matchFragment(t);
1907
+ if (!e || !e.validEnd)
1908
+ return !1;
1909
+ for (let n = 0; n < t.childCount; n++)
1910
+ if (!this.allowsMarks(t.child(n).marks))
1911
+ return !1;
1912
+ return !0;
1913
+ }
1914
+ /**
1915
+ Throws a RangeError if the given fragment is not valid content for this
1916
+ node type.
1917
+ @internal
1918
+ */
1919
+ checkContent(t) {
1920
+ if (!this.validContent(t))
1921
+ throw new RangeError(`Invalid content for node ${this.name}: ${t.toString().slice(0, 50)}`);
1922
+ }
1923
+ /**
1924
+ @internal
1925
+ */
1926
+ checkAttrs(t) {
1927
+ ht(this.attrs, t, "node", this.name);
1928
+ }
1929
+ /**
1930
+ Check whether the given mark type is allowed in this node.
1931
+ */
1932
+ allowsMarkType(t) {
1933
+ return this.markSet == null || this.markSet.indexOf(t) > -1;
1934
+ }
1935
+ /**
1936
+ Test whether the given set of marks are allowed in this node.
1937
+ */
1938
+ allowsMarks(t) {
1939
+ if (this.markSet == null)
1940
+ return !0;
1941
+ for (let e = 0; e < t.length; e++)
1942
+ if (!this.allowsMarkType(t[e].type))
1943
+ return !1;
1944
+ return !0;
1945
+ }
1946
+ /**
1947
+ Removes the marks that are not allowed in this node from the given set.
1948
+ */
1949
+ allowedMarks(t) {
1950
+ if (this.markSet == null)
1951
+ return t;
1952
+ let e;
1953
+ for (let n = 0; n < t.length; n++)
1954
+ this.allowsMarkType(t[n].type) ? e && e.push(t[n]) : e || (e = t.slice(0, n));
1955
+ return e ? e.length ? e : u.none : t;
1956
+ }
1957
+ /**
1958
+ @internal
1959
+ */
1960
+ static compile(t, e) {
1961
+ let n = /* @__PURE__ */ Object.create(null);
1962
+ t.forEach((r, l) => n[r] = new z(r, e, l));
1963
+ let i = e.spec.topNode || "doc";
1964
+ if (!n[i])
1965
+ throw new RangeError("Schema is missing its top node type ('" + i + "')");
1966
+ if (!n.text)
1967
+ throw new RangeError("Every schema needs a 'text' type");
1968
+ for (let r in n.text.attrs)
1969
+ throw new RangeError("The text node type should not have attributes");
1970
+ return n;
1971
+ }
1972
+ }
1973
+ function Nt(s, t, e) {
1974
+ let n = e.split("|");
1975
+ return (i) => {
1976
+ let r = i === null ? "null" : typeof i;
1977
+ if (n.indexOf(r) < 0)
1978
+ throw new RangeError(`Expected value of type ${n} for attribute ${t} on type ${s}, got ${r}`);
1979
+ };
1980
+ }
1981
+ class At {
1982
+ constructor(t, e, n) {
1983
+ this.hasDefault = Object.prototype.hasOwnProperty.call(n, "default"), this.default = n.default, this.validate = typeof n.validate == "string" ? Nt(t, e, n.validate) : n.validate;
1984
+ }
1985
+ get isRequired() {
1986
+ return !this.hasDefault;
1987
+ }
1988
+ }
1989
+ class J {
1990
+ /**
1991
+ @internal
1992
+ */
1993
+ constructor(t, e, n, i) {
1994
+ this.name = t, this.rank = e, this.schema = n, this.spec = i, this.attrs = at(t, i.attrs), this.excluded = null;
1995
+ let r = lt(this.attrs);
1996
+ this.instance = r ? new u(this, r) : null;
1997
+ }
1998
+ /**
1999
+ Create a mark of this type. `attrs` may be `null` or an object
2000
+ containing only some of the mark's attributes. The others, if
2001
+ they have defaults, will be added.
2002
+ */
2003
+ create(t = null) {
2004
+ return !t && this.instance ? this.instance : new u(this, ot(this.attrs, t));
2005
+ }
2006
+ /**
2007
+ @internal
2008
+ */
2009
+ static compile(t, e) {
2010
+ let n = /* @__PURE__ */ Object.create(null), i = 0;
2011
+ return t.forEach((r, l) => n[r] = new J(r, i++, e, l)), n;
2012
+ }
2013
+ /**
2014
+ When there is a mark of this type in the given set, a new set
2015
+ without it is returned. Otherwise, the input set is returned.
2016
+ */
2017
+ removeFromSet(t) {
2018
+ for (var e = 0; e < t.length; e++)
2019
+ t[e].type == this && (t = t.slice(0, e).concat(t.slice(e + 1)), e--);
2020
+ return t;
2021
+ }
2022
+ /**
2023
+ Tests whether there is a mark of this type in the given set.
2024
+ */
2025
+ isInSet(t) {
2026
+ for (let e = 0; e < t.length; e++)
2027
+ if (t[e].type == this)
2028
+ return t[e];
2029
+ }
2030
+ /**
2031
+ @internal
2032
+ */
2033
+ checkAttrs(t) {
2034
+ ht(this.attrs, t, "mark", this.name);
2035
+ }
2036
+ /**
2037
+ Queries whether a given mark type is
2038
+ [excluded](https://prosemirror.net/docs/ref/#model.MarkSpec.excludes) by this one.
2039
+ */
2040
+ excludes(t) {
2041
+ return this.excluded.indexOf(t) > -1;
2042
+ }
2043
+ }
2044
+ class Wt {
2045
+ /**
2046
+ Construct a schema from a schema [specification](https://prosemirror.net/docs/ref/#model.SchemaSpec).
2047
+ */
2048
+ constructor(t) {
2049
+ this.linebreakReplacement = null, this.cached = /* @__PURE__ */ Object.create(null);
2050
+ let e = this.spec = {};
2051
+ for (let i in t)
2052
+ e[i] = t[i];
2053
+ e.nodes = d.from(t.nodes), e.marks = d.from(t.marks || {}), this.nodes = z.compile(this.spec.nodes, this), this.marks = J.compile(this.spec.marks, this);
2054
+ let n = /* @__PURE__ */ Object.create(null);
2055
+ for (let i in this.nodes) {
2056
+ if (i in this.marks)
2057
+ throw new RangeError(i + " can not be both a node and a mark");
2058
+ let r = this.nodes[i], l = r.spec.content || "", o = r.spec.marks;
2059
+ if (r.contentMatch = n[l] || (n[l] = k.parse(l, this.nodes)), r.inlineContent = r.contentMatch.inlineContent, r.spec.linebreakReplacement) {
2060
+ if (this.linebreakReplacement)
2061
+ throw new RangeError("Multiple linebreak nodes defined");
2062
+ if (!r.isInline || !r.isLeaf)
2063
+ throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");
2064
+ this.linebreakReplacement = r;
2065
+ }
2066
+ r.markSet = o == "_" ? null : o ? U(this, o.split(" ")) : o == "" || !r.inlineContent ? [] : null;
2067
+ }
2068
+ for (let i in this.marks) {
2069
+ let r = this.marks[i], l = r.spec.excludes;
2070
+ r.excluded = l == null ? [r] : l == "" ? [] : U(this, l.split(" "));
2071
+ }
2072
+ this.nodeFromJSON = (i) => x.fromJSON(this, i), this.markFromJSON = (i) => u.fromJSON(this, i), this.topNodeType = this.nodes[this.spec.topNode || "doc"], this.cached.wrappings = /* @__PURE__ */ Object.create(null);
2073
+ }
2074
+ /**
2075
+ Create a node in this schema. The `type` may be a string or a
2076
+ `NodeType` instance. Attributes will be extended with defaults,
2077
+ `content` may be a `Fragment`, `null`, a `Node`, or an array of
2078
+ nodes.
2079
+ */
2080
+ node(t, e = null, n, i) {
2081
+ if (typeof t == "string")
2082
+ t = this.nodeType(t);
2083
+ else if (t instanceof z) {
2084
+ if (t.schema != this)
2085
+ throw new RangeError("Node type from different schema used (" + t.name + ")");
2086
+ } else throw new RangeError("Invalid node type: " + t);
2087
+ return t.createChecked(e, n, i);
2088
+ }
2089
+ /**
2090
+ Create a text node in the schema. Empty text nodes are not
2091
+ allowed.
2092
+ */
2093
+ text(t, e) {
2094
+ let n = this.nodes.text;
2095
+ return new A(n, n.defaultAttrs, t, u.setFrom(e));
2096
+ }
2097
+ /**
2098
+ Create a mark with the given type and attributes.
2099
+ */
2100
+ mark(t, e) {
2101
+ return typeof t == "string" && (t = this.marks[t]), t.create(e);
2102
+ }
2103
+ /**
2104
+ @internal
2105
+ */
2106
+ nodeType(t) {
2107
+ let e = this.nodes[t];
2108
+ if (!e)
2109
+ throw new RangeError("Unknown node type: " + t);
2110
+ return e;
2111
+ }
2112
+ }
2113
+ function U(s, t) {
2114
+ let e = [];
2115
+ for (let n = 0; n < t.length; n++) {
2116
+ let i = t[n], r = s.marks[i], l = r;
2117
+ if (r)
2118
+ e.push(r);
2119
+ else
2120
+ for (let o in s.marks) {
2121
+ let h = s.marks[o];
2122
+ (i == "_" || h.spec.group && h.spec.group.split(" ").indexOf(i) > -1) && e.push(l = h);
2123
+ }
2124
+ if (!l)
2125
+ throw new SyntaxError("Unknown mark type: '" + t[n] + "'");
2126
+ }
2127
+ return e;
2128
+ }
2129
+ function zt(s) {
2130
+ return s.tag != null;
2131
+ }
2132
+ function Rt(s) {
2133
+ return s.style != null;
2134
+ }
2135
+ class B {
2136
+ /**
2137
+ Create a parser that targets the given schema, using the given
2138
+ parsing rules.
2139
+ */
2140
+ constructor(t, e) {
2141
+ this.schema = t, this.rules = e, this.tags = [], this.styles = [];
2142
+ let n = this.matchedStyles = [];
2143
+ e.forEach((i) => {
2144
+ if (zt(i))
2145
+ this.tags.push(i);
2146
+ else if (Rt(i)) {
2147
+ let r = /[^=]*/.exec(i.style)[0];
2148
+ n.indexOf(r) < 0 && n.push(r), this.styles.push(i);
2149
+ }
2150
+ }), this.normalizeLists = !this.tags.some((i) => {
2151
+ if (!/^(ul|ol)\b/.test(i.tag) || !i.node)
2152
+ return !1;
2153
+ let r = t.nodes[i.node];
2154
+ return r.contentMatch.matchType(r);
2155
+ });
2156
+ }
2157
+ /**
2158
+ Parse a document from the content of a DOM node.
2159
+ */
2160
+ parse(t, e = {}) {
2161
+ let n = new G(this, e, !1);
2162
+ return n.addAll(t, u.none, e.from, e.to), n.finish();
2163
+ }
2164
+ /**
2165
+ Parses the content of the given DOM node, like
2166
+ [`parse`](https://prosemirror.net/docs/ref/#model.DOMParser.parse), and takes the same set of
2167
+ options. But unlike that method, which produces a whole node,
2168
+ this one returns a slice that is open at the sides, meaning that
2169
+ the schema constraints aren't applied to the start of nodes to
2170
+ the left of the input and the end of nodes at the end.
2171
+ */
2172
+ parseSlice(t, e = {}) {
2173
+ let n = new G(this, e, !0);
2174
+ return n.addAll(t, u.none, e.from, e.to), g.maxOpen(n.finish());
2175
+ }
2176
+ /**
2177
+ @internal
2178
+ */
2179
+ matchTag(t, e, n) {
2180
+ for (let i = n ? this.tags.indexOf(n) + 1 : 0; i < this.tags.length; i++) {
2181
+ let r = this.tags[i];
2182
+ if (Pt(t, r.tag) && (r.namespace === void 0 || t.namespaceURI == r.namespace) && (!r.context || e.matchesContext(r.context))) {
2183
+ if (r.getAttrs) {
2184
+ let l = r.getAttrs(t);
2185
+ if (l === !1)
2186
+ continue;
2187
+ r.attrs = l || void 0;
2188
+ }
2189
+ return r;
2190
+ }
2191
+ }
2192
+ }
2193
+ /**
2194
+ @internal
2195
+ */
2196
+ matchStyle(t, e, n, i) {
2197
+ for (let r = i ? this.styles.indexOf(i) + 1 : 0; r < this.styles.length; r++) {
2198
+ let l = this.styles[r], o = l.style;
2199
+ if (!(o.indexOf(t) != 0 || l.context && !n.matchesContext(l.context) || // Test that the style string either precisely matches the prop,
2200
+ // or has an '=' sign after the prop, followed by the given
2201
+ // value.
2202
+ o.length > t.length && (o.charCodeAt(t.length) != 61 || o.slice(t.length + 1) != e))) {
2203
+ if (l.getAttrs) {
2204
+ let h = l.getAttrs(e);
2205
+ if (h === !1)
2206
+ continue;
2207
+ l.attrs = h || void 0;
2208
+ }
2209
+ return l;
2210
+ }
2211
+ }
2212
+ }
2213
+ /**
2214
+ @internal
2215
+ */
2216
+ static schemaRules(t) {
2217
+ let e = [];
2218
+ function n(i) {
2219
+ let r = i.priority == null ? 50 : i.priority, l = 0;
2220
+ for (; l < e.length; l++) {
2221
+ let o = e[l];
2222
+ if ((o.priority == null ? 50 : o.priority) < r)
2223
+ break;
2224
+ }
2225
+ e.splice(l, 0, i);
2226
+ }
2227
+ for (let i in t.marks) {
2228
+ let r = t.marks[i].spec.parseDOM;
2229
+ r && r.forEach((l) => {
2230
+ n(l = H(l)), l.mark || l.ignore || l.clearMark || (l.mark = i);
2231
+ });
2232
+ }
2233
+ for (let i in t.nodes) {
2234
+ let r = t.nodes[i].spec.parseDOM;
2235
+ r && r.forEach((l) => {
2236
+ n(l = H(l)), l.node || l.ignore || l.mark || (l.node = i);
2237
+ });
2238
+ }
2239
+ return e;
2240
+ }
2241
+ /**
2242
+ Construct a DOM parser using the parsing rules listed in a
2243
+ schema's [node specs](https://prosemirror.net/docs/ref/#model.NodeSpec.parseDOM), reordered by
2244
+ [priority](https://prosemirror.net/docs/ref/#model.GenericParseRule.priority).
2245
+ */
2246
+ static fromSchema(t) {
2247
+ return t.cached.domParser || (t.cached.domParser = new B(t, B.schemaRules(t)));
2248
+ }
2249
+ }
2250
+ const ft = {
2251
+ address: !0,
2252
+ article: !0,
2253
+ aside: !0,
2254
+ blockquote: !0,
2255
+ canvas: !0,
2256
+ dd: !0,
2257
+ div: !0,
2258
+ dl: !0,
2259
+ fieldset: !0,
2260
+ figcaption: !0,
2261
+ figure: !0,
2262
+ footer: !0,
2263
+ form: !0,
2264
+ h1: !0,
2265
+ h2: !0,
2266
+ h3: !0,
2267
+ h4: !0,
2268
+ h5: !0,
2269
+ h6: !0,
2270
+ header: !0,
2271
+ hgroup: !0,
2272
+ hr: !0,
2273
+ li: !0,
2274
+ noscript: !0,
2275
+ ol: !0,
2276
+ output: !0,
2277
+ p: !0,
2278
+ pre: !0,
2279
+ section: !0,
2280
+ table: !0,
2281
+ tfoot: !0,
2282
+ ul: !0
2283
+ }, It = {
2284
+ head: !0,
2285
+ noscript: !0,
2286
+ object: !0,
2287
+ script: !0,
2288
+ style: !0,
2289
+ title: !0
2290
+ }, ct = { ol: !0, ul: !0 }, b = 1, F = 2, E = 4;
2291
+ function V(s, t, e) {
2292
+ return t != null ? (t ? b : 0) | (t === "full" ? F : 0) : s && s.whitespace == "pre" ? b | F : e & ~E;
2293
+ }
2294
+ class T {
2295
+ constructor(t, e, n, i, r, l) {
2296
+ this.type = t, this.attrs = e, this.marks = n, this.solid = i, this.options = l, this.content = [], this.activeMarks = u.none, this.match = r || (l & E ? null : t.contentMatch);
2297
+ }
2298
+ findWrapping(t) {
2299
+ if (!this.match) {
2300
+ if (!this.type)
2301
+ return [];
2302
+ let e = this.type.contentMatch.fillBefore(c.from(t));
2303
+ if (e)
2304
+ this.match = this.type.contentMatch.matchFragment(e);
2305
+ else {
2306
+ let n = this.type.contentMatch, i;
2307
+ return (i = n.findWrapping(t.type)) ? (this.match = n, i) : null;
2308
+ }
2309
+ }
2310
+ return this.match.findWrapping(t.type);
2311
+ }
2312
+ finish(t) {
2313
+ if (!(this.options & b)) {
2314
+ let n = this.content[this.content.length - 1], i;
2315
+ if (n && n.isText && (i = /[ \t\r\n\u000c]+$/.exec(n.text))) {
2316
+ let r = n;
2317
+ n.text.length == i[0].length ? this.content.pop() : this.content[this.content.length - 1] = r.withText(r.text.slice(0, r.text.length - i[0].length));
2318
+ }
2319
+ }
2320
+ let e = c.from(this.content);
2321
+ return !t && this.match && (e = e.append(this.match.fillBefore(c.empty, !0))), this.type ? this.type.create(this.attrs, e, this.marks) : e;
2322
+ }
2323
+ inlineContext(t) {
2324
+ return this.type ? this.type.inlineContent : this.content.length ? this.content[0].isInline : t.parentNode && !ft.hasOwnProperty(t.parentNode.nodeName.toLowerCase());
2325
+ }
2326
+ }
2327
+ class G {
2328
+ constructor(t, e, n) {
2329
+ this.parser = t, this.options = e, this.isOpen = n, this.open = 0, this.localPreserveWS = !1;
2330
+ let i = e.topNode, r, l = V(null, e.preserveWhitespace, 0) | (n ? E : 0);
2331
+ i ? r = new T(i.type, i.attrs, u.none, !0, e.topMatch || i.type.contentMatch, l) : n ? r = new T(null, null, u.none, !0, null, l) : r = new T(t.schema.topNodeType, null, u.none, !0, null, l), this.nodes = [r], this.find = e.findPositions, this.needsBlock = !1;
2332
+ }
2333
+ get top() {
2334
+ return this.nodes[this.open];
2335
+ }
2336
+ // Add a DOM node to the content. Text is inserted as text node,
2337
+ // otherwise, the node is passed to `addElement` or, if it has a
2338
+ // `style` attribute, `addElementWithStyles`.
2339
+ addDOM(t, e) {
2340
+ t.nodeType == 3 ? this.addTextNode(t, e) : t.nodeType == 1 && this.addElement(t, e);
2341
+ }
2342
+ addTextNode(t, e) {
2343
+ let n = t.nodeValue, i = this.top, r = i.options & F ? "full" : this.localPreserveWS || (i.options & b) > 0, { schema: l } = this.parser;
2344
+ if (r === "full" || i.inlineContext(t) || /[^ \t\r\n\u000c]/.test(n)) {
2345
+ if (r)
2346
+ if (r === "full")
2347
+ n = n.replace(/\r\n?/g, `
2348
+ `);
2349
+ else if (l.linebreakReplacement && /[\r\n]/.test(n) && this.top.findWrapping(l.linebreakReplacement.create())) {
2350
+ let o = n.split(/\r?\n|\r/);
2351
+ for (let h = 0; h < o.length; h++)
2352
+ h && this.insertNode(l.linebreakReplacement.create(), e, !0), o[h] && this.insertNode(l.text(o[h]), e, !/\S/.test(o[h]));
2353
+ n = "";
2354
+ } else
2355
+ n = n.replace(/\r?\n|\r/g, " ");
2356
+ else if (n = n.replace(/[ \t\r\n\u000c]+/g, " "), /^[ \t\r\n\u000c]/.test(n) && this.open == this.nodes.length - 1) {
2357
+ let o = i.content[i.content.length - 1], h = t.previousSibling;
2358
+ (!o || h && h.nodeName == "BR" || o.isText && /[ \t\r\n\u000c]$/.test(o.text)) && (n = n.slice(1));
2359
+ }
2360
+ n && this.insertNode(l.text(n), e, !/\S/.test(n)), this.findInText(t);
2361
+ } else
2362
+ this.findInside(t);
2363
+ }
2364
+ // Try to find a handler for the given tag and use that to parse. If
2365
+ // none is found, the element's content nodes are added directly.
2366
+ addElement(t, e, n) {
2367
+ let i = this.localPreserveWS, r = this.top;
2368
+ (t.tagName == "PRE" || /pre/.test(t.style && t.style.whiteSpace)) && (this.localPreserveWS = !0);
2369
+ let l = t.nodeName.toLowerCase(), o;
2370
+ ct.hasOwnProperty(l) && this.parser.normalizeLists && Dt(t);
2371
+ let h = this.options.ruleFromNode && this.options.ruleFromNode(t) || (o = this.parser.matchTag(t, this, n));
2372
+ t: if (h ? h.ignore : It.hasOwnProperty(l))
2373
+ this.findInside(t), this.ignoreFallback(t, e);
2374
+ else if (!h || h.skip || h.closeParent) {
2375
+ h && h.closeParent ? this.open = Math.max(0, this.open - 1) : h && h.skip.nodeType && (t = h.skip);
2376
+ let a, f = this.needsBlock;
2377
+ if (ft.hasOwnProperty(l))
2378
+ r.content.length && r.content[0].isInline && this.open && (this.open--, r = this.top), a = !0, r.type || (this.needsBlock = !0);
2379
+ else if (!t.firstChild) {
2380
+ this.leafFallback(t, e);
2381
+ break t;
2382
+ }
2383
+ let p = h && h.skip ? e : this.readStyles(t, e);
2384
+ p && this.addAll(t, p), a && this.sync(r), this.needsBlock = f;
2385
+ } else {
2386
+ let a = this.readStyles(t, e);
2387
+ a && this.addElementByRule(t, h, a, h.consuming === !1 ? o : void 0);
2388
+ }
2389
+ this.localPreserveWS = i;
2390
+ }
2391
+ // Called for leaf DOM nodes that would otherwise be ignored
2392
+ leafFallback(t, e) {
2393
+ t.nodeName == "BR" && this.top.type && this.top.type.inlineContent && this.addTextNode(t.ownerDocument.createTextNode(`
2394
+ `), e);
2395
+ }
2396
+ // Called for ignored nodes
2397
+ ignoreFallback(t, e) {
2398
+ t.nodeName == "BR" && (!this.top.type || !this.top.type.inlineContent) && this.findPlace(this.parser.schema.text("-"), e, !0);
2399
+ }
2400
+ // Run any style parser associated with the node's styles. Either
2401
+ // return an updated array of marks, or null to indicate some of the
2402
+ // styles had a rule with `ignore` set.
2403
+ readStyles(t, e) {
2404
+ let n = t.style;
2405
+ if (n && n.length)
2406
+ for (let i = 0; i < this.parser.matchedStyles.length; i++) {
2407
+ let r = this.parser.matchedStyles[i], l = n.getPropertyValue(r);
2408
+ if (l)
2409
+ for (let o = void 0; ; ) {
2410
+ let h = this.parser.matchStyle(r, l, this, o);
2411
+ if (!h)
2412
+ break;
2413
+ if (h.ignore)
2414
+ return null;
2415
+ if (h.clearMark ? e = e.filter((a) => !h.clearMark(a)) : e = e.concat(this.parser.schema.marks[h.mark].create(h.attrs)), h.consuming === !1)
2416
+ o = h;
2417
+ else
2418
+ break;
2419
+ }
2420
+ }
2421
+ return e;
2422
+ }
2423
+ // Look up a handler for the given node. If none are found, return
2424
+ // false. Otherwise, apply it, use its return value to drive the way
2425
+ // the node's content is wrapped, and return true.
2426
+ addElementByRule(t, e, n, i) {
2427
+ let r, l;
2428
+ if (e.node)
2429
+ if (l = this.parser.schema.nodes[e.node], l.isLeaf)
2430
+ this.insertNode(l.create(e.attrs), n, t.nodeName == "BR") || this.leafFallback(t, n);
2431
+ else {
2432
+ let h = this.enter(l, e.attrs || null, n, e.preserveWhitespace);
2433
+ h && (r = !0, n = h);
2434
+ }
2435
+ else {
2436
+ let h = this.parser.schema.marks[e.mark];
2437
+ n = n.concat(h.create(e.attrs));
2438
+ }
2439
+ let o = this.top;
2440
+ if (l && l.isLeaf)
2441
+ this.findInside(t);
2442
+ else if (i)
2443
+ this.addElement(t, n, i);
2444
+ else if (e.getContent)
2445
+ this.findInside(t), e.getContent(t, this.parser.schema).forEach((h) => this.insertNode(h, n, !1));
2446
+ else {
2447
+ let h = t;
2448
+ typeof e.contentElement == "string" ? h = t.querySelector(e.contentElement) : typeof e.contentElement == "function" ? h = e.contentElement(t) : e.contentElement && (h = e.contentElement), this.findAround(t, h, !0), this.addAll(h, n), this.findAround(t, h, !1);
2449
+ }
2450
+ r && this.sync(o) && this.open--;
2451
+ }
2452
+ // Add all child nodes between `startIndex` and `endIndex` (or the
2453
+ // whole node, if not given). If `sync` is passed, use it to
2454
+ // synchronize after every block element.
2455
+ addAll(t, e, n, i) {
2456
+ let r = n || 0;
2457
+ for (let l = n ? t.childNodes[n] : t.firstChild, o = i == null ? null : t.childNodes[i]; l != o; l = l.nextSibling, ++r)
2458
+ this.findAtPoint(t, r), this.addDOM(l, e);
2459
+ this.findAtPoint(t, r);
2460
+ }
2461
+ // Try to find a way to fit the given node type into the current
2462
+ // context. May add intermediate wrappers and/or leave non-solid
2463
+ // nodes that we're in.
2464
+ findPlace(t, e, n) {
2465
+ let i, r;
2466
+ for (let l = this.open, o = 0; l >= 0; l--) {
2467
+ let h = this.nodes[l], a = h.findWrapping(t);
2468
+ if (a && (!i || i.length > a.length + o) && (i = a, r = h, !a.length))
2469
+ break;
2470
+ if (h.solid) {
2471
+ if (n)
2472
+ break;
2473
+ o += 2;
2474
+ }
2475
+ }
2476
+ if (!i)
2477
+ return null;
2478
+ this.sync(r);
2479
+ for (let l = 0; l < i.length; l++)
2480
+ e = this.enterInner(i[l], null, e, !1);
2481
+ return e;
2482
+ }
2483
+ // Try to insert the given node, adjusting the context when needed.
2484
+ insertNode(t, e, n) {
2485
+ if (t.isInline && this.needsBlock && !this.top.type) {
2486
+ let r = this.textblockFromContext();
2487
+ r && (e = this.enterInner(r, null, e));
2488
+ }
2489
+ let i = this.findPlace(t, e, n);
2490
+ if (i) {
2491
+ this.closeExtra();
2492
+ let r = this.top;
2493
+ r.match && (r.match = r.match.matchType(t.type));
2494
+ let l = u.none;
2495
+ for (let o of i.concat(t.marks))
2496
+ (r.type ? r.type.allowsMarkType(o.type) : Q(o.type, t.type)) && (l = o.addToSet(l));
2497
+ return r.content.push(t.mark(l)), !0;
2498
+ }
2499
+ return !1;
2500
+ }
2501
+ // Try to start a node of the given type, adjusting the context when
2502
+ // necessary.
2503
+ enter(t, e, n, i) {
2504
+ let r = this.findPlace(t.create(e), n, !1);
2505
+ return r && (r = this.enterInner(t, e, n, !0, i)), r;
2506
+ }
2507
+ // Open a node of the given type
2508
+ enterInner(t, e, n, i = !1, r) {
2509
+ this.closeExtra();
2510
+ let l = this.top;
2511
+ l.match = l.match && l.match.matchType(t);
2512
+ let o = V(t, r, l.options);
2513
+ l.options & E && l.content.length == 0 && (o |= E);
2514
+ let h = u.none;
2515
+ return n = n.filter((a) => (l.type ? l.type.allowsMarkType(a.type) : Q(a.type, t)) ? (h = a.addToSet(h), !1) : !0), this.nodes.push(new T(t, e, h, i, null, o)), this.open++, n;
2516
+ }
2517
+ // Make sure all nodes above this.open are finished and added to
2518
+ // their parents
2519
+ closeExtra(t = !1) {
2520
+ let e = this.nodes.length - 1;
2521
+ if (e > this.open) {
2522
+ for (; e > this.open; e--)
2523
+ this.nodes[e - 1].content.push(this.nodes[e].finish(t));
2524
+ this.nodes.length = this.open + 1;
2525
+ }
2526
+ }
2527
+ finish() {
2528
+ return this.open = 0, this.closeExtra(this.isOpen), this.nodes[0].finish(!!(this.isOpen || this.options.topOpen));
2529
+ }
2530
+ sync(t) {
2531
+ for (let e = this.open; e >= 0; e--) {
2532
+ if (this.nodes[e] == t)
2533
+ return this.open = e, !0;
2534
+ this.localPreserveWS && (this.nodes[e].options |= b);
2535
+ }
2536
+ return !1;
2537
+ }
2538
+ get currentPos() {
2539
+ this.closeExtra();
2540
+ let t = 0;
2541
+ for (let e = this.open; e >= 0; e--) {
2542
+ let n = this.nodes[e].content;
2543
+ for (let i = n.length - 1; i >= 0; i--)
2544
+ t += n[i].nodeSize;
2545
+ e && t++;
2546
+ }
2547
+ return t;
2548
+ }
2549
+ findAtPoint(t, e) {
2550
+ if (this.find)
2551
+ for (let n = 0; n < this.find.length; n++)
2552
+ this.find[n].node == t && this.find[n].offset == e && (this.find[n].pos = this.currentPos);
2553
+ }
2554
+ findInside(t) {
2555
+ if (this.find)
2556
+ for (let e = 0; e < this.find.length; e++)
2557
+ this.find[e].pos == null && t.nodeType == 1 && t.contains(this.find[e].node) && (this.find[e].pos = this.currentPos);
2558
+ }
2559
+ findAround(t, e, n) {
2560
+ if (t != e && this.find)
2561
+ for (let i = 0; i < this.find.length; i++)
2562
+ this.find[i].pos == null && t.nodeType == 1 && t.contains(this.find[i].node) && e.compareDocumentPosition(this.find[i].node) & (n ? 2 : 4) && (this.find[i].pos = this.currentPos);
2563
+ }
2564
+ findInText(t) {
2565
+ if (this.find)
2566
+ for (let e = 0; e < this.find.length; e++)
2567
+ this.find[e].node == t && (this.find[e].pos = this.currentPos - (t.nodeValue.length - this.find[e].offset));
2568
+ }
2569
+ // Determines whether the given context string matches this context.
2570
+ matchesContext(t) {
2571
+ if (t.indexOf("|") > -1)
2572
+ return t.split(/\s*\|\s*/).some(this.matchesContext, this);
2573
+ let e = t.split("/"), n = this.options.context, i = !this.isOpen && (!n || n.parent.type == this.nodes[0].type), r = -(n ? n.depth + 1 : 0) + (i ? 0 : 1), l = (o, h) => {
2574
+ for (; o >= 0; o--) {
2575
+ let a = e[o];
2576
+ if (a == "") {
2577
+ if (o == e.length - 1 || o == 0)
2578
+ continue;
2579
+ for (; h >= r; h--)
2580
+ if (l(o - 1, h))
2581
+ return !0;
2582
+ return !1;
2583
+ } else {
2584
+ let f = h > 0 || h == 0 && i ? this.nodes[h].type : n && h >= r ? n.node(h - r).type : null;
2585
+ if (!f || f.name != a && !f.isInGroup(a))
2586
+ return !1;
2587
+ h--;
2588
+ }
2589
+ }
2590
+ return !0;
2591
+ };
2592
+ return l(e.length - 1, this.open);
2593
+ }
2594
+ textblockFromContext() {
2595
+ let t = this.options.context;
2596
+ if (t)
2597
+ for (let e = t.depth; e >= 0; e--) {
2598
+ let n = t.node(e).contentMatchAt(t.indexAfter(e)).defaultType;
2599
+ if (n && n.isTextblock && n.defaultAttrs)
2600
+ return n;
2601
+ }
2602
+ for (let e in this.parser.schema.nodes) {
2603
+ let n = this.parser.schema.nodes[e];
2604
+ if (n.isTextblock && n.defaultAttrs)
2605
+ return n;
2606
+ }
2607
+ }
2608
+ }
2609
+ function Dt(s) {
2610
+ for (let t = s.firstChild, e = null; t; t = t.nextSibling) {
2611
+ let n = t.nodeType == 1 ? t.nodeName.toLowerCase() : null;
2612
+ n && ct.hasOwnProperty(n) && e ? (e.appendChild(t), t = e) : n == "li" ? e = t : n && (e = null);
2613
+ }
2614
+ }
2615
+ function Pt(s, t) {
2616
+ return (s.matches || s.msMatchesSelector || s.webkitMatchesSelector || s.mozMatchesSelector).call(s, t);
2617
+ }
2618
+ function H(s) {
2619
+ let t = {};
2620
+ for (let e in s)
2621
+ t[e] = s[e];
2622
+ return t;
2623
+ }
2624
+ function Q(s, t) {
2625
+ let e = t.schema.nodes;
2626
+ for (let n in e) {
2627
+ let i = e[n];
2628
+ if (!i.allowsMarkType(s))
2629
+ continue;
2630
+ let r = [], l = (o) => {
2631
+ r.push(o);
2632
+ for (let h = 0; h < o.edgeCount; h++) {
2633
+ let { type: a, next: f } = o.edge(h);
2634
+ if (a == t || r.indexOf(f) < 0 && l(f))
2635
+ return !0;
2636
+ }
2637
+ };
2638
+ if (l(i.contentMatch))
2639
+ return !0;
2640
+ }
2641
+ }
2642
+ class ut {
2643
+ /**
2644
+ Create a serializer. `nodes` should map node names to functions
2645
+ that take a node and return a description of the corresponding
2646
+ DOM. `marks` does the same for mark names, but also gets an
2647
+ argument that tells it whether the mark's content is block or
2648
+ inline content (for typical use, it'll always be inline). A mark
2649
+ serializer may be `null` to indicate that marks of that type
2650
+ should not be serialized.
2651
+ */
2652
+ constructor(t, e) {
2653
+ this.nodes = t, this.marks = e;
2654
+ }
2655
+ /**
2656
+ Serialize the content of this fragment to a DOM fragment. When
2657
+ not in the browser, the `document` option, containing a DOM
2658
+ document, should be passed so that the serializer can create
2659
+ nodes.
2660
+ */
2661
+ serializeFragment(t, e = {}, n) {
2662
+ n || (n = I(e).createDocumentFragment());
2663
+ let i = n, r = [];
2664
+ return t.forEach((l) => {
2665
+ if (r.length || l.marks.length) {
2666
+ let o = 0, h = 0;
2667
+ for (; o < r.length && h < l.marks.length; ) {
2668
+ let a = l.marks[h];
2669
+ if (!this.marks[a.type.name]) {
2670
+ h++;
2671
+ continue;
2672
+ }
2673
+ if (!a.eq(r[o][0]) || a.type.spec.spanning === !1)
2674
+ break;
2675
+ o++, h++;
2676
+ }
2677
+ for (; o < r.length; )
2678
+ i = r.pop()[1];
2679
+ for (; h < l.marks.length; ) {
2680
+ let a = l.marks[h++], f = this.serializeMark(a, l.isInline, e);
2681
+ f && (r.push([a, i]), i.appendChild(f.dom), i = f.contentDOM || f.dom);
2682
+ }
2683
+ }
2684
+ i.appendChild(this.serializeNodeInner(l, e));
2685
+ }), n;
2686
+ }
2687
+ /**
2688
+ @internal
2689
+ */
2690
+ serializeNodeInner(t, e) {
2691
+ let { dom: n, contentDOM: i } = M(I(e), this.nodes[t.type.name](t), null, t.attrs);
2692
+ if (i) {
2693
+ if (t.isLeaf)
2694
+ throw new RangeError("Content hole not allowed in a leaf node spec");
2695
+ this.serializeFragment(t.content, e, i);
2696
+ }
2697
+ return n;
2698
+ }
2699
+ /**
2700
+ Serialize this node to a DOM node. This can be useful when you
2701
+ need to serialize a part of a document, as opposed to the whole
2702
+ document. To serialize a whole document, use
2703
+ [`serializeFragment`](https://prosemirror.net/docs/ref/#model.DOMSerializer.serializeFragment) on
2704
+ its [content](https://prosemirror.net/docs/ref/#model.Node.content).
2705
+ */
2706
+ serializeNode(t, e = {}) {
2707
+ let n = this.serializeNodeInner(t, e);
2708
+ for (let i = t.marks.length - 1; i >= 0; i--) {
2709
+ let r = this.serializeMark(t.marks[i], t.isInline, e);
2710
+ r && ((r.contentDOM || r.dom).appendChild(n), n = r.dom);
2711
+ }
2712
+ return n;
2713
+ }
2714
+ /**
2715
+ @internal
2716
+ */
2717
+ serializeMark(t, e, n = {}) {
2718
+ let i = this.marks[t.type.name];
2719
+ return i && M(I(n), i(t, e), null, t.attrs);
2720
+ }
2721
+ static renderSpec(t, e, n = null, i) {
2722
+ return M(t, e, n, i);
2723
+ }
2724
+ /**
2725
+ Build a serializer using the [`toDOM`](https://prosemirror.net/docs/ref/#model.NodeSpec.toDOM)
2726
+ properties in a schema's node and mark specs.
2727
+ */
2728
+ static fromSchema(t) {
2729
+ return t.cached.domSerializer || (t.cached.domSerializer = new ut(this.nodesFromSchema(t), this.marksFromSchema(t)));
2730
+ }
2731
+ /**
2732
+ Gather the serializers in a schema's node specs into an object.
2733
+ This can be useful as a base to build a custom serializer from.
2734
+ */
2735
+ static nodesFromSchema(t) {
2736
+ let e = X(t.nodes);
2737
+ return e.text || (e.text = (n) => n.text), e;
2738
+ }
2739
+ /**
2740
+ Gather the serializers in a schema's mark specs into an object.
2741
+ */
2742
+ static marksFromSchema(t) {
2743
+ return X(t.marks);
2744
+ }
2745
+ }
2746
+ function X(s) {
2747
+ let t = {};
2748
+ for (let e in s) {
2749
+ let n = s[e].spec.toDOM;
2750
+ n && (t[e] = n);
2751
+ }
2752
+ return t;
2753
+ }
2754
+ function I(s) {
2755
+ return s.document || window.document;
2756
+ }
2757
+ const Y = /* @__PURE__ */ new WeakMap();
2758
+ function Bt(s) {
2759
+ let t = Y.get(s);
2760
+ return t === void 0 && Y.set(s, t = Ft(s)), t;
2761
+ }
2762
+ function Ft(s) {
2763
+ let t = null;
2764
+ function e(n) {
2765
+ if (n && typeof n == "object")
2766
+ if (Array.isArray(n))
2767
+ if (typeof n[0] == "string")
2768
+ t || (t = []), t.push(n);
2769
+ else
2770
+ for (let i = 0; i < n.length; i++)
2771
+ e(n[i]);
2772
+ else
2773
+ for (let i in n)
2774
+ e(n[i]);
2775
+ }
2776
+ return e(s), t;
2777
+ }
2778
+ function M(s, t, e, n) {
2779
+ if (typeof t == "string")
2780
+ return { dom: s.createTextNode(t) };
2781
+ if (t.nodeType != null)
2782
+ return { dom: t };
2783
+ if (t.dom && t.dom.nodeType != null)
2784
+ return t;
2785
+ let i = t[0], r;
2786
+ if (typeof i != "string")
2787
+ throw new RangeError("Invalid array passed to renderSpec");
2788
+ if (n && (r = Bt(n)) && r.indexOf(t) > -1)
2789
+ throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");
2790
+ let l = i.indexOf(" ");
2791
+ l > 0 && (e = i.slice(0, l), i = i.slice(l + 1));
2792
+ let o, h = e ? s.createElementNS(e, i) : s.createElement(i), a = t[1], f = 1;
2793
+ if (a && typeof a == "object" && a.nodeType == null && !Array.isArray(a)) {
2794
+ f = 2;
2795
+ for (let p in a)
2796
+ if (a[p] != null) {
2797
+ let y = p.indexOf(" ");
2798
+ y > 0 ? h.setAttributeNS(p.slice(0, y), p.slice(y + 1), a[p]) : p == "style" && h.style ? h.style.cssText = a[p] : h.setAttribute(p, a[p]);
2799
+ }
2800
+ }
2801
+ for (let p = f; p < t.length; p++) {
2802
+ let y = t[p];
2803
+ if (y === 0) {
2804
+ if (p < t.length - 1 || p > f)
2805
+ throw new RangeError("Content hole must be the only child of its parent node");
2806
+ return { dom: h, contentDOM: h };
2807
+ } else {
2808
+ let { dom: pt, contentDOM: q } = M(s, y, e, n);
2809
+ if (h.appendChild(pt), q) {
2810
+ if (o)
2811
+ throw new RangeError("Multiple content holes");
2812
+ o = q;
2813
+ }
2814
+ }
2815
+ }
2816
+ return { dom: h, contentDOM: o };
2817
+ }
2818
+ const Jt = Symbol("rte-internal-impl"), jt = (s) => s.sort((t, e) => {
2819
+ const n = t.priority - e.priority;
2820
+ return n !== 0 ? n : t.featureName === e.featureName ? 0 : t.featureName > e.featureName ? 1 : -1;
2821
+ }).map((t) => t.value), qt = {
2822
+ high: -10,
2823
+ default: 0
2824
+ };
2825
+ class Lt {
2826
+ }
2827
+ class Ut {
2828
+ /**
2829
+ * Creates a contribution of this feature.
2830
+ */
2831
+ contribution(t, e) {
2832
+ return {
2833
+ featureName: this.name,
2834
+ priority: e ?? qt.default,
2835
+ value: t
2836
+ };
2837
+ }
2838
+ getStyles() {
2839
+ return [];
2840
+ }
2841
+ getSchema(t, e) {
2842
+ return [];
2843
+ }
2844
+ getTextblockAttrs() {
2845
+ return [];
2846
+ }
2847
+ getTextblockMarks() {
2848
+ return [];
2849
+ }
2850
+ getPlugins(t) {
2851
+ return [];
2852
+ }
2853
+ getToolbarItems(t) {
2854
+ return [];
2855
+ }
2856
+ // A feature may include additional features for better organization.
2857
+ getFeatures() {
2858
+ return [this];
2859
+ }
2860
+ }
2861
+ const Vt = (s) => {
2862
+ var t;
2863
+ class e extends (t = Lt, t) {
2864
+ constructor(...i) {
2865
+ super(), this[Jt] = new s(...i);
2866
+ }
2867
+ }
2868
+ return e;
2869
+ };
2870
+ export {
2871
+ ut as D,
2872
+ c as F,
2873
+ u as M,
2874
+ x as N,
2875
+ D as R,
2876
+ g as S,
2877
+ J as a,
2878
+ B as b,
2879
+ Ut as c,
2880
+ qt as d,
2881
+ Wt as e,
2882
+ Vt as f,
2883
+ mt as g,
2884
+ Jt as i,
2885
+ jt as s
2886
+ };