@graphty/graph-io 0.3.47 → 0.3.49

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 (770) hide show
  1. package/dist/chunks/{approximations-wWjCRzKj.js → approximations-Bzn3L-je.js} +2 -2
  2. package/dist/chunks/{approximations-wWjCRzKj.js.map → approximations-Bzn3L-je.js.map} +1 -1
  3. package/dist/chunks/bends-BGXjv_U4.js +129 -0
  4. package/dist/chunks/bends-BGXjv_U4.js.map +1 -0
  5. package/dist/chunks/{block-DiGq58c3.js → block-iptrlMBb.js} +947 -134
  6. package/dist/chunks/block-iptrlMBb.js.map +1 -0
  7. package/dist/chunks/choose-CczZJaX_.js +717 -0
  8. package/dist/chunks/choose-CczZJaX_.js.map +1 -0
  9. package/dist/chunks/codes-BE2xir2k.js +157 -0
  10. package/dist/chunks/codes-BE2xir2k.js.map +1 -0
  11. package/dist/chunks/{constants-BKwqelYD.js → constants-CKkYLPtt.js} +2 -2
  12. package/dist/chunks/{constants-BKwqelYD.js.map → constants-CKkYLPtt.js.map} +1 -1
  13. package/dist/chunks/context-C3p0RQxR.js +664 -0
  14. package/dist/chunks/context-C3p0RQxR.js.map +1 -0
  15. package/dist/chunks/{convert-BcQ8_jMo.js → convert-Ct2zelbQ.js} +7 -2
  16. package/dist/chunks/convert-Ct2zelbQ.js.map +1 -0
  17. package/dist/chunks/credentials-DXHx7nwR.js +349 -0
  18. package/dist/chunks/credentials-DXHx7nwR.js.map +1 -0
  19. package/dist/chunks/cx-export-Bt6NoqTQ.js +259 -0
  20. package/dist/chunks/cx-export-Bt6NoqTQ.js.map +1 -0
  21. package/dist/chunks/descriptor-B28U25x4.js +60 -0
  22. package/dist/chunks/descriptor-B28U25x4.js.map +1 -0
  23. package/dist/chunks/descriptor-C-YDhtsn.js +48 -0
  24. package/dist/chunks/descriptor-C-YDhtsn.js.map +1 -0
  25. package/dist/chunks/descriptor-DLA5kINx.js +142 -0
  26. package/dist/chunks/descriptor-DLA5kINx.js.map +1 -0
  27. package/dist/chunks/{emit-CwU8cUmG.js → emit-BwHQkZle.js} +1690 -103
  28. package/dist/chunks/emit-BwHQkZle.js.map +1 -0
  29. package/dist/chunks/{escape-CgzxiYPg.js → escape-CuCIzNMB.js} +12 -12
  30. package/dist/chunks/{escape-CgzxiYPg.js.map → escape-CuCIzNMB.js.map} +1 -1
  31. package/dist/chunks/{export-BvqAXCKh.js → export-Cha4dRFz.js} +48 -1780
  32. package/dist/chunks/export-Cha4dRFz.js.map +1 -0
  33. package/dist/chunks/{exporter--Mk9gXCJ.js → exporter-BP6otMO6.js} +6 -4
  34. package/dist/chunks/{exporter--Mk9gXCJ.js.map → exporter-BP6otMO6.js.map} +1 -1
  35. package/dist/chunks/{exporter-CrDWIyiq.js → exporter-D2CETOMK.js} +1222 -154
  36. package/dist/chunks/exporter-D2CETOMK.js.map +1 -0
  37. package/dist/chunks/{exporter-DndFlGSa.js → exporter-D9yMtocA.js} +7 -6
  38. package/dist/chunks/{exporter-DndFlGSa.js.map → exporter-D9yMtocA.js.map} +1 -1
  39. package/dist/chunks/exporter-_jrBTnos.js +1009 -0
  40. package/dist/chunks/exporter-_jrBTnos.js.map +1 -0
  41. package/dist/chunks/{exporter-CJgfhF-l.js → exporter-nDfxIK5D.js} +9 -7
  42. package/dist/chunks/{exporter-CJgfhF-l.js.map → exporter-nDfxIK5D.js.map} +1 -1
  43. package/dist/chunks/format-BXiAb-1h.js +408 -0
  44. package/dist/chunks/format-BXiAb-1h.js.map +1 -0
  45. package/dist/chunks/{generic-Dq1ntt9q.js → generic-ymWCETAJ.js} +387 -31
  46. package/dist/chunks/generic-ymWCETAJ.js.map +1 -0
  47. package/dist/chunks/{importer-CMmeMWlC.js → importer-B92x1xY5.js} +15 -263
  48. package/dist/chunks/importer-B92x1xY5.js.map +1 -0
  49. package/dist/chunks/{importer-DiZRmOQG.js → importer-CT9mJ1nn.js} +328 -90
  50. package/dist/chunks/importer-CT9mJ1nn.js.map +1 -0
  51. package/dist/chunks/{importer-COTK9Tsl.js → importer-DaLTjbds.js} +116 -1099
  52. package/dist/chunks/importer-DaLTjbds.js.map +1 -0
  53. package/dist/chunks/{importer-iFYPEKaJ.js → importer-GREKMdIf.js} +28 -16
  54. package/dist/chunks/importer-GREKMdIf.js.map +1 -0
  55. package/dist/chunks/{importer-BSvfrX_h.js → importer-PqaaKKnY.js} +23 -1016
  56. package/dist/chunks/importer-PqaaKKnY.js.map +1 -0
  57. package/dist/chunks/{importer-yh_aBCU6.js → importer-Vn5QvmmJ.js} +66 -12
  58. package/dist/chunks/importer-Vn5QvmmJ.js.map +1 -0
  59. package/dist/chunks/{importer-e6LGpqHB.js → importer-vRq4h3j5.js} +1470 -354
  60. package/dist/chunks/importer-vRq4h3j5.js.map +1 -0
  61. package/dist/chunks/input-CAxt_aV-.js +1397 -0
  62. package/dist/chunks/input-CAxt_aV-.js.map +1 -0
  63. package/dist/chunks/{json-elements-DJZRZ6jd.js → json-elements-Cq76WjnZ.js} +4 -4
  64. package/dist/chunks/{json-elements-DJZRZ6jd.js.map → json-elements-Cq76WjnZ.js.map} +1 -1
  65. package/dist/chunks/{lexicon-CT69Kd87.js → lexicon-Clf4QIyl.js} +299 -77
  66. package/dist/chunks/lexicon-Clf4QIyl.js.map +1 -0
  67. package/dist/chunks/{ontology-export-G4MqRdux.js → ontology-export-OMo91mb0.js} +4 -3
  68. package/dist/chunks/{ontology-export-G4MqRdux.js.map → ontology-export-OMo91mb0.js.map} +1 -1
  69. package/dist/chunks/{records-CiaWZrFH.js → records-NJiYvekn.js} +2 -2
  70. package/dist/chunks/{records-CiaWZrFH.js.map → records-NJiYvekn.js.map} +1 -1
  71. package/dist/chunks/{format-BpQBx8MZ.js → report-CwMfYa9J.js} +70 -127
  72. package/dist/chunks/report-CwMfYa9J.js.map +1 -0
  73. package/dist/chunks/round-trip-Zm3_ivgq.js +79 -0
  74. package/dist/chunks/round-trip-Zm3_ivgq.js.map +1 -0
  75. package/dist/chunks/sigv4-EokFic1V.js +247 -0
  76. package/dist/chunks/sigv4-EokFic1V.js.map +1 -0
  77. package/dist/chunks/{styles-BQnsga7p.js → styles-CCs214_3.js} +1300 -168
  78. package/dist/chunks/styles-CCs214_3.js.map +1 -0
  79. package/dist/chunks/styles-Cm62yyQX.js +2812 -0
  80. package/dist/chunks/styles-Cm62yyQX.js.map +1 -0
  81. package/dist/chunks/styles-DPQQIig4.js +1928 -0
  82. package/dist/chunks/styles-DPQQIig4.js.map +1 -0
  83. package/dist/chunks/styles-yed-UMFdNqze.js +1213 -0
  84. package/dist/chunks/styles-yed-UMFdNqze.js.map +1 -0
  85. package/dist/chunks/{text-CzJNFOS9.js → text-ystE2bYi.js} +2 -2
  86. package/dist/chunks/{text-CzJNFOS9.js.map → text-ystE2bYi.js.map} +1 -1
  87. package/dist/csv.js +7 -5
  88. package/dist/csv.js.map +1 -1
  89. package/dist/cx.js +5 -4
  90. package/dist/cx.js.map +1 -1
  91. package/dist/cx2.js +2 -2
  92. package/dist/cys.js +1 -1
  93. package/dist/dot.js +5 -4
  94. package/dist/dot.js.map +1 -1
  95. package/dist/gexf.js +42 -10
  96. package/dist/gexf.js.map +1 -1
  97. package/dist/gml.js +850 -193
  98. package/dist/gml.js.map +1 -1
  99. package/dist/graph-io.js +1189 -220
  100. package/dist/graph-io.js.map +1 -1
  101. package/dist/graphml.js +3 -3
  102. package/dist/json.js +3 -2
  103. package/dist/neo4j.js +6 -4
  104. package/dist/neo4j.js.map +1 -1
  105. package/dist/obo.js +1 -1
  106. package/dist/pajek.js +1 -1
  107. package/dist/positions.js +45 -3
  108. package/dist/positions.js.map +1 -1
  109. package/dist/sources-cypher.d.ts +1 -0
  110. package/dist/sources-cypher.js +1351 -0
  111. package/dist/sources-cypher.js.map +1 -0
  112. package/dist/sources-ndex.d.ts +1 -0
  113. package/dist/sources-ndex.js +278 -0
  114. package/dist/sources-ndex.js.map +1 -0
  115. package/dist/sources-rest.d.ts +1 -0
  116. package/dist/sources-rest.js +1377 -0
  117. package/dist/sources-rest.js.map +1 -0
  118. package/dist/sources-sparql.d.ts +1 -0
  119. package/dist/sources-sparql.js +405 -0
  120. package/dist/sources-sparql.js.map +1 -0
  121. package/dist/src/common/report.d.ts +6 -3
  122. package/dist/src/common/report.d.ts.map +1 -1
  123. package/dist/src/common/report.js +15 -9
  124. package/dist/src/common/report.js.map +1 -1
  125. package/dist/src/formats/cx/importer.d.ts.map +1 -1
  126. package/dist/src/formats/cx/importer.js +5 -1
  127. package/dist/src/formats/cx/importer.js.map +1 -1
  128. package/dist/src/formats/cx/styles.d.ts +24 -1
  129. package/dist/src/formats/cx/styles.d.ts.map +1 -1
  130. package/dist/src/formats/cx/styles.js +118 -11
  131. package/dist/src/formats/cx/styles.js.map +1 -1
  132. package/dist/src/formats/cx2/importer.d.ts.map +1 -1
  133. package/dist/src/formats/cx2/importer.js +1 -0
  134. package/dist/src/formats/cx2/importer.js.map +1 -1
  135. package/dist/src/formats/cx2/styles.d.ts.map +1 -1
  136. package/dist/src/formats/cx2/styles.js +3 -1
  137. package/dist/src/formats/cx2/styles.js.map +1 -1
  138. package/dist/src/formats/cys/importer.d.ts.map +1 -1
  139. package/dist/src/formats/cys/importer.js +1 -0
  140. package/dist/src/formats/cys/importer.js.map +1 -1
  141. package/dist/src/formats/cys/styles.d.ts +2 -0
  142. package/dist/src/formats/cys/styles.d.ts.map +1 -1
  143. package/dist/src/formats/cys/styles.js +15 -7
  144. package/dist/src/formats/cys/styles.js.map +1 -1
  145. package/dist/src/formats/dot/drawing.d.ts +98 -0
  146. package/dist/src/formats/dot/drawing.d.ts.map +1 -0
  147. package/dist/src/formats/dot/drawing.js +734 -0
  148. package/dist/src/formats/dot/drawing.js.map +1 -0
  149. package/dist/src/formats/dot/importer.d.ts.map +1 -1
  150. package/dist/src/formats/dot/importer.js +108 -31
  151. package/dist/src/formats/dot/importer.js.map +1 -1
  152. package/dist/src/formats/dot/label-places.d.ts +34 -0
  153. package/dist/src/formats/dot/label-places.d.ts.map +1 -0
  154. package/dist/src/formats/dot/label-places.js +179 -0
  155. package/dist/src/formats/dot/label-places.js.map +1 -0
  156. package/dist/src/formats/dot/record.d.ts +50 -0
  157. package/dist/src/formats/dot/record.d.ts.map +1 -0
  158. package/dist/src/formats/dot/record.js +275 -0
  159. package/dist/src/formats/dot/record.js.map +1 -0
  160. package/dist/src/formats/dot/styles.d.ts +62 -2
  161. package/dist/src/formats/dot/styles.d.ts.map +1 -1
  162. package/dist/src/formats/dot/styles.js +1457 -120
  163. package/dist/src/formats/dot/styles.js.map +1 -1
  164. package/dist/src/formats/gexf/dialog-metrics.d.ts +15 -0
  165. package/dist/src/formats/gexf/dialog-metrics.d.ts.map +1 -0
  166. package/dist/src/formats/gexf/dialog-metrics.js +59 -0
  167. package/dist/src/formats/gexf/dialog-metrics.js.map +1 -0
  168. package/dist/src/formats/gexf/importer.d.ts +7 -0
  169. package/dist/src/formats/gexf/importer.d.ts.map +1 -1
  170. package/dist/src/formats/gexf/importer.js +41 -5
  171. package/dist/src/formats/gexf/importer.js.map +1 -1
  172. package/dist/src/formats/gexf/preview.d.ts +77 -0
  173. package/dist/src/formats/gexf/preview.d.ts.map +1 -0
  174. package/dist/src/formats/gexf/preview.js +191 -0
  175. package/dist/src/formats/gexf/preview.js.map +1 -0
  176. package/dist/src/formats/gexf/schema.d.ts.map +1 -1
  177. package/dist/src/formats/gexf/schema.js +2 -1
  178. package/dist/src/formats/gexf/schema.js.map +1 -1
  179. package/dist/src/formats/gexf/styles.d.ts +60 -16
  180. package/dist/src/formats/gexf/styles.d.ts.map +1 -1
  181. package/dist/src/formats/gexf/styles.js +883 -131
  182. package/dist/src/formats/gexf/styles.js.map +1 -1
  183. package/dist/src/formats/gml/importer.d.ts +5 -2
  184. package/dist/src/formats/gml/importer.d.ts.map +1 -1
  185. package/dist/src/formats/gml/importer.js +258 -71
  186. package/dist/src/formats/gml/importer.js.map +1 -1
  187. package/dist/src/formats/gml/index.d.ts +1 -1
  188. package/dist/src/formats/gml/index.d.ts.map +1 -1
  189. package/dist/src/formats/gml/index.js +1 -1
  190. package/dist/src/formats/gml/index.js.map +1 -1
  191. package/dist/src/formats/gml/positions.d.ts +7 -0
  192. package/dist/src/formats/gml/positions.d.ts.map +1 -1
  193. package/dist/src/formats/gml/positions.js +29 -7
  194. package/dist/src/formats/gml/positions.js.map +1 -1
  195. package/dist/src/formats/gml/styles.d.ts.map +1 -1
  196. package/dist/src/formats/gml/styles.js +756 -103
  197. package/dist/src/formats/gml/styles.js.map +1 -1
  198. package/dist/src/formats/graphml/styles-plain.d.ts.map +1 -1
  199. package/dist/src/formats/graphml/styles-plain.js +8 -12
  200. package/dist/src/formats/graphml/styles-plain.js.map +1 -1
  201. package/dist/src/formats/graphml/styles-yed.d.ts +21 -15
  202. package/dist/src/formats/graphml/styles-yed.d.ts.map +1 -1
  203. package/dist/src/formats/graphml/styles-yed.js +749 -148
  204. package/dist/src/formats/graphml/styles-yed.js.map +1 -1
  205. package/dist/src/formats/graphml/styles-yfiles3.d.ts +1 -1
  206. package/dist/src/formats/graphml/styles-yfiles3.d.ts.map +1 -1
  207. package/dist/src/formats/graphml/styles-yfiles3.js +429 -64
  208. package/dist/src/formats/graphml/styles-yfiles3.js.map +1 -1
  209. package/dist/src/formats/graphml/yfiles.d.ts +3 -3
  210. package/dist/src/formats/graphml/yfiles.d.ts.map +1 -1
  211. package/dist/src/formats/graphml/yfiles.js +16 -6
  212. package/dist/src/formats/graphml/yfiles.js.map +1 -1
  213. package/dist/src/formats/json/dialect.d.ts +3 -2
  214. package/dist/src/formats/json/dialect.d.ts.map +1 -1
  215. package/dist/src/formats/json/dialect.js +39 -5
  216. package/dist/src/formats/json/dialect.js.map +1 -1
  217. package/dist/src/formats/json/importer.d.ts +13 -2
  218. package/dist/src/formats/json/importer.d.ts.map +1 -1
  219. package/dist/src/formats/json/importer.js +42 -6
  220. package/dist/src/formats/json/importer.js.map +1 -1
  221. package/dist/src/formats/json/index.d.ts +1 -1
  222. package/dist/src/formats/json/index.d.ts.map +1 -1
  223. package/dist/src/formats/json/index.js +1 -1
  224. package/dist/src/formats/json/index.js.map +1 -1
  225. package/dist/src/formats/json/positions.d.ts +5 -2
  226. package/dist/src/formats/json/positions.d.ts.map +1 -1
  227. package/dist/src/formats/json/positions.js +20 -4
  228. package/dist/src/formats/json/positions.js.map +1 -1
  229. package/dist/src/formats/json/styles.d.ts +12 -1
  230. package/dist/src/formats/json/styles.d.ts.map +1 -1
  231. package/dist/src/formats/json/styles.js +1755 -136
  232. package/dist/src/formats/json/styles.js.map +1 -1
  233. package/dist/src/formats/pajek/draw.d.ts +96 -0
  234. package/dist/src/formats/pajek/draw.d.ts.map +1 -0
  235. package/dist/src/formats/pajek/draw.js +372 -0
  236. package/dist/src/formats/pajek/draw.js.map +1 -0
  237. package/dist/src/formats/pajek/exporter.d.ts.map +1 -1
  238. package/dist/src/formats/pajek/exporter.js +70 -51
  239. package/dist/src/formats/pajek/exporter.js.map +1 -1
  240. package/dist/src/formats/pajek/importer.d.ts +9 -0
  241. package/dist/src/formats/pajek/importer.d.ts.map +1 -1
  242. package/dist/src/formats/pajek/importer.js +233 -102
  243. package/dist/src/formats/pajek/importer.js.map +1 -1
  244. package/dist/src/formats/pajek/index.d.ts +1 -0
  245. package/dist/src/formats/pajek/index.d.ts.map +1 -1
  246. package/dist/src/formats/pajek/index.js.map +1 -1
  247. package/dist/src/formats/pajek/styles.d.ts +15 -7
  248. package/dist/src/formats/pajek/styles.d.ts.map +1 -1
  249. package/dist/src/formats/pajek/styles.js +1279 -114
  250. package/dist/src/formats/pajek/styles.js.map +1 -1
  251. package/dist/src/formats/pajek/syntax.d.ts +10 -1
  252. package/dist/src/formats/pajek/syntax.d.ts.map +1 -1
  253. package/dist/src/formats/pajek/syntax.js +26 -2
  254. package/dist/src/formats/pajek/syntax.js.map +1 -1
  255. package/dist/src/formats/xgmml/emit.d.ts +1 -0
  256. package/dist/src/formats/xgmml/emit.d.ts.map +1 -1
  257. package/dist/src/formats/xgmml/emit.js +65 -5
  258. package/dist/src/formats/xgmml/emit.js.map +1 -1
  259. package/dist/src/formats/xgmml/styles.d.ts +23 -3
  260. package/dist/src/formats/xgmml/styles.d.ts.map +1 -1
  261. package/dist/src/formats/xgmml/styles.js +278 -60
  262. package/dist/src/formats/xgmml/styles.js.map +1 -1
  263. package/dist/src/index.d.ts +10 -2
  264. package/dist/src/index.d.ts.map +1 -1
  265. package/dist/src/index.js +11 -2
  266. package/dist/src/index.js.map +1 -1
  267. package/dist/src/positions/convert.d.ts.map +1 -1
  268. package/dist/src/positions/convert.js +11 -1
  269. package/dist/src/positions/convert.js.map +1 -1
  270. package/dist/src/positions/extract.d.ts.map +1 -1
  271. package/dist/src/positions/extract.js +53 -1
  272. package/dist/src/positions/extract.js.map +1 -1
  273. package/dist/src/positions/index.d.ts +1 -1
  274. package/dist/src/positions/index.d.ts.map +1 -1
  275. package/dist/src/positions/types.d.ts +59 -0
  276. package/dist/src/positions/types.d.ts.map +1 -1
  277. package/dist/src/registry.d.ts +173 -1
  278. package/dist/src/registry.d.ts.map +1 -1
  279. package/dist/src/registry.js +196 -1
  280. package/dist/src/registry.js.map +1 -1
  281. package/dist/src/sources/builtins.d.ts +11 -0
  282. package/dist/src/sources/builtins.d.ts.map +1 -0
  283. package/dist/src/sources/builtins.js +53 -0
  284. package/dist/src/sources/builtins.js.map +1 -0
  285. package/dist/src/sources/codes.d.ts +230 -0
  286. package/dist/src/sources/codes.d.ts.map +1 -0
  287. package/dist/src/sources/codes.js +58 -0
  288. package/dist/src/sources/codes.js.map +1 -0
  289. package/dist/src/sources/context.d.ts +112 -0
  290. package/dist/src/sources/context.d.ts.map +1 -0
  291. package/dist/src/sources/context.js +740 -0
  292. package/dist/src/sources/context.js.map +1 -0
  293. package/dist/src/sources/credentials.d.ts +179 -0
  294. package/dist/src/sources/credentials.d.ts.map +1 -0
  295. package/dist/src/sources/credentials.js +301 -0
  296. package/dist/src/sources/credentials.js.map +1 -0
  297. package/dist/src/sources/cypher/descriptor.d.ts +21 -0
  298. package/dist/src/sources/cypher/descriptor.d.ts.map +1 -0
  299. package/dist/src/sources/cypher/descriptor.js +124 -0
  300. package/dist/src/sources/cypher/descriptor.js.map +1 -0
  301. package/dist/src/sources/cypher/flatten.d.ts +72 -0
  302. package/dist/src/sources/cypher/flatten.d.ts.map +1 -0
  303. package/dist/src/sources/cypher/flatten.js +279 -0
  304. package/dist/src/sources/cypher/flatten.js.map +1 -0
  305. package/dist/src/sources/cypher/index.d.ts +33 -0
  306. package/dist/src/sources/cypher/index.d.ts.map +1 -0
  307. package/dist/src/sources/cypher/index.js +511 -0
  308. package/dist/src/sources/cypher/index.js.map +1 -0
  309. package/dist/src/sources/cypher/params.d.ts +40 -0
  310. package/dist/src/sources/cypher/params.d.ts.map +1 -0
  311. package/dist/src/sources/cypher/params.js +6 -0
  312. package/dist/src/sources/cypher/params.js.map +1 -0
  313. package/dist/src/sources/cypher/profiles.d.ts +44 -0
  314. package/dist/src/sources/cypher/profiles.d.ts.map +1 -0
  315. package/dist/src/sources/cypher/profiles.js +61 -0
  316. package/dist/src/sources/cypher/profiles.js.map +1 -0
  317. package/dist/src/sources/cypher/query-builder.d.ts +123 -0
  318. package/dist/src/sources/cypher/query-builder.d.ts.map +1 -0
  319. package/dist/src/sources/cypher/query-builder.js +267 -0
  320. package/dist/src/sources/cypher/query-builder.js.map +1 -0
  321. package/dist/src/sources/cypher/transports/bolt.d.ts +21 -0
  322. package/dist/src/sources/cypher/transports/bolt.d.ts.map +1 -0
  323. package/dist/src/sources/cypher/transports/bolt.js +185 -0
  324. package/dist/src/sources/cypher/transports/bolt.js.map +1 -0
  325. package/dist/src/sources/cypher/transports/neptune-analytics.d.ts +15 -0
  326. package/dist/src/sources/cypher/transports/neptune-analytics.d.ts.map +1 -0
  327. package/dist/src/sources/cypher/transports/neptune-analytics.js +38 -0
  328. package/dist/src/sources/cypher/transports/neptune-analytics.js.map +1 -0
  329. package/dist/src/sources/cypher/transports/neptune-https.d.ts +31 -0
  330. package/dist/src/sources/cypher/transports/neptune-https.d.ts.map +1 -0
  331. package/dist/src/sources/cypher/transports/neptune-https.js +104 -0
  332. package/dist/src/sources/cypher/transports/neptune-https.js.map +1 -0
  333. package/dist/src/sources/cypher/transports/query-api.d.ts +14 -0
  334. package/dist/src/sources/cypher/transports/query-api.d.ts.map +1 -0
  335. package/dist/src/sources/cypher/transports/query-api.js +80 -0
  336. package/dist/src/sources/cypher/transports/query-api.js.map +1 -0
  337. package/dist/src/sources/cypher/transports/transport.d.ts +78 -0
  338. package/dist/src/sources/cypher/transports/transport.d.ts.map +1 -0
  339. package/dist/src/sources/cypher/transports/transport.js +77 -0
  340. package/dist/src/sources/cypher/transports/transport.js.map +1 -0
  341. package/dist/src/sources/cypher/types-map.d.ts +91 -0
  342. package/dist/src/sources/cypher/types-map.d.ts.map +1 -0
  343. package/dist/src/sources/cypher/types-map.js +306 -0
  344. package/dist/src/sources/cypher/types-map.js.map +1 -0
  345. package/dist/src/sources/define.d.ts +47 -0
  346. package/dist/src/sources/define.d.ts.map +1 -0
  347. package/dist/src/sources/define.js +173 -0
  348. package/dist/src/sources/define.js.map +1 -0
  349. package/dist/src/sources/fail.d.ts +33 -0
  350. package/dist/src/sources/fail.d.ts.map +1 -0
  351. package/dist/src/sources/fail.js +49 -0
  352. package/dist/src/sources/fail.js.map +1 -0
  353. package/dist/src/sources/ids.d.ts +69 -0
  354. package/dist/src/sources/ids.d.ts.map +1 -0
  355. package/dist/src/sources/ids.js +69 -0
  356. package/dist/src/sources/ids.js.map +1 -0
  357. package/dist/src/sources/ndex/client.d.ts +31 -0
  358. package/dist/src/sources/ndex/client.d.ts.map +1 -0
  359. package/dist/src/sources/ndex/client.js +90 -0
  360. package/dist/src/sources/ndex/client.js.map +1 -0
  361. package/dist/src/sources/ndex/descriptor.d.ts +10 -0
  362. package/dist/src/sources/ndex/descriptor.d.ts.map +1 -0
  363. package/dist/src/sources/ndex/descriptor.js +55 -0
  364. package/dist/src/sources/ndex/descriptor.js.map +1 -0
  365. package/dist/src/sources/ndex/expand.d.ts +20 -0
  366. package/dist/src/sources/ndex/expand.d.ts.map +1 -0
  367. package/dist/src/sources/ndex/expand.js +87 -0
  368. package/dist/src/sources/ndex/expand.js.map +1 -0
  369. package/dist/src/sources/ndex/index.d.ts +25 -0
  370. package/dist/src/sources/ndex/index.d.ts.map +1 -0
  371. package/dist/src/sources/ndex/index.js +191 -0
  372. package/dist/src/sources/ndex/index.js.map +1 -0
  373. package/dist/src/sources/ndex/params.d.ts +17 -0
  374. package/dist/src/sources/ndex/params.d.ts.map +1 -0
  375. package/dist/src/sources/ndex/params.js +6 -0
  376. package/dist/src/sources/ndex/params.js.map +1 -0
  377. package/dist/src/sources/ndex/share-url.d.ts +40 -0
  378. package/dist/src/sources/ndex/share-url.d.ts.map +1 -0
  379. package/dist/src/sources/ndex/share-url.js +64 -0
  380. package/dist/src/sources/ndex/share-url.js.map +1 -0
  381. package/dist/src/sources/params.d.ts +31 -0
  382. package/dist/src/sources/params.d.ts.map +1 -0
  383. package/dist/src/sources/params.js +6 -0
  384. package/dist/src/sources/params.js.map +1 -0
  385. package/dist/src/sources/registry.d.ts +118 -0
  386. package/dist/src/sources/registry.d.ts.map +1 -0
  387. package/dist/src/sources/registry.js +193 -0
  388. package/dist/src/sources/registry.js.map +1 -0
  389. package/dist/src/sources/rest/descriptor.d.ts +16 -0
  390. package/dist/src/sources/rest/descriptor.d.ts.map +1 -0
  391. package/dist/src/sources/rest/descriptor.js +76 -0
  392. package/dist/src/sources/rest/descriptor.js.map +1 -0
  393. package/dist/src/sources/rest/index.d.ts +14 -0
  394. package/dist/src/sources/rest/index.d.ts.map +1 -0
  395. package/dist/src/sources/rest/index.js +13 -0
  396. package/dist/src/sources/rest/index.js.map +1 -0
  397. package/dist/src/sources/rest/mapping.d.ts +30 -0
  398. package/dist/src/sources/rest/mapping.d.ts.map +1 -0
  399. package/dist/src/sources/rest/mapping.js +362 -0
  400. package/dist/src/sources/rest/mapping.js.map +1 -0
  401. package/dist/src/sources/rest/openalex.d.ts +27 -0
  402. package/dist/src/sources/rest/openalex.d.ts.map +1 -0
  403. package/dist/src/sources/rest/openalex.js +269 -0
  404. package/dist/src/sources/rest/openalex.js.map +1 -0
  405. package/dist/src/sources/rest/paging.d.ts +53 -0
  406. package/dist/src/sources/rest/paging.d.ts.map +1 -0
  407. package/dist/src/sources/rest/paging.js +138 -0
  408. package/dist/src/sources/rest/paging.js.map +1 -0
  409. package/dist/src/sources/rest/params.d.ts +216 -0
  410. package/dist/src/sources/rest/params.d.ts.map +1 -0
  411. package/dist/src/sources/rest/params.js +7 -0
  412. package/dist/src/sources/rest/params.js.map +1 -0
  413. package/dist/src/sources/rest/records.d.ts +41 -0
  414. package/dist/src/sources/rest/records.d.ts.map +1 -0
  415. package/dist/src/sources/rest/records.js +240 -0
  416. package/dist/src/sources/rest/records.js.map +1 -0
  417. package/dist/src/sources/rest/samples/deps-dev.d.ts +10 -0
  418. package/dist/src/sources/rest/samples/deps-dev.d.ts.map +1 -0
  419. package/dist/src/sources/rest/samples/deps-dev.js +47 -0
  420. package/dist/src/sources/rest/samples/deps-dev.js.map +1 -0
  421. package/dist/src/sources/rest/samples/string.d.ts +9 -0
  422. package/dist/src/sources/rest/samples/string.d.ts.map +1 -0
  423. package/dist/src/sources/rest/samples/string.js +42 -0
  424. package/dist/src/sources/rest/samples/string.js.map +1 -0
  425. package/dist/src/sources/rest/selectors.d.ts +41 -0
  426. package/dist/src/sources/rest/selectors.d.ts.map +1 -0
  427. package/dist/src/sources/rest/selectors.js +81 -0
  428. package/dist/src/sources/rest/selectors.js.map +1 -0
  429. package/dist/src/sources/rest/source.d.ts +67 -0
  430. package/dist/src/sources/rest/source.d.ts.map +1 -0
  431. package/dist/src/sources/rest/source.js +650 -0
  432. package/dist/src/sources/rest/source.js.map +1 -0
  433. package/dist/src/sources/rest/templates.d.ts +38 -0
  434. package/dist/src/sources/rest/templates.d.ts.map +1 -0
  435. package/dist/src/sources/rest/templates.js +125 -0
  436. package/dist/src/sources/rest/templates.js.map +1 -0
  437. package/dist/src/sources/run.d.ts +93 -0
  438. package/dist/src/sources/run.d.ts.map +1 -0
  439. package/dist/src/sources/run.js +673 -0
  440. package/dist/src/sources/run.js.map +1 -0
  441. package/dist/src/sources/sha256.d.ts +12 -0
  442. package/dist/src/sources/sha256.d.ts.map +1 -0
  443. package/dist/src/sources/sha256.js +95 -0
  444. package/dist/src/sources/sha256.js.map +1 -0
  445. package/dist/src/sources/sigv4.d.ts +26 -0
  446. package/dist/src/sources/sigv4.d.ts.map +1 -0
  447. package/dist/src/sources/sigv4.js +184 -0
  448. package/dist/src/sources/sigv4.js.map +1 -0
  449. package/dist/src/sources/sparql/descriptor.d.ts +10 -0
  450. package/dist/src/sources/sparql/descriptor.d.ts.map +1 -0
  451. package/dist/src/sources/sparql/descriptor.js +64 -0
  452. package/dist/src/sources/sparql/descriptor.js.map +1 -0
  453. package/dist/src/sources/sparql/index.d.ts +28 -0
  454. package/dist/src/sources/sparql/index.d.ts.map +1 -0
  455. package/dist/src/sources/sparql/index.js +314 -0
  456. package/dist/src/sources/sparql/index.js.map +1 -0
  457. package/dist/src/sources/sparql/ntriples.d.ts +69 -0
  458. package/dist/src/sources/sparql/ntriples.d.ts.map +1 -0
  459. package/dist/src/sources/sparql/ntriples.js +180 -0
  460. package/dist/src/sources/sparql/ntriples.js.map +1 -0
  461. package/dist/src/sources/sparql/params.d.ts +27 -0
  462. package/dist/src/sources/sparql/params.d.ts.map +1 -0
  463. package/dist/src/sources/sparql/params.js +5 -0
  464. package/dist/src/sources/sparql/params.js.map +1 -0
  465. package/dist/src/sources/sparql/query.d.ts +72 -0
  466. package/dist/src/sources/sparql/query.d.ts.map +1 -0
  467. package/dist/src/sources/sparql/query.js +113 -0
  468. package/dist/src/sources/sparql/query.js.map +1 -0
  469. package/dist/src/sources/testing.d.ts +96 -0
  470. package/dist/src/sources/testing.d.ts.map +1 -0
  471. package/dist/src/sources/testing.js +138 -0
  472. package/dist/src/sources/testing.js.map +1 -0
  473. package/dist/src/sources/types.d.ts +696 -0
  474. package/dist/src/sources/types.d.ts.map +1 -0
  475. package/dist/src/sources/types.js +10 -0
  476. package/dist/src/sources/types.js.map +1 -0
  477. package/dist/src/styles/annotations.d.ts +61 -5
  478. package/dist/src/styles/annotations.d.ts.map +1 -1
  479. package/dist/src/styles/annotations.js +130 -22
  480. package/dist/src/styles/annotations.js.map +1 -1
  481. package/dist/src/styles/canon/bends.d.ts +46 -0
  482. package/dist/src/styles/canon/bends.d.ts.map +1 -1
  483. package/dist/src/styles/canon/bends.js +123 -0
  484. package/dist/src/styles/canon/bends.js.map +1 -1
  485. package/dist/src/styles/canon/color-tables.d.ts +6 -1
  486. package/dist/src/styles/canon/color-tables.d.ts.map +1 -1
  487. package/dist/src/styles/canon/color-tables.js +10 -4
  488. package/dist/src/styles/canon/color-tables.js.map +1 -1
  489. package/dist/src/styles/canon/color.d.ts +3 -1
  490. package/dist/src/styles/canon/color.d.ts.map +1 -1
  491. package/dist/src/styles/canon/color.js +103 -3
  492. package/dist/src/styles/canon/color.js.map +1 -1
  493. package/dist/src/styles/canon/enums.d.ts +2 -2
  494. package/dist/src/styles/canon/enums.d.ts.map +1 -1
  495. package/dist/src/styles/canon/enums.js +82 -7
  496. package/dist/src/styles/canon/enums.js.map +1 -1
  497. package/dist/src/styles/canon/graphviz.d.ts +12 -3
  498. package/dist/src/styles/canon/graphviz.d.ts.map +1 -1
  499. package/dist/src/styles/canon/graphviz.js +57 -9
  500. package/dist/src/styles/canon/graphviz.js.map +1 -1
  501. package/dist/src/styles/canon/number.d.ts +8 -0
  502. package/dist/src/styles/canon/number.d.ts.map +1 -1
  503. package/dist/src/styles/canon/number.js +18 -0
  504. package/dist/src/styles/canon/number.js.map +1 -1
  505. package/dist/src/styles/canon/text.d.ts +29 -2
  506. package/dist/src/styles/canon/text.d.ts.map +1 -1
  507. package/dist/src/styles/canon/text.js +156 -16
  508. package/dist/src/styles/canon/text.js.map +1 -1
  509. package/dist/src/styles/codes.d.ts +2 -0
  510. package/dist/src/styles/codes.d.ts.map +1 -1
  511. package/dist/src/styles/codes.js +2 -0
  512. package/dist/src/styles/codes.js.map +1 -1
  513. package/dist/src/styles/cyjs/cascade.d.ts.map +1 -1
  514. package/dist/src/styles/cyjs/cascade.js +1037 -35
  515. package/dist/src/styles/cyjs/cascade.js.map +1 -1
  516. package/dist/src/styles/cyjs/defaults-table.d.ts.map +1 -1
  517. package/dist/src/styles/cyjs/defaults-table.js +5 -0
  518. package/dist/src/styles/cyjs/defaults-table.js.map +1 -1
  519. package/dist/src/styles/cyjs/emit.d.ts.map +1 -1
  520. package/dist/src/styles/cyjs/emit.js +216 -12
  521. package/dist/src/styles/cyjs/emit.js.map +1 -1
  522. package/dist/src/styles/cyjs/face.d.ts +20 -0
  523. package/dist/src/styles/cyjs/face.d.ts.map +1 -0
  524. package/dist/src/styles/cyjs/face.js +332 -0
  525. package/dist/src/styles/cyjs/face.js.map +1 -0
  526. package/dist/src/styles/cyjs/mappers.d.ts +48 -2
  527. package/dist/src/styles/cyjs/mappers.d.ts.map +1 -1
  528. package/dist/src/styles/cyjs/mappers.js +463 -26
  529. package/dist/src/styles/cyjs/mappers.js.map +1 -1
  530. package/dist/src/styles/cyjs/routes.d.ts +53 -0
  531. package/dist/src/styles/cyjs/routes.d.ts.map +1 -0
  532. package/dist/src/styles/cyjs/routes.js +360 -0
  533. package/dist/src/styles/cyjs/routes.js.map +1 -0
  534. package/dist/src/styles/cytoscape/charts.d.ts +23 -0
  535. package/dist/src/styles/cytoscape/charts.d.ts.map +1 -0
  536. package/dist/src/styles/cytoscape/charts.js +560 -0
  537. package/dist/src/styles/cytoscape/charts.js.map +1 -0
  538. package/dist/src/styles/cytoscape/emit.d.ts.map +1 -1
  539. package/dist/src/styles/cytoscape/emit.js +204 -44
  540. package/dist/src/styles/cytoscape/emit.js.map +1 -1
  541. package/dist/src/styles/cytoscape/lexicon.d.ts +97 -3
  542. package/dist/src/styles/cytoscape/lexicon.d.ts.map +1 -1
  543. package/dist/src/styles/cytoscape/lexicon.js +413 -79
  544. package/dist/src/styles/cytoscape/lexicon.js.map +1 -1
  545. package/dist/src/styles/cytoscape/mappings.d.ts +30 -0
  546. package/dist/src/styles/cytoscape/mappings.d.ts.map +1 -1
  547. package/dist/src/styles/cytoscape/mappings.js +92 -0
  548. package/dist/src/styles/cytoscape/mappings.js.map +1 -1
  549. package/dist/src/styles/cytoscape/resolve.d.ts +46 -3
  550. package/dist/src/styles/cytoscape/resolve.d.ts.map +1 -1
  551. package/dist/src/styles/cytoscape/resolve.js +632 -22
  552. package/dist/src/styles/cytoscape/resolve.js.map +1 -1
  553. package/dist/src/styles/cytoscape/translate.d.ts.map +1 -1
  554. package/dist/src/styles/cytoscape/translate.js +10 -10
  555. package/dist/src/styles/cytoscape/translate.js.map +1 -1
  556. package/dist/src/styles/defaults.d.ts +50 -0
  557. package/dist/src/styles/defaults.d.ts.map +1 -1
  558. package/dist/src/styles/defaults.js +315 -37
  559. package/dist/src/styles/defaults.js.map +1 -1
  560. package/dist/src/styles/index.d.ts +4 -3
  561. package/dist/src/styles/index.d.ts.map +1 -1
  562. package/dist/src/styles/index.js +3 -2
  563. package/dist/src/styles/index.js.map +1 -1
  564. package/dist/src/styles/internal.d.ts +1 -0
  565. package/dist/src/styles/internal.d.ts.map +1 -1
  566. package/dist/src/styles/internal.js +1 -0
  567. package/dist/src/styles/internal.js.map +1 -1
  568. package/dist/src/styles/io/block.d.ts.map +1 -1
  569. package/dist/src/styles/io/block.js +9 -0
  570. package/dist/src/styles/io/block.js.map +1 -1
  571. package/dist/src/styles/io/generic.d.ts.map +1 -1
  572. package/dist/src/styles/io/generic.js +56 -16
  573. package/dist/src/styles/io/generic.js.map +1 -1
  574. package/dist/src/styles/io/round-trip.d.ts +56 -0
  575. package/dist/src/styles/io/round-trip.d.ts.map +1 -0
  576. package/dist/src/styles/io/round-trip.js +138 -0
  577. package/dist/src/styles/io/round-trip.js.map +1 -0
  578. package/dist/src/styles/io/writer.d.ts.map +1 -1
  579. package/dist/src/styles/io/writer.js +13 -4
  580. package/dist/src/styles/io/writer.js.map +1 -1
  581. package/dist/src/styles/notes.d.ts.map +1 -1
  582. package/dist/src/styles/notes.js +1 -0
  583. package/dist/src/styles/notes.js.map +1 -1
  584. package/dist/src/styles/plan/features.d.ts +1 -1
  585. package/dist/src/styles/plan/features.d.ts.map +1 -1
  586. package/dist/src/styles/plan/features.js +22 -2
  587. package/dist/src/styles/plan/features.js.map +1 -1
  588. package/dist/src/styles/plan/index.d.ts +1 -1
  589. package/dist/src/styles/plan/index.d.ts.map +1 -1
  590. package/dist/src/styles/plan/index.js +1 -1
  591. package/dist/src/styles/plan/index.js.map +1 -1
  592. package/dist/src/styles/plan/plan.d.ts.map +1 -1
  593. package/dist/src/styles/plan/plan.js +61 -4
  594. package/dist/src/styles/plan/plan.js.map +1 -1
  595. package/dist/src/styles/plan/resolve.d.ts +13 -1
  596. package/dist/src/styles/plan/resolve.d.ts.map +1 -1
  597. package/dist/src/styles/plan/resolve.js +53 -6
  598. package/dist/src/styles/plan/resolve.js.map +1 -1
  599. package/dist/src/styles/slots.d.ts +14 -0
  600. package/dist/src/styles/slots.d.ts.map +1 -0
  601. package/dist/src/styles/slots.js +20 -0
  602. package/dist/src/styles/slots.js.map +1 -0
  603. package/dist/src/styles/types.d.ts +638 -5
  604. package/dist/src/styles/types.d.ts.map +1 -1
  605. package/dist/src/styles/vocabulary.d.ts +3 -2
  606. package/dist/src/styles/vocabulary.d.ts.map +1 -1
  607. package/dist/src/styles/vocabulary.js +218 -1
  608. package/dist/src/styles/vocabulary.js.map +1 -1
  609. package/dist/src/types.d.ts +19 -5
  610. package/dist/src/types.d.ts.map +1 -1
  611. package/dist/src/types.js.map +1 -1
  612. package/dist/styles.js +29 -238
  613. package/dist/styles.js.map +1 -1
  614. package/dist/xgmml.js +3 -3
  615. package/docs/samples/people.json +6 -0
  616. package/package.json +53 -8
  617. package/src/common/report.ts +27 -7
  618. package/src/formats/cx/importer.ts +6 -1
  619. package/src/formats/cx/styles.ts +144 -9
  620. package/src/formats/cx2/importer.ts +1 -0
  621. package/src/formats/cx2/styles.ts +3 -1
  622. package/src/formats/cys/importer.ts +1 -0
  623. package/src/formats/cys/styles.ts +27 -5
  624. package/src/formats/dot/drawing.ts +799 -0
  625. package/src/formats/dot/importer.ts +120 -35
  626. package/src/formats/dot/label-places.ts +228 -0
  627. package/src/formats/dot/record.ts +336 -0
  628. package/src/formats/dot/styles.ts +1657 -154
  629. package/src/formats/gexf/dialog-metrics.ts +61 -0
  630. package/src/formats/gexf/importer.ts +50 -5
  631. package/src/formats/gexf/preview.ts +217 -0
  632. package/src/formats/gexf/schema.ts +2 -1
  633. package/src/formats/gexf/styles.ts +1144 -142
  634. package/src/formats/gml/importer.ts +291 -76
  635. package/src/formats/gml/index.ts +1 -1
  636. package/src/formats/gml/positions.ts +29 -7
  637. package/src/formats/gml/styles.ts +854 -111
  638. package/src/formats/graphml/styles-plain.ts +8 -23
  639. package/src/formats/graphml/styles-yed.ts +821 -159
  640. package/src/formats/graphml/styles-yfiles3.ts +485 -63
  641. package/src/formats/graphml/yfiles.ts +19 -6
  642. package/src/formats/json/dialect.ts +41 -5
  643. package/src/formats/json/importer.ts +59 -7
  644. package/src/formats/json/index.ts +1 -0
  645. package/src/formats/json/positions.ts +22 -5
  646. package/src/formats/json/styles.ts +2041 -185
  647. package/src/formats/pajek/draw.ts +458 -0
  648. package/src/formats/pajek/exporter.ts +81 -49
  649. package/src/formats/pajek/importer.ts +278 -103
  650. package/src/formats/pajek/index.ts +1 -0
  651. package/src/formats/pajek/styles.ts +1382 -133
  652. package/src/formats/pajek/syntax.ts +27 -2
  653. package/src/formats/xgmml/emit.ts +73 -5
  654. package/src/formats/xgmml/styles.ts +331 -71
  655. package/src/index.ts +94 -0
  656. package/src/positions/convert.ts +12 -1
  657. package/src/positions/extract.ts +55 -1
  658. package/src/positions/index.ts +1 -0
  659. package/src/positions/types.ts +60 -0
  660. package/src/registry.ts +326 -1
  661. package/src/sources/builtins.ts +63 -0
  662. package/src/sources/codes.ts +235 -0
  663. package/src/sources/context.ts +894 -0
  664. package/src/sources/credentials.ts +409 -0
  665. package/src/sources/cypher/descriptor.ts +131 -0
  666. package/src/sources/cypher/flatten.ts +323 -0
  667. package/src/sources/cypher/index.ts +628 -0
  668. package/src/sources/cypher/params.ts +41 -0
  669. package/src/sources/cypher/profiles.ts +78 -0
  670. package/src/sources/cypher/query-builder.ts +327 -0
  671. package/src/sources/cypher/transports/bolt.ts +228 -0
  672. package/src/sources/cypher/transports/neptune-analytics.ts +41 -0
  673. package/src/sources/cypher/transports/neptune-https.ts +122 -0
  674. package/src/sources/cypher/transports/query-api.ts +100 -0
  675. package/src/sources/cypher/transports/transport.ts +139 -0
  676. package/src/sources/cypher/types-map.ts +418 -0
  677. package/src/sources/define.ts +195 -0
  678. package/src/sources/fail.ts +70 -0
  679. package/src/sources/ids.ts +80 -0
  680. package/src/sources/ndex/client.ts +102 -0
  681. package/src/sources/ndex/descriptor.ts +64 -0
  682. package/src/sources/ndex/expand.ts +100 -0
  683. package/src/sources/ndex/index.ts +235 -0
  684. package/src/sources/ndex/params.ts +17 -0
  685. package/src/sources/ndex/share-url.ts +84 -0
  686. package/src/sources/params.ts +32 -0
  687. package/src/sources/registry.ts +325 -0
  688. package/src/sources/rest/descriptor.ts +79 -0
  689. package/src/sources/rest/index.ts +22 -0
  690. package/src/sources/rest/mapping.ts +401 -0
  691. package/src/sources/rest/openalex.ts +288 -0
  692. package/src/sources/rest/paging.ts +180 -0
  693. package/src/sources/rest/params.ts +243 -0
  694. package/src/sources/rest/records.ts +289 -0
  695. package/src/sources/rest/samples/deps-dev.ts +49 -0
  696. package/src/sources/rest/samples/string.ts +44 -0
  697. package/src/sources/rest/selectors.ts +91 -0
  698. package/src/sources/rest/source.ts +776 -0
  699. package/src/sources/rest/templates.ts +151 -0
  700. package/src/sources/run.ts +793 -0
  701. package/src/sources/sha256.ts +99 -0
  702. package/src/sources/sigv4.ts +209 -0
  703. package/src/sources/sparql/descriptor.ts +67 -0
  704. package/src/sources/sparql/index.ts +356 -0
  705. package/src/sources/sparql/ntriples.ts +219 -0
  706. package/src/sources/sparql/params.ts +28 -0
  707. package/src/sources/sparql/query.ts +162 -0
  708. package/src/sources/testing.ts +210 -0
  709. package/src/sources/types.ts +776 -0
  710. package/src/styles/annotations.ts +201 -27
  711. package/src/styles/canon/bends.ts +137 -0
  712. package/src/styles/canon/color-tables.ts +10 -4
  713. package/src/styles/canon/color.ts +105 -3
  714. package/src/styles/canon/enums.ts +99 -8
  715. package/src/styles/canon/graphviz.ts +71 -10
  716. package/src/styles/canon/number.ts +19 -0
  717. package/src/styles/canon/text.ts +187 -16
  718. package/src/styles/codes.ts +2 -0
  719. package/src/styles/cyjs/cascade.ts +1193 -38
  720. package/src/styles/cyjs/defaults-table.ts +5 -0
  721. package/src/styles/cyjs/emit.ts +247 -16
  722. package/src/styles/cyjs/face.ts +372 -0
  723. package/src/styles/cyjs/mappers.ts +498 -28
  724. package/src/styles/cyjs/routes.ts +432 -0
  725. package/src/styles/cytoscape/charts.ts +684 -0
  726. package/src/styles/cytoscape/emit.ts +220 -44
  727. package/src/styles/cytoscape/lexicon.ts +459 -80
  728. package/src/styles/cytoscape/mappings.ts +108 -0
  729. package/src/styles/cytoscape/resolve.ts +763 -23
  730. package/src/styles/cytoscape/translate.ts +11 -11
  731. package/src/styles/defaults.ts +436 -38
  732. package/src/styles/index.ts +5 -0
  733. package/src/styles/internal.ts +1 -0
  734. package/src/styles/io/block.ts +10 -0
  735. package/src/styles/io/generic.ts +79 -23
  736. package/src/styles/io/round-trip.ts +202 -0
  737. package/src/styles/io/writer.ts +14 -4
  738. package/src/styles/notes.ts +1 -0
  739. package/src/styles/plan/features.ts +23 -2
  740. package/src/styles/plan/index.ts +1 -1
  741. package/src/styles/plan/plan.ts +69 -5
  742. package/src/styles/plan/resolve.ts +61 -6
  743. package/src/styles/slots.ts +25 -0
  744. package/src/styles/types.ts +658 -4
  745. package/src/styles/vocabulary.ts +226 -3
  746. package/src/types.ts +19 -5
  747. package/dist/chunks/block-DiGq58c3.js.map +0 -1
  748. package/dist/chunks/choose--jM0yYCo.js +0 -57
  749. package/dist/chunks/choose--jM0yYCo.js.map +0 -1
  750. package/dist/chunks/convert-BcQ8_jMo.js.map +0 -1
  751. package/dist/chunks/emit-CwU8cUmG.js.map +0 -1
  752. package/dist/chunks/export-BvqAXCKh.js.map +0 -1
  753. package/dist/chunks/exporter-CrDWIyiq.js.map +0 -1
  754. package/dist/chunks/format-BpQBx8MZ.js.map +0 -1
  755. package/dist/chunks/generic-Dq1ntt9q.js.map +0 -1
  756. package/dist/chunks/importer-BSvfrX_h.js.map +0 -1
  757. package/dist/chunks/importer-CMmeMWlC.js.map +0 -1
  758. package/dist/chunks/importer-COTK9Tsl.js.map +0 -1
  759. package/dist/chunks/importer-DiZRmOQG.js.map +0 -1
  760. package/dist/chunks/importer-e6LGpqHB.js.map +0 -1
  761. package/dist/chunks/importer-iFYPEKaJ.js.map +0 -1
  762. package/dist/chunks/importer-yh_aBCU6.js.map +0 -1
  763. package/dist/chunks/lexicon-CT69Kd87.js.map +0 -1
  764. package/dist/chunks/styles-BQnsga7p.js.map +0 -1
  765. package/dist/chunks/styles-D3fRphrO.js +0 -690
  766. package/dist/chunks/styles-D3fRphrO.js.map +0 -1
  767. package/dist/chunks/styles-yed-BF5x3_Y5.js +0 -842
  768. package/dist/chunks/styles-yed-BF5x3_Y5.js.map +0 -1
  769. package/dist/chunks/writer-DMKvthQE.js +0 -448
  770. package/dist/chunks/writer-DMKvthQE.js.map +0 -1
