@harbour-enterprises/superdoc 0.28.1 → 0.29.0-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/dist/chunks/{PdfViewer-Can0yoW4.cjs → PdfViewer-D-eZ2Yov.cjs} +1 -1
  2. package/dist/chunks/{PdfViewer-DJkdA-8o.es.js → PdfViewer-DkZrQk4g.es.js} +1 -1
  3. package/dist/chunks/{index-DidXsI6u.es.js → index-DJQlES_f.es.js} +3 -3
  4. package/dist/chunks/{index-njnq8umX-DU2xcaHZ.es.js → index-DQ6dCde6-BZTSGgXX.es.js} +1 -1
  5. package/dist/chunks/{index-njnq8umX-_TfP84XP.cjs → index-DQ6dCde6-BnMDi7G1.cjs} +1 -1
  6. package/dist/chunks/{index-BY-vlgKe.cjs → index-zeAsCB89.cjs} +3 -3
  7. package/dist/chunks/{super-editor.es-ksiTgGLm.cjs → super-editor.es-BV85aAFJ.cjs} +1739 -1156
  8. package/dist/chunks/{super-editor.es-Br566URP.es.js → super-editor.es-CLErM40t.es.js} +1739 -1156
  9. package/dist/core/types/index.d.ts.map +1 -1
  10. package/dist/style.css +10 -0
  11. package/dist/super-editor/ai-writer.es.js +2 -2
  12. package/dist/super-editor/chunks/{converter-D6Z6OmA3.js → converter-iD03MYzC.js} +748 -672
  13. package/dist/super-editor/chunks/{docx-zipper-Dni97kMT.js → docx-zipper-nrZgxvR8.js} +1 -1
  14. package/dist/super-editor/chunks/{editor-D3TKfdXs.js → editor-C7iHgXnE.js} +644 -137
  15. package/dist/super-editor/chunks/{index-njnq8umX.js → index-DQ6dCde6.js} +1 -1
  16. package/dist/super-editor/chunks/{toolbar-fNE3luLB.js → toolbar-DKrq-G-q.js} +2 -2
  17. package/dist/super-editor/converter.es.js +1 -1
  18. package/dist/super-editor/docx-zipper.es.js +2 -2
  19. package/dist/super-editor/editor.es.js +3 -3
  20. package/dist/super-editor/file-zipper.es.js +1 -1
  21. package/dist/super-editor/style.css +10 -0
  22. package/dist/super-editor/super-editor/src/core/helpers/rangeUtils.d.ts +2 -0
  23. package/dist/super-editor/super-editor/src/core/super-converter/relationship-helpers.d.ts +2 -0
  24. package/dist/super-editor/super-editor/src/core/super-converter/v2/importer/listImporter.d.ts +1 -1
  25. package/dist/super-editor/super-editor/src/core/super-converter/v2/importer/numberingCache.d.ts +2 -2
  26. package/dist/super-editor/super-editor/src/extensions/field-annotation/FieldAnnotationPlugin.d.ts +5 -1
  27. package/dist/super-editor/super-editor/src/extensions/image/imageHelpers/imagePositionPlugin.d.ts +2 -0
  28. package/dist/super-editor/super-editor/src/extensions/list-item/helpers/listItemTypography.d.ts +5 -0
  29. package/dist/super-editor/super-editor/src/extensions/list-item/helpers/styledListMarkerPlugin.d.ts +11 -2
  30. package/dist/super-editor/super-editor/src/extensions/tab/helpers/tabDecorations.d.ts +4 -1
  31. package/dist/super-editor/super-editor/src/utils/headless-helpers.d.ts +1 -0
  32. package/dist/super-editor/super-editor/src/utils/styleIsolation.d.ts +2 -0
  33. package/dist/super-editor/super-editor.es.js +6 -6
  34. package/dist/super-editor/toolbar.es.js +2 -2
  35. package/dist/super-editor.cjs +1 -1
  36. package/dist/super-editor.es.js +1 -1
  37. package/dist/superdoc.cjs +2 -2
  38. package/dist/superdoc.es.js +2 -2
  39. package/dist/superdoc.umd.js +1503 -920
  40. package/dist/superdoc.umd.js.map +1 -1
  41. package/package.json +1 -1
  42. package/dist/images/altText_add.svg +0 -3
  43. package/dist/images/altText_disclaimer.svg +0 -3
  44. package/dist/images/altText_done.svg +0 -3
  45. package/dist/images/altText_spinner.svg +0 -30
  46. package/dist/images/altText_warning.svg +0 -3
  47. package/dist/images/annotation-check.svg +0 -11
  48. package/dist/images/annotation-comment.svg +0 -16
  49. package/dist/images/annotation-help.svg +0 -26
  50. package/dist/images/annotation-insert.svg +0 -10
  51. package/dist/images/annotation-key.svg +0 -11
  52. package/dist/images/annotation-newparagraph.svg +0 -11
  53. package/dist/images/annotation-noicon.svg +0 -7
  54. package/dist/images/annotation-note.svg +0 -42
  55. package/dist/images/annotation-paperclip.svg +0 -6
  56. package/dist/images/annotation-paragraph.svg +0 -16
  57. package/dist/images/annotation-pushpin.svg +0 -7
  58. package/dist/images/cursor-editorFreeHighlight.svg +0 -6
  59. package/dist/images/cursor-editorFreeText.svg +0 -3
  60. package/dist/images/cursor-editorInk.svg +0 -4
  61. package/dist/images/cursor-editorTextHighlight.svg +0 -8
  62. package/dist/images/editor-toolbar-delete.svg +0 -5
  63. package/dist/images/loading-icon.gif +0 -0
  64. package/dist/images/messageBar_closingButton.svg +0 -3
  65. package/dist/images/messageBar_warning.svg +0 -3
  66. package/dist/images/toolbarButton-editorHighlight.svg +0 -6
  67. package/dist/images/toolbarButton-menuArrow.svg +0 -3
