@caspeco/casper-ui-library 10.0.2 → 10.0.3

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.
@@ -1,9 +1,10 @@
1
- import { Node as g, wrappingInputRule as b, mergeAttributes as L, renderNestedMarkdownContent as $, Extension as A, isNodeActive as I, isAtStartOfNode as j, isAtEndOfNode as K, getNodeAtPosition as z, getNodeType as B, getRenderedAttributes as V, parseIndentedBlocks as w } from "../../core/dist/index.js";
2
- import { Fragment as X } from "../../../prosemirror-model/dist/index.js";
3
- var F = Object.defineProperty, G = (t, e) => {
4
- for (var s in e)
5
- F(t, s, { get: e[s], enumerable: !0 });
6
- }, W = "listItem", C = "textStyle", N = /^\s*([-+*])\s$/, q = g.create({
1
+ import { Node as b, wrappingInputRule as g, mergeAttributes as v, renderNestedMarkdownContent as z, Extension as _, isNodeActive as w, isAtStartOfNode as Q, isAtEndOfNode as tt, getNodeAtPosition as et, getNodeType as V, getRenderedAttributes as nt, parseIndentedBlocks as O } from "../../core/dist/index.js";
2
+ import { Fragment as st } from "../../../prosemirror-model/dist/index.js";
3
+ import { Plugin as rt } from "../../../prosemirror-state/dist/index.js";
4
+ var it = Object.defineProperty, ot = (t, e) => {
5
+ for (var n in e)
6
+ it(t, n, { get: e[n], enumerable: !0 });
7
+ }, at = "listItem", P = "textStyle", H = /^\s*([-+*])\s$/, ut = b.create({
7
8
  name: "bulletList",
8
9
  addOptions() {
9
10
  return {
@@ -21,7 +22,7 @@ var F = Object.defineProperty, G = (t, e) => {
21
22
  return [{ tag: "ul" }];
22
23
  },
23
24
  renderHTML({ HTMLAttributes: t }) {
24
- return ["ul", L(this.options.HTMLAttributes, t), 0];
25
+ return ["ul", v(this.options.HTMLAttributes, t), 0];
25
26
  },
26
27
  markdownTokenName: "list",
27
28
  parseMarkdown: (t, e) => t.type !== "list" || t.ordered ? [] : {
@@ -35,7 +36,7 @@ var F = Object.defineProperty, G = (t, e) => {
35
36
  },
36
37
  addCommands() {
37
38
  return {
38
- toggleBulletList: () => ({ commands: t, chain: e }) => this.options.keepAttributes ? e().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(W, this.editor.getAttributes(C)).run() : t.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks)
39
+ toggleBulletList: () => ({ commands: t, chain: e }) => this.options.keepAttributes ? e().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(at, this.editor.getAttributes(P)).run() : t.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks)
39
40
  };
40
41
  },
41
42
  addKeyboardShortcuts() {
@@ -44,84 +45,225 @@ var F = Object.defineProperty, G = (t, e) => {
44
45
  };
45
46
  },
46
47
  addInputRules() {
47
- let t = b({
48
- find: N,
48
+ let t = g({
49
+ find: H,
49
50
  type: this.type
50
51
  });
51
- return (this.options.keepMarks || this.options.keepAttributes) && (t = b({
52
- find: N,
52
+ return (this.options.keepMarks || this.options.keepAttributes) && (t = g({
53
+ find: H,
53
54
  type: this.type,
54
55
  keepMarks: this.options.keepMarks,
55
56
  keepAttributes: this.options.keepAttributes,
56
- getAttributes: () => this.editor.getAttributes(C),
57
+ getAttributes: () => this.editor.getAttributes(P),
57
58
  editor: this.editor
58
59
  })), [t];
59
60
  }
60
- }), Y = (t, e, s) => {
61
- const { selection: r } = t;
62
- if (!r.empty)
61
+ }), ct = (t, e, n) => {
62
+ const { selection: s } = t;
63
+ if (!s.empty)
63
64
  return null;
64
- const { $from: n } = r;
65
- if (!n.parent.isTextblock || n.parentOffset !== n.parent.content.size)
65
+ const { $from: r } = s;
66
+ if (!r.parent.isTextblock || r.parentOffset !== r.parent.content.size)
66
67
  return null;
67
68
  let i = -1;
68
- for (let d = n.depth; d > 0; d -= 1)
69
- if (n.node(d).type.name === e) {
69
+ for (let d = r.depth; d > 0; d -= 1)
70
+ if (r.node(d).type.name === e) {
70
71
  i = d;
71
72
  break;
72
73
  }
73
74
  if (i < 0)
74
75
  return null;
75
- const l = n.node(i), o = n.index(i);
76
- if (o + 1 >= l.childCount)
76
+ const a = r.node(i), o = r.index(i);
77
+ if (o + 1 >= a.childCount)
77
78
  return null;
78
- const p = l.child(o + 1);
79
- if (!s.includes(p.type.name))
79
+ const c = a.child(o + 1);
80
+ if (!n.includes(c.type.name))
80
81
  return null;
81
82
  const h = t.schema.nodes[e];
82
- let c = !1;
83
- if (p.forEach((d) => {
84
- d.type === h && d.childCount > 1 && (c = !0);
85
- }), !c)
83
+ let p = !1;
84
+ if (c.forEach((d) => {
85
+ d.type === h && d.childCount > 1 && (p = !0);
86
+ }), !p)
86
87
  return null;
87
- const a = t.doc.resolve(n.after()).nodeAfter;
88
- if (!a || !s.includes(a.type.name))
88
+ const u = t.doc.resolve(r.after()).nodeAfter;
89
+ if (!u || !n.includes(u.type.name))
89
90
  return null;
90
- const u = [];
91
- return a.forEach((d) => {
92
- u.push(d);
93
- }), u.length === 0 ? null : {
91
+ const l = [];
92
+ return u.forEach((d) => {
93
+ l.push(d);
94
+ }), l.length === 0 ? null : {
94
95
  listItemDepth: i,
95
- nestedList: a,
96
- nestedListPos: n.after(),
97
- insertPos: n.after(i),
98
- items: u
96
+ nestedList: u,
97
+ nestedListPos: r.after(),
98
+ insertPos: r.after(i),
99
+ items: l
99
100
  };
100
- }, J = (t, e, s, r) => {
101
- const n = Y(t, s, r);
102
- if (!n)
101
+ }, lt = (t, e, n, s) => {
102
+ const r = ct(t, n, s);
103
+ if (!r)
103
104
  return !1;
104
- const { selection: i } = t, { nestedList: l, nestedListPos: o, insertPos: p, items: h } = n, c = t.tr;
105
- c.delete(o, o + l.nodeSize);
106
- const a = c.mapping.map(p);
107
- return c.insert(a, X.from(h)), c.setSelection(i.map(c.doc, c.mapping)), e && e(c), !0;
108
- }, Q = (t, e, s) => J(t.state, t.view.dispatch, e, s), D = (t, e) => A.create({
105
+ const { selection: i } = t, { nestedList: a, nestedListPos: o, insertPos: c, items: h } = r, p = t.tr;
106
+ p.delete(o, o + a.nodeSize);
107
+ const u = p.mapping.map(c);
108
+ return p.insert(u, st.from(h)), p.setSelection(i.map(p.doc, p.mapping)), e && e(p), !0;
109
+ }, dt = (t, e, n) => lt(t.state, t.view.dispatch, e, n), X = (t, e) => _.create({
109
110
  name: `${t}BranchingDeleteKeymap`,
110
111
  priority: 101,
111
112
  addKeyboardShortcuts() {
112
- const s = () => Q(this.editor, t, e);
113
+ const n = () => dt(this.editor, t, e);
113
114
  return {
114
- Delete: s,
115
- "Mod-Delete": s
115
+ Delete: n,
116
+ "Mod-Delete": n
116
117
  };
117
118
  }
118
- });
119
+ }), F = [
120
+ [1e3, "m"],
121
+ [900, "cm"],
122
+ [500, "d"],
123
+ [400, "cd"],
124
+ [100, "c"],
125
+ [90, "xc"],
126
+ [50, "l"],
127
+ [40, "xl"],
128
+ [10, "x"],
129
+ [9, "ix"],
130
+ [5, "v"],
131
+ [4, "iv"],
132
+ [1, "i"]
133
+ ], T = "abcdefghijklmnopqrstuvwxyz", pt = "[a-zA-Z]{1,2}", S = String.raw`\d+|[ivxlcdmIVXLCDM]+|${pt}`;
134
+ function A(t) {
135
+ let e = t, n = "";
136
+ for (const [s, r] of F)
137
+ for (; e >= s; )
138
+ n += r, e -= s;
139
+ return n;
140
+ }
141
+ function $(t) {
142
+ return A(t).toUpperCase();
143
+ }
119
144
  function U(t) {
120
- var e, s;
121
- const r = (e = t.tokens) == null ? void 0 : e[0];
122
- return !!(t.text && ((s = t.tokens) == null ? void 0 : s.length) === 1 && r?.type === "list" && r.ordered && r.raw === t.text);
145
+ const e = t.toLowerCase();
146
+ let n = 0, s = 0;
147
+ for (; n < e.length; ) {
148
+ let r = !1;
149
+ for (const [i, a] of F)
150
+ if (e.startsWith(a, n)) {
151
+ s += i, n += a.length, r = !0;
152
+ break;
153
+ }
154
+ if (!r)
155
+ return 0;
156
+ }
157
+ return s;
158
+ }
159
+ function ht(t) {
160
+ if (!/^[ivxlcdmIVXLCDM]+$/.test(t))
161
+ return !1;
162
+ const e = U(t);
163
+ return e <= 0 ? !1 : (t === t.toLowerCase() ? A(e) : $(e)) === t;
164
+ }
165
+ function ft(t) {
166
+ const e = t.toLowerCase();
167
+ if (e.length === 1)
168
+ return e.charCodeAt(0) - 97 + 1;
169
+ if (e.length === 2) {
170
+ const n = e.charCodeAt(0) - 97, s = e.charCodeAt(1) - 97;
171
+ return (n + 1) * 26 + s + 1;
172
+ }
173
+ return 0;
174
+ }
175
+ function I(t) {
176
+ if (t <= 26)
177
+ return T[t - 1];
178
+ const e = Math.floor((t - 1) / 26) - 1, n = (t - 1) % 26;
179
+ return e < 0 ? T[n] : T[e] + T[n];
180
+ }
181
+ function x(t) {
182
+ if (!(!t || /^\d+$/.test(t))) {
183
+ if (ht(t))
184
+ return t === t.toLowerCase() ? "i" : "I";
185
+ if (/^[a-z]{1,2}$/.test(t))
186
+ return "a";
187
+ if (/^[A-Z]{1,2}$/.test(t))
188
+ return "A";
189
+ }
190
+ }
191
+ function R(t) {
192
+ if (/^\d+$/.test(t))
193
+ return parseInt(t, 10);
194
+ const e = x(t);
195
+ if (e === "i" || e === "I")
196
+ return U(t);
197
+ if (e === "a" || e === "A") {
198
+ const s = ft(t);
199
+ return s > 0 ? s : 1;
200
+ }
201
+ const n = parseInt(t, 10);
202
+ return Number.isNaN(n) ? 1 : n;
203
+ }
204
+ function mt(t, e) {
205
+ if (t === "numeric")
206
+ return String(e);
207
+ switch (t) {
208
+ case "a":
209
+ return I(e);
210
+ case "A":
211
+ return I(e).toUpperCase();
212
+ case "i":
213
+ return A(e);
214
+ case "I":
215
+ return $(e);
216
+ default:
217
+ return String(e);
218
+ }
123
219
  }
124
- function Z(t, e) {
220
+ function Lt(t) {
221
+ var e;
222
+ if (t.length === 0)
223
+ return !1;
224
+ const n = (e = x(t[0])) != null ? e : "numeric", s = R(t[0]);
225
+ if (s < 1)
226
+ return !1;
227
+ for (let r = 0; r < t.length; r++) {
228
+ const i = mt(n, s + r);
229
+ if (t[r] !== i)
230
+ return !1;
231
+ }
232
+ return !0;
233
+ }
234
+ function kt(t) {
235
+ return {
236
+ type: x(t),
237
+ start: R(t)
238
+ };
239
+ }
240
+ function yt(t) {
241
+ const { type: e, start: n } = kt(t), s = {};
242
+ return e && (s.type = e), n !== 1 && (s.start = n), s;
243
+ }
244
+ function gt(t, e, n = ". ") {
245
+ const s = e + 1;
246
+ if (!t || t === "1")
247
+ return `${s}${n}`;
248
+ switch (t) {
249
+ case "a":
250
+ return `${I(s)}${n}`;
251
+ case "A":
252
+ return `${I(s).toUpperCase()}${n}`;
253
+ case "i":
254
+ return `${A(s)}${n}`;
255
+ case "I":
256
+ return `${$(s)}${n}`;
257
+ default:
258
+ return `${s}${n}`;
259
+ }
260
+ }
261
+ function bt(t) {
262
+ var e, n;
263
+ const s = (e = t.tokens) == null ? void 0 : e[0];
264
+ return !!(t.text && ((n = t.tokens) == null ? void 0 : n.length) === 1 && s?.type === "list" && s.ordered && s.raw === t.text);
265
+ }
266
+ function vt(t, e) {
125
267
  return e.tokenizeInline ? e.parseInline(e.tokenizeInline(t)) : e.parseInline([
126
268
  {
127
269
  type: "text",
@@ -130,7 +272,7 @@ function Z(t, e) {
130
272
  }
131
273
  ]);
132
274
  }
133
- var tt = g.create({
275
+ var Tt = b.create({
134
276
  name: "listItem",
135
277
  addOptions() {
136
278
  return {
@@ -149,66 +291,72 @@ var tt = g.create({
149
291
  ];
150
292
  },
151
293
  renderHTML({ HTMLAttributes: t }) {
152
- return ["li", L(this.options.HTMLAttributes, t), 0];
294
+ return ["li", v(this.options.HTMLAttributes, t), 0];
153
295
  },
154
296
  markdownTokenName: "list_item",
155
297
  parseMarkdown: (t, e) => {
156
- var s;
298
+ var n;
157
299
  if (t.type !== "list_item")
158
300
  return [];
159
- const r = (s = e.parseBlockChildren) != null ? s : e.parseChildren;
160
- let n = [];
301
+ const s = (n = e.parseBlockChildren) != null ? n : e.parseChildren;
302
+ let r = [];
161
303
  if (t.tokens && t.tokens.length > 0) {
162
- if (U(t))
304
+ if (bt(t))
163
305
  return {
164
306
  type: "listItem",
165
307
  content: [
166
308
  {
167
309
  type: "paragraph",
168
- content: Z(t.text || "", e)
310
+ content: vt(t.text || "", e)
169
311
  }
170
312
  ]
171
313
  };
172
- if (t.tokens.some((l) => l.type === "paragraph"))
173
- n = r(t.tokens);
314
+ if (t.tokens.some((a) => a.type === "paragraph"))
315
+ r = s(t.tokens);
174
316
  else {
175
- const l = t.tokens[0];
176
- if (l && l.type === "text" && l.tokens && l.tokens.length > 0) {
177
- if (n = [
317
+ const a = t.tokens[0];
318
+ if (a && a.type === "text" && a.tokens && a.tokens.length > 0) {
319
+ if (r = [
178
320
  {
179
321
  type: "paragraph",
180
- content: e.parseInline(l.tokens)
322
+ content: e.parseInline(a.tokens)
181
323
  }
182
324
  ], t.tokens.length > 1) {
183
- const p = t.tokens.slice(1), h = r(p);
184
- n.push(...h);
325
+ const c = t.tokens.slice(1), h = s(c);
326
+ r.push(...h);
185
327
  }
186
328
  } else
187
- n = r(t.tokens);
329
+ r = s(t.tokens);
188
330
  }
189
331
  }
190
- return n.length === 0 && (n = [
332
+ return r.length === 0 && (r = [
191
333
  {
192
334
  type: "paragraph",
193
335
  content: []
194
336
  }
195
337
  ]), {
196
338
  type: "listItem",
197
- content: n
339
+ content: r
198
340
  };
199
341
  },
200
- renderMarkdown: (t, e, s) => $(
342
+ renderMarkdown: (t, e, n) => z(
201
343
  t,
202
344
  e,
203
- (r) => {
204
- var n, i;
205
- return r.parentType === "bulletList" ? "- " : r.parentType === "orderedList" ? `${(((i = (n = r.meta) == null ? void 0 : n.parentAttrs) == null ? void 0 : i.start) || 1) + r.index}. ` : "- ";
345
+ (s) => {
346
+ var r, i, a, o;
347
+ if (s.parentType === "bulletList")
348
+ return "- ";
349
+ if (s.parentType === "orderedList") {
350
+ const c = ((i = (r = s.meta) == null ? void 0 : r.parentAttrs) == null ? void 0 : i.start) || 1, h = (o = (a = s.meta) == null ? void 0 : a.parentAttrs) == null ? void 0 : o.type, p = c - 1 + (s.index || 0);
351
+ return gt(h, p, ". ");
352
+ }
353
+ return "- ";
206
354
  },
207
- s
355
+ n
208
356
  ),
209
357
  addExtensions() {
210
358
  return [
211
- D(this.name, [
359
+ X(this.name, [
212
360
  this.options.bulletListTypeName,
213
361
  this.options.orderedListTypeName
214
362
  ])
@@ -221,79 +369,79 @@ var tt = g.create({
221
369
  "Shift-Tab": () => this.editor.commands.liftListItem(this.name)
222
370
  };
223
371
  }
224
- }), et = {};
225
- G(et, {
226
- findListItemPos: () => y,
227
- getNextListDepth: () => M,
228
- handleBackspace: () => T,
229
- handleDelete: () => x,
230
- hasListBefore: () => O,
231
- hasListItemAfter: () => st,
232
- hasListItemBefore: () => nt,
233
- listItemHasSubList: () => rt,
234
- nextListIsDeeper: () => P,
235
- nextListIsHigher: () => _
372
+ }), It = {};
373
+ ot(It, {
374
+ findListItemPos: () => M,
375
+ getNextListDepth: () => D,
376
+ handleBackspace: () => C,
377
+ handleDelete: () => E,
378
+ hasListBefore: () => W,
379
+ hasListItemAfter: () => At,
380
+ hasListItemBefore: () => xt,
381
+ listItemHasSubList: () => Mt,
382
+ nextListIsDeeper: () => q,
383
+ nextListIsHigher: () => G
236
384
  });
237
- var y = (t, e) => {
238
- const { $from: s } = e.selection, r = B(t, e.schema);
239
- let n = null, i = s.depth, l = s.pos, o = null;
385
+ var M = (t, e) => {
386
+ const { $from: n } = e.selection, s = V(t, e.schema);
387
+ let r = null, i = n.depth, a = n.pos, o = null;
240
388
  for (; i > 0 && o === null; )
241
- n = s.node(i), n.type === r ? o = i : (i -= 1, l -= 1);
242
- return o === null ? null : { $pos: e.doc.resolve(l), depth: o };
243
- }, M = (t, e) => {
244
- const s = y(t, e);
245
- if (!s)
389
+ r = n.node(i), r.type === s ? o = i : (i -= 1, a -= 1);
390
+ return o === null ? null : { $pos: e.doc.resolve(a), depth: o };
391
+ }, D = (t, e) => {
392
+ const n = M(t, e);
393
+ if (!n)
246
394
  return !1;
247
- const [, r] = z(e, t, s.$pos.pos + 4);
248
- return r;
249
- }, O = (t, e, s) => {
250
- const { $anchor: r } = t.selection, n = Math.max(0, r.pos - 2), i = t.doc.resolve(n).node();
251
- return !(!i || !s.includes(i.type.name));
252
- }, T = (t, e, s) => {
395
+ const [, s] = et(e, t, n.$pos.pos + 4);
396
+ return s;
397
+ }, W = (t, e, n) => {
398
+ const { $anchor: s } = t.selection, r = Math.max(0, s.pos - 2), i = t.doc.resolve(r).node();
399
+ return !(!i || !n.includes(i.type.name));
400
+ }, C = (t, e, n) => {
253
401
  if (t.commands.undoInputRule())
254
402
  return !0;
255
403
  if (t.state.selection.from !== t.state.selection.to)
256
404
  return !1;
257
- if (!I(t.state, e) && O(t.state, e, s)) {
258
- const { $anchor: r } = t.state.selection, n = t.state.doc.resolve(r.before() - 1), i = [];
259
- n.node().descendants((p, h) => {
260
- p.type.name === e && i.push({ node: p, pos: h });
405
+ if (!w(t.state, e) && W(t.state, e, n)) {
406
+ const { $anchor: s } = t.state.selection, r = t.state.doc.resolve(s.before() - 1), i = [];
407
+ r.node().descendants((c, h) => {
408
+ c.type.name === e && i.push({ node: c, pos: h });
261
409
  });
262
- const l = i.at(-1);
263
- if (!l)
410
+ const a = i.at(-1);
411
+ if (!a)
264
412
  return !1;
265
- const o = t.state.doc.resolve(n.start() + l.pos + 1);
266
- return t.chain().cut({ from: r.start() - 1, to: r.end() + 1 }, o.end()).joinForward().run();
413
+ const o = t.state.doc.resolve(r.start() + a.pos + 1);
414
+ return t.chain().cut({ from: s.start() - 1, to: s.end() + 1 }, o.end()).joinForward().run();
267
415
  }
268
- return !I(t.state, e) || !j(t.state) ? !1 : t.chain().liftListItem(e).run();
269
- }, P = (t, e) => {
270
- const s = M(t, e), r = y(t, e);
271
- return !r || !s ? !1 : s > r.depth;
272
- }, _ = (t, e) => {
273
- const s = M(t, e), r = y(t, e);
274
- return !r || !s ? !1 : s < r.depth;
275
- }, x = (t, e) => {
276
- if (!I(t.state, e) || !K(t.state, e))
416
+ return !w(t.state, e) || !Q(t.state) ? !1 : t.chain().liftListItem(e).run();
417
+ }, q = (t, e) => {
418
+ const n = D(t, e), s = M(t, e);
419
+ return !s || !n ? !1 : n > s.depth;
420
+ }, G = (t, e) => {
421
+ const n = D(t, e), s = M(t, e);
422
+ return !s || !n ? !1 : n < s.depth;
423
+ }, E = (t, e) => {
424
+ if (!w(t.state, e) || !tt(t.state, e))
277
425
  return !1;
278
- const { selection: s } = t.state, { $from: r, $to: n } = s;
279
- return !s.empty && r.sameParent(n) ? !1 : P(e, t.state) ? t.chain().focus(t.state.selection.from + 4).lift(e).joinBackward().run() : _(e, t.state) ? t.chain().joinForward().joinBackward().run() : t.commands.joinItemForward();
280
- }, st = (t, e) => {
281
- var s;
282
- const { $anchor: r } = e.selection, n = e.doc.resolve(r.pos - r.parentOffset - 2);
283
- return !(n.index() === n.parent.childCount - 1 || ((s = n.nodeAfter) == null ? void 0 : s.type.name) !== t);
284
- }, nt = (t, e) => {
285
- var s;
286
- const { $anchor: r } = e.selection, n = e.doc.resolve(r.pos - 2);
287
- return !(n.index() === 0 || ((s = n.nodeBefore) == null ? void 0 : s.type.name) !== t);
288
- }, rt = (t, e, s) => {
289
- if (!s)
426
+ const { selection: n } = t.state, { $from: s, $to: r } = n;
427
+ return !n.empty && s.sameParent(r) ? !1 : q(e, t.state) ? t.chain().focus(t.state.selection.from + 4).lift(e).joinBackward().run() : G(e, t.state) ? t.chain().joinForward().joinBackward().run() : t.commands.joinItemForward();
428
+ }, At = (t, e) => {
429
+ var n;
430
+ const { $anchor: s } = e.selection, r = e.doc.resolve(s.pos - s.parentOffset - 2);
431
+ return !(r.index() === r.parent.childCount - 1 || ((n = r.nodeAfter) == null ? void 0 : n.type.name) !== t);
432
+ }, xt = (t, e) => {
433
+ var n;
434
+ const { $anchor: s } = e.selection, r = e.doc.resolve(s.pos - 2);
435
+ return !(r.index() === 0 || ((n = r.nodeBefore) == null ? void 0 : n.type.name) !== t);
436
+ }, Mt = (t, e, n) => {
437
+ if (!n)
290
438
  return !1;
291
- const r = B(t, e.schema);
292
- let n = !1;
293
- return s.descendants((i) => {
294
- i.type === r && (n = !0);
295
- }), n;
296
- }, it = A.create({
439
+ const s = V(t, e.schema);
440
+ let r = !1;
441
+ return n.descendants((i) => {
442
+ i.type === s && (r = !0);
443
+ }), r;
444
+ }, wt = _.create({
297
445
  name: "listKeymap",
298
446
  addOptions() {
299
447
  return {
@@ -313,170 +461,232 @@ var y = (t, e) => {
313
461
  return {
314
462
  Delete: ({ editor: t }) => {
315
463
  let e = !1;
316
- return this.options.listTypes.forEach(({ itemName: s }) => {
317
- t.state.schema.nodes[s] !== void 0 && x(t, s) && (e = !0);
464
+ return this.options.listTypes.forEach(({ itemName: n }) => {
465
+ t.state.schema.nodes[n] !== void 0 && E(t, n) && (e = !0);
318
466
  }), e;
319
467
  },
320
468
  "Mod-Delete": ({ editor: t }) => {
321
469
  let e = !1;
322
- return this.options.listTypes.forEach(({ itemName: s }) => {
323
- t.state.schema.nodes[s] !== void 0 && x(t, s) && (e = !0);
470
+ return this.options.listTypes.forEach(({ itemName: n }) => {
471
+ t.state.schema.nodes[n] !== void 0 && E(t, n) && (e = !0);
324
472
  }), e;
325
473
  },
326
474
  Backspace: ({ editor: t }) => {
327
475
  let e = !1;
328
- return this.options.listTypes.forEach(({ itemName: s, wrapperNames: r }) => {
329
- t.state.schema.nodes[s] !== void 0 && T(t, s, r) && (e = !0);
476
+ return this.options.listTypes.forEach(({ itemName: n, wrapperNames: s }) => {
477
+ t.state.schema.nodes[n] !== void 0 && C(t, n, s) && (e = !0);
330
478
  }), e;
331
479
  },
332
480
  "Mod-Backspace": ({ editor: t }) => {
333
481
  let e = !1;
334
- return this.options.listTypes.forEach(({ itemName: s, wrapperNames: r }) => {
335
- t.state.schema.nodes[s] !== void 0 && T(t, s, r) && (e = !0);
482
+ return this.options.listTypes.forEach(({ itemName: n, wrapperNames: s }) => {
483
+ t.state.schema.nodes[n] !== void 0 && C(t, n, s) && (e = !0);
336
484
  }), e;
337
485
  }
338
486
  };
339
487
  }
340
- }), E = /^(\s*)(\d+)\.\s+(.*)$/, ot = /^\s/;
341
- function at(t) {
488
+ }), N = new RegExp(
489
+ `^(\\s*)(${S})([.)])\\s+(.*)$`
490
+ ), Ct = new RegExp(
491
+ `^(\\s*)(${S})([.)])\\s+`
492
+ ), Et = /^\s/;
493
+ function Nt(t) {
494
+ return N.test(t.trimStart());
495
+ }
496
+ function _t(t) {
342
497
  const e = t.trimStart();
343
498
  return (
344
499
  // oxlint-disable-next-line prefer-string-starts-ends-with
345
- /^[-+*]\s+/.test(e) || // oxlint-disable-next-line prefer-string-starts-ends-with
346
- /^\d+\.\s+/.test(e) || // oxlint-disable-next-line prefer-string-starts-ends-with
500
+ /^[-+*]\s+/.test(e) || Nt(e) || // oxlint-disable-next-line prefer-string-starts-ends-with
347
501
  /^>\s?/.test(e) || // oxlint-disable-next-line prefer-string-starts-ends-with
348
502
  /^```/.test(e) || // oxlint-disable-next-line prefer-string-starts-ends-with
349
503
  /^~~~/.test(e)
350
504
  );
351
505
  }
352
- function lt(t) {
353
- const e = [], s = [];
354
- let r = !1;
355
- return t.forEach((n) => {
356
- if (r) {
357
- s.push(n);
506
+ function St(t) {
507
+ const e = [], n = [];
508
+ let s = !1;
509
+ return t.forEach((r) => {
510
+ if (s) {
511
+ n.push(r);
358
512
  return;
359
513
  }
360
- if (n.trim() === "") {
361
- r = !0, s.push(n);
514
+ if (r.trim() === "") {
515
+ s = !0, n.push(r);
362
516
  return;
363
517
  }
364
- if (e.length > 0 && at(n)) {
365
- r = !0, s.push(n);
518
+ if (e.length > 0 && _t(r)) {
519
+ s = !0, n.push(r);
366
520
  return;
367
521
  }
368
- e.push(n);
522
+ e.push(r);
369
523
  }), {
370
524
  paragraphLines: e,
371
- blockLines: s
525
+ blockLines: n
372
526
  };
373
527
  }
374
- function ut(t) {
528
+ function $t(t) {
375
529
  const e = [];
376
- let s = 0, r = 0;
377
- for (; s < t.length; ) {
378
- const n = t[s], i = n.match(E);
530
+ let n = 0, s = 0;
531
+ for (; n < t.length; ) {
532
+ const r = t[n], i = r.match(N);
379
533
  if (!i)
380
534
  break;
381
- const [, l, o, p] = i, h = l.length, c = [p];
382
- let a = s + 1;
383
- const u = [n];
384
- let d = !1;
385
- for (; a < t.length; ) {
386
- const m = t[a];
387
- if (m.match(E))
535
+ const [, a, o, c, h] = i, p = a.length, u = parseInt(o, 10), l = isNaN(u) ? x(o) : void 0, d = isNaN(u) ? R(o) : u, L = [h];
536
+ let f = n + 1;
537
+ const m = [r];
538
+ let y = !1;
539
+ for (; f < t.length; ) {
540
+ const k = t[f];
541
+ if (k.match(N))
388
542
  break;
389
- if (m.trim() === "")
390
- u.push(m), c.push(""), d = !0, a += 1;
391
- else if (m.match(ot))
392
- u.push(m), c.push(m.slice(h + 2)), a += 1;
393
- else {
394
- if (d)
543
+ if (k.trim() === "")
544
+ m.push(k), L.push(""), y = !0, f += 1;
545
+ else if (k.match(Et)) {
546
+ const J = k.length - k.trimStart().length, Y = p + o.length + 1;
547
+ m.push(k), L.push(k.slice(Math.min(J, Y))), f += 1;
548
+ } else {
549
+ if (y)
395
550
  break;
396
- u.push(m), c.push(m), a += 1;
551
+ m.push(k), L.push(k), f += 1;
397
552
  }
398
553
  }
399
554
  e.push({
400
- indent: h,
401
- number: parseInt(o, 10),
402
- content: c.join(`
555
+ indent: p,
556
+ number: d,
557
+ type: l,
558
+ content: L.join(`
403
559
  `).trim(),
404
- contentLines: c,
405
- raw: u.join(`
560
+ contentLines: L,
561
+ raw: m.join(`
406
562
  `)
407
- }), r = a, s = a;
563
+ }), s = f, n = f;
408
564
  }
409
- return [e, r];
565
+ return [e, s];
410
566
  }
411
- function R(t, e, s) {
412
- const r = [];
413
- let n = 0;
414
- for (; n < t.length; ) {
415
- const i = t[n];
567
+ var Rt = new RegExp(
568
+ `^(${S})([.)])\\s+(.+)$`
569
+ );
570
+ function Dt(t) {
571
+ const e = t.split(`
572
+ `).filter((i) => i.trim().length > 0);
573
+ if (e.length === 0)
574
+ return null;
575
+ const n = [];
576
+ for (const i of e) {
577
+ const a = i.trim().match(Rt);
578
+ if (!a)
579
+ return null;
580
+ n.push({
581
+ marker: a[1],
582
+ content: a[3]
583
+ });
584
+ }
585
+ const s = n.map((i) => i.marker);
586
+ return Lt(s) ? {
587
+ type: "orderedList",
588
+ attrs: yt(n[0].marker),
589
+ content: n.map((i) => ({
590
+ type: "listItem",
591
+ content: [
592
+ {
593
+ type: "paragraph",
594
+ content: [{ type: "text", text: i.content }]
595
+ }
596
+ ]
597
+ }))
598
+ } : null;
599
+ }
600
+ function Z(t, e, n) {
601
+ const s = [];
602
+ let r = 0;
603
+ for (; r < t.length; ) {
604
+ const i = t[r];
416
605
  if (i.indent === e) {
417
- const { paragraphLines: l, blockLines: o } = lt(i.contentLines), p = l.join(`
606
+ const { paragraphLines: a, blockLines: o } = St(i.contentLines), c = a.join(`
418
607
  `).trim(), h = [];
419
- p && h.push({
608
+ c && h.push({
420
609
  type: "paragraph",
421
- raw: p,
422
- tokens: s.inlineTokens(p)
610
+ raw: c,
611
+ tokens: n.inlineTokens(c)
423
612
  });
424
- const c = o.join(`
613
+ const p = o.join(`
425
614
  `).trim();
426
- if (c) {
427
- const d = s.blockTokens(c);
615
+ if (p) {
616
+ const d = n.blockTokens(p);
428
617
  h.push(...d);
429
618
  }
430
- let a = n + 1;
431
- const u = [];
432
- for (; a < t.length && t[a].indent > e; )
433
- u.push(t[a]), a += 1;
434
- if (u.length > 0) {
435
- const d = Math.min(...u.map((f) => f.indent)), m = R(u, d, s);
619
+ let u = r + 1;
620
+ const l = [];
621
+ for (; u < t.length && t[u].indent > e; )
622
+ l.push(t[u]), u += 1;
623
+ if (l.length > 0) {
624
+ const d = Math.min(...l.map((f) => f.indent)), L = Z(l, d, n);
436
625
  h.push({
437
626
  type: "list",
438
627
  ordered: !0,
439
- start: u[0].number,
440
- items: m,
441
- raw: u.map((f) => f.raw).join(`
628
+ start: l[0].number,
629
+ typeMarker: l[0].type,
630
+ items: L,
631
+ raw: l.map((f) => f.raw).join(`
442
632
  `)
443
633
  });
444
634
  }
445
- r.push({
635
+ s.push({
446
636
  type: "list_item",
447
637
  raw: i.raw,
448
638
  tokens: h
449
- }), n = a;
639
+ }), r = u;
450
640
  } else
451
- n += 1;
641
+ r += 1;
452
642
  }
453
- return r;
643
+ return s;
454
644
  }
455
- function dt(t, e) {
456
- return t.map((s) => {
457
- if (s.type !== "list_item")
458
- return e.parseChildren([s])[0];
459
- const r = [];
460
- return s.tokens && s.tokens.length > 0 && s.tokens.forEach((n) => {
461
- if (n.type === "paragraph" || n.type === "list" || n.type === "blockquote" || n.type === "code")
462
- r.push(...e.parseChildren([n]));
463
- else if (n.type === "text" && n.tokens) {
464
- const i = e.parseChildren([n]);
465
- r.push({
645
+ function Ot(t, e) {
646
+ return t.map((n) => {
647
+ if (n.type !== "list_item")
648
+ return e.parseChildren([n])[0];
649
+ const s = [];
650
+ return n.tokens && n.tokens.length > 0 && n.tokens.forEach((r) => {
651
+ if (r.type === "paragraph" || r.type === "list" || r.type === "blockquote" || r.type === "code")
652
+ s.push(...e.parseChildren([r]));
653
+ else if (r.type === "text" && r.tokens) {
654
+ const i = e.parseChildren([r]);
655
+ s.push({
466
656
  type: "paragraph",
467
657
  content: i
468
658
  });
469
659
  } else {
470
- const i = e.parseChildren([n]);
471
- i.length > 0 && r.push(...i);
660
+ const i = e.parseChildren([r]);
661
+ i.length > 0 && s.push(...i);
472
662
  }
473
663
  }), {
474
664
  type: "listItem",
475
- content: r
665
+ content: s
476
666
  };
477
667
  });
478
668
  }
479
- var ct = "listItem", H = "textStyle", S = /^(\d+)\.\s$/, pt = g.create({
669
+ var Pt = "listItem", B = "textStyle", j = /^(\d+)\.\s$/;
670
+ function K(t) {
671
+ const e = t.match(/list-style-type\s*:\s*([^;]+)/i);
672
+ if (!e)
673
+ return null;
674
+ switch (e[1].trim().toLowerCase()) {
675
+ case "upper-roman":
676
+ return "I";
677
+ case "lower-roman":
678
+ return "i";
679
+ case "upper-alpha":
680
+ case "upper-latin":
681
+ return "A";
682
+ case "lower-alpha":
683
+ case "lower-latin":
684
+ return "a";
685
+ default:
686
+ return null;
687
+ }
688
+ }
689
+ var Ht = b.create({
480
690
  name: "orderedList",
481
691
  addOptions() {
482
692
  return {
@@ -498,7 +708,27 @@ var ct = "listItem", H = "textStyle", S = /^(\d+)\.\s$/, pt = g.create({
498
708
  },
499
709
  type: {
500
710
  default: null,
501
- parseHTML: (t) => t.getAttribute("type")
711
+ parseHTML: (t) => {
712
+ const e = t.getAttribute("type");
713
+ if (e)
714
+ return e;
715
+ const n = t.getAttribute("style");
716
+ if (n) {
717
+ const r = K(n);
718
+ if (r)
719
+ return r;
720
+ }
721
+ const s = t.querySelector("li");
722
+ if (s) {
723
+ const r = s.getAttribute("style");
724
+ if (r) {
725
+ const i = K(r);
726
+ if (i)
727
+ return i;
728
+ }
729
+ }
730
+ return null;
731
+ }
502
732
  }
503
733
  };
504
734
  },
@@ -510,17 +740,17 @@ var ct = "listItem", H = "textStyle", S = /^(\d+)\.\s$/, pt = g.create({
510
740
  ];
511
741
  },
512
742
  renderHTML({ HTMLAttributes: t }) {
513
- const { start: e, ...s } = t;
514
- return e === 1 ? ["ol", L(this.options.HTMLAttributes, s), 0] : ["ol", L(this.options.HTMLAttributes, t), 0];
743
+ const { start: e, type: n, ...s } = t, r = v(this.options.HTMLAttributes, s);
744
+ return e !== 1 && (r.start = e), n && n !== "1" && (r.type = n), ["ol", r, 0];
515
745
  },
516
746
  markdownTokenName: "list",
517
747
  parseMarkdown: (t, e) => {
518
748
  if (t.type !== "list" || !t.ordered)
519
749
  return [];
520
- const s = t.start || 1, r = t.items ? dt(t.items, e) : [];
521
- return s !== 1 ? {
750
+ const n = t.start || 1, s = t.typeMarker, r = t.items ? Ot(t.items, e) : [], i = {};
751
+ return n !== 1 && (i.start = n), s && (i.type = s), Object.keys(i).length > 0 ? {
522
752
  type: "orderedList",
523
- attrs: { start: s },
753
+ attrs: i,
524
754
  content: r
525
755
  } : {
526
756
  type: "orderedList",
@@ -533,22 +763,26 @@ var ct = "listItem", H = "textStyle", S = /^(\d+)\.\s$/, pt = g.create({
533
763
  name: "orderedList",
534
764
  level: "block",
535
765
  start: (t) => {
536
- const e = t.match(/^(\s*)(\d+)\.\s+/), s = e?.index;
537
- return s !== void 0 ? s : -1;
766
+ const e = t.match(Ct), n = e?.index;
767
+ return n !== void 0 ? n : -1;
538
768
  },
539
- tokenize: (t, e, s) => {
540
- var r;
541
- const n = t.split(`
542
- `), [i, l] = ut(n);
543
- if (i.length === 0)
769
+ tokenize: (t, e, n) => {
770
+ var s, r;
771
+ const i = t.split(`
772
+ `), [a, o] = $t(i);
773
+ if (a.length === 0)
774
+ return;
775
+ const c = Z(a, 0, n);
776
+ if (c.length === 0)
544
777
  return;
545
- const o = R(i, 0, s);
546
- return o.length === 0 ? void 0 : {
778
+ const h = ((s = a[0]) == null ? void 0 : s.number) || 1, p = (r = a[0]) == null ? void 0 : r.type;
779
+ return {
547
780
  type: "list",
548
781
  ordered: !0,
549
- start: ((r = i[0]) == null ? void 0 : r.number) || 1,
550
- items: o,
551
- raw: n.slice(0, l).join(`
782
+ start: h,
783
+ typeMarker: p,
784
+ items: c,
785
+ raw: i.slice(0, o).join(`
552
786
  `)
553
787
  };
554
788
  }
@@ -558,7 +792,7 @@ var ct = "listItem", H = "textStyle", S = /^(\d+)\.\s$/, pt = g.create({
558
792
  },
559
793
  addCommands() {
560
794
  return {
561
- toggleOrderedList: () => ({ commands: t, chain: e }) => this.options.keepAttributes ? e().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(ct, this.editor.getAttributes(H)).run() : t.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks)
795
+ toggleOrderedList: () => ({ commands: t, chain: e }) => this.options.keepAttributes ? e().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(Pt, this.editor.getAttributes(B)).run() : t.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks)
562
796
  };
563
797
  },
564
798
  addKeyboardShortcuts() {
@@ -566,24 +800,51 @@ var ct = "listItem", H = "textStyle", S = /^(\d+)\.\s$/, pt = g.create({
566
800
  "Mod-Shift-7": () => this.editor.commands.toggleOrderedList()
567
801
  };
568
802
  },
803
+ addProseMirrorPlugins() {
804
+ return [
805
+ new rt({
806
+ props: {
807
+ handlePaste: (t, e) => {
808
+ var n, s;
809
+ const r = (n = e.clipboardData) == null ? void 0 : n.getData("text/html");
810
+ if (r?.trim())
811
+ return !1;
812
+ const i = (s = e.clipboardData) == null ? void 0 : s.getData("text/plain");
813
+ if (!i)
814
+ return !1;
815
+ const a = Dt(i);
816
+ if (!a)
817
+ return !1;
818
+ try {
819
+ const o = t.state.schema.nodeFromJSON(a), c = t.state.tr.replaceSelectionWith(o);
820
+ return t.dispatch(c), !0;
821
+ } catch {
822
+ return !1;
823
+ }
824
+ }
825
+ }
826
+ })
827
+ ];
828
+ },
569
829
  addInputRules() {
570
- let t = b({
571
- find: S,
830
+ const t = (n, s) => (!s.attrs.type || s.attrs.type === "1") && s.childCount + s.attrs.start === +n[1];
831
+ let e = g({
832
+ find: j,
572
833
  type: this.type,
573
- getAttributes: (e) => ({ start: +e[1] }),
574
- joinPredicate: (e, s) => s.childCount + s.attrs.start === +e[1]
834
+ getAttributes: (n) => ({ start: +n[1] }),
835
+ joinPredicate: t
575
836
  });
576
- return (this.options.keepMarks || this.options.keepAttributes) && (t = b({
577
- find: S,
837
+ return (this.options.keepMarks || this.options.keepAttributes) && (e = g({
838
+ find: j,
578
839
  type: this.type,
579
840
  keepMarks: this.options.keepMarks,
580
841
  keepAttributes: this.options.keepAttributes,
581
- getAttributes: (e) => ({ start: +e[1], ...this.editor.getAttributes(H) }),
582
- joinPredicate: (e, s) => s.childCount + s.attrs.start === +e[1],
842
+ getAttributes: (n) => ({ start: +n[1], ...this.editor.getAttributes(B) }),
843
+ joinPredicate: t,
583
844
  editor: this.editor
584
- })), [t];
845
+ })), [e];
585
846
  }
586
- }), ht = /^\s*(\[([( |x])?\])\s$/, mt = g.create({
847
+ }), Bt = /^\s*(\[([( |x])?\])\s$/, jt = b.create({
587
848
  name: "taskItem",
588
849
  addOptions() {
589
850
  return {
@@ -623,7 +884,7 @@ var ct = "listItem", H = "textStyle", S = /^(\d+)\.\s$/, pt = g.create({
623
884
  renderHTML({ node: t, HTMLAttributes: e }) {
624
885
  return [
625
886
  "li",
626
- L(this.options.HTMLAttributes, e, {
887
+ v(this.options.HTMLAttributes, e, {
627
888
  "data-type": this.name
628
889
  }),
629
890
  [
@@ -641,20 +902,20 @@ var ct = "listItem", H = "textStyle", S = /^(\d+)\.\s$/, pt = g.create({
641
902
  ];
642
903
  },
643
904
  parseMarkdown: (t, e) => {
644
- const s = [];
645
- if (t.tokens && t.tokens.length > 0 ? s.push(e.createNode("paragraph", {}, e.parseInline(t.tokens))) : t.text ? s.push(e.createNode("paragraph", {}, [e.createNode("text", { text: t.text })])) : s.push(e.createNode("paragraph", {}, [])), t.nestedTokens && t.nestedTokens.length > 0) {
646
- const r = e.parseChildren(t.nestedTokens);
647
- s.push(...r);
905
+ const n = [];
906
+ if (t.tokens && t.tokens.length > 0 ? n.push(e.createNode("paragraph", {}, e.parseInline(t.tokens))) : t.text ? n.push(e.createNode("paragraph", {}, [e.createNode("text", { text: t.text })])) : n.push(e.createNode("paragraph", {}, [])), t.nestedTokens && t.nestedTokens.length > 0) {
907
+ const s = e.parseChildren(t.nestedTokens);
908
+ n.push(...s);
648
909
  }
649
- return e.createNode("taskItem", { checked: t.checked || !1 }, s);
910
+ return e.createNode("taskItem", { checked: t.checked || !1 }, n);
650
911
  },
651
912
  renderMarkdown: (t, e) => {
652
- var s;
653
- const n = `- [${(s = t.attrs) != null && s.checked ? "x" : " "}] `;
654
- return $(t, e, n);
913
+ var n;
914
+ const r = `- [${(n = t.attrs) != null && n.checked ? "x" : " "}] `;
915
+ return z(t, e, r);
655
916
  },
656
917
  addExtensions() {
657
- return this.options.nested ? [D(this.name, [this.options.taskListTypeName])] : [];
918
+ return this.options.nested ? [X(this.name, [this.options.taskListTypeName])] : [];
658
919
  },
659
920
  addKeyboardShortcuts() {
660
921
  const t = {
@@ -667,54 +928,54 @@ var ct = "listItem", H = "textStyle", S = /^(\d+)\.\s$/, pt = g.create({
667
928
  } : t;
668
929
  },
669
930
  addNodeView() {
670
- return ({ node: t, HTMLAttributes: e, getPos: s, editor: r }) => {
671
- const n = document.createElement("li"), i = document.createElement("label"), l = document.createElement("span"), o = document.createElement("input"), p = document.createElement("div"), h = (a) => {
672
- var u, d;
673
- o.ariaLabel = ((d = (u = this.options.a11y) == null ? void 0 : u.checkboxLabel) == null ? void 0 : d.call(u, a, o.checked)) || `Task item checkbox for ${a.textContent || "empty task item"}`;
931
+ return ({ node: t, HTMLAttributes: e, getPos: n, editor: s }) => {
932
+ const r = document.createElement("li"), i = document.createElement("label"), a = document.createElement("span"), o = document.createElement("input"), c = document.createElement("div"), h = (u) => {
933
+ var l, d;
934
+ o.ariaLabel = ((d = (l = this.options.a11y) == null ? void 0 : l.checkboxLabel) == null ? void 0 : d.call(l, u, o.checked)) || `Task item checkbox for ${u.textContent || "empty task item"}`;
674
935
  };
675
- h(t), i.contentEditable = "false", o.type = "checkbox", o.addEventListener("mousedown", (a) => a.preventDefault()), o.addEventListener("change", (a) => {
676
- if (!r.isEditable && !this.options.onReadOnlyChecked) {
936
+ h(t), i.contentEditable = "false", o.type = "checkbox", o.addEventListener("mousedown", (u) => u.preventDefault()), o.addEventListener("change", (u) => {
937
+ if (!s.isEditable && !this.options.onReadOnlyChecked) {
677
938
  o.checked = !o.checked;
678
939
  return;
679
940
  }
680
- const { checked: u } = a.target;
681
- r.isEditable && typeof s == "function" && r.chain().focus(void 0, { scrollIntoView: !1 }).command(({ tr: d }) => {
682
- const m = s();
683
- if (typeof m != "number")
941
+ const { checked: l } = u.target;
942
+ s.isEditable && typeof n == "function" && s.chain().focus(void 0, { scrollIntoView: !1 }).command(({ tr: d }) => {
943
+ const L = n();
944
+ if (typeof L != "number")
684
945
  return !1;
685
- const f = d.doc.nodeAt(m);
686
- return d.setNodeMarkup(m, void 0, {
946
+ const f = d.doc.nodeAt(L);
947
+ return d.setNodeMarkup(L, void 0, {
687
948
  ...f?.attrs,
688
- checked: u
949
+ checked: l
689
950
  }), !0;
690
- }).run(), !r.isEditable && this.options.onReadOnlyChecked && (this.options.onReadOnlyChecked(t, u) || (o.checked = !o.checked));
691
- }), Object.entries(this.options.HTMLAttributes).forEach(([a, u]) => {
692
- n.setAttribute(a, u);
693
- }), n.dataset.checked = t.attrs.checked, o.checked = t.attrs.checked, i.append(o, l), n.append(i, p), Object.entries(e).forEach(([a, u]) => {
694
- n.setAttribute(a, u);
951
+ }).run(), !s.isEditable && this.options.onReadOnlyChecked && (this.options.onReadOnlyChecked(t, l) || (o.checked = !o.checked));
952
+ }), Object.entries(this.options.HTMLAttributes).forEach(([u, l]) => {
953
+ r.setAttribute(u, l);
954
+ }), r.dataset.checked = t.attrs.checked, o.checked = t.attrs.checked, i.append(o, a), r.append(i, c), Object.entries(e).forEach(([u, l]) => {
955
+ r.setAttribute(u, l);
695
956
  });
696
- let c = new Set(Object.keys(e));
957
+ let p = new Set(Object.keys(e));
697
958
  return {
698
- dom: n,
699
- contentDOM: p,
700
- update: (a) => {
701
- if (a.type !== this.type)
959
+ dom: r,
960
+ contentDOM: c,
961
+ update: (u) => {
962
+ if (u.type !== this.type)
702
963
  return !1;
703
- n.dataset.checked = a.attrs.checked, o.checked = a.attrs.checked, h(a);
704
- const u = r.extensionManager.attributes, d = V(a, u), m = new Set(Object.keys(d)), f = this.options.HTMLAttributes;
705
- return c.forEach((k) => {
706
- m.has(k) || (k in f ? n.setAttribute(k, f[k]) : n.removeAttribute(k));
707
- }), Object.entries(d).forEach(([k, v]) => {
708
- v == null ? k in f ? n.setAttribute(k, f[k]) : n.removeAttribute(k) : n.setAttribute(k, v);
709
- }), c = m, !0;
964
+ r.dataset.checked = u.attrs.checked, o.checked = u.attrs.checked, h(u);
965
+ const l = s.extensionManager.attributes, d = nt(u, l), L = new Set(Object.keys(d)), f = this.options.HTMLAttributes;
966
+ return p.forEach((m) => {
967
+ L.has(m) || (m in f ? r.setAttribute(m, f[m]) : r.removeAttribute(m));
968
+ }), Object.entries(d).forEach(([m, y]) => {
969
+ y == null ? m in f ? r.setAttribute(m, f[m]) : r.removeAttribute(m) : r.setAttribute(m, y);
970
+ }), p = L, !0;
710
971
  }
711
972
  };
712
973
  };
713
974
  },
714
975
  addInputRules() {
715
976
  return [
716
- b({
717
- find: ht,
977
+ g({
978
+ find: Bt,
718
979
  type: this.type,
719
980
  getAttributes: (t) => ({
720
981
  checked: t[t.length - 1] === "x"
@@ -722,7 +983,7 @@ var ct = "listItem", H = "textStyle", S = /^(\d+)\.\s$/, pt = g.create({
722
983
  })
723
984
  ];
724
985
  }
725
- }), ft = g.create({
986
+ }), Kt = b.create({
726
987
  name: "taskList",
727
988
  addOptions() {
728
989
  return {
@@ -745,7 +1006,7 @@ var ct = "listItem", H = "textStyle", S = /^(\d+)\.\s$/, pt = g.create({
745
1006
  renderHTML({ HTMLAttributes: t }) {
746
1007
  return [
747
1008
  "ul",
748
- L(this.options.HTMLAttributes, t, { "data-type": this.name }),
1009
+ v(this.options.HTMLAttributes, t, { "data-type": this.name }),
749
1010
  0
750
1011
  ];
751
1012
  },
@@ -757,12 +1018,12 @@ var ct = "listItem", H = "textStyle", S = /^(\d+)\.\s$/, pt = g.create({
757
1018
  level: "block",
758
1019
  start(t) {
759
1020
  var e;
760
- const s = (e = t.match(/^\s*[-+*]\s+\[([ xX])\]\s+/)) == null ? void 0 : e.index;
761
- return s !== void 0 ? s : -1;
1021
+ const n = (e = t.match(/^\s*[-+*]\s+\[([ xX])\]\s+/)) == null ? void 0 : e.index;
1022
+ return n !== void 0 ? n : -1;
762
1023
  },
763
- tokenize(t, e, s) {
764
- const r = (i) => {
765
- const l = w(
1024
+ tokenize(t, e, n) {
1025
+ const s = (i) => {
1026
+ const a = O(
766
1027
  i,
767
1028
  {
768
1029
  itemPattern: /^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,
@@ -771,29 +1032,29 @@ var ct = "listItem", H = "textStyle", S = /^(\d+)\.\s$/, pt = g.create({
771
1032
  mainContent: o[4],
772
1033
  checked: o[3].toLowerCase() === "x"
773
1034
  }),
774
- createToken: (o, p) => ({
1035
+ createToken: (o, c) => ({
775
1036
  type: "taskItem",
776
1037
  raw: "",
777
1038
  mainContent: o.mainContent,
778
1039
  indentLevel: o.indentLevel,
779
1040
  checked: o.checked,
780
1041
  text: o.mainContent,
781
- tokens: s.inlineTokens(o.mainContent),
782
- nestedTokens: p
1042
+ tokens: n.inlineTokens(o.mainContent),
1043
+ nestedTokens: c
783
1044
  }),
784
1045
  // Allow recursive nesting
785
- customNestedParser: r
1046
+ customNestedParser: s
786
1047
  },
787
- s
1048
+ n
788
1049
  );
789
- return l ? [
1050
+ return a ? [
790
1051
  {
791
1052
  type: "taskList",
792
- raw: l.raw,
793
- items: l.items
1053
+ raw: a.raw,
1054
+ items: a.items
794
1055
  }
795
- ] : s.blockTokens(i);
796
- }, n = w(
1056
+ ] : n.blockTokens(i);
1057
+ }, r = O(
797
1058
  t,
798
1059
  {
799
1060
  itemPattern: /^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,
@@ -802,26 +1063,26 @@ var ct = "listItem", H = "textStyle", S = /^(\d+)\.\s$/, pt = g.create({
802
1063
  mainContent: i[4],
803
1064
  checked: i[3].toLowerCase() === "x"
804
1065
  }),
805
- createToken: (i, l) => ({
1066
+ createToken: (i, a) => ({
806
1067
  type: "taskItem",
807
1068
  raw: "",
808
1069
  mainContent: i.mainContent,
809
1070
  indentLevel: i.indentLevel,
810
1071
  checked: i.checked,
811
1072
  text: i.mainContent,
812
- tokens: s.inlineTokens(i.mainContent),
813
- nestedTokens: l
1073
+ tokens: n.inlineTokens(i.mainContent),
1074
+ nestedTokens: a
814
1075
  }),
815
1076
  // Use the recursive parser for nested content
816
- customNestedParser: r
1077
+ customNestedParser: s
817
1078
  },
818
- s
1079
+ n
819
1080
  );
820
- if (n)
1081
+ if (r)
821
1082
  return {
822
1083
  type: "taskList",
823
- raw: n.raw,
824
- items: n.items
1084
+ raw: r.raw,
1085
+ items: r.items
825
1086
  };
826
1087
  }
827
1088
  },
@@ -839,22 +1100,32 @@ var ct = "listItem", H = "textStyle", S = /^(\d+)\.\s$/, pt = g.create({
839
1100
  };
840
1101
  }
841
1102
  });
842
- A.create({
1103
+ _.create({
843
1104
  name: "listKit",
844
1105
  addExtensions() {
845
1106
  const t = [];
846
- return this.options.bulletList !== !1 && t.push(q.configure(this.options.bulletList)), this.options.listItem !== !1 && t.push(tt.configure(this.options.listItem)), this.options.listKeymap !== !1 && t.push(it.configure(this.options.listKeymap)), this.options.orderedList !== !1 && t.push(pt.configure(this.options.orderedList)), this.options.taskItem !== !1 && t.push(mt.configure(this.options.taskItem)), this.options.taskList !== !1 && t.push(ft.configure(this.options.taskList)), t;
1107
+ return this.options.bulletList !== !1 && t.push(ut.configure(this.options.bulletList)), this.options.listItem !== !1 && t.push(Tt.configure(this.options.listItem)), this.options.listKeymap !== !1 && t.push(wt.configure(this.options.listKeymap)), this.options.orderedList !== !1 && t.push(Ht.configure(this.options.orderedList)), this.options.taskItem !== !1 && t.push(jt.configure(this.options.taskItem)), this.options.taskList !== !1 && t.push(Kt.configure(this.options.taskList)), t;
847
1108
  }
848
1109
  });
849
1110
  export {
850
- q as BulletList,
851
- tt as ListItem,
852
- it as ListKeymap,
853
- pt as OrderedList,
854
- mt as TaskItem,
855
- ft as TaskList,
856
- N as bulletListInputRegex,
857
- ht as inputRegex,
858
- et as listHelpers,
859
- S as orderedListInputRegex
1111
+ ut as BulletList,
1112
+ Tt as ListItem,
1113
+ wt as ListKeymap,
1114
+ S as ORDERED_LIST_MARKER_PATTERN,
1115
+ Ht as OrderedList,
1116
+ jt as TaskItem,
1117
+ Kt as TaskList,
1118
+ Lt as areOrderedListMarkersSequential,
1119
+ yt as buildOrderedListAttrsFromMarker,
1120
+ H as bulletListInputRegex,
1121
+ x as detectMarkerType,
1122
+ gt as getListMarker,
1123
+ Bt as inputRegex,
1124
+ It as listHelpers,
1125
+ R as markerToStart,
1126
+ j as orderedListInputRegex,
1127
+ kt as parseListMarker,
1128
+ Dt as parsePlainTextOrderedListPaste,
1129
+ A as toRoman,
1130
+ $ as toRomanUpper
860
1131
  };