@vizel/core 0.0.1-alpha.5 → 0.0.1-alpha.6

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 (49) hide show
  1. package/dist/index10.js +1 -1
  2. package/dist/index11.js +2 -2
  3. package/dist/index14.js +1 -1
  4. package/dist/index20.js +2 -2
  5. package/dist/index21.js +2 -2
  6. package/dist/index22.js +3 -3
  7. package/dist/index26.js +1 -1
  8. package/dist/index3.js +1 -1
  9. package/dist/index31.js +2 -2
  10. package/dist/index34.js +16 -63
  11. package/dist/index35.js +58 -4
  12. package/dist/index36.js +15 -123
  13. package/dist/index37.js +42 -305
  14. package/dist/index38.js +4 -487
  15. package/dist/index39.js +112 -37
  16. package/dist/index4.js +1 -1
  17. package/dist/index40.js +301 -653
  18. package/dist/index41.js +487 -4
  19. package/dist/index42.js +48 -4
  20. package/dist/index43.js +647 -206
  21. package/dist/index44.js +4 -82
  22. package/dist/index45.js +4 -17
  23. package/dist/index46.js +237 -57
  24. package/dist/index47.js +82 -15
  25. package/dist/index48.js +5 -5
  26. package/dist/index49.js +1458 -158
  27. package/dist/index5.js +1 -1
  28. package/dist/index50.js +5 -1502
  29. package/dist/index51.js +202 -5
  30. package/dist/index54.js +21 -84
  31. package/dist/index55.js +10 -246
  32. package/dist/index56.js +7 -3
  33. package/dist/index57.js +7 -1231
  34. package/dist/index58.js +11 -731
  35. package/dist/index59.js +19 -21
  36. package/dist/index6.js +1 -1
  37. package/dist/index60.js +25 -10
  38. package/dist/index61.js +83 -6
  39. package/dist/index62.js +245 -7
  40. package/dist/index63.js +3 -14
  41. package/dist/index64.js +1230 -17
  42. package/dist/index65.js +733 -24
  43. package/dist/index66.js +1059 -53
  44. package/dist/index67.js +53 -1059
  45. package/dist/index68.js +3 -90
  46. package/dist/index70.js +90 -3
  47. package/dist/index8.js +1 -1
  48. package/dist/index9.js +1 -1
  49. package/package.json +1 -1
