@aiquants/markdown 6.1.0 → 6.3.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 (142) hide show
  1. package/README.md +75 -2
  2. package/dist/{abnfDiagram-VRR7QNED-DRNsVB-u.cjs → abnfDiagram-VRR7QNED-BGUmgNQ4.cjs} +1 -1
  3. package/dist/{abnfDiagram-VRR7QNED-0ow9i3L-.js → abnfDiagram-VRR7QNED-D3L_2hCD.js} +3 -3
  4. package/dist/{arc-BWR9_qMf.cjs → arc-B48_ucR0.cjs} +1 -1
  5. package/dist/arc-ChEpDr_9.js +83 -0
  6. package/dist/{architectureDiagram-ZJ3FMSHR-DtrqDlxV.cjs → architectureDiagram-ZJ3FMSHR-Bg0dBVnf.cjs} +1 -1
  7. package/dist/{architectureDiagram-ZJ3FMSHR-CsFXQcxx.js → architectureDiagram-ZJ3FMSHR-D4ta1ajC.js} +2 -2
  8. package/dist/{blockDiagram-677ZJIJ3-CqQ43viF.js → blockDiagram-677ZJIJ3-CupyE7nK.js} +3 -3
  9. package/dist/{blockDiagram-677ZJIJ3-CoZEeE0C.cjs → blockDiagram-677ZJIJ3-DkWMy8pP.cjs} +1 -1
  10. package/dist/{c4Diagram-LMCZKHZV-QPgNg4El.js → c4Diagram-LMCZKHZV-Cy1lIde9.js} +2 -2
  11. package/dist/{c4Diagram-LMCZKHZV-DGA2gxp-.cjs → c4Diagram-LMCZKHZV-DxOKAkJI.cjs} +1 -1
  12. package/dist/{channel-PnA15jK3.js → channel-C9c0_XwC.js} +1 -1
  13. package/dist/{channel-Jkgg7NV4.cjs → channel-TOZvPft0.cjs} +1 -1
  14. package/dist/{chunk-2Q5K7J3B-1iQ5h7FK.cjs → chunk-2Q5K7J3B-DaGwwho3.cjs} +1 -1
  15. package/dist/{chunk-2Q5K7J3B-DOWfHP5s.js → chunk-2Q5K7J3B-DahzXbiI.js} +1 -1
  16. package/dist/{chunk-32BRIVSS-XUAL4SUU.cjs → chunk-32BRIVSS-BddWRgx3.cjs} +1 -1
  17. package/dist/{chunk-32BRIVSS-94iTIA-u.js → chunk-32BRIVSS-DFLtYkrI.js} +1 -1
  18. package/dist/{chunk-5VM5RSS4-CKgpuXOS.cjs → chunk-5VM5RSS4-DSg2-2mp.cjs} +1 -1
  19. package/dist/{chunk-5VM5RSS4-OANQKmQE.js → chunk-5VM5RSS4-DiwEVqol.js} +1 -1
  20. package/dist/{chunk-EX3LRPZG-BQDQ1MdS.js → chunk-EX3LRPZG-Ca4uquaA.js} +37 -37
  21. package/dist/{chunk-EX3LRPZG-BrRRbskW.cjs → chunk-EX3LRPZG-OD-kvRfM.cjs} +1 -1
  22. package/dist/{chunk-JWPE2WC7-Bz9dXsLZ.cjs → chunk-JWPE2WC7-BGdnK7yg.cjs} +1 -1
  23. package/dist/{chunk-JWPE2WC7-Djg6Qi23.js → chunk-JWPE2WC7-njgGfGvE.js} +1 -1
  24. package/dist/{chunk-MOJQB5TN-1pZNp2Wl.js → chunk-MOJQB5TN-B-H_fDpi.js} +11 -11
  25. package/dist/{chunk-MOJQB5TN-DUk2Jy4_.cjs → chunk-MOJQB5TN-DPs_chEk.cjs} +1 -1
  26. package/dist/{chunk-PUDLZKDR-G5JYyEiR.js → chunk-PUDLZKDR-9xQzJ025.js} +11 -11
  27. package/dist/{chunk-PUDLZKDR-CVedetzB.cjs → chunk-PUDLZKDR-DZphdeDg.cjs} +1 -1
  28. package/dist/{chunk-RYQCIY6F-D0y50t5B.cjs → chunk-RYQCIY6F-8Qpsw4iJ.cjs} +1 -1
  29. package/dist/{chunk-RYQCIY6F-Crmt36sO.js → chunk-RYQCIY6F-BNzT71C4.js} +10 -10
  30. package/dist/{chunk-V7JOEXUC-DXSQM1ea.cjs → chunk-V7JOEXUC-BPE4_Rfd.cjs} +1 -1
  31. package/dist/{chunk-V7JOEXUC-BNo-X7NC.js → chunk-V7JOEXUC-DG6RRlOY.js} +10 -10
  32. package/dist/{chunk-VR4S4FIN-Bc567umS.cjs → chunk-VR4S4FIN-C-Pbv_Mm.cjs} +1 -1
  33. package/dist/{chunk-VR4S4FIN-BGGITgpQ.js → chunk-VR4S4FIN-CLtgFgby.js} +1 -1
  34. package/dist/{chunk-XXDRQBXY-DOuLpiJ4.cjs → chunk-XXDRQBXY-B0bOz96Q.cjs} +1 -1
  35. package/dist/{chunk-XXDRQBXY-Drnpl-KK.js → chunk-XXDRQBXY-DEXdwwNg.js} +1 -1
  36. package/dist/{classDiagram-v2-EOCWNBFH-Cneye7qT.js → classDiagram-OUVF2IWQ-B9uAd2dg.js} +2 -2
  37. package/dist/{classDiagram-OUVF2IWQ-mmjBEYmN.cjs → classDiagram-OUVF2IWQ-DMqQXVMf.cjs} +1 -1
  38. package/dist/{classDiagram-OUVF2IWQ-Cneye7qT.js → classDiagram-v2-EOCWNBFH-B9uAd2dg.js} +2 -2
  39. package/dist/{classDiagram-v2-EOCWNBFH-mmjBEYmN.cjs → classDiagram-v2-EOCWNBFH-DMqQXVMf.cjs} +1 -1
  40. package/dist/components/HostedScrollArea.d.ts +15 -0
  41. package/dist/components/MarkdownViewer.d.ts +3 -1
  42. package/dist/components/MermaidDiagram.d.ts +1 -0
  43. package/dist/components/mdastNodes/CodeNode.d.ts +2 -1
  44. package/dist/components/mermaidInteraction.d.ts +1 -0
  45. package/dist/{cose-bilkent-JH36ORCC-BQWfGE1G.js → cose-bilkent-JH36ORCC-DVB8IdFe.js} +5 -5
  46. package/dist/{cose-bilkent-JH36ORCC-BaEdcRlX.cjs → cose-bilkent-JH36ORCC-DxpO_Qhk.cjs} +1 -1
  47. package/dist/{cynefinDiagram-TSTJHNR4-CTDDSUz7.js → cynefinDiagram-TSTJHNR4-C-iEKX8r.js} +28 -28
  48. package/dist/{cynefinDiagram-TSTJHNR4-DPQl09kC.cjs → cynefinDiagram-TSTJHNR4-Dvc8nHOe.cjs} +1 -1
  49. package/dist/{dagre-VKFMJZFB-BMRdJgZy.js → dagre-VKFMJZFB-CI1hyGqk.js} +9 -9
  50. package/dist/{dagre-VKFMJZFB-DZ4E-Szs.cjs → dagre-VKFMJZFB-DqU8jG6A.cjs} +1 -1
  51. package/dist/{diagram-FQU43EPY-mK9YHIy1.cjs → diagram-FQU43EPY-DQHw46B-.cjs} +1 -1
  52. package/dist/{diagram-FQU43EPY-CmEpNw5i.js → diagram-FQU43EPY-iMIQEr1Q.js} +25 -25
  53. package/dist/{diagram-G47NLZAW-BX8Lj_uD.cjs → diagram-G47NLZAW-Dxkn-83c.cjs} +1 -1
  54. package/dist/{diagram-G47NLZAW-eJRQFjAg.js → diagram-G47NLZAW-L7A0K5es.js} +25 -25
  55. package/dist/{diagram-NH7WQ7WH-BOOj_4-N.js → diagram-NH7WQ7WH-8BnG6h8J.js} +19 -19
  56. package/dist/{diagram-NH7WQ7WH-3r1_3TrC.cjs → diagram-NH7WQ7WH-CBMFD5SB.cjs} +1 -1
  57. package/dist/{diagram-OA4YK3LP-DnDIHtcW.js → diagram-OA4YK3LP-C24uGaef.js} +13 -13
  58. package/dist/{diagram-OA4YK3LP-CkDJzLOy.cjs → diagram-OA4YK3LP-DrD1SsZM.cjs} +1 -1
  59. package/dist/{diagram-WEI45ONY-BpCCo_Ty.cjs → diagram-WEI45ONY-BYN2qTiw.cjs} +1 -1
  60. package/dist/{diagram-WEI45ONY-BHpuPTt-.js → diagram-WEI45ONY-kBWsy9sQ.js} +35 -35
  61. package/dist/{ebnfDiagram-CCIWWBDH-CfdalXdM.cjs → ebnfDiagram-CCIWWBDH-C7whdHrV.cjs} +1 -1
  62. package/dist/{ebnfDiagram-CCIWWBDH-BDLB-AVF.js → ebnfDiagram-CCIWWBDH-DRfaz75o.js} +3 -3
  63. package/dist/embeds/testing.cjs +1 -1
  64. package/dist/embeds/testing.js +1 -1
  65. package/dist/embeds.cjs +1 -1
  66. package/dist/embeds.js +1 -1
  67. package/dist/{erDiagram-Q63AITRT-CviOyQsx.cjs → erDiagram-Q63AITRT-Cbh7ns6U.cjs} +1 -1
  68. package/dist/{erDiagram-Q63AITRT-DZlcgZfp.js → erDiagram-Q63AITRT-CvcOag5w.js} +4 -4
  69. package/dist/extractHeadings-By3kC3b_.cjs +311 -0
  70. package/dist/{extractHeadings-CtiYkq2z.js → extractHeadings-Dz8gnhsx.js} +5108 -5006
  71. package/dist/flowDiagram-23GEKE2U-C5ygxVuP.js +7 -0
  72. package/dist/flowDiagram-23GEKE2U-DSpM0zzA.cjs +1 -0
  73. package/dist/{ganttDiagram-NO4QXBWP-DO0HAbYg.js → ganttDiagram-NO4QXBWP-Ccrw6Vga.js} +2 -2
  74. package/dist/{ganttDiagram-NO4QXBWP-CJa-hKPU.cjs → ganttDiagram-NO4QXBWP-YWoWQpTa.cjs} +1 -1
  75. package/dist/gen/markdown/v1/markdown_pb.d.ts +1 -0
  76. package/dist/{gitGraphDiagram-IHSO6WYX-CXStgPQs.js → gitGraphDiagram-IHSO6WYX-C-mHT-ew.js} +3 -3
  77. package/dist/{gitGraphDiagram-IHSO6WYX-CXcPHbkt.cjs → gitGraphDiagram-IHSO6WYX-nKm0aLrL.cjs} +1 -1
  78. package/dist/index.cjs +1 -1
  79. package/dist/index.client.cjs +1 -1
  80. package/dist/index.client.d.ts +1 -0
  81. package/dist/index.client.js +33 -32
  82. package/dist/index.js +33 -32
  83. package/dist/index.server.cjs +1 -1
  84. package/dist/index.server.js +59 -38
  85. package/dist/{infoDiagram-FWYZ7A6U-BByoHihL.cjs → infoDiagram-FWYZ7A6U-B6uUqDCC.cjs} +1 -1
  86. package/dist/{infoDiagram-FWYZ7A6U-K0__ySEG.js → infoDiagram-FWYZ7A6U-HBcwdQ6Z.js} +3 -3
  87. package/dist/{ishikawaDiagram-FXEZZL3T-C8QlwQP1.js → ishikawaDiagram-FXEZZL3T-CcSYEsTJ.js} +18 -18
  88. package/dist/{ishikawaDiagram-FXEZZL3T-DZOMdeTI.cjs → ishikawaDiagram-FXEZZL3T-D9WZm1OZ.cjs} +1 -1
  89. package/dist/{journeyDiagram-5HDEW3XC-RvC77rKo.cjs → journeyDiagram-5HDEW3XC-BC3ajweK.cjs} +1 -1
  90. package/dist/{journeyDiagram-5HDEW3XC-CZ9PFNNN.js → journeyDiagram-5HDEW3XC-PJm-8Gz8.js} +30 -30
  91. package/dist/{kanban-definition-HUTT4EX6-Q12F4vHx.js → kanban-definition-HUTT4EX6-42_dEzBV.js} +120 -120
  92. package/dist/{kanban-definition-HUTT4EX6-BL1jihGl.cjs → kanban-definition-HUTT4EX6-BR-C1joQ.cjs} +1 -1
  93. package/dist/{linear-LWjATjog.js → linear-B7J7VKh9.js} +8 -8
  94. package/dist/{linear-lDvPoqlB.cjs → linear-CoCezkp4.cjs} +1 -1
  95. package/dist/markdown.css +1 -1
  96. package/dist/{mindmap-definition-LN4V7U3C-TVYKONRm.cjs → mindmap-definition-LN4V7U3C-BO555Yeu.cjs} +1 -1
  97. package/dist/{mindmap-definition-LN4V7U3C-CM1XvwJX.js → mindmap-definition-LN4V7U3C-e4fXdr28.js} +16 -16
  98. package/dist/{pegDiagram-2B236MQR-a9Up0ERY.cjs → pegDiagram-2B236MQR-CqN17IwE.cjs} +1 -1
  99. package/dist/{pegDiagram-2B236MQR-Dlrnikqd.js → pegDiagram-2B236MQR-nN-jUv5o.js} +3 -3
  100. package/dist/{pieDiagram-ENE6RG2P-ClakmSma.cjs → pieDiagram-ENE6RG2P-D_EIGKcE.cjs} +1 -1
  101. package/dist/{pieDiagram-ENE6RG2P-WYrEJp8U.js → pieDiagram-ENE6RG2P-EvhF_8o2.js} +60 -60
  102. package/dist/providers-BO7J62-7.cjs +1 -0
  103. package/dist/{providers-Drq7MT_K.js → providers-L5RM3KgR.js} +23 -23
  104. package/dist/{quadrantDiagram-ABIIQ3AL-BkgMVDaX.js → quadrantDiagram-ABIIQ3AL-2gTiccyy.js} +18 -18
  105. package/dist/{quadrantDiagram-ABIIQ3AL-Cb01YcqR.cjs → quadrantDiagram-ABIIQ3AL-HNTFSQzi.cjs} +1 -1
  106. package/dist/{railroadDiagram-RFXS5EU6-Bob4WSMz.cjs → railroadDiagram-RFXS5EU6-CRuA7qqW.cjs} +1 -1
  107. package/dist/{railroadDiagram-RFXS5EU6-RfCtZGUR.js → railroadDiagram-RFXS5EU6-CYAI9-bK.js} +3 -3
  108. package/dist/remarkProcessor.server.d.ts +1 -0
  109. package/dist/{requirementDiagram-TGXJPOKE-C1yJPMp1.js → requirementDiagram-TGXJPOKE-BZc_cLKC.js} +3 -3
  110. package/dist/{requirementDiagram-TGXJPOKE-BP5h9mCj.cjs → requirementDiagram-TGXJPOKE-DesNyieJ.cjs} +1 -1
  111. package/dist/{sankeyDiagram-HTMAVEWB-D5G9Dcmr.js → sankeyDiagram-HTMAVEWB-B1QsmzsN.js} +1 -1
  112. package/dist/{sankeyDiagram-HTMAVEWB-shq9WK4t.cjs → sankeyDiagram-HTMAVEWB-wLwqusl2.cjs} +1 -1
  113. package/dist/{sequenceDiagram-DBY2YBRQ-BRxcK5-5.cjs → sequenceDiagram-DBY2YBRQ-D3ciEWOE.cjs} +1 -1
  114. package/dist/{sequenceDiagram-DBY2YBRQ-8EJMQxiB.js → sequenceDiagram-DBY2YBRQ-OTeHr40Q.js} +3 -3
  115. package/dist/{sizeCapture-X5ZJPWSS-DJG85IuR.js → sizeCapture-X5ZJPWSS-BhcQlLlw.js} +1 -1
  116. package/dist/{sizeCapture-X5ZJPWSS-BtBRJO2R.cjs → sizeCapture-X5ZJPWSS-LlzRMz8i.cjs} +1 -1
  117. package/dist/source-lines.cjs +1 -0
  118. package/dist/source-lines.d.ts +6 -0
  119. package/dist/source-lines.js +11 -0
  120. package/dist/{stateDiagram-2N3HPSRC-Czgkv_ey.cjs → stateDiagram-2N3HPSRC-D0q856z6.cjs} +1 -1
  121. package/dist/{stateDiagram-2N3HPSRC-CAd-NU-f.js → stateDiagram-2N3HPSRC-DjLE1--n.js} +11 -11
  122. package/dist/{stateDiagram-v2-6OUMAXLB-BNP5Lx0Y.cjs → stateDiagram-v2-6OUMAXLB-DJHUGWBX.cjs} +1 -1
  123. package/dist/{stateDiagram-v2-6OUMAXLB-x_Zps-d5.js → stateDiagram-v2-6OUMAXLB-DKU0HsD1.js} +2 -2
  124. package/dist/styles/markdown.css +1 -1
  125. package/dist/{swimlanes-5IMT3BWC-CfdkDd3q.cjs → swimlanes-5IMT3BWC-DC6qS8iI.cjs} +1 -1
  126. package/dist/{swimlanes-5IMT3BWC-D8brzzxb.js → swimlanes-5IMT3BWC-cxcj_GGS.js} +3 -3
  127. package/dist/{swimlanesDiagram-G3AALYLV-Bc9-lR2e.js → swimlanesDiagram-G3AALYLV-B95OToWo.js} +2 -2
  128. package/dist/{swimlanesDiagram-G3AALYLV-dvJpSdGV.cjs → swimlanesDiagram-G3AALYLV-Dv76fKaH.cjs} +1 -1
  129. package/dist/{timeline-definition-FHXFAJF6-CKW3NJOF.js → timeline-definition-FHXFAJF6-P-5kO0xQ.js} +38 -38
  130. package/dist/{timeline-definition-FHXFAJF6-BSqACati.cjs → timeline-definition-FHXFAJF6-wD6O9DDR.cjs} +1 -1
  131. package/dist/{vennDiagram-L72KCM5P-ChKxsFyJ.cjs → vennDiagram-L72KCM5P-BXHvaRtm.cjs} +1 -1
  132. package/dist/{vennDiagram-L72KCM5P-vPmq984y.js → vennDiagram-L72KCM5P-BwinGtNb.js} +102 -102
  133. package/dist/{wardleyDiagram-EHGQE667-CxzlR7km.cjs → wardleyDiagram-EHGQE667-BDgwIQTf.cjs} +1 -1
  134. package/dist/{wardleyDiagram-EHGQE667-CwN9zwBX.js → wardleyDiagram-EHGQE667-BeYbREE2.js} +18 -18
  135. package/dist/{xychartDiagram-FW5EYKEG-DBSKTLuc.js → xychartDiagram-FW5EYKEG-BXjx9Zgc.js} +27 -27
  136. package/dist/{xychartDiagram-FW5EYKEG-wJqYRInm.cjs → xychartDiagram-FW5EYKEG-DLCCDPGO.cjs} +1 -1
  137. package/package.json +14 -7
  138. package/dist/arc-Bh12k776.js +0 -83
  139. package/dist/extractHeadings-D1A8WzVy.cjs +0 -311
  140. package/dist/flowDiagram-23GEKE2U-C_FW0q38.js +0 -7
  141. package/dist/flowDiagram-23GEKE2U-Cb0U58EU.cjs +0 -1
  142. package/dist/providers-Bxr2Wb-j.cjs +0 -1