@@ -1,13 +1,269 @@
1
1
  import { GraphFormatError, INVALID_INDEX } from "@graphty/graph-format";
2
- import { L as LOSS, c as capabilities, r as resolveExportOptions, G as sanitizeIds, p as pairFolding, a as checkCapabilities, e as explicitWeights, a1 as canonicalId, R as RENAMED_CODE, g as resolveImportOptions, i as reportUnusedOptions, P as LineReader, h as throwIfAborted, k as graphChosen, j as reportSinkOptions, l as DirectionResolver, I as IdCoercer, u as uniqueColumnName, d as declareResolved, a3 as coerceIdText, o as isWeightField, s as parseWeightText } from "./export-BvqAXCKh.js";
3
- import { g as isPajekLabel, j as quotePajekLabel } from "./escape-CgzxiYPg.js";
4
- import { p as plural, a as agree, _ as idText, ab as formatNumber, aO as formatDecimal, $ as formatF32, ad as formatInteger, P as PRECISION_CODE, l as DUPLICATE_ATTRIBUTE_CODE, S as SINK_OPTION_CODE, O as OPTION_IGNORED_CODE, R as ROLE_TAKEN_CODE, I as ID_MERGED_CODE, k as DUPLICATE_NODE_CODE, a8 as SYNTAX_CODE, a2 as AMBIGUOUS_GRAPH_NAME_CODE, a3 as GRAPH_NOT_FOUND_CODE, i as MULTIPLE_GRAPHS_CODE, s as UNKNOWN_ENCODING_CODE, t as ENCODING_FALLBACK_CODE, u as INVALID_ENCODING_CODE, v as INVALID_UTF8_CODE, y as ELEMENT_ISSUE, z as INPUT_ISSUE, Z as ImportReportBuilder } from "./format-BpQBx8MZ.js";
5
- import { i as inferTextDtype, W as WIDENING_UNSUPPORTED_CODE, a as isNumericText, T as TextCellWriter } from "./text-CzJNFOS9.js";
2
+ import { p as pairFolding, i as idText, b as formatNumber, d as formatDecimal, f as formatF32, c as formatInteger, D as DirectionResolver } from "./format-BXiAb-1h.js";
3
+ import { h as isPajekLabel, j as quotePajekLabel } from "./escape-CuCIzNMB.js";
4
+ import { e as explicitWeights, L as LOSS, c as capabilities, r as resolveExportOptions, z as sanitizeIds, a as checkCapabilities, H as canonicalId, R as RENAMED_CODE, b as resolveImportOptions, d as reportUnusedOptions, h as graphChosen, f as reportSinkOptions, I as IdCoercer, u as uniqueColumnName, i as declareResolved, Q as coerceIdText, k as isWeightField, p as parseWeightText } from "./export-Cha4dRFz.js";
5
+ import { p as plural, a as agree, P as PRECISION_CODE, l as DUPLICATE_ATTRIBUTE_CODE, S as SINK_OPTION_CODE, O as OPTION_IGNORED_CODE, R as ROLE_TAKEN_CODE, I as ID_MERGED_CODE, k as DUPLICATE_NODE_CODE, Q as SYNTAX_CODE, W as AMBIGUOUS_GRAPH_NAME_CODE, Y as GRAPH_NOT_FOUND_CODE, i as MULTIPLE_GRAPHS_CODE, s as UNKNOWN_ENCODING_CODE, t as ENCODING_FALLBACK_CODE, u as INVALID_ENCODING_CODE, v as INVALID_UTF8_CODE, y as ELEMENT_ISSUE, z as INPUT_ISSUE, K as ImportReportBuilder } from "./report-CwMfYa9J.js";
6
+ import { i as inferTextDtype, W as WIDENING_UNSUPPORTED_CODE, a as isNumericText, T as TextCellWriter } from "./text-ystE2bYi.js";
6
7
  import { j as joinText, e as encodeChunks } from "./writer-DxjgHwSe.js";
