@aiquants/markdown 10.0.0 → 11.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (138) hide show
  1. package/README.md +157 -51
  2. package/dist/{abnfDiagram-VRR7QNED-CYA0Qdic.js → abnfDiagram-VRR7QNED-CxQnFjoJ.js} +3 -3
  3. package/dist/{abnfDiagram-VRR7QNED-eurBMDzU.cjs → abnfDiagram-VRR7QNED-npWEsqYc.cjs} +1 -1
  4. package/dist/{arc-BEWKpekE.js → arc-8h1FB6uq.js} +20 -20
  5. package/dist/{arc-DE0KP7Dq.cjs → arc-CUfL06Yf.cjs} +1 -1
  6. package/dist/{architectureDiagram-ZJ3FMSHR-CGhHOaMo.cjs → architectureDiagram-ZJ3FMSHR-B20pDRbn.cjs} +1 -1
  7. package/dist/{architectureDiagram-ZJ3FMSHR-CHGNHywO.js → architectureDiagram-ZJ3FMSHR-B3AN9LVb.js} +2 -2
  8. package/dist/{blockDiagram-677ZJIJ3-BaGVzolE.cjs → blockDiagram-677ZJIJ3-BpyvdB6a.cjs} +1 -1
  9. package/dist/{blockDiagram-677ZJIJ3-DzwYMqTi.js → blockDiagram-677ZJIJ3-Cyl2Lsxi.js} +3 -3
  10. package/dist/{c4Diagram-LMCZKHZV-DN0oBwXJ.js → c4Diagram-LMCZKHZV-B1v06ANz.js} +2 -2
  11. package/dist/{c4Diagram-LMCZKHZV-u10-6vWB.cjs → c4Diagram-LMCZKHZV-C9aMoZww.cjs} +1 -1
  12. package/dist/{channel-DNeAktxT.cjs → channel-BFKA8ne6.cjs} +1 -1
  13. package/dist/{channel-jBqxYlqx.js → channel-DHWInoX5.js} +1 -1
  14. package/dist/{chunk-2Q5K7J3B-D1zCIQMT.cjs → chunk-2Q5K7J3B-CKQJDnvh.cjs} +1 -1
  15. package/dist/{chunk-2Q5K7J3B-CtqZCJKT.js → chunk-2Q5K7J3B-Hkei_N8G.js} +1 -1
  16. package/dist/{chunk-32BRIVSS-Cana8p5k.js → chunk-32BRIVSS-BVjoQVFd.js} +1 -1
  17. package/dist/{chunk-32BRIVSS-DOd1kGZA.cjs → chunk-32BRIVSS-BegSeeKc.cjs} +1 -1
  18. package/dist/{chunk-5VM5RSS4-DVLwboqR.cjs → chunk-5VM5RSS4-BQ9OvvVm.cjs} +1 -1
  19. package/dist/{chunk-5VM5RSS4-CQ1lkhhT.js → chunk-5VM5RSS4-Bwvu3ZQn.js} +1 -1
  20. package/dist/{chunk-EX3LRPZG-yCnsFHxB.cjs → chunk-EX3LRPZG-Bj_q1v7R.cjs} +1 -1
  21. package/dist/{chunk-EX3LRPZG-Cb1jrGLX.js → chunk-EX3LRPZG-Bz5BV4Fn.js} +4 -4
  22. package/dist/{chunk-JWPE2WC7-Bkx-q_31.js → chunk-JWPE2WC7-C01naS5D.js} +1 -1
  23. package/dist/{chunk-JWPE2WC7-BZ9nUeyl.cjs → chunk-JWPE2WC7-CZGO5NQs.cjs} +1 -1
  24. package/dist/{chunk-MOJQB5TN-DDpWrhot.js → chunk-MOJQB5TN-C3Hq75Zv.js} +10 -10
  25. package/dist/{chunk-MOJQB5TN-DF1lwGu5.cjs → chunk-MOJQB5TN-DFFX8TKc.cjs} +1 -1
  26. package/dist/{chunk-PUDLZKDR-BNRDFRXe.cjs → chunk-PUDLZKDR-2MWL0ZoW.cjs} +1 -1
  27. package/dist/{chunk-PUDLZKDR-BTWY1yiQ.js → chunk-PUDLZKDR-Sz0OB5IT.js} +6 -6
  28. package/dist/{chunk-RYQCIY6F-B7L5EllI.js → chunk-RYQCIY6F-CBI5EYhC.js} +12 -12
  29. package/dist/{chunk-RYQCIY6F-B1obSV-6.cjs → chunk-RYQCIY6F-CSDblZx6.cjs} +1 -1
  30. package/dist/{chunk-V7JOEXUC-Bm_JiVZ3.js → chunk-V7JOEXUC-Br5K_lDL.js} +15 -15
  31. package/dist/{chunk-V7JOEXUC-CvWipsVi.cjs → chunk-V7JOEXUC-D3Y19ZhK.cjs} +1 -1
  32. package/dist/{chunk-VR4S4FIN-4KrGYB-C.js → chunk-VR4S4FIN-CQXol07w.js} +3 -3
  33. package/dist/{chunk-VR4S4FIN-hwPR--n9.cjs → chunk-VR4S4FIN-DjxDq6sN.cjs} +1 -1
  34. package/dist/{chunk-XXDRQBXY-BWyzGhER.js → chunk-XXDRQBXY--FT3CTeH.js} +1 -1
  35. package/dist/{chunk-XXDRQBXY-8mWP2-nt.cjs → chunk-XXDRQBXY-DwP8HH5V.cjs} +1 -1
  36. package/dist/{classDiagram-v2-EOCWNBFH-CJsS9hMZ.js → classDiagram-OUVF2IWQ-HKTI1J11.js} +2 -2
  37. package/dist/{classDiagram-OUVF2IWQ-FSF9UhMj.cjs → classDiagram-OUVF2IWQ-WUNGB5FC.cjs} +1 -1
  38. package/dist/{classDiagram-OUVF2IWQ-CJsS9hMZ.js → classDiagram-v2-EOCWNBFH-HKTI1J11.js} +2 -2
  39. package/dist/{classDiagram-v2-EOCWNBFH-FSF9UhMj.cjs → classDiagram-v2-EOCWNBFH-WUNGB5FC.cjs} +1 -1
  40. package/dist/code-blocks-Bax5Xik7.cjs +4 -0
  41. package/dist/code-blocks-bgwDIVp1.js +267 -0
  42. package/dist/code-blocks.cjs +1 -1
  43. package/dist/code-blocks.d.ts +15 -1
  44. package/dist/code-blocks.js +19 -34
  45. package/dist/components/SpreadsheetBlock.d.ts +7 -2
  46. package/dist/components/SpreadsheetToolbar.d.ts +20 -2
  47. package/dist/components/blockKeys.d.ts +14 -0
  48. package/dist/components/controlStyles.d.ts +2 -1
  49. package/dist/components/spreadsheetClipboard.d.ts +1 -1
  50. package/dist/components/spreadsheetLabels.d.ts +13 -0
  51. package/dist/components/spreadsheetModel.d.ts +13 -8
  52. package/dist/components/toolbar.d.ts +25 -0
  53. package/dist/components/viewerLabels.d.ts +5 -2
  54. package/dist/converter.wasm +0 -0
  55. package/dist/{cose-bilkent-JH36ORCC-BcC-Wwam.js → cose-bilkent-JH36ORCC-BYqXiffa.js} +5 -5
  56. package/dist/{cose-bilkent-JH36ORCC-DWibrsnW.cjs → cose-bilkent-JH36ORCC-X2Leg8js.cjs} +1 -1
  57. package/dist/{cynefinDiagram-TSTJHNR4-Cp1h2-e6.cjs → cynefinDiagram-TSTJHNR4-DYAvR3E8.cjs} +1 -1
  58. package/dist/{cynefinDiagram-TSTJHNR4-Cg1ddgeH.js → cynefinDiagram-TSTJHNR4-YATbGDfo.js} +47 -47
  59. package/dist/{dagre-VKFMJZFB-BUh2zhjI.js → dagre-VKFMJZFB-Co2RmhO1.js} +20 -20
  60. package/dist/{dagre-VKFMJZFB-Czh6c6hy.cjs → dagre-VKFMJZFB-yjrP1oXL.cjs} +1 -1
  61. package/dist/{diagram-FQU43EPY-D3B1dqU1.cjs → diagram-FQU43EPY-DVts5oXk.cjs} +1 -1
  62. package/dist/{diagram-FQU43EPY-BtWgv1di.js → diagram-FQU43EPY-DfigqQP9.js} +2 -2
  63. package/dist/{diagram-G47NLZAW-1CaqVF7V.cjs → diagram-G47NLZAW-Cave3JO_.cjs} +1 -1
  64. package/dist/{diagram-G47NLZAW-BzoAXzcD.js → diagram-G47NLZAW-k5OpX3J4.js} +38 -38
  65. package/dist/{diagram-NH7WQ7WH-SP-bC7ec.cjs → diagram-NH7WQ7WH-ByEOvB5o.cjs} +1 -1
  66. package/dist/{diagram-NH7WQ7WH-DHYXjMeR.js → diagram-NH7WQ7WH-DDA_wiMC.js} +20 -20
  67. package/dist/{diagram-OA4YK3LP-GQmeRf1O.cjs → diagram-OA4YK3LP-C85REJhK.cjs} +1 -1
  68. package/dist/{diagram-OA4YK3LP-Dpb_X5Hh.js → diagram-OA4YK3LP-DR63MTHd.js} +58 -58
  69. package/dist/{diagram-WEI45ONY-Dtt-2TEo.cjs → diagram-WEI45ONY-9_82j2nL.cjs} +1 -1
  70. package/dist/{diagram-WEI45ONY-21kWbraV.js → diagram-WEI45ONY-DKy9LVdb.js} +10 -10
  71. package/dist/{ebnfDiagram-CCIWWBDH-yz62J_nS.cjs → ebnfDiagram-CCIWWBDH-CYd0AUSE.cjs} +1 -1
  72. package/dist/{ebnfDiagram-CCIWWBDH-DAA7ae1D.js → ebnfDiagram-CCIWWBDH-Cn6FnIur.js} +5 -5
  73. package/dist/{erDiagram-Q63AITRT-BMkAjnh7.js → erDiagram-Q63AITRT-BF_5IEpU.js} +9 -9
  74. package/dist/{erDiagram-Q63AITRT-D8yJBZGU.cjs → erDiagram-Q63AITRT-CMIoja24.cjs} +1 -1
  75. package/dist/{extractHeadings-BB6ZLvWu.js → extractHeadings-DZi9v6vp.js} +8430 -8099
  76. package/dist/extractHeadings-sSLGzcdt.cjs +315 -0
  77. package/dist/fencedBlockLines.d.ts +36 -0
  78. package/dist/flowDiagram-23GEKE2U-BCDxgNfH.js +7 -0
  79. package/dist/flowDiagram-23GEKE2U-DDbv1eCW.cjs +1 -0
  80. package/dist/{ganttDiagram-NO4QXBWP-BGIvTWCj.js → ganttDiagram-NO4QXBWP-DEnf80Mq.js} +2 -2
  81. package/dist/{ganttDiagram-NO4QXBWP-NrdWH7Dz.cjs → ganttDiagram-NO4QXBWP-Drcm5yEd.cjs} +1 -1
  82. package/dist/{gitGraphDiagram-IHSO6WYX-zLZeezJ0.cjs → gitGraphDiagram-IHSO6WYX-GII6PPu9.cjs} +1 -1
  83. package/dist/{gitGraphDiagram-IHSO6WYX-FeuQFvfT.js → gitGraphDiagram-IHSO6WYX-eyfAn5cz.js} +10 -10
  84. package/dist/index.cjs +1 -1
  85. package/dist/index.client.cjs +1 -1
  86. package/dist/index.client.d.ts +2 -2
  87. package/dist/index.client.js +37 -35
  88. package/dist/index.js +37 -35
  89. package/dist/{infoDiagram-FWYZ7A6U-_dgzOtXg.cjs → infoDiagram-FWYZ7A6U-C2FBPXIG.cjs} +1 -1
  90. package/dist/{infoDiagram-FWYZ7A6U-OSG1m3oM.js → infoDiagram-FWYZ7A6U-DPC7xHqx.js} +1 -1
  91. package/dist/{ishikawaDiagram-FXEZZL3T-DIGB3OT_.cjs → ishikawaDiagram-FXEZZL3T-CJVI_dU0.cjs} +1 -1
  92. package/dist/{ishikawaDiagram-FXEZZL3T-CzWd0QMP.js → ishikawaDiagram-FXEZZL3T-DqNbTlei.js} +25 -25
  93. package/dist/{journeyDiagram-5HDEW3XC-DkxVricX.cjs → journeyDiagram-5HDEW3XC-DiVOEWa6.cjs} +1 -1
  94. package/dist/{journeyDiagram-5HDEW3XC-BE0OaqTn.js → journeyDiagram-5HDEW3XC-DuKx5oFy.js} +4 -4
  95. package/dist/{kanban-definition-HUTT4EX6-XxRDkcBx.cjs → kanban-definition-HUTT4EX6-BklyDLxL.cjs} +1 -1
  96. package/dist/{kanban-definition-HUTT4EX6-BDfhy8eh.js → kanban-definition-HUTT4EX6-DezliCFs.js} +52 -52
  97. package/dist/{linear-O4EBzkc8.js → linear-CdYfVjua.js} +5 -5
  98. package/dist/{linear-cHCVVFP4.cjs → linear-w1JR48Qh.cjs} +1 -1
  99. package/dist/{mindmap-definition-LN4V7U3C-D0hxpmbu.js → mindmap-definition-LN4V7U3C-7q4b7Jdd.js} +16 -16
  100. package/dist/{mindmap-definition-LN4V7U3C-b3-6eyyt.cjs → mindmap-definition-LN4V7U3C-BlvTH7wL.cjs} +1 -1
  101. package/dist/{pegDiagram-2B236MQR-RJV3Czqa.js → pegDiagram-2B236MQR-BPY_9I4m.js} +3 -3
  102. package/dist/{pegDiagram-2B236MQR-BK7uPEAB.cjs → pegDiagram-2B236MQR-DirAhjr9.cjs} +1 -1
  103. package/dist/{pieDiagram-ENE6RG2P-C_36fpnW.cjs → pieDiagram-ENE6RG2P-CLMNCcZD.cjs} +1 -1
  104. package/dist/{pieDiagram-ENE6RG2P-DZfsigd-.js → pieDiagram-ENE6RG2P-L4j2AB7Y.js} +51 -51
  105. package/dist/{quadrantDiagram-ABIIQ3AL-CSp5iqoU.js → quadrantDiagram-ABIIQ3AL-B9uzT4Zl.js} +43 -43
  106. package/dist/{quadrantDiagram-ABIIQ3AL-vgf1WShL.cjs → quadrantDiagram-ABIIQ3AL-lyExQfuw.cjs} +1 -1
  107. package/dist/{railroadDiagram-RFXS5EU6-DAsVQQFP.js → railroadDiagram-RFXS5EU6-BgW-4T7B.js} +7 -7
  108. package/dist/{railroadDiagram-RFXS5EU6-BXR0a-Cu.cjs → railroadDiagram-RFXS5EU6-u2Ztkufm.cjs} +1 -1
  109. package/dist/{requirementDiagram-TGXJPOKE-DwIrkBKf.js → requirementDiagram-TGXJPOKE-BnyCTa79.js} +18 -18
  110. package/dist/{requirementDiagram-TGXJPOKE-CRhfuc9R.cjs → requirementDiagram-TGXJPOKE-Cm9r8e07.cjs} +1 -1
  111. package/dist/{sankeyDiagram-HTMAVEWB-C78HhAJS.js → sankeyDiagram-HTMAVEWB-Cv3KCrBX.js} +1 -1
  112. package/dist/{sankeyDiagram-HTMAVEWB-BMWqqmDK.cjs → sankeyDiagram-HTMAVEWB-KJ5WdXGw.cjs} +1 -1
  113. package/dist/{sequenceDiagram-DBY2YBRQ-CnzaQ_rF.js → sequenceDiagram-DBY2YBRQ-CUa9htwo.js} +3 -3
  114. package/dist/{sequenceDiagram-DBY2YBRQ-Dx5x59tf.cjs → sequenceDiagram-DBY2YBRQ-DYXMeMoq.cjs} +1 -1
  115. package/dist/{sizeCapture-X5ZJPWSS-C_iDBgb-.cjs → sizeCapture-X5ZJPWSS-C4RUlRk2.cjs} +1 -1
  116. package/dist/{sizeCapture-X5ZJPWSS-cE-TP8Rj.js → sizeCapture-X5ZJPWSS-D0cfhTVe.js} +1 -1
  117. package/dist/{stateDiagram-2N3HPSRC-CGTBi2mx.cjs → stateDiagram-2N3HPSRC-C4DOBTHC.cjs} +1 -1
  118. package/dist/{stateDiagram-2N3HPSRC-BCeQQ1y6.js → stateDiagram-2N3HPSRC-CUQCdjYa.js} +10 -10
  119. package/dist/{stateDiagram-v2-6OUMAXLB-CxTcyveK.cjs → stateDiagram-v2-6OUMAXLB-BK27mYqW.cjs} +1 -1
  120. package/dist/{stateDiagram-v2-6OUMAXLB-B_7vWqQA.js → stateDiagram-v2-6OUMAXLB-C1Fb_pKt.js} +2 -2
  121. package/dist/styles/markdown.css +1 -1
  122. package/dist/styles/markdown.standalone.css +1 -1
  123. package/dist/{swimlanes-5IMT3BWC-BGZ4AqRG.js → swimlanes-5IMT3BWC-DUPAete1.js} +313 -313
  124. package/dist/{swimlanes-5IMT3BWC-DoVEQSsm.cjs → swimlanes-5IMT3BWC-DZLnPVID.cjs} +1 -1
  125. package/dist/{swimlanesDiagram-G3AALYLV-D1qctaY1.js → swimlanesDiagram-G3AALYLV-BrpRN3Vb.js} +2 -2
  126. package/dist/{swimlanesDiagram-G3AALYLV-CQG6O6Ws.cjs → swimlanesDiagram-G3AALYLV-CMa-ZboO.cjs} +1 -1
  127. package/dist/{timeline-definition-FHXFAJF6-D7mCctKM.js → timeline-definition-FHXFAJF6-DC2SJZSb.js} +108 -108
  128. package/dist/{timeline-definition-FHXFAJF6-DfJV7kEg.cjs → timeline-definition-FHXFAJF6-wvuHQLus.cjs} +1 -1
  129. package/dist/{vennDiagram-L72KCM5P-JBAs3wKP.cjs → vennDiagram-L72KCM5P-DbIG-wm1.cjs} +1 -1
  130. package/dist/{vennDiagram-L72KCM5P-DpoGG-0p.js → vennDiagram-L72KCM5P-HK22xYss.js} +101 -101
  131. package/dist/{wardleyDiagram-EHGQE667-QdkaDYYo.cjs → wardleyDiagram-EHGQE667-BN2PkxRg.cjs} +1 -1
  132. package/dist/{wardleyDiagram-EHGQE667-Dy-eaRgv.js → wardleyDiagram-EHGQE667-JHC6pqAp.js} +85 -85
  133. package/dist/{xychartDiagram-FW5EYKEG-BRirBzDB.cjs → xychartDiagram-FW5EYKEG-CMRlyJDS.cjs} +1 -1
  134. package/dist/{xychartDiagram-FW5EYKEG-DosIK9IK.js → xychartDiagram-FW5EYKEG-DNLQTD-2.js} +40 -40
  135. package/package.json +10 -10
  136. package/dist/extractHeadings-GvfJwNxO.cjs +0 -314
  137. package/dist/flowDiagram-23GEKE2U-BZcpYPK4.js +0 -7
  138. package/dist/flowDiagram-23GEKE2U-CeCAObAc.cjs +0 -1
