@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.
- package/README.md +276 -65
- package/dist/{abnfDiagram-VRR7QNED-B_QmXzWv.js → abnfDiagram-VRR7QNED-B3Q9attM.js} +9 -9
- package/dist/abnfDiagram-VRR7QNED-QW4YM2AY.cjs +1 -0
- package/dist/arc-BBLXr5EU.js +83 -0
- package/dist/arc-Cn8XXgbN.cjs +1 -0
- package/dist/{architectureDiagram-ZJ3FMSHR-CEb923Bc.js → architectureDiagram-ZJ3FMSHR-BaSp0hC2.js} +123 -123
- package/dist/architectureDiagram-ZJ3FMSHR-BfmjNYww.cjs +36 -0
- package/dist/{blockDiagram-677ZJIJ3-CmKMdhaS.js → blockDiagram-677ZJIJ3-DFcPQ19k.js} +166 -166
- package/dist/{blockDiagram-677ZJIJ3-D7RRzjUx.cjs → blockDiagram-677ZJIJ3-u7d3VCxA.cjs} +1 -1
- package/dist/{c4Diagram-LMCZKHZV-CG6fvZQo.js → c4Diagram-LMCZKHZV-DW0yo5tR.js} +2 -2
- package/dist/{c4Diagram-LMCZKHZV-W7Qa-ecL.cjs → c4Diagram-LMCZKHZV-nScsMUE3.cjs} +1 -1
- package/dist/{channel-TsF8sms_.js → channel-B2FBCr9X.js} +1 -1
- package/dist/channel-DlkTPSf_.cjs +1 -0
- package/dist/{chunk-2Q5K7J3B-CopwR1m3.js → chunk-2Q5K7J3B-BkE4Fsuz.js} +1 -1
- package/dist/chunk-2Q5K7J3B-evSha-HP.cjs +1 -0
- package/dist/{chunk-32BRIVSS-BnNlhc1M.js → chunk-32BRIVSS-CqpDiZD2.js} +1 -1
- package/dist/chunk-32BRIVSS-rIw6tBRO.cjs +1 -0
- package/dist/{chunk-5VM5RSS4-lKwSmIqG.cjs → chunk-5VM5RSS4-CYVpj2mc.cjs} +1 -1
- package/dist/{chunk-5VM5RSS4-O28FGAOF.js → chunk-5VM5RSS4-DAgNhPcU.js} +1 -1
- package/dist/{chunk-EX3LRPZG-CtFe4olX.cjs → chunk-EX3LRPZG-Ct2cyGh-.cjs} +1 -1
- package/dist/{chunk-EX3LRPZG-C36gZH3_.js → chunk-EX3LRPZG-QFjD28UF.js} +21 -21
- package/dist/{chunk-JWPE2WC7-DG0ebjV4.js → chunk-JWPE2WC7-Bj2m1SXZ.js} +1 -1
- package/dist/chunk-JWPE2WC7-Dgw1ILoe.cjs +1 -0
- package/dist/{chunk-MOJQB5TN-nqR_swpx.js → chunk-MOJQB5TN-B1fdnpCz.js} +122 -122
- package/dist/{chunk-MOJQB5TN-DADVbG98.cjs → chunk-MOJQB5TN-yjlPYCh4.cjs} +3 -3
- package/dist/{chunk-PUDLZKDR-BUSFO-Gx.cjs → chunk-PUDLZKDR-BlQ3qKcC.cjs} +4 -4
- package/dist/{chunk-PUDLZKDR-CD96jce3.js → chunk-PUDLZKDR-CIcw3cpm.js} +21 -21
- package/dist/chunk-RYQCIY6F-B-V6UOJy.cjs +1 -0
- package/dist/{chunk-RYQCIY6F-DJkrr1sD.js → chunk-RYQCIY6F-DyVk8fNp.js} +5 -5
- package/dist/{chunk-V7JOEXUC-BzCaDGop.cjs → chunk-V7JOEXUC-B1EgagKh.cjs} +3 -3
- package/dist/{chunk-V7JOEXUC-eBy2sAXD.js → chunk-V7JOEXUC-C776k7_V.js} +15 -15
- package/dist/{chunk-VR4S4FIN-C-qPzUSR.js → chunk-VR4S4FIN-CyqARa17.js} +5 -5
- package/dist/chunk-VR4S4FIN-Sx71KwIQ.cjs +1 -0
- package/dist/{chunk-XXDRQBXY-BK6HOWf6.js → chunk-XXDRQBXY-B-99Fbs_.js} +3 -3
- package/dist/chunk-XXDRQBXY-BgeRIUG1.cjs +1 -0
- package/dist/classDiagram-OUVF2IWQ-BLAiuPPL.cjs +1 -0
- package/dist/{classDiagram-v2-EOCWNBFH-CPDmG5kI.js → classDiagram-OUVF2IWQ-DJ0hW16Q.js} +2 -2
- package/dist/classDiagram-v2-EOCWNBFH-BLAiuPPL.cjs +1 -0
- package/dist/{classDiagram-OUVF2IWQ-CPDmG5kI.js → classDiagram-v2-EOCWNBFH-DJ0hW16Q.js} +2 -2
- package/dist/{code-blocks-BWr5Xg1I.js → code-blocks-C6J8rVTc.js} +23 -22
- package/dist/{code-blocks-BdKjppKq.cjs → code-blocks-CTESwslp.cjs} +3 -3
- package/dist/code-blocks.cjs +1 -1
- package/dist/code-blocks.d.ts +1 -0
- package/dist/code-blocks.js +15 -14
- package/dist/components/CopyButton.d.ts +1 -2
- package/dist/components/MarkdownRenderer.d.ts +31 -2
- package/dist/components/MarkdownViewer.d.ts +11 -2
- package/dist/components/MermaidDiagram.d.ts +1 -0
- package/dist/components/ReadingPlaceKeeper.d.ts +32 -0
- package/dist/components/SelectionKeeper.d.ts +38 -0
- package/dist/components/SpreadsheetBlock.d.ts +2 -1
- package/dist/components/blockKeys.d.ts +9 -2
- package/dist/components/blockOffsets.d.ts +3 -0
- package/dist/components/clipboard.d.ts +1 -0
- package/dist/components/embeds/ClientFrame.d.ts +1 -0
- package/dist/components/embeds/ProviderEmbed.d.ts +2 -1
- package/dist/components/embeds/embedLabels.d.ts +1 -1
- package/dist/components/embeds/linkCardFetch.d.ts +2 -0
- package/dist/components/embeds.d.ts +5 -0
- package/dist/components/headingLevels.d.ts +6 -0
- package/dist/components/htmlNodes.d.ts +2 -0
- package/dist/components/htmlSanitizer.d.ts +15 -2
- package/dist/components/labels.d.ts +3 -2
- package/dist/components/links.d.ts +1 -0
- package/dist/components/mdastNodes/CodeNode.d.ts +3 -1
- package/dist/components/mermaidLabels.d.ts +5 -0
- package/dist/components/mermaidSetup.d.ts +10 -0
- package/dist/components/missingImageLabels.d.ts +2 -0
- package/dist/components/ownPixels.d.ts +1 -0
- package/dist/components/rawHtml.d.ts +7 -3
- package/dist/components/spreadsheetModel.d.ts +1 -0
- package/dist/components/viewerLabels.d.ts +11 -2
- package/dist/contentColors.d.ts +21 -0
- package/dist/conversion.d.ts +7 -0
- package/dist/converter/NOTICES.md +6 -6
- package/dist/converter/createMarkdownConverter.d.ts +1 -0
- package/dist/converter/protocol.d.ts +4 -0
- package/dist/converter.cjs +1 -1
- package/dist/converter.js +89 -71
- package/dist/converter.wasm +0 -0
- package/dist/{cose-bilkent-JH36ORCC-BxO1rjEU.js → cose-bilkent-JH36ORCC-CR6Hdvto.js} +24 -24
- package/dist/cose-bilkent-JH36ORCC-reAbGeDU.cjs +1 -0
- package/dist/cynefinDiagram-TSTJHNR4-2qz-sUtp.cjs +62 -0
- package/dist/{cynefinDiagram-TSTJHNR4-DBD-B_Un.js → cynefinDiagram-TSTJHNR4-D1eY-FSf.js} +65 -65
- package/dist/dagre-VKFMJZFB-Byr9WPjb.cjs +4 -0
- package/dist/{dagre-VKFMJZFB-B8vZCPJg.js → dagre-VKFMJZFB-CXSczF8v.js} +26 -26
- package/dist/{diagram-FQU43EPY-DwhEcKWF.cjs → diagram-FQU43EPY-2YWng437.cjs} +1 -1
- package/dist/{diagram-FQU43EPY-YrRTNuX-.js → diagram-FQU43EPY-BZo0xcaj.js} +54 -54
- package/dist/diagram-G47NLZAW-CQS7BN4F.cjs +24 -0
- package/dist/{diagram-G47NLZAW-D4vmirJw.js → diagram-G47NLZAW-CvJW9ny8.js} +65 -65
- package/dist/{diagram-NH7WQ7WH-Drekwiur.js → diagram-NH7WQ7WH-C6VIkj-R.js} +18 -18
- package/dist/diagram-NH7WQ7WH-DXUwOBe7.cjs +24 -0
- package/dist/{diagram-OA4YK3LP-DZsM4Fpo.js → diagram-OA4YK3LP-Co6nMbJc.js} +29 -29
- package/dist/{diagram-OA4YK3LP-DeJ7pMIO.cjs → diagram-OA4YK3LP-DBUm2qxb.cjs} +3 -3
- package/dist/{diagram-WEI45ONY-CjRbsbkF.js → diagram-WEI45ONY-BaMbc5o2.js} +76 -76
- package/dist/diagram-WEI45ONY-ChpK2gP3.cjs +41 -0
- package/dist/ebnfDiagram-CCIWWBDH-DMIRHp8N.cjs +1 -0
- package/dist/{ebnfDiagram-CCIWWBDH-D0kt5Zdu.js → ebnfDiagram-CCIWWBDH-i7CR-FU0.js} +3 -3
- package/dist/embeds/frames.d.ts +4 -0
- package/dist/embeds/linkCards.d.ts +3 -1
- package/dist/embeds/providers.d.ts +1 -0
- package/dist/embeds/testing.cjs +1 -1
- package/dist/embeds/testing.js +1 -1
- package/dist/embeds-B4g6w7Tf.cjs +1 -0
- package/dist/embeds-Dra-dGKD.js +64 -0
- package/dist/embeds.cjs +1 -1
- package/dist/embeds.d.ts +2 -2
- package/dist/embeds.js +31 -70
- package/dist/{erDiagram-Q63AITRT-Ce4GpK2Z.js → erDiagram-Q63AITRT-DC-HhdaO.js} +69 -69
- package/dist/{erDiagram-Q63AITRT-DqFANbZx.cjs → erDiagram-Q63AITRT-DjRvJyWK.cjs} +1 -1
- package/dist/errors-BWZJx2MD.cjs +1 -0
- package/dist/errors-CapTNE7l.js +62 -0
- package/dist/errors.d.ts +2 -2
- package/dist/extractHeadings-BAhmauKo.js +5296 -0
- package/dist/extractHeadings-qiJXegCx.cjs +11 -0
- package/dist/flowDiagram-23GEKE2U-CiNzp6BS.js +7 -0
- package/dist/flowDiagram-23GEKE2U-DzZNPkRJ.cjs +1 -0
- package/dist/{ganttDiagram-NO4QXBWP-DjpANtqX.js → ganttDiagram-NO4QXBWP-BwbtaPxc.js} +69 -69
- package/dist/ganttDiagram-NO4QXBWP-CJv5UQ4O.cjs +292 -0
- package/dist/gen/markdown/v1/linkcard_connect.d.ts +19 -0
- package/dist/gen/markdown/v1/linkcard_pb.d.ts +87 -0
- package/dist/gen/markdown/v1/markdown_pb.d.ts +4 -0
- package/dist/{gitGraphDiagram-IHSO6WYX-DzhnsGXo.js → gitGraphDiagram-IHSO6WYX--yebcp4V.js} +26 -26
- package/dist/gitGraphDiagram-IHSO6WYX-dSwtW7X6.cjs +106 -0
- package/dist/index.cjs +1 -1
- package/dist/index.client.cjs +1 -1
- package/dist/index.client.d.ts +2 -2
- package/dist/index.client.js +42 -36
- package/dist/index.js +42 -36
- package/dist/index.server.cjs +1 -1
- package/dist/index.server.d.ts +2 -1
- package/dist/index.server.js +126 -873
- package/dist/{infoDiagram-FWYZ7A6U-hraoyboI.js → infoDiagram-FWYZ7A6U-B4AiTiqD.js} +9 -9
- package/dist/infoDiagram-FWYZ7A6U-BOj0VF20.cjs +2 -0
- package/dist/{ishikawaDiagram-FXEZZL3T-cBJei3wJ.js → ishikawaDiagram-FXEZZL3T-BsYs_qnQ.js} +55 -55
- package/dist/{ishikawaDiagram-FXEZZL3T-D5b25aDN.cjs → ishikawaDiagram-FXEZZL3T-CisV4kPO.cjs} +1 -1
- package/dist/{journeyDiagram-5HDEW3XC-DrNyUSsx.cjs → journeyDiagram-5HDEW3XC-BAvgWwpr.cjs} +1 -1
- package/dist/{journeyDiagram-5HDEW3XC-IkQqMl8f.js → journeyDiagram-5HDEW3XC-DbDo-dqu.js} +29 -29
- package/dist/{kanban-definition-HUTT4EX6-D2UL88Cz.js → kanban-definition-HUTT4EX6-BlPZISwH.js} +111 -111
- package/dist/{kanban-definition-HUTT4EX6-CvBgN3eX.cjs → kanban-definition-HUTT4EX6-RjzOWas9.cjs} +2 -2
- package/dist/{linear-BiJV9gYf.js → linear-BXWX8YXI.js} +33 -33
- package/dist/linear-CKPQExK8.cjs +1 -0
- package/dist/linkCardServer/linkCardCore.d.ts +10 -0
- package/dist/linkCardServer/linkCardHandler.server.d.ts +1 -6
- package/dist/linkCardServer/pageFetchPort.d.ts +19 -0
- package/dist/linkCardServer/{pageMetadata.server.d.ts → pageMetadata.d.ts} +11 -3
- package/dist/linkCards-BikpIncf.cjs +1 -0
- package/dist/linkCards-DfSLqLPF.js +50 -0
- package/dist/linkCards.cjs +1 -0
- package/dist/linkCards.d.ts +2 -0
- package/dist/linkCards.js +5 -0
- package/dist/markdownServiceClient-C47z3Ynu.cjs +1 -0
- package/dist/markdownServiceClient-uDeklhtG.js +480 -0
- package/dist/markdownServiceClient.d.ts +20 -0
- package/dist/mermaid.core-C4EClWgB.js +15595 -0
- package/dist/mermaid.core-CRP55Hm1.cjs +305 -0
- package/dist/mermaidFrame/NOTICES.md +1345 -0
- package/dist/mermaidFrame/cssCleaner.d.ts +13 -0
- package/dist/mermaidFrame/drawer.d.ts +34 -0
- package/dist/mermaidFrame/frame.d.ts +1 -0
- package/dist/mermaidFrame/frame.js +3307 -0
- package/dist/mermaidFrame/katexInert.d.ts +4 -0
- package/dist/mermaidFrame/protocol.d.ts +38 -0
- package/dist/mermaidFrame/serve.d.ts +14 -0
- package/dist/mermaidFrame/svgCleaner.d.ts +4 -0
- package/dist/{mindmap-definition-LN4V7U3C-CK67hf6V.js → mindmap-definition-LN4V7U3C-BEWpoMMG.js} +75 -75
- package/dist/{mindmap-definition-LN4V7U3C-CBrUse7P.cjs → mindmap-definition-LN4V7U3C-DnbSfqWP.cjs} +3 -3
- package/dist/pageFetchPort-2H18xcdi.cjs +1 -0
- package/dist/pageFetchPort-DVpXsKCz.js +624 -0
- package/dist/{pegDiagram-2B236MQR-CwWX4Irn.js → pegDiagram-2B236MQR-BF7gLiB-.js} +3 -3
- package/dist/pegDiagram-2B236MQR-BJysMObA.cjs +1 -0
- package/dist/{pieDiagram-ENE6RG2P-MO42pSl8.js → pieDiagram-ENE6RG2P-D_YzC3qc.js} +65 -65
- package/dist/{pieDiagram-ENE6RG2P-BKvggS7k.cjs → pieDiagram-ENE6RG2P-UMpeIUyV.cjs} +2 -2
- package/dist/{providers-BwQK7hZa.js → providers-CSvkTZsr.js} +17 -2
- package/dist/{providers-DO2t7ks4.cjs → providers-Cx0FuVQU.cjs} +1 -1
- package/dist/{quadrantDiagram-ABIIQ3AL-BHhoAvLS.cjs → quadrantDiagram-ABIIQ3AL-DANY0ipQ.cjs} +1 -1
- package/dist/{quadrantDiagram-ABIIQ3AL-CzHgLdS3.js → quadrantDiagram-ABIIQ3AL-DDm-r_6D.js} +57 -57
- package/dist/railroadDiagram-RFXS5EU6-CDUd4th1.cjs +1 -0
- package/dist/{railroadDiagram-RFXS5EU6-Bu_Fhi5x.js → railroadDiagram-RFXS5EU6-hJ6uB90G.js} +3 -3
- package/dist/remarkProcessor.server.d.ts +2 -0
- package/dist/{requirementDiagram-TGXJPOKE-CY-JYM-P.js → requirementDiagram-TGXJPOKE-BJef5Jb0.js} +29 -29
- package/dist/{requirementDiagram-TGXJPOKE-BhdvQnjG.cjs → requirementDiagram-TGXJPOKE-DaoCo7go.cjs} +1 -1
- package/dist/{sankeyDiagram-HTMAVEWB-BmHtjxlW.js → sankeyDiagram-HTMAVEWB-BZQs0bE-.js} +48 -48
- package/dist/{sankeyDiagram-HTMAVEWB-CUeYKZeQ.cjs → sankeyDiagram-HTMAVEWB-DXiv0YOu.cjs} +3 -3
- package/dist/{sequenceDiagram-DBY2YBRQ-GepntdDB.cjs → sequenceDiagram-DBY2YBRQ-CJGpsnsv.cjs} +1 -1
- package/dist/{sequenceDiagram-DBY2YBRQ-Cn2CC9BC.js → sequenceDiagram-DBY2YBRQ-D05U2w26.js} +86 -86
- package/dist/serviceClient.cjs +1 -0
- package/dist/serviceClient.d.ts +3 -0
- package/dist/serviceClient.js +9 -0
- package/dist/{sizeCapture-X5ZJPWSS-CZF99dy_.js → sizeCapture-X5ZJPWSS-DTr0Vm61.js} +1 -1
- package/dist/sizeCapture-X5ZJPWSS-DjuH1zNP.cjs +1 -0
- package/dist/{stateDiagram-2N3HPSRC-CCbBvBua.js → stateDiagram-2N3HPSRC-B8nvJKpB.js} +20 -20
- package/dist/stateDiagram-2N3HPSRC-BrB47FD-.cjs +1 -0
- package/dist/stateDiagram-v2-6OUMAXLB-CC8gOGDK.cjs +1 -0
- package/dist/{stateDiagram-v2-6OUMAXLB-_A1QESxx.js → stateDiagram-v2-6OUMAXLB-CV-JqAeP.js} +2 -2
- package/dist/styles/markdown.css +1 -1
- package/dist/styles/markdown.standalone.css +1 -1
- package/dist/{swimlanes-5IMT3BWC-B-BDM_Ae.js → swimlanes-5IMT3BWC-BPtufzUd.js} +3 -3
- package/dist/swimlanes-5IMT3BWC-WAbDPRgt.cjs +1 -0
- package/dist/{swimlanesDiagram-G3AALYLV-BysT2rWl.js → swimlanesDiagram-G3AALYLV-BQKEmJFX.js} +2 -2
- package/dist/{swimlanesDiagram-G3AALYLV-DZuQxKuB.cjs → swimlanesDiagram-G3AALYLV-BTwwtLZL.cjs} +1 -1
- package/dist/{timeline-definition-FHXFAJF6-DVzdzbl1.js → timeline-definition-FHXFAJF6-DJ6GV7Fz.js} +34 -34
- package/dist/{timeline-definition-FHXFAJF6-oFf_sUOI.cjs → timeline-definition-FHXFAJF6-qdkrah7t.cjs} +1 -1
- package/dist/vennDiagram-L72KCM5P-B5onSWPA.cjs +34 -0
- package/dist/{vennDiagram-L72KCM5P-Bm1TGZux.js → vennDiagram-L72KCM5P-DWnnndTj.js} +196 -196
- package/dist/viewer-settings.cjs +1 -1
- package/dist/viewer-settings.d.ts +8 -0
- package/dist/viewer-settings.js +11 -5
- package/dist/{wardleyDiagram-EHGQE667-BC_1RAbp.js → wardleyDiagram-EHGQE667-DFmDgQSb.js} +41 -41
- package/dist/{wardleyDiagram-EHGQE667-CqB3gLCH.cjs → wardleyDiagram-EHGQE667-DdeBbvVM.cjs} +2 -2
- package/dist/{xychartDiagram-FW5EYKEG-a1vb5UxD.cjs → xychartDiagram-FW5EYKEG-CiJQMClv.cjs} +1 -1
- package/dist/{xychartDiagram-FW5EYKEG-ClITdEhV.js → xychartDiagram-FW5EYKEG-L2Kj4cZA.js} +28 -28
- package/package.json +29 -13
- package/dist/abnfDiagram-VRR7QNED-Crz-ChMJ.cjs +0 -1
- package/dist/arc-BKGy6Me1.js +0 -83
- package/dist/arc-CYJCyviq.cjs +0 -1
- package/dist/architectureDiagram-ZJ3FMSHR-gTB8pttO.cjs +0 -36
- package/dist/channel-BKoPLS2j.cjs +0 -1
- package/dist/chunk-2Q5K7J3B-DgtYKcDs.cjs +0 -1
- package/dist/chunk-32BRIVSS-D-6GBFtx.cjs +0 -1
- package/dist/chunk-JWPE2WC7-5sd39cpa.cjs +0 -1
- package/dist/chunk-RYQCIY6F-BBTBydZd.cjs +0 -1
- package/dist/chunk-VR4S4FIN-CHKLwvYh.cjs +0 -1
- package/dist/chunk-XXDRQBXY-DttkP7wv.cjs +0 -1
- package/dist/classDiagram-OUVF2IWQ-BKruajP_.cjs +0 -1
- package/dist/classDiagram-v2-EOCWNBFH-BKruajP_.cjs +0 -1
- package/dist/cose-bilkent-JH36ORCC-Cjfa6NyL.cjs +0 -1
- package/dist/cynefinDiagram-TSTJHNR4-B3boTACW.cjs +0 -62
- package/dist/dagre-VKFMJZFB-DF3Mvuas.cjs +0 -4
- package/dist/diagram-G47NLZAW-CKIEbGLS.cjs +0 -24
- package/dist/diagram-NH7WQ7WH-D6wMwkLQ.cjs +0 -24
- package/dist/diagram-WEI45ONY-SYHw7k8b.cjs +0 -41
- package/dist/ebnfDiagram-CCIWWBDH-23bjk9FU.cjs +0 -1
- package/dist/errors-BW5JXRoX.cjs +0 -1
- package/dist/errors-Blk_XJ9C.js +0 -55
- package/dist/extractHeadings-DlQcPv5N.js +0 -20361
- package/dist/extractHeadings-wWAipplS.cjs +0 -315
- package/dist/flowDiagram-23GEKE2U-CRC9U6qD.cjs +0 -1
- package/dist/flowDiagram-23GEKE2U-CRo7TM3K.js +0 -7
- package/dist/ganttDiagram-NO4QXBWP-CR55KG5d.cjs +0 -292
- package/dist/gitGraphDiagram-IHSO6WYX-BWYUn1Bi.cjs +0 -106
- package/dist/infoDiagram-FWYZ7A6U-CsUGc58_.cjs +0 -2
- package/dist/linear-DwqXGYLc.cjs +0 -1
- package/dist/linkCardServer/addressGuard.server.d.ts +0 -25
- package/dist/linkCardServer/pageFetch.server.d.ts +0 -37
- package/dist/linkCards-1JxY8wdm.js +0 -48
- package/dist/linkCards-Bjd_vW39.cjs +0 -1
- package/dist/pegDiagram-2B236MQR-C5pLIpKI.cjs +0 -1
- package/dist/railroadDiagram-RFXS5EU6-CwGmOFD_.cjs +0 -1
- package/dist/sizeCapture-X5ZJPWSS-Cd-k8xwk.cjs +0 -1
- package/dist/stateDiagram-2N3HPSRC-D2cvrAtN.cjs +0 -1
- package/dist/stateDiagram-v2-6OUMAXLB-BaktPIVY.cjs +0 -1
- package/dist/swimlanes-5IMT3BWC-DtdLK5z3.cjs +0 -1
- package/dist/vennDiagram-L72KCM5P-Ba2FGeN1.cjs +0 -34
- /package/dist/linkCardServer/{htmlEncoding.server.d.ts → htmlEncoding.d.ts} +0 -0
- /package/dist/linkCardServer/{metadataCache.server.d.ts → metadataCache.d.ts} +0 -0
package/dist/index.server.js
CHANGED
|
@@ -1,893 +1,146 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import * as
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
|
770
|
-
},
|
|
771
|
-
createConnection: () =>
|
|
772
|
-
|
|
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
|
|
23
|
+
return v.dirname($(import.meta.url));
|
|
775
24
|
} catch {
|
|
776
25
|
return __dirname;
|
|
777
26
|
}
|
|
778
|
-
},
|
|
779
|
-
const
|
|
780
|
-
if (
|
|
781
|
-
return
|
|
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
|
|
784
|
-
if (
|
|
785
|
-
return
|
|
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 =
|
|
789
|
-
return
|
|
790
|
-
},
|
|
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 ${
|
|
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(" "),
|
|
797
|
-
const r =
|
|
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(),
|
|
800
|
-
}), r.on("error", () =>
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
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
|
|
58
|
+
return await h() === "listening";
|
|
808
59
|
};
|
|
809
|
-
let
|
|
810
|
-
const
|
|
811
|
-
const
|
|
812
|
-
|
|
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
|
|
815
|
-
const
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
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
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
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
|
-
|
|
885
|
-
|
|
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
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
142
|
+
P as MAX_HTML_BYTES_LIMIT,
|
|
143
|
+
Ee as MarkdownResourceExhaustedError,
|
|
144
|
+
he as createLinkCardHandler,
|
|
145
|
+
ve as parseMarkdown
|
|
893
146
|
};
|