7
- import { i as importChosenGraph } from "./choose--jM0yYCo.js";
8
- import { w as writeStyleBlock, c as styleBlockLosses, t as StyleNotes, p as plainCell, u as parseStyleBlock, s as styleFingerprint, v as blockStyles, r as resolveStyles, o as canonText, l as canonEnum, h as canonNumber, g as canonColor, x as colorOpacity, D as DVIPS_COLORS } from "./block-DiGq58c3.js";
9
- import { S as StyleApproximations } from "./approximations-wWjCRzKj.js";
10
- import { v as valueColumns } from "./styles-yed-BF5x3_Y5.js";
8
+ import { p as postscriptFont, f as graphvizFontName, i as importChosenGraph } from "./choose-CczZJaX_.js";
9
+ import { L as LineReader, b as throwIfAborted } from "./input-CAxt_aV-.js";
10
+ import { A as writeStyleBlock, B as styleBlockLosses, h as StyleNotes, p as plainCell, f as canonText, a as canonEnum, d as canonColor, e as colorOpacity, c as canonNumber, n as noteAt, b as STYLE_ISSUE, y as toolDefaults, L as DVIPS_COLORS } from "./block-iptrlMBb.js";
11
+ import { S as StyleApproximations } from "./approximations-Bzn3L-je.js";
12
+ import { e as elementValues, t as takeFromBlock } from "./round-trip-Zm3_ivgq.js";
13
+ import { v as valueColumns } from "./styles-yed-UMFdNqze.js";
14
+ const PAJEK_WINDOW = 500;
15
+ function resolvePajekDraw(option) {
16
+ if (option === void 0) {
17
+ return null;
18
+ }
19
+ const bad = (found) => {
20
+ throw new GraphFormatError("E_UNSUPPORTED", "option pajekDraw: not an object of Pajek draw settings", {
21
+ option: "pajekDraw",
22
+ found
23
+ });
24
+ };
25
+ if (typeof option !== "object" || option === null || Array.isArray(option)) {
26
+ return bad(option);
27
+ }
28
+ const o = option;
29
+ const num = (v, fallback, positive) => {
30
+ if (v === void 0) {
31
+ return fallback;
32
+ }
33
+ if (typeof v !== "number" || !Number.isFinite(v)) {
34
+ return bad(v);
35
+ }
36
+ const inRange = positive ? v > 0 : v >= 0;
37
+ return inRange ? v : bad(v);
38
+ };
39
+ const ini = /* @__PURE__ */ new Map();
40
+ for (const [name, value] of Object.entries(o.ini ?? {})) {
41
+ if (typeof value !== "string" && typeof value !== "number" && typeof value !== "boolean") {
42
+ return bad(value);
43
+ }
44
+ ini.set(name, String(value));
45
+ }
46
+ return {
47
+ width: num(o.width, PAJEK_WINDOW, true),
48
+ height: num(o.height, PAJEK_WINDOW, true),
49
+ partition: num(o.partition, 0, false),
50
+ vector: num(o.vector, 0, false),
51
+ vector2: num(o.vector2, 0, false),
52
+ ini
53
+ };
54
+ }
55
+ function flag(draw, name) {
56
+ const v = draw.ini.get(name);
57
+ return v !== void 0 && v !== "0" && v !== "false";
58
+ }
59
+ function drawsLineLabels(draw) {
60
+ return draw !== null && flag(draw, "Form8.withLabels1");
61
+ }
62
+ function iniNumber(draw, name) {
63
+ const v = draw.ini.get(name);
64
+ const n = v === void 0 || v.trim() === "" ? Number.NaN : Number(v);
65
+ return Number.isFinite(n) ? n : null;
66
+ }
67
+ const PARTITION_COLORS = [
68
+ "#00ffff",
69
+ "#ffff00",
70
+ "#7fff00",
71
+ "#ff0000",
72
+ "#0000ff",
73
+ "#ffd8f2",
74
+ "#ffffff",
75
+ "#ff6321",
76
+ "#8c23ff",
77
+ "#606dc4",
78
+ "#1ef9a3",
79
+ "#009900",
80
+ "#7f7f7f",
81
+ "#000000",
82
+ "#ad0000",
83
+ "#ccffb2",
84
+ "#ffff99",
85
+ "#ff00ff",
86
+ "#007091",
87
+ "#ffb528",
88
+ "#ff0a9b",
89
+ "#00e000",
90
+ "#ff779e",
91
+ "#d8f2ff",
92
+ "#d8ff4f",
93
+ "#ff84ff",
94
+ "#e5ffcc",
95
+ "#ccccff",
96
+ "#59ddff",
97
+ "#ffd9bc",
98
+ "#db9370",
99
+ "#ccffff",
100
+ "#d8d8d8",
101
+ "#666666",
102
+ "#a5a5a5",
103
+ "#3f3f3f",
104
+ "#e5e5e5",
105
+ "#262626",
106
+ "#bfbfbf",
107
+ "#595959"
108
+ ];
109
+ const VERTEX_SIZE = 20;
110
+ const VERTEX_FILL = "#ffd9bc";
111
+ const SIZE_OF_VERTICES = 8;
112
+ function objectValues(snapshot, kind, n) {
113
+ if (n < 1) {
114
+ return null;
115
+ }
116
+ const pajek = snapshot.meta.extra.pajek;
117
+ const name = pajek?.objects?.filter((o) => o.kind === kind)[n - 1]?.column;
118
+ if (name === void 0 || !snapshot.nodes.has(name)) {
119
+ return null;
120
+ }
121
+ return (i) => {
122
+ const v = snapshot.nodes.value(name, i);
123
+ return typeof v === "number" && Number.isFinite(v) ? v : null;
124
+ };
125
+ }
126
+ function column(values, property, n) {
127
+ values[property] ??= new Array(n).fill(null);
128
+ return values[property];
129
+ }
130
+ function drawVertices(draw, snapshot, node) {
131
+ const n = snapshot.nodeCount;
132
+ const width = column(node, "width", n);
133
+ const height = column(node, "height", n);
134
+ scaleVertexSizes(draw, width, height);
135
+ sizeByVectors(draw, snapshot, width, height);
136
+ colorByPartition(draw, snapshot, node);
137
+ const opacity = iniNumber(draw, "TransparencyofVertices");
138
+ if (opacity !== null && opacity < 1) {
139
+ const o = Math.max(0, opacity);
140
+ const fill = column(node, "fillOpacity", n);
141
+ fill.forEach((v, i) => {
142
+ fill[i] = (typeof v === "number" ? v : 1) * o;
143
+ });
144
+ column(node, "borderOpacity", n).fill(o * o);
145
+ }
146
+ if (flag(draw, "Form10.effect3d")) {
147
+ effect3d(snapshot, node);
148
+ }
149
+ markVertices(draw, node, n);
150
+ for (const property of ["width", "height"]) {
151
+ if (node[property].every((v) => v === null)) {
152
+ Reflect.deleteProperty(node, property);
153
+ }
154
+ }
155
+ }
156
+ function scaleVertexSizes(draw, width, height) {
157
+ const size = iniNumber(draw, "Form8.SizeofVertices");
158
+ if (size === null || size === SIZE_OF_VERTICES) {
159
+ return;
160
+ }
161
+ const f = size / SIZE_OF_VERTICES;
162
+ const scaled = (v) => typeof v === "number" ? v * f : VERTEX_SIZE * f * f;
163
+ for (let i = 0; i < width.length; i++) {
164
+ width[i] = scaled(width[i]);
165
+ height[i] = scaled(height[i]);
166
+ }
167
+ }
168
+ function colorByPartition(draw, snapshot, node) {
169
+ const partition = objectValues(snapshot, "partition", draw.partition);
170
+ if (partition === null) {
171
+ return;
172
+ }
173
+ const fill = column(node, "fill", snapshot.nodeCount);
174
+ for (let i = 0; i < snapshot.nodeCount; i++) {
175
+ const k = partition(i);
176
+ if (k !== null) {
177
+ fill[i] = PARTITION_COLORS[Math.abs(k) % PARTITION_COLORS.length];
178
+ }
179
+ }
180
+ }
181
+ function markVertices(draw, node, n) {
182
+ const mark = iniNumber(draw, "Form8.MarkVerticesUsing");
183
+ if (mark === 2) {
184
+ column(node, "label", n).forEach((_, i, a) => {
185
+ a[i] = String(i + 1);
186
+ });
187
+ } else if (mark === 3 || mark === 4) {
188
+ column(node, "label", n).fill("");
189
+ }
190
+ }
191
+ function effect3d(snapshot, node) {
192
+ const n = snapshot.nodeCount;
193
+ const fill = column(node, "fill", n);
194
+ const end = column(node, "fillGradient", n);
195
+ const angle = column(node, "fillGradientAngle", n);
196
+ const half = (v) => {
197
+ const h = v / 2;
198
+ const f = Math.floor(h);
199
+ return h - f === 0.5 && f % 2 === 0 ? f : Math.round(h);
200
+ };
201
+ for (let i = 0; i < n; i++) {
202
+ const color = typeof fill[i] === "string" ? String(fill[i]) : VERTEX_FILL;
203
+ end[i] = `#${[1, 3, 5].map(
204
+ (k) => half(Number.parseInt(color.slice(k, k + 2), 16)).toString(16).padStart(2, "0")
205
+ ).join("")}`;
206
+ const phi = snapshot.nodes.has("phi") ? Number(snapshot.nodes.value("phi", i)) : 0;
207
+ angle[i] = Number.isFinite(phi) ? ((90 - phi) % 360 + 360) % 360 : 90;
208
+ }
209
+ }
210
+ function sizeByVectors(draw, snapshot, width, height) {
211
+ const first = objectValues(snapshot, "vector", draw.vector);
212
+ if (first === null) {
213
+ return;
214
+ }
215
+ const second = objectValues(snapshot, "vector", draw.vector2);
216
+ const scale = (sizes, i, v) => {
217
+ if (v !== null && v >= 0) {
218
+ sizes[i] = (typeof sizes[i] === "number" ? sizes[i] : VERTEX_SIZE) * v;
219
+ }
220
+ };
221
+ for (let i = 0; i < snapshot.nodeCount; i++) {
222
+ const v = first(i);
223
+ if (second === null) {
224
+ const root = v === null || v < 0 ? null : Math.sqrt(v);
225
+ scale(width, i, root);
226
+ scale(height, i, root);
227
+ } else {
228
+ scale(width, i, v);
229
+ scale(height, i, second(i));
230
+ }
231
+ }
232
+ }
233
+ function drawLines(draw, snapshot, node, edge) {
234
+ const m = snapshot.edgeCount;
235
+ const opacity = iniNumber(draw, "TransparencyofLines");
236
+ if (opacity !== null && opacity < 1) {
237
+ const o = column(edge, "opacity", m);
238
+ o.forEach((v, e) => {
239
+ o[e] = (typeof v === "number" ? v : 1) * Math.max(0, opacity);
240
+ });
241
+ }
242
+ if (flag(draw, "Form10.StraightLinesOnly1")) {
243
+ const curved = column(edge, "curved", m);
244
+ for (let e = 0; e < m; e++) {
245
+ const bends = edge.bends?.[e];
246
+ if (bends === null || bends === void 0) {
247
+ curved[e] = false;
248
+ }
249
+ }
250
+ }
251
+ if (flag(draw, "Form10.ColorGradientLines")) {
252
+ const fill = node.fill;
253
+ const fillOf = (i) => typeof fill?.[i] === "string" ? fill[i] : VERTEX_FILL;
254
+ const colors = column(edge, "gradientColors", m);
255
+ const kind = column(edge, "gradientKind", m);
256
+ const sourceArrow = column(edge, "sourceArrowColor", m);
257
+ const targetArrow = column(edge, "targetArrowColor", m);
258
+ for (let e = 0; e < m; e++) {
259
+ const [s, t] = [fillOf(snapshot.edgeSource(e)), fillOf(snapshot.edgeTarget(e))];
260
+ colors[e] = `${s} ${t}`;
261
+ kind[e] = "linear";
262
+ sourceArrow[e] = s;
263
+ targetArrow[e] = t;
264
+ }
265
+ }
266
+ }
11
267
  const LABEL_COLUMN = "label";
