@diagrammo/dgmo 0.15.1 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (122) hide show
  1. package/README.md +9 -9
  2. package/dist/advanced.cjs +612 -734
  3. package/dist/advanced.d.cts +42 -36
  4. package/dist/advanced.d.ts +42 -36
  5. package/dist/advanced.js +612 -733
  6. package/dist/auto.cjs +508 -620
  7. package/dist/auto.js +105 -105
  8. package/dist/auto.mjs +508 -620
  9. package/dist/cli.cjs +144 -144
  10. package/dist/editor.cjs +8 -9
  11. package/dist/editor.js +8 -9
  12. package/dist/highlight.cjs +8 -9
  13. package/dist/highlight.js +8 -9
  14. package/dist/index.cjs +497 -608
  15. package/dist/index.js +497 -608
  16. package/dist/internal.cjs +612 -734
  17. package/dist/internal.d.cts +42 -36
  18. package/dist/internal.d.ts +42 -36
  19. package/dist/internal.js +612 -733
  20. package/dist/pert.d.cts +2 -2
  21. package/dist/pert.d.ts +2 -2
  22. package/docs/language-reference.md +97 -84
  23. package/docs/migration-sequence-color-to-tags.md +1 -1
  24. package/gallery/fixtures/area.dgmo +3 -3
  25. package/gallery/fixtures/bar-stacked.dgmo +5 -5
  26. package/gallery/fixtures/boxes-and-lines.dgmo +2 -2
  27. package/gallery/fixtures/c4-full.dgmo +8 -8
  28. package/gallery/fixtures/class-full.dgmo +2 -2
  29. package/gallery/fixtures/doughnut.dgmo +6 -6
  30. package/gallery/fixtures/flowchart-colors.dgmo +3 -3
  31. package/gallery/fixtures/function.dgmo +3 -3
  32. package/gallery/fixtures/gantt-full.dgmo +9 -9
  33. package/gallery/fixtures/gantt.dgmo +7 -7
  34. package/gallery/fixtures/infra-full.dgmo +6 -6
  35. package/gallery/fixtures/infra.dgmo +2 -2
  36. package/gallery/fixtures/kanban.dgmo +9 -9
  37. package/gallery/fixtures/line.dgmo +2 -2
  38. package/gallery/fixtures/multi-line.dgmo +3 -3
  39. package/gallery/fixtures/org-full.dgmo +6 -6
  40. package/gallery/fixtures/quadrant.dgmo +2 -2
  41. package/gallery/fixtures/sankey.dgmo +9 -9
  42. package/gallery/fixtures/scatter.dgmo +3 -3
  43. package/gallery/fixtures/sequence-tags-protocols.dgmo +11 -11
  44. package/gallery/fixtures/sequence-tags.dgmo +10 -10
  45. package/gallery/fixtures/sequence.dgmo +4 -4
  46. package/gallery/fixtures/sitemap-full.dgmo +7 -7
  47. package/gallery/fixtures/slope.dgmo +5 -5
  48. package/gallery/fixtures/spr-eras.dgmo +9 -9
  49. package/gallery/fixtures/timeline.dgmo +3 -3
  50. package/gallery/fixtures/venn.dgmo +3 -3
  51. package/package.json +7 -3
  52. package/src/advanced.ts +0 -1
  53. package/src/auto/index.ts +2 -2
  54. package/src/boxes-and-lines/layout.ts +1 -2
  55. package/src/boxes-and-lines/renderer.ts +5 -1
  56. package/src/c4/parser.ts +2 -2
  57. package/src/c4/renderer.ts +15 -8
  58. package/src/chart.ts +18 -9
  59. package/src/class/parser.ts +8 -7
  60. package/src/class/renderer.ts +17 -6
  61. package/src/cli.ts +8 -8
  62. package/src/completion.ts +14 -17
  63. package/src/cycle/parser.ts +15 -1
  64. package/src/cycle/renderer.ts +6 -3
  65. package/src/d3.ts +88 -49
  66. package/src/diagnostics.ts +20 -0
  67. package/src/echarts.ts +28 -11
  68. package/src/editor/dgmo.grammar +1 -3
  69. package/src/editor/dgmo.grammar.d.ts +1 -1
  70. package/src/editor/dgmo.grammar.js +8 -8
  71. package/src/editor/dgmo.grammar.terms.js +11 -12
  72. package/src/editor/highlight-api.ts +0 -1
  73. package/src/editor/highlight.ts +0 -1
  74. package/src/er/parser.ts +19 -12
  75. package/src/er/renderer.ts +19 -7
  76. package/src/gantt/parser.ts +1 -1
  77. package/src/gantt/renderer.ts +7 -4
  78. package/src/graph/flowchart-parser.ts +18 -84
  79. package/src/graph/flowchart-renderer.ts +6 -8
  80. package/src/graph/layout.ts +0 -2
  81. package/src/graph/state-parser.ts +17 -62
  82. package/src/graph/state-renderer.ts +3 -8
  83. package/src/infra/parser.ts +21 -11
  84. package/src/infra/renderer.ts +8 -6
  85. package/src/journey-map/parser.ts +11 -4
  86. package/src/journey-map/renderer.ts +3 -1
  87. package/src/kanban/parser.ts +11 -7
  88. package/src/kanban/renderer.ts +3 -1
  89. package/src/mindmap/parser.ts +4 -5
  90. package/src/mindmap/renderer.ts +2 -1
  91. package/src/org/parser.ts +3 -3
  92. package/src/org/renderer.ts +4 -3
  93. package/src/pert/analyzer.ts +10 -10
  94. package/src/pert/layout.ts +1 -1
  95. package/src/pert/parser.ts +8 -8
  96. package/src/pert/renderer.ts +7 -2
  97. package/src/pert/types.ts +1 -1
  98. package/src/pyramid/parser.ts +13 -1
  99. package/src/raci/parser.ts +42 -12
  100. package/src/raci/renderer.ts +2 -1
  101. package/src/raci/types.ts +4 -3
  102. package/src/ring/parser.ts +13 -1
  103. package/src/sequence/parser.ts +81 -23
  104. package/src/sequence/participant-inference.ts +18 -181
  105. package/src/sequence/renderer.ts +48 -137
  106. package/src/sitemap/layout.ts +0 -2
  107. package/src/sitemap/parser.ts +12 -38
  108. package/src/sitemap/renderer.ts +13 -13
  109. package/src/sitemap/types.ts +0 -1
  110. package/src/tech-radar/parser.ts +2 -2
  111. package/src/tech-radar/renderer.ts +5 -3
  112. package/src/tech-radar/types.ts +2 -0
  113. package/src/utils/arrows.ts +3 -28
  114. package/src/utils/extract-alias.ts +1 -1
  115. package/src/utils/inline-markdown.ts +1 -1
  116. package/src/utils/legend-d3.ts +12 -6
  117. package/src/utils/legend-layout.ts +1 -1
  118. package/src/utils/legend-types.ts +1 -1
  119. package/src/utils/parsing.ts +64 -35
  120. package/src/utils/tag-groups.ts +98 -18
  121. package/src/utils/time-ticks.ts +1 -1
  122. package/src/wireframe/parser.ts +3 -3
