schematex 0.6.6 → 0.6.8

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 (105) hide show
  1. package/README.md +115 -3
  2. package/README.zh-CN.md +783 -0
  3. package/dist/ai/ai-sdk.cjs +11 -11
  4. package/dist/ai/ai-sdk.d.cts +4 -4
  5. package/dist/ai/ai-sdk.d.ts +4 -4
  6. package/dist/ai/ai-sdk.js +6 -6
  7. package/dist/ai/index.cjs +17 -17
  8. package/dist/ai/index.d.cts +3 -3
  9. package/dist/ai/index.d.ts +3 -3
  10. package/dist/ai/index.js +6 -6
  11. package/dist/{api-QFMTlIi7.d.ts → api-DIJM_mqp.d.ts} +1 -1
  12. package/dist/{api-DA4-U-jn.d.cts → api-JaBtsUT8.d.cts} +1 -1
  13. package/dist/browser.cjs +12 -12
  14. package/dist/browser.d.cts +3 -3
  15. package/dist/browser.d.ts +3 -3
  16. package/dist/browser.js +6 -6
  17. package/dist/{chunk-KJZCRHNR.js → chunk-2TUZ3QJA.js} +623 -9
  18. package/dist/chunk-2TUZ3QJA.js.map +1 -0
  19. package/dist/{chunk-EUVUO3CL.cjs → chunk-34O3C6OC.cjs} +2 -2
  20. package/dist/{chunk-EUVUO3CL.cjs.map → chunk-34O3C6OC.cjs.map} +1 -1
  21. package/dist/{chunk-MLLARXOI.cjs → chunk-AGBY7KLL.cjs} +131 -27
  22. package/dist/chunk-AGBY7KLL.cjs.map +1 -0
  23. package/dist/{chunk-EPKIJEH7.js → chunk-C7V57V6O.js} +54 -8
  24. package/dist/chunk-C7V57V6O.js.map +1 -0
  25. package/dist/{chunk-CMZKAASF.cjs → chunk-EDXDFKYO.cjs} +16 -8
  26. package/dist/chunk-EDXDFKYO.cjs.map +1 -0
  27. package/dist/{chunk-FOPOOV2P.js → chunk-J2TT7PGI.js} +127 -23
  28. package/dist/chunk-J2TT7PGI.js.map +1 -0
  29. package/dist/{chunk-DO2DDHTQ.cjs → chunk-J3EPFZPX.cjs} +623 -8
  30. package/dist/chunk-J3EPFZPX.cjs.map +1 -0
  31. package/dist/{chunk-KCHUQXS3.js → chunk-JTGTWBAD.js} +2 -2
  32. package/dist/{chunk-KCHUQXS3.js.map → chunk-JTGTWBAD.js.map} +1 -1
  33. package/dist/{chunk-7DAIEDQP.js → chunk-MPCSWRZC.js} +75 -13
  34. package/dist/chunk-MPCSWRZC.js.map +1 -0
  35. package/dist/{chunk-3HZW6K5I.js → chunk-QZ2OBNAS.js} +14 -6
  36. package/dist/chunk-QZ2OBNAS.js.map +1 -0
  37. package/dist/{chunk-SUIDD2C5.cjs → chunk-SHMG7BVF.cjs} +54 -8
  38. package/dist/chunk-SHMG7BVF.cjs.map +1 -0
  39. package/dist/{chunk-XYHCAJMI.cjs → chunk-UHPGWO77.cjs} +75 -12
  40. package/dist/chunk-UHPGWO77.cjs.map +1 -0
  41. package/dist/{diagnostics-CSznf_sl.d.cts → diagnostics-BKRow1ur.d.cts} +14 -0
  42. package/dist/{diagnostics-CSznf_sl.d.ts → diagnostics-BKRow1ur.d.ts} +14 -0
  43. package/dist/diagrams/blockdiagram/index.cjs +5 -5
  44. package/dist/diagrams/blockdiagram/index.d.cts +1 -1
  45. package/dist/diagrams/blockdiagram/index.d.ts +1 -1
  46. package/dist/diagrams/blockdiagram/index.js +1 -1
  47. package/dist/diagrams/circuit/index.cjs +11 -7
  48. package/dist/diagrams/circuit/index.d.cts +4 -2
  49. package/dist/diagrams/circuit/index.d.ts +4 -2
  50. package/dist/diagrams/circuit/index.js +1 -1
  51. package/dist/diagrams/ecomap/index.d.cts +1 -1
  52. package/dist/diagrams/ecomap/index.d.ts +1 -1
  53. package/dist/diagrams/entity/index.d.cts +1 -1
  54. package/dist/diagrams/entity/index.d.ts +1 -1
  55. package/dist/diagrams/fishbone/index.d.cts +1 -1
  56. package/dist/diagrams/fishbone/index.d.ts +1 -1
  57. package/dist/diagrams/flowchart/index.d.cts +2 -2
  58. package/dist/diagrams/flowchart/index.d.ts +2 -2
  59. package/dist/diagrams/genogram/index.d.cts +1 -1
  60. package/dist/diagrams/genogram/index.d.ts +1 -1
  61. package/dist/diagrams/ladder/index.d.cts +1 -1
  62. package/dist/diagrams/ladder/index.d.ts +1 -1
  63. package/dist/diagrams/logic/index.d.cts +1 -1
  64. package/dist/diagrams/logic/index.d.ts +1 -1
  65. package/dist/diagrams/orgchart/index.cjs +10 -6
  66. package/dist/diagrams/orgchart/index.d.cts +27 -2
  67. package/dist/diagrams/orgchart/index.d.ts +27 -2
  68. package/dist/diagrams/orgchart/index.js +1 -1
  69. package/dist/diagrams/pedigree/index.d.cts +1 -1
  70. package/dist/diagrams/pedigree/index.d.ts +1 -1
  71. package/dist/diagrams/phylo/index.d.cts +1 -1
  72. package/dist/diagrams/phylo/index.d.ts +1 -1
  73. package/dist/diagrams/sld/index.cjs +7 -7
  74. package/dist/diagrams/sld/index.d.cts +1 -1
  75. package/dist/diagrams/sld/index.d.ts +1 -1
  76. package/dist/diagrams/sld/index.js +1 -1
  77. package/dist/diagrams/sociogram/index.d.cts +1 -1
  78. package/dist/diagrams/sociogram/index.d.ts +1 -1
  79. package/dist/diagrams/timing/index.d.cts +1 -1
  80. package/dist/diagrams/timing/index.d.ts +1 -1
  81. package/dist/diagrams/venn/index.d.cts +1 -1
  82. package/dist/diagrams/venn/index.d.ts +1 -1
  83. package/dist/{index-CDpYuU7l.d.cts → index-DU2h1Y-a.d.cts} +1 -1
  84. package/dist/{index-jTwjudTW.d.ts → index-Dq3Mfxay.d.ts} +1 -1
  85. package/dist/index.cjs +35 -35
  86. package/dist/index.d.cts +4 -4
  87. package/dist/index.d.ts +4 -4
  88. package/dist/index.js +8 -8
  89. package/dist/react.cjs +6 -6
  90. package/dist/react.d.cts +2 -2
  91. package/dist/react.d.ts +2 -2
  92. package/dist/react.js +5 -5
  93. package/dist/{tools-CbuSbW6B.d.cts → tools-A0HRZ8jj.d.ts} +11 -2
  94. package/dist/{tools-D344vOzR.d.ts → tools-OzOQnlnV.d.cts} +11 -2
  95. package/package.json +2 -2
  96. package/dist/chunk-3HZW6K5I.js.map +0 -1
  97. package/dist/chunk-7DAIEDQP.js.map +0 -1
  98. package/dist/chunk-CMZKAASF.cjs.map +0 -1
  99. package/dist/chunk-DO2DDHTQ.cjs.map +0 -1
  100. package/dist/chunk-EPKIJEH7.js.map +0 -1
  101. package/dist/chunk-FOPOOV2P.js.map +0 -1
  102. package/dist/chunk-KJZCRHNR.js.map +0 -1
  103. package/dist/chunk-MLLARXOI.cjs.map +0 -1
  104. package/dist/chunk-SUIDD2C5.cjs.map +0 -1
  105. package/dist/chunk-XYHCAJMI.cjs.map +0 -1
