@aiquants/markdown 12.3.0 → 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 (256) hide show
  1. package/README.md +276 -65
  2. package/dist/{abnfDiagram-VRR7QNED-B_QmXzWv.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-CEb923Bc.js → architectureDiagram-ZJ3FMSHR-BaSp0hC2.js} +123 -123
  7. package/dist/architectureDiagram-ZJ3FMSHR-BfmjNYww.cjs +36 -0
  8. package/dist/{blockDiagram-677ZJIJ3-CmKMdhaS.js → blockDiagram-677ZJIJ3-DFcPQ19k.js} +166 -166
  9. package/dist/{blockDiagram-677ZJIJ3-D7RRzjUx.cjs → blockDiagram-677ZJIJ3-u7d3VCxA.cjs} +1 -1
  10. package/dist/{c4Diagram-LMCZKHZV-CG6fvZQo.js → c4Diagram-LMCZKHZV-DW0yo5tR.js} +2 -2
  11. package/dist/{c4Diagram-LMCZKHZV-W7Qa-ecL.cjs → c4Diagram-LMCZKHZV-nScsMUE3.cjs} +1 -1
  12. package/dist/{channel-TsF8sms_.js → channel-B2FBCr9X.js} +1 -1
  13. package/dist/channel-DlkTPSf_.cjs +1 -0
  14. package/dist/{chunk-2Q5K7J3B-CopwR1m3.js → chunk-2Q5K7J3B-BkE4Fsuz.js} +1 -1
  15. package/dist/chunk-2Q5K7J3B-evSha-HP.cjs +1 -0
  16. package/dist/{chunk-32BRIVSS-BnNlhc1M.js → chunk-32BRIVSS-CqpDiZD2.js} +1 -1
  17. package/dist/chunk-32BRIVSS-rIw6tBRO.cjs +1 -0
  18. package/dist/{chunk-5VM5RSS4-lKwSmIqG.cjs → chunk-5VM5RSS4-CYVpj2mc.cjs} +1 -1
  19. package/dist/{chunk-5VM5RSS4-O28FGAOF.js → chunk-5VM5RSS4-DAgNhPcU.js} +1 -1
  20. package/dist/{chunk-EX3LRPZG-CtFe4olX.cjs → chunk-EX3LRPZG-Ct2cyGh-.cjs} +1 -1
  21. package/dist/{chunk-EX3LRPZG-C36gZH3_.js → chunk-EX3LRPZG-QFjD28UF.js} +21 -21
  22. package/dist/{chunk-JWPE2WC7-DG0ebjV4.js → chunk-JWPE2WC7-Bj2m1SXZ.js} +1 -1
  23. package/dist/chunk-JWPE2WC7-Dgw1ILoe.cjs +1 -0
  24. package/dist/{chunk-MOJQB5TN-nqR_swpx.js → chunk-MOJQB5TN-B1fdnpCz.js} +122 -122
  25. package/dist/{chunk-MOJQB5TN-DADVbG98.cjs → chunk-MOJQB5TN-yjlPYCh4.cjs} +3 -3
  26. package/dist/{chunk-PUDLZKDR-BUSFO-Gx.cjs → chunk-PUDLZKDR-BlQ3qKcC.cjs} +4 -4
  27. package/dist/{chunk-PUDLZKDR-CD96jce3.js → chunk-PUDLZKDR-CIcw3cpm.js} +21 -21
  28. package/dist/chunk-RYQCIY6F-B-V6UOJy.cjs +1 -0
  29. package/dist/{chunk-RYQCIY6F-DJkrr1sD.js → chunk-RYQCIY6F-DyVk8fNp.js} +5 -5
  30. package/dist/{chunk-V7JOEXUC-BzCaDGop.cjs → chunk-V7JOEXUC-B1EgagKh.cjs} +3 -3
  31. package/dist/{chunk-V7JOEXUC-eBy2sAXD.js → chunk-V7JOEXUC-C776k7_V.js} +15 -15
  32. package/dist/{chunk-VR4S4FIN-C-qPzUSR.js → chunk-VR4S4FIN-CyqARa17.js} +5 -5
  33. package/dist/chunk-VR4S4FIN-Sx71KwIQ.cjs +1 -0
  34. package/dist/{chunk-XXDRQBXY-BK6HOWf6.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-CPDmG5kI.js → classDiagram-OUVF2IWQ-DJ0hW16Q.js} +2 -2
  38. package/dist/classDiagram-v2-EOCWNBFH-BLAiuPPL.cjs +1 -0
  39. package/dist/{classDiagram-OUVF2IWQ-CPDmG5kI.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 +1 -2
  46. package/dist/components/MarkdownRenderer.d.ts +31 -2
  47. package/dist/components/MarkdownViewer.d.ts +11 -2
  48. package/dist/components/MermaidDiagram.d.ts +1 -0
  49. package/dist/components/ReadingPlaceKeeper.d.ts +32 -0
  50. package/dist/components/SelectionKeeper.d.ts +38 -0
  51. package/dist/components/SpreadsheetBlock.d.ts +2 -1
  52. package/dist/components/blockKeys.d.ts +9 -2
  53. package/dist/components/blockOffsets.d.ts +3 -0
  54. package/dist/components/clipboard.d.ts +1 -0
  55. package/dist/components/embeds/ClientFrame.d.ts +1 -0
  56. package/dist/components/embeds/ProviderEmbed.d.ts +2 -1
  57. package/dist/components/embeds/embedLabels.d.ts +1 -1
  58. package/dist/components/embeds/linkCardFetch.d.ts +2 -0
  59. package/dist/components/embeds.d.ts +5 -0
  60. package/dist/components/headingLevels.d.ts +6 -0
  61. package/dist/components/htmlNodes.d.ts +2 -0
  62. package/dist/components/htmlSanitizer.d.ts +15 -2
  63. package/dist/components/labels.d.ts +3 -2
  64. package/dist/components/links.d.ts +1 -0
  65. package/dist/components/mdastNodes/CodeNode.d.ts +3 -1
  66. package/dist/components/mermaidLabels.d.ts +5 -0
  67. package/dist/components/mermaidSetup.d.ts +10 -0
  68. package/dist/components/missingImageLabels.d.ts +2 -0
  69. package/dist/components/ownPixels.d.ts +1 -0
  70. package/dist/components/rawHtml.d.ts +7 -3
  71. package/dist/components/spreadsheetModel.d.ts +1 -0
  72. package/dist/components/viewerLabels.d.ts +11 -2
  73. package/dist/contentColors.d.ts +21 -0
  74. package/dist/conversion.d.ts +7 -0
  75. package/dist/converter/NOTICES.md +6 -6
  76. package/dist/converter/createMarkdownConverter.d.ts +1 -0
  77. package/dist/converter/protocol.d.ts +4 -0
  78. package/dist/converter.cjs +1 -1
  79. package/dist/converter.js +89 -71
  80. package/dist/converter.wasm +0 -0
  81. package/dist/{cose-bilkent-JH36ORCC-BxO1rjEU.js → cose-bilkent-JH36ORCC-CR6Hdvto.js} +24 -24
  82. package/dist/cose-bilkent-JH36ORCC-reAbGeDU.cjs +1 -0
  83. package/dist/cynefinDiagram-TSTJHNR4-2qz-sUtp.cjs +62 -0
  84. package/dist/{cynefinDiagram-TSTJHNR4-DBD-B_Un.js → cynefinDiagram-TSTJHNR4-D1eY-FSf.js} +65 -65
  85. package/dist/dagre-VKFMJZFB-Byr9WPjb.cjs +4 -0
  86. package/dist/{dagre-VKFMJZFB-B8vZCPJg.js → dagre-VKFMJZFB-CXSczF8v.js} +26 -26
  87. package/dist/{diagram-FQU43EPY-DwhEcKWF.cjs → diagram-FQU43EPY-2YWng437.cjs} +1 -1
  88. package/dist/{diagram-FQU43EPY-YrRTNuX-.js → diagram-FQU43EPY-BZo0xcaj.js} +54 -54
  89. package/dist/diagram-G47NLZAW-CQS7BN4F.cjs +24 -0
  90. package/dist/{diagram-G47NLZAW-D4vmirJw.js → diagram-G47NLZAW-CvJW9ny8.js} +65 -65
  91. package/dist/{diagram-NH7WQ7WH-Drekwiur.js → diagram-NH7WQ7WH-C6VIkj-R.js} +18 -18
  92. package/dist/diagram-NH7WQ7WH-DXUwOBe7.cjs +24 -0
  93. package/dist/{diagram-OA4YK3LP-DZsM4Fpo.js → diagram-OA4YK3LP-Co6nMbJc.js} +29 -29
  94. package/dist/{diagram-OA4YK3LP-DeJ7pMIO.cjs → diagram-OA4YK3LP-DBUm2qxb.cjs} +3 -3
  95. package/dist/{diagram-WEI45ONY-CjRbsbkF.js → diagram-WEI45ONY-BaMbc5o2.js} +76 -76
  96. package/dist/diagram-WEI45ONY-ChpK2gP3.cjs +41 -0
  97. package/dist/ebnfDiagram-CCIWWBDH-DMIRHp8N.cjs +1 -0
  98. package/dist/{ebnfDiagram-CCIWWBDH-D0kt5Zdu.js → ebnfDiagram-CCIWWBDH-i7CR-FU0.js} +3 -3
  99. package/dist/embeds/frames.d.ts +4 -0
  100. package/dist/embeds/linkCards.d.ts +3 -1
  101. package/dist/embeds/providers.d.ts +1 -0
  102. package/dist/embeds/testing.cjs +1 -1
  103. package/dist/embeds/testing.js +1 -1
  104. package/dist/embeds-B4g6w7Tf.cjs +1 -0
  105. package/dist/embeds-Dra-dGKD.js +64 -0
  106. package/dist/embeds.cjs +1 -1
  107. package/dist/embeds.d.ts +2 -2
  108. package/dist/embeds.js +31 -70
  109. package/dist/{erDiagram-Q63AITRT-Ce4GpK2Z.js → erDiagram-Q63AITRT-DC-HhdaO.js} +69 -69
  110. package/dist/{erDiagram-Q63AITRT-DqFANbZx.cjs → erDiagram-Q63AITRT-DjRvJyWK.cjs} +1 -1
  111. package/dist/errors-BWZJx2MD.cjs +1 -0
  112. package/dist/errors-CapTNE7l.js +62 -0
  113. package/dist/errors.d.ts +2 -2
  114. package/dist/extractHeadings-BAhmauKo.js +5296 -0
  115. package/dist/extractHeadings-qiJXegCx.cjs +11 -0
  116. package/dist/flowDiagram-23GEKE2U-CiNzp6BS.js +7 -0
  117. package/dist/flowDiagram-23GEKE2U-DzZNPkRJ.cjs +1 -0
  118. package/dist/{ganttDiagram-NO4QXBWP-DjpANtqX.js → ganttDiagram-NO4QXBWP-BwbtaPxc.js} +69 -69
  119. package/dist/ganttDiagram-NO4QXBWP-CJv5UQ4O.cjs +292 -0
  120. package/dist/gen/markdown/v1/linkcard_connect.d.ts +19 -0
  121. package/dist/gen/markdown/v1/linkcard_pb.d.ts +87 -0
  122. package/dist/gen/markdown/v1/markdown_pb.d.ts +4 -0
  123. package/dist/{gitGraphDiagram-IHSO6WYX-DzhnsGXo.js → gitGraphDiagram-IHSO6WYX--yebcp4V.js} +26 -26
  124. package/dist/gitGraphDiagram-IHSO6WYX-dSwtW7X6.cjs +106 -0
  125. package/dist/index.cjs +1 -1
  126. package/dist/index.client.cjs +1 -1
  127. package/dist/index.client.d.ts +2 -2
  128. package/dist/index.client.js +42 -36
  129. package/dist/index.js +42 -36
  130. package/dist/index.server.cjs +1 -1
  131. package/dist/index.server.d.ts +2 -1
  132. package/dist/index.server.js +126 -873
  133. package/dist/{infoDiagram-FWYZ7A6U-hraoyboI.js → infoDiagram-FWYZ7A6U-B4AiTiqD.js} +9 -9
  134. package/dist/infoDiagram-FWYZ7A6U-BOj0VF20.cjs +2 -0
  135. package/dist/{ishikawaDiagram-FXEZZL3T-cBJei3wJ.js → ishikawaDiagram-FXEZZL3T-BsYs_qnQ.js} +55 -55
  136. package/dist/{ishikawaDiagram-FXEZZL3T-D5b25aDN.cjs → ishikawaDiagram-FXEZZL3T-CisV4kPO.cjs} +1 -1
  137. package/dist/{journeyDiagram-5HDEW3XC-DrNyUSsx.cjs → journeyDiagram-5HDEW3XC-BAvgWwpr.cjs} +1 -1
  138. package/dist/{journeyDiagram-5HDEW3XC-IkQqMl8f.js → journeyDiagram-5HDEW3XC-DbDo-dqu.js} +29 -29
  139. package/dist/{kanban-definition-HUTT4EX6-D2UL88Cz.js → kanban-definition-HUTT4EX6-BlPZISwH.js} +111 -111
  140. package/dist/{kanban-definition-HUTT4EX6-CvBgN3eX.cjs → kanban-definition-HUTT4EX6-RjzOWas9.cjs} +2 -2
  141. package/dist/{linear-BiJV9gYf.js → linear-BXWX8YXI.js} +33 -33
  142. package/dist/linear-CKPQExK8.cjs +1 -0
  143. package/dist/linkCardServer/linkCardCore.d.ts +10 -0
  144. package/dist/linkCardServer/linkCardHandler.server.d.ts +1 -6
  145. package/dist/linkCardServer/pageFetchPort.d.ts +19 -0
  146. package/dist/linkCardServer/{pageMetadata.server.d.ts → pageMetadata.d.ts} +11 -3
  147. package/dist/linkCards-BikpIncf.cjs +1 -0
  148. package/dist/linkCards-DfSLqLPF.js +50 -0
  149. package/dist/linkCards.cjs +1 -0
  150. package/dist/linkCards.d.ts +2 -0
  151. package/dist/linkCards.js +5 -0
  152. package/dist/markdownServiceClient-C47z3Ynu.cjs +1 -0
  153. package/dist/markdownServiceClient-uDeklhtG.js +480 -0
  154. package/dist/markdownServiceClient.d.ts +20 -0
  155. package/dist/mermaid.core-C4EClWgB.js +15595 -0
  156. package/dist/mermaid.core-CRP55Hm1.cjs +305 -0
  157. package/dist/mermaidFrame/NOTICES.md +1345 -0
  158. package/dist/mermaidFrame/cssCleaner.d.ts +13 -0
  159. package/dist/mermaidFrame/drawer.d.ts +34 -0
  160. package/dist/mermaidFrame/frame.d.ts +1 -0
  161. package/dist/mermaidFrame/frame.js +3307 -0
  162. package/dist/mermaidFrame/katexInert.d.ts +4 -0
  163. package/dist/mermaidFrame/protocol.d.ts +38 -0
  164. package/dist/mermaidFrame/serve.d.ts +14 -0
  165. package/dist/mermaidFrame/svgCleaner.d.ts +4 -0
  166. package/dist/{mindmap-definition-LN4V7U3C-CK67hf6V.js → mindmap-definition-LN4V7U3C-BEWpoMMG.js} +75 -75
  167. package/dist/{mindmap-definition-LN4V7U3C-CBrUse7P.cjs → mindmap-definition-LN4V7U3C-DnbSfqWP.cjs} +3 -3
  168. package/dist/pageFetchPort-2H18xcdi.cjs +1 -0
  169. package/dist/pageFetchPort-DVpXsKCz.js +624 -0
  170. package/dist/{pegDiagram-2B236MQR-CwWX4Irn.js → pegDiagram-2B236MQR-BF7gLiB-.js} +3 -3
  171. package/dist/pegDiagram-2B236MQR-BJysMObA.cjs +1 -0
  172. package/dist/{pieDiagram-ENE6RG2P-MO42pSl8.js → pieDiagram-ENE6RG2P-D_YzC3qc.js} +65 -65
  173. package/dist/{pieDiagram-ENE6RG2P-BKvggS7k.cjs → pieDiagram-ENE6RG2P-UMpeIUyV.cjs} +2 -2
  174. package/dist/{providers-BwQK7hZa.js → providers-CSvkTZsr.js} +17 -2
  175. package/dist/{providers-DO2t7ks4.cjs → providers-Cx0FuVQU.cjs} +1 -1
  176. package/dist/{quadrantDiagram-ABIIQ3AL-BHhoAvLS.cjs → quadrantDiagram-ABIIQ3AL-DANY0ipQ.cjs} +1 -1
  177. package/dist/{quadrantDiagram-ABIIQ3AL-CzHgLdS3.js → quadrantDiagram-ABIIQ3AL-DDm-r_6D.js} +57 -57
  178. package/dist/railroadDiagram-RFXS5EU6-CDUd4th1.cjs +1 -0
  179. package/dist/{railroadDiagram-RFXS5EU6-Bu_Fhi5x.js → railroadDiagram-RFXS5EU6-hJ6uB90G.js} +3 -3
  180. package/dist/remarkProcessor.server.d.ts +2 -0
  181. package/dist/{requirementDiagram-TGXJPOKE-CY-JYM-P.js → requirementDiagram-TGXJPOKE-BJef5Jb0.js} +29 -29
  182. package/dist/{requirementDiagram-TGXJPOKE-BhdvQnjG.cjs → requirementDiagram-TGXJPOKE-DaoCo7go.cjs} +1 -1
  183. package/dist/{sankeyDiagram-HTMAVEWB-BmHtjxlW.js → sankeyDiagram-HTMAVEWB-BZQs0bE-.js} +48 -48
  184. package/dist/{sankeyDiagram-HTMAVEWB-CUeYKZeQ.cjs → sankeyDiagram-HTMAVEWB-DXiv0YOu.cjs} +3 -3
  185. package/dist/{sequenceDiagram-DBY2YBRQ-GepntdDB.cjs → sequenceDiagram-DBY2YBRQ-CJGpsnsv.cjs} +1 -1
  186. package/dist/{sequenceDiagram-DBY2YBRQ-Cn2CC9BC.js → sequenceDiagram-DBY2YBRQ-D05U2w26.js} +86 -86
  187. package/dist/serviceClient.cjs +1 -0
  188. package/dist/serviceClient.d.ts +3 -0
  189. package/dist/serviceClient.js +9 -0
  190. package/dist/{sizeCapture-X5ZJPWSS-CZF99dy_.js → sizeCapture-X5ZJPWSS-DTr0Vm61.js} +1 -1
  191. package/dist/sizeCapture-X5ZJPWSS-DjuH1zNP.cjs +1 -0
  192. package/dist/{stateDiagram-2N3HPSRC-CCbBvBua.js → stateDiagram-2N3HPSRC-B8nvJKpB.js} +20 -20
  193. package/dist/stateDiagram-2N3HPSRC-BrB47FD-.cjs +1 -0
  194. package/dist/stateDiagram-v2-6OUMAXLB-CC8gOGDK.cjs +1 -0
  195. package/dist/{stateDiagram-v2-6OUMAXLB-_A1QESxx.js → stateDiagram-v2-6OUMAXLB-CV-JqAeP.js} +2 -2
  196. package/dist/styles/markdown.css +1 -1
  197. package/dist/styles/markdown.standalone.css +1 -1
  198. package/dist/{swimlanes-5IMT3BWC-B-BDM_Ae.js → swimlanes-5IMT3BWC-BPtufzUd.js} +3 -3
  199. package/dist/swimlanes-5IMT3BWC-WAbDPRgt.cjs +1 -0
  200. package/dist/{swimlanesDiagram-G3AALYLV-BysT2rWl.js → swimlanesDiagram-G3AALYLV-BQKEmJFX.js} +2 -2
  201. package/dist/{swimlanesDiagram-G3AALYLV-DZuQxKuB.cjs → swimlanesDiagram-G3AALYLV-BTwwtLZL.cjs} +1 -1
  202. package/dist/{timeline-definition-FHXFAJF6-DVzdzbl1.js → timeline-definition-FHXFAJF6-DJ6GV7Fz.js} +34 -34
  203. package/dist/{timeline-definition-FHXFAJF6-oFf_sUOI.cjs → timeline-definition-FHXFAJF6-qdkrah7t.cjs} +1 -1
  204. package/dist/vennDiagram-L72KCM5P-B5onSWPA.cjs +34 -0
  205. package/dist/{vennDiagram-L72KCM5P-Bm1TGZux.js → vennDiagram-L72KCM5P-DWnnndTj.js} +196 -196
  206. package/dist/viewer-settings.cjs +1 -1
  207. package/dist/viewer-settings.d.ts +8 -0
  208. package/dist/viewer-settings.js +11 -5
  209. package/dist/{wardleyDiagram-EHGQE667-BC_1RAbp.js → wardleyDiagram-EHGQE667-DFmDgQSb.js} +41 -41
  210. package/dist/{wardleyDiagram-EHGQE667-CqB3gLCH.cjs → wardleyDiagram-EHGQE667-DdeBbvVM.cjs} +2 -2
  211. package/dist/{xychartDiagram-FW5EYKEG-a1vb5UxD.cjs → xychartDiagram-FW5EYKEG-CiJQMClv.cjs} +1 -1
  212. package/dist/{xychartDiagram-FW5EYKEG-ClITdEhV.js → xychartDiagram-FW5EYKEG-L2Kj4cZA.js} +28 -28
  213. package/package.json +29 -13
  214. package/dist/abnfDiagram-VRR7QNED-Crz-ChMJ.cjs +0 -1
  215. package/dist/arc-BKGy6Me1.js +0 -83
  216. package/dist/arc-CYJCyviq.cjs +0 -1
  217. package/dist/architectureDiagram-ZJ3FMSHR-gTB8pttO.cjs +0 -36
  218. package/dist/channel-BKoPLS2j.cjs +0 -1
  219. package/dist/chunk-2Q5K7J3B-DgtYKcDs.cjs +0 -1
  220. package/dist/chunk-32BRIVSS-D-6GBFtx.cjs +0 -1
  221. package/dist/chunk-JWPE2WC7-5sd39cpa.cjs +0 -1
  222. package/dist/chunk-RYQCIY6F-BBTBydZd.cjs +0 -1
  223. package/dist/chunk-VR4S4FIN-CHKLwvYh.cjs +0 -1
  224. package/dist/chunk-XXDRQBXY-DttkP7wv.cjs +0 -1
  225. package/dist/classDiagram-OUVF2IWQ-BKruajP_.cjs +0 -1
  226. package/dist/classDiagram-v2-EOCWNBFH-BKruajP_.cjs +0 -1
  227. package/dist/cose-bilkent-JH36ORCC-Cjfa6NyL.cjs +0 -1
  228. package/dist/cynefinDiagram-TSTJHNR4-B3boTACW.cjs +0 -62
  229. package/dist/dagre-VKFMJZFB-DF3Mvuas.cjs +0 -4
  230. package/dist/diagram-G47NLZAW-CKIEbGLS.cjs +0 -24
  231. package/dist/diagram-NH7WQ7WH-D6wMwkLQ.cjs +0 -24
  232. package/dist/diagram-WEI45ONY-SYHw7k8b.cjs +0 -41
  233. package/dist/ebnfDiagram-CCIWWBDH-23bjk9FU.cjs +0 -1
  234. package/dist/errors-BW5JXRoX.cjs +0 -1
  235. package/dist/errors-Blk_XJ9C.js +0 -55
  236. package/dist/extractHeadings-DlQcPv5N.js +0 -20361
  237. package/dist/extractHeadings-wWAipplS.cjs +0 -315
  238. package/dist/flowDiagram-23GEKE2U-CRC9U6qD.cjs +0 -1
  239. package/dist/flowDiagram-23GEKE2U-CRo7TM3K.js +0 -7
  240. package/dist/ganttDiagram-NO4QXBWP-CR55KG5d.cjs +0 -292
  241. package/dist/gitGraphDiagram-IHSO6WYX-BWYUn1Bi.cjs +0 -106
  242. package/dist/infoDiagram-FWYZ7A6U-CsUGc58_.cjs +0 -2
  243. package/dist/linear-DwqXGYLc.cjs +0 -1
  244. package/dist/linkCardServer/addressGuard.server.d.ts +0 -25
  245. package/dist/linkCardServer/pageFetch.server.d.ts +0 -37
  246. package/dist/linkCards-1JxY8wdm.js +0 -48
  247. package/dist/linkCards-Bjd_vW39.cjs +0 -1
  248. package/dist/pegDiagram-2B236MQR-C5pLIpKI.cjs +0 -1
  249. package/dist/railroadDiagram-RFXS5EU6-CwGmOFD_.cjs +0 -1
  250. package/dist/sizeCapture-X5ZJPWSS-Cd-k8xwk.cjs +0 -1
  251. package/dist/stateDiagram-2N3HPSRC-D2cvrAtN.cjs +0 -1
  252. package/dist/stateDiagram-v2-6OUMAXLB-BaktPIVY.cjs +0 -1
  253. package/dist/swimlanes-5IMT3BWC-DtdLK5z3.cjs +0 -1
  254. package/dist/vennDiagram-L72KCM5P-Ba2FGeN1.cjs +0 -34
  255. /package/dist/linkCardServer/{htmlEncoding.server.d.ts → htmlEncoding.d.ts} +0 -0
  256. /package/dist/linkCardServer/{metadataCache.server.d.ts → metadataCache.d.ts} +0 -0
@@ -0,0 +1 @@
1
+ "use strict";const d=require("./linkCards-BikpIncf.cjs"),I=require("./simple-logger-9yf7ypyB.cjs"),Q=require("htmlparser2"),N=require("@connectrpc/connect"),i=require("@bufbuild/protobuf"),z=1024,ee=/^[\t\n\f\r ]$/u,w=r=>ee.test(r),b=r=>r.replace(/[A-Z]/gu,t=>t.toLowerCase()),_=r=>{try{return new TextDecoder(r).encoding}catch{return null}},te=r=>r[0]===239&&r[1]===187&&r[2]===191?"utf-8":r[0]===254&&r[1]===255?"utf-16be":r[0]===255&&r[1]===254?"utf-16le":null,re=r=>{for(const t of r.split(";").slice(1)){const e=t.indexOf("=");if(e!==-1&&t.slice(0,e).trim().toLowerCase()==="charset")return t.slice(e+1).trim().replace(/^"(.*)"$/su,"$1")}return null},ne=r=>{let t=0;for(;;){const e=r.indexOf("charset",t);if(e===-1)return null;let n=e+7;for(;w(r.charAt(n));)n+=1;if(r.charAt(n)!=="="){t=n;continue}for(n+=1;w(r.charAt(n));)n+=1;const o=r.charAt(n);if(o==='"'||o==="'"){const s=r.indexOf(o,n+1);return s===-1?null:r.slice(n+1,s)}const a=r.slice(n).search(/[\t\n\f\r ;]/u);return a===-1?r.slice(n):r.slice(n,n+a)}},q=(r,t)=>{let e=t;for(;w(r.charAt(e))||r.charAt(e)==="/";)e+=1;if(r.charAt(e)===">"||e>=r.length)return{attribute:null,end:e};let n="";for(;;){const s=r.charAt(e);if(s==="")return{attribute:null,end:e};if(s==="="&&n!=="")break;if(w(s)){for(;w(r.charAt(e));)e+=1;if(r.charAt(e)!=="=")return{attribute:{name:n,value:""},end:e};break}if(s==="/"||s===">")return{attribute:{name:n,value:""},end:e};n+=b(s),e+=1}for(e+=1;w(r.charAt(e));)e+=1;const o=r.charAt(e);if(o==='"'||o==="'"){const s=r.indexOf(o,e+1);return s===-1?{attribute:null,end:r.length}:{attribute:{name:n,value:b(r.slice(e+1,s))},end:s+1}}if(o===">")return{attribute:{name:n,value:""},end:e};const a=r.slice(e).search(/[\t\n\f\r >]/u);return a===-1?{attribute:null,end:r.length}:{attribute:{name:n,value:b(r.slice(e,e+a))},end:e+a}},oe=(r,t)=>{const e=new Set;let n=!1,o=null,a=null,s=t;for(;;){const{attribute:l,end:u}=q(r,s);if(s=u,l===null)break;if(!e.has(l.name))if(e.add(l.name),l.name==="http-equiv")n=l.value==="content-type";else if(l.name==="content"){const h=ne(l.value),g=h===null?null:_(h);g!==null&&a===null&&(a=g,o=!0)}else l.name==="charset"&&(a=_(l.value)??!1,o=!1)}return o===null||typeof a!="string"||o&&!n?{encoding:null,end:s}:a==="utf-16be"||a==="utf-16le"?{encoding:"utf-8",end:s}:{encoding:a==="x-user-defined"?"windows-1252":a,end:s}},ae=r=>{const t=Array.from(r.subarray(0,z),n=>String.fromCharCode(n)).join("");let e=0;for(;e<t.length;)if(t.startsWith("<!--",e)){const n=t.indexOf("-->",e+2);if(n===-1)return null;e=n+3}else if(/^<meta[\t\n\f\r /]$/iu.test(t.slice(e,e+6))){const{encoding:n,end:o}=oe(t,e+5);if(n!==null)return n;e=o+1}else if(/^<\/?[A-Za-z]/u.test(t.slice(e,e+3))){let n=e+1;for(;n<t.length&&!w(t.charAt(n))&&t.charAt(n)!==">";)n+=1;for(;;){const o=q(t,n);if(n=o.end,o.attribute===null)break}e=n+1}else if(/^<[!/?]$/u.test(t.slice(e,e+2))){const n=t.indexOf(">",e+1);if(n===-1)return null;e=n+1}else e+=1;return null},se=(r,t)=>{const e=te(r);if(e!==null)return e;const n=re(t),o=n===null?null:_(n);return o!==null?o:ae(r)??"utf-8"},ie=(r,t)=>{const e=new Uint8Array(t);let n=0;for(const o of r)e.set(o,n),n+=o.byteLength;return e},le=r=>{const t=[];let e=0,n=null;const o=()=>{const a=ie(t,e);t.length=0;const s=new TextDecoder(se(a,r));return n=s,{started:s,text:s.decode(a,{stream:!0})}};return{write:a=>n!==null?n.decode(a,{stream:!0}):(t.push(a),e+=a.byteLength,e<z?"":o().text),end:()=>{if(n!==null)return n.decode();const{started:a,text:s}=o();return s+a.decode()}}},ce=(r,t,e)=>{const n=new Map,o=new Map;return a=>{const s=n.get(a);if(s!==void 0&&s.expireAt>e())return Promise.resolve(s.value);const l=o.get(a);if(l!==void 0)return l;const u=r(a).then(h=>(!n.has(a)&&n.size>=t.maxEntries&&n.delete(n.keys().next().value),n.set(a,{value:h,expireAt:e()+t.ttlMsOf(h)}),h)).finally(()=>{o.delete(a)});return o.set(a,u),u}},ue=256,fe=4096,de=64,he=new Set(["html","head","title","meta","link","base","basefont","bgsound","noframes","script","style","template","noscript"]),pe=new Set(["title","script","style"]),me=new Set(["noscript","template","noframes"]),G=r=>{let t;try{t=new URL(r)}catch{return{ok:!1,detail:"Invalid URL"}}return t.protocol!=="http:"&&t.protocol!=="https:"?{ok:!1,detail:"Only http(s) URLs are allowed"}:t.username!==""||t.password!==""?{ok:!1,detail:"URLs with a user name or password are not allowed"}:(t.hash="",{ok:!0,href:t.href})},R=r=>{let t;try{t=new URL(r)}catch{return"(unparsable URL)"}return t.protocol!=="http:"&&t.protocol!=="https:"?`(a ${t.protocol} URL)`:(t.username="",t.password="",t.search="",t.hash="",t.href)},we=r=>r?.toLowerCase().split(/[\t\n\f\r ]+/u).includes("icon")===!0,ge=(r,t)=>{if(r===void 0)return t;let e;try{e=new URL(r,t)}catch{return t}return(e.protocol==="http:"||e.protocol==="https:")&&e.href.length<=d.LINK_CARD_URL_LIMIT?e.href:t},K=(r,t)=>{const e=r?.trim();if(e===void 0||e==="")return;let n;try{n=new URL(e,t)}catch{return}return n.href.length<=d.LINK_CARD_URL_LIMIT&&G(n.href).ok?n.href:void 0},Ee=r=>{let t=!1,e=0,n=0,o=0,a=null,s=null,l=null,u,h,g,P,U,D,M=!1,x,J=!1;const S=()=>{t=!0,O.pause()},O=new Q.Parser({onopentagname(c){e+=1,n+=1,o=0,(e>ue||n>fe||a===null&&!he.has(c))&&S()},onattribute(){o+=1,o>de&&S()},onopentag(c,f){if(!(t||a!==null)){if(me.has(c)){a=e;return}if(c==="meta"){const p=f.content;f.property==="og:site_name"&&(P=p),f.property==="og:title"&&(h=p),f.property==="og:description"&&(g=p),f.property==="og:image"&&(U=p),f.name==="description"&&(g=p)}else c==="link"&&!M&&we(f.rel)?(M=!0,D=f.href):c==="base"&&!J&&Object.hasOwn(f,"href")&&(J=!0,x=f.href);pe.has(c)&&(s=c,c==="title"&&u===void 0&&(l=""))}},ontext(c){a===null&&(l!==null?l+=c:s===null&&/[^\t\n\f\r ]/u.test(c)&&S())},onclosetag(c){if(!t){if(e-=1,a!==null){e<a&&(a=null);return}c===s&&(s=null,l!==null&&(u=l,l=null))}}},{decodeEntities:!0});return{write:c=>(t||O.write(c),!t),end:()=>{t||O.end();const c=d.linkCardTextOf(h,d.LINK_CARD_TEXT_LIMITS.title)??d.linkCardTextOf(u,d.LINK_CARD_TEXT_LIMITS.title),f=d.linkCardTextOf(g,d.LINK_CARD_TEXT_LIMITS.description),p=d.linkCardTextOf(P,d.LINK_CARD_TEXT_LIMITS.siteName),B=ge(x,r),H=K(U,B),F=K(D,B);return{...c===null?{}:{title:c},...f===null?{}:{description:f},...p===null?{}:{site_name:p},...H===void 0?{}:{image:H},...F===void 0?{}:{icon:F}}}}},Te=Object.freeze(["authorize","pageFetch"]),Ae=new Set(["text/html","application/xhtml+xml"]),ke="private, max-age=1800",ye=3600*1e3,W=Object.freeze({"private-network":1800,"forbidden-url":1800,unreachable:300,"not-html":300}),Ce=1e3,v="no-store",L=(r,t,e,n,o={})=>new Response(r.method==="HEAD"?null:JSON.stringify(e),{status:t,headers:{"Content-Type":"application/json; charset=utf-8","Cache-Control":n,"X-Content-Type-Options":"nosniff",...o}}),$=r=>new Response(null,{status:204,headers:{"Cache-Control":`private, max-age=${W[r]}`,"X-Content-Type-Options":"nosniff",[d.LINK_CARD_SKIP_HEADER]:r}}),V=(r,t,e)=>{if(typeof r!="object"||r===null)throw new TypeError(`${t}: options must be an object with an authorize function`);if(typeof r.authorize!="function")throw new TypeError(`${t}: options.authorize must be a function (pass () => true to serve everyone)`);const n=Object.keys(r).filter(o=>!e.includes(o));if(n.length>0)throw new TypeError(`${t}: unknown option(s): ${n.join(", ")}`)},Le=r=>Ae.has(r.split(";",1)[0].trim().toLowerCase()),ve=()=>new Promise(r=>{setTimeout(r,0)}),Se=async r=>{const t=le(r.contentType),e=Ee(r.url),n=r.body.getReader();for(;;){let o;try{o=await n.read()}catch(a){return I.linkCardLogger.error("Error reading a link-card page:",R(r.url),a),{ok:!1,reason:"unreachable"}}if(o.done)break;if(!e.write(t.write(o.value))){await Promise.allSettled([n.cancel()]);break}await ve()}return e.write(t.end()),{ok:!0,value:e.end()}},Oe=async(r,t,e)=>{const n=["image","icon"].filter(s=>r[s]!==void 0);if(n.length===0)return r;const o=await t.classify(n.map(s=>r[s]),e),a={...r};for(const[s,l]of n.entries())o[s]!==null&&delete a[l];return a},be=async(r,t)=>{const e=new AbortController;try{const n=await t.open(r,e.signal);if(n.kind==="skip")return{ok:!1,reason:n.reason};const o=n.status<200||n.status>299?"unreachable":Le(n.contentType)?null:"not-html";if(o!==null)return await Promise.allSettled([n.body.cancel()]),{ok:!1,reason:o};const a=await Se(n);return a.ok?{ok:!0,value:await Oe(a.value,t,e.signal)}:a}finally{e.abort()}},Ie=r=>{V(r,"createLinkCardHandlerCore",Te);const{authorize:t,pageFetch:e}=r;if(typeof e!="object"||e===null||typeof e.open!="function"||typeof e.classify!="function")throw new TypeError("createLinkCardHandlerCore: options.pageFetch must be a PageFetchPort (createConnectPageFetch makes one)");const n=ce(o=>be(o,e),{maxEntries:Ce,ttlMsOf:o=>o.ok?ye:W[o.reason]*1e3},Date.now);return async o=>{if(o.method!=="GET"&&o.method!=="HEAD")return L(o,405,{error:"Method Not Allowed"},v,{Allow:"GET, HEAD"});if(await t(o)!==!0)return L(o,401,{error:"Unauthorized"},v);const a=new URL(o.url).searchParams.get("url");if(a===null||a==="")return L(o,400,{error:"Missing 'url' parameter"},v);const s=G(a);if(!s.ok)return I.linkCardLogger.info("Refused link-card URL:",R(a),`(forbidden-url: ${s.detail})`),$("forbidden-url");let l;try{l=await n(s.href)}catch(u){return I.linkCardLogger.error("Unexpected error while reading link-card metadata:",R(s.href),u),L(o,500,{error:"Internal Server Error"},v)}return l.ok?L(o,200,l.value,ke):$(l.reason)}};var m=(r=>(r[r.UNSPECIFIED=0]="UNSPECIFIED",r[r.PRIVATE_NETWORK=1]="PRIVATE_NETWORK",r[r.FORBIDDEN_URL=2]="FORBIDDEN_URL",r[r.UNREACHABLE=3]="UNREACHABLE",r))(m||{});i.proto3.util.setEnumType(m,"markdown.v1.SkipReason",[{no:0,name:"SKIP_REASON_UNSPECIFIED"},{no:1,name:"SKIP_REASON_PRIVATE_NETWORK"},{no:2,name:"SKIP_REASON_FORBIDDEN_URL"},{no:3,name:"SKIP_REASON_UNREACHABLE"}]);class E extends i.Message{url="";constructor(t){super(),i.proto3.util.initPartial(t,this)}static runtime=i.proto3;static typeName="markdown.v1.FetchPageRequest";static fields=i.proto3.util.newFieldList(()=>[{no:1,name:"url",kind:"scalar",T:9}]);static fromBinary(t,e){return new E().fromBinary(t,e)}static fromJson(t,e){return new E().fromJson(t,e)}static fromJsonString(t,e){return new E().fromJsonString(t,e)}static equals(t,e){return i.proto3.util.equals(E,t,e)}}class T extends i.Message{part={case:void 0};constructor(t){super(),i.proto3.util.initPartial(t,this)}static runtime=i.proto3;static typeName="markdown.v1.FetchPageResponse";static fields=i.proto3.util.newFieldList(()=>[{no:1,name:"head",kind:"message",T:A,oneof:"part"},{no:2,name:"chunk",kind:"scalar",T:12,oneof:"part"},{no:3,name:"skip",kind:"message",T:k,oneof:"part"}]);static fromBinary(t,e){return new T().fromBinary(t,e)}static fromJson(t,e){return new T().fromJson(t,e)}static fromJsonString(t,e){return new T().fromJsonString(t,e)}static equals(t,e){return i.proto3.util.equals(T,t,e)}}class A extends i.Message{finalUrl="";status=0;contentType="";constructor(t){super(),i.proto3.util.initPartial(t,this)}static runtime=i.proto3;static typeName="markdown.v1.PageHead";static fields=i.proto3.util.newFieldList(()=>[{no:1,name:"final_url",kind:"scalar",T:9},{no:2,name:"status",kind:"scalar",T:5},{no:3,name:"content_type",kind:"scalar",T:9}]);static fromBinary(t,e){return new A().fromBinary(t,e)}static fromJson(t,e){return new A().fromJson(t,e)}static fromJsonString(t,e){return new A().fromJsonString(t,e)}static equals(t,e){return i.proto3.util.equals(A,t,e)}}class k extends i.Message{reason=0;constructor(t){super(),i.proto3.util.initPartial(t,this)}static runtime=i.proto3;static typeName="markdown.v1.PageSkip";static fields=i.proto3.util.newFieldList(()=>[{no:1,name:"reason",kind:"enum",T:i.proto3.getEnumType(m)}]);static fromBinary(t,e){return new k().fromBinary(t,e)}static fromJson(t,e){return new k().fromJson(t,e)}static fromJsonString(t,e){return new k().fromJsonString(t,e)}static equals(t,e){return i.proto3.util.equals(k,t,e)}}class y extends i.Message{urls=[];constructor(t){super(),i.proto3.util.initPartial(t,this)}static runtime=i.proto3;static typeName="markdown.v1.ClassifyUrlsRequest";static fields=i.proto3.util.newFieldList(()=>[{no:1,name:"urls",kind:"scalar",T:9,repeated:!0}]);static fromBinary(t,e){return new y().fromBinary(t,e)}static fromJson(t,e){return new y().fromJson(t,e)}static fromJsonString(t,e){return new y().fromJsonString(t,e)}static equals(t,e){return i.proto3.util.equals(y,t,e)}}class C extends i.Message{verdicts=[];constructor(t){super(),i.proto3.util.initPartial(t,this)}static runtime=i.proto3;static typeName="markdown.v1.ClassifyUrlsResponse";static fields=i.proto3.util.newFieldList(()=>[{no:1,name:"verdicts",kind:"enum",T:i.proto3.getEnumType(m),repeated:!0}]);static fromBinary(t,e){return new C().fromBinary(t,e)}static fromJson(t,e){return new C().fromJson(t,e)}static fromJsonString(t,e){return new C().fromJsonString(t,e)}static equals(t,e){return i.proto3.util.equals(C,t,e)}}const Ne={typeName:"markdown.v1.LinkCardService",methods:{fetchPage:{name:"FetchPage",I:E,O:T,kind:i.MethodKind.ServerStreaming},classifyUrls:{name:"ClassifyUrls",I:y,O:C,kind:i.MethodKind.Unary}}},Y=r=>{switch(r){case m.PRIVATE_NETWORK:return"private-network";case m.FORBIDDEN_URL:return"forbidden-url";case m.UNREACHABLE:return"unreachable";default:throw new Error(`LinkCardService answered an unknown skip reason: ${r}`)}},_e=r=>r===m.UNSPECIFIED?null:Y(r),Z=async(r,t)=>{try{return await r.next()}catch(e){throw t(),e}},Re=(r,t)=>new ReadableStream({pull:async e=>{const n=await Z(r,t);if(n.done===!0){t(),e.close();return}if(n.value.part.case!=="chunk")throw t(),new Error(`LinkCardService sent ${n.value.part.case??"nothing"} where a body chunk belongs`);e.enqueue(n.value.part.value)},cancel:t},{highWaterMark:0}),X=3e4,j=r=>{const t=new AbortController,e=AbortSignal.any([r,t.signal]);if(!e.aborted){const n=setTimeout(()=>t.abort(new N.ConnectError(`the call to LinkCardService took longer than ${X} ms`,N.Code.DeadlineExceeded)),X);e.addEventListener("abort",()=>clearTimeout(n),{once:!0})}return{signal:e,stop:()=>t.abort()}},Pe=r=>{const t=N.createClient(Ne,r);return{open:async(e,n)=>{const o=j(n),a=o.stop,s=t.fetchPage({url:e},{signal:o.signal})[Symbol.asyncIterator](),l=await Z(s,a),u=l.done===!0?void 0:l.value.part;switch(u?.case){case"head":return{kind:"page",url:u.value.finalUrl,status:u.value.status,contentType:u.value.contentType,body:Re(s,a)};case"skip":return a(),{kind:"skip",reason:Y(u.value.reason)};default:throw a(),new Error(`LinkCardService answered ${u?.case??"nothing"} where a head or a skip belongs`)}},classify:async(e,n)=>{const o=j(n);try{const{verdicts:a}=await t.classifyUrls({urls:[...e]},{signal:o.signal});if(a.length!==e.length)throw new Error(`LinkCardService answered ${a.length} verdicts for ${e.length} URLs`);return a.map(_e)}finally{o.stop()}}}};exports.assertLinkCardHandlerOptions=V;exports.createConnectPageFetch=Pe;exports.createLinkCardHandlerCore=Ie;
@@ -0,0 +1,624 @@
1
+ import { l as L, L as b, a as W, b as te } from "./linkCards-DfSLqLPF.js";
2
+ import { l as P } from "./simple-logger-DwH1YQvq.js";
3
+ import { Parser as ne } from "htmlparser2";
4
+ import { createClient as re, ConnectError as ae, Code as oe } from "@connectrpc/connect";
5
+ import { proto3 as l, Message as v, MethodKind as K } from "@bufbuild/protobuf";
6
+ const V = 1024, se = /^[\t\n\f\r ]$/u, p = (n) => se.test(n), R = (n) => n.replace(/[A-Z]/gu, (t) => t.toLowerCase()), I = (n) => {
7
+ try {
8
+ return new TextDecoder(n).encoding;
9
+ } catch {
10
+ return null;
11
+ }
12
+ }, ie = (n) => n[0] === 239 && n[1] === 187 && n[2] === 191 ? "utf-8" : n[0] === 254 && n[1] === 255 ? "utf-16be" : n[0] === 255 && n[1] === 254 ? "utf-16le" : null, le = (n) => {
13
+ for (const t of n.split(";").slice(1)) {
14
+ const e = t.indexOf("=");
15
+ if (e !== -1 && t.slice(0, e).trim().toLowerCase() === "charset")
16
+ return t.slice(e + 1).trim().replace(/^"(.*)"$/su, "$1");
17
+ }
18
+ return null;
19
+ }, ce = (n) => {
20
+ let t = 0;
21
+ for (; ; ) {
22
+ const e = n.indexOf("charset", t);
23
+ if (e === -1) return null;
24
+ let r = e + 7;
25
+ for (; p(n.charAt(r)); ) r += 1;
26
+ if (n.charAt(r) !== "=") {
27
+ t = r;
28
+ continue;
29
+ }
30
+ for (r += 1; p(n.charAt(r)); ) r += 1;
31
+ const a = n.charAt(r);
32
+ if (a === '"' || a === "'") {
33
+ const s = n.indexOf(a, r + 1);
34
+ return s === -1 ? null : n.slice(r + 1, s);
35
+ }
36
+ const o = n.slice(r).search(/[\t\n\f\r ;]/u);
37
+ return o === -1 ? n.slice(r) : n.slice(r, r + o);
38
+ }
39
+ }, q = (n, t) => {
40
+ let e = t;
41
+ for (; p(n.charAt(e)) || n.charAt(e) === "/"; ) e += 1;
42
+ if (n.charAt(e) === ">" || e >= n.length) return { attribute: null, end: e };
43
+ let r = "";
44
+ for (; ; ) {
45
+ const s = n.charAt(e);
46
+ if (s === "") return { attribute: null, end: e };
47
+ if (s === "=" && r !== "") break;
48
+ if (p(s)) {
49
+ for (; p(n.charAt(e)); ) e += 1;
50
+ if (n.charAt(e) !== "=") return { attribute: { name: r, value: "" }, end: e };
51
+ break;
52
+ }
53
+ if (s === "/" || s === ">") return { attribute: { name: r, value: "" }, end: e };
54
+ r += R(s), e += 1;
55
+ }
56
+ for (e += 1; p(n.charAt(e)); ) e += 1;
57
+ const a = n.charAt(e);
58
+ if (a === '"' || a === "'") {
59
+ const s = n.indexOf(a, e + 1);
60
+ return s === -1 ? { attribute: null, end: n.length } : { attribute: { name: r, value: R(n.slice(e + 1, s)) }, end: s + 1 };
61
+ }
62
+ if (a === ">") return { attribute: { name: r, value: "" }, end: e };
63
+ const o = n.slice(e).search(/[\t\n\f\r >]/u);
64
+ return o === -1 ? { attribute: null, end: n.length } : { attribute: { name: r, value: R(n.slice(e, e + o)) }, end: e + o };
65
+ }, ue = (n, t) => {
66
+ const e = /* @__PURE__ */ new Set();
67
+ let r = !1, a = null, o = null, s = t;
68
+ for (; ; ) {
69
+ const { attribute: i, end: u } = q(n, s);
70
+ if (s = u, i === null) break;
71
+ if (!e.has(i.name))
72
+ if (e.add(i.name), i.name === "http-equiv")
73
+ r = i.value === "content-type";
74
+ else if (i.name === "content") {
75
+ const d = ce(i.value), w = d === null ? null : I(d);
76
+ w !== null && o === null && (o = w, a = !0);
77
+ } else i.name === "charset" && (o = I(i.value) ?? !1, a = !1);
78
+ }
79
+ return a === null || typeof o != "string" || a && !r ? { encoding: null, end: s } : o === "utf-16be" || o === "utf-16le" ? { encoding: "utf-8", end: s } : { encoding: o === "x-user-defined" ? "windows-1252" : o, end: s };
80
+ }, fe = (n) => {
81
+ const t = Array.from(n.subarray(0, V), (r) => String.fromCharCode(r)).join("");
82
+ let e = 0;
83
+ for (; e < t.length; )
84
+ if (t.startsWith("<!--", e)) {
85
+ const r = t.indexOf("-->", e + 2);
86
+ if (r === -1) return null;
87
+ e = r + 3;
88
+ } else if (/^<meta[\t\n\f\r /]$/iu.test(t.slice(e, e + 6))) {
89
+ const { encoding: r, end: a } = ue(t, e + 5);
90
+ if (r !== null) return r;
91
+ e = a + 1;
92
+ } else if (/^<\/?[A-Za-z]/u.test(t.slice(e, e + 3))) {
93
+ let r = e + 1;
94
+ for (; r < t.length && !p(t.charAt(r)) && t.charAt(r) !== ">"; ) r += 1;
95
+ for (; ; ) {
96
+ const a = q(t, r);
97
+ if (r = a.end, a.attribute === null) break;
98
+ }
99
+ e = r + 1;
100
+ } else if (/^<[!/?]$/u.test(t.slice(e, e + 2))) {
101
+ const r = t.indexOf(">", e + 1);
102
+ if (r === -1) return null;
103
+ e = r + 1;
104
+ } else
105
+ e += 1;
106
+ return null;
107
+ }, de = (n, t) => {
108
+ const e = ie(n);
109
+ if (e !== null) return e;
110
+ const r = le(t), a = r === null ? null : I(r);
111
+ return a !== null ? a : fe(n) ?? "utf-8";
112
+ }, he = (n, t) => {
113
+ const e = new Uint8Array(t);
114
+ let r = 0;
115
+ for (const a of n)
116
+ e.set(a, r), r += a.byteLength;
117
+ return e;
118
+ }, me = (n) => {
119
+ const t = [];
120
+ let e = 0, r = null;
121
+ const a = () => {
122
+ const o = he(t, e);
123
+ t.length = 0;
124
+ const s = new TextDecoder(de(o, n));
125
+ return r = s, { started: s, text: s.decode(o, { stream: !0 }) };
126
+ };
127
+ return {
128
+ write: (o) => r !== null ? r.decode(o, { stream: !0 }) : (t.push(o), e += o.byteLength, e < V ? "" : a().text),
129
+ end: () => {
130
+ if (r !== null) return r.decode();
131
+ const { started: o, text: s } = a();
132
+ return s + o.decode();
133
+ }
134
+ };
135
+ }, pe = (n, t, e) => {
136
+ const r = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map();
137
+ return (o) => {
138
+ const s = r.get(o);
139
+ if (s !== void 0 && s.expireAt > e()) return Promise.resolve(s.value);
140
+ const i = a.get(o);
141
+ if (i !== void 0) return i;
142
+ const u = n(o).then((d) => (!r.has(o) && r.size >= t.maxEntries && r.delete(r.keys().next().value), r.set(o, { value: d, expireAt: e() + t.ttlMsOf(d) }), d)).finally(() => {
143
+ a.delete(o);
144
+ });
145
+ return a.set(o, u), u;
146
+ };
147
+ }, we = 256, Ee = 4096, ge = 64, Ae = /* @__PURE__ */ new Set(["html", "head", "title", "meta", "link", "base", "basefont", "bgsound", "noframes", "script", "style", "template", "noscript"]), ye = /* @__PURE__ */ new Set(["title", "script", "style"]), Te = /* @__PURE__ */ new Set(["noscript", "template", "noframes"]), Y = (n) => {
148
+ let t;
149
+ try {
150
+ t = new URL(n);
151
+ } catch {
152
+ return { ok: !1, detail: "Invalid URL" };
153
+ }
154
+ return t.protocol !== "http:" && t.protocol !== "https:" ? { ok: !1, detail: "Only http(s) URLs are allowed" } : t.username !== "" || t.password !== "" ? { ok: !1, detail: "URLs with a user name or password are not allowed" } : (t.hash = "", { ok: !0, href: t.href });
155
+ }, _ = (n) => {
156
+ let t;
157
+ try {
158
+ t = new URL(n);
159
+ } catch {
160
+ return "(unparsable URL)";
161
+ }
162
+ return t.protocol !== "http:" && t.protocol !== "https:" ? `(a ${t.protocol} URL)` : (t.username = "", t.password = "", t.search = "", t.hash = "", t.href);
163
+ }, ke = (n) => n?.toLowerCase().split(/[\t\n\f\r ]+/u).includes("icon") === !0, ve = (n, t) => {
164
+ if (n === void 0) return t;
165
+ let e;
166
+ try {
167
+ e = new URL(n, t);
168
+ } catch {
169
+ return t;
170
+ }
171
+ return (e.protocol === "http:" || e.protocol === "https:") && e.href.length <= W ? e.href : t;
172
+ }, j = (n, t) => {
173
+ const e = n?.trim();
174
+ if (e === void 0 || e === "") return;
175
+ let r;
176
+ try {
177
+ r = new URL(e, t);
178
+ } catch {
179
+ return;
180
+ }
181
+ return r.href.length <= W && Y(r.href).ok ? r.href : void 0;
182
+ }, Ce = (n) => {
183
+ let t = !1, e = 0, r = 0, a = 0, o = null, s = null, i = null, u, d, w, U, x, D, M = !1, J, B = !1;
184
+ const O = () => {
185
+ t = !0, N.pause();
186
+ }, N = new ne(
187
+ {
188
+ onopentagname(c) {
189
+ e += 1, r += 1, a = 0, (e > we || r > Ee || o === null && !Ae.has(c)) && O();
190
+ },
191
+ onattribute() {
192
+ a += 1, a > ge && O();
193
+ },
194
+ onopentag(c, f) {
195
+ if (!(t || o !== null)) {
196
+ if (Te.has(c)) {
197
+ o = e;
198
+ return;
199
+ }
200
+ if (c === "meta") {
201
+ const h = f.content;
202
+ f.property === "og:site_name" && (U = h), f.property === "og:title" && (d = h), f.property === "og:description" && (w = h), f.property === "og:image" && (x = h), f.name === "description" && (w = h);
203
+ } else c === "link" && !M && ke(f.rel) ? (M = !0, D = f.href) : c === "base" && !B && Object.hasOwn(f, "href") && (B = !0, J = f.href);
204
+ ye.has(c) && (s = c, c === "title" && u === void 0 && (i = ""));
205
+ }
206
+ },
207
+ ontext(c) {
208
+ o === null && (i !== null ? i += c : s === null && /[^\t\n\f\r ]/u.test(c) && O());
209
+ },
210
+ onclosetag(c) {
211
+ if (!t) {
212
+ if (e -= 1, o !== null) {
213
+ e < o && (o = null);
214
+ return;
215
+ }
216
+ c === s && (s = null, i !== null && (u = i, i = null));
217
+ }
218
+ }
219
+ },
220
+ { decodeEntities: !0 }
221
+ );
222
+ return {
223
+ write: (c) => (t || N.write(c), !t),
224
+ end: () => {
225
+ t || N.end();
226
+ const c = L(d, b.title) ?? L(u, b.title), f = L(w, b.description), h = L(U, b.siteName), H = ve(J, n), F = j(x, H), $ = j(D, H);
227
+ return {
228
+ ...c === null ? {} : { title: c },
229
+ ...f === null ? {} : { description: f },
230
+ ...h === null ? {} : { site_name: h },
231
+ ...F === void 0 ? {} : { image: F },
232
+ ...$ === void 0 ? {} : { icon: $ }
233
+ };
234
+ }
235
+ };
236
+ }, Le = Object.freeze(["authorize", "pageFetch"]), be = /* @__PURE__ */ new Set(["text/html", "application/xhtml+xml"]), Se = "private, max-age=1800", Oe = 3600 * 1e3, Z = Object.freeze({ "private-network": 1800, "forbidden-url": 1800, unreachable: 300, "not-html": 300 }), Ne = 1e3, S = "no-store", C = (n, t, e, r, a = {}) => new Response(n.method === "HEAD" ? null : JSON.stringify(e), {
237
+ status: t,
238
+ headers: { "Content-Type": "application/json; charset=utf-8", "Cache-Control": r, "X-Content-Type-Options": "nosniff", ...a }
239
+ }), z = (n) => new Response(null, {
240
+ status: 204,
241
+ headers: { "Cache-Control": `private, max-age=${Z[n]}`, "X-Content-Type-Options": "nosniff", [te]: n }
242
+ }), Re = (n, t, e) => {
243
+ if (typeof n != "object" || n === null)
244
+ throw new TypeError(`${t}: options must be an object with an authorize function`);
245
+ if (typeof n.authorize != "function")
246
+ throw new TypeError(`${t}: options.authorize must be a function (pass () => true to serve everyone)`);
247
+ const r = Object.keys(n).filter((a) => !e.includes(a));
248
+ if (r.length > 0)
249
+ throw new TypeError(`${t}: unknown option(s): ${r.join(", ")}`);
250
+ }, Pe = (n) => be.has(n.split(";", 1)[0].trim().toLowerCase()), Ie = () => new Promise((n) => {
251
+ setTimeout(n, 0);
252
+ }), _e = async (n) => {
253
+ const t = me(n.contentType), e = Ce(n.url), r = n.body.getReader();
254
+ for (; ; ) {
255
+ let a;
256
+ try {
257
+ a = await r.read();
258
+ } catch (o) {
259
+ return P.error("Error reading a link-card page:", _(n.url), o), { ok: !1, reason: "unreachable" };
260
+ }
261
+ if (a.done) break;
262
+ if (!e.write(t.write(a.value))) {
263
+ await Promise.allSettled([r.cancel()]);
264
+ break;
265
+ }
266
+ await Ie();
267
+ }
268
+ return e.write(t.end()), { ok: !0, value: e.end() };
269
+ }, Ue = async (n, t, e) => {
270
+ const r = ["image", "icon"].filter((s) => n[s] !== void 0);
271
+ if (r.length === 0) return n;
272
+ const a = await t.classify(
273
+ r.map((s) => n[s]),
274
+ e
275
+ ), o = { ...n };
276
+ for (const [s, i] of r.entries())
277
+ a[s] !== null && delete o[i];
278
+ return o;
279
+ }, xe = async (n, t) => {
280
+ const e = new AbortController();
281
+ try {
282
+ const r = await t.open(n, e.signal);
283
+ if (r.kind === "skip") return { ok: !1, reason: r.reason };
284
+ const a = r.status < 200 || r.status > 299 ? "unreachable" : Pe(r.contentType) ? null : "not-html";
285
+ if (a !== null)
286
+ return await Promise.allSettled([r.body.cancel()]), { ok: !1, reason: a };
287
+ const o = await _e(r);
288
+ return o.ok ? { ok: !0, value: await Ue(o.value, t, e.signal) } : o;
289
+ } finally {
290
+ e.abort();
291
+ }
292
+ }, je = (n) => {
293
+ Re(n, "createLinkCardHandlerCore", Le);
294
+ const { authorize: t, pageFetch: e } = n;
295
+ if (typeof e != "object" || e === null || typeof e.open != "function" || typeof e.classify != "function")
296
+ throw new TypeError("createLinkCardHandlerCore: options.pageFetch must be a PageFetchPort (createConnectPageFetch makes one)");
297
+ const r = pe((a) => xe(a, e), { maxEntries: Ne, ttlMsOf: (a) => a.ok ? Oe : Z[a.reason] * 1e3 }, Date.now);
298
+ return async (a) => {
299
+ if (a.method !== "GET" && a.method !== "HEAD")
300
+ return C(a, 405, { error: "Method Not Allowed" }, S, { Allow: "GET, HEAD" });
301
+ if (await t(a) !== !0)
302
+ return C(a, 401, { error: "Unauthorized" }, S);
303
+ const o = new URL(a.url).searchParams.get("url");
304
+ if (o === null || o === "")
305
+ return C(a, 400, { error: "Missing 'url' parameter" }, S);
306
+ const s = Y(o);
307
+ if (!s.ok)
308
+ return P.info("Refused link-card URL:", _(o), `(forbidden-url: ${s.detail})`), z("forbidden-url");
309
+ let i;
310
+ try {
311
+ i = await r(s.href);
312
+ } catch (u) {
313
+ return P.error("Unexpected error while reading link-card metadata:", _(s.href), u), C(a, 500, { error: "Internal Server Error" }, S);
314
+ }
315
+ return i.ok ? C(a, 200, i.value, Se) : z(i.reason);
316
+ };
317
+ };
318
+ var m = /* @__PURE__ */ ((n) => (n[n.UNSPECIFIED = 0] = "UNSPECIFIED", n[n.PRIVATE_NETWORK = 1] = "PRIVATE_NETWORK", n[n.FORBIDDEN_URL = 2] = "FORBIDDEN_URL", n[n.UNREACHABLE = 3] = "UNREACHABLE", n))(m || {});
319
+ l.util.setEnumType(m, "markdown.v1.SkipReason", [
320
+ { no: 0, name: "SKIP_REASON_UNSPECIFIED" },
321
+ { no: 1, name: "SKIP_REASON_PRIVATE_NETWORK" },
322
+ { no: 2, name: "SKIP_REASON_FORBIDDEN_URL" },
323
+ { no: 3, name: "SKIP_REASON_UNREACHABLE" }
324
+ ]);
325
+ class E extends v {
326
+ /**
327
+ * The URL to open. It is checked under the policy like every redirect
328
+ * target; a URL the policy refuses answers a skip.
329
+ *
330
+ * @generated from field: string url = 1;
331
+ */
332
+ url = "";
333
+ constructor(t) {
334
+ super(), l.util.initPartial(t, this);
335
+ }
336
+ static runtime = l;
337
+ static typeName = "markdown.v1.FetchPageRequest";
338
+ static fields = l.util.newFieldList(() => [{
339
+ no: 1,
340
+ name: "url",
341
+ kind: "scalar",
342
+ T: 9
343
+ /* ScalarType.STRING */
344
+ }]);
345
+ static fromBinary(t, e) {
346
+ return new E().fromBinary(t, e);
347
+ }
348
+ static fromJson(t, e) {
349
+ return new E().fromJson(t, e);
350
+ }
351
+ static fromJsonString(t, e) {
352
+ return new E().fromJsonString(t, e);
353
+ }
354
+ static equals(t, e) {
355
+ return l.util.equals(E, t, e);
356
+ }
357
+ }
358
+ class g extends v {
359
+ /**
360
+ * @generated from oneof markdown.v1.FetchPageResponse.part
361
+ */
362
+ part = { case: void 0 };
363
+ constructor(t) {
364
+ super(), l.util.initPartial(t, this);
365
+ }
366
+ static runtime = l;
367
+ static typeName = "markdown.v1.FetchPageResponse";
368
+ static fields = l.util.newFieldList(() => [
369
+ { no: 1, name: "head", kind: "message", T: A, oneof: "part" },
370
+ { no: 2, name: "chunk", kind: "scalar", T: 12, oneof: "part" },
371
+ { no: 3, name: "skip", kind: "message", T: y, oneof: "part" }
372
+ ]);
373
+ static fromBinary(t, e) {
374
+ return new g().fromBinary(t, e);
375
+ }
376
+ static fromJson(t, e) {
377
+ return new g().fromJson(t, e);
378
+ }
379
+ static fromJsonString(t, e) {
380
+ return new g().fromJsonString(t, e);
381
+ }
382
+ static equals(t, e) {
383
+ return l.util.equals(g, t, e);
384
+ }
385
+ }
386
+ class A extends v {
387
+ /**
388
+ * The URL of the final response, without its fragment.
389
+ *
390
+ * @generated from field: string final_url = 1;
391
+ */
392
+ finalUrl = "";
393
+ /**
394
+ * The HTTP status of the final response.
395
+ *
396
+ * @generated from field: int32 status = 2;
397
+ */
398
+ status = 0;
399
+ /**
400
+ * The Content-Type header of the final response, empty when absent.
401
+ *
402
+ * @generated from field: string content_type = 3;
403
+ */
404
+ contentType = "";
405
+ constructor(t) {
406
+ super(), l.util.initPartial(t, this);
407
+ }
408
+ static runtime = l;
409
+ static typeName = "markdown.v1.PageHead";
410
+ static fields = l.util.newFieldList(() => [
411
+ {
412
+ no: 1,
413
+ name: "final_url",
414
+ kind: "scalar",
415
+ T: 9
416
+ /* ScalarType.STRING */
417
+ },
418
+ {
419
+ no: 2,
420
+ name: "status",
421
+ kind: "scalar",
422
+ T: 5
423
+ /* ScalarType.INT32 */
424
+ },
425
+ {
426
+ no: 3,
427
+ name: "content_type",
428
+ kind: "scalar",
429
+ T: 9
430
+ /* ScalarType.STRING */
431
+ }
432
+ ]);
433
+ static fromBinary(t, e) {
434
+ return new A().fromBinary(t, e);
435
+ }
436
+ static fromJson(t, e) {
437
+ return new A().fromJson(t, e);
438
+ }
439
+ static fromJsonString(t, e) {
440
+ return new A().fromJsonString(t, e);
441
+ }
442
+ static equals(t, e) {
443
+ return l.util.equals(A, t, e);
444
+ }
445
+ }
446
+ class y extends v {
447
+ /**
448
+ * @generated from field: markdown.v1.SkipReason reason = 1;
449
+ */
450
+ reason = 0;
451
+ constructor(t) {
452
+ super(), l.util.initPartial(t, this);
453
+ }
454
+ static runtime = l;
455
+ static typeName = "markdown.v1.PageSkip";
456
+ static fields = l.util.newFieldList(() => [{ no: 1, name: "reason", kind: "enum", T: l.getEnumType(m) }]);
457
+ static fromBinary(t, e) {
458
+ return new y().fromBinary(t, e);
459
+ }
460
+ static fromJson(t, e) {
461
+ return new y().fromJson(t, e);
462
+ }
463
+ static fromJsonString(t, e) {
464
+ return new y().fromJsonString(t, e);
465
+ }
466
+ static equals(t, e) {
467
+ return l.util.equals(y, t, e);
468
+ }
469
+ }
470
+ class T extends v {
471
+ /**
472
+ * @generated from field: repeated string urls = 1;
473
+ */
474
+ urls = [];
475
+ constructor(t) {
476
+ super(), l.util.initPartial(t, this);
477
+ }
478
+ static runtime = l;
479
+ static typeName = "markdown.v1.ClassifyUrlsRequest";
480
+ static fields = l.util.newFieldList(() => [{ no: 1, name: "urls", kind: "scalar", T: 9, repeated: !0 }]);
481
+ static fromBinary(t, e) {
482
+ return new T().fromBinary(t, e);
483
+ }
484
+ static fromJson(t, e) {
485
+ return new T().fromJson(t, e);
486
+ }
487
+ static fromJsonString(t, e) {
488
+ return new T().fromJsonString(t, e);
489
+ }
490
+ static equals(t, e) {
491
+ return l.util.equals(T, t, e);
492
+ }
493
+ }
494
+ class k extends v {
495
+ /**
496
+ * One verdict for each of the request's URLs, in the same order.
497
+ *
498
+ * @generated from field: repeated markdown.v1.SkipReason verdicts = 1;
499
+ */
500
+ verdicts = [];
501
+ constructor(t) {
502
+ super(), l.util.initPartial(t, this);
503
+ }
504
+ static runtime = l;
505
+ static typeName = "markdown.v1.ClassifyUrlsResponse";
506
+ static fields = l.util.newFieldList(() => [{ no: 1, name: "verdicts", kind: "enum", T: l.getEnumType(m), repeated: !0 }]);
507
+ static fromBinary(t, e) {
508
+ return new k().fromBinary(t, e);
509
+ }
510
+ static fromJson(t, e) {
511
+ return new k().fromJson(t, e);
512
+ }
513
+ static fromJsonString(t, e) {
514
+ return new k().fromJsonString(t, e);
515
+ }
516
+ static equals(t, e) {
517
+ return l.util.equals(k, t, e);
518
+ }
519
+ }
520
+ const De = {
521
+ typeName: "markdown.v1.LinkCardService",
522
+ methods: {
523
+ /**
524
+ * FetchPage opens url and streams the final response: the head first, then
525
+ * body chunks of at most 64 KiB; a body over the server's MaxBodyBytes
526
+ * (8 MiB) is cut there and the stream ends normally (the reader parses the
527
+ * first bytes). A page that is not fetched answers a single skip. The stream
528
+ * ends early when the reader cancels it, and with an error when the body
529
+ * breaks off after the head: UNAVAILABLE, or DEADLINE_EXCEEDED past the
530
+ * server's time limit.
531
+ *
532
+ * @generated from rpc markdown.v1.LinkCardService.FetchPage
533
+ */
534
+ fetchPage: {
535
+ name: "FetchPage",
536
+ I: E,
537
+ O: g,
538
+ kind: K.ServerStreaming
539
+ },
540
+ /**
541
+ * ClassifyUrls answers, for each URL, whether the policy lets it be loaded
542
+ * (public), and otherwise why not. More URLs than the server's
543
+ * MaxClassifyUrls (16) fail with INVALID_ARGUMENT, and a classification past
544
+ * its ClassifyTimeout with DEADLINE_EXCEEDED.
545
+ *
546
+ * @generated from rpc markdown.v1.LinkCardService.ClassifyUrls
547
+ */
548
+ classifyUrls: {
549
+ name: "ClassifyUrls",
550
+ I: T,
551
+ O: k,
552
+ kind: K.Unary
553
+ }
554
+ }
555
+ }, Q = (n) => {
556
+ switch (n) {
557
+ case m.PRIVATE_NETWORK:
558
+ return "private-network";
559
+ case m.FORBIDDEN_URL:
560
+ return "forbidden-url";
561
+ case m.UNREACHABLE:
562
+ return "unreachable";
563
+ default:
564
+ throw new Error(`LinkCardService answered an unknown skip reason: ${n}`);
565
+ }
566
+ }, Me = (n) => n === m.UNSPECIFIED ? null : Q(n), ee = async (n, t) => {
567
+ try {
568
+ return await n.next();
569
+ } catch (e) {
570
+ throw t(), e;
571
+ }
572
+ }, Je = (n, t) => new ReadableStream(
573
+ {
574
+ pull: async (e) => {
575
+ const r = await ee(n, t);
576
+ if (r.done === !0) {
577
+ t(), e.close();
578
+ return;
579
+ }
580
+ if (r.value.part.case !== "chunk")
581
+ throw t(), new Error(`LinkCardService sent ${r.value.part.case ?? "nothing"} where a body chunk belongs`);
582
+ e.enqueue(r.value.part.value);
583
+ },
584
+ cancel: t
585
+ },
586
+ { highWaterMark: 0 }
587
+ ), X = 3e4, G = (n) => {
588
+ const t = new AbortController(), e = AbortSignal.any([n, t.signal]);
589
+ if (!e.aborted) {
590
+ const r = setTimeout(() => t.abort(new ae(`the call to LinkCardService took longer than ${X} ms`, oe.DeadlineExceeded)), X);
591
+ e.addEventListener("abort", () => clearTimeout(r), { once: !0 });
592
+ }
593
+ return { signal: e, stop: () => t.abort() };
594
+ }, ze = (n) => {
595
+ const t = re(De, n);
596
+ return {
597
+ open: async (e, r) => {
598
+ const a = G(r), o = a.stop, s = t.fetchPage({ url: e }, { signal: a.signal })[Symbol.asyncIterator](), i = await ee(s, o), u = i.done === !0 ? void 0 : i.value.part;
599
+ switch (u?.case) {
600
+ case "head":
601
+ return { kind: "page", url: u.value.finalUrl, status: u.value.status, contentType: u.value.contentType, body: Je(s, o) };
602
+ case "skip":
603
+ return o(), { kind: "skip", reason: Q(u.value.reason) };
604
+ default:
605
+ throw o(), new Error(`LinkCardService answered ${u?.case ?? "nothing"} where a head or a skip belongs`);
606
+ }
607
+ },
608
+ classify: async (e, r) => {
609
+ const a = G(r);
610
+ try {
611
+ const { verdicts: o } = await t.classifyUrls({ urls: [...e] }, { signal: a.signal });
612
+ if (o.length !== e.length) throw new Error(`LinkCardService answered ${o.length} verdicts for ${e.length} URLs`);
613
+ return o.map(Me);
614
+ } finally {
615
+ a.stop();
616
+ }
617
+ }
618
+ };
619
+ };
620
+ export {
621
+ je as a,
622
+ Re as b,
623
+ ze as c
624
+ };
@@ -1,6 +1,6 @@
1
- import { g as l, r as m, d as a } from "./chunk-MOJQB5TN-nqR_swpx.js";
2
- import { p } from "./chunk-JWPE2WC7-DG0ebjV4.js";
3
- import { _ as t, W as o } from "./extractHeadings-DlQcPv5N.js";
1
+ import { g as l, r as m, d as a } from "./chunk-MOJQB5TN-B1fdnpCz.js";
2
+ import { p } from "./chunk-JWPE2WC7-Bj2m1SXZ.js";
3
+ import { _ as t, l as o } from "./mermaid.core-C4EClWgB.js";
4
4
  import { M as u, d as c } from "./cynefin-VYW2F7L2-Bkk-F_Js.js";
5
5
  var f = c().RailroadPeg.parser.LangiumParser, i = /* @__PURE__ */ t((e) => {
6
6
  const r = e.alternatives.map(d);
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./chunk-MOJQB5TN-yjlPYCh4.cjs"),l=require("./chunk-JWPE2WC7-Dgw1ILoe.cjs"),t=require("./mermaid.core-CRP55Hm1.cjs"),s=require("./cynefin-VYW2F7L2-MpAliYy9.cjs");var u=s.createRailroadPegServices().RailroadPeg.parser.LangiumParser,i=t.__name(e=>{const r=e.alternatives.map(m);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformOrderedChoice"),m=t.__name(e=>{const r=e.elements.map(c);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformSequence"),c=t.__name(e=>{const r=p(e.suffix);return e.operator?{type:"special",text:e.operator==="&"?`&${o(r)}`:`!${o(r)}`}:r},"transformPrefix"),o=t.__name(e=>{switch(e.type){case"terminal":return`"${e.value}"`;case"nonterminal":return e.name;case"special":return e.text;default:return"(...)"}},"nodeToLabel"),p=t.__name(e=>{const r=d(e.primary);if(!e.operator)return r;switch(e.operator){case"?":return{type:"optional",element:r};case"*":return{type:"repetition",element:r,min:0,max:1/0};case"+":return{type:"repetition",element:r,min:1,max:1/0};default:throw new Error(`Unsupported PEG suffix operator: ${e.operator}`)}},"transformSuffix"),d=t.__name(e=>{switch(e.$type){case"PegLiteral":return{type:"terminal",value:e.value};case"PegIdentifier":return{type:"nonterminal",name:e.name};case"PegGroup":return i(e.element);case"PegAny":return{type:"special",text:e.dot};default:throw new Error(`Unsupported PEG primary node: ${e.$type}`)}},"transformPrimary"),f=t.__name(e=>({name:e.name,definition:i(e.definition)}),"transformRule"),g=t.__name(e=>{l.populateCommonDb(e,a.db),e.title&&a.db.setTitle(e.title),e.rules.map(r=>a.db.addRule(f(r)))},"populateDb"),P={parse:t.__name(e=>{a.db.clear(),t.log.debug("[PEG Parser] Starting Langium parse");const r=u.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new s.MermaidParseError(r);const n=r.value;t.log.debug("[PEG Parser] Parsed rules:",n.rules.length),g(n),t.log.debug("[PEG Parser] Parse complete")},"parse"),parser:{yy:a.db}},y={parser:P,db:a.db,renderer:a.renderer,styles:a.getStyles};exports.diagram=y;