package/README.md CHANGED
@@ -230,7 +230,8 @@ const { htmlContent, headings } = await converter.convert(
230
230
 
231
231
  ## Viewer, embeds and links
232
232
 
233
- `MarkdownRenderer` keys every top-level block by its content: a fingerprint of the block's HTML without `data-source-lines`, and its occurrence among equal blocks. When the document around a block changes (a paragraph added above, the lines it came from moved), the block keeps its components, so a highlighted code block, a Mermaid diagram or an embedded frame is not built again; only a block whose content changed is.
233
+ `MarkdownRenderer` keys every top-level block by its content, from the keys of the last committed render: a fingerprint of the block's HTML without `data-source-lines` (a ```` ```spreadsheets ```` block's fingerprint also leaves its table's text out), and the content itself. A block takes the earliest unclaimed key of the same fingerprint and content, then the earliest unclaimed key of its fingerprint (a table whose cells changed), else a new key.
234
+ When the document around a block changes (a paragraph added above, the lines it came from moved), the block keeps its components, so a highlighted code block, a Mermaid diagram, an embedded frame or a table is not built again; only a block whose content changed is, and inserting or deleting one of several equal tables never hands one table's state to another.
234
235
 
235
236
  ### Stylesheets
236
237
 
@@ -511,7 +512,7 @@ Mermaid draws in that element and the component shows the result in the slot, so
511
512
  - **Keyboard**: the frame takes focus (`tabindex="0"`, `role="group"`) and is named by the `diagram` label, which a hidden element carries with its own `lang`, so the drawing's text is not marked with it. On the frame itself, not on a link inside it and not with Ctrl, Meta or Alt held, the arrow keys pan the view by 25.9 % of the frame (only when the view can move; otherwise the page scrolls), `+` and `=` zoom in, `-` zooms out and `0` resets.
512
513
  When an element inside the drawing takes the focus (a node's link, by Tab), the view pans by the least distance that brings the element's box inside the frame, because the clipping frame is no scroll container the browser could scroll to it.
513
514
  - **Pan buttons**: four buttons (`pan-left`, `pan-up`, `pan-down`, `pan-right`) are shown in the toolbar only while the drawing overflows its frame, so panning never needs a drag (WCAG 2.5.7); at fit they keep their slots hidden (`visibility: hidden`: not focusable, not exposed), so zooming never adds a toolbar row or moves the frame; each moves the view by the same step as the arrow keys.
514
- - **Sizes**: under every pointer (a mouse, a pen or a finger) every control is 44 × 44 px and each menu item and the retry button at least 44 px tall (WCAG 2.2 enhanced target size). The toolbar is a wrapping row above the frame, so the controls never cover the drawing, and the menu opens from the button's left edge.
515
+ - **Sizes**: under every pointer (a mouse, a pen or a finger) every control is 44 × 44 px and each menu item and the retry button at least 44 px tall (WCAG 2.2 enhanced target size). The toolbar is a wrapping row above the frame, so the controls never cover the drawing, and the menu opens below its button, aligned to the button's start, or to its end when the start would run past the viewport (`data-aqmd-toolbar-menu`: `start` or `end`).
515
516
  - **Tall diagrams**: under a coarse pointer the frame is at most `calc(100svh - 2 * 2.75rem)` tall, so two 44 px bands of the page stay outside it wherever it sits and a finger can scroll the page past the diagram; the clipped drawing then overflows and pans by finger.
516
517
  - **Touch menu**: under a coarse pointer the menu button is named by `interactionModeTouch` and the menu lists four items, `none`, `zoom`, `pan` and `both`, worded for touch (see [Labels and languages](#labels-and-languages)); the checked item is the touch counterpart of the mode in force (`pan-shift` shows `pan`, `both-shift` shows `both`), and choosing an item sets that mode. Escape closes a menu and returns the focus to its button.
517
518
  - **Colours and focus ring**: the controls, the menu items, the checked item, the error message and the retry button reach 7:1 against their surfaces in both schemes (dark when `.dark` or `[data-theme="dark"]` is on an ancestor). The focus ring of the frame, the toolbar controls and the retry button is a 2 px `#003abc` outline with a white 4 px halo, 9:1 apart, so some part of it stands out on any background (WCAG 2.4.13, 1.4.11); the menu items draw it inset. The ring's rules sit outside every cascade layer, so the controls' `shadow` utility cannot replace the halo.
@@ -536,30 +537,55 @@ Total 200 235
536
537
 
537
538
  | Option | Value | Default | Effect |
538
539
  | --- | --- | --- | --- |
539
- | `header=N` | 0–128 | 0 | The first N rows are frozen at the top and drawn bold on `#f3f4f6` (the cell text keeps 7:1 on it) |
540
+ | `header=N` | 0–128 | 0 | The first N rows are the table's column headers: frozen at the top, their cells `role="columnheader"`, drawn bold on the header-row surface (`--aqsp-header-row-*`, 7:1 for the text) |
540
541
  | `footer=N` | 0–128 | 0 | The last N rows are frozen at the bottom (totals) |
541
542
  | `freeze=N` | 0–128 | 0 | The first N columns are frozen at the start |
542
- | `height=N` | 1–100 | the rows, at most 15 | The rows the block's box shows; a larger value than the table's rows shows the table's rows |
543
+ | `height=N` | 1–100 | the rows, at most 15 | The rows the block's box shows; a larger value than the rows the grid shows (an editable table's spare row included) shows those rows |
543
544
 
544
545
  - **Options are strict**: words are `key=value` separated by white space, each key at most once, each value a decimal integer
545
546
  without a sign or leading zeros. An unknown key, a repeated key, a malformed word or a value out of range shows an error in
546
- place of the table (`role="alert"`, naming the word) and the rest of the document renders. Counts larger than the table
547
- follow the spreadsheet's own rules (everything frozen), so an edit that shrinks the table never turns it into an error.
548
- - **The box**: the block reserves the grid's height before the grid loads — the column-header band, the visible rows and the
549
- horizontal scroll bar (`@aiquants/spreadsheet/view`'s constants and the block's 24 px rows) — and the server render and the
550
- hydrating render show a plain `<table>` of the visible rows there (header rows in `<thead>`), so the page does not shift
551
- when the grid replaces it (a block that mounts after the grid has loaded draws the grid at once) and a reader without JavaScript still sees the data. A failed load keeps the plain table and
552
- shows the error with a retry button.
553
- - **Reading**: in a read-only table (the default) every cell is read-only, but selection, Ctrl+C, scrolling, the zoom
554
- (Alt+wheel, Ctrl+Alt+`=` / `-` / `0` and the toolbar), Excel's Ctrl+Arrow data edges, column resizing and autofit, the
555
- active row and column bands (on by default), URL cells (a cell whose whole text is one http, https, mailto or tel URL links
556
- to it; Ctrl+click or Alt+Enter opens it in a new tab with `noopener,noreferrer`) and the cell and selection announcements
557
- (`B2, 120` / `A1:C3 selected`) all work. Numbers align right and text left by value.
558
- - **Toolbar** (44 × 44 px controls in a wrapping row above the box, the Mermaid toolbar's look): zoom in, zoom out and reset
559
- (the grid's 0.1 detents between 0.25 and 4), the bands toggle (`aria-pressed`), copy the whole table (TSV as `text/plain`
560
- and the interop HTML table, which carries the grid's own payload, as `text/html` — a paste into a grid reads it back
561
- losslessly), save as TSV (no byte order mark; the menu next to it saves with one, for Excel), full screen and the table's
562
- size. A control that cannot act now keeps its focus and slot (`aria-disabled`).
547
+ place of the table (`role="alert"`, naming the word and the ranges) and the rest of the document renders. Counts larger
548
+ than the table follow the spreadsheet's own rules (everything frozen), so an edit that shrinks the table never turns it into
549
+ an error.
550
+ - **Size budget**: a body with more cells (rows times its widest row, counted with `measureTsv` without building the table)
551
+ than the grid's operation budget, `SPREADSHEET_MAX_OPERATION_CELLS` (100,000), shows an error in place of the table
552
+ (`role="alert"`, `data-aqmd-spreadsheet-error="size"`, the `tooLarge` label with the cells and the most) instead of a
553
+ table the grid would refuse to operate on; its text stays in the document, and the grid is not loaded for it.
554
+ - **The box** (`layout="inline"`, the default in a document): the block reserves the grid's height before the grid loads —
555
+ the column-header band and the visible rows, both 24 px and scaled by the zoom, and the horizontal scroll bar
556
+ (`@aiquants/spreadsheet/view`'s constants) — capped at the viewport's height less two 44 px bands, so the page can always
557
+ be scrolled past it. `layout="fill"` lets a host that shows one table in a pane of its own (a file preview) give the
558
+ block the pane's height: the toolbar and the notice keep their own height and the box takes the rest.
559
+ - **The plain table**: the server render and the hydrating render show a plain `<table>` in the box, drawn as the grid
560
+ first shows it, so the page does not shift when the grid replaces it (a block that mounts after the grid has loaded draws
561
+ the grid at once) and a reader without JavaScript still sees the data: the column letters (A to Z, more than the box shows
562
+ at the default 100 px width) above the 64 px band of row numbers (both `aria-hidden`), 24 px rows, the header rows in
563
+ `<thead>` as `th scope="col"`, and the footer rows at the bottom when the table holds more rows than the box shows, painted
564
+ from the same `--aqsp-*` variables as the grid. A failed load keeps the plain table and shows the error with a retry
565
+ button.
566
+ - **Reading**: a read-only table (the default) is the grid's `readOnly` — every cell refuses edits and is announced as
567
+ read-only — while selection, Ctrl+C (the grid's own copy: TSV in Excel's clipboard form and the interop HTML table),
568
+ scrolling, the zoom, Excel's Ctrl+Arrow data edges, column and row sizes, the active row and column bands (on by default),
569
+ URL cells (a cell whose whole text is one http, https, mailto or tel URL links to it; Ctrl+click or Alt+Enter opens it in
570
+ a new tab with `noopener,noreferrer`) and the announcements (`B2, 120`, `A1:C3 selected`, `Column B is 120 px wide`) all
571
+ work. Numbers align right and text left by value. The zoom (Alt+wheel, Ctrl+Alt+`=` / `-` / `0` and the toolbar) steps
572
+ along the grid's geometric ladder, `SPREADSHEET_ZOOM_STEPS`: 2^(k/4) for k from −8 to 8, 25 % to 400 %, four steps to
573
+ double. A column's width and a row's height change by dragging a header's 6 px edge (a double-click fits the column),
574
+ by Alt+Shift+Arrow and Alt+Shift+`=` (fit), or by the toolbar's size controls.
575
+ - **Toolbar** (44 × 44 px controls in a wrapping row above the box, the Mermaid toolbar's look; one tab stop whose controls
576
+ the arrow keys, Home and End walk, the APG toolbar): zoom in, zoom out, the zoom in percent, which returns it to 100 % (the
577
+ control is as wide as the widest percent, 400 %, so the row never shifts as the zoom changes), the bands toggle
578
+ (`aria-pressed`), the size controls, copy the whole table, save as TSV (no byte order mark; the menu next to it saves with
579
+ one, for Excel) and full screen, followed by the table's size. The size control discloses a row of five 44 × 44 px buttons
580
+ under the toolbar that narrow, widen and fit the active column and make the active row shorter or taller, named after
581
+ that column's letter and that row's number — the grid's keyboard size commands for a pointer, so no size needs a drag
582
+ (WCAG 2.5.7); Escape in the row closes it and returns the focus to its control. The copy writes what the grid's own Ctrl+C
583
+ writes: TSV in Excel's clipboard form as `text/plain` (only a cell holding a tab or a line break is quoted, so a
584
+ plain-text target receives the cells as typed) and the interop HTML table, which carries the grid's own payload, as
585
+ `text/html` (a paste into a grid reads it back losslessly); the save writes the TSV the spreadsheet reads back exactly
586
+ (`serializeTsv`). A control that cannot act now keeps its focus and slot (`aria-disabled`). The save menu is an APG menu
587
+ button: ArrowDown and ArrowUp open it, Escape closes it with the focus back on its button, and a press outside or the
588
+ focus entering an element outside closes it.
563
589
  - **Full screen**: the toolbar and the box always sit in one `<dialog>` that stays open in the document (non-modal, named
564
590
  like a group); full screen turns that same dialog modal over the whole window (the top layer, the page behind inert), so
565
591
  the grid keeps its selection, zoom, bands and scroll. Escape or the control leaves full screen and returns the focus to the
@@ -568,40 +594,69 @@ Total 200 235
568
594
  around the document never sees it; an Escape already cancelled or ending an input method composition is left alone, and
569
595
  a close request without a key (Android's back) leaves full screen too, keeping the table in the document. The browser's
570
596
  Fullscreen API is not used, because iPhone Safari offers it to video only.
571
- - **Editing**: pass `spreadsheetEditor` (`SpreadsheetEditor`: `write`, `undo`, `redo`, `subscribe`) to `MarkdownRenderer`
572
- or `MarkdownViewer` and every table with source lines becomes editable, inside list items and quotes too; its root carries
573
- `data-aqmd-spreadsheet-editable`. The grid shows one spare row and one spare column to grow into (no spare row when the
574
- table has a footer). Each transaction (a commit, a paste, a delete, a fill) is one write-back,
597
+ - **Editing**: pass `spreadsheetEditor` (`SpreadsheetEditor`: `write`, `read`, `undo`, `redo`, `subscribe`) to
598
+ `MarkdownRenderer` or `MarkdownViewer` and every table with source lines becomes editable, inside list items and quotes
599
+ too; its root carries `data-aqmd-spreadsheet-editable`. The grid shows one spare row and one spare column to grow into (no
600
+ spare row when the table has a footer). Each transaction (a commit, a paste, a delete, a fill) is one write-back,
575
601
  `write({ fenceLine, expected, text })`: `fenceLine` is the block's opening fence line (the first of its source lines),
576
602
  `expected` the body the table knows and `text` the new body (TSV with line feeds, trailing empty rows and columns removed),
577
603
  both as the converter reads the block, without the markers and indentation its source lines carry inside a list item or a
578
604
  quote or behind an indented fence. The host replaces the body only when the block still reads `expected`, writing each new
579
605
  line with the markers and indentation the block's lines need (the item's indentation, `>`, the fence's indentation), as one
580
- undo step, and answers `true`; otherwise it changes nothing and answers `false`. A TSV table keeps text only: a change of
581
- formatting or links alone is refused (the cells keep their state and a notice says why) and a paste keeps its text. A body
582
- that would put ``` or ~~~ at the start of a line (after up to three spaces) is refused, because it could close the fence.
583
- The grid's Ctrl+Z and Ctrl+Y call `undo` and `redo` (the editor keeps the one history). A body that comes back from the
584
- document is the echo of the block's own write and changes nothing; any other body (typed in the editor, undone) is read
585
- again. `subscribe(listener)` tells the table of every change of the editor's text that is not a write-back (typing, an undo
586
- or a redo — also through `undo` and `redo` —, a text the host replaced), and answers the unsubscription: the table then
587
- drops the writes not seen back and shows the document's body again, because an undo that lands before a write's echo is
588
- drawn leaves the document's body as the table last received it, so no new body would reach the table. The block keeps one
589
- adapter for its life, and its key ignores its body (see [Viewer, embeds and links](#viewer-embeds-and-links)), so a
590
- write-back keeps the selection and the scroll.
591
- - **Languages**: `spreadsheetLocale` (`"en"`, the default, or `"ja"`) picks the language of the block's labels and of the
592
- grid's own chrome; the viewer's `spreadsheet*` labels replace single entries (see [Labels and languages](#labels-and-languages)).
593
- - **Hooks**: `data-aqmd-spreadsheet` (the root, which carries `data-source-lines` and the palette's CSS variables),
594
- `data-aqmd-spreadsheet-dialog`, `data-aqmd-spreadsheet-toolbar`, `data-aqmd-spreadsheet-control` (`zoom-in`, `zoom-out`,
595
- `reset-zoom`, `highlight`, `copy`, `save`, `save-menu`, `fullscreen`), `data-aqmd-spreadsheet-menu`,
596
- `data-aqmd-spreadsheet-size`, `data-aqmd-spreadsheet-box`, `data-aqmd-spreadsheet-static`, `data-aqmd-spreadsheet-notice`,
597
- `data-aqmd-spreadsheet-error` (`options` or `load`), `data-aqmd-spreadsheet-retry`, and the state attributes
598
- `data-aqmd-spreadsheet-editable` and `data-aqmd-spreadsheet-fullscreen` (a host gives the double-click and the keys inside an
599
- editable or full-screen table to the grid).
606
+ undo step, and answers what came of it (`SpreadsheetWriteResult`): `"written"`; `"changed"` — the block no longer reads
607
+ `expected` or no longer opens on the fence line, so nothing was written: the table shows the block as the editor holds it
608
+ now (`read`) and says the change was not saved; `"closesFence"` — a line of the new body would close the block's fence
609
+ (the fence's character, at least as long as the opening run, up to three columns after the containers, then spaces, tabs
610
+ or carriage returns only), so nothing was written and the table says why; `"unwritable"` — the host cannot rewrite the
611
+ block's source lines as they are laid out: the table says so and stays read-only until its body or source lines change.
612
+ After `"written"` the table reads the block back (`read`) and shows the body the converter reads. `read(fenceLine)`
613
+ answers the body of the ```` ```spreadsheets ```` block opening on that line as the converter reads the editor's text
614
+ now, or `null`. `@aiquants/markdown/code-blocks` holds the line rules as the converter applies them (`readFencedLine`,
615
+ `planFencedBodyEdit`; see [Settings without React](#settings-without-react)). A TSV table keeps text only: a change of
616
+ formatting or links alone is refused (the cells keep their state and a notice says why) and a paste keeps its text.
617
+ The grid's Ctrl+Z and Ctrl+Y call `undo` and `redo` (the editor keeps the one history) and then show the block as the
618
+ editor holds it, without waiting for the document to be drawn again. A body that comes back from the document is the echo
619
+ of the block's own write and changes nothing; for any other body an editable table shows the block as the editor holds it
620
+ now (`read`), because a rendering lags the editor (one drawn from a text before an undo or a write may arrive after it):
621
+ the document's body only where the editor holds no such block (the lines moved), and while the editor still holds the
622
+ table's last write the table keeps waiting for its echo.
623
+ `subscribe(listener)` tells the table of every change of the editor's text that is not a write-back (typing, an undo or a
624
+ redo — also through `undo` and `redo` —, a text the host replaced), and answers the unsubscription. While writes wait for
625
+ their echo, the table reads the block on each notice: a body other than its last write (an undo in the editor that landed
626
+ before the echo was drawn, when no new body would reach the table) is shown at once and drops the waiting writes; its last
627
+ write keeps waiting for the echo; no block (the lines moved) waits for the next body the document draws. With no write
628
+ waiting, a notice reads nothing. The block keeps one adapter for its life, and its key ignores its body (see
629
+ [Viewer, embeds and links](#viewer-embeds-and-links)), so a write-back keeps the selection and the scroll.
630
+ - **Languages**: `spreadsheetLocale` (`"en"`, the default, or `"ja"`; any other value is a `RangeError` during render)
631
+ picks the language of the block's labels and of the grid's own chrome; the viewer's `spreadsheet*` labels replace single
632
+ entries (see [Labels and languages](#labels-and-languages)).
633
+ - **Colours**: the stylesheet sets every colour of the grid and of the plain table through the grid's public `--aqsp-*`
634
+ variables on the block's root, for the light scheme (the grid's own defaults) and the dark one (`.dark` or
635
+ `[data-theme="dark"]` on an ancestor): every text keeps 7:1 on every surface it sits on (the selection, the bands and the
636
+ error fill composited in), and every mark that carries meaning keeps 3:1 on its surfaces (the selection border, the note
637
+ and comment markers, the reference and fill-preview outlines, the freeze divider, the popovers' input border — the same
638
+ pairs the grid checks for itself). The toolbar, the menu, the errors and the focus ring use the controls' palette shared
639
+ with Mermaid.
640
+ - **Hooks**: `data-aqmd-spreadsheet` (the root, which carries `data-source-lines` and the palette's CSS variables) with its
641
+ layout `data-aqmd-spreadsheet-layout` (`inline` or `fill`), `data-aqmd-spreadsheet-dialog`, `data-aqmd-spreadsheet-toolbar`,
642
+ `data-aqmd-spreadsheet-control` (`zoom-in`, `zoom-out`, `reset-zoom`, `highlight`, `track-size`, `copy`, `save`,
643
+ `save-menu`, `fullscreen`), `data-aqmd-spreadsheet-zoom` (the percent, with its hidden widest percent
644
+ `data-aqmd-spreadsheet-zoom-widest`), `data-aqmd-spreadsheet-track-size` (the row of size controls) and
645
+ `data-aqmd-spreadsheet-track-size-control` (`decreaseColumnWidth`, `increaseColumnWidth`, `autoFitColumnWidth`,
646
+ `decreaseRowHeight`, `increaseRowHeight`), `data-aqmd-spreadsheet-menu` and `data-aqmd-spreadsheet-menu-item`
647
+ (`save-with-bom`) with the menu's side `data-aqmd-toolbar-menu` (`start` or `end`), `data-aqmd-spreadsheet-size`,
648
+ `data-aqmd-spreadsheet-box`, `data-aqmd-spreadsheet-static` (with `data-aqmd-spreadsheet-static-letters` and
649
+ `data-aqmd-spreadsheet-static-number`), `data-aqmd-spreadsheet-notice`, `data-aqmd-spreadsheet-error` (`options`, `size`
650
+ or `load`), `data-aqmd-spreadsheet-retry`, and the state attributes `data-aqmd-spreadsheet-editable` and
651
+ `data-aqmd-spreadsheet-fullscreen` (a host gives the double-click and the keys inside an editable or full-screen table to
652
+ the grid).
600
653
  - **Known limits**: formulas are not calculated (a cell starting with `=` shows as written); a tap does not start editing (the
601
654
  spreadsheet's rule); a finger swipe that starts over a scrollable table does not scroll the page; Tab moves inside the grid
602
- and Escape leaves it; column widths and the zoom are not saved (a reload, or an edit that changes the row or column count,
603
- resets the widths); printing shows the visible part of the grid only; the grid stays white in the dark scheme; the
604
- clipboard is written only in a secure context (https or localhost).
655
+ and Escape leaves it; column widths, row heights and the zoom are not saved (a reload resets all three; the grid also
656
+ resets the widths when the column count changes and the heights when the row count changes, an edit that adds or removes a
657
+ column or a row included); printing shows the visible part of the grid only; the toolbar's copy uses the asynchronous
658
+ clipboard, which browsers grant only to a secure page (https or localhost) and with their permission (Ctrl+C in the grid
659
+ works anywhere).
605
660
 
606
661
  ### Viewer toolbar
607
662
 
@@ -751,16 +806,67 @@ The Mermaid keys of `MermaidDiagramLabels`, all optional (the viewer's key for e
751
806
  | `diagram` | The diagram's focusable frame | Diagram (arrow keys pan, + and - zoom, 0 resets) | `en` |
752
807
  | `retry` | The retry button after a failed drawing | 再試行 | `ja` |
753
808
 
809
+ The spreadsheet keys of `SpreadsheetBlockLabels`, all optional (the viewer's key for each is `spreadsheet` followed by the
810
+ key with a capital first letter: `zoomIn` is `spreadsheetZoomIn`). A block takes its built-in texts from the catalog its
811
+ locale picks, `SPREADSHEET_BLOCK_LABEL_CATALOGS.en` or `.ja` (each text marked with its own language); a text you pass
812
+ replaces the entry of every locale and is read in your page's language. A text written as a template fills its `{name}`
813
+ placeholders, which `SPREADSHEET_BLOCK_LABEL_PLACEHOLDERS` lists per key; a replacement uses the same names, and a
814
+ placeholder without a value stays as written, so a misspelt one shows rather than vanishing.
815
+
816
+ | Key | Names or says | English (`en`) | Japanese (`ja`) |
817
+ | --- | --- | --- | --- |
818
+ | `table`, `fullscreenDialog` | The block's name, in the document and full screen | Spreadsheet / Spreadsheet (full screen) | 表 / 表 (全画面) |
819
+ | `zoomIn`, `zoomOut` | The zoom buttons | Zoom in / Zoom out | 拡大 / 縮小 |
820
+ | `resetZoom` | The zoom percent's button, which returns it to 100 % (`{percent}`) | {percent} %, reset zoom | {percent} %、拡大率を戻す |
821
+ | `zoomed` | The announcement after the zoom changed (`{percent}`) | Zoom {percent} % | 拡大率 {percent} % |
822
+ | `highlight` | The bands toggle | Highlight the active row and column | 選んだ行と列を強調 |
823
+ | `trackSize` | The size control and the row it opens | Column and row size | 列と行の大きさ |
824
+ | `decreaseColumnWidth`, `increaseColumnWidth`, `autoFitColumnWidth` | The column's size buttons (`{column}`, its letter) | Narrow column {column} / Widen column {column} / Fit column {column} to its contents | 列 {column} を狭める / 列 {column} を広げる / 列 {column} を中身に合わせる |
825
+ | `decreaseRowHeight`, `increaseRowHeight` | The row's size buttons (`{row}`, its number) | Make row {row} shorter / Make row {row} taller | 行 {row} を低くする / 行 {row} を高くする |
826
+ | `columnResized`, `rowResized` | The announcement after a size changed (`{column}` or `{row}`, `{size}` in px) | Column {column} is {size} px wide / Row {row} is {size} px high | 列 {column} の幅は {size} px / 行 {row} の高さは {size} px |
827
+ | `copyAll`, `copied`, `copyFailed` | The copy button and its notices | Copy the whole table / Copied the whole table. / Could not copy the table. Browsers copy only on a secure page (https) and with their permission. | 表全体をコピー / 表全体をコピーしました。 / 表をコピーできませんでした。ブラウザは安全なページ (https) で、許可があるときだけコピーできます。 |
828
+ | `saveTsv`, `saveMenu`, `saveTsvWithBom`, `fileName` | The save button, the menu's button, its item and the file's name | Save as TSV / More ways to save / Save with a BOM (for Excel) / spreadsheet.tsv | TSV として保存 / ほかの保存の方法 / BOM を付けて保存 (Excel 向け) / 表.tsv |
829
+ | `fullscreen`, `exitFullscreen` | The full-screen button, by the way it goes | View full screen / Exit full screen | 全画面で見る / 全画面を閉じる |
830
+ | `size` | The table's size (`{rows}`, `{cols}`) | Rows {rows} × columns {cols} | {rows} 行 × {cols} 列 |
831
+ | `cellAnnouncement`, `readOnlyCellAnnouncement`, `emptyCell` | A cell's announcement (`{cell}` as `B2`, `{value}`) and an empty cell's value | {cell}, {value} / {cell}, {value}, read-only / blank | {cell}、{value} / {cell}、{value}、読み取り専用 / 空白 |
832
+ | `selectionAnnouncement` | A selection's announcement (`{range}` as `A1` or `A1:C3`) | {range} selected | {range} を選択 |
833
+ | `readOnly`, `formatRefused`, `fenceRefused`, `editConflict`, `unwritable` | The notices of a refused edit | Why the edit was not saved, one text per reason | 同じ |
834
+ | `optionsError` | The error of an option that cannot be read (`{word}`, `{frozenMax}`, `{heightMax}`) | The table option “{word}” cannot be read. … | 表の指定「{word}」を読めません。… |
835
+ | `tooLarge` | The error of a table past the budget (`{cells}`, `{max}`) | This table has {cells} cells, more than the {max} a table shows. Its text is still in the document. | この表のセルは {cells} 個で、表が見せられる {max} 個を超えます。表の文字は文書の中にあります。 |
836
+ | `loadFailed`, `retry` | The error of a failed load and its retry button | Could not load the spreadsheet. Check the connection and retry. / Retry | 表を読み込めませんでした。接続を確かめて再試行してください。 / 再試行 |
837
+
754
838
  ### Settings without React
755
839
 
756
840
  `@aiquants/markdown/code-blocks` holds the code-block contract without loading React: `CODE_META_ATTRIBUTE`
757
841
  (`data-code-meta`, the attribute the converter writes on a fenced block's `code` for the info string after the language,
758
- read as text only), `SPREADSHEETS_LANGUAGE`, `parseSpreadsheetOptions` (the one reader of a table's options, a `RangeError`
759
- naming the word for an invalid one) and its limits `DEFAULT_SPREADSHEET_VISIBLE_ROWS` (15), `MAX_SPREADSHEET_VISIBLE_ROWS`
842
+ read as text only), `SPREADSHEETS_LANGUAGE`, `parseSpreadsheetOptions` (the one reader of a table's options; an invalid
843
+ word throws `SpreadsheetOptionsError`, a `RangeError` whose `word` names it), `SPREADSHEET_OPTION_RULES` (each option's
844
+ field, range and value when absent) and the limits `DEFAULT_SPREADSHEET_VISIBLE_ROWS` (15), `MAX_SPREADSHEET_VISIBLE_ROWS`
760
845
  (100) and `MAX_SPREADSHEET_FROZEN_TRACKS` (128). A host's own sanitizer keeps `data-code-meta` on `code` with this name.
846
+ It also holds the table block's label catalogs (`SPREADSHEET_BLOCK_LABEL_CATALOGS`) and the placeholders each label's
847
+ text takes (`SPREADSHEET_BLOCK_LABEL_PLACEHOLDERS`), so a host can derive its own label keys and texts from them.
848
+
849
+ It also holds how the converter reads the source lines of a fenced block inside block quotes and list items, and how to
850
+ write a new body into them — what an editor that takes a table's write-back needs. A host describes the block's
851
+ containers, outermost first (`FencedBlockLayout`: `{ kind: "quote" }` or `{ kind: "listItem", width }`, with the
852
+ opening fence's indentation and run of backticks or tildes), reading each list item's width from its first line
853
+ (`listItemWidthOn`) and the opening fence from its line (`openingFenceOn`, which answers `null` for a line that opens
854
+ no fence after the containers); `fencedCodeLanguageOf` reads the language of an info string as the converter splits it
855
+ (`null` when an escape or a character reference in its first word would need decoding first). `readFencedLine` splits a
856
+ body line into the head its containers take and the content the converter reads (`null` for a line that does not
857
+ continue them), `fencedBodyAsRead` turns a body into the text the converter reads (inside a list item a line of white
858
+ space only reads as empty, `whiteSpaceLinesReadEmpty`), and `planFencedBodyEdit` plans the smallest rewrite: lines the
859
+ old and the new body share at their start and end stay as written, and each new line is written after the head of the
860
+ nearest kept line or, when none is kept, of a replaced line (so `>` without its space or a tab-indented item keeps its
861
+ style), else after `fencedLineHead`. It answers `edit` (the lines to replace and write), `closesFence` (a new line would
862
+ close the fence: the same character, at least as long as the opening run, up to three columns after the containers —
863
+ a tab counted to the next tab stop — and white space only after it) or `unwritable` (a line the rules cannot write so
864
+ that the converter reads it back). The rules are a port of goldmark's line continuation; a line where a tab would be
865
+ split at a container's edge is unreadable (`null`) rather than read another way. The test suite checks them against the
866
+ converter built to WebAssembly, on hundreds of generated layouts and bodies.
761
867
 
762
868
  ```ts
763
- import { CODE_META_ATTRIBUTE, parseSpreadsheetOptions } from "@aiquants/markdown/code-blocks"
869
+ import { CODE_META_ATTRIBUTE, parseSpreadsheetOptions, planFencedBodyEdit } from "@aiquants/markdown/code-blocks"
764
870
  ```
765
871
 
766
872
  `@aiquants/markdown/viewer-settings` exports the built-in document styles and the alignments without loading React, for modules that also run on the server (configuration, validation): `DEFAULT_MARKDOWN_STYLES`, `MarkdownStyleOption`, `ContentAlign`, `CONTENT_ALIGNS`, `DEFAULT_CONTENT_ALIGN` and `toContentAlign`. `@aiquants/markdown` re-exports the same values.
@@ -1,6 +1,6 @@
1
- import { g as p, r as u, d as a } from "./chunk-MOJQB5TN-DDpWrhot.js";
2
- import { p as f } from "./chunk-JWPE2WC7-Bkx-q_31.js";
3
- import { _ as n, U as o } from "./extractHeadings-BB6ZLvWu.js";
1
+ import { g as p, r as u, d as a } from "./chunk-MOJQB5TN-C3Hq75Zv.js";
2
+ import { p as f } from "./chunk-JWPE2WC7-C01naS5D.js";
3
+ import { _ as n, R as o } from "./extractHeadings-DZi9v6vp.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";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./chunk-MOJQB5TN-DF1lwGu5.cjs"),u=require("./chunk-JWPE2WC7-BZ9nUeyl.cjs"),n=require("./extractHeadings-GvfJwNxO.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-DFFX8TKc.cjs"),u=require("./chunk-JWPE2WC7-CZGO5NQs.cjs"),n=require("./extractHeadings-sSLGzcdt.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,4 +1,4 @@
1
- import { aF as ln, aG as an, aH as y, aI as tn, aJ as M, aK as I, aL as _, aM as un, aN as rn, aO as j, aP as o, aQ as H, aR as sn, aS as on, aT as fn } from "./extractHeadings-BB6ZLvWu.js";
1
+ import { aE as ln, aF as an, aG as y, aH as tn, aI as M, aJ as E, aK as _, aL as un, aM as rn, aN as j, aO as o, aP as H, aQ as sn, aR as on, aS as fn } from "./extractHeadings-DZi9v6vp.js";
2
2
  function cn(l) {
3
3
  return l.innerRadius;
4
4
  }
@@ -14,13 +14,13 @@ function dn(l) {
14
14
  function mn(l) {
15
15
  return l && l.padAngle;
16
16
  }
17
- function pn(l, h, q, O, v, R, J, a) {
18
- var D = q - l, i = O - h, n = J - v, d = a - R, u = d * D - n * i;
17
+ function pn(l, h, S, I, v, R, J, a) {
18
+ var q = S - l, i = I - h, n = J - v, d = a - R, u = d * q - n * i;
19
19
  if (!(u * u < y))
20
- return u = (n * (h - R) - d * (l - v)) / u, [l + u * D, h + u * i];
20
+ return u = (n * (h - R) - d * (l - v)) / u, [l + u * q, h + u * i];
21
21
  }
22
- function W(l, h, q, O, v, R, J) {
23
- var a = l - q, D = h - O, i = (J ? R : -R) / j(a * a + D * D), n = i * D, d = -i * a, u = l + n, s = h + d, f = q + n, c = O + d, K = (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, E = (g < 0 ? -1 : 1) * j(fn(0, T * T * A - P * P)), F = (P * g - m * E) / A, G = (-P * m - g * E) / A, w = (P * g + m * E) / A, p = (-P * m + g * E) / A, x = F - K, e = G - t, r = w - K, L = p - t;
22
+ function W(l, h, S, I, v, R, J) {
23
+ var a = l - S, q = h - I, i = (J ? R : -R) / j(a * a + q * q), n = i * q, d = -i * a, u = l + n, s = h + d, f = S + n, c = I + d, K = (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, D = (g < 0 ? -1 : 1) * j(fn(0, T * T * A - P * P)), F = (P * g - m * D) / A, G = (-P * m - g * D) / A, w = (P * g + m * D) / A, p = (-P * m + g * D) / A, x = F - K, e = G - t, r = w - K, L = p - t;
24
24
  return x * x + e * e > r * r + L * L && (F = w, G = p), {
25
25
  cx: F,
26
26
  cy: G,
@@ -31,43 +31,43 @@ function W(l, h, q, O, v, R, J) {
31
31
  };
32
32
  }
33
33
  function hn() {
34
- var l = cn, h = yn, q = H(0), O = null, v = gn, R = dn, J = mn, a = null, D = ln(i);
34
+ var l = cn, h = yn, S = H(0), I = null, v = gn, R = dn, J = mn, a = null, q = ln(i);
35
35
  function i() {
36
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, K = un(c - f), t = c > f;
37
- if (a || (a = n = D()), s < u && (d = s, s = u, u = d), !(s > y)) a.moveTo(0, 0);
37
+ if (a || (a = n = q()), s < u && (d = s, s = u, u = d), !(s > y)) a.moveTo(0, 0);
38
38
  else if (K > tn - y)
39
- a.moveTo(s * M(f), s * I(f)), a.arc(0, 0, s, f, c, !t), u > y && (a.moveTo(u * M(c), u * I(c)), a.arc(0, 0, u, c, f, t));
39
+ a.moveTo(s * M(f), s * E(f)), a.arc(0, 0, s, f, c, !t), u > y && (a.moveTo(u * M(c), u * E(c)), a.arc(0, 0, u, c, f, t));
40
40
  else {
41
- var m = f, g = c, A = f, T = c, P = K, E = K, F = J.apply(this, arguments) / 2, G = F > y && (O ? +O.apply(this, arguments) : j(u * u + s * s)), w = _(un(s - u) / 2, +q.apply(this, arguments)), p = w, x = w, e, r;
41
+ var m = f, g = c, A = f, T = c, P = K, D = K, F = J.apply(this, arguments) / 2, G = F > y && (I ? +I.apply(this, arguments) : j(u * u + s * s)), w = _(un(s - u) / 2, +S.apply(this, arguments)), p = w, x = w, e, r;
42
42
  if (G > y) {
43
- var L = sn(G / u * I(F)), z = sn(G / s * I(F));
44
- (P -= L * 2) > y ? (L *= t ? 1 : -1, A += L, T -= L) : (P = 0, A = T = (f + c) / 2), (E -= z * 2) > y ? (z *= t ? 1 : -1, m += z, g -= z) : (E = 0, m = g = (f + c) / 2);
43
+ var L = sn(G / u * E(F)), z = sn(G / s * E(F));
44
+ (P -= L * 2) > y ? (L *= t ? 1 : -1, A += L, T -= L) : (P = 0, A = T = (f + c) / 2), (D -= z * 2) > y ? (z *= t ? 1 : -1, m += z, g -= z) : (D = 0, m = g = (f + c) / 2);
45
45
  }
46
- var N = s * M(m), Q = s * I(m), B = u * M(T), C = u * I(T);
46
+ var N = s * M(m), Q = s * E(m), B = u * M(T), C = u * E(T);
47
47
  if (w > y) {
48
- var U = s * M(g), V = s * I(g), X = u * M(A), Y = u * I(A), S;
48
+ var U = s * M(g), V = s * E(g), X = u * M(A), Y = u * E(A), O;
49
49
  if (K < rn)
50
- if (S = pn(N, Q, X, Y, U, V, B, C)) {
51
- var Z = N - S[0], $ = Q - S[1], k = U - S[0], b = V - S[1], nn = 1 / I(on((Z * k + $ * b) / (j(Z * Z + $ * $) * j(k * k + b * b))) / 2), en = j(S[0] * S[0] + S[1] * S[1]);
50
+ if (O = pn(N, Q, X, Y, U, V, B, C)) {
51
+ var Z = N - O[0], $ = Q - O[1], k = U - O[0], b = V - O[1], nn = 1 / E(on((Z * k + $ * b) / (j(Z * Z + $ * $) * j(k * k + b * b))) / 2), en = j(O[0] * O[0] + O[1] * O[1]);
52
52
  p = _(w, (u - en) / (nn - 1)), x = _(w, (s - en) / (nn + 1));
53
53
  } else
54
54
  p = x = 0;
55
55
  }
56
- E > y ? x > y ? (e = W(X, Y, N, Q, 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(N, Q), a.arc(0, 0, s, m, g, !t)) : a.moveTo(N, Q), !(u > y) || !(P > y) ? a.lineTo(B, C) : p > y ? (e = W(B, C, U, V, u, -p, t), r = W(N, Q, 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);
56
+ D > y ? x > y ? (e = W(X, Y, N, Q, 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(N, Q), a.arc(0, 0, s, m, g, !t)) : a.moveTo(N, Q), !(u > y) || !(P > y) ? a.lineTo(B, C) : p > y ? (e = W(B, C, U, V, u, -p, t), r = W(N, Q, 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
57
  }
58
58
  if (a.closePath(), n) return a = null, n + "" || null;
59
59
  }
60
60
  return i.centroid = function() {
61
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 [M(d) * n, I(d) * n];
62
+ return [M(d) * n, E(d) * n];
63
63
  }, i.innerRadius = function(n) {
64
64
  return arguments.length ? (l = typeof n == "function" ? n : H(+n), i) : l;
65
65
  }, i.outerRadius = function(n) {
66
66
  return arguments.length ? (h = typeof n == "function" ? n : H(+n), i) : h;
67
67
  }, i.cornerRadius = function(n) {
68
- return arguments.length ? (q = typeof n == "function" ? n : H(+n), i) : q;
68
+ return arguments.length ? (S = typeof n == "function" ? n : H(+n), i) : S;
69
69
  }, i.padRadius = function(n) {
70
- return arguments.length ? (O = n == null ? null : typeof n == "function" ? n : H(+n), i) : O;
70
+ return arguments.length ? (I = n == null ? null : typeof n == "function" ? n : H(+n), i) : I;
71
71
  }, i.startAngle = function(n) {
72
72
  return arguments.length ? (v = typeof n == "function" ? n : H(+n), i) : v;
73
73
  }, i.endAngle = function(n) {
@@ -1 +1 @@
1
- "use strict";const n=require("./extractHeadings-GvfJwNxO.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-sSLGzcdt.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;