@burdenoff/microfe-support 2026.819.3 → 2026.819.5

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 (82) hide show
  1. package/dist/microfe-support.css +1 -1
  2. package/dist/node_modules/@tiptap/core/dist/index.js +3453 -0
  3. package/dist/node_modules/@tiptap/core/dist/index.js.map +1 -0
  4. package/dist/node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.js +21 -0
  5. package/dist/node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.js.map +1 -0
  6. package/dist/node_modules/@tiptap/extension-blockquote/dist/index.js +76 -0
  7. package/dist/node_modules/@tiptap/extension-blockquote/dist/index.js.map +1 -0
  8. package/dist/node_modules/@tiptap/extension-bold/dist/index.js +74 -0
  9. package/dist/node_modules/@tiptap/extension-bold/dist/index.js.map +1 -0
  10. package/dist/node_modules/@tiptap/extension-code/dist/index.js +68 -0
  11. package/dist/node_modules/@tiptap/extension-code/dist/index.js.map +1 -0
  12. package/dist/node_modules/@tiptap/extension-code-block/dist/index.js +160 -0
  13. package/dist/node_modules/@tiptap/extension-code-block/dist/index.js.map +1 -0
  14. package/dist/node_modules/@tiptap/extension-document/dist/index.js +12 -0
  15. package/dist/node_modules/@tiptap/extension-document/dist/index.js.map +1 -0
  16. package/dist/node_modules/@tiptap/extension-hard-break/dist/index.js +51 -0
  17. package/dist/node_modules/@tiptap/extension-hard-break/dist/index.js.map +1 -0
  18. package/dist/node_modules/@tiptap/extension-heading/dist/index.js +68 -0
  19. package/dist/node_modules/@tiptap/extension-heading/dist/index.js.map +1 -0
  20. package/dist/node_modules/@tiptap/extension-horizontal-rule/dist/index.js +50 -0
  21. package/dist/node_modules/@tiptap/extension-horizontal-rule/dist/index.js.map +1 -0
  22. package/dist/node_modules/@tiptap/extension-italic/dist/index.js +71 -0
  23. package/dist/node_modules/@tiptap/extension-italic/dist/index.js.map +1 -0
  24. package/dist/node_modules/@tiptap/extension-link/dist/index.js +373 -0
  25. package/dist/node_modules/@tiptap/extension-link/dist/index.js.map +1 -0
  26. package/dist/node_modules/@tiptap/extension-list/dist/index.js +964 -0
  27. package/dist/node_modules/@tiptap/extension-list/dist/index.js.map +1 -0
  28. package/dist/node_modules/@tiptap/extension-paragraph/dist/index.js +46 -0
  29. package/dist/node_modules/@tiptap/extension-paragraph/dist/index.js.map +1 -0
  30. package/dist/node_modules/@tiptap/extension-placeholder/dist/index.js +7 -0
  31. package/dist/node_modules/@tiptap/extension-placeholder/dist/index.js.map +1 -0
  32. package/dist/node_modules/@tiptap/extension-strike/dist/index.js +56 -0
  33. package/dist/node_modules/@tiptap/extension-strike/dist/index.js.map +1 -0
  34. package/dist/node_modules/@tiptap/extension-text/dist/index.js +15 -0
  35. package/dist/node_modules/@tiptap/extension-text/dist/index.js.map +1 -0
  36. package/dist/node_modules/@tiptap/extension-underline/dist/index.js +63 -0
  37. package/dist/node_modules/@tiptap/extension-underline/dist/index.js.map +1 -0
  38. package/dist/node_modules/@tiptap/extensions/dist/index.js +459 -0
  39. package/dist/node_modules/@tiptap/extensions/dist/index.js.map +1 -0
  40. package/dist/node_modules/@tiptap/react/dist/index.js +316 -0
  41. package/dist/node_modules/@tiptap/react/dist/index.js.map +1 -0
  42. package/dist/node_modules/@tiptap/starter-kit/dist/index.js +29 -0
  43. package/dist/node_modules/@tiptap/starter-kit/dist/index.js.map +1 -0
  44. package/dist/node_modules/fast-equals/dist/es/index.js +267 -0
  45. package/dist/node_modules/fast-equals/dist/es/index.js.map +1 -0
  46. package/dist/node_modules/linkifyjs/dist/linkify.js +514 -0
  47. package/dist/node_modules/linkifyjs/dist/linkify.js.map +1 -0
  48. package/dist/node_modules/orderedmap/dist/index.js +69 -0
  49. package/dist/node_modules/orderedmap/dist/index.js.map +1 -0
  50. package/dist/node_modules/prosemirror-commands/dist/index.js +335 -0
  51. package/dist/node_modules/prosemirror-commands/dist/index.js.map +1 -0
  52. package/dist/node_modules/prosemirror-dropcursor/dist/index.js +113 -0
  53. package/dist/node_modules/prosemirror-dropcursor/dist/index.js.map +1 -0
  54. package/dist/node_modules/prosemirror-gapcursor/dist/index.js +173 -0
  55. package/dist/node_modules/prosemirror-gapcursor/dist/index.js.map +1 -0
  56. package/dist/node_modules/prosemirror-history/dist/index.js +214 -0
  57. package/dist/node_modules/prosemirror-history/dist/index.js.map +1 -0
  58. package/dist/node_modules/prosemirror-keymap/dist/index.js +52 -0
  59. package/dist/node_modules/prosemirror-keymap/dist/index.js.map +1 -0
  60. package/dist/node_modules/prosemirror-model/dist/index.js +1786 -0
  61. package/dist/node_modules/prosemirror-model/dist/index.js.map +1 -0
  62. package/dist/node_modules/prosemirror-schema-list/dist/index.js +75 -0
  63. package/dist/node_modules/prosemirror-schema-list/dist/index.js.map +1 -0
  64. package/dist/node_modules/prosemirror-state/dist/index.js +527 -0
  65. package/dist/node_modules/prosemirror-state/dist/index.js.map +1 -0
  66. package/dist/node_modules/prosemirror-transform/dist/index.js +1153 -0
  67. package/dist/node_modules/prosemirror-transform/dist/index.js.map +1 -0
  68. package/dist/node_modules/prosemirror-view/dist/index.js +3296 -0
  69. package/dist/node_modules/prosemirror-view/dist/index.js.map +1 -0
  70. package/dist/node_modules/rope-sequence/dist/index.js +85 -0
  71. package/dist/node_modules/rope-sequence/dist/index.js.map +1 -0
  72. package/dist/node_modules/w3c-keyname/index.js +90 -0
  73. package/dist/node_modules/w3c-keyname/index.js.map +1 -0
  74. package/dist/support/components/careers/RichTextEditor.d.ts +16 -0
  75. package/dist/support/components/careers/RichTextEditor.js +87 -0
  76. package/dist/support/components/careers/RichTextEditor.js.map +1 -0
  77. package/dist/support/pages/JobApplicationDetailPage.d.ts +1 -0
  78. package/dist/support/pages/JobApplicationDetailPage.js +338 -336
  79. package/dist/support/pages/JobApplicationDetailPage.js.map +1 -1
  80. package/dist/support/pages/JobPostingDetailPage.js +310 -303
  81. package/dist/support/pages/JobPostingDetailPage.js.map +1 -1
  82. package/package.json +4 -1
