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,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var chunk3KRL2EGN_cjs = require('./chunk-3KRL2EGN.cjs');
4
- var chunkD7EHZFK4_cjs = require('./chunk-D7EHZFK4.cjs');
4
+ var chunkL7POWM5B_cjs = require('./chunk-L7POWM5B.cjs');
5
5
  var chunk3WNW5Y7P_cjs = require('./chunk-3WNW5Y7P.cjs');
6
6
 
7
7
  // src/diagrams/flowchart/parser.ts
@@ -18,8 +18,8 @@ var FlowchartParseError = class extends Error {
18
18
  source;
19
19
  };
20
20
  var DIRECTIONS = /* @__PURE__ */ new Set(["TB", "TD", "BT", "LR", "RL"]);
21
- function unquoteLabel(s) {
22
- const t = s.trim();
21
+ function unquoteLabel(s2) {
22
+ const t = s2.trim();
23
23
  if (t.length >= 2 && t.startsWith('"') && t.endsWith('"')) return t.slice(1, -1);
24
24
  return t;
25
25
  }
@@ -264,15 +264,15 @@ function parseChainStatement(line2, lineNo) {
264
264
  }
265
265
  function parseSubgraphHeader(rest, idx) {
266
266
  const defaultId = `sg_${idx}`;
267
- const s = rest.trim();
268
- if (!s) return { id: defaultId, label: defaultId, children: [], subgraphs: [] };
269
- const idBracket = /^(\w[\w-]*)\s+\[([^\]]*)\]$/.exec(s);
267
+ const s2 = rest.trim();
268
+ if (!s2) return { id: defaultId, label: defaultId, children: [], subgraphs: [] };
269
+ const idBracket = /^(\w[\w-]*)\s+\[([^\]]*)\]$/.exec(s2);
270
270
  if (idBracket) return { id: idBracket[1], label: idBracket[2], children: [], subgraphs: [] };
271
- const idQuoted = /^(\w[\w-]*)\s+"([^"]*)"$/.exec(s);
271
+ const idQuoted = /^(\w[\w-]*)\s+"([^"]*)"$/.exec(s2);
272
272
  if (idQuoted) return { id: idQuoted[1], label: idQuoted[2], children: [], subgraphs: [] };
273
- const quotedOnly = /^"([^"]*)"$/.exec(s);
273
+ const quotedOnly = /^"([^"]*)"$/.exec(s2);
274
274
  if (quotedOnly) return { id: defaultId, label: quotedOnly[1], children: [], subgraphs: [] };
275
- const plainId = s.split(/\s/)[0];
275
+ const plainId = s2.split(/\s/)[0];
276
276
  return { id: plainId, label: plainId, children: [], subgraphs: [] };
277
277
  }