@@ -180,6 +180,9 @@ function parseOrgchart(text2) {
180
180
  const nodeMap = /* @__PURE__ */ new Map();
181
181
  const edges = [];
182
182
  const indentStack = [];
183
+ const unparseableLines = [];
184
+ const duplicateIds = [];
185
+ const impliedNodes = [];
183
186
  for (const rl of rawLines) {
184
187
  const line = rl.text;
185
188
  if (/^orgchart\b/i.test(line)) {
@@ -226,10 +229,12 @@ function parseOrgchart(text2) {
226
229
  if (edgeHandled) continue;
227
230
  const parsed = parseNodeLine(line);
228
231
  if (!parsed) {
229
- throw new OrgchartParseError(`Cannot parse line: ${line}`, rl.line, void 0, line);
232
+ unparseableLines.push({ line: rl.line, text: line });
233
+ continue;
230
234
  }
231
235
  if (nodeMap.has(parsed.id)) {
232
- throw new OrgchartParseError(`Duplicate node id "${parsed.id}"`, rl.line, void 0, line);
236
+ duplicateIds.push(parsed.id);
237
+ continue;
233
238
  }
234
239
  const node = {
235
240
  id: parsed.id,
@@ -299,18 +304,23 @@ function parseOrgchart(text2) {
299
304
  if (!exists) edges.push({ from: n.parent, to: n.id, kind: "report" });
300
305
  }
301
306
  }
307
+ const ensureNode = (id) => {
308
+ if (nodeMap.has(id)) return;
309
+ const node = { id, name: id, kind: "person", matrix: [] };
310
+ nodes.push(node);
311
+ nodeMap.set(id, node);
312
+ impliedNodes.push(id);
313
+ };
302
314
  for (const e of edges) {
303
- if (!nodeMap.has(e.from)) {
304
- throw new OrgchartParseError(`Edge references unknown node "${e.from}"`);
305
- }
306
- if (!nodeMap.has(e.to)) {
307
- throw new OrgchartParseError(`Edge references unknown node "${e.to}"`);
308
- }
315
+ ensureNode(e.from);
316
+ ensureNode(e.to);
309
317
  }
310
318
  if (nodes.length === 0) {
311
- throw new OrgchartParseError("Orgchart has no nodes");
319
+ throw new OrgchartParseError(
320
+ unparseableLines.length > 0 ? `Orgchart has no parseable nodes (${unparseableLines.length} line(s) could not be read)` : "Orgchart has no nodes"
321
+ );
312
322
  }
313
- return {
323
+ const ast = {
314
324
  type: "orgchart",
315
325
  title: title2,
316
326
  direction,
@@ -318,6 +328,57 @@ function parseOrgchart(text2) {
318
328
  nodes,
319
329
  edges
320
330
  };
331
+ if (unparseableLines.length || duplicateIds.length || impliedNodes.length) {
332
+ ast.recovered = {
333
+ ...unparseableLines.length ? { unparseableLines } : {},
334
+ ...duplicateIds.length ? { duplicateIds } : {},
335
+ ...impliedNodes.length ? { impliedNodes } : {}
336
+ };
337
+ }
338
+ return ast;
339
+ }
340
+
341
+ // src/diagrams/orgchart/lint.ts
342
+ function lintOrgchart(text2) {
343
+ let ast;
344
+ try {
345
+ ast = parseOrgchart(text2);
346
+ } catch {
347
+ return [];
348
+ }
349
+ const out = [];
350
+ const rec = ast.recovered;
351
+ if (!rec) return out;
352
+ for (const { line, text: src } of rec.unparseableLines ?? []) {
353
+ out.push({
354
+ severity: "warning",
355
+ code: "ORGCHART_UNPARSEABLE_LINE",
356
+ message: `skipped a line that is neither a node nor an edge: "${src}"`,
357
+ line,
358
+ source: src,
359
+ hint: 'A node is `id : "Name" | Title | Dept`; an edge is `parent -> child`. Check for a missing colon or a stray line.',
360
+ fatal: false
361
+ });
362
+ }
363
+ if (rec.duplicateIds?.length) {
364
+ out.push({
365
+ severity: "warning",
366
+ code: "ORGCHART_DUPLICATE_ID",
367
+ message: `kept the first declaration of duplicate node id(s): ${rec.duplicateIds.map((id) => `"${id}"`).join(", ")}`,
368
+ hint: "Give each person/role a unique id; later redeclarations are dropped.",
369
+ fatal: false
370
+ });
371
+ }
372
+ if (rec.impliedNodes?.length) {
373
+ out.push({
374
+ severity: "warning",
375
+ code: "ORGCHART_IMPLIED_NODE",
376
+ message: `created node(s) from edges that were never declared: ${rec.impliedNodes.map((id) => `"${id}"`).join(", ")}`,
377
+ hint: 'Declare each person/role explicitly (`id : "Name"`) so labels and roles render; bare ids fall back to the id as the name.',
378
+ fatal: false
379
+ });
380
+ }
381
+ return out;
321
382
  }
322
383
 
323
384
  // src/diagrams/orgchart/layout.ts
@@ -1008,12 +1069,13 @@ var orgchart = {
1008
1069
  return /^\s*orgchart\b/i.test(text2);
1009
1070
  },
1010
1071
  parse: parseOrgchart,
1072
+ lint: lintOrgchart,
1011
1073
  render(text2, config) {
1012
1074
  const ast = parseOrgchart(text2);
1013
1075
  return renderOrgchart(ast, config);
1014
1076
  }
1015
1077
  };
1016
1078
 
1017
- export { OrgchartParseError, layoutOrgchart, orgchart, parseOrgchart, renderOrgchart };
1018
- //# sourceMappingURL=chunk-7DAIEDQP.js.map
1019
- //# sourceMappingURL=chunk-7DAIEDQP.js.map
1079
+ export { OrgchartParseError, layoutOrgchart, lintOrgchart, orgchart, parseOrgchart, renderOrgchart };
1080
+ //# sourceMappingURL=chunk-MPCSWRZC.js.map
1081
+ //# sourceMappingURL=chunk-MPCSWRZC.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/diagrams/orgchart/parser.ts","../src/diagrams/orgchart/lint.ts","../src/diagrams/orgchart/layout.ts","../src/diagrams/orgchart/renderer.ts","../src/diagrams/orgchart/index.ts"],"names":["text","title","sx","sy","ex","ey","path"],"mappings":";;;;;AAWO,IAAM,kBAAA,GAAN,cAAiC,KAAA,CAAM;AAAA,EAC5C,WAAA,CACE,OAAA,EACO,IAAA,EACA,MAAA,EACA,MAAA,EACP;AACA,IAAA,KAAA,CAAM,SAAS,MAAA,GAAY,CAAA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AG,IAAA,CAAK;AAAA;AACV,KACF;AAAA,EACF;AAGA,EAAA,KAAA,MAAW,EAAA,IAAM,OAAO,KAAA,EAAO;AAC7B,IAAA,KAAA,CAAM,IAAA,CAAK,cAAA,CAAe,EAAA,EAAI,CAAC,CAAC,CAAA;AAAA,EAClC;AAEA,EAAA,QAAA,CAAS,IAAA,CAAK,MAAM,EAAE,SAAA,EAAW,gBAAgB,WAAW,CAAA,CAAA,CAAA,EAAI,EAAG,KAAK,CAAC,CAAA;AAEzE,EAAA,OAAO,OAAA;AAAA,IACL;AAAA,MACE,KAAA,EAAO,QAAA;AAAA,MACP,IAAA,EAAM,KAAA;AAAA,MACN,YAAA,EAAc,SAAA,CAAU,GAAA,CAAI,KAAA,IAAS,sBAAsB,CAAA;AAAA,MAC3D,KAAA;AAAA,MACA,MAAA;AAAA,MACA,OAAA,EAAS,CAAA,IAAA,EAAO,KAAK,CAAA,CAAA,EAAI,MAAM,CAAA;AAAA,KACjC;AAAA,IACA;AAAA,GACF;AACF;;;ACjdO,IAAM,QAAA,GAA0B;AAAA,EACrC,IAAA,EAAM,UAAA;AAAA,EACN,OAAON,KAAAA,EAAM;AACX,IAAA,OAAO,iBAAA,CAAkB,KAAKA,KAAI,CAAA;AAAA,EACpC,CAAA;AAAA,EACA,KAAA,EAAO,aAAA;AAAA,EACP,IAAA,EAAM,YAAA;AAAA,EAEN,MAAA,CAAOA,OAAM,MAAA,EAAQ;AACnB,IAAA,MAAM,GAAA,GAAM,cAAcA,KAAI,CAAA;AAC9B,IAAA,OAAO,cAAA,CAAe,KAAK,MAAM,CAAA;AAAA,EACnC;AACF","file":"chunk-MPCSWRZC.js","sourcesContent":["import type {\n OrgchartAST,\n OrgchartDirection,\n OrgchartEdge,\n OrgchartLayoutMode,\n OrgchartNode,\n OrgchartNodeKind,\n OrgchartRoleIcon,\n} from \"./types\";\nimport { matchQuotedTitle } from \"../../core/quotes\";\n\nexport class OrgchartParseError extends Error {\n constructor(\n message: string,\n public line?: number,\n public column?: number,\n public source?: string\n ) {\n super(line !== undefined ? `Line ${line}: ${message}` : message);\n this.name = \"OrgchartParseError\";\n }\n}\n\nconst ROLE_ICONS: Record<string, OrgchartRoleIcon> = {\n ceo: \"CEO\",\n cto: \"CTO\",\n cfo: \"CFO\",\n coo: \"COO\",\n cmo: \"CMO\",\n cpo: \"CPO\",\n vp: \"VP\",\n engineer: \"Engineer\",\n engineering: \"Engineer\",\n designer: \"Designer\",\n design: \"Designer\",\n sales: \"Sales\",\n hr: \"HR\",\n legal: \"Legal\",\n ops: \"Ops\",\n operations: \"Ops\",\n marketing: \"Marketing\",\n product: \"Product\",\n data: \"Data\",\n advisor: \"Advisor\",\n intern: \"Intern\",\n vacant: \"Vacant\",\n};\n\nconst NODE_KIND_KEYWORDS = new Set([\n \"person\",\n \"role\",\n \"open\",\n \"draft\",\n \"tbh\",\n \"advisor\",\n \"external\",\n]);\n\nfunction stripComment(line: string): string {\n let out = \"\";\n let inQuote = false;\n for (const ch of line) {\n if (ch === '\"') inQuote = !inQuote;\n if ((ch === \"#\" || (ch === \"/\" && out.endsWith(\"/\"))) && !inQuote) {\n if (ch === \"/\") return out.slice(0, -1);\n return out;\n }\n out += ch;\n }\n return out;\n}\n\nfunction stripQuotes(v: string): string {\n const t = v.trim();\n if (t.length >= 2 && t.startsWith('\"') && t.endsWith('\"')) return t.slice(1, -1);\n return t;\n}\n\nfunction splitTopLevelCommas(inside: string): string[] {\n const parts: string[] = [];\n let cur = \"\";\n let inQuote = false;\n for (const ch of inside) {\n if (ch === '\"') inQuote = !inQuote;\n if (ch === \",\" && !inQuote) {\n parts.push(cur);\n cur = \"\";\n } else {\n cur += ch;\n }\n }\n if (cur.trim()) parts.push(cur);\n return parts;\n}\n\nfunction parseProps(inside: string): Record<string, string> {\n const out: Record<string, string> = {};\n for (const p of splitTopLevelCommas(inside)) {\n const s = p.trim();\n if (!s) continue;\n const colon = s.indexOf(\":\");\n if (colon < 0) {\n // bare flag like [open]\n out[s.toLowerCase()] = \"true\";\n continue;\n }\n const k = s.slice(0, colon).trim().toLowerCase();\n const v = s.slice(colon + 1).trim();\n out[k] = stripQuotes(v);\n }\n return out;\n}\n\ninterface RawLine {\n indent: number;\n text: string;\n line: number;\n}\n\nfunction tokenizeLines(text: string): RawLine[] {\n const result: RawLine[] = [];\n const split = text.split(\"\\n\");\n for (let i = 0; i < split.length; i++) {\n const raw = split[i] ?? \"\";\n const stripped = stripComment(raw.replace(/\\r$/, \"\"));\n if (!stripped.trim()) continue;\n const match = stripped.match(/^(\\s*)(.*)$/);\n if (!match) continue;\n const indent = match[1].replace(/\\t/g, \" \").length;\n result.push({ indent, text: match[2].trim(), line: i + 1 });\n }\n return result;\n}\n\nfunction parseNodeLine(line: string): {\n kind: OrgchartNodeKind;\n id: string;\n fields: string[];\n props: Record<string, string>;\n} | null {\n // Optional leading kind keyword\n let kind: OrgchartNodeKind = \"person\";\n let rest = line;\n const firstSp = line.indexOf(\" \");\n if (firstSp > 0) {\n const first = line.slice(0, firstSp).toLowerCase();\n if (NODE_KIND_KEYWORDS.has(first)) {\n if (first === \"role\" || first === \"open\") kind = \"role\";\n else if (first === \"draft\" || first === \"tbh\") kind = \"draft\";\n else if (first === \"advisor\" || first === \"external\") kind = \"advisor\";\n else kind = \"person\";\n rest = line.slice(firstSp + 1).trim();\n }\n }\n\n // <id> : \"<name>\" | <title> | <department> [props]\n const colonIdx = rest.indexOf(\":\");\n if (colonIdx < 0) return null;\n const id = rest.slice(0, colonIdx).trim();\n if (!/^[A-Za-z][A-Za-z0-9_-]*$/.test(id)) return null;\n\n let tail = rest.slice(colonIdx + 1).trim();\n // Extract [props]\n let props: Record<string, string> = {};\n const propsMatch = tail.match(/\\[([^\\]]*)\\]\\s*$/);\n if (propsMatch) {\n props = parseProps(propsMatch[1]);\n tail = tail.slice(0, tail.length - propsMatch[0].length).trim();\n }\n\n // Split by pipe at top level (respecting quotes)\n const fields: string[] = [];\n let cur = \"\";\n let inQuote = false;\n for (const ch of tail) {\n if (ch === '\"') inQuote = !inQuote;\n if (ch === \"|\" && !inQuote) {\n fields.push(cur.trim());\n cur = \"\";\n } else {\n cur += ch;\n }\n }\n if (cur.trim()) fields.push(cur.trim());\n // name field may be quoted\n if (fields.length > 0) fields[0] = stripQuotes(fields[0]);\n return { kind, id, fields, props };\n}\n\nfunction resolveRole(raw: string | undefined): OrgchartRoleIcon | undefined {\n if (!raw) return undefined;\n const key = raw.trim().toLowerCase();\n return ROLE_ICONS[key];\n}\n\nconst EDGE_OPS: Array<{ token: string; kind: \"report\" | \"matrix\" }> = [\n { token: \"-.->\", kind: \"matrix\" },\n { token: \"->\", kind: \"report\" },\n];\n\nfunction findEdgeToken(line: string, token: string): number {\n let inQuote = false;\n for (let i = 0; i < line.length; i++) {\n const ch = line[i];\n if (ch === '\"') inQuote = !inQuote;\n if (!inQuote && line.startsWith(token, i)) return i;\n }\n return -1;\n}\n\nexport function parseOrgchart(text: string): OrgchartAST {\n const rawLines = tokenizeLines(text);\n\n let title: string | undefined;\n let direction: OrgchartDirection = \"TD\";\n let layout: OrgchartLayoutMode = \"tree\";\n const nodes: OrgchartNode[] = [];\n const nodeMap = new Map<string, OrgchartNode>();\n const edges: OrgchartEdge[] = [];\n\n // Indent stack for hierarchical parent resolution\n const indentStack: Array<{ indent: number; id: string }> = [];\n\n // Recoverable-input notes — the parser degrades rather than throwing.\n const unparseableLines: { line?: number; text: string }[] = [];\n const duplicateIds: string[] = [];\n const impliedNodes: string[] = [];\n\n for (const rl of rawLines) {\n const line = rl.text;\n\n // Header\n if (/^orgchart\\b/i.test(line)) {\n const t = matchQuotedTitle(line);\n if (t !== undefined) title = t;\n continue;\n }\n\n // Config\n if (/^config\\b/i.test(line)) {\n const m = line.match(/^config\\s*:\\s*(\\w+)\\s*=\\s*\"?([^\"\\n]+?)\"?\\s*$/i);\n if (m) {\n const key = m[1].toLowerCase();\n const val = m[2].trim();\n if (key === \"direction\") {\n direction = val.toUpperCase() === \"LR\" ? \"LR\" : \"TD\";\n } else if (key === \"layout\") {\n const v = val.toLowerCase();\n if (v === \"list\" || v === \"directory\" || v === \"compact\") layout = \"list\";\n else layout = \"tree\";\n }\n }\n continue;\n }\n\n // Edge detection (explicit)\n let edgeHandled = false;\n for (const { token, kind } of EDGE_OPS) {\n const idx = findEdgeToken(line, token);\n if (idx < 0) continue;\n const left = line.slice(0, idx).trim();\n let rest = line.slice(idx + token.length).trim();\n if (!/^[A-Za-z][A-Za-z0-9_-]*$/.test(left)) break;\n let props: Record<string, string> = {};\n const propsMatch = rest.match(/\\[([^\\]]*)\\]\\s*$/);\n if (propsMatch) {\n props = parseProps(propsMatch[1]);\n rest = rest.slice(0, rest.length - propsMatch[0].length).trim();\n }\n const to = rest.split(/\\s+/)[0];\n if (!/^[A-Za-z][A-Za-z0-9_-]*$/.test(to)) break;\n const edge: OrgchartEdge = { from: left, to, kind };\n if (props.label) edge.label = props.label;\n edges.push(edge);\n edgeHandled = true;\n break;\n }\n if (edgeHandled) continue;\n\n // Node line\n const parsed = parseNodeLine(line);\n if (!parsed) {\n // Skip-and-warn rather than blanking the whole chart on one bad line.\n unparseableLines.push({ line: rl.line, text: line });\n continue;\n }\n if (nodeMap.has(parsed.id)) {\n // Keep the first declaration; drop the redeclaration with a warning.\n duplicateIds.push(parsed.id);\n continue;\n }\n\n const node: OrgchartNode = {\n id: parsed.id,\n name: parsed.fields[0] ?? parsed.id,\n title: parsed.fields[1] || undefined,\n department: parsed.fields[2] || undefined,\n info: parsed.fields[3] || undefined,\n kind: parsed.kind,\n matrix: [],\n };\n\n const p = parsed.props;\n if (p.role) node.role = resolveRole(p.role);\n if (p.icon) node.role = resolveRole(p.icon) ?? node.role;\n if (p.open === \"true\") {\n node.open = true;\n node.kind = \"role\";\n }\n if (p.draft === \"true\" || p.tbh === \"true\") {\n node.draft = true;\n node.kind = \"draft\";\n }\n if (p.external === \"true\") {\n node.external = true;\n if (node.kind === \"person\") node.kind = \"advisor\";\n }\n if (p[\"assistant-of\"]) node.assistantOf = p[\"assistant-of\"];\n if (p.reports) node.parent = p.reports;\n if (p.matrix) {\n node.matrix = p.matrix.split(/[\\s,]+/).filter(Boolean);\n }\n if (p.department) node.department = p.department;\n if (p[\"avatar-color\"] || p.avatarcolor) {\n node.avatarColor = p[\"avatar-color\"] ?? p.avatarcolor;\n }\n if (p.gender) {\n const g = p.gender.toLowerCase();\n if (g === \"male\" || g === \"m\") node.gender = \"male\";\n else if (g === \"female\" || g === \"f\") node.gender = \"female\";\n }\n // info line: note / email / phone / location (first one wins if multiple)\n if (!node.info) {\n node.info = p.note ?? p.email ?? p.phone ?? p.location ?? undefined;\n }\n if (p.status) {\n const s = p.status.toLowerCase();\n if (s === \"new\" || s === \"leaving\" || s === \"on-leave\") node.status = s;\n }\n if (node.kind === \"role\" && node.open === undefined && !p.draft) node.open = true;\n if (node.kind === \"role\" && !node.role) node.role = \"Vacant\";\n\n // Resolve parent via indent stack (only if not explicitly set)\n while (indentStack.length > 0 && indentStack[indentStack.length - 1].indent >= rl.indent) {\n indentStack.pop();\n }\n if (!node.parent && indentStack.length > 0) {\n node.parent = indentStack[indentStack.length - 1].id;\n }\n indentStack.push({ indent: rl.indent, id: node.id });\n\n // Attach matrix edges\n for (const m of node.matrix) {\n edges.push({ from: m, to: node.id, kind: \"matrix\" });\n }\n\n nodes.push(node);\n nodeMap.set(node.id, node);\n }\n\n // Add implicit report edges from parent relationships (hierarchical)\n for (const n of nodes) {\n if (n.parent && !n.assistantOf) {\n // Skip if an explicit report edge already exists\n const exists = edges.some(\n (e) => e.kind === \"report\" && e.from === n.parent && e.to === n.id\n );\n if (!exists) edges.push({ from: n.parent, to: n.id, kind: \"report\" });\n }\n }\n\n // Synthesize nodes for ids referenced only by edges. This lets an edge-only\n // chart (`CEO -> CTO`, Mermaid-style shorthand) render instead of throwing —\n // the layout builds the hierarchy from report edges, so the implied nodes\n // slot straight in. Recorded as a warning so the author can declare them.\n const ensureNode = (id: string): void => {\n if (nodeMap.has(id)) return;\n const node: OrgchartNode = { id, name: id, kind: \"person\", matrix: [] };\n nodes.push(node);\n nodeMap.set(id, node);\n impliedNodes.push(id);\n };\n for (const e of edges) {\n ensureNode(e.from);\n ensureNode(e.to);\n }\n\n if (nodes.length === 0) {\n // Nothing renderable at all (empty / header-only / all-unparseable).\n throw new OrgchartParseError(\n unparseableLines.length > 0\n ? `Orgchart has no parseable nodes (${unparseableLines.length} line(s) could not be read)`\n : \"Orgchart has no nodes\"\n );\n }\n\n const ast: OrgchartAST = {\n type: \"orgchart\",\n title,\n direction,\n layout,\n nodes,\n edges,\n };\n if (unparseableLines.length || duplicateIds.length || impliedNodes.length) {\n ast.recovered = {\n ...(unparseableLines.length ? { unparseableLines } : {}),\n ...(duplicateIds.length ? { duplicateIds } : {}),\n ...(impliedNodes.length ? { impliedNodes } : {}),\n };\n }\n return ast;\n}\n","import type { SchematexDiagnostic } from \"../../core/diagnostics\";\nimport type { OrgchartAST } from \"./types\";\nimport { parseOrgchart } from \"./parser\";\n\n/**\n * Orgchart recoverable-input lint.\n *\n * The parser degrades instead of throwing: unparseable lines are skipped,\n * duplicate ids dropped, and ids referenced only by edges are synthesized into\n * nodes. Each recovery is surfaced here as a warning so the render reports\n * `partial` and the author learns what was repaired — without ever blanking a\n * chart that has at least one node.\n */\nexport function lintOrgchart(text: string): SchematexDiagnostic[] {\n let ast: OrgchartAST;\n try {\n ast = parseOrgchart(text);\n } catch {\n return [];\n }\n const out: SchematexDiagnostic[] = [];\n const rec = ast.recovered;\n if (!rec) return out;\n\n for (const { line, text: src } of rec.unparseableLines ?? []) {\n out.push({\n severity: \"warning\",\n code: \"ORGCHART_UNPARSEABLE_LINE\",\n message: `skipped a line that is neither a node nor an edge: \"${src}\"`,\n line,\n source: src,\n hint: 'A node is `id : \"Name\" | Title | Dept`; an edge is `parent -> child`. Check for a missing colon or a stray line.',\n fatal: false,\n });\n }\n\n if (rec.duplicateIds?.length) {\n out.push({\n severity: \"warning\",\n code: \"ORGCHART_DUPLICATE_ID\",\n message: `kept the first declaration of duplicate node id(s): ${rec.duplicateIds\n .map((id) => `\"${id}\"`)\n .join(\", \")}`,\n hint: \"Give each person/role a unique id; later redeclarations are dropped.\",\n fatal: false,\n });\n }\n\n if (rec.impliedNodes?.length) {\n out.push({\n severity: \"warning\",\n code: \"ORGCHART_IMPLIED_NODE\",\n message: `created node(s) from edges that were never declared: ${rec.impliedNodes\n .map((id) => `\"${id}\"`)\n .join(\", \")}`,\n hint: 'Declare each person/role explicitly (`id : \"Name\"`) so labels and roles render; bare ids fall back to the id as the name.',\n fatal: false,\n });\n }\n\n return out;\n}\n","import type {\n OrgchartAST,\n OrgchartLayoutEdge,\n OrgchartLayoutNode,\n OrgchartLayoutResult,\n OrgchartNode,\n} from \"./types\";\n\nconst CARD_W = 240;\nconst CARD_H = 76;\nconst TIER_GAP = 44;\nconst SIB_GAP = 20;\nconst PADDING = 30;\nconst ASSISTANT_GAP = 32;\n\n\ninterface TreeNode {\n id: string;\n children: TreeNode[];\n assistants: TreeNode[];\n node: OrgchartNode;\n subtreeWidth: number;\n x: number;\n y: number;\n}\n\nfunction hashString(s: string): number {\n let h = 0;\n for (let i = 0; i < s.length; i++) {\n h = (h * 31 + s.charCodeAt(i)) | 0;\n }\n return Math.abs(h);\n}\n\nfunction hexToRgb(hex: string): { r: number; g: number; b: number } {\n const h = hex.replace(\"#\", \"\").padEnd(6, \"0\");\n return {\n r: parseInt(h.slice(0, 2), 16),\n g: parseInt(h.slice(2, 4), 16),\n b: parseInt(h.slice(4, 6), 16),\n };\n}\n\nfunction rgbToHex(r: number, g: number, b: number): string {\n const c = (v: number) =>\n Math.max(0, Math.min(255, Math.round(v)))\n .toString(16)\n .padStart(2, \"0\");\n return `#${c(r)}${c(g)}${c(b)}`;\n}\n\n/** Light tint: mix base color with white at given weight (0 = white, 1 = base). */\nfunction tint(hex: string, weight: number): string {\n const { r, g, b } = hexToRgb(hex);\n return rgbToHex(255 + (r - 255) * weight, 255 + (g - 255) * weight, 255 + (b - 255) * weight);\n}\n\n/** Darker shade: mix base with black at given weight (0 = base, 1 = black). */\nfunction shade(hex: string, weight: number): string {\n const { r, g, b } = hexToRgb(hex);\n return rgbToHex(r * (1 - weight), g * (1 - weight), b * (1 - weight));\n}\n\nfunction computeInitials(name: string): string {\n const trimmed = name.trim();\n if (!trimmed) return \"?\";\n // eslint-disable-next-line no-control-regex\n if (/[^\\x00-\\x7F]/.test(trimmed[0])) {\n return Array.from(trimmed)[0];\n }\n const parts = trimmed.split(/\\s+/);\n if (parts.length === 1) return parts[0].slice(0, 2).toUpperCase();\n return (parts[0][0] + parts[parts.length - 1][0]).toUpperCase();\n}\n\nexport function layoutOrgchart(\n ast: OrgchartAST,\n palette: readonly string[]\n): OrgchartLayoutResult {\n // If any node has info, expand card height to fit 3 text lines\n const hasInfo = ast.nodes.some((n) => !!n.info);\n const cW = CARD_W;\n const cH = hasInfo ? 92 : CARD_H;\n const tierGap = TIER_GAP;\n const sibGap = SIB_GAP;\n\n const nodeById = new Map<string, OrgchartNode>();\n for (const n of ast.nodes) nodeById.set(n.id, n);\n\n const childrenMap = new Map<string, string[]>();\n const parentMap = new Map<string, string>();\n for (const n of ast.nodes) childrenMap.set(n.id, []);\n for (const e of ast.edges) {\n if (e.kind !== \"report\") continue;\n childrenMap.get(e.from)?.push(e.to);\n parentMap.set(e.to, e.from);\n }\n\n const roots: OrgchartNode[] = [];\n for (const n of ast.nodes) {\n if (!parentMap.has(n.id) && !n.assistantOf) roots.push(n);\n }\n\n const treeById = new Map<string, TreeNode>();\n for (const n of ast.nodes) {\n treeById.set(n.id, {\n id: n.id,\n node: n,\n children: [],\n assistants: [],\n subtreeWidth: 0,\n x: 0,\n y: 0,\n });\n }\n\n for (const n of ast.nodes) {\n const t = treeById.get(n.id)!;\n for (const cid of childrenMap.get(n.id) ?? []) {\n const c = nodeById.get(cid)!;\n if (c.assistantOf === n.id) continue;\n t.children.push(treeById.get(cid)!);\n }\n }\n for (const n of ast.nodes) {\n if (n.assistantOf) {\n const parent = treeById.get(n.assistantOf);\n if (parent) parent.assistants.push(treeById.get(n.id)!);\n }\n }\n\n function computeWidth(t: TreeNode): number {\n if (t.children.length === 0) {\n t.subtreeWidth = cW;\n return t.subtreeWidth;\n }\n let sum = 0;\n for (let i = 0; i < t.children.length; i++) {\n sum += computeWidth(t.children[i]);\n if (i < t.children.length - 1) sum += sibGap;\n }\n t.subtreeWidth = Math.max(cW, sum);\n return t.subtreeWidth;\n }\n\n function assign(t: TreeNode, leftX: number, depth: number): void {\n const cx = leftX + t.subtreeWidth / 2;\n t.x = cx;\n t.y = PADDING + depth * (cH + tierGap);\n if (t.children.length > 0) {\n const childBlock = t.children.reduce(\n (s, c, i) => s + c.subtreeWidth + (i > 0 ? sibGap : 0),\n 0\n );\n let childLeft = cx - childBlock / 2;\n for (const c of t.children) {\n assign(c, childLeft, depth + 1);\n childLeft += c.subtreeWidth + sibGap;\n }\n }\n }\n\n let curLeft = PADDING;\n for (const r of roots) {\n const rt = treeById.get(r.id)!;\n computeWidth(rt);\n assign(rt, curLeft, 0);\n curLeft += rt.subtreeWidth + sibGap * 2;\n }\n\n for (const [, t] of treeById) {\n for (let i = 0; i < t.assistants.length; i++) {\n const a = t.assistants[i];\n a.x = t.x + cW + ASSISTANT_GAP + i * (cW + sibGap);\n a.y = t.y + cH * 0.3;\n }\n }\n\n // Department color index\n const deptIndex = new Map<string, number>();\n for (const n of ast.nodes) {\n if (n.department && !deptIndex.has(n.department)) {\n deptIndex.set(n.department, deptIndex.size);\n }\n }\n\n const nodes: OrgchartLayoutNode[] = [];\n for (const n of ast.nodes) {\n const t = treeById.get(n.id)!;\n const deptColor = n.department\n ? palette[(deptIndex.get(n.department) ?? 0) % palette.length]\n : undefined;\n const base =\n n.avatarColor ??\n deptColor ??\n palette[hashString(n.name) % palette.length];\n const avatarBg = tint(base, 0.14);\n const avatarFg = shade(base, 0.4);\n nodes.push({\n node: n,\n x: t.x,\n y: t.y,\n width: cW,\n height: cH,\n deptColor,\n avatarBg,\n avatarFg,\n initials: computeInitials(n.name),\n });\n }\n\n // Shift all nodes so the leftmost sits at PADDING\n let minX = Infinity;\n for (const n of nodes) minX = Math.min(minX, n.x - n.width / 2);\n const shift = PADDING - minX;\n if (Math.abs(shift) > 0.5) {\n for (const n of nodes) n.x += shift;\n }\n\n const nodeLayoutById = new Map<string, OrgchartLayoutNode>();\n for (const n of nodes) nodeLayoutById.set(n.node.id, n);\n\n const layoutEdges: OrgchartLayoutEdge[] = [];\n for (const e of ast.edges) {\n const from = nodeLayoutById.get(e.from);\n const to = nodeLayoutById.get(e.to);\n if (!from || !to) continue;\n if (e.kind === \"report\") {\n if (to.node.assistantOf === from.node.id) {\n const sx = from.x + from.width / 2;\n const sy = from.y + from.height / 2;\n const ex = to.x - to.width / 2;\n const ey = to.y + to.height / 2;\n layoutEdges.push({ edge: e, path: `M ${sx} ${sy} L ${ex} ${ey}` });\n continue;\n }\n const sx = from.x;\n const sy = from.y + from.height;\n const ex = to.x;\n const ey = to.y;\n const midY = (sy + ey) / 2;\n const path =\n Math.abs(sx - ex) < 0.5\n ? `M ${sx} ${sy} L ${ex} ${ey}`\n : `M ${sx} ${sy} L ${sx} ${midY} L ${ex} ${midY} L ${ex} ${ey}`;\n layoutEdges.push({ edge: e, path });\n } else {\n const sx = from.x;\n const sy = from.y + from.height / 2;\n const ex = to.x;\n const ey = to.y + to.height / 2;\n const midY = (sy + ey) / 2;\n const path = `M ${sx} ${sy} C ${sx} ${midY}, ${ex} ${midY}, ${ex} ${ey}`;\n const entry: OrgchartLayoutEdge = { edge: e, path };\n if (e.label) {\n entry.labelX = (sx + ex) / 2;\n entry.labelY = midY;\n }\n layoutEdges.push(entry);\n }\n }\n\n let maxX = 0;\n let maxY = 0;\n for (const n of nodes) {\n maxX = Math.max(maxX, n.x + n.width / 2);\n maxY = Math.max(maxY, n.y + n.height);\n }\n\n const width = Math.max(400, maxX + PADDING);\n const height = Math.max(200, maxY + PADDING);\n\n return {\n width,\n height,\n nodes,\n edges: layoutEdges,\n title: ast.title,\n mode: \"tree\",\n };\n}\n\n// ──────────────────────────────────────────────────────────────────────────────\n// List / directory layout\n// ──────────────────────────────────────────────────────────────────────────────\n\nconst LIST_ROW_H = 32;\nconst LIST_INDENT = 22;\nconst LIST_PAD = 20;\nconst LIST_PANEL_W = 820;\nconst LIST_GUIDE_X0 = 32; // x of root caret\n\nexport function layoutOrgchartList(\n ast: OrgchartAST,\n palette: readonly string[]\n): OrgchartLayoutResult {\n const nodeById = new Map<string, OrgchartNode>();\n for (const n of ast.nodes) nodeById.set(n.id, n);\n\n const childrenMap = new Map<string, string[]>();\n const parentMap = new Map<string, string>();\n for (const n of ast.nodes) childrenMap.set(n.id, []);\n for (const e of ast.edges) {\n if (e.kind !== \"report\") continue;\n childrenMap.get(e.from)?.push(e.to);\n parentMap.set(e.to, e.from);\n }\n\n const roots: OrgchartNode[] = [];\n for (const n of ast.nodes) {\n if (!parentMap.has(n.id) && !n.assistantOf) roots.push(n);\n }\n\n // Subtree size (descendants count, excluding self)\n const subtreeSize = new Map<string, number>();\n function computeSize(id: string): number {\n const cached = subtreeSize.get(id);\n if (cached !== undefined) return cached;\n const kids = childrenMap.get(id) ?? [];\n let s = kids.length;\n for (const k of kids) s += computeSize(k);\n subtreeSize.set(id, s);\n return s;\n }\n for (const n of ast.nodes) computeSize(n.id);\n\n // Department color index\n const deptIndex = new Map<string, number>();\n for (const n of ast.nodes) {\n if (n.department && !deptIndex.has(n.department)) {\n deptIndex.set(n.department, deptIndex.size);\n }\n }\n\n const nodes: OrgchartLayoutNode[] = [];\n const guides: string[] = [];\n let rowIdx = 0;\n\n function visit(id: string, depth: number): void {\n const n = nodeById.get(id);\n if (!n) return;\n const y = LIST_PAD + rowIdx * LIST_ROW_H;\n const x = LIST_GUIDE_X0 + depth * LIST_INDENT;\n const deptColor = n.department\n ? palette[(deptIndex.get(n.department) ?? 0) % palette.length]\n : undefined;\n const base =\n n.avatarColor ??\n deptColor ??\n palette[hashString(n.name) % palette.length];\n const kids = childrenMap.get(id) ?? [];\n const hasKids = kids.length > 0;\n nodes.push({\n node: n,\n x,\n y,\n width: LIST_PANEL_W - x - LIST_PAD,\n height: LIST_ROW_H,\n deptColor,\n avatarBg: tint(base, 0.14),\n avatarFg: shade(base, 0.4),\n initials: computeInitials(n.name),\n depth,\n subtreeSize: subtreeSize.get(id) ?? 0,\n hasChildren: hasKids,\n });\n rowIdx++;\n for (const c of kids) visit(c, depth + 1);\n }\n\n for (const r of roots) visit(r.id, 0);\n\n // Guide lines: for each parent with children, draw a vertical trunk from its row\n // center down to the last child's row center, plus a short horizontal tick into each child.\n for (let i = 0; i < nodes.length; i++) {\n const p = nodes[i];\n if (!p.hasChildren) continue;\n const pxLine = p.x + 10; // beneath the caret\n const pyStart = p.y + LIST_ROW_H / 2 + 6;\n // Find last descendant child (direct) row y\n const directChildren: OrgchartLayoutNode[] = [];\n for (let j = i + 1; j < nodes.length; j++) {\n const q = nodes[j];\n if ((q.depth ?? 0) <= (p.depth ?? 0)) break;\n if ((q.depth ?? 0) === (p.depth ?? 0) + 1) directChildren.push(q);\n }\n if (directChildren.length === 0) continue;\n const lastChild = directChildren[directChildren.length - 1];\n const pyEnd = lastChild.y + LIST_ROW_H / 2;\n guides.push(`M ${pxLine} ${pyStart} L ${pxLine} ${pyEnd}`);\n for (const c of directChildren) {\n const tickY = c.y + LIST_ROW_H / 2;\n guides.push(`M ${pxLine} ${tickY} L ${c.x - 2} ${tickY}`);\n }\n }\n\n const height = LIST_PAD * 2 + rowIdx * LIST_ROW_H;\n return {\n width: LIST_PANEL_W,\n height,\n nodes,\n edges: [],\n title: ast.title,\n mode: \"list\",\n guides,\n };\n}\n","import type { RenderConfig } from \"../../core/types\";\nimport {\n svgRoot,\n group,\n el,\n path as pathEl,\n text as textEl,\n title as titleEl,\n desc,\n rect,\n circle,\n escapeXml,\n} from \"../../core/svg\";\nimport { resolveBaseTheme, type BaseTheme } from \"../../core/theme\";\nimport { layoutOrgchart, layoutOrgchartList } from \"./layout\";\nimport type { OrgchartAST, OrgchartLayoutNode, OrgchartRoleIcon } from \"./types\";\n\nfunction buildCss(t: BaseTheme): string {\n return `\n.lt-org { font-family: system-ui, -apple-system, sans-serif; }\n.lt-org-title { font: 500 16px sans-serif; fill: ${t.text}; }\n.lt-org-card { fill: ${t.bg}; stroke: ${t.neutral}; stroke-width: 1; }\n.lt-org-card-vacant { fill: ${t.bg}; stroke: ${t.warn}; stroke-width: 1; stroke-dasharray: 4,3; }\n.lt-org-card-draft { fill: ${t.bg}; stroke: ${t.neutral}; stroke-width: 1; stroke-dasharray: 4,3; opacity: 0.7; }\n.lt-org-card-external { fill: ${t.bg}; stroke: ${t.neutral}; stroke-width: 1; stroke-dasharray: 4,3; }\n.lt-org-name { font: 500 14px sans-serif; fill: ${t.text}; }\n.lt-org-title-text { font: 400 12px sans-serif; fill: ${t.textMuted}; }\n.lt-org-info { font: 400 11px sans-serif; fill: ${t.textMuted}; }\n.lt-org-dept { font: 500 10px sans-serif; }\n.lt-org-avatar-text { font: 600 13px sans-serif; text-anchor: middle; }\n.lt-org-edge { stroke: ${t.stroke}; stroke-width: 1.4; fill: none; }\n.lt-org-edge-matrix { stroke: ${t.neutral}; stroke-width: 1.2; stroke-dasharray: 4,3; fill: none; }\n.lt-org-edge-label-bg { fill: ${t.bg}; stroke: ${t.neutral}; stroke-width: 1; }\n.lt-org-edge-label { font: 500 10px sans-serif; fill: ${t.textMuted}; text-anchor: middle; }\n.lt-org-pill-bg { fill: ${t.bg}; stroke-width: 1; }\n.lt-org-pill { font: 600 9px sans-serif; text-anchor: middle; letter-spacing: 0.4px; }\n.lt-org-panel { fill: ${t.bg}; stroke: ${t.neutral}; stroke-width: 1; }\n.lt-org-guide { stroke: ${t.neutral}; stroke-width: 1; fill: none; }\n.lt-org-caret { font: 400 9px sans-serif; fill: ${t.textMuted}; }\n.lt-org-row-name { font: 500 13px sans-serif; fill: ${t.text}; }\n.lt-org-row-title { font: 400 12px sans-serif; fill: ${t.textMuted}; }\n.lt-org-row-avatar-text { font: 600 10px sans-serif; text-anchor: middle; }\n.lt-org-row-count { font: 400 11px sans-serif; fill: ${t.textMuted}; text-anchor: end; }\n.lt-org-row-dept { font: 500 10px sans-serif; text-anchor: middle; }\n`.trim();\n}\n\n/** Gender silhouette (head + body) centered at (0,0), ~18px tall. */\nfunction renderGenderGlyph(gender: \"male\" | \"female\", fg: string): string {\n const f = `fill=\"${fg}\"`;\n if (gender === \"male\") {\n // head + broad rectangular shoulders\n return `<circle cx=\"0\" cy=\"-7\" r=\"5.5\" ${f}/><path d=\"M -9 11 C -9 2 -5 0 0 0 C 5 0 9 2 9 11 Z\" ${f}/>`;\n }\n // female: head + tapered dress silhouette\n return `<circle cx=\"0\" cy=\"-7\" r=\"5.5\" ${f}/><path d=\"M -5 0 C -10 5 -11 10 -10 11 L 10 11 C 11 10 10 5 5 0 Z\" ${f}/>`;\n}\n\n/** Simple SVG role-icon glyph in `fg` foreground color on a tinted circle. */\nfunction renderRoleGlyph(role: OrgchartRoleIcon, fg: string): string {\n // Approx 20x20 icon centered at (0,0)\n const stroke = `stroke=\"${fg}\" stroke-width=\"1.6\" fill=\"none\" stroke-linecap=\"round\" stroke-linejoin=\"round\"`;\n const fillWhite = `fill=\"${fg}\"`;\n switch (role) {\n case \"CEO\":\n case \"VP\":\n // Crown\n return `<path d=\"M -10 4 L -10 -6 L -4 0 L 0 -8 L 4 0 L 10 -6 L 10 4 Z\" ${fillWhite} stroke=\"none\"/>`;\n case \"CTO\":\n case \"Engineer\":\n // Gear (simplified 8-tooth)\n return `<circle r=\"6\" ${stroke}/><circle r=\"2\" ${fillWhite} stroke=\"none\"/><g ${stroke}><line x1=\"0\" y1=\"-9\" x2=\"0\" y2=\"-7\"/><line x1=\"0\" y1=\"9\" x2=\"0\" y2=\"7\"/><line x1=\"-9\" y1=\"0\" x2=\"-7\" y2=\"0\"/><line x1=\"9\" y1=\"0\" x2=\"7\" y2=\"0\"/><line x1=\"-6.4\" y1=\"-6.4\" x2=\"-5\" y2=\"-5\"/><line x1=\"6.4\" y1=\"-6.4\" x2=\"5\" y2=\"-5\"/><line x1=\"-6.4\" y1=\"6.4\" x2=\"-5\" y2=\"5\"/><line x1=\"6.4\" y1=\"6.4\" x2=\"5\" y2=\"5\"/></g>`;\n case \"CFO\":\n // Dollar\n return `<text x=\"0\" y=\"6\" text-anchor=\"middle\" font-size=\"18\" font-weight=\"700\" fill=\"${fg}\">$</text>`;\n case \"COO\":\n case \"Ops\":\n // Triple gear dots\n return `<g ${fillWhite}><circle cx=\"-6\" cy=\"0\" r=\"3\" stroke=\"none\"/><circle cx=\"6\" cy=\"0\" r=\"3\" stroke=\"none\"/><circle cx=\"0\" cy=\"-5\" r=\"3\" stroke=\"none\"/></g>`;\n case \"CMO\":\n case \"Marketing\":\n // Megaphone (simplified)\n return `<path d=\"M -8 -4 L 2 -7 L 2 7 L -8 4 Z\" ${fillWhite} stroke=\"none\"/><path d=\"M 2 -4 L 8 -6 L 8 6 L 2 4 Z\" ${fillWhite} stroke=\"none\"/>`;\n case \"CPO\":\n case \"Product\":\n // Lightbulb\n return `<path d=\"M 0 -8 C 5 -8 7 -4 7 0 C 7 3 4 4 4 6 L -4 6 C -4 4 -7 3 -7 0 C -7 -4 -5 -8 0 -8 Z\" ${fillWhite} stroke=\"none\"/><line x1=\"-3\" y1=\"9\" x2=\"3\" y2=\"9\" stroke=\"${fg}\" stroke-width=\"1.5\"/>`;\n case \"Designer\":\n // Paint brush\n return `<path d=\"M -7 7 L 7 -7 L 9 -5 L -5 9 Z\" ${fillWhite} stroke=\"none\"/>`;\n case \"Sales\":\n // Briefcase\n return `<rect x=\"-8\" y=\"-4\" width=\"16\" height=\"10\" rx=\"1\" ${fillWhite} stroke=\"none\"/><rect x=\"-4\" y=\"-7\" width=\"8\" height=\"4\" ${stroke}/>`;\n case \"HR\":\n // Person group\n return `<circle cx=\"-3\" cy=\"-4\" r=\"3\" ${fillWhite} stroke=\"none\"/><circle cx=\"4\" cy=\"-3\" r=\"2.5\" ${fillWhite} stroke=\"none\"/><path d=\"M -8 7 C -8 2 -2 2 -2 2 C -2 2 2 2 2 7 Z\" ${fillWhite} stroke=\"none\"/><path d=\"M 0 7 C 0 4 4 4 4 4 C 4 4 9 4 9 7 Z\" ${fillWhite} stroke=\"none\"/>`;\n case \"Legal\":\n // Balance / scale\n return `<line x1=\"0\" y1=\"-8\" x2=\"0\" y2=\"8\" stroke=\"${fg}\" stroke-width=\"1.6\"/><line x1=\"-7\" y1=\"-6\" x2=\"7\" y2=\"-6\" stroke=\"${fg}\" stroke-width=\"1.6\"/><path d=\"M -9 0 L -5 -6 L -1 0 Z\" ${fillWhite} stroke=\"none\"/><path d=\"M 1 0 L 5 -6 L 9 0 Z\" ${fillWhite} stroke=\"none\"/>`;\n case \"Data\":\n // Bar chart\n return `<g ${fillWhite}><rect x=\"-8\" y=\"0\" width=\"4\" height=\"7\" stroke=\"none\"/><rect x=\"-2\" y=\"-4\" width=\"4\" height=\"11\" stroke=\"none\"/><rect x=\"4\" y=\"-7\" width=\"4\" height=\"14\" stroke=\"none\"/></g>`;\n case \"Advisor\":\n // Star\n return `<path d=\"M 0 -9 L 2.6 -2.7 L 9 -2 L 4 2.3 L 5.3 8.5 L 0 5 L -5.3 8.5 L -4 2.3 L -9 -2 L -2.6 -2.7 Z\" ${fillWhite} stroke=\"none\"/>`;\n case \"Intern\":\n // Graduation cap\n return `<path d=\"M -10 -2 L 0 -7 L 10 -2 L 0 3 Z\" ${fillWhite} stroke=\"none\"/><path d=\"M -5 0 L -5 5 C -5 7 5 7 5 5 L 5 0\" ${stroke}/>`;\n case \"Vacant\":\n return `<circle r=\"7\" stroke=\"${fg}\" stroke-width=\"1.4\" fill=\"none\" stroke-dasharray=\"3,2\"/><text x=\"0\" y=\"4\" text-anchor=\"middle\" font-size=\"12\" font-weight=\"700\" fill=\"${fg}\">?</text>`;\n default:\n return \"\";\n }\n}\n\nfunction renderAvatar(ln: OrgchartLayoutNode): string {\n const role = ln.node.role;\n const cx = -ln.width / 2 + 14 + 18;\n const cy = 0;\n const r = 18;\n const parts: string[] = [\n circle({ cx, cy, r, fill: ln.avatarBg, stroke: \"none\" }),\n ];\n if (role && role !== \"Vacant\") {\n parts.push(\n group({ transform: `translate(${cx}, ${cy})` }, [\n renderRoleGlyph(role, ln.avatarFg),\n ])\n );\n } else if (ln.node.open) {\n parts.push(\n group({ transform: `translate(${cx}, ${cy})` }, [\n renderRoleGlyph(\"Vacant\", ln.avatarFg),\n ])\n );\n } else if (ln.node.gender) {\n parts.push(\n group({ transform: `translate(${cx}, ${cy})` }, [\n renderGenderGlyph(ln.node.gender, ln.avatarFg),\n ])\n );\n } else {\n parts.push(\n textEl(\n { x: cx, y: cy + 5, class: \"lt-org-avatar-text\", fill: ln.avatarFg },\n ln.initials\n )\n );\n }\n return group({}, parts);\n}\n\nfunction renderCardBody(ln: OrgchartLayoutNode, t: BaseTheme): string {\n const n = ln.node;\n const x = -ln.width / 2;\n const y = -ln.height / 2;\n\n let cardClass = \"lt-org-card\";\n if (n.open) cardClass = \"lt-org-card-vacant\";\n else if (n.draft) cardClass = \"lt-org-card-draft\";\n else if (n.external) cardClass = \"lt-org-card-external\";\n\n const parts: string[] = [];\n parts.push(\n rect({\n x,\n y,\n width: ln.width,\n height: ln.height,\n rx: 10,\n ry: 10,\n class: cardClass,\n })\n );\n\n parts.push(renderAvatar(ln));\n\n // Text block to the right of avatar. Name + title only; department is conveyed by avatar color.\n const textX = x + 14 + 36 + 12;\n const hasTitle = !!n.title;\n\n const hasInfo = !!n.info;\n const displayName = n.open && !n.name ? \"Open Role\" : n.name;\n\n // Vertical layout: name → title → info, centered in card\n // Anchor row count determines nameY offset\n const lineCount = 1 + (hasTitle ? 1 : 0) + (hasInfo ? 1 : 0);\n const lineH = 16;\n const nameY = -(lineCount - 1) * lineH / 2;\n\n parts.push(textEl({ x: textX, y: nameY, class: \"lt-org-name\" }, displayName));\n if (hasTitle) {\n parts.push(textEl({ x: textX, y: nameY + lineH, class: \"lt-org-title-text\" }, n.title!));\n }\n if (hasInfo) {\n parts.push(\n textEl(\n { x: textX, y: nameY + lineH * (hasTitle ? 2 : 1), class: \"lt-org-info\" },\n n.info!\n )\n );\n }\n\n // Status / hiring pill (top-right corner)\n const pillLabel =\n n.open\n ? \"HIRING\"\n : n.status === \"new\"\n ? \"NEW\"\n : n.status === \"leaving\"\n ? \"LEAVING\"\n : n.status === \"on-leave\"\n ? \"ON LEAVE\"\n : undefined;\n if (pillLabel) {\n const pw = pillLabel.length * 5.8 + 10;\n const ph = 14;\n const px = ln.width / 2 - pw - 8;\n const py = y + 8;\n const pillFg =\n pillLabel === \"HIRING\"\n ? \"#8a6d00\"\n : pillLabel === \"NEW\"\n ? \"#2b6a3a\"\n : pillLabel === \"LEAVING\"\n ? \"#8a3b1a\"\n : t.textMuted;\n const pillBg =\n pillLabel === \"HIRING\"\n ? \"#fef3c7\"\n : pillLabel === \"NEW\"\n ? \"#dcfce7\"\n : pillLabel === \"LEAVING\"\n ? \"#fee4d8\"\n : \"#eeeeea\";\n parts.push(\n rect({ x: px, y: py, width: pw, height: ph, rx: 3, fill: pillBg, stroke: \"none\" })\n );\n parts.push(\n textEl(\n { x: px + pw / 2, y: py + ph - 4, class: \"lt-org-pill\", fill: pillFg },\n pillLabel\n )\n );\n }\n\n return group(\n {\n transform: `translate(${ln.x}, ${ln.y + ln.height / 2})`,\n \"data-person-id\": n.id,\n \"data-department\": n.department ?? \"\",\n \"data-role\": n.role ?? \"\",\n },\n parts\n );\n}\n\nfunction renderListRow(ln: OrgchartLayoutNode): string {\n const n = ln.node;\n const rowCenterY = ln.y + ln.height / 2;\n const caretX = ln.x;\n const avatarCx = ln.x + 20;\n const avatarR = 11;\n const parts: string[] = [];\n\n // Caret\n const caret = ln.hasChildren ? \"▼\" : \"·\";\n parts.push(\n textEl(\n { x: caretX, y: rowCenterY + 3, class: \"lt-org-caret\" },\n caret\n )\n );\n\n // Avatar\n parts.push(circle({ cx: avatarCx, cy: rowCenterY, r: avatarR, fill: ln.avatarBg, stroke: \"none\" }));\n if (n.role && n.role !== \"Vacant\") {\n parts.push(\n group({ transform: `translate(${avatarCx}, ${rowCenterY}) scale(0.58)` }, [\n renderRoleGlyph(n.role, ln.avatarFg),\n ])\n );\n } else if (n.open) {\n parts.push(\n group({ transform: `translate(${avatarCx}, ${rowCenterY}) scale(0.58)` }, [\n renderRoleGlyph(\"Vacant\", ln.avatarFg),\n ])\n );\n } else if (n.gender) {\n parts.push(\n group({ transform: `translate(${avatarCx}, ${rowCenterY}) scale(0.56)` }, [\n renderGenderGlyph(n.gender, ln.avatarFg),\n ])\n );\n } else {\n parts.push(\n textEl(\n {\n x: avatarCx,\n y: rowCenterY + 3,\n class: \"lt-org-row-avatar-text\",\n fill: ln.avatarFg,\n },\n ln.initials\n )\n );\n }\n\n // Name + title\n const textY = rowCenterY + 4;\n const nameX = avatarCx + avatarR + 10;\n const displayName = n.open && !n.name ? \"Open Role\" : n.name;\n parts.push(textEl({ x: nameX, y: textY, class: \"lt-org-row-name\" }, displayName));\n if (n.title) {\n const titleX = nameX + Math.max(80, displayName.length * 8 + 10);\n parts.push(textEl({ x: titleX, y: textY, class: \"lt-org-row-title\" }, n.title));\n }\n\n // Right side: dept pill + report count (only if root has many)\n const rightEdge = ln.x + ln.width;\n let cursor = rightEdge;\n if (ln.subtreeSize && ln.subtreeSize > 0) {\n const countLabel = ln.depth === 0 ? `${ln.subtreeSize} reports` : `${ln.subtreeSize}`;\n parts.push(\n textEl(\n { x: cursor, y: textY, class: \"lt-org-row-count\" },\n countLabel\n )\n );\n cursor -= Math.max(30, countLabel.length * 6.5) + 12;\n }\n if (n.department) {\n const pw = n.department.length * 5.6 + 14;\n const ph = 16;\n const px = cursor - pw;\n const py = rowCenterY - ph / 2;\n parts.push(\n rect({ x: px, y: py, width: pw, height: ph, rx: 3, fill: ln.avatarBg, stroke: \"none\" })\n );\n parts.push(\n textEl(\n {\n x: px + pw / 2,\n y: textY,\n class: \"lt-org-row-dept\",\n fill: ln.avatarFg,\n },\n n.department\n )\n );\n }\n\n return group({ \"data-person-id\": n.id }, parts);\n}\n\nfunction renderOrgchartList(\n ast: OrgchartAST,\n layout: ReturnType<typeof layoutOrgchartList>,\n t: BaseTheme\n): string {\n const titleOffset = ast.title ? 42 : 16;\n const width = Math.ceil(layout.width);\n const height = Math.ceil(layout.height + titleOffset);\n\n const children: string[] = [];\n children.push(titleEl(ast.title ?? \"Organizational Directory\"));\n children.push(\n desc(\n `Organizational directory with ${ast.nodes.length} people and ${ast.edges.length} reporting relationships`\n )\n );\n children.push(el(\"style\", {}, buildCss(t)));\n\n if (ast.title) {\n children.push(textEl({ x: 20, y: 24, class: \"lt-org-title\" }, ast.title));\n }\n\n const inner: string[] = [];\n\n // Guide lines\n for (const g of layout.guides ?? []) {\n inner.push(pathEl({ d: g, class: \"lt-org-guide\" }));\n }\n\n // Rows\n for (const ln of layout.nodes) {\n inner.push(renderListRow(ln));\n }\n\n children.push(group({ transform: `translate(0, ${titleOffset})` }, inner));\n\n return svgRoot(\n {\n class: \"lt-org\",\n role: \"img\",\n \"aria-label\": escapeXml(ast.title ?? \"Organizational directory\"),\n width,\n height,\n viewBox: `0 0 ${width} ${height}`,\n },\n children\n );\n}\n\nexport function renderOrgchart(ast: OrgchartAST, config?: RenderConfig): string {\n const t = resolveBaseTheme(config?.theme ?? \"default\");\n if (ast.layout === \"list\") {\n return renderOrgchartList(ast, layoutOrgchartList(ast, t.palette), t);\n }\n const layout = layoutOrgchart(ast, t.palette);\n const titleOffset = ast.title ? 36 : 10;\n const width = Math.ceil(layout.width);\n const height = Math.ceil(layout.height + titleOffset);\n\n const children: string[] = [];\n children.push(titleEl(ast.title ?? \"Organizational Chart\"));\n children.push(\n desc(\n `Organizational chart with ${ast.nodes.length} people and ${ast.edges.length} relationships`\n )\n );\n children.push(el(\"style\", {}, buildCss(t)));\n\n if (ast.title) {\n children.push(textEl({ x: 20, y: 24, class: \"lt-org-title\" }, ast.title));\n }\n\n const inner: string[] = [];\n\n // Edges first\n for (const le of layout.edges) {\n const cls = le.edge.kind === \"matrix\" ? \"lt-org-edge-matrix\" : \"lt-org-edge\";\n inner.push(pathEl({ d: le.path, class: cls }));\n }\n // Matrix edge labels\n for (const le of layout.edges) {\n if (le.edge.kind !== \"matrix\" || !le.edge.label || le.labelX === undefined) continue;\n const w = le.edge.label.length * 6 + 12;\n const h = 16;\n const x = (le.labelX ?? 0) - w / 2;\n const y = (le.labelY ?? 0) - h / 2;\n inner.push(\n rect({ x, y, width: w, height: h, rx: 3, class: \"lt-org-edge-label-bg\" })\n );\n inner.push(\n textEl(\n { x: le.labelX, y: (le.labelY ?? 0) + 4, class: \"lt-org-edge-label\" },\n le.edge.label\n )\n );\n }\n\n // Cards on top\n for (const ln of layout.nodes) {\n inner.push(renderCardBody(ln, t));\n }\n\n children.push(group({ transform: `translate(0, ${titleOffset})` }, inner));\n\n return svgRoot(\n {\n class: \"lt-org\",\n role: \"img\",\n \"aria-label\": escapeXml(ast.title ?? \"Organizational chart\"),\n width,\n height,\n viewBox: `0 0 ${width} ${height}`,\n },\n children\n );\n}\n","import type { DiagramPlugin } from \"../../core/types\";\nimport { parseOrgchart } from \"./parser\";\nimport { lintOrgchart } from \"./lint\";\nimport { renderOrgchart } from \"./renderer\";\n\nexport const orgchart: DiagramPlugin = {\n type: \"orgchart\",\n detect(text) {\n return /^\\s*orgchart\\b/i.test(text);\n },\n parse: parseOrgchart,\n lint: lintOrgchart,\n\n render(text, config) {\n const ast = parseOrgchart(text);\n return renderOrgchart(ast, config);\n },\n};\n\nexport { parseOrgchart, OrgchartParseError } from \"./parser\";\nexport { lintOrgchart } from \"./lint\";\nexport { renderOrgchart } from \"./renderer\";\nexport { layoutOrgchart } from \"./layout\";\nexport type * from \"./types\";\n"]}
@@ -1,4 +1,4 @@
1
- import { parseResult, renderResult } from './chunk-FOPOOV2P.js';
1
+ import { parseResult, renderResult } from './chunk-J2TT7PGI.js';
2
2
 
3
3
  // src/ai/registry.ts
4
4
  var DIAGRAM_REGISTRY = [
@@ -2984,11 +2984,11 @@ var SYNTAX = {
2984
2984
  },
2985
2985
  "faulttree": {
2986
2986
  "title": "Fault Tree Analysis",
2987
- "content": '## 1. Your first diagram\n\nEvery document starts with the `faulttree` keyword (alias `fta`), an optional title, then a flat list of declarations wired by id:\n\n```\nfaulttree "Both pumps fail"\n analysis: cutsets, probability\n top T "Both redundant pumps fail" = AND(PA, PB)\n basic PA "Pump A fails" p: 0.01\n basic PB "Pump B fails" p: 0.01\n```\n\n`top` declares the single root event and the gate that produces it; `basic` declares a leaf component failure with a probability. The engine computes the minimal cut set `{PA, PB}` and P(top) = 1.0e-4. The DSL is **flat declaration + reference** (not nested by indentation) \u2014 a fault tree is a DAG, so a shared event is just referenced by id from several gates.\n\nHeader directives:\n\n- `analysis: cutsets, probability` \u2014 what to compute (also `pathsets`, `none`).\n- `prob: rare | mcub | exact` \u2014 the probability method (default `rare`, a conservative upper bound).\n- `layout: tb | bt` \u2014 top-down (default) or bottom-up.\n\n---\n\n## 2. Events\n\n```\ntop T "System fails" = OR(A, B)\ngate G1 "Sub-fault" = AND(A, B)\nbasic A "Component A fails" p: 0.01\nundeveloped EXT "External fire (not modelled)"\nhouse HX "Power on" state: 1\n```\n\n- **`top`** \u2014 the one undesired event being analysed (rectangle, emphasised border). Exactly one is required.\n- **`gate`** \u2014 an intermediate event that is itself a gate output (rectangle).\n- **`basic`** \u2014 a primary component failure, the leaf that carries `p:` (circle).\n- **`undeveloped`** \u2014 an event not developed further (diamond); may carry `p:`.\n- **`house`** \u2014 a normally-expected event forced `state: 0` or `state: 1` (house glyph) \u2014 switches branches of the tree on/off.\n\nProbabilities accept decimals or scientific notation (`p: 0.004` or `p: 1e-6`); `p:` and `prob:` are interchangeable. An event with no probability is treated symbolically (cut sets still computed; P(top) reported as n/a).\n\n---\n\n## 3. Gates\n\n```\ntop T1 = AND(A, B, C) # all inputs occur\ntop T2 = OR(A, B) # at least one input occurs\ntop T3 = XOR(A, B) # exactly one (treated as OR for cut sets)\ntop T4 = VOTING(2/3; A, B, C) # at least k of n\ngate G1 = INHIBIT(A) if COND # A occurs AND the condition holds\ngate G2 = PAND(A, B) order: A, B # A then B (order rendered, AND for cut sets)\n```\n\nGates are drawn **output-up, inputs-down** (the mirror of a `logic` gate): AND is a flat-bottomed dome, OR/XOR/VOTING a shield, INHIBIT a hexagon. The conditioning event of an `INHIBIT`/`PAND` renders as an ellipse to the side. A gate may reference another gate or any event \u2014 and the same basic event may feed several gates (a repeated event).\n\n---\n\n## 4. Computed cut sets & probability\n\nThis is the differentiator. With `analysis: cutsets`, the engine runs **MOCUS**: AND gates grow the order of a cut set, OR gates multiply the number of cut sets, then idempotence (`A\u2227A=A`) and absorption (`X \u2286 Y \u21D2 drop Y`) minimise the result.\n\n- Each **minimal cut set** is boxed in red; an **order-1 cut set is a single point of failure** (strongest red, `data-spof`).\n- A **repeated event** (one basic event under several gates) is handled by absorption \u2014 the case a naive expander gets wrong.\n- **P(top)** is computed from per-event probabilities: `rare` (\u03A3 cut-set probs, default), `mcub` (1 \u2212 \u220F(1\u2212P)), or `exact` (inclusion-exclusion, which correctly de-duplicates a shared event). The method is shown next to the top event and noted in `<desc>`.\n- A `house state: 0` can make the top event unsatisfiable \u2014 reported as "no cut sets."\n\n---\n\n## 5. Repeated events\n\n```\nfaulttree "Safety function fails"\n analysis: cutsets, probability\n prob: exact\n top T "Safety function fails" = OR(C1, C2)\n gate C1 "Channel 1" = AND(S1, L1)\n gate C2 "Channel 2" = AND(S2, L1)\n basic S1 "Sensor 1 fails" p: 0.05\n basic S2 "Sensor 2 fails" p: 0.05\n basic L1 "Shared logic solver fails" p: 0.05\n```\n\n`L1` feeds both channels \u2014 it is drawn once per reference with a shared-event mark, but the cut-set engine treats every instance as one Boolean variable. Cut sets are `{S1, L1}` and `{S2, L1}`; `prob: exact` subtracts the overlap (L1 counted once over the union), giving 0.004875 rather than the rare-event 0.005.\n\n---\n\n## 6. Transfers\n\n```\ngate OVP "Sustained over-pressure" = INHIBIT(PUMP) if HEATER\ntransfer OVP -> "OVP-detail"\n```\n\nA `transfer ID -> "name"` draws the transfer-out triangle below an event whose development lives elsewhere; a matching `transfer "name" = gate_expr` defines that named subtree and is spliced in for cut-set computation. v0.1 resolves transfers in-document.\n\n---\n\n## 7. Validation\n\nThe parser fails fast with readable errors so the cut-set math is meaningful:\n\n- exactly one `top` is required (zero or several is an error);\n- a gate referencing an undeclared id reports the id by name;\n- cycles are rejected (a fault tree is a DAG);\n- a probability outside `[0, 1]`, a `VOTING k/n` with `k > n` or `n \u2260 input count`, or an `if` condition on a non-INHIBIT/PAND gate are all reported in plain English.\n\n---\n\n## 8. Theming\n\n`default` uses the house palette \u2014 soft slate-blue event boxes, **green gates** ("logic proceeds"), **red cut-set boxes** (the computed risk), blue probability numerals, a yellow house. `monochrome` reproduces the NUREG-0492 black-and-white textbook look, where the dome/shield shape (not colour) carries the gate type. All strokes/fills come from `ReliabilityTokens`; every element carries `data-*` (`data-cutset`, `data-spof`, `data-prob`, `data-gate`) so the computed analysis is inspectable downstream.'
2987
+ "content": '## 1. Your first diagram\n\nEvery document starts with the `faulttree` keyword (alias `fta`), an optional title, then a flat list of declarations wired by id:\n\n```\nfaulttree "Both pumps fail"\n analysis: cutsets, probability\n top T "Both redundant pumps fail" = AND(PA, PB)\n basic PA "Pump A fails" p: 0.01\n basic PB "Pump B fails" p: 0.01\n```\n\n`top` declares the single root event and the gate that produces it; `basic` declares a leaf component failure with a probability. The engine computes the minimal cut set `{PA, PB}` and P(top) = 1.0e-4. The DSL is **flat declaration + reference** (not nested by indentation) \u2014 a fault tree is a DAG, so a shared event is just referenced by id from several gates.\n\nHeader directives:\n\n- `analysis: cutsets, probability` \u2014 what to compute (also `pathsets`, `none`).\n- `prob: rare | mcub | exact` \u2014 the probability method (default `rare`, a conservative upper bound).\n- `layout: tb` \u2014 top-down textbook orientation. `bt` is reserved and currently reports a warning instead of changing the render.\n\n---\n\n## 2. Events\n\n```\ntop T "System fails" = OR(A, B)\ngate G1 "Sub-fault" = AND(A, B)\nbasic A "Component A fails" p: 0.01\nundeveloped EXT "External fire (not modelled)"\nhouse HX "Power on" state: 1\n```\n\n- **`top`** \u2014 the one undesired event being analysed (rectangle, emphasised border). Exactly one is required.\n- **`gate`** \u2014 an intermediate event that is itself a gate output (rectangle).\n- **`basic`** \u2014 a primary component failure, the leaf that carries `p:` (circle).\n- **`undeveloped`** \u2014 an event not developed further (diamond); may carry `p:`.\n- **`house`** \u2014 a normally-expected event forced `state: 0` or `state: 1` (house glyph) \u2014 switches branches of the tree on/off.\n\nProbabilities accept decimals or scientific notation (`p: 0.004` or `p: 1e-6`); `p:` and `prob:` are interchangeable. An event with no probability is treated symbolically (cut sets still computed; P(top) reported as n/a).\n\n---\n\n## 3. Gates\n\n```\ntop T1 = AND(A, B, C) # all inputs occur\ntop T2 = OR(A, B) # at least one input occurs\ntop T3 = XOR(A, B) # exactly one (treated as OR for cut sets)\ntop T4 = VOTING(2/3; A, B, C) # at least k of n\ngate G1 = INHIBIT(A) if COND # A occurs AND the condition holds\ngate G2 = PAND(A, B) order: A, B # A then B (order rendered, AND for cut sets)\n```\n\nGates are drawn **output-up, inputs-down** (the mirror of a `logic` gate): AND is a flat-bottomed dome, OR/XOR/VOTING a shield, INHIBIT a hexagon. The conditioning event of an `INHIBIT`/`PAND` renders as an ellipse to the side. A gate may reference another gate or any event \u2014 and the same basic event may feed several gates (a repeated event).\n\n---\n\n## 4. Computed cut sets & probability\n\nThis is the differentiator. With `analysis: cutsets`, the engine runs **MOCUS**: AND gates grow the order of a cut set, OR gates multiply the number of cut sets, then idempotence (`A\u2227A=A`) and absorption (`X \u2286 Y \u21D2 drop Y`) minimise the result.\n\n- Each **minimal cut set** is boxed in red; an **order-1 cut set is a single point of failure** (strongest red, `data-spof`).\n- A **repeated event** (one basic event under several gates) is handled by absorption \u2014 the case a naive expander gets wrong.\n- **P(top)** is computed from per-event probabilities: `rare` (\u03A3 cut-set probs, default), `mcub` (1 \u2212 \u220F(1\u2212P)), or `exact` (inclusion-exclusion, which correctly de-duplicates a shared event). The method is shown next to the top event and noted in `<desc>`.\n- A `house state: 0` can make the top event unsatisfiable \u2014 reported as "no cut sets."\n\n---\n\n## 5. Repeated events\n\n```\nfaulttree "Safety function fails"\n analysis: cutsets, probability\n prob: exact\n top T "Safety function fails" = OR(C1, C2)\n gate C1 "Channel 1" = AND(S1, L1)\n gate C2 "Channel 2" = AND(S2, L1)\n basic S1 "Sensor 1 fails" p: 0.05\n basic S2 "Sensor 2 fails" p: 0.05\n basic L1 "Shared logic solver fails" p: 0.05\n```\n\n`L1` feeds both channels \u2014 it is drawn once per reference with a shared-event mark, but the cut-set engine treats every instance as one Boolean variable. Cut sets are `{S1, L1}` and `{S2, L1}`; `prob: exact` subtracts the overlap (L1 counted once over the union), giving 0.004875 rather than the rare-event 0.005.\n\n---\n\n## 6. Transfers\n\n```\ngate OVP "Sustained over-pressure" = INHIBIT(PUMP) if HEATER\ntransfer OVP -> "OVP-detail"\n```\n\nA `transfer ID -> "name"` draws the transfer-out triangle below an event whose development lives elsewhere; a matching `transfer "name" = gate_expr` defines that named subtree and is spliced in for cut-set computation. v0.1 resolves transfers in-document.\n\n---\n\n## 7. Validation\n\nThe parser fails fast with readable errors so the cut-set math is meaningful:\n\n- exactly one `top` is required (zero or several is an error);\n- a gate referencing an undeclared id reports the id by name;\n- cycles are rejected (a fault tree is a DAG);\n- a probability outside `[0, 1]`, a `VOTING k/n` with `k > n` or `n \u2260 input count`, or an `if` condition on a non-INHIBIT/PAND gate are all reported in plain English.\n\n---\n\n## 8. Theming\n\n`default` uses the house palette \u2014 soft slate-blue event boxes, **green gates** ("logic proceeds"), **red cut-set boxes** (the computed risk), blue probability numerals, a yellow house. `monochrome` reproduces the NUREG-0492 black-and-white textbook look, where the dome/shield shape (not colour) carries the gate type. All strokes/fills come from `ReliabilityTokens`; every element carries `data-*` (`data-cutset`, `data-spof`, `data-prob`, `data-gate`) so the computed analysis is inspectable downstream.'
2988
2988
  },
2989
2989
  "bowtie": {
2990
2990
  "title": "Bowtie Risk Diagram",
2991
- "content": '## 1. Your first diagram\n\nEvery document starts with the `bowtie` keyword, an optional title, then the hazard, the top event, and the two wings:\n\n```\nbowtie\ntopevent "Loss of containment"\nthreat "Corrosion"\n prevent "Inspection programme"\nconsequence "Release to atmosphere"\n mitigate "Gas detection + ESD"\n```\n\n`topevent` declares the single knot at the centre (mandatory, exactly one). Each `threat` starts a left-wing line; each `consequence` ends a right-wing line. A barrier under a `threat` is **preventative** (`prevent`); under a `consequence` it is **mitigative** (`mitigate`). The diagram is laid out symmetrically about the knot \u2014 threats fan in from the left, consequences fan out to the right.\n\nThe DSL is **indentation-structured** and mirrors the CCPS 7-step build methodology: identify the hazard \u2192 the top event \u2192 the threats \u2192 the consequences \u2192 the preventative barriers \u2192 the mitigative barriers \u2192 the escalation factors.\n\nHeader directives (any order):\n\n- `layout: symmetric | compact` \u2014 band model (default `symmetric`).\n- `legend: on | off | bottom | top` \u2014 the auto-derived colour legend (default on).\n\n---\n\n## 2. Hazard and top event\n\n```\nhazard "Working at height"\ntopevent "Person falls from height"\n```\n\n- **`hazard`** \u2014 the operation or material with the potential to cause harm: the *context* the bowtie is about (e.g. "Working at height", "Hydrocarbon under pressure"). Optional; renders as a header box above the knot with a tie-line down to it. At most one.\n- **`topevent`** \u2014 the moment control of the hazard is **lost** (e.g. "Loss of containment", "Person falls from height"). The knot of the bowtie, drawn as a green circle. **Mandatory, exactly one.**\n\nA hazard is a *thing/activity*, not a failure; the top event is the precise moment of *loss of control* \u2014 not a cause, and not yet a consequence.\n\n---\n\n## 3. Threats and consequences\n\n```\nthreat "Guardrail removed for access"\n prevent "Permit-to-work system"\n\nconsequence "Fatality"\n mitigate "Fall-arrest harness + lanyard"\n```\n\n- A **threat** is a credible cause that, *on its own*, could trigger the top event. Each threat is the start of one left-wing line, drawn as an orange box on the left edge.\n- A **consequence** is a credible outcome *of the top event* (not of the threat), drawn as a red box on the right edge.\n\nThreats and consequences may be declared in any interleaved order \u2014 the parser groups all left-wing blocks and all right-wing blocks regardless of sequence. A bowtie needs **at least one of each**: a one-wing diagram is a fault tree (see `faulttree`) or an event tree, not a bowtie.\n\n---\n\n## 4. Barriers (the controls in between)\n\n```\nthreat "Guardrail removed for access"\n prevent "Permit-to-work system"\n prevent "Temporary edge protection"\n prevent "Spotter / banksman"\n```\n\nA **barrier** is a control that interrupts the threat \u2192 top-event path (preventative) or reduces the consequence after the top event (mitigative). Each is a grey box *on the line*. Chains are free length (1..n) \u2014 the wing simply extends.\n\n**Barrier order is declaration order**: the first declared is the **outermost** (closest to the threat/consequence, the first line of defence); the last declared is the **innermost** (closest to the knot). This matches the left-to-right reading of a real bowtie. Each barrier carries `data-order` (0 = outermost) and `data-side` (`prevent` / `mitigate`) for downstream interactivity.\n\nWhen chains differ in length, barriers are **centre-anchored**: the innermost barriers align in a neat column near the knot, and the threat/consequence boxes are ragged by chain depth \u2014 reading as defence-in-depth.\n\n---\n\n## 5. Escalation factors\n\n```\nthreat "Corrosion"\n prevent "UT thickness inspection"\n escalation "Inspection interval too long"\n barrier "Risk-based inspection scheme"\n```\n\nAn **escalation factor** (or degradation factor) is a condition that *degrades a specific barrier\'s effectiveness* \u2014 e.g. "Edge protection not inspected", "Operator fatigue". It attaches to **one** barrier (not to the line) and drops vertically below it as an amber box, joined by a muted "degrades" connector.\n\nAn **escalation-factor barrier** is a control placed on the escalation factor itself \u2014 it protects the barrier from being degraded (e.g. a pre-use inspection regime). It nests one level deeper, under the escalation factor, and renders as a grey box below it.\n\nIndentation binds the nesting: `prevent`/`mitigate` at 2 spaces, `escalation` at 4, `barrier` at 6.\n\n---\n\n## 6. Correct by construction (the barrier rule set)\n\nBefore it draws a single shape, the engine validates the structural half of the CCPS/EI barrier rule set and **refuses to render** on failure \u2014 exactly as `prisma` refuses missing counts:\n\n- **Exactly one top event** \u2014 zero or several is an error.\n- **Every threat has \u2265 1 preventative barrier** \u2014 a bare threat is a Swiss-cheese cartoon, not a bowtie.\n- **Every consequence has \u2265 1 mitigative barrier** \u2014 the mirror rule.\n- **Every escalation factor is attached to a barrier** \u2014 it cannot float on a line or on the top event.\n- **At least one threat and one consequence** \u2014 a one-wing diagram is an FTA or an ETA.\n\nMessages name the offending element and the rule in plain English, e.g. *"Threat \'Corrosion\' has no preventative barrier \u2014 every threat must reach the top event through at least one barrier (CCPS/EI barrier rule). Add a `prevent` line under it."* This is what separates a real bowtie from a doodle. The engine does **not** judge whether a barrier is truly *effective* or *independent* \u2014 that is the analyst\'s qualitative judgement.\n\n---\n\n## 7. Bowtie vs fault tree\n\nA fully-developed bowtie *is* a fault tree glued to an event tree at the top event: the left wing read backwards is the fault tree whose top event is the bowtie\'s knot, and the right wing is the event tree that propagates it into consequences. Schematex keeps them as two engines because their use differs:\n\n- **`bowtie`** is qualitative and symmetric \u2014 the barrier inventory and the at-a-glance defence-in-depth story; no probability arithmetic.\n- **`faulttree`** is quantitative and Boolean \u2014 AND/OR gates, basic-event probabilities, minimal cut sets, a probability rollup.\n\nWhere you want the gate-level detail behind a single threat, draw a separate `faulttree`.\n\n---\n\n## 8. Theming\n\n`default` uses the recognised BowTieXP / bowtiemaster palette \u2014 **orange threats** (left), **grey barriers** on the line, a **green top-event disc** (centre knot), **red consequences** (right), **amber escalation factors** dropping below \u2014 mapped onto Schematex\'s semantic slots so it stays coherent with `prisma` / `pert` / `petri`. `monochrome` reproduces the regulator-print black-and-white look, where element distinction rides on shape/border + position (escalation factors get a dashed border, the knot a doubled ring) rather than colour. `dark` follows Catppuccin Mocha. All strokes/fills come from `BowtieTokens`; every element carries `data-*` (`data-role`, `data-side`, `data-line`, `data-order`, `data-barrier`) so the structure is inspectable downstream.'
2991
+ "content": '## 1. Your first diagram\n\nEvery document starts with the `bowtie` keyword, an optional title, then the hazard, the top event, and the two wings:\n\n```\nbowtie\ntopevent "Loss of containment"\nthreat "Corrosion"\n prevent "Inspection programme"\nconsequence "Release to atmosphere"\n mitigate "Gas detection + ESD"\n```\n\n`topevent` declares the single knot at the centre (mandatory, exactly one). Each `threat` starts a left-wing line; each `consequence` ends a right-wing line. A barrier under a `threat` is **preventative** (`prevent`); under a `consequence` it is **mitigative** (`mitigate`). The diagram is laid out symmetrically about the knot \u2014 threats fan in from the left, consequences fan out to the right.\n\nThe DSL is **indentation-structured** and mirrors the CCPS 7-step build methodology: identify the hazard \u2192 the top event \u2192 the threats \u2192 the consequences \u2192 the preventative barriers \u2192 the mitigative barriers \u2192 the escalation factors.\n\nHeader directives (any order):\n\n- `layout: symmetric` \u2014 band model (default). `compact` is reserved and currently reports a warning instead of changing the render.\n- `legend: on | off | bottom | top` \u2014 the auto-derived colour legend (default on).\n\n---\n\n## 2. Hazard and top event\n\n```\nhazard "Working at height"\ntopevent "Person falls from height"\n```\n\n- **`hazard`** \u2014 the operation or material with the potential to cause harm: the *context* the bowtie is about (e.g. "Working at height", "Hydrocarbon under pressure"). Optional; renders as a header box above the knot with a tie-line down to it. At most one.\n- **`topevent`** \u2014 the moment control of the hazard is **lost** (e.g. "Loss of containment", "Person falls from height"). The knot of the bowtie, drawn as a green circle. **Mandatory, exactly one.**\n\nA hazard is a *thing/activity*, not a failure; the top event is the precise moment of *loss of control* \u2014 not a cause, and not yet a consequence.\n\n---\n\n## 3. Threats and consequences\n\n```\nthreat "Guardrail removed for access"\n prevent "Permit-to-work system"\n\nconsequence "Fatality"\n mitigate "Fall-arrest harness + lanyard"\n```\n\n- A **threat** is a credible cause that, *on its own*, could trigger the top event. Each threat is the start of one left-wing line, drawn as an orange box on the left edge.\n- A **consequence** is a credible outcome *of the top event* (not of the threat), drawn as a red box on the right edge.\n\nThreats and consequences may be declared in any interleaved order \u2014 the parser groups all left-wing blocks and all right-wing blocks regardless of sequence. A bowtie needs **at least one of each**: a one-wing diagram is a fault tree (see `faulttree`) or an event tree, not a bowtie.\n\n---\n\n## 4. Barriers (the controls in between)\n\n```\nthreat "Guardrail removed for access"\n prevent "Permit-to-work system"\n prevent "Temporary edge protection"\n prevent "Spotter / banksman"\n```\n\nA **barrier** is a control that interrupts the threat \u2192 top-event path (preventative) or reduces the consequence after the top event (mitigative). Each is a grey box *on the line*. Chains are free length (1..n) \u2014 the wing simply extends.\n\n**Barrier order is declaration order**: the first declared is the **outermost** (closest to the threat/consequence, the first line of defence); the last declared is the **innermost** (closest to the knot). This matches the left-to-right reading of a real bowtie. Each barrier carries `data-order` (0 = outermost) and `data-side` (`prevent` / `mitigate`) for downstream interactivity.\n\nWhen chains differ in length, barriers are **centre-anchored**: the innermost barriers align in a neat column near the knot, and the threat/consequence boxes are ragged by chain depth \u2014 reading as defence-in-depth.\n\n---\n\n## 5. Escalation factors\n\n```\nthreat "Corrosion"\n prevent "UT thickness inspection"\n escalation "Inspection interval too long"\n barrier "Risk-based inspection scheme"\n```\n\nAn **escalation factor** (or degradation factor) is a condition that *degrades a specific barrier\'s effectiveness* \u2014 e.g. "Edge protection not inspected", "Operator fatigue". It attaches to **one** barrier (not to the line) and drops vertically below it as an amber box, joined by a muted "degrades" connector.\n\nAn **escalation-factor barrier** is a control placed on the escalation factor itself \u2014 it protects the barrier from being degraded (e.g. a pre-use inspection regime). It nests one level deeper, under the escalation factor, and renders as a grey box below it.\n\nIndentation binds the nesting: `prevent`/`mitigate` at 2 spaces, `escalation` at 4, `barrier` at 6.\n\n---\n\n## 6. Correct by construction (the barrier rule set)\n\nBefore it draws a single shape, the engine validates the structural half of the CCPS/EI barrier rule set and **refuses to render** on failure \u2014 exactly as `prisma` refuses missing counts:\n\n- **Exactly one top event** \u2014 zero or several is an error.\n- **Every threat has \u2265 1 preventative barrier** \u2014 a bare threat is a Swiss-cheese cartoon, not a bowtie.\n- **Every consequence has \u2265 1 mitigative barrier** \u2014 the mirror rule.\n- **Every escalation factor is attached to a barrier** \u2014 it cannot float on a line or on the top event.\n- **At least one threat and one consequence** \u2014 a one-wing diagram is an FTA or an ETA.\n\nMessages name the offending element and the rule in plain English, e.g. *"Threat \'Corrosion\' has no preventative barrier \u2014 every threat must reach the top event through at least one barrier (CCPS/EI barrier rule). Add a `prevent` line under it."* This is what separates a real bowtie from a doodle. The engine does **not** judge whether a barrier is truly *effective* or *independent* \u2014 that is the analyst\'s qualitative judgement.\n\n---\n\n## 7. Bowtie vs fault tree\n\nA fully-developed bowtie *is* a fault tree glued to an event tree at the top event: the left wing read backwards is the fault tree whose top event is the bowtie\'s knot, and the right wing is the event tree that propagates it into consequences. Schematex keeps them as two engines because their use differs:\n\n- **`bowtie`** is qualitative and symmetric \u2014 the barrier inventory and the at-a-glance defence-in-depth story; no probability arithmetic.\n- **`faulttree`** is quantitative and Boolean \u2014 AND/OR gates, basic-event probabilities, minimal cut sets, a probability rollup.\n\nWhere you want the gate-level detail behind a single threat, draw a separate `faulttree`.\n\n---\n\n## 8. Theming\n\n`default` uses the recognised BowTieXP / bowtiemaster palette \u2014 **orange threats** (left), **grey barriers** on the line, a **green top-event disc** (centre knot), **red consequences** (right), **amber escalation factors** dropping below \u2014 mapped onto Schematex\'s semantic slots so it stays coherent with `prisma` / `pert` / `petri`. `monochrome` reproduces the regulator-print black-and-white look, where element distinction rides on shape/border + position (escalation factors get a dashed border, the knot a doubled ring) rather than colour. `dark` follows Catppuccin Mocha. All strokes/fills come from `BowtieTokens`; every element carries `data-*` (`data-role`, `data-side`, `data-line`, `data-order`, `data-barrier`) so the structure is inspectable downstream.'
2992
2992
  }
2993
2993
  };
2994
2994
 
@@ -3639,11 +3639,19 @@ function validateDsl(type, dsl) {
3639
3639
  const config = type ? { type: resolvedType ?? type } : void 0;
3640
3640
  const result = parseResult(dsl, config);
3641
3641
  if (result.ok) {
3642
- return { ok: true, type: result.type };
3642
+ return {
3643
+ ok: true,
3644
+ type: result.type,
3645
+ status: result.status,
3646
+ warnings: result.diagnostics.map(
3647
+ (diagnostic) => toValidationError(diagnostic, result.type)
3648
+ )
3649
+ };
3643
3650
  }
3644
3651
  return {
3645
3652
  ok: false,
3646
3653
  type: result.type ?? resolvedType ?? resolveTypeFromText(dsl),
3654
+ status: "invalid",
3647
3655
  errors: result.diagnostics.map(
3648
3656
  (diagnostic) => toValidationError(diagnostic, result.type ?? resolvedType)
3649
3657
  )
@@ -3698,5 +3706,5 @@ function repairHint(type) {
3698
3706
  }
3699
3707
 
3700
3708
  export { DIAGRAM_REGISTRY, DIAGRAM_SINCE, getAllDiagramTypes, getDiagramMeta, getDiagramSince, getExamples, getSyntax, listDiagrams, renderDsl, resolveDiagramType, validateDsl };
3701
- //# sourceMappingURL=chunk-3HZW6K5I.js.map
3702
- //# sourceMappingURL=chunk-3HZW6K5I.js.map
3709
+ //# sourceMappingURL=chunk-QZ2OBNAS.js.map
3710
+ //# sourceMappingURL=chunk-QZ2OBNAS.js.map