@graphty/graph-io 0.3.48 → 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 (570) hide show
  1. package/dist/chunks/{approximations-C2riR4NT.js → approximations-Bzn3L-je.js} +2 -2
  2. package/dist/chunks/{approximations-C2riR4NT.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-Cu22ewuS.js → block-iptrlMBb.js} +906 -164
  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-CV_Bhcyi.js → codes-BE2xir2k.js} +6 -2
  10. package/dist/chunks/codes-BE2xir2k.js.map +1 -0
  11. package/dist/chunks/{constants-D0LqcsLJ.js → constants-CKkYLPtt.js} +2 -2
  12. package/dist/chunks/{constants-D0LqcsLJ.js.map → constants-CKkYLPtt.js.map} +1 -1
  13. package/dist/chunks/{context-cgmmOxZ2.js → context-C3p0RQxR.js} +5 -4
  14. package/dist/chunks/{context-cgmmOxZ2.js.map → context-C3p0RQxR.js.map} +1 -1
  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-BiQsnMTb.js → credentials-DXHx7nwR.js} +16 -14
  18. package/dist/chunks/credentials-DXHx7nwR.js.map +1 -0
  19. package/dist/chunks/{cx-export-BEeF6ymo.js → cx-export-Bt6NoqTQ.js} +3 -3
  20. package/dist/chunks/{cx-export-BEeF6ymo.js.map → cx-export-Bt6NoqTQ.js.map} +1 -1
  21. package/dist/chunks/descriptor-B28U25x4.js +60 -0
  22. package/dist/chunks/descriptor-B28U25x4.js.map +1 -0
  23. package/dist/chunks/{descriptor-BJ-W0Jd-.js → descriptor-DLA5kINx.js} +7 -2
  24. package/dist/chunks/descriptor-DLA5kINx.js.map +1 -0
  25. package/dist/chunks/{emit-CD8xnY8s.js → emit-BwHQkZle.js} +1660 -133
  26. package/dist/chunks/emit-BwHQkZle.js.map +1 -0
  27. package/dist/chunks/{escape-DH2Egt-l.js → escape-CuCIzNMB.js} +8 -8
  28. package/dist/chunks/{escape-DH2Egt-l.js.map → escape-CuCIzNMB.js.map} +1 -1
  29. package/dist/chunks/{export-CZ7VRm4I.js → export-Cha4dRFz.js} +45 -387
  30. package/dist/chunks/export-Cha4dRFz.js.map +1 -0
  31. package/dist/chunks/{exporter-Dcw7Ldtq.js → exporter-BP6otMO6.js} +6 -6
  32. package/dist/chunks/{exporter-Dcw7Ldtq.js.map → exporter-BP6otMO6.js.map} +1 -1
  33. package/dist/chunks/{exporter-bxxjOrDZ.js → exporter-D2CETOMK.js} +1222 -156
  34. package/dist/chunks/exporter-D2CETOMK.js.map +1 -0
  35. package/dist/chunks/{exporter-BIdaoIgh.js → exporter-D9yMtocA.js} +7 -7
  36. package/dist/chunks/{exporter-BIdaoIgh.js.map → exporter-D9yMtocA.js.map} +1 -1
  37. package/dist/chunks/{exporter-DtVU80Fa.js → exporter-_jrBTnos.js} +9 -8
  38. package/dist/chunks/{exporter-DtVU80Fa.js.map → exporter-_jrBTnos.js.map} +1 -1
  39. package/dist/chunks/{exporter-ChjL5fmP.js → exporter-nDfxIK5D.js} +9 -8
  40. package/dist/chunks/{exporter-ChjL5fmP.js.map → exporter-nDfxIK5D.js.map} +1 -1
  41. package/dist/chunks/format-BXiAb-1h.js +408 -0
  42. package/dist/chunks/format-BXiAb-1h.js.map +1 -0
  43. package/dist/chunks/{generic-CP6YD34u.js → generic-ymWCETAJ.js} +387 -31
  44. package/dist/chunks/generic-ymWCETAJ.js.map +1 -0
  45. package/dist/chunks/{importer-e3huMZbm.js → importer-B92x1xY5.js} +14 -10
  46. package/dist/chunks/importer-B92x1xY5.js.map +1 -0
  47. package/dist/chunks/{importer-B87_fmVx.js → importer-CT9mJ1nn.js} +326 -84
  48. package/dist/chunks/importer-CT9mJ1nn.js.map +1 -0
  49. package/dist/chunks/{importer-CB_zV5_L.js → importer-DaLTjbds.js} +116 -1102
  50. package/dist/chunks/importer-DaLTjbds.js.map +1 -0
  51. package/dist/chunks/{importer-DPZDN40-.js → importer-GREKMdIf.js} +25 -17
  52. package/dist/chunks/importer-GREKMdIf.js.map +1 -0
  53. package/dist/chunks/{importer-Bji2MeWr.js → importer-PqaaKKnY.js} +13 -10
  54. package/dist/chunks/{importer-Bji2MeWr.js.map → importer-PqaaKKnY.js.map} +1 -1
  55. package/dist/chunks/{importer-Cyy6UseH.js → importer-Vn5QvmmJ.js} +66 -13
  56. package/dist/chunks/importer-Vn5QvmmJ.js.map +1 -0
  57. package/dist/chunks/{importer-CVT-JyDE.js → importer-vRq4h3j5.js} +1469 -356
  58. package/dist/chunks/importer-vRq4h3j5.js.map +1 -0
  59. package/dist/chunks/{input-Ccg9I22A.js → input-CAxt_aV-.js} +4 -4
  60. package/dist/chunks/{input-Ccg9I22A.js.map → input-CAxt_aV-.js.map} +1 -1
  61. package/dist/chunks/{json-elements-By172SVq.js → json-elements-Cq76WjnZ.js} +4 -4
  62. package/dist/chunks/{json-elements-By172SVq.js.map → json-elements-Cq76WjnZ.js.map} +1 -1
  63. package/dist/chunks/{lexicon-u2SI5xcx.js → lexicon-Clf4QIyl.js} +282 -74
  64. package/dist/chunks/lexicon-Clf4QIyl.js.map +1 -0
  65. package/dist/chunks/{ontology-export-BwgMyuF0.js → ontology-export-OMo91mb0.js} +4 -4
  66. package/dist/chunks/{ontology-export-BwgMyuF0.js.map → ontology-export-OMo91mb0.js.map} +1 -1
  67. package/dist/chunks/{records-Cgvxz-Vx.js → records-NJiYvekn.js} +2 -2
  68. package/dist/chunks/{records-Cgvxz-Vx.js.map → records-NJiYvekn.js.map} +1 -1
  69. package/dist/chunks/{report-CgdsL9Hb.js → report-CwMfYa9J.js} +23 -23
  70. package/dist/chunks/{report-CgdsL9Hb.js.map → report-CwMfYa9J.js.map} +1 -1
  71. package/dist/chunks/round-trip-Zm3_ivgq.js +79 -0
  72. package/dist/chunks/round-trip-Zm3_ivgq.js.map +1 -0
  73. package/dist/chunks/{sigv4-LkAzsLAu.js → sigv4-EokFic1V.js} +5 -5
  74. package/dist/chunks/sigv4-EokFic1V.js.map +1 -0
  75. package/dist/chunks/{styles-CaABMoO1.js → styles-CCs214_3.js} +1237 -138
  76. package/dist/chunks/styles-CCs214_3.js.map +1 -0
  77. package/dist/chunks/styles-Cm62yyQX.js +2812 -0
  78. package/dist/chunks/styles-Cm62yyQX.js.map +1 -0
  79. package/dist/chunks/styles-DPQQIig4.js +1928 -0
  80. package/dist/chunks/styles-DPQQIig4.js.map +1 -0
  81. package/dist/chunks/{styles-yed-Cs1nmrjn.js → styles-yed-UMFdNqze.js} +503 -172
  82. package/dist/chunks/styles-yed-UMFdNqze.js.map +1 -0
  83. package/dist/chunks/{text-BuKQVMz2.js → text-ystE2bYi.js} +2 -2
  84. package/dist/chunks/{text-BuKQVMz2.js.map → text-ystE2bYi.js.map} +1 -1
  85. package/dist/csv.js +7 -7
  86. package/dist/cx.js +2 -2
  87. package/dist/cx2.js +2 -2
  88. package/dist/cys.js +1 -1
  89. package/dist/dot.js +5 -4
  90. package/dist/dot.js.map +1 -1
  91. package/dist/gexf.js +42 -12
  92. package/dist/gexf.js.map +1 -1
  93. package/dist/gml.js +847 -193
  94. package/dist/gml.js.map +1 -1
  95. package/dist/graph-io.js +232 -220
  96. package/dist/graph-io.js.map +1 -1
  97. package/dist/graphml.js +3 -3
  98. package/dist/json.js +3 -2
  99. package/dist/neo4j.js +6 -6
  100. package/dist/obo.js +1 -1
  101. package/dist/pajek.js +1 -1
  102. package/dist/positions.js +45 -3
  103. package/dist/positions.js.map +1 -1
  104. package/dist/sources-cypher.js +138 -23
  105. package/dist/sources-cypher.js.map +1 -1
  106. package/dist/sources-ndex.js +2 -2
  107. package/dist/sources-rest.js +16 -6
  108. package/dist/sources-rest.js.map +1 -1
  109. package/dist/sources-sparql.d.ts +1 -0
  110. package/dist/sources-sparql.js +405 -0
  111. package/dist/sources-sparql.js.map +1 -0
  112. package/dist/src/formats/cx/importer.d.ts.map +1 -1
  113. package/dist/src/formats/cx/importer.js +5 -1
  114. package/dist/src/formats/cx/importer.js.map +1 -1
  115. package/dist/src/formats/cx/styles.d.ts +24 -1
  116. package/dist/src/formats/cx/styles.d.ts.map +1 -1
  117. package/dist/src/formats/cx/styles.js +117 -11
  118. package/dist/src/formats/cx/styles.js.map +1 -1
  119. package/dist/src/formats/cx2/importer.d.ts.map +1 -1
  120. package/dist/src/formats/cx2/importer.js +1 -0
  121. package/dist/src/formats/cx2/importer.js.map +1 -1
  122. package/dist/src/formats/cx2/styles.d.ts.map +1 -1
  123. package/dist/src/formats/cx2/styles.js +3 -1
  124. package/dist/src/formats/cx2/styles.js.map +1 -1
  125. package/dist/src/formats/cys/importer.d.ts.map +1 -1
  126. package/dist/src/formats/cys/importer.js +1 -0
  127. package/dist/src/formats/cys/importer.js.map +1 -1
  128. package/dist/src/formats/cys/styles.d.ts +2 -0
  129. package/dist/src/formats/cys/styles.d.ts.map +1 -1
  130. package/dist/src/formats/cys/styles.js +15 -7
  131. package/dist/src/formats/cys/styles.js.map +1 -1
  132. package/dist/src/formats/dot/drawing.d.ts +98 -0
  133. package/dist/src/formats/dot/drawing.d.ts.map +1 -0
  134. package/dist/src/formats/dot/drawing.js +734 -0
  135. package/dist/src/formats/dot/drawing.js.map +1 -0
  136. package/dist/src/formats/dot/importer.d.ts.map +1 -1
  137. package/dist/src/formats/dot/importer.js +108 -31
  138. package/dist/src/formats/dot/importer.js.map +1 -1
  139. package/dist/src/formats/dot/label-places.d.ts +34 -0
  140. package/dist/src/formats/dot/label-places.d.ts.map +1 -0
  141. package/dist/src/formats/dot/label-places.js +179 -0
  142. package/dist/src/formats/dot/label-places.js.map +1 -0
  143. package/dist/src/formats/dot/record.d.ts +50 -0
  144. package/dist/src/formats/dot/record.d.ts.map +1 -0
  145. package/dist/src/formats/dot/record.js +275 -0
  146. package/dist/src/formats/dot/record.js.map +1 -0
  147. package/dist/src/formats/dot/styles.d.ts +62 -2
  148. package/dist/src/formats/dot/styles.d.ts.map +1 -1
  149. package/dist/src/formats/dot/styles.js +1454 -119
  150. package/dist/src/formats/dot/styles.js.map +1 -1
  151. package/dist/src/formats/gexf/dialog-metrics.d.ts +15 -0
  152. package/dist/src/formats/gexf/dialog-metrics.d.ts.map +1 -0
  153. package/dist/src/formats/gexf/dialog-metrics.js +59 -0
  154. package/dist/src/formats/gexf/dialog-metrics.js.map +1 -0
  155. package/dist/src/formats/gexf/importer.d.ts +7 -0
  156. package/dist/src/formats/gexf/importer.d.ts.map +1 -1
  157. package/dist/src/formats/gexf/importer.js +41 -5
  158. package/dist/src/formats/gexf/importer.js.map +1 -1
  159. package/dist/src/formats/gexf/preview.d.ts +77 -0
  160. package/dist/src/formats/gexf/preview.d.ts.map +1 -0
  161. package/dist/src/formats/gexf/preview.js +191 -0
  162. package/dist/src/formats/gexf/preview.js.map +1 -0
  163. package/dist/src/formats/gexf/schema.d.ts.map +1 -1
  164. package/dist/src/formats/gexf/schema.js +2 -1
  165. package/dist/src/formats/gexf/schema.js.map +1 -1
  166. package/dist/src/formats/gexf/styles.d.ts +58 -31
  167. package/dist/src/formats/gexf/styles.d.ts.map +1 -1
  168. package/dist/src/formats/gexf/styles.js +848 -225
  169. package/dist/src/formats/gexf/styles.js.map +1 -1
  170. package/dist/src/formats/gml/importer.d.ts +5 -2
  171. package/dist/src/formats/gml/importer.d.ts.map +1 -1
  172. package/dist/src/formats/gml/importer.js +258 -71
  173. package/dist/src/formats/gml/importer.js.map +1 -1
  174. package/dist/src/formats/gml/index.d.ts +1 -1
  175. package/dist/src/formats/gml/index.d.ts.map +1 -1
  176. package/dist/src/formats/gml/index.js +1 -1
  177. package/dist/src/formats/gml/index.js.map +1 -1
  178. package/dist/src/formats/gml/positions.d.ts +7 -0
  179. package/dist/src/formats/gml/positions.d.ts.map +1 -1
  180. package/dist/src/formats/gml/positions.js +29 -7
  181. package/dist/src/formats/gml/positions.js.map +1 -1
  182. package/dist/src/formats/gml/styles.d.ts.map +1 -1
  183. package/dist/src/formats/gml/styles.js +753 -101
  184. package/dist/src/formats/gml/styles.js.map +1 -1
  185. package/dist/src/formats/graphml/styles-plain.d.ts.map +1 -1
  186. package/dist/src/formats/graphml/styles-plain.js +6 -10
  187. package/dist/src/formats/graphml/styles-plain.js.map +1 -1
  188. package/dist/src/formats/graphml/styles-yed.d.ts +21 -15
  189. package/dist/src/formats/graphml/styles-yed.d.ts.map +1 -1
  190. package/dist/src/formats/graphml/styles-yed.js +692 -161
  191. package/dist/src/formats/graphml/styles-yed.js.map +1 -1
  192. package/dist/src/formats/graphml/styles-yfiles3.d.ts +1 -1
  193. package/dist/src/formats/graphml/styles-yfiles3.d.ts.map +1 -1
  194. package/dist/src/formats/graphml/styles-yfiles3.js +429 -64
  195. package/dist/src/formats/graphml/styles-yfiles3.js.map +1 -1
  196. package/dist/src/formats/graphml/yfiles.d.ts +3 -3
  197. package/dist/src/formats/graphml/yfiles.d.ts.map +1 -1
  198. package/dist/src/formats/graphml/yfiles.js +16 -6
  199. package/dist/src/formats/graphml/yfiles.js.map +1 -1
  200. package/dist/src/formats/json/dialect.d.ts +3 -2
  201. package/dist/src/formats/json/dialect.d.ts.map +1 -1
  202. package/dist/src/formats/json/dialect.js +39 -5
  203. package/dist/src/formats/json/dialect.js.map +1 -1
  204. package/dist/src/formats/json/importer.d.ts +13 -2
  205. package/dist/src/formats/json/importer.d.ts.map +1 -1
  206. package/dist/src/formats/json/importer.js +42 -6
  207. package/dist/src/formats/json/importer.js.map +1 -1
  208. package/dist/src/formats/json/index.d.ts +1 -1
  209. package/dist/src/formats/json/index.d.ts.map +1 -1
  210. package/dist/src/formats/json/index.js +1 -1
  211. package/dist/src/formats/json/index.js.map +1 -1
  212. package/dist/src/formats/json/positions.d.ts +5 -2
  213. package/dist/src/formats/json/positions.d.ts.map +1 -1
  214. package/dist/src/formats/json/positions.js +20 -4
  215. package/dist/src/formats/json/positions.js.map +1 -1
  216. package/dist/src/formats/json/styles.d.ts +12 -1
  217. package/dist/src/formats/json/styles.d.ts.map +1 -1
  218. package/dist/src/formats/json/styles.js +1755 -136
  219. package/dist/src/formats/json/styles.js.map +1 -1
  220. package/dist/src/formats/pajek/draw.d.ts +96 -0
  221. package/dist/src/formats/pajek/draw.d.ts.map +1 -0
  222. package/dist/src/formats/pajek/draw.js +372 -0
  223. package/dist/src/formats/pajek/draw.js.map +1 -0
  224. package/dist/src/formats/pajek/exporter.d.ts.map +1 -1
  225. package/dist/src/formats/pajek/exporter.js +70 -51
  226. package/dist/src/formats/pajek/exporter.js.map +1 -1
  227. package/dist/src/formats/pajek/importer.d.ts +9 -0
  228. package/dist/src/formats/pajek/importer.d.ts.map +1 -1
  229. package/dist/src/formats/pajek/importer.js +233 -102
  230. package/dist/src/formats/pajek/importer.js.map +1 -1
  231. package/dist/src/formats/pajek/index.d.ts +1 -0
  232. package/dist/src/formats/pajek/index.d.ts.map +1 -1
  233. package/dist/src/formats/pajek/index.js.map +1 -1
  234. package/dist/src/formats/pajek/styles.d.ts +15 -7
  235. package/dist/src/formats/pajek/styles.d.ts.map +1 -1
  236. package/dist/src/formats/pajek/styles.js +1278 -114
  237. package/dist/src/formats/pajek/styles.js.map +1 -1
  238. package/dist/src/formats/pajek/syntax.d.ts +10 -1
  239. package/dist/src/formats/pajek/syntax.d.ts.map +1 -1
  240. package/dist/src/formats/pajek/syntax.js +26 -2
  241. package/dist/src/formats/pajek/syntax.js.map +1 -1
  242. package/dist/src/formats/xgmml/emit.d.ts +1 -0
  243. package/dist/src/formats/xgmml/emit.d.ts.map +1 -1
  244. package/dist/src/formats/xgmml/emit.js +65 -5
  245. package/dist/src/formats/xgmml/emit.js.map +1 -1
  246. package/dist/src/formats/xgmml/styles.d.ts +23 -3
  247. package/dist/src/formats/xgmml/styles.d.ts.map +1 -1
  248. package/dist/src/formats/xgmml/styles.js +277 -60
  249. package/dist/src/formats/xgmml/styles.js.map +1 -1
  250. package/dist/src/index.d.ts +4 -3
  251. package/dist/src/index.d.ts.map +1 -1
  252. package/dist/src/index.js +4 -3
  253. package/dist/src/index.js.map +1 -1
  254. package/dist/src/positions/convert.d.ts.map +1 -1
  255. package/dist/src/positions/convert.js +11 -1
  256. package/dist/src/positions/convert.js.map +1 -1
  257. package/dist/src/positions/extract.d.ts.map +1 -1
  258. package/dist/src/positions/extract.js +53 -1
  259. package/dist/src/positions/extract.js.map +1 -1
  260. package/dist/src/positions/index.d.ts +1 -1
  261. package/dist/src/positions/index.d.ts.map +1 -1
  262. package/dist/src/positions/types.d.ts +59 -0
  263. package/dist/src/positions/types.d.ts.map +1 -1
  264. package/dist/src/sources/builtins.d.ts +1 -1
  265. package/dist/src/sources/builtins.d.ts.map +1 -1
  266. package/dist/src/sources/builtins.js +8 -2
  267. package/dist/src/sources/builtins.js.map +1 -1
  268. package/dist/src/sources/context.d.ts.map +1 -1
  269. package/dist/src/sources/context.js +1 -0
  270. package/dist/src/sources/context.js.map +1 -1
  271. package/dist/src/sources/cypher/descriptor.d.ts.map +1 -1
  272. package/dist/src/sources/cypher/descriptor.js +5 -0
  273. package/dist/src/sources/cypher/descriptor.js.map +1 -1
  274. package/dist/src/sources/cypher/index.d.ts.map +1 -1
  275. package/dist/src/sources/cypher/index.js +124 -18
  276. package/dist/src/sources/cypher/index.js.map +1 -1
  277. package/dist/src/sources/cypher/params.d.ts +1 -1
  278. package/dist/src/sources/cypher/params.d.ts.map +1 -1
  279. package/dist/src/sources/cypher/query-builder.d.ts +17 -0
  280. package/dist/src/sources/cypher/query-builder.d.ts.map +1 -1
  281. package/dist/src/sources/cypher/query-builder.js +31 -0
  282. package/dist/src/sources/cypher/query-builder.js.map +1 -1
  283. package/dist/src/sources/ids.d.ts +5 -0
  284. package/dist/src/sources/ids.d.ts.map +1 -1
  285. package/dist/src/sources/ids.js +5 -0
  286. package/dist/src/sources/ids.js.map +1 -1
  287. package/dist/src/sources/params.d.ts +3 -0
  288. package/dist/src/sources/params.d.ts.map +1 -1
  289. package/dist/src/sources/rest/descriptor.d.ts.map +1 -1
  290. package/dist/src/sources/rest/descriptor.js +5 -0
  291. package/dist/src/sources/rest/descriptor.js.map +1 -1
  292. package/dist/src/sources/rest/source.d.ts.map +1 -1
  293. package/dist/src/sources/rest/source.js +15 -0
  294. package/dist/src/sources/rest/source.js.map +1 -1
  295. package/dist/src/sources/sigv4.d.ts +5 -3
  296. package/dist/src/sources/sigv4.d.ts.map +1 -1
  297. package/dist/src/sources/sigv4.js +6 -4
  298. package/dist/src/sources/sigv4.js.map +1 -1
  299. package/dist/src/sources/sparql/descriptor.d.ts +10 -0
  300. package/dist/src/sources/sparql/descriptor.d.ts.map +1 -0
  301. package/dist/src/sources/sparql/descriptor.js +64 -0
  302. package/dist/src/sources/sparql/descriptor.js.map +1 -0
  303. package/dist/src/sources/sparql/index.d.ts +28 -0
  304. package/dist/src/sources/sparql/index.d.ts.map +1 -0
  305. package/dist/src/sources/sparql/index.js +314 -0
  306. package/dist/src/sources/sparql/index.js.map +1 -0
  307. package/dist/src/sources/sparql/ntriples.d.ts +69 -0
  308. package/dist/src/sources/sparql/ntriples.d.ts.map +1 -0
  309. package/dist/src/sources/sparql/ntriples.js +180 -0
  310. package/dist/src/sources/sparql/ntriples.js.map +1 -0
  311. package/dist/src/sources/sparql/params.d.ts +27 -0
  312. package/dist/src/sources/sparql/params.d.ts.map +1 -0
  313. package/dist/src/sources/sparql/params.js +5 -0
  314. package/dist/src/sources/sparql/params.js.map +1 -0
  315. package/dist/src/sources/sparql/query.d.ts +72 -0
  316. package/dist/src/sources/sparql/query.d.ts.map +1 -0
  317. package/dist/src/sources/sparql/query.js +113 -0
  318. package/dist/src/sources/sparql/query.js.map +1 -0
  319. package/dist/src/sources/types.d.ts +31 -0
  320. package/dist/src/sources/types.d.ts.map +1 -1
  321. package/dist/src/styles/annotations.d.ts +61 -5
  322. package/dist/src/styles/annotations.d.ts.map +1 -1
  323. package/dist/src/styles/annotations.js +130 -22
  324. package/dist/src/styles/annotations.js.map +1 -1
  325. package/dist/src/styles/canon/bends.d.ts +46 -0
  326. package/dist/src/styles/canon/bends.d.ts.map +1 -1
  327. package/dist/src/styles/canon/bends.js +123 -0
  328. package/dist/src/styles/canon/bends.js.map +1 -1
  329. package/dist/src/styles/canon/color-tables.d.ts +6 -1
  330. package/dist/src/styles/canon/color-tables.d.ts.map +1 -1
  331. package/dist/src/styles/canon/color-tables.js +10 -4
  332. package/dist/src/styles/canon/color-tables.js.map +1 -1
  333. package/dist/src/styles/canon/color.d.ts +3 -1
  334. package/dist/src/styles/canon/color.d.ts.map +1 -1
  335. package/dist/src/styles/canon/color.js +103 -3
  336. package/dist/src/styles/canon/color.js.map +1 -1
  337. package/dist/src/styles/canon/enums.d.ts +2 -2
  338. package/dist/src/styles/canon/enums.d.ts.map +1 -1
  339. package/dist/src/styles/canon/enums.js +81 -7
  340. package/dist/src/styles/canon/enums.js.map +1 -1
  341. package/dist/src/styles/canon/graphviz.d.ts +12 -3
  342. package/dist/src/styles/canon/graphviz.d.ts.map +1 -1
  343. package/dist/src/styles/canon/graphviz.js +57 -9
  344. package/dist/src/styles/canon/graphviz.js.map +1 -1
  345. package/dist/src/styles/canon/number.d.ts +8 -0
  346. package/dist/src/styles/canon/number.d.ts.map +1 -1
  347. package/dist/src/styles/canon/number.js +18 -0
  348. package/dist/src/styles/canon/number.js.map +1 -1
  349. package/dist/src/styles/canon/text.d.ts +29 -2
  350. package/dist/src/styles/canon/text.d.ts.map +1 -1
  351. package/dist/src/styles/canon/text.js +156 -16
  352. package/dist/src/styles/canon/text.js.map +1 -1
  353. package/dist/src/styles/codes.d.ts +2 -0
  354. package/dist/src/styles/codes.d.ts.map +1 -1
  355. package/dist/src/styles/codes.js +2 -0
  356. package/dist/src/styles/codes.js.map +1 -1
  357. package/dist/src/styles/cyjs/cascade.d.ts.map +1 -1
  358. package/dist/src/styles/cyjs/cascade.js +1015 -79
  359. package/dist/src/styles/cyjs/cascade.js.map +1 -1
  360. package/dist/src/styles/cyjs/defaults-table.d.ts.map +1 -1
  361. package/dist/src/styles/cyjs/defaults-table.js +3 -0
  362. package/dist/src/styles/cyjs/defaults-table.js.map +1 -1
  363. package/dist/src/styles/cyjs/emit.d.ts.map +1 -1
  364. package/dist/src/styles/cyjs/emit.js +202 -9
  365. package/dist/src/styles/cyjs/emit.js.map +1 -1
  366. package/dist/src/styles/cyjs/face.d.ts +20 -0
  367. package/dist/src/styles/cyjs/face.d.ts.map +1 -0
  368. package/dist/src/styles/cyjs/face.js +332 -0
  369. package/dist/src/styles/cyjs/face.js.map +1 -0
  370. package/dist/src/styles/cyjs/mappers.d.ts +44 -1
  371. package/dist/src/styles/cyjs/mappers.d.ts.map +1 -1
  372. package/dist/src/styles/cyjs/mappers.js +461 -26
  373. package/dist/src/styles/cyjs/mappers.js.map +1 -1
  374. package/dist/src/styles/cyjs/routes.d.ts +53 -0
  375. package/dist/src/styles/cyjs/routes.d.ts.map +1 -0
  376. package/dist/src/styles/cyjs/routes.js +360 -0
  377. package/dist/src/styles/cyjs/routes.js.map +1 -0
  378. package/dist/src/styles/cytoscape/charts.d.ts +23 -0
  379. package/dist/src/styles/cytoscape/charts.d.ts.map +1 -0
  380. package/dist/src/styles/cytoscape/charts.js +560 -0
  381. package/dist/src/styles/cytoscape/charts.js.map +1 -0
  382. package/dist/src/styles/cytoscape/emit.d.ts.map +1 -1
  383. package/dist/src/styles/cytoscape/emit.js +156 -48
  384. package/dist/src/styles/cytoscape/emit.js.map +1 -1
  385. package/dist/src/styles/cytoscape/lexicon.d.ts +91 -3
  386. package/dist/src/styles/cytoscape/lexicon.d.ts.map +1 -1
  387. package/dist/src/styles/cytoscape/lexicon.js +387 -77
  388. package/dist/src/styles/cytoscape/lexicon.js.map +1 -1
  389. package/dist/src/styles/cytoscape/mappings.d.ts +30 -0
  390. package/dist/src/styles/cytoscape/mappings.d.ts.map +1 -1
  391. package/dist/src/styles/cytoscape/mappings.js +92 -0
  392. package/dist/src/styles/cytoscape/mappings.js.map +1 -1
  393. package/dist/src/styles/cytoscape/resolve.d.ts +42 -2
  394. package/dist/src/styles/cytoscape/resolve.d.ts.map +1 -1
  395. package/dist/src/styles/cytoscape/resolve.js +623 -17
  396. package/dist/src/styles/cytoscape/resolve.js.map +1 -1
  397. package/dist/src/styles/defaults.d.ts +46 -26
  398. package/dist/src/styles/defaults.d.ts.map +1 -1
  399. package/dist/src/styles/defaults.js +308 -71
  400. package/dist/src/styles/defaults.js.map +1 -1
  401. package/dist/src/styles/index.d.ts +4 -3
  402. package/dist/src/styles/index.d.ts.map +1 -1
  403. package/dist/src/styles/index.js +3 -2
  404. package/dist/src/styles/index.js.map +1 -1
  405. package/dist/src/styles/internal.d.ts +1 -0
  406. package/dist/src/styles/internal.d.ts.map +1 -1
  407. package/dist/src/styles/internal.js +1 -0
  408. package/dist/src/styles/internal.js.map +1 -1
  409. package/dist/src/styles/io/generic.d.ts.map +1 -1
  410. package/dist/src/styles/io/generic.js +56 -16
  411. package/dist/src/styles/io/generic.js.map +1 -1
  412. package/dist/src/styles/io/round-trip.d.ts +56 -0
  413. package/dist/src/styles/io/round-trip.d.ts.map +1 -0
  414. package/dist/src/styles/io/round-trip.js +138 -0
  415. package/dist/src/styles/io/round-trip.js.map +1 -0
  416. package/dist/src/styles/io/writer.d.ts.map +1 -1
  417. package/dist/src/styles/io/writer.js +6 -1
  418. package/dist/src/styles/io/writer.js.map +1 -1
  419. package/dist/src/styles/notes.d.ts.map +1 -1
  420. package/dist/src/styles/notes.js +1 -0
  421. package/dist/src/styles/notes.js.map +1 -1
  422. package/dist/src/styles/plan/features.d.ts +1 -1
  423. package/dist/src/styles/plan/features.d.ts.map +1 -1
  424. package/dist/src/styles/plan/features.js +22 -2
  425. package/dist/src/styles/plan/features.js.map +1 -1
  426. package/dist/src/styles/plan/index.d.ts +1 -1
  427. package/dist/src/styles/plan/index.d.ts.map +1 -1
  428. package/dist/src/styles/plan/index.js +1 -1
  429. package/dist/src/styles/plan/index.js.map +1 -1
  430. package/dist/src/styles/plan/plan.d.ts.map +1 -1
  431. package/dist/src/styles/plan/plan.js +61 -4
  432. package/dist/src/styles/plan/plan.js.map +1 -1
  433. package/dist/src/styles/plan/resolve.d.ts +11 -0
  434. package/dist/src/styles/plan/resolve.d.ts.map +1 -1
  435. package/dist/src/styles/plan/resolve.js +40 -4
  436. package/dist/src/styles/plan/resolve.js.map +1 -1
  437. package/dist/src/styles/slots.d.ts +14 -0
  438. package/dist/src/styles/slots.d.ts.map +1 -0
  439. package/dist/src/styles/slots.js +20 -0
  440. package/dist/src/styles/slots.js.map +1 -0
  441. package/dist/src/styles/types.d.ts +622 -6
  442. package/dist/src/styles/types.d.ts.map +1 -1
  443. package/dist/src/styles/vocabulary.d.ts +3 -2
  444. package/dist/src/styles/vocabulary.d.ts.map +1 -1
  445. package/dist/src/styles/vocabulary.js +203 -0
  446. package/dist/src/styles/vocabulary.js.map +1 -1
  447. package/dist/styles.js +30 -239
  448. package/dist/styles.js.map +1 -1
  449. package/dist/xgmml.js +3 -3
  450. package/package.json +27 -7
  451. package/src/formats/cx/importer.ts +6 -1
  452. package/src/formats/cx/styles.ts +143 -9
  453. package/src/formats/cx2/importer.ts +1 -0
  454. package/src/formats/cx2/styles.ts +3 -1
  455. package/src/formats/cys/importer.ts +1 -0
  456. package/src/formats/cys/styles.ts +27 -5
  457. package/src/formats/dot/drawing.ts +799 -0
  458. package/src/formats/dot/importer.ts +120 -35
  459. package/src/formats/dot/label-places.ts +228 -0
  460. package/src/formats/dot/record.ts +336 -0
  461. package/src/formats/dot/styles.ts +1654 -153
  462. package/src/formats/gexf/dialog-metrics.ts +61 -0
  463. package/src/formats/gexf/importer.ts +50 -5
  464. package/src/formats/gexf/preview.ts +217 -0
  465. package/src/formats/gexf/schema.ts +2 -1
  466. package/src/formats/gexf/styles.ts +1099 -245
  467. package/src/formats/gml/importer.ts +291 -76
  468. package/src/formats/gml/index.ts +1 -1
  469. package/src/formats/gml/positions.ts +29 -7
  470. package/src/formats/gml/styles.ts +851 -109
  471. package/src/formats/graphml/styles-plain.ts +6 -15
  472. package/src/formats/graphml/styles-yed.ts +762 -173
  473. package/src/formats/graphml/styles-yfiles3.ts +485 -63
  474. package/src/formats/graphml/yfiles.ts +19 -6
  475. package/src/formats/json/dialect.ts +41 -5
  476. package/src/formats/json/importer.ts +59 -7
  477. package/src/formats/json/index.ts +1 -0
  478. package/src/formats/json/positions.ts +22 -5
  479. package/src/formats/json/styles.ts +2041 -185
  480. package/src/formats/pajek/draw.ts +458 -0
  481. package/src/formats/pajek/exporter.ts +81 -49
  482. package/src/formats/pajek/importer.ts +278 -103
  483. package/src/formats/pajek/index.ts +1 -0
  484. package/src/formats/pajek/styles.ts +1381 -133
  485. package/src/formats/pajek/syntax.ts +27 -2
  486. package/src/formats/xgmml/emit.ts +73 -5
  487. package/src/formats/xgmml/styles.ts +330 -71
  488. package/src/index.ts +5 -1
  489. package/src/positions/convert.ts +12 -1
  490. package/src/positions/extract.ts +55 -1
  491. package/src/positions/index.ts +1 -0
  492. package/src/positions/types.ts +60 -0
  493. package/src/sources/builtins.ts +8 -1
  494. package/src/sources/context.ts +1 -0
  495. package/src/sources/cypher/descriptor.ts +7 -1
  496. package/src/sources/cypher/index.ts +148 -18
  497. package/src/sources/cypher/params.ts +1 -1
  498. package/src/sources/cypher/query-builder.ts +33 -0
  499. package/src/sources/ids.ts +6 -0
  500. package/src/sources/params.ts +3 -0
  501. package/src/sources/rest/descriptor.ts +5 -0
  502. package/src/sources/rest/source.ts +16 -0
  503. package/src/sources/sigv4.ts +6 -4
  504. package/src/sources/sparql/descriptor.ts +67 -0
  505. package/src/sources/sparql/index.ts +356 -0
  506. package/src/sources/sparql/ntriples.ts +219 -0
  507. package/src/sources/sparql/params.ts +28 -0
  508. package/src/sources/sparql/query.ts +162 -0
  509. package/src/sources/types.ts +35 -0
  510. package/src/styles/annotations.ts +201 -27
  511. package/src/styles/canon/bends.ts +137 -0
  512. package/src/styles/canon/color-tables.ts +10 -4
  513. package/src/styles/canon/color.ts +105 -3
  514. package/src/styles/canon/enums.ts +98 -8
  515. package/src/styles/canon/graphviz.ts +71 -10
  516. package/src/styles/canon/number.ts +19 -0
  517. package/src/styles/canon/text.ts +187 -16
  518. package/src/styles/codes.ts +2 -0
  519. package/src/styles/cyjs/cascade.ts +1160 -84
  520. package/src/styles/cyjs/defaults-table.ts +3 -0
  521. package/src/styles/cyjs/emit.ts +233 -13
  522. package/src/styles/cyjs/face.ts +372 -0
  523. package/src/styles/cyjs/mappers.ts +492 -27
  524. package/src/styles/cyjs/routes.ts +432 -0
  525. package/src/styles/cytoscape/charts.ts +684 -0
  526. package/src/styles/cytoscape/emit.ts +170 -48
  527. package/src/styles/cytoscape/lexicon.ts +431 -78
  528. package/src/styles/cytoscape/mappings.ts +108 -0
  529. package/src/styles/cytoscape/resolve.ts +741 -17
  530. package/src/styles/defaults.ts +417 -108
  531. package/src/styles/index.ts +5 -0
  532. package/src/styles/internal.ts +1 -0
  533. package/src/styles/io/generic.ts +79 -23
  534. package/src/styles/io/round-trip.ts +202 -0
  535. package/src/styles/io/writer.ts +6 -1
  536. package/src/styles/notes.ts +1 -0
  537. package/src/styles/plan/features.ts +23 -2
  538. package/src/styles/plan/index.ts +1 -1
  539. package/src/styles/plan/plan.ts +69 -5
  540. package/src/styles/plan/resolve.ts +47 -4
  541. package/src/styles/slots.ts +25 -0
  542. package/src/styles/types.ts +633 -5
  543. package/src/styles/vocabulary.ts +211 -2
  544. package/dist/chunks/block-Cu22ewuS.js.map +0 -1
  545. package/dist/chunks/choose-Cdx6Enl2.js +0 -57
  546. package/dist/chunks/choose-Cdx6Enl2.js.map +0 -1
  547. package/dist/chunks/codes-CV_Bhcyi.js.map +0 -1
  548. package/dist/chunks/convert-BcQ8_jMo.js.map +0 -1
  549. package/dist/chunks/credentials-BiQsnMTb.js.map +0 -1
  550. package/dist/chunks/descriptor-BJ-W0Jd-.js.map +0 -1
  551. package/dist/chunks/emit-CD8xnY8s.js.map +0 -1
  552. package/dist/chunks/export-CZ7VRm4I.js.map +0 -1
  553. package/dist/chunks/exporter-bxxjOrDZ.js.map +0 -1
  554. package/dist/chunks/format-BMS-1Nxb.js +0 -64
  555. package/dist/chunks/format-BMS-1Nxb.js.map +0 -1
  556. package/dist/chunks/generic-CP6YD34u.js.map +0 -1
  557. package/dist/chunks/importer-B87_fmVx.js.map +0 -1
  558. package/dist/chunks/importer-CB_zV5_L.js.map +0 -1
  559. package/dist/chunks/importer-CVT-JyDE.js.map +0 -1
  560. package/dist/chunks/importer-Cyy6UseH.js.map +0 -1
  561. package/dist/chunks/importer-DPZDN40-.js.map +0 -1
  562. package/dist/chunks/importer-e3huMZbm.js.map +0 -1
  563. package/dist/chunks/lexicon-u2SI5xcx.js.map +0 -1
  564. package/dist/chunks/sigv4-LkAzsLAu.js.map +0 -1
  565. package/dist/chunks/styles-CaABMoO1.js.map +0 -1
  566. package/dist/chunks/styles-P_gmFAOi.js +0 -770
  567. package/dist/chunks/styles-P_gmFAOi.js.map +0 -1
  568. package/dist/chunks/styles-yed-Cs1nmrjn.js.map +0 -1
  569. package/dist/chunks/writer-DvHTl36J.js +0 -449
  570. package/dist/chunks/writer-DvHTl36J.js.map +0 -1
