@graphty/graph-io 0.3.47 → 0.3.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{approximations-wWjCRzKj.js → approximations-Bzn3L-je.js} +2 -2
- package/dist/chunks/{approximations-wWjCRzKj.js.map → approximations-Bzn3L-je.js.map} +1 -1
- package/dist/chunks/bends-BGXjv_U4.js +129 -0
- package/dist/chunks/bends-BGXjv_U4.js.map +1 -0
- package/dist/chunks/{block-DiGq58c3.js → block-iptrlMBb.js} +947 -134
- package/dist/chunks/block-iptrlMBb.js.map +1 -0
- package/dist/chunks/choose-CczZJaX_.js +717 -0
- package/dist/chunks/choose-CczZJaX_.js.map +1 -0
- package/dist/chunks/codes-BE2xir2k.js +157 -0
- package/dist/chunks/codes-BE2xir2k.js.map +1 -0
- package/dist/chunks/{constants-BKwqelYD.js → constants-CKkYLPtt.js} +2 -2
- package/dist/chunks/{constants-BKwqelYD.js.map → constants-CKkYLPtt.js.map} +1 -1
- package/dist/chunks/context-C3p0RQxR.js +664 -0
- package/dist/chunks/context-C3p0RQxR.js.map +1 -0
- package/dist/chunks/{convert-BcQ8_jMo.js → convert-Ct2zelbQ.js} +7 -2
- package/dist/chunks/convert-Ct2zelbQ.js.map +1 -0
- package/dist/chunks/credentials-DXHx7nwR.js +349 -0
- package/dist/chunks/credentials-DXHx7nwR.js.map +1 -0
- package/dist/chunks/cx-export-Bt6NoqTQ.js +259 -0
- package/dist/chunks/cx-export-Bt6NoqTQ.js.map +1 -0
- package/dist/chunks/descriptor-B28U25x4.js +60 -0
- package/dist/chunks/descriptor-B28U25x4.js.map +1 -0
- package/dist/chunks/descriptor-C-YDhtsn.js +48 -0
- package/dist/chunks/descriptor-C-YDhtsn.js.map +1 -0
- package/dist/chunks/descriptor-DLA5kINx.js +142 -0
- package/dist/chunks/descriptor-DLA5kINx.js.map +1 -0
- package/dist/chunks/{emit-CwU8cUmG.js → emit-BwHQkZle.js} +1690 -103
- package/dist/chunks/emit-BwHQkZle.js.map +1 -0
- package/dist/chunks/{escape-CgzxiYPg.js → escape-CuCIzNMB.js} +12 -12
- package/dist/chunks/{escape-CgzxiYPg.js.map → escape-CuCIzNMB.js.map} +1 -1
- package/dist/chunks/{export-BvqAXCKh.js → export-Cha4dRFz.js} +48 -1780
- package/dist/chunks/export-Cha4dRFz.js.map +1 -0
- package/dist/chunks/{exporter--Mk9gXCJ.js → exporter-BP6otMO6.js} +6 -4
- package/dist/chunks/{exporter--Mk9gXCJ.js.map → exporter-BP6otMO6.js.map} +1 -1
- package/dist/chunks/{exporter-CrDWIyiq.js → exporter-D2CETOMK.js} +1222 -154
- package/dist/chunks/exporter-D2CETOMK.js.map +1 -0
- package/dist/chunks/{exporter-DndFlGSa.js → exporter-D9yMtocA.js} +7 -6
- package/dist/chunks/{exporter-DndFlGSa.js.map → exporter-D9yMtocA.js.map} +1 -1
- package/dist/chunks/exporter-_jrBTnos.js +1009 -0
- package/dist/chunks/exporter-_jrBTnos.js.map +1 -0
- package/dist/chunks/{exporter-CJgfhF-l.js → exporter-nDfxIK5D.js} +9 -7
- package/dist/chunks/{exporter-CJgfhF-l.js.map → exporter-nDfxIK5D.js.map} +1 -1
- package/dist/chunks/format-BXiAb-1h.js +408 -0
- package/dist/chunks/format-BXiAb-1h.js.map +1 -0
- package/dist/chunks/{generic-Dq1ntt9q.js → generic-ymWCETAJ.js} +387 -31
- package/dist/chunks/generic-ymWCETAJ.js.map +1 -0
- package/dist/chunks/{importer-CMmeMWlC.js → importer-B92x1xY5.js} +15 -263
- package/dist/chunks/importer-B92x1xY5.js.map +1 -0
- package/dist/chunks/{importer-DiZRmOQG.js → importer-CT9mJ1nn.js} +328 -90
- package/dist/chunks/importer-CT9mJ1nn.js.map +1 -0
- package/dist/chunks/{importer-COTK9Tsl.js → importer-DaLTjbds.js} +116 -1099
- package/dist/chunks/importer-DaLTjbds.js.map +1 -0
- package/dist/chunks/{importer-iFYPEKaJ.js → importer-GREKMdIf.js} +28 -16
- package/dist/chunks/importer-GREKMdIf.js.map +1 -0
- package/dist/chunks/{importer-BSvfrX_h.js → importer-PqaaKKnY.js} +23 -1016
- package/dist/chunks/importer-PqaaKKnY.js.map +1 -0
- package/dist/chunks/{importer-yh_aBCU6.js → importer-Vn5QvmmJ.js} +66 -12
- package/dist/chunks/importer-Vn5QvmmJ.js.map +1 -0
- package/dist/chunks/{importer-e6LGpqHB.js → importer-vRq4h3j5.js} +1470 -354
- package/dist/chunks/importer-vRq4h3j5.js.map +1 -0
- package/dist/chunks/input-CAxt_aV-.js +1397 -0
- package/dist/chunks/input-CAxt_aV-.js.map +1 -0
- package/dist/chunks/{json-elements-DJZRZ6jd.js → json-elements-Cq76WjnZ.js} +4 -4
- package/dist/chunks/{json-elements-DJZRZ6jd.js.map → json-elements-Cq76WjnZ.js.map} +1 -1
- package/dist/chunks/{lexicon-CT69Kd87.js → lexicon-Clf4QIyl.js} +299 -77
- package/dist/chunks/lexicon-Clf4QIyl.js.map +1 -0
- package/dist/chunks/{ontology-export-G4MqRdux.js → ontology-export-OMo91mb0.js} +4 -3
- package/dist/chunks/{ontology-export-G4MqRdux.js.map → ontology-export-OMo91mb0.js.map} +1 -1
- package/dist/chunks/{records-CiaWZrFH.js → records-NJiYvekn.js} +2 -2
- package/dist/chunks/{records-CiaWZrFH.js.map → records-NJiYvekn.js.map} +1 -1
- package/dist/chunks/{format-BpQBx8MZ.js → report-CwMfYa9J.js} +70 -127
- package/dist/chunks/report-CwMfYa9J.js.map +1 -0
- package/dist/chunks/round-trip-Zm3_ivgq.js +79 -0
- package/dist/chunks/round-trip-Zm3_ivgq.js.map +1 -0
- package/dist/chunks/sigv4-EokFic1V.js +247 -0
- package/dist/chunks/sigv4-EokFic1V.js.map +1 -0
- package/dist/chunks/{styles-BQnsga7p.js → styles-CCs214_3.js} +1300 -168
- package/dist/chunks/styles-CCs214_3.js.map +1 -0
- package/dist/chunks/styles-Cm62yyQX.js +2812 -0
- package/dist/chunks/styles-Cm62yyQX.js.map +1 -0
- package/dist/chunks/styles-DPQQIig4.js +1928 -0
- package/dist/chunks/styles-DPQQIig4.js.map +1 -0
- package/dist/chunks/styles-yed-UMFdNqze.js +1213 -0
- package/dist/chunks/styles-yed-UMFdNqze.js.map +1 -0
- package/dist/chunks/{text-CzJNFOS9.js → text-ystE2bYi.js} +2 -2
- package/dist/chunks/{text-CzJNFOS9.js.map → text-ystE2bYi.js.map} +1 -1
- package/dist/csv.js +7 -5
- package/dist/csv.js.map +1 -1
- package/dist/cx.js +5 -4
- package/dist/cx.js.map +1 -1
- package/dist/cx2.js +2 -2
- package/dist/cys.js +1 -1
- package/dist/dot.js +5 -4
- package/dist/dot.js.map +1 -1
- package/dist/gexf.js +42 -10
- package/dist/gexf.js.map +1 -1
- package/dist/gml.js +850 -193
- package/dist/gml.js.map +1 -1
- package/dist/graph-io.js +1189 -220
- package/dist/graph-io.js.map +1 -1
- package/dist/graphml.js +3 -3
- package/dist/json.js +3 -2
- package/dist/neo4j.js +6 -4
- package/dist/neo4j.js.map +1 -1
- package/dist/obo.js +1 -1
- package/dist/pajek.js +1 -1
- package/dist/positions.js +45 -3
- package/dist/positions.js.map +1 -1
- package/dist/sources-cypher.d.ts +1 -0
- package/dist/sources-cypher.js +1351 -0
- package/dist/sources-cypher.js.map +1 -0
- package/dist/sources-ndex.d.ts +1 -0
- package/dist/sources-ndex.js +278 -0
- package/dist/sources-ndex.js.map +1 -0
- package/dist/sources-rest.d.ts +1 -0
- package/dist/sources-rest.js +1377 -0
- package/dist/sources-rest.js.map +1 -0
- package/dist/sources-sparql.d.ts +1 -0
- package/dist/sources-sparql.js +405 -0
- package/dist/sources-sparql.js.map +1 -0
- package/dist/src/common/report.d.ts +6 -3
- package/dist/src/common/report.d.ts.map +1 -1
- package/dist/src/common/report.js +15 -9
- package/dist/src/common/report.js.map +1 -1
- package/dist/src/formats/cx/importer.d.ts.map +1 -1
- package/dist/src/formats/cx/importer.js +5 -1
- package/dist/src/formats/cx/importer.js.map +1 -1
- package/dist/src/formats/cx/styles.d.ts +24 -1
- package/dist/src/formats/cx/styles.d.ts.map +1 -1
- package/dist/src/formats/cx/styles.js +118 -11
- package/dist/src/formats/cx/styles.js.map +1 -1
- package/dist/src/formats/cx2/importer.d.ts.map +1 -1
- package/dist/src/formats/cx2/importer.js +1 -0
- package/dist/src/formats/cx2/importer.js.map +1 -1
- package/dist/src/formats/cx2/styles.d.ts.map +1 -1
- package/dist/src/formats/cx2/styles.js +3 -1
- package/dist/src/formats/cx2/styles.js.map +1 -1
- package/dist/src/formats/cys/importer.d.ts.map +1 -1
- package/dist/src/formats/cys/importer.js +1 -0
- package/dist/src/formats/cys/importer.js.map +1 -1
- package/dist/src/formats/cys/styles.d.ts +2 -0
- package/dist/src/formats/cys/styles.d.ts.map +1 -1
- package/dist/src/formats/cys/styles.js +15 -7
- package/dist/src/formats/cys/styles.js.map +1 -1
- package/dist/src/formats/dot/drawing.d.ts +98 -0
- package/dist/src/formats/dot/drawing.d.ts.map +1 -0
- package/dist/src/formats/dot/drawing.js +734 -0
- package/dist/src/formats/dot/drawing.js.map +1 -0
- package/dist/src/formats/dot/importer.d.ts.map +1 -1
- package/dist/src/formats/dot/importer.js +108 -31
- package/dist/src/formats/dot/importer.js.map +1 -1
- package/dist/src/formats/dot/label-places.d.ts +34 -0
- package/dist/src/formats/dot/label-places.d.ts.map +1 -0
- package/dist/src/formats/dot/label-places.js +179 -0
- package/dist/src/formats/dot/label-places.js.map +1 -0
- package/dist/src/formats/dot/record.d.ts +50 -0
- package/dist/src/formats/dot/record.d.ts.map +1 -0
- package/dist/src/formats/dot/record.js +275 -0
- package/dist/src/formats/dot/record.js.map +1 -0
- package/dist/src/formats/dot/styles.d.ts +62 -2
- package/dist/src/formats/dot/styles.d.ts.map +1 -1
- package/dist/src/formats/dot/styles.js +1457 -120
- package/dist/src/formats/dot/styles.js.map +1 -1
- package/dist/src/formats/gexf/dialog-metrics.d.ts +15 -0
- package/dist/src/formats/gexf/dialog-metrics.d.ts.map +1 -0
- package/dist/src/formats/gexf/dialog-metrics.js +59 -0
- package/dist/src/formats/gexf/dialog-metrics.js.map +1 -0
- package/dist/src/formats/gexf/importer.d.ts +7 -0
- package/dist/src/formats/gexf/importer.d.ts.map +1 -1
- package/dist/src/formats/gexf/importer.js +41 -5
- package/dist/src/formats/gexf/importer.js.map +1 -1
- package/dist/src/formats/gexf/preview.d.ts +77 -0
- package/dist/src/formats/gexf/preview.d.ts.map +1 -0
- package/dist/src/formats/gexf/preview.js +191 -0
- package/dist/src/formats/gexf/preview.js.map +1 -0
- package/dist/src/formats/gexf/schema.d.ts.map +1 -1
- package/dist/src/formats/gexf/schema.js +2 -1
- package/dist/src/formats/gexf/schema.js.map +1 -1
- package/dist/src/formats/gexf/styles.d.ts +60 -16
- package/dist/src/formats/gexf/styles.d.ts.map +1 -1
- package/dist/src/formats/gexf/styles.js +883 -131
- package/dist/src/formats/gexf/styles.js.map +1 -1
- package/dist/src/formats/gml/importer.d.ts +5 -2
- package/dist/src/formats/gml/importer.d.ts.map +1 -1
- package/dist/src/formats/gml/importer.js +258 -71
- package/dist/src/formats/gml/importer.js.map +1 -1
- package/dist/src/formats/gml/index.d.ts +1 -1
- package/dist/src/formats/gml/index.d.ts.map +1 -1
- package/dist/src/formats/gml/index.js +1 -1
- package/dist/src/formats/gml/index.js.map +1 -1
- package/dist/src/formats/gml/positions.d.ts +7 -0
- package/dist/src/formats/gml/positions.d.ts.map +1 -1
- package/dist/src/formats/gml/positions.js +29 -7
- package/dist/src/formats/gml/positions.js.map +1 -1
- package/dist/src/formats/gml/styles.d.ts.map +1 -1
- package/dist/src/formats/gml/styles.js +756 -103
- package/dist/src/formats/gml/styles.js.map +1 -1
- package/dist/src/formats/graphml/styles-plain.d.ts.map +1 -1
- package/dist/src/formats/graphml/styles-plain.js +8 -12
- package/dist/src/formats/graphml/styles-plain.js.map +1 -1
- package/dist/src/formats/graphml/styles-yed.d.ts +21 -15
- package/dist/src/formats/graphml/styles-yed.d.ts.map +1 -1
- package/dist/src/formats/graphml/styles-yed.js +749 -148
- package/dist/src/formats/graphml/styles-yed.js.map +1 -1
- package/dist/src/formats/graphml/styles-yfiles3.d.ts +1 -1
- package/dist/src/formats/graphml/styles-yfiles3.d.ts.map +1 -1
- package/dist/src/formats/graphml/styles-yfiles3.js +429 -64
- package/dist/src/formats/graphml/styles-yfiles3.js.map +1 -1
- package/dist/src/formats/graphml/yfiles.d.ts +3 -3
- package/dist/src/formats/graphml/yfiles.d.ts.map +1 -1
- package/dist/src/formats/graphml/yfiles.js +16 -6
- package/dist/src/formats/graphml/yfiles.js.map +1 -1
- package/dist/src/formats/json/dialect.d.ts +3 -2
- package/dist/src/formats/json/dialect.d.ts.map +1 -1
- package/dist/src/formats/json/dialect.js +39 -5
- package/dist/src/formats/json/dialect.js.map +1 -1
- package/dist/src/formats/json/importer.d.ts +13 -2
- package/dist/src/formats/json/importer.d.ts.map +1 -1
- package/dist/src/formats/json/importer.js +42 -6
- package/dist/src/formats/json/importer.js.map +1 -1
- package/dist/src/formats/json/index.d.ts +1 -1
- package/dist/src/formats/json/index.d.ts.map +1 -1
- package/dist/src/formats/json/index.js +1 -1
- package/dist/src/formats/json/index.js.map +1 -1
- package/dist/src/formats/json/positions.d.ts +5 -2
- package/dist/src/formats/json/positions.d.ts.map +1 -1
- package/dist/src/formats/json/positions.js +20 -4
- package/dist/src/formats/json/positions.js.map +1 -1
- package/dist/src/formats/json/styles.d.ts +12 -1
- package/dist/src/formats/json/styles.d.ts.map +1 -1
- package/dist/src/formats/json/styles.js +1755 -136
- package/dist/src/formats/json/styles.js.map +1 -1
- package/dist/src/formats/pajek/draw.d.ts +96 -0
- package/dist/src/formats/pajek/draw.d.ts.map +1 -0
- package/dist/src/formats/pajek/draw.js +372 -0
- package/dist/src/formats/pajek/draw.js.map +1 -0
- package/dist/src/formats/pajek/exporter.d.ts.map +1 -1
- package/dist/src/formats/pajek/exporter.js +70 -51
- package/dist/src/formats/pajek/exporter.js.map +1 -1
- package/dist/src/formats/pajek/importer.d.ts +9 -0
- package/dist/src/formats/pajek/importer.d.ts.map +1 -1
- package/dist/src/formats/pajek/importer.js +233 -102
- package/dist/src/formats/pajek/importer.js.map +1 -1
- package/dist/src/formats/pajek/index.d.ts +1 -0
- package/dist/src/formats/pajek/index.d.ts.map +1 -1
- package/dist/src/formats/pajek/index.js.map +1 -1
- package/dist/src/formats/pajek/styles.d.ts +15 -7
- package/dist/src/formats/pajek/styles.d.ts.map +1 -1
- package/dist/src/formats/pajek/styles.js +1279 -114
- package/dist/src/formats/pajek/styles.js.map +1 -1
- package/dist/src/formats/pajek/syntax.d.ts +10 -1
- package/dist/src/formats/pajek/syntax.d.ts.map +1 -1
- package/dist/src/formats/pajek/syntax.js +26 -2
- package/dist/src/formats/pajek/syntax.js.map +1 -1
- package/dist/src/formats/xgmml/emit.d.ts +1 -0
- package/dist/src/formats/xgmml/emit.d.ts.map +1 -1
- package/dist/src/formats/xgmml/emit.js +65 -5
- package/dist/src/formats/xgmml/emit.js.map +1 -1
- package/dist/src/formats/xgmml/styles.d.ts +23 -3
- package/dist/src/formats/xgmml/styles.d.ts.map +1 -1
- package/dist/src/formats/xgmml/styles.js +278 -60
- package/dist/src/formats/xgmml/styles.js.map +1 -1
- package/dist/src/index.d.ts +10 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +11 -2
- package/dist/src/index.js.map +1 -1
- package/dist/src/positions/convert.d.ts.map +1 -1
- package/dist/src/positions/convert.js +11 -1
- package/dist/src/positions/convert.js.map +1 -1
- package/dist/src/positions/extract.d.ts.map +1 -1
- package/dist/src/positions/extract.js +53 -1
- package/dist/src/positions/extract.js.map +1 -1
- package/dist/src/positions/index.d.ts +1 -1
- package/dist/src/positions/index.d.ts.map +1 -1
- package/dist/src/positions/types.d.ts +59 -0
- package/dist/src/positions/types.d.ts.map +1 -1
- package/dist/src/registry.d.ts +173 -1
- package/dist/src/registry.d.ts.map +1 -1
- package/dist/src/registry.js +196 -1
- package/dist/src/registry.js.map +1 -1
- package/dist/src/sources/builtins.d.ts +11 -0
- package/dist/src/sources/builtins.d.ts.map +1 -0
- package/dist/src/sources/builtins.js +53 -0
- package/dist/src/sources/builtins.js.map +1 -0
- package/dist/src/sources/codes.d.ts +230 -0
- package/dist/src/sources/codes.d.ts.map +1 -0
- package/dist/src/sources/codes.js +58 -0
- package/dist/src/sources/codes.js.map +1 -0
- package/dist/src/sources/context.d.ts +112 -0
- package/dist/src/sources/context.d.ts.map +1 -0
- package/dist/src/sources/context.js +740 -0
- package/dist/src/sources/context.js.map +1 -0
- package/dist/src/sources/credentials.d.ts +179 -0
- package/dist/src/sources/credentials.d.ts.map +1 -0
- package/dist/src/sources/credentials.js +301 -0
- package/dist/src/sources/credentials.js.map +1 -0
- package/dist/src/sources/cypher/descriptor.d.ts +21 -0
- package/dist/src/sources/cypher/descriptor.d.ts.map +1 -0
- package/dist/src/sources/cypher/descriptor.js +124 -0
- package/dist/src/sources/cypher/descriptor.js.map +1 -0
- package/dist/src/sources/cypher/flatten.d.ts +72 -0
- package/dist/src/sources/cypher/flatten.d.ts.map +1 -0
- package/dist/src/sources/cypher/flatten.js +279 -0
- package/dist/src/sources/cypher/flatten.js.map +1 -0
- package/dist/src/sources/cypher/index.d.ts +33 -0
- package/dist/src/sources/cypher/index.d.ts.map +1 -0
- package/dist/src/sources/cypher/index.js +511 -0
- package/dist/src/sources/cypher/index.js.map +1 -0
- package/dist/src/sources/cypher/params.d.ts +40 -0
- package/dist/src/sources/cypher/params.d.ts.map +1 -0
- package/dist/src/sources/cypher/params.js +6 -0
- package/dist/src/sources/cypher/params.js.map +1 -0
- package/dist/src/sources/cypher/profiles.d.ts +44 -0
- package/dist/src/sources/cypher/profiles.d.ts.map +1 -0
- package/dist/src/sources/cypher/profiles.js +61 -0
- package/dist/src/sources/cypher/profiles.js.map +1 -0
- package/dist/src/sources/cypher/query-builder.d.ts +123 -0
- package/dist/src/sources/cypher/query-builder.d.ts.map +1 -0
- package/dist/src/sources/cypher/query-builder.js +267 -0
- package/dist/src/sources/cypher/query-builder.js.map +1 -0
- package/dist/src/sources/cypher/transports/bolt.d.ts +21 -0
- package/dist/src/sources/cypher/transports/bolt.d.ts.map +1 -0
- package/dist/src/sources/cypher/transports/bolt.js +185 -0
- package/dist/src/sources/cypher/transports/bolt.js.map +1 -0
- package/dist/src/sources/cypher/transports/neptune-analytics.d.ts +15 -0
- package/dist/src/sources/cypher/transports/neptune-analytics.d.ts.map +1 -0
- package/dist/src/sources/cypher/transports/neptune-analytics.js +38 -0
- package/dist/src/sources/cypher/transports/neptune-analytics.js.map +1 -0
- package/dist/src/sources/cypher/transports/neptune-https.d.ts +31 -0
- package/dist/src/sources/cypher/transports/neptune-https.d.ts.map +1 -0
- package/dist/src/sources/cypher/transports/neptune-https.js +104 -0
- package/dist/src/sources/cypher/transports/neptune-https.js.map +1 -0
- package/dist/src/sources/cypher/transports/query-api.d.ts +14 -0
- package/dist/src/sources/cypher/transports/query-api.d.ts.map +1 -0
- package/dist/src/sources/cypher/transports/query-api.js +80 -0
- package/dist/src/sources/cypher/transports/query-api.js.map +1 -0
- package/dist/src/sources/cypher/transports/transport.d.ts +78 -0
- package/dist/src/sources/cypher/transports/transport.d.ts.map +1 -0
- package/dist/src/sources/cypher/transports/transport.js +77 -0
- package/dist/src/sources/cypher/transports/transport.js.map +1 -0
- package/dist/src/sources/cypher/types-map.d.ts +91 -0
- package/dist/src/sources/cypher/types-map.d.ts.map +1 -0
- package/dist/src/sources/cypher/types-map.js +306 -0
- package/dist/src/sources/cypher/types-map.js.map +1 -0
- package/dist/src/sources/define.d.ts +47 -0
- package/dist/src/sources/define.d.ts.map +1 -0
- package/dist/src/sources/define.js +173 -0
- package/dist/src/sources/define.js.map +1 -0
- package/dist/src/sources/fail.d.ts +33 -0
- package/dist/src/sources/fail.d.ts.map +1 -0
- package/dist/src/sources/fail.js +49 -0
- package/dist/src/sources/fail.js.map +1 -0
- package/dist/src/sources/ids.d.ts +69 -0
- package/dist/src/sources/ids.d.ts.map +1 -0
- package/dist/src/sources/ids.js +69 -0
- package/dist/src/sources/ids.js.map +1 -0
- package/dist/src/sources/ndex/client.d.ts +31 -0
- package/dist/src/sources/ndex/client.d.ts.map +1 -0
- package/dist/src/sources/ndex/client.js +90 -0
- package/dist/src/sources/ndex/client.js.map +1 -0
- package/dist/src/sources/ndex/descriptor.d.ts +10 -0
- package/dist/src/sources/ndex/descriptor.d.ts.map +1 -0
- package/dist/src/sources/ndex/descriptor.js +55 -0
- package/dist/src/sources/ndex/descriptor.js.map +1 -0
- package/dist/src/sources/ndex/expand.d.ts +20 -0
- package/dist/src/sources/ndex/expand.d.ts.map +1 -0
- package/dist/src/sources/ndex/expand.js +87 -0
- package/dist/src/sources/ndex/expand.js.map +1 -0
- package/dist/src/sources/ndex/index.d.ts +25 -0
- package/dist/src/sources/ndex/index.d.ts.map +1 -0
- package/dist/src/sources/ndex/index.js +191 -0
- package/dist/src/sources/ndex/index.js.map +1 -0
- package/dist/src/sources/ndex/params.d.ts +17 -0
- package/dist/src/sources/ndex/params.d.ts.map +1 -0
- package/dist/src/sources/ndex/params.js +6 -0
- package/dist/src/sources/ndex/params.js.map +1 -0
- package/dist/src/sources/ndex/share-url.d.ts +40 -0
- package/dist/src/sources/ndex/share-url.d.ts.map +1 -0
- package/dist/src/sources/ndex/share-url.js +64 -0
- package/dist/src/sources/ndex/share-url.js.map +1 -0
- package/dist/src/sources/params.d.ts +31 -0
- package/dist/src/sources/params.d.ts.map +1 -0
- package/dist/src/sources/params.js +6 -0
- package/dist/src/sources/params.js.map +1 -0
- package/dist/src/sources/registry.d.ts +118 -0
- package/dist/src/sources/registry.d.ts.map +1 -0
- package/dist/src/sources/registry.js +193 -0
- package/dist/src/sources/registry.js.map +1 -0
- package/dist/src/sources/rest/descriptor.d.ts +16 -0
- package/dist/src/sources/rest/descriptor.d.ts.map +1 -0
- package/dist/src/sources/rest/descriptor.js +76 -0
- package/dist/src/sources/rest/descriptor.js.map +1 -0
- package/dist/src/sources/rest/index.d.ts +14 -0
- package/dist/src/sources/rest/index.d.ts.map +1 -0
- package/dist/src/sources/rest/index.js +13 -0
- package/dist/src/sources/rest/index.js.map +1 -0
- package/dist/src/sources/rest/mapping.d.ts +30 -0
- package/dist/src/sources/rest/mapping.d.ts.map +1 -0
- package/dist/src/sources/rest/mapping.js +362 -0
- package/dist/src/sources/rest/mapping.js.map +1 -0
- package/dist/src/sources/rest/openalex.d.ts +27 -0
- package/dist/src/sources/rest/openalex.d.ts.map +1 -0
- package/dist/src/sources/rest/openalex.js +269 -0
- package/dist/src/sources/rest/openalex.js.map +1 -0
- package/dist/src/sources/rest/paging.d.ts +53 -0
- package/dist/src/sources/rest/paging.d.ts.map +1 -0
- package/dist/src/sources/rest/paging.js +138 -0
- package/dist/src/sources/rest/paging.js.map +1 -0
- package/dist/src/sources/rest/params.d.ts +216 -0
- package/dist/src/sources/rest/params.d.ts.map +1 -0
- package/dist/src/sources/rest/params.js +7 -0
- package/dist/src/sources/rest/params.js.map +1 -0
- package/dist/src/sources/rest/records.d.ts +41 -0
- package/dist/src/sources/rest/records.d.ts.map +1 -0
- package/dist/src/sources/rest/records.js +240 -0
- package/dist/src/sources/rest/records.js.map +1 -0
- package/dist/src/sources/rest/samples/deps-dev.d.ts +10 -0
- package/dist/src/sources/rest/samples/deps-dev.d.ts.map +1 -0
- package/dist/src/sources/rest/samples/deps-dev.js +47 -0
- package/dist/src/sources/rest/samples/deps-dev.js.map +1 -0
- package/dist/src/sources/rest/samples/string.d.ts +9 -0
- package/dist/src/sources/rest/samples/string.d.ts.map +1 -0
- package/dist/src/sources/rest/samples/string.js +42 -0
- package/dist/src/sources/rest/samples/string.js.map +1 -0
- package/dist/src/sources/rest/selectors.d.ts +41 -0
- package/dist/src/sources/rest/selectors.d.ts.map +1 -0
- package/dist/src/sources/rest/selectors.js +81 -0
- package/dist/src/sources/rest/selectors.js.map +1 -0
- package/dist/src/sources/rest/source.d.ts +67 -0
- package/dist/src/sources/rest/source.d.ts.map +1 -0
- package/dist/src/sources/rest/source.js +650 -0
- package/dist/src/sources/rest/source.js.map +1 -0
- package/dist/src/sources/rest/templates.d.ts +38 -0
- package/dist/src/sources/rest/templates.d.ts.map +1 -0
- package/dist/src/sources/rest/templates.js +125 -0
- package/dist/src/sources/rest/templates.js.map +1 -0
- package/dist/src/sources/run.d.ts +93 -0
- package/dist/src/sources/run.d.ts.map +1 -0
- package/dist/src/sources/run.js +673 -0
- package/dist/src/sources/run.js.map +1 -0
- package/dist/src/sources/sha256.d.ts +12 -0
- package/dist/src/sources/sha256.d.ts.map +1 -0
- package/dist/src/sources/sha256.js +95 -0
- package/dist/src/sources/sha256.js.map +1 -0
- package/dist/src/sources/sigv4.d.ts +26 -0
- package/dist/src/sources/sigv4.d.ts.map +1 -0
- package/dist/src/sources/sigv4.js +184 -0
- package/dist/src/sources/sigv4.js.map +1 -0
- package/dist/src/sources/sparql/descriptor.d.ts +10 -0
- package/dist/src/sources/sparql/descriptor.d.ts.map +1 -0
- package/dist/src/sources/sparql/descriptor.js +64 -0
- package/dist/src/sources/sparql/descriptor.js.map +1 -0
- package/dist/src/sources/sparql/index.d.ts +28 -0
- package/dist/src/sources/sparql/index.d.ts.map +1 -0
- package/dist/src/sources/sparql/index.js +314 -0
- package/dist/src/sources/sparql/index.js.map +1 -0
- package/dist/src/sources/sparql/ntriples.d.ts +69 -0
- package/dist/src/sources/sparql/ntriples.d.ts.map +1 -0
- package/dist/src/sources/sparql/ntriples.js +180 -0
- package/dist/src/sources/sparql/ntriples.js.map +1 -0
- package/dist/src/sources/sparql/params.d.ts +27 -0
- package/dist/src/sources/sparql/params.d.ts.map +1 -0
- package/dist/src/sources/sparql/params.js +5 -0
- package/dist/src/sources/sparql/params.js.map +1 -0
- package/dist/src/sources/sparql/query.d.ts +72 -0
- package/dist/src/sources/sparql/query.d.ts.map +1 -0
- package/dist/src/sources/sparql/query.js +113 -0
- package/dist/src/sources/sparql/query.js.map +1 -0
- package/dist/src/sources/testing.d.ts +96 -0
- package/dist/src/sources/testing.d.ts.map +1 -0
- package/dist/src/sources/testing.js +138 -0
- package/dist/src/sources/testing.js.map +1 -0
- package/dist/src/sources/types.d.ts +696 -0
- package/dist/src/sources/types.d.ts.map +1 -0
- package/dist/src/sources/types.js +10 -0
- package/dist/src/sources/types.js.map +1 -0
- package/dist/src/styles/annotations.d.ts +61 -5
- package/dist/src/styles/annotations.d.ts.map +1 -1
- package/dist/src/styles/annotations.js +130 -22
- package/dist/src/styles/annotations.js.map +1 -1
- package/dist/src/styles/canon/bends.d.ts +46 -0
- package/dist/src/styles/canon/bends.d.ts.map +1 -1
- package/dist/src/styles/canon/bends.js +123 -0
- package/dist/src/styles/canon/bends.js.map +1 -1
- package/dist/src/styles/canon/color-tables.d.ts +6 -1
- package/dist/src/styles/canon/color-tables.d.ts.map +1 -1
- package/dist/src/styles/canon/color-tables.js +10 -4
- package/dist/src/styles/canon/color-tables.js.map +1 -1
- package/dist/src/styles/canon/color.d.ts +3 -1
- package/dist/src/styles/canon/color.d.ts.map +1 -1
- package/dist/src/styles/canon/color.js +103 -3
- package/dist/src/styles/canon/color.js.map +1 -1
- package/dist/src/styles/canon/enums.d.ts +2 -2
- package/dist/src/styles/canon/enums.d.ts.map +1 -1
- package/dist/src/styles/canon/enums.js +82 -7
- package/dist/src/styles/canon/enums.js.map +1 -1
- package/dist/src/styles/canon/graphviz.d.ts +12 -3
- package/dist/src/styles/canon/graphviz.d.ts.map +1 -1
- package/dist/src/styles/canon/graphviz.js +57 -9
- package/dist/src/styles/canon/graphviz.js.map +1 -1
- package/dist/src/styles/canon/number.d.ts +8 -0
- package/dist/src/styles/canon/number.d.ts.map +1 -1
- package/dist/src/styles/canon/number.js +18 -0
- package/dist/src/styles/canon/number.js.map +1 -1
- package/dist/src/styles/canon/text.d.ts +29 -2
- package/dist/src/styles/canon/text.d.ts.map +1 -1
- package/dist/src/styles/canon/text.js +156 -16
- package/dist/src/styles/canon/text.js.map +1 -1
- package/dist/src/styles/codes.d.ts +2 -0
- package/dist/src/styles/codes.d.ts.map +1 -1
- package/dist/src/styles/codes.js +2 -0
- package/dist/src/styles/codes.js.map +1 -1
- package/dist/src/styles/cyjs/cascade.d.ts.map +1 -1
- package/dist/src/styles/cyjs/cascade.js +1037 -35
- package/dist/src/styles/cyjs/cascade.js.map +1 -1
- package/dist/src/styles/cyjs/defaults-table.d.ts.map +1 -1
- package/dist/src/styles/cyjs/defaults-table.js +5 -0
- package/dist/src/styles/cyjs/defaults-table.js.map +1 -1
- package/dist/src/styles/cyjs/emit.d.ts.map +1 -1
- package/dist/src/styles/cyjs/emit.js +216 -12
- package/dist/src/styles/cyjs/emit.js.map +1 -1
- package/dist/src/styles/cyjs/face.d.ts +20 -0
- package/dist/src/styles/cyjs/face.d.ts.map +1 -0
- package/dist/src/styles/cyjs/face.js +332 -0
- package/dist/src/styles/cyjs/face.js.map +1 -0
- package/dist/src/styles/cyjs/mappers.d.ts +48 -2
- package/dist/src/styles/cyjs/mappers.d.ts.map +1 -1
- package/dist/src/styles/cyjs/mappers.js +463 -26
- package/dist/src/styles/cyjs/mappers.js.map +1 -1
- package/dist/src/styles/cyjs/routes.d.ts +53 -0
- package/dist/src/styles/cyjs/routes.d.ts.map +1 -0
- package/dist/src/styles/cyjs/routes.js +360 -0
- package/dist/src/styles/cyjs/routes.js.map +1 -0
- package/dist/src/styles/cytoscape/charts.d.ts +23 -0
- package/dist/src/styles/cytoscape/charts.d.ts.map +1 -0
- package/dist/src/styles/cytoscape/charts.js +560 -0
- package/dist/src/styles/cytoscape/charts.js.map +1 -0
- package/dist/src/styles/cytoscape/emit.d.ts.map +1 -1
- package/dist/src/styles/cytoscape/emit.js +204 -44
- package/dist/src/styles/cytoscape/emit.js.map +1 -1
- package/dist/src/styles/cytoscape/lexicon.d.ts +97 -3
- package/dist/src/styles/cytoscape/lexicon.d.ts.map +1 -1
- package/dist/src/styles/cytoscape/lexicon.js +413 -79
- package/dist/src/styles/cytoscape/lexicon.js.map +1 -1
- package/dist/src/styles/cytoscape/mappings.d.ts +30 -0
- package/dist/src/styles/cytoscape/mappings.d.ts.map +1 -1
- package/dist/src/styles/cytoscape/mappings.js +92 -0
- package/dist/src/styles/cytoscape/mappings.js.map +1 -1
- package/dist/src/styles/cytoscape/resolve.d.ts +46 -3
- package/dist/src/styles/cytoscape/resolve.d.ts.map +1 -1
- package/dist/src/styles/cytoscape/resolve.js +632 -22
- package/dist/src/styles/cytoscape/resolve.js.map +1 -1
- package/dist/src/styles/cytoscape/translate.d.ts.map +1 -1
- package/dist/src/styles/cytoscape/translate.js +10 -10
- package/dist/src/styles/cytoscape/translate.js.map +1 -1
- package/dist/src/styles/defaults.d.ts +50 -0
- package/dist/src/styles/defaults.d.ts.map +1 -1
- package/dist/src/styles/defaults.js +315 -37
- package/dist/src/styles/defaults.js.map +1 -1
- package/dist/src/styles/index.d.ts +4 -3
- package/dist/src/styles/index.d.ts.map +1 -1
- package/dist/src/styles/index.js +3 -2
- package/dist/src/styles/index.js.map +1 -1
- package/dist/src/styles/internal.d.ts +1 -0
- package/dist/src/styles/internal.d.ts.map +1 -1
- package/dist/src/styles/internal.js +1 -0
- package/dist/src/styles/internal.js.map +1 -1
- package/dist/src/styles/io/block.d.ts.map +1 -1
- package/dist/src/styles/io/block.js +9 -0
- package/dist/src/styles/io/block.js.map +1 -1
- package/dist/src/styles/io/generic.d.ts.map +1 -1
- package/dist/src/styles/io/generic.js +56 -16
- package/dist/src/styles/io/generic.js.map +1 -1
- package/dist/src/styles/io/round-trip.d.ts +56 -0
- package/dist/src/styles/io/round-trip.d.ts.map +1 -0
- package/dist/src/styles/io/round-trip.js +138 -0
- package/dist/src/styles/io/round-trip.js.map +1 -0
- package/dist/src/styles/io/writer.d.ts.map +1 -1
- package/dist/src/styles/io/writer.js +13 -4
- package/dist/src/styles/io/writer.js.map +1 -1
- package/dist/src/styles/notes.d.ts.map +1 -1
- package/dist/src/styles/notes.js +1 -0
- package/dist/src/styles/notes.js.map +1 -1
- package/dist/src/styles/plan/features.d.ts +1 -1
- package/dist/src/styles/plan/features.d.ts.map +1 -1
- package/dist/src/styles/plan/features.js +22 -2
- package/dist/src/styles/plan/features.js.map +1 -1
- package/dist/src/styles/plan/index.d.ts +1 -1
- package/dist/src/styles/plan/index.d.ts.map +1 -1
- package/dist/src/styles/plan/index.js +1 -1
- package/dist/src/styles/plan/index.js.map +1 -1
- package/dist/src/styles/plan/plan.d.ts.map +1 -1
- package/dist/src/styles/plan/plan.js +61 -4
- package/dist/src/styles/plan/plan.js.map +1 -1
- package/dist/src/styles/plan/resolve.d.ts +13 -1
- package/dist/src/styles/plan/resolve.d.ts.map +1 -1
- package/dist/src/styles/plan/resolve.js +53 -6
- package/dist/src/styles/plan/resolve.js.map +1 -1
- package/dist/src/styles/slots.d.ts +14 -0
- package/dist/src/styles/slots.d.ts.map +1 -0
- package/dist/src/styles/slots.js +20 -0
- package/dist/src/styles/slots.js.map +1 -0
- package/dist/src/styles/types.d.ts +638 -5
- package/dist/src/styles/types.d.ts.map +1 -1
- package/dist/src/styles/vocabulary.d.ts +3 -2
- package/dist/src/styles/vocabulary.d.ts.map +1 -1
- package/dist/src/styles/vocabulary.js +218 -1
- package/dist/src/styles/vocabulary.js.map +1 -1
- package/dist/src/types.d.ts +19 -5
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/types.js.map +1 -1
- package/dist/styles.js +29 -238
- package/dist/styles.js.map +1 -1
- package/dist/xgmml.js +3 -3
- package/docs/samples/people.json +6 -0
- package/package.json +53 -8
- package/src/common/report.ts +27 -7
- package/src/formats/cx/importer.ts +6 -1
- package/src/formats/cx/styles.ts +144 -9
- package/src/formats/cx2/importer.ts +1 -0
- package/src/formats/cx2/styles.ts +3 -1
- package/src/formats/cys/importer.ts +1 -0
- package/src/formats/cys/styles.ts +27 -5
- package/src/formats/dot/drawing.ts +799 -0
- package/src/formats/dot/importer.ts +120 -35
- package/src/formats/dot/label-places.ts +228 -0
- package/src/formats/dot/record.ts +336 -0
- package/src/formats/dot/styles.ts +1657 -154
- package/src/formats/gexf/dialog-metrics.ts +61 -0
- package/src/formats/gexf/importer.ts +50 -5
- package/src/formats/gexf/preview.ts +217 -0
- package/src/formats/gexf/schema.ts +2 -1
- package/src/formats/gexf/styles.ts +1144 -142
- package/src/formats/gml/importer.ts +291 -76
- package/src/formats/gml/index.ts +1 -1
- package/src/formats/gml/positions.ts +29 -7
- package/src/formats/gml/styles.ts +854 -111
- package/src/formats/graphml/styles-plain.ts +8 -23
- package/src/formats/graphml/styles-yed.ts +821 -159
- package/src/formats/graphml/styles-yfiles3.ts +485 -63
- package/src/formats/graphml/yfiles.ts +19 -6
- package/src/formats/json/dialect.ts +41 -5
- package/src/formats/json/importer.ts +59 -7
- package/src/formats/json/index.ts +1 -0
- package/src/formats/json/positions.ts +22 -5
- package/src/formats/json/styles.ts +2041 -185
- package/src/formats/pajek/draw.ts +458 -0
- package/src/formats/pajek/exporter.ts +81 -49
- package/src/formats/pajek/importer.ts +278 -103
- package/src/formats/pajek/index.ts +1 -0
- package/src/formats/pajek/styles.ts +1382 -133
- package/src/formats/pajek/syntax.ts +27 -2
- package/src/formats/xgmml/emit.ts +73 -5
- package/src/formats/xgmml/styles.ts +331 -71
- package/src/index.ts +94 -0
- package/src/positions/convert.ts +12 -1
- package/src/positions/extract.ts +55 -1
- package/src/positions/index.ts +1 -0
- package/src/positions/types.ts +60 -0
- package/src/registry.ts +326 -1
- package/src/sources/builtins.ts +63 -0
- package/src/sources/codes.ts +235 -0
- package/src/sources/context.ts +894 -0
- package/src/sources/credentials.ts +409 -0
- package/src/sources/cypher/descriptor.ts +131 -0
- package/src/sources/cypher/flatten.ts +323 -0
- package/src/sources/cypher/index.ts +628 -0
- package/src/sources/cypher/params.ts +41 -0
- package/src/sources/cypher/profiles.ts +78 -0
- package/src/sources/cypher/query-builder.ts +327 -0
- package/src/sources/cypher/transports/bolt.ts +228 -0
- package/src/sources/cypher/transports/neptune-analytics.ts +41 -0
- package/src/sources/cypher/transports/neptune-https.ts +122 -0
- package/src/sources/cypher/transports/query-api.ts +100 -0
- package/src/sources/cypher/transports/transport.ts +139 -0
- package/src/sources/cypher/types-map.ts +418 -0
- package/src/sources/define.ts +195 -0
- package/src/sources/fail.ts +70 -0
- package/src/sources/ids.ts +80 -0
- package/src/sources/ndex/client.ts +102 -0
- package/src/sources/ndex/descriptor.ts +64 -0
- package/src/sources/ndex/expand.ts +100 -0
- package/src/sources/ndex/index.ts +235 -0
- package/src/sources/ndex/params.ts +17 -0
- package/src/sources/ndex/share-url.ts +84 -0
- package/src/sources/params.ts +32 -0
- package/src/sources/registry.ts +325 -0
- package/src/sources/rest/descriptor.ts +79 -0
- package/src/sources/rest/index.ts +22 -0
- package/src/sources/rest/mapping.ts +401 -0
- package/src/sources/rest/openalex.ts +288 -0
- package/src/sources/rest/paging.ts +180 -0
- package/src/sources/rest/params.ts +243 -0
- package/src/sources/rest/records.ts +289 -0
- package/src/sources/rest/samples/deps-dev.ts +49 -0
- package/src/sources/rest/samples/string.ts +44 -0
- package/src/sources/rest/selectors.ts +91 -0
- package/src/sources/rest/source.ts +776 -0
- package/src/sources/rest/templates.ts +151 -0
- package/src/sources/run.ts +793 -0
- package/src/sources/sha256.ts +99 -0
- package/src/sources/sigv4.ts +209 -0
- package/src/sources/sparql/descriptor.ts +67 -0
- package/src/sources/sparql/index.ts +356 -0
- package/src/sources/sparql/ntriples.ts +219 -0
- package/src/sources/sparql/params.ts +28 -0
- package/src/sources/sparql/query.ts +162 -0
- package/src/sources/testing.ts +210 -0
- package/src/sources/types.ts +776 -0
- package/src/styles/annotations.ts +201 -27
- package/src/styles/canon/bends.ts +137 -0
- package/src/styles/canon/color-tables.ts +10 -4
- package/src/styles/canon/color.ts +105 -3
- package/src/styles/canon/enums.ts +99 -8
- package/src/styles/canon/graphviz.ts +71 -10
- package/src/styles/canon/number.ts +19 -0
- package/src/styles/canon/text.ts +187 -16
- package/src/styles/codes.ts +2 -0
- package/src/styles/cyjs/cascade.ts +1193 -38
- package/src/styles/cyjs/defaults-table.ts +5 -0
- package/src/styles/cyjs/emit.ts +247 -16
- package/src/styles/cyjs/face.ts +372 -0
- package/src/styles/cyjs/mappers.ts +498 -28
- package/src/styles/cyjs/routes.ts +432 -0
- package/src/styles/cytoscape/charts.ts +684 -0
- package/src/styles/cytoscape/emit.ts +220 -44
- package/src/styles/cytoscape/lexicon.ts +459 -80
- package/src/styles/cytoscape/mappings.ts +108 -0
- package/src/styles/cytoscape/resolve.ts +763 -23
- package/src/styles/cytoscape/translate.ts +11 -11
- package/src/styles/defaults.ts +436 -38
- package/src/styles/index.ts +5 -0
- package/src/styles/internal.ts +1 -0
- package/src/styles/io/block.ts +10 -0
- package/src/styles/io/generic.ts +79 -23
- package/src/styles/io/round-trip.ts +202 -0
- package/src/styles/io/writer.ts +14 -4
- package/src/styles/notes.ts +1 -0
- package/src/styles/plan/features.ts +23 -2
- package/src/styles/plan/index.ts +1 -1
- package/src/styles/plan/plan.ts +69 -5
- package/src/styles/plan/resolve.ts +61 -6
- package/src/styles/slots.ts +25 -0
- package/src/styles/types.ts +658 -4
- package/src/styles/vocabulary.ts +226 -3
- package/src/types.ts +19 -5
- package/dist/chunks/block-DiGq58c3.js.map +0 -1
- package/dist/chunks/choose--jM0yYCo.js +0 -57
- package/dist/chunks/choose--jM0yYCo.js.map +0 -1
- package/dist/chunks/convert-BcQ8_jMo.js.map +0 -1
- package/dist/chunks/emit-CwU8cUmG.js.map +0 -1
- package/dist/chunks/export-BvqAXCKh.js.map +0 -1
- package/dist/chunks/exporter-CrDWIyiq.js.map +0 -1
- package/dist/chunks/format-BpQBx8MZ.js.map +0 -1
- package/dist/chunks/generic-Dq1ntt9q.js.map +0 -1
- package/dist/chunks/importer-BSvfrX_h.js.map +0 -1
- package/dist/chunks/importer-CMmeMWlC.js.map +0 -1
- package/dist/chunks/importer-COTK9Tsl.js.map +0 -1
- package/dist/chunks/importer-DiZRmOQG.js.map +0 -1
- package/dist/chunks/importer-e6LGpqHB.js.map +0 -1
- package/dist/chunks/importer-iFYPEKaJ.js.map +0 -1
- package/dist/chunks/importer-yh_aBCU6.js.map +0 -1
- package/dist/chunks/lexicon-CT69Kd87.js.map +0 -1
- package/dist/chunks/styles-BQnsga7p.js.map +0 -1
- package/dist/chunks/styles-D3fRphrO.js +0 -690
- package/dist/chunks/styles-D3fRphrO.js.map +0 -1
- package/dist/chunks/styles-yed-BF5x3_Y5.js +0 -842
- package/dist/chunks/styles-yed-BF5x3_Y5.js.map +0 -1
- package/dist/chunks/writer-DMKvthQE.js +0 -448
- package/dist/chunks/writer-DMKvthQE.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emit-BwHQkZle.js","sources":["../../src/styles/budget.ts","../../src/styles/cyjs/defaults-table.ts","../../src/styles/cyjs/face.ts","../../src/styles/cyjs/mappers.ts","../../src/styles/cyjs/routes.ts","../../src/styles/cyjs/selector.ts","../../src/styles/cyjs/stylesheet-text.ts","../../src/styles/cyjs/cascade.ts","../../src/styles/cyjs/emit.ts"],"sourcesContent":["/**\n * The one counted work budget of a style extraction: the readers' cascades, the planner, the translation and the\n * replay all spend from it. It counts operations, never time, so the same file always stops at the same place.\n */\n\nimport type { StyleTarget, StyleWorkBudget } from \"./types.js\";\n\n/**\n * Operations one extraction may spend per target (nodes, edges) before what is left is copied per element.\n * @category Styles\n */\nexport const STYLE_WORK_BUDGET = 2e8;\n\n/**\n * A counted work budget per target. `spend()` adds operations and answers whether the target is still within its\n * limit; once a target has spent more than the limit it stays exhausted.\n * @category Styles\n */\nexport class StyleBudget implements StyleWorkBudget {\n /** Operations allowed per target. */\n readonly limit: number;\n readonly #used = { node: 0, edge: 0 };\n\n /**\n * Creates a budget.\n * @param limit - operations allowed per target; defaults to `STYLE_WORK_BUDGET`\n */\n constructor(limit: number = STYLE_WORK_BUDGET) {\n this.limit = limit;\n }\n\n /**\n * Spends operations for a target.\n * @param target - nodes or edges\n * @param operations - how many operations the work costs\n * @returns true while the target has spent at most `limit` operations\n */\n spend(target: StyleTarget, operations: number): boolean {\n this.#used[target] += operations;\n return this.#used[target] <= this.limit;\n }\n\n /**\n * Whether a target has spent more than `limit` operations.\n * @param target - nodes or edges\n * @returns true once the target's budget is exhausted\n */\n exhausted(target: StyleTarget): boolean {\n return this.#used[target] > this.limit;\n }\n\n /**\n * How many operations a target has spent.\n * @param target - nodes or edges\n * @returns the operations spent so far\n */\n used(target: StyleTarget): number {\n return this.#used[target];\n }\n}\n","/**\n * Cytoscape.js 3.34's own defaults for the properties graph-io carries, read from a headless core\n * (`cy.style().getDefaultProperty(name).strValue` and the first `cy.style().defaultLength` entries of its\n * stylesheet).\n *\n * Two tables, because Cytoscape.js uses two kinds of default:\n * - the property defaults: the value a property has when no rule sets it, and the value a `data()` or `mapData()`\n * that fails (a missing field, a value the property refuses) RESETS the property to, whatever the rules beneath say.\n * An edge's width resets to 30px there, not to the 3px edges are drawn with.\n * - the default stylesheet: rules Cytoscape.js puts beneath every stylesheet (edges 3px wide, compound parents drawn\n * as gray rectangles, loops curved, selected elements blue).\n */\n\n/** The property defaults, by Cytoscape.js property name, as Cytoscape.js writes them. */\nexport const CYJS_PROPERTY_DEFAULTS: ReadonlyMap<string, string> = new Map([\n [\"background-color\", \"rgb(153,153,153)\"],\n [\"background-opacity\", \"1\"],\n [\"opacity\", \"1\"],\n [\"border-color\", \"rgb(0,0,0)\"],\n [\"border-opacity\", \"1\"],\n [\"border-width\", \"0px\"],\n [\"border-style\", \"solid\"],\n [\"shape\", \"ellipse\"],\n [\"width\", \"30px\"],\n [\"height\", \"30px\"],\n [\"label\", \"\"],\n [\"color\", \"rgb(0,0,0)\"],\n [\"font-size\", \"16px\"],\n [\"font-family\", \"Helvetica Neue, Helvetica, sans-serif\"],\n [\"font-weight\", \"normal\"],\n [\"font-style\", \"normal\"],\n [\"visibility\", \"visible\"],\n [\"display\", \"element\"],\n [\"text-valign\", \"top\"],\n [\"text-halign\", \"center\"],\n [\"text-wrap\", \"none\"],\n [\"text-max-width\", \"9999px\"],\n [\"line-color\", \"rgb(153,153,153)\"],\n [\"line-style\", \"solid\"],\n [\"target-arrow-shape\", \"none\"],\n [\"source-arrow-shape\", \"none\"],\n [\"target-arrow-fill\", \"filled\"],\n [\"source-arrow-fill\", \"filled\"],\n [\"target-arrow-color\", \"rgb(153,153,153)\"],\n [\"source-arrow-color\", \"rgb(153,153,153)\"],\n [\"curve-style\", \"haystack\"],\n [\"arrow-scale\", \"1\"],\n [\"source-label\", \"\"],\n [\"target-label\", \"\"],\n]);\n\n/**\n * The rules of Cytoscape.js's default stylesheet that set a property graph-io carries, in its order. They sit\n * beneath every stylesheet a file gives.\n */\nexport const CYJS_DEFAULT_STYLESHEET: readonly {\n /** The rule's selector. */\n readonly selector: string;\n /** The rule's properties and values, as Cytoscape.js spells them. */\n readonly style: Readonly<Record<string, string>>;\n}[] = [\n {\n selector: \":parent\",\n style: {\n shape: \"rectangle\",\n \"background-color\": \"rgb(238,238,238)\",\n \"border-color\": \"rgb(204,204,204)\",\n \"border-width\": \"1px\",\n },\n },\n { selector: \"edge\", style: { width: \"3px\" } },\n { selector: \":loop\", style: { \"curve-style\": \"bezier\" } },\n { selector: \"edge:compound\", style: { \"curve-style\": \"bezier\" } },\n {\n selector: \":selected\",\n style: {\n \"background-color\": \"rgb(1,105,217)\",\n \"line-color\": \"rgb(1,105,217)\",\n \"source-arrow-color\": \"rgb(1,105,217)\",\n \"target-arrow-color\": \"rgb(1,105,217)\",\n },\n },\n {\n selector: \":parent:selected\",\n style: { \"background-color\": \"rgb(204,225,249)\", \"border-color\": \"rgb(174,200,229)\" },\n },\n];\n","/**\n * What Cytoscape.js draws over a node's face: its background image (`background-image`, `-fit`, `-width`,\n * `-height`, `-width-relative-to`, `-height-relative-to`, `-position-x`/`-y`, `-offset-x`/`-y`, `-repeat`, `-clip`, `background-image-smoothing`,\n * `background-image-opacity`), its pie (`pie-size`, `pie-hole`, `pie-start-angle`, `pie-N-background-*`) and its\n * stripes (`stripe-size`, `stripe-direction`, `stripe-N-background-*`), read as parts and combined per element into\n * the neutral `image*`, `pie*` and `stripe*` properties (https://js.cytoscape.org/#style/background-image,\n * #style/pie-chart-background, #style/stripe-chart-background).\n */\n\nimport type { StyleValue } from \"../types.js\";\nimport type { CyjsPropertySpec } from \"./mappers.js\";\n\n/** How many slices a pie, and bands a striped fill, has at most (Cytoscape.js's `pieBackgroundN`). */\nconst PIECES = 16;\n\nconst text = (property: string): CyjsPropertySpec => ({ property, type: \"text\" });\nconst color = (property: string): CyjsPropertySpec => ({ property, type: \"color\" });\n\n/** The parts, by Cytoscape.js property name. */\nexport const CYJS_FACE_PROPERTIES: readonly [string, CyjsPropertySpec][] = [\n [\"background-image\", text(\"_bgImage\")],\n [\"background-fit\", text(\"_bgFit\")],\n [\"background-width\", text(\"_bgWidth\")],\n [\"background-height\", text(\"_bgHeight\")],\n [\"background-width-relative-to\", text(\"_bgWidthRel\")],\n [\"background-height-relative-to\", text(\"_bgHeightRel\")],\n [\"background-position-x\", text(\"_bgPosX\")],\n [\"background-position-y\", text(\"_bgPosY\")],\n [\"background-offset-x\", text(\"_bgOffX\")],\n [\"background-offset-y\", text(\"_bgOffY\")],\n [\"background-repeat\", text(\"_bgRepeat\")],\n [\"background-clip\", text(\"_bgClip\")],\n [\"background-image-smoothing\", text(\"_bgSmooth\")],\n [\"background-image-opacity\", text(\"_bgOpacity\")],\n [\"pie-size\", text(\"_pieSize\")],\n [\"pie-hole\", text(\"_pieHole\")],\n [\"pie-start-angle\", text(\"_pieStart\")],\n [\"stripe-size\", text(\"_stripeSize\")],\n [\"stripe-direction\", text(\"_stripeDir\")],\n ...Array.from({ length: PIECES }, (_, k): [string, CyjsPropertySpec][] => [\n [`pie-${String(k + 1)}-background-color`, color(`_pieC${String(k + 1)}`)],\n [`pie-${String(k + 1)}-background-size`, text(`_pieS${String(k + 1)}`)],\n [`pie-${String(k + 1)}-background-opacity`, text(`_pieO${String(k + 1)}`)],\n [`stripe-${String(k + 1)}-background-color`, color(`_stripeC${String(k + 1)}`)],\n [`stripe-${String(k + 1)}-background-size`, text(`_stripeS${String(k + 1)}`)],\n [`stripe-${String(k + 1)}-background-opacity`, text(`_stripeO${String(k + 1)}`)],\n ]).flat(),\n];\n\n/**\n * A number and its unit: `30px` is `[30, \"px\"]`, `50%` `[50, \"%\"]`, `90deg` `[90, \"deg\"]`, `30` `[30, \"\"]`.\n * @param word - the value\n * @returns the number and its unit in lower case, or null\n */\nfunction measure(word: string | null | undefined): [number, string] | null {\n const m = /^(-?(?:\\d+(?:\\.\\d+)?|\\.\\d+)(?:e[+-]?\\d+)?)\\s*([a-z%]*)$/i.exec((word ?? \"\").trim());\n return m === null ? null : [Number(m[1]), m[2].toLowerCase()];\n}\n\nconst r6 = (v: number): number => Math.round(v * 1e6) / 1e6;\n\n/**\n * A length in pixels, or a percentage of `of`.\n * @param word - the value\n * @param of - what a percentage is of, or null when it is not known\n * @returns the length, or null for `auto`, a value it cannot read, or below 0\n */\nfunction length(word: string | null | undefined, of: number | null): number | null {\n const m = measure(word);\n if (m === null) {\n return null;\n }\n let out: number | null = null;\n if (m[1] === \"%\") {\n out = of === null ? null : (m[0] / 100) * of;\n } else if (m[1] === \"px\" || m[1] === \"\") {\n out = m[0];\n }\n return out === null || out < 0 ? null : r6(out);\n}\n\n/**\n * A node's padding in pixels: a percentage is drawn as its fraction in pixels on a node that is no compound parent\n * (cytoscape.js 3.34.3 `padding()` returns the property's `pfValue`, 0.2 for `20%`).\n * @param word - the padding as Cytoscape.js spells it, or null\n * @returns the pixels, 0 for none\n */\nfunction paddingPixels(word: string | null): number {\n const x = Number.parseFloat(word ?? \"\");\n if (!Number.isFinite(x) || x <= 0) {\n return 0;\n }\n return (word ?? \"\").trim().endsWith(\"%\") ? x / 100 : x;\n}\n\n/**\n * A fraction from a percentage (`50%` is 0.5), or from a plain number in 0..1.\n * @param word - the value\n * @returns the fraction, or null\n */\nfunction fraction(word: string | null | undefined): number | null {\n const m = measure(word);\n if (m === null) {\n return null;\n }\n if (m[1] === \"%\") {\n return r6(m[0] / 100);\n }\n return m[1] === \"\" ? r6(m[0]) : null;\n}\n\n/**\n * The first image of a background image list: `url(...)` unwrapped; `none` is none.\n * @param word - the value\n * @returns the URI, or null\n */\nfunction firstImage(word: string | null | undefined): string | null {\n const first = (word ?? \"\").trim().split(/\\s+/)[0] ?? \"\";\n const unwrapped = /^url\\((['\"]?)(.*)\\1\\)$/.exec(first)?.[2] ?? first;\n return unwrapped === \"\" || unwrapped === \"none\" ? null : unwrapped;\n}\n\n/**\n * An angle in degrees from 0 up to 360, from `90deg`, `1.5rad` or a number of degrees.\n * @param word - the value\n * @returns the angle, or null\n */\nfunction degrees(word: string | null | undefined): number | null {\n const m = measure(word);\n if (m === null) {\n return null;\n }\n if (m[1] !== \"rad\" && m[1] !== \"deg\" && m[1] !== \"\") {\n return null;\n }\n const deg = m[1] === \"rad\" ? (m[0] * 180) / Math.PI : m[0];\n return r6(((deg % 360) + 360) % 360);\n}\n\n/**\n * The slices or bands of one element: each `N` whose size is above 0, with its color (Cytoscape.js's default\n * black), size and opacity (default 1).\n * @param words - the parts\n * @param prefix - `_pie` or `_stripe`\n * @param i - the element\n * @returns the colors, sizes and opacities as lists separated by spaces, or null with no slice\n */\nfunction pieces(\n words: ReadonlyMap<string, (string | null)[]>,\n prefix: string,\n i: number,\n): { colors: string; sizes: string; opacities: string | null } | null {\n const colors: string[] = [];\n const sizes: string[] = [];\n const opacities: string[] = [];\n for (let k = 1; k <= PIECES; k++) {\n // a slice's size is a percentage, written with or without its sign\n const m = measure(words.get(`${prefix}S${String(k)}`)?.[i]);\n const size = m !== null && (m[1] === \"%\" || m[1] === \"\") ? r6(m[0] / 100) : null;\n if (size === null || size <= 0) {\n continue;\n }\n colors.push(words.get(`${prefix}C${String(k)}`)?.[i] ?? \"#000000\");\n sizes.push(String(size));\n const o = Number(words.get(`${prefix}O${String(k)}`)?.[i] ?? \"1\");\n opacities.push(String(Number.isFinite(o) ? Math.max(0, Math.min(1, o)) : 1));\n }\n if (colors.length === 0) {\n return null;\n }\n return {\n colors: colors.join(\" \"),\n sizes: sizes.join(\" \"),\n opacities: opacities.every((o) => o === \"1\") ? null : opacities.join(\" \"),\n };\n}\n\n/** One element's parts, and where its values go. */\ninterface FaceElement {\n /** a part's word for this element, or null */\n readonly word: (part: string) => string | null;\n /** sets one of this element's values */\n readonly put: (property: string, value: StyleValue) => void;\n /** the node's width, Cytoscape.js's default 30 unset */\n readonly w: number;\n /** the node's height, Cytoscape.js's default 30 unset */\n readonly h: number;\n}\n\n/**\n * Combines the parts of what is drawn over a node's face into the neutral properties, per element.\n * @param n - the element count\n * @param words - the parts by internal name\n * @param values - the values; changed in place\n */\nexport function combineFace(\n n: number,\n words: ReadonlyMap<string, (string | null)[]>,\n values: Record<string, (StyleValue | null)[]>,\n): void {\n const col = (property: string): (StyleValue | null)[] =>\n (values[property] ??= new Array<StyleValue | null>(n).fill(null));\n const num = (property: string, i: number): number | null => {\n const v = values[property]?.[i];\n return typeof v === \"number\" ? v : null;\n };\n for (let i = 0; i < n; i++) {\n const el: FaceElement = {\n word: (part) => words.get(part)?.[i] ?? null,\n put: (property, value) => {\n col(property)[i] = value;\n },\n // Cytoscape.js's default node is 30 x 30\n w: num(\"width\", i) ?? 30,\n h: num(\"height\", i) ?? 30,\n };\n faceImage(el);\n const pie = pieces(words, \"_pie\", i);\n if (pie !== null) {\n facePie(el, pie);\n }\n const stripe = pieces(words, \"_stripe\", i);\n if (stripe !== null) {\n faceStripes(el, stripe);\n }\n }\n}\n\n/**\n * An element's background image: the picture, how it fits, its size, place and look.\n * @param el - the element\n */\nfunction faceImage(el: FaceElement): void {\n const image = firstImage(el.word(\"_bgImage\"));\n if (image === null) {\n return;\n }\n el.put(\"image\", image);\n const fit = el.word(\"_bgFit\") ?? \"none\";\n el.put(\"imageFit\", [\"none\", \"contain\", \"cover\"].includes(fit) ? fit : \"none\");\n imageSize(el);\n imagePlace(el);\n imageLook(el);\n}\n\n/**\n * A background image's width and height. A percentage is of the node's padding box (`-relative-to: include-padding`,\n * the default), its padding on both sides taken in, or of its inner box (`inner`) (cytoscape.js 3.34.3\n * drawInscribedImage: `nodeTW`).\n * @param el - the element\n */\nfunction imageSize(el: FaceElement): void {\n const pad = paddingPixels(el.word(\"_padding\"));\n const of = (rel: string | null, side: number): number => (rel === \"inner\" ? side : side + 2 * pad);\n // a repeated picture is tiled at its own size whatever its width and height say (Cytoscape.js 3.34\n // `drawInscribedImage`: a canvas pattern of the picture as loaded)\n const tiled = [\"repeat\", \"repeat-x\", \"repeat-y\"].includes(el.word(\"_bgRepeat\") ?? \"\");\n const bw = tiled ? null : length(el.word(\"_bgWidth\"), of(el.word(\"_bgWidthRel\"), el.w));\n const bh = tiled ? null : length(el.word(\"_bgHeight\"), of(el.word(\"_bgHeightRel\"), el.h));\n if (bw !== null) {\n el.put(\"imageWidth\", bw);\n }\n if (bh !== null) {\n el.put(\"imageHeight\", bh);\n }\n // a side left `auto` is the picture's own (Cytoscape.js's `auto`: \"uses the width of the image\"), not in\n // proportion to the side given\n if ((bw === null) !== (bh === null)) {\n el.put(\"imageAutoSize\", \"natural\");\n }\n}\n\n/**\n * A background image's position and offset.\n * @param el - the element\n */\nfunction imagePlace(el: FaceElement): void {\n const px = fraction(el.word(\"_bgPosX\"));\n const py = fraction(el.word(\"_bgPosY\"));\n if (px !== null && px >= 0) {\n el.put(\"imagePositionX\", px);\n }\n if (py !== null && py >= 0) {\n el.put(\"imagePositionY\", py);\n }\n const ox = length(el.word(\"_bgOffX\"), el.w);\n const oy = length(el.word(\"_bgOffY\"), el.h);\n if (ox !== null) {\n el.put(\"imageOffsetX\", ox);\n }\n if (oy !== null) {\n el.put(\"imageOffsetY\", oy);\n }\n}\n\n/**\n * A background image's repeat, clip, smoothing and opacity.\n * @param el - the element\n */\nfunction imageLook(el: FaceElement): void {\n const repeat = el.word(\"_bgRepeat\");\n if (repeat !== null && [\"repeat\", \"repeat-x\", \"repeat-y\", \"no-repeat\"].includes(repeat)) {\n el.put(\"imageRepeat\", repeat);\n }\n const clip = el.word(\"_bgClip\");\n if (clip !== null) {\n el.put(\"imageClip\", clip === \"none\" ? \"none\" : \"node\");\n }\n const smooth = el.word(\"_bgSmooth\");\n if (smooth === \"yes\" || smooth === \"no\") {\n el.put(\"imageSmoothing\", smooth === \"yes\");\n }\n const opacity = Number(el.word(\"_bgOpacity\") ?? Number.NaN);\n if (Number.isFinite(opacity)) {\n el.put(\"imageOpacity\", Math.max(0, Math.min(1, opacity)));\n }\n}\n\n/**\n * An element's pie: its slices, radius, hole and start angle.\n * @param el - the element\n * @param pie - its slices\n * @param pie.colors - the slices' colors\n * @param pie.sizes - the slices' sizes\n * @param pie.opacities - the slices' opacities, or null when all are 1\n */\nfunction facePie(el: FaceElement, pie: { colors: string; sizes: string; opacities: string | null }): void {\n el.put(\"pieColors\", pie.colors);\n el.put(\"pieSizes\", pie.sizes);\n if (pie.opacities !== null) {\n el.put(\"pieOpacities\", pie.opacities);\n }\n const size = el.word(\"_pieSize\");\n // in pixels, the pie's diameter; as a fraction, of the node's shorter side\n const px = measure(size)?.[1] === \"px\" ? length(size, null) : null;\n const r = px === null ? fraction(size) : px / Math.min(el.w, el.h);\n if (r !== null) {\n el.put(\"pieRadius\", r6(r));\n }\n const hole = fraction(el.word(\"_pieHole\"));\n if (hole !== null && hole >= 0 && hole <= 1) {\n el.put(\"pieHole\", hole);\n }\n const start = degrees(el.word(\"_pieStart\"));\n if (start !== null) {\n el.put(\"pieRotation\", start);\n }\n}\n\n/**\n * An element's stripes: their bands, direction and size.\n * @param el - the element\n * @param stripe - its bands\n * @param stripe.colors - the bands' colors\n * @param stripe.sizes - the bands' sizes\n * @param stripe.opacities - the bands' opacities, or null when all are 1\n */\nfunction faceStripes(el: FaceElement, stripe: { colors: string; sizes: string; opacities: string | null }): void {\n el.put(\"stripeColors\", stripe.colors);\n el.put(\"stripeSizes\", stripe.sizes);\n if (stripe.opacities !== null) {\n el.put(\"stripeOpacities\", stripe.opacities);\n }\n // Cytoscape.js turns its stripes a quarter for `righward` (its spelling); anything else is `vertical`\n if (el.word(\"_stripeDir\") === \"righward\") {\n el.put(\"stripeDirection\", \"right\");\n }\n const size = fraction(el.word(\"_stripeSize\"));\n if (size !== null && size >= 0) {\n el.put(\"stripeSize\", size);\n }\n}\n","/**\n * Cytoscape.js's property values: the properties graph-io carries, how Cytoscape.js 3.34 parses each value\n * (`style.parse`), the `data()` and `mapData()` mappers and how they evaluate per element, and the neutral value\n * each parsed value is drawn as.\n *\n * What Cytoscape.js does and this module repeats:\n * - a number property takes `px`, `em` or no unit; a value with any other suffix is read with `parseFloat`, so\n * `width: 50%` draws 50 pixels wide. Unitless properties (opacities, `arrow-scale`) are read with `parseFloat`.\n * - a color is a name, `#rgb`, `#rrggbb`, `rgb()`, `rgba()`, `hsl()` or `hsla()` with Cytoscape.js's own limits; its\n * alpha is never drawn (the opacity properties are).\n * - `mapData(field, a, b, x, y)` maps a numeric field linearly from [a, b] to [x, y], clamped at the ends; a reversed\n * range runs backwards, a zero range gives x, equal x and y make it the constant x. A color is interpolated per\n * channel and rounded.\n * - a mapper that fails for an element (no field, a value the property refuses, a non-number for `mapData`) resets the\n * property to its Cytoscape.js default, whatever the rules beneath say.\n */\n\nimport { canonColor } from \"../canon/color.js\";\nimport { CSS_COLORS } from \"../canon/color-tables.js\";\nimport { canonEnum } from \"../canon/enums.js\";\nimport { num6 } from \"../canon/number.js\";\nimport type { CanonSite } from \"../canon/site.js\";\nimport { STYLE_ISSUE } from \"../codes.js\";\nimport type { StyleTarget, StyleValue } from \"../types.js\";\nimport { CYJS_FACE_PROPERTIES } from \"./face.js\";\n\n/** How Cytoscape.js types a property's value. */\nexport type CyjsValueType =\n | \"color\"\n | \"zeroOne\"\n | \"size\"\n | \"signedSize\"\n | \"nodeSize\"\n | \"positive\"\n | \"text\"\n | \"fontFamily\"\n | \"fontWeight\"\n | \"enum\";\n\n/** One property graph-io carries: the neutral property it sets (or a part it combines) and how it is parsed. */\nexport interface CyjsPropertySpec {\n /**\n * The neutral property, or `_valign`, `_halign`, `_visibility`, `_display`, `_sourceArrowFill`, `_targetArrowFill`\n * for the parts combined afterward.\n */\n readonly property: string;\n /** The value type. */\n readonly type: CyjsValueType;\n /** The allowed values of an enumeration. */\n readonly enums?: readonly (string | number)[];\n}\n\nconst NODE_SHAPES = [\n \"rectangle\",\n \"roundrectangle\",\n \"round-rectangle\",\n \"cutrectangle\",\n \"cut-rectangle\",\n \"bottomroundrectangle\",\n \"bottom-round-rectangle\",\n \"barrel\",\n \"ellipse\",\n \"triangle\",\n \"round-triangle\",\n \"square\",\n \"pentagon\",\n \"round-pentagon\",\n \"hexagon\",\n \"round-hexagon\",\n \"concavehexagon\",\n \"concave-hexagon\",\n \"heptagon\",\n \"round-heptagon\",\n \"octagon\",\n \"round-octagon\",\n \"tag\",\n \"round-tag\",\n \"star\",\n \"diamond\",\n \"round-diamond\",\n \"vee\",\n \"rhomboid\",\n \"right-rhomboid\",\n \"polygon\",\n];\nconst ARROWS = [\n \"tee\",\n \"triangle\",\n \"triangle-tee\",\n \"circle-triangle\",\n \"triangle-cross\",\n \"triangle-backcurve\",\n \"vee\",\n \"square\",\n \"circle\",\n \"diamond\",\n \"chevron\",\n \"none\",\n];\nconst FONT_WEIGHTS: readonly (string | number)[] = [\n \"normal\",\n \"bold\",\n \"bolder\",\n \"lighter\",\n \"100\",\n \"200\",\n \"300\",\n \"400\",\n \"500\",\n \"600\",\n \"800\",\n \"900\",\n 100,\n 200,\n 300,\n 400,\n 500,\n 600,\n 700,\n 800,\n 900,\n];\n/** Cytoscape.js's curve styles. */\nexport const CYJS_CURVE_STYLES = [\n \"bezier\",\n \"unbundled-bezier\",\n \"haystack\",\n \"segments\",\n \"straight\",\n \"straight-triangle\",\n \"taxi\",\n \"round-segments\",\n \"round-taxi\",\n];\n/** The curve styles Cytoscape.js draws as straight lines or straight pieces: only the beziers bow. */\nconst STRAIGHT: ReadonlySet<string> = new Set([\n \"haystack\",\n \"straight\",\n \"straight-triangle\",\n \"segments\",\n \"taxi\",\n \"round-segments\",\n \"round-taxi\",\n]);\n\nconst LABEL: [string, CyjsPropertySpec][] = [\n [\"label\", { property: \"label\", type: \"text\" }],\n [\"color\", { property: \"labelColor\", type: \"color\" }],\n [\"font-size\", { property: \"labelSize\", type: \"size\" }],\n [\"font-family\", { property: \"labelFont\", type: \"fontFamily\" }],\n [\"font-weight\", { property: \"labelWeight\", type: \"fontWeight\" }],\n [\"font-style\", { property: \"labelItalic\", type: \"enum\", enums: [\"italic\", \"normal\", \"oblique\"] }],\n [\"visibility\", { property: \"_visibility\", type: \"enum\", enums: [\"hidden\", \"visible\"] }],\n [\"display\", { property: \"_display\", type: \"enum\", enums: [\"element\", \"none\"] }],\n [\"opacity\", { property: \"opacity\", type: \"zeroOne\" }],\n [\"text-transform\", { property: \"_transform\", type: \"enum\", enums: [\"none\", \"uppercase\", \"lowercase\"] }],\n [\"text-wrap\", { property: \"_wrap\", type: \"enum\", enums: [\"none\", \"wrap\", \"ellipsis\"] }],\n [\"text-overflow-wrap\", { property: \"_overflowWrap\", type: \"enum\", enums: [\"whitespace\", \"anywhere\"] }],\n // how the lines line up; `auto` follows the horizontal alignment (`combineLabelText`)\n [\"text-justification\", { property: \"_justification\", type: \"enum\", enums: [\"auto\", \"left\", \"center\", \"right\"] }],\n // a width only `text-wrap: wrap` wraps at, so it is combined with the wrap afterward (`combineParts`)\n [\"text-max-width\", { property: \"_maxWidth\", type: \"size\" }],\n // the outline and the background box draw only with a width and an opacity (`combineLabelDress`)\n [\"text-outline-color\", { property: \"_outlineColor\", type: \"color\" }],\n [\"text-outline-width\", { property: \"_outlineWidth\", type: \"size\" }],\n [\"text-outline-opacity\", { property: \"_outlineOpacity\", type: \"zeroOne\" }],\n [\"text-background-color\", { property: \"_backgroundColor\", type: \"color\" }],\n [\"text-background-opacity\", { property: \"_backgroundOpacity\", type: \"zeroOne\" }],\n [\"text-background-padding\", { property: \"_backgroundPadding\", type: \"size\" }],\n [\n \"text-background-shape\",\n {\n property: \"_backgroundShape\",\n type: \"enum\",\n enums: [\"rectangle\", \"round-rectangle\", \"roundrectangle\", \"circle\"],\n },\n ],\n [\"text-rotation\", { property: \"_rotation\", type: \"text\" }],\n // the words' own opacity, drawn times the element's (`combineLabelOpacity`)\n [\"text-opacity\", { property: \"_textOpacity\", type: \"zeroOne\" }],\n // the label moved right and down by this many pixels from where its alignment puts it, a node's and an edge's\n [\"text-margin-x\", { property: \"labelOffsetX\", type: \"signedSize\" }],\n [\"text-margin-y\", { property: \"labelOffsetY\", type: \"signedSize\" }],\n // the line round the label's box draws only with a width and an opacity above 0 (`combineLabelDress`)\n [\"text-border-color\", { property: \"_textBorderColor\", type: \"color\" }],\n [\"text-border-width\", { property: \"_textBorderWidth\", type: \"size\" }],\n [\"text-border-opacity\", { property: \"_textBorderOpacity\", type: \"zeroOne\" }],\n [\n \"text-border-style\",\n { property: \"_textBorderStyle\", type: \"enum\", enums: [\"solid\", \"dotted\", \"dashed\", \"double\"] },\n ],\n];\n\n/** Cytoscape.js's `background-gradient-direction` values. */\nconst GRADIENT_DIRECTIONS = [\n \"to-bottom\",\n \"to-top\",\n \"to-left\",\n \"to-right\",\n \"to-bottom-right\",\n \"to-bottom-left\",\n \"to-top-right\",\n \"to-top-left\",\n \"to-right-bottom\",\n \"to-left-bottom\",\n \"to-right-top\",\n \"to-left-top\",\n];\n\n/**\n * The pixels of one `em`: Cytoscape.js reads it as its container's font size (`getEmSizeInPixels`, cytoscape.js\n * 3.34.3 dist/cytoscape.cjs.js line 16896), 16 in a page that leaves the font size at the browser's default.\n */\nconst EM_PX = 16;\n\n/**\n * Cytoscape.js's `shape-polygon-points` (`x y` pairs, y down, commas or spaces between) as neutral `shapePoints`.\n * @param text - the points\n * @returns `x,y` pairs with y up, or null when they are not pairs of numbers\n */\nfunction cyjsPointsToNeutral(text: string): string | null {\n const n = text\n .trim()\n .split(/[\\s,]+/)\n .map(Number);\n if (n.length < 6 || n.length % 2 !== 0 || !n.every((v) => Number.isFinite(v))) {\n return null;\n }\n const pairs: string[] = [];\n for (let i = 0; i < n.length; i += 2) {\n pairs.push(`${String(round6(n[i]))},${String(round6(-n[i + 1]))}`);\n }\n return pairs.join(\" \");\n}\n\n/**\n * Neutral `shapePoints` as Cytoscape.js's `shape-polygon-points`.\n * @param points - `x,y` pairs with y up\n * @returns `x y` pairs with y down, or null when they are not pairs of numbers\n */\nexport function neutralPointsToCyjs(points: string): string | null {\n const n = points\n .trim()\n .split(/[\\s,]+/)\n .map(Number);\n if (n.length < 6 || n.length % 2 !== 0 || !n.every((v) => Number.isFinite(v))) {\n return null;\n }\n const pairs: string[] = [];\n for (let i = 0; i < n.length; i += 2) {\n pairs.push(`${String(round6(n[i]))} ${String(round6(-n[i + 1]))}`);\n }\n return pairs.join(\" \");\n}\n\n/**\n * A coordinate to six decimals, with no negative zero.\n * @param v - the coordinate\n * @returns it rounded\n */\nconst round6 = (v: number): number => Math.round(v * 1e6) / 1e6 + 0;\n\n/**\n * Cytoscape.js's corners of a heptagon fitted to its box (`generateUnitNgonPointsFitToSquare(7, 0)`): a regular\n * heptagon with a corner up, stretched until it fills the box both ways.\n * @returns the corners as `x,y` fractions of the half width and half height, y up\n */\nfunction fittedHeptagon(): string {\n const corners = Array.from({ length: 7 }, (_, i): [number, number] => {\n const angle = Math.PI / 2 + (2 * Math.PI * i) / 7;\n return [Math.cos(angle), Math.sin(angle)];\n });\n const [x0, x1] = [Math.min(...corners.map(([x]) => x)), Math.max(...corners.map(([x]) => x))];\n const [y0, y1] = [Math.min(...corners.map(([, y]) => y)), Math.max(...corners.map(([, y]) => y))];\n return corners\n .map(([x, y]) => `${round6((2 * (x - x0)) / (x1 - x0) - 1)},${round6((2 * (y - y0)) / (y1 - y0) - 1)}`)\n .join(\" \");\n}\n\n/**\n * The Cytoscape.js node shapes no neutral shape names, with the corners Cytoscape.js draws each at (cytoscape.js\n * 3.34.3 dist/cytoscape.cjs.js lines 27976-28008); the round ones are `other:round-polygon` over the same corners.\n */\nconst CYJS_POLYGON_SHAPES: ReadonlyMap<string, string> = new Map([\n [\"heptagon\", fittedHeptagon()],\n [\"round-heptagon\", fittedHeptagon()],\n [\"tag\", \"-1,-1 0.25,-1 1,0 0.25,1 -1,1\"],\n [\"round-tag\", \"-1,-1 0.25,-1 1,0 0.25,1 -1,1\"],\n]);\n\n/**\n * Cytoscape.js's polygons drawn with rounded corners (`corner-radius`, by default a tenth of the shorter side),\n * kept as their own `other:` shapes rather than read as their sharp twins.\n */\nconst CYJS_ROUND_SHAPES: ReadonlySet<string> = new Set([\n \"round-triangle\",\n \"round-diamond\",\n \"round-pentagon\",\n \"round-hexagon\",\n \"round-octagon\",\n]);\n\n/**\n * Draws every Cytoscape.js shape no neutral shape names (`other:heptagon`, `other:tag`) as the polygon Cytoscape.js\n * builds for it: `polygon` with its corners in `shapePoints`.\n * @param values - node values (per element, or a rule's constants), changed in place\n */\nexport function cyjsPolygonShapes(values: Record<string, unknown>): void {\n const { shape } = values;\n const pointsOf = (v: unknown): string | undefined =>\n typeof v === \"string\" && v.startsWith(\"other:\") ? CYJS_POLYGON_SHAPES.get(v.slice(\"other:\".length)) : undefined;\n if (Array.isArray(shape)) {\n const col = shape as (StyleValue | null)[];\n if (!col.some((v) => pointsOf(v) !== undefined)) {\n return;\n }\n const points = Array.isArray(values.shapePoints)\n ? [...(values.shapePoints as (StyleValue | null)[])]\n : new Array<StyleValue | null>(col.length).fill(null);\n values.shape = col.map((v, i) => {\n const p = pointsOf(v);\n if (p === undefined) {\n return v;\n }\n points[i] = p;\n return polygonOf(v);\n });\n values.shapePoints = points;\n return;\n }\n const p = pointsOf(shape);\n if (p !== undefined) {\n values.shape = polygonOf(shape);\n values.shapePoints = p;\n }\n}\n\n/**\n * The polygon a Cytoscape.js polygon shape is drawn as: `other:round-polygon` for its round ones.\n * @param shape - the shape, `other:<Cytoscape.js name>`\n * @returns the neutral shape\n */\nfunction polygonOf(shape: unknown): string {\n return typeof shape === \"string\" && shape.startsWith(\"other:round-\") ? \"other:round-polygon\" : \"polygon\";\n}\n\n/** How Cytoscape.js's `line-fill` paints a line, as the neutral gradient kind. */\nconst GRADIENT_KINDS: ReadonlyMap<string, string> = new Map([\n [\"solid\", \"none\"],\n [\"linear-gradient\", \"linear\"],\n [\"radial-gradient\", \"radial\"],\n]);\n\n/**\n * A text split at its runs of whitespace that are not inside parentheses: `rgb(0, 0, 0) red` is two words. A run is\n * inside when the next parenthesis after it closes one (as `/\\s+(?![^(]*\\))/` splits, in one pass).\n * @param text - the text\n * @returns the words\n */\nfunction wordsOutsideParens(text: string): string[] {\n // whether the next parenthesis at or after each offset is a `)`\n const closes = new Array<boolean>(text.length + 1).fill(false);\n for (let i = text.length - 1; i >= 0; i--) {\n closes[i] = text[i] === \")\" || (text[i] !== \"(\" && closes[i + 1]);\n }\n const words: string[] = [];\n let start = 0;\n let i = 0;\n while (i < text.length) {\n if (!/\\s/.test(text[i])) {\n i++;\n continue;\n }\n let end = i + 1;\n while (end < text.length && /\\s/.test(text[end])) {\n end++;\n }\n if (!closes[end]) {\n words.push(text.slice(start, i));\n start = end;\n }\n i = end;\n }\n words.push(text.slice(start));\n return words;\n}\n\n/**\n * Cytoscape.js's `line-gradient-stop-colors` (colors separated by spaces) as `#rrggbb` colors separated by spaces.\n * @param text - the value\n * @param site - where it was read\n * @returns the colors, or undefined when one does not parse (noted)\n */\nfunction gradientColors(text: string, site: CanonSite): string | undefined {\n const hexes: string[] = [];\n for (const token of wordsOutsideParens(text.trim())) {\n const c = token === \"\" ? null : canonColor(token, \"css\", site);\n if (c === null) {\n return undefined;\n }\n hexes.push(c.color);\n }\n return hexes.join(\" \");\n}\n\n/**\n * Cytoscape.js's gradient stop colors (colors separated by spaces) as `#rrggbb` colors.\n * @param text - the value\n * @param site - where it was read\n * @returns the colors, none when one does not parse (noted)\n */\nexport function gradientStopColors(text: string, site: CanonSite): string[] {\n return gradientColors(text, site)?.split(\" \") ?? [];\n}\n\n/**\n * Cytoscape.js's `line-gradient-stop-positions` (percentages or fractions separated by spaces) as fractions.\n * @param text - the value\n * @returns the fractions separated by spaces, or undefined when one is not a number\n */\nexport function gradientStops(text: string): string | undefined {\n const stops = text\n .trim()\n .split(/\\s+/)\n .map((t) => (t.endsWith(\"%\") ? Number.parseFloat(t) / 100 : Number.parseFloat(t)));\n return stops.every((n) => Number.isFinite(n)) ? stops.map((n) => num6(n)).join(\" \") : undefined;\n}\n\n/** The lengths Cytoscape.js draws at half their value: a bundle's control point step, an outline's offset. */\nconst HALVED: ReadonlySet<string> = new Set([\"fanSpacing\", \"outerBorderOffset\"]);\n\n/** The node properties graph-io carries, by Cytoscape.js name. */\nexport const CYJS_NODE_PROPERTIES: ReadonlyMap<string, CyjsPropertySpec> = new Map<string, CyjsPropertySpec>([\n [\"background-color\", { property: \"fill\", type: \"color\" }],\n [\"background-opacity\", { property: \"fillOpacity\", type: \"zeroOne\" }],\n [\"border-color\", { property: \"borderColor\", type: \"color\" }],\n // the rings are drawn at their own opacity times the node's (`combineNodeOpacity`)\n [\"border-opacity\", { property: \"_ringOpacity\", type: \"zeroOne\" }],\n [\"border-width\", { property: \"borderWidth\", type: \"size\" }],\n [\"border-style\", { property: \"borderStyle\", type: \"enum\", enums: [\"solid\", \"dotted\", \"dashed\", \"double\"] }],\n // the dashes a dashed border is drawn with and their ends, which decide how it looks (`combineDashes`)\n [\"border-dash-pattern\", { property: \"_dashPattern\", type: \"text\" }],\n [\"border-cap\", { property: \"_dashCap\", type: \"enum\", enums: [\"butt\", \"round\", \"square\"] }],\n // where the border sits against the node's outline: across it, inside it or outside it\n [\"border-position\", { property: \"borderPosition\", type: \"enum\", enums: [\"center\", \"inside\", \"outside\"] }],\n [\"outline-color\", { property: \"outerBorderColor\", type: \"color\" }],\n [\"outline-opacity\", { property: \"_outlineRingOpacity\", type: \"zeroOne\" }],\n [\"outline-width\", { property: \"outerBorderWidth\", type: \"size\" }],\n [\"outline-style\", { property: \"outerBorderStyle\", type: \"enum\", enums: [\"solid\", \"dotted\", \"dashed\", \"double\"] }],\n [\"outline-offset\", { property: \"outerBorderOffset\", type: \"size\" }],\n [\"underlay-color\", { property: \"underlayColor\", type: \"color\" }],\n [\"underlay-opacity\", { property: \"underlayOpacity\", type: \"zeroOne\" }],\n [\"underlay-padding\", { property: \"underlayPadding\", type: \"size\" }],\n [\"underlay-shape\", { property: \"underlayShape\", type: \"enum\", enums: NODE_SHAPES }],\n [\"underlay-corner-radius\", { property: \"underlayCornerRadius\", type: \"size\" }],\n [\"overlay-color\", { property: \"overlayColor\", type: \"color\" }],\n [\"overlay-opacity\", { property: \"overlayOpacity\", type: \"zeroOne\" }],\n [\"overlay-padding\", { property: \"overlayPadding\", type: \"size\" }],\n [\"overlay-shape\", { property: \"overlayShape\", type: \"enum\", enums: NODE_SHAPES }],\n [\"overlay-corner-radius\", { property: \"overlayCornerRadius\", type: \"size\" }],\n [\"shape\", { property: \"shape\", type: \"enum\", enums: NODE_SHAPES }],\n [\"shape-polygon-points\", { property: \"shapePoints\", type: \"text\" }],\n [\"corner-radius\", { property: \"cornerRadius\", type: \"size\" }],\n [\"width\", { property: \"width\", type: \"nodeSize\" }],\n [\"height\", { property: \"height\", type: \"nodeSize\" }],\n // a node is drawn this much larger on every side (`nodeSizes`)\n [\"padding\", { property: \"_padding\", type: \"text\" }],\n [\n \"text-valign\",\n { property: \"_valign\", type: \"enum\", enums: [\"top\", \"top-inside\", \"center\", \"bottom\", \"bottom-inside\"] },\n ],\n [\n \"text-halign\",\n { property: \"_halign\", type: \"enum\", enums: [\"left\", \"left-inside\", \"center\", \"right\", \"right-inside\"] },\n ],\n // the fill's gradient, combined afterward into `fill`, `fillGradient`, `fillGradientAngle` and the other\n // `fillGradient*` properties\n [\n \"background-fill\",\n { property: \"_backgroundFill\", type: \"enum\", enums: [\"solid\", \"linear-gradient\", \"radial-gradient\"] },\n ],\n [\"background-gradient-stop-colors\", { property: \"_backgroundStops\", type: \"text\" }],\n [\"background-gradient-stop-positions\", { property: \"_backgroundPositions\", type: \"text\" }],\n [\"background-gradient-direction\", { property: \"_backgroundDirection\", type: \"enum\", enums: GRADIENT_DIRECTIONS }],\n ...CYJS_FACE_PROPERTIES,\n ...LABEL,\n]);\n\n/** The edge properties graph-io carries, by Cytoscape.js name. */\nexport const CYJS_EDGE_PROPERTIES: ReadonlyMap<string, CyjsPropertySpec> = new Map<string, CyjsPropertySpec>([\n [\"line-color\", { property: \"color\", type: \"color\" }],\n [\"width\", { property: \"width\", type: \"nodeSize\" }],\n [\"line-style\", { property: \"lineStyle\", type: \"enum\", enums: [\"solid\", \"dotted\", \"dashed\"] }],\n // the dashes a dashed line is drawn with and their ends, which decide how it looks (`combineDashes`)\n [\"line-dash-pattern\", { property: \"_dashPattern\", type: \"text\" }],\n [\"line-cap\", { property: \"_dashCap\", type: \"enum\", enums: [\"butt\", \"round\", \"square\"] }],\n // the line's own opacity, combined afterward into `opacity`, which the line is drawn at\n [\"line-opacity\", { property: \"_lineOpacity\", type: \"zeroOne\" }],\n [\"line-outline-width\", { property: \"outlineWidth\", type: \"size\" }],\n [\"line-fill\", { property: \"gradientKind\", type: \"enum\", enums: [\"solid\", \"linear-gradient\", \"radial-gradient\"] }],\n [\"line-gradient-stop-colors\", { property: \"gradientColors\", type: \"text\" }],\n [\"line-gradient-stop-positions\", { property: \"gradientStops\", type: \"text\" }],\n [\"line-outline-color\", { property: \"outlineColor\", type: \"color\" }],\n [\"underlay-color\", { property: \"underlayColor\", type: \"color\" }],\n [\"underlay-opacity\", { property: \"underlayOpacity\", type: \"zeroOne\" }],\n [\"underlay-padding\", { property: \"underlayPadding\", type: \"size\" }],\n [\"overlay-color\", { property: \"overlayColor\", type: \"color\" }],\n [\"overlay-opacity\", { property: \"overlayOpacity\", type: \"zeroOne\" }],\n [\"overlay-padding\", { property: \"overlayPadding\", type: \"size\" }],\n [\"target-arrow-shape\", { property: \"targetArrow\", type: \"enum\", enums: ARROWS }],\n [\"source-arrow-shape\", { property: \"sourceArrow\", type: \"enum\", enums: ARROWS }],\n [\"target-arrow-color\", { property: \"targetArrowColor\", type: \"color\" }],\n [\"source-arrow-color\", { property: \"sourceArrowColor\", type: \"color\" }],\n [\"mid-target-arrow-shape\", { property: \"midTargetArrow\", type: \"enum\", enums: ARROWS }],\n [\"mid-source-arrow-shape\", { property: \"midSourceArrow\", type: \"enum\", enums: ARROWS }],\n [\"mid-target-arrow-color\", { property: \"midTargetArrowColor\", type: \"color\" }],\n [\"mid-source-arrow-color\", { property: \"midSourceArrowColor\", type: \"color\" }],\n // filled or hollow: combined with the shape afterward (`combineParts`), a hollow triangle being `triangle-open`\n [\"target-arrow-fill\", { property: \"_targetArrowFill\", type: \"enum\", enums: [\"filled\", \"hollow\"] }],\n [\"source-arrow-fill\", { property: \"_sourceArrowFill\", type: \"enum\", enums: [\"filled\", \"hollow\"] }],\n [\"mid-target-arrow-fill\", { property: \"_midTargetArrowFill\", type: \"enum\", enums: [\"filled\", \"hollow\"] }],\n [\"mid-source-arrow-fill\", { property: \"_midSourceArrowFill\", type: \"enum\", enums: [\"filled\", \"hollow\"] }],\n [\"curve-style\", { property: \"curved\", type: \"enum\", enums: CYJS_CURVE_STYLES }],\n // a route's settings, read by the routes (`edgeRoutes`) as Cytoscape.js spells them\n [\"segment-distances\", { property: \"_segmentDistances\", type: \"text\" }],\n [\"segment-weights\", { property: \"_segmentWeights\", type: \"text\" }],\n [\"control-point-distances\", { property: \"_controlPointDistances\", type: \"text\" }],\n [\"control-point-weights\", { property: \"_controlPointWeights\", type: \"text\" }],\n [\"taxi-direction\", { property: \"_taxiDirection\", type: \"text\" }],\n [\"taxi-turn\", { property: \"_taxiTurn\", type: \"text\" }],\n [\"taxi-turn-min-distance\", { property: \"_taxiTurnMinDistance\", type: \"size\" }],\n [\"edge-distances\", { property: \"_edgeDistances\", type: \"text\" }],\n [\"loop-direction\", { property: \"_loopDirection\", type: \"text\" }],\n [\"loop-sweep\", { property: \"_loopSweep\", type: \"text\" }],\n [\"segment-radii\", { property: \"_segmentRadii\", type: \"text\" }],\n [\"taxi-radius\", { property: \"_taxiRadius\", type: \"text\" }],\n [\"radius-type\", { property: \"_radiusType\", type: \"text\" }],\n // where the ends meet the nodes, read with the routes (`edgePorts`)\n [\"source-endpoint\", { property: \"_sourceEndpoint\", type: \"text\" }],\n [\"target-endpoint\", { property: \"_targetEndpoint\", type: \"text\" }],\n // a bundle's control points are this far apart, so the curves' middles half of it (see cyjsNeutral)\n [\"control-point-step-size\", { property: \"fanSpacing\", type: \"size\" }],\n [\"arrow-scale\", { property: \"arrowSize\", type: \"positive\" }],\n [\"source-label\", { property: \"sourceLabel\", type: \"text\" }],\n [\"target-label\", { property: \"targetLabel\", type: \"text\" }],\n [\"source-text-offset\", { property: \"sourceLabelOffset\", type: \"size\" }],\n [\"target-text-offset\", { property: \"targetLabelOffset\", type: \"size\" }],\n [\"source-text-margin-x\", { property: \"sourceLabelOffsetX\", type: \"signedSize\" }],\n [\"source-text-margin-y\", { property: \"sourceLabelOffsetY\", type: \"signedSize\" }],\n [\"target-text-margin-x\", { property: \"targetLabelOffsetX\", type: \"signedSize\" }],\n [\"target-text-margin-y\", { property: \"targetLabelOffsetY\", type: \"signedSize\" }],\n // an angle, or autorotate along the line, which the routes work out (`autorotateLabels`)\n [\"source-text-rotation\", { property: \"_sourceRotation\", type: \"text\" }],\n [\"target-text-rotation\", { property: \"_targetRotation\", type: \"text\" }],\n ...LABEL,\n]);\n\n/**\n * The carried properties of a target.\n * @param target - nodes or edges\n * @returns Cytoscape.js name to its spec\n */\nexport function cyjsProperties(target: StyleTarget): ReadonlyMap<string, CyjsPropertySpec> {\n return target === \"node\" ? CYJS_NODE_PROPERTIES : CYJS_EDGE_PROPERTIES;\n}\n\n/**\n * Cytoscape.js 3.34.3's property aliases (`styfn.aliases`): each name is read as the property it points to.\n */\nconst CYJS_ALIASES: ReadonlyMap<string, string> = new Map([\n [\"content\", \"label\"],\n [\"control-point-distance\", \"control-point-distances\"],\n [\"control-point-weight\", \"control-point-weights\"],\n [\"segment-distance\", \"segment-distances\"],\n [\"segment-weight\", \"segment-weights\"],\n [\"segment-radius\", \"segment-radii\"],\n [\"edge-text-rotation\", \"text-rotation\"],\n [\"padding-left\", \"padding\"],\n [\"padding-right\", \"padding\"],\n [\"padding-top\", \"padding\"],\n [\"padding-bottom\", \"padding\"],\n]);\n\n/**\n * A dash-form property name with Cytoscape.js's aliases resolved (`content` is `label`, `segment-distance` is\n * `segment-distances`, `padding-left` is `padding`).\n * @param dashed - the name in dash form\n * @returns the property it sets\n */\nexport function cyjsAliasOf(dashed: string): string {\n return CYJS_ALIASES.get(dashed) ?? dashed;\n}\n\n/**\n * A property name in Cytoscape.js's dash form, aliases resolved (`backgroundColor` and `content` are read as\n * `background-color` and `label`).\n * @param name - the name as written\n * @returns the dash-form name\n */\nexport function cyjsPropertyName(name: string): string {\n return cyjsAliasOf(name.replaceAll(/[A-Z]/g, (c) => `-${c.toLowerCase()}`));\n}\n\n/** A parsed value, ready to draw. */\nexport type CyjsFlat =\n | {\n /** A color. */\n readonly kind: \"color\";\n /** Red, green, blue (0..255, possibly NaN for a malformed hex digit Cytoscape.js accepts). */\n readonly rgb: readonly [number, number, number];\n /** `rgb(r,g,b)`, as Cytoscape.js writes it. */\n readonly str: string;\n }\n | {\n /** A number. */\n readonly kind: \"number\";\n /** The number in its unit. */\n readonly value: number;\n /** `px`, `em`, or null for a value read with `parseFloat` past an unknown suffix. */\n readonly units: \"px\" | \"em\" | null;\n /** As Cytoscape.js writes it. */\n readonly str: string;\n }\n | {\n /** An enumeration value or a text. */\n readonly kind: \"word\";\n /** The value. */\n readonly value: string | number;\n /** As Cytoscape.js writes it. */\n readonly str: string;\n };\n\n/** A parsed property value: a flat value or a mapper. */\nexport type CyjsParsed =\n | CyjsFlat\n | {\n /** `data(field)`. */\n readonly kind: \"data\";\n /** The field, a dotted path. */\n readonly field: string;\n }\n | {\n /** `mapData(field, fieldMin, fieldMax, valueMin, valueMax)`. */\n readonly kind: \"mapData\";\n /** The field, a dotted path. */\n readonly field: string;\n /** The start of the input range. */\n readonly fieldMin: number;\n /** The end of the input range. */\n readonly fieldMax: number;\n /** The value at the start. */\n readonly min: CyjsFlat;\n /** The value at the end. */\n readonly max: CyjsFlat;\n }\n | {\n /** A function, from a live core's stylesheet. */\n readonly kind: \"fn\";\n };\n\n/** Where a value is parsed: a stylesheet rule, an element's own `style` (a bypass), or a mapper's per-element value. */\ntype CyjsParseMode = \"rule\" | \"bypass\" | \"flat\";\n\n/** Thrown by Cytoscape.js itself: a color given as a number makes its parser call `toLowerCase` on a number. */\nexport const CYJS_THROWS = \"throws\";\n\nconst NUM = String.raw`[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?)`;\nconst NUMBER_UNITS = new RegExp(`^(${NUM})(px|em)?$`);\nconst NUMBER_ONLY = new RegExp(String.raw`^\\s*${NUM}\\s*$`);\nconst RGBA = new RegExp(\n String.raw`^rgb[a]?\\((${NUM}[%]?)\\s*,\\s*(${NUM}[%]?)\\s*,\\s*(${NUM}[%]?)(?:\\s*,\\s*(${NUM}))?\\)$`,\n);\nconst HSLA = new RegExp(String.raw`^hsl[a]?\\((${NUM})\\s*,\\s*(${NUM}[%])\\s*,\\s*(${NUM}[%])(?:\\s*,\\s*(${NUM}))?\\)$`);\nconst MAP_ARG = new RegExp(\n String.raw`^(?:${NUM}|\\w+|rgb[a]?\\((?:${NUM}[%]?)\\s*,\\s*(?:${NUM}[%]?)\\s*,\\s*(?:${NUM}[%]?)(?:\\s*,\\s*(?:${NUM}))?\\)` +\n String.raw`|hsl[a]?\\((?:${NUM})\\s*,\\s*(?:${NUM}[%])\\s*,\\s*(?:${NUM}[%])(?:\\s*,\\s*(?:${NUM}))?\\)` +\n String.raw`|\\#[0-9a-fA-F]{3}|\\#[0-9a-fA-F]{6})$`,\n);\nconst FIELD = /^[\\w.]+$/;\nconst WORD_FONT = /^[\\w\\- \"]$/;\n\n/**\n * Cytoscape.js's color names: the CSS names without `rebeccapurple`, plus `transparent` (black with no alpha).\n * @param name - the lowercased name\n * @returns `#rrggbb`, or undefined\n */\nfunction namedColor(name: string): string | undefined {\n if (name === \"transparent\") {\n return \"#000000\";\n }\n return name === \"rebeccapurple\" ? undefined : CSS_COLORS.get(name);\n}\n\n/**\n * A color as Cytoscape.js reads it (`color2tuple`).\n * @param value - the trimmed text\n * @returns red, green and blue, or null when Cytoscape.js refuses it\n */\nfunction colorTuple(value: string): [number, number, number] | null {\n const named = namedColor(value.toLowerCase());\n if (named !== undefined) {\n return [\n Number.parseInt(named.slice(1, 3), 16),\n Number.parseInt(named.slice(3, 5), 16),\n Number.parseInt(named.slice(5, 7), 16),\n ];\n }\n if ((value.length === 4 || value.length === 7) && value.startsWith(\"#\")) {\n const short = value.length === 4;\n const pair = (k: number): number =>\n Number.parseInt(short ? value[k] + value[k] : value.slice(2 * k - 1, 2 * k + 1), 16);\n return [pair(1), pair(2), pair(3)];\n }\n const m = RGBA.exec(value);\n return m === null ? hslTuple(value) : rgbaTuple(m);\n}\n\n/**\n * `rgb()` and `rgba()` as Cytoscape.js reads them: channels all numbers or all percentages, within 0..255, and an\n * alpha within 0..1.\n * @param m - the match of the pattern\n * @returns red, green and blue, or null\n */\nfunction rgbaTuple(m: RegExpExecArray): [number, number, number] | null {\n const pct = [1, 2, 3].map((k) => m[k].endsWith(\"%\"));\n if (pct.some(Boolean) && !pct.every(Boolean)) {\n return null;\n }\n const channels = [1, 2, 3].map((k) => {\n const c = Number.parseFloat(m[k]);\n return pct[k - 1] ? (c / 100) * 255 : c;\n });\n if (channels.some((c) => c < 0 || c > 255)) {\n return null;\n }\n const alpha = m.at(4);\n if (alpha !== undefined && (Number.parseFloat(alpha) < 0 || Number.parseFloat(alpha) > 1)) {\n return null;\n }\n return [Math.floor(channels[0]), Math.floor(channels[1]), Math.floor(channels[2])];\n}\n\n/**\n * `hsl()` and `hsla()` as Cytoscape.js reads them.\n * @param value - the trimmed text\n * @returns red, green and blue, or null\n */\nfunction hslTuple(value: string): [number, number, number] | null {\n const m = HSLA.exec(value);\n if (m === null) {\n return null;\n }\n let h = Number.parseInt(m[1], 10);\n if (h < 0) {\n h = (360 - ((-1 * h) % 360)) % 360;\n } else if (h > 360) {\n h = h % 360;\n }\n h /= 360;\n const s = Number.parseFloat(m[2]);\n const l = Number.parseFloat(m[3]);\n if (s < 0 || s > 100 || l < 0 || l > 100) {\n return null;\n }\n const alpha = m.at(4);\n if (alpha !== undefined && (Number.parseFloat(alpha) < 0 || Number.parseFloat(alpha) > 1)) {\n return null;\n }\n const sn = s / 100;\n const ln = l / 100;\n if (sn === 0) {\n const g = Math.round(ln * 255);\n return [g, g, g];\n }\n const hue = (p: number, q: number, t0: number): number => {\n let t = t0;\n if (t < 0) {\n t += 1;\n }\n if (t > 1) {\n t -= 1;\n }\n if (t < 1 / 6) {\n return p + (q - p) * 6 * t;\n }\n if (t < 1 / 2) {\n return q;\n }\n if (t < 2 / 3) {\n return p + (q - p) * (2 / 3 - t) * 6;\n }\n return p;\n };\n const q = ln < 0.5 ? ln * (1 + sn) : ln + sn - ln * sn;\n const p = 2 * ln - q;\n return [\n Math.round(255 * hue(p, q, h + 1 / 3)),\n Math.round(255 * hue(p, q, h)),\n Math.round(255 * hue(p, q, h - 1 / 3)),\n ];\n}\n\n/**\n * Whether a value matches Cytoscape.js's font family pattern `^([\\w- \"]+(?:\\s*,\\s*[\\w- \"]+)*)$`, checked part by\n * part in one pass instead of with the backtracking pattern: items of word characters, `-`, space and `\"`, joined\n * by commas with any whitespace around them.\n * @param value - the text\n * @returns true when Cytoscape.js accepts it\n */\nexport function isFontFamily(value: string): boolean {\n const parts = value.split(\",\");\n if (parts.length === 1) {\n return parts[0].length > 0 && allOf(parts[0], isFontChar);\n }\n return (\n firstFontPart(parts[0]) &&\n lastFontPart(parts.at(-1) ?? \"\") &&\n parts.slice(1, -1).every((part) => middleFontPart(part))\n );\n}\n\n/**\n * Whether a character may be part of a font family item: a word character, `-`, space or `\"`.\n * @param c - the character\n * @returns true when it may\n */\nfunction isFontChar(c: string): boolean {\n return WORD_FONT.test(c);\n}\n\n/**\n * Whether a character is whitespace.\n * @param c - the character\n * @returns true for whitespace\n */\nfunction isSpace(c: string): boolean {\n return /\\s/.test(c);\n}\n\n/**\n * Whether every character of a text passes a test.\n * @param text - the text\n * @param test - the test\n * @returns true when all do (and for an empty text)\n */\nfunction allOf(text: string, test: (c: string) => boolean): boolean {\n return Array.from(text).every(test);\n}\n\n/**\n * The part before the first comma: an item, then whitespace before the comma.\n * @param part - the part\n * @returns true when it is one\n */\nfunction firstFontPart(part: string): boolean {\n let a = 0;\n while (a < part.length && isFontChar(part[a])) {\n a++;\n }\n return a > 0 && allOf(part.slice(a), isSpace);\n}\n\n/**\n * The part after the last comma: whitespace after the comma, then an item to the end.\n * @param part - the part\n * @returns true when it is one\n */\nfunction lastFontPart(part: string): boolean {\n let b = part.length;\n while (b > 0 && isFontChar(part[b - 1])) {\n b--;\n }\n return b < part.length && allOf(part.slice(0, b), isSpace);\n}\n\n/**\n * A part between two commas: whitespace, an item, whitespace; a part of whitespace only holds an item when one of its\n * characters is a space.\n * @param part - the part\n * @returns true when it is one\n */\nfunction middleFontPart(part: string): boolean {\n let a = 0;\n let b = part.length;\n while (a < b && isSpace(part[a])) {\n a++;\n }\n while (b > a && isSpace(part[b - 1])) {\n b--;\n }\n return a === b ? part.includes(\" \") : allOf(part.slice(a, b), isFontChar);\n}\n\n/** A flat value parsed: the value, null when Cytoscape.js refuses it, or `CYJS_THROWS` where Cytoscape.js throws. */\ntype FlatParse = CyjsFlat | null | typeof CYJS_THROWS;\n\n/**\n * Parses a flat value (no mappers) the way Cytoscape.js does.\n * @param spec - the property\n * @param raw - the value\n * @param rendered - the value is one Cytoscape.js reported (`ele.style(name)`), where every enumeration is text\n * @returns the parsed value, null when Cytoscape.js refuses it, or `CYJS_THROWS` where Cytoscape.js itself throws\n */\nfunction parseFlat(spec: CyjsPropertySpec, raw: unknown, rendered = false): FlatParse {\n const value: unknown = typeof raw === \"string\" ? raw.trim() : raw;\n switch (spec.type) {\n case \"color\":\n return parseColorValue(value);\n case \"zeroOne\":\n case \"positive\": {\n const x = Number.parseFloat(String(value));\n const ok = spec.type === \"zeroOne\" ? x >= 0 && x <= 1 : x > 0;\n return ok ? { kind: \"number\", value: x, units: null, str: String(x) } : null;\n }\n case \"size\":\n case \"signedSize\":\n case \"nodeSize\":\n return parseSizeValue(spec, value, raw);\n case \"text\":\n return { kind: \"word\", value: String(value), str: String(value) };\n case \"fontFamily\": {\n const text = String(value);\n return isFontFamily(text) ? { kind: \"word\", value: text, str: text } : null;\n }\n case \"fontWeight\":\n case \"enum\": {\n const enums = spec.type === \"fontWeight\" ? FONT_WEIGHTS : (spec.enums ?? []);\n const e = enums.find((x) => x === value || (rendered && String(x) === value));\n return e === undefined ? null : { kind: \"word\", value: e, str: String(e) };\n }\n default:\n return null;\n }\n}\n\n/**\n * A color as Cytoscape.js reads it: an `[r, g, b]` array as it is, else text.\n * @param value - the value, trimmed\n * @returns the color, null when refused, or `CYJS_THROWS` for a value that is neither\n */\nfunction parseColorValue(value: unknown): FlatParse {\n if (Array.isArray(value)) {\n const [r, g, b] = value as unknown[];\n const t: [number, number, number] = [Number(r), Number(g), Number(b)];\n return { kind: \"color\", rgb: t, str: `rgb(${t[0]},${t[1]},${t[2]})` };\n }\n if (typeof value !== \"string\") {\n return CYJS_THROWS;\n }\n const t = colorTuple(value);\n return t === null ? null : { kind: \"color\", rgb: t, str: `rgb(${t[0]},${t[1]},${t[2]})` };\n}\n\n/**\n * A size as Cytoscape.js reads it: a non-negative number in `px` or `em`, a number read past an unknown suffix, and\n * a node size of `label`.\n * @param spec - the property\n * @param value - the value, trimmed\n * @param raw - the value as given\n * @returns the size, or null when refused\n */\nfunction parseSizeValue(spec: CyjsPropertySpec, value: unknown, raw: unknown): CyjsFlat | null {\n let units: \"px\" | \"em\" | null = \"px\";\n let text: unknown = value;\n if (typeof value === \"string\") {\n const m = NUMBER_UNITS.exec(value);\n if (m === null) {\n units = null;\n } else {\n text = m[1];\n units = m.at(2) === \"em\" ? \"em\" : \"px\";\n }\n }\n const x = Number.parseFloat(String(text));\n if (Number.isNaN(x)) {\n return spec.type === \"nodeSize\" && raw === \"label\" ? { kind: \"word\", value: \"label\", str: \"label\" } : null;\n }\n return x < 0 && spec.type !== \"signedSize\"\n ? null\n : { kind: \"number\", value: x, units, str: `${String(x)}${units ?? \"\"}` };\n}\n\n/**\n * Splits the arguments of `mapData(...)` at the commas outside parentheses.\n * @param inner - the text between the outer parentheses\n * @returns the arguments\n */\nfunction splitArgs(inner: string): string[] {\n const out: string[] = [];\n let depth = 0;\n let start = 0;\n for (let i = 0; i < inner.length; i++) {\n const c = inner[i];\n if (c === \"(\") {\n depth++;\n } else if (c === \")\") {\n depth--;\n } else if (c === \",\" && depth === 0) {\n out.push(inner.slice(start, i));\n start = i + 1;\n }\n }\n out.push(inner.slice(start));\n return out;\n}\n\n/**\n * The text between the parentheses of `name(...)`, found by position: the name, optional whitespace, `(`, and a\n * last character `)`.\n * @param value - the trimmed value\n * @param name - `data` or `mapData`\n * @returns the inner text, or null\n */\nfunction callArgs(value: string, name: string): string | null {\n if (!value.startsWith(name) || !value.endsWith(\")\")) {\n return null;\n }\n let i = name.length;\n while (i < value.length && /\\s/.test(value[i])) {\n i++;\n }\n return value[i] === \"(\" ? value.slice(i + 1, -1) : null;\n}\n\n/**\n * Parses a property value the way Cytoscape.js does: a mapper in a rule, else a flat value.\n * @param spec - the property\n * @param raw - the value as given\n * @param mode - a stylesheet rule, an element bypass, or a mapper's per-element value\n * @returns the parsed value, null when Cytoscape.js refuses it, or `CYJS_THROWS`\n */\nexport function parseCyjsValue(\n spec: CyjsPropertySpec,\n raw: unknown,\n mode: CyjsParseMode,\n): CyjsParsed | null | typeof CYJS_THROWS {\n if (raw === undefined) {\n return null;\n }\n if (typeof raw === \"function\") {\n return mode === \"flat\" ? null : { kind: \"fn\" };\n }\n const value = typeof raw === \"string\" ? raw.trim() : raw;\n if (mode !== \"flat\" && typeof value === \"string\" && value.length >= 7 && value[1] === \"a\") {\n const mapper = parseMapper(spec, value, mode);\n if (mapper !== undefined) {\n return mapper;\n }\n }\n return parseFlat(spec, raw);\n}\n\n/**\n * A `data()` or `mapData()` value.\n * @param spec - the property\n * @param value - the trimmed value\n * @param mode - a rule or a bypass\n * @returns the mapper, null when it is refused (or its constant), or undefined when the value is not a mapper\n */\nfunction parseMapper(spec: CyjsPropertySpec, value: string, mode: CyjsParseMode): CyjsParsed | null | undefined {\n if (value.startsWith(\"d\")) {\n const field = callArgs(value, \"data\")?.trim();\n if (field === undefined || !FIELD.test(field)) {\n return undefined;\n }\n return mode === \"bypass\" ? null : { kind: \"data\", field };\n }\n if (!value.startsWith(\"m\") || value.length < 10) {\n return undefined;\n }\n return parseMapData(spec, value, mode);\n}\n\n/**\n * A `mapData()` value.\n * @param spec - the property\n * @param value - the trimmed value, starting with `m`\n * @param mode - a rule or a bypass\n * @returns the mapper, null when it is refused (or its constant), or undefined when the value is not a mapper\n */\nfunction parseMapData(spec: CyjsPropertySpec, value: string, mode: CyjsParseMode): CyjsParsed | null | undefined {\n const inner = callArgs(value, \"mapData\");\n if (inner === null) {\n return undefined;\n }\n const args = splitArgs(inner);\n if (!isMapDataArgs(args)) {\n return undefined;\n }\n if (mode === \"bypass\") {\n return null;\n }\n const numeric =\n spec.type === \"zeroOne\" ||\n spec.type === \"positive\" ||\n spec.type === \"size\" ||\n spec.type === \"signedSize\" ||\n spec.type === \"nodeSize\";\n if (spec.type !== \"color\" && !numeric) {\n return null;\n }\n const min = parseFlat(spec, args[3].trim());\n const max = parseFlat(spec, args[4].trim());\n if (min === null || max === null || min === CYJS_THROWS || max === CYJS_THROWS) {\n return null;\n }\n if (min.str === max.str || (min.kind === \"number\" && max.kind === \"number\" && pfValue(min) === pfValue(max))) {\n const constant = parseFlat(spec, min.str);\n return constant === CYJS_THROWS ? null : constant;\n }\n return {\n kind: \"mapData\",\n field: args[0].trim(),\n fieldMin: Number.parseFloat(args[1]),\n fieldMax: Number.parseFloat(args[2]),\n min,\n max,\n };\n}\n\n/**\n * Whether `mapData`'s arguments have Cytoscape.js's shape: a field, two numbers and two values.\n * @param args - the arguments\n * @returns true when they do\n */\nfunction isMapDataArgs(args: readonly string[]): boolean {\n return (\n args.length === 5 &&\n /^[\\w.]+\\s*$/.test(args[0]) &&\n NUMBER_ONLY.test(args[1]) &&\n NUMBER_ONLY.test(args[2]) &&\n MAP_ARG.test(args[3].trim()) &&\n MAP_ARG.test(args[4].replace(/^\\s+/, \"\"))\n );\n}\n\n/**\n * A number's value in pixels as Cytoscape.js normalizes it in a headless core (an `em` is 1 pixel there).\n * @param v - the number\n * @returns the normalized value\n */\nfunction pfValue(v: CyjsFlat & { kind: \"number\" }): number {\n return v.value;\n}\n\n/**\n * A field of an element's data as a mapper reads it: the dotted path walked while each step is truthy.\n * @param data - the element's data object\n * @param field - the field\n * @returns the value\n */\nfunction mapperField(data: unknown, field: string): unknown {\n let v: unknown = data;\n for (const step of field.split(\".\")) {\n if (!v) {\n break;\n }\n v = (v as Record<string, unknown>)[step];\n }\n return v;\n}\n\n/**\n * Evaluates a mapper for one element the way Cytoscape.js applies it.\n * @param spec - the property\n * @param m - the mapper\n * @param data - the element's data object\n * @returns the flat value, null when the mapper fails (the property resets to its default), or `CYJS_THROWS`\n */\nexport function applyCyjsMapper(\n spec: CyjsPropertySpec,\n m: CyjsParsed & { kind: \"data\" | \"mapData\" },\n data: unknown,\n): FlatParse {\n const v = mapperField(data, m.field);\n if (v === null || v === undefined) {\n return null;\n }\n if (m.kind === \"data\") {\n return parseFlat(spec, v);\n }\n if (typeof v !== \"number\" || Number.isNaN(v)) {\n return null;\n }\n const width = m.fieldMax - m.fieldMin;\n const p = Math.min(1, Math.max(0, width === 0 ? 0 : (v - m.fieldMin) / width));\n const { min, max } = m;\n if (min.kind === \"color\" && max.kind === \"color\") {\n const c = [0, 1, 2].map((k) => Math.round(min.rgb[k] + (max.rgb[k] - min.rgb[k]) * p)) as [\n number,\n number,\n number,\n ];\n return { kind: \"color\", rgb: c, str: `rgb(${c[0]}, ${c[1]}, ${c[2]})` };\n }\n if (min.kind === \"number\" && max.kind === \"number\") {\n return parseFlat(spec, min.value + (max.value - min.value) * p);\n }\n return null;\n}\n\n/**\n * A flat color as `#rrggbb`; a channel outside 0..255 is noted and undefined is returned.\n * @param v - the color\n * @param site - where it was read\n * @returns the color, or undefined\n */\nfunction colorNeutral(v: Extract<CyjsFlat, { kind: \"color\" }>, site: CanonSite): StyleValue | undefined {\n if (v.rgb.some((c) => !Number.isFinite(c) || c < 0 || c > 255)) {\n site.notes.add(STYLE_ISSUE.BAD_VALUE, site.target, site.property, {\n sample: v.str,\n element: site.element,\n });\n return undefined;\n }\n return `#${v.rgb.map((c) => Math.round(c).toString(16).padStart(2, \"0\")).join(\"\")}`;\n}\n\n/**\n * The neutral value a flat value is drawn as, for one property. A value Cytoscape.js draws from the page (an `em`\n * size, a node sized to its label) cannot be evaluated: it is noted and undefined is returned.\n * @param spec - the property\n * @param v - the flat value\n * @param site - where it was read\n * @returns the neutral value (for the combined parts, the Cytoscape.js word), or undefined\n */\nexport function cyjsNeutral(spec: CyjsPropertySpec, v: CyjsFlat, site: CanonSite): StyleValue | undefined {\n switch (v.kind) {\n case \"color\":\n return colorNeutral(v, site);\n case \"number\":\n // Cytoscape.js steps a bundle's control points; a quadratic's middle is half as far out. It grows the\n // outline's path by its offset across, so the outline starts half the offset out (drawOutline).\n return num6((HALVED.has(spec.property) ? v.value / 2 : v.value) * (v.units === \"em\" ? EM_PX : 1));\n default:\n break;\n }\n const word = v.value;\n switch (spec.property) {\n case \"width\":\n case \"height\":\n // a node sized to its label is drawn so by the node sizes (`nodeSizes`); an edge has no such width\n if (site.target === \"edge\") {\n site.notes.add(STYLE_ISSUE.BAD_VALUE, site.target, site.property, {\n sample: v.str,\n element: site.element,\n });\n }\n return undefined;\n case \"label\":\n case \"sourceLabel\":\n case \"targetLabel\":\n case \"labelFont\":\n return String(word);\n case \"gradientKind\":\n return GRADIENT_KINDS.get(String(word)) ?? undefined;\n case \"gradientColors\":\n return gradientColors(String(word), site);\n case \"gradientStops\":\n return gradientStops(String(word));\n case \"labelItalic\":\n return word === \"italic\" || word === \"oblique\";\n case \"curved\":\n return !STRAIGHT.has(String(word));\n case \"shapePoints\":\n return cyjsPointsToNeutral(String(word)) ?? undefined;\n case \"underlayShape\":\n case \"overlayShape\":\n return canonEnum(\"shape\", String(word), \"cytoscape-js\", site) ?? undefined;\n case \"shape\": {\n const polygon = String(word).toLowerCase();\n if (polygon === \"polygon\") {\n return \"polygon\";\n }\n // drawn exactly as the polygon Cytoscape.js builds, by `cyjsPolygonShapes`\n return CYJS_POLYGON_SHAPES.has(polygon) || CYJS_ROUND_SHAPES.has(polygon)\n ? `other:${polygon}`\n : (canonEnum(\"shape\", String(word), \"cytoscape-js\", site) ?? undefined);\n }\n case \"borderStyle\":\n return canonEnum(\"borderStyle\", String(word), \"cytoscape-js\", site) ?? undefined;\n case \"outerBorderStyle\":\n // cytoscape.js 3.34.3 drawOutline strokes a double outline whole and then erases a line a third of the\n // BORDER's width down its middle, a hairline under a border of 1: the ring it shows is solid\n return word === \"double\"\n ? \"solid\"\n : (canonEnum(\"borderStyle\", String(word), \"cytoscape-js\", site) ?? undefined);\n case \"lineStyle\":\n return canonEnum(\"lineStyle\", String(word), \"cytoscape-js\", site) ?? undefined;\n case \"sourceArrow\":\n case \"targetArrow\":\n case \"midSourceArrow\":\n case \"midTargetArrow\":\n return canonEnum(\"arrow\", String(word), \"cytoscape-js\", site) ?? undefined;\n case \"labelWeight\":\n return canonEnum(\"weight\", String(word), \"cytoscape-js\", site) ?? undefined;\n default:\n return word;\n }\n}\n\n/**\n * What a value a Cytoscape.js core reports for an element (`ele.style(name)`, always text) is drawn as.\n * @param target - nodes or edges\n * @param name - the Cytoscape.js property name\n * @param str - the reported value\n * @param site - where it was read\n * @returns the neutral value (for the combined parts, the Cytoscape.js word), null when the property is not carried\n * or the value does not parse, or undefined when it cannot be evaluated (noted)\n */\nexport function cyjsRendered(\n target: StyleTarget,\n name: string,\n str: unknown,\n site: CanonSite,\n): StyleValue | null | undefined {\n const spec = cyjsProperties(target).get(cyjsPropertyName(name));\n if (spec === undefined || typeof str !== \"string\") {\n return null;\n }\n const v = parseFlat(spec, str, true);\n if (v === null || v === CYJS_THROWS) {\n return null;\n }\n return cyjsNeutral(spec, v, site);\n}\n\n/**\n * The line class a dash array looks like against the line's width: solid where its gaps are a tenth of it or less,\n * dotted where no dash is longer than one and a half widths, dash-dot where a dash is twice another, else dashed.\n * @param dash - the dashes and gaps, in pixels\n * @param width - the line's width\n * @param cap - the dashes' ends\n * @returns the neutral line style\n */\nexport function cyjsDashLook(dash: readonly number[], width: number, cap: string): string {\n const pairs = dash.length % 2 === 1 ? [...dash, ...dash] : [...dash];\n const grow = cap === \"butt\" ? 0 : width;\n const on = pairs.filter((_, i) => i % 2 === 0).map((d) => Math.max(0, d) + grow);\n const off = pairs.filter((_, i) => i % 2 === 1).map((d) => Math.max(0, d - grow));\n const sum = (xs: readonly number[]): number => xs.reduce((a, b) => a + b, 0);\n if (sum(off) <= 0.1 * (sum(on) + sum(off))) {\n return \"solid\";\n }\n if (on.every((d) => d <= Math.max(1, width) * 1.5)) {\n return \"dotted\";\n }\n return Math.max(...on) >= 2 * Math.min(...on) ? \"dash-dot\" : \"dashed\";\n}\n","/**\n * The routes Cytoscape.js 3.34 draws for edges that do not run straight between their nodes, as neutral `bends`:\n * `segments` and `taxi` edges through their corner points, and `unbundled-bezier` edges and loops as the quadratic\n * splines Cytoscape.js draws through their control points, sampled into points (cytoscape.js 3.34.3\n * dist/cytoscape.cjs.js: `findSegmentsPoints` 23774, `findTaxiPoints` 23919, `findBezierPoints` 23878,\n * `findLoopPoints` 23806, the pair geometry 24400-24470).\n */\n\nimport { type BendPoint, canonBends, canonNodeOffsets, flattenQuadSpline } from \"../canon/bends.js\";\n\n/** One node as Cytoscape.js measures it for routing. */\nexport interface CyjsRouteNode {\n /** Its center, y down. */\n readonly center: BendPoint;\n /** Its outer width and height (the border included), which routes are measured against. */\n readonly size: BendPoint;\n /** Its width and height as drawn, which a loop's points are written relative to. */\n readonly box: BendPoint;\n /** Whether its shape is an ellipse (any other shape is measured as its box). */\n readonly ellipse: boolean;\n}\n\n/** One edge's routing settings, as Cytoscape.js spells them (null where unset: Cytoscape.js's default). */\nexport interface CyjsRouteEdge {\n readonly curveStyle: string;\n readonly segmentDistances: string | null;\n readonly segmentWeights: string | null;\n readonly controlPointDistances: string | null;\n readonly controlPointWeights: string | null;\n readonly controlPointStepSize: number | null;\n readonly taxiDirection: string | null;\n readonly taxiTurn: string | null;\n readonly taxiTurnMinDistance: number | null;\n readonly edgeDistances: string | null;\n readonly loopDirection: string | null;\n readonly loopSweep: string | null;\n /** A `round-segments` edge's corner radii (`segment-radii`). */\n readonly segmentRadii?: string | null;\n /** A `round-taxi` edge's corner radius (`taxi-radius`). */\n readonly taxiRadius?: string | null;\n /** Whether a radius is the arc's (`arc-radius`, the default) or how far back the arc starts (`influence-radius`). */\n readonly radiusType?: string | null;\n}\n\n/** An edge's route: its neutral `bends`, or null when Cytoscape.js draws it some other way. */\ntype CyjsRoute = string | null;\n\n/**\n * A list of lengths (`20px -20px`, numbers in pixels).\n * @param text - the value\n * @returns the numbers, none when one is not a number\n */\nfunction lengths(text: string): number[] {\n const out = text\n .trim()\n .split(/\\s+/)\n .map((t) => Number.parseFloat(t));\n return out.every((n) => Number.isFinite(n)) ? out : [];\n}\n\n/**\n * A Cytoscape.js angle in radians (`-45deg`, `0.5rad`, or radians with no unit).\n * @param text - the value\n * @returns the radians, or NaN\n */\nfunction radians(text: string): number {\n const t = text.trim();\n const x = Number.parseFloat(t);\n return t.endsWith(\"deg\") ? (x * Math.PI) / 180 : x;\n}\n\n/**\n * Where the ray from a node's center toward a point leaves the node: its ellipse, or its box.\n * @param node - the node\n * @param toward - the point\n * @returns the point on the node's outline\n */\nfunction outlinePoint(node: CyjsRouteNode, toward: BendPoint): BendPoint {\n const [cx, cy] = node.center;\n const dx = toward[0] - cx;\n const dy = toward[1] - cy;\n const [hw, hh] = [node.size[0] / 2, node.size[1] / 2];\n if ((dx === 0 && dy === 0) || hw <= 0 || hh <= 0) {\n return node.center;\n }\n // ponytail: every shape but the ellipse is measured as its box; the polygons' own outlines if a route needs them\n const t = node.ellipse ? 1 / Math.hypot(dx / hw, dy / hh) : Math.min(axisReach(dx, hw), axisReach(dy, hh));\n return [cx + dx * t, cy + dy * t];\n}\n\n/**\n * How many steps of a direction reach a box's side along one axis.\n * @param d - the step along the axis\n * @param half - the box's half size along it\n * @returns the steps, Infinity for a step of 0\n */\nfunction axisReach(d: number, half: number): number {\n return d === 0 ? Infinity : half / Math.abs(d);\n}\n\n/**\n * The line distances along a route are measured on: the two outline points (`edge-distances: intersection`, the\n * default) or the two centers (`node-position`).\n * @param edge - the edge's settings\n * @param src - its source\n * @param tgt - its target\n * @returns the two points and the unit normal Cytoscape.js offsets by (to the right of the line, y down)\n */\nfunction measureLine(\n edge: CyjsRouteEdge,\n src: CyjsRouteNode,\n tgt: CyjsRouteNode,\n): { a: BendPoint; b: BendPoint; normal: BendPoint } {\n const a0 = outlinePoint(src, tgt.center);\n const b0 = outlinePoint(tgt, src.center);\n const dx = b0[0] - a0[0];\n const dy = b0[1] - a0[1];\n const l = Math.hypot(dx, dy) || 1;\n const normal: BendPoint = [-dy / l, dx / l];\n return edge.edgeDistances === \"node-position\" ? { a: src.center, b: tgt.center, normal } : { a: a0, b: b0, normal };\n}\n\n/**\n * Points at weights along a line, each offset across it by a distance.\n * @param line - the line and its normal\n * @param line.a - its start\n * @param line.b - its end\n * @param line.normal - the unit normal\n * @param weights - the weights, 0 at the start\n * @param distances - the distances\n * @returns the points (as many as the shorter list)\n */\nfunction offsetPoints(\n line: { a: BendPoint; b: BendPoint; normal: BendPoint },\n weights: readonly number[],\n distances: readonly number[],\n): BendPoint[] {\n const n = Math.min(weights.length, distances.length);\n return Array.from({ length: n }, (_, s): BendPoint => {\n const w = weights[s];\n const d = distances[s];\n return [\n line.a[0] * (1 - w) + line.b[0] * w + line.normal[0] * d,\n line.a[1] * (1 - w) + line.b[1] * w + line.normal[1] * d,\n ];\n });\n}\n\n/**\n * A taxi edge's corner points (`findTaxiPoints`).\n * @param edge - the edge's settings\n * @param src - its source\n * @param tgt - its target\n * @returns the corners\n */\nfunction taxiPoints(edge: CyjsRouteEdge, src: CyjsRouteNode, tgt: CyjsRouteNode): BendPoint[] {\n const body = edge.edgeDistances !== \"node-position\";\n const [x1, y1] = src.center;\n const [x2, y2] = tgt.center;\n const [srcW, srcH] = src.size;\n const [tgtW, tgtH] = tgt.size;\n const pdx = x2 - x1;\n const pdy = y2 - y1;\n const dx = towardZero(pdx, body ? (srcW + tgtW) / 2 : 0);\n const dy = towardZero(pdy, body ? (srcH + tgtH) / 2 : 0);\n const raw = edge.taxiDirection ?? \"auto\";\n const vertical =\n raw === \"auto\" ? Math.abs(dx) <= Math.abs(dy) : raw === \"vertical\" || raw === \"upward\" || raw === \"downward\";\n const [along, pl] = vertical ? [dy, pdy] : [dx, pdx];\n const { d, l, sgn, forced } = taxiTurn(edge, raw, along, pl);\n const minD = edge.taxiTurnMinDistance ?? 10;\n const tooClose = (v: number): boolean => Math.abs(v) < minD || Math.abs(v) >= Math.abs(l);\n if ((tooClose(d) || tooClose(Math.abs(l) - Math.abs(d))) && !forced) {\n return taxiFallback(vertical, { x1, y1, x2, y2, pl, pdx, pdy }, src.size, tgt.size);\n }\n const srcAlong = vertical ? srcH : srcW;\n const out = body ? (srcAlong / 2) * sgn : 0;\n if (vertical) {\n const y = y1 + d + out;\n return [\n [x1, y],\n [x2, y],\n ];\n }\n const x = x1 + d + out;\n return [\n [x, y1],\n [x, y2],\n ];\n}\n\n/**\n * A difference less a gap, toward 0 and no further.\n * @param v - the difference\n * @param gap - the gap\n * @returns what is left\n */\nfunction towardZero(v: number, gap: number): number {\n return v > 0 ? Math.max(v - gap, 0) : Math.min(v + gap, 0);\n}\n\n/**\n * Where a taxi edge turns (`findTaxiPoints`): `taxi-turn` along its direction, a percentage of the gap between the\n * nodes or a distance from the source, a negative one from the target. A direction the nodes run against turns it\n * round (forced) unless an explicit direction is given with a percentage or a negative turn.\n * @param edge - the edge's settings\n * @param raw - its `taxi-direction`\n * @param along - the gap between the nodes along its direction\n * @param pl - the difference between the centers along its direction\n * @returns the turn's distance from the source, the gap and its sign as turned, and whether it was turned round\n */\nfunction taxiTurn(\n edge: CyjsRouteEdge,\n raw: string,\n along: number,\n pl: number,\n): { d: number; l: number; sgn: number; forced: boolean } {\n const explicit = raw !== \"auto\" && raw !== \"vertical\" && raw !== \"horizontal\";\n const turnText = (edge.taxiTurn ?? \"50%\").trim();\n const percent = turnText.endsWith(\"%\");\n const turn = percent ? Number.parseFloat(turnText) / 100 : Number.parseFloat(turnText);\n const forced = !(explicit && (percent || turn < 0)) && runsAgainst(raw, pl);\n const sgn = forced ? -Math.sign(pl) : Math.sign(pl);\n const l = forced ? sgn * Math.abs(along) : along;\n if (percent) {\n return { d: (turn < 0 ? 1 + turn : turn) * l, l, sgn, forced };\n }\n return { d: (turn < 0 ? l : 0) + turn * sgn, l, sgn, forced };\n}\n\n/**\n * Whether the nodes run against a taxi edge's explicit direction.\n * @param raw - its `taxi-direction`\n * @param pl - the difference between the centers along it\n * @returns whether they do\n */\nfunction runsAgainst(raw: string, pl: number): boolean {\n return (\n (raw === \"downward\" && pl < 0) ||\n (raw === \"upward\" && pl > 0) ||\n (raw === \"leftward\" && pl > 0) ||\n (raw === \"rightward\" && pl < 0)\n );\n}\n\n/**\n * A taxi edge's corners when its turn would fall too close to a node: a Z or an L shape (`findTaxiPoints`).\n * @param vertical - whether the taxi runs vertically\n * @param p - the centers and their differences\n * @param p.x1 - the source's x\n * @param p.y1 - the source's y\n * @param p.x2 - the target's x\n * @param p.y2 - the target's y\n * @param p.pl - the difference along the taxi's direction\n * @param p.pdx - the difference in x\n * @param p.pdy - the difference in y\n * @param srcSize - the source's outer size\n * @param tgtSize - the target's outer size\n * @returns the corners\n */\nfunction taxiFallback(\n vertical: boolean,\n p: { x1: number; y1: number; x2: number; y2: number; pl: number; pdx: number; pdy: number },\n srcSize: BendPoint,\n tgtSize: BendPoint,\n): BendPoint[] {\n const { x1, y1, x2, y2, pl, pdx, pdy } = p;\n const midX = (x1 + x2) / 2;\n const midY = (y1 + y2) / 2;\n if (vertical) {\n if (Math.abs(pl) <= srcSize[1] / 2) {\n return [\n [midX, y1],\n [midX, y2],\n ];\n }\n if (Math.abs(pdx) <= tgtSize[0] / 2) {\n return [\n [x1, midY],\n [x2, midY],\n ];\n }\n return [[x1, y2]];\n }\n if (Math.abs(pl) <= srcSize[0] / 2) {\n return [\n [x1, midY],\n [x2, midY],\n ];\n }\n if (Math.abs(pdy) <= tgtSize[1] / 2) {\n return [\n [midX, y1],\n [midX, y2],\n ];\n }\n return [[x2, y1]];\n}\n\n/**\n * The points between an edge's two ends of the quadratic spline Cytoscape.js draws through control points: from the\n * node's outline toward the first control point to the other node's outline toward the last.\n * @param src - the source\n * @param tgt - the target\n * @param controls - the control points\n * @returns the sampled points, the ends left out\n */\nfunction splinePoints(src: CyjsRouteNode, tgt: CyjsRouteNode, controls: readonly BendPoint[]): BendPoint[] {\n const start = outlinePoint(src, controls[0]);\n const end = outlinePoint(tgt, controls.at(-1) ?? tgt.center);\n return flattenQuadSpline([start, ...controls, end], 0).slice(1, -1);\n}\n\n/**\n * The route of one edge, as neutral `bends`.\n * @param edge - the edge's settings\n * @param src - its source\n * @param tgt - its target\n * @param loopIndex - for a loop, how many loops of the same direction and sweep on its node come before it\n * @returns the bends, or null when Cytoscape.js draws the edge straight or as a bundle's bezier\n */\nexport function cyjsRoute(edge: CyjsRouteEdge, src: CyjsRouteNode, tgt: CyjsRouteNode, loopIndex: number): CyjsRoute {\n const style = edge.curveStyle;\n if (style === \"haystack\") {\n return null;\n }\n if (src === tgt) {\n return loopRoute(edge, src, loopIndex);\n }\n let points: BendPoint[] = [];\n if (style.endsWith(\"segments\")) {\n const distances = lengths(edge.segmentDistances ?? \"20\");\n const weights = lengths(edge.segmentWeights ?? \"0.5\");\n points = offsetPoints(measureLine(edge, src, tgt), weights, distances);\n } else if (style.endsWith(\"taxi\")) {\n points = taxiPoints(edge, src, tgt);\n } else if (style === \"unbundled-bezier\") {\n // with no control-point-distances, its one control point is the step size out (cytoscape.js 3.34.3\n // `findBezierPoints`: \"fall back on step size\")\n const distances = lengths(edge.controlPointDistances ?? String(edge.controlPointStepSize ?? 40));\n const weights = lengths(edge.controlPointWeights ?? \"0.5\");\n const controls = offsetPoints(measureLine(edge, src, tgt), weights, distances);\n points = controls.length === 0 ? [] : splinePoints(src, tgt, controls);\n }\n if (points.length > 0 && style.startsWith(\"round-\")) {\n const radii = lengths((style === \"round-taxi\" ? edge.taxiRadius : edge.segmentRadii) ?? \"15\");\n const types = (edge.radiusType ?? \"arc-radius\").trim().split(/\\s+/);\n const start = outlinePoint(src, points[0]);\n const end = outlinePoint(tgt, points.at(-1) ?? tgt.center);\n points = roundedCorners([start, ...points, end], radii, types).slice(1, -1);\n }\n return points.length === 0 ? null : canonBends(src.center, tgt.center, points, true);\n}\n\n/** How many points each rounded corner's arc is drawn with. */\nconst ARC_STEPS = 8;\n\n/**\n * A polyline's corners rounded as Cytoscape.js rounds a `round-segments` or `round-taxi` edge's (cytoscape.js 3.34.3\n * `calcCornerArc`): an arc tangent to both sides, its radius the corner's (the last given for the corners after it),\n * or for `influence-radius` starting that far back along each side; never reaching past either side's middle.\n * @param line - the points, ends included\n * @param radii - the corners' radii\n * @param types - each corner's radius type\n * @returns the points with each corner replaced by its arc\n */\nfunction roundedCorners(line: readonly BendPoint[], radii: readonly number[], types: readonly string[]): BendPoint[] {\n const out: BendPoint[] = [line[0]];\n for (let i = 1; i < line.length - 1; i++) {\n const [p, a, b] = [line[i], line[i - 1], line[i + 1]];\n const r = radii[Math.min(i - 1, radii.length - 1)] ?? 15;\n const arc = (types[Math.min(i - 1, types.length - 1)] ?? \"arc-radius\") !== \"influence-radius\";\n const l1 = Math.hypot(a[0] - p[0], a[1] - p[1]);\n const l2 = Math.hypot(b[0] - p[0], b[1] - p[1]);\n const u1: BendPoint = [(a[0] - p[0]) / l1, (a[1] - p[1]) / l1];\n const u2: BendPoint = [(b[0] - p[0]) / l2, (b[1] - p[1]) / l2];\n // the angle between the two sides at the corner\n const angle = Math.acos(Math.max(-1, Math.min(1, u1[0] * u2[0] + u1[1] * u2[1])));\n const half = angle / 2;\n // a radius that is not a number, like one of 0, rounds nothing\n const rounds = r > 0 && l1 > 0 && l2 > 0;\n if (!rounds || Math.abs(Math.PI - angle) < 1e-6) {\n out.push(p);\n continue;\n }\n const limit = Math.min(l1 / 2, l2 / 2);\n const back = Math.min(limit, arc ? r / Math.tan(half) : r);\n const radius = back * Math.tan(half);\n const bis: BendPoint = [u1[0] + u2[0], u1[1] + u2[1]];\n const bl = Math.hypot(bis[0], bis[1]);\n const reach = Math.hypot(back, radius);\n const c: BendPoint = [p[0] + (bis[0] / bl) * reach, p[1] + (bis[1] / bl) * reach];\n const from = Math.atan2(p[1] + u1[1] * back - c[1], p[0] + u1[0] * back - c[0]);\n const to = Math.atan2(p[1] + u2[1] * back - c[1], p[0] + u2[0] * back - c[0]);\n // the short way round\n let sweep = to - from;\n sweep -= 2 * Math.PI * Math.round(sweep / (2 * Math.PI));\n for (let k = 0; k <= ARC_STEPS; k++) {\n const t = from + (sweep * k) / ARC_STEPS;\n out.push([c[0] + Math.cos(t) * radius, c[1] + Math.sin(t) * radius]);\n }\n }\n out.push(line.at(-1) ?? line[0]);\n return out;\n}\n\n/**\n * A loop's route (`findLoopPoints`): two control points out from the node's center along the loop's direction, half\n * its sweep to either side, as far as 1.4 times the step size (the control point distance for an unbundled bezier),\n * further for each loop before it; written relative to the node's size.\n * @param edge - the edge's settings\n * @param node - its node\n * @param loopIndex - how many loops of the same direction and sweep come before it\n * @returns the bends\n */\nfunction loopRoute(edge: CyjsRouteEdge, node: CyjsRouteNode, loopIndex: number): CyjsRoute {\n const unbundled = edge.curveStyle === \"unbundled-bezier\";\n const dist = unbundled\n ? (lengths(edge.controlPointDistances ?? \"\").at(0) ?? Number.NaN)\n : (edge.controlPointStepSize ?? 40);\n const dir = radians(edge.loopDirection ?? \"-45deg\");\n const sweep = radians(edge.loopSweep ?? \"-90deg\");\n if (!Number.isFinite(dist + dir + sweep)) {\n return null;\n }\n const angle = dir - Math.PI / 2;\n const reach = 1.4 * dist * (loopIndex / 3 + 1);\n const [cx, cy] = node.center;\n const at = (a: number): BendPoint => [cx + Math.cos(a) * reach, cy + Math.sin(a) * reach];\n const points = splinePoints(node, node, [at(angle - sweep / 2), at(angle + sweep / 2)]);\n return canonNodeOffsets(node.center, node.box, points, true);\n}\n","/**\n * Cytoscape.js's selector grammar, parsed the way Cytoscape.js 3.x parses it, by index in one pass. The grammar is\n * Cytoscape.js's own: the same tokens tried in the same order (group, state, `#id`, `.class`, `[a]`, `[a op v]`,\n * `[?a]`, `[[degree op n]]`, then the separators `,` `->` `<->` `>` and a space, and the subject `$`), building the\n * same query structure, so a selector that is valid there is valid here and selects the same elements.\n *\n * Two of Cytoscape.js's behaviors are kept on purpose because files depend on them:\n * - an invalid selector keeps what was parsed before the error. A selector whose first token fails has one empty\n * query and matches every node and edge; `node:not(.a)` keeps `node` and matches every node.\n * - a string value is kept as written between its quotes: `[a = \"x\\\"y\"]` compares with `x\\\"y`.\n */\n\n/** A comparison operator after its `!` and `@` flags are taken off. */\nexport type CyjsCompareOp = \"=\" | \">\" | \">=\" | \"<\" | \"<=\" | \"*=\" | \"^=\" | \"$=\";\n\n/** One check of a query; a query matches when every check does. */\nexport type CyjsCheck =\n | {\n /** The kind of check. */ readonly type: \"group\";\n /** The value compared with or matched. */ readonly value: \"nodes\" | \"edges\" | \"*\";\n }\n | {\n /** The kind of check. */ readonly type: \"state\";\n /** The value compared with or matched. */ readonly value: string;\n }\n | {\n /** The kind of check. */ readonly type: \"id\";\n /** The value compared with or matched. */ readonly value: string;\n }\n | {\n /** The kind of check. */ readonly type: \"class\";\n /** The value compared with or matched. */ readonly value: string;\n }\n | {\n /** The kind of check. */ readonly type: \"exist\";\n /** The data field (or, for `meta`, the degree) the check reads. */ readonly field: string;\n }\n | {\n /** The kind of check. */ readonly type: \"compare\";\n /** The data field (or, for `meta`, the degree) the check reads. */ readonly field: string;\n /** The operator. */ readonly op: CyjsCompareOp;\n /** Whether the comparison is negated (`!`). */ readonly not: boolean;\n /** Whether a string comparison ignores case (`@`). */ readonly ci: boolean;\n /** The value compared with or matched. */ readonly value: string | number;\n }\n | {\n /** The kind of check. */ readonly type: \"bool\";\n /** The data field (or, for `meta`, the degree) the check reads. */ readonly field: string;\n /** The operator. */ readonly op: \"?\" | \"!\" | \"^\";\n }\n | {\n /** The kind of check. */ readonly type: \"meta\";\n /** The data field (or, for `meta`, the degree) the check reads. */ readonly field:\n \"degree\" | \"indegree\" | \"outdegree\";\n /** The operator. */ readonly op: CyjsCompareOp;\n /** Whether the comparison is negated (`!`). */ readonly not: boolean;\n /** Whether a string comparison ignores case (`@`). */ readonly ci: boolean;\n /** The value compared with or matched. */ readonly value: number;\n }\n | {\n /** The kind of check: matches every element. */\n readonly type: \"true\";\n }\n | {\n /** The kind of check. */ readonly type: \"child\";\n /** The query the parent must match. */ readonly parent: CyjsQuery;\n /** The query the child must match. */ readonly child: CyjsQuery;\n }\n | {\n /** The kind of check. */ readonly type: \"descendant\";\n /** The query an ancestor must match. */ readonly ancestor: CyjsQuery;\n /** The query the descendant must match. */ readonly descendant: CyjsQuery;\n }\n | {\n /** The kind of check. */ readonly type: \"parent\";\n /** The query the parent must match. */ readonly parent: CyjsQuery;\n /** The query the child must match. */ readonly child: CyjsQuery;\n }\n | {\n /** The kind of check. */ readonly type: \"ancestor\";\n /** The query an ancestor must match. */ readonly ancestor: CyjsQuery;\n /** The query the descendant must match. */ readonly descendant: CyjsQuery;\n }\n | {\n /** The kind of check. */ readonly type: \"split\";\n /** The query left of the separator. */ readonly left: CyjsQuery;\n /** The query right of the separator. */ readonly right: CyjsQuery;\n /** The query marked as the subject with `$`. */ readonly subject: CyjsQuery;\n }\n | {\n /** The kind of check. */ readonly type: \"directedEdge\";\n /** The query the source node must match. */ readonly source: CyjsQuery;\n /** The query the target node must match. */ readonly target: CyjsQuery;\n }\n | {\n /** The kind of check. */ readonly type: \"undirectedEdge\";\n /** The queries the two end nodes must match, in either order. */ readonly nodes: readonly [\n CyjsQuery,\n CyjsQuery,\n ];\n }\n | {\n /** The kind of check. */ readonly type: \"nodeSource\";\n /** The query the source node must match. */ readonly source: CyjsQuery;\n /** The query the target node must match. */ readonly target: CyjsQuery;\n }\n | {\n /** The kind of check. */ readonly type: \"nodeTarget\";\n /** The query the source node must match. */ readonly source: CyjsQuery;\n /** The query the target node must match. */ readonly target: CyjsQuery;\n }\n | {\n /** The kind of check. */ readonly type: \"nodeNeighbor\";\n /** The query the node itself must match. */ readonly node: CyjsQuery;\n /** The query a neighbor must match. */ readonly neighbor: CyjsQuery;\n };\n\n/** One comma-separated alternative of a selector. */\nexport interface CyjsQuery {\n /** The checks; an empty list matches every element. */\n checks: CyjsCheck[];\n}\n\n/** A parsed selector. */\nexport interface CyjsSelector {\n /** The alternatives; an element matches when any one does. None: the selector matches nothing. */\n readonly queries: readonly CyjsQuery[];\n /** Cytoscape.js rejects the selector; the queries hold what it parsed before the error. */\n readonly invalid: boolean;\n}\n\n/** Every state selector Cytoscape.js 3.x knows. */\nconst CYJS_STATES: ReadonlySet<string> = new Set([\n \"selected\",\n \"unselected\",\n \"selectable\",\n \"unselectable\",\n \"locked\",\n \"unlocked\",\n \"visible\",\n \"hidden\",\n \"transparent\",\n \"grabbed\",\n \"free\",\n \"removed\",\n \"inside\",\n \"grabbable\",\n \"ungrabbable\",\n \"animated\",\n \"unanimated\",\n \"parent\",\n \"childless\",\n \"child\",\n \"orphan\",\n \"nonorphan\",\n \"compound\",\n \"loop\",\n \"simple\",\n \"active\",\n \"inactive\",\n \"backgrounding\",\n \"nonbackgrounding\",\n]);\n\n/** The longest selector parsed; a longer one is treated as invalid (and noted by the caller). */\nconst MAX_SELECTOR_LENGTH = 1 << 22;\n\n/** Cytoscape.js's escapable meta characters. */\nconst META = new Set(\"!\\\"#$%&'()*+,./:;<=>?@[]^`{|}~\");\n/** The base comparison operators, longest first so a scan takes `>=` before `>`. */\nconst BASE_OPS: readonly string[] = [\"!=\", \">=\", \"<=\", \"*=\", \"^=\", \"$=\", \"=\", \">\", \"<\"];\nconst META_FIELDS: readonly (\"indegree\" | \"outdegree\" | \"degree\")[] = [\"indegree\", \"outdegree\", \"degree\"];\n\n/**\n * Whether a character is a JavaScript regular expression word character.\n * @param c - the character\n * @returns true for `[A-Za-z0-9_]`\n */\nfunction isWord(c: string | undefined): boolean {\n if (c === undefined) {\n return false;\n }\n const k = c.codePointAt(0) ?? 0;\n return (k >= 48 && k <= 57) || (k >= 65 && k <= 90) || (k >= 97 && k <= 122) || k === 95;\n}\n\n/**\n * Whether a character is JavaScript regular expression whitespace (`\\s`).\n * @param c - the character\n * @returns true for whitespace\n */\nfunction isSpace(c: string | undefined): boolean {\n return c !== undefined && /\\s/.test(c);\n}\n\n/** The text being parsed and the position reached. */\nclass Cursor {\n pos = 0;\n constructor(readonly text: string) {}\n\n /**\n * The end of a run of whitespace.\n * @param from - where the run starts\n * @returns the first position after it\n */\n spaceEnd(from: number): number {\n let i = from;\n while (i < this.text.length && isSpace(this.text[i])) {\n i++;\n }\n return i;\n }\n\n /**\n * A name at `from`: word characters, `-`, and `.` when `dots` (Cytoscape.js's variable and id tokens), or a\n * backslash before a meta character.\n * @param from - the start\n * @param dots - whether `.` belongs to the name\n * @returns the raw name and its end, or null when there is none\n */\n name(from: number, dots: boolean): { raw: string; end: number } | null {\n let i = from;\n const t = this.text;\n while (i < t.length) {\n const c = t[i];\n if (isWord(c) || c === \"-\" || (dots && c === \".\")) {\n i++;\n } else if (c === \"\\\\\" && i + 1 < t.length && META.has(t[i + 1])) {\n i += 2;\n } else {\n break;\n }\n }\n return i > from ? { raw: t.slice(from, i), end: i } : null;\n }\n\n /**\n * A number literal at `from` (Cytoscape.js's `[-+]?(\\d+|\\d*\\.\\d+)([Ee][+-]?\\d+)?`). Both readings of the\n * mantissa are returned, longest first, because the regular expression backtracks to the shorter one.\n * @param from - the start\n * @returns the possible ends, longest first\n */\n numberEnds(from: number): number[] {\n const t = this.text;\n let i = from;\n if (t[i] === \"+\" || t[i] === \"-\") {\n i++;\n }\n const digits = (k: number): number => {\n let j = k;\n while (j < t.length && t[j] >= \"0\" && t[j] <= \"9\") {\n j++;\n }\n return j;\n };\n const mantissas: number[] = [];\n const intEnd = digits(i);\n if (intEnd > i) {\n mantissas.push(intEnd);\n }\n // \\d*\\.\\d+\n if (t[intEnd] === \".\") {\n const fracEnd = digits(intEnd + 1);\n if (fracEnd > intEnd + 1) {\n mantissas.unshift(fracEnd);\n }\n }\n const ends: number[] = [];\n for (const m of mantissas) {\n if (t[m] === \"e\" || t[m] === \"E\") {\n let j = m + 1;\n if (t[j] === \"+\" || t[j] === \"-\") {\n j++;\n }\n const expEnd = digits(j);\n if (expEnd > j) {\n ends.push(expEnd);\n }\n }\n ends.push(m);\n }\n return ends;\n }\n\n /**\n * The possible ends of a quoted string at `from`: every quote that may close it, longest first (a quote after a\n * backslash may also be escaped; the first quote with no backslash before it must close the string).\n * @param from - the opening quote\n * @returns the possible ends (after the closing quote), longest first\n */\n stringEnds(from: number): number[] {\n const t = this.text;\n const q = t[from];\n const ends: number[] = [];\n for (let i = from + 1; i < t.length; i++) {\n if (t[i] !== q) {\n continue;\n }\n ends.push(i + 1);\n if (t[i - 1] !== \"\\\\\" || i - 1 === from) {\n break;\n }\n }\n return ends.reverse();\n }\n\n /**\n * A comparison operator at `from`: `!` and `@` flags, then a base operator (`!` before a base that holds `!`\n * is not allowed).\n * @param from - the start\n * @returns the operator text and its end, or null\n */\n op(from: number): { text: string; end: number } | null {\n const t = this.text;\n let i = from;\n let prefix = \"\";\n if (t[i] === \"!\" && t[i + 1] !== \"=\") {\n prefix += \"!\";\n i++;\n }\n if (t[i] === \"@\") {\n prefix += \"@\";\n i++;\n }\n for (const base of BASE_OPS) {\n if (t.startsWith(base, i)) {\n if (prefix.includes(\"!\") && base === \"!=\") {\n return null;\n }\n return { text: prefix + base, end: i + base.length };\n }\n }\n return null;\n }\n}\n\n/**\n * A name with its backslash escapes of meta characters removed.\n * @param raw - the name as written\n * @returns the name\n */\nfunction cleanMeta(raw: string): string {\n let out = \"\";\n let i = 0;\n while (i < raw.length) {\n const escaped = raw[i] === \"\\\\\" && i + 1 < raw.length && META.has(raw[i + 1]);\n out += escaped ? raw[i + 1] : raw[i];\n i += escaped ? 2 : 1;\n }\n return out;\n}\n\n/**\n * Splits an operator into its base and its flags.\n * @param text - the operator as written\n * @returns the base operator and the `!` and `@` flags\n */\nfunction splitOp(text: string): { op: CyjsCompareOp; not: boolean; ci: boolean } {\n let op = text;\n let not = false;\n let ci = false;\n if (op.includes(\"!\")) {\n op = op.replace(\"!\", \"\");\n not = true;\n }\n if (op.includes(\"@\")) {\n op = op.replace(\"@\", \"\");\n ci = true;\n }\n return { op: op as CyjsCompareOp, not, ci };\n}\n\n/** The parser's state across queries: Cytoscape.js's selector object while it is filled. */\ninterface Building {\n readonly queries: CyjsQuery[];\n subject: CyjsQuery | null;\n edgeCount: number;\n compoundCount: number;\n readonly counts: { edgeCount: number; compoundCount: number; subject: CyjsQuery | null }[];\n}\n\n/** A token matched at the cursor: how to fill the selector, and where it ends. */\ninterface Token {\n readonly end: number;\n readonly fill: (b: Building, q: CyjsQuery) => CyjsQuery | null | false;\n}\n\n/**\n * Replaces the last query of the selector.\n * @param b - the selector being built\n * @param q - the replacement\n */\nfunction replaceLast(b: Building, q: CyjsQuery): void {\n b.queries[b.queries.length - 1] = q;\n}\n\n/**\n * The last query of the selector (a selector always has one).\n * @param b - the selector being built\n * @returns the query\n */\nfunction lastQuery(b: Building): CyjsQuery {\n return b.queries.at(-1) as CyjsQuery;\n}\n\n/**\n * The compound separators (`>` and a space) as Cytoscape.js fills them.\n * @param kind - child or descendant\n * @returns the fill function\n */\nfunction compoundFill(kind: \"child\" | \"descendant\"): Token[\"fill\"] {\n return (b, query) => {\n if (b.subject === null) {\n const outer: CyjsQuery = { checks: [] };\n const inner: CyjsQuery = { checks: [] };\n const left = lastQuery(b);\n outer.checks.push(\n kind === \"child\"\n ? { type: \"child\", parent: left, child: inner }\n : { type: \"descendant\", ancestor: left, descendant: inner },\n );\n replaceLast(b, outer);\n b.compoundCount++;\n return inner;\n }\n if (b.subject === query) {\n const compound: CyjsQuery = { checks: [] };\n const left = lastQuery(b);\n const right: CyjsQuery = { checks: [] };\n const subject: CyjsQuery = { checks: query.checks };\n const inner: CyjsQuery = { checks: [] };\n const outer: CyjsQuery = { checks: [{ type: \"true\" }] };\n query.checks = [{ type: \"true\" }];\n right.checks.push(\n kind === \"child\"\n ? { type: \"parent\", parent: outer, child: inner }\n : { type: \"ancestor\", ancestor: outer, descendant: inner },\n );\n compound.checks.push({ type: \"split\", left, right, subject });\n replaceLast(b, compound);\n b.subject = subject;\n b.compoundCount++;\n return inner;\n }\n const outer: CyjsQuery = { checks: query.checks };\n const inner: CyjsQuery = { checks: [] };\n query.checks = [\n kind === \"child\"\n ? { type: \"parent\", parent: outer, child: inner }\n : { type: \"ancestor\", ancestor: outer, descendant: inner },\n ];\n b.compoundCount++;\n return inner;\n };\n}\n\n/**\n * The first of Cytoscape.js's expressions that matches at the cursor, in its order.\n * @param c - the cursor\n * @returns the token, or null when none matches (the selector is invalid)\n */\nfunction nextToken(c: Cursor): Token | null {\n const ch = c.text[c.pos];\n return (\n groupToken(c) ??\n (ch === \":\" ? stateToken(c) : null) ??\n (ch === \"#\" || ch === \".\" ? nameToken(c, ch) : null) ??\n (ch === \"[\" ? dataToken(c, c.pos) : null) ??\n separatorToken(c) ??\n (ch === \"$\" ? subjectToken(c) : null)\n );\n}\n\n/**\n * A check that fills the query with a fixed check.\n * @param end - where the token ends\n * @param check - the check\n * @returns the token\n */\nfunction checkToken(end: number, check: CyjsCheck): Token {\n return {\n end,\n fill: (_b, q) => {\n q.checks.push(check);\n return null;\n },\n };\n}\n\n/**\n * A group: `node`, `edge` or `*`.\n * @param c - the cursor\n * @returns the token, or null\n */\nfunction groupToken(c: Cursor): Token | null {\n const i = c.pos;\n for (const [g, value] of [\n [\"node\", \"nodes\"],\n [\"edge\", \"edges\"],\n [\"*\", \"*\"],\n ] as const) {\n if (c.text.startsWith(g, i)) {\n return checkToken(i + g.length, { type: \"group\", value });\n }\n }\n return null;\n}\n\n/**\n * A state: the longest state name that is a prefix after the `:`.\n * @param c - the cursor\n * @returns the token, or null\n */\nfunction stateToken(c: Cursor): Token | null {\n const i = c.pos;\n let best: string | null = null;\n for (const s of CYJS_STATES) {\n if (c.text.startsWith(s, i + 1) && (best === null || s.length > best.length)) {\n best = s;\n }\n }\n return best === null ? null : checkToken(i + 1 + best.length, { type: \"state\", value: best });\n}\n\n/**\n * An id (`#`) or a class (`.`).\n * @param c - the cursor\n * @param ch - the `#` or `.`\n * @returns the token, or null\n */\nfunction nameToken(c: Cursor, ch: \"#\" | \".\"): Token | null {\n const n = c.name(c.pos + 1, ch === \"#\");\n if (n === null) {\n return null;\n }\n return checkToken(n.end, { type: ch === \"#\" ? \"id\" : \"class\", value: cleanMeta(n.raw) });\n}\n\n/**\n * A separator: `\\s*,\\s*`, `\\s+->\\s+`, `\\s+<->\\s+`, `\\s+>\\s+` or `\\s+`.\n * @param c - the cursor\n * @returns the token, or null\n */\nfunction separatorToken(c: Cursor): Token | null {\n const t = c.text;\n const i = c.pos;\n const ws = c.spaceEnd(i);\n if (t[ws] === \",\") {\n return { end: c.spaceEnd(ws + 1), fill: nextQuery };\n }\n if (ws === i) {\n return null;\n }\n for (const [sep, kind] of [\n [\"->\", \"directed\"],\n [\"<->\", \"undirected\"],\n [\">\", \"child\"],\n ] as const) {\n const after = t.startsWith(sep, ws) ? c.spaceEnd(ws + sep.length) : -1;\n if (after > ws + sep.length) {\n return { end: after, fill: kind === \"child\" ? compoundFill(\"child\") : edgeFill(kind) };\n }\n }\n return { end: ws, fill: compoundFill(\"descendant\") };\n}\n\n/**\n * Starts the next query of a selector list (`,`).\n * @param b - the selector being built\n * @returns the new query\n */\nfunction nextQuery(b: Building): CyjsQuery {\n b.counts.push({ edgeCount: b.edgeCount, compoundCount: b.compoundCount, subject: b.subject });\n b.subject = null;\n b.edgeCount = 0;\n b.compoundCount = 0;\n const next: CyjsQuery = { checks: [] };\n b.queries.push(next);\n return next;\n}\n\n/**\n * The subject marker `$`: the query it follows is the one the selector selects.\n * @param c - the cursor\n * @returns the token\n */\nfunction subjectToken(c: Cursor): Token {\n return {\n end: c.pos + 1,\n fill: (b, q) => {\n if (b.subject !== null && b.subject !== q) {\n return false;\n }\n b.subject = q;\n const top = lastQuery(b);\n const first = top.checks.at(0);\n if (first?.type === \"directedEdge\") {\n top.checks[0] = { type: \"nodeTarget\", source: first.source, target: first.target };\n } else if (first?.type === \"undirectedEdge\") {\n top.checks[0] = { type: \"nodeNeighbor\", node: first.nodes[1], neighbor: first.nodes[0] };\n }\n return null;\n },\n };\n}\n\n/**\n * The edge separators (`->`, `<->`) as Cytoscape.js fills them.\n * @param kind - directed or undirected\n * @returns the fill function\n */\nfunction edgeFill(kind: \"directed\" | \"undirected\"): Token[\"fill\"] {\n return (b, query) => {\n const target: CyjsQuery = { checks: [] };\n const outer: CyjsQuery = { checks: [] };\n if (b.subject === null) {\n outer.checks.push(\n kind === \"directed\"\n ? { type: \"directedEdge\", source: query, target }\n : { type: \"undirectedEdge\", nodes: [query, target] },\n );\n replaceLast(b, outer);\n b.edgeCount++;\n return target;\n }\n if (kind === \"directed\") {\n outer.checks.push({ type: \"nodeSource\", source: query, target });\n replaceLast(b, outer);\n b.edgeCount++;\n return target;\n }\n outer.checks.push({ type: \"nodeNeighbor\", node: query, neighbor: target });\n replaceLast(b, outer);\n return target;\n };\n}\n\n/**\n * A `[...]` token at `i`: data existence, a data comparison, a data boolean or a metadata comparison, tried in\n * Cytoscape.js's order.\n * @param c - the cursor\n * @param i - the position of `[`\n * @returns the token, or null\n */\nfunction dataToken(c: Cursor, i: number): Token | null {\n const inner = c.spaceEnd(i + 1);\n return compareToken(c, inner) ?? boolToken(c, inner) ?? (c.text[i + 1] === \"[\" ? metaToken(c, i) : null);\n}\n\n/**\n * `[a]` or `[a op value]`.\n * @param c - the cursor\n * @param inner - the position after `[` and its whitespace\n * @returns the token, or null\n */\nfunction compareToken(c: Cursor, inner: number): Token | null {\n const t = c.text;\n const v = c.name(inner, true);\n if (v === null) {\n return null;\n }\n const field = cleanMeta(v.raw);\n const afterName = c.spaceEnd(v.end);\n if (t[afterName] === \"]\") {\n return checkToken(afterName + 1, { type: \"exist\", field });\n }\n const op = c.op(afterName);\n if (op === null) {\n return null;\n }\n const at = c.spaceEnd(op.end);\n const quoted = t[at] === '\"' || t[at] === \"'\";\n const end = (quoted ? c.stringEnds(at) : c.numberEnds(at)).find((x) => t[c.spaceEnd(x)] === \"]\");\n if (end === undefined) {\n return null;\n }\n const literal = t.slice(at, end);\n const value: string | number = quoted ? literal.slice(1, -1) : Number.parseFloat(literal);\n const { op: base, not, ci } = splitOp(op.text);\n return checkToken(c.spaceEnd(end) + 1, { type: \"compare\", field, op: base, not, ci, value });\n}\n\n/**\n * `[?a]`, `[!a]` or `[^a]`.\n * @param c - the cursor\n * @param inner - the position after `[` and its whitespace\n * @returns the token, or null\n */\nfunction boolToken(c: Cursor, inner: number): Token | null {\n const t = c.text;\n const flag = t[inner];\n if (flag !== \"?\" && flag !== \"!\" && flag !== \"^\") {\n return null;\n }\n const n = c.name(c.spaceEnd(inner + 1), true);\n const close = n === null ? -1 : c.spaceEnd(n.end);\n if (n === null || t[close] !== \"]\") {\n return null;\n }\n return checkToken(close + 1, { type: \"bool\", field: cleanMeta(n.raw), op: flag });\n}\n\n/**\n * `[[degree op n]]`.\n * @param c - the cursor\n * @param i - the position of the first `[`\n * @returns the token, or null\n */\nfunction metaToken(c: Cursor, i: number): Token | null {\n const t = c.text;\n const at = c.spaceEnd(i + 2);\n const field = META_FIELDS.find((f) => t.startsWith(f, at));\n const op = field === undefined ? null : c.op(c.spaceEnd(at + field.length));\n if (field === undefined || op === null) {\n return null;\n }\n const numAt = c.spaceEnd(op.end);\n const end = c.numberEnds(numAt).find((x) => {\n const close = c.spaceEnd(x);\n return t[close] === \"]\" && t[close + 1] === \"]\";\n });\n if (end === undefined) {\n return null;\n }\n const value = Number.parseFloat(t.slice(numAt, end));\n const { op: base, not, ci } = splitOp(op.text);\n return checkToken(c.spaceEnd(end) + 2, { type: \"meta\", field, op: base, not, ci, value });\n}\n\n/**\n * Whether a selector is blank: white space only.\n * @param text - the selector\n * @returns true when blank\n */\nfunction isBlank(text: string): boolean {\n return /^\\s*$/.test(text.length > 1024 ? text.slice(0, 1024) : text) && text.trim() === \"\";\n}\n\n/**\n * Parses a selector the way Cytoscape.js does.\n * @param text - the selector\n * @returns the queries and whether Cytoscape.js rejects the selector\n */\nexport function parseCyjsSelector(text: unknown): CyjsSelector {\n // a missing or blank selector matches nothing\n if (typeof text !== \"string\" || isBlank(text)) {\n return { queries: [], invalid: false };\n }\n if (text.length > MAX_SELECTOR_LENGTH) {\n return { queries: [], invalid: true };\n }\n const c = new Cursor(text);\n const first: CyjsQuery = { checks: [] };\n const b: Building = { queries: [first], subject: null, edgeCount: 0, compoundCount: 0, counts: [] };\n let current = first;\n c.pos = c.spaceEnd(0);\n for (;;) {\n const tok = nextToken(c);\n if (tok === null) {\n return { queries: b.queries, invalid: true };\n }\n const next = tok.fill(b, current);\n if (next === false) {\n return { queries: b.queries, invalid: true };\n }\n if (next !== null) {\n current = next;\n }\n c.pos = tok.end;\n if (c.spaceEnd(c.pos) >= text.length) {\n break;\n }\n }\n b.counts.push({ edgeCount: b.edgeCount, compoundCount: b.compoundCount, subject: b.subject });\n // a query may hold one edge or compound relation, not both and not two edges\n const invalid = b.counts.some((k) => (k.compoundCount > 0 && k.edgeCount > 0) || k.edgeCount > 1);\n return { queries: b.queries, invalid };\n}\n","/**\n * A Cytoscape.js stylesheet written as text (`node { background-color: red; } edge[w > 2] { width: 4 }`), read the\n * way Cytoscape.js 3.34's `appendFromString` reads it, in linear passes instead of its backtracking patterns:\n *\n * - comments `/* ... *\\/` holding at least one character are removed first;\n * - each block is the text before the first `{` (the selector) and the text up to the next `}` (the properties);\n * an empty block takes the `}` and runs to the next one;\n * - a block whose selector Cytoscape.js rejects is skipped; text with no further block stops the reading;\n * - each property is `name: value` ending at `;` or at the end of the block, on one line; a property name is\n * taken as written (no camel case), and a block with a property that does not have this shape stops the reading.\n */\n\nimport { parseCyjsSelector } from \"./selector.js\";\n\n/** One block of a stylesheet: its selector and its properties in order. */\nexport interface CyjsSheetEntry {\n /** The selector as written. */\n readonly selector: unknown;\n /** `[name, value]` in order. */\n readonly properties: readonly (readonly [string, unknown])[];\n /** Whether property names are taken as written (text) or camel case is also read (JSON). */\n readonly dashOnly: boolean;\n}\n\n/**\n * Why reading a text stylesheet stopped early, or null.\n * @category Styles\n */\nexport type CyjsSheetStop = \"NO_BLOCK\" | \"BAD_PROPERTY\" | null;\n\n/** Line terminators, which `.` in Cytoscape.js's patterns does not match. */\nconst LINE = /[\\n\\r\\u2028\\u2029]/;\nconst SPACE = /\\s/;\n\n/**\n * Removes the comments Cytoscape.js removes: `/*`, at least one character, `*\\/`.\n * @param text - the stylesheet\n * @returns the text without comments\n */\nfunction stripComments(text: string): string {\n let out = \"\";\n let from = 0;\n for (;;) {\n const open = text.indexOf(\"/*\", from);\n if (open < 0) {\n break;\n }\n const close = text.indexOf(\"*/\", open + 3);\n if (close < 0) {\n break;\n }\n out += text.slice(from, open);\n from = close + 2;\n }\n return out + text.slice(from);\n}\n\n/**\n * The end of a run of whitespace.\n * @param s - the text\n * @param i - the start\n * @returns the first position that is not whitespace\n */\nfunction skipSpace(s: string, i: number): number {\n let j = i;\n while (j < s.length && SPACE.test(s[j])) {\n j++;\n }\n return j;\n}\n\n/**\n * The text with trailing whitespace removed.\n * @param s - the text\n * @returns the text\n */\nfunction trimEnd(s: string): string {\n let e = s.length;\n while (e > 0 && SPACE.test(s[e - 1])) {\n e--;\n }\n return s.slice(0, e);\n}\n\n/**\n * One `name: value` of a block, starting at `from`.\n * @param block - the block's text\n * @param from - where the remaining text starts\n * @param next - for each position, the first position at or after it that is not whitespace\n * @returns the name, the value and where the remaining text starts after it, or null\n */\nfunction readProperty(\n block: string,\n from: number,\n next: Int32Array,\n): { name: string; value: string; end: number } | null {\n const len = block.length;\n const lead = next[from];\n // the name: at least one character on one line, up to the first ':' after it\n const colon = block.indexOf(\":\", lead + 1);\n if (colon < 0) {\n return null;\n }\n const name = trimEnd(block.slice(lead, colon));\n if (name === \"\" || LINE.test(name)) {\n return null;\n }\n // the value: at least one character on one line, ending where only whitespace precedes ';' or the end\n const start = next[colon + 1];\n for (let e = start + 1; e <= len; e++) {\n if (LINE.test(block[e - 1])) {\n break;\n }\n const nn = next[e];\n if (nn >= len) {\n return { name, value: block.slice(start, e), end: len };\n }\n if (block[nn] === \";\") {\n return { name, value: block.slice(start, e), end: nn + 1 };\n }\n }\n // only whitespace after the colon: a whitespace character on the line is the value\n if (start >= len) {\n for (let i = colon + 1; i < len; i++) {\n if (!LINE.test(block[i])) {\n return { name, value: block[i], end: len };\n }\n }\n }\n return null;\n}\n\n/**\n * For each position of a text, the first position at or after it that is not whitespace.\n * @param s - the text\n * @returns the table (length + 1 entries)\n */\nfunction nextNonSpace(s: string): Int32Array {\n const next = new Int32Array(s.length + 1);\n next[s.length] = s.length;\n for (let i = s.length - 1; i >= 0; i--) {\n next[i] = SPACE.test(s[i]) ? next[i + 1] : i;\n }\n return next;\n}\n\n/**\n * Reads a text stylesheet into blocks the way Cytoscape.js does.\n * @param text - the stylesheet\n * @returns the blocks Cytoscape.js keeps, in order, and why reading stopped early (or null)\n */\nexport function parseCyjsStylesheetText(text: string): {\n /** The blocks Cytoscape.js keeps, in order. */\n entries: CyjsSheetEntry[];\n /** Why reading stopped early, or null. */\n stop: CyjsSheetStop;\n} {\n const s = stripComments(text);\n const entries: CyjsSheetEntry[] = [];\n let pos = 0;\n while (skipSpace(s, pos) < s.length) {\n const lead = skipSpace(s, pos);\n // the selector: the text before the first '{' that leaves it at least one character\n let open = s.indexOf(\"{\", lead + 1);\n let selStart = lead;\n if (s[lead] === \"{\") {\n if (lead > pos) {\n // the leading whitespace gives its last character to the selector\n selStart = lead - 1;\n open = lead;\n }\n }\n if (open < 0) {\n return { entries, stop: \"NO_BLOCK\" };\n }\n // the block: at least one character, up to the next '}'\n const close = s.indexOf(\"}\", open + 2);\n if (close < 0) {\n return { entries, stop: \"NO_BLOCK\" };\n }\n const selector = trimEnd(s.slice(selStart, open));\n const block = s.slice(open + 1, close);\n pos = close + 1;\n if (selector !== \"core\" && parseCyjsSelector(selector).invalid) {\n continue;\n }\n const properties = blockProperties(block);\n if (properties === null) {\n return { entries, stop: \"BAD_PROPERTY\" };\n }\n entries.push({ selector, properties, dashOnly: true });\n }\n return { entries, stop: null };\n}\n\n/**\n * The properties of one block, in order.\n * @param block - the text between the braces\n * @returns the name and value of each, or null when one does not read\n */\nfunction blockProperties(block: string): [string, unknown][] | null {\n const properties: [string, unknown][] = [];\n const next = nextNonSpace(block);\n let from = 0;\n while (next[from] < block.length) {\n const p = readProperty(block, from, next);\n if (p === null) {\n return null;\n }\n properties.push([p.name, p.value]);\n from = p.end;\n }\n return properties;\n}\n","/**\n * The Cytoscape.js style engine: a stylesheet applied to the raw element JSON the way Cytoscape.js 3.34 applies it,\n * giving what Cytoscape.js draws for every node and edge, and the stylesheet's rules as neutral rules.\n *\n * - Elements are taken as `cy.add()` takes them: nodes first, ids made text, duplicates and edges to missing nodes\n * dropped, compound parents linked without cycles.\n * - Comparisons read the RAW element data (a field of mixed types is compared with `===`, not as graph-io's column\n * holds it), and a dotted field reads a nested path.\n * - Beneath the file's rules lie Cytoscape.js's own default rules (edges 3px wide, compound parents gray rectangles,\n * selected elements blue); per property the last matching rule wins; a mapper that fails resets the property to\n * its Cytoscape.js default; an element's own `style` is a bypass over every rule.\n * - Every selector is evaluated through indexes (class, id, value) where one test decides, so a sheet of 20,000\n * per-value rules or a selector of 100,000 class tests costs one pass over the elements it names. Every step spends\n * from the extraction's one counted budget.\n *\n * The rules: a selector a short predicate expresses exactly over graph-io's columns becomes that predicate; any other\n * becomes a membership style column (`member.<n>`) with a short `has` test. A run of three or more rules that each\n * test one class, one id or one value of the same field and only set values becomes ONE mapping rule over a winner\n * column. A `data()` or `mapData()` mapper becomes a passthrough or continuous mapping when graph-io's column gives\n * exactly Cytoscape.js's values, else the mapper's per-element values as a style column.\n */\n\nimport type { GraphSnapshot } from \"@graphty/graph-format\";\n\nimport { StyleBudget } from \"../budget.js\";\nimport type { CanonSite } from \"../canon/site.js\";\nimport { STYLE_ISSUE } from \"../codes.js\";\nimport { StyleNotes } from \"../notes.js\";\nimport { canonicalFor, degreeValues, evalContinuous, numberOf, plainCell } from \"../plan/resolve.js\";\nimport type {\n ColumnRef,\n ContinuousPoint,\n ImporterStyles,\n Mapping,\n Predicate,\n ReaderOutput,\n Scalar,\n StyleColumn,\n StyleRule,\n StyleTarget,\n StyleValue,\n StyleWorkBudget,\n} from \"../types.js\";\nimport { CYJS_DEFAULT_STYLESHEET, CYJS_PROPERTY_DEFAULTS } from \"./defaults-table.js\";\nimport { combineFace } from \"./face.js\";\nimport {\n applyCyjsMapper,\n CYJS_CURVE_STYLES,\n CYJS_THROWS,\n cyjsAliasOf,\n cyjsDashLook,\n type CyjsFlat,\n cyjsNeutral,\n type CyjsParsed,\n cyjsPolygonShapes,\n cyjsProperties,\n cyjsPropertyName,\n type CyjsPropertySpec,\n cyjsRendered,\n gradientStopColors,\n gradientStops,\n parseCyjsValue,\n} from \"./mappers.js\";\nimport { cyjsRoute, type CyjsRouteEdge, type CyjsRouteNode } from \"./routes.js\";\nimport { type CyjsCheck, type CyjsQuery, type CyjsSelector, parseCyjsSelector } from \"./selector.js\";\nimport { type CyjsSheetEntry, parseCyjsStylesheetText } from \"./stylesheet-text.js\";\n\n// ============================================================ elements\n\n/** One element as a Cytoscape.js core holds it. */\nexport interface CyjsElement {\n /** The element's JSON as given. */\n readonly json: Readonly<Record<string, unknown>>;\n /** Its `data` object as given. */\n readonly data: Readonly<Record<string, unknown>>;\n /** Fields Cytoscape.js rewrites on add: an id made text or generated, endpoints and parent made text. */\n readonly overrides: ReadonlyMap<string, unknown>;\n /** The id. */\n readonly id: string;\n /** The classes. */\n readonly classes: ReadonlySet<unknown>;\n /** `:selected`. */\n readonly selected: boolean;\n /** `:selectable`. */\n readonly selectable: boolean;\n /** `:locked`. */\n readonly locked: boolean;\n /** `:grabbable`. */\n readonly grabbable: boolean;\n}\n\n/** The elements of a Cytoscape.js core, with their links. */\nexport interface CyjsGraph {\n /** Nodes in the order the core holds them. */\n readonly nodes: readonly CyjsElement[];\n /** Edges in the order the core holds them. */\n readonly edges: readonly CyjsElement[];\n /** Each edge's source node. */\n readonly source: Int32Array;\n /** Each edge's target node. */\n readonly target: Int32Array;\n /** Each node's compound parent, or -1. */\n readonly parent: Int32Array;\n /** Each node's children. */\n readonly children: readonly (readonly number[])[];\n /** Each node's incident edges (a loop once). */\n readonly incident: readonly (readonly number[])[];\n}\n\n/**\n * Whether a value is a plain object (not an array).\n * @param v - the value\n * @returns true for an object\n */\nfunction isObject(v: unknown): v is Record<string, unknown> {\n return v !== null && typeof v === \"object\" && !Array.isArray(v);\n}\n\n/**\n * An id as Cytoscape.js keeps it: a finite number made text, a non-blank string as it is; null when Cytoscape.js\n * refuses it.\n * @param v - the value\n * @returns the id, or null\n */\nfunction idText(v: unknown): string | null {\n if (typeof v === \"number\" && !Number.isNaN(v)) {\n return String(v);\n }\n if (typeof v === \"string\" && v !== \"\" && !/^\\s+$/.test(v)) {\n return v;\n }\n return null;\n}\n\n/**\n * The flags of an element from its JSON.\n * @param json - the element\n * @param edge - whether it is an edge\n * @returns the selection, lock and grab flags\n */\nfunction flags(\n json: Readonly<Record<string, unknown>>,\n edge: boolean,\n): Pick<CyjsElement, \"selected\" | \"selectable\" | \"locked\" | \"grabbable\"> {\n const pannable = json.pannable === undefined ? edge : Boolean(json.pannable);\n const grabbable = json.grabbable === undefined ? true : Boolean(json.grabbable);\n return {\n selected: Boolean(json.selected),\n selectable: json.selectable === undefined ? true : Boolean(json.selectable),\n locked: Boolean(json.locked),\n grabbable: !pannable && grabbable,\n };\n}\n\n/**\n * An element's classes as Cytoscape.js reads them: an array's truthy items, or a string split at whitespace.\n * @param v - the `classes` field\n * @returns the classes\n */\nfunction classSet(v: unknown): Set<unknown> {\n const out = new Set<unknown>();\n let items: unknown[] = [];\n if (Array.isArray(v)) {\n items = v;\n } else if (typeof v === \"string\") {\n items = v.split(/\\s+/);\n }\n for (const c of items) {\n if (c) {\n out.add(c);\n }\n }\n return out;\n}\n\n/**\n * Each node's compound parent, as Cytoscape.js keeps it: a parent naming no node, an edge, or a descendant of the\n * node itself (which would make a cycle) is dropped. Near-linear in the nodes, however deep the hierarchy.\n * @param nodes - the core's nodes, in order; a dropped parent is recorded in their overrides\n * @param ids - the index of each node id (edge ids map to -1)\n * @returns each node's parent index (-1 for none) and each node's children\n */\nfunction parentsOf(\n nodes: readonly CyjsElement[],\n ids: ReadonlyMap<string, number>,\n): { parent: Int32Array; children: number[][] } {\n const parent = new Int32Array(nodes.length).fill(-1);\n const children: number[][] = nodes.map(() => []);\n // root[x] leads to the root of x's parent chain; paths are halved as they are walked\n const root = Int32Array.from(nodes, (_n, i) => i);\n const rootOf = (x: number): number => {\n while (root[x] !== x) {\n root[x] = root[root[x]];\n x = root[x];\n }\n return x;\n };\n for (let i = 0; i < nodes.length; i++) {\n const raw = nodes[i].data.parent;\n if (raw === undefined || raw === null) {\n continue;\n }\n const text = typeof raw === \"number\" && !Number.isNaN(raw) ? String(raw) : raw;\n const p = typeof text === \"string\" ? ids.get(text) : undefined;\n if (p === undefined || p < 0) {\n (nodes[i].overrides as Map<string, unknown>).set(\"parent\", undefined);\n continue;\n }\n if (typeof raw === \"number\") {\n (nodes[i].overrides as Map<string, unknown>).set(\"parent\", text);\n }\n // a node never becomes its own ancestor: node i has no parent yet, so it is an ancestor of p exactly when it\n // is the root of p's chain, found in near-constant time through the union-find roots\n if (rootOf(p) === i) {\n (nodes[i].overrides as Map<string, unknown>).set(\"parent\", undefined);\n continue;\n }\n parent[i] = p;\n root[i] = p;\n children[p].push(i);\n }\n return { parent, children };\n}\n\n/**\n * The elements a Cytoscape.js core holds after `cy.add(elements)`.\n * @param elements - an array of element JSON, or `{ nodes, edges }`\n * @returns the elements and their links\n */\nexport function cyjsGraph(elements: unknown): CyjsGraph {\n const { nodeJson, edgeJson } = elementGroups(elements);\n const ids = new Map<string, number>();\n const make = elementMaker(ids);\n const nodes: CyjsElement[] = [];\n for (const json of nodeJson) {\n const e = make(json, false, new Map());\n if (e !== null) {\n ids.set(e.id, nodes.length);\n nodes.push(e);\n }\n }\n const edges: CyjsElement[] = [];\n const src: number[] = [];\n const tgt: number[] = [];\n const edgeIds = new Set<string>();\n for (const json of edgeJson) {\n const overrides = new Map<string, unknown>();\n const e = make(json, true, overrides);\n const ends = e === null || edgeIds.has(e.id) ? null : edgeEnds(e, ids, overrides);\n if (e !== null && ends !== null) {\n edgeIds.add(e.id);\n edges.push(e);\n src.push(ends[0]);\n tgt.push(ends[1]);\n }\n }\n for (const id of edgeIds) {\n ids.set(id, -1);\n }\n const { parent, children } = parentsOf(nodes, ids);\n const incident: number[][] = nodes.map(() => []);\n for (let e = 0; e < edges.length; e++) {\n incident[src[e]].push(e);\n if (src[e] !== tgt[e]) {\n incident[tgt[e]].push(e);\n }\n }\n return {\n nodes,\n edges,\n source: Int32Array.from(src),\n target: Int32Array.from(tgt),\n parent,\n children,\n incident,\n };\n}\n\n/**\n * The node and edge JSON of `cy.add(elements)`: an array's items by their `group`, else an edge when they name a\n * source and a target; a `{ nodes, edges }` object's by where they are.\n * @param elements - an array of element JSON, or `{ nodes, edges }`\n * @returns the node and edge JSON, in order\n */\nfunction elementGroups(elements: unknown): {\n nodeJson: Record<string, unknown>[];\n edgeJson: Record<string, unknown>[];\n} {\n const nodeJson: Record<string, unknown>[] = [];\n const edgeJson: Record<string, unknown>[] = [];\n const take = (item: unknown, group: unknown): void => {\n const g = groupOf(item, group);\n if (g === \"nodes\") {\n nodeJson.push(item as Record<string, unknown>);\n } else if (g === \"edges\") {\n edgeJson.push(item as Record<string, unknown>);\n }\n };\n if (Array.isArray(elements)) {\n for (const item of elements) {\n take(item, undefined);\n }\n } else if (isObject(elements)) {\n for (const item of Array.isArray(elements.nodes) ? elements.nodes : []) {\n take(item, \"nodes\");\n }\n for (const item of Array.isArray(elements.edges) ? elements.edges : []) {\n take(item, \"edges\");\n }\n }\n return { nodeJson, edgeJson };\n}\n\n/**\n * The group an element JSON is added to: the one its place gives, else its own `group`, else an edge when its data\n * names a source and a target.\n * @param item - the element JSON\n * @param group - the group its place gives, or undefined\n * @returns the group, or undefined for no element\n */\nfunction groupOf(item: unknown, group: unknown): unknown {\n if (!isObject(item)) {\n return undefined;\n }\n const data = item.data ?? {};\n if (!isObject(data)) {\n return undefined;\n }\n const given = group ?? item.group;\n if (given !== undefined && given !== null) {\n return given;\n }\n const ends = data.source !== undefined && data.source !== null && data.target !== undefined && data.target !== null;\n return ends ? \"edges\" : \"nodes\";\n}\n\n/**\n * Makes the elements of one core: an element without an id gets a generated one; one whose id is taken or not an id\n * is dropped.\n * @param ids - the ids taken so far, by node index\n * @returns the maker: the element of a JSON, or null when it is dropped\n */\nfunction elementMaker(\n ids: ReadonlyMap<string, number>,\n): (json: Record<string, unknown>, edge: boolean, overrides: Map<string, unknown>) => CyjsElement | null {\n let generated = 0;\n return (json, edge, overrides) => {\n const data = isObject(json.data) ? json.data : {};\n let id: string | null;\n if (data.id === undefined) {\n id = `${String.fromCodePoint(0)}generated-${String(generated++)}`;\n overrides.set(\"id\", id);\n } else {\n id = idText(data.id);\n if (id === null || ids.has(id)) {\n return null;\n }\n if (typeof data.id === \"number\") {\n overrides.set(\"id\", id);\n }\n }\n return { json, data, overrides, id, classes: classSet(json.classes), ...flags(json, edge) };\n };\n}\n\n/**\n * An edge's source and target nodes; a number endpoint is read as its text.\n * @param e - the edge\n * @param ids - the node ids\n * @param overrides - the edge's data as Cytoscape.js rewrites it\n * @returns the two node indexes, or null when an endpoint names no node\n */\nfunction edgeEnds(\n e: CyjsElement,\n ids: ReadonlyMap<string, number>,\n overrides: Map<string, unknown>,\n): [number, number] | null {\n const ends: number[] = [];\n for (const field of [\"source\", \"target\"] as const) {\n const raw = e.data[field];\n const text = typeof raw === \"number\" && !Number.isNaN(raw) ? String(raw) : raw;\n if (typeof raw === \"number\") {\n overrides.set(field, text);\n }\n const at = typeof text === \"string\" ? ids.get(text) : undefined;\n if (at !== undefined) {\n ends.push(at);\n }\n }\n return ends.length === 2 ? [ends[0], ends[1]] : null;\n}\n\n/**\n * A data field as a selector reads it (`ele.data(field)`): the field itself, else a dotted path walked step by step.\n * @param e - the element\n * @param field - the field\n * @returns the value, or undefined\n */\nfunction selectorField(e: CyjsElement, field: string): unknown {\n if (e.overrides.has(field)) {\n return e.overrides.get(field);\n }\n const direct = e.data[field];\n if (direct !== undefined || !field.includes(\".\")) {\n return direct;\n }\n let v: unknown = e.data;\n const path = field.split(\".\");\n let k = 0;\n while (v !== null && v !== undefined && k < path.length) {\n v = (v as Record<string, unknown>)[path[k++]];\n }\n return k === path.length ? v : undefined;\n}\n\n/**\n * An element's data as a mapper reads it, with Cytoscape.js's rewrites of id, endpoints and parent.\n * @param e - the element\n * @returns an object to read fields from\n */\nfunction mapperData(e: CyjsElement): unknown {\n if (e.overrides.size === 0) {\n return e.data;\n }\n return new Proxy(e.data, {\n get: (target, key) =>\n typeof key === \"string\" && e.overrides.has(key)\n ? e.overrides.get(key)\n : (target as Record<string | symbol, unknown>)[key],\n });\n}\n\n// ============================================================ the stylesheet\n\n/** One stylesheet entry ready to apply. */\ninterface Entry {\n /** The position in the sheet (default rules first, negative). */\n readonly index: number;\n /** Cytoscape.js's own default rule. */\n readonly tool: boolean;\n /** The selector as written. */\n readonly text: string;\n readonly selector: CyjsSelector;\n readonly properties: readonly (readonly [string, unknown])[];\n readonly dashOnly: boolean;\n}\n\n/**\n * The entries of a stylesheet given as JSON (an array of `{ selector, style }`) or as text.\n * @param style - the stylesheet\n * @param notes - where problems are noted\n * @returns the entries in order\n */\nfunction sheetEntries(style: unknown, notes: StyleNotes): CyjsSheetEntry[] {\n if (typeof style === \"string\") {\n const { entries, stop } = parseCyjsStylesheetText(style);\n if (stop !== null) {\n notes.add(STYLE_ISSUE.UNREADABLE, null, \"stylesheet\", { sample: stop });\n }\n return entries;\n }\n if (!Array.isArray(style)) {\n return [];\n }\n const out: CyjsSheetEntry[] = [];\n for (const item of style) {\n if (!isObject(item)) {\n continue;\n }\n const props = item.style ?? item.css;\n const properties: [string, unknown][] = [];\n if (isObject(props)) {\n for (const name of Object.keys(props)) {\n properties.push([name, props[name]]);\n }\n }\n out.push({ selector: item.selector, properties, dashOnly: false });\n }\n return out;\n}\n\n// ============================================================ matching\n\n/** The most nested combinators a selector may hold before it is noted and matched to nothing. */\nconst MAX_SELECTOR_NESTING = 64;\n\n/**\n * How deep a query nests.\n * @param q - the query\n * @param depth - the depth so far\n * @returns the depth, capped just above the limit\n */\nfunction nesting(q: CyjsQuery, depth = 0): number {\n if (depth > MAX_SELECTOR_NESTING) {\n return depth;\n }\n let max = depth;\n for (const c of q.checks) {\n for (const sub of subQueries(c)) {\n max = Math.max(max, nesting(sub, depth + 1));\n if (max > MAX_SELECTOR_NESTING) {\n return max;\n }\n }\n }\n return max;\n}\n\n/**\n * The queries a check holds.\n * @param c - the check\n * @returns its sub-queries\n */\nfunction subQueries(c: CyjsCheck): CyjsQuery[] {\n switch (c.type) {\n case \"child\":\n case \"parent\":\n return [c.parent, c.child];\n case \"descendant\":\n case \"ancestor\":\n return [c.ancestor, c.descendant];\n case \"split\":\n return [c.left, c.right, c.subject];\n case \"directedEdge\":\n case \"nodeSource\":\n case \"nodeTarget\":\n return [c.source, c.target];\n case \"undirectedEdge\":\n return [c.nodes[0], c.nodes[1]];\n case \"nodeNeighbor\":\n return [c.node, c.neighbor];\n default:\n return [];\n }\n}\n\n/**\n * Cytoscape.js's comparison of a field with a selector's value.\n * @param field - the element's value\n * @param op - the base operator\n * @param not - the `!` flag\n * @param ci - the `@` flag\n * @param value - the selector's value\n * @returns whether it matches\n */\nfunction valCmp(field: unknown, op: string, not: boolean, ci: boolean, value: string | number): boolean {\n let a: unknown = field;\n let b: unknown = value;\n const isFieldStr = typeof field === \"string\";\n const isFieldNum = typeof field === \"number\" && !Number.isNaN(field);\n let fs: string | null = null;\n let vs: string | null = null;\n if (isFieldStr || typeof value === \"string\" || ci) {\n fs = !isFieldStr && !isFieldNum ? \"\" : String(field);\n vs = String(value);\n }\n if (ci && fs !== null && vs !== null) {\n fs = fs.toLowerCase();\n vs = vs.toLowerCase();\n a = fs;\n b = vs;\n }\n let m = false;\n let ineq = false;\n switch (op) {\n case \"*=\":\n m = fs !== null && vs !== null && fs.includes(vs);\n break;\n case \"$=\":\n m = fs !== null && vs !== null && fs.endsWith(vs);\n break;\n case \"^=\":\n m = fs !== null && vs !== null && fs.startsWith(vs);\n break;\n case \"=\":\n m = a === b;\n break;\n case \">\":\n ineq = true;\n m = (a as number) > (b as number);\n break;\n case \">=\":\n ineq = true;\n m = (a as number) >= (b as number);\n break;\n case \"<\":\n ineq = true;\n m = (a as number) < (b as number);\n break;\n case \"<=\":\n ineq = true;\n m = (a as number) <= (b as number);\n break;\n default:\n break;\n }\n if (not && ((field !== null && field !== undefined) || !ineq)) {\n m = !m;\n }\n return m;\n}\n\n/** The checks of an element's place in the graph: its parents, children and edges. */\nconst STRUCTURE_CHECKS: ReadonlySet<string> = new Set([\n \"child\",\n \"parent\",\n \"descendant\",\n \"ancestor\",\n \"split\",\n \"directedEdge\",\n \"undirectedEdge\",\n \"nodeSource\",\n \"nodeTarget\",\n \"nodeNeighbor\",\n]);\n\n/** States whose value changes while Cytoscape.js runs; they are evaluated as at load and noted. */\nconst RUNTIME_STATES: ReadonlySet<string> = new Set([\n \"active\",\n \"inactive\",\n \"grabbed\",\n \"free\",\n \"animated\",\n \"unanimated\",\n \"visible\",\n \"hidden\",\n \"transparent\",\n \"backgrounding\",\n \"nonbackgrounding\",\n]);\n\n/** Thrown inside a selector match when the counted budget runs out partway through it. */\nclass BudgetStop extends Error {}\n\n/** How many units of work a match does between checks of the budget and the signal. */\nconst CHECK_EVERY = 4096;\n\n/** Evaluates selectors over one graph. */\nclass Matcher {\n readonly degree: Int32Array;\n readonly indegree: Int32Array;\n readonly outdegree: Int32Array;\n work = 0;\n /** Where the work is charged while a match runs; null between matches. */\n #charge: { kind: StyleTarget; budget: StyleWorkBudget; signal?: AbortSignal } | null = null;\n #charged = 0;\n /**\n * The answers of nested sub-queries for one match, per element: 0 unknown, 1 true, 2 false. Each sub-query is\n * then evaluated at most once per element, so a nested compound selector costs polynomial, not exponential, time.\n */\n readonly #memo = { node: new Map<CyjsQuery, Uint8Array>(), edge: new Map<CyjsQuery, Uint8Array>() };\n\n constructor(\n readonly g: CyjsGraph,\n readonly notes: StyleNotes,\n ) {\n const n = g.nodes.length;\n this.degree = new Int32Array(n);\n this.indegree = new Int32Array(n);\n this.outdegree = new Int32Array(n);\n for (let e = 0; e < g.edges.length; e++) {\n const s = g.source[e];\n const t = g.target[e];\n this.degree[s] += s === t ? 2 : 1;\n if (s !== t) {\n this.degree[t]++;\n }\n this.outdegree[s]++;\n this.indegree[t]++;\n }\n }\n\n /**\n * Whether an element matches a query.\n * @param q - the query\n * @param kind - the element's kind\n * @param i - the element\n * @returns true when every check matches\n */\n query(q: CyjsQuery, kind: StyleTarget, i: number): boolean {\n for (const c of q.checks) {\n this.work++;\n if (this.#charge !== null && this.work - this.#charged >= CHECK_EVERY) {\n this.settle();\n }\n if (!this.check(c, kind, i)) {\n return false;\n }\n }\n return true;\n }\n\n /**\n * Starts one selector match: its work is charged to the budget as it runs, and the sub-query answers are fresh.\n * @param kind - the target the work is charged to\n * @param budget - the counted budget\n * @param signal - cancels the match\n */\n begin(kind: StyleTarget, budget: StyleWorkBudget, signal?: AbortSignal): void {\n this.#charge = { kind, budget, signal };\n this.#charged = this.work;\n this.#memo.node.clear();\n this.#memo.edge.clear();\n }\n\n /** Ends a match: its remaining work is charged (never throwing) and its sub-query answers are dropped. */\n end(): void {\n const charge = this.#charge;\n this.#charge = null;\n charge?.budget.spend(charge.kind, this.work - this.#charged);\n this.#charged = this.work;\n this.#memo.node.clear();\n this.#memo.edge.clear();\n }\n\n /**\n * Charges the work done since the last charge; throws BudgetStop once the budget is exhausted.\n * @throws BudgetStop - when the target's budget is exhausted\n */\n settle(): void {\n const charge = this.#charge;\n if (charge === null) {\n return;\n }\n charge.budget.spend(charge.kind, this.work - this.#charged);\n this.#charged = this.work;\n charge.signal?.throwIfAborted();\n if (charge.budget.exhausted(charge.kind)) {\n throw new BudgetStop();\n }\n }\n\n /**\n * Whether an element matches a nested sub-query, remembered for the rest of the match.\n * @param q - the sub-query\n * @param kind - the element's kind\n * @param i - the element\n * @returns true when every check matches\n */\n sub(q: CyjsQuery, kind: StyleTarget, i: number): boolean {\n const memo = this.#memo[kind];\n let seen = memo.get(q);\n if (seen === undefined) {\n seen = new Uint8Array(kind === \"node\" ? this.g.nodes.length : this.g.edges.length);\n memo.set(q, seen);\n }\n if (seen[i] !== 0) {\n return seen[i] === 1;\n }\n const m = this.query(q, kind, i);\n seen[i] = m ? 1 : 2;\n return m;\n }\n\n /**\n * Whether an element matches one check.\n * @param c - the check\n * @param kind - the element's kind\n * @param i - the element\n * @returns true when it matches\n */\n check(c: CyjsCheck, kind: StyleTarget, i: number): boolean {\n return STRUCTURE_CHECKS.has(c.type) ? this.structureCheck(c, kind, i) : this.elementCheck(c, kind, i);\n }\n\n /**\n * Whether an element matches a check of its own: its group, state, id, classes or data.\n * @param c - the check\n * @param kind - the element's kind\n * @param i - the element\n * @returns true when it matches\n */\n private elementCheck(c: CyjsCheck, kind: StyleTarget, i: number): boolean {\n const { g } = this;\n const e = kind === \"node\" ? g.nodes[i] : g.edges[i];\n switch (c.type) {\n case \"group\":\n return c.value === \"*\" || c.value === `${kind}s`;\n case \"state\":\n return this.state(c.value, kind, i, e);\n case \"id\":\n return e.id === c.value;\n case \"class\":\n return e.classes.has(c.value);\n case \"exist\":\n return selectorField(e, c.field) !== undefined;\n case \"bool\": {\n const v = selectorField(e, c.field);\n if (c.op === \"?\") {\n return Boolean(v);\n }\n return c.op === \"!\" ? !v : v === undefined;\n }\n case \"compare\":\n return valCmp(selectorField(e, c.field), c.op, c.not, c.ci, c.value);\n case \"meta\": {\n const v = kind === \"node\" ? this[c.field][i] : undefined;\n return valCmp(v, c.op, c.not, c.ci, c.value);\n }\n case \"true\":\n return true;\n default:\n return false;\n }\n }\n\n /**\n * Whether an element matches a check of its place in the graph: its parents, children and edges.\n * @param c - the check\n * @param kind - the element's kind\n * @param i - the element\n * @returns true when it matches\n */\n private structureCheck(c: CyjsCheck, kind: StyleTarget, i: number): boolean {\n const { g } = this;\n switch (c.type) {\n case \"child\":\n return (\n this.sub(c.child, kind, i) &&\n kind === \"node\" &&\n g.parent[i] >= 0 &&\n this.sub(c.parent, \"node\", g.parent[i])\n );\n case \"parent\":\n return (\n this.sub(c.parent, kind, i) &&\n kind === \"node\" &&\n g.children[i].some((k) => this.sub(c.child, \"node\", k))\n );\n case \"descendant\":\n return this.sub(c.descendant, kind, i) && kind === \"node\" && this.someAncestor(i, c.ancestor);\n case \"ancestor\":\n return this.sub(c.ancestor, kind, i) && kind === \"node\" && this.someDescendant(i, c.descendant);\n case \"split\":\n return this.sub(c.subject, kind, i) && this.sub(c.left, kind, i) && this.sub(c.right, kind, i);\n case \"directedEdge\":\n return (\n kind === \"edge\" &&\n this.sub(c.source, \"node\", g.source[i]) &&\n this.sub(c.target, \"node\", g.target[i])\n );\n case \"undirectedEdge\": {\n if (kind !== \"edge\") {\n return false;\n }\n const [a, b] = c.nodes;\n const s = g.source[i];\n const t = g.target[i];\n return (\n (this.sub(a, \"node\", s) && this.sub(b, \"node\", t)) ||\n (this.sub(b, \"node\", s) && this.sub(a, \"node\", t))\n );\n }\n case \"nodeSource\":\n return (\n kind === \"node\" &&\n this.sub(c.source, kind, i) &&\n g.incident[i].some((ed) => g.source[ed] === i && this.sub(c.target, \"node\", g.target[ed]))\n );\n case \"nodeTarget\":\n return (\n kind === \"node\" &&\n this.sub(c.target, kind, i) &&\n g.incident[i].some((ed) => g.target[ed] === i && this.sub(c.source, \"node\", g.source[ed]))\n );\n case \"nodeNeighbor\":\n return (\n kind === \"node\" &&\n this.sub(c.node, kind, i) &&\n g.incident[i].some((ed) => {\n const other = g.source[ed] === i ? g.target[ed] : g.source[ed];\n return this.sub(c.neighbor, \"node\", other);\n })\n );\n default:\n return false;\n }\n }\n\n /**\n * Whether an ancestor of a node matches a query (cycle-safe: parents never form a cycle).\n * @param i - the node\n * @param q - the query\n * @returns true when one does\n */\n someAncestor(i: number, q: CyjsQuery): boolean {\n for (let a = this.g.parent[i]; a >= 0; a = this.g.parent[a]) {\n if (this.sub(q, \"node\", a)) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * Whether a descendant of a node matches a query, walked without recursion.\n * @param i - the node\n * @param q - the query\n * @returns true when one does\n */\n someDescendant(i: number, q: CyjsQuery): boolean {\n const stack = [...this.g.children[i]];\n while (stack.length > 0) {\n const k = stack.pop() as number;\n if (this.sub(q, \"node\", k)) {\n return true;\n }\n for (const c of this.g.children[k]) {\n stack.push(c);\n }\n }\n return false;\n }\n\n /**\n * A state selector, evaluated as at load.\n * @param s - the state\n * @param kind - the element's kind\n * @param i - the element\n * @param e - the element\n * @returns whether the element is in the state\n */\n state(s: string, kind: StyleTarget, i: number, e: CyjsElement): boolean {\n const { g } = this;\n if (RUNTIME_STATES.has(s)) {\n this.notes.add(STYLE_ISSUE.STATE_ASSUMED, kind, `:${s}`, { sample: `:${s}` });\n }\n const node = kind === \"node\";\n switch (s) {\n case \"selected\":\n return e.selected;\n case \"unselected\":\n return !e.selected;\n case \"selectable\":\n return e.selectable;\n case \"unselectable\":\n return !e.selectable;\n case \"locked\":\n return e.locked;\n case \"unlocked\":\n return !e.locked;\n case \"grabbable\":\n return e.grabbable;\n case \"ungrabbable\":\n return !e.grabbable;\n case \"free\":\n case \"inside\":\n case \"unanimated\":\n case \"inactive\":\n case \"nonbackgrounding\":\n case \"visible\":\n return true;\n case \"parent\":\n return node && g.children[i].length > 0;\n case \"childless\":\n return node && g.children[i].length === 0;\n case \"child\":\n case \"nonorphan\":\n return node && g.parent[i] >= 0;\n case \"orphan\":\n return node && g.parent[i] < 0;\n case \"compound\":\n return node\n ? g.children[i].length > 0\n : g.children[g.source[i]].length > 0 || g.children[g.target[i]].length > 0;\n case \"loop\":\n return !node && g.source[i] === g.target[i];\n case \"simple\":\n return !node && g.source[i] !== g.target[i];\n default:\n return false;\n }\n }\n}\n\n/** Indexes of one target's elements: by class, by id, and by value per field (built on first use). */\nclass Indexes {\n readonly byClass = new Map<unknown, number[]>();\n readonly byId = new Map<string, number>();\n readonly byValue = new Map<string, Map<string, number[]>>();\n /** Per element, the stamp of the last selector that matched it. */\n readonly marks: Int32Array;\n /** The last stamp handed out. */\n stamp = 0;\n\n constructor(\n readonly elements: readonly CyjsElement[],\n readonly spend: (ops: number) => void,\n ) {\n this.marks = new Int32Array(elements.length);\n for (let i = 0; i < elements.length; i++) {\n for (const c of elements[i].classes) {\n let list = this.byClass.get(c);\n if (list === undefined) {\n list = [];\n this.byClass.set(c, list);\n }\n list.push(i);\n }\n if (!this.byId.has(elements[i].id)) {\n this.byId.set(elements[i].id, i);\n }\n }\n spend(elements.length);\n }\n\n /**\n * The elements whose field is `===` a value.\n * @param field - the field\n * @param value - the value\n * @returns the element indexes\n */\n equal(field: string, value: string | number): readonly number[] {\n let m = this.byValue.get(field);\n if (m === undefined) {\n m = new Map();\n for (let i = 0; i < this.elements.length; i++) {\n const v = selectorField(this.elements[i], field);\n if (typeof v !== \"string\" && typeof v !== \"number\") {\n continue;\n }\n const k = `${typeof v}:${String(v)}`;\n let list = m.get(k);\n if (list === undefined) {\n list = [];\n m.set(k, list);\n }\n list.push(i);\n }\n this.byValue.set(field, m);\n this.spend(this.elements.length);\n }\n if (typeof value === \"number\" && Number.isNaN(value)) {\n return [];\n }\n return m.get(`${typeof value}:${String(value)}`) ?? [];\n }\n}\n\n/**\n * The candidates of one query for a target: the element list of its most selective indexed check, or null when\n * every element must be tested.\n * @param q - the query\n * @param kind - the target\n * @param ix - the target's indexes\n * @returns the candidates, or null\n */\nfunction candidates(q: CyjsQuery, kind: StyleTarget, ix: Indexes): readonly number[] | null {\n let best: readonly number[] | null = null;\n for (const c of q.checks) {\n let list: readonly number[] | null = null;\n if (c.type === \"group\" && c.value !== \"*\" && c.value !== `${kind}s`) {\n return [];\n }\n if (c.type === \"class\") {\n list = ix.byClass.get(c.value) ?? [];\n } else if (c.type === \"id\") {\n const at = ix.byId.get(c.value);\n list = at === undefined ? [] : [at];\n } else if (c.type === \"compare\" && c.op === \"=\" && !c.not && !c.ci) {\n list = ix.equal(c.field, c.value);\n }\n if (list !== null && (best === null || list.length < best.length)) {\n best = list;\n }\n }\n return best;\n}\n\n// ============================================================ the engine\n\n/** A cell of the cascade: a flat value, a failed mapper (the default), or a value Cytoscape.js cannot draw. */\ntype Cell = CyjsFlat | \"reset\" | \"fn\" | typeof CYJS_THROWS;\n\n/** One property of one entry, parsed. */\ninterface EntryProperty {\n readonly name: string;\n readonly spec: CyjsPropertySpec;\n readonly parsed: CyjsParsed;\n}\n\n/** One target's result. */\nexport interface CyjsTargetStyles {\n /** The element count (in snapshot order when a snapshot was given). */\n readonly n: number;\n /** What Cytoscape.js draws, per neutral property, by element index. */\n readonly values: Partial<Record<string, StyleColumn>>;\n /** The stylesheet's rules, bottom to top. */\n readonly rules: StyleRule[];\n /** The style columns the rules read. */\n readonly columns: Map<string, StyleColumn>;\n /** The data columns the rules or the values were read from. */\n readonly rawColumns: string[];\n /** Each element's Cytoscape.js element, by index (null where the core holds none). */\n readonly elements: readonly (CyjsElement | null)[];\n}\n\n/** The input of the engine. */\nexport interface CyjsStyleInput {\n /** The elements: an array of element JSON, or `{ nodes, edges }`. */\n readonly elements: unknown;\n /** The stylesheet: an array of `{ selector, style }` (or `css`), or a stylesheet written as text. */\n readonly style: unknown;\n /**\n * The graph the styles are for. Elements are matched to its nodes by id and to its edges in order, and the\n * values come out indexed like it; its columns let a selector or a mapper become a predicate or a mapping over\n * graph-io's columns. Without it, values are indexed like the core holds the elements.\n */\n readonly snapshot?: GraphSnapshot;\n /** Whether Cytoscape.js's own default rules (edges 3px wide, gray compound parents) are applied; default true. */\n readonly toolDefaults?: boolean;\n /**\n * What a live core draws, per element JSON object (`ele.style()` beside `ele.json()`): taken as the truth over what\n * the stylesheet gives, and the only source for a property whose stylesheet value is a function.\n */\n readonly rendered?: ReadonlyMap<object, Readonly<Record<string, unknown>>>;\n /** Where problems are noted. */\n readonly notes?: StyleNotes;\n /** The counted work budget. */\n readonly budget?: StyleWorkBudget;\n /** Cancels the work. */\n readonly signal?: AbortSignal;\n}\n\n/** The engine's result. */\nexport interface CyjsStyles {\n /** Nodes. */\n readonly node: CyjsTargetStyles;\n /** Edges. */\n readonly edge: CyjsTargetStyles;\n /** The elements as the core holds them. */\n readonly graph: CyjsGraph;\n}\n\nconst POSITIONS: ReadonlyMap<string, string> = new Map([\n [\"top,left\", \"top-left\"],\n [\"top,center\", \"top\"],\n [\"top,right\", \"top-right\"],\n [\"center,left\", \"left\"],\n [\"center,center\", \"center\"],\n [\"center,right\", \"right\"],\n [\"bottom,left\", \"bottom-left\"],\n [\"bottom,center\", \"bottom\"],\n [\"bottom,right\", \"bottom-right\"],\n]);\n\n/** The positions inside the node, by the sides the `-inside` alignments name (`center` for neither). */\nconst INSIDE_POSITIONS: ReadonlyMap<string, string> = new Map([\n [\"top,left\", \"inside-top-left\"],\n [\"top,center\", \"inside-top\"],\n [\"top,right\", \"inside-top-right\"],\n [\"center,left\", \"inside-left\"],\n [\"center,right\", \"inside-right\"],\n [\"bottom,left\", \"inside-bottom-left\"],\n [\"bottom,center\", \"inside-bottom\"],\n [\"bottom,right\", \"inside-bottom-right\"],\n]);\n\n/**\n * Applies a Cytoscape.js stylesheet to its elements as Cytoscape.js 3.34 does.\n * @param input - the elements, the stylesheet, the graph and the options\n * @returns what is drawn per element and the stylesheet's rules, per target\n */\nexport function evaluateCytoscapeJs(input: CyjsStyleInput): CyjsStyles {\n const notes = input.notes ?? new StyleNotes();\n const budget = input.budget ?? new StyleBudget();\n const graph = cyjsGraph(input.elements);\n const sheet: Entry[] = [];\n if (input.toolDefaults !== false) {\n CYJS_DEFAULT_STYLESHEET.forEach((d, k) => {\n sheet.push({\n index: k - CYJS_DEFAULT_STYLESHEET.length,\n tool: true,\n text: d.selector,\n selector: parseCyjsSelector(d.selector),\n properties: Object.entries(d.style),\n dashOnly: true,\n });\n });\n }\n const raw = sheetEntries(input.style, notes);\n let invalid = 0;\n let deep = 0;\n raw.forEach((r, k) => {\n let selector = parseCyjsSelector(r.selector);\n if (selector.invalid) {\n invalid++;\n }\n if (selector.queries.some((q) => nesting(q) > MAX_SELECTOR_NESTING)) {\n deep++;\n selector = { queries: [], invalid: true };\n }\n sheet.push({\n index: k,\n tool: false,\n text: typeof r.selector === \"string\" ? r.selector : \"\",\n selector,\n properties: r.properties,\n dashOnly: r.dashOnly,\n });\n });\n if (invalid > 0) {\n notes.add(STYLE_ISSUE.SELECTOR, null, \"selector\", { count: invalid, sample: \"invalid\" });\n }\n if (deep > 0) {\n notes.add(STYLE_ISSUE.SELECTOR, null, \"selector\", { count: deep, sample: \"nested too deep\" });\n }\n const matcher = new Matcher(graph, notes);\n const node = evaluateTarget(\"node\", graph, sheet, matcher, input, { notes, budget, nodes: null });\n const edge = evaluateTarget(\"edge\", graph, sheet, matcher, input, { notes, budget, nodes: node });\n return { node, edge, graph };\n}\n\n/**\n * The order of the output: for each output index, the core's element (or -1).\n * @param kind - the target\n * @param graph - the core's elements\n * @param snapshot - the graph, when given\n * @param notes - where problems are noted\n * @returns the core element of each output index\n */\nfunction outputOrder(\n kind: StyleTarget,\n graph: CyjsGraph,\n snapshot: GraphSnapshot | undefined,\n notes: StyleNotes,\n): Int32Array {\n const els = kind === \"node\" ? graph.nodes : graph.edges;\n if (snapshot === undefined) {\n return Int32Array.from(els, (_e, i) => i);\n }\n if (kind === \"node\") {\n const order = new Int32Array(snapshot.nodeCount).fill(-1);\n for (let i = 0; i < els.length; i++) {\n const at = snapshotIndex(snapshot, els[i].id);\n if (at >= 0 && order[at] < 0) {\n order[at] = i;\n }\n }\n return order;\n }\n const order = new Int32Array(snapshot.edgeCount).fill(-1);\n const nodeAt = outputOrder(\"node\", graph, snapshot, notes);\n const coreToSnap = new Int32Array(graph.nodes.length).fill(-1);\n nodeAt.forEach((c, s) => {\n if (c >= 0) {\n coreToSnap[c] = s;\n }\n });\n let j = 0;\n for (let e = 0; e < els.length && j < snapshot.edgeCount; e++) {\n if (\n coreToSnap[graph.source[e]] === snapshot.edgeSource(j) &&\n coreToSnap[graph.target[e]] === snapshot.edgeTarget(j)\n ) {\n order[j++] = e;\n }\n }\n if (j < snapshot.edgeCount) {\n notes.add(STYLE_ISSUE.UNRESOLVED, \"edge\", \"elements\", { count: snapshot.edgeCount - j, sample: \"edge order\" });\n }\n return order;\n}\n\n/**\n * A node's index in the graph by its Cytoscape.js id (text), trying the id as a number too.\n * @param snapshot - the graph\n * @param id - the id\n * @returns the index, or -1\n */\nfunction snapshotIndex(snapshot: GraphSnapshot, id: string): number {\n if (snapshot.ids.has(id)) {\n return snapshot.ids.indexOf(id);\n }\n const n = Number(id);\n return id.trim() !== \"\" && Number.isFinite(n) && snapshot.ids.has(n) ? snapshot.ids.indexOf(n) : -1;\n}\n\n/** The cascade's winning cells, per Cytoscape.js property, by core element. */\ntype Cells = Map<string, (Cell | undefined)[]>;\n\n/** One entry applied to a target: its elements and its parsed properties. */\ninterface Applied {\n readonly entry: Entry;\n readonly list: readonly number[];\n readonly props: EntryProperty[];\n}\n\n/**\n * A property's cells, created on first use.\n * @param cells - the cells\n * @param name - the Cytoscape.js property\n * @param n - the element count\n * @returns the property's cells\n */\nfunction cellsOf(cells: Cells, name: string, n: number): (Cell | undefined)[] {\n let c = cells.get(name);\n if (c === undefined) {\n c = new Array<Cell | undefined>(n);\n cells.set(name, c);\n }\n return c;\n}\n\n/**\n * Applies the sheet to one target.\n * @param kind - nodes or edges\n * @param graph - the core's elements\n * @param sheet - the entries\n * @param matcher - the selector evaluator\n * @param input - the input\n * @param env - where problems are noted, the counted budget, and for edges the nodes' values\n * @param env.notes - where problems are noted\n * @param env.budget - the counted budget\n * @param env.nodes - the nodes' values, which edge routes are measured against (null for nodes)\n * @returns the target's values and rules\n */\nfunction evaluateTarget(\n kind: StyleTarget,\n graph: CyjsGraph,\n sheet: readonly Entry[],\n matcher: Matcher,\n input: CyjsStyleInput,\n env: { readonly notes: StyleNotes; readonly budget: StyleWorkBudget; readonly nodes: CyjsTargetStyles | null },\n): CyjsTargetStyles {\n const { notes, budget } = env;\n const els = kind === \"node\" ? graph.nodes : graph.edges;\n const spend = (ops: number): void => {\n budget.spend(kind, ops);\n };\n const { cells, applied } = cascade(kind, els, sheet, matcher, input, notes, budget);\n const order = outputOrder(kind, graph, input.snapshot, notes);\n const coreToOut = new Int32Array(els.length).fill(-1);\n order.forEach((c, k) => {\n if (c >= 0) {\n coreToOut[c] = k;\n }\n });\n applyBypasses(kind, els, cells, coreToOut, notes);\n if (kind === \"edge\") {\n forceLoopCurves(graph, cells.get(\"curve-style\"));\n }\n const drawn = drawnValues(kind, els, cells, order, input.rendered, notes, spend);\n // a file read with Cytoscape.js's own defaults draws an edge no rule curves as a haystack (a file graphty wrote\n // is read with graphty's)\n if (kind === \"edge\" && input.toolDefaults !== false) {\n const read: DrawnRead = { kind, els, cells, order, rendered: input.rendered, notes };\n const curves = drawnColumn(read, \"curve-style\", CURVE_PART);\n noArrowsOnHaystacks(curves, drawn);\n if (env.nodes !== null) {\n edgeRoutes(graph, read, curves, env.nodes, drawn);\n }\n }\n if (kind === \"node\") {\n const read: DrawnRead = { kind, els, cells, order, rendered: input.rendered, notes };\n nodeSizes(graph, read, drawn);\n mixedLabelPlaces(graph, read, drawn);\n }\n if (kind === \"edge\") {\n straightenUnpairedBeziers(graph, curveStyles(graph, cells, input.rendered), coreToOut, drawn.curved);\n }\n const built = buildRules(kind, applied, { els, order, coreToOut }, input, drawn, { matcher, notes, spend });\n return {\n n: order.length,\n values: drawn,\n rules: built.rules,\n columns: built.columns,\n rawColumns: built.rawColumns,\n elements: Array.from(order, (i) => (i >= 0 ? els[i] : null)),\n };\n}\n\n/**\n * The cascade over one target: per property, the cell of the last rule that sets it, per element.\n * @param kind - nodes or edges\n * @param els - the core's elements of the target\n * @param sheet - the entries\n * @param matcher - the selector evaluator\n * @param input - the input\n * @param notes - where problems are noted\n * @param budget - the counted budget\n * @returns the cells and the entries applied\n */\nfunction cascade(\n kind: StyleTarget,\n els: readonly CyjsElement[],\n sheet: readonly Entry[],\n matcher: Matcher,\n input: CyjsStyleInput,\n notes: StyleNotes,\n budget: StyleWorkBudget,\n): { cells: Cells; applied: Applied[] } {\n const n = els.length;\n const specs = cyjsProperties(kind);\n const spend = (ops: number): void => {\n budget.spend(kind, ops);\n };\n const ix = new Indexes(els, spend);\n const cells: Cells = new Map();\n const notCarried = new Map<string, number>();\n const applied: Applied[] = [];\n let stopped = false;\n for (const entry of sheet) {\n input.signal?.throwIfAborted();\n const props = entryProperties(entry, kind, specs, notes, notCarried);\n if (props.length === 0) {\n continue;\n }\n const list = budget.exhausted(kind)\n ? null\n : budgetedMatch(entry.selector, { kind, n }, matcher, ix, input, budget);\n if (list === null) {\n stopped = true;\n break;\n }\n spend(list.length);\n applied.push({ entry, list, props });\n for (const p of props) {\n const col = cellsOf(cells, p.name, n);\n for (const i of list) {\n col[i] = cellFor(p, els[i]);\n }\n spend(list.length);\n }\n }\n if (stopped) {\n notes.add(STYLE_ISSUE.BUDGET, kind, null, { sample: \"stylesheet\" });\n }\n for (const [name, count] of notCarried) {\n notes.add(STYLE_ISSUE.NOT_CARRIED, kind, name, { count, sample: name });\n }\n return { cells, applied };\n}\n\n/**\n * The elements a selector matches, within the counted budget.\n * @param sel - the selector\n * @param target - the target and its element count\n * @param target.kind - nodes or edges\n * @param target.n - the element count\n * @param matcher - the evaluator\n * @param ix - the target's indexes\n * @param input - the input, whose signal cancels the match\n * @param budget - the counted budget\n * @returns the element indexes, or null when the budget ran out partway through\n */\nfunction budgetedMatch(\n sel: CyjsSelector,\n target: { readonly kind: StyleTarget; readonly n: number },\n matcher: Matcher,\n ix: Indexes,\n input: CyjsStyleInput,\n budget: StyleWorkBudget,\n): readonly number[] | null {\n matcher.begin(target.kind, budget, input.signal);\n try {\n return matchList(sel, target.kind, target.n, matcher, ix);\n } catch (error) {\n if (!(error instanceof BudgetStop)) {\n throw error;\n }\n return null;\n } finally {\n matcher.end();\n }\n}\n\n/**\n * Each element's own `style` (a bypass) over every rule; a mapper there is refused, as Cytoscape.js refuses it.\n * @param kind - nodes or edges\n * @param els - the core's elements of the target\n * @param cells - the cells; changed in place\n * @param coreToOut - the output index of each core element\n * @param notes - where problems are noted\n */\nfunction applyBypasses(\n kind: StyleTarget,\n els: readonly CyjsElement[],\n cells: Cells,\n coreToOut: Int32Array,\n notes: StyleNotes,\n): void {\n const specs = cyjsProperties(kind);\n for (let i = 0; i < els.length; i++) {\n const { json } = els[i];\n const bypass = json.style ?? json.css;\n if (!isObject(bypass)) {\n continue;\n }\n for (const name0 of Object.keys(bypass)) {\n const name = cyjsPropertyName(name0);\n const spec = specs.get(name);\n const value = bypass[name0];\n if (spec === undefined || value === \"\" || value === null) {\n continue;\n }\n const parsed = parseCyjsValue(spec, value, \"bypass\");\n if (parsed === null || parsed === CYJS_THROWS || !isFlat(parsed)) {\n notes.add(STYLE_ISSUE.BAD_VALUE, kind, spec.property, { sample: value, element: coreToOut[i] });\n continue;\n }\n cellsOf(cells, name, els.length)[i] = parsed;\n }\n }\n}\n\n/**\n * What is drawn per neutral property, in output order: the cells as neutral values, overridden by what a live core\n * reports, with the label alignments and the visibility parts combined. Properties with no value are left out.\n * @param kind - nodes or edges\n * @param els - the core's elements of the target\n * @param cells - the cascade's cells\n * @param order - the core element of each output index\n * @param rendered - what a live core reports per element JSON, when given\n * @param notes - where problems are noted\n * @param spend - spends from the budget\n * @returns the values by property\n */\nfunction drawnValues(\n kind: StyleTarget,\n els: readonly CyjsElement[],\n cells: Cells,\n order: Int32Array,\n rendered: CyjsStyleInput[\"rendered\"],\n notes: StyleNotes,\n spend: (ops: number) => void,\n): Record<string, (StyleValue | null)[]> {\n const out = order.length;\n const values: Record<string, (StyleValue | null)[]> = {};\n const words = new Map<string, (string | null)[]>();\n const drawnOf: DrawnRead = { kind, els, cells, order, rendered, notes };\n for (const [name, spec] of cyjsProperties(kind)) {\n if (!cells.has(name) && rendered === undefined) {\n continue;\n }\n const col = drawnColumn(drawnOf, name, spec);\n spend(2 * out);\n if (spec.property.startsWith(\"_\")) {\n words.set(\n spec.property,\n col.map((v) => (typeof v === \"string\" || typeof v === \"number\" ? String(v) : null)),\n );\n continue;\n }\n values[spec.property] ??= new Array<StyleValue | null>(out).fill(null);\n const target = values[spec.property];\n col.forEach((v, k) => {\n if (v !== null && v !== undefined) {\n target[k] = v;\n }\n });\n }\n combineParts(kind, out, words, values, notes);\n if (kind === \"node\") {\n cyjsPolygonShapes(values);\n }\n const drawn: Record<string, (StyleValue | null)[]> = {};\n for (const [p, col] of Object.entries(values)) {\n if (col.some((v) => v !== null)) {\n drawn[p] = col;\n }\n }\n return drawn;\n}\n\n/** What drawnColumn() reads. */\ninterface DrawnRead {\n readonly kind: StyleTarget;\n readonly els: readonly CyjsElement[];\n readonly cells: Cells;\n readonly order: Int32Array;\n readonly rendered: CyjsStyleInput[\"rendered\"];\n readonly notes: StyleNotes;\n}\n\n/**\n * One Cytoscape.js property's neutral value per output element: its cell, overridden by what a live core reports.\n * @param d - the target's cells and what a live core reports\n * @param name - the property\n * @param spec - its spec\n * @returns the values, in output order\n */\nfunction drawnColumn(d: DrawnRead, name: string, spec: CyjsPropertySpec): (StyleValue | null | undefined)[] {\n const { kind, order, notes, rendered } = d;\n const out = order.length;\n const col = new Array<StyleValue | null | undefined>(out).fill(null);\n const cellCol = d.cells.get(name);\n for (let k = 0; k < out && cellCol !== undefined; k++) {\n const c = order[k] >= 0 ? cellCol[order[k]] : undefined;\n if (c !== undefined) {\n col[k] = neutralOfCell(spec, name, c, { notes, target: kind, property: spec.property, element: k });\n }\n }\n if (rendered !== undefined) {\n overrideRendered(d, rendered, name, spec, col);\n }\n return col;\n}\n\n/**\n * Overrides a property's values with what a live core reports.\n * @param d - the target's cells\n * @param rendered - what a live core reports\n * @param name - the property\n * @param spec - its spec\n * @param col - the values, in output order, changed in place\n */\nfunction overrideRendered(\n d: DrawnRead,\n rendered: NonNullable<CyjsStyleInput[\"rendered\"]>,\n name: string,\n spec: CyjsPropertySpec,\n col: (StyleValue | null | undefined)[],\n): void {\n const { kind, order, notes } = d;\n for (let k = 0; k < order.length; k++) {\n const r = order[k] >= 0 ? rendered.get(d.els[order[k]].json) : undefined;\n if (r !== undefined && Object.hasOwn(r, name)) {\n const site = { notes, target: kind, property: spec.property, element: k };\n const v = cyjsRendered(kind, name, r[name], site);\n // a live core reports \"\" for a label it does not draw\n col[k] = v === undefined || (v === \"\" && spec.type === \"text\") ? null : v;\n }\n }\n}\n\n/**\n * Each edge's curve style as Cytoscape.js draws it: what a live core reports, else the winning cell.\n * @param graph - the core's elements\n * @param cells - the winning cells\n * @param rendered - what a live core reports, when given\n * @returns the curve style per edge, in core order\n */\nfunction curveStyles(graph: CyjsGraph, cells: Cells, rendered: CyjsStyleInput[\"rendered\"]): unknown[] {\n const col = cells.get(\"curve-style\");\n return graph.edges.map((el, e) => {\n const r = rendered?.get(el.json);\n if (r !== undefined && Object.hasOwn(r, \"curve-style\")) {\n return r[\"curve-style\"];\n }\n const c = col?.[e];\n return typeof c === \"object\" && c.kind === \"word\" ? c.value : undefined;\n });\n}\n\n/**\n * Cytoscape.js bows a `bezier` edge only to keep it apart from the other `bezier` edges joining the same two nodes:\n * it draws a lone one, and the middle one of an odd number, straight. Loops stay curved.\n * @param graph - the core's elements\n * @param styles - each edge's curve style, in core order\n * @param coreToOut - each edge's output index, or -1\n * @param curved - the drawn `curved` values in output order, changed in place\n */\nfunction straightenUnpairedBeziers(\n graph: CyjsGraph,\n styles: readonly unknown[],\n coreToOut: Int32Array,\n curved: (StyleValue | null)[] | undefined,\n): void {\n if (curved === undefined) {\n return;\n }\n for (const bundle of bezierBundles(graph, styles)) {\n const k = bundle.length % 2 === 1 ? coreToOut[bundle[(bundle.length - 1) / 2]] : -1;\n if (k >= 0) {\n curved[k] = false;\n }\n }\n}\n\n/**\n * The `bezier` edges that are not loops, grouped by the two nodes they join (either way round), in core order.\n * @param graph - the core's elements\n * @param styles - each edge's curve style, in core order\n * @returns the groups\n */\nfunction bezierBundles(graph: CyjsGraph, styles: readonly unknown[]): Iterable<number[]> {\n const bundles = new Map<string, number[]>();\n for (let e = 0; e < graph.edges.length; e++) {\n const s = graph.source[e];\n const t = graph.target[e];\n if (s === t || styles[e] !== \"bezier\") {\n continue;\n }\n const key = s < t ? `${s} ${t}` : `${t} ${s}`;\n const bundle = bundles.get(key);\n if (bundle === undefined) {\n bundles.set(key, [e]);\n } else {\n bundle.push(e);\n }\n }\n return bundles.values();\n}\n\n/**\n * Cytoscape.js draws every loop curved: a loop whose curve style is anything but `bezier` becomes `bezier`, except\n * `haystack`, which Cytoscape.js leaves as it is because it is the property's own default.\n * @param graph - the core's elements\n * @param col - the winning curve style per edge, if any rule set one\n */\nfunction forceLoopCurves(graph: CyjsGraph, col: (Cell | undefined)[] | undefined): void {\n if (col === undefined) {\n return;\n }\n for (let e = 0; e < graph.edges.length; e++) {\n const c = col[e];\n if (\n graph.source[e] === graph.target[e] &&\n typeof c === \"object\" &&\n c.kind === \"word\" &&\n c.value !== \"bezier\" &&\n c.value !== \"haystack\"\n ) {\n col[e] = { kind: \"word\", value: \"bezier\", str: \"bezier\" };\n }\n }\n}\n\n/**\n * The properties of one entry that apply to a target, parsed.\n * @param entry - the entry\n * @param kind - the target\n * @param specs - the target's carried properties\n * @param notes - where problems are noted\n * @param notCarried - counts of property names not carried\n * @returns the parsed properties, later duplicates last\n */\nfunction entryProperties(\n entry: Entry,\n kind: StyleTarget,\n specs: ReadonlyMap<string, CyjsPropertySpec>,\n notes: StyleNotes,\n notCarried: Map<string, number>,\n): EntryProperty[] {\n const out: EntryProperty[] = [];\n for (const [name0, value] of entry.properties) {\n const name = entry.dashOnly ? cyjsAliasOf(name0) : cyjsPropertyName(name0);\n const spec = specs.get(name);\n if (spec === undefined) {\n if (kind === \"node\" && !CYJS_EDGE_ONLY.has(name) && !entry.tool) {\n notCarried.set(name, (notCarried.get(name) ?? 0) + 1);\n }\n continue;\n }\n const parsed = parseCyjsValue(spec, value, \"rule\");\n if (parsed === null || parsed === CYJS_THROWS) {\n // a rule's own value: noted for the target as a whole, so per-element notes keep their element lists\n if (!entry.tool) {\n notes.add(STYLE_ISSUE.BAD_VALUE, kind, null, { sample: `${name}: ${String(value)}` });\n }\n continue;\n }\n out.push({ name, spec, parsed });\n }\n return out;\n}\n\n/** Edge properties a node never carries: not noted as dropped on nodes. */\nconst CYJS_EDGE_ONLY: ReadonlySet<string> = new Set([\n \"line-color\",\n \"line-style\",\n \"line-outline-width\",\n \"line-outline-color\",\n \"line-fill\",\n \"line-gradient-stop-colors\",\n \"line-gradient-stop-positions\",\n \"target-arrow-shape\",\n \"source-arrow-shape\",\n \"target-arrow-color\",\n \"source-arrow-color\",\n \"mid-target-arrow-shape\",\n \"mid-source-arrow-shape\",\n \"mid-target-arrow-color\",\n \"mid-source-arrow-color\",\n \"target-arrow-fill\",\n \"source-arrow-fill\",\n \"curve-style\",\n \"arrow-scale\",\n \"source-label\",\n \"target-label\",\n \"source-text-offset\",\n \"target-text-offset\",\n \"source-text-margin-x\",\n \"source-text-margin-y\",\n \"target-text-margin-x\",\n \"target-text-margin-y\",\n \"source-text-rotation\",\n \"target-text-rotation\",\n]);\n\n/**\n * The elements of a target a selector matches, in order.\n * @param sel - the selector\n * @param kind - the target\n * @param n - the element count\n * @param matcher - the evaluator\n * @param ix - the target's indexes\n * @returns the element indexes\n */\nfunction matchList(sel: CyjsSelector, kind: StyleTarget, n: number, matcher: Matcher, ix: Indexes): readonly number[] {\n if (sel.queries.length === 0) {\n return [];\n }\n // one stamp per call marks the elements found, so a selector costs what its candidates cost, not the graph\n const stamp = ++ix.stamp;\n const marked = ix.marks;\n const hits: number[] = [];\n let scanned = false;\n const visit = (q: CyjsQuery, i: number): void => {\n if (marked[i] !== stamp && matcher.query(q, kind, i)) {\n marked[i] = stamp;\n hits.push(i);\n }\n };\n for (const q of sel.queries) {\n const cands = candidates(q, kind, ix);\n if (cands === null) {\n scanned = true;\n for (let i = 0; i < n; i++) {\n visit(q, i);\n }\n } else {\n matcher.work += cands.length;\n for (const i of cands) {\n visit(q, i);\n }\n }\n }\n if (scanned || sel.queries.length > 1) {\n hits.sort((a, b) => a - b);\n }\n matcher.work += hits.length;\n return hits;\n}\n\n/**\n * The cell a property gives one element: its constant, or its mapper evaluated.\n * @param p - the property\n * @param e - the element\n * @returns the cell\n */\nfunction cellFor(p: EntryProperty, e: CyjsElement): Cell {\n const v = p.parsed;\n if (v.kind === \"data\" || v.kind === \"mapData\") {\n return applyCyjsMapper(p.spec, v, mapperData(e)) ?? \"reset\";\n }\n if (v.kind === \"fn\") {\n return \"fn\";\n }\n return v;\n}\n\n/** Parsed property defaults, per property name. */\nconst DEFAULT_CELLS = new Map<string, CyjsFlat | null>();\n\n/**\n * A property's Cytoscape.js default as a flat value.\n * @param name - the property\n * @param spec - its spec\n * @returns the default\n */\nfunction defaultCell(name: string, spec: CyjsPropertySpec): CyjsFlat | null {\n const key = `${spec.type}|${name}`;\n if (!DEFAULT_CELLS.has(key)) {\n const raw = CYJS_PROPERTY_DEFAULTS.get(name);\n const parsed = raw === undefined ? null : parseCyjsValue(spec, raw, \"flat\");\n DEFAULT_CELLS.set(key, parsed === null || parsed === CYJS_THROWS || !isFlat(parsed) ? null : parsed);\n }\n return DEFAULT_CELLS.get(key) ?? null;\n}\n\n/**\n * Whether a parsed value is flat.\n * @param v - the value\n * @returns true for a color, number or word\n */\nfunction isFlat(v: CyjsParsed): v is CyjsFlat {\n return v.kind === \"color\" || v.kind === \"number\" || v.kind === \"word\";\n}\n\n/**\n * The neutral value of a cell.\n * @param spec - the property\n * @param name - its Cytoscape.js name\n * @param c - the cell\n * @param site - where it is read\n * @returns the value, null for none, or undefined when it cannot be evaluated (noted)\n */\nfunction neutralOfCell(spec: CyjsPropertySpec, name: string, c: Cell, site: CanonSite): StyleValue | null | undefined {\n if (c === CYJS_THROWS) {\n site.notes.add(STYLE_ISSUE.BAD_VALUE, site.target, site.property, {\n sample: \"unstyleable\",\n element: site.element,\n });\n return undefined;\n }\n if (c === \"fn\") {\n site.notes.add(STYLE_ISSUE.LAYER_FLATTENED, site.target, site.property, {\n sample: \"FUNCTION\",\n element: site.element,\n });\n return undefined;\n }\n const flat = c === \"reset\" ? defaultCell(name, spec) : c;\n if (flat === null) {\n return null;\n }\n return cyjsNeutral(spec, flat, site);\n}\n\n/**\n * Combines the label alignments into `labelPosition`, `text-wrap` with `text-max-width` and `text-overflow-wrap` into\n * `labelWrapWidth`, `labelWrapEllipsis` and `labelWrapAnywhere`, and `visibility` with `display` into `visible`.\n * @param kind - the target\n * @param n - the element count\n * @param words - the parts by internal name\n * @param values - the values; changed in place\n * @param notes - where problems are noted\n */\nfunction combineParts(\n kind: StyleTarget,\n n: number,\n words: ReadonlyMap<string, (string | null)[]>,\n values: Record<string, (StyleValue | null)[]>,\n notes: StyleNotes,\n): void {\n // the element's own opacity, before an edge's line opacity is multiplied in: its label is drawn at it\n const whole = [...(values.opacity ?? new Array<StyleValue | null>(n).fill(null))];\n combineLabelOpacity(n, words, values);\n if (kind === \"node\") {\n combineNodeOpacity(n, words, values);\n }\n const va = words.get(\"_valign\");\n const ha = words.get(\"_halign\");\n if (kind === \"node\" && (va !== undefined || ha !== undefined)) {\n values.labelPosition = Array.from({ length: n }, (_, i) => labelPosition(va?.[i] ?? null, ha?.[i] ?? null));\n }\n // `text-max-width` wraps a label only under `text-wrap: wrap`; unset there, it is 9999 (cytoscape.js 3.34.3\n // dist/cytoscape.cjs.js line 18484), which wraps nothing but the label's own line breaks.\n // `text-wrap: ellipsis` cuts the label at the same width instead (3.34.3 line 25254), and\n // `text-overflow-wrap: anywhere` breaks a wrapped one between any two letters (line 25204).\n const wrap = words.get(\"_wrap\");\n const maxWidth = words.get(\"_maxWidth\");\n const overflow = words.get(\"_overflowWrap\");\n if (wrap !== undefined) {\n const cut = (i: number): boolean => wrap[i] === \"wrap\" || wrap[i] === \"ellipsis\";\n values.labelWrapWidth = Array.from({ length: n }, (_, i) =>\n cut(i) && typeof maxWidth?.[i] === \"string\" ? Number(maxWidth[i]) : null,\n );\n if (wrap.includes(\"ellipsis\")) {\n values.labelWrapEllipsis = wrap.map((w) => (w === \"ellipsis\" ? true : null));\n }\n if (overflow?.includes(\"anywhere\") === true) {\n values.labelWrapAnywhere = wrap.map((w, i) => (w === \"wrap\" && overflow[i] === \"anywhere\" ? true : null));\n }\n }\n if (kind === \"node\") {\n combineFace(n, words, values);\n combineBackgroundGradient(n, words, values, notes);\n } else {\n combineArrowFills(n, words, values, notes);\n combineLineOpacity(n, words.get(\"_lineOpacity\"), values);\n }\n combineDashes(kind, n, words, values);\n combineLabelText(kind, n, words, values);\n combineLabelDress(kind, n, words, values, notes, whole);\n combineVisibility(kind, n, words, values);\n}\n\n/**\n * A label's opacity as Cytoscape.js draws it: its `text-opacity` times the element's `opacity` (cytoscape.js 3.34.3\n * `drawText`: `effectiveOpacity() * text-opacity`), which the label's box and its line round it are drawn at too.\n * ponytail: a compound parent's opacity, which Cytoscape.js multiplies in as well, is left out\n * @param n - the element count\n * @param words - the parts by internal name\n * @param values - the values, `opacity` still the element's own; changed in place\n */\nfunction combineLabelOpacity(\n n: number,\n words: ReadonlyMap<string, (string | null)[]>,\n values: Record<string, (StyleValue | null)[]>,\n): void {\n const text = words.get(\"_textOpacity\");\n const whole = values.opacity;\n if (text === undefined && whole === undefined) {\n return;\n }\n const col = new Array<StyleValue | null>(n).fill(null);\n for (let i = 0; i < n; i++) {\n const t = text?.[i] ?? null;\n const o = whole?.[i];\n const v = Math.round((t === null ? 1 : Number(t)) * (typeof o === \"number\" ? o : 1) * 1e6) / 1e6;\n // a label at full strength is left unset, as one no rule fades\n col[i] = v === 1 || !Number.isFinite(v) ? null : v;\n }\n values.labelOpacity = col;\n}\n\n/**\n * A node's border and outline as Cytoscape.js draws them: at their own `border-opacity` / `outline-opacity` times the\n * node's `opacity` (cytoscape.js 3.34.3 `drawNode`: `parentOpacity * borderOpacity`). A ring at full strength is left\n * unset.\n * @param n - the element count\n * @param words - the parts by internal name\n * @param values - the values, `opacity` still the node's own; changed in place\n */\nfunction combineNodeOpacity(\n n: number,\n words: ReadonlyMap<string, (string | null)[]>,\n values: Record<string, (StyleValue | null)[]>,\n): void {\n const whole = values.opacity;\n for (const [part, p] of [\n [\"_ringOpacity\", \"borderOpacity\"],\n [\"_outlineRingOpacity\", \"outerBorderOpacity\"],\n ] as const) {\n const own = words.get(part);\n if (own === undefined && whole === undefined) {\n continue;\n }\n values[p] = Array.from({ length: n }, (_, i) => {\n const a = own?.[i] ?? null;\n const o = whole?.[i];\n const v = Math.round((a === null ? 1 : Number(a)) * (typeof o === \"number\" ? o : 1) * 1e6) / 1e6;\n return v === 1 || !Number.isFinite(v) ? null : v;\n });\n }\n}\n\n/**\n * A dashed line or border as the line it looks like. Cytoscape.js draws `dashed` with `line-dash-pattern` (6 3) or\n * `border-dash-pattern` (4 2) in pixels whatever the width, and `dotted` as 1 1 (cytoscape.js 3.34.3 `drawEdgePath`,\n * `drawNode`), so a wide dashed line shows dots and a pattern of long and short dashes a dash-dot. The class is read\n * from the dashes and gaps against the width, a round or square cap lengthening each dash by the width.\n * ponytail: the neutral line styles name a class, not a pattern; a dash pattern slot would carry the lengths exactly\n * @param kind - the target\n * @param n - the element count\n * @param words - the parts by internal name\n * @param values - the values; changed in place\n */\nfunction combineDashes(\n kind: StyleTarget,\n n: number,\n words: ReadonlyMap<string, (string | null)[]>,\n values: Record<string, (StyleValue | null)[]>,\n): void {\n // the line or border, and a node's outline, which is always dashed 4 2 with butt ends (`drawOutline`)\n const lines: [string, string, number, string, boolean][] =\n kind === \"edge\"\n ? [[\"lineStyle\", \"width\", 3, \"6 3\", true]]\n : [\n [\"borderStyle\", \"borderWidth\", 0, \"4 2\", true],\n [\"outerBorderStyle\", \"outerBorderWidth\", 0, \"4 2\", false],\n ];\n for (const [style, width, fallback, pattern, own] of lines) {\n const col = values[style];\n if (col !== undefined) {\n dashColumn(col, n, values[width], { fallback, pattern }, own ? words : null);\n }\n }\n}\n\n/**\n * One line style's dashed lines as the lines they look like.\n * @param col - the line styles; changed in place\n * @param n - the element count\n * @param widths - the lines' widths, when set\n * @param drawn - what Cytoscape.js draws when they are not set: the width and the dash pattern\n * @param drawn.fallback - the width\n * @param drawn.pattern - the dash pattern\n * @param words - the parts by internal name, or null for an outline, which has no pattern or cap of its own\n */\nfunction dashColumn(\n col: (StyleValue | null)[],\n n: number,\n widths: readonly (StyleValue | null)[] | undefined,\n drawn: { fallback: number; pattern: string },\n words: ReadonlyMap<string, (string | null)[]> | null,\n): void {\n for (let i = 0; i < n; i++) {\n if (col[i] !== \"dashed\") {\n continue;\n }\n const w = widths?.[i];\n const look = dashedLook(words, i, drawn.pattern, typeof w === \"number\" ? w : drawn.fallback);\n if (look !== null) {\n col[i] = look;\n }\n }\n}\n\n/**\n * One dashed line's look, from its dash pattern (its own `line-dash-pattern` when it has one) and cap.\n * @param words - the parts by internal name, or null for an outline, which has no pattern or cap of its own\n * @param i - the element\n * @param pattern - the pattern Cytoscape.js draws when none is given\n * @param width - the line's width\n * @returns the line style, or null when the pattern is not a list of numbers\n */\nfunction dashedLook(\n words: ReadonlyMap<string, (string | null)[]> | null,\n i: number,\n pattern: string,\n width: number,\n): string | null {\n const dashes = (words?.get(\"_dashPattern\")?.[i] ?? pattern)\n .split(/[\\s,[\\]]+/)\n .filter((t) => t !== \"\")\n .map((t) => Number.parseFloat(t));\n if (dashes.length === 0 || !dashes.every((d) => Number.isFinite(d))) {\n return null;\n }\n return cyjsDashLook(dashes, width, words?.get(\"_dashCap\")?.[i] ?? \"butt\");\n}\n\n/**\n * A property's values, created (all null) when it has none yet.\n * @param values - the values by property; changed in place\n * @param property - the property\n * @param n - the element count\n * @returns its values\n */\nfunction columnOf(values: Record<string, (StyleValue | null)[]>, property: string, n: number): (StyleValue | null)[] {\n let column = values[property];\n if (column === undefined) {\n column = new Array<StyleValue | null>(n).fill(null);\n values[property] = column;\n }\n return column;\n}\n\n/**\n * `visibility` with `display` into `visible`. Cytoscape.js leaves the edges of a node hidden with `visibility:\n * hidden` drawn (only `display: none` takes them away), so such a node is kept and drawn at opacity 0 (its border and\n * outline too), with no label.\n * @param kind - the target\n * @param n - the element count\n * @param words - the parts by internal name\n * @param values - the values; changed in place\n */\nfunction combineVisibility(\n kind: StyleTarget,\n n: number,\n words: ReadonlyMap<string, (string | null)[]>,\n values: Record<string, (StyleValue | null)[]>,\n): void {\n const vis = words.get(\"_visibility\");\n const disp = words.get(\"_display\");\n if (vis === undefined && disp === undefined) {\n return;\n }\n const col = new Array<StyleValue | null>(n).fill(null);\n for (let i = 0; i < n; i++) {\n const a = vis?.[i] ?? null;\n const b = disp?.[i] ?? null;\n if (a === null && b === null) {\n continue;\n }\n const keptInvisible = kind === \"node\" && a === \"hidden\" && b !== \"none\";\n col[i] = keptInvisible || (a !== \"hidden\" && b !== \"none\");\n if (keptInvisible) {\n // nothing of it is drawn: its body, its border, its outline or its label\n for (const p of [\"opacity\", \"borderOpacity\", \"outerBorderOpacity\", \"labelOpacity\"]) {\n columnOf(values, p, n)[i] = 0;\n }\n columnOf(values, \"label\", n)[i] = \"\";\n }\n }\n values.visible = col;\n}\n\n/**\n * The label's words as Cytoscape.js draws them: `text-transform`, `text-justification`, and `text-rotation` (an\n * edge's end labels' `source-` / `target-text-rotation` too) as `labelRotation`, `sourceLabelRotation` and\n * `targetLabelRotation`.\n * @param kind - the target\n * @param n - the element count\n * @param words - the parts by internal name\n * @param values - the values; changed in place\n */\nfunction combineLabelText(\n kind: StyleTarget,\n n: number,\n words: ReadonlyMap<string, (string | null)[]>,\n values: Record<string, (StyleValue | null)[]>,\n): void {\n transformLabels(n, words.get(\"_transform\"), values.label);\n // cytoscape.js 3.34.3 `labelJustification`: auto lines the lines up against the node, a label beside it on the\n // left to its right edge\n const justification = words.get(\"_justification\");\n if (justification !== undefined && kind === \"edge\") {\n combineEdgeJustification(n, justification, words.get(\"_wrap\"), values);\n } else if (justification !== undefined) {\n const halign = words.get(\"_halign\");\n const AUTO: Readonly<Record<string, string>> = {\n left: \"right\",\n right: \"left\",\n \"left-inside\": \"left\",\n \"right-inside\": \"right\",\n };\n values.labelTextAlign = justification.map((j, i) => {\n if (j === null) {\n return null;\n }\n return j === \"auto\" ? (AUTO[halign?.[i] ?? \"center\"] ?? \"center\") : j;\n });\n }\n // an edge's `autorotate` follows its line, which the routes work out (`autorotateLabels`)\n const rotations: readonly (readonly [string, string])[] = [\n [\"_rotation\", \"labelRotation\"],\n [\"_sourceRotation\", \"sourceLabelRotation\"],\n [\"_targetRotation\", \"targetLabelRotation\"],\n ];\n for (const [part, property] of rotations) {\n const rotation = words.get(part);\n if (rotation !== undefined) {\n values[property] = rotation.map((r) => (r === null ? null : cyjsAngleDegrees(r)));\n }\n }\n}\n\n/**\n * A label's `text-transform`: `uppercase` and `lowercase` change its words; anything else leaves them.\n * @param n - the element count\n * @param transform - each element's transform\n * @param label - each element's label; changed in place\n */\nfunction transformLabels(\n n: number,\n transform: readonly (string | null)[] | undefined,\n label: (StyleValue | null)[] | undefined,\n): void {\n if (transform === undefined || label === undefined) {\n return;\n }\n for (let i = 0; i < n; i++) {\n const text = label[i];\n if (typeof text === \"string\" && transform[i] === \"uppercase\") {\n label[i] = text.toUpperCase();\n } else if (typeof text === \"string\" && transform[i] === \"lowercase\") {\n label[i] = text.toLowerCase();\n }\n }\n}\n\n/**\n * An edge label's `text-justification` as Cytoscape.js draws it: every line centered (an edge's text is always\n * centered, cytoscape.js 3.34.3 `setupTextStyle`), the block moved half its width left for `left` and right for\n * `right`, and only for a wrapped label (`drawText`), as `labelShiftX`.\n * @param n - the element count\n * @param justification - each edge's justification\n * @param wrap - each edge's `text-wrap`\n * @param values - the values; changed in place\n */\nfunction combineEdgeJustification(\n n: number,\n justification: readonly (string | null)[],\n wrap: readonly (string | null)[] | undefined,\n values: Record<string, (StyleValue | null)[]>,\n): void {\n const SHIFT: Readonly<Record<string, number>> = { left: -0.5, right: 0.5 };\n for (let i = 0; i < n; i++) {\n const shift = wrap?.[i] === \"wrap\" ? SHIFT[justification[i] ?? \"\"] : undefined;\n if (shift !== undefined) {\n columnOf(values, \"labelShiftX\", n)[i] = shift;\n }\n }\n}\n\n/**\n * A label's outline and background box as Cytoscape.js draws them: the outline only with a `text-outline-width` and\n * a `text-outline-opacity` above 0, a stroke of twice that width centered on the letters' edges (cytoscape.js\n * 3.34.3 `drawText`: `lineWidth = 2 * text-outline-width`); the box only with a `text-background-opacity` above 0\n * (its default is 0), and the line round the box (`labelBorder`); the box and the line reach `text-background-padding`\n * past the words.\n * @param kind - the target\n * @param n - the element count\n * @param words - the parts by internal name\n * @param values - the values; changed in place\n * @param notes - where problems are noted\n * @param whole - each element's own opacity, which the box is drawn at too\n */\nfunction combineLabelDress(\n kind: StyleTarget,\n n: number,\n words: ReadonlyMap<string, (string | null)[]>,\n values: Record<string, (StyleValue | null)[]>,\n notes: StyleNotes,\n whole: readonly (StyleValue | null)[],\n): void {\n const num = (part: string, i: number, fallback: number): number => {\n const v = words.get(part)?.[i];\n return v === null || v === undefined ? fallback : Number(v);\n };\n const col = (p: string): (StyleValue | null)[] => (values[p] ??= new Array<StyleValue | null>(n).fill(null));\n const outlined = words.has(\"_outlineWidth\");\n const boxed = words.has(\"_backgroundOpacity\");\n const bordered = words.has(\"_textBorderWidth\") && words.has(\"_textBorderOpacity\");\n // each part is drawn at its own opacity times the element's; the outline at the words' opacity too (drawText)\n const at = (v: StyleValue | null | undefined): number => (typeof v === \"number\" ? v : 1);\n const faded = (v: number): number | null => {\n const r = Math.round(v * 1e6) / 1e6;\n return r < 1 ? r : null;\n };\n for (let i = 0; i < n && (outlined || boxed || bordered); i++) {\n const width = num(\"_outlineWidth\", i, 0);\n const outlineOpacity = num(\"_outlineOpacity\", i, 1);\n if (outlined && width > 0 && outlineOpacity > 0) {\n col(\"labelOutlineColor\")[i] = words.get(\"_outlineColor\")?.[i] ?? \"#000000\";\n col(\"labelOutlineWidth\")[i] = 2 * width;\n col(\"labelOutlineOpacity\")[i] = faded(outlineOpacity * at(values.labelOpacity?.[i]));\n }\n const boxOpacity = num(\"_backgroundOpacity\", i, 0);\n const box = boxed && boxOpacity > 0;\n if (box) {\n col(\"labelBackground\")[i] = words.get(\"_backgroundColor\")?.[i] ?? \"#000000\";\n col(\"labelBackgroundOpacity\")[i] = faded(boxOpacity * at(whole[i]));\n }\n const border = bordered && labelBorder(kind, i, words, col, notes, at(whole[i]));\n if (box || border) {\n labelBoxShape(kind, i, words, col, notes);\n }\n }\n}\n\n/**\n * A label's box or line round it, sized and shaped: it reaches `text-background-padding` past the words on every\n * side (0 unset), one font size tall a line (cytoscape.js 3.34.3 `calculateLabelDimensions`), its corners rounded\n * 2px for round-rectangle (`drawText`); a circle is noted.\n * @param kind - the target\n * @param i - the element\n * @param words - the parts by internal name\n * @param col - a property's values, created when absent\n * @param notes - where problems are noted\n */\nfunction labelBoxShape(\n kind: StyleTarget,\n i: number,\n words: ReadonlyMap<string, (string | null)[]>,\n col: (p: string) => (StyleValue | null)[],\n notes: StyleNotes,\n): void {\n const padding = words.get(\"_backgroundPadding\")?.[i];\n col(\"labelPadding\")[i] = padding === null || padding === undefined ? 0 : Number(padding);\n col(\"labelLineHeight\")[i] = 1;\n const shape = words.get(\"_backgroundShape\")?.[i];\n if (shape === \"round-rectangle\" || shape === \"roundrectangle\") {\n col(\"labelCornerRadius\")[i] = 2;\n } else if (shape === \"circle\") {\n // a disc as tall as the box, centered on it: no neutral box has that shape\n notes.add(STYLE_ISSUE.APPROXIMATED, kind, \"labelBackground\", { sample: \"circle\", element: i });\n }\n}\n\n/**\n * The line Cytoscape.js draws round a label's box: only with a `text-border-width` and a `text-border-opacity` above\n * 0 (both default to 0), in `text-border-color` (black unset), at its opacity times the element's. A double one is\n * one line a quarter of the width, where `drawText` strokes two such lines half the width apart (cytoscape.js 3.34.3),\n * noted; dotted and dashed are drawn solid, noted.\n * @param kind - the target\n * @param i - the element\n * @param words - the parts by internal name\n * @param col - a property's values, created when absent\n * @param notes - where problems are noted\n * @param whole - the element's opacity\n * @returns whether a line is drawn\n */\nfunction labelBorder(\n kind: StyleTarget,\n i: number,\n words: ReadonlyMap<string, (string | null)[]>,\n col: (p: string) => (StyleValue | null)[],\n notes: StyleNotes,\n whole: number,\n): boolean {\n const num = (part: string): number => Number(words.get(part)?.[i] ?? 0);\n const [width, opacity] = [num(\"_textBorderWidth\"), num(\"_textBorderOpacity\")];\n if (!(width > 0 && opacity > 0)) {\n return false;\n }\n const style = words.get(\"_textBorderStyle\")?.[i] ?? \"solid\";\n col(\"labelBorderColor\")[i] = words.get(\"_textBorderColor\")?.[i] ?? \"#000000\";\n col(\"labelBorderWidth\")[i] = style === \"double\" ? width / 4 : width;\n const drawn = Math.round(opacity * whole * 1e6) / 1e6;\n col(\"labelBorderOpacity\")[i] = drawn < 1 ? drawn : null;\n if (style === \"dotted\" || style === \"dashed\" || style === \"double\") {\n notes.add(STYLE_ISSUE.APPROXIMATED, kind, \"labelBorderColor\", { sample: style, element: i });\n }\n return true;\n}\n\n/**\n * An autorotated label's turn: along the line between two centers, kept upright (cytoscape.js 3.34.3\n * `lineAngleFromDelta`: atan(dy / dx), a vertical line turned to +90 whichever way it runs), from 0 up to 360.\n * @param a - the source's center\n * @param b - the target's center\n * @returns the degrees\n */\nfunction lineDegrees(a: readonly [number, number], b: readonly [number, number]): number {\n const dx = b[0] - a[0];\n const angle = Math.atan((b[1] - a[1]) / dx);\n const turn = ((dx === 0 ? Math.abs(angle) : angle) * 180) / Math.PI;\n return Number.isFinite(turn) ? Math.round((((turn % 360) + 360) % 360) * 1e6) / 1e6 + 0 : 0;\n}\n\n/**\n * A Cytoscape.js angle (`30deg`, `0.5rad`, a number of radians) in degrees; `none` and `autorotate` (which turns\n * only an edge's label) are 0.\n * @param text - the value\n * @returns the degrees, or null when it is not an angle\n */\nfunction cyjsAngleDegrees(text: string): number | null {\n const t = text.trim();\n if (t === \"none\" || t === \"autorotate\") {\n return 0;\n }\n const m = /^(-?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:e[+-]?\\d+)?)(deg|rad)?$/i.exec(t);\n if (m === null) {\n return null;\n }\n const x = Number(m[1]);\n const deg = m[2]?.toLowerCase() === \"deg\" ? x : (x * 180) / Math.PI;\n // the neutral rotation runs from 0 up to 360\n return Math.round((((deg % 360) + 360) % 360) * 1e6) / 1e6 + 0;\n}\n\n/**\n * An edge's `line-opacity` times its `opacity`, which the line is drawn at (cytoscape.js 3.34.3 `drawEdge`:\n * `effectiveLineOpacity`).\n * @param n - the element count\n * @param line - the line opacities, as text\n * @param values - the values; changed in place\n */\nfunction combineLineOpacity(\n n: number,\n line: readonly (string | null)[] | undefined,\n values: Record<string, (StyleValue | null)[]>,\n): void {\n if (line === undefined) {\n return;\n }\n const whole = values.opacity;\n values.opacity = Array.from({ length: n }, (_, i) => {\n const a = line[i] === null ? null : Number(line[i]);\n const b = whole?.[i];\n if (a === null || !Number.isFinite(a)) {\n return b ?? null;\n }\n return Math.round(a * (typeof b === \"number\" ? b : 1) * 1e6) / 1e6;\n });\n}\n\n/** Where each `background-gradient-direction` runs, in the neutral `fillGradientAngle` degrees. */\nconst GRADIENT_ANGLES: ReadonlyMap<string, number> = new Map([\n [\"to-bottom\", 90],\n [\"to-top\", 270],\n [\"to-left\", 180],\n [\"to-right\", 0],\n [\"to-bottom-right\", 45],\n [\"to-right-bottom\", 45],\n [\"to-bottom-left\", 135],\n [\"to-left-bottom\", 135],\n [\"to-top-right\", 315],\n [\"to-right-top\", 315],\n [\"to-top-left\", 225],\n [\"to-left-top\", 225],\n]);\n\n/**\n * A node's `background-fill: linear-gradient` or `radial-gradient` as `fill` (its first stop), `fillGradient` (its\n * last), `fillGradientAngle` (a linear one's direction), `fillGradientKind`, `fillGradientColors` (every stop, when\n * there are more than two) and `fillGradientStops` (`background-gradient-stop-positions`, when there is one per\n * color, as Cytoscape.js uses them).\n * @param n - the element count\n * @param words - the parts by internal name\n * @param values - the values; changed in place\n * @param notes - where problems are noted\n */\nfunction combineBackgroundGradient(\n n: number,\n words: ReadonlyMap<string, (string | null)[]>,\n values: Record<string, (StyleValue | null)[]>,\n notes: StyleNotes,\n): void {\n const fill = words.get(\"_backgroundFill\");\n if (fill === undefined) {\n return;\n }\n const stops = words.get(\"_backgroundStops\");\n const positions = words.get(\"_backgroundPositions\");\n const direction = words.get(\"_backgroundDirection\");\n const col = (name: string): (StyleValue | null)[] => (values[name] ??= new Array<StyleValue | null>(n).fill(null));\n for (let i = 0; i < n; i++) {\n const radial = fill[i] === \"radial-gradient\";\n if (fill[i] !== \"linear-gradient\" && !radial) {\n continue;\n }\n // Cytoscape.js's default stop colors are one gray, which draws flat\n const colors = gradientStopColors(stops?.[i] ?? \"#999\", {\n notes,\n target: \"node\",\n property: \"fill\",\n element: i,\n });\n if (colors.length < 2) {\n continue;\n }\n col(\"fill\")[i] = colors[0];\n col(\"fillGradient\")[i] = colors.at(-1) ?? null;\n if (colors.length > 2) {\n col(\"fillGradientColors\")[i] = colors.join(\" \");\n }\n const placed = gradientStops(positions?.[i] ?? \"\");\n if (placed?.split(\" \").length === colors.length) {\n col(\"fillGradientStops\")[i] = placed;\n }\n if (radial) {\n col(\"fillGradientKind\")[i] = \"radial\";\n } else {\n col(\"fillGradientAngle\")[i] = GRADIENT_ANGLES.get(direction?.[i] ?? \"to-bottom\") ?? 90;\n }\n }\n}\n\n/** An edge's routing settings, each read as Cytoscape.js spells it. */\nconst ROUTE_PARTS: readonly (readonly [keyof CyjsRouteEdge, string, CyjsPropertySpec])[] = [\n [\"segmentDistances\", \"segment-distances\", { property: \"_segmentDistances\", type: \"text\" }],\n [\"segmentWeights\", \"segment-weights\", { property: \"_segmentWeights\", type: \"text\" }],\n [\"controlPointDistances\", \"control-point-distances\", { property: \"_controlPointDistances\", type: \"text\" }],\n [\"controlPointWeights\", \"control-point-weights\", { property: \"_controlPointWeights\", type: \"text\" }],\n [\"controlPointStepSize\", \"control-point-step-size\", { property: \"_controlPointStepSize\", type: \"size\" }],\n [\"taxiDirection\", \"taxi-direction\", { property: \"_taxiDirection\", type: \"text\" }],\n [\"taxiTurn\", \"taxi-turn\", { property: \"_taxiTurn\", type: \"text\" }],\n [\"taxiTurnMinDistance\", \"taxi-turn-min-distance\", { property: \"_taxiTurnMinDistance\", type: \"size\" }],\n [\"edgeDistances\", \"edge-distances\", { property: \"_edgeDistances\", type: \"text\" }],\n [\"loopDirection\", \"loop-direction\", { property: \"_loopDirection\", type: \"text\" }],\n [\"loopSweep\", \"loop-sweep\", { property: \"_loopSweep\", type: \"text\" }],\n [\"segmentRadii\", \"segment-radii\", { property: \"_segmentRadii\", type: \"text\" }],\n [\"taxiRadius\", \"taxi-radius\", { property: \"_taxiRadius\", type: \"text\" }],\n [\"radiusType\", \"radius-type\", { property: \"_radiusType\", type: \"text\" }],\n];\n\n/**\n * The routes of the edges Cytoscape.js does not draw straight (`segments`, `taxi`, an `unbundled-bezier` with\n * control points, a loop) as `bends`, drawn straight through them (`curved` false).\n * @param graph - the core's elements\n * @param read - the edges' cells\n * @param curves - each edge's curve style, in output order\n * @param nodes - the nodes' values\n * @param values - the edges' values; changed in place\n */\nfunction edgeRoutes(\n graph: CyjsGraph,\n read: DrawnRead,\n curves: readonly (StyleValue | null | undefined)[],\n nodes: CyjsTargetStyles,\n values: Record<string, (StyleValue | null)[]>,\n): void {\n const words = new Map(ROUTE_PARTS.map(([key, name, spec]) => [key, drawnColumn(read, name, spec)] as const));\n const nodeAt = new Map<CyjsElement, number>();\n nodes.elements.forEach((el, k) => {\n if (el !== null) {\n nodeAt.set(el, k);\n }\n });\n const geometry = (core: number): CyjsRouteNode | null => routeNode(graph.nodes[core], nodeAt, nodes);\n // an end label's autorotate turns it as the main label's does (cytoscape.js 3.34.3 `calculateLabelAngle`)\n const turned: readonly (readonly [string, (StyleValue | null | undefined)[]])[] = [\n [\"labelRotation\", drawnColumn(read, \"text-rotation\", TEXT_PART)],\n [\"sourceLabelRotation\", drawnColumn(read, \"source-text-rotation\", TEXT_PART)],\n [\"targetLabelRotation\", drawnColumn(read, \"target-text-rotation\", TEXT_PART)],\n ];\n const ends = [drawnColumn(read, \"source-endpoint\", TEXT_PART), drawnColumn(read, \"target-endpoint\", TEXT_PART)];\n const loops = new Map<string, number>();\n const n = read.order.length;\n let routed: (StyleValue | null)[] | null = null;\n for (let k = 0; k < n; k++) {\n const e = read.order[k];\n const between = edgeNodes(graph, e, geometry);\n if (between === null) {\n continue;\n }\n const { src, tgt, loop } = between;\n if (!loop) {\n autorotateLabels(values, turned, k, n, lineDegrees(src.center, tgt.center));\n }\n const edge = routeSettings(words, k, curves[k]);\n const bends = cyjsRoute(edge, src, tgt, loop ? nextLoopIndex(loops, graph.source[e], edge) : 0);\n if (bends !== null) {\n routed ??= values.bends ?? new Array<StyleValue | null>(n).fill(null);\n routed[k] = bends;\n columnOf(values, \"curved\", n)[k] = false;\n }\n if (!loop) {\n edgePorts(edge.curveStyle, [ends[0][k], ends[1][k]], [src, tgt], (p, port) => {\n columnOf(values, p, n)[k] = port;\n });\n }\n }\n if (routed !== null) {\n values.bends = routed;\n }\n}\n\n/**\n * A node's geometry as the routes measure it: its center, its outer size (its border taken in), its box and whether\n * it is an ellipse.\n * @param el - the node\n * @param nodeAt - each node's output index\n * @param nodes - the nodes' values\n * @returns the geometry, or null when the node has no position\n */\nfunction routeNode(\n el: CyjsElement,\n nodeAt: ReadonlyMap<CyjsElement, number>,\n nodes: CyjsTargetStyles,\n): CyjsRouteNode | null {\n const k = nodeAt.get(el);\n const pos = el.json.position;\n if (k === undefined || !isObject(pos) || typeof pos.x !== \"number\" || typeof pos.y !== \"number\") {\n return null;\n }\n const num = (p: string, fallback: number): number => {\n const v = nodes.values[p]?.[k];\n return typeof v === \"number\" ? v : fallback;\n };\n const [w, h, bw] = [num(\"width\", 30), num(\"height\", 30), num(\"borderWidth\", 0)];\n return {\n center: [pos.x, pos.y],\n size: [w + bw, h + bw],\n box: [w, h],\n ellipse: (nodes.values.shape?.[k] ?? \"ellipse\") === \"ellipse\",\n };\n}\n\n/**\n * An edge's two nodes' geometry, and whether it is a loop.\n * @param graph - the core's elements\n * @param e - the edge's core index, below 0 for none\n * @param geometry - a node's geometry\n * @returns the source's and the target's geometry, or null when either is not known\n */\nfunction edgeNodes(\n graph: CyjsGraph,\n e: number,\n geometry: (core: number) => CyjsRouteNode | null,\n): { src: CyjsRouteNode; tgt: CyjsRouteNode; loop: boolean } | null {\n if (e < 0) {\n return null;\n }\n const loop = graph.source[e] === graph.target[e];\n const src = geometry(graph.source[e]);\n const tgt = loop ? src : geometry(graph.target[e]);\n return src === null || tgt === null ? null : { src, tgt, loop };\n}\n\n/**\n * Turns each of an edge's labels set to `autorotate` along its line.\n * @param values - the edges' values; changed in place\n * @param turned - each label's rotation property and its `text-rotation` words\n * @param k - the edge's output index\n * @param n - the edge count\n * @param degrees - the line's turn\n */\nfunction autorotateLabels(\n values: Record<string, (StyleValue | null)[]>,\n turned: readonly (readonly [string, (StyleValue | null | undefined)[]])[],\n k: number,\n n: number,\n degrees: number,\n): void {\n for (const [property, column] of turned) {\n if (column[k] === \"autorotate\") {\n columnOf(values, property, n)[k] = degrees;\n }\n }\n}\n\n/**\n * A loop's place among the loops drawn before it on the same node in the same direction and sweep, which fans them.\n * @param loops - how many loops each node, direction and sweep has so far; changed in place\n * @param source - the loop's node\n * @param edge - the loop's settings\n * @returns its place, from 0\n */\nfunction nextLoopIndex(loops: Map<string, number>, source: number, edge: CyjsRouteEdge): number {\n const key = `${String(source)} ${String(edge.loopDirection)} ${String(edge.loopSweep)}`;\n const index = loops.get(key) ?? 0;\n loops.set(key, index + 1);\n return index;\n}\n\n/**\n * Where an edge's ends meet its nodes, when not where the line from the centers crosses the outlines (cytoscape.js\n * 3.34.3 `findEndpoints`, `manualEndptToPx`): `inside-to-node` at the center, `x y` offsets from the center (pixels,\n * or percentages of the node's outer size), an angle clockwise from 12 o'clock on the outline. A `haystack` edge\n * runs between points `haystack-radius` of the way from the centers to the outlines in a random direction\n * (`findHaystackPoints`), drawn from the centers, where a radius of 0 (the default) puts them; a taxi edge ignores its\n * endpoints.\n * ponytail: an angle meets a polygon's outline where it meets its box; per-shape outlines if a file angles one\n * @param curve - the curve style\n * @param words - the source endpoint and the target endpoint, as Cytoscape.js spells them\n * @param nodes - the source's and the target's geometry\n * @param put - sets `sourcePort` or `targetPort`\n */\nfunction edgePorts(\n curve: string,\n words: readonly (StyleValue | null | undefined)[],\n nodes: readonly [CyjsRouteNode, CyjsRouteNode],\n put: (property: string, port: string) => void,\n): void {\n if (curve === \"taxi\" || curve === \"round-taxi\") {\n return;\n }\n ([\"sourcePort\", \"targetPort\"] as const).forEach((p, a) => {\n const port = curve === \"haystack\" ? \"0,0\" : endpointPort(String(words[a] ?? \"\"), nodes[a]);\n if (port !== null) {\n put(p, port);\n }\n });\n}\n\n/**\n * One `source-endpoint` / `target-endpoint` as a neutral port.\n * @param text - the value\n * @param node - the node's geometry\n * @returns the port, or null where the line meets the outline as it does by default\n */\nfunction endpointPort(text: string, node: CyjsRouteNode): string | null {\n const t = text.trim();\n if (t === \"inside-to-node\") {\n return \"0,0\";\n }\n const parts = t.split(/\\s+/);\n const [w, h] = node.size;\n const r6 = (v: number): string => String(Math.round(v * 1e6) / 1e6 + 0);\n const fraction = (part: string, size: number): number | null => {\n const m = /^(-?(?:\\d+(?:\\.\\d*)?|\\.\\d+))(%|px)?$/.exec(part);\n if (m === null || Number.isNaN(size) || size <= 0) {\n return null;\n }\n const px = m[2] === \"%\" ? (Number(m[1]) / 100) * size : Number(m[1]);\n return px / (size / 2);\n };\n if (parts.length === 2) {\n const [x, y] = [fraction(parts[0], w), fraction(parts[1], h)];\n return x === null || y === null ? null : `${r6(x)},${r6(-y)}`;\n }\n const m = /^(-?(?:\\d+(?:\\.\\d*)?|\\.\\d+))(deg|rad)$/.exec(t);\n if (m === null) {\n return null;\n }\n const turn = m[2] === \"deg\" ? (Number(m[1]) * Math.PI) / 180 : Number(m[1]);\n // the direction in half sizes, y up, from 12 o'clock clockwise; scaled until it meets the outline\n const [dx, dy] = [Math.sin(turn) / (w / 2), Math.cos(turn) / (h / 2)];\n const reach = node.ellipse ? Math.hypot(dx, dy) : Math.max(Math.abs(dx), Math.abs(dy));\n return reach > 0 ? `${r6(dx / reach)},${r6(dy / reach)}` : null;\n}\n\n/**\n * One edge's routing settings.\n * @param words - each setting's values, in output order\n * @param k - the edge's output index\n * @param curve - its curve style\n * @returns the settings\n */\nfunction routeSettings(\n words: ReadonlyMap<keyof CyjsRouteEdge, readonly (StyleValue | null | undefined)[]>,\n k: number,\n curve: StyleValue | null | undefined,\n): CyjsRouteEdge {\n const text = (key: keyof CyjsRouteEdge): string | null => {\n const v = words.get(key)?.[k];\n return v === null || v === undefined ? null : String(v);\n };\n const num = (key: keyof CyjsRouteEdge): number | null => {\n const v = text(key);\n return v === null ? null : Number(v);\n };\n return {\n curveStyle: String(curve ?? \"haystack\"),\n segmentDistances: text(\"segmentDistances\"),\n segmentWeights: text(\"segmentWeights\"),\n controlPointDistances: text(\"controlPointDistances\"),\n controlPointWeights: text(\"controlPointWeights\"),\n controlPointStepSize: num(\"controlPointStepSize\"),\n taxiDirection: text(\"taxiDirection\"),\n taxiTurn: text(\"taxiTurn\"),\n taxiTurnMinDistance: num(\"taxiTurnMinDistance\"),\n edgeDistances: text(\"edgeDistances\"),\n loopDirection: text(\"loopDirection\"),\n loopSweep: text(\"loopSweep\"),\n segmentRadii: text(\"segmentRadii\"),\n taxiRadius: text(\"taxiRadius\"),\n radiusType: text(\"radiusType\"),\n };\n}\n\n/** A padding read as Cytoscape.js spells it. */\nconst TEXT_PART: CyjsPropertySpec = { property: \"_text\", type: \"text\" };\n\n/**\n * A node's size as Cytoscape.js draws it: a node that is no compound parent is drawn `padding` larger on every side\n * (cytoscape.js 3.34.3 draws its shape `width() + 2 * padding()` across).\n * @param graph - the core's elements\n * @param read - the nodes' cells\n * @param values - the nodes' values; changed in place\n */\nfunction nodeSizes(graph: CyjsGraph, read: DrawnRead, values: Record<string, (StyleValue | null)[]>): void {\n const padding = drawnColumn(read, \"padding\", TEXT_PART);\n const toLabel = ([\"width\", \"height\"] as const).map((p) => drawnColumn(read, p, SIZE_PART));\n const n = read.order.length;\n const col = (p: string): (StyleValue | null)[] => (values[p] ??= new Array<StyleValue | null>(n).fill(null));\n for (let k = 0; k < n; k++) {\n const core = read.order[k];\n const pad = core < 0 || graph.children[core].length > 0 ? 0 : paddingOf(padding[k]);\n const fitted = toLabel.map((c) => c[k] === \"label\");\n if (fitted[0] || fitted[1]) {\n // `width: label` sizes the node to its label's box (cytoscape.js 3.34.3 `width()` reads the label's\n // width), padding on each side: the label's side is a minimum of 0, the other keeps its own size\n col(\"labelFit\")[k] = \"bounds\";\n col(\"labelPaddingX\")[k] = pad;\n col(\"labelPaddingY\")[k] = pad;\n [\"width\", \"height\"].forEach((p, a) => {\n const v = values[p]?.[k];\n const side = typeof v === \"number\" ? v : 30;\n col(p)[k] = fitted[a] ? 0 : side + 2 * pad;\n });\n continue;\n }\n if (pad <= 0) {\n continue;\n }\n for (const p of [\"width\", \"height\"]) {\n const v = values[p]?.[k];\n col(p)[k] = (typeof v === \"number\" ? v : 30) + 2 * pad;\n }\n }\n}\n\n/** The label alignments read as Cytoscape.js's words. */\nconst VALIGN_PART: CyjsPropertySpec = {\n property: \"_valign\",\n type: \"enum\",\n enums: [\"top\", \"top-inside\", \"center\", \"bottom\", \"bottom-inside\"],\n};\nconst HALIGN_PART: CyjsPropertySpec = {\n property: \"_halign\",\n type: \"enum\",\n enums: [\"left\", \"left-inside\", \"center\", \"right\", \"right-inside\"],\n};\n\n/**\n * Where Cytoscape.js pins a label on one axis (cytoscape.js 3.34.3 `recalculateNodeLabelProjection` and\n * `labelHalign` / `labelValign`): outside, `padding` past the node's side with the label's far edge there; inside,\n * `padding` short of it with the label's near edge there; centered, at the node's middle.\n * @param align - the alignment (`left`, `left-inside`, `top`, ...)\n * @param half - half the node's drawn size on that axis, `padding` included\n * @param pad - the node's padding\n * @returns the offset from the node's center and the shift by the label's own size\n */\nfunction pinnedAxis(align: string, half: number, pad: number): { offset: number; shift: number } {\n const near = /^(left|top)/.test(align);\n if (!near && !/^(right|bottom)/.test(align)) {\n return { offset: 0, shift: 0 };\n }\n const side = near ? -1 : 1;\n return align.endsWith(\"-inside\")\n ? { offset: side * (half - 2 * pad), shift: -side / 2 }\n : { offset: side * half, shift: side / 2 };\n}\n\n/**\n * A node label with one alignment inside the node and the other outside it (`text-valign: bottom-inside` with\n * `text-halign: left`): no neutral position says that, so the label is centered, moved to the point Cytoscape.js\n * puts it at by `labelOffsetX` / `labelOffsetY` (its `text-margin` added) and pinned there by `labelShiftX` /\n * `labelShiftY`. A node sized to its label keeps the outside side's position, noted.\n * @param graph - the core's elements\n * @param read - the nodes' cells\n * @param values - the nodes' values, sizes already drawn (`nodeSizes`); changed in place\n */\nfunction mixedLabelPlaces(graph: CyjsGraph, read: DrawnRead, values: Record<string, (StyleValue | null)[]>): void {\n const va = drawnColumn(read, \"text-valign\", VALIGN_PART);\n const ha = drawnColumn(read, \"text-halign\", HALIGN_PART);\n const padding = drawnColumn(read, \"padding\", TEXT_PART);\n const n = read.order.length;\n const col = (p: string): (StyleValue | null)[] => (values[p] ??= new Array<StyleValue | null>(n).fill(null));\n for (let k = 0; k < n; k++) {\n const v = typeof va[k] === \"string\" ? String(va[k]) : \"top\";\n const h = typeof ha[k] === \"string\" ? String(ha[k]) : \"center\";\n const inside = v.endsWith(\"-inside\") || h.endsWith(\"-inside\");\n const outside = v === \"top\" || v === \"bottom\" || h === \"left\" || h === \"right\";\n if (!inside || !outside) {\n continue;\n }\n if (values.labelFit?.[k] !== undefined && values.labelFit[k] !== null) {\n read.notes.add(STYLE_ISSUE.APPROXIMATED, \"node\", \"labelPosition\", { sample: `${v} ${h}`, element: k });\n continue;\n }\n const core = read.order[k];\n const pad = core < 0 || graph.children[core].length > 0 ? 0 : paddingOf(padding[k]);\n const size = (p: string): number => {\n const s = values[p]?.[k];\n return typeof s === \"number\" ? s : 30 + 2 * pad;\n };\n const x = pinnedAxis(h, size(\"width\") / 2, pad);\n const y = pinnedAxis(v, size(\"height\") / 2, pad);\n const add = (p: string, d: number): void => {\n const was = values[p]?.[k];\n col(p)[k] = (typeof was === \"number\" ? was : 0) + d;\n };\n col(\"labelPosition\")[k] = \"center\";\n add(\"labelOffsetX\", x.offset);\n add(\"labelOffsetY\", y.offset);\n col(\"labelShiftX\")[k] = x.shift;\n col(\"labelShiftY\")[k] = y.shift;\n }\n}\n\n/** A node size read as Cytoscape.js's word, so `label` is seen. */\nconst SIZE_PART: CyjsPropertySpec = { property: \"_size\", type: \"nodeSize\" };\n\n/**\n * A node's padding in pixels. A percentage is relative only on a compound parent; on any other node Cytoscape.js\n * draws its fraction as pixels (`padding()` returns the property's `pfValue`, 0.2 for `20%`).\n * @param text - the padding as Cytoscape.js spells it, or null\n * @returns the pixels, 0 for none\n */\nfunction paddingOf(text: StyleValue | null | undefined): number {\n if (typeof text !== \"string\") {\n return 0;\n }\n const x = Number.parseFloat(text);\n if (!Number.isFinite(x) || x <= 0) {\n return 0;\n }\n return text.trim().endsWith(\"%\") ? x / 100 : x;\n}\n\n/** The curve style read as Cytoscape.js's word. */\nconst CURVE_PART: CyjsPropertySpec = { property: \"_curve\", type: \"enum\", enums: CYJS_CURVE_STYLES };\n\n/**\n * Cytoscape.js draws no source or target arrow on a `haystack` edge, its default curve style (cytoscape.js 3.34.3\n * `drawArrowheads` skips them on haystacks, but still draws the mid arrows): each end arrow of one is `none`.\n * @param curves - each edge's curve style, null where no rule sets it\n * @param values - the values; changed in place\n */\nfunction noArrowsOnHaystacks(\n curves: readonly (StyleValue | null | undefined)[],\n values: Record<string, (StyleValue | null)[]>,\n): void {\n const n = curves.length;\n for (const p of [\"targetArrow\", \"sourceArrow\"]) {\n const col = values[p];\n if (col === undefined) {\n continue;\n }\n for (let i = 0; i < n; i++) {\n if ((curves[i] ?? \"haystack\") === \"haystack\" && col[i] !== null) {\n col[i] = \"none\";\n }\n }\n }\n}\n\n/**\n * The outline arrow a hollow `*-arrow-fill` draws for each filled shape that has one (cytoscape.js 3.34.3 strokes the\n * arrow's path instead of filling it). A hollow square has no outline cap of its own in the neutral vocabulary;\n * `other:open-square` is drawn as the nearest one.\n */\nconst HOLLOW_ARROWS: ReadonlyMap<StyleValue, string> = new Map([\n [\"triangle\", \"triangle-open\"],\n [\"diamond\", \"diamond-open\"],\n [\"circle\", \"circle-open\"],\n [\"square\", \"other:open-square\"],\n]);\n\n/**\n * A rule that sets an arrow shape and makes it hollow sets the outline shape (`combineArrowFills` does the same per\n * element, for a fill and a shape set by different rules).\n * @param set - the rule's values; changed in place\n * @param all - every property of the rule\n */\nfunction hollowArrowsOfRule(set: Record<string, StyleValue>, all: readonly EntryProperty[]): void {\n for (const p of all) {\n const shapeProp = /^_(\\w+Arrow)Fill$/.exec(p.spec.property)?.[1];\n const shape = shapeProp === undefined ? undefined : set[shapeProp];\n if (shapeProp === undefined || shape === undefined || p.parsed.kind !== \"word\") {\n continue;\n }\n const open = HOLLOW_ARROWS.get(shape);\n if (open !== undefined && p.parsed.value === \"hollow\") {\n set[shapeProp] = open;\n }\n }\n}\n\n/**\n * Turns each arrow whose `*-arrow-fill` is `hollow` into its outline shape. A hollow arrow the vocabulary has no\n * outline shape for keeps its filled shape and is noted.\n * @param n - the element count\n * @param words - the parts by internal name\n * @param values - the values; changed in place\n * @param notes - where a hollow arrow drawn filled is noted\n */\nfunction combineArrowFills(\n n: number,\n words: ReadonlyMap<string, (string | null)[]>,\n values: Record<string, (StyleValue | null)[]>,\n notes: StyleNotes,\n): void {\n for (const p of [\"targetArrow\", \"sourceArrow\", \"midTargetArrow\", \"midSourceArrow\"]) {\n const fill = words.get(`_${p}Fill`);\n const shapes = values[p];\n if (fill === undefined || shapes === undefined) {\n continue;\n }\n for (let i = 0; i < n; i++) {\n const shape = shapes[i];\n if (fill[i] !== \"hollow\" || shape === null || shape === \"none\") {\n continue;\n }\n const open = HOLLOW_ARROWS.get(shape);\n if (open !== undefined) {\n shapes[i] = open;\n } else if (!String(shape).includes(\"open\")) {\n const property = p.replaceAll(/[A-Z]/g, (c) => `-${c.toLowerCase()}`).replace(\"-arrow\", \"-arrow-fill\");\n notes.add(STYLE_ISSUE.NOT_CARRIED, \"edge\", property, { sample: `hollow ${String(shape)}`, element: i });\n }\n }\n }\n}\n\n/**\n * A node label's position from its vertical and horizontal alignments. Cytoscape.js 3.34 places an `-inside`\n * alignment against that side of the node, inside it (`recalculateNodeLabelProjection`): `top-inside` with\n * `center` is `inside-top`, `top-inside` with `left-inside` is `inside-top-left`. One inside and one outside\n * alignment have no neutral position of their own: the outside side here, its inside part read as centered, which\n * `mixedLabelPlaces()` replaces with the pinned place once the node's size is known.\n * @param v - the vertical alignment, or null\n * @param h - the horizontal alignment, or null\n * @returns the position, or null\n */\nfunction labelPosition(v: string | null, h: string | null): StyleValue | null {\n if (v === null && h === null) {\n return null;\n }\n const vIn = (v ?? \"\").endsWith(\"-inside\");\n const hIn = (h ?? \"\").endsWith(\"-inside\");\n const vv = (v ?? \"top\").replace(\"-inside\", \"\");\n const hh = (h ?? \"center\").replace(\"-inside\", \"\");\n if (vIn || hIn) {\n const vOut = vv !== \"center\" && !vIn;\n const hOut = hh !== \"center\" && !hIn;\n if (!vOut && !hOut) {\n return INSIDE_POSITIONS.get(`${vv},${hh}`) ?? null;\n }\n return POSITIONS.get(`${vIn ? \"center\" : vv},${hIn ? \"center\" : hh}`) ?? null;\n }\n return POSITIONS.get(`${vv},${hh}`) ?? null;\n}\n\n// ============================================================ rules\n\n/**\n * The stylesheet as neutral rules over graph-io's columns and the style columns it adds.\n * @param kind - the target\n * @param applied - the entries with their matched elements and properties\n * @param core - the core's elements, the core element of each output index and the output index of each core element\n * (or -1)\n * @param core.els - the core's elements\n * @param core.order - the core element of each output index\n * @param core.coreToOut - the output index of each core element, or -1\n * @param input - the input (the graph, the rendered values)\n * @param truth - what is drawn per property, by output index\n * @param env - the evaluator (degrees), where problems are noted and how the budget is spent\n * @param env.matcher - the evaluator\n * @param env.notes - where problems are noted\n * @param env.spend - spends from the budget\n * @returns the rules, the style columns and the data columns they read\n */\nfunction buildRules(\n kind: StyleTarget,\n applied: readonly { entry: Entry; list: readonly number[]; props: EntryProperty[] }[],\n core: { readonly els: readonly CyjsElement[]; readonly order: Int32Array; readonly coreToOut: Int32Array },\n input: CyjsStyleInput,\n truth: Readonly<Record<string, readonly (StyleValue | null)[]>>,\n env: { readonly matcher: Matcher; readonly notes: StyleNotes; readonly spend: (ops: number) => void },\n): { rules: StyleRule[]; columns: Map<string, StyleColumn>; rawColumns: string[] } {\n const { els, order, coreToOut } = core;\n const { matcher, notes, spend } = env;\n const out = order.length;\n const columns = new Map<string, StyleColumn>();\n const raw = new Set<string>();\n const ctx: RuleContext = {\n kind,\n els,\n coreToOut,\n out,\n snapshot: input.snapshot,\n truth: input.rendered === undefined ? null : truth,\n matcher,\n notes,\n spend,\n columns,\n raw,\n members: new Map(),\n faithful: new Map(),\n degrees: new Map(),\n };\n const drafts: Draft[] = [];\n for (const a of applied) {\n const props = a.props.filter((p) => !p.spec.property.startsWith(\"_\"));\n if (props.length === 0 || a.list.length === 0) {\n continue;\n }\n drafts.push(draftOf(ctx, a.entry, a.list, props, a.props));\n }\n const rules = collapse(ctx, drafts);\n return { rules, columns, rawColumns: [...raw] };\n}\n\n/** The state shared while rules are built. */\ninterface RuleContext {\n readonly kind: StyleTarget;\n readonly els: readonly CyjsElement[];\n readonly coreToOut: Int32Array;\n readonly out: number;\n readonly snapshot: GraphSnapshot | undefined;\n /** What a live core drew, when given: the values a function-valued property is copied from. */\n readonly truth: Readonly<Record<string, readonly (StyleValue | null)[]>> | null;\n readonly matcher: Matcher;\n readonly notes: StyleNotes;\n readonly spend: (ops: number) => void;\n readonly columns: Map<string, StyleColumn>;\n readonly raw: Set<string>;\n readonly members: Map<string, string>;\n readonly faithful: Map<string, boolean>;\n readonly degrees: Map<string, boolean>;\n}\n\n/** A rule with what collapsing needs. */\ninterface Draft {\n /** Builds the rule (and its predicate's column) when it stays a rule of its own. */\n readonly rule: () => StyleRule;\n /** The rule's id. */\n readonly id: string;\n /** Its constants. */\n readonly set: Readonly<Record<string, StyleValue>>;\n /** Cytoscape.js's own default rule. */\n readonly tool: boolean;\n /** For a rule of one class, one id or one value test that only sets values: its kind and key. */\n readonly single: { readonly sig: string; readonly key: Scalar } | null;\n /** The matched core elements. */\n readonly list: readonly number[];\n}\n\n/**\n * One entry as a rule.\n * @param ctx - the shared state\n * @param entry - the entry\n * @param list - the matched core elements\n * @param props - the carried properties\n * @param all - every property of the entry, the parts combined afterward too\n * @returns the draft\n */\nfunction draftOf(\n ctx: RuleContext,\n entry: Entry,\n list: readonly number[],\n props: readonly EntryProperty[],\n all: readonly EntryProperty[],\n): Draft {\n const setting = new Map<string, StyleValue>();\n const mapping = new Map<string, Mapping>();\n let flattened = false;\n const id = entry.tool\n ? `${ctx.kind}.cytoscape-js.${String(entry.index + CYJS_DEFAULT_STYLESHEET.length)}`\n : `${ctx.kind}.sheet.${String(entry.index)}`;\n for (const p of props) {\n // a later duplicate of a property replaces the earlier one\n setting.delete(p.spec.property);\n mapping.delete(p.spec.property);\n const v = p.parsed;\n if (v.kind === \"fn\") {\n const copied = functionCopy(ctx, entry, list, p.spec.property);\n if (copied !== null) {\n mapping.set(p.spec.property, copied);\n flattened = true;\n }\n } else if (isFlat(v)) {\n const neutral = cyjsNeutral(p.spec, v, {\n notes: new StyleNotes(),\n target: ctx.kind,\n property: p.spec.property,\n });\n if (neutral !== undefined) {\n setting.set(p.spec.property, neutral);\n }\n } else {\n mapping.set(p.spec.property, mapperMapping(ctx, entry, list, p));\n }\n }\n const set: Record<string, StyleValue> = Object.fromEntries(setting);\n if (ctx.kind === \"node\") {\n cyjsPolygonShapes(set);\n } else {\n hollowArrowsOfRule(set, all);\n }\n const map = Object.fromEntries(mapping);\n const hasMap = mapping.size > 0;\n // the predicate is built only for a rule that is not collapsed into a run: a run's rules need no column each\n const rule = (): StyleRule => {\n const where = predicateOf(ctx, entry, list);\n return {\n id,\n target: ctx.kind,\n role: roleOf(hasMap, where),\n origin: entry.tool ? \"tool\" : \"declared\",\n where,\n ...(setting.size > 0 ? { set } : {}),\n ...(hasMap ? { map } : {}),\n facts: flattened ? { elements: list.length, reason: \"FUNCTION\" } : { elements: list.length },\n };\n };\n return {\n rule,\n id,\n set,\n tool: entry.tool,\n single: hasMap || entry.tool ? null : singleTest(entry.selector, ctx.kind),\n list,\n };\n}\n\n/**\n * A function-valued property: its values as the live core drew them, copied per element into a style column.\n * @param ctx - the shared state\n * @param entry - the entry\n * @param list - the matched core elements\n * @param property - the neutral property\n * @returns the passthrough of the copy, or null without a live core's values\n */\nfunction functionCopy(ctx: RuleContext, entry: Entry, list: readonly number[], property: string): Mapping | null {\n const drawn = ctx.truth?.[property];\n if (drawn === undefined) {\n return null;\n }\n const key = `function.${String(entry.index)}.${property}`;\n const col = new Array<StyleValue | null>(ctx.out).fill(null);\n for (const i of list) {\n const k = ctx.coreToOut[i];\n if (k >= 0) {\n col[k] = drawn[k];\n }\n }\n ctx.columns.set(key, col);\n return { kind: \"passthrough\", by: { style: key } };\n}\n\n/**\n * A rule's role from what it does.\n * @param hasMap - whether it maps values\n * @param where - its predicate\n * @returns \"mapping\", \"defaults\" (constants on every element) or \"group\"\n */\nfunction roleOf(hasMap: boolean, where: Predicate): string {\n if (hasMap) {\n return \"mapping\";\n }\n return \"all\" in where ? \"defaults\" : \"group\";\n}\n\n/**\n * The varying test of a single-query selector, for collapsing runs: its last class, id or value test, with the other\n * tests (a shared scope such as `[graphty_import = \"a\"]`) in the signature so a run only joins rules that agree on them.\n * @param sel - the selector\n * @param kind - the target\n * @returns the run signature and the rule's key, or null\n */\nfunction singleTest(sel: CyjsSelector, kind: StyleTarget): { sig: string; key: Scalar } | null {\n if (sel.invalid || sel.queries.length !== 1) {\n return null;\n }\n const checks = sel.queries[0].checks.filter(\n (c) => !(c.type === \"group\" && (c.value === \"*\" || c.value === `${kind}s`)),\n );\n const c = checks.at(-1);\n if (c === undefined || checks.slice(0, -1).some((x) => x.type !== \"compare\" && x.type !== \"class\")) {\n return null;\n }\n const context = JSON.stringify(checks.slice(0, -1));\n if (c.type === \"class\" && typeof c.value === \"string\") {\n return { sig: `class\\u0000${context}`, key: c.value };\n }\n if (c.type === \"id\") {\n return { sig: `id\\u0000${context}`, key: c.value };\n }\n if (c.type === \"compare\" && c.op === \"=\" && !c.not && !c.ci) {\n return { sig: `eq\\u0000${context}\\u0000${c.field}`, key: c.value };\n }\n return null;\n}\n\n/**\n * Whether graph-io's column holds exactly what a selector reads for every element: the same value (`===`) where the\n * raw data has a scalar, nothing where it has none, and no raw null or false (a selector sees those, a column does\n * not).\n * @param ctx - the shared state\n * @param field - the field\n * @returns true when a predicate over the column selects what the selector selects\n */\nfunction faithful(ctx: RuleContext, field: string): boolean {\n const known = ctx.faithful.get(field);\n if (known !== undefined) {\n return known;\n }\n let ok = ctx.snapshot !== undefined;\n const table = ctx.kind === \"node\" ? ctx.snapshot?.nodes : ctx.snapshot?.edges;\n const has = table?.names().includes(field) ?? false;\n for (let c = 0; ok && c < ctx.els.length; c++) {\n const k = ctx.coreToOut[c];\n const rv = selectorField(ctx.els[c], field);\n if (rv === null || rv === false) {\n ok = false;\n break;\n }\n const gv = k >= 0 && has && table !== undefined ? plainCell(table.value(field, k)) : null;\n if (rv === undefined ? gv !== null : rv !== gv) {\n ok = false;\n }\n }\n ctx.spend(ctx.els.length);\n ctx.faithful.set(field, ok);\n return ok;\n}\n\n/**\n * Whether the graph's degree equals Cytoscape.js's for every node.\n * @param ctx - the shared state\n * @param which - the degree\n * @returns true when a predicate over the computed degree selects what the selector selects\n */\nfunction degreeAgrees(ctx: RuleContext, which: \"degree\" | \"indegree\" | \"outdegree\"): boolean {\n const known = ctx.degrees.get(which);\n if (known !== undefined) {\n return known;\n }\n let ok = ctx.snapshot !== undefined && ctx.kind === \"node\" && (which === \"degree\" || ctx.snapshot.directed);\n if (ok && ctx.snapshot !== undefined) {\n const mine = degreeValues(ctx.snapshot, which);\n for (let c = 0; c < ctx.els.length; c++) {\n const k = ctx.coreToOut[c];\n if (k < 0 || mine[k] !== ctx.matcher[which][c]) {\n ok = false;\n break;\n }\n }\n ok &&= ctx.els.length === ctx.out;\n }\n ctx.degrees.set(which, ok);\n return ok;\n}\n\n/**\n * A selector as a short predicate when one expresses it exactly, else a membership style column.\n * @param ctx - the shared state\n * @param entry - the entry\n * @param list - the matched core elements\n * @returns the predicate\n */\nfunction predicateOf(ctx: RuleContext, entry: Entry, list: readonly number[]): Predicate {\n const short = shortPredicate(ctx, entry.selector);\n if (short !== null) {\n return short;\n }\n if (list.length === ctx.els.length && ctx.els.length === ctx.out) {\n return { all: true };\n }\n const sig = `${entry.tool ? \"tool\" : \"file\"}\\u0000${entry.text}`;\n let key = ctx.members.get(sig);\n if (key === undefined) {\n key = `member.${String(ctx.members.size + 1)}`;\n ctx.members.set(sig, key);\n const col = new Array<StyleValue | null>(ctx.out).fill(null);\n for (const i of list) {\n const k = ctx.coreToOut[i];\n if (k >= 0) {\n col[k] = true;\n }\n }\n ctx.spend(ctx.out + list.length);\n ctx.columns.set(key, col);\n ctx.notes.add(STYLE_ISSUE.SELECTOR_AS_COLUMN, ctx.kind, key, { sample: entry.text });\n }\n return { has: { style: key } };\n}\n\n/**\n * The short predicate of a selector, or null: every query of one alternative with at most 8 tests, each a group,\n * a value test or an existence test over a column graph-io holds exactly, or a degree test the graph computes the\n * same way; several alternatives only as equal tests of one field (`in`).\n * @param ctx - the shared state\n * @param sel - the selector\n * @returns the predicate, or null\n */\nfunction shortPredicate(ctx: RuleContext, sel: CyjsSelector): Predicate | null {\n if (sel.invalid) {\n return null;\n }\n const alts: Predicate[][] = [];\n for (const q of sel.queries) {\n const terms = queryTerms(ctx, q);\n if (terms === null) {\n return null;\n }\n if (terms !== \"never\") {\n alts.push(terms);\n }\n }\n if (alts.length === 0) {\n return null;\n }\n if (alts.some((t) => t.length === 0)) {\n return ctx.els.length === ctx.out ? { all: true } : null;\n }\n if (alts.length === 1) {\n const t = alts[0];\n if (t.length > 8) {\n return null;\n }\n return t.length === 1 ? t[0] : { and: t };\n }\n return equalTests(alts);\n}\n\n/**\n * A query's checks as short predicate terms.\n * @param ctx - the shared state\n * @param q - the query\n * @returns the terms; \"never\" when its group test excludes the target; null when a check has no short term\n */\nfunction queryTerms(ctx: RuleContext, q: CyjsQuery): Predicate[] | \"never\" | null {\n const terms: Predicate[] = [];\n let never = false;\n for (const c of q.checks) {\n if (c.type === \"group\") {\n never ||= c.value !== \"*\" && c.value !== `${ctx.kind}s`;\n continue;\n }\n const t = termOf(ctx, c);\n if (t === null) {\n return null;\n }\n terms.push(t);\n }\n return never ? \"never\" : terms;\n}\n\n/**\n * Several alternatives as one `in` predicate: only equal tests of one column, at most 8.\n * @param alts - the alternatives' terms\n * @returns the predicate, or null\n */\nfunction equalTests(alts: readonly Predicate[][]): Predicate | null {\n if (alts.length > 8 || !alts.every((t) => t.length === 1 && \"eq\" in t[0])) {\n return null;\n }\n const by = (alts[0][0] as { eq: readonly [ColumnRef, Scalar] }).eq[0];\n const values: Scalar[] = [];\n for (const t of alts) {\n const [r, v] = (t[0] as { eq: readonly [ColumnRef, Scalar] }).eq;\n if (JSON.stringify(r) !== JSON.stringify(by)) {\n return null;\n }\n values.push(v);\n }\n return { in: [by, values] };\n}\n\n/**\n * One check as a short predicate term, or null.\n * @param ctx - the shared state\n * @param c - the check\n * @returns the term, or null\n */\nfunction termOf(ctx: RuleContext, c: CyjsCheck): Predicate | null {\n switch (c.type) {\n case \"compare\":\n if (c.op !== \"=\" || c.ci || !faithful(ctx, c.field)) {\n return null;\n }\n return c.not ? { not: { eq: [{ data: c.field }, c.value] } } : { eq: [{ data: c.field }, c.value] };\n case \"exist\":\n return faithful(ctx, c.field) ? { has: { data: c.field } } : null;\n case \"bool\":\n return c.op === \"^\" && faithful(ctx, c.field) ? { not: { has: { data: c.field } } } : null;\n case \"meta\":\n if (c.ci || !degreeAgrees(ctx, c.field)) {\n return null;\n }\n return degreeTerm(c.field, c.op, c.not, c.value);\n default:\n return null;\n }\n}\n\n/**\n * A degree test as a predicate over the computed degree, so it follows later edits: `=` as `eq`, and an order test\n * as the degrees it keeps or the degrees it leaves out (degrees are whole numbers from 0), at most 8 of them.\n * @param field - the degree\n * @param op - the comparison\n * @param not - whether the test is negated\n * @param value - the number compared with\n * @returns the predicate, or null when it needs more than 8 values\n */\nfunction degreeTerm(\n field: \"degree\" | \"indegree\" | \"outdegree\",\n op: string,\n not: boolean,\n value: number,\n): Predicate | null {\n const ref: ColumnRef = { computed: field };\n if (op === \"=\") {\n return not ? { not: { eq: [ref, value] } } : { eq: [ref, value] };\n }\n // The whole numbers from 0 the test leaves out (`>`, `>=`) or keeps (`<`, `<=`).\n let below: number;\n if (op === \">\" || op === \"<=\") {\n below = Math.floor(value) + 1;\n } else if (op === \">=\" || op === \"<\") {\n below = Math.ceil(value);\n } else {\n return null;\n }\n if (!Number.isFinite(below) || below < 1 || below > 8) {\n return null;\n }\n const values = Array.from({ length: below }, (_, k) => k);\n const keeps = op === \"<\" || op === \"<=\";\n const inSet: Predicate = { in: [ref, values] };\n return keeps !== not ? inSet : { not: inSet };\n}\n\n/**\n * A mapper as a neutral mapping over graph-io's column when that gives Cytoscape.js's values for every element the\n * rule applies to, else the mapper's per-element values as a style column (`value.<rule>.<property>`).\n * @param ctx - the shared state\n * @param entry - the entry\n * @param list - the matched core elements\n * @param p - the property\n * @returns the mapping\n */\nfunction mapperMapping(ctx: RuleContext, entry: Entry, list: readonly number[], p: EntryProperty): Mapping {\n const v = p.parsed as CyjsParsed & { kind: \"data\" | \"mapData\" };\n const want = new Array<StyleValue | null>(list.length);\n const site: CanonSite = { notes: new StyleNotes(), target: ctx.kind, property: p.spec.property };\n for (let k = 0; k < list.length; k++) {\n const c = cellFor(p, ctx.els[list[k]]);\n const neutral = neutralOfCell(p.spec, p.name, c, site);\n want[k] = neutral ?? null;\n }\n ctx.spend(list.length * 2);\n const candidate = candidateMapping(ctx, v, p);\n if (candidate !== null && ctx.snapshot !== undefined) {\n const exact = givesWanted(\n ctx,\n ctx.snapshot,\n candidate,\n { field: v.field, property: p.spec.property },\n list,\n want,\n );\n ctx.spend(list.length);\n if (exact) {\n ctx.raw.add(v.field);\n return candidate;\n }\n }\n const key = `value.${entry.tool ? \"tool\" : String(entry.index)}.${p.spec.property}`;\n const col = new Array<StyleValue | null>(ctx.out).fill(null);\n for (let k = 0; k < list.length; k++) {\n const o = ctx.coreToOut[list[k]];\n if (o >= 0) {\n col[o] = want[k];\n }\n }\n ctx.columns.set(key, col);\n return { kind: \"passthrough\", by: { style: key } };\n}\n\n/**\n * Whether a mapping over graph-io's column gives Cytoscape.js's value for every element a rule applies to.\n * @param ctx - the shared state\n * @param snapshot - the graph\n * @param candidate - the mapping\n * @param what - the column and the neutral property\n * @param what.field - the column\n * @param what.property - the neutral property\n * @param list - the matched core elements\n * @param want - Cytoscape.js's value of each, in list order\n * @returns true when it gives every one\n */\nfunction givesWanted(\n ctx: RuleContext,\n snapshot: GraphSnapshot,\n candidate: (Mapping & { kind: \"passthrough\" }) | (Mapping & { kind: \"continuous\" }),\n what: { readonly field: string; readonly property: string },\n list: readonly number[],\n want: readonly (StyleValue | null)[],\n): boolean {\n const table = ctx.kind === \"node\" ? snapshot.nodes : snapshot.edges;\n if (!table.names().includes(what.field)) {\n return false;\n }\n const canon = canonicalFor(ctx.kind, what.property);\n for (let k = 0; k < list.length; k++) {\n const o = ctx.coreToOut[list[k]];\n const cell = o < 0 ? null : plainCell(table.value(what.field, o));\n let got: StyleValue | null = null;\n if (cell !== null && !Array.isArray(cell)) {\n got = candidate.kind === \"passthrough\" ? canon(cell) : evalContinuous(candidate.points, numberOf(cell));\n }\n if (o >= 0 && got !== want[k]) {\n return false;\n }\n }\n return true;\n}\n\n/**\n * The neutral mapping a mapper would be over its field, before it is checked.\n * @param ctx - the shared state\n * @param v - the mapper\n * @param p - the property\n * @returns a passthrough for `data()`, a two-point continuous mapping for `mapData()`, or null\n */\nfunction candidateMapping(\n ctx: RuleContext,\n v: CyjsParsed & { kind: \"data\" | \"mapData\" },\n p: EntryProperty,\n): (Mapping & { kind: \"passthrough\" }) | (Mapping & { kind: \"continuous\" }) | null {\n if (v.kind === \"data\") {\n return { kind: \"passthrough\", by: { data: v.field } };\n }\n if (v.fieldMin === v.fieldMax) {\n return null;\n }\n const site: CanonSite = { notes: new StyleNotes(), target: ctx.kind, property: p.spec.property };\n const a = cyjsNeutral(p.spec, v.min, site);\n const b = cyjsNeutral(p.spec, v.max, site);\n if (a === undefined || b === undefined) {\n return null;\n }\n const lo: ContinuousPoint = { at: v.fieldMin, below: a, value: a, above: a };\n const hi: ContinuousPoint = { at: v.fieldMax, below: b, value: b, above: b };\n return { kind: \"continuous\", by: { data: v.field }, points: v.fieldMin < v.fieldMax ? [lo, hi] : [hi, lo] };\n}\n\n/**\n * Collapses runs of three or more rules that each test one class, one id or one value of the same field and only set\n * values into ONE mapping rule: per property, a winner column holds the key (class, id or value) of the last rule in\n * the run that matches the element and sets the property (the cascade's winner), and a discrete table maps each key\n * to that rule's value. A run keyed by a value whose column graph-io holds exactly reads that column instead.\n * @param ctx - the shared state\n * @param drafts - the rules in order\n * @returns the rules\n */\nfunction collapse(ctx: RuleContext, drafts: readonly Draft[]): StyleRule[] {\n const out: StyleRule[] = [];\n let run = 0;\n let i = 0;\n while (i < drafts.length) {\n const sig = drafts[i].single?.sig ?? null;\n let j = i + 1;\n while (sig !== null && j < drafts.length && drafts[j].single?.sig === sig) {\n j++;\n }\n if (sig === null || j - i < 3) {\n for (const d of drafts.slice(i, j)) {\n const rule = d.rule();\n // Cytoscape.js's own default rule over every element: the writing tool's constants already say it\n if (!(d.tool && \"all\" in rule.where)) {\n out.push(rule);\n }\n }\n } else {\n run++;\n out.push(runRule(ctx, drafts.slice(i, j), sig, run));\n }\n i = j;\n }\n return out;\n}\n\n/**\n * A run of rules collapsed into one mapping rule.\n * @param ctx - the shared state\n * @param members - the run's rules, in order\n * @param sig - their shared signature\n * @param run - the run's number\n * @returns the rule\n */\nfunction runRule(ctx: RuleContext, members: readonly Draft[], sig: string, run: number): StyleRule {\n const props = new Set(members.flatMap((d) => Object.keys(d.set)));\n // a value run with no shared tests may read the field itself\n const parts = sig.split(\"\\u0000\");\n const field = parts[0] === \"eq\" && parts[1] === \"[]\" ? parts[2] : null;\n const map: Record<string, Mapping> = {};\n for (const p of props) {\n map[p] = runMapping(ctx, members, p, { field, key: `winner.${String(run)}.${p}` });\n }\n const first = members[0].id.split(\".\").pop() ?? \"\";\n return {\n id: `${ctx.kind}.sheet.by.${parts[0] === \"eq\" ? \"value\" : parts[0]}.${first}`,\n target: ctx.kind,\n role: \"mapping\",\n origin: \"declared\",\n where: { all: true },\n map,\n facts: { elements: members.reduce((sum, d) => sum + d.list.length, 0) },\n };\n}\n\n/**\n * One property of a collapsed run: a winner column holds the key of the last rule in the run that matches the\n * element and sets the property (the cascade's winner), and a discrete table maps each key to that rule's value; a\n * run keyed by a value whose column graph-io holds exactly reads that column instead.\n * @param ctx - the shared state\n * @param members - the run's rules, in order\n * @param p - the property\n * @param names - the field a value run tests (null for another run) and the winner column's key\n * @param names.field - the field a value run tests, or null\n * @param names.key - the winner column's key\n * @returns the mapping\n */\nfunction runMapping(\n ctx: RuleContext,\n members: readonly Draft[],\n p: string,\n names: { readonly field: string | null; readonly key: string },\n): Mapping {\n const winner = new Array<StyleValue | null>(ctx.out).fill(null);\n const table = new Map<string, [Scalar, StyleValue]>();\n for (const d of members) {\n const value = (d.set as Record<string, StyleValue | undefined>)[p];\n if (value === undefined || d.single === null) {\n continue;\n }\n const { key } = d.single;\n table.set(`${typeof key}:${String(key)}`, [key, value]);\n for (const c of d.list) {\n const k = ctx.coreToOut[c];\n if (k >= 0) {\n winner[k] = key;\n }\n }\n ctx.spend(d.list.length);\n }\n const entries = [...table.values()];\n // a table key that names a later rule's value: the table maps each key to the last rule's value for it\n const byKey = new Map(entries.map(([k, v]) => [`${typeof k}:${String(k)}`, v]));\n const { field } = names;\n if (field !== null && faithful(ctx, field) && sameByData(ctx, field, winner, byKey)) {\n return { kind: \"discrete\", by: { data: field }, table: entries };\n }\n ctx.columns.set(names.key, winner);\n return { kind: \"discrete\", by: { style: names.key }, table: entries };\n}\n\n/**\n * Whether a discrete table keyed by a column's own values gives every element its winner's value.\n * @param ctx - the shared state\n * @param field - the column\n * @param winner - each element's winning key, or null\n * @param byKey - the table\n * @returns true when reading the column gives the same values\n */\nfunction sameByData(\n ctx: RuleContext,\n field: string,\n winner: readonly (StyleValue | null)[],\n byKey: ReadonlyMap<string, StyleValue>,\n): boolean {\n const table = ctx.kind === \"node\" ? ctx.snapshot?.nodes : ctx.snapshot?.edges;\n if (!table?.names().includes(field)) {\n return false;\n }\n for (let k = 0; k < ctx.out; k++) {\n const v = plainCell(table.value(field, k));\n const viaData =\n typeof v === \"string\" || typeof v === \"number\" ? (byKey.get(`${typeof v}:${String(v)}`) ?? null) : null;\n const w = winner[k];\n const viaWinner = w === null ? null : (byKey.get(`${typeof w}:${String(w)}`) ?? null);\n if (viaData !== viaWinner) {\n return false;\n }\n }\n return true;\n}\n\n// ============================================================ the importer path\n\n/**\n * A Cytoscape.js file's styles as an importer's `styles()` returns them: what Cytoscape.js draws per element and the\n * stylesheet's rules, with Cytoscape.js as the writing tool whose defaults fill what the stylesheet leaves unset.\n * @param input - the elements, the stylesheet, the graph and the options\n * @returns the styles for graph-io's planner\n */\nexport function cytoscapeJsStyles(input: CyjsStyleInput & { readonly snapshot: GraphSnapshot }): ImporterStyles {\n const notes = input.notes ?? new StyleNotes();\n const r = evaluateCytoscapeJs({ ...input, notes });\n const output = (t: CyjsTargetStyles): ReaderOutput => ({ values: t.values, rules: t.rules, columns: t.columns });\n return {\n canonical: true,\n dialect: \"cytoscape-js\",\n tool: \"cytoscape-js\",\n units: \"px\",\n node: output(r.node),\n edge: output(r.edge),\n notes: notes.list(),\n };\n}\n","/**\n * Neutral styles written as a Cytoscape.js stylesheet: the rules in order as stylesheet rules, the per-element values\n * those rules read as element data under flat keys, and per-element bypasses for the values no rule gives.\n *\n * - A short predicate becomes a selector (`all`, `has`, `eq`, `in`, `not`, one `and`); a predicate a selector cannot\n * state exactly (a computed degree, a boolean value, a column whose name a selector cannot spell) becomes a\n * membership value written into element data and tested with `[key]`.\n * - A passthrough becomes `data(key)` over the values, written ready for Cytoscape.js; a discrete mapping becomes one\n * rule per table key; a continuous mapping becomes `mapData()`, one per segment; every mapped rule is scoped to the\n * elements it gives a value, because a Cytoscape.js mapper that finds nothing resets the property to its default.\n * - The stylesheet is then applied to the element data with graph-io's own Cytoscape.js engine, and every element\n * whose drawn value still differs from the styles gets a bypass (its own `style`), so the result is exact.\n * - With an import id, every element gets `graphty_import: <id>` and every selector tests it, so two imports in one\n * core never style each other's elements.\n * - Cytoscape.js draws what it draws regardless of any stylesheet: a loop is always curved, and its own default rules\n * (compound parents, selected elements) apply beneath the stylesheet. A file Cytoscape.js wrote keeps those\n * defaults as Cytoscape.js's own; they are not written again.\n */\n\nimport { num6 } from \"../canon/number.js\";\nimport { STYLE_ISSUE } from \"../codes.js\";\nimport { StyleNotes } from \"../notes.js\";\nimport { matches, refSource, resolveRules } from \"../plan/resolve.js\";\nimport type {\n ColumnRef,\n ExtractedStyles,\n Mapping,\n Predicate,\n Scalar,\n StyleNote,\n StyleRule,\n StyleTarget,\n StyleValue,\n} from \"../types.js\";\nimport { STYLE_PROPERTIES } from \"../vocabulary.js\";\nimport { evaluateCytoscapeJs } from \"./cascade.js\";\nimport {\n CYJS_EDGE_PROPERTIES,\n CYJS_NODE_PROPERTIES,\n type CyjsPropertySpec,\n isFontFamily,\n neutralPointsToCyjs,\n} from \"./mappers.js\";\nimport { parseCyjsSelector } from \"./selector.js\";\n\n/** One rule of a Cytoscape.js stylesheet. */\nexport interface CytoscapeStylesheetRule {\n /** The selector. */\n readonly selector: string;\n /** Property name to value, as Cytoscape.js reads them. */\n readonly style: Readonly<Record<string, string | number>>;\n}\n\n/** A value written into an element's `data`. */\nexport type CytoscapeDataValue = string | number | boolean;\n\n/** Per target, one object per element (by element index), or null where the element needs nothing. */\nexport interface CytoscapePerElement<T> {\n /** Nodes. */\n readonly node: readonly (Readonly<Record<string, T>> | null)[];\n /** Edges. */\n readonly edge: readonly (Readonly<Record<string, T>> | null)[];\n}\n\n/** Options of `toCytoscapeStylesheet()`. */\nexport interface CytoscapeStylesheetOptions {\n /**\n * Scopes the stylesheet to one import: every element gets `graphty_import: <importId>` in its data and every\n * selector tests it. Quotes and backslashes are replaced with `_`, in the data and the selectors alike.\n */\n readonly importId?: string;\n}\n\n/** The stylesheet, the element data it reads and the bypasses that make it exact. */\nexport interface CytoscapeStylesheetResult {\n /** The rules, in order; append them to a core's stylesheet. */\n readonly stylesheet: CytoscapeStylesheetRule[];\n /** What to merge into each element's `data`. */\n readonly elementData: CytoscapePerElement<CytoscapeDataValue>;\n /** What to give each element as its own `style` (a bypass over every rule). */\n readonly bypass: CytoscapePerElement<string | number>;\n /** Every style that could not be written, or only approximately. */\n readonly notes: readonly StyleNote[];\n}\n\n/** The element data key that holds the import id. */\nexport const CYTOSCAPE_IMPORT_KEY = \"graphty_import\";\n\n/**\n * The flat element data key of a style column: Cytoscape.js reads a dot in a data selector as a nested path, so the\n * key has none (`member.3` is `graphty_style_member_3`).\n * @param key - the style column's key\n * @returns the element data key\n * @category Styles\n */\nexport function cytoscapeStyleKey(key: string): string {\n return `graphty_style_${key.replaceAll(/\\W/g, \"_\")}`;\n}\n\n/** A name a selector and a mapper can both spell without escapes or paths. */\nconst PLAIN_NAME = /^[A-Za-z_]\\w*$/;\n\n/** A neutral value written as Cytoscape.js properties, and whether that is only approximate. */\ninterface Written {\n readonly props: Record<string, string | number>;\n readonly approximate: boolean;\n}\n\nconst SHAPES_TO_CYJS: ReadonlyMap<string, string> = new Map([\n [\"ellipse\", \"ellipse\"],\n [\"rectangle\", \"rectangle\"],\n [\"round-rectangle\", \"round-rectangle\"],\n [\"triangle\", \"triangle\"],\n [\"diamond\", \"diamond\"],\n [\"pentagon\", \"pentagon\"],\n [\"hexagon\", \"hexagon\"],\n [\"octagon\", \"octagon\"],\n [\"parallelogram\", \"rhomboid\"],\n [\"star\", \"star\"],\n [\"vee\", \"vee\"],\n [\"polygon\", \"polygon\"],\n]);\nconst ARROWS_TO_CYJS: ReadonlyMap<string, string> = new Map([\n [\"none\", \"none\"],\n [\"triangle\", \"triangle\"],\n [\"vee\", \"vee\"],\n [\"tee\", \"tee\"],\n [\"diamond\", \"diamond\"],\n [\"circle\", \"circle\"],\n [\"square\", \"square\"],\n]);\n/** Cytoscape.js's `line-fill` for each neutral gradient kind. */\nconst LINE_FILLS: ReadonlyMap<string, string> = new Map([\n [\"none\", \"solid\"],\n [\"linear\", \"linear-gradient\"],\n [\"radial\", \"radial-gradient\"],\n]);\n\n/** The Cytoscape.js property each neutral arrow is written to. */\nconst ARROW_PROPERTY = {\n sourceArrow: \"source-arrow-shape\",\n targetArrow: \"target-arrow-shape\",\n midSourceArrow: \"mid-source-arrow-shape\",\n midTargetArrow: \"mid-target-arrow-shape\",\n} as const;\n\n/** The open arrows: their shape, drawn hollow. */\nconst ARROWS_OPEN: ReadonlyMap<string, string> = new Map([\n [\"triangle-open\", \"triangle\"],\n [\"diamond-open\", \"diamond\"],\n [\"circle-open\", \"circle\"],\n]);\nconst ARROWS_NEAREST: ReadonlyMap<string, string> = new Map([\n [\"half\", \"triangle\"],\n [\"inverted\", \"triangle\"],\n [\"crow\", \"vee\"],\n]);\n\n/**\n * A neutral value as Cytoscape.js properties.\n * @param target - nodes or edges\n * @param property - the neutral property\n * @param value - the value\n * @returns the properties, or null when Cytoscape.js has no place for it\n */\nfunction toCyjs(target: StyleTarget, property: string, value: StyleValue): Written | null {\n const specs = target === \"node\" ? CYJS_NODE_PROPERTIES : CYJS_EDGE_PROPERTIES;\n switch (property) {\n case \"visible\":\n return exact({ display: value === false ? \"none\" : \"element\" });\n case \"shapePoints\":\n return pointsToCyjs(String(value));\n case \"labelItalic\":\n return exact({ \"font-style\": value === true ? \"italic\" : \"normal\" });\n case \"curved\":\n // `bezier` bows only parallel edges; `unbundled-bezier` bows every edge\n return exact({ \"curve-style\": value === true ? \"unbundled-bezier\" : \"straight\" });\n case \"labelPosition\":\n return labelPositionToCyjs(String(value));\n case \"fanSpacing\":\n case \"labelWrapWidth\":\n return ifNumber(value, (v) => numberToCyjs(property, v));\n case \"gradientKind\":\n return gradientKindToCyjs(String(value));\n case \"gradientStops\":\n return exact({\n \"line-gradient-stop-positions\": String(value)\n .trim()\n .split(/\\s+/)\n .map((s) => `${num6(Number(s) * 100)}%`)\n .join(\" \"),\n });\n case \"outerBorderOffset\":\n // drawn half its value out (see the reader)\n return ifNumber(value, (v) => exact({ \"outline-offset\": num6(v * 2) }));\n case \"outerBorderStyle\":\n return outerBorderStyleToCyjs(String(value));\n case \"shape\":\n return enumToCyjs(\"shape\", String(value), SHAPES_TO_CYJS, specs);\n case \"borderStyle\":\n return borderStyleToCyjs(String(value));\n case \"lineStyle\":\n return lineStyleToCyjs(String(value));\n case \"sourceArrow\":\n case \"targetArrow\":\n case \"midSourceArrow\":\n case \"midTargetArrow\":\n return arrowToCyjs(ARROW_PROPERTY[property], String(value), specs);\n case \"labelFont\":\n return isFontFamily(String(value)) ? exact({ \"font-family\": String(value) }) : null;\n // a label's box draws only at an opacity above 0, which is 0 unset\n case \"labelBackground\":\n return exact({ \"text-background-color\": String(value), \"text-background-opacity\": 1 });\n // the outline is drawn as a stroke twice text-outline-width (see the reader)\n case \"labelOutlineColor\":\n return exact({ \"text-outline-color\": String(value) });\n case \"labelOutlineWidth\":\n return ifNumber(value, (v) => exact({ \"text-outline-width\": num6(v / 2) }));\n case \"labelPadding\":\n return ifNumber(value, (v) => exact({ \"text-background-padding\": v }));\n // the line round a label's box draws only at an opacity above 0, which is 0 unset\n case \"labelBorderColor\":\n return exact({ \"text-border-color\": String(value), \"text-border-opacity\": 1 });\n case \"labelBorderWidth\":\n return ifNumber(value, (v) => exact({ \"text-border-width\": v, \"text-border-opacity\": 1 }));\n default:\n return propertyToCyjs(property, value, specs);\n }\n}\n\n/**\n * A value written only when it is a number.\n * @param value - the value\n * @param write - writes the number\n * @returns the written value, or null when it is not a number\n */\nfunction ifNumber(value: StyleValue, write: (v: number) => Written | null): Written | null {\n return typeof value === \"number\" ? write(value) : null;\n}\n\n/**\n * A gradient kind as Cytoscape.js's `line-fill`.\n * @param kind - the neutral kind\n * @returns the written value, or null when Cytoscape.js has no such fill\n */\nfunction gradientKindToCyjs(kind: string): Written | null {\n const fill = LINE_FILLS.get(kind);\n return fill === undefined ? null : exact({ \"line-fill\": fill });\n}\n\n/**\n * An outline's style as Cytoscape.js's `outline-style`, read as a border style is.\n * @param style - the neutral style\n * @returns the written value, or null\n */\nfunction outerBorderStyleToCyjs(style: string): Written | null {\n const written = borderStyleToCyjs(style);\n return written === null ? null : { ...written, props: { \"outline-style\": written.props[\"border-style\"] } };\n}\n\n/**\n * A polygon's corners as Cytoscape.js's `shape-polygon-points`.\n * @param points - the neutral corners\n * @returns the written value, or null when they are not pairs of numbers\n */\nfunction pointsToCyjs(points: string): Written | null {\n const written = neutralPointsToCyjs(points);\n return written === null ? null : exact({ \"shape-polygon-points\": written });\n}\n\n/**\n * A length property: the fan spacing (Cytoscape.js steps between neighbors, twice the distance from the middle line)\n * or the label wrap width.\n * @param property - `fanSpacing` or `labelWrapWidth`\n * @param value - the length\n * @returns the written value\n */\nfunction numberToCyjs(property: \"fanSpacing\" | \"labelWrapWidth\", value: number): Written {\n return property === \"fanSpacing\"\n ? exact({ \"control-point-step-size\": num6(value * 2) })\n : exact({ \"text-wrap\": \"wrap\", \"text-max-width\": value });\n}\n\n/**\n * Properties written exactly.\n * @param props - the properties\n * @returns the written value\n */\nfunction exact(props: Record<string, string | number>): Written {\n return { props, approximate: false };\n}\n\n/**\n * Properties written as the nearest Cytoscape.js has.\n * @param props - the properties\n * @returns the written value\n */\nfunction near(props: Record<string, string | number>): Written {\n return { props, approximate: true };\n}\n\n/**\n * A label position as the vertical and horizontal alignments.\n * @param text - the position\n * @returns the written value\n */\nfunction labelPositionToCyjs(text: string): Written {\n const inside = text.startsWith(\"inside-\");\n const side = inside ? text.slice(\"inside-\".length) : text;\n const v = [\"top\", \"bottom\"].find((x) => side.startsWith(x)) ?? \"center\";\n const h = [\"left\", \"right\"].find((x) => side.endsWith(x)) ?? \"center\";\n const of = (a: string): string => (inside && a !== \"center\" ? `${a}-inside` : a);\n return exact({ \"text-valign\": of(v), \"text-halign\": of(h) });\n}\n\n/**\n * An enumeration value: Cytoscape.js's name for it, or an `other:` value Cytoscape.js has.\n * @param name - the Cytoscape.js property\n * @param value - the neutral value\n * @param table - the neutral values Cytoscape.js has, by their Cytoscape.js names\n * @param specs - the target's properties\n * @returns the written value, or null when Cytoscape.js has none\n */\nfunction enumToCyjs(\n name: string,\n value: string,\n table: ReadonlyMap<string, string>,\n specs: ReadonlyMap<string, CyjsPropertySpec>,\n): Written | null {\n const cy = table.get(value);\n if (cy !== undefined) {\n return exact({ [name]: cy });\n }\n const other = value.startsWith(\"other:\") ? value.slice(6) : null;\n return other !== null && specs.get(name)?.enums?.includes(other) === true ? exact({ [name]: other }) : null;\n}\n\n/**\n * An arrow, or the nearest arrow Cytoscape.js has, with its fill: an open arrow is its shape drawn hollow, and every\n * other arrow is written filled, so a hollow fill an earlier rule set does not carry over to it.\n * @param name - the Cytoscape.js shape property\n * @param value - the neutral arrow\n * @param specs - the target's properties\n * @returns the written value, or null when Cytoscape.js has none near\n */\nfunction arrowToCyjs(name: string, value: string, specs: ReadonlyMap<string, CyjsPropertySpec>): Written | null {\n const fill = name.replace(\"-shape\", \"-fill\");\n const open = ARROWS_OPEN.get(value);\n if (open !== undefined) {\n return exact({ [name]: open, [fill]: \"hollow\" });\n }\n const own = enumToCyjs(name, value, ARROWS_TO_CYJS, specs);\n const nearest = ARROWS_NEAREST.get(value);\n const w = own ?? (nearest === undefined ? null : near({ [name]: nearest }));\n return w === null || value === \"none\" ? w : { ...w, props: { ...w.props, [fill]: \"filled\" } };\n}\n\n/**\n * A border style: dash-dot is drawn dashed.\n * @param value - the neutral style\n * @returns the written value, or null when Cytoscape.js has none\n */\nfunction borderStyleToCyjs(value: string): Written | null {\n if (value === \"dash-dot\") {\n return near({ \"border-style\": \"dashed\" });\n }\n return [\"solid\", \"dotted\", \"dashed\", \"double\"].includes(value) ? exact({ \"border-style\": value }) : null;\n}\n\n/**\n * A line style: the dashed kinds are drawn dashed, any other solid.\n * @param value - the neutral style\n * @returns the written value\n */\nfunction lineStyleToCyjs(value: string): Written {\n if ([\"solid\", \"dotted\", \"dashed\"].includes(value)) {\n return exact({ \"line-style\": value });\n }\n return near({ \"line-style\": value === \"dash-dot\" || value === \"long-dash\" ? \"dashed\" : \"solid\" });\n}\n\n/**\n * Any other property: the Cytoscape.js property that carries it, the value as it is.\n * @param property - the neutral property\n * @param value - the value\n * @param specs - the target's properties\n * @returns the written value, or null when no property carries it\n */\nfunction propertyToCyjs(\n property: string,\n value: StyleValue,\n specs: ReadonlyMap<string, CyjsPropertySpec>,\n): Written | null {\n const entry = Array.from(specs).find(([, spec]) => spec.property === property);\n if (entry === undefined) {\n return null;\n }\n const [name, spec] = entry;\n if (spec.type === \"positive\" && !(typeof value === \"number\" && value > 0)) {\n return null;\n }\n // Cytoscape.js takes an empty bypass as no bypass at all; a blank, which it trims, draws no text\n if (value === \"\" && /label$/i.test(property)) {\n return exact({ [name]: \" \" });\n }\n return exact({ [name]: typeof value === \"boolean\" ? String(value) : value });\n}\n\n/**\n * A selector value literal: a string in quotes (when it holds no quote of that kind and no backslash) or a number.\n * @param v - the value\n * @returns the literal, or null when a selector cannot state it\n */\nfunction literal(v: Scalar): string | null {\n if (typeof v === \"number\") {\n return Number.isFinite(v) ? String(v) : null;\n }\n if (typeof v !== \"string\" || v.includes(\"\\\\\") || /[\\n\\r\\u2028\\u2029]/.test(v)) {\n return null;\n }\n if (!v.includes('\"')) {\n return `\"${v}\"`;\n }\n return v.includes(\"'\") ? null : `'${v}'`;\n}\n\n/** The state of one emit. */\ninterface Emit {\n readonly extracted: ExtractedStyles;\n readonly notes: StyleNotes;\n readonly scope: string;\n readonly stylesheet: CytoscapeStylesheetRule[];\n readonly data: { node: Record<string, CytoscapeDataValue>[]; edge: Record<string, CytoscapeDataValue>[] };\n /** Per target, the source (a style column key or a generated name) to the flat key written for it. */\n readonly keys: { readonly node: Map<string, string>; readonly edge: Map<string, string> };\n /** Per target, the flat keys in use. */\n readonly used: { readonly node: Set<string>; readonly edge: Set<string> };\n}\n\n/**\n * A flat element data key for a source, unique within the target's data.\n * @param e - the emit\n * @param target - nodes or edges\n * @param source - the source: a style column key, or a generated name\n * @returns the flat key, and whether it is new\n */\nfunction flatKey(e: Emit, target: StyleTarget, source: string): { key: string; fresh: boolean } {\n const known = e.keys[target].get(source);\n if (known !== undefined) {\n return { key: known, fresh: false };\n }\n let key = cytoscapeStyleKey(source);\n let k = 2;\n while (e.used[target].has(key)) {\n key = `${cytoscapeStyleKey(source)}_${String(k)}`;\n k++;\n }\n e.keys[target].set(source, key);\n e.used[target].add(key);\n return { key, fresh: true };\n}\n\n/**\n * Writes a column into element data.\n * @param e - the emit\n * @param target - nodes or edges\n * @param key - the flat key\n * @param values - the values by element index; null and false are not written\n */\nfunction writeColumn(\n e: Emit,\n target: StyleTarget,\n key: string,\n values: ArrayLike<CytoscapeDataValue | null | undefined>,\n): void {\n const rows = e.data[target];\n for (let i = 0; i < rows.length && i < values.length; i++) {\n const v = values[i];\n if (v !== null && v !== undefined && v !== false) {\n rows[i][key] = v;\n }\n }\n}\n\n/**\n * The selector tests of a predicate, as alternatives of conjunctions; null when a selector cannot state it exactly.\n * @param e - the emit\n * @param target - nodes or edges\n * @param where - the predicate\n * @returns the alternatives (each a string of tests), or null\n */\nfunction testsOf(e: Emit, target: StyleTarget, where: Predicate): string[] | null {\n if (\"all\" in where) {\n return where.all ? [\"\"] : null;\n }\n if (\"has\" in where) {\n const k = keyOf(e, target, where.has);\n return k === null || !(\"style\" in where.has) ? null : [`[${k}]`];\n }\n if (\"eq\" in where) {\n return equalTest(e, target, where.eq, \"=\");\n }\n if (\"in\" in where) {\n const k = keyOf(e, target, where.in[0]);\n const values = where.in[1].map((x) => literal(x));\n if (values.length === 0) {\n return [];\n }\n return k === null || values.includes(null) ? null : values.map((v) => `[${k} = ${String(v)}]`);\n }\n if (\"not\" in where) {\n return notTests(e, target, where.not);\n }\n if (\"and\" in where) {\n return andTests(e, target, where.and);\n }\n if (\"or\" in where) {\n return orTests(e, target, where.or);\n }\n return null;\n}\n\n/**\n * An equality test, or its negation.\n * @param e - the emit\n * @param target - nodes or edges\n * @param eq - the column and the value\n * @param op - `=` or `!=`\n * @returns the test, or null when a selector cannot state it\n */\nfunction equalTest(e: Emit, target: StyleTarget, eq: readonly [ColumnRef, Scalar], op: \"=\" | \"!=\"): string[] | null {\n const k = keyOf(e, target, eq[0]);\n const v = literal(eq[1]);\n return k === null || v === null ? null : [`[${k} ${op} ${v}]`];\n}\n\n/**\n * A negated predicate: only a style column's absence and an inequality are stated.\n * @param e - the emit\n * @param target - nodes or edges\n * @param inner - the predicate negated\n * @returns the tests, or null\n */\nfunction notTests(e: Emit, target: StyleTarget, inner: Predicate): string[] | null {\n if (\"has\" in inner && \"style\" in inner.has) {\n const k = keyOf(e, target, inner.has);\n return k === null ? null : [`[^${k}]`];\n }\n return \"eq\" in inner ? equalTest(e, target, inner.eq, \"!=\") : null;\n}\n\n/**\n * A conjunction: every combination of its parts' alternatives, at most 8.\n * @param e - the emit\n * @param target - nodes or edges\n * @param parts - the predicates joined\n * @returns the alternatives, or null\n */\nfunction andTests(e: Emit, target: StyleTarget, parts: readonly Predicate[]): string[] | null {\n let alts = [\"\"];\n for (const p of parts) {\n const t = testsOf(e, target, p);\n if (t === null) {\n return null;\n }\n alts = alts.flatMap((a) => t.map((b) => a + b));\n if (alts.length > 8) {\n return null;\n }\n }\n return alts;\n}\n\n/**\n * A disjunction: its parts' alternatives, at most 8.\n * @param e - the emit\n * @param target - nodes or edges\n * @param parts - the predicates joined\n * @returns the alternatives, or null\n */\nfunction orTests(e: Emit, target: StyleTarget, parts: readonly Predicate[]): string[] | null {\n const out: string[] = [];\n for (const p of parts) {\n const t = testsOf(e, target, p);\n if (t === null) {\n return null;\n }\n out.push(...t);\n }\n return out.length > 8 ? null : out;\n}\n\n/**\n * The element data key a column reference is read from: a style column's flat key (its values written into element\n * data) or a data column's own name when a selector can spell it; null for anything else.\n * @param e - the emit\n * @param target - nodes or edges\n * @param ref - the reference\n * @returns the key, or null\n */\nfunction keyOf(e: Emit, target: StyleTarget, ref: ColumnRef): string | null {\n if (\"style\" in ref) {\n const col = e.extracted.columns[target].get(ref.style);\n if (col === undefined) {\n return null;\n }\n const { key, fresh } = flatKey(e, target, ref.style);\n if (fresh) {\n writeColumn(e, target, key, col);\n }\n return key;\n }\n if (\n \"data\" in ref &&\n PLAIN_NAME.test(ref.data) &&\n ref.data !== CYTOSCAPE_IMPORT_KEY &&\n !ref.data.startsWith(\"graphty_\")\n ) {\n return ref.data;\n }\n return null;\n}\n\n/**\n * The selectors of a rule: its predicate as tests, or a membership value written into element data.\n * @param e - the emit\n * @param rule - the rule\n * @param index - the rule's position\n * @returns the selector prefixes (group and scope included), one per alternative\n */\nfunction selectorsOf(e: Emit, rule: StyleRule, index: number): string[] {\n const head = `${rule.target}${e.scope}`;\n const tests = testsOf(e, rule.target, rule.where);\n if (tests !== null) {\n return tests.map((t) => head + t);\n }\n const src = refSource(\n rule.target,\n e.data[rule.target].length,\n e.extracted.columns[rule.target],\n e.extracted.features[rule.target],\n );\n const { key } = flatKey(e, rule.target, `emit.where.${String(index)}`);\n const col = new Array<boolean | null>(src.n);\n for (let i = 0; i < src.n; i++) {\n col[i] = matches(rule.where, src, i) ? true : null;\n }\n writeColumn(e, rule.target, key, col);\n return [`${head}[${key}]`];\n}\n\n/**\n * Emits one rule's constants and mappings.\n * @param e - the emit\n * @param rule - the rule\n * @param index - the rule's position\n */\nfunction emitRule(e: Emit, rule: StyleRule, index: number): void {\n const { target } = rule;\n const selectors = selectorsOf(e, rule, index);\n const constants: Record<string, string | number> = {};\n for (const [p, v] of Object.entries<StyleValue | undefined>(rule.set ?? {})) {\n if (v === undefined) {\n continue;\n }\n const w = written(e, target, p, v);\n if (w !== null) {\n Object.assign(constants, w);\n }\n }\n if (Object.keys(constants).length > 0) {\n for (const sel of selectors) {\n e.stylesheet.push({ selector: sel, style: constants });\n // Cytoscape.js curves a straight loop, but keeps a loop it is told to draw as a haystack\n if (target === \"edge\" && constants[\"curve-style\"] === \"straight\") {\n e.stylesheet.push({ selector: `${sel}:loop`, style: { \"curve-style\": \"haystack\" } });\n }\n }\n }\n for (const [p, m] of Object.entries<Mapping | undefined>(rule.map ?? {})) {\n if (m !== undefined) {\n emitMapping(e, rule, index, selectors, p, m);\n }\n }\n}\n\n/**\n * Whether Cytoscape.js holds a neutral value exactly: a value it cannot hold, or holds only as a nearest one, reads back\n * as something else.\n * @param target - nodes or edges\n * @param property - the neutral property\n * @param value - the value\n * @returns true when it is written as it is\n */\nexport function cyjsHoldsExactly(target: StyleTarget, property: string, value: StyleValue): boolean {\n const w = toCyjs(target, property, value);\n return w !== null && !w.approximate;\n}\n\n/**\n * A value as Cytoscape.js properties, noted when it cannot be written or only approximately.\n * @param e - the emit\n * @param target - nodes or edges\n * @param property - the neutral property\n * @param value - the value\n * @returns the properties, or null\n */\nfunction written(\n e: Emit,\n target: StyleTarget,\n property: string,\n value: StyleValue,\n): Record<string, string | number> | null {\n const w = toCyjs(target, property, value);\n if (w === null) {\n e.notes.add(STYLE_ISSUE.NOT_WRITTEN, target, property, { sample: value });\n return null;\n }\n if (w.approximate) {\n e.notes.add(STYLE_ISSUE.APPROXIMATED, target, property, { sample: value });\n }\n return w.props;\n}\n\n/**\n * Emits one mapping of a rule.\n * @param e - the emit\n * @param rule - the rule\n * @param index - the rule's position\n * @param selectors - the rule's selectors\n * @param property - the property\n * @param m - the mapping\n */\nfunction emitMapping(\n e: Emit,\n rule: StyleRule,\n index: number,\n selectors: readonly string[],\n property: string,\n m: Mapping,\n): void {\n const { target } = rule;\n if (m.kind === \"discrete\") {\n // one rule per table key, when a selector can state every key; else the per-element values\n const key = keyOf(e, target, m.by);\n const keys = m.table.map(([k]) => literal(k));\n if (key === null || keys.includes(null)) {\n emitValues(e, rule, index, selectors, property);\n return;\n }\n m.table.forEach(([, v], j) => {\n const w = written(e, target, property, v);\n if (w === null) {\n return;\n }\n for (const sel of selectors) {\n e.stylesheet.push({ selector: `${sel}[${key} = ${String(keys[j])}]`, style: w });\n }\n });\n return;\n }\n if (m.kind === \"continuous\" && isNumericOutput(target, property)) {\n const key = numericKey(e, target, m.by, index);\n if (key !== null) {\n emitContinuous(e, target, selectors, property, key, m.points);\n return;\n }\n }\n emitValues(e, rule, index, selectors, property);\n}\n\n/**\n * Whether a property's values are numbers or colors, which `mapData()` interpolates.\n * @param target - nodes or edges\n * @param property - the property\n * @returns true for a number, opacity or color property\n */\nfunction isNumericOutput(target: StyleTarget, property: string): boolean {\n const kind = STYLE_PROPERTIES[target].get(property);\n return kind === \"number\" || kind === \"opacity\" || kind === \"color\";\n}\n\n/**\n * The element data key of a mapping's numeric input: a data column a mapper can spell, or the input copied into\n * element data.\n * @param e - the emit\n * @param target - nodes or edges\n * @param by - the input\n * @param index - the rule's position\n * @returns the key, or null when the input has no values\n */\nfunction numericKey(e: Emit, target: StyleTarget, by: ColumnRef, index: number): string | null {\n const src = refSource(target, e.data[target].length, e.extracted.columns[target], e.extracted.features[target]);\n const col = src.column(by);\n if (col === null) {\n return null;\n }\n if (\"data\" in by && PLAIN_NAME.test(by.data) && !by.data.startsWith(\"graphty_\")) {\n return by.data;\n }\n const { key } = flatKey(e, target, `emit.input.${String(index)}`);\n const values = new Array<number | null>(src.n);\n for (let i = 0; i < src.n; i++) {\n const v = col[i];\n values[i] = typeof v === \"number\" && Number.isFinite(v) ? v : null;\n }\n writeColumn(e, target, key, values);\n return key;\n}\n\n/**\n * A continuous mapping as `mapData()` rules: one per segment, the values below the first point and above the last,\n * and the exact values at the points, each scoped to its input range.\n * @param e - the emit\n * @param target - nodes or edges\n * @param selectors - the rule's selectors\n * @param property - the property\n * @param key - the input's element data key\n * @param points - the points\n */\nfunction emitContinuous(\n e: Emit,\n target: StyleTarget,\n selectors: readonly string[],\n property: string,\n key: string,\n points: readonly { at: number; below: StyleValue; value: StyleValue; above: StyleValue }[],\n): void {\n if (points.length === 0) {\n return;\n }\n const lit = String;\n const push = (test: string, style: Record<string, string | number> | null): void => {\n if (style === null) {\n return;\n }\n for (const sel of selectors) {\n e.stylesheet.push({ selector: `${sel}${test}`, style });\n }\n };\n const first = points[0];\n const last = points.at(-1) ?? first;\n push(`[${key} < ${lit(first.at)}]`, written(e, target, property, first.below));\n for (let k = 0; k + 1 < points.length; k++) {\n const a = points[k];\n const b = points[k + 1];\n const wa = written(e, target, property, a.above);\n const wb = written(e, target, property, b.below);\n if (wa === null || wb === null) {\n continue;\n }\n const style: Record<string, string | number> = {};\n for (const name of Object.keys(wa)) {\n style[name] = `mapData(${key}, ${lit(a.at)}, ${lit(b.at)}, ${String(wa[name])}, ${String(wb[name])})`;\n }\n push(`[${key} > ${lit(a.at)}][${key} < ${lit(b.at)}]`, style);\n }\n push(`[${key} > ${lit(last.at)}]`, written(e, target, property, last.above));\n for (const p of points) {\n push(`[${key} = ${lit(p.at)}]`, written(e, target, property, p.value));\n }\n}\n\n/**\n * A mapping as its per-element values: what the rule gives each element, written ready for Cytoscape.js into element\n * data and read with `data()`, scoped to the elements that have a value.\n * @param e - the emit\n * @param rule - the rule\n * @param index - the rule's position\n * @param selectors - the rule's selectors\n * @param property - the property\n */\nfunction emitValues(e: Emit, rule: StyleRule, index: number, selectors: readonly string[], property: string): void {\n const { target } = rule;\n const n = e.data[target].length;\n const src = refSource(target, n, e.extracted.columns[target], e.extracted.features[target]);\n const mapping = new Map(Object.entries<Mapping | undefined>(rule.map ?? {})).get(property);\n const only: StyleRule = { ...rule, where: { all: true }, set: undefined, map: { [property]: mapping } };\n const values = resolveRules([only], target, property, src);\n const names = new Map<string, (string | number | null)[]>();\n for (let i = 0; i < n; i++) {\n const v = values[i];\n if (v === null) {\n continue;\n }\n const w = written(e, target, property, v);\n if (w === null) {\n continue;\n }\n for (const [name, x] of Object.entries(w)) {\n let col = names.get(name);\n if (col === undefined) {\n col = new Array<string | number | null>(n).fill(null);\n names.set(name, col);\n }\n col[i] = x;\n }\n }\n for (const [name, col] of names) {\n const { key } = flatKey(e, target, `emit.value.${String(index)}.${name}`);\n writeColumn(e, target, key, col);\n for (const sel of selectors) {\n e.stylesheet.push({ selector: `${sel}[${key}]`, style: { [name]: `data(${key})` } });\n }\n }\n}\n\n/**\n * Writes neutral styles as a Cytoscape.js stylesheet, the element data it reads and the bypasses that make it exact.\n * @param extracted - the styles\n * @param options - the import id that scopes the stylesheet\n * @returns the stylesheet, the element data, the bypasses and the notes of what could not be written\n * @category Styles\n */\nexport function toCytoscapeStylesheet(\n extracted: ExtractedStyles,\n options: CytoscapeStylesheetOptions = {},\n): CytoscapeStylesheetResult {\n const notes = new StyleNotes();\n const importId = options.importId?.replaceAll(/[\"'\\\\\\n\\r\\u2028\\u2029]/g, \"_\");\n const { nodes } = extracted.fingerprint;\n const { edges } = extracted.fingerprint;\n const e: Emit = {\n extracted,\n notes,\n scope: importId === undefined ? \"\" : `[${CYTOSCAPE_IMPORT_KEY} = \"${importId}\"]`,\n stylesheet: [],\n data: {\n node: Array.from({ length: nodes }, () => ({})),\n edge: Array.from({ length: edges }, () => ({})),\n },\n keys: { node: new Map(), edge: new Map() },\n // a flat key never takes the name of a data field the elements already hold\n used: {\n node: new Set([CYTOSCAPE_IMPORT_KEY, ...dataNames(extracted, \"node\")]),\n edge: new Set([CYTOSCAPE_IMPORT_KEY, ...dataNames(extracted, \"edge\")]),\n },\n };\n if (importId !== undefined) {\n for (const rows of [e.data.node, e.data.edge]) {\n for (const row of rows) {\n row[CYTOSCAPE_IMPORT_KEY] = importId;\n }\n }\n }\n // Cytoscape.js draws its own defaults: the rules that state them are not written again\n const rules =\n extracted.styles.source.tool === \"cytoscape-js\"\n ? extracted.styles.rules.filter((r) => r.origin !== \"tool\")\n : extracted.styles.rules;\n rules.forEach((rule, k) => {\n if (rule.role !== \"exceptions\") {\n emitRule(e, rule, k);\n }\n });\n const bypass = exactness(e, rules);\n for (const sel of e.stylesheet) {\n if (parseCyjsSelector(sel.selector).invalid) {\n notes.add(STYLE_ISSUE.NOT_WRITTEN, null, \"selector\", { sample: sel.selector });\n }\n }\n const rows = (list: Record<string, CytoscapeDataValue>[]): (Record<string, CytoscapeDataValue> | null)[] =>\n list.map((r) => (Object.keys(r).length > 0 ? r : null));\n return {\n stylesheet: e.stylesheet,\n elementData: { node: rows(e.data.node), edge: rows(e.data.edge) },\n bypass,\n notes: notes.list(),\n };\n}\n\n/**\n * Applies the stylesheet to the element data with graph-io's Cytoscape.js engine and gives every element whose drawn\n * value differs from the styles a bypass with the right value.\n * @param e - the emit\n * @param rules - the rules written (Cytoscape.js's own defaults left out)\n * @returns the bypasses\n */\nfunction exactness(e: Emit, rules: readonly StyleRule[]): CytoscapePerElement<string | number> {\n const { extracted } = e;\n const nodes = e.data.node.length;\n const elements: unknown[] = [];\n for (let i = 0; i < nodes; i++) {\n elements.push({\n group: \"nodes\",\n data: { ...dataColumns(extracted, \"node\", i), ...e.data.node[i], id: `n${String(i)}` },\n });\n }\n // the edges join two nodes (no loops: Cytoscape.js draws a loop curved whatever the stylesheet says)\n const far = nodes > 1 ? \"n1\" : \"n0\";\n for (let i = 0; i < e.data.edge.length && nodes > 0; i++) {\n elements.push({\n group: \"edges\",\n data: {\n ...dataColumns(extracted, \"edge\", i),\n ...e.data.edge[i],\n id: `e${String(i)}`,\n source: \"n0\",\n target: far,\n },\n });\n }\n const drawn = evaluateCytoscapeJs({ elements, style: e.stylesheet, toolDefaults: false });\n const out = {\n node: [] as (Record<string, string | number> | null)[],\n edge: [] as (Record<string, string | number> | null)[],\n };\n for (const target of [\"node\", \"edge\"] as const) {\n const n = e.data[target].length;\n const src = refSource(target, n, extracted.columns[target], extracted.features[target]);\n const rows = new Array<Record<string, string | number> | null>(n).fill(null);\n for (const property of STYLE_PROPERTIES[target].keys()) {\n const want = resolveRules(rules, target, property, src);\n addBypasses(rows, target, property, want, drawn[target].values[property]);\n }\n const want = (p: string): readonly (StyleValue | null)[] => resolveRules(rules, target, p, src);\n if (target === \"node\") {\n labelSizedBypasses(rows, want, drawn.node.values);\n }\n labelOpacityBypasses(rows, want, drawn[target].values);\n // each part with the property it is drawn only with: a label's box, line or outline only where it has one\n const parts: (readonly [string, string, string, string | null])[] = [\n [\"labelBackgroundOpacity\", \"text-background-opacity\", \"opacity\", \"labelBackground\"],\n [\"labelBorderOpacity\", \"text-border-opacity\", \"opacity\", \"labelBorderWidth\"],\n [\"labelOutlineOpacity\", \"text-outline-opacity\", \"labelOpacity\", \"labelOutlineWidth\"],\n ];\n if (target === \"node\") {\n parts.push(\n [\"borderOpacity\", \"border-opacity\", \"opacity\", null],\n [\"outerBorderOpacity\", \"outline-opacity\", \"opacity\", null],\n );\n }\n for (const part of parts) {\n partOpacityBypasses(rows, want, drawn[target].values, part);\n }\n out[target] = rows;\n }\n return out;\n}\n\n/**\n * A label's opacity as Cytoscape.js's `text-opacity`, which it draws times the element's `opacity`, where what is\n * drawn differs; an edge whose label is less faint than its line is written at the label's opacity with a fainter\n * `line-opacity`.\n * @param rows - the bypasses, changed in place\n * @param want - the styles' values of a property\n * @param got - what is drawn\n */\nfunction labelOpacityBypasses(\n rows: (Record<string, string | number> | null)[],\n want: (property: string) => readonly (StyleValue | null)[],\n got: Readonly<Partial<Record<string, readonly (StyleValue | null)[]>>>,\n): void {\n const label = want(\"labelOpacity\");\n const whole = want(\"opacity\");\n const at = (v: StyleValue | null | undefined): number => (typeof v === \"number\" ? v : 1);\n for (let i = 0; i < rows.length; i++) {\n const [l, o] = [at(label[i]), at(whole[i])];\n // a bypass of the opacity written above changes the label's too\n const rewritten = rows[i]?.opacity !== undefined;\n if ((l === at(got.labelOpacity?.[i]) && !rewritten) || Number.isNaN(o) || o <= 0) {\n continue;\n }\n if (l === o && rewritten) {\n continue;\n }\n if (l <= o) {\n rows[i] = { ...rows[i], \"text-opacity\": num6(l / o) };\n } else if (l > 0) {\n // an edge's line fainter than its label: the element at the label's opacity, the line fainter still\n rows[i] = { ...rows[i], opacity: num6(l), \"line-opacity\": num6(o / l), \"text-opacity\": 1 };\n }\n }\n}\n\n/**\n * The opacity of one part of an element (a node's border or outline, a label's box, line or outline) as the\n * Cytoscape.js property that carries it, which Cytoscape.js draws times the element's `opacity` (a label's outline\n * times the words' opacity), where what is drawn differs.\n * @param rows - the bypasses, changed in place\n * @param want - the styles' values of a property\n * @param got - what is drawn\n * @param part - the neutral property, the Cytoscape.js property, the neutral property it is drawn times, and the one\n * it is drawn only with (null: always)\n */\nfunction partOpacityBypasses(\n rows: (Record<string, string | number> | null)[],\n want: (property: string) => readonly (StyleValue | null)[],\n got: Readonly<Partial<Record<string, readonly (StyleValue | null)[]>>>,\n part: readonly [string, string, string, string | null],\n): void {\n const [property, name, by, drawnBy] = part;\n const own = want(property);\n const whole = want(by);\n const shown = drawnBy === null ? null : want(drawnBy);\n const at = (v: StyleValue | null | undefined): number => (typeof v === \"number\" ? v : 1);\n for (let i = 0; i < rows.length; i++) {\n if (shown !== null && shown[i] === null) {\n continue;\n }\n const [r, o] = [at(own[i]), at(whole[i])];\n const rewritten = rows[i]?.opacity !== undefined || rows[i]?.[\"text-opacity\"] !== undefined;\n if ((r === at(got[property]?.[i]) && !rewritten) || Number.isNaN(o) || o <= 0 || r > o) {\n continue;\n }\n rows[i] = { ...rows[i], [name]: num6(r / o) };\n }\n}\n\n/**\n * A node sized to its label (`labelFit` `bounds`, the label's side 0) as Cytoscape.js's `width: label` or\n * `height: label`, where what is drawn does not size it so already.\n * @param rows - the bypasses, changed in place\n * @param want - the styles' values of a property\n * @param got - what is drawn\n */\nfunction labelSizedBypasses(\n rows: (Record<string, string | number> | null)[],\n want: (property: string) => readonly (StyleValue | null)[],\n got: Readonly<Partial<Record<string, readonly (StyleValue | null)[]>>>,\n): void {\n const fit = want(\"labelFit\");\n for (const p of [\"width\", \"height\"]) {\n const size = want(p);\n for (let i = 0; i < rows.length; i++) {\n if (fit[i] === \"bounds\" && size[i] === 0 && !(got.labelFit?.[i] === \"bounds\" && got[p]?.[i] === 0)) {\n rows[i] = { ...rows[i], [p]: \"label\" };\n }\n }\n }\n}\n\n/**\n * A bypass of one property for every element whose drawn value differs from the styles' and that Cytoscape.js can\n * hold exactly.\n * @param rows - the bypasses, changed in place\n * @param target - nodes or edges\n * @param property - the property\n * @param want - the styles' values\n * @param got - what is drawn, or undefined for nothing\n */\nfunction addBypasses(\n rows: (Record<string, string | number> | null)[],\n target: StyleTarget,\n property: string,\n want: readonly (StyleValue | null)[],\n got: readonly (StyleValue | null)[] | undefined,\n): void {\n for (let i = 0; i < rows.length; i++) {\n const w = want[i];\n const conv = w === null || (got?.[i] ?? null) === w ? null : toCyjs(target, property, w);\n if (conv !== null && !conv.approximate) {\n rows[i] = { ...rows[i], ...conv.props };\n }\n }\n}\n\n/**\n * The names of the data columns among the styles' features.\n * @param extracted - the styles\n * @param target - nodes or edges\n * @returns the names\n */\nfunction dataNames(extracted: ExtractedStyles, target: StyleTarget): string[] {\n return extracted.features[target].flatMap((f) => (\"data\" in f.ref ? [f.ref.data] : []));\n}\n\n/**\n * An element's data columns from the styles' features: what a consumer writes into element data from the graph.\n * @param extracted - the styles\n * @param target - nodes or edges\n * @param i - the element\n * @returns the data fields\n */\nfunction dataColumns(extracted: ExtractedStyles, target: StyleTarget, i: number): Record<string, unknown> {\n const out: Record<string, unknown> = Object.create(null) as Record<string, unknown>;\n for (const f of extracted.features[target]) {\n if (\"data\" in f.ref && f.values[i] !== null) {\n out[f.ref.data] = f.values[i];\n }\n }\n return out;\n}\n"],"names":["text","p","i","q","isSpace","t","outer","inner","literal","order","degrees","r6","fraction","m","near","c","exact","written","spec","rows","want"],"mappings":";;AAWO,MAAM,oBAAoB;AAO1B,MAAM,YAAuC;AAAA,EAGvC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMlC,YAAY,QAAgB,mBAAmB;AAC3C,SAAK,QAAQ;AAAA,EACjB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,QAAqB,YAA6B;AACpD,SAAK,MAAM,MAAM,KAAK;AACtB,WAAO,KAAK,MAAM,MAAM,KAAK,KAAK;AAAA,EACtC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,UAAU,QAA8B;AACpC,WAAO,KAAK,MAAM,MAAM,I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