drizzle-cube 0.4.5 → 0.4.8

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 (140) hide show
  1. package/dist/adapters/express/index.cjs +8 -4
  2. package/dist/adapters/express/index.d.ts +7 -0
  3. package/dist/adapters/express/index.js +189 -139
  4. package/dist/adapters/fastify/index.cjs +8 -4
  5. package/dist/adapters/fastify/index.d.ts +7 -0
  6. package/dist/adapters/fastify/index.js +209 -150
  7. package/dist/adapters/handler-BLcxTuwi.cjs +23 -0
  8. package/dist/adapters/handler-odjn7MIB.js +1880 -0
  9. package/dist/adapters/hono/index.cjs +8 -4
  10. package/dist/adapters/hono/index.d.ts +7 -0
  11. package/dist/adapters/hono/index.js +202 -144
  12. package/dist/adapters/{mcp-transport-YHDZWKOi.js → mcp-transport-CU5g9bxj.js} +7 -3
  13. package/dist/adapters/{mcp-transport-BqLo4hKi.cjs → mcp-transport-KX92EgkF.cjs} +21 -21
  14. package/dist/adapters/nextjs/index.cjs +7 -3
  15. package/dist/adapters/nextjs/index.d.ts +14 -0
  16. package/dist/adapters/nextjs/index.js +220 -144
  17. package/dist/client/charts/chartConfigs.d.ts +2 -9
  18. package/dist/client/charts.js +72 -70
  19. package/dist/client/charts.js.map +1 -1
  20. package/dist/client/chunks/{RetentionCombinedChart.config-C-ILIaEb.js → RetentionCombinedChart.config-Bbp2ghim.js} +2 -1
  21. package/dist/client/chunks/RetentionCombinedChart.config-Bbp2ghim.js.map +1 -0
  22. package/dist/client/chunks/{RetentionHeatmap.config-CIvhc-GT.js → RetentionHeatmap.config-BWf_-vdj.js} +2 -1
  23. package/dist/client/chunks/RetentionHeatmap.config-BWf_-vdj.js.map +1 -0
  24. package/dist/client/chunks/{analysis-builder-CG5VIMYB.js → analysis-builder-Bov_gLsf.js} +1408 -1393
  25. package/dist/client/chunks/analysis-builder-Bov_gLsf.js.map +1 -0
  26. package/dist/client/chunks/{analysis-builder-shared-CjlKJgyA.js → analysis-builder-shared-NBk6y0md.js} +3 -3
  27. package/dist/client/chunks/{analysis-builder-shared-CjlKJgyA.js.map → analysis-builder-shared-NBk6y0md.js.map} +1 -1
  28. package/dist/client/chunks/{chart-activity-grid-DStNr34n.js → chart-activity-grid-CE7xGFQo.js} +2 -2
  29. package/dist/client/chunks/{chart-activity-grid-DStNr34n.js.map → chart-activity-grid-CE7xGFQo.js.map} +1 -1
  30. package/dist/client/chunks/chart-box-plot-Dja4LS3O.js +313 -0
  31. package/dist/client/chunks/chart-box-plot-Dja4LS3O.js.map +1 -0
  32. package/dist/client/chunks/{chart-config-activity-grid-CAlo1cHA.js → chart-config-activity-grid-CmOqDuOT.js} +4 -5
  33. package/dist/client/chunks/chart-config-activity-grid-CmOqDuOT.js.map +1 -0
  34. package/dist/client/chunks/{chart-config-area-CyyJOO2T.js → chart-config-area-CK_GVApT.js} +4 -5
  35. package/dist/client/chunks/chart-config-area-CK_GVApT.js.map +1 -0
  36. package/dist/client/chunks/{chart-config-bar-soxw6m2o.js → chart-config-bar-C8uzktxl.js} +4 -5
  37. package/dist/client/chunks/chart-config-bar-C8uzktxl.js.map +1 -0
  38. package/dist/client/chunks/chart-config-box-plot-D3DA7_pr.js +85 -0
  39. package/dist/client/chunks/chart-config-box-plot-D3DA7_pr.js.map +1 -0
  40. package/dist/client/chunks/{chart-config-bubble-CuSsCHZ4.js → chart-config-bubble-q3DoQX5F.js} +4 -5
  41. package/dist/client/chunks/chart-config-bubble-q3DoQX5F.js.map +1 -0
  42. package/dist/client/chunks/{chart-config-data-table-BhgqwoqT.js → chart-config-data-table-B20Y5JCm.js} +4 -5
  43. package/dist/client/chunks/chart-config-data-table-B20Y5JCm.js.map +1 -0
  44. package/dist/client/chunks/{chart-config-funnel-BlSQYng0.js → chart-config-funnel-3eYnGg8M.js} +4 -5
  45. package/dist/client/chunks/chart-config-funnel-3eYnGg8M.js.map +1 -0
  46. package/dist/client/chunks/{chart-config-heat-map-DHQGFZhX.js → chart-config-heat-map-_wEnTnRA.js} +4 -5
  47. package/dist/client/chunks/chart-config-heat-map-_wEnTnRA.js.map +1 -0
  48. package/dist/client/chunks/{chart-config-kpi-delta-yTA5ug_l.js → chart-config-kpi-delta-DLGZ2A3X.js} +4 -5
  49. package/dist/client/chunks/chart-config-kpi-delta-DLGZ2A3X.js.map +1 -0
  50. package/dist/client/chunks/{chart-config-kpi-number-nVAwDXzq.js → chart-config-kpi-number-K-wzviXF.js} +4 -5
  51. package/dist/client/chunks/chart-config-kpi-number-K-wzviXF.js.map +1 -0
  52. package/dist/client/chunks/{chart-config-kpi-text-DZjqsx-b.js → chart-config-kpi-text-BjYqwqaJ.js} +4 -5
  53. package/dist/client/chunks/chart-config-kpi-text-BjYqwqaJ.js.map +1 -0
  54. package/dist/client/chunks/{chart-config-line-D5ME6w0v.js → chart-config-line-JNagi9tf.js} +4 -5
  55. package/dist/client/chunks/chart-config-line-JNagi9tf.js.map +1 -0
  56. package/dist/client/chunks/{chart-config-markdown-BXKL5TbQ.js → chart-config-markdown-BWQSjJpy.js} +4 -5
  57. package/dist/client/chunks/chart-config-markdown-BWQSjJpy.js.map +1 -0
  58. package/dist/client/chunks/{chart-config-pie-DlHa2jTy.js → chart-config-pie-CNLXb-fr.js} +4 -5
  59. package/dist/client/chunks/chart-config-pie-CNLXb-fr.js.map +1 -0
  60. package/dist/client/chunks/{chart-config-radar-BBAVIF0S.js → chart-config-radar-oxHfRAa3.js} +4 -5
  61. package/dist/client/chunks/chart-config-radar-oxHfRAa3.js.map +1 -0
  62. package/dist/client/chunks/{chart-config-radial-bar-CTwjDRnB.js → chart-config-radial-bar-_Aw3jAEm.js} +4 -5
  63. package/dist/client/chunks/chart-config-radial-bar-_Aw3jAEm.js.map +1 -0
  64. package/dist/client/chunks/{chart-config-sankey-CNAgsMQ4.js → chart-config-sankey-C8FX9hGF.js} +4 -5
  65. package/dist/client/chunks/chart-config-sankey-C8FX9hGF.js.map +1 -0
  66. package/dist/client/chunks/{chart-config-scatter-CWvN2E-X.js → chart-config-scatter-DFKM80eO.js} +4 -5
  67. package/dist/client/chunks/chart-config-scatter-DFKM80eO.js.map +1 -0
  68. package/dist/client/chunks/{chart-config-sunburst-W_SKwaj0.js → chart-config-sunburst-BmC0NLTU.js} +4 -5
  69. package/dist/client/chunks/chart-config-sunburst-BmC0NLTU.js.map +1 -0
  70. package/dist/client/chunks/{chart-config-tree-map-IRAYf9YM.js → chart-config-tree-map-DGMbNTaa.js} +4 -5
  71. package/dist/client/chunks/chart-config-tree-map-DGMbNTaa.js.map +1 -0
  72. package/dist/client/chunks/{chart-data-table-Ch_1c1Zo.js → chart-data-table-Ba_6tuJw.js} +2 -2
  73. package/dist/client/chunks/{chart-data-table-Ch_1c1Zo.js.map → chart-data-table-Ba_6tuJw.js.map} +1 -1
  74. package/dist/client/chunks/{chart-kpi-delta-CWCmi8vL.js → chart-kpi-delta-D9XJoKuA.js} +3 -3
  75. package/dist/client/chunks/{chart-kpi-delta-CWCmi8vL.js.map → chart-kpi-delta-D9XJoKuA.js.map} +1 -1
  76. package/dist/client/chunks/{chart-kpi-number-C-5m3qt5.js → chart-kpi-number-C29Vj2g8.js} +2 -2
  77. package/dist/client/chunks/{chart-kpi-number-C-5m3qt5.js.map → chart-kpi-number-C29Vj2g8.js.map} +1 -1
  78. package/dist/client/chunks/{chart-kpi-text--t4ibPmx.js → chart-kpi-text-CgjjrurK.js} +2 -2
  79. package/dist/client/chunks/{chart-kpi-text--t4ibPmx.js.map → chart-kpi-text-CgjjrurK.js.map} +1 -1
  80. package/dist/client/chunks/chart-markdown-Du4Z2iqK.js +2695 -0
  81. package/dist/client/chunks/chart-markdown-Du4Z2iqK.js.map +1 -0
  82. package/dist/client/chunks/{charts-loader-m5Ussksz.js → charts-loader-HYQFVOo4.js} +14 -13
  83. package/dist/client/chunks/charts-loader-HYQFVOo4.js.map +1 -0
  84. package/dist/client/chunks/{components-D-5p1LVQ.js → components-O0hh7ooo.js} +6 -6
  85. package/dist/client/chunks/components-O0hh7ooo.js.map +1 -0
  86. package/dist/client/chunks/{icons-DRreo6m8.js → icons-DAeqv1iX.js} +7 -7
  87. package/dist/client/chunks/{icons-DRreo6m8.js.map → icons-DAeqv1iX.js.map} +1 -1
  88. package/dist/client/components/AgenticNotebook/AgentChatPanel.d.ts +8 -0
  89. package/dist/client/components/AgenticNotebook/ChatInput.d.ts +14 -0
  90. package/dist/client/components/AgenticNotebook/ChatMessage.d.ts +7 -0
  91. package/dist/client/components/AgenticNotebook/NotebookCanvas.d.ts +3 -0
  92. package/dist/client/components/AgenticNotebook/NotebookMarkdownBlock.d.ts +12 -0
  93. package/dist/client/components/AgenticNotebook/NotebookPortletBlock.d.ts +12 -0
  94. package/dist/client/components/AgenticNotebook/index.d.ts +34 -0
  95. package/dist/client/components/charts/BoxPlotChart.config.d.ts +11 -0
  96. package/dist/client/components/charts/BoxPlotChart.d.ts +4 -0
  97. package/dist/client/components/charts/index.d.ts +1 -0
  98. package/dist/client/components.js +1 -1
  99. package/dist/client/hooks/useAgentChat.d.ts +36 -0
  100. package/dist/client/icons.js +1 -1
  101. package/dist/client/index.d.ts +6 -0
  102. package/dist/client/index.js +923 -187
  103. package/dist/client/index.js.map +1 -1
  104. package/dist/client/stores/notebookStore.d.ts +152 -0
  105. package/dist/client/styles.css +1 -1
  106. package/dist/client/types.d.ts +1 -1
  107. package/dist/client/utils.js +3 -3
  108. package/dist/client-bundle-stats.html +4 -4
  109. package/dist/server/index.cjs +116 -90
  110. package/dist/server/index.d.ts +155 -0
  111. package/dist/server/index.js +7088 -4852
  112. package/package.json +12 -6
  113. package/dist/client/chunks/RetentionCombinedChart.config-C-ILIaEb.js.map +0 -1
  114. package/dist/client/chunks/RetentionHeatmap.config-CIvhc-GT.js.map +0 -1
  115. package/dist/client/chunks/analysis-builder-CG5VIMYB.js.map +0 -1
  116. package/dist/client/chunks/chart-config-activity-grid-CAlo1cHA.js.map +0 -1
  117. package/dist/client/chunks/chart-config-area-CyyJOO2T.js.map +0 -1
  118. package/dist/client/chunks/chart-config-bar-soxw6m2o.js.map +0 -1
  119. package/dist/client/chunks/chart-config-bubble-CuSsCHZ4.js.map +0 -1
  120. package/dist/client/chunks/chart-config-data-table-BhgqwoqT.js.map +0 -1
  121. package/dist/client/chunks/chart-config-funnel-BlSQYng0.js.map +0 -1
  122. package/dist/client/chunks/chart-config-heat-map-DHQGFZhX.js.map +0 -1
  123. package/dist/client/chunks/chart-config-kpi-delta-yTA5ug_l.js.map +0 -1
  124. package/dist/client/chunks/chart-config-kpi-number-nVAwDXzq.js.map +0 -1
  125. package/dist/client/chunks/chart-config-kpi-text-DZjqsx-b.js.map +0 -1
  126. package/dist/client/chunks/chart-config-line-D5ME6w0v.js.map +0 -1
  127. package/dist/client/chunks/chart-config-markdown-BXKL5TbQ.js.map +0 -1
  128. package/dist/client/chunks/chart-config-pie-DlHa2jTy.js.map +0 -1
  129. package/dist/client/chunks/chart-config-radar-BBAVIF0S.js.map +0 -1
  130. package/dist/client/chunks/chart-config-radial-bar-CTwjDRnB.js.map +0 -1
  131. package/dist/client/chunks/chart-config-sankey-CNAgsMQ4.js.map +0 -1
  132. package/dist/client/chunks/chart-config-scatter-CWvN2E-X.js.map +0 -1
  133. package/dist/client/chunks/chart-config-sunburst-W_SKwaj0.js.map +0 -1
  134. package/dist/client/chunks/chart-config-tree-map-IRAYf9YM.js.map +0 -1
  135. package/dist/client/chunks/chart-markdown-Rq6ORisB.js +0 -276
  136. package/dist/client/chunks/chart-markdown-Rq6ORisB.js.map +0 -1
  137. package/dist/client/chunks/chartConfigRegistry-C5dZm-ZK.js +0 -44
  138. package/dist/client/chunks/chartConfigRegistry-C5dZm-ZK.js.map +0 -1
  139. package/dist/client/chunks/charts-loader-m5Ussksz.js.map +0 -1
  140. package/dist/client/chunks/components-D-5p1LVQ.js.map +0 -1
