@graphty/graph-io 0.3.43 → 0.3.45
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-DJMHdDvv.js +40 -0
- package/dist/chunks/approximations-DJMHdDvv.js.map +1 -0
- package/dist/chunks/block-CPCHkX42.js +2777 -0
- package/dist/chunks/block-CPCHkX42.js.map +1 -0
- package/dist/chunks/{choose-DvpbdRuz.js → choose--jM0yYCo.js} +3 -2
- package/dist/chunks/{choose-DvpbdRuz.js.map → choose--jM0yYCo.js.map} +1 -1
- package/dist/chunks/{constants-fT3E8JYY.js → constants-BKwqelYD.js} +6 -2
- package/dist/chunks/constants-BKwqelYD.js.map +1 -0
- package/dist/chunks/convert-BcQ8_jMo.js +59 -0
- package/dist/chunks/convert-BcQ8_jMo.js.map +1 -0
- package/dist/chunks/emit-DZy6JgdA.js +3456 -0
- package/dist/chunks/emit-DZy6JgdA.js.map +1 -0
- package/dist/chunks/{escape-B62ZGM_a.js → escape-CgzxiYPg.js} +44 -21
- package/dist/chunks/escape-CgzxiYPg.js.map +1 -0
- package/dist/chunks/{export-rKLeGQMo.js → export-BvqAXCKh.js} +196 -792
- package/dist/chunks/export-BvqAXCKh.js.map +1 -0
- package/dist/chunks/{exporter-yLxKBvLE.js → exporter--Mk9gXCJ.js} +4 -3
- package/dist/chunks/{exporter-yLxKBvLE.js.map → exporter--Mk9gXCJ.js.map} +1 -1
- package/dist/chunks/{exporter-RVtXVetw.js → exporter-C-9cgZKa.js} +1805 -287
- package/dist/chunks/exporter-C-9cgZKa.js.map +1 -0
- package/dist/chunks/{exporter-8hLNemFk.js → exporter-DFqJhBnj.js} +133 -74
- package/dist/chunks/exporter-DFqJhBnj.js.map +1 -0
- package/dist/chunks/{exporter-BWwEuOPT.js → exporter-DteVeJki.js} +22 -12
- package/dist/chunks/exporter-DteVeJki.js.map +1 -0
- package/dist/chunks/format-BpQBx8MZ.js +676 -0
- package/dist/chunks/format-BpQBx8MZ.js.map +1 -0
- package/dist/chunks/generic-BGO71QBv.js +1347 -0
- package/dist/chunks/generic-BGO71QBv.js.map +1 -0
- package/dist/chunks/{importer-C98dpSH4.js → importer-B-9Rc1zO.js} +141 -82
- package/dist/chunks/importer-B-9Rc1zO.js.map +1 -0
- package/dist/chunks/{importer-D794XUTe.js → importer-BVVR740x.js} +31 -8
- package/dist/chunks/importer-BVVR740x.js.map +1 -0
- package/dist/chunks/{importer-WrGRZb0N.js → importer-C0AjA3Ax.js} +449 -102
- package/dist/chunks/importer-C0AjA3Ax.js.map +1 -0
- package/dist/chunks/{importer-BbNb7eNg.js → importer-C7pvJe1L.js} +1398 -129
- package/dist/chunks/importer-C7pvJe1L.js.map +1 -0
- package/dist/chunks/{importer-xZ-3suY1.js → importer-ClwoVx3O.js} +791 -135
- package/dist/chunks/importer-ClwoVx3O.js.map +1 -0
- package/dist/chunks/{importer-Ht7LNg8L.js → importer-D0sC_6bO.js} +116 -296
- package/dist/chunks/importer-D0sC_6bO.js.map +1 -0
- package/dist/chunks/{importer-Dz7tI8Sa.js → importer-EHQk1jbM.js} +617 -115
- package/dist/chunks/importer-EHQk1jbM.js.map +1 -0
- package/dist/chunks/{json-elements-DKSqpNW1.js → json-elements-DJZRZ6jd.js} +123 -32
- package/dist/chunks/json-elements-DJZRZ6jd.js.map +1 -0
- package/dist/chunks/lexicon-WMsNddyU.js +509 -0
- package/dist/chunks/lexicon-WMsNddyU.js.map +1 -0
- package/dist/chunks/{ontology-export-CtRXjg_i.js → ontology-export-G4MqRdux.js} +3 -2
- package/dist/chunks/{ontology-export-CtRXjg_i.js.map → ontology-export-G4MqRdux.js.map} +1 -1
- package/dist/chunks/{records-Cu4bxYOm.js → records-CiaWZrFH.js} +2 -2
- package/dist/chunks/{records-Cu4bxYOm.js.map → records-CiaWZrFH.js.map} +1 -1
- package/dist/chunks/styles-DvoFBKCK.js +690 -0
- package/dist/chunks/styles-DvoFBKCK.js.map +1 -0
- package/dist/chunks/styles-yed-Cz9rLBCP.js +842 -0
- package/dist/chunks/styles-yed-Cz9rLBCP.js.map +1 -0
- package/dist/chunks/styles-zNTmz5R7.js +2102 -0
- package/dist/chunks/styles-zNTmz5R7.js.map +1 -0
- package/dist/chunks/{text-DHOJXnED.js → text-CzJNFOS9.js} +2 -2
- package/dist/chunks/{text-DHOJXnED.js.map → text-CzJNFOS9.js.map} +1 -1
- package/dist/chunks/units-XMZFIFe1.js +19 -0
- package/dist/chunks/units-XMZFIFe1.js.map +1 -0
- package/dist/chunks/writer-gQ8kx99H.js +448 -0
- package/dist/chunks/writer-gQ8kx99H.js.map +1 -0
- package/dist/csv.js +5 -4
- package/dist/csv.js.map +1 -1
- package/dist/cx.js +1 -1
- package/dist/cx2.js +2 -2
- package/dist/cys.js +1 -1
- package/dist/dot.js +5 -2
- package/dist/dot.js.map +1 -1
- package/dist/gexf.js +292 -412
- package/dist/gexf.js.map +1 -1
- package/dist/gml.js +927 -74
- package/dist/gml.js.map +1 -1
- package/dist/graph-io.js +351 -236
- package/dist/graph-io.js.map +1 -1
- package/dist/graphml.js +4 -2
- package/dist/graphml.js.map +1 -1
- package/dist/json.js +1 -1
- package/dist/neo4j.js +4 -3
- package/dist/neo4j.js.map +1 -1
- package/dist/obo.js +1 -1
- package/dist/pajek.js +4 -2
- package/dist/positions.d.ts +1 -0
- package/dist/positions.js +427 -0
- package/dist/positions.js.map +1 -0
- package/dist/src/common/codes.d.ts +6 -0
- package/dist/src/common/codes.d.ts.map +1 -1
- package/dist/src/common/codes.js +6 -0
- package/dist/src/common/codes.js.map +1 -1
- package/dist/src/common/escape.d.ts.map +1 -1
- package/dist/src/common/escape.js +4 -2
- package/dist/src/common/escape.js.map +1 -1
- package/dist/src/common/export.d.ts +10 -0
- package/dist/src/common/export.d.ts.map +1 -1
- package/dist/src/common/export.js +123 -100
- package/dist/src/common/export.js.map +1 -1
- package/dist/src/common/input.d.ts.map +1 -1
- package/dist/src/common/input.js +8 -1
- package/dist/src/common/input.js.map +1 -1
- package/dist/src/common/json-elements.d.ts +12 -9
- package/dist/src/common/json-elements.d.ts.map +1 -1
- package/dist/src/common/json-elements.js +160 -37
- package/dist/src/common/json-elements.js.map +1 -1
- package/dist/src/common/notes.d.ts +42 -0
- package/dist/src/common/notes.d.ts.map +1 -0
- package/dist/src/common/notes.js +72 -0
- package/dist/src/common/notes.js.map +1 -0
- package/dist/src/common/report.d.ts +18 -0
- package/dist/src/common/report.d.ts.map +1 -1
- package/dist/src/common/report.js +36 -1
- package/dist/src/common/report.js.map +1 -1
- package/dist/src/common/units.d.ts +24 -0
- package/dist/src/common/units.d.ts.map +1 -0
- package/dist/src/common/units.js +26 -0
- package/dist/src/common/units.js.map +1 -0
- package/dist/src/common/xml.d.ts +18 -0
- package/dist/src/common/xml.d.ts.map +1 -1
- package/dist/src/common/xml.js +42 -5
- package/dist/src/common/xml.js.map +1 -1
- package/dist/src/formats/cx/exporter.d.ts +6 -0
- package/dist/src/formats/cx/exporter.d.ts.map +1 -1
- package/dist/src/formats/cx/exporter.js +71 -8
- package/dist/src/formats/cx/exporter.js.map +1 -1
- package/dist/src/formats/cx/importer.d.ts +5 -2
- package/dist/src/formats/cx/importer.d.ts.map +1 -1
- package/dist/src/formats/cx/importer.js +102 -72
- package/dist/src/formats/cx/importer.js.map +1 -1
- package/dist/src/formats/cx/styles.d.ts +102 -0
- package/dist/src/formats/cx/styles.d.ts.map +1 -0
- package/dist/src/formats/cx/styles.js +225 -0
- package/dist/src/formats/cx/styles.js.map +1 -0
- package/dist/src/formats/cx2/exporter.d.ts +5 -0
- package/dist/src/formats/cx2/exporter.d.ts.map +1 -1
- package/dist/src/formats/cx2/exporter.js +181 -71
- package/dist/src/formats/cx2/exporter.js.map +1 -1
- package/dist/src/formats/cx2/importer.d.ts +4 -1
- package/dist/src/formats/cx2/importer.d.ts.map +1 -1
- package/dist/src/formats/cx2/importer.js +19 -1
- package/dist/src/formats/cx2/importer.js.map +1 -1
- package/dist/src/formats/cx2/styles.d.ts +18 -0
- package/dist/src/formats/cx2/styles.d.ts.map +1 -0
- package/dist/src/formats/cx2/styles.js +24 -0
- package/dist/src/formats/cx2/styles.js.map +1 -0
- package/dist/src/formats/cys/constants.d.ts +2 -0
- package/dist/src/formats/cys/constants.d.ts.map +1 -1
- package/dist/src/formats/cys/constants.js +2 -0
- package/dist/src/formats/cys/constants.js.map +1 -1
- package/dist/src/formats/cys/exporter.d.ts +6 -2
- package/dist/src/formats/cys/exporter.d.ts.map +1 -1
- package/dist/src/formats/cys/exporter.js +215 -53
- package/dist/src/formats/cys/exporter.js.map +1 -1
- package/dist/src/formats/cys/importer.d.ts +2 -1
- package/dist/src/formats/cys/importer.d.ts.map +1 -1
- package/dist/src/formats/cys/importer.js +119 -6
- package/dist/src/formats/cys/importer.js.map +1 -1
- package/dist/src/formats/cys/session.d.ts +2 -0
- package/dist/src/formats/cys/session.d.ts.map +1 -1
- package/dist/src/formats/cys/session.js +5 -0
- package/dist/src/formats/cys/session.js.map +1 -1
- package/dist/src/formats/cys/styles.d.ts +38 -0
- package/dist/src/formats/cys/styles.d.ts.map +1 -0
- package/dist/src/formats/cys/styles.js +213 -0
- package/dist/src/formats/cys/styles.js.map +1 -0
- package/dist/src/formats/cys/tables.d.ts +8 -3
- package/dist/src/formats/cys/tables.d.ts.map +1 -1
- package/dist/src/formats/cys/tables.js +88 -34
- package/dist/src/formats/cys/tables.js.map +1 -1
- package/dist/src/formats/dot/exporter.d.ts +2 -0
- package/dist/src/formats/dot/exporter.d.ts.map +1 -1
- package/dist/src/formats/dot/exporter.js +195 -81
- package/dist/src/formats/dot/exporter.js.map +1 -1
- package/dist/src/formats/dot/importer.d.ts.map +1 -1
- package/dist/src/formats/dot/importer.js +100 -20
- package/dist/src/formats/dot/importer.js.map +1 -1
- package/dist/src/formats/dot/index.d.ts +1 -0
- package/dist/src/formats/dot/index.d.ts.map +1 -1
- package/dist/src/formats/dot/index.js +1 -0
- package/dist/src/formats/dot/index.js.map +1 -1
- package/dist/src/formats/dot/positions.d.ts +14 -0
- package/dist/src/formats/dot/positions.d.ts.map +1 -0
- package/dist/src/formats/dot/positions.js +70 -0
- package/dist/src/formats/dot/positions.js.map +1 -0
- package/dist/src/formats/dot/styles.d.ts +82 -0
- package/dist/src/formats/dot/styles.d.ts.map +1 -0
- package/dist/src/formats/dot/styles.js +1496 -0
- package/dist/src/formats/dot/styles.js.map +1 -0
- package/dist/src/formats/gexf/exporter.d.ts.map +1 -1
- package/dist/src/formats/gexf/exporter.js +20 -5
- package/dist/src/formats/gexf/exporter.js.map +1 -1
- package/dist/src/formats/gexf/importer.d.ts +8 -1
- package/dist/src/formats/gexf/importer.d.ts.map +1 -1
- package/dist/src/formats/gexf/importer.js +251 -131
- package/dist/src/formats/gexf/importer.js.map +1 -1
- package/dist/src/formats/gexf/index.d.ts +8 -0
- package/dist/src/formats/gexf/index.d.ts.map +1 -1
- package/dist/src/formats/gexf/index.js +10 -2
- package/dist/src/formats/gexf/index.js.map +1 -1
- package/dist/src/formats/gexf/schema.d.ts +5 -0
- package/dist/src/formats/gexf/schema.d.ts.map +1 -1
- package/dist/src/formats/gexf/schema.js +5 -0
- package/dist/src/formats/gexf/schema.js.map +1 -1
- package/dist/src/formats/gexf/styles.d.ts +74 -0
- package/dist/src/formats/gexf/styles.d.ts.map +1 -0
- package/dist/src/formats/gexf/styles.js +604 -0
- package/dist/src/formats/gexf/styles.js.map +1 -0
- package/dist/src/formats/gml/exporter.d.ts +1 -5
- package/dist/src/formats/gml/exporter.d.ts.map +1 -1
- package/dist/src/formats/gml/exporter.js +19 -8
- package/dist/src/formats/gml/exporter.js.map +1 -1
- package/dist/src/formats/gml/importer.d.ts.map +1 -1
- package/dist/src/formats/gml/importer.js +4 -0
- package/dist/src/formats/gml/importer.js.map +1 -1
- package/dist/src/formats/gml/index.d.ts +2 -1
- package/dist/src/formats/gml/index.d.ts.map +1 -1
- package/dist/src/formats/gml/index.js +2 -1
- package/dist/src/formats/gml/index.js.map +1 -1
- package/dist/src/formats/gml/positions.d.ts +14 -0
- package/dist/src/formats/gml/positions.d.ts.map +1 -0
- package/dist/src/formats/gml/positions.js +46 -0
- package/dist/src/formats/gml/positions.js.map +1 -0
- package/dist/src/formats/gml/styles.d.ts +59 -0
- package/dist/src/formats/gml/styles.d.ts.map +1 -0
- package/dist/src/formats/gml/styles.js +1056 -0
- package/dist/src/formats/gml/styles.js.map +1 -0
- package/dist/src/formats/gml/syntax.d.ts +11 -0
- package/dist/src/formats/gml/syntax.d.ts.map +1 -1
- package/dist/src/formats/gml/syntax.js +151 -62
- package/dist/src/formats/gml/syntax.js.map +1 -1
- package/dist/src/formats/graphml/constants.d.ts +4 -0
- package/dist/src/formats/graphml/constants.d.ts.map +1 -1
- package/dist/src/formats/graphml/constants.js +5 -1
- package/dist/src/formats/graphml/constants.js.map +1 -1
- package/dist/src/formats/graphml/exporter.d.ts.map +1 -1
- package/dist/src/formats/graphml/exporter.js +133 -65
- package/dist/src/formats/graphml/exporter.js.map +1 -1
- package/dist/src/formats/graphml/importer.d.ts +4 -1
- package/dist/src/formats/graphml/importer.d.ts.map +1 -1
- package/dist/src/formats/graphml/importer.js +100 -44
- package/dist/src/formats/graphml/importer.js.map +1 -1
- package/dist/src/formats/graphml/index.d.ts +1 -0
- package/dist/src/formats/graphml/index.d.ts.map +1 -1
- package/dist/src/formats/graphml/index.js +1 -0
- package/dist/src/formats/graphml/index.js.map +1 -1
- package/dist/src/formats/graphml/styles-plain.d.ts +19 -0
- package/dist/src/formats/graphml/styles-plain.d.ts.map +1 -0
- package/dist/src/formats/graphml/styles-plain.js +187 -0
- package/dist/src/formats/graphml/styles-plain.js.map +1 -0
- package/dist/src/formats/graphml/styles-yed.d.ts +179 -0
- package/dist/src/formats/graphml/styles-yed.d.ts.map +1 -0
- package/dist/src/formats/graphml/styles-yed.js +1086 -0
- package/dist/src/formats/graphml/styles-yed.js.map +1 -0
- package/dist/src/formats/graphml/styles-yfiles3.d.ts +19 -0
- package/dist/src/formats/graphml/styles-yfiles3.d.ts.map +1 -0
- package/dist/src/formats/graphml/styles-yfiles3.js +508 -0
- package/dist/src/formats/graphml/styles-yfiles3.js.map +1 -0
- package/dist/src/formats/graphml/tree.d.ts.map +1 -1
- package/dist/src/formats/graphml/tree.js +34 -19
- package/dist/src/formats/graphml/tree.js.map +1 -1
- package/dist/src/formats/graphml/yfiles.d.ts +16 -2
- package/dist/src/formats/graphml/yfiles.d.ts.map +1 -1
- package/dist/src/formats/graphml/yfiles.js +83 -12
- package/dist/src/formats/graphml/yfiles.js.map +1 -1
- package/dist/src/formats/json/exporter.d.ts +5 -0
- package/dist/src/formats/json/exporter.d.ts.map +1 -1
- package/dist/src/formats/json/exporter.js +68 -25
- package/dist/src/formats/json/exporter.js.map +1 -1
- package/dist/src/formats/json/importer.d.ts +22 -3
- package/dist/src/formats/json/importer.d.ts.map +1 -1
- package/dist/src/formats/json/importer.js +439 -264
- package/dist/src/formats/json/importer.js.map +1 -1
- package/dist/src/formats/json/positions.d.ts +16 -0
- package/dist/src/formats/json/positions.d.ts.map +1 -0
- package/dist/src/formats/json/positions.js +44 -0
- package/dist/src/formats/json/positions.js.map +1 -0
- package/dist/src/formats/json/styles.d.ts +102 -0
- package/dist/src/formats/json/styles.d.ts.map +1 -0
- package/dist/src/formats/json/styles.js +1753 -0
- package/dist/src/formats/json/styles.js.map +1 -0
- package/dist/src/formats/neo4j/exporter.d.ts.map +1 -1
- package/dist/src/formats/neo4j/exporter.js +2 -1
- package/dist/src/formats/neo4j/exporter.js.map +1 -1
- package/dist/src/formats/pajek/exporter.d.ts +2 -0
- package/dist/src/formats/pajek/exporter.d.ts.map +1 -1
- package/dist/src/formats/pajek/exporter.js +142 -76
- package/dist/src/formats/pajek/exporter.js.map +1 -1
- package/dist/src/formats/pajek/importer.d.ts +4 -0
- package/dist/src/formats/pajek/importer.d.ts.map +1 -1
- package/dist/src/formats/pajek/importer.js +60 -6
- package/dist/src/formats/pajek/importer.js.map +1 -1
- package/dist/src/formats/pajek/index.d.ts +2 -0
- package/dist/src/formats/pajek/index.d.ts.map +1 -1
- package/dist/src/formats/pajek/index.js +2 -0
- package/dist/src/formats/pajek/index.js.map +1 -1
- package/dist/src/formats/pajek/styles.d.ts +50 -0
- package/dist/src/formats/pajek/styles.d.ts.map +1 -0
- package/dist/src/formats/pajek/styles.js +569 -0
- package/dist/src/formats/pajek/styles.js.map +1 -0
- package/dist/src/formats/pajek/syntax.d.ts +6 -0
- package/dist/src/formats/pajek/syntax.d.ts.map +1 -1
- package/dist/src/formats/pajek/syntax.js +6 -0
- package/dist/src/formats/pajek/syntax.js.map +1 -1
- package/dist/src/formats/xgmml/columns.d.ts.map +1 -1
- package/dist/src/formats/xgmml/columns.js +34 -9
- package/dist/src/formats/xgmml/columns.js.map +1 -1
- package/dist/src/formats/xgmml/constants.d.ts +2 -0
- package/dist/src/formats/xgmml/constants.d.ts.map +1 -1
- package/dist/src/formats/xgmml/constants.js +3 -1
- package/dist/src/formats/xgmml/constants.js.map +1 -1
- package/dist/src/formats/xgmml/document.d.ts +12 -8
- package/dist/src/formats/xgmml/document.d.ts.map +1 -1
- package/dist/src/formats/xgmml/document.js +56 -13
- package/dist/src/formats/xgmml/document.js.map +1 -1
- package/dist/src/formats/xgmml/emit.d.ts.map +1 -1
- package/dist/src/formats/xgmml/emit.js +12 -6
- package/dist/src/formats/xgmml/emit.js.map +1 -1
- package/dist/src/formats/xgmml/exporter.d.ts +3 -1
- package/dist/src/formats/xgmml/exporter.d.ts.map +1 -1
- package/dist/src/formats/xgmml/exporter.js +22 -9
- package/dist/src/formats/xgmml/exporter.js.map +1 -1
- package/dist/src/formats/xgmml/importer.d.ts +2 -1
- package/dist/src/formats/xgmml/importer.d.ts.map +1 -1
- package/dist/src/formats/xgmml/importer.js +31 -24
- package/dist/src/formats/xgmml/importer.js.map +1 -1
- package/dist/src/formats/xgmml/styles.d.ts +104 -0
- package/dist/src/formats/xgmml/styles.d.ts.map +1 -0
- package/dist/src/formats/xgmml/styles.js +310 -0
- package/dist/src/formats/xgmml/styles.js.map +1 -0
- package/dist/src/index.d.ts +9 -7
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +7 -7
- package/dist/src/index.js.map +1 -1
- package/dist/src/positions/codes.d.ts +31 -0
- package/dist/src/positions/codes.d.ts.map +1 -0
- package/dist/src/positions/codes.js +26 -0
- package/dist/src/positions/codes.js.map +1 -0
- package/dist/src/positions/convert.d.ts +58 -0
- package/dist/src/positions/convert.d.ts.map +1 -0
- package/dist/src/positions/convert.js +107 -0
- package/dist/src/positions/convert.js.map +1 -0
- package/dist/src/positions/extract.d.ts +27 -0
- package/dist/src/positions/extract.d.ts.map +1 -0
- package/dist/src/positions/extract.js +526 -0
- package/dist/src/positions/extract.js.map +1 -0
- package/dist/src/positions/index.d.ts +10 -0
- package/dist/src/positions/index.d.ts.map +1 -0
- package/dist/src/positions/index.js +9 -0
- package/dist/src/positions/index.js.map +1 -0
- package/dist/src/positions/types.d.ts +208 -0
- package/dist/src/positions/types.d.ts.map +1 -0
- package/dist/src/positions/types.js +10 -0
- package/dist/src/positions/types.js.map +1 -0
- package/dist/src/registry.d.ts +30 -0
- package/dist/src/registry.d.ts.map +1 -1
- package/dist/src/registry.js +130 -9
- package/dist/src/registry.js.map +1 -1
- package/dist/src/styles/annotations.d.ts +132 -0
- package/dist/src/styles/annotations.d.ts.map +1 -0
- package/dist/src/styles/annotations.js +320 -0
- package/dist/src/styles/annotations.js.map +1 -0
- package/dist/src/styles/budget.d.ts +45 -0
- package/dist/src/styles/budget.d.ts.map +1 -0
- package/dist/src/styles/budget.js +58 -0
- package/dist/src/styles/budget.js.map +1 -0
- package/dist/src/styles/canon/bends.d.ts +32 -0
- package/dist/src/styles/canon/bends.d.ts.map +1 -0
- package/dist/src/styles/canon/bends.js +74 -0
- package/dist/src/styles/canon/bends.js.map +1 -0
- package/dist/src/styles/canon/color-tables.d.ts +22 -0
- package/dist/src/styles/canon/color-tables.d.ts.map +1 -0
- package/dist/src/styles/canon/color-tables.js +369 -0
- package/dist/src/styles/canon/color-tables.js.map +1 -0
- package/dist/src/styles/canon/color.d.ts +66 -0
- package/dist/src/styles/canon/color.d.ts.map +1 -0
- package/dist/src/styles/canon/color.js +548 -0
- package/dist/src/styles/canon/color.js.map +1 -0
- package/dist/src/styles/canon/enums.d.ts +25 -0
- package/dist/src/styles/canon/enums.d.ts.map +1 -0
- package/dist/src/styles/canon/enums.js +187 -0
- package/dist/src/styles/canon/enums.js.map +1 -0
- package/dist/src/styles/canon/graphviz.d.ts +48 -0
- package/dist/src/styles/canon/graphviz.d.ts.map +1 -0
- package/dist/src/styles/canon/graphviz.js +160 -0
- package/dist/src/styles/canon/graphviz.js.map +1 -0
- package/dist/src/styles/canon/index.d.ts +13 -0
- package/dist/src/styles/canon/index.d.ts.map +1 -0
- package/dist/src/styles/canon/index.js +13 -0
- package/dist/src/styles/canon/index.js.map +1 -0
- package/dist/src/styles/canon/number.d.ts +59 -0
- package/dist/src/styles/canon/number.d.ts.map +1 -0
- package/dist/src/styles/canon/number.js +142 -0
- package/dist/src/styles/canon/number.js.map +1 -0
- package/dist/src/styles/canon/site.d.ts +51 -0
- package/dist/src/styles/canon/site.d.ts.map +1 -0
- package/dist/src/styles/canon/site.js +63 -0
- package/dist/src/styles/canon/site.js.map +1 -0
- package/dist/src/styles/canon/text.d.ts +61 -0
- package/dist/src/styles/canon/text.d.ts.map +1 -0
- package/dist/src/styles/canon/text.js +199 -0
- package/dist/src/styles/canon/text.js.map +1 -0
- package/dist/src/styles/codes.d.ts +95 -0
- package/dist/src/styles/codes.d.ts.map +1 -0
- package/dist/src/styles/codes.js +97 -0
- package/dist/src/styles/codes.js.map +1 -0
- package/dist/src/styles/cyjs/cascade.d.ts +134 -0
- package/dist/src/styles/cyjs/cascade.d.ts.map +1 -0
- package/dist/src/styles/cyjs/cascade.js +2252 -0
- package/dist/src/styles/cyjs/cascade.js.map +1 -0
- package/dist/src/styles/cyjs/defaults-table.d.ts +25 -0
- package/dist/src/styles/cyjs/defaults-table.d.ts.map +1 -0
- package/dist/src/styles/cyjs/defaults-table.js +76 -0
- package/dist/src/styles/cyjs/defaults-table.js.map +1 -0
- package/dist/src/styles/cyjs/emit.d.ts +82 -0
- package/dist/src/styles/cyjs/emit.d.ts.map +1 -0
- package/dist/src/styles/cyjs/emit.js +791 -0
- package/dist/src/styles/cyjs/emit.js.map +1 -0
- package/dist/src/styles/cyjs/index.d.ts +13 -0
- package/dist/src/styles/cyjs/index.d.ts.map +1 -0
- package/dist/src/styles/cyjs/index.js +13 -0
- package/dist/src/styles/cyjs/index.js.map +1 -0
- package/dist/src/styles/cyjs/live.d.ts +46 -0
- package/dist/src/styles/cyjs/live.d.ts.map +1 -0
- package/dist/src/styles/cyjs/live.js +108 -0
- package/dist/src/styles/cyjs/live.js.map +1 -0
- package/dist/src/styles/cyjs/mappers.d.ts +147 -0
- package/dist/src/styles/cyjs/mappers.d.ts.map +1 -0
- package/dist/src/styles/cyjs/mappers.js +744 -0
- package/dist/src/styles/cyjs/mappers.js.map +1 -0
- package/dist/src/styles/cyjs/selector.d.ts +113 -0
- package/dist/src/styles/cyjs/selector.d.ts.map +1 -0
- package/dist/src/styles/cyjs/selector.js +611 -0
- package/dist/src/styles/cyjs/selector.js.map +1 -0
- package/dist/src/styles/cyjs/stylesheet-text.d.ts +37 -0
- package/dist/src/styles/cyjs/stylesheet-text.d.ts.map +1 -0
- package/dist/src/styles/cyjs/stylesheet-text.js +181 -0
- package/dist/src/styles/cyjs/stylesheet-text.js.map +1 -0
- package/dist/src/styles/cytoscape/emit.d.ts +125 -0
- package/dist/src/styles/cytoscape/emit.d.ts.map +1 -0
- package/dist/src/styles/cytoscape/emit.js +1025 -0
- package/dist/src/styles/cytoscape/emit.js.map +1 -0
- package/dist/src/styles/cytoscape/index.d.ts +10 -0
- package/dist/src/styles/cytoscape/index.d.ts.map +1 -0
- package/dist/src/styles/cytoscape/index.js +10 -0
- package/dist/src/styles/cytoscape/index.js.map +1 -0
- package/dist/src/styles/cytoscape/lexicon.d.ts +49 -0
- package/dist/src/styles/cytoscape/lexicon.d.ts.map +1 -0
- package/dist/src/styles/cytoscape/lexicon.js +605 -0
- package/dist/src/styles/cytoscape/lexicon.js.map +1 -0
- package/dist/src/styles/cytoscape/mappings.d.ts +171 -0
- package/dist/src/styles/cytoscape/mappings.d.ts.map +1 -0
- package/dist/src/styles/cytoscape/mappings.js +460 -0
- package/dist/src/styles/cytoscape/mappings.js.map +1 -0
- package/dist/src/styles/cytoscape/resolve.d.ts +137 -0
- package/dist/src/styles/cytoscape/resolve.d.ts.map +1 -0
- package/dist/src/styles/cytoscape/resolve.js +381 -0
- package/dist/src/styles/cytoscape/resolve.js.map +1 -0
- package/dist/src/styles/cytoscape/translate.d.ts +50 -0
- package/dist/src/styles/cytoscape/translate.d.ts.map +1 -0
- package/dist/src/styles/cytoscape/translate.js +156 -0
- package/dist/src/styles/cytoscape/translate.js.map +1 -0
- package/dist/src/styles/defaults.d.ts +90 -0
- package/dist/src/styles/defaults.d.ts.map +1 -0
- package/dist/src/styles/defaults.js +414 -0
- package/dist/src/styles/defaults.js.map +1 -0
- package/dist/src/styles/index.d.ts +15 -0
- package/dist/src/styles/index.d.ts.map +1 -0
- package/dist/src/styles/index.js +14 -0
- package/dist/src/styles/index.js.map +1 -0
- package/dist/src/styles/internal.d.ts +17 -0
- package/dist/src/styles/internal.d.ts.map +1 -0
- package/dist/src/styles/internal.js +16 -0
- package/dist/src/styles/internal.js.map +1 -0
- package/dist/src/styles/io/approximations.d.ts +24 -0
- package/dist/src/styles/io/approximations.d.ts.map +1 -0
- package/dist/src/styles/io/approximations.js +51 -0
- package/dist/src/styles/io/approximations.js.map +1 -0
- package/dist/src/styles/io/block.d.ts +166 -0
- package/dist/src/styles/io/block.d.ts.map +1 -0
- package/dist/src/styles/io/block.js +930 -0
- package/dist/src/styles/io/block.js.map +1 -0
- package/dist/src/styles/io/generic.d.ts +88 -0
- package/dist/src/styles/io/generic.d.ts.map +1 -0
- package/dist/src/styles/io/generic.js +516 -0
- package/dist/src/styles/io/generic.js.map +1 -0
- package/dist/src/styles/io/index.d.ts +8 -0
- package/dist/src/styles/io/index.d.ts.map +1 -0
- package/dist/src/styles/io/index.js +7 -0
- package/dist/src/styles/io/index.js.map +1 -0
- package/dist/src/styles/io/writer.d.ts +89 -0
- package/dist/src/styles/io/writer.d.ts.map +1 -0
- package/dist/src/styles/io/writer.js +626 -0
- package/dist/src/styles/io/writer.js.map +1 -0
- package/dist/src/styles/notes.d.ts +47 -0
- package/dist/src/styles/notes.d.ts.map +1 -0
- package/dist/src/styles/notes.js +140 -0
- package/dist/src/styles/notes.js.map +1 -0
- package/dist/src/styles/plan/classes.d.ts +31 -0
- package/dist/src/styles/plan/classes.d.ts.map +1 -0
- package/dist/src/styles/plan/classes.js +139 -0
- package/dist/src/styles/plan/classes.js.map +1 -0
- package/dist/src/styles/plan/continuous.d.ts +32 -0
- package/dist/src/styles/plan/continuous.d.ts.map +1 -0
- package/dist/src/styles/plan/continuous.js +165 -0
- package/dist/src/styles/plan/continuous.js.map +1 -0
- package/dist/src/styles/plan/discrete.d.ts +39 -0
- package/dist/src/styles/plan/discrete.d.ts.map +1 -0
- package/dist/src/styles/plan/discrete.js +127 -0
- package/dist/src/styles/plan/discrete.js.map +1 -0
- package/dist/src/styles/plan/families.d.ts +31 -0
- package/dist/src/styles/plan/families.d.ts.map +1 -0
- package/dist/src/styles/plan/families.js +95 -0
- package/dist/src/styles/plan/families.js.map +1 -0
- package/dist/src/styles/plan/features.d.ts +58 -0
- package/dist/src/styles/plan/features.d.ts.map +1 -0
- package/dist/src/styles/plan/features.js +185 -0
- package/dist/src/styles/plan/features.js.map +1 -0
- package/dist/src/styles/plan/index.d.ts +7 -0
- package/dist/src/styles/plan/index.d.ts.map +1 -0
- package/dist/src/styles/plan/index.js +7 -0
- package/dist/src/styles/plan/index.js.map +1 -0
- package/dist/src/styles/plan/plan.d.ts +71 -0
- package/dist/src/styles/plan/plan.d.ts.map +1 -0
- package/dist/src/styles/plan/plan.js +893 -0
- package/dist/src/styles/plan/plan.js.map +1 -0
- package/dist/src/styles/plan/resolve.d.ts +137 -0
- package/dist/src/styles/plan/resolve.d.ts.map +1 -0
- package/dist/src/styles/plan/resolve.js +587 -0
- package/dist/src/styles/plan/resolve.js.map +1 -0
- package/dist/src/styles/types.d.ts +702 -0
- package/dist/src/styles/types.d.ts.map +1 -0
- package/dist/src/styles/types.js +10 -0
- package/dist/src/styles/types.js.map +1 -0
- package/dist/src/styles/vocabulary.d.ts +41 -0
- package/dist/src/styles/vocabulary.d.ts.map +1 -0
- package/dist/src/styles/vocabulary.js +140 -0
- package/dist/src/styles/vocabulary.js.map +1 -0
- package/dist/src/types.d.ts +64 -1
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/types.js.map +1 -1
- package/dist/styles.d.ts +1 -0
- package/dist/styles.js +322 -0
- package/dist/styles.js.map +1 -0
- package/dist/xgmml.js +5 -4
- package/dist/xgmml.js.map +1 -1
- package/package.json +13 -2
- package/src/common/codes.ts +7 -0
- package/src/common/escape.ts +5 -2
- package/src/common/export.ts +179 -140
- package/src/common/input.ts +8 -4
- package/src/common/json-elements.ts +169 -38
- package/src/common/notes.ts +94 -0
- package/src/common/report.ts +41 -1
- package/src/common/units.ts +42 -0
- package/src/common/xml.ts +45 -5
- package/src/formats/cx/exporter.ts +95 -11
- package/src/formats/cx/importer.ts +126 -90
- package/src/formats/cx/styles.ts +304 -0
- package/src/formats/cx2/exporter.ts +234 -77
- package/src/formats/cx2/importer.ts +19 -1
- package/src/formats/cx2/styles.ts +29 -0
- package/src/formats/cys/constants.ts +3 -0
- package/src/formats/cys/exporter.ts +246 -60
- package/src/formats/cys/importer.ts +125 -9
- package/src/formats/cys/session.ts +6 -0
- package/src/formats/cys/styles.ts +254 -0
- package/src/formats/cys/tables.ts +117 -48
- package/src/formats/dot/exporter.ts +262 -126
- package/src/formats/dot/importer.ts +111 -20
- package/src/formats/dot/index.ts +1 -0
- package/src/formats/dot/positions.ts +77 -0
- package/src/formats/dot/styles.ts +1755 -0
- package/src/formats/gexf/exporter.ts +27 -11
- package/src/formats/gexf/importer.ts +308 -158
- package/src/formats/gexf/index.ts +10 -0
- package/src/formats/gexf/schema.ts +5 -0
- package/src/formats/gexf/styles.ts +719 -0
- package/src/formats/gml/exporter.ts +33 -14
- package/src/formats/gml/importer.ts +4 -0
- package/src/formats/gml/index.ts +2 -1
- package/src/formats/gml/positions.ts +52 -0
- package/src/formats/gml/styles.ts +1248 -0
- package/src/formats/gml/syntax.ts +173 -62
- package/src/formats/graphml/constants.ts +5 -0
- package/src/formats/graphml/exporter.ts +163 -71
- package/src/formats/graphml/importer.ts +119 -45
- package/src/formats/graphml/index.ts +1 -0
- package/src/formats/graphml/styles-plain.ts +236 -0
- package/src/formats/graphml/styles-yed.ts +1221 -0
- package/src/formats/graphml/styles-yfiles3.ts +573 -0
- package/src/formats/graphml/tree.ts +36 -20
- package/src/formats/graphml/yfiles.ts +89 -13
- package/src/formats/json/exporter.ts +76 -26
- package/src/formats/json/importer.ts +541 -322
- package/src/formats/json/positions.ts +50 -0
- package/src/formats/json/styles.ts +2082 -0
- package/src/formats/neo4j/exporter.ts +2 -1
- package/src/formats/pajek/exporter.ts +195 -106
- package/src/formats/pajek/importer.ts +78 -9
- package/src/formats/pajek/index.ts +2 -0
- package/src/formats/pajek/styles.ts +685 -0
- package/src/formats/pajek/syntax.ts +7 -0
- package/src/formats/xgmml/columns.ts +39 -9
- package/src/formats/xgmml/constants.ts +3 -0
- package/src/formats/xgmml/document.ts +54 -12
- package/src/formats/xgmml/emit.ts +11 -6
- package/src/formats/xgmml/exporter.ts +32 -13
- package/src/formats/xgmml/importer.ts +43 -29
- package/src/formats/xgmml/styles.ts +400 -0
- package/src/index.ts +16 -0
- package/src/positions/codes.ts +32 -0
- package/src/positions/convert.ts +123 -0
- package/src/positions/extract.ts +619 -0
- package/src/positions/index.ts +23 -0
- package/src/positions/types.ts +221 -0
- package/src/registry.ts +179 -8
- package/src/styles/annotations.ts +478 -0
- package/src/styles/budget.ts +60 -0
- package/src/styles/canon/bends.ts +84 -0
- package/src/styles/canon/color-tables.ts +386 -0
- package/src/styles/canon/color.ts +624 -0
- package/src/styles/canon/enums.ts +211 -0
- package/src/styles/canon/graphviz.ts +189 -0
- package/src/styles/canon/index.ts +13 -0
- package/src/styles/canon/number.ts +152 -0
- package/src/styles/canon/site.ts +87 -0
- package/src/styles/canon/text.ts +221 -0
- package/src/styles/codes.ts +104 -0
- package/src/styles/cyjs/cascade.ts +2670 -0
- package/src/styles/cyjs/defaults-table.ts +82 -0
- package/src/styles/cyjs/emit.ts +952 -0
- package/src/styles/cyjs/index.ts +37 -0
- package/src/styles/cyjs/live.ts +147 -0
- package/src/styles/cyjs/mappers.ts +879 -0
- package/src/styles/cyjs/selector.ts +778 -0
- package/src/styles/cyjs/stylesheet-text.ts +214 -0
- package/src/styles/cytoscape/emit.ts +1264 -0
- package/src/styles/cytoscape/index.ts +40 -0
- package/src/styles/cytoscape/lexicon.ts +658 -0
- package/src/styles/cytoscape/mappings.ts +603 -0
- package/src/styles/cytoscape/resolve.ts +521 -0
- package/src/styles/cytoscape/translate.ts +237 -0
- package/src/styles/defaults.ts +504 -0
- package/src/styles/index.ts +57 -0
- package/src/styles/internal.ts +17 -0
- package/src/styles/io/approximations.ts +47 -0
- package/src/styles/io/block.ts +1138 -0
- package/src/styles/io/generic.ts +687 -0
- package/src/styles/io/index.ts +18 -0
- package/src/styles/io/writer.ts +780 -0
- package/src/styles/notes.ts +165 -0
- package/src/styles/plan/classes.ts +166 -0
- package/src/styles/plan/continuous.ts +218 -0
- package/src/styles/plan/discrete.ts +165 -0
- package/src/styles/plan/families.ts +115 -0
- package/src/styles/plan/features.ts +234 -0
- package/src/styles/plan/index.ts +7 -0
- package/src/styles/plan/plan.ts +1129 -0
- package/src/styles/plan/resolve.ts +685 -0
- package/src/styles/types.ts +814 -0
- package/src/styles/vocabulary.ts +172 -0
- package/src/types.ts +76 -1
- package/dist/chunks/constants-fT3E8JYY.js.map +0 -1
- package/dist/chunks/escape-B62ZGM_a.js.map +0 -1
- package/dist/chunks/export-rKLeGQMo.js.map +0 -1
- package/dist/chunks/exporter-8hLNemFk.js.map +0 -1
- package/dist/chunks/exporter-BWwEuOPT.js.map +0 -1
- package/dist/chunks/exporter-RVtXVetw.js.map +0 -1
- package/dist/chunks/importer-BbNb7eNg.js.map +0 -1
- package/dist/chunks/importer-C98dpSH4.js.map +0 -1
- package/dist/chunks/importer-D794XUTe.js.map +0 -1
- package/dist/chunks/importer-Dz7tI8Sa.js.map +0 -1
- package/dist/chunks/importer-Ht7LNg8L.js.map +0 -1
- package/dist/chunks/importer-WrGRZb0N.js.map +0 -1
- package/dist/chunks/importer-xZ-3suY1.js.map +0 -1
- package/dist/chunks/json-elements-DKSqpNW1.js.map +0 -1
|
@@ -0,0 +1,2777 @@
|
|
|
1
|
+
import { a5 as STYLES_NOT_IMPORTED_CODE, $ as formatF32 } from "./format-BpQBx8MZ.js";
|
|
2
|
+
const STYLE_ISSUE = Object.freeze({
|
|
3
|
+
// ------------------------------------------------ reading values
|
|
4
|
+
/** A value longer than 256 characters was not parsed. */
|
|
5
|
+
VALUE_TOO_LONG: "W_STYLE_VALUE_TOO_LONG",
|
|
6
|
+
/** A value does not parse in the file's dialect (an unknown color name, a non-number, a negative length). */
|
|
7
|
+
BAD_VALUE: "W_STYLE_BAD_VALUE",
|
|
8
|
+
/** An enumeration value the vocabulary has no name for; kept as `other:<value>`. */
|
|
9
|
+
UNKNOWN_VALUE: "W_STYLE_UNKNOWN_VALUE",
|
|
10
|
+
/** A color's alpha was dropped because the property has no opacity to carry it. */
|
|
11
|
+
ALPHA_DROPPED: "W_STYLE_ALPHA_DROPPED",
|
|
12
|
+
/** A list of colors where one color is expected; the tool draws it its own way and the first is not taken. */
|
|
13
|
+
COLOR_LIST: "W_STYLE_COLOR_LIST",
|
|
14
|
+
/** A gradient fill; its first color is kept. */
|
|
15
|
+
GRADIENT: "W_STYLE_GRADIENT",
|
|
16
|
+
/** A node the tool draws unfilled although the file gives it a fill color. */
|
|
17
|
+
UNFILLED: "W_STYLE_UNFILLED",
|
|
18
|
+
/** A node fill the file marks as transparent or absent. */
|
|
19
|
+
NO_FILL: "W_STYLE_NO_FILL",
|
|
20
|
+
/** An edge stroke the file marks as absent. */
|
|
21
|
+
NO_STROKE: "W_STYLE_NO_STROKE",
|
|
22
|
+
/** The tool grows a node to fit its label, so the stated size is a minimum. */
|
|
23
|
+
SIZE_MINIMUM: "W_STYLE_SIZE_MINIMUM",
|
|
24
|
+
/** An HTML-like label: its text is kept and its markup dropped. */
|
|
25
|
+
HTML_LABEL: "W_STYLE_HTML_LABEL",
|
|
26
|
+
/** A record label: its fields are joined with " | ". */
|
|
27
|
+
RECORD_LABEL: "W_STYLE_RECORD_LABEL",
|
|
28
|
+
/** An element carries more than one label; the first is kept. */
|
|
29
|
+
EXTRA_LABELS: "W_STYLE_EXTRA_LABELS",
|
|
30
|
+
/** A color that inherits from the edge's ends in a way the vocabulary cannot express. */
|
|
31
|
+
INHERIT_COLOR: "W_STYLE_INHERIT_COLOR",
|
|
32
|
+
/** A style property the vocabulary has no counterpart for was not carried. */
|
|
33
|
+
NOT_CARRIED: "W_STYLE_NOT_CARRIED",
|
|
34
|
+
// ------------------------------------------------ reading declared styles
|
|
35
|
+
/** A declared mapping that cannot be read. */
|
|
36
|
+
BAD_MAPPING: "W_STYLE_BAD_MAPPING",
|
|
37
|
+
/** A declared mapping reads a column the file does not have. */
|
|
38
|
+
MAPPING_COLUMN_MISSING: "W_STYLE_MAPPING_COLUMN_MISSING",
|
|
39
|
+
/** References between style records that are circular or too deep; the rest are read. */
|
|
40
|
+
REFERENCE_CYCLE: "W_STYLE_REFERENCE_CYCLE",
|
|
41
|
+
/** A style reference that names nothing in the file. */
|
|
42
|
+
UNRESOLVED: "W_STYLE_UNRESOLVED",
|
|
43
|
+
/** Style structures nested deeper than graph-io reads. */
|
|
44
|
+
NESTING: "W_STYLE_NESTING",
|
|
45
|
+
/** A style section that cannot be read at all. */
|
|
46
|
+
UNREADABLE: "W_STYLE_UNREADABLE",
|
|
47
|
+
/** A Cytoscape session without its visual styles; the tool's fallbacks apply. */
|
|
48
|
+
NO_VIZMAP: "W_STYLE_NO_VIZMAP",
|
|
49
|
+
/** The view names a visual style the file does not hold. */
|
|
50
|
+
VIEW_STYLE_MISSING: "W_STYLE_VIEW_STYLE_MISSING",
|
|
51
|
+
/** The file holds more visual styles than the one its view uses; the others are not read. */
|
|
52
|
+
OTHER_STYLES: "W_STYLE_OTHER_STYLES",
|
|
53
|
+
/** The file holds more views than one; only the first view's styles are read. */
|
|
54
|
+
OTHER_VIEWS: "W_STYLE_OTHER_VIEWS",
|
|
55
|
+
/** A selector the tool treats as invalid, which matches every element there. */
|
|
56
|
+
SELECTOR: "W_STYLE_SELECTOR",
|
|
57
|
+
/** A selector a short predicate cannot express; its members are marked on the elements instead. */
|
|
58
|
+
SELECTOR_AS_COLUMN: "W_STYLE_SELECTOR_AS_COLUMN",
|
|
59
|
+
/** A selector state that changes while the tool runs (selected, hovered), evaluated as at load. */
|
|
60
|
+
STATE_ASSUMED: "W_STYLE_STATE_ASSUMED",
|
|
61
|
+
// ------------------------------------------------ planning
|
|
62
|
+
/** A continuous mapping matches the file's values only within the tool's rounding. */
|
|
63
|
+
RAMP_ROUNDED: "W_STYLE_RAMP_ROUNDED",
|
|
64
|
+
/** Rules were folded into a copy to keep the number of rules per kind bounded. */
|
|
65
|
+
LAYER_CAP: "W_STYLE_LAYER_CAP",
|
|
66
|
+
/** The counted work budget ran out; the values not yet explained are copied per element. */
|
|
67
|
+
BUDGET: "W_STYLE_BUDGET",
|
|
68
|
+
// ------------------------------------------------ graphty's own block
|
|
69
|
+
/** A `graphty.styles` block was ignored, with a reason code; the file is read like any other. */
|
|
70
|
+
BLOCK_IGNORED: "W_STYLE_BLOCK_IGNORED",
|
|
71
|
+
// ------------------------------------------------ export
|
|
72
|
+
/** The format has no place for this property; it is not written. */
|
|
73
|
+
NOT_WRITTEN: "W_STYLE_NOT_WRITTEN",
|
|
74
|
+
/** Written as the nearest value the format allows. */
|
|
75
|
+
APPROXIMATED: "W_STYLE_APPROXIMATED",
|
|
76
|
+
/** Per-element values were written but not the rules; importing the file infers them again. */
|
|
77
|
+
RULES_NOT_KEPT: "W_STYLE_RULES_NOT_KEPT",
|
|
78
|
+
/** A style was written as its per-element values and lost its editable form, with a reason code. */
|
|
79
|
+
LAYER_FLATTENED: "W_STYLE_LAYER_FLATTENED",
|
|
80
|
+
// ------------------------------------------------ styles as a whole
|
|
81
|
+
/** The file holds styles that were not imported; import them with the `styles` option. */
|
|
82
|
+
NOT_IMPORTED: STYLES_NOT_IMPORTED_CODE,
|
|
83
|
+
/** The graph has styles that were not exported; export them with the `styles` option. */
|
|
84
|
+
NOT_EXPORTED: "W_STYLES_NOT_EXPORTED",
|
|
85
|
+
/** The styles were read from or built for a different graph; nothing is written. */
|
|
86
|
+
MISMATCH: "E_STYLES_MISMATCH"
|
|
87
|
+
});
|
|
88
|
+
const MAX_STYLE_VALUE_LENGTH = 256;
|
|
89
|
+
function noteAt(site, code, sample) {
|
|
90
|
+
site.notes.add(code, site.target, site.property, { sample, element: site.element });
|
|
91
|
+
}
|
|
92
|
+
function spendAt(site, operations) {
|
|
93
|
+
site.budget?.spend(site.target === "graph" ? "node" : site.target, operations);
|
|
94
|
+
}
|
|
95
|
+
function scalarText(raw, site) {
|
|
96
|
+
spendAt(site, 1);
|
|
97
|
+
if (raw === null || raw === void 0) {
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
if (typeof raw === "number") {
|
|
101
|
+
if (Number.isFinite(raw)) {
|
|
102
|
+
return String(raw);
|
|
103
|
+
}
|
|
104
|
+
noteAt(site, STYLE_ISSUE.BAD_VALUE, String(raw));
|
|
105
|
+
return null;
|
|
106
|
+
}
|
|
107
|
+
if (typeof raw !== "string") {
|
|
108
|
+
noteAt(site, STYLE_ISSUE.BAD_VALUE, typeof raw);
|
|
109
|
+
return null;
|
|
110
|
+
}
|
|
111
|
+
if (raw.length > MAX_STYLE_VALUE_LENGTH) {
|
|
112
|
+
noteAt(site, STYLE_ISSUE.VALUE_TOO_LONG, `${raw.length} characters`);
|
|
113
|
+
return null;
|
|
114
|
+
}
|
|
115
|
+
spendAt(site, raw.length);
|
|
116
|
+
if (raw.trim() === "") {
|
|
117
|
+
noteAt(site, STYLE_ISSUE.BAD_VALUE, raw);
|
|
118
|
+
return null;
|
|
119
|
+
}
|
|
120
|
+
return raw;
|
|
121
|
+
}
|
|
122
|
+
const MAX_STYLE_NUMBER = 1e6;
|
|
123
|
+
const DOT_POINTS_PER_INCH = 72;
|
|
124
|
+
const DECIMAL$1 = /^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/;
|
|
125
|
+
function num6$1(value) {
|
|
126
|
+
return Number(value.toPrecision(6)) + 0;
|
|
127
|
+
}
|
|
128
|
+
function finite(raw, site) {
|
|
129
|
+
if (typeof raw === "boolean") {
|
|
130
|
+
noteAt(site, STYLE_ISSUE.BAD_VALUE, raw);
|
|
131
|
+
return null;
|
|
132
|
+
}
|
|
133
|
+
const text = scalarText(raw, site);
|
|
134
|
+
if (text === null) {
|
|
135
|
+
return null;
|
|
136
|
+
}
|
|
137
|
+
const trimmed = text.trim();
|
|
138
|
+
let value = Number.NaN;
|
|
139
|
+
if (typeof raw === "number") {
|
|
140
|
+
value = raw;
|
|
141
|
+
} else if (DECIMAL$1.test(trimmed)) {
|
|
142
|
+
value = Number(trimmed);
|
|
143
|
+
}
|
|
144
|
+
if (!Number.isFinite(value)) {
|
|
145
|
+
noteAt(site, STYLE_ISSUE.BAD_VALUE, text);
|
|
146
|
+
return null;
|
|
147
|
+
}
|
|
148
|
+
return value;
|
|
149
|
+
}
|
|
150
|
+
function canonNumber(raw, site, factor = 1) {
|
|
151
|
+
const value = finite(raw, site);
|
|
152
|
+
if (value === null) {
|
|
153
|
+
return null;
|
|
154
|
+
}
|
|
155
|
+
const scaled = value * factor;
|
|
156
|
+
if (!(scaled >= 0 && scaled <= MAX_STYLE_NUMBER)) {
|
|
157
|
+
noteAt(site, STYLE_ISSUE.BAD_VALUE, typeof raw === "string" ? raw : String(raw));
|
|
158
|
+
return null;
|
|
159
|
+
}
|
|
160
|
+
return num6$1(scaled);
|
|
161
|
+
}
|
|
162
|
+
function canonOpacity(raw, dialect, site) {
|
|
163
|
+
const value = finite(raw, site);
|
|
164
|
+
if (value === null) {
|
|
165
|
+
return null;
|
|
166
|
+
}
|
|
167
|
+
const top = dialect === "cytoscape" ? 255 : 1;
|
|
168
|
+
if (!(value >= 0 && value <= top)) {
|
|
169
|
+
noteAt(site, STYLE_ISSUE.BAD_VALUE, typeof raw === "string" ? raw : String(raw));
|
|
170
|
+
return null;
|
|
171
|
+
}
|
|
172
|
+
return num6$1(value / top);
|
|
173
|
+
}
|
|
174
|
+
const BOOLEANS = /* @__PURE__ */ new Map([
|
|
175
|
+
["true", true],
|
|
176
|
+
["yes", true],
|
|
177
|
+
["on", true],
|
|
178
|
+
["1", true],
|
|
179
|
+
["false", false],
|
|
180
|
+
["no", false],
|
|
181
|
+
["off", false],
|
|
182
|
+
["0", false]
|
|
183
|
+
]);
|
|
184
|
+
function canonBoolean(raw, site) {
|
|
185
|
+
if (typeof raw === "boolean") {
|
|
186
|
+
spendAt(site, 1);
|
|
187
|
+
return raw;
|
|
188
|
+
}
|
|
189
|
+
const text = scalarText(raw, site);
|
|
190
|
+
if (text === null) {
|
|
191
|
+
return null;
|
|
192
|
+
}
|
|
193
|
+
const value = BOOLEANS.get(text.trim().toLowerCase());
|
|
194
|
+
if (value === void 0) {
|
|
195
|
+
noteAt(site, STYLE_ISSUE.BAD_VALUE, text);
|
|
196
|
+
return null;
|
|
197
|
+
}
|
|
198
|
+
return value;
|
|
199
|
+
}
|
|
200
|
+
function styleLengthUnit(dialect) {
|
|
201
|
+
return dialect === "gexf" || dialect === "dvips" ? "relative" : "px";
|
|
202
|
+
}
|
|
203
|
+
const MAX_SAMPLES = 8;
|
|
204
|
+
const MAX_SAMPLE_LENGTH = 80;
|
|
205
|
+
const PHRASES = /* @__PURE__ */ new Map([
|
|
206
|
+
["W_STYLE_VALUE_TOO_LONG", "values longer than 256 characters were not parsed"],
|
|
207
|
+
["W_STYLE_BAD_VALUE", "values do not parse"],
|
|
208
|
+
["W_STYLE_UNKNOWN_VALUE", "values have no name in the vocabulary and are kept as other:<value>"],
|
|
209
|
+
["W_STYLE_ALPHA_DROPPED", "color alpha was dropped"],
|
|
210
|
+
["W_STYLE_COLOR_LIST", "color lists are not read as one color"],
|
|
211
|
+
["W_STYLE_GRADIENT", "gradients are read as their first color"],
|
|
212
|
+
["W_STYLE_UNFILLED", "nodes with a fill color are drawn unfilled"],
|
|
213
|
+
["W_STYLE_NO_FILL", "fills are marked transparent"],
|
|
214
|
+
["W_STYLE_NO_STROKE", "strokes are marked absent"],
|
|
215
|
+
["W_STYLE_SIZE_MINIMUM", "node sizes are minimums: the node grows to fit its label"],
|
|
216
|
+
["W_STYLE_HTML_LABEL", "HTML-like labels keep their text; markup was dropped"],
|
|
217
|
+
["W_STYLE_RECORD_LABEL", "record label fields were joined"],
|
|
218
|
+
["W_STYLE_EXTRA_LABELS", "elements have more than one label; the first was kept"],
|
|
219
|
+
["W_STYLE_INHERIT_COLOR", "inherited colors cannot be expressed"],
|
|
220
|
+
["W_STYLE_NOT_CARRIED", "style properties have no counterpart and were not carried"],
|
|
221
|
+
["W_STYLE_BAD_MAPPING", "mappings cannot be read"],
|
|
222
|
+
["W_STYLE_MAPPING_COLUMN_MISSING", "mappings read a column the file does not have"],
|
|
223
|
+
["W_STYLE_REFERENCE_CYCLE", "style references are circular or too deep"],
|
|
224
|
+
["W_STYLE_UNRESOLVED", "style references name nothing"],
|
|
225
|
+
["W_STYLE_NESTING", "style structures are nested too deep"],
|
|
226
|
+
["W_STYLE_UNREADABLE", "a style section cannot be read"],
|
|
227
|
+
["W_STYLE_NO_VIZMAP", "the session holds no visual styles"],
|
|
228
|
+
["W_STYLE_VIEW_STYLE_MISSING", "the view names a style the file does not hold"],
|
|
229
|
+
["W_STYLE_OTHER_STYLES", "other visual styles were not read"],
|
|
230
|
+
["W_STYLE_OTHER_VIEWS", "other views were not read"],
|
|
231
|
+
["W_STYLE_SELECTOR", "invalid selectors match every element"],
|
|
232
|
+
["W_STYLE_SELECTOR_AS_COLUMN", "selectors were evaluated into per-element values"],
|
|
233
|
+
["W_STYLE_STATE_ASSUMED", "selector states were evaluated as at load"],
|
|
234
|
+
["W_STYLE_RAMP_ROUNDED", "continuous mappings match within the tool's rounding"],
|
|
235
|
+
["W_STYLE_LAYER_CAP", "rules were folded into per-element copies"],
|
|
236
|
+
["W_STYLE_BUDGET", "the work budget ran out; values were copied per element"],
|
|
237
|
+
["W_STYLE_BLOCK_IGNORED", "the graphty.styles block was ignored"],
|
|
238
|
+
["W_STYLE_NOT_WRITTEN", "the format cannot hold this style"],
|
|
239
|
+
["W_STYLE_APPROXIMATED", "written as the nearest value the format allows"],
|
|
240
|
+
["W_STYLE_RULES_NOT_KEPT", "per-element values were written but not the rules"],
|
|
241
|
+
["W_STYLE_LAYER_FLATTENED", "a style was written as per-element values"]
|
|
242
|
+
]);
|
|
243
|
+
class StyleNotes {
|
|
244
|
+
#notes = /* @__PURE__ */ new Map();
|
|
245
|
+
/**
|
|
246
|
+
* Records one occurrence (or `count` occurrences) of a condition.
|
|
247
|
+
* @param code - the condition
|
|
248
|
+
* @param target - nodes, edges, the graph, or null for the file as a whole
|
|
249
|
+
* @param property - the property or the file's name for the construct, or null
|
|
250
|
+
* @param report - a sample, the element index and a count
|
|
251
|
+
*/
|
|
252
|
+
add(code, target, property, report = {}) {
|
|
253
|
+
const key = `${code}\0${target ?? ""}\0${property ?? ""}`;
|
|
254
|
+
let note = this.#notes.get(key);
|
|
255
|
+
if (note === void 0) {
|
|
256
|
+
note = { code, target, property, count: 0, samples: [], elements: /* @__PURE__ */ new Set(), unindexed: false };
|
|
257
|
+
this.#notes.set(key, note);
|
|
258
|
+
}
|
|
259
|
+
note.count += report.count ?? 1;
|
|
260
|
+
if (report.element === void 0) {
|
|
261
|
+
note.unindexed = true;
|
|
262
|
+
} else {
|
|
263
|
+
note.elements.add(report.element);
|
|
264
|
+
}
|
|
265
|
+
if (report.sample !== void 0 && note.samples.length < MAX_SAMPLES) {
|
|
266
|
+
const sample = sampleText(report.sample);
|
|
267
|
+
if (!note.samples.includes(sample)) {
|
|
268
|
+
note.samples.push(sample);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Whether a note with this code, target and property covers an element.
|
|
274
|
+
* @param code - the condition
|
|
275
|
+
* @param target - nodes or edges
|
|
276
|
+
* @param property - the property
|
|
277
|
+
* @param element - the element index
|
|
278
|
+
* @returns true when such a note named the element
|
|
279
|
+
*/
|
|
280
|
+
covers(code, target, property, element) {
|
|
281
|
+
return this.#notes.get(`${code}\0${target}\0${property ?? ""}`)?.elements.has(element) === true;
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* The collected notes, in the order their conditions first occurred.
|
|
285
|
+
* @returns one note per (code, target, property)
|
|
286
|
+
*/
|
|
287
|
+
list() {
|
|
288
|
+
const out = [];
|
|
289
|
+
for (const n of this.#notes.values()) {
|
|
290
|
+
const where = n.property === null ? n.target ?? "file" : `${n.target ?? "file"} ${n.property}`;
|
|
291
|
+
out.push({
|
|
292
|
+
code: n.code,
|
|
293
|
+
params: { property: n.property, target: n.target, count: n.count, samples: [...n.samples] },
|
|
294
|
+
elements: n.unindexed ? { count: n.count } : Array.from(n.elements).sort((a, b) => a - b),
|
|
295
|
+
message: `${where}: ${PHRASES.get(n.code) ?? n.code} (${n.count})`
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
return out;
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
function sampleText(value) {
|
|
302
|
+
let text;
|
|
303
|
+
if (typeof value === "string") {
|
|
304
|
+
text = value;
|
|
305
|
+
} else {
|
|
306
|
+
try {
|
|
307
|
+
text = JSON.stringify(value) ?? typeof value;
|
|
308
|
+
} catch {
|
|
309
|
+
text = typeof value;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
return text.slice(0, MAX_SAMPLE_LENGTH);
|
|
313
|
+
}
|
|
314
|
+
const SHAPES = {
|
|
315
|
+
ellipse: [
|
|
316
|
+
"ellipse",
|
|
317
|
+
"oval",
|
|
318
|
+
"circle",
|
|
319
|
+
"disc",
|
|
320
|
+
"disk",
|
|
321
|
+
"point",
|
|
322
|
+
"doublecircle",
|
|
323
|
+
"mcircle",
|
|
324
|
+
"dot",
|
|
325
|
+
"sphere",
|
|
326
|
+
"circular"
|
|
327
|
+
],
|
|
328
|
+
rectangle: [
|
|
329
|
+
"rectangle",
|
|
330
|
+
"rect",
|
|
331
|
+
"box",
|
|
332
|
+
"square",
|
|
333
|
+
"plaintext",
|
|
334
|
+
"plain",
|
|
335
|
+
"record",
|
|
336
|
+
"msquare",
|
|
337
|
+
"box3d",
|
|
338
|
+
"rectangle3d",
|
|
339
|
+
"component",
|
|
340
|
+
"tab",
|
|
341
|
+
"folder",
|
|
342
|
+
"note",
|
|
343
|
+
"underline"
|
|
344
|
+
],
|
|
345
|
+
"round-rectangle": [
|
|
346
|
+
"round-rectangle",
|
|
347
|
+
"roundrectangle",
|
|
348
|
+
"roundrect",
|
|
349
|
+
"rounded",
|
|
350
|
+
"roundedrectangle",
|
|
351
|
+
"round-rect",
|
|
352
|
+
"mrecord",
|
|
353
|
+
"cut-rectangle",
|
|
354
|
+
"round-tag",
|
|
355
|
+
"bottom-round-rectangle"
|
|
356
|
+
],
|
|
357
|
+
triangle: ["triangle", "invtriangle", "round-triangle", "tag"],
|
|
358
|
+
diamond: ["diamond", "rhombus", "mdiamond", "round-diamond"],
|
|
359
|
+
pentagon: ["pentagon", "round-pentagon"],
|
|
360
|
+
hexagon: ["hexagon", "hexagon2", "round-hexagon", "concave-hexagon", "septagon", "heptagon", "round-heptagon"],
|
|
361
|
+
octagon: ["octagon", "doubleoctagon", "tripleoctagon", "round-octagon", "octagon2"],
|
|
362
|
+
parallelogram: ["parallelogram", "parallelogram2", "rhomboid", "fat-arrow", "fatarrow"],
|
|
363
|
+
trapezoid: ["trapezoid", "trapezoid2", "invtrapezoid", "trapezium", "round-trapezoid"],
|
|
364
|
+
star: ["star", "star5", "star6", "star8", "polygon"],
|
|
365
|
+
vee: ["vee", "v"],
|
|
366
|
+
none: ["none", "empty", "invis"]
|
|
367
|
+
};
|
|
368
|
+
const BORDER_STYLES = {
|
|
369
|
+
solid: ["solid", "line"],
|
|
370
|
+
dashed: ["dashed", "dash", "equal-dash"],
|
|
371
|
+
dotted: ["dotted", "dot", "dots"],
|
|
372
|
+
"dash-dot": ["dash-dot", "dashdot", "dashed-dotted"],
|
|
373
|
+
double: ["double", "parallel-lines"]
|
|
374
|
+
};
|
|
375
|
+
const LINE_STYLES = {
|
|
376
|
+
solid: ["solid", "line", "continuous", "separate-arrow"],
|
|
377
|
+
dashed: ["dashed", "dash", "dashed-line", "equal-dash"],
|
|
378
|
+
dotted: ["dotted", "dot", "dots", "dotted-line"],
|
|
379
|
+
"dash-dot": ["dash-dot", "dashdot", "dashed-dotted", "dash-dot-dot"],
|
|
380
|
+
"long-dash": ["long-dash", "longdash"],
|
|
381
|
+
double: ["double", "parallel", "parallel-lines"],
|
|
382
|
+
zigzag: ["zigzag"],
|
|
383
|
+
sinewave: ["sinewave", "sine-wave"]
|
|
384
|
+
};
|
|
385
|
+
const ARROWS = {
|
|
386
|
+
none: ["none", "no-arrow", "noarrow", "0"],
|
|
387
|
+
triangle: [
|
|
388
|
+
"triangle",
|
|
389
|
+
"normal",
|
|
390
|
+
"delta",
|
|
391
|
+
"standard",
|
|
392
|
+
"arrow",
|
|
393
|
+
"triangle-backcurve",
|
|
394
|
+
"white-delta-inverted",
|
|
395
|
+
"simple",
|
|
396
|
+
"short",
|
|
397
|
+
"plain",
|
|
398
|
+
"convex",
|
|
399
|
+
"a"
|
|
400
|
+
],
|
|
401
|
+
"triangle-open": ["triangle-open", "onormal", "empty", "white-delta", "transparent-circle-inverted", "open-delta"],
|
|
402
|
+
vee: ["vee", "open", "chevron", "concave", "triangle-cross", "b"],
|
|
403
|
+
tee: ["tee", "t", "t-shape", "half-bottom", "half-top", "bar"],
|
|
404
|
+
diamond: ["diamond", "white-diamond-inverted"],
|
|
405
|
+
"diamond-open": ["diamond-open", "odiamond", "white-diamond", "ediamond", "open-diamond"],
|
|
406
|
+
circle: ["circle", "dot", "transparent-circle", "white-circle-inverted"],
|
|
407
|
+
"circle-open": ["circle-open", "odot", "white-circle", "open-circle"],
|
|
408
|
+
square: ["square", "box", "skewed-dash"],
|
|
409
|
+
// An X-shaped "cross" (yEd, yFiles) is not a crow's foot: it stays other:cross.
|
|
410
|
+
crow: ["crow", "crows-foot", "crows-foot-many"],
|
|
411
|
+
half: ["half", "half-top-arrow", "half-open", "lnormal", "rnormal", "halfopen"],
|
|
412
|
+
inverted: ["inverted", "inv", "inverted-triangle", "inv-triangle"]
|
|
413
|
+
};
|
|
414
|
+
const WEIGHTS = {
|
|
415
|
+
normal: ["normal", "regular", "plain", "lighter", "100", "200", "300", "400", "500"],
|
|
416
|
+
bold: ["bold", "bolder", "600", "700", "800", "900"]
|
|
417
|
+
};
|
|
418
|
+
const POSITIONS = {
|
|
419
|
+
center: ["center", "centre", "middle", "c"],
|
|
420
|
+
top: ["top", "north", "t"],
|
|
421
|
+
bottom: ["bottom", "south", "b"],
|
|
422
|
+
left: ["left", "west", "l"],
|
|
423
|
+
right: ["right", "east", "r"],
|
|
424
|
+
"top-left": ["top-left", "north-west", "northwest"],
|
|
425
|
+
"top-right": ["top-right", "north-east", "northeast"],
|
|
426
|
+
"bottom-left": ["bottom-left", "south-west", "southwest"],
|
|
427
|
+
"bottom-right": ["bottom-right", "south-east", "southeast"]
|
|
428
|
+
};
|
|
429
|
+
const VIS$1 = {
|
|
430
|
+
shape: {
|
|
431
|
+
"round-rectangle": ["box"],
|
|
432
|
+
ellipse: ["dot"],
|
|
433
|
+
triangle: ["triangledown"],
|
|
434
|
+
none: ["text"]
|
|
435
|
+
},
|
|
436
|
+
arrow: { inverted: ["inv-triangle"], square: ["box"] }
|
|
437
|
+
};
|
|
438
|
+
const OVERRIDES = /* @__PURE__ */ new Map([["vis", VIS$1]]);
|
|
439
|
+
const OPEN = /* @__PURE__ */ new Set(["shape", "borderStyle", "lineStyle", "arrow"]);
|
|
440
|
+
function lookup(aliases) {
|
|
441
|
+
const map = /* @__PURE__ */ new Map();
|
|
442
|
+
for (const [value, spellings] of Object.entries(aliases)) {
|
|
443
|
+
for (const spelling of spellings) {
|
|
444
|
+
map.set(spelling, value);
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
return map;
|
|
448
|
+
}
|
|
449
|
+
const COMMON = /* @__PURE__ */ new Map([
|
|
450
|
+
["shape", lookup(SHAPES)],
|
|
451
|
+
["borderStyle", lookup(BORDER_STYLES)],
|
|
452
|
+
["lineStyle", lookup(LINE_STYLES)],
|
|
453
|
+
["arrow", lookup(ARROWS)],
|
|
454
|
+
["weight", lookup(WEIGHTS)],
|
|
455
|
+
["position", lookup(POSITIONS)]
|
|
456
|
+
]);
|
|
457
|
+
const DIALECT = new Map(
|
|
458
|
+
Array.from(OVERRIDES, ([dialect, kinds]) => [
|
|
459
|
+
dialect,
|
|
460
|
+
new Map(Object.entries(kinds).map(([kind, aliases]) => [kind, lookup(aliases)]))
|
|
461
|
+
])
|
|
462
|
+
);
|
|
463
|
+
function canonEnum(kind, raw, dialect, site) {
|
|
464
|
+
const text = scalarText(raw, site);
|
|
465
|
+
if (text === null) {
|
|
466
|
+
return null;
|
|
467
|
+
}
|
|
468
|
+
const trimmed = text.trim();
|
|
469
|
+
const key = trimmed.toLowerCase().replaceAll(/[\s_]+/g, "-");
|
|
470
|
+
const value = DIALECT.get(dialect)?.get(kind)?.get(key) ?? COMMON.get(kind)?.get(key);
|
|
471
|
+
if (value !== void 0) {
|
|
472
|
+
return value;
|
|
473
|
+
}
|
|
474
|
+
noteAt(site, STYLE_ISSUE.UNKNOWN_VALUE, trimmed);
|
|
475
|
+
return OPEN.has(kind) ? `other:${trimmed}` : null;
|
|
476
|
+
}
|
|
477
|
+
function canonText(raw, site) {
|
|
478
|
+
spendAt(site, 1);
|
|
479
|
+
if (raw === null || raw === void 0) {
|
|
480
|
+
return null;
|
|
481
|
+
}
|
|
482
|
+
if (typeof raw === "string") {
|
|
483
|
+
spendAt(site, raw.length);
|
|
484
|
+
return raw;
|
|
485
|
+
}
|
|
486
|
+
if (typeof raw === "number" && Number.isFinite(raw) || typeof raw === "boolean") {
|
|
487
|
+
return String(raw);
|
|
488
|
+
}
|
|
489
|
+
noteAt(site, STYLE_ISSUE.BAD_VALUE, typeof raw === "number" ? String(raw) : typeof raw);
|
|
490
|
+
return null;
|
|
491
|
+
}
|
|
492
|
+
function dotLabelText(text, names, site) {
|
|
493
|
+
if (site !== void 0) {
|
|
494
|
+
spendAt(site, text.length);
|
|
495
|
+
}
|
|
496
|
+
const subs = {
|
|
497
|
+
N: names.node,
|
|
498
|
+
G: names.graph,
|
|
499
|
+
E: names.edge,
|
|
500
|
+
T: names.tail,
|
|
501
|
+
H: names.head
|
|
502
|
+
};
|
|
503
|
+
const first = replaceEscapes(text, (e) => (Object.hasOwn(subs, e) ? subs[e] : void 0) ?? `\\${e}`);
|
|
504
|
+
const out = replaceEscapes(first, (e) => e === "n" || e === "l" || e === "r" ? "\n" : e);
|
|
505
|
+
return out.endsWith("\n") ? out.slice(0, -1) : out;
|
|
506
|
+
}
|
|
507
|
+
function replaceEscapes(text, replace) {
|
|
508
|
+
let out = "";
|
|
509
|
+
let i = 0;
|
|
510
|
+
while (i < text.length) {
|
|
511
|
+
const c = text[i];
|
|
512
|
+
if (c === "\\" && i + 1 < text.length) {
|
|
513
|
+
out += replace(text[i + 1]);
|
|
514
|
+
i += 2;
|
|
515
|
+
} else {
|
|
516
|
+
out += c;
|
|
517
|
+
i++;
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
return out;
|
|
521
|
+
}
|
|
522
|
+
const ENTITIES = /* @__PURE__ */ new Map([
|
|
523
|
+
["amp", "&"],
|
|
524
|
+
["lt", "<"],
|
|
525
|
+
["gt", ">"],
|
|
526
|
+
["quot", '"'],
|
|
527
|
+
["apos", "'"],
|
|
528
|
+
["nbsp", " "]
|
|
529
|
+
]);
|
|
530
|
+
function entity(body) {
|
|
531
|
+
if (body.startsWith("#")) {
|
|
532
|
+
const hex = body[1] === "x" || body[1] === "X";
|
|
533
|
+
const digits = body.slice(hex ? 2 : 1);
|
|
534
|
+
if (digits === "" || digits.length > 7 || !(hex ? /^[0-9a-f]+$/i : /^\d+$/).test(digits)) {
|
|
535
|
+
return void 0;
|
|
536
|
+
}
|
|
537
|
+
const cp = Number.parseInt(digits, hex ? 16 : 10);
|
|
538
|
+
return cp > 0 && cp <= 1114111 ? String.fromCodePoint(cp) : void 0;
|
|
539
|
+
}
|
|
540
|
+
return ENTITIES.get(body.toLowerCase());
|
|
541
|
+
}
|
|
542
|
+
function htmlLabelText(html, site) {
|
|
543
|
+
spendAt(site, html.length);
|
|
544
|
+
noteAt(site, STYLE_ISSUE.HTML_LABEL, html);
|
|
545
|
+
const body = html.startsWith("<") && html.endsWith(">") ? html.slice(1, -1) : html;
|
|
546
|
+
let out = "";
|
|
547
|
+
let i = 0;
|
|
548
|
+
while (i < body.length) {
|
|
549
|
+
const c = body[i];
|
|
550
|
+
if (c === "<") {
|
|
551
|
+
const close = body.indexOf(">", i + 1);
|
|
552
|
+
if (close < 0) {
|
|
553
|
+
break;
|
|
554
|
+
}
|
|
555
|
+
if (/^<br\b/i.test(body.slice(i, i + 4))) {
|
|
556
|
+
out += "\n";
|
|
557
|
+
}
|
|
558
|
+
i = close + 1;
|
|
559
|
+
} else if (c === "&") {
|
|
560
|
+
const [text, next] = entityAt(body, i);
|
|
561
|
+
out += text;
|
|
562
|
+
i = next;
|
|
563
|
+
} else {
|
|
564
|
+
out += c;
|
|
565
|
+
i++;
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
return out.trim();
|
|
569
|
+
}
|
|
570
|
+
function entityAt(body, i) {
|
|
571
|
+
const near = body.slice(i + 1, i + 10).indexOf(";");
|
|
572
|
+
const semi = near < 0 ? -1 : i + 1 + near;
|
|
573
|
+
const decoded = semi > i ? entity(body.slice(i + 1, semi)) : void 0;
|
|
574
|
+
return decoded === void 0 ? ["&", i + 1] : [decoded, semi + 1];
|
|
575
|
+
}
|
|
576
|
+
function recordLabelText(label, site) {
|
|
577
|
+
spendAt(site, label.length);
|
|
578
|
+
noteAt(site, STYLE_ISSUE.RECORD_LABEL, label);
|
|
579
|
+
const fields = [];
|
|
580
|
+
let field = "";
|
|
581
|
+
const flush = () => {
|
|
582
|
+
const t = field.trim();
|
|
583
|
+
if (t !== "") {
|
|
584
|
+
fields.push(t);
|
|
585
|
+
}
|
|
586
|
+
field = "";
|
|
587
|
+
};
|
|
588
|
+
let i = 0;
|
|
589
|
+
while (i < label.length) {
|
|
590
|
+
const c = label[i];
|
|
591
|
+
if (c === "\\" && i + 1 < label.length && "|{}<> ".includes(label[i + 1])) {
|
|
592
|
+
field += label[i + 1];
|
|
593
|
+
i += 2;
|
|
594
|
+
continue;
|
|
595
|
+
}
|
|
596
|
+
if (c === "<") {
|
|
597
|
+
const close = label.indexOf(">", i + 1);
|
|
598
|
+
i = close < 0 ? label.length : close + 1;
|
|
599
|
+
continue;
|
|
600
|
+
}
|
|
601
|
+
if (c === "|" || c === "{" || c === "}") {
|
|
602
|
+
flush();
|
|
603
|
+
} else {
|
|
604
|
+
field += c;
|
|
605
|
+
}
|
|
606
|
+
i++;
|
|
607
|
+
}
|
|
608
|
+
flush();
|
|
609
|
+
return fields.join(" | ");
|
|
610
|
+
}
|
|
611
|
+
const STYLE_PROPERTIES = Object.freeze({
|
|
612
|
+
node: /* @__PURE__ */ new Map([
|
|
613
|
+
["fill", "color"],
|
|
614
|
+
["borderColor", "color"],
|
|
615
|
+
["labelColor", "color"],
|
|
616
|
+
["fillOpacity", "opacity"],
|
|
617
|
+
["opacity", "opacity"],
|
|
618
|
+
["width", "number"],
|
|
619
|
+
["height", "number"],
|
|
620
|
+
["borderWidth", "number"],
|
|
621
|
+
["cornerRadius", "number"],
|
|
622
|
+
["labelSize", "number"],
|
|
623
|
+
["shape", "shape"],
|
|
624
|
+
["borderStyle", "borderStyle"],
|
|
625
|
+
["label", "text"],
|
|
626
|
+
["tooltip", "text"],
|
|
627
|
+
["labelFont", "text"],
|
|
628
|
+
["labelWeight", "weight"],
|
|
629
|
+
["labelItalic", "boolean"],
|
|
630
|
+
["labelPosition", "position"],
|
|
631
|
+
["image", "text"],
|
|
632
|
+
["visible", "boolean"]
|
|
633
|
+
]),
|
|
634
|
+
edge: /* @__PURE__ */ new Map([
|
|
635
|
+
["color", "color"],
|
|
636
|
+
["sourceArrowColor", "color"],
|
|
637
|
+
["targetArrowColor", "color"],
|
|
638
|
+
["labelColor", "color"],
|
|
639
|
+
["opacity", "opacity"],
|
|
640
|
+
["width", "number"],
|
|
641
|
+
["labelSize", "number"],
|
|
642
|
+
["arrowSize", "number"],
|
|
643
|
+
["lineStyle", "lineStyle"],
|
|
644
|
+
["sourceArrow", "arrow"],
|
|
645
|
+
["targetArrow", "arrow"],
|
|
646
|
+
["curved", "boolean"],
|
|
647
|
+
["bends", "text"],
|
|
648
|
+
["label", "text"],
|
|
649
|
+
["tooltip", "text"],
|
|
650
|
+
["labelFont", "text"],
|
|
651
|
+
["labelWeight", "weight"],
|
|
652
|
+
["labelItalic", "boolean"],
|
|
653
|
+
["sourceLabel", "text"],
|
|
654
|
+
["targetLabel", "text"],
|
|
655
|
+
["visible", "boolean"]
|
|
656
|
+
]),
|
|
657
|
+
graph: /* @__PURE__ */ new Map([["background", "color"]])
|
|
658
|
+
});
|
|
659
|
+
const STYLE_ENUMS = /* @__PURE__ */ new Map([
|
|
660
|
+
[
|
|
661
|
+
"shape",
|
|
662
|
+
[
|
|
663
|
+
"ellipse",
|
|
664
|
+
"rectangle",
|
|
665
|
+
"round-rectangle",
|
|
666
|
+
"triangle",
|
|
667
|
+
"diamond",
|
|
668
|
+
"pentagon",
|
|
669
|
+
"hexagon",
|
|
670
|
+
"octagon",
|
|
671
|
+
"parallelogram",
|
|
672
|
+
"trapezoid",
|
|
673
|
+
"star",
|
|
674
|
+
"vee",
|
|
675
|
+
"none"
|
|
676
|
+
]
|
|
677
|
+
],
|
|
678
|
+
["borderStyle", ["solid", "dashed", "dotted", "dash-dot", "double"]],
|
|
679
|
+
["lineStyle", ["solid", "dashed", "dotted", "dash-dot", "long-dash", "double", "zigzag", "sinewave"]],
|
|
680
|
+
[
|
|
681
|
+
"arrow",
|
|
682
|
+
[
|
|
683
|
+
"none",
|
|
684
|
+
"triangle",
|
|
685
|
+
"triangle-open",
|
|
686
|
+
"vee",
|
|
687
|
+
"tee",
|
|
688
|
+
"diamond",
|
|
689
|
+
"diamond-open",
|
|
690
|
+
"circle",
|
|
691
|
+
"circle-open",
|
|
692
|
+
"square",
|
|
693
|
+
"crow",
|
|
694
|
+
"half",
|
|
695
|
+
"inverted"
|
|
696
|
+
]
|
|
697
|
+
],
|
|
698
|
+
["weight", ["normal", "bold"]],
|
|
699
|
+
["position", ["center", "top", "bottom", "left", "right", "top-left", "top-right", "bottom-left", "bottom-right"]]
|
|
700
|
+
]);
|
|
701
|
+
const OPEN_ENUMS = /* @__PURE__ */ new Set(["shape", "borderStyle", "lineStyle", "arrow"]);
|
|
702
|
+
function isStyleValue(target, property, value) {
|
|
703
|
+
if (target !== "graph" && property.startsWith("graphty:")) {
|
|
704
|
+
return typeof value === "string" || typeof value === "number" || typeof value === "boolean";
|
|
705
|
+
}
|
|
706
|
+
const kind = STYLE_PROPERTIES[target].get(property);
|
|
707
|
+
switch (kind) {
|
|
708
|
+
case void 0:
|
|
709
|
+
return false;
|
|
710
|
+
case "color":
|
|
711
|
+
return typeof value === "string" && /^#[0-9a-f]{6}$/.test(value);
|
|
712
|
+
case "number":
|
|
713
|
+
return typeof value === "number" && Number.isFinite(value) && value >= 0;
|
|
714
|
+
case "opacity":
|
|
715
|
+
return typeof value === "number" && value >= 0 && value <= 1;
|
|
716
|
+
case "text":
|
|
717
|
+
return typeof value === "string";
|
|
718
|
+
case "boolean":
|
|
719
|
+
return typeof value === "boolean";
|
|
720
|
+
default:
|
|
721
|
+
return typeof value === "string" && ((STYLE_ENUMS.get(kind)?.includes(value) ?? false) || OPEN_ENUMS.has(kind) && value.startsWith("other:") && value.length > "other:".length);
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
const MAX_PREDICATE_DEPTH = 32;
|
|
725
|
+
const MAX_PREDICATE_TERMS = 8;
|
|
726
|
+
const HEX6 = /^#[0-9a-f]{6}$/;
|
|
727
|
+
function refKey(ref) {
|
|
728
|
+
if ("style" in ref) {
|
|
729
|
+
return `style:${ref.style}`;
|
|
730
|
+
}
|
|
731
|
+
if ("computed" in ref) {
|
|
732
|
+
return `computed:${ref.computed}`;
|
|
733
|
+
}
|
|
734
|
+
return `data:${ref.data}`;
|
|
735
|
+
}
|
|
736
|
+
function plainCell(v2) {
|
|
737
|
+
if (v2 === void 0 || v2 === null) {
|
|
738
|
+
return null;
|
|
739
|
+
}
|
|
740
|
+
if (typeof v2 === "bigint") {
|
|
741
|
+
return Number(v2);
|
|
742
|
+
}
|
|
743
|
+
if (ArrayBuffer.isView(v2)) {
|
|
744
|
+
return Array.from(v2);
|
|
745
|
+
}
|
|
746
|
+
return v2;
|
|
747
|
+
}
|
|
748
|
+
function dataCell(table2, name2, i) {
|
|
749
|
+
const v2 = plainCell(table2.value(name2, i));
|
|
750
|
+
return typeof v2 === "number" && table2.get(name2)?.dtype === "f32" ? Number(formatF32(v2)) : v2;
|
|
751
|
+
}
|
|
752
|
+
function degreeValues(snapshot, which) {
|
|
753
|
+
let arr;
|
|
754
|
+
if (which === "degree") {
|
|
755
|
+
arr = snapshot.degree();
|
|
756
|
+
} else if (which === "indegree") {
|
|
757
|
+
arr = snapshot.inDegree();
|
|
758
|
+
} else {
|
|
759
|
+
arr = snapshot.outDegree();
|
|
760
|
+
}
|
|
761
|
+
return Array.from(arr);
|
|
762
|
+
}
|
|
763
|
+
function refSource(target, n, columns, features, snapshot) {
|
|
764
|
+
const cache = /* @__PURE__ */ new Map();
|
|
765
|
+
const byKey = /* @__PURE__ */ new Map();
|
|
766
|
+
for (const f of features) {
|
|
767
|
+
byKey.set(refKey(f.ref), f);
|
|
768
|
+
}
|
|
769
|
+
return {
|
|
770
|
+
n,
|
|
771
|
+
column(ref) {
|
|
772
|
+
if ("style" in ref) {
|
|
773
|
+
return columns.get(ref.style) ?? null;
|
|
774
|
+
}
|
|
775
|
+
const k = refKey(ref);
|
|
776
|
+
if (cache.has(k)) {
|
|
777
|
+
return cache.get(k) ?? null;
|
|
778
|
+
}
|
|
779
|
+
const out = snapshot === void 0 ? byKey.get(k)?.values ?? null : snapshotColumn(snapshot, target, n, ref);
|
|
780
|
+
cache.set(k, out);
|
|
781
|
+
return out;
|
|
782
|
+
}
|
|
783
|
+
};
|
|
784
|
+
}
|
|
785
|
+
function snapshotColumn(snapshot, target, n, ref) {
|
|
786
|
+
if ("computed" in ref) {
|
|
787
|
+
return target === "node" ? degreeValues(snapshot, ref.computed) : null;
|
|
788
|
+
}
|
|
789
|
+
const table2 = target === "node" ? snapshot.nodes : snapshot.edges;
|
|
790
|
+
return table2.has(ref.data) ? Array.from({ length: n }, (_, i) => dataCell(table2, ref.data, i)) : null;
|
|
791
|
+
}
|
|
792
|
+
function readRef(src, ref, i) {
|
|
793
|
+
const col = src.column(ref);
|
|
794
|
+
if (col === null) {
|
|
795
|
+
return null;
|
|
796
|
+
}
|
|
797
|
+
return col[i] ?? null;
|
|
798
|
+
}
|
|
799
|
+
function isShortPredicate(where) {
|
|
800
|
+
if ("and" in where) {
|
|
801
|
+
if (!Array.isArray(where.and) || where.and.length === 0) {
|
|
802
|
+
return false;
|
|
803
|
+
}
|
|
804
|
+
let terms = 0;
|
|
805
|
+
for (const p of where.and) {
|
|
806
|
+
const t = atomTerms(p);
|
|
807
|
+
if (t === 0) {
|
|
808
|
+
return false;
|
|
809
|
+
}
|
|
810
|
+
terms += t;
|
|
811
|
+
}
|
|
812
|
+
return terms <= MAX_PREDICATE_TERMS;
|
|
813
|
+
}
|
|
814
|
+
return atomTerms(where) > 0;
|
|
815
|
+
}
|
|
816
|
+
function atomTerms(p) {
|
|
817
|
+
if ("all" in p) {
|
|
818
|
+
return p.all ? 1 : 0;
|
|
819
|
+
}
|
|
820
|
+
if ("has" in p) {
|
|
821
|
+
return 1;
|
|
822
|
+
}
|
|
823
|
+
if ("not" in p) {
|
|
824
|
+
return "has" in p.not || "computed" in refOfTest(p.not) ? atomTerms(p.not) : 0;
|
|
825
|
+
}
|
|
826
|
+
if ("eq" in p) {
|
|
827
|
+
return 1;
|
|
828
|
+
}
|
|
829
|
+
if ("in" in p) {
|
|
830
|
+
const n = Array.isArray(p.in[1]) ? p.in[1].length : 0;
|
|
831
|
+
return n >= 1 && n <= MAX_PREDICATE_TERMS ? n : 0;
|
|
832
|
+
}
|
|
833
|
+
return 0;
|
|
834
|
+
}
|
|
835
|
+
function refOfTest(p) {
|
|
836
|
+
if ("eq" in p) {
|
|
837
|
+
return p.eq[0];
|
|
838
|
+
}
|
|
839
|
+
if ("in" in p) {
|
|
840
|
+
return p.in[0];
|
|
841
|
+
}
|
|
842
|
+
return {};
|
|
843
|
+
}
|
|
844
|
+
function scalarEq(v2, k) {
|
|
845
|
+
if (v2 === k) {
|
|
846
|
+
return v2 !== null && v2 !== void 0;
|
|
847
|
+
}
|
|
848
|
+
if (typeof k === "boolean") {
|
|
849
|
+
return boolEq(k, v2);
|
|
850
|
+
}
|
|
851
|
+
return typeof v2 === "boolean" && boolEq(v2, k);
|
|
852
|
+
}
|
|
853
|
+
function boolEq(b, other) {
|
|
854
|
+
return other === (b ? 1 : 0) || typeof other === "string" && other.toLowerCase() === String(b);
|
|
855
|
+
}
|
|
856
|
+
function matches(where, src, i, depth = 0) {
|
|
857
|
+
if (depth > MAX_PREDICATE_DEPTH) {
|
|
858
|
+
return false;
|
|
859
|
+
}
|
|
860
|
+
if ("all" in where) {
|
|
861
|
+
return where.all;
|
|
862
|
+
}
|
|
863
|
+
if ("has" in where) {
|
|
864
|
+
const v2 = readRef(src, where.has, i);
|
|
865
|
+
return v2 !== null && v2 !== false;
|
|
866
|
+
}
|
|
867
|
+
if ("eq" in where) {
|
|
868
|
+
return scalarEq(readRef(src, where.eq[0], i), where.eq[1]);
|
|
869
|
+
}
|
|
870
|
+
if ("in" in where) {
|
|
871
|
+
const v2 = readRef(src, where.in[0], i);
|
|
872
|
+
return where.in[1].some((k) => scalarEq(v2, k));
|
|
873
|
+
}
|
|
874
|
+
if ("and" in where) {
|
|
875
|
+
return where.and.every((p) => matches(p, src, i, depth + 1));
|
|
876
|
+
}
|
|
877
|
+
if ("or" in where) {
|
|
878
|
+
return where.or.some((p) => matches(p, src, i, depth + 1));
|
|
879
|
+
}
|
|
880
|
+
if ("not" in where) {
|
|
881
|
+
return !matches(where.not, src, i, depth + 1);
|
|
882
|
+
}
|
|
883
|
+
return false;
|
|
884
|
+
}
|
|
885
|
+
const ENUM_KINDS = /* @__PURE__ */ new Set(["shape", "borderStyle", "lineStyle", "arrow", "weight", "position"]);
|
|
886
|
+
function canonicalFor(target, property) {
|
|
887
|
+
const kind = STYLE_PROPERTIES[target].get(property);
|
|
888
|
+
const site = { notes: new StyleNotes(), target, property };
|
|
889
|
+
if (kind === void 0) {
|
|
890
|
+
return (raw) => typeof raw === "string" || typeof raw === "number" || typeof raw === "boolean" ? raw : null;
|
|
891
|
+
}
|
|
892
|
+
switch (kind) {
|
|
893
|
+
case "color":
|
|
894
|
+
return (raw) => typeof raw === "string" && /^#[0-9a-fA-F]{6}$/.test(raw) ? raw.toLowerCase() : null;
|
|
895
|
+
case "number":
|
|
896
|
+
return (raw) => canonNumber(raw, site);
|
|
897
|
+
case "opacity":
|
|
898
|
+
return (raw) => canonOpacity(raw, "css", site);
|
|
899
|
+
case "boolean":
|
|
900
|
+
return (raw) => canonBoolean(raw, site);
|
|
901
|
+
case "text":
|
|
902
|
+
return (raw) => canonText(raw, site);
|
|
903
|
+
default:
|
|
904
|
+
if (!ENUM_KINDS.has(kind)) {
|
|
905
|
+
return () => null;
|
|
906
|
+
}
|
|
907
|
+
return (raw) => typeof raw === "string" && raw.startsWith("other:") ? raw : canonEnum(kind, raw, "css", site);
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
const LOOKUPS = /* @__PURE__ */ new WeakMap();
|
|
911
|
+
const DECIMAL = /^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/;
|
|
912
|
+
function numberOf(v2) {
|
|
913
|
+
if (typeof v2 === "number") {
|
|
914
|
+
return Number.isFinite(v2) ? v2 : null;
|
|
915
|
+
}
|
|
916
|
+
if (typeof v2 === "string" && v2.length <= 64 && DECIMAL.test(v2.trim())) {
|
|
917
|
+
return Number(v2.trim());
|
|
918
|
+
}
|
|
919
|
+
return null;
|
|
920
|
+
}
|
|
921
|
+
function discreteLookup(table2) {
|
|
922
|
+
const cached = LOOKUPS.get(table2);
|
|
923
|
+
if (cached !== void 0) {
|
|
924
|
+
return cached;
|
|
925
|
+
}
|
|
926
|
+
const byStr = /* @__PURE__ */ new Map();
|
|
927
|
+
const byNum = /* @__PURE__ */ new Map();
|
|
928
|
+
const byBool = /* @__PURE__ */ new Map();
|
|
929
|
+
table2.forEach(([k], j) => {
|
|
930
|
+
if (k === null || typeof k === "object") {
|
|
931
|
+
return;
|
|
932
|
+
}
|
|
933
|
+
const ks = String(k);
|
|
934
|
+
if (!byStr.has(ks)) {
|
|
935
|
+
byStr.set(ks, j);
|
|
936
|
+
}
|
|
937
|
+
const kn = numberOf(k);
|
|
938
|
+
if (kn !== null && !byNum.has(kn)) {
|
|
939
|
+
byNum.set(kn, j);
|
|
940
|
+
}
|
|
941
|
+
const kb = ks.toLowerCase();
|
|
942
|
+
if ((kb === "true" || kb === "false") && !byBool.has(kb)) {
|
|
943
|
+
byBool.set(kb, j);
|
|
944
|
+
}
|
|
945
|
+
});
|
|
946
|
+
const one = (value) => {
|
|
947
|
+
if (typeof value === "number") {
|
|
948
|
+
return byNum.get(value) ?? -1;
|
|
949
|
+
}
|
|
950
|
+
if (typeof value === "boolean") {
|
|
951
|
+
return byBool.get(String(value)) ?? -1;
|
|
952
|
+
}
|
|
953
|
+
if (typeof value === "string") {
|
|
954
|
+
return byStr.get(value) ?? -1;
|
|
955
|
+
}
|
|
956
|
+
return -1;
|
|
957
|
+
};
|
|
958
|
+
const f = (value) => {
|
|
959
|
+
if (Array.isArray(value)) {
|
|
960
|
+
for (const v2 of value) {
|
|
961
|
+
const j = one(v2);
|
|
962
|
+
if (j >= 0) {
|
|
963
|
+
return j;
|
|
964
|
+
}
|
|
965
|
+
}
|
|
966
|
+
return -1;
|
|
967
|
+
}
|
|
968
|
+
return one(value);
|
|
969
|
+
};
|
|
970
|
+
LOOKUPS.set(table2, f);
|
|
971
|
+
return f;
|
|
972
|
+
}
|
|
973
|
+
function hex2$2(v2) {
|
|
974
|
+
return Math.min(255, Math.max(0, Math.round(v2))).toString(16).padStart(2, "0");
|
|
975
|
+
}
|
|
976
|
+
function num6(x) {
|
|
977
|
+
return Number(x.toPrecision(6)) + 0;
|
|
978
|
+
}
|
|
979
|
+
function interpolate(a, b, t) {
|
|
980
|
+
if (typeof a === "number" && typeof b === "number") {
|
|
981
|
+
return num6(a + (b - a) * t);
|
|
982
|
+
}
|
|
983
|
+
if (typeof a === "string" && typeof b === "string" && HEX6.test(a) && HEX6.test(b)) {
|
|
984
|
+
let out = "#";
|
|
985
|
+
for (const k of [1, 3, 5]) {
|
|
986
|
+
const ca = Number.parseInt(a.slice(k, k + 2), 16);
|
|
987
|
+
const cb = Number.parseInt(b.slice(k, k + 2), 16);
|
|
988
|
+
out += hex2$2(ca + (cb - ca) * t);
|
|
989
|
+
}
|
|
990
|
+
return out;
|
|
991
|
+
}
|
|
992
|
+
return t < 1 ? a : b;
|
|
993
|
+
}
|
|
994
|
+
function evalContinuous(points, x) {
|
|
995
|
+
if (x === null || !Number.isFinite(x) || points.length === 0) {
|
|
996
|
+
return null;
|
|
997
|
+
}
|
|
998
|
+
if (x < points[0].at) {
|
|
999
|
+
return points[0].below;
|
|
1000
|
+
}
|
|
1001
|
+
for (let i = 0; i < points.length; i++) {
|
|
1002
|
+
const p = points[i];
|
|
1003
|
+
if (x === p.at) {
|
|
1004
|
+
return p.value;
|
|
1005
|
+
}
|
|
1006
|
+
const q = points.at(i + 1);
|
|
1007
|
+
if (q === void 0) {
|
|
1008
|
+
return p.above;
|
|
1009
|
+
}
|
|
1010
|
+
if (x < q.at) {
|
|
1011
|
+
return interpolate(p.above, q.below, (x - p.at) / (q.at - p.at));
|
|
1012
|
+
}
|
|
1013
|
+
}
|
|
1014
|
+
return null;
|
|
1015
|
+
}
|
|
1016
|
+
function evalMapping(m, canon, src, i) {
|
|
1017
|
+
const v2 = readRef(src, m.by, i);
|
|
1018
|
+
if (v2 === null || v2 === void 0) {
|
|
1019
|
+
return null;
|
|
1020
|
+
}
|
|
1021
|
+
switch (m.kind) {
|
|
1022
|
+
case "passthrough":
|
|
1023
|
+
if (Array.isArray(v2)) {
|
|
1024
|
+
return null;
|
|
1025
|
+
}
|
|
1026
|
+
if ("style" in m.by) {
|
|
1027
|
+
return typeof v2 === "string" || typeof v2 === "number" || typeof v2 === "boolean" ? v2 : null;
|
|
1028
|
+
}
|
|
1029
|
+
return canon(v2);
|
|
1030
|
+
case "discrete": {
|
|
1031
|
+
const j = discreteLookup(m.table)(v2);
|
|
1032
|
+
return j < 0 ? null : m.table[j][1];
|
|
1033
|
+
}
|
|
1034
|
+
case "continuous":
|
|
1035
|
+
return Array.isArray(v2) ? null : evalContinuous(m.points, numberOf(v2));
|
|
1036
|
+
default:
|
|
1037
|
+
return null;
|
|
1038
|
+
}
|
|
1039
|
+
}
|
|
1040
|
+
function setOf(rule, property) {
|
|
1041
|
+
const set = rule.set ?? {};
|
|
1042
|
+
return Object.hasOwn(set, property) ? set[property] : void 0;
|
|
1043
|
+
}
|
|
1044
|
+
function mapOf(rule, property) {
|
|
1045
|
+
const map = rule.map ?? {};
|
|
1046
|
+
return Object.hasOwn(map, property) ? map[property] : void 0;
|
|
1047
|
+
}
|
|
1048
|
+
function resolveRules(rules, target, property, src, budget) {
|
|
1049
|
+
const writers = rules.filter(
|
|
1050
|
+
(rule) => rule.target === target && (setOf(rule, property) !== void 0 || mapOf(rule, property) !== void 0)
|
|
1051
|
+
).reverse();
|
|
1052
|
+
const canon = canonicalFor(target, property);
|
|
1053
|
+
const out = new Array(src.n).fill(null);
|
|
1054
|
+
let visits = 0;
|
|
1055
|
+
for (let i = 0; i < src.n; i++) {
|
|
1056
|
+
for (const rule of writers) {
|
|
1057
|
+
visits++;
|
|
1058
|
+
const v2 = ruleValue(rule, property, canon, src, i);
|
|
1059
|
+
if (v2 !== null) {
|
|
1060
|
+
out[i] = v2;
|
|
1061
|
+
break;
|
|
1062
|
+
}
|
|
1063
|
+
}
|
|
1064
|
+
}
|
|
1065
|
+
budget?.spend(target, visits + src.n);
|
|
1066
|
+
return out;
|
|
1067
|
+
}
|
|
1068
|
+
function ruleValue(rule, property, canon, src, i) {
|
|
1069
|
+
if (!matches(rule.where, src, i)) {
|
|
1070
|
+
return null;
|
|
1071
|
+
}
|
|
1072
|
+
const set = setOf(rule, property);
|
|
1073
|
+
if (set !== void 0) {
|
|
1074
|
+
return set;
|
|
1075
|
+
}
|
|
1076
|
+
const mapping2 = mapOf(rule, property);
|
|
1077
|
+
return mapping2 === void 0 ? null : evalMapping(mapping2, canon, src, i);
|
|
1078
|
+
}
|
|
1079
|
+
function resolveStyles(extracted, target, property, snapshot) {
|
|
1080
|
+
let n = extracted.fingerprint[target === "node" ? "nodes" : "edges"];
|
|
1081
|
+
if (snapshot !== void 0) {
|
|
1082
|
+
n = target === "node" ? snapshot.nodeCount : snapshot.edgeCount;
|
|
1083
|
+
}
|
|
1084
|
+
const src = refSource(target, n, extracted.columns[target], extracted.features[target], snapshot);
|
|
1085
|
+
return resolveRules(extracted.styles.rules, target, property, src);
|
|
1086
|
+
}
|
|
1087
|
+
function within(a, b) {
|
|
1088
|
+
if (a === b) {
|
|
1089
|
+
return true;
|
|
1090
|
+
}
|
|
1091
|
+
if (typeof a === "number" && typeof b === "number") {
|
|
1092
|
+
return Math.abs(a - b) <= 1e-5 * Math.max(Math.abs(a), Math.abs(b), 1e-9);
|
|
1093
|
+
}
|
|
1094
|
+
if (typeof a === "string" && typeof b === "string" && HEX6.test(a) && HEX6.test(b)) {
|
|
1095
|
+
for (const k of [1, 3, 5]) {
|
|
1096
|
+
if (Math.abs(Number.parseInt(a.slice(k, k + 2), 16) - Number.parseInt(b.slice(k, k + 2), 16)) > 2) {
|
|
1097
|
+
return false;
|
|
1098
|
+
}
|
|
1099
|
+
}
|
|
1100
|
+
return true;
|
|
1101
|
+
}
|
|
1102
|
+
return false;
|
|
1103
|
+
}
|
|
1104
|
+
function table(text) {
|
|
1105
|
+
const map = /* @__PURE__ */ new Map();
|
|
1106
|
+
for (const entry of text.split(" ")) {
|
|
1107
|
+
const eq = entry.indexOf("=");
|
|
1108
|
+
map.set(entry.slice(0, eq), `#${entry.slice(eq + 1)}`);
|
|
1109
|
+
}
|
|
1110
|
+
return map;
|
|
1111
|
+
}
|
|
1112
|
+
const CSS_COLORS = table(
|
|
1113
|
+
"aliceblue=f0f8ff antiquewhite=faebd7 aqua=00ffff aquamarine=7fffd4 azure=f0ffff beige=f5f5dc bisque=ffe4c4 black=000000 blanchedalmond=ffebcd blue=0000ff blueviolet=8a2be2 brown=a52a2a burlywood=deb887 cadetblue=5f9ea0 chartreuse=7fff00 chocolate=d2691e coral=ff7f50 cornflowerblue=6495ed cornsilk=fff8dc crimson=dc143c cyan=00ffff darkblue=00008b darkcyan=008b8b darkgoldenrod=b8860b darkgray=a9a9a9 darkgreen=006400 darkgrey=a9a9a9 darkkhaki=bdb76b darkmagenta=8b008b darkolivegreen=556b2f darkorange=ff8c00 darkorchid=9932cc darkred=8b0000 darksalmon=e9967a darkseagreen=8fbc8f darkslateblue=483d8b darkslategray=2f4f4f darkslategrey=2f4f4f darkturquoise=00ced1 darkviolet=9400d3 deeppink=ff1493 deepskyblue=00bfff dimgray=696969 dimgrey=696969 dodgerblue=1e90ff firebrick=b22222 floralwhite=fffaf0 forestgreen=228b22 fuchsia=ff00ff gainsboro=dcdcdc ghostwhite=f8f8ff gold=ffd700 goldenrod=daa520 gray=808080 green=008000 greenyellow=adff2f grey=808080 honeydew=f0fff0 hotpink=ff69b4 indianred=cd5c5c indigo=4b0082 ivory=fffff0 khaki=f0e68c lavender=e6e6fa lavenderblush=fff0f5 lawngreen=7cfc00 lemonchiffon=fffacd lightblue=add8e6 lightcoral=f08080 lightcyan=e0ffff lightgoldenrodyellow=fafad2 lightgray=d3d3d3 lightgreen=90ee90 lightgrey=d3d3d3 lightpink=ffb6c1 lightsalmon=ffa07a lightseagreen=20b2aa lightskyblue=87cefa lightslategray=778899 lightslategrey=778899 lightsteelblue=b0c4de lightyellow=ffffe0 lime=00ff00 limegreen=32cd32 linen=faf0e6 magenta=ff00ff maroon=800000 mediumaquamarine=66cdaa mediumblue=0000cd mediumorchid=ba55d3 mediumpurple=9370db mediumseagreen=3cb371 mediumslateblue=7b68ee mediumspringgreen=00fa9a mediumturquoise=48d1cc mediumvioletred=c71585 midnightblue=191970 mintcream=f5fffa mistyrose=ffe4e1 moccasin=ffe4b5 navajowhite=ffdead navy=000080 oldlace=fdf5e6 olive=808000 olivedrab=6b8e23 orange=ffa500 orangered=ff4500 orchid=da70d6 palegoldenrod=eee8aa palegreen=98fb98 paleturquoise=afeeee palevioletred=db7093 papayawhip=ffefd5 peachpuff=ffdab9 peru=cd853f pink=ffc0cb plum=dda0dd powderblue=b0e0e6 purple=800080 rebeccapurple=663399 red=ff0000 rosybrown=bc8f8f royalblue=4169e1 saddlebrown=8b4513 salmon=fa8072 sandybrown=f4a460 seagreen=2e8b57 seashell=fff5ee sienna=a0522d silver=c0c0c0 skyblue=87ceeb slateblue=6a5acd slategray=708090 slategrey=708090 snow=fffafa springgreen=00ff7f steelblue=4682b4 tan=d2b48c teal=008080 thistle=d8bfd8 tomato=ff6347 turquoise=40e0d0 violet=ee82ee wheat=f5deb3 white=ffffff whitesmoke=f5f5f5 yellow=ffff00 yellowgreen=9acd32"
|
|
1114
|
+
);
|
|
1115
|
+
const X11_COLORS = table(
|
|
1116
|
+
"aliceblue=f0f8ff antiquewhite=faebd7 antiquewhite1=ffefdb antiquewhite2=eedfcc antiquewhite3=cdc0b0 antiquewhite4=8b8378 aqua=00ffff aquamarine=7fffd4 aquamarine1=7fffd4 aquamarine2=76eec6 aquamarine3=66cdaa aquamarine4=458b74 azure=f0ffff azure1=f0ffff azure2=e0eeee azure3=c1cdcd azure4=838b8b beige=f5f5dc bisque=ffe4c4 bisque1=ffe4c4 bisque2=eed5b7 bisque3=cdb79e bisque4=8b7d6b black=000000 blanchedalmond=ffebcd blue=0000ff blue1=0000ff blue2=0000ee blue3=0000cd blue4=00008b blueviolet=8a2be2 brown=a52a2a brown1=ff4040 brown2=ee3b3b brown3=cd3333 brown4=8b2323 burlywood=deb887 burlywood1=ffd39b burlywood2=eec591 burlywood3=cdaa7d burlywood4=8b7355 cadetblue=5f9ea0 cadetblue1=98f5ff cadetblue2=8ee5ee cadetblue3=7ac5cd cadetblue4=53868b chartreuse=7fff00 chartreuse1=7fff00 chartreuse2=76ee00 chartreuse3=66cd00 chartreuse4=458b00 chocolate=d2691e chocolate1=ff7f24 chocolate2=ee7621 chocolate3=cd661d chocolate4=8b4513 coral=ff7f50 coral1=ff7256 coral2=ee6a50 coral3=cd5b45 coral4=8b3e2f cornflowerblue=6495ed cornsilk=fff8dc cornsilk1=fff8dc cornsilk2=eee8cd cornsilk3=cdc8b1 cornsilk4=8b8878 crimson=dc143c cyan=00ffff cyan1=00ffff cyan2=00eeee cyan3=00cdcd cyan4=008b8b darkblue=00008b darkcyan=008b8b darkgoldenrod=b8860b darkgoldenrod1=ffb90f darkgoldenrod2=eead0e darkgoldenrod3=cd950c darkgoldenrod4=8b6508 darkgray=a9a9a9 darkgreen=006400 darkgrey=a9a9a9 darkkhaki=bdb76b darkmagenta=8b008b darkolivegreen=556b2f darkolivegreen1=caff70 darkolivegreen2=bcee68 darkolivegreen3=a2cd5a darkolivegreen4=6e8b3d darkorange=ff8c00 darkorange1=ff7f00 darkorange2=ee7600 darkorange3=cd6600 darkorange4=8b4500 darkorchid=9932cc darkorchid1=bf3eff darkorchid2=b23aee darkorchid3=9a32cd darkorchid4=68228b darkred=8b0000 darksalmon=e9967a darkseagreen=8fbc8f darkseagreen1=c1ffc1 darkseagreen2=b4eeb4 darkseagreen3=9bcd9b darkseagreen4=698b69 darkslateblue=483d8b darkslategray=2f4f4f darkslategray1=97ffff darkslategray2=8deeee darkslategray3=79cdcd darkslategray4=528b8b darkslategrey=2f4f4f darkturquoise=00ced1 darkviolet=9400d3 deeppink=ff1493 deeppink1=ff1493 deeppink2=ee1289 deeppink3=cd1076 deeppink4=8b0a50 deepskyblue=00bfff deepskyblue1=00bfff deepskyblue2=00b2ee deepskyblue3=009acd deepskyblue4=00688b dimgray=696969 dimgrey=696969 dodgerblue=1e90ff dodgerblue1=1e90ff dodgerblue2=1c86ee dodgerblue3=1874cd dodgerblue4=104e8b firebrick=b22222 firebrick1=ff3030 firebrick2=ee2c2c firebrick3=cd2626 firebrick4=8b1a1a floralwhite=fffaf0 forestgreen=228b22 fuchsia=ff00ff gainsboro=dcdcdc ghostwhite=f8f8ff gold=ffd700 gold1=ffd700 gold2=eec900 gold3=cdad00 gold4=8b7500 goldenrod=daa520 goldenrod1=ffc125 goldenrod2=eeb422 goldenrod3=cd9b1d goldenrod4=8b6914 gray=c0c0c0 gray0=000000 gray1=030303 gray10=1a1a1a gray100=ffffff gray11=1c1c1c gray12=1f1f1f gray13=212121 gray14=242424 gray15=262626 gray16=292929 gray17=2b2b2b gray18=2e2e2e gray19=303030 gray2=050505 gray20=333333 gray21=363636 gray22=383838 gray23=3b3b3b gray24=3d3d3d gray25=404040 gray26=424242 gray27=454545 gray28=474747 gray29=4a4a4a gray3=080808 gray30=4d4d4d gray31=4f4f4f gray32=525252 gray33=545454 gray34=575757 gray35=595959 gray36=5c5c5c gray37=5e5e5e gray38=616161 gray39=636363 gray4=0a0a0a gray40=666666 gray41=696969 gray42=6b6b6b gray43=6e6e6e gray44=707070 gray45=737373 gray46=757575 gray47=787878 gray48=7a7a7a gray49=7d7d7d gray5=0d0d0d gray50=7f7f7f gray51=828282 gray52=858585 gray53=878787 gray54=8a8a8a gray55=8c8c8c gray56=8f8f8f gray57=919191 gray58=949494 gray59=969696 gray6=0f0f0f gray60=999999 gray61=9c9c9c gray62=9e9e9e gray63=a1a1a1 gray64=a3a3a3 gray65=a6a6a6 gray66=a8a8a8 gray67=ababab gray68=adadad gray69=b0b0b0 gray7=121212 gray70=b3b3b3 gray71=b5b5b5 gray72=b8b8b8 gray73=bababa gray74=bdbdbd gray75=bfbfbf gray76=c2c2c2 gray77=c4c4c4 gray78=c7c7c7 gray79=c9c9c9 gray8=141414 gray80=cccccc gray81=cfcfcf gray82=d1d1d1 gray83=d4d4d4 gray84=d6d6d6 gray85=d9d9d9 gray86=dbdbdb gray87=dedede gray88=e0e0e0 gray89=e3e3e3 gray9=171717 gray90=e5e5e5 gray91=e8e8e8 gray92=ebebeb gray93=ededed gray94=f0f0f0 gray95=f2f2f2 gray96=f5f5f5 gray97=f7f7f7 gray98=fafafa gray99=fcfcfc green=00ff00 green1=00ff00 green2=00ee00 green3=00cd00 green4=008b00 greenyellow=adff2f grey=c0c0c0 grey0=000000 grey1=030303 grey10=1a1a1a grey100=ffffff grey11=1c1c1c grey12=1f1f1f grey13=212121 grey14=242424 grey15=262626 grey16=292929 grey17=2b2b2b grey18=2e2e2e grey19=303030 grey2=050505 grey20=333333 grey21=363636 grey22=383838 grey23=3b3b3b grey24=3d3d3d grey25=404040 grey26=424242 grey27=454545 grey28=474747 grey29=4a4a4a grey3=080808 grey30=4d4d4d grey31=4f4f4f grey32=525252 grey33=545454 grey34=575757 grey35=595959 grey36=5c5c5c grey37=5e5e5e grey38=616161 grey39=636363 grey4=0a0a0a grey40=666666 grey41=696969 grey42=6b6b6b grey43=6e6e6e grey44=707070 grey45=737373 grey46=757575 grey47=787878 grey48=7a7a7a grey49=7d7d7d grey5=0d0d0d grey50=7f7f7f grey51=828282 grey52=858585 grey53=878787 grey54=8a8a8a grey55=8c8c8c grey56=8f8f8f grey57=919191 grey58=949494 grey59=969696 grey6=0f0f0f grey60=999999 grey61=9c9c9c grey62=9e9e9e grey63=a1a1a1 grey64=a3a3a3 grey65=a6a6a6 grey66=a8a8a8 grey67=ababab grey68=adadad grey69=b0b0b0 grey7=121212 grey70=b3b3b3 grey71=b5b5b5 grey72=b8b8b8 grey73=bababa grey74=bdbdbd grey75=bfbfbf grey76=c2c2c2 grey77=c4c4c4 grey78=c7c7c7 grey79=c9c9c9 grey8=141414 grey80=cccccc grey81=cfcfcf grey82=d1d1d1 grey83=d4d4d4 grey84=d6d6d6 grey85=d9d9d9 grey86=dbdbdb grey87=dedede grey88=e0e0e0 grey89=e3e3e3 grey9=171717 grey90=e5e5e5 grey91=e8e8e8 grey92=ebebeb grey93=ededed grey94=f0f0f0 grey95=f2f2f2 grey96=f5f5f5 grey97=f7f7f7 grey98=fafafa grey99=fcfcfc honeydew=f0fff0 honeydew1=f0fff0 honeydew2=e0eee0 honeydew3=c1cdc1 honeydew4=838b83 hotpink=ff69b4 hotpink1=ff6eb4 hotpink2=ee6aa7 hotpink3=cd6090 hotpink4=8b3a62 indianred=cd5c5c indianred1=ff6a6a indianred2=ee6363 indianred3=cd5555 indianred4=8b3a3a indigo=4b0082 ivory=fffff0 ivory1=fffff0 ivory2=eeeee0 ivory3=cdcdc1 ivory4=8b8b83 khaki=f0e68c khaki1=fff68f khaki2=eee685 khaki3=cdc673 khaki4=8b864e lavender=e6e6fa lavenderblush=fff0f5 lavenderblush1=fff0f5 lavenderblush2=eee0e5 lavenderblush3=cdc1c5 lavenderblush4=8b8386 lawngreen=7cfc00 lemonchiffon=fffacd lemonchiffon1=fffacd lemonchiffon2=eee9bf lemonchiffon3=cdc9a5 lemonchiffon4=8b8970 lightblue=add8e6 lightblue1=bfefff lightblue2=b2dfee lightblue3=9ac0cd lightblue4=68838b lightcoral=f08080 lightcyan=e0ffff lightcyan1=e0ffff lightcyan2=d1eeee lightcyan3=b4cdcd lightcyan4=7a8b8b lightgoldenrod=eedd82 lightgoldenrod1=ffec8b lightgoldenrod2=eedc82 lightgoldenrod3=cdbe70 lightgoldenrod4=8b814c lightgoldenrodyellow=fafad2 lightgray=d3d3d3 lightgreen=90ee90 lightgrey=d3d3d3 lightpink=ffb6c1 lightpink1=ffaeb9 lightpink2=eea2ad lightpink3=cd8c95 lightpink4=8b5f65 lightsalmon=ffa07a lightsalmon1=ffa07a lightsalmon2=ee9572 lightsalmon3=cd8162 lightsalmon4=8b5742 lightseagreen=20b2aa lightskyblue=87cefa lightskyblue1=b0e2ff lightskyblue2=a4d3ee lightskyblue3=8db6cd lightskyblue4=607b8b lightslateblue=8470ff lightslategray=778899 lightslategrey=778899 lightsteelblue=b0c4de lightsteelblue1=cae1ff lightsteelblue2=bcd2ee lightsteelblue3=a2b5cd lightsteelblue4=6e7b8b lightyellow=ffffe0 lightyellow1=ffffe0 lightyellow2=eeeed1 lightyellow3=cdcdb4 lightyellow4=8b8b7a lime=00ff00 limegreen=32cd32 linen=faf0e6 magenta=ff00ff magenta1=ff00ff magenta2=ee00ee magenta3=cd00cd magenta4=8b008b maroon=b03060 maroon1=ff34b3 maroon2=ee30a7 maroon3=cd2990 maroon4=8b1c62 mediumaquamarine=66cdaa mediumblue=0000cd mediumorchid=ba55d3 mediumorchid1=e066ff mediumorchid2=d15fee mediumorchid3=b452cd mediumorchid4=7a378b mediumpurple=9370db mediumpurple1=ab82ff mediumpurple2=9f79ee mediumpurple3=8968cd mediumpurple4=5d478b mediumseagreen=3cb371 mediumslateblue=7b68ee mediumspringgreen=00fa9a mediumturquoise=48d1cc mediumvioletred=c71585 midnightblue=191970 mintcream=f5fffa mistyrose=ffe4e1 mistyrose1=ffe4e1 mistyrose2=eed5d2 mistyrose3=cdb7b5 mistyrose4=8b7d7b moccasin=ffe4b5 navajowhite=ffdead navajowhite1=ffdead navajowhite2=eecfa1 navajowhite3=cdb38b navajowhite4=8b795e navy=000080 navyblue=000080 oldlace=fdf5e6 olive=808000 olivedrab=6b8e23 olivedrab1=c0ff3e olivedrab2=b3ee3a olivedrab3=9acd32 olivedrab4=698b22 orange=ffa500 orange1=ffa500 orange2=ee9a00 orange3=cd8500 orange4=8b5a00 orangered=ff4500 orangered1=ff4500 orangered2=ee4000 orangered3=cd3700 orangered4=8b2500 orchid=da70d6 orchid1=ff83fa orchid2=ee7ae9 orchid3=cd69c9 orchid4=8b4789 palegoldenrod=eee8aa palegreen=98fb98 palegreen1=9aff9a palegreen2=90ee90 palegreen3=7ccd7c palegreen4=548b54 paleturquoise=afeeee paleturquoise1=bbffff paleturquoise2=aeeeee paleturquoise3=96cdcd paleturquoise4=668b8b palevioletred=db7093 palevioletred1=ff82ab palevioletred2=ee799f palevioletred3=cd6889 palevioletred4=8b475d papayawhip=ffefd5 peachpuff=ffdab9 peachpuff1=ffdab9 peachpuff2=eecbad peachpuff3=cdaf95 peachpuff4=8b7765 peru=cd853f pink=ffc0cb pink1=ffb5c5 pink2=eea9b8 pink3=cd919e pink4=8b636c plum=dda0dd plum1=ffbbff plum2=eeaeee plum3=cd96cd plum4=8b668b powderblue=b0e0e6 purple=a020f0 purple1=9b30ff purple2=912cee purple3=7d26cd purple4=551a8b rebeccapurple=663399 red=ff0000 red1=ff0000 red2=ee0000 red3=cd0000 red4=8b0000 rosybrown=bc8f8f rosybrown1=ffc1c1 rosybrown2=eeb4b4 rosybrown3=cd9b9b rosybrown4=8b6969 royalblue=4169e1 royalblue1=4876ff royalblue2=436eee royalblue3=3a5fcd royalblue4=27408b saddlebrown=8b4513 salmon=fa8072 salmon1=ff8c69 salmon2=ee8262 salmon3=cd7054 salmon4=8b4c39 sandybrown=f4a460 seagreen=2e8b57 seagreen1=54ff9f seagreen2=4eee94 seagreen3=43cd80 seagreen4=2e8b57 seashell=fff5ee seashell1=fff5ee seashell2=eee5de seashell3=cdc5bf seashell4=8b8682 sienna=a0522d sienna1=ff8247 sienna2=ee7942 sienna3=cd6839 sienna4=8b4726 silver=c0c0c0 skyblue=87ceeb skyblue1=87ceff skyblue2=7ec0ee skyblue3=6ca6cd skyblue4=4a708b slateblue=6a5acd slateblue1=836fff slateblue2=7a67ee slateblue3=6959cd slateblue4=473c8b slategray=708090 slategray1=c6e2ff slategray2=b9d3ee slategray3=9fb6cd slategray4=6c7b8b slategrey=708090 snow=fffafa snow1=fffafa snow2=eee9e9 snow3=cdc9c9 snow4=8b8989 springgreen=00ff7f springgreen1=00ff7f springgreen2=00ee76 springgreen3=00cd66 springgreen4=008b45 steelblue=4682b4 steelblue1=63b8ff steelblue2=5cacee steelblue3=4f94cd steelblue4=36648b tan=d2b48c tan1=ffa54f tan2=ee9a49 tan3=cd853f tan4=8b5a2b teal=008080 thistle=d8bfd8 thistle1=ffe1ff thistle2=eed2ee thistle3=cdb5cd thistle4=8b7b8b tomato=ff6347 tomato1=ff6347 tomato2=ee5c42 tomato3=cd4f39 tomato4=8b3626 turquoise=40e0d0 turquoise1=00f5ff turquoise2=00e5ee turquoise3=00c5cd turquoise4=00868b violet=ee82ee violetred=d02090 violetred1=ff3e96 violetred2=ee3a8c violetred3=cd3278 violetred4=8b2252 wheat=f5deb3 wheat1=ffe7ba wheat2=eed8ae wheat3=cdba96 wheat4=8b7e66 white=ffffff whitesmoke=f5f5f5 yellow=ffff00 yellow1=ffff00 yellow2=eeee00 yellow3=cdcd00 yellow4=8b8b00 yellowgreen=9acd32"
|
|
1117
|
+
);
|
|
1118
|
+
const DVIPS_COLORS = table(
|
|
1119
|
+
"GreenYellow=d9ff4f Yellow=ffff00 Goldenrod=ffe629 Dandelion=ffb529 Apricot=ffad7a Peach=ff804d Melon=ff8a80 YellowOrange=ff9400 Orange=ff6321 BurntOrange=ff7d00 Bittersweet=c20300 RedOrange=ff3b21 Mahogany=a60000 Maroon=ad0000 BrickRed=b80000 Red=ff0000 OrangeRed=ff0080 RubineRed=ff00de WildStrawberry=ff0a9c Salmon=ff789e CarnationPink=ff5eff Magenta=ff00ff VioletRed=ff30ff Rhodamine=ff2eff Mulberry=a314fa RedViolet=9600a8 Fuchsia=7303eb Lavender=ff85ff Thistle=e069ff Orchid=ad5cff DarkOrchid=9933cc Purple=8c24ff Plum=8000ff Violet=361fff RoyalPurple=4019ff BlueViolet=190df5 Periwinkle=6e73ff CadetBlue=616ec4 CornflowerBlue=59deff MidnightBlue=007091 NavyBlue=0f75ff RoyalBlue=0080ff Blue=0000ff Cerulean=0fe3ff Cyan=00ffff ProcessBlue=0affff SkyBlue=61ffe0 Turquoise=26ffcc TealBlue=1ffaa3 Aquamarine=2effb2 BlueGreen=26ffab Emerald=00ff80 JungleGreen=03ff7a SeaGreen=4fff80 Green=00ff00 ForestGreen=00e000 PineGreen=00bf29 LimeGreen=80ff00 YellowGreen=8fff42 SpringGreen=bdff3d OliveGreen=009900 RawSienna=8c0000 Sepia=4d0000 Brown=660000 Tan=db9470 Gray=808080 Black=000000 White=ffffff"
|
|
1120
|
+
);
|
|
1121
|
+
const JAVA_COLORS = table(
|
|
1122
|
+
"black=000000 blue=0000ff cyan=00ffff darkgray=404040 dark_gray=404040 gray=808080 green=00ff00 lightgray=c0c0c0 light_gray=c0c0c0 magenta=ff00ff orange=ffc800 pink=ffafaf red=ff0000 white=ffffff yellow=ffff00"
|
|
1123
|
+
);
|
|
1124
|
+
const BREWER_SCHEMES = new Map(
|
|
1125
|
+
"accent3=7fc97f,beaed4,fdc086 accent4=7fc97f,beaed4,fdc086,ffff99 accent5=7fc97f,beaed4,fdc086,ffff99,386cb0 accent6=7fc97f,beaed4,fdc086,ffff99,386cb0,f0027f accent7=7fc97f,beaed4,fdc086,ffff99,386cb0,f0027f,bf5b17 accent8=7fc97f,beaed4,fdc086,ffff99,386cb0,f0027f,bf5b17,666666 blues3=deebf7,9ecae1,3182bd blues4=eff3ff,bdd7e7,6baed6,2171b5 blues5=eff3ff,bdd7e7,6baed6,3182bd,08519c blues6=eff3ff,c6dbef,9ecae1,6baed6,3182bd,08519c blues7=eff3ff,c6dbef,9ecae1,6baed6,4292c6,2171b5,084594 blues8=f7fbff,deebf7,c6dbef,9ecae1,6baed6,4292c6,2171b5,084594 blues9=f7fbff,deebf7,c6dbef,9ecae1,6baed6,4292c6,2171b5,08519c,08306b brbg10=543005,8c510a,bf812d,dfc27d,f6e8c3,c7eae5,80cdc1,35978f,01665e,003c30 brbg11=543005,8c510a,bf812d,dfc27d,f6e8c3,f5f5f5,c7eae5,80cdc1,35978f,01665e,003c30 brbg3=d8b365,f5f5f5,5ab4ac brbg4=a6611a,dfc27d,80cdc1,018571 brbg5=a6611a,dfc27d,f5f5f5,80cdc1,018571 brbg6=8c510a,d8b365,f6e8c3,c7eae5,5ab4ac,01665e brbg7=8c510a,d8b365,f6e8c3,f5f5f5,c7eae5,5ab4ac,01665e brbg8=8c510a,bf812d,dfc27d,f6e8c3,c7eae5,80cdc1,35978f,01665e brbg9=8c510a,bf812d,dfc27d,f6e8c3,f5f5f5,c7eae5,80cdc1,35978f,01665e bugn3=e5f5f9,99d8c9,2ca25f bugn4=edf8fb,b2e2e2,66c2a4,238b45 bugn5=edf8fb,b2e2e2,66c2a4,2ca25f,006d2c bugn6=edf8fb,ccece6,99d8c9,66c2a4,2ca25f,006d2c bugn7=edf8fb,ccece6,99d8c9,66c2a4,41ae76,238b45,005824 bugn8=f7fcfd,e5f5f9,ccece6,99d8c9,66c2a4,41ae76,238b45,005824 bugn9=f7fcfd,e5f5f9,ccece6,99d8c9,66c2a4,41ae76,238b45,006d2c,00441b bupu3=e0ecf4,9ebcda,8856a7 bupu4=edf8fb,b3cde3,8c96c6,88419d bupu5=edf8fb,b3cde3,8c96c6,8856a7,810f7c bupu6=edf8fb,bfd3e6,9ebcda,8c96c6,8856a7,810f7c bupu7=edf8fb,bfd3e6,9ebcda,8c96c6,8c6bb1,88419d,6e016b bupu8=f7fcfd,e0ecf4,bfd3e6,9ebcda,8c96c6,8c6bb1,88419d,6e016b bupu9=f7fcfd,e0ecf4,bfd3e6,9ebcda,8c96c6,8c6bb1,88419d,810f7c,4d004b dark23=1b9e77,d95f02,7570b3 dark24=1b9e77,d95f02,7570b3,e7298a dark25=1b9e77,d95f02,7570b3,e7298a,66a61e dark26=1b9e77,d95f02,7570b3,e7298a,66a61e,e6ab02 dark27=1b9e77,d95f02,7570b3,e7298a,66a61e,e6ab02,a6761d dark28=1b9e77,d95f02,7570b3,e7298a,66a61e,e6ab02,a6761d,666666 gnbu3=e0f3db,a8ddb5,43a2ca gnbu4=f0f9e8,bae4bc,7bccc4,2b8cbe gnbu5=f0f9e8,bae4bc,7bccc4,43a2ca,0868ac gnbu6=f0f9e8,ccebc5,a8ddb5,7bccc4,43a2ca,0868ac gnbu7=f0f9e8,ccebc5,a8ddb5,7bccc4,4eb3d3,2b8cbe,08589e gnbu8=f7fcf0,e0f3db,ccebc5,a8ddb5,7bccc4,4eb3d3,2b8cbe,08589e gnbu9=f7fcf0,e0f3db,ccebc5,a8ddb5,7bccc4,4eb3d3,2b8cbe,0868ac,084081 greens3=e5f5e0,a1d99b,31a354 greens4=edf8e9,bae4b3,74c476,238b45 greens5=edf8e9,bae4b3,74c476,31a354,006d2c greens6=edf8e9,c7e9c0,a1d99b,74c476,31a354,006d2c greens7=edf8e9,c7e9c0,a1d99b,74c476,41ab5d,238b45,005a32 greens8=f7fcf5,e5f5e0,c7e9c0,a1d99b,74c476,41ab5d,238b45,005a32 greens9=f7fcf5,e5f5e0,c7e9c0,a1d99b,74c476,41ab5d,238b45,006d2c,00441b greys3=f0f0f0,bdbdbd,636363 greys4=f7f7f7,cccccc,969696,525252 greys5=f7f7f7,cccccc,969696,636363,252525 greys6=f7f7f7,d9d9d9,bdbdbd,969696,636363,252525 greys7=f7f7f7,d9d9d9,bdbdbd,969696,737373,525252,252525 greys8=ffffff,f0f0f0,d9d9d9,bdbdbd,969696,737373,525252,252525 greys9=ffffff,f0f0f0,d9d9d9,bdbdbd,969696,737373,525252,252525,000000 oranges3=fee6ce,fdae6b,e6550d oranges4=feedde,fdbe85,fd8d3c,d94701 oranges5=feedde,fdbe85,fd8d3c,e6550d,a63603 oranges6=feedde,fdd0a2,fdae6b,fd8d3c,e6550d,a63603 oranges7=feedde,fdd0a2,fdae6b,fd8d3c,f16913,d94801,8c2d04 oranges8=fff5eb,fee6ce,fdd0a2,fdae6b,fd8d3c,f16913,d94801,8c2d04 oranges9=fff5eb,fee6ce,fdd0a2,fdae6b,fd8d3c,f16913,d94801,a63603,7f2704 orrd3=fee8c8,fdbb84,e34a33 orrd4=fef0d9,fdcc8a,fc8d59,d7301f orrd5=fef0d9,fdcc8a,fc8d59,e34a33,b30000 orrd6=fef0d9,fdd49e,fdbb84,fc8d59,e34a33,b30000 orrd7=fef0d9,fdd49e,fdbb84,fc8d59,ef6548,d7301f,990000 orrd8=fff7ec,fee8c8,fdd49e,fdbb84,fc8d59,ef6548,d7301f,990000 orrd9=fff7ec,fee8c8,fdd49e,fdbb84,fc8d59,ef6548,d7301f,b30000,7f0000 paired10=a6cee3,1f78b4,b2df8a,33a02c,fb9a99,e31a1c,fdbf6f,ff7f00,cab2d6,6a3d9a paired11=a6cee3,1f78b4,b2df8a,33a02c,fb9a99,e31a1c,fdbf6f,ff7f00,cab2d6,6a3d9a,ffff99 paired12=a6cee3,1f78b4,b2df8a,33a02c,fb9a99,e31a1c,fdbf6f,ff7f00,cab2d6,6a3d9a,ffff99,b15928 paired3=a6cee3,1f78b4,b2df8a paired4=a6cee3,1f78b4,b2df8a,33a02c paired5=a6cee3,1f78b4,b2df8a,33a02c,fb9a99 paired6=a6cee3,1f78b4,b2df8a,33a02c,fb9a99,e31a1c paired7=a6cee3,1f78b4,b2df8a,33a02c,fb9a99,e31a1c,fdbf6f paired8=a6cee3,1f78b4,b2df8a,33a02c,fb9a99,e31a1c,fdbf6f,ff7f00 paired9=a6cee3,1f78b4,b2df8a,33a02c,fb9a99,e31a1c,fdbf6f,ff7f00,cab2d6 pastel13=fbb4ae,b3cde3,ccebc5 pastel14=fbb4ae,b3cde3,ccebc5,decbe4 pastel15=fbb4ae,b3cde3,ccebc5,decbe4,fed9a6 pastel16=fbb4ae,b3cde3,ccebc5,decbe4,fed9a6,ffffcc pastel17=fbb4ae,b3cde3,ccebc5,decbe4,fed9a6,ffffcc,e5d8bd pastel18=fbb4ae,b3cde3,ccebc5,decbe4,fed9a6,ffffcc,e5d8bd,fddaec pastel19=fbb4ae,b3cde3,ccebc5,decbe4,fed9a6,ffffcc,e5d8bd,fddaec,f2f2f2 pastel23=b3e2cd,fdcdac,cbd5e8 pastel24=b3e2cd,fdcdac,cbd5e8,f4cae4 pastel25=b3e2cd,fdcdac,cbd5e8,f4cae4,e6f5c9 pastel26=b3e2cd,fdcdac,cbd5e8,f4cae4,e6f5c9,fff2ae pastel27=b3e2cd,fdcdac,cbd5e8,f4cae4,e6f5c9,fff2ae,f1e2cc pastel28=b3e2cd,fdcdac,cbd5e8,f4cae4,e6f5c9,fff2ae,f1e2cc,cccccc piyg10=8e0152,c51b7d,de77ae,f1b6da,fde0ef,e6f5d0,b8e186,7fbc41,4d9221,276419 piyg11=8e0152,c51b7d,de77ae,f1b6da,fde0ef,f7f7f7,e6f5d0,b8e186,7fbc41,4d9221,276419 piyg3=e9a3c9,f7f7f7,a1d76a piyg4=d01c8b,f1b6da,b8e186,4dac26 piyg5=d01c8b,f1b6da,f7f7f7,b8e186,4dac26 piyg6=c51b7d,e9a3c9,fde0ef,e6f5d0,a1d76a,4d9221 piyg7=c51b7d,e9a3c9,fde0ef,f7f7f7,e6f5d0,a1d76a,4d9221 piyg8=c51b7d,de77ae,f1b6da,fde0ef,e6f5d0,b8e186,7fbc41,4d9221 piyg9=c51b7d,de77ae,f1b6da,fde0ef,f7f7f7,e6f5d0,b8e186,7fbc41,4d9221 prgn10=40004b,762a83,9970ab,c2a5cf,e7d4e8,d9f0d3,a6dba0,5aae61,1b7837,00441b prgn11=40004b,762a83,9970ab,c2a5cf,e7d4e8,f7f7f7,d9f0d3,a6dba0,5aae61,1b7837,00441b prgn3=af8dc3,f7f7f7,7fbf7b prgn4=7b3294,c2a5cf,a6dba0,008837 prgn5=7b3294,c2a5cf,f7f7f7,a6dba0,008837 prgn6=762a83,af8dc3,e7d4e8,d9f0d3,7fbf7b,1b7837 prgn7=762a83,af8dc3,e7d4e8,f7f7f7,d9f0d3,7fbf7b,1b7837 prgn8=762a83,9970ab,c2a5cf,e7d4e8,d9f0d3,a6dba0,5aae61,1b7837 prgn9=762a83,9970ab,c2a5cf,e7d4e8,f7f7f7,d9f0d3,a6dba0,5aae61,1b7837 pubu3=ece7f2,a6bddb,2b8cbe pubu4=f1eef6,bdc9e1,74a9cf,0570b0 pubu5=f1eef6,bdc9e1,74a9cf,2b8cbe,045a8d pubu6=f1eef6,d0d1e6,a6bddb,74a9cf,2b8cbe,045a8d pubu7=f1eef6,d0d1e6,a6bddb,74a9cf,3690c0,0570b0,034e7b pubu8=fff7fb,ece7f2,d0d1e6,a6bddb,74a9cf,3690c0,0570b0,034e7b pubu9=fff7fb,ece7f2,d0d1e6,a6bddb,74a9cf,3690c0,0570b0,045a8d,023858 pubugn3=ece2f0,a6bddb,1c9099 pubugn4=f6eff7,bdc9e1,67a9cf,02818a pubugn5=f6eff7,bdc9e1,67a9cf,1c9099,016c59 pubugn6=f6eff7,d0d1e6,a6bddb,67a9cf,1c9099,016c59 pubugn7=f6eff7,d0d1e6,a6bddb,67a9cf,3690c0,02818a,016450 pubugn8=fff7fb,ece2f0,d0d1e6,a6bddb,67a9cf,3690c0,02818a,016450 pubugn9=fff7fb,ece2f0,d0d1e6,a6bddb,67a9cf,3690c0,02818a,016c59,014636 puor10=7f3b08,b35806,e08214,fdb863,fee0b6,d8daeb,b2abd2,8073ac,542788,2d004b puor11=7f3b08,b35806,e08214,fdb863,fee0b6,f7f7f7,d8daeb,b2abd2,8073ac,542788,2d004b puor3=f1a340,f7f7f7,998ec3 puor4=e66101,fdb863,b2abd2,5e3c99 puor5=e66101,fdb863,f7f7f7,b2abd2,5e3c99 puor6=b35806,f1a340,fee0b6,d8daeb,998ec3,542788 puor7=b35806,f1a340,fee0b6,f7f7f7,d8daeb,998ec3,542788 puor8=b35806,e08214,fdb863,fee0b6,d8daeb,b2abd2,8073ac,542788 puor9=b35806,e08214,fdb863,fee0b6,f7f7f7,d8daeb,b2abd2,8073ac,542788 purd3=e7e1ef,c994c7,dd1c77 purd4=f1eef6,d7b5d8,df65b0,ce1256 purd5=f1eef6,d7b5d8,df65b0,dd1c77,980043 purd6=f1eef6,d4b9da,c994c7,df65b0,dd1c77,980043 purd7=f1eef6,d4b9da,c994c7,df65b0,e7298a,ce1256,91003f purd8=f7f4f9,e7e1ef,d4b9da,c994c7,df65b0,e7298a,ce1256,91003f purd9=f7f4f9,e7e1ef,d4b9da,c994c7,df65b0,e7298a,ce1256,980043,67001f purples3=efedf5,bcbddc,756bb1 purples4=f2f0f7,cbc9e2,9e9ac8,6a51a3 purples5=f2f0f7,cbc9e2,9e9ac8,756bb1,54278f purples6=f2f0f7,dadaeb,bcbddc,9e9ac8,756bb1,54278f purples7=f2f0f7,dadaeb,bcbddc,9e9ac8,807dba,6a51a3,4a1486 purples8=fcfbfd,efedf5,dadaeb,bcbddc,9e9ac8,807dba,6a51a3,4a1486 purples9=fcfbfd,efedf5,dadaeb,bcbddc,9e9ac8,807dba,6a51a3,54278f,3f007d rdbu10=67001f,b2182b,d6604d,f4a582,fddbc7,d1e5f0,92c5de,4393c3,2166ac,053061 rdbu11=67001f,b2182b,d6604d,f4a582,fddbc7,f7f7f7,d1e5f0,92c5de,4393c3,2166ac,053061 rdbu3=ef8a62,f7f7f7,67a9cf rdbu4=ca0020,f4a582,92c5de,0571b0 rdbu5=ca0020,f4a582,f7f7f7,92c5de,0571b0 rdbu6=b2182b,ef8a62,fddbc7,d1e5f0,67a9cf,2166ac rdbu7=b2182b,ef8a62,fddbc7,f7f7f7,d1e5f0,67a9cf,2166ac rdbu8=b2182b,d6604d,f4a582,fddbc7,d1e5f0,92c5de,4393c3,2166ac rdbu9=b2182b,d6604d,f4a582,fddbc7,f7f7f7,d1e5f0,92c5de,4393c3,2166ac rdgy10=67001f,b2182b,d6604d,f4a582,fddbc7,e0e0e0,bababa,878787,4d4d4d,1a1a1a rdgy11=67001f,b2182b,d6604d,f4a582,fddbc7,ffffff,e0e0e0,bababa,878787,4d4d4d,1a1a1a rdgy3=ef8a62,ffffff,999999 rdgy4=ca0020,f4a582,bababa,404040 rdgy5=ca0020,f4a582,ffffff,bababa,404040 rdgy6=b2182b,ef8a62,fddbc7,e0e0e0,999999,4d4d4d rdgy7=b2182b,ef8a62,fddbc7,ffffff,e0e0e0,999999,4d4d4d rdgy8=b2182b,d6604d,f4a582,fddbc7,e0e0e0,bababa,878787,4d4d4d rdgy9=b2182b,d6604d,f4a582,fddbc7,ffffff,e0e0e0,bababa,878787,4d4d4d rdpu3=fde0dd,fa9fb5,c51b8a rdpu4=feebe2,fbb4b9,f768a1,ae017e rdpu5=feebe2,fbb4b9,f768a1,c51b8a,7a0177 rdpu6=feebe2,fcc5c0,fa9fb5,f768a1,c51b8a,7a0177 rdpu7=feebe2,fcc5c0,fa9fb5,f768a1,dd3497,ae017e,7a0177 rdpu8=fff7f3,fde0dd,fcc5c0,fa9fb5,f768a1,dd3497,ae017e,7a0177 rdpu9=fff7f3,fde0dd,fcc5c0,fa9fb5,f768a1,dd3497,ae017e,7a0177,49006a rdylbu10=a50026,d73027,f46d43,fdae61,fee090,e0f3f8,abd9e9,74add1,4575b4,313695 rdylbu11=a50026,d73027,f46d43,fdae61,fee090,ffffbf,e0f3f8,abd9e9,74add1,4575b4,313695 rdylbu3=fc8d59,ffffbf,91bfdb rdylbu4=d7191c,fdae61,abd9e9,2c7bb6 rdylbu5=d7191c,fdae61,ffffbf,abd9e9,2c7bb6 rdylbu6=d73027,fc8d59,fee090,e0f3f8,91bfdb,4575b4 rdylbu7=d73027,fc8d59,fee090,ffffbf,e0f3f8,91bfdb,4575b4 rdylbu8=d73027,f46d43,fdae61,fee090,e0f3f8,abd9e9,74add1,4575b4 rdylbu9=d73027,f46d43,fdae61,fee090,ffffbf,e0f3f8,abd9e9,74add1,4575b4 rdylgn10=a50026,d73027,f46d43,fdae61,fee08b,d9ef8b,a6d96a,66bd63,1a9850,006837 rdylgn11=a50026,d73027,f46d43,fdae61,fee08b,ffffbf,d9ef8b,a6d96a,66bd63,1a9850,006837 rdylgn3=fc8d59,ffffbf,91cf60 rdylgn4=d7191c,fdae61,a6d96a,1a9641 rdylgn5=d7191c,fdae61,ffffbf,a6d96a,1a9641 rdylgn6=d73027,fc8d59,fee08b,d9ef8b,91cf60,1a9850 rdylgn7=d73027,fc8d59,fee08b,ffffbf,d9ef8b,91cf60,1a9850 rdylgn8=d73027,f46d43,fdae61,fee08b,d9ef8b,a6d96a,66bd63,1a9850 rdylgn9=d73027,f46d43,fdae61,fee08b,ffffbf,d9ef8b,a6d96a,66bd63,1a9850 reds3=fee0d2,fc9272,de2d26 reds4=fee5d9,fcae91,fb6a4a,cb181d reds5=fee5d9,fcae91,fb6a4a,de2d26,a50f15 reds6=fee5d9,fcbba1,fc9272,fb6a4a,de2d26,a50f15 reds7=fee5d9,fcbba1,fc9272,fb6a4a,ef3b2c,cb181d,99000d reds8=fff5f0,fee0d2,fcbba1,fc9272,fb6a4a,ef3b2c,cb181d,99000d reds9=fff5f0,fee0d2,fcbba1,fc9272,fb6a4a,ef3b2c,cb181d,a50f15,67000d set13=e41a1c,377eb8,4daf4a set14=e41a1c,377eb8,4daf4a,984ea3 set15=e41a1c,377eb8,4daf4a,984ea3,ff7f00 set16=e41a1c,377eb8,4daf4a,984ea3,ff7f00,ffff33 set17=e41a1c,377eb8,4daf4a,984ea3,ff7f00,ffff33,a65628 set18=e41a1c,377eb8,4daf4a,984ea3,ff7f00,ffff33,a65628,f781bf set19=e41a1c,377eb8,4daf4a,984ea3,ff7f00,ffff33,a65628,f781bf,999999 set23=66c2a5,fc8d62,8da0cb set24=66c2a5,fc8d62,8da0cb,e78ac3 set25=66c2a5,fc8d62,8da0cb,e78ac3,a6d854 set26=66c2a5,fc8d62,8da0cb,e78ac3,a6d854,ffd92f set27=66c2a5,fc8d62,8da0cb,e78ac3,a6d854,ffd92f,e5c494 set28=66c2a5,fc8d62,8da0cb,e78ac3,a6d854,ffd92f,e5c494,b3b3b3 set310=8dd3c7,ffffb3,bebada,fb8072,80b1d3,fdb462,b3de69,fccde5,d9d9d9,bc80bd set311=8dd3c7,ffffb3,bebada,fb8072,80b1d3,fdb462,b3de69,fccde5,d9d9d9,bc80bd,ccebc5 set312=8dd3c7,ffffb3,bebada,fb8072,80b1d3,fdb462,b3de69,fccde5,d9d9d9,bc80bd,ccebc5,ffed6f set33=8dd3c7,ffffb3,bebada set34=8dd3c7,ffffb3,bebada,fb8072 set35=8dd3c7,ffffb3,bebada,fb8072,80b1d3 set36=8dd3c7,ffffb3,bebada,fb8072,80b1d3,fdb462 set37=8dd3c7,ffffb3,bebada,fb8072,80b1d3,fdb462,b3de69 set38=8dd3c7,ffffb3,bebada,fb8072,80b1d3,fdb462,b3de69,fccde5 set39=8dd3c7,ffffb3,bebada,fb8072,80b1d3,fdb462,b3de69,fccde5,d9d9d9 spectral10=9e0142,d53e4f,f46d43,fdae61,fee08b,e6f598,abdda4,66c2a5,3288bd,5e4fa2 spectral11=9e0142,d53e4f,f46d43,fdae61,fee08b,ffffbf,e6f598,abdda4,66c2a5,3288bd,5e4fa2 spectral3=fc8d59,ffffbf,99d594 spectral4=d7191c,fdae61,abdda4,2b83ba spectral5=d7191c,fdae61,ffffbf,abdda4,2b83ba spectral6=d53e4f,fc8d59,fee08b,e6f598,99d594,3288bd spectral7=d53e4f,fc8d59,fee08b,ffffbf,e6f598,99d594,3288bd spectral8=d53e4f,f46d43,fdae61,fee08b,e6f598,abdda4,66c2a5,3288bd spectral9=d53e4f,f46d43,fdae61,fee08b,ffffbf,e6f598,abdda4,66c2a5,3288bd ylgn3=f7fcb9,addd8e,31a354 ylgn4=ffffcc,c2e699,78c679,238443 ylgn5=ffffcc,c2e699,78c679,31a354,006837 ylgn6=ffffcc,d9f0a3,addd8e,78c679,31a354,006837 ylgn7=ffffcc,d9f0a3,addd8e,78c679,41ab5d,238443,005a32 ylgn8=ffffe5,f7fcb9,d9f0a3,addd8e,78c679,41ab5d,238443,005a32 ylgn9=ffffe5,f7fcb9,d9f0a3,addd8e,78c679,41ab5d,238443,006837,004529 ylgnbu3=edf8b1,7fcdbb,2c7fb8 ylgnbu4=ffffcc,a1dab4,41b6c4,225ea8 ylgnbu5=ffffcc,a1dab4,41b6c4,2c7fb8,253494 ylgnbu6=ffffcc,c7e9b4,7fcdbb,41b6c4,2c7fb8,253494 ylgnbu7=ffffcc,c7e9b4,7fcdbb,41b6c4,1d91c0,225ea8,0c2c84 ylgnbu8=ffffd9,edf8b1,c7e9b4,7fcdbb,41b6c4,1d91c0,225ea8,0c2c84 ylgnbu9=ffffd9,edf8b1,c7e9b4,7fcdbb,41b6c4,1d91c0,225ea8,253494,081d58 ylorbr3=fff7bc,fec44f,d95f0e ylorbr4=ffffd4,fed98e,fe9929,cc4c02 ylorbr5=ffffd4,fed98e,fe9929,d95f0e,993404 ylorbr6=ffffd4,fee391,fec44f,fe9929,d95f0e,993404 ylorbr7=ffffd4,fee391,fec44f,fe9929,ec7014,cc4c02,8c2d04 ylorbr8=ffffe5,fff7bc,fee391,fec44f,fe9929,ec7014,cc4c02,8c2d04 ylorbr9=ffffe5,fff7bc,fee391,fec44f,fe9929,ec7014,cc4c02,993404,662506 ylorrd3=ffeda0,feb24c,f03b20 ylorrd4=ffffb2,fecc5c,fd8d3c,e31a1c ylorrd5=ffffb2,fecc5c,fd8d3c,f03b20,bd0026 ylorrd6=ffffb2,fed976,feb24c,fd8d3c,f03b20,bd0026 ylorrd7=ffffb2,fed976,feb24c,fd8d3c,fc4e2a,e31a1c,b10026 ylorrd8=ffffcc,ffeda0,fed976,feb24c,fd8d3c,fc4e2a,e31a1c,b10026 ylorrd9=ffffcc,ffeda0,fed976,feb24c,fd8d3c,fc4e2a,e31a1c,bd0026,800026".split(" ").map((entry) => {
|
|
1126
|
+
const eq = entry.indexOf("=");
|
|
1127
|
+
return [
|
|
1128
|
+
entry.slice(0, eq),
|
|
1129
|
+
entry.slice(eq + 1).split(",").map((h) => `#${h}`)
|
|
1130
|
+
];
|
|
1131
|
+
})
|
|
1132
|
+
);
|
|
1133
|
+
const TRANSPARENT = /* @__PURE__ */ new Set(["transparent", "none", "invis"]);
|
|
1134
|
+
const HSV_PART = /^(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/;
|
|
1135
|
+
function hex2$1(v2) {
|
|
1136
|
+
return v2.toString(16).padStart(2, "0");
|
|
1137
|
+
}
|
|
1138
|
+
function hsvHex(h, s, v2) {
|
|
1139
|
+
const i = Math.floor(h * 6);
|
|
1140
|
+
const f = h * 6 - i;
|
|
1141
|
+
const p = v2 * (1 - s);
|
|
1142
|
+
const q = v2 * (1 - f * s);
|
|
1143
|
+
const t = v2 * (1 - (1 - f) * s);
|
|
1144
|
+
const rgb = [
|
|
1145
|
+
[v2, t, p],
|
|
1146
|
+
[q, v2, p],
|
|
1147
|
+
[p, v2, t],
|
|
1148
|
+
[p, q, v2],
|
|
1149
|
+
[t, p, v2],
|
|
1150
|
+
[v2, p, q]
|
|
1151
|
+
][i % 6];
|
|
1152
|
+
return `#${rgb.map((c) => hex2$1(Math.trunc(c * 255))).join("")}`;
|
|
1153
|
+
}
|
|
1154
|
+
function resolveOne(text, scheme) {
|
|
1155
|
+
if (text.startsWith("#")) {
|
|
1156
|
+
const m = /^#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{1,2})?/.exec(text);
|
|
1157
|
+
if (m === null) {
|
|
1158
|
+
return null;
|
|
1159
|
+
}
|
|
1160
|
+
return {
|
|
1161
|
+
hex: `#${m[1]}${m[2]}${m[3]}`.toLowerCase(),
|
|
1162
|
+
alpha: m[4] === void 0 ? 1 : Number.parseInt(m[4], 16) / 255
|
|
1163
|
+
};
|
|
1164
|
+
}
|
|
1165
|
+
const hsv = /^[.\d]/.test(text) ? hsvColor(text) : null;
|
|
1166
|
+
if (hsv !== null) {
|
|
1167
|
+
return { hex: hsv, alpha: 1 };
|
|
1168
|
+
}
|
|
1169
|
+
const named = schemedName(text.toLowerCase(), scheme);
|
|
1170
|
+
if (named === null) {
|
|
1171
|
+
return null;
|
|
1172
|
+
}
|
|
1173
|
+
if (TRANSPARENT.has(named.name)) {
|
|
1174
|
+
return { hex: "#fffffe", alpha: 0 };
|
|
1175
|
+
}
|
|
1176
|
+
const hex = schemeColor(named.name, named.scheme);
|
|
1177
|
+
return hex === void 0 ? null : { hex, alpha: 1 };
|
|
1178
|
+
}
|
|
1179
|
+
function hsvColor(text) {
|
|
1180
|
+
const parts = text.split(/[ ,]+/);
|
|
1181
|
+
if (parts.length < 3 || !parts.slice(0, 3).every((p) => HSV_PART.test(p))) {
|
|
1182
|
+
return null;
|
|
1183
|
+
}
|
|
1184
|
+
const [h, s, v2] = parts.slice(0, 3).map((p) => Math.min(1, Math.max(0, Number(p))));
|
|
1185
|
+
return hsvHex(h, s, v2);
|
|
1186
|
+
}
|
|
1187
|
+
function schemedName(name2, scheme) {
|
|
1188
|
+
if (!name2.startsWith("/")) {
|
|
1189
|
+
return { name: name2, scheme };
|
|
1190
|
+
}
|
|
1191
|
+
const slash = name2.indexOf("/", 1);
|
|
1192
|
+
if (slash < 0) {
|
|
1193
|
+
return null;
|
|
1194
|
+
}
|
|
1195
|
+
const prefix = name2.slice(1, slash);
|
|
1196
|
+
return { name: name2.slice(slash + 1), scheme: prefix === "" ? scheme : prefix };
|
|
1197
|
+
}
|
|
1198
|
+
function schemeColor(name2, scheme) {
|
|
1199
|
+
if (scheme === "x11") {
|
|
1200
|
+
return X11_COLORS.get(name2);
|
|
1201
|
+
}
|
|
1202
|
+
if (scheme === "svg") {
|
|
1203
|
+
return CSS_COLORS.get(name2);
|
|
1204
|
+
}
|
|
1205
|
+
const colors = BREWER_SCHEMES.get(scheme);
|
|
1206
|
+
const index = /^\d{1,3}$/.test(name2) ? Number(name2) : 0;
|
|
1207
|
+
return colors !== void 0 && index >= 1 ? colors[index - 1] : void 0;
|
|
1208
|
+
}
|
|
1209
|
+
function graphvizColor(raw, scheme, use) {
|
|
1210
|
+
let text = raw.replace(/^[ \t\r\n]+/, "");
|
|
1211
|
+
let list = null;
|
|
1212
|
+
const colon = text.indexOf(":");
|
|
1213
|
+
if (colon >= 0) {
|
|
1214
|
+
text = text.slice(0, colon);
|
|
1215
|
+
if (use !== "line") {
|
|
1216
|
+
const semi = text.indexOf(";");
|
|
1217
|
+
if (semi >= 0) {
|
|
1218
|
+
text = text.slice(0, semi);
|
|
1219
|
+
}
|
|
1220
|
+
list = use === "fill" ? "gradient" : "lines";
|
|
1221
|
+
}
|
|
1222
|
+
}
|
|
1223
|
+
const sc = scheme === null || scheme.trim() === "" ? "x11" : scheme.toLowerCase();
|
|
1224
|
+
const resolved = text === "" ? null : resolveOne(text, sc);
|
|
1225
|
+
return resolved === null ? { hex: "#000000", alpha: 1, unknown: true, list } : { hex: resolved.hex, alpha: resolved.alpha, unknown: false, list };
|
|
1226
|
+
}
|
|
1227
|
+
function hex2(v2) {
|
|
1228
|
+
return Math.max(0, Math.min(255, Math.round(v2))).toString(16).padStart(2, "0");
|
|
1229
|
+
}
|
|
1230
|
+
function rgbHex(r, g, b) {
|
|
1231
|
+
return `#${hex2(r)}${hex2(g)}${hex2(b)}`;
|
|
1232
|
+
}
|
|
1233
|
+
function alpha01(a) {
|
|
1234
|
+
return num6$1(Math.max(0, Math.min(1, a)));
|
|
1235
|
+
}
|
|
1236
|
+
function mul(m, v2) {
|
|
1237
|
+
return [
|
|
1238
|
+
m[0][0] * v2[0] + m[0][1] * v2[1] + m[0][2] * v2[2],
|
|
1239
|
+
m[1][0] * v2[0] + m[1][1] * v2[1] + m[1][2] * v2[2],
|
|
1240
|
+
m[2][0] * v2[0] + m[2][1] * v2[1] + m[2][2] * v2[2]
|
|
1241
|
+
];
|
|
1242
|
+
}
|
|
1243
|
+
const LIN_TO_XYZ = [
|
|
1244
|
+
[0.41239079926595934, 0.357584339383878, 0.1804807884018343],
|
|
1245
|
+
[0.21263900587151027, 0.715168678767756, 0.07219231536073371],
|
|
1246
|
+
[0.01933081871559182, 0.11919477979462598, 0.9505321522496607]
|
|
1247
|
+
];
|
|
1248
|
+
const XYZ_TO_LIN = [
|
|
1249
|
+
[3.2409699419045226, -1.537383177570094, -0.4986107602930034],
|
|
1250
|
+
[-0.9692436362808796, 1.8759675015077202, 0.04155505740717559],
|
|
1251
|
+
[0.05563007969699366, -0.20397695888897652, 1.0569715142428786]
|
|
1252
|
+
];
|
|
1253
|
+
const XYZ_TO_LMS = [
|
|
1254
|
+
[0.819022437996703, 0.3619062600528904, -0.1288737815209879],
|
|
1255
|
+
[0.0329836539323885, 0.929286861586343, 0.0361446663506424],
|
|
1256
|
+
[0.0481771893596242, 0.2642395317527308, 0.6335478284694309]
|
|
1257
|
+
];
|
|
1258
|
+
const LMS_TO_XYZ = [
|
|
1259
|
+
[1.2268798758459243, -0.5578149944602171, 0.2813910456659647],
|
|
1260
|
+
[-0.0405757452148008, 1.112286803280317, -0.0717110580655164],
|
|
1261
|
+
[-0.0763729366746601, -0.4214933324022432, 1.5869240198367816]
|
|
1262
|
+
];
|
|
1263
|
+
const LMS_TO_LAB = [
|
|
1264
|
+
[0.210454268309314, 0.7936177747023054, -0.0040720430116193],
|
|
1265
|
+
[1.9779985324311684, -2.42859224204858, 0.450593709617411],
|
|
1266
|
+
[0.0259040424655478, 0.7827717124575296, -0.8086757549230774]
|
|
1267
|
+
];
|
|
1268
|
+
const LAB_TO_LMS = [
|
|
1269
|
+
[1, 0.3963377773761749, 0.2158037573099136],
|
|
1270
|
+
[1, -0.1055613458156586, -0.0638541728258133],
|
|
1271
|
+
[1, -0.0894841775298119, -1.2914855480194092]
|
|
1272
|
+
];
|
|
1273
|
+
function srgbToOklab(rgb) {
|
|
1274
|
+
const lin = rgb.map((c) => {
|
|
1275
|
+
const a = Math.abs(c);
|
|
1276
|
+
return Math.sign(c) * (a <= 0.04045 ? a / 12.92 : ((a + 0.055) / 1.055) ** 2.4);
|
|
1277
|
+
});
|
|
1278
|
+
const lms = mul(XYZ_TO_LMS, mul(LIN_TO_XYZ, lin));
|
|
1279
|
+
return mul(LMS_TO_LAB, lms.map(Math.cbrt));
|
|
1280
|
+
}
|
|
1281
|
+
function oklabToSrgb(lab) {
|
|
1282
|
+
const lms = mul(LAB_TO_LMS, lab).map((c) => c ** 3);
|
|
1283
|
+
return mul(XYZ_TO_LIN, mul(LMS_TO_XYZ, lms)).map((c) => {
|
|
1284
|
+
const a = Math.abs(c);
|
|
1285
|
+
return Math.sign(c) * (a > 31308e-7 ? 1.055 * a ** (1 / 2.4) - 0.055 : 12.92 * a);
|
|
1286
|
+
});
|
|
1287
|
+
}
|
|
1288
|
+
function inGamut(rgb) {
|
|
1289
|
+
return rgb.every((c) => c >= 0 && c <= 1);
|
|
1290
|
+
}
|
|
1291
|
+
function clip(rgb) {
|
|
1292
|
+
return rgb.map((c) => Math.max(0, Math.min(1, c)));
|
|
1293
|
+
}
|
|
1294
|
+
function deltaEOK(p, q) {
|
|
1295
|
+
return Math.hypot(p[0] - q[0], p[1] - q[1], p[2] - q[2]);
|
|
1296
|
+
}
|
|
1297
|
+
function toGamut(rgb) {
|
|
1298
|
+
if (inGamut(rgb)) {
|
|
1299
|
+
return rgb;
|
|
1300
|
+
}
|
|
1301
|
+
const JND = 0.02;
|
|
1302
|
+
const [l, a, b] = srgbToOklab(rgb);
|
|
1303
|
+
if (l >= 1) {
|
|
1304
|
+
return [1, 1, 1];
|
|
1305
|
+
}
|
|
1306
|
+
if (l <= 0) {
|
|
1307
|
+
return [0, 0, 0];
|
|
1308
|
+
}
|
|
1309
|
+
const achromatic = Math.abs(a) < 2e-4 && Math.abs(b) < 2e-4;
|
|
1310
|
+
const degrees = (Math.atan2(b, a) * 180 / Math.PI % 360 + 360) % 360;
|
|
1311
|
+
const at = (chroma) => achromatic ? [l, 0, 0] : [l, chroma * Math.cos(degrees * Math.PI / 180), chroma * Math.sin(degrees * Math.PI / 180)];
|
|
1312
|
+
const chroma0 = Math.sqrt(a ** 2 + b ** 2);
|
|
1313
|
+
const first = oklabToSrgb(at(chroma0));
|
|
1314
|
+
if (inGamut(first)) {
|
|
1315
|
+
return first;
|
|
1316
|
+
}
|
|
1317
|
+
const clipped = clip(first);
|
|
1318
|
+
if (deltaEOK(srgbToOklab(clipped), at(chroma0)) < JND) {
|
|
1319
|
+
return clip(rgb);
|
|
1320
|
+
}
|
|
1321
|
+
return bisectChroma(at, chroma0, clipped);
|
|
1322
|
+
}
|
|
1323
|
+
function bisectChroma(at, chroma0, first) {
|
|
1324
|
+
const JND = 0.02;
|
|
1325
|
+
const EPSILON = 1e-4;
|
|
1326
|
+
let clipped = first;
|
|
1327
|
+
let min = 0;
|
|
1328
|
+
let max = chroma0;
|
|
1329
|
+
let minInGamut = true;
|
|
1330
|
+
while (max - min > EPSILON) {
|
|
1331
|
+
const chroma = (min + max) / 2;
|
|
1332
|
+
const current = at(chroma);
|
|
1333
|
+
const rgbNow = oklabToSrgb(current);
|
|
1334
|
+
if (minInGamut && inGamut(rgbNow)) {
|
|
1335
|
+
min = chroma;
|
|
1336
|
+
continue;
|
|
1337
|
+
}
|
|
1338
|
+
clipped = clip(rgbNow);
|
|
1339
|
+
const e = deltaEOK(srgbToOklab(clipped), current);
|
|
1340
|
+
if (e >= JND) {
|
|
1341
|
+
max = chroma;
|
|
1342
|
+
} else if (JND - e < EPSILON) {
|
|
1343
|
+
break;
|
|
1344
|
+
} else {
|
|
1345
|
+
minInGamut = false;
|
|
1346
|
+
min = chroma;
|
|
1347
|
+
}
|
|
1348
|
+
}
|
|
1349
|
+
return clipped;
|
|
1350
|
+
}
|
|
1351
|
+
function srgbHex(rgb) {
|
|
1352
|
+
const [r, g, b] = toGamut(rgb);
|
|
1353
|
+
return rgbHex(r * 255, g * 255, b * 255);
|
|
1354
|
+
}
|
|
1355
|
+
const CSS_NUMBER = /^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i;
|
|
1356
|
+
const CSS_UNIT = /(%|deg|grad|rad|turn)$/i;
|
|
1357
|
+
function cssArgs(body) {
|
|
1358
|
+
const slash = body.split("/");
|
|
1359
|
+
if (slash.length > 2) {
|
|
1360
|
+
return null;
|
|
1361
|
+
}
|
|
1362
|
+
const parts = slash[0].split(/[\s,]+/).filter((p) => p !== "");
|
|
1363
|
+
let alpha = slash.length === 2 ? slash[1].trim() : void 0;
|
|
1364
|
+
if (alpha === void 0 && parts.length === 4) {
|
|
1365
|
+
alpha = parts.pop();
|
|
1366
|
+
}
|
|
1367
|
+
return parts.length === 3 && alpha !== "" ? { parts, alpha } : null;
|
|
1368
|
+
}
|
|
1369
|
+
function cssNumber(text) {
|
|
1370
|
+
const unit = CSS_UNIT.exec(text)?.[1] ?? "";
|
|
1371
|
+
const number = text.slice(0, text.length - unit.length);
|
|
1372
|
+
if (!CSS_NUMBER.test(number)) {
|
|
1373
|
+
return null;
|
|
1374
|
+
}
|
|
1375
|
+
const value = Number(number);
|
|
1376
|
+
return Number.isFinite(value) ? { value, unit: unit.toLowerCase() } : null;
|
|
1377
|
+
}
|
|
1378
|
+
function cssAlpha(text) {
|
|
1379
|
+
if (text === void 0) {
|
|
1380
|
+
return 1;
|
|
1381
|
+
}
|
|
1382
|
+
const n = cssNumber(text);
|
|
1383
|
+
if (n === null || n.unit !== "" && n.unit !== "%") {
|
|
1384
|
+
return null;
|
|
1385
|
+
}
|
|
1386
|
+
return alpha01(n.unit === "%" ? n.value / 100 : n.value);
|
|
1387
|
+
}
|
|
1388
|
+
function cssFunction(text) {
|
|
1389
|
+
const m = /^(rgba?|hsla?)\(([^()]*)\)$/i.exec(text);
|
|
1390
|
+
if (m === null) {
|
|
1391
|
+
return null;
|
|
1392
|
+
}
|
|
1393
|
+
const args = cssArgs(m[2]);
|
|
1394
|
+
if (args === null) {
|
|
1395
|
+
return null;
|
|
1396
|
+
}
|
|
1397
|
+
const nums = args.parts.map(cssNumber);
|
|
1398
|
+
const alpha = cssAlpha(args.alpha);
|
|
1399
|
+
if (nums.includes(null) || alpha === null) {
|
|
1400
|
+
return null;
|
|
1401
|
+
}
|
|
1402
|
+
const [x, y, z] = nums;
|
|
1403
|
+
if (m[1].toLowerCase().startsWith("rgb")) {
|
|
1404
|
+
if ([x, y, z].some((n) => n.unit !== "" && n.unit !== "%")) {
|
|
1405
|
+
return null;
|
|
1406
|
+
}
|
|
1407
|
+
const ch = [x, y, z].map((n) => n.unit === "%" ? n.value / 100 : n.value / 255);
|
|
1408
|
+
return { hex: srgbHex(ch), alpha };
|
|
1409
|
+
}
|
|
1410
|
+
const turns = { "": 360, deg: 360, grad: 400, rad: 2 * Math.PI, turn: 1 };
|
|
1411
|
+
if (x.unit === "%" || !Object.hasOwn(turns, x.unit) || [y, z].some((n) => n.unit !== "" && n.unit !== "%")) {
|
|
1412
|
+
return null;
|
|
1413
|
+
}
|
|
1414
|
+
const h = (x.value / turns[x.unit] * 360 % 360 + 360) % 360;
|
|
1415
|
+
const s = y.value / 100;
|
|
1416
|
+
const l = z.value / 100;
|
|
1417
|
+
const f = (n) => {
|
|
1418
|
+
const k = (n + h / 30) % 12;
|
|
1419
|
+
return l - s * Math.min(l, 1 - l) * Math.max(-1, Math.min(k - 3, 9 - k, 1));
|
|
1420
|
+
};
|
|
1421
|
+
return { hex: srgbHex([f(0), f(8), f(4)]), alpha };
|
|
1422
|
+
}
|
|
1423
|
+
function hexColor(text, alphaFirst) {
|
|
1424
|
+
const m = /^#([0-9a-f]+)$/i.exec(text);
|
|
1425
|
+
if (m === null) {
|
|
1426
|
+
return null;
|
|
1427
|
+
}
|
|
1428
|
+
const h = m[1];
|
|
1429
|
+
const byte = (i) => Number.parseInt(h.slice(i, i + 2), 16);
|
|
1430
|
+
switch (h.length) {
|
|
1431
|
+
case 3:
|
|
1432
|
+
case 4: {
|
|
1433
|
+
const v2 = Array.from(h, (c) => Number.parseInt(c + c, 16));
|
|
1434
|
+
return { hex: rgbHex(v2[0], v2[1], v2[2]), alpha: h.length === 4 ? alpha01(v2[3] / 255) : 1 };
|
|
1435
|
+
}
|
|
1436
|
+
case 6:
|
|
1437
|
+
return { hex: `#${h.toLowerCase()}`, alpha: 1 };
|
|
1438
|
+
case 8:
|
|
1439
|
+
return alphaFirst ? { hex: rgbHex(byte(2), byte(4), byte(6)), alpha: alpha01(byte(0) / 255) } : { hex: rgbHex(byte(0), byte(2), byte(4)), alpha: alpha01(byte(6) / 255) };
|
|
1440
|
+
default:
|
|
1441
|
+
return null;
|
|
1442
|
+
}
|
|
1443
|
+
}
|
|
1444
|
+
function cssColor(text) {
|
|
1445
|
+
const lower = text.toLowerCase();
|
|
1446
|
+
if (lower === "transparent") {
|
|
1447
|
+
return { hex: "#000000", alpha: 0 };
|
|
1448
|
+
}
|
|
1449
|
+
const named = CSS_COLORS.get(lower);
|
|
1450
|
+
if (named !== void 0) {
|
|
1451
|
+
return { hex: named, alpha: 1 };
|
|
1452
|
+
}
|
|
1453
|
+
return hexColor(text, false) ?? cssFunction(text);
|
|
1454
|
+
}
|
|
1455
|
+
const PAJEK_CHANNEL = /^(?:\d+(?:\.\d*)?|\.\d+)$/;
|
|
1456
|
+
function pajekColor(text) {
|
|
1457
|
+
const named = DVIPS_COLORS.get(text);
|
|
1458
|
+
if (named !== void 0) {
|
|
1459
|
+
return { hex: named, alpha: 1 };
|
|
1460
|
+
}
|
|
1461
|
+
const gray = /^Gray(\d\d)$/.exec(text);
|
|
1462
|
+
if (gray !== null) {
|
|
1463
|
+
const v2 = 255 * (1 - Number(gray[1]) / 100);
|
|
1464
|
+
return { hex: rgbHex(v2, v2, v2), alpha: 1 };
|
|
1465
|
+
}
|
|
1466
|
+
const rgb = /^RGB([0-9A-Fa-f]{6})$/.exec(text);
|
|
1467
|
+
if (rgb !== null) {
|
|
1468
|
+
return { hex: `#${rgb[1].toLowerCase()}`, alpha: 1 };
|
|
1469
|
+
}
|
|
1470
|
+
const cmyk = /^CMYK([0-9A-Fa-f]{8})$/.exec(text);
|
|
1471
|
+
let parts = null;
|
|
1472
|
+
let model = "";
|
|
1473
|
+
if (cmyk === null) {
|
|
1474
|
+
const fn = /^(RGB|CMYK)\(([^()]*)\)$/.exec(text);
|
|
1475
|
+
const channels2 = fn === null ? [] : fn[2].split(",");
|
|
1476
|
+
if (fn !== null && channels2.every((c2) => PAJEK_CHANNEL.test(c2))) {
|
|
1477
|
+
model = fn[1];
|
|
1478
|
+
parts = channels2.map(Number);
|
|
1479
|
+
}
|
|
1480
|
+
} else {
|
|
1481
|
+
model = "CMYK";
|
|
1482
|
+
parts = [0, 2, 4, 6].map((i) => Number.parseInt(cmyk[1].slice(i, i + 2), 16) / 255);
|
|
1483
|
+
}
|
|
1484
|
+
if (parts === null || parts.some((p) => p > 1) || parts.length !== (model === "RGB" ? 3 : 4)) {
|
|
1485
|
+
return hexColor(text, false);
|
|
1486
|
+
}
|
|
1487
|
+
if (model === "RGB") {
|
|
1488
|
+
return { hex: rgbHex(parts[0] * 255, parts[1] * 255, parts[2] * 255), alpha: 1 };
|
|
1489
|
+
}
|
|
1490
|
+
const [c, m, y, k] = parts;
|
|
1491
|
+
const ch = (v2) => 255 * (1 - Math.min(1, v2 + k));
|
|
1492
|
+
return { hex: rgbHex(ch(c), ch(m), ch(y)), alpha: 1 };
|
|
1493
|
+
}
|
|
1494
|
+
function channels(raw) {
|
|
1495
|
+
if (!Object.hasOwn(raw, "r") || !Object.hasOwn(raw, "g") || !Object.hasOwn(raw, "b")) {
|
|
1496
|
+
return null;
|
|
1497
|
+
}
|
|
1498
|
+
const o = raw;
|
|
1499
|
+
const [r, g, b] = [o.r, o.g, o.b].map(
|
|
1500
|
+
(v2) => typeof v2 === "number" || typeof v2 === "string" ? Number(v2) : Number.NaN
|
|
1501
|
+
);
|
|
1502
|
+
if (![r, g, b].every((v2) => Number.isFinite(v2) && v2 >= 0 && v2 <= 255)) {
|
|
1503
|
+
return null;
|
|
1504
|
+
}
|
|
1505
|
+
const a = Object.hasOwn(raw, "a") && o.a !== void 0 && o.a !== null ? Number(o.a) : 1;
|
|
1506
|
+
return Number.isFinite(a) ? { hex: rgbHex(r, g, b), alpha: alpha01(a) } : null;
|
|
1507
|
+
}
|
|
1508
|
+
function canonColor(raw, dialect, site, options = {}) {
|
|
1509
|
+
if (raw !== null && typeof raw === "object") {
|
|
1510
|
+
return objectColor(raw, dialect, site);
|
|
1511
|
+
}
|
|
1512
|
+
if (typeof raw === "number" && dialect === "java" && Number.isInteger(raw) && Math.abs(raw) <= 4294967295) {
|
|
1513
|
+
spendAt(site, 1);
|
|
1514
|
+
const v2 = raw >>> 0;
|
|
1515
|
+
return { color: rgbHex(v2 >>> 16 & 255, v2 >>> 8 & 255, v2 & 255), alpha: 1 };
|
|
1516
|
+
}
|
|
1517
|
+
const text = scalarText(raw, site);
|
|
1518
|
+
if (text === null) {
|
|
1519
|
+
return null;
|
|
1520
|
+
}
|
|
1521
|
+
if (dialect === "graphviz" || dialect === "x11") {
|
|
1522
|
+
return graphvizCanon(text, dialect === "x11" ? "x11" : "graphviz", site, options);
|
|
1523
|
+
}
|
|
1524
|
+
const c = textColor(text.trim(), dialect);
|
|
1525
|
+
if (c === null) {
|
|
1526
|
+
noteAt(site, STYLE_ISSUE.BAD_VALUE, text);
|
|
1527
|
+
return null;
|
|
1528
|
+
}
|
|
1529
|
+
return { color: c.hex, alpha: c.alpha };
|
|
1530
|
+
}
|
|
1531
|
+
function objectColor(raw, dialect, site) {
|
|
1532
|
+
spendAt(site, 1);
|
|
1533
|
+
const c = dialect === "gexf" || dialect === "gephi" ? channels(raw) : null;
|
|
1534
|
+
if (c === null) {
|
|
1535
|
+
noteAt(site, STYLE_ISSUE.BAD_VALUE, raw);
|
|
1536
|
+
return null;
|
|
1537
|
+
}
|
|
1538
|
+
return { color: c.hex, alpha: c.alpha };
|
|
1539
|
+
}
|
|
1540
|
+
function graphvizCanon(text, dialect, site, options) {
|
|
1541
|
+
const g = graphvizColor(text, dialect === "x11" ? null : options.scheme ?? null, options.use ?? "line");
|
|
1542
|
+
if (g.unknown) {
|
|
1543
|
+
noteAt(site, STYLE_ISSUE.BAD_VALUE, text);
|
|
1544
|
+
if (dialect === "x11") {
|
|
1545
|
+
return null;
|
|
1546
|
+
}
|
|
1547
|
+
}
|
|
1548
|
+
if (g.list !== null) {
|
|
1549
|
+
noteAt(site, g.list === "gradient" ? STYLE_ISSUE.GRADIENT : STYLE_ISSUE.COLOR_LIST, text);
|
|
1550
|
+
}
|
|
1551
|
+
return { color: g.hex, alpha: alpha01(g.alpha) };
|
|
1552
|
+
}
|
|
1553
|
+
function textColor(trimmed, dialect) {
|
|
1554
|
+
const lower = trimmed.toLowerCase();
|
|
1555
|
+
switch (dialect) {
|
|
1556
|
+
case "dvips":
|
|
1557
|
+
return pajekColor(trimmed);
|
|
1558
|
+
case "yfiles3":
|
|
1559
|
+
return hexColor(trimmed, true) ?? cssColor(lower.replaceAll("_", ""));
|
|
1560
|
+
case "java":
|
|
1561
|
+
case "gephi":
|
|
1562
|
+
case "cytoscape": {
|
|
1563
|
+
const java = JAVA_COLORS.get(lower);
|
|
1564
|
+
return java === void 0 ? cssColor(trimmed) : { hex: java, alpha: 1 };
|
|
1565
|
+
}
|
|
1566
|
+
default:
|
|
1567
|
+
return cssColor(trimmed);
|
|
1568
|
+
}
|
|
1569
|
+
}
|
|
1570
|
+
function colorOpacity(color, stated, site, carried) {
|
|
1571
|
+
if (!carried) {
|
|
1572
|
+
if (color.alpha < 1) {
|
|
1573
|
+
noteAt(site, STYLE_ISSUE.ALPHA_DROPPED, color.color);
|
|
1574
|
+
}
|
|
1575
|
+
return stated;
|
|
1576
|
+
}
|
|
1577
|
+
if (color.alpha === 1) {
|
|
1578
|
+
return stated;
|
|
1579
|
+
}
|
|
1580
|
+
return num6$1((stated ?? 1) * color.alpha);
|
|
1581
|
+
}
|
|
1582
|
+
function v(value, source) {
|
|
1583
|
+
return { value, source };
|
|
1584
|
+
}
|
|
1585
|
+
const CY = "cytoscape-impl vizmap-gui-impl default_vizmap.xml, style default, line";
|
|
1586
|
+
const CYL = "cytoscape-api BasicVisualLexicon.java line";
|
|
1587
|
+
const CYJS = "cytoscape.js 3.34.3 dist/cytoscape.cjs.js line";
|
|
1588
|
+
const GV = "graphviz.org/docs/attrs";
|
|
1589
|
+
const YED_QA = "yEd Q&A, How can I change the default nodes and/or default edges";
|
|
1590
|
+
const YED_CORPUS = "yEd GraphML corpus, most frequent value";
|
|
1591
|
+
const YED_EDGE = "yFiles for Java 2.19 EdgeRealizer API docs";
|
|
1592
|
+
const Y3 = "yFiles for HTML API docs,";
|
|
1593
|
+
const GEPHI = "gephi master 92e503df61a7";
|
|
1594
|
+
const VIS = "vis-network 10.1.2 vis-network.esm.js";
|
|
1595
|
+
const SIGMA = "sigma 3.0.3 packages/sigma/src";
|
|
1596
|
+
const PAJEK = "Pajek 6.02 reference manual";
|
|
1597
|
+
const OGDF = "ogdf master 1a40505ac006";
|
|
1598
|
+
const NX = "networkx 6da4704cbf32 networkx/drawing/nx_pylab.py line";
|
|
1599
|
+
const TOOL_DEFAULTS = new Map(
|
|
1600
|
+
[
|
|
1601
|
+
{
|
|
1602
|
+
tool: "cytoscape",
|
|
1603
|
+
version: "cytoscape-impl develop 6c63e97c5152 (3.11)",
|
|
1604
|
+
units: "px",
|
|
1605
|
+
node: {
|
|
1606
|
+
fill: v("#89d0f5", `${CY} 382`),
|
|
1607
|
+
fillOpacity: v(1, `${CY} 383`),
|
|
1608
|
+
shape: v("round-rectangle", `${CY} 367`),
|
|
1609
|
+
width: v(75, `${CY} 384`),
|
|
1610
|
+
height: v(35, `${CY} 358`),
|
|
1611
|
+
borderColor: v("#cccccc", `${CY} 392`),
|
|
1612
|
+
borderWidth: v(0, `${CY} 350`),
|
|
1613
|
+
borderStyle: v("solid", `${CY} 366`),
|
|
1614
|
+
labelColor: v("#000000", `${CY} 395`),
|
|
1615
|
+
labelFont: v("sans-serif", `${CY} 370`),
|
|
1616
|
+
labelWeight: v("normal", `${CY} 370`),
|
|
1617
|
+
labelItalic: v(false, `${CY} 370`),
|
|
1618
|
+
labelSize: v(12, `${CY} 371`),
|
|
1619
|
+
labelPosition: v("center", `${CY} 380`)
|
|
1620
|
+
},
|
|
1621
|
+
edge: {
|
|
1622
|
+
color: v("#848484", `${CY} 431`),
|
|
1623
|
+
width: v(2, `${CY} 417`),
|
|
1624
|
+
lineStyle: v("solid", `${CY} 438`),
|
|
1625
|
+
opacity: v(1, `${CY} 423`),
|
|
1626
|
+
sourceArrow: v("none", `${CY} 437`),
|
|
1627
|
+
targetArrow: v("none", `${CY} 428`),
|
|
1628
|
+
sourceArrowColor: v("#000000", `${CY} 432`),
|
|
1629
|
+
targetArrowColor: v("#000000", `${CY} 432`),
|
|
1630
|
+
labelColor: v("#000000", `${CY} 415`),
|
|
1631
|
+
labelFont: v("sans-serif", `${CY} 439`),
|
|
1632
|
+
labelWeight: v("normal", `${CY} 439`),
|
|
1633
|
+
labelItalic: v(false, `${CY} 439`),
|
|
1634
|
+
labelSize: v(10, `${CY} 439`),
|
|
1635
|
+
// EDGE_CURVED is true there, but it only rounds an edge's bends: an edge without bends is straight
|
|
1636
|
+
curved: v(false, `${CY} 422`)
|
|
1637
|
+
},
|
|
1638
|
+
graph: { background: v("#ffffff", `${CY} 335`) },
|
|
1639
|
+
derived: [{ kind: "labelFromColumn", column: "name", source: `${CY} 406-408` }]
|
|
1640
|
+
},
|
|
1641
|
+
{
|
|
1642
|
+
tool: "cytoscape-fallbacks",
|
|
1643
|
+
version: "cytoscape-api develop (3.11)",
|
|
1644
|
+
units: "px",
|
|
1645
|
+
node: {
|
|
1646
|
+
fill: v("#c80000", `${CYL} 83`),
|
|
1647
|
+
fillOpacity: v(1, `${CYL} 273`),
|
|
1648
|
+
shape: v("ellipse", `${CYL} 302-303`),
|
|
1649
|
+
width: v(60, `${CYL} 155`),
|
|
1650
|
+
height: v(40, `${CYL} 163`),
|
|
1651
|
+
borderColor: v("#000000", `${CYL} 230`),
|
|
1652
|
+
borderWidth: v(2, `${CYL} 54`),
|
|
1653
|
+
labelColor: v("#000000", `${CYL} 91`),
|
|
1654
|
+
labelFont: v("sans-serif", `${CYL} 255`),
|
|
1655
|
+
labelWeight: v("normal", `${CYL} 255`),
|
|
1656
|
+
labelItalic: v(false, `${CYL} 255`),
|
|
1657
|
+
labelSize: v(12, `${CYL} 55`),
|
|
1658
|
+
labelPosition: v("center", `${CYL} 205`)
|
|
1659
|
+
},
|
|
1660
|
+
edge: {
|
|
1661
|
+
color: v("#404040", `${CYL} 469`),
|
|
1662
|
+
width: v(1, `${CYL} 368`),
|
|
1663
|
+
lineStyle: v("solid", `${CYL} 392`),
|
|
1664
|
+
sourceArrow: v("none", `${CYL} 487`),
|
|
1665
|
+
targetArrow: v("none", `${CYL} 493`),
|
|
1666
|
+
labelColor: v("#000000", `${CYL} 327`),
|
|
1667
|
+
labelFont: v("sans-serif", `${CYL} 408`),
|
|
1668
|
+
labelWeight: v("normal", `${CYL} 408`),
|
|
1669
|
+
labelItalic: v(false, `${CYL} 408`),
|
|
1670
|
+
labelSize: v(10, `${CYL} 416`)
|
|
1671
|
+
},
|
|
1672
|
+
graph: { background: v("#ffffff", `${CYL} 667`) },
|
|
1673
|
+
derived: []
|
|
1674
|
+
},
|
|
1675
|
+
{
|
|
1676
|
+
tool: "cytoscape-js",
|
|
1677
|
+
version: "cytoscape.js 3.34.3",
|
|
1678
|
+
units: "px",
|
|
1679
|
+
node: {
|
|
1680
|
+
fill: v("#999999", `${CYJS} 18536`),
|
|
1681
|
+
fillOpacity: v(1, `${CYJS} 18538`),
|
|
1682
|
+
shape: v("ellipse", `${CYJS} 18571`),
|
|
1683
|
+
width: v(30, `${CYJS} 18569`),
|
|
1684
|
+
height: v(30, `${CYJS} 18570`),
|
|
1685
|
+
borderColor: v("#000000", `${CYJS} 18555`),
|
|
1686
|
+
borderWidth: v(0, `${CYJS} 18557`),
|
|
1687
|
+
borderStyle: v("solid", `${CYJS} 18558`),
|
|
1688
|
+
opacity: v(1, `${CYJS} 18503`),
|
|
1689
|
+
labelColor: v("#000000", `${CYJS} 18474`),
|
|
1690
|
+
labelSize: v(16, `${CYJS} 18496`),
|
|
1691
|
+
labelFont: v("Helvetica Neue, Helvetica, sans-serif", `${CYJS} 18493`),
|
|
1692
|
+
labelWeight: v("normal", `${CYJS} 18495`),
|
|
1693
|
+
labelPosition: v("top", `${CYJS} 18470-18471`)
|
|
1694
|
+
},
|
|
1695
|
+
edge: {
|
|
1696
|
+
color: v("#999999", `${CYJS} 18639`),
|
|
1697
|
+
sourceArrowColor: v("#999999", `${CYJS} 18639`),
|
|
1698
|
+
targetArrowColor: v("#999999", `${CYJS} 18639`),
|
|
1699
|
+
width: v(3, `${CYJS} 18711`),
|
|
1700
|
+
lineStyle: v("solid", `${CYJS} 18638`),
|
|
1701
|
+
opacity: v(1, `${CYJS} 18503`),
|
|
1702
|
+
sourceArrow: v("none", `${CYJS} 18670`),
|
|
1703
|
+
targetArrow: v("none", `${CYJS} 18671`),
|
|
1704
|
+
arrowSize: v(1, `${CYJS} 18660`),
|
|
1705
|
+
curved: v(false, `${CYJS} 18658`),
|
|
1706
|
+
labelColor: v("#000000", `${CYJS} 18474`),
|
|
1707
|
+
labelSize: v(16, `${CYJS} 18496`),
|
|
1708
|
+
labelFont: v("Helvetica Neue, Helvetica, sans-serif", `${CYJS} 18493`),
|
|
1709
|
+
labelWeight: v("normal", `${CYJS} 18495`)
|
|
1710
|
+
},
|
|
1711
|
+
graph: {},
|
|
1712
|
+
derived: []
|
|
1713
|
+
},
|
|
1714
|
+
{
|
|
1715
|
+
tool: "graphviz",
|
|
1716
|
+
version: "graphviz main (16.1.0)",
|
|
1717
|
+
units: "px",
|
|
1718
|
+
node: {
|
|
1719
|
+
fillOpacity: v(0, `${GV}/style/ (default "", not filled)`),
|
|
1720
|
+
borderColor: v("#000000", `${GV}/color/`),
|
|
1721
|
+
borderWidth: v(1, `${GV}/penwidth/; lib/common/const.h line 77`),
|
|
1722
|
+
shape: v("ellipse", `${GV}/shape/; lib/common/const.h line 76`),
|
|
1723
|
+
width: v(54, `${GV}/width/ (0.75 inch); lib/common/const.h line 72`),
|
|
1724
|
+
height: v(36, `${GV}/height/ (0.5 inch); lib/common/const.h line 73`),
|
|
1725
|
+
labelColor: v("#000000", `${GV}/fontcolor/`),
|
|
1726
|
+
labelSize: v(14, `${GV}/fontsize/; lib/common/const.h line 61`),
|
|
1727
|
+
labelFont: v("Times-Roman", `${GV}/fontname/; lib/common/const.h line 67`),
|
|
1728
|
+
labelPosition: v("center", `${GV}/labelloc/`)
|
|
1729
|
+
},
|
|
1730
|
+
edge: {
|
|
1731
|
+
color: v("#000000", `${GV}/color/`),
|
|
1732
|
+
width: v(1, `${GV}/penwidth/`),
|
|
1733
|
+
lineStyle: v("solid", `${GV}/style/`),
|
|
1734
|
+
sourceArrow: v("none", `${GV}/dir/`),
|
|
1735
|
+
targetArrow: v("none", `${GV}/dir/ (none in a graph)`),
|
|
1736
|
+
arrowSize: v(1, `${GV}/arrowsize/`),
|
|
1737
|
+
labelColor: v("#000000", `${GV}/fontcolor/`),
|
|
1738
|
+
labelSize: v(14, `${GV}/fontsize/`),
|
|
1739
|
+
labelFont: v("Times-Roman", `${GV}/fontname/`)
|
|
1740
|
+
},
|
|
1741
|
+
graph: {},
|
|
1742
|
+
derived: [
|
|
1743
|
+
{ kind: "labelFromId", source: String.raw`${GV}/label/ (default \N, the node name)` },
|
|
1744
|
+
{
|
|
1745
|
+
kind: "targetArrowOnDirected",
|
|
1746
|
+
arrow: "triangle",
|
|
1747
|
+
source: `${GV}/dir/ (forward in a digraph); ${GV}/arrowhead/ (normal)`
|
|
1748
|
+
}
|
|
1749
|
+
]
|
|
1750
|
+
},
|
|
1751
|
+
{
|
|
1752
|
+
tool: "yed",
|
|
1753
|
+
version: "yEd / yFiles for Java 2.19",
|
|
1754
|
+
units: "px",
|
|
1755
|
+
node: {
|
|
1756
|
+
fill: v("#ffcc00", `${YED_QA}; ${YED_CORPUS} of y:Fill color`),
|
|
1757
|
+
shape: v("rectangle", "yFiles for Java 2.19 ShapeNodeRealizer API docs"),
|
|
1758
|
+
borderColor: v("#000000", `${YED_CORPUS} of y:BorderStyle`),
|
|
1759
|
+
borderWidth: v(1, `${YED_CORPUS} of y:BorderStyle`),
|
|
1760
|
+
borderStyle: v("solid", `${YED_CORPUS} of y:BorderStyle`),
|
|
1761
|
+
labelColor: v("#000000", `${YED_CORPUS} of y:NodeLabel`),
|
|
1762
|
+
labelFont: v("Dialog", `${YED_CORPUS} of y:NodeLabel`),
|
|
1763
|
+
labelSize: v(12, `${YED_CORPUS} of y:NodeLabel`),
|
|
1764
|
+
labelWeight: v("normal", `${YED_CORPUS} of y:NodeLabel`),
|
|
1765
|
+
labelPosition: v("center", `${YED_CORPUS} of y:NodeLabel`)
|
|
1766
|
+
},
|
|
1767
|
+
edge: {
|
|
1768
|
+
color: v("#000000", `${YED_EDGE} (line color defaults to Color.black)`),
|
|
1769
|
+
width: v(1, `${YED_EDGE} (line type defaults to LineType.LINE_1)`),
|
|
1770
|
+
lineStyle: v("solid", `${YED_EDGE} (line type defaults to LineType.LINE_1)`),
|
|
1771
|
+
sourceArrow: v("none", `${YED_EDGE} (defaults to Arrow.NONE)`),
|
|
1772
|
+
targetArrow: v("none", `${YED_EDGE} (defaults to Arrow.NONE)`),
|
|
1773
|
+
labelColor: v("#000000", `${YED_CORPUS} of y:EdgeLabel`),
|
|
1774
|
+
labelFont: v("Dialog", `${YED_CORPUS} of y:EdgeLabel`),
|
|
1775
|
+
labelSize: v(12, `${YED_CORPUS} of y:EdgeLabel`)
|
|
1776
|
+
},
|
|
1777
|
+
graph: {},
|
|
1778
|
+
derived: []
|
|
1779
|
+
},
|
|
1780
|
+
{
|
|
1781
|
+
tool: "yfiles3",
|
|
1782
|
+
version: "yFiles for HTML (API docs retrieved 2026-10-11)",
|
|
1783
|
+
units: "px",
|
|
1784
|
+
node: {
|
|
1785
|
+
fill: v("#ffffff", `${Y3} ShapeNodeStyle fill`),
|
|
1786
|
+
borderColor: v("#000000", `${Y3} ShapeNodeStyle stroke`),
|
|
1787
|
+
borderWidth: v(1, `${Y3} ShapeNodeStyle stroke`),
|
|
1788
|
+
shape: v("rectangle", `${Y3} ShapeNodeStyle shape`),
|
|
1789
|
+
labelColor: v("#000000", `${Y3} LabelStyle textFill`),
|
|
1790
|
+
labelFont: v("Arial", `${Y3} LabelStyle font`),
|
|
1791
|
+
labelSize: v(12, `${Y3} LabelStyle font`)
|
|
1792
|
+
},
|
|
1793
|
+
edge: {
|
|
1794
|
+
color: v("#000000", `${Y3} PolylineEdgeStyle stroke`),
|
|
1795
|
+
width: v(1, `${Y3} PolylineEdgeStyle stroke`),
|
|
1796
|
+
sourceArrow: v("none", `${Y3} PolylineEdgeStyle sourceArrow`),
|
|
1797
|
+
targetArrow: v("none", `${Y3} PolylineEdgeStyle targetArrow`),
|
|
1798
|
+
labelColor: v("#000000", `${Y3} LabelStyle textFill`),
|
|
1799
|
+
labelFont: v("Arial", `${Y3} LabelStyle font`),
|
|
1800
|
+
labelSize: v(12, `${Y3} LabelStyle font`)
|
|
1801
|
+
},
|
|
1802
|
+
graph: {},
|
|
1803
|
+
derived: []
|
|
1804
|
+
},
|
|
1805
|
+
{
|
|
1806
|
+
tool: "gephi",
|
|
1807
|
+
version: "gephi 0.11.4-SNAPSHOT",
|
|
1808
|
+
units: "relative",
|
|
1809
|
+
node: {
|
|
1810
|
+
fill: v("#000000", "gephi/graphstore a4c790b2343e NodeImpl.java line 322"),
|
|
1811
|
+
width: v(10, `${GEPHI} AbstractProcessor.java lines 195-198`),
|
|
1812
|
+
height: v(10, `${GEPHI} AbstractProcessor.java lines 195-198`),
|
|
1813
|
+
shape: v("ellipse", "GEXF 1.3 viz shape default disc; Preview NodeRenderer"),
|
|
1814
|
+
labelPosition: v(
|
|
1815
|
+
"center",
|
|
1816
|
+
`${GEPHI} NodeLabelRenderer.java (a label is drawn centered on its node)`
|
|
1817
|
+
)
|
|
1818
|
+
},
|
|
1819
|
+
edge: {
|
|
1820
|
+
sourceArrow: v("none", `${GEPHI} DefaultPreset.java line 62`),
|
|
1821
|
+
targetArrow: v("none", `${GEPHI} DefaultPreset.java line 62`)
|
|
1822
|
+
},
|
|
1823
|
+
graph: { background: v("#ffffff", `${GEPHI} VizConfig.java line 111`) },
|
|
1824
|
+
derived: [
|
|
1825
|
+
{
|
|
1826
|
+
kind: "colorFromSourceNode",
|
|
1827
|
+
source: `${GEPHI} VizConfig.java line 119 (EdgeColorMode.SOURCE)`
|
|
1828
|
+
},
|
|
1829
|
+
{
|
|
1830
|
+
kind: "widthFromWeight",
|
|
1831
|
+
source: `${GEPHI} VizConfig.java lines 136, 144-145; DefaultPreset.java lines 67, 73`
|
|
1832
|
+
},
|
|
1833
|
+
{
|
|
1834
|
+
kind: "targetArrowOnDirected",
|
|
1835
|
+
arrow: "triangle",
|
|
1836
|
+
source: `${GEPHI} DefaultPreset.java line 62`
|
|
1837
|
+
}
|
|
1838
|
+
]
|
|
1839
|
+
},
|
|
1840
|
+
{
|
|
1841
|
+
tool: "vis-network",
|
|
1842
|
+
version: "vis-network 10.1.2",
|
|
1843
|
+
units: "px",
|
|
1844
|
+
node: {
|
|
1845
|
+
fill: v("#97c2fc", `${VIS} lines 32986-33110`),
|
|
1846
|
+
borderColor: v("#2b7ce9", `${VIS} lines 32986-33110`),
|
|
1847
|
+
borderWidth: v(1, `${VIS} lines 32986-33110`),
|
|
1848
|
+
shape: v("ellipse", `${VIS} lines 32986-33110`),
|
|
1849
|
+
labelColor: v("#343434", `${VIS} lines 32986-33110`),
|
|
1850
|
+
labelSize: v(14, `${VIS} lines 32986-33110`),
|
|
1851
|
+
labelFont: v("arial", `${VIS} lines 32986-33110`),
|
|
1852
|
+
labelPosition: v("center", `${VIS} lines 32986-33110`)
|
|
1853
|
+
},
|
|
1854
|
+
edge: {
|
|
1855
|
+
width: v(1, `${VIS} lines 25160-25290`),
|
|
1856
|
+
lineStyle: v("solid", `${VIS} lines 25160-25290 (dashes false)`),
|
|
1857
|
+
sourceArrow: v("none", `${VIS} lines 25160-25290`),
|
|
1858
|
+
targetArrow: v("none", `${VIS} lines 25160-25290`),
|
|
1859
|
+
labelColor: v("#343434", `${VIS} lines 25160-25290`),
|
|
1860
|
+
labelSize: v(14, `${VIS} lines 25160-25290`),
|
|
1861
|
+
labelFont: v("arial", `${VIS} lines 25160-25290`)
|
|
1862
|
+
},
|
|
1863
|
+
graph: {},
|
|
1864
|
+
derived: [
|
|
1865
|
+
{ kind: "labelFromColumn", column: "label", source: `${VIS} lines 32986-33110` },
|
|
1866
|
+
{ kind: "colorFromSourceNode", source: `${VIS} lines 25160-25290 (color.inherit "from")` }
|
|
1867
|
+
]
|
|
1868
|
+
},
|
|
1869
|
+
{
|
|
1870
|
+
tool: "sigma",
|
|
1871
|
+
version: "sigma 3.0.3",
|
|
1872
|
+
units: "relative",
|
|
1873
|
+
node: {
|
|
1874
|
+
fill: v("#999999", `${SIGMA}/settings.ts lines 119-126`),
|
|
1875
|
+
shape: v("ellipse", `${SIGMA}/settings.ts lines 119-126`),
|
|
1876
|
+
width: v(2, `${SIGMA}/sigma.ts line 76`),
|
|
1877
|
+
height: v(2, `${SIGMA}/sigma.ts line 76`),
|
|
1878
|
+
labelColor: v("#000000", `${SIGMA}/settings.ts lines 119-126`),
|
|
1879
|
+
labelFont: v("Arial", `${SIGMA}/settings.ts lines 119-126`),
|
|
1880
|
+
labelSize: v(14, `${SIGMA}/settings.ts lines 119-126`),
|
|
1881
|
+
labelWeight: v("normal", `${SIGMA}/settings.ts lines 119-126`)
|
|
1882
|
+
},
|
|
1883
|
+
edge: {
|
|
1884
|
+
color: v("#cccccc", `${SIGMA}/settings.ts lines 119-126`),
|
|
1885
|
+
width: v(0.5, `${SIGMA}/sigma.ts line 100`),
|
|
1886
|
+
sourceArrow: v("none", `${SIGMA}/settings.ts lines 119-126 (type line)`),
|
|
1887
|
+
targetArrow: v("none", `${SIGMA}/settings.ts lines 119-126 (type line)`)
|
|
1888
|
+
},
|
|
1889
|
+
graph: {},
|
|
1890
|
+
derived: [{ kind: "labelFromColumn", column: "label", source: `${SIGMA}/settings.ts lines 119-126` }]
|
|
1891
|
+
},
|
|
1892
|
+
{
|
|
1893
|
+
tool: "pajek",
|
|
1894
|
+
version: "Pajek 6.02",
|
|
1895
|
+
units: "relative",
|
|
1896
|
+
node: {
|
|
1897
|
+
shape: v("ellipse", `${PAJEK} p. 85`),
|
|
1898
|
+
opacity: v(1, `${PAJEK} p. 87`),
|
|
1899
|
+
borderColor: v("#000000", `${PAJEK}, vertex parameter bc (default Black)`),
|
|
1900
|
+
borderWidth: v(0.2, `${PAJEK}, vertex parameter bw (default 1, against the default vertex size 5)`)
|
|
1901
|
+
},
|
|
1902
|
+
edge: {
|
|
1903
|
+
color: v("#000000", `${PAJEK} p. 90`),
|
|
1904
|
+
lineStyle: v("solid", `${PAJEK} p. 90`),
|
|
1905
|
+
opacity: v(1, `${PAJEK} p. 87`),
|
|
1906
|
+
sourceArrow: v("none", `${PAJEK} p. 91`),
|
|
1907
|
+
targetArrow: v("none", `${PAJEK} p. 91 (edges have none)`)
|
|
1908
|
+
},
|
|
1909
|
+
graph: {},
|
|
1910
|
+
derived: [
|
|
1911
|
+
{ kind: "labelFromColumn", column: "label", source: `${PAJEK}, vertex labels (drawn by default)` },
|
|
1912
|
+
{ kind: "targetArrowOnDirected", arrow: "triangle", source: `${PAJEK} p. 91 (arcs)` }
|
|
1913
|
+
]
|
|
1914
|
+
},
|
|
1915
|
+
{
|
|
1916
|
+
tool: "ogdf",
|
|
1917
|
+
version: "ogdf master 1a40505ac006",
|
|
1918
|
+
units: "px",
|
|
1919
|
+
node: {
|
|
1920
|
+
fill: v("#ffffff", `${OGDF} LayoutStandards.cpp lines 38-45`),
|
|
1921
|
+
shape: v("rectangle", `${OGDF} LayoutStandards.cpp lines 38-45`),
|
|
1922
|
+
width: v(20, `${OGDF} LayoutStandards.cpp lines 38-45`),
|
|
1923
|
+
height: v(20, `${OGDF} LayoutStandards.cpp lines 38-45`),
|
|
1924
|
+
borderColor: v("#000000", `${OGDF} LayoutStandards.cpp lines 38-45`),
|
|
1925
|
+
borderWidth: v(1, `${OGDF} LayoutStandards.cpp lines 38-45`),
|
|
1926
|
+
borderStyle: v("solid", `${OGDF} LayoutStandards.cpp lines 38-45`)
|
|
1927
|
+
},
|
|
1928
|
+
edge: {
|
|
1929
|
+
color: v("#000000", `${OGDF} LayoutStandards.cpp lines 38-45`),
|
|
1930
|
+
width: v(1, `${OGDF} LayoutStandards.cpp lines 38-45`),
|
|
1931
|
+
lineStyle: v("solid", `${OGDF} LayoutStandards.cpp lines 38-45`)
|
|
1932
|
+
},
|
|
1933
|
+
graph: {},
|
|
1934
|
+
derived: []
|
|
1935
|
+
},
|
|
1936
|
+
{
|
|
1937
|
+
tool: "networkx",
|
|
1938
|
+
version: "networkx 3.7 (main 6da4704cbf32)",
|
|
1939
|
+
units: "px",
|
|
1940
|
+
node: {
|
|
1941
|
+
fill: v("#1f78b4", `${NX} 1378`),
|
|
1942
|
+
fillOpacity: v(1, `${NX} 549`),
|
|
1943
|
+
shape: v("ellipse", `${NX} 1379 (node_shape "o")`),
|
|
1944
|
+
// node_size 300 is a marker area in points squared (matplotlib scatter): diameter sqrt(300)
|
|
1945
|
+
width: v(17.3205, `${NX} 1377 (node_size 300, points squared)`),
|
|
1946
|
+
height: v(17.3205, `${NX} 1377 (node_size 300, points squared)`),
|
|
1947
|
+
labelColor: v("#000000", `${NX} 2143`),
|
|
1948
|
+
labelSize: v(12, `${NX} 2142`),
|
|
1949
|
+
labelFont: v("sans-serif", `${NX} 2144`),
|
|
1950
|
+
labelWeight: v("normal", `${NX} 2145`),
|
|
1951
|
+
labelPosition: v("center", `${NX} 2148-2149`)
|
|
1952
|
+
},
|
|
1953
|
+
edge: {
|
|
1954
|
+
color: v("#000000", `${NX} 1768 (edge_color "k")`),
|
|
1955
|
+
width: v(1, `${NX} 1767`),
|
|
1956
|
+
lineStyle: v("solid", `${NX} 1769`),
|
|
1957
|
+
opacity: v(1, `${NX} 568`),
|
|
1958
|
+
sourceArrow: v("none", `${NX} 1848-1849`),
|
|
1959
|
+
targetArrow: v("none", `${NX} 1849 (undirected graphs draw "-")`),
|
|
1960
|
+
labelColor: v("#000000", `${NX} 557`),
|
|
1961
|
+
labelSize: v(12, `${NX} 556`),
|
|
1962
|
+
labelFont: v("sans-serif", `${NX} 558`),
|
|
1963
|
+
labelWeight: v("normal", `${NX} 559`)
|
|
1964
|
+
},
|
|
1965
|
+
graph: {},
|
|
1966
|
+
derived: [
|
|
1967
|
+
{
|
|
1968
|
+
kind: "targetArrowOnDirected",
|
|
1969
|
+
arrow: "triangle",
|
|
1970
|
+
source: `${NX} 1848 (arrowstyle "-|>" for directed graphs)`
|
|
1971
|
+
}
|
|
1972
|
+
]
|
|
1973
|
+
}
|
|
1974
|
+
].map((d) => [d.tool, d])
|
|
1975
|
+
);
|
|
1976
|
+
function toolDefaults(tool) {
|
|
1977
|
+
return TOOL_DEFAULTS.get(tool) ?? null;
|
|
1978
|
+
}
|
|
1979
|
+
const SCALAR_DTYPES = /* @__PURE__ */ new Set(["string", "dict", "bool", "i32", "u32", "u8", "f32", "f64"]);
|
|
1980
|
+
const COORDINATE = /^(?:x|y|z|_pos)$/i;
|
|
1981
|
+
const PARENT_COLUMN = "graphty.parent";
|
|
1982
|
+
const MIN_INDEX = 8;
|
|
1983
|
+
function featuresOf(snapshot, target) {
|
|
1984
|
+
const table2 = target === "node" ? snapshot.nodes : snapshot.edges;
|
|
1985
|
+
const n = target === "node" ? snapshot.nodeCount : snapshot.edgeCount;
|
|
1986
|
+
const out = [];
|
|
1987
|
+
for (const name2 of table2.names().filter((c) => isFeatureColumn(table2, c))) {
|
|
1988
|
+
const values2 = Array.from({ length: n }, (_, i) => {
|
|
1989
|
+
const v2 = dataCell(table2, name2, i);
|
|
1990
|
+
return typeof v2 === "string" || typeof v2 === "number" || typeof v2 === "boolean" ? v2 : null;
|
|
1991
|
+
});
|
|
1992
|
+
if (name2 !== PARENT_COLUMN) {
|
|
1993
|
+
out.push({ ref: { data: name2 }, values: values2 });
|
|
1994
|
+
} else if (target === "node") {
|
|
1995
|
+
const group = values2.map(
|
|
1996
|
+
(v2) => typeof v2 === "number" && v2 >= 0 && v2 < snapshot.nodeCount ? String(snapshot.ids.idOf(v2)) : null
|
|
1997
|
+
);
|
|
1998
|
+
out.push({ ref: { style: "group" }, values: group });
|
|
1999
|
+
}
|
|
2000
|
+
}
|
|
2001
|
+
if (target === "node" && n > 0) {
|
|
2002
|
+
const kinds = snapshot.directed ? ["degree", "indegree", "outdegree"] : ["degree"];
|
|
2003
|
+
for (const k of kinds) {
|
|
2004
|
+
out.push({ ref: { computed: k }, values: degreeValues(snapshot, k) });
|
|
2005
|
+
}
|
|
2006
|
+
}
|
|
2007
|
+
return out;
|
|
2008
|
+
}
|
|
2009
|
+
function isFeatureColumn(table2, name2) {
|
|
2010
|
+
if (name2.startsWith("graphty.") && name2 !== PARENT_COLUMN || name2 === "selected" || COORDINATE.test(name2)) {
|
|
2011
|
+
return false;
|
|
2012
|
+
}
|
|
2013
|
+
const col = table2.get(name2);
|
|
2014
|
+
return col !== null && col.meta.role !== "position" && SCALAR_DTYPES.has(col.meta.dtype) && col.meta.components === 1;
|
|
2015
|
+
}
|
|
2016
|
+
function styleFingerprint(snapshot) {
|
|
2017
|
+
let h1 = 0;
|
|
2018
|
+
let h2 = 0;
|
|
2019
|
+
for (let i = 0; i < snapshot.nodeCount; i++) {
|
|
2020
|
+
const text = String(snapshot.ids.idOf(i));
|
|
2021
|
+
let a = 2166136261;
|
|
2022
|
+
let b = 16777619 ^ 1540483477;
|
|
2023
|
+
for (let c = 0; c < text.length; c++) {
|
|
2024
|
+
const code = text.charCodeAt(c);
|
|
2025
|
+
a = Math.imul(a ^ code, 16777619);
|
|
2026
|
+
b = Math.imul(b ^ code, 16777619) ^ b >>> 13;
|
|
2027
|
+
}
|
|
2028
|
+
h1 = h1 + (a >>> 0) >>> 0;
|
|
2029
|
+
h2 = h2 + (b >>> 0) >>> 0;
|
|
2030
|
+
}
|
|
2031
|
+
const hex = (h) => (h >>> 0).toString(16).padStart(8, "0");
|
|
2032
|
+
return {
|
|
2033
|
+
nodes: snapshot.nodeCount,
|
|
2034
|
+
edges: snapshot.edgeCount,
|
|
2035
|
+
heldEdges: heldEdgeRows(snapshot).length,
|
|
2036
|
+
ids: hex(h1) + hex(h2)
|
|
2037
|
+
};
|
|
2038
|
+
}
|
|
2039
|
+
function heldEdgeRows(snapshot) {
|
|
2040
|
+
const pair = snapshot.edges.byRole("pair");
|
|
2041
|
+
const rows = [];
|
|
2042
|
+
for (let e = 0; e < snapshot.edgeCount; e++) {
|
|
2043
|
+
if (!(pair?.isSet(e) === true && pair.value(e) < e)) {
|
|
2044
|
+
rows.push(e);
|
|
2045
|
+
}
|
|
2046
|
+
}
|
|
2047
|
+
return rows;
|
|
2048
|
+
}
|
|
2049
|
+
function valueStats(values2) {
|
|
2050
|
+
const seen = /* @__PURE__ */ new Set();
|
|
2051
|
+
let categorical = true;
|
|
2052
|
+
let numeric = true;
|
|
2053
|
+
let integers = true;
|
|
2054
|
+
let lo = Infinity;
|
|
2055
|
+
let hi = -Infinity;
|
|
2056
|
+
let count = 0;
|
|
2057
|
+
for (const v2 of values2) {
|
|
2058
|
+
if (v2 === null) {
|
|
2059
|
+
continue;
|
|
2060
|
+
}
|
|
2061
|
+
count++;
|
|
2062
|
+
seen.add(`${typeof v2}:${String(v2)}`);
|
|
2063
|
+
if (typeof v2 !== "number") {
|
|
2064
|
+
numeric = false;
|
|
2065
|
+
integers = false;
|
|
2066
|
+
} else if (Number.isFinite(v2)) {
|
|
2067
|
+
integers &&= Number.isInteger(v2);
|
|
2068
|
+
categorical &&= Number.isInteger(v2);
|
|
2069
|
+
lo = Math.min(lo, v2);
|
|
2070
|
+
hi = Math.max(hi, v2);
|
|
2071
|
+
} else {
|
|
2072
|
+
numeric = false;
|
|
2073
|
+
categorical = false;
|
|
2074
|
+
}
|
|
2075
|
+
}
|
|
2076
|
+
return { seen, categorical, numeric, integers, lo, hi, count };
|
|
2077
|
+
}
|
|
2078
|
+
function featureName(ref) {
|
|
2079
|
+
if ("style" in ref) {
|
|
2080
|
+
return ref.style;
|
|
2081
|
+
}
|
|
2082
|
+
if ("computed" in ref) {
|
|
2083
|
+
return ref.computed;
|
|
2084
|
+
}
|
|
2085
|
+
return ref.data;
|
|
2086
|
+
}
|
|
2087
|
+
function describeFeature(feature, raw) {
|
|
2088
|
+
const { seen, categorical, numeric, integers, lo, hi, count } = valueStats(feature.values);
|
|
2089
|
+
const computed = "computed" in feature.ref;
|
|
2090
|
+
const index = !computed && numeric && integers && count >= MIN_INDEX && seen.size === count && hi - lo + 1 === count;
|
|
2091
|
+
return {
|
|
2092
|
+
feature,
|
|
2093
|
+
name: featureName(feature.ref),
|
|
2094
|
+
distinct: seen.size,
|
|
2095
|
+
categorical: count > 0 && categorical,
|
|
2096
|
+
numeric: count > 0 && numeric && !index,
|
|
2097
|
+
raw
|
|
2098
|
+
};
|
|
2099
|
+
}
|
|
2100
|
+
const STYLE_BLOCK_NAME = "graphty.styles";
|
|
2101
|
+
const MAX_STYLE_BLOCK_LENGTH = 16 * 1024 * 1024;
|
|
2102
|
+
const MAX_DEPTH = 64;
|
|
2103
|
+
const MAX_RULES = 4096;
|
|
2104
|
+
const MAX_NAME = 256;
|
|
2105
|
+
const FORBIDDEN_KEYS = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
|
|
2106
|
+
const TARGETS = ["node", "edge"];
|
|
2107
|
+
const COMPUTED = /* @__PURE__ */ new Set(["degree", "indegree", "outdegree"]);
|
|
2108
|
+
function styleTag(target, key) {
|
|
2109
|
+
return `graphty.style.${target}.${key}`;
|
|
2110
|
+
}
|
|
2111
|
+
const SAFE_ESCAPES = {
|
|
2112
|
+
"\\": String.raw`\u005c`,
|
|
2113
|
+
n: String.raw`\u000a`,
|
|
2114
|
+
t: String.raw`\u0009`
|
|
2115
|
+
};
|
|
2116
|
+
function writeStyleBlock(extracted, options = {}) {
|
|
2117
|
+
const { styles, columns, fingerprint } = extracted;
|
|
2118
|
+
const out = {
|
|
2119
|
+
version: 1,
|
|
2120
|
+
source: styles.source,
|
|
2121
|
+
units: styles.units,
|
|
2122
|
+
graph: styles.graph,
|
|
2123
|
+
rules: styles.rules,
|
|
2124
|
+
columns: { node: Array.from(columns.node.keys()), edge: Array.from(columns.edge.keys()) }
|
|
2125
|
+
};
|
|
2126
|
+
const booleanKeys = (byKey) => Array.from(byKey).filter(([, col]) => col.some((x) => x !== null) && col.every((x) => x === null || typeof x === "boolean")).map(([key]) => key);
|
|
2127
|
+
const booleans = { node: booleanKeys(columns.node), edge: booleanKeys(columns.edge) };
|
|
2128
|
+
if (booleans.node.length > 0 || booleans.edge.length > 0) {
|
|
2129
|
+
out.booleans = booleans;
|
|
2130
|
+
}
|
|
2131
|
+
if (options.inlineColumns === true) {
|
|
2132
|
+
if (options.snapshot !== void 0) {
|
|
2133
|
+
const { ids, nodeCount } = options.snapshot;
|
|
2134
|
+
out.order = Array.from({ length: nodeCount }, (_unused, i) => String(ids.idOf(i)));
|
|
2135
|
+
}
|
|
2136
|
+
const held = options.snapshot === void 0 ? null : heldEdgeRows(options.snapshot);
|
|
2137
|
+
out.values = {
|
|
2138
|
+
node: Object.fromEntries(columns.node),
|
|
2139
|
+
edge: Object.fromEntries(
|
|
2140
|
+
Array.from(columns.edge, ([key, col]) => [key, held === null ? col : held.map((e) => col[e] ?? null)])
|
|
2141
|
+
)
|
|
2142
|
+
};
|
|
2143
|
+
}
|
|
2144
|
+
const { snapshot } = options;
|
|
2145
|
+
if (snapshot !== void 0) {
|
|
2146
|
+
const hashes = (target) => {
|
|
2147
|
+
const table2 = target === "node" ? snapshot.nodes : snapshot.edges;
|
|
2148
|
+
const n = target === "node" ? snapshot.nodeCount : snapshot.edgeCount;
|
|
2149
|
+
const read = dataNames(styles.rules.filter((r) => r.target === target)).filter((c) => table2.has(c) && !FORBIDDEN_KEYS.has(c) && c.length <= MAX_NAME).slice(0, MAX_RULES);
|
|
2150
|
+
return Object.fromEntries(read.map((c) => [c, columnHash(table2, c, n)]));
|
|
2151
|
+
};
|
|
2152
|
+
out.data = { node: hashes("node"), edge: hashes("edge") };
|
|
2153
|
+
}
|
|
2154
|
+
out.fingerprint = {
|
|
2155
|
+
nodes: fingerprint.nodes,
|
|
2156
|
+
edges: fingerprint.heldEdges ?? fingerprint.edges,
|
|
2157
|
+
ids: fingerprint.ids
|
|
2158
|
+
};
|
|
2159
|
+
return JSON.stringify(out).replaceAll(/\\(.)/g, (escape, c) => SAFE_ESCAPES[c] ?? escape);
|
|
2160
|
+
}
|
|
2161
|
+
function styleBlockLosses(text, rules, check = "all") {
|
|
2162
|
+
let reason = null;
|
|
2163
|
+
if (text.length > MAX_STYLE_BLOCK_LENGTH) {
|
|
2164
|
+
reason = "TOO_LARGE";
|
|
2165
|
+
} else if (check === "all") {
|
|
2166
|
+
const top = JSON.parse(text);
|
|
2167
|
+
const { nodes, edges, ids } = top.fingerprint;
|
|
2168
|
+
const parsed = parseStyleBlock(text, { nodes, edges, ids });
|
|
2169
|
+
reason = parsed.ok ? null : parsed.reason;
|
|
2170
|
+
}
|
|
2171
|
+
if (reason === null) {
|
|
2172
|
+
return [];
|
|
2173
|
+
}
|
|
2174
|
+
return [
|
|
2175
|
+
Object.freeze({
|
|
2176
|
+
code: STYLE_ISSUE.RULES_NOT_KEPT,
|
|
2177
|
+
message: `the ${STYLE_BLOCK_NAME} block would not read back (${reason}): the styles are written as the format's own, and importing the file infers the rules again`,
|
|
2178
|
+
column: null,
|
|
2179
|
+
count: rules
|
|
2180
|
+
})
|
|
2181
|
+
];
|
|
2182
|
+
}
|
|
2183
|
+
class Invalid extends Error {
|
|
2184
|
+
}
|
|
2185
|
+
function invalid() {
|
|
2186
|
+
throw new Invalid();
|
|
2187
|
+
}
|
|
2188
|
+
function parseStyleBlock(text, fingerprint) {
|
|
2189
|
+
if (typeof text !== "string") {
|
|
2190
|
+
return { ok: false, reason: "INVALID" };
|
|
2191
|
+
}
|
|
2192
|
+
if (text.length > MAX_STYLE_BLOCK_LENGTH) {
|
|
2193
|
+
return { ok: false, reason: "TOO_LARGE" };
|
|
2194
|
+
}
|
|
2195
|
+
let json;
|
|
2196
|
+
try {
|
|
2197
|
+
json = JSON.parse(text);
|
|
2198
|
+
} catch {
|
|
2199
|
+
return { ok: false, reason: "NOT_JSON" };
|
|
2200
|
+
}
|
|
2201
|
+
if (!safeTree(json)) {
|
|
2202
|
+
return { ok: false, reason: "INVALID" };
|
|
2203
|
+
}
|
|
2204
|
+
const top = isObject(json) ? json : null;
|
|
2205
|
+
if (top === null) {
|
|
2206
|
+
return { ok: false, reason: "INVALID" };
|
|
2207
|
+
}
|
|
2208
|
+
if (top.version !== 1) {
|
|
2209
|
+
return { ok: false, reason: "VERSION" };
|
|
2210
|
+
}
|
|
2211
|
+
const fp = isObject(top.fingerprint) ? top.fingerprint : null;
|
|
2212
|
+
if (fp !== null && (fp.nodes !== fingerprint.nodes || fp.edges !== (fingerprint.heldEdges ?? fingerprint.edges) || fp.ids !== fingerprint.ids)) {
|
|
2213
|
+
return { ok: false, reason: "FINGERPRINT" };
|
|
2214
|
+
}
|
|
2215
|
+
let block;
|
|
2216
|
+
try {
|
|
2217
|
+
block = readBlock(top);
|
|
2218
|
+
} catch (err) {
|
|
2219
|
+
if (err instanceof Invalid) {
|
|
2220
|
+
return { ok: false, reason: "INVALID" };
|
|
2221
|
+
}
|
|
2222
|
+
throw err;
|
|
2223
|
+
}
|
|
2224
|
+
const f = block.fingerprint;
|
|
2225
|
+
if (f.nodes !== fingerprint.nodes || f.edges !== (fingerprint.heldEdges ?? fingerprint.edges) || f.ids !== fingerprint.ids) {
|
|
2226
|
+
return { ok: false, reason: "FINGERPRINT" };
|
|
2227
|
+
}
|
|
2228
|
+
return { ok: true, block };
|
|
2229
|
+
}
|
|
2230
|
+
function safeTree(root) {
|
|
2231
|
+
const stack = [[root, 0]];
|
|
2232
|
+
while (stack.length > 0) {
|
|
2233
|
+
const [v2, depth] = stack.pop();
|
|
2234
|
+
if (v2 === null || typeof v2 !== "object") {
|
|
2235
|
+
continue;
|
|
2236
|
+
}
|
|
2237
|
+
if (depth >= MAX_DEPTH || !Array.isArray(v2) && Object.keys(v2).some((key) => FORBIDDEN_KEYS.has(key))) {
|
|
2238
|
+
return false;
|
|
2239
|
+
}
|
|
2240
|
+
const items = Array.isArray(v2) ? v2 : Object.values(v2);
|
|
2241
|
+
for (const item of items) {
|
|
2242
|
+
if (item !== null && typeof item === "object") {
|
|
2243
|
+
stack.push([item, depth + 1]);
|
|
2244
|
+
}
|
|
2245
|
+
}
|
|
2246
|
+
}
|
|
2247
|
+
return true;
|
|
2248
|
+
}
|
|
2249
|
+
function isObject(v2) {
|
|
2250
|
+
return v2 !== null && typeof v2 === "object" && !Array.isArray(v2);
|
|
2251
|
+
}
|
|
2252
|
+
function name(v2) {
|
|
2253
|
+
return typeof v2 === "string" && v2.length <= MAX_NAME ? v2 : invalid();
|
|
2254
|
+
}
|
|
2255
|
+
function nameOrNull(v2) {
|
|
2256
|
+
return v2 === null || v2 === void 0 ? null : name(v2);
|
|
2257
|
+
}
|
|
2258
|
+
function isScalar(v2) {
|
|
2259
|
+
return typeof v2 === "string" || typeof v2 === "boolean" || typeof v2 === "number" && Number.isFinite(v2);
|
|
2260
|
+
}
|
|
2261
|
+
function scalar(v2) {
|
|
2262
|
+
return isScalar(v2) ? v2 : invalid();
|
|
2263
|
+
}
|
|
2264
|
+
function array(v2, max) {
|
|
2265
|
+
return Array.isArray(v2) && v2.length <= max ? v2 : invalid();
|
|
2266
|
+
}
|
|
2267
|
+
function readBlock(top) {
|
|
2268
|
+
const source = isObject(top.source) ? top.source : invalid();
|
|
2269
|
+
const units = isObject(top.units) ? top.units : invalid();
|
|
2270
|
+
const length = units.length === "px" || units.length === "relative" ? units.length : invalid();
|
|
2271
|
+
const fp = isObject(top.fingerprint) ? top.fingerprint : invalid();
|
|
2272
|
+
const count = (v2) => typeof v2 === "number" && Number.isSafeInteger(v2) && v2 >= 0 ? v2 : invalid();
|
|
2273
|
+
const cols = isObject(top.columns) ? top.columns : invalid();
|
|
2274
|
+
const block = {
|
|
2275
|
+
version: 1,
|
|
2276
|
+
source: { format: name(source.format), dialect: nameOrNull(source.dialect), tool: nameOrNull(source.tool) },
|
|
2277
|
+
units: { length },
|
|
2278
|
+
graph: values(top.graph ?? {}),
|
|
2279
|
+
rules: array(top.rules, MAX_RULES).map(readRule),
|
|
2280
|
+
columns: {
|
|
2281
|
+
node: array(cols.node, MAX_RULES).map(name),
|
|
2282
|
+
edge: array(cols.edge, MAX_RULES).map(name)
|
|
2283
|
+
},
|
|
2284
|
+
fingerprint: { nodes: count(fp.nodes), edges: count(fp.edges), ids: name(fp.ids) }
|
|
2285
|
+
};
|
|
2286
|
+
const read = top.data === void 0 ? block : { ...block, data: readData(top.data) };
|
|
2287
|
+
const withData = top.booleans === void 0 ? read : { ...read, booleans: readBooleans(top.booleans) };
|
|
2288
|
+
if (top.values === void 0) {
|
|
2289
|
+
return withData;
|
|
2290
|
+
}
|
|
2291
|
+
const order = top.order === void 0 ? void 0 : readOrder(top.order, block.fingerprint.nodes);
|
|
2292
|
+
const inline = readInline(top.values, block);
|
|
2293
|
+
return { ...withData, ...order === void 0 ? {} : { order }, values: inline };
|
|
2294
|
+
}
|
|
2295
|
+
function readBooleans(v2) {
|
|
2296
|
+
const booleans = isObject(v2) ? v2 : invalid();
|
|
2297
|
+
return {
|
|
2298
|
+
node: array(booleans.node ?? [], MAX_RULES).map(name),
|
|
2299
|
+
edge: array(booleans.edge ?? [], MAX_RULES).map(name)
|
|
2300
|
+
};
|
|
2301
|
+
}
|
|
2302
|
+
function readOrder(v2, nodes) {
|
|
2303
|
+
const order = array(v2, nodes).map((id) => typeof id === "string" ? id : invalid());
|
|
2304
|
+
return order.length === nodes ? order : invalid();
|
|
2305
|
+
}
|
|
2306
|
+
function readInline(v2, block) {
|
|
2307
|
+
const values2 = isObject(v2) ? v2 : invalid();
|
|
2308
|
+
const inline = { node: /* @__PURE__ */ new Map(), edge: /* @__PURE__ */ new Map() };
|
|
2309
|
+
for (const target of TARGETS) {
|
|
2310
|
+
const n = target === "node" ? block.fingerprint.nodes : block.fingerprint.edges;
|
|
2311
|
+
const byKey = isObject(values2[target]) ? values2[target] : invalid();
|
|
2312
|
+
for (const key of block.columns[target]) {
|
|
2313
|
+
const col = array(Object.hasOwn(byKey, key) ? byKey[key] : invalid(), n);
|
|
2314
|
+
if (col.length !== n) {
|
|
2315
|
+
invalid();
|
|
2316
|
+
}
|
|
2317
|
+
inline[target].set(
|
|
2318
|
+
key,
|
|
2319
|
+
col.map((x) => x === null ? null : scalar(x))
|
|
2320
|
+
);
|
|
2321
|
+
}
|
|
2322
|
+
}
|
|
2323
|
+
return inline;
|
|
2324
|
+
}
|
|
2325
|
+
function readData(v2) {
|
|
2326
|
+
const d = isObject(v2) ? v2 : invalid();
|
|
2327
|
+
const byTarget = (t) => {
|
|
2328
|
+
const o = isObject(t) ? t : invalid();
|
|
2329
|
+
const keys = Object.keys(o);
|
|
2330
|
+
if (keys.length > MAX_RULES) {
|
|
2331
|
+
invalid();
|
|
2332
|
+
}
|
|
2333
|
+
return new Map(keys.map((k) => [name(k), name(o[k])]));
|
|
2334
|
+
};
|
|
2335
|
+
return { node: byTarget(d.node), edge: byTarget(d.edge) };
|
|
2336
|
+
}
|
|
2337
|
+
function cellText(v2) {
|
|
2338
|
+
if (v2 === null) {
|
|
2339
|
+
return "";
|
|
2340
|
+
}
|
|
2341
|
+
if (typeof v2 === "string" || typeof v2 === "number" || typeof v2 === "boolean") {
|
|
2342
|
+
return String(v2);
|
|
2343
|
+
}
|
|
2344
|
+
return JSON.stringify(v2);
|
|
2345
|
+
}
|
|
2346
|
+
function columnHash(table2, column, n) {
|
|
2347
|
+
let h1 = 2166136261;
|
|
2348
|
+
let h2 = 16777619 ^ 1540483477;
|
|
2349
|
+
for (let i = 0; i < n; i++) {
|
|
2350
|
+
const text = `${cellText(plainCell(table2.value(column, i)))}\0`;
|
|
2351
|
+
for (let c = 0; c < text.length; c++) {
|
|
2352
|
+
const code = text.charCodeAt(c);
|
|
2353
|
+
h1 = Math.imul(h1 ^ code, 16777619);
|
|
2354
|
+
h2 = Math.imul(h2 ^ code, 16777619) ^ h2 >>> 13;
|
|
2355
|
+
}
|
|
2356
|
+
}
|
|
2357
|
+
const hex = (h) => (h >>> 0).toString(16).padStart(8, "0");
|
|
2358
|
+
return hex(h1) + hex(h2);
|
|
2359
|
+
}
|
|
2360
|
+
function dataNames(rules) {
|
|
2361
|
+
const out = /* @__PURE__ */ new Set();
|
|
2362
|
+
for (const { ext: _ext, ...rule } of rules) {
|
|
2363
|
+
JSON.stringify(rule, (_k, v2) => {
|
|
2364
|
+
if (isObject(v2) && typeof v2.data === "string" && Object.keys(v2).length === 1) {
|
|
2365
|
+
out.add(v2.data);
|
|
2366
|
+
}
|
|
2367
|
+
return v2;
|
|
2368
|
+
});
|
|
2369
|
+
}
|
|
2370
|
+
return [...out];
|
|
2371
|
+
}
|
|
2372
|
+
function renameData(rule, rename) {
|
|
2373
|
+
const { ext, ...rest } = rule;
|
|
2374
|
+
const moved = JSON.parse(
|
|
2375
|
+
JSON.stringify(
|
|
2376
|
+
rest,
|
|
2377
|
+
(_k, v2) => isObject(v2) && typeof v2.data === "string" && Object.keys(v2).length === 1 && rename.has(v2.data) ? { data: rename.get(v2.data) } : v2
|
|
2378
|
+
)
|
|
2379
|
+
);
|
|
2380
|
+
return ext === void 0 ? moved : { ...moved, ext };
|
|
2381
|
+
}
|
|
2382
|
+
function movedColumns(block, snapshot, target) {
|
|
2383
|
+
const moved = /* @__PURE__ */ new Map();
|
|
2384
|
+
const want = block.data?.[target];
|
|
2385
|
+
if (want === void 0 || want.size === 0) {
|
|
2386
|
+
return moved;
|
|
2387
|
+
}
|
|
2388
|
+
const table2 = target === "node" ? snapshot.nodes : snapshot.edges;
|
|
2389
|
+
const n = target === "node" ? snapshot.nodeCount : snapshot.edgeCount;
|
|
2390
|
+
let have = null;
|
|
2391
|
+
for (const [column, hash] of want) {
|
|
2392
|
+
if (table2.has(column) && columnHash(table2, column, n) === hash) {
|
|
2393
|
+
continue;
|
|
2394
|
+
}
|
|
2395
|
+
have ??= new Map(Array.from(table2.names(), (c) => [c, columnHash(table2, c, n)]));
|
|
2396
|
+
for (const [c, h] of have) {
|
|
2397
|
+
if (h === hash) {
|
|
2398
|
+
moved.set(column, c);
|
|
2399
|
+
break;
|
|
2400
|
+
}
|
|
2401
|
+
}
|
|
2402
|
+
}
|
|
2403
|
+
return moved;
|
|
2404
|
+
}
|
|
2405
|
+
function values(v2) {
|
|
2406
|
+
const o = isObject(v2) ? v2 : invalid();
|
|
2407
|
+
const out = /* @__PURE__ */ Object.create(null);
|
|
2408
|
+
for (const key of Object.keys(o)) {
|
|
2409
|
+
out[name(key)] = scalar(o[key]);
|
|
2410
|
+
}
|
|
2411
|
+
return out;
|
|
2412
|
+
}
|
|
2413
|
+
function readRule(v2) {
|
|
2414
|
+
const r = isObject(v2) ? v2 : invalid();
|
|
2415
|
+
const target = r.target === "node" || r.target === "edge" ? r.target : invalid();
|
|
2416
|
+
const rule = {
|
|
2417
|
+
id: name(r.id),
|
|
2418
|
+
target,
|
|
2419
|
+
role: name(r.role),
|
|
2420
|
+
origin: name(r.origin),
|
|
2421
|
+
where: predicate(r.where)
|
|
2422
|
+
};
|
|
2423
|
+
if (r.set !== void 0) {
|
|
2424
|
+
rule.set = values(r.set);
|
|
2425
|
+
}
|
|
2426
|
+
if (r.map !== void 0) {
|
|
2427
|
+
const m = isObject(r.map) ? r.map : invalid();
|
|
2428
|
+
const map = /* @__PURE__ */ Object.create(null);
|
|
2429
|
+
for (const key of Object.keys(m)) {
|
|
2430
|
+
map[name(key)] = mapping(m[key]);
|
|
2431
|
+
}
|
|
2432
|
+
rule.map = map;
|
|
2433
|
+
}
|
|
2434
|
+
if (r.facts !== void 0) {
|
|
2435
|
+
rule.facts = facts(r.facts);
|
|
2436
|
+
}
|
|
2437
|
+
if (r.ext !== void 0) {
|
|
2438
|
+
rule.ext = isObject(r.ext) ? r.ext : invalid();
|
|
2439
|
+
}
|
|
2440
|
+
return rule;
|
|
2441
|
+
}
|
|
2442
|
+
function columnRef(v2) {
|
|
2443
|
+
const o = isObject(v2) ? v2 : invalid();
|
|
2444
|
+
if (typeof o.data === "string") {
|
|
2445
|
+
return { data: name(o.data) };
|
|
2446
|
+
}
|
|
2447
|
+
if (typeof o.style === "string") {
|
|
2448
|
+
return { style: name(o.style) };
|
|
2449
|
+
}
|
|
2450
|
+
if (typeof o.computed === "string" && COMPUTED.has(o.computed)) {
|
|
2451
|
+
return { computed: o.computed };
|
|
2452
|
+
}
|
|
2453
|
+
return invalid();
|
|
2454
|
+
}
|
|
2455
|
+
function predicate(v2) {
|
|
2456
|
+
const o = isObject(v2) ? v2 : invalid();
|
|
2457
|
+
if ("all" in o) {
|
|
2458
|
+
return o.all === true ? { all: true } : invalid();
|
|
2459
|
+
}
|
|
2460
|
+
if ("has" in o) {
|
|
2461
|
+
return { has: columnRef(o.has) };
|
|
2462
|
+
}
|
|
2463
|
+
if ("eq" in o) {
|
|
2464
|
+
const t = array(o.eq, 2);
|
|
2465
|
+
return t.length === 2 ? { eq: [columnRef(t[0]), scalar(t[1])] } : invalid();
|
|
2466
|
+
}
|
|
2467
|
+
if ("in" in o) {
|
|
2468
|
+
const t = array(o.in, 2);
|
|
2469
|
+
return t.length === 2 ? { in: [columnRef(t[0]), array(t[1], 65536).map(scalar)] } : invalid();
|
|
2470
|
+
}
|
|
2471
|
+
if ("and" in o) {
|
|
2472
|
+
return { and: array(o.and, 64).map(predicate) };
|
|
2473
|
+
}
|
|
2474
|
+
if ("or" in o) {
|
|
2475
|
+
return { or: array(o.or, 64).map(predicate) };
|
|
2476
|
+
}
|
|
2477
|
+
if ("not" in o) {
|
|
2478
|
+
return { not: predicate(o.not) };
|
|
2479
|
+
}
|
|
2480
|
+
return o;
|
|
2481
|
+
}
|
|
2482
|
+
function mapping(v2) {
|
|
2483
|
+
const o = isObject(v2) ? v2 : invalid();
|
|
2484
|
+
const by = columnRef(o.by);
|
|
2485
|
+
switch (o.kind) {
|
|
2486
|
+
case "passthrough":
|
|
2487
|
+
return { kind: "passthrough", by };
|
|
2488
|
+
case "discrete":
|
|
2489
|
+
return {
|
|
2490
|
+
kind: "discrete",
|
|
2491
|
+
by,
|
|
2492
|
+
table: array(o.table, 1 << 20).map((pair) => {
|
|
2493
|
+
const p = array(pair, 2);
|
|
2494
|
+
return p.length === 2 ? [scalar(p[0]), scalar(p[1])] : invalid();
|
|
2495
|
+
})
|
|
2496
|
+
};
|
|
2497
|
+
case "continuous":
|
|
2498
|
+
return {
|
|
2499
|
+
kind: "continuous",
|
|
2500
|
+
by,
|
|
2501
|
+
points: array(o.points, 4096).map((pt) => {
|
|
2502
|
+
const q = isObject(pt) ? pt : invalid();
|
|
2503
|
+
return {
|
|
2504
|
+
at: typeof q.at === "number" && Number.isFinite(q.at) ? q.at : invalid(),
|
|
2505
|
+
below: scalar(q.below),
|
|
2506
|
+
value: scalar(q.value),
|
|
2507
|
+
above: scalar(q.above)
|
|
2508
|
+
};
|
|
2509
|
+
})
|
|
2510
|
+
};
|
|
2511
|
+
default:
|
|
2512
|
+
return { ...o, kind: name(o.kind), by };
|
|
2513
|
+
}
|
|
2514
|
+
}
|
|
2515
|
+
function facts(v2) {
|
|
2516
|
+
const o = isObject(v2) ? v2 : invalid();
|
|
2517
|
+
const count = (x) => typeof x === "number" && Number.isSafeInteger(x) && x >= 0 ? x : void 0;
|
|
2518
|
+
const out = {};
|
|
2519
|
+
const elements = count(o.elements);
|
|
2520
|
+
const classes = count(o.classes);
|
|
2521
|
+
const distinctValues = count(o.distinctValues);
|
|
2522
|
+
if (elements !== void 0) {
|
|
2523
|
+
out.elements = elements;
|
|
2524
|
+
}
|
|
2525
|
+
if (classes !== void 0) {
|
|
2526
|
+
out.classes = classes;
|
|
2527
|
+
}
|
|
2528
|
+
if (distinctValues !== void 0) {
|
|
2529
|
+
out.distinctValues = distinctValues;
|
|
2530
|
+
}
|
|
2531
|
+
if (typeof o.reason === "string") {
|
|
2532
|
+
out.reason = name(o.reason);
|
|
2533
|
+
}
|
|
2534
|
+
if (o.names !== void 0) {
|
|
2535
|
+
out.names = array(o.names, 1 << 20).map((pair) => {
|
|
2536
|
+
const p = array(pair, 2);
|
|
2537
|
+
return p.length === 2 ? [scalar(p[0]), String(scalar(p[1]))] : invalid();
|
|
2538
|
+
});
|
|
2539
|
+
}
|
|
2540
|
+
return out;
|
|
2541
|
+
}
|
|
2542
|
+
function blockColumns(block, snapshot, target) {
|
|
2543
|
+
const out = /* @__PURE__ */ new Map();
|
|
2544
|
+
const table2 = target === "node" ? snapshot.nodes : snapshot.edges;
|
|
2545
|
+
const n = target === "node" ? snapshot.nodeCount : snapshot.edgeCount;
|
|
2546
|
+
for (const key of block.columns[target]) {
|
|
2547
|
+
const inline = block.values?.[target].get(key);
|
|
2548
|
+
if (inline !== void 0) {
|
|
2549
|
+
out.set(key, target === "node" ? inNodeOrder(block, snapshot, inline) : onEdgeRows(snapshot, inline));
|
|
2550
|
+
continue;
|
|
2551
|
+
}
|
|
2552
|
+
const tag = styleTag(target, key);
|
|
2553
|
+
if (!table2.has(tag)) {
|
|
2554
|
+
return null;
|
|
2555
|
+
}
|
|
2556
|
+
const col = Array.from({ length: n }, (_, i) => {
|
|
2557
|
+
const v2 = plainCell(table2.value(tag, i));
|
|
2558
|
+
return isScalar(v2) ? v2 : null;
|
|
2559
|
+
});
|
|
2560
|
+
out.set(key, target === "edge" ? withPairValues(snapshot, col) : col);
|
|
2561
|
+
}
|
|
2562
|
+
return out;
|
|
2563
|
+
}
|
|
2564
|
+
function asBooleans(block, columns) {
|
|
2565
|
+
for (const target of TARGETS) {
|
|
2566
|
+
for (const key of block.booleans?.[target] ?? []) {
|
|
2567
|
+
const col = columns[target].get(key);
|
|
2568
|
+
if (col !== void 0) {
|
|
2569
|
+
columns[target].set(key, col.map(asBoolean));
|
|
2570
|
+
}
|
|
2571
|
+
}
|
|
2572
|
+
}
|
|
2573
|
+
}
|
|
2574
|
+
function asBoolean(v2) {
|
|
2575
|
+
if (v2 === 1 || v2 === "1" || v2 === "true") {
|
|
2576
|
+
return true;
|
|
2577
|
+
}
|
|
2578
|
+
return v2 === 0 || v2 === "0" || v2 === "false" ? false : v2;
|
|
2579
|
+
}
|
|
2580
|
+
function inNodeOrder(block, snapshot, col) {
|
|
2581
|
+
const { order } = block;
|
|
2582
|
+
if (order === void 0 || order.every((id, i) => id === String(snapshot.ids.idOf(i)))) {
|
|
2583
|
+
return col;
|
|
2584
|
+
}
|
|
2585
|
+
const at = /* @__PURE__ */ new Map();
|
|
2586
|
+
order.forEach((id, i) => {
|
|
2587
|
+
if (!at.has(id)) {
|
|
2588
|
+
at.set(id, i);
|
|
2589
|
+
}
|
|
2590
|
+
});
|
|
2591
|
+
return Array.from(
|
|
2592
|
+
{ length: snapshot.nodeCount },
|
|
2593
|
+
(_unused, i) => col[at.get(String(snapshot.ids.idOf(i))) ?? -1] ?? null
|
|
2594
|
+
);
|
|
2595
|
+
}
|
|
2596
|
+
function onEdgeRows(snapshot, col) {
|
|
2597
|
+
const held = heldEdgeRows(snapshot);
|
|
2598
|
+
if (held.length === snapshot.edgeCount) {
|
|
2599
|
+
return col;
|
|
2600
|
+
}
|
|
2601
|
+
const out = new Array(snapshot.edgeCount).fill(null);
|
|
2602
|
+
held.forEach((e, k) => {
|
|
2603
|
+
out[e] = col[k] ?? null;
|
|
2604
|
+
});
|
|
2605
|
+
return withPairValues(snapshot, out);
|
|
2606
|
+
}
|
|
2607
|
+
function withPairValues(snapshot, col) {
|
|
2608
|
+
const pair = snapshot.edges.byRole("pair");
|
|
2609
|
+
if (pair === null) {
|
|
2610
|
+
return col;
|
|
2611
|
+
}
|
|
2612
|
+
for (let i = 0; i < col.length; i++) {
|
|
2613
|
+
if (col[i] === null && pair.isSet(i)) {
|
|
2614
|
+
col[i] = col[pair.value(i)] ?? null;
|
|
2615
|
+
}
|
|
2616
|
+
}
|
|
2617
|
+
return col;
|
|
2618
|
+
}
|
|
2619
|
+
const ALPHA_SLOT = {
|
|
2620
|
+
node: ["fill", "fillOpacity"],
|
|
2621
|
+
edge: ["color", "opacity"]
|
|
2622
|
+
};
|
|
2623
|
+
function opaqueColors(values2, target, rules, src, n) {
|
|
2624
|
+
const [colorProperty, opacityProperty] = ALPHA_SLOT[target];
|
|
2625
|
+
const color = values2[colorProperty];
|
|
2626
|
+
if (color === void 0) {
|
|
2627
|
+
return values2;
|
|
2628
|
+
}
|
|
2629
|
+
const native = values2[opacityProperty];
|
|
2630
|
+
const resolved = resolveRules(rules, target, opacityProperty, src);
|
|
2631
|
+
let out = null;
|
|
2632
|
+
for (let i = 0; i < n; i++) {
|
|
2633
|
+
const r = resolved[i];
|
|
2634
|
+
if ((color[i] ?? null) !== null && (native?.[i] ?? null) === null && r !== null && r !== 1) {
|
|
2635
|
+
out ??= native === void 0 ? new Array(n).fill(null) : [...native];
|
|
2636
|
+
out[i] = 1;
|
|
2637
|
+
}
|
|
2638
|
+
}
|
|
2639
|
+
return out === null ? values2 : { ...values2, [opacityProperty]: out };
|
|
2640
|
+
}
|
|
2641
|
+
function freeName(taken, base) {
|
|
2642
|
+
let name2 = base;
|
|
2643
|
+
let k = 2;
|
|
2644
|
+
while (taken(name2)) {
|
|
2645
|
+
name2 = `${base}#${String(k)}`;
|
|
2646
|
+
k++;
|
|
2647
|
+
}
|
|
2648
|
+
return name2;
|
|
2649
|
+
}
|
|
2650
|
+
function textProperty(target, property) {
|
|
2651
|
+
return STYLE_PROPERTIES[target].get(property) === "text";
|
|
2652
|
+
}
|
|
2653
|
+
function editedValues(values2, resolved, unset, text) {
|
|
2654
|
+
const empty = text ? "" : void 0;
|
|
2655
|
+
let exceptions = null;
|
|
2656
|
+
for (let i = 0; i < resolved.length; i++) {
|
|
2657
|
+
const t = values2[i] ?? null;
|
|
2658
|
+
const unchanged = resolved[i] === null && (t === unset || t === empty);
|
|
2659
|
+
if (t !== null && !within(t, resolved[i]) && !unchanged) {
|
|
2660
|
+
exceptions ??= new Array(resolved.length).fill(null);
|
|
2661
|
+
exceptions[i] = t;
|
|
2662
|
+
}
|
|
2663
|
+
}
|
|
2664
|
+
return exceptions;
|
|
2665
|
+
}
|
|
2666
|
+
function exceptionMappings(own, rules, target, src, columns, unsetOf) {
|
|
2667
|
+
const map = /* @__PURE__ */ Object.create(null);
|
|
2668
|
+
for (const [property, values2] of Object.entries(own).sort(([a], [b]) => a < b ? -1 : 1)) {
|
|
2669
|
+
if (values2 === void 0) {
|
|
2670
|
+
continue;
|
|
2671
|
+
}
|
|
2672
|
+
const resolved = resolveRules(rules, target, property, src);
|
|
2673
|
+
const exceptions = editedValues(values2, resolved, unsetOf(property), textProperty(target, property));
|
|
2674
|
+
if (exceptions !== null) {
|
|
2675
|
+
const key = freeName((k) => columns.has(k), `exceptions.${property}`);
|
|
2676
|
+
columns.set(key, exceptions);
|
|
2677
|
+
map[property] = { kind: "passthrough", by: { style: key } };
|
|
2678
|
+
}
|
|
2679
|
+
}
|
|
2680
|
+
return map;
|
|
2681
|
+
}
|
|
2682
|
+
function blockStyles(block, snapshot, format, truth = {}, notes = [], tool = null, opacityInColor = false) {
|
|
2683
|
+
const node = blockColumns(block, snapshot, "node");
|
|
2684
|
+
const edge = blockColumns(block, snapshot, "edge");
|
|
2685
|
+
if (node === null || edge === null) {
|
|
2686
|
+
return null;
|
|
2687
|
+
}
|
|
2688
|
+
const columns = { node, edge };
|
|
2689
|
+
asBooleans(block, columns);
|
|
2690
|
+
const features = { node: featuresOf(snapshot, "node"), edge: featuresOf(snapshot, "edge") };
|
|
2691
|
+
const moved = { node: movedColumns(block, snapshot, "node"), edge: movedColumns(block, snapshot, "edge") };
|
|
2692
|
+
const blockRules = block.rules.map((r) => moved[r.target].size === 0 ? r : renameData(r, moved[r.target]));
|
|
2693
|
+
const rules = [...blockRules];
|
|
2694
|
+
for (const target of TARGETS) {
|
|
2695
|
+
const n = target === "node" ? snapshot.nodeCount : snapshot.edgeCount;
|
|
2696
|
+
const src = refSource(target, n, columns[target], features[target], snapshot);
|
|
2697
|
+
const own = opacityInColor ? opaqueColors(truth[target] ?? {}, target, blockRules, src, n) : truth[target];
|
|
2698
|
+
const unsetOf = (property) => (tool === null ? null : toolDefaults(tool))?.[target]?.[property]?.value;
|
|
2699
|
+
const map = exceptionMappings(own ?? {}, blockRules, target, src, columns[target], unsetOf);
|
|
2700
|
+
if (Object.keys(map).length > 0) {
|
|
2701
|
+
const id = freeName((x) => rules.some((r) => r.id === x), `${target}.exceptions`);
|
|
2702
|
+
rules.push({
|
|
2703
|
+
id,
|
|
2704
|
+
target,
|
|
2705
|
+
role: "exceptions",
|
|
2706
|
+
origin: "inferred",
|
|
2707
|
+
where: { all: true },
|
|
2708
|
+
map
|
|
2709
|
+
});
|
|
2710
|
+
}
|
|
2711
|
+
}
|
|
2712
|
+
return {
|
|
2713
|
+
styles: {
|
|
2714
|
+
version: 1,
|
|
2715
|
+
source: { format, dialect: "graphty", tool: "graphty" },
|
|
2716
|
+
units: block.units,
|
|
2717
|
+
graph: block.graph,
|
|
2718
|
+
rules,
|
|
2719
|
+
notes
|
|
2720
|
+
},
|
|
2721
|
+
columns,
|
|
2722
|
+
features,
|
|
2723
|
+
fingerprint: styleFingerprint(snapshot)
|
|
2724
|
+
};
|
|
2725
|
+
}
|
|
2726
|
+
export {
|
|
2727
|
+
STYLE_ENUMS as A,
|
|
2728
|
+
STYLE_PROPERTIES as B,
|
|
2729
|
+
toolDefaults as C,
|
|
2730
|
+
DVIPS_COLORS as D,
|
|
2731
|
+
htmlLabelText as E,
|
|
2732
|
+
dotLabelText as F,
|
|
2733
|
+
recordLabelText as G,
|
|
2734
|
+
DOT_POINTS_PER_INCH as H,
|
|
2735
|
+
interpolate as I,
|
|
2736
|
+
within as J,
|
|
2737
|
+
describeFeature as K,
|
|
2738
|
+
refSource as L,
|
|
2739
|
+
MAX_STYLE_VALUE_LENGTH as M,
|
|
2740
|
+
isShortPredicate as N,
|
|
2741
|
+
resolveRules as O,
|
|
2742
|
+
matches as P,
|
|
2743
|
+
evalContinuous as Q,
|
|
2744
|
+
numberOf as R,
|
|
2745
|
+
STYLE_BLOCK_NAME as S,
|
|
2746
|
+
TOOL_DEFAULTS as T,
|
|
2747
|
+
styleLengthUnit as U,
|
|
2748
|
+
discreteLookup as V,
|
|
2749
|
+
CSS_COLORS as W,
|
|
2750
|
+
STYLE_ISSUE as a,
|
|
2751
|
+
styleTag as b,
|
|
2752
|
+
styleBlockLosses as c,
|
|
2753
|
+
canonicalFor as d,
|
|
2754
|
+
degreeValues as e,
|
|
2755
|
+
dataCell as f,
|
|
2756
|
+
canonColor as g,
|
|
2757
|
+
canonNumber as h,
|
|
2758
|
+
num6$1 as i,
|
|
2759
|
+
canonOpacity as j,
|
|
2760
|
+
scalarText as k,
|
|
2761
|
+
canonEnum as l,
|
|
2762
|
+
canonBoolean as m,
|
|
2763
|
+
noteAt as n,
|
|
2764
|
+
canonText as o,
|
|
2765
|
+
plainCell as p,
|
|
2766
|
+
isStyleValue as q,
|
|
2767
|
+
resolveStyles as r,
|
|
2768
|
+
styleFingerprint as s,
|
|
2769
|
+
StyleNotes as t,
|
|
2770
|
+
parseStyleBlock as u,
|
|
2771
|
+
blockStyles as v,
|
|
2772
|
+
writeStyleBlock as w,
|
|
2773
|
+
colorOpacity as x,
|
|
2774
|
+
featuresOf as y,
|
|
2775
|
+
MAX_STYLE_BLOCK_LENGTH as z
|
|
2776
|
+
};
|
|
2777
|
+
//# sourceMappingURL=block-CPCHkX42.js.map
|