@graphty/graph-io 0.3.46 → 0.3.48

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 (460) hide show
  1. package/dist/chunks/{approximations-wWjCRzKj.js → approximations-C2riR4NT.js} +2 -2
  2. package/dist/chunks/{approximations-wWjCRzKj.js.map → approximations-C2riR4NT.js.map} +1 -1
  3. package/dist/chunks/{block-DiGq58c3.js → block-Cu22ewuS.js} +92 -21
  4. package/dist/chunks/block-Cu22ewuS.js.map +1 -0
  5. package/dist/chunks/{choose--jM0yYCo.js → choose-Cdx6Enl2.js} +3 -3
  6. package/dist/chunks/{choose--jM0yYCo.js.map → choose-Cdx6Enl2.js.map} +1 -1
  7. package/dist/chunks/codes-CV_Bhcyi.js +153 -0
  8. package/dist/chunks/codes-CV_Bhcyi.js.map +1 -0
  9. package/dist/chunks/{constants-BKwqelYD.js → constants-D0LqcsLJ.js} +2 -2
  10. package/dist/chunks/{constants-BKwqelYD.js.map → constants-D0LqcsLJ.js.map} +1 -1
  11. package/dist/chunks/context-cgmmOxZ2.js +663 -0
  12. package/dist/chunks/context-cgmmOxZ2.js.map +1 -0
  13. package/dist/chunks/credentials-BiQsnMTb.js +347 -0
  14. package/dist/chunks/credentials-BiQsnMTb.js.map +1 -0
  15. package/dist/chunks/cx-export-BEeF6ymo.js +259 -0
  16. package/dist/chunks/cx-export-BEeF6ymo.js.map +1 -0
  17. package/dist/chunks/descriptor-BJ-W0Jd-.js +137 -0
  18. package/dist/chunks/descriptor-BJ-W0Jd-.js.map +1 -0
  19. package/dist/chunks/descriptor-C-YDhtsn.js +48 -0
  20. package/dist/chunks/descriptor-C-YDhtsn.js.map +1 -0
  21. package/dist/chunks/{emit-CwU8cUmG.js → emit-CD8xnY8s.js} +70 -10
  22. package/dist/chunks/emit-CD8xnY8s.js.map +1 -0
  23. package/dist/chunks/{escape-CgzxiYPg.js → escape-DH2Egt-l.js} +12 -12
  24. package/dist/chunks/{escape-CgzxiYPg.js.map → escape-DH2Egt-l.js.map} +1 -1
  25. package/dist/chunks/{export-BvqAXCKh.js → export-CZ7VRm4I.js} +53 -1443
  26. package/dist/chunks/export-CZ7VRm4I.js.map +1 -0
  27. package/dist/chunks/{exporter-DndFlGSa.js → exporter-BIdaoIgh.js} +7 -6
  28. package/dist/chunks/{exporter-DndFlGSa.js.map → exporter-BIdaoIgh.js.map} +1 -1
  29. package/dist/chunks/{exporter-CJgfhF-l.js → exporter-ChjL5fmP.js} +8 -7
  30. package/dist/chunks/{exporter-CJgfhF-l.js.map → exporter-ChjL5fmP.js.map} +1 -1
  31. package/dist/chunks/{exporter--Mk9gXCJ.js → exporter-Dcw7Ldtq.js} +6 -4
  32. package/dist/chunks/{exporter--Mk9gXCJ.js.map → exporter-Dcw7Ldtq.js.map} +1 -1
  33. package/dist/chunks/exporter-DtVU80Fa.js +1008 -0
  34. package/dist/chunks/exporter-DtVU80Fa.js.map +1 -0
  35. package/dist/chunks/{exporter-CrDWIyiq.js → exporter-bxxjOrDZ.js} +11 -9
  36. package/dist/chunks/{exporter-CrDWIyiq.js.map → exporter-bxxjOrDZ.js.map} +1 -1
  37. package/dist/chunks/format-BMS-1Nxb.js +64 -0
  38. package/dist/chunks/format-BMS-1Nxb.js.map +1 -0
  39. package/dist/chunks/{generic-Dq1ntt9q.js → generic-CP6YD34u.js} +4 -4
  40. package/dist/chunks/{generic-Dq1ntt9q.js.map → generic-CP6YD34u.js.map} +1 -1
  41. package/dist/chunks/{importer-DiZRmOQG.js → importer-B87_fmVx.js} +13 -17
  42. package/dist/chunks/importer-B87_fmVx.js.map +1 -0
  43. package/dist/chunks/{importer-BSvfrX_h.js → importer-Bji2MeWr.js} +18 -1014
  44. package/dist/chunks/importer-Bji2MeWr.js.map +1 -0
  45. package/dist/chunks/{importer-COTK9Tsl.js → importer-CB_zV5_L.js} +14 -11
  46. package/dist/chunks/importer-CB_zV5_L.js.map +1 -0
  47. package/dist/chunks/{importer-e6LGpqHB.js → importer-CVT-JyDE.js} +12 -9
  48. package/dist/chunks/importer-CVT-JyDE.js.map +1 -0
  49. package/dist/chunks/{importer-yh_aBCU6.js → importer-Cyy6UseH.js} +7 -6
  50. package/dist/chunks/{importer-yh_aBCU6.js.map → importer-Cyy6UseH.js.map} +1 -1
  51. package/dist/chunks/{importer-iFYPEKaJ.js → importer-DPZDN40-.js} +14 -10
  52. package/dist/chunks/{importer-iFYPEKaJ.js.map → importer-DPZDN40-.js.map} +1 -1
  53. package/dist/chunks/{importer-CMmeMWlC.js → importer-e3huMZbm.js} +8 -260
  54. package/dist/chunks/importer-e3huMZbm.js.map +1 -0
  55. package/dist/chunks/input-Ccg9I22A.js +1397 -0
  56. package/dist/chunks/input-Ccg9I22A.js.map +1 -0
  57. package/dist/chunks/{json-elements-DJZRZ6jd.js → json-elements-By172SVq.js} +4 -4
  58. package/dist/chunks/{json-elements-DJZRZ6jd.js.map → json-elements-By172SVq.js.map} +1 -1
  59. package/dist/chunks/{lexicon-CT69Kd87.js → lexicon-u2SI5xcx.js} +19 -5
  60. package/dist/chunks/lexicon-u2SI5xcx.js.map +1 -0
  61. package/dist/chunks/{ontology-export-G4MqRdux.js → ontology-export-BwgMyuF0.js} +4 -3
  62. package/dist/chunks/{ontology-export-G4MqRdux.js.map → ontology-export-BwgMyuF0.js.map} +1 -1
  63. package/dist/chunks/{records-CiaWZrFH.js → records-Cgvxz-Vx.js} +2 -2
  64. package/dist/chunks/{records-CiaWZrFH.js.map → records-Cgvxz-Vx.js.map} +1 -1
  65. package/dist/chunks/{format-BpQBx8MZ.js → report-CgdsL9Hb.js} +72 -129
  66. package/dist/chunks/report-CgdsL9Hb.js.map +1 -0
  67. package/dist/chunks/sigv4-LkAzsLAu.js +247 -0
  68. package/dist/chunks/sigv4-LkAzsLAu.js.map +1 -0
  69. package/dist/chunks/{styles-BQnsga7p.js → styles-CaABMoO1.js} +76 -43
  70. package/dist/chunks/styles-CaABMoO1.js.map +1 -0
  71. package/dist/chunks/{styles-D3fRphrO.js → styles-P_gmFAOi.js} +101 -21
  72. package/dist/chunks/styles-P_gmFAOi.js.map +1 -0
  73. package/dist/chunks/{styles-yed-BF5x3_Y5.js → styles-yed-Cs1nmrjn.js} +60 -20
  74. package/dist/chunks/styles-yed-Cs1nmrjn.js.map +1 -0
  75. package/dist/chunks/{text-CzJNFOS9.js → text-BuKQVMz2.js} +2 -2
  76. package/dist/chunks/{text-CzJNFOS9.js.map → text-BuKQVMz2.js.map} +1 -1
  77. package/dist/chunks/{writer-DMKvthQE.js → writer-DvHTl36J.js} +5 -4
  78. package/dist/chunks/writer-DvHTl36J.js.map +1 -0
  79. package/dist/csv.js +7 -5
  80. package/dist/csv.js.map +1 -1
  81. package/dist/cx.js +5 -4
  82. package/dist/cx.js.map +1 -1
  83. package/dist/cx2.js +2 -2
  84. package/dist/cys.js +1 -1
  85. package/dist/dot.js +2 -2
  86. package/dist/gexf.js +7 -5
  87. package/dist/gexf.js.map +1 -1
  88. package/dist/gml.js +16 -13
  89. package/dist/gml.js.map +1 -1
  90. package/dist/graph-io.js +1181 -224
  91. package/dist/graph-io.js.map +1 -1
  92. package/dist/graphml.js +3 -3
  93. package/dist/json.js +1 -1
  94. package/dist/neo4j.js +6 -4
  95. package/dist/neo4j.js.map +1 -1
  96. package/dist/obo.js +1 -1
  97. package/dist/pajek.js +1 -1
  98. package/dist/sources-cypher.d.ts +1 -0
  99. package/dist/sources-cypher.js +1236 -0
  100. package/dist/sources-cypher.js.map +1 -0
  101. package/dist/sources-ndex.d.ts +1 -0
  102. package/dist/sources-ndex.js +278 -0
  103. package/dist/sources-ndex.js.map +1 -0
  104. package/dist/sources-rest.d.ts +1 -0
  105. package/dist/sources-rest.js +1367 -0
  106. package/dist/sources-rest.js.map +1 -0
  107. package/dist/src/common/report.d.ts +6 -3
  108. package/dist/src/common/report.d.ts.map +1 -1
  109. package/dist/src/common/report.js +15 -9
  110. package/dist/src/common/report.js.map +1 -1
  111. package/dist/src/formats/cx/styles.d.ts.map +1 -1
  112. package/dist/src/formats/cx/styles.js +1 -0
  113. package/dist/src/formats/cx/styles.js.map +1 -1
  114. package/dist/src/formats/dot/styles.d.ts.map +1 -1
  115. package/dist/src/formats/dot/styles.js +3 -1
  116. package/dist/src/formats/dot/styles.js.map +1 -1
  117. package/dist/src/formats/gexf/styles.d.ts +29 -12
  118. package/dist/src/formats/gexf/styles.d.ts.map +1 -1
  119. package/dist/src/formats/gexf/styles.js +160 -31
  120. package/dist/src/formats/gexf/styles.js.map +1 -1
  121. package/dist/src/formats/gml/styles.d.ts.map +1 -1
  122. package/dist/src/formats/gml/styles.js +5 -4
  123. package/dist/src/formats/gml/styles.js.map +1 -1
  124. package/dist/src/formats/graphml/styles-plain.d.ts.map +1 -1
  125. package/dist/src/formats/graphml/styles-plain.js +3 -3
  126. package/dist/src/formats/graphml/styles-plain.js.map +1 -1
  127. package/dist/src/formats/graphml/styles-yed.d.ts.map +1 -1
  128. package/dist/src/formats/graphml/styles-yed.js +89 -19
  129. package/dist/src/formats/graphml/styles-yed.js.map +1 -1
  130. package/dist/src/formats/pajek/styles.d.ts.map +1 -1
  131. package/dist/src/formats/pajek/styles.js +1 -0
  132. package/dist/src/formats/pajek/styles.js.map +1 -1
  133. package/dist/src/formats/xgmml/styles.d.ts.map +1 -1
  134. package/dist/src/formats/xgmml/styles.js +1 -0
  135. package/dist/src/formats/xgmml/styles.js.map +1 -1
  136. package/dist/src/index.d.ts +8 -1
  137. package/dist/src/index.d.ts.map +1 -1
  138. package/dist/src/index.js +9 -1
  139. package/dist/src/index.js.map +1 -1
  140. package/dist/src/registry.d.ts +173 -1
  141. package/dist/src/registry.d.ts.map +1 -1
  142. package/dist/src/registry.js +196 -1
  143. package/dist/src/registry.js.map +1 -1
  144. package/dist/src/sources/builtins.d.ts +11 -0
  145. package/dist/src/sources/builtins.d.ts.map +1 -0
  146. package/dist/src/sources/builtins.js +47 -0
  147. package/dist/src/sources/builtins.js.map +1 -0
  148. package/dist/src/sources/codes.d.ts +230 -0
  149. package/dist/src/sources/codes.d.ts.map +1 -0
  150. package/dist/src/sources/codes.js +58 -0
  151. package/dist/src/sources/codes.js.map +1 -0
  152. package/dist/src/sources/context.d.ts +112 -0
  153. package/dist/src/sources/context.d.ts.map +1 -0
  154. package/dist/src/sources/context.js +739 -0
  155. package/dist/src/sources/context.js.map +1 -0
  156. package/dist/src/sources/credentials.d.ts +179 -0
  157. package/dist/src/sources/credentials.d.ts.map +1 -0
  158. package/dist/src/sources/credentials.js +301 -0
  159. package/dist/src/sources/credentials.js.map +1 -0
  160. package/dist/src/sources/cypher/descriptor.d.ts +21 -0
  161. package/dist/src/sources/cypher/descriptor.d.ts.map +1 -0
  162. package/dist/src/sources/cypher/descriptor.js +119 -0
  163. package/dist/src/sources/cypher/descriptor.js.map +1 -0
  164. package/dist/src/sources/cypher/flatten.d.ts +72 -0
  165. package/dist/src/sources/cypher/flatten.d.ts.map +1 -0
  166. package/dist/src/sources/cypher/flatten.js +279 -0
  167. package/dist/src/sources/cypher/flatten.js.map +1 -0
  168. package/dist/src/sources/cypher/index.d.ts +33 -0
  169. package/dist/src/sources/cypher/index.d.ts.map +1 -0
  170. package/dist/src/sources/cypher/index.js +405 -0
  171. package/dist/src/sources/cypher/index.js.map +1 -0
  172. package/dist/src/sources/cypher/params.d.ts +40 -0
  173. package/dist/src/sources/cypher/params.d.ts.map +1 -0
  174. package/dist/src/sources/cypher/params.js +6 -0
  175. package/dist/src/sources/cypher/params.js.map +1 -0
  176. package/dist/src/sources/cypher/profiles.d.ts +44 -0
  177. package/dist/src/sources/cypher/profiles.d.ts.map +1 -0
  178. package/dist/src/sources/cypher/profiles.js +61 -0
  179. package/dist/src/sources/cypher/profiles.js.map +1 -0
  180. package/dist/src/sources/cypher/query-builder.d.ts +106 -0
  181. package/dist/src/sources/cypher/query-builder.d.ts.map +1 -0
  182. package/dist/src/sources/cypher/query-builder.js +236 -0
  183. package/dist/src/sources/cypher/query-builder.js.map +1 -0
  184. package/dist/src/sources/cypher/transports/bolt.d.ts +21 -0
  185. package/dist/src/sources/cypher/transports/bolt.d.ts.map +1 -0
  186. package/dist/src/sources/cypher/transports/bolt.js +185 -0
  187. package/dist/src/sources/cypher/transports/bolt.js.map +1 -0
  188. package/dist/src/sources/cypher/transports/neptune-analytics.d.ts +15 -0
  189. package/dist/src/sources/cypher/transports/neptune-analytics.d.ts.map +1 -0
  190. package/dist/src/sources/cypher/transports/neptune-analytics.js +38 -0
  191. package/dist/src/sources/cypher/transports/neptune-analytics.js.map +1 -0
  192. package/dist/src/sources/cypher/transports/neptune-https.d.ts +31 -0
  193. package/dist/src/sources/cypher/transports/neptune-https.d.ts.map +1 -0
  194. package/dist/src/sources/cypher/transports/neptune-https.js +104 -0
  195. package/dist/src/sources/cypher/transports/neptune-https.js.map +1 -0
  196. package/dist/src/sources/cypher/transports/query-api.d.ts +14 -0
  197. package/dist/src/sources/cypher/transports/query-api.d.ts.map +1 -0
  198. package/dist/src/sources/cypher/transports/query-api.js +80 -0
  199. package/dist/src/sources/cypher/transports/query-api.js.map +1 -0
  200. package/dist/src/sources/cypher/transports/transport.d.ts +78 -0
  201. package/dist/src/sources/cypher/transports/transport.d.ts.map +1 -0
  202. package/dist/src/sources/cypher/transports/transport.js +77 -0
  203. package/dist/src/sources/cypher/transports/transport.js.map +1 -0
  204. package/dist/src/sources/cypher/types-map.d.ts +91 -0
  205. package/dist/src/sources/cypher/types-map.d.ts.map +1 -0
  206. package/dist/src/sources/cypher/types-map.js +306 -0
  207. package/dist/src/sources/cypher/types-map.js.map +1 -0
  208. package/dist/src/sources/define.d.ts +47 -0
  209. package/dist/src/sources/define.d.ts.map +1 -0
  210. package/dist/src/sources/define.js +173 -0
  211. package/dist/src/sources/define.js.map +1 -0
  212. package/dist/src/sources/fail.d.ts +33 -0
  213. package/dist/src/sources/fail.d.ts.map +1 -0
  214. package/dist/src/sources/fail.js +49 -0
  215. package/dist/src/sources/fail.js.map +1 -0
  216. package/dist/src/sources/ids.d.ts +64 -0
  217. package/dist/src/sources/ids.d.ts.map +1 -0
  218. package/dist/src/sources/ids.js +64 -0
  219. package/dist/src/sources/ids.js.map +1 -0
  220. package/dist/src/sources/ndex/client.d.ts +31 -0
  221. package/dist/src/sources/ndex/client.d.ts.map +1 -0
  222. package/dist/src/sources/ndex/client.js +90 -0
  223. package/dist/src/sources/ndex/client.js.map +1 -0
  224. package/dist/src/sources/ndex/descriptor.d.ts +10 -0
  225. package/dist/src/sources/ndex/descriptor.d.ts.map +1 -0
  226. package/dist/src/sources/ndex/descriptor.js +55 -0
  227. package/dist/src/sources/ndex/descriptor.js.map +1 -0
  228. package/dist/src/sources/ndex/expand.d.ts +20 -0
  229. package/dist/src/sources/ndex/expand.d.ts.map +1 -0
  230. package/dist/src/sources/ndex/expand.js +87 -0
  231. package/dist/src/sources/ndex/expand.js.map +1 -0
  232. package/dist/src/sources/ndex/index.d.ts +25 -0
  233. package/dist/src/sources/ndex/index.d.ts.map +1 -0
  234. package/dist/src/sources/ndex/index.js +191 -0
  235. package/dist/src/sources/ndex/index.js.map +1 -0
  236. package/dist/src/sources/ndex/params.d.ts +17 -0
  237. package/dist/src/sources/ndex/params.d.ts.map +1 -0
  238. package/dist/src/sources/ndex/params.js +6 -0
  239. package/dist/src/sources/ndex/params.js.map +1 -0
  240. package/dist/src/sources/ndex/share-url.d.ts +40 -0
  241. package/dist/src/sources/ndex/share-url.d.ts.map +1 -0
  242. package/dist/src/sources/ndex/share-url.js +64 -0
  243. package/dist/src/sources/ndex/share-url.js.map +1 -0
  244. package/dist/src/sources/params.d.ts +28 -0
  245. package/dist/src/sources/params.d.ts.map +1 -0
  246. package/dist/src/sources/params.js +6 -0
  247. package/dist/src/sources/params.js.map +1 -0
  248. package/dist/src/sources/registry.d.ts +118 -0
  249. package/dist/src/sources/registry.d.ts.map +1 -0
  250. package/dist/src/sources/registry.js +193 -0
  251. package/dist/src/sources/registry.js.map +1 -0
  252. package/dist/src/sources/rest/descriptor.d.ts +16 -0
  253. package/dist/src/sources/rest/descriptor.d.ts.map +1 -0
  254. package/dist/src/sources/rest/descriptor.js +71 -0
  255. package/dist/src/sources/rest/descriptor.js.map +1 -0
  256. package/dist/src/sources/rest/index.d.ts +14 -0
  257. package/dist/src/sources/rest/index.d.ts.map +1 -0
  258. package/dist/src/sources/rest/index.js +13 -0
  259. package/dist/src/sources/rest/index.js.map +1 -0
  260. package/dist/src/sources/rest/mapping.d.ts +30 -0
  261. package/dist/src/sources/rest/mapping.d.ts.map +1 -0
  262. package/dist/src/sources/rest/mapping.js +362 -0
  263. package/dist/src/sources/rest/mapping.js.map +1 -0
  264. package/dist/src/sources/rest/openalex.d.ts +27 -0
  265. package/dist/src/sources/rest/openalex.d.ts.map +1 -0
  266. package/dist/src/sources/rest/openalex.js +269 -0
  267. package/dist/src/sources/rest/openalex.js.map +1 -0
  268. package/dist/src/sources/rest/paging.d.ts +53 -0
  269. package/dist/src/sources/rest/paging.d.ts.map +1 -0
  270. package/dist/src/sources/rest/paging.js +138 -0
  271. package/dist/src/sources/rest/paging.js.map +1 -0
  272. package/dist/src/sources/rest/params.d.ts +216 -0
  273. package/dist/src/sources/rest/params.d.ts.map +1 -0
  274. package/dist/src/sources/rest/params.js +7 -0
  275. package/dist/src/sources/rest/params.js.map +1 -0
  276. package/dist/src/sources/rest/records.d.ts +41 -0
  277. package/dist/src/sources/rest/records.d.ts.map +1 -0
  278. package/dist/src/sources/rest/records.js +240 -0
  279. package/dist/src/sources/rest/records.js.map +1 -0
  280. package/dist/src/sources/rest/samples/deps-dev.d.ts +10 -0
  281. package/dist/src/sources/rest/samples/deps-dev.d.ts.map +1 -0
  282. package/dist/src/sources/rest/samples/deps-dev.js +47 -0
  283. package/dist/src/sources/rest/samples/deps-dev.js.map +1 -0
  284. package/dist/src/sources/rest/samples/string.d.ts +9 -0
  285. package/dist/src/sources/rest/samples/string.d.ts.map +1 -0
  286. package/dist/src/sources/rest/samples/string.js +42 -0
  287. package/dist/src/sources/rest/samples/string.js.map +1 -0
  288. package/dist/src/sources/rest/selectors.d.ts +41 -0
  289. package/dist/src/sources/rest/selectors.d.ts.map +1 -0
  290. package/dist/src/sources/rest/selectors.js +81 -0
  291. package/dist/src/sources/rest/selectors.js.map +1 -0
  292. package/dist/src/sources/rest/source.d.ts +67 -0
  293. package/dist/src/sources/rest/source.d.ts.map +1 -0
  294. package/dist/src/sources/rest/source.js +635 -0
  295. package/dist/src/sources/rest/source.js.map +1 -0
  296. package/dist/src/sources/rest/templates.d.ts +38 -0
  297. package/dist/src/sources/rest/templates.d.ts.map +1 -0
  298. package/dist/src/sources/rest/templates.js +125 -0
  299. package/dist/src/sources/rest/templates.js.map +1 -0
  300. package/dist/src/sources/run.d.ts +93 -0
  301. package/dist/src/sources/run.d.ts.map +1 -0
  302. package/dist/src/sources/run.js +673 -0
  303. package/dist/src/sources/run.js.map +1 -0
  304. package/dist/src/sources/sha256.d.ts +12 -0
  305. package/dist/src/sources/sha256.d.ts.map +1 -0
  306. package/dist/src/sources/sha256.js +95 -0
  307. package/dist/src/sources/sha256.js.map +1 -0
  308. package/dist/src/sources/sigv4.d.ts +24 -0
  309. package/dist/src/sources/sigv4.d.ts.map +1 -0
  310. package/dist/src/sources/sigv4.js +182 -0
  311. package/dist/src/sources/sigv4.js.map +1 -0
  312. package/dist/src/sources/testing.d.ts +96 -0
  313. package/dist/src/sources/testing.d.ts.map +1 -0
  314. package/dist/src/sources/testing.js +138 -0
  315. package/dist/src/sources/testing.js.map +1 -0
  316. package/dist/src/sources/types.d.ts +665 -0
  317. package/dist/src/sources/types.d.ts.map +1 -0
  318. package/dist/src/sources/types.js +10 -0
  319. package/dist/src/sources/types.js.map +1 -0
  320. package/dist/src/styles/canon/enums.d.ts.map +1 -1
  321. package/dist/src/styles/canon/enums.js +1 -0
  322. package/dist/src/styles/canon/enums.js.map +1 -1
  323. package/dist/src/styles/cyjs/cascade.d.ts.map +1 -1
  324. package/dist/src/styles/cyjs/cascade.js +68 -2
  325. package/dist/src/styles/cyjs/cascade.js.map +1 -1
  326. package/dist/src/styles/cyjs/defaults-table.d.ts.map +1 -1
  327. package/dist/src/styles/cyjs/defaults-table.js +2 -0
  328. package/dist/src/styles/cyjs/defaults-table.js.map +1 -1
  329. package/dist/src/styles/cyjs/emit.d.ts.map +1 -1
  330. package/dist/src/styles/cyjs/emit.js +18 -7
  331. package/dist/src/styles/cyjs/emit.js.map +1 -1
  332. package/dist/src/styles/cyjs/mappers.d.ts +4 -1
  333. package/dist/src/styles/cyjs/mappers.d.ts.map +1 -1
  334. package/dist/src/styles/cyjs/mappers.js +2 -0
  335. package/dist/src/styles/cyjs/mappers.js.map +1 -1
  336. package/dist/src/styles/cytoscape/emit.d.ts.map +1 -1
  337. package/dist/src/styles/cytoscape/emit.js +59 -7
  338. package/dist/src/styles/cytoscape/emit.js.map +1 -1
  339. package/dist/src/styles/cytoscape/lexicon.d.ts +6 -0
  340. package/dist/src/styles/cytoscape/lexicon.d.ts.map +1 -1
  341. package/dist/src/styles/cytoscape/lexicon.js +26 -2
  342. package/dist/src/styles/cytoscape/lexicon.js.map +1 -1
  343. package/dist/src/styles/cytoscape/resolve.d.ts +4 -1
  344. package/dist/src/styles/cytoscape/resolve.d.ts.map +1 -1
  345. package/dist/src/styles/cytoscape/resolve.js +10 -6
  346. package/dist/src/styles/cytoscape/resolve.js.map +1 -1
  347. package/dist/src/styles/cytoscape/translate.d.ts.map +1 -1
  348. package/dist/src/styles/cytoscape/translate.js +10 -10
  349. package/dist/src/styles/cytoscape/translate.js.map +1 -1
  350. package/dist/src/styles/defaults.d.ts +30 -0
  351. package/dist/src/styles/defaults.d.ts.map +1 -1
  352. package/dist/src/styles/defaults.js +45 -4
  353. package/dist/src/styles/defaults.js.map +1 -1
  354. package/dist/src/styles/io/block.d.ts.map +1 -1
  355. package/dist/src/styles/io/block.js +9 -0
  356. package/dist/src/styles/io/block.js.map +1 -1
  357. package/dist/src/styles/io/writer.d.ts.map +1 -1
  358. package/dist/src/styles/io/writer.js +7 -3
  359. package/dist/src/styles/io/writer.js.map +1 -1
  360. package/dist/src/styles/plan/resolve.d.ts +2 -1
  361. package/dist/src/styles/plan/resolve.d.ts.map +1 -1
  362. package/dist/src/styles/plan/resolve.js +13 -2
  363. package/dist/src/styles/plan/resolve.js.map +1 -1
  364. package/dist/src/styles/types.d.ts +19 -2
  365. package/dist/src/styles/types.d.ts.map +1 -1
  366. package/dist/src/styles/vocabulary.d.ts.map +1 -1
  367. package/dist/src/styles/vocabulary.js +15 -1
  368. package/dist/src/styles/vocabulary.js.map +1 -1
  369. package/dist/src/types.d.ts +19 -5
  370. package/dist/src/types.d.ts.map +1 -1
  371. package/dist/src/types.js.map +1 -1
  372. package/dist/styles.js +11 -11
  373. package/dist/xgmml.js +3 -3
  374. package/docs/samples/people.json +6 -0
  375. package/package.json +29 -4
  376. package/src/common/report.ts +27 -7
  377. package/src/formats/cx/styles.ts +1 -0
  378. package/src/formats/dot/styles.ts +3 -1
  379. package/src/formats/gexf/styles.ts +185 -37
  380. package/src/formats/gml/styles.ts +5 -4
  381. package/src/formats/graphml/styles-plain.ts +3 -9
  382. package/src/formats/graphml/styles-yed.ts +93 -20
  383. package/src/formats/pajek/styles.ts +1 -0
  384. package/src/formats/xgmml/styles.ts +1 -0
  385. package/src/index.ts +90 -0
  386. package/src/registry.ts +326 -1
  387. package/src/sources/builtins.ts +56 -0
  388. package/src/sources/codes.ts +235 -0
  389. package/src/sources/context.ts +893 -0
  390. package/src/sources/credentials.ts +409 -0
  391. package/src/sources/cypher/descriptor.ts +125 -0
  392. package/src/sources/cypher/flatten.ts +323 -0
  393. package/src/sources/cypher/index.ts +498 -0
  394. package/src/sources/cypher/params.ts +41 -0
  395. package/src/sources/cypher/profiles.ts +78 -0
  396. package/src/sources/cypher/query-builder.ts +294 -0
  397. package/src/sources/cypher/transports/bolt.ts +228 -0
  398. package/src/sources/cypher/transports/neptune-analytics.ts +41 -0
  399. package/src/sources/cypher/transports/neptune-https.ts +122 -0
  400. package/src/sources/cypher/transports/query-api.ts +100 -0
  401. package/src/sources/cypher/transports/transport.ts +139 -0
  402. package/src/sources/cypher/types-map.ts +418 -0
  403. package/src/sources/define.ts +195 -0
  404. package/src/sources/fail.ts +70 -0
  405. package/src/sources/ids.ts +74 -0
  406. package/src/sources/ndex/client.ts +102 -0
  407. package/src/sources/ndex/descriptor.ts +64 -0
  408. package/src/sources/ndex/expand.ts +100 -0
  409. package/src/sources/ndex/index.ts +235 -0
  410. package/src/sources/ndex/params.ts +17 -0
  411. package/src/sources/ndex/share-url.ts +84 -0
  412. package/src/sources/params.ts +29 -0
  413. package/src/sources/registry.ts +325 -0
  414. package/src/sources/rest/descriptor.ts +74 -0
  415. package/src/sources/rest/index.ts +22 -0
  416. package/src/sources/rest/mapping.ts +401 -0
  417. package/src/sources/rest/openalex.ts +288 -0
  418. package/src/sources/rest/paging.ts +180 -0
  419. package/src/sources/rest/params.ts +243 -0
  420. package/src/sources/rest/records.ts +289 -0
  421. package/src/sources/rest/samples/deps-dev.ts +49 -0
  422. package/src/sources/rest/samples/string.ts +44 -0
  423. package/src/sources/rest/selectors.ts +91 -0
  424. package/src/sources/rest/source.ts +760 -0
  425. package/src/sources/rest/templates.ts +151 -0
  426. package/src/sources/run.ts +793 -0
  427. package/src/sources/sha256.ts +99 -0
  428. package/src/sources/sigv4.ts +207 -0
  429. package/src/sources/testing.ts +210 -0
  430. package/src/sources/types.ts +741 -0
  431. package/src/styles/canon/enums.ts +1 -0
  432. package/src/styles/cyjs/cascade.ts +81 -2
  433. package/src/styles/cyjs/defaults-table.ts +2 -0
  434. package/src/styles/cyjs/emit.ts +18 -7
  435. package/src/styles/cyjs/mappers.ts +6 -1
  436. package/src/styles/cytoscape/emit.ts +61 -7
  437. package/src/styles/cytoscape/lexicon.ts +28 -2
  438. package/src/styles/cytoscape/resolve.ts +22 -6
  439. package/src/styles/cytoscape/translate.ts +11 -11
  440. package/src/styles/defaults.ts +93 -4
  441. package/src/styles/io/block.ts +10 -0
  442. package/src/styles/io/writer.ts +8 -3
  443. package/src/styles/plan/resolve.ts +14 -2
  444. package/src/styles/types.ts +28 -2
  445. package/src/styles/vocabulary.ts +15 -1
  446. package/src/types.ts +19 -5
  447. package/dist/chunks/block-DiGq58c3.js.map +0 -1
  448. package/dist/chunks/emit-CwU8cUmG.js.map +0 -1
  449. package/dist/chunks/export-BvqAXCKh.js.map +0 -1
  450. package/dist/chunks/format-BpQBx8MZ.js.map +0 -1
  451. package/dist/chunks/importer-BSvfrX_h.js.map +0 -1
  452. package/dist/chunks/importer-CMmeMWlC.js.map +0 -1
  453. package/dist/chunks/importer-COTK9Tsl.js.map +0 -1
  454. package/dist/chunks/importer-DiZRmOQG.js.map +0 -1
  455. package/dist/chunks/importer-e6LGpqHB.js.map +0 -1
  456. package/dist/chunks/lexicon-CT69Kd87.js.map +0 -1
  457. package/dist/chunks/styles-BQnsga7p.js.map +0 -1
  458. package/dist/chunks/styles-D3fRphrO.js.map +0 -1
  459. package/dist/chunks/styles-yed-BF5x3_Y5.js.map +0 -1
  460. package/dist/chunks/writer-DMKvthQE.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles-yed-Cs1nmrjn.js","sources":["../../src/styles/canon/bends.ts","../../src/formats/graphml/styles-yed.ts"],"sourcesContent":["/**\n * The neutral `bends` value of an edge: the points its route passes through between its two nodes, each relative to\n * the straight line from the source node's center to the target node's center. `along` is how far along that line\n * the point lies (0 at the source center, 1 at the target center) and `across` how far to its left, y up, both as\n * fractions of the line's length. Written `along,across` per point, in order from the source, separated by spaces:\n * `\"0,-0.5 1,-0.5\"` is a route that leaves the source, runs parallel to the line half its length to the right, and\n * comes back to the target. Relative, so a drawing that moves or scales the nodes keeps the route's shape and its\n * right angles.\n */\n\n/** A point in the file's own coordinates. */\nexport type BendPoint = readonly [x: number, y: number];\n\n/**\n * Rounds a fraction to 4 decimals, so a value spells the same whatever float noise the file's numbers carry.\n * @param v - the fraction\n * @returns its spelling\n */\nconst fraction = (v: number): string => String(Math.round(v * 1e4) / 1e4);\n\n/**\n * The `bends` value of an edge whose route passes through `points`.\n * @param source - the source node's center\n * @param target - the target node's center\n * @param points - the bend points, from the source end\n * @param yDown - true when the file's y axis points down (the value is always y up)\n * @returns the value, or null with no bends, no line between distinct centers, or a coordinate that is not finite\n * @category Styles\n */\nexport function canonBends(\n source: BendPoint,\n target: BendPoint,\n points: readonly BendPoint[],\n yDown: boolean,\n): string | null {\n const flip = yDown ? -1 : 1;\n const dx = target[0] - source[0];\n const dy = (target[1] - source[1]) * flip;\n const length2 = dx * dx + dy * dy;\n if (points.length === 0 || length2 <= 0 || !Number.isFinite(length2)) {\n return null;\n }\n const out: string[] = [];\n for (const [px, py] of points) {\n const rx = px - source[0];\n const ry = (py - source[1]) * flip;\n const along = (rx * dx + ry * dy) / length2;\n const across = (dx * ry - dy * rx) / length2;\n if (!Number.isFinite(along) || !Number.isFinite(across)) {\n return null;\n }\n out.push(`${fraction(along)},${fraction(across)}`);\n }\n return out.join(\" \");\n}\n\n/**\n * The bend points a `bends` value places between two node centers: the inverse of {@link canonBends}.\n * @param source - the source node's center\n * @param target - the target node's center\n * @param value - the `bends` value\n * @param yDown - true when the points are wanted in a y-down file's coordinates\n * @returns the points, or null when the value is not `along,across` pairs or a coordinate is not finite\n * @category Styles\n */\nexport function bendsToPoints(source: BendPoint, target: BendPoint, value: string, yDown: boolean): BendPoint[] | null {\n const flip = yDown ? -1 : 1;\n const dx = target[0] - source[0];\n const dy = (target[1] - source[1]) * flip;\n const out: BendPoint[] = [];\n for (const pair of value.trim().split(/\\s+/)) {\n const [a, c, extra] = pair.split(\",\").map(Number);\n if (extra !== undefined || !Number.isFinite(a) || !Number.isFinite(c)) {\n return null;\n }\n const x = source[0] + a * dx - c * dy;\n const y = source[1] + (a * dy + c * dx) * flip;\n if (!Number.isFinite(x) || !Number.isFinite(y)) {\n return null;\n }\n out.push([x, y]);\n }\n return out.length === 0 ? null : out;\n}\n","/**\n * yEd styles (yFiles for Java 2.x GraphML): reading every realizer a yEd graphics tree holds (`y:ShapeNode`,\n * `y:GenericNode`, `y:GroupNode`, `y:SVGNode`, `y:PolyLineEdge`, `y:BezierEdge`, ...) into the neutral style\n * vocabulary, and writing a graph's styles back as `y:ShapeNode` and `y:PolyLineEdge` graphics. The trees are the\n * json columns the GraphML importer keeps (tree.ts), never the typed `yfiles.*` columns read from them.\n *\n * The tree helpers here are shared with the yFiles 3 reader.\n */\n\nimport type { GraphSnapshot } from \"@graphty/graph-format\";\n\nimport { toFilePositions, toNeutral } from \"../../positions/convert.js\";\nimport type { PositionColumnExtra } from \"../../positions/types.js\";\nimport { type BendPoint, bendsToPoints, canonBends } from \"../../styles/canon/bends.js\";\nimport { canonColor, colorOpacity } from \"../../styles/canon/color.js\";\nimport { canonEnum } from \"../../styles/canon/enums.js\";\nimport { canonNumber } from \"../../styles/canon/number.js\";\nimport { type CanonSite, MAX_STYLE_VALUE_LENGTH, noteAt } from \"../../styles/canon/site.js\";\nimport { canonText } from \"../../styles/canon/text.js\";\nimport { STYLE_ISSUE } from \"../../styles/codes.js\";\nimport { StyleApproximations } from \"../../styles/io/approximations.js\";\nimport type { ExporterStyleInput } from \"../../styles/io/writer.js\";\nimport type { StyleNotes } from \"../../styles/notes.js\";\nimport { plainCell } from \"../../styles/plan/resolve.js\";\nimport type { StyleTarget, StyleValue, StyleWorkBudget, StyleWriteCapabilities } from \"../../styles/types.js\";\nimport type { LossNote } from \"../../types.js\";\n\n// ============================================================ the kept trees\n\n/** A tree object as tree.ts builds it: `@_<name>` attributes, `#text`, and child elements by name. */\ntype Tree = Record<string, unknown>;\n\n/**\n * Whether a value is a tree object.\n * @param value - the value\n * @returns true for a non-array object\n */\nexport function isTree(value: unknown): value is Tree {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\n/**\n * The local part of an element name: `y:ShapeNode` is `ShapeNode`, whatever the prefix.\n * @param name - the name as written\n * @returns the local name\n */\nexport function localOf(name: string): string {\n const colon = name.indexOf(\":\");\n return colon < 0 ? name : name.slice(colon + 1);\n}\n\n/**\n * The child elements of a tree node with a local name, in file order.\n * @param node - the tree node\n * @param local - the local name\n * @returns the children\n */\nexport function treeChildren(node: unknown, local: string): unknown[] {\n const out: unknown[] = [];\n if (!isTree(node)) {\n return out;\n }\n for (const key of Object.keys(node)) {\n if (key.startsWith(\"@_\") || key === \"#text\" || localOf(key) !== local) {\n continue;\n }\n const value = node[key];\n if (Array.isArray(value)) {\n for (const item of value) {\n out.push(item);\n }\n } else {\n out.push(value);\n }\n }\n return out;\n}\n\n/**\n * The first child element of a tree node with a local name.\n * @param node - the tree node\n * @param local - the local name\n * @returns the child, or undefined\n */\nexport function treeChild(node: unknown, local: string): unknown {\n if (!isTree(node)) {\n return undefined;\n }\n for (const key of Object.keys(node)) {\n if (!key.startsWith(\"@_\") && key !== \"#text\" && localOf(key) === local) {\n const value = node[key];\n return Array.isArray(value) ? value[0] : value;\n }\n }\n return undefined;\n}\n\n/**\n * An attribute of a tree node.\n * @param node - the tree node\n * @param name - the attribute name as written\n * @returns its text, or undefined\n */\nexport function treeAttr(node: unknown, name: string): string | undefined {\n if (!isTree(node) || !Object.hasOwn(node, `@_${name}`)) {\n return undefined;\n }\n const value = node[`@_${name}`];\n return typeof value === \"string\" ? value : undefined;\n}\n\n/**\n * The text of an element: the element itself when it has neither attributes nor children, else its `#text`.\n * @param node - the tree node\n * @returns the text, or null\n */\nexport function treeText(node: unknown): string | null {\n if (typeof node === \"string\") {\n return node;\n }\n if (isTree(node) && Object.hasOwn(node, \"#text\")) {\n const text = node[\"#text\"];\n return typeof text === \"string\" ? text : null;\n }\n return null;\n}\n\n/**\n * The json columns of a table holding yFiles trees.\n * @param table - the node, edge or graph table\n * @returns their names\n */\nfunction treeColumns(table: GraphSnapshot[\"nodes\"]): string[] {\n const out: string[] = [];\n for (const col of table) {\n if (col.dtype === \"json\" && col.meta.origin?.namespace === \"yfiles\") {\n out.push(col.meta.name);\n }\n }\n return out;\n}\n\n/**\n * Every column of a table the GraphML importer made from yFiles keys: the trees and the typed `yfiles.*` columns\n * read from them. They hold the styles themselves, so the planner never explains a style with them.\n * @param table - the node or edge table\n * @returns their names\n */\nexport function yfilesColumns(table: GraphSnapshot[\"nodes\"]): string[] {\n const out: string[] = [];\n for (const col of table) {\n if (col.meta.origin?.namespace === \"yfiles\") {\n out.push(col.meta.name);\n }\n }\n return out;\n}\n\n// ============================================================ reading\n\n/** One element's canonical value of a property; null leaves it unset. */\nexport type PutValue = (property: string, value: StyleValue | null) => void;\n\n/** Where a value of an element was read, by property. */\nexport type SiteOf = (property: string) => CanonSite;\n\n/** The yEd node realizers, by local name. */\nconst NODE_REALIZERS: ReadonlySet<string> = new Set([\n \"ShapeNode\",\n \"GenericNode\",\n \"GroupNode\",\n \"GenericGroupNode\",\n \"SVGNode\",\n \"ImageNode\",\n \"TableNode\",\n \"UMLClassNode\",\n \"UMLNoteNode\",\n \"ProxyAutoBoundsNode\",\n]);\n\n/** The yEd edge realizers, by local name. */\nconst EDGE_REALIZERS: ReadonlySet<string> = new Set([\n \"PolyLineEdge\",\n \"ArcEdge\",\n \"BezierEdge\",\n \"QuadCurveEdge\",\n \"SplineEdge\",\n \"GenericEdge\",\n]);\n\n/** A realizer: its local name and its element. */\ninterface Realizer {\n readonly type: string;\n readonly r: unknown;\n}\n\n/**\n * The realizer a graphics tree holds; a `y:ProxyAutoBoundsNode` (a folder or group) gives its active realizer.\n * @param tree - the `<data>` content\n * @param names - the realizer names of the target\n * @returns the realizer, or null\n */\nfunction realizerOf(tree: unknown, names: ReadonlySet<string>): Realizer | null {\n if (!isTree(tree)) {\n return null;\n }\n for (const key of Object.keys(tree)) {\n const type = localOf(key);\n if (key.startsWith(\"@_\") || !names.has(type)) {\n continue;\n }\n const value = tree[key];\n const r = Array.isArray(value) ? value[0] : value;\n return type === \"ProxyAutoBoundsNode\" ? activeRealizer(r) : { type, r };\n }\n return null;\n}\n\n/**\n * The active realizer of a `y:ProxyAutoBoundsNode`, else its first.\n * @param proxy - the proxy element\n * @returns the realizer, or null when it has none\n */\nfunction activeRealizer(proxy: unknown): Realizer | null {\n const realizers = treeChild(proxy, \"Realizers\");\n const all: Realizer[] = [];\n if (isTree(realizers)) {\n for (const k of Object.keys(realizers).filter((key) => !key.startsWith(\"@_\") && key !== \"#text\")) {\n for (const item of treeChildren(realizers, localOf(k))) {\n all.push({ type: localOf(k), r: item });\n }\n }\n }\n const active = Number(treeAttr(realizers, \"active\") ?? \"0\");\n return all[Number.isInteger(active) && active >= 0 && active < all.length ? active : 0] ?? null;\n}\n\n/**\n * yEd's flowchart palette (`com.yworks.flowchart.<name>`), by name, to the shape each draws. Matched whole, before\n * the words below: \"data\" is a parallelogram, but \"storedData\" and \"directData\" are not.\n */\nconst FLOWCHART_SHAPES: ReadonlyMap<string, string> = new Map([\n [\"process\", \"rectangle\"],\n [\"decision\", \"diamond\"],\n [\"terminator\", \"round-rectangle\"],\n [\"start1\", \"ellipse\"],\n [\"start2\", \"ellipse\"],\n [\"data\", \"parallelogram\"],\n [\"preparation\", \"hexagon\"],\n]);\n\nconst FLOWCHART_PREFIX = \"com.yworks.flowchart.\";\n\n/**\n * The shape a yEd flowchart configuration draws: a GraphML GenericNode's `configuration`, or a yEd GML node's\n * `customconfiguration`.\n * @param configuration - the configuration\n * @returns the neutral shape, or null for a configuration that is not one of the flowchart shapes known here\n */\nexport function flowchartShape(configuration: string): string | null {\n return configuration.startsWith(FLOWCHART_PREFIX)\n ? (FLOWCHART_SHAPES.get(configuration.slice(FLOWCHART_PREFIX.length)) ?? null)\n : null;\n}\n\n/** GenericNode configurations, by a word they contain, to the shape they draw; the first match wins. */\nconst GENERIC_SHAPES: readonly (readonly [string, string])[] = [\n [\"ellipse\", \"ellipse\"],\n [\"circle\", \"ellipse\"],\n [\"oval\", \"ellipse\"],\n [\"diamond\", \"diamond\"],\n [\"decision\", \"diamond\"],\n [\"hexagon\", \"hexagon\"],\n [\"octagon\", \"octagon\"],\n [\"triangle\", \"triangle\"],\n [\"rect\", \"rectangle\"],\n [\"process\", \"rectangle\"],\n [\"box\", \"rectangle\"],\n];\n\n/**\n * yEd's label positions (`modelPosition` of the internal, sides, sandwich, corners and eight-position models). The\n * internal model's `t` (inside the top of the box: a group's title) is `inside-top`; its other inside positions have\n * no neutral value and read as the nearest side or corner.\n */\nconst YED_POSITIONS: ReadonlyMap<string, string> = new Map([\n [\"c\", \"center\"],\n [\"t\", \"top\"],\n [\"b\", \"bottom\"],\n [\"l\", \"left\"],\n [\"r\", \"right\"],\n [\"tl\", \"top-left\"],\n [\"tr\", \"top-right\"],\n [\"bl\", \"bottom-left\"],\n [\"br\", \"bottom-right\"],\n [\"n\", \"top\"],\n [\"s\", \"bottom\"],\n [\"e\", \"right\"],\n [\"w\", \"left\"],\n [\"nw\", \"top-left\"],\n [\"ne\", \"top-right\"],\n [\"sw\", \"bottom-left\"],\n [\"se\", \"bottom-right\"],\n]);\n\n/** yEd's font styles, as label weight and italic. */\nexport const FONT_STYLES: ReadonlyMap<string, readonly [string, boolean]> = new Map([\n [\"plain\", [\"normal\", false]],\n [\"bold\", [\"bold\", false]],\n [\"italic\", [\"normal\", true]],\n [\"bolditalic\", [\"bold\", true]],\n]);\n\n/**\n * Reads a color into a property and its alpha into the property's opacity (or notes the alpha dropped).\n * @param raw - the attribute\n * @param property - the color property\n * @param opacity - its opacity property, or null when it has none\n * @param put - receives the values\n * @param at - the sites\n */\nfunction readColor(raw: unknown, property: string, opacity: string | null, put: PutValue, at: SiteOf): void {\n const c = canonColor(raw, \"yed\", at(property));\n if (c === null) {\n return;\n }\n put(property, c.color);\n const alpha = colorOpacity(c, null, at(property), opacity !== null);\n if (opacity !== null) {\n put(opacity, alpha);\n }\n}\n\n/**\n * Reads an element's label: the first visible label with text (yEd icon nodes put an empty, `hasText=\"false\"`\n * label first); further visible labels are noted for the element.\n * @param labels - the label elements, in file order\n * @param node - whether they are node labels (which have a position)\n * @param put - receives the values\n * @param at - the sites\n */\nfunction readLabels(labels: readonly unknown[], node: boolean, put: PutValue, at: SiteOf): void {\n let label: unknown = undefined;\n let text = \"\";\n let extra = 0;\n for (const l of labels) {\n const t = treeText(l)?.trim() ?? \"\";\n if (t.length === 0 || treeAttr(l, \"visible\") === \"false\" || treeAttr(l, \"hasText\") === \"false\") {\n continue;\n }\n if (label === undefined) {\n label = l;\n text = t;\n } else {\n extra++;\n }\n }\n if (label === undefined) {\n return;\n }\n if (extra > 0) {\n noteAt(at(\"label\"), STYLE_ISSUE.EXTRA_LABELS, `${String(extra + 1)} labels`);\n }\n put(\"label\", canonText(text, at(\"label\")));\n readLabelLook(label, node, put, at);\n}\n\n/**\n * Reads a label's look: its color, font and, for a node label, its position.\n * @param label - the label element\n * @param node - whether it is a node label\n * @param put - receives the values\n * @param at - the sites\n */\nfunction readLabelLook(label: unknown, node: boolean, put: PutValue, at: SiteOf): void {\n readColor(treeAttr(label, \"textColor\"), \"labelColor\", null, put, at);\n put(\"labelSize\", canonNumber(treeAttr(label, \"fontSize\"), at(\"labelSize\")));\n put(\"labelFont\", canonText(treeAttr(label, \"fontFamily\"), at(\"labelFont\")));\n const style = treeAttr(label, \"fontStyle\");\n if (style !== undefined) {\n const known = FONT_STYLES.get(style.trim().toLowerCase());\n if (known === undefined) {\n noteAt(at(\"labelWeight\"), STYLE_ISSUE.UNKNOWN_VALUE, style.slice(0, MAX_STYLE_VALUE_LENGTH));\n } else {\n put(\"labelWeight\", known[0]);\n put(\"labelItalic\", known[1]);\n }\n }\n if (node) {\n readLabelPosition(label, put, at);\n }\n}\n\n/**\n * Reads a node label's position: a `custom` label from its `y:SmartNodeLabelModelParameter`, any other from its\n * `modelPosition` (yEd's default model is `internal`).\n * @param label - the label element\n * @param put - receives the values\n * @param at - the sites\n */\nfunction readLabelPosition(label: unknown, put: PutValue, at: SiteOf): void {\n const model = treeAttr(label, \"modelName\")?.trim().toLowerCase() ?? \"internal\";\n if (model === \"custom\") {\n const smart = treeChild(treeChild(label, \"ModelParameter\"), \"SmartNodeLabelModelParameter\");\n if (smart === undefined) {\n noteAt(at(\"labelPosition\"), STYLE_ISSUE.UNKNOWN_VALUE, \"custom\");\n return;\n }\n put(\"labelPosition\", smartPosition(smart));\n return;\n }\n const position = treeAttr(label, \"modelPosition\");\n if (position === undefined) {\n return;\n }\n const key = position.trim().toLowerCase();\n const known = model === \"internal\" && key === \"t\" ? \"inside-top\" : YED_POSITIONS.get(key);\n if (known === undefined) {\n noteAt(at(\"labelPosition\"), STYLE_ISSUE.UNKNOWN_VALUE, position.slice(0, MAX_STYLE_VALUE_LENGTH));\n }\n put(\"labelPosition\", known ?? null);\n}\n\n/**\n * The nearest neutral position of a SmartNodeLabelModel placement. yEd puts the point `labelRatio` of the label\n * (-0.5..0.5 of its size from its center) on the point `nodeRatio` of the node; the offsets are ignored. On each axis\n * a node ratio below or above zero is that side, zero is the middle. A label on the node's top edge that hangs down\n * into it (labelRatioY at or below zero) is `inside-top`; every other edge or corner placement is the outside side\n * or corner, the nearest neutral value (an inside bottom or side has none).\n * @param smart - the `y:SmartNodeLabelModelParameter` element\n * @returns the position\n */\nfunction smartPosition(smart: unknown): string {\n const ratio = (name: string): number => {\n const n = Number(treeAttr(smart, name));\n return Number.isFinite(n) ? n : 0;\n };\n const h = sideOf(ratio(\"nodeRatioX\"), \"left\", \"right\");\n const v = sideOf(ratio(\"nodeRatioY\"), \"top\", \"bottom\");\n if (v === \"top\" && h === \"\" && ratio(\"labelRatioY\") <= 0) {\n return \"inside-top\";\n }\n if (v === \"\" || h === \"\") {\n return v + h || \"center\";\n }\n return `${v}-${h}`;\n}\n\n/**\n * One axis of a SmartNodeLabelModel node ratio.\n * @param ratio - the ratio, -0.5..0.5\n * @param low - the side below zero\n * @param high - the side above zero\n * @returns the side, or \"\" for the middle\n */\nfunction sideOf(ratio: number, low: string, high: string): string {\n if (ratio < 0) {\n return low;\n }\n return ratio > 0 ? high : \"\";\n}\n\n/**\n * The shape of a node realizer: its `y:Shape` where it has one, a GenericNode's configuration, or the realizer\n * type itself for one that draws an image (SVG, image, table, UML).\n * @param real - the realizer\n * @param at - the sites\n * @returns the shape, or null\n */\nfunction realizerShape(real: Realizer, at: SiteOf): string | null {\n const shape = treeChild(real.r, \"Shape\");\n if (shape !== undefined) {\n return canonEnum(\"shape\", treeAttr(shape, \"type\"), \"yed\", at(\"shape\"));\n }\n if (real.type === \"ShapeNode\" || real.type === \"GroupNode\" || real.type === \"GenericGroupNode\") {\n return null;\n }\n if (real.type === \"GenericNode\") {\n const conf = treeAttr(real.r, \"configuration\") ?? \"\";\n const flowchart = flowchartShape(conf);\n if (flowchart !== null) {\n return flowchart;\n }\n const lower = conf.slice(0, MAX_STYLE_VALUE_LENGTH).toLowerCase();\n for (const [word, value] of GENERIC_SHAPES) {\n if (lower.includes(word)) {\n return value;\n }\n }\n if (lower.length === 0) {\n return null;\n }\n noteAt(at(\"shape\"), STYLE_ISSUE.UNKNOWN_VALUE, lower);\n return `other:${lower}`;\n }\n noteAt(at(\"shape\"), STYLE_ISSUE.UNKNOWN_VALUE, real.type);\n return `other:${real.type}`;\n}\n\n/**\n * Reads one node realizer.\n * @param real - the realizer\n * @param put - receives the values\n * @param at - the sites\n */\nfunction readNode(real: Realizer, put: PutValue, at: SiteOf): void {\n const { r } = real;\n const fill = treeChild(r, \"Fill\");\n if (fill !== undefined) {\n if (treeAttr(fill, \"hasColor\") === \"false\" || treeAttr(fill, \"transparent\") === \"true\") {\n noteAt(at(\"fill\"), STYLE_ISSUE.NO_FILL, \"transparent\");\n put(\"fillOpacity\", 0);\n } else {\n readColor(treeAttr(fill, \"color\"), \"fill\", \"fillOpacity\", put, at);\n const second = treeAttr(fill, \"color2\");\n if (second !== undefined) {\n noteAt(at(\"fill\"), STYLE_ISSUE.GRADIENT, second);\n }\n }\n }\n const border = treeChild(r, \"BorderStyle\");\n if (border !== undefined) {\n if (treeAttr(border, \"hasColor\") === \"false\") {\n put(\"borderWidth\", 0);\n } else {\n readColor(treeAttr(border, \"color\"), \"borderColor\", null, put, at);\n put(\"borderWidth\", canonNumber(treeAttr(border, \"width\"), at(\"borderWidth\")));\n }\n put(\"borderStyle\", canonEnum(\"borderStyle\", treeAttr(border, \"type\"), \"yed\", at(\"borderStyle\")));\n }\n const geometry = treeChild(r, \"Geometry\");\n put(\"width\", canonNumber(treeAttr(geometry, \"width\"), at(\"width\")));\n put(\"height\", canonNumber(treeAttr(geometry, \"height\"), at(\"height\")));\n put(\"shape\", realizerShape(real, at));\n readLabels(treeChildren(r, \"NodeLabel\"), true, put, at);\n}\n\n/**\n * Reads one edge realizer.\n * @param real - the realizer\n * @param put - receives the values\n * @param at - the sites\n */\nfunction readEdge(real: Realizer, put: PutValue, at: SiteOf): void {\n const { r } = real;\n const line = treeChild(r, \"LineStyle\");\n if (line !== undefined) {\n readColor(treeAttr(line, \"color\"), \"color\", \"opacity\", put, at);\n put(\"width\", canonNumber(treeAttr(line, \"width\"), at(\"width\")));\n put(\"lineStyle\", canonEnum(\"lineStyle\", treeAttr(line, \"type\"), \"yed\", at(\"lineStyle\")));\n }\n const arrows = treeChild(r, \"Arrows\");\n if (arrows !== undefined) {\n put(\"sourceArrow\", canonEnum(\"arrow\", treeAttr(arrows, \"source\"), \"yed\", at(\"sourceArrow\")));\n put(\"targetArrow\", canonEnum(\"arrow\", treeAttr(arrows, \"target\"), \"yed\", at(\"targetArrow\")));\n }\n put(\"curved\", edgeCurved(real));\n readLabels(treeChildren(r, \"EdgeLabel\"), false, put, at);\n}\n\n/**\n * Whether yEd draws an edge curved: an arc always; a Bezier, quad curve, spline or generic edge only through its\n * control points (with none it is a straight line); a polyline only when it smooths bends it has.\n * @param real - the edge realizer\n * @returns true when curved, null when a polyline does not say whether it smooths\n */\nfunction edgeCurved(real: Realizer): boolean | null {\n if (real.type === \"ArcEdge\") {\n return true;\n }\n const bent = treeChildren(treeChild(real.r, \"Path\"), \"Point\").length > 0;\n if (real.type !== \"PolyLineEdge\") {\n return bent;\n }\n const smoothed = treeAttr(treeChild(real.r, \"BendStyle\"), \"smoothed\");\n return smoothed === undefined ? null : smoothed === \"true\" && bent;\n}\n\n/**\n * An edge's bends: the points of its `y:Path`, relative to the centers of its two nodes. yEd draws a polyline through\n * them; a curve type (Bezier, quad curve, spline) passes near them as its control points.\n * @param real - the edge realizer\n * @param centers - each node's center, x and y\n * @param source - the source node's index\n * @param target - the target node's index\n * @returns the `bends` value, or null without bends\n */\nfunction edgeBends(real: Realizer, centers: Float64Array, source: number, target: number): string | null {\n const points = treeChildren(treeChild(real.r, \"Path\"), \"Point\").map((p): BendPoint => [\n Number(treeAttr(p, \"x\")),\n Number(treeAttr(p, \"y\")),\n ]);\n const at = (k: number): BendPoint => [centers[2 * k], centers[2 * k + 1]];\n return canonBends(at(source), at(target), points, true);\n}\n\n/** Canonical values per property, by element index. */\nexport type ValueColumns = Record<string, (StyleValue | null)[]>;\n\n/**\n * A collector of canonical values for one target.\n * @param n - the element count\n * @returns the values and a setter for element i\n */\nexport function valueColumns(n: number): {\n readonly values: ValueColumns;\n put(i: number, property: string, value: StyleValue | null): void;\n} {\n const values: ValueColumns = Object.create(null) as ValueColumns;\n return {\n values,\n put(i, property, value) {\n if (value !== null) {\n values[property] ??= new Array<StyleValue | null>(n).fill(null);\n values[property][i] = value;\n }\n },\n };\n}\n\n/** What the yEd reader read. */\nexport interface YedRead {\n /** Node values. */\n readonly node: ValueColumns;\n /** Edge values. */\n readonly edge: ValueColumns;\n}\n\n/**\n * The yEd styles of a graph: each element's realizer read into canonical values.\n * @param snapshot - the graph\n * @param notes - where problems are noted\n * @param budget - the work budget\n * @returns the values, or null when no element has a yEd realizer\n */\nexport function readYedStyles(snapshot: GraphSnapshot, notes: StyleNotes, budget: StyleWorkBudget): YedRead | null {\n let found = false;\n // each node's center, read with the node, for its edges' bends; NaN for a node without yEd graphics\n const centers = new Float64Array(2 * snapshot.nodeCount).fill(Number.NaN);\n const read = (target: StyleTarget): ValueColumns => {\n const table = target === \"node\" ? snapshot.nodes : snapshot.edges;\n const n = target === \"node\" ? snapshot.nodeCount : snapshot.edgeCount;\n const names = target === \"node\" ? NODE_REALIZERS : EDGE_REALIZERS;\n const columns = treeColumns(table);\n const out = valueColumns(n);\n if (columns.length === 0) {\n return out.values;\n }\n for (let i = 0; i < n; i++) {\n budget.spend(target, columns.length);\n let real: Realizer | null = null;\n for (let c = 0; c < columns.length && real === null; c++) {\n real = realizerOf(plainCell(table.value(columns[c], i)), names);\n }\n if (real === null) {\n continue;\n }\n found = true;\n const at: SiteOf = (property) => ({ notes, target, property, element: i, budget });\n const put: PutValue = (property, value) => {\n out.put(i, property, value);\n };\n if (target === \"node\") {\n readNode(real, put, at);\n const geometry = treeChild(real.r, \"Geometry\");\n centers[2 * i] = Number(treeAttr(geometry, \"x\")) + Number(treeAttr(geometry, \"width\")) / 2;\n centers[2 * i + 1] = Number(treeAttr(geometry, \"y\")) + Number(treeAttr(geometry, \"height\")) / 2;\n } else {\n readEdge(real, put, at);\n put(\"bends\", edgeBends(real, centers, snapshot.edgeSource(i), snapshot.edgeTarget(i)));\n }\n }\n return out.values;\n };\n const node = read(\"node\");\n const edge = read(\"edge\");\n return found ? { node, edge } : null;\n}\n\n// ============================================================ writing\n\n/**\n * What the GraphML writer holds natively: yEd `y:ShapeNode` and `y:PolyLineEdge` graphics. The `graphty.styles`\n * block is a graph `<data>` under its own key, and the per-element values its rules read are keys of their own.\n * @category Built-in formats\n */\nexport const GRAPHML_STYLE_CAPABILITIES: StyleWriteCapabilities = Object.freeze({\n tool: \"yed\",\n node: Object.freeze([\n \"fill\",\n \"fillOpacity\",\n \"borderColor\",\n \"borderWidth\",\n \"borderStyle\",\n \"shape\",\n \"width\",\n \"height\",\n \"label\",\n \"labelColor\",\n \"labelSize\",\n \"labelFont\",\n \"labelWeight\",\n \"labelItalic\",\n \"labelPosition\",\n ] as const),\n edge: Object.freeze([\n \"color\",\n \"opacity\",\n \"width\",\n \"lineStyle\",\n \"sourceArrow\",\n \"targetArrow\",\n \"curved\",\n \"bends\",\n \"label\",\n \"labelColor\",\n \"labelSize\",\n \"labelFont\",\n \"labelWeight\",\n \"labelItalic\",\n ] as const),\n block: \"attributes\",\n});\n\n/** A written value and whether it is the exact value. */\ninterface Written {\n readonly value: string;\n readonly exact: boolean;\n}\n\n/** yEd's ShapeNode types, by the neutral shape each draws exactly. */\nexport const YED_SHAPES: ReadonlyMap<string, string> = new Map([\n [\"ellipse\", \"ellipse\"],\n [\"rectangle\", \"rectangle\"],\n [\"round-rectangle\", \"roundrectangle\"],\n [\"triangle\", \"triangle\"],\n [\"diamond\", \"diamond\"],\n [\"hexagon\", \"hexagon\"],\n [\"octagon\", \"octagon\"],\n [\"parallelogram\", \"parallelogram\"],\n [\"trapezoid\", \"trapezoid\"],\n [\"star\", \"star5\"],\n]);\n\n/** yEd's line types, by the neutral line style each draws exactly. */\nexport const YED_LINES: ReadonlyMap<string, string> = new Map([\n [\"solid\", \"line\"],\n [\"dashed\", \"dashed\"],\n [\"dotted\", \"dotted\"],\n [\"dash-dot\", \"dashed_dotted\"],\n]);\n\n/** yEd's arrows, by the neutral arrow each draws exactly. */\nexport const YED_ARROWS: ReadonlyMap<string, string> = new Map([\n [\"none\", \"none\"],\n [\"triangle\", \"standard\"],\n [\"triangle-open\", \"white_delta\"],\n [\"vee\", \"concave\"],\n [\"tee\", \"t_shape\"],\n [\"diamond\", \"diamond\"],\n [\"diamond-open\", \"white_diamond\"],\n [\"circle\", \"circle\"],\n [\"circle-open\", \"white_circle\"],\n [\"square\", \"skewed_dash\"],\n [\"crow\", \"crows_foot_many\"],\n]);\n\n/**\n * yEd's label model and position by neutral position: the inside ones in the internal model, the outside sides and\n * corners in the eight-position model.\n */\nconst YED_MODEL_POSITIONS: ReadonlyMap<string, readonly [string, string]> = new Map([\n [\"center\", [\"internal\", \"c\"]],\n [\"inside-top\", [\"internal\", \"t\"]],\n [\"top\", [\"eight_pos\", \"n\"]],\n [\"bottom\", [\"eight_pos\", \"s\"]],\n [\"left\", [\"eight_pos\", \"w\"]],\n [\"right\", [\"eight_pos\", \"e\"]],\n [\"top-left\", [\"eight_pos\", \"nw\"]],\n [\"top-right\", [\"eight_pos\", \"ne\"]],\n [\"bottom-left\", [\"eight_pos\", \"sw\"]],\n [\"bottom-right\", [\"eight_pos\", \"se\"]],\n]);\n\n/**\n * A value of a table, or the nearest value the table has.\n * @param table - neutral value to yEd value\n * @param value - the neutral value\n * @param nearest - the yEd value written when the table has none\n * @returns the written value\n */\nexport function yedValue(table: ReadonlyMap<string, string>, value: string, nearest: string): Written {\n const exact = table.get(value);\n if (exact !== undefined) {\n return { value: exact, exact: true };\n }\n // a value the reader kept as other:<raw> goes back as written\n return value.startsWith(\"other:\") ? { value: value.slice(6), exact: true } : { value: nearest, exact: false };\n}\n\n/**\n * A color with an alpha from an opacity, as yEd writes it: `#RRGGBB`, or `#RRGGBBAA` with the alpha last.\n * @param color - the canonical color\n * @param opacity - the opacity, or null\n * @returns the text\n */\nexport function yedColor(color: string, opacity: StyleValue | null): string {\n const hex = color.toUpperCase();\n if (typeof opacity !== \"number\" || opacity >= 1) {\n return hex;\n }\n return (\n hex +\n Math.round(Math.max(0, opacity) * 255)\n .toString(16)\n .toUpperCase()\n .padStart(2, \"0\")\n );\n}\n\n/** Records a value written as the nearest one yEd has. */\ntype Approximate = (property: string, value: StyleValue) => void;\n\n/**\n * A value in yEd's spelling, recorded as approximated when yEd has no exact one.\n * @param table - yEd's spellings\n * @param value - the neutral value\n * @param nearest - the spelling written when there is no exact one\n * @param property - the property, for the approximation note\n * @param approximate - records approximations\n * @returns the spelling\n */\nexport function yedSpelled(\n table: ReadonlyMap<string, string>,\n value: string,\n nearest: string,\n property: string,\n approximate: Approximate,\n): string {\n const w = yedValue(table, value, nearest);\n if (!w.exact) {\n approximate(property, value);\n }\n return w.value;\n}\n\n/** One element's value of a property. */\ntype GetValue = (property: string) => StyleValue | null;\n\n/**\n * The label attributes and text of one element.\n * @param get - the element's values\n * @param node - whether it is a node label (which has a position)\n * @param approximate - records approximations\n * @returns the label element, or null when the element has no label text\n */\nfunction labelTree(get: GetValue, node: boolean, approximate: Approximate): Tree | null {\n const text = get(\"label\");\n if (typeof text !== \"string\" || text.trim().length === 0) {\n return null;\n }\n const label: Tree = {};\n const font = get(\"labelFont\");\n if (typeof font === \"string\") {\n label[\"@_fontFamily\"] = font;\n }\n const size = get(\"labelSize\");\n if (typeof size === \"number\") {\n label[\"@_fontSize\"] = String(size);\n }\n const weight = get(\"labelWeight\");\n const italic = get(\"labelItalic\");\n if (weight !== null || italic !== null) {\n const style = (weight === \"bold\" ? \"bold\" : \"\") + (italic === true ? \"italic\" : \"\");\n label[\"@_fontStyle\"] = style.length === 0 ? \"plain\" : style;\n }\n const color = get(\"labelColor\");\n if (typeof color === \"string\") {\n label[\"@_textColor\"] = color.toUpperCase();\n }\n const position = node ? get(\"labelPosition\") : null;\n if (typeof position === \"string\") {\n const written = YED_MODEL_POSITIONS.get(position);\n if (written === undefined) {\n approximate(\"labelPosition\", position);\n }\n label[\"@_modelName\"] = written?.[0] ?? \"internal\";\n label[\"@_modelPosition\"] = written?.[1] ?? \"c\";\n }\n label[\"#text\"] = text;\n return label;\n}\n\n/**\n * A node's `y:ShapeNode` from its values.\n * @param get - the node's values\n * @param at - the node's position from the graphics it had, or null\n * @param approximate - records approximations\n * @returns the graphics tree\n */\nfunction shapeNodeTree(get: GetValue, at: readonly [string, string] | null, approximate: Approximate): Tree {\n const node: Tree = {};\n node[\"y:Geometry\"] = geometryTree(get, at);\n const fill = get(\"fill\");\n const fillOpacity = get(\"fillOpacity\");\n if (typeof fill === \"string\") {\n node[\"y:Fill\"] = { \"@_color\": yedColor(fill, fillOpacity), \"@_transparent\": \"false\" };\n } else if (fillOpacity === 0) {\n node[\"y:Fill\"] = { \"@_hasColor\": \"false\", \"@_transparent\": \"false\" };\n }\n const border = lineTree(get, [\"borderColor\", \"borderWidth\", \"borderStyle\"], approximate);\n if (border !== null) {\n node[\"y:BorderStyle\"] = border;\n }\n const label = labelTree(get, true, approximate);\n if (label !== null) {\n node[\"y:NodeLabel\"] = label;\n }\n const shape = get(\"shape\");\n if (typeof shape === \"string\") {\n node[\"y:Shape\"] = {\n \"@_type\": yedSpelled(YED_SHAPES, shape, shape === \"vee\" ? \"triangle\" : \"rectangle\", \"shape\", approximate),\n };\n }\n return { \"y:ShapeNode\": node };\n}\n\n/**\n * A node's `y:Geometry`: its size, and its position from the graphics it had.\n * @param get - the node's values\n * @param at - the node's position, or null\n * @returns the geometry\n */\nfunction geometryTree(get: GetValue, at: readonly [string, string] | null): Tree {\n const geometry: Tree = {};\n const height = get(\"height\");\n const width = get(\"width\");\n if (typeof height === \"number\") {\n geometry[\"@_height\"] = String(height);\n }\n if (typeof width === \"number\") {\n geometry[\"@_width\"] = String(width);\n }\n if (at !== null) {\n geometry[\"@_x\"] = at[0];\n geometry[\"@_y\"] = at[1];\n }\n return geometry;\n}\n\n/**\n * A `y:BorderStyle` or `y:LineStyle`: a color, a width and a line type. A node's border color is written opaque; an\n * edge's color carries its opacity.\n * @param get - the element's values\n * @param properties - the color, width and style properties\n * @param approximate - records approximations\n * @param opacity - the opacity of the color, for an edge's line\n * @returns the element, or null when none of the three is set\n */\nfunction lineTree(\n get: GetValue,\n properties: readonly [string, string, string],\n approximate: Approximate,\n opacity?: StyleValue | null,\n): Tree | null {\n const [colorKey, widthKey, styleKey] = properties;\n const color = get(colorKey);\n const width = get(widthKey);\n const style = get(styleKey);\n if (color === null && width === null && style === null) {\n return null;\n }\n const line: Tree = {};\n if (typeof color === \"string\") {\n line[\"@_color\"] = opacity === undefined ? color.toUpperCase() : yedColor(color, opacity);\n }\n if (typeof style === \"string\") {\n const nearest = styleKey === \"lineStyle\" && style === \"long-dash\" ? \"dashed\" : \"line\";\n line[\"@_type\"] = yedSpelled(YED_LINES, style, nearest, styleKey, approximate);\n }\n if (typeof width === \"number\") {\n line[\"@_width\"] = String(width);\n }\n return line;\n}\n\n/**\n * An edge's `y:PolyLineEdge` from its values.\n * @param get - the edge's values\n * @param path - the `y:Path` of the graphics it had, or undefined\n * @param approximate - records approximations\n * @returns the graphics tree\n */\nfunction polyLineEdgeTree(get: GetValue, path: unknown, approximate: Approximate): Tree {\n const edge: Tree = {};\n if (path !== undefined) {\n edge[\"y:Path\"] = path;\n }\n const line = lineTree(get, [\"color\", \"width\", \"lineStyle\"], approximate, get(\"opacity\"));\n if (line !== null) {\n edge[\"y:LineStyle\"] = line;\n }\n const source = get(\"sourceArrow\");\n const target = get(\"targetArrow\");\n if (source !== null || target !== null) {\n const arrow = (property: string, value: StyleValue | null): string =>\n typeof value === \"string\" ? yedSpelled(YED_ARROWS, value, \"standard\", property, approximate) : \"none\";\n edge[\"y:Arrows\"] = { \"@_source\": arrow(\"sourceArrow\", source), \"@_target\": arrow(\"targetArrow\", target) };\n }\n const label = labelTree(get, false, approximate);\n if (label !== null) {\n edge[\"y:EdgeLabel\"] = label;\n }\n const curved = get(\"curved\");\n if (typeof curved === \"boolean\") {\n edge[\"y:BendStyle\"] = { \"@_smoothed\": String(curved) };\n }\n return { \"y:PolyLineEdge\": edge };\n}\n\n/**\n * Each element's values of the properties the writer writes, as a getter per element.\n * @param picture - each element's value of a property\n * @param target - nodes or edges\n * @returns the getter\n */\nfunction getter(\n picture: (target: StyleTarget, property: string) => readonly (StyleValue | null)[],\n target: StyleTarget,\n): (i: number) => GetValue {\n const columns = new Map<string, readonly (StyleValue | null)[]>();\n for (const p of GRAPHML_STYLE_CAPABILITIES[target]) {\n columns.set(p, picture(target, p));\n }\n return (i) => (property) => columns.get(property)?.[i] ?? null;\n}\n\n/**\n * For a file graphty wrote: where a value read from the yEd graphics is what the writer writes for the block's own\n * value (a pentagon written as a hexagon, an opacity rounded to yEd's 255 steps), the block's exact value is the\n * truth, so a re-import gives back the same rules; a value another program changed since stays the truth.\n * @param read - the values the reader read, changed in place\n * @param picture - each element's value of a property under the block's rules\n * @param counts - the node and edge counts\n * @param counts.node - the node count\n * @param counts.edge - the edge count\n * @param notes - a scratch note list for reading back what the writer writes\n */\nexport function exactFromBlock(\n read: YedRead,\n picture: (target: StyleTarget, property: string) => readonly (StyleValue | null)[],\n counts: { readonly node: number; readonly edge: number },\n notes: StyleNotes,\n): void {\n for (const target of [\"node\", \"edge\"] as const) {\n const values = read[target];\n const get = getter(picture, target);\n for (let i = 0; i < counts[target]; i++) {\n const want = get(i);\n const back = writtenAndReadBack(target, want, notes);\n if (back === null) {\n continue;\n }\n for (const property of GRAPHML_STYLE_CAPABILITIES[target]) {\n const native = values[property]?.[i] ?? null;\n const w = want(property);\n if (native !== w && native === (back.get(property) ?? null)) {\n values[property] ??= new Array<StyleValue | null>(counts[target]).fill(null);\n values[property][i] = w;\n }\n }\n }\n }\n}\n\n/**\n * An element's values written as the writer writes them and read back as the reader reads them.\n * @param target - nodes or edges\n * @param want - its values\n * @param notes - a scratch for the notes the round trip makes\n * @returns the values read back, by property, or null when the written graphics hold no realizer\n */\nfunction writtenAndReadBack(target: StyleTarget, want: GetValue, notes: StyleNotes): Map<string, StyleValue> | null {\n const ignore: Approximate = () => undefined;\n const tree = target === \"node\" ? shapeNodeTree(want, null, ignore) : polyLineEdgeTree(want, undefined, ignore);\n const real = realizerOf(tree, target === \"node\" ? NODE_REALIZERS : EDGE_REALIZERS);\n if (real === null) {\n return null;\n }\n const back = new Map<string, StyleValue>();\n const at: SiteOf = (property) => ({ notes, target, property });\n const put: PutValue = (property, value) => {\n if (value !== null) {\n back.set(property, value);\n }\n };\n if (target === \"node\") {\n readNode(real, put, at);\n } else {\n readEdge(real, put, at);\n }\n return back;\n}\n\n/** A GraphML export with styles worked out. */\ninterface GraphmlStyledExport {\n /** The graph to write: the yFiles drawing columns replaced by yEd graphics written from the styles. */\n readonly snapshot: GraphSnapshot;\n /** W_STYLE_APPROXIMATED for every value written as the nearest one yEd has. */\n readonly notes: readonly LossNote[];\n}\n\n/** The yFiles key type of the written node and edge graphics. */\nconst GRAPHICS_TYPES: Readonly<Record<StyleTarget, string>> = { node: \"nodegraphics\", edge: \"edgegraphics\" };\n\n/**\n * A node's position from the graphics it had: a yEd realizer's `y:Geometry` x and y, or a yFiles 3 `y:RectD`'s.\n * @param table - the node table\n * @param columns - its tree columns\n * @param i - the node\n * @returns the x and y as written, or null\n */\nfunction keptPosition(table: GraphSnapshot[\"nodes\"], columns: readonly string[], i: number): [string, string] | null {\n for (const name of columns) {\n const tree = plainCell(table.value(name, i));\n const real = realizerOf(tree, NODE_REALIZERS);\n const geometry = real === null ? treeChild(tree, \"RectD\") : treeChild(real.r, \"Geometry\");\n const x = treeAttr(geometry, real === null ? \"X\" : \"x\");\n const y = treeAttr(geometry, real === null ? \"Y\" : \"y\");\n if (x !== undefined && y !== undefined) {\n return [x, y];\n }\n }\n return null;\n}\n\n/**\n * A node's `y:Geometry` x and y from the graph's position column, for a node with no yEd graphics of its own: the\n * column's coordinate read in its declared spelling (center, y up when it declares none), written as yEd places a\n * box, by its top-left corner with y growing downward.\n * @param snapshot - the graph\n * @param i - the node\n * @param get - the node's values (its drawn width and height)\n * @returns the x and y to write, or null when the node has no finite position\n */\nfunction columnPosition(snapshot: GraphSnapshot, i: number, get: GetValue): [string, string] | null {\n const column = snapshot.nodes.byRole(\"position\");\n if (column === null || column.meta.components < 2 || !column.isSet(i)) {\n return null;\n }\n const v = column.value(i) as ArrayLike<number>;\n const width = get(\"width\");\n const height = get(\"height\");\n const size: [number, number] = [typeof width === \"number\" ? width : 0, typeof height === \"number\" ? height : 0];\n const p: [number, number, number] = [v[0], v[1], 0];\n toNeutral(p, column.meta.extra ?? {}, size, false);\n const [x, y] = toFilePositions(Float64Array.from(p), YED_SPELLING, {\n width: Float64Array.of(size[0]),\n height: Float64Array.of(size[1]),\n });\n return Number.isFinite(x) && Number.isFinite(y) ? [String(x), String(y)] : null;\n}\n\n/** How yEd spells a node's place: its box's top-left corner, y growing downward. */\nconst YED_SPELLING: PositionColumnExtra = { yAxis: \"down\", anchor: \"top-left\" };\n\n/**\n * An edge's `y:Path` (its bends) from the yEd graphics it had.\n * @param table - the edge table\n * @param columns - its tree columns\n * @param e - the edge\n * @returns the path, or undefined\n */\nfunction keptPath(table: GraphSnapshot[\"edges\"], columns: readonly string[], e: number): unknown {\n for (const name of columns) {\n const real = realizerOf(plainCell(table.value(name, e)), EDGE_REALIZERS);\n const path = real === null ? undefined : treeChild(real.r, \"Path\");\n if (path !== undefined) {\n return path;\n }\n }\n return undefined;\n}\n\n/**\n * An edge's `y:Path` with its points placed from its `bends` value between the written node centers, so the bends\n * read back as written; the ports of the path it had are kept. Without a value, or without both centers, the path it\n * had.\n * @param kept - the path from the graphics the edge had, or undefined\n * @param bends - the edge's `bends` value\n * @param ends - the written centers of its source and target\n * @returns the path, or undefined\n */\nfunction pathWithBends(kept: unknown, bends: StyleValue | null, ends: readonly [BendPoint, BendPoint]): unknown {\n const points = typeof bends === \"string\" ? bendsToPoints(ends[0], ends[1], bends, true) : null;\n if (points === null) {\n return kept;\n }\n const path: Tree = {};\n for (const port of [\"sx\", \"sy\", \"tx\", \"ty\"]) {\n path[`@_${port}`] = treeAttr(kept, port) ?? \"0.0\";\n }\n path[\"y:Point\"] = points.map(([x, y]) => ({ \"@_x\": String(x), \"@_y\": String(y) }));\n return path;\n}\n\n/**\n * A column name not yet taken in a table.\n * @param table - the table\n * @param base - the preferred name\n * @returns the name\n */\nfunction freeName(table: GraphSnapshot[\"nodes\"], base: string): string {\n let name = base;\n let k = 2;\n while (table.has(name)) {\n name = `${base}#${String(k)}`;\n k++;\n }\n return name;\n}\n\n/**\n * Works out a GraphML export with styles: every node and edge column made from yFiles keys (the graphics trees,\n * the typed `yfiles.*` columns and yFiles 3's drawing state) is replaced by yEd graphics written from what graphty\n * draws, keeping each node's position and each edge's bends from the graphics it had; graph data from yFiles 3\n * keys goes too, since its `y:` elements are not yEd's.\n * @param snapshot - the graph handed to the exporter\n * @param input - the styles, or undefined when none are written\n * @returns the styled export, or null without styles\n */\nexport function graphmlStyledExport(\n snapshot: GraphSnapshot,\n input: ExporterStyleInput | undefined,\n): GraphmlStyledExport | null {\n if (input === undefined) {\n return null;\n }\n const approximated = new StyleApproximations();\n const approximateFor =\n (target: StyleTarget): Approximate =>\n (property, value) => {\n approximated.add(target, property, value);\n };\n const picture = (target: StyleTarget, property: string): readonly (StyleValue | null)[] =>\n input.picture(target, property as never);\n const nodeColumns = treeColumns(snapshot.nodes);\n const edgeColumns = treeColumns(snapshot.edges);\n const getNode = getter(picture, \"node\");\n const getEdge = getter(picture, \"edge\");\n const nodeTrees: (Tree | null)[] = [];\n for (let i = 0; i < snapshot.nodeCount; i++) {\n const get = getNode(i);\n const at = keptPosition(snapshot.nodes, nodeColumns, i) ?? columnPosition(snapshot, i, get);\n nodeTrees.push(shapeNodeTree(get, at, approximateFor(\"node\")));\n }\n const centers = nodeTrees.map((tree): BendPoint => {\n const geometry = treeChild(treeChild(tree, \"ShapeNode\"), \"Geometry\");\n const at = (k: string): number => Number(treeAttr(geometry, k) ?? Number.NaN);\n return [at(\"x\") + at(\"width\") / 2, at(\"y\") + at(\"height\") / 2];\n });\n const edgeTrees: (Tree | null)[] = [];\n for (let e = 0; e < snapshot.edgeCount; e++) {\n const get = getEdge(e);\n const ends: readonly [BendPoint, BendPoint] = [\n centers[snapshot.edgeSource(e)],\n centers[snapshot.edgeTarget(e)],\n ];\n const path = pathWithBends(keptPath(snapshot.edges, edgeColumns, e), get(\"bends\"), ends);\n edgeTrees.push(polyLineEdgeTree(get, path, approximateFor(\"edge\")));\n }\n const out = snapshot.withColumns();\n for (const [table, trees, target] of [\n [out.nodes, nodeTrees, \"node\"],\n [out.edges, edgeTrees, \"edge\"],\n ] as const) {\n for (const name of yfilesColumns(table)) {\n table.remove(name);\n }\n const name = freeName(table, GRAPHICS_TYPES[target]);\n table.set(name, trees, {\n dtype: \"json\",\n nullable: true,\n origin: { format: \"graphml\", id: null, title: null, type: GRAPHICS_TYPES[target], namespace: \"yfiles\" },\n });\n }\n const yfiles3 = [...out.graph].filter(\n (col) => col.meta.origin?.namespace === \"yfiles\" && (col.meta.origin.type ?? \"\").includes(\"://\"),\n );\n for (const col of yfiles3) {\n out.graph.remove(col.meta.name);\n }\n return { snapshot: out, notes: approximated.notes(\"yEd\") };\n}\n"],"names":["name"],"mappings":";;;AAkBA,MAAM,WAAW,CAAC,MAAsB,OAAO,KAAK,MAAM,IAAI,GAAG,IAAI,GAAG;AAWjE,SAAS,WACZ,QACA,QACA,QACA,OACa;AACb,QAAM,OAAe;AACrB,QAAM,KAAK,OAAO,CAAC,IAAI,OAAO,CAAC;AAC/B,QAAM,MAAM,OAAO,CAAC,IAAI,OAAO,CAAC,KAAK;AACrC,QAAM,UAAU,KAAK,KAAK,KAAK;AAC/B,MAAI,OAAO,WAAW,KAAK,WAAW,KAAK,CAAC,OAAO,SAAS,OAAO,GAAG;AAClE,WAAO;AAAA,EACX;AACA,QAAM,MAAgB,CAAA;AACtB,aAAW,CAAC,IAAI,EAAE,KAAK,QAAQ;AAC3B,UAAM,KAAK,KAAK,OAAO,CAAC;AACxB,UAAM,MAAM,KAAK,OAAO,CAAC,KAAK;AAC9B,UAAM,SAAS,KAAK,KAAK,KAAK,MAAM;AACpC,UAAM,UAAU,KAAK,KAAK,KAAK,MAAM;AACrC,QAAI,CAAC,OAAO,SAAS,KAAK,KAAK,CAAC,OAAO,SAAS,MAAM,GAAG;AACrD,aAAO;AAAA,IACX;AACA,QAAI,KAAK,GAAG,SAAS,KAAK,CAAC,IAAI,SAAS,MAAM,CAAC,EAAE;AAAA,EACrD;AACA,SAAO,IAAI,KAAK,GAAG;AACvB;AAWO,SAAS,cAAc,QAAmB,QAAmB,OAAe,OAAoC;AACnH,QAAM,OAAe;AACrB,QAAM,KAAK,OAAO,CAAC,IAAI,OAAO,CAAC;AAC/B,QAAM,MAAM,OAAO,CAAC,IAAI,OAAO,CAAC,KAAK;AACrC,QAAM,MAAmB,CAAA;AACzB,aAAW,QAAQ,MAAM,KAAA,EAAO,MAAM,KAAK,GAAG;AAC1C,UAAM,CAAC,GAAG,GAAG,KAAK,IAAI,KAAK,MAAM,GAAG,EAAE,I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AM,KAAK;AAAA,IACjC,CAAC,IAAI,OAAO,WAAW,MAAM;AAAA,IAC7B,CAAC,IAAI,OAAO,WAAW,MAAM;AAAA,EAAA,GACrB;AACR,eAAWA,SAAQ,cAAc,KAAK,GAAG;AACrC,YAAM,OAAOA,KAAI;AAAA,IACrB;AACA,UAAM,OAAO,SAAS,OAAO,eAAe,MAAM,CAAC;AACnD,UAAM,IAAI,MAAM,OAAO;AAAA,MACnB,OAAO;AAAA,MACP,UAAU;AAAA,MACV,QAAQ,EAAE,QAAQ,WAAW,IAAI,MAAM,OAAO,MAAM,MAAM,eAAe,MAAM,GAAG,WAAW,SAAA;AAAA,IAAS,CACzG;AAAA,EACL;AACA,QAAM,UAAU,CAAC,GAAG,IAAI,KAAK,EAAE;AAAA,IAC3B,CAAC,QAAQ,IAAI,KAAK,QAAQ,cAAc,aAAa,IAAI,KAAK,OAAO,QAAQ,IAAI,SAAS,KAAK;AAAA,EAAA;AAEnG,aAAW,OAAO,SAAS;AACvB,QAAI,MAAM,OAAO,IAAI,KAAK,IAAI;AAAA,EAClC;AACA,SAAO,EAAE,UAAU,KAAK,OAAO,aAAa,MAAM,KAAK,EAAA;AAC3D;"}
