@mdsvex/parse 1.0.0-next.2 → 1.0.0-next.4

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.
package/dist/utils.js CHANGED
@@ -1,43 +1,44 @@
1
- const X = new Uint32Array(0), I = Object.freeze([]), S = 12 * 4, M = [], N = globalThis.Buffer, j = N !== void 0 && typeof N.allocUnsafeSlow == "function";
2
- function P(h) {
3
- return j ? N.allocUnsafeSlow(h).buffer : new ArrayBuffer(h);
1
+ var j;
2
+ const $ = new Uint32Array(0), W = Object.freeze([]), L = 48, H = [], R = globalThis.Buffer, tt = R !== void 0 && typeof R.allocUnsafeSlow == "function";
3
+ function K(n) {
4
+ return tt ? R.allocUnsafeSlow(n).buffer : new ArrayBuffer(n);
4
5
  }
5
- const C = 512;
6
- function E(h, t, f) {
6
+ const N = 512;
7
+ function S(n, t, f) {
7
8
  const s = f - t <= 64 ? f : t + 64;
8
9
  for (let i = t * 12; i < s * 12; )
9
- h[
10
+ n[
10
11
  i + 2
11
12
  /* NodeField.end */
12
- ] = 4294967295, h[
13
+ ] = 4294967295, n[
13
14
  i + 3
14
15
  /* NodeField.value_start */
15
- ] = 0, h[
16
+ ] = 0, n[
16
17
  i + 4
17
18
  /* NodeField.value_end */
18
- ] = 0, h[
19
+ ] = 0, n[
19
20
  i + 6
20
21
  /* NodeField.next */
21
- ] = 4294967295, h[
22
+ ] = 4294967295, n[
22
23
  i + 7
23
24
  /* NodeField.prev */
24
- ] = 4294967295, h[
25
+ ] = 4294967295, n[
25
26
  i + 8
26
27
  /* NodeField.first_child */
27
- ] = 4294967295, h[
28
+ ] = 4294967295, n[
28
29
  i + 9
29
30
  /* NodeField.last_child */
30
- ] = 4294967295, h[
31
+ ] = 4294967295, n[
31
32
  i + 10
32
33
  /* NodeField.pending */
33
- ] = 0, h[
34
+ ] = 0, n[
34
35
  i + 11
35
36
  /* NodeField.meta */
36
37
  ] = 0, i += 12;
37
38
  let e = s;
38
39
  for (; e < f; ) {
39
40
  let i = e - t;
40
- i > C && (i = C), i > f - e && (i = f - e), h.copyWithin(
41
+ i > N && (i = N), i > f - e && (i = f - e), n.copyWithin(
41
42
  e * 12,
42
43
  t * 12,
43
44
  (t + i) * 12
@@ -45,17 +46,17 @@ function E(h, t, f) {
45
46
  ), e += i;
46
47
  }
47
48
  }
48
- const q = 1048576 / S | 0, D = 4096;
49
- let z = new ArrayBuffer(0), w = 1048576, T = null;
50
- const G = 32;
51
- function F(h) {
49
+ const ft = 1048576 / L | 0, V = 4096;
50
+ let y = new ArrayBuffer(0), w = 1048576, m = null;
51
+ const st = 32;
52
+ function q(n) {
52
53
  let t = 1;
53
- for (; t < h; )
54
+ for (; t < n; )
54
55
  t <<= 1;
55
56
  return t;
56
57
  }
57
- const K = (h) => {
58
- switch (h) {
58
+ const G = (n) => {
59
+ switch (n) {
59
60
  case 0:
60
61
  return "root";
61
62
  case 1:
@@ -135,67 +136,140 @@ const K = (h) => {
135
136
  case 38:
136
137
  return "definition";
137
138
  }
138
- }, W = /* @__PURE__ */ new Map();
139
- for (let h = 0; h <= 38; h++)
140
- W.set(K(h), h);
141
- const Q = (h) => W.get(h), H = (h) => {
142
- switch (h) {
139
+ }, J = /* @__PURE__ */ new Map();
140
+ for (let n = 0; n <= 38; n++)
141
+ J.set(G(n), n);
142
+ const at = (n) => J.get(n), et = (n) => {
143
+ switch (n) {
143
144
  case 3:
144
145
  return "depth";
145
146
  }
146
147
  };
147
- let L = !1;
148
- function Z() {
149
- return L ? (L = !1, !0) : !1;
148
+ let O = !1;
149
+ function ct() {
150
+ return O ? (O = !1, !0) : !1;
150
151
  }
151
- let Y = !1;
152
- function $() {
153
- Y = !0;
152
+ let M = !1;
153
+ function lt() {
154
+ M = !0;
154
155
  }
155
- function tt() {
156
- return Y ? (Y = !1, !0) : !1;
156
+ function ot() {
157
+ return M ? (M = !1, !0) : !1;
157
158
  }
158
- let O = !1;
159
- function ft() {
160
- O = !0;
159
+ let D = !1;
160
+ function ut() {
161
+ D = !0;
161
162
  }
162
- function st() {
163
- return O ? (O = !1, !0) : !1;
163
+ function pt() {
164
+ return D ? (D = !1, !0) : !1;
164
165
  }
165
- const U = 128, y = [];
166
- let b = 0;
167
- function V(h, t) {
168
- b < U ? (y[b] = h, y[b + 1] = t, b += 2) : b = U + 2;
166
+ const P = 128, z = [];
167
+ let x = 0;
168
+ function Q(n, t) {
169
+ x < P ? (z[x] = n, z[x + 1] = t, x += 2) : x = P + 2;
169
170
  }
170
- function et(h, t, f) {
171
- return b !== 0 && J(h, t, f);
171
+ function dt(n, t, f) {
172
+ return x !== 0 && it(n, t, f);
172
173
  }
173
- function J(h, t, f) {
174
- const s = b;
175
- if (b = 0, s > U)
174
+ function it(n, t, f) {
175
+ const s = x;
176
+ if (x = 0, s > P)
176
177
  return !0;
177
178
  for (let e = 0; e < s; e += 2) {
178
- const i = y[e + 1], r = i - t.length;
179
- for (let n = y[e]; n <= r; n++)
180
- if (h.startsWith(t, n))
179
+ const i = z[e + 1], r = i - t.length;
180
+ for (let h = z[e]; h <= r; h++)
181
+ if (n.startsWith(t, h))
181
182
  return !0;
182
183
  if (f === void 0)
183
184
  continue;
184
185
  const _ = i - f.length;
185
- for (let n = y[e]; n <= _; n++)
186
- if (h.startsWith(f, n))
186
+ for (let h = z[e]; h <= _; h++)
187
+ if (n.startsWith(f, h))
187
188
  return !0;
188
189
  }
189
190
  return !1;
190
191
  }
191
- function it(h, t) {
192
- switch (h) {
192
+ const rt = 0, nt = 1, _t = 2;
193
+ class I {
194
+ constructor(t, f, s, e, i, r, _, h, a, c) {
195
+ this.source = t, this.base = f, this.rec = s, this.at = e, this.n = i, this.name_start = r, this.attrs_end = _, this.open_end = h, this.attrs_start = a, this.canonical = c, this.text = void 0;
196
+ }
197
+ }
198
+ function gt(n) {
199
+ return n.text ?? (n.text = n.source.slice(n.attrs_start - n.base, n.attrs_end - n.base));
200
+ }
201
+ let Y = new Int32Array(8192), B = 0, Z = 0;
202
+ function bt(n, t) {
203
+ B + t > Y.length && (Y = new Int32Array(t > 8192 ? t : 8192), B = 0);
204
+ const f = Y, s = Z = B;
205
+ for (let e = 0; e < t; e++)
206
+ f[s + e] = n[e];
207
+ return B = s + t, f;
208
+ }
209
+ function xt() {
210
+ return Z;
211
+ }
212
+ function F(n) {
213
+ const t = n.source, f = n.base, s = n.rec, e = n.at + n.n, i = {};
214
+ for (let r = n.at; r < e; r += 5) {
215
+ const _ = s[r], h = t.slice(s[r + 1] - f, s[r + 2] - f);
216
+ if (_ === rt)
217
+ i[h] = !0;
218
+ else if (_ === _t)
219
+ i[h] = { type: "expression", value: h };
220
+ else {
221
+ const a = t.slice(s[r + 3] - f, s[r + 4] - f);
222
+ i[h] = _ === nt ? a : { type: "expression", value: a };
223
+ }
224
+ }
225
+ return i;
226
+ }
227
+ function wt(n, t) {
228
+ const f = n.source, s = n.base, e = n.rec, i = n.at + n.n;
229
+ for (let r = n.at; r < i; r += 5) {
230
+ const _ = e[r + 1] - s;
231
+ if (e[r + 2] - s - _ === t.length && f.startsWith(t, _))
232
+ return !0;
233
+ }
234
+ return !1;
235
+ }
236
+ const T = Symbol("attributes");
237
+ class U {
238
+ constructor(t) {
239
+ this[j] = void 0, this.tag = t;
240
+ }
241
+ get attributes() {
242
+ const t = this[T];
243
+ return t instanceof I ? this[T] = F(t) : t;
244
+ }
245
+ set attributes(t) {
246
+ this[T] = t;
247
+ }
248
+ }
249
+ j = T;
250
+ function ht(n) {
251
+ if (!(n instanceof U))
252
+ return n;
253
+ const t = { tag: n.tag }, f = n.attributes;
254
+ f !== void 0 && (t.attributes = f);
255
+ for (const s in n)
256
+ t[s] = n[s];
257
+ return t;
258
+ }
259
+ function At(n) {
260
+ if (!(n instanceof U))
261
+ return;
262
+ const t = n[T];
263
+ return t instanceof I ? t : void 0;
264
+ }
265
+ function kt(n, t) {
266
+ switch (n) {
193
267
  case "tag":
194
- return { tag: t };
268
+ return new U(t);
195
269
  case "href":
196
270
  return { href: t };
197
271
  case "src":
198
- return L = !0, { src: t };
272
+ return O = !0, { src: t };
199
273
  case "ordered":
200
274
  return { ordered: t };
201
275
  case "info_start":
@@ -205,7 +279,9 @@ function it(h, t) {
205
279
  case "alignments":
206
280
  return { alignments: t };
207
281
  case "attributes":
208
- return { attributes: t };
282
+ return {
283
+ attributes: t instanceof I ? F(t) : t
284
+ };
209
285
  case "self_closing":
210
286
  return { self_closing: t };
211
287
  case "title":
@@ -215,7 +291,7 @@ function it(h, t) {
215
291
  case "tight":
216
292
  return { tight: t };
217
293
  case "info_end":
218
- return V(0, t), { info_end: t };
294
+ return Q(0, t), { info_end: t };
219
295
  case "args":
220
296
  return { name: void 0, args: t };
221
297
  case "col_count":
@@ -223,69 +299,69 @@ function it(h, t) {
223
299
  case "checked":
224
300
  return { checked: t };
225
301
  default: {
226
- if (h === "__proto__")
227
- return { [h]: t };
302
+ if (n === "__proto__")
303
+ return { [n]: t };
228
304
  const f = {};
229
- return f[h] = t, f;
305
+ return f[n] = t, f;
230
306
  }
231
307
  }
232
308
  }
233
- function rt(h, t, f) {
309
+ function vt(n, t, f) {
234
310
  switch (t) {
235
311
  case "attributes":
236
- h.attributes = f;
312
+ n.attributes = f instanceof I && !(n instanceof U) ? F(f) : f;
237
313
  return;
238
314
  case "start":
239
- h.start = f;
315
+ n.start = f;
240
316
  return;
241
317
  case "tight":
242
- h.tight = f;
318
+ n.tight = f;
243
319
  return;
244
320
  case "title":
245
- h.title = f;
321
+ n.title = f;
246
322
  return;
247
323
  case "self_closing":
248
- h.self_closing = f;
324
+ n.self_closing = f;
249
325
  return;
250
326
  case "info_end":
251
- f !== h.info_start && V(h.info_start, f), h.info_end = f;
327
+ f !== n.info_start && Q(n.info_start, f), n.info_end = f;
252
328
  return;
253
329
  case "col_count":
254
- h.col_count = f;
330
+ n.col_count = f;
255
331
  return;
256
332
  case "args":
257
- h.args = f;
333
+ n.args = f;
258
334
  return;
259
335
  case "tag":
260
- h.tag = f;
336
+ n.tag = f;
261
337
  return;
262
338
  case "href":
263
- h.href = f;
339
+ n.href = f;
264
340
  return;
265
341
  case "src":
266
- L = !0, h.src = f;
342
+ O = !0, n.src = f;
267
343
  return;
268
344
  case "ordered":
269
- h.ordered = f;
345
+ n.ordered = f;
270
346
  return;
271
347
  case "info_start":
272
- h.info_start = f;
348
+ n.info_start = f;
273
349
  return;
274
350
  case "name":
275
- h.name = f;
351
+ n.name = f;
276
352
  return;
277
353
  case "alignments":
278
- h.alignments = f;
354
+ n.alignments = f;
279
355
  return;
280
356
  case "checked":
281
- h.checked = f;
357
+ n.checked = f;
282
358
  return;
283
359
  default:
284
- h[t] = f;
360
+ n[t] = f;
285
361
  }
286
362
  }
287
- function B(h) {
288
- switch (h) {
363
+ function C(n) {
364
+ switch (n) {
289
365
  case 7:
290
366
  return 1;
291
367
  case 1:
@@ -311,17 +387,17 @@ function B(h) {
311
387
  return 0;
312
388
  }
313
389
  }
314
- function R(h, t) {
390
+ function X(n, t) {
315
391
  for (let f = 0; f < t.length; f++)
316
- h.push(t[f]);
392
+ n.push(t[f]);
317
393
  }
318
- function _t(h) {
319
- return h === "script" || h === "style" || h === "pre" || h === "textarea";
394
+ function yt(n) {
395
+ return n === "script" || n === "style" || n === "pre" || n === "textarea";
320
396
  }
321
- class nt {
397
+ class zt {
322
398
  constructor(t = 128) {
323
- this._capacity = 0, this._n = X, this._meta = I, this._strings = M, this._size = 0, this._filled = 0;
324
- let f = this.alloc(F(t > 32 ? t : 32));
399
+ this._capacity = 0, this._n = $, this._meta = W, this._strings = H, this._size = 0, this._filled = 0;
400
+ let f = this.alloc(q(t > 32 ? t : 32));
325
401
  this._filled === 0 && (f = this.fill(0)), f[0] = 0, f[
326
402
  1
327
403
  /* NodeField.start */
@@ -331,25 +407,25 @@ class nt {
331
407
  ] = 4294967295, this._size = 1;
332
408
  }
333
409
  alloc(t) {
334
- const f = t * S;
410
+ const f = t * L;
335
411
  let s, e = 0;
336
- f <= 262144 ? (w + f > 1048576 && (z = P(1048576), w = 0, E(new Uint32Array(z), 0, q)), s = z, e = w, w = e + f) : s = P(f);
412
+ f <= 262144 ? (w + f > 1048576 && (y = K(1048576), w = 0, S(new Uint32Array(y), 0, ft)), s = y, e = w, w = e + f) : s = K(f);
337
413
  const i = new Uint32Array(
338
414
  s,
339
415
  e,
340
416
  t * 12
341
417
  /* NodeField.stride */
342
418
  );
343
- return s === z ? (T = i, this._filled = t) : this._filled = 0, this._capacity = t, this._n = i, i;
419
+ return s === y ? (m = i, this._filled = t) : this._filled = 0, this._capacity = t, this._n = i, i;
344
420
  }
345
421
  /** @internal */
346
422
  own_strings() {
347
423
  const t = this._strings;
348
- return t === M ? this._strings = [] : t;
424
+ return t === H ? this._strings = [] : t;
349
425
  }
350
426
  /** gives the unused tail of the last slab carve back, a later push resizes */
351
427
  trim() {
352
- this._n === T && (w -= (this._capacity - this._size) * S, this._capacity = this._size, this._filled = this._size);
428
+ this._n === m && (w -= (this._capacity - this._size) * L, this._capacity = this._size, this._filled = this._size);
353
429
  }
354
430
  /** clear nodes without reallocating storage */
355
431
  reset() {
@@ -360,7 +436,7 @@ class nt {
360
436
  const f = this._n;
361
437
  for (let s = 0; s < t; ) {
362
438
  let e = t - s;
363
- e > C && (e = C), f.copyWithin(
439
+ e > N && (e = N), f.copyWithin(
364
440
  s * 12,
365
441
  t * 12,
366
442
  (t + e) * 12
@@ -368,7 +444,7 @@ class nt {
368
444
  ), s += e;
369
445
  }
370
446
  } else
371
- E(this._n, 0, t);
447
+ S(this._n, 0, t);
372
448
  this._size = 0;
373
449
  }
374
450
  }
@@ -396,15 +472,15 @@ class nt {
396
472
  const r = this._size;
397
473
  let _ = this._n;
398
474
  r >= this._filled && (_ = this.fill(r));
399
- const n = r * 12;
400
- if (_[n] = t & 255 | (e & 65535) << 8, _[
401
- n + 1
475
+ const h = r * 12;
476
+ if (_[h] = t & 255 | (e & 65535) << 8, _[
477
+ h + 1
402
478
  /* NodeField.start */
403
479
  ] = f, _[
404
- n + 5
480
+ h + 5
405
481
  /* NodeField.parent */
406
482
  ] = s, i && (_[
407
- n + 10
483
+ h + 10
408
484
  /* NodeField.pending */
409
485
  ] = 1), this._size = r + 1, s !== 4294967295) {
410
486
  const a = s * 12, c = _[
@@ -418,7 +494,7 @@ class nt {
418
494
  c * 12 + 6
419
495
  /* NodeField.next */
420
496
  ] = r, _[
421
- n + 7
497
+ h + 7
422
498
  /* NodeField.prev */
423
499
  ] = c), _[
424
500
  a + 9
@@ -449,20 +525,20 @@ class nt {
449
525
  r + 5
450
526
  /* NodeField.parent */
451
527
  ] = s, this._size = e + 1;
452
- const _ = s * 12, n = i[
528
+ const _ = s * 12, h = i[
453
529
  _ + 9
454
530
  /* NodeField.last_child */
455
531
  ];
456
- return n === 4294967295 ? i[
532
+ return h === 4294967295 ? i[
457
533
  _ + 8
458
534
  /* NodeField.first_child */
459
535
  ] = e : (i[
460
- n * 12 + 6
536
+ h * 12 + 6
461
537
  /* NodeField.next */
462
538
  ] = e, i[
463
539
  r + 7
464
540
  /* NodeField.prev */
465
- ] = n), i[
541
+ ] = h), i[
466
542
  _ + 9
467
543
  /* NodeField.last_child */
468
544
  ] = e, e;
@@ -470,39 +546,39 @@ class nt {
470
546
  /** a closed node with no extra and a value range, as open, value and close would leave it */
471
547
  push_leaf(t, f, s, e, i, r) {
472
548
  const _ = this._size;
473
- let n = this._n;
474
- _ >= this._filled && (n = this.fill(_));
549
+ let h = this._n;
550
+ _ >= this._filled && (h = this.fill(_));
475
551
  const a = _ * 12;
476
- n[a] = t, n[
552
+ h[a] = t, h[
477
553
  a + 1
478
554
  /* NodeField.start */
479
- ] = f, n[
555
+ ] = f, h[
480
556
  a + 2
481
557
  /* NodeField.end */
482
- ] = i, n[
558
+ ] = i, h[
483
559
  a + 3
484
560
  /* NodeField.value_start */
485
- ] = s, n[
561
+ ] = s, h[
486
562
  a + 4
487
563
  /* NodeField.value_end */
488
- ] = e, n[
564
+ ] = e, h[
489
565
  a + 5
490
566
  /* NodeField.parent */
491
567
  ] = r, this._size = _ + 1;
492
- const c = r * 12, o = n[
568
+ const c = r * 12, o = h[
493
569
  c + 9
494
570
  /* NodeField.last_child */
495
571
  ];
496
- return o === 4294967295 ? n[
572
+ return o === 4294967295 ? h[
497
573
  c + 8
498
574
  /* NodeField.first_child */
499
- ] = _ : (n[
575
+ ] = _ : (h[
500
576
  o * 12 + 6
501
577
  /* NodeField.next */
502
- ] = _, n[
578
+ ] = _, h[
503
579
  a + 7
504
580
  /* NodeField.prev */
505
- ] = o), n[
581
+ ] = o), h[
506
582
  c + 9
507
583
  /* NodeField.last_child */
508
584
  ] = _, _;
@@ -512,8 +588,8 @@ class nt {
512
588
  t >= this._capacity && (f = this.grow());
513
589
  let s = this._filled;
514
590
  if (t >= s) {
515
- let e = s + (s > D ? s : D);
516
- e > this._capacity && (e = this._capacity), E(f, s, e), this._filled = s = e;
591
+ let e = s + (s > V ? s : V);
592
+ e > this._capacity && (e = this._capacity), S(f, s, e), this._filled = s = e;
517
593
  }
518
594
  return f;
519
595
  }
@@ -561,9 +637,9 @@ class nt {
561
637
  const _ = this.push_synthetic(f, 0, t, s, e);
562
638
  if (i !== 4294967295) {
563
639
  this.set_first_child(_, i), this.set_last_child(_, r);
564
- let n = i;
565
- for (; n !== 4294967295 && this.parent_at(n) === t; )
566
- this.set_parent(n, _), n = this.next_at(n);
640
+ let h = i;
641
+ for (; h !== 4294967295 && this.parent_at(h) === t; )
642
+ this.set_parent(h, _), h = this.next_at(h);
567
643
  }
568
644
  return _;
569
645
  }
@@ -572,11 +648,11 @@ class nt {
572
648
  * @returns buffer index of the wrapper
573
649
  */
574
650
  wrap_node(t, f, s = 0, e = 0, i) {
575
- const r = this.parent_at(t), _ = r !== 4294967295 && this.first_child_at(r) === t, n = _ ? 4294967295 : this.prev_at(t);
651
+ const r = this.parent_at(t), _ = r !== 4294967295 && this.first_child_at(r) === t, h = _ ? 4294967295 : this.prev_at(t);
576
652
  let a = this.next_at(t);
577
653
  a !== 4294967295 && this.parent_at(a) !== r && (a = 4294967295);
578
654
  const c = this.push_synthetic(f, s, 4294967295, e, i);
579
- return this.set_parent(c, r), this.set_prev(c, n), this.set_next(c, a), _ ? this.set_first_child(r, c) : n !== 4294967295 && this.set_next(n, c), a !== 4294967295 && this.set_prev(a, c), r !== 4294967295 && this.last_child_at(r) === t && this.set_last_child(r, c), this.set_parent(t, c), this.set_prev(t, 4294967295), this.set_next(t, 4294967295), this.set_first_child(c, t), this.set_last_child(c, t), c;
655
+ return this.set_parent(c, r), this.set_prev(c, h), this.set_next(c, a), _ ? this.set_first_child(r, c) : h !== 4294967295 && this.set_next(h, c), a !== 4294967295 && this.set_prev(a, c), r !== 4294967295 && this.last_child_at(r) === t && this.set_last_child(r, c), this.set_parent(t, c), this.set_prev(t, 4294967295), this.set_next(t, 4294967295), this.set_first_child(c, t), this.set_last_child(c, t), c;
580
656
  }
581
657
  /** unlink a node, subtree and all, and make it the last child of another parent */
582
658
  move_to_end(t, f) {
@@ -656,12 +732,12 @@ class nt {
656
732
  this.unwrap_node(t);
657
733
  return;
658
734
  }
659
- const n = _ === 0 || _ === 14 || _ === 16 || _ === 29 || _ === 32 || _ === 37;
660
- if (i === 33 && n) {
735
+ const h = _ === 0 || _ === 14 || _ === 16 || _ === 29 || _ === 32 || _ === 37;
736
+ if (i === 33 && h) {
661
737
  this.unwrap_node(t);
662
738
  return;
663
739
  }
664
- if (i === 2 && n) {
740
+ if (i === 2 && h) {
665
741
  this.repair_block_html(t, f, s);
666
742
  return;
667
743
  }
@@ -678,11 +754,11 @@ class nt {
678
754
  this.set_first_child(t, 4294967295), this.set_last_child(t, 4294967295);
679
755
  return;
680
756
  }
681
- let A = a, k = a;
757
+ let A = a, v = a;
682
758
  for (; A !== 4294967295 && this.parent_at(A) === t; )
683
- this.set_parent(A, e), k = A, A = this.next_at(A);
684
- const m = this.next_at(t);
685
- this.set_next(t, a), this.set_prev(a, t), m !== 4294967295 && this.parent_at(m) === e ? (this.set_next(k, m), this.set_prev(m, k)) : this.set_next(k, 4294967295), this.last_child_at(e) === t && this.set_last_child(e, k), this.set_first_child(t, 4294967295), this.set_last_child(t, 4294967295);
759
+ this.set_parent(A, e), v = A, A = this.next_at(A);
760
+ const E = this.next_at(t);
761
+ this.set_next(t, a), this.set_prev(a, t), E !== 4294967295 && this.parent_at(E) === e ? (this.set_next(v, E), this.set_prev(E, v)) : this.set_next(v, 4294967295), this.last_child_at(e) === t && this.set_last_child(e, v), this.set_first_child(t, 4294967295), this.set_last_child(t, 4294967295);
686
762
  return;
687
763
  }
688
764
  const c = this.delimiter_end_at(t, i);
@@ -696,17 +772,17 @@ class nt {
696
772
  this.set_value_start(t, l), this.set_value_end(t, c === 4294967295 ? this.end_at(t) : c);
697
773
  return;
698
774
  }
699
- let o = a, x = a;
775
+ let o = a, b = a;
700
776
  for (; o !== 4294967295 && this.parent_at(o) === t; )
701
- this.set_parent(o, e), x = o, o = this.next_at(o);
702
- if (x === a && this.kind_at(a) === 1 && (c === 4294967295 || this.value_start_at(a) === c)) {
777
+ this.set_parent(o, e), b = o, o = this.next_at(o);
778
+ if (b === a && this.kind_at(a) === 1 && (c === 4294967295 || this.value_start_at(a) === c)) {
703
779
  this.set_value(t, this.start_at(t), this.value_end_at(a)), this.set_end(t, this.end_at(a)), this.set_first_child(t, 4294967295), this.set_last_child(t, 4294967295);
704
780
  return;
705
781
  }
706
782
  const u = this.prev_at(a), p = this.sibling(t, e, !0);
707
- this.set_next(t, a), this.set_prev(a, t), u !== 4294967295 && (this.set_next(u, t), this.set_prev(t, u)), this.set_next(x, p), p !== 4294967295 ? this.set_prev(p, x) : this.last_child_at(e) === t && this.set_last_child(e, x), this.set_first_child(t, 4294967295), this.set_last_child(t, 4294967295);
708
- const g = this.start_at(t), v = c === 4294967295 ? this.start_at(a) : c;
709
- this.set_value(t, g, v), this.set_end(t, v);
783
+ this.set_next(t, a), this.set_prev(a, t), u !== 4294967295 && (this.set_next(u, t), this.set_prev(t, u)), this.set_next(b, p), p !== 4294967295 ? this.set_prev(p, b) : this.last_child_at(e) === t && this.set_last_child(e, b), this.set_first_child(t, 4294967295), this.set_last_child(t, 4294967295);
784
+ const g = this.start_at(t), k = c === 4294967295 ? this.start_at(a) : c;
785
+ this.set_value(t, g, k), this.set_end(t, k);
710
786
  }
711
787
  /** where the delimiter of a revoked inline node ends, none when only the parser knows its length */
712
788
  delimiter_end_at(t, f) {
@@ -729,30 +805,30 @@ class nt {
729
805
  this.unwrap_node(t);
730
806
  return;
731
807
  }
732
- let n = [], a = this.sibling(t, e, !1);
733
- for (; a !== 4294967295 && B(this.kind_at(a)) >= 2; )
734
- n.push(a), a = this.sibling(a, e, !1);
735
- n.reverse();
736
- const c = n.length;
737
- n.push(t);
738
- let o = !0, x = !0;
808
+ let h = [], a = this.sibling(t, e, !1);
809
+ for (; a !== 4294967295 && C(this.kind_at(a)) >= 2; )
810
+ h.push(a), a = this.sibling(a, e, !1);
811
+ h.reverse();
812
+ const c = h.length;
813
+ h.push(t);
814
+ let o = !0, b = !0;
739
815
  const u = [];
740
816
  let p = this.sibling(t, e, !0);
741
817
  this.set_first_child(t, 4294967295), this.set_last_child(t, 4294967295), this.delete_metadata(t);
742
818
  let g = r;
743
819
  for (; g !== 4294967295 && this.parent_at(g) === t; ) {
744
- const l = this.next_at(g), d = B(this.kind_at(g));
745
- d >= 2 ? (n.push(g), d === 3 && (o = !0)) : (d === 1 && n.length !== 0 ? (x && this.tag_text(t, i, _, f, s), this.set_start(g, this.start_at(n[0])), this.adopt(g, n, !0)) : (x ? this.tag_paragraph(n, c, _, f, s) : this.run_paragraph(n, o), R(u, n)), u.push(g), n = [], o = !1, x = !1), g = l;
820
+ const l = this.next_at(g), d = C(this.kind_at(g));
821
+ d >= 2 ? (h.push(g), d === 3 && (o = !0)) : (d === 1 && h.length !== 0 ? (b && this.tag_text(t, i, _, f, s), this.set_start(g, this.start_at(h[0])), this.adopt(g, h, !0)) : (b ? this.tag_paragraph(h, c, _, f, s) : this.run_paragraph(h, o), X(u, h)), u.push(g), h = [], o = !1, b = !1), g = l;
746
822
  }
747
- for (; p !== 4294967295 && B(this.kind_at(p)) >= 2; )
748
- B(this.kind_at(p)) === 3 && (o = !0), n.push(p), p = this.sibling(p, e, !0);
749
- x ? this.tag_paragraph(n, c, _, f, s) : this.run_paragraph(n, o), R(u, n);
823
+ for (; p !== 4294967295 && C(this.kind_at(p)) >= 2; )
824
+ C(this.kind_at(p)) === 3 && (o = !0), h.push(p), p = this.sibling(p, e, !0);
825
+ b ? this.tag_paragraph(h, c, _, f, s) : this.run_paragraph(h, o), X(u, h);
750
826
  for (let l = 0; l < u.length; l++) {
751
827
  const d = u[l];
752
828
  this.set_parent(d, e), this.set_prev(d, l === 0 ? a : u[l - 1]), this.set_next(d, l + 1 < u.length ? u[l + 1] : p);
753
829
  }
754
- const v = u[u.length - 1];
755
- a === 4294967295 ? this.set_first_child(e, u[0]) : this.set_next(a, u[0]), p === 4294967295 ? this.set_last_child(e, v) : this.set_prev(p, v);
830
+ const k = u[u.length - 1];
831
+ a === 4294967295 ? this.set_first_child(e, u[0]) : this.set_next(a, u[0]), p === 4294967295 ? this.set_last_child(e, k) : this.set_prev(p, k);
756
832
  }
757
833
  /** the next or previous sibling under parent, a stale link is none */
758
834
  sibling(t, f, s) {
@@ -776,8 +852,8 @@ class nt {
776
852
  7
777
853
  /* NodeKind.paragraph */
778
854
  ), this.set_start(r, this.start_at(t[0]));
779
- const n = this.push(1, _);
780
- this.tag_text(n, _, s, e, i), t[f] = n, this.wrap_run(r, t);
855
+ const h = this.push(1, _);
856
+ this.tag_text(h, _, s, e, i), t[f] = h, this.wrap_run(r, t);
781
857
  }
782
858
  /** a run with text gets a paragraph, on return it is what goes under the parent */
783
859
  run_paragraph(t, f) {
@@ -807,8 +883,8 @@ class nt {
807
883
  return;
808
884
  const i = s ? 4294967295 : this.last_child_at(t), r = s ? this.first_child_at(t) : 4294967295;
809
885
  for (let _ = 0; _ < e; _++) {
810
- const n = f[_];
811
- this.set_parent(n, t), this.set_prev(n, _ === 0 ? i : f[_ - 1]), this.set_next(n, _ + 1 < e ? f[_ + 1] : r);
886
+ const h = f[_];
887
+ this.set_parent(h, t), this.set_prev(h, _ === 0 ? i : f[_ - 1]), this.set_next(h, _ + 1 < e ? f[_ + 1] : r);
812
888
  }
813
889
  i === 4294967295 ? this.set_first_child(t, f[0]) : this.set_next(i, f[0]), r === 4294967295 ? this.set_last_child(t, f[e - 1]) : this.set_prev(r, f[e - 1]);
814
890
  }
@@ -822,7 +898,7 @@ class nt {
822
898
  }
823
899
  pop() {
824
900
  const t = --this._size;
825
- E(this._n, t, t + 1);
901
+ S(this._n, t, t + 1);
826
902
  }
827
903
  /**
828
904
  * remove a node from the tree and reparent its children to its parent.
@@ -832,8 +908,8 @@ class nt {
832
908
  unwrap_node(t) {
833
909
  const f = this.parent_at(t), s = this.first_child_at(t);
834
910
  if (s === 4294967295) {
835
- const n = this.prev_at(t), a = this.next_at(t);
836
- n !== 4294967295 ? this.set_next(n, a) : f !== 4294967295 && this.set_first_child(f, a), a !== 4294967295 && this.set_prev(a, n), f !== 4294967295 && this.last_child_at(f) === t && this.set_last_child(f, n);
911
+ const h = this.prev_at(t), a = this.next_at(t);
912
+ h !== 4294967295 ? this.set_next(h, a) : f !== 4294967295 && this.set_first_child(f, a), a !== 4294967295 && this.set_prev(a, h), f !== 4294967295 && this.last_child_at(f) === t && this.set_last_child(f, h);
837
913
  return;
838
914
  }
839
915
  let e = s, i = s;
@@ -1039,16 +1115,16 @@ class nt {
1039
1115
  }
1040
1116
  resize(t) {
1041
1117
  const f = this._n, s = this._capacity * 12;
1042
- if (f === T) {
1043
- const r = w - s * 4, _ = t * S;
1118
+ if (f === m) {
1119
+ const r = w - s * 4, _ = t * L;
1044
1120
  if (_ <= 262144 && r + _ <= 1048576) {
1045
- const n = new Uint32Array(
1046
- z,
1121
+ const h = new Uint32Array(
1122
+ y,
1047
1123
  r,
1048
1124
  t * 12
1049
1125
  /* NodeField.stride */
1050
1126
  );
1051
- return w = r + _, T = n, this._capacity = t, this._filled = t, this._n = n, n;
1127
+ return w = r + _, m = h, this._capacity = t, this._filled = t, this._n = h, h;
1052
1128
  }
1053
1129
  }
1054
1130
  const e = this.alloc(t), i = this._size;
@@ -1064,7 +1140,7 @@ class nt {
1064
1140
  this._meta[i - 1] = f;
1065
1141
  else {
1066
1142
  const r = this._meta;
1067
- r === I ? (this._meta = [f], s[e] = 1) : s[e] = r.push(f);
1143
+ r === W ? (this._meta = [f], s[e] = 1) : s[e] = r.push(f);
1068
1144
  }
1069
1145
  }
1070
1146
  metadata_at(t) {
@@ -1086,21 +1162,21 @@ class nt {
1086
1162
  * @returns node
1087
1163
  */
1088
1164
  get_node(t = 0) {
1089
- const f = this.kind_at(t), s = H(f), e = s ? { [s]: this.extra_at(t) } : f === 8 && this.extra_at(t) === 1 ? { math: !0 } : {}, i = [];
1165
+ const f = this.kind_at(t), s = et(f), e = s ? { [s]: this.extra_at(t) } : f === 8 && this.extra_at(t) === 1 ? { math: !0 } : {}, i = [];
1090
1166
  let r = this.first_child_at(t);
1091
1167
  for (; r !== 4294967295 && this.parent_at(r) === t; )
1092
1168
  i.push(r), r = this.next_at(r);
1093
- const _ = this.parent_at(t), n = this.next_at(t), a = this.prev_at(t);
1169
+ const _ = this.parent_at(t), h = this.next_at(t), a = this.prev_at(t);
1094
1170
  return {
1095
- kind: K(f),
1171
+ kind: G(f),
1096
1172
  start: this.start_at(t),
1097
1173
  end: this.end_at(t),
1098
1174
  metadata: {
1099
- ...this.metadata_at(t),
1175
+ ...ht(this.metadata_at(t)),
1100
1176
  ...e
1101
1177
  },
1102
1178
  parent: _ === 4294967295 ? null : _,
1103
- next: n === 4294967295 ? null : n,
1179
+ next: h === 4294967295 ? null : h,
1104
1180
  prev: a === 4294967295 ? null : a,
1105
1181
  value: [this.value_start_at(t), this.value_end_at(t)],
1106
1182
  children: i,
@@ -1108,13 +1184,13 @@ class nt {
1108
1184
  };
1109
1185
  }
1110
1186
  }
1111
- class ht {
1187
+ class Tt {
1112
1188
  /**
1113
1189
  * create a collector that records error indices encountered while parsing.
1114
1190
  * @param initial_capacity requested starting capacity for error indices.
1115
1191
  */
1116
- constructor(t = G) {
1117
- const f = F(t);
1192
+ constructor(t = st) {
1193
+ const f = q(t);
1118
1194
  this.capacity = f, this.indices = new Uint32Array(f), this._size = 0;
1119
1195
  }
1120
1196
  /** clear previously stored errors. */
@@ -1151,17 +1227,26 @@ class ht {
1151
1227
  }
1152
1228
  }
1153
1229
  export {
1154
- ht as ErrorCollector,
1155
- nt as NodeBuffer,
1156
- _t as is_raw_text_tag,
1157
- K as kind_to_string,
1158
- it as make_meta,
1159
- rt as merge_meta,
1160
- $ as note_footnote,
1161
- ft as note_math,
1162
- Q as string_to_kind,
1163
- tt as take_footnote,
1164
- et as take_info,
1165
- st as take_math,
1166
- Z as take_src
1230
+ I as AttrSpans,
1231
+ Tt as ErrorCollector,
1232
+ U as HtmlMeta,
1233
+ zt as NodeBuffer,
1234
+ F as build_attrs,
1235
+ yt as is_raw_text_tag,
1236
+ G as kind_to_string,
1237
+ kt as make_meta,
1238
+ vt as merge_meta,
1239
+ lt as note_footnote,
1240
+ ut as note_math,
1241
+ ht as plain_meta,
1242
+ wt as spans_have,
1243
+ gt as spans_text,
1244
+ bt as store_attr_rec,
1245
+ xt as stored_attr_at,
1246
+ at as string_to_kind,
1247
+ ot as take_footnote,
1248
+ dt as take_info,
1249
+ pt as take_math,
1250
+ ct as take_src,
1251
+ At as unread_spans
1167
1252
  };