package/dist/index57.js CHANGED
@@ -1,1234 +1,10 @@
1
- function I(h, t, e) {
2
- for (let n = 0; ; n++) {
3
- if (n == h.childCount || n == t.childCount)
4
- return h.childCount == t.childCount ? null : e;
5
- let i = h.child(n), r = t.child(n);
6
- if (i == r) {
7
- e += i.nodeSize;
8
- continue;
9
- }
10
- if (!i.sameMarkup(r))
11
- return e;
12
- if (i.isText && i.text != r.text) {
13
- for (let s = 0; i.text[s] == r.text[s]; s++)
14
- e++;
15
- return e;
16
- }
17
- if (i.content.size || r.content.size) {
18
- let s = I(i.content, r.content, e + 1);
19
- if (s != null)
20
- return s;
21
- }
22
- e += i.nodeSize;
23
- }
24
- }
25
- function D(h, t, e, n) {
26
- for (let i = h.childCount, r = t.childCount; ; ) {
27
- if (i == 0 || r == 0)
28
- return i == r ? null : { a: e, b: n };
29
- let s = h.child(--i), o = t.child(--r), l = s.nodeSize;
30
- if (s == o) {
31
- e -= l, n -= l;
32
- continue;
33
- }
34
- if (!s.sameMarkup(o))
35
- return { a: e, b: n };
36
- if (s.isText && s.text != o.text) {
37
- let f = 0, a = Math.min(s.text.length, o.text.length);
38
- for (; f < a && s.text[s.text.length - f - 1] == o.text[o.text.length - f - 1]; )
39
- f++, e--, n--;
40
- return { a: e, b: n };
41
- }
42
- if (s.content.size || o.content.size) {
43
- let f = D(s.content, o.content, e - 1, n - 1);
44
- if (f)
45
- return f;
46
- }
47
- e -= l, n -= l;
48
- }
49
- }
50
- class c {
51
- /**
52
- @internal
53
- */
54
- constructor(t, e) {
55
- if (this.content = t, this.size = e || 0, e == null)
56
- for (let n = 0; n < t.length; n++)
57
- this.size += t[n].nodeSize;
58
- }
59
- /**
60
- Invoke a callback for all descendant nodes between the given two
61
- positions (relative to start of this fragment). Doesn't descend
62
- into a node when the callback returns `false`.
63
- */
64
- nodesBetween(t, e, n, i = 0, r) {
65
- for (let s = 0, o = 0; o < e; s++) {
66
- let l = this.content[s], f = o + l.nodeSize;
67
- if (f > t && n(l, i + o, r || null, s) !== !1 && l.content.size) {
68
- let a = o + 1;
69
- l.nodesBetween(Math.max(0, t - a), Math.min(l.content.size, e - a), n, i + a);
70
- }
71
- o = f;
72
- }
73
- }
74
- /**
75
- Call the given callback for every descendant node. `pos` will be
76
- relative to the start of the fragment. The callback may return
77
- `false` to prevent traversal of a given node's children.
78
- */
79
- descendants(t) {
80
- this.nodesBetween(0, this.size, t);
81
- }
82
- /**
83
- Extract the text between `from` and `to`. See the same method on
84
- [`Node`](https://prosemirror.net/docs/ref/#model.Node.textBetween).
85
- */
86
- textBetween(t, e, n, i) {
87
- let r = "", s = !0;
88
- return this.nodesBetween(t, e, (o, l) => {
89
- let f = o.isText ? o.text.slice(Math.max(t, l) - l, e - l) : o.isLeaf ? i ? typeof i == "function" ? i(o) : i : o.type.spec.leafText ? o.type.spec.leafText(o) : "" : "";
90
- o.isBlock && (o.isLeaf && f || o.isTextblock) && n && (s ? s = !1 : r += n), r += f;
91
- }, 0), r;
92
- }
93
- /**
94
- Create a new fragment containing the combined content of this
95
- fragment and the other.
96
- */
97
- append(t) {
98
- if (!t.size)
99
- return this;
100
- if (!this.size)
101
- return t;
102
- let e = this.lastChild, n = t.firstChild, i = this.content.slice(), r = 0;
103
- for (e.isText && e.sameMarkup(n) && (i[i.length - 1] = e.withText(e.text + n.text), r = 1); r < t.content.length; r++)
104
- i.push(t.content[r]);
105
- return new c(i, this.size + t.size);
106
- }
107
- /**
108
- Cut out the sub-fragment between the two given positions.
109
- */
110
- cut(t, e = this.size) {
111
- if (t == 0 && e == this.size)
112
- return this;
113
- let n = [], i = 0;
114
- if (e > t)
115
- for (let r = 0, s = 0; s < e; r++) {
116
- let o = this.content[r], l = s + o.nodeSize;
117
- l > t && ((s < t || l > e) && (o.isText ? o = o.cut(Math.max(0, t - s), Math.min(o.text.length, e - s)) : o = o.cut(Math.max(0, t - s - 1), Math.min(o.content.size, e - s - 1))), n.push(o), i += o.nodeSize), s = l;
118
- }
119
- return new c(n, i);
120
- }
121
- /**
122
- @internal
123
- */
124
- cutByIndex(t, e) {
125
- return t == e ? c.empty : t == 0 && e == this.content.length ? this : new c(this.content.slice(t, e));
126
- }
127
- /**
128
- Create a new fragment in which the node at the given index is
129
- replaced by the given node.
130
- */
131
- replaceChild(t, e) {
132
- let n = this.content[t];
133
- if (n == e)
134
- return this;
135
- let i = this.content.slice(), r = this.size + e.nodeSize - n.nodeSize;
136
- return i[t] = e, new c(i, r);
137
- }
138
- /**
139
- Create a new fragment by prepending the given node to this
140
- fragment.
141
- */
142
- addToStart(t) {
143
- return new c([t].concat(this.content), this.size + t.nodeSize);
144
- }
145
- /**
146
- Create a new fragment by appending the given node to this
147
- fragment.
148
- */
149
- addToEnd(t) {
150
- return new c(this.content.concat(t), this.size + t.nodeSize);
151
- }
152
- /**
153
- Compare this fragment to another one.
154
- */
155
- eq(t) {
156
- if (this.content.length != t.content.length)
157
- return !1;
158
- for (let e = 0; e < this.content.length; e++)
159
- if (!this.content[e].eq(t.content[e]))
160
- return !1;
161
- return !0;
162
- }
163
- /**
164
- The first child of the fragment, or `null` if it is empty.
165
- */
166
- get firstChild() {
167
- return this.content.length ? this.content[0] : null;
168
- }
169
- /**
170
- The last child of the fragment, or `null` if it is empty.
171
- */
172
- get lastChild() {
173
- return this.content.length ? this.content[this.content.length - 1] : null;
174
- }
175
- /**
176
- The number of child nodes in this fragment.
177
- */
178
- get childCount() {
179
- return this.content.length;
180
- }
181
- /**
182
- Get the child node at the given index. Raise an error when the
183
- index is out of range.
184
- */
185
- child(t) {
186
- let e = this.content[t];
187
- if (!e)
188
- throw new RangeError("Index " + t + " out of range for " + this);
189
- return e;
190
- }
191
- /**
192
- Get the child node at the given index, if it exists.
193
- */
194
- maybeChild(t) {
195
- return this.content[t] || null;
196
- }
197
- /**
198
- Call `f` for every child node, passing the node, its offset
199
- into this parent node, and its index.
200
- */
201
- forEach(t) {
202
- for (let e = 0, n = 0; e < this.content.length; e++) {
203
- let i = this.content[e];
204
- t(i, n, e), n += i.nodeSize;
205
- }
206
- }
207
- /**
208
- Find the first position at which this fragment and another
209
- fragment differ, or `null` if they are the same.
210
- */
211
- findDiffStart(t, e = 0) {
212
- return I(this, t, e);
213
- }
214
- /**
215
- Find the first position, searching from the end, at which this
216
- fragment and the given fragment differ, or `null` if they are
217
- the same. Since this position will not be the same in both
218
- nodes, an object with two separate positions is returned.
219
- */
220
- findDiffEnd(t, e = this.size, n = t.size) {
221
- return D(this, t, e, n);
222
- }
223
- /**
224
- Find the index and inner offset corresponding to a given relative
225
- position in this fragment. The result object will be reused
226
- (overwritten) the next time the function is called. @internal
227
- */
228
- findIndex(t) {
229
- if (t == 0)
230
- return x(0, t);
231
- if (t == this.size)
232
- return x(this.content.length, t);
233
- if (t > this.size || t < 0)
234
- throw new RangeError(`Position ${t} outside of fragment (${this})`);
235
- for (let e = 0, n = 0; ; e++) {
236
- let i = this.child(e), r = n + i.nodeSize;
237
- if (r >= t)
238
- return r == t ? x(e + 1, r) : x(e, n);
239
- n = r;
240
- }
241
- }
242
- /**
243
- Return a debugging string that describes this fragment.
244
- */
245
- toString() {
246
- return "<" + this.toStringInner() + ">";
247
- }
248
- /**
249
- @internal
250
- */
251
- toStringInner() {
252
- return this.content.join(", ");
253
- }
254
- /**
255
- Create a JSON-serializeable representation of this fragment.
256
- */
257
- toJSON() {
258
- return this.content.length ? this.content.map((t) => t.toJSON()) : null;
259
- }
260
- /**
261
- Deserialize a fragment from its JSON representation.
262
- */
263
- static fromJSON(t, e) {
264
- if (!e)
265
- return c.empty;
266
- if (!Array.isArray(e))
267
- throw new RangeError("Invalid input for Fragment.fromJSON");
268
- return new c(e.map(t.nodeFromJSON));
269
- }
270
- /**
271
- Build a fragment from an array of nodes. Ensures that adjacent
272
- text nodes with the same marks are joined together.
273
- */
274
- static fromArray(t) {
275
- if (!t.length)
276
- return c.empty;
277
- let e, n = 0;
278
- for (let i = 0; i < t.length; i++) {
279
- let r = t[i];
280
- n += r.nodeSize, i && r.isText && t[i - 1].sameMarkup(r) ? (e || (e = t.slice(0, i)), e[e.length - 1] = r.withText(e[e.length - 1].text + r.text)) : e && e.push(r);
281
- }
282
- return new c(e || t, n);
283
- }
284
- /**
285
- Create a fragment from something that can be interpreted as a
286
- set of nodes. For `null`, it returns the empty fragment. For a
287
- fragment, the fragment itself. For a node or array of nodes, a
288
- fragment containing those nodes.
289
- */
290
- static from(t) {
291
- if (!t)
292
- return c.empty;
293
- if (t instanceof c)
294
- return t;
295
- if (Array.isArray(t))
296
- return this.fromArray(t);
297
- if (t.attrs)
298
- return new c([t], t.nodeSize);
299
- throw new RangeError("Can not convert " + t + " to a Fragment" + (t.nodesBetween ? " (looks like multiple versions of prosemirror-model were loaded)" : ""));
300
- }
301
- }
302
- c.empty = new c([], 0);
303
- const E = { index: 0, offset: 0 };
304
- function x(h, t) {
305
- return E.index = h, E.offset = t, E;
306
- }
307
- function k(h, t) {
308
- if (h === t)
309
- return !0;
310
- if (!(h && typeof h == "object") || !(t && typeof t == "object"))
311
- return !1;
312
- let e = Array.isArray(h);
313
- if (Array.isArray(t) != e)
314
- return !1;
315
- if (e) {
316
- if (h.length != t.length)
317
- return !1;
318
- for (let n = 0; n < h.length; n++)
319
- if (!k(h[n], t[n]))
320
- return !1;
321
- } else {
322
- for (let n in h)
323
- if (!(n in t) || !k(h[n], t[n]))
324
- return !1;
325
- for (let n in t)
326
- if (!(n in h))
327
- return !1;
328
- }
329
- return !0;
330
- }
331
- class p {
332
- /**
333
- @internal
334
- */
335
- constructor(t, e) {
336
- this.type = t, this.attrs = e;
337
- }
338
- /**
339
- Given a set of marks, create a new set which contains this one as
340
- well, in the right position. If this mark is already in the set,
341
- the set itself is returned. If any marks that are set to be
342
- [exclusive](https://prosemirror.net/docs/ref/#model.MarkSpec.excludes) with this mark are present,
343
- those are replaced by this one.
344
- */
345
- addToSet(t) {
346
- let e, n = !1;
347
- for (let i = 0; i < t.length; i++) {
348
- let r = t[i];
349
- if (this.eq(r))
350
- return t;
351
- if (this.type.excludes(r.type))
352
- e || (e = t.slice(0, i));
353
- else {
354
- if (r.type.excludes(this.type))
355
- return t;
356
- !n && r.type.rank > this.type.rank && (e || (e = t.slice(0, i)), e.push(this), n = !0), e && e.push(r);
357
- }
358
- }
359
- return e || (e = t.slice()), n || e.push(this), e;
360
- }
361
- /**
362
- Remove this mark from the given set, returning a new set. If this
363
- mark is not in the set, the set itself is returned.
364
- */
365
- removeFromSet(t) {
366
- for (let e = 0; e < t.length; e++)
367
- if (this.eq(t[e]))
368
- return t.slice(0, e).concat(t.slice(e + 1));
369
- return t;
370
- }
371
- /**
372
- Test whether this mark is in the given set of marks.
373
- */
374
- isInSet(t) {
375
- for (let e = 0; e < t.length; e++)
376
- if (this.eq(t[e]))
377
- return !0;
378
- return !1;
379
- }
380
- /**
381
- Test whether this mark has the same type and attributes as
382
- another mark.
383
- */
384
- eq(t) {
385
- return this == t || this.type == t.type && k(this.attrs, t.attrs);
386
- }
387
- /**
388
- Convert this mark to a JSON-serializeable representation.
389
- */
390
- toJSON() {
391
- let t = { type: this.type.name };
392
- for (let e in this.attrs) {
393
- t.attrs = this.attrs;
394
- break;
395
- }
396
- return t;
397
- }
398
- /**
399
- Deserialize a mark from JSON.
400
- */
401
- static fromJSON(t, e) {
402
- if (!e)
403
- throw new RangeError("Invalid input for Mark.fromJSON");
404
- let n = t.marks[e.type];
405
- if (!n)
406
- throw new RangeError(`There is no mark type ${e.type} in this schema`);
407
- let i = n.create(e.attrs);
408
- return n.checkAttrs(i.attrs), i;
409
- }
410
- /**
411
- Test whether two sets of marks are identical.
412
- */
413
- static sameSet(t, e) {
414
- if (t == e)
415
- return !0;
416
- if (t.length != e.length)
417
- return !1;
418
- for (let n = 0; n < t.length; n++)
419
- if (!t[n].eq(e[n]))
420
- return !1;
421
- return !0;
422
- }
423
- /**
424
- Create a properly sorted mark set from null, a single mark, or an
425
- unsorted array of marks.
426
- */
427
- static setFrom(t) {
428
- if (!t || Array.isArray(t) && t.length == 0)
429
- return p.none;
430
- if (t instanceof p)
431
- return [t];
432
- let e = t.slice();
433
- return e.sort((n, i) => n.type.rank - i.type.rank), e;
434
- }
435
- }
436
- p.none = [];
437
- class K extends Error {
438
- }
439
- class d {
440
- /**
441
- Create a slice. When specifying a non-zero open depth, you must
442
- make sure that there are nodes of at least that depth at the
443
- appropriate side of the fragment—i.e. if the fragment is an
444
- empty paragraph node, `openStart` and `openEnd` can't be greater
445
- than 1.
446
-
447
- It is not necessary for the content of open nodes to conform to
448
- the schema's content constraints, though it should be a valid
449
- start/end/middle for such a node, depending on which sides are
450
- open.
451
- */
452
- constructor(t, e, n) {
453
- this.content = t, this.openStart = e, this.openEnd = n;
454
- }
455
- /**
456
- The size this slice would add when inserted into a document.
457
- */
458
- get size() {
459
- return this.content.size - this.openStart - this.openEnd;
460
- }
461
- /**
462
- @internal
463
- */
464
- insertAt(t, e) {
465
- let n = v(this.content, t + this.openStart, e);
466
- return n && new d(n, this.openStart, this.openEnd);
467
- }
468
- /**
469
- @internal
470
- */
471
- removeBetween(t, e) {
472
- return new d(B(this.content, t + this.openStart, e + this.openStart), this.openStart, this.openEnd);
473
- }
474
- /**
475
- Tests whether this slice is equal to another slice.
476
- */
477
- eq(t) {
478
- return this.content.eq(t.content) && this.openStart == t.openStart && this.openEnd == t.openEnd;
479
- }
480
- /**
481
- @internal
482
- */
483
- toString() {
484
- return this.content + "(" + this.openStart + "," + this.openEnd + ")";
485
- }
486
- /**
487
- Convert a slice to a JSON-serializable representation.
488
- */
489
- toJSON() {
490
- if (!this.content.size)
491
- return null;
492
- let t = { content: this.content.toJSON() };
493
- return this.openStart > 0 && (t.openStart = this.openStart), this.openEnd > 0 && (t.openEnd = this.openEnd), t;
494
- }
495
- /**
496
- Deserialize a slice from its JSON representation.
497
- */
498
- static fromJSON(t, e) {
499
- if (!e)
500
- return d.empty;
501
- let n = e.openStart || 0, i = e.openEnd || 0;
502
- if (typeof n != "number" || typeof i != "number")
503
- throw new RangeError("Invalid input for Slice.fromJSON");
504
- return new d(c.fromJSON(t, e.content), n, i);
505
- }
506
- /**
507
- Create a slice from a fragment by taking the maximum possible
508
- open value on both side of the fragment.
509
- */
510
- static maxOpen(t, e = !0) {
511
- let n = 0, i = 0;
512
- for (let r = t.firstChild; r && !r.isLeaf && (e || !r.type.spec.isolating); r = r.firstChild)
513
- n++;
514
- for (let r = t.lastChild; r && !r.isLeaf && (e || !r.type.spec.isolating); r = r.lastChild)
515
- i++;
516
- return new d(t, n, i);
517
- }
518
- }
519
- d.empty = new d(c.empty, 0, 0);
520
- function B(h, t, e) {
521
- let { index: n, offset: i } = h.findIndex(t), r = h.maybeChild(n), { index: s, offset: o } = h.findIndex(e);
522
- if (i == t || r.isText) {
523
- if (o != e && !h.child(s).isText)
524
- throw new RangeError("Removing non-flat range");
525
- return h.cut(0, t).append(h.cut(e));
526
- }
527
- if (n != s)
528
- throw new RangeError("Removing non-flat range");
529
- return h.replaceChild(n, r.copy(B(r.content, t - i - 1, e - i - 1)));
530
- }
531
- function v(h, t, e, n) {
532
- let { index: i, offset: r } = h.findIndex(t), s = h.maybeChild(i);
533
- if (r == t || s.isText)
534
- return n && !n.canReplace(i, i, e) ? null : h.cut(0, t).append(e).append(h.cut(t));
535
- let o = v(s.content, t - r - 1, e, s);
536
- return o && h.replaceChild(i, s.copy(o));
537
- }
538
- function F(h) {
539
- return h.tag != null;
540
- }
541
- function $(h) {
542
- return h.style != null;
543
- }
544
- class z {
545
- /**
546
- Create a parser that targets the given schema, using the given
547
- parsing rules.
548
- */
549
- constructor(t, e) {
550
- this.schema = t, this.rules = e, this.tags = [], this.styles = [];
551
- let n = this.matchedStyles = [];
552
- e.forEach((i) => {
553
- if (F(i))
554
- this.tags.push(i);
555
- else if ($(i)) {
556
- let r = /[^=]*/.exec(i.style)[0];
557
- n.indexOf(r) < 0 && n.push(r), this.styles.push(i);
558
- }
559
- }), this.normalizeLists = !this.tags.some((i) => {
560
- if (!/^(ul|ol)\b/.test(i.tag) || !i.node)
561
- return !1;
562
- let r = t.nodes[i.node];
563
- return r.contentMatch.matchType(r);
564
- });
565
- }
566
- /**
567
- Parse a document from the content of a DOM node.
568
- */
569
- parse(t, e = {}) {
570
- let n = new N(this, e, !1);
571
- return n.addAll(t, p.none, e.from, e.to), n.finish();
572
- }
573
- /**
574
- Parses the content of the given DOM node, like
575
- [`parse`](https://prosemirror.net/docs/ref/#model.DOMParser.parse), and takes the same set of
576
- options. But unlike that method, which produces a whole node,
577
- this one returns a slice that is open at the sides, meaning that
578
- the schema constraints aren't applied to the start of nodes to
579
- the left of the input and the end of nodes at the end.
580
- */
581
- parseSlice(t, e = {}) {
582
- let n = new N(this, e, !0);
583
- return n.addAll(t, p.none, e.from, e.to), d.maxOpen(n.finish());
584
- }
585
- /**
586
- @internal
587
- */
588
- matchTag(t, e, n) {
589
- for (let i = n ? this.tags.indexOf(n) + 1 : 0; i < this.tags.length; i++) {
590
- let r = this.tags[i];
591
- if (U(t, r.tag) && (r.namespace === void 0 || t.namespaceURI == r.namespace) && (!r.context || e.matchesContext(r.context))) {
592
- if (r.getAttrs) {
593
- let s = r.getAttrs(t);
594
- if (s === !1)
595
- continue;
596
- r.attrs = s || void 0;
597
- }
598
- return r;
599
- }
600
- }
601
- }
602
- /**
603
- @internal
604
- */
605
- matchStyle(t, e, n, i) {
606
- for (let r = i ? this.styles.indexOf(i) + 1 : 0; r < this.styles.length; r++) {
607
- let s = this.styles[r], o = s.style;
608
- if (!(o.indexOf(t) != 0 || s.context && !n.matchesContext(s.context) || // Test that the style string either precisely matches the prop,
609
- // or has an '=' sign after the prop, followed by the given
610
- // value.
611
- o.length > t.length && (o.charCodeAt(t.length) != 61 || o.slice(t.length + 1) != e))) {
612
- if (s.getAttrs) {
613
- let l = s.getAttrs(e);
614
- if (l === !1)
615
- continue;
616
- s.attrs = l || void 0;
617
- }
618
- return s;
619
- }
620
- }
621
- }
622
- /**
623
- @internal
624
- */
625
- static schemaRules(t) {
626
- let e = [];
627
- function n(i) {
628
- let r = i.priority == null ? 50 : i.priority, s = 0;
629
- for (; s < e.length; s++) {
630
- let o = e[s];
631
- if ((o.priority == null ? 50 : o.priority) < r)
632
- break;
633
- }
634
- e.splice(s, 0, i);
635
- }
636
- for (let i in t.marks) {
637
- let r = t.marks[i].spec.parseDOM;
638
- r && r.forEach((s) => {
639
- n(s = P(s)), s.mark || s.ignore || s.clearMark || (s.mark = i);
640
- });
641
- }
642
- for (let i in t.nodes) {
643
- let r = t.nodes[i].spec.parseDOM;
644
- r && r.forEach((s) => {
645
- n(s = P(s)), s.node || s.ignore || s.mark || (s.node = i);
646
- });
647
- }
648
- return e;
649
- }
650
- /**
651
- Construct a DOM parser using the parsing rules listed in a
652
- schema's [node specs](https://prosemirror.net/docs/ref/#model.NodeSpec.parseDOM), reordered by
653
- [priority](https://prosemirror.net/docs/ref/#model.GenericParseRule.priority).
654
- */
655
- static fromSchema(t) {
656
- return t.cached.domParser || (t.cached.domParser = new z(t, z.schemaRules(t)));
657
- }
658
- }
659
- const L = {
660
- address: !0,
661
- article: !0,
662
- aside: !0,
663
- blockquote: !0,
664
- canvas: !0,
665
- dd: !0,
666
- div: !0,
667
- dl: !0,
668
- fieldset: !0,
669
- figcaption: !0,
670
- figure: !0,
671
- footer: !0,
672
- form: !0,
673
- h1: !0,
674
- h2: !0,
675
- h3: !0,
676
- h4: !0,
677
- h5: !0,
678
- h6: !0,
679
- header: !0,
680
- hgroup: !0,
681
- hr: !0,
682
- li: !0,
683
- noscript: !0,
684
- ol: !0,
685
- output: !0,
686
- p: !0,
687
- pre: !0,
688
- section: !0,
689
- table: !0,
690
- tfoot: !0,
691
- ul: !0
692
- }, V = {
693
- head: !0,
694
- noscript: !0,
695
- object: !0,
696
- script: !0,
697
- style: !0,
698
- title: !0
699
- }, W = { ol: !0, ul: !0 }, m = 1, M = 2, g = 4;
700
- function O(h, t, e) {
701
- return t != null ? (t ? m : 0) | (t === "full" ? M : 0) : h && h.whitespace == "pre" ? m | M : e & ~g;
702
- }
703
- class S {
704
- constructor(t, e, n, i, r, s) {
705
- this.type = t, this.attrs = e, this.marks = n, this.solid = i, this.options = s, this.content = [], this.activeMarks = p.none, this.match = r || (s & g ? null : t.contentMatch);
706
- }
707
- findWrapping(t) {
708
- if (!this.match) {
709
- if (!this.type)
710
- return [];
711
- let e = this.type.contentMatch.fillBefore(c.from(t));
712
- if (e)
713
- this.match = this.type.contentMatch.matchFragment(e);
714
- else {
715
- let n = this.type.contentMatch, i;
716
- return (i = n.findWrapping(t.type)) ? (this.match = n, i) : null;
717
- }
718
- }
719
- return this.match.findWrapping(t.type);
720
- }
721
- finish(t) {
722
- if (!(this.options & m)) {
723
- let n = this.content[this.content.length - 1], i;
724
- if (n && n.isText && (i = /[ \t\r\n\u000c]+$/.exec(n.text))) {
725
- let r = n;
726
- n.text.length == i[0].length ? this.content.pop() : this.content[this.content.length - 1] = r.withText(r.text.slice(0, r.text.length - i[0].length));
727
- }
728
- }
729
- let e = c.from(this.content);
730
- return !t && this.match && (e = e.append(this.match.fillBefore(c.empty, !0))), this.type ? this.type.create(this.attrs, e, this.marks) : e;
731
- }
732
- inlineContext(t) {
733
- return this.type ? this.type.inlineContent : this.content.length ? this.content[0].isInline : t.parentNode && !L.hasOwnProperty(t.parentNode.nodeName.toLowerCase());
734
- }
735
- }
736
- class N {
737
- constructor(t, e, n) {
738
- this.parser = t, this.options = e, this.isOpen = n, this.open = 0, this.localPreserveWS = !1;
739
- let i = e.topNode, r, s = O(null, e.preserveWhitespace, 0) | (n ? g : 0);
740
- i ? r = new S(i.type, i.attrs, p.none, !0, e.topMatch || i.type.contentMatch, s) : n ? r = new S(null, null, p.none, !0, null, s) : r = new S(t.schema.topNodeType, null, p.none, !0, null, s), this.nodes = [r], this.find = e.findPositions, this.needsBlock = !1;
741
- }
742
- get top() {
743
- return this.nodes[this.open];
744
- }
745
- // Add a DOM node to the content. Text is inserted as text node,
746
- // otherwise, the node is passed to `addElement` or, if it has a
747
- // `style` attribute, `addElementWithStyles`.
748
- addDOM(t, e) {
749
- t.nodeType == 3 ? this.addTextNode(t, e) : t.nodeType == 1 && this.addElement(t, e);
750
- }
751
- addTextNode(t, e) {
752
- let n = t.nodeValue, i = this.top, r = i.options & M ? "full" : this.localPreserveWS || (i.options & m) > 0, { schema: s } = this.parser;
753
- if (r === "full" || i.inlineContext(t) || /[^ \t\r\n\u000c]/.test(n)) {
754
- if (r)
755
- if (r === "full")
756
- n = n.replace(/\r\n?/g, `
757
- `);
758
- else if (s.linebreakReplacement && /[\r\n]/.test(n) && this.top.findWrapping(s.linebreakReplacement.create())) {
759
- let o = n.split(/\r?\n|\r/);
760
- for (let l = 0; l < o.length; l++)
761
- l && this.insertNode(s.linebreakReplacement.create(), e, !0), o[l] && this.insertNode(s.text(o[l]), e, !/\S/.test(o[l]));
762
- n = "";
763
- } else
764
- n = n.replace(/\r?\n|\r/g, " ");
765
- else if (n = n.replace(/[ \t\r\n\u000c]+/g, " "), /^[ \t\r\n\u000c]/.test(n) && this.open == this.nodes.length - 1) {
766
- let o = i.content[i.content.length - 1], l = t.previousSibling;
767
- (!o || l && l.nodeName == "BR" || o.isText && /[ \t\r\n\u000c]$/.test(o.text)) && (n = n.slice(1));
768
- }
769
- n && this.insertNode(s.text(n), e, !/\S/.test(n)), this.findInText(t);
770
- } else
771
- this.findInside(t);
772
- }
773
- // Try to find a handler for the given tag and use that to parse. If
774
- // none is found, the element's content nodes are added directly.
775
- addElement(t, e, n) {
776
- let i = this.localPreserveWS, r = this.top;
777
- (t.tagName == "PRE" || /pre/.test(t.style && t.style.whiteSpace)) && (this.localPreserveWS = !0);
778
- let s = t.nodeName.toLowerCase(), o;
779
- W.hasOwnProperty(s) && this.parser.normalizeLists && j(t);
780
- let l = this.options.ruleFromNode && this.options.ruleFromNode(t) || (o = this.parser.matchTag(t, this, n));
781
- t: if (l ? l.ignore : V.hasOwnProperty(s))
782
- this.findInside(t), this.ignoreFallback(t, e);
783
- else if (!l || l.skip || l.closeParent) {
784
- l && l.closeParent ? this.open = Math.max(0, this.open - 1) : l && l.skip.nodeType && (t = l.skip);
785
- let f, a = this.needsBlock;
786
- if (L.hasOwnProperty(s))
787
- r.content.length && r.content[0].isInline && this.open && (this.open--, r = this.top), f = !0, r.type || (this.needsBlock = !0);
788
- else if (!t.firstChild) {
789
- this.leafFallback(t, e);
790
- break t;
791
- }
792
- let u = l && l.skip ? e : this.readStyles(t, e);
793
- u && this.addAll(t, u), f && this.sync(r), this.needsBlock = a;
794
- } else {
795
- let f = this.readStyles(t, e);
796
- f && this.addElementByRule(t, l, f, l.consuming === !1 ? o : void 0);
797
- }
798
- this.localPreserveWS = i;
799
- }
800
- // Called for leaf DOM nodes that would otherwise be ignored
801
- leafFallback(t, e) {
802
- t.nodeName == "BR" && this.top.type && this.top.type.inlineContent && this.addTextNode(t.ownerDocument.createTextNode(`
803
- `), e);
804
- }
805
- // Called for ignored nodes
806
- ignoreFallback(t, e) {
807
- t.nodeName == "BR" && (!this.top.type || !this.top.type.inlineContent) && this.findPlace(this.parser.schema.text("-"), e, !0);
808
- }
809
- // Run any style parser associated with the node's styles. Either
810
- // return an updated array of marks, or null to indicate some of the
811
- // styles had a rule with `ignore` set.
812
- readStyles(t, e) {
813
- let n = t.style;
814
- if (n && n.length)
815
- for (let i = 0; i < this.parser.matchedStyles.length; i++) {
816
- let r = this.parser.matchedStyles[i], s = n.getPropertyValue(r);
817
- if (s)
818
- for (let o = void 0; ; ) {
819
- let l = this.parser.matchStyle(r, s, this, o);
820
- if (!l)
821
- break;
822
- if (l.ignore)
823
- return null;
824
- if (l.clearMark ? e = e.filter((f) => !l.clearMark(f)) : e = e.concat(this.parser.schema.marks[l.mark].create(l.attrs)), l.consuming === !1)
825
- o = l;
826
- else
827
- break;
828
- }
829
- }
830
- return e;
831
- }
832
- // Look up a handler for the given node. If none are found, return
833
- // false. Otherwise, apply it, use its return value to drive the way
834
- // the node's content is wrapped, and return true.
835
- addElementByRule(t, e, n, i) {
836
- let r, s;
837
- if (e.node)
838
- if (s = this.parser.schema.nodes[e.node], s.isLeaf)
839
- this.insertNode(s.create(e.attrs), n, t.nodeName == "BR") || this.leafFallback(t, n);
840
- else {
841
- let l = this.enter(s, e.attrs || null, n, e.preserveWhitespace);
842
- l && (r = !0, n = l);
843
- }
844
- else {
845
- let l = this.parser.schema.marks[e.mark];
846
- n = n.concat(l.create(e.attrs));
847
- }
848
- let o = this.top;
849
- if (s && s.isLeaf)
850
- this.findInside(t);
851
- else if (i)
852
- this.addElement(t, n, i);
853
- else if (e.getContent)
854
- this.findInside(t), e.getContent(t, this.parser.schema).forEach((l) => this.insertNode(l, n, !1));
855
- else {
856
- let l = t;
857
- typeof e.contentElement == "string" ? l = t.querySelector(e.contentElement) : typeof e.contentElement == "function" ? l = e.contentElement(t) : e.contentElement && (l = e.contentElement), this.findAround(t, l, !0), this.addAll(l, n), this.findAround(t, l, !1);
858
- }
859
- r && this.sync(o) && this.open--;
860
- }
861
- // Add all child nodes between `startIndex` and `endIndex` (or the
862
- // whole node, if not given). If `sync` is passed, use it to
863
- // synchronize after every block element.
864
- addAll(t, e, n, i) {
865
- let r = n || 0;
866
- for (let s = n ? t.childNodes[n] : t.firstChild, o = i == null ? null : t.childNodes[i]; s != o; s = s.nextSibling, ++r)
867
- this.findAtPoint(t, r), this.addDOM(s, e);
868
- this.findAtPoint(t, r);
869
- }
870
- // Try to find a way to fit the given node type into the current
871
- // context. May add intermediate wrappers and/or leave non-solid
872
- // nodes that we're in.
873
- findPlace(t, e, n) {
874
- let i, r;
875
- for (let s = this.open, o = 0; s >= 0; s--) {
876
- let l = this.nodes[s], f = l.findWrapping(t);
877
- if (f && (!i || i.length > f.length + o) && (i = f, r = l, !f.length))
878
- break;
879
- if (l.solid) {
880
- if (n)
881
- break;
882
- o += 2;
883
- }
884
- }
885
- if (!i)
886
- return null;
887
- this.sync(r);
888
- for (let s = 0; s < i.length; s++)
889
- e = this.enterInner(i[s], null, e, !1);
890
- return e;
891
- }
892
- // Try to insert the given node, adjusting the context when needed.
893
- insertNode(t, e, n) {
894
- if (t.isInline && this.needsBlock && !this.top.type) {
895
- let r = this.textblockFromContext();
896
- r && (e = this.enterInner(r, null, e));
897
- }
898
- let i = this.findPlace(t, e, n);
899
- if (i) {
900
- this.closeExtra();
901
- let r = this.top;
902
- r.match && (r.match = r.match.matchType(t.type));
903
- let s = p.none;
904
- for (let o of i.concat(t.marks))
905
- (r.type ? r.type.allowsMarkType(o.type) : R(o.type, t.type)) && (s = o.addToSet(s));
906
- return r.content.push(t.mark(s)), !0;
907
- }
908
- return !1;
909
- }
910
- // Try to start a node of the given type, adjusting the context when
911
- // necessary.
912
- enter(t, e, n, i) {
913
- let r = this.findPlace(t.create(e), n, !1);
914
- return r && (r = this.enterInner(t, e, n, !0, i)), r;
915
- }
916
- // Open a node of the given type
917
- enterInner(t, e, n, i = !1, r) {
918
- this.closeExtra();
919
- let s = this.top;
920
- s.match = s.match && s.match.matchType(t);
921
- let o = O(t, r, s.options);
922
- s.options & g && s.content.length == 0 && (o |= g);
923
- let l = p.none;
924
- return n = n.filter((f) => (s.type ? s.type.allowsMarkType(f.type) : R(f.type, t)) ? (l = f.addToSet(l), !1) : !0), this.nodes.push(new S(t, e, l, i, null, o)), this.open++, n;
925
- }
926
- // Make sure all nodes above this.open are finished and added to
927
- // their parents
928
- closeExtra(t = !1) {
929
- let e = this.nodes.length - 1;
930
- if (e > this.open) {
931
- for (; e > this.open; e--)
932
- this.nodes[e - 1].content.push(this.nodes[e].finish(t));
933
- this.nodes.length = this.open + 1;
934
- }
935
- }
936
- finish() {
937
- return this.open = 0, this.closeExtra(this.isOpen), this.nodes[0].finish(!!(this.isOpen || this.options.topOpen));
938
- }
939
- sync(t) {
940
- for (let e = this.open; e >= 0; e--) {
941
- if (this.nodes[e] == t)
942
- return this.open = e, !0;
943
- this.localPreserveWS && (this.nodes[e].options |= m);
944
- }
945
- return !1;
946
- }
947
- get currentPos() {
948
- this.closeExtra();
949
- let t = 0;
950
- for (let e = this.open; e >= 0; e--) {
951
- let n = this.nodes[e].content;
952
- for (let i = n.length - 1; i >= 0; i--)
953
- t += n[i].nodeSize;
954
- e && t++;
955
- }
956
- return t;
957
- }
958
- findAtPoint(t, e) {
959
- if (this.find)
960
- for (let n = 0; n < this.find.length; n++)
961
- this.find[n].node == t && this.find[n].offset == e && (this.find[n].pos = this.currentPos);
962
- }
963
- findInside(t) {
964
- if (this.find)
965
- for (let e = 0; e < this.find.length; e++)
966
- this.find[e].pos == null && t.nodeType == 1 && t.contains(this.find[e].node) && (this.find[e].pos = this.currentPos);
967
- }
968
- findAround(t, e, n) {
969
- if (t != e && this.find)
970
- for (let i = 0; i < this.find.length; i++)
971
- this.find[i].pos == null && t.nodeType == 1 && t.contains(this.find[i].node) && e.compareDocumentPosition(this.find[i].node) & (n ? 2 : 4) && (this.find[i].pos = this.currentPos);
972
- }
973
- findInText(t) {
974
- if (this.find)
975
- for (let e = 0; e < this.find.length; e++)
976
- this.find[e].node == t && (this.find[e].pos = this.currentPos - (t.nodeValue.length - this.find[e].offset));
977
- }
978
- // Determines whether the given context string matches this context.
979
- matchesContext(t) {
980
- if (t.indexOf("|") > -1)
981
- return t.split(/\s*\|\s*/).some(this.matchesContext, this);
982
- let e = t.split("/"), n = this.options.context, i = !this.isOpen && (!n || n.parent.type == this.nodes[0].type), r = -(n ? n.depth + 1 : 0) + (i ? 0 : 1), s = (o, l) => {
983
- for (; o >= 0; o--) {
984
- let f = e[o];
985
- if (f == "") {
986
- if (o == e.length - 1 || o == 0)
987
- continue;
988
- for (; l >= r; l--)
989
- if (s(o - 1, l))
990
- return !0;
991
- return !1;
992
- } else {
993
- let a = l > 0 || l == 0 && i ? this.nodes[l].type : n && l >= r ? n.node(l - r).type : null;
994
- if (!a || a.name != f && !a.isInGroup(f))
995
- return !1;
996
- l--;
997
- }
998
- }
999
- return !0;
1000
- };
1001
- return s(e.length - 1, this.open);
1002
- }
1003
- textblockFromContext() {
1004
- let t = this.options.context;
1005
- if (t)
1006
- for (let e = t.depth; e >= 0; e--) {
1007
- let n = t.node(e).contentMatchAt(t.indexAfter(e)).defaultType;
1008
- if (n && n.isTextblock && n.defaultAttrs)
1009
- return n;
1010
- }
1011
- for (let e in this.parser.schema.nodes) {
1012
- let n = this.parser.schema.nodes[e];
1013
- if (n.isTextblock && n.defaultAttrs)
1014
- return n;
1015
- }
1016
- }
1017
- }
1018
- function j(h) {
1019
- for (let t = h.firstChild, e = null; t; t = t.nextSibling) {
1020
- let n = t.nodeType == 1 ? t.nodeName.toLowerCase() : null;
1021
- n && W.hasOwnProperty(n) && e ? (e.appendChild(t), t = e) : n == "li" ? e = t : n && (e = null);
1022
- }
1023
- }
1024
- function U(h, t) {
1025
- return (h.matches || h.msMatchesSelector || h.webkitMatchesSelector || h.mozMatchesSelector).call(h, t);
1026
- }
1027
- function P(h) {
1028
- let t = {};
1029
- for (let e in h)
1030
- t[e] = h[e];
1031
- return t;
1032
- }
1033
- function R(h, t) {
1034
- let e = t.schema.nodes;
1035
- for (let n in e) {
1036
- let i = e[n];
1037
- if (!i.allowsMarkType(h))
1038
- continue;
1039
- let r = [], s = (o) => {
1040
- r.push(o);
1041
- for (let l = 0; l < o.edgeCount; l++) {
1042
- let { type: f, next: a } = o.edge(l);
1043
- if (f == t || r.indexOf(a) < 0 && s(a))
1044
- return !0;
1045
- }
1046
- };
1047
- if (s(i.contentMatch))
1048
- return !0;
1049
- }
1050
- }
1051
- class J {
1052
- /**
1053
- Create a serializer. `nodes` should map node names to functions
1054
- that take a node and return a description of the corresponding
1055
- DOM. `marks` does the same for mark names, but also gets an
1056
- argument that tells it whether the mark's content is block or
1057
- inline content (for typical use, it'll always be inline). A mark
1058
- serializer may be `null` to indicate that marks of that type
1059
- should not be serialized.
1060
- */
1061
- constructor(t, e) {
1062
- this.nodes = t, this.marks = e;
1063
- }
1064
- /**
1065
- Serialize the content of this fragment to a DOM fragment. When
1066
- not in the browser, the `document` option, containing a DOM
1067
- document, should be passed so that the serializer can create
1068
- nodes.
1069
- */
1070
- serializeFragment(t, e = {}, n) {
1071
- n || (n = T(e).createDocumentFragment());
1072
- let i = n, r = [];
1073
- return t.forEach((s) => {
1074
- if (r.length || s.marks.length) {
1075
- let o = 0, l = 0;
1076
- for (; o < r.length && l < s.marks.length; ) {
1077
- let f = s.marks[l];
1078
- if (!this.marks[f.type.name]) {
1079
- l++;
1080
- continue;
1081
- }
1082
- if (!f.eq(r[o][0]) || f.type.spec.spanning === !1)
1083
- break;
1084
- o++, l++;
1085
- }
1086
- for (; o < r.length; )
1087
- i = r.pop()[1];
1088
- for (; l < s.marks.length; ) {
1089
- let f = s.marks[l++], a = this.serializeMark(f, s.isInline, e);
1090
- a && (r.push([f, i]), i.appendChild(a.dom), i = a.contentDOM || a.dom);
1091
- }
1092
- }
1093
- i.appendChild(this.serializeNodeInner(s, e));
1094
- }), n;
1095
- }
1096
- /**
1097
- @internal
1098
- */
1099
- serializeNodeInner(t, e) {
1100
- let { dom: n, contentDOM: i } = w(T(e), this.nodes[t.type.name](t), null, t.attrs);
1101
- if (i) {
1102
- if (t.isLeaf)
1103
- throw new RangeError("Content hole not allowed in a leaf node spec");
1104
- this.serializeFragment(t.content, e, i);
1105
- }
1106
- return n;
1107
- }
1108
- /**
1109
- Serialize this node to a DOM node. This can be useful when you
1110
- need to serialize a part of a document, as opposed to the whole
1111
- document. To serialize a whole document, use
1112
- [`serializeFragment`](https://prosemirror.net/docs/ref/#model.DOMSerializer.serializeFragment) on
1113
- its [content](https://prosemirror.net/docs/ref/#model.Node.content).
1114
- */
1115
- serializeNode(t, e = {}) {
1116
- let n = this.serializeNodeInner(t, e);
1117
- for (let i = t.marks.length - 1; i >= 0; i--) {
1118
- let r = this.serializeMark(t.marks[i], t.isInline, e);
1119
- r && ((r.contentDOM || r.dom).appendChild(n), n = r.dom);
1120
- }
1121
- return n;
1122
- }
1123
- /**
1124
- @internal
1125
- */
1126
- serializeMark(t, e, n = {}) {
1127
- let i = this.marks[t.type.name];
1128
- return i && w(T(n), i(t, e), null, t.attrs);
1129
- }
1130
- static renderSpec(t, e, n = null, i) {
1131
- return w(t, e, n, i);
1132
- }
1133
- /**
1134
- Build a serializer using the [`toDOM`](https://prosemirror.net/docs/ref/#model.NodeSpec.toDOM)
1135
- properties in a schema's node and mark specs.
1136
- */
1137
- static fromSchema(t) {
1138
- return t.cached.domSerializer || (t.cached.domSerializer = new J(this.nodesFromSchema(t), this.marksFromSchema(t)));
1139
- }
1140
- /**
1141
- Gather the serializers in a schema's node specs into an object.
1142
- This can be useful as a base to build a custom serializer from.
1143
- */
1144
- static nodesFromSchema(t) {
1145
- let e = A(t.nodes);
1146
- return e.text || (e.text = (n) => n.text), e;
1147
- }
1148
- /**
1149
- Gather the serializers in a schema's mark specs into an object.
1150
- */
1151
- static marksFromSchema(t) {
1152
- return A(t.marks);
1153
- }
1154
- }
1155
- function A(h) {
1156
- let t = {};
1157
- for (let e in h) {
1158
- let n = h[e].spec.toDOM;
1159
- n && (t[e] = n);
1160
- }
1161
- return t;
1162
- }
1163
- function T(h) {
1164
- return h.document || window.document;
1165
- }
1166
- const b = /* @__PURE__ */ new WeakMap();
1167
- function G(h) {
1168
- let t = b.get(h);
1169
- return t === void 0 && b.set(h, t = H(h)), t;
1170
- }
1171
- function H(h) {
1172
- let t = null;
1173
- function e(n) {
1174
- if (n && typeof n == "object")
1175
- if (Array.isArray(n))
1176
- if (typeof n[0] == "string")
1177
- t || (t = []), t.push(n);
1178
- else
1179
- for (let i = 0; i < n.length; i++)
1180
- e(n[i]);
1181
- else
1182
- for (let i in n)
1183
- e(n[i]);
1184
- }
1185
- return e(h), t;
1186
- }
1187
- function w(h, t, e, n) {
1188
- if (typeof t == "string")
1189
- return { dom: h.createTextNode(t) };
1190
- if (t.nodeType != null)
1191
- return { dom: t };
1192
- if (t.dom && t.dom.nodeType != null)
1193
- return t;
1194
- let i = t[0], r;
1195
- if (typeof i != "string")
1196
- throw new RangeError("Invalid array passed to renderSpec");
1197
- if (n && (r = G(n)) && r.indexOf(t) > -1)
1198
- throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");
1199
- let s = i.indexOf(" ");
1200
- s > 0 && (e = i.slice(0, s), i = i.slice(s + 1));
1201
- let o, l = e ? h.createElementNS(e, i) : h.createElement(i), f = t[1], a = 1;
1202
- if (f && typeof f == "object" && f.nodeType == null && !Array.isArray(f)) {
1203
- a = 2;
1204
- for (let u in f)
1205
- if (f[u] != null) {
1206
- let y = u.indexOf(" ");
1207
- y > 0 ? l.setAttributeNS(u.slice(0, y), u.slice(y + 1), f[u]) : u == "style" && l.style ? l.style.cssText = f[u] : l.setAttribute(u, f[u]);
1208
- }
1209
- }
1210
- for (let u = a; u < t.length; u++) {
1211
- let y = t[u];
1212
- if (y === 0) {
1213
- if (u < t.length - 1 || u > a)
1214
- throw new RangeError("Content hole must be the only child of its parent node");
1215
- return { dom: l, contentDOM: l };
1216
- } else {
1217
- let { dom: q, contentDOM: C } = w(h, y, e, n);
1218
- if (l.appendChild(q), C) {
1219
- if (o)
1220
- throw new RangeError("Multiple content holes");
1221
- o = C;
1222
- }
1223
- }
1224
- }
1225
- return { dom: l, contentDOM: o };
1
+ import { defaultExtendedIconProps as f, defaultIconTransformations as r } from "./index54.js";
2
+ import { mergeIconTransformations as t } from "./index56.js";
3
+ function a(e, i) {
4
+ const n = t(e, i);
5
+ for (const o in f) o in r ? o in e && !(o in n) && (n[o] = r[o]) : o in i ? n[o] = i[o] : o in e && (n[o] = e[o]);
6
+ return n;
1226
7
  }
1227
8
  export {
1228
- z as DOMParser,
1229
- J as DOMSerializer,
1230
- c as Fragment,
1231
- p as Mark,
1232
- K as ReplaceError,
1233
- d as Slice
9
+ a as mergeIconData
1234
10
  };