@graphrefly/graphrefly 0.45.0 → 0.46.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 (714) hide show
  1. package/README.md +1 -2
  2. package/dist/_internal-B23BagFd.d.cts +33 -0
  3. package/dist/_internal-B23BagFd.d.ts +33 -0
  4. package/dist/adaptive-rate-limiter-Dch_xYIi.d.cts +111 -0
  5. package/dist/adaptive-rate-limiter-Dch_xYIi.d.ts +111 -0
  6. package/dist/agents-C0Ji9ldU.d.cts +629 -0
  7. package/dist/agents-C9zexT7I.d.ts +629 -0
  8. package/dist/audit-BAXb3VOg.d.ts +246 -0
  9. package/dist/audit-C_bPfkqS.d.cts +246 -0
  10. package/dist/backoff-7KIK3WQW.js +24 -0
  11. package/dist/backoff-7KIK3WQW.js.map +1 -0
  12. package/dist/backoff-Bnb9OoPh.d.cts +6 -0
  13. package/dist/backoff-Bnb9OoPh.d.ts +6 -0
  14. package/dist/base/composition/index.cjs +811 -0
  15. package/dist/base/composition/index.cjs.map +1 -0
  16. package/dist/base/composition/index.d.cts +469 -0
  17. package/dist/base/composition/index.d.ts +469 -0
  18. package/dist/base/composition/index.js +40 -0
  19. package/dist/base/composition/index.js.map +1 -0
  20. package/dist/base/index.cjs +6336 -0
  21. package/dist/base/index.cjs.map +1 -0
  22. package/dist/base/index.d.cts +22 -0
  23. package/dist/base/index.d.ts +22 -0
  24. package/dist/base/index.js +259 -0
  25. package/dist/base/index.js.map +1 -0
  26. package/dist/base/io/index.cjs +3270 -0
  27. package/dist/base/io/index.cjs.map +1 -0
  28. package/dist/base/io/index.d.cts +2245 -0
  29. package/dist/base/io/index.d.ts +2245 -0
  30. package/dist/base/io/index.js +117 -0
  31. package/dist/base/io/index.js.map +1 -0
  32. package/dist/base/meta/index.cjs +43 -0
  33. package/dist/base/meta/index.cjs.map +1 -0
  34. package/dist/base/meta/index.d.cts +45 -0
  35. package/dist/base/meta/index.d.ts +45 -0
  36. package/dist/base/meta/index.js +13 -0
  37. package/dist/base/meta/index.js.map +1 -0
  38. package/dist/base/mutation/index.cjs +200 -0
  39. package/dist/base/mutation/index.cjs.map +1 -0
  40. package/dist/base/mutation/index.d.cts +177 -0
  41. package/dist/base/mutation/index.d.ts +177 -0
  42. package/dist/base/mutation/index.js +22 -0
  43. package/dist/base/mutation/index.js.map +1 -0
  44. package/dist/base/render/index.cjs +1120 -0
  45. package/dist/base/render/index.cjs.map +1 -0
  46. package/dist/base/render/index.d.cts +227 -0
  47. package/dist/base/render/index.d.ts +227 -0
  48. package/dist/base/render/index.js +24 -0
  49. package/dist/base/render/index.js.map +1 -0
  50. package/dist/base/sources/browser/index.cjs +172 -0
  51. package/dist/base/sources/browser/index.cjs.map +1 -0
  52. package/dist/base/sources/browser/index.d.cts +84 -0
  53. package/dist/base/sources/browser/index.d.ts +84 -0
  54. package/dist/base/sources/browser/index.js +151 -0
  55. package/dist/base/sources/browser/index.js.map +1 -0
  56. package/dist/base/sources/event/index.cjs +98 -0
  57. package/dist/base/sources/event/index.cjs.map +1 -0
  58. package/dist/base/sources/event/index.d.cts +91 -0
  59. package/dist/base/sources/event/index.d.ts +91 -0
  60. package/dist/base/sources/event/index.js +13 -0
  61. package/dist/base/sources/event/index.js.map +1 -0
  62. package/dist/base/sources/index.cjs +755 -0
  63. package/dist/base/sources/index.cjs.map +1 -0
  64. package/dist/base/sources/index.d.cts +357 -0
  65. package/dist/base/sources/index.d.ts +357 -0
  66. package/dist/base/sources/index.js +42 -0
  67. package/dist/base/sources/index.js.map +1 -0
  68. package/dist/base/sources/node/index.cjs +320 -0
  69. package/dist/base/sources/node/index.cjs.map +1 -0
  70. package/dist/base/sources/node/index.d.cts +185 -0
  71. package/dist/base/sources/node/index.d.ts +185 -0
  72. package/dist/base/sources/node/index.js +306 -0
  73. package/dist/base/sources/node/index.js.map +1 -0
  74. package/dist/base/utils/index.cjs +37 -0
  75. package/dist/base/utils/index.cjs.map +1 -0
  76. package/dist/base/utils/index.d.cts +37 -0
  77. package/dist/base/utils/index.d.ts +37 -0
  78. package/dist/base/utils/index.js +11 -0
  79. package/dist/base/utils/index.js.map +1 -0
  80. package/dist/base/worker/index.cjs +548 -0
  81. package/dist/base/worker/index.cjs.map +1 -0
  82. package/dist/base/worker/index.d.cts +207 -0
  83. package/dist/base/worker/index.d.ts +207 -0
  84. package/dist/base/worker/index.js +20 -0
  85. package/dist/base/worker/index.js.map +1 -0
  86. package/dist/breaker-C9skL3d8.d.ts +175 -0
  87. package/dist/breaker-ugSdq54q.d.cts +175 -0
  88. package/dist/cascading-CSSbKGrJ.d.ts +199 -0
  89. package/dist/cascading-baGkiihI.d.cts +199 -0
  90. package/dist/chunk-255UCBG4.js +58 -0
  91. package/dist/chunk-255UCBG4.js.map +1 -0
  92. package/dist/chunk-2LO3EL4W.js +1 -0
  93. package/dist/chunk-2LO3EL4W.js.map +1 -0
  94. package/dist/chunk-2OB3CEJS.js +1065 -0
  95. package/dist/chunk-2OB3CEJS.js.map +1 -0
  96. package/dist/chunk-36NMM65U.js +144 -0
  97. package/dist/chunk-36NMM65U.js.map +1 -0
  98. package/dist/chunk-3CEXCBN6.js +1 -0
  99. package/dist/chunk-3CEXCBN6.js.map +1 -0
  100. package/dist/chunk-3MUSLI6E.js +105 -0
  101. package/dist/chunk-3MUSLI6E.js.map +1 -0
  102. package/dist/chunk-3PSLNJDU.js +884 -0
  103. package/dist/chunk-3PSLNJDU.js.map +1 -0
  104. package/dist/chunk-3QZY5BI7.js +92 -0
  105. package/dist/chunk-3QZY5BI7.js.map +1 -0
  106. package/dist/chunk-42FQ27MQ.js +594 -0
  107. package/dist/chunk-42FQ27MQ.js.map +1 -0
  108. package/dist/chunk-4GYMCUDZ.js +1085 -0
  109. package/dist/chunk-4GYMCUDZ.js.map +1 -0
  110. package/dist/chunk-4S53H2KR.js +382 -0
  111. package/dist/chunk-4S53H2KR.js.map +1 -0
  112. package/dist/chunk-4XCHZRUJ.js +128 -0
  113. package/dist/chunk-4XCHZRUJ.js.map +1 -0
  114. package/dist/chunk-5THCXDWY.js +725 -0
  115. package/dist/chunk-5THCXDWY.js.map +1 -0
  116. package/dist/chunk-6XZYT4SW.js +256 -0
  117. package/dist/chunk-6XZYT4SW.js.map +1 -0
  118. package/dist/chunk-7EGRP2VX.js +76 -0
  119. package/dist/chunk-7EGRP2VX.js.map +1 -0
  120. package/dist/chunk-A7KV5UK4.js +150 -0
  121. package/dist/chunk-A7KV5UK4.js.map +1 -0
  122. package/dist/chunk-APY2SS5X.js +156 -0
  123. package/dist/chunk-APY2SS5X.js.map +1 -0
  124. package/dist/chunk-AZDQPQ3V.js +66 -0
  125. package/dist/chunk-AZDQPQ3V.js.map +1 -0
  126. package/dist/chunk-BU3SEFA5.js +90 -0
  127. package/dist/chunk-BU3SEFA5.js.map +1 -0
  128. package/dist/chunk-BXGZFGZ4.js +189 -0
  129. package/dist/chunk-BXGZFGZ4.js.map +1 -0
  130. package/dist/chunk-CGHORL6G.js +579 -0
  131. package/dist/chunk-CGHORL6G.js.map +1 -0
  132. package/dist/chunk-CXANAIZU.js +530 -0
  133. package/dist/chunk-CXANAIZU.js.map +1 -0
  134. package/dist/chunk-CZQHCKKG.js +1 -0
  135. package/dist/chunk-CZQHCKKG.js.map +1 -0
  136. package/dist/chunk-DKNHAICT.js +133 -0
  137. package/dist/chunk-DKNHAICT.js.map +1 -0
  138. package/dist/chunk-DM4OMPWK.js +584 -0
  139. package/dist/chunk-DM4OMPWK.js.map +1 -0
  140. package/dist/chunk-DMSNO6ZB.js +452 -0
  141. package/dist/chunk-DMSNO6ZB.js.map +1 -0
  142. package/dist/chunk-E5OZPDIW.js +229 -0
  143. package/dist/chunk-E5OZPDIW.js.map +1 -0
  144. package/dist/chunk-EVYY4X5A.js +509 -0
  145. package/dist/chunk-EVYY4X5A.js.map +1 -0
  146. package/dist/chunk-FDFD67UO.js +1 -0
  147. package/dist/chunk-FDFD67UO.js.map +1 -0
  148. package/dist/chunk-FMPF42Q4.js +13 -0
  149. package/dist/chunk-FMPF42Q4.js.map +1 -0
  150. package/dist/chunk-FR6RGA3B.js +1277 -0
  151. package/dist/chunk-FR6RGA3B.js.map +1 -0
  152. package/dist/chunk-FW23JYNQ.js +454 -0
  153. package/dist/chunk-FW23JYNQ.js.map +1 -0
  154. package/dist/chunk-GBCENOLN.js +1575 -0
  155. package/dist/chunk-GBCENOLN.js.map +1 -0
  156. package/dist/chunk-HL7HUJIX.js +1 -0
  157. package/dist/chunk-HL7HUJIX.js.map +1 -0
  158. package/dist/chunk-HULCUY35.js +2508 -0
  159. package/dist/chunk-HULCUY35.js.map +1 -0
  160. package/dist/chunk-IHTWQEDR.js +169 -0
  161. package/dist/chunk-IHTWQEDR.js.map +1 -0
  162. package/dist/chunk-IJRR6YAI.js +128 -0
  163. package/dist/chunk-IJRR6YAI.js.map +1 -0
  164. package/dist/chunk-JGFRAFDL.js +221 -0
  165. package/dist/chunk-JGFRAFDL.js.map +1 -0
  166. package/dist/chunk-KIIXR252.js +211 -0
  167. package/dist/chunk-KIIXR252.js.map +1 -0
  168. package/dist/chunk-KN3H5CNT.js +11 -0
  169. package/dist/chunk-KN3H5CNT.js.map +1 -0
  170. package/dist/chunk-KPG3DGLA.js +1 -0
  171. package/dist/chunk-KPG3DGLA.js.map +1 -0
  172. package/dist/chunk-KRNQ6RGQ.js +1 -0
  173. package/dist/chunk-KRNQ6RGQ.js.map +1 -0
  174. package/dist/chunk-LBAJK24K.js +1071 -0
  175. package/dist/chunk-LBAJK24K.js.map +1 -0
  176. package/dist/chunk-MLTPJMH6.js +417 -0
  177. package/dist/chunk-MLTPJMH6.js.map +1 -0
  178. package/dist/chunk-N3SZ7BMH.js +95 -0
  179. package/dist/chunk-N3SZ7BMH.js.map +1 -0
  180. package/dist/chunk-NDUD3IMO.js +540 -0
  181. package/dist/chunk-NDUD3IMO.js.map +1 -0
  182. package/dist/chunk-NY2PYHNC.js +873 -0
  183. package/dist/chunk-NY2PYHNC.js.map +1 -0
  184. package/dist/chunk-O3MT7DYI.js +225 -0
  185. package/dist/chunk-O3MT7DYI.js.map +1 -0
  186. package/dist/chunk-OCUDSN63.js +2386 -0
  187. package/dist/chunk-OCUDSN63.js.map +1 -0
  188. package/dist/chunk-OIWU3NYV.js +199 -0
  189. package/dist/chunk-OIWU3NYV.js.map +1 -0
  190. package/dist/chunk-OO5BM6CJ.js +1153 -0
  191. package/dist/chunk-OO5BM6CJ.js.map +1 -0
  192. package/dist/chunk-OQUIJT7A.js +1 -0
  193. package/dist/chunk-OQUIJT7A.js.map +1 -0
  194. package/dist/chunk-P5LBT622.js +105 -0
  195. package/dist/chunk-P5LBT622.js.map +1 -0
  196. package/dist/chunk-PKGQG5QQ.js +519 -0
  197. package/dist/chunk-PKGQG5QQ.js.map +1 -0
  198. package/dist/chunk-PKPO3JTZ.js +561 -0
  199. package/dist/chunk-PKPO3JTZ.js.map +1 -0
  200. package/dist/chunk-PL5UDIQ5.js +118 -0
  201. package/dist/chunk-PL5UDIQ5.js.map +1 -0
  202. package/dist/chunk-PZWISPIQ.js +432 -0
  203. package/dist/chunk-PZWISPIQ.js.map +1 -0
  204. package/dist/chunk-Q3EYOCZB.js +510 -0
  205. package/dist/chunk-Q3EYOCZB.js.map +1 -0
  206. package/dist/chunk-QMBYUVRL.js +15 -0
  207. package/dist/chunk-QMBYUVRL.js.map +1 -0
  208. package/dist/chunk-RAGGHLCV.js +200 -0
  209. package/dist/chunk-RAGGHLCV.js.map +1 -0
  210. package/dist/chunk-RGL53X5G.js +574 -0
  211. package/dist/chunk-RGL53X5G.js.map +1 -0
  212. package/dist/chunk-RJOG4IJU.js +1039 -0
  213. package/dist/chunk-RJOG4IJU.js.map +1 -0
  214. package/dist/chunk-SOOKUYVM.js +403 -0
  215. package/dist/chunk-SOOKUYVM.js.map +1 -0
  216. package/dist/chunk-T5BN5KG7.js +1 -0
  217. package/dist/chunk-T5BN5KG7.js.map +1 -0
  218. package/dist/chunk-TP7244Y6.js +207 -0
  219. package/dist/chunk-TP7244Y6.js.map +1 -0
  220. package/dist/chunk-TSBFTJKM.js +57 -0
  221. package/dist/chunk-TSBFTJKM.js.map +1 -0
  222. package/dist/chunk-URQ2CBBF.js +143 -0
  223. package/dist/chunk-URQ2CBBF.js.map +1 -0
  224. package/dist/chunk-W2BOPXTI.js +1 -0
  225. package/dist/chunk-W2BOPXTI.js.map +1 -0
  226. package/dist/chunk-WKSWLSCX.js +207 -0
  227. package/dist/chunk-WKSWLSCX.js.map +1 -0
  228. package/dist/chunk-Y52CS6YA.js +88 -0
  229. package/dist/chunk-Y52CS6YA.js.map +1 -0
  230. package/dist/chunk-YCBUWK77.js +92 -0
  231. package/dist/chunk-YCBUWK77.js.map +1 -0
  232. package/dist/chunk-YJ4U2D2C.js +314 -0
  233. package/dist/chunk-YJ4U2D2C.js.map +1 -0
  234. package/dist/chunk-Z4YXAUDN.js +239 -0
  235. package/dist/chunk-Z4YXAUDN.js.map +1 -0
  236. package/dist/chunk-Z6EGP5D7.js +92 -0
  237. package/dist/chunk-Z6EGP5D7.js.map +1 -0
  238. package/dist/compat/index.cjs +3083 -2
  239. package/dist/compat/index.cjs.map +1 -1
  240. package/dist/compat/index.d.cts +116 -1
  241. package/dist/compat/index.d.ts +116 -1
  242. package/dist/compat/index.js +175 -2
  243. package/dist/compat/index.js.map +1 -1
  244. package/dist/compat/jotai/index.cjs +130 -2
  245. package/dist/compat/jotai/index.cjs.map +1 -1
  246. package/dist/compat/jotai/index.d.cts +2 -1
  247. package/dist/compat/jotai/index.d.ts +2 -1
  248. package/dist/compat/jotai/index.js +7 -2
  249. package/dist/compat/jotai/index.js.map +1 -1
  250. package/dist/compat/nanostores/index.cjs +186 -2
  251. package/dist/compat/nanostores/index.cjs.map +1 -1
  252. package/dist/compat/nanostores/index.d.cts +2 -1
  253. package/dist/compat/nanostores/index.d.ts +2 -1
  254. package/dist/compat/nanostores/index.js +21 -2
  255. package/dist/compat/nanostores/index.js.map +1 -1
  256. package/dist/compat/nestjs/index.cjs +2224 -2
  257. package/dist/compat/nestjs/index.cjs.map +1 -1
  258. package/dist/compat/nestjs/index.d.cts +10 -1
  259. package/dist/compat/nestjs/index.d.ts +10 -1
  260. package/dist/compat/nestjs/index.js +77 -2
  261. package/dist/compat/nestjs/index.js.map +1 -1
  262. package/dist/compat/react/index.cjs +95 -2
  263. package/dist/compat/react/index.cjs.map +1 -1
  264. package/dist/compat/react/index.d.cts +2 -1
  265. package/dist/compat/react/index.d.ts +2 -1
  266. package/dist/compat/react/index.js +11 -2
  267. package/dist/compat/react/index.js.map +1 -1
  268. package/dist/compat/solid/index.cjs +82 -2
  269. package/dist/compat/solid/index.cjs.map +1 -1
  270. package/dist/compat/solid/index.d.cts +2 -1
  271. package/dist/compat/solid/index.d.ts +2 -1
  272. package/dist/compat/solid/index.js +11 -2
  273. package/dist/compat/solid/index.js.map +1 -1
  274. package/dist/compat/svelte/index.cjs +85 -2
  275. package/dist/compat/svelte/index.cjs.map +1 -1
  276. package/dist/compat/svelte/index.d.cts +2 -1
  277. package/dist/compat/svelte/index.d.ts +2 -1
  278. package/dist/compat/svelte/index.js +11 -2
  279. package/dist/compat/svelte/index.js.map +1 -1
  280. package/dist/compat/vue/index.cjs +100 -2
  281. package/dist/compat/vue/index.cjs.map +1 -1
  282. package/dist/compat/vue/index.d.cts +3 -1
  283. package/dist/compat/vue/index.d.ts +3 -1
  284. package/dist/compat/vue/index.js +11 -2
  285. package/dist/compat/vue/index.js.map +1 -1
  286. package/dist/compat/zustand/index.cjs +50 -2
  287. package/dist/compat/zustand/index.cjs.map +1 -1
  288. package/dist/compat/zustand/index.d.cts +2 -1
  289. package/dist/compat/zustand/index.d.ts +2 -1
  290. package/dist/compat/zustand/index.js +7 -2
  291. package/dist/compat/zustand/index.js.map +1 -1
  292. package/dist/distill-De6Rnn15.d.cts +48 -0
  293. package/dist/distill-De6Rnn15.d.ts +48 -0
  294. package/dist/external-register-CWyroXb_.d.cts +138 -0
  295. package/dist/external-register-CWyroXb_.d.ts +138 -0
  296. package/dist/fallback-Bx46zqky.d.cts +243 -0
  297. package/dist/fallback-pIWW8A2d.d.ts +243 -0
  298. package/dist/guarded-execution-BcdtxeBk.d.ts +207 -0
  299. package/dist/guarded-execution-C-3hnP6A.d.cts +207 -0
  300. package/dist/index-5SU_O78r.d.cts +754 -0
  301. package/dist/index-B6pxYJzO.d.cts +36 -0
  302. package/dist/index-B6pxYJzO.d.ts +36 -0
  303. package/dist/index-BFsng6v1.d.cts +44 -0
  304. package/dist/index-BFsng6v1.d.ts +44 -0
  305. package/dist/index-Bg-LwEt-.d.cts +45 -0
  306. package/dist/index-Bg-LwEt-.d.ts +45 -0
  307. package/dist/index-Brp888t0.d.cts +127 -0
  308. package/dist/index-Brp888t0.d.ts +127 -0
  309. package/dist/index-CDfk6jHN.d.cts +37 -0
  310. package/dist/index-CDfk6jHN.d.ts +37 -0
  311. package/dist/index-CEXCtYYJ.d.ts +754 -0
  312. package/dist/index-DLAxYaN5.d.cts +169 -0
  313. package/dist/index-DLAxYaN5.d.ts +169 -0
  314. package/dist/index-DeWbQzMe.d.cts +34 -0
  315. package/dist/index-DeWbQzMe.d.ts +34 -0
  316. package/dist/index-dX9IzPqj.d.cts +86 -0
  317. package/dist/index-dX9IzPqj.d.ts +86 -0
  318. package/dist/index.cjs +25950 -0
  319. package/dist/index.cjs.map +1 -1
  320. package/dist/index.d.cts +56 -42
  321. package/dist/index.d.ts +56 -42
  322. package/dist/index.js +849 -0
  323. package/dist/index.js.map +1 -1
  324. package/dist/layout-types-B5aiHYgk.d.cts +72 -0
  325. package/dist/layout-types-B5aiHYgk.d.ts +72 -0
  326. package/dist/memory-composers-BryDrRBX.d.cts +529 -0
  327. package/dist/memory-composers-CVQqPYEV.d.ts +529 -0
  328. package/dist/observable-BXQoW1P-.d.cts +36 -0
  329. package/dist/observable-BXQoW1P-.d.ts +36 -0
  330. package/dist/pipeline-graph-Ce47CB6Y.d.cts +145 -0
  331. package/dist/pipeline-graph-DXCwY9vG.d.ts +145 -0
  332. package/dist/presets/ai/index.cjs +4377 -0
  333. package/dist/presets/ai/index.cjs.map +1 -0
  334. package/dist/presets/ai/index.d.cts +98 -0
  335. package/dist/presets/ai/index.d.ts +98 -0
  336. package/dist/presets/ai/index.js +54 -0
  337. package/dist/presets/ai/index.js.map +1 -0
  338. package/dist/presets/harness/index.cjs +5929 -0
  339. package/dist/presets/harness/index.cjs.map +1 -0
  340. package/dist/presets/harness/index.d.cts +566 -0
  341. package/dist/presets/harness/index.d.ts +566 -0
  342. package/dist/presets/harness/index.js +71 -0
  343. package/dist/presets/harness/index.js.map +1 -0
  344. package/dist/presets/index.cjs +9782 -0
  345. package/dist/presets/index.cjs.map +1 -0
  346. package/dist/presets/index.d.cts +28 -0
  347. package/dist/presets/index.d.ts +28 -0
  348. package/dist/presets/index.js +129 -0
  349. package/dist/presets/index.js.map +1 -0
  350. package/dist/presets/inspect/index.cjs +1087 -0
  351. package/dist/presets/inspect/index.cjs.map +1 -0
  352. package/dist/presets/inspect/index.d.cts +172 -0
  353. package/dist/presets/inspect/index.d.ts +172 -0
  354. package/dist/presets/inspect/index.js +21 -0
  355. package/dist/presets/inspect/index.js.map +1 -0
  356. package/dist/presets/resilience/index.cjs +1593 -0
  357. package/dist/presets/resilience/index.cjs.map +1 -0
  358. package/dist/presets/resilience/index.d.cts +205 -0
  359. package/dist/presets/resilience/index.d.ts +205 -0
  360. package/dist/presets/resilience/index.js +18 -0
  361. package/dist/presets/resilience/index.js.map +1 -0
  362. package/dist/rate-limiter-CEALq4N1.d.ts +559 -0
  363. package/dist/rate-limiter-DpVbSYdH.d.cts +559 -0
  364. package/dist/reactive-layout-fswlBUvX.d.cts +195 -0
  365. package/dist/reactive-layout-fswlBUvX.d.ts +195 -0
  366. package/dist/retry-BDbRZ_gx.d.ts +125 -0
  367. package/dist/retry-DWuhjvsA.d.cts +125 -0
  368. package/dist/solutions/index.cjs +8200 -0
  369. package/dist/solutions/index.cjs.map +1 -0
  370. package/dist/solutions/index.d.cts +23 -0
  371. package/dist/solutions/index.d.ts +23 -0
  372. package/dist/solutions/index.js +55 -0
  373. package/dist/solutions/index.js.map +1 -0
  374. package/dist/spawnable-5mDY501F.d.cts +746 -0
  375. package/dist/spawnable-D3lR0oQu.d.ts +746 -0
  376. package/dist/status-U-rUI79b.d.cts +84 -0
  377. package/dist/status-U-rUI79b.d.ts +84 -0
  378. package/dist/timeout-U5O4ESK3.js +12 -0
  379. package/dist/timeout-U5O4ESK3.js.map +1 -0
  380. package/dist/types-BB5Lw-pB.d.cts +442 -0
  381. package/dist/types-BB5Lw-pB.d.ts +442 -0
  382. package/dist/types-CJWIMJiZ.d.ts +548 -0
  383. package/dist/types-vCq7ShIm.d.cts +548 -0
  384. package/dist/utils/ai/browser.cjs +2169 -0
  385. package/dist/utils/ai/browser.cjs.map +1 -0
  386. package/dist/utils/ai/browser.d.cts +129 -0
  387. package/dist/utils/ai/browser.d.ts +129 -0
  388. package/dist/utils/ai/browser.js +255 -0
  389. package/dist/utils/ai/browser.js.map +1 -0
  390. package/dist/utils/ai/index.cjs +8468 -0
  391. package/dist/utils/ai/index.cjs.map +1 -0
  392. package/dist/utils/ai/index.d.cts +1777 -0
  393. package/dist/utils/ai/index.d.ts +1777 -0
  394. package/dist/utils/ai/index.js +173 -0
  395. package/dist/utils/ai/index.js.map +1 -0
  396. package/dist/utils/ai/node.cjs +648 -0
  397. package/dist/utils/ai/node.cjs.map +1 -0
  398. package/dist/utils/ai/node.d.cts +57 -0
  399. package/dist/utils/ai/node.d.ts +57 -0
  400. package/dist/utils/ai/node.js +84 -0
  401. package/dist/utils/ai/node.js.map +1 -0
  402. package/dist/utils/cqrs/index.cjs +1036 -0
  403. package/dist/utils/cqrs/index.cjs.map +1 -0
  404. package/dist/utils/cqrs/index.d.cts +438 -0
  405. package/dist/utils/cqrs/index.d.ts +438 -0
  406. package/dist/utils/cqrs/index.js +18 -0
  407. package/dist/utils/cqrs/index.js.map +1 -0
  408. package/dist/utils/demo-shell/index.cjs +865 -0
  409. package/dist/utils/demo-shell/index.cjs.map +1 -0
  410. package/dist/utils/demo-shell/index.d.cts +90 -0
  411. package/dist/utils/demo-shell/index.d.ts +90 -0
  412. package/dist/utils/demo-shell/index.js +13 -0
  413. package/dist/utils/demo-shell/index.js.map +1 -0
  414. package/dist/utils/domain-templates/index.cjs +732 -0
  415. package/dist/utils/domain-templates/index.cjs.map +1 -0
  416. package/dist/utils/domain-templates/index.d.cts +214 -0
  417. package/dist/utils/domain-templates/index.d.ts +214 -0
  418. package/dist/utils/domain-templates/index.js +17 -0
  419. package/dist/utils/domain-templates/index.js.map +1 -0
  420. package/dist/utils/graphspec/index.cjs +1174 -0
  421. package/dist/utils/graphspec/index.cjs.map +1 -0
  422. package/dist/utils/graphspec/index.d.cts +449 -0
  423. package/dist/utils/graphspec/index.d.ts +449 -0
  424. package/dist/utils/graphspec/index.js +35 -0
  425. package/dist/utils/graphspec/index.js.map +1 -0
  426. package/dist/utils/harness/index.cjs +656 -0
  427. package/dist/utils/harness/index.cjs.map +1 -0
  428. package/dist/utils/harness/index.d.cts +542 -0
  429. package/dist/utils/harness/index.d.ts +542 -0
  430. package/dist/utils/harness/index.js +56 -0
  431. package/dist/utils/harness/index.js.map +1 -0
  432. package/dist/utils/index.cjs +17609 -0
  433. package/dist/utils/index.cjs.map +1 -0
  434. package/dist/utils/index.d.cts +96 -0
  435. package/dist/utils/index.d.ts +96 -0
  436. package/dist/utils/index.js +514 -0
  437. package/dist/utils/index.js.map +1 -0
  438. package/dist/utils/inspect/index.cjs +807 -0
  439. package/dist/utils/inspect/index.cjs.map +1 -0
  440. package/dist/utils/inspect/index.d.cts +123 -0
  441. package/dist/utils/inspect/index.d.ts +123 -0
  442. package/dist/utils/inspect/index.js +30 -0
  443. package/dist/utils/inspect/index.js.map +1 -0
  444. package/dist/utils/job-queue/index.cjs +717 -0
  445. package/dist/utils/job-queue/index.cjs.map +1 -0
  446. package/dist/utils/job-queue/index.d.cts +200 -0
  447. package/dist/utils/job-queue/index.d.ts +200 -0
  448. package/dist/utils/job-queue/index.js +18 -0
  449. package/dist/utils/job-queue/index.js.map +1 -0
  450. package/dist/utils/memory/index.cjs +1451 -0
  451. package/dist/utils/memory/index.cjs.map +1 -0
  452. package/dist/utils/memory/index.d.cts +582 -0
  453. package/dist/utils/memory/index.d.ts +582 -0
  454. package/dist/utils/memory/index.js +19 -0
  455. package/dist/utils/memory/index.js.map +1 -0
  456. package/dist/utils/messaging/index.cjs +666 -0
  457. package/dist/utils/messaging/index.cjs.map +1 -0
  458. package/dist/utils/messaging/index.d.cts +562 -0
  459. package/dist/utils/messaging/index.d.ts +562 -0
  460. package/dist/utils/messaging/index.js +50 -0
  461. package/dist/utils/messaging/index.js.map +1 -0
  462. package/dist/utils/orchestration/index.cjs +876 -0
  463. package/dist/utils/orchestration/index.cjs.map +1 -0
  464. package/dist/utils/orchestration/index.d.cts +233 -0
  465. package/dist/utils/orchestration/index.d.ts +233 -0
  466. package/dist/utils/orchestration/index.js +19 -0
  467. package/dist/utils/orchestration/index.js.map +1 -0
  468. package/dist/utils/process/index.cjs +743 -0
  469. package/dist/utils/process/index.cjs.map +1 -0
  470. package/dist/utils/process/index.d.cts +411 -0
  471. package/dist/utils/process/index.d.ts +411 -0
  472. package/dist/utils/process/index.js +14 -0
  473. package/dist/utils/process/index.js.map +1 -0
  474. package/dist/utils/reactive-layout/index.cjs +1607 -0
  475. package/dist/utils/reactive-layout/index.cjs.map +1 -0
  476. package/dist/utils/reactive-layout/index.d.cts +492 -0
  477. package/dist/utils/reactive-layout/index.d.ts +492 -0
  478. package/dist/utils/reactive-layout/index.js +52 -0
  479. package/dist/utils/reactive-layout/index.js.map +1 -0
  480. package/dist/utils/reduction/index.cjs +203 -0
  481. package/dist/utils/reduction/index.cjs.map +1 -0
  482. package/dist/utils/reduction/index.d.cts +102 -0
  483. package/dist/utils/reduction/index.d.ts +102 -0
  484. package/dist/utils/reduction/index.js +14 -0
  485. package/dist/utils/reduction/index.js.map +1 -0
  486. package/dist/utils/resilience/index.cjs +1617 -0
  487. package/dist/utils/resilience/index.cjs.map +1 -0
  488. package/dist/utils/resilience/index.d.cts +9 -0
  489. package/dist/utils/resilience/index.d.ts +9 -0
  490. package/dist/utils/resilience/index.js +44 -0
  491. package/dist/utils/resilience/index.js.map +1 -0
  492. package/dist/utils/surface/index.cjs +1070 -0
  493. package/dist/utils/surface/index.cjs.map +1 -0
  494. package/dist/utils/surface/index.d.cts +240 -0
  495. package/dist/utils/surface/index.d.ts +240 -0
  496. package/dist/utils/surface/index.js +30 -0
  497. package/dist/utils/surface/index.js.map +1 -0
  498. package/dist/utils/topology-view/index.cjs +620 -0
  499. package/dist/utils/topology-view/index.cjs.map +1 -0
  500. package/dist/utils/topology-view/index.d.cts +68 -0
  501. package/dist/utils/topology-view/index.d.ts +68 -0
  502. package/dist/utils/topology-view/index.js +11 -0
  503. package/dist/utils/topology-view/index.js.map +1 -0
  504. package/package.json +293 -237
  505. package/dist/core/index.cjs +0 -21
  506. package/dist/core/index.cjs.map +0 -1
  507. package/dist/core/index.d.cts +0 -1
  508. package/dist/core/index.d.ts +0 -1
  509. package/dist/core/index.js +0 -3
  510. package/dist/core/index.js.map +0 -1
  511. package/dist/extra/browser.cjs +0 -21
  512. package/dist/extra/browser.cjs.map +0 -1
  513. package/dist/extra/browser.d.cts +0 -1
  514. package/dist/extra/browser.d.ts +0 -1
  515. package/dist/extra/browser.js +0 -3
  516. package/dist/extra/browser.js.map +0 -1
  517. package/dist/extra/index.cjs +0 -21
  518. package/dist/extra/index.cjs.map +0 -1
  519. package/dist/extra/index.d.cts +0 -1
  520. package/dist/extra/index.d.ts +0 -1
  521. package/dist/extra/index.js +0 -3
  522. package/dist/extra/index.js.map +0 -1
  523. package/dist/extra/node.cjs +0 -21
  524. package/dist/extra/node.cjs.map +0 -1
  525. package/dist/extra/node.d.cts +0 -1
  526. package/dist/extra/node.d.ts +0 -1
  527. package/dist/extra/node.js +0 -3
  528. package/dist/extra/node.js.map +0 -1
  529. package/dist/extra/operators.cjs +0 -21
  530. package/dist/extra/operators.cjs.map +0 -1
  531. package/dist/extra/operators.d.cts +0 -1
  532. package/dist/extra/operators.d.ts +0 -1
  533. package/dist/extra/operators.js +0 -3
  534. package/dist/extra/operators.js.map +0 -1
  535. package/dist/extra/reactive.cjs +0 -21
  536. package/dist/extra/reactive.cjs.map +0 -1
  537. package/dist/extra/reactive.d.cts +0 -1
  538. package/dist/extra/reactive.d.ts +0 -1
  539. package/dist/extra/reactive.js +0 -3
  540. package/dist/extra/reactive.js.map +0 -1
  541. package/dist/extra/render/index.cjs +0 -21
  542. package/dist/extra/render/index.cjs.map +0 -1
  543. package/dist/extra/render/index.d.cts +0 -1
  544. package/dist/extra/render/index.d.ts +0 -1
  545. package/dist/extra/render/index.js +0 -3
  546. package/dist/extra/render/index.js.map +0 -1
  547. package/dist/extra/sources.cjs +0 -21
  548. package/dist/extra/sources.cjs.map +0 -1
  549. package/dist/extra/sources.d.cts +0 -1
  550. package/dist/extra/sources.d.ts +0 -1
  551. package/dist/extra/sources.js +0 -3
  552. package/dist/extra/sources.js.map +0 -1
  553. package/dist/extra/storage-browser.cjs +0 -21
  554. package/dist/extra/storage-browser.cjs.map +0 -1
  555. package/dist/extra/storage-browser.d.cts +0 -1
  556. package/dist/extra/storage-browser.d.ts +0 -1
  557. package/dist/extra/storage-browser.js +0 -3
  558. package/dist/extra/storage-browser.js.map +0 -1
  559. package/dist/extra/storage-core.cjs +0 -21
  560. package/dist/extra/storage-core.cjs.map +0 -1
  561. package/dist/extra/storage-core.d.cts +0 -1
  562. package/dist/extra/storage-core.d.ts +0 -1
  563. package/dist/extra/storage-core.js +0 -3
  564. package/dist/extra/storage-core.js.map +0 -1
  565. package/dist/extra/storage-node.cjs +0 -21
  566. package/dist/extra/storage-node.cjs.map +0 -1
  567. package/dist/extra/storage-node.d.cts +0 -1
  568. package/dist/extra/storage-node.d.ts +0 -1
  569. package/dist/extra/storage-node.js +0 -3
  570. package/dist/extra/storage-node.js.map +0 -1
  571. package/dist/extra/storage-tiers-browser.cjs +0 -21
  572. package/dist/extra/storage-tiers-browser.cjs.map +0 -1
  573. package/dist/extra/storage-tiers-browser.d.cts +0 -1
  574. package/dist/extra/storage-tiers-browser.d.ts +0 -1
  575. package/dist/extra/storage-tiers-browser.js +0 -3
  576. package/dist/extra/storage-tiers-browser.js.map +0 -1
  577. package/dist/extra/storage-tiers-node.cjs +0 -21
  578. package/dist/extra/storage-tiers-node.cjs.map +0 -1
  579. package/dist/extra/storage-tiers-node.d.cts +0 -1
  580. package/dist/extra/storage-tiers-node.d.ts +0 -1
  581. package/dist/extra/storage-tiers-node.js +0 -3
  582. package/dist/extra/storage-tiers-node.js.map +0 -1
  583. package/dist/extra/storage-tiers.cjs +0 -21
  584. package/dist/extra/storage-tiers.cjs.map +0 -1
  585. package/dist/extra/storage-tiers.d.cts +0 -1
  586. package/dist/extra/storage-tiers.d.ts +0 -1
  587. package/dist/extra/storage-tiers.js +0 -3
  588. package/dist/extra/storage-tiers.js.map +0 -1
  589. package/dist/extra/storage-wal.cjs +0 -21
  590. package/dist/extra/storage-wal.cjs.map +0 -1
  591. package/dist/extra/storage-wal.d.cts +0 -1
  592. package/dist/extra/storage-wal.d.ts +0 -1
  593. package/dist/extra/storage-wal.js +0 -3
  594. package/dist/extra/storage-wal.js.map +0 -1
  595. package/dist/graph/index.cjs +0 -21
  596. package/dist/graph/index.cjs.map +0 -1
  597. package/dist/graph/index.d.cts +0 -1
  598. package/dist/graph/index.d.ts +0 -1
  599. package/dist/graph/index.js +0 -3
  600. package/dist/graph/index.js.map +0 -1
  601. package/dist/patterns/ai/browser.cjs +0 -21
  602. package/dist/patterns/ai/browser.cjs.map +0 -1
  603. package/dist/patterns/ai/browser.d.cts +0 -1
  604. package/dist/patterns/ai/browser.d.ts +0 -1
  605. package/dist/patterns/ai/browser.js +0 -3
  606. package/dist/patterns/ai/browser.js.map +0 -1
  607. package/dist/patterns/ai/index.cjs +0 -21
  608. package/dist/patterns/ai/index.cjs.map +0 -1
  609. package/dist/patterns/ai/index.d.cts +0 -1
  610. package/dist/patterns/ai/index.d.ts +0 -1
  611. package/dist/patterns/ai/index.js +0 -3
  612. package/dist/patterns/ai/index.js.map +0 -1
  613. package/dist/patterns/ai/node.cjs +0 -21
  614. package/dist/patterns/ai/node.cjs.map +0 -1
  615. package/dist/patterns/ai/node.d.cts +0 -1
  616. package/dist/patterns/ai/node.d.ts +0 -1
  617. package/dist/patterns/ai/node.js +0 -3
  618. package/dist/patterns/ai/node.js.map +0 -1
  619. package/dist/patterns/cqrs/index.cjs +0 -21
  620. package/dist/patterns/cqrs/index.cjs.map +0 -1
  621. package/dist/patterns/cqrs/index.d.cts +0 -1
  622. package/dist/patterns/cqrs/index.d.ts +0 -1
  623. package/dist/patterns/cqrs/index.js +0 -3
  624. package/dist/patterns/cqrs/index.js.map +0 -1
  625. package/dist/patterns/demo-shell/index.cjs +0 -21
  626. package/dist/patterns/demo-shell/index.cjs.map +0 -1
  627. package/dist/patterns/demo-shell/index.d.cts +0 -1
  628. package/dist/patterns/demo-shell/index.d.ts +0 -1
  629. package/dist/patterns/demo-shell/index.js +0 -3
  630. package/dist/patterns/demo-shell/index.js.map +0 -1
  631. package/dist/patterns/domain-templates/index.cjs +0 -21
  632. package/dist/patterns/domain-templates/index.cjs.map +0 -1
  633. package/dist/patterns/domain-templates/index.d.cts +0 -1
  634. package/dist/patterns/domain-templates/index.d.ts +0 -1
  635. package/dist/patterns/domain-templates/index.js +0 -3
  636. package/dist/patterns/domain-templates/index.js.map +0 -1
  637. package/dist/patterns/graphspec/index.cjs +0 -21
  638. package/dist/patterns/graphspec/index.cjs.map +0 -1
  639. package/dist/patterns/graphspec/index.d.cts +0 -1
  640. package/dist/patterns/graphspec/index.d.ts +0 -1
  641. package/dist/patterns/graphspec/index.js +0 -3
  642. package/dist/patterns/graphspec/index.js.map +0 -1
  643. package/dist/patterns/harness/index.cjs +0 -21
  644. package/dist/patterns/harness/index.cjs.map +0 -1
  645. package/dist/patterns/harness/index.d.cts +0 -1
  646. package/dist/patterns/harness/index.d.ts +0 -1
  647. package/dist/patterns/harness/index.js +0 -3
  648. package/dist/patterns/harness/index.js.map +0 -1
  649. package/dist/patterns/inspect/index.cjs +0 -21
  650. package/dist/patterns/inspect/index.cjs.map +0 -1
  651. package/dist/patterns/inspect/index.d.cts +0 -1
  652. package/dist/patterns/inspect/index.d.ts +0 -1
  653. package/dist/patterns/inspect/index.js +0 -3
  654. package/dist/patterns/inspect/index.js.map +0 -1
  655. package/dist/patterns/job-queue/index.cjs +0 -21
  656. package/dist/patterns/job-queue/index.cjs.map +0 -1
  657. package/dist/patterns/job-queue/index.d.cts +0 -1
  658. package/dist/patterns/job-queue/index.d.ts +0 -1
  659. package/dist/patterns/job-queue/index.js +0 -3
  660. package/dist/patterns/job-queue/index.js.map +0 -1
  661. package/dist/patterns/memory/index.cjs +0 -21
  662. package/dist/patterns/memory/index.cjs.map +0 -1
  663. package/dist/patterns/memory/index.d.cts +0 -1
  664. package/dist/patterns/memory/index.d.ts +0 -1
  665. package/dist/patterns/memory/index.js +0 -3
  666. package/dist/patterns/memory/index.js.map +0 -1
  667. package/dist/patterns/messaging/index.cjs +0 -21
  668. package/dist/patterns/messaging/index.cjs.map +0 -1
  669. package/dist/patterns/messaging/index.d.cts +0 -1
  670. package/dist/patterns/messaging/index.d.ts +0 -1
  671. package/dist/patterns/messaging/index.js +0 -3
  672. package/dist/patterns/messaging/index.js.map +0 -1
  673. package/dist/patterns/orchestration/index.cjs +0 -21
  674. package/dist/patterns/orchestration/index.cjs.map +0 -1
  675. package/dist/patterns/orchestration/index.d.cts +0 -1
  676. package/dist/patterns/orchestration/index.d.ts +0 -1
  677. package/dist/patterns/orchestration/index.js +0 -3
  678. package/dist/patterns/orchestration/index.js.map +0 -1
  679. package/dist/patterns/process/index.cjs +0 -21
  680. package/dist/patterns/process/index.cjs.map +0 -1
  681. package/dist/patterns/process/index.d.cts +0 -1
  682. package/dist/patterns/process/index.d.ts +0 -1
  683. package/dist/patterns/process/index.js +0 -3
  684. package/dist/patterns/process/index.js.map +0 -1
  685. package/dist/patterns/reactive-layout/index.cjs +0 -21
  686. package/dist/patterns/reactive-layout/index.cjs.map +0 -1
  687. package/dist/patterns/reactive-layout/index.d.cts +0 -1
  688. package/dist/patterns/reactive-layout/index.d.ts +0 -1
  689. package/dist/patterns/reactive-layout/index.js +0 -3
  690. package/dist/patterns/reactive-layout/index.js.map +0 -1
  691. package/dist/patterns/reduction/index.cjs +0 -21
  692. package/dist/patterns/reduction/index.cjs.map +0 -1
  693. package/dist/patterns/reduction/index.d.cts +0 -1
  694. package/dist/patterns/reduction/index.d.ts +0 -1
  695. package/dist/patterns/reduction/index.js +0 -3
  696. package/dist/patterns/reduction/index.js.map +0 -1
  697. package/dist/patterns/surface/index.cjs +0 -21
  698. package/dist/patterns/surface/index.cjs.map +0 -1
  699. package/dist/patterns/surface/index.d.cts +0 -1
  700. package/dist/patterns/surface/index.d.ts +0 -1
  701. package/dist/patterns/surface/index.js +0 -3
  702. package/dist/patterns/surface/index.js.map +0 -1
  703. package/dist/patterns/topology-view/index.cjs +0 -21
  704. package/dist/patterns/topology-view/index.cjs.map +0 -1
  705. package/dist/patterns/topology-view/index.d.cts +0 -1
  706. package/dist/patterns/topology-view/index.d.ts +0 -1
  707. package/dist/patterns/topology-view/index.js +0 -3
  708. package/dist/patterns/topology-view/index.js.map +0 -1
  709. package/dist/testing/index.cjs +0 -21
  710. package/dist/testing/index.cjs.map +0 -1
  711. package/dist/testing/index.d.cts +0 -1
  712. package/dist/testing/index.d.ts +0 -1
  713. package/dist/testing/index.js +0 -3
  714. package/dist/testing/index.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/base/render/index.ts","../../../src/base/render/_ascii-width.ts","../../../src/base/render/_ascii-grid.ts","../../../src/base/render/_layout-sugiyama.ts","../../../src/base/render/graph-spec-to-ascii.ts","../../../src/base/render/_internal.ts","../../../src/base/render/graph-spec-to-d2.ts","../../../src/base/render/graph-spec-to-json.ts","../../../src/base/render/graph-spec-to-mermaid.ts","../../../src/base/render/graph-spec-to-mermaid-url.ts","../../../src/base/render/graph-spec-to-pretty.ts","../../../src/base/render/layout-frame-to-svg.ts"],"sourcesContent":["/**\n * Renderers barrel — pure functions over `GraphDescribeOutput` (Tier 2.1 A2).\n *\n * Each function takes a describe snapshot and returns a formatted string.\n * Compose with `derived` for live formatted output:\n *\n * ```ts\n * import { graphSpecToMermaid } from \"@graphrefly/graphrefly/extra/render\";\n * import { derived } from \"@graphrefly/graphrefly\";\n *\n * const live = derived(\n * [graph.describe({ reactive: true }).node],\n * ([g]) => graphSpecToMermaid(g),\n * );\n * ```\n *\n * Replaces the old `describe({ format })` dispatch — the `format` sugar option\n * was removed in the D1 three-layer-view refactor (pre-1.0 breaking, no shim).\n *\n * @module\n */\n\nexport type { DiagramDirection } from \"./_internal.js\";\nexport type { LayoutDirection } from \"./_layout-sugiyama.js\";\nexport { type GraphSpecToAsciiOptions, graphSpecToAscii } from \"./graph-spec-to-ascii.js\";\nexport { type GraphSpecToD2Options, graphSpecToD2 } from \"./graph-spec-to-d2.js\";\nexport { type GraphSpecToJsonOptions, graphSpecToJson } from \"./graph-spec-to-json.js\";\nexport { type GraphSpecToMermaidOptions, graphSpecToMermaid } from \"./graph-spec-to-mermaid.js\";\nexport {\n\ttype GraphSpecToMermaidUrlOptions,\n\tgraphSpecToMermaidUrl,\n\ttype MermaidLiveTheme,\n\tmermaidLiveUrl,\n} from \"./graph-spec-to-mermaid-url.js\";\nexport { type GraphSpecToPrettyOptions, graphSpecToPretty } from \"./graph-spec-to-pretty.js\";\nexport {\n\ttype LayoutFrameToSvgOptions,\n\tlayoutFrameToSvg,\n} from \"./layout-frame-to-svg.js\";\n","/**\n * Monospace-terminal cell-width utilities shared by the CLI measurement\n * adapter ([src/patterns/reactive-layout/measurement-adapters.ts](../patterns/reactive-layout/measurement-adapters.ts))\n * and the ASCII describe renderer ([graph-spec-to-ascii.ts](./graph-spec-to-ascii.ts)).\n *\n * Approximates UAX #11 East_Asian_Width (W/F → 2) plus known combining-mark\n * ranges (→ 0). Not a full EAW table — covers CJK, Hangul, fullwidth forms,\n * common emoji, and Extensions B-G. Does not handle ZWJ emoji sequences\n * (multi-codepoint clusters rendered as a single glyph) — terminal support\n * for those varies widely.\n */\n\nexport function cellWidth(code: number): 0 | 1 | 2 {\n\t// Combining marks (Mn, Mc, Me) → 0 cells\n\tif (\n\t\t(code >= 0x0300 && code <= 0x036f) || // Combining Diacritical Marks\n\t\t(code >= 0x0483 && code <= 0x0489) || // Cyrillic combining marks\n\t\t(code >= 0x0591 && code <= 0x05bd) || // Hebrew combining marks\n\t\t(code >= 0x0610 && code <= 0x061a) || // Arabic combining marks\n\t\t(code >= 0x064b && code <= 0x065f) || // Arabic combining marks\n\t\t(code >= 0x0670 && code === 0x0670) || // Arabic superscript alef\n\t\t(code >= 0x06d6 && code <= 0x06dc) || // Arabic combining marks\n\t\t(code >= 0x06df && code <= 0x06e4) || // Arabic combining marks\n\t\t(code >= 0x06e7 && code <= 0x06e8) || // Arabic combining marks\n\t\t(code >= 0x06ea && code <= 0x06ed) || // Arabic combining marks\n\t\t(code >= 0x0730 && code <= 0x074a) || // Syriac combining marks\n\t\t(code >= 0x07a6 && code <= 0x07b0) || // Thaana combining marks\n\t\t(code >= 0x0900 && code <= 0x0903) || // Devanagari combining marks\n\t\t(code >= 0x093a && code <= 0x094f) || // Devanagari combining marks\n\t\t(code >= 0x0951 && code <= 0x0957) || // Devanagari combining marks\n\t\t(code >= 0x0962 && code <= 0x0963) || // Devanagari combining marks\n\t\t(code >= 0x0981 && code <= 0x0983) || // Bengali combining marks\n\t\t(code >= 0x09bc && code <= 0x09cd) || // Bengali combining marks\n\t\t(code >= 0x0a01 && code <= 0x0a03) || // Gurmukhi combining marks\n\t\t(code >= 0x0a3c && code <= 0x0a51) || // Gurmukhi combining marks\n\t\t(code >= 0x0a70 && code <= 0x0a71) || // Gurmukhi combining marks\n\t\t(code >= 0x0a75 && code === 0x0a75) || // Gurmukhi combining mark\n\t\t(code >= 0x0e31 && code === 0x0e31) || // Thai combining mark\n\t\t(code >= 0x0e34 && code <= 0x0e3a) || // Thai combining marks\n\t\t(code >= 0x0e47 && code <= 0x0e4e) || // Thai combining marks\n\t\t(code >= 0x0eb1 && code === 0x0eb1) || // Lao combining mark\n\t\t(code >= 0x0eb4 && code <= 0x0ebc) || // Lao combining marks\n\t\t(code >= 0x0ec8 && code <= 0x0ece) || // Lao combining marks\n\t\t(code >= 0x1dc0 && code <= 0x1dff) || // Combining Diacritical Marks Supplement\n\t\t(code >= 0x20d0 && code <= 0x20ff) || // Combining Diacritical Marks for Symbols\n\t\t(code >= 0xfe00 && code <= 0xfe0f) || // Variation Selectors\n\t\t(code >= 0xfe20 && code <= 0xfe2f) || // Combining Half Marks\n\t\tcode === 0x200d // Zero Width Joiner\n\t) {\n\t\treturn 0;\n\t}\n\t// Wide / fullwidth → 2 cells\n\tif (\n\t\t(code >= 0x1100 && code <= 0x115f) || // Hangul Jamo\n\t\t(code >= 0x231a && code <= 0x231b) || // Watch, Hourglass\n\t\t(code >= 0x2329 && code <= 0x232a) || // Angle brackets\n\t\t(code >= 0x23e9 && code <= 0x23f3) || // Media control symbols\n\t\t(code >= 0x23f8 && code <= 0x23fa) || // Media control symbols\n\t\t(code >= 0x25fd && code <= 0x25fe) || // Medium squares\n\t\t(code >= 0x2614 && code <= 0x2615) || // Umbrella, Hot Beverage\n\t\t(code >= 0x2648 && code <= 0x2653) || // Zodiac symbols\n\t\tcode === 0x267f || // Wheelchair\n\t\tcode === 0x2693 || // Anchor\n\t\tcode === 0x26a1 || // High Voltage\n\t\t(code >= 0x26aa && code <= 0x26ab) || // Medium circles\n\t\t(code >= 0x26bd && code <= 0x26be) || // Soccer, Baseball\n\t\t(code >= 0x26c4 && code <= 0x26c5) || // Snowman, Sun behind cloud\n\t\tcode === 0x26ce || // Ophiuchus\n\t\tcode === 0x26d4 || // No Entry\n\t\tcode === 0x26ea || // Church\n\t\t(code >= 0x26f2 && code <= 0x26f3) || // Fountain, Golf\n\t\tcode === 0x26f5 || // Sailboat\n\t\tcode === 0x26fa || // Tent\n\t\tcode === 0x26fd || // Fuel Pump\n\t\tcode === 0x2702 || // Scissors\n\t\tcode === 0x2705 || // Check Mark\n\t\t(code >= 0x2708 && code <= 0x270d) || // Airplane...Writing Hand\n\t\tcode === 0x270f || // Pencil\n\t\t(code >= 0x2753 && code <= 0x2755) || // Question marks\n\t\tcode === 0x2757 || // Exclamation\n\t\t(code >= 0x2795 && code <= 0x2797) || // Plus, Minus, Divide\n\t\tcode === 0x27b0 || // Curly Loop\n\t\tcode === 0x27bf || // Double Curly Loop\n\t\t(code >= 0x2934 && code <= 0x2935) || // Arrows\n\t\t(code >= 0x2b05 && code <= 0x2b07) || // Arrows\n\t\t(code >= 0x2b1b && code <= 0x2b1c) || // Squares\n\t\tcode === 0x2b50 || // Star\n\t\tcode === 0x2b55 || // Circle\n\t\t(code >= 0x2e80 && code <= 0x303e) || // CJK Radicals, Symbols, Punctuation\n\t\t(code >= 0x3040 && code <= 0x309f) || // Hiragana\n\t\t(code >= 0x30a0 && code <= 0x30ff) || // Katakana\n\t\t(code >= 0x3105 && code <= 0x312f) || // Bopomofo\n\t\t(code >= 0x3131 && code <= 0x318e) || // Hangul Compatibility Jamo\n\t\t(code >= 0x3190 && code <= 0x31e3) || // Kanbun, CJK Strokes\n\t\t(code >= 0x31f0 && code <= 0x321e) || // Katakana Phonetic Extensions\n\t\t(code >= 0x3220 && code <= 0x3247) || // Enclosed CJK\n\t\t(code >= 0x3250 && code <= 0x4dbf) || // CJK Extensions + Unified block\n\t\t(code >= 0x4e00 && code <= 0x9fff) || // CJK Unified Ideographs\n\t\t(code >= 0xa960 && code <= 0xa97c) || // Hangul Jamo Extended-A\n\t\t(code >= 0xac00 && code <= 0xd7a3) || // Hangul Syllables\n\t\t(code >= 0xf900 && code <= 0xfaff) || // CJK Compatibility Ideographs\n\t\t(code >= 0xfe10 && code <= 0xfe19) || // Vertical forms\n\t\t(code >= 0xfe30 && code <= 0xfe6b) || // CJK Compatibility Forms\n\t\t(code >= 0xff01 && code <= 0xff60) || // Fullwidth Forms (excl. halfwidth)\n\t\t(code >= 0xffe0 && code <= 0xffe6) || // Fullwidth Signs\n\t\t(code >= 0x1f004 && code === 0x1f004) || // Mahjong Red Dragon\n\t\tcode === 0x1f0cf || // Joker\n\t\t(code >= 0x1f170 && code <= 0x1f171) || // A/B buttons\n\t\tcode === 0x1f17e || // O button\n\t\tcode === 0x1f17f || // P button\n\t\tcode === 0x1f18e || // AB button\n\t\t(code >= 0x1f191 && code <= 0x1f19a) || // Squared symbols\n\t\t(code >= 0x1f1e0 && code <= 0x1f1ff) || // Regional Indicator Symbols\n\t\t(code >= 0x1f200 && code <= 0x1f202) || // Enclosed ideographic\n\t\tcode === 0x1f21a || // Squared CJK\n\t\tcode === 0x1f22f || // Squared CJK\n\t\t(code >= 0x1f232 && code <= 0x1f23a) || // Squared CJK\n\t\t(code >= 0x1f250 && code <= 0x1f251) || // Circled ideographic\n\t\t(code >= 0x1f300 && code <= 0x1f9ff) || // Misc Symbols / Emoticons / Emoji\n\t\t(code >= 0x1fa00 && code <= 0x1faff) || // Chess, Symbols Extended-A\n\t\t(code >= 0x1fb00 && code <= 0x1fbff) || // Symbols for Legacy Computing\n\t\t(code >= 0x20000 && code <= 0x2fffd) || // CJK Extension B-F (excl. nonchars)\n\t\t(code >= 0x30000 && code <= 0x3fffd) // CJK Extension G+ (excl. nonchars)\n\t) {\n\t\treturn 2;\n\t}\n\treturn 1;\n}\n\n/**\n * Count total display cells for a string in a monospace terminal.\n *\n * Combining marks contribute 0 cells; CJK / fullwidth contribute 2.\n * Does not handle ZWJ emoji sequences.\n */\nexport function countCells(text: string): number {\n\tlet cells = 0;\n\tfor (const ch of text) {\n\t\tcells += cellWidth(ch.codePointAt(0)!);\n\t}\n\treturn cells;\n}\n\n/**\n * Truncate `text` to at most `maxCells` terminal cells, appending an ellipsis\n * (\"…\" → 1 cell) when truncation occurs. Grapheme-unaware — splits at\n * codepoints; ZWJ sequences may be cut mid-cluster.\n */\nexport function truncateToCells(text: string, maxCells: number): string {\n\tif (maxCells <= 0) return \"\";\n\tlet cells = 0;\n\tlet out = \"\";\n\tfor (const ch of text) {\n\t\tconst w = cellWidth(ch.codePointAt(0)!);\n\t\tif (cells + w > maxCells) {\n\t\t\tif (maxCells <= 1) return \"…\";\n\t\t\t// Drop last wide char if we'd exceed budget with the ellipsis\n\t\t\twhile (cells + 1 > maxCells && out.length > 0) {\n\t\t\t\tconst last = [...out].pop()!;\n\t\t\t\tout = out.slice(0, -last.length);\n\t\t\t\tcells -= cellWidth(last.codePointAt(0)!);\n\t\t\t}\n\t\t\treturn `${out}…`;\n\t\t}\n\t\tout += ch;\n\t\tcells += w;\n\t}\n\treturn out;\n}\n","/**\n * Character-grid blitter for the ASCII describe renderer.\n *\n * Given a [LayoutResult](./_layout-sugiyama.ts) (boxes + polyline edges on\n * an integer cell grid), produce a newline-joined string using Unicode\n * box-drawing glyphs (or plain ASCII when `charset: \"ascii\"` is requested).\n *\n * Invariants:\n * - Multi-cell CJK labels still count as 2 cells via\n * [_ascii-width.ts](./_ascii-width.ts).\n * - Edge crossings (two segments perpendicular at the same cell) collapse\n * to `┼` / `+`. Corner-vs-line collisions resolve to a corner glyph.\n * - Boxes overwrite edge glyphs — boxes are blitted last so an edge that\n * happens to pass under a box body is hidden.\n */\n\nimport { countCells } from \"./_ascii-width.js\";\nimport type { LayoutBox, LayoutEdge, LayoutResult } from \"./_layout-sugiyama.js\";\n\nexport type AsciiCharset = \"unicode\" | \"ascii\";\n\nexport type GridOptions = {\n\treadonly charset: AsciiCharset;\n\treadonly labelOf: (id: string) => string;\n};\n\ntype Glyphs = {\n\treadonly horizontal: string;\n\treadonly vertical: string;\n\treadonly cornerTL: string;\n\treadonly cornerTR: string;\n\treadonly cornerBL: string;\n\treadonly cornerBR: string;\n\treadonly tDown: string;\n\treadonly tUp: string;\n\treadonly tRight: string;\n\treadonly tLeft: string;\n\treadonly cross: string;\n\treadonly arrowRight: string;\n\treadonly arrowDown: string;\n\treadonly arrowLeft: string;\n\treadonly arrowUp: string;\n\treadonly boxTL: string;\n\treadonly boxTR: string;\n\treadonly boxBL: string;\n\treadonly boxBR: string;\n\treadonly boxH: string;\n\treadonly boxV: string;\n};\n\nconst UNICODE: Glyphs = {\n\thorizontal: \"─\",\n\tvertical: \"│\",\n\tcornerTL: \"┌\",\n\tcornerTR: \"┐\",\n\tcornerBL: \"└\",\n\tcornerBR: \"┘\",\n\ttDown: \"┬\",\n\ttUp: \"┴\",\n\ttRight: \"├\",\n\ttLeft: \"┤\",\n\tcross: \"┼\",\n\tarrowRight: \"▶\",\n\tarrowDown: \"▼\",\n\tarrowLeft: \"◀\",\n\tarrowUp: \"▲\",\n\tboxTL: \"┌\",\n\tboxTR: \"┐\",\n\tboxBL: \"└\",\n\tboxBR: \"┘\",\n\tboxH: \"─\",\n\tboxV: \"│\",\n};\n\nconst ASCII: Glyphs = {\n\thorizontal: \"-\",\n\tvertical: \"|\",\n\tcornerTL: \"+\",\n\tcornerTR: \"+\",\n\tcornerBL: \"+\",\n\tcornerBR: \"+\",\n\ttDown: \"+\",\n\ttUp: \"+\",\n\ttRight: \"+\",\n\ttLeft: \"+\",\n\tcross: \"+\",\n\tarrowRight: \">\",\n\tarrowDown: \"v\",\n\tarrowLeft: \"<\",\n\tarrowUp: \"^\",\n\tboxTL: \"+\",\n\tboxTR: \"+\",\n\tboxBL: \"+\",\n\tboxBR: \"+\",\n\tboxH: \"-\",\n\tboxV: \"|\",\n};\n\n// Set of glyphs considered \"edge lines\" when resolving collisions. A later\n// put() into an edge cell that conflicts produces `cross`; corners and\n// T-junctions are preserved (they carry more information).\ntype CellKind =\n\t| \"empty\"\n\t| \"boxH\"\n\t| \"boxV\"\n\t| \"boxCorner\"\n\t| \"edgeH\"\n\t| \"edgeV\"\n\t| \"edgeCorner\"\n\t| \"arrow\"\n\t| \"label\";\n\nexport function renderGrid(layout: LayoutResult, options: GridOptions): string {\n\tconst glyphs = options.charset === \"ascii\" ? ASCII : UNICODE;\n\tconst width = layout.width;\n\tconst height = layout.height;\n\tconst grid: string[][] = Array.from({ length: height }, () =>\n\t\tArray.from({ length: width }, () => \" \"),\n\t);\n\tconst kind: CellKind[][] = Array.from({ length: height }, () =>\n\t\tArray.from({ length: width }, () => \"empty\" as CellKind),\n\t);\n\n\t// 1. Draw edges first (boxes overwrite).\n\tfor (const edge of layout.edges) {\n\t\tdrawEdge(grid, kind, glyphs, edge);\n\t}\n\n\t// 2. Draw boxes on top.\n\tfor (const box of layout.boxes) {\n\t\tdrawBox(grid, kind, glyphs, box, options.labelOf(box.id));\n\t}\n\n\treturn grid.map((row) => stripTrailing(row.join(\"\"))).join(\"\\n\");\n}\n\n// ---------------------------------------------------------------------------\n// Box drawing\n// ---------------------------------------------------------------------------\n\nfunction drawBox(\n\tgrid: string[][],\n\tkind: CellKind[][],\n\tglyphs: Glyphs,\n\tbox: LayoutBox,\n\tlabel: string,\n): void {\n\tconst { x, y, w, h } = box;\n\tif (w < 2 || h < 2) {\n\t\t// Degenerate — just paint the label.\n\t\tif (h > 0) writeLabel(grid, kind, x, y, w, label);\n\t\treturn;\n\t}\n\t// Top border\n\tputBoxCell(grid, kind, x, y, glyphs.boxTL);\n\tfor (let cx = x + 1; cx < x + w - 1; cx += 1) putBoxCell(grid, kind, cx, y, glyphs.boxH);\n\tputBoxCell(grid, kind, x + w - 1, y, glyphs.boxTR);\n\t// Middle rows — side borders + content (only middle row carries the label)\n\tfor (let cy = y + 1; cy < y + h - 1; cy += 1) {\n\t\tputBoxCell(grid, kind, x, cy, glyphs.boxV);\n\t\tfor (let cx = x + 1; cx < x + w - 1; cx += 1) {\n\t\t\tputBoxCellAs(grid, kind, cx, cy, \" \", \"empty\");\n\t\t}\n\t\tputBoxCell(grid, kind, x + w - 1, cy, glyphs.boxV);\n\t}\n\t// Bottom border\n\tputBoxCell(grid, kind, x, y + h - 1, glyphs.boxBL);\n\tfor (let cx = x + 1; cx < x + w - 1; cx += 1) putBoxCell(grid, kind, cx, y + h - 1, glyphs.boxH);\n\tputBoxCell(grid, kind, x + w - 1, y + h - 1, glyphs.boxBR);\n\t// Label in vertical middle (h >= 3 expected)\n\tconst midY = y + Math.floor(h / 2);\n\twriteLabel(grid, kind, x + 1, midY, w - 2, label);\n}\n\nfunction putBoxCell(\n\tgrid: string[][],\n\tkind: CellKind[][],\n\tx: number,\n\ty: number,\n\tglyph: string,\n): void {\n\tconst k: CellKind =\n\t\tglyph === \" \"\n\t\t\t? \"empty\"\n\t\t\t: glyph === \"─\" || glyph === \"-\"\n\t\t\t\t? \"boxH\"\n\t\t\t\t: glyph === \"│\" || glyph === \"|\"\n\t\t\t\t\t? \"boxV\"\n\t\t\t\t\t: \"boxCorner\";\n\tputBoxCellAs(grid, kind, x, y, glyph, k);\n}\n\nfunction putBoxCellAs(\n\tgrid: string[][],\n\tkind: CellKind[][],\n\tx: number,\n\ty: number,\n\tglyph: string,\n\tk: CellKind,\n): void {\n\tif (y < 0 || y >= grid.length) return;\n\tconst row = grid[y]!;\n\tif (x < 0 || x >= row.length) return;\n\trow[x] = glyph;\n\tkind[y]![x] = k;\n}\n\nfunction writeLabel(\n\tgrid: string[][],\n\tkind: CellKind[][],\n\tx: number,\n\ty: number,\n\tmaxWidthCells: number,\n\tlabel: string,\n): void {\n\t// The grid is cell-indexed (one array slot per terminal cell). Wide\n\t// characters (CJK, fullwidth) occupy TWO cells visually; we store the\n\t// char in the first slot and an empty string in the second slot so\n\t// join(\"\") collapses to a single visible wide glyph and neighboring\n\t// writes don't add spurious narrow spaces next to the wide char.\n\tif (y < 0 || y >= grid.length) return;\n\tlet cursor = x;\n\tlet cellsLeft = maxWidthCells;\n\tfor (const ch of label) {\n\t\tconst cw = countCells(ch);\n\t\tif (cw === 0) continue;\n\t\tif (cellsLeft < cw) break;\n\t\tif (cursor >= 0 && cursor < grid[y]!.length) {\n\t\t\tgrid[y]![cursor] = ch;\n\t\t\tkind[y]![cursor] = \"label\";\n\t\t\tif (cw === 2 && cursor + 1 < grid[y]!.length) {\n\t\t\t\tgrid[y]![cursor + 1] = \"\";\n\t\t\t\tkind[y]![cursor + 1] = \"label\";\n\t\t\t}\n\t\t}\n\t\tcursor += cw;\n\t\tcellsLeft -= cw;\n\t}\n\t// Pad remaining cells with spaces so any edge glyphs lurking under the\n\t// box body don't leak into the label row.\n\twhile (cellsLeft > 0) {\n\t\tif (cursor >= 0 && cursor < grid[y]!.length) {\n\t\t\tgrid[y]![cursor] = \" \";\n\t\t\tkind[y]![cursor] = \"empty\";\n\t\t}\n\t\tcursor += 1;\n\t\tcellsLeft -= 1;\n\t}\n}\n\n// ---------------------------------------------------------------------------\n// Edge drawing\n// ---------------------------------------------------------------------------\n\nfunction drawEdge(grid: string[][], kind: CellKind[][], glyphs: Glyphs, edge: LayoutEdge): void {\n\tconst pts = edge.points;\n\tif (pts.length < 2) return;\n\t// Draw segments\n\tfor (let i = 0; i + 1 < pts.length; i += 1) {\n\t\tdrawSegment(grid, kind, glyphs, pts[i]!, pts[i + 1]!);\n\t}\n\t// Draw corners at interior points\n\tfor (let i = 1; i + 1 < pts.length; i += 1) {\n\t\tconst a = pts[i - 1]!;\n\t\tconst b = pts[i]!;\n\t\tconst c = pts[i + 1]!;\n\t\tconst corner = cornerGlyph(a, b, c, glyphs);\n\t\tif (corner) putEdgeCell(grid, kind, b.x, b.y, corner, \"edgeCorner\");\n\t}\n\t// Arrow tip at the final point, aimed from the penultimate point.\n\t// Four cardinal directions — covers backward and upward tips produced\n\t// by routing past virtual nodes or dense-gutter fallbacks.\n\tconst tip = pts[pts.length - 1]!;\n\tconst prev = pts[pts.length - 2]!;\n\tconst arrow = arrowGlyph(prev, tip, glyphs);\n\tif (arrow) putEdgeCell(grid, kind, tip.x, tip.y, arrow, \"arrow\");\n}\n\nfunction drawSegment(\n\tgrid: string[][],\n\tkind: CellKind[][],\n\tglyphs: Glyphs,\n\ta: { x: number; y: number },\n\tb: { x: number; y: number },\n): void {\n\tif (a.x === b.x && a.y === b.y) return;\n\tif (a.y === b.y) {\n\t\t// Horizontal\n\t\tconst y = a.y;\n\t\tconst x0 = Math.min(a.x, b.x);\n\t\tconst x1 = Math.max(a.x, b.x);\n\t\tfor (let x = x0; x <= x1; x += 1) {\n\t\t\tputEdgeLine(grid, kind, x, y, glyphs, \"h\");\n\t\t}\n\t} else if (a.x === b.x) {\n\t\t// Vertical\n\t\tconst x = a.x;\n\t\tconst y0 = Math.min(a.y, b.y);\n\t\tconst y1 = Math.max(a.y, b.y);\n\t\tfor (let y = y0; y <= y1; y += 1) {\n\t\t\tputEdgeLine(grid, kind, x, y, glyphs, \"v\");\n\t\t}\n\t}\n\t// Diagonal shouldn't happen — routing is orthogonal.\n}\n\nfunction putEdgeLine(\n\tgrid: string[][],\n\tkind: CellKind[][],\n\tx: number,\n\ty: number,\n\tglyphs: Glyphs,\n\torientation: \"h\" | \"v\",\n): void {\n\tif (y < 0 || y >= grid.length) return;\n\tconst row = grid[y]!;\n\tif (x < 0 || x >= row.length) return;\n\tconst existing = kind[y]![x];\n\tif (\n\t\texisting === \"boxH\" ||\n\t\texisting === \"boxV\" ||\n\t\texisting === \"boxCorner\" ||\n\t\texisting === \"label\"\n\t) {\n\t\t// Box wins — do nothing. Boxes are drawn after edges, but if order\n\t\t// is reversed the edge must not clobber the box.\n\t\treturn;\n\t}\n\tif (existing === \"empty\") {\n\t\trow[x] = orientation === \"h\" ? glyphs.horizontal : glyphs.vertical;\n\t\tkind[y]![x] = orientation === \"h\" ? \"edgeH\" : \"edgeV\";\n\t\treturn;\n\t}\n\tif (existing === \"edgeH\" && orientation === \"v\") {\n\t\trow[x] = glyphs.cross;\n\t\tkind[y]![x] = \"edgeCorner\";\n\t\treturn;\n\t}\n\tif (existing === \"edgeV\" && orientation === \"h\") {\n\t\trow[x] = glyphs.cross;\n\t\tkind[y]![x] = \"edgeCorner\";\n\t\treturn;\n\t}\n\t// Same-orientation overlay: keep existing glyph.\n}\n\nfunction putEdgeCell(\n\tgrid: string[][],\n\tkind: CellKind[][],\n\tx: number,\n\ty: number,\n\tglyph: string,\n\tk: CellKind,\n): void {\n\tif (y < 0 || y >= grid.length) return;\n\tconst row = grid[y]!;\n\tif (x < 0 || x >= row.length) return;\n\tconst existing = kind[y]![x];\n\tif (\n\t\texisting === \"boxH\" ||\n\t\texisting === \"boxV\" ||\n\t\texisting === \"boxCorner\" ||\n\t\texisting === \"label\"\n\t)\n\t\treturn;\n\trow[x] = glyph;\n\tkind[y]![x] = k;\n}\n\n// ---------------------------------------------------------------------------\n// Corner + arrow glyph selection\n// ---------------------------------------------------------------------------\n\nfunction cornerGlyph(\n\ta: { x: number; y: number },\n\tb: { x: number; y: number },\n\tc: { x: number; y: number },\n\tglyphs: Glyphs,\n): string | undefined {\n\tconst inHoriz = a.y === b.y;\n\tconst outHoriz = b.y === c.y;\n\tif (inHoriz === outHoriz) return undefined; // not a turn\n\t// In from horizontal, out to vertical (or vice versa). Figure out which\n\t// of the four corners we're at.\n\tif (inHoriz) {\n\t\t// Coming from the left (a.x < b.x) or right (a.x > b.x)\n\t\tconst fromLeft = a.x < b.x;\n\t\tconst goingDown = c.y > b.y;\n\t\tif (fromLeft && goingDown) return glyphs.cornerTR;\n\t\tif (fromLeft && !goingDown) return glyphs.cornerBR;\n\t\tif (!fromLeft && goingDown) return glyphs.cornerTL;\n\t\treturn glyphs.cornerBL;\n\t}\n\t// Vertical in, horizontal out\n\tconst fromAbove = a.y < b.y;\n\tconst goingRight = c.x > b.x;\n\tif (fromAbove && goingRight) return glyphs.cornerBL;\n\tif (fromAbove && !goingRight) return glyphs.cornerBR;\n\tif (!fromAbove && goingRight) return glyphs.cornerTL;\n\treturn glyphs.cornerTR;\n}\n\nfunction arrowGlyph(\n\tprev: { x: number; y: number },\n\ttip: { x: number; y: number },\n\tglyphs: Glyphs,\n): string | undefined {\n\tif (tip.x > prev.x) return glyphs.arrowRight;\n\tif (tip.x < prev.x) return glyphs.arrowLeft;\n\tif (tip.y > prev.y) return glyphs.arrowDown;\n\tif (tip.y < prev.y) return glyphs.arrowUp;\n\treturn undefined; // zero-length segment — no tip\n}\n\n// ---------------------------------------------------------------------------\n// Output trimming\n// ---------------------------------------------------------------------------\n\nfunction stripTrailing(line: string): string {\n\t// Trim trailing spaces only; preserve internal grid alignment.\n\tlet end = line.length;\n\twhile (end > 0 && line.charCodeAt(end - 1) === 32) end -= 1;\n\treturn line.slice(0, end);\n}\n","/**\n * Sugiyama-style layered DAG layout on an integer grid.\n *\n * Pipeline:\n * 1. Longest-path layer assignment (sources at layer 0).\n * 2. Virtual-node splitting — every edge spanning more than one layer\n * becomes a chain of synthetic nodes on intermediate layers. Downstream\n * passes treat real and virtual nodes identically; crossing\n * minimization therefore works on wide + deep DAGs, not only\n * adjacent-layer cases.\n * 3. Crossing minimization — barycenter heuristic with alternating up /\n * down sweeps plus an adjacent-transposition polish pass.\n * 4. Coordinate assignment — greedy median-aligned packing with collision\n * resolution. Straightens vertical runs of virtual nodes so long edges\n * become straight lines where topology allows.\n * 5. Orthogonal edge routing — per-gutter x-track assignment; horizontal\n * segments sit at endpoint centerlines, vertical segments pack into the\n * gutter column range without overlap. Remaining crossings are\n * topologically unavoidable and will render as `┼` at draw time.\n *\n * Output coordinates are cell-grid integers (LR direction). TD rendering\n * swaps axes at draw time — the layout is direction-agnostic by\n * construction.\n *\n * Used only by [graph-spec-to-ascii.ts](./graph-spec-to-ascii.ts); not part of the public\n * `extra/render/index.ts` surface (underscore-prefixed).\n */\n\nexport type LayoutDirection = \"LR\" | \"TD\";\n\nexport type LayoutInput = {\n\t/** Node ids in stable iteration order. Determines initial tie-break. */\n\treadonly nodes: readonly string[];\n\t/** Edges by (from, to) path. Endpoints must be present in `nodes`. */\n\treadonly edges: ReadonlyArray<{ from: string; to: string }>;\n\t/** Label width in cells for each node (independent of direction). */\n\treadonly widthCells: (id: string) => number;\n\t/** Label height in cells for each node (independent of direction). */\n\treadonly heightCells: (id: string) => number;\n\t/**\n\t * Gap between layer \"columns\" (LR) or \"rows\" (TD), in cells.\n\t * Must allow enough room for per-gutter edge tracks.\n\t */\n\treadonly layerGap: number;\n\t/**\n\t * Gap between neighboring nodes *within* a layer, in cells.\n\t * LR: vertical gap; TD: horizontal gap.\n\t */\n\treadonly nodeGap: number;\n\t/**\n\t * Axis orientation. LR: layers = columns (x grows), order = rows (y grows).\n\t * TD: layers = rows (y grows), order = columns (x grows).\n\t */\n\treadonly direction: LayoutDirection;\n};\n\nexport type LayoutBox = {\n\treadonly id: string;\n\treadonly layer: number;\n\treadonly order: number;\n\treadonly x: number;\n\treadonly y: number;\n\treadonly w: number;\n\treadonly h: number;\n};\n\nexport type LayoutEdgePoint = { readonly x: number; readonly y: number };\n\nexport type LayoutEdge = {\n\treadonly from: string;\n\treadonly to: string;\n\t/** Polyline of waypoints (start → corners → end). Minimum 2 entries. */\n\treadonly points: readonly LayoutEdgePoint[];\n};\n\nexport type LayoutResult = {\n\treadonly boxes: readonly LayoutBox[];\n\treadonly edges: readonly LayoutEdge[];\n\treadonly width: number;\n\treadonly height: number;\n};\n\n// ---------------------------------------------------------------------------\n// Internal types — carried through the pipeline\n// ---------------------------------------------------------------------------\n\ntype Hop = {\n\tchainId: number;\n\tchainFrom: string;\n\tchainTo: string;\n\tfromId: string;\n\ttoId: string;\n\t/** 0-based hop index along the chain. */\n\thopIndex: number;\n\t/** Total hops in the chain (1 = direct, 2+ = spans virtuals). */\n\tchainLen: number;\n};\n\ntype InternalNode = {\n\tid: string;\n\tisVirtual: boolean;\n\tlayer: number;\n\torder: number;\n\tx: number;\n\ty: number;\n\tw: number;\n\th: number;\n\tin: Hop[];\n\tout: Hop[];\n};\n\ntype Layer = InternalNode[];\n\ntype PipelineState = {\n\tnodes: Map<string, InternalNode>;\n\tlayers: Layer[];\n\thops: Hop[];\n};\n\n// ---------------------------------------------------------------------------\n// Pipeline entry\n// ---------------------------------------------------------------------------\n\nexport function sugiyamaLayout(input: LayoutInput): LayoutResult {\n\tconst state = buildInitial(input);\n\tassignLayers(state);\n\tinsertVirtualNodes(state);\n\tminimizeCrossings(state);\n\tassignCoordinates(state, input);\n\tconst edges = routeEdges(state, input);\n\tconst { width, height } = boundingBox(state);\n\tconst boxes: LayoutBox[] = [];\n\tfor (const layer of state.layers) {\n\t\tfor (const n of layer) {\n\t\t\tif (n.isVirtual) continue;\n\t\t\tboxes.push({\n\t\t\t\tid: n.id,\n\t\t\t\tlayer: n.layer,\n\t\t\t\torder: n.order,\n\t\t\t\tx: n.x,\n\t\t\t\ty: n.y,\n\t\t\t\tw: n.w,\n\t\t\t\th: n.h,\n\t\t\t});\n\t\t}\n\t}\n\treturn { boxes, edges, width, height };\n}\n\n// ---------------------------------------------------------------------------\n// 1. Build internal graph\n// ---------------------------------------------------------------------------\n\nfunction buildInitial(input: LayoutInput): PipelineState {\n\tconst nodes = new Map<string, InternalNode>();\n\tfor (const id of input.nodes) {\n\t\tnodes.set(id, {\n\t\t\tid,\n\t\t\tisVirtual: false,\n\t\t\tlayer: -1,\n\t\t\torder: 0,\n\t\t\tx: 0,\n\t\t\ty: 0,\n\t\t\tw: input.widthCells(id),\n\t\t\th: input.heightCells(id),\n\t\t\tin: [],\n\t\t\tout: [],\n\t\t});\n\t}\n\tconst hops: Hop[] = [];\n\tlet chainId = 0;\n\tfor (const e of input.edges) {\n\t\tif (e.from === e.to) continue; // drop self-loops\n\t\tconst f = nodes.get(e.from);\n\t\tconst t = nodes.get(e.to);\n\t\tif (!f || !t) continue; // drop dangling endpoints\n\t\tconst hop: Hop = {\n\t\t\tchainId: chainId++,\n\t\t\tchainFrom: e.from,\n\t\t\tchainTo: e.to,\n\t\t\tfromId: e.from,\n\t\t\ttoId: e.to,\n\t\t\thopIndex: 0,\n\t\t\tchainLen: 1,\n\t\t};\n\t\tf.out.push(hop);\n\t\tt.in.push(hop);\n\t\thops.push(hop);\n\t}\n\treturn { nodes, layers: [], hops };\n}\n\n// ---------------------------------------------------------------------------\n// 2. Longest-path layer assignment (Kahn's algorithm)\n// ---------------------------------------------------------------------------\n\nfunction assignLayers(state: PipelineState): void {\n\tconst indeg = new Map<string, number>();\n\tfor (const n of state.nodes.values()) indeg.set(n.id, n.in.length);\n\n\tconst queue: InternalNode[] = [];\n\tfor (const n of state.nodes.values()) {\n\t\tif ((indeg.get(n.id) ?? 0) === 0) {\n\t\t\tn.layer = 0;\n\t\t\tqueue.push(n);\n\t\t}\n\t}\n\n\t// Cursor-based BFS — `Array.prototype.shift` is O(n), so the naive form\n\t// is O(n²) and degrades past ~1000 nodes. Cursor keeps it linear.\n\tconst visited = new Set<string>();\n\tlet head = 0;\n\twhile (head < queue.length) {\n\t\tconst n = queue[head++]!;\n\t\tif (visited.has(n.id)) continue;\n\t\tvisited.add(n.id);\n\t\tfor (const hop of n.out) {\n\t\t\tconst t = state.nodes.get(hop.toId)!;\n\t\t\tt.layer = Math.max(t.layer, n.layer + 1);\n\t\t\tconst d = (indeg.get(t.id) ?? 0) - 1;\n\t\t\tindeg.set(t.id, d);\n\t\t\tif (d <= 0) queue.push(t);\n\t\t}\n\t}\n\t// Nodes trapped in a cycle default to layer 0. The edges that would\n\t// close the cycle are dropped in `insertVirtualNodes` (any hop whose\n\t// span is not a positive integer). GraphReFly graphs are DAGs by spec;\n\t// this path is defensive against malformed describe snapshots.\n\tfor (const n of state.nodes.values()) if (n.layer < 0) n.layer = 0;\n}\n\n// ---------------------------------------------------------------------------\n// 3. Virtual-node insertion — critical for scaling past adjacent-layer edges\n// ---------------------------------------------------------------------------\n\nfunction insertVirtualNodes(state: PipelineState): void {\n\tconst maxLayer = Math.max(0, ...Array.from(state.nodes.values(), (n) => n.layer));\n\tconst layers: Layer[] = Array.from({ length: maxLayer + 1 }, () => []);\n\tfor (const n of state.nodes.values()) layers[n.layer]!.push(n);\n\n\tconst newHops: Hop[] = [];\n\tlet virtCounter = 0;\n\tfor (const hop of state.hops) {\n\t\tconst f = state.nodes.get(hop.fromId)!;\n\t\tconst t = state.nodes.get(hop.toId)!;\n\t\tconst span = t.layer - f.layer;\n\t\tif (span <= 0) {\n\t\t\t// Same-layer or back-edge — the input violated the DAG invariant\n\t\t\t// (self-loop was already dropped in `buildInitial`; this catches\n\t\t\t// cycles whose nodes collapsed to layer 0 in `assignLayers`).\n\t\t\t// Drop from both endpoints so routing never sees the hop; same\n\t\t\t// render-best-effort policy as the self-loop / dangling-endpoint\n\t\t\t// filters in `buildInitial`.\n\t\t\tf.out = f.out.filter((h) => h !== hop);\n\t\t\tt.in = t.in.filter((h) => h !== hop);\n\t\t\tcontinue;\n\t\t}\n\t\tif (span === 1) {\n\t\t\thop.hopIndex = 0;\n\t\t\thop.chainLen = 1;\n\t\t\tnewHops.push(hop);\n\t\t\tcontinue;\n\t\t}\n\t\t// Multi-hop: f → v1 → v2 → ... → t\n\t\t// Detach the original edge from f.out / t.in; we rewrite as chain.\n\t\tf.out = f.out.filter((h) => h !== hop);\n\t\tt.in = t.in.filter((h) => h !== hop);\n\n\t\tlet prev = f;\n\t\tfor (let i = 1; i < span; i += 1) {\n\t\t\tconst vid = `__virt_${virtCounter++}__`;\n\t\t\tconst v: InternalNode = {\n\t\t\t\tid: vid,\n\t\t\t\tisVirtual: true,\n\t\t\t\tlayer: f.layer + i,\n\t\t\t\torder: 0,\n\t\t\t\tx: 0,\n\t\t\t\ty: 0,\n\t\t\t\tw: 0,\n\t\t\t\th: 1,\n\t\t\t\tin: [],\n\t\t\t\tout: [],\n\t\t\t};\n\t\t\tstate.nodes.set(vid, v);\n\t\t\tlayers[v.layer]!.push(v);\n\t\t\tconst h: Hop = {\n\t\t\t\tchainId: hop.chainId,\n\t\t\t\tchainFrom: hop.chainFrom,\n\t\t\t\tchainTo: hop.chainTo,\n\t\t\t\tfromId: prev.id,\n\t\t\t\ttoId: vid,\n\t\t\t\thopIndex: i - 1,\n\t\t\t\tchainLen: span,\n\t\t\t};\n\t\t\tprev.out.push(h);\n\t\t\tv.in.push(h);\n\t\t\tnewHops.push(h);\n\t\t\tprev = v;\n\t\t}\n\t\tconst finalHop: Hop = {\n\t\t\tchainId: hop.chainId,\n\t\t\tchainFrom: hop.chainFrom,\n\t\t\tchainTo: hop.chainTo,\n\t\t\tfromId: prev.id,\n\t\t\ttoId: t.id,\n\t\t\thopIndex: span - 1,\n\t\t\tchainLen: span,\n\t\t};\n\t\tprev.out.push(finalHop);\n\t\tt.in.push(finalHop);\n\t\tnewHops.push(finalHop);\n\t}\n\n\t// Stable initial order within each layer.\n\tfor (const layer of layers) {\n\t\tfor (let i = 0; i < layer.length; i += 1) layer[i]!.order = i;\n\t}\n\tstate.layers = layers;\n\tstate.hops = newHops;\n}\n\n// ---------------------------------------------------------------------------\n// 4. Crossing minimization\n// ---------------------------------------------------------------------------\n\nfunction minimizeCrossings(state: PipelineState): void {\n\tconst SWEEPS = 4;\n\tfor (let sweep = 0; sweep < SWEEPS; sweep += 1) {\n\t\t// Down-sweep\n\t\tfor (let li = 1; li < state.layers.length; li += 1) {\n\t\t\tsortByBarycenter(state, state.layers[li]!, \"in\");\n\t\t\treindex(state.layers[li]!);\n\t\t}\n\t\t// Up-sweep\n\t\tfor (let li = state.layers.length - 2; li >= 0; li -= 1) {\n\t\t\tsortByBarycenter(state, state.layers[li]!, \"out\");\n\t\t\treindex(state.layers[li]!);\n\t\t}\n\t}\n\t// Polish — adjacent-transposition pass, bounded iterations.\n\tfor (let iter = 0; iter < 2; iter += 1) {\n\t\tlet improved = false;\n\t\tfor (let li = 1; li < state.layers.length; li += 1) {\n\t\t\tconst layer = state.layers[li]!;\n\t\t\tfor (let i = 0; i + 1 < layer.length; i += 1) {\n\t\t\t\tconst before = pairCrossings(state, layer[i]!, layer[i + 1]!, \"in\");\n\t\t\t\t[layer[i], layer[i + 1]] = [layer[i + 1]!, layer[i]!];\n\t\t\t\treindex(layer);\n\t\t\t\tconst after = pairCrossings(state, layer[i]!, layer[i + 1]!, \"in\");\n\t\t\t\tif (after < before) {\n\t\t\t\t\timproved = true;\n\t\t\t\t} else {\n\t\t\t\t\t[layer[i], layer[i + 1]] = [layer[i + 1]!, layer[i]!];\n\t\t\t\t\treindex(layer);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (!improved) break;\n\t}\n}\n\nfunction sortByBarycenter(state: PipelineState, layer: Layer, direction: \"in\" | \"out\"): void {\n\tconst bary = new Map<string, number>();\n\tfor (const n of layer) {\n\t\tconst neighbors = direction === \"in\" ? n.in : n.out;\n\t\tif (neighbors.length === 0) {\n\t\t\tbary.set(n.id, n.order);\n\t\t\tcontinue;\n\t\t}\n\t\tlet sum = 0;\n\t\tlet count = 0;\n\t\tfor (const h of neighbors) {\n\t\t\tconst other = state.nodes.get(direction === \"in\" ? h.fromId : h.toId);\n\t\t\tif (!other) continue;\n\t\t\tsum += other.order;\n\t\t\tcount += 1;\n\t\t}\n\t\tbary.set(n.id, count === 0 ? n.order : sum / count);\n\t}\n\tlayer.sort((a, b) => {\n\t\tconst ba = bary.get(a.id)!;\n\t\tconst bb = bary.get(b.id)!;\n\t\tif (ba !== bb) return ba - bb;\n\t\treturn a.order - b.order;\n\t});\n}\n\nfunction reindex(layer: Layer): void {\n\tfor (let i = 0; i < layer.length; i += 1) layer[i]!.order = i;\n}\n\nfunction pairCrossings(\n\tstate: PipelineState,\n\ta: InternalNode,\n\tb: InternalNode,\n\tdirection: \"in\" | \"out\",\n): number {\n\tconst aEdges = direction === \"in\" ? a.in : a.out;\n\tconst bEdges = direction === \"in\" ? b.in : b.out;\n\tlet crossings = 0;\n\tfor (const ea of aEdges) {\n\t\tfor (const eb of bEdges) {\n\t\t\tconst oa = state.nodes.get(direction === \"in\" ? ea.fromId : ea.toId)?.order ?? 0;\n\t\t\tconst ob = state.nodes.get(direction === \"in\" ? eb.fromId : eb.toId)?.order ?? 0;\n\t\t\tif ((a.order < b.order && oa > ob) || (a.order > b.order && oa < ob)) {\n\t\t\t\tcrossings += 1;\n\t\t\t}\n\t\t}\n\t}\n\treturn crossings;\n}\n\n// ---------------------------------------------------------------------------\n// 5. Coordinate assignment (direction-aware)\n// ---------------------------------------------------------------------------\n\nfunction assignCoordinates(state: PipelineState, input: LayoutInput): void {\n\tif (input.direction === \"LR\") assignCoordinatesLR(state, input);\n\telse assignCoordinatesTD(state, input);\n}\n\nfunction assignCoordinatesLR(state: PipelineState, input: LayoutInput): void {\n\t// x: per-layer column based on cumulative max width.\n\tconst layerX: number[] = [];\n\tlet cursorX = 0;\n\tfor (let li = 0; li < state.layers.length; li += 1) {\n\t\tlayerX.push(cursorX);\n\t\tlet maxW = 0;\n\t\tfor (const n of state.layers[li]!) maxW = Math.max(maxW, n.w);\n\t\tcursorX += maxW + input.layerGap;\n\t}\n\tfor (let li = 0; li < state.layers.length; li += 1) {\n\t\tfor (const n of state.layers[li]!) n.x = layerX[li]!;\n\t}\n\t// y: greedy pack per layer.\n\tfor (const layer of state.layers) {\n\t\tlet y = 0;\n\t\tfor (const n of layer) {\n\t\t\tn.y = y;\n\t\t\ty += n.h + input.nodeGap;\n\t\t}\n\t}\n\t// Median alignment — straightens chains through virtuals.\n\trunMedianPasses(state, input, \"y\");\n}\n\nfunction assignCoordinatesTD(state: PipelineState, input: LayoutInput): void {\n\t// y: per-layer row based on cumulative max height.\n\tconst layerY: number[] = [];\n\tlet cursorY = 0;\n\tfor (let li = 0; li < state.layers.length; li += 1) {\n\t\tlayerY.push(cursorY);\n\t\tlet maxH = 0;\n\t\tfor (const n of state.layers[li]!) maxH = Math.max(maxH, n.h);\n\t\tcursorY += maxH + input.layerGap;\n\t}\n\tfor (let li = 0; li < state.layers.length; li += 1) {\n\t\tfor (const n of state.layers[li]!) n.y = layerY[li]!;\n\t}\n\t// x: greedy pack per layer.\n\tfor (const layer of state.layers) {\n\t\tlet x = 0;\n\t\tfor (const n of layer) {\n\t\t\tn.x = x;\n\t\t\tx += n.w + input.nodeGap;\n\t\t}\n\t}\n\trunMedianPasses(state, input, \"x\");\n}\n\n/**\n * Median alignment passes — pulls each node toward the median position of\n * its in-layer neighbors along the private axis (\"y\" for LR, \"x\" for TD),\n * then resolves collisions greedily while preserving layer order.\n */\nfunction runMedianPasses(state: PipelineState, input: LayoutInput, axis: \"x\" | \"y\"): void {\n\tconst sizeOf = (n: InternalNode) => (axis === \"y\" ? n.h : n.w);\n\tconst gap = input.nodeGap;\n\tfor (let pass = 0; pass < 2; pass += 1) {\n\t\tconst walk = pass === 0 ? state.layers.slice(1) : state.layers.slice(0, -1).reverse();\n\t\tfor (const layer of walk) {\n\t\t\tconst preferred = new Map<string, number>();\n\t\t\tfor (const n of layer) {\n\t\t\t\tconst neighbors = pass === 0 ? n.in : n.out;\n\t\t\t\tif (neighbors.length === 0) continue;\n\t\t\t\tconst centers: number[] = [];\n\t\t\t\tfor (const h of neighbors) {\n\t\t\t\t\tconst other = state.nodes.get(pass === 0 ? h.fromId : h.toId);\n\t\t\t\t\tif (!other) continue;\n\t\t\t\t\tconst base = axis === \"y\" ? other.y : other.x;\n\t\t\t\t\tcenters.push(base + Math.floor(sizeOf(other) / 2));\n\t\t\t\t}\n\t\t\t\tif (centers.length === 0) continue;\n\t\t\t\tcenters.sort((a, b) => a - b);\n\t\t\t\tconst mid = centers[Math.floor(centers.length / 2)]!;\n\t\t\t\tpreferred.set(n.id, mid - Math.floor(sizeOf(n) / 2));\n\t\t\t}\n\t\t\tlet floor = 0;\n\t\t\tfor (const n of layer) {\n\t\t\t\tconst p = preferred.get(n.id);\n\t\t\t\tconst current = axis === \"y\" ? n.y : n.x;\n\t\t\t\tconst target = p ?? current;\n\t\t\t\tconst clamped = Math.max(target, floor);\n\t\t\t\tif (axis === \"y\") n.y = clamped;\n\t\t\t\telse n.x = clamped;\n\t\t\t\tfloor = clamped + sizeOf(n) + gap;\n\t\t\t}\n\t\t}\n\t}\n}\n\n// ---------------------------------------------------------------------------\n// 6. Orthogonal edge routing (direction-aware)\n//\n// For both LR and TD the algorithm is symmetric — it just operates on a\n// different pair of \"primary\" vs \"cross\" axes:\n//\n// LR: primary = x (layer axis); cross = y. Gutters are vertical strips\n// between columns; tracks within a gutter are distinct x-values.\n// TD: primary = y (layer axis); cross = x. Gutters are horizontal strips\n// between rows; tracks within a gutter are distinct y-values.\n// ---------------------------------------------------------------------------\n\nfunction routeEdges(state: PipelineState, input: LayoutInput): LayoutEdge[] {\n\t// Group hops by chainId → one LayoutEdge per user-facing edge.\n\tconst byChain = new Map<number, Hop[]>();\n\tfor (const h of state.hops) {\n\t\tconst arr = byChain.get(h.chainId);\n\t\tif (arr) arr.push(h);\n\t\telse byChain.set(h.chainId, [h]);\n\t}\n\tfor (const arr of byChain.values()) arr.sort((a, b) => a.hopIndex - b.hopIndex);\n\n\tconst isLR = input.direction === \"LR\";\n\tconst primary = (n: InternalNode): number => (isLR ? n.x : n.y);\n\tconst primarySize = (n: InternalNode): number => (isLR ? n.w : n.h);\n\tconst crossCenter = (n: InternalNode): number =>\n\t\tisLR ? n.y + Math.floor(n.h / 2) : n.x + Math.floor(n.w / 2);\n\n\t// Per-gutter cross-axis track assignment. Two passes:\n\t// 1. Assign each hop to a track INDEX using disjoint-interval packing\n\t// (an existing track may host multiple hops as long as their\n\t// cross-axis ranges don't overlap pairwise).\n\t// 2. Map each track index to a primary-axis position using the final\n\t// track count so the distribution is uniform across the gutter —\n\t// per-hop recomputation (old behavior) collapsed late tracks onto\n\t// `gEnd`, producing bundled overlaps in dense gutters.\n\tconst hopTrackCross = new Map<Hop, number>();\n\tfor (let g = 0; g + 1 < state.layers.length; g += 1) {\n\t\tconst srcLayer = state.layers[g]!;\n\t\tconst dstLayer = state.layers[g + 1]!;\n\n\t\tlet gutterStart = 0;\n\t\tfor (const n of srcLayer) gutterStart = Math.max(gutterStart, primary(n) + primarySize(n));\n\t\tlet gutterEnd = Number.POSITIVE_INFINITY;\n\t\tfor (const n of dstLayer) gutterEnd = Math.min(gutterEnd, primary(n));\n\t\tconst gEnd = Number.isFinite(gutterEnd) ? (gutterEnd as number) - 1 : gutterStart;\n\t\tconst gutterWidth = Math.max(1, gEnd - gutterStart + 1);\n\n\t\tconst gutterHops: Hop[] = [];\n\t\tfor (const n of srcLayer) for (const h of n.out) gutterHops.push(h);\n\t\tgutterHops.sort((a, b) => {\n\t\t\tconst sa = crossCenter(state.nodes.get(a.fromId)!);\n\t\t\tconst sb = crossCenter(state.nodes.get(b.fromId)!);\n\t\t\tif (sa !== sb) return sa - sb;\n\t\t\tconst da = crossCenter(state.nodes.get(a.toId)!);\n\t\t\tconst db = crossCenter(state.nodes.get(b.toId)!);\n\t\t\treturn da - db;\n\t\t});\n\n\t\t// Pass 1: assign track indexes. Each track is an ARRAY of disjoint\n\t\t// intervals — two hops share a track iff their cross-axis ranges\n\t\t// don't overlap any existing interval on that track.\n\t\tconst tracks: Array<Array<{ lo: number; hi: number }>> = [];\n\t\tconst hopToTrackIdx = new Map<Hop, number>();\n\t\tfor (const h of gutterHops) {\n\t\t\tconst sc = crossCenter(state.nodes.get(h.fromId)!);\n\t\t\tconst dc = crossCenter(state.nodes.get(h.toId)!);\n\t\t\tconst lo = Math.min(sc, dc);\n\t\t\tconst hi = Math.max(sc, dc);\n\t\t\tlet idx = -1;\n\t\t\tfor (let t = 0; t < tracks.length; t += 1) {\n\t\t\t\tconst intervals = tracks[t]!;\n\t\t\t\tlet fits = true;\n\t\t\t\tfor (const iv of intervals) {\n\t\t\t\t\tif (iv.lo <= hi && lo <= iv.hi) {\n\t\t\t\t\t\tfits = false;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (fits) {\n\t\t\t\t\tintervals.push({ lo, hi });\n\t\t\t\t\tidx = t;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (idx < 0) {\n\t\t\t\ttracks.push([{ lo, hi }]);\n\t\t\t\tidx = tracks.length - 1;\n\t\t\t}\n\t\t\thopToTrackIdx.set(h, idx);\n\t\t}\n\n\t\t// Pass 2: distribute track indexes uniformly across the gutter's\n\t\t// **interior** (reserve 1-cell margin from each boundary when the\n\t\t// gutter is wide enough). A track placed exactly at `gutterStart`\n\t\t// or `gEnd` collapses the final turn-segment into the adjacent\n\t\t// node's border row, producing a visually misleading arrow; the\n\t\t// margin avoids that whenever geometry allows.\n\t\tconst count = tracks.length;\n\t\tconst hasMargin = gutterWidth >= Math.max(3, count + 2);\n\t\tconst usableStart = hasMargin ? gutterStart + 1 : gutterStart;\n\t\tconst usableEnd = hasMargin ? gEnd - 1 : gEnd;\n\t\tconst usableWidth = Math.max(1, usableEnd - usableStart + 1);\n\t\tfor (const h of gutterHops) {\n\t\t\tconst idx = hopToTrackIdx.get(h)!;\n\t\t\tlet trackPrimary: number;\n\t\t\tif (count <= 1) {\n\t\t\t\ttrackPrimary = usableStart + Math.floor(usableWidth / 2);\n\t\t\t} else {\n\t\t\t\tconst step = (usableWidth - 1) / (count - 1);\n\t\t\t\ttrackPrimary = usableStart + Math.floor(idx * step);\n\t\t\t}\n\t\t\thopTrackCross.set(h, Math.max(gutterStart, Math.min(gEnd, trackPrimary)));\n\t\t}\n\t}\n\n\t// Build polylines.\n\tconst out: LayoutEdge[] = [];\n\tfor (const [, hops] of byChain) {\n\t\tconst points: LayoutEdgePoint[] = [];\n\t\tfor (let i = 0; i < hops.length; i += 1) {\n\t\t\tconst h = hops[i]!;\n\t\t\tconst src = state.nodes.get(h.fromId)!;\n\t\t\tconst dst = state.nodes.get(h.toId)!;\n\t\t\tconst track = hopTrackCross.get(h)!;\n\t\t\t// Endpoints in (primary, cross) space.\n\t\t\tconst srcPrimary = src.isVirtual ? primary(src) : primary(src) + primarySize(src);\n\t\t\tconst dstPrimary = dst.isVirtual ? primary(dst) : primary(dst) - 1;\n\t\t\tconst sc = crossCenter(src);\n\t\t\tconst dc = crossCenter(dst);\n\t\t\tif (i === 0) pushPoint(points, isLR, srcPrimary, sc);\n\t\t\tif (sc !== dc) {\n\t\t\t\tpushPoint(points, isLR, track, sc);\n\t\t\t\tpushPoint(points, isLR, track, dc);\n\t\t\t}\n\t\t\tpushPoint(points, isLR, dstPrimary, dc);\n\t\t}\n\t\tconst chain = hops[0]!;\n\t\tout.push({\n\t\t\tfrom: chain.chainFrom,\n\t\t\tto: chain.chainTo,\n\t\t\tpoints: dedupWaypoints(points),\n\t\t});\n\t}\n\treturn out;\n}\n\nfunction pushPoint(acc: LayoutEdgePoint[], isLR: boolean, primary: number, cross: number): void {\n\tacc.push(isLR ? { x: primary, y: cross } : { x: cross, y: primary });\n}\n\nfunction dedupWaypoints(points: readonly LayoutEdgePoint[]): LayoutEdgePoint[] {\n\tconst out: LayoutEdgePoint[] = [];\n\tfor (const p of points) {\n\t\tconst last = out[out.length - 1];\n\t\tif (!last || last.x !== p.x || last.y !== p.y) out.push(p);\n\t}\n\treturn out;\n}\n\n// ---------------------------------------------------------------------------\n// Bounding box\n// ---------------------------------------------------------------------------\n\nfunction boundingBox(state: PipelineState): { width: number; height: number } {\n\tlet w = 0;\n\tlet h = 0;\n\tfor (const layer of state.layers) {\n\t\tfor (const n of layer) {\n\t\t\tw = Math.max(w, n.x + n.w);\n\t\t\th = Math.max(h, n.y + n.h);\n\t\t}\n\t}\n\treturn { width: w, height: h };\n}\n","/**\n * `graphSpecToAscii(g, opts?)` — stdout-native DAG flowchart renderer for a\n * {@link GraphDescribeOutput}.\n *\n * Zero external dependencies, graph-size independent via proper Sugiyama\n * (layer assignment → virtual-node splitting → barycenter crossing\n * minimization → median-aligned coordinate assignment → per-gutter\n * track-assigned orthogonal routing). See\n * [_layout-sugiyama.ts](./_layout-sugiyama.ts) for the layout pipeline and\n * [_ascii-grid.ts](./_ascii-grid.ts) for the character blitter.\n *\n * Pure function over the describe snapshot; no Graph instance dependency.\n *\n * @category extra\n */\n\nimport type { GraphDescribeOutput } from \"@graphrefly/pure-ts/graph\";\nimport { renderGrid } from \"./_ascii-grid.js\";\nimport { countCells, truncateToCells } from \"./_ascii-width.js\";\nimport type { LayoutDirection } from \"./_layout-sugiyama.js\";\nimport { sugiyamaLayout } from \"./_layout-sugiyama.js\";\n\nconst DEFAULT_LABEL_WIDTH = 24;\nconst LAYER_GAP = 4;\nconst NODE_GAP = 1;\nconst BOX_HEIGHT = 3;\n\nexport type GraphSpecToAsciiOptions = {\n\t/**\n\t * ASCII layout direction. ASCII grid semantics are meaningful only for\n\t * `\"LR\"` (default) and `\"TD\"`.\n\t */\n\tdirection?: LayoutDirection;\n\t/** Per-box label cell cap; longer labels are truncated with `…`. Default `24`. */\n\tmaxLabelWidth?: number;\n\t/** Glyph set: `\"unicode\"` (default, box-drawing) or `\"ascii\"` (`-|+<>v`). */\n\tasciiCharset?: \"unicode\" | \"ascii\";\n\t/** Optional logger hook; fires with the rendered text before return. */\n\tlogger?: (text: string) => void;\n};\n\nexport function graphSpecToAscii(g: GraphDescribeOutput, opts?: GraphSpecToAsciiOptions): string {\n\tconst direction = normalizeAsciiDirection(opts?.direction);\n\tconst maxLabel = Math.max(3, opts?.maxLabelWidth ?? DEFAULT_LABEL_WIDTH);\n\tconst charset = opts?.asciiCharset ?? \"unicode\";\n\n\t// Deterministic paths ordering — match the rest of describe rendering.\n\tconst paths = Object.keys(g.nodes).sort();\n\t// Drop edges whose endpoints aren't in the current visible path set\n\t// (respects actor filtering that the caller already applied).\n\tconst nodeSet = new Set(paths);\n\tconst edges = g.edges.filter((e) => nodeSet.has(e.from) && nodeSet.has(e.to));\n\n\t// Precompute truncated labels + cell widths so the layout knows box\n\t// dimensions without re-measuring.\n\tconst labels = new Map<string, string>();\n\tconst widths = new Map<string, number>();\n\tfor (const p of paths) {\n\t\tconst label = truncateToCells(p, maxLabel);\n\t\tlabels.set(p, label);\n\t\t// Box width = label cells + 2 side borders + 2 cells of padding.\n\t\twidths.set(p, countCells(label) + 4);\n\t}\n\n\tconst layout = sugiyamaLayout({\n\t\tnodes: paths,\n\t\tedges,\n\t\twidthCells: (id) => widths.get(id) ?? 3,\n\t\theightCells: () => BOX_HEIGHT,\n\t\tlayerGap: LAYER_GAP,\n\t\tnodeGap: NODE_GAP,\n\t\tdirection,\n\t});\n\n\tconst text = renderGrid(layout, {\n\t\tcharset,\n\t\tlabelOf: (id) => labels.get(id) ?? id,\n\t});\n\n\topts?.logger?.(text);\n\treturn text;\n}\n\nfunction normalizeAsciiDirection(direction: unknown): LayoutDirection {\n\tif (direction === undefined || direction === \"LR\") return \"LR\";\n\tif (direction === \"TD\") return \"TD\";\n\t// BT / RL are valid for the vector diagram formats but ASCII grid\n\t// semantics are meaningful only for LR and TD — reject early with a\n\t// clear message rather than silently ignoring.\n\tthrow new Error(`ascii describe supports direction \"LR\" or \"TD\" only; got ${String(direction)}`);\n}\n","/**\n * Internal helpers shared across renderers in `extra/render/`.\n *\n * These are pure functions over `GraphDescribeOutput` — no Graph instance\n * dependency. Extracted from `src/graph/graph.ts` (the consolidated\n * ex-dumpGraph / ex-graphSpecToMermaid / ex-graphSpecToD2 renderers) per\n * Tier 2.1 A2.\n */\n\nimport type { GraphDescribeOutput } from \"@graphrefly/pure-ts/graph\";\n\n/** Direction options for diagram exports. */\nexport type DiagramDirection = \"TD\" | \"LR\" | \"BT\" | \"RL\";\n\n/** Recursively sort object keys for deterministic JSON (git-diffable). */\nexport function sortJsonValue(value: unknown): unknown {\n\tif (value === null || typeof value !== \"object\") {\n\t\treturn value;\n\t}\n\tif (Array.isArray(value)) {\n\t\treturn value.map(sortJsonValue);\n\t}\n\tconst obj = value as Record<string, unknown>;\n\tconst keys = Object.keys(obj).sort();\n\tconst out: Record<string, unknown> = {};\n\tfor (const k of keys) {\n\t\tout[k] = sortJsonValue(obj[k]);\n\t}\n\treturn out;\n}\n\n/** Escape characters that are illegal inside a quoted Mermaid label. */\nexport function escapeMermaidLabel(value: string): string {\n\treturn value.replaceAll(\"\\\\\", \"\\\\\\\\\").replaceAll('\"', '\\\\\"');\n}\n\n/** Escape characters that are illegal inside a quoted D2 label. */\nexport function escapeD2Label(value: string): string {\n\treturn value.replaceAll(\"\\\\\", \"\\\\\\\\\").replaceAll('\"', '\\\\\"');\n}\n\n/** Map our 4-direction enum to D2's `direction:` keyword. */\nexport function d2DirectionFromGraphDirection(direction: DiagramDirection): string {\n\tif (direction === \"TD\") return \"down\";\n\tif (direction === \"BT\") return \"up\";\n\tif (direction === \"RL\") return \"left\";\n\treturn \"right\";\n}\n\n/** Collect deduplicated (from, to) arrows from deps + edges. */\nexport function collectDiagramArrows(described: GraphDescribeOutput): [string, string][] {\n\tconst seen = new Set<string>();\n\tconst arrows: [string, string][] = [];\n\tfunction add(from: string, to: string): void {\n\t\tconst key = `${from}\\0${to}`;\n\t\tif (seen.has(key)) return;\n\t\tseen.add(key);\n\t\tarrows.push([from, to]);\n\t}\n\tfor (const [path, info] of Object.entries(described.nodes)) {\n\t\tconst deps: string[] | undefined = (info as Record<string, unknown>).deps as\n\t\t\t| string[]\n\t\t\t| undefined;\n\t\tif (deps) {\n\t\t\tfor (const dep of deps) add(dep, path);\n\t\t}\n\t}\n\tfor (const edge of described.edges) add(edge.from, edge.to);\n\treturn arrows;\n}\n\n/** Default to \"LR\"; throw on unknown values to surface caller bugs early. */\nexport function normalizeDiagramDirection(direction: unknown): DiagramDirection {\n\tif (direction === undefined) return \"LR\";\n\tif (direction === \"TD\" || direction === \"LR\" || direction === \"BT\" || direction === \"RL\") {\n\t\treturn direction;\n\t}\n\tthrow new Error(\n\t\t`invalid diagram direction ${String(direction)}; expected one of: TD, LR, BT, RL`,\n\t);\n}\n\n/** JSON-aware single-value formatter (used by `graphSpecToPretty`). */\nexport function describeData(value: unknown): string {\n\tif (typeof value === \"string\") return JSON.stringify(value);\n\tif (typeof value === \"number\" || typeof value === \"boolean\" || value == null)\n\t\treturn String(value);\n\ttry {\n\t\treturn JSON.stringify(value);\n\t} catch {\n\t\treturn \"[unserializable]\";\n\t}\n}\n","/**\n * `graphSpecToD2(g, opts?)` — render a {@link GraphDescribeOutput} as D2\n * diagram text.\n *\n * Pure function over the describe snapshot; no Graph instance dependency.\n *\n * @category extra\n */\n\nimport type { GraphDescribeOutput } from \"@graphrefly/pure-ts/graph\";\nimport {\n\tcollectDiagramArrows,\n\ttype DiagramDirection,\n\td2DirectionFromGraphDirection,\n\tescapeD2Label,\n\tnormalizeDiagramDirection,\n} from \"./_internal.js\";\n\nexport type GraphSpecToD2Options = {\n\t/** Diagram direction; default `\"LR\"`. */\n\tdirection?: DiagramDirection;\n};\n\nexport function graphSpecToD2(g: GraphDescribeOutput, opts?: GraphSpecToD2Options): string {\n\tconst direction = normalizeDiagramDirection(opts?.direction);\n\tconst paths = Object.keys(g.nodes).sort();\n\tconst ids = new Map<string, string>();\n\tfor (let i = 0; i < paths.length; i += 1) ids.set(paths[i]!, `n${i}`);\n\tconst lines: string[] = [`direction: ${d2DirectionFromGraphDirection(direction)}`];\n\tfor (const path of paths) {\n\t\tconst id = ids.get(path)!;\n\t\tlines.push(`${id}: \"${escapeD2Label(path)}\"`);\n\t}\n\tfor (const [from, to] of collectDiagramArrows(g)) {\n\t\tconst fromId = ids.get(from);\n\t\tconst toId = ids.get(to);\n\t\tif (!fromId || !toId) continue;\n\t\tlines.push(`${fromId} -> ${toId}`);\n\t}\n\treturn lines.join(\"\\n\");\n}\n","/**\n * `graphSpecToJson(g, opts?)` — render a {@link GraphDescribeOutput} as\n * deterministic JSON text with sorted keys.\n *\n * Pure function over the describe snapshot; no Graph instance dependency.\n *\n * @category extra\n */\n\nimport type { GraphDescribeOutput } from \"@graphrefly/pure-ts/graph\";\nimport { sortJsonValue } from \"./_internal.js\";\n\nexport type GraphSpecToJsonOptions = {\n\t/** Include the Edges section (default `true`). */\n\tincludeEdges?: boolean;\n\t/** Include the Subgraphs section (default `true`). */\n\tincludeSubgraphs?: boolean;\n\t/** JSON indent (default `2`). */\n\tindent?: number;\n\t/** Optional logger hook; fires with the rendered text before return. */\n\tlogger?: (text: string) => void;\n};\n\nexport function graphSpecToJson(g: GraphDescribeOutput, opts?: GraphSpecToJsonOptions): string {\n\tconst includeEdges = opts?.includeEdges ?? true;\n\tconst includeSubgraphs = opts?.includeSubgraphs ?? true;\n\tconst { expand: _expand, ...rest } = g;\n\tconst payload: GraphDescribeOutput = {\n\t\t...rest,\n\t\tedges: includeEdges ? g.edges : [],\n\t\tsubgraphs: includeSubgraphs ? g.subgraphs : [],\n\t};\n\tconst text = JSON.stringify(sortJsonValue(payload), null, opts?.indent ?? 2);\n\topts?.logger?.(text);\n\treturn text;\n}\n","/**\n * `graphSpecToMermaid(g, opts?)` — render a {@link GraphDescribeOutput} as\n * Mermaid flowchart text.\n *\n * Pure function over the describe snapshot; no Graph instance dependency.\n * Compose with `derived` for live formatted output:\n *\n * ```ts\n * import { graphSpecToMermaid } from \"@graphrefly/graphrefly/extra/render\";\n * import { derived } from \"@graphrefly/graphrefly\";\n *\n * const live = derived(\n * [graph.describe({ reactive: true }).node],\n * ([g]) => graphSpecToMermaid(g),\n * );\n * ```\n *\n * @category extra\n */\n\nimport type { GraphDescribeOutput } from \"@graphrefly/pure-ts/graph\";\nimport {\n\tcollectDiagramArrows,\n\ttype DiagramDirection,\n\tescapeMermaidLabel,\n\tnormalizeDiagramDirection,\n} from \"./_internal.js\";\n\nexport type GraphSpecToMermaidOptions = {\n\t/** Diagram direction; default `\"LR\"`. */\n\tdirection?: DiagramDirection;\n};\n\nexport function graphSpecToMermaid(\n\tg: GraphDescribeOutput,\n\topts?: GraphSpecToMermaidOptions,\n): string {\n\tconst direction = normalizeDiagramDirection(opts?.direction);\n\tconst paths = Object.keys(g.nodes).sort();\n\tconst ids = new Map<string, string>();\n\tfor (let i = 0; i < paths.length; i += 1) ids.set(paths[i]!, `n${i}`);\n\tconst lines: string[] = [`flowchart ${direction}`];\n\tfor (const path of paths) {\n\t\tconst id = ids.get(path)!;\n\t\tlines.push(` ${id}[\"${escapeMermaidLabel(path)}\"]`);\n\t}\n\tfor (const [from, to] of collectDiagramArrows(g)) {\n\t\tconst fromId = ids.get(from);\n\t\tconst toId = ids.get(to);\n\t\tif (!fromId || !toId) continue;\n\t\tlines.push(` ${fromId} --> ${toId}`);\n\t}\n\treturn lines.join(\"\\n\");\n}\n","/**\n * `graphSpecToMermaidUrl(g, opts?)` — encode a {@link GraphDescribeOutput}\n * as a `https://mermaid.live/edit#base64:…` deep link.\n *\n * Round-trip with the mermaid.live editor's `/edit#base64:` share format —\n * payload is `base64url(JSON({code, mermaid: {theme}, ...}))`. No network\n * calls; the payload is encoded into the URL fragment.\n *\n * @category extra\n */\n\nimport type { GraphDescribeOutput } from \"@graphrefly/pure-ts/graph\";\nimport { type GraphSpecToMermaidOptions, graphSpecToMermaid } from \"./graph-spec-to-mermaid.js\";\n\nexport type MermaidLiveTheme = \"default\" | \"dark\" | \"forest\" | \"neutral\" | \"base\";\n\nexport type GraphSpecToMermaidUrlOptions = GraphSpecToMermaidOptions & {\n\ttheme?: MermaidLiveTheme;\n\tautoSync?: boolean;\n};\n\n/**\n * Encode an arbitrary mermaid source string to a `mermaid.live` deep link.\n * Exported separately so callers that already rendered mermaid text can\n * upgrade to a live-editor URL without re-rendering.\n */\nexport function mermaidLiveUrl(\n\tmermaidSrc: string,\n\topts?: { theme?: MermaidLiveTheme; autoSync?: boolean },\n): string {\n\tconst theme = opts?.theme ?? \"default\";\n\tconst autoSync = opts?.autoSync ?? true;\n\tconst payload = { code: mermaidSrc, mermaid: { theme }, autoSync };\n\tconst json = JSON.stringify(payload);\n\t// Browsers + Node both expose globalThis.btoa; encode UTF-8 bytes first so\n\t// non-ASCII node names don't explode btoa. Then url-safe base64 (`+/=`→`-_` strip).\n\tconst bytes = new TextEncoder().encode(json);\n\tlet binary = \"\";\n\tfor (let i = 0; i < bytes.length; i++) binary += String.fromCharCode(bytes[i]!);\n\tconst b64 = globalThis.btoa(binary).replace(/\\+/g, \"-\").replace(/\\//g, \"_\").replace(/=+$/, \"\");\n\treturn `https://mermaid.live/edit#base64:${b64}`;\n}\n\nexport function graphSpecToMermaidUrl(\n\tg: GraphDescribeOutput,\n\topts?: GraphSpecToMermaidUrlOptions,\n): string {\n\tconst mermaidSrc = graphSpecToMermaid(g, opts);\n\treturn mermaidLiveUrl(mermaidSrc, opts);\n}\n","/**\n * `graphSpecToPretty(g, opts?)` — render a {@link GraphDescribeOutput} as\n * human-readable plaintext (Node list with values, plus optional Edges and\n * Subgraphs sections).\n *\n * Pure function over the describe snapshot; no Graph instance dependency.\n *\n * @category extra\n */\n\nimport type { GraphDescribeOutput } from \"@graphrefly/pure-ts/graph\";\nimport { describeData } from \"./_internal.js\";\n\nexport type GraphSpecToPrettyOptions = {\n\t/** Include the Edges section (default `true`). */\n\tincludeEdges?: boolean;\n\t/** Include the Subgraphs section (default `true`). */\n\tincludeSubgraphs?: boolean;\n\t/** Optional logger hook; fires with the rendered text before return. */\n\tlogger?: (text: string) => void;\n};\n\nexport function graphSpecToPretty(g: GraphDescribeOutput, opts?: GraphSpecToPrettyOptions): string {\n\tconst includeEdges = opts?.includeEdges ?? true;\n\tconst includeSubgraphs = opts?.includeSubgraphs ?? true;\n\tconst lines: string[] = [];\n\tlines.push(`Graph ${g.name}`);\n\tlines.push(\"Nodes:\");\n\tfor (const path of Object.keys(g.nodes).sort()) {\n\t\tconst n = g.nodes[path]!;\n\t\tlines.push(`- ${path} (${n.type}/${n.status}): ${describeData(n.value)}`);\n\t}\n\tif (includeEdges) {\n\t\tlines.push(\"Edges:\");\n\t\tfor (const edge of g.edges) {\n\t\t\tlines.push(`- ${edge.from} -> ${edge.to}`);\n\t\t}\n\t}\n\tif (includeSubgraphs) {\n\t\tlines.push(\"Subgraphs:\");\n\t\tfor (const sg of g.subgraphs) {\n\t\t\tlines.push(`- ${sg}`);\n\t\t}\n\t}\n\tconst text = lines.join(\"\\n\");\n\topts?.logger?.(text);\n\treturn text;\n}\n","/**\n * `layoutFrameToSvg(frame, opts?)` — render a {@link LayoutFrame} as an SVG\n * markup string.\n *\n * Universal-safe — emits a string, not a DOM tree. Browser code embeds via\n * `el.innerHTML = svg`; Node code writes to a file. Cell-grid coordinates from\n * the layout are scaled by `cellWidth` / `cellHeight` (default 12 × 18 px,\n * roughly matching a monospace baseline).\n *\n * Each box gets `data-id=\"<path>\"` for change-event highlighting; each edge\n * gets `data-from=\"<from>\" data-to=\"<to>\"` so renderers can animate flowing\n * data per `LayoutFrame.changes`.\n *\n * @category extra\n */\n\nimport type { LayoutFrame } from \"./layout-types.js\";\n\nexport interface LayoutFrameToSvgOptions {\n\t/** Pixel width of one cell. Default: `12`. */\n\treadonly cellWidth?: number;\n\t/** Pixel height of one cell. Default: `18`. */\n\treadonly cellHeight?: number;\n\t/** Outer margin in pixels. Default: `16`. */\n\treadonly padding?: number;\n\t/** Box stroke color. Default: `\"#444\"`. */\n\treadonly boxStroke?: string;\n\t/** Box fill color. Default: `\"#fff\"`. */\n\treadonly boxFill?: string;\n\t/** Edge stroke color. Default: `\"#888\"`. */\n\treadonly edgeStroke?: string;\n\t/** Box label text color. Default: `\"#111\"`. */\n\treadonly textColor?: string;\n\t/** Font family. Default: `\"ui-monospace, monospace\"`. */\n\treadonly fontFamily?: string;\n\t/** Font size in pixels. Default: `12`. */\n\treadonly fontSize?: number;\n}\n\nconst SPECIAL_CHARS: Record<string, string> = {\n\t\"&\": \"&amp;\",\n\t\"<\": \"&lt;\",\n\t\">\": \"&gt;\",\n\t'\"': \"&quot;\",\n\t\"'\": \"&apos;\",\n};\n\nfunction escapeXml(s: string): string {\n\treturn s.replace(/[&<>\"']/g, (c) => SPECIAL_CHARS[c] ?? c);\n}\n\n/**\n * Render a {@link LayoutFrame} to SVG markup. Pure function — call from\n * `derived` to drive a live `<svg>` element from a `topologyView` output.\n */\nexport function layoutFrameToSvg(frame: LayoutFrame, opts?: LayoutFrameToSvgOptions): string {\n\tconst cellW = opts?.cellWidth ?? 12;\n\tconst cellH = opts?.cellHeight ?? 18;\n\tconst pad = opts?.padding ?? 16;\n\t// /qa F-10: route option-bag string attributes through escapeXml so that\n\t// user-supplied themes (URL params, dashboard config, etc.) cannot inject\n\t// `\"/><script>...` and break out of the attribute. Numeric `fontSize` has\n\t// no XSS surface; escape only when caller passes a string.\n\tconst boxStroke = escapeXml(opts?.boxStroke ?? \"#444\");\n\tconst boxFill = escapeXml(opts?.boxFill ?? \"#fff\");\n\tconst edgeStroke = escapeXml(opts?.edgeStroke ?? \"#888\");\n\tconst textColor = escapeXml(opts?.textColor ?? \"#111\");\n\tconst fontFamily = opts?.fontFamily ?? \"ui-monospace, monospace\";\n\tconst fontSize = opts?.fontSize ?? 12;\n\n\tlet maxX = 0;\n\tlet maxY = 0;\n\tfor (const b of frame.boxes) {\n\t\tmaxX = Math.max(maxX, b.x + b.w);\n\t\tmaxY = Math.max(maxY, b.y + b.h);\n\t}\n\tfor (const e of frame.edges) {\n\t\tfor (const [x, y] of e.points) {\n\t\t\tmaxX = Math.max(maxX, x);\n\t\t\tmaxY = Math.max(maxY, y);\n\t\t}\n\t}\n\tconst width = Math.max(1, maxX) * cellW + pad * 2;\n\tconst height = Math.max(1, maxY) * cellH + pad * 2;\n\n\tconst lines: string[] = [];\n\tlines.push(\n\t\t`<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 ${width} ${height}\" width=\"${width}\" height=\"${height}\">`,\n\t);\n\n\t// Edges first (so boxes overlay them at endpoints).\n\tfor (const e of frame.edges) {\n\t\tif (e.points.length < 2) continue;\n\t\tconst pts = e.points.map(([x, y]) => `${x * cellW + pad},${y * cellH + pad}`).join(\" \");\n\t\tlines.push(\n\t\t\t` <polyline points=\"${pts}\" fill=\"none\" stroke=\"${edgeStroke}\" stroke-width=\"1\" data-from=\"${escapeXml(e.from)}\" data-to=\"${escapeXml(e.to)}\" data-dep-index=\"${e.depIndex}\" />`,\n\t\t);\n\t}\n\n\t// Boxes.\n\tfor (const b of frame.boxes) {\n\t\tconst px = b.x * cellW + pad;\n\t\tconst py = b.y * cellH + pad;\n\t\tconst pw = Math.max(1, b.w) * cellW;\n\t\tconst ph = Math.max(1, b.h) * cellH;\n\t\t// Local segment for label so deeply-mounted nodes stay readable.\n\t\tconst local = b.id.includes(\"::\") ? (b.id.split(\"::\").pop() ?? b.id) : b.id;\n\t\tlines.push(\n\t\t\t` <g data-id=\"${escapeXml(b.id)}\">`,\n\t\t\t` <rect x=\"${px}\" y=\"${py}\" width=\"${pw}\" height=\"${ph}\" fill=\"${boxFill}\" stroke=\"${boxStroke}\" stroke-width=\"1\" />`,\n\t\t\t` <text x=\"${px + pw / 2}\" y=\"${py + ph / 2}\" fill=\"${textColor}\" font-family=\"${escapeXml(fontFamily)}\" font-size=\"${fontSize}\" text-anchor=\"middle\" dominant-baseline=\"central\">${escapeXml(local)}</text>`,\n\t\t\t` </g>`,\n\t\t);\n\t}\n\n\tlines.push(\"</svg>\");\n\treturn lines.join(\"\\n\");\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACYO,SAAS,UAAU,MAAyB;AAElD,MACE,QAAQ,OAAU,QAAQ;AAAA,EAC1B,QAAQ,QAAU,QAAQ;AAAA,EAC1B,QAAQ,QAAU,QAAQ;AAAA,EAC1B,QAAQ,QAAU,QAAQ;AAAA,EAC1B,QAAQ,QAAU,QAAQ;AAAA,EAC1B,QAAQ,QAAU,SAAS;AAAA,EAC3B,QAAQ,QAAU,QAAQ;AAAA,EAC1B,QAAQ,QAAU,QAAQ;AAAA,EAC1B,QAAQ,QAAU,QAAQ;AAAA,EAC1B,QAAQ,QAAU,QAAQ;AAAA,EAC1B,QAAQ,QAAU,QAAQ;AAAA,EAC1B,QAAQ,QAAU,QAAQ;AAAA,EAC1B,QAAQ,QAAU,QAAQ;AAAA,EAC1B,QAAQ,QAAU,QAAQ;AAAA,EAC1B,QAAQ,QAAU,QAAQ;AAAA,EAC1B,QAAQ,QAAU,QAAQ;AAAA,EAC1B,QAAQ,QAAU,QAAQ;AAAA,EAC1B,QAAQ,QAAU,QAAQ;AAAA,EAC1B,QAAQ,QAAU,QAAQ;AAAA,EAC1B,QAAQ,QAAU,QAA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AAE,EAAE,CAAC,qBAAqB,EAAE,QAAQ;AAAA,IAC5K;AAAA,EACD;AAGA,aAAW,KAAK,MAAM,OAAO;AAC5B,UAAM,KAAK,EAAE,IAAI,QAAQ;AACzB,UAAM,KAAK,EAAE,IAAI,QAAQ;AACzB,UAAM,KAAK,KAAK,IAAI,GAAG,EAAE,CAAC,IAAI;AAC9B,UAAM,KAAK,KAAK,IAAI,GAAG,EAAE,CAAC,IAAI;AAE9B,UAAM,QAAQ,EAAE,GAAG,SAAS,IAAI,IAAK,EAAE,GAAG,MAAM,IAAI,EAAE,IAAI,KAAK,EAAE,KAAM,EAAE;AACzE,UAAM;AAAA,MACL,iBAAiB,UAAU,EAAE,EAAE,CAAC;AAAA,MAChC,gBAAgB,EAAE,QAAQ,EAAE,YAAY,EAAE,aAAa,EAAE,WAAW,OAAO,aAAa,SAAS;AAAA,MACjG,gBAAgB,KAAK,KAAK,CAAC,QAAQ,KAAK,KAAK,CAAC,WAAW,SAAS,kBAAkB,UAAU,UAAU,CAAC,gBAAgB,QAAQ,sDAAsD,UAAU,KAAK,CAAC;AAAA,MACvM;AAAA,IACD;AAAA,EACD;AAEA,QAAM,KAAK,QAAQ;AACnB,SAAO,MAAM,KAAK,IAAI;AACvB;","names":[]}