package/dist/advanced.cjs CHANGED
@@ -76,6 +76,9 @@ function nameMergedMessage(args) {
76
76
  function akaRemovedMessage() {
77
77
  return `'aka' is no longer supported \u2014 use the participant name directly`;
78
78
  }
79
+ function participantTypeRemovedMessage(type) {
80
+ return `'${type}' is no longer supported \u2014 drop 'is a ${type}'; the participant renders as the default rectangle`;
81
+ }
79
82
  function tagShorthandRemovedMessage(args) {
80
83
  return `Bare tag shorthand 'tag ${args.name} ${args.alias}' was removed. Use 'tag ${args.name} as ${args.alias}' instead.`;
81
84
  }
@@ -109,7 +112,15 @@ var init_diagnostics = __esm({
109
112
  * participant declaration. Forgiving normalization makes aliasing
110
113
  * unnecessary; the diagnostic directs users to the new syntax.
111
114
  */
112
- AKA_REMOVED: "E_AKA_REMOVED"
115
+ AKA_REMOVED: "E_AKA_REMOVED",
116
+ /**
117
+ * Error: a removed sequence participant-type keyword was used in
118
+ * an `is a X` declaration. The 0.16.0 trim retained only
119
+ * `actor`/`database`/`cache`/`queue`; `service`/`frontend`/
120
+ * `networking`/`gateway`/`external` no longer carry semantic
121
+ * weight and emit this error so users drop the override.
122
+ */
123
+ PARTICIPANT_TYPE_REMOVED: "E_PARTICIPANT_TYPE_REMOVED"
113
124
  };
114
125
  ALIAS_DIAGNOSTIC_CODES = {
115
126
  /** Alias token used before its declaration (strict-ordering rule). */
@@ -140,114 +151,6 @@ var init_diagnostics = __esm({
140
151
  }
141
152
  });
142
153
 
143
- // src/colors.ts
144
- function isRecognizedColorName(name) {
145
- return Object.prototype.hasOwnProperty.call(colorNames, name.toLowerCase());
146
- }
147
- function resolveColor(color, palette) {
148
- if (!color) return null;
149
- if (color.startsWith("#")) return null;
150
- const lower = color.toLowerCase();
151
- if (!isRecognizedColorName(lower)) return null;
152
- if (palette) {
153
- const named = palette.colors[lower];
154
- if (named) return named;
155
- }
156
- return colorNames[lower];
157
- }
158
- function resolveColorWithDiagnostic(color, line12, diagnostics, palette) {
159
- const resolved = resolveColor(color, palette);
160
- if (resolved !== null) return resolved;
161
- const hint = suggest(color, RECOGNIZED_COLOR_NAMES);
162
- const suggestion = hint ? ` ${hint}` : "";
163
- diagnostics.push(
164
- makeDgmoError(
165
- line12,
166
- `Unknown color "${color}". Allowed: ${RECOGNIZED_COLOR_NAMES.join(", ")}.${suggestion}`,
167
- "warning"
168
- )
169
- );
170
- return void 0;
171
- }
172
- var nord, colorNames, RECOGNIZED_COLOR_NAMES, seriesColors;
173
- var init_colors = __esm({
174
- "src/colors.ts"() {
175
- "use strict";
176
- init_diagnostics();
177
- nord = {
178
- // Polar Night (dark)
179
- nord0: "#2e3440",
180
- nord1: "#3b4252",
181
- nord2: "#434c5e",
182
- nord3: "#4c566a",
183
- // Snow Storm (light)
184
- nord4: "#d8dee9",
185
- nord5: "#e5e9f0",
186
- nord6: "#eceff4",
187
- // Frost (accent blues)
188
- nord7: "#8fbcbb",
189
- nord8: "#88c0d0",
190
- nord9: "#81a1c1",
191
- nord10: "#5e81ac",
192
- // Aurora (colors)
193
- nord11: "#bf616a",
194
- // red
195
- nord12: "#d08770",
196
- // orange
197
- nord13: "#ebcb8b",
198
- // yellow
199
- nord14: "#a3be8c",
200
- // green
201
- nord15: "#b48ead"
202
- // purple
203
- };
204
- colorNames = {
205
- red: nord.nord11,
206
- orange: nord.nord12,
207
- yellow: nord.nord13,
208
- green: nord.nord14,
209
- blue: nord.nord10,
210
- purple: nord.nord15,
211
- teal: nord.nord7,
212
- cyan: nord.nord8,
213
- gray: nord.nord3,
214
- black: nord.nord0,
215
- white: nord.nord6
216
- };
217
- RECOGNIZED_COLOR_NAMES = Object.freeze([
218
- "red",
219
- "orange",
220
- "yellow",
221
- "green",
222
- "blue",
223
- "purple",
224
- "teal",
225
- "cyan",
226
- "gray",
227
- "black",
228
- "white"
229
- ]);
230
- seriesColors = [
231
- nord.nord10,
232
- // blue
233
- nord.nord14,
234
- // green
235
- nord.nord13,
236
- // yellow
237
- nord.nord12,
238
- // orange
239
- nord.nord15,
240
- // purple
241
- nord.nord11,
242
- // red
243
- nord.nord7,
244
- // teal
245
- nord.nord8
246
- // light blue
247
- ];
248
- }
249
- });
250
-
251
154
  // src/utils/arrows.ts
252
155
  function validateLabelCharacters(label, lineNumber) {
253
156
  const out = [];
@@ -288,15 +191,6 @@ function parseInArrowLabel(rawLabel, lineNumber) {
288
191
  const diagnostics = validateLabelCharacters(trimmed, lineNumber);
289
192
  return { label: trimmed, diagnostics };
290
193
  }
291
- function matchColorParens(content) {
292
- const m = content.match(/^\(([A-Za-z]+)\)$/);
293
- if (!m) return null;
294
- const candidate = m[1].toLowerCase();
295
- if (RECOGNIZED_COLOR_NAMES.includes(candidate)) {
296
- return candidate;
297
- }
298
- return null;
299
- }
300
194
  function parseArrow(line12) {
301
195
  if (BIDI_SYNC_RE.test(line12) || BIDI_ASYNC_RE.test(line12)) {
302
196
  return {
@@ -335,7 +229,6 @@ var init_arrows = __esm({
335
229
  "src/utils/arrows.ts"() {
336
230
  "use strict";
337
231
  init_diagnostics();
338
- init_colors();
339
232
  ARROW_DIAGNOSTIC_CODES = {
340
233
  /** Active: label contains `->` or `~>` substring (TD-13). */
341
234
  ARROW_SUBSTRING_IN_LABEL: "E_ARROW_SUBSTRING_IN_LABEL",
@@ -697,6 +590,114 @@ var init_time_ticks = __esm({
697
590
  }
698
591
  });
699
592
 
593
+ // src/colors.ts
594
+ function isRecognizedColorName(name) {
595
+ return Object.prototype.hasOwnProperty.call(colorNames, name.toLowerCase());
596
+ }
597
+ function resolveColor(color, palette) {
598
+ if (!color) return null;
599
+ if (color.startsWith("#")) return null;
600
+ const lower = color.toLowerCase();
601
+ if (!isRecognizedColorName(lower)) return null;
602
+ if (palette) {
603
+ const named = palette.colors[lower];
604
+ if (named) return named;
605
+ }
606
+ return colorNames[lower];
607
+ }
608
+ function resolveColorWithDiagnostic(color, line12, diagnostics, palette) {
609
+ const resolved = resolveColor(color, palette);
610
+ if (resolved !== null) return resolved;
611
+ const hint = suggest(color, RECOGNIZED_COLOR_NAMES);
612
+ const suggestion = hint ? ` ${hint}` : "";
613
+ diagnostics.push(
614
+ makeDgmoError(
615
+ line12,
616
+ `Unknown color "${color}". Allowed: ${RECOGNIZED_COLOR_NAMES.join(", ")}.${suggestion}`,
617
+ "warning"
618
+ )
619
+ );
620
+ return void 0;
621
+ }
622
+ var nord, colorNames, RECOGNIZED_COLOR_NAMES, seriesColors;
623
+ var init_colors = __esm({
624
+ "src/colors.ts"() {
625
+ "use strict";
626
+ init_diagnostics();
627
+ nord = {
628
+ // Polar Night (dark)
629
+ nord0: "#2e3440",
630
+ nord1: "#3b4252",
631
+ nord2: "#434c5e",
632
+ nord3: "#4c566a",
633
+ // Snow Storm (light)
634
+ nord4: "#d8dee9",
635
+ nord5: "#e5e9f0",
636
+ nord6: "#eceff4",
637
+ // Frost (accent blues)
638
+ nord7: "#8fbcbb",
639
+ nord8: "#88c0d0",
640
+ nord9: "#81a1c1",
641
+ nord10: "#5e81ac",
642
+ // Aurora (colors)
643
+ nord11: "#bf616a",
644
+ // red
645
+ nord12: "#d08770",
646
+ // orange
647
+ nord13: "#ebcb8b",
648
+ // yellow
649
+ nord14: "#a3be8c",
650
+ // green
651
+ nord15: "#b48ead"
652
+ // purple
653
+ };
654
+ colorNames = {
655
+ red: nord.nord11,
656
+ orange: nord.nord12,
657
+ yellow: nord.nord13,
658
+ green: nord.nord14,
659
+ blue: nord.nord10,
660
+ purple: nord.nord15,
661
+ teal: nord.nord7,
662
+ cyan: nord.nord8,
663
+ gray: nord.nord3,
664
+ black: nord.nord0,
665
+ white: nord.nord6
666
+ };
667
+ RECOGNIZED_COLOR_NAMES = Object.freeze([
668
+ "red",
669
+ "orange",
670
+ "yellow",
671
+ "green",
672
+ "blue",
673
+ "purple",
674
+ "teal",
675
+ "cyan",
676
+ "gray",
677
+ "black",
678
+ "white"
679
+ ]);
680
+ seriesColors = [
681
+ nord.nord10,
682
+ // blue
683
+ nord.nord14,
684
+ // green
685
+ nord.nord13,
686
+ // yellow
687
+ nord.nord12,
688
+ // orange
689
+ nord.nord15,
690
+ // purple
691
+ nord.nord11,
692
+ // red
693
+ nord.nord7,
694
+ // teal
695
+ nord.nord8
696
+ // light blue
697
+ ];
698
+ }
699
+ });
700
+
700
701
  // src/palettes/registry.ts
701
702
  function isValidHex(value) {
702
703
  return /^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.test(value);
@@ -1929,17 +1930,21 @@ function measureIndent(line12) {
1929
1930
  return indent;
1930
1931
  }
1931
1932
  function extractColor(label, palette, diagnostics, line12) {
1932
- const m = label.match(COLOR_SUFFIX_RE);
1933
- if (!m) return { label };
1934
- const colorName = m[1].trim();
1933
+ const lastSpaceIdx = Math.max(
1934
+ label.lastIndexOf(" "),
1935
+ label.lastIndexOf(" ")
1936
+ );
1937
+ if (lastSpaceIdx < 0) return { label };
1938
+ const trailing = label.substring(lastSpaceIdx + 1);
1939
+ if (!RECOGNIZED_COLOR_SET.has(trailing)) return { label };
1935
1940
  let color;
1936
1941
  if (diagnostics && line12 !== void 0) {
1937
- color = resolveColorWithDiagnostic(colorName, line12, diagnostics, palette);
1942
+ color = resolveColorWithDiagnostic(trailing, line12, diagnostics, palette);
1938
1943
  } else {
1939
- color = resolveColor(colorName, palette) ?? void 0;
1944
+ color = resolveColor(trailing, palette) ?? void 0;
1940
1945
  }
1941
1946
  return {
1942
- label: label.substring(0, m.index).trim(),
1947
+ label: label.substring(0, lastSpaceIdx).trimEnd(),
1943
1948
  color
1944
1949
  };
1945
1950
  }
@@ -2072,14 +2077,18 @@ function parseSeriesNames(value, lines, lineIndex, palette, diagnostics) {
2072
2077
  }
2073
2078
  return { series, names, nameColors, nameLineNumbers, newIndex };
2074
2079
  }
2075
- function inferArrowColor(label) {
2076
- const lower = label.toLowerCase();
2077
- if (lower === "yes" || lower === "success" || lower === "ok" || lower === "true")
2078
- return "green";
2079
- if (lower === "no" || lower === "fail" || lower === "error" || lower === "false")
2080
- return "red";
2081
- if (lower === "maybe" || lower === "warning") return "orange";
2082
- return void 0;
2080
+ function peelTrailingColorName(label) {
2081
+ const lastSpaceIdx = Math.max(
2082
+ label.lastIndexOf(" "),
2083
+ label.lastIndexOf(" ")
2084
+ );
2085
+ if (lastSpaceIdx < 0) return { label };
2086
+ const trailing = label.substring(lastSpaceIdx + 1);
2087
+ if (!RECOGNIZED_COLOR_SET.has(trailing)) return { label };
2088
+ return {
2089
+ label: label.substring(0, lastSpaceIdx).trimEnd(),
2090
+ colorName: trailing
2091
+ };
2083
2092
  }
2084
2093
  function parsePipeMetadata(segments, aliasMap = /* @__PURE__ */ new Map(), errorMultiplePipes) {
2085
2094
  if (segments.length > 2) {
@@ -2101,11 +2110,14 @@ function parsePipeMetadata(segments, aliasMap = /* @__PURE__ */ new Map(), error
2101
2110
  }
2102
2111
  return metadata;
2103
2112
  }
2104
- var ALL_CHART_TYPES, PIPE_KEY_VALUE_PREFIX_RE, PIPE_LIKELY_STRUCTURED_TAIL_RE, COLOR_SUFFIX_RE, OPTION_NOCOLON_RE, GLOBAL_BOOLEANS, MULTIPLE_PIPE_ERROR;
2113
+ var RECOGNIZED_COLOR_SET, ALL_CHART_TYPES, PIPE_KEY_VALUE_PREFIX_RE, PIPE_LIKELY_STRUCTURED_TAIL_RE, OPTION_NOCOLON_RE, GLOBAL_BOOLEANS, MULTIPLE_PIPE_ERROR;
2105
2114
  var init_parsing = __esm({
2106
2115
  "src/utils/parsing.ts"() {
2107
2116
  "use strict";
2108
2117
  init_colors();
2118
+ RECOGNIZED_COLOR_SET = new Set(
2119
+ RECOGNIZED_COLOR_NAMES
2120
+ );
2109
2121
  ALL_CHART_TYPES = /* @__PURE__ */ new Set([
2110
2122
  // data charts
2111
2123
  "bar",
@@ -2157,7 +2169,6 @@ var init_parsing = __esm({
2157
2169
  ]);
2158
2170
  PIPE_KEY_VALUE_PREFIX_RE = /^\s*[A-Za-z][A-Za-z0-9_-]*\s*:/;
2159
2171
  PIPE_LIKELY_STRUCTURED_TAIL_RE = /,\s*[A-Za-z][A-Za-z0-9_-]*\s*:/;
2160
- COLOR_SUFFIX_RE = /\(([^)]+)\)\s*$/;
2161
2172
  OPTION_NOCOLON_RE = /^([a-z][a-z0-9-]*)\s+(.+)$/i;
2162
2173
  GLOBAL_BOOLEANS = /* @__PURE__ */ new Set([
2163
2174
  "solid-fill",
@@ -2194,7 +2205,7 @@ function parseTagDeclaration(line12) {
2194
2205
  let restStartIdx = 1;
2195
2206
  let valueStart = tokens.length;
2196
2207
  for (let i = 1; i < tokens.length; i++) {
2197
- if (tokens[i].includes("(")) {
2208
+ if (tokens[i].includes(",")) {
2198
2209
  valueStart = i;
2199
2210
  break;
2200
2211
  }
@@ -2226,13 +2237,29 @@ function parseTagDeclaration(line12) {
2226
2237
  restStartIdx = valueStart;
2227
2238
  }
2228
2239
  } else {
2229
- if (tokens[0][0] === '"' || tokens[0][0] === "'") {
2230
- if (tokens.length > 1 && isAliasToken(tokens[1]) && valueStart > 1) {
2240
+ const isColorWord = (s) => RECOGNIZED_COLOR_NAMES.includes(s);
2241
+ if (valueStart < tokens.length) {
2242
+ const commaTokenIdx = valueStart;
2243
+ const lastBeforeComma = tokens[commaTokenIdx].replace(/,$/, "");
2244
+ const firstValueStart = isColorWord(lastBeforeComma) ? commaTokenIdx - 1 : commaTokenIdx;
2245
+ const prefixEnd = firstValueStart;
2246
+ const aliasCandidate = prefixEnd > 1 ? tokens[prefixEnd - 1] : void 0;
2247
+ if (aliasCandidate && isAliasToken(aliasCandidate) && !isColorWord(aliasCandidate)) {
2248
+ alias = aliasCandidate;
2249
+ legacyForm = "bare-shorthand";
2250
+ name = tokens.slice(0, prefixEnd - 1).map((t) => stripQuotes(t)).join(" ");
2251
+ restStartIdx = prefixEnd;
2252
+ } else {
2253
+ name = tokens.slice(0, prefixEnd).map((t) => stripQuotes(t)).join(" ");
2254
+ restStartIdx = prefixEnd;
2255
+ }
2256
+ } else if (tokens[0][0] === '"' || tokens[0][0] === "'") {
2257
+ if (tokens.length > 1 && isAliasToken(tokens[1]) && !isColorWord(tokens[1])) {
2231
2258
  alias = tokens[1];
2232
2259
  legacyForm = "bare-shorthand";
2233
2260
  restStartIdx = 2;
2234
2261
  }
2235
- } else if (valueStart > 1 && isAliasToken(tokens[valueStart - 1])) {
2262
+ } else if (valueStart > 1 && isAliasToken(tokens[valueStart - 1]) && !isColorWord(tokens[valueStart - 1])) {
2236
2263
  alias = tokens[valueStart - 1];
2237
2264
  legacyForm = "bare-shorthand";
2238
2265
  name = tokens.slice(0, valueStart - 1).map((t) => stripQuotes(t)).join(" ");
@@ -2247,10 +2274,13 @@ function parseTagDeclaration(line12) {
2247
2274
  inlineValues = valueStr.split(",").map((v) => v.trim()).filter(Boolean);
2248
2275
  }
2249
2276
  if (!inlineValues || inlineValues.length === 0) {
2250
- const colorMatch = name.match(/\(([^)]+)\)\s*$/);
2251
- if (colorMatch) {
2252
- colorHint = colorMatch[1];
2253
- name = name.substring(0, colorMatch.index).trim();
2277
+ const lastSpaceIdx = name.lastIndexOf(" ");
2278
+ if (lastSpaceIdx > 0) {
2279
+ const trailing = name.substring(lastSpaceIdx + 1);
2280
+ if (RECOGNIZED_COLOR_NAMES.includes(trailing)) {
2281
+ colorHint = trailing;
2282
+ name = name.substring(0, lastSpaceIdx).trimEnd();
2283
+ }
2254
2284
  }
2255
2285
  }
2256
2286
  return {
@@ -2378,6 +2408,7 @@ var init_tag_groups = __esm({
2378
2408
  "use strict";
2379
2409
  init_parsing();
2380
2410
  init_diagnostics();
2411
+ init_colors();
2381
2412
  TAG_BLOCK_NOCOLON_RE = /^tag\s+/i;
2382
2413
  VALID_TAG_IDENT_RE = /^[A-Za-z_][A-Za-z0-9_-]*$/;
2383
2414
  }
@@ -2651,7 +2682,7 @@ function buildControlsGroupLayout(config, state) {
2651
2682
  }
2652
2683
  function computeLegendLayout(config, state, containerWidth) {
2653
2684
  const { groups, controls: configControls, mode } = config;
2654
- const isExport = mode === "inline";
2685
+ const isExport = mode === "export";
2655
2686
  const activeGroupName = state.activeGroup?.toLowerCase() ?? null;
2656
2687
  if (isExport && !activeGroupName) {
2657
2688
  return {
@@ -2941,7 +2972,10 @@ function renderLegendD3(container, config, state, palette, isDark, callbacks, co
2941
2972
  const width = containerWidth ?? parseFloat(container.attr("width") || "800");
2942
2973
  let currentState = { ...state };
2943
2974
  let currentLayout;
2944
- const legendG = container.append("g").attr("class", "dgmo-legend");
2975
+ const legendG = container.append("g").attr("class", "dgmo-legend").attr("data-legend-title-relation", config.position.titleRelation).attr(
2976
+ "data-legend-capsule-addon-width",
2977
+ String(config.capsulePillAddonWidth ?? 0)
2978
+ );
2945
2979
  function render2() {
2946
2980
  currentLayout = computeLegendLayout(config, currentState, width);
2947
2981
  legendG.selectAll("*").remove();
@@ -3192,81 +3226,7 @@ var init_participant_inference = __esm({
3192
3226
  // Names that would incorrectly match general patterns in later groups
3193
3227
  { pattern: /^KeyDB$/i, type: "cache" },
3194
3228
  // not database (DB$ suffix)
3195
- { pattern: /Webhook/i, type: "external" },
3196
- // not frontend (Web contains)
3197
- { pattern: /^Upstream$/i, type: "external" },
3198
- // not queue (Stream$ suffix)
3199
- { pattern: /^Downstream$/i, type: "external" },
3200
- // not queue (Stream$ suffix)
3201
- // ── 1. Infrastructure overrides ─────────────────────────
3202
- // These names end in -er/-or but are NOT actors
3203
- { pattern: /^.*Router$/i, type: "networking" },
3204
- { pattern: /^.*Scheduler$/i, type: "service" },
3205
- { pattern: /^.*Dispatcher$/i, type: "service" },
3206
- { pattern: /^.*Balancer$/i, type: "networking" },
3207
- { pattern: /^.*Controller$/i, type: "service" },
3208
- { pattern: /^.*Handler$/i, type: "service" },
3209
- { pattern: /^.*Processor$/i, type: "service" },
3210
- { pattern: /^.*Connector$/i, type: "service" },
3211
- { pattern: /^.*Adapter$/i, type: "service" },
3212
- { pattern: /^.*Provider$/i, type: "service" },
3213
- { pattern: /^.*Manager$/i, type: "service" },
3214
- { pattern: /^.*Orchestrator$/i, type: "service" },
3215
- { pattern: /^.*Monitor$/i, type: "service" },
3216
- { pattern: /^.*Resolver$/i, type: "service" },
3217
- { pattern: /^.*Logger$/i, type: "service" },
3218
- { pattern: /^.*Server$/i, type: "service" },
3219
- { pattern: /^.*Broker$/i, type: "queue" },
3220
- { pattern: /^.*Worker$/i, type: "service" },
3221
- { pattern: /^.*Consumer$/i, type: "service" },
3222
- { pattern: /^.*Producer$/i, type: "service" },
3223
- { pattern: /^.*Publisher$/i, type: "service" },
3224
- { pattern: /^.*Subscriber$/i, type: "service" },
3225
- { pattern: /^.*Listener$/i, type: "service" },
3226
- // New -er/-or suffixes that are services, not actors
3227
- { pattern: /^.*Watcher$/i, type: "service" },
3228
- { pattern: /^.*Executor$/i, type: "service" },
3229
- { pattern: /^.*Aggregator$/i, type: "service" },
3230
- { pattern: /^.*Collector$/i, type: "service" },
3231
- { pattern: /^.*Transformer$/i, type: "service" },
3232
- { pattern: /^.*Validator$/i, type: "service" },
3233
- { pattern: /^.*Generator$/i, type: "service" },
3234
- { pattern: /^.*Indexer$/i, type: "service" },
3235
- { pattern: /^.*Crawler$/i, type: "service" },
3236
- { pattern: /^.*Scanner$/i, type: "service" },
3237
- { pattern: /^.*Parser$/i, type: "service" },
3238
- { pattern: /^.*Emitter$/i, type: "service" },
3239
- { pattern: /^.*Exporter$/i, type: "service" },
3240
- { pattern: /^.*Importer$/i, type: "service" },
3241
- { pattern: /^.*Loader$/i, type: "service" },
3242
- { pattern: /^.*Renderer$/i, type: "service" },
3243
- { pattern: /^.*Checker$/i, type: "service" },
3244
- { pattern: /^.*Inspector$/i, type: "service" },
3245
- { pattern: /^.*Encoder$/i, type: "service" },
3246
- { pattern: /^.*Decoder$/i, type: "service" },
3247
- { pattern: /^.*Notifier$/i, type: "service" },
3248
- // ── 2. Networking patterns ──────────────────────────────
3249
- { pattern: /Gateway/i, type: "networking" },
3250
- { pattern: /GW$/i, type: "networking" },
3251
- { pattern: /Proxy/i, type: "networking" },
3252
- { pattern: /LB$/i, type: "networking" },
3253
- { pattern: /LoadBalancer/i, type: "networking" },
3254
- { pattern: /CDN/i, type: "networking" },
3255
- { pattern: /Firewall/i, type: "networking" },
3256
- { pattern: /WAF$/i, type: "networking" },
3257
- { pattern: /DNS/i, type: "networking" },
3258
- { pattern: /Ingress/i, type: "networking" },
3259
- // Named products & patterns
3260
- { pattern: /Nginx/i, type: "networking" },
3261
- { pattern: /Traefik/i, type: "networking" },
3262
- { pattern: /Envoy/i, type: "networking" },
3263
- { pattern: /Istio/i, type: "networking" },
3264
- { pattern: /Kong/i, type: "networking" },
3265
- { pattern: /Akamai/i, type: "networking" },
3266
- { pattern: /Cloudflare/i, type: "networking" },
3267
- { pattern: /Mesh$/i, type: "networking" },
3268
- { pattern: /ServiceMesh/i, type: "networking" },
3269
- // ── 3. Database patterns ────────────────────────────────
3229
+ // ── 1. Database patterns ────────────────────────────────
3270
3230
  { pattern: /DB$/i, type: "database" },
3271
3231
  { pattern: /Database/i, type: "database" },
3272
3232
  { pattern: /Datastore/i, type: "database" },
@@ -3300,16 +3260,15 @@ var init_participant_inference = __esm({
3300
3260
  { pattern: /Milvus/i, type: "database" },
3301
3261
  { pattern: /Presto/i, type: "database" },
3302
3262
  { pattern: /Table$/i, type: "database" },
3303
- // ── 4. Cache patterns ──────────────────────────────────
3263
+ // ── 2. Cache patterns ──────────────────────────────────
3304
3264
  { pattern: /Cache/i, type: "cache" },
3305
3265
  { pattern: /Redis/i, type: "cache" },
3306
3266
  { pattern: /Memcache/i, type: "cache" },
3307
- // CDN already matched by networking above
3308
3267
  // Named products
3309
3268
  { pattern: /Dragonfly/i, type: "cache" },
3310
3269
  { pattern: /Hazelcast/i, type: "cache" },
3311
3270
  { pattern: /Valkey/i, type: "cache" },
3312
- // ── 5. Queue/Messaging patterns ─────────────────────────
3271
+ // ── 3. Queue/Messaging patterns ─────────────────────────
3313
3272
  { pattern: /Queue/i, type: "queue" },
3314
3273
  { pattern: /MQ$/i, type: "queue" },
3315
3274
  { pattern: /SQS/i, type: "queue" },
@@ -3322,6 +3281,7 @@ var init_participant_inference = __esm({
3322
3281
  { pattern: /Stream$/i, type: "queue" },
3323
3282
  { pattern: /SNS/i, type: "queue" },
3324
3283
  { pattern: /PubSub/i, type: "queue" },
3284
+ { pattern: /Broker$/i, type: "queue" },
3325
3285
  // Named products & patterns
3326
3286
  { pattern: /NATS/i, type: "queue" },
3327
3287
  { pattern: /Pulsar/i, type: "queue" },
@@ -3332,7 +3292,7 @@ var init_participant_inference = __esm({
3332
3292
  { pattern: /Sidekiq/i, type: "queue" },
3333
3293
  { pattern: /EventHub/i, type: "queue" },
3334
3294
  { pattern: /Channel$/i, type: "queue" },
3335
- // ── 6. Actor patterns ──────────────────────────────────
3295
+ // ── 4. Actor patterns ──────────────────────────────────
3336
3296
  // Exact matches first
3337
3297
  { pattern: /^Admin$/i, type: "actor" },
3338
3298
  { pattern: /^User$/i, type: "actor" },
@@ -3351,98 +3311,11 @@ var init_participant_inference = __esm({
3351
3311
  { pattern: /^Fan$/i, type: "actor" },
3352
3312
  { pattern: /^Purchaser$/i, type: "actor" },
3353
3313
  { pattern: /^Reviewer$/i, type: "actor" },
3354
- // Suffix rules (after infrastructure overrides filtered above)
3314
+ // Suffix rules
3355
3315
  { pattern: /User$/i, type: "actor" },
3356
3316
  { pattern: /Actor$/i, type: "actor" },
3357
3317
  { pattern: /Analyst$/i, type: "actor" },
3358
- { pattern: /Staff$/i, type: "actor" },
3359
- // ── 7. Frontend patterns ────────────────────────────────
3360
- { pattern: /App$/i, type: "frontend" },
3361
- { pattern: /Application/i, type: "frontend" },
3362
- { pattern: /Mobile/i, type: "frontend" },
3363
- { pattern: /iOS/i, type: "frontend" },
3364
- { pattern: /Android/i, type: "frontend" },
3365
- { pattern: /Web/i, type: "frontend" },
3366
- { pattern: /Browser/i, type: "frontend" },
3367
- { pattern: /Frontend/i, type: "frontend" },
3368
- { pattern: /UI$/i, type: "frontend" },
3369
- { pattern: /Dashboard/i, type: "frontend" },
3370
- { pattern: /CLI$/i, type: "frontend" },
3371
- { pattern: /Terminal/i, type: "frontend" },
3372
- // Frameworks & patterns
3373
- { pattern: /React/i, type: "frontend" },
3374
- { pattern: /^Vue$/i, type: "frontend" },
3375
- { pattern: /Angular/i, type: "frontend" },
3376
- { pattern: /Svelte/i, type: "frontend" },
3377
- { pattern: /NextJS/i, type: "frontend" },
3378
- { pattern: /Nuxt/i, type: "frontend" },
3379
- { pattern: /Remix/i, type: "frontend" },
3380
- { pattern: /Electron/i, type: "frontend" },
3381
- { pattern: /Tauri/i, type: "frontend" },
3382
- { pattern: /Widget$/i, type: "frontend" },
3383
- { pattern: /Portal/i, type: "frontend" },
3384
- { pattern: /Console$/i, type: "frontend" },
3385
- { pattern: /^SPA$/i, type: "frontend" },
3386
- { pattern: /^PWA$/i, type: "frontend" },
3387
- // ── 8. Service patterns ─────────────────────────────────
3388
- { pattern: /Service/i, type: "service" },
3389
- { pattern: /Svc$/i, type: "service" },
3390
- { pattern: /API$/i, type: "service" },
3391
- { pattern: /Lambda/i, type: "service" },
3392
- { pattern: /Function$/i, type: "service" },
3393
- { pattern: /Fn$/i, type: "service" },
3394
- { pattern: /Job$/i, type: "service" },
3395
- { pattern: /Cron/i, type: "service" },
3396
- { pattern: /Microservice/i, type: "service" },
3397
- // Auth
3398
- { pattern: /^Auth$/i, type: "service" },
3399
- { pattern: /^AuthN$/i, type: "service" },
3400
- { pattern: /^AuthZ$/i, type: "service" },
3401
- { pattern: /^SSO$/i, type: "service" },
3402
- { pattern: /OAuth/i, type: "service" },
3403
- { pattern: /^OIDC$/i, type: "service" },
3404
- // SaaS
3405
- { pattern: /Stripe/i, type: "service" },
3406
- { pattern: /Twilio/i, type: "service" },
3407
- { pattern: /SendGrid/i, type: "service" },
3408
- { pattern: /Mailgun/i, type: "service" },
3409
- // Cloud/infra
3410
- { pattern: /^S3$/i, type: "service" },
3411
- { pattern: /^Blob$/i, type: "service" },
3412
- { pattern: /Vercel/i, type: "service" },
3413
- { pattern: /Netlify/i, type: "service" },
3414
- { pattern: /Heroku/i, type: "service" },
3415
- { pattern: /Docker/i, type: "service" },
3416
- { pattern: /Kubernetes/i, type: "service" },
3417
- { pattern: /K8s/i, type: "service" },
3418
- { pattern: /Terraform/i, type: "service" },
3419
- // Security
3420
- { pattern: /Vault/i, type: "service" },
3421
- { pattern: /^HSM$/i, type: "service" },
3422
- { pattern: /KMS/i, type: "service" },
3423
- { pattern: /^IAM$/i, type: "service" },
3424
- // AI/ML
3425
- { pattern: /^LLM$/i, type: "service" },
3426
- { pattern: /GPT/i, type: "service" },
3427
- { pattern: /^Claude$/i, type: "service" },
3428
- { pattern: /Embedding/i, type: "service" },
3429
- { pattern: /Inference/i, type: "service" },
3430
- // Suffixes & patterns
3431
- { pattern: /Pipeline$/i, type: "service" },
3432
- { pattern: /Registry/i, type: "service" },
3433
- { pattern: /Engine$/i, type: "service" },
3434
- { pattern: /Daemon/i, type: "service" },
3435
- // ── 9. External patterns ────────────────────────────────
3436
- { pattern: /External/i, type: "external" },
3437
- { pattern: /Ext$/i, type: "external" },
3438
- { pattern: /ThirdParty/i, type: "external" },
3439
- { pattern: /3P$/i, type: "external" },
3440
- { pattern: /Vendor/i, type: "external" },
3441
- // Named products & patterns
3442
- { pattern: /Callback/i, type: "external" },
3443
- { pattern: /^AWS$/i, type: "external" },
3444
- { pattern: /^GCP$/i, type: "external" },
3445
- { pattern: /Azure/i, type: "external" }
3318
+ { pattern: /Staff$/i, type: "actor" }
3446
3319
  ];
3447
3320
  RULE_COUNT = PARTICIPANT_RULES.length;
3448
3321
  }
@@ -3670,7 +3543,7 @@ function parseSequenceDgmo(content) {
3670
3543
  const pushWarning = (line12, message) => {
3671
3544
  result.diagnostics.push(makeDgmoError(line12, message, "warning"));
3672
3545
  };
3673
- if (!content || !content.trim()) {
3546
+ if (!content?.trim()) {
3674
3547
  return fail(0, "Empty content");
3675
3548
  }
3676
3549
  const lines = content.split("\n");
@@ -3681,7 +3554,7 @@ function parseSequenceDgmo(content) {
3681
3554
  const fl = lines[fi].trim();
3682
3555
  if (!fl || fl.startsWith("//")) continue;
3683
3556
  const parsed = parseFirstLine(fl);
3684
- if (parsed && parsed.chartType === "sequence") {
3557
+ if (parsed?.chartType === "sequence") {
3685
3558
  hasExplicitChart = true;
3686
3559
  firstLineIndex = fi;
3687
3560
  if (parsed.title) {
@@ -3800,7 +3673,7 @@ function parseSequenceDgmo(content) {
3800
3673
  if (groupColor) {
3801
3674
  pushWarning(
3802
3675
  lineNumber,
3803
- `(${groupColor}) color syntax removed from sequence diagrams \u2014 use 'tag:' groups for coloring`
3676
+ `'(${groupColor})' parens-color syntax removed from sequence diagrams \u2014 use 'tag:' groups for coloring`
3804
3677
  );
3805
3678
  }
3806
3679
  contentStarted = true;
@@ -3880,7 +3753,7 @@ function parseSequenceDgmo(content) {
3880
3753
  if (!color) {
3881
3754
  pushError(
3882
3755
  lineNumber,
3883
- `Expected 'Value(color)' in tag group '${currentTagGroup.name}'`
3756
+ `Expected 'Value color' in tag group '${currentTagGroup.name}'`
3884
3757
  );
3885
3758
  continue;
3886
3759
  }
@@ -3904,11 +3777,13 @@ function parseSequenceDgmo(content) {
3904
3777
  blockStack.pop();
3905
3778
  }
3906
3779
  const labelRaw = sectionMatch[1].trim();
3907
- const colorMatch = labelRaw.match(/^(.+?)\(([^)]+)\)$/);
3780
+ const colorMatch = labelRaw.match(
3781
+ /^(.+?)\((red|orange|yellow|green|blue|purple|teal|cyan|gray|black|white)\)$/
3782
+ );
3908
3783
  if (colorMatch) {
3909
3784
  pushWarning(
3910
3785
  lineNumber,
3911
- `(${colorMatch[2].trim()}) color syntax removed from sequence diagrams \u2014 use 'tag:' groups for coloring`
3786
+ `'(${colorMatch[2]})' parens-color syntax removed from sequence diagrams \u2014 use 'tag:' groups for coloring`
3912
3787
  );
3913
3788
  }
3914
3789
  contentStarted = true;
@@ -3994,6 +3869,17 @@ function parseSequenceDgmo(content) {
3994
3869
  const id = isAMatch[1];
3995
3870
  const typeStr = isAMatch[2].toLowerCase();
3996
3871
  let remainder = isAMatch[3]?.trim() || "";
3872
+ if (REMOVED_PARTICIPANT_TYPES.has(typeStr)) {
3873
+ result.diagnostics.push(
3874
+ makeDgmoError(
3875
+ lineNumber,
3876
+ participantTypeRemovedMessage(typeStr),
3877
+ "error",
3878
+ NAME_DIAGNOSTIC_CODES.PARTICIPANT_TYPE_REMOVED
3879
+ )
3880
+ );
3881
+ continue;
3882
+ }
3997
3883
  const participantType = VALID_PARTICIPANT_TYPES.has(
3998
3884
  typeStr
3999
3885
  ) ? typeStr : "default";
@@ -4063,7 +3949,7 @@ function parseSequenceDgmo(content) {
4063
3949
  const color = coloredMatch[2].trim();
4064
3950
  pushError(
4065
3951
  lineNumber,
4066
- `'${id}(${color})' syntax is no longer supported \u2014 use 'tag:' groups for coloring`
3952
+ `'${id}(${color})' parens-color syntax is no longer supported \u2014 use 'tag:' groups for coloring`
4067
3953
  );
4068
3954
  contentStarted = true;
4069
3955
  const key = addParticipant(id, lineNumber, { metadata: colorMeta });
@@ -4294,6 +4180,25 @@ function parseSequenceDgmo(content) {
4294
4180
  }
4295
4181
  continue;
4296
4182
  }
4183
+ const elifMatch = trimmed.match(/^elif\b\s*(.*)$/i);
4184
+ if (elifMatch) {
4185
+ const tailRaw = elifMatch[1].trim();
4186
+ const tail = tailRaw ? " " + tailRaw : "";
4187
+ pushError(
4188
+ lineNumber,
4189
+ `'elif' is not a keyword. Did you mean 'else if${tail}'?`
4190
+ );
4191
+ continue;
4192
+ }
4193
+ const elseLabelMatch = trimmed.match(/^else\s+(.+)$/i);
4194
+ if (elseLabelMatch) {
4195
+ const tail = elseLabelMatch[1].trim();
4196
+ pushError(
4197
+ lineNumber,
4198
+ `'else' does not take a label. Did you mean 'else if ${tail}'?`
4199
+ );
4200
+ continue;
4201
+ }
4297
4202
  {
4298
4203
  const noteParsed = parseNoteLine(
4299
4204
  trimmed,
@@ -4417,7 +4322,7 @@ function looksLikeSequence(content) {
4417
4322
  return ARROW_PATTERN.test(trimmed);
4418
4323
  });
4419
4324
  }
4420
- var KNOWN_SEQ_OPTIONS, KNOWN_SEQ_BOOLEANS, VALID_PARTICIPANT_TYPES, IS_A_PATTERN, POSITION_ONLY_PATTERN, COLORED_PARTICIPANT_PATTERN, GROUP_HEADING_PATTERN, GROUP_HEADING_FALLBACK, LEGACY_GROUP_PATTERN, SECTION_PATTERN, ARROW_PATTERN, NOTE_BARE, NOTE_MULTI;
4325
+ var KNOWN_SEQ_OPTIONS, KNOWN_SEQ_BOOLEANS, VALID_PARTICIPANT_TYPES, REMOVED_PARTICIPANT_TYPES, IS_A_PATTERN, POSITION_ONLY_PATTERN, COLORED_PARTICIPANT_PATTERN, GROUP_HEADING_PATTERN, GROUP_HEADING_FALLBACK, LEGACY_GROUP_PATTERN, SECTION_PATTERN, ARROW_PATTERN, NOTE_BARE, NOTE_MULTI;
4421
4326
  var init_parser = __esm({
4422
4327
  "src/sequence/parser.ts"() {
4423
4328
  "use strict";
@@ -4430,19 +4335,21 @@ var init_parser = __esm({
4430
4335
  KNOWN_SEQ_OPTIONS = /* @__PURE__ */ new Set(["active-tag"]);
4431
4336
  KNOWN_SEQ_BOOLEANS = /* @__PURE__ */ new Set(["activations", "solid-fill", "no-title"]);
4432
4337
  VALID_PARTICIPANT_TYPES = /* @__PURE__ */ new Set([
4433
- "service",
4434
4338
  "database",
4435
4339
  "actor",
4436
4340
  "queue",
4437
- "cache",
4438
- "gateway",
4439
- "external",
4341
+ "cache"
4342
+ ]);
4343
+ REMOVED_PARTICIPANT_TYPES = /* @__PURE__ */ new Set([
4344
+ "service",
4345
+ "frontend",
4440
4346
  "networking",
4441
- "frontend"
4347
+ "gateway",
4348
+ "external"
4442
4349
  ]);
4443
4350
  IS_A_PATTERN = /^([^:]+?)\s+is\s+an?\s+(\w+)(?:\s+(.+))?$/i;
4444
4351
  POSITION_ONLY_PATTERN = /^([^:]+?)\s+position\s+(-?\d+)$/i;
4445
- COLORED_PARTICIPANT_PATTERN = /^(\S+?)\(([^)]+)\)\s*$/;
4352
+ COLORED_PARTICIPANT_PATTERN = /^(\S+?)\((red|orange|yellow|green|blue|purple|teal|cyan|gray|black|white)\)\s*$/;
4446
4353
  GROUP_HEADING_PATTERN = /^\[([^\]|]+?)(?:\(([^)]+)\))?\]\s*(.*)$/;
4447
4354
  GROUP_HEADING_FALLBACK = /^\[([^\]]+)\]\s*(.*)$/;
4448
4355
  LEGACY_GROUP_PATTERN = /^##\s+(.+?)(?:\(([^)]+)\))?\s*$/;
@@ -4511,7 +4418,6 @@ function splitArrows(line12) {
4511
4418
  const arrowEnd = idx + 2;
4512
4419
  let arrowStart;
4513
4420
  let label;
4514
- let color;
4515
4421
  let openingStart = -1;
4516
4422
  for (let i = scanFloor; i < runStart; i++) {
4517
4423
  if (line12[i] !== "-") continue;
@@ -4524,21 +4430,13 @@ function splitArrows(line12) {
4524
4430
  if (openingStart !== -1) {
4525
4431
  let openingEnd = openingStart;
4526
4432
  while (openingEnd < runStart && line12[openingEnd] === "-") openingEnd++;
4527
- const arrowContent = line12.substring(openingEnd, runStart);
4528
- const colorMatch = arrowContent.match(/\(([^)]+)\)\s*$/);
4529
- if (colorMatch) {
4530
- color = colorMatch[1].trim();
4531
- const labelPart = arrowContent.substring(0, colorMatch.index).trim();
4532
- if (labelPart) label = labelPart;
4533
- } else {
4534
- const labelPart = arrowContent.trim();
4535
- if (labelPart) label = labelPart;
4536
- }
4433
+ const labelPart = line12.substring(openingEnd, runStart).trim();
4434
+ if (labelPart) label = labelPart;
4537
4435
  arrowStart = openingStart;
4538
4436
  } else {
4539
4437
  arrowStart = runStart;
4540
4438
  }
4541
- arrowPositions.push({ start: arrowStart, end: arrowEnd, label, color });
4439
+ arrowPositions.push({ start: arrowStart, end: arrowEnd, label });
4542
4440
  searchFrom = arrowEnd;
4543
4441
  scanFloor = arrowEnd;
4544
4442
  }
@@ -4552,11 +4450,7 @@ function splitArrows(line12) {
4552
4450
  if (beforeText || i === 0) {
4553
4451
  segments.push(beforeText);
4554
4452
  }
4555
- let arrowToken = "->";
4556
- if (arrow.label && arrow.color)
4557
- arrowToken = `-${arrow.label}(${arrow.color})->`;
4558
- else if (arrow.label) arrowToken = `-${arrow.label}->`;
4559
- else if (arrow.color) arrowToken = `-(${arrow.color})->`;
4453
+ const arrowToken = arrow.label ? `-${arrow.label}->` : "->";
4560
4454
  segments.push(arrowToken);
4561
4455
  lastIndex = arrow.end;
4562
4456
  }
@@ -4566,45 +4460,14 @@ function splitArrows(line12) {
4566
4460
  }
4567
4461
  return segments;
4568
4462
  }
4569
- function parseArrowToken(token, palette, lineNumber, diagnostics) {
4463
+ function parseArrowToken(token, _palette, lineNumber, diagnostics) {
4570
4464
  if (token === "->") return {};
4571
- const bareParen = token.match(/^-(\([A-Za-z]+\))->$/);
4572
- if (bareParen) {
4573
- const colorName = matchColorParens(bareParen[1]);
4574
- if (colorName) {
4575
- return {
4576
- color: resolveColorWithDiagnostic(
4577
- colorName,
4578
- lineNumber,
4579
- diagnostics,
4580
- palette
4581
- )
4582
- };
4583
- }
4584
- }
4585
- const m = token.match(/^-(.+?)(?:\(([^)]+)\))?->$/);
4465
+ const m = token.match(/^-(.+?)->$/);
4586
4466
  if (m) {
4587
4467
  const rawLabel = m[1] ?? "";
4588
4468
  const labelResult = parseInArrowLabel(rawLabel, lineNumber);
4589
4469
  diagnostics.push(...labelResult.diagnostics);
4590
- const label = labelResult.label;
4591
- let color = m[2] ? resolveColorWithDiagnostic(
4592
- m[2].trim(),
4593
- lineNumber,
4594
- diagnostics,
4595
- palette
4596
- ) : void 0;
4597
- if (label && !color) {
4598
- const inferred = inferArrowColor(label);
4599
- if (inferred)
4600
- color = resolveColorWithDiagnostic(
4601
- inferred,
4602
- lineNumber,
4603
- diagnostics,
4604
- palette
4605
- );
4606
- }
4607
- return { label, color };
4470
+ return { label: labelResult.label };
4608
4471
  }
4609
4472
  return {};
4610
4473
  }
@@ -4670,13 +4533,12 @@ function parseFlowchart(content, palette) {
4670
4533
  result.nodes.push(node);
4671
4534
  return node;
4672
4535
  }
4673
- function addEdge(sourceId, targetId, lineNumber, label, color) {
4536
+ function addEdge(sourceId, targetId, lineNumber, label) {
4674
4537
  const edge = {
4675
4538
  source: sourceId,
4676
4539
  target: targetId,
4677
4540
  lineNumber,
4678
- ...label && { label },
4679
- ...color && { color }
4541
+ ...label && { label }
4680
4542
  };
4681
4543
  result.edges.push(edge);
4682
4544
  }
@@ -4742,13 +4604,7 @@ function parseFlowchart(content, palette) {
4742
4604
  if (pendingArrow !== null) {
4743
4605
  const sourceId = lastNodeId ?? implicitSourceId;
4744
4606
  if (sourceId) {
4745
- addEdge(
4746
- sourceId,
4747
- node.id,
4748
- lineNumber,
4749
- pendingArrow.label,
4750
- pendingArrow.color
4751
- );
4607
+ addEdge(sourceId, node.id, lineNumber, pendingArrow.label);
4752
4608
  }
4753
4609
  pendingArrow = null;
4754
4610
  } else if (lastNodeId === null && implicitSourceId === null) {
@@ -4873,7 +4729,6 @@ var NODE_ID_RE;
4873
4729
  var init_flowchart_parser = __esm({
4874
4730
  "src/graph/flowchart-parser.ts"() {
4875
4731
  "use strict";
4876
- init_colors();
4877
4732
  init_diagnostics();
4878
4733
  init_arrows();
4879
4734
  init_parsing();
@@ -4901,7 +4756,6 @@ function splitArrows2(line12) {
4901
4756
  const arrowEnd = idx + 2;
4902
4757
  let arrowStart;
4903
4758
  let label;
4904
- let color;
4905
4759
  let openingStart = -1;
4906
4760
  for (let i = scanFloor; i < runStart; i++) {
4907
4761
  if (line12[i] !== "-") continue;
@@ -4914,21 +4768,13 @@ function splitArrows2(line12) {
4914
4768
  if (openingStart !== -1) {
4915
4769
  let openingEnd = openingStart;
4916
4770
  while (openingEnd < runStart && line12[openingEnd] === "-") openingEnd++;
4917
- const arrowContent = line12.substring(openingEnd, runStart);
4918
- const colorMatch = arrowContent.match(/\(([^)]+)\)\s*$/);
4919
- if (colorMatch) {
4920
- color = colorMatch[1].trim();
4921
- const labelPart = arrowContent.substring(0, colorMatch.index).trim();
4922
- if (labelPart) label = labelPart;
4923
- } else {
4924
- const labelPart = arrowContent.trim();
4925
- if (labelPart) label = labelPart;
4926
- }
4771
+ const labelPart = line12.substring(openingEnd, runStart).trim();
4772
+ if (labelPart) label = labelPart;
4927
4773
  arrowStart = openingStart;
4928
4774
  } else {
4929
4775
  arrowStart = runStart;
4930
4776
  }
4931
- arrowPositions.push({ start: arrowStart, end: arrowEnd, label, color });
4777
+ arrowPositions.push({ start: arrowStart, end: arrowEnd, label });
4932
4778
  searchFrom = arrowEnd;
4933
4779
  scanFloor = arrowEnd;
4934
4780
  }
@@ -4938,11 +4784,7 @@ function splitArrows2(line12) {
4938
4784
  const arrow = arrowPositions[i];
4939
4785
  const beforeText = line12.substring(lastIndex, arrow.start).trim();
4940
4786
  if (beforeText || i === 0) segments.push(beforeText);
4941
- let arrowToken = "->";
4942
- if (arrow.label && arrow.color)
4943
- arrowToken = `-${arrow.label}(${arrow.color})->`;
4944
- else if (arrow.label) arrowToken = `-${arrow.label}->`;
4945
- else if (arrow.color) arrowToken = `-(${arrow.color})->`;
4787
+ const arrowToken = arrow.label ? `-${arrow.label}->` : "->";
4946
4788
  segments.push(arrowToken);
4947
4789
  lastIndex = arrow.end;
4948
4790
  }
@@ -4950,35 +4792,14 @@ function splitArrows2(line12) {
4950
4792
  if (remaining) segments.push(remaining);
4951
4793
  return segments;
4952
4794
  }
4953
- function parseArrowToken2(token, palette, lineNumber, diagnostics) {
4795
+ function parseArrowToken2(token, _palette, lineNumber, diagnostics) {
4954
4796
  if (token === "->") return {};
4955
- const bareParen = token.match(/^-(\([A-Za-z]+\))->$/);
4956
- if (bareParen) {
4957
- const colorName = matchColorParens(bareParen[1]);
4958
- if (colorName) {
4959
- return {
4960
- color: resolveColorWithDiagnostic(
4961
- colorName,
4962
- lineNumber,
4963
- diagnostics,
4964
- palette
4965
- )
4966
- };
4967
- }
4968
- }
4969
- const m = token.match(/^-(.+?)(?:\(([^)]+)\))?->$/);
4797
+ const m = token.match(/^-(.+?)->$/);
4970
4798
  if (m) {
4971
4799
  const rawLabel = m[1] ?? "";
4972
4800
  const labelResult = parseInArrowLabel(rawLabel, lineNumber);
4973
4801
  diagnostics.push(...labelResult.diagnostics);
4974
- const label = labelResult.label;
4975
- const color = m[2] ? resolveColorWithDiagnostic(
4976
- m[2].trim(),
4977
- lineNumber,
4978
- diagnostics,
4979
- palette
4980
- ) : void 0;
4981
- return { label, color };
4802
+ return { label: labelResult.label };
4982
4803
  }
4983
4804
  return {};
4984
4805
  }
@@ -5069,13 +4890,12 @@ function parseState(content, palette) {
5069
4890
  }
5070
4891
  return node;
5071
4892
  }
5072
- function addEdge(sourceId, targetId, lineNumber, label, color) {
4893
+ function addEdge(sourceId, targetId, lineNumber, label) {
5073
4894
  result.edges.push({
5074
4895
  source: sourceId,
5075
4896
  target: targetId,
5076
4897
  lineNumber,
5077
- ...label && { label },
5078
- ...color && { color }
4898
+ ...label && { label }
5079
4899
  });
5080
4900
  }
5081
4901
  for (let i = 0; i < lines.length; i++) {
@@ -5218,13 +5038,7 @@ function parseState(content, palette) {
5218
5038
  if (pendingArrow !== null) {
5219
5039
  const sourceId = lastNodeId ?? implicitSourceId;
5220
5040
  if (sourceId) {
5221
- addEdge(
5222
- sourceId,
5223
- node.id,
5224
- lineNumber,
5225
- pendingArrow.label,
5226
- pendingArrow.color
5227
- );
5041
+ addEdge(sourceId, node.id, lineNumber, pendingArrow.label);
5228
5042
  }
5229
5043
  pendingArrow = null;
5230
5044
  }
@@ -5277,7 +5091,7 @@ var init_state_parser = __esm({
5277
5091
  init_name_normalize();
5278
5092
  PSEUDOSTATE_ID = "pseudostate:[*]";
5279
5093
  PSEUDOSTATE_LABEL = "[*]";
5280
- GROUP_BRACKET_RE = /^\[([^\]]+)\](?:\(([^)]+)\))?\s*$/;
5094
+ GROUP_BRACKET_RE = /^\[([^\]]+)\](?:\s+(red|orange|yellow|green|blue|purple|teal|cyan|gray|black|white))?\s*$/;
5281
5095
  }
5282
5096
  });
5283
5097
 
@@ -5425,7 +5239,7 @@ function parseClassDiagram(content, palette) {
5425
5239
  if (trimmed.startsWith("//")) continue;
5426
5240
  if (!contentStarted && indent === 0 && i === 0) {
5427
5241
  const firstLine = parseFirstLine(trimmed);
5428
- if (firstLine && firstLine.chartType === "class") {
5242
+ if (firstLine?.chartType === "class") {
5429
5243
  if (firstLine.title) {
5430
5244
  result.title = firstLine.title;
5431
5245
  result.titleLineNumber = lineNumber;
@@ -5656,7 +5470,7 @@ var init_parser2 = __esm({
5656
5470
  init_arrows();
5657
5471
  init_parsing();
5658
5472
  init_name_normalize();
5659
- CLASS_DECL_RE = /^(?:(abstract|interface|enum)\s+)?(?:"([^"]+)"|([A-Z][^":]*?))(?:\s+extends\s+(?:"([^"]+)"|([A-Z][^":]*?)))?(?:\s+implements\s+(?:"([^"]+)"|([A-Z][^":]*?)))?(?:\s+\[(abstract|interface|enum)\])?(?:\s+\(([^)]+)\))?(?:\s+as\s+([A-Za-z][A-Za-z0-9_]{0,11}))?\s*$/;
5473
+ CLASS_DECL_RE = /^(?:(abstract|interface|enum)\s+)?(?:"([^"]+)"|([A-Z][^":]*?))(?:\s+extends\s+(?:"([^"]+)"|([A-Z][^":]*?)))?(?:\s+implements\s+(?:"([^"]+)"|([A-Z][^":]*?)))?(?:\s+\[(abstract|interface|enum)\])?(?:\s+(red|orange|yellow|green|blue|purple|teal|cyan|gray|black|white))?(?:\s+as\s+([A-Za-z][A-Za-z0-9_]{0,11}))?\s*$/;
5660
5474
  INDENT_REL_ARROW_RE = /^(--\|>|\.\.\|>|\*--|o--|\.\.>|->)\s*(?:"([^"]+)"|([A-Za-z][^":]*?))(?:\s+:?\s*(.+))?$/;
5661
5475
  REL_ARROW_RE = /^(?:"([^"]+)"|([A-Z][^":]*?))\s*(--\|>|\.\.\|>|\*--|o--|\.\.>|->)\s*(?:"([^"]+)"|([A-Z][^":]*?))(?:\s+:?\s*(.+))?$/;
5662
5476
  VISIBILITY_RE = /^([+\-#])\s*/;
@@ -5826,7 +5640,7 @@ function parseERDiagram(content, palette) {
5826
5640
  if (trimmed.startsWith("//")) continue;
5827
5641
  if (!firstLineParsed && indent === 0) {
5828
5642
  const firstLineResult = parseFirstLine(trimmed);
5829
- if (firstLineResult && firstLineResult.chartType === "er") {
5643
+ if (firstLineResult?.chartType === "er") {
5830
5644
  firstLineParsed = true;
5831
5645
  if (firstLineResult.title) {
5832
5646
  result.title = firstLineResult.title;
@@ -5863,7 +5677,7 @@ function parseERDiagram(content, palette) {
5863
5677
  result.diagnostics.push(
5864
5678
  makeDgmoError(
5865
5679
  lineNumber,
5866
- `Expected 'Value(color)' in tag group '${currentTagGroup.name}'`,
5680
+ `Expected 'Value color' in tag group '${currentTagGroup.name}'`,
5867
5681
  "warning"
5868
5682
  )
5869
5683
  );
@@ -5975,7 +5789,7 @@ function parseERDiagram(content, palette) {
5975
5789
  if (result.tables.length === 0 && !result.error) {
5976
5790
  const diag = makeDgmoError(
5977
5791
  1,
5978
- 'No tables found. Add table declarations like "users" or "orders (blue)".'
5792
+ 'No tables found. Add table declarations like "users" or "orders blue".'
5979
5793
  );
5980
5794
  result.diagnostics.push(diag);
5981
5795
  result.error = formatDgmoError(diag);
@@ -6061,15 +5875,19 @@ function extractSymbols3(docText) {
6061
5875
  for (const rawLine of docText.split("\n")) {
6062
5876
  const line12 = rawLine.trim();
6063
5877
  if (inMetadata && /^er(\s|$)/i.test(line12)) continue;
6064
- if (inMetadata && OPTION_NOCOLON_RE.test(line12)) continue;
6065
- inMetadata = false;
6066
- if (line12.length === 0) continue;
6067
5878
  if (/^\s/.test(rawLine)) continue;
5879
+ if (line12.length === 0) continue;
6068
5880
  const m = TABLE_DECL_RE.exec(line12);
6069
5881
  if (m) {
6070
5882
  const name = (m[1] ?? m[2] ?? "").trim();
6071
- if (name) entities.push(name);
5883
+ if (name) {
5884
+ inMetadata = false;
5885
+ entities.push(name);
5886
+ continue;
5887
+ }
6072
5888
  }
5889
+ if (inMetadata && OPTION_NOCOLON_RE.test(line12)) continue;
5890
+ inMetadata = false;
6073
5891
  }
6074
5892
  return {
6075
5893
  kind: "er",
@@ -6087,7 +5905,7 @@ var init_parser3 = __esm({
6087
5905
  init_name_normalize();
6088
5906
  init_parsing();
6089
5907
  init_tag_groups();
6090
- TABLE_DECL_RE = /^(?:"([^"]+)"|([a-zA-Z_][^|":(]*?))(?:\s*\(([^)]+)\))?(?:\s*\|(.+))?$/;
5908
+ TABLE_DECL_RE = /^(?:"([^"]+)"|([a-zA-Z_][^|":(]*?))(?:\s+(red|orange|yellow|green|blue|purple|teal|cyan|gray|black|white))?(?:\s*\|(.+))?$/;
6091
5909
  INDENT_REL_RE = /^([1*?])-{1,2}(?:(.+?)-{1,2})?([1*?])\s+(?:"([^"]+)"|([a-zA-Z_][^":]*?))\s*$/;
6092
5910
  CONSTRAINT_MAP = {
6093
5911
  pk: "pk",
@@ -6167,18 +5985,22 @@ function parseChart(content, palette) {
6167
5985
  return fail(lineNumber, msg2);
6168
5986
  }
6169
5987
  }
6170
- const eraMatch = trimmed.match(
6171
- /^era\s+(.+?)\s*->\s*(.+?)(?:\s*\(([^)]+)\))?\s*$/
6172
- );
5988
+ const eraMatch = trimmed.match(/^era\s+(.+?)\s*->\s*(.+?)\s*$/);
6173
5989
  if (eraMatch) {
6174
5990
  const afterArrow = eraMatch[2].trim();
6175
5991
  const spaceIdx2 = afterArrow.indexOf(" ");
6176
5992
  if (spaceIdx2 >= 0) {
5993
+ const lastSpaceIdx = afterArrow.lastIndexOf(" ");
5994
+ const trailing = afterArrow.substring(lastSpaceIdx + 1);
5995
+ const hasColor = RECOGNIZED_COLOR_NAMES.includes(
5996
+ trailing
5997
+ );
5998
+ const labelPart = hasColor ? afterArrow.substring(0, lastSpaceIdx).trimEnd() : afterArrow;
6177
5999
  rawEras.push({
6178
6000
  start: eraMatch[1].trim(),
6179
- afterArrow,
6180
- color: eraMatch[3] ? resolveColorWithDiagnostic(
6181
- eraMatch[3].trim(),
6001
+ afterArrow: labelPart,
6002
+ color: hasColor ? resolveColorWithDiagnostic(
6003
+ trailing,
6182
6004
  lineNumber,
6183
6005
  result.diagnostics,
6184
6006
  palette
@@ -6691,11 +6513,12 @@ function parseExtendedChart(content, palette) {
6691
6513
  return result;
6692
6514
  }
6693
6515
  }
6694
- const categoryMatch = trimmed.match(/^\[(.+?)\](?:\s*\(([^)]+)\))?\s*$/);
6516
+ const categoryMatch = trimmed.match(/^\[(.+?)\](?:\s+(\S+))?\s*$/);
6695
6517
  if (categoryMatch) {
6696
6518
  const catName = categoryMatch[1].trim();
6697
- const catColor = categoryMatch[2] ? resolveColorWithDiagnostic(
6698
- categoryMatch[2].trim(),
6519
+ const rawCatColor = categoryMatch[2]?.trim();
6520
+ const catColor = rawCatColor ? resolveColorWithDiagnostic(
6521
+ rawCatColor,
6699
6522
  lineNumber,
6700
6523
  result.diagnostics,
6701
6524
  palette
@@ -6710,7 +6533,7 @@ function parseExtendedChart(content, palette) {
6710
6533
  continue;
6711
6534
  }
6712
6535
  const arrowMatch = trimmed.match(
6713
- /^(.+?)\s*(->|--)\s*(.+?)\s+(-?[\d,_]+(?:\.[\d]+)?)\s*(?:\(([^)]+)\))?\s*$/
6536
+ /^(.+?)\s*(->|--)\s*(.+?)\s+(-?[\d,_]+(?:\.[\d]+)?)(?:\s+(red|orange|yellow|green|blue|purple|teal|cyan|gray|black|white))?\s*$/
6714
6537
  );
6715
6538
  if (arrowMatch) {
6716
6539
  const [, rawSource, arrow, rawTarget, rawVal, rawLinkColor] = arrowMatch;
@@ -6755,11 +6578,14 @@ function parseExtendedChart(content, palette) {
6755
6578
  }
6756
6579
  if (sankeyStack.length > 0) {
6757
6580
  const valColorMatch = trimmed.match(
6758
- /(-?[\d,_]+(?:\.[\d]+)?)\s*\(([^)]+)\)\s*$/
6581
+ /(-?[\d,_]+(?:\.[\d]+)?)\s+(red|orange|yellow|green|blue|purple|teal|cyan|gray|black|white)\s*$/
6759
6582
  );
6760
- const strippedLine = valColorMatch ? trimmed.replace(/\s*\([^)]+\)\s*$/, "") : trimmed;
6583
+ const strippedLine = valColorMatch ? trimmed.replace(
6584
+ /\s+(red|orange|yellow|green|blue|purple|teal|cyan|gray|black|white)\s*$/,
6585
+ ""
6586
+ ) : trimmed;
6761
6587
  const dataRow2 = parseDataRowValues(strippedLine);
6762
- if (dataRow2 && dataRow2.values.length === 1) {
6588
+ if (dataRow2?.values.length === 1) {
6763
6589
  const source = sankeyStack.at(-1).name;
6764
6590
  const linkColor = valColorMatch?.[2] ? resolveColorWithDiagnostic(
6765
6591
  valColorMatch[2].trim(),
@@ -6991,7 +6817,7 @@ function parseExtendedChart(content, palette) {
6991
6817
  }
6992
6818
  }
6993
6819
  const dataRow = parseDataRowValues(trimmed);
6994
- if (dataRow && dataRow.values.length === 1) {
6820
+ if (dataRow?.values.length === 1) {
6995
6821
  const { label: rawLabel, color: pointColor } = extractColor(
6996
6822
  dataRow.label,
6997
6823
  palette
@@ -9039,7 +8865,7 @@ function parseOrg(content, palette) {
9039
8865
  const pushWarning = (line12, message) => {
9040
8866
  result.diagnostics.push(makeDgmoError(line12, message, "warning"));
9041
8867
  };
9042
- if (!content || !content.trim()) {
8868
+ if (!content?.trim()) {
9043
8869
  return fail(0, "No content provided");
9044
8870
  }
9045
8871
  const lines = content.split("\n");
@@ -9137,7 +8963,7 @@ function parseOrg(content, palette) {
9137
8963
  if (!color) {
9138
8964
  pushError(
9139
8965
  lineNumber,
9140
- `Expected 'Value(color)' in tag group '${currentTagGroup.name}'`
8966
+ `Expected 'Value color' in tag group '${currentTagGroup.name}'`
9141
8967
  );
9142
8968
  continue;
9143
8969
  }
@@ -9336,7 +9162,7 @@ function parseKanban(content, palette) {
9336
9162
  const warn = (line12, message) => {
9337
9163
  result.diagnostics.push(makeDgmoError(line12, message, "warning"));
9338
9164
  };
9339
- if (!content || !content.trim()) {
9165
+ if (!content?.trim()) {
9340
9166
  return fail(0, "No content provided");
9341
9167
  }
9342
9168
  const lines = content.split("\n");
@@ -9428,7 +9254,7 @@ function parseKanban(content, palette) {
9428
9254
  if (!color) {
9429
9255
  warn(
9430
9256
  lineNumber,
9431
- `Expected 'Value(color)' in tag group '${currentTagGroup.name}'`
9257
+ `Expected 'Value color' in tag group '${currentTagGroup.name}'`
9432
9258
  );
9433
9259
  continue;
9434
9260
  }
@@ -9471,8 +9297,9 @@ function parseKanban(content, palette) {
9471
9297
  currentCard = null;
9472
9298
  columnCounter++;
9473
9299
  const colName = columnMatch[1].trim();
9474
- const colColor = columnMatch[2] ? resolveColorWithDiagnostic(
9475
- columnMatch[2].trim(),
9300
+ const rawTrailing = columnMatch[2]?.trim();
9301
+ const colColor = rawTrailing ? resolveColorWithDiagnostic(
9302
+ rawTrailing,
9476
9303
  lineNumber,
9477
9304
  result.diagnostics,
9478
9305
  palette
@@ -9627,7 +9454,7 @@ var init_parser5 = __esm({
9627
9454
  init_tag_groups();
9628
9455
  init_parsing();
9629
9456
  init_name_normalize();
9630
- COLUMN_RE = /^\[(.+?)\](?:\s*\(([^)]+)\))?(?:\s+as\s+([A-Za-z][A-Za-z0-9_]{0,11}))?\s*(?:\|\s*(.+))?$/;
9457
+ COLUMN_RE = /^\[(.+?)\](?:\s+(\S+))?(?:\s+as\s+([A-Za-z][A-Za-z0-9_]{0,11}))?\s*(?:\|\s*(.+))?$/;
9631
9458
  LEGACY_COLUMN_RE = /^==\s+(.+?)\s*(?:\[wip:\s*(\d+)\])?\s*==$/;
9632
9459
  KNOWN_OPTIONS4 = /* @__PURE__ */ new Set(["hide", "active-tag"]);
9633
9460
  KNOWN_BOOLEANS3 = /* @__PURE__ */ new Set([
@@ -9724,7 +9551,7 @@ function parseC4(content, palette) {
9724
9551
  result.error = formatDgmoError(diag);
9725
9552
  return result;
9726
9553
  };
9727
- if (!content || !content.trim()) {
9554
+ if (!content?.trim()) {
9728
9555
  return fail(0, "No content provided");
9729
9556
  }
9730
9557
  const lines = content.split("\n");
@@ -9810,7 +9637,7 @@ function parseC4(content, palette) {
9810
9637
  if (!color) {
9811
9638
  pushError(
9812
9639
  lineNumber,
9813
- `Expected 'Value(color)' in tag group '${currentTagGroup.name}'`
9640
+ `Expected 'Value color' in tag group '${currentTagGroup.name}'`
9814
9641
  );
9815
9642
  continue;
9816
9643
  }
@@ -10406,7 +10233,7 @@ __export(parser_exports7, {
10406
10233
  looksLikeSitemap: () => looksLikeSitemap,
10407
10234
  parseSitemap: () => parseSitemap
10408
10235
  });
10409
- function parseArrowLine(trimmed, palette, lineNumber, diagnostics) {
10236
+ function parseArrowLine(trimmed, _palette, _lineNumber, _diagnostics) {
10410
10237
  const bareMatch = trimmed.match(BARE_ARROW_RE);
10411
10238
  if (bareMatch) {
10412
10239
  const rawTarget = bareMatch[1].trim();
@@ -10419,27 +10246,10 @@ function parseArrowLine(trimmed, palette, lineNumber, diagnostics) {
10419
10246
  const arrowMatch = trimmed.match(ARROW_RE);
10420
10247
  if (arrowMatch) {
10421
10248
  const label = arrowMatch[1]?.trim() || void 0;
10422
- let color = arrowMatch[2] ? resolveColorWithDiagnostic(
10423
- arrowMatch[2].trim(),
10424
- lineNumber,
10425
- diagnostics,
10426
- palette
10427
- ) : void 0;
10428
- if (label && !color) {
10429
- const inferred = inferArrowColor(label);
10430
- if (inferred)
10431
- color = resolveColorWithDiagnostic(
10432
- inferred,
10433
- lineNumber,
10434
- diagnostics,
10435
- palette
10436
- );
10437
- }
10438
- const rawTarget = arrowMatch[3].trim();
10249
+ const rawTarget = arrowMatch[2].trim();
10439
10250
  const groupMatch = rawTarget.match(/^\[(.+)\]$/);
10440
10251
  return {
10441
10252
  label,
10442
- color,
10443
10253
  target: groupMatch ? groupMatch[1].trim() : rawTarget,
10444
10254
  targetIsGroup: !!groupMatch
10445
10255
  };
@@ -10492,7 +10302,7 @@ function parseSitemap(content, palette) {
10492
10302
  const pushWarning = (line12, message) => {
10493
10303
  result.diagnostics.push(makeDgmoError(line12, message, "warning"));
10494
10304
  };
10495
- if (!content || !content.trim()) {
10305
+ if (!content?.trim()) {
10496
10306
  return fail(0, "No content provided");
10497
10307
  }
10498
10308
  const lines = content.split("\n");
@@ -10581,7 +10391,7 @@ function parseSitemap(content, palette) {
10581
10391
  if (!color) {
10582
10392
  pushError(
10583
10393
  lineNumber,
10584
- `Expected 'Value(color)' in tag group '${currentTagGroup.name}'`
10394
+ `Expected 'Value color' in tag group '${currentTagGroup.name}'`
10585
10395
  );
10586
10396
  continue;
10587
10397
  }
@@ -10618,7 +10428,6 @@ function parseSitemap(content, palette) {
10618
10428
  targetLabel: arrowInfo.target,
10619
10429
  targetIsGroup: arrowInfo.targetIsGroup,
10620
10430
  label: arrowInfo.label,
10621
- color: arrowInfo.color,
10622
10431
  lineNumber
10623
10432
  });
10624
10433
  }
@@ -10716,7 +10525,6 @@ function parseSitemap(content, palette) {
10716
10525
  sourceId: arrow.sourceNode.id,
10717
10526
  targetId: aliasHit,
10718
10527
  label: arrow.label,
10719
- color: arrow.color,
10720
10528
  lineNumber: arrow.lineNumber
10721
10529
  });
10722
10530
  continue;
@@ -10736,7 +10544,6 @@ function parseSitemap(content, palette) {
10736
10544
  sourceId: arrow.sourceNode.id,
10737
10545
  targetId: targetContainer.id,
10738
10546
  label: arrow.label,
10739
- color: arrow.color,
10740
10547
  lineNumber: arrow.lineNumber
10741
10548
  });
10742
10549
  } else {
@@ -10753,7 +10560,6 @@ function parseSitemap(content, palette) {
10753
10560
  sourceId: arrow.sourceNode.id,
10754
10561
  targetId: targetNode.id,
10755
10562
  label: arrow.label,
10756
- color: arrow.color,
10757
10563
  lineNumber: arrow.lineNumber
10758
10564
  });
10759
10565
  }
@@ -10843,7 +10649,6 @@ var CONTAINER_RE3, METADATA_RE3, ARROW_RE, BARE_ARROW_RE;
10843
10649
  var init_parser7 = __esm({
10844
10650
  "src/sitemap/parser.ts"() {
10845
10651
  "use strict";
10846
- init_colors();
10847
10652
  init_diagnostics();
10848
10653
  init_name_normalize();
10849
10654
  init_tag_groups();
@@ -10851,7 +10656,7 @@ var init_parser7 = __esm({
10851
10656
  init_description_helpers();
10852
10657
  CONTAINER_RE3 = /^\[([^\]]+)\]\s*(?:\|\s*(.+))?$/;
10853
10658
  METADATA_RE3 = /^([^:]+):\s*(.+)$/;
10854
- ARROW_RE = /^-([^(>][^(>]*?)?\s*(?:\(([^)]+)\))?\s*->\s*(.+)$/;
10659
+ ARROW_RE = /^-([^>][^>]*?)?\s*->\s*(.+)$/;
10855
10660
  BARE_ARROW_RE = /^->\s*(.+)$/;
10856
10661
  }
10857
10662
  });
@@ -11142,13 +10947,18 @@ function parseInfra(content) {
11142
10947
  }
11143
10948
  if (currentTagGroup && indent > 0) {
11144
10949
  const { text: cleanEntry, isDefault } = stripDefaultModifier(trimmed);
11145
- const tvMatch = cleanEntry.match(TAG_VALUE_RE);
11146
- if (tvMatch) {
11147
- const valueName = tvMatch[1].trim();
11148
- const rawColor = tvMatch[2]?.trim();
11149
- if (rawColor) {
11150
- resolveColorWithDiagnostic(rawColor, lineNumber, result.diagnostics);
11151
- }
10950
+ const lastSpaceIdx = cleanEntry.lastIndexOf(" ");
10951
+ let valueName = cleanEntry;
10952
+ let rawColor;
10953
+ if (lastSpaceIdx > 0) {
10954
+ const trailing = cleanEntry.substring(lastSpaceIdx + 1);
10955
+ if (isRecognizedColorName(trailing)) {
10956
+ rawColor = trailing;
10957
+ valueName = cleanEntry.substring(0, lastSpaceIdx).trimEnd();
10958
+ }
10959
+ }
10960
+ const tvMatch = valueName.match(TAG_VALUE_RE);
10961
+ if (tvMatch || /^\w+$/.test(valueName)) {
11152
10962
  currentTagGroup.values.push({
11153
10963
  name: valueName,
11154
10964
  color: rawColor
@@ -11560,9 +11370,9 @@ var init_parser8 = __esm({
11560
11370
  "use strict";
11561
11371
  init_diagnostics();
11562
11372
  init_description_helpers();
11563
- init_colors();
11564
11373
  init_arrows();
11565
11374
  init_parsing();
11375
+ init_colors();
11566
11376
  init_name_normalize();
11567
11377
  init_tag_groups();
11568
11378
  init_types();
@@ -11572,7 +11382,7 @@ var init_parser8 = __esm({
11572
11382
  ASYNC_SIMPLE_CONNECTION_RE = /^~>\s*(.+?)\s*$/;
11573
11383
  DEPRECATED_FANOUT_RE = /\bx(\d+)\s*$/;
11574
11384
  GROUP_RE = /^\[([^\]]+)\]\s*(?:as\s+([A-Za-z][A-Za-z0-9_]{0,11})\s*)?(?:\|\s*(.+))?$/;
11575
- TAG_VALUE_RE = /^(\w[\w\s]*?)(?:\(([^)]+)\))?\s*$/;
11385
+ TAG_VALUE_RE = /^(\w[\w\s]+?)\s*$/;
11576
11386
  COMPONENT_RE = /^(?:"([^"]+)"|([a-zA-Z_][^|":]*?))\s*(\|.*)?$/;
11577
11387
  PIPE_META_RE = /[|,]\s*(\w+)\s*:\s*([^|,]+)/g;
11578
11388
  PROPERTY_RE = /^([\w-]+)\s+(.+)$/;
@@ -13009,7 +12819,7 @@ function parsePert(content, parseOpts = {}) {
13009
12819
  if (!color) {
13010
12820
  warn(
13011
12821
  lineNumber,
13012
- `Expected 'Value(color)' in tag group '${currentTagGroup.name}'`
12822
+ `Expected 'Value color' in tag group '${currentTagGroup.name}'`
13013
12823
  );
13014
12824
  continue;
13015
12825
  }
@@ -13032,7 +12842,7 @@ function parsePert(content, parseOpts = {}) {
13032
12842
  if (!color) {
13033
12843
  warn(
13034
12844
  lineNumber,
13035
- `Expected 'Value(color)' in tag group '${currentTagGroup.name}'`
12845
+ `Expected 'Value color' in tag group '${currentTagGroup.name}'`
13036
12846
  );
13037
12847
  continue;
13038
12848
  }
@@ -13176,7 +12986,7 @@ function parsePert(content, parseOpts = {}) {
13176
12986
  const head = trimmed.slice(0, firstSpace).toLowerCase();
13177
12987
  const value = trimmed.slice(firstSpace + 1).trim();
13178
12988
  const hint = NEAR_DIRECTIVE_HINTS.find((h) => h.stem === head);
13179
- if (hint && hint.matches.test(value)) {
12989
+ if (hint?.matches.test(value)) {
13180
12990
  error(
13181
12991
  lineNumber,
13182
12992
  `Unknown directive '${head}'. Did you mean '${hint.canonical}'?`,
@@ -14483,7 +14293,7 @@ function parseMindmap(content, palette) {
14483
14293
  const pushWarning = (line12, message) => {
14484
14294
  result.diagnostics.push(makeDgmoError(line12, message, "warning"));
14485
14295
  };
14486
- if (!content || !content.trim()) {
14296
+ if (!content?.trim()) {
14487
14297
  return fail(0, "No content provided");
14488
14298
  }
14489
14299
  const lines = content.split("\n");
@@ -14581,7 +14391,7 @@ function parseMindmap(content, palette) {
14581
14391
  if (!color) {
14582
14392
  pushError(
14583
14393
  lineNumber,
14584
- `Expected 'Value(color)' in tag group '${currentTagGroup.name}'`
14394
+ `Expected 'Value color' in tag group '${currentTagGroup.name}'`
14585
14395
  );
14586
14396
  continue;
14587
14397
  }
@@ -14654,7 +14464,7 @@ function parseMindmap(content, palette) {
14654
14464
  const diag = makeDgmoError(1, "No nodes found in mindmap");
14655
14465
  result.diagnostics.push(diag);
14656
14466
  result.error = formatDgmoError(diag);
14657
- } else if (titleRoot && titleRoot.children.length === 0 && result.roots.length === 1 && !result.error) {
14467
+ } else if (titleRoot?.children.length === 0 && result.roots.length === 1 && !result.error) {
14658
14468
  }
14659
14469
  return result;
14660
14470
  }
@@ -15113,7 +14923,7 @@ function parseWireframe(content) {
15113
14923
  const indent = measureIndent(line12);
15114
14924
  if (phase === "header") {
15115
14925
  const firstLineResult = parseFirstLine(trimmed);
15116
- if (firstLineResult && firstLineResult.chartType === "wireframe") {
14926
+ if (firstLineResult?.chartType === "wireframe") {
15117
14927
  title = firstLineResult.title || null;
15118
14928
  titleLineNumber = lineNumber;
15119
14929
  continue;
@@ -15167,7 +14977,7 @@ function parseWireframe(content) {
15167
14977
  } else {
15168
14978
  pushWarning(
15169
14979
  lineNumber,
15170
- `Expected 'Value(color)' in tag group '${currentTagGroup.name}'`
14980
+ `Expected 'Value color' in tag group '${currentTagGroup.name}'`
15171
14981
  );
15172
14982
  }
15173
14983
  continue;
@@ -15408,7 +15218,7 @@ function parseTechRadar(content) {
15408
15218
  const warn = (line12, message) => {
15409
15219
  result.diagnostics.push(makeDgmoError(line12, message, "warning"));
15410
15220
  };
15411
- if (!content || !content.trim()) {
15221
+ if (!content?.trim()) {
15412
15222
  return fail(0, "No content provided");
15413
15223
  }
15414
15224
  function isRingName(name) {
@@ -15445,7 +15255,7 @@ function parseTechRadar(content) {
15445
15255
  if (trimmed.startsWith("//")) continue;
15446
15256
  if (!headerParsed) {
15447
15257
  const firstLine = parseFirstLine(trimmed);
15448
- if (firstLine && firstLine.chartType === "tech-radar") {
15258
+ if (firstLine?.chartType === "tech-radar") {
15449
15259
  result.title = firstLine.title ?? "";
15450
15260
  result.titleLineNumber = lineNumber;
15451
15261
  headerParsed = true;
@@ -15737,7 +15547,7 @@ function parseCycle(content) {
15737
15547
  const indent = measureIndent(raw);
15738
15548
  if (!headerParsed) {
15739
15549
  const firstLineResult = parseFirstLine(trimmed);
15740
- if (firstLineResult && firstLineResult.chartType === "cycle") {
15550
+ if (firstLineResult?.chartType === "cycle") {
15741
15551
  result.title = firstLineResult.title ?? "";
15742
15552
  result.titleLineNumber = lineNum;
15743
15553
  headerParsed = true;
@@ -15784,6 +15594,13 @@ function parseCycle(content) {
15784
15594
  warn(lineNum, "Empty node label.");
15785
15595
  continue;
15786
15596
  }
15597
+ if (!metadata["color"]) {
15598
+ const { label: stripped, colorName: shortcutColor } = peelTrailingColorName(label);
15599
+ if (shortcutColor) {
15600
+ metadata["color"] = shortcutColor;
15601
+ label = stripped;
15602
+ }
15603
+ }
15787
15604
  const color = metadata["color"];
15788
15605
  const spanStr = metadata["span"];
15789
15606
  let span = 1;
@@ -15954,7 +15771,7 @@ function parseJourneyMap(content, palette) {
15954
15771
  const warn = (line12, message) => {
15955
15772
  result.diagnostics.push(makeDgmoError(line12, message, "warning"));
15956
15773
  };
15957
- if (!content || !content.trim()) {
15774
+ if (!content?.trim()) {
15958
15775
  return fail(0, "No content provided");
15959
15776
  }
15960
15777
  const lines = content.split("\n");
@@ -16013,8 +15830,12 @@ function parseJourneyMap(content, palette) {
16013
15830
  const key = part.substring(0, colonIdx).trim().toLowerCase();
16014
15831
  const value = part.substring(colonIdx + 1).trim();
16015
15832
  if (key === "color") {
16016
- const resolved = extractColor(`x(${value})`, palette);
16017
- personaColor = resolved.color;
15833
+ personaColor = resolveColorWithDiagnostic(
15834
+ value,
15835
+ lineNumber,
15836
+ result.diagnostics,
15837
+ palette
15838
+ ) ?? void 0;
16018
15839
  }
16019
15840
  }
16020
15841
  }
@@ -16072,7 +15893,7 @@ function parseJourneyMap(content, palette) {
16072
15893
  if (!color) {
16073
15894
  warn(
16074
15895
  lineNumber,
16075
- `Expected 'Value(color)' in tag group '${currentTagGroup.name}'`
15896
+ `Expected 'Value color' in tag group '${currentTagGroup.name}'`
16076
15897
  );
16077
15898
  continue;
16078
15899
  }
@@ -16315,6 +16136,7 @@ var PHASE_RE, SCORE_RE, ANNOTATION_RE, KNOWN_OPTIONS9, KNOWN_BOOLEANS6;
16315
16136
  var init_parser16 = __esm({
16316
16137
  "src/journey-map/parser.ts"() {
16317
16138
  "use strict";
16139
+ init_colors();
16318
16140
  init_diagnostics();
16319
16141
  init_tag_groups();
16320
16142
  init_parsing();
@@ -16369,7 +16191,7 @@ function parsePyramid(content) {
16369
16191
  const indent = measureIndent(raw);
16370
16192
  if (!headerParsed) {
16371
16193
  const firstLineResult = parseFirstLine(trimmed);
16372
- if (firstLineResult && firstLineResult.chartType === "pyramid") {
16194
+ if (firstLineResult?.chartType === "pyramid") {
16373
16195
  result.title = firstLineResult.title ?? "";
16374
16196
  result.titleLineNumber = lineNum;
16375
16197
  headerParsed = true;
@@ -16413,6 +16235,13 @@ function parsePyramid(content) {
16413
16235
  warn(lineNum, "Empty layer label.");
16414
16236
  continue;
16415
16237
  }
16238
+ if (!color) {
16239
+ const { label: stripped, colorName: shortcutColor } = peelTrailingColorName(label);
16240
+ if (shortcutColor) {
16241
+ color = shortcutColor;
16242
+ label = stripped;
16243
+ }
16244
+ }
16416
16245
  currentLayer = {
16417
16246
  label,
16418
16247
  lineNumber: lineNum,
@@ -16496,7 +16325,7 @@ function parseRing(content) {
16496
16325
  const indent = measureIndent(raw);
16497
16326
  if (!headerParsed) {
16498
16327
  const firstLineResult = parseFirstLine(trimmed);
16499
- if (firstLineResult && firstLineResult.chartType === "ring") {
16328
+ if (firstLineResult?.chartType === "ring") {
16500
16329
  result.title = firstLineResult.title ?? "";
16501
16330
  result.titleLineNumber = lineNum;
16502
16331
  headerParsed = true;
@@ -16576,6 +16405,13 @@ function parseRing(content) {
16576
16405
  warn(lineNum, "Empty layer label.");
16577
16406
  continue;
16578
16407
  }
16408
+ if (!color) {
16409
+ const { label: stripped, colorName: shortcutColor } = peelTrailingColorName(label);
16410
+ if (shortcutColor) {
16411
+ color = shortcutColor;
16412
+ label = stripped;
16413
+ }
16414
+ }
16579
16415
  currentLayer = {
16580
16416
  label,
16581
16417
  lineNumber: lineNum,
@@ -16936,7 +16772,7 @@ function parseRaci(content, palette) {
16936
16772
  const errorAt = (line12, message, code) => {
16937
16773
  result.diagnostics.push(makeDgmoError(line12, message, "error", code));
16938
16774
  };
16939
- if (!content || !content.trim()) {
16775
+ if (!content?.trim()) {
16940
16776
  return fail(0, "No content provided");
16941
16777
  }
16942
16778
  const lines = content.split("\n");
@@ -17070,7 +16906,7 @@ function parseRaci(content, palette) {
17070
16906
  if (next.length > 0 && next[0] !== " " && next[0] !== " ") break;
17071
16907
  const stripped = nextTrim.replace(/,\s*$/, "");
17072
16908
  const segments = stripped.split("|").map((s) => s.trim());
17073
- const roleLabel = segments[0] ?? "";
16909
+ let roleLabel = segments[0] ?? "";
17074
16910
  let roleColor;
17075
16911
  if (segments.length > 1) {
17076
16912
  const meta = parsePipeMetadata(segments);
@@ -17083,6 +16919,18 @@ function parseRaci(content, palette) {
17083
16919
  );
17084
16920
  }
17085
16921
  }
16922
+ if (!roleColor) {
16923
+ const { label: stripLabel, colorName: shortcutColor } = peelTrailingColorName(roleLabel);
16924
+ if (shortcutColor) {
16925
+ roleColor = resolveColorWithDiagnostic(
16926
+ shortcutColor,
16927
+ j + 1,
16928
+ result.diagnostics,
16929
+ palette
16930
+ );
16931
+ roleLabel = stripLabel;
16932
+ }
16933
+ }
17086
16934
  if (roleLabel) getOrAddRole(roleLabel, j + 1, roleColor);
17087
16935
  }
17088
16936
  i = j - 1;
@@ -17141,8 +16989,10 @@ function parseRaci(content, palette) {
17141
16989
  continue;
17142
16990
  }
17143
16991
  let phaseColor;
17144
- if (phaseMatch[2]) {
17145
- const meta = parsePipeMetadata(["", phaseMatch[2]]);
16992
+ const trailingToken = phaseMatch[2];
16993
+ const pipeMeta = phaseMatch[3];
16994
+ if (pipeMeta) {
16995
+ const meta = parsePipeMetadata(["", pipeMeta]);
17146
16996
  if (meta["color"]) {
17147
16997
  phaseColor = resolveColorWithDiagnostic(
17148
16998
  meta["color"],
@@ -17152,6 +17002,17 @@ function parseRaci(content, palette) {
17152
17002
  );
17153
17003
  }
17154
17004
  }
17005
+ if (!phaseColor && trailingToken) {
17006
+ const { colorName } = peelTrailingColorName(`x ${trailingToken}`);
17007
+ if (colorName) {
17008
+ phaseColor = resolveColorWithDiagnostic(
17009
+ colorName,
17010
+ lineNumber,
17011
+ result.diagnostics,
17012
+ palette
17013
+ );
17014
+ }
17015
+ }
17155
17016
  currentPhase = {
17156
17017
  id: normalizeName(display),
17157
17018
  displayName: display,
@@ -17232,7 +17093,7 @@ function parseRaci(content, palette) {
17232
17093
  if (roleId === null) continue;
17233
17094
  if (rolesExplicit) {
17234
17095
  const entry = roleStore.get(roleId);
17235
- if (entry && entry.declaredLine === lineNumber) {
17096
+ if (entry?.declaredLine === lineNumber) {
17236
17097
  const candidates = result.roleDisplayNames.filter(
17237
17098
  (n) => n !== entry.displayName
17238
17099
  );
@@ -17382,7 +17243,7 @@ var init_parser19 = __esm({
17382
17243
  "no-title",
17383
17244
  ...Object.keys(VARIANT_LOCK_DIRECTIVES)
17384
17245
  ]);
17385
- PHASE_RE2 = /^\[(.+?)\]\s*(?:\|\s*(.+))?\s*$/;
17246
+ PHASE_RE2 = /^\[(.+?)\](?:\s+(\S+))?(?:\s*\|\s*(.+))?\s*$/;
17386
17247
  ROLE_ASSIGNMENT_RE = /^([^:]+):\s*(.*)$/;
17387
17248
  }
17388
17249
  });
@@ -19098,7 +18959,7 @@ function containerFill(palette, isDark, nodeColor2) {
19098
18959
  function containerStroke(palette, nodeColor2) {
19099
18960
  return nodeColor2 ?? palette.textMuted;
19100
18961
  }
19101
- function renderOrg(container, parsed, layout, palette, isDark, onClickItem, exportDims, activeTagGroup, hiddenAttributes, ancestorPath) {
18962
+ function renderOrg(container, parsed, layout, palette, isDark, onClickItem, exportDims, activeTagGroup, hiddenAttributes, ancestorPath, exportMode) {
19102
18963
  d3Selection.select(container).selectAll(":not([data-d3-tooltip])").remove();
19103
18964
  const width = exportDims?.width ?? container.clientWidth;
19104
18965
  const height = exportDims?.height ?? container.clientHeight;
@@ -19358,7 +19219,7 @@ function renderOrg(container, parsed, layout, palette, isDark, onClickItem, expo
19358
19219
  }
19359
19220
  ],
19360
19221
  position: { placement: "top-center", titleRelation: "below-title" },
19361
- mode: "fixed"
19222
+ mode: exportMode ? "export" : "preview"
19362
19223
  };
19363
19224
  const singleState = { activeGroup: lg.name };
19364
19225
  const groupG = legendParentBase.append("g").attr("transform", `translate(${lg.x}, ${lg.y})`);
@@ -19378,7 +19239,7 @@ function renderOrg(container, parsed, layout, palette, isDark, onClickItem, expo
19378
19239
  const legendConfig = {
19379
19240
  groups,
19380
19241
  position: { placement: "top-center", titleRelation: "below-title" },
19381
- mode: "fixed",
19242
+ mode: exportMode ? "export" : "preview",
19382
19243
  capsulePillAddonWidth: eyeAddonWidth
19383
19244
  };
19384
19245
  const legendState = { activeGroup: activeTagGroup ?? null };
@@ -19845,7 +19706,6 @@ function layoutSitemap(parsed, hiddenCounts, activeTagGroup, hiddenAttributes, e
19845
19706
  targetId: edge.targetId,
19846
19707
  points,
19847
19708
  label: edge.label,
19848
- color: edge.color,
19849
19709
  lineNumber: edge.lineNumber,
19850
19710
  deferred: deferredSet.has(i) || void 0
19851
19711
  });
@@ -20301,7 +20161,7 @@ function containerFill2(palette, isDark, nodeColor2) {
20301
20161
  function containerStroke2(palette, nodeColor2) {
20302
20162
  return nodeColor2 ?? palette.textMuted;
20303
20163
  }
20304
- function renderSitemap(container, parsed, layout, palette, isDark, onClickItem, exportDims, activeTagGroup, hiddenAttributes) {
20164
+ function renderSitemap(container, parsed, layout, palette, isDark, onClickItem, exportDims, activeTagGroup, hiddenAttributes, exportMode) {
20305
20165
  d3Selection2.select(container).selectAll(":not([data-d3-tooltip])").remove();
20306
20166
  const width = exportDims?.width ?? container.clientWidth;
20307
20167
  const height = exportDims?.height ?? container.clientHeight;
@@ -20332,9 +20192,6 @@ function renderSitemap(container, parsed, layout, palette, isDark, onClickItem,
20332
20192
  const defs = svg.append("defs");
20333
20193
  defs.append("marker").attr("id", "sm-arrow").attr("viewBox", `0 0 ${ARROWHEAD_W} ${ARROWHEAD_H}`).attr("refX", ARROWHEAD_W).attr("refY", ARROWHEAD_H / 2).attr("markerWidth", ARROWHEAD_W).attr("markerHeight", ARROWHEAD_H).attr("orient", "auto").append("polygon").attr("points", `0,0 ${ARROWHEAD_W},${ARROWHEAD_H / 2} 0,${ARROWHEAD_H}`).attr("fill", palette.textMuted);
20334
20194
  const edgeColors = /* @__PURE__ */ new Set();
20335
- for (const edge of layout.edges) {
20336
- if (edge.color) edgeColors.add(edge.color);
20337
- }
20338
20195
  for (const color of edgeColors) {
20339
20196
  const id = `sm-arrow-${color.replace("#", "")}`;
20340
20197
  defs.append("marker").attr("id", id).attr("viewBox", `0 0 ${ARROWHEAD_W} ${ARROWHEAD_H}`).attr("refX", ARROWHEAD_W).attr("refY", ARROWHEAD_H / 2).attr("markerWidth", ARROWHEAD_W).attr("markerHeight", ARROWHEAD_H).attr("orient", "auto").append("polygon").attr("points", `0,0 ${ARROWHEAD_W},${ARROWHEAD_H / 2} 0,${ARROWHEAD_H}`).attr("fill", color);
@@ -20413,8 +20270,8 @@ function renderSitemap(container, parsed, layout, palette, isDark, onClickItem,
20413
20270
  for (const edge of layout.edges) {
20414
20271
  if (edge.points.length < 2) continue;
20415
20272
  const edgeG = contentG.append("g").attr("class", "sitemap-edge-group").attr("data-line-number", String(edge.lineNumber));
20416
- const edgeColor3 = edge.color ?? palette.textMuted;
20417
- const markerId = edge.color ? `sm-arrow-${edge.color.replace("#", "")}` : "sm-arrow";
20273
+ const edgeColor3 = palette.textMuted;
20274
+ const markerId = "sm-arrow";
20418
20275
  const gen = edge.deferred ? lineGeneratorLinear : lineGenerator;
20419
20276
  const pathD = gen(edge.points);
20420
20277
  if (pathD) {
@@ -20495,7 +20352,8 @@ function renderSitemap(container, parsed, layout, palette, isDark, onClickItem,
20495
20352
  isDark,
20496
20353
  activeTagGroup,
20497
20354
  void 0,
20498
- hiddenAttributes
20355
+ hiddenAttributes,
20356
+ exportMode
20499
20357
  );
20500
20358
  }
20501
20359
  if (fixedTitle) {
@@ -20520,11 +20378,12 @@ function renderSitemap(container, parsed, layout, palette, isDark, onClickItem,
20520
20378
  isDark,
20521
20379
  activeTagGroup,
20522
20380
  width,
20523
- hiddenAttributes
20381
+ hiddenAttributes,
20382
+ exportMode
20524
20383
  );
20525
20384
  }
20526
20385
  }
20527
- function renderLegend(parent, legendGroups, palette, isDark, activeTagGroup, fixedWidth, hiddenAttributes) {
20386
+ function renderLegend(parent, legendGroups, palette, isDark, activeTagGroup, fixedWidth, hiddenAttributes, exportMode) {
20528
20387
  if (legendGroups.length === 0) return;
20529
20388
  const groups = legendGroups.map((g) => ({
20530
20389
  name: g.name,
@@ -20535,7 +20394,7 @@ function renderLegend(parent, legendGroups, palette, isDark, activeTagGroup, fix
20535
20394
  const legendConfig = {
20536
20395
  groups,
20537
20396
  position: { placement: "top-center", titleRelation: "below-title" },
20538
- mode: "fixed",
20397
+ mode: exportMode ? "export" : "preview",
20539
20398
  capsulePillAddonWidth: eyeAddonWidth
20540
20399
  };
20541
20400
  const legendState = { activeGroup: activeTagGroup ?? null };
@@ -20921,7 +20780,7 @@ function renderKanban(container, parsed, palette, isDark, options) {
20921
20780
  const legendConfig = {
20922
20781
  groups: parsed.tagGroups,
20923
20782
  position: { placement: "top-center", titleRelation: "inline-with-title" },
20924
- mode: exportDims ? "inline" : "fixed"
20783
+ mode: options?.exportMode ? "export" : "preview"
20925
20784
  };
20926
20785
  const legendState = { activeGroup: activeTagGroup ?? null };
20927
20786
  const legendG = svg.append("g").attr("class", "kanban-legend").attr("transform", `translate(${legendX},${legendY})`);
@@ -21079,7 +20938,8 @@ function renderKanbanForExport(content, theme, palette) {
21079
20938
  const layout = computeLayout(parsed, palette);
21080
20939
  const container = document.createElement("div");
21081
20940
  renderKanban(container, parsed, palette, isDark, {
21082
- exportDims: { width: layout.totalWidth, height: layout.totalHeight }
20941
+ exportDims: { width: layout.totalWidth, height: layout.totalHeight },
20942
+ exportMode: true
21083
20943
  });
21084
20944
  const svgEl = container.querySelector("svg");
21085
20945
  return svgEl?.outerHTML ?? "";
@@ -21617,7 +21477,7 @@ function markerIdForType(type) {
21617
21477
  function isSourceMarker(type) {
21618
21478
  return type === "composes" || type === "aggregates";
21619
21479
  }
21620
- function renderClassDiagram(container, parsed, layout, palette, isDark, onClickItem, exportDims, legendActive) {
21480
+ function renderClassDiagram(container, parsed, layout, palette, isDark, onClickItem, exportDims, legendActive, exportMode) {
21621
21481
  d3Selection4.select(container).selectAll(":not([data-d3-tooltip])").remove();
21622
21482
  const width = exportDims?.width ?? container.clientWidth;
21623
21483
  const height = exportDims?.height ?? container.clientHeight;
@@ -21679,7 +21539,7 @@ function renderClassDiagram(container, parsed, layout, palette, isDark, onClickI
21679
21539
  const legendConfig = {
21680
21540
  groups: legendGroups,
21681
21541
  position: { placement: "top-center", titleRelation: "below-title" },
21682
- mode: "fixed"
21542
+ mode: exportMode ? "export" : "preview"
21683
21543
  };
21684
21544
  const legendState = {
21685
21545
  activeGroup: isLegendExpanded ? LEGEND_GROUP_NAME : null
@@ -21819,10 +21679,22 @@ function renderClassDiagramForExport(content, theme, palette) {
21819
21679
  const exportWidth = layout.width + DIAGRAM_PADDING4 * 2;
21820
21680
  const exportHeight = layout.height + DIAGRAM_PADDING4 * 2 + (parsed.title ? 40 : 0) + legendReserve;
21821
21681
  return runInExportContainer(exportWidth, exportHeight, (container) => {
21822
- renderClassDiagram(container, parsed, layout, palette, isDark, void 0, {
21823
- width: exportWidth,
21824
- height: exportHeight
21825
- });
21682
+ renderClassDiagram(
21683
+ container,
21684
+ parsed,
21685
+ layout,
21686
+ palette,
21687
+ isDark,
21688
+ void 0,
21689
+ {
21690
+ width: exportWidth,
21691
+ height: exportHeight
21692
+ },
21693
+ true,
21694
+ // legendActive for export
21695
+ true
21696
+ // exportMode
21697
+ );
21826
21698
  return extractExportSvg(container, theme);
21827
21699
  });
21828
21700
  }
@@ -22298,7 +22170,7 @@ function drawCardinality(g, point, prevPoint, cardinality, color, useLabels) {
22298
22170
  g.append("line").attr("x1", bx + px * spread).attr("y1", by + py * spread).attr("x2", bx - px * spread).attr("y2", by - py * spread).attr("stroke", color).attr("stroke-width", sw);
22299
22171
  }
22300
22172
  }
22301
- function renderERDiagram(container, parsed, layout, palette, isDark, onClickItem, exportDims, activeTagGroup, semanticColorsActive) {
22173
+ function renderERDiagram(container, parsed, layout, palette, isDark, onClickItem, exportDims, activeTagGroup, semanticColorsActive, exportMode) {
22302
22174
  d3Selection5.select(container).selectAll(":not([data-d3-tooltip])").remove();
22303
22175
  const useSemanticColors = parsed.tagGroups.length === 0 && layout.nodes.every((n) => !n.color);
22304
22176
  const LEGEND_FIXED_GAP4 = 8;
@@ -22454,7 +22326,7 @@ function renderERDiagram(container, parsed, layout, palette, isDark, onClickItem
22454
22326
  const legendConfig = {
22455
22327
  groups: parsed.tagGroups,
22456
22328
  position: { placement: "top-center", titleRelation: "below-title" },
22457
- mode: "fixed"
22329
+ mode: exportMode ? "export" : "preview"
22458
22330
  };
22459
22331
  const legendState = { activeGroup: activeTagGroup ?? null };
22460
22332
  const legendG = svg.append("g").attr("class", "er-tag-legend").attr("transform", `translate(0,${legendY})`);
@@ -22490,7 +22362,7 @@ function renderERDiagram(container, parsed, layout, palette, isDark, onClickItem
22490
22362
  const legendConfig = {
22491
22363
  groups: semanticGroups,
22492
22364
  position: { placement: "top-center", titleRelation: "below-title" },
22493
- mode: "fixed"
22365
+ mode: exportMode ? "export" : "preview"
22494
22366
  };
22495
22367
  const legendState = {
22496
22368
  activeGroup: semanticActive ? "Role" : null
@@ -22523,10 +22395,21 @@ function renderERDiagramForExport(content, theme, palette) {
22523
22395
  container.style.left = "-9999px";
22524
22396
  document.body.appendChild(container);
22525
22397
  try {
22526
- renderERDiagram(container, parsed, layout, palette, isDark, void 0, {
22527
- width: exportWidth,
22528
- height: exportHeight
22529
- });
22398
+ renderERDiagram(
22399
+ container,
22400
+ parsed,
22401
+ layout,
22402
+ palette,
22403
+ isDark,
22404
+ void 0,
22405
+ {
22406
+ width: exportWidth,
22407
+ height: exportHeight
22408
+ },
22409
+ void 0,
22410
+ void 0,
22411
+ true
22412
+ );
22530
22413
  const svgEl = container.querySelector("svg");
22531
22414
  if (!svgEl) return "";
22532
22415
  if (theme === "transparent") {
@@ -22761,7 +22644,8 @@ function renderBoxesAndLines(container, parsed, layout, palette, isDark, options
22761
22644
  hideDescriptions,
22762
22645
  controlsExpanded,
22763
22646
  onToggleDescriptions,
22764
- onToggleControlsExpand
22647
+ onToggleControlsExpand,
22648
+ exportMode = false
22765
22649
  } = options ?? {};
22766
22650
  d3Selection6.select(container).selectAll(":not([data-d3-tooltip])").remove();
22767
22651
  const width = exportDims?.width ?? container.clientWidth;
@@ -23097,7 +22981,7 @@ function renderBoxesAndLines(container, parsed, layout, palette, isDark, options
23097
22981
  const legendConfig = {
23098
22982
  groups: parsed.tagGroups,
23099
22983
  position: { placement: "top-center", titleRelation: "below-title" },
23100
- mode: "fixed",
22984
+ mode: exportMode ? "export" : "preview",
23101
22985
  controlsGroup
23102
22986
  };
23103
22987
  const legendState = {
@@ -23129,7 +23013,8 @@ function renderBoxesAndLinesForExport(container, parsed, layout, palette, isDark
23129
23013
  renderBoxesAndLines(container, parsed, layout, palette, isDark, {
23130
23014
  exportDims: options?.exportDims,
23131
23015
  activeTagGroup: options?.activeTagGroup,
23132
- hiddenTagValues: options?.hiddenTagValues
23016
+ hiddenTagValues: options?.hiddenTagValues,
23017
+ exportMode: options?.exportMode
23133
23018
  });
23134
23019
  }
23135
23020
  var d3Selection6, d3Shape4, DIAGRAM_PADDING6, NODE_FONT_SIZE, MIN_NODE_FONT_SIZE, EDGE_LABEL_FONT_SIZE4, EDGE_STROKE_WIDTH5, NODE_STROKE_WIDTH5, NODE_RX, COLLAPSE_BAR_HEIGHT3, ARROWHEAD_W2, ARROWHEAD_H2, DESC_FONT_SIZE, DESC_LINE_HEIGHT, MAX_DESC_LINES, CHAR_WIDTH_RATIO2, NODE_TEXT_PADDING, GROUP_RX, GROUP_LABEL_FONT_SIZE, GROUP_LABEL_ZONE, lineGeneratorLR, lineGeneratorTB;
@@ -23589,8 +23474,7 @@ async function layoutBoxesAndLines(parsed, collapseInfo, layoutOptions) {
23589
23474
  const edge = parsed.edges[i];
23590
23475
  if (edgeParallelCounts[i] === 0) continue;
23591
23476
  const elkEdge = edgeById.get(`e${i}`);
23592
- if (!elkEdge || !elkEdge.sections || elkEdge.sections.length === 0)
23593
- continue;
23477
+ if (!elkEdge?.sections || elkEdge.sections.length === 0) continue;
23594
23478
  const container = elkEdge.container ?? "root";
23595
23479
  const off = containerAbs.get(container) ?? { x: 0, y: 0 };
23596
23480
  const s = elkEdge.sections[0];
@@ -24367,7 +24251,7 @@ function renderMindmap(container, parsed, layout, palette, isDark, onClickItem,
24367
24251
  };
24368
24252
  }),
24369
24253
  position: { placement: "top-center", titleRelation: "below-title" },
24370
- mode: "fixed",
24254
+ mode: options?.exportMode ? "export" : "preview",
24371
24255
  controlsGroup: controlsToggles
24372
24256
  };
24373
24257
  const legendState = {
@@ -27169,7 +27053,7 @@ function drawPersonIcon(g, cx, cy, color) {
27169
27053
  g.append("line").attr("x1", cx).attr("y1", bodyBottomY).attr("x2", cx - PERSON_LEG_SPAN).attr("y2", legY).attr("stroke", color).attr("stroke-width", PERSON_SW);
27170
27054
  g.append("line").attr("x1", cx).attr("y1", bodyBottomY).attr("x2", cx + PERSON_LEG_SPAN).attr("y2", legY).attr("stroke", color).attr("stroke-width", PERSON_SW);
27171
27055
  }
27172
- function renderC4Context(container, parsed, layout, palette, isDark, onClickItem, exportDims, activeTagGroup) {
27056
+ function renderC4Context(container, parsed, layout, palette, isDark, onClickItem, exportDims, activeTagGroup, exportMode) {
27173
27057
  d3Selection9.select(container).selectAll(":not([data-d3-tooltip])").remove();
27174
27058
  const width = exportDims?.width ?? container.clientWidth;
27175
27059
  const height = exportDims?.height ?? container.clientHeight;
@@ -27345,7 +27229,8 @@ function renderC4Context(container, parsed, layout, palette, isDark, onClickItem
27345
27229
  palette,
27346
27230
  isDark,
27347
27231
  activeTagGroup,
27348
- fixedLegend ? width : null
27232
+ fixedLegend ? width : null,
27233
+ exportMode
27349
27234
  );
27350
27235
  }
27351
27236
  }
@@ -27700,7 +27585,7 @@ function placeEdgeLabels(labels, edges, obstacleRects) {
27700
27585
  placedRects.push({ x: lbl.x, y: lbl.y, w: lbl.bgW, h: lbl.bgH });
27701
27586
  }
27702
27587
  }
27703
- function renderLegend2(parent, layout, palette, isDark, activeTagGroup, fixedWidth) {
27588
+ function renderLegend2(parent, layout, palette, isDark, activeTagGroup, fixedWidth, exportMode) {
27704
27589
  const groups = layout.legend.map((g) => ({
27705
27590
  name: g.name,
27706
27591
  entries: g.entries.map((e) => ({ value: e.value, color: e.color }))
@@ -27708,7 +27593,7 @@ function renderLegend2(parent, layout, palette, isDark, activeTagGroup, fixedWid
27708
27593
  const legendConfig = {
27709
27594
  groups,
27710
27595
  position: { placement: "top-center", titleRelation: "below-title" },
27711
- mode: "fixed"
27596
+ mode: exportMode ? "export" : "preview"
27712
27597
  };
27713
27598
  const legendState = { activeGroup: activeTagGroup ?? null };
27714
27599
  const containerWidth = fixedWidth ?? layout.width;
@@ -27723,7 +27608,7 @@ function renderLegend2(parent, layout, palette, isDark, activeTagGroup, fixedWid
27723
27608
  );
27724
27609
  parent.selectAll("[data-legend-group]").classed("c4-legend-group", true);
27725
27610
  }
27726
- function renderC4Containers(container, parsed, layout, palette, isDark, onClickItem, exportDims, activeTagGroup) {
27611
+ function renderC4Containers(container, parsed, layout, palette, isDark, onClickItem, exportDims, activeTagGroup, exportMode) {
27727
27612
  d3Selection9.select(container).selectAll(":not([data-d3-tooltip])").remove();
27728
27613
  const width = exportDims?.width ?? container.clientWidth;
27729
27614
  const height = exportDims?.height ?? container.clientHeight;
@@ -27954,7 +27839,8 @@ function renderC4Containers(container, parsed, layout, palette, isDark, onClickI
27954
27839
  palette,
27955
27840
  isDark,
27956
27841
  activeTagGroup,
27957
- fixedLegend ? width : null
27842
+ fixedLegend ? width : null,
27843
+ exportMode
27958
27844
  );
27959
27845
  }
27960
27846
  }
@@ -28022,7 +27908,7 @@ function renderC4ComponentsForExport(content, systemName, containerName, theme,
28022
27908
  document.body.removeChild(el);
28023
27909
  }
28024
27910
  }
28025
- function renderC4Deployment(container, parsed, layout, palette, isDark, onClickItem, exportDims, activeTagGroup) {
27911
+ function renderC4Deployment(container, parsed, layout, palette, isDark, onClickItem, exportDims, activeTagGroup, exportMode) {
28026
27912
  renderC4Containers(
28027
27913
  container,
28028
27914
  parsed,
@@ -28031,7 +27917,8 @@ function renderC4Deployment(container, parsed, layout, palette, isDark, onClickI
28031
27917
  isDark,
28032
27918
  onClickItem,
28033
27919
  exportDims,
28034
- activeTagGroup
27920
+ activeTagGroup,
27921
+ exportMode
28035
27922
  );
28036
27923
  }
28037
27924
  function renderC4DeploymentForExport(content, theme, palette) {
@@ -28213,7 +28100,6 @@ function layoutGraph(graph, options) {
28213
28100
  target: edge.target,
28214
28101
  points: edgeData?.points ?? [],
28215
28102
  label: edge.label,
28216
- color: edge.color,
28217
28103
  lineNumber: edge.lineNumber
28218
28104
  };
28219
28105
  });
@@ -28514,6 +28400,8 @@ function renderNodeShape(g, node, palette, isDark, endTerminalIds, colorOff, sol
28514
28400
  case "document":
28515
28401
  renderDocument(g, node, palette, isDark, colorOff, solid);
28516
28402
  break;
28403
+ default:
28404
+ break;
28517
28405
  }
28518
28406
  }
28519
28407
  function renderFlowchart(container, graph, layout, palette, isDark, onClickItem, exportDims) {
@@ -28536,9 +28424,6 @@ function renderFlowchart(container, graph, layout, palette, isDark, onClickItem,
28536
28424
  const defs = svg.append("defs");
28537
28425
  defs.append("marker").attr("id", "fc-arrow").attr("viewBox", `0 0 ${ARROWHEAD_W3} ${ARROWHEAD_H3}`).attr("refX", ARROWHEAD_W3).attr("refY", ARROWHEAD_H3 / 2).attr("markerWidth", ARROWHEAD_W3).attr("markerHeight", ARROWHEAD_H3).attr("orient", "auto").append("polygon").attr("points", `0,0 ${ARROWHEAD_W3},${ARROWHEAD_H3 / 2} 0,${ARROWHEAD_H3}`).attr("fill", palette.textMuted);
28538
28426
  const edgeColors = /* @__PURE__ */ new Set();
28539
- for (const edge of layout.edges) {
28540
- if (edge.color) edgeColors.add(edge.color);
28541
- }
28542
28427
  for (const color of edgeColors) {
28543
28428
  const id = `fc-arrow-${color.replace("#", "")}`;
28544
28429
  defs.append("marker").attr("id", id).attr("viewBox", `0 0 ${ARROWHEAD_W3} ${ARROWHEAD_H3}`).attr("refX", ARROWHEAD_W3).attr("refY", ARROWHEAD_H3 / 2).attr("markerWidth", ARROWHEAD_W3).attr("markerHeight", ARROWHEAD_H3).attr("orient", "auto").append("polygon").attr("points", `0,0 ${ARROWHEAD_W3},${ARROWHEAD_H3 / 2} 0,${ARROWHEAD_H3}`).attr("fill", color);
@@ -28602,8 +28487,8 @@ function renderFlowchart(container, graph, layout, palette, isDark, onClickItem,
28602
28487
  const edge = layout.edges[ei];
28603
28488
  if (edge.points.length < 2) continue;
28604
28489
  const edgeG = contentG.append("g").attr("class", "fc-edge-group").attr("data-line-number", String(edge.lineNumber));
28605
- const edgeColor3 = edge.color ?? palette.textMuted;
28606
- const markerId = edge.color ? `fc-arrow-${edge.color.replace("#", "")}` : "fc-arrow";
28490
+ const edgeColor3 = palette.textMuted;
28491
+ const markerId = "fc-arrow";
28607
28492
  const pathD = lineGenerator5(edge.points);
28608
28493
  if (pathD) {
28609
28494
  edgeG.append("path").attr("d", pathD).attr("fill", "none").attr("stroke", edgeColor3).attr("stroke-width", EDGE_STROKE_WIDTH8).attr("marker-end", `url(#${markerId})`).attr("class", "fc-edge");
@@ -31087,7 +30972,7 @@ function renderNodes(svg, nodes, palette, isDark, animate, expandedNodeIds, acti
31087
30972
  const badgeText = `${node.computedInstances}x`;
31088
30973
  g.append("text").attr("x", x + node.width - 6).attr("y", y + NODE_HEADER_HEIGHT2 / 2 + META_FONT_SIZE4 * 0.35).attr("text-anchor", "end").attr("font-family", FONT_FAMILY).attr("font-size", META_FONT_SIZE4).attr("fill", textFill).attr("data-instance-node", node.id).style("cursor", "pointer").text(badgeText);
31089
30974
  }
31090
- const showDots = activeGroup != null && activeGroup.toLowerCase() === "capabilities";
30975
+ const showDots = activeGroup?.toLowerCase() === "capabilities";
31091
30976
  const roles = showDots && !node.isEdge ? inferRoles(node.properties) : [];
31092
30977
  if (roles.length > 0) {
31093
30978
  const dotY = isCollapsedGroup ? y + node.height - COLLAPSE_BAR_HEIGHT6 - NODE_PAD_BOTTOM2 / 2 : y + node.height - NODE_PAD_BOTTOM2 / 2;
@@ -31227,7 +31112,7 @@ function computeInfraLegendGroups(nodes, tagGroups, palette, edges) {
31227
31112
  }
31228
31113
  return groups;
31229
31114
  }
31230
- function renderLegend3(rootSvg, legendGroups, totalWidth, legendY, palette, isDark, activeGroup, playback) {
31115
+ function renderLegend3(rootSvg, legendGroups, totalWidth, legendY, palette, isDark, activeGroup, playback, exportMode = false) {
31231
31116
  if (legendGroups.length === 0 && !playback) return;
31232
31117
  const legendG = rootSvg.append("g").attr("transform", `translate(0, ${legendY})`);
31233
31118
  if (activeGroup) {
@@ -31243,7 +31128,7 @@ function renderLegend3(rootSvg, legendGroups, totalWidth, legendY, palette, isDa
31243
31128
  const legendConfig = {
31244
31129
  groups: allGroups,
31245
31130
  position: { placement: "top-center", titleRelation: "below-title" },
31246
- mode: "fixed",
31131
+ mode: exportMode ? "export" : "preview",
31247
31132
  showEmptyGroups: true
31248
31133
  };
31249
31134
  const legendState = { activeGroup };
@@ -31431,7 +31316,8 @@ function renderInfra(container, layout, palette, isDark, title, titleLineNumber,
31431
31316
  palette,
31432
31317
  isDark,
31433
31318
  activeGroup ?? null,
31434
- playback ?? void 0
31319
+ playback ?? void 0,
31320
+ exportMode
31435
31321
  );
31436
31322
  legendSvg.selectAll(".infra-legend-group").style("pointer-events", "auto");
31437
31323
  } else {
@@ -31443,7 +31329,8 @@ function renderInfra(container, layout, palette, isDark, title, titleLineNumber,
31443
31329
  palette,
31444
31330
  isDark,
31445
31331
  activeGroup ?? null,
31446
- playback ?? void 0
31332
+ playback ?? void 0,
31333
+ exportMode
31447
31334
  );
31448
31335
  }
31449
31336
  }
@@ -31887,7 +31774,7 @@ function analyzePert(parsed) {
31887
31774
  for (const e of edges) {
31888
31775
  if (!e.lag || e.lag.amount >= 0) continue;
31889
31776
  const src = activities.find((a) => a.id === e.source);
31890
- if (!src || !src.duration) continue;
31777
+ if (!src?.duration) continue;
31891
31778
  const leadDays = -toDays(e.lag, sprintDays);
31892
31779
  const srcDurDays = toDays(src.duration.m, sprintDays);
31893
31780
  if (e.type === "FS" && leadDays > srcDurDays) {
@@ -32393,7 +32280,7 @@ function buildSummary(input) {
32393
32280
  const anchor = input.anchor ?? null;
32394
32281
  if (parsedActivities.length === 0) return null;
32395
32282
  if (projectMu === null) {
32396
- if (anchor && anchor.kind === "backward") {
32283
+ if (anchor?.kind === "backward") {
32397
32284
  return [
32398
32285
  { text: "Expected duration: ?", level: 0 },
32399
32286
  { text: "P50 latest-safe start: ?", level: 0 },
@@ -32416,13 +32303,13 @@ function buildSummary(input) {
32416
32303
  const sigmaPositive = projectSigma !== null && projectSigma > 0;
32417
32304
  const showMcDetail = mc && sigmaPositive;
32418
32305
  const sigmaParen = showMcDetail ? ` (\xB1 ${roundForCaption(projectSigma)} ${pluralizeUnit(projectSigma, unit)})` : "";
32419
- if (anchor && anchor.kind === "forward") {
32306
+ if (anchor?.kind === "forward") {
32420
32307
  const projectMuDays = projectMu * unitToDays(unit);
32421
32308
  rows.push({
32422
32309
  text: `Expected finish: ${addCalendarDays(anchor.date, projectMuDays)}${sigmaParen}.`,
32423
32310
  level: 0
32424
32311
  });
32425
- } else if (anchor && anchor.kind === "backward") {
32312
+ } else if (anchor?.kind === "backward") {
32426
32313
  const projectMuDays = projectMu * unitToDays(unit);
32427
32314
  rows.push({
32428
32315
  text: `Expected start: ${addCalendarDays(anchor.date, -projectMuDays)}${sigmaParen}.`,
@@ -32441,13 +32328,13 @@ function buildSummary(input) {
32441
32328
  { pct: 80, days: monteCarloResult.p80 },
32442
32329
  { pct: 95, days: monteCarloResult.p95 }
32443
32330
  ];
32444
- if (anchor && anchor.kind === "forward") {
32331
+ if (anchor?.kind === "forward") {
32445
32332
  for (const { pct, days } of percentiles) {
32446
32333
  const offsetDays = roundConservative(days, "forward");
32447
32334
  const date = addCalendarDays(anchor.date, offsetDays);
32448
32335
  rows.push({ text: `P${pct} finish: ${date}.`, level: 1 });
32449
32336
  }
32450
- } else if (anchor && anchor.kind === "backward") {
32337
+ } else if (anchor?.kind === "backward") {
32451
32338
  for (const { pct, days } of percentiles) {
32452
32339
  const offsetDays = roundConservative(days, "backward");
32453
32340
  const date = addCalendarDays(anchor.date, -offsetDays);
@@ -32491,20 +32378,20 @@ function buildProjectSubtitle(input) {
32491
32378
  const sigmaPositive = projectSigma !== null && projectSigma > 0;
32492
32379
  const sigmaParen = sigmaPositive ? ` (\xB1 ${roundForCaption(projectSigma)})` : "";
32493
32380
  if (projectMu === null) {
32494
- if (anchor && anchor.kind === "forward") {
32381
+ if (anchor?.kind === "forward") {
32495
32382
  return `Expected finish: ? \xB7 \u2248 ? ${pluralizeUnit(2, unit)} of work`;
32496
32383
  }
32497
- if (anchor && anchor.kind === "backward") {
32384
+ if (anchor?.kind === "backward") {
32498
32385
  return `Expected start: ? \xB7 \u2248 ? ${pluralizeUnit(2, unit)} lead time`;
32499
32386
  }
32500
32387
  return `\u2248 ? ${pluralizeUnit(2, unit)}`;
32501
32388
  }
32502
32389
  const muStr = `${roundForCaption(projectMu)} ${pluralizeUnit(projectMu, unit)}`;
32503
- if (anchor && anchor.kind === "forward") {
32390
+ if (anchor?.kind === "forward") {
32504
32391
  const projectMuDays = projectMu * unitToDays(unit);
32505
32392
  return `Expected finish: ${addCalendarDays(anchor.date, projectMuDays)} \xB7 \u2248 ${muStr} of work${sigmaParen}`;
32506
32393
  }
32507
- if (anchor && anchor.kind === "backward") {
32394
+ if (anchor?.kind === "backward") {
32508
32395
  const projectMuDays = projectMu * unitToDays(unit);
32509
32396
  return `Expected start: ${addCalendarDays(anchor.date, -projectMuDays)} \xB7 \u2248 ${muStr} lead time${sigmaParen}`;
32510
32397
  }
@@ -32694,7 +32581,7 @@ function computeNodeSizing(resolved) {
32694
32581
  return { activityWidth, milestoneWidth, outerColW, midColW };
32695
32582
  }
32696
32583
  function nodeDimensions(resolved, id, sizing, overrides) {
32697
- if (overrides && overrides[id]) {
32584
+ if (overrides?.[id]) {
32698
32585
  return { width: overrides[id].width, height: overrides[id].height };
32699
32586
  }
32700
32587
  const r = resolved.activities.find((a) => a.activity.id === id);
@@ -33345,7 +33232,8 @@ function renderPert(container, resolved, layout, palette, isDark, options = {})
33345
33232
  x: 0,
33346
33233
  y: tagLegendY,
33347
33234
  width: exportWidth,
33348
- activeGroup: tagLegendActive
33235
+ activeGroup: tagLegendActive,
33236
+ exportMode: options.exportMode
33349
33237
  });
33350
33238
  }
33351
33239
  const root = svg.append("g").attr("transform", `translate(${offsetX}, ${offsetY})`);
@@ -33406,7 +33294,8 @@ function renderPertForExport(content, theme, palette, now) {
33406
33294
  renderPert(container, resolved, layout, palette, isDark, {
33407
33295
  title: hasTitle ? parsed.title : null,
33408
33296
  subtitle: resolved.projectSubtitle,
33409
- exportDims: { width: exportWidth, height: exportHeight }
33297
+ exportDims: { width: exportWidth, height: exportHeight },
33298
+ exportMode: true
33410
33299
  });
33411
33300
  const svgEl = container.querySelector("svg");
33412
33301
  if (!svgEl) return "";
@@ -34493,7 +34382,7 @@ function renderLegendBlock(svg, entries, args) {
34493
34382
  }
34494
34383
  function renderTagLegendRow(svg, resolved, palette, isDark, args) {
34495
34384
  if (resolved.tagGroups.length === 0) return;
34496
- const { x, y, width, activeGroup } = args;
34385
+ const { x, y, width, activeGroup, exportMode } = args;
34497
34386
  const groups = resolved.tagGroups.map((g) => ({
34498
34387
  name: g.name,
34499
34388
  entries: g.entries.map((e) => ({ value: e.value, color: e.color }))
@@ -34504,7 +34393,7 @@ function renderTagLegendRow(svg, resolved, palette, isDark, args) {
34504
34393
  {
34505
34394
  groups,
34506
34395
  position: { placement: "top-center", titleRelation: "below-title" },
34507
- mode: "fixed"
34396
+ mode: exportMode ? "export" : "preview"
34508
34397
  },
34509
34398
  { activeGroup },
34510
34399
  palette,
@@ -35944,7 +35833,8 @@ function renderGantt(container, resolved, palette, isDark, options, exportDims)
35944
35833
  ).attr("display", active ? null : "none");
35945
35834
  }
35946
35835
  drawLegend();
35947
- }
35836
+ },
35837
+ options?.exportMode ?? false
35948
35838
  );
35949
35839
  }
35950
35840
  }
@@ -36733,7 +36623,7 @@ function buildControlsToggles(hasCriticalPath, criticalPathActive, hasDependenci
36733
36623
  }
36734
36624
  return toggles;
36735
36625
  }
36736
- function renderTagLegend(svg, chartG, tagGroups, activeGroupName, chartLeftMargin, chartInnerWidth, legendY, palette, isDark, hasCriticalPath, criticalPathActive, _optionLineNumbers, onToggle, onToggleControlsExpand, currentSwimlaneGroup, onSwimlaneChange, legendViewMode, resolvedTasks, controlsExpanded = false, hasDependencies = false, dependenciesActive = false, onControlsToggle) {
36626
+ function renderTagLegend(svg, chartG, tagGroups, activeGroupName, chartLeftMargin, chartInnerWidth, legendY, palette, isDark, hasCriticalPath, criticalPathActive, _optionLineNumbers, onToggle, onToggleControlsExpand, currentSwimlaneGroup, onSwimlaneChange, legendViewMode, resolvedTasks, controlsExpanded = false, hasDependencies = false, dependenciesActive = false, onControlsToggle, exportMode = false) {
36737
36627
  let visibleGroups;
36738
36628
  if (activeGroupName) {
36739
36629
  const activeGroup = tagGroups.filter(
@@ -36828,7 +36718,7 @@ function renderTagLegend(svg, chartG, tagGroups, activeGroupName, chartLeftMargi
36828
36718
  placement: "top-center",
36829
36719
  titleRelation: "below-title"
36830
36720
  },
36831
- mode: "fixed",
36721
+ mode: exportMode ? "export" : "preview",
36832
36722
  capsulePillAddonWidth: iconReserve,
36833
36723
  controlsGroup: controlsToggles.length > 0 ? { toggles: controlsToggles } : void 0
36834
36724
  };
@@ -36935,7 +36825,7 @@ function renderTagLegend(svg, chartG, tagGroups, activeGroupName, chartLeftMargi
36935
36825
  placement: "top-center",
36936
36826
  titleRelation: "below-title"
36937
36827
  },
36938
- mode: "fixed",
36828
+ mode: exportMode ? "export" : "preview",
36939
36829
  controlsGroup: { toggles: controlsToggles }
36940
36830
  };
36941
36831
  const tagGroupG = legendRow.append("g");
@@ -37818,9 +37708,6 @@ function renderState(container, graph, layout, palette, isDark, onClickItem, exp
37818
37708
  const defs = svg.append("defs");
37819
37709
  defs.append("marker").attr("id", "st-arrow").attr("viewBox", `0 0 ${ARROWHEAD_W5} ${ARROWHEAD_H5}`).attr("refX", ARROWHEAD_W5).attr("refY", ARROWHEAD_H5 / 2).attr("markerWidth", ARROWHEAD_W5).attr("markerHeight", ARROWHEAD_H5).attr("orient", "auto").append("polygon").attr("points", `0,0 ${ARROWHEAD_W5},${ARROWHEAD_H5 / 2} 0,${ARROWHEAD_H5}`).attr("fill", palette.textMuted);
37820
37710
  const edgeColors = /* @__PURE__ */ new Set();
37821
- for (const edge of layout.edges) {
37822
- if (edge.color) edgeColors.add(edge.color);
37823
- }
37824
37711
  for (const color of edgeColors) {
37825
37712
  const id = `st-arrow-${color.replace("#", "")}`;
37826
37713
  defs.append("marker").attr("id", id).attr("viewBox", `0 0 ${ARROWHEAD_W5} ${ARROWHEAD_H5}`).attr("refX", ARROWHEAD_W5).attr("refY", ARROWHEAD_H5 / 2).attr("markerWidth", ARROWHEAD_W5).attr("markerHeight", ARROWHEAD_H5).attr("orient", "auto").append("polygon").attr("points", `0,0 ${ARROWHEAD_W5},${ARROWHEAD_H5 / 2} 0,${ARROWHEAD_H5}`).attr("fill", color);
@@ -37915,8 +37802,8 @@ function renderState(container, graph, layout, palette, isDark, onClickItem, exp
37915
37802
  for (let ei = 0; ei < layout.edges.length; ei++) {
37916
37803
  const edge = layout.edges[ei];
37917
37804
  const edgeG = contentG.append("g").attr("class", "st-edge-group").attr("data-line-number", String(edge.lineNumber));
37918
- const edgeColor3 = edge.color ?? palette.textMuted;
37919
- const markerId = edge.color ? `st-arrow-${edge.color.replace("#", "")}` : "st-arrow";
37805
+ const edgeColor3 = palette.textMuted;
37806
+ const markerId = "st-arrow";
37920
37807
  if (edge.source === edge.target) {
37921
37808
  const node = nodePositionMap.get(edge.source);
37922
37809
  if (node) {
@@ -39006,7 +38893,7 @@ function renderTechRadar(container, parsed, palette, isDark, onClickItem, export
39006
38893
  }
39007
38894
  ],
39008
38895
  position: { placement: "top-center", titleRelation: "below-title" },
39009
- mode: "fixed",
38896
+ mode: options?.exportMode ? "export" : "preview",
39010
38897
  controlsGroup: {
39011
38898
  toggles: [
39012
38899
  {
@@ -39609,7 +39496,7 @@ function getQuadrantLabelPosition(position, cx, cy, maxRadius) {
39609
39496
  };
39610
39497
  }
39611
39498
  }
39612
- function renderTechRadarForExport(container, parsed, palette, isDark, exportDims, viewState) {
39499
+ function renderTechRadarForExport(container, parsed, palette, isDark, exportDims, viewState, exportMode) {
39613
39500
  renderTechRadar(
39614
39501
  container,
39615
39502
  parsed,
@@ -39617,7 +39504,8 @@ function renderTechRadarForExport(container, parsed, palette, isDark, exportDims
39617
39504
  isDark,
39618
39505
  void 0,
39619
39506
  exportDims,
39620
- viewState
39507
+ viewState,
39508
+ { exportMode }
39621
39509
  );
39622
39510
  }
39623
39511
  var d3Selection16, BLIP_RADIUS2, BLIP_FONT_SIZE2, RING_LABEL_FONT_SIZE, QUADRANT_LABEL_FONT_SIZE, TITLE_FONT_SIZE3, LISTING_FONT_SIZE, LISTING_HEADER_FONT_SIZE, LISTING_TOP_MARGIN, LISTING_COL_GAP, LISTING_LINE_HEIGHT, LISTING_BLIP_R;
@@ -39996,7 +39884,7 @@ function renderJourneyMap(container, parsed, palette, isDark, options) {
39996
39884
  titleRelation: "inline-with-title"
39997
39885
  },
39998
39886
  titleWidth: 0,
39999
- mode: exportDims ? "inline" : "fixed"
39887
+ mode: options?.exportMode ? "export" : "preview"
40000
39888
  };
40001
39889
  const legendState = { activeGroup: effectiveActiveGroup };
40002
39890
  const legendCallbacks = {
@@ -40709,7 +40597,8 @@ function renderJourneyMapForExport(content, theme, palette) {
40709
40597
  const layout = layoutJourneyMap(parsed, palette, { isDark });
40710
40598
  const container = document.createElement("div");
40711
40599
  renderJourneyMap(container, parsed, palette, isDark, {
40712
- exportDims: { width: layout.totalWidth, height: layout.totalHeight }
40600
+ exportDims: { width: layout.totalWidth, height: layout.totalHeight },
40601
+ exportMode: true
40713
40602
  });
40714
40603
  const svgEl = container.querySelector("svg");
40715
40604
  if (!svgEl) return "";
@@ -41475,7 +41364,7 @@ function renderCycle(container, parsed, palette, isDark, onClickItem, exportDims
41475
41364
  const legendConfig = {
41476
41365
  groups: [],
41477
41366
  position: { placement: "top-center", titleRelation: "below-title" },
41478
- mode: "fixed",
41367
+ mode: renderOptions?.exportMode ? "export" : "preview",
41479
41368
  controlsGroup
41480
41369
  };
41481
41370
  const legendState = {
@@ -41659,7 +41548,7 @@ function renderCycle(container, parsed, palette, isDark, onClickItem, exportDims
41659
41548
  }
41660
41549
  }
41661
41550
  }
41662
- function renderCycleForExport(container, parsed, palette, isDark, exportDims, viewState) {
41551
+ function renderCycleForExport(container, parsed, palette, isDark, exportDims, viewState, exportMode) {
41663
41552
  renderCycle(
41664
41553
  container,
41665
41554
  parsed,
@@ -41667,7 +41556,8 @@ function renderCycleForExport(container, parsed, palette, isDark, exportDims, vi
41667
41556
  isDark,
41668
41557
  void 0,
41669
41558
  exportDims,
41670
- viewState
41559
+ viewState,
41560
+ { exportMode }
41671
41561
  );
41672
41562
  }
41673
41563
  function resolveNodeColor5(color, palette, defaultColor) {
@@ -43297,9 +43187,6 @@ function wrapLabelWords(words) {
43297
43187
  function renderRectParticipant(g, palette, isDark, color, solid) {
43298
43188
  g.append("rect").attr("x", -W / 2).attr("y", 0).attr("width", W).attr("height", H).attr("rx", 2).attr("ry", 2).attr("fill", fill(palette, isDark, color, solid)).attr("stroke", stroke(palette, color)).attr("stroke-width", SW);
43299
43189
  }
43300
- function renderServiceParticipant(g, palette, isDark, color, solid) {
43301
- g.append("rect").attr("x", -W / 2).attr("y", 0).attr("width", W).attr("height", H).attr("rx", SERVICE_BORDER_RADIUS).attr("ry", SERVICE_BORDER_RADIUS).attr("fill", fill(palette, isDark, color, solid)).attr("stroke", stroke(palette, color)).attr("stroke-width", SW);
43302
- }
43303
43190
  function renderActorParticipant(g, palette, color) {
43304
43191
  const headR = 8;
43305
43192
  const cx = 0;
@@ -43354,31 +43241,6 @@ function renderCacheParticipant(g, palette, isDark, color, solid) {
43354
43241
  g.append("line").attr("x1", W / 2).attr("y1", topY).attr("x2", W / 2).attr("y2", topY + bodyH).attr("stroke", s).attr("stroke-width", SW).attr("stroke-dasharray", dash);
43355
43242
  g.append("ellipse").attr("cx", 0).attr("cy", topY).attr("rx", W / 2).attr("ry", ry).attr("fill", f).attr("stroke", s).attr("stroke-width", SW).attr("stroke-dasharray", dash);
43356
43243
  }
43357
- function renderNetworkingParticipant(g, palette, isDark, color, solid) {
43358
- const inset = 16;
43359
- const points = [
43360
- `${-W / 2 + inset},0`,
43361
- `${W / 2 - inset},0`,
43362
- `${W / 2},${H / 2}`,
43363
- `${W / 2 - inset},${H}`,
43364
- `${-W / 2 + inset},${H}`,
43365
- `${-W / 2},${H / 2}`
43366
- ].join(" ");
43367
- g.append("polygon").attr("points", points).attr("fill", fill(palette, isDark, color, solid)).attr("stroke", stroke(palette, color)).attr("stroke-width", SW);
43368
- }
43369
- function renderFrontendParticipant(g, palette, isDark, color, solid) {
43370
- const screenH = H - 10;
43371
- const s = stroke(palette, color);
43372
- g.append("rect").attr("x", -W / 2).attr("y", 0).attr("width", W).attr("height", screenH).attr("rx", 3).attr("ry", 3).attr("fill", fill(palette, isDark, color, solid)).attr("stroke", s).attr("stroke-width", SW);
43373
- g.append("line").attr("x1", 0).attr("y1", screenH).attr("x2", 0).attr("y2", H - 2).attr("stroke", s).attr("stroke-width", SW);
43374
- g.append("line").attr("x1", -14).attr("y1", H - 2).attr("x2", 14).attr("y2", H - 2).attr("stroke", s).attr("stroke-width", SW);
43375
- }
43376
- function renderExternalParticipant(g, palette, isDark, color, solid) {
43377
- g.append("rect").attr("x", -W / 2).attr("y", 0).attr("width", W).attr("height", H).attr("rx", 2).attr("ry", 2).attr("fill", fill(palette, isDark, color, solid)).attr("stroke", stroke(palette, color)).attr("stroke-width", SW).attr("stroke-dasharray", "6 3");
43378
- }
43379
- function renderGatewayParticipant(g, palette, isDark, color, _solid) {
43380
- renderRectParticipant(g, palette, isDark, color);
43381
- }
43382
43244
  function groupMessagesBySection(elements, messages) {
43383
43245
  const groups = [];
43384
43246
  let currentGroup = null;
@@ -44017,7 +43879,7 @@ function renderSequenceDiagram(container, parsed, palette, isDark, _onNavigateTo
44017
43879
  }
44018
43880
  }
44019
43881
  const lastStep = renderSteps[renderSteps.length - 1];
44020
- const lastIsSelfCall = lastStep && lastStep.type === "call" && lastStep.from === lastStep.to;
43882
+ const lastIsSelfCall = lastStep?.type === "call" && lastStep.from === lastStep.to;
44021
43883
  const lastStepTrailing = lastIsSelfCall ? SELF_CALL_HEIGHT + 25 : stepSpacing;
44022
43884
  let contentBottomY = renderSteps.length > 0 ? Math.max(
44023
43885
  stepYPositions[stepYPositions.length - 1] + lastStepTrailing,
@@ -44191,6 +44053,9 @@ function renderSequenceDiagram(container, parsed, palette, isDark, _onNavigateTo
44191
44053
  const FRAME_PADDING_X = 30;
44192
44054
  const FRAME_PADDING_BOTTOM = 15;
44193
44055
  const FRAME_LABEL_HEIGHT = 18;
44056
+ const SELF_ARROW_PROJECTION = ACTIVATION_WIDTH / 2 + SELF_CALL_WIDTH;
44057
+ const SELF_ARROW_FRAME_PAD = 10;
44058
+ const frameRightmostX = Math.max(...Array.from(participantX.values()));
44194
44059
  const collectMsgIndices = (els) => {
44195
44060
  const indices = [];
44196
44061
  for (const el of els) {
@@ -44257,16 +44122,40 @@ function renderSequenceDiagram(container, parsed, palette, isDark, _onNavigateTo
44257
44122
  maxPX = Math.max(maxPX, px);
44258
44123
  }
44259
44124
  }
44260
- const frameX = minPX - FRAME_PADDING_X;
44125
+ let extraLeft = 0;
44126
+ let extraRight = 0;
44127
+ let maxStepIsSelfCall = false;
44128
+ for (const mi of allIndices) {
44129
+ const m = messages[mi];
44130
+ if (m.from === m.to) {
44131
+ const px = participantX.get(m.from);
44132
+ if (px !== void 0) {
44133
+ const flipLeft = px === frameRightmostX;
44134
+ if (flipLeft) {
44135
+ const loopMin = px - SELF_ARROW_PROJECTION;
44136
+ const need = minPX - FRAME_PADDING_X - loopMin + SELF_ARROW_FRAME_PAD;
44137
+ if (need > 0) extraLeft = Math.max(extraLeft, need);
44138
+ } else {
44139
+ const loopMax = px + SELF_ARROW_PROJECTION;
44140
+ const need = loopMax - (maxPX + FRAME_PADDING_X) + SELF_ARROW_FRAME_PAD;
44141
+ if (need > 0) extraRight = Math.max(extraRight, need);
44142
+ }
44143
+ }
44144
+ if (msgToLastStep.get(mi) === maxStep) {
44145
+ maxStepIsSelfCall = true;
44146
+ }
44147
+ }
44148
+ }
44149
+ const frameX = minPX - FRAME_PADDING_X - extraLeft;
44261
44150
  const frameY = stepY(minStep) - FRAME_PADDING_TOP;
44262
- const frameW = maxPX - minPX + FRAME_PADDING_X * 2;
44263
- const frameH = stepY(maxStep) - stepY(minStep) + FRAME_PADDING_TOP + FRAME_PADDING_BOTTOM;
44151
+ const frameW = maxPX - minPX + FRAME_PADDING_X * 2 + extraLeft + extraRight;
44152
+ const frameH = stepY(maxStep) - stepY(minStep) + FRAME_PADDING_TOP + FRAME_PADDING_BOTTOM + (maxStepIsSelfCall ? SELF_CALL_HEIGHT : 0);
44264
44153
  svg.append("rect").attr("x", frameX).attr("y", frameY).attr("width", frameW).attr("height", frameH).attr("fill", "none").attr("stroke", palette.textMuted).attr("stroke-width", 1).attr("stroke-dasharray", "2 3").attr("rx", 3).attr("ry", 3).attr("class", "block-frame").attr("data-block-line", String(el.lineNumber));
44265
44154
  deferredLabels.push({
44266
44155
  x: frameX + 6,
44267
44156
  y: frameY + FRAME_LABEL_HEIGHT - 4,
44268
44157
  text: `${el.type} ${el.label}`,
44269
- bold: true,
44158
+ bold: false,
44270
44159
  italic: false,
44271
44160
  blockLine: el.lineNumber
44272
44161
  });
@@ -44292,7 +44181,7 @@ function renderSequenceDiagram(container, parsed, palette, isDark, _onNavigateTo
44292
44181
  y: dividerY + 14,
44293
44182
  text: `else if ${branchData.label}`,
44294
44183
  bold: false,
44295
- italic: true,
44184
+ italic: false,
44296
44185
  blockLine: branchData.lineNumber
44297
44186
  });
44298
44187
  }
@@ -44319,7 +44208,7 @@ function renderSequenceDiagram(container, parsed, palette, isDark, _onNavigateTo
44319
44208
  y: dividerY + 14,
44320
44209
  text: "else",
44321
44210
  bold: false,
44322
- italic: true,
44211
+ italic: false,
44323
44212
  blockLine: el.elseLineNumber
44324
44213
  });
44325
44214
  }
@@ -44389,7 +44278,7 @@ function renderSequenceDiagram(container, parsed, palette, isDark, _onNavigateTo
44389
44278
  return side === "right" ? px + ACTIVATION_WIDTH / 2 + offset : px - ACTIVATION_WIDTH / 2 + offset;
44390
44279
  };
44391
44280
  const leftmostX = Math.min(...Array.from(participantX.values()));
44392
- const rightmostX = Math.max(...Array.from(participantX.values()));
44281
+ const rightmostX = frameRightmostX;
44393
44282
  const sectionLineX1 = leftmostX - PARTICIPANT_BOX_WIDTH / 2 - 10;
44394
44283
  const sectionLineX2 = rightmostX + PARTICIPANT_BOX_WIDTH / 2 + 10;
44395
44284
  for (const region of sectionRegions) {
@@ -44591,7 +44480,7 @@ function renderSequenceDiagram(container, parsed, palette, isDark, _onNavigateTo
44591
44480
  const legendConfig = {
44592
44481
  groups: resolvedGroups,
44593
44482
  position: { placement: "top-center", titleRelation: "below-title" },
44594
- mode: "fixed"
44483
+ mode: "preview"
44595
44484
  };
44596
44485
  const legendState = {
44597
44486
  activeGroup: activeTagGroup ?? null,
@@ -44648,27 +44537,12 @@ function renderParticipant(svg, participant, cx, cy, palette, isDark, color, tag
44648
44537
  case "database":
44649
44538
  renderDatabaseParticipant(g, palette, isDark, color, solid);
44650
44539
  break;
44651
- case "service":
44652
- renderServiceParticipant(g, palette, isDark, color, solid);
44653
- break;
44654
44540
  case "queue":
44655
44541
  renderQueueParticipant(g, palette, isDark, color, solid);
44656
44542
  break;
44657
44543
  case "cache":
44658
44544
  renderCacheParticipant(g, palette, isDark, color, solid);
44659
44545
  break;
44660
- case "networking":
44661
- renderNetworkingParticipant(g, palette, isDark, color, solid);
44662
- break;
44663
- case "frontend":
44664
- renderFrontendParticipant(g, palette, isDark, color, solid);
44665
- break;
44666
- case "external":
44667
- renderExternalParticipant(g, palette, isDark, color, solid);
44668
- break;
44669
- case "gateway":
44670
- renderGatewayParticipant(g, palette, isDark, color, solid);
44671
- break;
44672
44546
  default:
44673
44547
  renderRectParticipant(g, palette, isDark, color, solid);
44674
44548
  break;
@@ -44696,7 +44570,7 @@ function renderParticipant(svg, participant, cx, cy, palette, isDark, color, tag
44696
44570
  });
44697
44571
  }
44698
44572
  }
44699
- var d3Selection21, PARTICIPANT_GAP, PARTICIPANT_BOX_WIDTH, PARTICIPANT_BOX_HEIGHT, TOP_MARGIN, TITLE_HEIGHT8, PARTICIPANT_Y_OFFSET, SERVICE_BORDER_RADIUS, MESSAGE_START_OFFSET, LIFELINE_TAIL, ARROWHEAD_SIZE, NOTE_MAX_W, NOTE_FOLD, NOTE_PAD_H, NOTE_PAD_V, NOTE_FONT_SIZE, NOTE_LINE_H, NOTE_GAP, NOTE_CHAR_W, NOTE_CHARS_PER_LINE, ACTIVATION_WIDTH, SELF_CALL_HEIGHT, SELF_CALL_WIDTH, NOTE_LANE_MAX, LABEL_CHAR_WIDTH, LABEL_MAX_CHARS, fill, stroke, SW, W, H;
44573
+ var d3Selection21, PARTICIPANT_GAP, PARTICIPANT_BOX_WIDTH, PARTICIPANT_BOX_HEIGHT, TOP_MARGIN, TITLE_HEIGHT8, PARTICIPANT_Y_OFFSET, MESSAGE_START_OFFSET, LIFELINE_TAIL, ARROWHEAD_SIZE, NOTE_MAX_W, NOTE_FOLD, NOTE_PAD_H, NOTE_PAD_V, NOTE_FONT_SIZE, NOTE_LINE_H, NOTE_GAP, NOTE_CHAR_W, NOTE_CHARS_PER_LINE, ACTIVATION_WIDTH, SELF_CALL_HEIGHT, SELF_CALL_WIDTH, NOTE_LANE_MAX, LABEL_CHAR_WIDTH, LABEL_MAX_CHARS, fill, stroke, SW, W, H;
44700
44574
  var init_renderer19 = __esm({
44701
44575
  "src/sequence/renderer.ts"() {
44702
44576
  "use strict";
@@ -44718,7 +44592,6 @@ var init_renderer19 = __esm({
44718
44592
  TOP_MARGIN = 20;
44719
44593
  TITLE_HEIGHT8 = 30;
44720
44594
  PARTICIPANT_Y_OFFSET = 10;
44721
- SERVICE_BORDER_RADIUS = 10;
44722
44595
  MESSAGE_START_OFFSET = 30;
44723
44596
  LIFELINE_TAIL = 30;
44724
44597
  ARROWHEAD_SIZE = 8;
@@ -44910,7 +44783,7 @@ function parseVisualization(content, palette) {
44910
44783
  const warn = (line12, message) => {
44911
44784
  result.diagnostics.push(makeDgmoError(line12, message, "warning"));
44912
44785
  };
44913
- if (!content || !content.trim()) {
44786
+ if (!content?.trim()) {
44914
44787
  return fail(0, "Empty content");
44915
44788
  }
44916
44789
  const lines = content.split("\n");
@@ -44992,7 +44865,9 @@ function parseVisualization(content, palette) {
44992
44865
  if (currentTimelineTagGroup && indent === 0) {
44993
44866
  currentTimelineTagGroup = null;
44994
44867
  }
44995
- const groupMatch = line12.match(/^\[(.+?)\](?:\s*\(([^)]+)\))?\s*$/);
44868
+ const groupMatch = line12.match(
44869
+ /^\[(.+?)\](?:\s+(red|orange|yellow|green|blue|purple|teal|cyan|gray|black|white))?\s*$/
44870
+ );
44996
44871
  if (groupMatch) {
44997
44872
  if (result.type === "arc") {
44998
44873
  const name = groupMatch[1].trim();
@@ -45034,7 +44909,7 @@ function parseVisualization(content, palette) {
45034
44909
  }
45035
44910
  if (result.type === "arc") {
45036
44911
  const linkMatch = line12.match(
45037
- /^(.+?)\s*->\s*(.+?)(?:\(([^)]+)\))?\s*(?:\s+(-?[\d,_]+(?:\.[\d]+)?))?$/
44912
+ /^(.+?)\s*->\s*(.+?)(?:\s+(red|orange|yellow|green|blue|purple|teal|cyan|gray|black|white))?(?:\s+(-?[\d,_]+(?:\.[\d]+)?))?$/
45038
44913
  );
45039
44914
  if (linkMatch) {
45040
44915
  const source = linkMatch[1].trim();
@@ -45073,7 +44948,7 @@ function parseVisualization(content, palette) {
45073
44948
  } else {
45074
44949
  if (line12.startsWith("//")) continue;
45075
44950
  const eraEntryMatch = line12.match(
45076
- /^(\d{4}(?:-\d{2})?(?:-\d{2}(?: \d{2}:\d{2})?)?)\s*(?:->|\u2013>)\s*(\d{4}(?:-\d{2})?(?:-\d{2}(?: \d{2}:\d{2})?)?)\s+(.+?)(?:\s*\(([^)]+)\))?\s*$/
44951
+ /^(\d{4}(?:-\d{2})?(?:-\d{2}(?: \d{2}:\d{2})?)?)\s*(?:->|\u2013>)\s*(\d{4}(?:-\d{2})?(?:-\d{2}(?: \d{2}:\d{2})?)?)\s+(.+?)(?:\s+(red|orange|yellow|green|blue|purple|teal|cyan|gray|black|white))?\s*$/
45077
44952
  );
45078
44953
  if (eraEntryMatch) {
45079
44954
  const colorAnnotation = eraEntryMatch[4]?.trim() || null;
@@ -45101,7 +44976,7 @@ function parseVisualization(content, palette) {
45101
44976
  } else {
45102
44977
  if (line12.startsWith("//")) continue;
45103
44978
  const markerEntryMatch = line12.match(
45104
- /^(\d{4}(?:-\d{2})?(?:-\d{2}(?: \d{2}:\d{2})?)?)\s+(.+?)(?:\s*\(([^)]+)\))?\s*$/
44979
+ /^(\d{4}(?:-\d{2})?(?:-\d{2}(?: \d{2}:\d{2})?)?)\s+(.+?)(?:\s+(red|orange|yellow|green|blue|purple|teal|cyan|gray|black|white))?\s*$/
45105
44980
  );
45106
44981
  if (markerEntryMatch) {
45107
44982
  const colorAnnotation = markerEntryMatch[3]?.trim() || null;
@@ -45134,7 +45009,7 @@ function parseVisualization(content, palette) {
45134
45009
  continue;
45135
45010
  }
45136
45011
  const eraMatch = line12.match(
45137
- /^era\s+(\d{4}(?:-\d{2})?(?:-\d{2}(?: \d{2}:\d{2})?)?)\s*(?:->|\u2013>)\s*(\d{4}(?:-\d{2})?(?:-\d{2}(?: \d{2}:\d{2})?)?)\s+(.+?)(?:\s*\(([^)]+)\))?\s*$/
45012
+ /^era\s+(\d{4}(?:-\d{2})?(?:-\d{2}(?: \d{2}:\d{2})?)?)\s*(?:->|\u2013>)\s*(\d{4}(?:-\d{2})?(?:-\d{2}(?: \d{2}:\d{2})?)?)\s+(.+?)(?:\s+(red|orange|yellow|green|blue|purple|teal|cyan|gray|black|white))?\s*$/
45138
45013
  );
45139
45014
  if (eraMatch) {
45140
45015
  const colorAnnotation = eraMatch[4]?.trim() || null;
@@ -45153,7 +45028,7 @@ function parseVisualization(content, palette) {
45153
45028
  continue;
45154
45029
  }
45155
45030
  const markerMatch = line12.match(
45156
- /^marker\s+(\d{4}(?:-\d{2})?(?:-\d{2}(?: \d{2}:\d{2})?)?)\s+(.+?)(?:\s*\(([^)]+)\))?\s*$/
45031
+ /^marker\s+(\d{4}(?:-\d{2})?(?:-\d{2}(?: \d{2}:\d{2})?)?)\s+(.+?)(?:\s+(red|orange|yellow|green|blue|purple|teal|cyan|gray|black|white))?\s*$/
45157
45032
  );
45158
45033
  if (markerMatch) {
45159
45034
  const colorAnnotation = markerMatch[3]?.trim() || null;
@@ -45274,13 +45149,11 @@ function parseVisualization(content, palette) {
45274
45149
  }
45275
45150
  }
45276
45151
  if (!/^(solid-fill|no-name|no-value|no-percent|no-title)$/i.test(line12)) {
45277
- const legacyAliasMatch = line12.match(
45278
- /^([^(:]+?)(?:\(([^)]+)\))?\s+alias\s+(\S+)\s*$/i
45279
- );
45152
+ const legacyAliasMatch = line12.match(/^(.+?)\s+alias\s+(\S+)\s*$/i);
45280
45153
  if (legacyAliasMatch) {
45281
- const name = legacyAliasMatch[1].trim();
45282
- const colorName = legacyAliasMatch[2]?.trim() ?? null;
45283
- const aliasToken = legacyAliasMatch[3].trim();
45154
+ const nameWithMaybeColor = legacyAliasMatch[1].trim();
45155
+ const aliasToken = legacyAliasMatch[2].trim();
45156
+ const { label: name, colorName } = peelTrailingColorName(nameWithMaybeColor);
45284
45157
  let color = null;
45285
45158
  if (colorName) {
45286
45159
  color = resolveColorWithDiagnostic(
@@ -45302,11 +45175,12 @@ function parseVisualization(content, palette) {
45302
45175
  continue;
45303
45176
  }
45304
45177
  const setDeclMatch = line12.match(
45305
- /^([^(:]+?)(?:\(([^)]+)\))?(?:\s+as\s+([A-Za-z][A-Za-z0-9_]{0,11}))?\s*$/i
45178
+ /^(.+?)(?:\s+as\s+([A-Za-z][A-Za-z0-9_]{0,11}))?\s*$/i
45306
45179
  );
45307
45180
  if (setDeclMatch) {
45308
- const name = setDeclMatch[1].trim();
45309
- const colorName = setDeclMatch[2]?.trim() ?? null;
45181
+ const nameWithMaybeColor = setDeclMatch[1].trim();
45182
+ const alias = setDeclMatch[2]?.trim() ?? null;
45183
+ const { label: name, colorName } = peelTrailingColorName(nameWithMaybeColor);
45310
45184
  let color = null;
45311
45185
  if (colorName) {
45312
45186
  color = resolveColorWithDiagnostic(
@@ -45316,7 +45190,6 @@ function parseVisualization(content, palette) {
45316
45190
  palette
45317
45191
  ) ?? null;
45318
45192
  }
45319
- const alias = setDeclMatch[3]?.trim() ?? null;
45320
45193
  result.vennSets.push({ name, alias, color, lineNumber });
45321
45194
  continue;
45322
45195
  }
@@ -45362,10 +45235,9 @@ function parseVisualization(content, palette) {
45362
45235
  if (quadrantMatch) {
45363
45236
  const position = quadrantMatch[1].toLowerCase();
45364
45237
  const labelPart = quadrantMatch[2].trim();
45365
- const labelColorMatch = labelPart.match(/^(.+?)\s*\(([^)]+)\)\s*$/);
45366
- const text = labelColorMatch ? labelColorMatch[1].trim() : labelPart;
45367
- const color = labelColorMatch ? resolveColorWithDiagnostic(
45368
- labelColorMatch[2].trim(),
45238
+ const { label: text, colorName } = peelTrailingColorName(labelPart);
45239
+ const color = colorName ? resolveColorWithDiagnostic(
45240
+ colorName,
45369
45241
  lineNumber,
45370
45242
  result.diagnostics,
45371
45243
  palette
@@ -45555,10 +45427,9 @@ function parseVisualization(content, palette) {
45555
45427
  );
45556
45428
  continue;
45557
45429
  }
45558
- const colorMatch = joinedLabel.match(/^(.+?)\(([^)]+)\)\s*$/);
45559
- const labelPart = colorMatch ? colorMatch[1].trim() : joinedLabel;
45560
- const colorPart = colorMatch ? resolveColorWithDiagnostic(
45561
- colorMatch[2].trim(),
45430
+ const { label: labelPart, colorName: colorWord } = peelTrailingColorName(joinedLabel);
45431
+ const colorPart = colorWord ? resolveColorWithDiagnostic(
45432
+ colorWord,
45562
45433
  lineNumber,
45563
45434
  result.diagnostics,
45564
45435
  palette
@@ -46847,7 +46718,7 @@ function makeTimelineHoverHelpers() {
46847
46718
  setTagAttrs
46848
46719
  };
46849
46720
  }
46850
- function renderTimelineTagLegendOverlay(container, parsed, palette, isDark, setup, hovers, onClickItem, exportDims, swimlaneTagGroup, activeTagGroup, onTagStateChange, viewMode) {
46721
+ function renderTimelineTagLegendOverlay(container, parsed, palette, isDark, setup, hovers, onClickItem, exportDims, swimlaneTagGroup, activeTagGroup, onTagStateChange, viewMode, exportMode) {
46851
46722
  if (parsed.timelineTagGroups.length === 0) return;
46852
46723
  const { width, textColor, groupColorMap, solid } = setup;
46853
46724
  const { FADE_OPACITY: FADE_OPACITY3, fadeReset, fadeToTagValue } = hovers;
@@ -46918,7 +46789,7 @@ function renderTimelineTagLegendOverlay(container, parsed, palette, isDark, setu
46918
46789
  const centralConfig = {
46919
46790
  groups: centralGroups,
46920
46791
  position: { placement: "top-center", titleRelation: "below-title" },
46921
- mode: "fixed",
46792
+ mode: exportMode ? "export" : "preview",
46922
46793
  capsulePillAddonWidth: iconAddon
46923
46794
  };
46924
46795
  const centralState = { activeGroup: centralActive };
@@ -46952,7 +46823,7 @@ function renderTimelineTagLegendOverlay(container, parsed, palette, isDark, setu
46952
46823
  const groupKey = groupName.toLowerCase();
46953
46824
  groupEl.attr("data-tag-group", groupKey);
46954
46825
  if (isActive && !viewMode) {
46955
- const isSwimActive = currentSwimlaneGroup != null && currentSwimlaneGroup.toLowerCase() === groupKey;
46826
+ const isSwimActive = currentSwimlaneGroup?.toLowerCase() === groupKey;
46956
46827
  const pillWidth3 = measureLegendText(groupName, LG_PILL_FONT_SIZE) + LG_PILL_PAD;
46957
46828
  const pillXOff = LG_CAPSULE_PAD;
46958
46829
  const iconX = pillXOff + pillWidth3 + 5;
@@ -47762,7 +47633,7 @@ function renderTimelineVertical(container, parsed, palette, isDark, setup, hover
47762
47633
  }
47763
47634
  }
47764
47635
  }
47765
- function renderTimeline(container, parsed, palette, isDark, onClickItem, exportDims, activeTagGroup, swimlaneTagGroup, onTagStateChange, viewMode) {
47636
+ function renderTimeline(container, parsed, palette, isDark, onClickItem, exportDims, activeTagGroup, swimlaneTagGroup, onTagStateChange, viewMode, exportMode) {
47766
47637
  const setup = setupTimeline(
47767
47638
  container,
47768
47639
  parsed,
@@ -47837,7 +47708,8 @@ function renderTimeline(container, parsed, palette, isDark, onClickItem, exportD
47837
47708
  swimlaneTagGroup,
47838
47709
  activeTagGroup,
47839
47710
  onTagStateChange,
47840
- viewMode
47711
+ viewMode,
47712
+ exportMode
47841
47713
  );
47842
47714
  }
47843
47715
  function getRotateFn(mode) {
@@ -48981,6 +48853,7 @@ function finalizeSvgExport(container, theme, palette) {
48981
48853
  return svgHtml;
48982
48854
  }
48983
48855
  async function renderForExport(content, theme, palette, viewState, options) {
48856
+ const exportMode = options?.exportMode ?? false;
48984
48857
  const { parseDgmoChartType: parseDgmoChartType2 } = await Promise.resolve().then(() => (init_dgmo_router(), dgmo_router_exports));
48985
48858
  const detectedType = parseDgmoChartType2(content);
48986
48859
  if (detectedType === "org") {
@@ -49022,7 +48895,9 @@ async function renderForExport(content, theme, palette, viewState, options) {
49022
48895
  void 0,
49023
48896
  { width: exportWidth, height: exportHeight },
49024
48897
  activeTagGroup,
49025
- hiddenAttributes
48898
+ hiddenAttributes,
48899
+ void 0,
48900
+ exportMode
49026
48901
  );
49027
48902
  return finalizeSvgExport(container2, theme, effectivePalette2);
49028
48903
  }
@@ -49064,7 +48939,8 @@ async function renderForExport(content, theme, palette, viewState, options) {
49064
48939
  void 0,
49065
48940
  { width: exportWidth, height: exportHeight },
49066
48941
  activeTagGroup,
49067
- hiddenAttributes
48942
+ hiddenAttributes,
48943
+ exportMode
49068
48944
  );
49069
48945
  return finalizeSvgExport(container2, theme, effectivePalette2);
49070
48946
  }
@@ -49087,7 +48963,8 @@ async function renderForExport(content, theme, palette, viewState, options) {
49087
48963
  currentSwimlaneGroup: viewState?.swim ?? null,
49088
48964
  collapsedLanes: viewState?.cl ? new Set(viewState.cl) : void 0,
49089
48965
  collapsedColumns: viewState?.cc ? new Set(viewState.cc) : void 0,
49090
- compactMeta: viewState?.cm
48966
+ compactMeta: viewState?.cm,
48967
+ exportMode
49091
48968
  });
49092
48969
  return finalizeSvgExport(container2, theme, effectivePalette2);
49093
48970
  }
@@ -49111,7 +48988,9 @@ async function renderForExport(content, theme, palette, viewState, options) {
49111
48988
  effectivePalette2,
49112
48989
  theme === "dark",
49113
48990
  void 0,
49114
- { width: exportWidth, height: exportHeight }
48991
+ { width: exportWidth, height: exportHeight },
48992
+ void 0,
48993
+ exportMode
49115
48994
  );
49116
48995
  return finalizeSvgExport(container2, theme, effectivePalette2);
49117
48996
  }
@@ -49141,7 +49020,8 @@ async function renderForExport(content, theme, palette, viewState, options) {
49141
49020
  erParsed.options["active-tag"],
49142
49021
  viewState?.tag ?? options?.tagGroup
49143
49022
  ),
49144
- viewState?.sem
49023
+ viewState?.sem,
49024
+ exportMode
49145
49025
  );
49146
49026
  return finalizeSvgExport(container2, theme, effectivePalette2);
49147
49027
  }
@@ -49174,7 +49054,8 @@ async function renderForExport(content, theme, palette, viewState, options) {
49174
49054
  {
49175
49055
  exportDims: { width: exportWidth, height: exportHeight },
49176
49056
  activeTagGroup: viewState?.tag ?? options?.tagGroup,
49177
- hiddenTagValues: blHiddenTagValues
49057
+ hiddenTagValues: blHiddenTagValues,
49058
+ exportMode
49178
49059
  }
49179
49060
  );
49180
49061
  return finalizeSvgExport(container2, theme, effectivePalette2);
@@ -49220,7 +49101,7 @@ async function renderForExport(content, theme, palette, viewState, options) {
49220
49101
  void 0,
49221
49102
  hideDescriptions,
49222
49103
  colorByDepth ? null : activeTagGroup,
49223
- colorByDepth ? { colorByDepth: true } : void 0
49104
+ colorByDepth ? { colorByDepth: true, exportMode } : { exportMode }
49224
49105
  );
49225
49106
  return finalizeSvgExport(container2, theme, effectivePalette2);
49226
49107
  }
@@ -49283,7 +49164,8 @@ async function renderForExport(content, theme, palette, viewState, options) {
49283
49164
  c4Parsed.tagGroups,
49284
49165
  c4Parsed.options["active-tag"],
49285
49166
  viewState?.tag ?? options?.tagGroup
49286
- )
49167
+ ),
49168
+ exportMode
49287
49169
  );
49288
49170
  return finalizeSvgExport(container2, theme, effectivePalette2);
49289
49171
  }
@@ -49419,7 +49301,8 @@ async function renderForExport(content, theme, palette, viewState, options) {
49419
49301
  resolved.tagGroups,
49420
49302
  resolved.options.activeTag ?? void 0,
49421
49303
  viewState?.tag ?? options?.tagGroup
49422
- )
49304
+ ),
49305
+ exportMode
49423
49306
  },
49424
49307
  { width: EXPORT_W, height: EXPORT_H }
49425
49308
  );
@@ -49460,7 +49343,8 @@ async function renderForExport(content, theme, palette, viewState, options) {
49460
49343
  effectivePalette2,
49461
49344
  theme === "dark",
49462
49345
  { width: RADAR_EXPORT_W, height: RADAR_EXPORT_H },
49463
- viewState
49346
+ viewState,
49347
+ exportMode
49464
49348
  );
49465
49349
  return finalizeSvgExport(container2, theme, effectivePalette2);
49466
49350
  }
@@ -49480,7 +49364,8 @@ async function renderForExport(content, theme, palette, viewState, options) {
49480
49364
  jmLayout.totalHeight
49481
49365
  );
49482
49366
  renderJourneyMap2(container2, jmParsed, effectivePalette2, theme === "dark", {
49483
- exportDims: { width: jmLayout.totalWidth, height: jmLayout.totalHeight }
49367
+ exportDims: { width: jmLayout.totalWidth, height: jmLayout.totalHeight },
49368
+ exportMode
49484
49369
  });
49485
49370
  return finalizeSvgExport(container2, theme, effectivePalette2);
49486
49371
  }
@@ -49497,7 +49382,8 @@ async function renderForExport(content, theme, palette, viewState, options) {
49497
49382
  effectivePalette2,
49498
49383
  theme === "dark",
49499
49384
  { width: EXPORT_WIDTH, height: EXPORT_HEIGHT },
49500
- viewState
49385
+ viewState,
49386
+ exportMode
49501
49387
  );
49502
49388
  return finalizeSvgExport(container2, theme, effectivePalette2);
49503
49389
  }
@@ -49616,7 +49502,10 @@ async function renderForExport(content, theme, palette, viewState, options) {
49616
49502
  void 0,
49617
49503
  viewState?.tag ?? options?.tagGroup
49618
49504
  ),
49619
- viewState?.swim
49505
+ viewState?.swim,
49506
+ void 0,
49507
+ void 0,
49508
+ exportMode
49620
49509
  );
49621
49510
  } else if (parsed.type === "venn") {
49622
49511
  renderVenn(container, parsed, effectivePalette, isDark, void 0, dims);
@@ -50365,7 +50254,6 @@ __export(advanced_exports, {
50365
50254
  looksLikeSitemap: () => looksLikeSitemap,
50366
50255
  looksLikeState: () => looksLikeState,
50367
50256
  makeDgmoError: () => makeDgmoError,
50368
- matchColorParens: () => matchColorParens,
50369
50257
  matchesContiguously: () => matchesContiguously,
50370
50258
  measurePertAnalysisBlock: () => measurePertAnalysisBlock,
50371
50259
  mix: () => mix,
@@ -51603,7 +51491,11 @@ init_parser8();
51603
51491
  init_parser2();
51604
51492
  init_parser10();
51605
51493
  init_parsing();
51494
+ init_colors();
51606
51495
  init_chart_types();
51496
+ var RECOGNIZED_COLOR_SET2 = new Set(
51497
+ RECOGNIZED_COLOR_NAMES
51498
+ );
51607
51499
  var extractorRegistry = /* @__PURE__ */ new Map();
51608
51500
  function registerExtractor(kind, fn) {
51609
51501
  extractorRegistry.set(kind, fn);
@@ -52090,20 +51982,7 @@ var CHART_TYPES = [...ALL_CHART_TYPES].filter((t) => t !== "multi-line").map((na
52090
51982
  description: CHART_TYPE_DESCRIPTIONS2[name] ?? name
52091
51983
  }));
52092
51984
  var ENTITY_TYPES = /* @__PURE__ */ new Map([
52093
- [
52094
- "sequence",
52095
- [
52096
- "service",
52097
- "database",
52098
- "actor",
52099
- "queue",
52100
- "cache",
52101
- "gateway",
52102
- "external",
52103
- "networking",
52104
- "frontend"
52105
- ]
52106
- ],
51985
+ ["sequence", ["actor", "database", "queue", "cache"]],
52107
51986
  [
52108
51987
  "c4",
52109
51988
  ["person", "system", "container", "component", "external", "database"]
@@ -52372,8 +52251,8 @@ function extractTagDeclarations(docText) {
52372
52251
  }
52373
52252
  if (currentAlias !== null && raw.length > 0 && (raw[0] === " " || raw[0] === " ")) {
52374
52253
  if (trimmed && !trimmed.startsWith("//")) {
52375
- const colorIdx = trimmed.indexOf("(");
52376
- const value = colorIdx > 0 ? trimmed.substring(0, colorIdx).trim() : trimmed;
52254
+ const lastSpaceIdx = trimmed.lastIndexOf(" ");
52255
+ const value = lastSpaceIdx > 0 && RECOGNIZED_COLOR_SET2.has(trimmed.substring(lastSpaceIdx + 1)) ? trimmed.substring(0, lastSpaceIdx).trim() : trimmed;
52377
52256
  if (value) currentValues.push(value);
52378
52257
  }
52379
52258
  continue;
@@ -52925,7 +52804,6 @@ init_dgmo_router();
52925
52804
  looksLikeSitemap,
52926
52805
  looksLikeState,
52927
52806
  makeDgmoError,
52928
- matchColorParens,
52929
52807
  matchesContiguously,
52930
52808
  measurePertAnalysisBlock,
52931
52809
  mix,