@@ -1,5 +1,5 @@
1
1
  import { INVALID_INDEX, GraphFormatError } from "@graphty/graph-format";
2
- import { P as PRECISION_CODE } from "./format-BpQBx8MZ.js";
2
+ import { P as PRECISION_CODE } from "./report-CgdsL9Hb.js";
3
3
  const I32_TEXT = /^-?(0|[1-9]\d*)$/;
4
4
  const F64_TEXT = /^[+-]?((0|[1-9]\d*)(\.\d*)?|\.\d+)([eE][+-]?\d+)?$/;
5
5
  const I32_MIN = -2147483648;
@@ -213,4 +213,4 @@ export {
213
213
  parseTextCell as p,
214
214
  trimTrailingZeros as t
215
215
  };
216
- //# sourceMappingURL=text-CzJNFOS9.js.map
216
+ //# sourceMappingURL=text-BuKQVMz2.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"text-CzJNFOS9.js","sources":["../../src/common/text.ts"],"sourcesContent":["/**\n * The fixed lexical grammar of design section 5.1 for untyped text sources (CSV cells, GML\n * values, DOT strings, Pajek tokens), reproduced from the core's reference implementation so the\n * two agree (invariant I15). Text importers parse each cell with parseTextCell() and push the JS\n * value; the sink's per-column inference then widens `bool -> i32 -> f64 -> string` and never per\n * cell, so a column that saw `1` and then `\"01\"` becomes string for all rows.\n *\n * - `bool` is exactly `true` / `false` (case-sensitive);\n * - `i32` is `/^-?(0|[1-9][0-9]*)$/` within `[-2^31, 2^31)`; `0` / `1` are i32, never bool;\n * - `f64` is a decimal or exponent literal accepted by `Number()` that is not empty, not\n * whitespace, not `Infinity` / `NaN`, not a hex / octal / binary form, has no leading zeros in\n * its integer part, and whose value is finite (an integer literal outside i32 range is f64);\n * - everything else is `string`.\n */\n\nimport { type ColumnHandle, GraphFormatError, type GraphSink, INVALID_INDEX } from \"@graphty/graph-format\";\n\nimport { PRECISION_CODE } from \"./codes.js\";\nimport { type ImportReportBuilder } from \"./report.js\";\n\nconst I32_TEXT = /^-?(0|[1-9]\\d*)$/;\nconst F64_TEXT = /^[+-]?((0|[1-9]\\d*)(\\.\\d*)?|\\.\\d+)([eE][+-]?\\d+)?$/;\nconst I32_MIN = -2147483648;\nconst I32_MAX = 2147483647;\n\n/**\n * The dtype a text cell parses as under the fixed text grammar.\n * @public\n * @category Plugin helpers\n */\nexport type TextDtype = \"bool\" | \"i32\" | \"f64\" | \"string\";\n\n/**\n * A digit string without its trailing zeros (`\"1200\"` becomes `\"12\"`).\n * @param digits - the digits\n * @returns the digits up to the last one that is not 0\n */\nexport function trimTrailingZeros(digits: string): string {\n let end = digits.length;\n while (end > 0 && digits[end - 1] === \"0\") {\n end--;\n }\n return digits.slice(0, end);\n}\n\n/**\n * Classify one text cell by the fixed grammar.\n * @param text - the cell text, exactly as read (no trimming)\n * @returns bool, i32, f64 or string\n * @category Plugin helpers\n */\nexport function inferTextDtype(text: string): TextDtype {\n if (text === \"true\" || text === \"false\") {\n return \"bool\";\n }\n if (I32_TEXT.test(text)) {\n const n = Number(text);\n if (n >= I32_MIN && n <= I32_MAX) {\n return \"i32\";\n }\n return Number.isFinite(n) ? \"f64\" : \"string\";\n }\n if (F64_TEXT.test(text) && Number.isFinite(Number(text))) {\n return \"f64\";\n }\n return \"string\";\n}\n\n/**\n * Parse one text cell into the JS value its grammar class implies: a boolean for bool, a number for\n * i32 / f64, the text itself for string. The sink infers the column dtype from the value.\n * @param text - the cell text, exactly as read\n * @returns the value\n * @category Plugin helpers\n */\nexport function parseTextCell(text: string): boolean | number | string {\n switch (inferTextDtype(text)) {\n case \"bool\":\n return text === \"true\";\n case \"i32\":\n case \"f64\":\n return Number(text);\n case \"string\":\n return text;\n default:\n return text;\n }\n}\n\n/**\n * Whether a text cell is a number under the f64 grammar (an i32 or f64 literal).\n * @param text - the cell text\n * @returns true when parseTextCell(text) returns a number\n * @category Plugin helpers\n */\nexport function isNumericText(text: string): boolean {\n const dtype = inferTextDtype(text);\n return dtype === \"i32\" || dtype === \"f64\";\n}\n\n/**\n * Whether a numeric cell text is the canonical spelling of its value (`String(value) === text`),\n * so that the sink's own re-formatting of the value would reproduce it.\n * @param text - the cell text\n * @param value - the parsed value\n * @returns true when the lexical form survives a widening to string\n */\nfunction isCanonicalNumberText(text: string, value: number): boolean {\n return String(value) === text;\n}\n\n/**\n * The widening rank of a text dtype in the design section 5.1 order.\n * @param dtype - the text dtype\n * @returns 0 for bool, 1 for i32, 2 for f64, 3 for string\n */\nfunction textDtypeRank(dtype: TextDtype): number {\n switch (dtype) {\n case \"bool\":\n return 0;\n case \"i32\":\n return 1;\n case \"f64\":\n return 2;\n case \"string\":\n return 3;\n default: {\n const name: string = dtype;\n throw new GraphFormatError(\"E_UNSUPPORTED\", `unknown text dtype ${name}`, { dtype: name });\n }\n }\n}\n\n/**\n * Writes the cells of one attribute of a text format whose values carry no type (CSV, DOT, Pajek):\n * you hand it each cell's text and it stores a number, a boolean or text, choosing one type for the\n * whole attribute. A column of `2.0`, `3.5` stays a number column with decimals even though `2.0`\n * alone looks like an integer, and once one cell turns out to be text, earlier cells such as `1e5`\n * are kept as written instead of as `100000`. Create one writer per attribute name and per kind\n * (\"node\" or \"edge\"), and call `write(index, text)` with the node or edge index the sink gave you:\n *\n * ```ts\n * const color = new TextCellWriter(\"color\", \"node\", sink, report);\n * color.write(sink.addNode(\"a\"), \"red\");\n * ```\n *\n * A sink that cannot change a column's type after the fact (one of your own without\n * `widenNodeColumn` / `widenEdgeColumn`) keeps the type the first values implied, with one W_WIDENING_UNSUPPORTED warning\n * per attribute.\n * @public\n * @category Writing a format\n */\nexport class TextCellWriter {\n /** The column name in the sink. */\n readonly name: string;\n\n private readonly domain: \"node\" | \"edge\";\n\n private readonly sink: GraphSink;\n\n private readonly report: ImportReportBuilder;\n\n private handle: ColumnHandle = INVALID_INDEX as ColumnHandle;\n\n /** The widest text dtype seen (the column's dtype under the 5.1 grammar). */\n private textDtype: TextDtype | null = null;\n\n /** The widest dtype the pushed values imply (what the sink inferred on its own). */\n private valueDtype: TextDtype | null = null;\n\n private readonly keptRows: number[] = [];\n\n private readonly keptTexts: string[] = [];\n\n /**\n * Create a writer. The attribute is added to the sink on the first write.\n * @param name - the attribute name\n * @param domain - \"node\" for a node attribute, \"edge\" for an edge attribute\n * @param sink - the sink the importer fills\n * @param report - the import report, for warnings about the values\n */\n constructor(name: string, domain: \"node\" | \"edge\", sink: GraphSink, report: ImportReportBuilder) {\n this.name = name;\n this.domain = domain;\n this.sink = sink;\n this.report = report;\n }\n\n /**\n * The sink's handle of the attribute's column, for reading it back.\n * @returns the handle, or INVALID_INDEX before the first write\n */\n get column(): ColumnHandle {\n return this.handle;\n }\n\n /**\n * Write one cell.\n * @param row - the node or edge index, as the sink's addNode() or addEdge() returned it\n * @param text - the cell text, exactly as read from the file\n */\n write(row: number, text: string): void {\n const kind = inferTextDtype(text);\n const value = parseTextCell(text);\n this.warnIfImprecise(text, value);\n const wasString = this.textDtype === \"string\";\n const textDtype =\n this.textDtype === null || textDtypeRank(kind) > textDtypeRank(this.textDtype) ? kind : this.textDtype;\n // a string column keeps every cell's lexical form; a numeric text is never re-spelled. The\n // sink may refuse the value (a declared column of another dtype): the state advances only\n // once the cell is written, so a refused cell leaves the writer as it was.\n this.set(row, textDtype === \"string\" ? text : value);\n this.textDtype = textDtype;\n const valueKind = kindOfValue(value);\n if (this.valueDtype === null || textDtypeRank(valueKind) > textDtypeRank(this.valueDtype)) {\n this.valueDtype = valueKind;\n }\n if (this.textDtype === \"string\") {\n if (!wasString && this.keptRows.length > 0) {\n // the sink just widened the column to string from the values; restore the texts\n // whose lexical form the values did not carry\n for (let i = 0; i < this.keptRows.length; i++) {\n this.set(this.keptRows[i], this.keptTexts[i]);\n }\n this.keptRows.length = 0;\n this.keptTexts.length = 0;\n }\n return;\n }\n if (typeof value === \"number\" && !isCanonicalNumberText(text, value)) {\n this.keptRows.push(row);\n this.keptTexts.push(text);\n }\n if (this.textDtype === \"f64\" && this.valueDtype !== \"f64\") {\n this.widen(\"f64\");\n }\n }\n\n /**\n * Warn, once per column, when the cell is an integer beyond 2^53 that is stored as the nearest\n * double.\n * @param text - the cell text\n * @param value - the parsed value\n */\n private warnIfImprecise(text: string, value: unknown): void {\n if (\n typeof value === \"number\" &&\n !Number.isSafeInteger(value) &&\n I32_TEXT.test(text) &&\n BigInt(text) !== BigInt(value)\n ) {\n this.report.warnOnce(\n \"precision\",\n PRECISION_CODE,\n `${this.domain} column \"${this.name}\": integers beyond 2^53 are stored as the nearest double (first: ${text})`,\n { element: this.name },\n `${PRECISION_CODE}:${this.domain}:${this.name}`,\n );\n }\n }\n\n /**\n * Write a value (the parsed scalar, or a text into a widened column).\n * @param row - the row\n * @param value - the value\n */\n private set(row: number, value: unknown): void {\n if (this.handle === INVALID_INDEX) {\n if (this.domain === \"node\") {\n this.sink.setNodeValue(this.name, row, value);\n this.handle = this.sink.nodeColumn(this.name);\n } else {\n this.sink.setEdgeValue(this.name, row, value);\n this.handle = this.sink.edgeColumn(this.name);\n }\n return;\n }\n if (this.domain === \"node\") {\n this.sink.setNodeValue(this.handle, row, value);\n } else {\n this.sink.setEdgeValue(this.handle, row, value);\n }\n }\n\n /**\n * Widen the column to the dtype the text grammar implies, through the sink's optional call.\n * @param dtype - the dtype\n */\n private widen(dtype: \"f64\"): void {\n const { sink } = this;\n const supported =\n this.domain === \"node\" ? sink.widenNodeColumn !== undefined : sink.widenEdgeColumn !== undefined;\n if (!supported) {\n this.report.warnOnce(\n \"coercion\",\n WIDENING_UNSUPPORTED_CODE,\n `column \"${this.name}\" holds ${dtype} text but the sink cannot widen an inferred column; it keeps the value-inferred dtype`,\n { element: this.name },\n );\n this.valueDtype = dtype;\n return;\n }\n try {\n if (this.domain === \"node\") {\n sink.widenNodeColumn?.(this.handle, dtype);\n } else {\n sink.widenEdgeColumn?.(this.handle, dtype);\n }\n this.valueDtype = dtype;\n } catch (err) {\n if (!(err instanceof GraphFormatError) || err.code !== \"E_COLUMN_TYPE\") {\n throw err;\n }\n // a caller's declared column of the name: its dtype stands\n this.valueDtype = dtype;\n }\n }\n}\n\n/**\n * Your graph builder cannot change an attribute's type after its first value, so a text column keeps the type of its\n * first values.\n * @category Issue and loss codes\n */\nexport const WIDENING_UNSUPPORTED_CODE = \"W_WIDENING_UNSUPPORTED\";\n\n/**\n * The text dtype a parsed cell value implies on its own (what the sink's inference sees). It must\n * be graph-format's inference rule exactly: -0 is an integer there, so a column holding only\n * `-0.0` is inferred i32 and must be widened to f64, or the sign is lost.\n * @param value - the parsed value\n * @returns the dtype\n */\nfunction kindOfValue(value: boolean | number | string): TextDtype {\n if (typeof value === \"boolean\") {\n return \"bool\";\n }\n if (typeof value === \"string\") {\n return \"string\";\n }\n return Number.isInteger(value) && value >= -2147483648 && value <= 2147483647 ? \"i32\" : \"f64\";\n}\n"],"names":[],"mappings":";;AAoBA,MAAM,WAAW;AACjB,MAAM,WAAW;AACjB,MAAM,UAAU;AAChB,MAAM,UAAU;AAcT,SAAS,kBAAkB,QAAw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,QAAI,CAAC,WAAW;AACZ,WAAK,OAAO;AAAA,QACR;AAAA,QACA;AAAA,QACA,WAAW,KAAK,IAAI,WAAW,KAAK;AAAA,QACpC,EAAE,SAAS,KAAK,KAAA;AAAA,MAAK;AAEzB,WAAK,aAAa;AAClB;AAAA,IACJ;AACA,QAAI;AACA,UAAI,KAAK,WAAW,QAAQ;AACxB,aAAK,kBAAkB,KAAK,QAAQ,KAAK;AAAA,MAC7C,OAAO;AACH,aAAK,kBAAkB,KAAK,QAAQ,KAAK;AAAA,MAC7C;AACA,WAAK,aAAa;AAAA,IACtB,SAAS,KAAK;AACV,UAAI,EAAE,eAAe,qBAAqB,IAAI,SAAS,iBAAiB;AACpE,cAAM;AAAA,MACV;AAEA,WAAK,aAAa;AAAA,IACtB;AAAA,EACJ;AACJ;AAOO,MAAM,4BAA4B;AASzC,SAAS,YAAY,OAA6C;AAC9D,MAAI,OAAO,UAAU,WAAW;AAC5B,WAAO;AAAA,EACX;AACA,MAAI,OAAO,UAAU,UAAU;AAC3B,WAAO;AAAA,EACX;AACA,SAAO,OAAO,UAAU,KAAK,KAAK,SAAS,eAAe,SAAS,aAAa,QAAQ;AAC5F;"}
1
+ {"version":3,"file":"text-BuKQVMz2.js","sources":["../../src/common/text.ts"],"sourcesContent":["/**\n * The fixed lexical grammar of design section 5.1 for untyped text sources (CSV cells, GML\n * values, DOT strings, Pajek tokens), reproduced from the core's reference implementation so the\n * two agree (invariant I15). Text importers parse each cell with parseTextCell() and push the JS\n * value; the sink's per-column inference then widens `bool -> i32 -> f64 -> string` and never per\n * cell, so a column that saw `1` and then `\"01\"` becomes string for all rows.\n *\n * - `bool` is exactly `true` / `false` (case-sensitive);\n * - `i32` is `/^-?(0|[1-9][0-9]*)$/` within `[-2^31, 2^31)`; `0` / `1` are i32, never bool;\n * - `f64` is a decimal or exponent literal accepted by `Number()` that is not empty, not\n * whitespace, not `Infinity` / `NaN`, not a hex / octal / binary form, has no leading zeros in\n * its integer part, and whose value is finite (an integer literal outside i32 range is f64);\n * - everything else is `string`.\n */\n\nimport { type ColumnHandle, GraphFormatError, type GraphSink, INVALID_INDEX } from \"@graphty/graph-format\";\n\nimport { PRECISION_CODE } from \"./codes.js\";\nimport { type ImportReportBuilder } from \"./report.js\";\n\nconst I32_TEXT = /^-?(0|[1-9]\\d*)$/;\nconst F64_TEXT = /^[+-]?((0|[1-9]\\d*)(\\.\\d*)?|\\.\\d+)([eE][+-]?\\d+)?$/;\nconst I32_MIN = -2147483648;\nconst I32_MAX = 2147483647;\n\n/**\n * The dtype a text cell parses as under the fixed text grammar.\n * @public\n * @category Plugin helpers\n */\nexport type TextDtype = \"bool\" | \"i32\" | \"f64\" | \"string\";\n\n/**\n * A digit string without its trailing zeros (`\"1200\"` becomes `\"12\"`).\n * @param digits - the digits\n * @returns the digits up to the last one that is not 0\n */\nexport function trimTrailingZeros(digits: string): string {\n let end = digits.length;\n while (end > 0 && digits[end - 1] === \"0\") {\n end--;\n }\n return digits.slice(0, end);\n}\n\n/**\n * Classify one text cell by the fixed grammar.\n * @param text - the cell text, exactly as read (no trimming)\n * @returns bool, i32, f64 or string\n * @category Plugin helpers\n */\nexport function inferTextDtype(text: string): TextDtype {\n if (text === \"true\" || text === \"false\") {\n return \"bool\";\n }\n if (I32_TEXT.test(text)) {\n const n = Number(text);\n if (n >= I32_MIN && n <= I32_MAX) {\n return \"i32\";\n }\n return Number.isFinite(n) ? \"f64\" : \"string\";\n }\n if (F64_TEXT.test(text) && Number.isFinite(Number(text))) {\n return \"f64\";\n }\n return \"string\";\n}\n\n/**\n * Parse one text cell into the JS value its grammar class implies: a boolean for bool, a number for\n * i32 / f64, the text itself for string. The sink infers the column dtype from the value.\n * @param text - the cell text, exactly as read\n * @returns the value\n * @category Plugin helpers\n */\nexport function parseTextCell(text: string): boolean | number | string {\n switch (inferTextDtype(text)) {\n case \"bool\":\n return text === \"true\";\n case \"i32\":\n case \"f64\":\n return Number(text);\n case \"string\":\n return text;\n default:\n return text;\n }\n}\n\n/**\n * Whether a text cell is a number under the f64 grammar (an i32 or f64 literal).\n * @param text - the cell text\n * @returns true when parseTextCell(text) returns a number\n * @category Plugin helpers\n */\nexport function isNumericText(text: string): boolean {\n const dtype = inferTextDtype(text);\n return dtype === \"i32\" || dtype === \"f64\";\n}\n\n/**\n * Whether a numeric cell text is the canonical spelling of its value (`String(value) === text`),\n * so that the sink's own re-formatting of the value would reproduce it.\n * @param text - the cell text\n * @param value - the parsed value\n * @returns true when the lexical form survives a widening to string\n */\nfunction isCanonicalNumberText(text: string, value: number): boolean {\n return String(value) === text;\n}\n\n/**\n * The widening rank of a text dtype in the design section 5.1 order.\n * @param dtype - the text dtype\n * @returns 0 for bool, 1 for i32, 2 for f64, 3 for string\n */\nfunction textDtypeRank(dtype: TextDtype): number {\n switch (dtype) {\n case \"bool\":\n return 0;\n case \"i32\":\n return 1;\n case \"f64\":\n return 2;\n case \"string\":\n return 3;\n default: {\n const name: string = dtype;\n throw new GraphFormatError(\"E_UNSUPPORTED\", `unknown text dtype ${name}`, { dtype: name });\n }\n }\n}\n\n/**\n * Writes the cells of one attribute of a text format whose values carry no type (CSV, DOT, Pajek):\n * you hand it each cell's text and it stores a number, a boolean or text, choosing one type for the\n * whole attribute. A column of `2.0`, `3.5` stays a number column with decimals even though `2.0`\n * alone looks like an integer, and once one cell turns out to be text, earlier cells such as `1e5`\n * are kept as written instead of as `100000`. Create one writer per attribute name and per kind\n * (\"node\" or \"edge\"), and call `write(index, text)` with the node or edge index the sink gave you:\n *\n * ```ts\n * const color = new TextCellWriter(\"color\", \"node\", sink, report);\n * color.write(sink.addNode(\"a\"), \"red\");\n * ```\n *\n * A sink that cannot change a column's type after the fact (one of your own without\n * `widenNodeColumn` / `widenEdgeColumn`) keeps the type the first values implied, with one W_WIDENING_UNSUPPORTED warning\n * per attribute.\n * @public\n * @category Writing a format\n */\nexport class TextCellWriter {\n /** The column name in the sink. */\n readonly name: string;\n\n private readonly domain: \"node\" | \"edge\";\n\n private readonly sink: GraphSink;\n\n private readonly report: ImportReportBuilder;\n\n private handle: ColumnHandle = INVALID_INDEX as ColumnHandle;\n\n /** The widest text dtype seen (the column's dtype under the 5.1 grammar). */\n private textDtype: TextDtype | null = null;\n\n /** The widest dtype the pushed values imply (what the sink inferred on its own). */\n private valueDtype: TextDtype | null = null;\n\n private readonly keptRows: number[] = [];\n\n private readonly keptTexts: string[] = [];\n\n /**\n * Create a writer. The attribute is added to the sink on the first write.\n * @param name - the attribute name\n * @param domain - \"node\" for a node attribute, \"edge\" for an edge attribute\n * @param sink - the sink the importer fills\n * @param report - the import report, for warnings about the values\n */\n constructor(name: string, domain: \"node\" | \"edge\", sink: GraphSink, report: ImportReportBuilder) {\n this.name = name;\n this.domain = domain;\n this.sink = sink;\n this.report = report;\n }\n\n /**\n * The sink's handle of the attribute's column, for reading it back.\n * @returns the handle, or INVALID_INDEX before the first write\n */\n get column(): ColumnHandle {\n return this.handle;\n }\n\n /**\n * Write one cell.\n * @param row - the node or edge index, as the sink's addNode() or addEdge() returned it\n * @param text - the cell text, exactly as read from the file\n */\n write(row: number, text: string): void {\n const kind = inferTextDtype(text);\n const value = parseTextCell(text);\n this.warnIfImprecise(text, value);\n const wasString = this.textDtype === \"string\";\n const textDtype =\n this.textDtype === null || textDtypeRank(kind) > textDtypeRank(this.textDtype) ? kind : this.textDtype;\n // a string column keeps every cell's lexical form; a numeric text is never re-spelled. The\n // sink may refuse the value (a declared column of another dtype): the state advances only\n // once the cell is written, so a refused cell leaves the writer as it was.\n this.set(row, textDtype === \"string\" ? text : value);\n this.textDtype = textDtype;\n const valueKind = kindOfValue(value);\n if (this.valueDtype === null || textDtypeRank(valueKind) > textDtypeRank(this.valueDtype)) {\n this.valueDtype = valueKind;\n }\n if (this.textDtype === \"string\") {\n if (!wasString && this.keptRows.length > 0) {\n // the sink just widened the column to string from the values; restore the texts\n // whose lexical form the values did not carry\n for (let i = 0; i < this.keptRows.length; i++) {\n this.set(this.keptRows[i], this.keptTexts[i]);\n }\n this.keptRows.length = 0;\n this.keptTexts.length = 0;\n }\n return;\n }\n if (typeof value === \"number\" && !isCanonicalNumberText(text, value)) {\n this.keptRows.push(row);\n this.keptTexts.push(text);\n }\n if (this.textDtype === \"f64\" && this.valueDtype !== \"f64\") {\n this.widen(\"f64\");\n }\n }\n\n /**\n * Warn, once per column, when the cell is an integer beyond 2^53 that is stored as the nearest\n * double.\n * @param text - the cell text\n * @param value - the parsed value\n */\n private warnIfImprecise(text: string, value: unknown): void {\n if (\n typeof value === \"number\" &&\n !Number.isSafeInteger(value) &&\n I32_TEXT.test(text) &&\n BigInt(text) !== BigInt(value)\n ) {\n this.report.warnOnce(\n \"precision\",\n PRECISION_CODE,\n `${this.domain} column \"${this.name}\": integers beyond 2^53 are stored as the nearest double (first: ${text})`,\n { element: this.name },\n `${PRECISION_CODE}:${this.domain}:${this.name}`,\n );\n }\n }\n\n /**\n * Write a value (the parsed scalar, or a text into a widened column).\n * @param row - the row\n * @param value - the value\n */\n private set(row: number, value: unknown): void {\n if (this.handle === INVALID_INDEX) {\n if (this.domain === \"node\") {\n this.sink.setNodeValue(this.name, row, value);\n this.handle = this.sink.nodeColumn(this.name);\n } else {\n this.sink.setEdgeValue(this.name, row, value);\n this.handle = this.sink.edgeColumn(this.name);\n }\n return;\n }\n if (this.domain === \"node\") {\n this.sink.setNodeValue(this.handle, row, value);\n } else {\n this.sink.setEdgeValue(this.handle, row, value);\n }\n }\n\n /**\n * Widen the column to the dtype the text grammar implies, through the sink's optional call.\n * @param dtype - the dtype\n */\n private widen(dtype: \"f64\"): void {\n const { sink } = this;\n const supported =\n this.domain === \"node\" ? sink.widenNodeColumn !== undefined : sink.widenEdgeColumn !== undefined;\n if (!supported) {\n this.report.warnOnce(\n \"coercion\",\n WIDENING_UNSUPPORTED_CODE,\n `column \"${this.name}\" holds ${dtype} text but the sink cannot widen an inferred column; it keeps the value-inferred dtype`,\n { element: this.name },\n );\n this.valueDtype = dtype;\n return;\n }\n try {\n if (this.domain === \"node\") {\n sink.widenNodeColumn?.(this.handle, dtype);\n } else {\n sink.widenEdgeColumn?.(this.handle, dtype);\n }\n this.valueDtype = dtype;\n } catch (err) {\n if (!(err instanceof GraphFormatError) || err.code !== \"E_COLUMN_TYPE\") {\n throw err;\n }\n // a caller's declared column of the name: its dtype stands\n this.valueDtype = dtype;\n }\n }\n}\n\n/**\n * Your graph builder cannot change an attribute's type after its first value, so a text column keeps the type of its\n * first values.\n * @category Issue and loss codes\n */\nexport const WIDENING_UNSUPPORTED_CODE = \"W_WIDENING_UNSUPPORTED\";\n\n/**\n * The text dtype a parsed cell value implies on its own (what the sink's inference sees). It must\n * be graph-format's inference rule exactly: -0 is an integer there, so a column holding only\n * `-0.0` is inferred i32 and must be widened to f64, or the sign is lost.\n * @param value - the parsed value\n * @returns the dtype\n */\nfunction kindOfValue(value: boolean | number | string): TextDtype {\n if (typeof value === \"boolean\") {\n return \"bool\";\n }\n if (typeof value === \"string\") {\n return \"string\";\n }\n return Number.isInteger(value) && value >= -2147483648 && value <= 2147483647 ? \"i32\" : \"f64\";\n}\n"],"names":[],"mappings":";;AAoBA,MAAM,WAAW;AACjB,MAAM,WAAW;AACjB,MAAM,UAAU;AAChB,MAAM,UAAU;AAcT,SAAS,kBAAkB,QAAwB;AACtD,MAAI,MAAM,OAAO;AACjB,SAAO,MAAM,KAAK,OAAO,MAAM,CAAC,MAAM,KAAK;AACvC;AAAA,EACJ;AACA,SAAO,OAAO,MAAM,GAAG,GAAG;AAC9B;AAQO,SAAS,eAAe,MAAyB;AACpD,MAAI,SAAS,UAAU,SAAS,SAAS;AACrC,WAAO;AAAA,EACX;AACA,MAAI,SAAS,KAAK,IAAI,GAAG;AACrB,UAAM,IAAI,OAAO,IAAI;AACrB,QAAI,KAAK,WAAW,KAAK,SAAS;AAC9B,aAAO;AAAA,IACX;AACA,WAAO,OAAO,SAAS,CAAC,IAAI,QAAQ;AAAA,EACxC;AACA,MAAI,SAAS,KAAK,IAAI,KAAK,OAAO,SAAS,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;AAEA,WAAK,aAAa;AAAA,IACtB;AAAA,EACJ;AACJ;AAOO,MAAM,4BAA4B;AASzC,SAAS,YAAY,OAA6C;AAC9D,MAAI,OAAO,UAAU,WAAW;AAC5B,WAAO;AAAA,EACX;AACA,MAAI,OAAO,UAAU,UAAU;AAC3B,WAAO;AAAA,EACX;AACA,SAAO,OAAO,UAAU,KAAK,KAAK,SAAS,eAAe,SAAS,aAAa,QAAQ;AAC5F;"}
@@ -1,5 +1,5 @@
1
- import { p as plural, a as agree } from "./format-BpQBx8MZ.js";
2
- import { s as styleFingerprint, a as STYLE_ISSUE, b as styleTag, w as writeStyleBlock, c as styleBlockLosses, r as resolveStyles, S as STYLE_BLOCK_NAME, d as canonicalFor, e as degreeValues, f as dataCell, p as plainCell } from "./block-DiGq58c3.js";
1
+ import { p as plural, a as agree } from "./report-CgdsL9Hb.js";
2
+ import { s as styleFingerprint, a as STYLE_ISSUE, b as styleTag, w as writeStyleBlock, c as styleBlockLosses, r as resolveStyles, S as STYLE_BLOCK_NAME, d as canonicalFor, e as degreeValues, f as dataCell, t as toolDefaults, p as plainCell } from "./block-Cu22ewuS.js";
3
3
  const STYLE_ROLES = /* @__PURE__ */ new Set(["color", "size", "shape", "thickness", "hidden"]);
