schematex 0.5.0 → 0.6.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 (180) hide show
  1. package/README.md +89 -7
  2. package/dist/ai/ai-sdk.cjs +32 -26
  3. package/dist/ai/ai-sdk.cjs.map +1 -1
  4. package/dist/ai/ai-sdk.d.cts +4 -3
  5. package/dist/ai/ai-sdk.d.ts +4 -3
  6. package/dist/ai/ai-sdk.js +28 -22
  7. package/dist/ai/ai-sdk.js.map +1 -1
  8. package/dist/ai/index.cjs +37 -25
  9. package/dist/ai/index.d.cts +20 -153
  10. package/dist/ai/index.d.ts +20 -153
  11. package/dist/ai/index.js +17 -17
  12. package/dist/{api-C5UcmT7n.d.cts → api-XWHHAhQI.d.ts} +12 -2
  13. package/dist/{api-C5UcmT7n.d.ts → api-qVDutqXH.d.cts} +12 -2
  14. package/dist/browser.cjs +37 -19
  15. package/dist/browser.cjs.map +1 -1
  16. package/dist/browser.d.cts +12 -3
  17. package/dist/browser.d.ts +12 -3
  18. package/dist/browser.js +27 -19
  19. package/dist/browser.js.map +1 -1
  20. package/dist/{chunk-3YUUC6RN.cjs → chunk-25ZON47K.cjs} +4105 -267
  21. package/dist/chunk-25ZON47K.cjs.map +1 -0
  22. package/dist/{chunk-N7W5KZK7.cjs → chunk-2L4YXZAZ.cjs} +4 -4
  23. package/dist/{chunk-N7W5KZK7.cjs.map → chunk-2L4YXZAZ.cjs.map} +1 -1
  24. package/dist/{chunk-ZYRCPSBU.js → chunk-3IE7KZY4.js} +4 -4
  25. package/dist/{chunk-ZYRCPSBU.js.map → chunk-3IE7KZY4.js.map} +1 -1
  26. package/dist/{chunk-ZX74KJPM.js → chunk-3VB5AT4R.js} +3 -3
  27. package/dist/{chunk-ZX74KJPM.js.map → chunk-3VB5AT4R.js.map} +1 -1
  28. package/dist/{chunk-S2KJRHDZ.cjs → chunk-4UFR2LB6.cjs} +13 -13
  29. package/dist/{chunk-S2KJRHDZ.cjs.map → chunk-4UFR2LB6.cjs.map} +1 -1
  30. package/dist/{chunk-QTNPMIO2.cjs → chunk-6JI6FWLZ.cjs} +341 -35
  31. package/dist/chunk-6JI6FWLZ.cjs.map +1 -0
  32. package/dist/{chunk-GTDQAN2Z.js → chunk-7AFW2J6J.js} +4075 -247
  33. package/dist/chunk-7AFW2J6J.js.map +1 -0
  34. package/dist/{chunk-UFTYX73U.js → chunk-7F76AWOI.js} +339 -35
  35. package/dist/chunk-7F76AWOI.js.map +1 -0
  36. package/dist/{chunk-BW4KGTV7.cjs → chunk-C5C5EF3W.cjs} +4 -4
  37. package/dist/{chunk-BW4KGTV7.cjs.map → chunk-C5C5EF3W.cjs.map} +1 -1
  38. package/dist/{chunk-VJGMEGMR.js → chunk-DOK7LKLO.js} +125 -13
  39. package/dist/chunk-DOK7LKLO.js.map +1 -0
  40. package/dist/{chunk-3M6WB62Y.cjs → chunk-ECD5XHBM.cjs} +139 -7
  41. package/dist/chunk-ECD5XHBM.cjs.map +1 -0
  42. package/dist/{chunk-L3CTXXVZ.js → chunk-FBS3PACU.js} +3 -3
  43. package/dist/{chunk-L3CTXXVZ.js.map → chunk-FBS3PACU.js.map} +1 -1
  44. package/dist/{chunk-QUKVGHN4.cjs → chunk-FKJBXGWP.cjs} +4 -4
  45. package/dist/{chunk-QUKVGHN4.cjs.map → chunk-FKJBXGWP.cjs.map} +1 -1
  46. package/dist/{chunk-SZK376QB.js → chunk-H4MT5TJP.js} +3 -3
  47. package/dist/{chunk-SZK376QB.js.map → chunk-H4MT5TJP.js.map} +1 -1
  48. package/dist/{chunk-3M6T7KB4.js → chunk-HAZALB7U.js} +3 -3
  49. package/dist/{chunk-3M6T7KB4.js.map → chunk-HAZALB7U.js.map} +1 -1
  50. package/dist/{chunk-VFZOPRQP.cjs → chunk-HWVBHU3O.cjs} +5 -5
  51. package/dist/{chunk-VFZOPRQP.cjs.map → chunk-HWVBHU3O.cjs.map} +1 -1
  52. package/dist/{chunk-D7EHZFK4.cjs → chunk-L7POWM5B.cjs} +138 -2
  53. package/dist/chunk-L7POWM5B.cjs.map +1 -0
  54. package/dist/{chunk-6OSUNBZY.js → chunk-LGABFD3L.js} +135 -7
  55. package/dist/chunk-LGABFD3L.js.map +1 -0
  56. package/dist/{chunk-2VNMKOUO.js → chunk-LRI4RH2N.js} +135 -3
  57. package/dist/chunk-LRI4RH2N.js.map +1 -0
  58. package/dist/{chunk-VDSYMSUY.js → chunk-MVIEIKOI.js} +3 -3
  59. package/dist/{chunk-VDSYMSUY.js.map → chunk-MVIEIKOI.js.map} +1 -1
  60. package/dist/{chunk-ZL5RB4UV.js → chunk-N5B242WY.js} +3 -3
  61. package/dist/{chunk-ZL5RB4UV.js.map → chunk-N5B242WY.js.map} +1 -1
  62. package/dist/{chunk-IM4RCUHA.js → chunk-P63S7P6N.js} +1309 -69
  63. package/dist/chunk-P63S7P6N.js.map +1 -0
  64. package/dist/{chunk-YLEVMOK2.cjs → chunk-R66QG3XT.cjs} +5 -4
  65. package/dist/{chunk-YLEVMOK2.cjs.map → chunk-R66QG3XT.cjs.map} +1 -1
  66. package/dist/{chunk-I55HO32M.js → chunk-RJMCWT7Z.js} +3 -3
  67. package/dist/{chunk-I55HO32M.js.map → chunk-RJMCWT7Z.js.map} +1 -1
  68. package/dist/{chunk-TZTCIAYW.cjs → chunk-S3RMAXH5.cjs} +137 -25
  69. package/dist/chunk-S3RMAXH5.cjs.map +1 -0
  70. package/dist/{chunk-IBRW3UOA.js → chunk-TWLKXV2O.js} +3 -3
  71. package/dist/{chunk-IBRW3UOA.js.map → chunk-TWLKXV2O.js.map} +1 -1
  72. package/dist/{chunk-HUPDIRBX.js → chunk-UWA5MWCI.js} +949 -918
  73. package/dist/chunk-UWA5MWCI.js.map +1 -0
  74. package/dist/{chunk-RYVV5UVI.cjs → chunk-V4GILQR6.cjs} +4 -4
  75. package/dist/{chunk-RYVV5UVI.cjs.map → chunk-V4GILQR6.cjs.map} +1 -1
  76. package/dist/{chunk-XRCY75UV.cjs → chunk-V4RO5KYY.cjs} +951 -918
  77. package/dist/chunk-V4RO5KYY.cjs.map +1 -0
  78. package/dist/{chunk-VZ5LDNHK.cjs → chunk-VTSH4YPT.cjs} +12 -12
  79. package/dist/{chunk-VZ5LDNHK.cjs.map → chunk-VTSH4YPT.cjs.map} +1 -1
  80. package/dist/{chunk-UUBNQV2T.cjs → chunk-WQDIZH2Z.cjs} +12 -12
  81. package/dist/{chunk-UUBNQV2T.cjs.map → chunk-WQDIZH2Z.cjs.map} +1 -1
  82. package/dist/{chunk-EGSUMHCS.cjs → chunk-YB4XJY5L.cjs} +12 -12
  83. package/dist/{chunk-EGSUMHCS.cjs.map → chunk-YB4XJY5L.cjs.map} +1 -1
  84. package/dist/{chunk-JHDR56XO.js → chunk-YS6CGUNH.js} +3 -3
  85. package/dist/{chunk-JHDR56XO.js.map → chunk-YS6CGUNH.js.map} +1 -1
  86. package/dist/{chunk-NWPCY65Z.cjs → chunk-YVDUEUFV.cjs} +1311 -68
  87. package/dist/chunk-YVDUEUFV.cjs.map +1 -0
  88. package/dist/{types-BOAsqHoU.d.ts → diagnostics-DRxhodP6.d.cts} +74 -2
  89. package/dist/{types-BOAsqHoU.d.cts → diagnostics-DRxhodP6.d.ts} +74 -2
  90. package/dist/diagrams/blockdiagram/index.d.cts +1 -1
  91. package/dist/diagrams/blockdiagram/index.d.ts +1 -1
  92. package/dist/diagrams/circuit/index.cjs +8 -8
  93. package/dist/diagrams/circuit/index.d.cts +1 -1
  94. package/dist/diagrams/circuit/index.d.ts +1 -1
  95. package/dist/diagrams/circuit/index.js +2 -2
  96. package/dist/diagrams/ecomap/index.cjs +7 -7
  97. package/dist/diagrams/ecomap/index.d.cts +1 -1
  98. package/dist/diagrams/ecomap/index.d.ts +1 -1
  99. package/dist/diagrams/ecomap/index.js +2 -2
  100. package/dist/diagrams/entity/index.cjs +6 -6
  101. package/dist/diagrams/entity/index.d.cts +1 -1
  102. package/dist/diagrams/entity/index.d.ts +1 -1
  103. package/dist/diagrams/entity/index.js +2 -2
  104. package/dist/diagrams/fishbone/index.cjs +8 -8
  105. package/dist/diagrams/fishbone/index.d.cts +1 -1
  106. package/dist/diagrams/fishbone/index.d.ts +1 -1
  107. package/dist/diagrams/fishbone/index.js +2 -2
  108. package/dist/diagrams/flowchart/index.cjs +8 -8
  109. package/dist/diagrams/flowchart/index.d.cts +2 -2
  110. package/dist/diagrams/flowchart/index.d.ts +2 -2
  111. package/dist/diagrams/flowchart/index.js +2 -2
  112. package/dist/diagrams/genogram/index.cjs +9 -9
  113. package/dist/diagrams/genogram/index.d.cts +1 -1
  114. package/dist/diagrams/genogram/index.d.ts +1 -1
  115. package/dist/diagrams/genogram/index.js +2 -2
  116. package/dist/diagrams/ladder/index.cjs +6 -6
  117. package/dist/diagrams/ladder/index.d.cts +1 -1
  118. package/dist/diagrams/ladder/index.d.ts +1 -1
  119. package/dist/diagrams/ladder/index.js +2 -2
  120. package/dist/diagrams/logic/index.cjs +6 -6
  121. package/dist/diagrams/logic/index.d.cts +1 -1
  122. package/dist/diagrams/logic/index.d.ts +1 -1
  123. package/dist/diagrams/logic/index.js +2 -2
  124. package/dist/diagrams/orgchart/index.cjs +7 -7
  125. package/dist/diagrams/orgchart/index.d.cts +1 -1
  126. package/dist/diagrams/orgchart/index.d.ts +1 -1
  127. package/dist/diagrams/orgchart/index.js +2 -2
  128. package/dist/diagrams/pedigree/index.cjs +7 -7
  129. package/dist/diagrams/pedigree/index.d.cts +1 -1
  130. package/dist/diagrams/pedigree/index.d.ts +1 -1
  131. package/dist/diagrams/pedigree/index.js +2 -2
  132. package/dist/diagrams/phylo/index.cjs +7 -7
  133. package/dist/diagrams/phylo/index.d.cts +1 -1
  134. package/dist/diagrams/phylo/index.d.ts +1 -1
  135. package/dist/diagrams/phylo/index.js +2 -2
  136. package/dist/diagrams/sld/index.cjs +14 -6
  137. package/dist/diagrams/sld/index.d.cts +14 -2
  138. package/dist/diagrams/sld/index.d.ts +14 -2
  139. package/dist/diagrams/sld/index.js +2 -2
  140. package/dist/diagrams/sociogram/index.cjs +6 -6
  141. package/dist/diagrams/sociogram/index.d.cts +1 -1
  142. package/dist/diagrams/sociogram/index.d.ts +1 -1
  143. package/dist/diagrams/sociogram/index.js +2 -2
  144. package/dist/diagrams/timing/index.d.cts +1 -1
  145. package/dist/diagrams/timing/index.d.ts +1 -1
  146. package/dist/diagrams/venn/index.cjs +9 -9
  147. package/dist/diagrams/venn/index.d.cts +1 -1
  148. package/dist/diagrams/venn/index.d.ts +1 -1
  149. package/dist/diagrams/venn/index.js +2 -2
  150. package/dist/{index-CJai_TEZ.d.ts → index-BRIkOPnd.d.cts} +60 -2
  151. package/dist/{index-C9A0h-CB.d.cts → index-C7SN-FB3.d.ts} +60 -2
  152. package/dist/index.cjs +351 -51
  153. package/dist/index.cjs.map +1 -1
  154. package/dist/index.d.cts +38 -4
  155. package/dist/index.d.ts +38 -4
  156. package/dist/index.js +283 -16
  157. package/dist/index.js.map +1 -1
  158. package/dist/react.cjs +21 -23
  159. package/dist/react.cjs.map +1 -1
  160. package/dist/react.d.cts +3 -2
  161. package/dist/react.d.ts +3 -2
  162. package/dist/react.js +21 -23
  163. package/dist/react.js.map +1 -1
  164. package/dist/tools-BVeUNdsU.d.ts +161 -0
  165. package/dist/tools-DdhP1kWY.d.cts +161 -0
  166. package/package.json +2 -2
  167. package/dist/chunk-2VNMKOUO.js.map +0 -1
  168. package/dist/chunk-3M6WB62Y.cjs.map +0 -1
  169. package/dist/chunk-3YUUC6RN.cjs.map +0 -1
  170. package/dist/chunk-6OSUNBZY.js.map +0 -1
  171. package/dist/chunk-D7EHZFK4.cjs.map +0 -1
  172. package/dist/chunk-GTDQAN2Z.js.map +0 -1
  173. package/dist/chunk-HUPDIRBX.js.map +0 -1
  174. package/dist/chunk-IM4RCUHA.js.map +0 -1
  175. package/dist/chunk-NWPCY65Z.cjs.map +0 -1
  176. package/dist/chunk-QTNPMIO2.cjs.map +0 -1
  177. package/dist/chunk-TZTCIAYW.cjs.map +0 -1
  178. package/dist/chunk-UFTYX73U.js.map +0 -1
  179. package/dist/chunk-VJGMEGMR.js.map +0 -1
  180. package/dist/chunk-XRCY75UV.cjs.map +0 -1