278
278
  function normalizeDirection(dir) {
@@ -281,9 +281,9 @@ function normalizeDirection(dir) {
281
281
  if (up === "TB" || up === "BT" || up === "LR" || up === "RL") return up;
282
282
  return "TB";
283
283
  }
284
- function parseCssProps(s) {
284
+ function parseCssProps(s2) {
285
285
  const props = {};
286
- for (const part of s.split(",")) {
286
+ for (const part of s2.split(",")) {
287
287
  const colon = part.indexOf(":");
288
288
  if (colon < 0) continue;
289
289
  const key = part.slice(0, colon).trim();
@@ -392,7 +392,7 @@ function parseFlowchart(source) {
392
392
  const sg = parseSubgraphHeader(sgMatch[1] ?? "", ast.subgraphs.length);
393
393
  let finalId = sg.id;
394
394
  let collision = 0;
395
- while (ast.subgraphs.some((s) => s.id === finalId)) {
395
+ while (ast.subgraphs.some((s2) => s2.id === finalId)) {
396
396
  finalId = `${sg.id}_${++collision}`;
397
397
  }
398
398
  sg.id = finalId;
@@ -413,9 +413,23 @@ function parseFlowchart(source) {
413
413
  subgraphStack.pop();
414
414
  continue;
415
415
  }
416
+ const iconMatch = /^icon\s+(\w[\w-]*)\s*:?\s+([\w-]+)\s*$/.exec(trimmed);
417
+ if (iconMatch) {
418
+ const nid = iconMatch[1];
419
+ const iconName = iconMatch[2];
420
+ const existing = nodeMap.get(nid);
421
+ if (existing) {
422
+ existing.icon = iconName;
423
+ } else {
424
+ const node = { id: nid, shape: "rect", label: nid, icon: iconName };
425
+ nodeMap.set(nid, node);
426
+ ast.nodes.push(node);
427
+ }
428
+ continue;
429
+ }
416
430
  const classMatch = /^class\s+([\w,\s]+?)\s+(\w[\w-]*)\s*$/.exec(trimmed);
417
431
  if (classMatch) {
418
- const idList = classMatch[1].split(/[,\s]+/).map((s) => s.trim()).filter((s) => s.length > 0);
432
+ const idList = classMatch[1].split(/[,\s]+/).map((s2) => s2.trim()).filter((s2) => s2.length > 0);
419
433
  const className = classMatch[2];
420
434
  for (const nid of idList) {
421
435
  const existing = nodeMap.get(nid);
@@ -459,7 +473,7 @@ function parseFlowchart(source) {
459
473
  const sel = linkStyleMatch[1].trim();
460
474
  const props = parseCssProps(linkStyleMatch[2]);
461
475
  if (sel !== "default") {
462
- const indices = sel.split(/[,\s]+/).map((s) => s.trim()).filter((s) => s.length > 0).map((s) => parseInt(s, 10)).filter((n) => !isNaN(n));
476
+ const indices = sel.split(/[,\s]+/).map((s2) => s2.trim()).filter((s2) => s2.length > 0).map((s2) => parseInt(s2, 10)).filter((n) => !isNaN(n));
463
477
  for (const idx of indices) {
464
478
  ast.linkStyles.set(idx, { ...ast.linkStyles.get(idx) ?? {}, ...props });
465
479
  }
@@ -703,8 +717,8 @@ function horizontalCompaction(layers, root, align, nodeById, nodeSep) {
703
717
  for (const v of layer) {
704
718
  const r = root.get(v.id);
705
719
  const rx = xs.get(r) ?? 0;
706
- const s = shift.get(sink.get(r));
707
- const sx = s !== void 0 && s !== Number.POSITIVE_INFINITY ? s : 0;
720
+ const s2 = shift.get(sink.get(r));
721
+ const sx = s2 !== void 0 && s2 !== Number.POSITIVE_INFINITY ? s2 : 0;
708
722
  result.set(v.id, rx + sx);
709
723
  }
710
724
  }
@@ -776,6 +790,281 @@ function balance(xss) {
776
790
  return result;
777
791
  }
778
792
 
793
+ // src/diagrams/flowchart/icons.ts
794
+ var ICON_SIZE = 22;
795
+ var ICON_GAP = 4;
796
+ var s = `class="sx-fc-icon" fill="none" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"`;
797
+ var sf = `class="sx-fc-icon-fill"`;
798
+ function gearGlyph() {
799
+ let teeth = "";
800
+ for (let i = 0; i < 8; i++) {
801
+ teeth += `<rect x="-1.8" y="-10.4" width="3.6" height="3.6" rx="0.6" transform="rotate(${i * 45})" ${sf}/>`;
802
+ }
803
+ return `<circle cx="0" cy="0" r="7" ${s}/>${teeth}<circle cx="0" cy="0" r="2.6" ${s}/>`;
804
+ }
805
+ var ICONS = {
806
+ // ── core (original set) ──────────────────────────────────────
807
+ 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}/>`,
808
+ 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}/>`,
809
+ user: () => `<circle cx="0" cy="-4" r="4" ${s}/><path d="M -8 10 C -8 3 8 3 8 10" ${s}/>`,
810
+ 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}/>`,
811
+ gear: gearGlyph,
812
+ 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}/>`,
813
+ 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}/>`,
814
+ 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}/>`,
815
+ 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}/>`,
816
+ clock: () => `<circle cx="0" cy="0" r="9" ${s}/><path d="M 0 -5 V 0 L 4 3" ${s}/>`,
817
+ check: () => `<circle cx="0" cy="0" r="9" ${s}/><path d="M -4 0 L -1 3 L 5 -4" ${s}/>`,
818
+ 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}/>`,
819
+ 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}/>`,
820
+ 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}/>`,
821
+ // ── Tier 1 · general flow ────────────────────────────────────
822
+ folder: () => `<path d="M -10 -6 H -3 L -1 -3 H 10 V 8 H -10 Z" ${s}/>`,
823
+ 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}/>`,
824
+ search: () => `<circle cx="-2" cy="-2" r="6" ${s}/><path d="M 2.5 2.5 L 9 9" ${s}/>`,
825
+ 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}/>`,
826
+ 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}/>`,
827
+ add: () => `<circle cx="0" cy="0" r="9" ${s}/><path d="M -4 0 H 4 M 0 -4 V 4" ${s}/>`,
828
+ 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}/>`,
829
+ 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}/>`,
830
+ 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}/>`,
831
+ 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}/>`,
832
+ 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}/>`,
833
+ 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}/>`,
834
+ filter: () => `<path d="M -9 -7 H 9 L 2 1 V 9 L -2 7 V 1 Z" ${s}/>`,
835
+ flag: () => `<path d="M -7 -9 V 9 M -7 -9 H 7 L 4 -5 L 7 -1 H -7" ${s}/>`,
836
+ 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}/>`,
837
+ 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}/>`,
838
+ 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}/>`,
839
+ 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}/>`,
840
+ cancel: () => `<circle cx="0" cy="0" r="9" ${s}/><path d="M -4 -4 L 4 4 M 4 -4 L -4 4" ${s}/>`,
841
+ play: () => `<circle cx="0" cy="0" r="9" ${s}/><path d="M -3 -5 L 5 0 L -3 5 Z" ${sf}/>`,
842
+ 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}/>`,
843
+ // ── Tier 2 · tech / architecture ─────────────────────────────
844
+ code: () => `<path d="M -3 -7 L -9 0 L -3 7 M 3 -7 L 9 0 L 3 7" ${s}/>`,
845
+ 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}/>`,
846
+ 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}/>`,
847
+ 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}/>`,
848
+ 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}/>`,
849
+ 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}/>`,
850
+ 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}/>`,
851
+ mobile: () => `<rect x="-6" y="-9" width="12" height="18" rx="2" ${s}/><path d="M -2 6 H 2" ${s}/>`,
852
+ 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}/>`,
853
+ 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}/>`,
854
+ "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}/>`,
855
+ 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}/>`,
856
+ 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}/>`,
857
+ 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}/>`,
858
+ function: () => `<path d="M 5 -8 H 3 C 1 -8 0 -6 0 -3 V 8 M -4 -2 H 4" ${s}/>`,
859
+ // ── Tier 3 · people / business / analytics ──────────────────
860
+ 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}/>`,
861
+ 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}/>`,
862
+ 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}/>`,
863
+ 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}/>`,
864
+ "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}/>`,
865
+ "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}/>`,
866
+ 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}/>`,
867
+ chat: () => `<path d="M -9 -7 H 9 V 3 H -2 L -6 7 V 3 H -9 Z" ${s}/>`,
868
+ 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}/>`,
869
+ 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}/>`,
870
+ // ── Tier 4 · medical ─────────────────────────────────────────
871
+ 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}/>`,
872
+ 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>`,
873
+ 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}/>`,
874
+ 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>`,
875
+ 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}/>`,
876
+ // ── Tier 4 · legal ───────────────────────────────────────────
877
+ 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}/>`,
878
+ 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>`,
879
+ 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}/>`,
880
+ 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}/>`,
881
+ // ── Tier 4 · engineering ─────────────────────────────────────
882
+ bolt: () => `<path d="M 2 -9 L -5 2 H 0 L -2 9 L 6 -2 H 1 Z" ${s}/>`,
883
+ 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}/>`,
884
+ 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}/>`,
885
+ 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}/>`,
886
+ 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}/>`,
887
+ 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}/>`,
888
+ // ── Tier 4 · finance ─────────────────────────────────────────
889
+ 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}/>`,
890
+ "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}/>`,
891
+ 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}/>`,
892
+ 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}/>`
893
+ };
894
+ var ALIASES = {
895
+ db: "database",
896
+ storage: "database",
897
+ api: "server",
898
+ service: "server",
899
+ person: "user",
900
+ account: "user",
901
+ customer: "user",
902
+ cog: "gear",
903
+ settings: "gear",
904
+ config: "gear",
905
+ doc: "document",
906
+ web: "globe",
907
+ internet: "globe",
908
+ www: "globe",
909
+ secure: "lock",
910
+ auth: "lock",
911
+ password: "lock",
912
+ email: "mail",
913
+ envelope: "mail",
914
+ time: "clock",
915
+ timer: "clock",
916
+ schedule: "clock",
917
+ done: "check",
918
+ success: "check",
919
+ ok: "check",
920
+ complete: "check",
921
+ warning: "alert",
922
+ error: "alert",
923
+ danger: "alert",
924
+ // tier 1
925
+ directory: "folder",
926
+ page: "file",
927
+ find: "search",
928
+ pencil: "edit",
929
+ modify: "edit",
930
+ delete: "trash",
931
+ remove: "trash",
932
+ plus: "add",
933
+ new: "add",
934
+ create: "add",
935
+ refresh: "sync",
936
+ reload: "sync",
937
+ publish: "upload",
938
+ import: "download",
939
+ save: "download",
940
+ url: "link",
941
+ date: "calendar",
942
+ events: "calendar",
943
+ menu: "list",
944
+ steps: "list",
945
+ sort: "filter",
946
+ milestone: "flag",
947
+ favorite: "star",
948
+ rating: "star",
949
+ label: "tag",
950
+ about: "info",
951
+ help: "question",
952
+ faq: "question",
953
+ close: "cancel",
954
+ reject: "cancel",
955
+ start: "play",
956
+ run: "play",
957
+ end: "stop",
958
+ // tier 2
959
+ dev: "code",
960
+ source: "code",
961
+ shell: "terminal",
962
+ cli: "terminal",
963
+ docker: "container",
964
+ pod: "container",
965
+ redis: "cache",
966
+ firewall: "shield",
967
+ protect: "shield",
968
+ token: "key",
969
+ credential: "key",
970
+ site: "browser",
971
+ phone_app: "mobile",
972
+ app: "mobile",
973
+ monitor: "desktop",
974
+ computer: "desktop",
975
+ chip: "cpu",
976
+ processor: "cpu",
977
+ git: "git-branch",
978
+ branch: "git-branch",
979
+ issue: "bug",
980
+ defect: "bug",
981
+ deploy: "rocket",
982
+ launch: "rocket",
983
+ ship: "rocket",
984
+ hook: "webhook",
985
+ fn: "function",
986
+ lambda: "function",
987
+ // tier 3
988
+ group: "users",
989
+ team: "users",
990
+ org: "building",
991
+ company: "building",
992
+ office: "building",
993
+ work: "briefcase",
994
+ job: "briefcase",
995
+ cash: "money",
996
+ dollar: "money",
997
+ payment: "money",
998
+ chart: "bar-chart",
999
+ bars: "bar-chart",
1000
+ metrics: "bar-chart",
1001
+ pie: "pie-chart",
1002
+ growth: "trend",
1003
+ analytics: "trend",
1004
+ message: "chat",
1005
+ comment: "chat",
1006
+ notification: "bell",
1007
+ notify: "bell",
1008
+ call: "phone",
1009
+ // tier 4 medical
1010
+ health: "heart",
1011
+ like: "heart",
1012
+ medication: "pill",
1013
+ drug: "pill",
1014
+ clinic: "cross",
1015
+ hospital: "cross",
1016
+ medical: "cross",
1017
+ injection: "syringe",
1018
+ vaccine: "syringe",
1019
+ gene: "dna",
1020
+ genetic: "dna",
1021
+ // tier 4 legal
1022
+ justice: "scale",
1023
+ balance: "scale",
1024
+ legal: "scale",
1025
+ judge: "gavel",
1026
+ court: "gavel",
1027
+ agreement: "contract",
1028
+ signed: "contract",
1029
+ seal: "stamp",
1030
+ approved: "stamp",
1031
+ // tier 4 engineering
1032
+ power: "bolt",
1033
+ electric: "bolt",
1034
+ flash: "bolt",
1035
+ charge: "battery",
1036
+ meter: "gauge",
1037
+ speed: "gauge",
1038
+ tool: "wrench",
1039
+ tools: "wrench",
1040
+ repair: "wrench",
1041
+ plant: "factory",
1042
+ industrial: "factory",
1043
+ // tier 4 finance
1044
+ finance: "bank",
1045
+ card: "credit-card",
1046
+ bill: "invoice",
1047
+ receipt: "invoice",
1048
+ coin: "coins"
1049
+ };
1050
+ function resolveIconName(name) {
1051
+ const key = name.toLowerCase();
1052
+ if (ICONS[key]) return key;
1053
+ if (ALIASES[key] && ICONS[ALIASES[key]]) return ALIASES[key];
1054
+ return void 0;
1055
+ }
1056
+ function iconNames() {
1057
+ return Object.keys(ICONS);
1058
+ }
1059
+ function renderIcon(name) {
1060
+ const key = resolveIconName(name);
1061
+ if (key) return ICONS[key]();
1062
+ 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}/>`;
1063
+ }
1064
+ function hasIcon(name) {
1065
+ return typeof name === "string" && name.length > 0;
1066
+ }
1067
+
779
1068
  // src/diagrams/flowchart/layout.ts
780
1069
  var FC_CONST = {
781
1070
  nodeWidth: 120,
@@ -1037,23 +1326,23 @@ function barycenterReorder(layer, fixed, neighborsOf, biasRight) {
1037
1326
  const scored = layer.map((id, i) => {
1038
1327
  const neighbors = neighborsOf(id).map((n) => fixedIdx.get(n)).filter((p) => p !== void 0);
1039
1328
  if (neighbors.length === 0) return { id, score: -1, orig: i, hasNeighbors: false };
1040
- const sum = neighbors.reduce((s, n) => s + n, 0);
1329
+ const sum = neighbors.reduce((s2, n) => s2 + n, 0);
1041
1330
  return { id, score: sum / neighbors.length, orig: i, hasNeighbors: true };
1042
1331
  });
1043
- const withNbrs = scored.filter((s) => s.hasNeighbors);
1044
- const withoutNbrs = scored.filter((s) => !s.hasNeighbors);
1332
+ const withNbrs = scored.filter((s2) => s2.hasNeighbors);
1333
+ const withoutNbrs = scored.filter((s2) => !s2.hasNeighbors);
1045
1334
  withNbrs.sort((a, b) => {
1046
1335
  if (a.score !== b.score) return a.score - b.score;
1047
1336
  return biasRight ? b.orig - a.orig : a.orig - b.orig;
1048
1337
  });
1049
1338
  const result = new Array(layer.length);
1050
- for (const s of withoutNbrs) result[s.orig] = s;
1339
+ for (const s2 of withoutNbrs) result[s2.orig] = s2;
1051
1340
  let k = 0;
1052
1341
  for (let i = 0; i < result.length; i++) {
1053
1342
  if (result[i] !== void 0) continue;
1054
1343
  result[i] = withNbrs[k++];
1055
1344
  }
1056
- return result.map((s) => s.id);
1345
+ return result.map((s2) => s2.id);
1057
1346
  }
1058
1347
  function orderLayers(layers, segments) {
1059
1348
  const succ = /* @__PURE__ */ new Map();
@@ -1220,7 +1509,7 @@ function laneBasedXCoords(layerNodes, pathOf, nodeSpacingX, segments) {
1220
1509
  for (const layerLanes of lanesPerLayer) {
1221
1510
  const members = layerLanes.get(lane) ?? [];
1222
1511
  if (members.length === 0) continue;
1223
- const inner = members.reduce((s, n) => s + n.width, 0) + (members.length - 1) * nodeSpacingX;
1512
+ const inner = members.reduce((s2, n) => s2 + n.width, 0) + (members.length - 1) * nodeSpacingX;
1224
1513
  if (inner > maxInner) maxInner = inner;
1225
1514
  }
1226
1515
  const pad = lane !== null ? 2 * INNER_PAD : 0;
@@ -1243,7 +1532,7 @@ function laneBasedXCoords(layerNodes, pathOf, nodeSpacingX, segments) {
1243
1532
  if (members.length === 0) continue;
1244
1533
  const laneW = laneWidths[laneIdx];
1245
1534
  const laneStart = laneStartX[laneIdx];
1246
- const innerW = members.reduce((s, n) => s + n.width, 0) + (members.length - 1) * nodeSpacingX;
1535
+ const innerW = members.reduce((s2, n) => s2 + n.width, 0) + (members.length - 1) * nodeSpacingX;
1247
1536
  let cursor = laneStart + (laneW - innerW) / 2;
1248
1537
  for (const n of members) {
1249
1538
  result.set(n.id, cursor + n.width / 2);
@@ -1286,7 +1575,7 @@ function enforceSequentialClusterLayers(ast, layerMap, edges) {
1286
1575
  const topLevel = ast.subgraphs.filter((sg) => !sgParent.get(sg.id));
1287
1576
  if (topLevel.length < 2) return;
1288
1577
  const collect = (sgId) => {
1289
- const sg = ast.subgraphs.find((s) => s.id === sgId);
1578
+ const sg = ast.subgraphs.find((s2) => s2.id === sgId);
1290
1579
  if (!sg) return [];
1291
1580
  const ids = [...sg.children];
1292
1581
  for (const childSgId of sg.subgraphs) ids.push(...collect(childSgId));
@@ -1360,7 +1649,7 @@ function hasOverlappingTopLevelClusters(ast, layerMap, sgParent) {
1360
1649
  const topLevel = ast.subgraphs.filter((sg) => !sgParent.get(sg.id));
1361
1650
  if (topLevel.length < 2) return false;
1362
1651
  const collect = (sgId) => {
1363
- const sg = ast.subgraphs.find((s) => s.id === sgId);
1652
+ const sg = ast.subgraphs.find((s2) => s2.id === sgId);
1364
1653
  if (!sg) return [];
1365
1654
  const ids = [...sg.children];
1366
1655
  for (const childSgId of sg.subgraphs) ids.push(...collect(childSgId));
@@ -1425,6 +1714,10 @@ function layoutFlowchart(ast) {
1425
1714
  if (n.shape === "subroutine") {
1426
1715
  shapeW = Math.max(shapeW, labelW + 36);
1427
1716
  }
1717
+ if (hasIcon(n.icon)) {
1718
+ shapeH += ICON_SIZE + ICON_GAP;
1719
+ shapeW = Math.max(shapeW, ICON_SIZE + 16);
1720
+ }
1428
1721
  return isHorizontalDir ? { w: shapeH, h: shapeW } : { w: shapeW, h: shapeH };
1429
1722
  };
1430
1723
  const nodeMap = /* @__PURE__ */ new Map();
@@ -1792,15 +2085,15 @@ function layoutFlowchart(ast) {
1792
2085
  };
1793
2086
  });
1794
2087
  function collectDescendantNodeIds(sgId) {
1795
- const sg = ast.subgraphs.find((s) => s.id === sgId);
2088
+ const sg = ast.subgraphs.find((s2) => s2.id === sgId);
1796
2089
  if (!sg) return [];
1797
2090
  const ids = [...sg.children];
1798
2091
  for (const childSgId of sg.subgraphs) ids.push(...collectDescendantNodeIds(childSgId));
1799
2092
  return ids;
1800
2093
  }
1801
2094
  function computeDepth(sgId) {
1802
- for (const s of ast.subgraphs) {
1803
- if (s.subgraphs.includes(sgId)) return 1 + computeDepth(s.id);
2095
+ for (const s2 of ast.subgraphs) {
2096
+ if (s2.subgraphs.includes(sgId)) return 1 + computeDepth(s2.id);
1804
2097
  }
1805
2098
  return 0;
1806
2099
  }
@@ -1990,7 +2283,7 @@ function shapeSVG(shape, w, h) {
1990
2283
 
1991
2284
  // src/diagrams/flowchart/renderer.ts
1992
2285
  var CSS_TEMPLATE = (themeName) => {
1993
- const t = chunkD7EHZFK4_cjs.resolveFlowchartTheme(themeName);
2286
+ const t = chunkL7POWM5B_cjs.resolveFlowchartTheme(themeName);
1994
2287
  const c = t.classes;
1995
2288
  return `