4
4
  const TARGETS = ["node", "edge"];
5
5
  function prepareStyleExport(snapshot, exporter, given, plain) {
@@ -304,7 +304,8 @@ function lossNotes(extracted, exporter, caps, picture, snapshot) {
304
304
  }
305
305
  function graphLossNotes(extracted, exporter, caps) {
306
306
  const graphWritten = new Set(caps?.graph ?? []);
307
- return Object.keys(extracted.styles.graph).filter((property) => !graphWritten.has(property)).map(
307
+ const drawn = (caps?.tool === void 0 ? null : toolDefaults(caps.tool))?.graph ?? {};
308
+ return Object.entries(extracted.styles.graph).filter(([property, value]) => !graphWritten.has(property) && drawn[property]?.value !== value).map(([property]) => property).map(
308
309
  (property) => Object.freeze({
309
310
  code: STYLE_ISSUE.NOT_WRITTEN,
310
311
  message: `the graph's ${property} is not written: the ${exporter.format} format has no place for it`,
@@ -445,4 +446,4 @@ export {
445
446
  prepareStyleExport as p,
446
447
  sharedInExportCall as s
447
448
  };
448
- //# sourceMappingURL=writer-DMKvthQE.js.map
449
+ //# sourceMappingURL=writer-DvHTl36J.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"writer-DvHTl36J.js","sources":["../../src/styles/io/writer.ts"],"sourcesContent":["/**\n * Writing a graph's styles: what `exportGraph(snapshot, format, { styles })` hands a format's exporter, the losses\n * reported before anything is written, and, for an exporter whose block goes into attributes, the snapshot with the\n * `graphty.styles` block and the tagged per-element values added as attributes.\n */\n\nimport type { GraphSnapshot } from \"@graphty/graph-format\";\n\nimport { agree, plural } from \"../../common/plural.js\";\nimport type { GraphExporter, LossNote } from \"../../types.js\";\nimport { STYLE_ISSUE } from \"../codes.js\";\nimport { toolDefaults } from \"../defaults.js\";\nimport { styleFingerprint } from \"../plan/features.js\";\nimport { canonicalFor, dataCell, degreeValues, plainCell, resolveStyles } from \"../plan/resolve.js\";\nimport type {\n ExtractedStyles,\n Mapping,\n StyleColumn,\n StyleProperty,\n StyleRule,\n StyleTarget,\n StyleValue,\n StyleWriteCapabilities,\n} from \"../types.js\";\nimport { STYLE_BLOCK_NAME, styleBlockLosses, styleTag, writeStyleBlock } from \"./block.js\";\n\n/**\n * What an exporter with a `styles` member receives as `options.styles` when styles are being written.\n * @category Styles\n */\nexport interface ExporterStyleInput {\n /**\n * Each element's value of one property, by element index (null where no rule gives one): what graphty draws, to\n * write into the format's own style slots.\n * @param target - nodes or edges\n * @param property - the property\n * @returns the values\n */\n picture(target: StyleTarget, property: StyleProperty): readonly (StyleValue | null)[];\n /** The `graphty.styles` block (JSON text) to place where the format keeps extra data. */\n readonly block: string;\n /** The per-element style values the block's rules read, by attribute name (`graphty.style.<target>.<key>`). */\n readonly tags: {\n /** Node values. */\n readonly node: ReadonlyMap<string, StyleColumn>;\n /** Edge values. */\n readonly edge: ReadonlyMap<string, StyleColumn>;\n };\n /** The styles themselves, for a format with a style language of its own. */\n readonly rules: ExtractedStyles;\n}\n\n/**\n * The options an exporter with a `styles` member reads its styles from: type its options as `Opts &\n * ExporterStyleOptions`.\n * @category Styles\n */\nexport interface ExporterStyleOptions {\n /** Present when styles are being written. */\n readonly styles?: ExporterStyleInput | undefined;\n}\n\n/** What an export with styles writes and loses, worked out before writing. */\ninterface PreparedStyleExport {\n /** The snapshot to hand the exporter: style roles removed, and the block and tagged values added as attributes. */\n readonly snapshot: GraphSnapshot;\n /** The exporter's `options.styles`, or null for an exporter without a `styles` member. */\n readonly input: ExporterStyleInput | null;\n /** W_STYLE_ notes: every property not written natively, and the rules when they are not kept. */\n readonly notes: readonly LossNote[];\n /** E_STYLES_MISMATCH when the styles belong to a different graph; nothing is then written. */\n readonly refusal: LossNote | null;\n}\n\n/** The roles of columns that hold styles; with styles given they are data, never written into a style slot. */\nconst STYLE_ROLES: ReadonlySet<string> = new Set([\"color\", \"size\", \"shape\", \"thickness\", \"hidden\"]);\nconst TARGETS: readonly StyleTarget[] = [\"node\", \"edge\"];\n\n/**\n * Works out an export with styles: the refusal when the styles belong to another graph, the losses, the exporter's\n * `options.styles`, and the snapshot to write.\n * @param snapshot - the graph being written\n * @param exporter - the format's exporter\n * @param given - the styles\n * @param plain - the export's other options, which decide what the format loses of the graph's data\n * @returns what to write and what is lost\n */\nexport function prepareStyleExport(\n snapshot: GraphSnapshot,\n exporter: GraphExporter,\n given: ExtractedStyles,\n plain?: Readonly<Record<string, unknown>>,\n): PreparedStyleExport {\n const fp = styleFingerprint(snapshot);\n const want = given.fingerprint;\n if (fp.nodes !== want.nodes || fp.edges !== want.edges || fp.ids !== want.ids) {\n return {\n snapshot,\n input: null,\n notes: [],\n refusal: Object.freeze({\n code: STYLE_ISSUE.MISMATCH,\n message: `the styles were read from or built for a different graph (${String(want.nodes)} nodes and ${String(want.edges)} edges, this graph has ${String(fp.nodes)} and ${String(fp.edges)}, or other node ids); nothing is written`,\n column: null,\n count: null,\n }),\n };\n }\n const caps = exporter.styles?.capabilities ?? null;\n let plan = writePlan(snapshot, exporter, given);\n if (keepsStyleBlock(exporter)) {\n // what the export loses of the graph's data, styles written as they are: the rules' inputs among it are carried\n let checked: readonly LossNote[];\n try {\n checked = exporter.check(plan.snapshot, plan.input === null ? plain : { ...plain, styles: plan.input });\n } catch {\n checked = [];\n }\n const carried = withLostInputsCarried(given, snapshot, checked);\n if (carried !== given) {\n plan = writePlan(snapshot, exporter, carried);\n }\n }\n return {\n snapshot: plan.snapshot,\n input: plan.input,\n notes: lossNotes(plan.extracted, exporter, caps, plan.picture, snapshot),\n refusal: null,\n };\n}\n\n/**\n * The work an exporter shares between the check and the write of one export call, by the styles input made for that\n * call (null until the first exporter step does it). Only an input writePlan() made is here, so an input a caller\n * builds and changes in place is always worked out again.\n */\nconst CALL_WORK = new WeakMap<\n ExporterStyleInput,\n { readonly key: readonly unknown[]; readonly value: unknown } | null\n>();\n\n/**\n * Work an exporter does from its styles input once per export call: the registry checks before it writes, with the\n * same input, graph and options. Outside an export call (an input the caller made) it is done every time.\n * @param input - the exporter's `options.styles`\n * @param key - what else the work reads (the graph, options), compared by identity\n * @param compute - the work\n * @returns its result\n */\nexport function sharedInExportCall<T>(input: ExporterStyleInput, key: readonly unknown[], compute: () => T): T {\n if (!CALL_WORK.has(input)) {\n return compute();\n }\n const done = CALL_WORK.get(input);\n if (done?.key.length === key.length && done.key.every((k, i) => k === key[i])) {\n return done.value as T;\n }\n const value = compute();\n CALL_WORK.set(input, { key, value });\n return value;\n}\n\n/**\n * What an exporter is handed to write a graph's styles: the snapshot with the block and tagged values added where\n * the format keeps them, and its `options.styles`.\n * @param snapshot - the graph\n * @param exporter - the exporter\n * @param extracted - the styles\n * @returns the plan\n */\nfunction writePlan(\n snapshot: GraphSnapshot,\n exporter: GraphExporter,\n extracted: ExtractedStyles,\n): {\n readonly snapshot: GraphSnapshot;\n readonly input: ExporterStyleInput | null;\n readonly extracted: ExtractedStyles;\n readonly picture: (target: StyleTarget, property: StyleProperty) => readonly (StyleValue | null)[];\n} {\n const caps = exporter.styles?.capabilities ?? null;\n const pictures = new Map<string, readonly (StyleValue | null)[]>();\n const picture = (target: StyleTarget, property: StyleProperty): readonly (StyleValue | null)[] => {\n const key = `${target}\\u0000${property}`;\n let values = pictures.get(key);\n if (values === undefined) {\n values = resolveStyles(extracted, target, property, snapshot);\n pictures.set(key, values);\n }\n return values;\n };\n const tags = { node: new Map<string, StyleColumn>(), edge: new Map<string, StyleColumn>() };\n for (const target of TARGETS) {\n for (const [key, col] of extracted.columns[target]) {\n tags[target].set(styleTag(target, key), col);\n }\n }\n const block = writeStyleBlock(extracted, { snapshot });\n const input = exporter.styles === undefined ? null : { picture, block, tags, rules: extracted };\n if (input !== null) {\n CALL_WORK.set(input, null);\n }\n return {\n snapshot: styledSnapshot(snapshot, caps, tags, block, extracted.styles.rules),\n input,\n extracted,\n picture,\n };\n}\n\n/**\n * Loss notes about a column whose values read back the same: written elsewhere (CSV's node table), under another\n * name a block finds by its values, with another role, storage or number type, or as a wider type.\n */\nconst VALUES_KEPT = /NODE_TABLE|NAME_CHANGED|ROLE_ASSUMED|STORAGE_CLASS|NUMBER_TYPE|INTEGRAL|WIDENED/;\n\n/**\n * The styles with every input the format will not read back as it is given carried as a style column of its own: a\n * data column the export drops or changes (its loss notes name it), and the in and out degrees when the file does not\n * keep the edges' direction. The rules then read the copies, which the file keeps beside the block, and give back the\n * same values.\n * @param extracted - the styles\n * @param snapshot - the graph\n * @param notes - what the export, styles written as they are, loses\n * @returns the styles, the same object when nothing is lost\n */\nfunction withLostInputsCarried(\n extracted: ExtractedStyles,\n snapshot: GraphSnapshot,\n notes: readonly LossNote[],\n): ExtractedStyles {\n const lost = new Set<string>();\n let direction = false;\n for (const note of notes) {\n if (!VALUES_KEPT.test(note.code)) {\n for (const name of note.columns ?? (note.column === null ? [] : [note.column])) {\n lost.add(name);\n }\n }\n direction ||= /DIRECTION/.test(note.code);\n }\n const carrier = new LostInputs(snapshot, lost, direction, extracted.columns);\n const rules = extracted.styles.rules.map((rule) => carrier.carry(rule));\n const changed = rules.some((rule, i) => rule !== extracted.styles.rules[i]);\n return changed ? { ...extracted, styles: { ...extracted.styles, rules }, columns: carrier.columns } : extracted;\n}\n\n/** Carries the inputs of rules that the format will not read back into style columns of their own. */\nclass LostInputs {\n /** The style columns, the copies added. */\n readonly columns: { readonly node: Map<string, StyleColumn>; readonly edge: Map<string, StyleColumn> };\n\n /** Whether the rule being carried read a lost input. */\n private touched = false;\n\n /**\n * A carrier for one export.\n * @param snapshot - the graph\n * @param lost - the data columns the export drops or changes\n * @param direction - whether the file loses the edges' direction (and so the in and out degrees)\n * @param columns - the styles' own style columns\n * @param columns.node - the node columns\n * @param columns.edge - the edge columns\n */\n constructor(\n private readonly snapshot: GraphSnapshot,\n private readonly lost: ReadonlySet<string>,\n private readonly direction: boolean,\n columns: { readonly node: ReadonlyMap<string, StyleColumn>; readonly edge: ReadonlyMap<string, StyleColumn> },\n ) {\n this.columns = { node: new Map(columns.node), edge: new Map(columns.edge) };\n }\n\n /**\n * A rule with every lost input it reads replaced by a copy of its values.\n * @param rule - the rule\n * @returns the rule read from copies, or the rule itself when it reads no lost input\n */\n carry(rule: StyleRule): StyleRule {\n this.touched = false;\n const { ext, ...given } = rule;\n const map = this.carryMap(rule);\n const where = this.walk(rule, given.where);\n if (!this.touched) {\n return rule;\n }\n const { map: _given, ...unmapped } = given;\n const plain = Object.keys(map).length === 0 ? { ...unmapped, where } : { ...unmapped, where, map };\n // a JSON copy drops undefined members, as the written block does; structuredClone would keep them\n const moved = JSON.parse(JSON.stringify(plain)) as StyleRule; // NOSONAR(S7784): undefined members must go\n return ext === undefined ? moved : { ...moved, ext };\n }\n\n /**\n * A rule's mappings with their lost inputs replaced. A passthrough reads a data column as the property's value: its\n * copy holds those values; one that gives no element a value (a list, text that is not a color) is left out, so\n * no other value the file reads back in the column (a list written as text) is given either.\n * @param rule - the rule\n * @returns the mappings\n */\n private carryMap(rule: StyleRule): Record<string, Mapping> {\n const map = Object.create(null) as Record<string, Mapping>;\n const { table } = this.tableOf(rule.target);\n for (const [property, mapping] of Object.entries(rule.map ?? {})) {\n if (mapping === undefined) {\n continue;\n }\n if (mapping.kind !== \"passthrough\") {\n map[property] = this.walk(rule, mapping);\n continue;\n }\n const name = (mapping.by as { data?: unknown }).data;\n const lostColumn = typeof name === \"string\" && this.lost.has(name) && table.has(name);\n const values = lostColumn ? this.cells(rule.target, name, canonicalFor(rule.target, property)) : null;\n if (values !== null && !values.some((v) => v !== null)) {\n this.touched = true;\n } else if (values !== null && this.isLost(rule.target, name)) {\n this.touched = true;\n map[property] = { ...mapping, by: this.copy(rule.target, `${property}.data.${name}`, () => values) };\n } else {\n map[property] = mapping;\n }\n }\n return map;\n }\n\n /**\n * A value with every other reference to a lost input reading a copy of its values as they are.\n * @param rule - the rule it belongs to\n * @param value - the value\n * @returns the value, references replaced\n */\n private walk<T>(rule: StyleRule, value: T): T {\n return JSON.parse(JSON.stringify(value, (_k, v: unknown) => this.replaced(rule, v))) as T;\n }\n\n /**\n * One reference with a lost input replaced by its copy: a data column, or a degree the file does not keep.\n * @param rule - the rule it belongs to\n * @param v - a value of the rule\n * @returns the value, or the reference to the copy\n */\n private replaced(rule: StyleRule, v: unknown): unknown {\n if (typeof v !== \"object\" || v === null || Array.isArray(v) || Object.keys(v).length !== 1) {\n return v;\n }\n const ref = v as { data?: unknown; computed?: unknown };\n if (this.isLost(rule.target, ref.data)) {\n const name = ref.data;\n this.touched = true;\n return this.copy(rule.target, `data.${name}`, () =>\n this.cells(rule.target, name, (raw) => (isStyleScalar(raw) ? raw : null)),\n );\n }\n const which = ref.computed;\n if ((which === \"indegree\" || which === \"outdegree\") && this.direction && rule.target === \"node\") {\n this.touched = true;\n return this.copy(rule.target, `computed.${which}`, () => degreeValues(this.snapshot, which));\n }\n return v;\n }\n\n /**\n * The reference to a copy of an input, made on first use and shared by every rule that reads it.\n * @param target - nodes or edges\n * @param base - what is copied\n * @param values - its values\n * @returns the reference\n */\n private copy(target: StyleTarget, base: string, values: () => StyleColumn): { style: string } {\n const key = `input.${base}`;\n const held = this.columns[target];\n if (!held.has(key)) {\n held.set(key, values());\n }\n return { style: key };\n }\n\n /**\n * Whether a name is a lost input that can be copied: only a column of plain values can, and a list, or a column with\n * no value, stays as it is.\n * @param target - nodes or edges\n * @param name - the name\n * @returns true for a lost input\n */\n private isLost(target: StyleTarget, name: unknown): name is string {\n const { table, n } = this.tableOf(target);\n return typeof name === \"string\" && this.lost.has(name) && table.has(name) && carriable(table, n, name);\n }\n\n /**\n * Every element's value of a data column.\n * @param target - nodes or edges\n * @param name - the column\n * @param read - the value of a cell\n * @returns the values\n */\n private cells(target: StyleTarget, name: string, read: (raw: unknown) => StyleValue | null): StyleColumn {\n const { table, n } = this.tableOf(target);\n return Array.from({ length: n }, (_u, i) => read(dataCell(table, name, i)));\n }\n\n /**\n * A target's table and row count.\n * @param target - nodes or edges\n * @returns the table and its row count\n */\n private tableOf(target: StyleTarget): { table: GraphSnapshot[\"nodes\"]; n: number } {\n const { snapshot } = this;\n return target === \"node\"\n ? { table: snapshot.nodes, n: snapshot.nodeCount }\n : { table: snapshot.edges, n: snapshot.edgeCount };\n }\n}\n\n/**\n * Whether a data column can be copied into a style column: some value, and every value text, a finite number or a\n * boolean.\n * @param table - the table\n * @param n - its row count\n * @param name - the column\n * @returns true when it can\n */\nfunction carriable(table: GraphSnapshot[\"nodes\"], n: number, name: string): boolean {\n let some = false;\n for (let i = 0; i < n; i++) {\n const cell = plainCell(table.value(name, i));\n if (cell !== null && cell !== undefined) {\n if (!isStyleScalar(cell)) {\n return false;\n }\n some = true;\n }\n }\n return some;\n}\n\n/**\n * Whether a cell is a value a style column holds: text, a finite number or a boolean.\n * @param v - the cell\n * @returns true for a scalar\n */\nfunction isStyleScalar(v: unknown): v is StyleValue {\n return typeof v === \"string\" || typeof v === \"boolean\" || (typeof v === \"number\" && Number.isFinite(v));\n}\n\n/**\n * Whether an exporter keeps the `graphty.styles` block, natively or as a graph attribute.\n * @param exporter - the exporter\n * @returns true when the block is written\n */\nfunction keepsStyleBlock(exporter: GraphExporter): boolean {\n const caps = exporter.styles?.capabilities;\n return (\n caps !== undefined &&\n (caps.block === \"native\" || (caps.block === \"attributes\" && exporter.capabilities.graphAttributes))\n );\n}\n\n/**\n * Whether a loss note is about a property only graphty draws (`graphty:<channel>`) in a file that keeps the block:\n * the block carries it, and no other program would draw it, so nothing is lost.\n * @param note - the note\n * @param exporter - the exporter writing the file\n * @returns true when the note names nothing lost\n */\nexport function isKeptGraphtyProperty(note: LossNote, exporter: GraphExporter): boolean {\n return note.style?.property.startsWith(\"graphty:\") === true && keepsStyleBlock(exporter);\n}\n\n/**\n * The losses of an export with styles: W_STYLE_NOT_WRITTEN for every property the format does not write natively\n * (all of them for an exporter without a `styles` member), and W_STYLE_RULES_NOT_KEPT when the block is not kept.\n * @param extracted - the styles\n * @param exporter - the exporter\n * @param caps - its style capabilities, or null\n * @param picture - each element's value of a property\n * @param snapshot - the graph\n * @returns the notes\n */\nfunction lossNotes(\n extracted: ExtractedStyles,\n exporter: GraphExporter,\n caps: StyleWriteCapabilities | null,\n picture: (target: StyleTarget, property: StyleProperty) => readonly (StyleValue | null)[],\n snapshot: GraphSnapshot,\n): LossNote[] {\n const notes: LossNote[] = [];\n const kept = keepsStyleBlock(exporter);\n for (const target of TARGETS) {\n const written = new Set<string>(caps?.[target] ?? []);\n for (const property of ruleProperties(extracted.styles.rules, target)) {\n // a property only graphty draws is written into the block alone: lost only when the block is\n if (written.has(property) || (kept && property.startsWith(\"graphty:\"))) {\n if (target === \"edge\") {\n notes.push(...pairNotes(snapshot, exporter, property, picture(\"edge\", property as StyleProperty)));\n }\n } else {\n notes.push(notWrittenNote(target, property, exporter, picture));\n }\n }\n }\n notes.push(...graphLossNotes(extracted, exporter, caps));\n if (kept) {\n notes.push(...styleBlockLosses(writeStyleBlock(extracted, { snapshot }), extracted.styles.rules.length));\n } else if (extracted.styles.rules.length > 0) {\n notes.push(\n Object.freeze({\n code: STYLE_ISSUE.RULES_NOT_KEPT,\n message: `the style rules are not kept: the ${exporter.format} format has no place for them; importing the file infers them again from what it holds`,\n column: null,\n count: extracted.styles.rules.length,\n }),\n );\n }\n return notes;\n}\n\n/**\n * W_STYLE_NOT_WRITTEN for every graph property the format does not write, except one whose value is what the program\n * the format is written for draws anyway (a white background for yEd): nothing is lost there.\n * @param extracted - the styles\n * @param exporter - the exporter\n * @param caps - its style capabilities, or null\n * @returns the notes\n */\nfunction graphLossNotes(\n extracted: ExtractedStyles,\n exporter: GraphExporter,\n caps: StyleWriteCapabilities | null,\n): LossNote[] {\n const graphWritten = new Set<string>(caps?.graph ?? []);\n const drawn: Readonly<Record<string, { readonly value: unknown } | undefined>> =\n (caps?.tool === undefined ? null : toolDefaults(caps.tool))?.graph ?? {};\n return Object.entries(extracted.styles.graph)\n .filter(([property, value]) => !graphWritten.has(property) && drawn[property]?.value !== value)\n .map(([property]) => property)\n .map((property) =>\n Object.freeze({\n code: STYLE_ISSUE.NOT_WRITTEN,\n message: `the graph's ${property} is not written: the ${exporter.format} format has no place for it`,\n column: null,\n count: 1,\n style: Object.freeze({ target: \"graph\" as const, property: property as \"background\" }),\n }),\n );\n}\n\n/**\n * The properties the rules of a target write, in first-written order.\n * @param rules - the rules\n * @param target - nodes or edges\n * @returns the properties\n */\nfunction ruleProperties(rules: readonly StyleRule[], target: StyleTarget): Set<string> {\n return new Set(\n rules\n .filter((rule) => rule.target === target)\n .flatMap((rule) => [...Object.keys(rule.set ?? {}), ...Object.keys(rule.map ?? {})]),\n );\n}\n\n/**\n * W_STYLE_NOT_WRITTEN for a property the format has no place for.\n * @param target - nodes or edges\n * @param property - the property\n * @param exporter - the exporter\n * @param picture - each element's value of a property\n * @returns the note\n */\nfunction notWrittenNote(\n target: StyleTarget,\n property: string,\n exporter: GraphExporter,\n picture: (target: StyleTarget, property: StyleProperty) => readonly (StyleValue | null)[],\n): LossNote {\n const count = picture(target, property as StyleProperty).filter((v) => v !== null).length;\n return Object.freeze({\n code: STYLE_ISSUE.NOT_WRITTEN,\n message: `${target} ${property} is not written: the ${exporter.format} format has no place for it (${String(count)} ${target}${plural(count)} ${agree(count, \"has\", \"have\")} a value)`,\n column: null,\n count,\n style: Object.freeze({ target, property: property as StyleProperty }),\n });\n}\n\n/**\n * W_STYLE_APPROXIMATED for the second halves of undirected edges in a directed graph whose value of a property\n * differs from the first half's: every format writes such an edge once, so both halves read back with one value.\n * @param snapshot - the graph\n * @param exporter - the exporter\n * @param property - the edge property\n * @param values - each edge's value\n * @returns the note, or none\n */\nfunction pairNotes(\n snapshot: GraphSnapshot,\n exporter: GraphExporter,\n property: string,\n values: readonly (StyleValue | null)[],\n): LossNote[] {\n const pair = snapshot.edges.byRole(\"pair\");\n let count = 0;\n for (let i = 0; pair !== null && i < values.length; i++) {\n const other = pair.isSet(i) ? (pair.value(i) as number) : i;\n if (other < i && values[i] !== values[other]) {\n count++;\n }\n }\n if (count === 0) {\n return [];\n }\n return [\n Object.freeze({\n code: STYLE_ISSUE.APPROXIMATED,\n message: `edge ${property}: ${String(count)} undirected edge${plural(count)} in a directed graph ${agree(count, \"has\", \"have\")} another value on each half; the ${exporter.format} format writes the edge once, with the first half's value`,\n column: null,\n count,\n style: Object.freeze({ target: \"edge\" as const, property: property as StyleProperty }),\n }),\n ];\n}\n\n/**\n * The snapshot an exporter writes when styles are given: columns with a style role keep their data but lose the\n * role (the style writer is the only thing that writes the format's style slots), and for `block: \"attributes\"`\n * the block becomes a graph attribute and the tagged values element attributes.\n * @param snapshot - the graph\n * @param caps - the exporter's style capabilities, or null\n * @param tags - the tagged per-element values\n * @param tags.node - node values by attribute name\n * @param tags.edge - edge values by attribute name\n * @param block - the block's text\n * @param rules - the rules written, which keep a style value column of an earlier write they read as data\n * @returns the snapshot to write (the same object when nothing changes)\n */\nfunction styledSnapshot(\n snapshot: GraphSnapshot,\n caps: StyleWriteCapabilities | null,\n tags: { readonly node: ReadonlyMap<string, StyleColumn>; readonly edge: ReadonlyMap<string, StyleColumn> },\n block: string,\n rules: readonly StyleRule[],\n): GraphSnapshot {\n const attributes = caps?.block === \"attributes\";\n // the per-element style values of an earlier write whose block was set aside are data now; these styles write\n // their own under the same names, so the old ones go, unless these styles read them as data\n const stale = { node: staleTags(snapshot.nodes, rules, \"node\"), edge: staleTags(snapshot.edges, rules, \"edge\") };\n // a format that writes the label from the styles has its label slot taken: the label column is data there too\n const roles = { node: roledNames(snapshot.nodes, caps, \"node\"), edge: roledNames(snapshot.edges, caps, \"edge\") };\n // the block of an earlier import is replaced by the one these styles write, wherever the format puts that\n const staleBlock = snapshot.graph.has(STYLE_BLOCK_NAME);\n const changes = [stale.node, stale.edge, roles.node, roles.edge].some((names) => names.length > 0);\n if (!attributes && !staleBlock && !changes) {\n return snapshot;\n }\n const out = snapshot.withColumns();\n if (staleBlock) {\n out.graph.remove(STYLE_BLOCK_NAME);\n }\n for (const target of TARGETS) {\n const table = target === \"node\" ? out.nodes : out.edges;\n for (const name of stale[target]) {\n table.remove(name);\n }\n for (const name of roles[target]) {\n const col = table.get(name);\n if (col !== null) {\n // an explicit undefined role in the patch replaces the column's role with none\n table.set(name, col, { role: undefined });\n }\n }\n }\n if (attributes) {\n setTagAttributes(out, tags);\n out.graph.set(STYLE_BLOCK_NAME, [block], { dtype: \"string\" });\n }\n return out;\n}\n\n/**\n * The per-element style values of an earlier write that these rules do not read as data.\n * @param table - the node or edge table\n * @param rules - the rules written\n * @param target - nodes or edges\n * @returns the column names\n */\nfunction staleTags(table: GraphSnapshot[\"nodes\"], rules: readonly StyleRule[], target: StyleTarget): string[] {\n const read = dataRead(rules, target);\n return table.names().filter((name) => isStyleTagName(name) && !read.has(name));\n}\n\n/**\n * The columns whose style role the styles take: every style role, and the label where the format writes the label\n * from the styles.\n * @param table - the node or edge table\n * @param caps - the exporter's style capabilities, or null\n * @param target - nodes or edges\n * @returns the column names\n */\nfunction roledNames(table: GraphSnapshot[\"nodes\"], caps: StyleWriteCapabilities | null, target: StyleTarget): string[] {\n const writesLabel = (caps?.[target] ?? []).includes(\"label\");\n return table.names().filter((name) => {\n const role = table.get(name)?.meta.role ?? \"\";\n return STYLE_ROLES.has(role) || (role === \"label\" && writesLabel);\n });\n}\n\n/**\n * Sets the tagged per-element values as element attributes, replacing those of an earlier import in the order of\n * these styles' columns, so writing a file read back gives the same bytes whichever elements held a value first.\n * @param out - the graph, changed in place\n * @param tags - the tagged values\n * @param tags.node - node values by attribute name\n * @param tags.edge - edge values by attribute name\n */\nfunction setTagAttributes(\n out: GraphSnapshot,\n tags: { readonly node: ReadonlyMap<string, StyleColumn>; readonly edge: ReadonlyMap<string, StyleColumn> },\n): void {\n for (const target of TARGETS) {\n const table = target === \"node\" ? out.nodes : out.edges;\n const prefix = styleTag(target, \"\");\n for (const name of table.names().filter((c) => c.startsWith(prefix))) {\n table.remove(name);\n }\n for (const [name, col] of tags[target]) {\n const dtype = tagDtype(col);\n table.set(name, dtype === \"string\" ? col.map((v) => (v === null ? null : String(v))) : col, { dtype });\n }\n }\n}\n\n/**\n * Whether a column name is one graphty writes per-element style values under: `graphty.style.<target>.<key>`, or\n * `graphty_style_<...>` where the format allows no dots in a name (GML, Cytoscape.js).\n * @param name - the column name\n * @returns true for a style value name\n */\nfunction isStyleTagName(name: string): boolean {\n return name.startsWith(\"graphty.style.\") || name.startsWith(\"graphty_style_\");\n}\n\n/**\n * The data columns the rules of one target read.\n * @param rules - the rules\n * @param target - nodes or edges\n * @returns the column names\n */\nexport function dataRead(rules: readonly StyleRule[], target: StyleTarget): Set<string> {\n const out = new Set<string>();\n for (const { ext: _ext, ...rule } of rules.filter((r) => r.target === target)) {\n JSON.stringify(rule, (_k, v: unknown) => {\n const data =\n typeof v === \"object\" && v !== null && !Array.isArray(v) ? (v as { data?: unknown }).data : null;\n if (typeof data === \"string\" && Object.keys(v as object).length === 1) {\n out.add(data);\n }\n return v;\n });\n }\n return out;\n}\n\n/**\n * The dtype a tagged column is written with: numbers, booleans or text (a mixed column as text).\n * @param col - the values\n * @returns the dtype\n */\nfunction tagDtype(col: StyleColumn): \"f64\" | \"bool\" | \"string\" {\n let kind: string | null = null;\n for (const v of col) {\n if (v === null) {\n continue;\n }\n if (kind === null) {\n kind = typeof v;\n } else if (kind !== typeof v) {\n return \"string\";\n }\n }\n if (kind === \"number\") {\n return \"f64\";\n }\n return kind === \"boolean\" ? \"bool\" : \"string\";\n}\n"],"names":[],"mappings":";;AA2EA,MAAM,kCAAuC,IAAI,CAAC,SAAS,QAAQ,SAAS,aAAa,QAAQ,CAAC;AAClG,MAAM,UAAkC,CAAC,QAAQ,MAAM;AAWhD,SAAS,mBACZ,UACA,UACA,OACA,OACmB;AACnB,QAAM,KAAK,iBAAiB,QAAQ;AACpC,QAAM,OAAO,MAAM;AACnB,MAAI,GAAG,UAAU,KAAK,SAAS,GAAG,UAAU,KAAK,SAAS,GAAG,QAAQ,KAAK,KAAK;AAC3E,WAAO;AAAA,MACH;AAAA,MACA,OAAO;AAAA,MACP,OAAO,CAAA;AAAA,MACP,SAAS,OAAO,OAAO;AAAA,QACnB,MAAM,YAAY;AAAA,QAClB,SAAS,6DAA6D,OAAO,KAAK,KAAK,CAAC,cAAc,OAAO,KAAK,KAAK,CAAC,0BAA0B,OAAO,GAAG,KAAK,CAAC,QAAQ,OAAO,GAAG,KAAK,CAAC;AAAA,QAC1L,QAAQ;AAAA,QACR,OAAO;AAAA,MAAA,CACV;AAAA,IAAA;AAAA,EAET;AACA,QAAM,OAAO,SAAS,QAAQ,gBAAgB;AAC9C,MAAI,OAAO,UAAU,UAAU,UAAU,KAAK;AAC9C,MAAI,gBAAgB,QAAQ,GAAG;AAE3B,QAAI;AACJ,QAAI;AACA,gBAAU,SAAS,MAAM,KAAK,UAAU,KAAK,UAAU,OAAO,QAAQ,EAAE,GAAG,OAAO,QAAQ,KAAK,OAAO;AAAA,IAC1G,QAAQ;AACJ,gBAAU,CAAA;AAAA,IACd;AACA,UAAM,UAAU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AAA,IAClB,WAAW,SAAS,OAAO,GAAG;AAC1B,aAAO;AAAA,IACX;AAAA,EACJ;AACA,MAAI,SAAS,UAAU;AACnB,WAAO;AAAA,EACX;AACA,SAAO,SAAS,YAAY,SAAS;AACzC;"}
package/dist/csv.js CHANGED
@@ -1,9 +1,11 @@
1
- import { p as plural, R as ROLE_TAKEN_CODE$1, I as ID_MERGED_CODE$1, j as DUPLICATE_EDGE_ID_CODE$1, k as DUPLICATE_NODE_CODE$1, o as MISSING_ID_CODE$1, n as MISSING_ENDPOINT_CODE$1, E as EMPTY_INPUT_CODE$1, Z as ImportReportBuilder, O as OPTION_IGNORED_CODE, a as agree, ad as formatInteger, aO as formatDecimal, M as MIXED_DIRECTION_CODE, D as DIRECTION_FORCED_CODE, b as DIRECTION_REFUSED_CODE, S as SINK_OPTION_CODE, C as COLUMN_RENAMED_CODE, s as UNKNOWN_ENCODING_CODE, t as ENCODING_FALLBACK_CODE, u as INVALID_ENCODING_CODE, v as INVALID_UTF8_CODE, P as PRECISION_CODE, y as ELEMENT_ISSUE, z as INPUT_ISSUE } from "./chunks/format-BpQBx8MZ.js";
2
- import { i as inferTextDtype, T as TextCellWriter, p as parseTextCell, W as WIDENING_UNSUPPORTED_CODE } from "./chunks/text-CzJNFOS9.js";
1
+ import { p as plural, R as ROLE_TAKEN_CODE$1, I as ID_MERGED_CODE$1, j as DUPLICATE_EDGE_ID_CODE$1, k as DUPLICATE_NODE_CODE$1, o as MISSING_ID_CODE$1, n as MISSING_ENDPOINT_CODE$1, E as EMPTY_INPUT_CODE$1, K as ImportReportBuilder, O as OPTION_IGNORED_CODE, a as agree, M as MIXED_DIRECTION_CODE, D as DIRECTION_FORCED_CODE, b as DIRECTION_REFUSED_CODE, S as SINK_OPTION_CODE, C as COLUMN_RENAMED_CODE, s as UNKNOWN_ENCODING_CODE, t as ENCODING_FALLBACK_CODE, u as INVALID_ENCODING_CODE, v as INVALID_UTF8_CODE, P as PRECISION_CODE, y as ELEMENT_ISSUE, z as INPUT_ISSUE } from "./chunks/report-CgdsL9Hb.js";
2
+ import { i as inferTextDtype, T as TextCellWriter, p as parseTextCell, W as WIDENING_UNSUPPORTED_CODE } from "./chunks/text-BuKQVMz2.js";
3
3
  import { GraphFormatError, INVALID_INDEX } from "@graphty/graph-format";
4
- import { ag as DICT_SAMPLE_ROWS, D as DictHeuristic, g as resolveImportOptions, j as reportSinkOptions, i as reportUnusedOptions, l as DirectionResolver, I as IdCoercer, h as throwIfAborted, s as parseWeightText, u as uniqueColumnName, R as RENAMED_CODE, d as declareResolved, c as capabilities, L as LOSS, a as checkCapabilities, r as resolveExportOptions, p as pairFolding, e as explicitWeights, ah as otherFormatDialect, ai as countMixedEdges, K as joinListText, a1 as canonicalId } from "./chunks/export-BvqAXCKh.js";
5
- import { s as stripLeadingComments, a as sniffNewline, b as sniffDelimiter, D as DELIMITER_CANDIDATES, C as CsvRecordReader, d as splitRecords, c as checkRecordSyntax, B as BAD_QUOTE_CODE, U as UNCLOSED_QUOTE_CODE } from "./chunks/records-CiaWZrFH.js";
6
- import { q as quoteCsvCell } from "./chunks/escape-CgzxiYPg.js";
4
+ import { Q as DICT_SAMPLE_ROWS, D as DictHeuristic, d as resolveImportOptions, g as reportSinkOptions, f as reportUnusedOptions, i as DirectionResolver, I as IdCoercer, o as parseWeightText, u as uniqueColumnName, R as RENAMED_CODE, j as declareResolved, c as capabilities, L as LOSS, a as checkCapabilities, r as resolveExportOptions, p as pairFolding, e as explicitWeights, S as otherFormatDialect, U as countMixedEdges, G as joinListText, O as canonicalId } from "./chunks/export-CZ7VRm4I.js";
5
+ import { b as throwIfAborted } from "./chunks/input-Ccg9I22A.js";
6
+ import { s as stripLeadingComments, a as sniffNewline, b as sniffDelimiter, D as DELIMITER_CANDIDATES, C as CsvRecordReader, d as splitRecords, c as checkRecordSyntax, B as BAD_QUOTE_CODE, U as UNCLOSED_QUOTE_CODE } from "./chunks/records-Cgvxz-Vx.js";
7
+ import { q as quoteCsvCell } from "./chunks/escape-DH2Egt-l.js";
8
+ import { c as formatInteger, d as formatDecimal } from "./chunks/format-BMS-1Nxb.js";
7
9
  import { j as joinText, e as encodeChunks } from "./chunks/writer-DxjgHwSe.js";
8
10
  const SOURCE_NAMES = Object.freeze([
9
11
  "source",