@@ -112,18 +112,18 @@ ieee754.read = function(buffer2, offset, isLE, mLen, nBytes) {
112
112
  var eBias = eMax >> 1;
113
113
  var nBits = -7;
114
114
  var i = isLE ? nBytes - 1 : 0;
115
- var d = isLE ? -1 : 1;
115
+ var d2 = isLE ? -1 : 1;
116
116
  var s = buffer2[offset + i];
117
- i += d;
117
+ i += d2;
118
118
  e = s & (1 << -nBits) - 1;
119
119
  s >>= -nBits;
120
120
  nBits += eLen;
121
- for (; nBits > 0; e = e * 256 + buffer2[offset + i], i += d, nBits -= 8) {
121
+ for (; nBits > 0; e = e * 256 + buffer2[offset + i], i += d2, nBits -= 8) {
122
122
  }
123
123
  m2 = e & (1 << -nBits) - 1;
124
124
  e >>= -nBits;
125
125
  nBits += mLen;
126
- for (; nBits > 0; m2 = m2 * 256 + buffer2[offset + i], i += d, nBits -= 8) {
126
+ for (; nBits > 0; m2 = m2 * 256 + buffer2[offset + i], i += d2, nBits -= 8) {
127
127
  }
128
128
  if (e === 0) {
129
129
  e = 1 - eBias;
@@ -142,7 +142,7 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
142
142
  var eBias = eMax >> 1;
143
143
  var rt = mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0;
144
144
  var i = isLE ? 0 : nBytes - 1;
145
- var d = isLE ? 1 : -1;
145
+ var d2 = isLE ? 1 : -1;
146
146
  var s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0;
147
147
  value = Math.abs(value);
148
148
  if (isNaN(value) || value === Infinity) {
@@ -174,13 +174,13 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
174
174
  e = 0;
175
175
  }
176
176
  }
177
- for (; mLen >= 8; buffer2[offset + i] = m2 & 255, i += d, m2 /= 256, mLen -= 8) {
177
+ for (; mLen >= 8; buffer2[offset + i] = m2 & 255, i += d2, m2 /= 256, mLen -= 8) {
178
178
  }
179
179
  e = e << mLen | m2;
180
180
  eLen += mLen;
181
- for (; eLen > 0; buffer2[offset + i] = e & 255, i += d, e /= 256, eLen -= 8) {
181
+ for (; eLen > 0; buffer2[offset + i] = e & 255, i += d2, e /= 256, eLen -= 8) {
182
182
  }
183
- buffer2[offset + i - d] |= s * 128;
183
+ buffer2[offset + i - d2] |= s * 128;
184
184
  };
185
185
  /*!
186
186
  * The buffer module from node.js, for the browser.
@@ -414,17 +414,17 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
414
414
  );
415
415
  }
416
416
  if (a === b2) return 0;
417
- let x2 = a.length;
417
+ let x = a.length;
418
418
  let y2 = b2.length;
419
- for (let i = 0, len = Math.min(x2, y2); i < len; ++i) {
419
+ for (let i = 0, len = Math.min(x, y2); i < len; ++i) {
420
420
  if (a[i] !== b2[i]) {
421
- x2 = a[i];
421
+ x = a[i];
422
422
  y2 = b2[i];
423
423
  break;
424
424
  }
425
425
  }
426
- if (x2 < y2) return -1;
427
- if (y2 < x2) return 1;
426
+ if (x < y2) return -1;
427
+ if (y2 < x) return 1;
428
428
  return 0;
429
429
  };
430
430
  Buffer3.isEncoding = function isEncoding(encoding) {
@@ -673,20 +673,20 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
673
673
  thisStart >>>= 0;
674
674
  thisEnd >>>= 0;
675
675
  if (this === target) return 0;
676
- let x2 = thisEnd - thisStart;
676
+ let x = thisEnd - thisStart;
677
677
  let y2 = end - start;
678
- const len = Math.min(x2, y2);
678
+ const len = Math.min(x, y2);
679
679
  const thisCopy = this.slice(thisStart, thisEnd);
680
680
  const targetCopy = target.slice(start, end);
681
681
  for (let i = 0; i < len; ++i) {
682
682
  if (thisCopy[i] !== targetCopy[i]) {
683
- x2 = thisCopy[i];
683
+ x = thisCopy[i];
684
684
  y2 = targetCopy[i];
685
685
  break;
686
686
  }
687
687
  }
688
- if (x2 < y2) return -1;
689
- if (y2 < x2) return 1;
688
+ if (x < y2) return -1;
689
+ if (y2 < x) return 1;
690
690
  return 0;
691
691
  };
692
692
  function bidirectionalIndexOf(buffer2, val, byteOffset, encoding, dir) {
@@ -1776,8 +1776,8 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
1776
1776
  })(buffer);
1777
1777
  const Buffer2 = buffer.Buffer;
1778
1778
  var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
1779
- function getDefaultExportFromCjs$2(x2) {
1780
- return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;
1779
+ function getDefaultExportFromCjs$2(x) {
1780
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
1781
1781
  }
1782
1782
  var sax = {};
1783
1783
  var events = { exports: {} };
@@ -1785,13 +1785,13 @@ var hasRequiredEvents;
1785
1785
  function requireEvents() {
1786
1786
  if (hasRequiredEvents) return events.exports;
1787
1787
  hasRequiredEvents = 1;
1788
- var R = typeof Reflect === "object" ? Reflect : null;
1789
- var ReflectApply = R && typeof R.apply === "function" ? R.apply : function ReflectApply2(target, receiver, args) {
1788
+ var R2 = typeof Reflect === "object" ? Reflect : null;
1789
+ var ReflectApply = R2 && typeof R2.apply === "function" ? R2.apply : function ReflectApply2(target, receiver, args) {
1790
1790
  return Function.prototype.apply.call(target, receiver, args);
1791
1791
  };
1792
1792
  var ReflectOwnKeys;
1793
- if (R && typeof R.ownKeys === "function") {
1794
- ReflectOwnKeys = R.ownKeys;
1793
+ if (R2 && typeof R2.ownKeys === "function") {
1794
+ ReflectOwnKeys = R2.ownKeys;
1795
1795
  } else if (Object.getOwnPropertySymbols) {
1796
1796
  ReflectOwnKeys = function ReflectOwnKeys2(target) {
1797
1797
  return Object.getOwnPropertyNames(target).concat(Object.getOwnPropertySymbols(target));
@@ -2181,8 +2181,8 @@ function requireInherits_browser() {
2181
2181
  }
2182
2182
  return inherits_browser.exports;
2183
2183
  }
2184
- function getDefaultExportFromCjs$1(x2) {
2185
- return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;
2184
+ function getDefaultExportFromCjs$1(x) {
2185
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
2186
2186
  }
2187
2187
  var browser$1 = { exports: {} };
2188
2188
  var process = browser$1.exports = {};
@@ -2461,18 +2461,18 @@ function requireDist() {
2461
2461
  var eBias = eMax >> 1;
2462
2462
  var nBits = -7;
2463
2463
  var i2 = isLE ? nBytes - 1 : 0;
2464
- var d = isLE ? -1 : 1;
2464
+ var d2 = isLE ? -1 : 1;
2465
2465
  var s = buffer3[offset + i2];
2466
- i2 += d;
2466
+ i2 += d2;
2467
2467
  e = s & (1 << -nBits) - 1;
2468
2468
  s >>= -nBits;
2469
2469
  nBits += eLen;
2470
- for (; nBits > 0; e = e * 256 + buffer3[offset + i2], i2 += d, nBits -= 8) {
2470
+ for (; nBits > 0; e = e * 256 + buffer3[offset + i2], i2 += d2, nBits -= 8) {
2471
2471
  }
2472
2472
  m2 = e & (1 << -nBits) - 1;
2473
2473
  e >>= -nBits;
2474
2474
  nBits += mLen;
2475
- for (; nBits > 0; m2 = m2 * 256 + buffer3[offset + i2], i2 += d, nBits -= 8) {
2475
+ for (; nBits > 0; m2 = m2 * 256 + buffer3[offset + i2], i2 += d2, nBits -= 8) {
2476
2476
  }
2477
2477
  if (e === 0) {
2478
2478
  e = 1 - eBias;
@@ -2491,7 +2491,7 @@ function requireDist() {
2491
2491
  var eBias = eMax >> 1;
2492
2492
  var rt = mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0;
2493
2493
  var i2 = isLE ? 0 : nBytes - 1;
2494
- var d = isLE ? 1 : -1;
2494
+ var d2 = isLE ? 1 : -1;
2495
2495
  var s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0;
2496
2496
  value = Math.abs(value);
2497
2497
  if (isNaN(value) || value === Infinity) {
@@ -2523,13 +2523,13 @@ function requireDist() {
2523
2523
  e = 0;
2524
2524
  }
2525
2525
  }
2526
- for (; mLen >= 8; buffer3[offset + i2] = m2 & 255, i2 += d, m2 /= 256, mLen -= 8) {
2526
+ for (; mLen >= 8; buffer3[offset + i2] = m2 & 255, i2 += d2, m2 /= 256, mLen -= 8) {
2527
2527
  }
2528
2528
  e = e << mLen | m2;
2529
2529
  eLen += mLen;
2530
- for (; eLen > 0; buffer3[offset + i2] = e & 255, i2 += d, e /= 256, eLen -= 8) {
2530
+ for (; eLen > 0; buffer3[offset + i2] = e & 255, i2 += d2, e /= 256, eLen -= 8) {
2531
2531
  }
2532
- buffer3[offset + i2 - d] |= s * 128;
2532
+ buffer3[offset + i2 - d2] |= s * 128;
2533
2533
  };
2534
2534
  /*!
2535
2535
  * The buffer module from node.js, for the browser.
@@ -2763,17 +2763,17 @@ function requireDist() {
2763
2763
  );
2764
2764
  }
2765
2765
  if (a === b2) return 0;
2766
- let x2 = a.length;
2766
+ let x = a.length;
2767
2767
  let y2 = b2.length;
2768
- for (let i2 = 0, len2 = Math.min(x2, y2); i2 < len2; ++i2) {
2768
+ for (let i2 = 0, len2 = Math.min(x, y2); i2 < len2; ++i2) {
2769
2769
  if (a[i2] !== b2[i2]) {
2770
- x2 = a[i2];
2770
+ x = a[i2];
2771
2771
  y2 = b2[i2];
2772
2772
  break;
2773
2773
  }
2774
2774
  }
2775
- if (x2 < y2) return -1;
2776
- if (y2 < x2) return 1;
2775
+ if (x < y2) return -1;
2776
+ if (y2 < x) return 1;
2777
2777
  return 0;
2778
2778
  };
2779
2779
  Buffer4.isEncoding = function isEncoding(encoding) {
@@ -3022,20 +3022,20 @@ function requireDist() {
3022
3022
  thisStart >>>= 0;
3023
3023
  thisEnd >>>= 0;
3024
3024
  if (this === target) return 0;
3025
- let x2 = thisEnd - thisStart;
3025
+ let x = thisEnd - thisStart;
3026
3026
  let y2 = end - start;
3027
- const len2 = Math.min(x2, y2);
3027
+ const len2 = Math.min(x, y2);
3028
3028
  const thisCopy = this.slice(thisStart, thisEnd);
3029
3029
  const targetCopy = target.slice(start, end);
3030
3030
  for (let i2 = 0; i2 < len2; ++i2) {
3031
3031
  if (thisCopy[i2] !== targetCopy[i2]) {
3032
- x2 = thisCopy[i2];
3032
+ x = thisCopy[i2];
3033
3033
  y2 = targetCopy[i2];
3034
3034
  break;
3035
3035
  }
3036
3036
  }
3037
- if (x2 < y2) return -1;
3038
- if (y2 < x2) return 1;
3037
+ if (x < y2) return -1;
3038
+ if (y2 < x) return 1;
3039
3039
  return 0;
3040
3040
  };
3041
3041
  function bidirectionalIndexOf(buffer3, val, byteOffset, encoding, dir) {
@@ -4607,15 +4607,15 @@ function requireGetProto() {
4607
4607
  var reflectGetProto = requireReflect_getPrototypeOf();
4608
4608
  var originalGetProto = requireObject_getPrototypeOf();
4609
4609
  var getDunderProto = /* @__PURE__ */ requireGet();
4610
- getProto = reflectGetProto ? function getProto2(O) {
4611
- return reflectGetProto(O);
4612
- } : originalGetProto ? function getProto2(O) {
4613
- if (!O || typeof O !== "object" && typeof O !== "function") {
4610
+ getProto = reflectGetProto ? function getProto2(O2) {
4611
+ return reflectGetProto(O2);
4612
+ } : originalGetProto ? function getProto2(O2) {
4613
+ if (!O2 || typeof O2 !== "object" && typeof O2 !== "function") {
4614
4614
  throw new TypeError("getProto: not an object");
4615
4615
  }
4616
- return originalGetProto(O);
4617
- } : getDunderProto ? function getProto2(O) {
4618
- return getDunderProto(O);
4616
+ return originalGetProto(O2);
4617
+ } : getDunderProto ? function getProto2(O2) {
4618
+ return getDunderProto(O2);
4619
4619
  } : null;
4620
4620
  return getProto;
4621
4621
  }
@@ -5283,18 +5283,18 @@ function requireForEach() {
5283
5283
  }
5284
5284
  };
5285
5285
  var forEachObject = function forEachObject2(object, iterator, receiver) {
5286
- for (var k2 in object) {
5287
- if (hasOwnProperty.call(object, k2)) {
5286
+ for (var k in object) {
5287
+ if (hasOwnProperty.call(object, k)) {
5288
5288
  if (receiver == null) {
5289
- iterator(object[k2], k2, object);
5289
+ iterator(object[k], k, object);
5290
5290
  } else {
5291
- iterator.call(receiver, object[k2], k2, object);
5291
+ iterator.call(receiver, object[k], k, object);
5292
5292
  }
5293
5293
  }
5294
5294
  }
5295
5295
  };
5296
- function isArray(x2) {
5297
- return toStr.call(x2) === "[object Array]";
5296
+ function isArray(x) {
5297
+ return toStr.call(x) === "[object Array]";
5298
5298
  }
5299
5299
  forEach = function forEach2(list, iterator, thisArg) {
5300
5300
  if (!isCallable2(iterator)) {
@@ -5903,10 +5903,10 @@ function requireUtil() {
5903
5903
  var i = 1;
5904
5904
  var args = arguments;
5905
5905
  var len = args.length;
5906
- var str = String(f).replace(formatRegExp, function(x3) {
5907
- if (x3 === "%%") return "%";
5908
- if (i >= len) return x3;
5909
- switch (x3) {
5906
+ var str = String(f).replace(formatRegExp, function(x2) {
5907
+ if (x2 === "%%") return "%";
5908
+ if (i >= len) return x2;
5909
+ switch (x2) {
5910
5910
  case "%s":
5911
5911
  return String(args[i++]);
5912
5912
  case "%d":
@@ -5918,14 +5918,14 @@ function requireUtil() {
5918
5918
  return "[Circular]";
5919
5919
  }
5920
5920
  default:
5921
- return x3;
5921
+ return x2;
5922
5922
  }
5923
5923
  });
5924
- for (var x2 = args[i]; i < len; x2 = args[++i]) {
5925
- if (isNull(x2) || !isObject(x2)) {
5926
- str += " " + x2;
5924
+ for (var x = args[i]; i < len; x = args[++i]) {
5925
+ if (isNull(x) || !isObject(x)) {
5926
+ str += " " + x;
5927
5927
  } else {
5928
- str += " " + inspect(x2);
5928
+ str += " " + inspect(x);
5929
5929
  }
5930
5930
  }
5931
5931
  return str;
@@ -6138,7 +6138,7 @@ function requireUtil() {
6138
6138
  }
6139
6139
  function formatArray(ctx, value, recurseTimes, visibleKeys, keys2) {
6140
6140
  var output = [];
6141
- for (var i = 0, l = value.length; i < l; ++i) {
6141
+ for (var i = 0, l3 = value.length; i < l3; ++i) {
6142
6142
  if (hasOwnProperty(value, String(i))) {
6143
6143
  output.push(formatProperty(
6144
6144
  ctx,
@@ -6272,8 +6272,8 @@ function requireUtil() {
6272
6272
  return typeof arg === "object" && arg !== null;
6273
6273
  }
6274
6274
  exports.isObject = isObject;
6275
- function isDate(d) {
6276
- return isObject(d) && objectToString(d) === "[object Date]";
6275
+ function isDate(d2) {
6276
+ return isObject(d2) && objectToString(d2) === "[object Date]";
6277
6277
  }
6278
6278
  exports.isDate = isDate;
6279
6279
  exports.types.isDate = isDate;
@@ -6313,13 +6313,13 @@ function requireUtil() {
6313
6313
  "Dec"
6314
6314
  ];
6315
6315
  function timestamp() {
6316
- var d = /* @__PURE__ */ new Date();
6316
+ var d2 = /* @__PURE__ */ new Date();
6317
6317
  var time = [
6318
- pad(d.getHours()),
6319
- pad(d.getMinutes()),
6320
- pad(d.getSeconds())
6318
+ pad(d2.getHours()),
6319
+ pad(d2.getMinutes()),
6320
+ pad(d2.getSeconds())
6321
6321
  ].join(":");
6322
- return [d.getDate(), months[d.getMonth()], time].join(" ");
6322
+ return [d2.getDate(), months[d2.getMonth()], time].join(" ");
6323
6323
  }
6324
6324
  exports.log = function() {
6325
6325
  console.log("%s - %s", timestamp(), exports.format.apply(exports, arguments));
@@ -7237,8 +7237,8 @@ function require_stream_writable() {
7237
7237
  state2.bufferProcessing = true;
7238
7238
  var entry = state2.bufferedRequest;
7239
7239
  if (stream._writev && entry && entry.next) {
7240
- var l = state2.bufferedRequestCount;
7241
- var buffer2 = new Array(l);
7240
+ var l3 = state2.bufferedRequestCount;
7241
+ var buffer2 = new Array(l3);
7242
7242
  var holder = state2.corkedRequestsFree;
7243
7243
  holder.entry = entry;
7244
7244
  var count = 0;
@@ -7490,7 +7490,6 @@ function require_stream_duplex() {
7490
7490
  }
7491
7491
  var string_decoder = {};
7492
7492
  var safeBuffer = { exports: {} };
7493
- /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
7494
7493
  var hasRequiredSafeBuffer;
7495
7494
  function requireSafeBuffer() {
7496
7495
  if (hasRequiredSafeBuffer) return safeBuffer.exports;
@@ -7512,7 +7511,6 @@ function requireSafeBuffer() {
7512
7511
  function SafeBuffer(arg, encodingOrOffset, length) {
7513
7512
  return Buffer3(arg, encodingOrOffset, length);
7514
7513
  }
7515
- SafeBuffer.prototype = Object.create(Buffer3.prototype);
7516
7514
  copyProps(Buffer3, SafeBuffer);
7517
7515
  SafeBuffer.from = function(arg, encodingOrOffset, length) {
7518
7516
  if (typeof arg === "number") {
@@ -8790,9 +8788,9 @@ function require_stream_readable() {
8790
8788
  return from(Readable, iterable, opts);
8791
8789
  };
8792
8790
  }
8793
- function indexOf(xs, x2) {
8794
- for (var i = 0, l = xs.length; i < l; i++) {
8795
- if (xs[i] === x2) return i;
8791
+ function indexOf(xs, x) {
8792
+ for (var i = 0, l3 = xs.length; i < l3; i++) {
8793
+ if (xs[i] === x) return i;
8796
8794
  }
8797
8795
  return -1;
8798
8796
  }
@@ -9171,7 +9169,7 @@ function requireSax() {
9171
9169
  function checkBufferLength(parser) {
9172
9170
  var maxAllowed = Math.max(sax2.MAX_BUFFER_LENGTH, 10);
9173
9171
  var maxActual = 0;
9174
- for (var i = 0, l = buffers.length; i < l; i++) {
9172
+ for (var i = 0, l3 = buffers.length; i < l3; i++) {
9175
9173
  var len = parser[buffers[i]].length;
9176
9174
  if (len > maxAllowed) {
9177
9175
  switch (buffers[i]) {
@@ -9196,7 +9194,7 @@ function requireSax() {
9196
9194
  parser.bufferCheckPosition = m2 + parser.position;
9197
9195
  }
9198
9196
  function clearBuffers(parser) {
9199
- for (var i = 0, l = buffers.length; i < l; i++) {
9197
+ for (var i = 0, l3 = buffers.length; i < l3; i++) {
9200
9198
  parser[buffers[i]] = "";
9201
9199
  }
9202
9200
  }
@@ -9250,27 +9248,27 @@ function requireSax() {
9250
9248
  this._parser = new SAXParser(strict, opt);
9251
9249
  this.writable = true;
9252
9250
  this.readable = true;
9253
- var me2 = this;
9251
+ var me = this;
9254
9252
  this._parser.onend = function() {
9255
- me2.emit("end");
9253
+ me.emit("end");
9256
9254
  };
9257
9255
  this._parser.onerror = function(er) {
9258
- me2.emit("error", er);
9259
- me2._parser.error = null;
9256
+ me.emit("error", er);
9257
+ me._parser.error = null;
9260
9258
  };
9261
9259
  this._decoder = null;
9262
9260
  streamWraps.forEach(function(ev) {
9263
- Object.defineProperty(me2, "on" + ev, {
9261
+ Object.defineProperty(me, "on" + ev, {
9264
9262
  get: function() {
9265
- return me2._parser["on" + ev];
9263
+ return me._parser["on" + ev];
9266
9264
  },
9267
9265
  set: function(h2) {
9268
9266
  if (!h2) {
9269
- me2.removeAllListeners(ev);
9270
- me2._parser["on" + ev] = h2;
9267
+ me.removeAllListeners(ev);
9268
+ me._parser["on" + ev] = h2;
9271
9269
  return h2;
9272
9270
  }
9273
- me2.on(ev, h2);
9271
+ me.on(ev, h2);
9274
9272
  },
9275
9273
  enumerable: true,
9276
9274
  configurable: false
@@ -9302,15 +9300,15 @@ function requireSax() {
9302
9300
  return true;
9303
9301
  };
9304
9302
  SAXStream.prototype.on = function(ev, handler2) {
9305
- var me2 = this;
9306
- if (!me2._parser["on" + ev] && streamWraps.indexOf(ev) !== -1) {
9307
- me2._parser["on" + ev] = function() {
9303
+ var me = this;
9304
+ if (!me._parser["on" + ev] && streamWraps.indexOf(ev) !== -1) {
9305
+ me._parser["on" + ev] = function() {
9308
9306
  var args = arguments.length === 1 ? [arguments[0]] : Array.apply(null, arguments);
9309
9307
  args.splice(0, 0, ev);
9310
- me2.emit.apply(me2, args);
9308
+ me.emit.apply(me, args);
9311
9309
  };
9312
9310
  }
9313
- return Stream.prototype.on.call(me2, ev, handler2);
9311
+ return Stream.prototype.on.call(me, ev, handler2);
9314
9312
  };
9315
9313
  var CDATA = "[CDATA[";
9316
9314
  var DOCTYPE = "DOCTYPE";
@@ -9412,266 +9410,266 @@ function requireSax() {
9412
9410
  // <script> ... <
9413
9411
  };
9414
9412
  sax2.XML_ENTITIES = {
9415
- "amp": "&",
9416
- "gt": ">",
9417
- "lt": "<",
9418
- "quot": '"',
9419
- "apos": "'"
9413
+ amp: "&",
9414
+ gt: ">",
9415
+ lt: "<",
9416
+ quot: '"',
9417
+ apos: "'"
9420
9418
  };
9421
9419
  sax2.ENTITIES = {
9422
- "amp": "&",
9423
- "gt": ">",
9424
- "lt": "<",
9425
- "quot": '"',
9426
- "apos": "'",
9427
- "AElig": 198,
9428
- "Aacute": 193,
9429
- "Acirc": 194,
9430
- "Agrave": 192,
9431
- "Aring": 197,
9432
- "Atilde": 195,
9433
- "Auml": 196,
9434
- "Ccedil": 199,
9435
- "ETH": 208,
9436
- "Eacute": 201,
9437
- "Ecirc": 202,
9438
- "Egrave": 200,
9439
- "Euml": 203,
9440
- "Iacute": 205,
9441
- "Icirc": 206,
9442
- "Igrave": 204,
9443
- "Iuml": 207,
9444
- "Ntilde": 209,
9445
- "Oacute": 211,
9446
- "Ocirc": 212,
9447
- "Ograve": 210,
9448
- "Oslash": 216,
9449
- "Otilde": 213,
9450
- "Ouml": 214,
9451
- "THORN": 222,
9452
- "Uacute": 218,
9453
- "Ucirc": 219,
9454
- "Ugrave": 217,
9455
- "Uuml": 220,
9456
- "Yacute": 221,
9457
- "aacute": 225,
9458
- "acirc": 226,
9459
- "aelig": 230,
9460
- "agrave": 224,
9461
- "aring": 229,
9462
- "atilde": 227,
9463
- "auml": 228,
9464
- "ccedil": 231,
9465
- "eacute": 233,
9466
- "ecirc": 234,
9467
- "egrave": 232,
9468
- "eth": 240,
9469
- "euml": 235,
9470
- "iacute": 237,
9471
- "icirc": 238,
9472
- "igrave": 236,
9473
- "iuml": 239,
9474
- "ntilde": 241,
9475
- "oacute": 243,
9476
- "ocirc": 244,
9477
- "ograve": 242,
9478
- "oslash": 248,
9479
- "otilde": 245,
9480
- "ouml": 246,
9481
- "szlig": 223,
9482
- "thorn": 254,
9483
- "uacute": 250,
9484
- "ucirc": 251,
9485
- "ugrave": 249,
9486
- "uuml": 252,
9487
- "yacute": 253,
9488
- "yuml": 255,
9489
- "copy": 169,
9490
- "reg": 174,
9491
- "nbsp": 160,
9492
- "iexcl": 161,
9493
- "cent": 162,
9494
- "pound": 163,
9495
- "curren": 164,
9496
- "yen": 165,
9497
- "brvbar": 166,
9498
- "sect": 167,
9499
- "uml": 168,
9500
- "ordf": 170,
9501
- "laquo": 171,
9502
- "not": 172,
9503
- "shy": 173,
9504
- "macr": 175,
9505
- "deg": 176,
9506
- "plusmn": 177,
9507
- "sup1": 185,
9508
- "sup2": 178,
9509
- "sup3": 179,
9510
- "acute": 180,
9511
- "micro": 181,
9512
- "para": 182,
9513
- "middot": 183,
9514
- "cedil": 184,
9515
- "ordm": 186,
9516
- "raquo": 187,
9517
- "frac14": 188,
9518
- "frac12": 189,
9519
- "frac34": 190,
9520
- "iquest": 191,
9521
- "times": 215,
9522
- "divide": 247,
9523
- "OElig": 338,
9524
- "oelig": 339,
9525
- "Scaron": 352,
9526
- "scaron": 353,
9527
- "Yuml": 376,
9528
- "fnof": 402,
9529
- "circ": 710,
9530
- "tilde": 732,
9531
- "Alpha": 913,
9532
- "Beta": 914,
9533
- "Gamma": 915,
9534
- "Delta": 916,
9535
- "Epsilon": 917,
9536
- "Zeta": 918,
9537
- "Eta": 919,
9538
- "Theta": 920,
9539
- "Iota": 921,
9540
- "Kappa": 922,
9541
- "Lambda": 923,
9542
- "Mu": 924,
9543
- "Nu": 925,
9544
- "Xi": 926,
9545
- "Omicron": 927,
9546
- "Pi": 928,
9547
- "Rho": 929,
9548
- "Sigma": 931,
9549
- "Tau": 932,
9550
- "Upsilon": 933,
9551
- "Phi": 934,
9552
- "Chi": 935,
9553
- "Psi": 936,
9554
- "Omega": 937,
9555
- "alpha": 945,
9556
- "beta": 946,
9557
- "gamma": 947,
9558
- "delta": 948,
9559
- "epsilon": 949,
9560
- "zeta": 950,
9561
- "eta": 951,
9562
- "theta": 952,
9563
- "iota": 953,
9564
- "kappa": 954,
9565
- "lambda": 955,
9566
- "mu": 956,
9567
- "nu": 957,
9568
- "xi": 958,
9569
- "omicron": 959,
9570
- "pi": 960,
9571
- "rho": 961,
9572
- "sigmaf": 962,
9573
- "sigma": 963,
9574
- "tau": 964,
9575
- "upsilon": 965,
9576
- "phi": 966,
9577
- "chi": 967,
9578
- "psi": 968,
9579
- "omega": 969,
9580
- "thetasym": 977,
9581
- "upsih": 978,
9582
- "piv": 982,
9583
- "ensp": 8194,
9584
- "emsp": 8195,
9585
- "thinsp": 8201,
9586
- "zwnj": 8204,
9587
- "zwj": 8205,
9588
- "lrm": 8206,
9589
- "rlm": 8207,
9590
- "ndash": 8211,
9591
- "mdash": 8212,
9592
- "lsquo": 8216,
9593
- "rsquo": 8217,
9594
- "sbquo": 8218,
9595
- "ldquo": 8220,
9596
- "rdquo": 8221,
9597
- "bdquo": 8222,
9598
- "dagger": 8224,
9599
- "Dagger": 8225,
9600
- "bull": 8226,
9601
- "hellip": 8230,
9602
- "permil": 8240,
9603
- "prime": 8242,
9604
- "Prime": 8243,
9605
- "lsaquo": 8249,
9606
- "rsaquo": 8250,
9607
- "oline": 8254,
9608
- "frasl": 8260,
9609
- "euro": 8364,
9610
- "image": 8465,
9611
- "weierp": 8472,
9612
- "real": 8476,
9613
- "trade": 8482,
9614
- "alefsym": 8501,
9615
- "larr": 8592,
9616
- "uarr": 8593,
9617
- "rarr": 8594,
9618
- "darr": 8595,
9619
- "harr": 8596,
9620
- "crarr": 8629,
9621
- "lArr": 8656,
9622
- "uArr": 8657,
9623
- "rArr": 8658,
9624
- "dArr": 8659,
9625
- "hArr": 8660,
9626
- "forall": 8704,
9627
- "part": 8706,
9628
- "exist": 8707,
9629
- "empty": 8709,
9630
- "nabla": 8711,
9631
- "isin": 8712,
9632
- "notin": 8713,
9633
- "ni": 8715,
9634
- "prod": 8719,
9635
- "sum": 8721,
9636
- "minus": 8722,
9637
- "lowast": 8727,
9638
- "radic": 8730,
9639
- "prop": 8733,
9640
- "infin": 8734,
9641
- "ang": 8736,
9642
- "and": 8743,
9643
- "or": 8744,
9644
- "cap": 8745,
9645
- "cup": 8746,
9646
- "int": 8747,
9647
- "there4": 8756,
9648
- "sim": 8764,
9649
- "cong": 8773,
9650
- "asymp": 8776,
9651
- "ne": 8800,
9652
- "equiv": 8801,
9653
- "le": 8804,
9654
- "ge": 8805,
9655
- "sub": 8834,
9656
- "sup": 8835,
9657
- "nsub": 8836,
9658
- "sube": 8838,
9659
- "supe": 8839,
9660
- "oplus": 8853,
9661
- "otimes": 8855,
9662
- "perp": 8869,
9663
- "sdot": 8901,
9664
- "lceil": 8968,
9665
- "rceil": 8969,
9666
- "lfloor": 8970,
9667
- "rfloor": 8971,
9668
- "lang": 9001,
9669
- "rang": 9002,
9670
- "loz": 9674,
9671
- "spades": 9824,
9672
- "clubs": 9827,
9673
- "hearts": 9829,
9674
- "diams": 9830
9420
+ amp: "&",
9421
+ gt: ">",
9422
+ lt: "<",
9423
+ quot: '"',
9424
+ apos: "'",
9425
+ AElig: 198,
9426
+ Aacute: 193,
9427
+ Acirc: 194,
9428
+ Agrave: 192,
9429
+ Aring: 197,
9430
+ Atilde: 195,
9431
+ Auml: 196,
9432
+ Ccedil: 199,
9433
+ ETH: 208,
9434
+ Eacute: 201,
9435
+ Ecirc: 202,
9436
+ Egrave: 200,
9437
+ Euml: 203,
9438
+ Iacute: 205,
9439
+ Icirc: 206,
9440
+ Igrave: 204,
9441
+ Iuml: 207,
9442
+ Ntilde: 209,
9443
+ Oacute: 211,
9444
+ Ocirc: 212,
9445
+ Ograve: 210,
9446
+ Oslash: 216,
9447
+ Otilde: 213,
9448
+ Ouml: 214,
9449
+ THORN: 222,
9450
+ Uacute: 218,
9451
+ Ucirc: 219,
9452
+ Ugrave: 217,
9453
+ Uuml: 220,
9454
+ Yacute: 221,
9455
+ aacute: 225,
9456
+ acirc: 226,
9457
+ aelig: 230,
9458
+ agrave: 224,
9459
+ aring: 229,
9460
+ atilde: 227,
9461
+ auml: 228,
9462
+ ccedil: 231,
9463
+ eacute: 233,
9464
+ ecirc: 234,
9465
+ egrave: 232,
9466
+ eth: 240,
9467
+ euml: 235,
9468
+ iacute: 237,
9469
+ icirc: 238,
9470
+ igrave: 236,
9471
+ iuml: 239,
9472
+ ntilde: 241,
9473
+ oacute: 243,
9474
+ ocirc: 244,
9475
+ ograve: 242,
9476
+ oslash: 248,
9477
+ otilde: 245,
9478
+ ouml: 246,
9479
+ szlig: 223,
9480
+ thorn: 254,
9481
+ uacute: 250,
9482
+ ucirc: 251,
9483
+ ugrave: 249,
9484
+ uuml: 252,
9485
+ yacute: 253,
9486
+ yuml: 255,
9487
+ copy: 169,
9488
+ reg: 174,
9489
+ nbsp: 160,
9490
+ iexcl: 161,
9491
+ cent: 162,
9492
+ pound: 163,
9493
+ curren: 164,
9494
+ yen: 165,
9495
+ brvbar: 166,
9496
+ sect: 167,
9497
+ uml: 168,
9498
+ ordf: 170,
9499
+ laquo: 171,
9500
+ not: 172,
9501
+ shy: 173,
9502
+ macr: 175,
9503
+ deg: 176,
9504
+ plusmn: 177,
9505
+ sup1: 185,
9506
+ sup2: 178,
9507
+ sup3: 179,
9508
+ acute: 180,
9509
+ micro: 181,
9510
+ para: 182,
9511
+ middot: 183,
9512
+ cedil: 184,
9513
+ ordm: 186,
9514
+ raquo: 187,
9515
+ frac14: 188,
9516
+ frac12: 189,
9517
+ frac34: 190,
9518
+ iquest: 191,
9519
+ times: 215,
9520
+ divide: 247,
9521
+ OElig: 338,
9522
+ oelig: 339,
9523
+ Scaron: 352,
9524
+ scaron: 353,
9525
+ Yuml: 376,
9526
+ fnof: 402,
9527
+ circ: 710,
9528
+ tilde: 732,
9529
+ Alpha: 913,
9530
+ Beta: 914,
9531
+ Gamma: 915,
9532
+ Delta: 916,
9533
+ Epsilon: 917,
9534
+ Zeta: 918,
9535
+ Eta: 919,
9536
+ Theta: 920,
9537
+ Iota: 921,
9538
+ Kappa: 922,
9539
+ Lambda: 923,
9540
+ Mu: 924,
9541
+ Nu: 925,
9542
+ Xi: 926,
9543
+ Omicron: 927,
9544
+ Pi: 928,
9545
+ Rho: 929,
9546
+ Sigma: 931,
9547
+ Tau: 932,
9548
+ Upsilon: 933,
9549
+ Phi: 934,
9550
+ Chi: 935,
9551
+ Psi: 936,
9552
+ Omega: 937,
9553
+ alpha: 945,
9554
+ beta: 946,
9555
+ gamma: 947,
9556
+ delta: 948,
9557
+ epsilon: 949,
9558
+ zeta: 950,
9559
+ eta: 951,
9560
+ theta: 952,
9561
+ iota: 953,
9562
+ kappa: 954,
9563
+ lambda: 955,
9564
+ mu: 956,
9565
+ nu: 957,
9566
+ xi: 958,
9567
+ omicron: 959,
9568
+ pi: 960,
9569
+ rho: 961,
9570
+ sigmaf: 962,
9571
+ sigma: 963,
9572
+ tau: 964,
9573
+ upsilon: 965,
9574
+ phi: 966,
9575
+ chi: 967,
9576
+ psi: 968,
9577
+ omega: 969,
9578
+ thetasym: 977,
9579
+ upsih: 978,
9580
+ piv: 982,
9581
+ ensp: 8194,
9582
+ emsp: 8195,
9583
+ thinsp: 8201,
9584
+ zwnj: 8204,
9585
+ zwj: 8205,
9586
+ lrm: 8206,
9587
+ rlm: 8207,
9588
+ ndash: 8211,
9589
+ mdash: 8212,
9590
+ lsquo: 8216,
9591
+ rsquo: 8217,
9592
+ sbquo: 8218,
9593
+ ldquo: 8220,
9594
+ rdquo: 8221,
9595
+ bdquo: 8222,
9596
+ dagger: 8224,
9597
+ Dagger: 8225,
9598
+ bull: 8226,
9599
+ hellip: 8230,
9600
+ permil: 8240,
9601
+ prime: 8242,
9602
+ Prime: 8243,
9603
+ lsaquo: 8249,
9604
+ rsaquo: 8250,
9605
+ oline: 8254,
9606
+ frasl: 8260,
9607
+ euro: 8364,
9608
+ image: 8465,
9609
+ weierp: 8472,
9610
+ real: 8476,
9611
+ trade: 8482,
9612
+ alefsym: 8501,
9613
+ larr: 8592,
9614
+ uarr: 8593,
9615
+ rarr: 8594,
9616
+ darr: 8595,
9617
+ harr: 8596,
9618
+ crarr: 8629,
9619
+ lArr: 8656,
9620
+ uArr: 8657,
9621
+ rArr: 8658,
9622
+ dArr: 8659,
9623
+ hArr: 8660,
9624
+ forall: 8704,
9625
+ part: 8706,
9626
+ exist: 8707,
9627
+ empty: 8709,
9628
+ nabla: 8711,
9629
+ isin: 8712,
9630
+ notin: 8713,
9631
+ ni: 8715,
9632
+ prod: 8719,
9633
+ sum: 8721,
9634
+ minus: 8722,
9635
+ lowast: 8727,
9636
+ radic: 8730,
9637
+ prop: 8733,
9638
+ infin: 8734,
9639
+ ang: 8736,
9640
+ and: 8743,
9641
+ or: 8744,
9642
+ cap: 8745,
9643
+ cup: 8746,
9644
+ int: 8747,
9645
+ there4: 8756,
9646
+ sim: 8764,
9647
+ cong: 8773,
9648
+ asymp: 8776,
9649
+ ne: 8800,
9650
+ equiv: 8801,
9651
+ le: 8804,
9652
+ ge: 8805,
9653
+ sub: 8834,
9654
+ sup: 8835,
9655
+ nsub: 8836,
9656
+ sube: 8838,
9657
+ supe: 8839,
9658
+ oplus: 8853,
9659
+ otimes: 8855,
9660
+ perp: 8869,
9661
+ sdot: 8901,
9662
+ lceil: 8968,
9663
+ rceil: 8969,
9664
+ lfloor: 8970,
9665
+ rfloor: 8971,
9666
+ lang: 9001,
9667
+ rang: 9002,
9668
+ loz: 9674,
9669
+ spades: 9824,
9670
+ clubs: 9827,
9671
+ hearts: 9829,
9672
+ diams: 9830
9675
9673
  };
9676
9674
  Object.keys(sax2.ENTITIES).forEach(function(key) {
9677
9675
  var e = sax2.ENTITIES[key];
@@ -9710,7 +9708,8 @@ function requireSax() {
9710
9708
  return parser;
9711
9709
  }
9712
9710
  function end(parser) {
9713
- if (parser.sawRoot && !parser.closedRoot) strictFail(parser, "Unclosed root tag");
9711
+ if (parser.sawRoot && !parser.closedRoot)
9712
+ strictFail(parser, "Unclosed root tag");
9714
9713
  if (parser.state !== S2.BEGIN && parser.state !== S2.BEGIN_WHITESPACE && parser.state !== S2.TEXT) {
9715
9714
  error(parser, "Unexpected end");
9716
9715
  }
@@ -9800,7 +9799,10 @@ function requireSax() {
9800
9799
  tag.local = qn.local;
9801
9800
  tag.uri = tag.ns[qn.prefix] || "";
9802
9801
  if (tag.prefix && !tag.uri) {
9803
- strictFail(parser, "Unbound namespace prefix: " + JSON.stringify(parser.tagName));
9802
+ strictFail(
9803
+ parser,
9804
+ "Unbound namespace prefix: " + JSON.stringify(parser.tagName)
9805
+ );
9804
9806
  tag.uri = qn.prefix;
9805
9807
  }
9806
9808
  var parent = parser.tags[parser.tags.length - 1] || parser;
@@ -9812,7 +9814,7 @@ function requireSax() {
9812
9814
  });
9813
9815
  });
9814
9816
  }
9815
- for (var i = 0, l = parser.attribList.length; i < l; i++) {
9817
+ for (var i = 0, l3 = parser.attribList.length; i < l3; i++) {
9816
9818
  var nv = parser.attribList[i];
9817
9819
  var name = nv[0];
9818
9820
  var value = nv[1];
@@ -9828,7 +9830,10 @@ function requireSax() {
9828
9830
  uri: uri2
9829
9831
  };
9830
9832
  if (prefix && prefix !== "xmlns" && !uri2) {
9831
- strictFail(parser, "Unbound namespace prefix: " + JSON.stringify(prefix));
9833
+ strictFail(
9834
+ parser,
9835
+ "Unbound namespace prefix: " + JSON.stringify(prefix)
9836
+ );
9832
9837
  a.uri = prefix;
9833
9838
  }
9834
9839
  parser.tag.attributes[name] = a;
@@ -9895,9 +9900,9 @@ function requireSax() {
9895
9900
  var tag = parser.tag = parser.tags.pop();
9896
9901
  parser.tagName = parser.tag.name;
9897
9902
  emitNode(parser, "onclosetag", parser.tagName);
9898
- var x2 = {};
9903
+ var x = {};
9899
9904
  for (var i in tag.ns) {
9900
- x2[i] = tag.ns[i];
9905
+ x[i] = tag.ns[i];
9901
9906
  }
9902
9907
  var parent = parser.tags[parser.tags.length - 1] || parser;
9903
9908
  if (parser.opt.xmlns && tag.ns !== parent.ns) {
@@ -9936,7 +9941,7 @@ function requireSax() {
9936
9941
  }
9937
9942
  }
9938
9943
  entity = entity.replace(/^0+/, "");
9939
- if (isNaN(num) || numStr.toLowerCase() !== entity) {
9944
+ if (isNaN(num) || numStr.toLowerCase() !== entity || num < 0 || num > 1114111) {
9940
9945
  strictFail(parser, "Invalid character entity");
9941
9946
  return "&" + parser.entity + ";";
9942
9947
  }
@@ -10194,10 +10199,22 @@ function requireSax() {
10194
10199
  }
10195
10200
  continue;
10196
10201
  case S2.CDATA:
10202
+ var starti = i - 1;
10203
+ while (c && c !== "]") {
10204
+ c = charAt(chunk, i++);
10205
+ if (c && parser.trackPosition) {
10206
+ parser.position++;
10207
+ if (c === "\n") {
10208
+ parser.line++;
10209
+ parser.column = 0;
10210
+ } else {
10211
+ parser.column++;
10212
+ }
10213
+ }
10214
+ }
10215
+ parser.cdata += chunk.substring(starti, i - 1);
10197
10216
  if (c === "]") {
10198
10217
  parser.state = S2.CDATA_ENDING;
10199
- } else {
10200
- parser.cdata += c;
10201
10218
  }
10202
10219
  continue;
10203
10220
  case S2.CDATA_ENDING:
@@ -10276,7 +10293,10 @@ function requireSax() {
10276
10293
  openTag(parser, true);
10277
10294
  closeTag(parser);
10278
10295
  } else {
10279
- strictFail(parser, "Forward-slash in opening tag not followed by >");
10296
+ strictFail(
10297
+ parser,
10298
+ "Forward-slash in opening tag not followed by >"
10299
+ );
10280
10300
  parser.state = S2.ATTRIB;
10281
10301
  }
10282
10302
  continue;
@@ -10939,8 +10959,8 @@ function requireXml2json() {
10939
10959
  js = xml2js2(xml, options);
10940
10960
  parentKey = "compact" in options && options.compact ? "_parent" : "parent";
10941
10961
  if ("addParent" in options && options.addParent) {
10942
- json = JSON.stringify(js, function(k2, v2) {
10943
- return k2 === parentKey ? "_" : v2;
10962
+ json = JSON.stringify(js, function(k, v2) {
10963
+ return k === parentKey ? "_" : v2;
10944
10964
  }, options.spaces);
10945
10965
  } else {
10946
10966
  json = JSON.stringify(js, null, options.spaces);
@@ -11362,8 +11382,8 @@ function v4(options, buf, offset) {
11362
11382
  rnds[8] = rnds[8] & 63 | 128;
11363
11383
  return unsafeStringify(rnds);
11364
11384
  }
11365
- function getDefaultExportFromCjs(x2) {
11366
- return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;
11385
+ function getDefaultExportFromCjs(x) {
11386
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
11367
11387
  }
11368
11388
  const CRC_TABLE = new Int32Array([
11369
11389
  0,
@@ -12736,9 +12756,9 @@ class ResolvedPos {
12736
12756
  blockRange(other = this, pred) {
12737
12757
  if (other.pos < this.pos)
12738
12758
  return other.blockRange(this);
12739
- for (let d = this.depth - (this.parent.inlineContent || this.pos == other.pos ? 1 : 0); d >= 0; d--)
12740
- if (other.pos <= this.end(d) && (!pred || pred(this.node(d))))
12741
- return new NodeRange(this, other, d);
12759
+ for (let d2 = this.depth - (this.parent.inlineContent || this.pos == other.pos ? 1 : 0); d2 >= 0; d2--)
12760
+ if (other.pos <= this.end(d2) && (!pred || pred(this.node(d2))))
12761
+ return new NodeRange(this, other, d2);
12742
12762
  return null;
12743
12763
  }
12744
12764
  /**
@@ -14757,8 +14777,8 @@ class ParseContext {
14757
14777
  textblockFromContext() {
14758
14778
  let $context = this.options.context;
14759
14779
  if ($context)
14760
- for (let d = $context.depth; d >= 0; d--) {
14761
- let deflt = $context.node(d).contentMatchAt($context.indexAfter(d)).defaultType;
14780
+ for (let d2 = $context.depth; d2 >= 0; d2--) {
14781
+ let deflt = $context.node(d2).contentMatchAt($context.indexAfter(d2)).defaultType;
14762
14782
  if (deflt && deflt.isTextblock && deflt.defaultAttrs)
14763
14783
  return deflt;
14764
14784
  }
@@ -15179,8 +15199,8 @@ function polygonToObj(polygonNode) {
15179
15199
  const points = [];
15180
15200
  polygonNode.elements.forEach((element) => {
15181
15201
  if (["wp:start", "wp:lineTo"].includes(element.name)) {
15182
- const { x: x2, y: y2 } = element.attributes;
15183
- points.push([polygonUnitsToPixels(x2), polygonUnitsToPixels(y2)]);
15202
+ const { x, y: y2 } = element.attributes;
15203
+ points.push([polygonUnitsToPixels(x), polygonUnitsToPixels(y2)]);
15184
15204
  }
15185
15205
  });
15186
15206
  if (points.length > 1) {
@@ -15203,13 +15223,13 @@ function objToPolygon(points) {
15203
15223
  elements: []
15204
15224
  };
15205
15225
  points.forEach((point, index2) => {
15206
- const [x2, y2] = point;
15226
+ const [x, y2] = point;
15207
15227
  const tagName = index2 === 0 ? "wp:start" : "wp:lineTo";
15208
15228
  const pointNode = {
15209
15229
  name: tagName,
15210
15230
  type: tagName,
15211
15231
  attributes: {
15212
- x: pixelsToPolygonUnits(x2),
15232
+ x: pixelsToPolygonUnits(x),
15213
15233
  y: pixelsToPolygonUnits(y2)
15214
15234
  }
15215
15235
  };
@@ -17441,19 +17461,19 @@ function lift(tr, range2, target) {
17441
17461
  let gapStart = $from.before(depth + 1), gapEnd = $to.after(depth + 1);
17442
17462
  let start = gapStart, end = gapEnd;
17443
17463
  let before = Fragment.empty, openStart = 0;
17444
- for (let d = depth, splitting = false; d > target; d--)
17445
- if (splitting || $from.index(d) > 0) {
17464
+ for (let d2 = depth, splitting = false; d2 > target; d2--)
17465
+ if (splitting || $from.index(d2) > 0) {
17446
17466
  splitting = true;
17447
- before = Fragment.from($from.node(d).copy(before));
17467
+ before = Fragment.from($from.node(d2).copy(before));
17448
17468
  openStart++;
17449
17469
  } else {
17450
17470
  start--;
17451
17471
  }
17452
17472
  let after = Fragment.empty, openEnd = 0;
17453
- for (let d = depth, splitting = false; d > target; d--)
17454
- if (splitting || $to.after(d + 1) < $to.end(d)) {
17473
+ for (let d2 = depth, splitting = false; d2 > target; d2--)
17474
+ if (splitting || $to.after(d2 + 1) < $to.end(d2)) {
17455
17475
  splitting = true;
17456
- after = Fragment.from($to.node(d).copy(after));
17476
+ after = Fragment.from($to.node(d2).copy(after));
17457
17477
  openEnd++;
17458
17478
  } else {
17459
17479
  end++;
@@ -17573,8 +17593,8 @@ function canSplit(doc2, pos, depth = 1, typesAfter) {
17573
17593
  let innerType = typesAfter && typesAfter[typesAfter.length - 1] || $pos.parent;
17574
17594
  if (base < 0 || $pos.parent.type.spec.isolating || !$pos.parent.canReplace($pos.index(), $pos.parent.childCount) || !innerType.type.validContent($pos.parent.content.cutByIndex($pos.index(), $pos.parent.childCount)))
17575
17595
  return false;
17576
- for (let d = $pos.depth - 1, i = depth - 2; d > base; d--, i--) {
17577
- let node = $pos.node(d), index3 = $pos.index(d);
17596
+ for (let d2 = $pos.depth - 1, i = depth - 2; d2 > base; d2--, i--) {
17597
+ let node = $pos.node(d2), index3 = $pos.index(d2);
17578
17598
  if (node.type.spec.isolating)
17579
17599
  return false;
17580
17600
  let rest = node.content.cutByIndex(index3, node.childCount);
@@ -17591,10 +17611,10 @@ function canSplit(doc2, pos, depth = 1, typesAfter) {
17591
17611
  }
17592
17612
  function split(tr, pos, depth = 1, typesAfter) {
17593
17613
  let $pos = tr.doc.resolve(pos), before = Fragment.empty, after = Fragment.empty;
17594
- for (let d = $pos.depth, e = $pos.depth - depth, i = depth - 1; d > e; d--, i--) {
17595
- before = Fragment.from($pos.node(d).copy(before));
17614
+ for (let d2 = $pos.depth, e = $pos.depth - depth, i = depth - 1; d2 > e; d2--, i--) {
17615
+ before = Fragment.from($pos.node(d2).copy(before));
17596
17616
  let typeAfter = typesAfter && typesAfter[i];
17597
- after = Fragment.from(typeAfter ? typeAfter.type.create(typeAfter.attrs, after) : $pos.node(d).copy(after));
17617
+ after = Fragment.from(typeAfter ? typeAfter.type.create(typeAfter.attrs, after) : $pos.node(d2).copy(after));
17598
17618
  }
17599
17619
  tr.step(new ReplaceStep(pos, pos, new Slice(before.append(after), depth, depth), true));
17600
17620
  }
@@ -17623,24 +17643,24 @@ function joinable(a, b2) {
17623
17643
  }
17624
17644
  function joinPoint(doc2, pos, dir = -1) {
17625
17645
  let $pos = doc2.resolve(pos);
17626
- for (let d = $pos.depth; ; d--) {
17627
- let before, after, index2 = $pos.index(d);
17628
- if (d == $pos.depth) {
17646
+ for (let d2 = $pos.depth; ; d2--) {
17647
+ let before, after, index2 = $pos.index(d2);
17648
+ if (d2 == $pos.depth) {
17629
17649
  before = $pos.nodeBefore;
17630
17650
  after = $pos.nodeAfter;
17631
17651
  } else if (dir > 0) {
17632
- before = $pos.node(d + 1);
17652
+ before = $pos.node(d2 + 1);
17633
17653
  index2++;
17634
- after = $pos.node(d).maybeChild(index2);
17654
+ after = $pos.node(d2).maybeChild(index2);
17635
17655
  } else {
17636
- before = $pos.node(d).maybeChild(index2 - 1);
17637
- after = $pos.node(d + 1);
17656
+ before = $pos.node(d2).maybeChild(index2 - 1);
17657
+ after = $pos.node(d2 + 1);
17638
17658
  }
17639
- if (before && !before.isTextblock && joinable(before, after) && $pos.node(d).canReplace(index2, index2 + 1))
17659
+ if (before && !before.isTextblock && joinable(before, after) && $pos.node(d2).canReplace(index2, index2 + 1))
17640
17660
  return pos;
17641
- if (d == 0)
17661
+ if (d2 == 0)
17642
17662
  break;
17643
- pos = dir < 0 ? $pos.before(d) : $pos.after(d);
17663
+ pos = dir < 0 ? $pos.before(d2) : $pos.after(d2);
17644
17664
  }
17645
17665
  }
17646
17666
  function join(tr, pos, depth) {
@@ -17675,19 +17695,19 @@ function insertPoint(doc2, pos, nodeType) {
17675
17695
  if ($pos.parent.canReplaceWith($pos.index(), $pos.index(), nodeType))
17676
17696
  return pos;
17677
17697
  if ($pos.parentOffset == 0)
17678
- for (let d = $pos.depth - 1; d >= 0; d--) {
17679
- let index2 = $pos.index(d);
17680
- if ($pos.node(d).canReplaceWith(index2, index2, nodeType))
17681
- return $pos.before(d + 1);
17698
+ for (let d2 = $pos.depth - 1; d2 >= 0; d2--) {
17699
+ let index2 = $pos.index(d2);
17700
+ if ($pos.node(d2).canReplaceWith(index2, index2, nodeType))
17701
+ return $pos.before(d2 + 1);
17682
17702
  if (index2 > 0)
17683
17703
  return null;
17684
17704
  }
17685
17705
  if ($pos.parentOffset == $pos.parent.content.size)
17686
- for (let d = $pos.depth - 1; d >= 0; d--) {
17687
- let index2 = $pos.indexAfter(d);
17688
- if ($pos.node(d).canReplaceWith(index2, index2, nodeType))
17689
- return $pos.after(d + 1);
17690
- if (index2 < $pos.node(d).childCount)
17706
+ for (let d2 = $pos.depth - 1; d2 >= 0; d2--) {
17707
+ let index2 = $pos.indexAfter(d2);
17708
+ if ($pos.node(d2).canReplaceWith(index2, index2, nodeType))
17709
+ return $pos.after(d2 + 1);
17710
+ if (index2 < $pos.node(d2).childCount)
17691
17711
  return null;
17692
17712
  }
17693
17713
  return null;
@@ -17700,10 +17720,10 @@ function dropPoint(doc2, pos, slice) {
17700
17720
  for (let i = 0; i < slice.openStart; i++)
17701
17721
  content = content.firstChild.content;
17702
17722
  for (let pass = 1; pass <= (slice.openStart == 0 && slice.size ? 2 : 1); pass++) {
17703
- for (let d = $pos.depth; d >= 0; d--) {
17704
- let bias = d == $pos.depth ? 0 : $pos.pos <= ($pos.start(d + 1) + $pos.end(d + 1)) / 2 ? -1 : 1;
17705
- let insertPos = $pos.index(d) + (bias > 0 ? 1 : 0);
17706
- let parent = $pos.node(d), fits = false;
17723
+ for (let d2 = $pos.depth; d2 >= 0; d2--) {
17724
+ let bias = d2 == $pos.depth ? 0 : $pos.pos <= ($pos.start(d2 + 1) + $pos.end(d2 + 1)) / 2 ? -1 : 1;
17725
+ let insertPos = $pos.index(d2) + (bias > 0 ? 1 : 0);
17726
+ let parent = $pos.node(d2), fits = false;
17707
17727
  if (pass == 1) {
17708
17728
  fits = parent.canReplace(insertPos, insertPos, content);
17709
17729
  } else {
@@ -17711,7 +17731,7 @@ function dropPoint(doc2, pos, slice) {
17711
17731
  fits = wrapping && parent.canReplaceWith(insertPos, insertPos, wrapping[0]);
17712
17732
  }
17713
17733
  if (fits)
17714
- return bias == 0 ? $pos.pos : bias < 0 ? $pos.before(d + 1) : $pos.after(d + 1);
17734
+ return bias == 0 ? $pos.pos : bias < 0 ? $pos.before(d2 + 1) : $pos.after(d2 + 1);
17715
17735
  }
17716
17736
  }
17717
17737
  return null;
@@ -17777,12 +17797,12 @@ class Fitter {
17777
17797
  // depths, one for the slice and one for the frontier.
17778
17798
  findFittable() {
17779
17799
  let startDepth = this.unplaced.openStart;
17780
- for (let cur = this.unplaced.content, d = 0, openEnd = this.unplaced.openEnd; d < startDepth; d++) {
17800
+ for (let cur = this.unplaced.content, d2 = 0, openEnd = this.unplaced.openEnd; d2 < startDepth; d2++) {
17781
17801
  let node = cur.firstChild;
17782
17802
  if (cur.childCount > 1)
17783
17803
  openEnd = 0;
17784
- if (node.type.spec.isolating && openEnd <= d) {
17785
- startDepth = d;
17804
+ if (node.type.spec.isolating && openEnd <= d2) {
17805
+ startDepth = d2;
17786
17806
  break;
17787
17807
  }
17788
17808
  cur = node.content;
@@ -17888,9 +17908,9 @@ class Fitter {
17888
17908
  let fit = contentAfterFits($to, i, type2, match, dropInner);
17889
17909
  if (!fit)
17890
17910
  continue;
17891
- for (let d = i - 1; d >= 0; d--) {
17892
- let { match: match2, type: type3 } = this.frontier[d];
17893
- let matches2 = contentAfterFits($to, d, type3, match2, true);
17911
+ for (let d2 = i - 1; d2 >= 0; d2--) {
17912
+ let { match: match2, type: type3 } = this.frontier[d2];
17913
+ let matches2 = contentAfterFits($to, d2, type3, match2, true);
17894
17914
  if (!matches2 || matches2.childCount)
17895
17915
  continue scan;
17896
17916
  }
@@ -17906,8 +17926,8 @@ class Fitter {
17906
17926
  if (close2.fit.childCount)
17907
17927
  this.placed = addToFragment(this.placed, close2.depth, close2.fit);
17908
17928
  $to = close2.move;
17909
- for (let d = close2.depth + 1; d <= $to.depth; d++) {
17910
- let node = $to.node(d), add = node.type.contentMatch.fillBefore(node.content, true, $to.index(d));
17929
+ for (let d2 = close2.depth + 1; d2 <= $to.depth; d2++) {
17930
+ let node = $to.node(d2), add = node.type.contentMatch.fillBefore(node.content, true, $to.index(d2));
17911
17931
  this.openFrontierNode(node.type, node.attrs, add);
17912
17932
  }
17913
17933
  return $to;
@@ -17980,14 +18000,14 @@ function replaceRange(tr, from, to, slice) {
17980
18000
  targetDepths.pop();
17981
18001
  let preferredTarget = -($from.depth + 1);
17982
18002
  targetDepths.unshift(preferredTarget);
17983
- for (let d = $from.depth, pos = $from.pos - 1; d > 0; d--, pos--) {
17984
- let spec = $from.node(d).type.spec;
18003
+ for (let d2 = $from.depth, pos = $from.pos - 1; d2 > 0; d2--, pos--) {
18004
+ let spec = $from.node(d2).type.spec;
17985
18005
  if (spec.defining || spec.definingAsContext || spec.isolating)
17986
18006
  break;
17987
- if (targetDepths.indexOf(d) > -1)
17988
- preferredTarget = d;
17989
- else if ($from.before(d) == pos)
17990
- targetDepths.splice(1, 0, -d);
18007
+ if (targetDepths.indexOf(d2) > -1)
18008
+ preferredTarget = d2;
18009
+ else if ($from.before(d2) == pos)
18010
+ targetDepths.splice(1, 0, -d2);
17991
18011
  }
17992
18012
  let preferredTargetIndex = targetDepths.indexOf(preferredTarget);
17993
18013
  let leftNodes = [], preferredDepth = slice.openStart;
@@ -17998,10 +18018,10 @@ function replaceRange(tr, from, to, slice) {
17998
18018
  break;
17999
18019
  content = node.content;
18000
18020
  }
18001
- for (let d = preferredDepth - 1; d >= 0; d--) {
18002
- let leftNode = leftNodes[d], def = definesContent(leftNode.type);
18021
+ for (let d2 = preferredDepth - 1; d2 >= 0; d2--) {
18022
+ let leftNode = leftNodes[d2], def = definesContent(leftNode.type);
18003
18023
  if (def && !leftNode.sameMarkup($from.node(Math.abs(preferredTarget) - 1)))
18004
- preferredDepth = d;
18024
+ preferredDepth = d2;
18005
18025
  else if (def || !leftNode.type.isTextblock)
18006
18026
  break;
18007
18027
  }
@@ -18063,20 +18083,20 @@ function deleteRange(tr, from, to) {
18063
18083
  if (depth > 0 && (last || $from.node(depth - 1).canReplace($from.index(depth - 1), $to.indexAfter(depth - 1))))
18064
18084
  return tr.delete($from.before(depth), $to.after(depth));
18065
18085
  }
18066
- for (let d = 1; d <= $from.depth && d <= $to.depth; d++) {
18067
- if (from - $from.start(d) == $from.depth - d && to > $from.end(d) && $to.end(d) - to != $to.depth - d && $from.start(d - 1) == $to.start(d - 1) && $from.node(d - 1).canReplace($from.index(d - 1), $to.index(d - 1)))
18068
- return tr.delete($from.before(d), to);
18086
+ for (let d2 = 1; d2 <= $from.depth && d2 <= $to.depth; d2++) {
18087
+ if (from - $from.start(d2) == $from.depth - d2 && to > $from.end(d2) && $to.end(d2) - to != $to.depth - d2 && $from.start(d2 - 1) == $to.start(d2 - 1) && $from.node(d2 - 1).canReplace($from.index(d2 - 1), $to.index(d2 - 1)))
18088
+ return tr.delete($from.before(d2), to);
18069
18089
  }
18070
18090
  tr.delete(from, to);
18071
18091
  }
18072
18092
  function coveredDepths($from, $to) {
18073
18093
  let result = [], minDepth = Math.min($from.depth, $to.depth);
18074
- for (let d = minDepth; d >= 0; d--) {
18075
- let start = $from.start(d);
18076
- if (start < $from.pos - ($from.depth - d) || $to.end(d) > $to.pos + ($to.depth - d) || $from.node(d).type.spec.isolating || $to.node(d).type.spec.isolating)
18094
+ for (let d2 = minDepth; d2 >= 0; d2--) {
18095
+ let start = $from.start(d2);
18096
+ if (start < $from.pos - ($from.depth - d2) || $to.end(d2) > $to.pos + ($to.depth - d2) || $from.node(d2).type.spec.isolating || $to.node(d2).type.spec.isolating)
18077
18097
  break;
18078
- if (start == $to.start(d) || d == $from.depth && d == $to.depth && $from.parent.inlineContent && $to.parent.inlineContent && d && $to.start(d - 1) == start - 1)
18079
- result.push(d);
18098
+ if (start == $to.start(d2) || d2 == $from.depth && d2 == $to.depth && $from.parent.inlineContent && $to.parent.inlineContent && d2 && $to.start(d2 - 1) == start - 1)
18099
+ result.push(d2);
18080
18100
  }
18081
18101
  return result;
18082
18102
  }
@@ -20569,7 +20589,23 @@ const baseNumbering = {
20569
20589
  ]
20570
20590
  };
20571
20591
  const docxNumberingCacheStore = /* @__PURE__ */ new WeakMap();
20592
+ const NUMBERING_CACHE_KEY = "numbering-cache";
20572
20593
  const LEVELS_MAP_KEY = Symbol("superdoc.numbering.levels");
20594
+ const NUMBERING_CACHE_DOCX_KEY = Symbol("superdoc.numbering.docx");
20595
+ const clearConverterCache = (converter) => {
20596
+ if (!converter) return;
20597
+ delete converter[NUMBERING_CACHE_KEY];
20598
+ delete converter[NUMBERING_CACHE_DOCX_KEY];
20599
+ };
20600
+ const setConverterCache = (converter, cache, docx) => {
20601
+ if (!converter) return;
20602
+ converter[NUMBERING_CACHE_KEY] = cache;
20603
+ if (docx && typeof docx === "object") {
20604
+ converter[NUMBERING_CACHE_DOCX_KEY] = docx;
20605
+ } else {
20606
+ delete converter[NUMBERING_CACHE_DOCX_KEY];
20607
+ }
20608
+ };
20573
20609
  const createEmptyCache = () => ({
20574
20610
  numToAbstractId: /* @__PURE__ */ new Map(),
20575
20611
  abstractById: /* @__PURE__ */ new Map(),
@@ -20641,12 +20677,27 @@ const buildNumberingCache = (docx) => {
20641
20677
  }
20642
20678
  return { numToAbstractId, abstractById, templateById, numToDefinition, numNodesById };
20643
20679
  };
20644
- const ensureNumberingCache = (docx) => {
20680
+ const ensureNumberingCache = (docx, converter) => {
20681
+ if (converter?.[NUMBERING_CACHE_KEY]) {
20682
+ const cachedDocx = converter[NUMBERING_CACHE_DOCX_KEY];
20683
+ if (docx && cachedDocx && cachedDocx !== docx) {
20684
+ clearConverterCache(converter);
20685
+ } else {
20686
+ return converter[NUMBERING_CACHE_KEY];
20687
+ }
20688
+ }
20645
20689
  if (!docx || typeof docx !== "object") return createEmptyCache();
20646
20690
  const existingCache = docxNumberingCacheStore.get(docx);
20647
- if (existingCache) return existingCache;
20691
+ if (existingCache) {
20692
+ setConverterCache(converter, existingCache, docx);
20693
+ return existingCache;
20694
+ }
20648
20695
  const cache = buildNumberingCache(docx);
20649
- docxNumberingCacheStore.set(docx, cache);
20696
+ if (converter) {
20697
+ setConverterCache(converter, cache, docx);
20698
+ } else {
20699
+ docxNumberingCacheStore.set(docx, cache);
20700
+ }
20650
20701
  return cache;
20651
20702
  };
20652
20703
  const handleListNode = (params) => {
@@ -20903,11 +20954,11 @@ const getListNumIdFromStyleRef = (styleId, docx) => {
20903
20954
  }
20904
20955
  return { numId, ilvl };
20905
20956
  };
20906
- const getAbstractDefinition = (numId, docx) => {
20957
+ const getAbstractDefinition = (numId, docx, converter) => {
20907
20958
  const numberingXml = docx["word/numbering.xml"];
20908
20959
  if (!numberingXml) return {};
20909
20960
  if (numId == null) return void 0;
20910
- const cache = ensureNumberingCache(docx);
20961
+ const cache = ensureNumberingCache(docx, converter);
20911
20962
  const numKey = String(numId);
20912
20963
  let listDefinitionForThisNumId = cache.numToDefinition.get(numKey);
20913
20964
  if (!listDefinitionForThisNumId) {
@@ -22836,7 +22887,7 @@ function posToDOMRect(view, from, to) {
22836
22887
  const right = Math.max(start.right, end.right);
22837
22888
  const width = right - left;
22838
22889
  const height = bottom - top;
22839
- const x2 = left;
22890
+ const x = left;
22840
22891
  const y2 = top;
22841
22892
  const data = {
22842
22893
  top,
@@ -22845,7 +22896,7 @@ function posToDOMRect(view, from, to) {
22845
22896
  right,
22846
22897
  width,
22847
22898
  height,
22848
- x: x2,
22899
+ x,
22849
22900
  y: y2
22850
22901
  };
22851
22902
  return {
@@ -22855,8 +22906,8 @@ function posToDOMRect(view, from, to) {
22855
22906
  }
22856
22907
  const isInTable = (state2) => {
22857
22908
  const { $head } = state2.selection;
22858
- for (let d = $head.depth; d > 0; d -= 1) {
22859
- if ($head.node(d).type?.spec?.tableRole === "row") {
22909
+ for (let d2 = $head.depth; d2 > 0; d2 -= 1) {
22910
+ if ($head.node(d2).type?.spec?.tableRole === "row") {
22860
22911
  return true;
22861
22912
  }
22862
22913
  }
@@ -22909,7 +22960,7 @@ function stripHtmlStyles(html) {
22909
22960
  function cleanStyle(style) {
22910
22961
  if (!style) return "";
22911
22962
  const declarations = style.split(";").map((s) => s.trim()).filter(Boolean);
22912
- const textAlign = declarations.find((d) => d.startsWith("text-align"));
22963
+ const textAlign = declarations.find((d2) => d2.startsWith("text-align"));
22913
22964
  return textAlign ? `${textAlign};` : "";
22914
22965
  }
22915
22966
  function preserveSpaces(innerHtml) {
@@ -22934,39 +22985,39 @@ function createDocFromHTML(content, schema, options = {}) {
22934
22985
  function L() {
22935
22986
  return { async: false, breaks: false, extensions: null, gfm: true, hooks: null, pedantic: false, renderer: null, silent: false, tokenizer: null, walkTokens: null };
22936
22987
  }
22937
- var T = L();
22938
- function G(u3) {
22939
- T = u3;
22988
+ var O = L();
22989
+ function G(l3) {
22990
+ O = l3;
22940
22991
  }
22941
- var I = { exec: () => null };
22942
- function h(u3, e = "") {
22943
- let t = typeof u3 == "string" ? u3 : u3.source, n = { replace: (r, i) => {
22992
+ var E = { exec: () => null };
22993
+ function h(l3, e = "") {
22994
+ let t = typeof l3 == "string" ? l3 : l3.source, n = { replace: (r, i) => {
22944
22995
  let s = typeof i == "string" ? i : i.source;
22945
22996
  return s = s.replace(m.caret, "$1"), t = t.replace(r, s), n;
22946
22997
  }, getRegex: () => new RegExp(t, e) };
22947
22998
  return n;
22948
22999
  }
22949
- var m = { codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm, outputLinkReplace: /\\([\[\]])/g, indentCodeCompensation: /^(\s+)(?:```)/, beginningSpace: /^\s+/, endingHash: /#$/, startingSpaceChar: /^ /, endingSpaceChar: / $/, nonSpaceChar: /[^ ]/, newLineCharGlobal: /\n/g, tabCharGlobal: /\t/g, multipleSpaceGlobal: /\s+/g, blankLine: /^[ \t]*$/, doubleBlankLine: /\n[ \t]*\n[ \t]*$/, blockquoteStart: /^ {0,3}>/, blockquoteSetextReplace: /\n {0,3}((?:=+|-+) *)(?=\n|$)/g, blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm, listReplaceTabs: /^\t+/, listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g, listIsTask: /^\[[ xX]\] /, listReplaceTask: /^\[[ xX]\] +/, anyLine: /\n.*\n/, hrefBrackets: /^<(.*)>$/, tableDelimiter: /[:|]/, tableAlignChars: /^\||\| *$/g, tableRowBlankLine: /\n[ \t]*$/, tableAlignRight: /^ *-+: *$/, tableAlignCenter: /^ *:-+: *$/, tableAlignLeft: /^ *:-+ *$/, startATag: /^<a /i, endATag: /^<\/a>/i, startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i, endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i, startAngleBracket: /^</, endAngleBracket: />$/, pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/, unicodeAlphaNumeric: /[\p{L}\p{N}]/u, escapeTest: /[&<>"']/, escapeReplace: /[&<>"']/g, escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/, escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g, unescapeTest: /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig, caret: /(^|[^\[])\^/g, percentDecode: /%25/g, findPipe: /\|/g, splitPipe: / \|/, slashPipe: /\\\|/g, carriageReturn: /\r\n|\r/g, spaceLine: /^ +$/gm, notSpaceStart: /^\S*/, endingNewline: /\n$/, listItemRegex: (u3) => new RegExp(`^( {0,3}${u3})((?:[ ][^\\n]*)?(?:\\n|$))`), nextBulletRegex: (u3) => new RegExp(`^ {0,${Math.min(3, u3 - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`), hrRegex: (u3) => new RegExp(`^ {0,${Math.min(3, u3 - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`), fencesBeginRegex: (u3) => new RegExp(`^ {0,${Math.min(3, u3 - 1)}}(?:\`\`\`|~~~)`), headingBeginRegex: (u3) => new RegExp(`^ {0,${Math.min(3, u3 - 1)}}#`), htmlBeginRegex: (u3) => new RegExp(`^ {0,${Math.min(3, u3 - 1)}}<(?:[a-z].*>|!--)`, "i") }, be = /^(?:[ \t]*(?:\n|$))+/, Re = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, Te = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, E = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, Oe = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, F = /(?:[*+-]|\d{1,9}[.)])/, ie = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, oe = h(ie).replace(/bull/g, F).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex(), we = h(ie).replace(/bull/g, F).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(), j = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, ye = /^[^\n]+/, Q = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/, Pe = h(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", Q).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), Se = h(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, F).getRegex(), v = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul", U = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, $e = h("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))", "i").replace("comment", U).replace("tag", v).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), ae = h(j).replace("hr", E).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", v).getRegex(), _e = h(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", ae).getRegex(), K = { blockquote: _e, code: Re, def: Pe, fences: Te, heading: Oe, hr: E, html: $e, lheading: oe, list: Se, newline: be, paragraph: ae, table: I, text: ye }, re = h("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", E).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", v).getRegex(), Le = { ...K, lheading: we, table: re, paragraph: h(j).replace("hr", E).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", re).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", v).getRegex() }, Me = { ...K, html: h(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", U).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(), def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/, heading: /^(#{1,6})(.*)(?:\n+|$)/, fences: I, lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/, paragraph: h(j).replace("hr", E).replace("heading", ` *#{1,6} *[^
22950
- ]`).replace("lheading", oe).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() }, ze = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, Ae = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, le = /^( {2,}|\\)\n(?!\s*$)/, Ie = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, D = /[\p{P}\p{S}]/u, W = /[\s\p{P}\p{S}]/u, ue = /[^\s\p{P}\p{S}]/u, Ee = h(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, W).getRegex(), pe = /(?!~)[\p{P}\p{S}]/u, Ce = /(?!~)[\s\p{P}\p{S}]/u, Be = /(?:[^\s\p{P}\p{S}]|~)/u, qe = h(/link|code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<!`)(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("code", /(?<!`)(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex(), ce = /^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/, ve = h(ce, "u").replace(/punct/g, D).getRegex(), De = h(ce, "u").replace(/punct/g, pe).getRegex(), he$3 = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", He = h(he$3, "gu").replace(/notPunctSpace/g, ue).replace(/punctSpace/g, W).replace(/punct/g, D).getRegex(), Ze = h(he$3, "gu").replace(/notPunctSpace/g, Be).replace(/punctSpace/g, Ce).replace(/punct/g, pe).getRegex(), Ge = h("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, ue).replace(/punctSpace/g, W).replace(/punct/g, D).getRegex(), Ne = h(/\\(punct)/, "gu").replace(/punct/g, D).getRegex(), Fe = h(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email", /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(), je = h(U).replace("(?:-->|$)", "-->").getRegex(), Qe = h("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", je).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), q = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/, Ue = h(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label", q).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), de = h(/^!?\[(label)\]\[(ref)\]/).replace("label", q).replace("ref", Q).getRegex(), ke = h(/^!?\[(ref)\](?:\[\])?/).replace("ref", Q).getRegex(), Ke = h("reflink|nolink(?!\\()", "g").replace("reflink", de).replace("nolink", ke).getRegex(), se = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/, X = { _backpedal: I, anyPunctuation: Ne, autolink: Fe, blockSkip: qe, br: le, code: Ae, del: I, emStrongLDelim: ve, emStrongRDelimAst: He, emStrongRDelimUnd: Ge, escape: ze, link: Ue, nolink: ke, punctuation: Ee, reflink: de, reflinkSearch: Ke, tag: Qe, text: Ie, url: I }, We = { ...X, link: h(/^!?\[(label)\]\((.*?)\)/).replace("label", q).getRegex(), reflink: h(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", q).getRegex() }, N = { ...X, emStrongRDelimAst: Ze, emStrongLDelim: De, url: h(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol", se).replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(), _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/, del: /^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/, text: h(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol", se).getRegex() }, Xe = { ...N, br: h(le).replace("{2,}", "*").getRegex(), text: h(N.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex() }, C = { normal: K, gfm: Le, pedantic: Me }, M = { normal: X, gfm: N, breaks: Xe, pedantic: We };
22951
- var Je = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" }, ge = (u3) => Je[u3];
22952
- function w(u3, e) {
23000
+ var m = { codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm, outputLinkReplace: /\\([\[\]])/g, indentCodeCompensation: /^(\s+)(?:```)/, beginningSpace: /^\s+/, endingHash: /#$/, startingSpaceChar: /^ /, endingSpaceChar: / $/, nonSpaceChar: /[^ ]/, newLineCharGlobal: /\n/g, tabCharGlobal: /\t/g, multipleSpaceGlobal: /\s+/g, blankLine: /^[ \t]*$/, doubleBlankLine: /\n[ \t]*\n[ \t]*$/, blockquoteStart: /^ {0,3}>/, blockquoteSetextReplace: /\n {0,3}((?:=+|-+) *)(?=\n|$)/g, blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm, listReplaceTabs: /^\t+/, listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g, listIsTask: /^\[[ xX]\] /, listReplaceTask: /^\[[ xX]\] +/, anyLine: /\n.*\n/, hrefBrackets: /^<(.*)>$/, tableDelimiter: /[:|]/, tableAlignChars: /^\||\| *$/g, tableRowBlankLine: /\n[ \t]*$/, tableAlignRight: /^ *-+: *$/, tableAlignCenter: /^ *:-+: *$/, tableAlignLeft: /^ *:-+ *$/, startATag: /^<a /i, endATag: /^<\/a>/i, startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i, endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i, startAngleBracket: /^</, endAngleBracket: />$/, pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/, unicodeAlphaNumeric: /[\p{L}\p{N}]/u, escapeTest: /[&<>"']/, escapeReplace: /[&<>"']/g, escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/, escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g, unescapeTest: /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig, caret: /(^|[^\[])\^/g, percentDecode: /%25/g, findPipe: /\|/g, splitPipe: / \|/, slashPipe: /\\\|/g, carriageReturn: /\r\n|\r/g, spaceLine: /^ +$/gm, notSpaceStart: /^\S*/, endingNewline: /\n$/, listItemRegex: (l3) => new RegExp(`^( {0,3}${l3})((?:[ ][^\\n]*)?(?:\\n|$))`), nextBulletRegex: (l3) => new RegExp(`^ {0,${Math.min(3, l3 - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`), hrRegex: (l3) => new RegExp(`^ {0,${Math.min(3, l3 - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`), fencesBeginRegex: (l3) => new RegExp(`^ {0,${Math.min(3, l3 - 1)}}(?:\`\`\`|~~~)`), headingBeginRegex: (l3) => new RegExp(`^ {0,${Math.min(3, l3 - 1)}}#`), htmlBeginRegex: (l3) => new RegExp(`^ {0,${Math.min(3, l3 - 1)}}<(?:[a-z].*>|!--)`, "i") }, xe = /^(?:[ \t]*(?:\n|$))+/, be = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, Re = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, C = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, Oe = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, j = /(?:[*+-]|\d{1,9}[.)])/, se = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, ie = h(se).replace(/bull/g, j).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex(), Te = h(se).replace(/bull/g, j).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(), F = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, we = /^[^\n]+/, Q = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/, ye = h(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", Q).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), Pe = h(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, j).getRegex(), v = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul", U = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, Se = h("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))", "i").replace("comment", U).replace("tag", v).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), oe = h(F).replace("hr", C).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", v).getRegex(), $e = h(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", oe).getRegex(), K = { blockquote: $e, code: be, def: ye, fences: Re, heading: Oe, hr: C, html: Se, lheading: ie, list: Pe, newline: xe, paragraph: oe, table: E, text: we }, re = h("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", C).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", v).getRegex(), _e = { ...K, lheading: Te, table: re, paragraph: h(F).replace("hr", C).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", re).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", v).getRegex() }, Le = { ...K, html: h(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", U).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(), def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/, heading: /^(#{1,6})(.*)(?:\n+|$)/, fences: E, lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/, paragraph: h(F).replace("hr", C).replace("heading", ` *#{1,6} *[^
23001
+ ]`).replace("lheading", ie).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() }, Me = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, ze = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, ae = /^( {2,}|\\)\n(?!\s*$)/, Ae = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, D = /[\p{P}\p{S}]/u, W = /[\s\p{P}\p{S}]/u, le = /[^\s\p{P}\p{S}]/u, Ee = h(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, W).getRegex(), ue = /(?!~)[\p{P}\p{S}]/u, Ce = /(?!~)[\s\p{P}\p{S}]/u, Ie = /(?:[^\s\p{P}\p{S}]|~)/u, Be = /\[[^\[\]]*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)|`[^`]*?`|<(?! )[^<>]*?>/g, pe = /^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/, qe = h(pe, "u").replace(/punct/g, D).getRegex(), ve = h(pe, "u").replace(/punct/g, ue).getRegex(), ce = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", De = h(ce, "gu").replace(/notPunctSpace/g, le).replace(/punctSpace/g, W).replace(/punct/g, D).getRegex(), He = h(ce, "gu").replace(/notPunctSpace/g, Ie).replace(/punctSpace/g, Ce).replace(/punct/g, ue).getRegex(), Ze = h("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, le).replace(/punctSpace/g, W).replace(/punct/g, D).getRegex(), Ge = h(/\\(punct)/, "gu").replace(/punct/g, D).getRegex(), Ne = h(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email", /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(), je = h(U).replace("(?:-->|$)", "-->").getRegex(), Fe = h("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", je).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), q = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`[^`]*`|[^\[\]\\`])*?/, Qe = h(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label", q).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), he$3 = h(/^!?\[(label)\]\[(ref)\]/).replace("label", q).replace("ref", Q).getRegex(), de = h(/^!?\[(ref)\](?:\[\])?/).replace("ref", Q).getRegex(), Ue = h("reflink|nolink(?!\\()", "g").replace("reflink", he$3).replace("nolink", de).getRegex(), X = { _backpedal: E, anyPunctuation: Ge, autolink: Ne, blockSkip: Be, br: ae, code: ze, del: E, emStrongLDelim: qe, emStrongRDelimAst: De, emStrongRDelimUnd: Ze, escape: Me, link: Qe, nolink: de, punctuation: Ee, reflink: he$3, reflinkSearch: Ue, tag: Fe, text: Ae, url: E }, Ke = { ...X, link: h(/^!?\[(label)\]\((.*?)\)/).replace("label", q).getRegex(), reflink: h(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", q).getRegex() }, N = { ...X, emStrongRDelimAst: He, emStrongLDelim: ve, url: h(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/, "i").replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(), _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/, del: /^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/, text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/ }, We = { ...N, br: h(ae).replace("{2,}", "*").getRegex(), text: h(N.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex() }, I = { normal: K, gfm: _e, pedantic: Le }, M = { normal: X, gfm: N, breaks: We, pedantic: Ke };
23002
+ var Xe = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" }, ke = (l3) => Xe[l3];
23003
+ function w(l3, e) {
22953
23004
  if (e) {
22954
- if (m.escapeTest.test(u3)) return u3.replace(m.escapeReplace, ge);
22955
- } else if (m.escapeTestNoEncode.test(u3)) return u3.replace(m.escapeReplaceNoEncode, ge);
22956
- return u3;
23005
+ if (m.escapeTest.test(l3)) return l3.replace(m.escapeReplace, ke);
23006
+ } else if (m.escapeTestNoEncode.test(l3)) return l3.replace(m.escapeReplaceNoEncode, ke);
23007
+ return l3;
22957
23008
  }
22958
- function J(u3) {
23009
+ function J(l3) {
22959
23010
  try {
22960
- u3 = encodeURI(u3).replace(m.percentDecode, "%");
23011
+ l3 = encodeURI(l3).replace(m.percentDecode, "%");
22961
23012
  } catch {
22962
23013
  return null;
22963
23014
  }
22964
- return u3;
23015
+ return l3;
22965
23016
  }
22966
- function V(u3, e) {
22967
- let t = u3.replace(m.findPipe, (i, s, o) => {
22968
- let a = false, l = s;
22969
- for (; --l >= 0 && o[l] === "\\"; ) a = !a;
23017
+ function V(l3, e) {
23018
+ let t = l3.replace(m.findPipe, (i, s, o) => {
23019
+ let a = false, u = s;
23020
+ for (; --u >= 0 && o[u] === "\\"; ) a = !a;
22970
23021
  return a ? "|" : " |";
22971
23022
  }), n = t.split(m.splitPipe), r = 0;
22972
23023
  if (n[0].trim() || n.shift(), n.length > 0 && !n.at(-1)?.trim() && n.pop(), e) if (n.length > e) n.splice(e);
@@ -22974,33 +23025,33 @@ function V(u3, e) {
22974
23025
  for (; r < n.length; r++) n[r] = n[r].trim().replace(m.slashPipe, "|");
22975
23026
  return n;
22976
23027
  }
22977
- function z(u3, e, t) {
22978
- let n = u3.length;
23028
+ function z(l3, e, t) {
23029
+ let n = l3.length;
22979
23030
  if (n === 0) return "";
22980
23031
  let r = 0;
22981
23032
  for (; r < n; ) {
22982
- let i = u3.charAt(n - r - 1);
23033
+ let i = l3.charAt(n - r - 1);
22983
23034
  if (i === e && true) r++;
22984
23035
  else break;
22985
23036
  }
22986
- return u3.slice(0, n - r);
23037
+ return l3.slice(0, n - r);
22987
23038
  }
22988
- function fe(u3, e) {
22989
- if (u3.indexOf(e[1]) === -1) return -1;
23039
+ function ge(l3, e) {
23040
+ if (l3.indexOf(e[1]) === -1) return -1;
22990
23041
  let t = 0;
22991
- for (let n = 0; n < u3.length; n++) if (u3[n] === "\\") n++;
22992
- else if (u3[n] === e[0]) t++;
22993
- else if (u3[n] === e[1] && (t--, t < 0)) return n;
23042
+ for (let n = 0; n < l3.length; n++) if (l3[n] === "\\") n++;
23043
+ else if (l3[n] === e[0]) t++;
23044
+ else if (l3[n] === e[1] && (t--, t < 0)) return n;
22994
23045
  return t > 0 ? -2 : -1;
22995
23046
  }
22996
- function me(u3, e, t, n, r) {
22997
- let i = e.href, s = e.title || null, o = u3[1].replace(r.other.outputLinkReplace, "$1");
23047
+ function fe(l3, e, t, n, r) {
23048
+ let i = e.href, s = e.title || null, o = l3[1].replace(r.other.outputLinkReplace, "$1");
22998
23049
  n.state.inLink = true;
22999
- let a = { type: u3[0].charAt(0) === "!" ? "image" : "link", raw: t, href: i, title: s, text: o, tokens: n.inlineTokens(o) };
23050
+ let a = { type: l3[0].charAt(0) === "!" ? "image" : "link", raw: t, href: i, title: s, text: o, tokens: n.inlineTokens(o) };
23000
23051
  return n.state.inLink = false, a;
23001
23052
  }
23002
- function Ve(u3, e, t) {
23003
- let n = u3.match(t.other.indentCodeCompensation);
23053
+ function Je(l3, e, t) {
23054
+ let n = l3.match(t.other.indentCodeCompensation);
23004
23055
  if (n === null) return e;
23005
23056
  let r = n[1];
23006
23057
  return e.split(`
@@ -23017,7 +23068,7 @@ var y = class {
23017
23068
  __publicField(this, "options");
23018
23069
  __publicField(this, "rules");
23019
23070
  __publicField(this, "lexer");
23020
- this.options = e || T;
23071
+ this.options = e || O;
23021
23072
  }
23022
23073
  space(e) {
23023
23074
  let t = this.rules.block.newline.exec(e);
@@ -23034,7 +23085,7 @@ var y = class {
23034
23085
  fences(e) {
23035
23086
  let t = this.rules.block.fences.exec(e);
23036
23087
  if (t) {
23037
- let n = t[0], r = Ve(n, t[3] || "", this.rules);
23088
+ let n = t[0], r = Je(n, t[3] || "", this.rules);
23038
23089
  return { type: "code", raw: n, lang: t[2] ? t[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : t[2], text: r };
23039
23090
  }
23040
23091
  }
@@ -23061,32 +23112,32 @@ var y = class {
23061
23112
  `).split(`
23062
23113
  `), r = "", i = "", s = [];
23063
23114
  for (; n.length > 0; ) {
23064
- let o = false, a = [], l;
23065
- for (l = 0; l < n.length; l++) if (this.rules.other.blockquoteStart.test(n[l])) a.push(n[l]), o = true;
23066
- else if (!o) a.push(n[l]);
23115
+ let o = false, a = [], u;
23116
+ for (u = 0; u < n.length; u++) if (this.rules.other.blockquoteStart.test(n[u])) a.push(n[u]), o = true;
23117
+ else if (!o) a.push(n[u]);
23067
23118
  else break;
23068
- n = n.slice(l);
23069
- let c = a.join(`
23070
- `), p = c.replace(this.rules.other.blockquoteSetextReplace, `
23119
+ n = n.slice(u);
23120
+ let p = a.join(`
23121
+ `), c = p.replace(this.rules.other.blockquoteSetextReplace, `
23071
23122
  $1`).replace(this.rules.other.blockquoteSetextReplace2, "");
23072
23123
  r = r ? `${r}
23073
- ${c}` : c, i = i ? `${i}
23074
- ${p}` : p;
23075
- let g = this.lexer.state.top;
23076
- if (this.lexer.state.top = true, this.lexer.blockTokens(p, s, true), this.lexer.state.top = g, n.length === 0) break;
23077
- let d = s.at(-1);
23078
- if (d?.type === "code") break;
23079
- if (d?.type === "blockquote") {
23080
- let R = d, f = R.raw + `
23124
+ ${p}` : p, i = i ? `${i}
23125
+ ${c}` : c;
23126
+ let f = this.lexer.state.top;
23127
+ if (this.lexer.state.top = true, this.lexer.blockTokens(c, s, true), this.lexer.state.top = f, n.length === 0) break;
23128
+ let k = s.at(-1);
23129
+ if (k?.type === "code") break;
23130
+ if (k?.type === "blockquote") {
23131
+ let x = k, g = x.raw + `
23081
23132
  ` + n.join(`
23082
- `), O = this.blockquote(f);
23083
- s[s.length - 1] = O, r = r.substring(0, r.length - R.raw.length) + O.raw, i = i.substring(0, i.length - R.text.length) + O.text;
23133
+ `), T = this.blockquote(g);
23134
+ s[s.length - 1] = T, r = r.substring(0, r.length - x.raw.length) + T.raw, i = i.substring(0, i.length - x.text.length) + T.text;
23084
23135
  break;
23085
- } else if (d?.type === "list") {
23086
- let R = d, f = R.raw + `
23136
+ } else if (k?.type === "list") {
23137
+ let x = k, g = x.raw + `
23087
23138
  ` + n.join(`
23088
- `), O = this.list(f);
23089
- s[s.length - 1] = O, r = r.substring(0, r.length - d.raw.length) + O.raw, i = i.substring(0, i.length - R.raw.length) + O.raw, n = f.substring(s.at(-1).raw.length).split(`
23139
+ `), T = this.list(g);
23140
+ s[s.length - 1] = T, r = r.substring(0, r.length - k.raw.length) + T.raw, i = i.substring(0, i.length - x.raw.length) + T.raw, n = g.substring(s.at(-1).raw.length).split(`
23090
23141
  `);
23091
23142
  continue;
23092
23143
  }
@@ -23101,43 +23152,43 @@ ${p}` : p;
23101
23152
  n = r ? `\\d{1,9}\\${n.slice(-1)}` : `\\${n}`, this.options.pedantic && (n = r ? n : "[*+-]");
23102
23153
  let s = this.rules.other.listItemRegex(n), o = false;
23103
23154
  for (; e; ) {
23104
- let l = false, c = "", p = "";
23155
+ let u = false, p = "", c = "";
23105
23156
  if (!(t = s.exec(e)) || this.rules.block.hr.test(e)) break;
23106
- c = t[0], e = e.substring(c.length);
23107
- let g = t[2].split(`
23108
- `, 1)[0].replace(this.rules.other.listReplaceTabs, (H) => " ".repeat(3 * H.length)), d = e.split(`
23109
- `, 1)[0], R = !g.trim(), f = 0;
23110
- if (this.options.pedantic ? (f = 2, p = g.trimStart()) : R ? f = t[1].length + 1 : (f = t[2].search(this.rules.other.nonSpaceChar), f = f > 4 ? 1 : f, p = g.slice(f), f += t[1].length), R && this.rules.other.blankLine.test(d) && (c += d + `
23111
- `, e = e.substring(d.length + 1), l = true), !l) {
23112
- let H = this.rules.other.nextBulletRegex(f), ee = this.rules.other.hrRegex(f), te = this.rules.other.fencesBeginRegex(f), ne = this.rules.other.headingBeginRegex(f), xe = this.rules.other.htmlBeginRegex(f);
23157
+ p = t[0], e = e.substring(p.length);
23158
+ let f = t[2].split(`
23159
+ `, 1)[0].replace(this.rules.other.listReplaceTabs, (H) => " ".repeat(3 * H.length)), k = e.split(`
23160
+ `, 1)[0], x = !f.trim(), g = 0;
23161
+ if (this.options.pedantic ? (g = 2, c = f.trimStart()) : x ? g = t[1].length + 1 : (g = t[2].search(this.rules.other.nonSpaceChar), g = g > 4 ? 1 : g, c = f.slice(g), g += t[1].length), x && this.rules.other.blankLine.test(k) && (p += k + `
23162
+ `, e = e.substring(k.length + 1), u = true), !u) {
23163
+ let H = this.rules.other.nextBulletRegex(g), ee = this.rules.other.hrRegex(g), te = this.rules.other.fencesBeginRegex(g), ne = this.rules.other.headingBeginRegex(g), me = this.rules.other.htmlBeginRegex(g);
23113
23164
  for (; e; ) {
23114
23165
  let Z = e.split(`
23115
23166
  `, 1)[0], A;
23116
- if (d = Z, this.options.pedantic ? (d = d.replace(this.rules.other.listReplaceNesting, " "), A = d) : A = d.replace(this.rules.other.tabCharGlobal, " "), te.test(d) || ne.test(d) || xe.test(d) || H.test(d) || ee.test(d)) break;
23117
- if (A.search(this.rules.other.nonSpaceChar) >= f || !d.trim()) p += `
23118
- ` + A.slice(f);
23167
+ if (k = Z, this.options.pedantic ? (k = k.replace(this.rules.other.listReplaceNesting, " "), A = k) : A = k.replace(this.rules.other.tabCharGlobal, " "), te.test(k) || ne.test(k) || me.test(k) || H.test(k) || ee.test(k)) break;
23168
+ if (A.search(this.rules.other.nonSpaceChar) >= g || !k.trim()) c += `
23169
+ ` + A.slice(g);
23119
23170
  else {
23120
- if (R || g.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || te.test(g) || ne.test(g) || ee.test(g)) break;
23121
- p += `
23122
- ` + d;
23171
+ if (x || f.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || te.test(f) || ne.test(f) || ee.test(f)) break;
23172
+ c += `
23173
+ ` + k;
23123
23174
  }
23124
- !R && !d.trim() && (R = true), c += Z + `
23125
- `, e = e.substring(Z.length + 1), g = A.slice(f);
23175
+ !x && !k.trim() && (x = true), p += Z + `
23176
+ `, e = e.substring(Z.length + 1), f = A.slice(g);
23126
23177
  }
23127
23178
  }
23128
- i.loose || (o ? i.loose = true : this.rules.other.doubleBlankLine.test(c) && (o = true));
23129
- let O = null, Y;
23130
- this.options.gfm && (O = this.rules.other.listIsTask.exec(p), O && (Y = O[0] !== "[ ] ", p = p.replace(this.rules.other.listReplaceTask, ""))), i.items.push({ type: "list_item", raw: c, task: !!O, checked: Y, loose: false, text: p, tokens: [] }), i.raw += c;
23179
+ i.loose || (o ? i.loose = true : this.rules.other.doubleBlankLine.test(p) && (o = true));
23180
+ let T = null, Y;
23181
+ this.options.gfm && (T = this.rules.other.listIsTask.exec(c), T && (Y = T[0] !== "[ ] ", c = c.replace(this.rules.other.listReplaceTask, ""))), i.items.push({ type: "list_item", raw: p, task: !!T, checked: Y, loose: false, text: c, tokens: [] }), i.raw += p;
23131
23182
  }
23132
23183
  let a = i.items.at(-1);
23133
23184
  if (a) a.raw = a.raw.trimEnd(), a.text = a.text.trimEnd();
23134
23185
  else return;
23135
23186
  i.raw = i.raw.trimEnd();
23136
- for (let l = 0; l < i.items.length; l++) if (this.lexer.state.top = false, i.items[l].tokens = this.lexer.blockTokens(i.items[l].text, []), !i.loose) {
23137
- let c = i.items[l].tokens.filter((g) => g.type === "space"), p = c.length > 0 && c.some((g) => this.rules.other.anyLine.test(g.raw));
23138
- i.loose = p;
23187
+ for (let u = 0; u < i.items.length; u++) if (this.lexer.state.top = false, i.items[u].tokens = this.lexer.blockTokens(i.items[u].text, []), !i.loose) {
23188
+ let p = i.items[u].tokens.filter((f) => f.type === "space"), c = p.length > 0 && p.some((f) => this.rules.other.anyLine.test(f.raw));
23189
+ i.loose = c;
23139
23190
  }
23140
- if (i.loose) for (let l = 0; l < i.items.length; l++) i.items[l].loose = true;
23191
+ if (i.loose) for (let u = 0; u < i.items.length; u++) i.items[u].loose = true;
23141
23192
  return i;
23142
23193
  }
23143
23194
  }
@@ -23160,7 +23211,7 @@ ${p}` : p;
23160
23211
  if (n.length === r.length) {
23161
23212
  for (let o of r) this.rules.other.tableAlignRight.test(o) ? s.align.push("right") : this.rules.other.tableAlignCenter.test(o) ? s.align.push("center") : this.rules.other.tableAlignLeft.test(o) ? s.align.push("left") : s.align.push(null);
23162
23213
  for (let o = 0; o < n.length; o++) s.header.push({ text: n[o], tokens: this.lexer.inline(n[o]), header: true, align: s.align[o] });
23163
- for (let o of i) s.rows.push(V(o, s.header.length).map((a, l) => ({ text: a, tokens: this.lexer.inline(a), header: false, align: s.align[l] })));
23214
+ for (let o of i) s.rows.push(V(o, s.header.length).map((a, u) => ({ text: a, tokens: this.lexer.inline(a), header: false, align: s.align[u] })));
23164
23215
  return s;
23165
23216
  }
23166
23217
  }
@@ -23197,7 +23248,7 @@ ${p}` : p;
23197
23248
  let s = z(n.slice(0, -1), "\\");
23198
23249
  if ((n.length - s.length) % 2 === 0) return;
23199
23250
  } else {
23200
- let s = fe(t[2], "()");
23251
+ let s = ge(t[2], "()");
23201
23252
  if (s === -2) return;
23202
23253
  if (s > -1) {
23203
23254
  let a = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length + s;
@@ -23209,7 +23260,7 @@ ${p}` : p;
23209
23260
  let s = this.rules.other.pedanticHrefTitle.exec(r);
23210
23261
  s && (r = s[1], i = s[3]);
23211
23262
  } else i = t[3] ? t[3].slice(1, -1) : "";
23212
- return r = r.trim(), this.rules.other.startAngleBracket.test(r) && (this.options.pedantic && !this.rules.other.endAngleBracket.test(n) ? r = r.slice(1) : r = r.slice(1, -1)), me(t, { href: r && r.replace(this.rules.inline.anyPunctuation, "$1"), title: i && i.replace(this.rules.inline.anyPunctuation, "$1") }, t[0], this.lexer, this.rules);
23263
+ return r = r.trim(), this.rules.other.startAngleBracket.test(r) && (this.options.pedantic && !this.rules.other.endAngleBracket.test(n) ? r = r.slice(1) : r = r.slice(1, -1)), fe(t, { href: r && r.replace(this.rules.inline.anyPunctuation, "$1"), title: i && i.replace(this.rules.inline.anyPunctuation, "$1") }, t[0], this.lexer, this.rules);
23213
23264
  }
23214
23265
  }
23215
23266
  reflink(e, t) {
@@ -23220,32 +23271,32 @@ ${p}` : p;
23220
23271
  let s = n[0].charAt(0);
23221
23272
  return { type: "text", raw: s, text: s };
23222
23273
  }
23223
- return me(n, i, n[0], this.lexer, this.rules);
23274
+ return fe(n, i, n[0], this.lexer, this.rules);
23224
23275
  }
23225
23276
  }
23226
23277
  emStrong(e, t, n = "") {
23227
23278
  let r = this.rules.inline.emStrongLDelim.exec(e);
23228
23279
  if (!r || r[3] && n.match(this.rules.other.unicodeAlphaNumeric)) return;
23229
23280
  if (!(r[1] || r[2] || "") || !n || this.rules.inline.punctuation.exec(n)) {
23230
- let s = [...r[0]].length - 1, o, a, l = s, c = 0, p = r[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
23231
- for (p.lastIndex = 0, t = t.slice(-1 * e.length + s); (r = p.exec(t)) != null; ) {
23281
+ let s = [...r[0]].length - 1, o, a, u = s, p = 0, c = r[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
23282
+ for (c.lastIndex = 0, t = t.slice(-1 * e.length + s); (r = c.exec(t)) != null; ) {
23232
23283
  if (o = r[1] || r[2] || r[3] || r[4] || r[5] || r[6], !o) continue;
23233
23284
  if (a = [...o].length, r[3] || r[4]) {
23234
- l += a;
23285
+ u += a;
23235
23286
  continue;
23236
23287
  } else if ((r[5] || r[6]) && s % 3 && !((s + a) % 3)) {
23237
- c += a;
23288
+ p += a;
23238
23289
  continue;
23239
23290
  }
23240
- if (l -= a, l > 0) continue;
23241
- a = Math.min(a, a + l + c);
23242
- let g = [...r[0]][0].length, d = e.slice(0, s + r.index + g + a);
23291
+ if (u -= a, u > 0) continue;
23292
+ a = Math.min(a, a + u + p);
23293
+ let f = [...r[0]][0].length, k = e.slice(0, s + r.index + f + a);
23243
23294
  if (Math.min(s, a) % 2) {
23244
- let f = d.slice(1, -1);
23245
- return { type: "em", raw: d, text: f, tokens: this.lexer.inlineTokens(f) };
23295
+ let g = k.slice(1, -1);
23296
+ return { type: "em", raw: k, text: g, tokens: this.lexer.inlineTokens(g) };
23246
23297
  }
23247
- let R = d.slice(2, -2);
23248
- return { type: "strong", raw: d, text: R, tokens: this.lexer.inlineTokens(R) };
23298
+ let x = k.slice(2, -2);
23299
+ return { type: "strong", raw: k, text: x, tokens: this.lexer.inlineTokens(x) };
23249
23300
  }
23250
23301
  }
23251
23302
  }
@@ -23294,25 +23345,25 @@ ${p}` : p;
23294
23345
  }
23295
23346
  }
23296
23347
  };
23297
- var x = class u {
23348
+ var b = class l {
23298
23349
  constructor(e) {
23299
23350
  __publicField(this, "tokens");
23300
23351
  __publicField(this, "options");
23301
23352
  __publicField(this, "state");
23302
23353
  __publicField(this, "tokenizer");
23303
23354
  __publicField(this, "inlineQueue");
23304
- this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = e || T, this.options.tokenizer = this.options.tokenizer || new y(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = { inLink: false, inRawBlock: false, top: true };
23305
- let t = { other: m, block: C.normal, inline: M.normal };
23306
- this.options.pedantic ? (t.block = C.pedantic, t.inline = M.pedantic) : this.options.gfm && (t.block = C.gfm, this.options.breaks ? t.inline = M.breaks : t.inline = M.gfm), this.tokenizer.rules = t;
23355
+ this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = e || O, this.options.tokenizer = this.options.tokenizer || new y(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = { inLink: false, inRawBlock: false, top: true };
23356
+ let t = { other: m, block: I.normal, inline: M.normal };
23357
+ this.options.pedantic ? (t.block = I.pedantic, t.inline = M.pedantic) : this.options.gfm && (t.block = I.gfm, this.options.breaks ? t.inline = M.breaks : t.inline = M.gfm), this.tokenizer.rules = t;
23307
23358
  }
23308
23359
  static get rules() {
23309
- return { block: C, inline: M };
23360
+ return { block: I, inline: M };
23310
23361
  }
23311
23362
  static lex(e, t) {
23312
- return new u(t).lex(e);
23363
+ return new l(t).lex(e);
23313
23364
  }
23314
23365
  static lexInline(e, t) {
23315
- return new u(t).inlineTokens(e);
23366
+ return new l(t).inlineTokens(e);
23316
23367
  }
23317
23368
  lex(e) {
23318
23369
  e = e.replace(m.carriageReturn, `
@@ -23387,8 +23438,8 @@ var x = class u {
23387
23438
  let i = e;
23388
23439
  if (this.options.extensions?.startBlock) {
23389
23440
  let s = 1 / 0, o = e.slice(1), a;
23390
- this.options.extensions.startBlock.forEach((l) => {
23391
- a = l.call({ lexer: this }, o), typeof a == "number" && a >= 0 && (s = Math.min(s, a));
23441
+ this.options.extensions.startBlock.forEach((u) => {
23442
+ a = u.call({ lexer: this }, o), typeof a == "number" && a >= 0 && (s = Math.min(s, a));
23392
23443
  }), s < 1 / 0 && s >= 0 && (i = e.substring(0, s + 1));
23393
23444
  }
23394
23445
  if (this.state.top && (r = this.tokenizer.paragraph(i))) {
@@ -23434,7 +23485,7 @@ var x = class u {
23434
23485
  for (; e; ) {
23435
23486
  i || (s = ""), i = false;
23436
23487
  let o;
23437
- if (this.options.extensions?.inline?.some((l) => (o = l.call({ lexer: this }, e, t)) ? (e = e.substring(o.raw.length), t.push(o), true) : false)) continue;
23488
+ if (this.options.extensions?.inline?.some((u) => (o = u.call({ lexer: this }, e, t)) ? (e = e.substring(o.raw.length), t.push(o), true) : false)) continue;
23438
23489
  if (o = this.tokenizer.escape(e)) {
23439
23490
  e = e.substring(o.raw.length), t.push(o);
23440
23491
  continue;
@@ -23449,8 +23500,8 @@ var x = class u {
23449
23500
  }
23450
23501
  if (o = this.tokenizer.reflink(e, this.tokens.links)) {
23451
23502
  e = e.substring(o.raw.length);
23452
- let l = t.at(-1);
23453
- o.type === "text" && l?.type === "text" ? (l.raw += o.raw, l.text += o.text) : t.push(o);
23503
+ let u = t.at(-1);
23504
+ o.type === "text" && u?.type === "text" ? (u.raw += o.raw, u.text += o.text) : t.push(o);
23454
23505
  continue;
23455
23506
  }
23456
23507
  if (o = this.tokenizer.emStrong(e, n, s)) {
@@ -23479,23 +23530,23 @@ var x = class u {
23479
23530
  }
23480
23531
  let a = e;
23481
23532
  if (this.options.extensions?.startInline) {
23482
- let l = 1 / 0, c = e.slice(1), p;
23483
- this.options.extensions.startInline.forEach((g) => {
23484
- p = g.call({ lexer: this }, c), typeof p == "number" && p >= 0 && (l = Math.min(l, p));
23485
- }), l < 1 / 0 && l >= 0 && (a = e.substring(0, l + 1));
23533
+ let u = 1 / 0, p = e.slice(1), c;
23534
+ this.options.extensions.startInline.forEach((f) => {
23535
+ c = f.call({ lexer: this }, p), typeof c == "number" && c >= 0 && (u = Math.min(u, c));
23536
+ }), u < 1 / 0 && u >= 0 && (a = e.substring(0, u + 1));
23486
23537
  }
23487
23538
  if (o = this.tokenizer.inlineText(a)) {
23488
23539
  e = e.substring(o.raw.length), o.raw.slice(-1) !== "_" && (s = o.raw.slice(-1)), i = true;
23489
- let l = t.at(-1);
23490
- l?.type === "text" ? (l.raw += o.raw, l.text += o.text) : t.push(o);
23540
+ let u = t.at(-1);
23541
+ u?.type === "text" ? (u.raw += o.raw, u.text += o.text) : t.push(o);
23491
23542
  continue;
23492
23543
  }
23493
23544
  if (e) {
23494
- let l = "Infinite loop on byte: " + e.charCodeAt(0);
23545
+ let u = "Infinite loop on byte: " + e.charCodeAt(0);
23495
23546
  if (this.options.silent) {
23496
- console.error(l);
23547
+ console.error(u);
23497
23548
  break;
23498
- } else throw new Error(l);
23549
+ } else throw new Error(u);
23499
23550
  }
23500
23551
  }
23501
23552
  return t;
@@ -23505,7 +23556,7 @@ var P = class {
23505
23556
  constructor(e) {
23506
23557
  __publicField(this, "options");
23507
23558
  __publicField(this, "parser");
23508
- this.options = e || T;
23559
+ this.options = e || O;
23509
23560
  }
23510
23561
  space(e) {
23511
23562
  return "";
@@ -23653,18 +23704,18 @@ var $ = class {
23653
23704
  return "";
23654
23705
  }
23655
23706
  };
23656
- var b = class u2 {
23707
+ var R = class l2 {
23657
23708
  constructor(e) {
23658
23709
  __publicField(this, "options");
23659
23710
  __publicField(this, "renderer");
23660
23711
  __publicField(this, "textRenderer");
23661
- this.options = e || T, this.options.renderer = this.options.renderer || new P(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new $();
23712
+ this.options = e || O, this.options.renderer = this.options.renderer || new P(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new $();
23662
23713
  }
23663
23714
  static parse(e, t) {
23664
- return new u2(t).parse(e);
23715
+ return new l2(t).parse(e);
23665
23716
  }
23666
23717
  static parseInline(e, t) {
23667
- return new u2(t).parseInline(e);
23718
+ return new l2(t).parseInline(e);
23668
23719
  }
23669
23720
  parse(e, t = true) {
23670
23721
  let n = "";
@@ -23802,7 +23853,7 @@ var S = (_a = class {
23802
23853
  constructor(e) {
23803
23854
  __publicField(this, "options");
23804
23855
  __publicField(this, "block");
23805
- this.options = e || T;
23856
+ this.options = e || O;
23806
23857
  }
23807
23858
  preprocess(e) {
23808
23859
  return e;
@@ -23817,10 +23868,10 @@ var S = (_a = class {
23817
23868
  return e;
23818
23869
  }
23819
23870
  provideLexer() {
23820
- return this.block ? x.lex : x.lexInline;
23871
+ return this.block ? b.lex : b.lexInline;
23821
23872
  }
23822
23873
  provideParser() {
23823
- return this.block ? b.parse : b.parseInline;
23874
+ return this.block ? R.parse : R.parseInline;
23824
23875
  }
23825
23876
  }, __publicField(_a, "passThroughHooks", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens", "emStrongMask"])), __publicField(_a, "passThroughHooksRespectAsync", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens"])), _a);
23826
23877
  var B = class {
@@ -23829,10 +23880,10 @@ var B = class {
23829
23880
  __publicField(this, "options", this.setOptions);
23830
23881
  __publicField(this, "parse", this.parseMarkdown(true));
23831
23882
  __publicField(this, "parseInline", this.parseMarkdown(false));
23832
- __publicField(this, "Parser", b);
23883
+ __publicField(this, "Parser", R);
23833
23884
  __publicField(this, "Renderer", P);
23834
23885
  __publicField(this, "TextRenderer", $);
23835
- __publicField(this, "Lexer", x);
23886
+ __publicField(this, "Lexer", b);
23836
23887
  __publicField(this, "Tokenizer", y);
23837
23888
  __publicField(this, "Hooks", S);
23838
23889
  this.use(...e);
@@ -23885,10 +23936,10 @@ var B = class {
23885
23936
  for (let s in n.renderer) {
23886
23937
  if (!(s in i)) throw new Error(`renderer '${s}' does not exist`);
23887
23938
  if (["options", "parser"].includes(s)) continue;
23888
- let o = s, a = n.renderer[o], l = i[o];
23889
- i[o] = (...c) => {
23890
- let p = a.apply(i, c);
23891
- return p === false && (p = l.apply(i, c)), p || "";
23939
+ let o = s, a = n.renderer[o], u = i[o];
23940
+ i[o] = (...p) => {
23941
+ let c = a.apply(i, p);
23942
+ return c === false && (c = u.apply(i, p)), c || "";
23892
23943
  };
23893
23944
  }
23894
23945
  r.renderer = i;
@@ -23898,10 +23949,10 @@ var B = class {
23898
23949
  for (let s in n.tokenizer) {
23899
23950
  if (!(s in i)) throw new Error(`tokenizer '${s}' does not exist`);
23900
23951
  if (["options", "rules", "lexer"].includes(s)) continue;
23901
- let o = s, a = n.tokenizer[o], l = i[o];
23902
- i[o] = (...c) => {
23903
- let p = a.apply(i, c);
23904
- return p === false && (p = l.apply(i, c)), p;
23952
+ let o = s, a = n.tokenizer[o], u = i[o];
23953
+ i[o] = (...p) => {
23954
+ let c = a.apply(i, p);
23955
+ return c === false && (c = u.apply(i, p)), c;
23905
23956
  };
23906
23957
  }
23907
23958
  r.tokenizer = i;
@@ -23911,21 +23962,14 @@ var B = class {
23911
23962
  for (let s in n.hooks) {
23912
23963
  if (!(s in i)) throw new Error(`hook '${s}' does not exist`);
23913
23964
  if (["options", "block"].includes(s)) continue;
23914
- let o = s, a = n.hooks[o], l = i[o];
23915
- S.passThroughHooks.has(s) ? i[o] = (c) => {
23916
- if (this.defaults.async && S.passThroughHooksRespectAsync.has(s)) return (async () => {
23917
- let g = await a.call(i, c);
23918
- return l.call(i, g);
23919
- })();
23920
- let p = a.call(i, c);
23921
- return l.call(i, p);
23922
- } : i[o] = (...c) => {
23923
- if (this.defaults.async) return (async () => {
23924
- let g = await a.apply(i, c);
23925
- return g === false && (g = await l.apply(i, c)), g;
23926
- })();
23927
- let p = a.apply(i, c);
23928
- return p === false && (p = l.apply(i, c)), p;
23965
+ let o = s, a = n.hooks[o], u = i[o];
23966
+ S.passThroughHooks.has(s) ? i[o] = (p) => {
23967
+ if (this.defaults.async && S.passThroughHooksRespectAsync.has(s)) return Promise.resolve(a.call(i, p)).then((f) => u.call(i, f));
23968
+ let c = a.call(i, p);
23969
+ return u.call(i, c);
23970
+ } : i[o] = (...p) => {
23971
+ let c = a.apply(i, p);
23972
+ return c === false && (c = u.apply(i, p)), c;
23929
23973
  };
23930
23974
  }
23931
23975
  r.hooks = i;
@@ -23944,10 +23988,10 @@ var B = class {
23944
23988
  return this.defaults = { ...this.defaults, ...e }, this;
23945
23989
  }
23946
23990
  lexer(e, t) {
23947
- return x.lex(e, t ?? this.defaults);
23991
+ return b.lex(e, t ?? this.defaults);
23948
23992
  }
23949
23993
  parser(e, t) {
23950
- return b.parse(e, t ?? this.defaults);
23994
+ return R.parse(e, t ?? this.defaults);
23951
23995
  }
23952
23996
  parseMarkdown(e) {
23953
23997
  return (n, r) => {
@@ -23955,20 +23999,17 @@ var B = class {
23955
23999
  if (this.defaults.async === true && i.async === false) return o(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));
23956
24000
  if (typeof n > "u" || n === null) return o(new Error("marked(): input parameter is undefined or null"));
23957
24001
  if (typeof n != "string") return o(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(n) + ", string expected"));
23958
- if (s.hooks && (s.hooks.options = s, s.hooks.block = e), s.async) return (async () => {
23959
- let a = s.hooks ? await s.hooks.preprocess(n) : n, c = await (s.hooks ? await s.hooks.provideLexer() : e ? x.lex : x.lexInline)(a, s), p = s.hooks ? await s.hooks.processAllTokens(c) : c;
23960
- s.walkTokens && await Promise.all(this.walkTokens(p, s.walkTokens));
23961
- let d = await (s.hooks ? await s.hooks.provideParser() : e ? b.parse : b.parseInline)(p, s);
23962
- return s.hooks ? await s.hooks.postprocess(d) : d;
23963
- })().catch(o);
24002
+ s.hooks && (s.hooks.options = s, s.hooks.block = e);
24003
+ let a = s.hooks ? s.hooks.provideLexer() : e ? b.lex : b.lexInline, u = s.hooks ? s.hooks.provideParser() : e ? R.parse : R.parseInline;
24004
+ if (s.async) return Promise.resolve(s.hooks ? s.hooks.preprocess(n) : n).then((p) => a(p, s)).then((p) => s.hooks ? s.hooks.processAllTokens(p) : p).then((p) => s.walkTokens ? Promise.all(this.walkTokens(p, s.walkTokens)).then(() => p) : p).then((p) => u(p, s)).then((p) => s.hooks ? s.hooks.postprocess(p) : p).catch(o);
23964
24005
  try {
23965
24006
  s.hooks && (n = s.hooks.preprocess(n));
23966
- let l = (s.hooks ? s.hooks.provideLexer() : e ? x.lex : x.lexInline)(n, s);
23967
- s.hooks && (l = s.hooks.processAllTokens(l)), s.walkTokens && this.walkTokens(l, s.walkTokens);
23968
- let p = (s.hooks ? s.hooks.provideParser() : e ? b.parse : b.parseInline)(l, s);
23969
- return s.hooks && (p = s.hooks.postprocess(p)), p;
23970
- } catch (a) {
23971
- return o(a);
24007
+ let p = a(n, s);
24008
+ s.hooks && (p = s.hooks.processAllTokens(p)), s.walkTokens && this.walkTokens(p, s.walkTokens);
24009
+ let c = u(p, s);
24010
+ return s.hooks && (c = s.hooks.postprocess(c)), c;
24011
+ } catch (p) {
24012
+ return o(p);
23972
24013
  }
23973
24014
  };
23974
24015
  }
@@ -23985,38 +24026,38 @@ Please report this to https://github.com/markedjs/marked.`, e) {
23985
24026
  }
23986
24027
  };
23987
24028
  var _ = new B();
23988
- function k(u3, e) {
23989
- return _.parse(u3, e);
23990
- }
23991
- k.options = k.setOptions = function(u3) {
23992
- return _.setOptions(u3), k.defaults = _.defaults, G(k.defaults), k;
23993
- };
23994
- k.getDefaults = L;
23995
- k.defaults = T;
23996
- k.use = function(...u3) {
23997
- return _.use(...u3), k.defaults = _.defaults, G(k.defaults), k;
23998
- };
23999
- k.walkTokens = function(u3, e) {
24000
- return _.walkTokens(u3, e);
24001
- };
24002
- k.parseInline = _.parseInline;
24003
- k.Parser = b;
24004
- k.parser = b.parse;
24005
- k.Renderer = P;
24006
- k.TextRenderer = $;
24007
- k.Lexer = x;
24008
- k.lexer = x.lex;
24009
- k.Tokenizer = y;
24010
- k.Hooks = S;
24011
- k.parse = k;
24012
- k.options;
24013
- k.setOptions;
24014
- k.use;
24015
- k.walkTokens;
24016
- k.parseInline;
24017
- b.parse;
24018
- x.lex;
24019
- k.use({
24029
+ function d(l3, e) {
24030
+ return _.parse(l3, e);
24031
+ }
24032
+ d.options = d.setOptions = function(l3) {
24033
+ return _.setOptions(l3), d.defaults = _.defaults, G(d.defaults), d;
24034
+ };
24035
+ d.getDefaults = L;
24036
+ d.defaults = O;
24037
+ d.use = function(...l3) {
24038
+ return _.use(...l3), d.defaults = _.defaults, G(d.defaults), d;
24039
+ };
24040
+ d.walkTokens = function(l3, e) {
24041
+ return _.walkTokens(l3, e);
24042
+ };
24043
+ d.parseInline = _.parseInline;
24044
+ d.Parser = R;
24045
+ d.parser = R.parse;
24046
+ d.Renderer = P;
24047
+ d.TextRenderer = $;
24048
+ d.Lexer = b;
24049
+ d.lexer = b.lex;
24050
+ d.Tokenizer = y;
24051
+ d.Hooks = S;
24052
+ d.parse = d;
24053
+ d.options;
24054
+ d.setOptions;
24055
+ d.use;
24056
+ d.walkTokens;
24057
+ d.parseInline;
24058
+ R.parse;
24059
+ b.lex;
24060
+ d.use({
24020
24061
  breaks: false,
24021
24062
  // Use proper paragraphs, not <br> tags
24022
24063
  gfm: true
@@ -24027,7 +24068,7 @@ function createDocFromMarkdown(markdown, schema, options = {}) {
24027
24068
  return createDocFromHTML(html, schema, options);
24028
24069
  }
24029
24070
  function convertMarkdownToHTML(markdown) {
24030
- let html = k.parse(markdown, { async: false });
24071
+ let html = d.parse(markdown, { async: false });
24031
24072
  return html.replace(/<\/p>\n<ul>/g, "</p>\n<p>&nbsp;</p>\n<ul>").replace(/<\/p>\n<ol>/g, "</p>\n<p>&nbsp;</p>\n<ol>").replace(/<\/ul>\n<h/g, "</ul>\n<p>&nbsp;</p>\n<h").replace(/<\/ol>\n<h/g, "</ol>\n<p>&nbsp;</p>\n<h");
24032
24073
  }
24033
24074
  function processContent({ content, type: type2, schema }) {
@@ -24206,7 +24247,7 @@ const getBasicNumIdTag = (numId, abstractId) => {
24206
24247
  };
24207
24248
  const getNewListId = (editor, grouping = "definitions") => {
24208
24249
  const defs = editor.converter.numbering[grouping] || {};
24209
- const intKeys = Object.keys(defs).map((k2) => Number(k2)).filter((n) => Number.isInteger(n));
24250
+ const intKeys = Object.keys(defs).map((k) => Number(k)).filter((n) => Number.isInteger(n));
24210
24251
  const max2 = intKeys.length ? Math.max(...intKeys) : 0;
24211
24252
  return max2 + 1;
24212
24253
  };
@@ -24430,10 +24471,11 @@ const getListItemStyleDefinitions = ({ styleId, numId, level, editor, tries }) =
24430
24471
  if (typeof numId === "string") numId = Number(numId);
24431
24472
  if (typeof level === "string") level = Number(level);
24432
24473
  const docx = editor?.converter?.convertedXml;
24433
- const numbering = editor?.converter?.numbering;
24474
+ const converter = editor?.converter;
24475
+ const numbering = converter?.numbering;
24434
24476
  const styleDefinition = docx ? getStyleTagFromStyleId(styleId, docx) : null;
24435
24477
  const stylePpr = styleDefinition?.elements.find((el) => el.name === "w:pPr");
24436
- let abstractDefinition = docx ? getAbstractDefinition(numId, docx) : null;
24478
+ let abstractDefinition = docx ? getAbstractDefinition(numId, docx, converter) : null;
24437
24479
  if (!abstractDefinition) {
24438
24480
  const listDef = numbering?.definitions?.[numId];
24439
24481
  const abstractId = listDef?.elements?.find((item) => item.name === "w:abstractNumId")?.attributes?.["w:val"];
@@ -28783,7 +28825,16 @@ const translateImageNode = (params) => {
28783
28825
  const { width: w2, height: h2 } = resizeKeepAspectRatio(size.w, size.h, maxWidthEmu);
28784
28826
  if (w2 && h2) size = { w: w2, h: h2 };
28785
28827
  }
28786
- if (params.node.type === "image" && !imageId) {
28828
+ if (imageId) {
28829
+ const docx = params.converter?.convertedXml || {};
28830
+ const rels = docx["word/_rels/document.xml.rels"];
28831
+ const relsTag = rels?.elements?.find((el) => el.name === "Relationships");
28832
+ const hasRelation = relsTag?.elements.find((el) => el.attributes.Id === imageId);
28833
+ const path = src?.split("word/")[1];
28834
+ if (!hasRelation) {
28835
+ addImageRelationshipForId(params, imageId, path);
28836
+ }
28837
+ } else if (params.node.type === "image" && !imageId) {
28787
28838
  const path = src?.split("word/")[1];
28788
28839
  imageId = addNewImageRelationship(params, path);
28789
28840
  } else if (params.node.type === "fieldAnnotation" && !imageId) {
@@ -29007,6 +29058,18 @@ function addNewImageRelationship(params, imagePath) {
29007
29058
  params.relationships.push(newRel);
29008
29059
  return newId;
29009
29060
  }
29061
+ function addImageRelationshipForId(params, id, imagePath) {
29062
+ const newRel = {
29063
+ type: "element",
29064
+ name: "Relationship",
29065
+ attributes: {
29066
+ Id: id,
29067
+ Type: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",
29068
+ Target: imagePath
29069
+ }
29070
+ };
29071
+ params.relationships.push(newRel);
29072
+ }
29010
29073
  function translateVectorShape(params) {
29011
29074
  const { node } = params;
29012
29075
  const { drawingContent } = node.attrs;
@@ -33522,7 +33585,7 @@ const createDocumentJson = (docx, converter, editor) => {
33522
33585
  comments,
33523
33586
  inlineDocumentFonts,
33524
33587
  linkedStyles: getStyleDefinitions(docx),
33525
- numbering: getNumberingDefinitions(docx)
33588
+ numbering: getNumberingDefinitions(docx, converter)
33526
33589
  };
33527
33590
  }
33528
33591
  return null;
@@ -33921,8 +33984,8 @@ function filterOutRootInlineNodes(content = []) {
33921
33984
  ]);
33922
33985
  return content.filter((node) => node && typeof node.type === "string" && !INLINE_TYPES.has(node.type));
33923
33986
  }
33924
- function getNumberingDefinitions(docx) {
33925
- const cache = ensureNumberingCache(docx);
33987
+ function getNumberingDefinitions(docx, converter) {
33988
+ const cache = ensureNumberingCache(docx, converter);
33926
33989
  const abstractDefinitions = {};
33927
33990
  cache.abstractById.forEach((value, key) => {
33928
33991
  const numericKey = Number(key);
@@ -35296,6 +35359,35 @@ const prepareCommentsXmlFilesForExport = ({ convertedXml, defs, commentsWithPara
35296
35359
  };
35297
35360
  const HYPERLINK_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink";
35298
35361
  const HEADER_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header";
35362
+ const FOOTER_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer";
35363
+ const REL_ID_NUMERIC_PATTERN = /rId|mi/g;
35364
+ const getLargestRelationshipId = (relationships = []) => {
35365
+ const numericIds = relationships.map((rel) => Number(String(rel?.attributes?.Id ?? "").replace(REL_ID_NUMERIC_PATTERN, ""))).filter((value) => Number.isFinite(value));
35366
+ return numericIds.length ? Math.max(...numericIds) : 0;
35367
+ };
35368
+ const mergeRelationshipElements = (existingRelationships = [], newRelationships = []) => {
35369
+ if (!newRelationships?.length) return existingRelationships;
35370
+ let largestId = getLargestRelationshipId(existingRelationships);
35371
+ const seenIds = new Set(existingRelationships.map((rel) => rel?.attributes?.Id).filter(Boolean));
35372
+ const additions = [];
35373
+ newRelationships.forEach((rel) => {
35374
+ if (!rel?.attributes) return;
35375
+ const attributes = rel.attributes;
35376
+ const currentId = attributes.Id || "";
35377
+ attributes.Target = attributes?.Target?.replace(/&/g, "&amp;");
35378
+ const existingTarget = existingRelationships.find((el) => el.attributes.Target === attributes.Target);
35379
+ const isMedia = attributes.Target?.startsWith("media/");
35380
+ const isNewHyperlink = attributes.Type === HYPERLINK_RELATIONSHIP_TYPE && currentId.length > 6;
35381
+ const isNewHeadFoot = (attributes.Type === HEADER_RELATIONSHIP_TYPE || attributes.Type === FOOTER_RELATIONSHIP_TYPE) && currentId.length > 6;
35382
+ const hasSeenId = currentId && seenIds.has(currentId);
35383
+ const shouldSkip = !isNewHyperlink && !isNewHeadFoot && (hasSeenId || existingTarget);
35384
+ if (shouldSkip) return;
35385
+ attributes.Id = currentId.length > 6 || isMedia ? currentId : `rId${++largestId}`;
35386
+ seenIds.add(attributes.Id);
35387
+ additions.push(rel);
35388
+ });
35389
+ return additions.length ? [...existingRelationships, ...additions] : existingRelationships;
35390
+ };
35299
35391
  const FONT_FAMILY_FALLBACKS = Object.freeze({
35300
35392
  swiss: "Arial, sans-serif",
35301
35393
  roman: "Times New Roman, serif",
@@ -35504,7 +35596,7 @@ const _SuperConverter = class _SuperConverter {
35504
35596
  static getStoredSuperdocVersion(docx) {
35505
35597
  return _SuperConverter.getStoredCustomProperty(docx, "SuperdocVersion");
35506
35598
  }
35507
- static setStoredSuperdocVersion(docx = this.convertedXml, version = "0.28.0") {
35599
+ static setStoredSuperdocVersion(docx = this.convertedXml, version = "0.28.2") {
35508
35600
  return _SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version, false);
35509
35601
  }
35510
35602
  /**
@@ -35898,7 +35990,7 @@ prepareCommentsXmlFilesForExport_fn = function({ defs, exportType, commentsWithP
35898
35990
  };
35899
35991
  exportProcessHeadersFooters_fn = function({ isFinalDoc = false }) {
35900
35992
  const relsData = this.convertedXml["word/_rels/document.xml.rels"];
35901
- const relationships = relsData.elements.find((x2) => x2.name === "Relationships");
35993
+ const relationships = relsData.elements.find((x) => x.name === "Relationships");
35902
35994
  const newDocRels = [];
35903
35995
  Object.entries(this.headers).forEach(([id, header], index2) => {
35904
35996
  const fileName = relationships.elements.find((el) => el.attributes.Id === id)?.attributes.Target || `header${index2 + 1}.xml`;
@@ -35939,7 +36031,7 @@ exportProcessHeadersFooters_fn = function({ isFinalDoc = false }) {
35939
36031
  }
35940
36032
  this.convertedXml[`word/${fileName}`].elements[0].elements = bodyContent;
35941
36033
  if (params.relationships.length) {
35942
- const relationships2 = this.convertedXml[`word/_rels/${fileName}.rels`]?.elements?.find((x2) => x2.name === "Relationships")?.elements || [];
36034
+ const relationships2 = this.convertedXml[`word/_rels/${fileName}.rels`]?.elements?.find((x) => x.name === "Relationships")?.elements || [];
35943
36035
  this.convertedXml[`word/_rels/${fileName}.rels`] = {
35944
36036
  declaration: this.initialJSON?.declaration,
35945
36037
  elements: [
@@ -35993,7 +36085,7 @@ exportProcessHeadersFooters_fn = function({ isFinalDoc = false }) {
35993
36085
  }
35994
36086
  this.convertedXml[`word/${fileName}`].elements[0].elements = bodyContent;
35995
36087
  if (params.relationships.length) {
35996
- const relationships2 = this.convertedXml[`word/_rels/${fileName}.rels`]?.elements?.find((x2) => x2.name === "Relationships")?.elements || [];
36088
+ const relationships2 = this.convertedXml[`word/_rels/${fileName}.rels`]?.elements?.find((x) => x.name === "Relationships")?.elements || [];
35997
36089
  this.convertedXml[`word/_rels/${fileName}.rels`] = {
35998
36090
  declaration: this.initialJSON?.declaration,
35999
36091
  elements: [
@@ -36012,24 +36104,8 @@ exportProcessHeadersFooters_fn = function({ isFinalDoc = false }) {
36012
36104
  };
36013
36105
  exportProcessNewRelationships_fn = function(rels = []) {
36014
36106
  const relsData = this.convertedXml["word/_rels/document.xml.rels"];
36015
- const relationships = relsData.elements.find((x2) => x2.name === "Relationships");
36016
- const newRels = [];
36017
- const regex = /rId|mi/g;
36018
- let largestId = Math.max(...relationships.elements.map((el) => Number(el.attributes.Id.replace(regex, ""))));
36019
- rels.forEach((rel) => {
36020
- const existingId = rel.attributes.Id;
36021
- const existingTarget = relationships.elements.find((el) => el.attributes.Target === rel.attributes.Target);
36022
- const isNewMedia = rel.attributes.Target?.startsWith("media/") && existingId.length > 6;
36023
- const isNewHyperlink = rel.attributes.Type === HYPERLINK_RELATIONSHIP_TYPE && existingId.length > 6;
36024
- const isNewHeadFoot = rel.attributes.Type === HEADER_RELATIONSHIP_TYPE && existingId.length > 6;
36025
- if (existingTarget && !isNewMedia && !isNewHyperlink && !isNewHeadFoot) {
36026
- return;
36027
- }
36028
- rel.attributes.Target = rel.attributes?.Target?.replace(/&/g, "&amp;");
36029
- rel.attributes.Id = existingId.length > 6 ? existingId : `rId${++largestId}`;
36030
- newRels.push(rel);
36031
- });
36032
- relationships.elements = [...relationships.elements, ...newRels];
36107
+ const relationships = relsData.elements.find((x) => x.name === "Relationships");
36108
+ relationships.elements = mergeRelationshipElements(relationships.elements, rels);
36033
36109
  };
36034
36110
  exportProcessMediaFiles_fn = async function(media = {}) {
36035
36111
  const processedData = {