1996
2289
  .sx-fc { font-family: system-ui, -apple-system, "Segoe UI", sans-serif; }
@@ -1999,6 +2292,8 @@ var CSS_TEMPLATE = (themeName) => {
1999
2292
  .sx-fc-node-diamond { fill: ${t.diamondFill}; stroke: ${t.stroke}; }
2000
2293
  .sx-fc-node-round { fill: ${t.roundFill}; stroke: ${t.stroke}; }
2001
2294
  .sx-fc-node-text { fill: ${t.text}; font: 12px system-ui, -apple-system, "Segoe UI", sans-serif; }
2295
+ .sx-fc-icon { stroke: ${t.text}; fill: none; }
2296
+ .sx-fc-icon-fill { fill: ${t.text}; stroke: none; }
2002
2297
  /* Semantic class presets (applied via 'class A start') \u2014 override shape fills */
2003
2298
  .sx-fc-class-start > .sx-fc-node { fill: ${c.start.fill}; stroke: ${c.start.stroke}; }
2004
2299
  .sx-fc-class-start > .sx-fc-node-text { fill: ${c.start.text}; font-weight: 600; }
@@ -2075,10 +2370,19 @@ function renderCluster(lc) {
2075
2370
  function renderNode(ln) {
2076
2371
  const n = ln.node;
2077
2372
  const shapeEl = shapeSVG(n.shape, ln.width, ln.height);
2373
+ const iconBand = hasIcon(n.icon) ? ICON_SIZE + ICON_GAP : 0;
2374
+ let iconEl = "";
2375
+ if (iconBand > 0) {
2376
+ iconEl = chunk3WNW5Y7P_cjs.group(
2377
+ { transform: `translate(${fmt2(ln.width / 2)} ${fmt2(8 + ICON_SIZE / 2)})` },
2378
+ [renderIcon(n.icon)]
2379
+ );
2380
+ }
2381
+ const labelCy = iconBand > 0 ? iconBand + (ln.height - iconBand) / 2 : ln.height / 2;
2078
2382
  const label = chunk3WNW5Y7P_cjs.multilineText(
2079
2383
  {
2080
2384
  x: ln.width / 2,
2081
- y: ln.height / 2,
2385
+ y: labelCy,
2082
2386
  class: "sx-fc-node-text",
2083
2387
  "text-anchor": "middle",
2084
2388
  "dominant-baseline": "central"
@@ -2097,7 +2401,7 @@ function renderNode(ln) {
2097
2401
  class: classAttr,
2098
2402
  transform: `translate(${fmt2(ln.x)} ${fmt2(ln.y)})`
2099
2403
  },
2100
- [shapeEl, label, nodeTitle]
2404
+ [shapeEl, iconEl, label, nodeTitle].filter((sEl) => sEl.length > 0)
2101
2405
  );
2102
2406
  }
2103
2407
  function renderEdge(le) {
@@ -2128,7 +2432,7 @@ function renderEdge(le) {
2128
2432
  "data-from": e.from,
2129
2433
  "data-to": e.to
2130
2434
  },
2131
- [p, edgeTitle, labelEl].filter((s) => s.length > 0)
2435
+ [p, edgeTitle, labelEl].filter((s2) => s2.length > 0)
2132
2436
  );
2133
2437
  }
2134
2438
  function renderEdgeLabel(label, cx, cy, textAnchor) {
@@ -2185,7 +2489,7 @@ function renderFlowchartAST(ast, themeName = "default") {
2185
2489
  },
2186
2490
  ast.title
2187
2491
  ) : "";
2188
- const cssOverrides = [nodeStyleOverrides, classDefOverrides, linkStyleOverrides].filter((s) => s.length > 0).join("\n");
2492
+ const cssOverrides = [nodeStyleOverrides, classDefOverrides, linkStyleOverrides].filter((s2) => s2.length > 0).join("\n");
2189
2493
  const headMeta = [
2190
2494
  chunk3WNW5Y7P_cjs.title(ast.title ? `${ast.title} \u2014 Flowchart` : "Flowchart"),
2191
2495
  chunk3WNW5Y7P_cjs.desc(
@@ -2240,9 +2544,11 @@ var flowchart = {
2240
2544
 
2241
2545
  exports.FC_CONST = FC_CONST;
2242
2546
  exports.flowchart = flowchart;
2547
+ exports.iconNames = iconNames;
2243
2548
  exports.layoutFlowchart = layoutFlowchart;
2244
2549
  exports.parseFlowchart = parseFlowchart;
2245
2550
  exports.renderFlowchart = renderFlowchart;
2246
2551
  exports.renderFlowchartAST = renderFlowchartAST;
2247
- //# sourceMappingURL=chunk-QTNPMIO2.cjs.map
2248
- //# sourceMappingURL=chunk-QTNPMIO2.cjs.map
2552
+ exports.renderIcon = renderIcon;
2553
+ //# sourceMappingURL=chunk-6JI6FWLZ.cjs.map
2554
+ //# sourceMappingURL=chunk-6JI6FWLZ.cjs.map