@aiquants/markdown 12.2.3 → 13.0.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 (265) hide show
  1. package/README.md +383 -75
  2. package/dist/{abnfDiagram-VRR7QNED-DQ52KUbH.js → abnfDiagram-VRR7QNED-B3Q9attM.js} +9 -9
  3. package/dist/abnfDiagram-VRR7QNED-QW4YM2AY.cjs +1 -0
  4. package/dist/arc-BBLXr5EU.js +83 -0
  5. package/dist/arc-Cn8XXgbN.cjs +1 -0
  6. package/dist/{architectureDiagram-ZJ3FMSHR-Cc9gQRX2.js → architectureDiagram-ZJ3FMSHR-BaSp0hC2.js} +2 -2
  7. package/dist/architectureDiagram-ZJ3FMSHR-BfmjNYww.cjs +36 -0
  8. package/dist/{blockDiagram-677ZJIJ3-DIpIE77y.js → blockDiagram-677ZJIJ3-DFcPQ19k.js} +3 -3
  9. package/dist/{blockDiagram-677ZJIJ3-BCgCtZXM.cjs → blockDiagram-677ZJIJ3-u7d3VCxA.cjs} +1 -1
  10. package/dist/{c4Diagram-LMCZKHZV-jgR25uUP.js → c4Diagram-LMCZKHZV-DW0yo5tR.js} +2 -2
  11. package/dist/{c4Diagram-LMCZKHZV-q0iHoZqg.cjs → c4Diagram-LMCZKHZV-nScsMUE3.cjs} +1 -1
  12. package/dist/{channel-Bw3o-12p.js → channel-B2FBCr9X.js} +1 -1
  13. package/dist/channel-DlkTPSf_.cjs +1 -0
  14. package/dist/{chunk-2Q5K7J3B-0amJDSXB.js → chunk-2Q5K7J3B-BkE4Fsuz.js} +1 -1
  15. package/dist/chunk-2Q5K7J3B-evSha-HP.cjs +1 -0
  16. package/dist/{chunk-32BRIVSS-BMqTi8UH.js → chunk-32BRIVSS-CqpDiZD2.js} +1 -1
  17. package/dist/chunk-32BRIVSS-rIw6tBRO.cjs +1 -0
  18. package/dist/{chunk-5VM5RSS4-C0OtlojA.cjs → chunk-5VM5RSS4-CYVpj2mc.cjs} +1 -1
  19. package/dist/{chunk-5VM5RSS4-EGE3VaH8.js → chunk-5VM5RSS4-DAgNhPcU.js} +1 -1
  20. package/dist/{chunk-EX3LRPZG-4qSuVZkz.cjs → chunk-EX3LRPZG-Ct2cyGh-.cjs} +1 -1
  21. package/dist/{chunk-EX3LRPZG-wasnZ2h7.js → chunk-EX3LRPZG-QFjD28UF.js} +37 -37
  22. package/dist/{chunk-JWPE2WC7-O891tu2Q.js → chunk-JWPE2WC7-Bj2m1SXZ.js} +1 -1
  23. package/dist/chunk-JWPE2WC7-Dgw1ILoe.cjs +1 -0
  24. package/dist/{chunk-MOJQB5TN-BzuZr6pz.js → chunk-MOJQB5TN-B1fdnpCz.js} +121 -121
  25. package/dist/{chunk-MOJQB5TN-BSfpWEVd.cjs → chunk-MOJQB5TN-yjlPYCh4.cjs} +3 -3
  26. package/dist/{chunk-PUDLZKDR-DNbm7Xzd.cjs → chunk-PUDLZKDR-BlQ3qKcC.cjs} +4 -4
  27. package/dist/{chunk-PUDLZKDR-BRL3efwE.js → chunk-PUDLZKDR-CIcw3cpm.js} +16 -16
  28. package/dist/chunk-RYQCIY6F-B-V6UOJy.cjs +1 -0
  29. package/dist/{chunk-RYQCIY6F-DwmsCCiA.js → chunk-RYQCIY6F-DyVk8fNp.js} +1 -1
  30. package/dist/{chunk-V7JOEXUC-BowEdIo-.cjs → chunk-V7JOEXUC-B1EgagKh.cjs} +3 -3
  31. package/dist/{chunk-V7JOEXUC-D0oynREN.js → chunk-V7JOEXUC-C776k7_V.js} +5 -5
  32. package/dist/{chunk-VR4S4FIN-Dg_3SNs1.js → chunk-VR4S4FIN-CyqARa17.js} +3 -3
  33. package/dist/chunk-VR4S4FIN-Sx71KwIQ.cjs +1 -0
  34. package/dist/{chunk-XXDRQBXY-Byo5u3b_.js → chunk-XXDRQBXY-B-99Fbs_.js} +3 -3
  35. package/dist/chunk-XXDRQBXY-BgeRIUG1.cjs +1 -0
  36. package/dist/classDiagram-OUVF2IWQ-BLAiuPPL.cjs +1 -0
  37. package/dist/{classDiagram-v2-EOCWNBFH-CVu4_B8x.js → classDiagram-OUVF2IWQ-DJ0hW16Q.js} +2 -2
  38. package/dist/classDiagram-v2-EOCWNBFH-BLAiuPPL.cjs +1 -0
  39. package/dist/{classDiagram-OUVF2IWQ-CVu4_B8x.js → classDiagram-v2-EOCWNBFH-DJ0hW16Q.js} +2 -2
  40. package/dist/{code-blocks-BWr5Xg1I.js → code-blocks-C6J8rVTc.js} +23 -22
  41. package/dist/{code-blocks-BdKjppKq.cjs → code-blocks-CTESwslp.cjs} +3 -3
  42. package/dist/code-blocks.cjs +1 -1
  43. package/dist/code-blocks.d.ts +1 -0
  44. package/dist/code-blocks.js +15 -14
  45. package/dist/components/CopyButton.d.ts +8 -0
  46. package/dist/components/HostedScrollArea.d.ts +2 -1
  47. package/dist/components/MarkdownRenderer.d.ts +37 -3
  48. package/dist/components/MarkdownViewer.d.ts +15 -4
  49. package/dist/components/MermaidDiagram.d.ts +1 -0
  50. package/dist/components/ReadingPlaceKeeper.d.ts +32 -0
  51. package/dist/components/SelectionKeeper.d.ts +38 -0
  52. package/dist/components/SpreadsheetBlock.d.ts +4 -2
  53. package/dist/components/blockKeys.d.ts +9 -2
  54. package/dist/components/blockOffsets.d.ts +3 -0
  55. package/dist/components/clipboard.d.ts +1 -0
  56. package/dist/components/codeBlockLabels.d.ts +9 -0
  57. package/dist/components/cssLength.d.ts +1 -0
  58. package/dist/components/displayMathLabels.d.ts +11 -0
  59. package/dist/components/embeds/ClientFrame.d.ts +1 -0
  60. package/dist/components/embeds/ProviderEmbed.d.ts +2 -1
  61. package/dist/components/embeds/embedLabels.d.ts +1 -1
  62. package/dist/components/embeds/linkCardFetch.d.ts +2 -0
  63. package/dist/components/embeds.d.ts +5 -0
  64. package/dist/components/headingLevels.d.ts +6 -0
  65. package/dist/components/htmlNodes.d.ts +2 -0
  66. package/dist/components/htmlSanitizer.d.ts +15 -2
  67. package/dist/components/labels.d.ts +3 -2
  68. package/dist/components/links.d.ts +1 -0
  69. package/dist/components/mathRendering.d.ts +3 -1
  70. package/dist/components/mdastNodes/CodeNode.d.ts +5 -1
  71. package/dist/components/mdastNodes/MathNode.d.ts +6 -5
  72. package/dist/components/mermaidLabels.d.ts +5 -0
  73. package/dist/components/mermaidSetup.d.ts +10 -0
  74. package/dist/components/missingImageLabels.d.ts +2 -0
  75. package/dist/components/ownPixels.d.ts +4 -0
  76. package/dist/components/rawHtml.d.ts +7 -3
  77. package/dist/components/spreadsheetModel.d.ts +1 -0
  78. package/dist/components/toolbarOverlap.d.ts +4 -1
  79. package/dist/components/viewerLabels.d.ts +22 -3
  80. package/dist/components/viewerToolbarStyles.d.ts +2 -0
  81. package/dist/contentColors.d.ts +21 -0
  82. package/dist/conversion.d.ts +7 -0
  83. package/dist/converter/NOTICES.md +6 -6
  84. package/dist/converter/createMarkdownConverter.d.ts +1 -0
  85. package/dist/converter/protocol.d.ts +4 -0
  86. package/dist/converter.cjs +1 -1
  87. package/dist/converter.js +89 -71
  88. package/dist/converter.wasm +0 -0
  89. package/dist/{cose-bilkent-JH36ORCC-BmM-AQ-j.js → cose-bilkent-JH36ORCC-CR6Hdvto.js} +1 -1
  90. package/dist/cose-bilkent-JH36ORCC-reAbGeDU.cjs +1 -0
  91. package/dist/cynefinDiagram-TSTJHNR4-2qz-sUtp.cjs +62 -0
  92. package/dist/{cynefinDiagram-TSTJHNR4-iS4n-7T_.js → cynefinDiagram-TSTJHNR4-D1eY-FSf.js} +56 -56
  93. package/dist/dagre-VKFMJZFB-Byr9WPjb.cjs +4 -0
  94. package/dist/{dagre-VKFMJZFB-C1Y6S6Dm.js → dagre-VKFMJZFB-CXSczF8v.js} +25 -25
  95. package/dist/{diagram-FQU43EPY-CRXs7mU1.cjs → diagram-FQU43EPY-2YWng437.cjs} +1 -1
  96. package/dist/{diagram-FQU43EPY-CFG9AlAq.js → diagram-FQU43EPY-BZo0xcaj.js} +35 -35
  97. package/dist/diagram-G47NLZAW-CQS7BN4F.cjs +24 -0
  98. package/dist/{diagram-G47NLZAW-Bqr76Qn5.js → diagram-G47NLZAW-CvJW9ny8.js} +60 -60
  99. package/dist/{diagram-NH7WQ7WH-BDWfQ8xs.js → diagram-NH7WQ7WH-C6VIkj-R.js} +17 -17
  100. package/dist/diagram-NH7WQ7WH-DXUwOBe7.cjs +24 -0
  101. package/dist/{diagram-OA4YK3LP-DuW90Uhk.js → diagram-OA4YK3LP-Co6nMbJc.js} +28 -28
  102. package/dist/{diagram-OA4YK3LP-uBVV8yBB.cjs → diagram-OA4YK3LP-DBUm2qxb.cjs} +3 -3
  103. package/dist/{diagram-WEI45ONY-Cd3qe8Wi.js → diagram-WEI45ONY-BaMbc5o2.js} +59 -59
  104. package/dist/diagram-WEI45ONY-ChpK2gP3.cjs +41 -0
  105. package/dist/ebnfDiagram-CCIWWBDH-DMIRHp8N.cjs +1 -0
  106. package/dist/{ebnfDiagram-CCIWWBDH-CMmTdVTT.js → ebnfDiagram-CCIWWBDH-i7CR-FU0.js} +3 -3
  107. package/dist/embeds/frames.d.ts +4 -0
  108. package/dist/embeds/linkCards.d.ts +3 -1
  109. package/dist/embeds/providers.d.ts +1 -0
  110. package/dist/embeds/testing.cjs +1 -1
  111. package/dist/embeds/testing.js +1 -1
  112. package/dist/embeds-B4g6w7Tf.cjs +1 -0
  113. package/dist/embeds-Dra-dGKD.js +64 -0
  114. package/dist/embeds.cjs +1 -1
  115. package/dist/embeds.d.ts +2 -2
  116. package/dist/embeds.js +31 -70
  117. package/dist/{erDiagram-Q63AITRT-tOZoI25O.js → erDiagram-Q63AITRT-DC-HhdaO.js} +68 -68
  118. package/dist/{erDiagram-Q63AITRT-ONnVKrzr.cjs → erDiagram-Q63AITRT-DjRvJyWK.cjs} +1 -1
  119. package/dist/errors-BWZJx2MD.cjs +1 -0
  120. package/dist/errors-CapTNE7l.js +62 -0
  121. package/dist/errors.d.ts +2 -2
  122. package/dist/extractHeadings-BAhmauKo.js +5296 -0
  123. package/dist/extractHeadings-qiJXegCx.cjs +11 -0
  124. package/dist/flowDiagram-23GEKE2U-CiNzp6BS.js +7 -0
  125. package/dist/flowDiagram-23GEKE2U-DzZNPkRJ.cjs +1 -0
  126. package/dist/{ganttDiagram-NO4QXBWP-C23vm5cK.js → ganttDiagram-NO4QXBWP-BwbtaPxc.js} +69 -69
  127. package/dist/ganttDiagram-NO4QXBWP-CJv5UQ4O.cjs +292 -0
  128. package/dist/gen/markdown/v1/linkcard_connect.d.ts +19 -0
  129. package/dist/gen/markdown/v1/linkcard_pb.d.ts +87 -0
  130. package/dist/gen/markdown/v1/markdown_pb.d.ts +4 -0
  131. package/dist/{gitGraphDiagram-IHSO6WYX-BXWses91.js → gitGraphDiagram-IHSO6WYX--yebcp4V.js} +21 -21
  132. package/dist/gitGraphDiagram-IHSO6WYX-dSwtW7X6.cjs +106 -0
  133. package/dist/index.cjs +1 -1
  134. package/dist/index.client.cjs +1 -1
  135. package/dist/index.client.d.ts +5 -3
  136. package/dist/index.client.js +56 -48
  137. package/dist/index.js +56 -48
  138. package/dist/index.server.cjs +1 -1
  139. package/dist/index.server.d.ts +2 -1
  140. package/dist/index.server.js +126 -873
  141. package/dist/{infoDiagram-FWYZ7A6U-C4NsbHAN.js → infoDiagram-FWYZ7A6U-B4AiTiqD.js} +9 -9
  142. package/dist/infoDiagram-FWYZ7A6U-BOj0VF20.cjs +2 -0
  143. package/dist/{ishikawaDiagram-FXEZZL3T-B2bMsFnl.js → ishikawaDiagram-FXEZZL3T-BsYs_qnQ.js} +59 -59
  144. package/dist/{ishikawaDiagram-FXEZZL3T-Cjqwv-T2.cjs → ishikawaDiagram-FXEZZL3T-CisV4kPO.cjs} +1 -1
  145. package/dist/{journeyDiagram-5HDEW3XC-DfRiiYRf.cjs → journeyDiagram-5HDEW3XC-BAvgWwpr.cjs} +1 -1
  146. package/dist/{journeyDiagram-5HDEW3XC-DO1Xx-OE.js → journeyDiagram-5HDEW3XC-DbDo-dqu.js} +32 -32
  147. package/dist/{kanban-definition-HUTT4EX6-RfpoaM17.js → kanban-definition-HUTT4EX6-BlPZISwH.js} +97 -97
  148. package/dist/{kanban-definition-HUTT4EX6-Cu_E-BJj.cjs → kanban-definition-HUTT4EX6-RjzOWas9.cjs} +2 -2
  149. package/dist/{linear-BbWOUIQi.js → linear-BXWX8YXI.js} +31 -31
  150. package/dist/linear-CKPQExK8.cjs +1 -0
  151. package/dist/linkCardServer/linkCardCore.d.ts +10 -0
  152. package/dist/linkCardServer/linkCardHandler.server.d.ts +1 -6
  153. package/dist/linkCardServer/pageFetchPort.d.ts +19 -0
  154. package/dist/linkCardServer/{pageMetadata.server.d.ts → pageMetadata.d.ts} +11 -3
  155. package/dist/linkCards-BikpIncf.cjs +1 -0
  156. package/dist/linkCards-DfSLqLPF.js +50 -0
  157. package/dist/linkCards.cjs +1 -0
  158. package/dist/linkCards.d.ts +2 -0
  159. package/dist/linkCards.js +5 -0
  160. package/dist/markdownServiceClient-C47z3Ynu.cjs +1 -0
  161. package/dist/markdownServiceClient-uDeklhtG.js +480 -0
  162. package/dist/markdownServiceClient.d.ts +20 -0
  163. package/dist/mermaid.core-C4EClWgB.js +15595 -0
  164. package/dist/mermaid.core-CRP55Hm1.cjs +305 -0
  165. package/dist/mermaidFrame/NOTICES.md +1345 -0
  166. package/dist/mermaidFrame/cssCleaner.d.ts +13 -0
  167. package/dist/mermaidFrame/drawer.d.ts +34 -0
  168. package/dist/mermaidFrame/frame.d.ts +1 -0
  169. package/dist/mermaidFrame/frame.js +3307 -0
  170. package/dist/mermaidFrame/katexInert.d.ts +4 -0
  171. package/dist/mermaidFrame/protocol.d.ts +38 -0
  172. package/dist/mermaidFrame/serve.d.ts +14 -0
  173. package/dist/mermaidFrame/svgCleaner.d.ts +4 -0
  174. package/dist/{mindmap-definition-LN4V7U3C-B5LpvJ9m.js → mindmap-definition-LN4V7U3C-BEWpoMMG.js} +79 -79
  175. package/dist/{mindmap-definition-LN4V7U3C-CB606E3L.cjs → mindmap-definition-LN4V7U3C-DnbSfqWP.cjs} +3 -3
  176. package/dist/pageFetchPort-2H18xcdi.cjs +1 -0
  177. package/dist/pageFetchPort-DVpXsKCz.js +624 -0
  178. package/dist/{pegDiagram-2B236MQR-DaosueJV.js → pegDiagram-2B236MQR-BF7gLiB-.js} +3 -3
  179. package/dist/pegDiagram-2B236MQR-BJysMObA.cjs +1 -0
  180. package/dist/{pieDiagram-ENE6RG2P-wfsOfWyT.js → pieDiagram-ENE6RG2P-D_YzC3qc.js} +50 -50
  181. package/dist/{pieDiagram-ENE6RG2P-BUY2Dvjo.cjs → pieDiagram-ENE6RG2P-UMpeIUyV.cjs} +2 -2
  182. package/dist/{providers-BwQK7hZa.js → providers-CSvkTZsr.js} +17 -2
  183. package/dist/{providers-DO2t7ks4.cjs → providers-Cx0FuVQU.cjs} +1 -1
  184. package/dist/{quadrantDiagram-ABIIQ3AL-BSvHqsTp.cjs → quadrantDiagram-ABIIQ3AL-DANY0ipQ.cjs} +1 -1
  185. package/dist/{quadrantDiagram-ABIIQ3AL-Bgc3vspL.js → quadrantDiagram-ABIIQ3AL-DDm-r_6D.js} +59 -59
  186. package/dist/railroadDiagram-RFXS5EU6-CDUd4th1.cjs +1 -0
  187. package/dist/{railroadDiagram-RFXS5EU6-Du2CFU9M.js → railroadDiagram-RFXS5EU6-hJ6uB90G.js} +3 -3
  188. package/dist/remarkProcessor.server.d.ts +2 -0
  189. package/dist/{requirementDiagram-TGXJPOKE-CnafqSUP.js → requirementDiagram-TGXJPOKE-BJef5Jb0.js} +15 -15
  190. package/dist/{requirementDiagram-TGXJPOKE-WM3sItRw.cjs → requirementDiagram-TGXJPOKE-DaoCo7go.cjs} +1 -1
  191. package/dist/{sankeyDiagram-HTMAVEWB-D4Qv4d98.js → sankeyDiagram-HTMAVEWB-BZQs0bE-.js} +41 -41
  192. package/dist/{sankeyDiagram-HTMAVEWB-DaZN3ZDb.cjs → sankeyDiagram-HTMAVEWB-DXiv0YOu.cjs} +3 -3
  193. package/dist/{sequenceDiagram-DBY2YBRQ-C6fa7Axs.cjs → sequenceDiagram-DBY2YBRQ-CJGpsnsv.cjs} +1 -1
  194. package/dist/{sequenceDiagram-DBY2YBRQ-CmP6XGGE.js → sequenceDiagram-DBY2YBRQ-D05U2w26.js} +46 -46
  195. package/dist/serviceClient.cjs +1 -0
  196. package/dist/serviceClient.d.ts +3 -0
  197. package/dist/serviceClient.js +9 -0
  198. package/dist/{sizeCapture-X5ZJPWSS-mWZkTwA5.js → sizeCapture-X5ZJPWSS-DTr0Vm61.js} +1 -1
  199. package/dist/sizeCapture-X5ZJPWSS-DjuH1zNP.cjs +1 -0
  200. package/dist/{stateDiagram-2N3HPSRC-ClDZKhLD.js → stateDiagram-2N3HPSRC-B8nvJKpB.js} +13 -13
  201. package/dist/stateDiagram-2N3HPSRC-BrB47FD-.cjs +1 -0
  202. package/dist/stateDiagram-v2-6OUMAXLB-CC8gOGDK.cjs +1 -0
  203. package/dist/{stateDiagram-v2-6OUMAXLB-K7slPgH_.js → stateDiagram-v2-6OUMAXLB-CV-JqAeP.js} +2 -2
  204. package/dist/styles/markdown.css +1 -1
  205. package/dist/styles/markdown.standalone.css +1 -1
  206. package/dist/{swimlanes-5IMT3BWC-Cpowlk7O.js → swimlanes-5IMT3BWC-BPtufzUd.js} +3 -3
  207. package/dist/swimlanes-5IMT3BWC-WAbDPRgt.cjs +1 -0
  208. package/dist/{swimlanesDiagram-G3AALYLV-36K4ynZn.js → swimlanesDiagram-G3AALYLV-BQKEmJFX.js} +2 -2
  209. package/dist/{swimlanesDiagram-G3AALYLV-BZ0eguZa.cjs → swimlanesDiagram-G3AALYLV-BTwwtLZL.cjs} +1 -1
  210. package/dist/{timeline-definition-FHXFAJF6-C2xHtlkw.js → timeline-definition-FHXFAJF6-DJ6GV7Fz.js} +53 -53
  211. package/dist/{timeline-definition-FHXFAJF6-BJN69nkZ.cjs → timeline-definition-FHXFAJF6-qdkrah7t.cjs} +1 -1
  212. package/dist/utils/promiseTry.d.ts +1 -0
  213. package/dist/vennDiagram-L72KCM5P-B5onSWPA.cjs +34 -0
  214. package/dist/{vennDiagram-L72KCM5P-DbqRaWm5.js → vennDiagram-L72KCM5P-DWnnndTj.js} +176 -176
  215. package/dist/viewer-settings.cjs +1 -1
  216. package/dist/viewer-settings.d.ts +8 -0
  217. package/dist/viewer-settings.js +11 -5
  218. package/dist/{wardleyDiagram-EHGQE667-CF5I0pM9.js → wardleyDiagram-EHGQE667-DFmDgQSb.js} +34 -34
  219. package/dist/{wardleyDiagram-EHGQE667-CyU76ilz.cjs → wardleyDiagram-EHGQE667-DdeBbvVM.cjs} +2 -2
  220. package/dist/{xychartDiagram-FW5EYKEG-DaKE_uIg.cjs → xychartDiagram-FW5EYKEG-CiJQMClv.cjs} +1 -1
  221. package/dist/{xychartDiagram-FW5EYKEG-spkx-w6w.js → xychartDiagram-FW5EYKEG-L2Kj4cZA.js} +56 -56
  222. package/package.json +32 -17
  223. package/dist/abnfDiagram-VRR7QNED-1fn6qV_P.cjs +0 -1
  224. package/dist/arc-D8xGHwLe.cjs +0 -1
  225. package/dist/arc-D9kg3f8-.js +0 -83
  226. package/dist/architectureDiagram-ZJ3FMSHR-C4QxQA-o.cjs +0 -36
  227. package/dist/channel-DuWQwUVP.cjs +0 -1
  228. package/dist/chunk-2Q5K7J3B-gCP3NILS.cjs +0 -1
  229. package/dist/chunk-32BRIVSS-PidRQo43.cjs +0 -1
  230. package/dist/chunk-JWPE2WC7-CHK_g5p5.cjs +0 -1
  231. package/dist/chunk-RYQCIY6F-B_33Thwg.cjs +0 -1
  232. package/dist/chunk-VR4S4FIN-Ca3mlCgX.cjs +0 -1
  233. package/dist/chunk-XXDRQBXY-CeZMmeIi.cjs +0 -1
  234. package/dist/classDiagram-OUVF2IWQ-DPzttpgE.cjs +0 -1
  235. package/dist/classDiagram-v2-EOCWNBFH-DPzttpgE.cjs +0 -1
  236. package/dist/cose-bilkent-JH36ORCC-C3UAMvQQ.cjs +0 -1
  237. package/dist/cynefinDiagram-TSTJHNR4-DStGofoE.cjs +0 -62
  238. package/dist/dagre-VKFMJZFB-BXsQ5-Ek.cjs +0 -4
  239. package/dist/diagram-G47NLZAW-BaX-jrfs.cjs +0 -24
  240. package/dist/diagram-NH7WQ7WH-Cczq2y99.cjs +0 -24
  241. package/dist/diagram-WEI45ONY-C_L-4kui.cjs +0 -41
  242. package/dist/ebnfDiagram-CCIWWBDH-Cg7DTSlM.cjs +0 -1
  243. package/dist/errors-BW5JXRoX.cjs +0 -1
  244. package/dist/errors-Blk_XJ9C.js +0 -55
  245. package/dist/extractHeadings-3qWVTkb9.js +0 -20290
  246. package/dist/extractHeadings-DpvwXCio.cjs +0 -315
  247. package/dist/flowDiagram-23GEKE2U-DfDAl_qd.cjs +0 -1
  248. package/dist/flowDiagram-23GEKE2U-p6ccACf3.js +0 -7
  249. package/dist/ganttDiagram-NO4QXBWP-CHP_muri.cjs +0 -292
  250. package/dist/gitGraphDiagram-IHSO6WYX-DOH3WBNZ.cjs +0 -106
  251. package/dist/infoDiagram-FWYZ7A6U-Bj2fnr5Y.cjs +0 -2
  252. package/dist/linear-Cz3x9Lkl.cjs +0 -1
  253. package/dist/linkCardServer/addressGuard.server.d.ts +0 -25
  254. package/dist/linkCardServer/pageFetch.server.d.ts +0 -37
  255. package/dist/linkCards-1JxY8wdm.js +0 -48
  256. package/dist/linkCards-Bjd_vW39.cjs +0 -1
  257. package/dist/pegDiagram-2B236MQR-BCqBc3Re.cjs +0 -1
  258. package/dist/railroadDiagram-RFXS5EU6-DdF2c_n3.cjs +0 -1
  259. package/dist/sizeCapture-X5ZJPWSS-B6sRQba9.cjs +0 -1
  260. package/dist/stateDiagram-2N3HPSRC-B__29zPZ.cjs +0 -1
  261. package/dist/stateDiagram-v2-6OUMAXLB-BA-_ovVY.cjs +0 -1
  262. package/dist/swimlanes-5IMT3BWC-BhxZhB7M.cjs +0 -1
  263. package/dist/vennDiagram-L72KCM5P-3R1vuMWd.cjs +0 -34
  264. /package/dist/linkCardServer/{htmlEncoding.server.d.ts → htmlEncoding.d.ts} +0 -0
  265. /package/dist/linkCardServer/{metadataCache.server.d.ts → metadataCache.d.ts} +0 -0
