@graphty/graph-io 0.3.18 → 0.3.20
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/README.md +80 -2
- package/dist/chunks/{escape-D-gZWO26.js → escape-B-tkk_Cl.js} +74 -16
- package/dist/chunks/escape-B-tkk_Cl.js.map +1 -0
- package/dist/chunks/{writer-GAdltGmC.js → export-Bh60Dv-n.js} +7 -252
- package/dist/chunks/export-Bh60Dv-n.js.map +1 -0
- package/dist/chunks/exporter-BGrsWamJ.js +736 -0
- package/dist/chunks/exporter-BGrsWamJ.js.map +1 -0
- package/dist/chunks/exporter-DIeGJXAZ.js +834 -0
- package/dist/chunks/exporter-DIeGJXAZ.js.map +1 -0
- package/dist/chunks/{importer-Br_QeAeE.js → importer-BWY2FFc5.js} +28 -6
- package/dist/chunks/importer-BWY2FFc5.js.map +1 -0
- package/dist/chunks/importer-BaQpCEcJ.js +2194 -0
- package/dist/chunks/importer-BaQpCEcJ.js.map +1 -0
- package/dist/chunks/importer-DD-xv9_Y.js +1471 -0
- package/dist/chunks/importer-DD-xv9_Y.js.map +1 -0
- package/dist/chunks/{importer-aNJfe0qu.js → importer-DEcKhsmQ.js} +2 -2
- package/dist/chunks/{importer-aNJfe0qu.js.map → importer-DEcKhsmQ.js.map} +1 -1
- package/dist/chunks/{importer-DHagxvDD.js → importer-DIrbbnAf.js} +6 -4
- package/dist/chunks/{importer-DHagxvDD.js.map → importer-DIrbbnAf.js.map} +1 -1
- package/dist/chunks/importer-D_e7e7LX.js +3055 -0
- package/dist/chunks/importer-D_e7e7LX.js.map +1 -0
- package/dist/chunks/{importer-Du5crN9l.js → importer-Wv4C4gaF.js} +278 -82
- package/dist/chunks/importer-Wv4C4gaF.js.map +1 -0
- package/dist/chunks/importer-vi3bSdtw.js +1713 -0
- package/dist/chunks/importer-vi3bSdtw.js.map +1 -0
- package/dist/chunks/{importer-d0uQxFp6.js → importer-zGLo8Dg_.js} +6 -4
- package/dist/chunks/{importer-d0uQxFp6.js.map → importer-zGLo8Dg_.js.map} +1 -1
- package/dist/chunks/json-elements-DDS8N2Dd.js +779 -0
- package/dist/chunks/json-elements-DDS8N2Dd.js.map +1 -0
- package/dist/chunks/{records-Bk9jgodz.js → records-dbRkxwaq.js} +2 -2
- package/dist/chunks/{records-Bk9jgodz.js.map → records-dbRkxwaq.js.map} +1 -1
- package/dist/chunks/{report-BOk0p5y8.js → report-B1z4WT9e.js} +143 -111
- package/dist/chunks/{report-BOk0p5y8.js.map → report-B1z4WT9e.js.map} +1 -1
- package/dist/chunks/weights-Dzba96G3.js +176 -0
- package/dist/chunks/weights-Dzba96G3.js.map +1 -0
- package/dist/chunks/writer-C7flM-Ih.js +77 -0
- package/dist/chunks/writer-C7flM-Ih.js.map +1 -0
- package/dist/csv.js +6 -4
- package/dist/csv.js.map +1 -1
- package/dist/cx.d.ts +1 -0
- package/dist/cx.js +6 -0
- package/dist/cx.js.map +1 -0
- package/dist/cx2.d.ts +1 -0
- package/dist/cx2.js +10 -0
- package/dist/cx2.js.map +1 -0
- package/dist/cys.d.ts +1 -0
- package/dist/cys.js +6 -0
- package/dist/cys.js.map +1 -0
- package/dist/dot.js +1 -1
- package/dist/gexf.js +16 -4
- package/dist/gexf.js.map +1 -1
- package/dist/gml.js +13 -14
- package/dist/gml.js.map +1 -1
- package/dist/graph-io.js +302 -399
- package/dist/graph-io.js.map +1 -1
- package/dist/graphml.js +1 -1
- package/dist/json.js +1 -1
- package/dist/neo4j.js +6 -4
- package/dist/neo4j.js.map +1 -1
- package/dist/obo.js +1 -1
- package/dist/pajek.js +1 -1
- package/dist/src/common/cell-budget.d.ts +84 -0
- package/dist/src/common/cell-budget.d.ts.map +1 -0
- package/dist/src/common/cell-budget.js +138 -0
- package/dist/src/common/cell-budget.js.map +1 -0
- package/dist/src/common/input.d.ts +10 -0
- package/dist/src/common/input.d.ts.map +1 -1
- package/dist/src/common/input.js +39 -0
- package/dist/src/common/input.js.map +1 -1
- package/dist/src/common/json-elements.d.ts +286 -0
- package/dist/src/common/json-elements.d.ts.map +1 -0
- package/dist/src/common/json-elements.js +926 -0
- package/dist/src/common/json-elements.js.map +1 -0
- package/dist/src/common/options.d.ts +6 -0
- package/dist/src/common/options.d.ts.map +1 -1
- package/dist/src/common/options.js +1 -1
- package/dist/src/common/options.js.map +1 -1
- package/dist/src/common/xml.d.ts +37 -3
- package/dist/src/common/xml.d.ts.map +1 -1
- package/dist/src/common/xml.js +86 -6
- package/dist/src/common/xml.js.map +1 -1
- package/dist/src/common/zip.d.ts +92 -0
- package/dist/src/common/zip.d.ts.map +1 -0
- package/dist/src/common/zip.js +399 -0
- package/dist/src/common/zip.js.map +1 -0
- package/dist/src/formats/cx/importer.d.ts +133 -0
- package/dist/src/formats/cx/importer.d.ts.map +1 -0
- package/dist/src/formats/cx/importer.js +2220 -0
- package/dist/src/formats/cx/importer.js.map +1 -0
- package/dist/src/formats/cx/index.d.ts +7 -0
- package/dist/src/formats/cx/index.d.ts.map +1 -0
- package/dist/src/formats/cx/index.js +7 -0
- package/dist/src/formats/cx/index.js.map +1 -0
- package/dist/src/formats/cx2/exporter.d.ts +59 -0
- package/dist/src/formats/cx2/exporter.d.ts.map +1 -0
- package/dist/src/formats/cx2/exporter.js +864 -0
- package/dist/src/formats/cx2/exporter.js.map +1 -0
- package/dist/src/formats/cx2/importer.d.ts +169 -0
- package/dist/src/formats/cx2/importer.d.ts.map +1 -0
- package/dist/src/formats/cx2/importer.js +1652 -0
- package/dist/src/formats/cx2/importer.js.map +1 -0
- package/dist/src/formats/cx2/index.d.ts +7 -0
- package/dist/src/formats/cx2/index.d.ts.map +1 -0
- package/dist/src/formats/cx2/index.js +7 -0
- package/dist/src/formats/cx2/index.js.map +1 -0
- package/dist/src/formats/cys/constants.d.ts +68 -0
- package/dist/src/formats/cys/constants.d.ts.map +1 -0
- package/dist/src/formats/cys/constants.js +76 -0
- package/dist/src/formats/cys/constants.js.map +1 -0
- package/dist/src/formats/cys/importer.d.ts +38 -0
- package/dist/src/formats/cys/importer.d.ts.map +1 -0
- package/dist/src/formats/cys/importer.js +830 -0
- package/dist/src/formats/cys/importer.js.map +1 -0
- package/dist/src/formats/cys/index.d.ts +7 -0
- package/dist/src/formats/cys/index.d.ts.map +1 -0
- package/dist/src/formats/cys/index.js +7 -0
- package/dist/src/formats/cys/index.js.map +1 -0
- package/dist/src/formats/cys/session.d.ts +132 -0
- package/dist/src/formats/cys/session.d.ts.map +1 -0
- package/dist/src/formats/cys/session.js +315 -0
- package/dist/src/formats/cys/session.js.map +1 -0
- package/dist/src/formats/cys/tables.d.ts +90 -0
- package/dist/src/formats/cys/tables.d.ts.map +1 -0
- package/dist/src/formats/cys/tables.js +293 -0
- package/dist/src/formats/cys/tables.js.map +1 -0
- 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 +12 -0
- package/dist/src/formats/dot/exporter.js.map +1 -1
- package/dist/src/formats/dot/importer.js +6 -2
- package/dist/src/formats/dot/importer.js.map +1 -1
- package/dist/src/formats/gexf/exporter.d.ts +2 -0
- package/dist/src/formats/gexf/exporter.d.ts.map +1 -1
- package/dist/src/formats/gexf/exporter.js +6 -0
- package/dist/src/formats/gexf/exporter.js.map +1 -1
- package/dist/src/formats/gexf/importer.d.ts +0 -2
- package/dist/src/formats/gexf/importer.d.ts.map +1 -1
- package/dist/src/formats/gexf/importer.js +1 -3
- package/dist/src/formats/gexf/importer.js.map +1 -1
- package/dist/src/formats/gexf/index.d.ts +1 -1
- package/dist/src/formats/gexf/index.js +2 -2
- package/dist/src/formats/gexf/index.js.map +1 -1
- package/dist/src/formats/gml/exporter.d.ts +0 -8
- package/dist/src/formats/gml/exporter.d.ts.map +1 -1
- package/dist/src/formats/gml/exporter.js +8 -18
- package/dist/src/formats/gml/exporter.js.map +1 -1
- package/dist/src/formats/json/importer.d.ts.map +1 -1
- package/dist/src/formats/json/importer.js +6 -104
- package/dist/src/formats/json/importer.js.map +1 -1
- package/dist/src/formats/xgmml/columns.d.ts +152 -0
- package/dist/src/formats/xgmml/columns.d.ts.map +1 -0
- package/dist/src/formats/xgmml/columns.js +593 -0
- package/dist/src/formats/xgmml/columns.js.map +1 -0
- package/dist/src/formats/xgmml/constants.d.ts +196 -0
- package/dist/src/formats/xgmml/constants.d.ts.map +1 -0
- package/dist/src/formats/xgmml/constants.js +197 -0
- package/dist/src/formats/xgmml/constants.js.map +1 -0
- package/dist/src/formats/xgmml/document.d.ts +361 -0
- package/dist/src/formats/xgmml/document.d.ts.map +1 -0
- package/dist/src/formats/xgmml/document.js +695 -0
- package/dist/src/formats/xgmml/document.js.map +1 -0
- package/dist/src/formats/xgmml/emit.d.ts +341 -0
- package/dist/src/formats/xgmml/emit.d.ts.map +1 -0
- package/dist/src/formats/xgmml/emit.js +1275 -0
- package/dist/src/formats/xgmml/emit.js.map +1 -0
- package/dist/src/formats/xgmml/exporter.d.ts +24 -0
- package/dist/src/formats/xgmml/exporter.d.ts.map +1 -0
- package/dist/src/formats/xgmml/exporter.js +999 -0
- package/dist/src/formats/xgmml/exporter.js.map +1 -0
- package/dist/src/formats/xgmml/importer.d.ts +58 -0
- package/dist/src/formats/xgmml/importer.d.ts.map +1 -0
- package/dist/src/formats/xgmml/importer.js +360 -0
- package/dist/src/formats/xgmml/importer.js.map +1 -0
- package/dist/src/formats/xgmml/index.d.ts +8 -0
- package/dist/src/formats/xgmml/index.d.ts.map +1 -0
- package/dist/src/formats/xgmml/index.js +8 -0
- package/dist/src/formats/xgmml/index.js.map +1 -0
- package/dist/src/formats/xgmml/values.d.ts +60 -0
- package/dist/src/formats/xgmml/values.d.ts.map +1 -0
- package/dist/src/formats/xgmml/values.js +148 -0
- package/dist/src/formats/xgmml/values.js.map +1 -0
- package/dist/src/index.d.ts +4 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +4 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/registry.d.ts +7 -0
- package/dist/src/registry.d.ts.map +1 -1
- package/dist/src/registry.js +30 -10
- package/dist/src/registry.js.map +1 -1
- package/dist/src/sniff.d.ts +1 -1
- package/dist/src/sniff.d.ts.map +1 -1
- package/dist/src/sniff.js +4 -0
- package/dist/src/sniff.js.map +1 -1
- package/dist/xgmml.d.ts +1 -0
- package/dist/xgmml.js +9 -0
- package/dist/xgmml.js.map +1 -0
- package/package.json +25 -2
- package/src/common/cell-budget.ts +170 -0
- package/src/common/input.ts +40 -0
- package/src/common/json-elements.ts +1147 -0
- package/src/common/options.ts +1 -1
- package/src/common/xml.ts +127 -6
- package/src/common/zip.ts +472 -0
- package/src/formats/cx/importer.ts +2733 -0
- package/src/formats/cx/index.ts +7 -0
- package/src/formats/cx2/exporter.ts +1036 -0
- package/src/formats/cx2/importer.ts +2187 -0
- package/src/formats/cx2/index.ts +7 -0
- package/src/formats/cys/constants.ts +99 -0
- package/src/formats/cys/importer.ts +1100 -0
- package/src/formats/cys/index.ts +7 -0
- package/src/formats/cys/session.ts +428 -0
- package/src/formats/cys/tables.ts +400 -0
- package/src/formats/dot/exporter.ts +17 -0
- package/src/formats/dot/importer.ts +6 -2
- package/src/formats/gexf/exporter.ts +11 -0
- package/src/formats/gexf/importer.ts +1 -2
- package/src/formats/gexf/index.ts +1 -1
- package/src/formats/gml/exporter.ts +8 -19
- package/src/formats/json/importer.ts +6 -105
- package/src/formats/xgmml/columns.ts +747 -0
- package/src/formats/xgmml/constants.ts +265 -0
- package/src/formats/xgmml/document.ts +975 -0
- package/src/formats/xgmml/emit.ts +1563 -0
- package/src/formats/xgmml/exporter.ts +1215 -0
- package/src/formats/xgmml/importer.ts +491 -0
- package/src/formats/xgmml/index.ts +8 -0
- package/src/formats/xgmml/values.ts +183 -0
- package/src/index.ts +19 -0
- package/src/registry.ts +46 -15
- package/src/sniff.ts +18 -1
- package/dist/chunks/escape-D-gZWO26.js.map +0 -1
- package/dist/chunks/importer-Br_QeAeE.js.map +0 -1
- package/dist/chunks/importer-Du5crN9l.js.map +0 -1
- package/dist/chunks/writer-GAdltGmC.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"importer-Br_QeAeE.js","sources":["../../src/formats/dot/names.ts","../../src/formats/dot/exporter.ts","../../src/formats/dot/tokenizer.ts","../../src/formats/dot/importer.ts"],"sourcesContent":["/**\n * The names the DOT importer and exporter share: the format name, the column origin, the\n * format-owned columns (design section 5.6: `graphty.` prefix) and the attribute names the format\n * gives a fixed meaning to.\n */\n\nimport { type ColumnOriginInput } from \"@graphty/graph-format\";\n\n/** The format name. */\nexport const DOT_FORMAT = \"dot\";\n\n/** The origin recorded on every column the importer declares. */\nexport const DOT_ORIGIN: ColumnOriginInput = Object.freeze({ format: DOT_FORMAT });\n\n/** The bool node column marking a cluster's container node. */\nexport const CLUSTER_COLUMN = \"graphty.cluster\";\n\n/** The u32 node column (role parent, refersTo node) holding a member's cluster. */\nexport const PARENT_COLUMN = \"graphty.parent\";\n\n/** The string edge column (role sourcePort) holding an edge's tail port. */\nexport const SOURCE_PORT_COLUMN = \"graphty.sourcePort\";\n\n/** The string edge column (role targetPort) holding an edge's head port. */\nexport const TARGET_PORT_COLUMN = \"graphty.targetPort\";\n\n/** The attribute that is the display label (kept as text with role label). */\nexport const LABEL_ATTRIBUTE = \"label\";\n\n/** The node attribute holding a position, mapped to the position role column (design section 5.2). */\nexport const POS_ATTRIBUTE = \"pos\";\n\n/** The edge attribute cgraph uses as an edge's identity within its endpoints, mapped to the edge id role. */\nexport const KEY_ATTRIBUTE = \"key\";\n\n/** The node attribute a `!` suffix of `pos` sets (Graphviz's own spelling of a pinned position). */\nexport const PIN_ATTRIBUTE = \"pin\";\n\n/** The key under meta.extra holding the format's graph flags (`{ strict: true }`). */\nexport const DOT_META_KEY = \"dot\";\n","/**\n * The DOT / Graphviz exporter (design section 8.5; research note 07 section 9). Writes one\n * `[strict] graph | digraph [name] { ... }` with the graph attributes first, every node in index\n * order (a node statement carrying its set cells as attributes, or a `subgraph` block for a cluster\n * container node with its members nested inside), then every logical edge in index order with its\n * explicit weight, `key` (the edge id role), ports and attributes.\n *\n * What the format keeps and what check() reports: any id and any text (DOT quotes everything\n * except a text ending in a backslash, which the lexer cannot read back); bool / i32 / f64 cells\n * (f64 written with a decimal point so the dtype survives re-import; other numeric dtypes are\n * written and read back inferred); containment through the parent role (clusters); graph\n * attributes; node positions as `pos=\"x,y\"`. Mixed direction is folded per onMixedDirection\n * (DOT has none); lists, json, defaults, options, temporal and visual roles cannot be written.\n */\n\nimport { type Column, GraphFormatError, type GraphSnapshot, type NodeId } from \"@graphty/graph-format\";\n\nimport { type ChildrenCsr, childrenCsr } from \"../../children.js\";\nimport { type PairFolding, pairFolding } from \"../../common/direction.js\";\nimport { isWritableDotText, quoteDotId } from \"../../common/escape.js\";\nimport { capabilities, checkCapabilities, countMixedEdges, LOSS, sanitizeIds } from \"../../common/export.js\";\nimport { formatDecimal, formatF32, formatF64, formatInteger } from \"../../common/format.js\";\nimport { canonicalId } from \"../../common/ids.js\";\nimport { type ResolvedExportOptions, resolveExportOptions } from \"../../common/options.js\";\nimport { inferTextDtype } from \"../../common/text.js\";\nimport { type ExplicitWeights, explicitWeights } from \"../../common/weights.js\";\nimport { encodeChunks, joinText } from \"../../common/writer.js\";\nimport { type CommonExportOptions, type ExportCapabilities, type GraphExporter, type LossNote } from \"../../types.js\";\nimport {\n CLUSTER_COLUMN,\n DOT_FORMAT,\n DOT_META_KEY,\n KEY_ATTRIBUTE,\n LABEL_ATTRIBUTE,\n PARENT_COLUMN,\n POS_ATTRIBUTE,\n SOURCE_PORT_COLUMN,\n TARGET_PORT_COLUMN,\n} from \"./names.js\";\n\n/** The DOT exporter's format-specific options. */\nexport interface DotExportOptions {\n /** The indentation of one nesting level; four spaces by default. */\n indent?: string | undefined;\n /** The graph name to write; `meta.name` by default, null for an anonymous graph. */\n name?: string | null | undefined;\n /** Whether to write `strict`; by default when `meta.extra.dot.strict` is true. */\n strict?: boolean | undefined;\n}\n\n/** The LossNote codes of the DOT exporter; the shared ones are LOSS's. */\nexport const DOT_LOSS = Object.freeze({\n /** An id, name or text with a backslash before a quote or a line break, or at its end, cannot be written as a DOT quoted string; export() throws. */\n TRAILING_BACKSLASH: \"E_DOT_TRAILING_BACKSLASH\",\n /** A non-finite f32 / f64 cell has no numeric DOT spelling and reads back as text. */\n NON_FINITE: \"W_DOT_NON_FINITE\",\n /** Text cells that look like numbers or booleans read back as such (DOT attribute values are untyped). */\n TEXT_INFERRED: LOSS.TEXT_INFERRED,\n /** A plain column named like an attribute the exporter writes for a role (weight, key, pos) is not written. */\n ATTRIBUTE_CLASH: \"W_DOT_ATTRIBUTE_CLASH\",\n /** A mutual pair is written as two directed edges. */\n MUTUAL_EXPANDED: LOSS.MUTUAL_EXPANDED,\n /** A parents (multi-parent) column cannot be written; DOT clusters nest. */\n PARENTS_DROPPED: LOSS.PARENTS,\n /** A position column that is not a node column of 2 or 3 components is not written. */\n POSITION_SHAPE: \"W_DOT_POSITION_SHAPE\",\n /** An id whose text reads back as the other type under ids: \"canonical\" (1.5 as text, \"1\" as 1). */\n ID_TEXT_TYPE: LOSS.ID_TEXT_TYPE,\n /** A declared column whose every row is unset is not written (DOT writes cells, never declarations). */\n EMPTY_COLUMN_DROPPED: LOSS.EMPTY_COLUMN,\n /** A role-less column named `label` reads back with the label role. */\n ROLE_ASSUMED: LOSS.ROLE_ASSUMED,\n});\n\n/** The roles DOT has a slot for (the label attribute, key, ports, clusters); every other role is reported. */\nconst KEPT_ROLES: ReadonlySet<string> = new Set([\"label\", \"id\", \"sourcePort\", \"targetPort\", \"parent\"]);\n\n/** The column name the importer gives each mapped role on re-import. */\nconst ROLE_NAMES: Readonly<Record<string, string>> = Object.freeze({\n label: LABEL_ATTRIBUTE,\n id: KEY_ATTRIBUTE,\n sourcePort: SOURCE_PORT_COLUMN,\n targetPort: TARGET_PORT_COLUMN,\n parent: PARENT_COLUMN,\n position: POS_ATTRIBUTE,\n});\n\nconst CAPABILITIES: ExportCapabilities = capabilities({\n mixedDirection: false,\n multiEdges: true,\n selfLoops: true,\n edgeIds: \"optional\",\n idCharset: \"any\",\n dtypes: [\"bool\", \"i32\", \"f64\", \"string\"],\n components: false,\n lists: false,\n json: false,\n defaults: false,\n options: false,\n hierarchy: true,\n temporal: \"none\",\n graphAttributes: true,\n positions: true,\n viz: false,\n});\n\nconst DEFAULT_INDENT = \" \";\nconst CLUSTER_PREFIX = \"cluster\";\nconst COMPASS_POINTS: ReadonlySet<string> = new Set([\"n\", \"ne\", \"e\", \"se\", \"s\", \"sw\", \"w\", \"nw\", \"c\", \"_\"]);\n\n/** Roles never written as attributes, per domain. */\nconst SKIPPED_NODE_ROLES: ReadonlySet<string> = new Set([\n \"parent\",\n \"parents\",\n \"position\",\n \"color\",\n \"size\",\n \"shape\",\n \"thickness\",\n \"start\",\n \"end\",\n \"timestamp\",\n \"timestamps\",\n \"spells\",\n \"open\",\n \"spellsOpen\",\n \"timeText\",\n \"directed\",\n \"pair\",\n \"mutual\",\n \"weight\",\n]);\nconst SKIPPED_EDGE_ROLES: ReadonlySet<string> = new Set([\n \"id\",\n \"weight\",\n \"directed\",\n \"pair\",\n \"mutual\",\n \"sourcePort\",\n \"targetPort\",\n \"position\",\n \"color\",\n \"size\",\n \"shape\",\n \"thickness\",\n \"start\",\n \"end\",\n \"timestamp\",\n \"timestamps\",\n \"spells\",\n \"open\",\n \"spellsOpen\",\n \"timeText\",\n \"parent\",\n \"parents\",\n]);\nconst SKIPPED_GRAPH_ROLES: ReadonlySet<string> = new Set([\"position\", \"color\", \"size\", \"shape\", \"thickness\"]);\n/** Text columns whose values are read back as text regardless of their spelling (no TEXT_INFERRED note). */\nconst TEXT_ROLES: ReadonlySet<string> = new Set([\"label\", \"id\", \"sourcePort\", \"targetPort\"]);\n\n/**\n * The exporter plugin for DOT / Graphviz text (design section 12.4).\n */\nexport const dotExporter: GraphExporter<DotExportOptions> = Object.freeze({\n format: DOT_FORMAT,\n capabilities: CAPABILITIES,\n\n /**\n * Pre-flight: every loss the DOT text would incur, without writing anything.\n * @param snapshot - the snapshot to check\n * @param options - format-specific and common options\n * @returns the notes, empty when the export is exact\n */\n check(snapshot: GraphSnapshot, options?: DotExportOptions & CommonExportOptions): readonly LossNote[] {\n const resolved = resolveExportOptions(options);\n const notes = checkCapabilities(snapshot, CAPABILITIES, resolved, {\n positionDtype: \"f32\",\n roles: KEPT_ROLES,\n roleNames: ROLE_NAMES,\n });\n const plan = new ExportPlan(snapshot, resolved, options);\n return [...notes, ...plan.notes()];\n },\n\n /**\n * Write the snapshot as UTF-8 chunks.\n * @param snapshot - the snapshot to write\n * @param options - format-specific and common options\n * @returns the encoded chunks\n */\n export(snapshot: GraphSnapshot, options?: DotExportOptions & CommonExportOptions): AsyncIterable<Uint8Array> {\n return encodeChunks(writeDot(snapshot, options));\n },\n\n /**\n * Write the snapshot as one string.\n * @param snapshot - the snapshot to write\n * @param options - format-specific and common options\n * @returns the whole document\n */\n exportToString(snapshot: GraphSnapshot, options?: DotExportOptions & CommonExportOptions): Promise<string> {\n return joinText(writeDot(snapshot, options));\n },\n});\n\n/**\n * The text parts of a DOT document.\n * @param snapshot - the snapshot\n * @param options - the caller's options\n * @yields one statement (or header / footer) at a time\n * @returns nothing\n */\nfunction* writeDot(snapshot: GraphSnapshot, options?: DotExportOptions & CommonExportOptions): Generator<string> {\n const resolved = resolveExportOptions(options);\n const plan = new ExportPlan(snapshot, resolved, options);\n plan.refuse();\n yield* plan.write();\n}\n\n/**\n * Whether a text ends in a backslash, which a DOT quoted string cannot carry (the lexer would read\n * the backslash and the closing quote as an escaped quote; common/escape.ts isWritableDotText).\n * @param text - the text\n * @returns true when unwritable\n */\nfunction endsWithBackslash(text: string): boolean {\n return !isWritableDotText(text);\n}\n\n/**\n * Whether a text is an HTML string (balanced angle brackets around the whole text), which DOT\n * writes bare as `<...>`.\n * @param text - the text\n * @returns true for an HTML string\n */\nfunction isHtmlString(text: string): boolean {\n if (text.length < 2 || !text.startsWith(\"<\") || !text.endsWith(\">\")) {\n return false;\n }\n let depth = 0;\n for (let i = 0; i < text.length; i++) {\n const c = text.charCodeAt(i);\n if (c === 0x3c) {\n depth++;\n } else if (c === 0x3e) {\n depth--;\n if (depth === 0 && i !== text.length - 1) {\n return false;\n }\n }\n }\n return depth === 0;\n}\n\n/**\n * Write a text as a DOT ID: an HTML string bare, everything else through quoteDotId.\n * @param text - the text\n * @returns the DOT ID\n */\nfunction writeId(text: string): string {\n return isHtmlString(text) ? text : quoteDotId(text);\n}\n\n/**\n * Write a port text (`f0`, `f0:ne`, `ne`) as its DOT spelling after the endpoint.\n * @param port - the port text\n * @returns `:port[:compass]`\n */\nfunction writePort(port: string): string {\n const colon = port.lastIndexOf(\":\");\n if (colon > 0 && COMPASS_POINTS.has(port.slice(colon + 1))) {\n return `:${quoteDotId(port.slice(0, colon))}:${port.slice(colon + 1)}`;\n }\n return `:${quoteDotId(port)}`;\n}\n\n/**\n * Whether a column can be written as attribute text: every scalar dtype; lists and json cannot.\n * @param column - the column\n * @returns true when writable\n */\nfunction isTextualDtype(column: Column): boolean {\n return column.dtype !== \"list\" && column.dtype !== \"json\";\n}\n\n/**\n * Everything one export needs to know about a snapshot, computed once and shared by check() and\n * write(): the output direction, the columns written per table, the cluster structure, and the\n * format-specific loss notes.\n */\nclass ExportPlan {\n private readonly snapshot: GraphSnapshot;\n\n private readonly resolved: ResolvedExportOptions;\n\n private readonly indent: string;\n\n private readonly name: string | null;\n\n private readonly strict: boolean;\n\n private readonly mixed: number;\n\n private readonly directed: boolean;\n\n private readonly nodeColumns: Column[];\n\n private readonly edgeColumns: Column[];\n\n private readonly graphColumns: Column[];\n\n private readonly position: Column | null;\n\n private readonly positionDims: 2 | 3;\n\n private readonly parent: Column | null;\n\n private readonly cluster: Column | null;\n\n private readonly edgeId: Column | null;\n\n private readonly weights: ExplicitWeights;\n\n private readonly folding: PairFolding;\n\n private readonly sourcePort: Column | null;\n\n private readonly targetPort: Column | null;\n\n private readonly children: ChildrenCsr;\n\n private readonly extraNotes: LossNote[] = [];\n\n /**\n * Plan one export.\n * @param snapshot - the snapshot\n * @param resolved - the resolved common options\n * @param options - the caller's options (format-specific fields read here)\n */\n constructor(snapshot: GraphSnapshot, resolved: ResolvedExportOptions, options?: DotExportOptions) {\n this.snapshot = snapshot;\n this.resolved = resolved;\n this.indent = options?.indent ?? DEFAULT_INDENT;\n this.name = options?.name === undefined ? snapshot.meta.name : options.name;\n this.strict = options?.strict ?? isStrictMeta(snapshot);\n this.mixed = countMixedEdges(snapshot);\n if (this.mixed > 0 && resolved.onMixedDirection !== \"error\") {\n this.directed = resolved.onMixedDirection === \"directed\";\n } else {\n this.directed = snapshot.directed;\n }\n const { nodes, edges, graph } = snapshot;\n this.position = nodes.byRole(\"position\");\n this.positionDims = positionDims(this.position);\n this.parent = nodes.byRole(\"parent\");\n const cluster = nodes.get(CLUSTER_COLUMN);\n this.cluster = cluster !== null && cluster.dtype === \"bool\" ? cluster : null;\n this.edgeId = edges.byRole(\"id\");\n this.weights = explicitWeights(snapshot);\n this.folding = pairFolding(snapshot);\n this.sourcePort = edges.byRole(\"sourcePort\");\n this.targetPort = edges.byRole(\"targetPort\");\n this.nodeColumns = [...nodes].filter((c) => this.writesNodeColumn(c));\n this.edgeColumns = [...edges].filter((c) => this.writesEdgeColumn(c));\n this.graphColumns = [...graph].filter(\n (c) => isTextualDtype(c) && (c.meta.role === null || !SKIPPED_GRAPH_ROLES.has(c.meta.role)),\n );\n this.children = childrenCsr(snapshot, {\n column: this.parent !== null && this.parent.dtype === \"u32\" ? this.parent : null,\n });\n }\n\n /**\n * Whether a node column is written as node attributes.\n * @param column - the column\n * @returns true when written\n */\n private writesNodeColumn(column: Column): boolean {\n const { name, role } = column.meta;\n if (!isTextualDtype(column) || name === CLUSTER_COLUMN) {\n return false;\n }\n if (role !== null && SKIPPED_NODE_ROLES.has(role)) {\n return false;\n }\n if (name === POS_ATTRIBUTE && role !== \"position\") {\n this.clash(\"node\", name, \"the position role is written as pos\");\n return false;\n }\n return true;\n }\n\n /**\n * Whether an edge column is written as edge attributes.\n * @param column - the column\n * @returns true when written\n */\n private writesEdgeColumn(column: Column): boolean {\n const { name, role } = column.meta;\n if (!isTextualDtype(column)) {\n return false;\n }\n if (role !== null && SKIPPED_EDGE_ROLES.has(role)) {\n return false;\n }\n if (name === KEY_ATTRIBUTE && this.edgeId !== null) {\n this.clash(\"edge\", name, \"the edge id role is written as key\");\n return false;\n }\n if (name === \"weight\") {\n this.clash(\"edge\", name, \"the weight is written as weight\");\n return false;\n }\n return true;\n }\n\n /**\n * Record a column not written because its name is an attribute the exporter writes for a role.\n * @param domain - the table\n * @param name - the column name\n * @param reason - why\n */\n private clash(domain: string, name: string, reason: string): void {\n this.extraNotes.push(\n Object.freeze({\n code: DOT_LOSS.ATTRIBUTE_CLASH,\n message: `${domain} column \"${name}\" has no role and is not written: ${reason}`,\n column: name,\n count: null,\n }),\n );\n }\n\n /**\n * The format-specific loss notes (the generic ones come from checkCapabilities).\n * @returns the notes\n */\n notes(): LossNote[] {\n const notes: LossNote[] = [...this.extraNotes];\n const note = (\n code: string,\n message: string,\n column: string | null = null,\n count: number | null = null,\n ): void => {\n notes.push(Object.freeze({ code, message, column, count }));\n };\n const { snapshot } = this;\n const unwritable = this.countUnwritable();\n if (unwritable > 0) {\n note(\n DOT_LOSS.TRAILING_BACKSLASH,\n `${unwritable} id(s), name(s) or text value(s) hold a backslash before a quote or a line break, or at the end, which a DOT quoted string cannot carry; export() will throw`,\n null,\n unwritable,\n );\n }\n for (const [label, columns] of [\n [\"node\", this.nodeColumns],\n [\"edge\", this.edgeColumns],\n [\"graph\", this.graphColumns],\n ] as const) {\n for (const column of columns) {\n if (label !== \"graph\" && column.nullCount === column.length) {\n note(\n DOT_LOSS.EMPTY_COLUMN_DROPPED,\n `${label} column \"${column.meta.name}\" has no set cell and is not written: DOT writes cells, never declarations`,\n column.meta.name,\n 0,\n );\n continue;\n }\n if (\n label !== \"graph\" &&\n column.meta.role === null &&\n column.meta.name === LABEL_ATTRIBUTE &&\n (column.dtype === \"string\" || column.dtype === \"dict\")\n ) {\n note(\n DOT_LOSS.ROLE_ASSUMED,\n `${label} column \"${column.meta.name}\" reads back with the label role`,\n column.meta.name,\n column.length - column.nullCount,\n );\n }\n if (column.dtype === \"f32\" || column.dtype === \"f64\") {\n const bad = countNonFinite(column);\n if (bad > 0) {\n note(\n DOT_LOSS.NON_FINITE,\n `${label} column \"${column.meta.name}\" holds ${bad} non-finite value(s) with no numeric DOT spelling; they read back as text`,\n column.meta.name,\n bad,\n );\n }\n }\n if (\n (column.dtype === \"string\" || column.dtype === \"dict\") &&\n (column.meta.role === null || !TEXT_ROLES.has(column.meta.role))\n ) {\n const typed = countTypedLookingText(column);\n if (typed > 0) {\n note(\n DOT_LOSS.TEXT_INFERRED,\n `${label} column \"${column.meta.name}\" holds ${typed} text value(s) that look like numbers or booleans; DOT values are untyped and they read back as such`,\n column.meta.name,\n typed,\n );\n }\n }\n }\n }\n const mutual = this.folding.mutualCount;\n if (mutual > 0) {\n note(\n DOT_LOSS.MUTUAL_EXPANDED,\n `${mutual} mutual pair(s) are written as two directed edges each; the mutual mark is lost`,\n null,\n mutual,\n );\n }\n const parents = snapshot.nodes.byRole(\"parents\");\n if (parents !== null) {\n note(\n DOT_LOSS.PARENTS_DROPPED,\n `node column \"${parents.meta.name}\" (parents) cannot be written: a DOT node is in one cluster`,\n parents.meta.name,\n parents.length - parents.nullCount,\n );\n }\n if (this.position !== null && this.position.meta.components !== 2 && this.position.meta.components !== 3) {\n note(\n DOT_LOSS.POSITION_SHAPE,\n `node column \"${this.position.meta.name}\" (position) has ${this.position.meta.components} components and is not written; pos takes 2 or 3`,\n this.position.meta.name,\n this.position.length - this.position.nullCount,\n );\n }\n for (const [label, table] of [\n [\"edge\", snapshot.edges],\n [\"graph\", snapshot.graph],\n ] as const) {\n const column = table.byRole(\"position\");\n if (column !== null) {\n note(\n DOT_LOSS.POSITION_SHAPE,\n `${label} column \"${column.meta.name}\" (position) is not written; only node positions map to pos`,\n column.meta.name,\n column.length - column.nullCount,\n );\n }\n }\n const textIds = countTextIds(snapshot);\n if (textIds > 0) {\n note(\n DOT_LOSS.ID_TEXT_TYPE,\n `${textIds} node id(s) read back as the other type under ids: \"canonical\" (a string \"1\" becomes 1, a number 1.5 becomes \"1.5\")`,\n null,\n textIds,\n );\n }\n return notes;\n }\n\n /**\n * Throw for the conditions check() reports as errors: mixed direction under \"error\", and an\n * unwritable id / name / text.\n */\n refuse(): void {\n if (this.mixed > 0 && this.resolved.onMixedDirection === \"error\") {\n throw new GraphFormatError(\n \"E_DIRECTED\",\n `${this.mixed} undirected edge(s) in a directed graph; DOT has no mixed direction and onMixedDirection is \"error\"`,\n { reason: LOSS.MIXED_DIRECTION_ERROR, count: this.mixed },\n );\n }\n const first = this.firstUnwritable();\n if (first !== null) {\n throw new GraphFormatError(\n first.kind === \"id\" ? \"E_INVALID_ID\" : \"E_COLUMN_TYPE\",\n `${first.kind} ${JSON.stringify(first.text)} holds a backslash before a quote or a line break, or at its end, which a DOT quoted string cannot carry`,\n { reason: \"trailing backslash\", kind: first.kind, value: first.text },\n );\n }\n sanitizeIds(this.snapshot, CAPABILITIES.idCharset, this.resolved.sanitizeIds);\n }\n\n /**\n * How many ids, names and text values end in a backslash.\n * @returns the count\n */\n private countUnwritable(): number {\n let count = 0;\n this.forEachText((text) => {\n if (endsWithBackslash(text)) {\n count++;\n }\n });\n return count;\n }\n\n /**\n * The first id, name or text value ending in a backslash.\n * @returns what it is and its text, or null\n */\n private firstUnwritable(): { kind: string; text: string } | null {\n let found: { kind: string; text: string } | null = null;\n this.forEachText((text, kind) => {\n if (found === null && endsWithBackslash(text)) {\n found = { kind, text };\n }\n });\n return found;\n }\n\n /**\n * Visit every text the document writes as a quoted string: the graph name, node ids, column\n * names and string / dict cells.\n * @param visit - the visitor\n */\n private forEachText(visit: (text: string, kind: string) => void): void {\n const { snapshot } = this;\n if (this.name !== null) {\n visit(this.name, \"graph name\");\n }\n for (let i = 0; i < snapshot.nodeCount; i++) {\n const id = snapshot.ids.idOf(i);\n if (typeof id === \"string\") {\n visit(id, \"id\");\n }\n }\n for (const columns of [this.nodeColumns, this.edgeColumns, this.graphColumns]) {\n for (const column of columns) {\n visit(column.meta.name, \"attribute name\");\n if (column.dtype === \"string\" || column.dtype === \"dict\") {\n for (let r = 0; r < column.length; r++) {\n if (column.isSet(r)) {\n visit(column.value(r) as string, \"value\");\n }\n }\n }\n }\n }\n for (const column of [this.edgeId, this.sourcePort, this.targetPort]) {\n if (column !== null && (column.dtype === \"string\" || column.dtype === \"dict\")) {\n for (let r = 0; r < column.length; r++) {\n if (column.isSet(r)) {\n visit(column.value(r) as string, \"value\");\n }\n }\n }\n }\n }\n\n /**\n * The document, one statement per part.\n * @yields the parts\n * @returns nothing\n */\n *write(): Generator<string> {\n const { snapshot, indent } = this;\n const keyword = this.directed ? \"digraph\" : \"graph\";\n const name = this.name === null ? \"\" : ` ${quoteDotId(this.name)}`;\n yield `${this.strict ? \"strict \" : \"\"}${keyword}${name} {\\n`;\n const graphAttributes = this.attributesOf(this.graphColumns, 0);\n if (graphAttributes.length > 0) {\n yield `${indent}graph [${graphAttributes.join(\", \")}];\\n`;\n }\n const emitted = new Uint8Array(snapshot.nodeCount);\n for (let i = 0; i < snapshot.nodeCount; i++) {\n yield* this.writeNode(i, 1, emitted);\n }\n yield* this.writeEdges();\n yield \"}\\n\";\n }\n\n /**\n * Write one node (and, for a container, its cluster block with the members nested).\n * @param i - the node index\n * @param depth - the nesting depth\n * @param emitted - which nodes were written already\n * @yields the statements\n * @returns nothing\n */\n private *writeNode(i: number, depth: number, emitted: Uint8Array): Generator<string> {\n if (emitted[i] === 1) {\n return;\n }\n emitted[i] = 1;\n const pad = this.indent.repeat(depth);\n const idText = this.idText(i);\n const kids = this.children.childrenOf(i);\n const marked = this.cluster !== null && this.cluster.isSet(i) && this.cluster.value(i) === true;\n if (kids.length === 0 && !marked) {\n yield `${pad}${this.nodeStatement(i, idText)};\\n`;\n return;\n }\n if (!marked) {\n // a real node that is also a parent: its cells are node attributes, the cluster only groups\n yield `${pad}${this.nodeStatement(i, idText)};\\n`;\n }\n const inner = `${pad}${this.indent}`;\n yield `${pad}subgraph ${writeId(idText)} {\\n`;\n if (!idText.startsWith(CLUSTER_PREFIX)) {\n yield `${inner}cluster=true;\\n`;\n }\n if (marked) {\n const attributes = this.nodeAttributes(i);\n if (attributes.length > 0) {\n yield `${inner}graph [${attributes.join(\", \")}];\\n`;\n }\n }\n for (const child of kids) {\n if (emitted[child] === 1) {\n yield `${inner}${writeId(this.idText(child))};\\n`;\n } else {\n yield* this.writeNode(child, depth + 1, emitted);\n }\n }\n yield `${pad}}\\n`;\n }\n\n /**\n * A node statement without its terminator.\n * @param i - the node index\n * @param idText - the id text\n * @returns `id` or `id [attrs]`\n */\n private nodeStatement(i: number, idText: string): string {\n const attributes = this.nodeAttributes(i);\n return attributes.length === 0 ? writeId(idText) : `${writeId(idText)} [${attributes.join(\", \")}]`;\n }\n\n /**\n * The attributes of a node: its set cells plus `pos` from the position column.\n * @param i - the node index\n * @returns the attribute texts\n */\n private nodeAttributes(i: number): string[] {\n const attributes = this.attributesOf(this.nodeColumns, i);\n const pos = this.positionText(i);\n if (pos !== null) {\n attributes.push(`${POS_ATTRIBUTE}=${quoteDotId(pos)}`);\n }\n return attributes;\n }\n\n /**\n * The `pos` text of a node, or null when it has none.\n * @param i - the node index\n * @returns `x,y` or `x,y,z`\n */\n private positionText(i: number): string | null {\n const column = this.position;\n if (column === null || !column.isSet(i)) {\n return null;\n }\n if (column.dtype !== \"f32\" && column.dtype !== \"f64\" && column.dtype !== \"i32\") {\n return null;\n }\n const { components } = column.meta;\n if (components !== 2 && components !== 3) {\n return null;\n }\n const format = column.dtype === \"f32\" ? formatF32 : formatF64;\n const base = i * components;\n const { data } = column;\n const parts = [format(data[base]), format(data[base + 1])];\n if (this.positionDims === 3) {\n parts.push(format(components === 3 ? data[base + 2] : 0));\n }\n return parts.join(\",\");\n }\n\n /**\n * The `name=value` attributes of one row over a column list (set cells only).\n * @param columns - the columns\n * @param row - the row\n * @returns the attribute texts\n */\n private attributesOf(columns: readonly Column[], row: number): string[] {\n const out: string[] = [];\n for (const column of columns) {\n if (!column.isSet(row)) {\n continue;\n }\n const text = cellText(column, row);\n if (text !== null) {\n out.push(`${quoteDotId(column.meta.name)}=${writeId(text)}`);\n }\n }\n return out;\n }\n\n /**\n * Every logical edge in index order, mirror halves of expanded undirected pairs folded away.\n * @yields the edge statements\n * @returns nothing\n */\n private *writeEdges(): Generator<string> {\n const { snapshot, indent } = this;\n const list = snapshot.edgeList();\n const op = this.directed ? \"->\" : \"--\";\n for (let e = 0; e < snapshot.edgeCount; e++) {\n if (this.folding.folded(e)) {\n continue;\n }\n const attributes = this.attributesOf(this.edgeColumns, e);\n const weight = this.weights.text(e);\n if (weight !== null) {\n attributes.unshift(`weight=${quoteDotId(weight)}`);\n }\n const key = this.keyText(e);\n if (key !== null) {\n attributes.unshift(`${KEY_ATTRIBUTE}=${writeId(key)}`);\n }\n const source = `${writeId(this.idText(list.src[e]))}${this.portText(this.sourcePort, e)}`;\n const target = `${writeId(this.idText(list.dst[e]))}${this.portText(this.targetPort, e)}`;\n const tail = attributes.length === 0 ? \"\" : ` [${attributes.join(\", \")}]`;\n yield `${indent}${source} ${op} ${target}${tail};\\n`;\n }\n }\n\n /**\n * The edge id of an edge as `key` text, or null.\n * @param e - the edge index\n * @returns the text\n */\n private keyText(e: number): string | null {\n const column = this.edgeId;\n if (column === null || !column.isSet(e)) {\n return null;\n }\n if (column.dtype === \"f32\" || column.dtype === \"f64\") {\n return formatF64(column.data[e]);\n }\n return cellText(column, e);\n }\n\n /**\n * The port suffix of an endpoint.\n * @param column - the port column, or null\n * @param e - the edge index\n * @returns `:port` or \"\"\n */\n private portText(column: Column | null, e: number): string {\n if (column === null || !column.isSet(e)) {\n return \"\";\n }\n const text = cellText(column, e);\n return text === null || text.length === 0 ? \"\" : writePort(text);\n }\n\n /**\n * The id text of a node.\n * @param i - the node index\n * @returns String(id)\n */\n private idText(i: number): string {\n return idToText(this.snapshot.ids.idOf(i));\n }\n}\n\n/**\n * The text of a node id: the string itself, or the shortest decimal of a number.\n * @param id - the id\n * @returns the text\n */\nfunction idToText(id: NodeId): string {\n return typeof id === \"string\" ? id : formatF64(id);\n}\n\n/**\n * Whether the snapshot's meta records a strict graph.\n * @param snapshot - the snapshot\n * @returns true when meta.extra.dot.strict is true\n */\nfunction isStrictMeta(snapshot: GraphSnapshot): boolean {\n const dot: unknown = snapshot.meta.extra[DOT_META_KEY];\n return typeof dot === \"object\" && dot !== null && (dot as { strict?: unknown }).strict === true;\n}\n\n/**\n * The dimensions `pos` is written with: what the importer recorded in extra.sourceDims, else 2\n * for a 2-component column and 3 otherwise.\n * @param column - the position column, or null\n * @returns 2 or 3\n */\nfunction positionDims(column: Column | null): 2 | 3 {\n if (column === null) {\n return 2;\n }\n const dims: unknown = column.meta.extra.sourceDims;\n if (dims === 2 || dims === 3) {\n return dims;\n }\n return column.meta.components === 2 ? 2 : 3;\n}\n\n/**\n * The attribute text of one set cell, or null for a dtype the format cannot write.\n * @param column - the column\n * @param row - the row\n * @returns the text\n */\nfunction cellText(column: Column, row: number): string | null {\n switch (column.dtype) {\n case \"bool\":\n return column.value(row) === true ? \"true\" : \"false\";\n case \"i32\":\n case \"u32\":\n case \"u8\":\n return numericText(column, row, formatInteger);\n case \"f32\":\n return numericText(column, row, (v) => formatDecimal(v, \"f32\"));\n case \"f64\":\n return numericText(column, row, (v) => formatDecimal(v, \"f64\"));\n case \"dict\":\n case \"string\":\n return column.value(row) ?? \"\";\n case \"list\":\n case \"json\":\n return null;\n default: {\n const name: string = (column as Column).dtype;\n throw new GraphFormatError(\"E_COLUMN_TYPE\", `unknown dtype ${name}`, { dtype: name });\n }\n }\n}\n\n/**\n * The text of a numeric cell: one number, or the `components` numbers joined by commas.\n * @param column - a numeric column\n * @param row - the row\n * @param format - the per-number formatter\n * @returns the text\n */\nfunction numericText(\n column: Column & { readonly data: ArrayLike<number> },\n row: number,\n format: (value: number) => string,\n): string {\n const { components } = column.meta;\n if (components === 1) {\n return format(column.data[row]);\n }\n const parts: string[] = [];\n for (let k = 0; k < components; k++) {\n parts.push(format(column.data[row * components + k]));\n }\n return parts.join(\",\");\n}\n\n/**\n * How many set cells of an f32 / f64 column are non-finite.\n * @param column - the column\n * @returns the count\n */\nfunction countNonFinite(column: Column): number {\n if (column.dtype !== \"f32\" && column.dtype !== \"f64\") {\n return 0;\n }\n const { components } = column.meta;\n let count = 0;\n for (let r = 0; r < column.length; r++) {\n if (!column.isSet(r)) {\n continue;\n }\n for (let k = 0; k < components; k++) {\n if (!Number.isFinite(column.data[r * components + k])) {\n count++;\n break;\n }\n }\n }\n return count;\n}\n\n/**\n * How many set cells of a text column read back as something other than text under the 5.1 grammar.\n * @param column - a string or dict column\n * @returns the count\n */\nfunction countTypedLookingText(column: Column): number {\n if (column.dtype !== \"string\" && column.dtype !== \"dict\") {\n return 0;\n }\n let count = 0;\n for (let r = 0; r < column.length; r++) {\n if (column.isSet(r) && inferTextDtype(column.value(r) ?? \"\") !== \"string\") {\n count++;\n }\n }\n return count;\n}\n\n/**\n * How many ids read back as the other type under the canonical rule: numeric ids that are not\n * canonical integer text (read back as strings) and string ids that are (read back as numbers).\n * @param snapshot - the snapshot\n * @returns the count\n */\nfunction countTextIds(snapshot: GraphSnapshot): number {\n const { ids } = snapshot;\n if (ids.kind === \"identity\" || ids.kind === \"dense\") {\n return 0;\n }\n let count = 0;\n for (let i = 0; i < ids.size; i++) {\n const id = ids.idOf(i);\n if (canonicalId(idToText(id)) !== id) {\n count++;\n }\n }\n return count;\n}\n","/**\n * The DOT lexer (graphviz.org/doc/info/lang.html): IDs in their four spellings (an alphanumeric\n * identifier, a numeral, a double-quoted string with `\\\"` as its only escape, backslash pairs\n * consumed as units and backslash-newline as a line continuation, an HTML string in balanced\n * angle brackets), the punctuation of the\n * grammar, the two edge operators, the `+` of quoted-string concatenation, and the three comment\n * forms (`//`, `/* ... *\\/`, and a `#` line, which is C preprocessor output). Keywords are not\n * distinguished here: the parser matches a bare id case-insensitively, since a quoted `\"node\"` is\n * an ordinary id. Line numbers are 1-based and attached to every token for the report.\n */\n\n/** The kinds of token. */\ntype DotTokenKind = \"id\" | \"punct\" | \"eof\";\n\n/** One token of a DOT document. */\nexport interface DotToken {\n /** The kind. */\n readonly kind: DotTokenKind;\n /**\n * The decoded text of an id (quotes removed, `\\\"` unescaped, an HTML string kept with its outer\n * angle brackets), the punctuation itself for \"punct\" (`{ } [ ] ; , = : + -> --`), \"\" at the end.\n */\n readonly text: string;\n /** Whether an id was double-quoted (a quoted keyword is an ordinary id). */\n readonly quoted: boolean;\n /** Whether an id was an HTML string. */\n readonly html: boolean;\n /** The 1-based line the token starts on. */\n readonly line: number;\n}\n\n/** The error the lexer and parser throw for a grammar violation; the importer turns it into a fatal parse-error. */\nexport class DotSyntaxError extends Error {\n /** The 1-based line of the violation. */\n readonly line: number;\n\n /**\n * Create a syntax error.\n * @param message - a plain-ASCII message\n * @param line - the 1-based line\n */\n constructor(message: string, line: number) {\n super(message);\n this.name = \"DotSyntaxError\";\n this.line = line;\n }\n}\n\nconst EOF_TOKEN_TEXT = \"\";\n\n/**\n * Whether a UTF-16 code unit may start a bare DOT identifier: a letter, an underscore or any code\n * of 128 and above (the grammar's `\\200-\\377` range, read here as every non-ASCII unit).\n * @param c - the code unit\n * @returns true for an identifier start\n */\nfunction isIdentifierStart(c: number): boolean {\n return (c >= 65 && c <= 90) || (c >= 97 && c <= 122) || c === 95 || c >= 128;\n}\n\n/**\n * Whether a UTF-16 code unit may continue a bare DOT identifier.\n * @param c - the code unit\n * @returns true for an identifier character\n */\nfunction isIdentifierPart(c: number): boolean {\n return isIdentifierStart(c) || isDigit(c);\n}\n\n/**\n * Whether a code unit is an ASCII digit.\n * @param c - the code unit\n * @returns true for 0-9\n */\nfunction isDigit(c: number): boolean {\n return c >= 48 && c <= 57;\n}\n\n/**\n * A pull lexer over one DOT document with arbitrary lookahead.\n */\nexport class DotTokenizer {\n private readonly text: string;\n\n private pos = 0;\n\n private line = 1;\n\n private readonly lookahead: DotToken[] = [];\n\n private readonly onAmbiguity: ((numeral: string, line: number) => void) | null;\n\n /**\n * Create a lexer over a whole document.\n * @param text - the DOT text (BOM already removed)\n * @param onAmbiguity - called for a badly delimited numeral (`1e3`, which Graphviz splits into\n * `1` and `e3` with a warning), with the numeral text and its line\n */\n constructor(text: string, onAmbiguity: ((numeral: string, line: number) => void) | null = null) {\n this.text = text;\n this.onAmbiguity = onAmbiguity;\n }\n\n /**\n * Look at a token without consuming it.\n * @param n - how far ahead (0 = the next token)\n * @returns the token; an \"eof\" token past the end\n */\n peek(n = 0): DotToken {\n while (this.lookahead.length <= n) {\n this.lookahead.push(this.lex());\n }\n return this.lookahead[n];\n }\n\n /**\n * Consume the next token.\n * @returns the token; an \"eof\" token past the end\n */\n next(): DotToken {\n const ahead = this.lookahead.shift();\n return ahead ?? this.lex();\n }\n\n /**\n * Produce the next token from the text.\n * @returns the token\n */\n private lex(): DotToken {\n this.skipTrivia();\n const { text } = this;\n if (this.pos >= text.length) {\n return { kind: \"eof\", text: EOF_TOKEN_TEXT, quoted: false, html: false, line: this.line };\n }\n const start = this.pos;\n const { line } = this;\n const c = text.charCodeAt(start);\n switch (c) {\n case 0x7b: // {\n case 0x7d: // }\n case 0x5b: // [\n case 0x5d: // ]\n case 0x3b: // ;\n case 0x2c: // ,\n case 0x3d: // =\n case 0x3a: // :\n case 0x2b: // +\n this.pos++;\n return { kind: \"punct\", text: text[start], quoted: false, html: false, line };\n case 0x2d: {\n // - : an edge operator, or the sign of a numeral\n const d = text.charCodeAt(start + 1);\n if (d === 0x3e || d === 0x2d) {\n this.pos += 2;\n return { kind: \"punct\", text: text.slice(start, start + 2), quoted: false, html: false, line };\n }\n if (isDigit(d) || (d === 0x2e && isDigit(text.charCodeAt(start + 2)))) {\n return this.numeral(start, line);\n }\n throw new DotSyntaxError(\"unexpected '-': not an edge operator or a numeral\", line);\n }\n case 0x22:\n return this.quoted(start, line);\n case 0x3c:\n return this.html(start, line);\n default:\n break;\n }\n if (isIdentifierStart(c)) {\n let end = start + 1;\n while (end < text.length && isIdentifierPart(text.charCodeAt(end))) {\n end++;\n }\n this.pos = end;\n return { kind: \"id\", text: text.slice(start, end), quoted: false, html: false, line };\n }\n if (isDigit(c) || (c === 0x2e && isDigit(text.charCodeAt(start + 1)))) {\n return this.numeral(start, line);\n }\n throw new DotSyntaxError(`unexpected character ${JSON.stringify(text[start])}`, line);\n }\n\n /**\n * Lex a numeral `-?(.[0-9]+ | [0-9]+(.[0-9]*)?)` starting at `start`.\n * @param start - the offset of the first character (a sign, a digit or a dot)\n * @param line - the line\n * @returns the id token holding the numeral text\n */\n private numeral(start: number, line: number): DotToken {\n const { text } = this;\n let end = start;\n if (text.charCodeAt(end) === 0x2d) {\n end++;\n }\n while (end < text.length && isDigit(text.charCodeAt(end))) {\n end++;\n }\n if (text.charCodeAt(end) === 0x2e) {\n end++;\n while (end < text.length && isDigit(text.charCodeAt(end))) {\n end++;\n }\n }\n this.pos = end;\n const numeral = text.slice(start, end);\n if (end < text.length && isIdentifierStart(text.charCodeAt(end)) && this.onAmbiguity !== null) {\n // Graphviz: \"syntax ambiguity - badly delimited number '1e' ... splits into two tokens\"\n this.onAmbiguity(numeral, line);\n }\n return { kind: \"id\", text: numeral, quoted: false, html: false, line };\n }\n\n /**\n * Lex a double-quoted string starting at the opening quote: `\\\"` is the only escape, a\n * backslash followed by a line break is a continuation (both removed), every other backslash is\n * kept as written, and raw line breaks are allowed inside.\n * @param start - the offset of the opening quote\n * @param line - the line of the opening quote\n * @returns the id token holding the decoded text\n */\n private quoted(start: number, line: number): DotToken {\n const { text } = this;\n let out = \"\";\n let segment = start + 1;\n let i = start + 1;\n for (;;) {\n if (i >= text.length) {\n throw new DotSyntaxError(\"unterminated quoted string (missing closing quote)\", line);\n }\n const c = text.charCodeAt(i);\n if (c === 0x22) {\n out += text.slice(segment, i);\n this.pos = i + 1;\n return { kind: \"id\", text: out, quoted: true, html: false, line };\n }\n if (c === 0x5c) {\n const d = text.charCodeAt(i + 1);\n if (d === 0x22) {\n out += `${text.slice(segment, i)}\"`;\n i += 2;\n segment = i;\n continue;\n }\n if (d === 0x5c) {\n // Graphviz's scanner consumes a backslash pair as one unit (both kept), so the\n // second backslash never escapes a closing quote: \"x\\\\\" is the text x\\\\\n i += 2;\n continue;\n }\n if (d === 0x0a || d === 0x0d) {\n out += text.slice(segment, i);\n i += d === 0x0d && text.charCodeAt(i + 2) === 0x0a ? 3 : 2;\n this.line++;\n segment = i;\n continue;\n }\n i++;\n continue;\n }\n if (c === 0x0a || c === 0x0d) {\n if (c === 0x0d && text.charCodeAt(i + 1) === 0x0a) {\n i++;\n }\n this.line++;\n }\n i++;\n }\n }\n\n /**\n * Lex an HTML string starting at the opening angle bracket: the text up to the matching\n * closing bracket, brackets balanced, kept verbatim including the outer pair.\n * @param start - the offset of the opening bracket\n * @param line - the line of the opening bracket\n * @returns the id token holding the whole `<...>` text\n */\n private html(start: number, line: number): DotToken {\n const { text } = this;\n let depth = 0;\n for (let i = start; i < text.length; i++) {\n const c = text.charCodeAt(i);\n if (c === 0x3c) {\n depth++;\n } else if (c === 0x3e) {\n depth--;\n if (depth === 0) {\n this.pos = i + 1;\n return { kind: \"id\", text: text.slice(start, i + 1), quoted: false, html: true, line };\n }\n } else if (c === 0x0a || (c === 0x0d && text.charCodeAt(i + 1) !== 0x0a)) {\n this.line++;\n }\n }\n throw new DotSyntaxError(\"unterminated HTML string (missing closing '>')\", line);\n }\n\n /**\n * Skip whitespace and comments, counting lines.\n */\n private skipTrivia(): void {\n const { text } = this;\n for (;;) {\n if (this.pos >= text.length) {\n return;\n }\n const c = text.charCodeAt(this.pos);\n if (c === 0x0a) {\n this.line++;\n this.pos++;\n this.skipPreprocessorLine();\n continue;\n }\n if (c === 0x0d) {\n this.line++;\n this.pos += text.charCodeAt(this.pos + 1) === 0x0a ? 2 : 1;\n this.skipPreprocessorLine();\n continue;\n }\n if (c === 0x20 || c === 0x09 || c === 0x0b || c === 0x0c) {\n this.pos++;\n continue;\n }\n if (c === 0x2f) {\n const d = text.charCodeAt(this.pos + 1);\n if (d === 0x2f) {\n this.skipToLineEnd();\n continue;\n }\n if (d === 0x2a) {\n this.skipBlockComment();\n continue;\n }\n }\n if (c === 0x23 && this.pos === 0) {\n this.skipToLineEnd();\n continue;\n }\n return;\n }\n }\n\n /**\n * Discard a `#` line when one starts at the current position (the start of a line).\n */\n private skipPreprocessorLine(): void {\n if (this.text.charCodeAt(this.pos) === 0x23) {\n this.skipToLineEnd();\n }\n }\n\n /**\n * Advance to the next line break without consuming it.\n */\n private skipToLineEnd(): void {\n const { text } = this;\n while (this.pos < text.length) {\n const c = text.charCodeAt(this.pos);\n if (c === 0x0a || c === 0x0d) {\n return;\n }\n this.pos++;\n }\n }\n\n /**\n * Skip a block comment starting at the current `/*`.\n */\n private skipBlockComment(): void {\n const { text } = this;\n const startLine = this.line;\n let i = this.pos + 2;\n for (; i < text.length; i++) {\n const c = text.charCodeAt(i);\n if (c === 0x2a && text.charCodeAt(i + 1) === 0x2f) {\n this.pos = i + 2;\n return;\n }\n if (c === 0x0a || (c === 0x0d && text.charCodeAt(i + 1) !== 0x0a)) {\n this.line++;\n }\n }\n throw new DotSyntaxError(\"unterminated block comment\", startLine);\n }\n}\n","/**\n * The DOT / Graphviz importer (design sections 8.4, 4.1, 5.1; research note 07 section 2.4). A\n * recursive-descent parser over the DOT grammar pushes nodes and edges into the sink as they are\n * mentioned, in first-mention order:\n *\n * - `graph` / `digraph` set the direction through the DirectionResolver (rule 1 of 8.4); `strict`\n * merges parallel edges as cgraph does and is recorded in `meta.extra.dot.strict`; the graph name\n * becomes `meta.name`.\n * - node, edge and graph attribute statements (`node [..]`, `edge [..]`, `graph [..]`, `ID = ID`)\n * are stateful, scoped defaults applied to the elements created after them in the same or a\n * nested subgraph; every element receives its effective attributes as plain cells, so the\n * exporter writes them back explicitly.\n * - edge chains `a -> b -> c` and subgraph endpoints `{a b} -> c` expand to one edge per pair, in\n * cgraph order; a port on an edge endpoint is kept in the `graphty.sourcePort` /\n * `graphty.targetPort` edge columns (roles sourcePort / targetPort) and never part of the id; a\n * port on a node statement has no meaning and is dropped with a warning.\n * - a subgraph named `cluster*` (or carrying `cluster=true`) becomes a container NODE whose id is\n * the cluster name (design section 5.10: containment is the `parent` role, never an adjacency\n * edge); members get `graphty.parent` = the container's index, the container's own attributes are\n * its node cells, and `graphty.cluster` = true marks it. A plain node and a cluster of the same\n * name (fdp's cluster edges) merge into that one node with a warning. Other subgraphs are\n * transparent grouping; their attributes are reported as dropped.\n * - attribute values are ID strings inferred per column by the sink under the 5.1 grammar, except\n * `label` (text, role label), `pos` on a node (the position role column, f32 x3, design section\n * 5.2), `weight` (THE weight, `weightFrom`) and `key` (cgraph's edge identity, the edge id role).\n * - ids are coerced with the common rule (`canonical` by default: `1` and `\"1\"` are the same node,\n * as the DOT grammar says).\n *\n * The whole text is read first (design section 8.4 allows it for DOT). A grammar violation is\n * fatal, as it is for Graphviz itself: the import aborts with ImportError (code E_DOT_SYNTAX)\n * carrying the partial report. Errors the sink raises for one element are recorded and the element\n * is skipped (section 8.6).\n */\n\nimport {\n type ColumnDecl,\n type ColumnHandle,\n GraphFormatError,\n type GraphSink,\n INVALID_INDEX,\n type NodeId,\n} from \"@graphty/graph-format\";\n\nimport { declareResolved } from \"../../common/attributes.js\";\nimport {\n COLUMN_RENAMED_CODE,\n DIRECTION_FORCED_CODE,\n DIRECTION_REFUSED_CODE,\n EMPTY_INPUT_CODE,\n ENCODING_FALLBACK_CODE,\n ID_MERGED_CODE,\n INVALID_ENCODING_CODE,\n INVALID_UTF8_CODE,\n MIXED_DIRECTION_CODE,\n MULTIPLE_GRAPHS_CODE,\n OPTION_IGNORED_CODE,\n ROLE_TAKEN_CODE,\n SINK_OPTION_CODE,\n SYNTAX_CODE,\n UNKNOWN_ENCODING_CODE,\n} from \"../../common/codes.js\";\nimport { DirectionResolver, type EdgeKind } from \"../../common/direction.js\";\nimport { IdCoercer } from \"../../common/ids.js\";\nimport { readText, throwIfAborted } from \"../../common/input.js\";\nimport {\n reportSinkOptions,\n reportUnusedOptions,\n type ResolvedImportOptions,\n resolveImportOptions,\n} from \"../../common/options.js\";\nimport { ImportReportBuilder } from \"../../common/report.js\";\nimport { parseTextCell, TextCellWriter, WIDENING_UNSUPPORTED_CODE } from \"../../common/text.js\";\nimport { parseWeightText } from \"../../common/weights.js\";\nimport { type CommonImportOptions, type GraphImporter, type ImportInput, type ImportReport } from \"../../types.js\";\nimport {\n CLUSTER_COLUMN,\n DOT_FORMAT,\n DOT_ORIGIN,\n KEY_ATTRIBUTE,\n LABEL_ATTRIBUTE,\n PARENT_COLUMN,\n PIN_ATTRIBUTE,\n POS_ATTRIBUTE,\n SOURCE_PORT_COLUMN,\n TARGET_PORT_COLUMN,\n} from \"./names.js\";\nimport { DotSyntaxError, type DotToken, DotTokenizer } from \"./tokenizer.js\";\n\n/** The DOT importer's format-specific options. */\nexport interface DotImportOptions {\n /**\n * What an edge operator that contradicts the graph keyword means (`--` in a digraph, `->` in a\n * graph; a syntax error for Graphviz): \"operator\" (default) reads the edge with the operator's\n * direction and resolves it per onMixedDirection, with a warning; \"header\" reads it with the\n * graph's direction, with a warning; \"error\" aborts the import as Graphviz does.\n */\n mismatchedEdgeOperator?: \"operator\" | \"header\" | \"error\" | undefined;\n /**\n * Map a node's `pos` to a `pos` column with the position role and a trailing `!` to `pin`\n * (default true); false keeps `pos` as the text the file wrote, like any other attribute.\n */\n positions?: boolean | undefined;\n}\n\n/**\n * The issue codes the DOT importer records (design section 8.6), by name: the codes shared with\n * the other importers (src/common/codes.ts) and the DOT-specific ones. A key is the code without\n * its severity and format prefixes.\n */\nexport const DOT_ISSUE = Object.freeze({\n /** A grammar violation; fatal. */\n SYNTAX: SYNTAX_CODE,\n /** The input holds no graph at all (empty or only comments); fatal. */\n EMPTY_INPUT: EMPTY_INPUT_CODE,\n /** The input holds invalid UTF-8 (fatal). */\n INVALID_UTF8: INVALID_UTF8_CODE,\n /** Invalid bytes in the encoding a BOM, a declaration or the encoding option chose (fatal). */\n INVALID_ENCODING: INVALID_ENCODING_CODE,\n /** Bytes that are not UTF-8 and declare no encoding were read as windows-1252. */\n ENCODING_FALLBACK: ENCODING_FALLBACK_CODE,\n /** A declared encoding the platform cannot decode was ignored. */\n UNKNOWN_ENCODING: UNKNOWN_ENCODING_CODE,\n /** Subgraphs or braces nested deeper than the parser's limit; fatal. */\n NESTING: \"E_DOT_NESTING\",\n /** An edge operator contradicting the graph keyword (warning under \"operator\" / \"header\"). */\n EDGE_OPERATOR: \"W_DOT_EDGE_OPERATOR\",\n /** A second graph in the same input; only the first is read. */\n MULTIPLE_GRAPHS: MULTIPLE_GRAPHS_CODE,\n /** A badly delimited numeral (`1e3`) split into two tokens, as Graphviz does with a warning. */\n NUMERAL_AMBIGUITY: \"W_DOT_NUMERAL_AMBIGUITY\",\n /** Attributes of a subgraph that is not a cluster (rank=same and the like) cannot be represented. */\n SUBGRAPH_ATTRIBUTES_DROPPED: \"W_DOT_SUBGRAPH_ATTRIBUTES_DROPPED\",\n /** A port on a node statement has no meaning and was dropped. */\n NODE_PORT_DROPPED: \"W_DOT_NODE_PORT_DROPPED\",\n /** A plain node and a cluster share a name and were merged into one container node. */\n CLUSTER_NODE_MERGED: \"W_DOT_CLUSTER_NODE_MERGED\",\n /** A node mentioned in two unrelated clusters keeps the first. */\n CLUSTER_CONFLICT: \"W_DOT_CLUSTER_CONFLICT\",\n /** A node `pos` that is not a point; the value was dropped. */\n BAD_POS: \"W_DOT_BAD_POS\",\n /** A parallel edge merged into an earlier one under `strict`. */\n STRICT_MERGED: \"W_DOT_STRICT_MERGED\",\n /** An edge merged into an earlier one with the same endpoints and `key`. */\n KEY_MERGED: \"W_DOT_KEY_MERGED\",\n /** A role (label, id, position, ...) was already taken in the caller's sink; the column was declared without it. */\n ROLE_TAKEN: ROLE_TAKEN_CODE,\n /** A column of another shape exists in the caller's sink under a name the importer declares; renamed `<name>#<id>`. */\n COLUMN_RENAMED: COLUMN_RENAMED_CODE,\n /** A common option the format has no use for was given a non-default value. */\n OPTION_IGNORED: OPTION_IGNORED_CODE,\n /** Two distinct id texts merged under ids: \"number\". */\n ID_MERGED: ID_MERGED_CODE,\n /** A builder-policy option the sink does not honour. */\n SINK_OPTION: SINK_OPTION_CODE,\n /** The sink refused the file's direction. */\n DIRECTION_REFUSED: DIRECTION_REFUSED_CODE,\n /** Edges forced to the policy's direction. */\n DIRECTION_FORCED: DIRECTION_FORCED_CODE,\n /** A mixed file under onMixedDirection \"error\" (fatal). */\n MIXED_DIRECTION: MIXED_DIRECTION_CODE,\n /** A text column the sink could not widen to the dtype its cells imply. */\n WIDENING_UNSUPPORTED: WIDENING_UNSUPPORTED_CODE,\n});\n\n/** The common options the DOT importer reads (the rest is reported by reportUnusedOptions). */\nconst USED_OPTIONS: ReadonlySet<keyof CommonImportOptions> = new Set<keyof CommonImportOptions>([\n \"ids\",\n \"addMissingNodes\",\n \"duplicateEdges\",\n \"selfLoops\",\n \"onMixedDirection\",\n \"weightFrom\",\n \"weightDtype\",\n \"errorLimit\",\n \"signal\",\n \"onProgress\",\n]);\n\n/** The deepest nesting of subgraphs and braces the parser accepts (each level is one stack frame). */\nconst MAX_NESTING = 1024;\n\nconst EXTENSIONS: readonly string[] = Object.freeze([\".dot\", \".gv\"]);\nconst MIME_TYPES: readonly string[] = Object.freeze([\"text/vnd.graphviz\"]);\nconst CLUSTER_PREFIX = \"cluster\";\nconst CLUSTER_ATTRIBUTE = \"cluster\";\nconst STATEMENTS_PER_ABORT_CHECK = 64;\nconst MAX_ANCESTOR_WALK = 4096;\n\n/**\n * The header keyword, ended by what may follow it in DOT: space, `{`, a quoted ID or a comment.\n * A `[` after it is GML (`Graph [ ... ]`), which DOT never allows there.\n */\nconst DOT_HEADER = /^\\s*(strict\\s+)?(di)?graph(?=[\\s{\"/]|$)(?!\\s*\\[)/i;\nconst TRUE_TEXTS: ReadonlySet<string> = new Set([\"true\", \"yes\", \"1\"]);\nconst POINT_TEXT =\n /^\\s*([-+]?[0-9]*\\.?[0-9]+(?:[eE][-+]?[0-9]+)?)\\s*,\\s*([-+]?[0-9]*\\.?[0-9]+(?:[eE][-+]?[0-9]+)?)(?:\\s*,\\s*([-+]?[0-9]*\\.?[0-9]+(?:[eE][-+]?[0-9]+)?))?\\s*(!?)\\s*$/;\n\n/** An attribute as written: name, value text and the line of the assignment. */\ninterface DotAttribute {\n readonly name: string;\n readonly value: string;\n readonly line: number;\n}\n\n/** Where an edge issue is recorded: the statement's line and the edge's description. */\ninterface EdgeWhere {\n readonly line: number;\n readonly element: string;\n}\n\n/** One endpoint of an edge chain: a mentioned node and its port. */\ninterface Endpoint {\n readonly id: NodeId;\n readonly index: number;\n readonly port: string | null;\n}\n\n/** A lexical scope: the root graph or one subgraph. */\ninterface Scope {\n readonly root: boolean;\n /** The subgraph name, null for the root and for an anonymous subgraph. */\n readonly name: string | null;\n readonly line: number;\n /** Defaults for nodes created in this scope, copied from the enclosing scope on entry. */\n readonly nodeDefaults: Map<string, string>;\n /** Defaults for edges created in this scope. */\n readonly edgeDefaults: Map<string, string>;\n /** Node indices mentioned in this scope (nested scopes included), in first-mention order. */\n readonly members: number[];\n readonly memberSet: Set<number>;\n /** Container nodes of clusters closed inside this scope. */\n readonly containers: number[];\n /** Subgraph attributes buffered until the subgraph closes (the root applies them at once). */\n readonly attributes: Map<string, DotAttribute>;\n /** Whether the subgraph is a cluster (by name or by `cluster=true`). */\n cluster: boolean;\n /** The container node index once created, or INVALID_INDEX. */\n container: number;\n}\n\n/**\n * The importer plugin for DOT / Graphviz text (design section 12.4).\n */\nexport const dotImporter: GraphImporter<DotImportOptions> = Object.freeze({\n format: DOT_FORMAT,\n extensions: EXTENSIONS,\n mimeTypes: MIME_TYPES,\n\n /**\n * Confidence that the head of an input is DOT: the `[strict] graph | digraph` header after\n * optional comments.\n * @param head - the first bytes of the input\n * @returns 0.95 for a header followed by `{`, 0.8 for a header alone, 0 otherwise\n */\n sniff(head: Uint8Array): number {\n const text = stripLeadingComments(new TextDecoder(\"utf-8\").decode(head));\n const match = DOT_HEADER.exec(text);\n if (match === null) {\n return 0;\n }\n return text.includes(\"{\") ? 0.95 : 0.8;\n },\n\n /**\n * Read a DOT document into the sink.\n * @param input - the text, bytes or stream\n * @param sink - the sink to push into\n * @param options - format-specific and common options\n * @returns the import report; ImportError (E_IMPORT) on a syntax error or beyond the error limit\n */\n async import(\n input: ImportInput,\n sink: GraphSink,\n options?: DotImportOptions & CommonImportOptions,\n ): Promise<ImportReport> {\n const resolved = resolveImportOptions(options, {\n ids: \"canonical\",\n defaultDirected: true,\n weightFrom: \"weight\",\n });\n const mismatch = mismatchOption(options?.mismatchedEdgeOperator);\n const report = new ImportReportBuilder(DOT_FORMAT, resolved.errorLimit);\n reportUnusedOptions(options, report, USED_OPTIONS);\n reportSinkOptions(sink, options, report);\n const text = await readText(input, report, { ...resolved, declaredEncoding: dotCharset });\n const reports = { current: report };\n const lexer = dotLexer(text, reports);\n const first = guard(report, () => lexer.next());\n const trailing = parseGraph(\n new DotParser(lexer, sink, report, resolved, mismatch, options?.positions !== false),\n report,\n first,\n );\n if (trailing.kind !== \"eof\") {\n const skipped = guard(report, () => countGraphs(lexer, trailing));\n report.warning(\n \"unsupported\",\n MULTIPLE_GRAPHS_CODE,\n `the input holds ${skipped} more graph(s) after the first; import() reads the first, importAll() reads every one`,\n { line: trailing.line },\n );\n }\n // an abort raised during the last few statements (after the last periodic check) still rejects\n throwIfAborted(resolved.signal);\n return report.finish();\n },\n\n /**\n * Read every graph of a DOT file (Graphviz renders each one), each into its own sink.\n * @param input - the text, bytes or stream\n * @param sinkFor - the sink of the graph with this index, called before its first push\n * @param options - format-specific and common options\n * @returns one report per graph; ImportError (E_IMPORT) on a syntax error anywhere\n */\n async importAll(\n input: ImportInput,\n sinkFor: (index: number) => GraphSink,\n options?: DotImportOptions & CommonImportOptions,\n ): Promise<ImportReport[]> {\n const resolved = resolveImportOptions(options, {\n ids: \"canonical\",\n defaultDirected: true,\n weightFrom: \"weight\",\n });\n const mismatch = mismatchOption(options?.mismatchedEdgeOperator);\n const first = new ImportReportBuilder(DOT_FORMAT, resolved.errorLimit);\n reportUnusedOptions(options, first, USED_OPTIONS);\n const text = await readText(input, first, { ...resolved, declaredEncoding: dotCharset });\n const reports = { current: first };\n const lexer = dotLexer(text, reports);\n const done: ImportReport[] = [];\n let token = guard(first, () => lexer.next());\n do {\n const report = done.length === 0 ? first : new ImportReportBuilder(DOT_FORMAT, resolved.errorLimit);\n reports.current = report;\n const sink = sinkFor(done.length);\n reportSinkOptions(sink, options, report);\n token = parseGraph(\n new DotParser(lexer, sink, report, resolved, mismatch, options?.positions !== false),\n report,\n token,\n );\n throwIfAborted(resolved.signal);\n done.push(report.finish());\n } while (token.kind !== \"eof\");\n return done;\n },\n});\n\n/**\n * The tokenizer of one input; its badly-delimited-numeral warnings go to the report of the graph\n * being read.\n * @param text - the DOT text\n * @param reports - holds the current graph's report\n * @param reports.current - the report warnings are recorded in\n * @returns the tokenizer\n */\nfunction dotLexer(text: string, reports: { current: ImportReportBuilder }): DotTokenizer {\n return new DotTokenizer(text, (numeral, line) => {\n reports.current.warning(\n \"validation-error\",\n DOT_ISSUE.NUMERAL_AMBIGUITY,\n `badly delimited number ${JSON.stringify(numeral)} splits into two tokens (Graphviz warns the same)`,\n { line, element: numeral },\n );\n });\n}\n\n/**\n * Run a step that may throw DotSyntaxError, turning it into the fatal E_SYNTAX issue.\n * @param report - the report of the graph being read\n * @param step - the step\n * @returns the step's result\n */\nfunction guard<T>(report: ImportReportBuilder, step: () => T): T {\n try {\n return step();\n } catch (err) {\n if (err instanceof DotSyntaxError) {\n report.fail(SYNTAX_CODE, err.message, { line: err.line }, { line: err.line });\n }\n throw err;\n }\n}\n\n/**\n * Parse one graph.\n * @param parser - the parser of this graph\n * @param report - its report\n * @param first - the graph's first token (already read)\n * @returns the token after the graph's closing brace\n */\nfunction parseGraph(parser: DotParser, report: ImportReportBuilder, first: DotToken): DotToken {\n return guard(report, () => parser.parse(first));\n}\n\n/**\n * Count the graphs that follow the first one without reading their statements: each must be\n * `[strict] (graph | digraph) [ID] { ... }` with balanced braces, as Graphviz requires.\n * @param lexer - the tokenizer, positioned after `first`\n * @param first - the first token after the first graph\n * @returns how many graphs follow; DotSyntaxError on anything else\n */\nfunction countGraphs(lexer: DotTokenizer, first: DotToken): number {\n let count = 0;\n let token = first;\n while (token.kind !== \"eof\") {\n if (isKeyword(token, \"strict\")) {\n token = lexer.next();\n }\n if (!isKeyword(token, \"graph\") && !isKeyword(token, \"digraph\")) {\n throw new DotSyntaxError(`expected \"graph\" or \"digraph\", found ${describeToken(token)}`, token.line);\n }\n token = lexer.next();\n if (token.kind === \"id\") {\n token = lexer.next();\n }\n if (!isPunct(token, \"{\")) {\n throw new DotSyntaxError(`expected \"{\" after the graph header, found ${describeToken(token)}`, token.line);\n }\n for (let depth = 1; depth > 0; ) {\n token = lexer.next();\n if (token.kind === \"eof\") {\n throw new DotSyntaxError('missing \"}\" at the end of a graph', token.line);\n }\n if (isPunct(token, \"{\")) {\n depth++;\n } else if (isPunct(token, \"}\")) {\n depth--;\n }\n }\n count++;\n token = lexer.next();\n }\n return count;\n}\n\n/** A `charset` attribute assignment (Graphviz's declaration of the input encoding). */\nconst DOT_CHARSET = /\\bcharset\\s*=\\s*\"?([A-Za-z][A-Za-z0-9._-]*)/i;\n\n/**\n * The encoding a DOT file declares with the graph attribute `charset` (Graphviz reads UTF-8,\n * Latin1 and Big-5), for the shared byte decoder; Graphviz's spellings `latin-1` and `big-5` are\n * mapped to the WHATWG labels.\n * @param head - the start of the file, decoded as windows-1252\n * @returns the declared label, or null\n */\nfunction dotCharset(head: string): string | null {\n const match = DOT_CHARSET.exec(head);\n return match === null ? null : match[1].replace(/^(latin|big)-/i, \"$1\");\n}\n\n/**\n * Resolve the mismatchedEdgeOperator option.\n * @param value - the caller's value\n * @returns the value or the default; E_UNSUPPORTED for anything else\n */\nfunction mismatchOption(value: unknown): \"operator\" | \"header\" | \"error\" {\n if (value === undefined) {\n return \"operator\";\n }\n if (value === \"operator\" || value === \"header\" || value === \"error\") {\n return value;\n }\n throw new GraphFormatError(\n \"E_UNSUPPORTED\",\n `option mismatchedEdgeOperator: ${JSON.stringify(value)} is not one of \"operator\", \"header\", \"error\"`,\n { option: \"mismatchedEdgeOperator\", found: value, supported: [\"operator\", \"header\", \"error\"] },\n );\n}\n\n/**\n * Remove leading whitespace and comments from a head sample so the header regex sees the keyword.\n * @param text - the decoded head\n * @returns the text from the first non-comment character\n */\nfunction stripLeadingComments(text: string): string {\n let rest = text;\n for (;;) {\n const trimmed = rest.replace(/^\\s+/, \"\");\n if (trimmed.startsWith(\"//\") || trimmed.startsWith(\"#\")) {\n const nl = trimmed.search(/[\\r\\n]/);\n if (nl < 0) {\n return \"\";\n }\n rest = trimmed.slice(nl);\n continue;\n }\n if (trimmed.startsWith(\"/*\")) {\n const end = trimmed.indexOf(\"*/\");\n if (end < 0) {\n return \"\";\n }\n rest = trimmed.slice(end + 2);\n continue;\n }\n return trimmed;\n }\n}\n\n/**\n * Whether a bare token is a given keyword (keywords are case-insensitive; a quoted id never is).\n * @param token - the token\n * @param keyword - the lower-case keyword\n * @returns true for a match\n */\nfunction isKeyword(token: DotToken, keyword: string): boolean {\n return token.kind === \"id\" && !token.quoted && !token.html && token.text.toLowerCase() === keyword;\n}\n\n/**\n * Whether a token is a given punctuation.\n * @param token - the token\n * @param text - the punctuation\n * @returns true for a match\n */\nfunction isPunct(token: DotToken, text: string): boolean {\n return token.kind === \"punct\" && token.text === text;\n}\n\n/**\n * Whether a token is an edge operator.\n * @param token - the token\n * @returns true for `->` or `--`\n */\nfunction isEdgeOp(token: DotToken): boolean {\n return token.kind === \"punct\" && (token.text === \"->\" || token.text === \"--\");\n}\n\n/**\n * A short description of a token for syntax error messages.\n * @param token - the token\n * @returns `end of input`, or the token text in quotes\n */\nfunction describeToken(token: DotToken): string {\n if (token.kind === \"eof\") {\n return \"end of input\";\n }\n return JSON.stringify(token.text.length > 40 ? `${token.text.slice(0, 40)}...` : token.text);\n}\n\n/**\n * Whether a subgraph name marks a cluster.\n * @param name - the name, or null\n * @returns true when it starts with `cluster`\n */\nfunction isClusterName(name: string | null): boolean {\n return name !== null && name.startsWith(CLUSTER_PREFIX);\n}\n\n/**\n * The parser and pusher for one import call.\n */\nclass DotParser {\n private readonly lexer: DotTokenizer;\n\n private readonly sink: GraphSink;\n\n private readonly report: ImportReportBuilder;\n\n private readonly options: ResolvedImportOptions;\n\n private readonly mismatch: \"operator\" | \"header\" | \"error\";\n private readonly positions: boolean;\n\n private readonly ids: IdCoercer;\n\n private readonly resolver: DirectionResolver;\n\n private directed = true;\n\n private strict = false;\n\n private statements = 0;\n\n /** The id of every node mentioned so far, by index (the sink has no idOf). */\n private readonly idOf = new Map<number, NodeId>();\n\n /** Container nodes this import created or adopted. */\n private readonly containers = new Set<number>();\n\n /** The parent assigned to a node by this import. */\n private readonly parentOf = new Map<number, number>();\n\n /** Nodes already warned about a cluster conflict. */\n private readonly conflictWarned = new Set<number>();\n\n /** Under `strict`: the edge index of every (source, target) pair pushed. */\n private readonly strictEdges = new Map<string, number>();\n\n /** The edge index of every (source, target, key) triple pushed. */\n private readonly keyedEdges = new Map<string, number>();\n\n /** Columns of the caller's sink adopted under a name the importer declares with another shape; values are inferred for them. */\n\n private nodeLabelHandle: ColumnHandle = INVALID_INDEX as ColumnHandle;\n\n private edgeLabelHandle: ColumnHandle = INVALID_INDEX as ColumnHandle;\n\n private positionHandle: ColumnHandle = INVALID_INDEX as ColumnHandle;\n\n private clusterHandle: ColumnHandle = INVALID_INDEX as ColumnHandle;\n\n private parentHandle: ColumnHandle = INVALID_INDEX as ColumnHandle;\n\n private keyHandle: ColumnHandle = INVALID_INDEX as ColumnHandle;\n\n private sourcePortHandle: ColumnHandle = INVALID_INDEX as ColumnHandle;\n\n private targetPortHandle: ColumnHandle = INVALID_INDEX as ColumnHandle;\n\n /** The current subgraph nesting depth. */\n private depth = 0;\n\n /** The inferred attribute columns by name, per domain (the 5.1 text grammar per column). */\n private readonly nodeWriters = new Map<string, TextCellWriter>();\n\n private readonly edgeWriters = new Map<string, TextCellWriter>();\n\n /**\n * Create a parser for one graph of a document.\n * @param lexer - the document's tokenizer, positioned at the graph\n * @param sink - the sink\n * @param report - the report\n * @param options - the resolved common options\n * @param mismatch - the resolved mismatchedEdgeOperator option\n * @param positions - whether `pos` goes to the position column\n */\n constructor(\n lexer: DotTokenizer,\n sink: GraphSink,\n report: ImportReportBuilder,\n options: ResolvedImportOptions,\n mismatch: \"operator\" | \"header\" | \"error\",\n positions: boolean,\n ) {\n this.lexer = lexer;\n this.sink = sink;\n this.report = report;\n this.options = options;\n this.mismatch = mismatch;\n this.positions = positions;\n this.ids = new IdCoercer(options.ids);\n this.resolver = new DirectionResolver(sink, report, options.onMixedDirection);\n }\n\n /**\n * Parse one graph: `[strict] (graph | digraph) [ID] { stmt_list }`.\n * @param first - the graph's first token (already read from the tokenizer)\n * @returns the token after the closing brace (eof when the document ends there)\n */\n parse(first: DotToken): DotToken {\n const { lexer } = this;\n let token = first;\n if (token.kind === \"eof\") {\n this.report.fail(EMPTY_INPUT_CODE, \"the input holds no graph (empty or only comments)\", {\n line: token.line,\n });\n }\n if (isKeyword(token, \"strict\")) {\n this.strict = true;\n token = lexer.next();\n }\n if (isKeyword(token, \"digraph\")) {\n this.directed = true;\n } else if (isKeyword(token, \"graph\")) {\n this.directed = false;\n } else {\n throw new DotSyntaxError(`expected \"graph\" or \"digraph\", found ${describeToken(token)}`, token.line);\n }\n const headerLine = token.line;\n token = lexer.next();\n let name: string | null = null;\n if (token.kind === \"id\") {\n name = token.text;\n token = lexer.next();\n }\n if (!isPunct(token, \"{\")) {\n throw new DotSyntaxError(`expected \"{\" after the graph header, found ${describeToken(token)}`, token.line);\n }\n this.resolver.setHeader(this.directed, { line: headerLine });\n this.sink.setMeta({\n name,\n sourceFormat: DOT_FORMAT,\n ...(this.strict ? { extra: { dot: { strict: true } } } : {}),\n });\n const root = this.newScope(null, headerLine, true, null);\n this.statementList(root);\n return lexer.next();\n }\n\n /**\n * Create a scope.\n * @param parent - the enclosing scope, or null for the root\n * @param line - the line the scope opens on\n * @param root - whether this is the root graph\n * @param name - the subgraph name, or null\n * @returns the scope\n */\n private newScope(parent: Scope | null, line: number, root: boolean, name: string | null): Scope {\n return {\n root,\n name,\n line,\n nodeDefaults: new Map(parent?.nodeDefaults),\n edgeDefaults: new Map(parent?.edgeDefaults),\n members: [],\n memberSet: new Set(),\n containers: [],\n attributes: new Map(),\n cluster: false,\n container: INVALID_INDEX,\n };\n }\n\n /**\n * Parse `stmt_list }` for a scope whose `{` was consumed.\n * @param scope - the scope\n */\n private statementList(scope: Scope): void {\n const { lexer } = this;\n for (;;) {\n const token = lexer.peek();\n if (isPunct(token, \"}\")) {\n lexer.next();\n return;\n }\n if (token.kind === \"eof\") {\n throw new DotSyntaxError(\n scope.root\n ? 'unexpected end of input: missing \"}\" closing the graph'\n : `unexpected end of input: missing \"}\" closing the subgraph opened on line ${scope.line}`,\n token.line,\n );\n }\n if (isPunct(token, \";\")) {\n lexer.next();\n continue;\n }\n this.statement(scope);\n if (++this.statements % STATEMENTS_PER_ABORT_CHECK === 0) {\n throwIfAborted(this.options.signal);\n }\n }\n }\n\n /**\n * Parse one statement of a scope.\n * @param scope - the scope\n */\n private statement(scope: Scope): void {\n const { lexer } = this;\n const token = lexer.peek();\n if (token.kind === \"punct\") {\n if (token.text === \"{\") {\n const group = this.subgraph(scope);\n this.maybeEdgeStatement(scope, group, token.line);\n return;\n }\n throw new DotSyntaxError(`unexpected ${describeToken(token)} at the start of a statement`, token.line);\n }\n if (!token.quoted && !token.html) {\n const keyword = token.text.toLowerCase();\n if (keyword === \"node\" || keyword === \"edge\" || keyword === \"graph\") {\n lexer.next();\n this.attributeStatement(scope, keyword, token.line);\n return;\n }\n if (keyword === \"subgraph\") {\n const group = this.subgraph(scope);\n this.maybeEdgeStatement(scope, group, token.line);\n return;\n }\n if (keyword === \"digraph\" || keyword === \"strict\") {\n throw new DotSyntaxError(`unexpected keyword ${describeToken(token)} inside a graph`, token.line);\n }\n }\n // ID '=' ID, a node statement, or an edge statement starting with a node\n const id = this.identifier();\n if (isPunct(lexer.peek(), \"=\")) {\n lexer.next();\n const value = this.identifier();\n this.scopeAttribute(scope, { name: id.text, value: value.text, line: id.line });\n return;\n }\n const port = this.port();\n if (isEdgeOp(lexer.peek())) {\n const endpoint = this.mentionEndpoint(scope, id, port);\n this.edgeStatement(scope, endpoint === null ? [] : [endpoint], id.line);\n return;\n }\n this.nodeStatement(scope, id, port);\n }\n\n /**\n * Read an ID, concatenating quoted strings joined by `+`.\n * @returns the id token (the concatenation keeps the first token's line and quoted flag)\n */\n private identifier(): DotToken {\n const { lexer } = this;\n const token = lexer.next();\n if (token.kind !== \"id\") {\n throw new DotSyntaxError(`expected an identifier, found ${describeToken(token)}`, token.line);\n }\n if (!token.quoted || !isPunct(lexer.peek(), \"+\")) {\n return token;\n }\n let { text } = token;\n while (isPunct(lexer.peek(), \"+\")) {\n const plus = lexer.next();\n const more = lexer.next();\n if (more.kind !== \"id\" || !more.quoted) {\n throw new DotSyntaxError(\n `expected a quoted string after \"+\", found ${describeToken(more)}`,\n more.kind === \"eof\" ? plus.line : more.line,\n );\n }\n text += more.text;\n }\n return { kind: \"id\", text, quoted: true, html: false, line: token.line };\n }\n\n /**\n * Read an optional port after a node id: `: ID [ : compass ]` or `: compass`.\n * @returns the port text (`f0`, `f0:n`, `n`), or null when there is none\n */\n private port(): string | null {\n const { lexer } = this;\n if (!isPunct(lexer.peek(), \":\")) {\n return null;\n }\n lexer.next();\n let { text } = this.identifier();\n if (isPunct(lexer.peek(), \":\")) {\n lexer.next();\n text += `:${this.identifier().text}`;\n }\n return text;\n }\n\n /**\n * Parse `[subgraph [ID]] { stmt_list }` and return its member nodes for use as an edge endpoint.\n * @param parent - the enclosing scope\n * @returns the endpoints (every node mentioned in the subgraph, in first-mention order)\n */\n private subgraph(parent: Scope): Endpoint[] {\n const { lexer } = this;\n let token = lexer.next();\n let name: string | null = null;\n if (isKeyword(token, \"subgraph\")) {\n token = lexer.next();\n if (token.kind === \"id\") {\n name = token.text;\n token = lexer.next();\n }\n }\n if (!isPunct(token, \"{\")) {\n throw new DotSyntaxError(`expected \"{\" to open a subgraph, found ${describeToken(token)}`, token.line);\n }\n if (++this.depth > MAX_NESTING) {\n this.report.fail(\n DOT_ISSUE.NESTING,\n `subgraphs nested deeper than ${MAX_NESTING} levels (the parser recurses per level)`,\n { line: token.line },\n );\n }\n const scope = this.newScope(parent, token.line, false, name);\n if (isClusterName(name)) {\n scope.cluster = true;\n this.ensureContainer(scope);\n }\n this.statementList(scope);\n this.depth--;\n this.closeScope(scope, parent);\n return scope.members.map((index) => ({ id: this.idOf.get(index) ?? index, index, port: null }));\n }\n\n /**\n * Finish a subgraph: apply its attributes to the container node when it is a cluster (or report\n * them dropped), assign parents to its members, and propagate members and containers upward.\n * @param scope - the closed scope\n * @param parent - the enclosing scope\n */\n private closeScope(scope: Scope, parent: Scope): void {\n const { container } = scope;\n if (container !== INVALID_INDEX) {\n for (const attribute of scope.attributes.values()) {\n if (attribute.name !== CLUSTER_ATTRIBUTE) {\n this.setNodeAttribute(container, attribute.name, attribute.value, attribute.line);\n }\n }\n for (const nested of scope.containers) {\n if (nested !== container && !this.parentOf.has(nested)) {\n this.setParent(nested, container);\n }\n }\n for (const member of scope.members) {\n if (member === container) {\n continue;\n }\n const existing = this.parentOf.get(member);\n if (existing === undefined) {\n this.setParent(member, container);\n } else if (existing !== container && !this.isAncestor(container, existing)) {\n this.clusterConflict(member, existing, container, scope.line);\n }\n }\n parent.containers.push(container);\n } else {\n if (scope.attributes.size > 0) {\n const names = [...scope.attributes.keys()].join(\", \");\n this.report.warning(\n \"unsupported\",\n DOT_ISSUE.SUBGRAPH_ATTRIBUTES_DROPPED,\n `subgraph ${scope.name === null ? \"(anonymous)\" : JSON.stringify(scope.name)} is not a cluster; its attributes (${names}) cannot be represented and were dropped`,\n { line: scope.line, element: scope.name },\n );\n }\n for (const nested of scope.containers) {\n parent.containers.push(nested);\n }\n }\n if (!parent.root) {\n for (const member of scope.members) {\n if (!parent.memberSet.has(member)) {\n parent.memberSet.add(member);\n parent.members.push(member);\n }\n }\n }\n }\n\n /**\n * Whether `candidate` is an ancestor of `node` through the parents assigned so far.\n * @param candidate - the possible ancestor\n * @param node - the node whose chain is walked\n * @returns true when candidate is reached\n */\n private isAncestor(candidate: number, node: number): boolean {\n let current: number | undefined = node;\n for (let steps = 0; current !== undefined && steps < MAX_ANCESTOR_WALK; steps++) {\n if (current === candidate) {\n return true;\n }\n current = this.parentOf.get(current);\n }\n return false;\n }\n\n /**\n * Record a node mentioned in two unrelated clusters (once per node).\n * @param member - the node\n * @param existing - its parent\n * @param container - the cluster it was also mentioned in\n * @param line - the line of the losing cluster\n */\n private clusterConflict(member: number, existing: number, container: number, line: number): void {\n if (this.conflictWarned.has(member)) {\n return;\n }\n this.conflictWarned.add(member);\n const id = this.idOf.get(member) ?? member;\n this.report.warning(\n \"coercion\",\n DOT_ISSUE.CLUSTER_CONFLICT,\n `node ${JSON.stringify(id)} is in cluster ${JSON.stringify(this.idOf.get(existing) ?? existing)} and in cluster ${JSON.stringify(this.idOf.get(container) ?? container)}; the first is kept`,\n { line, element: String(id) },\n );\n }\n\n /**\n * Assign a parent.\n * @param node - the node index\n * @param container - the container index\n */\n private setParent(node: number, container: number): void {\n if (node === container) {\n return;\n }\n try {\n this.sink.setNodeValue(this.parentColumn(), node, container);\n this.parentOf.set(node, container);\n } catch (err) {\n this.report.recordError(err, { element: String(this.idOf.get(node) ?? node) });\n }\n }\n\n /**\n * Create (or adopt) the container node of a cluster scope.\n * @param scope - the cluster scope\n */\n private ensureContainer(scope: Scope): void {\n if (scope.container !== INVALID_INDEX || scope.name === null) {\n return;\n }\n const id = this.coerceId(scope.name, scope.line);\n if (id === null) {\n return;\n }\n let index = this.sink.indexOf(id);\n try {\n if (index === INVALID_INDEX) {\n index = this.sink.addNode(id);\n this.report.counts.nodes++;\n } else if (!this.containers.has(index)) {\n this.report.warning(\n \"coercion\",\n DOT_ISSUE.CLUSTER_NODE_MERGED,\n `cluster ${JSON.stringify(scope.name)} and the node of the same name were merged into one container node`,\n { line: scope.line, element: scope.name },\n );\n }\n this.idOf.set(index, id);\n if (!this.containers.has(index)) {\n this.containers.add(index);\n this.sink.setNodeValue(this.clusterColumn(), index, true);\n }\n scope.container = index;\n } catch (err) {\n this.report.recordError(err, { line: scope.line, element: scope.name });\n if (index === INVALID_INDEX) {\n this.report.counts.skippedNodes++;\n }\n }\n }\n\n /**\n * Apply an `ID = ID` or `graph [..]` attribute: the graph table at the root, a buffered\n * subgraph attribute otherwise (`cluster=true` turns the subgraph into a cluster).\n * @param scope - the scope\n * @param attribute - the attribute\n */\n private scopeAttribute(scope: Scope, attribute: DotAttribute): void {\n if (scope.root) {\n this.setGraphAttribute(attribute);\n return;\n }\n scope.attributes.set(attribute.name, attribute);\n if (attribute.name === CLUSTER_ATTRIBUTE && TRUE_TEXTS.has(attribute.value.trim().toLowerCase())) {\n scope.cluster = true;\n this.ensureContainer(scope);\n }\n }\n\n /**\n * Parse `node|edge|graph attr_list` after the keyword.\n * @param scope - the scope\n * @param keyword - which defaults are set\n * @param line - the keyword's line\n */\n private attributeStatement(scope: Scope, keyword: string, line: number): void {\n if (!isPunct(this.lexer.peek(), \"[\")) {\n const found = this.lexer.peek();\n throw new DotSyntaxError(`expected \"[\" after \"${keyword}\", found ${describeToken(found)}`, found.line);\n }\n const attributes = this.attributeList();\n switch (keyword) {\n case \"node\":\n for (const a of attributes) {\n scope.nodeDefaults.set(a.name, a.value);\n }\n break;\n case \"edge\":\n for (const a of attributes) {\n scope.edgeDefaults.set(a.name, a.value);\n }\n break;\n case \"graph\":\n for (const a of attributes) {\n this.scopeAttribute(scope, a);\n }\n break;\n default:\n throw new DotSyntaxError(`unknown attribute statement \"${keyword}\"`, line);\n }\n }\n\n /**\n * Parse one or more `[ a_list ]` groups.\n * @returns the attributes in order (a repeated name keeps its last value at application time)\n */\n private attributeList(): DotAttribute[] {\n const { lexer } = this;\n const out: DotAttribute[] = [];\n while (isPunct(lexer.peek(), \"[\")) {\n lexer.next();\n for (;;) {\n const token = lexer.peek();\n if (isPunct(token, \"]\")) {\n lexer.next();\n break;\n }\n if (isPunct(token, \";\") || isPunct(token, \",\")) {\n lexer.next();\n continue;\n }\n const name = this.identifier();\n const eq = lexer.next();\n if (!isPunct(eq, \"=\")) {\n throw new DotSyntaxError(\n `expected \"=\" after attribute name ${JSON.stringify(name.text)}, found ${describeToken(eq)}`,\n eq.line,\n );\n }\n const value = this.identifier();\n out.push({ name: name.text, value: value.text, line: name.line });\n }\n }\n return out;\n }\n\n /**\n * Parse a node statement after its id and port: an optional attribute list, then apply.\n * @param scope - the scope\n * @param id - the id token\n * @param port - the port, if any (dropped with a warning)\n */\n private nodeStatement(scope: Scope, id: DotToken, port: string | null): void {\n const attributes = this.attributeList();\n const endpoint = this.mentionEndpoint(scope, id, null);\n if (endpoint === null) {\n return;\n }\n if (port !== null) {\n this.report.warning(\n \"unsupported\",\n DOT_ISSUE.NODE_PORT_DROPPED,\n `port ${JSON.stringify(port)} on the node statement of ${JSON.stringify(id.text)} has no meaning and was dropped`,\n { line: id.line, element: id.text },\n );\n }\n for (const attribute of attributes) {\n this.setNodeAttribute(endpoint.index, attribute.name, attribute.value, attribute.line);\n }\n }\n\n /**\n * After a subgraph statement: continue as an edge statement when an edge operator follows.\n * @param scope - the scope\n * @param group - the subgraph's members\n * @param line - the statement's line\n */\n private maybeEdgeStatement(scope: Scope, group: Endpoint[], line: number): void {\n if (isEdgeOp(this.lexer.peek())) {\n this.edgeStatement(scope, group, line);\n }\n }\n\n /**\n * Parse `edgeRHS [attr_list]` after the first endpoint group and push the edges.\n * @param scope - the scope\n * @param first - the first group (empty when its node could not be created)\n * @param line - the statement's line\n */\n private edgeStatement(scope: Scope, first: Endpoint[], line: number): void {\n const { lexer } = this;\n const groups: Endpoint[][] = [first];\n const kinds: EdgeKind[] = [];\n while (isEdgeOp(lexer.peek())) {\n const op = lexer.next();\n kinds.push(this.edgeKind(op));\n const next = lexer.peek();\n if (isPunct(next, \"{\") || isKeyword(next, \"subgraph\")) {\n groups.push(this.subgraph(scope));\n } else {\n const id = this.identifier();\n const port = this.port();\n const endpoint = this.mentionEndpoint(scope, id, port);\n groups.push(endpoint === null ? [] : [endpoint]);\n }\n }\n const attributes = this.attributeList();\n for (let k = 0; k < kinds.length; k++) {\n for (const source of groups[k]) {\n for (const target of groups[k + 1]) {\n this.pushEdge(scope, source, target, kinds[k], attributes, line);\n }\n }\n }\n }\n\n /**\n * The direction of an edge from its operator, checked against the graph keyword.\n * @param op - the operator token\n * @returns the edge kind\n */\n private edgeKind(op: DotToken): EdgeKind {\n const operatorDirected = op.text === \"->\";\n if (operatorDirected === this.directed) {\n return operatorDirected ? \"directed\" : \"undirected\";\n }\n const message = `edge operator \"${op.text}\" in a ${this.directed ? \"digraph\" : \"graph\"}`;\n switch (this.mismatch) {\n case \"error\":\n throw new DotSyntaxError(`${message} (mismatchedEdgeOperator: \"error\")`, op.line);\n case \"header\":\n this.report.warnOnce(\n \"coercion\",\n DOT_ISSUE.EDGE_OPERATOR,\n `${message}; read with the graph's direction (mismatchedEdgeOperator: \"header\")`,\n { line: op.line },\n );\n return this.directed ? \"directed\" : \"undirected\";\n case \"operator\":\n this.report.warnOnce(\n \"coercion\",\n DOT_ISSUE.EDGE_OPERATOR,\n `${message}; read with the operator's direction and resolved per onMixedDirection`,\n { line: op.line },\n );\n return operatorDirected ? \"directed\" : \"undirected\";\n default: {\n const name: string = this.mismatch;\n throw new GraphFormatError(\"E_UNSUPPORTED\", `unknown mismatchedEdgeOperator ${name}`, { found: name });\n }\n }\n }\n\n /**\n * Coerce an id text, recording a merge under ids: \"number\".\n * @param text - the id text\n * @param line - the line, for issues\n * @returns the id, or null when the text was rejected (recorded, node skipped)\n */\n private coerceId(text: string, line: number): NodeId | null {\n try {\n const id = this.ids.text(text);\n const merge = this.ids.lastMerge;\n if (merge !== null) {\n this.report.warning(\n \"coercion\",\n DOT_ISSUE.ID_MERGED,\n `id text ${JSON.stringify(merge.text)} merged with ${JSON.stringify(merge.previousText)} as ${merge.id} under ids: \"number\"`,\n { line, element: text },\n );\n }\n return id;\n } catch (err) {\n this.report.recordError(err, { line, element: text });\n this.report.counts.skippedNodes++;\n return null;\n }\n }\n\n /**\n * Mention a node: create it on first mention (applying the scope's node defaults), record it as\n * a member of the scope, and return it as an endpoint.\n * @param scope - the scope\n * @param id - the id token\n * @param port - the endpoint's port, or null\n * @returns the endpoint, or null when the node could not be created (recorded)\n */\n private mentionEndpoint(scope: Scope, id: DotToken, port: string | null): Endpoint | null {\n const nodeId = this.coerceId(id.text, id.line);\n if (nodeId === null) {\n return null;\n }\n const { sink } = this;\n let index = sink.indexOf(nodeId);\n if (index === INVALID_INDEX) {\n try {\n index = sink.addNode(nodeId);\n } catch (err) {\n this.report.recordError(err, { line: id.line, element: id.text });\n this.report.counts.skippedNodes++;\n return null;\n }\n this.report.counts.nodes++;\n this.idOf.set(index, nodeId);\n for (const [name, value] of scope.nodeDefaults) {\n this.setNodeAttribute(index, name, value, id.line);\n }\n } else if (!this.idOf.has(index)) {\n this.idOf.set(index, nodeId);\n }\n if (!scope.root && !scope.memberSet.has(index)) {\n scope.memberSet.add(index);\n scope.members.push(index);\n }\n return { id: nodeId, index, port };\n }\n\n /**\n * Push one edge with its effective attributes (scope defaults overridden by the statement's).\n * @param scope - the scope\n * @param source - the source endpoint\n * @param target - the target endpoint\n * @param kind - the edge's direction\n * @param attributes - the statement's attributes\n * @param line - the statement's line\n */\n private pushEdge(\n scope: Scope,\n source: Endpoint,\n target: Endpoint,\n kind: EdgeKind,\n attributes: readonly DotAttribute[],\n line: number,\n ): void {\n const effective = new Map(scope.edgeDefaults);\n for (const a of attributes) {\n effective.set(a.name, a.value);\n }\n const element = `${String(source.id)} ${kind === \"directed\" ? \"->\" : \"--\"} ${String(target.id)}`;\n const where: EdgeWhere = { line, element };\n const { weightFrom } = this.options;\n let weight: number | undefined;\n const weightText = weightFrom === null ? undefined : effective.get(weightFrom);\n if (weightText !== undefined) {\n try {\n weight = parseWeightText(weightText);\n } catch (err) {\n this.report.recordError(err, where);\n this.report.counts.skippedEdges++;\n return;\n }\n }\n const key = effective.get(KEY_ATTRIBUTE);\n const dedupeKey = this.dedupeKey(source.index, target.index, kind, key);\n if (dedupeKey !== null) {\n const existing = (this.strict ? this.strictEdges : this.keyedEdges).get(dedupeKey);\n if (existing !== undefined) {\n this.mergeEdge(existing, weight, effective, where, key);\n this.setPorts(existing, source, target, where);\n return;\n }\n }\n const { sink } = this;\n const before = sink.edgeCount;\n let e: number;\n try {\n e = this.resolver.addEdge(source.id, target.id, kind, weight, where);\n } catch (err) {\n this.report.recordError(err, where);\n this.report.counts.skippedEdges++;\n return;\n }\n this.report.counts.edges += sink.edgeCount - before;\n if (dedupeKey !== null) {\n (this.strict ? this.strictEdges : this.keyedEdges).set(dedupeKey, e);\n }\n for (const [name, value] of effective) {\n if (name !== weightFrom) {\n this.setEdgeAttribute(e, name, value, line, element);\n }\n }\n this.setPorts(e, source, target, where);\n }\n\n /**\n * Write the endpoints' ports of an edge, when they have any.\n * @param e - the edge index\n * @param source - the source endpoint\n * @param target - the target endpoint\n * @param where - the line and element\n */\n private setPorts(e: number, source: Endpoint, target: Endpoint, where: EdgeWhere): void {\n if (source.port !== null) {\n this.setPort(e, \"source\", source.port, where);\n }\n if (target.port !== null) {\n this.setPort(e, \"target\", target.port, where);\n }\n }\n\n /**\n * The key under which an edge is merged with an earlier one: every (source, target) pair under\n * `strict` (unordered for an undirected edge), else the (source, target, key) triple of an edge\n * carrying a `key` attribute (cgraph's edge identity).\n * @param source - the source index\n * @param target - the target index\n * @param kind - the edge's direction\n * @param key - the `key` attribute, or undefined\n * @returns the dedupe key, or null when the edge is never merged\n */\n private dedupeKey(source: number, target: number, kind: EdgeKind, key: string | undefined): string | null {\n const ordered = kind === \"undirected\" && target < source ? `${target}>${source}` : `${source}>${target}`;\n if (this.strict) {\n return ordered;\n }\n return key === undefined ? null : `${ordered}#${key}`;\n }\n\n /**\n * Merge a repeated edge into the earlier one: its attributes overwrite, an explicit weight too.\n * @param e - the existing edge index\n * @param weight - the repeated edge's weight, or undefined\n * @param effective - the repeated edge's effective attributes\n * @param where - the line and element\n * @param key - the `key` attribute when the merge is by key\n */\n private mergeEdge(\n e: number,\n weight: number | undefined,\n effective: ReadonlyMap<string, string>,\n where: EdgeWhere,\n key: string | undefined,\n ): void {\n const byKey = !this.strict && key !== undefined;\n this.report.warning(\n \"merged\",\n byKey ? DOT_ISSUE.KEY_MERGED : DOT_ISSUE.STRICT_MERGED,\n byKey\n ? `edge ${where.element} with key ${JSON.stringify(key)} repeats an earlier edge; attributes merged`\n : `parallel edge ${where.element} merged into the earlier one (strict graph)`,\n where,\n );\n try {\n if (weight !== undefined) {\n this.sink.setEdgeWeight(e, weight);\n }\n } catch (err) {\n this.report.recordError(err, where);\n }\n for (const [name, value] of effective) {\n if (name !== this.options.weightFrom) {\n this.setEdgeAttribute(e, name, value, where.line, where.element);\n }\n }\n }\n\n /**\n * Write one node attribute: `label` to the label column, `pos` to the position column,\n * anything else as an inferred cell.\n * @param index - the node index\n * @param name - the attribute name\n * @param value - the value text\n * @param line - the line, for issues\n */\n private setNodeAttribute(index: number, name: string, value: string, line: number): void {\n const element = String(this.idOf.get(index) ?? index);\n try {\n if (name === LABEL_ATTRIBUTE) {\n this.sink.setNodeValue(this.nodeLabel(), index, value);\n } else if (name === POS_ATTRIBUTE && this.positions) {\n this.setPosition(index, value, line, element);\n } else {\n this.textWriter(\"node\", name).write(index, value);\n }\n } catch (err) {\n this.report.recordError(err, { line, element });\n }\n }\n\n /**\n * Write one edge attribute: `label` to the label column, `key` to the edge id column, anything\n * else as an inferred cell.\n * @param e - the edge index\n * @param name - the attribute name\n * @param value - the value text\n * @param line - the line, for issues\n * @param element - the edge description, for issues\n */\n private setEdgeAttribute(e: number, name: string, value: string, line: number, element: string): void {\n try {\n if (name === LABEL_ATTRIBUTE) {\n this.setEdgeText(this.edgeLabel(), e, value);\n } else if (name === KEY_ATTRIBUTE) {\n this.setEdgeText(this.keyColumn(), e, value);\n } else {\n this.textWriter(\"edge\", name).write(e, value);\n }\n } catch (err) {\n this.report.recordError(err, { line, element });\n }\n }\n\n /**\n * Write a graph attribute (the root's `ID = ID` and `graph [..]`).\n * @param attribute - the attribute\n */\n private setGraphAttribute(attribute: DotAttribute): void {\n try {\n if (attribute.name === LABEL_ATTRIBUTE) {\n this.sink.setGraphValue(attribute.name, attribute.value, { dtype: \"string\", origin: DOT_ORIGIN });\n } else {\n this.sink.setGraphValue(attribute.name, parseTextCell(attribute.value), { origin: DOT_ORIGIN });\n }\n } catch (err) {\n this.report.recordError(err, { line: attribute.line, element: attribute.name });\n }\n }\n\n /**\n * Write a node's `pos`: `x,y[,z][!]` into the position column, the `!` as `pin` = true.\n * @param index - the node index\n * @param text - the pos text\n * @param line - the line\n * @param element - the node id text\n */\n private setPosition(index: number, text: string, line: number, element: string): void {\n const match = POINT_TEXT.exec(text);\n if (match === null) {\n this.report.warning(\n \"validation-error\",\n DOT_ISSUE.BAD_POS,\n `pos ${JSON.stringify(text)} is not a point \"x,y[,z][!]\"; dropped`,\n { line, element },\n );\n return;\n }\n const x = Number(match[1]);\n const y = Number(match[2]);\n const z = match[3] === undefined ? 0 : Number(match[3]);\n const dims = match[3] === undefined ? 2 : 3;\n this.sink.setNodeValue(this.positionColumn(dims), index, [x, y, z]);\n if (match[4] === \"!\") {\n this.sink.setNodeValue(PIN_ATTRIBUTE, index, true);\n }\n }\n\n /**\n * Write an endpoint's port into the source / target port column.\n * @param e - the edge index\n * @param side - which endpoint\n * @param port - the port text\n * @param where - the line and element\n */\n private setPort(e: number, side: \"source\" | \"target\", port: string, where: EdgeWhere): void {\n try {\n this.setEdgeText(side === \"source\" ? this.sourcePortColumn() : this.targetPortColumn(), e, port);\n } catch (err) {\n this.report.recordError(err, where);\n }\n }\n\n /**\n * Write a text cell into one of the importer's edge text columns.\n * @param handle - the column\n * @param e - the edge index\n * @param text - the text\n */\n private setEdgeText(handle: ColumnHandle, e: number, text: string): void {\n this.sink.setEdgeValue(handle, e, text);\n }\n\n // ============================================================ lazily declared columns\n\n /**\n * The node label column (string, role label).\n * @returns the handle\n */\n private nodeLabel(): ColumnHandle {\n if (this.nodeLabelHandle === INVALID_INDEX) {\n this.nodeLabelHandle = this.declare(\"node\", {\n name: LABEL_ATTRIBUTE,\n dtype: \"string\",\n nullable: true,\n role: \"label\",\n origin: DOT_ORIGIN,\n });\n }\n return this.nodeLabelHandle;\n }\n\n /**\n * The edge label column (string, role label).\n * @returns the handle\n */\n private edgeLabel(): ColumnHandle {\n if (this.edgeLabelHandle === INVALID_INDEX) {\n this.edgeLabelHandle = this.declare(\"edge\", {\n name: LABEL_ATTRIBUTE,\n dtype: \"string\",\n nullable: true,\n role: \"label\",\n origin: DOT_ORIGIN,\n });\n }\n return this.edgeLabelHandle;\n }\n\n /**\n * The position column (f32 x3, role position, design section 5.2), declared on the first `pos`.\n * @param dims - the dimensions of the first value, recorded in extra.sourceDims\n * @returns the handle\n */\n private positionColumn(dims: 2 | 3): ColumnHandle {\n if (this.positionHandle === INVALID_INDEX) {\n this.positionHandle = this.declare(\"node\", {\n name: POS_ATTRIBUTE,\n dtype: \"f32\",\n components: 3,\n nullable: true,\n mutable: true,\n role: \"position\",\n origin: { ...DOT_ORIGIN, type: \"point\" },\n extra: { sourceDims: dims, units: \"file\" },\n });\n }\n return this.positionHandle;\n }\n\n /**\n * The cluster marker column (bool).\n * @returns the handle\n */\n private clusterColumn(): ColumnHandle {\n if (this.clusterHandle === INVALID_INDEX) {\n this.clusterHandle = this.declare(\"node\", {\n name: CLUSTER_COLUMN,\n dtype: \"bool\",\n nullable: true,\n origin: DOT_ORIGIN,\n });\n }\n return this.clusterHandle;\n }\n\n /**\n * The parent column (u32, role parent, refersTo node).\n * @returns the handle\n */\n private parentColumn(): ColumnHandle {\n if (this.parentHandle === INVALID_INDEX) {\n this.parentHandle = this.declare(\"node\", {\n name: PARENT_COLUMN,\n dtype: \"u32\",\n nullable: true,\n role: \"parent\",\n refersTo: \"node\",\n origin: DOT_ORIGIN,\n });\n }\n return this.parentHandle;\n }\n\n /**\n * The edge key column (string, role id): cgraph's edge identity within a source / target pair.\n * @returns the handle\n */\n private keyColumn(): ColumnHandle {\n if (this.keyHandle === INVALID_INDEX) {\n this.keyHandle = this.declare(\"edge\", {\n name: KEY_ATTRIBUTE,\n dtype: \"string\",\n nullable: true,\n role: \"id\",\n origin: { ...DOT_ORIGIN, id: KEY_ATTRIBUTE },\n });\n }\n return this.keyHandle;\n }\n\n /**\n * The source port column (string, role sourcePort).\n * @returns the handle\n */\n private sourcePortColumn(): ColumnHandle {\n if (this.sourcePortHandle === INVALID_INDEX) {\n this.sourcePortHandle = this.declare(\"edge\", {\n name: SOURCE_PORT_COLUMN,\n dtype: \"string\",\n nullable: true,\n role: \"sourcePort\",\n origin: DOT_ORIGIN,\n });\n }\n return this.sourcePortHandle;\n }\n\n /**\n * The target port column (string, role targetPort).\n * @returns the handle\n */\n private targetPortColumn(): ColumnHandle {\n if (this.targetPortHandle === INVALID_INDEX) {\n this.targetPortHandle = this.declare(\"edge\", {\n name: TARGET_PORT_COLUMN,\n dtype: \"string\",\n nullable: true,\n role: \"targetPort\",\n origin: DOT_ORIGIN,\n });\n }\n return this.targetPortHandle;\n }\n\n /**\n * The inferred-column writer of an attribute name in a domain (design section 5.1: the column's\n * dtype follows the text grammar per column; a caller's column of the name receives parsed\n * values through the sink's own inference).\n * @param domain - node or edge\n * @param name - the attribute name\n * @returns the writer\n */\n private textWriter(domain: \"node\" | \"edge\", name: string): TextCellWriter {\n const writers = domain === \"node\" ? this.nodeWriters : this.edgeWriters;\n let writer = writers.get(name);\n if (writer === undefined) {\n writer = new TextCellWriter(name, domain, this.sink, this.report);\n writers.set(name, writer);\n }\n return writer;\n }\n\n /**\n * Declare one of the importer's columns on the sink through the shared design section 5.6\n * rule: a caller's sink that already holds the role gets the column without it (reported), one\n * that holds the name with another shape gets it renamed `<name>#<id>` (reported).\n * @param domain - node or edge\n * @param decl - the declaration\n * @returns the handle\n */\n private declare(domain: \"node\" | \"edge\", decl: ColumnDecl): ColumnHandle {\n const withId: ColumnDecl =\n decl.origin?.id === undefined ? { ...decl, origin: { ...decl.origin, id: decl.name } } : decl;\n return declareResolved(this.sink, domain, withId, this.report, { element: decl.name }).handle;\n }\n}\n"],"names":["CLUSTER_PREFIX"],"mappings":";;;;;;AASO,MAAM,aAAa;AAGnB,MAAM,aAAgC,OAAO,OAAO,EAAE,QAAQ,YAAY;AAG1E,MAAM,iBAAiB;AAGvB,MAAM,gBAAgB;AAGtB,MAAM,qBAAqB;AAG3B,MAAM,qBAAqB;AAG3B,MAAM,kBAAkB;AAGxB,MAAM,gBAAgB;AAGtB,MAAM,gBAAgB;AAGtB,MAAM,gBAAgB;AAGtB,MAAM,eAAe;ACYrB,MAAM,WAAW,OAAO,OAAO;AAAA;AAAA,EAElC,oBAAoB;AAAA;AAAA,EAEpB,YAAY;AAAA;AAAA,EAEZ,eAAe,KAAK;AAAA;AAAA,EAEpB,iBAAiB;AAAA;AAAA,EAEjB,iBAAiB,KAAK;AAAA;AAAA,EAEtB,iBAAiB,KAAK;AAAA;AAAA,EAEtB,gBAAgB;AAAA;AAAA,EAEhB,cAAc,KAAK;AAAA;AAAA,EAEnB,sBAAsB,KAAK;AAAA;AAAA,EAE3B,cAAc,KAAK;AACvB,CAAC;AAGD,MAAM,iCAAsC,IAAI,CAAC,SAAS,MAAM,cAAc,cAAc,QAAQ,CAAC;AAGrG,MAAM,aAA+C,OAAO,OAAO;A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