@@ -0,0 +1,2695 @@
1
+ import { jsx as Ur, jsxs as Qa } from "react/jsx-runtime";
2
+ import * as xr from "react";
3
+ import $a, { useMemo as Ft } from "react";
4
+ var tt;
5
+ function en(e) {
6
+ if (!tt) if (typeof document < "u") tt = document.createElement("textarea");
7
+ else return;
8
+ var t = "&" + e + ";";
9
+ tt.innerHTML = t;
10
+ var r = tt.value;
11
+ return r !== t ? r : void 0;
12
+ }
13
+ var B = 32, E = 9, br = 13, D = 10, ne = 96, Te = 126, Ce = 91, ar = 94, U = 62, or = 35, rn = 36, lt = 37, q = 45, Ke = 61, we = 92, xe = 42, pe = 95, ce = 60, st = 64, Ge = 93, ze = 33, _t = 38, Ne = 58, Kt = 70, Pr = 102, ht = 104, Mr = 119, wt = 116, qt = 112, tn = 115, an = 160, nn = 12, ua = 44, Ht = 59, Dr = 63, Qe = 46, be = 47, wr = 39, Lr = 34, Br = 43, Be = 124, Ir = 123, ut = 125, Ze = 40, $e = 41, it = 30, Ca = 31, $ = 48, ee = 57, Y = 65, Z = 90, Ae = 97, ge = 122, Gr = 128, ur = 32, ln = { blockQuote: 0, breakLine: 1, breakThematic: 2, codeBlock: 3, codeInline: 4, footnote: 5, footnoteReference: 6, frontmatter: 7, gfmTask: 8, heading: 9, htmlBlock: 10, htmlComment: 11, htmlSelfClosing: 12, image: 13, link: 14, orderedList: 15, paragraph: 16, ref: 17, refCollection: 18, table: 19, text: 20, textFormatted: 21, unorderedList: 22 }, x = ln;
14
+ function on(e) {
15
+ if (!Yt(e, "---")) return null;
16
+ let t = 3;
17
+ for (; t < e.length && (e[t] === " " || e[t] === " "); ) t++;
18
+ if (t < e.length && e[t] === "\r" && t++, t >= e.length || e[t] !== `
19
+ `) return null;
20
+ t++;
21
+ let r = !1;
22
+ for (; t < e.length; ) {
23
+ let a = t;
24
+ for (; t < e.length && e[t] !== `
25
+ ` && e[t] !== "\r"; ) t++;
26
+ if (t >= e.length) break;
27
+ let n = t;
28
+ if (e[t] === "\r" && t++, t < e.length && e[t] === `
29
+ ` && t++, Yt(e, "---", a)) return { endPos: t, hasValidYaml: r };
30
+ let l = e.indexOf(":", a);
31
+ l !== -1 && l < n && (r = !0);
32
+ }
33
+ return null;
34
+ }
35
+ var cn = /&([a-zA-Z0-9]+|#[0-9]{1,7}|#x[0-9a-fA-F]{1,6});/gi, fn = { class: "className", for: "htmlFor", allowfullscreen: "allowFullScreen", allowtransparency: "allowTransparency", autocomplete: "autoComplete", autofocus: "autoFocus", autoplay: "autoPlay", cellpadding: "cellPadding", cellspacing: "cellSpacing", charset: "charSet", classid: "classId", colspan: "colSpan", contenteditable: "contentEditable", contextmenu: "contextMenu", crossorigin: "crossOrigin", enctype: "encType", formaction: "formAction", formenctype: "formEncType", formmethod: "formMethod", formnovalidate: "formNoValidate", formtarget: "formTarget", frameborder: "frameBorder", hreflang: "hrefLang", inputmode: "inputMode", keyparams: "keyParams", keytype: "keyType", marginheight: "marginHeight", marginwidth: "marginWidth", maxlength: "maxLength", mediagroup: "mediaGroup", minlength: "minLength", novalidate: "noValidate", radiogroup: "radioGroup", readonly: "readOnly", rowspan: "rowSpan", spellcheck: "spellCheck", srcdoc: "srcDoc", srclang: "srcLang", srcset: "srcSet", tabindex: "tabIndex", usemap: "useMap", viewbox: "viewBox" };
36
+ function Fe(e) {
37
+ var t = {};
38
+ for (var r in e) {
39
+ var a = r.toLowerCase(), n = fn[a];
40
+ if (n) t[n] = e[r];
41
+ else {
42
+ var l = r.indexOf(":");
43
+ l !== -1 ? t[r.slice(0, l) + r[l + 1].toUpperCase() + r.slice(l + 2)] = e[r] : t[r] = e[r];
44
+ }
45
+ }
46
+ return t;
47
+ }
48
+ var dn = /(\n|^[-*]\s|^#|^ {2,}|^-{2,}|^>\s|^<(div|p|h[1-6]|ul|ol|li|blockquote|pre|table|thead|tbody|tr|td|th|dl|dt|dd|hr|address|article|aside|details|dialog|figure|figcaption|footer|form|header|main|menu|nav|section|summary|textarea|fieldset|legend|center|dir|hgroup|marquee|search|output|template)\b)/i;
49
+ function Ct(e) {
50
+ return e.indexOf("&") === -1 ? e : e.replace(cn, (t, r) => {
51
+ var a = en(r);
52
+ if (a) return a;
53
+ if (r[0] === "#") {
54
+ var n = r[1] === "x" || r[1] === "X" ? parseInt(r.slice(2), 16) : parseInt(r.slice(1), 10);
55
+ return n === 0 || n >= 55296 && n <= 57343 || n > 1114111 ? "�" : n <= 65535 ? String.fromCharCode(n) : String.fromCharCode(55296 + (n - 65536 >> 10), 56320 + (n - 65536 & 1023));
56
+ }
57
+ return t;
58
+ });
59
+ }
60
+ var Gt = /(javascript|vbscript|data(?!:image)):/i;
61
+ function Nt(e) {
62
+ if (Gt.test(e)) return null;
63
+ if (e.indexOf("%") === -1) return e;
64
+ try {
65
+ let t = decodeURIComponent(e).replace(/[^A-Za-z0-9/:]/g, "");
66
+ if (Gt.test(t)) return null;
67
+ } catch {
68
+ return null;
69
+ }
70
+ return e;
71
+ }
72
+ var He = {}, Me, Oe;
73
+ for (Me = [192, 193, 194, 195, 196, 197, 224, 225, 226, 227, 228, 229, 230, 198], Oe = 0; Oe < Me.length; Oe++) He[Me[Oe]] = "a";
74
+ for (He[231] = He[199] = "c", He[240] = He[208] = "d", Me = [200, 201, 202, 203, 233, 232, 234, 235], Oe = 0; Oe < Me.length; Oe++) He[Me[Oe]] = "e";
75
+ for (Me = [207, 239, 206, 238, 205, 237, 204, 236], Oe = 0; Oe < Me.length; Oe++) He[Me[Oe]] = "i";
76
+ for (He[209] = He[241] = "n", Me = [248, 216, 339, 338, 213, 245, 212, 244, 211, 243, 210, 242], Oe = 0; Oe < Me.length; Oe++) He[Me[Oe]] = "o";
77
+ for (Me = [220, 252, 219, 251, 218, 250, 217, 249], Oe = 0; Oe < Me.length; Oe++) He[Me[Oe]] = "u";
78
+ He[376] = He[255] = He[221] = He[253] = "y";
79
+ function sn(e) {
80
+ return e < Gr && (vn[e] & (Lt | Aa)) !== 0;
81
+ }
82
+ function ir(e) {
83
+ for (var t = "", r = -1, a = 0; a < e.length; a++) {
84
+ var n = e.charCodeAt(a);
85
+ if (sn(n)) n >= Y && n <= Z ? (r >= 0 && (t += e.slice(r, a), r = -1), t += String.fromCharCode(n + ur)) : r < 0 && (r = a);
86
+ else if (n === B || n === q) r >= 0 && (t += e.slice(r, a), r = -1), t += "-";
87
+ else {
88
+ r >= 0 && (t += e.slice(r, a), r = -1);
89
+ var l = He[n];
90
+ l && (t += l);
91
+ }
92
+ }
93
+ return r >= 0 && (t += e.slice(r)), t;
94
+ }
95
+ function Yt(e, t, r) {
96
+ return e.startsWith(t, r);
97
+ }
98
+ var Vt = /* @__PURE__ */ new Set(["area", "base", "br", "col", "embed", "hr", "img", "input", "link", "meta", "param", "source", "track", "wbr", "circle", "ellipse", "line", "path", "polygon", "polyline", "rect", "use", "stop", "animate", "set"]);
99
+ function Yr(e) {
100
+ let t = e.toLowerCase();
101
+ if (Vt.has(t)) return !0;
102
+ let r = t.indexOf(":");
103
+ return r !== -1 ? (t = t.slice(r + 1), Vt.has(t)) : !1;
104
+ }
105
+ var Fr = 1, at = 2, Lt = 4, Aa = 8, Zt = 16, Qt = 32, hn = 64, $t = 1, un = 2, Cn = 3, An = 4, vn = (function() {
106
+ let e = new Uint8Array(128), t;
107
+ for (e[E] = Fr | Qt, e[D] = Fr | Zt, e[nn] = Fr, e[br] = Fr | Zt, e[B] = Fr | Qt, t = ze; t <= be; t++) e[t] = at;
108
+ for (t = Ne; t <= st; t++) e[t] = at;
109
+ for (t = Ce; t <= ne; t++) e[t] = at;
110
+ for (t = Ir; t <= Te; t++) e[t] = at;
111
+ for (t = $; t <= ee; t++) e[t] = Aa;
112
+ for (t = Y; t <= Z; t++) e[t] = Lt | hn;
113
+ for (t = Ae; t <= ge; t++) e[t] = Lt;
114
+ return e;
115
+ })();
116
+ (function() {
117
+ let e = new Uint8Array(128);
118
+ return e[we] = un, e[Ce] = An, e[xe] = e[pe] = e[Te] = e[Ke] = Cn, e[ne] = e[ce] = e[st] = e[Ge] = e[D] = e[B] = e[ze] = $t, e[Pr] = e[ht] = e[Mr] = $t, e;
119
+ })();
120
+ var Er = [];
121
+ function pn(e) {
122
+ var t = e.indexOf("\r"), r = e.indexOf("\0");
123
+ if (t === -1 && r === -1) return e;
124
+ var a = e.length;
125
+ Er.length = 0;
126
+ var n = 0, l = 0;
127
+ for (t === -1 ? l = r : r === -1 ? l = t : l = t < r ? t : r; l < a; l++) {
128
+ var i = e.charCodeAt(l);
129
+ i === br ? (n < l && Er.push(e.slice(n, l)), l + 1 < a && e.charCodeAt(l + 1) === D && l++, Er.push(`
130
+ `), n = l + 1) : i === 0 && (n < l && Er.push(e.slice(n, l)), Er.push("�"), n = l + 1);
131
+ }
132
+ return n < a && Er.push(e.slice(n)), Er.join("");
133
+ }
134
+ function Bt(e, t, r) {
135
+ for (var a = e, n = t.split("."), l = 0; l < n.length && (a = a?.[n[l]], a !== void 0); ) l++;
136
+ return a || r;
137
+ }
138
+ function gn(e) {
139
+ for (var t = !1, r = 0; r < e.length; r++) {
140
+ var a = e.charCodeAt(r);
141
+ if (a <= B || a === Lr || a === lt || a === ce || a === U || a === Ce || a === we || a === Ge || a === ar || a === ne || a >= 123) {
142
+ t = !0;
143
+ break;
144
+ }
145
+ }
146
+ if (!t) return e;
147
+ for (var n = "", r = 0; r < e.length; r++) {
148
+ var a = e.charCodeAt(r);
149
+ if (a === lt && r + 2 < e.length) {
150
+ var l = e.charCodeAt(r + 1), i = e.charCodeAt(r + 2);
151
+ if ((l >= $ && l <= ee || l >= Y && l <= Kt || l >= Ae && l <= Pr) && (i >= $ && i <= ee || i >= Y && i <= Kt || i >= Ae && i <= Pr)) {
152
+ n += e[r] + e[r + 1] + e[r + 2], r += 2;
153
+ continue;
154
+ }
155
+ }
156
+ n += encodeURI(e[r]);
157
+ }
158
+ return n;
159
+ }
160
+ function mn(...e) {
161
+ return e.filter(Boolean).join(" ");
162
+ }
163
+ var xn = /* @__PURE__ */ new Set(["title", "textarea", "style", "xmp", "iframe", "noembed", "noframes", "script", "plaintext"]), ot = /<(\/?)(title|textarea|style|xmp|iframe|noembed|noframes|script|plaintext)(\s|>|\/)/gi;
164
+ function ea(e) {
165
+ return xn.has(e.toLowerCase());
166
+ }
167
+ function yn(e) {
168
+ return ot.lastIndex = 0, ot.test(e);
169
+ }
170
+ function ra(e) {
171
+ return ot.lastIndex = 0, e.replace(ot, function(t, r, a, n) {
172
+ return "&lt;" + r + a + n;
173
+ });
174
+ }
175
+ var kn = /^<([a-zA-Z][a-zA-Z0-9-]*)\s[^>]*>/, bn = /^<[A-Z]/, Tt = ["script", "pre", "style", "textarea"], Vr = new Set(Tt), wn = /<(?:pre|script|style|textarea)\b/i, Ln = /* @__PURE__ */ new Set(["table", "thead", "tbody", "tfoot", "tr", "td", "th"]), va = new Uint8Array(128);
176
+ (function() {
177
+ for (var e = [ne, xe, pe, Te, Ke, Ce, ze, ce, we, Ca, ht, Mr, Pr], t = 0; t < e.length; t++) va[e[t]] = 1;
178
+ })();
179
+ var ta = /([a-zA-Z_][a-zA-Z0-9_-]*)=(?:"([^"]*)"|'([^']*)')/g;
180
+ function Bn(e) {
181
+ return Vr.has(e);
182
+ }
183
+ function Tn(e) {
184
+ return wn.test(e);
185
+ }
186
+ function pa(e, t, r) {
187
+ for (var a = t, n = r; a < n && (e.charCodeAt(a) === B || e.charCodeAt(a) === E); ) a++;
188
+ if (a >= n) return !1;
189
+ e.charCodeAt(a) === Be && a++;
190
+ for (var l = 0; a < n; ) {
191
+ for (; a < n && (e.charCodeAt(a) === B || e.charCodeAt(a) === E); ) a++;
192
+ if (a >= n) break;
193
+ if (e.charCodeAt(a) === Be && l > 0) {
194
+ for (var i = a + 1; i < n && (e.charCodeAt(i) === B || e.charCodeAt(i) === E); ) i++;
195
+ if (i >= n) return !0;
196
+ }
197
+ if (e.charCodeAt(a) === Ne && a++, a >= n || e.charCodeAt(a) !== q) return !1;
198
+ for (; a < n && e.charCodeAt(a) === q; ) a++;
199
+ for (a < n && e.charCodeAt(a) === Ne && a++, l++; a < n && (e.charCodeAt(a) === B || e.charCodeAt(a) === E); ) a++;
200
+ if (a < n) if (e.charCodeAt(a) === Be) a++;
201
+ else return !1;
202
+ }
203
+ return l > 0;
204
+ }
205
+ function sr(e, t) {
206
+ if (e.charCodeAt(t) !== ce) return null;
207
+ let r = t + 1, a = e.length, n = !1;
208
+ e.charCodeAt(r) === be && (r++, n = !0);
209
+ let l = r, i = e.charCodeAt(r);
210
+ if (!(i >= Ae && i <= ge || i >= Y && i <= Z)) return null;
211
+ for (; r < a && (e.charCodeAt(r) >= Ae && e.charCodeAt(r) <= ge || e.charCodeAt(r) >= Y && e.charCodeAt(r) <= Z || e.charCodeAt(r) >= $ && e.charCodeAt(r) <= ee || e.charCodeAt(r) === q); ) r++;
212
+ let o = e.slice(l, r);
213
+ if (!o) return null;
214
+ let c = r;
215
+ for (; r < a && (e.charCodeAt(r) === B || e.charCodeAt(r) === E || e.charCodeAt(r) === D); ) r++;
216
+ let f = e.slice(c, r);
217
+ if (r === c && r < a) {
218
+ var s = e.charCodeAt(r);
219
+ if (s !== U && s !== be) return null;
220
+ }
221
+ let u = r, C = {}, A = !1;
222
+ for (; r < a; ) {
223
+ let I = e.charCodeAt(r);
224
+ if (I === U) {
225
+ let O = e.slice(u, r);
226
+ return { tag: o, attrs: C, selfClosing: !1, end: r + 1, rawAttrs: O, whitespaceBeforeAttrs: f, isClosing: n, hasSpaceBeforeSlash: A };
227
+ }
228
+ if (I === B || I === E || I === D) {
229
+ r++;
230
+ continue;
231
+ }
232
+ if (I === be && r + 1 < a && e.charCodeAt(r + 1) === U) {
233
+ let O = e.slice(u, r);
234
+ return A = r > u && e.charCodeAt(r - 1) === B, { tag: o, attrs: C, selfClosing: !0, end: r + 2, rawAttrs: O, whitespaceBeforeAttrs: f, isClosing: n, hasSpaceBeforeSlash: A };
235
+ }
236
+ var p = r, d = e.charCodeAt(r);
237
+ if (!(d >= Ae && d <= ge || d >= Y && d <= Z || d === pe || d === Ne)) return null;
238
+ for (r++; r < a; ) {
239
+ var h = e.charCodeAt(r);
240
+ if (h >= Ae && h <= ge || h >= Y && h <= Z || h >= $ && h <= ee || h === pe || h === Qe || h === Ne || h === q) r++;
241
+ else break;
242
+ }
243
+ for (var v = e.slice(p, r); r < a && (e.charCodeAt(r) === B || e.charCodeAt(r) === E); ) r++;
244
+ if (e.charCodeAt(r) !== Ke) {
245
+ C[v] = "";
246
+ continue;
247
+ }
248
+ for (r++; r < a && (e.charCodeAt(r) === B || e.charCodeAt(r) === E); ) r++;
249
+ var y = e.charCodeAt(r);
250
+ if (y === Lr || y === wr) {
251
+ r++;
252
+ for (var m = r; r < a && e.charCodeAt(r) !== y; ) r++;
253
+ if (r >= a) return null;
254
+ if (C[v] = e.slice(m, r), r++, r < a) {
255
+ var L = e.charCodeAt(r);
256
+ if (L !== B && L !== E && L !== D && L !== U && L !== be) return null;
257
+ }
258
+ } else if (y === Ir) {
259
+ var w = 1, m = r;
260
+ for (r++; r < a && w > 0; ) {
261
+ var h = e.charCodeAt(r);
262
+ h === Ir ? w++ : h === ut && w--, r++;
263
+ }
264
+ C[v] = e.slice(m, r);
265
+ } else {
266
+ for (var m = r; r < a; ) {
267
+ var g = e.charCodeAt(r);
268
+ if (g === B || g === E || g === U || g === D || g === Lr || g === wr || g === Ke || g === ce || g === ne) break;
269
+ r++;
270
+ }
271
+ if (r === m) return null;
272
+ C[v] = e.slice(m, r);
273
+ }
274
+ }
275
+ return null;
276
+ }
277
+ function ga(e, t, r) {
278
+ for (var a = 0, n = e.length, l = !1; a < n; ) {
279
+ for (var i = e.indexOf(`
280
+ `, a), o = i < 0 ? n : i, c = a, f = 0; c < o && f < 4; ) if (e.charCodeAt(c) === B) f++, c++;
281
+ else if (e.charCodeAt(c) === E) f += 4, c++;
282
+ else break;
283
+ if (c >= o) {
284
+ l = !1, a = i < 0 ? n : i + 1;
285
+ continue;
286
+ }
287
+ if (f < 4) {
288
+ var s = e.charCodeAt(c);
289
+ if (s === ne || s === Te) {
290
+ for (var u = s, C = 0, A = c; A < o && e.charCodeAt(A) === u; ) C++, A++;
291
+ if (C >= 3) {
292
+ l = !1;
293
+ for (var p = i < 0 ? n : i + 1; p < n; ) {
294
+ for (var d = p, h = 0; d < n && h < 4; ) {
295
+ var v = e.charCodeAt(d);
296
+ if (v === B) h++, d++;
297
+ else if (v === E) h += 4, d++;
298
+ else break;
299
+ }
300
+ if (h < 4 && d < n && e.charCodeAt(d) === u) {
301
+ for (var y = 0; d < n && e.charCodeAt(d) === u; ) y++, d++;
302
+ if (y >= C) {
303
+ for (; d < n && (e.charCodeAt(d) === B || e.charCodeAt(d) === E); ) d++;
304
+ if (d >= n || e.charCodeAt(d) === D) {
305
+ a = d >= n ? n : d + 1;
306
+ break;
307
+ }
308
+ }
309
+ }
310
+ for (; p < n && e.charCodeAt(p) !== D; ) p++;
311
+ p < n && p++;
312
+ }
313
+ p >= n && (a = n);
314
+ continue;
315
+ }
316
+ }
317
+ }
318
+ for (var m = c; m < o && e.charCodeAt(m) === U; ) {
319
+ m++, m < o && e.charCodeAt(m) === B && m++;
320
+ for (var L = 0; m < o && L < 4; ) if (e.charCodeAt(m) === B) L++, m++;
321
+ else if (e.charCodeAt(m) === E) L += 4, m++;
322
+ else break;
323
+ if (L >= 4) break;
324
+ l = !1;
325
+ }
326
+ if (!l && f < 4 && m < o && e.charCodeAt(m) === Ce && !(m + 1 < n && e.charCodeAt(m + 1) === ar)) {
327
+ var w = ma(e, m, t);
328
+ if (w) {
329
+ a = w, l = !1;
330
+ continue;
331
+ }
332
+ }
333
+ var g = e.charCodeAt(c);
334
+ if (g === or && f < 4) l = !1;
335
+ else if (f < 4 && (g === q || g === xe || g === pe)) {
336
+ for (var I = c, O = 0; I < o; ) {
337
+ var S = e.charCodeAt(I);
338
+ if (S === g) O++;
339
+ else if (S !== B && S !== E) break;
340
+ I++;
341
+ }
342
+ l = !(O >= 3 && I >= o);
343
+ } else l = !0;
344
+ a = i < 0 ? n : i + 1;
345
+ }
346
+ }
347
+ function ma(e, t, r) {
348
+ let a = e.length;
349
+ if (e.charCodeAt(t) !== Ce) return null;
350
+ let n = t + 1 < a && e.charCodeAt(t + 1) === ar, l = t + 1;
351
+ for (; l < a; ) {
352
+ var i = e.charCodeAt(l);
353
+ if (i === Ge) {
354
+ l++;
355
+ break;
356
+ }
357
+ if (i === Ce) return null;
358
+ i === we && l + 1 < a && l++, l++;
359
+ }
360
+ if (l > a || e.charCodeAt(l - 1) !== Ge) return null;
361
+ let o = e.slice(t + 1, l - 1);
362
+ if (o.length > 999) return null;
363
+ let c = nt(o);
364
+ if (!c || l >= a || e.charCodeAt(l) !== Ne) return null;
365
+ l++;
366
+ let f = !1;
367
+ for (; l < a; ) {
368
+ let N = e.charCodeAt(l);
369
+ if (N === B || N === E) l++;
370
+ else if (N === D && !f) f = !0, l++;
371
+ else break;
372
+ }
373
+ if (n) {
374
+ let N = e.indexOf(`
375
+ `, l), W = N < 0 ? a : N, j = e.slice(l, W).trim();
376
+ return r[c] = { target: j, title: void 0 }, N < 0 ? a : N + 1;
377
+ }
378
+ var s;
379
+ if (l < a && e.charCodeAt(l) === ce) {
380
+ l++;
381
+ for (var u = l; l < a && e.charCodeAt(l) !== U && e.charCodeAt(l) !== D; ) e.charCodeAt(l) === we && l + 1 < a && l++, l++;
382
+ if (l >= a || e.charCodeAt(l) !== U) return null;
383
+ s = e.slice(u, l), l++;
384
+ for (var C = e.indexOf(`
385
+ `, l), A = C < 0 ? a : C, p = l; p < A && (e.charCodeAt(p) === B || e.charCodeAt(p) === E); ) p++;
386
+ if (p < A) {
387
+ if (p === l) return null;
388
+ var d = e.charCodeAt(p);
389
+ if (d !== Lr && d !== wr && d !== Ze) return null;
390
+ }
391
+ } else {
392
+ for (var u = l, h = 0; l < a; ) {
393
+ var i = e.charCodeAt(l);
394
+ if (i === Ze) h++;
395
+ else if (i === $e) {
396
+ if (h === 0) break;
397
+ h--;
398
+ } else {
399
+ if (i === B || i === E || i === D) break;
400
+ i === we && l + 1 < a && l++;
401
+ }
402
+ l++;
403
+ }
404
+ if (s = e.slice(u, l), !s) return null;
405
+ }
406
+ for (; l < a && (e.charCodeAt(l) === B || e.charCodeAt(l) === E); ) l++;
407
+ var v = e.indexOf(`
408
+ `, l), y = v < 0 ? a : v, m, L = !1, w = l, g = l;
409
+ if (l === y && l < a) for (g = l + 1; g < a && (e.charCodeAt(g) === B || e.charCodeAt(g) === E); ) g++;
410
+ if (g < a) {
411
+ var I = e.charCodeAt(g);
412
+ if (I === Lr || I === wr || I === Ze) {
413
+ for (var O = I === Ze ? 41 : I, S = g + 1, T = S; S < a; ) {
414
+ var R = e.charCodeAt(S);
415
+ if (R === O) {
416
+ for (var H = S + 1; H < a && (e.charCodeAt(H) === B || e.charCodeAt(H) === E); ) H++;
417
+ (H >= a || e.charCodeAt(H) === D) && (m = e.slice(T, S), L = !0, w = H < a ? H + 1 : a);
418
+ break;
419
+ }
420
+ if (R === we && S + 1 < a) {
421
+ S += 2;
422
+ continue;
423
+ }
424
+ if (R === D && S + 1 < a && e.charCodeAt(S + 1) === D) break;
425
+ S++;
426
+ }
427
+ if (!L && g === l) return null;
428
+ }
429
+ }
430
+ if (L) return r[c] || (r[c] = { target: zr(s), title: m !== void 0 ? Ct(zr(m)) : m }), w;
431
+ for (; l < y && (e.charCodeAt(l) === B || e.charCodeAt(l) === E); ) l++;
432
+ return l < y ? null : (r[c] || (r[c] = { target: zr(s), title: m }), v < 0 ? a : v + 1);
433
+ }
434
+ var jr = 1, aa = 2, Q = 4, xa = 8, On = 16, tr = 32, gr = 64, K = new Uint8Array(128);
435
+ K[B] = jr, K[E] = jr, K[D] = jr | aa, K[br] = jr | aa, K[or] = tr | Q, K[U] = tr | Q, K[q] = tr | gr | Q, K[Br] = tr | Q, K[xe] = tr | gr | Q, K[pe] = tr | gr | Q, K[ne] = tr | gr | Q, K[Te] = tr | gr | Q, K[ce] = tr | gr | Q, K[Ce] = gr | Q, K[ze] = gr | Q, K[Be] = tr | Q;
436
+ for (let e = $; e <= ee; e++) K[e] = On | tr;
437
+ for (let e = Y; e <= Z; e++) K[e] = xa;
438
+ for (let e = Ae; e <= ge; e++) K[e] = xa;
439
+ K[we] = Q, K[Ge] = Q, K[Ze] = Q, K[$e] = Q, K[Ne] = Q, K[Lr] = Q, K[wr] = Q, K[_t] = Q, K[Ke] = Q, K[rn] = Q, K[lt] = Q, K[ua] = Q, K[Qe] = Q, K[be] = Q, K[Ht] = Q, K[Dr] = Q, K[st] = Q, K[ar] = Q, K[Ir] = Q, K[ut] = Q;
440
+ function na(e) {
441
+ if (e.indexOf("[") < 0 && e.indexOf("]") < 0) return !1;
442
+ for (var t = 0; t < e.length; t++) {
443
+ if (e.charCodeAt(t) === we) {
444
+ t++;
445
+ continue;
446
+ }
447
+ if (e.charCodeAt(t) === Ce || e.charCodeAt(t) === Ge) return !0;
448
+ }
449
+ return !1;
450
+ }
451
+ function nt(e) {
452
+ var t = e.replace(/\s+/g, " ").trim();
453
+ return t.indexOf("ẞ") !== -1 ? t.replace(/\u1E9E/g, "ss").toLowerCase() : t.toLowerCase();
454
+ }
455
+ function jt(e) {
456
+ return e < Gr ? K[e] : e === an ? jr : 0;
457
+ }
458
+ function zr(e) {
459
+ return e.replace(/\\([!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~])/g, "$1");
460
+ }
461
+ function le(e, t) {
462
+ var r = e.indexOf(`
463
+ `, t);
464
+ return r < 0 ? e.length : r;
465
+ }
466
+ function G(e, t) {
467
+ let r = le(e, t);
468
+ return r < e.length ? r + 1 : r;
469
+ }
470
+ function qr(e, t, r) {
471
+ for (; t < r; ) {
472
+ let a = e.charCodeAt(t);
473
+ if (a !== B && a !== E) break;
474
+ t++;
475
+ }
476
+ return t;
477
+ }
478
+ function la(e, t) {
479
+ let r = G(e, t);
480
+ for (; r < e.length; ) {
481
+ let a = le(e, r);
482
+ if (qe(e, r, a)) return r;
483
+ r = G(e, r);
484
+ }
485
+ return e.length;
486
+ }
487
+ function Cr(e, t, r, a) {
488
+ let n = 0;
489
+ for (; t + n < r && e.charCodeAt(t + n) === a; ) n++;
490
+ return n;
491
+ }
492
+ var ae = 0, te = 0;
493
+ function me(e, t, r) {
494
+ for (ae = 0, te = 0; t + te < r; ) {
495
+ let a = e.charCodeAt(t + te);
496
+ if (a === E) ae += 4 - ae % 4;
497
+ else if (a === B) ae++;
498
+ else break;
499
+ te++;
500
+ }
501
+ }
502
+ function qe(e, t, r) {
503
+ return qr(e, t, r) >= r;
504
+ }
505
+ function ya(e, t, r, a) {
506
+ let n = le(e, t);
507
+ if (me(e, t, n), ae > 3) return null;
508
+ let l = t + te;
509
+ if (e.charCodeAt(l) !== or) return null;
510
+ let i = Cr(e, l, n, 35);
511
+ if (i < 1 || i > 6 || (l += i, l < n && e.charCodeAt(l) !== B && e.charCodeAt(l) !== E)) return null;
512
+ l = qr(e, l, n);
513
+ for (var o = n; o > l && e.charCodeAt(o - 1) === B; ) o--;
514
+ for (var c = o; o > l && e.charCodeAt(o - 1) === or; ) o--;
515
+ if (o < c) if (o === l || e.charCodeAt(o - 1) === B) for (; o > l && e.charCodeAt(o - 1) === B; ) o--;
516
+ else o = c;
517
+ let f = e.slice(l, o), s = je(f, 0, f.length, r, a), u = (a?.slugify || ir)(f);
518
+ return { node: { type: x.heading, level: i, children: s, id: u }, end: G(e, n) };
519
+ }
520
+ function yr(e, t) {
521
+ let r = le(e, t);
522
+ if (me(e, t, r), ae > 3) return null;
523
+ let a = t + te, n = e.charCodeAt(a);
524
+ if (n !== q && n !== xe && n !== pe) return null;
525
+ let l = 0;
526
+ for (; a < r; ) {
527
+ let i = e.charCodeAt(a);
528
+ if (i === n) l++;
529
+ else if (i !== B && i !== E) return null;
530
+ a++;
531
+ }
532
+ return l < 3 ? null : { node: { type: x.breakThematic }, end: G(e, r) };
533
+ }
534
+ function En(e, t, r) {
535
+ let a = le(e, t);
536
+ if (me(e, t, a), ae > 3) return null;
537
+ let n = ae, l = t + te, i = e.charCodeAt(l);
538
+ if (i !== ne && i !== Te) return null;
539
+ let o = Cr(e, l, a, i);
540
+ if (o < 3) return null;
541
+ l += o;
542
+ let c = qr(e, l, a), f = a;
543
+ if (i === ne) {
544
+ for (let O = c; O < a; O++) if (e.charCodeAt(O) === ne) return null;
545
+ }
546
+ for (; f > c && (e.charCodeAt(f - 1) === B || e.charCodeAt(f - 1) === E); ) f--;
547
+ let s = e.slice(c, f), u = "", C = "", A = s.indexOf(" ");
548
+ A === -1 ? u = s : (u = s.slice(0, A), C = s.slice(A + 1).trim()), u = zr(u);
549
+ var p = void 0;
550
+ if (C) {
551
+ ta.lastIndex = 0;
552
+ for (var d; (d = ta.exec(C)) !== null; ) p || (p = {}), p[d[1]] = d[2] !== void 0 ? d[2] : d[3];
553
+ }
554
+ let h = G(e, a), v = h, y = e.length;
555
+ for (; v < e.length; ) {
556
+ let O = le(e, v);
557
+ if (me(e, v, O), ae < 4) {
558
+ let S = v + te;
559
+ var m = Cr(e, S, O, i);
560
+ if (m >= o) {
561
+ let T = S + m;
562
+ if (qe(e, T, O)) {
563
+ y = G(e, O);
564
+ break;
565
+ }
566
+ }
567
+ }
568
+ v = G(e, O);
569
+ }
570
+ var L;
571
+ if (n === 0) L = v > h && e.charCodeAt(v - 1) === D ? e.slice(h, v - 1) : e.slice(h, v);
572
+ else {
573
+ L = "";
574
+ for (var w = h; w < v; ) {
575
+ var g = le(e, w);
576
+ me(e, w, g);
577
+ var I = Math.min(te, n);
578
+ L += e.slice(w + I, g) + `
579
+ `, w = G(e, g);
580
+ }
581
+ L.length > 0 && L.charCodeAt(L.length - 1) === D && (L = L.slice(0, -1));
582
+ }
583
+ return { node: { type: x.codeBlock, lang: u || void 0, text: L, infoString: C || void 0, attrs: p }, end: y };
584
+ }
585
+ function Sn(e, t) {
586
+ let r = le(e, t);
587
+ if (me(e, t, r), ae < 4) return null;
588
+ let a = "", n = t;
589
+ for (; n < e.length; ) {
590
+ let A = le(e, n);
591
+ if (me(e, n, A), qe(e, n, A)) {
592
+ for (var l = 0, i = G(e, A); i < e.length; ) {
593
+ var o = le(e, i);
594
+ if (qe(e, i, o)) {
595
+ l++, i = G(e, o);
596
+ continue;
597
+ }
598
+ if (me(e, i, o), ae >= 4) {
599
+ for (var c = 0; c <= l; c++) a += `
600
+ `;
601
+ n = i;
602
+ break;
603
+ }
604
+ break;
605
+ }
606
+ if (n !== i) break;
607
+ continue;
608
+ }
609
+ if (ae < 4) break;
610
+ let p = 0, d = 0;
611
+ var f = 0;
612
+ for (let h = n; h < A && d < 4; h++) {
613
+ if (e.charCodeAt(h) === E) {
614
+ var s = 4 - d % 4;
615
+ d + s > 4 && (f = d + s - 4), d += s;
616
+ } else d++;
617
+ p++;
618
+ }
619
+ var u = "";
620
+ if (f > 0) for (var C = 0; C < f; C++) u += " ";
621
+ u += e.slice(n + p, A), a += u + `
622
+ `, n = G(e, A);
623
+ }
624
+ for (; a.length > 0 && a.charCodeAt(a.length - 1) === D; ) a = a.slice(0, -1);
625
+ for (; a.length > 0 && a.charCodeAt(a.length - 1) === D; ) a = a.slice(0, -1);
626
+ return a ? { node: { type: x.codeBlock, text: a }, end: n } : null;
627
+ }
628
+ function In(e, t, r, a) {
629
+ let n = le(e, t);
630
+ if (me(e, t, n), ae > 3) return null;
631
+ let l = t + te;
632
+ if (e.charCodeAt(l) !== U) return null;
633
+ let i = "", o = t, c, f = !1, s = !1, u = !1;
634
+ for (; o < e.length; ) {
635
+ let b = le(e, o);
636
+ me(e, o, b);
637
+ let J = o + te;
638
+ if (e.charCodeAt(J) === U) {
639
+ let X = J + 1;
640
+ var C = ae + 1, A = !1;
641
+ if (X < b) {
642
+ var p = e.charCodeAt(X);
643
+ p === B ? (X++, C++, A = !0) : p === E && (A = !0);
644
+ }
645
+ for (var d = "", h = !1, v = X; v < b; v++) if (e.charCodeAt(v) === E) {
646
+ h = !0;
647
+ break;
648
+ }
649
+ if (h) {
650
+ var y = C;
651
+ if (A && X < b && e.charCodeAt(X) === E) {
652
+ for (var m = 4 - y % 4, L = 0; L < m - 1; L++) d += " ";
653
+ y += m, X++;
654
+ }
655
+ for (var w = X; w < b; w++) if (e.charCodeAt(w) === E) {
656
+ for (var g = 4 - y % 4, I = 0; I < g; I++) d += " ";
657
+ y += g;
658
+ } else d += e[w], y++;
659
+ } else d = e.slice(X, b);
660
+ if (!i && !c) {
661
+ let _ = d.match(/^\[!([A-Za-z]+)\]\s*$/);
662
+ if (_) {
663
+ c = _[1].toUpperCase(), o = G(e, b);
664
+ continue;
665
+ }
666
+ }
667
+ i += d + `
668
+ `;
669
+ var O = d.trimStart();
670
+ O.startsWith("```") || O.startsWith("~~~") ? u = !u : d.startsWith(" ") || d.startsWith(" ") ? u = !0 : O.length > 0 && !u && (u = !1), s = O.length > 0, o = G(e, b);
671
+ } else if (i && !qe(e, o, b) && s) {
672
+ if (ae < 4) {
673
+ var S = o + te, T = S < b ? e.charCodeAt(S) : 0;
674
+ if (T === or || T === U || T === ne || T === Te || T === ce || (T === q || T === xe || T === pe) && yr(e, o) || (T === q || T === xe || T === Br) && S + 1 < b && (e.charCodeAt(S + 1) === B || e.charCodeAt(S + 1) === E)) break;
675
+ if (T >= $ && T <= ee) {
676
+ for (var R = S; R < b && e.charCodeAt(R) >= $ && e.charCodeAt(R) <= ee; ) R++;
677
+ if (R < b && (e.charCodeAt(R) === Qe || e.charCodeAt(R) === $e)) break;
678
+ }
679
+ }
680
+ if (u) break;
681
+ i += e.slice(o, b) + `
682
+ `, f = !0, o = G(e, b);
683
+ } else break;
684
+ }
685
+ if (!i && !c) return null;
686
+ var { inBlockQuote: H, f: N } = r;
687
+ r.inBlockQuote = !0, f && (r.f = !0);
688
+ let W = kr(i || "", r, a);
689
+ r.inBlockQuote = H, r.f = N;
690
+ let j = { type: x.blockQuote, children: W };
691
+ return c && (j.alert = c), { node: j, end: o };
692
+ }
693
+ function ka(e, t, r) {
694
+ for (var a = 0, n = t; n < r; n++) e.charCodeAt(n) === E ? a += 4 - a % 4 : a++;
695
+ return a;
696
+ }
697
+ function mr(e, t, r) {
698
+ if (me(e, t, r), ae > 3) return null;
699
+ var a = t + te;
700
+ if (a >= r) return null;
701
+ var n = e.charCodeAt(a), l = ae, i = a;
702
+ if (n === q || n === xe || n === Br) {
703
+ if (i = a + 1, i < r && e.charCodeAt(i) !== B && e.charCodeAt(i) !== E && e.charCodeAt(i) !== D) return null;
704
+ } else if (n >= $ && n <= ee) {
705
+ for (var o = a; o < r && o - a < 9; ) {
706
+ var c = e.charCodeAt(o);
707
+ if (c < $ || c > ee) break;
708
+ o++;
709
+ }
710
+ if (o > a && o < r) {
711
+ var f = e.charCodeAt(o);
712
+ if (f === Qe || f === $e) {
713
+ if (i = o + 1, i < r && e.charCodeAt(i) !== B && e.charCodeAt(i) !== E && e.charCodeAt(i) !== D) return null;
714
+ } else return null;
715
+ } else return null;
716
+ } else return null;
717
+ var s = i, u = ka(e, t, i), C = 0, A = s, p = u;
718
+ if (s >= r) return { ordered: n >= $ && n <= ee, marker: n >= $ && n <= ee ? e[o] : e[a], start: n >= $ && n <= ee ? parseInt(e.slice(a, o), 10) : void 0, contentStart: s, contentCol: u + 1, markerCol: l, isEmpty: !0 };
719
+ for (; A < r && (e.charCodeAt(A) === B || e.charCodeAt(A) === E); ) {
720
+ if (e.charCodeAt(A) === E) {
721
+ var d = 4 - p % 4;
722
+ p += d;
723
+ } else p++;
724
+ A++, C++;
725
+ }
726
+ var h = A >= r, v = p - u;
727
+ return h || v > 4 ? (p = u + 1, A = s + 1, C = 1) : C === 0 && (p = u + 1, A = s, C = 1), { ordered: n >= $ && n <= ee, marker: n >= $ && n <= ee ? e[o] : e[a], start: n >= $ && n <= ee ? parseInt(e.slice(a, o), 10) : void 0, contentStart: A, contentCol: p, markerCol: l, isEmpty: h };
728
+ }
729
+ var ct = 0;
730
+ function Rn(e, t, r, a) {
731
+ var n = 0, l = t;
732
+ for (ct = 0; l < r && n < a; ) {
733
+ var i = e.charCodeAt(l);
734
+ if (i === E) {
735
+ var o = 4 - n % 4;
736
+ if (n + o > a) {
737
+ ct = n + o - a, l++, n = a;
738
+ break;
739
+ }
740
+ n += o;
741
+ } else if (i === B) n++;
742
+ else break;
743
+ l++;
744
+ }
745
+ return l;
746
+ }
747
+ function ia(e, t, r, a) {
748
+ var n = le(e, t), l = mr(e, t, n);
749
+ if (!l) return null;
750
+ var i = [], o = t, c = l.contentCol, f = "", s = l.isEmpty, u = !1, C = !1;
751
+ if (!l.isEmpty) {
752
+ for (var A = !1, p = l.contentStart; p < n; p++) if (e.charCodeAt(p) === E) {
753
+ A = !0;
754
+ break;
755
+ }
756
+ if (A) {
757
+ var d = "", h = ka(e, t, l.contentStart), v = h - l.contentCol;
758
+ if (v > 0) for (var y = 0; y < v; y++) d += " ";
759
+ for (var m = l.contentStart; m < n; m++) if (e.charCodeAt(m) === E) {
760
+ for (var L = 4 - h % 4, w = 0; w < L; w++) d += " ";
761
+ h += L;
762
+ } else d += e[m], h++;
763
+ f = d + `
764
+ `;
765
+ } else f = e.slice(l.contentStart, n) + `
766
+ `;
767
+ }
768
+ for (o = G(e, n); o < e.length; ) {
769
+ var g = le(e, o);
770
+ me(e, o, g);
771
+ var I = e.charCodeAt(o + te);
772
+ if (ae < c && (I === q || I === xe || I === pe) && ae <= 3 && yr(e, o)) break;
773
+ var O = mr(e, o, g);
774
+ if (O && O.ordered === l.ordered && O.marker === l.marker && O.markerCol < c) {
775
+ i.push({ contentCol: c, raw: f, hasBlankAfter: u, isEmpty: s }), u && (C = !0), c = O.contentCol, s = O.isEmpty, u = !1, f = O.isEmpty ? "" : e.slice(O.contentStart, g) + `
776
+ `, o = G(e, g);
777
+ continue;
778
+ }
779
+ if (qe(e, o, g)) {
780
+ f += `
781
+ `, o = G(e, g);
782
+ for (var S = !1, T = 0; T < f.length; T++) {
783
+ var R = f.charCodeAt(T);
784
+ if (R !== D && R !== br && R !== B && R !== E) {
785
+ S = !0;
786
+ break;
787
+ }
788
+ }
789
+ if (s && !S) if (o < e.length) {
790
+ var H = le(e, o), N = mr(e, o, H);
791
+ if (!N || N.ordered !== l.ordered || N.marker !== l.marker) break;
792
+ u = !0;
793
+ } else break;
794
+ if (o < e.length) {
795
+ var W = le(e, o);
796
+ me(e, o, W);
797
+ var j = e.charCodeAt(o + te);
798
+ if ((j === q || j === xe || j === pe) && ae <= 3 && yr(e, o)) break;
799
+ var b = mr(e, o, W);
800
+ if (b && b.ordered === l.ordered && b.marker === l.marker && b.markerCol < c) {
801
+ u = !0;
802
+ continue;
803
+ }
804
+ if (!qe(e, o, W) && ae < c) break;
805
+ }
806
+ continue;
807
+ }
808
+ if (ae >= c) {
809
+ var J = Rn(e, o, g, c);
810
+ if (ct > 0) {
811
+ for (var X = "", _ = c, ie = 0; ie < ct; ie++) X += " ", _++;
812
+ for (var fe = J; fe < g; fe++) if (e.charCodeAt(fe) === E) {
813
+ for (var Le = 4 - _ % 4, re = 0; re < Le; re++) X += " ";
814
+ _ += Le;
815
+ } else X += e[fe], _++;
816
+ f += X + `
817
+ `;
818
+ } else f += e.slice(J, g) + `
819
+ `;
820
+ o = G(e, g);
821
+ continue;
822
+ }
823
+ for (var he = !1, P = 0; P < f.length; P++) {
824
+ var V = f.charCodeAt(P);
825
+ if (V !== D && V !== br && V !== B && V !== E) {
826
+ he = !0;
827
+ break;
828
+ }
829
+ }
830
+ if (!u && he && !s) {
831
+ var Ee = o + te, z = e.charCodeAt(Ee), Pe = z === or || z === U || z === ce || z === ne || z === Te || (z === q || z === xe || z === pe || z === Br) && (yr(e, o) !== null || mr(e, o, g) !== null) || z >= $ && z <= ee && mr(e, o, g) !== null;
832
+ if (!Pe) {
833
+ f += "" + e.slice(Ee, g) + `
834
+ `, o = G(e, g);
835
+ continue;
836
+ }
837
+ }
838
+ break;
839
+ }
840
+ if (i.push({ contentCol: c, raw: f, hasBlankAfter: u, isEmpty: s }), i.length === 0) return null;
841
+ var ye = C;
842
+ if (!ye) for (var ve = 0; ve < i.length; ve++) {
843
+ if (i[ve].hasBlankAfter && ve < i.length - 1) {
844
+ ye = !0;
845
+ break;
846
+ }
847
+ if (!i[ve].isEmpty) {
848
+ for (var M = i[ve].raw, k = M.length, se = 0, F = !1, Re = !1, de = !1, ue = !1, De = 0, We = 0, _e = -1; se < k; ) {
849
+ var oe = M.indexOf(`
850
+ `, se);
851
+ if (oe < 0 && (oe = k), ue) {
852
+ me(M, se, oe);
853
+ for (var Rr = M.slice(se + te, oe), Ye = 0; Ye < Rr.length && Rr.charCodeAt(Ye) === De; ) Ye++;
854
+ Ye >= We && Rr.slice(Ye).trim() === "" && (ue = !1), se = oe < k ? oe + 1 : k;
855
+ continue;
856
+ }
857
+ if (qe(M, se, oe)) {
858
+ _e >= 0 ? de = !0 : F && (Re = !0), se = oe < k ? oe + 1 : k;
859
+ continue;
860
+ }
861
+ if (me(M, se, oe), _e >= 0) {
862
+ if (ae >= _e) {
863
+ se = oe < k ? oe + 1 : k;
864
+ continue;
865
+ }
866
+ var Tr = mr(M, se, oe);
867
+ if (Tr && Tr.markerCol < _e && Tr.contentCol <= _e) {
868
+ se = oe < k ? oe + 1 : k;
869
+ continue;
870
+ }
871
+ if (Tr) {
872
+ se = oe < k ? oe + 1 : k;
873
+ continue;
874
+ }
875
+ _e = -1, de && (Re = !0, de = !1);
876
+ }
877
+ var _r = M.slice(se + te, oe), Ar = _r.charCodeAt(0);
878
+ if ((Ar === ne || Ar === Te) && ae <= 3) {
879
+ for (var er = 0; er < _r.length && _r.charCodeAt(er) === Ar; ) er++;
880
+ if (er >= 3) {
881
+ if (Re && F) {
882
+ ye = !0;
883
+ break;
884
+ }
885
+ ue = !0, De = Ar, We = er, F = !0, se = oe < k ? oe + 1 : k;
886
+ continue;
887
+ }
888
+ }
889
+ var Zr = ae <= 3 ? mr(M, se, oe) : null;
890
+ if (Zr && F) {
891
+ if (Re) {
892
+ ye = !0;
893
+ break;
894
+ }
895
+ _e = Zr.contentCol, de = !1, se = oe < k ? oe + 1 : k, F = !0;
896
+ continue;
897
+ }
898
+ if (Re) {
899
+ ye = !0;
900
+ break;
901
+ }
902
+ F = !0, se = oe < k ? oe + 1 : k;
903
+ }
904
+ if (ye) break;
905
+ }
906
+ }
907
+ for (var rr = [], nr = 0; nr < i.length; nr++) {
908
+ for (var vr = i[nr], Ve = vr.raw, Je = Ve.length; Je > 0 && Ve.charCodeAt(Je - 1) === D; ) Je--;
909
+ var Se = Je < Ve.length ? Ve.slice(0, Je) : Ve, Hr = null;
910
+ if (Se.length >= 3 && Se.charCodeAt(0) === Ce) {
911
+ var cr = Se[1];
912
+ (cr === " " || cr === "x" || cr === "X") && Se.charCodeAt(2) === Ge && (Hr = { type: x.gfmTask, completed: cr === "x" || cr === "X" }, Se = Se.slice(3));
913
+ }
914
+ var ke;
915
+ if (vr.isEmpty && Se.trim() === "") ke = [];
916
+ else if (ye) {
917
+ var vt = r.inList;
918
+ r.inList = !0, ke = kr(Se, r, a), r.inList = vt;
919
+ } else {
920
+ var pt = r.inList;
921
+ if (r.inList = !0, ke = kr(Se, r, a), r.inList = pt, ke.length === 1 && ke[0].type === x.paragraph) ke = ke[0].children;
922
+ else {
923
+ for (var fr = [], Xe = 0; Xe < ke.length; Xe++) if (ke[Xe].type === x.paragraph) for (var lr = ke[Xe].children, Wr = 0; Wr < lr.length; Wr++) fr.push(lr[Wr]);
924
+ else fr.push(ke[Xe]);
925
+ ke = fr;
926
+ }
927
+ }
928
+ Hr ? rr.push([Hr, { type: x.text, text: " " }, ...ke]) : rr.push(ke);
929
+ }
930
+ return { node: { type: l.ordered ? x.orderedList : x.unorderedList, start: l.ordered ? l.start : void 0, items: rr }, end: o };
931
+ }
932
+ var ft = /* @__PURE__ */ new Set(["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", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hr", "html", "iframe", "legend", "li", "link", "main", "menu", "menuitem", "nav", "noframes", "ol", "optgroup", "option", "p", "param", "search", "section", "summary", "table", "tbody", "td", "tfoot", "th", "thead", "title", "tr", "track", "ul"]);
933
+ function dr(e, t, r) {
934
+ let a = {};
935
+ for (let [i, o] of Object.entries(e)) {
936
+ let c = i, f = i.toLowerCase();
937
+ if (f === "style" && typeof o == "string") {
938
+ let s = {}, u = [], C = 0, A = 0;
939
+ for (let d = 0; d < o.length; d++) {
940
+ let h = o.charCodeAt(d);
941
+ h === Ze ? C++ : h === $e ? C-- : h === Ht && C === 0 && (u.push(o.slice(A, d)), A = d + 1);
942
+ }
943
+ A < o.length && u.push(o.slice(A));
944
+ let p = !1;
945
+ u.forEach((d) => {
946
+ let h = d.indexOf(":");
947
+ if (h === -1) return;
948
+ let v = d.slice(0, h).trim(), y = d.slice(h + 1).trim();
949
+ if (v && y) {
950
+ if (/url\s*\(\s*(javascript|vbscript|data:(?!image\/))/i.test(y)) {
951
+ p = !0;
952
+ return;
953
+ }
954
+ let m = v.indexOf("-") !== -1 ? v.replace(/-([a-z])/g, (L, w) => w.toUpperCase()) : v;
955
+ s[m] = y;
956
+ }
957
+ }), !p && Object.keys(s).length > 0 && (a[c] = s);
958
+ } else if ((f === "href" || f === "src") && r?.sanitizer) {
959
+ let s = r.sanitizer(o, t, f);
960
+ s !== null && (a[c] = s);
961
+ } else if (o === "") a[c] = !0;
962
+ else if (o.length >= 2 && o.charCodeAt(0) === Ir && o.charCodeAt(o.length - 1) === ut) {
963
+ var n = o.slice(1, -1);
964
+ if (n.length > 0) {
965
+ var l = n.charCodeAt(0);
966
+ if (l === Ce || l === Ir) try {
967
+ a[c] = JSON.parse(n);
968
+ continue;
969
+ } catch {
970
+ }
971
+ }
972
+ if (n === "true") {
973
+ a[c] = !0;
974
+ continue;
975
+ }
976
+ if (n === "false") {
977
+ a[c] = !1;
978
+ continue;
979
+ }
980
+ if (r?.evalUnserializableExpressions) try {
981
+ a[c] = (0, eval)("(" + n + ")");
982
+ continue;
983
+ } catch {
984
+ }
985
+ a[c] = n;
986
+ } else a[c] = o;
987
+ }
988
+ return a;
989
+ }
990
+ function hr(e, t, r) {
991
+ let a = t.length;
992
+ var n = t.charCodeAt(0);
993
+ n >= Y && n <= Z && (n += ur);
994
+ for (let i = r; i <= e.length - a; i++) {
995
+ var l = e.charCodeAt(i);
996
+ if (l >= Y && l <= Z && (l += ur), l !== n) continue;
997
+ let o = !0;
998
+ for (let c = 1; c < a; c++) {
999
+ let f = e.charCodeAt(i + c), s = t.charCodeAt(c);
1000
+ if (f >= Y && f <= Z && (f += ur), s >= Y && s <= Z && (s += ur), f !== s) {
1001
+ o = !1;
1002
+ break;
1003
+ }
1004
+ }
1005
+ if (o) return i;
1006
+ }
1007
+ return -1;
1008
+ }
1009
+ function _n(e, t, r) {
1010
+ let a = t.length;
1011
+ var n = t.charCodeAt(0);
1012
+ n >= Y && n <= Z && (n += ur);
1013
+ for (let i = Math.min(r, e.length - a); i >= 0; i--) {
1014
+ var l = e.charCodeAt(i);
1015
+ if (l >= Y && l <= Z && (l += ur), l !== n) continue;
1016
+ let o = !0;
1017
+ for (let c = 1; c < a; c++) {
1018
+ let f = e.charCodeAt(i + c), s = t.charCodeAt(c);
1019
+ if (f >= Y && f <= Z && (f += ur), s >= Y && s <= Z && (s += ur), f !== s) {
1020
+ o = !1;
1021
+ break;
1022
+ }
1023
+ }
1024
+ if (o) return i;
1025
+ }
1026
+ return -1;
1027
+ }
1028
+ var Ot = -1;
1029
+ function ba(e, t, r) {
1030
+ let a = r.toLowerCase(), n = "<" + a, l = "</" + a, i = 1, o = t, c = e.length;
1031
+ for (Ot = -1; o < c && i > 0; ) {
1032
+ let u = hr(e, n, o), C = hr(e, l, o);
1033
+ if (C === -1) return -1;
1034
+ if (u !== -1 && u < C) {
1035
+ let A = sr(e, u);
1036
+ A ? (A.tag.toLowerCase() === a && !A.isClosing && !A.selfClosing && !Yr(A.tag) && i++, o = A.end) : o = u + 1;
1037
+ } else {
1038
+ var f = C + l.length, s = f < c ? e.charCodeAt(f) : 62;
1039
+ if ((s === U || s === B || s === E || s === D) && (i--, i === 0)) {
1040
+ Ot = C;
1041
+ let A = C + l.length;
1042
+ for (; A < c && e.charCodeAt(A) !== U; ) A++;
1043
+ return A + 1;
1044
+ }
1045
+ o = C + 1;
1046
+ }
1047
+ }
1048
+ return -1;
1049
+ }
1050
+ function wa(e, t, r, a) {
1051
+ if (a.ignoreHTMLBlocks || a.disableParsingRawHTML) return null;
1052
+ var n = le(e, t);
1053
+ if (me(e, t, n), ae > 3 && !r.inHTML) return null;
1054
+ var l = t + te;
1055
+ if (e.charCodeAt(l) !== ce) return null;
1056
+ var i = e.indexOf(">", l + 1);
1057
+ if (i !== -1 && i < n) {
1058
+ var o = e.slice(l + 1, i);
1059
+ if (/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(o) || /^[^\s@]+@[^\s@]+$/.test(o)) return null;
1060
+ }
1061
+ var c = Hn(e, l);
1062
+ if (c >= 1 && c <= 5) {
1063
+ var f = e.length;
1064
+ if (c === 1) {
1065
+ for (var s = e.length, u = 0; u < Tt.length; u++) {
1066
+ var C = hr(e, "</" + Tt[u] + ">", l);
1067
+ C >= 0 && C < s && (s = C);
1068
+ }
1069
+ if (s < e.length) {
1070
+ var A = e.indexOf(">", s);
1071
+ f = A >= 0 ? G(e, A + 1) : e.length;
1072
+ }
1073
+ } else {
1074
+ var p = c === 2 ? "-->" : c === 3 ? "?>" : c === 4 ? ">" : "]]>", d = e.indexOf(p, l);
1075
+ d >= 0 && (f = G(e, d + p.length));
1076
+ }
1077
+ var h = e.slice(l, f);
1078
+ if (c >= 2) return { node: { type: x.htmlComment, text: h, raw: !0, endPos: f }, end: f };
1079
+ var v = "div", y = h.match(/^<\/?([a-zA-Z][a-zA-Z0-9-]*)/);
1080
+ y && (v = y[1]);
1081
+ var m = sr(e, l), L = {}, w;
1082
+ m && !m.isClosing && (L = dr(m.attrs, v, a), w = m.whitespaceBeforeAttrs + m.rawAttrs);
1083
+ var g = [], I = v.toLowerCase(), O = "</" + I, S = hr(h, O, 0), T = h, R = "";
1084
+ if (m && m.isClosing) for (T = h.slice(m.end - l); T.length > 0 && T.charCodeAt(T.length - 1) === D; ) T = T.slice(0, -1);
1085
+ else if (m && !m.isClosing) {
1086
+ var H = m.end - l;
1087
+ if (S !== -1) for (T = h.slice(H), T.charCodeAt(0) === D && (T = T.slice(1)); T.length > 0 && T.charCodeAt(T.length - 1) === D; ) T = T.slice(0, -1);
1088
+ else for (T = h; T.length > 0 && T.charCodeAt(T.length - 1) === D; ) T = T.slice(0, -1);
1089
+ if (S !== -1) {
1090
+ var N = h.slice(H, S);
1091
+ R = N.trim();
1092
+ }
1093
+ }
1094
+ var W = m ? m.isClosing : !1;
1095
+ return { node: { type: x.htmlBlock, tag: v, attrs: L, e: w, children: g, a: T, text: R, c: !0, b: W, endPos: f, canInterruptParagraph: !0 }, end: f };
1096
+ }
1097
+ if (c === 6 || c === 7) {
1098
+ var j = la(e, t), b = j < e.length ? j : e.length, J = e.slice(l, b), X = j < e.length ? G(e, j) : e.length, _ = sr(e, l);
1099
+ if (_) {
1100
+ var ie = _.tag, fe = ie.toLowerCase(), Le = _.isClosing;
1101
+ if (Le) {
1102
+ var re = e.slice(_.end, b);
1103
+ return { node: { type: x.htmlBlock, tag: ie, attrs: {}, children: [], a: re, text: re, c: !0, b: !0, endPos: b, canInterruptParagraph: c === 6 }, end: X };
1104
+ }
1105
+ if (_.selfClosing || Yr(ie)) return { node: { type: x.htmlBlock, tag: ie, attrs: dr(_.attrs, ie, a), e: _.whitespaceBeforeAttrs + _.rawAttrs, children: [], a: "", text: "", c: !1, b: !1, endPos: _.end, canInterruptParagraph: c === 6 }, end: G(e, _.end) };
1106
+ var he = r.d || 0, P = e.slice(l, b), V = -1, Ee = -1;
1107
+ if (he < 10) {
1108
+ for (var z = "</" + fe, Pe = _.end - l, ye = 1, ve = Pe; ve < P.length && ye > 0; ) {
1109
+ var M = hr(P, "<" + fe, ve), k = hr(P, z, ve);
1110
+ if (k === -1) break;
1111
+ if (M !== -1 && M < k) {
1112
+ var se = M + fe.length + 1;
1113
+ if (se < P.length) {
1114
+ var F = P.charCodeAt(se);
1115
+ (F === B || F === E || F === D || F === U || F === be) && ye++;
1116
+ }
1117
+ ve = M + 1;
1118
+ } else {
1119
+ var Re = k + z.length;
1120
+ if (Re < P.length) {
1121
+ var de = P.charCodeAt(Re);
1122
+ if ((de === U || de === B || de === E || de === D) && (ye--, ye === 0)) {
1123
+ V = k;
1124
+ for (var ue = Re; ue < P.length && P.charCodeAt(ue) !== U; ) ue++;
1125
+ Ee = ue + 1;
1126
+ break;
1127
+ }
1128
+ } else if (ye--, ye === 0) {
1129
+ V = k, Ee = P.length;
1130
+ break;
1131
+ }
1132
+ ve = k + 1;
1133
+ }
1134
+ }
1135
+ var De = !1;
1136
+ if (V === -1 && c === 6 && !_.isClosing && !Ln.has(fe)) {
1137
+ var We = e.slice(_.end), _e = hr(We, z, 0);
1138
+ if (_e !== -1) {
1139
+ var oe = We.slice(0, _e);
1140
+ if (oe.indexOf(`
1141
+
1142
+ `) !== -1) {
1143
+ for (var Rr = _.end + _e, Ye = Rr + z.length; Ye < e.length && e.charCodeAt(Ye) !== U; ) Ye++;
1144
+ if (Ye < e.length && e.charCodeAt(Ye) === U) {
1145
+ var Tr = Ye + 1, _r = le(e, Tr);
1146
+ b = _r, X = G(e, _r), P = e.slice(l, b), J = e.slice(l, b), V = Rr - l, Ee = Tr - l, De = !0;
1147
+ }
1148
+ }
1149
+ }
1150
+ }
1151
+ }
1152
+ var Ar = _.rawAttrs.indexOf(`
1153
+ `) !== -1 || _.whitespaceBeforeAttrs.indexOf(`
1154
+ `) !== -1, er = !1;
1155
+ if (V !== -1) {
1156
+ var Zr = P.slice(Ee).trim();
1157
+ er = Zr.length === 0;
1158
+ }
1159
+ var rr = !1, nr = b, vr = X;
1160
+ if (V !== -1) {
1161
+ var Ve = l + Ee, Je = le(e, Ve - 1);
1162
+ if (Ve < Je) {
1163
+ for (var Se = Ve; Se < Je && (e.charCodeAt(Se) === B || e.charCodeAt(Se) === E); ) Se++;
1164
+ if (Se < Je && e.charCodeAt(Se) === ce) {
1165
+ var Hr = sr(e, Se);
1166
+ Hr && !Hr.isClosing && (rr = !0, nr = Ve, vr = Ve, er = !0);
1167
+ }
1168
+ }
1169
+ if (!rr) {
1170
+ var cr = G(e, Je);
1171
+ if (cr < b) {
1172
+ for (var ke = cr; ke < b && (e.charCodeAt(ke) === B || e.charCodeAt(ke) === E); ) ke++;
1173
+ if (ke < b && e.charCodeAt(ke) === ce) {
1174
+ var vt = sr(e, ke);
1175
+ vt && (rr = !0, nr = Je, vr = cr, er = !0);
1176
+ }
1177
+ }
1178
+ }
1179
+ if (!rr && r.inHTML) {
1180
+ rr = !0, nr = Je, vr = G(e, Je);
1181
+ var pt = e.slice(Ve, Je).trim();
1182
+ er = pt.length === 0;
1183
+ }
1184
+ }
1185
+ var fr = [], Xe = "";
1186
+ if (V !== -1) {
1187
+ Xe = P.slice(_.end - l, V);
1188
+ var lr = Xe.trim();
1189
+ if (lr) {
1190
+ var { inline: Wr, inHTML: Ta, d: Oa } = r;
1191
+ r.inHTML = !0, r.d = he + 1;
1192
+ var Ea = fe === "p";
1193
+ if (Ea) r.inline = !0, fr = je(lr, 0, lr.length, r, a);
1194
+ else {
1195
+ var Sa = Xe.indexOf(`
1196
+
1197
+ `) !== -1, Ia = /^(\s{0,3}#[#\s]|\s{0,3}[-*+]\s|\s{0,3}\d+\.\s|\s{0,3}>\s|\s{0,3}```)/m.test(lr), zt = /^<([a-z][^ >/\n\r]*) ?([^>]*?)>/im.test(lr), Ra = Sa || Ia || r.inHTML && zt;
1198
+ Ra || zt ? (r.inline = !1, fr = kr(Xe, r, a)) : (r.inline = !0, fr = je(lr, 0, lr.length, r, a));
1199
+ }
1200
+ r.inline = Wr, r.inHTML = Ta, r.d = Oa;
1201
+ }
1202
+ }
1203
+ var Pt = !1;
1204
+ if (c === 6 && V !== -1 && !r.inHTML && !Ar) {
1205
+ var gt = Xe, _a = /<[a-zA-Z][^>]*>/.test(gt), Ha = /\n\n/.test(gt) || /^(\s{0,3}#[#\s]|\s{0,3}[-*+]\s|\s{0,3}\d+\.\s|\s{0,3}>\s|\s{0,3}```)/m.test(gt);
1206
+ _a && !Ha && (Pt = !0);
1207
+ }
1208
+ var Na = r.inHTML || c === 7 || Ar || !er || Pt;
1209
+ if (Na) {
1210
+ var Ue;
1211
+ if (V !== -1 && rr) {
1212
+ var Dt = !1;
1213
+ if (r.inHTML && Ee < P.length) {
1214
+ for (var Qr = Ee; Qr < P.length && P.charCodeAt(Qr) !== D; ) Qr++;
1215
+ var mt = P.slice(Ee, Qr).trim();
1216
+ Dt = mt.length > 1 && mt.charCodeAt(0) === ce && mt.charCodeAt(1) !== be;
1217
+ }
1218
+ Ue = Dt ? P.slice(_.end - l) : Xe;
1219
+ } else (c === 7 || r.inHTML) && V !== -1 ? (Ue = P.slice(_.end - l), Ue.charCodeAt(0) === D && (Ue = Ue.slice(1))) : rr ? Ue = e.slice(l, nr) : Ar ? Ue = J : (Ue = P.slice(_.end - l), Ue.charCodeAt(0) === D && (Ue = Ue.slice(1)));
1220
+ return { node: { type: x.htmlBlock, tag: ie, attrs: dr(_.attrs, ie, a), e: _.whitespaceBeforeAttrs + _.rawAttrs, children: fr, a: Ue, text: Ue, c: !0, b: !1, endPos: nr, canInterruptParagraph: c === 6 }, end: vr };
1221
+ }
1222
+ return { node: { type: x.htmlBlock, tag: ie, attrs: dr(_.attrs, ie, a), e: _.whitespaceBeforeAttrs + _.rawAttrs, children: fr, a: De ? "" : Xe, text: Xe, c: !1, b: !1, endPos: nr, canInterruptParagraph: c === 6 }, end: vr };
1223
+ }
1224
+ var $r = J.match(/^<(\/?)([a-zA-Z][a-zA-Z0-9-]*)/), ja = $r ? $r[2] : "div", Wt = $r ? $r[1] === "/" : !1, xt = J;
1225
+ if (Wt) {
1226
+ var Jt = J.indexOf(">");
1227
+ Jt !== -1 && (xt = J.slice(Jt + 1));
1228
+ }
1229
+ return { node: { type: x.htmlBlock, tag: ja, attrs: {}, children: [], a: xt, text: xt, c: !0, b: Wt, endPos: b, canInterruptParagraph: c === 6 }, end: X };
1230
+ }
1231
+ var Ie = sr(e, l);
1232
+ if (!Ie) return null;
1233
+ var pr = Ie.tag, yt = pr.toLowerCase(), Xt = pr.charCodeAt(0), et = Xt >= Y && Xt <= Z;
1234
+ if (!et && !ft.has(yt) && !Vr.has(yt) && !yt.includes("-")) return null;
1235
+ if (Ie.isClosing) return { node: { type: x.htmlSelfClosing, tag: pr, attrs: {}, endPos: Ie.end, b: !0, a: e.slice(l, Ie.end) }, end: Ie.end };
1236
+ var Or = ba(e, Ie.end, pr), Jr = [];
1237
+ if (Or !== -1) {
1238
+ var Ma = Ot, rt = e.slice(Ie.end, Ma), Xr = rt.trim();
1239
+ if (Xr) {
1240
+ var za = rt.indexOf(`
1241
+
1242
+ `) !== -1, Pa = /^(\s{0,3}#[#\s]|\s{0,3}[-*+]\s|\s{0,3}\d+\.\s|\s{0,3}>\s|\s{0,3}```)/m.test(Xr), Da = /^<([a-z][^ >/\n\r]*) ?([^>]*?)>/im.test(Xr), Wa = r.inline, Ja = r.inHTML, Xa = r.d;
1243
+ r.inHTML = !0, r.d = (r.d || 0) + 1, za || Pa || Da ? (r.inline = !1, Jr = kr(rt, r, a)) : (r.inline = !0, Jr = je(Xr, 0, Xr.length, r, a)), r.inline = Wa, r.inHTML = Ja, r.d = Xa;
1244
+ }
1245
+ var Ua = le(e, Or), Fa = e.slice(Or, Ua).trim(), kt = Fa ? Or : G(e, Or), Ut = et ? e.slice(l, Or) : e.slice(l, kt), Ka = et ? Or : kt;
1246
+ return { node: { type: x.htmlBlock, tag: pr, attrs: dr(Ie.attrs, pr, a), e: Ie.whitespaceBeforeAttrs + Ie.rawAttrs, children: Jr, a: Ut, text: et ? rt : Ut, c: !0, b: !1, endPos: Ka, canInterruptParagraph: !1 }, end: kt };
1247
+ }
1248
+ var Nr = la(e, Ie.end), qa = Nr < e.length ? G(e, Nr) : Nr, bt = e.slice(Ie.end, Nr);
1249
+ if (bt.trim()) {
1250
+ var { inline: Ga, inHTML: Ya, d: Va } = r;
1251
+ r.inline = !1, r.inHTML = !0, r.d = (r.d || 0) + 1, Jr = kr(bt, r, a), r.inline = Ga, r.inHTML = Ya, r.d = Va;
1252
+ }
1253
+ var Za = e.slice(Ie.end, Nr);
1254
+ return { node: { type: x.htmlBlock, tag: pr, attrs: dr(Ie.attrs, pr, a), e: Ie.whitespaceBeforeAttrs + Ie.rawAttrs, children: Jr, a: Za, text: bt, c: !0, b: !1, endPos: Nr, canInterruptParagraph: !1 }, end: qa };
1255
+ }
1256
+ function Hn(e, t) {
1257
+ if (e.charCodeAt(t) !== ce) return 0;
1258
+ var r = t + 1, a = e.length;
1259
+ if (e.charCodeAt(r) === ze && e.charCodeAt(r + 1) === q && e.charCodeAt(r + 2) === q) return 2;
1260
+ if (e.charCodeAt(r) === Dr) return 3;
1261
+ if (e.charCodeAt(r) === ze) {
1262
+ var n = e.charCodeAt(r + 1);
1263
+ if (n >= Y && n <= Z) return 4;
1264
+ if (e.slice(r + 1, r + 8) === "[CDATA[") return 5;
1265
+ }
1266
+ for (var l = e.charCodeAt(r) === be, i = l ? r + 1 : r, o = i; o < a; ) {
1267
+ var c = e.charCodeAt(o);
1268
+ if (c >= Y && c <= Z || c >= Ae && c <= ge || c >= $ && c <= ee || c === q) o++;
1269
+ else break;
1270
+ }
1271
+ if (o === i) return 0;
1272
+ var f = e.slice(i, o);
1273
+ if (Vr.has(f.toLowerCase())) {
1274
+ if (l) return 0;
1275
+ var s = e.charCodeAt(o);
1276
+ return s === B || s === E || s === U || s === D || o >= a ? 1 : 0;
1277
+ }
1278
+ if (ft.has(f.toLowerCase())) {
1279
+ if (l) {
1280
+ for (var u = o; u < a && (e.charCodeAt(u) === B || e.charCodeAt(u) === E); ) u++;
1281
+ return u < a && e.charCodeAt(u) === U ? 6 : 0;
1282
+ }
1283
+ var C = o < a ? e.charCodeAt(o) : -1;
1284
+ return C === B || C === E || C === U || C === D || C === be || C === -1 ? 6 : 0;
1285
+ }
1286
+ if (l) {
1287
+ for (var A = o; A < a && (e.charCodeAt(A) === B || e.charCodeAt(A) === E); ) A++;
1288
+ if (A < a && e.charCodeAt(A) === U) {
1289
+ var p = le(e, t), d = e.slice(A + 1, p).trim();
1290
+ if (d === "") return 7;
1291
+ }
1292
+ } else {
1293
+ var h = le(e, t), v = sr(e, t);
1294
+ if (v && v.end <= h) {
1295
+ var y = e.slice(v.end, h).trim();
1296
+ if (y === "") return 7;
1297
+ }
1298
+ }
1299
+ return 0;
1300
+ }
1301
+ function oa(e, t, r) {
1302
+ for (var a = 0, n = e.length; a < n && (e.charCodeAt(a) === B || e.charCodeAt(a) === E); ) a++;
1303
+ for (; n > a && (e.charCodeAt(n - 1) === B || e.charCodeAt(n - 1) === E); ) n--;
1304
+ a < n && e.charCodeAt(a) === Be && a++, n > a && e.charCodeAt(n - 1) === Be && (n - 2 < a || e.charCodeAt(n - 2) !== we) && n--;
1305
+ for (var l = [], i = a, o = !1, c = [], f = a; f < n; ) {
1306
+ var s = e.charCodeAt(f);
1307
+ if (s === we && f + 1 < n) {
1308
+ e.charCodeAt(f + 1) === Be ? (o || (o = !0, c = []), c.push(e.slice(i, f)), c.push("|"), f += 2, i = f) : f += 2;
1309
+ continue;
1310
+ }
1311
+ if (s === ne) {
1312
+ for (var u = 0; f < n && e.charCodeAt(f) === ne; ) u++, f++;
1313
+ for (var C = !1; f < n && !C; ) {
1314
+ for (var A = 0; f < n && e.charCodeAt(f) === ne; ) A++, f++;
1315
+ A === u ? C = !0 : A === 0 && f++;
1316
+ }
1317
+ continue;
1318
+ }
1319
+ if (s === Be) {
1320
+ var p = o ? (c.push(e.slice(i, f)), c.join("")) : e.slice(i, f);
1321
+ l.push(p.trim()), f++, i = f, o = !1, c = [];
1322
+ continue;
1323
+ }
1324
+ f++;
1325
+ }
1326
+ var d = o ? (c.push(e.slice(i, n)), c.join("")) : e.slice(i, n);
1327
+ return l.push(d.trim()), l.map(function(h) {
1328
+ var v = h.indexOf("\\|") !== -1 ? h.replace(/\\\|/g, "|") : h;
1329
+ return je(v, 0, v.length, t, r);
1330
+ });
1331
+ }
1332
+ function ca(e, t, r, a) {
1333
+ let n = le(e, t);
1334
+ var l = e.indexOf("|", t);
1335
+ if (l < 0 || l >= n) return null;
1336
+ let i = G(e, n);
1337
+ if (i >= e.length) return null;
1338
+ let o = le(e, i);
1339
+ if (!pa(e, i, o)) return null;
1340
+ let c = e.slice(t, n), f = e.slice(i, o);
1341
+ for (var s = [], u = 0, C = f.length; u < C && (f.charCodeAt(u) === B || f.charCodeAt(u) === E); ) u++;
1342
+ for (u < C && f.charCodeAt(u) === Be && u++; u < C; ) {
1343
+ for (; u < C && (f.charCodeAt(u) === B || f.charCodeAt(u) === E); ) u++;
1344
+ if (u >= C || f.charCodeAt(u) === Be) break;
1345
+ var A = f.charCodeAt(u) === Ne;
1346
+ for (A && u++; u < C && f.charCodeAt(u) === q; ) u++;
1347
+ var p = u < C && f.charCodeAt(u) === Ne;
1348
+ for (p && u++, s.push(A && p ? "center" : p ? "right" : A ? "left" : null); u < C && (f.charCodeAt(u) === B || f.charCodeAt(u) === E); ) u++;
1349
+ u < C && f.charCodeAt(u) === Be && u++;
1350
+ }
1351
+ let d = oa(c, r, a);
1352
+ if (s.length !== d.length) return null;
1353
+ let h = [], v = G(e, o);
1354
+ for (; v < e.length; ) {
1355
+ let I = le(e, v), O = e.slice(v, I);
1356
+ if (qe(e, v, I)) break;
1357
+ if (me(e, v, I), ae < 4) {
1358
+ var y = e.charCodeAt(v + te);
1359
+ if (y === U || y === or || (y === q || y === xe || y === pe) && yr(e, v)) break;
1360
+ if (y === ne || y === Te) {
1361
+ for (var m = v + te, L = 0; m < I && e.charCodeAt(m) === y; ) L++, m++;
1362
+ if (L >= 3) break;
1363
+ }
1364
+ }
1365
+ h.push(oa(O, r, a)), v = G(e, I);
1366
+ }
1367
+ if ((a.streaming || a.optimizeForStreaming) && h.length === 0) return null;
1368
+ for (var w = d.length, g = 0; g < h.length; g++) if (h[g].length < w) for (; h[g].length < w; ) h[g].push([]);
1369
+ else h[g].length > w && (h[g].length = w);
1370
+ return { node: { type: x.table, header: d, cells: h, align: s }, end: v };
1371
+ }
1372
+ function Nn(e, t, r) {
1373
+ var a = le(e, t);
1374
+ if (me(e, t, a), ae > 3) return null;
1375
+ var n = t + te;
1376
+ if (e.charCodeAt(n) !== Ce) return null;
1377
+ if (n + 1 < e.length && e.charCodeAt(n + 1) === ar) {
1378
+ var l = jn(e, n, r);
1379
+ return l || null;
1380
+ }
1381
+ r.refs || (r.refs = {});
1382
+ var i = ma(e, n, r.refs);
1383
+ return i === null ? null : { node: { type: x.refCollection }, end: i };
1384
+ }
1385
+ function jn(e, t, r) {
1386
+ var a = e.length;
1387
+ if (e.charCodeAt(t) !== Ce || t + 1 >= a || e.charCodeAt(t + 1) !== ar) return null;
1388
+ for (var n = t + 2, l = n; n < a && e.charCodeAt(n) !== Ge; ) {
1389
+ if (e.charCodeAt(n) === D) return null;
1390
+ n++;
1391
+ }
1392
+ if (n >= a) return null;
1393
+ var i = ("^" + e.slice(l, n)).toLowerCase();
1394
+ if (n++, n >= a || e.charCodeAt(n) !== Ne) return null;
1395
+ for (n++; n < a && (e.charCodeAt(n) === B || e.charCodeAt(n) === E); ) n++;
1396
+ if (n < a && e.charCodeAt(n) === D) for (n++; n < a && (e.charCodeAt(n) === B || e.charCodeAt(n) === E); ) n++;
1397
+ var o = e.indexOf(`
1398
+ `, n);
1399
+ o < 0 && (o = a);
1400
+ for (var c = e.slice(n, o).trim(), f = o < a ? o + 1 : a; f < a; ) {
1401
+ var s = le(e, f);
1402
+ if (me(e, f, s), ae >= 2 && !qe(e, f, s)) c += `
1403
+ ` + e.slice(f, s), f = G(e, s);
1404
+ else if (qe(e, f, s)) {
1405
+ var u = G(e, s);
1406
+ if (u < a) {
1407
+ var C = le(e, u);
1408
+ if (me(e, u, C), ae >= 2) {
1409
+ c += `
1410
+ `, f = G(e, s);
1411
+ continue;
1412
+ }
1413
+ }
1414
+ break;
1415
+ } else break;
1416
+ }
1417
+ return r.refs[i] || (r.refs[i] = { target: c, title: void 0 }), { node: { type: x.footnote }, end: f };
1418
+ }
1419
+ function Mn(e, t, r, a) {
1420
+ let n = t, l = 0, i = 0, o = -1;
1421
+ for (; n < e.length; ) {
1422
+ let R = o >= 0 ? o : le(e, n);
1423
+ if (o = -1, qe(e, n, R)) break;
1424
+ if (me(e, n, R), ae < 4 && i > 0 && !r.f) {
1425
+ let N = e.charCodeAt(n + te);
1426
+ if (N === Ke || N === q) {
1427
+ let W = n + te;
1428
+ for (; W < R && e.charCodeAt(W) === N; ) W++;
1429
+ for (; W < R && (e.charCodeAt(W) === B || e.charCodeAt(W) === E); ) W++;
1430
+ if (W >= R) {
1431
+ l = N === Ke ? 1 : 2, n = G(e, R);
1432
+ break;
1433
+ }
1434
+ }
1435
+ }
1436
+ i = R;
1437
+ let H = G(e, R);
1438
+ if (H < e.length) {
1439
+ if (e.charCodeAt(H) === it) {
1440
+ var c = le(e, H);
1441
+ n = G(e, c), i = c;
1442
+ continue;
1443
+ }
1444
+ let N = le(e, H);
1445
+ if (o = N, me(e, H, N), ae < 4) {
1446
+ let W = e.charCodeAt(H + te);
1447
+ if (W === U) {
1448
+ n = H;
1449
+ break;
1450
+ }
1451
+ if (W === or && ya(e, H, r, a)) {
1452
+ n = H;
1453
+ break;
1454
+ }
1455
+ if (W === ne || W === Te) {
1456
+ for (var f = H + te, s = 0; f < N && e.charCodeAt(f) === W; ) s++, f++;
1457
+ if (s >= 3) {
1458
+ n = H;
1459
+ break;
1460
+ }
1461
+ }
1462
+ if (W === ce) {
1463
+ var u = H + te + 1, C = u < N ? e.charCodeAt(u) : 0, A = C === ze || C === Dr;
1464
+ if (!A && C === be) {
1465
+ for (var p = u + 1, d = p; d < N && (e.charCodeAt(d) >= Y && e.charCodeAt(d) <= Z || e.charCodeAt(d) >= Ae && e.charCodeAt(d) <= ge || e.charCodeAt(d) >= $ && e.charCodeAt(d) <= ee || e.charCodeAt(d) === q); ) d++;
1466
+ d > p && (A = ft.has(e.slice(p, d).toLowerCase()));
1467
+ } else if (!A) {
1468
+ for (var h = u; h < N && (e.charCodeAt(h) >= Y && e.charCodeAt(h) <= Z || e.charCodeAt(h) >= Ae && e.charCodeAt(h) <= ge || e.charCodeAt(h) >= $ && e.charCodeAt(h) <= ee || e.charCodeAt(h) === q); ) h++;
1469
+ if (h > u) {
1470
+ var v = e.slice(u, h).toLowerCase();
1471
+ A = ft.has(v) || Vr.has(v);
1472
+ }
1473
+ }
1474
+ if (A && wa(e, H, r, a)) {
1475
+ n = H;
1476
+ break;
1477
+ }
1478
+ }
1479
+ if (W === q || W === xe || W === Br) {
1480
+ let j = H + te + 1;
1481
+ if (j < N && (e.charCodeAt(j) === B || e.charCodeAt(j) === E)) {
1482
+ var y = qr(e, j, N);
1483
+ if (y < N && !yr(e, H)) {
1484
+ n = H;
1485
+ break;
1486
+ }
1487
+ }
1488
+ }
1489
+ if (W >= $ && W <= ee) {
1490
+ let j = H + te;
1491
+ for (; j < N && e.charCodeAt(j) >= $ && e.charCodeAt(j) <= ee; ) j++;
1492
+ if (j < N && (e.charCodeAt(j) === Qe || e.charCodeAt(j) === $e) && j - (H + te) === 1 && e.charCodeAt(H + te) === 49) {
1493
+ var m = j + 1;
1494
+ if (m < N && (e.charCodeAt(m) === B || e.charCodeAt(m) === E)) {
1495
+ var L = qr(e, m, N);
1496
+ if (L < N) {
1497
+ n = H;
1498
+ break;
1499
+ }
1500
+ }
1501
+ }
1502
+ }
1503
+ if (W === Be) {
1504
+ let j = G(e, N);
1505
+ if (j < e.length) {
1506
+ let b = le(e, j);
1507
+ if (pa(e, j, b)) {
1508
+ n = H;
1509
+ break;
1510
+ }
1511
+ }
1512
+ }
1513
+ if ((W === q || W === xe || W === pe) && yr(e, H)) {
1514
+ if (W !== q) {
1515
+ n = H;
1516
+ break;
1517
+ }
1518
+ let j = H + te;
1519
+ for (; j < N && e.charCodeAt(j) === q; ) j++;
1520
+ for (; j < N && (e.charCodeAt(j) === B || e.charCodeAt(j) === E); ) j++;
1521
+ if (j < N) {
1522
+ n = H;
1523
+ break;
1524
+ }
1525
+ }
1526
+ }
1527
+ }
1528
+ n = G(e, R);
1529
+ }
1530
+ for (var w = l ? i : n; w > t && (e.charCodeAt(w - 1) === D || e.charCodeAt(w - 1) === br || e.charCodeAt(w - 1) === B || e.charCodeAt(w - 1) === E); ) w--;
1531
+ for (var g = t; g < w && (e.charCodeAt(g) === B || e.charCodeAt(g) === E); ) g++;
1532
+ if (g >= w) return null;
1533
+ for (var I = !1, O = g; O < w; O++) if (e.charCodeAt(O) === it) {
1534
+ I = !0;
1535
+ break;
1536
+ }
1537
+ var S = I ? e.slice(g, w).replace(/\u001E/g, "") : e.slice(g, w);
1538
+ if (!S) return null;
1539
+ let T = zn(S, 0, S.length, r, a);
1540
+ if (l) {
1541
+ let R = (a?.slugify || ir)(S);
1542
+ return { node: { type: x.heading, level: l, children: T, id: R }, end: n };
1543
+ }
1544
+ return { node: { type: x.paragraph, children: T }, end: n };
1545
+ }
1546
+ function zn(e, t, r, a, n) {
1547
+ var l = e.indexOf(`
1548
+ `, t);
1549
+ if (l < 0 || l >= r) return je(e, t, r, a, n);
1550
+ for (var i = "", o = t, c = t; c < r; ) {
1551
+ var f = e.charCodeAt(c);
1552
+ if (f === ne) {
1553
+ var s = At(e, c, r);
1554
+ if (s > c) {
1555
+ for (var u = !1, C = c; C < s; C++) if (e.charCodeAt(C) === D) {
1556
+ u = !0;
1557
+ break;
1558
+ }
1559
+ u && (i += e.slice(o, c), i += e.slice(c, s).replace(/\n/g, " "), o = s), c = s;
1560
+ continue;
1561
+ }
1562
+ }
1563
+ if (f === ce) {
1564
+ var A = La(e, c, r);
1565
+ if (A > c) {
1566
+ c = A;
1567
+ continue;
1568
+ }
1569
+ }
1570
+ if (f === D) {
1571
+ var p = !1, d = 0;
1572
+ if (c > t && e.charCodeAt(c - 1) === we) p = !0, d = 1;
1573
+ else {
1574
+ for (var h = 0, v = c - 1; v >= t && e.charCodeAt(v) === B; ) h++, v--;
1575
+ h >= 2 && (p = !0, d = h);
1576
+ }
1577
+ for (p ? (i += e.slice(o, c - d), i += "") : i += e.slice(o, c + 1), c++; c < r && e.charCodeAt(c) === B; ) c++;
1578
+ o = c;
1579
+ continue;
1580
+ }
1581
+ c++;
1582
+ }
1583
+ return o < r && (i += e.slice(o, r)), je(i, 0, i.length, a, n);
1584
+ }
1585
+ function Pn(e, t, r) {
1586
+ if (e.charCodeAt(t) !== ne) return null;
1587
+ let a = Cr(e, t, r, 96), n = t + a;
1588
+ for (; n < r; ) {
1589
+ let l = e.indexOf("`", n);
1590
+ if (l < 0 || l >= r) return null;
1591
+ let i = Cr(e, l, r, 96);
1592
+ if (i === a) {
1593
+ let o = e.slice(t + a, l);
1594
+ return o = o.replace(/\n/g, " "), o.length > 0 && o[0] === " " && o[o.length - 1] === " " && o.trim().length > 0 && (o = o.slice(1, -1)), { node: { type: x.codeInline, text: o }, end: l + i };
1595
+ }
1596
+ n = l + i;
1597
+ }
1598
+ return null;
1599
+ }
1600
+ function At(e, t, r) {
1601
+ if (e.charCodeAt(t) !== ne) return t;
1602
+ let a = Cr(e, t, r, 96), n = t + a;
1603
+ for (; n < r; ) {
1604
+ let l = e.indexOf("`", n);
1605
+ if (l < 0 || l >= r) return t;
1606
+ let i = Cr(e, l, r, 96);
1607
+ if (i === a) return l + i;
1608
+ n = l + i;
1609
+ }
1610
+ return t;
1611
+ }
1612
+ function La(e, t, r) {
1613
+ if (e.charCodeAt(t) !== ce) return t;
1614
+ if (t + 1 < r && e.charCodeAt(t + 1) === be) {
1615
+ let f = t + 2;
1616
+ for (; f < r && e.charCodeAt(f) !== U; ) f++;
1617
+ return f < r ? f + 1 : t;
1618
+ }
1619
+ if (t + 3 < r && e.charCodeAt(t + 1) === ze && e.charCodeAt(t + 2) === q && e.charCodeAt(t + 3) === q) {
1620
+ let f = e.indexOf("-->", t + 4);
1621
+ return f >= 0 ? f + 3 : t;
1622
+ }
1623
+ let a = t + 1, n = a;
1624
+ for (; a < r; ) {
1625
+ let f = e.charCodeAt(a);
1626
+ if (f >= Y && f <= Z || f >= Ae && f <= ge || f >= $ && f <= ee || f === q) a++;
1627
+ else break;
1628
+ }
1629
+ if (a === n) return t;
1630
+ let l = e.slice(n, a).toLowerCase(), i = !1;
1631
+ for (; a < r; ) {
1632
+ let f = e.charCodeAt(a);
1633
+ if (f === U) {
1634
+ a++;
1635
+ break;
1636
+ }
1637
+ if (f === be && a + 1 < r && e.charCodeAt(a + 1) === U) {
1638
+ a += 2, i = !0;
1639
+ break;
1640
+ }
1641
+ if (f === Lr || f === wr) {
1642
+ var o = f;
1643
+ for (a++; a < r && e.charCodeAt(a) !== o; ) a++;
1644
+ a < r && a++;
1645
+ continue;
1646
+ }
1647
+ if (f === D) return t;
1648
+ a++;
1649
+ }
1650
+ if (i || Yr(l)) return a;
1651
+ let c = 1;
1652
+ for (; a < r && c > 0; ) if (e.charCodeAt(a) === ce) if (a + 1 < r && e.charCodeAt(a + 1) === be) {
1653
+ let f = a + 2, s = f;
1654
+ for (; s < r && (e.charCodeAt(s) >= Y && e.charCodeAt(s) <= Z || e.charCodeAt(s) >= Ae && e.charCodeAt(s) <= ge); ) s++;
1655
+ if (e.slice(f, s).toLowerCase() === l) {
1656
+ for (; s < r && e.charCodeAt(s) !== U; ) s++;
1657
+ if (s < r && s++, c--, c === 0) return s;
1658
+ }
1659
+ a = s;
1660
+ } else {
1661
+ let f = a + 1, s = f;
1662
+ for (; s < r && (e.charCodeAt(s) >= Y && e.charCodeAt(s) <= Z || e.charCodeAt(s) >= Ae && e.charCodeAt(s) <= ge); ) s++;
1663
+ e.slice(f, s).toLowerCase() === l && c++, a++;
1664
+ }
1665
+ else a++;
1666
+ return a;
1667
+ }
1668
+ function Dn(e, t, r, a, n) {
1669
+ if (e.charCodeAt(t) !== Te || t + 1 >= r || e.charCodeAt(t + 1) !== Te) return null;
1670
+ let l = t + 2;
1671
+ for (; l + 1 < r; ) {
1672
+ let i = e.charCodeAt(l);
1673
+ if (i === ne) {
1674
+ let o = At(e, l, r);
1675
+ if (o > l) {
1676
+ l = o;
1677
+ continue;
1678
+ }
1679
+ }
1680
+ if (i === Te && e.charCodeAt(l + 1) === Te) {
1681
+ let o = e.slice(t + 2, l), c = je(o, 0, o.length, a, n);
1682
+ return { node: { type: x.textFormatted, tag: "del", children: c }, end: l + 2 };
1683
+ }
1684
+ i === we && l + 1 < r && l++, l++;
1685
+ }
1686
+ return null;
1687
+ }
1688
+ function Wn(e, t, r, a, n) {
1689
+ if (e.charCodeAt(t) !== Ke || t + 1 >= r || e.charCodeAt(t + 1) !== Ke) return null;
1690
+ let l = t + 2;
1691
+ for (; l + 1 < r; ) {
1692
+ let i = e.charCodeAt(l);
1693
+ if (i === ne) {
1694
+ let o = At(e, l, r);
1695
+ if (o > l) {
1696
+ l = o;
1697
+ continue;
1698
+ }
1699
+ }
1700
+ if (i === Ke && e.charCodeAt(l + 1) === Ke && l > t + 2) {
1701
+ let o = e.slice(t + 2, l), c = je(o, 0, o.length, a, n);
1702
+ return { node: { type: x.textFormatted, tag: "mark", children: c }, end: l + 2 };
1703
+ }
1704
+ i === we && l + 1 < r && l++, l++;
1705
+ }
1706
+ return null;
1707
+ }
1708
+ var Jn = /[\p{P}\p{S}]/u;
1709
+ function fa(e, t, r) {
1710
+ return e < Gr ? !!(jt(e) & Q) : Jn.test(t[r]);
1711
+ }
1712
+ function da(e, t, r) {
1713
+ return e < Gr ? !!(jt(e) & jr) : new RegExp("\\p{Zs}", "u").test(t[r]);
1714
+ }
1715
+ function Xn(e, t, r) {
1716
+ var a = e.charCodeAt(t);
1717
+ if (a !== xe && a !== pe) return null;
1718
+ var n = Cr(e, t, r, a);
1719
+ if (n === 0) return null;
1720
+ var l = t > 0 ? e.charCodeAt(t - 1) : 32, i = t + n < r ? e.charCodeAt(t + n) : 32, o = da(l, e, t - 1), c = da(i, e, t + n), f = t > 0 ? fa(l, e, t - 1) : !1, s = t + n < r ? fa(i, e, t + n) : !1, u = !c && (!s || o || f), C = !o && (!f || c || s), A, p;
1721
+ return a === xe ? (A = u, p = C) : (A = u && (!C || f), p = C && (!u || s)), { len: n, canOpen: A, canClose: p };
1722
+ }
1723
+ function Un(e, t, r, a) {
1724
+ if (t.length !== 0) {
1725
+ for (var n = [], l = 0; l < 12; l++) n[l] = -1;
1726
+ for (var i = 0; i < t.length; ) {
1727
+ var o = t[i];
1728
+ if (!o.active || !o.canClose) {
1729
+ i++;
1730
+ continue;
1731
+ }
1732
+ for (var c = o.ch === xe ? 0 : 1, f = c * 6 + o.len % 3 * 2 + (o.canOpen ? 1 : 0), s = n[f] !== void 0 ? n[f] : -1, u = -1, C = i - 1; C > s; C--) {
1733
+ var A = t[C];
1734
+ if (!(!A.active || A.ch !== o.ch || !A.canOpen) && !((o.canOpen || A.canClose) && (A.len + o.len) % 3 === 0 && A.len % 3 !== 0)) {
1735
+ u = C;
1736
+ break;
1737
+ }
1738
+ }
1739
+ if (u < 0) {
1740
+ n[f] = i - 1, !o.canOpen && (o.active = !1), i++;
1741
+ continue;
1742
+ }
1743
+ var p = t[u], d = p.len >= 2 && o.len >= 2, h = d ? 2 : 1;
1744
+ p.len -= h, o.len -= h;
1745
+ var v = e[p.idx], y = e[o.idx];
1746
+ v.text = v.text.slice(0, v.text.length - h), y.text = y.text.slice(h);
1747
+ var m = p.idx + 1, L = o.idx, w = e.slice(m, L), g = { type: x.textFormatted, tag: d ? "strong" : "em", children: w };
1748
+ e.splice(m, L - m, g);
1749
+ for (var I = L - m - 1, O = 0; O < t.length; O++) t[O].idx > p.idx && (t[O].idx -= I);
1750
+ for (var S = u + 1; S < i; S++) t[S].active = !1;
1751
+ if (p.len === 0 && (p.active = !1, v.text === "")) {
1752
+ e.splice(p.idx, 1);
1753
+ for (var T = 0; T < t.length; T++) t[T].idx > p.idx ? t[T].idx-- : t[T].idx === p.idx && (t[T].idx = -1);
1754
+ }
1755
+ if (o.len === 0) {
1756
+ o.active = !1;
1757
+ var R = o.idx;
1758
+ if (y.text === "") {
1759
+ e.splice(R, 1);
1760
+ for (var H = 0; H < t.length; H++) t[H].idx > R ? t[H].idx-- : t[H].idx === R && (t[H].idx = -1);
1761
+ }
1762
+ } else continue;
1763
+ i++;
1764
+ }
1765
+ for (var N = 0, W = 0; W < e.length; W++) {
1766
+ var j = e[W];
1767
+ if (j.type === x.text) {
1768
+ var b = j;
1769
+ if (b.text === "") continue;
1770
+ if (N > 0 && e[N - 1].type === x.text) {
1771
+ e[N - 1].text += b.text;
1772
+ continue;
1773
+ }
1774
+ }
1775
+ e[N++] = j;
1776
+ }
1777
+ e.length = N;
1778
+ }
1779
+ }
1780
+ function sa(e, t, r, a, n) {
1781
+ let l = e.charCodeAt(t) === ze, i = l ? t + 1 : t;
1782
+ if (e.charCodeAt(i) !== Ce) return null;
1783
+ var o = e.indexOf("]", i + 1);
1784
+ if (o < 0 || o >= r) return null;
1785
+ for (var c = i + 1, f = -1, s = 1; c < r && s > 0; ) {
1786
+ var u = e.charCodeAt(c);
1787
+ if (u === we && c + 1 < r) {
1788
+ c += 2;
1789
+ continue;
1790
+ }
1791
+ if (u === ne) {
1792
+ var C = At(e, c, r);
1793
+ if (C > c) {
1794
+ c = C;
1795
+ continue;
1796
+ }
1797
+ }
1798
+ if (u === ce) {
1799
+ var A = Ba(e, c, r);
1800
+ if (A) {
1801
+ c = A.end;
1802
+ continue;
1803
+ }
1804
+ var p = La(e, c, r);
1805
+ if (p > c) {
1806
+ c = p;
1807
+ continue;
1808
+ }
1809
+ }
1810
+ u === Ce ? s++ : u === Ge && s--, c++;
1811
+ }
1812
+ if (s !== 0) return null;
1813
+ var d = c - 1, h = e.slice(i + 1, d), v = c < r ? e.charCodeAt(c) : 0, y = !1;
1814
+ if (v === Ze) {
1815
+ var m = !0;
1816
+ for (c++; c < r && (e.charCodeAt(c) === B || e.charCodeAt(c) === D); ) c++;
1817
+ var L = "", w = c;
1818
+ if (c < r && e.charCodeAt(c) === ce) {
1819
+ for (c++, w = c; w < r && e.charCodeAt(w) !== U; ) {
1820
+ if (e.charCodeAt(w) === we && w + 1 < r) {
1821
+ w += 2;
1822
+ continue;
1823
+ }
1824
+ if (e.charCodeAt(w) === D) {
1825
+ m = !1;
1826
+ break;
1827
+ }
1828
+ w++;
1829
+ }
1830
+ m && (w >= r || e.charCodeAt(w) !== U) && (m = !1), m && (L = e.slice(c, w), w++);
1831
+ } else if (m) {
1832
+ for (var g = 0; w < r; ) {
1833
+ var I = e.charCodeAt(w);
1834
+ if (I === we && w + 1 < r) {
1835
+ w += 2;
1836
+ continue;
1837
+ }
1838
+ if (I === Ze) g++;
1839
+ else if (I === $e) {
1840
+ if (g === 0) break;
1841
+ g--;
1842
+ } else if (I === B || I === D) break;
1843
+ w++;
1844
+ }
1845
+ L = e.slice(c, w);
1846
+ }
1847
+ if (m) {
1848
+ for (c = w; c < r && (e.charCodeAt(c) === B || e.charCodeAt(c) === D); ) c++;
1849
+ var O;
1850
+ if (c < r) {
1851
+ var S = e.charCodeAt(c);
1852
+ if (S === Lr || S === wr || S === Ze) {
1853
+ var T = S === Ze ? 41 : S;
1854
+ c++;
1855
+ for (var R = c; c < r && e.charCodeAt(c) !== T; ) e.charCodeAt(c) === we && c + 1 < r && c++, c++;
1856
+ c >= r ? m = !1 : (O = e.slice(R, c), c++);
1857
+ }
1858
+ }
1859
+ if (m) {
1860
+ for (; c < r && (e.charCodeAt(c) === B || e.charCodeAt(c) === D); ) c++;
1861
+ (c >= r || e.charCodeAt(c) !== $e) && (m = !1);
1862
+ }
1863
+ }
1864
+ if (m) {
1865
+ c++, L = zr(L), O !== void 0 && (O = Ct(zr(O)));
1866
+ var H = n?.sanitizer || Nt, N = H(L, l ? "img" : "a", l ? "src" : "href"), W = N === null ? null : L;
1867
+ if (l) {
1868
+ var j = je(h, 0, h.length, a, n), b = dt(j);
1869
+ return { node: { type: x.image, target: W, alt: b, title: O }, end: c };
1870
+ } else {
1871
+ var J = a.inAnchor;
1872
+ a.inAnchor = !0;
1873
+ var P = J ? [{ type: x.text, text: h }] : je(h, 0, h.length, a, n);
1874
+ return a.inAnchor = J, !a.inAnchor && Et(P) ? null : { node: { type: x.link, target: W, title: O, children: P }, end: c };
1875
+ }
1876
+ } else c = d + 1, y = !0;
1877
+ }
1878
+ var X = "", _ = c;
1879
+ if (!y && v === Ce) {
1880
+ var ie = c + 1;
1881
+ _ = ie;
1882
+ for (var fe = !1; _ < r && e.charCodeAt(_) !== Ge; ) {
1883
+ if (e.charCodeAt(_) === we && _ + 1 < r) {
1884
+ _ += 2;
1885
+ continue;
1886
+ }
1887
+ if (e.charCodeAt(_) === Ce) {
1888
+ fe = !0;
1889
+ break;
1890
+ }
1891
+ _++;
1892
+ }
1893
+ if (fe || _ >= r) return null;
1894
+ var Le = e.slice(ie, _);
1895
+ if (Le.trim()) X = nt(Le);
1896
+ else {
1897
+ if (na(h)) return null;
1898
+ X = nt(h);
1899
+ }
1900
+ _ = _ + 1;
1901
+ } else {
1902
+ if (na(h)) return null;
1903
+ X = nt(h);
1904
+ }
1905
+ var re = a.refs[X];
1906
+ if (!re) return null;
1907
+ if (l) return { node: { type: x.image, target: re.target, alt: dt(je(h, 0, h.length, a, n)), title: re.title }, end: _ };
1908
+ var he = a.inAnchor;
1909
+ a.inAnchor = !0;
1910
+ var P = he ? [{ type: x.text, text: h }] : je(h, 0, h.length, a, n);
1911
+ return a.inAnchor = he, !a.inAnchor && Et(P) ? null : { node: { type: x.link, target: re.target, title: re.title, children: P }, end: _ };
1912
+ }
1913
+ function Ba(e, t, r) {
1914
+ if (e.charCodeAt(t) !== ce) return null;
1915
+ for (var a = t + 1; a < r; ) {
1916
+ var n = e.charCodeAt(a);
1917
+ if (n === U) break;
1918
+ if (n === B || n === D || n === br || n === ce) return null;
1919
+ a++;
1920
+ }
1921
+ if (a >= r || e.charCodeAt(a) !== U) return null;
1922
+ var l = e.slice(t + 1, a), i = l.match(/^([a-zA-Z][a-zA-Z0-9+.-]{1,31}):([^\x00-\x20]*)$/);
1923
+ return i ? { node: { type: x.link, target: l, children: [{ type: x.text, text: l }] }, end: a + 1 } : l.indexOf("@") !== -1 && /^[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])?)*$/.test(l) ? { node: { type: x.link, target: "mailto:" + l, children: [{ type: x.text, text: l }] }, end: a + 1 } : null;
1924
+ }
1925
+ function Fn(e, t, r, a) {
1926
+ if (e.charCodeAt(t) !== Ce || t + 1 >= r || e.charCodeAt(t + 1) !== ar) return null;
1927
+ let n = t + 2;
1928
+ for (; n < r && e.charCodeAt(n) !== Ge && e.charCodeAt(n) !== D; ) n++;
1929
+ if (n >= r || e.charCodeAt(n) !== Ge) return null;
1930
+ let l = e.slice(t + 2, n);
1931
+ return l ? { node: { type: x.footnoteReference, target: "#" + ir(l), text: l }, end: n + 1 } : null;
1932
+ }
1933
+ function Kn(e, t, r, a) {
1934
+ if (a.disableBareUrls) return null;
1935
+ var n = "", l = !1, i = e.charCodeAt(t);
1936
+ if (i === ht || i === 72 ? t + 8 <= r && e.charCodeAt(t + 1) === wt && e.charCodeAt(t + 2) === wt && e.charCodeAt(t + 3) === qt && (e.charCodeAt(t + 4) === tn && e.charCodeAt(t + 5) === Ne && e.charCodeAt(t + 6) === be && e.charCodeAt(t + 7) === be ? n = "https://" : e.charCodeAt(t + 4) === Ne && e.charCodeAt(t + 5) === be && e.charCodeAt(t + 6) === be && (n = "http://")) : i === Pr || i === 70 ? t + 6 <= r && e.charCodeAt(t + 1) === wt && e.charCodeAt(t + 2) === qt && e.charCodeAt(t + 3) === Ne && e.charCodeAt(t + 4) === be && e.charCodeAt(t + 5) === be && (n = "ftp://") : (i === Mr || i === 87) && t + 4 <= r && e.charCodeAt(t + 1) === Mr && e.charCodeAt(t + 2) === Mr && e.charCodeAt(t + 3) === Qe && (n = "www.", l = !0), !n) return null;
1937
+ let o = t + n.length;
1938
+ for (; o < r; ) {
1939
+ let g = e.charCodeAt(o);
1940
+ if (g === B || g === D || g === E || g === br || g === ce || g === U) break;
1941
+ o++;
1942
+ }
1943
+ for (var c = 0, f = 0, s = t; s < o; s++) {
1944
+ var u = e.charCodeAt(s);
1945
+ u === Ze ? c++ : u === $e && f++;
1946
+ }
1947
+ let C = o;
1948
+ for (; C > t + n.length; ) {
1949
+ let g = e.charCodeAt(C - 1);
1950
+ if (g === Qe || g === ua || g === Ne || g === ze || g === Dr || g === $e) {
1951
+ if (g === $e) {
1952
+ if (c >= f) break;
1953
+ f--;
1954
+ }
1955
+ C--;
1956
+ } else if (g === Ht) {
1957
+ for (var A = C - 2; A > t && (e.charCodeAt(A) >= Y && e.charCodeAt(A) <= Z || e.charCodeAt(A) >= Ae && e.charCodeAt(A) <= ge || e.charCodeAt(A) >= $ && e.charCodeAt(A) <= ee); ) A--;
1958
+ A >= t && e.charCodeAt(A) === _t ? C = A : C--;
1959
+ } else break;
1960
+ }
1961
+ if (C <= t + n.length) return null;
1962
+ var p = t + (l ? 4 : n.length), d = e.indexOf("/", p);
1963
+ if ((d < 0 || d > C) && (d = C), l && e.indexOf(".", p) === -1) return null;
1964
+ for (var h = -1, v = -1, y = d - 1; y >= p; y--) if (e.charCodeAt(y) === Qe) if (h < 0) h = y;
1965
+ else {
1966
+ v = y;
1967
+ break;
1968
+ }
1969
+ for (var m = v >= 0 ? v + 1 : p, y = m; y < d; y++) if (e.charCodeAt(y) === pe) return null;
1970
+ var L = e.slice(t, C), w = l ? "http://" + L : L;
1971
+ return { node: { type: x.link, target: w, children: [{ type: x.text, text: L }] }, end: C };
1972
+ }
1973
+ function qn(e, t, r, a) {
1974
+ if (a.disableBareUrls) return null;
1975
+ for (var n = t, l = n; n < r; ) {
1976
+ var i = e.charCodeAt(n);
1977
+ if (i >= Y && i <= Z || i >= Ae && i <= ge || i >= $ && i <= ee || i === Qe || i === ze || i === or || i === 36 || i === lt || i === _t || i === wr || i === xe || i === Br || i === be || i === Ke || i === Dr || i === ar || i === pe || i === ne || i === Ir || i === Be || i === ut || i === Te || i === q) n++;
1978
+ else break;
1979
+ }
1980
+ if (n === l || n >= r || e.charCodeAt(n) !== st) return null;
1981
+ n++;
1982
+ for (var o = n, c = -1, f = n; n < r; ) {
1983
+ var i = e.charCodeAt(n);
1984
+ if (i >= Y && i <= Z || i >= Ae && i <= ge || i >= $ && i <= ee) n++;
1985
+ else if ((i === q || i === pe) && n > o) n++;
1986
+ else if (i === Qe) {
1987
+ if (n === o) break;
1988
+ var s = e.charCodeAt(n - 1);
1989
+ if (s === q || s === pe || n - f > 63) break;
1990
+ if (n + 1 < r) {
1991
+ var u = e.charCodeAt(n + 1);
1992
+ if (u >= Y && u <= Z || u >= Ae && u <= ge || u >= $ && u <= ee) c = n, f = n + 1, n++;
1993
+ else break;
1994
+ } else break;
1995
+ } else break;
1996
+ }
1997
+ if (n - f > 63 || c < 0) return null;
1998
+ var C = e.charCodeAt(n - 1);
1999
+ if (!(C >= Y && C <= Z || C >= Ae && C <= ge || C >= $ && C <= ee) || n <= c + 1) return null;
2000
+ for (var A = -1, p = c - 1; p >= o; p--) if (e.charCodeAt(p) === Qe) {
2001
+ A = p;
2002
+ break;
2003
+ }
2004
+ for (var d = A >= 0 ? A + 1 : o, p = d; p < n; p++) if (e.charCodeAt(p) === pe) return null;
2005
+ var h = e.slice(t, n);
2006
+ return { node: { type: x.link, target: "mailto:" + h, children: [{ type: x.text, text: h }] }, end: n };
2007
+ }
2008
+ function Et(e) {
2009
+ for (var t = 0; t < e.length; t++) if (e[t].type === x.link || "children" in e[t] && Array.isArray(e[t].children) && Et(e[t].children)) return !0;
2010
+ return !1;
2011
+ }
2012
+ function dt(e) {
2013
+ for (var t = "", r = 0; r < e.length; r++) {
2014
+ var a = e[r];
2015
+ a.type === x.text ? t += a.text : a.type === x.breakLine ? t += " " : a.type === x.codeInline ? t += a.text : "children" in a && Array.isArray(a.children) ? t += dt(a.children) : a.type === x.image ? t += a.alt || "" : a.type === x.link && (t += dt(a.children));
2016
+ }
2017
+ return t;
2018
+ }
2019
+ function Sr(e) {
2020
+ let t = e.includes("&") ? Ct(e) : e;
2021
+ return { type: x.text, text: t };
2022
+ }
2023
+ function Gn(e, t, r, a, n) {
2024
+ if (e.charCodeAt(t) !== ce) return null;
2025
+ var l = t + 1;
2026
+ if (l >= r) return null;
2027
+ var i = e.charCodeAt(l);
2028
+ if (i === ze && l + 1 < r && e.charCodeAt(l + 1) === q && l + 2 < r && e.charCodeAt(l + 2) === q) {
2029
+ var o = l + 3;
2030
+ if (o < r && e.charCodeAt(o) === U) return { node: { type: x.htmlComment, text: "", endsWithGreaterThan: !0 }, end: o + 1 };
2031
+ if (o + 1 < r && e.charCodeAt(o) === q && e.charCodeAt(o + 1) === U) return { node: { type: x.htmlComment, text: "-", endsWithGreaterThan: !0 }, end: o + 2 };
2032
+ var c = e.indexOf("-->", o);
2033
+ return c !== -1 && c <= r - 3 ? { node: { type: x.htmlComment, text: e.slice(t + 4, c) }, end: c + 3 } : null;
2034
+ }
2035
+ if (i === Dr) {
2036
+ var f = e.indexOf("?>", l + 1);
2037
+ return f !== -1 && f < r ? { node: { type: x.htmlSelfClosing, tag: "?", attrs: {}, a: e.slice(t, f + 2) }, end: f + 2 } : null;
2038
+ }
2039
+ if (i === ze && l + 1 < r) {
2040
+ var s = e.charCodeAt(l + 1);
2041
+ if (s === Ce && e.slice(l + 1, l + 8) === "[CDATA[") {
2042
+ var u = e.indexOf("]]>", l + 8);
2043
+ return u !== -1 && u < r ? { node: { type: x.htmlSelfClosing, tag: "![CDATA[", attrs: {}, a: e.slice(t, u + 3) }, end: u + 3 } : null;
2044
+ }
2045
+ if (s >= Y && s <= Z) {
2046
+ var C = e.indexOf(">", l + 2);
2047
+ return C !== -1 && C < r ? { node: { type: x.htmlSelfClosing, tag: "!" + e.slice(l + 1, C), attrs: {}, a: e.slice(t, C + 1) }, end: C + 1 } : null;
2048
+ }
2049
+ }
2050
+ if (i === be) {
2051
+ var A = l + 1;
2052
+ if (A >= r) return null;
2053
+ var p = e.charCodeAt(A);
2054
+ if (!(p >= Y && p <= Z || p >= Ae && p <= ge)) return null;
2055
+ for (A++; A < r; ) {
2056
+ var d = e.charCodeAt(A);
2057
+ if (d >= Y && d <= Z || d >= Ae && d <= ge || d >= $ && d <= ee || d === q) A++;
2058
+ else break;
2059
+ }
2060
+ for (; A < r && (e.charCodeAt(A) === B || e.charCodeAt(A) === E || e.charCodeAt(A) === D); ) A++;
2061
+ if (A < r && e.charCodeAt(A) === U) {
2062
+ var h = e.slice(l + 1, A).trim();
2063
+ return { node: { type: x.htmlSelfClosing, tag: h, attrs: {}, a: e.slice(t, A + 1), b: !0 }, end: A + 1 };
2064
+ }
2065
+ return null;
2066
+ }
2067
+ if (!(i >= Y && i <= Z || i >= Ae && i <= ge)) return null;
2068
+ var v = sr(e, t);
2069
+ if (!v) return null;
2070
+ var y = v.tag, m = y.toLowerCase(), L = v.selfClosing;
2071
+ if (L || Yr(y)) return { node: { type: x.htmlSelfClosing, tag: y, attrs: dr(v.attrs, y, n), a: e.slice(t, v.end) }, end: v.end };
2072
+ var w = Vr.has(m), g = ba(e.slice(0, r), v.end, y);
2073
+ if (g === -1) return { node: { type: x.htmlSelfClosing, tag: y, attrs: dr(v.attrs, y, n), a: e.slice(t, v.end) }, end: v.end };
2074
+ var I = _n(e, "</" + m, g), O = e.slice(v.end, I), S = [];
2075
+ if (w) O.trim() && (S = [{ type: x.text, text: O }]);
2076
+ else {
2077
+ var T = O.trim();
2078
+ if (T) {
2079
+ var { inAnchor: R, inline: H } = a;
2080
+ m === "a" && (a.inAnchor = !0);
2081
+ var N = T.indexOf(`
2082
+
2083
+ `) !== -1 || /^#{1,6}\s/.test(T);
2084
+ N ? (a.inline = !1, S = kr(T, a, n)) : S = je(T, 0, T.length, a, n), a.inAnchor = R, a.inline = H;
2085
+ }
2086
+ }
2087
+ return { node: { type: x.htmlBlock, tag: y, attrs: dr(v.attrs, y, n), e: v.rawAttrs, children: S, text: O, c: !1 }, end: g };
2088
+ }
2089
+ var Yn = 200, Kr = 0;
2090
+ function je(e, t, r, a, n) {
2091
+ if (Kr++, Kr > Yn) return Kr--, [{ type: x.text, text: e.slice(t, r) }];
2092
+ let l = a;
2093
+ if (n.streaming || n.optimizeForStreaming) {
2094
+ let M = function(ue, De) {
2095
+ for (var We = 1, _e = De + 1; _e < ue.length; _e++) {
2096
+ var oe = ue.charCodeAt(_e);
2097
+ if (oe === Ce) We++;
2098
+ else if (oe === Ge && (We--, We === 0)) return _e;
2099
+ }
2100
+ return -1;
2101
+ }, k = e.slice(t, r), se = k;
2102
+ for (var i = 0, o = 0, c = 0, f = 0, s = 0, u = -1, C = -1, A = -1, p = -1, d = -1, h = 0; h < k.length; h++) {
2103
+ var v = k.charCodeAt(h);
2104
+ v === xe ? h + 1 < k.length && k.charCodeAt(h + 1) === xe ? (i++, u = h, h++) : (o++, C = h) : v === pe ? h + 1 < k.length && k.charCodeAt(h + 1) === pe ? (c++, A = h, h++) : (f++, p = h) : v === Te && h + 1 < k.length && k.charCodeAt(h + 1) === Te && (s++, d = h, h++);
2105
+ }
2106
+ var y = [];
2107
+ s % 2 === 1 && d >= 0 && y.push([d, 2]), c % 2 === 1 && A >= 0 && y.push([A, 2]), f % 2 === 1 && p >= 0 && y.push([p, 1]), i % 2 === 1 && u >= 0 && y.push([u, 2]), o % 2 === 1 && C >= 0 && y.push([C, 1]), y.sort(function(ue, De) {
2108
+ return De[0] - ue[0];
2109
+ });
2110
+ for (var m = 0; m < y.length; m++) {
2111
+ var L = y[m][0], w = y[m][1];
2112
+ k = k.slice(0, L) + k.slice(L + w);
2113
+ }
2114
+ let F = 0, Re = -1;
2115
+ for (let ue = 0; ue < k.length; ue++) k.charCodeAt(ue) === ne && (F++, Re = ue);
2116
+ if (F % 2 === 1 && Re !== -1) {
2117
+ let ue = !1, De = -1, We = 0;
2118
+ for (; We < k.length; ) k.charCodeAt(We) === ne && (ue ? (ue = !1, De = -1) : (De = We, ue = !0)), We++;
2119
+ ue && De !== -1 && (k = k.slice(0, De));
2120
+ }
2121
+ for (var g = !0; g; ) {
2122
+ g = !1;
2123
+ for (var I = -1, O = -1, S = -1, T = !1, R = 0; R < k.length; R++) {
2124
+ var H = k.charCodeAt(R);
2125
+ if (H === Ce && (R === 0 || k.charCodeAt(R - 1) !== we)) {
2126
+ var N = R > 0 && k.charCodeAt(R - 1) === ze, W = N ? R - 1 : R, j = M(k, R);
2127
+ if (j === -1) I = W, T = N, O = R + 1, S = k.length;
2128
+ else {
2129
+ var b = j + 1;
2130
+ if (b >= k.length) I = W, T = N, O = R + 1, S = j;
2131
+ else if (k.charCodeAt(b) === Ze) {
2132
+ var J = k.indexOf(")", b + 1);
2133
+ J === -1 ? (I = W, T = N, O = R + 1, S = j, R = k.length) : R = J;
2134
+ } else if (k.charCodeAt(b) === Ce) {
2135
+ var X = k.indexOf("]", b + 1);
2136
+ X === -1 ? (I = W, T = N, O = R + 1, S = j, R = k.length) : R = X;
2137
+ } else R = j;
2138
+ }
2139
+ }
2140
+ }
2141
+ if (I >= 0) {
2142
+ var _ = T ? "" : k.slice(O, S);
2143
+ k = k.slice(0, I) + _, g = !0;
2144
+ }
2145
+ }
2146
+ let de = k.match(/<([A-Z][A-Za-z0-9]*)(?:\s[^>]*)?>([^<]*)$/);
2147
+ if (de && de.index !== void 0) {
2148
+ for (var ie = !1, fe = 0, Le = 0; Le < de.index; Le++) k.charCodeAt(Le) === ne && fe++;
2149
+ if (ie = fe % 2 === 1, !ie) {
2150
+ let ue = de[1];
2151
+ hr(k, "</" + ue, 0) === -1 && (k = k.replace(/<[A-Z][A-Za-z0-9]*(?:\s[^>]*)?>([^<]*)$/, "$1"));
2152
+ }
2153
+ }
2154
+ k !== se && (e = e.slice(0, t) + k, r = t + k.length);
2155
+ }
2156
+ let re = [];
2157
+ var he = [];
2158
+ let P = t;
2159
+ var V = n.disableAutoLink || n.disableBareUrls || l.inAnchor ? -1 : e.indexOf("@", t);
2160
+ for (V >= r && (V = -1); t < r; ) {
2161
+ let M = e.charCodeAt(t), k = null;
2162
+ if (M === ne) {
2163
+ if (k = Pn(e, t, r), !k) {
2164
+ var Ee = Cr(e, t, r, ne);
2165
+ t += Ee - 1;
2166
+ }
2167
+ } else if (M === xe || M === pe) {
2168
+ var z = Xn(e, t, r);
2169
+ if (z) {
2170
+ if (z.canOpen || z.canClose) {
2171
+ t > P && re.push(Sr(e.slice(P, t)));
2172
+ var Pe = e.slice(t, t + z.len), ye = Sr(Pe);
2173
+ he.push({ idx: re.length, ch: M, len: z.len, canOpen: z.canOpen, canClose: z.canClose, active: !0 }), re.push(ye), t += z.len, P = t;
2174
+ continue;
2175
+ }
2176
+ t += z.len - 1;
2177
+ }
2178
+ } else M === Te ? k = Dn(e, t, r, l, n) : M === Ke ? k = Wn(e, t, r, l, n) : M === Ce ? (t + 1 < r && e.charCodeAt(t + 1) === ar && (k = Fn(e, t, r)), k || (k = sa(e, t, r, l, n))) : M === ze && t + 1 < r && e.charCodeAt(t + 1) === Ce ? k = sa(e, t, r, l, n) : M === ce ? (k = Ba(e, t, r), !k && !n.disableParsingRawHTML && !n.ignoreHTMLBlocks && (k = Gn(e, t, r, l, n))) : (M === ht || M === Mr || M === Pr) && !l.inAnchor && !n.disableAutoLink && (t === 0 || e.charCodeAt(t - 1) !== ce) && (k = Kn(e, t, r, n));
2179
+ if (!k && V >= 0 && V - t <= 64 && !l.inAnchor && !n.disableAutoLink && !n.disableBareUrls && (M >= Y && M <= Z || M >= Ae && M <= ge || M >= $ && M <= ee) && (k = qn(e, t, r, n), !k && t >= V && (V = e.indexOf("@", t + 1), V >= r && (V = -1))), M === Ca) {
2180
+ t > P && re.push(Sr(e.slice(P, t))), re.push({ type: x.breakLine }), t++, P = t;
2181
+ continue;
2182
+ }
2183
+ if (k) t > P && re.push(Sr(e.slice(P, t))), re.push(k.node), t = k.end, P = t;
2184
+ else {
2185
+ if (M === we && t + 1 < r) {
2186
+ let se = e.charCodeAt(t + 1);
2187
+ if (jt(se) & Q) {
2188
+ t > P && re.push(Sr(e.slice(P, t))), re.push(Sr(e[t + 1])), t += 2, P = t;
2189
+ continue;
2190
+ }
2191
+ }
2192
+ if (t++, V < 0 || V - t > 64) for (; t < r; ) {
2193
+ var ve = e.charCodeAt(t);
2194
+ if (ve < Gr && !va[ve]) t++;
2195
+ else break;
2196
+ }
2197
+ }
2198
+ }
2199
+ if (r > P) {
2200
+ let M = e.slice(P, r);
2201
+ (n.streaming || n.optimizeForStreaming) && (M = M.replace(/\*\*([^*]+)$/, "$1"), M.match(/\*[^*]+$/) && (M = M.replace(/\*([^*]+)$/, "$1")), M = M.replace(/__([^_]+)$/, "$1"), M.match(/_[^_]+$/) && (M = M.replace(/_([^_]+)$/, "$1")), M = M.replace(/~~([^~]+)$/, "$1"), M = M.replace(/\[([^\]]+)$/, "$1"), M = M.replace(/\[([^\]]+)\]\([^)]*$/, "$1")), M && re.push(Sr(M));
2202
+ }
2203
+ return he.length > 0 && Un(re, he), Kr--, re;
2204
+ }
2205
+ var Vn = 500;
2206
+ function kr(e, t, r) {
2207
+ var a = t.g || 0;
2208
+ if (a > Vn) return [{ type: x.text, text: e }];
2209
+ if (t.g = a + 1, r.streaming || r.optimizeForStreaming) {
2210
+ var n = e.length;
2211
+ n > 0 && e.charCodeAt(n - 1) === D && n--;
2212
+ for (var l = n; l > 0 && e.charCodeAt(l - 1) !== D; ) l--;
2213
+ if (l > 0 && e.charCodeAt(l) === Be) {
2214
+ for (var i = !0, o = l; o < n; o++) {
2215
+ var c = e.charCodeAt(o);
2216
+ if (c !== B && c !== E && c !== q && c !== Ne && c !== Be) {
2217
+ i = !1;
2218
+ break;
2219
+ }
2220
+ }
2221
+ if (i) {
2222
+ for (var f = l - 1; f > 0 && e.charCodeAt(f - 1) !== D; ) f--;
2223
+ e.charCodeAt(f) === Be && (e = e.slice(0, f).trimEnd());
2224
+ }
2225
+ }
2226
+ var s = e.trim(), u = s.lastIndexOf(`
2227
+ `), C = u === -1 ? s : s.slice(u + 1);
2228
+ if (C.length > 0 && C.charCodeAt(0) === Be) {
2229
+ for (var A = !1, p = !1, d = 1; d < C.length; d++) {
2230
+ var h = C.charCodeAt(d);
2231
+ h === Be && (A = !0), h === q && (p = !0);
2232
+ }
2233
+ A && p && (e = u === -1 ? "" : e.slice(0, e.lastIndexOf(C)).trimEnd());
2234
+ }
2235
+ for (var v = -1, y = -1, m = -1, L = e.length - 1; L >= 0; L--) if (e.charCodeAt(L) === ce) {
2236
+ var w = L + 1 < e.length ? e.charCodeAt(L + 1) : 0;
2237
+ if (w >= Y && w <= Z || w >= Ae && w <= ge) {
2238
+ for (var g = L + 2; g < e.length; ) {
2239
+ var I = e.charCodeAt(g);
2240
+ if (I >= Y && I <= Z || I >= Ae && I <= ge || I >= $ && I <= ee) g++;
2241
+ else break;
2242
+ }
2243
+ for (var O = g; O < e.length && e.charCodeAt(O) !== U; ) O++;
2244
+ if (O < e.length) {
2245
+ for (var S = !1, T = O + 1; T < e.length; T++) if (e.charCodeAt(T) === ce) {
2246
+ S = !0;
2247
+ break;
2248
+ }
2249
+ S || (v = L, y = g, m = O + 1);
2250
+ }
2251
+ }
2252
+ break;
2253
+ }
2254
+ if (v >= 0) {
2255
+ for (var R = 0, H = 0; H < v; H++) e.charCodeAt(H) === ne && R++;
2256
+ if (R % 2 === 0) {
2257
+ var N = e.slice(v + 1, y);
2258
+ hr(e, "</" + N, 0) === -1 && (e = e.slice(0, v) + e.slice(m));
2259
+ }
2260
+ }
2261
+ var W = e.length;
2262
+ if (W > 0) {
2263
+ for (var j = e.lastIndexOf(`
2264
+ `), b = j === -1 ? 0 : j + 1, J = W, X = b, _ = 0; X < J && e.charCodeAt(X) === B && _ < 3; ) X++, _++;
2265
+ if (X < J) {
2266
+ var ie = e.charCodeAt(X), fe = !1;
2267
+ if (ie === xe || ie === q || ie === Br) {
2268
+ var Le = X + 1;
2269
+ if (Le >= J || e.charCodeAt(Le) === B || e.charCodeAt(Le) === E) {
2270
+ for (var re = Le; re < J && (e.charCodeAt(re) === B || e.charCodeAt(re) === E); ) re++;
2271
+ re >= J && (fe = !0);
2272
+ }
2273
+ } else if (ie >= $ && ie <= ee) {
2274
+ for (var he = X; he < J && e.charCodeAt(he) >= $ && e.charCodeAt(he) <= ee; ) he++;
2275
+ if (he < J && (e.charCodeAt(he) === Qe || e.charCodeAt(he) === $e)) {
2276
+ var P = he + 1;
2277
+ if (P >= J || e.charCodeAt(P) === B || e.charCodeAt(P) === E) {
2278
+ for (var V = P; V < J && (e.charCodeAt(V) === B || e.charCodeAt(V) === E); ) V++;
2279
+ V >= J && (fe = !0);
2280
+ }
2281
+ }
2282
+ }
2283
+ fe && (e = e.slice(0, b).trimEnd());
2284
+ }
2285
+ }
2286
+ }
2287
+ if (t.inline) return je(e, 0, e.length, t, r);
2288
+ let Ee = [], z = 0, Pe = e.length;
2289
+ if (z === 0 && e.startsWith("---")) {
2290
+ let F = on(e);
2291
+ if (F && F.hasValidYaml) {
2292
+ if (r.preserveFrontmatter !== !1) {
2293
+ let Re = e.slice(0, F.endPos).trimEnd();
2294
+ Ee.push({ type: x.frontmatter, text: Re });
2295
+ }
2296
+ z = F.endPos;
2297
+ }
2298
+ }
2299
+ for (; z < Pe; ) {
2300
+ for (var ye = e.indexOf(`
2301
+ `, z), ve = ye < 0 ? Pe : ye; z < Pe && qe(e, z, ve); ) z = ve < Pe ? ve + 1 : ve, z < Pe && (ye = e.indexOf(`
2302
+ `, z), ve = ye < 0 ? Pe : ye);
2303
+ if (z >= Pe) break;
2304
+ e.charCodeAt(z), me(e, z, ve);
2305
+ let F = null;
2306
+ if (e.charCodeAt(z) !== it && ae >= 4 && !t.inHTML) F = Sn(e, z);
2307
+ else if (e.charCodeAt(z) !== it) {
2308
+ let Re = z + te, de = e.charCodeAt(Re);
2309
+ de === or ? F = ya(e, z, t, r) : de === U ? F = In(e, z, t, r) : de === ne || de === Te ? F = En(e, z) : de === q || de === xe || de === pe ? (F = yr(e, z), !F && (F = ia(e, z, t, r))) : de === Br || de >= $ && de <= ee ? F = ia(e, z, t, r) : de === ce ? F = wa(e, z, t, r) : de === Be ? F = ca(e, z, t, r) : de === Ce && (F = Nn(e, z, t));
2310
+ }
2311
+ if (!F) {
2312
+ for (var M = !1, k = z; k < ve; k++) if (e.charCodeAt(k) === Be) {
2313
+ M = !0;
2314
+ break;
2315
+ }
2316
+ M && (F = ca(e, z, t, r));
2317
+ }
2318
+ if (F || (F = Mn(e, z, t, r)), F) F.node.type !== x.refCollection && Ee.push(F.node), z = F.end;
2319
+ else {
2320
+ var se = e.indexOf(`
2321
+ `, z);
2322
+ z = se < 0 ? Pe : se + 1;
2323
+ }
2324
+ }
2325
+ return t.g = a, Ee;
2326
+ }
2327
+ function Zn(e, t, r, a) {
2328
+ var n = sr(e, t);
2329
+ return n ? { tagName: n.tag, tagLower: n.tag.toLowerCase(), attrs: n.rawAttrs, whitespaceBeforeAttrs: n.whitespaceBeforeAttrs, isSelfClosing: n.selfClosing, hasSpaceBeforeSlash: n.hasSpaceBeforeSlash, isClosing: n.isClosing, hasNewline: n.whitespaceBeforeAttrs.includes(`
2330
+ `) || n.rawAttrs.includes(`
2331
+ `), endPos: n.end } : null;
2332
+ }
2333
+ function Mt(e, t, r) {
2334
+ Kr = 0, e = pn(e), !t.refs && (t.refs = {}), ga(e, t.refs);
2335
+ let a = kr(e, t, r);
2336
+ return t.refs && Object.keys(t.refs).length > 0 ? [{ type: x.refCollection, refs: t.refs }, ...a] : a;
2337
+ }
2338
+ var Qn = /^\n+/, St;
2339
+ try {
2340
+ St = xr.createElement("div").$$typeof;
2341
+ } catch {
2342
+ St = /* @__PURE__ */ Symbol.for("react.transitional.element");
2343
+ }
2344
+ function It(e, t, r) {
2345
+ var a = { $$typeof: St, type: e, key: r != null ? "" + r : null, ref: null, props: t, h: null };
2346
+ return a;
2347
+ }
2348
+ var $n = typeof xr.createContext < "u" ? xr.createContext(void 0) : void 0;
2349
+ function ha(e, t, r, a, n, l, i, o) {
2350
+ switch (e.type) {
2351
+ case x.blockQuote: {
2352
+ let d = { key: r.key };
2353
+ return e.alert && (d.className = "markdown-alert-" + l(e.alert.toLowerCase(), ir), e.children.unshift({ attrs: {}, children: [{ type: x.text, text: e.alert }], c: !0, type: x.htmlBlock, tag: "header" })), a("blockquote", d, t(e.children, r));
2354
+ }
2355
+ case x.breakLine:
2356
+ return a("br", { key: r.key });
2357
+ case x.breakThematic:
2358
+ return a("hr", { key: r.key });
2359
+ case x.frontmatter:
2360
+ return o.preserveFrontmatter ? a("pre", { key: r.key }, e.text) : null;
2361
+ case x.codeBlock:
2362
+ let p = e.lang ? Ct(e.lang) : "";
2363
+ return a("pre", { key: r.key }, a("code", { ...Fe(e.attrs || {}), className: p ? `language-${p} lang-${p}` : "" }, e.text));
2364
+ case x.codeInline:
2365
+ return a("code", { key: r.key }, e.text);
2366
+ case x.footnoteReference:
2367
+ return a("a", { key: r.key, href: n(e.target, "a", "href") || void 0 }, a("sup", { key: r.key }, e.text));
2368
+ case x.gfmTask:
2369
+ return a("input", { checked: e.completed, key: r.key, readOnly: !0, type: "checkbox" });
2370
+ case x.heading:
2371
+ return a(`h${e.level}`, { id: e.id, key: r.key }, t(e.children, r));
2372
+ case x.htmlBlock: {
2373
+ let d = e;
2374
+ if (o.tagfilter && ea(d.tag)) {
2375
+ var c = "";
2376
+ if (d.attrs) for (var f in d.attrs) {
2377
+ var s = d.attrs[f];
2378
+ s === !0 ? c += " " + f : s != null && s !== !1 && (c += " " + f + '="' + String(s) + '"');
2379
+ }
2380
+ return a("span", { key: r.key }, "<" + d.tag + c + ">");
2381
+ }
2382
+ if (d.a && d.c) {
2383
+ let h = function(b) {
2384
+ if ((b.type === x.htmlSelfClosing || b.type === x.htmlBlock) && b.b) return [];
2385
+ if (b.type === x.paragraph) {
2386
+ let J = b.children;
2387
+ return J ? J.flatMap(h) : [];
2388
+ }
2389
+ return b.type === x.text ? b.text?.trim() ? [b] : [] : b.type === x.htmlBlock && b.children ? [{ ...b, children: b.children?.flatMap(h) }] : [b];
2390
+ }, v = function(b) {
2391
+ for (var J = 0; J < b.length; J++) b[J].type === x.htmlBlock && (b[J].c = !1), "children" in b[J] && b[J].children && v(b[J].children);
2392
+ }, y = function(b, J) {
2393
+ for (var X = 0; X < b.length; X++) {
2394
+ var _ = b[X];
2395
+ if (_.type === x.paragraph && _.children) for (var ie = _.children, fe = 0; fe < ie.length; fe++) {
2396
+ var Le = ie[fe];
2397
+ if (Le.type === x.htmlSelfClosing && Le.b && Le.tag.toLowerCase() === J) {
2398
+ var re = b.slice(0, X);
2399
+ fe > 0 && re.push({ type: x.paragraph, children: ie.slice(0, fe) });
2400
+ var he = [];
2401
+ if (fe + 1 < ie.length) {
2402
+ var P = ie.slice(fe + 1);
2403
+ P = P.filter(function(V) {
2404
+ return !(V.type === x.htmlSelfClosing && V.b);
2405
+ }), P.length > 0 && (he = P);
2406
+ }
2407
+ return he = he.concat(b.slice(X + 1)), { found: !0, beforeClose: re, afterClose: he };
2408
+ }
2409
+ }
2410
+ if ((_.type === x.htmlSelfClosing || _.type === x.htmlBlock) && _.b && _.tag.toLowerCase() === J) return { found: !0, beforeClose: b.slice(0, X), afterClose: b.slice(X + 1) };
2411
+ }
2412
+ return { found: !1, beforeClose: b, afterClose: [] };
2413
+ }, m = d.tag.toLowerCase(), L = Bn(m), w = d.children && d.children.length > 0, g = /<[a-z][^>]{0,100}>/i.test(d.a);
2414
+ if (L) {
2415
+ let b = d.a.replace(new RegExp("\\s*</" + m + ">\\s*$", "i"), "");
2416
+ return o.tagfilter && (b = ra(b)), g ? a(e.tag, { key: r.key, ...Fe(e.attrs || {}), dangerouslySetInnerHTML: { __html: b } }) : a(e.tag, { key: r.key, ...Fe(e.attrs || {}) }, b);
2417
+ }
2418
+ let I = new RegExp(`^<${d.tag}(\\s|>)`, "i").test(d.a);
2419
+ if (w && !I && o.tagfilter && yn(d.a)) return a(e.tag, { key: r.key, ...Fe(e.attrs || {}) }, t(d.children, r));
2420
+ if (Tn(d.a)) {
2421
+ let b = o.tagfilter ? ra(d.a) : d.a;
2422
+ return a(e.tag, { key: r.key, ...Fe(e.attrs || {}), dangerouslySetInnerHTML: { __html: b } });
2423
+ }
2424
+ let O = { slugify: (b) => l(b, ir), sanitizer: n, tagfilter: !0 }, S = d.a.replace(/>\s+</g, "><").replace(/\n+/g, " ").trim();
2425
+ if (new RegExp(`^<${d.tag}(\\s[^>]*)?>(\\s*</${d.tag}>)?$`, "i").test(S)) return d.children && d.children.length > 0 ? a(e.tag, { key: r.key, ...Fe(e.attrs || {}) }, t(d.children, r)) : a(e.tag, { key: r.key, ...Fe(e.attrs || {}) });
2426
+ let T = Mt(S, { inline: !1, refs: i, inHTML: !1 }, O);
2427
+ v(T);
2428
+ let R = d.tag.toLowerCase(), H = "</" + R + ">", N = new RegExp(`^<${d.tag}(\\s|>)`, "i").test(S), W = S.toLowerCase().trimEnd().endsWith(H), j = N && W;
2429
+ if (j && w) return a(e.tag, { key: r.key, ...Fe(e.attrs || {}) }, t(d.children, r));
2430
+ if (j) return t(T.flatMap(h), r);
2431
+ var u = y(T, R);
2432
+ if (u.found && u.afterClose.length > 0) {
2433
+ var C = u.beforeClose.flatMap(h), A = u.afterClose.flatMap(h);
2434
+ return It(xr.Fragment, { children: [a(e.tag, { key: r.key, ...Fe(e.attrs || {}) }, t(C, r)), t(A, r)] }, null);
2435
+ }
2436
+ return a(e.tag, { key: r.key, ...Fe(e.attrs || {}) }, t(T.flatMap(h), r));
2437
+ }
2438
+ return Yr(e.tag) ? a(e.tag, { key: r.key, ...Fe(e.attrs || {}) }) : a(e.tag, { key: r.key, ...Fe(e.attrs || {}) }, e.children ? t(e.children, r) : "");
2439
+ }
2440
+ case x.htmlSelfClosing: {
2441
+ let d = e;
2442
+ if (o.tagfilter && ea(d.tag)) {
2443
+ var c = "";
2444
+ if (d.attrs) for (var f in d.attrs) {
2445
+ var s = d.attrs[f];
2446
+ s === !0 ? c += " " + f : s != null && s !== !1 && (c += " " + f + '="' + String(s) + '"');
2447
+ }
2448
+ return a("span", { key: r.key }, "<" + d.tag + c + " />");
2449
+ }
2450
+ return a(e.tag, { key: r.key, ...Fe(e.attrs || {}) });
2451
+ }
2452
+ case x.image: {
2453
+ let d = e.target != null ? n(e.target, "img", "src") : null;
2454
+ return a("img", { key: r.key, alt: e.alt && e.alt.length > 0 ? e.alt : void 0, title: e.title || void 0, src: d || void 0 });
2455
+ }
2456
+ case x.link: {
2457
+ let d = { key: r.key };
2458
+ return e.target != null && (d.href = gn(e.target)), e.title && (d.title = e.title), a("a", d, t(e.children, r));
2459
+ }
2460
+ case x.table: {
2461
+ let d = e;
2462
+ return a("table", { key: r.key }, a("thead", null, a("tr", null, d.header.map(function(h, v) {
2463
+ return a("th", { key: v, style: d.align[v] == null ? {} : { textAlign: d.align[v] } }, t(h, r));
2464
+ }))), a("tbody", null, d.cells.map(function(h, v) {
2465
+ return a("tr", { key: v }, h.map(function(y, m) {
2466
+ return a("td", { key: m, style: d.align[m] == null ? {} : { textAlign: d.align[m] } }, t(y, r));
2467
+ }));
2468
+ })));
2469
+ }
2470
+ case x.text:
2471
+ return e.text;
2472
+ case x.textFormatted:
2473
+ return a(e.tag, { key: r.key }, t(e.children, r));
2474
+ case x.orderedList:
2475
+ case x.unorderedList: {
2476
+ let d = e.type === x.orderedList ? "ol" : "ul";
2477
+ return a(d, { key: r.key, start: e.type === x.orderedList ? e.start : void 0 }, e.items.map(function(h, v) {
2478
+ return a("li", { key: v }, t(h, r));
2479
+ }));
2480
+ }
2481
+ case x.paragraph:
2482
+ return a("p", { key: r.key }, t(e.children, r));
2483
+ case x.ref:
2484
+ return null;
2485
+ default:
2486
+ return null;
2487
+ }
2488
+ }
2489
+ var el = (e, t, r, a, n, l) => {
2490
+ var i = (c) => c.map(function(f) {
2491
+ return "text" in f ? f.text : "";
2492
+ }), o = (c, f = {}) => {
2493
+ var s = (f.renderDepth || 0) + 1;
2494
+ if (s > 2500) return i(c);
2495
+ f.renderDepth = s;
2496
+ for (var u = f.key, C = [], A = !1, p = 0; p < c.length; p++) {
2497
+ f.key = p;
2498
+ var d;
2499
+ if (e) {
2500
+ var h = ha.bind(null, c[p], o, f, t, r, a, n, l);
2501
+ d = e(h, c[p], o, f);
2502
+ } else d = ha(c[p], o, f, t, r, a, n, l);
2503
+ var v = typeof d == "string";
2504
+ if (v && A) C[C.length - 1] += d;
2505
+ else if (d !== null) if (Array.isArray(d)) for (var y = 0; y < d.length; y++) C.push(d[y]);
2506
+ else C.push(d);
2507
+ A = v;
2508
+ }
2509
+ return f.key = u, f.renderDepth = s - 1, C;
2510
+ };
2511
+ return o;
2512
+ }, rl = (e, t) => {
2513
+ let r = Bt(t, e, void 0);
2514
+ return r ? typeof r == "function" || typeof r == "object" && "render" in r ? r : Bt(t, `${e}.component`, e) : e;
2515
+ };
2516
+ function tl(e, t) {
2517
+ let r = { ...t || {} };
2518
+ r.overrides = r.overrides || {};
2519
+ let a = r.slugify || ir, n = r.sanitizer || Nt, l = r.createElement, i = r.overrides && Object.keys(r.overrides).length > 0, o = (v) => Rt(v, { ...r, wrapper: null });
2520
+ function c(v, y, ...m) {
2521
+ var L = y || {};
2522
+ for (var w in L) {
2523
+ var g = L[w];
2524
+ if (typeof g == "string" && g.length > 0 && g.charCodeAt(0) === ce && (kn.test(g) || bn.test(g) || Zn(g, 0))) {
2525
+ var I = o(g.trim());
2526
+ L[w] = w === "innerHTML" && Array.isArray(I) ? I[0] : I;
2527
+ }
2528
+ }
2529
+ var O = v;
2530
+ if (i) {
2531
+ var S = Bt(r.overrides, v + ".props", {});
2532
+ O = rl(v, r.overrides), L = { ...L, ...S, className: mn(L.className, S.className) || void 0 };
2533
+ }
2534
+ if (!l) {
2535
+ var T = L.key;
2536
+ return T != null && delete L.key, m.length === 1 ? L.children = m[0] : m.length > 1 && (L.children = m), It(O, L, T);
2537
+ }
2538
+ return l(O, L, ...m);
2539
+ }
2540
+ let f = { ...r, slugify: (v) => a(v, ir), sanitizer: n, tagfilter: r.tagfilter !== !1 }, s = e[0] && e[0].type === x.refCollection ? e[0].refs : {}, u = el(r.renderRule, c, n, a, s, r), C = u(e, { inline: r.forceInline, refs: s }), A = [];
2541
+ for (let v in s) v.charCodeAt(0) === ar && A.push({ identifier: v, footnote: s[v].target });
2542
+ if (A.length && C.push(c("footer", { key: "footer" }, A.map(function(v) {
2543
+ let y = v.identifier.charCodeAt(0) === ar ? v.identifier.slice(1) : v.identifier, m = Mt(v.footnote, { inline: !0, refs: s }, f);
2544
+ return c("div", { id: a(y, ir), key: v.identifier }, y + ": ", u(m, { inline: !0, refs: s }));
2545
+ }))), r.wrapper === null) return C;
2546
+ let p = r.wrapper || (r.forceInline ? "span" : "div"), d;
2547
+ if (C.length > 1 || r.forceWrapper) d = C;
2548
+ else return C.length === 1 ? C[0] : null;
2549
+ var h = r.wrapperProps ? { ...r.wrapperProps } : {};
2550
+ return h.children = d, It(p, h, "outer");
2551
+ }
2552
+ function Rt(e = "", t = {}) {
2553
+ let r = { ...t || {} };
2554
+ r.overrides = r.overrides || {};
2555
+ let a = r.slugify || ir, n = r.sanitizer || Nt;
2556
+ function l(o) {
2557
+ let c = r.forceInline || !r.forceBlock && !dn.test(o), f = { ...r, slugify: (C) => a(C, ir), sanitizer: n, tagfilter: r.tagfilter !== !1 };
2558
+ c || ga(o, i);
2559
+ let s = o;
2560
+ if (!c) {
2561
+ let C = s.length;
2562
+ for (; C > 0 && (s[C - 1] === `
2563
+ ` || s[C - 1] === "\r"); ) C--;
2564
+ s = s.slice(0, C), s = `${s.replace(Qn, "")}
2565
+
2566
+ `;
2567
+ }
2568
+ if (r.optimizeForStreaming) {
2569
+ let C = s.lastIndexOf("<");
2570
+ C !== -1 && s.slice(C).indexOf(">") === -1 && (s = s.slice(0, C));
2571
+ }
2572
+ let u = Mt(c ? o : s, { inline: c, refs: i }, f);
2573
+ return tl(u, { ...f, forceInline: c });
2574
+ }
2575
+ let i = {};
2576
+ return l(e);
2577
+ }
2578
+ var al = ({ children: e, options: t, ...r }) => {
2579
+ if (!(typeof xr.useContext < "u")) {
2580
+ let i = { ...t, overrides: { ...t?.overrides }, wrapperProps: { ...t?.wrapperProps, ...r } };
2581
+ return Rt(e ?? "", i);
2582
+ }
2583
+ let a = xr.useContext($n), n = xr.useMemo(() => ({ ...a, ...t, overrides: { ...a?.overrides, ...t?.overrides }, wrapperProps: { ...a?.wrapperProps, ...t?.wrapperProps, ...r } }), [a, t, r]), l = e ?? "";
2584
+ return xr.useMemo(() => Rt(l, n), [l, n]);
2585
+ }, nl = al;
2586
+ const ll = $a.memo(function({
2587
+ displayConfig: t = {},
2588
+ height: r = "100%",
2589
+ colorPalette: a
2590
+ }) {
2591
+ const n = t.content || "", l = t.accentColorIndex ?? 0, i = t.fontSize || "medium", o = t.alignment || "left", c = !!t.transparentBackground, f = t.accentBorder || "none", s = Ft(() => a?.colors && l < a.colors.length ? a.colors[l] : "#8884d8", [a, l]), u = {
2592
+ small: "dc:text-sm",
2593
+ medium: "dc:text-lg",
2594
+ large: "dc:text-xl"
2595
+ }, C = {
2596
+ left: "dc:text-left",
2597
+ center: "dc:text-center",
2598
+ right: "dc:text-right"
2599
+ }, A = {
2600
+ small: { 1: "dc:text-lg", 2: "dc:text-base", 3: "dc:text-sm" },
2601
+ medium: { 1: "dc:text-3xl", 2: "dc:text-2xl", 3: "dc:text-xl" },
2602
+ large: { 1: "dc:text-5xl", 2: "dc:text-4xl", 3: "dc:text-3xl" }
2603
+ }, p = { 1: "dc:mb-4", 2: "dc:mb-3", 3: "dc:mb-2" }, d = Ft(() => ({
2604
+ overrides: {
2605
+ h1: {
2606
+ props: {
2607
+ className: `dc:font-bold ${A[i]?.[1] || "dc:text-3xl"} ${p[1]}`,
2608
+ style: { color: s }
2609
+ }
2610
+ },
2611
+ h2: {
2612
+ props: {
2613
+ className: `dc:font-bold ${A[i]?.[2] || "dc:text-2xl"} ${p[2]}`,
2614
+ style: { color: s }
2615
+ }
2616
+ },
2617
+ h3: {
2618
+ props: {
2619
+ className: `dc:font-bold ${A[i]?.[3] || "dc:text-xl"} ${p[3]}`,
2620
+ style: { color: s }
2621
+ }
2622
+ },
2623
+ p: { props: { className: "dc:mb-3 dc:leading-relaxed text-dc-text" } },
2624
+ strong: { props: { className: "dc:font-bold text-dc-text" } },
2625
+ em: { props: { className: "dc:italic text-dc-text" } },
2626
+ a: {
2627
+ props: {
2628
+ className: "dc:hover:underline dc:transition-colors",
2629
+ target: "_blank",
2630
+ rel: "nofollow noopener noreferrer",
2631
+ style: { color: s }
2632
+ }
2633
+ },
2634
+ code: { props: { className: "dc:px-1 dc:py-0.5 dc:rounded dc:text-xs bg-dc-surface-secondary text-dc-accent dc:font-mono" } },
2635
+ pre: { props: { className: "dc:rounded-lg dc:p-3 dc:my-2 dc:overflow-x-auto dc:text-xs bg-dc-surface-secondary text-dc-text dc:font-mono" } },
2636
+ ul: { props: { className: "dc:list-disc dc:ml-6 dc:mb-3 text-dc-text dc:space-y-1" } },
2637
+ ol: { props: { className: "dc:list-decimal dc:ml-6 dc:mb-3 text-dc-text dc:space-y-1" } },
2638
+ li: { props: { className: "dc:mb-1 text-dc-text" } },
2639
+ blockquote: { props: { className: "dc:border-l-4 border-dc-accent dc:pl-3 dc:my-2 dc:italic text-dc-text-secondary" } },
2640
+ hr: {
2641
+ props: {
2642
+ className: "dc:my-4 dc:border-none",
2643
+ style: { height: "2px", backgroundColor: s, opacity: 0.3 }
2644
+ }
2645
+ },
2646
+ table: { props: { className: "dc:w-full dc:border-collapse dc:my-3 dc:text-sm" } },
2647
+ thead: { props: { className: "bg-dc-surface-secondary" } },
2648
+ th: { props: { className: "dc:px-3 dc:py-2 dc:text-left dc:font-semibold dc:text-xs text-dc-text-secondary dc:uppercase dc:tracking-wider border-dc-border dc:border-b" } },
2649
+ td: { props: { className: "dc:px-3 dc:py-2 text-dc-text border-dc-border dc:border-b" } },
2650
+ tr: { props: { className: "dc:hover:opacity-80" } }
2651
+ }
2652
+ }), [s, i]);
2653
+ if (!n.trim())
2654
+ return c ? null : /* @__PURE__ */ Ur(
2655
+ "div",
2656
+ {
2657
+ className: "dc:flex dc:items-center dc:justify-center dc:w-full dc:h-full",
2658
+ style: {
2659
+ height: r === "100%" ? "100%" : r
2660
+ },
2661
+ children: /* @__PURE__ */ Qa("div", { className: "dc:text-center text-dc-text-muted", children: [
2662
+ /* @__PURE__ */ Ur("div", { className: "dc:text-sm dc:font-semibold dc:mb-1", children: "No content" }),
2663
+ /* @__PURE__ */ Ur("div", { className: "dc:text-xs text-dc-text-secondary", children: "Add markdown content in the chart configuration" })
2664
+ ] })
2665
+ }
2666
+ );
2667
+ const h = {};
2668
+ if (f !== "none") {
2669
+ const v = `border${f.charAt(0).toUpperCase() + f.slice(1)}`;
2670
+ if (h[v] = `4px solid ${s}`, c) {
2671
+ const y = `padding${f.charAt(0).toUpperCase() + f.slice(1)}`;
2672
+ f === "left" && (h[y] = "12px");
2673
+ }
2674
+ }
2675
+ return /* @__PURE__ */ Ur(
2676
+ "div",
2677
+ {
2678
+ className: `dc:w-full dc:overflow-auto ${c ? "" : "dc:p-4 "}${u[i] || "dc:text-lg"} ${C[o] || "dc:text-left"}`,
2679
+ style: {
2680
+ height: r === "100%" ? "100%" : r,
2681
+ ...h
2682
+ },
2683
+ children: /* @__PURE__ */ Ur(nl, { options: d, children: n })
2684
+ }
2685
+ );
2686
+ }), cl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2687
+ __proto__: null,
2688
+ default: ll
2689
+ }, Symbol.toStringTag, { value: "Module" }));
2690
+ export {
2691
+ ll as M,
2692
+ nl as Q,
2693
+ cl as a
2694
+ };
2695
+ //# sourceMappingURL=chart-markdown-Du4Z2iqK.js.map