@@ -0,0 +1,227 @@
1
+ import { GraphDescribeOutput } from '@graphrefly/pure-ts/graph';
2
+ import { c as LayoutFrame } from '../../layout-types-B5aiHYgk.cjs';
3
+
4
+ /**
5
+ * Internal helpers shared across renderers in `extra/render/`.
6
+ *
7
+ * These are pure functions over `GraphDescribeOutput` — no Graph instance
8
+ * dependency. Extracted from `src/graph/graph.ts` (the consolidated
9
+ * ex-dumpGraph / ex-graphSpecToMermaid / ex-graphSpecToD2 renderers) per
10
+ * Tier 2.1 A2.
11
+ */
12
+
13
+ /** Direction options for diagram exports. */
14
+ type DiagramDirection = "TD" | "LR" | "BT" | "RL";
15
+
16
+ /**
17
+ * Sugiyama-style layered DAG layout on an integer grid.
18
+ *
19
+ * Pipeline:
20
+ * 1. Longest-path layer assignment (sources at layer 0).
21
+ * 2. Virtual-node splitting — every edge spanning more than one layer
22
+ * becomes a chain of synthetic nodes on intermediate layers. Downstream
23
+ * passes treat real and virtual nodes identically; crossing
24
+ * minimization therefore works on wide + deep DAGs, not only
25
+ * adjacent-layer cases.
26
+ * 3. Crossing minimization — barycenter heuristic with alternating up /
27
+ * down sweeps plus an adjacent-transposition polish pass.
28
+ * 4. Coordinate assignment — greedy median-aligned packing with collision
29
+ * resolution. Straightens vertical runs of virtual nodes so long edges
30
+ * become straight lines where topology allows.
31
+ * 5. Orthogonal edge routing — per-gutter x-track assignment; horizontal
32
+ * segments sit at endpoint centerlines, vertical segments pack into the
33
+ * gutter column range without overlap. Remaining crossings are
34
+ * topologically unavoidable and will render as `┼` at draw time.
35
+ *
36
+ * Output coordinates are cell-grid integers (LR direction). TD rendering
37
+ * swaps axes at draw time — the layout is direction-agnostic by
38
+ * construction.
39
+ *
40
+ * Used only by [graph-spec-to-ascii.ts](./graph-spec-to-ascii.ts); not part of the public
41
+ * `extra/render/index.ts` surface (underscore-prefixed).
42
+ */
43
+ type LayoutDirection = "LR" | "TD";
44
+
45
+ /**
46
+ * `graphSpecToAscii(g, opts?)` — stdout-native DAG flowchart renderer for a
47
+ * {@link GraphDescribeOutput}.
48
+ *
49
+ * Zero external dependencies, graph-size independent via proper Sugiyama
50
+ * (layer assignment → virtual-node splitting → barycenter crossing
51
+ * minimization → median-aligned coordinate assignment → per-gutter
52
+ * track-assigned orthogonal routing). See
53
+ * [_layout-sugiyama.ts](./_layout-sugiyama.ts) for the layout pipeline and
54
+ * [_ascii-grid.ts](./_ascii-grid.ts) for the character blitter.
55
+ *
56
+ * Pure function over the describe snapshot; no Graph instance dependency.
57
+ *
58
+ * @category extra
59
+ */
60
+
61
+ type GraphSpecToAsciiOptions = {
62
+ /**
63
+ * ASCII layout direction. ASCII grid semantics are meaningful only for
64
+ * `"LR"` (default) and `"TD"`.
65
+ */
66
+ direction?: LayoutDirection;
67
+ /** Per-box label cell cap; longer labels are truncated with `…`. Default `24`. */
68
+ maxLabelWidth?: number;
69
+ /** Glyph set: `"unicode"` (default, box-drawing) or `"ascii"` (`-|+<>v`). */
70
+ asciiCharset?: "unicode" | "ascii";
71
+ /** Optional logger hook; fires with the rendered text before return. */
72
+ logger?: (text: string) => void;
73
+ };
74
+ declare function graphSpecToAscii(g: GraphDescribeOutput, opts?: GraphSpecToAsciiOptions): string;
75
+
76
+ /**
77
+ * `graphSpecToD2(g, opts?)` — render a {@link GraphDescribeOutput} as D2
78
+ * diagram text.
79
+ *
80
+ * Pure function over the describe snapshot; no Graph instance dependency.
81
+ *
82
+ * @category extra
83
+ */
84
+
85
+ type GraphSpecToD2Options = {
86
+ /** Diagram direction; default `"LR"`. */
87
+ direction?: DiagramDirection;
88
+ };
89
+ declare function graphSpecToD2(g: GraphDescribeOutput, opts?: GraphSpecToD2Options): string;
90
+
91
+ /**
92
+ * `graphSpecToJson(g, opts?)` — render a {@link GraphDescribeOutput} as
93
+ * deterministic JSON text with sorted keys.
94
+ *
95
+ * Pure function over the describe snapshot; no Graph instance dependency.
96
+ *
97
+ * @category extra
98
+ */
99
+
100
+ type GraphSpecToJsonOptions = {
101
+ /** Include the Edges section (default `true`). */
102
+ includeEdges?: boolean;
103
+ /** Include the Subgraphs section (default `true`). */
104
+ includeSubgraphs?: boolean;
105
+ /** JSON indent (default `2`). */
106
+ indent?: number;
107
+ /** Optional logger hook; fires with the rendered text before return. */
108
+ logger?: (text: string) => void;
109
+ };
110
+ declare function graphSpecToJson(g: GraphDescribeOutput, opts?: GraphSpecToJsonOptions): string;
111
+
112
+ /**
113
+ * `graphSpecToMermaid(g, opts?)` — render a {@link GraphDescribeOutput} as
114
+ * Mermaid flowchart text.
115
+ *
116
+ * Pure function over the describe snapshot; no Graph instance dependency.
117
+ * Compose with `derived` for live formatted output:
118
+ *
119
+ * ```ts
120
+ * import { graphSpecToMermaid } from "@graphrefly/graphrefly/extra/render";
121
+ * import { derived } from "@graphrefly/graphrefly";
122
+ *
123
+ * const live = derived(
124
+ * [graph.describe({ reactive: true }).node],
125
+ * ([g]) => graphSpecToMermaid(g),
126
+ * );
127
+ * ```
128
+ *
129
+ * @category extra
130
+ */
131
+
132
+ type GraphSpecToMermaidOptions = {
133
+ /** Diagram direction; default `"LR"`. */
134
+ direction?: DiagramDirection;
135
+ };
136
+ declare function graphSpecToMermaid(g: GraphDescribeOutput, opts?: GraphSpecToMermaidOptions): string;
137
+
138
+ /**
139
+ * `graphSpecToMermaidUrl(g, opts?)` — encode a {@link GraphDescribeOutput}
140
+ * as a `https://mermaid.live/edit#base64:…` deep link.
141
+ *
142
+ * Round-trip with the mermaid.live editor's `/edit#base64:` share format —
143
+ * payload is `base64url(JSON({code, mermaid: {theme}, ...}))`. No network
144
+ * calls; the payload is encoded into the URL fragment.
145
+ *
146
+ * @category extra
147
+ */
148
+
149
+ type MermaidLiveTheme = "default" | "dark" | "forest" | "neutral" | "base";
150
+ type GraphSpecToMermaidUrlOptions = GraphSpecToMermaidOptions & {
151
+ theme?: MermaidLiveTheme;
152
+ autoSync?: boolean;
153
+ };
154
+ /**
155
+ * Encode an arbitrary mermaid source string to a `mermaid.live` deep link.
156
+ * Exported separately so callers that already rendered mermaid text can
157
+ * upgrade to a live-editor URL without re-rendering.
158
+ */
159
+ declare function mermaidLiveUrl(mermaidSrc: string, opts?: {
160
+ theme?: MermaidLiveTheme;
161
+ autoSync?: boolean;
162
+ }): string;
163
+ declare function graphSpecToMermaidUrl(g: GraphDescribeOutput, opts?: GraphSpecToMermaidUrlOptions): string;
164
+
165
+ /**
166
+ * `graphSpecToPretty(g, opts?)` — render a {@link GraphDescribeOutput} as
167
+ * human-readable plaintext (Node list with values, plus optional Edges and
168
+ * Subgraphs sections).
169
+ *
170
+ * Pure function over the describe snapshot; no Graph instance dependency.
171
+ *
172
+ * @category extra
173
+ */
174
+
175
+ type GraphSpecToPrettyOptions = {
176
+ /** Include the Edges section (default `true`). */
177
+ includeEdges?: boolean;
178
+ /** Include the Subgraphs section (default `true`). */
179
+ includeSubgraphs?: boolean;
180
+ /** Optional logger hook; fires with the rendered text before return. */
181
+ logger?: (text: string) => void;
182
+ };
183
+ declare function graphSpecToPretty(g: GraphDescribeOutput, opts?: GraphSpecToPrettyOptions): string;
184
+
185
+ /**
186
+ * `layoutFrameToSvg(frame, opts?)` — render a {@link LayoutFrame} as an SVG
187
+ * markup string.
188
+ *
189
+ * Universal-safe — emits a string, not a DOM tree. Browser code embeds via
190
+ * `el.innerHTML = svg`; Node code writes to a file. Cell-grid coordinates from
191
+ * the layout are scaled by `cellWidth` / `cellHeight` (default 12 × 18 px,
192
+ * roughly matching a monospace baseline).
193
+ *
194
+ * Each box gets `data-id="<path>"` for change-event highlighting; each edge
195
+ * gets `data-from="<from>" data-to="<to>"` so renderers can animate flowing
196
+ * data per `LayoutFrame.changes`.
197
+ *
198
+ * @category extra
199
+ */
200
+
201
+ interface LayoutFrameToSvgOptions {
202
+ /** Pixel width of one cell. Default: `12`. */
203
+ readonly cellWidth?: number;
204
+ /** Pixel height of one cell. Default: `18`. */
205
+ readonly cellHeight?: number;
206
+ /** Outer margin in pixels. Default: `16`. */
207
+ readonly padding?: number;
208
+ /** Box stroke color. Default: `"#444"`. */
209
+ readonly boxStroke?: string;
210
+ /** Box fill color. Default: `"#fff"`. */
211
+ readonly boxFill?: string;
212
+ /** Edge stroke color. Default: `"#888"`. */
213
+ readonly edgeStroke?: string;
214
+ /** Box label text color. Default: `"#111"`. */
215
+ readonly textColor?: string;
216
+ /** Font family. Default: `"ui-monospace, monospace"`. */
217
+ readonly fontFamily?: string;
218
+ /** Font size in pixels. Default: `12`. */
219
+ readonly fontSize?: number;
220
+ }
221
+ /**
222
+ * Render a {@link LayoutFrame} to SVG markup. Pure function — call from
223
+ * `derived` to drive a live `<svg>` element from a `topologyView` output.
224
+ */
225
+ declare function layoutFrameToSvg(frame: LayoutFrame, opts?: LayoutFrameToSvgOptions): string;
226
+
227
+ export { type DiagramDirection, type GraphSpecToAsciiOptions, type GraphSpecToD2Options, type GraphSpecToJsonOptions, type GraphSpecToMermaidOptions, type GraphSpecToMermaidUrlOptions, type GraphSpecToPrettyOptions, type LayoutDirection, type LayoutFrameToSvgOptions, type MermaidLiveTheme, graphSpecToAscii, graphSpecToD2, graphSpecToJson, graphSpecToMermaid, graphSpecToMermaidUrl, graphSpecToPretty, layoutFrameToSvg, mermaidLiveUrl };