@@ -1,5 +1,5 @@
1
1
  import { firstContentLine } from './chunk-2KTQ75LN.js';
2
- import { resolveFlowchartTheme } from './chunk-2VNMKOUO.js';
2
+ import { resolveFlowchartTheme } from './chunk-LRI4RH2N.js';
3
3
  import { text, title, desc, el, defs, group, svgRoot, rect, multilineText, path, polygon, circle, line } from './chunk-SYYBKDL7.js';
4
4
 
5
5
  // src/diagrams/flowchart/parser.ts
@@ -16,8 +16,8 @@ var FlowchartParseError = class extends Error {
16
16
  source;
17
17
  };
18
18
  var DIRECTIONS = /* @__PURE__ */ new Set(["TB", "TD", "BT", "LR", "RL"]);
19
- function unquoteLabel(s) {
20
- const t = s.trim();
19
+ function unquoteLabel(s2) {
20
+ const t = s2.trim();
21
21
  if (t.length >= 2 && t.startsWith('"') && t.endsWith('"')) return t.slice(1, -1);
22
22
  return t;
23
23
  }
@@ -262,15 +262,15 @@ function parseChainStatement(line2, lineNo) {
262
262
  }
263
263
  function parseSubgraphHeader(rest, idx) {
264
264
  const defaultId = `sg_${idx}`;
265
- const s = rest.trim();
266
- if (!s) return { id: defaultId, label: defaultId, children: [], subgraphs: [] };
267
- const idBracket = /^(\w[\w-]*)\s+\[([^\]]*)\]$/.exec(s);
265
+ const s2 = rest.trim();
266
+ if (!s2) return { id: defaultId, label: defaultId, children: [], subgraphs: [] };
267
+ const idBracket = /^(\w[\w-]*)\s+\[([^\]]*)\]$/.exec(s2);
268
268
  if (idBracket) return { id: idBracket[1], label: idBracket[2], children: [], subgraphs: [] };
