@sovann72-dev/lynqify-ui 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/dist/components/NoteEditor/BatchImageGalleryNodeView.d.ts +19 -0
  2. package/dist/components/RichTextEditor/Extension/Indent/backspace.indent.handlers.d.ts +18 -0
  3. package/dist/components/RichTextEditor/Extension/Indent/indent.extension.d.ts +26 -0
  4. package/dist/components/RichTextEditor/Extension/Indent/indent.handlers.d.ts +16 -0
  5. package/{src/components/RichTextEditor/Extension/Indent/indent.types.ts → dist/components/RichTextEditor/Extension/Indent/indent.types.d.ts} +10 -35
  6. package/dist/components/RichTextEditor/Extension/Indent/indent.utils.d.ts +8 -0
  7. package/dist/components/RichTextEditor/Extension/Indent/outdent.handlers.d.ts +6 -0
  8. package/dist/components/RichTextEditor/Extension/Indent/shifttab.indent.handlers.d.ts +18 -0
  9. package/dist/components/RichTextEditor/Extension/Indent/tab.indent.handlers.d.ts +21 -0
  10. package/dist/components/RichTextEditor/Extension/List/custom-list-item.extension.d.ts +17 -0
  11. package/dist/components/RichTextEditor/Extension/List/dynamic-bullet-styling.extension.d.ts +2 -0
  12. package/dist/components/RichTextEditor/Extension/batch-segment-images.extension.d.ts +19 -0
  13. package/dist/components/RichTextEditor/Extension/batch-segment-images.types.d.ts +33 -0
  14. package/dist/components/RichTextEditor/Extension/custom-image.extension.d.ts +4 -0
  15. package/dist/components/RichTextEditor/Extension/custom-link.extension.d.ts +3 -0
  16. package/dist/components/RichTextEditor/Extension/custom-mention.extension.d.ts +3 -0
  17. package/dist/components/RichTextEditor/Extension/custom-paragraph.extension.d.ts +6 -0
  18. package/dist/components/RichTextEditor/Extension/extensions.d.ts +4 -0
  19. package/dist/components/RichTextEditor/Extension/file-filtering.extension.d.ts +1 -0
  20. package/dist/components/RichTextEditor/Extension/list-indent-integration.extension.d.ts +2 -0
  21. package/dist/components/RichTextEditor/Extension/mentionstorage.extension.d.ts +9 -0
  22. package/dist/components/RichTextEditor/Extension/tiptap-extension-fontsize.d.ts +21 -0
  23. package/dist/components/RichTextEditor/Extension/tiptap-extension-lineheight.d.ts +21 -0
  24. package/{src/index.ts → dist/index.d.ts} +5 -17
  25. package/dist/lynqify-ui.js +3264 -0
  26. package/dist/lynqify-ui.umd.cjs +30 -0
  27. package/package.json +60 -31
  28. package/src/components/RichTextEditor/Extension/Indent/backspace.indent.handlers.ts +0 -77
  29. package/src/components/RichTextEditor/Extension/Indent/indent.extension.ts +0 -285
  30. package/src/components/RichTextEditor/Extension/Indent/indent.handlers.ts +0 -121
  31. package/src/components/RichTextEditor/Extension/Indent/indent.utils.ts +0 -8
  32. package/src/components/RichTextEditor/Extension/Indent/outdent.handlers.ts +0 -71
  33. package/src/components/RichTextEditor/Extension/Indent/shifttab.indent.handlers.ts +0 -133
  34. package/src/components/RichTextEditor/Extension/Indent/tab.indent.handlers.ts +0 -103
  35. package/src/components/RichTextEditor/Extension/List/custom-list-item.extension.ts +0 -107
  36. package/src/components/RichTextEditor/Extension/List/dynamic-bullet-styling.extension.ts +0 -40
  37. package/src/components/RichTextEditor/Extension/batch-segment-images.extension.ts +0 -486
  38. package/src/components/RichTextEditor/Extension/batch-segment-images.types.ts +0 -35
  39. package/src/components/RichTextEditor/Extension/custom-image.extension.ts +0 -18
  40. package/src/components/RichTextEditor/Extension/custom-link.extension.ts +0 -58
  41. package/src/components/RichTextEditor/Extension/custom-mention.extension.ts +0 -29
  42. package/src/components/RichTextEditor/Extension/custom-paragraph.extension.ts +0 -46
  43. package/src/components/RichTextEditor/Extension/extensions.ts +0 -118
  44. package/src/components/RichTextEditor/Extension/file-filtering.extension.ts +0 -0
  45. package/src/components/RichTextEditor/Extension/list-indent-integration.extension.ts +0 -125
  46. package/src/components/RichTextEditor/Extension/mentionstorage.extension.ts +0 -10
  47. package/src/components/RichTextEditor/Extension/tiptap-extension-fontsize.ts +0 -73
  48. package/src/components/RichTextEditor/Extension/tiptap-extension-lineheight.ts +0 -73