@@ -1,4 +1,5 @@
1
- import { a as STYLE_ISSUE, i as num6, l as canonEnum, W as CSS_COLORS, u as StyleNotes, d as canonicalFor, p as plainCell, Q as evalContinuous, R as numberOf, e as degreeValues, L as refSource, C as STYLE_PROPERTIES, O as resolveRules, P as matches } from "./block-Cu22ewuS.js";
1
+ import { i as num6, a as canonEnum, b as STYLE_ISSUE, d as canonColor, _ as CSS_COLORS, h as StyleNotes, C as canonicalFor, p as plainCell, W as evalContinuous, X as numberOf, D as degreeValues, Q as refSource, w as STYLE_PROPERTIES, U as resolveRules, V as matches } from "./block-iptrlMBb.js";
2
+ import { d as canonBends, c as canonNodeOffsets, a as flattenQuadSpline } from "./bends-BGXjv_U4.js";
2
3
  const STYLE_WORK_BUDGET = 2e8;
3
4
  class StyleBudget {
4
5
  #used = { node: 0, edge: 0 };
@@ -41,6 +42,7 @@ const CYJS_PROPERTY_DEFAULTS = /* @__PURE__ */ new Map([
41
42
  ["background-opacity", "1"],
42
43
  ["opacity", "1"],
43
44
  ["border-color", "rgb(0,0,0)"],
45
+ ["border-opacity", "1"],
44
46
  ["border-width", "0px"],
45
47
  ["border-style", "solid"],
46
48
  ["shape", "ellipse"],
@@ -56,6 +58,8 @@ const CYJS_PROPERTY_DEFAULTS = /* @__PURE__ */ new Map([
56
58
  ["display", "element"],
57
59
  ["text-valign", "top"],
58
60
  ["text-halign", "center"],
61
+ ["text-wrap", "none"],
62
+ ["text-max-width", "9999px"],
59
63
  ["line-color", "rgb(153,153,153)"],
60
64
  ["line-style", "solid"],
61
65
  ["target-arrow-shape", "none"],
@@ -96,6 +100,239 @@ const CYJS_DEFAULT_STYLESHEET = [
96
100
  style: { "background-color": "rgb(204,225,249)", "border-color": "rgb(174,200,229)" }
97
101
  }
98
102
  ];
103
+ const PIECES = 16;
104
+ const text = (property) => ({ property, type: "text" });
105
+ const color = (property) => ({ property, type: "color" });
106
+ const CYJS_FACE_PROPERTIES = [
107
+ ["background-image", text("_bgImage")],
108
+ ["background-fit", text("_bgFit")],
109
+ ["background-width", text("_bgWidth")],
110
+ ["background-height", text("_bgHeight")],
111
+ ["background-width-relative-to", text("_bgWidthRel")],
112
+ ["background-height-relative-to", text("_bgHeightRel")],
113
+ ["background-position-x", text("_bgPosX")],
114
+ ["background-position-y", text("_bgPosY")],
115
+ ["background-offset-x", text("_bgOffX")],
116
+ ["background-offset-y", text("_bgOffY")],
117
+ ["background-repeat", text("_bgRepeat")],
118
+ ["background-clip", text("_bgClip")],
119
+ ["background-image-smoothing", text("_bgSmooth")],
120
+ ["background-image-opacity", text("_bgOpacity")],
121
+ ["pie-size", text("_pieSize")],
122
+ ["pie-hole", text("_pieHole")],
123
+ ["pie-start-angle", text("_pieStart")],
124
+ ["stripe-size", text("_stripeSize")],
125
+ ["stripe-direction", text("_stripeDir")],
126
+ ...Array.from({ length: PIECES }, (_, k) => [
127
+ [`pie-${String(k + 1)}-background-color`, color(`_pieC${String(k + 1)}`)],
128
+ [`pie-${String(k + 1)}-background-size`, text(`_pieS${String(k + 1)}`)],
129
+ [`pie-${String(k + 1)}-background-opacity`, text(`_pieO${String(k + 1)}`)],
130
+ [`stripe-${String(k + 1)}-background-color`, color(`_stripeC${String(k + 1)}`)],
131
+ [`stripe-${String(k + 1)}-background-size`, text(`_stripeS${String(k + 1)}`)],
132
+ [`stripe-${String(k + 1)}-background-opacity`, text(`_stripeO${String(k + 1)}`)]
133
+ ]).flat()
134
+ ];
135
+ function measure(word) {
136
+ const m = /^(-?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)\s*([a-z%]*)$/i.exec((word ?? "").trim());
137
+ return m === null ? null : [Number(m[1]), m[2].toLowerCase()];
138
+ }
139
+ const r6 = (v) => Math.round(v * 1e6) / 1e6;
140
+ function length(word, of) {
141
+ const m = measure(word);
142
+ if (m === null) {
143
+ return null;
144
+ }
145
+ let out = null;
146
+ if (m[1] === "%") {
147
+ out = of === null ? null : m[0] / 100 * of;
148
+ } else if (m[1] === "px" || m[1] === "") {
149
+ out = m[0];
150
+ }
151
+ return out === null || out < 0 ? null : r6(out);
152
+ }
153
+ function paddingPixels(word) {
154
+ const x = Number.parseFloat(word ?? "");
155
+ if (!Number.isFinite(x) || x <= 0) {
156
+ return 0;
157
+ }
158
+ return (word ?? "").trim().endsWith("%") ? x / 100 : x;
159
+ }
160
+ function fraction(word) {
161
+ const m = measure(word);
162
+ if (m === null) {
163
+ return null;
164
+ }
165
+ if (m[1] === "%") {
166
+ return r6(m[0] / 100);
167
+ }
168
+ return m[1] === "" ? r6(m[0]) : null;
169
+ }
170
+ function firstImage(word) {
171
+ const first = (word ?? "").trim().split(/\s+/)[0] ?? "";
172
+ const unwrapped = /^url\((['"]?)(.*)\1\)$/.exec(first)?.[2] ?? first;
173
+ return unwrapped === "" || unwrapped === "none" ? null : unwrapped;
174
+ }
175
+ function degrees(word) {
176
+ const m = measure(word);
177
+ if (m === null) {
178
+ return null;
179
+ }
180
+ if (m[1] !== "rad" && m[1] !== "deg" && m[1] !== "") {
181
+ return null;
182
+ }
183
+ const deg = m[1] === "rad" ? m[0] * 180 / Math.PI : m[0];
184
+ return r6((deg % 360 + 360) % 360);
185
+ }
186
+ function pieces(words, prefix, i) {
187
+ const colors = [];
188
+ const sizes = [];
189
+ const opacities = [];
190
+ for (let k = 1; k <= PIECES; k++) {
191
+ const m = measure(words.get(`${prefix}S${String(k)}`)?.[i]);
192
+ const size = m !== null && (m[1] === "%" || m[1] === "") ? r6(m[0] / 100) : null;
193
+ if (size === null || size <= 0) {
194
+ continue;
195
+ }
196
+ colors.push(words.get(`${prefix}C${String(k)}`)?.[i] ?? "#000000");
197
+ sizes.push(String(size));
198
+ const o = Number(words.get(`${prefix}O${String(k)}`)?.[i] ?? "1");
199
+ opacities.push(String(Number.isFinite(o) ? Math.max(0, Math.min(1, o)) : 1));
200
+ }
201
+ if (colors.length === 0) {
202
+ return null;
203
+ }
204
+ return {
205
+ colors: colors.join(" "),
206
+ sizes: sizes.join(" "),
207
+ opacities: opacities.every((o) => o === "1") ? null : opacities.join(" ")
208
+ };
209
+ }
210
+ function combineFace(n, words, values) {
211
+ const col = (property) => values[property] ??= new Array(n).fill(null);
212
+ const num = (property, i) => {
213
+ const v = values[property]?.[i];
214
+ return typeof v === "number" ? v : null;
215
+ };
216
+ for (let i = 0; i < n; i++) {
217
+ const el = {
218
+ word: (part) => words.get(part)?.[i] ?? null,
219
+ put: (property, value) => {
220
+ col(property)[i] = value;
221
+ },
222
+ // Cytoscape.js's default node is 30 x 30
223
+ w: num("width", i) ?? 30,
224
+ h: num("height", i) ?? 30
225
+ };
226
+ faceImage(el);
227
+ const pie = pieces(words, "_pie", i);
228
+ if (pie !== null) {
229
+ facePie(el, pie);
230
+ }
231
+ const stripe = pieces(words, "_stripe", i);
232
+ if (stripe !== null) {
233
+ faceStripes(el, stripe);
234
+ }
235
+ }
236
+ }
237
+ function faceImage(el) {
238
+ const image = firstImage(el.word("_bgImage"));
239
+ if (image === null) {
240
+ return;
241
+ }
242
+ el.put("image", image);
243
+ const fit = el.word("_bgFit") ?? "none";
244
+ el.put("imageFit", ["none", "contain", "cover"].includes(fit) ? fit : "none");
245
+ imageSize(el);
246
+ imagePlace(el);
247
+ imageLook(el);
248
+ }
249
+ function imageSize(el) {
250
+ const pad = paddingPixels(el.word("_padding"));
251
+ const of = (rel, side) => rel === "inner" ? side : side + 2 * pad;
252
+ const tiled = ["repeat", "repeat-x", "repeat-y"].includes(el.word("_bgRepeat") ?? "");
253
+ const bw = tiled ? null : length(el.word("_bgWidth"), of(el.word("_bgWidthRel"), el.w));
254
+ const bh = tiled ? null : length(el.word("_bgHeight"), of(el.word("_bgHeightRel"), el.h));
255
+ if (bw !== null) {
256
+ el.put("imageWidth", bw);
257
+ }
258
+ if (bh !== null) {
259
+ el.put("imageHeight", bh);
260
+ }
261
+ if (bw === null !== (bh === null)) {
262
+ el.put("imageAutoSize", "natural");
263
+ }
264
+ }
265
+ function imagePlace(el) {
266
+ const px = fraction(el.word("_bgPosX"));
267
+ const py = fraction(el.word("_bgPosY"));
268
+ if (px !== null && px >= 0) {
269
+ el.put("imagePositionX", px);
270
+ }
271
+ if (py !== null && py >= 0) {
272
+ el.put("imagePositionY", py);
273
+ }
274
+ const ox = length(el.word("_bgOffX"), el.w);
275
+ const oy = length(el.word("_bgOffY"), el.h);
276
+ if (ox !== null) {
277
+ el.put("imageOffsetX", ox);
278
+ }
279
+ if (oy !== null) {
280
+ el.put("imageOffsetY", oy);
281
+ }
282
+ }
283
+ function imageLook(el) {
284
+ const repeat = el.word("_bgRepeat");
285
+ if (repeat !== null && ["repeat", "repeat-x", "repeat-y", "no-repeat"].includes(repeat)) {
286
+ el.put("imageRepeat", repeat);
287
+ }
288
+ const clip = el.word("_bgClip");
289
+ if (clip !== null) {
290
+ el.put("imageClip", clip === "none" ? "none" : "node");
291
+ }
292
+ const smooth = el.word("_bgSmooth");
293
+ if (smooth === "yes" || smooth === "no") {
294
+ el.put("imageSmoothing", smooth === "yes");
295
+ }
296
+ const opacity = Number(el.word("_bgOpacity") ?? Number.NaN);
297
+ if (Number.isFinite(opacity)) {
298
+ el.put("imageOpacity", Math.max(0, Math.min(1, opacity)));
299
+ }
300
+ }
301
+ function facePie(el, pie) {
302
+ el.put("pieColors", pie.colors);
303
+ el.put("pieSizes", pie.sizes);
304
+ if (pie.opacities !== null) {
305
+ el.put("pieOpacities", pie.opacities);
306
+ }
307
+ const size = el.word("_pieSize");
308
+ const px = measure(size)?.[1] === "px" ? length(size, null) : null;
309
+ const r = px === null ? fraction(size) : px / Math.min(el.w, el.h);
310
+ if (r !== null) {
311
+ el.put("pieRadius", r6(r));
312
+ }
313
+ const hole = fraction(el.word("_pieHole"));
314
+ if (hole !== null && hole >= 0 && hole <= 1) {
315
+ el.put("pieHole", hole);
316
+ }
317
+ const start = degrees(el.word("_pieStart"));
318
+ if (start !== null) {
319
+ el.put("pieRotation", start);
320
+ }
321
+ }
322
+ function faceStripes(el, stripe) {
323
+ el.put("stripeColors", stripe.colors);
324
+ el.put("stripeSizes", stripe.sizes);
325
+ if (stripe.opacities !== null) {
326
+ el.put("stripeOpacities", stripe.opacities);
327
+ }
328
+ if (el.word("_stripeDir") === "righward") {
329
+ el.put("stripeDirection", "right");
330
+ }
331
+ const size = fraction(el.word("_stripeSize"));
332
+ if (size !== null && size >= 0) {
333
+ el.put("stripeSize", size);
334
+ }
335
+ }
99
336
  const NODE_SHAPES = [
100
337
  "rectangle",
101
338
  "roundrectangle",
@@ -166,7 +403,7 @@ const FONT_WEIGHTS = [
166
403
  800,
167
404
  900
168
405
  ];
169
- const CURVES = [
406
+ const CYJS_CURVE_STYLES = [
170
407
  "bezier",
171
408
  "unbundled-bezier",
172
409
  "haystack",
@@ -195,18 +432,218 @@ const LABEL = [
195
432
  ["font-style", { property: "labelItalic", type: "enum", enums: ["italic", "normal", "oblique"] }],
196
433
  ["visibility", { property: "_visibility", type: "enum", enums: ["hidden", "visible"] }],
197
434
  ["display", { property: "_display", type: "enum", enums: ["element", "none"] }],
198
- ["opacity", { property: "opacity", type: "zeroOne" }]
435
+ ["opacity", { property: "opacity", type: "zeroOne" }],
436
+ ["text-transform", { property: "_transform", type: "enum", enums: ["none", "uppercase", "lowercase"] }],
437
+ ["text-wrap", { property: "_wrap", type: "enum", enums: ["none", "wrap", "ellipsis"] }],
438
+ ["text-overflow-wrap", { property: "_overflowWrap", type: "enum", enums: ["whitespace", "anywhere"] }],
439
+ // how the lines line up; `auto` follows the horizontal alignment (`combineLabelText`)
440
+ ["text-justification", { property: "_justification", type: "enum", enums: ["auto", "left", "center", "right"] }],
441
+ // a width only `text-wrap: wrap` wraps at, so it is combined with the wrap afterward (`combineParts`)
442
+ ["text-max-width", { property: "_maxWidth", type: "size" }],
443
+ // the outline and the background box draw only with a width and an opacity (`combineLabelDress`)
444
+ ["text-outline-color", { property: "_outlineColor", type: "color" }],
445
+ ["text-outline-width", { property: "_outlineWidth", type: "size" }],
446
+ ["text-outline-opacity", { property: "_outlineOpacity", type: "zeroOne" }],
447
+ ["text-background-color", { property: "_backgroundColor", type: "color" }],
448
+ ["text-background-opacity", { property: "_backgroundOpacity", type: "zeroOne" }],
449
+ ["text-background-padding", { property: "_backgroundPadding", type: "size" }],
450
+ [
451
+ "text-background-shape",
452
+ {
453
+ property: "_backgroundShape",
454
+ type: "enum",
455
+ enums: ["rectangle", "round-rectangle", "roundrectangle", "circle"]
456
+ }
457
+ ],
458
+ ["text-rotation", { property: "_rotation", type: "text" }],
459
+ // the words' own opacity, drawn times the element's (`combineLabelOpacity`)
460
+ ["text-opacity", { property: "_textOpacity", type: "zeroOne" }],
461
+ // the label moved right and down by this many pixels from where its alignment puts it, a node's and an edge's
462
+ ["text-margin-x", { property: "labelOffsetX", type: "signedSize" }],
463
+ ["text-margin-y", { property: "labelOffsetY", type: "signedSize" }],
464
+ // the line round the label's box draws only with a width and an opacity above 0 (`combineLabelDress`)
465
+ ["text-border-color", { property: "_textBorderColor", type: "color" }],
466
+ ["text-border-width", { property: "_textBorderWidth", type: "size" }],
467
+ ["text-border-opacity", { property: "_textBorderOpacity", type: "zeroOne" }],
468
+ [
469
+ "text-border-style",
470
+ { property: "_textBorderStyle", type: "enum", enums: ["solid", "dotted", "dashed", "double"] }
471
+ ]
199
472
  ];
473
+ const GRADIENT_DIRECTIONS = [
474
+ "to-bottom",
475
+ "to-top",
476
+ "to-left",
477
+ "to-right",
478
+ "to-bottom-right",
479
+ "to-bottom-left",
480
+ "to-top-right",
481
+ "to-top-left",
482
+ "to-right-bottom",
483
+ "to-left-bottom",
484
+ "to-right-top",
485
+ "to-left-top"
486
+ ];
487
+ const EM_PX = 16;
488
+ function cyjsPointsToNeutral(text2) {
489
+ const n = text2.trim().split(/[\s,]+/).map(Number);
490
+ if (n.length < 6 || n.length % 2 !== 0 || !n.every((v) => Number.isFinite(v))) {
491
+ return null;
492
+ }
493
+ const pairs = [];
494
+ for (let i = 0; i < n.length; i += 2) {
495
+ pairs.push(`${String(round6(n[i]))},${String(round6(-n[i + 1]))}`);
496
+ }
497
+ return pairs.join(" ");
498
+ }
499
+ function neutralPointsToCyjs(points) {
500
+ const n = points.trim().split(/[\s,]+/).map(Number);
501
+ if (n.length < 6 || n.length % 2 !== 0 || !n.every((v) => Number.isFinite(v))) {
502
+ return null;
503
+ }
504
+ const pairs = [];
505
+ for (let i = 0; i < n.length; i += 2) {
506
+ pairs.push(`${String(round6(n[i]))} ${String(round6(-n[i + 1]))}`);
507
+ }
508
+ return pairs.join(" ");
509
+ }
510
+ const round6 = (v) => Math.round(v * 1e6) / 1e6 + 0;
511
+ function fittedHeptagon() {
512
+ const corners = Array.from({ length: 7 }, (_, i) => {
513
+ const angle = Math.PI / 2 + 2 * Math.PI * i / 7;
514
+ return [Math.cos(angle), Math.sin(angle)];
515
+ });
516
+ const [x0, x1] = [Math.min(...corners.map(([x]) => x)), Math.max(...corners.map(([x]) => x))];
517
+ const [y0, y1] = [Math.min(...corners.map(([, y]) => y)), Math.max(...corners.map(([, y]) => y))];
518
+ return corners.map(([x, y]) => `${round6(2 * (x - x0) / (x1 - x0) - 1)},${round6(2 * (y - y0) / (y1 - y0) - 1)}`).join(" ");
519
+ }
520
+ const CYJS_POLYGON_SHAPES = /* @__PURE__ */ new Map([
521
+ ["heptagon", fittedHeptagon()],
522
+ ["round-heptagon", fittedHeptagon()],
523
+ ["tag", "-1,-1 0.25,-1 1,0 0.25,1 -1,1"],
524
+ ["round-tag", "-1,-1 0.25,-1 1,0 0.25,1 -1,1"]
525
+ ]);
526
+ const CYJS_ROUND_SHAPES = /* @__PURE__ */ new Set([
527
+ "round-triangle",
528
+ "round-diamond",
529
+ "round-pentagon",
530
+ "round-hexagon",
531
+ "round-octagon"
532
+ ]);
533
+ function cyjsPolygonShapes(values) {
534
+ const { shape } = values;
535
+ const pointsOf = (v) => typeof v === "string" && v.startsWith("other:") ? CYJS_POLYGON_SHAPES.get(v.slice("other:".length)) : void 0;
536
+ if (Array.isArray(shape)) {
537
+ const col = shape;
538
+ if (!col.some((v) => pointsOf(v) !== void 0)) {
539
+ return;
540
+ }
541
+ const points = Array.isArray(values.shapePoints) ? [...values.shapePoints] : new Array(col.length).fill(null);
542
+ values.shape = col.map((v, i) => {
543
+ const p2 = pointsOf(v);
544
+ if (p2 === void 0) {
545
+ return v;
546
+ }
547
+ points[i] = p2;
548
+ return polygonOf(v);
549
+ });
550
+ values.shapePoints = points;
551
+ return;
552
+ }
553
+ const p = pointsOf(shape);
554
+ if (p !== void 0) {
555
+ values.shape = polygonOf(shape);
556
+ values.shapePoints = p;
557
+ }
558
+ }
559
+ function polygonOf(shape) {
560
+ return typeof shape === "string" && shape.startsWith("other:round-") ? "other:round-polygon" : "polygon";
561
+ }
562
+ const GRADIENT_KINDS = /* @__PURE__ */ new Map([
563
+ ["solid", "none"],
564
+ ["linear-gradient", "linear"],
565
+ ["radial-gradient", "radial"]
566
+ ]);
567
+ function wordsOutsideParens(text2) {
568
+ const closes = new Array(text2.length + 1).fill(false);
569
+ for (let i2 = text2.length - 1; i2 >= 0; i2--) {
570
+ closes[i2] = text2[i2] === ")" || text2[i2] !== "(" && closes[i2 + 1];
571
+ }
572
+ const words = [];
573
+ let start = 0;
574
+ let i = 0;
575
+ while (i < text2.length) {
576
+ if (!/\s/.test(text2[i])) {
577
+ i++;
578
+ continue;
579
+ }
580
+ let end = i + 1;
581
+ while (end < text2.length && /\s/.test(text2[end])) {
582
+ end++;
583
+ }
584
+ if (!closes[end]) {
585
+ words.push(text2.slice(start, i));
586
+ start = end;
587
+ }
588
+ i = end;
589
+ }
590
+ words.push(text2.slice(start));
591
+ return words;
592
+ }
593
+ function gradientColors(text2, site) {
594
+ const hexes = [];
595
+ for (const token of wordsOutsideParens(text2.trim())) {
596
+ const c = token === "" ? null : canonColor(token, "css", site);
597
+ if (c === null) {
598
+ return void 0;
599
+ }
600
+ hexes.push(c.color);
601
+ }
602
+ return hexes.join(" ");
603
+ }
604
+ function gradientStopColors(text2, site) {
605
+ return gradientColors(text2, site)?.split(" ") ?? [];
606
+ }
607
+ function gradientStops(text2) {
608
+ const stops = text2.trim().split(/\s+/).map((t) => t.endsWith("%") ? Number.parseFloat(t) / 100 : Number.parseFloat(t));
609
+ return stops.every((n) => Number.isFinite(n)) ? stops.map((n) => num6(n)).join(" ") : void 0;
610
+ }
611
+ const HALVED = /* @__PURE__ */ new Set(["fanSpacing", "outerBorderOffset"]);
200
612
  const CYJS_NODE_PROPERTIES = new Map([
201
613
  ["background-color", { property: "fill", type: "color" }],
202
614
  ["background-opacity", { property: "fillOpacity", type: "zeroOne" }],
203
615
  ["border-color", { property: "borderColor", type: "color" }],
616
+ // the rings are drawn at their own opacity times the node's (`combineNodeOpacity`)
617
+ ["border-opacity", { property: "_ringOpacity", type: "zeroOne" }],
204
618
  ["border-width", { property: "borderWidth", type: "size" }],
205
619
  ["border-style", { property: "borderStyle", type: "enum", enums: ["solid", "dotted", "dashed", "double"] }],
620
+ // the dashes a dashed border is drawn with and their ends, which decide how it looks (`combineDashes`)
621
+ ["border-dash-pattern", { property: "_dashPattern", type: "text" }],
622
+ ["border-cap", { property: "_dashCap", type: "enum", enums: ["butt", "round", "square"] }],
623
+ // where the border sits against the node's outline: across it, inside it or outside it
624
+ ["border-position", { property: "borderPosition", type: "enum", enums: ["center", "inside", "outside"] }],
625
+ ["outline-color", { property: "outerBorderColor", type: "color" }],
626
+ ["outline-opacity", { property: "_outlineRingOpacity", type: "zeroOne" }],
627
+ ["outline-width", { property: "outerBorderWidth", type: "size" }],
628
+ ["outline-style", { property: "outerBorderStyle", type: "enum", enums: ["solid", "dotted", "dashed", "double"] }],
629
+ ["outline-offset", { property: "outerBorderOffset", type: "size" }],
630
+ ["underlay-color", { property: "underlayColor", type: "color" }],
631
+ ["underlay-opacity", { property: "underlayOpacity", type: "zeroOne" }],
632
+ ["underlay-padding", { property: "underlayPadding", type: "size" }],
633
+ ["underlay-shape", { property: "underlayShape", type: "enum", enums: NODE_SHAPES }],
634
+ ["underlay-corner-radius", { property: "underlayCornerRadius", type: "size" }],
635
+ ["overlay-color", { property: "overlayColor", type: "color" }],
636
+ ["overlay-opacity", { property: "overlayOpacity", type: "zeroOne" }],
637
+ ["overlay-padding", { property: "overlayPadding", type: "size" }],
638
+ ["overlay-shape", { property: "overlayShape", type: "enum", enums: NODE_SHAPES }],
639
+ ["overlay-corner-radius", { property: "overlayCornerRadius", type: "size" }],
206
640
  ["shape", { property: "shape", type: "enum", enums: NODE_SHAPES }],
641
+ ["shape-polygon-points", { property: "shapePoints", type: "text" }],
207
642
  ["corner-radius", { property: "cornerRadius", type: "size" }],
208
643
  ["width", { property: "width", type: "nodeSize" }],
209
644
  ["height", { property: "height", type: "nodeSize" }],
645
+ // a node is drawn this much larger on every side (`nodeSizes`)
646
+ ["padding", { property: "_padding", type: "text" }],
210
647
  [
211
648
  "text-valign",
212
649
  { property: "_valign", type: "enum", enums: ["top", "top-inside", "center", "bottom", "bottom-inside"] }
@@ -215,30 +652,106 @@ const CYJS_NODE_PROPERTIES = new Map([
215
652
  "text-halign",
216
653
  { property: "_halign", type: "enum", enums: ["left", "left-inside", "center", "right", "right-inside"] }
217
654
  ],
655
+ // the fill's gradient, combined afterward into `fill`, `fillGradient`, `fillGradientAngle` and the other
656
+ // `fillGradient*` properties
657
+ [
658
+ "background-fill",
659
+ { property: "_backgroundFill", type: "enum", enums: ["solid", "linear-gradient", "radial-gradient"] }
660
+ ],
661
+ ["background-gradient-stop-colors", { property: "_backgroundStops", type: "text" }],
662
+ ["background-gradient-stop-positions", { property: "_backgroundPositions", type: "text" }],
663
+ ["background-gradient-direction", { property: "_backgroundDirection", type: "enum", enums: GRADIENT_DIRECTIONS }],
664
+ ...CYJS_FACE_PROPERTIES,
218
665
  ...LABEL
219
666
  ]);
220
667
  const CYJS_EDGE_PROPERTIES = new Map([
221
668
  ["line-color", { property: "color", type: "color" }],
222
669
  ["width", { property: "width", type: "nodeSize" }],
223
670
  ["line-style", { property: "lineStyle", type: "enum", enums: ["solid", "dotted", "dashed"] }],
671
+ // the dashes a dashed line is drawn with and their ends, which decide how it looks (`combineDashes`)
672
+ ["line-dash-pattern", { property: "_dashPattern", type: "text" }],
673
+ ["line-cap", { property: "_dashCap", type: "enum", enums: ["butt", "round", "square"] }],
674
+ // the line's own opacity, combined afterward into `opacity`, which the line is drawn at
675
+ ["line-opacity", { property: "_lineOpacity", type: "zeroOne" }],
676
+ ["line-outline-width", { property: "outlineWidth", type: "size" }],
677
+ ["line-fill", { property: "gradientKind", type: "enum", enums: ["solid", "linear-gradient", "radial-gradient"] }],
678
+ ["line-gradient-stop-colors", { property: "gradientColors", type: "text" }],
679
+ ["line-gradient-stop-positions", { property: "gradientStops", type: "text" }],
680
+ ["line-outline-color", { property: "outlineColor", type: "color" }],
681
+ ["underlay-color", { property: "underlayColor", type: "color" }],
682
+ ["underlay-opacity", { property: "underlayOpacity", type: "zeroOne" }],
683
+ ["underlay-padding", { property: "underlayPadding", type: "size" }],
684
+ ["overlay-color", { property: "overlayColor", type: "color" }],
685
+ ["overlay-opacity", { property: "overlayOpacity", type: "zeroOne" }],
686
+ ["overlay-padding", { property: "overlayPadding", type: "size" }],
224
687
  ["target-arrow-shape", { property: "targetArrow", type: "enum", enums: ARROWS }],
225
688
  ["source-arrow-shape", { property: "sourceArrow", type: "enum", enums: ARROWS }],
226
689
  ["target-arrow-color", { property: "targetArrowColor", type: "color" }],
227
690
  ["source-arrow-color", { property: "sourceArrowColor", type: "color" }],
691
+ ["mid-target-arrow-shape", { property: "midTargetArrow", type: "enum", enums: ARROWS }],
692
+ ["mid-source-arrow-shape", { property: "midSourceArrow", type: "enum", enums: ARROWS }],
693
+ ["mid-target-arrow-color", { property: "midTargetArrowColor", type: "color" }],
694
+ ["mid-source-arrow-color", { property: "midSourceArrowColor", type: "color" }],
695
+ // filled or hollow: combined with the shape afterward (`combineParts`), a hollow triangle being `triangle-open`
228
696
  ["target-arrow-fill", { property: "_targetArrowFill", type: "enum", enums: ["filled", "hollow"] }],
229
697
  ["source-arrow-fill", { property: "_sourceArrowFill", type: "enum", enums: ["filled", "hollow"] }],
230
- ["curve-style", { property: "curved", type: "enum", enums: CURVES }],
698
+ ["mid-target-arrow-fill", { property: "_midTargetArrowFill", type: "enum", enums: ["filled", "hollow"] }],
699
+ ["mid-source-arrow-fill", { property: "_midSourceArrowFill", type: "enum", enums: ["filled", "hollow"] }],
700
+ ["curve-style", { property: "curved", type: "enum", enums: CYJS_CURVE_STYLES }],
701
+ // a route's settings, read by the routes (`edgeRoutes`) as Cytoscape.js spells them
702
+ ["segment-distances", { property: "_segmentDistances", type: "text" }],
703
+ ["segment-weights", { property: "_segmentWeights", type: "text" }],
704
+ ["control-point-distances", { property: "_controlPointDistances", type: "text" }],
705
+ ["control-point-weights", { property: "_controlPointWeights", type: "text" }],
706
+ ["taxi-direction", { property: "_taxiDirection", type: "text" }],
707
+ ["taxi-turn", { property: "_taxiTurn", type: "text" }],
708
+ ["taxi-turn-min-distance", { property: "_taxiTurnMinDistance", type: "size" }],
709
+ ["edge-distances", { property: "_edgeDistances", type: "text" }],
710
+ ["loop-direction", { property: "_loopDirection", type: "text" }],
711
+ ["loop-sweep", { property: "_loopSweep", type: "text" }],
712
+ ["segment-radii", { property: "_segmentRadii", type: "text" }],
713
+ ["taxi-radius", { property: "_taxiRadius", type: "text" }],
714
+ ["radius-type", { property: "_radiusType", type: "text" }],
715
+ // where the ends meet the nodes, read with the routes (`edgePorts`)
716
+ ["source-endpoint", { property: "_sourceEndpoint", type: "text" }],
717
+ ["target-endpoint", { property: "_targetEndpoint", type: "text" }],
718
+ // a bundle's control points are this far apart, so the curves' middles half of it (see cyjsNeutral)
719
+ ["control-point-step-size", { property: "fanSpacing", type: "size" }],
231
720
  ["arrow-scale", { property: "arrowSize", type: "positive" }],
232
721
  ["source-label", { property: "sourceLabel", type: "text" }],
233
722
  ["target-label", { property: "targetLabel", type: "text" }],
723
+ ["source-text-offset", { property: "sourceLabelOffset", type: "size" }],
724
+ ["target-text-offset", { property: "targetLabelOffset", type: "size" }],
725
+ ["source-text-margin-x", { property: "sourceLabelOffsetX", type: "signedSize" }],
726
+ ["source-text-margin-y", { property: "sourceLabelOffsetY", type: "signedSize" }],
727
+ ["target-text-margin-x", { property: "targetLabelOffsetX", type: "signedSize" }],
728
+ ["target-text-margin-y", { property: "targetLabelOffsetY", type: "signedSize" }],
729
+ // an angle, or autorotate along the line, which the routes work out (`autorotateLabels`)
730
+ ["source-text-rotation", { property: "_sourceRotation", type: "text" }],
731
+ ["target-text-rotation", { property: "_targetRotation", type: "text" }],
234
732
  ...LABEL
235
733
  ]);
236
734
  function cyjsProperties(target) {
237
735
  return target === "node" ? CYJS_NODE_PROPERTIES : CYJS_EDGE_PROPERTIES;
238
736
  }
737
+ const CYJS_ALIASES = /* @__PURE__ */ new Map([
738
+ ["content", "label"],
739
+ ["control-point-distance", "control-point-distances"],
740
+ ["control-point-weight", "control-point-weights"],
741
+ ["segment-distance", "segment-distances"],
742
+ ["segment-weight", "segment-weights"],
743
+ ["segment-radius", "segment-radii"],
744
+ ["edge-text-rotation", "text-rotation"],
745
+ ["padding-left", "padding"],
746
+ ["padding-right", "padding"],
747
+ ["padding-top", "padding"],
748
+ ["padding-bottom", "padding"]
749
+ ]);
750
+ function cyjsAliasOf(dashed) {
751
+ return CYJS_ALIASES.get(dashed) ?? dashed;
752
+ }
239
753
  function cyjsPropertyName(name) {
240
- const dashed = name.replaceAll(/[A-Z]/g, (c) => `-${c.toLowerCase()}`);
241
- return dashed === "content" ? "label" : dashed;
754
+ return cyjsAliasOf(name.replaceAll(/[A-Z]/g, (c) => `-${c.toLowerCase()}`));
242
755
  }
243
756
  const CYJS_THROWS = "throws";
244
757
  const NUM = String.raw`[-+]?(?:(?:\d+|\d*\.\d+)(?:[Ee][+-]?\d+)?)`;
@@ -361,8 +874,8 @@ function isFontChar(c) {
361
874
  function isSpace$1(c) {
362
875
  return /\s/.test(c);
363
876
  }
364
- function allOf(text, test) {
365
- return Array.from(text).every(test);
877
+ function allOf(text2, test) {
878
+ return Array.from(text2).every(test);
366
879
  }
367
880
  function firstFontPart(part) {
368
881
  let a = 0;
@@ -401,13 +914,14 @@ function parseFlat(spec, raw, rendered = false) {
401
914
  return ok ? { kind: "number", value: x, units: null, str: String(x) } : null;
402
915
  }
403
916
  case "size":
917
+ case "signedSize":
404
918
  case "nodeSize":
405
919
  return parseSizeValue(spec, value, raw);
406
920
  case "text":
407
921
  return { kind: "word", value: String(value), str: String(value) };
408
922
  case "fontFamily": {
409
- const text = String(value);
410
- return isFontFamily(text) ? { kind: "word", value: text, str: text } : null;
923
+ const text2 = String(value);
924
+ return isFontFamily(text2) ? { kind: "word", value: text2, str: text2 } : null;
411
925
  }
412
926
  case "fontWeight":
413
927
  case "enum": {
@@ -433,21 +947,21 @@ function parseColorValue(value) {
433
947
  }
434
948
  function parseSizeValue(spec, value, raw) {
435
949
  let units = "px";
436
- let text = value;
950
+ let text2 = value;
437
951
  if (typeof value === "string") {
438
952
  const m = NUMBER_UNITS.exec(value);
439
953
  if (m === null) {
440
954
  units = null;
441
955
  } else {
442
- text = m[1];
956
+ text2 = m[1];
443
957
  units = m.at(2) === "em" ? "em" : "px";
444
958
  }
445
959
  }
446
- const x = Number.parseFloat(String(text));
960
+ const x = Number.parseFloat(String(text2));
447
961
  if (Number.isNaN(x)) {
448
962
  return spec.type === "nodeSize" && raw === "label" ? { kind: "word", value: "label", str: "label" } : null;
449
963
  }
450
- return x < 0 ? null : { kind: "number", value: x, units, str: `${String(x)}${units ?? ""}` };
964
+ return x < 0 && spec.type !== "signedSize" ? null : { kind: "number", value: x, units, str: `${String(x)}${units ?? ""}` };
451
965
  }
452
966
  function splitArgs(inner) {
453
967
  const out = [];
@@ -518,7 +1032,7 @@ function parseMapData(spec, value, mode) {
518
1032
  if (mode === "bypass") {
519
1033
  return null;
520
1034
  }
521
- const numeric = spec.type === "zeroOne" || spec.type === "positive" || spec.type === "size" || spec.type === "nodeSize";
1035
+ const numeric = spec.type === "zeroOne" || spec.type === "positive" || spec.type === "size" || spec.type === "signedSize" || spec.type === "nodeSize";
522
1036
  if (spec.type !== "color" && !numeric) {
523
1037
  return null;
524
1038
  }
@@ -579,51 +1093,71 @@ function applyCyjsMapper(spec, m, data) {
579
1093
  }
580
1094
  return null;
581
1095
  }
1096
+ function colorNeutral(v, site) {
1097
+ if (v.rgb.some((c) => !Number.isFinite(c) || c < 0 || c > 255)) {
1098
+ site.notes.add(STYLE_ISSUE.BAD_VALUE, site.target, site.property, {
1099
+ sample: v.str,
1100
+ element: site.element
1101
+ });
1102
+ return void 0;
1103
+ }
1104
+ return `#${v.rgb.map((c) => Math.round(c).toString(16).padStart(2, "0")).join("")}`;
1105
+ }
582
1106
  function cyjsNeutral(spec, v, site) {
583
1107
  switch (v.kind) {
584
- case "color": {
585
- if (v.rgb.some((c) => !Number.isFinite(c) || c < 0 || c > 255)) {
586
- site.notes.add(STYLE_ISSUE.BAD_VALUE, site.target, site.property, {
587
- sample: v.str,
588
- element: site.element
589
- });
590
- return void 0;
591
- }
592
- return `#${v.rgb.map((c) => Math.round(c).toString(16).padStart(2, "0")).join("")}`;
593
- }
1108
+ case "color":
1109
+ return colorNeutral(v, site);
594
1110
  case "number":
595
- if (v.units === "em") {
596
- site.notes.add(STYLE_ISSUE.BAD_VALUE, site.target, site.property, {
597
- sample: v.str,
598
- element: site.element
599
- });
600
- return void 0;
601
- }
602
- return num6(v.value);
1111
+ return num6((HALVED.has(spec.property) ? v.value / 2 : v.value) * (v.units === "em" ? EM_PX : 1));
603
1112
  }
604
1113
  const word = v.value;
605
1114
  switch (spec.property) {
606
1115
  case "width":
607
1116
  case "height":
608
- site.notes.add(STYLE_ISSUE.BAD_VALUE, site.target, site.property, { sample: v.str, element: site.element });
1117
+ if (site.target === "edge") {
1118
+ site.notes.add(STYLE_ISSUE.BAD_VALUE, site.target, site.property, {
1119
+ sample: v.str,
1120
+ element: site.element
1121
+ });
1122
+ }
609
1123
  return void 0;
610
1124
  case "label":
611
1125
  case "sourceLabel":
612
1126
  case "targetLabel":
613
1127
  case "labelFont":
614
1128
  return String(word);
1129
+ case "gradientKind":
1130
+ return GRADIENT_KINDS.get(String(word)) ?? void 0;
1131
+ case "gradientColors":
1132
+ return gradientColors(String(word), site);
1133
+ case "gradientStops":
1134
+ return gradientStops(String(word));
615
1135
  case "labelItalic":
616
1136
  return word === "italic" || word === "oblique";
617
1137
  case "curved":
618
1138
  return !STRAIGHT.has(String(word));
619
- case "shape":
1139
+ case "shapePoints":
1140
+ return cyjsPointsToNeutral(String(word)) ?? void 0;
1141
+ case "underlayShape":
1142
+ case "overlayShape":
620
1143
  return canonEnum("shape", String(word), "cytoscape-js", site) ?? void 0;
1144
+ case "shape": {
1145
+ const polygon = String(word).toLowerCase();
1146
+ if (polygon === "polygon") {
1147
+ return "polygon";
1148
+ }
1149
+ return CYJS_POLYGON_SHAPES.has(polygon) || CYJS_ROUND_SHAPES.has(polygon) ? `other:${polygon}` : canonEnum("shape", String(word), "cytoscape-js", site) ?? void 0;
1150
+ }
621
1151
  case "borderStyle":
622
1152
  return canonEnum("borderStyle", String(word), "cytoscape-js", site) ?? void 0;
1153
+ case "outerBorderStyle":
1154
+ return word === "double" ? "solid" : canonEnum("borderStyle", String(word), "cytoscape-js", site) ?? void 0;
623
1155
  case "lineStyle":
624
1156
  return canonEnum("lineStyle", String(word), "cytoscape-js", site) ?? void 0;
625
1157
  case "sourceArrow":
626
1158
  case "targetArrow":
1159
+ case "midSourceArrow":
1160
+ case "midTargetArrow":
627
1161
  return canonEnum("arrow", String(word), "cytoscape-js", site) ?? void 0;
628
1162
  case "labelWeight":
629
1163
  return canonEnum("weight", String(word), "cytoscape-js", site) ?? void 0;
@@ -642,6 +1176,236 @@ function cyjsRendered(target, name, str, site) {
642
1176
  }
643
1177
  return cyjsNeutral(spec, v, site);
644
1178
  }
1179
+ function cyjsDashLook(dash, width, cap) {
1180
+ const pairs = dash.length % 2 === 1 ? [...dash, ...dash] : [...dash];
1181
+ const grow = cap === "butt" ? 0 : width;
1182
+ const on = pairs.filter((_, i) => i % 2 === 0).map((d) => Math.max(0, d) + grow);
1183
+ const off = pairs.filter((_, i) => i % 2 === 1).map((d) => Math.max(0, d - grow));
1184
+ const sum = (xs) => xs.reduce((a, b) => a + b, 0);
1185
+ if (sum(off) <= 0.1 * (sum(on) + sum(off))) {
1186
+ return "solid";
1187
+ }
1188
+ if (on.every((d) => d <= Math.max(1, width) * 1.5)) {
1189
+ return "dotted";
1190
+ }
1191
+ return Math.max(...on) >= 2 * Math.min(...on) ? "dash-dot" : "dashed";
1192
+ }
1193
+ function lengths(text2) {
1194
+ const out = text2.trim().split(/\s+/).map((t) => Number.parseFloat(t));
1195
+ return out.every((n) => Number.isFinite(n)) ? out : [];
1196
+ }
1197
+ function radians(text2) {
1198
+ const t = text2.trim();
1199
+ const x = Number.parseFloat(t);
1200
+ return t.endsWith("deg") ? x * Math.PI / 180 : x;
1201
+ }
1202
+ function outlinePoint(node, toward) {
1203
+ const [cx, cy] = node.center;
1204
+ const dx = toward[0] - cx;
1205
+ const dy = toward[1] - cy;
1206
+ const [hw, hh] = [node.size[0] / 2, node.size[1] / 2];
1207
+ if (dx === 0 && dy === 0 || hw <= 0 || hh <= 0) {
1208
+ return node.center;
1209
+ }
1210
+ const t = node.ellipse ? 1 / Math.hypot(dx / hw, dy / hh) : Math.min(axisReach(dx, hw), axisReach(dy, hh));
1211
+ return [cx + dx * t, cy + dy * t];
1212
+ }
1213
+ function axisReach(d, half) {
1214
+ return d === 0 ? Infinity : half / Math.abs(d);
1215
+ }
1216
+ function measureLine(edge, src, tgt) {
1217
+ const a0 = outlinePoint(src, tgt.center);
1218
+ const b0 = outlinePoint(tgt, src.center);
1219
+ const dx = b0[0] - a0[0];
1220
+ const dy = b0[1] - a0[1];
1221
+ const l = Math.hypot(dx, dy) || 1;
1222
+ const normal = [-dy / l, dx / l];
1223
+ return edge.edgeDistances === "node-position" ? { a: src.center, b: tgt.center, normal } : { a: a0, b: b0, normal };
1224
+ }
1225
+ function offsetPoints(line, weights, distances) {
1226
+ const n = Math.min(weights.length, distances.length);
1227
+ return Array.from({ length: n }, (_, s) => {
1228
+ const w = weights[s];
1229
+ const d = distances[s];
1230
+ return [
1231
+ line.a[0] * (1 - w) + line.b[0] * w + line.normal[0] * d,
1232
+ line.a[1] * (1 - w) + line.b[1] * w + line.normal[1] * d
1233
+ ];
1234
+ });
1235
+ }
1236
+ function taxiPoints(edge, src, tgt) {
1237
+ const body = edge.edgeDistances !== "node-position";
1238
+ const [x1, y1] = src.center;
1239
+ const [x2, y2] = tgt.center;
1240
+ const [srcW, srcH] = src.size;
1241
+ const [tgtW, tgtH] = tgt.size;
1242
+ const pdx = x2 - x1;
1243
+ const pdy = y2 - y1;
1244
+ const dx = towardZero(pdx, body ? (srcW + tgtW) / 2 : 0);
1245
+ const dy = towardZero(pdy, body ? (srcH + tgtH) / 2 : 0);
1246
+ const raw = edge.taxiDirection ?? "auto";
1247
+ const vertical = raw === "auto" ? Math.abs(dx) <= Math.abs(dy) : raw === "vertical" || raw === "upward" || raw === "downward";
1248
+ const [along, pl] = vertical ? [dy, pdy] : [dx, pdx];
1249
+ const { d, l, sgn, forced } = taxiTurn(edge, raw, along, pl);
1250
+ const minD = edge.taxiTurnMinDistance ?? 10;
1251
+ const tooClose = (v) => Math.abs(v) < minD || Math.abs(v) >= Math.abs(l);
1252
+ if ((tooClose(d) || tooClose(Math.abs(l) - Math.abs(d))) && !forced) {
1253
+ return taxiFallback(vertical, { x1, y1, x2, y2, pl, pdx, pdy }, src.size, tgt.size);
1254
+ }
1255
+ const srcAlong = vertical ? srcH : srcW;
1256
+ const out = body ? srcAlong / 2 * sgn : 0;
1257
+ if (vertical) {
1258
+ const y = y1 + d + out;
1259
+ return [
1260
+ [x1, y],
1261
+ [x2, y]
1262
+ ];
1263
+ }
1264
+ const x = x1 + d + out;
1265
+ return [
1266
+ [x, y1],
1267
+ [x, y2]
1268
+ ];
1269
+ }
1270
+ function towardZero(v, gap) {
1271
+ return v > 0 ? Math.max(v - gap, 0) : Math.min(v + gap, 0);
1272
+ }
1273
+ function taxiTurn(edge, raw, along, pl) {
1274
+ const explicit = raw !== "auto" && raw !== "vertical" && raw !== "horizontal";
1275
+ const turnText = (edge.taxiTurn ?? "50%").trim();
1276
+ const percent = turnText.endsWith("%");
1277
+ const turn = percent ? Number.parseFloat(turnText) / 100 : Number.parseFloat(turnText);
1278
+ const forced = !(explicit && (percent || turn < 0)) && runsAgainst(raw, pl);
1279
+ const sgn = forced ? -Math.sign(pl) : Math.sign(pl);
1280
+ const l = forced ? sgn * Math.abs(along) : along;
1281
+ if (percent) {
1282
+ return { d: (turn < 0 ? 1 + turn : turn) * l, l, sgn, forced };
1283
+ }
1284
+ return { d: (turn < 0 ? l : 0) + turn * sgn, l, sgn, forced };
1285
+ }
1286
+ function runsAgainst(raw, pl) {
1287
+ return raw === "downward" && pl < 0 || raw === "upward" && pl > 0 || raw === "leftward" && pl > 0 || raw === "rightward" && pl < 0;
1288
+ }
1289
+ function taxiFallback(vertical, p, srcSize, tgtSize) {
1290
+ const { x1, y1, x2, y2, pl, pdx, pdy } = p;
1291
+ const midX = (x1 + x2) / 2;
1292
+ const midY = (y1 + y2) / 2;
1293
+ if (vertical) {
1294
+ if (Math.abs(pl) <= srcSize[1] / 2) {
1295
+ return [
1296
+ [midX, y1],
1297
+ [midX, y2]
1298
+ ];
1299
+ }
1300
+ if (Math.abs(pdx) <= tgtSize[0] / 2) {
1301
+ return [
1302
+ [x1, midY],
1303
+ [x2, midY]
1304
+ ];
1305
+ }
1306
+ return [[x1, y2]];
1307
+ }
1308
+ if (Math.abs(pl) <= srcSize[0] / 2) {
1309
+ return [
1310
+ [x1, midY],
1311
+ [x2, midY]
1312
+ ];
1313
+ }
1314
+ if (Math.abs(pdy) <= tgtSize[1] / 2) {
1315
+ return [
1316
+ [midX, y1],
1317
+ [midX, y2]
1318
+ ];
1319
+ }
1320
+ return [[x2, y1]];
1321
+ }
1322
+ function splinePoints(src, tgt, controls) {
1323
+ const start = outlinePoint(src, controls[0]);
1324
+ const end = outlinePoint(tgt, controls.at(-1) ?? tgt.center);
1325
+ return flattenQuadSpline([start, ...controls, end], 0).slice(1, -1);
1326
+ }
1327
+ function cyjsRoute(edge, src, tgt, loopIndex) {
1328
+ const style = edge.curveStyle;
1329
+ if (style === "haystack") {
1330
+ return null;
1331
+ }
1332
+ if (src === tgt) {
1333
+ return loopRoute(edge, src, loopIndex);
1334
+ }
1335
+ let points = [];
1336
+ if (style.endsWith("segments")) {
1337
+ const distances = lengths(edge.segmentDistances ?? "20");
1338
+ const weights = lengths(edge.segmentWeights ?? "0.5");
1339
+ points = offsetPoints(measureLine(edge, src, tgt), weights, distances);
1340
+ } else if (style.endsWith("taxi")) {
1341
+ points = taxiPoints(edge, src, tgt);
1342
+ } else if (style === "unbundled-bezier") {
1343
+ const distances = lengths(edge.controlPointDistances ?? String(edge.controlPointStepSize ?? 40));
1344
+ const weights = lengths(edge.controlPointWeights ?? "0.5");
1345
+ const controls = offsetPoints(measureLine(edge, src, tgt), weights, distances);
1346
+ points = controls.length === 0 ? [] : splinePoints(src, tgt, controls);
1347
+ }
1348
+ if (points.length > 0 && style.startsWith("round-")) {
1349
+ const radii = lengths((style === "round-taxi" ? edge.taxiRadius : edge.segmentRadii) ?? "15");
1350
+ const types = (edge.radiusType ?? "arc-radius").trim().split(/\s+/);
1351
+ const start = outlinePoint(src, points[0]);
1352
+ const end = outlinePoint(tgt, points.at(-1) ?? tgt.center);
1353
+ points = roundedCorners([start, ...points, end], radii, types).slice(1, -1);
1354
+ }
1355
+ return points.length === 0 ? null : canonBends(src.center, tgt.center, points, true);
1356
+ }
1357
+ const ARC_STEPS = 8;
1358
+ function roundedCorners(line, radii, types) {
1359
+ const out = [line[0]];
1360
+ for (let i = 1; i < line.length - 1; i++) {
1361
+ const [p, a, b] = [line[i], line[i - 1], line[i + 1]];
1362
+ const r = radii[Math.min(i - 1, radii.length - 1)] ?? 15;
1363
+ const arc = (types[Math.min(i - 1, types.length - 1)] ?? "arc-radius") !== "influence-radius";
1364
+ const l1 = Math.hypot(a[0] - p[0], a[1] - p[1]);
1365
+ const l2 = Math.hypot(b[0] - p[0], b[1] - p[1]);
1366
+ const u1 = [(a[0] - p[0]) / l1, (a[1] - p[1]) / l1];
1367
+ const u2 = [(b[0] - p[0]) / l2, (b[1] - p[1]) / l2];
1368
+ const angle = Math.acos(Math.max(-1, Math.min(1, u1[0] * u2[0] + u1[1] * u2[1])));
1369
+ const half = angle / 2;
1370
+ const rounds = r > 0 && l1 > 0 && l2 > 0;
1371
+ if (!rounds || Math.abs(Math.PI - angle) < 1e-6) {
1372
+ out.push(p);
1373
+ continue;
1374
+ }
1375
+ const limit = Math.min(l1 / 2, l2 / 2);
1376
+ const back = Math.min(limit, arc ? r / Math.tan(half) : r);
1377
+ const radius = back * Math.tan(half);
1378
+ const bis = [u1[0] + u2[0], u1[1] + u2[1]];
1379
+ const bl = Math.hypot(bis[0], bis[1]);
1380
+ const reach = Math.hypot(back, radius);
1381
+ const c = [p[0] + bis[0] / bl * reach, p[1] + bis[1] / bl * reach];
1382
+ const from = Math.atan2(p[1] + u1[1] * back - c[1], p[0] + u1[0] * back - c[0]);
1383
+ const to = Math.atan2(p[1] + u2[1] * back - c[1], p[0] + u2[0] * back - c[0]);
1384
+ let sweep = to - from;
1385
+ sweep -= 2 * Math.PI * Math.round(sweep / (2 * Math.PI));
1386
+ for (let k = 0; k <= ARC_STEPS; k++) {
1387
+ const t = from + sweep * k / ARC_STEPS;
1388
+ out.push([c[0] + Math.cos(t) * radius, c[1] + Math.sin(t) * radius]);
1389
+ }
1390
+ }
1391
+ out.push(line.at(-1) ?? line[0]);
1392
+ return out;
1393
+ }
1394
+ function loopRoute(edge, node, loopIndex) {
1395
+ const unbundled = edge.curveStyle === "unbundled-bezier";
1396
+ const dist = unbundled ? lengths(edge.controlPointDistances ?? "").at(0) ?? Number.NaN : edge.controlPointStepSize ?? 40;
1397
+ const dir = radians(edge.loopDirection ?? "-45deg");
1398
+ const sweep = radians(edge.loopSweep ?? "-90deg");
1399
+ if (!Number.isFinite(dist + dir + sweep)) {
1400
+ return null;
1401
+ }
1402
+ const angle = dir - Math.PI / 2;
1403
+ const reach = 1.4 * dist * (loopIndex / 3 + 1);
1404
+ const [cx, cy] = node.center;
1405
+ const at = (a) => [cx + Math.cos(a) * reach, cy + Math.sin(a) * reach];
1406
+ const points = splinePoints(node, node, [at(angle - sweep / 2), at(angle + sweep / 2)]);
1407
+ return canonNodeOffsets(node.center, node.box, points, true);
1408
+ }
645
1409
  const CYJS_STATES = /* @__PURE__ */ new Set([
646
1410
  "selected",
647
1411
  "unselected",
@@ -688,8 +1452,8 @@ function isSpace(c) {
688
1452
  return c !== void 0 && /\s/.test(c);
689
1453
  }
690
1454
  class Cursor {
691
- constructor(text) {
692
- this.text = text;
1455
+ constructor(text2) {
1456
+ this.text = text2;
693
1457
  this.pos = 0;
694
1458
  }
695
1459
  /**
@@ -832,8 +1596,8 @@ function cleanMeta(raw) {
832
1596
  }
833
1597
  return out;
834
1598
  }
835
- function splitOp(text) {
836
- let op = text;
1599
+ function splitOp(text2) {
1600
+ let op = text2;
837
1601
  let not = false;
838
1602
  let ci = false;
839
1603
  if (op.includes("!")) {
@@ -1070,17 +1834,17 @@ function metaToken(c, i) {
1070
1834
  const { op: base, not, ci } = splitOp(op.text);
1071
1835
  return checkToken(c.spaceEnd(end) + 2, { type: "meta", field, op: base, not, ci, value });
1072
1836
  }
1073
- function isBlank(text) {
1074
- return /^\s*$/.test(text.length > 1024 ? text.slice(0, 1024) : text) && text.trim() === "";
1837
+ function isBlank(text2) {
1838
+ return /^\s*$/.test(text2.length > 1024 ? text2.slice(0, 1024) : text2) && text2.trim() === "";
1075
1839
  }
1076
- function parseCyjsSelector(text) {
1077
- if (typeof text !== "string" || isBlank(text)) {
1840
+ function parseCyjsSelector(text2) {
1841
+ if (typeof text2 !== "string" || isBlank(text2)) {
1078
1842
  return { queries: [], invalid: false };
1079
1843
  }
1080
- if (text.length > MAX_SELECTOR_LENGTH) {
1844
+ if (text2.length > MAX_SELECTOR_LENGTH) {
1081
1845
  return { queries: [], invalid: true };
1082
1846
  }
1083
- const c = new Cursor(text);
1847
+ const c = new Cursor(text2);
1084
1848
  const first = { checks: [] };
1085
1849
  const b = { queries: [first], subject: null, edgeCount: 0, compoundCount: 0, counts: [] };
1086
1850
  let current = first;
@@ -1098,7 +1862,7 @@ function parseCyjsSelector(text) {
1098
1862
  current = next;
1099
1863
  }
1100
1864
  c.pos = tok.end;
1101
- if (c.spaceEnd(c.pos) >= text.length) {
1865
+ if (c.spaceEnd(c.pos) >= text2.length) {
1102
1866
  break;
1103
1867
  }
1104
1868
  }
@@ -1108,22 +1872,22 @@ function parseCyjsSelector(text) {
1108
1872
  }
1109
1873
  const LINE = /[\n\r\u2028\u2029]/;
1110
1874
  const SPACE = /\s/;
1111
- function stripComments(text) {
1875
+ function stripComments(text2) {
1112
1876
  let out = "";
1113
1877
  let from = 0;
1114
1878
  for (; ; ) {
1115
- const open = text.indexOf("/*", from);
1879
+ const open = text2.indexOf("/*", from);
1116
1880
  if (open < 0) {
1117
1881
  break;
1118
1882
  }
1119
- const close = text.indexOf("*/", open + 3);
1883
+ const close = text2.indexOf("*/", open + 3);
1120
1884
  if (close < 0) {
1121
1885
  break;
1122
1886
  }
1123
- out += text.slice(from, open);
1887
+ out += text2.slice(from, open);
1124
1888
  from = close + 2;
1125
1889
  }
1126
- return out + text.slice(from);
1890
+ return out + text2.slice(from);
1127
1891
  }
1128
1892
  function skipSpace(s, i) {
1129
1893
  let j = i;
@@ -1180,8 +1944,8 @@ function nextNonSpace(s) {
1180
1944
  }
1181
1945
  return next;
1182
1946
  }
1183
- function parseCyjsStylesheetText(text) {
1184
- const s = stripComments(text);
1947
+ function parseCyjsStylesheetText(text2) {
1948
+ const s = stripComments(text2);
1185
1949
  const entries = [];
1186
1950
  let pos = 0;
1187
1951
  while (skipSpace(s, pos) < s.length) {
@@ -1282,14 +2046,14 @@ function parentsOf(nodes, ids) {
1282
2046
  if (raw === void 0 || raw === null) {
1283
2047
  continue;
1284
2048
  }
1285
- const text = typeof raw === "number" && !Number.isNaN(raw) ? String(raw) : raw;
1286
- const p = typeof text === "string" ? ids.get(text) : void 0;
2049
+ const text2 = typeof raw === "number" && !Number.isNaN(raw) ? String(raw) : raw;
2050
+ const p = typeof text2 === "string" ? ids.get(text2) : void 0;
1287
2051
  if (p === void 0 || p < 0) {
1288
2052
  nodes[i].overrides.set("parent", void 0);
1289
2053
  continue;
1290
2054
  }
1291
2055
  if (typeof raw === "number") {
1292
- nodes[i].overrides.set("parent", text);
2056
+ nodes[i].overrides.set("parent", text2);
1293
2057
  }
1294
2058
  if (rootOf(p) === i) {
1295
2059
  nodes[i].overrides.set("parent", void 0);
@@ -1413,11 +2177,11 @@ function edgeEnds(e, ids, overrides) {
1413
2177
  const ends = [];
1414
2178
  for (const field of ["source", "target"]) {
1415
2179
  const raw = e.data[field];
1416
- const text = typeof raw === "number" && !Number.isNaN(raw) ? String(raw) : raw;
2180
+ const text2 = typeof raw === "number" && !Number.isNaN(raw) ? String(raw) : raw;
1417
2181
  if (typeof raw === "number") {
1418
- overrides.set(field, text);
2182
+ overrides.set(field, text2);
1419
2183
  }
1420
- const at = typeof text === "string" ? ids.get(text) : void 0;
2184
+ const at = typeof text2 === "string" ? ids.get(text2) : void 0;
1421
2185
  if (at !== void 0) {
1422
2186
  ends.push(at);
1423
2187
  }
@@ -1971,6 +2735,16 @@ const POSITIONS = /* @__PURE__ */ new Map([
1971
2735
  ["bottom,center", "bottom"],
1972
2736
  ["bottom,right", "bottom-right"]
1973
2737
  ]);
2738
+ const INSIDE_POSITIONS = /* @__PURE__ */ new Map([
2739
+ ["top,left", "inside-top-left"],
2740
+ ["top,center", "inside-top"],
2741
+ ["top,right", "inside-top-right"],
2742
+ ["center,left", "inside-left"],
2743
+ ["center,right", "inside-right"],
2744
+ ["bottom,left", "inside-bottom-left"],
2745
+ ["bottom,center", "inside-bottom"],
2746
+ ["bottom,right", "inside-bottom-right"]
2747
+ ]);
1974
2748
  function evaluateCytoscapeJs(input) {
1975
2749
  const notes = input.notes ?? new StyleNotes();
1976
2750
  const budget = input.budget ?? new StyleBudget();
@@ -2016,8 +2790,8 @@ function evaluateCytoscapeJs(input) {
2016
2790
  notes.add(STYLE_ISSUE.SELECTOR, null, "selector", { count: deep, sample: "nested too deep" });
2017
2791
  }
2018
2792
  const matcher = new Matcher(graph, notes);
2019
- const node = evaluateTarget("node", graph, sheet, matcher, input, notes, budget);
2020
- const edge = evaluateTarget("edge", graph, sheet, matcher, input, notes, budget);
2793
+ const node = evaluateTarget("node", graph, sheet, matcher, input, { notes, budget, nodes: null });
2794
+ const edge = evaluateTarget("edge", graph, sheet, matcher, input, { notes, budget, nodes: node });
2021
2795
  return { node, edge, graph };
2022
2796
  }
2023
2797
  function outputOrder(kind, graph, snapshot, notes) {
@@ -2069,7 +2843,8 @@ function cellsOf(cells, name, n) {
2069
2843
  }
2070
2844
  return c;
2071
2845
  }
2072
- function evaluateTarget(kind, graph, sheet, matcher, input, notes, budget) {
2846
+ function evaluateTarget(kind, graph, sheet, matcher, input, env) {
2847
+ const { notes, budget } = env;
2073
2848
  const els = kind === "node" ? graph.nodes : graph.edges;
2074
2849
  const spend = (ops) => {
2075
2850
  budget.spend(kind, ops);
@@ -2087,6 +2862,19 @@ function evaluateTarget(kind, graph, sheet, matcher, input, notes, budget) {
2087
2862
  forceLoopCurves(graph, cells.get("curve-style"));
2088
2863
  }
2089
2864
  const drawn = drawnValues(kind, els, cells, order, input.rendered, notes, spend);
2865
+ if (kind === "edge" && input.toolDefaults !== false) {
2866
+ const read = { kind, els, cells, order, rendered: input.rendered, notes };
2867
+ const curves = drawnColumn(read, "curve-style", CURVE_PART);
2868
+ noArrowsOnHaystacks(curves, drawn);
2869
+ if (env.nodes !== null) {
2870
+ edgeRoutes(graph, read, curves, env.nodes, drawn);
2871
+ }
2872
+ }
2873
+ if (kind === "node") {
2874
+ const read = { kind, els, cells, order, rendered: input.rendered, notes };
2875
+ nodeSizes(graph, read, drawn);
2876
+ mixedLabelPlaces(graph, read, drawn);
2877
+ }
2090
2878
  if (kind === "edge") {
2091
2879
  straightenUnpairedBeziers(graph, curveStyles(graph, cells, input.rendered), coreToOut, drawn.curved);
2092
2880
  }
@@ -2191,7 +2979,7 @@ function drawnValues(kind, els, cells, order, rendered, notes, spend) {
2191
2979
  if (spec.property.startsWith("_")) {
2192
2980
  words.set(
2193
2981
  spec.property,
2194
- col.map((v) => typeof v === "string" ? v : null)
2982
+ col.map((v) => typeof v === "string" || typeof v === "number" ? String(v) : null)
2195
2983
  );
2196
2984
  continue;
2197
2985
  }
@@ -2204,6 +2992,9 @@ function drawnValues(kind, els, cells, order, rendered, notes, spend) {
2204
2992
  });
2205
2993
  }
2206
2994
  combineParts(kind, out, words, values, notes);
2995
+ if (kind === "node") {
2996
+ cyjsPolygonShapes(values);
2997
+ }
2207
2998
  const drawn = {};
2208
2999
  for (const [p, col] of Object.entries(values)) {
2209
3000
  if (col.some((v) => v !== null)) {
@@ -2293,7 +3084,7 @@ function forceLoopCurves(graph, col) {
2293
3084
  function entryProperties(entry, kind, specs, notes, notCarried) {
2294
3085
  const out = [];
2295
3086
  for (const [name0, value] of entry.properties) {
2296
- const name = entry.dashOnly ? dashOnlyName(name0) : cyjsPropertyName(name0);
3087
+ const name = entry.dashOnly ? cyjsAliasOf(name0) : cyjsPropertyName(name0);
2297
3088
  const spec = specs.get(name);
2298
3089
  if (spec === void 0) {
2299
3090
  if (kind === "node" && !CYJS_EDGE_ONLY.has(name) && !entry.tool) {
@@ -2312,22 +3103,36 @@ function entryProperties(entry, kind, specs, notes, notCarried) {
2312
3103
  }
2313
3104
  return out;
2314
3105
  }
2315
- function dashOnlyName(name) {
2316
- return name === "content" ? "label" : name;
2317
- }
2318
3106
  const CYJS_EDGE_ONLY = /* @__PURE__ */ new Set([
2319
3107
  "line-color",
2320
3108
  "line-style",
3109
+ "line-outline-width",
3110
+ "line-outline-color",
3111
+ "line-fill",
3112
+ "line-gradient-stop-colors",
3113
+ "line-gradient-stop-positions",
2321
3114
  "target-arrow-shape",
2322
3115
  "source-arrow-shape",
2323
3116
  "target-arrow-color",
2324
3117
  "source-arrow-color",
3118
+ "mid-target-arrow-shape",
3119
+ "mid-source-arrow-shape",
3120
+ "mid-target-arrow-color",
3121
+ "mid-source-arrow-color",
2325
3122
  "target-arrow-fill",
2326
3123
  "source-arrow-fill",
2327
3124
  "curve-style",
2328
3125
  "arrow-scale",
2329
3126
  "source-label",
2330
- "target-label"
3127
+ "target-label",
3128
+ "source-text-offset",
3129
+ "target-text-offset",
3130
+ "source-text-margin-x",
3131
+ "source-text-margin-y",
3132
+ "target-text-margin-x",
3133
+ "target-text-margin-y",
3134
+ "source-text-rotation",
3135
+ "target-text-rotation"
2331
3136
  ]);
2332
3137
  function matchList(sel, kind, n, matcher, ix) {
2333
3138
  if (sel.queries.length === 0) {
@@ -2408,84 +3213,676 @@ function neutralOfCell(spec, name, c, site) {
2408
3213
  return cyjsNeutral(spec, flat, site);
2409
3214
  }
2410
3215
  function combineParts(kind, n, words, values, notes) {
3216
+ const whole = [...values.opacity ?? new Array(n).fill(null)];
3217
+ combineLabelOpacity(n, words, values);
3218
+ if (kind === "node") {
3219
+ combineNodeOpacity(n, words, values);
3220
+ }
2411
3221
  const va = words.get("_valign");
2412
3222
  const ha = words.get("_halign");
2413
3223
  if (kind === "node" && (va !== void 0 || ha !== void 0)) {
2414
- values.labelPosition = Array.from(
3224
+ values.labelPosition = Array.from({ length: n }, (_, i) => labelPosition(va?.[i] ?? null, ha?.[i] ?? null));
3225
+ }
3226
+ const wrap = words.get("_wrap");
3227
+ const maxWidth = words.get("_maxWidth");
3228
+ const overflow = words.get("_overflowWrap");
3229
+ if (wrap !== void 0) {
3230
+ const cut = (i) => wrap[i] === "wrap" || wrap[i] === "ellipsis";
3231
+ values.labelWrapWidth = Array.from(
2415
3232
  { length: n },
2416
- (_, i) => labelPosition(va?.[i] ?? null, ha?.[i] ?? null, (sample) => {
2417
- notes.add(STYLE_ISSUE.UNKNOWN_VALUE, kind, "labelPosition", { sample, element: i });
2418
- })
3233
+ (_, i) => cut(i) && typeof maxWidth?.[i] === "string" ? Number(maxWidth[i]) : null
2419
3234
  );
3235
+ if (wrap.includes("ellipsis")) {
3236
+ values.labelWrapEllipsis = wrap.map((w) => w === "ellipsis" ? true : null);
3237
+ }
3238
+ if (overflow?.includes("anywhere") === true) {
3239
+ values.labelWrapAnywhere = wrap.map((w, i) => w === "wrap" && overflow[i] === "anywhere" ? true : null);
3240
+ }
3241
+ }
3242
+ if (kind === "node") {
3243
+ combineFace(n, words, values);
3244
+ combineBackgroundGradient(n, words, values, notes);
3245
+ } else {
3246
+ combineArrowFills(n, words, values, notes);
3247
+ combineLineOpacity(n, words.get("_lineOpacity"), values);
3248
+ }
3249
+ combineDashes(kind, n, words, values);
3250
+ combineLabelText(kind, n, words, values);
3251
+ combineLabelDress(kind, n, words, values, notes, whole);
3252
+ combineVisibility(kind, n, words, values);
3253
+ }
3254
+ function combineLabelOpacity(n, words, values) {
3255
+ const text2 = words.get("_textOpacity");
3256
+ const whole = values.opacity;
3257
+ if (text2 === void 0 && whole === void 0) {
3258
+ return;
3259
+ }
3260
+ const col = new Array(n).fill(null);
3261
+ for (let i = 0; i < n; i++) {
3262
+ const t = text2?.[i] ?? null;
3263
+ const o = whole?.[i];
3264
+ const v = Math.round((t === null ? 1 : Number(t)) * (typeof o === "number" ? o : 1) * 1e6) / 1e6;
3265
+ col[i] = v === 1 || !Number.isFinite(v) ? null : v;
3266
+ }
3267
+ values.labelOpacity = col;
3268
+ }
3269
+ function combineNodeOpacity(n, words, values) {
3270
+ const whole = values.opacity;
3271
+ for (const [part, p] of [
3272
+ ["_ringOpacity", "borderOpacity"],
3273
+ ["_outlineRingOpacity", "outerBorderOpacity"]
3274
+ ]) {
3275
+ const own = words.get(part);
3276
+ if (own === void 0 && whole === void 0) {
3277
+ continue;
3278
+ }
3279
+ values[p] = Array.from({ length: n }, (_, i) => {
3280
+ const a = own?.[i] ?? null;
3281
+ const o = whole?.[i];
3282
+ const v = Math.round((a === null ? 1 : Number(a)) * (typeof o === "number" ? o : 1) * 1e6) / 1e6;
3283
+ return v === 1 || !Number.isFinite(v) ? null : v;
3284
+ });
2420
3285
  }
3286
+ }
3287
+ function combineDashes(kind, n, words, values) {
3288
+ const lines = kind === "edge" ? [["lineStyle", "width", 3, "6 3", true]] : [
3289
+ ["borderStyle", "borderWidth", 0, "4 2", true],
3290
+ ["outerBorderStyle", "outerBorderWidth", 0, "4 2", false]
3291
+ ];
3292
+ for (const [style, width, fallback, pattern, own] of lines) {
3293
+ const col = values[style];
3294
+ if (col !== void 0) {
3295
+ dashColumn(col, n, values[width], { fallback, pattern }, own ? words : null);
3296
+ }
3297
+ }
3298
+ }
3299
+ function dashColumn(col, n, widths, drawn, words) {
3300
+ for (let i = 0; i < n; i++) {
3301
+ if (col[i] !== "dashed") {
3302
+ continue;
3303
+ }
3304
+ const w = widths?.[i];
3305
+ const look = dashedLook(words, i, drawn.pattern, typeof w === "number" ? w : drawn.fallback);
3306
+ if (look !== null) {
3307
+ col[i] = look;
3308
+ }
3309
+ }
3310
+ }
3311
+ function dashedLook(words, i, pattern, width) {
3312
+ const dashes = (words?.get("_dashPattern")?.[i] ?? pattern).split(/[\s,[\]]+/).filter((t) => t !== "").map((t) => Number.parseFloat(t));
3313
+ if (dashes.length === 0 || !dashes.every((d) => Number.isFinite(d))) {
3314
+ return null;
3315
+ }
3316
+ return cyjsDashLook(dashes, width, words?.get("_dashCap")?.[i] ?? "butt");
3317
+ }
3318
+ function columnOf(values, property, n) {
3319
+ let column = values[property];
3320
+ if (column === void 0) {
3321
+ column = new Array(n).fill(null);
3322
+ values[property] = column;
3323
+ }
3324
+ return column;
3325
+ }
3326
+ function combineVisibility(kind, n, words, values) {
2421
3327
  const vis = words.get("_visibility");
2422
3328
  const disp = words.get("_display");
2423
- if (vis !== void 0 || disp !== void 0) {
2424
- const col = new Array(n).fill(null);
2425
- for (let i = 0; i < n; i++) {
2426
- const a = vis?.[i] ?? null;
2427
- const b = disp?.[i] ?? null;
2428
- if (a === null && b === null) {
2429
- continue;
3329
+ if (vis === void 0 && disp === void 0) {
3330
+ return;
3331
+ }
3332
+ const col = new Array(n).fill(null);
3333
+ for (let i = 0; i < n; i++) {
3334
+ const a = vis?.[i] ?? null;
3335
+ const b = disp?.[i] ?? null;
3336
+ if (a === null && b === null) {
3337
+ continue;
3338
+ }
3339
+ const keptInvisible = kind === "node" && a === "hidden" && b !== "none";
3340
+ col[i] = keptInvisible || a !== "hidden" && b !== "none";
3341
+ if (keptInvisible) {
3342
+ for (const p of ["opacity", "borderOpacity", "outerBorderOpacity", "labelOpacity"]) {
3343
+ columnOf(values, p, n)[i] = 0;
2430
3344
  }
2431
- col[i] = a !== "hidden" && b !== "none";
3345
+ columnOf(values, "label", n)[i] = "";
3346
+ }
3347
+ }
3348
+ values.visible = col;
3349
+ }
3350
+ function combineLabelText(kind, n, words, values) {
3351
+ transformLabels(n, words.get("_transform"), values.label);
3352
+ const justification = words.get("_justification");
3353
+ if (justification !== void 0 && kind === "edge") {
3354
+ combineEdgeJustification(n, justification, words.get("_wrap"), values);
3355
+ } else if (justification !== void 0) {
3356
+ const halign = words.get("_halign");
3357
+ const AUTO = {
3358
+ left: "right",
3359
+ right: "left",
3360
+ "left-inside": "left",
3361
+ "right-inside": "right"
3362
+ };
3363
+ values.labelTextAlign = justification.map((j, i) => {
3364
+ if (j === null) {
3365
+ return null;
3366
+ }
3367
+ return j === "auto" ? AUTO[halign?.[i] ?? "center"] ?? "center" : j;
3368
+ });
3369
+ }
3370
+ const rotations = [
3371
+ ["_rotation", "labelRotation"],
3372
+ ["_sourceRotation", "sourceLabelRotation"],
3373
+ ["_targetRotation", "targetLabelRotation"]
3374
+ ];
3375
+ for (const [part, property] of rotations) {
3376
+ const rotation = words.get(part);
3377
+ if (rotation !== void 0) {
3378
+ values[property] = rotation.map((r) => r === null ? null : cyjsAngleDegrees(r));
2432
3379
  }
2433
- values.visible = col;
2434
3380
  }
2435
- if (kind === "edge") {
2436
- hollowArrows("target", words.get("_targetArrowFill"), values, notes);
2437
- hollowArrows("source", words.get("_sourceArrowFill"), values, notes);
3381
+ }
3382
+ function transformLabels(n, transform, label) {
3383
+ if (transform === void 0 || label === void 0) {
3384
+ return;
3385
+ }
3386
+ for (let i = 0; i < n; i++) {
3387
+ const text2 = label[i];
3388
+ if (typeof text2 === "string" && transform[i] === "uppercase") {
3389
+ label[i] = text2.toUpperCase();
3390
+ } else if (typeof text2 === "string" && transform[i] === "lowercase") {
3391
+ label[i] = text2.toLowerCase();
3392
+ }
2438
3393
  }
2439
3394
  }
2440
- function openArrows(setting, parts) {
2441
- for (const end of ["target", "source"]) {
2442
- let fill;
2443
- for (const p of parts) {
2444
- if (p.spec.property === `_${end}ArrowFill`) {
2445
- fill = p.parsed;
2446
- }
3395
+ function combineEdgeJustification(n, justification, wrap, values) {
3396
+ const SHIFT = { left: -0.5, right: 0.5 };
3397
+ for (let i = 0; i < n; i++) {
3398
+ const shift = wrap?.[i] === "wrap" ? SHIFT[justification[i] ?? ""] : void 0;
3399
+ if (shift !== void 0) {
3400
+ columnOf(values, "labelShiftX", n)[i] = shift;
3401
+ }
3402
+ }
3403
+ }
3404
+ function combineLabelDress(kind, n, words, values, notes, whole) {
3405
+ const num = (part, i, fallback) => {
3406
+ const v = words.get(part)?.[i];
3407
+ return v === null || v === void 0 ? fallback : Number(v);
3408
+ };
3409
+ const col = (p) => values[p] ??= new Array(n).fill(null);
3410
+ const outlined = words.has("_outlineWidth");
3411
+ const boxed = words.has("_backgroundOpacity");
3412
+ const bordered = words.has("_textBorderWidth") && words.has("_textBorderOpacity");
3413
+ const at = (v) => typeof v === "number" ? v : 1;
3414
+ const faded = (v) => {
3415
+ const r = Math.round(v * 1e6) / 1e6;
3416
+ return r < 1 ? r : null;
3417
+ };
3418
+ for (let i = 0; i < n && (outlined || boxed || bordered); i++) {
3419
+ const width = num("_outlineWidth", i, 0);
3420
+ const outlineOpacity = num("_outlineOpacity", i, 1);
3421
+ if (outlined && width > 0 && outlineOpacity > 0) {
3422
+ col("labelOutlineColor")[i] = words.get("_outlineColor")?.[i] ?? "#000000";
3423
+ col("labelOutlineWidth")[i] = 2 * width;
3424
+ col("labelOutlineOpacity")[i] = faded(outlineOpacity * at(values.labelOpacity?.[i]));
3425
+ }
3426
+ const boxOpacity = num("_backgroundOpacity", i, 0);
3427
+ const box = boxed && boxOpacity > 0;
3428
+ if (box) {
3429
+ col("labelBackground")[i] = words.get("_backgroundColor")?.[i] ?? "#000000";
3430
+ col("labelBackgroundOpacity")[i] = faded(boxOpacity * at(whole[i]));
3431
+ }
3432
+ const border = bordered && labelBorder(kind, i, words, col, notes, at(whole[i]));
3433
+ if (box || border) {
3434
+ labelBoxShape(kind, i, words, col, notes);
3435
+ }
3436
+ }
3437
+ }
3438
+ function labelBoxShape(kind, i, words, col, notes) {
3439
+ const padding = words.get("_backgroundPadding")?.[i];
3440
+ col("labelPadding")[i] = padding === null || padding === void 0 ? 0 : Number(padding);
3441
+ col("labelLineHeight")[i] = 1;
3442
+ const shape = words.get("_backgroundShape")?.[i];
3443
+ if (shape === "round-rectangle" || shape === "roundrectangle") {
3444
+ col("labelCornerRadius")[i] = 2;
3445
+ } else if (shape === "circle") {
3446
+ notes.add(STYLE_ISSUE.APPROXIMATED, kind, "labelBackground", { sample: "circle", element: i });
3447
+ }
3448
+ }
3449
+ function labelBorder(kind, i, words, col, notes, whole) {
3450
+ const num = (part) => Number(words.get(part)?.[i] ?? 0);
3451
+ const [width, opacity] = [num("_textBorderWidth"), num("_textBorderOpacity")];
3452
+ if (!(width > 0 && opacity > 0)) {
3453
+ return false;
3454
+ }
3455
+ const style = words.get("_textBorderStyle")?.[i] ?? "solid";
3456
+ col("labelBorderColor")[i] = words.get("_textBorderColor")?.[i] ?? "#000000";
3457
+ col("labelBorderWidth")[i] = style === "double" ? width / 4 : width;
3458
+ const drawn = Math.round(opacity * whole * 1e6) / 1e6;
3459
+ col("labelBorderOpacity")[i] = drawn < 1 ? drawn : null;
3460
+ if (style === "dotted" || style === "dashed" || style === "double") {
3461
+ notes.add(STYLE_ISSUE.APPROXIMATED, kind, "labelBorderColor", { sample: style, element: i });
3462
+ }
3463
+ return true;
3464
+ }
3465
+ function lineDegrees(a, b) {
3466
+ const dx = b[0] - a[0];
3467
+ const angle = Math.atan((b[1] - a[1]) / dx);
3468
+ const turn = (dx === 0 ? Math.abs(angle) : angle) * 180 / Math.PI;
3469
+ return Number.isFinite(turn) ? Math.round((turn % 360 + 360) % 360 * 1e6) / 1e6 + 0 : 0;
3470
+ }
3471
+ function cyjsAngleDegrees(text2) {
3472
+ const t = text2.trim();
3473
+ if (t === "none" || t === "autorotate") {
3474
+ return 0;
3475
+ }
3476
+ const m = /^(-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?)(deg|rad)?$/i.exec(t);
3477
+ if (m === null) {
3478
+ return null;
3479
+ }
3480
+ const x = Number(m[1]);
3481
+ const deg = m[2]?.toLowerCase() === "deg" ? x : x * 180 / Math.PI;
3482
+ return Math.round((deg % 360 + 360) % 360 * 1e6) / 1e6 + 0;
3483
+ }
3484
+ function combineLineOpacity(n, line, values) {
3485
+ if (line === void 0) {
3486
+ return;
3487
+ }
3488
+ const whole = values.opacity;
3489
+ values.opacity = Array.from({ length: n }, (_, i) => {
3490
+ const a = line[i] === null ? null : Number(line[i]);
3491
+ const b = whole?.[i];
3492
+ if (a === null || !Number.isFinite(a)) {
3493
+ return b ?? null;
3494
+ }
3495
+ return Math.round(a * (typeof b === "number" ? b : 1) * 1e6) / 1e6;
3496
+ });
3497
+ }
3498
+ const GRADIENT_ANGLES = /* @__PURE__ */ new Map([
3499
+ ["to-bottom", 90],
3500
+ ["to-top", 270],
3501
+ ["to-left", 180],
3502
+ ["to-right", 0],
3503
+ ["to-bottom-right", 45],
3504
+ ["to-right-bottom", 45],
3505
+ ["to-bottom-left", 135],
3506
+ ["to-left-bottom", 135],
3507
+ ["to-top-right", 315],
3508
+ ["to-right-top", 315],
3509
+ ["to-top-left", 225],
3510
+ ["to-left-top", 225]
3511
+ ]);
3512
+ function combineBackgroundGradient(n, words, values, notes) {
3513
+ const fill = words.get("_backgroundFill");
3514
+ if (fill === void 0) {
3515
+ return;
3516
+ }
3517
+ const stops = words.get("_backgroundStops");
3518
+ const positions = words.get("_backgroundPositions");
3519
+ const direction = words.get("_backgroundDirection");
3520
+ const col = (name) => values[name] ??= new Array(n).fill(null);
3521
+ for (let i = 0; i < n; i++) {
3522
+ const radial = fill[i] === "radial-gradient";
3523
+ if (fill[i] !== "linear-gradient" && !radial) {
3524
+ continue;
3525
+ }
3526
+ const colors = gradientStopColors(stops?.[i] ?? "#999", {
3527
+ notes,
3528
+ target: "node",
3529
+ property: "fill",
3530
+ element: i
3531
+ });
3532
+ if (colors.length < 2) {
3533
+ continue;
3534
+ }
3535
+ col("fill")[i] = colors[0];
3536
+ col("fillGradient")[i] = colors.at(-1) ?? null;
3537
+ if (colors.length > 2) {
3538
+ col("fillGradientColors")[i] = colors.join(" ");
3539
+ }
3540
+ const placed = gradientStops(positions?.[i] ?? "");
3541
+ if (placed?.split(" ").length === colors.length) {
3542
+ col("fillGradientStops")[i] = placed;
3543
+ }
3544
+ if (radial) {
3545
+ col("fillGradientKind")[i] = "radial";
3546
+ } else {
3547
+ col("fillGradientAngle")[i] = GRADIENT_ANGLES.get(direction?.[i] ?? "to-bottom") ?? 90;
3548
+ }
3549
+ }
3550
+ }
3551
+ const ROUTE_PARTS = [
3552
+ ["segmentDistances", "segment-distances", { property: "_segmentDistances", type: "text" }],
3553
+ ["segmentWeights", "segment-weights", { property: "_segmentWeights", type: "text" }],
3554
+ ["controlPointDistances", "control-point-distances", { property: "_controlPointDistances", type: "text" }],
3555
+ ["controlPointWeights", "control-point-weights", { property: "_controlPointWeights", type: "text" }],
3556
+ ["controlPointStepSize", "control-point-step-size", { property: "_controlPointStepSize", type: "size" }],
3557
+ ["taxiDirection", "taxi-direction", { property: "_taxiDirection", type: "text" }],
3558
+ ["taxiTurn", "taxi-turn", { property: "_taxiTurn", type: "text" }],
3559
+ ["taxiTurnMinDistance", "taxi-turn-min-distance", { property: "_taxiTurnMinDistance", type: "size" }],
3560
+ ["edgeDistances", "edge-distances", { property: "_edgeDistances", type: "text" }],
3561
+ ["loopDirection", "loop-direction", { property: "_loopDirection", type: "text" }],
3562
+ ["loopSweep", "loop-sweep", { property: "_loopSweep", type: "text" }],
3563
+ ["segmentRadii", "segment-radii", { property: "_segmentRadii", type: "text" }],
3564
+ ["taxiRadius", "taxi-radius", { property: "_taxiRadius", type: "text" }],
3565
+ ["radiusType", "radius-type", { property: "_radiusType", type: "text" }]
3566
+ ];
3567
+ function edgeRoutes(graph, read, curves, nodes, values) {
3568
+ const words = new Map(ROUTE_PARTS.map(([key, name, spec]) => [key, drawnColumn(read, name, spec)]));
3569
+ const nodeAt = /* @__PURE__ */ new Map();
3570
+ nodes.elements.forEach((el, k) => {
3571
+ if (el !== null) {
3572
+ nodeAt.set(el, k);
3573
+ }
3574
+ });
3575
+ const geometry = (core) => routeNode(graph.nodes[core], nodeAt, nodes);
3576
+ const turned = [
3577
+ ["labelRotation", drawnColumn(read, "text-rotation", TEXT_PART)],
3578
+ ["sourceLabelRotation", drawnColumn(read, "source-text-rotation", TEXT_PART)],
3579
+ ["targetLabelRotation", drawnColumn(read, "target-text-rotation", TEXT_PART)]
3580
+ ];
3581
+ const ends = [drawnColumn(read, "source-endpoint", TEXT_PART), drawnColumn(read, "target-endpoint", TEXT_PART)];
3582
+ const loops = /* @__PURE__ */ new Map();
3583
+ const n = read.order.length;
3584
+ let routed = null;
3585
+ for (let k = 0; k < n; k++) {
3586
+ const e = read.order[k];
3587
+ const between = edgeNodes(graph, e, geometry);
3588
+ if (between === null) {
3589
+ continue;
3590
+ }
3591
+ const { src, tgt, loop } = between;
3592
+ if (!loop) {
3593
+ autorotateLabels(values, turned, k, n, lineDegrees(src.center, tgt.center));
3594
+ }
3595
+ const edge = routeSettings(words, k, curves[k]);
3596
+ const bends = cyjsRoute(edge, src, tgt, loop ? nextLoopIndex(loops, graph.source[e], edge) : 0);
3597
+ if (bends !== null) {
3598
+ routed ??= values.bends ?? new Array(n).fill(null);
3599
+ routed[k] = bends;
3600
+ columnOf(values, "curved", n)[k] = false;
3601
+ }
3602
+ if (!loop) {
3603
+ edgePorts(edge.curveStyle, [ends[0][k], ends[1][k]], [src, tgt], (p, port) => {
3604
+ columnOf(values, p, n)[k] = port;
3605
+ });
3606
+ }
3607
+ }
3608
+ if (routed !== null) {
3609
+ values.bends = routed;
3610
+ }
3611
+ }
3612
+ function routeNode(el, nodeAt, nodes) {
3613
+ const k = nodeAt.get(el);
3614
+ const pos = el.json.position;
3615
+ if (k === void 0 || !isObject(pos) || typeof pos.x !== "number" || typeof pos.y !== "number") {
3616
+ return null;
3617
+ }
3618
+ const num = (p, fallback) => {
3619
+ const v = nodes.values[p]?.[k];
3620
+ return typeof v === "number" ? v : fallback;
3621
+ };
3622
+ const [w, h, bw] = [num("width", 30), num("height", 30), num("borderWidth", 0)];
3623
+ return {
3624
+ center: [pos.x, pos.y],
3625
+ size: [w + bw, h + bw],
3626
+ box: [w, h],
3627
+ ellipse: (nodes.values.shape?.[k] ?? "ellipse") === "ellipse"
3628
+ };
3629
+ }
3630
+ function edgeNodes(graph, e, geometry) {
3631
+ if (e < 0) {
3632
+ return null;
3633
+ }
3634
+ const loop = graph.source[e] === graph.target[e];
3635
+ const src = geometry(graph.source[e]);
3636
+ const tgt = loop ? src : geometry(graph.target[e]);
3637
+ return src === null || tgt === null ? null : { src, tgt, loop };
3638
+ }
3639
+ function autorotateLabels(values, turned, k, n, degrees2) {
3640
+ for (const [property, column] of turned) {
3641
+ if (column[k] === "autorotate") {
3642
+ columnOf(values, property, n)[k] = degrees2;
3643
+ }
3644
+ }
3645
+ }
3646
+ function nextLoopIndex(loops, source, edge) {
3647
+ const key = `${String(source)} ${String(edge.loopDirection)} ${String(edge.loopSweep)}`;
3648
+ const index = loops.get(key) ?? 0;
3649
+ loops.set(key, index + 1);
3650
+ return index;
3651
+ }
3652
+ function edgePorts(curve, words, nodes, put) {
3653
+ if (curve === "taxi" || curve === "round-taxi") {
3654
+ return;
3655
+ }
3656
+ ["sourcePort", "targetPort"].forEach((p, a) => {
3657
+ const port = curve === "haystack" ? "0,0" : endpointPort(String(words[a] ?? ""), nodes[a]);
3658
+ if (port !== null) {
3659
+ put(p, port);
2447
3660
  }
2448
- const shape = setting.get(`${end}Arrow`);
2449
- const open = shape === void 0 ? void 0 : OPEN_ARROWS.get(shape);
2450
- if (fill?.kind === "word" && fill.value === "hollow" && open !== void 0) {
2451
- setting.set(`${end}Arrow`, open);
3661
+ });
3662
+ }
3663
+ function endpointPort(text2, node) {
3664
+ const t = text2.trim();
3665
+ if (t === "inside-to-node") {
3666
+ return "0,0";
3667
+ }
3668
+ const parts = t.split(/\s+/);
3669
+ const [w, h] = node.size;
3670
+ const r62 = (v) => String(Math.round(v * 1e6) / 1e6 + 0);
3671
+ const fraction2 = (part, size) => {
3672
+ const m2 = /^(-?(?:\d+(?:\.\d*)?|\.\d+))(%|px)?$/.exec(part);
3673
+ if (m2 === null || Number.isNaN(size) || size <= 0) {
3674
+ return null;
2452
3675
  }
3676
+ const px = m2[2] === "%" ? Number(m2[1]) / 100 * size : Number(m2[1]);
3677
+ return px / (size / 2);
3678
+ };
3679
+ if (parts.length === 2) {
3680
+ const [x, y] = [fraction2(parts[0], w), fraction2(parts[1], h)];
3681
+ return x === null || y === null ? null : `${r62(x)},${r62(-y)}`;
3682
+ }
3683
+ const m = /^(-?(?:\d+(?:\.\d*)?|\.\d+))(deg|rad)$/.exec(t);
3684
+ if (m === null) {
3685
+ return null;
2453
3686
  }
3687
+ const turn = m[2] === "deg" ? Number(m[1]) * Math.PI / 180 : Number(m[1]);
3688
+ const [dx, dy] = [Math.sin(turn) / (w / 2), Math.cos(turn) / (h / 2)];
3689
+ const reach = node.ellipse ? Math.hypot(dx, dy) : Math.max(Math.abs(dx), Math.abs(dy));
3690
+ return reach > 0 ? `${r62(dx / reach)},${r62(dy / reach)}` : null;
2454
3691
  }
2455
- const OPEN_ARROWS = /* @__PURE__ */ new Map([
3692
+ function routeSettings(words, k, curve) {
3693
+ const text2 = (key) => {
3694
+ const v = words.get(key)?.[k];
3695
+ return v === null || v === void 0 ? null : String(v);
3696
+ };
3697
+ const num = (key) => {
3698
+ const v = text2(key);
3699
+ return v === null ? null : Number(v);
3700
+ };
3701
+ return {
3702
+ curveStyle: String(curve ?? "haystack"),
3703
+ segmentDistances: text2("segmentDistances"),
3704
+ segmentWeights: text2("segmentWeights"),
3705
+ controlPointDistances: text2("controlPointDistances"),
3706
+ controlPointWeights: text2("controlPointWeights"),
3707
+ controlPointStepSize: num("controlPointStepSize"),
3708
+ taxiDirection: text2("taxiDirection"),
3709
+ taxiTurn: text2("taxiTurn"),
3710
+ taxiTurnMinDistance: num("taxiTurnMinDistance"),
3711
+ edgeDistances: text2("edgeDistances"),
3712
+ loopDirection: text2("loopDirection"),
3713
+ loopSweep: text2("loopSweep"),
3714
+ segmentRadii: text2("segmentRadii"),
3715
+ taxiRadius: text2("taxiRadius"),
3716
+ radiusType: text2("radiusType")
3717
+ };
3718
+ }
3719
+ const TEXT_PART = { property: "_text", type: "text" };
3720
+ function nodeSizes(graph, read, values) {
3721
+ const padding = drawnColumn(read, "padding", TEXT_PART);
3722
+ const toLabel = ["width", "height"].map((p) => drawnColumn(read, p, SIZE_PART));
3723
+ const n = read.order.length;
3724
+ const col = (p) => values[p] ??= new Array(n).fill(null);
3725
+ for (let k = 0; k < n; k++) {
3726
+ const core = read.order[k];
3727
+ const pad = core < 0 || graph.children[core].length > 0 ? 0 : paddingOf(padding[k]);
3728
+ const fitted = toLabel.map((c) => c[k] === "label");
3729
+ if (fitted[0] || fitted[1]) {
3730
+ col("labelFit")[k] = "bounds";
3731
+ col("labelPaddingX")[k] = pad;
3732
+ col("labelPaddingY")[k] = pad;
3733
+ ["width", "height"].forEach((p, a) => {
3734
+ const v = values[p]?.[k];
3735
+ const side = typeof v === "number" ? v : 30;
3736
+ col(p)[k] = fitted[a] ? 0 : side + 2 * pad;
3737
+ });
3738
+ continue;
3739
+ }
3740
+ if (pad <= 0) {
3741
+ continue;
3742
+ }
3743
+ for (const p of ["width", "height"]) {
3744
+ const v = values[p]?.[k];
3745
+ col(p)[k] = (typeof v === "number" ? v : 30) + 2 * pad;
3746
+ }
3747
+ }
3748
+ }
3749
+ const VALIGN_PART = {
3750
+ property: "_valign",
3751
+ type: "enum",
3752
+ enums: ["top", "top-inside", "center", "bottom", "bottom-inside"]
3753
+ };
3754
+ const HALIGN_PART = {
3755
+ property: "_halign",
3756
+ type: "enum",
3757
+ enums: ["left", "left-inside", "center", "right", "right-inside"]
3758
+ };
3759
+ function pinnedAxis(align, half, pad) {
3760
+ const near2 = /^(left|top)/.test(align);
3761
+ if (!near2 && !/^(right|bottom)/.test(align)) {
3762
+ return { offset: 0, shift: 0 };
3763
+ }
3764
+ const side = near2 ? -1 : 1;
3765
+ return align.endsWith("-inside") ? { offset: side * (half - 2 * pad), shift: -side / 2 } : { offset: side * half, shift: side / 2 };
3766
+ }
3767
+ function mixedLabelPlaces(graph, read, values) {
3768
+ const va = drawnColumn(read, "text-valign", VALIGN_PART);
3769
+ const ha = drawnColumn(read, "text-halign", HALIGN_PART);
3770
+ const padding = drawnColumn(read, "padding", TEXT_PART);
3771
+ const n = read.order.length;
3772
+ const col = (p) => values[p] ??= new Array(n).fill(null);
3773
+ for (let k = 0; k < n; k++) {
3774
+ const v = typeof va[k] === "string" ? String(va[k]) : "top";
3775
+ const h = typeof ha[k] === "string" ? String(ha[k]) : "center";
3776
+ const inside = v.endsWith("-inside") || h.endsWith("-inside");
3777
+ const outside = v === "top" || v === "bottom" || h === "left" || h === "right";
3778
+ if (!inside || !outside) {
3779
+ continue;
3780
+ }
3781
+ if (values.labelFit?.[k] !== void 0 && values.labelFit[k] !== null) {
3782
+ read.notes.add(STYLE_ISSUE.APPROXIMATED, "node", "labelPosition", { sample: `${v} ${h}`, element: k });
3783
+ continue;
3784
+ }
3785
+ const core = read.order[k];
3786
+ const pad = core < 0 || graph.children[core].length > 0 ? 0 : paddingOf(padding[k]);
3787
+ const size = (p) => {
3788
+ const s = values[p]?.[k];
3789
+ return typeof s === "number" ? s : 30 + 2 * pad;
3790
+ };
3791
+ const x = pinnedAxis(h, size("width") / 2, pad);
3792
+ const y = pinnedAxis(v, size("height") / 2, pad);
3793
+ const add = (p, d) => {
3794
+ const was = values[p]?.[k];
3795
+ col(p)[k] = (typeof was === "number" ? was : 0) + d;
3796
+ };
3797
+ col("labelPosition")[k] = "center";
3798
+ add("labelOffsetX", x.offset);
3799
+ add("labelOffsetY", y.offset);
3800
+ col("labelShiftX")[k] = x.shift;
3801
+ col("labelShiftY")[k] = y.shift;
3802
+ }
3803
+ }
3804
+ const SIZE_PART = { property: "_size", type: "nodeSize" };
3805
+ function paddingOf(text2) {
3806
+ if (typeof text2 !== "string") {
3807
+ return 0;
3808
+ }
3809
+ const x = Number.parseFloat(text2);
3810
+ if (!Number.isFinite(x) || x <= 0) {
3811
+ return 0;
3812
+ }
3813
+ return text2.trim().endsWith("%") ? x / 100 : x;
3814
+ }
3815
+ const CURVE_PART = { property: "_curve", type: "enum", enums: CYJS_CURVE_STYLES };
3816
+ function noArrowsOnHaystacks(curves, values) {
3817
+ const n = curves.length;
3818
+ for (const p of ["targetArrow", "sourceArrow"]) {
3819
+ const col = values[p];
3820
+ if (col === void 0) {
3821
+ continue;
3822
+ }
3823
+ for (let i = 0; i < n; i++) {
3824
+ if ((curves[i] ?? "haystack") === "haystack" && col[i] !== null) {
3825
+ col[i] = "none";
3826
+ }
3827
+ }
3828
+ }
3829
+ }
3830
+ const HOLLOW_ARROWS = /* @__PURE__ */ new Map([
2456
3831
  ["triangle", "triangle-open"],
3832
+ ["diamond", "diamond-open"],
2457
3833
  ["circle", "circle-open"],
2458
- ["diamond", "diamond-open"]
3834
+ ["square", "other:open-square"]
2459
3835
  ]);
2460
- function hollowArrows(end, fill, values, notes) {
2461
- const shapes = values[`${end}Arrow`];
2462
- if (fill === void 0 || shapes === void 0) {
2463
- return;
3836
+ function hollowArrowsOfRule(set, all) {
3837
+ for (const p of all) {
3838
+ const shapeProp = /^_(\w+Arrow)Fill$/.exec(p.spec.property)?.[1];
3839
+ const shape = shapeProp === void 0 ? void 0 : set[shapeProp];
3840
+ if (shapeProp === void 0 || shape === void 0 || p.parsed.kind !== "word") {
3841
+ continue;
3842
+ }
3843
+ const open = HOLLOW_ARROWS.get(shape);
3844
+ if (open !== void 0 && p.parsed.value === "hollow") {
3845
+ set[shapeProp] = open;
3846
+ }
2464
3847
  }
2465
- for (let i = 0; i < shapes.length; i++) {
2466
- const shape = shapes[i];
2467
- if (fill[i] !== "hollow" || shape === null || shape === "none") {
3848
+ }
3849
+ function combineArrowFills(n, words, values, notes) {
3850
+ for (const p of ["targetArrow", "sourceArrow", "midTargetArrow", "midSourceArrow"]) {
3851
+ const fill = words.get(`_${p}Fill`);
3852
+ const shapes = values[p];
3853
+ if (fill === void 0 || shapes === void 0) {
2468
3854
  continue;
2469
3855
  }
2470
- const open = OPEN_ARROWS.get(shape);
2471
- if (open === void 0) {
2472
- notes.add(STYLE_ISSUE.NOT_CARRIED, "edge", `${end}-arrow-fill`, {
2473
- sample: `hollow ${String(shape)}`,
2474
- element: i
2475
- });
2476
- } else {
2477
- shapes[i] = open;
3856
+ for (let i = 0; i < n; i++) {
3857
+ const shape = shapes[i];
3858
+ if (fill[i] !== "hollow" || shape === null || shape === "none") {
3859
+ continue;
3860
+ }
3861
+ const open = HOLLOW_ARROWS.get(shape);
3862
+ if (open !== void 0) {
3863
+ shapes[i] = open;
3864
+ } else if (!String(shape).includes("open")) {
3865
+ const property = p.replaceAll(/[A-Z]/g, (c) => `-${c.toLowerCase()}`).replace("-arrow", "-arrow-fill");
3866
+ notes.add(STYLE_ISSUE.NOT_CARRIED, "edge", property, { sample: `hollow ${String(shape)}`, element: i });
3867
+ }
2478
3868
  }
2479
3869
  }
2480
3870
  }
2481
- function labelPosition(v, h, note) {
3871
+ function labelPosition(v, h) {
2482
3872
  if (v === null && h === null) {
2483
3873
  return null;
2484
3874
  }
3875
+ const vIn = (v ?? "").endsWith("-inside");
3876
+ const hIn = (h ?? "").endsWith("-inside");
2485
3877
  const vv = (v ?? "top").replace("-inside", "");
2486
3878
  const hh = (h ?? "center").replace("-inside", "");
2487
- if ((v ?? "").endsWith("-inside") || (h ?? "").endsWith("-inside")) {
2488
- note(`${v ?? ""} ${h ?? ""}`);
3879
+ if (vIn || hIn) {
3880
+ const vOut = vv !== "center" && !vIn;
3881
+ const hOut = hh !== "center" && !hIn;
3882
+ if (!vOut && !hOut) {
3883
+ return INSIDE_POSITIONS.get(`${vv},${hh}`) ?? null;
3884
+ }
3885
+ return POSITIONS.get(`${vIn ? "center" : vv},${hIn ? "center" : hh}`) ?? null;
2489
3886
  }
2490
3887
  return POSITIONS.get(`${vv},${hh}`) ?? null;
2491
3888
  }
@@ -2522,7 +3919,7 @@ function buildRules(kind, applied, core, input, truth, env) {
2522
3919
  const rules = collapse(ctx, drafts);
2523
3920
  return { rules, columns, rawColumns: [...raw] };
2524
3921
  }
2525
- function draftOf(ctx, entry, list, props, parts) {
3922
+ function draftOf(ctx, entry, list, props, all) {
2526
3923
  const setting = /* @__PURE__ */ new Map();
2527
3924
  const mapping = /* @__PURE__ */ new Map();
2528
3925
  let flattened = false;
@@ -2550,8 +3947,12 @@ function draftOf(ctx, entry, list, props, parts) {
2550
3947
  mapping.set(p.spec.property, mapperMapping(ctx, entry, list, p));
2551
3948
  }
2552
3949
  }
2553
- openArrows(setting, parts);
2554
3950
  const set = Object.fromEntries(setting);
3951
+ if (ctx.kind === "node") {
3952
+ cyjsPolygonShapes(set);
3953
+ } else {
3954
+ hollowArrowsOfRule(set, all);
3955
+ }
2555
3956
  const map = Object.fromEntries(mapping);
2556
3957
  const hasMap = mapping.size > 0;
2557
3958
  const rule = () => {
@@ -2982,7 +4383,8 @@ const SHAPES_TO_CYJS = /* @__PURE__ */ new Map([
2982
4383
  ["octagon", "octagon"],
2983
4384
  ["parallelogram", "rhomboid"],
2984
4385
  ["star", "star"],
2985
- ["vee", "vee"]
4386
+ ["vee", "vee"],
4387
+ ["polygon", "polygon"]
2986
4388
  ]);
2987
4389
  const ARROWS_TO_CYJS = /* @__PURE__ */ new Map([
2988
4390
  ["none", "none"],
@@ -2993,6 +4395,17 @@ const ARROWS_TO_CYJS = /* @__PURE__ */ new Map([
2993
4395
  ["circle", "circle"],
2994
4396
  ["square", "square"]
2995
4397
  ]);
4398
+ const LINE_FILLS = /* @__PURE__ */ new Map([
4399
+ ["none", "solid"],
4400
+ ["linear", "linear-gradient"],
4401
+ ["radial", "radial-gradient"]
4402
+ ]);
4403
+ const ARROW_PROPERTY = {
4404
+ sourceArrow: "source-arrow-shape",
4405
+ targetArrow: "target-arrow-shape",
4406
+ midSourceArrow: "mid-source-arrow-shape",
4407
+ midTargetArrow: "mid-target-arrow-shape"
4408
+ };
2996
4409
  const ARROWS_OPEN = /* @__PURE__ */ new Map([
2997
4410
  ["triangle-open", "triangle"],
2998
4411
  ["diamond-open", "diamond"],
@@ -3008,12 +4421,27 @@ function toCyjs(target, property, value) {
3008
4421
  switch (property) {
3009
4422
  case "visible":
3010
4423
  return exact({ display: value === false ? "none" : "element" });
4424
+ case "shapePoints":
4425
+ return pointsToCyjs(String(value));
3011
4426
  case "labelItalic":
3012
4427
  return exact({ "font-style": value === true ? "italic" : "normal" });
3013
4428
  case "curved":
3014
4429
  return exact({ "curve-style": value === true ? "unbundled-bezier" : "straight" });
3015
4430
  case "labelPosition":
3016
4431
  return labelPositionToCyjs(String(value));
4432
+ case "fanSpacing":
4433
+ case "labelWrapWidth":
4434
+ return ifNumber(value, (v) => numberToCyjs(property, v));
4435
+ case "gradientKind":
4436
+ return gradientKindToCyjs(String(value));
4437
+ case "gradientStops":
4438
+ return exact({
4439
+ "line-gradient-stop-positions": String(value).trim().split(/\s+/).map((s) => `${num6(Number(s) * 100)}%`).join(" ")
4440
+ });
4441
+ case "outerBorderOffset":
4442
+ return ifNumber(value, (v) => exact({ "outline-offset": num6(v * 2) }));
4443
+ case "outerBorderStyle":
4444
+ return outerBorderStyleToCyjs(String(value));
3017
4445
  case "shape":
3018
4446
  return enumToCyjs("shape", String(value), SHAPES_TO_CYJS, specs);
3019
4447
  case "borderStyle":
@@ -3022,30 +4450,61 @@ function toCyjs(target, property, value) {
3022
4450
  return lineStyleToCyjs(String(value));
3023
4451
  case "sourceArrow":
3024
4452
  case "targetArrow":
3025
- return arrowToCyjs(
3026
- property === "sourceArrow" ? "source-arrow-shape" : "target-arrow-shape",
3027
- String(value),
3028
- specs
3029
- );
4453
+ case "midSourceArrow":
4454
+ case "midTargetArrow":
4455
+ return arrowToCyjs(ARROW_PROPERTY[property], String(value), specs);
3030
4456
  case "labelFont":
3031
4457
  return isFontFamily(String(value)) ? exact({ "font-family": String(value) }) : null;
4458
+ // a label's box draws only at an opacity above 0, which is 0 unset
4459
+ case "labelBackground":
4460
+ return exact({ "text-background-color": String(value), "text-background-opacity": 1 });
4461
+ // the outline is drawn as a stroke twice text-outline-width (see the reader)
4462
+ case "labelOutlineColor":
4463
+ return exact({ "text-outline-color": String(value) });
4464
+ case "labelOutlineWidth":
4465
+ return ifNumber(value, (v) => exact({ "text-outline-width": num6(v / 2) }));
4466
+ case "labelPadding":
4467
+ return ifNumber(value, (v) => exact({ "text-background-padding": v }));
4468
+ // the line round a label's box draws only at an opacity above 0, which is 0 unset
4469
+ case "labelBorderColor":
4470
+ return exact({ "text-border-color": String(value), "text-border-opacity": 1 });
4471
+ case "labelBorderWidth":
4472
+ return ifNumber(value, (v) => exact({ "text-border-width": v, "text-border-opacity": 1 }));
3032
4473
  default:
3033
4474
  return propertyToCyjs(property, value, specs);
3034
4475
  }
3035
4476
  }
4477
+ function ifNumber(value, write) {
4478
+ return typeof value === "number" ? write(value) : null;
4479
+ }
4480
+ function gradientKindToCyjs(kind) {
4481
+ const fill = LINE_FILLS.get(kind);
4482
+ return fill === void 0 ? null : exact({ "line-fill": fill });
4483
+ }
4484
+ function outerBorderStyleToCyjs(style) {
4485
+ const written2 = borderStyleToCyjs(style);
4486
+ return written2 === null ? null : { ...written2, props: { "outline-style": written2.props["border-style"] } };
4487
+ }
4488
+ function pointsToCyjs(points) {
4489
+ const written2 = neutralPointsToCyjs(points);
4490
+ return written2 === null ? null : exact({ "shape-polygon-points": written2 });
4491
+ }
4492
+ function numberToCyjs(property, value) {
4493
+ return property === "fanSpacing" ? exact({ "control-point-step-size": num6(value * 2) }) : exact({ "text-wrap": "wrap", "text-max-width": value });
4494
+ }
3036
4495
  function exact(props) {
3037
4496
  return { props, approximate: false };
3038
4497
  }
3039
4498
  function near(props) {
3040
4499
  return { props, approximate: true };
3041
4500
  }
3042
- function labelPositionToCyjs(text) {
3043
- if (text === "inside-top") {
3044
- return near({ "text-valign": "top", "text-halign": "center" });
3045
- }
3046
- const v = ["top", "bottom"].find((x) => text.startsWith(x)) ?? "center";
3047
- const h = ["left", "right"].find((x) => text.endsWith(x)) ?? "center";
3048
- return exact({ "text-valign": v, "text-halign": h });
4501
+ function labelPositionToCyjs(text2) {
4502
+ const inside = text2.startsWith("inside-");
4503
+ const side = inside ? text2.slice("inside-".length) : text2;
4504
+ const v = ["top", "bottom"].find((x) => side.startsWith(x)) ?? "center";
4505
+ const h = ["left", "right"].find((x) => side.endsWith(x)) ?? "center";
4506
+ const of = (a) => inside && a !== "center" ? `${a}-inside` : a;
4507
+ return exact({ "text-valign": of(v), "text-halign": of(h) });
3049
4508
  }
3050
4509
  function enumToCyjs(name, value, table, specs) {
3051
4510
  const cy = table.get(value);
@@ -3475,13 +4934,81 @@ function exactness(e, rules) {
3475
4934
  const src = refSource(target, n, extracted.columns[target], extracted.features[target]);
3476
4935
  const rows = new Array(n).fill(null);
3477
4936
  for (const property of STYLE_PROPERTIES[target].keys()) {
3478
- const want = resolveRules(rules, target, property, src);
3479
- addBypasses(rows, target, property, want, drawn[target].values[property]);
4937
+ const want2 = resolveRules(rules, target, property, src);
4938
+ addBypasses(rows, target, property, want2, drawn[target].values[property]);
4939
+ }
4940
+ const want = (p) => resolveRules(rules, target, p, src);
4941
+ if (target === "node") {
4942
+ labelSizedBypasses(rows, want, drawn.node.values);
4943
+ }
4944
+ labelOpacityBypasses(rows, want, drawn[target].values);
4945
+ const parts = [
4946
+ ["labelBackgroundOpacity", "text-background-opacity", "opacity", "labelBackground"],
4947
+ ["labelBorderOpacity", "text-border-opacity", "opacity", "labelBorderWidth"],
4948
+ ["labelOutlineOpacity", "text-outline-opacity", "labelOpacity", "labelOutlineWidth"]
4949
+ ];
4950
+ if (target === "node") {
4951
+ parts.push(
4952
+ ["borderOpacity", "border-opacity", "opacity", null],
4953
+ ["outerBorderOpacity", "outline-opacity", "opacity", null]
4954
+ );
4955
+ }
4956
+ for (const part of parts) {
4957
+ partOpacityBypasses(rows, want, drawn[target].values, part);
3480
4958
  }
3481
4959
  out[target] = rows;
3482
4960
  }
3483
4961
  return out;
3484
4962
  }
4963
+ function labelOpacityBypasses(rows, want, got) {
4964
+ const label = want("labelOpacity");
4965
+ const whole = want("opacity");
4966
+ const at = (v) => typeof v === "number" ? v : 1;
4967
+ for (let i = 0; i < rows.length; i++) {
4968
+ const [l, o] = [at(label[i]), at(whole[i])];
4969
+ const rewritten = rows[i]?.opacity !== void 0;
4970
+ if (l === at(got.labelOpacity?.[i]) && !rewritten || Number.isNaN(o) || o <= 0) {
4971
+ continue;
4972
+ }
4973
+ if (l === o && rewritten) {
4974
+ continue;
4975
+ }
4976
+ if (l <= o) {
4977
+ rows[i] = { ...rows[i], "text-opacity": num6(l / o) };
4978
+ } else if (l > 0) {
4979
+ rows[i] = { ...rows[i], opacity: num6(l), "line-opacity": num6(o / l), "text-opacity": 1 };
4980
+ }
4981
+ }
4982
+ }
4983
+ function partOpacityBypasses(rows, want, got, part) {
4984
+ const [property, name, by, drawnBy] = part;
4985
+ const own = want(property);
4986
+ const whole = want(by);
4987
+ const shown = drawnBy === null ? null : want(drawnBy);
4988
+ const at = (v) => typeof v === "number" ? v : 1;
4989
+ for (let i = 0; i < rows.length; i++) {
4990
+ if (shown !== null && shown[i] === null) {
4991
+ continue;
4992
+ }
4993
+ const [r, o] = [at(own[i]), at(whole[i])];
4994
+ const rewritten = rows[i]?.opacity !== void 0 || rows[i]?.["text-opacity"] !== void 0;
4995
+ if (r === at(got[property]?.[i]) && !rewritten || Number.isNaN(o) || o <= 0 || r > o) {
4996
+ continue;
4997
+ }
4998
+ rows[i] = { ...rows[i], [name]: num6(r / o) };
4999
+ }
5000
+ }
5001
+ function labelSizedBypasses(rows, want, got) {
5002
+ const fit = want("labelFit");
5003
+ for (const p of ["width", "height"]) {
5004
+ const size = want(p);
5005
+ for (let i = 0; i < rows.length; i++) {
5006
+ if (fit[i] === "bounds" && size[i] === 0 && !(got.labelFit?.[i] === "bounds" && got[p]?.[i] === 0)) {
5007
+ rows[i] = { ...rows[i], [p]: "label" };
5008
+ }
5009
+ }
5010
+ }
5011
+ }
3485
5012
  function addBypasses(rows, target, property, want, got) {
3486
5013
  for (let i = 0; i < rows.length; i++) {
3487
5014
  const w = want[i];
@@ -3513,4 +5040,4 @@ export {
3513
5040
  evaluateCytoscapeJs as e,
3514
5041
  toCytoscapeStylesheet as t
3515
5042
  };
3516
- //# sourceMappingURL=emit-CD8xnY8s.js.map
5043
+ //# sourceMappingURL=emit-BwHQkZle.js.map