@@ -1,893 +1,146 @@
1
- import { R as ge, c as ke, a as be } from "./errors-Blk_XJ9C.js";
2
- import { d as er } from "./errors-Blk_XJ9C.js";
3
- import { l as L, L as O, a as ae, b as Ee } from "./linkCards-1JxY8wdm.js";
4
- import { l as h } from "./simple-logger-DwH1YQvq.js";
5
- import { Resolver as ve } from "node:dns/promises";
6
- import * as se from "node:net";
7
- import { BlockList as Te, isIP as ie, connect as Se } from "node:net";
8
- import { Agent as ye, buildConnector as Y, fetch as Ae } from "undici";
9
- import { Parser as _e } from "htmlparser2";
10
- import { spawn as Re } from "node:child_process";
11
- import { existsSync as C, unlinkSync as Le } from "node:fs";
12
- import { createRequire as Oe } from "node:module";
13
- import * as M from "node:path";
14
- import { fileURLToPath as Pe } from "node:url";
15
- import { createClient as Ce, ConnectError as Me, Code as Ie } from "@connectrpc/connect";
16
- import { Http2SessionManager as Ne, createConnectTransport as xe } from "@connectrpc/connect-node";
17
- import { Message as N, proto3 as d, MethodKind as De } from "@bufbuild/protobuf";
18
- const Be = [
19
- [[0], 8],
20
- [[10], 8],
21
- [[100, 64], 10],
22
- [[127], 8],
23
- [[169, 254], 16],
24
- [[172, 16], 12],
25
- [[192, 0, 0], 24],
26
- [[192, 0, 2], 24],
27
- [[192, 168], 16],
28
- [[198, 18], 15],
29
- [[198, 51, 100], 24],
30
- [[203, 0, 113], 24],
31
- [[224], 4],
32
- [[240], 4]
33
- ], Ue = [
34
- [[100, 65435], 32],
35
- [[0, 0, 0, 0, 65535, 0], 96],
36
- [[256, 0, 0, 0], 64],
37
- [[256, 0, 0, 1], 64],
38
- [[8193, 0], 32],
39
- [[8193, 2, 0], 48],
40
- [[8193, 3512], 32],
41
- [[8194], 16],
42
- [[16383], 20],
43
- [[24320], 16],
44
- [[64512], 7],
45
- [[65152], 10],
46
- [[65216], 10],
47
- [[65280], 8]
48
- ], T = new Te();
49
- for (const [t, r] of Be) {
50
- const e = [...t, 0, 0, 0].slice(0, 4).join(".");
51
- T.addSubnet(e, r, "ipv4"), T.addSubnet(`::ffff:${e}`, 96 + r, "ipv6"), T.addSubnet(`::${e}`, 96 + r, "ipv6");
52
- }
53
- for (const [t, r] of Ue)
54
- T.addSubnet(`${t.map((e) => e.toString(16)).join(":")}::`, r, "ipv6");
55
- const $ = (t) => {
56
- const r = t.replace(/^\[/u, "").replace(/\]$/u, "").replace(/%.*$/su, ""), e = ie(r);
57
- return e !== 0 && T.check(r, e === 4 ? "ipv4" : "ipv6");
58
- }, le = "ERR_LINK_CARD_PRIVATE_ADDRESS", Z = Object.freeze({ timeoutMs: 1e3, tries: 2 }), q = new ve({ timeout: Z.timeoutMs, tries: Z.tries }), Q = (t, r) => ({
59
- error: Object.assign(new Error(`Blocked hostname resolving to a private address: ${t} -> ${r}`), { code: le })
60
- }), $e = async (t, r) => {
61
- const e = ie(t);
62
- if (e !== 0)
63
- return $(t) ? Q(t, t) : { error: null, family: e === 4 ? 4 : 6, addresses: [t] };
64
- const [n, o] = await Promise.allSettled([r === 6 ? Promise.resolve([]) : q.resolve4(t), r === 4 ? Promise.resolve([]) : q.resolve6(t)]), s = n.status === "fulfilled" ? n.value : [], a = o.status === "fulfilled" ? o.value : [], i = [...s, ...a].find((R) => $(R));
65
- if (i !== void 0) return Q(t, i);
66
- const [l, ...c] = s;
67
- if (l !== void 0) return { error: null, family: 4, addresses: [l, ...c] };
68
- const [f, ...S] = a;
69
- return f !== void 0 ? { error: null, family: 6, addresses: [f, ...S] } : n.status === "rejected" ? { error: n.reason } : o.status === "rejected" ? { error: o.reason } : { error: Object.assign(new Error(`No address for ${t}`), { code: "ENOTFOUND" }) };
70
- }, He = (t, r, e) => {
71
- const n = r.family === 4 || r.family === "IPv4" ? 4 : r.family === 6 || r.family === "IPv6" ? 6 : 0;
72
- $e(t, n).then((o) => {
73
- if (o.error !== null) {
74
- e(o.error, "");
75
- return;
76
- }
77
- const { family: s, addresses: a } = o;
78
- r.all === !0 ? e(
79
- null,
80
- a.map((i) => ({ address: i, family: s }))
81
- ) : e(null, a[0], s);
82
- });
83
- }, je = /* @__PURE__ */ new Set(["127.0.0.1", "0.0.0.0", "[::1]"]), Ke = [".local", ".internal", ".home.arpa"], j = (t, r) => {
84
- let e;
85
- try {
86
- e = new URL(t);
87
- } catch {
88
- return { ok: !1, reason: "forbidden-url", detail: "Invalid URL" };
89
- }
90
- if (e.protocol !== "http:" && e.protocol !== "https:")
91
- return { ok: !1, reason: "forbidden-url", detail: "Only http(s) URLs are allowed" };
92
- if (e.username !== "" || e.password !== "")
93
- return { ok: !1, reason: "forbidden-url", detail: "URLs with a user name or password are not allowed" };
94
- e.hash = "";
95
- const n = e.hostname.replace(/\.+$/u, "");
96
- return n === "localhost" || n.endsWith(".localhost") || je.has(n) ? { ok: !1, reason: "private-network", detail: "Localhost access is not allowed" } : $(n) ? { ok: !1, reason: "private-network", detail: "Private network access is not allowed" } : !(n.startsWith("[") || n.includes(".")) || Ke.some((s) => n.endsWith(s)) ? { ok: !1, reason: "private-network", detail: "Internal domain access is not allowed" } : { ok: !0, href: e.href };
97
- }, ce = (t) => {
98
- let r;
99
- try {
100
- r = new URL(t);
101
- } catch {
102
- return "(unparsable URL)";
103
- }
104
- return r.protocol !== "http:" && r.protocol !== "https:" ? `(a ${r.protocol} URL)` : (r.username = "", r.password = "", r.href);
105
- }, ue = 1024, ze = /^[\t\n\f\r ]$/u, w = (t) => ze.test(t), B = (t) => t.replace(/[A-Z]/gu, (r) => r.toLowerCase()), H = (t) => {
106
- try {
107
- return new TextDecoder(t).encoding;
108
- } catch {
109
- return null;
110
- }
111
- }, Je = (t) => t[0] === 239 && t[1] === 187 && t[2] === 191 ? "utf-8" : t[0] === 254 && t[1] === 255 ? "utf-16be" : t[0] === 255 && t[1] === 254 ? "utf-16le" : null, Fe = (t) => {
112
- for (const r of t.split(";").slice(1)) {
113
- const e = r.indexOf("=");
114
- if (e !== -1 && r.slice(0, e).trim().toLowerCase() === "charset")
115
- return r.slice(e + 1).trim().replace(/^"(.*)"$/su, "$1");
116
- }
117
- return null;
118
- }, Ge = (t) => {
119
- let r = 0;
120
- for (; ; ) {
121
- const e = t.indexOf("charset", r);
122
- if (e === -1) return null;
123
- let n = e + 7;
124
- for (; w(t.charAt(n)); ) n += 1;
125
- if (t.charAt(n) !== "=") {
126
- r = n;
127
- continue;
128
- }
129
- for (n += 1; w(t.charAt(n)); ) n += 1;
130
- const o = t.charAt(n);
131
- if (o === '"' || o === "'") {
132
- const a = t.indexOf(o, n + 1);
133
- return a === -1 ? null : t.slice(n + 1, a);
134
- }
135
- const s = t.slice(n).search(/[\t\n\f\r ;]/u);
136
- return s === -1 ? t.slice(n) : t.slice(n, n + s);
137
- }
138
- }, de = (t, r) => {
139
- let e = r;
140
- for (; w(t.charAt(e)) || t.charAt(e) === "/"; ) e += 1;
141
- if (t.charAt(e) === ">" || e >= t.length) return { attribute: null, end: e };
142
- let n = "";
143
- for (; ; ) {
144
- const a = t.charAt(e);
145
- if (a === "") return { attribute: null, end: e };
146
- if (a === "=" && n !== "") break;
147
- if (w(a)) {
148
- for (; w(t.charAt(e)); ) e += 1;
149
- if (t.charAt(e) !== "=") return { attribute: { name: n, value: "" }, end: e };
150
- break;
151
- }
152
- if (a === "/" || a === ">") return { attribute: { name: n, value: "" }, end: e };
153
- n += B(a), e += 1;
154
- }
155
- for (e += 1; w(t.charAt(e)); ) e += 1;
156
- const o = t.charAt(e);
157
- if (o === '"' || o === "'") {
158
- const a = t.indexOf(o, e + 1);
159
- return a === -1 ? { attribute: null, end: t.length } : { attribute: { name: n, value: B(t.slice(e + 1, a)) }, end: a + 1 };
160
- }
161
- if (o === ">") return { attribute: { name: n, value: "" }, end: e };
162
- const s = t.slice(e).search(/[\t\n\f\r >]/u);
163
- return s === -1 ? { attribute: null, end: t.length } : { attribute: { name: n, value: B(t.slice(e, e + s)) }, end: e + s };
164
- }, Xe = (t, r) => {
165
- const e = /* @__PURE__ */ new Set();
166
- let n = !1, o = null, s = null, a = r;
167
- for (; ; ) {
168
- const { attribute: i, end: l } = de(t, a);
169
- if (a = l, i === null) break;
170
- if (!e.has(i.name))
171
- if (e.add(i.name), i.name === "http-equiv")
172
- n = i.value === "content-type";
173
- else if (i.name === "content") {
174
- const c = Ge(i.value), f = c === null ? null : H(c);
175
- f !== null && s === null && (s = f, o = !0);
176
- } else i.name === "charset" && (s = H(i.value) ?? !1, o = !1);
177
- }
178
- return o === null || typeof s != "string" || o && !n ? { encoding: null, end: a } : s === "utf-16be" || s === "utf-16le" ? { encoding: "utf-8", end: a } : { encoding: s === "x-user-defined" ? "windows-1252" : s, end: a };
179
- }, Ve = (t) => {
180
- const r = Array.from(t.subarray(0, ue), (n) => String.fromCharCode(n)).join("");
181
- let e = 0;
182
- for (; e < r.length; )
183
- if (r.startsWith("<!--", e)) {
184
- const n = r.indexOf("-->", e + 2);
185
- if (n === -1) return null;
186
- e = n + 3;
187
- } else if (/^<meta[\t\n\f\r /]$/iu.test(r.slice(e, e + 6))) {
188
- const { encoding: n, end: o } = Xe(r, e + 5);
189
- if (n !== null) return n;
190
- e = o + 1;
191
- } else if (/^<\/?[A-Za-z]/u.test(r.slice(e, e + 3))) {
192
- let n = e + 1;
193
- for (; n < r.length && !w(r.charAt(n)) && r.charAt(n) !== ">"; ) n += 1;
194
- for (; ; ) {
195
- const o = de(r, n);
196
- if (n = o.end, o.attribute === null) break;
197
- }
198
- e = n + 1;
199
- } else if (/^<[!/?]$/u.test(r.slice(e, e + 2))) {
200
- const n = r.indexOf(">", e + 1);
201
- if (n === -1) return null;
202
- e = n + 1;
203
- } else
204
- e += 1;
205
- return null;
206
- }, We = (t, r) => {
207
- const e = Je(t);
208
- if (e !== null) return e;
209
- const n = Fe(r), o = n === null ? null : H(n);
210
- return o !== null ? o : Ve(t) ?? "utf-8";
211
- }, Ye = (t, r) => {
212
- const e = new Uint8Array(r);
213
- let n = 0;
214
- for (const o of t)
215
- e.set(o, n), n += o.byteLength;
216
- return e;
217
- }, Ze = (t) => {
218
- const r = [];
219
- let e = 0, n = null;
220
- const o = () => {
221
- const s = Ye(r, e);
222
- r.length = 0;
223
- const a = new TextDecoder(We(s, t));
224
- return n = a, { started: a, text: a.decode(s, { stream: !0 }) };
225
- };
226
- return {
227
- write: (s) => n !== null ? n.decode(s, { stream: !0 }) : (r.push(s), e += s.byteLength, e < ue ? "" : o().text),
228
- end: () => {
229
- if (n !== null) return n.decode();
230
- const { started: s, text: a } = o();
231
- return a + s.decode();
232
- }
233
- };
234
- }, qe = (t, r, e) => {
235
- const n = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map();
236
- return (s) => {
237
- const a = n.get(s);
238
- if (a !== void 0 && a.expireAt > e()) return Promise.resolve(a.value);
239
- const i = o.get(s);
240
- if (i !== void 0) return i;
241
- const l = t(s).then((c) => (!n.has(s) && n.size >= r.maxEntries && n.delete(n.keys().next().value), n.set(s, { value: c, expireAt: e() + r.ttlMsOf(c) }), c)).finally(() => {
242
- o.delete(s);
243
- });
244
- return o.set(s, l), l;
245
- };
246
- }, Qe = 65536, et = /* @__PURE__ */ new Set([301, 302, 303, 307, 308]), tt = /* @__PURE__ */ new Set(["text/html", "application/xhtml+xml"]), rt = /* @__PURE__ */ new Set(["ERR_IP_BLOCKED", le]), fe = Object.freeze({ timeoutMs: 5e3, maxRedirects: 5, maxBodyBytes: 8 * 1024 * 1024 }), nt = Object.freeze({ lookup: He, blockList: T }), ot = (t, r) => {
247
- const e = Y({ lookup: t.lookup, blockList: t.blockList, timeout: r }), n = Y({ timeout: r });
248
- return (o, s) => {
249
- if (o.protocol !== "https:") {
250
- e(o, s);
251
- return;
252
- }
253
- const a = Se({ host: o.hostname, port: Number(o.port === "" ? 443 : o.port), lookup: t.lookup, blockList: t.blockList }), i = (l) => {
254
- a.destroy(), s(l, null);
255
- };
256
- a.setTimeout(r, () => i(Object.assign(new Error(`Connect timeout: ${o.hostname}`), { code: "UND_ERR_CONNECT_TIMEOUT" }))), a.once("error", i), a.once("connect", () => {
257
- a.setTimeout(0), a.removeListener("error", i), n({ ...o, httpSocket: a }, s);
258
- });
259
- };
260
- }, at = (t) => new ye({
261
- maxHeaderSize: Qe,
262
- connect: ot(nt, fe.timeoutMs)
263
- }), U = async (t) => {
264
- t.body !== null && await Promise.allSettled([t.body.cancel()]);
265
- }, st = (t) => t !== null && tt.has(t.split(";", 1)[0].trim().toLowerCase()), it = (t) => {
266
- const r = [t];
267
- for (let e = 0; e < 16 && r.length > 0; e += 1) {
268
- const n = r.shift();
269
- if (!(n instanceof Error)) continue;
270
- const o = n.code;
271
- if (typeof o == "string" && rt.has(o)) return n.message;
272
- r.push(n.cause, ...n instanceof AggregateError ? n.errors : []);
273
- }
274
- return null;
275
- }, me = (t, r) => {
276
- const e = it(t);
277
- return e !== null ? (h.info("Refused link-card connection to a private address:", r, e), { ok: !1, reason: "private-network" }) : (h.error("Error fetching link-card metadata:", t), { ok: !1, reason: "unreachable" });
278
- }, lt = () => new Promise((t) => {
279
- setImmediate(t);
280
- }), ct = async (t, r, e, n) => {
281
- if (t.body === null) return { ok: !0, value: r.end() };
282
- const o = t.body.getReader();
283
- let s = 0;
284
- for (; ; ) {
285
- let a;
286
- try {
287
- a = await o.read();
288
- } catch (f) {
289
- return me(f, n);
290
- }
291
- if (a.done) break;
292
- const i = e - s, l = a.value.byteLength > i, c = l ? a.value.subarray(0, i) : a.value;
293
- if (s += c.byteLength, !r.write(c)) {
294
- await Promise.allSettled([o.cancel()]);
295
- break;
296
- }
297
- if (l) {
298
- await Promise.allSettled([o.cancel()]), h.warn("Link-card page body exceeds the size limit; parsing only its first bytes:", n, e);
299
- break;
300
- }
301
- await lt();
302
- }
303
- return { ok: !0, value: r.end() };
304
- }, ut = async (t, r, e, n) => {
305
- let o = t;
306
- for (let s = 0; s <= r.limits.maxRedirects; s += 1) {
307
- let a;
308
- try {
309
- a = await Ae(o, { signal: n, redirect: "manual", dispatcher: r.agent });
310
- } catch (f) {
311
- return me(f, o);
312
- }
313
- const i = et.has(a.status) ? a.headers.get("location")?.trim() ?? "" : "";
314
- if (i === "") {
315
- if (!a.ok)
316
- return await U(a), { ok: !1, reason: "unreachable" };
317
- const f = a.headers.get("content-type");
318
- return st(f) ? ct(a, e({ url: o, contentType: f }), r.limits.maxBodyBytes, o) : (await U(a), { ok: !1, reason: "not-html" });
319
- }
320
- await U(a);
321
- let l;
322
- try {
323
- l = new URL(i, o);
324
- } catch {
325
- return h.error("Blocked redirect to an unparsable Location from:", o), { ok: !1, reason: "unreachable" };
326
- }
327
- const c = j(l.href);
328
- if (!c.ok)
329
- return h.info("Refused link-card redirect:", ce(l), `(${c.reason}: ${c.detail})`), { ok: !1, reason: c.reason };
330
- o = c.href;
331
- }
332
- return h.error("Too many redirects while fetching link-card metadata:", t), { ok: !1, reason: "unreachable" };
333
- }, dt = (t, r, e) => {
334
- const n = new AbortController(), o = setTimeout(() => n.abort(), r.limits.timeoutMs);
335
- return ut(t, r, e, n.signal).finally(() => {
336
- clearTimeout(o);
337
- });
338
- }, ft = 256, mt = 4096, pt = 64, ht = /* @__PURE__ */ new Set(["html", "head", "title", "meta", "link", "base", "basefont", "bgsound", "noframes", "script", "style", "template", "noscript"]), wt = /* @__PURE__ */ new Set(["title", "script", "style"]), gt = /* @__PURE__ */ new Set(["noscript", "template", "noframes"]), kt = (t) => t?.toLowerCase().split(/[\t\n\f\r ]+/u).includes("icon") === !0, bt = (t, r) => {
339
- if (t === void 0) return r;
340
- let e;
341
- try {
342
- e = new URL(t, r);
343
- } catch {
344
- return r;
345
- }
346
- return (e.protocol === "http:" || e.protocol === "https:") && e.href.length <= ae ? e.href : r;
347
- }, ee = (t, r, e) => {
348
- const n = t?.trim();
349
- if (n === void 0 || n === "") return;
350
- let o;
351
- try {
352
- o = new URL(n, r);
353
- } catch {
354
- return;
355
- }
356
- return o.href.length <= ae && j(o.href).ok ? o.href : void 0;
357
- }, Et = (t, r) => {
358
- let e = !1, n = 0, o = 0, s = 0, a = null, i = null, l = null, c, f, S, R, K, z, J = !1, F, G = !1;
359
- const x = () => {
360
- e = !0, D.pause();
361
- }, D = new _e(
362
- {
363
- onopentagname(u) {
364
- n += 1, o += 1, s = 0, (n > ft || o > mt || a === null && !ht.has(u)) && x();
365
- },
366
- onattribute() {
367
- s += 1, s > pt && x();
368
- },
369
- onopentag(u, m) {
370
- if (!(e || a !== null)) {
371
- if (gt.has(u)) {
372
- a = n;
373
- return;
374
- }
375
- if (u === "meta") {
376
- const p = m.content;
377
- m.property === "og:site_name" && (R = p), m.property === "og:title" && (f = p), m.property === "og:description" && (S = p), m.property === "og:image" && (K = p), m.name === "description" && (S = p);
378
- } else u === "link" && !J && kt(m.rel) ? (J = !0, z = m.href) : u === "base" && !G && Object.hasOwn(m, "href") && (G = !0, F = m.href);
379
- wt.has(u) && (i = u, u === "title" && c === void 0 && (l = ""));
380
- }
381
- },
382
- ontext(u) {
383
- a === null && (l !== null ? l += u : i === null && /[^\t\n\f\r ]/u.test(u) && x());
384
- },
385
- onclosetag(u) {
386
- if (!e) {
387
- if (n -= 1, a !== null) {
388
- n < a && (a = null);
389
- return;
390
- }
391
- u === i && (i = null, l !== null && (c = l, l = null));
392
- }
393
- }
394
- },
395
- { decodeEntities: !0 }
396
- );
397
- return {
398
- write: (u) => (e || D.write(u), !e),
399
- end: () => {
400
- e || D.end();
401
- const u = L(f, O.title) ?? L(c, O.title), m = L(S, O.description), p = L(R, O.siteName), X = bt(F, t), V = ee(K, X), W = ee(z, X);
402
- return {
403
- ...u === null ? {} : { title: u },
404
- ...m === null ? {} : { description: m },
405
- ...p === null ? {} : { site_name: p },
406
- ...V === void 0 ? {} : { image: V },
407
- ...W === void 0 ? {} : { icon: W }
408
- };
409
- }
410
- };
411
- }, vt = /* @__PURE__ */ new Set(["authorize"]), Tt = "private, max-age=1800", St = 3600 * 1e3, pe = Object.freeze({ "private-network": 1800, "forbidden-url": 1800, unreachable: 300, "not-html": 300 }), yt = 1e3, P = "no-store", y = (t, r, e, n, o = {}) => new Response(t.method === "HEAD" ? null : JSON.stringify(e), {
412
- status: r,
413
- headers: { "Content-Type": "application/json; charset=utf-8", "Cache-Control": n, "X-Content-Type-Options": "nosniff", ...o }
414
- }), te = (t) => new Response(null, {
415
- status: 204,
416
- headers: { "Cache-Control": `private, max-age=${pe[t]}`, "X-Content-Type-Options": "nosniff", [Ee]: t }
417
- }), At = (t) => {
418
- if (typeof t != "object" || t === null)
419
- throw new TypeError("createLinkCardHandler: options must be an object with an authorize function");
420
- if (typeof t.authorize != "function")
421
- throw new TypeError("createLinkCardHandler: options.authorize must be a function (pass () => true to serve everyone)");
422
- const r = Object.keys(t).filter((e) => !vt.has(e));
423
- if (r.length > 0)
424
- throw new TypeError(`createLinkCardHandler: unknown option(s): ${r.join(", ")}`);
425
- }, _t = (t) => (r) => {
426
- const e = Ze(r.contentType), n = Et(r.url);
427
- return {
428
- write: (o) => n.write(e.write(o)),
429
- end: () => (n.write(e.end()), n.end())
430
- };
431
- }, Rt = (t, r) => {
432
- At(t);
433
- const { authorize: e } = t, n = at(), o = qe(
434
- (s) => dt(s, { agent: n, scope: r, limits: fe }, _t()),
435
- { maxEntries: yt, ttlMsOf: (s) => s.ok ? St : pe[s.reason] * 1e3 },
436
- Date.now
437
- );
438
- return async (s) => {
439
- if (s.method !== "GET" && s.method !== "HEAD")
440
- return y(s, 405, { error: "Method Not Allowed" }, P, { Allow: "GET, HEAD" });
441
- if (await e(s) !== !0)
442
- return y(s, 401, { error: "Unauthorized" }, P);
443
- const a = new URL(s.url).searchParams.get("url");
444
- if (a === null || a === "")
445
- return y(s, 400, { error: "Missing 'url' parameter" }, P);
446
- const i = j(a);
447
- if (!i.ok)
448
- return h.info("Refused link-card URL:", ce(a), `(${i.reason}: ${i.detail})`), te(i.reason);
449
- let l;
450
- try {
451
- l = await o(i.href);
452
- } catch (c) {
453
- return h.error("Unexpected error while reading link-card metadata:", i.href, c), y(s, 500, { error: "Internal Server Error" }, P);
454
- }
455
- return l.ok ? y(s, 200, l.value, Tt) : te(l.reason);
456
- };
457
- }, Yt = (t) => Rt(t, "public");
458
- class b extends N {
459
- /**
460
- * @generated from field: string markdown_text = 1;
461
- */
462
- markdownText = "";
463
- /**
464
- * Path of the document being converted. Canonical form is a fully qualified
465
- * URI: `file:///abs/path.md` (or a bare absolute path) for local documents,
466
- * `gcs://` / `gdrive://` URIs for cloud documents. A workspace-relative path
467
- * (bare or with a stray `file://` prefix) is also accepted and is anchored to
468
- * `workspace_root` server-side. Relative paths are NEVER resolved against the
469
- * server process's working directory. INVALID_ARGUMENT is returned when the
470
- * path is empty, when `workspace_root` is not absolute for a local document,
471
- * or when a relative path cannot be anchored strictly inside `workspace_root`
472
- * (e.g. `.` or `..` escapes).
473
- *
474
- * @generated from field: string file_path = 2;
475
- */
476
- filePath = "";
477
- /**
478
- * Absolute path of the workspace root. Required for local (file scheme)
479
- * documents: it anchors relative `file_path` values, bounds the local file://
480
- * sandbox, and is the base of the workspace-relative document paths written to
481
- * `data-asset-src` and `data-doc-path`. Ignored for cloud documents.
482
- *
483
- * @generated from field: string workspace_root = 3;
484
- */
485
- workspaceRoot = "";
486
- /**
487
- * Enables existence validation for locally resolvable image and doc-link
488
- * targets. Every admitted storage image (local or cloud) has no src and
489
- * carries `data-asset-src` (its document path); when true, a local one also
490
- * gains `data-asset-exists` ("true" or "false"), and local doc links gain
491
- * `data-doc-exists`. A target refused by
492
- * `deny` or outside `workspace_root` is never probed: it is marked exactly
493
- * like a missing one, without `data-asset-src`, whether or not it exists.
494
- * When false, no existence markers are emitted and no existence probes run.
495
- * Cloud-scheme (gcs/gdrive) targets are never probed.
496
- *
497
- * @generated from field: bool validate_existence = 4;
498
- */
499
- validateExistence = !1;
500
- /**
501
- * @generated from field: optional bool enable_subscript = 5;
502
- */
503
- enableSubscript;
504
- /**
505
- * @generated from field: optional bool enable_superscript = 6;
506
- */
507
- enableSuperscript;
508
- /**
509
- * @generated from field: optional bool enable_mark = 7;
510
- */
511
- enableMark;
512
- /**
513
- * @generated from field: optional bool enable_table_merge = 8;
514
- */
515
- enableTableMerge;
516
- /**
517
- * @generated from field: optional bool enable_embeds = 9;
518
- */
519
- enableEmbeds;
520
- /**
521
- * @generated from field: optional bool enable_zenn_directives = 10;
522
- */
523
- enableZennDirectives;
524
- /**
525
- * Expands `<!-- @import "path" -->` directives before conversion. False by
526
- * default: a directive then stays an HTML comment and nothing is read. When
527
- * true, a target is read only when it is a Markdown file (its name ends in
528
- * `.md` in any letter case, also once symbolic links are resolved) and
529
- * `deny` admits it, nested imports included; a refused target fails the
530
- * conversion with PERMISSION_DENIED. The document with every import expanded
531
- * is held to the server's source limit (RESOURCE_EXHAUSTED past it).
532
- *
533
- * @generated from field: bool resolve_imports = 11;
534
- */
535
- resolveImports = !1;
536
- /**
537
- * The largest HTML the conversion may produce, in bytes, before and after
538
- * post-processing. Must be positive when set (INVALID_ARGUMENT otherwise).
539
- * The server's own limit applies as well; the smaller one wins. A conversion
540
- * that would exceed it stops while rendering and fails with
541
- * RESOURCE_EXHAUSTED.
542
- *
543
- * @generated from field: optional uint32 max_html_bytes = 12;
544
- */
545
- maxHtmlBytes;
546
- /**
547
- * Deny rules applied to every target the conversion resolves: imports,
548
- * images and links. Required (INVALID_ARGUMENT when unset); an empty pattern
549
- * list denies nothing.
550
- *
551
- * @generated from field: markdown.v1.DenyRules deny = 13;
552
- */
553
- deny;
554
- /**
555
- * Annotates every rendered block with `data-source-lines="<first>-<last>"`:
556
- * the 1-based lines of `markdown_text` it came from, both inclusive (with
557
- * `resolve_imports`, the lines of the text with every import expanded). A
558
- * block that spans no line of its own (a thematic break) and a raw HTML
559
- * block carry none. False by default; either way, a `data-source-lines` an
560
- * author wrote is removed, so the attribute in the HTML is always the
561
- * converter's own. With it, the HTML is the HTML without it plus the
562
- * attribute alone.
563
- *
564
- * @generated from field: bool include_source_lines = 14;
565
- */
566
- includeSourceLines = !1;
567
- constructor(r) {
568
- super(), d.util.initPartial(r, this);
569
- }
570
- static runtime = d;
571
- static typeName = "markdown.v1.ConvertRequest";
572
- static fields = d.util.newFieldList(() => [
573
- {
574
- no: 1,
575
- name: "markdown_text",
576
- kind: "scalar",
577
- T: 9
578
- /* ScalarType.STRING */
579
- },
580
- {
581
- no: 2,
582
- name: "file_path",
583
- kind: "scalar",
584
- T: 9
585
- /* ScalarType.STRING */
586
- },
587
- {
588
- no: 3,
589
- name: "workspace_root",
590
- kind: "scalar",
591
- T: 9
592
- /* ScalarType.STRING */
593
- },
594
- {
595
- no: 4,
596
- name: "validate_existence",
597
- kind: "scalar",
598
- T: 8
599
- /* ScalarType.BOOL */
600
- },
601
- { no: 5, name: "enable_subscript", kind: "scalar", T: 8, opt: !0 },
602
- { no: 6, name: "enable_superscript", kind: "scalar", T: 8, opt: !0 },
603
- { no: 7, name: "enable_mark", kind: "scalar", T: 8, opt: !0 },
604
- { no: 8, name: "enable_table_merge", kind: "scalar", T: 8, opt: !0 },
605
- { no: 9, name: "enable_embeds", kind: "scalar", T: 8, opt: !0 },
606
- { no: 10, name: "enable_zenn_directives", kind: "scalar", T: 8, opt: !0 },
607
- {
608
- no: 11,
609
- name: "resolve_imports",
610
- kind: "scalar",
611
- T: 8
612
- /* ScalarType.BOOL */
613
- },
614
- { no: 12, name: "max_html_bytes", kind: "scalar", T: 13, opt: !0 },
615
- { no: 13, name: "deny", kind: "message", T: g },
616
- {
617
- no: 14,
618
- name: "include_source_lines",
619
- kind: "scalar",
620
- T: 8
621
- /* ScalarType.BOOL */
622
- }
623
- ]);
624
- static fromBinary(r, e) {
625
- return new b().fromBinary(r, e);
626
- }
627
- static fromJson(r, e) {
628
- return new b().fromJson(r, e);
629
- }
630
- static fromJsonString(r, e) {
631
- return new b().fromJsonString(r, e);
632
- }
633
- static equals(r, e) {
634
- return d.util.equals(b, r, e);
635
- }
636
- }
637
- class g extends N {
638
- /**
639
- * @generated from field: repeated string segment_patterns = 1;
640
- */
641
- segmentPatterns = [];
642
- constructor(r) {
643
- super(), d.util.initPartial(r, this);
644
- }
645
- static runtime = d;
646
- static typeName = "markdown.v1.DenyRules";
647
- static fields = d.util.newFieldList(() => [{ no: 1, name: "segment_patterns", kind: "scalar", T: 9, repeated: !0 }]);
648
- static fromBinary(r, e) {
649
- return new g().fromBinary(r, e);
650
- }
651
- static fromJson(r, e) {
652
- return new g().fromJson(r, e);
653
- }
654
- static fromJsonString(r, e) {
655
- return new g().fromJsonString(r, e);
656
- }
657
- static equals(r, e) {
658
- return d.util.equals(g, r, e);
659
- }
660
- }
661
- class E extends N {
662
- /**
663
- * @generated from field: string html_content = 1;
664
- */
665
- htmlContent = "";
666
- /**
667
- * @generated from field: repeated markdown.v1.Heading headings = 2;
668
- */
669
- headings = [];
670
- constructor(r) {
671
- super(), d.util.initPartial(r, this);
672
- }
673
- static runtime = d;
674
- static typeName = "markdown.v1.ConvertResponse";
675
- static fields = d.util.newFieldList(() => [
676
- {
677
- no: 1,
678
- name: "html_content",
679
- kind: "scalar",
680
- T: 9
681
- /* ScalarType.STRING */
682
- },
683
- { no: 2, name: "headings", kind: "message", T: v, repeated: !0 }
684
- ]);
685
- static fromBinary(r, e) {
686
- return new E().fromBinary(r, e);
687
- }
688
- static fromJson(r, e) {
689
- return new E().fromJson(r, e);
690
- }
691
- static fromJsonString(r, e) {
692
- return new E().fromJsonString(r, e);
693
- }
694
- static equals(r, e) {
695
- return d.util.equals(E, r, e);
696
- }
697
- }
698
- class v extends N {
699
- /**
700
- * @generated from field: string text = 1;
701
- */
702
- text = "";
703
- /**
704
- * @generated from field: int32 depth = 2;
705
- */
706
- depth = 0;
707
- /**
708
- * @generated from field: string id = 3;
709
- */
710
- id = "";
711
- constructor(r) {
712
- super(), d.util.initPartial(r, this);
713
- }
714
- static runtime = d;
715
- static typeName = "markdown.v1.Heading";
716
- static fields = d.util.newFieldList(() => [
717
- {
718
- no: 1,
719
- name: "text",
720
- kind: "scalar",
721
- T: 9
722
- /* ScalarType.STRING */
723
- },
724
- {
725
- no: 2,
726
- name: "depth",
727
- kind: "scalar",
728
- T: 5
729
- /* ScalarType.INT32 */
730
- },
731
- {
732
- no: 3,
733
- name: "id",
734
- kind: "scalar",
735
- T: 9
736
- /* ScalarType.STRING */
737
- }
738
- ]);
739
- static fromBinary(r, e) {
740
- return new v().fromBinary(r, e);
741
- }
742
- static fromJson(r, e) {
743
- return new v().fromJson(r, e);
744
- }
745
- static fromJsonString(r, e) {
746
- return new v().fromJsonString(r, e);
747
- }
748
- static equals(r, e) {
749
- return d.util.equals(v, r, e);
750
- }
751
- }
752
- const Lt = {
753
- typeName: "markdown.v1.MarkdownService",
754
- methods: {
755
- /**
756
- * @generated from rpc markdown.v1.MarkdownService.Convert
757
- */
758
- convert: {
759
- name: "Convert",
760
- I: b,
761
- O: E,
762
- kind: De.Unary
763
- }
764
- }
765
- }, k = () => {
766
- const t = process.env.MARKDOWN_SOCKET_PATH;
767
- if (t === void 0 || t === "")
1
+ import { M as P, R as C } from "./errors-CapTNE7l.js";
2
+ import { c as Ee } from "./errors-CapTNE7l.js";
3
+ import { spawn as L } from "node:child_process";
4
+ import { existsSync as f } from "node:fs";
5
+ import { createRequire as D } from "node:module";
6
+ import * as M from "node:net";
7
+ import * as v from "node:path";
8
+ import { fileURLToPath as $ } from "node:url";
9
+ import { createLocalServiceTransport as x } from "@aiquants/local-service-transport";
10
+ import { createClient as U, ConnectError as i, Code as c } from "@connectrpc/connect";
11
+ import { M as G, a as W, s as F, l as B } from "./markdownServiceClient-uDeklhtG.js";
12
+ import { b as H, a as K, c as T } from "./pageFetchPort-DVpXsKCz.js";
13
+ const s = () => {
14
+ const e = process.env.MARKDOWN_SOCKET_PATH;
15
+ if (e === void 0 || e === "")
768
16
  throw new Error("MARKDOWN_SOCKET_PATH is required: set it to the path of the markdown-api service's UNIX domain socket, the same value the service reads");
769
- return t;
770
- }, Ot = new Ne("http://localhost", void 0, {
771
- createConnection: () => se.connect(k())
772
- }), re = () => {
17
+ return e;
18
+ }, N = x({
19
+ createConnection: () => M.connect(s()),
20
+ readMaxBytes: 2 * P + C
21
+ }), j = U(G, N), E = () => {
773
22
  try {
774
- return M.dirname(Pe(import.meta.url));
23
+ return v.dirname($(import.meta.url));
775
24
  } catch {
776
25
  return __dirname;
777
26
  }
778
- }, he = () => `@aiquants/markdown-${process.platform}-${process.arch}`, ne = () => process.platform === "win32" ? "bin/markdown-api.exe" : "bin/markdown-api", Pt = () => {
779
- const t = process.env.MARKDOWN_API_BINARY;
780
- if (t && C(t))
781
- return t;
27
+ }, R = () => `@aiquants/markdown-${process.platform}-${process.arch}`, _ = "markdown-api", q = () => {
28
+ const e = process.env.MARKDOWN_API_BINARY;
29
+ if (e && f(e))
30
+ return e;
782
31
  try {
783
- const e = Oe(M.join(re(), "index.js")).resolve(`${he()}/${ne()}`);
784
- if (C(e))
785
- return e;
32
+ const t = D(v.join(E(), "index.js")).resolve(`${R()}/bin/${_}`);
33
+ if (f(t))
34
+ return t;
786
35
  } catch {
787
36
  }
788
- const r = M.join(re(), "..", "..", "go", "markdown-api", "dist", M.basename(ne()));
789
- return C(r) ? r : void 0;
790
- }, Ct = () => [
37
+ const r = v.join(E(), "..", "..", "go", "markdown-api", "dist", _);
38
+ return f(r) ? r : void 0;
39
+ }, Y = () => [
791
40
  `markdown-api binary not found for ${process.platform}-${process.arch}.`,
792
- `Expected the optional dependency ${he()} to be installed.`,
41
+ `Expected the optional dependency ${R()} to be installed.`,
793
42
  "If your platform is unsupported, build the service yourself",
794
43
  "(https://github.com/fehde-k/aiquants/tree/main/packages/go/markdown-api)",
795
44
  "and point MARKDOWN_API_BINARY at it."
796
- ].join(" "), we = () => new Promise((t) => {
797
- const r = se.connect(k());
45
+ ].join(" "), z = "The markdown-api service is not started from Node.js on Windows; a Windows host runs the service inside its own executable instead.", X = /* @__PURE__ */ new Set(["ENOENT", "ECONNREFUSED"]), h = () => new Promise((e) => {
46
+ const r = M.connect(s());
798
47
  r.on("connect", () => {
799
- r.destroy(), t(!0);
800
- }), r.on("error", () => t(!1));
801
- }), oe = async (t) => {
802
- const r = Date.now();
803
- for (; Date.now() - r < t; ) {
804
- if (await we()) return !0;
805
- await new Promise((e) => setTimeout(e, 100));
48
+ r.destroy(), e("listening");
49
+ }), r.on("error", (t) => {
50
+ t.code === "EAGAIN" ? e("listening") : e(X.has(t.code) ? "absent" : "unknown");
51
+ });
52
+ }), k = async (e, r) => {
53
+ const t = Date.now();
54
+ for (; Date.now() - t < e && !r(); ) {
55
+ if (await h() === "listening") return !0;
56
+ await new Promise((n) => setTimeout(n, 100));
806
57
  }
807
- return !1;
58
+ return await h() === "listening";
808
59
  };
