@zettelgeist/cli 0.1.0

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 (189) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +64 -0
  3. package/dist/bin.js +2211 -0
  4. package/dist/bin.js.map +7 -0
  5. package/dist/templates/export.html +27 -0
  6. package/dist/templates/skill/SKILL.md +220 -0
  7. package/dist/viewer-bundle/architecture-YZFGNWBL-W2K3EQOM.js +14 -0
  8. package/dist/viewer-bundle/architecture-YZFGNWBL-W2K3EQOM.js.map +7 -0
  9. package/dist/viewer-bundle/architectureDiagram-Q4EWVU46-LCGRUEWT.js +8884 -0
  10. package/dist/viewer-bundle/architectureDiagram-Q4EWVU46-LCGRUEWT.js.map +7 -0
  11. package/dist/viewer-bundle/base.css +248 -0
  12. package/dist/viewer-bundle/blockDiagram-DXYQGD6D-KAM7BOAP.js +3777 -0
  13. package/dist/viewer-bundle/blockDiagram-DXYQGD6D-KAM7BOAP.js.map +7 -0
  14. package/dist/viewer-bundle/board.css +370 -0
  15. package/dist/viewer-bundle/c4Diagram-AHTNJAMY-C3FIQYXA.js +2596 -0
  16. package/dist/viewer-bundle/c4Diagram-AHTNJAMY-C3FIQYXA.js.map +7 -0
  17. package/dist/viewer-bundle/chunk-2QXGXAO5.js +68 -0
  18. package/dist/viewer-bundle/chunk-2QXGXAO5.js.map +7 -0
  19. package/dist/viewer-bundle/chunk-5PZT7VUU.js +67 -0
  20. package/dist/viewer-bundle/chunk-5PZT7VUU.js.map +7 -0
  21. package/dist/viewer-bundle/chunk-5YJCJF2C.js +112 -0
  22. package/dist/viewer-bundle/chunk-5YJCJF2C.js.map +7 -0
  23. package/dist/viewer-bundle/chunk-6LYV7PBV.js +1011 -0
  24. package/dist/viewer-bundle/chunk-6LYV7PBV.js.map +7 -0
  25. package/dist/viewer-bundle/chunk-6VW7D5WX.js +48 -0
  26. package/dist/viewer-bundle/chunk-6VW7D5WX.js.map +7 -0
  27. package/dist/viewer-bundle/chunk-76C5OSD4.js +2048 -0
  28. package/dist/viewer-bundle/chunk-76C5OSD4.js.map +7 -0
  29. package/dist/viewer-bundle/chunk-7NZMPQDX.js +6957 -0
  30. package/dist/viewer-bundle/chunk-7NZMPQDX.js.map +7 -0
  31. package/dist/viewer-bundle/chunk-A634GTZN.js +122 -0
  32. package/dist/viewer-bundle/chunk-A634GTZN.js.map +7 -0
  33. package/dist/viewer-bundle/chunk-AJQJUKMU.js +133 -0
  34. package/dist/viewer-bundle/chunk-AJQJUKMU.js.map +7 -0
  35. package/dist/viewer-bundle/chunk-BM2KPNFW.js +5556 -0
  36. package/dist/viewer-bundle/chunk-BM2KPNFW.js.map +7 -0
  37. package/dist/viewer-bundle/chunk-CIDUOCCG.js +25 -0
  38. package/dist/viewer-bundle/chunk-CIDUOCCG.js.map +7 -0
  39. package/dist/viewer-bundle/chunk-CZHJHAOR.js +6397 -0
  40. package/dist/viewer-bundle/chunk-CZHJHAOR.js.map +7 -0
  41. package/dist/viewer-bundle/chunk-D5RLIWY4.js +125 -0
  42. package/dist/viewer-bundle/chunk-D5RLIWY4.js.map +7 -0
  43. package/dist/viewer-bundle/chunk-DI52DQAC.js +44 -0
  44. package/dist/viewer-bundle/chunk-DI52DQAC.js.map +7 -0
  45. package/dist/viewer-bundle/chunk-EXJQLTIV.js +51 -0
  46. package/dist/viewer-bundle/chunk-EXJQLTIV.js.map +7 -0
  47. package/dist/viewer-bundle/chunk-G3PPZWPW.js +96 -0
  48. package/dist/viewer-bundle/chunk-G3PPZWPW.js.map +7 -0
  49. package/dist/viewer-bundle/chunk-GTW4IDD4.js +30297 -0
  50. package/dist/viewer-bundle/chunk-GTW4IDD4.js.map +7 -0
  51. package/dist/viewer-bundle/chunk-GVE7OA3Z.js +59 -0
  52. package/dist/viewer-bundle/chunk-GVE7OA3Z.js.map +7 -0
  53. package/dist/viewer-bundle/chunk-JBUVKVPY.js +2042 -0
  54. package/dist/viewer-bundle/chunk-JBUVKVPY.js.map +7 -0
  55. package/dist/viewer-bundle/chunk-JQLVOAQB.js +20 -0
  56. package/dist/viewer-bundle/chunk-JQLVOAQB.js.map +7 -0
  57. package/dist/viewer-bundle/chunk-LQMQSYLO.js +101 -0
  58. package/dist/viewer-bundle/chunk-LQMQSYLO.js.map +7 -0
  59. package/dist/viewer-bundle/chunk-MBFAQ3IK.js +34 -0
  60. package/dist/viewer-bundle/chunk-MBFAQ3IK.js.map +7 -0
  61. package/dist/viewer-bundle/chunk-N7G7IIKG.js +25 -0
  62. package/dist/viewer-bundle/chunk-N7G7IIKG.js.map +7 -0
  63. package/dist/viewer-bundle/chunk-NW4YG3NS.js +171 -0
  64. package/dist/viewer-bundle/chunk-NW4YG3NS.js.map +7 -0
  65. package/dist/viewer-bundle/chunk-ODEP5TKB.js +61 -0
  66. package/dist/viewer-bundle/chunk-ODEP5TKB.js.map +7 -0
  67. package/dist/viewer-bundle/chunk-OGKINV23.js +1050 -0
  68. package/dist/viewer-bundle/chunk-OGKINV23.js.map +7 -0
  69. package/dist/viewer-bundle/chunk-OGMSNDVH.js +1994 -0
  70. package/dist/viewer-bundle/chunk-OGMSNDVH.js.map +7 -0
  71. package/dist/viewer-bundle/chunk-QJVSDNAW.js +25 -0
  72. package/dist/viewer-bundle/chunk-QJVSDNAW.js.map +7 -0
  73. package/dist/viewer-bundle/chunk-RBTT26R4.js +2721 -0
  74. package/dist/viewer-bundle/chunk-RBTT26R4.js.map +7 -0
  75. package/dist/viewer-bundle/chunk-RQIPIIE2.js +48 -0
  76. package/dist/viewer-bundle/chunk-RQIPIIE2.js.map +7 -0
  77. package/dist/viewer-bundle/chunk-SRTYTXTX.js +22 -0
  78. package/dist/viewer-bundle/chunk-SRTYTXTX.js.map +7 -0
  79. package/dist/viewer-bundle/chunk-TRL7YIZG.js +1663 -0
  80. package/dist/viewer-bundle/chunk-TRL7YIZG.js.map +7 -0
  81. package/dist/viewer-bundle/chunk-U5T7X4BV.js +172 -0
  82. package/dist/viewer-bundle/chunk-U5T7X4BV.js.map +7 -0
  83. package/dist/viewer-bundle/chunk-UCAW6C6C.js +48 -0
  84. package/dist/viewer-bundle/chunk-UCAW6C6C.js.map +7 -0
  85. package/dist/viewer-bundle/chunk-UEAG4BJQ.js +93 -0
  86. package/dist/viewer-bundle/chunk-UEAG4BJQ.js.map +7 -0
  87. package/dist/viewer-bundle/chunk-UVRE3R6A.js +1039 -0
  88. package/dist/viewer-bundle/chunk-UVRE3R6A.js.map +7 -0
  89. package/dist/viewer-bundle/chunk-VODO7SV4.js +25029 -0
  90. package/dist/viewer-bundle/chunk-VODO7SV4.js.map +7 -0
  91. package/dist/viewer-bundle/chunk-YEU62MVS.js +682 -0
  92. package/dist/viewer-bundle/chunk-YEU62MVS.js.map +7 -0
  93. package/dist/viewer-bundle/chunk-YFQT7PPW.js +987 -0
  94. package/dist/viewer-bundle/chunk-YFQT7PPW.js.map +7 -0
  95. package/dist/viewer-bundle/chunk-Z4G7FG27.js +48 -0
  96. package/dist/viewer-bundle/chunk-Z4G7FG27.js.map +7 -0
  97. package/dist/viewer-bundle/chunk-ZW4Y7DIF.js +2044 -0
  98. package/dist/viewer-bundle/chunk-ZW4Y7DIF.js.map +7 -0
  99. package/dist/viewer-bundle/classDiagram-6PBFFD2Q-7VKYXLUX.js +46 -0
  100. package/dist/viewer-bundle/classDiagram-6PBFFD2Q-7VKYXLUX.js.map +7 -0
  101. package/dist/viewer-bundle/classDiagram-v2-HSJHXN6E-ACCNN7EN.js +46 -0
  102. package/dist/viewer-bundle/classDiagram-v2-HSJHXN6E-ACCNN7EN.js.map +7 -0
  103. package/dist/viewer-bundle/cose-bilkent-S5V4N54A-MUJHAA34.js +5009 -0
  104. package/dist/viewer-bundle/cose-bilkent-S5V4N54A-MUJHAA34.js.map +7 -0
  105. package/dist/viewer-bundle/dagre-KV5264BT-YC5VV3WF.js +739 -0
  106. package/dist/viewer-bundle/dagre-KV5264BT-YC5VV3WF.js.map +7 -0
  107. package/dist/viewer-bundle/dark.css +13 -0
  108. package/dist/viewer-bundle/detail.css +539 -0
  109. package/dist/viewer-bundle/diagram-5BDNPKRD-RXFPVFYK.js +214 -0
  110. package/dist/viewer-bundle/diagram-5BDNPKRD-RXFPVFYK.js.map +7 -0
  111. package/dist/viewer-bundle/diagram-G4DWMVQ6-KN7CBNBQ.js +578 -0
  112. package/dist/viewer-bundle/diagram-G4DWMVQ6-KN7CBNBQ.js.map +7 -0
  113. package/dist/viewer-bundle/diagram-MMDJMWI5-ZN6TQ7ZC.js +345 -0
  114. package/dist/viewer-bundle/diagram-MMDJMWI5-ZN6TQ7ZC.js.map +7 -0
  115. package/dist/viewer-bundle/diagram-TYMM5635-MMTUJ4KA.js +255 -0
  116. package/dist/viewer-bundle/diagram-TYMM5635-MMTUJ4KA.js.map +7 -0
  117. package/dist/viewer-bundle/docs.css +88 -0
  118. package/dist/viewer-bundle/edit-modal-BEGC2AO6.js +176 -0
  119. package/dist/viewer-bundle/edit-modal-BEGC2AO6.js.map +7 -0
  120. package/dist/viewer-bundle/erDiagram-SMLLAGMA-TBHMLD2E.js +1349 -0
  121. package/dist/viewer-bundle/erDiagram-SMLLAGMA-TBHMLD2E.js.map +7 -0
  122. package/dist/viewer-bundle/flowDiagram-DWJPFMVM-BZHLK6QB.js +2501 -0
  123. package/dist/viewer-bundle/flowDiagram-DWJPFMVM-BZHLK6QB.js.map +7 -0
  124. package/dist/viewer-bundle/ganttDiagram-T4ZO3ILL-YBARPTQR.js +2654 -0
  125. package/dist/viewer-bundle/ganttDiagram-T4ZO3ILL-YBARPTQR.js.map +7 -0
  126. package/dist/viewer-bundle/gitGraph-7Q5UKJZL-HENKIQDX.js +14 -0
  127. package/dist/viewer-bundle/gitGraph-7Q5UKJZL-HENKIQDX.js.map +7 -0
  128. package/dist/viewer-bundle/gitGraphDiagram-UUTBAWPF-M4VV3YVA.js +1946 -0
  129. package/dist/viewer-bundle/gitGraphDiagram-UUTBAWPF-M4VV3YVA.js.map +7 -0
  130. package/dist/viewer-bundle/index.html +28 -0
  131. package/dist/viewer-bundle/info-OMHHGYJF-E773USRS.js +14 -0
  132. package/dist/viewer-bundle/info-OMHHGYJF-E773USRS.js.map +7 -0
  133. package/dist/viewer-bundle/infoDiagram-42DDH7IO-C7JGUXKK.js +59 -0
  134. package/dist/viewer-bundle/infoDiagram-42DDH7IO-C7JGUXKK.js.map +7 -0
  135. package/dist/viewer-bundle/ishikawaDiagram-UXIWVN3A-YBC4X4VB.js +1012 -0
  136. package/dist/viewer-bundle/ishikawaDiagram-UXIWVN3A-YBC4X4VB.js.map +7 -0
  137. package/dist/viewer-bundle/journeyDiagram-VCZTEJTY-6WKVEOOO.js +1303 -0
  138. package/dist/viewer-bundle/journeyDiagram-VCZTEJTY-6WKVEOOO.js.map +7 -0
  139. package/dist/viewer-bundle/kanban-definition-6JOO6SKY-URTTHHO4.js +1131 -0
  140. package/dist/viewer-bundle/kanban-definition-6JOO6SKY-URTTHHO4.js.map +7 -0
  141. package/dist/viewer-bundle/katex-QN5266ZE.js +14318 -0
  142. package/dist/viewer-bundle/katex-QN5266ZE.js.map +7 -0
  143. package/dist/viewer-bundle/light.css +15 -0
  144. package/dist/viewer-bundle/main.js +4816 -0
  145. package/dist/viewer-bundle/main.js.map +7 -0
  146. package/dist/viewer-bundle/mermaid.core-AEBXU2JK.js +1708 -0
  147. package/dist/viewer-bundle/mermaid.core-AEBXU2JK.js.map +7 -0
  148. package/dist/viewer-bundle/mindmap-definition-QFDTVHPH-KUMAMRSF.js +1277 -0
  149. package/dist/viewer-bundle/mindmap-definition-QFDTVHPH-KUMAMRSF.js.map +7 -0
  150. package/dist/viewer-bundle/packet-4T2RLAQJ-IRYWWA66.js +14 -0
  151. package/dist/viewer-bundle/packet-4T2RLAQJ-IRYWWA66.js.map +7 -0
  152. package/dist/viewer-bundle/pico.classless.min.css +4 -0
  153. package/dist/viewer-bundle/pie-ZZUOXDRM-JYO4VL5N.js +14 -0
  154. package/dist/viewer-bundle/pie-ZZUOXDRM-JYO4VL5N.js.map +7 -0
  155. package/dist/viewer-bundle/pieDiagram-DEJITSTG-QOEHQN3N.js +238 -0
  156. package/dist/viewer-bundle/pieDiagram-DEJITSTG-QOEHQN3N.js.map +7 -0
  157. package/dist/viewer-bundle/prompt-modal-C4LHI7BS.js +12 -0
  158. package/dist/viewer-bundle/prompt-modal-C4LHI7BS.js.map +7 -0
  159. package/dist/viewer-bundle/quadrantDiagram-34T5L4WZ-SJNPUU5N.js +1409 -0
  160. package/dist/viewer-bundle/quadrantDiagram-34T5L4WZ-SJNPUU5N.js.map +7 -0
  161. package/dist/viewer-bundle/radar-PYXPWWZC-45BRYQSB.js +14 -0
  162. package/dist/viewer-bundle/radar-PYXPWWZC-45BRYQSB.js.map +7 -0
  163. package/dist/viewer-bundle/reason-modal-MK34MQ73.js +68 -0
  164. package/dist/viewer-bundle/reason-modal-MK34MQ73.js.map +7 -0
  165. package/dist/viewer-bundle/requirementDiagram-MS252O5E-UOMT3FCC.js +1311 -0
  166. package/dist/viewer-bundle/requirementDiagram-MS252O5E-UOMT3FCC.js.map +7 -0
  167. package/dist/viewer-bundle/sankeyDiagram-XADWPNL6-LAVJ5C6A.js +1263 -0
  168. package/dist/viewer-bundle/sankeyDiagram-XADWPNL6-LAVJ5C6A.js.map +7 -0
  169. package/dist/viewer-bundle/sequenceDiagram-FGHM5R23-3IWTOUNQ.js +4655 -0
  170. package/dist/viewer-bundle/sequenceDiagram-FGHM5R23-3IWTOUNQ.js.map +7 -0
  171. package/dist/viewer-bundle/stateDiagram-FHFEXIEX-S2OVQQON.js +495 -0
  172. package/dist/viewer-bundle/stateDiagram-FHFEXIEX-S2OVQQON.js.map +7 -0
  173. package/dist/viewer-bundle/stateDiagram-v2-QKLJ7IA2-XNZ3XXSV.js +44 -0
  174. package/dist/viewer-bundle/stateDiagram-v2-QKLJ7IA2-XNZ3XXSV.js.map +7 -0
  175. package/dist/viewer-bundle/timeline-definition-GMOUNBTQ-FHVZ7MHE.js +1646 -0
  176. package/dist/viewer-bundle/timeline-definition-GMOUNBTQ-FHVZ7MHE.js.map +7 -0
  177. package/dist/viewer-bundle/treeView-SZITEDCU-RXZXNYAM.js +14 -0
  178. package/dist/viewer-bundle/treeView-SZITEDCU-RXZXNYAM.js.map +7 -0
  179. package/dist/viewer-bundle/treemap-W4RFUUIX-2IGOFSJM.js +14 -0
  180. package/dist/viewer-bundle/treemap-W4RFUUIX-2IGOFSJM.js.map +7 -0
  181. package/dist/viewer-bundle/vennDiagram-DHZGUBPP-HEAOEXEZ.js +2544 -0
  182. package/dist/viewer-bundle/vennDiagram-DHZGUBPP-HEAOEXEZ.js.map +7 -0
  183. package/dist/viewer-bundle/wardley-RL74JXVD-VSPCLOX2.js +14 -0
  184. package/dist/viewer-bundle/wardley-RL74JXVD-VSPCLOX2.js.map +7 -0
  185. package/dist/viewer-bundle/wardleyDiagram-NUSXRM2D-EBY4FG3X.js +938 -0
  186. package/dist/viewer-bundle/wardleyDiagram-NUSXRM2D-EBY4FG3X.js.map +7 -0
  187. package/dist/viewer-bundle/xychartDiagram-5P7HB3ND-SSMUQEXK.js +1952 -0
  188. package/dist/viewer-bundle/xychartDiagram-5P7HB3ND-SSMUQEXK.js.map +7 -0
  189. package/package.json +51 -0