@@ -0,0 +1,3264 @@
1
+ import Tt from "@tiptap/extension-bold";
2
+ import { default as hi } from "@tiptap/extension-bold";
3
+ import Et from "@tiptap/extension-color";
4
+ import { default as mi } from "@tiptap/extension-color";
5
+ import kt from "@tiptap/extension-document";
6
+ import { default as yi } from "@tiptap/extension-document";
7
+ import _r from "@tiptap/extension-file-handler";
8
+ import { default as Ii } from "@tiptap/extension-file-handler";
9
+ import Rt from "@tiptap/extension-hard-break";
10
+ import { default as xi } from "@tiptap/extension-hard-break";
11
+ import Jr from "@tiptap/extension-heading";
12
+ import { default as bi } from "@tiptap/extension-heading";
13
+ import Fr from "@tiptap/extension-highlight";
14
+ import { default as Ei } from "@tiptap/extension-highlight";
15
+ import Hr from "@tiptap/extension-image";
16
+ import { default as Ri } from "@tiptap/extension-image";
17
+ import Ot from "@tiptap/extension-italic";
18
+ import { default as Ni } from "@tiptap/extension-italic";
19
+ import Br from "@tiptap/extension-link";
20
+ import { default as Ci } from "@tiptap/extension-link";
21
+ import { BulletList as Nt, ListItem as At, OrderedList as Ct, TaskItem as Lt, ListKeymap as $r, TaskList as jr } from "@tiptap/extension-list";
22
+ import { BulletList as Mi, ListItem as Pi, ListKeymap as Di, OrderedList as zi, TaskItem as _i, TaskList as Ji } from "@tiptap/extension-list";
23
+ import qr from "@tiptap/extension-mention";
24
+ import { default as Hi } from "@tiptap/extension-mention";
25
+ import Mt from "@tiptap/extension-paragraph";
26
+ import { default as $i } from "@tiptap/extension-paragraph";
27
+ import { Table as Vr, TableCell as Wr, TableHeader as Ur, TableRow as Yr } from "@tiptap/extension-table";
28
+ import { Table as qi, TableCell as Vi, TableHeader as Wi, TableRow as Ui } from "@tiptap/extension-table";
29
+ import Pt from "@tiptap/extension-text";
30
+ import { default as Ki } from "@tiptap/extension-text";
31
+ import Dt from "@tiptap/extension-text-align";
32
+ import { default as Xi } from "@tiptap/extension-text-align";
33
+ import { TextStyle as zt } from "@tiptap/extension-text-style";
34
+ import { TextStyle as Qi } from "@tiptap/extension-text-style";
35
+ import _t from "@tiptap/extension-underline";
36
+ import { default as ts } from "@tiptap/extension-underline";
37
+ import { UndoRedo as Jt, CharacterCount as Kr, Placeholder as Gr } from "@tiptap/extensions";
38
+ import { CharacterCount as ns, UndoRedo as is, Placeholder as ss } from "@tiptap/extensions";
39
+ import { Extension as Xr } from "@tiptap/react";
40
+ import { Extension as fe, Node as Zr } from "@tiptap/core";
41
+ import * as Le from "react";
42
+ import Ft from "react";
43
+ import Qr from "react-dom";
44
+ const en = Mt.extend({
45
+ // Keep name as 'paragraph' for schema compatibility
46
+ addNodeView() {
47
+ return ({ node: n }) => {
48
+ const e = n.attrs.indent || 0, t = document.createElement("p");
49
+ return t.setAttribute("data-indent", String(e)), e > 0 && (t.style.paddingLeft = `${e * 20}px`), { dom: t, contentDOM: t };
50
+ };
51
+ },
52
+ // Placeholder positioning based on indent level
53
+ addAttributes() {
54
+ var n;
55
+ return {
56
+ ...(n = this.parent) == null ? void 0 : n.call(this),
57
+ indent: {
58
+ default: 0,
59
+ parseHTML: (e) => parseInt(e.getAttribute("data-indent") || "0"),
60
+ renderHTML: (e) => e.indent ? {
61
+ "data-indent": e.indent,
62
+ // CSS custom property for dynamic placeholder offset
63
+ style: `--indent-level: ${e.indent};`
64
+ } : {}
65
+ }
66
+ };
67
+ }
68
+ });
69
+ function Ht(n, e, t) {
70
+ for (let r = 0; ; r++) {
71
+ if (r == n.childCount || r == e.childCount)
72
+ return n.childCount == e.childCount ? null : t;
73
+ let i = n.child(r), s = e.child(r);
74
+ if (i == s) {
75
+ t += i.nodeSize;
76
+ continue;
77
+ }
78
+ if (!i.sameMarkup(s))
79
+ return t;
80
+ if (i.isText && i.text != s.text) {
81
+ for (let l = 0; i.text[l] == s.text[l]; l++)
82
+ t++;
83
+ return t;
84
+ }
85
+ if (i.content.size || s.content.size) {
86
+ let l = Ht(i.content, s.content, t + 1);
87
+ if (l != null)
88
+ return l;
89
+ }
90
+ t += i.nodeSize;
91
+ }
92
+ }
93
+ function Bt(n, e, t, r) {
94
+ for (let i = n.childCount, s = e.childCount; ; ) {
95
+ if (i == 0 || s == 0)
96
+ return i == s ? null : { a: t, b: r };
97
+ let l = n.child(--i), a = e.child(--s), u = l.nodeSize;
98
+ if (l == a) {
99
+ t -= u, r -= u;
100
+ continue;
101
+ }
102
+ if (!l.sameMarkup(a))
103
+ return { a: t, b: r };
104
+ if (l.isText && l.text != a.text) {
105
+ let f = 0, d = Math.min(l.text.length, a.text.length);
106
+ for (; f < d && l.text[l.text.length - f - 1] == a.text[a.text.length - f - 1]; )
107
+ f++, t--, r--;
108
+ return { a: t, b: r };
109
+ }
110
+ if (l.content.size || a.content.size) {
111
+ let f = Bt(l.content, a.content, t - 1, r - 1);
112
+ if (f)
113
+ return f;
114
+ }
115
+ t -= u, r -= u;
116
+ }
117
+ }
118
+ class k {
119
+ /**
120
+ @internal
121
+ */
122
+ constructor(e, t) {
123
+ if (this.content = e, this.size = t || 0, t == null)
124
+ for (let r = 0; r < e.length; r++)
125
+ this.size += e[r].nodeSize;
126
+ }
127
+ /**
128
+ Invoke a callback for all descendant nodes between the given two
129
+ positions (relative to start of this fragment). Doesn't descend
130
+ into a node when the callback returns `false`.
131
+ */
132
+ nodesBetween(e, t, r, i = 0, s) {
133
+ for (let l = 0, a = 0; a < t; l++) {
134
+ let u = this.content[l], f = a + u.nodeSize;
135
+ if (f > e && r(u, i + a, s || null, l) !== !1 && u.content.size) {
136
+ let d = a + 1;
137
+ u.nodesBetween(Math.max(0, e - d), Math.min(u.content.size, t - d), r, i + d);
138
+ }
139
+ a = f;
140
+ }
141
+ }
142
+ /**
143
+ Call the given callback for every descendant node. `pos` will be
144
+ relative to the start of the fragment. The callback may return
145
+ `false` to prevent traversal of a given node's children.
146
+ */
147
+ descendants(e) {
148
+ this.nodesBetween(0, this.size, e);
149
+ }
150
+ /**
151
+ Extract the text between `from` and `to`. See the same method on
152
+ [`Node`](https://prosemirror.net/docs/ref/#model.Node.textBetween).
153
+ */
154
+ textBetween(e, t, r, i) {
155
+ let s = "", l = !0;
156
+ return this.nodesBetween(e, t, (a, u) => {
157
+ let f = a.isText ? a.text.slice(Math.max(e, u) - u, t - u) : a.isLeaf ? i ? typeof i == "function" ? i(a) : i : a.type.spec.leafText ? a.type.spec.leafText(a) : "" : "";
158
+ a.isBlock && (a.isLeaf && f || a.isTextblock) && r && (l ? l = !1 : s += r), s += f;
159
+ }, 0), s;
160
+ }
161
+ /**
162
+ Create a new fragment containing the combined content of this
163
+ fragment and the other.
164
+ */
165
+ append(e) {
166
+ if (!e.size)
167
+ return this;
168
+ if (!this.size)
169
+ return e;
170
+ let t = this.lastChild, r = e.firstChild, i = this.content.slice(), s = 0;
171
+ for (t.isText && t.sameMarkup(r) && (i[i.length - 1] = t.withText(t.text + r.text), s = 1); s < e.content.length; s++)
172
+ i.push(e.content[s]);
173
+ return new k(i, this.size + e.size);
174
+ }
175
+ /**
176
+ Cut out the sub-fragment between the two given positions.
177
+ */
178
+ cut(e, t = this.size) {
179
+ if (e == 0 && t == this.size)
180
+ return this;
181
+ let r = [], i = 0;
182
+ if (t > e)
183
+ for (let s = 0, l = 0; l < t; s++) {
184
+ let a = this.content[s], u = l + a.nodeSize;
185
+ u > e && ((l < e || u > t) && (a.isText ? a = a.cut(Math.max(0, e - l), Math.min(a.text.length, t - l)) : a = a.cut(Math.max(0, e - l - 1), Math.min(a.content.size, t - l - 1))), r.push(a), i += a.nodeSize), l = u;
186
+ }
187
+ return new k(r, i);
188
+ }
189
+ /**
190
+ @internal
191
+ */
192
+ cutByIndex(e, t) {
193
+ return e == t ? k.empty : e == 0 && t == this.content.length ? this : new k(this.content.slice(e, t));
194
+ }
195
+ /**
196
+ Create a new fragment in which the node at the given index is
197
+ replaced by the given node.
198
+ */
199
+ replaceChild(e, t) {
200
+ let r = this.content[e];
201
+ if (r == t)
202
+ return this;
203
+ let i = this.content.slice(), s = this.size + t.nodeSize - r.nodeSize;
204
+ return i[e] = t, new k(i, s);
205
+ }
206
+ /**
207
+ Create a new fragment by prepending the given node to this
208
+ fragment.
209
+ */
210
+ addToStart(e) {
211
+ return new k([e].concat(this.content), this.size + e.nodeSize);
212
+ }
213
+ /**
214
+ Create a new fragment by appending the given node to this
215
+ fragment.
216
+ */
217
+ addToEnd(e) {
218
+ return new k(this.content.concat(e), this.size + e.nodeSize);
219
+ }
220
+ /**
221
+ Compare this fragment to another one.
222
+ */
223
+ eq(e) {
224
+ if (this.content.length != e.content.length)
225
+ return !1;
226
+ for (let t = 0; t < this.content.length; t++)
227
+ if (!this.content[t].eq(e.content[t]))
228
+ return !1;
229
+ return !0;
230
+ }
231
+ /**
232
+ The first child of the fragment, or `null` if it is empty.
233
+ */
234
+ get firstChild() {
235
+ return this.content.length ? this.content[0] : null;
236
+ }
237
+ /**
238
+ The last child of the fragment, or `null` if it is empty.
239
+ */
240
+ get lastChild() {
241
+ return this.content.length ? this.content[this.content.length - 1] : null;
242
+ }
243
+ /**
244
+ The number of child nodes in this fragment.
245
+ */
246
+ get childCount() {
247
+ return this.content.length;
248
+ }
249
+ /**
250
+ Get the child node at the given index. Raise an error when the
251
+ index is out of range.
252
+ */
253
+ child(e) {
254
+ let t = this.content[e];
255
+ if (!t)
256
+ throw new RangeError("Index " + e + " out of range for " + this);
257
+ return t;
258
+ }
259
+ /**
260
+ Get the child node at the given index, if it exists.
261
+ */
262
+ maybeChild(e) {
263
+ return this.content[e] || null;
264
+ }
265
+ /**
266
+ Call `f` for every child node, passing the node, its offset
267
+ into this parent node, and its index.
268
+ */
269
+ forEach(e) {
270
+ for (let t = 0, r = 0; t < this.content.length; t++) {
271
+ let i = this.content[t];
272
+ e(i, r, t), r += i.nodeSize;
273
+ }
274
+ }
275
+ /**
276
+ Find the first position at which this fragment and another
277
+ fragment differ, or `null` if they are the same.
278
+ */
279
+ findDiffStart(e, t = 0) {
280
+ return Ht(this, e, t);
281
+ }
282
+ /**
283
+ Find the first position, searching from the end, at which this
284
+ fragment and the given fragment differ, or `null` if they are
285
+ the same. Since this position will not be the same in both
286
+ nodes, an object with two separate positions is returned.
287
+ */
288
+ findDiffEnd(e, t = this.size, r = e.size) {
289
+ return Bt(this, e, t, r);
290
+ }
291
+ /**
292
+ Find the index and inner offset corresponding to a given relative
293
+ position in this fragment. The result object will be reused
294
+ (overwritten) the next time the function is called. @internal
295
+ */
296
+ findIndex(e) {
297
+ if (e == 0)
298
+ return ye(0, e);
299
+ if (e == this.size)
300
+ return ye(this.content.length, e);
301
+ if (e > this.size || e < 0)
302
+ throw new RangeError(`Position ${e} outside of fragment (${this})`);
303
+ for (let t = 0, r = 0; ; t++) {
304
+ let i = this.child(t), s = r + i.nodeSize;
305
+ if (s >= e)
306
+ return s == e ? ye(t + 1, s) : ye(t, r);
307
+ r = s;
308
+ }
309
+ }
310
+ /**
311
+ Return a debugging string that describes this fragment.
312
+ */
313
+ toString() {
314
+ return "<" + this.toStringInner() + ">";
315
+ }
316
+ /**
317
+ @internal
318
+ */
319
+ toStringInner() {
320
+ return this.content.join(", ");
321
+ }
322
+ /**
323
+ Create a JSON-serializeable representation of this fragment.
324
+ */
325
+ toJSON() {
326
+ return this.content.length ? this.content.map((e) => e.toJSON()) : null;
327
+ }
328
+ /**
329
+ Deserialize a fragment from its JSON representation.
330
+ */
331
+ static fromJSON(e, t) {
332
+ if (!t)
333
+ return k.empty;
334
+ if (!Array.isArray(t))
335
+ throw new RangeError("Invalid input for Fragment.fromJSON");
336
+ return new k(t.map(e.nodeFromJSON));
337
+ }
338
+ /**
339
+ Build a fragment from an array of nodes. Ensures that adjacent
340
+ text nodes with the same marks are joined together.
341
+ */
342
+ static fromArray(e) {
343
+ if (!e.length)
344
+ return k.empty;
345
+ let t, r = 0;
346
+ for (let i = 0; i < e.length; i++) {
347
+ let s = e[i];
348
+ r += s.nodeSize, i && s.isText && e[i - 1].sameMarkup(s) ? (t || (t = e.slice(0, i)), t[t.length - 1] = s.withText(t[t.length - 1].text + s.text)) : t && t.push(s);
349
+ }
350
+ return new k(t || e, r);
351
+ }
352
+ /**
353
+ Create a fragment from something that can be interpreted as a
354
+ set of nodes. For `null`, it returns the empty fragment. For a
355
+ fragment, the fragment itself. For a node or array of nodes, a
356
+ fragment containing those nodes.
357
+ */
358
+ static from(e) {
359
+ if (!e)
360
+ return k.empty;
361
+ if (e instanceof k)
362
+ return e;
363
+ if (Array.isArray(e))
364
+ return this.fromArray(e);
365
+ if (e.attrs)
366
+ return new k([e], e.nodeSize);
367
+ throw new RangeError("Can not convert " + e + " to a Fragment" + (e.nodesBetween ? " (looks like multiple versions of prosemirror-model were loaded)" : ""));
368
+ }
369
+ }
370
+ k.empty = new k([], 0);
371
+ const Me = { index: 0, offset: 0 };
372
+ function ye(n, e) {
373
+ return Me.index = n, Me.offset = e, Me;
374
+ }
375
+ class tn extends Error {
376
+ }
377
+ class T {
378
+ /**
379
+ Create a slice. When specifying a non-zero open depth, you must
380
+ make sure that there are nodes of at least that depth at the
381
+ appropriate side of the fragment—i.e. if the fragment is an
382
+ empty paragraph node, `openStart` and `openEnd` can't be greater
383
+ than 1.
384
+
385
+ It is not necessary for the content of open nodes to conform to
386
+ the schema's content constraints, though it should be a valid
387
+ start/end/middle for such a node, depending on which sides are
388
+ open.
389
+ */
390
+ constructor(e, t, r) {
391
+ this.content = e, this.openStart = t, this.openEnd = r;
392
+ }
393
+ /**
394
+ The size this slice would add when inserted into a document.
395
+ */
396
+ get size() {
397
+ return this.content.size - this.openStart - this.openEnd;
398
+ }
399
+ /**
400
+ @internal
401
+ */
402
+ insertAt(e, t) {
403
+ let r = jt(this.content, e + this.openStart, t);
404
+ return r && new T(r, this.openStart, this.openEnd);
405
+ }
406
+ /**
407
+ @internal
408
+ */
409
+ removeBetween(e, t) {
410
+ return new T($t(this.content, e + this.openStart, t + this.openStart), this.openStart, this.openEnd);
411
+ }
412
+ /**
413
+ Tests whether this slice is equal to another slice.
414
+ */
415
+ eq(e) {
416
+ return this.content.eq(e.content) && this.openStart == e.openStart && this.openEnd == e.openEnd;
417
+ }
418
+ /**
419
+ @internal
420
+ */
421
+ toString() {
422
+ return this.content + "(" + this.openStart + "," + this.openEnd + ")";
423
+ }
424
+ /**
425
+ Convert a slice to a JSON-serializable representation.
426
+ */
427
+ toJSON() {
428
+ if (!this.content.size)
429
+ return null;
430
+ let e = { content: this.content.toJSON() };
431
+ return this.openStart > 0 && (e.openStart = this.openStart), this.openEnd > 0 && (e.openEnd = this.openEnd), e;
432
+ }
433
+ /**
434
+ Deserialize a slice from its JSON representation.
435
+ */
436
+ static fromJSON(e, t) {
437
+ if (!t)
438
+ return T.empty;
439
+ let r = t.openStart || 0, i = t.openEnd || 0;
440
+ if (typeof r != "number" || typeof i != "number")
441
+ throw new RangeError("Invalid input for Slice.fromJSON");
442
+ return new T(k.fromJSON(e, t.content), r, i);
443
+ }
444
+ /**
445
+ Create a slice from a fragment by taking the maximum possible
446
+ open value on both side of the fragment.
447
+ */
448
+ static maxOpen(e, t = !0) {
449
+ let r = 0, i = 0;
450
+ for (let s = e.firstChild; s && !s.isLeaf && (t || !s.type.spec.isolating); s = s.firstChild)
451
+ r++;
452
+ for (let s = e.lastChild; s && !s.isLeaf && (t || !s.type.spec.isolating); s = s.lastChild)
453
+ i++;
454
+ return new T(e, r, i);
455
+ }
456
+ }
457
+ T.empty = new T(k.empty, 0, 0);
458
+ function $t(n, e, t) {
459
+ let { index: r, offset: i } = n.findIndex(e), s = n.maybeChild(r), { index: l, offset: a } = n.findIndex(t);
460
+ if (i == e || s.isText) {
461
+ if (a != t && !n.child(l).isText)
462
+ throw new RangeError("Removing non-flat range");
463
+ return n.cut(0, e).append(n.cut(t));
464
+ }
465
+ if (r != l)
466
+ throw new RangeError("Removing non-flat range");
467
+ return n.replaceChild(r, s.copy($t(s.content, e - i - 1, t - i - 1)));
468
+ }
469
+ function jt(n, e, t, r) {
470
+ let { index: i, offset: s } = n.findIndex(e), l = n.maybeChild(i);
471
+ if (s == e || l.isText)
472
+ return r && !r.canReplace(i, i, t) ? null : n.cut(0, e).append(t).append(n.cut(e));
473
+ let a = jt(l.content, e - s - 1, t, l);
474
+ return a && n.replaceChild(i, l.copy(a));
475
+ }
476
+ class qt {
477
+ /**
478
+ Construct a node range. `$from` and `$to` should point into the
479
+ same node until at least the given `depth`, since a node range
480
+ denotes an adjacent set of nodes in a single parent node.
481
+ */
482
+ constructor(e, t, r) {
483
+ this.$from = e, this.$to = t, this.depth = r;
484
+ }
485
+ /**
486
+ The position at the start of the range.
487
+ */
488
+ get start() {
489
+ return this.$from.before(this.depth + 1);
490
+ }
491
+ /**
492
+ The position at the end of the range.
493
+ */
494
+ get end() {
495
+ return this.$to.after(this.depth + 1);
496
+ }
497
+ /**
498
+ The parent node that the range points into.
499
+ */
500
+ get parent() {
501
+ return this.$from.node(this.depth);
502
+ }
503
+ /**
504
+ The start index of the range in the parent node.
505
+ */
506
+ get startIndex() {
507
+ return this.$from.index(this.depth);
508
+ }
509
+ /**
510
+ The end index of the range in the parent node.
511
+ */
512
+ get endIndex() {
513
+ return this.$to.indexAfter(this.depth);
514
+ }
515
+ }
516
+ const Vt = 65535, Wt = Math.pow(2, 16);
517
+ function rn(n, e) {
518
+ return n + e * Wt;
519
+ }
520
+ function ht(n) {
521
+ return n & Vt;
522
+ }
523
+ function nn(n) {
524
+ return (n - (n & Vt)) / Wt;
525
+ }
526
+ const Ut = 1, Yt = 2, we = 4, Kt = 8;
527
+ class pt {
528
+ /**
529
+ @internal
530
+ */
531
+ constructor(e, t, r) {
532
+ this.pos = e, this.delInfo = t, this.recover = r;
533
+ }
534
+ /**
535
+ Tells you whether the position was deleted, that is, whether the
536
+ step removed the token on the side queried (via the `assoc`)
537
+ argument from the document.
538
+ */
539
+ get deleted() {
540
+ return (this.delInfo & Kt) > 0;
541
+ }
542
+ /**
543
+ Tells you whether the token before the mapped position was deleted.
544
+ */
545
+ get deletedBefore() {
546
+ return (this.delInfo & (Ut | we)) > 0;
547
+ }
548
+ /**
549
+ True when the token after the mapped position was deleted.
550
+ */
551
+ get deletedAfter() {
552
+ return (this.delInfo & (Yt | we)) > 0;
553
+ }
554
+ /**
555
+ Tells whether any of the steps mapped through deletes across the
556
+ position (including both the token before and after the
557
+ position).
558
+ */
559
+ get deletedAcross() {
560
+ return (this.delInfo & we) > 0;
561
+ }
562
+ }
563
+ class F {
564
+ /**
565
+ Create a position map. The modifications to the document are
566
+ represented as an array of numbers, in which each group of three
567
+ represents a modified chunk as `[start, oldSize, newSize]`.
568
+ */
569
+ constructor(e, t = !1) {
570
+ if (this.ranges = e, this.inverted = t, !e.length && F.empty)
571
+ return F.empty;
572
+ }
573
+ /**
574
+ @internal
575
+ */
576
+ recover(e) {
577
+ let t = 0, r = ht(e);
578
+ if (!this.inverted)
579
+ for (let i = 0; i < r; i++)
580
+ t += this.ranges[i * 3 + 2] - this.ranges[i * 3 + 1];
581
+ return this.ranges[r * 3] + t + nn(e);
582
+ }
583
+ mapResult(e, t = 1) {
584
+ return this._map(e, t, !1);
585
+ }
586
+ map(e, t = 1) {
587
+ return this._map(e, t, !0);
588
+ }
589
+ /**
590
+ @internal
591
+ */
592
+ _map(e, t, r) {
593
+ let i = 0, s = this.inverted ? 2 : 1, l = this.inverted ? 1 : 2;
594
+ for (let a = 0; a < this.ranges.length; a += 3) {
595
+ let u = this.ranges[a] - (this.inverted ? i : 0);
596
+ if (u > e)
597
+ break;
598
+ let f = this.ranges[a + s], d = this.ranges[a + l], p = u + f;
599
+ if (e <= p) {
600
+ let y = f ? e == u ? -1 : e == p ? 1 : t : t, w = u + i + (y < 0 ? 0 : d);
601
+ if (r)
602
+ return w;
603
+ let m = e == (t < 0 ? u : p) ? null : rn(a / 3, e - u), S = e == u ? Yt : e == p ? Ut : we;
604
+ return (t < 0 ? e != u : e != p) && (S |= Kt), new pt(w, S, m);
605
+ }
606
+ i += d - f;
607
+ }
608
+ return r ? e + i : new pt(e + i, 0, null);
609
+ }
610
+ /**
611
+ @internal
612
+ */
613
+ touches(e, t) {
614
+ let r = 0, i = ht(t), s = this.inverted ? 2 : 1, l = this.inverted ? 1 : 2;
615
+ for (let a = 0; a < this.ranges.length; a += 3) {
616
+ let u = this.ranges[a] - (this.inverted ? r : 0);
617
+ if (u > e)
618
+ break;
619
+ let f = this.ranges[a + s], d = u + f;
620
+ if (e <= d && a == i * 3)
621
+ return !0;
622
+ r += this.ranges[a + l] - f;
623
+ }
624
+ return !1;
625
+ }
626
+ /**
627
+ Calls the given function on each of the changed ranges included in
628
+ this map.
629
+ */
630
+ forEach(e) {
631
+ let t = this.inverted ? 2 : 1, r = this.inverted ? 1 : 2;
632
+ for (let i = 0, s = 0; i < this.ranges.length; i += 3) {
633
+ let l = this.ranges[i], a = l - (this.inverted ? s : 0), u = l + (this.inverted ? 0 : s), f = this.ranges[i + t], d = this.ranges[i + r];
634
+ e(a, a + f, u, u + d), s += d - f;
635
+ }
636
+ }
637
+ /**
638
+ Create an inverted version of this map. The result can be used to
639
+ map positions in the post-step document to the pre-step document.
640
+ */
641
+ invert() {
642
+ return new F(this.ranges, !this.inverted);
643
+ }
644
+ /**
645
+ @internal
646
+ */
647
+ toString() {
648
+ return (this.inverted ? "-" : "") + JSON.stringify(this.ranges);
649
+ }
650
+ /**
651
+ Create a map that moves all positions by offset `n` (which may be
652
+ negative). This can be useful when applying steps meant for a
653
+ sub-document to a larger document, or vice-versa.
654
+ */
655
+ static offset(e) {
656
+ return e == 0 ? F.empty : new F(e < 0 ? [0, -e, 0] : [0, 0, e]);
657
+ }
658
+ }
659
+ F.empty = new F([]);
660
+ const Pe = /* @__PURE__ */ Object.create(null);
661
+ class M {
662
+ /**
663
+ Get the step map that represents the changes made by this step,
664
+ and which can be used to transform between positions in the old
665
+ and the new document.
666
+ */
667
+ getMap() {
668
+ return F.empty;
669
+ }
670
+ /**
671
+ Try to merge this step with another one, to be applied directly
672
+ after it. Returns the merged step when possible, null if the
673
+ steps can't be merged.
674
+ */
675
+ merge(e) {
676
+ return null;
677
+ }
678
+ /**
679
+ Deserialize a step from its JSON representation. Will call
680
+ through to the step class' own implementation of this method.
681
+ */
682
+ static fromJSON(e, t) {
683
+ if (!t || !t.stepType)
684
+ throw new RangeError("Invalid input for Step.fromJSON");
685
+ let r = Pe[t.stepType];
686
+ if (!r)
687
+ throw new RangeError(`No step type ${t.stepType} defined`);
688
+ return r.fromJSON(e, t);
689
+ }
690
+ /**
691
+ To be able to serialize steps to JSON, each step needs a string
692
+ ID to attach to its JSON representation. Use this method to
693
+ register an ID for your step classes. Try to pick something
694
+ that's unlikely to clash with steps from other modules.
695
+ */
696
+ static jsonID(e, t) {
697
+ if (e in Pe)
698
+ throw new RangeError("Duplicate use of step JSON ID " + e);
699
+ return Pe[e] = t, t.prototype.jsonID = e, t;
700
+ }
701
+ }
702
+ class N {
703
+ /**
704
+ @internal
705
+ */
706
+ constructor(e, t) {
707
+ this.doc = e, this.failed = t;
708
+ }
709
+ /**
710
+ Create a successful step result.
711
+ */
712
+ static ok(e) {
713
+ return new N(e, null);
714
+ }
715
+ /**
716
+ Create a failed step result.
717
+ */
718
+ static fail(e) {
719
+ return new N(null, e);
720
+ }
721
+ /**
722
+ Call [`Node.replace`](https://prosemirror.net/docs/ref/#model.Node.replace) with the given
723
+ arguments. Create a successful result if it succeeds, and a
724
+ failed one if it throws a `ReplaceError`.
725
+ */
726
+ static fromReplace(e, t, r, i) {
727
+ try {
728
+ return N.ok(e.replace(t, r, i));
729
+ } catch (s) {
730
+ if (s instanceof tn)
731
+ return N.fail(s.message);
732
+ throw s;
733
+ }
734
+ }
735
+ }
736
+ function He(n, e, t) {
737
+ let r = [];
738
+ for (let i = 0; i < n.childCount; i++) {
739
+ let s = n.child(i);
740
+ s.content.size && (s = s.copy(He(s.content, e, s))), s.isInline && (s = e(s, t, i)), r.push(s);
741
+ }
742
+ return k.fromArray(r);
743
+ }
744
+ class U extends M {
745
+ /**
746
+ Create a mark step.
747
+ */
748
+ constructor(e, t, r) {
749
+ super(), this.from = e, this.to = t, this.mark = r;
750
+ }
751
+ apply(e) {
752
+ let t = e.slice(this.from, this.to), r = e.resolve(this.from), i = r.node(r.sharedDepth(this.to)), s = new T(He(t.content, (l, a) => !l.isAtom || !a.type.allowsMarkType(this.mark.type) ? l : l.mark(this.mark.addToSet(l.marks)), i), t.openStart, t.openEnd);
753
+ return N.fromReplace(e, this.from, this.to, s);
754
+ }
755
+ invert() {
756
+ return new Y(this.from, this.to, this.mark);
757
+ }
758
+ map(e) {
759
+ let t = e.mapResult(this.from, 1), r = e.mapResult(this.to, -1);
760
+ return t.deleted && r.deleted || t.pos >= r.pos ? null : new U(t.pos, r.pos, this.mark);
761
+ }
762
+ merge(e) {
763
+ return e instanceof U && e.mark.eq(this.mark) && this.from <= e.to && this.to >= e.from ? new U(Math.min(this.from, e.from), Math.max(this.to, e.to), this.mark) : null;
764
+ }
765
+ toJSON() {
766
+ return {
767
+ stepType: "addMark",
768
+ mark: this.mark.toJSON(),
769
+ from: this.from,
770
+ to: this.to
771
+ };
772
+ }
773
+ /**
774
+ @internal
775
+ */
776
+ static fromJSON(e, t) {
777
+ if (typeof t.from != "number" || typeof t.to != "number")
778
+ throw new RangeError("Invalid input for AddMarkStep.fromJSON");
779
+ return new U(t.from, t.to, e.markFromJSON(t.mark));
780
+ }
781
+ }
782
+ M.jsonID("addMark", U);
783
+ class Y extends M {
784
+ /**
785
+ Create a mark-removing step.
786
+ */
787
+ constructor(e, t, r) {
788
+ super(), this.from = e, this.to = t, this.mark = r;
789
+ }
790
+ apply(e) {
791
+ let t = e.slice(this.from, this.to), r = new T(He(t.content, (i) => i.mark(this.mark.removeFromSet(i.marks)), e), t.openStart, t.openEnd);
792
+ return N.fromReplace(e, this.from, this.to, r);
793
+ }
794
+ invert() {
795
+ return new U(this.from, this.to, this.mark);
796
+ }
797
+ map(e) {
798
+ let t = e.mapResult(this.from, 1), r = e.mapResult(this.to, -1);
799
+ return t.deleted && r.deleted || t.pos >= r.pos ? null : new Y(t.pos, r.pos, this.mark);
800
+ }
801
+ merge(e) {
802
+ return e instanceof Y && e.mark.eq(this.mark) && this.from <= e.to && this.to >= e.from ? new Y(Math.min(this.from, e.from), Math.max(this.to, e.to), this.mark) : null;
803
+ }
804
+ toJSON() {
805
+ return {
806
+ stepType: "removeMark",
807
+ mark: this.mark.toJSON(),
808
+ from: this.from,
809
+ to: this.to
810
+ };
811
+ }
812
+ /**
813
+ @internal
814
+ */
815
+ static fromJSON(e, t) {
816
+ if (typeof t.from != "number" || typeof t.to != "number")
817
+ throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");
818
+ return new Y(t.from, t.to, e.markFromJSON(t.mark));
819
+ }
820
+ }
821
+ M.jsonID("removeMark", Y);
822
+ class K extends M {
823
+ /**
824
+ Create a node mark step.
825
+ */
826
+ constructor(e, t) {
827
+ super(), this.pos = e, this.mark = t;
828
+ }
829
+ apply(e) {
830
+ let t = e.nodeAt(this.pos);
831
+ if (!t)
832
+ return N.fail("No node at mark step's position");
833
+ let r = t.type.create(t.attrs, null, this.mark.addToSet(t.marks));
834
+ return N.fromReplace(e, this.pos, this.pos + 1, new T(k.from(r), 0, t.isLeaf ? 0 : 1));
835
+ }
836
+ invert(e) {
837
+ let t = e.nodeAt(this.pos);
838
+ if (t) {
839
+ let r = this.mark.addToSet(t.marks);
840
+ if (r.length == t.marks.length) {
841
+ for (let i = 0; i < t.marks.length; i++)
842
+ if (!t.marks[i].isInSet(r))
843
+ return new K(this.pos, t.marks[i]);
844
+ return new K(this.pos, this.mark);
845
+ }
846
+ }
847
+ return new ue(this.pos, this.mark);
848
+ }
849
+ map(e) {
850
+ let t = e.mapResult(this.pos, 1);
851
+ return t.deletedAfter ? null : new K(t.pos, this.mark);
852
+ }
853
+ toJSON() {
854
+ return { stepType: "addNodeMark", pos: this.pos, mark: this.mark.toJSON() };
855
+ }
856
+ /**
857
+ @internal
858
+ */
859
+ static fromJSON(e, t) {
860
+ if (typeof t.pos != "number")
861
+ throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");
862
+ return new K(t.pos, e.markFromJSON(t.mark));
863
+ }
864
+ }
865
+ M.jsonID("addNodeMark", K);
866
+ class ue extends M {
867
+ /**
868
+ Create a mark-removing step.
869
+ */
870
+ constructor(e, t) {
871
+ super(), this.pos = e, this.mark = t;
872
+ }
873
+ apply(e) {
874
+ let t = e.nodeAt(this.pos);
875
+ if (!t)
876
+ return N.fail("No node at mark step's position");
877
+ let r = t.type.create(t.attrs, null, this.mark.removeFromSet(t.marks));
878
+ return N.fromReplace(e, this.pos, this.pos + 1, new T(k.from(r), 0, t.isLeaf ? 0 : 1));
879
+ }
880
+ invert(e) {
881
+ let t = e.nodeAt(this.pos);
882
+ return !t || !this.mark.isInSet(t.marks) ? this : new K(this.pos, this.mark);
883
+ }
884
+ map(e) {
885
+ let t = e.mapResult(this.pos, 1);
886
+ return t.deletedAfter ? null : new ue(t.pos, this.mark);
887
+ }
888
+ toJSON() {
889
+ return { stepType: "removeNodeMark", pos: this.pos, mark: this.mark.toJSON() };
890
+ }
891
+ /**
892
+ @internal
893
+ */
894
+ static fromJSON(e, t) {
895
+ if (typeof t.pos != "number")
896
+ throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");
897
+ return new ue(t.pos, e.markFromJSON(t.mark));
898
+ }
899
+ }
900
+ M.jsonID("removeNodeMark", ue);
901
+ class B extends M {
902
+ /**
903
+ The given `slice` should fit the 'gap' between `from` and
904
+ `to`—the depths must line up, and the surrounding nodes must be
905
+ able to be joined with the open sides of the slice. When
906
+ `structure` is true, the step will fail if the content between
907
+ from and to is not just a sequence of closing and then opening
908
+ tokens (this is to guard against rebased replace steps
909
+ overwriting something they weren't supposed to).
910
+ */
911
+ constructor(e, t, r, i = !1) {
912
+ super(), this.from = e, this.to = t, this.slice = r, this.structure = i;
913
+ }
914
+ apply(e) {
915
+ return this.structure && Fe(e, this.from, this.to) ? N.fail("Structure replace would overwrite content") : N.fromReplace(e, this.from, this.to, this.slice);
916
+ }
917
+ getMap() {
918
+ return new F([this.from, this.to - this.from, this.slice.size]);
919
+ }
920
+ invert(e) {
921
+ return new B(this.from, this.from + this.slice.size, e.slice(this.from, this.to));
922
+ }
923
+ map(e) {
924
+ let t = e.mapResult(this.to, -1), r = this.from == this.to && B.MAP_BIAS < 0 ? t : e.mapResult(this.from, 1);
925
+ return r.deletedAcross && t.deletedAcross ? null : new B(r.pos, Math.max(r.pos, t.pos), this.slice, this.structure);
926
+ }
927
+ merge(e) {
928
+ if (!(e instanceof B) || e.structure || this.structure)
929
+ return null;
930
+ if (this.from + this.slice.size == e.from && !this.slice.openEnd && !e.slice.openStart) {
931
+ let t = this.slice.size + e.slice.size == 0 ? T.empty : new T(this.slice.content.append(e.slice.content), this.slice.openStart, e.slice.openEnd);
932
+ return new B(this.from, this.to + (e.to - e.from), t, this.structure);
933
+ } else if (e.to == this.from && !this.slice.openStart && !e.slice.openEnd) {
934
+ let t = this.slice.size + e.slice.size == 0 ? T.empty : new T(e.slice.content.append(this.slice.content), e.slice.openStart, this.slice.openEnd);
935
+ return new B(e.from, this.to, t, this.structure);
936
+ } else
937
+ return null;
938
+ }
939
+ toJSON() {
940
+ let e = { stepType: "replace", from: this.from, to: this.to };
941
+ return this.slice.size && (e.slice = this.slice.toJSON()), this.structure && (e.structure = !0), e;
942
+ }
943
+ /**
944
+ @internal
945
+ */
946
+ static fromJSON(e, t) {
947
+ if (typeof t.from != "number" || typeof t.to != "number")
948
+ throw new RangeError("Invalid input for ReplaceStep.fromJSON");
949
+ return new B(t.from, t.to, T.fromJSON(e, t.slice), !!t.structure);
950
+ }
951
+ }
952
+ B.MAP_BIAS = 1;
953
+ M.jsonID("replace", B);
954
+ class ee extends M {
955
+ /**
956
+ Create a replace-around step with the given range and gap.
957
+ `insert` should be the point in the slice into which the content
958
+ of the gap should be moved. `structure` has the same meaning as
959
+ it has in the [`ReplaceStep`](https://prosemirror.net/docs/ref/#transform.ReplaceStep) class.
960
+ */
961
+ constructor(e, t, r, i, s, l, a = !1) {
962
+ super(), this.from = e, this.to = t, this.gapFrom = r, this.gapTo = i, this.slice = s, this.insert = l, this.structure = a;
963
+ }
964
+ apply(e) {
965
+ if (this.structure && (Fe(e, this.from, this.gapFrom) || Fe(e, this.gapTo, this.to)))
966
+ return N.fail("Structure gap-replace would overwrite content");
967
+ let t = e.slice(this.gapFrom, this.gapTo);
968
+ if (t.openStart || t.openEnd)
969
+ return N.fail("Gap is not a flat range");
970
+ let r = this.slice.insertAt(this.insert, t.content);
971
+ return r ? N.fromReplace(e, this.from, this.to, r) : N.fail("Content does not fit in gap");
972
+ }
973
+ getMap() {
974
+ return new F([
975
+ this.from,
976
+ this.gapFrom - this.from,
977
+ this.insert,
978
+ this.gapTo,
979
+ this.to - this.gapTo,
980
+ this.slice.size - this.insert
981
+ ]);
982
+ }
983
+ invert(e) {
984
+ let t = this.gapTo - this.gapFrom;
985
+ return new ee(this.from, this.from + this.slice.size + t, this.from + this.insert, this.from + this.insert + t, e.slice(this.from, this.to).removeBetween(this.gapFrom - this.from, this.gapTo - this.from), this.gapFrom - this.from, this.structure);
986
+ }
987
+ map(e) {
988
+ let t = e.mapResult(this.from, 1), r = e.mapResult(this.to, -1), i = this.from == this.gapFrom ? t.pos : e.map(this.gapFrom, -1), s = this.to == this.gapTo ? r.pos : e.map(this.gapTo, 1);
989
+ return t.deletedAcross && r.deletedAcross || i < t.pos || s > r.pos ? null : new ee(t.pos, r.pos, i, s, this.slice, this.insert, this.structure);
990
+ }
991
+ toJSON() {
992
+ let e = {
993
+ stepType: "replaceAround",
994
+ from: this.from,
995
+ to: this.to,
996
+ gapFrom: this.gapFrom,
997
+ gapTo: this.gapTo,
998
+ insert: this.insert
999
+ };
1000
+ return this.slice.size && (e.slice = this.slice.toJSON()), this.structure && (e.structure = !0), e;
1001
+ }
1002
+ /**
1003
+ @internal
1004
+ */
1005
+ static fromJSON(e, t) {
1006
+ if (typeof t.from != "number" || typeof t.to != "number" || typeof t.gapFrom != "number" || typeof t.gapTo != "number" || typeof t.insert != "number")
1007
+ throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");
1008
+ return new ee(t.from, t.to, t.gapFrom, t.gapTo, T.fromJSON(e, t.slice), t.insert, !!t.structure);
1009
+ }
1010
+ }
1011
+ M.jsonID("replaceAround", ee);
1012
+ function Fe(n, e, t) {
1013
+ let r = n.resolve(e), i = t - e, s = r.depth;
1014
+ for (; i > 0 && s > 0 && r.indexAfter(s) == r.node(s).childCount; )
1015
+ s--, i--;
1016
+ if (i > 0) {
1017
+ let l = r.node(s).maybeChild(r.indexAfter(s));
1018
+ for (; i > 0; ) {
1019
+ if (!l || l.isLeaf)
1020
+ return !0;
1021
+ l = l.firstChild, i--;
1022
+ }
1023
+ }
1024
+ return !1;
1025
+ }
1026
+ function sn(n, e, t) {
1027
+ return (e == 0 || n.canReplace(e, n.childCount)) && (t == n.childCount || n.canReplace(0, t));
1028
+ }
1029
+ function Gt(n) {
1030
+ let t = n.parent.content.cutByIndex(n.startIndex, n.endIndex);
1031
+ for (let r = n.depth, i = 0, s = 0; ; --r) {
1032
+ let l = n.$from.node(r), a = n.$from.index(r) + i, u = n.$to.indexAfter(r) - s;
1033
+ if (r < n.depth && l.canReplace(a, u, t))
1034
+ return r;
1035
+ if (r == 0 || l.type.spec.isolating || !sn(l, a, u))
1036
+ break;
1037
+ a && (i = 1), u < l.childCount && (s = 1);
1038
+ }
1039
+ return null;
1040
+ }
1041
+ class le extends M {
1042
+ /**
1043
+ Construct an attribute step.
1044
+ */
1045
+ constructor(e, t, r) {
1046
+ super(), this.pos = e, this.attr = t, this.value = r;
1047
+ }
1048
+ apply(e) {
1049
+ let t = e.nodeAt(this.pos);
1050
+ if (!t)
1051
+ return N.fail("No node at attribute step's position");
1052
+ let r = /* @__PURE__ */ Object.create(null);
1053
+ for (let s in t.attrs)
1054
+ r[s] = t.attrs[s];
1055
+ r[this.attr] = this.value;
1056
+ let i = t.type.create(r, null, t.marks);
1057
+ return N.fromReplace(e, this.pos, this.pos + 1, new T(k.from(i), 0, t.isLeaf ? 0 : 1));
1058
+ }
1059
+ getMap() {
1060
+ return F.empty;
1061
+ }
1062
+ invert(e) {
1063
+ return new le(this.pos, this.attr, e.nodeAt(this.pos).attrs[this.attr]);
1064
+ }
1065
+ map(e) {
1066
+ let t = e.mapResult(this.pos, 1);
1067
+ return t.deletedAfter ? null : new le(t.pos, this.attr, this.value);
1068
+ }
1069
+ toJSON() {
1070
+ return { stepType: "attr", pos: this.pos, attr: this.attr, value: this.value };
1071
+ }
1072
+ static fromJSON(e, t) {
1073
+ if (typeof t.pos != "number" || typeof t.attr != "string")
1074
+ throw new RangeError("Invalid input for AttrStep.fromJSON");
1075
+ return new le(t.pos, t.attr, t.value);
1076
+ }
1077
+ }
1078
+ M.jsonID("attr", le);
1079
+ class xe extends M {
1080
+ /**
1081
+ Construct an attribute step.
1082
+ */
1083
+ constructor(e, t) {
1084
+ super(), this.attr = e, this.value = t;
1085
+ }
1086
+ apply(e) {
1087
+ let t = /* @__PURE__ */ Object.create(null);
1088
+ for (let i in e.attrs)
1089
+ t[i] = e.attrs[i];
1090
+ t[this.attr] = this.value;
1091
+ let r = e.type.create(t, e.content, e.marks);
1092
+ return N.ok(r);
1093
+ }
1094
+ getMap() {
1095
+ return F.empty;
1096
+ }
1097
+ invert(e) {
1098
+ return new xe(this.attr, e.attrs[this.attr]);
1099
+ }
1100
+ map(e) {
1101
+ return this;
1102
+ }
1103
+ toJSON() {
1104
+ return { stepType: "docAttr", attr: this.attr, value: this.value };
1105
+ }
1106
+ static fromJSON(e, t) {
1107
+ if (typeof t.attr != "string")
1108
+ throw new RangeError("Invalid input for DocAttrStep.fromJSON");
1109
+ return new xe(t.attr, t.value);
1110
+ }
1111
+ }
1112
+ M.jsonID("docAttr", xe);
1113
+ let ce = class extends Error {
1114
+ };
1115
+ ce = function n(e) {
1116
+ let t = Error.call(this, e);
1117
+ return t.__proto__ = n.prototype, t;
1118
+ };
1119
+ ce.prototype = Object.create(Error.prototype);
1120
+ ce.prototype.constructor = ce;
1121
+ ce.prototype.name = "TransformError";
1122
+ const De = /* @__PURE__ */ Object.create(null);
1123
+ class L {
1124
+ /**
1125
+ Initialize a selection with the head and anchor and ranges. If no
1126
+ ranges are given, constructs a single range across `$anchor` and
1127
+ `$head`.
1128
+ */
1129
+ constructor(e, t, r) {
1130
+ this.$anchor = e, this.$head = t, this.ranges = r || [new on(e.min(t), e.max(t))];
1131
+ }
1132
+ /**
1133
+ The selection's anchor, as an unresolved position.
1134
+ */
1135
+ get anchor() {
1136
+ return this.$anchor.pos;
1137
+ }
1138
+ /**
1139
+ The selection's head.
1140
+ */
1141
+ get head() {
1142
+ return this.$head.pos;
1143
+ }
1144
+ /**
1145
+ The lower bound of the selection's main range.
1146
+ */
1147
+ get from() {
1148
+ return this.$from.pos;
1149
+ }
1150
+ /**
1151
+ The upper bound of the selection's main range.
1152
+ */
1153
+ get to() {
1154
+ return this.$to.pos;
1155
+ }
1156
+ /**
1157
+ The resolved lower bound of the selection's main range.
1158
+ */
1159
+ get $from() {
1160
+ return this.ranges[0].$from;
1161
+ }
1162
+ /**
1163
+ The resolved upper bound of the selection's main range.
1164
+ */
1165
+ get $to() {
1166
+ return this.ranges[0].$to;
1167
+ }
1168
+ /**
1169
+ Indicates whether the selection contains any content.
1170
+ */
1171
+ get empty() {
1172
+ let e = this.ranges;
1173
+ for (let t = 0; t < e.length; t++)
1174
+ if (e[t].$from.pos != e[t].$to.pos)
1175
+ return !1;
1176
+ return !0;
1177
+ }
1178
+ /**
1179
+ Get the content of this selection as a slice.
1180
+ */
1181
+ content() {
1182
+ return this.$from.doc.slice(this.from, this.to, !0);
1183
+ }
1184
+ /**
1185
+ Replace the selection with a slice or, if no slice is given,
1186
+ delete the selection. Will append to the given transaction.
1187
+ */
1188
+ replace(e, t = T.empty) {
1189
+ let r = t.content.lastChild, i = null;
1190
+ for (let a = 0; a < t.openEnd; a++)
1191
+ i = r, r = r.lastChild;
1192
+ let s = e.steps.length, l = this.ranges;
1193
+ for (let a = 0; a < l.length; a++) {
1194
+ let { $from: u, $to: f } = l[a], d = e.mapping.slice(s);
1195
+ e.replaceRange(d.map(u.pos), d.map(f.pos), a ? T.empty : t), a == 0 && yt(e, s, (r ? r.isInline : i && i.isTextblock) ? -1 : 1);
1196
+ }
1197
+ }
1198
+ /**
1199
+ Replace the selection with the given node, appending the changes
1200
+ to the given transaction.
1201
+ */
1202
+ replaceWith(e, t) {
1203
+ let r = e.steps.length, i = this.ranges;
1204
+ for (let s = 0; s < i.length; s++) {
1205
+ let { $from: l, $to: a } = i[s], u = e.mapping.slice(r), f = u.map(l.pos), d = u.map(a.pos);
1206
+ s ? e.deleteRange(f, d) : (e.replaceRangeWith(f, d, t), yt(e, r, t.isInline ? -1 : 1));
1207
+ }
1208
+ }
1209
+ /**
1210
+ Find a valid cursor or leaf node selection starting at the given
1211
+ position and searching back if `dir` is negative, and forward if
1212
+ positive. When `textOnly` is true, only consider cursor
1213
+ selections. Will return null when no valid selection position is
1214
+ found.
1215
+ */
1216
+ static findFrom(e, t, r = !1) {
1217
+ let i = e.parent.inlineContent ? new D(e) : Q(e.node(0), e.parent, e.pos, e.index(), t, r);
1218
+ if (i)
1219
+ return i;
1220
+ for (let s = e.depth - 1; s >= 0; s--) {
1221
+ let l = t < 0 ? Q(e.node(0), e.node(s), e.before(s + 1), e.index(s), t, r) : Q(e.node(0), e.node(s), e.after(s + 1), e.index(s) + 1, t, r);
1222
+ if (l)
1223
+ return l;
1224
+ }
1225
+ return null;
1226
+ }
1227
+ /**
1228
+ Find a valid cursor or leaf node selection near the given
1229
+ position. Searches forward first by default, but if `bias` is
1230
+ negative, it will search backwards first.
1231
+ */
1232
+ static near(e, t = 1) {
1233
+ return this.findFrom(e, t) || this.findFrom(e, -t) || new j(e.node(0));
1234
+ }
1235
+ /**
1236
+ Find the cursor or leaf node selection closest to the start of
1237
+ the given document. Will return an
1238
+ [`AllSelection`](https://prosemirror.net/docs/ref/#state.AllSelection) if no valid position
1239
+ exists.
1240
+ */
1241
+ static atStart(e) {
1242
+ return Q(e, e, 0, 0, 1) || new j(e);
1243
+ }
1244
+ /**
1245
+ Find the cursor or leaf node selection closest to the end of the
1246
+ given document.
1247
+ */
1248
+ static atEnd(e) {
1249
+ return Q(e, e, e.content.size, e.childCount, -1) || new j(e);
1250
+ }
1251
+ /**
1252
+ Deserialize the JSON representation of a selection. Must be
1253
+ implemented for custom classes (as a static class method).
1254
+ */
1255
+ static fromJSON(e, t) {
1256
+ if (!t || !t.type)
1257
+ throw new RangeError("Invalid input for Selection.fromJSON");
1258
+ let r = De[t.type];
1259
+ if (!r)
1260
+ throw new RangeError(`No selection type ${t.type} defined`);
1261
+ return r.fromJSON(e, t);
1262
+ }
1263
+ /**
1264
+ To be able to deserialize selections from JSON, custom selection
1265
+ classes must register themselves with an ID string, so that they
1266
+ can be disambiguated. Try to pick something that's unlikely to
1267
+ clash with classes from other modules.
1268
+ */
1269
+ static jsonID(e, t) {
1270
+ if (e in De)
1271
+ throw new RangeError("Duplicate use of selection JSON ID " + e);
1272
+ return De[e] = t, t.prototype.jsonID = e, t;
1273
+ }
1274
+ /**
1275
+ Get a [bookmark](https://prosemirror.net/docs/ref/#state.SelectionBookmark) for this selection,
1276
+ which is a value that can be mapped without having access to a
1277
+ current document, and later resolved to a real selection for a
1278
+ given document again. (This is used mostly by the history to
1279
+ track and restore old selections.) The default implementation of
1280
+ this method just converts the selection to a text selection and
1281
+ returns the bookmark for that.
1282
+ */
1283
+ getBookmark() {
1284
+ return D.between(this.$anchor, this.$head).getBookmark();
1285
+ }
1286
+ }
1287
+ L.prototype.visible = !0;
1288
+ class on {
1289
+ /**
1290
+ Create a range.
1291
+ */
1292
+ constructor(e, t) {
1293
+ this.$from = e, this.$to = t;
1294
+ }
1295
+ }
1296
+ let mt = !1;
1297
+ function gt(n) {
1298
+ !mt && !n.parent.inlineContent && (mt = !0, console.warn("TextSelection endpoint not pointing into a node with inline content (" + n.parent.type.name + ")"));
1299
+ }
1300
+ class D extends L {
1301
+ /**
1302
+ Construct a text selection between the given points.
1303
+ */
1304
+ constructor(e, t = e) {
1305
+ gt(e), gt(t), super(e, t);
1306
+ }
1307
+ /**
1308
+ Returns a resolved position if this is a cursor selection (an
1309
+ empty text selection), and null otherwise.
1310
+ */
1311
+ get $cursor() {
1312
+ return this.$anchor.pos == this.$head.pos ? this.$head : null;
1313
+ }
1314
+ map(e, t) {
1315
+ let r = e.resolve(t.map(this.head));
1316
+ if (!r.parent.inlineContent)
1317
+ return L.near(r);
1318
+ let i = e.resolve(t.map(this.anchor));
1319
+ return new D(i.parent.inlineContent ? i : r, r);
1320
+ }
1321
+ replace(e, t = T.empty) {
1322
+ if (super.replace(e, t), t == T.empty) {
1323
+ let r = this.$from.marksAcross(this.$to);
1324
+ r && e.ensureMarks(r);
1325
+ }
1326
+ }
1327
+ eq(e) {
1328
+ return e instanceof D && e.anchor == this.anchor && e.head == this.head;
1329
+ }
1330
+ getBookmark() {
1331
+ return new Se(this.anchor, this.head);
1332
+ }
1333
+ toJSON() {
1334
+ return { type: "text", anchor: this.anchor, head: this.head };
1335
+ }
1336
+ /**
1337
+ @internal
1338
+ */
1339
+ static fromJSON(e, t) {
1340
+ if (typeof t.anchor != "number" || typeof t.head != "number")
1341
+ throw new RangeError("Invalid input for TextSelection.fromJSON");
1342
+ return new D(e.resolve(t.anchor), e.resolve(t.head));
1343
+ }
1344
+ /**
1345
+ Create a text selection from non-resolved positions.
1346
+ */
1347
+ static create(e, t, r = t) {
1348
+ let i = e.resolve(t);
1349
+ return new this(i, r == t ? i : e.resolve(r));
1350
+ }
1351
+ /**
1352
+ Return a text selection that spans the given positions or, if
1353
+ they aren't text positions, find a text selection near them.
1354
+ `bias` determines whether the method searches forward (default)
1355
+ or backwards (negative number) first. Will fall back to calling
1356
+ [`Selection.near`](https://prosemirror.net/docs/ref/#state.Selection^near) when the document
1357
+ doesn't contain a valid text position.
1358
+ */
1359
+ static between(e, t, r) {
1360
+ let i = e.pos - t.pos;
1361
+ if ((!r || i) && (r = i >= 0 ? 1 : -1), !t.parent.inlineContent) {
1362
+ let s = L.findFrom(t, r, !0) || L.findFrom(t, -r, !0);
1363
+ if (s)
1364
+ t = s.$head;
1365
+ else
1366
+ return L.near(t, r);
1367
+ }
1368
+ return e.parent.inlineContent || (i == 0 ? e = t : (e = (L.findFrom(e, -r, !0) || L.findFrom(e, r, !0)).$anchor, e.pos < t.pos != i < 0 && (e = t))), new D(e, t);
1369
+ }
1370
+ }
1371
+ L.jsonID("text", D);
1372
+ class Se {
1373
+ constructor(e, t) {
1374
+ this.anchor = e, this.head = t;
1375
+ }
1376
+ map(e) {
1377
+ return new Se(e.map(this.anchor), e.map(this.head));
1378
+ }
1379
+ resolve(e) {
1380
+ return D.between(e.resolve(this.anchor), e.resolve(this.head));
1381
+ }
1382
+ }
1383
+ class z extends L {
1384
+ /**
1385
+ Create a node selection. Does not verify the validity of its
1386
+ argument.
1387
+ */
1388
+ constructor(e) {
1389
+ let t = e.nodeAfter, r = e.node(0).resolve(e.pos + t.nodeSize);
1390
+ super(e, r), this.node = t;
1391
+ }
1392
+ map(e, t) {
1393
+ let { deleted: r, pos: i } = t.mapResult(this.anchor), s = e.resolve(i);
1394
+ return r ? L.near(s) : new z(s);
1395
+ }
1396
+ content() {
1397
+ return new T(k.from(this.node), 0, 0);
1398
+ }
1399
+ eq(e) {
1400
+ return e instanceof z && e.anchor == this.anchor;
1401
+ }
1402
+ toJSON() {
1403
+ return { type: "node", anchor: this.anchor };
1404
+ }
1405
+ getBookmark() {
1406
+ return new Be(this.anchor);
1407
+ }
1408
+ /**
1409
+ @internal
1410
+ */
1411
+ static fromJSON(e, t) {
1412
+ if (typeof t.anchor != "number")
1413
+ throw new RangeError("Invalid input for NodeSelection.fromJSON");
1414
+ return new z(e.resolve(t.anchor));
1415
+ }
1416
+ /**
1417
+ Create a node selection from non-resolved positions.
1418
+ */
1419
+ static create(e, t) {
1420
+ return new z(e.resolve(t));
1421
+ }
1422
+ /**
1423
+ Determines whether the given node may be selected as a node
1424
+ selection.
1425
+ */
1426
+ static isSelectable(e) {
1427
+ return !e.isText && e.type.spec.selectable !== !1;
1428
+ }
1429
+ }
1430
+ z.prototype.visible = !1;
1431
+ L.jsonID("node", z);
1432
+ class Be {
1433
+ constructor(e) {
1434
+ this.anchor = e;
1435
+ }
1436
+ map(e) {
1437
+ let { deleted: t, pos: r } = e.mapResult(this.anchor);
1438
+ return t ? new Se(r, r) : new Be(r);
1439
+ }
1440
+ resolve(e) {
1441
+ let t = e.resolve(this.anchor), r = t.nodeAfter;
1442
+ return r && z.isSelectable(r) ? new z(t) : L.near(t);
1443
+ }
1444
+ }
1445
+ class j extends L {
1446
+ /**
1447
+ Create an all-selection over the given document.
1448
+ */
1449
+ constructor(e) {
1450
+ super(e.resolve(0), e.resolve(e.content.size));
1451
+ }
1452
+ replace(e, t = T.empty) {
1453
+ if (t == T.empty) {
1454
+ e.delete(0, e.doc.content.size);
1455
+ let r = L.atStart(e.doc);
1456
+ r.eq(e.selection) || e.setSelection(r);
1457
+ } else
1458
+ super.replace(e, t);
1459
+ }
1460
+ toJSON() {
1461
+ return { type: "all" };
1462
+ }
1463
+ /**
1464
+ @internal
1465
+ */
1466
+ static fromJSON(e) {
1467
+ return new j(e);
1468
+ }
1469
+ map(e) {
1470
+ return new j(e);
1471
+ }
1472
+ eq(e) {
1473
+ return e instanceof j;
1474
+ }
1475
+ getBookmark() {
1476
+ return an;
1477
+ }
1478
+ }
1479
+ L.jsonID("all", j);
1480
+ const an = {
1481
+ map() {
1482
+ return this;
1483
+ },
1484
+ resolve(n) {
1485
+ return new j(n);
1486
+ }
1487
+ };
1488
+ function Q(n, e, t, r, i, s = !1) {
1489
+ if (e.inlineContent)
1490
+ return D.create(n, t);
1491
+ for (let l = r - (i > 0 ? 0 : 1); i > 0 ? l < e.childCount : l >= 0; l += i) {
1492
+ let a = e.child(l);
1493
+ if (a.isAtom) {
1494
+ if (!s && z.isSelectable(a))
1495
+ return z.create(n, t - (i < 0 ? a.nodeSize : 0));
1496
+ } else {
1497
+ let u = Q(n, a, t + i, i < 0 ? a.childCount : 0, i, s);
1498
+ if (u)
1499
+ return u;
1500
+ }
1501
+ t += a.nodeSize * i;
1502
+ }
1503
+ return null;
1504
+ }
1505
+ function yt(n, e, t) {
1506
+ let r = n.steps.length - 1;
1507
+ if (r < e)
1508
+ return;
1509
+ let i = n.steps[r];
1510
+ if (!(i instanceof B || i instanceof ee))
1511
+ return;
1512
+ let s = n.mapping.maps[r], l;
1513
+ s.forEach((a, u, f, d) => {
1514
+ l == null && (l = d);
1515
+ }), n.setSelection(L.near(n.doc.resolve(l), t));
1516
+ }
1517
+ function vt(n, e) {
1518
+ return !e || !n ? n : n.bind(e);
1519
+ }
1520
+ class ve {
1521
+ constructor(e, t, r) {
1522
+ this.name = e, this.init = vt(t.init, r), this.apply = vt(t.apply, r);
1523
+ }
1524
+ }
1525
+ new ve("doc", {
1526
+ init(n) {
1527
+ return n.doc || n.schema.topNodeType.createAndFill();
1528
+ },
1529
+ apply(n) {
1530
+ return n.doc;
1531
+ }
1532
+ }), new ve("selection", {
1533
+ init(n, e) {
1534
+ return n.selection || L.atStart(e.doc);
1535
+ },
1536
+ apply(n) {
1537
+ return n.selection;
1538
+ }
1539
+ }), new ve("storedMarks", {
1540
+ init(n) {
1541
+ return n.storedMarks || null;
1542
+ },
1543
+ apply(n, e, t, r) {
1544
+ return r.selection.$cursor ? n.storedMarks : null;
1545
+ }
1546
+ }), new ve("scrollToSelection", {
1547
+ init() {
1548
+ return 0;
1549
+ },
1550
+ apply(n, e) {
1551
+ return n.scrolledIntoView ? e + 1 : e;
1552
+ }
1553
+ });
1554
+ function Xt(n, e, t) {
1555
+ for (let r in n) {
1556
+ let i = n[r];
1557
+ i instanceof Function ? i = i.bind(e) : r == "handleDOMEvents" && (i = Xt(i, e, {})), t[r] = i;
1558
+ }
1559
+ return t;
1560
+ }
1561
+ class de {
1562
+ /**
1563
+ Create a plugin.
1564
+ */
1565
+ constructor(e) {
1566
+ this.spec = e, this.props = {}, e.props && Xt(e.props, this, this.props), this.key = e.key ? e.key.key : Zt("plugin");
1567
+ }
1568
+ /**
1569
+ Extract the plugin's state field from an editor state.
1570
+ */
1571
+ getState(e) {
1572
+ return e[this.key];
1573
+ }
1574
+ }
1575
+ const ze = /* @__PURE__ */ Object.create(null);
1576
+ function Zt(n) {
1577
+ return n in ze ? n + "$" + ++ze[n] : (ze[n] = 0, n + "$");
1578
+ }
1579
+ class ln {
1580
+ /**
1581
+ Create a plugin key.
1582
+ */
1583
+ constructor(e = "key") {
1584
+ this.key = Zt(e);
1585
+ }
1586
+ /**
1587
+ Get the active plugin with this key, if any, from an editor
1588
+ state.
1589
+ */
1590
+ get(e) {
1591
+ return e.config.pluginsByKey[this.key];
1592
+ }
1593
+ /**
1594
+ Get the plugin's state from an editor state.
1595
+ */
1596
+ getState(e) {
1597
+ return e[this.key];
1598
+ }
1599
+ }
1600
+ const $ = (n) => n === "bulletList" || n === "orderedList", be = (n) => n === "listItem", _ = (n) => n === "paragraph" || n === "heading";
1601
+ function _e(n, e) {
1602
+ for (const t of n)
1603
+ if (t(e))
1604
+ return !0;
1605
+ return !1;
1606
+ }
1607
+ function un(n, e) {
1608
+ for (const t of n)
1609
+ if (t(e)) return !0;
1610
+ return !1;
1611
+ }
1612
+ const It = ({
1613
+ state: n,
1614
+ view: e,
1615
+ $from: t,
1616
+ $to: r,
1617
+ selectionIsEmpty: i
1618
+ }) => {
1619
+ if (i) return !1;
1620
+ let s = 0;
1621
+ if (n.doc.nodesBetween(t.pos, r.pos, (p) => {
1622
+ (be(p.type.name) || _(p.type.name)) && s++;
1623
+ }), !(s > 1)) return !1;
1624
+ const { tr: a, doc: u } = n;
1625
+ let f = !1;
1626
+ const d = /* @__PURE__ */ new Set();
1627
+ return u.nodesBetween(t.pos, r.pos, (p, y) => {
1628
+ if ($(p.type.name) && (p.attrs.indent ?? 0) > 0) {
1629
+ if (!d.has(y)) {
1630
+ d.add(y);
1631
+ const w = p.attrs.indent ?? 0;
1632
+ a.setNodeAttribute(y, "indent", Math.max(0, w - 1)), f = !0;
1633
+ const m = n.doc.resolve(y), S = n.doc.resolve(y + p.nodeSize), C = new qt(m, S, m.depth), A = Gt(C);
1634
+ A != null && (a.lift(C, A), f = !0);
1635
+ }
1636
+ return !1;
1637
+ }
1638
+ if (_(p.type.name) && (p.attrs.indent ?? 0) > 0) {
1639
+ const w = p.attrs.indent ?? 0;
1640
+ a.setNodeAttribute(y, "indent", Math.max(0, w - 1)), f = !0;
1641
+ }
1642
+ return !0;
1643
+ }), f ? (a.setMeta("addToHistory", !0), e.dispatch(a), !0) : !1;
1644
+ }, cn = ({
1645
+ editor: n,
1646
+ $from: e,
1647
+ currentNode: t
1648
+ }) => {
1649
+ const r = e.pos === e.start(), i = t.attrs.indent > 0;
1650
+ return _(t.type.name) && i && r ? n.commands.outdent() : !1;
1651
+ }, dn = ({
1652
+ state: n,
1653
+ view: e,
1654
+ $from: t,
1655
+ currentNode: r
1656
+ }) => {
1657
+ const i = r.content.size === 0, s = r.attrs.indent > 0;
1658
+ if (!(_(r.type.name) && s && i)) return !1;
1659
+ const a = t.before(t.depth), u = n.tr;
1660
+ return u.delete(a, a + r.nodeSize), e.dispatch(u), !0;
1661
+ }, fn = ({
1662
+ state: n,
1663
+ view: e,
1664
+ $from: t,
1665
+ currentNode: r
1666
+ }) => {
1667
+ const i = t.pos === t.start(), s = r.content.size === 0, l = r.attrs.indent > 0, a = t.before(t.depth), u = n.doc.resolve(a).nodeBefore, f = u != null && $(u.type.name);
1668
+ if (_(r.type.name) && !l && s && i && f) {
1669
+ const p = n.tr;
1670
+ return p.delete(a, a + r.nodeSize), e.dispatch(p), !0;
1671
+ }
1672
+ return !1;
1673
+ }, hn = (n) => {
1674
+ const { tr: e, state: t, dispatch: r } = n, { selection: i } = t, { $from: s, $to: l } = i;
1675
+ if (i.empty) return !1;
1676
+ let a = 0;
1677
+ if (t.doc.nodesBetween(s.pos, l.pos, (d) => {
1678
+ ($(d.type.name) || _(d.type.name)) && a++;
1679
+ }), a <= 1) return !1;
1680
+ const u = /* @__PURE__ */ new Set();
1681
+ let f = !1;
1682
+ return t.doc.nodesBetween(s.pos, l.pos, (d, p) => {
1683
+ var w;
1684
+ return !($(d.type.name) || _(d.type.name)) || u.has(p) ? !0 : (u.add(p), e.setNodeAttribute(p, "indent", (((w = d.attrs) == null ? void 0 : w.indent) ?? 0) + 1), f = !0, !1);
1685
+ }), f ? (e.setMeta("addToHistory", !0), r == null || r(e), !0) : !1;
1686
+ }, pn = (n) => {
1687
+ var f;
1688
+ const { tr: e, state: t, dispatch: r } = n, { selection: i } = t, { $from: s } = i;
1689
+ let l = null, a = null;
1690
+ for (let d = s.depth; d > 0; d--) {
1691
+ const p = s.node(d);
1692
+ if ($(p.type.name)) {
1693
+ l = { ...p, pos: s.before(d) }, a = { ...s.node(d + 1), pos: s.before(d + 1) };
1694
+ break;
1695
+ }
1696
+ }
1697
+ if (!l || !a) return !1;
1698
+ if (((f = l.content) == null ? void 0 : f.childCount) === 1 && i instanceof D) {
1699
+ const d = l.attrs.indent ?? 0;
1700
+ return e.setNodeAttribute(l.pos, "indent", d + 1), e.setMeta("addToHistory", !1), r == null || r(e), !0;
1701
+ }
1702
+ return n.chain().focus().sinkListItem("listItem").updateAttributes("bulletList", { indent: 1 }).updateAttributes("orderedList", { indent: 1 }).run(), !0;
1703
+ }, mn = (n) => {
1704
+ const { tr: e, state: t, dispatch: r } = n, { selection: i } = t, { $from: s } = i, l = s.node();
1705
+ if (!(_(l.type.name) && i instanceof D)) return !1;
1706
+ const u = l.attrs.indent ?? 0;
1707
+ return e.setNodeAttribute(s.before(s.depth), "indent", u + 1), e.setMeta("addToHistory", !1), r == null || r(e), !0;
1708
+ }, gn = ({
1709
+ state: n,
1710
+ view: e,
1711
+ $from: t,
1712
+ $to: r,
1713
+ selectionIsEmpty: i
1714
+ }) => {
1715
+ if (i) return !1;
1716
+ let s = 0;
1717
+ if (n.doc.nodesBetween(t.pos, r.pos, (p) => {
1718
+ (be(p.type.name) || _(p.type.name)) && s++;
1719
+ }), !(s > 1)) return !1;
1720
+ const { tr: a, doc: u } = n;
1721
+ let f = !1;
1722
+ const d = /* @__PURE__ */ new Set();
1723
+ return u.nodesBetween(t.pos, r.pos, (p, y) => {
1724
+ if ($(p.type.name) && (p.attrs.indent ?? 0) > 0) {
1725
+ if (!d.has(y)) {
1726
+ d.add(y);
1727
+ const w = p.attrs.indent ?? 0;
1728
+ a.setNodeAttribute(y, "indent", Math.max(0, w - 1)), f = !0;
1729
+ const m = n.doc.resolve(y), S = n.doc.resolve(y + p.nodeSize), C = new qt(m, S, m.depth), A = Gt(C);
1730
+ A != null && (a.lift(C, A), f = !0);
1731
+ }
1732
+ return !1;
1733
+ }
1734
+ if (_(p.type.name) && (p.attrs.indent ?? 0) > 0) {
1735
+ const w = p.attrs.indent ?? 0;
1736
+ a.setNodeAttribute(y, "indent", Math.max(0, w - 1)), f = !0;
1737
+ }
1738
+ return !0;
1739
+ }), f ? (a.setMeta("addToHistory", !0), e.dispatch(a), !0) : !1;
1740
+ }, yn = ({ $from: n, selectionIsEmpty: e }) => {
1741
+ var l;
1742
+ if (!e) return !1;
1743
+ let t = !1, r = !1, i = 0;
1744
+ for (let a = n.depth; a > 0; a--) {
1745
+ const u = n.node(a);
1746
+ if ($(u.type.name))
1747
+ if (!t)
1748
+ t = !0, i = ((l = u.attrs) == null ? void 0 : l.indent) ?? 0;
1749
+ else {
1750
+ r = !0;
1751
+ break;
1752
+ }
1753
+ }
1754
+ return t && !r ? i === 0 : !1;
1755
+ }, vn = ({
1756
+ state: n,
1757
+ view: e,
1758
+ $from: t,
1759
+ currentNode: r,
1760
+ selectionIsEmpty: i
1761
+ }) => {
1762
+ if (!i || !(r.type.name === "paragraph" && r.content.size === 0)) return !1;
1763
+ const l = t.before(t.depth), a = n.doc.resolve(l).nodeBefore;
1764
+ if (!(a != null && $(a.type.name))) return !1;
1765
+ const f = n.doc.resolve(l - 1), d = n.tr.setSelection(D.near(f, -1));
1766
+ return e.dispatch(d), !0;
1767
+ }, In = ({
1768
+ state: n,
1769
+ view: e,
1770
+ $from: t,
1771
+ $to: r,
1772
+ selectionIsEmpty: i
1773
+ }) => {
1774
+ if (i) return !1;
1775
+ let s = 0;
1776
+ if (n.doc.nodesBetween(t.pos, r.pos, (p) => {
1777
+ (be(p.type.name) || _(p.type.name)) && s++;
1778
+ }), !(s > 1)) return !1;
1779
+ const { tr: a, doc: u } = n;
1780
+ let f = !1;
1781
+ const d = /* @__PURE__ */ new Set();
1782
+ return u.nodesBetween(t.pos, r.pos, (p, y) => {
1783
+ if (($(p.type.name) || _(p.type.name)) && !d.has(y)) {
1784
+ d.add(y);
1785
+ const m = p.attrs.indent ?? 0;
1786
+ return a.setNodeAttribute(y, "indent", m + 1), f = !0, !1;
1787
+ }
1788
+ return !0;
1789
+ }), f ? (a.setMeta("addToHistory", !0), e.dispatch(a), !0) : !1;
1790
+ }, wn = ({
1791
+ state: n,
1792
+ view: e,
1793
+ $from: t,
1794
+ selectionIsEmpty: r
1795
+ }) => r || t.path.some((s) => {
1796
+ var l;
1797
+ return ((l = s == null ? void 0 : s.type) == null ? void 0 : l.name) === "listItem";
1798
+ }) ? !1 : (e.dispatch(n.tr.insertText(" ")), !0), xn = ({ editor: n, currentNode: e, $from: t }) => {
1799
+ const r = e.content.size === 0, i = t.node(t.depth - 1);
1800
+ return i && be(i.type.name) && !r ? (n.chain().focus().indent().focus().run(), !0) : !1;
1801
+ }, Sn = ({ state: n, view: e, $from: t, currentNode: r }) => {
1802
+ const i = t.pos === t.start(), s = r.content.size === 0;
1803
+ return !i && !s ? (e.dispatch(n.tr.insertText(" ")), !0) : !1;
1804
+ };
1805
+ function Je(n) {
1806
+ const { state: e, view: t } = n, { $from: r, $to: i, empty: s } = e.selection;
1807
+ return { editor: n, state: e, view: t, $from: r, $to: i, selectionIsEmpty: s, currentNode: r.node() };
1808
+ }
1809
+ const bn = Xr.create({
1810
+ name: "indent",
1811
+ addKeyboardShortcuts() {
1812
+ return {
1813
+ Enter: () => this.editor.commands._handleEnterKeyDown(),
1814
+ Tab: () => {
1815
+ const n = Je(this.editor);
1816
+ return _e(
1817
+ [
1818
+ In,
1819
+ wn,
1820
+ xn,
1821
+ Sn
1822
+ ],
1823
+ n
1824
+ ) || this.editor.commands.indent();
1825
+ },
1826
+ Backspace: () => {
1827
+ const n = Je(this.editor);
1828
+ return _e(
1829
+ [
1830
+ cn,
1831
+ dn,
1832
+ fn
1833
+ ],
1834
+ n
1835
+ );
1836
+ },
1837
+ "Shift-Tab": () => {
1838
+ const n = Je(this.editor);
1839
+ return _e(
1840
+ [
1841
+ gn,
1842
+ vn,
1843
+ yn
1844
+ ],
1845
+ n
1846
+ ) || this.editor.chain().outdentShiftTab().run();
1847
+ },
1848
+ Space: () => this.editor.commands._handleSpaceKeyDown()
1849
+ };
1850
+ },
1851
+ addProseMirrorPlugins() {
1852
+ return [
1853
+ new de({
1854
+ // WHY: When a paragraph/heading inside a listItem gets an indent attribute (e.g. from a
1855
+ // paste or undo), the indent belongs on the parent list node, not the text node inside it.
1856
+ // This plugin corrects that automatically on every document change.
1857
+ appendTransaction: (n, e, t) => {
1858
+ if (!n.some((s) => s.docChanged)) return null;
1859
+ let i = null;
1860
+ return t.doc.descendants((s, l) => {
1861
+ var y;
1862
+ if (!(_(s.type.name) && (((y = s == null ? void 0 : s.attrs) == null ? void 0 : y.indent) ?? 0) > 0)) return;
1863
+ const u = t.doc.resolve(l);
1864
+ if (!(u.parent.type.name === "listItem")) return;
1865
+ let d = null;
1866
+ for (let w = u.depth - 1; w > 0; w--)
1867
+ if ($(u.node(w).type.name)) {
1868
+ d = u.start(w) - 1;
1869
+ break;
1870
+ }
1871
+ if (d === null || d < 0) return;
1872
+ i || (i = t.tr);
1873
+ const p = s.attrs.indent;
1874
+ i.setNodeAttribute(l, "indent", 0), i.setNodeAttribute(d, "indent", p);
1875
+ }), i;
1876
+ }
1877
+ })
1878
+ ];
1879
+ },
1880
+ addGlobalAttributes() {
1881
+ return [
1882
+ {
1883
+ types: this.options.types ?? ["orderedList", "bulletList", "paragraph", "heading"],
1884
+ attributes: {
1885
+ indent: {
1886
+ default: 1,
1887
+ parseHTML: (n) => parseInt(n.getAttribute("data-indent") || "1", 10),
1888
+ renderHTML: (n) => n != null && n.indent ? { style: `padding-left: ${n.indent * 20}px` } : {}
1889
+ }
1890
+ }
1891
+ }
1892
+ ];
1893
+ },
1894
+ addCommands() {
1895
+ return {
1896
+ _handleEnterKeyDown: () => (n) => {
1897
+ var u;
1898
+ const { tr: e, state: t, dispatch: r } = n, { $from: i } = t.selection, s = i.node();
1899
+ if (!(((u = s == null ? void 0 : s.type) == null ? void 0 : u.name) === "paragraph" && s.attrs.indent)) return !1;
1900
+ const a = s.attrs.indent;
1901
+ return e.split(i.pos), e.setNodeAttribute(e.selection.$from.before(), "indent", a), e.scrollIntoView(), e.setMeta("addToHistory", !1), r == null || r(e), !0;
1902
+ },
1903
+ _handleSpaceKeyDown: () => () => !1,
1904
+ indent: () => (n) => un(
1905
+ [hn, pn, mn],
1906
+ n
1907
+ ),
1908
+ // WHY: `outdent` is used by Backspace. It only reduces indent when the cursor
1909
+ // is at the very start of the node, preventing accidental outdenting mid-sentence.
1910
+ outdent: () => (n) => {
1911
+ const { state: e, view: t, tr: r, dispatch: i } = n, { $from: s, $to: l, empty: a } = e.selection, u = {
1912
+ editor: n.editor,
1913
+ state: e,
1914
+ view: t,
1915
+ $from: s,
1916
+ $to: l,
1917
+ selectionIsEmpty: a,
1918
+ currentNode: s.node()
1919
+ };
1920
+ if (It(u)) return !0;
1921
+ const f = s.node();
1922
+ if (!(_(f.type.name) && f.attrs.indent > 0) || !(s.pos === s.start())) return !1;
1923
+ const y = Math.max(0, f.attrs.indent - 1);
1924
+ return r.setNodeAttribute(s.before(s.depth), "indent", y), r.setMeta("addToHistory", !1), i == null || i(r), !0;
1925
+ },
1926
+ // WHY: `outdentShiftTab` is used by Shift+Tab. Unlike `outdent`, it reduces indent
1927
+ // regardless of where the cursor is — Shift+Tab is an explicit intent to un-indent.
1928
+ outdentShiftTab: () => (n) => {
1929
+ const { state: e, tr: t, dispatch: r } = n, { $from: i } = e.selection, s = i.node();
1930
+ if (!(_(s.type.name) && s.attrs.indent > 0)) return !1;
1931
+ const a = Math.max(0, s.attrs.indent - 1);
1932
+ return t.setNodeAttribute(i.before(i.depth), "indent", a), t.setMeta("addToHistory", !1), r == null || r(t), !0;
1933
+ },
1934
+ increaseIndent: () => ({ commands: n }) => n.indent(),
1935
+ decreaseIndent: () => (n) => {
1936
+ const { state: e, view: t } = n, { $from: r, $to: i, empty: s } = e.selection, l = {
1937
+ editor: n.editor,
1938
+ state: e,
1939
+ view: t,
1940
+ $from: r,
1941
+ $to: i,
1942
+ selectionIsEmpty: s,
1943
+ currentNode: r.node()
1944
+ };
1945
+ return It(l) ? !0 : n.chain().outdentShiftTab().run();
1946
+ }
1947
+ };
1948
+ }
1949
+ });
1950
+ var Tn = Nt, En = At, kn = Ct;
1951
+ const Rn = Tn.extend({
1952
+ addAttributes() {
1953
+ var n;
1954
+ return {
1955
+ ...(n = this.parent) == null ? void 0 : n.call(this),
1956
+ indent: {
1957
+ default: 0,
1958
+ // Backward compatibility (FR-030)
1959
+ parseHTML: (e) => parseInt(e.getAttribute("data-indent") || "0", 10),
1960
+ renderHTML: (e) => e.indent ? { "data-indent": e.indent } : {}
1961
+ }
1962
+ };
1963
+ },
1964
+ addNodeView() {
1965
+ return ({ node: n }) => {
1966
+ const e = n.attrs.indent || 0, t = document.createElement("ul");
1967
+ return t.setAttribute("data-indent", String(e)), e > 0 && (t.style.paddingLeft = `${e * 20}px`), { dom: t, contentDOM: t };
1968
+ };
1969
+ }
1970
+ }), On = kn.extend({
1971
+ addAttributes() {
1972
+ var n;
1973
+ return {
1974
+ ...(n = this.parent) == null ? void 0 : n.call(this),
1975
+ indent: {
1976
+ default: 0,
1977
+ // Backward compatibility (FR-030)
1978
+ parseHTML: (e) => parseInt(e.getAttribute("data-indent") || "0", 10),
1979
+ renderHTML: (e) => e.indent ? { "data-indent": e.indent } : {}
1980
+ }
1981
+ };
1982
+ },
1983
+ addNodeView() {
1984
+ return ({ node: n }) => {
1985
+ const e = n.attrs.indent || 0, t = document.createElement("ol");
1986
+ return t.setAttribute("data-indent", String(e)), e > 0 && (t.style.paddingLeft = `${e * 20}px`), { dom: t, contentDOM: t };
1987
+ };
1988
+ }
1989
+ }), Qt = En.extend({
1990
+ addAttributes() {
1991
+ var n;
1992
+ return {
1993
+ ...(n = this.parent) == null ? void 0 : n.call(this),
1994
+ class: {
1995
+ default: null,
1996
+ parseHTML: (e) => e.getAttribute("class"),
1997
+ renderHTML: (e) => e.class ? { class: e.class, ...e } : {}
1998
+ },
1999
+ indent: {
2000
+ default: 0,
2001
+ // Backward compatibility (FR-030)
2002
+ parseHTML: (e) => parseInt(e.getAttribute("data-indent") || "0", 10),
2003
+ renderHTML: (e) => e.indent ? { "data-indent": e.indent } : {}
2004
+ }
2005
+ };
2006
+ }
2007
+ }), er = fe.create({
2008
+ name: "dynamicBulletStyling",
2009
+ addProseMirrorPlugins() {
2010
+ return [
2011
+ new de({
2012
+ key: new ln("dynamicBulletStyling"),
2013
+ appendTransaction: (n, e, t) => {
2014
+ const r = t.tr;
2015
+ let i = !1;
2016
+ return t.doc.descendants((s, l) => {
2017
+ if (s.type.name === "listItem") {
2018
+ let a = 0;
2019
+ const u = t.doc.resolve(l);
2020
+ for (let f = u.depth; f > 0; f--)
2021
+ if (u.node(f).type.name === "bulletList") {
2022
+ a = 1;
2023
+ break;
2024
+ }
2025
+ a > 0 && (r.setNodeAttribute(u.pos, "[data-style]", "line-height: inherit"), i = !0);
2026
+ }
2027
+ }), i ? r : null;
2028
+ }
2029
+ })
2030
+ ];
2031
+ }
2032
+ }), Nn = (n) => n === "bulletList" || n === "orderedList", An = (n) => n === "paragraph" || n === "heading", Cn = fe.create({
2033
+ name: "listIndentIntegration",
2034
+ addProseMirrorPlugins() {
2035
+ return [
2036
+ // Indent attribute transfer plugin
2037
+ new de({
2038
+ appendTransaction: (n, e, t) => {
2039
+ if (!n.find((i) => i.docChanged))
2040
+ return null;
2041
+ let r = null;
2042
+ return t.doc.descendants((i, s) => {
2043
+ var l;
2044
+ if (An(i.type.name) && (((l = i == null ? void 0 : i.attrs) == null ? void 0 : l.indent) ?? 0) > 0) {
2045
+ const a = t.doc.resolve(s);
2046
+ if (a.parent.type.name === "listItem") {
2047
+ let f = null;
2048
+ for (let d = a.depth - 1; d > 0; d--) {
2049
+ const p = a.node(d);
2050
+ if (Nn(p.type.name)) {
2051
+ f = a.start(d) - 1;
2052
+ break;
2053
+ }
2054
+ }
2055
+ if (f !== null && f >= 0) {
2056
+ r || (r = t.tr);
2057
+ const d = i.attrs.indent;
2058
+ r.setNodeAttribute(s, "indent", 0), r.setNodeAttribute(f, "indent", d);
2059
+ }
2060
+ }
2061
+ }
2062
+ }), r;
2063
+ }
2064
+ }),
2065
+ // T088, T089, T090: Paste transformation plugin
2066
+ new de({
2067
+ props: {
2068
+ transformPastedHTML(n) {
2069
+ const e = /<p[^>]*style="[^"]*(?:padding|margin)-left:\s*(\d+)(?:px|pt|em)[^"]*"[^>]*>/gi;
2070
+ n = n.replace(e, (i, s) => `<p data-indent="${Math.floor(parseInt(s, 10) / 40)}">`);
2071
+ const t = /<ol[^>]*style="[^"]*list-style-type:\s*(upper-roman|lower-roman|upper-alpha|lower-alpha)[^"]*"[^>]*>/gi;
2072
+ n = n.replace(t, () => "<ol>");
2073
+ const r = /<li[^>]*style="[^"]*list-style-type:\s*[^;"\s]+[^"]*"[^>]*>/gi;
2074
+ return n = n.replace(r, (i) => i.replace(/list-style-type:\s*[^;"\s]+;?/gi, "")), n;
2075
+ }
2076
+ }
2077
+ })
2078
+ ];
2079
+ }
2080
+ }), tr = fe.create({
2081
+ name: "fontSize",
2082
+ addOptions() {
2083
+ return {
2084
+ types: ["textStyle"],
2085
+ getStyle: (n) => `font-size: ${n}`
2086
+ };
2087
+ },
2088
+ addGlobalAttributes() {
2089
+ return [
2090
+ {
2091
+ types: this.options.types,
2092
+ attributes: {
2093
+ fontSize: {
2094
+ default: null,
2095
+ parseHTML: (n) => n.style.fontSize.replace(/['"]+/g, ""),
2096
+ renderHTML: (n) => n.fontSize ? {
2097
+ style: this.options.getStyle(n.fontSize)
2098
+ } : {}
2099
+ }
2100
+ }
2101
+ }
2102
+ ];
2103
+ },
2104
+ addCommands() {
2105
+ return {
2106
+ setFontSize: (n) => ({ chain: e }) => e().setMark("textStyle", { fontSize: n }).run(),
2107
+ unsetFontSize: () => ({ chain: n }) => n().setMark("textStyle", { fontSize: null }).removeEmptyTextStyle().run()
2108
+ };
2109
+ }
2110
+ }), rr = fe.create({
2111
+ name: "lineHeight",
2112
+ addOptions() {
2113
+ return {
2114
+ types: ["textStyle"],
2115
+ getStyle: (n) => `line-height: ${n};`
2116
+ };
2117
+ },
2118
+ addGlobalAttributes() {
2119
+ return [
2120
+ {
2121
+ types: this.options.types,
2122
+ attributes: {
2123
+ lineHeight: {
2124
+ default: null,
2125
+ parseHTML: (n) => n.style.lineHeight.replace(/['"]+/g, ""),
2126
+ renderHTML: (n) => n.lineHeight ? {
2127
+ style: this.options.getStyle(n.lineHeight)
2128
+ } : {}
2129
+ }
2130
+ }
2131
+ }
2132
+ ];
2133
+ },
2134
+ addCommands() {
2135
+ return {
2136
+ setLineHeight: (n) => ({ chain: e }) => e().setMark("textStyle", { lineHeight: n }).run(),
2137
+ unsetLineHeight: () => ({ chain: n }) => n().setMark("textStyle", { lineHeight: null }).removeEmptyTextStyle().run()
2138
+ };
2139
+ }
2140
+ }), ai = [
2141
+ Tt,
2142
+ Kr,
2143
+ Et,
2144
+ kt,
2145
+ _r,
2146
+ Jr,
2147
+ Fr,
2148
+ Hr,
2149
+ Br,
2150
+ At,
2151
+ $r,
2152
+ qr,
2153
+ Ct,
2154
+ Gr,
2155
+ Vr,
2156
+ Wr,
2157
+ Ur,
2158
+ Yr,
2159
+ Lt,
2160
+ jr,
2161
+ Dt,
2162
+ zt,
2163
+ _t,
2164
+ // Missing from BASE_EXTENSIONS
2165
+ Mt,
2166
+ Pt,
2167
+ Ot,
2168
+ // Gapcursor,
2169
+ Rt,
2170
+ Jt,
2171
+ Qt,
2172
+ tr,
2173
+ rr,
2174
+ Nt,
2175
+ er
2176
+ ], li = [
2177
+ en,
2178
+ // CONVENTION - Replaces Paragraph with selectable indent spacing (T006-T007)
2179
+ zt,
2180
+ Et,
2181
+ Jt.configure({
2182
+ // T012, T091: Pause-based undo/redo granularity (FR-032, FR-033)
2183
+ // Verified: Rapid Tab presses within 500ms are grouped as single undo unit
2184
+ // This matches Google Docs behavior (spec requirement)
2185
+ newGroupDelay: 500,
2186
+ // Group operations within 500ms window
2187
+ depth: 100
2188
+ // Max undo stack depth
2189
+ }),
2190
+ // COMMENTED OUT TEMPORARILY THE GAPCURSOR FIRST BECAUSE WE DON'T NEED VISUAL EFFECT FROM GAPCUROSR AND WE DO CUSTOM IMAGES CURSOR ANYWAY. UNCOMMENT IT IF NEEDED LATER.
2191
+ // Gapcursor,
2192
+ Rt,
2193
+ _t,
2194
+ Tt,
2195
+ Ot,
2196
+ Lt,
2197
+ Qt,
2198
+ // T011: ListItem with indent attribute
2199
+ kt,
2200
+ Pt,
2201
+ tr,
2202
+ rr,
2203
+ Rn,
2204
+ // T009: BulletList with indent attribute
2205
+ // No custom keymap, just dynamic styling
2206
+ er,
2207
+ Cn,
2208
+ // T029: Indent attribute transfer (FR-020, FR-021, FR-023)
2209
+ Dt.configure({
2210
+ types: ["heading", "paragraph"]
2211
+ }),
2212
+ On.configure({
2213
+ // T010: OrderedList with indent attribute
2214
+ itemTypeName: "listItem",
2215
+ keepMarks: !0,
2216
+ keepAttributes: !0
2217
+ }),
2218
+ // Must be last to have highest keyboard shortcut priority
2219
+ bn
2220
+ ], ui = fe.create({
2221
+ name: "MentionStorage",
2222
+ addStorage() {
2223
+ return {
2224
+ suggestions: []
2225
+ };
2226
+ }
2227
+ });
2228
+ var Z = {}, wt;
2229
+ function Ln() {
2230
+ if (wt) return Z;
2231
+ wt = 1;
2232
+ var n = Qr;
2233
+ if (process.env.NODE_ENV === "production")
2234
+ Z.createRoot = n.createRoot, Z.hydrateRoot = n.hydrateRoot;
2235
+ else {
2236
+ var e = n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
2237
+ Z.createRoot = function(t, r) {
2238
+ e.usingClientEntryPoint = !0;
2239
+ try {
2240
+ return n.createRoot(t, r);
2241
+ } finally {
2242
+ e.usingClientEntryPoint = !1;
2243
+ }
2244
+ }, Z.hydrateRoot = function(t, r, i) {
2245
+ e.usingClientEntryPoint = !0;
2246
+ try {
2247
+ return n.hydrateRoot(t, r, i);
2248
+ } finally {
2249
+ e.usingClientEntryPoint = !1;
2250
+ }
2251
+ };
2252
+ }
2253
+ return Z;
2254
+ }
2255
+ var Mn = Ln(), Ie = { exports: {} }, ie = {};
2256
+ /**
2257
+ * @license React
2258
+ * react-jsx-runtime.production.min.js
2259
+ *
2260
+ * Copyright (c) Facebook, Inc. and its affiliates.
2261
+ *
2262
+ * This source code is licensed under the MIT license found in the
2263
+ * LICENSE file in the root directory of this source tree.
2264
+ */
2265
+ var xt;
2266
+ function Pn() {
2267
+ if (xt) return ie;
2268
+ xt = 1;
2269
+ var n = Ft, e = Symbol.for("react.element"), t = Symbol.for("react.fragment"), r = Object.prototype.hasOwnProperty, i = n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, s = { key: !0, ref: !0, __self: !0, __source: !0 };
2270
+ function l(a, u, f) {
2271
+ var d, p = {}, y = null, w = null;
2272
+ f !== void 0 && (y = "" + f), u.key !== void 0 && (y = "" + u.key), u.ref !== void 0 && (w = u.ref);
2273
+ for (d in u) r.call(u, d) && !s.hasOwnProperty(d) && (p[d] = u[d]);
2274
+ if (a && a.defaultProps) for (d in u = a.defaultProps, u) p[d] === void 0 && (p[d] = u[d]);
2275
+ return { $$typeof: e, type: a, key: y, ref: w, props: p, _owner: i.current };
2276
+ }
2277
+ return ie.Fragment = t, ie.jsx = l, ie.jsxs = l, ie;
2278
+ }
2279
+ var se = {};
2280
+ /**
2281
+ * @license React
2282
+ * react-jsx-runtime.development.js
2283
+ *
2284
+ * Copyright (c) Facebook, Inc. and its affiliates.
2285
+ *
2286
+ * This source code is licensed under the MIT license found in the
2287
+ * LICENSE file in the root directory of this source tree.
2288
+ */
2289
+ var St;
2290
+ function Dn() {
2291
+ return St || (St = 1, process.env.NODE_ENV !== "production" && (function() {
2292
+ var n = Ft, e = Symbol.for("react.element"), t = Symbol.for("react.portal"), r = Symbol.for("react.fragment"), i = Symbol.for("react.strict_mode"), s = Symbol.for("react.profiler"), l = Symbol.for("react.provider"), a = Symbol.for("react.context"), u = Symbol.for("react.forward_ref"), f = Symbol.for("react.suspense"), d = Symbol.for("react.suspense_list"), p = Symbol.for("react.memo"), y = Symbol.for("react.lazy"), w = Symbol.for("react.offscreen"), m = Symbol.iterator, S = "@@iterator";
2293
+ function C(o) {
2294
+ if (o === null || typeof o != "object")
2295
+ return null;
2296
+ var c = m && o[m] || o[S];
2297
+ return typeof c == "function" ? c : null;
2298
+ }
2299
+ var A = n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
2300
+ function E(o) {
2301
+ {
2302
+ for (var c = arguments.length, h = new Array(c > 1 ? c - 1 : 0), g = 1; g < c; g++)
2303
+ h[g - 1] = arguments[g];
2304
+ te("error", o, h);
2305
+ }
2306
+ }
2307
+ function te(o, c, h) {
2308
+ {
2309
+ var g = A.ReactDebugCurrentFrame, x = g.getStackAddendum();
2310
+ x !== "" && (c += "%s", h = h.concat([x]));
2311
+ var b = h.map(function(I) {
2312
+ return String(I);
2313
+ });
2314
+ b.unshift("Warning: " + c), Function.prototype.apply.call(console[o], console, b);
2315
+ }
2316
+ }
2317
+ var nr = !1, ir = !1, sr = !1, or = !1, ar = !1, $e;
2318
+ $e = Symbol.for("react.module.reference");
2319
+ function lr(o) {
2320
+ return !!(typeof o == "string" || typeof o == "function" || o === r || o === s || ar || o === i || o === f || o === d || or || o === w || nr || ir || sr || typeof o == "object" && o !== null && (o.$$typeof === y || o.$$typeof === p || o.$$typeof === l || o.$$typeof === a || o.$$typeof === u || // This needs to include all possible module reference object
2321
+ // types supported by any Flight configuration anywhere since
2322
+ // we don't know which Flight build this will end up being used
2323
+ // with.
2324
+ o.$$typeof === $e || o.getModuleId !== void 0));
2325
+ }
2326
+ function ur(o, c, h) {
2327
+ var g = o.displayName;
2328
+ if (g)
2329
+ return g;
2330
+ var x = c.displayName || c.name || "";
2331
+ return x !== "" ? h + "(" + x + ")" : h;
2332
+ }
2333
+ function je(o) {
2334
+ return o.displayName || "Context";
2335
+ }
2336
+ function q(o) {
2337
+ if (o == null)
2338
+ return null;
2339
+ if (typeof o.tag == "number" && E("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof o == "function")
2340
+ return o.displayName || o.name || null;
2341
+ if (typeof o == "string")
2342
+ return o;
2343
+ switch (o) {
2344
+ case r:
2345
+ return "Fragment";
2346
+ case t:
2347
+ return "Portal";
2348
+ case s:
2349
+ return "Profiler";
2350
+ case i:
2351
+ return "StrictMode";
2352
+ case f:
2353
+ return "Suspense";
2354
+ case d:
2355
+ return "SuspenseList";
2356
+ }
2357
+ if (typeof o == "object")
2358
+ switch (o.$$typeof) {
2359
+ case a:
2360
+ var c = o;
2361
+ return je(c) + ".Consumer";
2362
+ case l:
2363
+ var h = o;
2364
+ return je(h._context) + ".Provider";
2365
+ case u:
2366
+ return ur(o, o.render, "ForwardRef");
2367
+ case p:
2368
+ var g = o.displayName || null;
2369
+ return g !== null ? g : q(o.type) || "Memo";
2370
+ case y: {
2371
+ var x = o, b = x._payload, I = x._init;
2372
+ try {
2373
+ return q(I(b));
2374
+ } catch {
2375
+ return null;
2376
+ }
2377
+ }
2378
+ }
2379
+ return null;
2380
+ }
2381
+ var V = Object.assign, re = 0, qe, Ve, We, Ue, Ye, Ke, Ge;
2382
+ function Xe() {
2383
+ }
2384
+ Xe.__reactDisabledLog = !0;
2385
+ function cr() {
2386
+ {
2387
+ if (re === 0) {
2388
+ qe = console.log, Ve = console.info, We = console.warn, Ue = console.error, Ye = console.group, Ke = console.groupCollapsed, Ge = console.groupEnd;
2389
+ var o = {
2390
+ configurable: !0,
2391
+ enumerable: !0,
2392
+ value: Xe,
2393
+ writable: !0
2394
+ };
2395
+ Object.defineProperties(console, {
2396
+ info: o,
2397
+ log: o,
2398
+ warn: o,
2399
+ error: o,
2400
+ group: o,
2401
+ groupCollapsed: o,
2402
+ groupEnd: o
2403
+ });
2404
+ }
2405
+ re++;
2406
+ }
2407
+ }
2408
+ function dr() {
2409
+ {
2410
+ if (re--, re === 0) {
2411
+ var o = {
2412
+ configurable: !0,
2413
+ enumerable: !0,
2414
+ writable: !0
2415
+ };
2416
+ Object.defineProperties(console, {
2417
+ log: V({}, o, {
2418
+ value: qe
2419
+ }),
2420
+ info: V({}, o, {
2421
+ value: Ve
2422
+ }),
2423
+ warn: V({}, o, {
2424
+ value: We
2425
+ }),
2426
+ error: V({}, o, {
2427
+ value: Ue
2428
+ }),
2429
+ group: V({}, o, {
2430
+ value: Ye
2431
+ }),
2432
+ groupCollapsed: V({}, o, {
2433
+ value: Ke
2434
+ }),
2435
+ groupEnd: V({}, o, {
2436
+ value: Ge
2437
+ })
2438
+ });
2439
+ }
2440
+ re < 0 && E("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
2441
+ }
2442
+ }
2443
+ var Te = A.ReactCurrentDispatcher, Ee;
2444
+ function he(o, c, h) {
2445
+ {
2446
+ if (Ee === void 0)
2447
+ try {
2448
+ throw Error();
2449
+ } catch (x) {
2450
+ var g = x.stack.trim().match(/\n( *(at )?)/);
2451
+ Ee = g && g[1] || "";
2452
+ }
2453
+ return `
2454
+ ` + Ee + o;
2455
+ }
2456
+ }
2457
+ var ke = !1, pe;
2458
+ {
2459
+ var fr = typeof WeakMap == "function" ? WeakMap : Map;
2460
+ pe = new fr();
2461
+ }
2462
+ function Ze(o, c) {
2463
+ if (!o || ke)
2464
+ return "";
2465
+ {
2466
+ var h = pe.get(o);
2467
+ if (h !== void 0)
2468
+ return h;
2469
+ }
2470
+ var g;
2471
+ ke = !0;
2472
+ var x = Error.prepareStackTrace;
2473
+ Error.prepareStackTrace = void 0;
2474
+ var b;
2475
+ b = Te.current, Te.current = null, cr();
2476
+ try {
2477
+ if (c) {
2478
+ var I = function() {
2479
+ throw Error();
2480
+ };
2481
+ if (Object.defineProperty(I.prototype, "props", {
2482
+ set: function() {
2483
+ throw Error();
2484
+ }
2485
+ }), typeof Reflect == "object" && Reflect.construct) {
2486
+ try {
2487
+ Reflect.construct(I, []);
2488
+ } catch (J) {
2489
+ g = J;
2490
+ }
2491
+ Reflect.construct(o, [], I);
2492
+ } else {
2493
+ try {
2494
+ I.call();
2495
+ } catch (J) {
2496
+ g = J;
2497
+ }
2498
+ o.call(I.prototype);
2499
+ }
2500
+ } else {
2501
+ try {
2502
+ throw Error();
2503
+ } catch (J) {
2504
+ g = J;
2505
+ }
2506
+ o();
2507
+ }
2508
+ } catch (J) {
2509
+ if (J && g && typeof J.stack == "string") {
2510
+ for (var v = J.stack.split(`
2511
+ `), P = g.stack.split(`
2512
+ `), R = v.length - 1, O = P.length - 1; R >= 1 && O >= 0 && v[R] !== P[O]; )
2513
+ O--;
2514
+ for (; R >= 1 && O >= 0; R--, O--)
2515
+ if (v[R] !== P[O]) {
2516
+ if (R !== 1 || O !== 1)
2517
+ do
2518
+ if (R--, O--, O < 0 || v[R] !== P[O]) {
2519
+ var H = `
2520
+ ` + v[R].replace(" at new ", " at ");
2521
+ return o.displayName && H.includes("<anonymous>") && (H = H.replace("<anonymous>", o.displayName)), typeof o == "function" && pe.set(o, H), H;
2522
+ }
2523
+ while (R >= 1 && O >= 0);
2524
+ break;
2525
+ }
2526
+ }
2527
+ } finally {
2528
+ ke = !1, Te.current = b, dr(), Error.prepareStackTrace = x;
2529
+ }
2530
+ var X = o ? o.displayName || o.name : "", W = X ? he(X) : "";
2531
+ return typeof o == "function" && pe.set(o, W), W;
2532
+ }
2533
+ function hr(o, c, h) {
2534
+ return Ze(o, !1);
2535
+ }
2536
+ function pr(o) {
2537
+ var c = o.prototype;
2538
+ return !!(c && c.isReactComponent);
2539
+ }
2540
+ function me(o, c, h) {
2541
+ if (o == null)
2542
+ return "";
2543
+ if (typeof o == "function")
2544
+ return Ze(o, pr(o));
2545
+ if (typeof o == "string")
2546
+ return he(o);
2547
+ switch (o) {
2548
+ case f:
2549
+ return he("Suspense");
2550
+ case d:
2551
+ return he("SuspenseList");
2552
+ }
2553
+ if (typeof o == "object")
2554
+ switch (o.$$typeof) {
2555
+ case u:
2556
+ return hr(o.render);
2557
+ case p:
2558
+ return me(o.type, c, h);
2559
+ case y: {
2560
+ var g = o, x = g._payload, b = g._init;
2561
+ try {
2562
+ return me(b(x), c, h);
2563
+ } catch {
2564
+ }
2565
+ }
2566
+ }
2567
+ return "";
2568
+ }
2569
+ var ne = Object.prototype.hasOwnProperty, Qe = {}, et = A.ReactDebugCurrentFrame;
2570
+ function ge(o) {
2571
+ if (o) {
2572
+ var c = o._owner, h = me(o.type, o._source, c ? c.type : null);
2573
+ et.setExtraStackFrame(h);
2574
+ } else
2575
+ et.setExtraStackFrame(null);
2576
+ }
2577
+ function mr(o, c, h, g, x) {
2578
+ {
2579
+ var b = Function.call.bind(ne);
2580
+ for (var I in o)
2581
+ if (b(o, I)) {
2582
+ var v = void 0;
2583
+ try {
2584
+ if (typeof o[I] != "function") {
2585
+ var P = Error((g || "React class") + ": " + h + " type `" + I + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof o[I] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
2586
+ throw P.name = "Invariant Violation", P;
2587
+ }
2588
+ v = o[I](c, I, g, h, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
2589
+ } catch (R) {
2590
+ v = R;
2591
+ }
2592
+ v && !(v instanceof Error) && (ge(x), E("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", g || "React class", h, I, typeof v), ge(null)), v instanceof Error && !(v.message in Qe) && (Qe[v.message] = !0, ge(x), E("Failed %s type: %s", h, v.message), ge(null));
2593
+ }
2594
+ }
2595
+ }
2596
+ var gr = Array.isArray;
2597
+ function Re(o) {
2598
+ return gr(o);
2599
+ }
2600
+ function yr(o) {
2601
+ {
2602
+ var c = typeof Symbol == "function" && Symbol.toStringTag, h = c && o[Symbol.toStringTag] || o.constructor.name || "Object";
2603
+ return h;
2604
+ }
2605
+ }
2606
+ function vr(o) {
2607
+ try {
2608
+ return tt(o), !1;
2609
+ } catch {
2610
+ return !0;
2611
+ }
2612
+ }
2613
+ function tt(o) {
2614
+ return "" + o;
2615
+ }
2616
+ function rt(o) {
2617
+ if (vr(o))
2618
+ return E("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", yr(o)), tt(o);
2619
+ }
2620
+ var nt = A.ReactCurrentOwner, Ir = {
2621
+ key: !0,
2622
+ ref: !0,
2623
+ __self: !0,
2624
+ __source: !0
2625
+ }, it, st;
2626
+ function wr(o) {
2627
+ if (ne.call(o, "ref")) {
2628
+ var c = Object.getOwnPropertyDescriptor(o, "ref").get;
2629
+ if (c && c.isReactWarning)
2630
+ return !1;
2631
+ }
2632
+ return o.ref !== void 0;
2633
+ }
2634
+ function xr(o) {
2635
+ if (ne.call(o, "key")) {
2636
+ var c = Object.getOwnPropertyDescriptor(o, "key").get;
2637
+ if (c && c.isReactWarning)
2638
+ return !1;
2639
+ }
2640
+ return o.key !== void 0;
2641
+ }
2642
+ function Sr(o, c) {
2643
+ typeof o.ref == "string" && nt.current;
2644
+ }
2645
+ function br(o, c) {
2646
+ {
2647
+ var h = function() {
2648
+ it || (it = !0, E("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", c));
2649
+ };
2650
+ h.isReactWarning = !0, Object.defineProperty(o, "key", {
2651
+ get: h,
2652
+ configurable: !0
2653
+ });
2654
+ }
2655
+ }
2656
+ function Tr(o, c) {
2657
+ {
2658
+ var h = function() {
2659
+ st || (st = !0, E("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", c));
2660
+ };
2661
+ h.isReactWarning = !0, Object.defineProperty(o, "ref", {
2662
+ get: h,
2663
+ configurable: !0
2664
+ });
2665
+ }
2666
+ }
2667
+ var Er = function(o, c, h, g, x, b, I) {
2668
+ var v = {
2669
+ // This tag allows us to uniquely identify this as a React Element
2670
+ $$typeof: e,
2671
+ // Built-in properties that belong on the element
2672
+ type: o,
2673
+ key: c,
2674
+ ref: h,
2675
+ props: I,
2676
+ // Record the component responsible for creating this element.
2677
+ _owner: b
2678
+ };
2679
+ return v._store = {}, Object.defineProperty(v._store, "validated", {
2680
+ configurable: !1,
2681
+ enumerable: !1,
2682
+ writable: !0,
2683
+ value: !1
2684
+ }), Object.defineProperty(v, "_self", {
2685
+ configurable: !1,
2686
+ enumerable: !1,
2687
+ writable: !1,
2688
+ value: g
2689
+ }), Object.defineProperty(v, "_source", {
2690
+ configurable: !1,
2691
+ enumerable: !1,
2692
+ writable: !1,
2693
+ value: x
2694
+ }), Object.freeze && (Object.freeze(v.props), Object.freeze(v)), v;
2695
+ };
2696
+ function kr(o, c, h, g, x) {
2697
+ {
2698
+ var b, I = {}, v = null, P = null;
2699
+ h !== void 0 && (rt(h), v = "" + h), xr(c) && (rt(c.key), v = "" + c.key), wr(c) && (P = c.ref, Sr(c, x));
2700
+ for (b in c)
2701
+ ne.call(c, b) && !Ir.hasOwnProperty(b) && (I[b] = c[b]);
2702
+ if (o && o.defaultProps) {
2703
+ var R = o.defaultProps;
2704
+ for (b in R)
2705
+ I[b] === void 0 && (I[b] = R[b]);
2706
+ }
2707
+ if (v || P) {
2708
+ var O = typeof o == "function" ? o.displayName || o.name || "Unknown" : o;
2709
+ v && br(I, O), P && Tr(I, O);
2710
+ }
2711
+ return Er(o, v, P, x, g, nt.current, I);
2712
+ }
2713
+ }
2714
+ var Oe = A.ReactCurrentOwner, ot = A.ReactDebugCurrentFrame;
2715
+ function G(o) {
2716
+ if (o) {
2717
+ var c = o._owner, h = me(o.type, o._source, c ? c.type : null);
2718
+ ot.setExtraStackFrame(h);
2719
+ } else
2720
+ ot.setExtraStackFrame(null);
2721
+ }
2722
+ var Ne;
2723
+ Ne = !1;
2724
+ function Ae(o) {
2725
+ return typeof o == "object" && o !== null && o.$$typeof === e;
2726
+ }
2727
+ function at() {
2728
+ {
2729
+ if (Oe.current) {
2730
+ var o = q(Oe.current.type);
2731
+ if (o)
2732
+ return `
2733
+
2734
+ Check the render method of \`` + o + "`.";
2735
+ }
2736
+ return "";
2737
+ }
2738
+ }
2739
+ function Rr(o) {
2740
+ return "";
2741
+ }
2742
+ var lt = {};
2743
+ function Or(o) {
2744
+ {
2745
+ var c = at();
2746
+ if (!c) {
2747
+ var h = typeof o == "string" ? o : o.displayName || o.name;
2748
+ h && (c = `
2749
+
2750
+ Check the top-level render call using <` + h + ">.");
2751
+ }
2752
+ return c;
2753
+ }
2754
+ }
2755
+ function ut(o, c) {
2756
+ {
2757
+ if (!o._store || o._store.validated || o.key != null)
2758
+ return;
2759
+ o._store.validated = !0;
2760
+ var h = Or(c);
2761
+ if (lt[h])
2762
+ return;
2763
+ lt[h] = !0;
2764
+ var g = "";
2765
+ o && o._owner && o._owner !== Oe.current && (g = " It was passed a child from " + q(o._owner.type) + "."), G(o), E('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', h, g), G(null);
2766
+ }
2767
+ }
2768
+ function ct(o, c) {
2769
+ {
2770
+ if (typeof o != "object")
2771
+ return;
2772
+ if (Re(o))
2773
+ for (var h = 0; h < o.length; h++) {
2774
+ var g = o[h];
2775
+ Ae(g) && ut(g, c);
2776
+ }
2777
+ else if (Ae(o))
2778
+ o._store && (o._store.validated = !0);
2779
+ else if (o) {
2780
+ var x = C(o);
2781
+ if (typeof x == "function" && x !== o.entries)
2782
+ for (var b = x.call(o), I; !(I = b.next()).done; )
2783
+ Ae(I.value) && ut(I.value, c);
2784
+ }
2785
+ }
2786
+ }
2787
+ function Nr(o) {
2788
+ {
2789
+ var c = o.type;
2790
+ if (c == null || typeof c == "string")
2791
+ return;
2792
+ var h;
2793
+ if (typeof c == "function")
2794
+ h = c.propTypes;
2795
+ else if (typeof c == "object" && (c.$$typeof === u || // Note: Memo only checks outer props here.
2796
+ // Inner props are checked in the reconciler.
2797
+ c.$$typeof === p))
2798
+ h = c.propTypes;
2799
+ else
2800
+ return;
2801
+ if (h) {
2802
+ var g = q(c);
2803
+ mr(h, o.props, "prop", g, o);
2804
+ } else if (c.PropTypes !== void 0 && !Ne) {
2805
+ Ne = !0;
2806
+ var x = q(c);
2807
+ E("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", x || "Unknown");
2808
+ }
2809
+ typeof c.getDefaultProps == "function" && !c.getDefaultProps.isReactClassApproved && E("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
2810
+ }
2811
+ }
2812
+ function Ar(o) {
2813
+ {
2814
+ for (var c = Object.keys(o.props), h = 0; h < c.length; h++) {
2815
+ var g = c[h];
2816
+ if (g !== "children" && g !== "key") {
2817
+ G(o), E("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", g), G(null);
2818
+ break;
2819
+ }
2820
+ }
2821
+ o.ref !== null && (G(o), E("Invalid attribute `ref` supplied to `React.Fragment`."), G(null));
2822
+ }
2823
+ }
2824
+ var dt = {};
2825
+ function ft(o, c, h, g, x, b) {
2826
+ {
2827
+ var I = lr(o);
2828
+ if (!I) {
2829
+ var v = "";
2830
+ (o === void 0 || typeof o == "object" && o !== null && Object.keys(o).length === 0) && (v += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
2831
+ var P = Rr();
2832
+ P ? v += P : v += at();
2833
+ var R;
2834
+ o === null ? R = "null" : Re(o) ? R = "array" : o !== void 0 && o.$$typeof === e ? (R = "<" + (q(o.type) || "Unknown") + " />", v = " Did you accidentally export a JSX literal instead of a component?") : R = typeof o, E("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", R, v);
2835
+ }
2836
+ var O = kr(o, c, h, x, b);
2837
+ if (O == null)
2838
+ return O;
2839
+ if (I) {
2840
+ var H = c.children;
2841
+ if (H !== void 0)
2842
+ if (g)
2843
+ if (Re(H)) {
2844
+ for (var X = 0; X < H.length; X++)
2845
+ ct(H[X], o);
2846
+ Object.freeze && Object.freeze(H);
2847
+ } else
2848
+ E("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
2849
+ else
2850
+ ct(H, o);
2851
+ }
2852
+ if (ne.call(c, "key")) {
2853
+ var W = q(o), J = Object.keys(c).filter(function(zr) {
2854
+ return zr !== "key";
2855
+ }), Ce = J.length > 0 ? "{key: someKey, " + J.join(": ..., ") + ": ...}" : "{key: someKey}";
2856
+ if (!dt[W + Ce]) {
2857
+ var Dr = J.length > 0 ? "{" + J.join(": ..., ") + ": ...}" : "{}";
2858
+ E(`A props object containing a "key" prop is being spread into JSX:
2859
+ let props = %s;
2860
+ <%s {...props} />
2861
+ React keys must be passed directly to JSX without using spread:
2862
+ let props = %s;
2863
+ <%s key={someKey} {...props} />`, Ce, W, Dr, W), dt[W + Ce] = !0;
2864
+ }
2865
+ }
2866
+ return o === r ? Ar(O) : Nr(O), O;
2867
+ }
2868
+ }
2869
+ function Cr(o, c, h) {
2870
+ return ft(o, c, h, !0);
2871
+ }
2872
+ function Lr(o, c, h) {
2873
+ return ft(o, c, h, !1);
2874
+ }
2875
+ var Mr = Lr, Pr = Cr;
2876
+ se.Fragment = r, se.jsx = Mr, se.jsxs = Pr;
2877
+ })()), se;
2878
+ }
2879
+ var bt;
2880
+ function zn() {
2881
+ return bt || (bt = 1, process.env.NODE_ENV === "production" ? Ie.exports = Pn() : Ie.exports = Dn()), Ie.exports;
2882
+ }
2883
+ var oe = zn();
2884
+ const _n = ({
2885
+ images: n,
2886
+ onAdd: e,
2887
+ onDelete: t,
2888
+ onImageClick: r,
2889
+ focusedImageIndex: i
2890
+ }) => /* @__PURE__ */ oe.jsxs("div", { className: "batch-image-gallery", style: { display: "flex", gap: "8px", overflowX: "auto", padding: "8px" }, children: [
2891
+ n.map((s, l) => /* @__PURE__ */ oe.jsxs(
2892
+ "div",
2893
+ {
2894
+ style: {
2895
+ position: "relative",
2896
+ border: i === l ? "2px solid blue" : "2px solid transparent",
2897
+ cursor: "pointer"
2898
+ },
2899
+ onClick: () => r(s),
2900
+ children: [
2901
+ /* @__PURE__ */ oe.jsx("img", { src: s.src, alt: s.alt, style: { width: "80px", height: "80px", objectFit: "cover" } }),
2902
+ /* @__PURE__ */ oe.jsx(
2903
+ "button",
2904
+ {
2905
+ onClick: (a) => {
2906
+ a.stopPropagation(), t(l);
2907
+ },
2908
+ style: { position: "absolute", top: 0, right: 0 },
2909
+ children: "×"
2910
+ }
2911
+ )
2912
+ ]
2913
+ },
2914
+ s.id
2915
+ )),
2916
+ /* @__PURE__ */ oe.jsx("button", { onClick: e, style: { width: "80px", height: "80px" }, children: "+" })
2917
+ ] });
2918
+ let ae = null;
2919
+ const ci = Zr.create({
2920
+ name: "batchSegmentImages",
2921
+ group: "block",
2922
+ inline: !1,
2923
+ atom: !0,
2924
+ addOptions() {
2925
+ return {
2926
+ maxImageAmount: void 0,
2927
+ height: void 0,
2928
+ onAdd: void 0,
2929
+ onRemove: void 0,
2930
+ onImageClick: void 0,
2931
+ initialImageRegistry: void 0
2932
+ };
2933
+ },
2934
+ // Create a storage registry for this extension storage
2935
+ addStorage() {
2936
+ return {
2937
+ imageRegistry: new Map(this.options.initialImageRegistry)
2938
+ };
2939
+ },
2940
+ addAttributes() {
2941
+ return {
2942
+ batchId: {
2943
+ default: null,
2944
+ parseHTML: (n) => n.getAttribute("data-batch-id"),
2945
+ renderHTML: (n) => ({ "data-batch-id": n.batchId })
2946
+ },
2947
+ id: {
2948
+ default: null,
2949
+ parseHTML: (n) => n.getAttribute("data-id"),
2950
+ renderHTML: (n) => ({
2951
+ "data-id": n.id
2952
+ })
2953
+ },
2954
+ images: {
2955
+ default: [],
2956
+ parseHTML: (n) => {
2957
+ const e = n.querySelectorAll("img"), t = [];
2958
+ return e.forEach((r) => {
2959
+ const i = r.getAttribute("data-id"), s = r.getAttribute("src"), l = r.getAttribute("alt"), a = r.getAttribute("title");
2960
+ i && s && t.push({
2961
+ id: i,
2962
+ src: s,
2963
+ alt: l ?? void 0,
2964
+ title: a ?? void 0
2965
+ });
2966
+ }), t;
2967
+ },
2968
+ renderHTML: () => ({})
2969
+ },
2970
+ imageVersion: {
2971
+ default: 0,
2972
+ parseHTML: () => 0,
2973
+ renderHTML: () => ({})
2974
+ },
2975
+ // Ephemeral UI state — not persisted in HTML
2976
+ focusedImageIndex: {
2977
+ default: null,
2978
+ parseHTML: () => null,
2979
+ renderHTML: () => ({})
2980
+ }
2981
+ };
2982
+ },
2983
+ addProseMirrorPlugins() {
2984
+ return [
2985
+ new de({
2986
+ props: {
2987
+ handleKeyDown(n, e) {
2988
+ return e.key === "ArrowLeft" || e.key === "ArrowUp" ? ae = "left" : e.key === "ArrowRight" || e.key === "ArrowDown" ? ae = "right" : ae = null, !1;
2989
+ }
2990
+ }
2991
+ })
2992
+ ];
2993
+ },
2994
+ addKeyboardShortcuts() {
2995
+ const n = (r, i) => {
2996
+ const s = this.editor.state.tr.setNodeMarkup(r, void 0, { ...i.attrs, focusedImageIndex: null }).setMeta("addToHistory", !1);
2997
+ s.setSelection(D.near(s.doc.resolve(r))), this.editor.view.dispatch(s);
2998
+ }, e = (r, i) => {
2999
+ const s = r + i.nodeSize, l = this.editor.state.tr.setNodeMarkup(r, void 0, { ...i.attrs, focusedImageIndex: null }).setMeta("addToHistory", !1);
3000
+ l.setSelection(D.near(l.doc.resolve(s))), this.editor.view.dispatch(l);
3001
+ }, t = (r) => {
3002
+ var p, y;
3003
+ const { selection: i } = this.editor.state;
3004
+ if (!(i instanceof z)) return !1;
3005
+ const s = i.node;
3006
+ if (s.type.name !== "batchSegmentImages") return !1;
3007
+ const l = ((y = (p = this.editor.storage.batchSegmentImages) == null ? void 0 : p.imageRegistry) == null ? void 0 : y.get(s.attrs.batchId)) ?? s.attrs.images;
3008
+ if (!l.length) return !1;
3009
+ const a = i.from, u = s.attrs.focusedImageIndex, f = !!this.options.onAdd;
3010
+ let d;
3011
+ if (r === "right") {
3012
+ if (u === null)
3013
+ return e(a, s), !0;
3014
+ if (u < l.length - 1)
3015
+ d = u + 1;
3016
+ else if (u === l.length - 1 && f)
3017
+ d = null;
3018
+ else
3019
+ return e(a, s), !0;
3020
+ } else if (u === null)
3021
+ d = l.length - 1;
3022
+ else if (u > 0)
3023
+ d = u - 1;
3024
+ else
3025
+ return n(a, s), !0;
3026
+ if (this.editor.view.dispatch(
3027
+ this.editor.state.tr.setNodeMarkup(a, void 0, { ...s.attrs, focusedImageIndex: d }).setMeta("addToHistory", !1)
3028
+ ), d !== null && d >= 0 && d < l.length) {
3029
+ const w = this.editor.view.nodeDOM(a);
3030
+ w instanceof HTMLElement && requestAnimationFrame(() => {
3031
+ var S;
3032
+ (S = w.querySelectorAll("img")[d]) == null || S.scrollIntoView({ block: "nearest", inline: "nearest" });
3033
+ });
3034
+ }
3035
+ return !0;
3036
+ };
3037
+ return {
3038
+ ArrowLeft: () => t("left"),
3039
+ ArrowRight: () => t("right"),
3040
+ Space: () => {
3041
+ var u, f, d, p, y, w;
3042
+ const { selection: r } = this.editor.state;
3043
+ if (!(r instanceof z)) return !1;
3044
+ const i = r.node;
3045
+ if (i.type.name !== "batchSegmentImages") return !1;
3046
+ const s = ((f = (u = this.editor.storage.batchSegmentImages) == null ? void 0 : u.imageRegistry) == null ? void 0 : f.get(i.attrs.batchId)) ?? i.attrs.images, l = i.attrs.focusedImageIndex, a = r.from;
3047
+ if (l === null)
3048
+ return (p = (d = this.options).onAdd) == null || p.call(d, {
3049
+ position: "last",
3050
+ batchId: i.attrs.batchId,
3051
+ currentImages: s,
3052
+ getPos: () => a,
3053
+ editor: this.editor
3054
+ }), !0;
3055
+ if (l >= 0 && l < s.length) {
3056
+ const m = s[l];
3057
+ return (w = (y = this.options).onImageClick) == null || w.call(y, {
3058
+ imageId: m.id,
3059
+ batchId: i.attrs.batchId,
3060
+ src: m.src,
3061
+ getPos: () => a,
3062
+ editor: this.editor
3063
+ }), !0;
3064
+ }
3065
+ return !1;
3066
+ }
3067
+ };
3068
+ },
3069
+ renderHTML({ node: n }) {
3070
+ const e = n.attrs.images ?? [];
3071
+ return [
3072
+ "div",
3073
+ {
3074
+ "data-batch-id": n.attrs.batchId,
3075
+ style: "display: flex; overflow-x: auto; gap: 10px; white-space: nowrap; padding: 10px 0;"
3076
+ },
3077
+ ...e.map(
3078
+ (t) => [
3079
+ "img",
3080
+ {
3081
+ "data-id": t.id,
3082
+ src: t.src,
3083
+ alt: t.alt ?? "",
3084
+ title: t.title ?? "",
3085
+ style: "width: 80px; height: 80px; object-fit: cover; flex-shrink: 0;"
3086
+ }
3087
+ ]
3088
+ )
3089
+ ];
3090
+ },
3091
+ addNodeView() {
3092
+ return ({ node: n, getPos: e, editor: t }) => {
3093
+ const r = this.options, i = this.storage, s = document.createElement("div");
3094
+ s.style.width = "100%", s.classList.add("batch-segment-gallery"), i.imageRegistry.has(n.attrs.batchId) || i.imageRegistry.set(n.attrs.batchId, n.attrs.images ?? []);
3095
+ const l = Mn.createRoot(s), a = { current: n };
3096
+ let u = null;
3097
+ const f = () => {
3098
+ var m;
3099
+ (m = r.onAdd) == null || m.call(r, {
3100
+ position: "last",
3101
+ batchId: a.current.attrs.batchId,
3102
+ currentImages: i.imageRegistry.get(a.current.attrs.batchId) ?? [],
3103
+ getPos: e,
3104
+ editor: t
3105
+ });
3106
+ }, d = (m) => {
3107
+ var S, C;
3108
+ (C = r.onRemove) == null || C.call(r, {
3109
+ index: m,
3110
+ imageId: (S = (i.imageRegistry.get(a.current.attrs.batchId) ?? [])[m]) == null ? void 0 : S.id,
3111
+ batchId: a.current.attrs.batchId,
3112
+ getPos: e,
3113
+ editor: t
3114
+ });
3115
+ }, p = (m) => {
3116
+ var C;
3117
+ const S = e();
3118
+ if (S !== void 0) {
3119
+ const A = (i.imageRegistry.get(a.current.attrs.batchId) ?? []).findIndex((E) => E.id === m.id);
3120
+ t.view.dispatch(
3121
+ t.state.tr.setNodeMarkup(S, void 0, {
3122
+ ...a.current.attrs,
3123
+ focusedImageIndex: A
3124
+ }).setMeta("addToHistory", !1)
3125
+ );
3126
+ }
3127
+ (C = r.onImageClick) == null || C.call(r, {
3128
+ imageId: m.id,
3129
+ batchId: a.current.attrs.batchId,
3130
+ src: m.src,
3131
+ getPos: e,
3132
+ editor: t
3133
+ });
3134
+ }, y = () => {
3135
+ const [m, S] = Le.useState({
3136
+ images: i.imageRegistry.get(n.attrs.batchId) ?? [],
3137
+ focusedImageIndex: n.attrs.focusedImageIndex,
3138
+ batchId: n.attrs.batchId
3139
+ });
3140
+ return u = S, Le.createElement(_n, {
3141
+ batchId: m.batchId,
3142
+ images: m.images,
3143
+ maxImageAmount: r.maxImageAmount,
3144
+ height: r.height,
3145
+ focusedImageIndex: m.focusedImageIndex,
3146
+ onAdd: f,
3147
+ onDelete: d,
3148
+ onImageClick: p
3149
+ });
3150
+ };
3151
+ l.render(Le.createElement(y));
3152
+ let w = n;
3153
+ return s.addEventListener("click", () => {
3154
+ const m = e();
3155
+ if (m !== void 0) {
3156
+ const { state: S, view: C } = t, A = S.doc.nodeAt(m);
3157
+ if (!A) return;
3158
+ const E = S.tr.setNodeMarkup(m, void 0, { ...A.attrs, focusedImageIndex: null }).setMeta("addToHistory", !1);
3159
+ C.dispatch(E.setSelection(z.create(E.doc, m)));
3160
+ }
3161
+ }), {
3162
+ dom: s,
3163
+ update: (m) => m.type !== n.type ? !1 : (m === w || (w = m, a.current = m, u == null || u({
3164
+ images: i.imageRegistry.get(m.attrs.batchId) ?? [],
3165
+ focusedImageIndex: m.attrs.focusedImageIndex,
3166
+ batchId: m.attrs.batchId
3167
+ })), !0),
3168
+ // selectNode fires when node becomes selected (ArrowUp/Down/Left/Right from outside).
3169
+ // Deferred via queueMicrotask — safe since selectNode is called during view.dispatch.
3170
+ selectNode: () => {
3171
+ const m = ae;
3172
+ ae = null;
3173
+ const S = e();
3174
+ if (S === void 0) return;
3175
+ const C = t.state.doc.nodeAt(S);
3176
+ if (!C || C.attrs.focusedImageIndex !== null) return;
3177
+ const A = m === "left" ? null : 0;
3178
+ queueMicrotask(() => {
3179
+ const E = e();
3180
+ if (E === void 0) return;
3181
+ const te = t.state.doc.nodeAt(E);
3182
+ !te || te.attrs.focusedImageIndex !== null || t.state.selection instanceof z && t.view.dispatch(
3183
+ t.state.tr.setNodeMarkup(E, void 0, { ...te.attrs, focusedImageIndex: A }).setMeta("addToHistory", !1)
3184
+ );
3185
+ });
3186
+ },
3187
+ deselectNode: () => {
3188
+ const m = e();
3189
+ if (m === void 0) return;
3190
+ const S = t.state.doc.nodeAt(m);
3191
+ !S || S.attrs.focusedImageIndex === null || t.view.dispatch(
3192
+ t.state.tr.setNodeMarkup(m, void 0, { ...S.attrs, focusedImageIndex: null }).setMeta("addToHistory", !1)
3193
+ );
3194
+ },
3195
+ destroy: () => {
3196
+ i.imageRegistry.delete(n.attrs.batchId), queueMicrotask(() => l.unmount());
3197
+ }
3198
+ };
3199
+ };
3200
+ },
3201
+ addCommands() {
3202
+ return {
3203
+ insertBatchImages: ({ batchId: n, images: e }) => (t) => (t.editor.storage.batchSegmentImages.imageRegistry.set(n, e), t.chain().insertContent({
3204
+ type: "batchSegmentImages",
3205
+ attrs: {
3206
+ batchId: n,
3207
+ images: e,
3208
+ id: crypto.randomUUID()
3209
+ }
3210
+ }).run())
3211
+ };
3212
+ },
3213
+ parseHTML() {
3214
+ return [
3215
+ {
3216
+ tag: "div[data-batch-id]"
3217
+ }
3218
+ ];
3219
+ }
3220
+ });
3221
+ export {
3222
+ ai as ALL_EXTENSIONS,
3223
+ li as BASE_EXTENSIONS,
3224
+ ci as BatchSegmentImagesExtension,
3225
+ hi as Bold,
3226
+ Mi as BulletList,
3227
+ ns as CharacterCount,
3228
+ mi as Color,
3229
+ Rn as CustomBulletList,
3230
+ Qt as CustomListItem,
3231
+ On as CustomOrderedList,
3232
+ en as CustomParagraph,
3233
+ yi as Document,
3234
+ er as DynamicBulletStyling,
3235
+ Ii as FileHandler,
3236
+ tr as FontSize,
3237
+ xi as HardBreak,
3238
+ bi as Heading,
3239
+ Ei as Highlight,
3240
+ is as History,
3241
+ Ri as Image,
3242
+ bn as IndentExtension,
3243
+ Ni as Italic,
3244
+ rr as LineHeight,
3245
+ Ci as Link,
3246
+ Cn as ListIndentIntegration,
3247
+ Pi as ListItem,
3248
+ Di as ListKeymap,
3249
+ Hi as Mention,
3250
+ ui as MentionStorage,
3251
+ zi as OrderedList,
3252
+ $i as Paragraph,
3253
+ ss as Placeholder,
3254
+ qi as Table,
3255
+ Vi as TableCell,
3256
+ Wi as TableHeader,
3257
+ Ui as TableRow,
3258
+ _i as TaskItem,
3259
+ Ji as TaskList,
3260
+ Ki as Text,
3261
+ Xi as TextAlign,
3262
+ Qi as TextStyle,
3263
+ ts as Underline
3264
+ };