@@ -0,0 +1,1153 @@
1
+ import { Fragment as e, Mark as t, MarkType as n, ReplaceError as r, Slice as i } from "../../prosemirror-model/dist/index.js";
2
+ //#region node_modules/prosemirror-transform/dist/index.js
3
+ var a = 65535, o = 2 ** 16;
4
+ function s(e, t) {
5
+ return e + t * o;
6
+ }
7
+ function c(e) {
8
+ return e & a;
9
+ }
10
+ function l(e) {
11
+ return (e - (e & a)) / o;
12
+ }
13
+ var u = 1, d = 2, f = 4, p = 8, m = class {
14
+ constructor(e, t, n) {
15
+ this.pos = e, this.delInfo = t, this.recover = n;
16
+ }
17
+ get deleted() {
18
+ return (this.delInfo & p) > 0;
19
+ }
20
+ get deletedBefore() {
21
+ return (this.delInfo & 5) > 0;
22
+ }
23
+ get deletedAfter() {
24
+ return (this.delInfo & 6) > 0;
25
+ }
26
+ get deletedAcross() {
27
+ return (this.delInfo & f) > 0;
28
+ }
29
+ }, h = class e {
30
+ constructor(t, n = !1) {
31
+ if (this.ranges = t, this.inverted = n, !t.length && e.empty) return e.empty;
32
+ }
33
+ recover(e) {
34
+ let t = 0, n = c(e);
35
+ if (!this.inverted) for (let e = 0; e < n; e++) t += this.ranges[e * 3 + 2] - this.ranges[e * 3 + 1];
36
+ return this.ranges[n * 3] + t + l(e);
37
+ }
38
+ mapResult(e, t = 1) {
39
+ return this._map(e, t, !1);
40
+ }
41
+ map(e, t = 1) {
42
+ return this._map(e, t, !0);
43
+ }
44
+ _map(e, t, n) {
45
+ let r = 0, i = this.inverted ? 2 : 1, a = this.inverted ? 1 : 2;
46
+ for (let o = 0; o < this.ranges.length; o += 3) {
47
+ let c = this.ranges[o] - (this.inverted ? r : 0);
48
+ if (c > e) break;
49
+ let l = this.ranges[o + i], h = this.ranges[o + a], g = c + l;
50
+ if (e <= g) {
51
+ let i = l ? e == c ? -1 : e == g ? 1 : t : t, a = c + r + (i < 0 ? 0 : h);
52
+ if (n) return a;
53
+ let _ = e == (t < 0 ? c : g) ? null : s(o / 3, e - c), v = e == c ? d : e == g ? u : f;
54
+ return (t < 0 ? e != c : e != g) && (v |= p), new m(a, v, _);
55
+ }
56
+ r += h - l;
57
+ }
58
+ return n ? e + r : new m(e + r, 0, null);
59
+ }
60
+ touches(e, t) {
61
+ let n = 0, r = c(t), i = this.inverted ? 2 : 1, a = this.inverted ? 1 : 2;
62
+ for (let t = 0; t < this.ranges.length; t += 3) {
63
+ let o = this.ranges[t] - (this.inverted ? n : 0);
64
+ if (o > e) break;
65
+ let s = this.ranges[t + i];
66
+ if (e <= o + s && t == r * 3) return !0;
67
+ n += this.ranges[t + a] - s;
68
+ }
69
+ return !1;
70
+ }
71
+ forEach(e) {
72
+ let t = this.inverted ? 2 : 1, n = this.inverted ? 1 : 2;
73
+ for (let r = 0, i = 0; r < this.ranges.length; r += 3) {
74
+ let a = this.ranges[r], o = a - (this.inverted ? i : 0), s = a + (this.inverted ? 0 : i), c = this.ranges[r + t], l = this.ranges[r + n];
75
+ e(o, o + c, s, s + l), i += l - c;
76
+ }
77
+ }
78
+ invert() {
79
+ return new e(this.ranges, !this.inverted);
80
+ }
81
+ toString() {
82
+ return (this.inverted ? "-" : "") + JSON.stringify(this.ranges);
83
+ }
84
+ static offset(t) {
85
+ return t == 0 ? e.empty : new e(t < 0 ? [
86
+ 0,
87
+ -t,
88
+ 0
89
+ ] : [
90
+ 0,
91
+ 0,
92
+ t
93
+ ]);
94
+ }
95
+ };
96
+ h.empty = new h([]);
97
+ var g = class e {
98
+ constructor(e, t, n = 0, r = e ? e.length : 0) {
99
+ this.mirror = t, this.from = n, this.to = r, this._maps = e || [], this.ownData = !(e || t);
100
+ }
101
+ get maps() {
102
+ return this._maps;
103
+ }
104
+ slice(t = 0, n = this.maps.length) {
105
+ return new e(this._maps, this.mirror, t, n);
106
+ }
107
+ appendMap(e, t) {
108
+ this.ownData ||= (this._maps = this._maps.slice(), this.mirror = this.mirror && this.mirror.slice(), !0), this.to = this._maps.push(e), t != null && this.setMirror(this._maps.length - 1, t);
109
+ }
110
+ appendMapping(e) {
111
+ for (let t = 0, n = this._maps.length; t < e._maps.length; t++) {
112
+ let r = e.getMirror(t);
113
+ this.appendMap(e._maps[t], r != null && r < t ? n + r : void 0);
114
+ }
115
+ }
116
+ getMirror(e) {
117
+ if (this.mirror) {
118
+ for (let t = 0; t < this.mirror.length; t++) if (this.mirror[t] == e) return this.mirror[t + (t % 2 ? -1 : 1)];
119
+ }
120
+ }
121
+ setMirror(e, t) {
122
+ this.mirror ||= [], this.mirror.push(e, t);
123
+ }
124
+ appendMappingInverted(e) {
125
+ for (let t = e.maps.length - 1, n = this._maps.length + e._maps.length; t >= 0; t--) {
126
+ let r = e.getMirror(t);
127
+ this.appendMap(e._maps[t].invert(), r != null && r > t ? n - r - 1 : void 0);
128
+ }
129
+ }
130
+ invert() {
131
+ let t = new e();
132
+ return t.appendMappingInverted(this), t;
133
+ }
134
+ map(e, t = 1) {
135
+ if (this.mirror) return this._map(e, t, !0);
136
+ for (let n = this.from; n < this.to; n++) e = this._maps[n].map(e, t);
137
+ return e;
138
+ }
139
+ mapResult(e, t = 1) {
140
+ return this._map(e, t, !1);
141
+ }
142
+ _map(e, t, n) {
143
+ let r = 0;
144
+ for (let n = this.from; n < this.to; n++) {
145
+ let i = this._maps[n].mapResult(e, t);
146
+ if (i.recover != null) {
147
+ let t = this.getMirror(n);
148
+ if (t != null && t > n && t < this.to) {
149
+ n = t, e = this._maps[t].recover(i.recover);
150
+ continue;
151
+ }
152
+ }
153
+ r |= i.delInfo, e = i.pos;
154
+ }
155
+ return n ? e : new m(e, r, null);
156
+ }
157
+ }, _ = Object.create(null), v = class {
158
+ getMap() {
159
+ return h.empty;
160
+ }
161
+ merge(e) {
162
+ return null;
163
+ }
164
+ static fromJSON(e, t) {
165
+ if (!t || !t.stepType) throw RangeError("Invalid input for Step.fromJSON");
166
+ let n = _[t.stepType];
167
+ if (!n) throw RangeError(`No step type ${t.stepType} defined`);
168
+ return n.fromJSON(e, t);
169
+ }
170
+ static jsonID(e, t) {
171
+ if (e in _) throw RangeError("Duplicate use of step JSON ID " + e);
172
+ return _[e] = t, t.prototype.jsonID = e, t;
173
+ }
174
+ }, y = class e {
175
+ constructor(e, t) {
176
+ this.doc = e, this.failed = t;
177
+ }
178
+ static ok(t) {
179
+ return new e(t, null);
180
+ }
181
+ static fail(t) {
182
+ return new e(null, t);
183
+ }
184
+ static fromReplace(t, n, i, a) {
185
+ try {
186
+ return e.ok(t.replace(n, i, a));
187
+ } catch (t) {
188
+ if (t instanceof r) return e.fail(t.message);
189
+ throw t;
190
+ }
191
+ }
192
+ };
193
+ function b(t, n, r) {
194
+ let i = [];
195
+ for (let e = 0; e < t.childCount; e++) {
196
+ let a = t.child(e);
197
+ a.content.size && (a = a.copy(b(a.content, n, a))), a.isInline && (a = n(a, r, e)), i.push(a);
198
+ }
199
+ return e.fromArray(i);
200
+ }
201
+ var x = class e extends v {
202
+ constructor(e, t, n) {
203
+ super(), this.from = e, this.to = t, this.mark = n;
204
+ }
205
+ apply(e) {
206
+ let t = e.slice(this.from, this.to), n = e.resolve(this.from), r = n.node(n.sharedDepth(this.to)), a = new i(b(t.content, (e, t) => !e.isAtom || !t.type.allowsMarkType(this.mark.type) ? e : e.mark(this.mark.addToSet(e.marks)), r), t.openStart, t.openEnd);
207
+ return y.fromReplace(e, this.from, this.to, a);
208
+ }
209
+ invert() {
210
+ return new S(this.from, this.to, this.mark);
211
+ }
212
+ map(t) {
213
+ let n = t.mapResult(this.from, 1), r = t.mapResult(this.to, -1);
214
+ return n.deleted && r.deleted || n.pos >= r.pos ? null : new e(n.pos, r.pos, this.mark);
215
+ }
216
+ merge(t) {
217
+ return t instanceof e && t.mark.eq(this.mark) && this.from <= t.to && this.to >= t.from ? new e(Math.min(this.from, t.from), Math.max(this.to, t.to), this.mark) : null;
218
+ }
219
+ toJSON() {
220
+ return {
221
+ stepType: "addMark",
222
+ mark: this.mark.toJSON(),
223
+ from: this.from,
224
+ to: this.to
225
+ };
226
+ }
227
+ static fromJSON(t, n) {
228
+ if (typeof n.from != "number" || typeof n.to != "number") throw RangeError("Invalid input for AddMarkStep.fromJSON");
229
+ return new e(n.from, n.to, t.markFromJSON(n.mark));
230
+ }
231
+ };
232
+ v.jsonID("addMark", x);
233
+ var S = class e extends v {
234
+ constructor(e, t, n) {
235
+ super(), this.from = e, this.to = t, this.mark = n;
236
+ }
237
+ apply(e) {
238
+ let t = e.slice(this.from, this.to), n = new i(b(t.content, (e) => e.mark(this.mark.removeFromSet(e.marks)), e), t.openStart, t.openEnd);
239
+ return y.fromReplace(e, this.from, this.to, n);
240
+ }
241
+ invert() {
242
+ return new x(this.from, this.to, this.mark);
243
+ }
244
+ map(t) {
245
+ let n = t.mapResult(this.from, 1), r = t.mapResult(this.to, -1);
246
+ return n.deleted && r.deleted || n.pos >= r.pos ? null : new e(n.pos, r.pos, this.mark);
247
+ }
248
+ merge(t) {
249
+ return t instanceof e && t.mark.eq(this.mark) && this.from <= t.to && this.to >= t.from ? new e(Math.min(this.from, t.from), Math.max(this.to, t.to), this.mark) : null;
250
+ }
251
+ toJSON() {
252
+ return {
253
+ stepType: "removeMark",
254
+ mark: this.mark.toJSON(),
255
+ from: this.from,
256
+ to: this.to
257
+ };
258
+ }
259
+ static fromJSON(t, n) {
260
+ if (typeof n.from != "number" || typeof n.to != "number") throw RangeError("Invalid input for RemoveMarkStep.fromJSON");
261
+ return new e(n.from, n.to, t.markFromJSON(n.mark));
262
+ }
263
+ };
264
+ v.jsonID("removeMark", S);
265
+ var C = class t extends v {
266
+ constructor(e, t) {
267
+ super(), this.pos = e, this.mark = t;
268
+ }
269
+ apply(t) {
270
+ let n = t.nodeAt(this.pos);
271
+ if (!n) return y.fail("No node at mark step's position");
272
+ let r = n.type.create(n.attrs, null, this.mark.addToSet(n.marks));
273
+ return y.fromReplace(t, this.pos, this.pos + 1, new i(e.from(r), 0, +!n.isLeaf));
274
+ }
275
+ invert(e) {
276
+ let n = e.nodeAt(this.pos);
277
+ if (n) {
278
+ let e = this.mark.addToSet(n.marks);
279
+ if (e.length == n.marks.length) {
280
+ for (let r = 0; r < n.marks.length; r++) if (!n.marks[r].isInSet(e)) return new t(this.pos, n.marks[r]);
281
+ return new t(this.pos, this.mark);
282
+ }
283
+ }
284
+ return new w(this.pos, this.mark);
285
+ }
286
+ map(e) {
287
+ let n = e.mapResult(this.pos, 1);
288
+ return n.deletedAfter ? null : new t(n.pos, this.mark);
289
+ }
290
+ toJSON() {
291
+ return {
292
+ stepType: "addNodeMark",
293
+ pos: this.pos,
294
+ mark: this.mark.toJSON()
295
+ };
296
+ }
297
+ static fromJSON(e, n) {
298
+ if (typeof n.pos != "number") throw RangeError("Invalid input for AddNodeMarkStep.fromJSON");
299
+ return new t(n.pos, e.markFromJSON(n.mark));
300
+ }
301
+ };
302
+ v.jsonID("addNodeMark", C);
303
+ var w = class t extends v {
304
+ constructor(e, t) {
305
+ super(), this.pos = e, this.mark = t;
306
+ }
307
+ apply(t) {
308
+ let n = t.nodeAt(this.pos);
309
+ if (!n) return y.fail("No node at mark step's position");
310
+ let r = n.type.create(n.attrs, null, this.mark.removeFromSet(n.marks));
311
+ return y.fromReplace(t, this.pos, this.pos + 1, new i(e.from(r), 0, +!n.isLeaf));
312
+ }
313
+ invert(e) {
314
+ let t = e.nodeAt(this.pos);
315
+ return !t || !this.mark.isInSet(t.marks) ? this : new C(this.pos, this.mark);
316
+ }
317
+ map(e) {
318
+ let n = e.mapResult(this.pos, 1);
319
+ return n.deletedAfter ? null : new t(n.pos, this.mark);
320
+ }
321
+ toJSON() {
322
+ return {
323
+ stepType: "removeNodeMark",
324
+ pos: this.pos,
325
+ mark: this.mark.toJSON()
326
+ };
327
+ }
328
+ static fromJSON(e, n) {
329
+ if (typeof n.pos != "number") throw RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");
330
+ return new t(n.pos, e.markFromJSON(n.mark));
331
+ }
332
+ };
333
+ v.jsonID("removeNodeMark", w);
334
+ var T = class e extends v {
335
+ constructor(e, t, n, r = !1) {
336
+ super(), this.from = e, this.to = t, this.slice = n, this.structure = r;
337
+ }
338
+ apply(e) {
339
+ return this.structure && D(e, this.from, this.to) ? y.fail("Structure replace would overwrite content") : y.fromReplace(e, this.from, this.to, this.slice);
340
+ }
341
+ getMap() {
342
+ return new h([
343
+ this.from,
344
+ this.to - this.from,
345
+ this.slice.size
346
+ ]);
347
+ }
348
+ invert(t) {
349
+ return new e(this.from, this.from + this.slice.size, t.slice(this.from, this.to));
350
+ }
351
+ map(t) {
352
+ let n = t.mapResult(this.to, -1), r = this.from == this.to && e.MAP_BIAS < 0 ? n : t.mapResult(this.from, 1);
353
+ return r.deletedAcross && n.deletedAcross ? null : new e(r.pos, Math.max(r.pos, n.pos), this.slice, this.structure);
354
+ }
355
+ merge(t) {
356
+ if (!(t instanceof e) || t.structure || this.structure) return null;
357
+ if (this.from + this.slice.size == t.from && !this.slice.openEnd && !t.slice.openStart) {
358
+ let n = this.slice.size + t.slice.size == 0 ? i.empty : new i(this.slice.content.append(t.slice.content), this.slice.openStart, t.slice.openEnd);
359
+ return new e(this.from, this.to + (t.to - t.from), n, this.structure);
360
+ }
361
+ if (t.to == this.from && !this.slice.openStart && !t.slice.openEnd) {
362
+ let n = this.slice.size + t.slice.size == 0 ? i.empty : new i(t.slice.content.append(this.slice.content), t.slice.openStart, this.slice.openEnd);
363
+ return new e(t.from, this.to, n, this.structure);
364
+ }
365
+ return null;
366
+ }
367
+ toJSON() {
368
+ let e = {
369
+ stepType: "replace",
370
+ from: this.from,
371
+ to: this.to
372
+ };
373
+ return this.slice.size && (e.slice = this.slice.toJSON()), this.structure && (e.structure = !0), e;
374
+ }
375
+ static fromJSON(t, n) {
376
+ if (typeof n.from != "number" || typeof n.to != "number") throw RangeError("Invalid input for ReplaceStep.fromJSON");
377
+ return new e(n.from, n.to, i.fromJSON(t, n.slice), !!n.structure);
378
+ }
379
+ };
380
+ T.MAP_BIAS = 1, v.jsonID("replace", T);
381
+ var E = class e extends v {
382
+ constructor(e, t, n, r, i, a, o = !1) {
383
+ super(), this.from = e, this.to = t, this.gapFrom = n, this.gapTo = r, this.slice = i, this.insert = a, this.structure = o;
384
+ }
385
+ apply(e) {
386
+ if (this.structure && (D(e, this.from, this.gapFrom) || D(e, this.gapTo, this.to))) return y.fail("Structure gap-replace would overwrite content");
387
+ let t = e.slice(this.gapFrom, this.gapTo);
388
+ if (t.openStart || t.openEnd) return y.fail("Gap is not a flat range");
389
+ let n = this.slice.insertAt(this.insert, t.content);
390
+ return n ? y.fromReplace(e, this.from, this.to, n) : y.fail("Content does not fit in gap");
391
+ }
392
+ getMap() {
393
+ return new h([
394
+ this.from,
395
+ this.gapFrom - this.from,
396
+ this.insert,
397
+ this.gapTo,
398
+ this.to - this.gapTo,
399
+ this.slice.size - this.insert
400
+ ]);
401
+ }
402
+ invert(t) {
403
+ let n = this.gapTo - this.gapFrom;
404
+ return new e(this.from, this.from + this.slice.size + n, this.from + this.insert, this.from + this.insert + n, t.slice(this.from, this.to).removeBetween(this.gapFrom - this.from, this.gapTo - this.from), this.gapFrom - this.from, this.structure);
405
+ }
406
+ map(t) {
407
+ let n = t.mapResult(this.from, 1), r = t.mapResult(this.to, -1), i = this.from == this.gapFrom ? n.pos : t.map(this.gapFrom, -1), a = this.to == this.gapTo ? r.pos : t.map(this.gapTo, 1);
408
+ return n.deletedAcross && r.deletedAcross || i < n.pos || a > r.pos ? null : new e(n.pos, r.pos, i, a, this.slice, this.insert, this.structure);
409
+ }
410
+ toJSON() {
411
+ let e = {
412
+ stepType: "replaceAround",
413
+ from: this.from,
414
+ to: this.to,
415
+ gapFrom: this.gapFrom,
416
+ gapTo: this.gapTo,
417
+ insert: this.insert
418
+ };
419
+ return this.slice.size && (e.slice = this.slice.toJSON()), this.structure && (e.structure = !0), e;
420
+ }
421
+ static fromJSON(t, n) {
422
+ if (typeof n.from != "number" || typeof n.to != "number" || typeof n.gapFrom != "number" || typeof n.gapTo != "number" || typeof n.insert != "number") throw RangeError("Invalid input for ReplaceAroundStep.fromJSON");
423
+ return new e(n.from, n.to, n.gapFrom, n.gapTo, i.fromJSON(t, n.slice), n.insert, !!n.structure);
424
+ }
425
+ };
426
+ v.jsonID("replaceAround", E);
427
+ function D(e, t, n) {
428
+ let r = e.resolve(t), i = n - t, a = r.depth;
429
+ for (; i > 0 && a > 0 && r.indexAfter(a) == r.node(a).childCount;) a--, i--;
430
+ if (i > 0) {
431
+ let e = r.node(a).maybeChild(r.indexAfter(a));
432
+ for (; i > 0;) {
433
+ if (!e || e.isLeaf) return !0;
434
+ e = e.firstChild, i--;
435
+ }
436
+ }
437
+ return !1;
438
+ }
439
+ function ee(e, t, n, r) {
440
+ let i = [], a = [], o, s;
441
+ e.doc.nodesBetween(t, n, (e, c, l) => {
442
+ if (!e.isInline) return;
443
+ let u = e.marks;
444
+ if (!r.isInSet(u) && l.type.allowsMarkType(r.type)) {
445
+ let l = Math.max(c, t), d = Math.min(c + e.nodeSize, n), f = r.addToSet(u);
446
+ for (let e = 0; e < u.length; e++) u[e].isInSet(f) || (o && o.to == l && o.mark.eq(u[e]) ? o.to = d : i.push(o = new S(l, d, u[e])));
447
+ s && s.to == l ? s.to = d : a.push(s = new x(l, d, r));
448
+ }
449
+ }), i.forEach((t) => e.step(t)), a.forEach((t) => e.step(t));
450
+ }
451
+ function te(e, t, r, i) {
452
+ let a = [], o = 0;
453
+ e.doc.nodesBetween(t, r, (e, s) => {
454
+ if (!e.isInline) return;
455
+ o++;
456
+ let c = null;
457
+ if (i instanceof n) {
458
+ let t = e.marks, n;
459
+ for (; n = i.isInSet(t);) (c ||= []).push(n), t = n.removeFromSet(t);
460
+ } else i ? i.isInSet(e.marks) && (c = [i]) : c = e.marks;
461
+ if (c && c.length) {
462
+ let n = Math.min(s + e.nodeSize, r);
463
+ for (let e = 0; e < c.length; e++) {
464
+ let r = c[e], i;
465
+ for (let e = 0; e < a.length; e++) {
466
+ let t = a[e];
467
+ t.step == o - 1 && r.eq(a[e].style) && (i = t);
468
+ }
469
+ i ? (i.to = n, i.step = o) : a.push({
470
+ style: r,
471
+ from: Math.max(s, t),
472
+ to: n,
473
+ step: o
474
+ });
475
+ }
476
+ }
477
+ }), a.forEach((t) => e.step(new S(t.from, t.to, t.style)));
478
+ }
479
+ function O(t, n, r, a = r.contentMatch, o = !0) {
480
+ let s = t.doc.nodeAt(n), c = [], l = n + 1;
481
+ for (let n = 0; n < s.childCount; n++) {
482
+ let u = s.child(n), d = l + u.nodeSize, f = a.matchType(u.type);
483
+ if (!f) c.push(new T(l, d, i.empty));
484
+ else {
485
+ a = f;
486
+ for (let e = 0; e < u.marks.length; e++) r.allowsMarkType(u.marks[e].type) || t.step(new S(l, d, u.marks[e]));
487
+ if (o && u.isText && r.whitespace != "pre") {
488
+ let t, n = /\r?\n|\r/g, a;
489
+ for (; t = n.exec(u.text);) a ||= new i(e.from(r.schema.text(" ", r.allowedMarks(u.marks))), 0, 0), c.push(new T(l + t.index, l + t.index + t[0].length, a));
490
+ }
491
+ }
492
+ l = d;
493
+ }
494
+ if (!a.validEnd) {
495
+ let n = a.fillBefore(e.empty, !0);
496
+ t.replace(l, l, new i(n, 0, 0));
497
+ }
498
+ for (let e = c.length - 1; e >= 0; e--) t.step(c[e]);
499
+ }
500
+ function ne(e, t, n) {
501
+ return (t == 0 || e.canReplace(t, e.childCount)) && (n == e.childCount || e.canReplace(0, n));
502
+ }
503
+ function re(e) {
504
+ let t = e.parent.content.cutByIndex(e.startIndex, e.endIndex);
505
+ for (let n = e.depth, r = 0, i = 0;; --n) {
506
+ let a = e.$from.node(n), o = e.$from.index(n) + r, s = e.$to.indexAfter(n) - i;
507
+ if (n < e.depth && a.canReplace(o, s, t)) return n;
508
+ if (n == 0 || a.type.spec.isolating || !ne(a, o, s)) break;
509
+ o && (r = 1), s < a.childCount && (i = 1);
510
+ }
511
+ return null;
512
+ }
513
+ function ie(t, n, r) {
514
+ let { $from: a, $to: o, depth: s } = n, c = a.before(s + 1), l = o.after(s + 1), u = c, d = l, f = e.empty, p = 0;
515
+ for (let t = s, n = !1; t > r; t--) n || a.index(t) > 0 ? (n = !0, f = e.from(a.node(t).copy(f)), p++) : u--;
516
+ let m = e.empty, h = 0;
517
+ for (let t = s, n = !1; t > r; t--) n || o.after(t + 1) < o.end(t) ? (n = !0, m = e.from(o.node(t).copy(m)), h++) : d++;
518
+ t.step(new E(u, d, c, l, new i(f.append(m), p, h), f.size - p, !0));
519
+ }
520
+ function ae(e, t, n = null, r = e) {
521
+ let i = oe(e, t), a = i && se(r, t);
522
+ return a ? i.map(k).concat({
523
+ type: t,
524
+ attrs: n
525
+ }).concat(a.map(k)) : null;
526
+ }
527
+ function k(e) {
528
+ return {
529
+ type: e,
530
+ attrs: null
531
+ };
532
+ }
533
+ function oe(e, t) {
534
+ let { parent: n, startIndex: r, endIndex: i } = e, a = n.contentMatchAt(r).findWrapping(t);
535
+ if (!a) return null;
536
+ let o = a.length ? a[0] : t;
537
+ return n.canReplaceWith(r, i, o) ? a : null;
538
+ }
539
+ function se(e, t) {
540
+ let { parent: n, startIndex: r, endIndex: i } = e, a = n.child(r), o = t.contentMatch.findWrapping(a.type);
541
+ if (!o) return null;
542
+ let s = (o.length ? o[o.length - 1] : t).contentMatch;
543
+ for (let e = r; s && e < i; e++) s = s.matchType(n.child(e).type);
544
+ return !s || !s.validEnd ? null : o;
545
+ }
546
+ function A(t, n, r) {
547
+ let a = e.empty;
548
+ for (let t = r.length - 1; t >= 0; t--) {
549
+ if (a.size) {
550
+ let e = r[t].type.contentMatch.matchFragment(a);
551
+ if (!e || !e.validEnd) throw RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper");
552
+ }
553
+ a = e.from(r[t].type.create(r[t].attrs, a));
554
+ }
555
+ let o = n.start, s = n.end;
556
+ t.step(new E(o, s, o, s, new i(a, 0, 0), r.length, !0));
557
+ }
558
+ function j(t, n, r, a, o) {
559
+ if (!a.isTextblock) throw RangeError("Type given to setBlockType should be a textblock");
560
+ let s = t.steps.length;
561
+ t.doc.nodesBetween(n, r, (n, r) => {
562
+ let c = typeof o == "function" ? o(n) : o;
563
+ if (n.isTextblock && !n.hasMarkup(a, c) && P(t.doc, t.mapping.slice(s).map(r), a)) {
564
+ let o = null;
565
+ if (a.schema.linebreakReplacement) {
566
+ let e = a.whitespace == "pre", t = !!a.contentMatch.matchType(a.schema.linebreakReplacement);
567
+ e && !t ? o = !1 : !e && t && (o = !0);
568
+ }
569
+ o === !1 && N(t, n, r, s), O(t, t.mapping.slice(s).map(r, 1), a, void 0, o === null);
570
+ let l = t.mapping.slice(s), u = l.map(r, 1), d = l.map(r + n.nodeSize, 1);
571
+ return t.step(new E(u, d, u + 1, d - 1, new i(e.from(a.create(c, null, n.marks)), 0, 0), 1, !0)), o === !0 && M(t, n, r, s), !1;
572
+ }
573
+ });
574
+ }
575
+ function M(e, t, n, r) {
576
+ t.forEach((i, a) => {
577
+ if (i.isText) {
578
+ let o, s = /\r?\n|\r/g;
579
+ for (; o = s.exec(i.text);) {
580
+ let i = e.mapping.slice(r).map(n + 1 + a + o.index);
581
+ e.replaceWith(i, i + 1, t.type.schema.linebreakReplacement.create());
582
+ }
583
+ }
584
+ });
585
+ }
586
+ function N(e, t, n, r) {
587
+ t.forEach((i, a) => {
588
+ if (i.type == i.type.schema.linebreakReplacement) {
589
+ let i = e.mapping.slice(r).map(n + 1 + a);
590
+ e.replaceWith(i, i + 1, t.type.schema.text("\n"));
591
+ }
592
+ });
593
+ }
594
+ function P(e, t, n) {
595
+ let r = e.resolve(t), i = r.index();
596
+ return r.parent.canReplaceWith(i, i + 1, n);
597
+ }
598
+ function F(t, n, r, a, o) {
599
+ let s = t.doc.nodeAt(n);
600
+ if (!s) throw RangeError("No node at given position");
601
+ r ||= s.type;
602
+ let c = r.create(a, null, o || s.marks);
603
+ if (s.isLeaf) return t.replaceWith(n, n + s.nodeSize, c);
604
+ if (!r.validContent(s.content)) throw RangeError("Invalid content for node type " + r.name);
605
+ t.step(new E(n, n + s.nodeSize, n + 1, n + s.nodeSize - 1, new i(e.from(c), 0, 0), 1, !0));
606
+ }
607
+ function ce(e, t, n = 1, r) {
608
+ let i = e.resolve(t), a = i.depth - n, o = r && r[r.length - 1] || i.parent;
609
+ if (a < 0 || i.parent.type.spec.isolating || !i.parent.canReplace(i.index(), i.parent.childCount) || !o.type.validContent(i.parent.content.cutByIndex(i.index(), i.parent.childCount))) return !1;
610
+ for (let e = i.depth - 1, t = n - 2; e > a; e--, t--) {
611
+ let n = i.node(e), a = i.index(e);
612
+ if (n.type.spec.isolating) return !1;
613
+ let o = n.content.cutByIndex(a, n.childCount), s = r && r[t + 1];
614
+ s && (o = o.replaceChild(0, s.type.create(s.attrs)));
615
+ let c = r && r[t] || n;
616
+ if (!n.canReplace(a + 1, n.childCount) || !c.type.validContent(o)) return !1;
617
+ }
618
+ let s = i.indexAfter(a), c = r && r[0];
619
+ return i.node(a).canReplaceWith(s, s, c ? c.type : i.node(a + 1).type);
620
+ }
621
+ function le(t, n, r = 1, a) {
622
+ let o = t.doc.resolve(n), s = e.empty, c = e.empty;
623
+ for (let t = o.depth, n = o.depth - r, i = r - 1; t > n; t--, i--) {
624
+ s = e.from(o.node(t).copy(s));
625
+ let n = a && a[i];
626
+ c = e.from(n ? n.type.create(n.attrs, c) : o.node(t).copy(c));
627
+ }
628
+ t.step(new T(n, n, new i(s.append(c), r, r), !0));
629
+ }
630
+ function ue(e, t) {
631
+ let n = e.resolve(t), r = n.index();
632
+ return I(n.nodeBefore, n.nodeAfter) && n.parent.canReplace(r, r + 1);
633
+ }
634
+ function de(e, t) {
635
+ t.content.size || e.type.compatibleContent(t.type);
636
+ let n = e.contentMatchAt(e.childCount), { linebreakReplacement: r } = e.type.schema;
637
+ for (let i = 0; i < t.childCount; i++) {
638
+ let a = t.child(i), o = a.type == r ? e.type.schema.nodes.text : a.type;
639
+ if (n = n.matchType(o), !n || !e.type.allowsMarks(a.marks)) return !1;
640
+ }
641
+ return n.validEnd;
642
+ }
643
+ function I(e, t) {
644
+ return !!(e && t && !e.isLeaf && de(e, t));
645
+ }
646
+ function L(e, t, n = -1) {
647
+ let r = e.resolve(t);
648
+ for (let e = r.depth;; e--) {
649
+ let i, a, o = r.index(e);
650
+ if (e == r.depth ? (i = r.nodeBefore, a = r.nodeAfter) : n > 0 ? (i = r.node(e + 1), o++, a = r.node(e).maybeChild(o)) : (i = r.node(e).maybeChild(o - 1), a = r.node(e + 1)), i && !i.isTextblock && I(i, a) && r.node(e).canReplace(o, o + 1)) return t;
651
+ if (e == 0) break;
652
+ t = n < 0 ? r.before(e) : r.after(e);
653
+ }
654
+ }
655
+ function R(e, t, n) {
656
+ let r = null, { linebreakReplacement: a } = e.doc.type.schema, o = e.doc.resolve(t - n), s = o.node().type;
657
+ if (a && s.inlineContent) {
658
+ let e = s.whitespace == "pre", t = !!s.contentMatch.matchType(a);
659
+ e && !t ? r = !1 : !e && t && (r = !0);
660
+ }
661
+ let c = e.steps.length;
662
+ if (r === !1) {
663
+ let r = e.doc.resolve(t + n);
664
+ N(e, r.node(), r.before(), c);
665
+ }
666
+ s.inlineContent && O(e, t + n - 1, s, o.node().contentMatchAt(o.index()), r == null);
667
+ let l = e.mapping.slice(c), u = l.map(t - n);
668
+ if (e.step(new T(u, l.map(t + n, -1), i.empty, !0)), r === !0) {
669
+ let t = e.doc.resolve(u);
670
+ M(e, t.node(), t.before(), e.steps.length);
671
+ }
672
+ return e;
673
+ }
674
+ function z(e, t, n) {
675
+ let r = e.resolve(t);
676
+ if (r.parent.canReplaceWith(r.index(), r.index(), n)) return t;
677
+ if (r.parentOffset == 0) for (let e = r.depth - 1; e >= 0; e--) {
678
+ let t = r.index(e);
679
+ if (r.node(e).canReplaceWith(t, t, n)) return r.before(e + 1);
680
+ if (t > 0) return null;
681
+ }
682
+ if (r.parentOffset == r.parent.content.size) for (let e = r.depth - 1; e >= 0; e--) {
683
+ let t = r.indexAfter(e);
684
+ if (r.node(e).canReplaceWith(t, t, n)) return r.after(e + 1);
685
+ if (t < r.node(e).childCount) return null;
686
+ }
687
+ return null;
688
+ }
689
+ function B(e, t, n) {
690
+ let r = e.resolve(t);
691
+ if (!n.content.size) return t;
692
+ let i = n.content;
693
+ for (let e = 0; e < n.openStart; e++) i = i.firstChild.content;
694
+ for (let e = 1; e <= (n.openStart == 0 && n.size ? 2 : 1); e++) for (let t = r.depth; t >= 0; t--) {
695
+ let n = t == r.depth ? 0 : r.pos <= (r.start(t + 1) + r.end(t + 1)) / 2 ? -1 : 1, a = r.index(t) + +(n > 0), o = r.node(t), s = !1;
696
+ if (e == 1) s = o.canReplace(a, a, i);
697
+ else {
698
+ let e = o.contentMatchAt(a).findWrapping(i.firstChild.type);
699
+ s = e && o.canReplaceWith(a, a, e[0]);
700
+ }
701
+ if (s) return n == 0 ? r.pos : n < 0 ? r.before(t + 1) : r.after(t + 1);
702
+ }
703
+ return null;
704
+ }
705
+ function V(e, t, n = t, r = i.empty) {
706
+ if (t == n && !r.size) return null;
707
+ let a = e.resolve(t), o = e.resolve(n);
708
+ return H(a, o, r) ? new T(t, n, r) : new fe(a, o, r).fit();
709
+ }
710
+ function H(e, t, n) {
711
+ return !n.openStart && !n.openEnd && e.start() == t.start() && e.parent.canReplace(e.index(), t.index(), n.content);
712
+ }
713
+ var fe = class {
714
+ constructor(t, n, r) {
715
+ this.$from = t, this.$to = n, this.unplaced = r, this.frontier = [], this.placed = e.empty;
716
+ for (let e = 0; e <= t.depth; e++) {
717
+ let n = t.node(e);
718
+ this.frontier.push({
719
+ type: n.type,
720
+ match: n.contentMatchAt(t.indexAfter(e))
721
+ });
722
+ }
723
+ for (let n = t.depth; n > 0; n--) this.placed = e.from(t.node(n).copy(this.placed));
724
+ }
725
+ get depth() {
726
+ return this.frontier.length - 1;
727
+ }
728
+ fit() {
729
+ for (; this.unplaced.size;) {
730
+ let e = this.findFittable();
731
+ e ? this.placeNodes(e) : this.openMore() || this.dropNode();
732
+ }
733
+ let e = this.mustMoveInline(), t = this.placed.size - this.depth - this.$from.depth, n = this.$from, r = this.close(e < 0 ? this.$to : n.doc.resolve(e));
734
+ if (!r) return null;
735
+ let a = this.placed, o = n.depth, s = r.depth;
736
+ for (; o && s && a.childCount == 1;) a = a.firstChild.content, o--, s--;
737
+ let c = new i(a, o, s);
738
+ return e > -1 ? new E(n.pos, e, this.$to.pos, this.$to.end(), c, t) : c.size || n.pos != this.$to.pos ? new T(n.pos, r.pos, c) : null;
739
+ }
740
+ findFittable() {
741
+ let t = this.unplaced.openStart;
742
+ for (let e = this.unplaced.content, n = 0, r = this.unplaced.openEnd; n < t; n++) {
743
+ let i = e.firstChild;
744
+ if (e.childCount > 1 && (r = 0), i.type.spec.isolating && r <= n) {
745
+ t = n;
746
+ break;
747
+ }
748
+ e = i.content;
749
+ }
750
+ for (let n = 1; n <= 2; n++) for (let r = n == 1 ? t : this.unplaced.openStart; r >= 0; r--) {
751
+ let t, i = null;
752
+ r ? (i = G(this.unplaced.content, r - 1).firstChild, t = i.content) : t = this.unplaced.content;
753
+ let a = t.firstChild;
754
+ for (let t = this.depth; t >= 0; t--) {
755
+ let { type: o, match: s } = this.frontier[t], c, l = null;
756
+ if (n == 1 && (a ? s.matchType(a.type) || (l = s.fillBefore(e.from(a), !1)) : i && o.compatibleContent(i.type))) return {
757
+ sliceDepth: r,
758
+ frontierDepth: t,
759
+ parent: i,
760
+ inject: l
761
+ };
762
+ if (n == 2 && a && (c = s.findWrapping(a.type))) return {
763
+ sliceDepth: r,
764
+ frontierDepth: t,
765
+ parent: i,
766
+ wrap: c
767
+ };
768
+ if (i && s.matchType(i.type)) break;
769
+ }
770
+ }
771
+ }
772
+ openMore() {
773
+ let { content: e, openStart: t, openEnd: n } = this.unplaced, r = G(e, t);
774
+ return !r.childCount || r.firstChild.isLeaf ? !1 : (this.unplaced = new i(e, t + 1, Math.max(n, r.size + t >= e.size - n ? t + 1 : 0)), !0);
775
+ }
776
+ dropNode() {
777
+ let { content: e, openStart: t, openEnd: n } = this.unplaced, r = G(e, t);
778
+ if (r.childCount <= 1 && t > 0) {
779
+ let a = e.size - t <= t + r.size;
780
+ this.unplaced = new i(U(e, t - 1, 1), t - 1, a ? t - 1 : n);
781
+ } else this.unplaced = new i(U(e, t, 1), t, n);
782
+ }
783
+ placeNodes({ sliceDepth: t, frontierDepth: n, parent: r, inject: a, wrap: o }) {
784
+ for (; this.depth > n;) this.closeFrontierNode();
785
+ if (o) for (let e = 0; e < o.length; e++) this.openFrontierNode(o[e]);
786
+ let s = this.unplaced, c = r ? r.content : s.content, l = s.openStart - t, u = 0, d = [], { match: f, type: p } = this.frontier[n];
787
+ if (a) {
788
+ for (let e = 0; e < a.childCount; e++) d.push(a.child(e));
789
+ f = f.matchFragment(a);
790
+ }
791
+ let m = c.size + t - (s.content.size - s.openEnd);
792
+ for (; u < c.childCount;) {
793
+ let e = c.child(u), t = f.matchType(e.type);
794
+ if (!t) break;
795
+ u++, (u > 1 || l == 0 || e.content.size) && (f = t, d.push(K(e.mark(p.allowedMarks(e.marks)), u == 1 ? l : 0, u == c.childCount ? m : -1)));
796
+ }
797
+ let h = u == c.childCount;
798
+ h || (m = -1), this.placed = W(this.placed, n, e.from(d)), this.frontier[n].match = f, h && m < 0 && r && r.type == this.frontier[this.depth].type && this.frontier.length > 1 && this.closeFrontierNode();
799
+ for (let e = 0, t = c; e < m; e++) {
800
+ let e = t.lastChild;
801
+ this.frontier.push({
802
+ type: e.type,
803
+ match: e.contentMatchAt(e.childCount)
804
+ }), t = e.content;
805
+ }
806
+ this.unplaced = h ? t == 0 ? i.empty : new i(U(s.content, t - 1, 1), t - 1, m < 0 ? s.openEnd : t - 1) : new i(U(s.content, t, u), s.openStart, s.openEnd);
807
+ }
808
+ mustMoveInline() {
809
+ if (!this.$to.parent.isTextblock) return -1;
810
+ let e = this.frontier[this.depth], t;
811
+ if (!e.type.isTextblock || !q(this.$to, this.$to.depth, e.type, e.match, !1) || this.$to.depth == this.depth && (t = this.findCloseLevel(this.$to)) && t.depth == this.depth) return -1;
812
+ let { depth: n } = this.$to, r = this.$to.after(n);
813
+ for (; n > 1 && r == this.$to.end(--n);) ++r;
814
+ return r;
815
+ }
816
+ findCloseLevel(e) {
817
+ scan: for (let t = Math.min(this.depth, e.depth); t >= 0; t--) {
818
+ let { match: n, type: r } = this.frontier[t], i = t < e.depth && e.end(t + 1) == e.pos + (e.depth - (t + 1)), a = q(e, t, r, n, i);
819
+ if (a) {
820
+ for (let n = t - 1; n >= 0; n--) {
821
+ let { match: t, type: r } = this.frontier[n], i = q(e, n, r, t, !0);
822
+ if (!i || i.childCount) continue scan;
823
+ }
824
+ return {
825
+ depth: t,
826
+ fit: a,
827
+ move: i ? e.doc.resolve(e.after(t + 1)) : e
828
+ };
829
+ }
830
+ }
831
+ }
832
+ close(e) {
833
+ let t = this.findCloseLevel(e);
834
+ if (!t) return null;
835
+ for (; this.depth > t.depth;) this.closeFrontierNode();
836
+ t.fit.childCount && (this.placed = W(this.placed, t.depth, t.fit)), e = t.move;
837
+ for (let n = t.depth + 1; n <= e.depth; n++) {
838
+ let t = e.node(n), r = t.type.contentMatch.fillBefore(t.content, !0, e.index(n));
839
+ this.openFrontierNode(t.type, t.attrs, r);
840
+ }
841
+ return e;
842
+ }
843
+ openFrontierNode(t, n = null, r) {
844
+ let i = this.frontier[this.depth];
845
+ i.match = i.match.matchType(t), this.placed = W(this.placed, this.depth, e.from(t.create(n, r))), this.frontier.push({
846
+ type: t,
847
+ match: t.contentMatch
848
+ });
849
+ }
850
+ closeFrontierNode() {
851
+ let t = this.frontier.pop().match.fillBefore(e.empty, !0);
852
+ t.childCount && (this.placed = W(this.placed, this.frontier.length, t));
853
+ }
854
+ };
855
+ function U(e, t, n) {
856
+ return t == 0 ? e.cutByIndex(n, e.childCount) : e.replaceChild(0, e.firstChild.copy(U(e.firstChild.content, t - 1, n)));
857
+ }
858
+ function W(e, t, n) {
859
+ return t == 0 ? e.append(n) : e.replaceChild(e.childCount - 1, e.lastChild.copy(W(e.lastChild.content, t - 1, n)));
860
+ }
861
+ function G(e, t) {
862
+ for (let n = 0; n < t; n++) e = e.firstChild.content;
863
+ return e;
864
+ }
865
+ function K(t, n, r) {
866
+ if (n <= 0) return t;
867
+ let i = t.content;
868
+ return n > 1 && (i = i.replaceChild(0, K(i.firstChild, n - 1, i.childCount == 1 ? r - 1 : 0))), n > 0 && (i = t.type.contentMatch.fillBefore(i).append(i), r <= 0 && (i = i.append(t.type.contentMatch.matchFragment(i).fillBefore(e.empty, !0)))), t.copy(i);
869
+ }
870
+ function q(e, t, n, r, i) {
871
+ let a = e.node(t), o = i ? e.indexAfter(t) : e.index(t);
872
+ if (o == a.childCount && !n.compatibleContent(a.type)) return null;
873
+ let s = r.fillBefore(a.content, !0, o);
874
+ return s && !pe(n, a.content, o) ? s : null;
875
+ }
876
+ function pe(e, t, n) {
877
+ for (let r = n; r < t.childCount; r++) if (!e.allowsMarks(t.child(r).marks)) return !0;
878
+ return !1;
879
+ }
880
+ function me(e) {
881
+ return e.spec.defining || e.spec.definingForContent;
882
+ }
883
+ function he(e, t, n, r) {
884
+ if (!r.size) return e.deleteRange(t, n);
885
+ let a = e.doc.resolve(t), o = e.doc.resolve(n);
886
+ if (H(a, o, r)) return e.step(new T(t, n, r));
887
+ let s = X(a, o);
888
+ s[s.length - 1] == 0 && s.pop();
889
+ let c = -(a.depth + 1);
890
+ s.unshift(c);
891
+ for (let e = a.depth, t = a.pos - 1; e > 0; e--, t--) {
892
+ let n = a.node(e).type.spec;
893
+ if (n.defining || n.definingAsContext || n.isolating) break;
894
+ s.indexOf(e) > -1 ? c = e : a.before(e) == t && s.splice(1, 0, -e);
895
+ }
896
+ let l = s.indexOf(c), u = [], d = r.openStart;
897
+ for (let e = r.content, t = 0;; t++) {
898
+ let n = e.firstChild;
899
+ if (u.push(n), t == r.openStart) break;
900
+ e = n.content;
901
+ }
902
+ for (let e = d - 1; e >= 0; e--) {
903
+ let t = u[e], n = me(t.type);
904
+ if (n && !t.sameMarkup(a.node(Math.abs(c) - 1))) d = e;
905
+ else if (n || !t.type.isTextblock) break;
906
+ }
907
+ for (let t = r.openStart; t >= 0; t--) {
908
+ let c = (t + d + 1) % (r.openStart + 1), f = u[c];
909
+ if (f) for (let t = 0; t < s.length; t++) {
910
+ let u = s[(t + l) % s.length], d = !0;
911
+ u < 0 && (d = !1, u = -u);
912
+ let p = a.node(u - 1), m = a.index(u - 1);
913
+ if (p.canReplaceWith(m, m, f.type, f.marks)) return e.replace(a.before(u), d ? o.after(u) : n, new i(J(r.content, 0, r.openStart, c), c, r.openEnd));
914
+ }
915
+ }
916
+ let f = e.steps.length;
917
+ for (let i = s.length - 1; i >= 0 && (e.replace(t, n, r), !(e.steps.length > f)); i--) {
918
+ let e = s[i];
919
+ e < 0 || (t = a.before(e), n = o.after(e));
920
+ }
921
+ }
922
+ function J(t, n, r, i, a) {
923
+ if (n < r) {
924
+ let e = t.firstChild;
925
+ t = t.replaceChild(0, e.copy(J(e.content, n + 1, r, i, e)));
926
+ }
927
+ if (n > i) {
928
+ let n = a.contentMatchAt(0), r = n.fillBefore(t).append(t);
929
+ t = r.append(n.matchFragment(r).fillBefore(e.empty, !0));
930
+ }
931
+ return t;
932
+ }
933
+ function Y(t, n, r, a) {
934
+ if (!a.isInline && n == r && t.doc.resolve(n).parent.content.size) {
935
+ let e = z(t.doc, n, a.type);
936
+ e != null && (n = r = e);
937
+ }
938
+ t.replaceRange(n, r, new i(e.from(a), 0, 0));
939
+ }
940
+ function ge(e, t, n) {
941
+ let r = e.doc.resolve(t), i = e.doc.resolve(n);
942
+ if (r.parent.isTextblock && i.parent.isTextblock && r.start() != i.start() && r.parentOffset == 0 && i.parentOffset == 0) {
943
+ let a = r.sharedDepth(n), o = !1;
944
+ for (let e = r.depth; e > a; e--) r.node(e).type.spec.isolating && (o = !0);
945
+ for (let e = i.depth; e > a; e--) i.node(e).type.spec.isolating && (o = !0);
946
+ if (!o) {
947
+ for (let e = r.depth; e > 0 && t == r.start(e); e--) t = r.before(e);
948
+ for (let e = i.depth; e > 0 && n == i.start(e); e--) n = i.before(e);
949
+ r = e.doc.resolve(t), i = e.doc.resolve(n);
950
+ }
951
+ }
952
+ let a = X(r, i);
953
+ for (let t = 0; t < a.length; t++) {
954
+ let n = a[t], o = t == a.length - 1;
955
+ if (o && n == 0 || r.node(n).type.contentMatch.validEnd) return e.delete(r.start(n), i.end(n));
956
+ if (n > 0 && (o || r.node(n - 1).canReplace(r.index(n - 1), i.indexAfter(n - 1)))) return e.delete(r.before(n), i.after(n));
957
+ }
958
+ for (let a = 1; a <= r.depth && a <= i.depth; a++) if (t - r.start(a) == r.depth - a && n > r.end(a) && i.end(a) - n != i.depth - a && r.start(a - 1) == i.start(a - 1) && r.node(a - 1).canReplace(r.index(a - 1), i.index(a - 1))) return e.delete(r.before(a), n);
959
+ e.delete(t, n);
960
+ }
961
+ function X(e, t) {
962
+ let n = [], r = Math.min(e.depth, t.depth);
963
+ for (let i = r; i >= 0; i--) {
964
+ let r = e.start(i);
965
+ if (r < e.pos - (e.depth - i) || t.end(i) > t.pos + (t.depth - i) || e.node(i).type.spec.isolating || t.node(i).type.spec.isolating) break;
966
+ (r == t.start(i) || i == e.depth && i == t.depth && e.parent.inlineContent && t.parent.inlineContent && i && t.start(i - 1) == r - 1) && n.push(i);
967
+ }
968
+ return n;
969
+ }
970
+ var Z = class t extends v {
971
+ constructor(e, t, n) {
972
+ super(), this.pos = e, this.attr = t, this.value = n;
973
+ }
974
+ apply(t) {
975
+ let n = t.nodeAt(this.pos);
976
+ if (!n) return y.fail("No node at attribute step's position");
977
+ let r = Object.create(null);
978
+ for (let e in n.attrs) r[e] = n.attrs[e];
979
+ r[this.attr] = this.value;
980
+ let a = n.type.create(r, null, n.marks);
981
+ return y.fromReplace(t, this.pos, this.pos + 1, new i(e.from(a), 0, +!n.isLeaf));
982
+ }
983
+ getMap() {
984
+ return h.empty;
985
+ }
986
+ invert(e) {
987
+ return new t(this.pos, this.attr, e.nodeAt(this.pos).attrs[this.attr]);
988
+ }
989
+ map(e) {
990
+ let n = e.mapResult(this.pos, 1);
991
+ return n.deletedAfter ? null : new t(n.pos, this.attr, this.value);
992
+ }
993
+ toJSON() {
994
+ return {
995
+ stepType: "attr",
996
+ pos: this.pos,
997
+ attr: this.attr,
998
+ value: this.value
999
+ };
1000
+ }
1001
+ static fromJSON(e, n) {
1002
+ if (typeof n.pos != "number" || typeof n.attr != "string") throw RangeError("Invalid input for AttrStep.fromJSON");
1003
+ return new t(n.pos, n.attr, n.value);
1004
+ }
1005
+ };
1006
+ v.jsonID("attr", Z);
1007
+ var Q = class e extends v {
1008
+ constructor(e, t) {
1009
+ super(), this.attr = e, this.value = t;
1010
+ }
1011
+ apply(e) {
1012
+ let t = Object.create(null);
1013
+ for (let n in e.attrs) t[n] = e.attrs[n];
1014
+ t[this.attr] = this.value;
1015
+ let n = e.type.create(t, e.content, e.marks);
1016
+ return y.ok(n);
1017
+ }
1018
+ getMap() {
1019
+ return h.empty;
1020
+ }
1021
+ invert(t) {
1022
+ return new e(this.attr, t.attrs[this.attr]);
1023
+ }
1024
+ map(e) {
1025
+ return this;
1026
+ }
1027
+ toJSON() {
1028
+ return {
1029
+ stepType: "docAttr",
1030
+ attr: this.attr,
1031
+ value: this.value
1032
+ };
1033
+ }
1034
+ static fromJSON(t, n) {
1035
+ if (typeof n.attr != "string") throw RangeError("Invalid input for DocAttrStep.fromJSON");
1036
+ return new e(n.attr, n.value);
1037
+ }
1038
+ };
1039
+ v.jsonID("docAttr", Q);
1040
+ var $ = class extends Error {};
1041
+ $ = function e(t) {
1042
+ let n = Error.call(this, t);
1043
+ return n.__proto__ = e.prototype, n;
1044
+ }, $.prototype = Object.create(Error.prototype), $.prototype.constructor = $, $.prototype.name = "TransformError";
1045
+ var _e = class {
1046
+ constructor(e) {
1047
+ this.doc = e, this.steps = [], this.docs = [], this.mapping = new g();
1048
+ }
1049
+ get before() {
1050
+ return this.docs.length ? this.docs[0] : this.doc;
1051
+ }
1052
+ step(e) {
1053
+ let t = this.maybeStep(e);
1054
+ if (t.failed) throw new $(t.failed);
1055
+ return this;
1056
+ }
1057
+ maybeStep(e) {
1058
+ let t = e.apply(this.doc);
1059
+ return t.failed || this.addStep(e, t.doc), t;
1060
+ }
1061
+ get docChanged() {
1062
+ return this.steps.length > 0;
1063
+ }
1064
+ changedRange() {
1065
+ let e = 1e9, t = -1e9;
1066
+ for (let n = 0; n < this.mapping.maps.length; n++) {
1067
+ let r = this.mapping.maps[n];
1068
+ n && (e = r.map(e, 1), t = r.map(t, -1)), r.forEach((n, r, i, a) => {
1069
+ e = Math.min(e, i), t = Math.max(t, a);
1070
+ });
1071
+ }
1072
+ return e == 1e9 ? null : {
1073
+ from: e,
1074
+ to: t
1075
+ };
1076
+ }
1077
+ addStep(e, t) {
1078
+ this.docs.push(this.doc), this.steps.push(e), this.mapping.appendMap(e.getMap()), this.doc = t;
1079
+ }
1080
+ replace(e, t = e, n = i.empty) {
1081
+ let r = V(this.doc, e, t, n);
1082
+ return r && this.step(r), this;
1083
+ }
1084
+ replaceWith(t, n, r) {
1085
+ return this.replace(t, n, new i(e.from(r), 0, 0));
1086
+ }
1087
+ delete(e, t) {
1088
+ return this.replace(e, t, i.empty);
1089
+ }
1090
+ insert(e, t) {
1091
+ return this.replaceWith(e, e, t);
1092
+ }
1093
+ replaceRange(e, t, n) {
1094
+ return he(this, e, t, n), this;
1095
+ }
1096
+ replaceRangeWith(e, t, n) {
1097
+ return Y(this, e, t, n), this;
1098
+ }
1099
+ deleteRange(e, t) {
1100
+ return ge(this, e, t), this;
1101
+ }
1102
+ lift(e, t) {
1103
+ return ie(this, e, t), this;
1104
+ }
1105
+ join(e, t = 1) {
1106
+ return R(this, e, t), this;
1107
+ }
1108
+ wrap(e, t) {
1109
+ return A(this, e, t), this;
1110
+ }
1111
+ setBlockType(e, t = e, n, r = null) {
1112
+ return j(this, e, t, n, r), this;
1113
+ }
1114
+ setNodeMarkup(e, t, n = null, r) {
1115
+ return F(this, e, t, n, r), this;
1116
+ }
1117
+ setNodeAttribute(e, t, n) {
1118
+ return this.step(new Z(e, t, n)), this;
1119
+ }
1120
+ setDocAttribute(e, t) {
1121
+ return this.step(new Q(e, t)), this;
1122
+ }
1123
+ addNodeMark(e, t) {
1124
+ return this.step(new C(e, t)), this;
1125
+ }
1126
+ removeNodeMark(e, n) {
1127
+ let r = this.doc.nodeAt(e);
1128
+ if (!r) throw RangeError("No node at position " + e);
1129
+ if (n instanceof t) n.isInSet(r.marks) && this.step(new w(e, n));
1130
+ else {
1131
+ let t = r.marks, i, a = [];
1132
+ for (; i = n.isInSet(t);) a.push(new w(e, i)), t = i.removeFromSet(t);
1133
+ for (let e = a.length - 1; e >= 0; e--) this.step(a[e]);
1134
+ }
1135
+ return this;
1136
+ }
1137
+ split(e, t = 1, n) {
1138
+ return le(this, e, t, n), this;
1139
+ }
1140
+ addMark(e, t, n) {
1141
+ return ee(this, e, t, n), this;
1142
+ }
1143
+ removeMark(e, t, n) {
1144
+ return te(this, e, t, n), this;
1145
+ }
1146
+ clearIncompatible(e, t, n) {
1147
+ return O(this, e, t, n), this;
1148
+ }
1149
+ };
1150
+ //#endregion
1151
+ export { x as AddMarkStep, C as AddNodeMarkStep, Z as AttrStep, Q as DocAttrStep, m as MapResult, g as Mapping, S as RemoveMarkStep, w as RemoveNodeMarkStep, E as ReplaceAroundStep, T as ReplaceStep, v as Step, h as StepMap, y as StepResult, _e as Transform, $ as TransformError, ue as canJoin, ce as canSplit, B as dropPoint, ae as findWrapping, z as insertPoint, L as joinPoint, re as liftTarget, V as replaceStep };
1152
+
1153
+ //# sourceMappingURL=index.js.map