12
268
  const POSITION_COLUMN = "position";
13
269
  const SHAPE_COLUMN = "shape";
@@ -254,7 +510,7 @@ function parseIntervals(token) {
254
510
  return [];
255
511
  }
256
512
  const spells = [];
257
- for (const part of body.split(",")) {
513
+ for (const part of body.split(/[,/]/)) {
258
514
  spells.push(parseSpell(token, part));
259
515
  }
260
516
  return spells;
@@ -326,7 +582,22 @@ function isParameterKey(text) {
326
582
  }
327
583
  return !/^[+-]?(\.\d|\d)/.test(text) && !/^[+-]?(?:nan|inf|infinity)$/i.test(text);
328
584
  }
585
+ const VOIDING_KEYS = /* @__PURE__ */ new Set([
586
+ "bc",
587
+ "bw",
588
+ "s_size",
589
+ "phi",
590
+ "r",
591
+ "q",
592
+ "lc",
593
+ "la",
594
+ "lr",
595
+ "lphi",
596
+ "fos",
597
+ "font"
598
+ ]);
329
599
  const PAJEK_STYLE_CAPABILITIES = Object.freeze({
600
+ tool: "pajek",
330
601
  node: Object.freeze([
331
602
  "label",
332
603
  "fill",
@@ -335,22 +606,93 @@ const PAJEK_STYLE_CAPABILITIES = Object.freeze({
335
606
  "borderColor",
336
607
  "borderWidth",
337
608
  "shape",
609
+ "shapePoints",
338
610
  "width",
339
611
  "height",
340
612
  "labelColor",
341
- "labelSize"
613
+ "labelSize",
614
+ "labelFont",
615
+ "labelPosition",
616
+ "labelOffsetX",
617
+ "labelOffsetY",
618
+ "labelShiftX"
619
+ ]),
620
+ edge: Object.freeze([
621
+ "color",
622
+ "opacity",
623
+ "width",
624
+ "lineStyle",
625
+ "sourceArrow",
626
+ "targetArrow",
627
+ "arrowPosition",
628
+ "label",
629
+ "labelColor",
630
+ "labelSize",
631
+ "labelFont"
342
632
  ]),
343
- edge: Object.freeze(["color", "opacity", "width", "lineStyle", "sourceArrow", "targetArrow"]),
344
633
  block: "native"
345
634
  });
346
- const VERTEX_SIZE = 5;
347
- const NODE_KEYS = ["ic", "bc", "bw", "x_fact", "y_fact", "lc", "fos"];
348
- const EDGE_KEYS = ["c", "w", "p"];
635
+ const PAJEK_VERTEX_SIZE = 20;
636
+ const PAJEK_FIGURES = /* @__PURE__ */ new Map([
637
+ ["other:man", [2.502, 6.487]],
638
+ ["other:woman", [3.003, 6.478]]
639
+ ]);
640
+ const PAJEK_POINTS_PER_UNIT = 500;
641
+ const NODE_KEYS = [
642
+ "ic",
643
+ "bc",
644
+ "bw",
645
+ "s_size",
646
+ "x_fact",
647
+ "y_fact",
648
+ "phi",
649
+ "q",
650
+ "lc",
651
+ "fos",
652
+ "font",
653
+ "lr",
654
+ "lphi",
655
+ "la"
656
+ ];
657
+ const EDGE_KEYS = ["c", "w", "p", "s", "ap", "l", "lc", "fos", "font"];
658
+ const CARRIED = {
659
+ node: [SHAPE_COLUMN, ...NODE_KEYS],
660
+ edge: ["c", "w", "p", "s", "ap"]
661
+ };
662
+ const CARRIED_LINE = CARRIED.edge.filter((key) => key !== "p");
663
+ const EDGE_WIDTH_PER_W = 2;
664
+ const ARC_DEFAULTS = { color: "#999999", width: 1 };
665
+ function carriedParams(keys, whole) {
666
+ let last = /* @__PURE__ */ new Map();
667
+ return (get) => {
668
+ const own = /* @__PURE__ */ new Map();
669
+ for (const key of keys) {
670
+ const v = get(key);
671
+ if (v !== null) {
672
+ own.set(key, v);
673
+ }
674
+ }
675
+ if (whole) {
676
+ if (own.size > 0) {
677
+ last = own;
678
+ return get;
679
+ }
680
+ } else {
681
+ for (const [key, v] of own) {
682
+ last.set(key, v);
683
+ }
684
+ }
685
+ const carried = last;
686
+ return (key) => get(key) ?? (keys.includes(key) ? carried.get(key) ?? null : null);
687
+ };
688
+ }
349
689
  const DIRECTED_KEY = "directed";
350
690
  const READ = {
351
691
  node: [
352
692
  "label",
353
693
  "shape",
694
+ "shapePoints",
695
+ "shapePointsStretch",
354
696
  "fill",
355
697
  "fillOpacity",
356
698
  "borderColor",
@@ -358,9 +700,26 @@ const READ = {
358
700
  "width",
359
701
  "height",
360
702
  "labelColor",
361
- "labelSize"
703
+ "labelSize",
704
+ "labelFont",
705
+ "labelPosition",
706
+ "labelOffsetX",
707
+ "labelOffsetY",
708
+ "labelShiftX",
709
+ "labelRotation"
362
710
  ],
363
- edge: ["color", "opacity", "width", "lineStyle"]
711
+ edge: [
712
+ "color",
713
+ "opacity",
714
+ "width",
715
+ "lineStyle",
716
+ "arrowSize",
717
+ "arrowPosition",
718
+ "label",
719
+ "labelColor",
720
+ "labelSize",
721
+ "labelFont"
722
+ ]
364
723
  };
365
724
  function readColor(raw, property, opacity, put, at) {
366
725
  if (raw === null) {
@@ -368,6 +727,10 @@ function readColor(raw, property, opacity, put, at) {
368
727
  }
369
728
  const c = canonColor(raw, "dvips", at(property));
370
729
  if (c === null) {
730
+ const unknown = UNKNOWN_COLORS.get(property);
731
+ if (unknown !== void 0 && typeof raw === "string" && /^[A-Za-z]\w*$/.test(raw.trim())) {
732
+ put(property, unknown);
733
+ }
371
734
  return;
372
735
  }
373
736
  put(property, c.color);
@@ -376,43 +739,437 @@ function readColor(raw, property, opacity, put, at) {
376
739
  put(opacity, alpha);
377
740
  }
378
741
  }
742
+ const UNKNOWN_COLORS = /* @__PURE__ */ new Map([
743
+ ["fill", "#ffffff"],
744
+ ["color", "#000000"]
745
+ ]);
379
746
  function readNumber(raw, property, put, at) {
380
747
  if (raw !== null) {
381
748
  put(property, canonNumber(raw, at(property)));
382
749
  }
383
750
  }
384
- function readVertex(get, put, at) {
751
+ function readVertex(get, put, at, place = null) {
385
752
  const label = get(LABEL_COLUMN);
386
753
  if (label !== null && label !== "") {
387
754
  put("label", canonText(label, at("label")));
388
755
  }
389
- const shape = get(SHAPE_COLUMN);
390
- if (shape !== null) {
391
- put("shape", canonEnum("shape", shape, "dvips", at("shape")));
756
+ const raw = get(SHAPE_COLUMN);
757
+ const shape = raw === null ? null : canonEnum("shape", raw, "dvips", at("shape"));
758
+ if (raw !== null) {
759
+ put("shape", shape);
392
760
  }
393
761
  readColor(get("ic"), "fill", "fillOpacity", put, at);
394
762
  readColor(get("bc"), "borderColor", null, put, at);
395
- const bw = get("bw");
396
- if (bw !== null) {
397
- const width = canonNumber(bw, at("borderWidth"));
398
- put("borderWidth", width === null ? null : width / VERTEX_SIZE);
399
- }
400
- readNumber(get("x_fact"), "width", put, at);
401
- readNumber(get("y_fact"), "height", put, at);
763
+ readNumber(get("bw"), "borderWidth", put, at);
764
+ readSize(get, put, at, PAJEK_FIGURES.get(String(shape)));
765
+ readOutline(get, put, shape);
402
766
  readColor(get("lc"), "labelColor", null, put, at);
403
767
  readNumber(get("fos"), "labelSize", put, at);
768
+ readFont(get("font"), put, at);
769
+ readLabelPosition(get, put, at);
770
+ readLabelAngle(get("la"), put, at, place);
771
+ if (shape === "none") {
772
+ for (const [property, value] of EMPTY_LABEL) {
773
+ put(property, value);
774
+ }
775
+ }
776
+ }
777
+ const PAJEK_OUTLINES = /* @__PURE__ */ new Map([
778
+ [
779
+ "rectangle",
780
+ [
781
+ [-1, 1],
782
+ [1, 1],
783
+ [1, -1],
784
+ [-1, -1]
785
+ ]
786
+ ],
787
+ [
788
+ "triangle",
789
+ [
790
+ [1, -1],
791
+ [0, 1],
792
+ [-1, -1]
793
+ ]
794
+ ],
795
+ [
796
+ "other:house",
797
+ [
798
+ [-0.7, -1],
799
+ [0.7, -1],
800
+ [0.7, 0.3],
801
+ [1, 0.3],
802
+ [1, 0.4],
803
+ [0, 1],
804
+ [-1, 0.4],
805
+ [-1, 0.3],
806
+ [-0.7, 0.3]
807
+ ]
808
+ ]
809
+ ]);
810
+ const PAJEK_DIAMOND_Q = 1e-3;
811
+ function readOutline(get, put, shape) {
812
+ const phi = numberOrNull(get("phi")) ?? 0;
813
+ const q = numberOrNull(get("q")) ?? PAJEK_DIAMOND_Q;
814
+ const diamond = [
815
+ [-1, 0],
816
+ [-q, 1],
817
+ [q, 1],
818
+ [1, 0],
819
+ [q, -1],
820
+ [-q, -1]
821
+ ];
822
+ const corners = shape === "diamond" ? diamond : PAJEK_OUTLINES.get(String(shape));
823
+ if (corners === void 0 || shape !== "diamond" && phi % 360 === 0) {
824
+ return;
825
+ }
826
+ const [w, h] = [numberOrNull(get("x_fact")) || 1, numberOrNull(get("y_fact")) || 1];
827
+ const [c, s] = [Math.cos(phi * Math.PI / 180), Math.sin(phi * Math.PI / 180)];
828
+ const round = (v) => String(Number(v.toFixed(4)) + 0);
829
+ const points = corners.map(([x, y]) => {
830
+ const [px, py] = [x * w, y * h];
831
+ return `${round((px * c - py * s) / w)},${round((px * s + py * c) / h)}`;
832
+ });
833
+ put("shape", "polygon");
834
+ put("shapePoints", points.join(" "));
835
+ put("shapePointsStretch", false);
836
+ }
837
+ const EMPTY_LABEL = [
838
+ ["labelSize", 1],
839
+ ["labelColor", "#ffffff"],
840
+ ["labelPosition", "center"],
841
+ ["labelOffsetX", 0],
842
+ ["labelOffsetY", 0],
843
+ ["labelShiftX", 0]
844
+ ];
845
+ function readFont(raw, put, at) {
846
+ if (raw === null || raw === "") {
847
+ return;
848
+ }
849
+ const ps = typeof raw === "string" ? postscriptFont(raw.trim()) : null;
850
+ if (ps === null) {
851
+ readText(raw, "labelFont", put, at);
852
+ return;
853
+ }
854
+ put("labelFont", ps.family);
404
855
  }
405
- function readLine(get, put, at) {
856
+ function readLabelAngle(raw, put, at, place) {
857
+ let a = raw === null ? null : canonNumber(raw, at("labelRotation"));
858
+ if (a !== null && a >= 360) {
859
+ a = place === null ? null : Math.atan2(0.5 - place[1], place[0] - 0.5) * 180 / Math.PI + a - 360;
860
+ }
861
+ if (a !== null) {
862
+ put("labelRotation", Number((((360 - a) % 360 + 360) % 360).toPrecision(12)));
863
+ }
864
+ }
865
+ function readSize(get, put, at, figure) {
866
+ for (const [key, property, k] of [
867
+ ["x_fact", "width", 0],
868
+ ["y_fact", "height", 1]
869
+ ]) {
870
+ const f = get(key);
871
+ if (f === null && figure === void 0) {
872
+ continue;
873
+ }
874
+ const factor = f === null ? 1 : canonNumber(f, at(property));
875
+ const over = figure?.[k] ?? 1;
876
+ put(property, factor === null ? null : Number((PAJEK_VERTEX_SIZE * factor * over).toPrecision(15)));
877
+ }
878
+ }
879
+ function readText(raw, property, put, at) {
880
+ if (raw !== null && raw !== "") {
881
+ put(property, canonText(raw, at(property)));
882
+ }
883
+ }
884
+ const SIDE_ANGLES = /* @__PURE__ */ new Map([
885
+ ["right", 0],
886
+ ["top-right", 90],
887
+ ["left", 180],
888
+ ["bottom-right", 285]
889
+ ]);
890
+ const NEAREST_SIDES = /* @__PURE__ */ new Map([
891
+ ["top", "top-right"],
892
+ ["top-left", "top-right"],
893
+ ["bottom", "bottom-right"],
894
+ ["bottom-left", "bottom-right"]
895
+ ]);
896
+ function readLabelPosition(get, put, at) {
897
+ const [lr, lphi, fos] = [get("lr"), get("lphi"), get("fos")];
898
+ if (lr === null && lphi === null && fos === null) {
899
+ return;
900
+ }
901
+ const radius = lr === null ? PAJEK_LABEL_RADIUS : canonNumber(lr, at("labelPosition"));
902
+ const angle = lphi === null ? PAJEK_LABEL_ANGLE : canonNumber(lphi, at("labelPosition"));
903
+ const size = fos === null ? PAJEK_LABEL_SIZE : canonNumber(fos, at("labelSize"));
904
+ if (radius === null || angle === null || size === null) {
905
+ return;
906
+ }
907
+ const [x, y] = labelOffset(radius, angle, size);
908
+ put("labelPosition", "center");
909
+ put("labelOffsetX", x);
910
+ put("labelOffsetY", y);
911
+ put("labelShiftX", radius === 0 ? 0 : 0.5);
912
+ }
913
+ function labelOffset(radius, angle, size) {
914
+ if (radius === 0) {
915
+ return [0, 0];
916
+ }
917
+ const t = angle * Math.PI / 180;
918
+ const round = (v) => Number(v.toFixed(9)) + 0;
919
+ return [round(radius * Math.cos(t)), round(-radius * Math.sin(t) - PAJEK_BASELINE_TO_MIDDLE * size)];
920
+ }
921
+ const PAJEK_LABEL_RADIUS = 20;
922
+ const PAJEK_LABEL_ANGLE = 285;
923
+ const PAJEK_LABEL_SIZE = 15;
924
+ const PAJEK_BASELINE_TO_MIDDLE = 0.3465;
925
+ function readLine(get, put, at, directed, labels = true, run = null, loop = null) {
406
926
  readColor(get("c"), "color", "opacity", put, at);
407
- readNumber(get("w"), "width", put, at);
927
+ readNumber(
928
+ get("w"),
929
+ "width",
930
+ (property, value) => {
931
+ put(property, typeof value === "number" && !directed ? value * EDGE_WIDTH_PER_W : value);
932
+ },
933
+ at
934
+ );
408
935
  const p = get("p");
409
- if (p !== null) {
410
- put("lineStyle", canonEnum("lineStyle", p, "dvips", at("lineStyle")));
936
+ if (p === "Dots") {
937
+ put("lineStyle", pajekDash(get, directed));
938
+ } else if (p === "Solid") {
939
+ put("lineStyle", "solid");
940
+ } else if (p !== null) {
941
+ noteAt(at("lineStyle"), STYLE_ISSUE.UNKNOWN_VALUE, typeof p === "string" ? p : JSON.stringify(p));
942
+ put("lineStyle", "solid");
943
+ }
944
+ readNumber(get("s"), "arrowSize", put, at);
945
+ readArrowPosition(get("ap"), put, at);
946
+ const line = loop === null ? get : loopParam(get);
947
+ const controls = loop === null ? null : readLoop(line, put, loop);
948
+ if (labels) {
949
+ readText(get("l"), "label", put, at);
950
+ if (controls === null) {
951
+ readLineLabelPlace(get, put, at, run);
952
+ } else {
953
+ readLineLabelPlace(line, put, at, [PAJEK_POINTS_PER_UNIT, 0], loopTop(controls));
954
+ }
955
+ }
956
+ if (loop === null) {
957
+ readBezier(get, put, run);
958
+ }
959
+ readColor(get("lc"), "labelColor", null, put, at);
960
+ readNumber(get("fos"), "labelSize", put, at);
961
+ readFont(get("font"), put, at);
962
+ }
963
+ const LOOP_DEFAULTS = { a1: -70, k1: 0.3, a2: -70, k2: 0.3 };
964
+ function loopParam(get) {
965
+ return (key) => get(key) ?? (key in LOOP_DEFAULTS ? LOOP_DEFAULTS[key] : null);
966
+ }
967
+ function readLoop(get, put, loop) {
968
+ const run = [PAJEK_POINTS_PER_UNIT, 0];
969
+ const controls = bezierControls(get, run);
970
+ if (controls === null) {
971
+ return null;
972
+ }
973
+ const [[a1, l1], [a2, l2]] = controls;
974
+ const L = PAJEK_POINTS_PER_UNIT;
975
+ const [c1, c2] = [
976
+ [a1 * L, -l1 * L],
977
+ [(a2 - 1) * L, -l2 * L]
978
+ ];
979
+ loop([c1, c2]);
980
+ put("curved", true);
981
+ put("bendCurve", "bezier");
982
+ put("targetArrow", "none");
983
+ return [c1, c2];
984
+ }
985
+ function loopTop(controls) {
986
+ const [c1, c2] = controls;
987
+ return Math.atan2(c2[1] - c1[1], c2[0] - c1[0]) * 180 / Math.PI;
988
+ }
989
+ function layLoops(snapshot, loops, node, edge) {
990
+ const fraction = (x) => String(Math.round(x * 1e4) / 1e4 || 0);
991
+ for (const [e, controls] of loops) {
992
+ const v = snapshot.edgeSource(e);
993
+ const half = (property) => {
994
+ const size = node[property]?.[v];
995
+ return (typeof size === "number" && size > 0 ? size : PAJEK_VERTEX_SIZE) / 2;
996
+ };
997
+ const [hw, hh] = [half("width"), half("height")];
998
+ const column2 = (property) => edge[property] ??= new Array(snapshot.edgeCount).fill(null);
999
+ column2("bends")[e] = controls.map(([x, y]) => `${fraction(x / hw)},${fraction(-y / hh)}`).join(" ");
1000
+ column2("curved")[e] = true;
1001
+ column2("bendCurve")[e] = "bezier";
1002
+ }
1003
+ }
1004
+ function readLineLabelPlace(get, put, at, run, direction) {
1005
+ const length = run === null ? 0 : Math.hypot(run[0], run[1]);
1006
+ if (run === null || length === 0) {
1007
+ return;
1008
+ }
1009
+ const n = (key, fallback, property) => {
1010
+ const v = get(key);
1011
+ return v === null ? fallback : canonNumber(v, at(property));
1012
+ };
1013
+ const [lp, lr, lphi, la] = [
1014
+ n("lp", 0.5, "labelOffsetX"),
1015
+ n("lr", 0, "labelOffsetX"),
1016
+ n("lphi", 0, "labelOffsetX"),
1017
+ n("la", 0, "labelRotation")
1018
+ ];
1019
+ const size = n("fos", PAJEK_LABEL_SIZE, "labelSize");
1020
+ if (lp === null || lr === null || lphi === null || la === null || size === null) {
1021
+ return;
1022
+ }
1023
+ const along = 0.5 - (lp <= 1 ? lp : lp / length);
1024
+ const t = lphi * Math.PI / 180;
1025
+ const round = (v) => Number(v.toFixed(9)) + 0;
1026
+ const turn = ((direction ?? lineDirection(get, run, along + 0.5)) - la) % 360 + 360;
1027
+ const up = turn * Math.PI / 180;
1028
+ const rise = PAJEK_BASELINE_TO_MIDDLE * size;
1029
+ put("labelPosition", "center");
1030
+ put("labelOffsetX", round(along * run[0] + lr * Math.cos(t) + rise * Math.sin(up)));
1031
+ put("labelOffsetY", round(along * run[1] - lr * Math.sin(t) - rise * Math.cos(up)));
1032
+ put("labelRotation", round(turn % 360));
1033
+ }
1034
+ function readBezier(get, put, run) {
1035
+ const controls = bezierControls(get, run);
1036
+ if (controls === null) {
1037
+ return;
1038
+ }
1039
+ const fraction = (x) => String(Math.round(x * 1e4) / 1e4 || 0);
1040
+ put("curved", true);
1041
+ put("bendCurve", "bezier");
1042
+ put("bends", controls.map(([along, across]) => `${fraction(along)},${fraction(across)}`).join(" "));
1043
+ }
1044
+ function readArcEnd(get, put, run, target) {
1045
+ const ap = numberOrNull(get("ap")) ?? 0;
1046
+ const length = Math.hypot(run[0], run[1]);
1047
+ if (ap !== 0 || length === 0 || bezierControls(get, run) === null) {
1048
+ return;
1049
+ }
1050
+ const [ux, uy] = [run[0] / length, run[1] / length];
1051
+ const r = 1 / Math.hypot(ux / (target[0] / 2), uy / (target[1] / 2));
1052
+ const back = 1.5 + 5 * (numberOrNull(get("s")) ?? 1);
1053
+ const turn = -(numberOrNull(get("a2")) ?? 0) * Math.PI / 180;
1054
+ const [c, s] = [Math.cos(turn), Math.sin(turn)];
1055
+ const end = [run[0] - r * ux - back * (ux * c - uy * s), run[1] - r * uy - back * (ux * s + uy * c)];
1056
+ const controls = bezierControls(get, end);
1057
+ if (controls === null) {
1058
+ return;
1059
+ }
1060
+ const L2 = length * length;
1061
+ const fraction = (x) => String(Math.round(x * 1e4) / 1e4 || 0);
1062
+ const bends = controls.map(([along, left]) => {
1063
+ const [x, y] = [along * end[0] + left * end[1], along * end[1] - left * end[0]];
1064
+ return `${fraction((x * run[0] + y * run[1]) / L2)},${fraction((x * run[1] - y * run[0]) / L2)}`;
1065
+ });
1066
+ put("bends", bends.join(" "));
1067
+ }
1068
+ function bezierControls(get, run) {
1069
+ const [a1, k1, a2, k2] = ["a1", "k1", "a2", "k2"].map((key) => numberOrNull(get(key)));
1070
+ if (a1 === null && k1 === null && a2 === null && k2 === null || run === null || run[0] === 0 && run[1] === 0) {
1071
+ return null;
1072
+ }
1073
+ const [s, t] = [k1 ?? 1, k2 ?? 1];
1074
+ if (s < 0 || t < 0) {
1075
+ return null;
1076
+ }
1077
+ const rad = Math.PI / 180;
1078
+ const [u, v] = [(a1 ?? 0) * rad, (a2 ?? 0) * rad];
1079
+ return [
1080
+ [s / 2 * Math.cos(u), -s / 2 * Math.sin(u)],
1081
+ [1 - t / 2 * Math.cos(v), -t / 2 * Math.sin(v)]
1082
+ ];
1083
+ }
1084
+ function lineDirection(get, run, along) {
1085
+ const controls = bezierControls(get, run);
1086
+ let [dx, dy] = run;
1087
+ if (controls !== null) {
1088
+ const t = Math.min(1, Math.max(0, along));
1089
+ const p = [[0, 0], ...controls, [1, 0]];
1090
+ const d = (k) => 3 * (1 - t) ** 2 * (p[1][k] - p[0][k]) + 6 * (1 - t) * t * (p[2][k] - p[1][k]) + 3 * t ** 2 * (p[3][k] - p[2][k]);
1091
+ const [a, l] = [d(0), d(1)];
1092
+ [dx, dy] = [a * run[0] + l * run[1], a * run[1] - l * run[0]];
1093
+ }
1094
+ return Math.atan2(dy, dx) * 180 / Math.PI;
1095
+ }
1096
+ function readLineValue(value, get, put, directed = true) {
1097
+ if (value === 0) {
1098
+ put("visible", false);
1099
+ } else if (value !== null && value < 0 && get("p") === null) {
1100
+ put("lineStyle", pajekDash(get, directed));
1101
+ }
1102
+ }
1103
+ const PAJEK_DASH = 5;
1104
+ function pajekDash(get, directed) {
1105
+ const w = numberOrNull(get("w"));
1106
+ const width = (w ?? 1) * (directed ? 1 : EDGE_WIDTH_PER_W);
1107
+ return PAJEK_DASH <= 1.5 * Math.max(1, width) ? "dotted" : "dashed";
1108
+ }
1109
+ function readHooks(get, put, source, target) {
1110
+ for (const [key, property, shape] of [
1111
+ ["h1", "sourcePort", source],
1112
+ ["h2", "targetPort", target]
1113
+ ]) {
1114
+ const hook = numberOrNull(get(key));
1115
+ const port = hook === null ? null : hookPort(shape, hook);
1116
+ if (port !== null) {
1117
+ const round = (v) => String(Number(v.toFixed(4)) + 0);
1118
+ put(property, `${round(port[0])},${round(port[1])}`);
1119
+ }
1120
+ }
1121
+ }
1122
+ function hookPort(shape, hook) {
1123
+ if (!Number.isInteger(hook) || hook < 1) {
1124
+ return null;
1125
+ }
1126
+ const keyword = typeof shape === "string" ? shape.toLowerCase() : "ellipse";
1127
+ if (keyword === "ellipse" || keyword === "cross") {
1128
+ const a = hook * Math.PI / 180;
1129
+ return [Math.cos(a), Math.sin(a)];
1130
+ }
1131
+ if (keyword !== "box" || hook > 400) {
1132
+ return null;
1133
+ }
1134
+ const d = hook * 0.02;
1135
+ if (hook <= 50) {
1136
+ return [1, d];
1137
+ }
1138
+ if (hook <= 150) {
1139
+ return [2 - d, 1];
1140
+ }
1141
+ if (hook <= 250) {
1142
+ return [-1, 4 - d];
1143
+ }
1144
+ return hook <= 350 ? [d - 6, -1] : [1, d - 8];
1145
+ }
1146
+ function numberOrNull(raw) {
1147
+ if (typeof raw === "string" && raw.trim() !== "") {
1148
+ raw = Number(raw);
1149
+ }
1150
+ return typeof raw === "number" && Number.isFinite(raw) ? raw : null;
1151
+ }
1152
+ function readArrowPosition(raw, put, at) {
1153
+ if (raw === null) {
1154
+ return;
1155
+ }
1156
+ const ap = canonNumber(raw, at("arrowPosition"));
1157
+ if (ap !== null && ap > 1) {
1158
+ noteAt(at("arrowPosition"), STYLE_ISSUE.NOT_CARRIED, `ap ${String(ap)}`);
1159
+ return;
1160
+ }
1161
+ if (ap !== 0) {
1162
+ put("arrowPosition", ap);
411
1163
  }
412
1164
  }
413
1165
  function cells(table, i) {
414
- return (key) => table.has(key) ? plainCell(table.value(key, i)) : null;
1166
+ return (key) => {
1167
+ const v = table.has(key) ? plainCell(table.value(key, i)) : null;
1168
+ return COLOR_PARAMS.has(key) && typeof v === "string" && NUMERIC_COLOR.test(v) ? null : v;
1169
+ };
415
1170
  }
1171
+ const COLOR_PARAMS = /* @__PURE__ */ new Set(["ic", "bc", "lc", "c"]);
1172
+ const NUMERIC_COLOR = /^[\d.]+(?: [\d.]+)*$/;
416
1173
  function directedEdges(snapshot) {
417
1174
  const out = new Array(snapshot.edgeCount).fill(snapshot.directed);
418
1175
  const col = snapshot.directed ? snapshot.edges.byRole("directed") : null;
@@ -428,32 +1185,72 @@ function styleColumns(table, keys) {
428
1185
  }
429
1186
  function pajekStyles(snapshot, context) {
430
1187
  const notes = new StyleNotes();
1188
+ const { block, draw, voided } = keptOf(context.kept);
1189
+ const labels = drawsLineLabels(draw);
1190
+ const place = places(snapshot);
1191
+ const window = draw ?? { width: PAJEK_POINTS_PER_UNIT, height: PAJEK_POINTS_PER_UNIT };
1192
+ const loops = /* @__PURE__ */ new Map();
1193
+ const runOf = (e) => {
1194
+ const [s, t] = [place(snapshot.edgeSource(e)), place(snapshot.edgeTarget(e))];
1195
+ return s === null || t === null ? null : [(t[0] - s[0]) * window.width, (t[1] - s[1]) * window.height];
1196
+ };
431
1197
  const read = (target) => {
432
1198
  const table = target === "node" ? snapshot.nodes : snapshot.edges;
433
1199
  const n = target === "node" ? snapshot.nodeCount : snapshot.edgeCount;
434
1200
  const out = valueColumns(n);
1201
+ const carry = carriedParams(target === "node" ? CARRIED.node : CARRIED_LINE, target === "node");
435
1202
  for (let i = 0; i < n; i++) {
436
1203
  context.budget.spend(target, 1);
437
1204
  const at = (property) => ({ notes, target, property, element: i, budget: context.budget });
438
- (target === "node" ? readVertex : readLine)(
439
- cells(table, i),
440
- (property, value) => {
441
- out.put(i, property, value);
442
- },
443
- at
444
- );
1205
+ const put = (property, value) => {
1206
+ out.put(i, property, value);
1207
+ };
1208
+ const own = cells(table, i);
1209
+ const get = target === "node" && voided.has(i) ? voidedParams(own, keywords[i - 1] ?? null) : carry(own);
1210
+ if (target === "node") {
1211
+ readVertex(get, put, at, place(i));
1212
+ keywords[i] = get(SHAPE_COLUMN);
1213
+ } else {
1214
+ readEdge(i, get, put, at);
1215
+ }
445
1216
  }
446
1217
  return out.values;
447
1218
  };
1219
+ const readEdge = (i, get, put, at) => {
1220
+ const run = runOf(i);
1221
+ const loop = run !== null && block === null && snapshot.edgeSource(i) === snapshot.edgeTarget(i) ? (controls) => {
1222
+ loops.set(i, controls);
1223
+ } : null;
1224
+ readLine(get, put, at, directed[i], labels, run, loop);
1225
+ if (directed[i] && loop === null && run !== null) {
1226
+ readArcEnd(get, put, run, targetSize(snapshot.edgeTarget(i)));
1227
+ }
1228
+ readLineValue(lineValue(i), get, put, directed[i]);
1229
+ readHooks(get, put, keywords[snapshot.edgeSource(i)], keywords[snapshot.edgeTarget(i)]);
1230
+ };
1231
+ const directed = directedEdges(snapshot);
1232
+ const keywords = [];
1233
+ const weights = explicitWeights(snapshot);
1234
+ const lineValue = (e) => weights.isExplicit(e) ? weights.value(e) : numberOrNull(cells(snapshot.edges, e)(VALUE_COLUMN));
448
1235
  const node = read("node");
1236
+ const targetSize = (v) => {
1237
+ const size = (property) => {
1238
+ const s = node[property]?.[v];
1239
+ return typeof s === "number" && s > 0 ? s : PAJEK_VERTEX_SIZE;
1240
+ };
1241
+ return [size("width"), size("height")];
1242
+ };
449
1243
  const edge = read("edge");
450
- const block = typeof context.kept === "string" ? context.kept : null;
1244
+ if (draw !== null) {
1245
+ drawVertices(draw, snapshot, node);
1246
+ drawLines(draw, snapshot, node, edge);
1247
+ }
1248
+ layLoops(snapshot, loops, node, edge);
451
1249
  if (block !== null) {
452
- exactFromBlock(snapshot, block, { node, edge });
1250
+ exactFromBlock(snapshot, block, { node, edge }, labels);
453
1251
  }
454
1252
  const rules = [];
455
1253
  const columns = /* @__PURE__ */ new Map();
456
- const directed = directedEdges(snapshot);
457
1254
  if (directed.some(Boolean)) {
458
1255
  columns.set(
459
1256
  DIRECTED_KEY,
@@ -465,14 +1262,14 @@ function pajekStyles(snapshot, context) {
465
1262
  role: "group",
466
1263
  origin: "tool",
467
1264
  where: { has: { style: DIRECTED_KEY } },
468
- set: { targetArrow: "triangle" }
1265
+ set: { targetArrow: "triangle", color: ARC_DEFAULTS.color, width: ARC_DEFAULTS.width }
469
1266
  });
470
1267
  }
471
1268
  return {
472
1269
  canonical: true,
473
1270
  dialect: "dvips",
474
1271
  tool: "pajek",
475
- units: "relative",
1272
+ units: "px",
476
1273
  node: { values: node },
477
1274
  edge: { values: edge, rules, columns },
478
1275
  notes: notes.list(),
@@ -483,6 +1280,39 @@ function pajekStyles(snapshot, context) {
483
1280
  }
484
1281
  };
485
1282
  }
1283
+ function places(snapshot) {
1284
+ const col = snapshot.nodes.byRole("position");
1285
+ return (i) => {
1286
+ const v = col === null || col === void 0 ? null : col.value(i);
1287
+ if (v === null || typeof v !== "object" || !("length" in v)) {
1288
+ return null;
1289
+ }
1290
+ const [x, y] = v;
1291
+ return typeof x === "number" && typeof y === "number" ? [x, y] : null;
1292
+ };
1293
+ }
1294
+ function keptOf(kept) {
1295
+ if (typeof kept === "string") {
1296
+ return { block: kept, draw: null, voided: /* @__PURE__ */ new Set() };
1297
+ }
1298
+ if (typeof kept === "object" && kept !== null) {
1299
+ const { block, pajekDraw, voided } = kept;
1300
+ return {
1301
+ block: typeof block === "string" ? block : null,
1302
+ draw: pajekDraw ?? null,
1303
+ voided: new Set(voided ?? [])
1304
+ };
1305
+ }
1306
+ return { block: null, draw: null, voided: /* @__PURE__ */ new Set() };
1307
+ }
1308
+ function voidedParams(own, before) {
1309
+ return (key) => {
1310
+ if (key === LABEL_COLUMN) {
1311
+ return own(key);
1312
+ }
1313
+ return key === SHAPE_COLUMN ? before : null;
1314
+ };
1315
+ }
486
1316
  const SHAPES = /* @__PURE__ */ new Map([
487
1317
  ["ellipse", "ellipse"],
488
1318
  ["rectangle", "box"],
@@ -523,9 +1353,37 @@ function shapeKeyword(get, approximate) {
523
1353
  if (keyword !== void 0) {
524
1354
  return keyword;
525
1355
  }
1356
+ if (shape === "polygon" && diamondQ(get) !== null) {
1357
+ return "diamond";
1358
+ }
526
1359
  approximate("shape", shape);
1360
+ const points = get("shapePoints");
1361
+ if (shape === "polygon" && points !== null) {
1362
+ approximate("shapePoints", points);
1363
+ }
527
1364
  return NEAREST_SHAPES.get(shape) ?? "ellipse";
528
1365
  }
1366
+ function diamondQ(get) {
1367
+ const points = get("shapePoints");
1368
+ const corners = typeof points === "string" ? points.trim().split(/\s+/).map((p) => p.split(",").map(Number)) : [];
1369
+ if (corners.length !== 6) {
1370
+ return null;
1371
+ }
1372
+ const q = corners[2][0];
1373
+ const want = [
1374
+ [-1, 0],
1375
+ [-q, 1],
1376
+ [q, 1],
1377
+ [1, 0],
1378
+ [q, -1],
1379
+ [-q, -1]
1380
+ ];
1381
+ return want.every(([x, y], k) => corners[k][0] === x && corners[k][1] === y) ? q : null;
1382
+ }
1383
+ function pajekDefault(target, property) {
1384
+ const values = toolDefaults("pajek")?.[target];
1385
+ return values?.[property]?.value;
1386
+ }
529
1387
  function vertexParams(get, approximate) {
530
1388
  const out = /* @__PURE__ */ new Map();
531
1389
  opaque(get, ["fillOpacity", "opacity"], approximate);
@@ -533,54 +1391,117 @@ function vertexParams(get, approximate) {
533
1391
  if (keyword !== "ellipse") {
534
1392
  out.set(SHAPE_COLUMN, keyword);
535
1393
  }
1394
+ const q = diamondQ(get);
1395
+ if (q !== null && q !== PAJEK_DIAMOND_Q) {
1396
+ out.set("q", q);
1397
+ }
1398
+ vertexColorParams(get, out);
1399
+ vertexSizeParams(get, out);
1400
+ const bw = get("borderWidth");
1401
+ if (typeof bw === "number" && bw !== pajekDefault("node", "borderWidth")) {
1402
+ out.set("bw", bw);
1403
+ }
1404
+ fontParam(get, out, pajekDefault("node", "labelFont"));
1405
+ labelPositionParams(get, out, approximate);
1406
+ return out;
1407
+ }
1408
+ function vertexColorParams(get, out) {
536
1409
  const colors = [
537
1410
  ["fill", "ic"],
538
1411
  ["borderColor", "bc"],
539
1412
  ["labelColor", "lc"]
540
1413
  ];
541
- const numbers = [
542
- ["width", "x_fact"],
543
- ["height", "y_fact"],
544
- ["labelSize", "fos"]
545
- ];
546
1414
  for (const [property, key] of colors) {
547
1415
  const v = get(property);
548
- if (typeof v === "string" && (property === "fill" || v !== "#000000")) {
1416
+ if (typeof v === "string" && v !== pajekDefault("node", property)) {
549
1417
  out.set(key, pajekColorText(v));
550
1418
  }
551
1419
  }
552
- for (const [property, key] of numbers) {
1420
+ }
1421
+ function vertexSizeParams(get, out) {
1422
+ const numbers = [
1423
+ ["width", "x_fact", PAJEK_VERTEX_SIZE],
1424
+ ["height", "y_fact", PAJEK_VERTEX_SIZE],
1425
+ ["labelSize", "fos", 1]
1426
+ ];
1427
+ const figure = PAJEK_FIGURES.get(String(get("shape")));
1428
+ for (const [property, key, per] of numbers) {
553
1429
  const v = get(property);
554
- if (typeof v === "number") {
555
- out.set(key, v);
1430
+ let over = 1;
1431
+ if (figure !== void 0 && key !== "fos") {
1432
+ over = figure[key === "x_fact" ? 0 : 1];
1433
+ }
1434
+ if (typeof v === "number" && (over !== 1 || v !== pajekDefault("node", property))) {
1435
+ out.set(key, Number((v / (per * over)).toPrecision(15)));
556
1436
  }
557
1437
  }
558
- const bw = get("borderWidth");
559
- if (typeof bw === "number") {
560
- const written = Number((bw * VERTEX_SIZE).toPrecision(15));
561
- if (written === 1) {
562
- out.delete("bw");
563
- } else {
564
- out.set("bw", written);
1438
+ }
1439
+ function fontParam(get, out, skip) {
1440
+ const font = get("labelFont");
1441
+ const name = typeof font === "string" && font !== "" ? graphvizFontName(font, false, false) : null;
1442
+ if (name !== null && name !== skip) {
1443
+ out.set("font", name);
1444
+ }
1445
+ }
1446
+ function labelPositionParams(get, out, approximate) {
1447
+ const position = get("labelPosition");
1448
+ if (typeof position !== "string") {
1449
+ return;
1450
+ }
1451
+ if (position === "center") {
1452
+ const polar = polarOf(get);
1453
+ if (polar === null) {
1454
+ out.set("lr", 0);
1455
+ } else if (polar[0] !== PAJEK_LABEL_RADIUS || polar[1] !== PAJEK_LABEL_ANGLE) {
1456
+ out.set("lr", polar[0]);
1457
+ out.set("lphi", polar[1]);
565
1458
  }
1459
+ return;
1460
+ }
1461
+ const nearest = NEAREST_SIDES.get(position);
1462
+ if (nearest !== void 0) {
1463
+ approximate("labelPosition", position);
1464
+ }
1465
+ const angle = SIDE_ANGLES.get(nearest ?? position);
1466
+ if (angle !== void 0 && angle !== PAJEK_LABEL_ANGLE) {
1467
+ out.set("lphi", angle);
566
1468
  }
567
- return out;
1469
+ }
1470
+ function polarOf(get) {
1471
+ const [x, y, shift] = [get("labelOffsetX"), get("labelOffsetY"), get("labelShiftX")];
1472
+ if (typeof x !== "number" || typeof y !== "number" || shift !== 0.5) {
1473
+ return null;
1474
+ }
1475
+ const size = get("labelSize");
1476
+ const up = y + PAJEK_BASELINE_TO_MIDDLE * (typeof size === "number" ? size : PAJEK_LABEL_SIZE);
1477
+ const round = (v) => Number(v.toFixed(6)) + 0;
1478
+ const lr = round(Math.hypot(x, up));
1479
+ return lr === 0 ? null : [lr, round((Math.atan2(-up, x) * 180 / Math.PI % 360 + 360) % 360)];
1480
+ }
1481
+ function lineDefaults(directed) {
1482
+ return directed ? ARC_DEFAULTS : { color: pajekDefault("edge", "color"), width: pajekDefault("edge", "width") };
568
1483
  }
569
1484
  function lineParams(get, directed, approximate) {
570
1485
  const out = /* @__PURE__ */ new Map();
571
1486
  opaque(get, ["opacity"], approximate);
1487
+ const defaults = lineDefaults(directed);
572
1488
  const color = get("color");
573
- if (typeof color === "string" && color !== "#000000") {
1489
+ if (typeof color === "string" && color !== defaults.color) {
574
1490
  out.set("c", pajekColorText(color));
575
1491
  }
576
1492
  const width = get("width");
577
- if (typeof width === "number") {
578
- out.set("w", width);
1493
+ if (typeof width === "number" && width !== defaults.width) {
1494
+ out.set("w", directed ? width : Number((width / EDGE_WIDTH_PER_W).toPrecision(15)));
579
1495
  }
580
1496
  const lineStyle = get("lineStyle");
581
- if (typeof lineStyle === "string" && lineStyle !== "solid" && pajekDots(lineStyle, approximate)) {
1497
+ if (typeof lineStyle === "string" && lineStyle !== "solid" && pajekDots(lineStyle, out, directed, approximate)) {
582
1498
  out.set("p", "Dots");
583
1499
  }
1500
+ const position = get("arrowPosition");
1501
+ if (typeof position === "number" && position > 0) {
1502
+ out.set("ap", position);
1503
+ }
1504
+ lineLabelParams(get, out, approximate);
584
1505
  const target = get("targetArrow");
585
1506
  if (target !== null && target !== (directed ? "triangle" : "none")) {
586
1507
  approximate("targetArrow", target);
@@ -591,47 +1512,50 @@ function lineParams(get, directed, approximate) {
591
1512
  }
592
1513
  return out;
593
1514
  }
594
- function pajekDots(lineStyle, approximate) {
595
- if (lineStyle === "dotted") {
596
- return true;
1515
+ function lineLabelParams(get, out, approximate) {
1516
+ const label = get("label");
1517
+ if (typeof label === "string" && label !== "") {
1518
+ const text = pajekLabelText(label);
1519
+ if (text !== label) {
1520
+ approximate("label", label);
1521
+ }
1522
+ out.set("l", text);
597
1523
  }
598
- approximate("lineStyle", lineStyle);
599
- return lineStyle === "dashed" || lineStyle === "dash-dot" || lineStyle === "long-dash";
600
- }
601
- function getter(picture, target) {
602
- const columns = /* @__PURE__ */ new Map();
603
- for (const p of PAJEK_STYLE_CAPABILITIES[target]) {
604
- columns.set(p, picture(target, p));
1524
+ const labelColor = get("labelColor");
1525
+ if (typeof labelColor === "string") {
1526
+ out.set("lc", pajekColorText(labelColor));
1527
+ }
1528
+ const labelSize = get("labelSize");
1529
+ if (typeof labelSize === "number") {
1530
+ out.set("fos", labelSize);
605
1531
  }
606
- return (i) => (property) => columns.get(property)?.[i] ?? null;
1532
+ fontParam(get, out);
607
1533
  }
608
- function exactFromBlock(snapshot, text, read) {
609
- const parsed = parseStyleBlock(text, styleFingerprint(snapshot));
610
- const ex = parsed.ok ? blockStyles(parsed.block, snapshot, "pajek") : null;
611
- if (ex === null) {
612
- return;
1534
+ function pajekDots(lineStyle, params, directed, approximate) {
1535
+ if (lineStyle === pajekDash((key) => params.get(key) ?? null, directed)) {
1536
+ return true;
613
1537
  }
1538
+ approximate("lineStyle", lineStyle);
1539
+ return ["dashed", "dotted", "dash-dot", "long-dash"].includes(lineStyle);
1540
+ }
1541
+ function exactFromBlock(snapshot, text, read, labels) {
614
1542
  const notes = new StyleNotes();
615
1543
  const directed = directedEdges(snapshot);
616
- for (const target of ["node", "edge"]) {
617
- const n = target === "node" ? snapshot.nodeCount : snapshot.edgeCount;
618
- const get = getter((t, p) => resolveStyles(ex, t, p, snapshot), target);
619
- const values = read[target];
620
- for (let i = 0; i < n; i++) {
621
- const want = get(i);
622
- const back = writtenAndReadBack(target, want, directed[i], notes);
623
- for (const property of READ[target]) {
624
- const native = values[property]?.[i] ?? null;
625
- const w = want(property);
626
- if (w !== null && native !== w && native === (back.get(property) ?? null)) {
627
- values[property] ??= new Array(n).fill(null);
628
- values[property][i] = w;
629
- }
630
- }
631
- }
632
- }
1544
+ takeFromBlock(snapshot, text, "pajek", (target) => ({
1545
+ values: read[target],
1546
+ properties: READ[target],
1547
+ writes: PAJEK_STYLE_CAPABILITIES[target],
1548
+ readBack: (i, want) => {
1549
+ const back = writtenAndReadBack(target, want, directed[i], notes, labels);
1550
+ return (property) => back.get(property) ?? null;
1551
+ },
1552
+ // a label the block places by a side clears the offsets its `lphi` reads back as
1553
+ take: (property, wanted) => wanted !== null || LABEL_PLACE.has(property) || OUTLINE.has(property)
1554
+ }));
633
1555
  }
634
- function writtenAndReadBack(target, want, directed, notes) {
1556
+ const OUTLINE = /* @__PURE__ */ new Set(["shapePoints", "shapePointsStretch"]);
1557
+ const LABEL_PLACE = /* @__PURE__ */ new Set(["labelOffsetX", "labelOffsetY", "labelShiftX"]);
1558
+ function writtenAndReadBack(target, want, directed, notes, labels) {
635
1559
  const ignore = () => void 0;
636
1560
  const params = target === "node" ? vertexParams(want, ignore) : lineParams(want, directed, ignore);
637
1561
  const back = /* @__PURE__ */ new Map();
@@ -639,15 +1563,26 @@ function writtenAndReadBack(target, want, directed, notes) {
639
1563
  if (typeof label === "string") {
640
1564
  params.set(LABEL_COLUMN, pajekLabelText(label));
641
1565
  }
642
- (target === "node" ? readVertex : readLine)(
643
- (key) => params.get(key) ?? null,
644
- (property, value) => {
645
- if (value !== null) {
646
- back.set(property, value);
647
- }
648
- },
649
- (property) => ({ notes, target, property })
650
- );
1566
+ if (target === "node" && [...params.keys()].every((key) => key === LABEL_COLUMN)) {
1567
+ params.set(SHAPE_COLUMN, "ellipse");
1568
+ }
1569
+ for (const key of target === "edge" ? CARRIED.edge : []) {
1570
+ if (!params.has(key)) {
1571
+ params.set(key, lineRestated(key, directed));
1572
+ }
1573
+ }
1574
+ const get = (key) => params.get(key) ?? null;
1575
+ const put = (property, value) => {
1576
+ if (value !== null) {
1577
+ back.set(property, value);
1578
+ }
1579
+ };
1580
+ const at = (property) => ({ notes, target, property });
1581
+ if (target === "node") {
1582
+ readVertex(get, put, at);
1583
+ } else {
1584
+ readLine(get, put, at, directed, labels);
1585
+ }
651
1586
  return back;
652
1587
  }
653
1588
  function pajekStyledExport(snapshot, input) {
@@ -662,14 +1597,15 @@ function pajekStyledExport(snapshot, input) {
662
1597
  const approximate = (property, value) => {
663
1598
  approximated.add(target, property, value);
664
1599
  };
665
- const get = getter((t, p) => input.picture(t, p), target);
1600
+ const get = elementValues((t, p) => input.picture(t, p), target, PAJEK_STYLE_CAPABILITIES[target]);
666
1601
  const n = target === "node" ? snapshot.nodeCount : snapshot.edgeCount;
667
1602
  const params = (i) => target === "node" ? vertexParams(get(i), approximate) : lineParams(get(i), directed[i], approximate);
668
- replaceParamColumns(
669
- table,
670
- target === "node" ? [SHAPE_COLUMN, ...NODE_KEYS] : EDGE_KEYS,
671
- paramColumns(n, params)
672
- );
1603
+ const columns = paramColumns(n, params);
1604
+ if (target === "edge") {
1605
+ keepLineLabels(snapshot, columns);
1606
+ }
1607
+ restateCarried(target, columns, directed);
1608
+ replaceParamColumns(table, target === "node" ? [SHAPE_COLUMN, ...NODE_KEYS] : EDGE_KEYS, columns);
673
1609
  }
674
1610
  out.nodes.set(
675
1611
  LABEL_COLUMN,
@@ -684,6 +1620,23 @@ function pajekStyledExport(snapshot, input) {
684
1620
  notes.push(...styleBlockLosses(block, input.rules.styles.rules.length, "size"));
685
1621
  return { snapshot: out, comment: PAJEK_STYLE_COMMENT + block, notes };
686
1622
  }
1623
+ function keepLineLabels(snapshot, columns) {
1624
+ if (!snapshot.edges.has("l")) {
1625
+ return;
1626
+ }
1627
+ const own = (e) => plainCell(snapshot.edges.value("l", e));
1628
+ let col = columns.get("l");
1629
+ for (let e = 0; e < snapshot.edgeCount; e++) {
1630
+ const v = own(e);
1631
+ if (typeof v === "string" && v !== "" && (col?.[e] ?? null) === null) {
1632
+ col ??= new Array(snapshot.edgeCount).fill(null);
1633
+ col[e] = pajekLabelText(v);
1634
+ }
1635
+ }
1636
+ if (col !== void 0) {
1637
+ columns.set("l", col);
1638
+ }
1639
+ }
687
1640
  function drawnLabels(input, n, approximated) {
688
1641
  const drawn = input.picture("node", "label");
689
1642
  const out = new Array(n).fill("");
@@ -712,6 +1665,45 @@ function replaceParamColumns(table, keys, columns) {
712
1665
  table.set(key, col, { dtype: numeric ? "f64" : "string" });
713
1666
  }
714
1667
  }
1668
+ function restateCarried(target, columns, directed) {
1669
+ if (target === "node") {
1670
+ const all = [...columns.values()];
1671
+ if (all.length === 0) {
1672
+ return;
1673
+ }
1674
+ const n = all[0].length;
1675
+ const shape = columns.get(SHAPE_COLUMN) ?? new Array(n).fill(null);
1676
+ for (let i = 0; i < n; i++) {
1677
+ if (all.every((col) => col[i] === null)) {
1678
+ shape[i] = "ellipse";
1679
+ }
1680
+ }
1681
+ columns.set(SHAPE_COLUMN, shape);
1682
+ return;
1683
+ }
1684
+ for (const key of CARRIED.edge) {
1685
+ const col = columns.get(key);
1686
+ if (col === void 0) {
1687
+ continue;
1688
+ }
1689
+ for (let i = 0; i < col.length; i++) {
1690
+ col[i] ??= lineRestated(key, directed[i]);
1691
+ }
1692
+ }
1693
+ }
1694
+ function lineRestated(key, directed) {
1695
+ const defaults = lineDefaults(directed);
1696
+ switch (key) {
1697
+ case "c":
1698
+ return pajekColorText(String(defaults.color));
1699
+ case "w":
1700
+ return directed ? Number(defaults.width) : Number(defaults.width) / EDGE_WIDTH_PER_W;
1701
+ case "p":
1702
+ return "Solid";
1703
+ default:
1704
+ return 0;
1705
+ }
1706
+ }
715
1707
  function paramColumns(n, params) {
716
1708
  const columns = /* @__PURE__ */ new Map();
717
1709
  for (let i = 0; i < n; i++) {
@@ -812,58 +1804,58 @@ const CAPABILITIES = capabilities({
812
1804
  });
813
1805
  function plan(table, domain, notes) {
814
1806
  const planned = [];
815
- for (const column of table) {
816
- const slot = columnSlot(column, domain, notes);
1807
+ for (const column2 of table) {
1808
+ const slot = columnSlot(column2, domain, notes);
817
1809
  if (slot !== null) {
818
- planned.push({ column, slot });
1810
+ planned.push({ column: column2, slot });
819
1811
  }
820
1812
  }
821
1813
  return planned;
822
1814
  }
823
- function columnNote(notes, code, message, column) {
824
- notes?.push(note(code, message, column.meta.name, column.length - column.nullCount));
1815
+ function columnNote(notes, code, message, column2) {
1816
+ notes?.push(note(code, message, column2.meta.name, column2.length - column2.nullCount));
825
1817
  }
826
- function columnSlot(column, domain, notes) {
827
- const { role, name } = column.meta;
1818
+ function columnSlot(column2, domain, notes) {
1819
+ const { role, name } = column2.meta;
828
1820
  if (role === "label" && domain === "node") {
829
- return labelSlot(column, notes);
1821
+ return labelSlot(column2, notes);
830
1822
  }
831
1823
  if (role === "position") {
832
- return positionSlot(column, domain, notes);
1824
+ return positionSlot(column2, domain, notes);
833
1825
  }
834
1826
  if (role === "spells") {
835
- return spellsSlot(column, domain, notes);
1827
+ return spellsSlot(column2, domain, notes);
836
1828
  }
837
1829
  if (role !== null && DROPPED_TEMPORAL_ROLES.has(role)) {
838
1830
  columnNote(
839
1831
  notes,
840
1832
  PAJEK_LOSS.TEMPORAL_DROPPED,
841
1833
  `${domain} column "${name}" (${role}) cannot be written; Pajek intervals come from the spells role`,
842
- column
1834
+ column2
843
1835
  );
844
1836
  return null;
845
1837
  }
846
- if (writtenElsewhere(column, domain)) {
1838
+ if (writtenElsewhere(column2, domain)) {
847
1839
  return null;
848
1840
  }
849
- return namedSlot(column, domain, notes);
1841
+ return namedSlot(column2, domain, notes);
850
1842
  }
851
- function labelSlot(column, notes) {
852
- const { name, dtype } = column.meta;
1843
+ function labelSlot(column2, notes) {
1844
+ const { name, dtype } = column2.meta;
853
1845
  if (dtype !== "string" && dtype !== "dict") {
854
1846
  columnNote(
855
1847
  notes,
856
1848
  PAJEK_LOSS.LABEL_AS_TEXT,
857
1849
  `node column "${name}" (label) is ${dtype}; labels are text and re-import as string`,
858
- column
1850
+ column2
859
1851
  );
860
1852
  }
861
1853
  return "label";
862
1854
  }
863
- function positionSlot(column, domain, notes) {
864
- const { name, components } = column.meta;
1855
+ function positionSlot(column2, domain, notes) {
1856
+ const { name, components } = column2.meta;
865
1857
  if (domain === "edge") {
866
- columnNote(notes, LOSS.POSITIONS, `edge column "${name}" (position) cannot be written`, column);
1858
+ columnNote(notes, LOSS.POSITIONS, `edge column "${name}" (position) cannot be written`, column2);
867
1859
  return null;
868
1860
  }
869
1861
  if (components === 2 || components === 3) {
@@ -873,12 +1865,12 @@ function positionSlot(column, domain, notes) {
873
1865
  notes,
874
1866
  PAJEK_LOSS.POSITION_STRIDE,
875
1867
  `node column "${name}" (position) has ${components} components; Pajek coordinates are x y [z]`,
876
- column
1868
+ column2
877
1869
  );
878
1870
  return null;
879
1871
  }
880
- function spellsSlot(column, domain, notes) {
881
- const { name, dtype, itemDtype } = column.meta;
1872
+ function spellsSlot(column2, domain, notes) {
1873
+ const { name, dtype, itemDtype } = column2.meta;
882
1874
  if (dtype === "list" && (itemDtype === "f64" || itemDtype === "i32" || itemDtype === "f32")) {
883
1875
  return "spells";
884
1876
  }
@@ -886,22 +1878,22 @@ function spellsSlot(column, domain, notes) {
886
1878
  notes,
887
1879
  LOSS.SPELLS,
888
1880
  `${domain} column "${name}" (spells) is not a list of number pairs; it cannot be written`,
889
- column
1881
+ column2
890
1882
  );
891
1883
  return null;
892
1884
  }
893
- function writtenElsewhere(column, domain) {
894
- const { role, dtype } = column.meta;
1885
+ function writtenElsewhere(column2, domain) {
1886
+ const { role, dtype } = column2.meta;
895
1887
  if (role !== null && (STRUCTURAL_ROLES.has(role) || CHECKED_ROLES.has(role))) {
896
1888
  return true;
897
1889
  }
898
1890
  return domain === "edge" && role === "id" || dtype === "list" || dtype === "json";
899
1891
  }
900
- function namedSlot(column, domain, notes) {
901
- const { name, dtype } = column.meta;
1892
+ function namedSlot(column2, domain, notes) {
1893
+ const { name, dtype } = column2.meta;
902
1894
  const text = dtype === "dict" || dtype === "string";
903
1895
  if (text && domain === "node" && name === SHAPE_COLUMN) {
904
- return shapeSlot(column, notes);
1896
+ return shapeSlot(column2, notes);
905
1897
  }
906
1898
  if (text && domain === "edge" && name === RELATION_COLUMN) {
907
1899
  return "relation";
@@ -911,22 +1903,22 @@ function namedSlot(column, domain, notes) {
911
1903
  notes,
912
1904
  PAJEK_LOSS.KEY_DROPPED,
913
1905
  `${domain} column "${name}" cannot be a Pajek parameter key; it is not written`,
914
- column
1906
+ column2
915
1907
  );
916
1908
  return null;
917
1909
  }
918
1910
  return "param";
919
1911
  }
920
- function shapeSlot(column, notes) {
921
- if (allShapeKeywords(column)) {
1912
+ function shapeSlot(column2, notes) {
1913
+ if (allShapeKeywords(column2)) {
922
1914
  return "shape";
923
1915
  }
924
- if (column.meta.dtype === "dict") {
1916
+ if (column2.meta.dtype === "dict") {
925
1917
  columnNote(
926
1918
  notes,
927
1919
  PAJEK_LOSS.SHAPE_AS_PARAMETER,
928
- `node column "${column.meta.name}" holds values outside the Pajek shape keywords; it is written as a parameter and reads back as string`,
929
- column
1920
+ `node column "${column2.meta.name}" holds values outside the Pajek shape keywords; it is written as a parameter and reads back as string`,
1921
+ column2
930
1922
  );
931
1923
  }
932
1924
  return "param";
@@ -934,9 +1926,9 @@ function shapeSlot(column, notes) {
934
1926
  function labelNotes(snapshot, nodePlan, notes) {
935
1927
  let labels = null;
936
1928
  let carried = 0;
937
- for (const { column, slot } of nodePlan) {
1929
+ for (const { column: column2, slot } of nodePlan) {
938
1930
  if (slot === "label") {
939
- labels = column;
1931
+ labels = column2;
940
1932
  } else if (slot !== "skip" && slot !== "relation") {
941
1933
  carried++;
942
1934
  }
@@ -983,16 +1975,16 @@ function unlabeled(nodeCount, labels) {
983
1975
  }
984
1976
  return count;
985
1977
  }
986
- function allShapeKeywords(column) {
987
- for (let r = 0; r < column.length; r++) {
988
- if (column.isSet(r) && !SHAPES$1.has(column.value(r))) {
1978
+ function allShapeKeywords(column2) {
1979
+ for (let r = 0; r < column2.length; r++) {
1980
+ if (column2.isSet(r) && !SHAPES$1.has(column2.value(r))) {
989
1981
  return false;
990
1982
  }
991
1983
  }
992
1984
  return true;
993
1985
  }
994
- function note(code, message, column = null, count = null) {
995
- return Object.freeze({ code, message, column, count });
1986
+ function note(code, message, column2 = null, count = null) {
1987
+ return Object.freeze({ code, message, column: column2, count });
996
1988
  }
997
1989
  function numberText(value, dtype) {
998
1990
  switch (dtype) {
@@ -1010,53 +2002,53 @@ function numberText(value, dtype) {
1010
2002
  }
1011
2003
  }
1012
2004
  }
1013
- function cellText(column, row) {
1014
- switch (column.dtype) {
2005
+ function cellText(column2, row) {
2006
+ switch (column2.dtype) {
1015
2007
  case "f32":
1016
2008
  case "f64":
1017
2009
  case "i32":
1018
2010
  case "u32":
1019
2011
  case "u8": {
1020
- const value = column.value(row);
2012
+ const value = column2.value(row);
1021
2013
  if (typeof value === "number") {
1022
- return numberText(value, column.dtype);
2014
+ return numberText(value, column2.dtype);
1023
2015
  }
1024
2016
  const parts = [];
1025
2017
  const vector = value;
1026
2018
  for (let k = 0; k < vector.length; k++) {
1027
- parts.push(numberText(vector[k], column.dtype));
2019
+ parts.push(numberText(vector[k], column2.dtype));
1028
2020
  }
1029
2021
  return parts.join(" ");
1030
2022
  }
1031
2023
  case "bool":
1032
- return column.value(row) === true ? "true" : "false";
2024
+ return column2.value(row) === true ? "true" : "false";
1033
2025
  case "dict":
1034
2026
  case "string":
1035
- return column.value(row);
2027
+ return column2.value(row);
1036
2028
  case "list":
1037
2029
  case "json":
1038
- return JSON.stringify(column.value(row));
2030
+ return JSON.stringify(column2.value(row));
1039
2031
  default: {
1040
- const name = column.dtype;
2032
+ const name = column2.dtype;
1041
2033
  throw new Error(`unknown dtype ${name}`);
1042
2034
  }
1043
2035
  }
1044
2036
  }
1045
2037
  function checkCells(planned, domain, notes) {
1046
- for (const { column, slot } of planned) {
2038
+ for (const { column: column2, slot } of planned) {
1047
2039
  if (slot === "position" || slot === "spells") {
1048
2040
  continue;
1049
2041
  }
1050
- const { name } = column.meta;
2042
+ const { name } = column2.meta;
1051
2043
  let badText = 0;
1052
2044
  let nonFinite = 0;
1053
2045
  let typed = 0;
1054
- for (let r = 0; r < column.length; r++) {
1055
- if (!column.isSet(r)) {
2046
+ for (let r = 0; r < column2.length; r++) {
2047
+ if (!column2.isSet(r)) {
1056
2048
  continue;
1057
2049
  }
1058
- if (column.dtype === "f64" || column.dtype === "f32") {
1059
- const value = column.value(r);
2050
+ if (column2.dtype === "f64" || column2.dtype === "f32") {
2051
+ const value = column2.value(r);
1060
2052
  if (typeof value === "number") {
1061
2053
  if (!Number.isFinite(value)) {
1062
2054
  nonFinite++;
@@ -1064,8 +2056,8 @@ function checkCells(planned, domain, notes) {
1064
2056
  } else if (value !== void 0 && !Array.from(value).every((v) => Number.isFinite(v))) {
1065
2057
  nonFinite++;
1066
2058
  }
1067
- } else if (column.dtype === "string" || column.dtype === "dict") {
1068
- const text = column.value(r);
2059
+ } else if (column2.dtype === "string" || column2.dtype === "dict") {
2060
+ const text = column2.value(r);
1069
2061
  if (!isPajekLabel(text)) {
1070
2062
  badText++;
1071
2063
  } else if (slot === "param" && inferTextDtype(text) !== "string") {
@@ -1128,11 +2120,11 @@ function labelOf(labels, ids, i, needed) {
1128
2120
  }
1129
2121
  return null;
1130
2122
  }
1131
- function spellsText(column, row) {
1132
- if (column.dtype !== "list" || !column.isSet(row)) {
2123
+ function spellsText(column2, row) {
2124
+ if (column2.dtype !== "list" || !column2.isSet(row)) {
1133
2125
  return null;
1134
2126
  }
1135
- const items = column.sliceOf(row);
2127
+ const items = column2.sliceOf(row);
1136
2128
  if (items.length === 0) {
1137
2129
  return null;
1138
2130
  }
@@ -1143,29 +2135,29 @@ function spellsText(column, row) {
1143
2135
  }
1144
2136
  return formatIntervals(pairs);
1145
2137
  }
1146
- function coordinatesText(column, i, writeZ) {
1147
- if (!column.isSet(i)) {
2138
+ function coordinatesText(column2, i, writeZ) {
2139
+ if (!column2.isSet(i)) {
1148
2140
  return null;
1149
2141
  }
1150
- const dtype = column.dtype;
1151
- const vector = column.value(i);
2142
+ const dtype = column2.dtype;
2143
+ const vector = column2.value(i);
1152
2144
  const x = formatNumber(vector[0], dtype);
1153
2145
  const y = formatNumber(vector[1], dtype);
1154
- if (column.meta.components === 3 && writeZ) {
2146
+ if (column2.meta.components === 3 && writeZ) {
1155
2147
  return `${x} ${y} ${formatNumber(vector[2], dtype)}`;
1156
2148
  }
1157
2149
  return `${x} ${y}`;
1158
2150
  }
1159
- function needsZ(column) {
1160
- if (column.meta.components !== 3) {
2151
+ function needsZ(column2) {
2152
+ if (column2.meta.components !== 3) {
1161
2153
  return false;
1162
2154
  }
1163
- if (column.meta.extra.sourceDims !== 2) {
2155
+ if (column2.meta.extra.sourceDims !== 2) {
1164
2156
  return true;
1165
2157
  }
1166
- for (let i = 0; i < column.length; i++) {
1167
- if (column.isSet(i)) {
1168
- const vector = column.value(i);
2158
+ for (let i = 0; i < column2.length; i++) {
2159
+ if (column2.isSet(i)) {
2160
+ const vector = column2.value(i);
1169
2161
  if (vector[2] !== 0) {
1170
2162
  return true;
1171
2163
  }
@@ -1248,27 +2240,49 @@ function checkIdTexts(nodeCount, ids, mangle, notes) {
1248
2240
  }
1249
2241
  }
1250
2242
  function* writeVertices(snapshot, ids, nodePlan, mangle) {
1251
- let labels = null;
1252
- let position = null;
1253
- let shape = null;
1254
- let nodeSpells = null;
1255
- const nodeParams = [];
1256
- for (const { column, slot } of nodePlan) {
2243
+ const slots = vertexSlots(nodePlan);
2244
+ const writeZ = slots.position !== null && needsZ(slots.position);
2245
+ for (let i = 0; i < snapshot.nodeCount; i++) {
2246
+ const parts = vertexParts(slots, i, writeZ);
2247
+ if (mangle && ids.isChanged(i)) {
2248
+ parts.push(`${ORIGINAL_ID_KEY} ${quotePajekLabel(idText(ids.originalAt(i)))}`);
2249
+ }
2250
+ if (slots.spells !== null) {
2251
+ const spells = spellsText(slots.spells, i);
2252
+ if (spells !== null) {
2253
+ parts.push(spells);
2254
+ }
2255
+ }
2256
+ const label = labelOf(slots.labels, ids, i, parts.length > 0);
2257
+ let line = String(i + 1);
2258
+ if (label !== null) {
2259
+ line += ` ${quotePajekLabel(encodeCharacterReferences(label))}`;
2260
+ }
2261
+ if (parts.length > 0) {
2262
+ line += ` ${parts.join(" ")}`;
2263
+ }
2264
+ yield `${line}
2265
+ `;
2266
+ }
2267
+ }
2268
+ function vertexSlots(nodePlan) {
2269
+ const slots = { labels: null, position: null, shape: null, spells: null, params: [] };
2270
+ for (const { column: column2, slot } of nodePlan) {
1257
2271
  switch (slot) {
1258
2272
  case "label":
1259
- labels = column;
2273
+ slots.labels = column2;
1260
2274
  break;
1261
2275
  case "position":
1262
- position = column;
2276
+ slots.position = column2;
1263
2277
  break;
1264
2278
  case "shape":
1265
- shape = column;
2279
+ slots.shape = column2;
1266
2280
  break;
1267
2281
  case "spells":
1268
- nodeSpells = column;
2282
+ slots.spells = column2;
1269
2283
  break;
1270
2284
  case "param":
1271
- nodeParams.push(column);
2285
+ slots.params.push(column2);
1272
2286
  break;
1273
2287
  case "relation":
1274
2288
  case "skip":
@@ -1279,48 +2293,32 @@ function* writeVertices(snapshot, ids, nodePlan, mangle) {
1279
2293
  }
1280
2294
  }
1281
2295
  }
1282
- const writeZ = position !== null && needsZ(position);
1283
- for (let i = 0; i < snapshot.nodeCount; i++) {
1284
- const parts = [];
1285
- if (position !== null) {
1286
- const coordinates = coordinatesText(position, i, writeZ);
1287
- if (coordinates !== null) {
1288
- parts.push(coordinates);
1289
- }
1290
- }
1291
- if (shape?.isSet(i)) {
1292
- const keyword = cellText(shape, i);
1293
- if (SHAPES$1.has(keyword)) {
1294
- parts.push(keyword);
1295
- } else {
1296
- parts.push(`${SHAPE_COLUMN} ${quotePajekLabel(keyword)}`);
1297
- }
1298
- }
1299
- for (const column of nodeParams) {
1300
- if (column.isSet(i)) {
1301
- parts.push(`${column.meta.name} ${quotePajekLabel(cellText(column, i))}`);
1302
- }
1303
- }
1304
- if (mangle && ids.isChanged(i)) {
1305
- parts.push(`${ORIGINAL_ID_KEY} ${quotePajekLabel(idText(ids.originalAt(i)))}`);
1306
- }
1307
- if (nodeSpells !== null) {
1308
- const spells = spellsText(nodeSpells, i);
1309
- if (spells !== null) {
1310
- parts.push(spells);
1311
- }
1312
- }
1313
- const label = labelOf(labels, ids, i, parts.length > 0);
1314
- let line = String(i + 1);
1315
- if (label !== null) {
1316
- line += ` ${quotePajekLabel(encodeCharacterReferences(label))}`;
2296
+ return slots;
2297
+ }
2298
+ function vertexParts(slots, i, writeZ) {
2299
+ const { position, shape } = slots;
2300
+ const parts = [];
2301
+ const coordinates = position === null ? null : coordinatesText(position, i, writeZ);
2302
+ if (coordinates !== null) {
2303
+ parts.push(coordinates);
2304
+ }
2305
+ const placed = parts.length > 0;
2306
+ const shaped = shape?.isSet(i) === true;
2307
+ if (shaped) {
2308
+ const keyword = cellText(shape, i);
2309
+ parts.push(SHAPES$1.has(keyword) ? keyword : `${SHAPE_COLUMN} ${quotePajekLabel(keyword)}`);
2310
+ }
2311
+ const named = parts.length;
2312
+ for (const column2 of slots.params) {
2313
+ if (!column2.isSet(i)) {
2314
+ continue;
1317
2315
  }
1318
- if (parts.length > 0) {
1319
- line += ` ${parts.join(" ")}`;
2316
+ if (placed && !shaped && parts.length === named && VOIDING_KEYS.has(column2.meta.name)) {
2317
+ parts.push("ellipse");
1320
2318
  }
1321
- yield `${line}
1322
- `;
2319
+ parts.push(`${column2.meta.name} ${quotePajekLabel(cellText(column2, i))}`);
1323
2320
  }
2321
+ return parts;
1324
2322
  }
1325
2323
  function* writeLines(snapshot, edgePlan) {
1326
2324
  const folding = pairFolding(snapshot, { foldMutual: true });
@@ -1329,16 +2327,16 @@ function* writeLines(snapshot, edgePlan) {
1329
2327
  let relation = null;
1330
2328
  let edgeSpells = null;
1331
2329
  const edgeParams = [];
1332
- for (const { column, slot } of edgePlan) {
2330
+ for (const { column: column2, slot } of edgePlan) {
1333
2331
  switch (slot) {
1334
2332
  case "relation":
1335
- relation = column;
2333
+ relation = column2;
1336
2334
  break;
1337
2335
  case "spells":
1338
- edgeSpells = column;
2336
+ edgeSpells = column2;
1339
2337
  break;
1340
2338
  case "param":
1341
- edgeParams.push(column);
2339
+ edgeParams.push(column2);
1342
2340
  break;
1343
2341
  case "label":
1344
2342
  case "position":
@@ -1385,9 +2383,9 @@ function* writeLines(snapshot, edgePlan) {
1385
2383
  if (weight !== null) {
1386
2384
  line += ` ${weight}`;
1387
2385
  }
1388
- for (const column of edgeParams) {
1389
- if (column.isSet(e)) {
1390
- line += ` ${column.meta.name} ${quotePajekLabel(cellText(column, e))}`;
2386
+ for (const column2 of edgeParams) {
2387
+ if (column2.isSet(e)) {
2388
+ line += ` ${column2.meta.name} ${quotePajekLabel(cellText(column2, e))}`;
1391
2389
  }
1392
2390
  }
1393
2391
  if (edgeSpells !== null) {
@@ -1475,16 +2473,16 @@ function withOriginalIds(options) {
1475
2473
  }
1476
2474
  function ownedColumns(snapshot, planned) {
1477
2475
  const owned = /* @__PURE__ */ new Set();
1478
- const key = (column) => `${column.meta.domain}:${column.meta.name}`;
1479
- for (const { column, slot } of planned) {
1480
- const shapeParam = slot === "param" && column.meta.domain === "node" && column.meta.name === SHAPE_COLUMN;
2476
+ const key = (column2) => `${column2.meta.domain}:${column2.meta.name}`;
2477
+ for (const { column: column2, slot } of planned) {
2478
+ const shapeParam = slot === "param" && column2.meta.domain === "node" && column2.meta.name === SHAPE_COLUMN;
1481
2479
  if (slot === "shape" || slot === "relation" || shapeParam) {
1482
- owned.add(key(column));
2480
+ owned.add(key(column2));
1483
2481
  }
1484
2482
  }
1485
- for (const column of [...snapshot.nodes, ...snapshot.edges]) {
1486
- if (column.meta.role === "spells") {
1487
- owned.add(key(column));
2483
+ for (const column2 of [...snapshot.nodes, ...snapshot.edges]) {
2484
+ if (column2.meta.role === "spells") {
2485
+ owned.add(key(column2));
1488
2486
  }
1489
2487
  }
1490
2488
  return owned;
@@ -1527,13 +2525,13 @@ function checkPlain(snapshot, options) {
1527
2525
  const owned = ownedColumns(snapshot, [...nodePlan, ...edgePlan]);
1528
2526
  notes.push(...capabilityNotes(snapshot, resolved, owned));
1529
2527
  labelNotes(snapshot, nodePlan, notes);
1530
- for (const column of [...snapshot.edges].filter((c) => c.meta.role === "label")) {
2528
+ for (const column2 of [...snapshot.edges].filter((c) => c.meta.role === "label")) {
1531
2529
  notes.push(
1532
2530
  note(
1533
2531
  LOSS.ROLE,
1534
- `edge column "${column.meta.name}" (label) is written as a plain parameter; Pajek labels vertices only and the role is lost`,
1535
- column.meta.name,
1536
- column.length - column.nullCount
2532
+ `edge column "${column2.meta.name}" (label) is written as a plain parameter; Pajek labels vertices only and the role is lost`,
2533
+ column2.meta.name,
2534
+ column2.length - column2.nullCount
1537
2535
  )
1538
2536
  );
1539
2537
  }
@@ -1728,7 +2726,7 @@ function spellsDecl() {
1728
2726
  origin: { format: "pajek", id: "interval" }
1729
2727
  };
1730
2728
  }
1731
- function positionDecl(sourceDims) {
2729
+ function positionDecl(sourceDims, window) {
1732
2730
  return {
1733
2731
  name: POSITION_COLUMN,
1734
2732
  dtype: "f64",
@@ -1737,10 +2735,21 @@ function positionDecl(sourceDims) {
1737
2735
  role: "position",
1738
2736
  origin: { format: "pajek", id: "coordinates" },
1739
2737
  // Pajek draws y downward (USAir97.net has Deadhorse, Alaska at y 0.10 and Miami at 0.53),
1740
- // centers depth on 0.5, and NetworkX writes "0.0 0.0" for a node with no position
1741
- extra: { sourceDims, units: "file", yAxis: "down", zOrigin: 0.5, zeroUnplaced: true }
2738
+ // centers depth on 0.5, and NetworkX writes "0.0 0.0" for a node with no position; one unit
2739
+ // is the Draw window's width in points across and its height down (500 each by default,
2740
+ // PAJEK_POINTS_PER_UNIT): Pajek stretches 0..1 to the window one axis at a time
2741
+ extra: {
2742
+ sourceDims,
2743
+ units: "file",
2744
+ pxPerUnit: window.width,
2745
+ ...window.height === window.width ? {} : { pxPerUnitY: window.height },
2746
+ yAxis: "down",
2747
+ zOrigin: 0.5,
2748
+ zeroUnplaced: true
2749
+ }
1742
2750
  };
1743
2751
  }
2752
+ const DEFAULT_WINDOW = { width: PAJEK_POINTS_PER_UNIT, height: PAJEK_POINTS_PER_UNIT };
1744
2753
  class LineError extends Error {
1745
2754
  /**
1746
2755
  * Create a line error.
@@ -1767,8 +2776,11 @@ class PajekParser {
1767
2776
  * @param report - the report
1768
2777
  * @param options - the resolved common options
1769
2778
  * @param firstVertex - the firstVertex format option
2779
+ * @param window - the Draw window the coordinates are stretched to
1770
2780
  */
1771
- constructor(sink, report, options, firstVertex) {
2781
+ constructor(sink, report, options, firstVertex, window = DEFAULT_WINDOW) {
2782
+ this.keptBlock = null;
2783
+ this.voided = [];
1772
2784
  this.section = "none";
1773
2785
  this.kind = "directed";
1774
2786
  this.relation = null;
@@ -1805,6 +2817,7 @@ class PajekParser {
1805
2817
  this.ended = false;
1806
2818
  this.edgeParams = /* @__PURE__ */ new Map();
1807
2819
  this.styleBlockKept = false;
2820
+ this.window = window;
1808
2821
  this.sink = sink;
1809
2822
  this.report = report;
1810
2823
  this.options = options;
@@ -1824,7 +2837,8 @@ class PajekParser {
1824
2837
  const trimmed = text.trimStart();
1825
2838
  if (trimmed.startsWith(PAJEK_STYLE_COMMENT)) {
1826
2839
  this.styleBlockKept = true;
1827
- this.report.keepForStyles(trimmed.slice(PAJEK_STYLE_COMMENT.length));
2840
+ this.keptBlock = trimmed.slice(PAJEK_STYLE_COMMENT.length);
2841
+ this.report.keepForStyles(this.keptBlock);
1828
2842
  }
1829
2843
  }
1830
2844
  /**
@@ -2287,6 +3301,55 @@ class PajekParser {
2287
3301
  */
2288
3302
  vertexLine(text, line) {
2289
3303
  const tokens = this.tokens(text, "node", line);
3304
+ const { k, pos } = this.vertexNumber(tokens, line);
3305
+ let i = 1;
3306
+ let label = null;
3307
+ if (tokens.length > 1 && !startsWithCoordinates(text, tokens)) {
3308
+ label = this.labelOf(tokens[1], k, line);
3309
+ i = 2;
3310
+ }
3311
+ const { xyz, dims, next } = this.vertexCoordinates(tokens, i, k);
3312
+ i = next;
3313
+ this.checkCoordinates(text, tokens, i, dims === 2 && label !== null, k, line);
3314
+ let shape = null;
3315
+ if (i < tokens.length && isShapeKeyword(tokens[i])) {
3316
+ shape = tokens[i].toLowerCase();
3317
+ i++;
3318
+ }
3319
+ const extras = this.extras(tokens, i, "node", line);
3320
+ shape = extras.shape ?? shape;
3321
+ const restored = this.restoredId(extras);
3322
+ this.createNodes();
3323
+ const repeated = this.markVertexSeen(pos, k, line);
3324
+ const index = this.vertexIndex(pos, k, label, restored, repeated, line);
3325
+ if (shape === null && dims > 0 && extras.keys.length > 0 && VOIDING_KEYS.has(extras.keys[0])) {
3326
+ this.voided.push(index);
3327
+ }
3328
+ if (label !== null) {
3329
+ this.labelHandle = this.nodeHandle(this.labelHandle, LABEL_DECL, line);
3330
+ this.sink.setNodeValue(this.labelHandle, index, label);
3331
+ }
3332
+ if (dims > 0) {
3333
+ this.writePosition(index, dims, xyz, k, line);
3334
+ }
3335
+ if (shape !== null) {
3336
+ this.writeShape(index, shape, line);
3337
+ }
3338
+ for (let p = 0; p < extras.keys.length; p++) {
3339
+ this.writeParameter("node", extras.keys[p], index, extras.values[p]);
3340
+ }
3341
+ if (extras.spells !== null) {
3342
+ this.nodeSpellsHandle = this.nodeHandle(this.nodeSpellsHandle, spellsDecl(), line);
3343
+ this.sink.setNodeValue(this.nodeSpellsHandle, index, extras.spells);
3344
+ }
3345
+ }
3346
+ /**
3347
+ * A vertex line's number, checked: it starts the line and is in the declared range.
3348
+ * @param tokens - the line's tokens
3349
+ * @param line - the line number
3350
+ * @returns the vertex number and its position
3351
+ */
3352
+ vertexNumber(tokens, line) {
2290
3353
  if (!isVertexNumber(tokens[0])) {
2291
3354
  this.report.counts.skippedNodes++;
2292
3355
  throw new LineError(
@@ -2309,27 +3372,25 @@ class PajekParser {
2309
3372
  `vertex ${k} is outside ${this.base}..${this.base + this.vertexCount - 1}`
2310
3373
  );
2311
3374
  }
2312
- let i = 1;
2313
- let label = null;
2314
- if (tokens.length > 1 && !startsWithCoordinates(text, tokens)) {
2315
- label = this.labelOf(tokens[1], k, line);
2316
- i = 2;
2317
- }
2318
- let x = 0;
2319
- let y = 0;
2320
- let z = 0;
2321
- let dims = 0;
3375
+ return { k, pos };
3376
+ }
3377
+ /**
3378
+ * A vertex line's coordinates: two or three numbers, or none; a single one is an error.
3379
+ * @param tokens - the line's tokens
3380
+ * @param i - where the coordinates would start
3381
+ * @param k - the vertex number
3382
+ * @returns x, y and z (0 when absent), how many were read, and the index after them
3383
+ */
3384
+ vertexCoordinates(tokens, i, k) {
2322
3385
  if (i + 1 < tokens.length && isNumericText(tokens[i]) && isNumericText(tokens[i + 1])) {
2323
- x = Number(tokens[i]);
2324
- y = Number(tokens[i + 1]);
2325
- i += 2;
2326
- dims = 2;
2327
- if (i < tokens.length && isNumericText(tokens[i])) {
2328
- z = Number(tokens[i]);
2329
- i++;
2330
- dims = 3;
3386
+ const x = Number(tokens[i]);
3387
+ const y = Number(tokens[i + 1]);
3388
+ if (i + 2 < tokens.length && isNumericText(tokens[i + 2])) {
3389
+ return { xyz: [x, y, Number(tokens[i + 2])], dims: 3, next: i + 3 };
2331
3390
  }
2332
- } else if (i < tokens.length && isNumericText(tokens[i])) {
3391
+ return { xyz: [x, y, 0], dims: 2, next: i + 2 };
3392
+ }
3393
+ if (i < tokens.length && isNumericText(tokens[i])) {
2333
3394
  this.report.counts.skippedNodes++;
2334
3395
  throw new LineError(
2335
3396
  "parse-error",
@@ -2337,81 +3398,88 @@ class PajekParser {
2337
3398
  `vertex ${k}: a single coordinate "${tokens[i]}"; coordinates are x y [z]`
2338
3399
  );
2339
3400
  }
2340
- this.checkCoordinates(text, tokens, i, dims === 2 && label !== null, k, line);
2341
- let shape = null;
2342
- if (i < tokens.length && isShapeKeyword(tokens[i])) {
2343
- shape = tokens[i].toLowerCase();
2344
- i++;
2345
- }
2346
- const extras = this.extras(tokens, i, "node", line);
2347
- shape = extras.shape ?? shape;
2348
- const restored = this.restoredId(extras);
2349
- this.createNodes();
2350
- const repeated = this.seen[pos] !== 0;
2351
- if (repeated) {
3401
+ return { xyz: [0, 0, 0], dims: 0, next: i };
3402
+ }
3403
+ /**
3404
+ * Marks a vertex's position as having a line, warning when it already had one.
3405
+ * @param pos - the vertex's position
3406
+ * @param k - the vertex number
3407
+ * @param line - the line number
3408
+ * @returns whether the vertex already had a line
3409
+ */
3410
+ markVertexSeen(pos, k, line) {
3411
+ if (this.seen[pos] !== 0) {
2352
3412
  this.report.warning(
2353
3413
  "merged",
2354
3414
  PAJEK_ISSUE.DUPLICATE_NODE,
2355
3415
  `vertex ${k} has more than one line; the later values overwrite`,
2356
3416
  { line, element: String(k) }
2357
3417
  );
2358
- } else {
2359
- this.seen[pos] = 1;
2360
- this.seenCount++;
3418
+ return true;
2361
3419
  }
2362
- let index;
2363
- if (this.idOfPos !== null && !repeated && this.options.nodeIdFrom === "label") {
2364
- index = this.deferredNode(this.idOfPos, pos, k, label, line, "label");
2365
- } else if (this.idOfPos !== null && this.idOfPos[pos] === void 0) {
3420
+ this.seen[pos] = 1;
3421
+ this.seenCount++;
3422
+ return false;
3423
+ }
3424
+ /**
3425
+ * The node index a vertex line writes to, creating the node when its id is deferred to its line.
3426
+ * @param pos - the vertex's position
3427
+ * @param k - the vertex number
3428
+ * @param label - the line's label, or null
3429
+ * @param restored - the original id the line carries, or null
3430
+ * @param repeated - whether the vertex already had a line
3431
+ * @param line - the line number
3432
+ * @returns the node index
3433
+ */
3434
+ vertexIndex(pos, k, label, restored, repeated, line) {
3435
+ const { idOfPos } = this;
3436
+ if (idOfPos !== null && !repeated && this.options.nodeIdFrom === "label") {
3437
+ return this.deferredNode(idOfPos, pos, k, label, line, "label");
3438
+ }
3439
+ if (idOfPos !== null && idOfPos[pos] === void 0) {
2366
3440
  for (let p = this.filledBelow; p < pos; p++) {
2367
- if (this.idOfPos[p] === void 0) {
2368
- this.numberedNode(this.idOfPos, p);
3441
+ if (idOfPos[p] === void 0) {
3442
+ this.numberedNode(idOfPos, p);
2369
3443
  }
2370
3444
  }
2371
3445
  if (pos > this.filledBelow) {
2372
3446
  this.filledBelow = pos;
2373
3447
  }
2374
- index = this.deferredNode(this.idOfPos, pos, k, restored, line, "originalId");
2375
- } else {
2376
- index = this.indexOfPos[pos];
2377
- if (restored !== null && !repeated) {
2378
- this.report.warning(
2379
- "coercion",
2380
- PAJEK_ISSUE.ORIGINAL_ID_UNRESTORED,
2381
- `vertex ${k} carries ${ORIGINAL_ID_KEY} ${JSON.stringify(restored)} but a later vertex's line came first and created it under its number; the original id is not restored`,
2382
- { line, element: String(k) }
2383
- );
2384
- }
2385
- }
2386
- const { sink } = this;
2387
- if (label !== null) {
2388
- if (this.labelHandle === INVALID_INDEX) {
2389
- this.labelHandle = declareResolved(sink, "node", LABEL_DECL, this.report, { line }).handle;
2390
- }
2391
- sink.setNodeValue(this.labelHandle, index, label);
3448
+ return this.deferredNode(idOfPos, pos, k, restored, line, "originalId");
2392
3449
  }
2393
- if (dims > 0) {
2394
- this.writePosition(index, dims, [x, y, z], k, line);
2395
- }
2396
- if (shape !== null) {
2397
- if (this.shapeHandle === INVALID_INDEX && this.nodeParams.has(SHAPE_COLUMN)) {
2398
- this.writeParameter("node", SHAPE_COLUMN, index, shape);
2399
- } else {
2400
- if (this.shapeHandle === INVALID_INDEX) {
2401
- this.shapeHandle = declareResolved(sink, "node", SHAPE_DECL, this.report, { line }).handle;
2402
- }
2403
- sink.setNodeValue(this.shapeHandle, index, shape);
2404
- }
2405
- }
2406
- for (let p = 0; p < extras.keys.length; p++) {
2407
- this.writeParameter("node", extras.keys[p], index, extras.values[p]);
3450
+ if (restored !== null && !repeated) {
3451
+ this.report.warning(
3452
+ "coercion",
3453
+ PAJEK_ISSUE.ORIGINAL_ID_UNRESTORED,
3454
+ `vertex ${k} carries ${ORIGINAL_ID_KEY} ${JSON.stringify(restored)} but a later vertex's line came first and created it under its number; the original id is not restored`,
3455
+ { line, element: String(k) }
3456
+ );
2408
3457
  }
2409
- if (extras.spells !== null) {
2410
- if (this.nodeSpellsHandle === INVALID_INDEX) {
2411
- this.nodeSpellsHandle = declareResolved(sink, "node", spellsDecl(), this.report, { line }).handle;
2412
- }
2413
- sink.setNodeValue(this.nodeSpellsHandle, index, extras.spells);
3458
+ return this.indexOfPos[pos];
3459
+ }
3460
+ /**
3461
+ * A node column's handle, declared on first use.
3462
+ * @param handle - the handle so far, or INVALID_INDEX
3463
+ * @param decl - the column's declaration
3464
+ * @param line - the line number
3465
+ * @returns the handle
3466
+ */
3467
+ nodeHandle(handle, decl, line) {
3468
+ return handle === INVALID_INDEX ? declareResolved(this.sink, "node", decl, this.report, { line }).handle : handle;
3469
+ }
3470
+ /**
3471
+ * Writes a vertex's shape keyword: to the shape column, or to an earlier `shape "<text>"` parameter's column.
3472
+ * @param index - the node index
3473
+ * @param shape - the keyword
3474
+ * @param line - the line number
3475
+ */
3476
+ writeShape(index, shape, line) {
3477
+ if (this.shapeHandle === INVALID_INDEX && this.nodeParams.has(SHAPE_COLUMN)) {
3478
+ this.writeParameter("node", SHAPE_COLUMN, index, shape);
3479
+ return;
2414
3480
  }
3481
+ this.shapeHandle = this.nodeHandle(this.shapeHandle, SHAPE_DECL, line);
3482
+ this.sink.setNodeValue(this.shapeHandle, index, shape);
2415
3483
  }
2416
3484
  /**
2417
3485
  * A vertex label as written, its character references decoded.
@@ -2472,7 +3540,9 @@ class PajekParser {
2472
3540
  writePosition(index, dims, point, k, line) {
2473
3541
  if (this.positionHandle === INVALID_INDEX) {
2474
3542
  this.coordDims = dims;
2475
- this.positionHandle = declareResolved(this.sink, "node", positionDecl(dims), this.report, { line }).handle;
3543
+ this.positionHandle = declareResolved(this.sink, "node", positionDecl(dims, this.window), this.report, {
3544
+ line
3545
+ }).handle;
2476
3546
  } else if (dims !== this.coordDims) {
2477
3547
  this.report.warnOnce(
2478
3548
  "validation-error",
@@ -2859,7 +3929,7 @@ class PajekParser {
2859
3929
  for (let i = start; i < tokens.length; ) {
2860
3930
  const token = tokens[i];
2861
3931
  if (token.startsWith("[")) {
2862
- extras.spells = this.intervals(token, domain);
3932
+ extras.spells = this.intervals(token, domain, line);
2863
3933
  i++;
2864
3934
  continue;
2865
3935
  }
@@ -2882,8 +3952,9 @@ class PajekParser {
2882
3952
  }
2883
3953
  seen.add(token);
2884
3954
  extras.keys.push(token);
2885
- extras.values.push(tokens[i + 1]);
2886
- i += 2;
3955
+ const triple = COLOR_KEYS.has(token) ? colorTriple(tokens, i + 1) : null;
3956
+ extras.values.push(triple ?? tokens[i + 1]);
3957
+ i += triple === null ? 2 : 4;
2887
3958
  }
2888
3959
  return extras;
2889
3960
  }
@@ -2912,12 +3983,15 @@ class PajekParser {
2912
3983
  );
2913
3984
  }
2914
3985
  /**
2915
- * The spells of a row's interval token; a malformed one skips the row.
3986
+ * The spells of a row's interval token. A token not closed by "]" skips the row; a closed one
3987
+ * whose times cannot be read (`[287-?]`, lin-rel4.net) is reported and dropped, and the rest of
3988
+ * the row (its label, coordinates and parameters) is kept.
2916
3989
  * @param token - the token, starting with "["
2917
- * @param domain - what is skipped when the token is malformed
2918
- * @returns the spells, or null for an empty `[]`, which is no spell at all
3990
+ * @param domain - what is skipped when the token is not closed
3991
+ * @param line - the line number
3992
+ * @returns the spells, or null for an empty `[]`, which is no spell at all, and for a dropped one
2919
3993
  */
2920
- intervals(token, domain) {
3994
+ intervals(token, domain, line) {
2921
3995
  if (!isIntervalToken(token)) {
2922
3996
  this.skip(domain);
2923
3997
  throw new LineError(
@@ -2930,12 +4004,13 @@ class PajekParser {
2930
4004
  const spells = parseIntervals(token);
2931
4005
  return spells.length === 0 ? null : spells;
2932
4006
  } catch (err) {
2933
- this.skip(domain);
2934
- throw new LineError(
4007
+ this.report.error(
2935
4008
  "validation-error",
2936
4009
  PAJEK_ISSUE.INTERVAL,
2937
- err instanceof Error ? err.message : String(err)
4010
+ `${err instanceof Error ? err.message : String(err)}; the interval is dropped and the rest of the line kept`,
4011
+ { line }
2938
4012
  );
4013
+ return null;
2939
4014
  }
2940
4015
  }
2941
4016
  /**
@@ -2973,6 +4048,12 @@ class PajekParser {
2973
4048
  writer.write(row, text);
2974
4049
  }
2975
4050
  }
4051
+ const COLOR_KEYS = /* @__PURE__ */ new Set(["ic", "bc", "lc", "c"]);
4052
+ function colorTriple(tokens, at) {
4053
+ const parts = tokens.slice(at, at + 3);
4054
+ const fraction = (t) => /^[01]?(?:\.\d+)?$/.test(t) && t !== "" && Number(t) <= 1;
4055
+ return parts.length === 3 && parts.every(fraction) ? parts.join(" ") : null;
4056
+ }
2976
4057
  function startsWithCoordinates(text, tokens) {
2977
4058
  if (quotedAfterNumber(text, tokens)) {
2978
4059
  return false;
@@ -3012,10 +4093,29 @@ function headSection(text) {
3012
4093
  }
3013
4094
  const pajekImporter = Object.freeze({
3014
4095
  format: "pajek",
3015
- options: Object.freeze(["firstVertex"]),
4096
+ options: Object.freeze(["firstVertex", "pajekDraw"]),
3016
4097
  extensions: Object.freeze([".net", ".paj"]),
3017
4098
  mimeTypes: Object.freeze(["text/x-pajek", "text/plain"]),
3018
4099
  styles: pajekStyles,
4100
+ /**
4101
+ * Where Pajek 6.02 draws a network whose vertices have no coordinates: round a circle in vertex order, the first
4102
+ * on the left, the rest going clockwise on screen (y down), at radius 0.4 about the middle of the Draw window
4103
+ * (pajek-iliad: 311 vertices 200 points from the middle of its 500-point window). A file with coordinates is read
4104
+ * from its position column.
4105
+ * @param snapshot - the imported graph
4106
+ * @returns the circle for a file with no coordinates, else null
4107
+ */
4108
+ positions(snapshot) {
4109
+ if (snapshot.nodes.byRole("position") !== null) {
4110
+ return null;
4111
+ }
4112
+ return {
4113
+ units: "file",
4114
+ pxPerUnit: PAJEK_POINTS_PER_UNIT,
4115
+ yAxis: "down",
4116
+ unplacedCircle: { center: [0.5, 0.5], radius: 0.4, startDegrees: 180, direction: 1 }
4117
+ };
4118
+ },
3019
4119
  /**
3020
4120
  * Confidence that the input is a Pajek network: it starts with `*Vertices` (or `*Network`),
3021
4121
  * after any `%` comment lines.
@@ -3043,10 +4143,11 @@ const pajekImporter = Object.freeze({
3043
4143
  }
3044
4144
  const resolved = resolveImportOptions(options, DEFAULTS);
3045
4145
  const firstVertex = firstVertexOption(options?.firstVertex);
4146
+ const draw = resolvePajekDraw(options?.pajekDraw);
3046
4147
  const report = new ImportReportBuilder("pajek", resolved.errorLimit);
3047
4148
  reportSinkOptions(sink, options, report);
3048
4149
  reportUnusedOptions(options, report, USED_OPTIONS);
3049
- const parser = new PajekParser(sink, report, resolved, firstVertex);
4150
+ const parser = new PajekParser(sink, report, resolved, firstVertex, draw ?? DEFAULT_WINDOW);
3050
4151
  const reader = new LineReader(input, report, resolved);
3051
4152
  let rest = null;
3052
4153
  let restLine = 0;
@@ -3066,6 +4167,9 @@ const pajekImporter = Object.freeze({
3066
4167
  }
3067
4168
  }
3068
4169
  parser.finish();
4170
+ if (draw !== null || parser.voided.length > 0) {
4171
+ report.keepForStyles({ block: parser.keptBlock, pajekDraw: draw ?? void 0, voided: parser.voided });
4172
+ }
3069
4173
  if (rest !== null) {
3070
4174
  const objects = rest.objects > 0 ? `; ${rest.objects} *Partition / *Vector object(s) after them are not read` : "";
3071
4175
  report.warning(
@@ -3090,13 +4194,25 @@ const pajekImporter = Object.freeze({
3090
4194
  async importAll(input, sinkFor, options) {
3091
4195
  const resolved = resolveImportOptions(options, DEFAULTS);
3092
4196
  const firstVertex = firstVertexOption(options?.firstVertex);
4197
+ const draw = resolvePajekDraw(options?.pajekDraw);
3093
4198
  const reports = [new ImportReportBuilder("pajek", resolved.errorLimit)];
3094
4199
  reportUnusedOptions(options, reports[0], USED_OPTIONS);
3095
4200
  const open = () => {
3096
4201
  const report = reports[reports.length - 1];
3097
4202
  const sink = sinkFor(reports.length - 1);
3098
4203
  reportSinkOptions(sink, options, report);
3099
- return new PajekParser(sink, report, resolved, firstVertex);
4204
+ return new PajekParser(sink, report, resolved, firstVertex, draw ?? DEFAULT_WINDOW);
4205
+ };
4206
+ const close = (p) => {
4207
+ p.finish();
4208
+ const last = reports.at(-1);
4209
+ if (last !== void 0 && (draw !== null || p.voided.length > 0)) {
4210
+ last.keepForStyles({
4211
+ block: p.keptBlock,
4212
+ pajekDraw: draw ?? void 0,
4213
+ voided: p.voided
4214
+ });
4215
+ }
3100
4216
  };
3101
4217
  let parser = open();
3102
4218
  const reader = new LineReader(input, reports[0], resolved);
@@ -3104,7 +4220,7 @@ const pajekImporter = Object.freeze({
3104
4220
  for await (const raw of reader) {
3105
4221
  const text = withoutStrayBom(raw);
3106
4222
  if (parser.line(text, reader.line)) {
3107
- parser.finish();
4223
+ close(parser);
3108
4224
  reports.push(new ImportReportBuilder("pajek", resolved.errorLimit));
3109
4225
  parser = open();
3110
4226
  parser.line(text, reader.line);
@@ -3114,7 +4230,7 @@ const pajekImporter = Object.freeze({
3114
4230
  throwIfAborted(resolved.signal);
3115
4231
  }
3116
4232
  }
3117
- parser.finish();
4233
+ close(parser);
3118
4234
  throwIfAborted(resolved.signal);
3119
4235
  return reports.map((r) => r.finish());
3120
4236
  }
@@ -3176,4 +4292,4 @@ export {
3176
4292
  pajekImporter as d,
3177
4293
  pajekExporter as p
3178
4294
  };
3179
- //# sourceMappingURL=importer-e6LGpqHB.js.map
4295
+ //# sourceMappingURL=importer-vRq4h3j5.js.map