package/README.md CHANGED
@@ -131,6 +131,7 @@ const parseResult = await parseMarkdown(
131
131
  maxHtmlBytes: 4 * 1024 * 1024, // required; the largest HTML in bytes
132
132
  resolveImports: false, // expand <!-- @import "path" --> (default false)
133
133
  validateExistence: true, // probe local images and doc links (data-asset-exists / data-doc-exists; default true)
134
+ includeSourceLines: false, // annotate each block with data-source-lines="<first>-<last>" (default false)
134
135
  signal: controller.signal, // cancels the conversion in the service too
135
136
  timeoutMs: 10_000, // the conversion's deadline
136
137
  enableSubscript: false, // Disable subscript (leaves ~2~ as plain text)
@@ -149,6 +150,7 @@ const parseResult = await parseMarkdown(
149
150
  | `maxHtmlBytes` | ✅ | The largest HTML in bytes, a positive integer up to `MAX_HTML_BYTES_LIMIT`. The service stops while it renders and the call rejects with `MarkdownResourceExhaustedError`; the response the call accepts is bounded by twice this plus 64 KiB. |
150
151
  | `resolveImports` | | Expand `<!-- @import "path" -->` directives (default `false`: a directive stays an HTML comment and nothing is read). Only Markdown (`.md`) targets the deny rules admit are read, nested imports included; a refused target rejects the call with `permission_denied`. |
151
152
  | `validateExistence` | | Probe local targets (default `true`): a local storage image also gets `data-asset-exists` (`"true"` or `"false"`) and a local doc link `data-doc-exists` (`"true"` or `"false"`). Cloud targets are never probed, and `data-asset-src` is written for every admitted storage image either way. |
153
+ | `includeSourceLines` | | Annotate every rendered block with `data-source-lines="<first>-<last>"`, the 1-based lines of `markdownText` it came from, both inclusive (default `false`; see "Source lines" below). |
152
154
  | `signal` | | Cancels the call; the service stops converting. |
153
155
  | `timeoutMs` | | The conversion's deadline in milliseconds (a positive integer); the service stops at it or at `MARKDOWN_CONVERT_TIMEOUT`, whichever comes first. |
154
156
  | `enable*` | | Switch the syntax extensions and HTML plugins (each enabled unless `false`). The text plugins leave `summary` text (a `:::details` title included) as written. |
@@ -169,6 +171,25 @@ An image destination is a URL decoded once: `![](a%2541.png)` names the file `a%
169
171
 
170
172
  `MarkdownRenderer` shows an image without a `src` (or with `data-asset-exists="false"`) as a placeholder naming its `data-asset-src`, so HTML rendered before the host wrote the URLs shows which files are missing instead of blank space.
171
173
 
174
+ ### Source lines
175
+
176
+ With `includeSourceLines`, every rendered block carries `data-source-lines="<first>-<last>"`: the 1-based lines of `markdownText` it came from, both inclusive, so an editor can open the source at the block a reader points at. With `resolveImports`, the lines count the text with every import expanded.
177
+
178
+ - A leaf block counts its own lines (a fenced code block from its opening fence, which holds the info string); a container (a list, an item, a blockquote, a table, an alert, a Zenn container, a definition list, the footnotes) spans its blocks. A setext heading counts its text, not its underline; an alert, its blocks, not the `[!NOTE]` line.
179
+ - A thematic break and a raw HTML block carry none (the converter never wraps an author's HTML).
180
+ - The HTML with source lines is the HTML without them plus the attribute alone.
181
+ - The attribute comes only from the converter: a `data-source-lines` written in raw HTML or a heading's `{…}` attributes is removed whether or not the option is on.
182
+ - The viewer keeps the attribute only in the converter's shape, and moves the attribute of a `pre` it replaces (a highlighted code block, a Mermaid diagram) onto the replacement's root.
183
+
184
+ `@aiquants/markdown/source-lines` holds the contract without React or any package, for host sanitizers and editors: `SOURCE_LINES_ATTRIBUTE` (`"data-source-lines"`), the type `SourceLines` (`{ first, last }`) and `parseSourceLines(value)`, which returns `null` for any value the converter could not have written.
185
+
186
+ ```ts
187
+ import { parseSourceLines, SOURCE_LINES_ATTRIBUTE } from "@aiquants/markdown/source-lines"
188
+
189
+ const block = target.closest(`[${SOURCE_LINES_ATTRIBUTE}]`)
190
+ const lines = parseSourceLines(block?.getAttribute(SOURCE_LINES_ATTRIBUTE))
191
+ ```
192
+
172
193
  ## Viewer, embeds and links
173
194
 
174
195
  ### Stylesheets
@@ -238,7 +259,7 @@ The link is always kept: under the frame, as the card, or as the paragraph.
238
259
  Every host must match exactly (look-alike hosts, user info, ports and URLs carrying a provider URL in their query never match), and each path segment must match its own grammar. Short links without an id, Facebook, Pinterest, TikTok photo posts and LinkedIn articles have no provider: as bare URLs they become cards.
239
260
 
240
261
  **Frames.** No provider script ever runs in the page: posts and videos are cross-origin iframes with the registry's attributes (an `allow` within the six shared features, a `sandbox`, a referrer policy, `loading="lazy"`), titled `"<provider>: <label>"`. Every iframe — provider frames, iframes written in documents and the Dify plugin — mounts only on the client after hydration, and **never when its origin is the page's own origin**, whatever the host allows.
241
- The server HTML holds the link and a reserved box (`width: 100%` up to the provider's maximum, its aspect ratio or height, never a CSS `min-width`), hidden for readers without JavaScript. A frame whose box is narrower than the provider's minimum (YouTube 356 px, Shorts 200 px, X 250 px, Instagram 326 px, Threads 281 px, Bluesky 300 px) shows the fallback instead, and mounts again when the pane widens. X follows the primary subtag of the page's `<html lang>`; X, Threads and Bluesky follow `theme`.
262
+ The server HTML holds the link and a reserved box (`width: 100%` up to the provider's maximum, its aspect ratio or height, never a CSS `min-width`), hidden for readers without JavaScript. A frame whose box is narrower than the provider's minimum (YouTube 356 px, Shorts 200 px, X 250 px, Instagram 326 px, Threads 281 px, Bluesky 300 px, LinkedIn 251 px, niconico 229 px) shows the fallback instead, and mounts again when the pane widens. X follows the primary subtag of the page's `<html lang>`; X, Threads and Bluesky follow `theme`.
242
263
  Frames that report their height (X, Instagram, Threads, Bluesky, Reddit, note) are sized through one `message` listener that accepts only the frame's own window from its exact provider origin.
243
264
 
244
265
  **Link cards.** A card asks `GET <linkCardEndpoint>?url=<href>` (same-origin credentials, `redirect: "error"`) once an IntersectionObserver rooted at the viewer's scroller sees it, through a page-wide queue (two requests at once, 256 answers kept, aborted when no card needs the answer).
@@ -386,6 +407,7 @@ Mermaid draws in that element and the component shows the result in the slot, so
386
407
  - Nothing is drawn while the slot has no width (inside a closed `<details>` the browser does not lay out, or a hidden panel): the loading text stays until the slot gets a width. A drawing already under way when the slot loses its width finishes at the width it was given.
387
408
  - When the width of a slot showing a gantt chart changes (a splitter drag, a window resize), the chart is drawn again at the new width 200 ms after the last change, unless the slot then has no width or the width of the latest drawing. The shown chart stays until the new one replaces it, and the new one starts at the initial zoom and pan. Other diagram types take their size from their text and are never drawn again for a width change.
388
409
  - A drawing that finishes after a newer one started, after the diagram's text changed or after the component unmounted is discarded.
410
+ - Touch and pen: the diagram's `<svg>` and its container take `touch-action: none` only in the modes whose pan starts with a plain drag (`pan`, `both`), where a finger or pen drag pans the diagram. In every other mode (`both-shift` by default, `pan-shift`, `zoom`, `none`) the component writes no `touch-action`, so the browser default applies and a finger or pen scrolls the document over the diagram as anywhere else. The value follows the menu: switching the mode rewrites it on both elements, and the component removes it (with the other styles Panzoom wrote) when it tears its Panzoom instance down.
389
411
 
390
412
  ### Viewer toolbar
391
413
 
@@ -394,7 +416,7 @@ Mermaid draws in that element and the component shows the result in the slot, so
394
416
  | Property | Effect |
395
417
  | --- | --- |
396
418
  | `--aqmd-toolbar-inset-block-start` | Offset from the top of the toolbar's containing block |
397
- | `--aqmd-toolbar-inset-inline-end` | Offset from the inline end of the containing block (added to the scrollbar clearance) |
419
+ | `--aqmd-toolbar-inset-inline-end` | Offset from the inline end of the containing block (added to the scrollbar clearance: 24 px for the native scrollbar, or the measured width of a host scroll bar, see below) |
398
420
 
399
421
  The viewer reads no other package's variable. Where the toolbar is fixed to the viewport and must clear something of the host's own (a pinned side menu, for example), bind the property to that width in the host's layout, on an ancestor of the viewer:
400
422
 
@@ -413,6 +435,57 @@ Each menu's popover opens below the toolbar at its inline end, whichever button
413
435
 
414
436
  An open, unpinned popover closes on Escape while the focus is inside its menu, returns the focus to its button and calls `preventDefault()` on that keydown, so an outer Escape handler can skip a key the viewer consumed. Escape is not consumed while no popover is open.
415
437
 
438
+ ### Host scroll bar
439
+
440
+ `renderScrollBar?: (scroller: HTMLElement) => ReactNode` (type `MarkdownScrollBarRenderer`) lets the host put its own scroll bar beside the document, for example a control that scrolls by tapping. The package does not provide the bar; it provides the seam:
441
+
442
+ ```tsx
443
+ <MarkdownViewer {...props} renderScrollBar={(scroller) => <MyScrollBar target={scroller} />} />
444
+ ```
445
+
446
+ Given the prop, the viewer renders
447
+
448
+ | Element | Role |
449
+ | --- | --- |
450
+ | `[data-aqmd-scroll-row]` | A flex row as large as the viewer's own box |
451
+ | `[data-aqmd-scroll-clip]` | The row's first cell (`flex: 1 1 0%`, `overflow: clip`), holding the scroll container |
452
+ | `[data-aqmd-scroll-bar]` | The slot at the row's inline end (`flex: none`), as tall as the row; its child is stretched to the full height |
453
+
454
+ The function receives the scroll container, `[data-aqmd-scroll-container]`, the same element with the same hooks and classes as without the prop. It is called on every render once the container is mounted, before the first paint. The bar reads and writes the container's scroll position itself (`scrollTop`, `scrollHeight`, `clientHeight`, `scroll` events).
455
+
456
+ Only the native vertical scrollbar is hidden, in every engine: the scroll container always reserves it (`overflow-y: scroll`, so its thickness is constant), its border box (`box-sizing: border-box`, whatever the host's default) is widened by the measured thickness (`width: calc(100% + <thickness>px)`), and the clipping cell cuts that strip off. The native horizontal scrollbar keeps its native look, spans exactly the visible width and stays usable, as do the wheel, the keyboard and touch in both directions. No `::-webkit-scrollbar` or `scrollbar-width` rule is involved, so a host's `scrollbar-color` or `scrollbar-width` neither breaks the hiding nor is overridden. The cell uses `overflow: clip` rather than `hidden`, so nothing can scroll the cell itself, and it creates no containing block, so the fixed toolbar is neither moved nor clipped by it. Coverage: classic (space-taking) scrollbars are hidden in every browser that supports `overflow: clip` (Chromium 90, Firefox 81, Safari 16). An overlay scrollbar (macOS by default, mobile browsers, Firefox and GTK overlay modes) takes no space, measures 0 px and is drawn over the content while scrolling, so it stays visible there; the right-to-left inline end is handled the same way.
457
+
458
+ The thickness and the slot's width are measured in the scroll container's own CSS px, which a CSS `zoom` or a transform above it makes differ from the viewport's: a native scrollbar keeps its size on screen, so under `zoom: 1.1` its 15 px are 13.64 of the container's px. The container is positioned (`position: relative`) and holds an invisible, zero-tall box stretched across its padding box, `[data-aqmd-scroll-bar-probe]` (`aria-hidden`, out of flow); the thickness is the container's rect width less that box's, converted by the ratio of the container's rect width to its computed width, less its side borders. It is rounded up to a whole px, because the clip must never leave any of the native bar showing: the price is less than 1 px of the container's own px cut off its inline-end padding and the end of the native horizontal scrollbar (0.36 px at `zoom: 1.1`, none where the thickness is whole). Both are measured before the first paint and again whenever the container or the slot resizes and the window resizes (a page zoom changes a scrollbar's thickness in CSS px). The floating toolbar keeps the slot's measured width from the inline end instead of a native scrollbar's 24 px, and each popover's maximum width uses the same clearance.
459
+
460
+ Everything else keeps using the native scroller: fragment and table-of-contents scrolling with `scroll-padding-block-start`, the scroll position kept across a display-style change, link-card visibility observation, embed minimum widths measured from the content column, and the browser's scroll anchoring. Without the prop, the scroll container is the viewer's root element with its native scrollbars, and no row, cell or slot is rendered. Switching between given and omitted moves the scroll container onto another element, which starts at the top.
461
+
462
+ The layout is the exported `HostedScrollArea` (next section), which hosts can use for scrollers of their own.
463
+
464
+ ### Hosted scroll area
465
+
466
+ `HostedScrollArea` (props `HostedScrollAreaProps`) is the layout behind `renderScrollBar`, exported so a host can give any scroller of its own (an image canvas, a media stage, a panel's scroll area) the same bar. It renders the caller's scroller and, given `renderScrollBar`, the same row, clipping cell, slot and probe as the viewer: the host's bar replaces the native vertical scrollbar, and the native horizontal one stays.
467
+
468
+ ```tsx
469
+ <HostedScrollArea
470
+ scrollerRef={canvasRef}
471
+ scrollerProps={{ "data-my-scroller": "", className: "canvas", style: { blockSize: "100%", overflow: "auto" } }}
472
+ renderScrollBar={(scroller) => <MyScrollBar target={scroller} />}
473
+ rowStyle={{ flex: "1 1 0%" }}>
474
+ <img src={src} alt="" />
475
+ </HostedScrollArea>
476
+ ```
477
+
478
+ | Prop | Meaning |
479
+ | --- | --- |
480
+ | `scrollerProps` | The scroller's own attributes (type `HostedScrollerProps`: `data-*` hooks, class, inline style, ARIA, handlers), put on the `<div>` that scrolls, in their order. A hook the host finds with `closest()` or `querySelector()` therefore sits on the real scroller, not on a wrapper. |
481
+ | `scrollerRef` | The caller's ref to that element: an object ref, or a callback ref (one that returns a cleanup gets the cleanup instead of a call with `null`). |
482
+ | `children` | The scroller's content. |
483
+ | `renderScrollBar` | The host's bar (`MarkdownScrollBarRenderer`). Omitted, the area renders the scroller alone with the caller's props unchanged and measures nothing, so a host can use it unconditionally. |
484
+ | `rowClassName`, `rowStyle` | Place the row in its parent, with a bar only: the row takes the scroller's place there, so a flex item's `flex` and minimum sizes go here. `rowStyle` is merged over the row's own `display: flex; inline-size: 100%; block-size: 100%` and zero minimum sizes. |
485
+ | `onBarInlineSizeChange` | Called with the slot's measured width, in the scroller's own CSS px, whenever it changes, before the paint that shows it. The width is 0 before the first call and returns to 0 when the bar is removed. The viewer keeps its floating toolbar clear of the bar with it. |
486
+
487
+ With a bar, the area owns four of the scroller's styles, `position: relative`, `box-sizing: border-box`, `overflow-y: scroll` and `width: calc(100% + <thickness>px)`, and appends the probe as its last child; the rest of `scrollerProps.style` and the class are kept, so the horizontal overflow stays the caller's. The scroller must be as tall as the clipping cell (`block-size: 100%`). The hiding, the measurement under zoom and their coverage are those described in the previous section.
488
+
416
489
  ### Table of contents
417
490
 
418
491
  Activating an entry closes an unpinned table of contents, reveals the heading if it is hidden, scrolls to it (instantly under `prefers-reduced-motion: reduce`) and moves the focus to it (adding `tabindex="-1"` when the heading has none), so the next Tab continues from that section. Pass `onHeadingSelect(heading, event)` to take part: return `false` to let the viewer reveal, scroll and focus after your own work (writing the URL hash, say), or `true` when you have handled the navigation yourself.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./chunk-MOJQB5TN-DUk2Jy4_.cjs"),u=require("./chunk-JWPE2WC7-Bz9dXsLZ.cjs"),n=require("./extractHeadings-D1A8WzVy.cjs"),i=require("./cynefin-VYW2F7L2-MpAliYy9.cjs");var p=i.createRailroadAbnfServices().RailroadAbnf.parser.LangiumParser,o=n.__name(e=>{const r=e.alternatives.map(c);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformAlternation"),c=n.__name(e=>{const r=e.elements.map(d);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformConcatenation"),f=n.__name(e=>{if(e.includes("*")){const[t,s]=e.split("*"),l=t?parseInt(t,10):0,m=s?parseInt(s,10):1/0;return{min:l,max:m}}const r=parseInt(e,10);return{min:r,max:r}},"parseRepeat"),d=n.__name(e=>{const r=b(e.primary);if(!e.repeat)return r;const{min:t,max:s}=f(e.repeat);return t===0&&s===1?{type:"optional",element:r}:{type:"repetition",element:r,min:t,max:s}},"transformElement"),b=n.__name(e=>{switch(e.$type){case"AbnfStringLiteral":return{type:"terminal",value:e.value};case"AbnfNumVal":return{type:"terminal",value:e.value};case"AbnfRuleName":return{type:"nonterminal",name:e.name};case"AbnfGroup":return o(e.element);case"AbnfOptionalGroup":return{type:"optional",element:o(e.element)};default:throw new Error(`Unsupported ABNF primary node: ${e.$type}`)}},"transformPrimary"),g=n.__name(e=>({name:e.name,definition:o(e.definition)}),"transformRule"),v=n.__name(e=>{u.populateCommonDb(e,a.db),e.title&&a.db.setTitle(e.title),e.rules.map(r=>a.db.addRule(g(r)))},"populateDb"),y={parse:n.__name(e=>{a.db.clear(),n.log.debug("[ABNF Parser] Starting Langium parse");const r=p.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new i.MermaidParseError(r);const t=r.value;n.log.debug("[ABNF Parser] Parsed rules:",t.rules.length),v(t),n.log.debug("[ABNF Parser] Parse complete")},"parse"),parser:{yy:a.db}},_={parser:y,db:a.db,renderer:a.renderer,styles:a.getStyles};exports.diagram=_;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./chunk-MOJQB5TN-DPs_chEk.cjs"),u=require("./chunk-JWPE2WC7-BGdnK7yg.cjs"),n=require("./extractHeadings-By3kC3b_.cjs"),i=require("./cynefin-VYW2F7L2-MpAliYy9.cjs");var p=i.createRailroadAbnfServices().RailroadAbnf.parser.LangiumParser,o=n.__name(e=>{const r=e.alternatives.map(c);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformAlternation"),c=n.__name(e=>{const r=e.elements.map(d);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformConcatenation"),f=n.__name(e=>{if(e.includes("*")){const[t,s]=e.split("*"),l=t?parseInt(t,10):0,m=s?parseInt(s,10):1/0;return{min:l,max:m}}const r=parseInt(e,10);return{min:r,max:r}},"parseRepeat"),d=n.__name(e=>{const r=b(e.primary);if(!e.repeat)return r;const{min:t,max:s}=f(e.repeat);return t===0&&s===1?{type:"optional",element:r}:{type:"repetition",element:r,min:t,max:s}},"transformElement"),b=n.__name(e=>{switch(e.$type){case"AbnfStringLiteral":return{type:"terminal",value:e.value};case"AbnfNumVal":return{type:"terminal",value:e.value};case"AbnfRuleName":return{type:"nonterminal",name:e.name};case"AbnfGroup":return o(e.element);case"AbnfOptionalGroup":return{type:"optional",element:o(e.element)};default:throw new Error(`Unsupported ABNF primary node: ${e.$type}`)}},"transformPrimary"),g=n.__name(e=>({name:e.name,definition:o(e.definition)}),"transformRule"),v=n.__name(e=>{u.populateCommonDb(e,a.db),e.title&&a.db.setTitle(e.title),e.rules.map(r=>a.db.addRule(g(r)))},"populateDb"),y={parse:n.__name(e=>{a.db.clear(),n.log.debug("[ABNF Parser] Starting Langium parse");const r=p.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new i.MermaidParseError(r);const t=r.value;n.log.debug("[ABNF Parser] Parsed rules:",t.rules.length),v(t),n.log.debug("[ABNF Parser] Parse complete")},"parse"),parser:{yy:a.db}},_={parser:y,db:a.db,renderer:a.renderer,styles:a.getStyles};exports.diagram=_;
@@ -1,6 +1,6 @@
1
- import { g as p, r as u, d as a } from "./chunk-MOJQB5TN-1pZNp2Wl.js";
2
- import { p as f } from "./chunk-JWPE2WC7-Djg6Qi23.js";
3
- import { _ as n, O as o } from "./extractHeadings-CtiYkq2z.js";
1
+ import { g as p, r as u, d as a } from "./chunk-MOJQB5TN-B-H_fDpi.js";
2
+ import { p as f } from "./chunk-JWPE2WC7-njgGfGvE.js";
3
+ import { _ as n, Q as o } from "./extractHeadings-Dz8gnhsx.js";
4
4
  import { M as c, b as d } from "./cynefin-VYW2F7L2-Bkk-F_Js.js";
5
5
  var v = d().RailroadAbnf.parser.LangiumParser, i = /* @__PURE__ */ n((e) => {
6
6
  const r = e.alternatives.map(g);
@@ -1 +1 @@
1
- "use strict";const n=require("./extractHeadings-D1A8WzVy.cjs");function $(o){return o.innerRadius}function b(o){return o.outerRadius}function k(o){return o.startAngle}function _(o){return o.endAngle}function nn(o){return o&&o.padAngle}function en(o,x,D,P,h,v,S,s){var E=D-o,r=P-x,e=S-h,p=s-v,i=p*E-e*r;if(!(i*i<n.epsilon))return i=(e*(x-v)-p*(o-h))/i,[o+i*E,x+i*r]}function M(o,x,D,P,h,v,S){var s=o-D,E=x-P,r=(S?v:-v)/n.sqrt(s*s+E*E),e=r*E,p=-r*s,i=o+e,u=x+p,c=D+e,f=P+p,j=(i+c)/2,l=(u+f)/2,y=c-i,g=f-u,A=y*y+g*g,R=h-v,T=i*f-c*u,H=(g<0?-1:1)*n.sqrt(n.max(0,R*R*A-T*T)),I=(T*g-y*H)/A,O=(-T*y-g*H)/A,q=(T*g+y*H)/A,d=(-T*y+g*H)/A,m=I-j,a=O-l,t=q-j,z=d-l;return m*m+a*a>t*t+z*z&&(I=q,O=d),{cx:I,cy:O,x01:-e,y01:-p,x11:I*(h/R-1),y11:O*(h/R-1)}}function an(){var o=$,x=b,D=n.constant(0),P=null,h=k,v=_,S=nn,s=null,E=n.withPath(r);function r(){var e,p,i=+o.apply(this,arguments),u=+x.apply(this,arguments),c=h.apply(this,arguments)-n.halfPi,f=v.apply(this,arguments)-n.halfPi,j=n.abs(f-c),l=f>c;if(s||(s=e=E()),u<i&&(p=u,u=i,i=p),!(u>n.epsilon))s.moveTo(0,0);else if(j>n.tau-n.epsilon)s.moveTo(u*n.cos(c),u*n.sin(c)),s.arc(0,0,u,c,f,!l),i>n.epsilon&&(s.moveTo(i*n.cos(f),i*n.sin(f)),s.arc(0,0,i,f,c,l));else{var y=c,g=f,A=c,R=f,T=j,H=j,I=S.apply(this,arguments)/2,O=I>n.epsilon&&(P?+P.apply(this,arguments):n.sqrt(i*i+u*u)),q=n.min(n.abs(u-i)/2,+D.apply(this,arguments)),d=q,m=q,a,t;if(O>n.epsilon){var z=n.asin(O/i*n.sin(I)),F=n.asin(O/u*n.sin(I));(T-=z*2)>n.epsilon?(z*=l?1:-1,A+=z,R-=z):(T=0,A=R=(c+f)/2),(H-=F*2)>n.epsilon?(F*=l?1:-1,y+=F,g-=F):(H=0,y=g=(c+f)/2)}var B=u*n.cos(y),C=u*n.sin(y),G=i*n.cos(R),J=i*n.sin(R);if(q>n.epsilon){var K=u*n.cos(g),L=u*n.sin(g),N=i*n.cos(A),Q=i*n.sin(A),w;if(j<n.pi)if(w=en(B,C,N,Q,K,L,G,J)){var U=B-w[0],V=C-w[1],W=K-w[0],X=L-w[1],Y=1/n.sin(n.acos((U*W+V*X)/(n.sqrt(U*U+V*V)*n.sqrt(W*W+X*X)))/2),Z=n.sqrt(w[0]*w[0]+w[1]*w[1]);d=n.min(q,(i-Z)/(Y-1)),m=n.min(q,(u-Z)/(Y+1))}else d=m=0}H>n.epsilon?m>n.epsilon?(a=M(N,Q,B,C,u,m,l),t=M(K,L,G,J,u,m,l),s.moveTo(a.cx+a.x01,a.cy+a.y01),m<q?s.arc(a.cx,a.cy,m,n.atan2(a.y01,a.x01),n.atan2(t.y01,t.x01),!l):(s.arc(a.cx,a.cy,m,n.atan2(a.y01,a.x01),n.atan2(a.y11,a.x11),!l),s.arc(0,0,u,n.atan2(a.cy+a.y11,a.cx+a.x11),n.atan2(t.cy+t.y11,t.cx+t.x11),!l),s.arc(t.cx,t.cy,m,n.atan2(t.y11,t.x11),n.atan2(t.y01,t.x01),!l))):(s.moveTo(B,C),s.arc(0,0,u,y,g,!l)):s.moveTo(B,C),!(i>n.epsilon)||!(T>n.epsilon)?s.lineTo(G,J):d>n.epsilon?(a=M(G,J,K,L,i,-d,l),t=M(B,C,N,Q,i,-d,l),s.lineTo(a.cx+a.x01,a.cy+a.y01),d<q?s.arc(a.cx,a.cy,d,n.atan2(a.y01,a.x01),n.atan2(t.y01,t.x01),!l):(s.arc(a.cx,a.cy,d,n.atan2(a.y01,a.x01),n.atan2(a.y11,a.x11),!l),s.arc(0,0,i,n.atan2(a.cy+a.y11,a.cx+a.x11),n.atan2(t.cy+t.y11,t.cx+t.x11),l),s.arc(t.cx,t.cy,d,n.atan2(t.y11,t.x11),n.atan2(t.y01,t.x01),!l))):s.arc(0,0,i,R,A,l)}if(s.closePath(),e)return s=null,e+""||null}return r.centroid=function(){var e=(+o.apply(this,arguments)+ +x.apply(this,arguments))/2,p=(+h.apply(this,arguments)+ +v.apply(this,arguments))/2-n.pi/2;return[n.cos(p)*e,n.sin(p)*e]},r.innerRadius=function(e){return arguments.length?(o=typeof e=="function"?e:n.constant(+e),r):o},r.outerRadius=function(e){return arguments.length?(x=typeof e=="function"?e:n.constant(+e),r):x},r.cornerRadius=function(e){return arguments.length?(D=typeof e=="function"?e:n.constant(+e),r):D},r.padRadius=function(e){return arguments.length?(P=e==null?null:typeof e=="function"?e:n.constant(+e),r):P},r.startAngle=function(e){return arguments.length?(h=typeof e=="function"?e:n.constant(+e),r):h},r.endAngle=function(e){return arguments.length?(v=typeof e=="function"?e:n.constant(+e),r):v},r.padAngle=function(e){return arguments.length?(S=typeof e=="function"?e:n.constant(+e),r):S},r.context=function(e){return arguments.length?(s=e??null,r):s},r}exports.d3arc=an;
1
+ "use strict";const n=require("./extractHeadings-By3kC3b_.cjs");function $(o){return o.innerRadius}function b(o){return o.outerRadius}function k(o){return o.startAngle}function _(o){return o.endAngle}function nn(o){return o&&o.padAngle}function en(o,x,D,P,h,v,S,s){var E=D-o,r=P-x,e=S-h,p=s-v,i=p*E-e*r;if(!(i*i<n.epsilon))return i=(e*(x-v)-p*(o-h))/i,[o+i*E,x+i*r]}function M(o,x,D,P,h,v,S){var s=o-D,E=x-P,r=(S?v:-v)/n.sqrt(s*s+E*E),e=r*E,p=-r*s,i=o+e,u=x+p,c=D+e,f=P+p,j=(i+c)/2,l=(u+f)/2,y=c-i,g=f-u,A=y*y+g*g,R=h-v,T=i*f-c*u,H=(g<0?-1:1)*n.sqrt(n.max(0,R*R*A-T*T)),I=(T*g-y*H)/A,O=(-T*y-g*H)/A,q=(T*g+y*H)/A,d=(-T*y+g*H)/A,m=I-j,a=O-l,t=q-j,z=d-l;return m*m+a*a>t*t+z*z&&(I=q,O=d),{cx:I,cy:O,x01:-e,y01:-p,x11:I*(h/R-1),y11:O*(h/R-1)}}function an(){var o=$,x=b,D=n.constant(0),P=null,h=k,v=_,S=nn,s=null,E=n.withPath(r);function r(){var e,p,i=+o.apply(this,arguments),u=+x.apply(this,arguments),c=h.apply(this,arguments)-n.halfPi,f=v.apply(this,arguments)-n.halfPi,j=n.abs(f-c),l=f>c;if(s||(s=e=E()),u<i&&(p=u,u=i,i=p),!(u>n.epsilon))s.moveTo(0,0);else if(j>n.tau-n.epsilon)s.moveTo(u*n.cos(c),u*n.sin(c)),s.arc(0,0,u,c,f,!l),i>n.epsilon&&(s.moveTo(i*n.cos(f),i*n.sin(f)),s.arc(0,0,i,f,c,l));else{var y=c,g=f,A=c,R=f,T=j,H=j,I=S.apply(this,arguments)/2,O=I>n.epsilon&&(P?+P.apply(this,arguments):n.sqrt(i*i+u*u)),q=n.min(n.abs(u-i)/2,+D.apply(this,arguments)),d=q,m=q,a,t;if(O>n.epsilon){var z=n.asin(O/i*n.sin(I)),F=n.asin(O/u*n.sin(I));(T-=z*2)>n.epsilon?(z*=l?1:-1,A+=z,R-=z):(T=0,A=R=(c+f)/2),(H-=F*2)>n.epsilon?(F*=l?1:-1,y+=F,g-=F):(H=0,y=g=(c+f)/2)}var B=u*n.cos(y),C=u*n.sin(y),G=i*n.cos(R),J=i*n.sin(R);if(q>n.epsilon){var K=u*n.cos(g),L=u*n.sin(g),N=i*n.cos(A),Q=i*n.sin(A),w;if(j<n.pi)if(w=en(B,C,N,Q,K,L,G,J)){var U=B-w[0],V=C-w[1],W=K-w[0],X=L-w[1],Y=1/n.sin(n.acos((U*W+V*X)/(n.sqrt(U*U+V*V)*n.sqrt(W*W+X*X)))/2),Z=n.sqrt(w[0]*w[0]+w[1]*w[1]);d=n.min(q,(i-Z)/(Y-1)),m=n.min(q,(u-Z)/(Y+1))}else d=m=0}H>n.epsilon?m>n.epsilon?(a=M(N,Q,B,C,u,m,l),t=M(K,L,G,J,u,m,l),s.moveTo(a.cx+a.x01,a.cy+a.y01),m<q?s.arc(a.cx,a.cy,m,n.atan2(a.y01,a.x01),n.atan2(t.y01,t.x01),!l):(s.arc(a.cx,a.cy,m,n.atan2(a.y01,a.x01),n.atan2(a.y11,a.x11),!l),s.arc(0,0,u,n.atan2(a.cy+a.y11,a.cx+a.x11),n.atan2(t.cy+t.y11,t.cx+t.x11),!l),s.arc(t.cx,t.cy,m,n.atan2(t.y11,t.x11),n.atan2(t.y01,t.x01),!l))):(s.moveTo(B,C),s.arc(0,0,u,y,g,!l)):s.moveTo(B,C),!(i>n.epsilon)||!(T>n.epsilon)?s.lineTo(G,J):d>n.epsilon?(a=M(G,J,K,L,i,-d,l),t=M(B,C,N,Q,i,-d,l),s.lineTo(a.cx+a.x01,a.cy+a.y01),d<q?s.arc(a.cx,a.cy,d,n.atan2(a.y01,a.x01),n.atan2(t.y01,t.x01),!l):(s.arc(a.cx,a.cy,d,n.atan2(a.y01,a.x01),n.atan2(a.y11,a.x11),!l),s.arc(0,0,i,n.atan2(a.cy+a.y11,a.cx+a.x11),n.atan2(t.cy+t.y11,t.cx+t.x11),l),s.arc(t.cx,t.cy,d,n.atan2(t.y11,t.x11),n.atan2(t.y01,t.x01),!l))):s.arc(0,0,i,R,A,l)}if(s.closePath(),e)return s=null,e+""||null}return r.centroid=function(){var e=(+o.apply(this,arguments)+ +x.apply(this,arguments))/2,p=(+h.apply(this,arguments)+ +v.apply(this,arguments))/2-n.pi/2;return[n.cos(p)*e,n.sin(p)*e]},r.innerRadius=function(e){return arguments.length?(o=typeof e=="function"?e:n.constant(+e),r):o},r.outerRadius=function(e){return arguments.length?(x=typeof e=="function"?e:n.constant(+e),r):x},r.cornerRadius=function(e){return arguments.length?(D=typeof e=="function"?e:n.constant(+e),r):D},r.padRadius=function(e){return arguments.length?(P=e==null?null:typeof e=="function"?e:n.constant(+e),r):P},r.startAngle=function(e){return arguments.length?(h=typeof e=="function"?e:n.constant(+e),r):h},r.endAngle=function(e){return arguments.length?(v=typeof e=="function"?e:n.constant(+e),r):v},r.padAngle=function(e){return arguments.length?(S=typeof e=="function"?e:n.constant(+e),r):S},r.context=function(e){return arguments.length?(s=e??null,r):s},r}exports.d3arc=an;
@@ -0,0 +1,83 @@
1
+ import { aD as ln, aE as an, aF as y, aG as tn, aH as N, aI as D, aJ as _, aK as un, aL as rn, aM as j, aN as o, aO as J, aP as sn, aQ as on, aR as fn } from "./extractHeadings-Dz8gnhsx.js";
2
+ function cn(l) {
3
+ return l.innerRadius;
4
+ }
5
+ function yn(l) {
6
+ return l.outerRadius;
7
+ }
8
+ function gn(l) {
9
+ return l.startAngle;
10
+ }
11
+ function dn(l) {
12
+ return l.endAngle;
13
+ }
14
+ function mn(l) {
15
+ return l && l.padAngle;
16
+ }
17
+ function pn(l, h, O, E, v, R, K, a) {
18
+ var q = O - l, i = E - h, n = K - v, d = a - R, u = d * q - n * i;
19
+ if (!(u * u < y))
20
+ return u = (n * (h - R) - d * (l - v)) / u, [l + u * q, h + u * i];
21
+ }
22
+ function W(l, h, O, E, v, R, K) {
23
+ var a = l - O, q = h - E, i = (K ? R : -R) / j(a * a + q * q), n = i * q, d = -i * a, u = l + n, s = h + d, f = O + n, c = E + d, L = (u + f) / 2, t = (s + c) / 2, m = f - u, g = c - s, A = m * m + g * g, T = v - R, P = u * c - f * s, F = (g < 0 ? -1 : 1) * j(fn(0, T * T * A - P * P)), G = (P * g - m * F) / A, H = (-P * m - g * F) / A, w = (P * g + m * F) / A, p = (-P * m + g * F) / A, x = G - L, e = H - t, r = w - L, M = p - t;
24
+ return x * x + e * e > r * r + M * M && (G = w, H = p), {
25
+ cx: G,
26
+ cy: H,
27
+ x01: -n,
28
+ y01: -d,
29
+ x11: G * (v / T - 1),
30
+ y11: H * (v / T - 1)
31
+ };
32
+ }
33
+ function hn() {
34
+ var l = cn, h = yn, O = J(0), E = null, v = gn, R = dn, K = mn, a = null, q = ln(i);
35
+ function i() {
36
+ var n, d, u = +l.apply(this, arguments), s = +h.apply(this, arguments), f = v.apply(this, arguments) - an, c = R.apply(this, arguments) - an, L = un(c - f), t = c > f;
37
+ if (a || (a = n = q()), s < u && (d = s, s = u, u = d), !(s > y)) a.moveTo(0, 0);
38
+ else if (L > tn - y)
39
+ a.moveTo(s * N(f), s * D(f)), a.arc(0, 0, s, f, c, !t), u > y && (a.moveTo(u * N(c), u * D(c)), a.arc(0, 0, u, c, f, t));
40
+ else {
41
+ var m = f, g = c, A = f, T = c, P = L, F = L, G = K.apply(this, arguments) / 2, H = G > y && (E ? +E.apply(this, arguments) : j(u * u + s * s)), w = _(un(s - u) / 2, +O.apply(this, arguments)), p = w, x = w, e, r;
42
+ if (H > y) {
43
+ var M = sn(H / u * D(G)), z = sn(H / s * D(G));
44
+ (P -= M * 2) > y ? (M *= t ? 1 : -1, A += M, T -= M) : (P = 0, A = T = (f + c) / 2), (F -= z * 2) > y ? (z *= t ? 1 : -1, m += z, g -= z) : (F = 0, m = g = (f + c) / 2);
45
+ }
46
+ var Q = s * N(m), S = s * D(m), B = u * N(T), C = u * D(T);
47
+ if (w > y) {
48
+ var U = s * N(g), V = s * D(g), X = u * N(A), Y = u * D(A), I;
49
+ if (L < rn)
50
+ if (I = pn(Q, S, X, Y, U, V, B, C)) {
51
+ var Z = Q - I[0], $ = S - I[1], k = U - I[0], b = V - I[1], nn = 1 / D(on((Z * k + $ * b) / (j(Z * Z + $ * $) * j(k * k + b * b))) / 2), en = j(I[0] * I[0] + I[1] * I[1]);
52
+ p = _(w, (u - en) / (nn - 1)), x = _(w, (s - en) / (nn + 1));
53
+ } else
54
+ p = x = 0;
55
+ }
56
+ F > y ? x > y ? (e = W(X, Y, Q, S, s, x, t), r = W(U, V, B, C, s, x, t), a.moveTo(e.cx + e.x01, e.cy + e.y01), x < w ? a.arc(e.cx, e.cy, x, o(e.y01, e.x01), o(r.y01, r.x01), !t) : (a.arc(e.cx, e.cy, x, o(e.y01, e.x01), o(e.y11, e.x11), !t), a.arc(0, 0, s, o(e.cy + e.y11, e.cx + e.x11), o(r.cy + r.y11, r.cx + r.x11), !t), a.arc(r.cx, r.cy, x, o(r.y11, r.x11), o(r.y01, r.x01), !t))) : (a.moveTo(Q, S), a.arc(0, 0, s, m, g, !t)) : a.moveTo(Q, S), !(u > y) || !(P > y) ? a.lineTo(B, C) : p > y ? (e = W(B, C, U, V, u, -p, t), r = W(Q, S, X, Y, u, -p, t), a.lineTo(e.cx + e.x01, e.cy + e.y01), p < w ? a.arc(e.cx, e.cy, p, o(e.y01, e.x01), o(r.y01, r.x01), !t) : (a.arc(e.cx, e.cy, p, o(e.y01, e.x01), o(e.y11, e.x11), !t), a.arc(0, 0, u, o(e.cy + e.y11, e.cx + e.x11), o(r.cy + r.y11, r.cx + r.x11), t), a.arc(r.cx, r.cy, p, o(r.y11, r.x11), o(r.y01, r.x01), !t))) : a.arc(0, 0, u, T, A, t);
57
+ }
58
+ if (a.closePath(), n) return a = null, n + "" || null;
59
+ }
60
+ return i.centroid = function() {
61
+ var n = (+l.apply(this, arguments) + +h.apply(this, arguments)) / 2, d = (+v.apply(this, arguments) + +R.apply(this, arguments)) / 2 - rn / 2;
62
+ return [N(d) * n, D(d) * n];
63
+ }, i.innerRadius = function(n) {
64
+ return arguments.length ? (l = typeof n == "function" ? n : J(+n), i) : l;
65
+ }, i.outerRadius = function(n) {
66
+ return arguments.length ? (h = typeof n == "function" ? n : J(+n), i) : h;
67
+ }, i.cornerRadius = function(n) {
68
+ return arguments.length ? (O = typeof n == "function" ? n : J(+n), i) : O;
69
+ }, i.padRadius = function(n) {
70
+ return arguments.length ? (E = n == null ? null : typeof n == "function" ? n : J(+n), i) : E;
71
+ }, i.startAngle = function(n) {
72
+ return arguments.length ? (v = typeof n == "function" ? n : J(+n), i) : v;
73
+ }, i.endAngle = function(n) {
74
+ return arguments.length ? (R = typeof n == "function" ? n : J(+n), i) : R;
75
+ }, i.padAngle = function(n) {
76
+ return arguments.length ? (K = typeof n == "function" ? n : J(+n), i) : K;
77
+ }, i.context = function(n) {
78
+ return arguments.length ? (a = n ?? null, i) : a;
79
+ }, i;
80
+ }
81
+ export {
82
+ hn as d
83
+ };