269
- const idQuoted = /^(\w[\w-]*)\s+"([^"]*)"$/.exec(s);
269
+ const idQuoted = /^(\w[\w-]*)\s+"([^"]*)"$/.exec(s2);
270
270
  if (idQuoted) return { id: idQuoted[1], label: idQuoted[2], children: [], subgraphs: [] };
271
- const quotedOnly = /^"([^"]*)"$/.exec(s);
271
+ const quotedOnly = /^"([^"]*)"$/.exec(s2);
272
272
  if (quotedOnly) return { id: defaultId, label: quotedOnly[1], children: [], subgraphs: [] };
273
- const plainId = s.split(/\s/)[0];
273
+ const plainId = s2.split(/\s/)[0];
274
274
  return { id: plainId, label: plainId, children: [], subgraphs: [] };
275
275
  }
276
276
  function normalizeDirection(dir) {
@@ -279,9 +279,9 @@ function normalizeDirection(dir) {
279
279
  if (up === "TB" || up === "BT" || up === "LR" || up === "RL") return up;
280
280
  return "TB";
281
281
  }
282
- function parseCssProps(s) {
282
+ function parseCssProps(s2) {
283
283
  const props = {};
284
- for (const part of s.split(",")) {
284
+ for (const part of s2.split(",")) {
285
285
  const colon = part.indexOf(":");
286
286
  if (colon < 0) continue;
287
287
  const key = part.slice(0, colon).trim();
@@ -390,7 +390,7 @@ function parseFlowchart(source) {
390
390
  const sg = parseSubgraphHeader(sgMatch[1] ?? "", ast.subgraphs.length);
391
391
  let finalId = sg.id;
392
392
  let collision = 0;
393
- while (ast.subgraphs.some((s) => s.id === finalId)) {
393
+ while (ast.subgraphs.some((s2) => s2.id === finalId)) {
394
394
  finalId = `${sg.id}_${++collision}`;
395
395
  }
396
396
  sg.id = finalId;
@@ -411,9 +411,23 @@ function parseFlowchart(source) {
411
411
  subgraphStack.pop();
412
412
  continue;
413
413
  }
414
+ const iconMatch = /^icon\s+(\w[\w-]*)\s*:?\s+([\w-]+)\s*$/.exec(trimmed);
415
+ if (iconMatch) {
416
+ const nid = iconMatch[1];
417
+ const iconName = iconMatch[2];
418
+ const existing = nodeMap.get(nid);
419
+ if (existing) {
420
+ existing.icon = iconName;
421
+ } else {
422
+ const node = { id: nid, shape: "rect", label: nid, icon: iconName };
423
+ nodeMap.set(nid, node);
424
+ ast.nodes.push(node);
425
+ }
426
+ continue;
427
+ }
414
428
  const classMatch = /^class\s+([\w,\s]+?)\s+(\w[\w-]*)\s*$/.exec(trimmed);
415
429
  if (classMatch) {
416
- const idList = classMatch[1].split(/[,\s]+/).map((s) => s.trim()).filter((s) => s.length > 0);
430
+ const idList = classMatch[1].split(/[,\s]+/).map((s2) => s2.trim()).filter((s2) => s2.length > 0);
417
431
  const className = classMatch[2];
418
432
  for (const nid of idList) {
419
433
  const existing = nodeMap.get(nid);
@@ -457,7 +471,7 @@ function parseFlowchart(source) {
457
471
  const sel = linkStyleMatch[1].trim();
458
472
  const props = parseCssProps(linkStyleMatch[2]);
459
473
  if (sel !== "default") {
460
- const indices = sel.split(/[,\s]+/).map((s) => s.trim()).filter((s) => s.length > 0).map((s) => parseInt(s, 10)).filter((n) => !isNaN(n));
474
+ const indices = sel.split(/[,\s]+/).map((s2) => s2.trim()).filter((s2) => s2.length > 0).map((s2) => parseInt(s2, 10)).filter((n) => !isNaN(n));
461
475
  for (const idx of indices) {
462
476
  ast.linkStyles.set(idx, { ...ast.linkStyles.get(idx) ?? {}, ...props });
463
477
  }
@@ -701,8 +715,8 @@ function horizontalCompaction(layers, root, align, nodeById, nodeSep) {
701
715
  for (const v of layer) {
702
716
  const r = root.get(v.id);
703
717
  const rx = xs.get(r) ?? 0;
704
- const s = shift.get(sink.get(r));
705
- const sx = s !== void 0 && s !== Number.POSITIVE_INFINITY ? s : 0;
718
+ const s2 = shift.get(sink.get(r));
719
+ const sx = s2 !== void 0 && s2 !== Number.POSITIVE_INFINITY ? s2 : 0;
706
720
  result.set(v.id, rx + sx);
707
721
  }
708
722
  }
@@ -774,6 +788,281 @@ function balance(xss) {
774
788
  return result;
775
789
  }
776
790
 
791
+ // src/diagrams/flowchart/icons.ts
792
+ var ICON_SIZE = 22;
793
+ var ICON_GAP = 4;
794
+ var s = `class="sx-fc-icon" fill="none" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"`;
795
+ var sf = `class="sx-fc-icon-fill"`;
796
+ function gearGlyph() {
797
+ let teeth = "";
798
+ for (let i = 0; i < 8; i++) {
799
+ teeth += `<rect x="-1.8" y="-10.4" width="3.6" height="3.6" rx="0.6" transform="rotate(${i * 45})" ${sf}/>`;
800
+ }
801
+ return `<circle cx="0" cy="0" r="7" ${s}/>${teeth}<circle cx="0" cy="0" r="2.6" ${s}/>`;
802
+ }
803
+ var ICONS = {
804
+ // ── core (original set) ──────────────────────────────────────
805
+ server: () => `<rect x="-10" y="-9" width="20" height="7" rx="1.5" ${s}/><rect x="-10" y="2" width="20" height="7" rx="1.5" ${s}/><circle cx="-6" cy="-5.5" r="0.9" ${sf}/><circle cx="-6" cy="5.5" r="0.9" ${sf}/>`,
806
+ database: () => `<ellipse cx="0" cy="-7" rx="9" ry="3.2" ${s}/><path d="M -9 -7 V 7 C -9 8.8 -5 10 0 10 C 5 10 9 8.8 9 7 V -7" ${s}/><path d="M -9 0 C -9 1.8 -5 3 0 3 C 5 3 9 1.8 9 0" ${s}/>`,
807
+ user: () => `<circle cx="0" cy="-4" r="4" ${s}/><path d="M -8 10 C -8 3 8 3 8 10" ${s}/>`,
808
+ cloud: () => `<path d="M -7 5 C -11 5 -11 -2 -6 -2 C -6 -8 5 -8 5 -2 C 10 -3 11 5 6 5 Z" ${s}/>`,
809
+ gear: gearGlyph,
810
+ document: () => `<path d="M -7 -10 H 3 L 7 -6 V 10 H -7 Z" ${s}/><path d="M 3 -10 V -6 H 7 M -4 0 H 4 M -4 4 H 4" ${s}/>`,
811
+ globe: () => `<circle cx="0" cy="0" r="9" ${s}/><path d="M -9 0 H 9 M 0 -9 V 9 M 0 -9 C -5 -4 -5 4 0 9 C 5 4 5 -4 0 -9" ${s}/>`,
812
+ lock: () => `<rect x="-7" y="-1" width="14" height="11" rx="1.5" ${s}/><path d="M -4 -1 V -4 C -4 -9 4 -9 4 -4 V -1" ${s}/>`,
813
+ mail: () => `<rect x="-10" y="-7" width="20" height="14" rx="1.5" ${s}/><path d="M -10 -6 L 0 2 L 10 -6" ${s}/>`,
814
+ clock: () => `<circle cx="0" cy="0" r="9" ${s}/><path d="M 0 -5 V 0 L 4 3" ${s}/>`,
815
+ check: () => `<circle cx="0" cy="0" r="9" ${s}/><path d="M -4 0 L -1 3 L 5 -4" ${s}/>`,
816
+ alert: () => `<path d="M 0 -9 L 10 8 H -10 Z" ${s}/><path d="M 0 -3 V 2" ${s}/><circle cx="0" cy="5" r="0.9" ${sf}/>`,
817
+ process: () => `<rect x="-9" y="-7" width="18" height="14" rx="1.5" ${s}/><path d="M -5 -2 H 5 M -5 2 H 2" ${s}/>`,
818
+ queue: () => `<rect x="-10" y="-6" width="6" height="12" rx="1" ${s}/><rect x="-2" y="-6" width="6" height="12" rx="1" ${s}/><rect x="6" y="-6" width="4" height="12" rx="1" ${s}/>`,
819
+ // ── Tier 1 · general flow ────────────────────────────────────
820
+ folder: () => `<path d="M -10 -6 H -3 L -1 -3 H 10 V 8 H -10 Z" ${s}/>`,
821
+ file: () => `<path d="M -7 -10 H 3 L 7 -6 V 10 H -7 Z" ${s}/><path d="M 3 -10 V -6 H 7" ${s}/>`,
822
+ search: () => `<circle cx="-2" cy="-2" r="6" ${s}/><path d="M 2.5 2.5 L 9 9" ${s}/>`,
823
+ edit: () => `<path d="M -9 9 H -5 L 7 -3 L 3 -7 L -9 5 Z" ${s}/><path d="M 2 -6 L 6 -2" ${s}/>`,
824
+ trash: () => `<path d="M -8 -5 H 8 M -6 -5 V 8 C -6 9 -5 9 -4 9 H 4 C 5 9 6 9 6 8 V -5 M -3 -5 V -8 H 3 V -5 M -2 -1 V 5 M 2 -1 V 5" ${s}/>`,
825
+ add: () => `<circle cx="0" cy="0" r="9" ${s}/><path d="M -4 0 H 4 M 0 -4 V 4" ${s}/>`,
826
+ sync: () => `<path d="M -8 -1 A 8 8 0 0 1 6 -5" ${s}/><path d="M 6 -5 L 7 -8 M 6 -5 L 3 -6" ${s}/><path d="M 8 1 A 8 8 0 0 1 -6 5" ${s}/><path d="M -6 5 L -7 8 M -6 5 L -3 6" ${s}/>`,
827
+ upload: () => `<path d="M -8 6 V 9 H 8 V 6" ${s}/><path d="M 0 -9 V 3 M -4 -5 L 0 -9 L 4 -5" ${s}/>`,
828
+ download: () => `<path d="M -8 6 V 9 H 8 V 6" ${s}/><path d="M 0 -9 V 3 M -4 -1 L 0 3 L 4 -1" ${s}/>`,
829
+ link: () => `<path d="M -1 -4 L -5 0 A 4.2 4.2 0 0 0 1 6 L 3 4" ${s}/><path d="M 1 4 L 5 0 A 4.2 4.2 0 0 0 -1 -6 L -3 -4" ${s}/>`,
830
+ calendar: () => `<rect x="-9" y="-7" width="18" height="15" rx="1.5" ${s}/><path d="M -9 -2 H 9 M -4 -10 V -4 M 4 -10 V -4" ${s}/>`,
831
+ list: () => `<circle cx="-8" cy="-6" r="1.2" ${sf}/><circle cx="-8" cy="0" r="1.2" ${sf}/><circle cx="-8" cy="6" r="1.2" ${sf}/><path d="M -4 -6 H 9 M -4 0 H 9 M -4 6 H 9" ${s}/>`,
832
+ filter: () => `<path d="M -9 -7 H 9 L 2 1 V 9 L -2 7 V 1 Z" ${s}/>`,
833
+ flag: () => `<path d="M -7 -9 V 9 M -7 -9 H 7 L 4 -5 L 7 -1 H -7" ${s}/>`,
834
+ star: () => `<path d="M 0 -9 L 2.6 -2.8 L 9 -2.4 L 4 1.8 L 5.6 8.4 L 0 5 L -5.6 8.4 L -4 1.8 L -9 -2.4 L -2.6 -2.8 Z" ${s}/>`,
835
+ tag: () => `<path d="M 1 -8 H 9 V 0 L 0 9 L -9 0 L 1 -8 Z" ${s}/><circle cx="5.5" cy="-4.5" r="1.4" ${sf}/>`,
836
+ info: () => `<circle cx="0" cy="0" r="9" ${s}/><circle cx="0" cy="-4" r="1" ${sf}/><path d="M 0 -1 V 5" ${s}/>`,
837
+ question: () => `<circle cx="0" cy="0" r="9" ${s}/><path d="M -3 -3 A 3 3 0 1 1 1 1 V 3" ${s}/><circle cx="0.5" cy="6" r="1" ${sf}/>`,
838
+ cancel: () => `<circle cx="0" cy="0" r="9" ${s}/><path d="M -4 -4 L 4 4 M 4 -4 L -4 4" ${s}/>`,
839
+ play: () => `<circle cx="0" cy="0" r="9" ${s}/><path d="M -3 -5 L 5 0 L -3 5 Z" ${sf}/>`,
840
+ stop: () => `<path d="M -3.5 -8 H 3.5 L 8 -3.5 V 3.5 L 3.5 8 H -3.5 L -8 3.5 V -3.5 Z" ${s}/>`,
841
+ // ── Tier 2 · tech / architecture ─────────────────────────────
842
+ code: () => `<path d="M -3 -7 L -9 0 L -3 7 M 3 -7 L 9 0 L 3 7" ${s}/>`,
843
+ terminal: () => `<rect x="-10" y="-7" width="20" height="14" rx="1.5" ${s}/><path d="M -6 -2 L -2 1 L -6 4 M 0 4 H 5" ${s}/>`,
844
+ container: () => `<path d="M 0 -9 L 9 -4 V 5 L 0 10 L -9 5 V -4 Z" ${s}/><path d="M -9 -4 L 0 1 L 9 -4 M 0 1 V 10" ${s}/>`,
845
+ cache: () => `<rect x="-9" y="-7" width="18" height="14" rx="1.5" ${s}/><path d="M 1 -4 L -3 1 H 0 L -1 4 L 3 -1 H 0 Z" ${sf}/>`,
846
+ shield: () => `<path d="M 0 -9 L 8 -6 V 1 C 8 7 0 10 0 10 C 0 10 -8 7 -8 1 V -6 Z" ${s}/><path d="M -3 -0.5 L -1 1.5 L 3.5 -3" ${s}/>`,
847
+ key: () => `<circle cx="-4" cy="-4" r="4" ${s}/><path d="M -1 -1 L 7 7 M 4 4 L 7 1 M 7 7 L 4 10" ${s}/>`,
848
+ browser: () => `<rect x="-10" y="-8" width="20" height="16" rx="1.5" ${s}/><path d="M -10 -3 H 10" ${s}/><circle cx="-7" cy="-5.5" r="0.9" ${sf}/><circle cx="-4" cy="-5.5" r="0.9" ${sf}/>`,
849
+ mobile: () => `<rect x="-6" y="-9" width="12" height="18" rx="2" ${s}/><path d="M -2 6 H 2" ${s}/>`,
850
+ desktop: () => `<rect x="-10" y="-8" width="20" height="13" rx="1.5" ${s}/><path d="M -4 9 H 4 M 0 5 V 9" ${s}/>`,
851
+ cpu: () => `<rect x="-6" y="-6" width="12" height="12" rx="1" ${s}/><rect x="-2.5" y="-2.5" width="5" height="5" ${s}/><path d="M -3 -6 V -9 M 0 -6 V -9 M 3 -6 V -9 M -3 6 V 9 M 0 6 V 9 M 3 6 V 9 M -6 -3 H -9 M -6 0 H -9 M -6 3 H -9 M 6 -3 H 9 M 6 0 H 9 M 6 3 H 9" ${s}/>`,
852
+ "git-branch": () => `<circle cx="-5" cy="-6" r="2.5" ${s}/><circle cx="-5" cy="7" r="2.5" ${s}/><circle cx="5" cy="-6" r="2.5" ${s}/><path d="M -5 -3.5 V 4.5 M -5 0 C -5 -4 5 -2 5 -3.5" ${s}/>`,
853
+ bug: () => `<ellipse cx="0" cy="1" rx="5" ry="6" ${s}/><path d="M -5 -2 H 5 M -8 -3 L -5 -1 M 8 -3 L 5 -1 M -8 3 H -5 M 8 3 H 5 M -7 7 L -5 4 M 7 7 L 5 4 M -2 -6 L -4 -9 M 2 -6 L 4 -9" ${s}/>`,
854
+ rocket: () => `<path d="M 0 -10 C 4 -6 4 0 2 5 H -2 C -4 0 -4 -6 0 -10 Z" ${s}/><circle cx="0" cy="-3" r="1.6" ${s}/><path d="M -2 5 L -5 9 L -2 7 M 2 5 L 5 9 L 2 7" ${s}/>`,
855
+ webhook: () => `<circle cx="-4" cy="-4" r="2.6" ${s}/><circle cx="5" cy="5" r="2.6" ${s}/><path d="M -2.5 -2 C 1 1 1 3 2.8 4" ${s}/>`,
856
+ function: () => `<path d="M 5 -8 H 3 C 1 -8 0 -6 0 -3 V 8 M -4 -2 H 4" ${s}/>`,
857
+ // ── Tier 3 · people / business / analytics ──────────────────
858
+ users: () => `<circle cx="-3" cy="-4" r="3.2" ${s}/><path d="M -10 9 C -10 3 4 3 4 9" ${s}/><circle cx="5" cy="-3" r="2.6" ${s}/><path d="M 6 0 C 9 0.5 10 4 10 9" ${s}/>`,
859
+ building: () => `<rect x="-7" y="-9" width="14" height="18" rx="1" ${s}/><path d="M -4 -5 H -1 M 1 -5 H 4 M -4 -1 H -1 M 1 -1 H 4 M -2 9 V 4 H 2 V 9" ${s}/>`,
860
+ briefcase: () => `<rect x="-9" y="-4" width="18" height="12" rx="1.5" ${s}/><path d="M -4 -4 V -7 H 4 V -4 M -9 1 H 9" ${s}/>`,
861
+ money: () => `<circle cx="0" cy="0" r="9" ${s}/><path d="M 0 -6 V 6 M 3 -3 C 3 -5 -3 -5 -3 -2.5 C -3 0 3 0 3 2.5 C 3 5 -3 5 -3 3" ${s}/>`,
862
+ "bar-chart": () => `<path d="M -9 9 H 9 M -8 9 V -9" ${s}/><rect x="-6" y="1" width="3.4" height="8" ${sf}/><rect x="-1" y="-4" width="3.4" height="13" ${sf}/><rect x="4" y="-8" width="3.4" height="17" ${sf}/>`,
863
+ "pie-chart": () => `<circle cx="0" cy="0" r="9" ${s}/><path d="M 0 0 L 0 -9 A 9 9 0 0 1 7.8 4.5 Z" ${s}/>`,
864
+ trend: () => `<path d="M -9 7 L -3 1 L 1 4 L 9 -6 M 9 -6 H 4 M 9 -6 V -1" ${s}/>`,
865
+ chat: () => `<path d="M -9 -7 H 9 V 3 H -2 L -6 7 V 3 H -9 Z" ${s}/>`,
866
+ bell: () => `<path d="M 0 -9 C 4 -9 6 -6 6 -2 C 6 3 8 5 8 5 H -8 C -8 5 -6 3 -6 -2 C -6 -6 -4 -9 0 -9 Z" ${s}/><path d="M -2.5 5 C -2.5 8 2.5 8 2.5 5" ${s}/>`,
867
+ phone: () => `<path d="M -7 -7 C -3 -3 3 3 7 7 C 9 5 9 3 7 2 L 4 4 C 1 2 -2 -1 -4 -4 L -2 -7 C -3 -9 -5 -9 -7 -7 Z" ${s}/>`,
868
+ // ── Tier 4 · medical ─────────────────────────────────────────
869
+ heart: () => `<path d="M 0 8 C -8 1 -9 -7 -3 -7 C -1 -7 0 -5 0 -4 C 0 -5 1 -7 3 -7 C 9 -7 8 1 0 8 Z" ${s}/>`,
870
+ pill: () => `<g transform="rotate(-40)"><rect x="-9" y="-4" width="18" height="8" rx="4" ${s}/><path d="M 0 -4 V 4" ${s}/></g>`,
871
+ cross: () => `<path d="M -3 -9 H 3 V -3 H 9 V 3 H 3 V 9 H -3 V 3 H -9 V -3 H -3 Z" ${s}/>`,
872
+ syringe: () => `<g transform="rotate(-45)"><rect x="-6" y="-3" width="11" height="6" ${s}/><path d="M 5 0 H 10 M -6 -3 V 3 M -8 0 H -6 M 0 -3 V 3 M 2.5 -3 V 3" ${s}/></g>`,
873
+ dna: () => `<path d="M -5 -9 C 5 -4 -5 4 5 9 M 5 -9 C -5 -4 5 4 -5 9" ${s}/><path d="M -2.5 -6 H 2.5 M -3.5 0 H 3.5 M -2.5 6 H 2.5" ${s}/>`,
874
+ // ── Tier 4 · legal ───────────────────────────────────────────
875
+ scale: () => `<path d="M 0 -9 V 9 M -8 9 H 8 M -8 -5 H 8" ${s}/><circle cx="0" cy="-7.5" r="1.3" ${sf}/><path d="M -8 -5 L -10.5 1 H -5.5 Z M 8 -5 L 5.5 1 H 10.5 Z" ${s}/>`,
876
+ gavel: () => `<g transform="rotate(40)"><rect x="-5" y="-4.5" width="10" height="9" rx="1" ${s}/><path d="M 0 4.5 V 11 M -5 -2 H 5" ${s}/></g>`,
877
+ contract: () => `<path d="M -7 -10 H 3 L 7 -6 V 10 H -7 Z" ${s}/><path d="M 3 -10 V -6 H 7 M -4 -2 H 3 M -4 1 H 1 M -4 5 C -2 3 0 7 2 5 C 3 4 4 5 4.5 5" ${s}/>`,
878
+ stamp: () => `<path d="M -7 9 H 7 M -7 6 H 7 M -4 6 V 2 C -4 0 -2 0 -2 -2 V -5 C -2 -7 2 -7 2 -5 V -2 C 2 0 4 0 4 2 V 6" ${s}/>`,
879
+ // ── Tier 4 · engineering ─────────────────────────────────────
880
+ bolt: () => `<path d="M 2 -9 L -5 2 H 0 L -2 9 L 6 -2 H 1 Z" ${s}/>`,
881
+ battery: () => `<rect x="-9" y="-5" width="16" height="10" rx="1.5" ${s}/><path d="M 7 -2 H 9 V 2 H 7" ${s}/><path d="M -5 -2 V 2 M -1 -2 V 2 M 3 -2 V 2" ${s}/>`,
882
+ gauge: () => `<path d="M -8 5 A 8 8 0 0 1 8 5" ${s}/><path d="M 0 5 L 4.5 -2" ${s}/><circle cx="0" cy="5" r="1.5" ${sf}/><path d="M -8 5 H -6 M 8 5 H 6 M 0 -3 V -1" ${s}/>`,
883
+ wrench: () => `<path d="M 5 -9 A 4 4 0 1 0 9 -3 L -1 7 L -4 9.5 L -6.5 7 L -4 4 Z" ${s}/>`,
884
+ factory: () => `<path d="M -9 9 V -1 L -3 3 V -1 L 3 3 V -1 L 9 3 V 9 Z" ${s}/><path d="M -7 -1 V -7 H -4 V -3" ${s}/>`,
885
+ valve: () => `<path d="M -9 -6 V 6 L 0 0 Z M 9 -6 V 6 L 0 0 Z" ${s}/><path d="M 0 0 V -8 M -3 -8 H 3" ${s}/>`,
886
+ // ── Tier 4 · finance ─────────────────────────────────────────
887
+ bank: () => `<path d="M -9 -2 L 0 -8 L 9 -2 Z" ${s}/><path d="M -7 -2 V 7 M -2.5 -2 V 7 M 2.5 -2 V 7 M 7 -2 V 7 M -9 9 H 9" ${s}/>`,
888
+ "credit-card": () => `<rect x="-10" y="-7" width="20" height="14" rx="2" ${s}/><path d="M -10 -2 H 10 M -7 4 H -2" ${s}/>`,
889
+ invoice: () => `<path d="M -7 -10 H 7 V 9 L 5 11 L 3 9 L 1 11 L -1 9 L -3 11 L -5 9 L -7 11 Z" ${s}/><path d="M -4 -5 H 4 M -4 -1 H 4 M -4 3 H 1" ${s}/>`,
890
+ coins: () => `<ellipse cx="0" cy="-4" rx="7" ry="3" ${s}/><path d="M -7 -4 V 2 C -7 4 7 4 7 2 V -4 M -7 -1 C -7 1 7 1 7 -1" ${s}/>`
891
+ };
892
+ var ALIASES = {
893
+ db: "database",
894
+ storage: "database",
895
+ api: "server",
896
+ service: "server",
897
+ person: "user",
898
+ account: "user",
899
+ customer: "user",
900
+ cog: "gear",
901
+ settings: "gear",
902
+ config: "gear",
903
+ doc: "document",
904
+ web: "globe",
905
+ internet: "globe",
906
+ www: "globe",
907
+ secure: "lock",
908
+ auth: "lock",
909
+ password: "lock",
910
+ email: "mail",
911
+ envelope: "mail",
912
+ time: "clock",
913
+ timer: "clock",
914
+ schedule: "clock",
915
+ done: "check",
916
+ success: "check",
917
+ ok: "check",
918
+ complete: "check",
919
+ warning: "alert",
920
+ error: "alert",
921
+ danger: "alert",
922
+ // tier 1
923
+ directory: "folder",
924
+ page: "file",
925
+ find: "search",
926
+ pencil: "edit",
927
+ modify: "edit",
928
+ delete: "trash",
929
+ remove: "trash",
930
+ plus: "add",
931
+ new: "add",
932
+ create: "add",
933
+ refresh: "sync",
934
+ reload: "sync",
935
+ publish: "upload",
936
+ import: "download",
937
+ save: "download",
938
+ url: "link",
939
+ date: "calendar",
940
+ events: "calendar",
941
+ menu: "list",
942
+ steps: "list",
943
+ sort: "filter",
944
+ milestone: "flag",
945
+ favorite: "star",
946
+ rating: "star",
947
+ label: "tag",
948
+ about: "info",
949
+ help: "question",
950
+ faq: "question",
951
+ close: "cancel",
952
+ reject: "cancel",
953
+ start: "play",
954
+ run: "play",
955
+ end: "stop",
956
+ // tier 2
957
+ dev: "code",
958
+ source: "code",
959
+ shell: "terminal",
960
+ cli: "terminal",
961
+ docker: "container",
962
+ pod: "container",
963
+ redis: "cache",
964
+ firewall: "shield",
965
+ protect: "shield",
966
+ token: "key",
967
+ credential: "key",
968
+ site: "browser",
969
+ phone_app: "mobile",
970
+ app: "mobile",
971
+ monitor: "desktop",
972
+ computer: "desktop",
973
+ chip: "cpu",
974
+ processor: "cpu",
975
+ git: "git-branch",
976
+ branch: "git-branch",
977
+ issue: "bug",
978
+ defect: "bug",
979
+ deploy: "rocket",
980
+ launch: "rocket",
981
+ ship: "rocket",
982
+ hook: "webhook",
983
+ fn: "function",
984
+ lambda: "function",
985
+ // tier 3
986
+ group: "users",
987
+ team: "users",
988
+ org: "building",
989
+ company: "building",
990
+ office: "building",
991
+ work: "briefcase",
992
+ job: "briefcase",
993
+ cash: "money",
994
+ dollar: "money",
995
+ payment: "money",
996
+ chart: "bar-chart",
997
+ bars: "bar-chart",
998
+ metrics: "bar-chart",
999
+ pie: "pie-chart",
1000
+ growth: "trend",
1001
+ analytics: "trend",
1002
+ message: "chat",
1003
+ comment: "chat",
1004
+ notification: "bell",
1005
+ notify: "bell",
1006
+ call: "phone",
1007
+ // tier 4 medical
1008
+ health: "heart",
1009
+ like: "heart",
1010
+ medication: "pill",
1011
+ drug: "pill",
1012
+ clinic: "cross",
1013
+ hospital: "cross",
1014
+ medical: "cross",
1015
+ injection: "syringe",
1016
+ vaccine: "syringe",
1017
+ gene: "dna",
1018
+ genetic: "dna",
1019
+ // tier 4 legal
1020
+ justice: "scale",
1021
+ balance: "scale",
1022
+ legal: "scale",
1023
+ judge: "gavel",
1024
+ court: "gavel",
1025
+ agreement: "contract",
1026
+ signed: "contract",
1027
+ seal: "stamp",
1028
+ approved: "stamp",
1029
+ // tier 4 engineering
1030
+ power: "bolt",
1031
+ electric: "bolt",
1032
+ flash: "bolt",
1033
+ charge: "battery",
1034
+ meter: "gauge",
1035
+ speed: "gauge",
1036
+ tool: "wrench",
1037
+ tools: "wrench",
1038
+ repair: "wrench",
1039
+ plant: "factory",
1040
+ industrial: "factory",
1041
+ // tier 4 finance
1042
+ finance: "bank",
1043
+ card: "credit-card",
1044
+ bill: "invoice",
1045
+ receipt: "invoice",
1046
+ coin: "coins"
1047
+ };
1048
+ function resolveIconName(name) {
1049
+ const key = name.toLowerCase();
1050
+ if (ICONS[key]) return key;
1051
+ if (ALIASES[key] && ICONS[ALIASES[key]]) return ALIASES[key];
1052
+ return void 0;
1053
+ }
1054
+ function iconNames() {
1055
+ return Object.keys(ICONS);
1056
+ }
1057
+ function renderIcon(name) {
1058
+ const key = resolveIconName(name);
1059
+ if (key) return ICONS[key]();
1060
+ return `<path d="M -9 -5 H 2 L 9 0 L 2 5 H -9 Z" ${s}/><circle cx="-5" cy="0" r="1" ${sf}/>`;
1061
+ }
1062
+ function hasIcon(name) {
1063
+ return typeof name === "string" && name.length > 0;
1064
+ }
1065
+
777
1066
  // src/diagrams/flowchart/layout.ts
778
1067
  var FC_CONST = {
779
1068
  nodeWidth: 120,
@@ -1035,23 +1324,23 @@ function barycenterReorder(layer, fixed, neighborsOf, biasRight) {
1035
1324
  const scored = layer.map((id, i) => {
1036
1325
  const neighbors = neighborsOf(id).map((n) => fixedIdx.get(n)).filter((p) => p !== void 0);
1037
1326
  if (neighbors.length === 0) return { id, score: -1, orig: i, hasNeighbors: false };
1038
- const sum = neighbors.reduce((s, n) => s + n, 0);
1327
+ const sum = neighbors.reduce((s2, n) => s2 + n, 0);
1039
1328
  return { id, score: sum / neighbors.length, orig: i, hasNeighbors: true };
1040
1329
  });
1041
- const withNbrs = scored.filter((s) => s.hasNeighbors);
1042
- const withoutNbrs = scored.filter((s) => !s.hasNeighbors);
1330
+ const withNbrs = scored.filter((s2) => s2.hasNeighbors);
1331
+ const withoutNbrs = scored.filter((s2) => !s2.hasNeighbors);
1043
1332
  withNbrs.sort((a, b) => {
1044
1333
  if (a.score !== b.score) return a.score - b.score;
1045
1334
  return biasRight ? b.orig - a.orig : a.orig - b.orig;
1046
1335
  });
1047
1336
  const result = new Array(layer.length);
1048
- for (const s of withoutNbrs) result[s.orig] = s;
1337
+ for (const s2 of withoutNbrs) result[s2.orig] = s2;
1049
1338
  let k = 0;
1050
1339
  for (let i = 0; i < result.length; i++) {
1051
1340
  if (result[i] !== void 0) continue;
1052
1341
  result[i] = withNbrs[k++];
1053
1342
  }
1054
- return result.map((s) => s.id);
1343
+ return result.map((s2) => s2.id);
1055
1344
  }
1056
1345
  function orderLayers(layers, segments) {
1057
1346
  const succ = /* @__PURE__ */ new Map();
@@ -1218,7 +1507,7 @@ function laneBasedXCoords(layerNodes, pathOf, nodeSpacingX, segments) {
1218
1507
  for (const layerLanes of lanesPerLayer) {
1219
1508
  const members = layerLanes.get(lane) ?? [];
1220
1509
  if (members.length === 0) continue;
1221
- const inner = members.reduce((s, n) => s + n.width, 0) + (members.length - 1) * nodeSpacingX;
1510
+ const inner = members.reduce((s2, n) => s2 + n.width, 0) + (members.length - 1) * nodeSpacingX;
1222
1511
  if (inner > maxInner) maxInner = inner;
1223
1512
  }
1224
1513
  const pad = lane !== null ? 2 * INNER_PAD : 0;
@@ -1241,7 +1530,7 @@ function laneBasedXCoords(layerNodes, pathOf, nodeSpacingX, segments) {
1241
1530
  if (members.length === 0) continue;
1242
1531
  const laneW = laneWidths[laneIdx];
1243
1532
  const laneStart = laneStartX[laneIdx];
1244
- const innerW = members.reduce((s, n) => s + n.width, 0) + (members.length - 1) * nodeSpacingX;
1533
+ const innerW = members.reduce((s2, n) => s2 + n.width, 0) + (members.length - 1) * nodeSpacingX;
1245
1534
  let cursor = laneStart + (laneW - innerW) / 2;
1246
1535
  for (const n of members) {
1247
1536
  result.set(n.id, cursor + n.width / 2);
@@ -1284,7 +1573,7 @@ function enforceSequentialClusterLayers(ast, layerMap, edges) {
1284
1573
  const topLevel = ast.subgraphs.filter((sg) => !sgParent.get(sg.id));
1285
1574
  if (topLevel.length < 2) return;
1286
1575
  const collect = (sgId) => {
1287
- const sg = ast.subgraphs.find((s) => s.id === sgId);
1576
+ const sg = ast.subgraphs.find((s2) => s2.id === sgId);
1288
1577
  if (!sg) return [];
1289
1578
  const ids = [...sg.children];
1290
1579
  for (const childSgId of sg.subgraphs) ids.push(...collect(childSgId));
@@ -1358,7 +1647,7 @@ function hasOverlappingTopLevelClusters(ast, layerMap, sgParent) {
1358
1647
  const topLevel = ast.subgraphs.filter((sg) => !sgParent.get(sg.id));
1359
1648
  if (topLevel.length < 2) return false;
1360
1649
  const collect = (sgId) => {
1361
- const sg = ast.subgraphs.find((s) => s.id === sgId);
1650
+ const sg = ast.subgraphs.find((s2) => s2.id === sgId);
1362
1651
  if (!sg) return [];
1363
1652
  const ids = [...sg.children];
1364
1653
  for (const childSgId of sg.subgraphs) ids.push(...collect(childSgId));
@@ -1423,6 +1712,10 @@ function layoutFlowchart(ast) {
1423
1712
  if (n.shape === "subroutine") {
1424
1713
  shapeW = Math.max(shapeW, labelW + 36);
1425
1714
  }
1715
+ if (hasIcon(n.icon)) {
1716
+ shapeH += ICON_SIZE + ICON_GAP;
1717
+ shapeW = Math.max(shapeW, ICON_SIZE + 16);
1718
+ }
1426
1719
  return isHorizontalDir ? { w: shapeH, h: shapeW } : { w: shapeW, h: shapeH };
1427
1720
  };
1428
1721
  const nodeMap = /* @__PURE__ */ new Map();
@@ -1790,15 +2083,15 @@ function layoutFlowchart(ast) {
1790
2083
  };
1791
2084
  });
1792
2085
  function collectDescendantNodeIds(sgId) {
1793
- const sg = ast.subgraphs.find((s) => s.id === sgId);
2086
+ const sg = ast.subgraphs.find((s2) => s2.id === sgId);
1794
2087
  if (!sg) return [];
1795
2088
  const ids = [...sg.children];
1796
2089
  for (const childSgId of sg.subgraphs) ids.push(...collectDescendantNodeIds(childSgId));
1797
2090
  return ids;
1798
2091
  }
1799
2092
  function computeDepth(sgId) {
1800
- for (const s of ast.subgraphs) {
1801
- if (s.subgraphs.includes(sgId)) return 1 + computeDepth(s.id);
2093
+ for (const s2 of ast.subgraphs) {
2094
+ if (s2.subgraphs.includes(sgId)) return 1 + computeDepth(s2.id);
1802
2095
  }
1803
2096
  return 0;
1804
2097
  }
@@ -1997,6 +2290,8 @@ var CSS_TEMPLATE = (themeName) => {
1997
2290
  .sx-fc-node-diamond { fill: ${t.diamondFill}; stroke: ${t.stroke}; }
1998
2291
  .sx-fc-node-round { fill: ${t.roundFill}; stroke: ${t.stroke}; }
1999
2292
  .sx-fc-node-text { fill: ${t.text}; font: 12px system-ui, -apple-system, "Segoe UI", sans-serif; }
2293
+ .sx-fc-icon { stroke: ${t.text}; fill: none; }
2294
+ .sx-fc-icon-fill { fill: ${t.text}; stroke: none; }
2000
2295
  /* Semantic class presets (applied via 'class A start') \u2014 override shape fills */
2001
2296
  .sx-fc-class-start > .sx-fc-node { fill: ${c.start.fill}; stroke: ${c.start.stroke}; }
2002
2297
  .sx-fc-class-start > .sx-fc-node-text { fill: ${c.start.text}; font-weight: 600; }
@@ -2073,10 +2368,19 @@ function renderCluster(lc) {
2073
2368
  function renderNode(ln) {
2074
2369
  const n = ln.node;
2075
2370
  const shapeEl = shapeSVG(n.shape, ln.width, ln.height);
2371
+ const iconBand = hasIcon(n.icon) ? ICON_SIZE + ICON_GAP : 0;
2372
+ let iconEl = "";
2373
+ if (iconBand > 0) {
2374
+ iconEl = group(
2375
+ { transform: `translate(${fmt2(ln.width / 2)} ${fmt2(8 + ICON_SIZE / 2)})` },
2376
+ [renderIcon(n.icon)]
2377
+ );
2378
+ }
2379
+ const labelCy = iconBand > 0 ? iconBand + (ln.height - iconBand) / 2 : ln.height / 2;
2076
2380
  const label = multilineText(
2077
2381
  {
2078
2382
  x: ln.width / 2,
2079
- y: ln.height / 2,
2383
+ y: labelCy,
2080
2384
  class: "sx-fc-node-text",
2081
2385
  "text-anchor": "middle",
2082
2386
  "dominant-baseline": "central"
@@ -2095,7 +2399,7 @@ function renderNode(ln) {
2095
2399
  class: classAttr,
2096
2400
  transform: `translate(${fmt2(ln.x)} ${fmt2(ln.y)})`
2097
2401
  },
2098
- [shapeEl, label, nodeTitle]
2402
+ [shapeEl, iconEl, label, nodeTitle].filter((sEl) => sEl.length > 0)
2099
2403
  );
2100
2404
  }
2101
2405
  function renderEdge(le) {
@@ -2126,7 +2430,7 @@ function renderEdge(le) {
2126
2430
  "data-from": e.from,
2127
2431
  "data-to": e.to
2128
2432
  },
2129
- [p, edgeTitle, labelEl].filter((s) => s.length > 0)
2433
+ [p, edgeTitle, labelEl].filter((s2) => s2.length > 0)
2130
2434
  );
2131
2435
  }
2132
2436
  function renderEdgeLabel(label, cx, cy, textAnchor) {
@@ -2183,7 +2487,7 @@ function renderFlowchartAST(ast, themeName = "default") {
2183
2487
  },
2184
2488
  ast.title
2185
2489
  ) : "";
2186
- const cssOverrides = [nodeStyleOverrides, classDefOverrides, linkStyleOverrides].filter((s) => s.length > 0).join("\n");
2490
+ const cssOverrides = [nodeStyleOverrides, classDefOverrides, linkStyleOverrides].filter((s2) => s2.length > 0).join("\n");
2187
2491
  const headMeta = [
2188
2492
  title(ast.title ? `${ast.title} \u2014 Flowchart` : "Flowchart"),
2189
2493
  desc(
@@ -2236,6 +2540,6 @@ var flowchart = {
2236
2540
  }
2237
2541
  };
2238
2542
 
2239
- export { FC_CONST, flowchart, layoutFlowchart, parseFlowchart, renderFlowchart, renderFlowchartAST };
2240
- //# sourceMappingURL=chunk-UFTYX73U.js.map
2241
- //# sourceMappingURL=chunk-UFTYX73U.js.map
2543
+ export { FC_CONST, flowchart, iconNames, layoutFlowchart, parseFlowchart, renderFlowchart, renderFlowchartAST, renderIcon };
2544
+ //# sourceMappingURL=chunk-7F76AWOI.js.map
2545
+ //# sourceMappingURL=chunk-7F76AWOI.js.map