@@ -0,0 +1,1994 @@
1
+ import {
2
+ decodeEntities
3
+ } from "./chunk-UVRE3R6A.js";
4
+ import {
5
+ common_default,
6
+ getConfig,
7
+ hasKatex,
8
+ renderKatexSanitized,
9
+ sanitizeText
10
+ } from "./chunk-7NZMPQDX.js";
11
+ import {
12
+ __name,
13
+ log,
14
+ select_default
15
+ } from "./chunk-CZHJHAOR.js";
16
+
17
+ // ../../node_modules/.pnpm/ts-dedent@2.2.0/node_modules/ts-dedent/esm/index.js
18
+ function dedent(templ) {
19
+ var values = [];
20
+ for (var _i = 1; _i < arguments.length; _i++) {
21
+ values[_i - 1] = arguments[_i];
22
+ }
23
+ var strings = Array.from(typeof templ === "string" ? [templ] : templ);
24
+ strings[strings.length - 1] = strings[strings.length - 1].replace(/\r?\n([\t ]*)$/, "");
25
+ var indentLengths = strings.reduce(function(arr, str) {
26
+ var matches = str.match(/\n([\t ]+|(?!\s).)/g);
27
+ if (matches) {
28
+ return arr.concat(matches.map(function(match) {
29
+ var _a, _b;
30
+ return (_b = (_a = match.match(/[\t ]/g)) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
31
+ }));
32
+ }
33
+ return arr;
34
+ }, []);
35
+ if (indentLengths.length) {
36
+ var pattern_1 = new RegExp("\n[ ]{" + Math.min.apply(Math, indentLengths) + "}", "g");
37
+ strings = strings.map(function(str) {
38
+ return str.replace(pattern_1, "\n");
39
+ });
40
+ }
41
+ strings[0] = strings[0].replace(/^\r?\n/, "");
42
+ var string = strings[0];
43
+ values.forEach(function(value, i) {
44
+ var endentations = string.match(/(?:^|\n)( *)$/);
45
+ var endentation = endentations ? endentations[1] : "";
46
+ var indentedValue = value;
47
+ if (typeof value === "string" && value.includes("\n")) {
48
+ indentedValue = String(value).split("\n").map(function(str, i2) {
49
+ return i2 === 0 ? str : "" + endentation + str;
50
+ }).join("\n");
51
+ }
52
+ string += indentedValue + strings[i + 1];
53
+ });
54
+ return string;
55
+ }
56
+
57
+ // ../../node_modules/.pnpm/@iconify+utils@3.1.3/node_modules/@iconify/utils/lib/icon/defaults.js
58
+ var defaultIconDimensions = Object.freeze({
59
+ left: 0,
60
+ top: 0,
61
+ width: 16,
62
+ height: 16
63
+ });
64
+ var defaultIconTransformations = Object.freeze({
65
+ rotate: 0,
66
+ vFlip: false,
67
+ hFlip: false
68
+ });
69
+ var defaultIconProps = Object.freeze({
70
+ ...defaultIconDimensions,
71
+ ...defaultIconTransformations
72
+ });
73
+ var defaultExtendedIconProps = Object.freeze({
74
+ ...defaultIconProps,
75
+ body: "",
76
+ hidden: false
77
+ });
78
+
79
+ // ../../node_modules/.pnpm/@iconify+utils@3.1.3/node_modules/@iconify/utils/lib/customisations/defaults.js
80
+ var defaultIconSizeCustomisations = Object.freeze({
81
+ width: null,
82
+ height: null
83
+ });
84
+ var defaultIconCustomisations = Object.freeze({
85
+ ...defaultIconSizeCustomisations,
86
+ ...defaultIconTransformations
87
+ });
88
+
89
+ // ../../node_modules/.pnpm/@iconify+utils@3.1.3/node_modules/@iconify/utils/lib/icon/name.js
90
+ var stringToIcon = (value, validate, allowSimpleName, provider = "") => {
91
+ const colonSeparated = value.split(":");
92
+ if (value.slice(0, 1) === "@") {
93
+ if (colonSeparated.length < 2 || colonSeparated.length > 3) return null;
94
+ provider = colonSeparated.shift().slice(1);
95
+ }
96
+ if (colonSeparated.length > 3 || !colonSeparated.length) return null;
97
+ if (colonSeparated.length > 1) {
98
+ const name2 = colonSeparated.pop();
99
+ const prefix = colonSeparated.pop();
100
+ const result = {
101
+ provider: colonSeparated.length > 0 ? colonSeparated[0] : provider,
102
+ prefix,
103
+ name: name2
104
+ };
105
+ return validate && !validateIconName(result) ? null : result;
106
+ }
107
+ const name = colonSeparated[0];
108
+ const dashSeparated = name.split("-");
109
+ if (dashSeparated.length > 1) {
110
+ const result = {
111
+ provider,
112
+ prefix: dashSeparated.shift(),
113
+ name: dashSeparated.join("-")
114
+ };
115
+ return validate && !validateIconName(result) ? null : result;
116
+ }
117
+ if (allowSimpleName && provider === "") {
118
+ const result = {
119
+ provider,
120
+ prefix: "",
121
+ name
122
+ };
123
+ return validate && !validateIconName(result, allowSimpleName) ? null : result;
124
+ }
125
+ return null;
126
+ };
127
+ var validateIconName = (icon, allowSimpleName) => {
128
+ if (!icon) return false;
129
+ return !!((allowSimpleName && icon.prefix === "" || !!icon.prefix) && !!icon.name);
130
+ };
131
+
132
+ // ../../node_modules/.pnpm/@iconify+utils@3.1.3/node_modules/@iconify/utils/lib/icon/transformations.js
133
+ function mergeIconTransformations(obj1, obj2) {
134
+ const result = {};
135
+ if (!obj1.hFlip !== !obj2.hFlip) result.hFlip = true;
136
+ if (!obj1.vFlip !== !obj2.vFlip) result.vFlip = true;
137
+ const rotate = ((obj1.rotate || 0) + (obj2.rotate || 0)) % 4;
138
+ if (rotate) result.rotate = rotate;
139
+ return result;
140
+ }
141
+
142
+ // ../../node_modules/.pnpm/@iconify+utils@3.1.3/node_modules/@iconify/utils/lib/icon/merge.js
143
+ function mergeIconData(parent, child) {
144
+ const result = mergeIconTransformations(parent, child);
145
+ for (const key in defaultExtendedIconProps) if (key in defaultIconTransformations) {
146
+ if (key in parent && !(key in result)) result[key] = defaultIconTransformations[key];
147
+ } else if (key in child) result[key] = child[key];
148
+ else if (key in parent) result[key] = parent[key];
149
+ return result;
150
+ }
151
+
152
+ // ../../node_modules/.pnpm/@iconify+utils@3.1.3/node_modules/@iconify/utils/lib/icon-set/tree.js
153
+ function getIconsTree(data, names) {
154
+ const icons = data.icons;
155
+ const aliases = data.aliases || /* @__PURE__ */ Object.create(null);
156
+ const resolved = /* @__PURE__ */ Object.create(null);
157
+ function resolve(name) {
158
+ if (icons[name]) return resolved[name] = [];
159
+ if (!(name in resolved)) {
160
+ resolved[name] = null;
161
+ const parent = aliases[name] && aliases[name].parent;
162
+ const value = parent && resolve(parent);
163
+ if (value) resolved[name] = [parent].concat(value);
164
+ }
165
+ return resolved[name];
166
+ }
167
+ (names || Object.keys(icons).concat(Object.keys(aliases))).forEach(resolve);
168
+ return resolved;
169
+ }
170
+
171
+ // ../../node_modules/.pnpm/@iconify+utils@3.1.3/node_modules/@iconify/utils/lib/icon-set/get-icon.js
172
+ function internalGetIconData(data, name, tree) {
173
+ const icons = data.icons;
174
+ const aliases = data.aliases || /* @__PURE__ */ Object.create(null);
175
+ let currentProps = {};
176
+ function parse(name2) {
177
+ currentProps = mergeIconData(icons[name2] || aliases[name2], currentProps);
178
+ }
179
+ parse(name);
180
+ tree.forEach(parse);
181
+ return mergeIconData(data, currentProps);
182
+ }
183
+ function getIconData(data, name) {
184
+ if (data.icons[name]) return internalGetIconData(data, name, []);
185
+ const tree = getIconsTree(data, [name])[name];
186
+ return tree ? internalGetIconData(data, name, tree) : null;
187
+ }
188
+
189
+ // ../../node_modules/.pnpm/@iconify+utils@3.1.3/node_modules/@iconify/utils/lib/svg/size.js
190
+ var unitsSplit = /(-?[0-9.]*[0-9]+[0-9.]*)/g;
191
+ var unitsTest = /^-?[0-9.]*[0-9]+[0-9.]*$/g;
192
+ function calculateSize(size, ratio, precision) {
193
+ if (ratio === 1) return size;
194
+ precision = precision || 100;
195
+ if (typeof size === "number") return Math.ceil(size * ratio * precision) / precision;
196
+ if (typeof size !== "string") return size;
197
+ const oldParts = size.split(unitsSplit);
198
+ if (oldParts === null || !oldParts.length) return size;
199
+ const newParts = [];
200
+ let code = oldParts.shift();
201
+ let isNumber = unitsTest.test(code);
202
+ while (true) {
203
+ if (isNumber) {
204
+ const num = parseFloat(code);
205
+ if (isNaN(num)) newParts.push(code);
206
+ else newParts.push(Math.ceil(num * ratio * precision) / precision);
207
+ } else newParts.push(code);
208
+ code = oldParts.shift();
209
+ if (code === void 0) return newParts.join("");
210
+ isNumber = !isNumber;
211
+ }
212
+ }
213
+
214
+ // ../../node_modules/.pnpm/@iconify+utils@3.1.3/node_modules/@iconify/utils/lib/svg/defs.js
215
+ function splitSVGDefs(content, tag = "defs") {
216
+ let defs = "";
217
+ const index = content.indexOf("<" + tag);
218
+ while (index >= 0) {
219
+ const start = content.indexOf(">", index);
220
+ const end = content.indexOf("</" + tag);
221
+ if (start === -1 || end === -1) break;
222
+ const endEnd = content.indexOf(">", end);
223
+ if (endEnd === -1) break;
224
+ defs += content.slice(start + 1, end).trim();
225
+ content = content.slice(0, index).trim() + content.slice(endEnd + 1);
226
+ }
227
+ return {
228
+ defs,
229
+ content
230
+ };
231
+ }
232
+ function mergeDefsAndContent(defs, content) {
233
+ return defs ? "<defs>" + defs + "</defs>" + content : content;
234
+ }
235
+ function wrapSVGContent(body, start, end) {
236
+ const split = splitSVGDefs(body);
237
+ return mergeDefsAndContent(split.defs, start + split.content + end);
238
+ }
239
+
240
+ // ../../node_modules/.pnpm/@iconify+utils@3.1.3/node_modules/@iconify/utils/lib/svg/build.js
241
+ var isUnsetKeyword = (value) => value === "unset" || value === "undefined" || value === "none";
242
+ function iconToSVG(icon, customisations) {
243
+ const fullIcon = {
244
+ ...defaultIconProps,
245
+ ...icon
246
+ };
247
+ const fullCustomisations = {
248
+ ...defaultIconCustomisations,
249
+ ...customisations
250
+ };
251
+ const box = {
252
+ left: fullIcon.left,
253
+ top: fullIcon.top,
254
+ width: fullIcon.width,
255
+ height: fullIcon.height
256
+ };
257
+ let body = fullIcon.body;
258
+ [fullIcon, fullCustomisations].forEach((props) => {
259
+ const transformations = [];
260
+ const hFlip = props.hFlip;
261
+ const vFlip = props.vFlip;
262
+ let rotation = props.rotate;
263
+ if (hFlip) if (vFlip) rotation += 2;
264
+ else {
265
+ transformations.push("translate(" + (box.width + box.left).toString() + " " + (0 - box.top).toString() + ")");
266
+ transformations.push("scale(-1 1)");
267
+ box.top = box.left = 0;
268
+ }
269
+ else if (vFlip) {
270
+ transformations.push("translate(" + (0 - box.left).toString() + " " + (box.height + box.top).toString() + ")");
271
+ transformations.push("scale(1 -1)");
272
+ box.top = box.left = 0;
273
+ }
274
+ let tempValue;
275
+ if (rotation < 0) rotation -= Math.floor(rotation / 4) * 4;
276
+ rotation = rotation % 4;
277
+ switch (rotation) {
278
+ case 1:
279
+ tempValue = box.height / 2 + box.top;
280
+ transformations.unshift("rotate(90 " + tempValue.toString() + " " + tempValue.toString() + ")");
281
+ break;
282
+ case 2:
283
+ transformations.unshift("rotate(180 " + (box.width / 2 + box.left).toString() + " " + (box.height / 2 + box.top).toString() + ")");
284
+ break;
285
+ case 3:
286
+ tempValue = box.width / 2 + box.left;
287
+ transformations.unshift("rotate(-90 " + tempValue.toString() + " " + tempValue.toString() + ")");
288
+ break;
289
+ }
290
+ if (rotation % 2 === 1) {
291
+ if (box.left !== box.top) {
292
+ tempValue = box.left;
293
+ box.left = box.top;
294
+ box.top = tempValue;
295
+ }
296
+ if (box.width !== box.height) {
297
+ tempValue = box.width;
298
+ box.width = box.height;
299
+ box.height = tempValue;
300
+ }
301
+ }
302
+ if (transformations.length) body = wrapSVGContent(body, '<g transform="' + transformations.join(" ") + '">', "</g>");
303
+ });
304
+ const customisationsWidth = fullCustomisations.width;
305
+ const customisationsHeight = fullCustomisations.height;
306
+ const boxWidth = box.width;
307
+ const boxHeight = box.height;
308
+ let width;
309
+ let height;
310
+ if (customisationsWidth === null) {
311
+ height = customisationsHeight === null ? "1em" : customisationsHeight === "auto" ? boxHeight : customisationsHeight;
312
+ width = calculateSize(height, boxWidth / boxHeight);
313
+ } else {
314
+ width = customisationsWidth === "auto" ? boxWidth : customisationsWidth;
315
+ height = customisationsHeight === null ? calculateSize(width, boxHeight / boxWidth) : customisationsHeight === "auto" ? boxHeight : customisationsHeight;
316
+ }
317
+ const attributes = {};
318
+ const setAttr = (prop, value) => {
319
+ if (!isUnsetKeyword(value)) attributes[prop] = value.toString();
320
+ };
321
+ setAttr("width", width);
322
+ setAttr("height", height);
323
+ const viewBox = [
324
+ box.left,
325
+ box.top,
326
+ boxWidth,
327
+ boxHeight
328
+ ];
329
+ attributes.viewBox = viewBox.join(" ");
330
+ return {
331
+ attributes,
332
+ viewBox,
333
+ body
334
+ };
335
+ }
336
+
337
+ // ../../node_modules/.pnpm/@iconify+utils@3.1.3/node_modules/@iconify/utils/lib/svg/id.js
338
+ var regex = /\sid="(\S+)"/g;
339
+ var counters = /* @__PURE__ */ new Map();
340
+ function nextID(id) {
341
+ id = id.replace(/[0-9]+$/, "") || "a";
342
+ const count = counters.get(id) || 0;
343
+ counters.set(id, count + 1);
344
+ return count ? `${id}${count}` : id;
345
+ }
346
+ function replaceIDs(body) {
347
+ const ids = [];
348
+ let match;
349
+ while (match = regex.exec(body)) ids.push(match[1]);
350
+ if (!ids.length) return body;
351
+ const suffix = "suffix" + (Math.random() * 16777216 | Date.now()).toString(16);
352
+ ids.forEach((id) => {
353
+ const newID = nextID(id);
354
+ const escapedID = id.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
355
+ body = body.replace(new RegExp('([#;"])(' + escapedID + ')([")]|\\.[a-z])', "g"), "$1" + newID + suffix + "$3");
356
+ });
357
+ body = body.replace(new RegExp(suffix, "g"), "");
358
+ return body;
359
+ }
360
+
361
+ // ../../node_modules/.pnpm/@iconify+utils@3.1.3/node_modules/@iconify/utils/lib/svg/html.js
362
+ function iconToHTML(body, attributes) {
363
+ let renderAttribsHTML = body.indexOf("xlink:") === -1 ? "" : ' xmlns:xlink="http://www.w3.org/1999/xlink"';
364
+ for (const attr in attributes) renderAttribsHTML += " " + attr + '="' + attributes[attr] + '"';
365
+ return '<svg xmlns="http://www.w3.org/2000/svg"' + renderAttribsHTML + ">" + body + "</svg>";
366
+ }
367
+
368
+ // ../../node_modules/.pnpm/marked@16.4.2/node_modules/marked/lib/marked.esm.js
369
+ function L() {
370
+ return { async: false, breaks: false, extensions: null, gfm: true, hooks: null, pedantic: false, renderer: null, silent: false, tokenizer: null, walkTokens: null };
371
+ }
372
+ var T = L();
373
+ function G(l3) {
374
+ T = l3;
375
+ }
376
+ var E = { exec: () => null };
377
+ function d(l3, e = "") {
378
+ let t = typeof l3 == "string" ? l3 : l3.source, n = { replace: (r, i) => {
379
+ let s = typeof i == "string" ? i : i.source;
380
+ return s = s.replace(m.caret, "$1"), t = t.replace(r, s), n;
381
+ }, getRegex: () => new RegExp(t, e) };
382
+ return n;
383
+ }
384
+ var be = (() => {
385
+ try {
386
+ return !!new RegExp("(?<=1)(?<!1)");
387
+ } catch {
388
+ return false;
389
+ }
390
+ })();
391
+ var m = { codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm, outputLinkReplace: /\\([\[\]])/g, indentCodeCompensation: /^(\s+)(?:```)/, beginningSpace: /^\s+/, endingHash: /#$/, startingSpaceChar: /^ /, endingSpaceChar: / $/, nonSpaceChar: /[^ ]/, newLineCharGlobal: /\n/g, tabCharGlobal: /\t/g, multipleSpaceGlobal: /\s+/g, blankLine: /^[ \t]*$/, doubleBlankLine: /\n[ \t]*\n[ \t]*$/, blockquoteStart: /^ {0,3}>/, blockquoteSetextReplace: /\n {0,3}((?:=+|-+) *)(?=\n|$)/g, blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm, listReplaceTabs: /^\t+/, listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g, listIsTask: /^\[[ xX]\] /, listReplaceTask: /^\[[ xX]\] +/, anyLine: /\n.*\n/, hrefBrackets: /^<(.*)>$/, tableDelimiter: /[:|]/, tableAlignChars: /^\||\| *$/g, tableRowBlankLine: /\n[ \t]*$/, tableAlignRight: /^ *-+: *$/, tableAlignCenter: /^ *:-+: *$/, tableAlignLeft: /^ *:-+ *$/, startATag: /^<a /i, endATag: /^<\/a>/i, startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i, endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i, startAngleBracket: /^</, endAngleBracket: />$/, pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/, unicodeAlphaNumeric: /[\p{L}\p{N}]/u, escapeTest: /[&<>"']/, escapeReplace: /[&<>"']/g, escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/, escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g, unescapeTest: /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig, caret: /(^|[^\[])\^/g, percentDecode: /%25/g, findPipe: /\|/g, splitPipe: / \|/, slashPipe: /\\\|/g, carriageReturn: /\r\n|\r/g, spaceLine: /^ +$/gm, notSpaceStart: /^\S*/, endingNewline: /\n$/, listItemRegex: (l3) => new RegExp(`^( {0,3}${l3})((?:[ ][^\\n]*)?(?:\\n|$))`), nextBulletRegex: (l3) => new RegExp(`^ {0,${Math.min(3, l3 - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`), hrRegex: (l3) => new RegExp(`^ {0,${Math.min(3, l3 - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`), fencesBeginRegex: (l3) => new RegExp(`^ {0,${Math.min(3, l3 - 1)}}(?:\`\`\`|~~~)`), headingBeginRegex: (l3) => new RegExp(`^ {0,${Math.min(3, l3 - 1)}}#`), htmlBeginRegex: (l3) => new RegExp(`^ {0,${Math.min(3, l3 - 1)}}<(?:[a-z].*>|!--)`, "i") };
392
+ var Re = /^(?:[ \t]*(?:\n|$))+/;
393
+ var Te = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/;
394
+ var Oe = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/;
395
+ var I = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/;
396
+ var we = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/;
397
+ var F = /(?:[*+-]|\d{1,9}[.)])/;
398
+ var ie = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/;
399
+ var oe = d(ie).replace(/bull/g, F).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex();
400
+ var ye = d(ie).replace(/bull/g, F).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex();
401
+ var j = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/;
402
+ var Pe = /^[^\n]+/;
403
+ var Q = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/;
404
+ var Se = d(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", Q).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex();
405
+ var $e = d(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, F).getRegex();
406
+ var v = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul";
407
+ var U = /<!--(?:-?>|[\s\S]*?(?:-->|$))/;
408
+ var _e = d("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))", "i").replace("comment", U).replace("tag", v).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
409
+ var ae = d(j).replace("hr", I).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", v).getRegex();
410
+ var Le = d(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", ae).getRegex();
411
+ var K = { blockquote: Le, code: Te, def: Se, fences: Oe, heading: we, hr: I, html: _e, lheading: oe, list: $e, newline: Re, paragraph: ae, table: E, text: Pe };
412
+ var re = d("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", I).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", v).getRegex();
413
+ var Me = { ...K, lheading: ye, table: re, paragraph: d(j).replace("hr", I).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", re).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", v).getRegex() };
414
+ var ze = { ...K, html: d(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", U).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(), def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/, heading: /^(#{1,6})(.*)(?:\n+|$)/, fences: E, lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/, paragraph: d(j).replace("hr", I).replace("heading", ` *#{1,6} *[^
415
+ ]`).replace("lheading", oe).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() };
416
+ var Ae = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/;
417
+ var Ee = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/;
418
+ var le = /^( {2,}|\\)\n(?!\s*$)/;
419
+ var Ie = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/;
420
+ var D = /[\p{P}\p{S}]/u;
421
+ var W = /[\s\p{P}\p{S}]/u;
422
+ var ue = /[^\s\p{P}\p{S}]/u;
423
+ var Ce = d(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, W).getRegex();
424
+ var pe = /(?!~)[\p{P}\p{S}]/u;
425
+ var Be = /(?!~)[\s\p{P}\p{S}]/u;
426
+ var qe = /(?:[^\s\p{P}\p{S}]|~)/u;
427
+ var ve = d(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", be ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex();
428
+ var ce = /^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/;
429
+ var De = d(ce, "u").replace(/punct/g, D).getRegex();
430
+ var He = d(ce, "u").replace(/punct/g, pe).getRegex();
431
+ var he = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)";
432
+ var Ze = d(he, "gu").replace(/notPunctSpace/g, ue).replace(/punctSpace/g, W).replace(/punct/g, D).getRegex();
433
+ var Ge = d(he, "gu").replace(/notPunctSpace/g, qe).replace(/punctSpace/g, Be).replace(/punct/g, pe).getRegex();
434
+ var Ne = d("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, ue).replace(/punctSpace/g, W).replace(/punct/g, D).getRegex();
435
+ var Fe = d(/\\(punct)/, "gu").replace(/punct/g, D).getRegex();
436
+ var je = d(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email", /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex();
437
+ var Qe = d(U).replace("(?:-->|$)", "-->").getRegex();
438
+ var Ue = d("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", Qe).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex();
439
+ var q = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/;
440
+ var Ke = d(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label", q).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex();
441
+ var de = d(/^!?\[(label)\]\[(ref)\]/).replace("label", q).replace("ref", Q).getRegex();
442
+ var ke = d(/^!?\[(ref)\](?:\[\])?/).replace("ref", Q).getRegex();
443
+ var We = d("reflink|nolink(?!\\()", "g").replace("reflink", de).replace("nolink", ke).getRegex();
444
+ var se = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/;
445
+ var X = { _backpedal: E, anyPunctuation: Fe, autolink: je, blockSkip: ve, br: le, code: Ee, del: E, emStrongLDelim: De, emStrongRDelimAst: Ze, emStrongRDelimUnd: Ne, escape: Ae, link: Ke, nolink: ke, punctuation: Ce, reflink: de, reflinkSearch: We, tag: Ue, text: Ie, url: E };
446
+ var Xe = { ...X, link: d(/^!?\[(label)\]\((.*?)\)/).replace("label", q).getRegex(), reflink: d(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", q).getRegex() };
447
+ var N = { ...X, emStrongRDelimAst: Ge, emStrongLDelim: He, url: d(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol", se).replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(), _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/, del: /^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/, text: d(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol", se).getRegex() };
448
+ var Je = { ...N, br: d(le).replace("{2,}", "*").getRegex(), text: d(N.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex() };
449
+ var C = { normal: K, gfm: Me, pedantic: ze };
450
+ var M = { normal: X, gfm: N, breaks: Je, pedantic: Xe };
451
+ var Ve = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" };
452
+ var ge = (l3) => Ve[l3];
453
+ function w(l3, e) {
454
+ if (e) {
455
+ if (m.escapeTest.test(l3)) return l3.replace(m.escapeReplace, ge);
456
+ } else if (m.escapeTestNoEncode.test(l3)) return l3.replace(m.escapeReplaceNoEncode, ge);
457
+ return l3;
458
+ }
459
+ function J(l3) {
460
+ try {
461
+ l3 = encodeURI(l3).replace(m.percentDecode, "%");
462
+ } catch {
463
+ return null;
464
+ }
465
+ return l3;
466
+ }
467
+ function V(l3, e) {
468
+ let t = l3.replace(m.findPipe, (i, s, a) => {
469
+ let o = false, p = s;
470
+ for (; --p >= 0 && a[p] === "\\"; ) o = !o;
471
+ return o ? "|" : " |";
472
+ }), n = t.split(m.splitPipe), r = 0;
473
+ if (n[0].trim() || n.shift(), n.length > 0 && !n.at(-1)?.trim() && n.pop(), e) if (n.length > e) n.splice(e);
474
+ else for (; n.length < e; ) n.push("");
475
+ for (; r < n.length; r++) n[r] = n[r].trim().replace(m.slashPipe, "|");
476
+ return n;
477
+ }
478
+ function z(l3, e, t) {
479
+ let n = l3.length;
480
+ if (n === 0) return "";
481
+ let r = 0;
482
+ for (; r < n; ) {
483
+ let i = l3.charAt(n - r - 1);
484
+ if (i === e && !t) r++;
485
+ else if (i !== e && t) r++;
486
+ else break;
487
+ }
488
+ return l3.slice(0, n - r);
489
+ }
490
+ function fe(l3, e) {
491
+ if (l3.indexOf(e[1]) === -1) return -1;
492
+ let t = 0;
493
+ for (let n = 0; n < l3.length; n++) if (l3[n] === "\\") n++;
494
+ else if (l3[n] === e[0]) t++;
495
+ else if (l3[n] === e[1] && (t--, t < 0)) return n;
496
+ return t > 0 ? -2 : -1;
497
+ }
498
+ function me(l3, e, t, n, r) {
499
+ let i = e.href, s = e.title || null, a = l3[1].replace(r.other.outputLinkReplace, "$1");
500
+ n.state.inLink = true;
501
+ let o = { type: l3[0].charAt(0) === "!" ? "image" : "link", raw: t, href: i, title: s, text: a, tokens: n.inlineTokens(a) };
502
+ return n.state.inLink = false, o;
503
+ }
504
+ function Ye(l3, e, t) {
505
+ let n = l3.match(t.other.indentCodeCompensation);
506
+ if (n === null) return e;
507
+ let r = n[1];
508
+ return e.split(`
509
+ `).map((i) => {
510
+ let s = i.match(t.other.beginningSpace);
511
+ if (s === null) return i;
512
+ let [a] = s;
513
+ return a.length >= r.length ? i.slice(r.length) : i;
514
+ }).join(`
515
+ `);
516
+ }
517
+ var y = class {
518
+ options;
519
+ rules;
520
+ lexer;
521
+ constructor(e) {
522
+ this.options = e || T;
523
+ }
524
+ space(e) {
525
+ let t = this.rules.block.newline.exec(e);
526
+ if (t && t[0].length > 0) return { type: "space", raw: t[0] };
527
+ }
528
+ code(e) {
529
+ let t = this.rules.block.code.exec(e);
530
+ if (t) {
531
+ let n = t[0].replace(this.rules.other.codeRemoveIndent, "");
532
+ return { type: "code", raw: t[0], codeBlockStyle: "indented", text: this.options.pedantic ? n : z(n, `
533
+ `) };
534
+ }
535
+ }
536
+ fences(e) {
537
+ let t = this.rules.block.fences.exec(e);
538
+ if (t) {
539
+ let n = t[0], r = Ye(n, t[3] || "", this.rules);
540
+ return { type: "code", raw: n, lang: t[2] ? t[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : t[2], text: r };
541
+ }
542
+ }
543
+ heading(e) {
544
+ let t = this.rules.block.heading.exec(e);
545
+ if (t) {
546
+ let n = t[2].trim();
547
+ if (this.rules.other.endingHash.test(n)) {
548
+ let r = z(n, "#");
549
+ (this.options.pedantic || !r || this.rules.other.endingSpaceChar.test(r)) && (n = r.trim());
550
+ }
551
+ return { type: "heading", raw: t[0], depth: t[1].length, text: n, tokens: this.lexer.inline(n) };
552
+ }
553
+ }
554
+ hr(e) {
555
+ let t = this.rules.block.hr.exec(e);
556
+ if (t) return { type: "hr", raw: z(t[0], `
557
+ `) };
558
+ }
559
+ blockquote(e) {
560
+ let t = this.rules.block.blockquote.exec(e);
561
+ if (t) {
562
+ let n = z(t[0], `
563
+ `).split(`
564
+ `), r = "", i = "", s = [];
565
+ for (; n.length > 0; ) {
566
+ let a = false, o = [], p;
567
+ for (p = 0; p < n.length; p++) if (this.rules.other.blockquoteStart.test(n[p])) o.push(n[p]), a = true;
568
+ else if (!a) o.push(n[p]);
569
+ else break;
570
+ n = n.slice(p);
571
+ let u = o.join(`
572
+ `), c = u.replace(this.rules.other.blockquoteSetextReplace, `
573
+ $1`).replace(this.rules.other.blockquoteSetextReplace2, "");
574
+ r = r ? `${r}
575
+ ${u}` : u, i = i ? `${i}
576
+ ${c}` : c;
577
+ let g = this.lexer.state.top;
578
+ if (this.lexer.state.top = true, this.lexer.blockTokens(c, s, true), this.lexer.state.top = g, n.length === 0) break;
579
+ let h = s.at(-1);
580
+ if (h?.type === "code") break;
581
+ if (h?.type === "blockquote") {
582
+ let R = h, f = R.raw + `
583
+ ` + n.join(`
584
+ `), O = this.blockquote(f);
585
+ s[s.length - 1] = O, r = r.substring(0, r.length - R.raw.length) + O.raw, i = i.substring(0, i.length - R.text.length) + O.text;
586
+ break;
587
+ } else if (h?.type === "list") {
588
+ let R = h, f = R.raw + `
589
+ ` + n.join(`
590
+ `), O = this.list(f);
591
+ s[s.length - 1] = O, r = r.substring(0, r.length - h.raw.length) + O.raw, i = i.substring(0, i.length - R.raw.length) + O.raw, n = f.substring(s.at(-1).raw.length).split(`
592
+ `);
593
+ continue;
594
+ }
595
+ }
596
+ return { type: "blockquote", raw: r, tokens: s, text: i };
597
+ }
598
+ }
599
+ list(e) {
600
+ let t = this.rules.block.list.exec(e);
601
+ if (t) {
602
+ let n = t[1].trim(), r = n.length > 1, i = { type: "list", raw: "", ordered: r, start: r ? +n.slice(0, -1) : "", loose: false, items: [] };
603
+ n = r ? `\\d{1,9}\\${n.slice(-1)}` : `\\${n}`, this.options.pedantic && (n = r ? n : "[*+-]");
604
+ let s = this.rules.other.listItemRegex(n), a = false;
605
+ for (; e; ) {
606
+ let p = false, u = "", c = "";
607
+ if (!(t = s.exec(e)) || this.rules.block.hr.test(e)) break;
608
+ u = t[0], e = e.substring(u.length);
609
+ let g = t[2].split(`
610
+ `, 1)[0].replace(this.rules.other.listReplaceTabs, (H) => " ".repeat(3 * H.length)), h = e.split(`
611
+ `, 1)[0], R = !g.trim(), f = 0;
612
+ if (this.options.pedantic ? (f = 2, c = g.trimStart()) : R ? f = t[1].length + 1 : (f = t[2].search(this.rules.other.nonSpaceChar), f = f > 4 ? 1 : f, c = g.slice(f), f += t[1].length), R && this.rules.other.blankLine.test(h) && (u += h + `
613
+ `, e = e.substring(h.length + 1), p = true), !p) {
614
+ let H = this.rules.other.nextBulletRegex(f), ee = this.rules.other.hrRegex(f), te = this.rules.other.fencesBeginRegex(f), ne = this.rules.other.headingBeginRegex(f), xe = this.rules.other.htmlBeginRegex(f);
615
+ for (; e; ) {
616
+ let Z = e.split(`
617
+ `, 1)[0], A;
618
+ if (h = Z, this.options.pedantic ? (h = h.replace(this.rules.other.listReplaceNesting, " "), A = h) : A = h.replace(this.rules.other.tabCharGlobal, " "), te.test(h) || ne.test(h) || xe.test(h) || H.test(h) || ee.test(h)) break;
619
+ if (A.search(this.rules.other.nonSpaceChar) >= f || !h.trim()) c += `
620
+ ` + A.slice(f);
621
+ else {
622
+ if (R || g.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || te.test(g) || ne.test(g) || ee.test(g)) break;
623
+ c += `
624
+ ` + h;
625
+ }
626
+ !R && !h.trim() && (R = true), u += Z + `
627
+ `, e = e.substring(Z.length + 1), g = A.slice(f);
628
+ }
629
+ }
630
+ i.loose || (a ? i.loose = true : this.rules.other.doubleBlankLine.test(u) && (a = true));
631
+ let O = null, Y;
632
+ this.options.gfm && (O = this.rules.other.listIsTask.exec(c), O && (Y = O[0] !== "[ ] ", c = c.replace(this.rules.other.listReplaceTask, ""))), i.items.push({ type: "list_item", raw: u, task: !!O, checked: Y, loose: false, text: c, tokens: [] }), i.raw += u;
633
+ }
634
+ let o = i.items.at(-1);
635
+ if (o) o.raw = o.raw.trimEnd(), o.text = o.text.trimEnd();
636
+ else return;
637
+ i.raw = i.raw.trimEnd();
638
+ for (let p = 0; p < i.items.length; p++) if (this.lexer.state.top = false, i.items[p].tokens = this.lexer.blockTokens(i.items[p].text, []), !i.loose) {
639
+ let u = i.items[p].tokens.filter((g) => g.type === "space"), c = u.length > 0 && u.some((g) => this.rules.other.anyLine.test(g.raw));
640
+ i.loose = c;
641
+ }
642
+ if (i.loose) for (let p = 0; p < i.items.length; p++) i.items[p].loose = true;
643
+ return i;
644
+ }
645
+ }
646
+ html(e) {
647
+ let t = this.rules.block.html.exec(e);
648
+ if (t) return { type: "html", block: true, raw: t[0], pre: t[1] === "pre" || t[1] === "script" || t[1] === "style", text: t[0] };
649
+ }
650
+ def(e) {
651
+ let t = this.rules.block.def.exec(e);
652
+ if (t) {
653
+ let n = t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal, " "), r = t[2] ? t[2].replace(this.rules.other.hrefBrackets, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "", i = t[3] ? t[3].substring(1, t[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : t[3];
654
+ return { type: "def", tag: n, raw: t[0], href: r, title: i };
655
+ }
656
+ }
657
+ table(e) {
658
+ let t = this.rules.block.table.exec(e);
659
+ if (!t || !this.rules.other.tableDelimiter.test(t[2])) return;
660
+ let n = V(t[1]), r = t[2].replace(this.rules.other.tableAlignChars, "").split("|"), i = t[3]?.trim() ? t[3].replace(this.rules.other.tableRowBlankLine, "").split(`
661
+ `) : [], s = { type: "table", raw: t[0], header: [], align: [], rows: [] };
662
+ if (n.length === r.length) {
663
+ for (let a of r) this.rules.other.tableAlignRight.test(a) ? s.align.push("right") : this.rules.other.tableAlignCenter.test(a) ? s.align.push("center") : this.rules.other.tableAlignLeft.test(a) ? s.align.push("left") : s.align.push(null);
664
+ for (let a = 0; a < n.length; a++) s.header.push({ text: n[a], tokens: this.lexer.inline(n[a]), header: true, align: s.align[a] });
665
+ for (let a of i) s.rows.push(V(a, s.header.length).map((o, p) => ({ text: o, tokens: this.lexer.inline(o), header: false, align: s.align[p] })));
666
+ return s;
667
+ }
668
+ }
669
+ lheading(e) {
670
+ let t = this.rules.block.lheading.exec(e);
671
+ if (t) return { type: "heading", raw: t[0], depth: t[2].charAt(0) === "=" ? 1 : 2, text: t[1], tokens: this.lexer.inline(t[1]) };
672
+ }
673
+ paragraph(e) {
674
+ let t = this.rules.block.paragraph.exec(e);
675
+ if (t) {
676
+ let n = t[1].charAt(t[1].length - 1) === `
677
+ ` ? t[1].slice(0, -1) : t[1];
678
+ return { type: "paragraph", raw: t[0], text: n, tokens: this.lexer.inline(n) };
679
+ }
680
+ }
681
+ text(e) {
682
+ let t = this.rules.block.text.exec(e);
683
+ if (t) return { type: "text", raw: t[0], text: t[0], tokens: this.lexer.inline(t[0]) };
684
+ }
685
+ escape(e) {
686
+ let t = this.rules.inline.escape.exec(e);
687
+ if (t) return { type: "escape", raw: t[0], text: t[1] };
688
+ }
689
+ tag(e) {
690
+ let t = this.rules.inline.tag.exec(e);
691
+ if (t) return !this.lexer.state.inLink && this.rules.other.startATag.test(t[0]) ? this.lexer.state.inLink = true : this.lexer.state.inLink && this.rules.other.endATag.test(t[0]) && (this.lexer.state.inLink = false), !this.lexer.state.inRawBlock && this.rules.other.startPreScriptTag.test(t[0]) ? this.lexer.state.inRawBlock = true : this.lexer.state.inRawBlock && this.rules.other.endPreScriptTag.test(t[0]) && (this.lexer.state.inRawBlock = false), { type: "html", raw: t[0], inLink: this.lexer.state.inLink, inRawBlock: this.lexer.state.inRawBlock, block: false, text: t[0] };
692
+ }
693
+ link(e) {
694
+ let t = this.rules.inline.link.exec(e);
695
+ if (t) {
696
+ let n = t[2].trim();
697
+ if (!this.options.pedantic && this.rules.other.startAngleBracket.test(n)) {
698
+ if (!this.rules.other.endAngleBracket.test(n)) return;
699
+ let s = z(n.slice(0, -1), "\\");
700
+ if ((n.length - s.length) % 2 === 0) return;
701
+ } else {
702
+ let s = fe(t[2], "()");
703
+ if (s === -2) return;
704
+ if (s > -1) {
705
+ let o = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length + s;
706
+ t[2] = t[2].substring(0, s), t[0] = t[0].substring(0, o).trim(), t[3] = "";
707
+ }
708
+ }
709
+ let r = t[2], i = "";
710
+ if (this.options.pedantic) {
711
+ let s = this.rules.other.pedanticHrefTitle.exec(r);
712
+ s && (r = s[1], i = s[3]);
713
+ } else i = t[3] ? t[3].slice(1, -1) : "";
714
+ return r = r.trim(), this.rules.other.startAngleBracket.test(r) && (this.options.pedantic && !this.rules.other.endAngleBracket.test(n) ? r = r.slice(1) : r = r.slice(1, -1)), me(t, { href: r && r.replace(this.rules.inline.anyPunctuation, "$1"), title: i && i.replace(this.rules.inline.anyPunctuation, "$1") }, t[0], this.lexer, this.rules);
715
+ }
716
+ }
717
+ reflink(e, t) {
718
+ let n;
719
+ if ((n = this.rules.inline.reflink.exec(e)) || (n = this.rules.inline.nolink.exec(e))) {
720
+ let r = (n[2] || n[1]).replace(this.rules.other.multipleSpaceGlobal, " "), i = t[r.toLowerCase()];
721
+ if (!i) {
722
+ let s = n[0].charAt(0);
723
+ return { type: "text", raw: s, text: s };
724
+ }
725
+ return me(n, i, n[0], this.lexer, this.rules);
726
+ }
727
+ }
728
+ emStrong(e, t, n = "") {
729
+ let r = this.rules.inline.emStrongLDelim.exec(e);
730
+ if (!r || r[3] && n.match(this.rules.other.unicodeAlphaNumeric)) return;
731
+ if (!(r[1] || r[2] || "") || !n || this.rules.inline.punctuation.exec(n)) {
732
+ let s = [...r[0]].length - 1, a, o, p = s, u = 0, c = r[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
733
+ for (c.lastIndex = 0, t = t.slice(-1 * e.length + s); (r = c.exec(t)) != null; ) {
734
+ if (a = r[1] || r[2] || r[3] || r[4] || r[5] || r[6], !a) continue;
735
+ if (o = [...a].length, r[3] || r[4]) {
736
+ p += o;
737
+ continue;
738
+ } else if ((r[5] || r[6]) && s % 3 && !((s + o) % 3)) {
739
+ u += o;
740
+ continue;
741
+ }
742
+ if (p -= o, p > 0) continue;
743
+ o = Math.min(o, o + p + u);
744
+ let g = [...r[0]][0].length, h = e.slice(0, s + r.index + g + o);
745
+ if (Math.min(s, o) % 2) {
746
+ let f = h.slice(1, -1);
747
+ return { type: "em", raw: h, text: f, tokens: this.lexer.inlineTokens(f) };
748
+ }
749
+ let R = h.slice(2, -2);
750
+ return { type: "strong", raw: h, text: R, tokens: this.lexer.inlineTokens(R) };
751
+ }
752
+ }
753
+ }
754
+ codespan(e) {
755
+ let t = this.rules.inline.code.exec(e);
756
+ if (t) {
757
+ let n = t[2].replace(this.rules.other.newLineCharGlobal, " "), r = this.rules.other.nonSpaceChar.test(n), i = this.rules.other.startingSpaceChar.test(n) && this.rules.other.endingSpaceChar.test(n);
758
+ return r && i && (n = n.substring(1, n.length - 1)), { type: "codespan", raw: t[0], text: n };
759
+ }
760
+ }
761
+ br(e) {
762
+ let t = this.rules.inline.br.exec(e);
763
+ if (t) return { type: "br", raw: t[0] };
764
+ }
765
+ del(e) {
766
+ let t = this.rules.inline.del.exec(e);
767
+ if (t) return { type: "del", raw: t[0], text: t[2], tokens: this.lexer.inlineTokens(t[2]) };
768
+ }
769
+ autolink(e) {
770
+ let t = this.rules.inline.autolink.exec(e);
771
+ if (t) {
772
+ let n, r;
773
+ return t[2] === "@" ? (n = t[1], r = "mailto:" + n) : (n = t[1], r = n), { type: "link", raw: t[0], text: n, href: r, tokens: [{ type: "text", raw: n, text: n }] };
774
+ }
775
+ }
776
+ url(e) {
777
+ let t;
778
+ if (t = this.rules.inline.url.exec(e)) {
779
+ let n, r;
780
+ if (t[2] === "@") n = t[0], r = "mailto:" + n;
781
+ else {
782
+ let i;
783
+ do
784
+ i = t[0], t[0] = this.rules.inline._backpedal.exec(t[0])?.[0] ?? "";
785
+ while (i !== t[0]);
786
+ n = t[0], t[1] === "www." ? r = "http://" + t[0] : r = t[0];
787
+ }
788
+ return { type: "link", raw: t[0], text: n, href: r, tokens: [{ type: "text", raw: n, text: n }] };
789
+ }
790
+ }
791
+ inlineText(e) {
792
+ let t = this.rules.inline.text.exec(e);
793
+ if (t) {
794
+ let n = this.lexer.state.inRawBlock;
795
+ return { type: "text", raw: t[0], text: t[0], escaped: n };
796
+ }
797
+ }
798
+ };
799
+ var x = class l {
800
+ tokens;
801
+ options;
802
+ state;
803
+ tokenizer;
804
+ inlineQueue;
805
+ constructor(e) {
806
+ this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = e || T, this.options.tokenizer = this.options.tokenizer || new y(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = { inLink: false, inRawBlock: false, top: true };
807
+ let t = { other: m, block: C.normal, inline: M.normal };
808
+ this.options.pedantic ? (t.block = C.pedantic, t.inline = M.pedantic) : this.options.gfm && (t.block = C.gfm, this.options.breaks ? t.inline = M.breaks : t.inline = M.gfm), this.tokenizer.rules = t;
809
+ }
810
+ static get rules() {
811
+ return { block: C, inline: M };
812
+ }
813
+ static lex(e, t) {
814
+ return new l(t).lex(e);
815
+ }
816
+ static lexInline(e, t) {
817
+ return new l(t).inlineTokens(e);
818
+ }
819
+ lex(e) {
820
+ e = e.replace(m.carriageReturn, `
821
+ `), this.blockTokens(e, this.tokens);
822
+ for (let t = 0; t < this.inlineQueue.length; t++) {
823
+ let n = this.inlineQueue[t];
824
+ this.inlineTokens(n.src, n.tokens);
825
+ }
826
+ return this.inlineQueue = [], this.tokens;
827
+ }
828
+ blockTokens(e, t = [], n = false) {
829
+ for (this.options.pedantic && (e = e.replace(m.tabCharGlobal, " ").replace(m.spaceLine, "")); e; ) {
830
+ let r;
831
+ if (this.options.extensions?.block?.some((s) => (r = s.call({ lexer: this }, e, t)) ? (e = e.substring(r.raw.length), t.push(r), true) : false)) continue;
832
+ if (r = this.tokenizer.space(e)) {
833
+ e = e.substring(r.raw.length);
834
+ let s = t.at(-1);
835
+ r.raw.length === 1 && s !== void 0 ? s.raw += `
836
+ ` : t.push(r);
837
+ continue;
838
+ }
839
+ if (r = this.tokenizer.code(e)) {
840
+ e = e.substring(r.raw.length);
841
+ let s = t.at(-1);
842
+ s?.type === "paragraph" || s?.type === "text" ? (s.raw += (s.raw.endsWith(`
843
+ `) ? "" : `
844
+ `) + r.raw, s.text += `
845
+ ` + r.text, this.inlineQueue.at(-1).src = s.text) : t.push(r);
846
+ continue;
847
+ }
848
+ if (r = this.tokenizer.fences(e)) {
849
+ e = e.substring(r.raw.length), t.push(r);
850
+ continue;
851
+ }
852
+ if (r = this.tokenizer.heading(e)) {
853
+ e = e.substring(r.raw.length), t.push(r);
854
+ continue;
855
+ }
856
+ if (r = this.tokenizer.hr(e)) {
857
+ e = e.substring(r.raw.length), t.push(r);
858
+ continue;
859
+ }
860
+ if (r = this.tokenizer.blockquote(e)) {
861
+ e = e.substring(r.raw.length), t.push(r);
862
+ continue;
863
+ }
864
+ if (r = this.tokenizer.list(e)) {
865
+ e = e.substring(r.raw.length), t.push(r);
866
+ continue;
867
+ }
868
+ if (r = this.tokenizer.html(e)) {
869
+ e = e.substring(r.raw.length), t.push(r);
870
+ continue;
871
+ }
872
+ if (r = this.tokenizer.def(e)) {
873
+ e = e.substring(r.raw.length);
874
+ let s = t.at(-1);
875
+ s?.type === "paragraph" || s?.type === "text" ? (s.raw += (s.raw.endsWith(`
876
+ `) ? "" : `
877
+ `) + r.raw, s.text += `
878
+ ` + r.raw, this.inlineQueue.at(-1).src = s.text) : this.tokens.links[r.tag] || (this.tokens.links[r.tag] = { href: r.href, title: r.title }, t.push(r));
879
+ continue;
880
+ }
881
+ if (r = this.tokenizer.table(e)) {
882
+ e = e.substring(r.raw.length), t.push(r);
883
+ continue;
884
+ }
885
+ if (r = this.tokenizer.lheading(e)) {
886
+ e = e.substring(r.raw.length), t.push(r);
887
+ continue;
888
+ }
889
+ let i = e;
890
+ if (this.options.extensions?.startBlock) {
891
+ let s = 1 / 0, a = e.slice(1), o;
892
+ this.options.extensions.startBlock.forEach((p) => {
893
+ o = p.call({ lexer: this }, a), typeof o == "number" && o >= 0 && (s = Math.min(s, o));
894
+ }), s < 1 / 0 && s >= 0 && (i = e.substring(0, s + 1));
895
+ }
896
+ if (this.state.top && (r = this.tokenizer.paragraph(i))) {
897
+ let s = t.at(-1);
898
+ n && s?.type === "paragraph" ? (s.raw += (s.raw.endsWith(`
899
+ `) ? "" : `
900
+ `) + r.raw, s.text += `
901
+ ` + r.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = s.text) : t.push(r), n = i.length !== e.length, e = e.substring(r.raw.length);
902
+ continue;
903
+ }
904
+ if (r = this.tokenizer.text(e)) {
905
+ e = e.substring(r.raw.length);
906
+ let s = t.at(-1);
907
+ s?.type === "text" ? (s.raw += (s.raw.endsWith(`
908
+ `) ? "" : `
909
+ `) + r.raw, s.text += `
910
+ ` + r.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = s.text) : t.push(r);
911
+ continue;
912
+ }
913
+ if (e) {
914
+ let s = "Infinite loop on byte: " + e.charCodeAt(0);
915
+ if (this.options.silent) {
916
+ console.error(s);
917
+ break;
918
+ } else throw new Error(s);
919
+ }
920
+ }
921
+ return this.state.top = true, t;
922
+ }
923
+ inline(e, t = []) {
924
+ return this.inlineQueue.push({ src: e, tokens: t }), t;
925
+ }
926
+ inlineTokens(e, t = []) {
927
+ let n = e, r = null;
928
+ if (this.tokens.links) {
929
+ let o = Object.keys(this.tokens.links);
930
+ if (o.length > 0) for (; (r = this.tokenizer.rules.inline.reflinkSearch.exec(n)) != null; ) o.includes(r[0].slice(r[0].lastIndexOf("[") + 1, -1)) && (n = n.slice(0, r.index) + "[" + "a".repeat(r[0].length - 2) + "]" + n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex));
931
+ }
932
+ for (; (r = this.tokenizer.rules.inline.anyPunctuation.exec(n)) != null; ) n = n.slice(0, r.index) + "++" + n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
933
+ let i;
934
+ for (; (r = this.tokenizer.rules.inline.blockSkip.exec(n)) != null; ) i = r[2] ? r[2].length : 0, n = n.slice(0, r.index + i) + "[" + "a".repeat(r[0].length - i - 2) + "]" + n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
935
+ n = this.options.hooks?.emStrongMask?.call({ lexer: this }, n) ?? n;
936
+ let s = false, a = "";
937
+ for (; e; ) {
938
+ s || (a = ""), s = false;
939
+ let o;
940
+ if (this.options.extensions?.inline?.some((u) => (o = u.call({ lexer: this }, e, t)) ? (e = e.substring(o.raw.length), t.push(o), true) : false)) continue;
941
+ if (o = this.tokenizer.escape(e)) {
942
+ e = e.substring(o.raw.length), t.push(o);
943
+ continue;
944
+ }
945
+ if (o = this.tokenizer.tag(e)) {
946
+ e = e.substring(o.raw.length), t.push(o);
947
+ continue;
948
+ }
949
+ if (o = this.tokenizer.link(e)) {
950
+ e = e.substring(o.raw.length), t.push(o);
951
+ continue;
952
+ }
953
+ if (o = this.tokenizer.reflink(e, this.tokens.links)) {
954
+ e = e.substring(o.raw.length);
955
+ let u = t.at(-1);
956
+ o.type === "text" && u?.type === "text" ? (u.raw += o.raw, u.text += o.text) : t.push(o);
957
+ continue;
958
+ }
959
+ if (o = this.tokenizer.emStrong(e, n, a)) {
960
+ e = e.substring(o.raw.length), t.push(o);
961
+ continue;
962
+ }
963
+ if (o = this.tokenizer.codespan(e)) {
964
+ e = e.substring(o.raw.length), t.push(o);
965
+ continue;
966
+ }
967
+ if (o = this.tokenizer.br(e)) {
968
+ e = e.substring(o.raw.length), t.push(o);
969
+ continue;
970
+ }
971
+ if (o = this.tokenizer.del(e)) {
972
+ e = e.substring(o.raw.length), t.push(o);
973
+ continue;
974
+ }
975
+ if (o = this.tokenizer.autolink(e)) {
976
+ e = e.substring(o.raw.length), t.push(o);
977
+ continue;
978
+ }
979
+ if (!this.state.inLink && (o = this.tokenizer.url(e))) {
980
+ e = e.substring(o.raw.length), t.push(o);
981
+ continue;
982
+ }
983
+ let p = e;
984
+ if (this.options.extensions?.startInline) {
985
+ let u = 1 / 0, c = e.slice(1), g;
986
+ this.options.extensions.startInline.forEach((h) => {
987
+ g = h.call({ lexer: this }, c), typeof g == "number" && g >= 0 && (u = Math.min(u, g));
988
+ }), u < 1 / 0 && u >= 0 && (p = e.substring(0, u + 1));
989
+ }
990
+ if (o = this.tokenizer.inlineText(p)) {
991
+ e = e.substring(o.raw.length), o.raw.slice(-1) !== "_" && (a = o.raw.slice(-1)), s = true;
992
+ let u = t.at(-1);
993
+ u?.type === "text" ? (u.raw += o.raw, u.text += o.text) : t.push(o);
994
+ continue;
995
+ }
996
+ if (e) {
997
+ let u = "Infinite loop on byte: " + e.charCodeAt(0);
998
+ if (this.options.silent) {
999
+ console.error(u);
1000
+ break;
1001
+ } else throw new Error(u);
1002
+ }
1003
+ }
1004
+ return t;
1005
+ }
1006
+ };
1007
+ var P = class {
1008
+ options;
1009
+ parser;
1010
+ constructor(e) {
1011
+ this.options = e || T;
1012
+ }
1013
+ space(e) {
1014
+ return "";
1015
+ }
1016
+ code({ text: e, lang: t, escaped: n }) {
1017
+ let r = (t || "").match(m.notSpaceStart)?.[0], i = e.replace(m.endingNewline, "") + `
1018
+ `;
1019
+ return r ? '<pre><code class="language-' + w(r) + '">' + (n ? i : w(i, true)) + `</code></pre>
1020
+ ` : "<pre><code>" + (n ? i : w(i, true)) + `</code></pre>
1021
+ `;
1022
+ }
1023
+ blockquote({ tokens: e }) {
1024
+ return `<blockquote>
1025
+ ${this.parser.parse(e)}</blockquote>
1026
+ `;
1027
+ }
1028
+ html({ text: e }) {
1029
+ return e;
1030
+ }
1031
+ def(e) {
1032
+ return "";
1033
+ }
1034
+ heading({ tokens: e, depth: t }) {
1035
+ return `<h${t}>${this.parser.parseInline(e)}</h${t}>
1036
+ `;
1037
+ }
1038
+ hr(e) {
1039
+ return `<hr>
1040
+ `;
1041
+ }
1042
+ list(e) {
1043
+ let t = e.ordered, n = e.start, r = "";
1044
+ for (let a = 0; a < e.items.length; a++) {
1045
+ let o = e.items[a];
1046
+ r += this.listitem(o);
1047
+ }
1048
+ let i = t ? "ol" : "ul", s = t && n !== 1 ? ' start="' + n + '"' : "";
1049
+ return "<" + i + s + `>
1050
+ ` + r + "</" + i + `>
1051
+ `;
1052
+ }
1053
+ listitem(e) {
1054
+ let t = "";
1055
+ if (e.task) {
1056
+ let n = this.checkbox({ checked: !!e.checked });
1057
+ e.loose ? e.tokens[0]?.type === "paragraph" ? (e.tokens[0].text = n + " " + e.tokens[0].text, e.tokens[0].tokens && e.tokens[0].tokens.length > 0 && e.tokens[0].tokens[0].type === "text" && (e.tokens[0].tokens[0].text = n + " " + w(e.tokens[0].tokens[0].text), e.tokens[0].tokens[0].escaped = true)) : e.tokens.unshift({ type: "text", raw: n + " ", text: n + " ", escaped: true }) : t += n + " ";
1058
+ }
1059
+ return t += this.parser.parse(e.tokens, !!e.loose), `<li>${t}</li>
1060
+ `;
1061
+ }
1062
+ checkbox({ checked: e }) {
1063
+ return "<input " + (e ? 'checked="" ' : "") + 'disabled="" type="checkbox">';
1064
+ }
1065
+ paragraph({ tokens: e }) {
1066
+ return `<p>${this.parser.parseInline(e)}</p>
1067
+ `;
1068
+ }
1069
+ table(e) {
1070
+ let t = "", n = "";
1071
+ for (let i = 0; i < e.header.length; i++) n += this.tablecell(e.header[i]);
1072
+ t += this.tablerow({ text: n });
1073
+ let r = "";
1074
+ for (let i = 0; i < e.rows.length; i++) {
1075
+ let s = e.rows[i];
1076
+ n = "";
1077
+ for (let a = 0; a < s.length; a++) n += this.tablecell(s[a]);
1078
+ r += this.tablerow({ text: n });
1079
+ }
1080
+ return r && (r = `<tbody>${r}</tbody>`), `<table>
1081
+ <thead>
1082
+ ` + t + `</thead>
1083
+ ` + r + `</table>
1084
+ `;
1085
+ }
1086
+ tablerow({ text: e }) {
1087
+ return `<tr>
1088
+ ${e}</tr>
1089
+ `;
1090
+ }
1091
+ tablecell(e) {
1092
+ let t = this.parser.parseInline(e.tokens), n = e.header ? "th" : "td";
1093
+ return (e.align ? `<${n} align="${e.align}">` : `<${n}>`) + t + `</${n}>
1094
+ `;
1095
+ }
1096
+ strong({ tokens: e }) {
1097
+ return `<strong>${this.parser.parseInline(e)}</strong>`;
1098
+ }
1099
+ em({ tokens: e }) {
1100
+ return `<em>${this.parser.parseInline(e)}</em>`;
1101
+ }
1102
+ codespan({ text: e }) {
1103
+ return `<code>${w(e, true)}</code>`;
1104
+ }
1105
+ br(e) {
1106
+ return "<br>";
1107
+ }
1108
+ del({ tokens: e }) {
1109
+ return `<del>${this.parser.parseInline(e)}</del>`;
1110
+ }
1111
+ link({ href: e, title: t, tokens: n }) {
1112
+ let r = this.parser.parseInline(n), i = J(e);
1113
+ if (i === null) return r;
1114
+ e = i;
1115
+ let s = '<a href="' + e + '"';
1116
+ return t && (s += ' title="' + w(t) + '"'), s += ">" + r + "</a>", s;
1117
+ }
1118
+ image({ href: e, title: t, text: n, tokens: r }) {
1119
+ r && (n = this.parser.parseInline(r, this.parser.textRenderer));
1120
+ let i = J(e);
1121
+ if (i === null) return w(n);
1122
+ e = i;
1123
+ let s = `<img src="${e}" alt="${n}"`;
1124
+ return t && (s += ` title="${w(t)}"`), s += ">", s;
1125
+ }
1126
+ text(e) {
1127
+ return "tokens" in e && e.tokens ? this.parser.parseInline(e.tokens) : "escaped" in e && e.escaped ? e.text : w(e.text);
1128
+ }
1129
+ };
1130
+ var $ = class {
1131
+ strong({ text: e }) {
1132
+ return e;
1133
+ }
1134
+ em({ text: e }) {
1135
+ return e;
1136
+ }
1137
+ codespan({ text: e }) {
1138
+ return e;
1139
+ }
1140
+ del({ text: e }) {
1141
+ return e;
1142
+ }
1143
+ html({ text: e }) {
1144
+ return e;
1145
+ }
1146
+ text({ text: e }) {
1147
+ return e;
1148
+ }
1149
+ link({ text: e }) {
1150
+ return "" + e;
1151
+ }
1152
+ image({ text: e }) {
1153
+ return "" + e;
1154
+ }
1155
+ br() {
1156
+ return "";
1157
+ }
1158
+ };
1159
+ var b = class l2 {
1160
+ options;
1161
+ renderer;
1162
+ textRenderer;
1163
+ constructor(e) {
1164
+ this.options = e || T, this.options.renderer = this.options.renderer || new P(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new $();
1165
+ }
1166
+ static parse(e, t) {
1167
+ return new l2(t).parse(e);
1168
+ }
1169
+ static parseInline(e, t) {
1170
+ return new l2(t).parseInline(e);
1171
+ }
1172
+ parse(e, t = true) {
1173
+ let n = "";
1174
+ for (let r = 0; r < e.length; r++) {
1175
+ let i = e[r];
1176
+ if (this.options.extensions?.renderers?.[i.type]) {
1177
+ let a = i, o = this.options.extensions.renderers[a.type].call({ parser: this }, a);
1178
+ if (o !== false || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "def", "paragraph", "text"].includes(a.type)) {
1179
+ n += o || "";
1180
+ continue;
1181
+ }
1182
+ }
1183
+ let s = i;
1184
+ switch (s.type) {
1185
+ case "space": {
1186
+ n += this.renderer.space(s);
1187
+ continue;
1188
+ }
1189
+ case "hr": {
1190
+ n += this.renderer.hr(s);
1191
+ continue;
1192
+ }
1193
+ case "heading": {
1194
+ n += this.renderer.heading(s);
1195
+ continue;
1196
+ }
1197
+ case "code": {
1198
+ n += this.renderer.code(s);
1199
+ continue;
1200
+ }
1201
+ case "table": {
1202
+ n += this.renderer.table(s);
1203
+ continue;
1204
+ }
1205
+ case "blockquote": {
1206
+ n += this.renderer.blockquote(s);
1207
+ continue;
1208
+ }
1209
+ case "list": {
1210
+ n += this.renderer.list(s);
1211
+ continue;
1212
+ }
1213
+ case "html": {
1214
+ n += this.renderer.html(s);
1215
+ continue;
1216
+ }
1217
+ case "def": {
1218
+ n += this.renderer.def(s);
1219
+ continue;
1220
+ }
1221
+ case "paragraph": {
1222
+ n += this.renderer.paragraph(s);
1223
+ continue;
1224
+ }
1225
+ case "text": {
1226
+ let a = s, o = this.renderer.text(a);
1227
+ for (; r + 1 < e.length && e[r + 1].type === "text"; ) a = e[++r], o += `
1228
+ ` + this.renderer.text(a);
1229
+ t ? n += this.renderer.paragraph({ type: "paragraph", raw: o, text: o, tokens: [{ type: "text", raw: o, text: o, escaped: true }] }) : n += o;
1230
+ continue;
1231
+ }
1232
+ default: {
1233
+ let a = 'Token with "' + s.type + '" type was not found.';
1234
+ if (this.options.silent) return console.error(a), "";
1235
+ throw new Error(a);
1236
+ }
1237
+ }
1238
+ }
1239
+ return n;
1240
+ }
1241
+ parseInline(e, t = this.renderer) {
1242
+ let n = "";
1243
+ for (let r = 0; r < e.length; r++) {
1244
+ let i = e[r];
1245
+ if (this.options.extensions?.renderers?.[i.type]) {
1246
+ let a = this.options.extensions.renderers[i.type].call({ parser: this }, i);
1247
+ if (a !== false || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(i.type)) {
1248
+ n += a || "";
1249
+ continue;
1250
+ }
1251
+ }
1252
+ let s = i;
1253
+ switch (s.type) {
1254
+ case "escape": {
1255
+ n += t.text(s);
1256
+ break;
1257
+ }
1258
+ case "html": {
1259
+ n += t.html(s);
1260
+ break;
1261
+ }
1262
+ case "link": {
1263
+ n += t.link(s);
1264
+ break;
1265
+ }
1266
+ case "image": {
1267
+ n += t.image(s);
1268
+ break;
1269
+ }
1270
+ case "strong": {
1271
+ n += t.strong(s);
1272
+ break;
1273
+ }
1274
+ case "em": {
1275
+ n += t.em(s);
1276
+ break;
1277
+ }
1278
+ case "codespan": {
1279
+ n += t.codespan(s);
1280
+ break;
1281
+ }
1282
+ case "br": {
1283
+ n += t.br(s);
1284
+ break;
1285
+ }
1286
+ case "del": {
1287
+ n += t.del(s);
1288
+ break;
1289
+ }
1290
+ case "text": {
1291
+ n += t.text(s);
1292
+ break;
1293
+ }
1294
+ default: {
1295
+ let a = 'Token with "' + s.type + '" type was not found.';
1296
+ if (this.options.silent) return console.error(a), "";
1297
+ throw new Error(a);
1298
+ }
1299
+ }
1300
+ }
1301
+ return n;
1302
+ }
1303
+ };
1304
+ var S = class {
1305
+ options;
1306
+ block;
1307
+ constructor(e) {
1308
+ this.options = e || T;
1309
+ }
1310
+ static passThroughHooks = /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens", "emStrongMask"]);
1311
+ static passThroughHooksRespectAsync = /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens"]);
1312
+ preprocess(e) {
1313
+ return e;
1314
+ }
1315
+ postprocess(e) {
1316
+ return e;
1317
+ }
1318
+ processAllTokens(e) {
1319
+ return e;
1320
+ }
1321
+ emStrongMask(e) {
1322
+ return e;
1323
+ }
1324
+ provideLexer() {
1325
+ return this.block ? x.lex : x.lexInline;
1326
+ }
1327
+ provideParser() {
1328
+ return this.block ? b.parse : b.parseInline;
1329
+ }
1330
+ };
1331
+ var B = class {
1332
+ defaults = L();
1333
+ options = this.setOptions;
1334
+ parse = this.parseMarkdown(true);
1335
+ parseInline = this.parseMarkdown(false);
1336
+ Parser = b;
1337
+ Renderer = P;
1338
+ TextRenderer = $;
1339
+ Lexer = x;
1340
+ Tokenizer = y;
1341
+ Hooks = S;
1342
+ constructor(...e) {
1343
+ this.use(...e);
1344
+ }
1345
+ walkTokens(e, t) {
1346
+ let n = [];
1347
+ for (let r of e) switch (n = n.concat(t.call(this, r)), r.type) {
1348
+ case "table": {
1349
+ let i = r;
1350
+ for (let s of i.header) n = n.concat(this.walkTokens(s.tokens, t));
1351
+ for (let s of i.rows) for (let a of s) n = n.concat(this.walkTokens(a.tokens, t));
1352
+ break;
1353
+ }
1354
+ case "list": {
1355
+ let i = r;
1356
+ n = n.concat(this.walkTokens(i.items, t));
1357
+ break;
1358
+ }
1359
+ default: {
1360
+ let i = r;
1361
+ this.defaults.extensions?.childTokens?.[i.type] ? this.defaults.extensions.childTokens[i.type].forEach((s) => {
1362
+ let a = i[s].flat(1 / 0);
1363
+ n = n.concat(this.walkTokens(a, t));
1364
+ }) : i.tokens && (n = n.concat(this.walkTokens(i.tokens, t)));
1365
+ }
1366
+ }
1367
+ return n;
1368
+ }
1369
+ use(...e) {
1370
+ let t = this.defaults.extensions || { renderers: {}, childTokens: {} };
1371
+ return e.forEach((n) => {
1372
+ let r = { ...n };
1373
+ if (r.async = this.defaults.async || r.async || false, n.extensions && (n.extensions.forEach((i) => {
1374
+ if (!i.name) throw new Error("extension name required");
1375
+ if ("renderer" in i) {
1376
+ let s = t.renderers[i.name];
1377
+ s ? t.renderers[i.name] = function(...a) {
1378
+ let o = i.renderer.apply(this, a);
1379
+ return o === false && (o = s.apply(this, a)), o;
1380
+ } : t.renderers[i.name] = i.renderer;
1381
+ }
1382
+ if ("tokenizer" in i) {
1383
+ if (!i.level || i.level !== "block" && i.level !== "inline") throw new Error("extension level must be 'block' or 'inline'");
1384
+ let s = t[i.level];
1385
+ s ? s.unshift(i.tokenizer) : t[i.level] = [i.tokenizer], i.start && (i.level === "block" ? t.startBlock ? t.startBlock.push(i.start) : t.startBlock = [i.start] : i.level === "inline" && (t.startInline ? t.startInline.push(i.start) : t.startInline = [i.start]));
1386
+ }
1387
+ "childTokens" in i && i.childTokens && (t.childTokens[i.name] = i.childTokens);
1388
+ }), r.extensions = t), n.renderer) {
1389
+ let i = this.defaults.renderer || new P(this.defaults);
1390
+ for (let s in n.renderer) {
1391
+ if (!(s in i)) throw new Error(`renderer '${s}' does not exist`);
1392
+ if (["options", "parser"].includes(s)) continue;
1393
+ let a = s, o = n.renderer[a], p = i[a];
1394
+ i[a] = (...u) => {
1395
+ let c = o.apply(i, u);
1396
+ return c === false && (c = p.apply(i, u)), c || "";
1397
+ };
1398
+ }
1399
+ r.renderer = i;
1400
+ }
1401
+ if (n.tokenizer) {
1402
+ let i = this.defaults.tokenizer || new y(this.defaults);
1403
+ for (let s in n.tokenizer) {
1404
+ if (!(s in i)) throw new Error(`tokenizer '${s}' does not exist`);
1405
+ if (["options", "rules", "lexer"].includes(s)) continue;
1406
+ let a = s, o = n.tokenizer[a], p = i[a];
1407
+ i[a] = (...u) => {
1408
+ let c = o.apply(i, u);
1409
+ return c === false && (c = p.apply(i, u)), c;
1410
+ };
1411
+ }
1412
+ r.tokenizer = i;
1413
+ }
1414
+ if (n.hooks) {
1415
+ let i = this.defaults.hooks || new S();
1416
+ for (let s in n.hooks) {
1417
+ if (!(s in i)) throw new Error(`hook '${s}' does not exist`);
1418
+ if (["options", "block"].includes(s)) continue;
1419
+ let a = s, o = n.hooks[a], p = i[a];
1420
+ S.passThroughHooks.has(s) ? i[a] = (u) => {
1421
+ if (this.defaults.async && S.passThroughHooksRespectAsync.has(s)) return (async () => {
1422
+ let g = await o.call(i, u);
1423
+ return p.call(i, g);
1424
+ })();
1425
+ let c = o.call(i, u);
1426
+ return p.call(i, c);
1427
+ } : i[a] = (...u) => {
1428
+ if (this.defaults.async) return (async () => {
1429
+ let g = await o.apply(i, u);
1430
+ return g === false && (g = await p.apply(i, u)), g;
1431
+ })();
1432
+ let c = o.apply(i, u);
1433
+ return c === false && (c = p.apply(i, u)), c;
1434
+ };
1435
+ }
1436
+ r.hooks = i;
1437
+ }
1438
+ if (n.walkTokens) {
1439
+ let i = this.defaults.walkTokens, s = n.walkTokens;
1440
+ r.walkTokens = function(a) {
1441
+ let o = [];
1442
+ return o.push(s.call(this, a)), i && (o = o.concat(i.call(this, a))), o;
1443
+ };
1444
+ }
1445
+ this.defaults = { ...this.defaults, ...r };
1446
+ }), this;
1447
+ }
1448
+ setOptions(e) {
1449
+ return this.defaults = { ...this.defaults, ...e }, this;
1450
+ }
1451
+ lexer(e, t) {
1452
+ return x.lex(e, t ?? this.defaults);
1453
+ }
1454
+ parser(e, t) {
1455
+ return b.parse(e, t ?? this.defaults);
1456
+ }
1457
+ parseMarkdown(e) {
1458
+ return (n, r) => {
1459
+ let i = { ...r }, s = { ...this.defaults, ...i }, a = this.onError(!!s.silent, !!s.async);
1460
+ if (this.defaults.async === true && i.async === false) return a(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));
1461
+ if (typeof n > "u" || n === null) return a(new Error("marked(): input parameter is undefined or null"));
1462
+ if (typeof n != "string") return a(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(n) + ", string expected"));
1463
+ if (s.hooks && (s.hooks.options = s, s.hooks.block = e), s.async) return (async () => {
1464
+ let o = s.hooks ? await s.hooks.preprocess(n) : n, u = await (s.hooks ? await s.hooks.provideLexer() : e ? x.lex : x.lexInline)(o, s), c = s.hooks ? await s.hooks.processAllTokens(u) : u;
1465
+ s.walkTokens && await Promise.all(this.walkTokens(c, s.walkTokens));
1466
+ let h = await (s.hooks ? await s.hooks.provideParser() : e ? b.parse : b.parseInline)(c, s);
1467
+ return s.hooks ? await s.hooks.postprocess(h) : h;
1468
+ })().catch(a);
1469
+ try {
1470
+ s.hooks && (n = s.hooks.preprocess(n));
1471
+ let p = (s.hooks ? s.hooks.provideLexer() : e ? x.lex : x.lexInline)(n, s);
1472
+ s.hooks && (p = s.hooks.processAllTokens(p)), s.walkTokens && this.walkTokens(p, s.walkTokens);
1473
+ let c = (s.hooks ? s.hooks.provideParser() : e ? b.parse : b.parseInline)(p, s);
1474
+ return s.hooks && (c = s.hooks.postprocess(c)), c;
1475
+ } catch (o) {
1476
+ return a(o);
1477
+ }
1478
+ };
1479
+ }
1480
+ onError(e, t) {
1481
+ return (n) => {
1482
+ if (n.message += `
1483
+ Please report this to https://github.com/markedjs/marked.`, e) {
1484
+ let r = "<p>An error occurred:</p><pre>" + w(n.message + "", true) + "</pre>";
1485
+ return t ? Promise.resolve(r) : r;
1486
+ }
1487
+ if (t) return Promise.reject(n);
1488
+ throw n;
1489
+ };
1490
+ }
1491
+ };
1492
+ var _ = new B();
1493
+ function k(l3, e) {
1494
+ return _.parse(l3, e);
1495
+ }
1496
+ k.options = k.setOptions = function(l3) {
1497
+ return _.setOptions(l3), k.defaults = _.defaults, G(k.defaults), k;
1498
+ };
1499
+ k.getDefaults = L;
1500
+ k.defaults = T;
1501
+ k.use = function(...l3) {
1502
+ return _.use(...l3), k.defaults = _.defaults, G(k.defaults), k;
1503
+ };
1504
+ k.walkTokens = function(l3, e) {
1505
+ return _.walkTokens(l3, e);
1506
+ };
1507
+ k.parseInline = _.parseInline;
1508
+ k.Parser = b;
1509
+ k.parser = b.parse;
1510
+ k.Renderer = P;
1511
+ k.TextRenderer = $;
1512
+ k.Lexer = x;
1513
+ k.lexer = x.lex;
1514
+ k.Tokenizer = y;
1515
+ k.Hooks = S;
1516
+ k.parse = k;
1517
+ var Zt = k.options;
1518
+ var Gt = k.setOptions;
1519
+ var Nt = k.use;
1520
+ var Ft = k.walkTokens;
1521
+ var jt = k.parseInline;
1522
+ var Ut = b.parse;
1523
+ var Kt = x.lex;
1524
+
1525
+ // ../../node_modules/.pnpm/mermaid@11.14.0/node_modules/mermaid/dist/chunks/mermaid.core/chunk-U2HBQHQK.mjs
1526
+ var unknownIcon = {
1527
+ body: '<g><rect width="80" height="80" style="fill: #087ebf; stroke-width: 0px;"/><text transform="translate(21.16 64.67)" style="fill: #fff; font-family: ArialMT, Arial; font-size: 67.75px;"><tspan x="0" y="0">?</tspan></text></g>',
1528
+ height: 80,
1529
+ width: 80
1530
+ };
1531
+ var iconsStore = /* @__PURE__ */ new Map();
1532
+ var loaderStore = /* @__PURE__ */ new Map();
1533
+ var registerIconPacks = /* @__PURE__ */ __name((iconLoaders) => {
1534
+ for (const iconLoader of iconLoaders) {
1535
+ if (!iconLoader.name) {
1536
+ throw new Error(
1537
+ 'Invalid icon loader. Must have a "name" property with non-empty string value.'
1538
+ );
1539
+ }
1540
+ log.debug("Registering icon pack:", iconLoader.name);
1541
+ if ("loader" in iconLoader) {
1542
+ loaderStore.set(iconLoader.name, iconLoader.loader);
1543
+ } else if ("icons" in iconLoader) {
1544
+ iconsStore.set(iconLoader.name, iconLoader.icons);
1545
+ } else {
1546
+ log.error("Invalid icon loader:", iconLoader);
1547
+ throw new Error('Invalid icon loader. Must have either "icons" or "loader" property.');
1548
+ }
1549
+ }
1550
+ }, "registerIconPacks");
1551
+ var getRegisteredIconData = /* @__PURE__ */ __name(async (iconName, fallbackPrefix) => {
1552
+ const data = stringToIcon(iconName, true, fallbackPrefix !== void 0);
1553
+ if (!data) {
1554
+ throw new Error(`Invalid icon name: ${iconName}`);
1555
+ }
1556
+ const prefix = data.prefix || fallbackPrefix;
1557
+ if (!prefix) {
1558
+ throw new Error(`Icon name must contain a prefix: ${iconName}`);
1559
+ }
1560
+ let icons = iconsStore.get(prefix);
1561
+ if (!icons) {
1562
+ const loader = loaderStore.get(prefix);
1563
+ if (!loader) {
1564
+ throw new Error(`Icon set not found: ${data.prefix}`);
1565
+ }
1566
+ try {
1567
+ const loaded = await loader();
1568
+ icons = { ...loaded, prefix };
1569
+ iconsStore.set(prefix, icons);
1570
+ } catch (e) {
1571
+ log.error(e);
1572
+ throw new Error(`Failed to load icon set: ${data.prefix}`);
1573
+ }
1574
+ }
1575
+ const iconData = getIconData(icons, data.name);
1576
+ if (!iconData) {
1577
+ throw new Error(`Icon not found: ${iconName}`);
1578
+ }
1579
+ return iconData;
1580
+ }, "getRegisteredIconData");
1581
+ var isIconAvailable = /* @__PURE__ */ __name(async (iconName) => {
1582
+ try {
1583
+ await getRegisteredIconData(iconName);
1584
+ return true;
1585
+ } catch {
1586
+ return false;
1587
+ }
1588
+ }, "isIconAvailable");
1589
+ var getIconSVG = /* @__PURE__ */ __name(async (iconName, customisations, extraAttributes) => {
1590
+ let iconData;
1591
+ try {
1592
+ iconData = await getRegisteredIconData(iconName, customisations?.fallbackPrefix);
1593
+ } catch (e) {
1594
+ log.error(e);
1595
+ iconData = unknownIcon;
1596
+ }
1597
+ const renderData = iconToSVG(iconData, customisations);
1598
+ const svg = iconToHTML(replaceIDs(renderData.body), {
1599
+ ...renderData.attributes,
1600
+ ...extraAttributes
1601
+ });
1602
+ return sanitizeText(svg, getConfig());
1603
+ }, "getIconSVG");
1604
+ function preprocessMarkdown(markdown, { markdownAutoWrap }) {
1605
+ const withoutBR = markdown.replace(/<br\/>/g, "\n");
1606
+ const withoutMultipleNewlines = withoutBR.replace(/\n{2,}/g, "\n");
1607
+ const withoutExtraSpaces = dedent(withoutMultipleNewlines);
1608
+ if (markdownAutoWrap === false) {
1609
+ }
1610
+ return withoutExtraSpaces;
1611
+ }
1612
+ __name(preprocessMarkdown, "preprocessMarkdown");
1613
+ function nonMarkdownToLines(nonMarkdownText) {
1614
+ return nonMarkdownText.split(/\\n|\n|<br\s*\/?>/gi).map(
1615
+ (line) => line.trim().match(/<[^>]+>|[^\s<>]+/g)?.map((word) => ({ content: word, type: "normal" })) ?? []
1616
+ );
1617
+ }
1618
+ __name(nonMarkdownToLines, "nonMarkdownToLines");
1619
+ function markdownToLines(markdown, config = {}) {
1620
+ const preprocessedMarkdown = preprocessMarkdown(markdown, config);
1621
+ const nodes = k.lexer(preprocessedMarkdown);
1622
+ const lines = [[]];
1623
+ let currentLine = 0;
1624
+ function processNode(node, parentType = "normal") {
1625
+ if (node.type === "text") {
1626
+ const textLines = node.text.split("\n");
1627
+ textLines.forEach((textLine, index) => {
1628
+ if (index !== 0) {
1629
+ currentLine++;
1630
+ lines.push([]);
1631
+ }
1632
+ textLine.split(" ").forEach((word) => {
1633
+ word = word.replace(/&#39;/g, `'`);
1634
+ if (word) {
1635
+ lines[currentLine].push({ content: word, type: parentType });
1636
+ }
1637
+ });
1638
+ });
1639
+ } else if (node.type === "strong" || node.type === "em") {
1640
+ node.tokens.forEach((contentNode) => {
1641
+ processNode(contentNode, node.type);
1642
+ });
1643
+ } else if (node.type === "html") {
1644
+ lines[currentLine].push({ content: node.text, type: "normal" });
1645
+ }
1646
+ }
1647
+ __name(processNode, "processNode");
1648
+ nodes.forEach((treeNode) => {
1649
+ if (treeNode.type === "paragraph") {
1650
+ treeNode.tokens?.forEach((contentNode) => {
1651
+ processNode(contentNode);
1652
+ });
1653
+ } else if (treeNode.type === "html") {
1654
+ lines[currentLine].push({ content: treeNode.text, type: "normal" });
1655
+ } else {
1656
+ lines[currentLine].push({ content: treeNode.raw, type: "normal" });
1657
+ }
1658
+ });
1659
+ return lines;
1660
+ }
1661
+ __name(markdownToLines, "markdownToLines");
1662
+ function nonMarkdownToHTML(text) {
1663
+ if (!text) {
1664
+ return "";
1665
+ }
1666
+ return `<p>${/**
1667
+ * Replace new lines with <br /> tags.
1668
+ *
1669
+ * Unlike in markdown text, `\n` sequences are treated as line breaks here.
1670
+ */
1671
+ text.replace(/\\n|\n/g, "<br />")}</p>`;
1672
+ }
1673
+ __name(nonMarkdownToHTML, "nonMarkdownToHTML");
1674
+ function markdownToHTML(markdown, { markdownAutoWrap } = {}) {
1675
+ const nodes = k.lexer(markdown);
1676
+ function output(node) {
1677
+ if (node.type === "text") {
1678
+ if (markdownAutoWrap === false) {
1679
+ return node.text.replace(/\n */g, "<br/>").replace(/ /g, "&nbsp;");
1680
+ }
1681
+ return node.text.replace(/\n */g, "<br/>");
1682
+ } else if (node.type === "strong") {
1683
+ return `<strong>${node.tokens?.map(output).join("")}</strong>`;
1684
+ } else if (node.type === "em") {
1685
+ return `<em>${node.tokens?.map(output).join("")}</em>`;
1686
+ } else if (node.type === "paragraph") {
1687
+ return `<p>${node.tokens?.map(output).join("")}</p>`;
1688
+ } else if (node.type === "space") {
1689
+ return "";
1690
+ } else if (node.type === "html") {
1691
+ return `${node.text}`;
1692
+ } else if (node.type === "escape") {
1693
+ return node.text;
1694
+ }
1695
+ log.warn(`Unsupported markdown: ${node.type}`);
1696
+ return node.raw;
1697
+ }
1698
+ __name(output, "output");
1699
+ return nodes.map(output).join("");
1700
+ }
1701
+ __name(markdownToHTML, "markdownToHTML");
1702
+ function splitTextToChars(text) {
1703
+ if (Intl.Segmenter) {
1704
+ return [...new Intl.Segmenter().segment(text)].map((s) => s.segment);
1705
+ }
1706
+ return [...text];
1707
+ }
1708
+ __name(splitTextToChars, "splitTextToChars");
1709
+ function splitWordToFitWidth(checkFit, word) {
1710
+ const characters = splitTextToChars(word.content);
1711
+ return splitWordToFitWidthRecursion(checkFit, [], characters, word.type);
1712
+ }
1713
+ __name(splitWordToFitWidth, "splitWordToFitWidth");
1714
+ function splitWordToFitWidthRecursion(checkFit, usedChars, remainingChars, type) {
1715
+ if (remainingChars.length === 0) {
1716
+ return [
1717
+ { content: usedChars.join(""), type },
1718
+ { content: "", type }
1719
+ ];
1720
+ }
1721
+ const [nextChar, ...rest] = remainingChars;
1722
+ const newWord = [...usedChars, nextChar];
1723
+ if (checkFit([{ content: newWord.join(""), type }])) {
1724
+ return splitWordToFitWidthRecursion(checkFit, newWord, rest, type);
1725
+ }
1726
+ if (usedChars.length === 0 && nextChar) {
1727
+ usedChars.push(nextChar);
1728
+ remainingChars.shift();
1729
+ }
1730
+ return [
1731
+ { content: usedChars.join(""), type },
1732
+ { content: remainingChars.join(""), type }
1733
+ ];
1734
+ }
1735
+ __name(splitWordToFitWidthRecursion, "splitWordToFitWidthRecursion");
1736
+ function splitLineToFitWidth(line, checkFit) {
1737
+ if (line.some(({ content }) => content.includes("\n"))) {
1738
+ throw new Error("splitLineToFitWidth does not support newlines in the line");
1739
+ }
1740
+ return splitLineToFitWidthRecursion(line, checkFit);
1741
+ }
1742
+ __name(splitLineToFitWidth, "splitLineToFitWidth");
1743
+ function splitLineToFitWidthRecursion(words, checkFit, lines = [], newLine = []) {
1744
+ if (words.length === 0) {
1745
+ if (newLine.length > 0) {
1746
+ lines.push(newLine);
1747
+ }
1748
+ return lines.length > 0 ? lines : [];
1749
+ }
1750
+ let joiner = "";
1751
+ if (words[0].content === " ") {
1752
+ joiner = " ";
1753
+ words.shift();
1754
+ }
1755
+ const nextWord = words.shift() ?? { content: " ", type: "normal" };
1756
+ const lineWithNextWord = [...newLine];
1757
+ if (joiner !== "") {
1758
+ lineWithNextWord.push({ content: joiner, type: "normal" });
1759
+ }
1760
+ lineWithNextWord.push(nextWord);
1761
+ if (checkFit(lineWithNextWord)) {
1762
+ return splitLineToFitWidthRecursion(words, checkFit, lines, lineWithNextWord);
1763
+ }
1764
+ if (newLine.length > 0) {
1765
+ lines.push(newLine);
1766
+ words.unshift(nextWord);
1767
+ } else if (nextWord.content) {
1768
+ const [line, rest] = splitWordToFitWidth(checkFit, nextWord);
1769
+ lines.push([line]);
1770
+ if (rest.content) {
1771
+ words.unshift(rest);
1772
+ }
1773
+ }
1774
+ return splitLineToFitWidthRecursion(words, checkFit, lines);
1775
+ }
1776
+ __name(splitLineToFitWidthRecursion, "splitLineToFitWidthRecursion");
1777
+ function applyStyle(dom, styleFn) {
1778
+ if (styleFn) {
1779
+ dom.attr("style", styleFn);
1780
+ }
1781
+ }
1782
+ __name(applyStyle, "applyStyle");
1783
+ var maxSafeSizeForWidth = 16384;
1784
+ async function addHtmlSpan(element, node, width, classes, addBackground = false, config = getConfig()) {
1785
+ const fo = element.append("foreignObject");
1786
+ fo.attr("width", `${Math.min(10 * width, maxSafeSizeForWidth)}px`);
1787
+ fo.attr("height", `${Math.min(10 * width, maxSafeSizeForWidth)}px`);
1788
+ const div = fo.append("xhtml:div");
1789
+ const sanitizedLabel = hasKatex(node.label) ? await renderKatexSanitized(node.label.replace(common_default.lineBreakRegex, "\n"), config) : sanitizeText(node.label, config);
1790
+ const labelClass = node.isNode ? "nodeLabel" : "edgeLabel";
1791
+ const span = div.append("span");
1792
+ span.html(sanitizedLabel);
1793
+ applyStyle(span, node.labelStyle);
1794
+ span.attr("class", `${labelClass} ${classes}`);
1795
+ applyStyle(div, node.labelStyle);
1796
+ div.style("display", "table-cell");
1797
+ div.style("white-space", "nowrap");
1798
+ div.style("line-height", "1.5");
1799
+ if (width !== Number.POSITIVE_INFINITY) {
1800
+ div.style("max-width", width + "px");
1801
+ div.style("text-align", "center");
1802
+ }
1803
+ div.attr("xmlns", "http://www.w3.org/1999/xhtml");
1804
+ if (addBackground) {
1805
+ div.attr("class", "labelBkg");
1806
+ }
1807
+ let bbox = div.node().getBoundingClientRect();
1808
+ if (bbox.width === width) {
1809
+ div.style("display", "table");
1810
+ div.style("white-space", "break-spaces");
1811
+ div.style("width", width + "px");
1812
+ bbox = div.node().getBoundingClientRect();
1813
+ }
1814
+ return fo.node();
1815
+ }
1816
+ __name(addHtmlSpan, "addHtmlSpan");
1817
+ function createTspan(textElement, lineIndex, lineHeight, centerText = false) {
1818
+ const tspan = textElement.append("tspan").attr("class", "text-outer-tspan").attr("x", 0).attr("y", lineIndex * lineHeight - 0.1 + "em").attr("dy", lineHeight + "em");
1819
+ if (centerText) {
1820
+ tspan.attr("text-anchor", "middle");
1821
+ }
1822
+ return tspan;
1823
+ }
1824
+ __name(createTspan, "createTspan");
1825
+ function computeWidthOfText(parentNode, lineHeight, line) {
1826
+ const testElement = parentNode.append("text");
1827
+ const testSpan = createTspan(testElement, 1, lineHeight);
1828
+ updateTextContentAndStyles(testSpan, line);
1829
+ const textLength = testSpan.node().getComputedTextLength();
1830
+ testElement.remove();
1831
+ return textLength;
1832
+ }
1833
+ __name(computeWidthOfText, "computeWidthOfText");
1834
+ function computeDimensionOfText(parentNode, lineHeight, text) {
1835
+ const testElement = parentNode.append("text");
1836
+ const testSpan = createTspan(testElement, 1, lineHeight);
1837
+ updateTextContentAndStyles(testSpan, [{ content: text, type: "normal" }]);
1838
+ const textDimension = testSpan.node()?.getBoundingClientRect();
1839
+ if (textDimension) {
1840
+ testElement.remove();
1841
+ }
1842
+ return textDimension;
1843
+ }
1844
+ __name(computeDimensionOfText, "computeDimensionOfText");
1845
+ function createFormattedText(width, g, structuredText, addBackground = false, centerText = false) {
1846
+ const lineHeight = 1.1;
1847
+ const labelGroup = g.append("g");
1848
+ const bkg = labelGroup.insert("rect").attr("class", "background").attr("style", "stroke: none");
1849
+ const textElement = labelGroup.append("text").attr("y", "-10.1");
1850
+ if (centerText) {
1851
+ textElement.attr("text-anchor", "middle");
1852
+ }
1853
+ let lineIndex = 0;
1854
+ for (const line of structuredText) {
1855
+ const checkWidth = /* @__PURE__ */ __name((line2) => computeWidthOfText(labelGroup, lineHeight, line2) <= width, "checkWidth");
1856
+ const linesUnderWidth = checkWidth(line) ? [line] : splitLineToFitWidth(line, checkWidth);
1857
+ for (const preparedLine of linesUnderWidth) {
1858
+ const tspan = createTspan(textElement, lineIndex, lineHeight, centerText);
1859
+ updateTextContentAndStyles(tspan, preparedLine);
1860
+ lineIndex++;
1861
+ }
1862
+ }
1863
+ if (addBackground) {
1864
+ const bbox = textElement.node().getBBox();
1865
+ const padding = 2;
1866
+ bkg.attr("x", bbox.x - padding).attr("y", bbox.y - padding).attr("width", bbox.width + 2 * padding).attr("height", bbox.height + 2 * padding);
1867
+ return labelGroup.node();
1868
+ } else {
1869
+ return textElement.node();
1870
+ }
1871
+ }
1872
+ __name(createFormattedText, "createFormattedText");
1873
+ function decodeHTMLEntities(text) {
1874
+ const regex2 = /&(amp|lt|gt);/g;
1875
+ return text.replace(regex2, (match, entity) => {
1876
+ switch (entity) {
1877
+ case "amp":
1878
+ return "&";
1879
+ case "lt":
1880
+ return "<";
1881
+ case "gt":
1882
+ return ">";
1883
+ default:
1884
+ return match;
1885
+ }
1886
+ });
1887
+ }
1888
+ __name(decodeHTMLEntities, "decodeHTMLEntities");
1889
+ function updateTextContentAndStyles(tspan, wrappedLine) {
1890
+ tspan.text("");
1891
+ wrappedLine.forEach((word, index) => {
1892
+ const innerTspan = tspan.append("tspan").attr("font-style", word.type === "em" ? "italic" : "normal").attr("class", "text-inner-tspan").attr("font-weight", word.type === "strong" ? "bold" : "normal");
1893
+ if (index === 0) {
1894
+ innerTspan.text(decodeHTMLEntities(word.content));
1895
+ } else {
1896
+ innerTspan.text(" " + decodeHTMLEntities(word.content));
1897
+ }
1898
+ });
1899
+ }
1900
+ __name(updateTextContentAndStyles, "updateTextContentAndStyles");
1901
+ async function replaceIconSubstring(text, config = {}) {
1902
+ const pendingReplacements = [];
1903
+ text.replace(/(fa[bklrs]?):fa-([\w-]+)/g, (fullMatch, prefix, iconName) => {
1904
+ pendingReplacements.push(
1905
+ (async () => {
1906
+ const registeredIconName = `${prefix}:${iconName}`;
1907
+ if (await isIconAvailable(registeredIconName)) {
1908
+ return await getIconSVG(registeredIconName, void 0, { class: "label-icon" });
1909
+ } else {
1910
+ return `<i class='${sanitizeText(fullMatch, config).replace(":", " ")}'></i>`;
1911
+ }
1912
+ })()
1913
+ );
1914
+ return fullMatch;
1915
+ });
1916
+ const replacements = await Promise.all(pendingReplacements);
1917
+ return text.replace(/(fa[bklrs]?):fa-([\w-]+)/g, () => replacements.shift() ?? "");
1918
+ }
1919
+ __name(replaceIconSubstring, "replaceIconSubstring");
1920
+ var createText = /* @__PURE__ */ __name(async (el, text = "", {
1921
+ style = "",
1922
+ isTitle = false,
1923
+ classes = "",
1924
+ useHtmlLabels = true,
1925
+ markdown = true,
1926
+ isNode = true,
1927
+ /**
1928
+ * The width to wrap the text within. Set to `Number.POSITIVE_INFINITY` for no wrapping.
1929
+ */
1930
+ width = 200,
1931
+ addSvgBackground = false
1932
+ } = {}, config) => {
1933
+ log.debug(
1934
+ "XYZ createText",
1935
+ text,
1936
+ style,
1937
+ isTitle,
1938
+ classes,
1939
+ useHtmlLabels,
1940
+ isNode,
1941
+ "addSvgBackground: ",
1942
+ addSvgBackground
1943
+ );
1944
+ if (useHtmlLabels) {
1945
+ const htmlText = markdown ? markdownToHTML(text, config) : nonMarkdownToHTML(text);
1946
+ const decodedReplacedText = await replaceIconSubstring(decodeEntities(htmlText), config);
1947
+ const inputForKatex = text.replace(/\\\\/g, "\\");
1948
+ const node = {
1949
+ isNode,
1950
+ label: hasKatex(text) ? inputForKatex : decodedReplacedText,
1951
+ labelStyle: style.replace("fill:", "color:")
1952
+ };
1953
+ const vertexNode = await addHtmlSpan(el, node, width, classes, addSvgBackground, config);
1954
+ return vertexNode;
1955
+ } else {
1956
+ const sanitizeBR = decodeEntities(text.replace(/<br\s*\/?>/g, "<br/>"));
1957
+ const structuredText = markdown ? markdownToLines(sanitizeBR.replace("<br>", "<br/>"), config) : nonMarkdownToLines(sanitizeBR);
1958
+ const svgLabel = createFormattedText(
1959
+ width,
1960
+ el,
1961
+ structuredText,
1962
+ text ? addSvgBackground : false,
1963
+ !isNode
1964
+ );
1965
+ if (isNode) {
1966
+ if (/stroke:/.exec(style)) {
1967
+ style = style.replace("stroke:", "lineColor:");
1968
+ }
1969
+ const nodeLabelTextStyle = style.replace(/stroke:[^;]+;?/g, "").replace(/stroke-width:[^;]+;?/g, "").replace(/fill:[^;]+;?/g, "").replace(/color:/g, "fill:");
1970
+ select_default(svgLabel).attr("style", nodeLabelTextStyle);
1971
+ } else {
1972
+ const edgeLabelRectStyle = style.replace(/stroke:[^;]+;?/g, "").replace(/stroke-width:[^;]+;?/g, "").replace(/fill:[^;]+;?/g, "").replace(/background:/g, "fill:");
1973
+ select_default(svgLabel).select("rect").attr("style", edgeLabelRectStyle.replace(/background:/g, "fill:"));
1974
+ const edgeLabelTextStyle = style.replace(/stroke:[^;]+;?/g, "").replace(/stroke-width:[^;]+;?/g, "").replace(/fill:[^;]+;?/g, "").replace(/color:/g, "fill:");
1975
+ select_default(svgLabel).select("text").attr("style", edgeLabelTextStyle);
1976
+ }
1977
+ if (isTitle) {
1978
+ select_default(svgLabel).selectAll("tspan.text-outer-tspan").classed("title-row", true);
1979
+ } else {
1980
+ select_default(svgLabel).selectAll("tspan.text-outer-tspan").classed("row", true);
1981
+ }
1982
+ return svgLabel;
1983
+ }
1984
+ }, "createText");
1985
+
1986
+ export {
1987
+ dedent,
1988
+ unknownIcon,
1989
+ registerIconPacks,
1990
+ getIconSVG,
1991
+ computeDimensionOfText,
1992
+ createText
1993
+ };
1994
+ //# sourceMappingURL=chunk-OGMSNDVH.js.map