809
- let A = null, _ = null;
810
- const Mt = 2e3, It = () => {
811
- const t = Number(process.env.MARKDOWN_API_STARTUP_TIMEOUT_MS);
812
- return Number.isFinite(t) && t > 0 ? t : 1e4;
60
+ let d = null, w = null;
61
+ const J = 2e3, V = 1e4, Q = () => {
62
+ const e = process.env.MARKDOWN_API_STARTUP_TIMEOUT_MS;
63
+ if (e === void 0 || e === "") return V;
64
+ const r = Number(e);
65
+ if (!Number.isSafeInteger(r) || r <= 0)
66
+ throw new RangeError(`MARKDOWN_API_STARTUP_TIMEOUT_MS must be a positive integer of milliseconds; got ${JSON.stringify(e)}`);
67
+ return r;
813
68
  };
814
- let I = null;
815
- const Nt = async () => {
816
- if (await we()) return !0;
817
- if (_) return _;
818
- _ = (async () => {
819
- const r = Pt();
820
- if (!r)
821
- return await oe(Mt) ? !0 : (I = Ct(), !1);
822
- I = null;
823
- try {
824
- C(k()) && Le(k());
825
- } catch {
826
- }
827
- try {
828
- A = Re(r, [], { stdio: "ignore" });
829
- const e = () => {
830
- if (A) {
831
- try {
832
- A.kill("SIGTERM");
833
- } catch {
834
- }
835
- A = null;
836
- }
837
- };
838
- return process.once("exit", e), await oe(It()) ? !0 : (console.error("markdown-api Go server did not become ready on socket:", k()), e(), process.removeListener("exit", e), !1);
839
- } catch (e) {
840
- return console.error("Failed to spawn markdown-api Go server:", e), A = null, !1;
841
- }
842
- })();
843
- const t = await _;
844
- return t || (_ = null), t;
845
- }, xt = (t) => {
846
- if (be(t, "parseMarkdown"), t.timeoutMs !== void 0 && (!Number.isSafeInteger(t.timeoutMs) || t.timeoutMs <= 0))
847
- throw new RangeError(`parseMarkdown: timeoutMs must be a positive integer, got ${t.timeoutMs}`);
848
- }, Zt = async (t, r, e, n, o) => {
849
- if (k(), xt(o), !await Nt()) {
850
- const i = I ? ` ${I}` : "";
851
- throw new Error(`markdown service is not reachable on ${k()}.${i}`);
852
- }
853
- const s = {};
854
- n && (s.Authorization = `Bearer ${n}`);
855
- const a = Ce(Lt, xe({ baseUrl: "http://localhost", httpVersion: "2", sessionManager: Ot, readMaxBytes: 2 * o.maxHtmlBytes + ge }));
69
+ let l = null;
70
+ const b = () => {
71
+ d = null, process.removeListener("exit", p), process.removeListener("SIGTERM", m), process.removeListener("SIGINT", m);
72
+ }, p = () => {
73
+ const e = d;
74
+ e !== null && (b(), e.kill("SIGTERM"));
75
+ }, m = (e) => {
76
+ p(), process.listenerCount(e) === 0 && process.kill(process.pid, e);
77
+ }, Z = (e) => {
78
+ d = e, e.unref(), process.once("exit", p), process.prependOnceListener("SIGTERM", m), process.prependOnceListener("SIGINT", m);
79
+ const r = () => {
80
+ d === e && b();
81
+ };
82
+ e.once("exit", r), e.once("error", (t) => {
83
+ console.error("Failed to spawn markdown-api Go server:", t), r();
84
+ });
85
+ }, ee = async () => {
86
+ const e = q();
87
+ if (!e)
88
+ return await k(J, () => !1) ? !0 : (l = Y(), !1);
89
+ l = null;
90
+ const r = Q();
91
+ p();
92
+ let t;
856
93
  try {
857
- const i = await a.convert(
858
- {
859
- markdownText: t,
860
- filePath: r,
861
- workspaceRoot: e,
862
- validateExistence: o.validateExistence ?? !0,
863
- enableSubscript: o.enableSubscript,
864
- enableSuperscript: o.enableSuperscript,
865
- enableMark: o.enableMark,
866
- enableTableMerge: o.enableTableMerge,
867
- enableEmbeds: o.enableEmbeds,
868
- enableZennDirectives: o.enableZennDirectives,
869
- resolveImports: o.resolveImports ?? !1,
870
- includeSourceLines: o.includeSourceLines ?? !1,
871
- maxHtmlBytes: o.maxHtmlBytes,
872
- deny: new g({ segmentPatterns: [...o.deniedPathSegments] })
873
- },
874
- { headers: s, signal: o.signal, timeoutMs: o.timeoutMs }
875
- );
876
- return {
877
- htmlContent: i.htmlContent,
878
- headings: i.headings.map((l) => ({
879
- text: l.text,
880
- depth: l.depth,
881
- id: l.id
882
- }))
94
+ t = L(e, [], { stdio: ["ignore", "ignore", "inherit"] }), Z(t);
95
+ } catch (o) {
96
+ return console.error("Failed to spawn markdown-api Go server:", o), !1;
97
+ }
98
+ if (await k(r, () => d !== t)) return !0;
99
+ const n = t.exitCode ?? t.signalCode;
100
+ return console.error(n === null ? "markdown-api Go server did not become ready on socket:" : `markdown-api Go server ended (${n}) before it listened on socket:`, s()), p(), !1;
101
+ }, re = async (e) => process.platform === "win32" ? (l = z, !1) : await h() !== "absent" || e() ? !0 : (w ??= ee().finally(() => {
102
+ w = null;
103
+ }), w), te = async (e) => {
104
+ if (await re(e)) return;
105
+ const r = l ? ` ${l}` : "";
106
+ throw new i(`markdown service is not reachable on ${s()}.${r}`, c.Unavailable);
107
+ }, A = async ({ signal: e, timeoutMs: r }) => {
108
+ const t = () => new i("the call was stopped before the service listened", c.Canceled);
109
+ if (e?.aborted === !0) throw t();
110
+ const n = Date.now();
111
+ let o = !1, a = () => {
112
+ }, u;
113
+ const O = new Promise((ae, g) => {
114
+ const S = (I) => {
115
+ o = !0, g(I);
883
116
  };
884
- } catch (i) {
885
- throw i instanceof Me && i.code === Ie.ResourceExhausted ? new ke(i.rawMessage, { cause: i }) : i;
886
- }
887
- };
117
+ a = () => S(t()), e?.addEventListener("abort", a, { once: !0 }), r !== void 0 && (u = setTimeout(() => S(new i("the deadline passed before the service listened", c.DeadlineExceeded)), r));
118
+ });
119
+ try {
120
+ await Promise.race([te(() => o), O]);
121
+ } finally {
122
+ e?.removeEventListener("abort", a), clearTimeout(u);
123
+ }
124
+ return r === void 0 ? void 0 : Math.max(1, r - (Date.now() - n));
125
+ }, y = async (e) => (s(), await A({ signal: e }), N), ne = (e, r) => {
126
+ if (!(e instanceof i) || e.code === c.Unavailable || r?.aborted === !0 || !B(e)) return e;
127
+ const t = e.cause, n = t?.syscall === "connect" ? `markdown service is not reachable on ${s()}: ${t.code}` : `markdown service went away during the call: ${e.rawMessage}`;
128
+ return new i(n, c.Unavailable, void 0, void 0, e);
129
+ }, ve = async (e, r, t, n, o) => {
130
+ s(), W(o, "parseMarkdown");
131
+ const a = await A(o);
132
+ try {
133
+ return await F(j, { markdownText: e, filePath: r, workspaceRoot: t, userOAuthToken: n }, { ...o, timeoutMs: a });
134
+ } catch (u) {
135
+ throw ne(u, o.signal);
136
+ }
137
+ }, oe = Object.freeze(["authorize"]), se = {
138
+ open: async (e, r) => T(await y(r)).open(e, r),
139
+ classify: async (e, r) => T(await y(r)).classify(e, r)
140
+ }, he = (e) => (H(e, "createLinkCardHandler", oe), K({ authorize: e.authorize, pageFetch: se }));
888
141
  export {
889
- er as MAX_HTML_BYTES_LIMIT,
890
- ke as MarkdownResourceExhaustedError,
891
- Yt as createLinkCardHandler,
892
- Zt as parseMarkdown
142
+ P as MAX_HTML_BYTES_LIMIT,
143
+ Ee as MarkdownResourceExhaustedError,
144
+ he as createLinkCardHandler,
145
+ ve as parseMarkdown
893
146
  };