schematex 0.9.4 → 0.9.6

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 (82) hide show
  1. package/README.md +45 -0
  2. package/dist/ai/ai-sdk.cjs +8 -8
  3. package/dist/ai/ai-sdk.d.cts +3 -3
  4. package/dist/ai/ai-sdk.d.ts +3 -3
  5. package/dist/ai/ai-sdk.js +3 -3
  6. package/dist/ai/index.cjs +17 -17
  7. package/dist/ai/index.d.cts +4 -4
  8. package/dist/ai/index.d.ts +4 -4
  9. package/dist/ai/index.js +4 -4
  10. package/dist/{api-1xoGiseb.d.cts → api-BOJJlNb1.d.ts} +2 -2
  11. package/dist/{api-CgXRSnCn.d.ts → api-v9t1T1v6.d.cts} +2 -2
  12. package/dist/browser.cjs +9 -9
  13. package/dist/browser.d.cts +3 -3
  14. package/dist/browser.d.ts +3 -3
  15. package/dist/browser.js +3 -3
  16. package/dist/{chunk-UFXDAIDD.js → chunk-4W75FGWO.js} +1714 -658
  17. package/dist/chunk-4W75FGWO.js.map +1 -0
  18. package/dist/{chunk-NIYB6CHH.js → chunk-CVTHUOAM.js} +265 -15
  19. package/dist/chunk-CVTHUOAM.js.map +1 -0
  20. package/dist/{chunk-TX3YWZZX.cjs → chunk-HX64QWB6.cjs} +267 -17
  21. package/dist/chunk-HX64QWB6.cjs.map +1 -0
  22. package/dist/{chunk-PFZKW3HE.js → chunk-II4GLKGF.js} +2 -2
  23. package/dist/chunk-II4GLKGF.js.map +1 -0
  24. package/dist/{chunk-GTCAJPQR.cjs → chunk-KH5GRKUM.cjs} +1715 -658
  25. package/dist/chunk-KH5GRKUM.cjs.map +1 -0
  26. package/dist/{chunk-WJXLF42K.cjs → chunk-N3HU635X.cjs} +2 -2
  27. package/dist/chunk-N3HU635X.cjs.map +1 -0
  28. package/dist/{diagnostics-CDwnQ65n.d.cts → diagnostics-5bVLlGNj.d.cts} +1 -1
  29. package/dist/{diagnostics-CDwnQ65n.d.ts → diagnostics-5bVLlGNj.d.ts} +1 -1
  30. package/dist/diagrams/blockdiagram/index.d.cts +1 -1
  31. package/dist/diagrams/blockdiagram/index.d.ts +1 -1
  32. package/dist/diagrams/circuit/index.d.cts +1 -1
  33. package/dist/diagrams/circuit/index.d.ts +1 -1
  34. package/dist/diagrams/ecomap/index.d.cts +1 -1
  35. package/dist/diagrams/ecomap/index.d.ts +1 -1
  36. package/dist/diagrams/entity/index.d.cts +1 -1
  37. package/dist/diagrams/entity/index.d.ts +1 -1
  38. package/dist/diagrams/fishbone/index.d.cts +1 -1
  39. package/dist/diagrams/fishbone/index.d.ts +1 -1
  40. package/dist/diagrams/flowchart/index.d.cts +2 -2
  41. package/dist/diagrams/flowchart/index.d.ts +2 -2
  42. package/dist/diagrams/genogram/index.d.cts +1 -1
  43. package/dist/diagrams/genogram/index.d.ts +1 -1
  44. package/dist/diagrams/ladder/index.d.cts +1 -1
  45. package/dist/diagrams/ladder/index.d.ts +1 -1
  46. package/dist/diagrams/logic/index.d.cts +1 -1
  47. package/dist/diagrams/logic/index.d.ts +1 -1
  48. package/dist/diagrams/orgchart/index.d.cts +1 -1
  49. package/dist/diagrams/orgchart/index.d.ts +1 -1
  50. package/dist/diagrams/pedigree/index.d.cts +1 -1
  51. package/dist/diagrams/pedigree/index.d.ts +1 -1
  52. package/dist/diagrams/phylo/index.d.cts +1 -1
  53. package/dist/diagrams/phylo/index.d.ts +1 -1
  54. package/dist/diagrams/sld/index.cjs +7 -7
  55. package/dist/diagrams/sld/index.d.cts +1 -1
  56. package/dist/diagrams/sld/index.d.ts +1 -1
  57. package/dist/diagrams/sld/index.js +1 -1
  58. package/dist/diagrams/sociogram/index.d.cts +1 -1
  59. package/dist/diagrams/sociogram/index.d.ts +1 -1
  60. package/dist/diagrams/timing/index.d.cts +1 -1
  61. package/dist/diagrams/timing/index.d.ts +1 -1
  62. package/dist/diagrams/venn/index.d.cts +1 -1
  63. package/dist/diagrams/venn/index.d.ts +1 -1
  64. package/dist/{index-DNOoLmYX.d.cts → index-Cmf4Rcve.d.cts} +1 -1
  65. package/dist/{index-CYSH3_ca.d.ts → index-syc0E5Ss.d.ts} +1 -1
  66. package/dist/index.cjs +41 -37
  67. package/dist/index.d.cts +7 -5
  68. package/dist/index.d.ts +7 -5
  69. package/dist/index.js +4 -4
  70. package/dist/react.cjs +3 -3
  71. package/dist/react.d.cts +2 -2
  72. package/dist/react.d.ts +2 -2
  73. package/dist/react.js +2 -2
  74. package/dist/{tools-CbYmQ3hH.d.cts → tools-B98iarLm.d.cts} +2 -2
  75. package/dist/{tools-BhTti-oG.d.ts → tools-CCZ1IcIN.d.ts} +2 -2
  76. package/package.json +1 -1
  77. package/dist/chunk-GTCAJPQR.cjs.map +0 -1
  78. package/dist/chunk-NIYB6CHH.js.map +0 -1
  79. package/dist/chunk-PFZKW3HE.js.map +0 -1
  80. package/dist/chunk-TX3YWZZX.cjs.map +0 -1
  81. package/dist/chunk-UFXDAIDD.js.map +0 -1
  82. package/dist/chunk-WJXLF42K.cjs.map +0 -1
@@ -4,7 +4,7 @@ var chunk4OC3CTGE_cjs = require('./chunk-4OC3CTGE.cjs');
4
4
  var chunk4AC6I7KJ_cjs = require('./chunk-4AC6I7KJ.cjs');
5
5
  var chunkC4Y24X3U_cjs = require('./chunk-C4Y24X3U.cjs');
6
6
  var chunkINVLJYAE_cjs = require('./chunk-INVLJYAE.cjs');
7
- var chunkWJXLF42K_cjs = require('./chunk-WJXLF42K.cjs');
7
+ var chunkN3HU635X_cjs = require('./chunk-N3HU635X.cjs');
8
8
  var chunkGAQ36VFD_cjs = require('./chunk-GAQ36VFD.cjs');
9
9
  var chunk627GHE2N_cjs = require('./chunk-627GHE2N.cjs');
10
10
  var chunkITI3STJ6_cjs = require('./chunk-ITI3STJ6.cjs');
@@ -2756,8 +2756,8 @@ function renderEras(layout, theme) {
2756
2756
  layout.eras.forEach((e, i) => {
2757
2757
  const l = leftmostOnRow.get(e.bandRow);
2758
2758
  if (l === void 0 || e.x < layout.eras[l].x) leftmostOnRow.set(e.bandRow, i);
2759
- const r6 = rightmostOnRow.get(e.bandRow);
2760
- if (r6 === void 0 || e.x + e.width > layout.eras[r6].x + layout.eras[r6].width) rightmostOnRow.set(e.bandRow, i);
2759
+ const r7 = rightmostOnRow.get(e.bandRow);
2760
+ if (r7 === void 0 || e.x + e.width > layout.eras[r7].x + layout.eras[r7].width) rightmostOnRow.set(e.bandRow, i);
2761
2761
  });
2762
2762
  const plotEnd = layout.plotX + layout.plotW;
2763
2763
  const items = layout.eras.map((e, i) => {
@@ -2883,20 +2883,20 @@ function renderSwimlanePoints(layout, theme) {
2883
2883
  function renderMarker(ev, color, shape, isMilestone) {
2884
2884
  const x = ev.x;
2885
2885
  const y = ev.y;
2886
- const r6 = isMilestone ? 8 : 5;
2886
+ const r7 = isMilestone ? 8 : 5;
2887
2887
  const klass = isMilestone ? "st-milestone" : "st-event-dot";
2888
2888
  switch (shape) {
2889
2889
  case "square":
2890
- return chunk3WNW5Y7P_cjs.rect({ x: x - r6, y: y - r6, width: r6 * 2, height: r6 * 2, fill: color, class: klass, "data-event-id": ev.event.id });
2890
+ return chunk3WNW5Y7P_cjs.rect({ x: x - r7, y: y - r7, width: r7 * 2, height: r7 * 2, fill: color, class: klass, "data-event-id": ev.event.id });
2891
2891
  case "diamond":
2892
- return chunk3WNW5Y7P_cjs.path({ d: `M ${x},${y - r6} L ${x + r6},${y} L ${x},${y + r6} L ${x - r6},${y} Z`, fill: color, class: klass, "data-event-id": ev.event.id });
2892
+ return chunk3WNW5Y7P_cjs.path({ d: `M ${x},${y - r7} L ${x + r7},${y} L ${x},${y + r7} L ${x - r7},${y} Z`, fill: color, class: klass, "data-event-id": ev.event.id });
2893
2893
  case "star":
2894
- return chunk3WNW5Y7P_cjs.path({ d: starPath(x, y, r6 + 2, (r6 + 2) / 2.5, 5), fill: color, class: klass, "data-event-id": ev.event.id });
2894
+ return chunk3WNW5Y7P_cjs.path({ d: starPath(x, y, r7 + 2, (r7 + 2) / 2.5, 5), fill: color, class: klass, "data-event-id": ev.event.id });
2895
2895
  case "flag":
2896
- return chunk3WNW5Y7P_cjs.path({ d: `M ${x - r6},${y + r6} L ${x - r6},${y - r6 - 4} L ${x + r6 + 4},${y - r6 - 1} L ${x - r6},${y + 2}`, fill: color, class: klass, "data-event-id": ev.event.id });
2896
+ return chunk3WNW5Y7P_cjs.path({ d: `M ${x - r7},${y + r7} L ${x - r7},${y - r7 - 4} L ${x + r7 + 4},${y - r7 - 1} L ${x - r7},${y + 2}`, fill: color, class: klass, "data-event-id": ev.event.id });
2897
2897
  case "circle":
2898
2898
  default:
2899
- return chunk3WNW5Y7P_cjs.circle({ cx: x, cy: y, r: r6, fill: color, class: klass, "data-event-id": ev.event.id });
2899
+ return chunk3WNW5Y7P_cjs.circle({ cx: x, cy: y, r: r7, fill: color, class: klass, "data-event-id": ev.event.id });
2900
2900
  }
2901
2901
  }
2902
2902
  function renderLabels(layout) {
@@ -3152,10 +3152,10 @@ function starPath(cx, cy, rOuter, rInner, points) {
3152
3152
  const step = Math.PI / points;
3153
3153
  let d = "";
3154
3154
  for (let i = 0; i < points * 2; i++) {
3155
- const r6 = i % 2 === 0 ? rOuter : rInner;
3155
+ const r7 = i % 2 === 0 ? rOuter : rInner;
3156
3156
  const a = i * step - Math.PI / 2;
3157
- const x = cx + r6 * Math.cos(a);
3158
- const y = cy + r6 * Math.sin(a);
3157
+ const x = cx + r7 * Math.cos(a);
3158
+ const y = cy + r7 * Math.sin(a);
3159
3159
  d += (i === 0 ? "M" : "L") + x.toFixed(2) + "," + y.toFixed(2) + " ";
3160
3160
  }
3161
3161
  return d + "Z";
@@ -3426,7 +3426,7 @@ function parseStateDiagram(src) {
3426
3426
  }
3427
3427
  ctxTop.regionMode = true;
3428
3428
  if (!parent.regions) parent.regions = [];
3429
- const lastIdx = parent.regions.reduce((s, r6) => s + r6.length, 0);
3429
+ const lastIdx = parent.regions.reduce((s, r7) => s + r7.length, 0);
3430
3430
  const slice = parent.children.slice(lastIdx);
3431
3431
  parent.regions.push(slice);
3432
3432
  i++;
@@ -3630,7 +3630,7 @@ function parseStateDiagram(src) {
3630
3630
  }
3631
3631
  function finalizeRegions(node) {
3632
3632
  if (node.regions) {
3633
- const consumed = node.regions.reduce((s, r6) => s + r6.length, 0);
3633
+ const consumed = node.regions.reduce((s, r7) => s + r7.length, 0);
3634
3634
  if (node.children.length > consumed) {
3635
3635
  node.regions.push(node.children.slice(consumed));
3636
3636
  }
@@ -4075,33 +4075,33 @@ function pointsToPath(pts) {
4075
4075
  const rest = pts.slice(1).map((p) => `L ${p.x} ${p.y}`).join(" ");
4076
4076
  return rest ? `${head} ${rest}` : head;
4077
4077
  }
4078
- function trimPathStart(d, cx, cy, r6) {
4078
+ function trimPathStart(d, cx, cy, r7) {
4079
4079
  const pts = parsePathPoints(d);
4080
4080
  if (!pts || pts.length < 2) return d;
4081
4081
  const p0 = pts[0];
4082
4082
  const p1 = pts[1];
4083
- const newP0 = projectOnPerimeter(p0, p1, cx, cy, r6);
4083
+ const newP0 = projectOnPerimeter(p0, p1, cx, cy, r7);
4084
4084
  pts[0] = newP0;
4085
4085
  return pointsToPath(pts);
4086
4086
  }
4087
- function trimPathEnd(d, cx, cy, r6) {
4087
+ function trimPathEnd(d, cx, cy, r7) {
4088
4088
  const pts = parsePathPoints(d);
4089
4089
  if (!pts || pts.length < 2) return d;
4090
4090
  const last = pts[pts.length - 1];
4091
4091
  const prev = pts[pts.length - 2];
4092
- const newLast = projectOnPerimeter(last, prev, cx, cy, r6);
4092
+ const newLast = projectOnPerimeter(last, prev, cx, cy, r7);
4093
4093
  pts[pts.length - 1] = newLast;
4094
4094
  return pointsToPath(pts);
4095
4095
  }
4096
- function projectOnPerimeter(endpoint, neighbor, cx, cy, r6) {
4096
+ function projectOnPerimeter(endpoint, neighbor, cx, cy, r7) {
4097
4097
  const dx = endpoint.x - neighbor.x;
4098
4098
  const dy = endpoint.y - neighbor.y;
4099
4099
  if (Math.abs(dx) > Math.abs(dy)) {
4100
4100
  const sign2 = dx >= 0 ? 1 : -1;
4101
- return { x: cx - sign2 * r6, y: cy };
4101
+ return { x: cx - sign2 * r7, y: cy };
4102
4102
  }
4103
4103
  const sign = dy >= 0 ? 1 : -1;
4104
- return { x: cx, y: cy - sign * r6 };
4104
+ return { x: cx, y: cy - sign * r7 };
4105
4105
  }
4106
4106
  function shiftPathX(d, dx) {
4107
4107
  return d.replace(/([MLCQ])\s*((?:-?\d+(?:\.\d+)?\s+){1,5}-?\d+(?:\.\d+)?)/g, (_, cmd, args) => {
@@ -4279,12 +4279,12 @@ function renderPseudo(node) {
4279
4279
  ]
4280
4280
  );
4281
4281
  case "choice": {
4282
- const r6 = 14;
4282
+ const r7 = 14;
4283
4283
  return chunk3WNW5Y7P_cjs.group(
4284
4284
  { class: "lt-state lt-pseudo", "data-id": node.id, "data-kind": "choice" },
4285
4285
  [
4286
4286
  chunk3WNW5Y7P_cjs.polygon({
4287
- points: `${cx},${cy - r6} ${cx + r6},${cy} ${cx},${cy + r6} ${cx - r6},${cy}`,
4287
+ points: `${cx},${cy - r7} ${cx + r7},${cy} ${cx},${cy + r7} ${cx - r7},${cy}`,
4288
4288
  class: "lt-ps-choice"
4289
4289
  })
4290
4290
  ]
@@ -5282,27 +5282,27 @@ function renderEquip(type, label, rawType) {
5282
5282
  ]);
5283
5283
  }
5284
5284
  case "pump_centrifugal": {
5285
- const r6 = 22;
5285
+ const r7 = 22;
5286
5286
  return chunk3WNW5Y7P_cjs.group({}, [
5287
- chunk3WNW5Y7P_cjs.circle({ cx: 0, cy: 0, r: r6, class: "lt-pid-equip" }),
5287
+ chunk3WNW5Y7P_cjs.circle({ cx: 0, cy: 0, r: r7, class: "lt-pid-equip" }),
5288
5288
  chunk3WNW5Y7P_cjs.polygon({
5289
- points: `${r6 * 0.4},${-r6 * 0.9} ${r6 + 6},${-r6 * 0.9} ${r6 * 0.4},${0}`,
5289
+ points: `${r7 * 0.4},${-r7 * 0.9} ${r7 + 6},${-r7 * 0.9} ${r7 * 0.4},${0}`,
5290
5290
  class: "lt-pid-equip"
5291
5291
  }),
5292
5292
  chunk3WNW5Y7P_cjs.text(
5293
- { x: 0, y: r6 + 14, "text-anchor": "middle", class: "lt-pid-equip-tag" },
5293
+ { x: 0, y: r7 + 14, "text-anchor": "middle", class: "lt-pid-equip-tag" },
5294
5294
  label
5295
5295
  )
5296
5296
  ]);
5297
5297
  }
5298
5298
  case "pump_pd": {
5299
- const r6 = 22;
5299
+ const r7 = 22;
5300
5300
  return chunk3WNW5Y7P_cjs.group({}, [
5301
- chunk3WNW5Y7P_cjs.circle({ cx: 0, cy: 0, r: r6, class: "lt-pid-equip" }),
5301
+ chunk3WNW5Y7P_cjs.circle({ cx: 0, cy: 0, r: r7, class: "lt-pid-equip" }),
5302
5302
  chunk3WNW5Y7P_cjs.circle({ cx: -8, cy: 0, r: 6, class: "lt-pid-tray-line", fill: "none" }),
5303
5303
  chunk3WNW5Y7P_cjs.circle({ cx: 8, cy: 0, r: 6, class: "lt-pid-tray-line", fill: "none" }),
5304
5304
  chunk3WNW5Y7P_cjs.text(
5305
- { x: 0, y: r6 + 14, "text-anchor": "middle", class: "lt-pid-equip-tag" },
5305
+ { x: 0, y: r7 + 14, "text-anchor": "middle", class: "lt-pid-equip-tag" },
5306
5306
  label
5307
5307
  )
5308
5308
  ]);
@@ -5317,14 +5317,14 @@ function renderEquip(type, label, rawType) {
5317
5317
  ]);
5318
5318
  }
5319
5319
  case "blower": {
5320
- const r6 = 22;
5320
+ const r7 = 22;
5321
5321
  return chunk3WNW5Y7P_cjs.group({}, [
5322
- chunk3WNW5Y7P_cjs.circle({ cx: 0, cy: 0, r: r6, class: "lt-pid-equip" }),
5322
+ chunk3WNW5Y7P_cjs.circle({ cx: 0, cy: 0, r: r7, class: "lt-pid-equip" }),
5323
5323
  chunk3WNW5Y7P_cjs.path({
5324
- d: `M 0 0 L ${r6 * 0.8} ${-r6 * 0.5} M 0 0 L ${-r6 * 0.6} ${-r6 * 0.6} M 0 0 L 0 ${r6 * 0.8}`,
5324
+ d: `M 0 0 L ${r7 * 0.8} ${-r7 * 0.5} M 0 0 L ${-r7 * 0.6} ${-r7 * 0.6} M 0 0 L 0 ${r7 * 0.8}`,
5325
5325
  class: "lt-pid-tray-line"
5326
5326
  }),
5327
- chunk3WNW5Y7P_cjs.text({ x: 0, y: r6 + 14, "text-anchor": "middle", class: "lt-pid-equip-tag" }, label)
5327
+ chunk3WNW5Y7P_cjs.text({ x: 0, y: r7 + 14, "text-anchor": "middle", class: "lt-pid-equip-tag" }, label)
5328
5328
  ]);
5329
5329
  }
5330
5330
  case "reactor_cstr": {
@@ -5500,7 +5500,7 @@ function renderEquip(type, label, rawType) {
5500
5500
  }
5501
5501
  }
5502
5502
  function renderInstrument(category, letterCode, loopNumber) {
5503
- const r6 = 14;
5503
+ const r7 = 14;
5504
5504
  const isComputer = category.endsWith("computer");
5505
5505
  const isPlc = category.endsWith("plc");
5506
5506
  const isShared = category.endsWith("shared");
@@ -5508,17 +5508,17 @@ function renderInstrument(category, letterCode, loopNumber) {
5508
5508
  const isLocal = category.startsWith("local_");
5509
5509
  const parts = [];
5510
5510
  if (isComputer) {
5511
- parts.push(chunk3WNW5Y7P_cjs.circle({ cx: 0, cy: 0, r: r6, class: "lt-inst-body" }));
5511
+ parts.push(chunk3WNW5Y7P_cjs.circle({ cx: 0, cy: 0, r: r7, class: "lt-inst-body" }));
5512
5512
  parts.push(
5513
5513
  chunk3WNW5Y7P_cjs.polygon({
5514
- points: `0,${-r6 + 1} ${r6 - 1},0 0,${r6 - 1} ${ -13},0`,
5514
+ points: `0,${-r7 + 1} ${r7 - 1},0 0,${r7 - 1} ${ -13},0`,
5515
5515
  class: "lt-inst-body",
5516
5516
  fill: "none"
5517
5517
  })
5518
5518
  );
5519
5519
  } else if (isPlc) {
5520
- parts.push(chunk3WNW5Y7P_cjs.circle({ cx: 0, cy: 0, r: r6, class: "lt-inst-body" }));
5521
- const side = r6 * Math.SQRT1_2 * 2 - 2;
5520
+ parts.push(chunk3WNW5Y7P_cjs.circle({ cx: 0, cy: 0, r: r7, class: "lt-inst-body" }));
5521
+ const side = r7 * Math.SQRT1_2 * 2 - 2;
5522
5522
  parts.push(
5523
5523
  chunk3WNW5Y7P_cjs.rect({
5524
5524
  x: -side / 2,
@@ -5530,11 +5530,11 @@ function renderInstrument(category, letterCode, loopNumber) {
5530
5530
  })
5531
5531
  );
5532
5532
  } else if (isShared) {
5533
- parts.push(chunk3WNW5Y7P_cjs.circle({ cx: 0, cy: 0, r: r6, class: "lt-inst-body" }));
5533
+ parts.push(chunk3WNW5Y7P_cjs.circle({ cx: 0, cy: 0, r: r7, class: "lt-inst-body" }));
5534
5534
  const hex = [];
5535
5535
  for (let i = 0; i < 6; i++) {
5536
5536
  const a = Math.PI / 3 * i - Math.PI / 2;
5537
- hex.push(`${(r6 - 2) * Math.cos(a)},${(r6 - 2) * Math.sin(a)}`);
5537
+ hex.push(`${(r7 - 2) * Math.cos(a)},${(r7 - 2) * Math.sin(a)}`);
5538
5538
  }
5539
5539
  parts.push(
5540
5540
  chunk3WNW5Y7P_cjs.polygon({
@@ -5544,12 +5544,12 @@ function renderInstrument(category, letterCode, loopNumber) {
5544
5544
  })
5545
5545
  );
5546
5546
  } else {
5547
- parts.push(chunk3WNW5Y7P_cjs.circle({ cx: 0, cy: 0, r: r6, class: "lt-inst-body" }));
5547
+ parts.push(chunk3WNW5Y7P_cjs.circle({ cx: 0, cy: 0, r: r7, class: "lt-inst-body" }));
5548
5548
  }
5549
5549
  if (isControlRoom) {
5550
- parts.push(chunk3WNW5Y7P_cjs.line({ x1: -r6, y1: 0, x2: r6, y2: 0, class: "lt-inst-cr-line" }));
5550
+ parts.push(chunk3WNW5Y7P_cjs.line({ x1: -r7, y1: 0, x2: r7, y2: 0, class: "lt-inst-cr-line" }));
5551
5551
  } else if (isLocal) {
5552
- parts.push(chunk3WNW5Y7P_cjs.line({ x1: -r6, y1: 0, x2: r6, y2: 0, class: "lt-inst-local-line" }));
5552
+ parts.push(chunk3WNW5Y7P_cjs.line({ x1: -r7, y1: 0, x2: r7, y2: 0, class: "lt-inst-local-line" }));
5553
5553
  }
5554
5554
  parts.push(
5555
5555
  chunk3WNW5Y7P_cjs.text(
@@ -6301,19 +6301,19 @@ function readScalar(map, key) {
6301
6301
  return { value, line: entry.header.line };
6302
6302
  }
6303
6303
  function readInt(map, key) {
6304
- const r6 = readScalar(map, key);
6305
- if (r6 === void 0) return void 0;
6306
- return parseInt10(r6.value, r6.line);
6304
+ const r7 = readScalar(map, key);
6305
+ if (r7 === void 0) return void 0;
6306
+ return parseInt10(r7.value, r7.line);
6307
6307
  }
6308
6308
  function readSources(map, key) {
6309
- const r6 = readScalar(map, key);
6310
- if (r6 === void 0) return void 0;
6311
- return parsePairs(r6.value, r6.line);
6309
+ const r7 = readScalar(map, key);
6310
+ if (r7 === void 0) return void 0;
6311
+ return parsePairs(r7.value, r7.line);
6312
6312
  }
6313
6313
  function readReasons(map, key) {
6314
- const r6 = readScalar(map, key);
6315
- if (r6 === void 0) return void 0;
6316
- return parsePairs(r6.value, r6.line);
6314
+ const r7 = readScalar(map, key);
6315
+ if (r7 === void 0) return void 0;
6316
+ return parsePairs(r7.value, r7.line);
6317
6317
  }
6318
6318
  function readBlock(map, key) {
6319
6319
  const entry = map.get(key);
@@ -6641,7 +6641,7 @@ function runArithmeticValidation(ast) {
6641
6641
  }
6642
6642
  }
6643
6643
  if (ast.screening.excluded.reasons && ast.screening.excluded.reasons.length > 0) {
6644
- const sum = ast.screening.excluded.reasons.reduce((a, r6) => a + r6.count, 0);
6644
+ const sum = ast.screening.excluded.reasons.reduce((a, r7) => a + r7.count, 0);
6645
6645
  if (sum !== screenedExcluded) {
6646
6646
  issues.push(
6647
6647
  `screening.excluded reasons sum to ${formatN(sum)} but n = ${formatN(screenedExcluded)}`
@@ -6649,7 +6649,7 @@ function runArithmeticValidation(ast) {
6649
6649
  }
6650
6650
  }
6651
6651
  if (ast.eligibility.excluded.reasons && ast.eligibility.excluded.reasons.length > 0) {
6652
- const sum = ast.eligibility.excluded.reasons.reduce((a, r6) => a + r6.count, 0);
6652
+ const sum = ast.eligibility.excluded.reasons.reduce((a, r7) => a + r7.count, 0);
6653
6653
  if (sum !== eligExcluded) {
6654
6654
  issues.push(
6655
6655
  `eligibility.excluded reasons sum to ${formatN(sum)} but n = ${formatN(eligExcluded)}`
@@ -6742,7 +6742,7 @@ function aggregateReasons(reasons) {
6742
6742
  const sorted = [...reasons].sort((a, b) => b.count - a.count);
6743
6743
  const head = sorted.slice(0, PRISMA_CONST.MAX_REASON_LINES - 1);
6744
6744
  const tail = sorted.slice(PRISMA_CONST.MAX_REASON_LINES - 1);
6745
- const otherSum = tail.reduce((a, r6) => a + r6.count, 0);
6745
+ const otherSum = tail.reduce((a, r7) => a + r7.count, 0);
6746
6746
  return {
6747
6747
  lines: [...head, { name: `Other (${tail.length} reasons)`, count: otherSum }],
6748
6748
  truncated: tail.length
@@ -6799,8 +6799,8 @@ function buildIdentificationRemovedBox(id, kind) {
6799
6799
  }
6800
6800
  if (removed.length === 0) return null;
6801
6801
  const lines = [{ text: v.recordsRemovedLabel, style: "label" }];
6802
- for (const r6 of removed) {
6803
- lines.push({ text: r6, style: "reason", indent: 1 });
6802
+ for (const r7 of removed) {
6803
+ lines.push({ text: r7, style: "reason", indent: 1 });
6804
6804
  }
6805
6805
  return {
6806
6806
  role: "id-removed",
@@ -6856,8 +6856,8 @@ function buildScreeningExcludedBox(n, reasons, kind) {
6856
6856
  { text: v.recordsExcluded, style: "label" },
6857
6857
  { text: `n = ${nFmt(n)}`, style: "count" }
6858
6858
  ];
6859
- for (const r6 of items) {
6860
- out.push({ text: `${r6.name} (n = ${nFmt(r6.count)})`, style: "reason", indent: 1 });
6859
+ for (const r7 of items) {
6860
+ out.push({ text: `${r7.name} (n = ${nFmt(r7.count)})`, style: "reason", indent: 1 });
6861
6861
  }
6862
6862
  return {
6863
6863
  role: "screening-excluded",
@@ -6887,8 +6887,8 @@ function buildEligibilityExcludedBox(n, reasons, kind) {
6887
6887
  { text: v.reportsExcluded, style: "label" },
6888
6888
  { text: `n = ${nFmt(n)}`, style: "count" }
6889
6889
  ];
6890
- for (const r6 of items) {
6891
- out.push({ text: `${r6.name} (n = ${nFmt(r6.count)})`, style: "reason", indent: 1 });
6890
+ for (const r7 of items) {
6891
+ out.push({ text: `${r7.name} (n = ${nFmt(r7.count)})`, style: "reason", indent: 1 });
6892
6892
  }
6893
6893
  return {
6894
6894
  role: "eligibility-excluded",
@@ -7489,7 +7489,7 @@ function classForEdge(kind) {
7489
7489
  }
7490
7490
  }
7491
7491
  function renderBand(band) {
7492
- const r6 = chunk3WNW5Y7P_cjs.rect({
7492
+ const r7 = chunk3WNW5Y7P_cjs.rect({
7493
7493
  x: band.x,
7494
7494
  y: band.y,
7495
7495
  width: band.width,
@@ -7512,10 +7512,10 @@ function renderBand(band) {
7512
7512
  },
7513
7513
  band.label
7514
7514
  );
7515
- return chunk3WNW5Y7P_cjs.group({ "data-band": band.stage }, [r6, txt]);
7515
+ return chunk3WNW5Y7P_cjs.group({ "data-band": band.stage }, [r7, txt]);
7516
7516
  }
7517
7517
  function renderHeader(h) {
7518
- const r6 = chunk3WNW5Y7P_cjs.rect({
7518
+ const r7 = chunk3WNW5Y7P_cjs.rect({
7519
7519
  x: h.x,
7520
7520
  y: h.y,
7521
7521
  width: h.width,
@@ -7540,10 +7540,10 @@ function renderHeader(h) {
7540
7540
  ln
7541
7541
  )
7542
7542
  );
7543
- return chunk3WNW5Y7P_cjs.group({ "data-header": h.column }, [r6, ...lines]);
7543
+ return chunk3WNW5Y7P_cjs.group({ "data-header": h.column }, [r7, ...lines]);
7544
7544
  }
7545
7545
  function renderBox(box2) {
7546
- const r6 = chunk3WNW5Y7P_cjs.rect({
7546
+ const r7 = chunk3WNW5Y7P_cjs.rect({
7547
7547
  x: box2.x,
7548
7548
  y: box2.y,
7549
7549
  width: box2.width,
@@ -7601,7 +7601,7 @@ function renderBox(box2) {
7601
7601
  "data-prisma-variant": box2.variant,
7602
7602
  "data-prisma-stage": box2.stage
7603
7603
  },
7604
- [r6, ...textEls]
7604
+ [r7, ...textEls]
7605
7605
  );
7606
7606
  }
7607
7607
  function approxLineWidth(line2) {
@@ -8310,14 +8310,14 @@ function sizeEllipse(uc) {
8310
8310
  }
8311
8311
  function buildDeepEdges(ast, ucIds) {
8312
8312
  const edges = [];
8313
- for (const r6 of ast.relations) {
8314
- if (!ucIds.has(r6.source) || !ucIds.has(r6.target)) continue;
8315
- if (r6.kind === "include") {
8316
- edges.push({ from: r6.source, to: r6.target });
8317
- } else if (r6.kind === "extend") {
8318
- edges.push({ from: r6.target, to: r6.source });
8319
- } else if (r6.kind === "generalization") {
8320
- edges.push({ from: r6.source, to: r6.target });
8313
+ for (const r7 of ast.relations) {
8314
+ if (!ucIds.has(r7.source) || !ucIds.has(r7.target)) continue;
8315
+ if (r7.kind === "include") {
8316
+ edges.push({ from: r7.source, to: r7.target });
8317
+ } else if (r7.kind === "extend") {
8318
+ edges.push({ from: r7.target, to: r7.source });
8319
+ } else if (r7.kind === "generalization") {
8320
+ edges.push({ from: r7.source, to: r7.target });
8321
8321
  }
8322
8322
  }
8323
8323
  return edges;
@@ -8345,15 +8345,15 @@ function classifyActorSides(ast) {
8345
8345
  ast.actors.forEach((a, i) => idx.set(a.id, i));
8346
8346
  const parent = /* @__PURE__ */ new Map();
8347
8347
  const find = (x) => {
8348
- let r6 = x;
8349
- while ((parent.get(r6) ?? r6) !== r6) r6 = parent.get(r6) ?? r6;
8348
+ let r7 = x;
8349
+ while ((parent.get(r7) ?? r7) !== r7) r7 = parent.get(r7) ?? r7;
8350
8350
  let c = x;
8351
8351
  while ((parent.get(c) ?? c) !== c) {
8352
8352
  const next = parent.get(c) ?? c;
8353
- parent.set(c, r6);
8353
+ parent.set(c, r7);
8354
8354
  c = next;
8355
8355
  }
8356
- return r6;
8356
+ return r7;
8357
8357
  };
8358
8358
  const union = (a, b) => {
8359
8359
  const ra = find(a);
@@ -8363,9 +8363,9 @@ function classifyActorSides(ast) {
8363
8363
  else parent.set(ra, rb);
8364
8364
  };
8365
8365
  for (const a of ast.actors) parent.set(a.id, a.id);
8366
- for (const r6 of ast.relations) {
8367
- if (r6.kind === "generalization" && actorIds.has(r6.source) && actorIds.has(r6.target)) {
8368
- union(r6.source, r6.target);
8366
+ for (const r7 of ast.relations) {
8367
+ if (r7.kind === "generalization" && actorIds.has(r7.source) && actorIds.has(r7.target)) {
8368
+ union(r7.source, r7.target);
8369
8369
  }
8370
8370
  }
8371
8371
  const baseSide = (a, i) => a.side === "left" ? "left" : a.side === "right" ? "right" : i === 0 ? "left" : "right";
@@ -8400,10 +8400,10 @@ function layoutUsecase(ast) {
8400
8400
  const sides = classifyActorSides(ast);
8401
8401
  const connectedActors = /* @__PURE__ */ new Map();
8402
8402
  for (const u of ast.usecases) connectedActors.set(u.id, []);
8403
- for (const r6 of ast.relations) {
8404
- if (r6.kind !== "association" && r6.kind !== "directed") continue;
8405
- const aId = actorById.has(r6.source) ? r6.source : actorById.has(r6.target) ? r6.target : null;
8406
- const uId = ucIds.has(r6.source) ? r6.source : ucIds.has(r6.target) ? r6.target : null;
8403
+ for (const r7 of ast.relations) {
8404
+ if (r7.kind !== "association" && r7.kind !== "directed") continue;
8405
+ const aId = actorById.has(r7.source) ? r7.source : actorById.has(r7.target) ? r7.target : null;
8406
+ const uId = ucIds.has(r7.source) ? r7.source : ucIds.has(r7.target) ? r7.target : null;
8407
8407
  if (aId && uId) connectedActors.get(uId).push(aId);
8408
8408
  }
8409
8409
  const columns = [];
@@ -8442,10 +8442,10 @@ function layoutUsecase(ast) {
8442
8442
  });
8443
8443
  let prev = -Infinity;
8444
8444
  for (const u of col) {
8445
- let r6 = rowPos.get(u.id);
8446
- if (r6 <= prev) r6 = prev + 1;
8447
- rowPos.set(u.id, r6);
8448
- prev = r6;
8445
+ let r7 = rowPos.get(u.id);
8446
+ if (r7 <= prev) r7 = prev + 1;
8447
+ rowPos.set(u.id, r7);
8448
+ prev = r7;
8449
8449
  }
8450
8450
  }
8451
8451
  const colMaxRx = columns.map(
@@ -8591,10 +8591,10 @@ function layoutUsecase(ast) {
8591
8591
  const edges = [];
8592
8592
  const trees = [];
8593
8593
  const genByParent = /* @__PURE__ */ new Map();
8594
- for (const r6 of ast.relations) {
8595
- if (r6.kind !== "generalization") continue;
8596
- if (!genByParent.has(r6.target)) genByParent.set(r6.target, []);
8597
- genByParent.get(r6.target).push(r6);
8594
+ for (const r7 of ast.relations) {
8595
+ if (r7.kind !== "generalization") continue;
8596
+ if (!genByParent.has(r7.target)) genByParent.set(r7.target, []);
8597
+ genByParent.get(r7.target).push(r7);
8598
8598
  }
8599
8599
  const handledGen = /* @__PURE__ */ new Set();
8600
8600
  function nodeCenter(id) {
@@ -8628,11 +8628,11 @@ function layoutUsecase(ast) {
8628
8628
  }
8629
8629
  for (const [parentId, rels] of genByParent) {
8630
8630
  const useTree = ast.generalizationTree && rels.length >= C2.GEN_TREE_THRESHOLD;
8631
- const allActors = actorById2.has(parentId) && rels.every((r6) => actorById2.has(r6.source));
8631
+ const allActors = actorById2.has(parentId) && rels.every((r7) => actorById2.has(r7.source));
8632
8632
  if (allActors) {
8633
8633
  const side = sides.get(parentId) ?? "left";
8634
8634
  const pAnchor = actorGenAnchor(parentId, side);
8635
- const childAnchors = rels.map((r6) => ({ r: r6, p: actorGenAnchor(r6.source, side) }));
8635
+ const childAnchors = rels.map((r7) => ({ r: r7, p: actorGenAnchor(r7.source, side) }));
8636
8636
  const xs = [pAnchor.x, ...childAnchors.map((c) => c.p.x)];
8637
8637
  const ys = [pAnchor.y, ...childAnchors.map((c) => c.p.y)];
8638
8638
  const busX = side === "left" ? Math.min(...xs) - 20 : Math.max(...xs) + 20;
@@ -8648,7 +8648,7 @@ function layoutUsecase(ast) {
8648
8648
  }
8649
8649
  trees.push({
8650
8650
  parentId,
8651
- childIds: rels.map((r6) => r6.source),
8651
+ childIds: rels.map((r7) => r7.source),
8652
8652
  stemX: busX,
8653
8653
  stemTop: minY2,
8654
8654
  stemBottom: maxY2,
@@ -8671,7 +8671,7 @@ function layoutUsecase(ast) {
8671
8671
  if (!useTree) continue;
8672
8672
  const parent = nodeCenter(parentId);
8673
8673
  if (!parent) continue;
8674
- const childCenters = rels.map((r6) => nodeCenter(r6.source)).filter((c) => c !== null);
8674
+ const childCenters = rels.map((r7) => nodeCenter(r7.source)).filter((c) => c !== null);
8675
8675
  if (childCenters.length === 0) continue;
8676
8676
  const avgX = childCenters.reduce((s, c) => s + c.cx, 0) / childCenters.length;
8677
8677
  const avgY = childCenters.reduce((s, c) => s + c.cy, 0) / childCenters.length;
@@ -8682,14 +8682,14 @@ function layoutUsecase(ast) {
8682
8682
  const jx = pPt.x + dirX / len * C2.GEN_JUNCTION_OFFSET;
8683
8683
  const jy = pPt.y + dirY / len * C2.GEN_JUNCTION_OFFSET;
8684
8684
  const legPaths = [];
8685
- for (const r6 of rels) {
8686
- const cPt = perimeter(r6.source, jx, jy);
8685
+ for (const r7 of rels) {
8686
+ const cPt = perimeter(r7.source, jx, jy);
8687
8687
  legPaths.push(`M ${round3(cPt.x)} ${round3(cPt.y)} L ${round3(jx)} ${round3(jy)}`);
8688
- handledGen.add(r6);
8688
+ handledGen.add(r7);
8689
8689
  }
8690
8690
  trees.push({
8691
8691
  parentId,
8692
- childIds: rels.map((r6) => r6.source),
8692
+ childIds: rels.map((r7) => r7.source),
8693
8693
  stemX: jx,
8694
8694
  stemTop: jy,
8695
8695
  stemBottom: jy,
@@ -8697,72 +8697,72 @@ function layoutUsecase(ast) {
8697
8697
  legPaths
8698
8698
  });
8699
8699
  }
8700
- for (const r6 of ast.relations) {
8701
- if (handledGen.has(r6)) continue;
8702
- const a = nodeCenter(r6.source);
8703
- const b = nodeCenter(r6.target);
8700
+ for (const r7 of ast.relations) {
8701
+ if (handledGen.has(r7)) continue;
8702
+ const a = nodeCenter(r7.source);
8703
+ const b = nodeCenter(r7.target);
8704
8704
  if (!a || !b) continue;
8705
- if (r6.kind === "generalization" && actorById2.has(r6.source) && actorById2.has(r6.target)) {
8706
- const side = sides.get(r6.target) ?? "left";
8707
- const pAnchor = actorGenAnchor(r6.target, side);
8708
- const cAnchor = actorGenAnchor(r6.source, side);
8705
+ if (r7.kind === "generalization" && actorById2.has(r7.source) && actorById2.has(r7.target)) {
8706
+ const side = sides.get(r7.target) ?? "left";
8707
+ const pAnchor = actorGenAnchor(r7.target, side);
8708
+ const cAnchor = actorGenAnchor(r7.source, side);
8709
8709
  const busX = side === "left" ? Math.min(pAnchor.x, cAnchor.x) - 20 : Math.max(pAnchor.x, cAnchor.x) + 20;
8710
8710
  edges.push({
8711
- relation: r6,
8711
+ relation: r7,
8712
8712
  d: `M ${round3(cAnchor.x)} ${round3(cAnchor.y)} L ${round3(busX)} ${round3(cAnchor.y)} L ${round3(busX)} ${round3(pAnchor.y)} L ${round3(pAnchor.x)} ${round3(pAnchor.y)}`,
8713
8713
  arrowKind: "hollow",
8714
8714
  dashed: false
8715
8715
  });
8716
8716
  continue;
8717
8717
  }
8718
- const srcActor = actorById2.get(r6.source);
8719
- const tgtActor = actorById2.get(r6.target);
8718
+ const srcActor = actorById2.get(r7.source);
8719
+ const tgtActor = actorById2.get(r7.target);
8720
8720
  let pa;
8721
8721
  let pb;
8722
8722
  if (srcActor && !tgtActor) {
8723
8723
  pa = { x: srcActor.anchorX, y: srcActor.anchorY };
8724
- pb = perimeter(r6.target, pa.x, pa.y);
8724
+ pb = perimeter(r7.target, pa.x, pa.y);
8725
8725
  } else if (tgtActor && !srcActor) {
8726
8726
  pb = { x: tgtActor.anchorX, y: tgtActor.anchorY };
8727
- pa = perimeter(r6.source, pb.x, pb.y);
8727
+ pa = perimeter(r7.source, pb.x, pb.y);
8728
8728
  } else {
8729
- pa = perimeter(r6.source, b.cx, b.cy);
8730
- pb = perimeter(r6.target, a.cx, a.cy);
8729
+ pa = perimeter(r7.source, b.cx, b.cy);
8730
+ pb = perimeter(r7.target, a.cx, a.cy);
8731
8731
  }
8732
- const dashed = r6.kind === "include" || r6.kind === "extend";
8732
+ const dashed = r7.kind === "include" || r7.kind === "extend";
8733
8733
  let arrowKind2 = "none";
8734
- if (r6.kind === "directed" || r6.kind === "include" || r6.kind === "extend") arrowKind2 = "open";
8735
- else if (r6.kind === "generalization") arrowKind2 = "hollow";
8734
+ if (r7.kind === "directed" || r7.kind === "include" || r7.kind === "extend") arrowKind2 = "open";
8735
+ else if (r7.kind === "generalization") arrowKind2 = "hollow";
8736
8736
  const edge = {
8737
- relation: r6,
8737
+ relation: r7,
8738
8738
  d: `M ${round3(pa.x)} ${round3(pa.y)} L ${round3(pb.x)} ${round3(pb.y)}`,
8739
8739
  arrowKind: arrowKind2,
8740
8740
  dashed
8741
8741
  };
8742
- if (r6.kind === "include" || r6.kind === "extend") {
8742
+ if (r7.kind === "include" || r7.kind === "extend") {
8743
8743
  const rows = [];
8744
- const keyword = r6.kind === "include" ? "include" : "extend";
8745
- rows.push(`\xAB${r6.stereotype ?? keyword}\xBB`);
8746
- if (r6.condition) rows.push(`[${r6.condition}]`);
8747
- if (r6.extensionPointRef) rows.push(`(extension point: ${r6.extensionPointRef})`);
8744
+ const keyword = r7.kind === "include" ? "include" : "extend";
8745
+ rows.push(`\xAB${r7.stereotype ?? keyword}\xBB`);
8746
+ if (r7.condition) rows.push(`[${r7.condition}]`);
8747
+ if (r7.extensionPointRef) rows.push(`(extension point: ${r7.extensionPointRef})`);
8748
8748
  const label = {
8749
8749
  rows,
8750
8750
  cx: (pa.x + pb.x) / 2,
8751
8751
  cy: (pa.y + pb.y) / 2
8752
8752
  };
8753
8753
  edge.label = label;
8754
- } else if ((r6.kind === "association" || r6.kind === "directed") && r6.stereotype) {
8754
+ } else if ((r7.kind === "association" || r7.kind === "directed") && r7.stereotype) {
8755
8755
  edge.label = {
8756
- rows: [`\xAB${r6.stereotype}\xBB`],
8756
+ rows: [`\xAB${r7.stereotype}\xBB`],
8757
8757
  cx: (pa.x + pb.x) / 2,
8758
8758
  cy: (pa.y + pb.y) / 2
8759
8759
  };
8760
8760
  }
8761
- if (r6.sourceMultiplicity) {
8762
- edge.multiplicityFrom = placeMultiplicity(pa, pb, r6.sourceMultiplicity);
8761
+ if (r7.sourceMultiplicity) {
8762
+ edge.multiplicityFrom = placeMultiplicity(pa, pb, r7.sourceMultiplicity);
8763
8763
  }
8764
- if (r6.targetMultiplicity) {
8765
- edge.multiplicityTo = placeMultiplicity(pb, pa, r6.targetMultiplicity);
8764
+ if (r7.targetMultiplicity) {
8765
+ edge.multiplicityTo = placeMultiplicity(pb, pa, r7.targetMultiplicity);
8766
8766
  }
8767
8767
  edges.push(edge);
8768
8768
  }
@@ -9017,7 +9017,7 @@ function renderEdgeLabel(e) {
9017
9017
  const rows = e.label.rows;
9018
9018
  const lineH = 12;
9019
9019
  const totalH = rows.length * lineH;
9020
- const widest = rows.reduce((m, r6) => Math.max(m, r6.length), 0);
9020
+ const widest = rows.reduce((m, r7) => Math.max(m, r7.length), 0);
9021
9021
  const pillW = widest * 6 + 8;
9022
9022
  const pillH = totalH + 4;
9023
9023
  const startY = e.label.cy - totalH / 2 + 9;
@@ -9033,7 +9033,7 @@ function renderEdgeLabel(e) {
9033
9033
  ry: 4
9034
9034
  })
9035
9035
  ];
9036
- rows.forEach((r6, i) => {
9036
+ rows.forEach((r7, i) => {
9037
9037
  parts.push(
9038
9038
  chunk3WNW5Y7P_cjs.text(
9039
9039
  {
@@ -9042,7 +9042,7 @@ function renderEdgeLabel(e) {
9042
9042
  y: startY + i * lineH,
9043
9043
  "text-anchor": "middle"
9044
9044
  },
9045
- r6
9045
+ r7
9046
9046
  )
9047
9047
  );
9048
9048
  });
@@ -9082,8 +9082,8 @@ function renderTree(tr) {
9082
9082
  function renderUsecaseLayout(layout, config) {
9083
9083
  const t = chunkENUM7GMZ_cjs.resolveBaseTheme(config?.theme ?? "default");
9084
9084
  const children = [];
9085
- const nInclude = layout.ast.relations.filter((r6) => r6.kind === "include").length;
9086
- const nExtend = layout.ast.relations.filter((r6) => r6.kind === "extend").length;
9085
+ const nInclude = layout.ast.relations.filter((r7) => r7.kind === "include").length;
9086
+ const nExtend = layout.ast.relations.filter((r7) => r7.kind === "extend").length;
9087
9087
  children.push(chunk3WNW5Y7P_cjs.title(`Use Case Diagram${layout.title ? " \u2014 " + layout.title : ""}`));
9088
9088
  children.push(
9089
9089
  chunk3WNW5Y7P_cjs.desc(
@@ -9260,8 +9260,8 @@ function parseHeaderLine(ln, ast) {
9260
9260
  }
9261
9261
  case "layout": {
9262
9262
  const l = value.toLowerCase();
9263
- if (l !== "network" && l !== "timescaled" && l !== "aoa") {
9264
- throw new PertParseError(`layout must be network, timescaled, or aoa (got '${value}')`, ln.line);
9263
+ if (l !== "network" && l !== "timescaled" && l !== "aoa" && l !== "gantt") {
9264
+ throw new PertParseError(`layout must be network, timescaled, aoa, or gantt (got '${value}')`, ln.line);
9265
9265
  }
9266
9266
  ast.layout = l;
9267
9267
  return true;
@@ -9272,6 +9272,26 @@ function parseHeaderLine(ln, ast) {
9272
9272
  case "show-sentinels":
9273
9273
  ast.showSentinels = /^(true|yes|on)$/i.test(value);
9274
9274
  return true;
9275
+ case "start":
9276
+ if (!/^\d{4}-\d{2}-\d{2}$/.test(value)) {
9277
+ throw new PertParseError(`start must be a date 'YYYY-MM-DD' (got '${value}')`, ln.line);
9278
+ }
9279
+ ast.start = value;
9280
+ return true;
9281
+ case "calendar": {
9282
+ const c = value.toLowerCase();
9283
+ if (c !== "continuous" && c !== "5day" && c !== "7day") {
9284
+ throw new PertParseError(`calendar must be continuous, 7day, or 5day (got '${value}')`, ln.line);
9285
+ }
9286
+ ast.calendar = c === "5day" ? "5day" : "continuous";
9287
+ return true;
9288
+ }
9289
+ case "today":
9290
+ if (!/^\d{4}-\d{2}-\d{2}$/.test(value)) {
9291
+ throw new PertParseError(`today must be a date 'YYYY-MM-DD' (got '${value}')`, ln.line);
9292
+ }
9293
+ ast.today = value;
9294
+ return true;
9275
9295
  default:
9276
9296
  return false;
9277
9297
  }
@@ -9336,7 +9356,7 @@ function parseDepRef(raw, unit, lineNo) {
9336
9356
  }
9337
9357
  throw new PertParseError(`cannot parse predecessor reference '${ref}'`, lineNo);
9338
9358
  }
9339
- var KEY_RE = /\b(duration|after|tags|class|lane)\s*:/gi;
9359
+ var KEY_RE = /\b(duration|after|tags|class|lane|progress|done)\s*:/gi;
9340
9360
  function parseTaskLine(ln, ast) {
9341
9361
  const head = ln.text.match(/^task\s+(\S+)\s*(.*)$/i);
9342
9362
  if (!head) {
@@ -9411,6 +9431,13 @@ function parseTaskLine(ln, ast) {
9411
9431
  const tags = values.tags ? values.tags.split(",").map((t) => t.trim()).filter(Boolean) : [];
9412
9432
  const className = values.class ? values.class.trim() : void 0;
9413
9433
  const lane = values.lane ? stripQuotes3(values.lane) : void 0;
9434
+ const progressRaw = values.progress ?? values.done;
9435
+ let progress;
9436
+ if (progressRaw !== void 0 && progressRaw !== "") {
9437
+ const pct = progressRaw.trim().replace(/%$/, "");
9438
+ const n = parseNumber(pct, ln.line, "progress");
9439
+ progress = Math.max(0, Math.min(100, n));
9440
+ }
9414
9441
  const task = {
9415
9442
  id,
9416
9443
  label,
@@ -9424,6 +9451,7 @@ function parseTaskLine(ln, ast) {
9424
9451
  if (variance !== void 0) task.variance = variance;
9425
9452
  if (className) task.className = className;
9426
9453
  if (lane) task.lane = lane;
9454
+ if (progress !== void 0) task.progress = progress;
9427
9455
  ast.tasks.push(task);
9428
9456
  }
9429
9457
  function parsePert(src) {
@@ -9434,18 +9462,21 @@ function parsePert(src) {
9434
9462
  layout: "network",
9435
9463
  criticalTolerance: 0,
9436
9464
  showSentinels: false,
9465
+ calendar: "continuous",
9437
9466
  tasks: [],
9438
9467
  warnings: []
9439
9468
  };
9440
9469
  const lines = preprocess8(src);
9441
9470
  if (lines.length === 0) {
9442
- throw new PertParseError("empty document \u2014 expected 'pert' header", 1);
9471
+ throw new PertParseError("empty document \u2014 expected 'pert' or 'gantt' header", 1);
9443
9472
  }
9444
9473
  const first = lines[0];
9445
- if (!/^pert\b/i.test(first.text)) {
9446
- throw new PertParseError(`first non-comment line must start with 'pert' (got: ${first.text})`, first.line);
9474
+ if (!/^(pert|gantt)\b/i.test(first.text)) {
9475
+ throw new PertParseError(`first non-comment line must start with 'pert' or 'gantt' (got: ${first.text})`, first.line);
9447
9476
  }
9448
- const inlineTitle = first.text.replace(/^pert\b/i, "").trim();
9477
+ const isGanttHeader = /^gantt\b/i.test(first.text);
9478
+ if (isGanttHeader) ast.layout = "gantt";
9479
+ const inlineTitle = first.text.replace(/^(pert|gantt)\b/i, "").trim();
9449
9480
  if (inlineTitle) {
9450
9481
  const m = inlineTitle.match(/^"([^"]+)"$/) || inlineTitle.match(/^'([^']+)'$/);
9451
9482
  if (m) ast.title = m[1];
@@ -9831,12 +9862,12 @@ function layoutAoa(ast, schedule) {
9831
9862
  const predEvents = (e) => inAdj[e].map((ai) => arcs[ai].from);
9832
9863
  const succEvents = (e) => outAdj[e].map((ai) => arcs[ai].to);
9833
9864
  for (let iter = 0; iter < 4; iter++) {
9834
- for (let r6 = 1; r6 <= maxRank; r6++) {
9835
- layers[r6] = sortByBary(layers[r6], predEvents, pos);
9865
+ for (let r7 = 1; r7 <= maxRank; r7++) {
9866
+ layers[r7] = sortByBary(layers[r7], predEvents, pos);
9836
9867
  refresh(layers, pos);
9837
9868
  }
9838
- for (let r6 = maxRank - 1; r6 >= 0; r6--) {
9839
- layers[r6] = sortByBary(layers[r6], succEvents, pos);
9869
+ for (let r7 = maxRank - 1; r7 >= 0; r7--) {
9870
+ layers[r7] = sortByBary(layers[r7], succEvents, pos);
9840
9871
  refresh(layers, pos);
9841
9872
  }
9842
9873
  }
@@ -9846,12 +9877,12 @@ function layoutAoa(ast, schedule) {
9846
9877
  const contentH = (maxRows - 1) * AOA.VGAP + 2 * AOA.R;
9847
9878
  const cx = new Array(nEvents).fill(0);
9848
9879
  const cy = new Array(nEvents).fill(0);
9849
- for (let r6 = 0; r6 <= maxRank; r6++) {
9850
- const layer = layers[r6];
9880
+ for (let r7 = 0; r7 <= maxRank; r7++) {
9881
+ const layer = layers[r7];
9851
9882
  const colH = (layer.length - 1) * AOA.VGAP;
9852
9883
  const y0 = topY + AOA.R + (contentH - 2 * AOA.R - colH) / 2;
9853
9884
  layer.forEach((e, i) => {
9854
- cx[e] = AOA.PAD + AOA.R + r6 * AOA.COL;
9885
+ cx[e] = AOA.PAD + AOA.R + r7 * AOA.COL;
9855
9886
  cy[e] = y0 + i * AOA.VGAP;
9856
9887
  });
9857
9888
  }
@@ -9913,16 +9944,16 @@ function sortByBary(layer, neighbors, pos) {
9913
9944
  return { e, i, bary };
9914
9945
  }).sort((a, b) => a.bary !== b.bary ? a.bary - b.bary : a.i - b.i).map((x) => x.e);
9915
9946
  }
9916
- function arcGeometry(tx, ty, hx, hy, r6) {
9947
+ function arcGeometry(tx, ty, hx, hy, r7) {
9917
9948
  const dx = hx - tx;
9918
9949
  const dy = hy - ty;
9919
9950
  const len = Math.hypot(dx, dy) || 1;
9920
9951
  const ux = dx / len;
9921
9952
  const uy = dy / len;
9922
- const sx = tx + ux * r6;
9923
- const sy = ty + uy * r6;
9924
- const ex = hx - ux * r6;
9925
- const ey = hy - uy * r6;
9953
+ const sx = tx + ux * r7;
9954
+ const sy = ty + uy * r7;
9955
+ const ex = hx - ux * r7;
9956
+ const ey = hy - uy * r7;
9926
9957
  return { d: `M ${round5(sx)} ${round5(sy)} L ${round5(ex)} ${round5(ey)}`, mx: (sx + ex) / 2, my: (sy + ey) / 2 };
9927
9958
  }
9928
9959
  function buildAoaSummary(ast, sched) {
@@ -9995,11 +10026,11 @@ function assignRanks(ast) {
9995
10026
  if (visiting.has(id)) return 0;
9996
10027
  visiting.add(id);
9997
10028
  const t = byId.get(id);
9998
- let r6 = 0;
9999
- for (const dep of t.deps) r6 = Math.max(r6, compute(dep.pred) + 1);
10029
+ let r7 = 0;
10030
+ for (const dep of t.deps) r7 = Math.max(r7, compute(dep.pred) + 1);
10000
10031
  visiting.delete(id);
10001
- rank.set(id, r6);
10002
- return r6;
10032
+ rank.set(id, r7);
10033
+ return r7;
10003
10034
  };
10004
10035
  let maxRank = 0;
10005
10036
  for (const t of ast.tasks) maxRank = Math.max(maxRank, compute(t.id));
@@ -10045,15 +10076,15 @@ function orderLayers(ast, schedule, rank, maxRank) {
10045
10076
  return s / neighbors.length;
10046
10077
  };
10047
10078
  for (let iter = 0; iter < 4; iter++) {
10048
- for (let r6 = 1; r6 <= maxRank; r6++) {
10049
- layers[r6] = stableSortByKey(layers[r6], (id) => {
10079
+ for (let r7 = 1; r7 <= maxRank; r7++) {
10080
+ layers[r7] = stableSortByKey(layers[r7], (id) => {
10050
10081
  const bc = barycenter(id, pred.get(id));
10051
10082
  return crit(id) ? bc - 0.4 : bc;
10052
10083
  });
10053
10084
  refreshPos();
10054
10085
  }
10055
- for (let r6 = maxRank - 1; r6 >= 0; r6--) {
10056
- layers[r6] = stableSortByKey(layers[r6], (id) => {
10086
+ for (let r7 = maxRank - 1; r7 >= 0; r7--) {
10087
+ layers[r7] = stableSortByKey(layers[r7], (id) => {
10057
10088
  const bc = barycenter(id, succ.get(id));
10058
10089
  return crit(id) ? bc - 0.4 : bc;
10059
10090
  });
@@ -10105,9 +10136,9 @@ function layoutNetwork(ast, schedule) {
10105
10136
  const originCross = dir === "TB" ? C2.PAD : C2.PAD + titleH;
10106
10137
  const boxes = [];
10107
10138
  const boxById = /* @__PURE__ */ new Map();
10108
- for (let r6 = 0; r6 <= maxRank; r6++) {
10109
- const layer = layers[r6];
10110
- const extent = colExtent[r6];
10139
+ for (let r7 = 0; r7 <= maxRank; r7++) {
10140
+ const layer = layers[r7];
10141
+ const extent = colExtent[r7];
10111
10142
  const crossStart = originCross + (maxExtent - extent) / 2;
10112
10143
  let cursor = crossStart;
10113
10144
  for (const id of layer) {
@@ -10118,12 +10149,12 @@ function layoutNetwork(ast, schedule) {
10118
10149
  let x;
10119
10150
  let y;
10120
10151
  if (dir === "TB") {
10121
- const rankPos = originPrimary + r6 * (C2.BOX_H + C2.H_GAP);
10152
+ const rankPos = originPrimary + r7 * (C2.BOX_H + C2.H_GAP);
10122
10153
  x = cursor + (C2.BOX_W - w) / 2;
10123
10154
  y = rankPos;
10124
10155
  cursor += C2.BOX_W + C2.H_GAP;
10125
10156
  } else {
10126
- const rankPos = originPrimary + r6 * (C2.BOX_W + C2.H_GAP);
10157
+ const rankPos = originPrimary + r7 * (C2.BOX_W + C2.H_GAP);
10127
10158
  x = rankPos + (C2.BOX_W - w) / 2;
10128
10159
  y = cursor;
10129
10160
  cursor += C2.BOX_H + C2.V_GAP;
@@ -10137,7 +10168,7 @@ function layoutNetwork(ast, schedule) {
10137
10168
  width: w,
10138
10169
  height: h,
10139
10170
  milestone: t.milestone,
10140
- rank: r6
10171
+ rank: r7
10141
10172
  };
10142
10173
  boxes.push(box2);
10143
10174
  boxById.set(id, box2);
@@ -10297,7 +10328,7 @@ function layoutSwimlane2(ast, schedule) {
10297
10328
  const crit = (id) => schedule.computed.get(id).critical;
10298
10329
  const es = (id) => schedule.computed.get(id).es;
10299
10330
  const cell = /* @__PURE__ */ new Map();
10300
- const key = (lane, r6) => `${lane}\0${r6}`;
10331
+ const key = (lane, r7) => `${lane}\0${r7}`;
10301
10332
  for (const t of ast.tasks) {
10302
10333
  const k = key(laneOf.get(t.id), rank.get(t.id));
10303
10334
  if (!cell.has(k)) cell.set(k, []);
@@ -10314,15 +10345,15 @@ function layoutSwimlane2(ast, schedule) {
10314
10345
  }
10315
10346
  const titleH = ast.title ? C2.TITLE_H : 0;
10316
10347
  const topY = C2.PAD + titleH;
10317
- const colX = (r6) => C2.LANE_LABEL_W + C2.PAD + r6 * (C2.BOX_W + C2.H_GAP);
10348
+ const colX = (r7) => C2.LANE_LABEL_W + C2.PAD + r7 * (C2.BOX_W + C2.H_GAP);
10318
10349
  const lanes = [];
10319
10350
  const laneY = /* @__PURE__ */ new Map();
10320
10351
  const laneH = /* @__PURE__ */ new Map();
10321
10352
  let cursor = topY;
10322
10353
  laneOrder.forEach((lane, i) => {
10323
10354
  let stack = 1;
10324
- for (let r6 = 0; r6 <= maxRank; r6++) {
10325
- const arr = cell.get(key(lane, r6));
10355
+ for (let r7 = 0; r7 <= maxRank; r7++) {
10356
+ const arr = cell.get(key(lane, r7));
10326
10357
  if (arr) stack = Math.max(stack, arr.length);
10327
10358
  }
10328
10359
  const bandH = stack * C2.BOX_H + (stack - 1) * C2.V_GAP + 2 * C2.LANE_PAD;
@@ -10337,15 +10368,15 @@ function layoutSwimlane2(ast, schedule) {
10337
10368
  for (const lane of laneOrder) {
10338
10369
  const bandTop = laneY.get(lane);
10339
10370
  const bandH = laneH.get(lane);
10340
- for (let r6 = 0; r6 <= maxRank; r6++) {
10341
- const arr = cell.get(key(lane, r6));
10371
+ for (let r7 = 0; r7 <= maxRank; r7++) {
10372
+ const arr = cell.get(key(lane, r7));
10342
10373
  if (!arr) continue;
10343
10374
  const colInnerH = arr.length * C2.BOX_H + (arr.length - 1) * C2.V_GAP;
10344
10375
  const y0 = bandTop + (bandH - colInnerH) / 2;
10345
10376
  arr.forEach((id, idx) => {
10346
10377
  const t = byId.get(id);
10347
10378
  const w = t.milestone ? C2.MS_W : C2.BOX_W;
10348
- const x = colX(r6) + (C2.BOX_W - w) / 2;
10379
+ const x = colX(r7) + (C2.BOX_W - w) / 2;
10349
10380
  const y = y0 + idx * (C2.BOX_H + C2.V_GAP);
10350
10381
  const box2 = {
10351
10382
  id,
@@ -10356,7 +10387,7 @@ function layoutSwimlane2(ast, schedule) {
10356
10387
  width: w,
10357
10388
  height: C2.BOX_H,
10358
10389
  milestone: t.milestone,
10359
- rank: r6
10390
+ rank: r7
10360
10391
  };
10361
10392
  boxes.push(box2);
10362
10393
  boxById.set(id, box2);
@@ -10525,10 +10556,381 @@ function layoutPert(ast, schedule) {
10525
10556
  return layoutNetwork(ast, sched);
10526
10557
  }
10527
10558
 
10528
- // src/diagrams/pert/renderer.ts
10559
+ // src/diagrams/pert/gantt.ts
10560
+ var PALETTES = {
10561
+ default: {
10562
+ bar: "#cfe0f5",
10563
+ barStroke: "#5b85c0",
10564
+ barDone: "#5b85c0",
10565
+ critBar: "#fbe6e0",
10566
+ critStroke: "#d2604f",
10567
+ critDone: "#d2604f",
10568
+ milestone: "#3c5a80",
10569
+ text: "#234567",
10570
+ subtext: "#728198",
10571
+ axis: "#8497ad",
10572
+ grid: "#e3eaf3",
10573
+ sectionBand: "#eef3fa",
10574
+ sectionText: "#41597a",
10575
+ dep: "#9fb0c6",
10576
+ today: "#d2604f"
10577
+ },
10578
+ monochrome: {
10579
+ bar: "#ffffff",
10580
+ barStroke: "#000000",
10581
+ barDone: "#9a9a9a",
10582
+ critBar: "#ffffff",
10583
+ critStroke: "#000000",
10584
+ critDone: "#000000",
10585
+ milestone: "#000000",
10586
+ text: "#000000",
10587
+ subtext: "#555555",
10588
+ axis: "#000000",
10589
+ grid: "#dddddd",
10590
+ sectionBand: "#f2f2f2",
10591
+ sectionText: "#000000",
10592
+ dep: "#888888",
10593
+ today: "#000000"
10594
+ },
10595
+ dark: {
10596
+ bar: "#37506e",
10597
+ barStroke: "#89b4fa",
10598
+ barDone: "#89b4fa",
10599
+ critBar: "#5a3540",
10600
+ critStroke: "#f38ba8",
10601
+ critDone: "#f38ba8",
10602
+ milestone: "#bac2de",
10603
+ text: "#cdd6f4",
10604
+ subtext: "#9399b2",
10605
+ axis: "#7f849c",
10606
+ grid: "#313244",
10607
+ sectionBand: "#272838",
10608
+ sectionText: "#bac2de",
10609
+ dep: "#6c7086",
10610
+ today: "#f38ba8"
10611
+ }
10612
+ };
10613
+ function ymdToDays(y, m, d) {
10614
+ const yy = m <= 2 ? y - 1 : y;
10615
+ const era = Math.floor((yy >= 0 ? yy : yy - 399) / 400);
10616
+ const yoe = yy - era * 400;
10617
+ const doy = Math.floor((153 * (m > 2 ? m - 3 : m + 9) + 2) / 5) + d - 1;
10618
+ const doe = yoe * 365 + Math.floor(yoe / 4) - Math.floor(yoe / 100) + doy;
10619
+ return era * 146097 + doe - 719468;
10620
+ }
10621
+ function daysToYmd(z) {
10622
+ const zz = z + 719468;
10623
+ const era = Math.floor((zz >= 0 ? zz : zz - 146096) / 146097);
10624
+ const doe = zz - era * 146097;
10625
+ const yoe = Math.floor((doe - Math.floor(doe / 1460) + Math.floor(doe / 36524) - Math.floor(doe / 146096)) / 365);
10626
+ const y = yoe + era * 400;
10627
+ const doy = doe - (365 * yoe + Math.floor(yoe / 4) - Math.floor(yoe / 100));
10628
+ const mp = Math.floor((5 * doy + 2) / 153);
10629
+ const d = doy - Math.floor((153 * mp + 2) / 5) + 1;
10630
+ const m = mp < 10 ? mp + 3 : mp - 9;
10631
+ return { y: m <= 2 ? y + 1 : y, m, d };
10632
+ }
10633
+ function parseISODays(s) {
10634
+ const [y, m, d] = s.split("-").map(Number);
10635
+ return ymdToDays(y, m, d);
10636
+ }
10637
+ function dow(days) {
10638
+ return (days % 7 + 4 + 7e3) % 7;
10639
+ }
10640
+ function isWeekend(days) {
10641
+ const w = dow(days);
10642
+ return w === 0 || w === 6;
10643
+ }
10644
+ function advanceWorking(startDays, n) {
10645
+ let cur = startDays;
10646
+ let left = Math.round(n);
10647
+ const step = left >= 0 ? 1 : -1;
10648
+ left = Math.abs(left);
10649
+ while (left > 0) {
10650
+ cur += step;
10651
+ if (!isWeekend(cur)) left--;
10652
+ }
10653
+ return cur;
10654
+ }
10655
+ var MONTHS = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
10656
+ function fmtDate(days) {
10657
+ const { m, d } = daysToYmd(days);
10658
+ return `${MONTHS[m - 1]} ${d}`;
10659
+ }
10660
+ var G = {
10661
+ PAD: 20,
10662
+ TITLE_H: 30,
10663
+ AXIS_H: 26,
10664
+ ROW_H: 28,
10665
+ BAR_H: 15,
10666
+ SECTION_H: 24,
10667
+ LABEL_MIN: 120,
10668
+ LABEL_MAX: 250,
10669
+ CHAR_W: 6.6,
10670
+ LABEL_PAD: 12,
10671
+ TARGET_CHART_W: 740,
10672
+ MIN_PX_UNIT: 5,
10673
+ MAX_PX_UNIT: 56,
10674
+ FOOTER_H: 28
10675
+ };
10676
+ function renderGantt2(ast, schedule, config) {
10677
+ const base = chunkENUM7GMZ_cjs.resolveBaseTheme(config?.theme ?? "default");
10678
+ const themeName = (config?.theme ?? "default") in PALETTES ? config.theme : "default";
10679
+ const P = PALETTES[themeName];
10680
+ const tasks = ast.tasks;
10681
+ const span = Math.max(schedule.projectDuration, 1);
10682
+ const unitToDay = ast.unit === "weeks" ? 7 : 1;
10683
+ const unitToWork = ast.unit === "weeks" ? 5 : 1;
10684
+ const pxUnit = Math.max(G.MIN_PX_UNIT, Math.min(G.MAX_PX_UNIT, G.TARGET_CHART_W / span));
10685
+ const longest = tasks.reduce((mx, t) => Math.max(mx, (t.label ?? t.id).length), 4);
10686
+ const labelW = Math.max(G.LABEL_MIN, Math.min(G.LABEL_MAX, Math.ceil(longest * G.CHAR_W) + 2 * G.LABEL_PAD));
10687
+ const chartX = G.PAD + labelW + 8;
10688
+ const chartW = Math.ceil(span * pxUnit);
10689
+ const hasTitle = !!ast.title;
10690
+ const topY = G.PAD + (hasTitle ? G.TITLE_H : 0);
10691
+ const axisBottom = topY + G.AXIS_H;
10692
+ const rows = [];
10693
+ let cursorY = axisBottom + 6;
10694
+ let lastLane = "\0";
10695
+ for (const t of tasks) {
10696
+ const lane = t.lane;
10697
+ if (lane !== lastLane && lane !== void 0) {
10698
+ rows.push({ kind: "section", y: cursorY, h: G.SECTION_H, label: lane });
10699
+ cursorY += G.SECTION_H;
10700
+ lastLane = lane;
10701
+ } else if (lane === void 0) {
10702
+ lastLane = void 0;
10703
+ }
10704
+ rows.push({ kind: "task", y: cursorY, h: G.ROW_H, task: t });
10705
+ cursorY += G.ROW_H;
10706
+ }
10707
+ const chartBottom = cursorY;
10708
+ const totalH = chartBottom + G.FOOTER_H + G.PAD;
10709
+ const totalW = chartX + chartW + G.PAD;
10710
+ const startDays = ast.start ? parseISODays(ast.start) : void 0;
10711
+ const xAt = (unitOffset) => chartX + unitOffset * pxUnit;
10712
+ const offsetToDate = (u) => {
10713
+ if (startDays === void 0) return void 0;
10714
+ return ast.calendar === "5day" ? advanceWorking(startDays, u * unitToWork) : startDays + Math.round(u * unitToDay);
10715
+ };
10716
+ const niceStep2 = (s) => {
10717
+ const raw = s / 9;
10718
+ const candidates = [1, 2, 5, 7, 10, 14, 20, 25, 50, 100];
10719
+ for (const c of candidates) if (c >= raw) return c;
10720
+ return Math.ceil(raw / 50) * 50;
10721
+ };
10722
+ const step = niceStep2(span);
10723
+ const styleBlock = chunk3WNW5Y7P_cjs.el("style", {}, `
10724
+ .sx-gantt-bg { fill: ${base.bg}; }
10725
+ .sx-gantt-title { fill: ${P.text}; font-size: 15px; font-weight: 700; }
10726
+ .sx-gantt-grid { stroke: ${P.grid}; stroke-width: 1; }
10727
+ .sx-gantt-axis-tick { stroke: ${P.axis}; stroke-width: 1; }
10728
+ .sx-gantt-axis-text { fill: ${P.subtext}; font-size: 9.5px; }
10729
+ .sx-gantt-axis-base { stroke: ${P.axis}; stroke-width: 1.2; }
10730
+ .sx-gantt-section { fill: ${P.sectionBand}; }
10731
+ .sx-gantt-section-text { fill: ${P.sectionText}; font-size: 11px; font-weight: 700; }
10732
+ .sx-gantt-rowlabel { fill: ${P.text}; font-size: 11.5px; }
10733
+ .sx-gantt-rowlabel.crit { fill: ${P.critStroke}; font-weight: 600; }
10734
+ .sx-gantt-bar { fill: ${P.bar}; stroke: ${P.barStroke}; stroke-width: 1; }
10735
+ .sx-gantt-bar[data-critical="true"] { fill: ${P.critBar}; stroke: ${P.critStroke}; stroke-width: 1.4; }
10736
+ .sx-gantt-done { fill: ${P.barDone}; }
10737
+ .sx-gantt-done[data-critical="true"] { fill: ${P.critDone}; }
10738
+ .sx-gantt-ms { fill: ${P.milestone}; stroke: ${P.milestone}; }
10739
+ .sx-gantt-ms[data-critical="true"] { fill: ${P.critStroke}; stroke: ${P.critStroke}; }
10740
+ .sx-gantt-dep { fill: none; stroke: ${P.dep}; stroke-width: 1; }
10741
+ .sx-gantt-barlabel { fill: ${P.subtext}; font-size: 9.5px; }
10742
+ .sx-gantt-today { stroke: ${P.today}; stroke-width: 1.3; stroke-dasharray: 4 3; }
10743
+ .sx-gantt-today-text { fill: ${P.today}; font-size: 9.5px; font-weight: 700; }
10744
+ .sx-gantt-footer { fill: ${P.subtext}; font-size: 10px; }
10745
+ `.trim());
10746
+ const children = [
10747
+ chunk3WNW5Y7P_cjs.title(`Gantt chart${ast.title ? " \u2014 " + ast.title : ""}`),
10748
+ chunk3WNW5Y7P_cjs.desc(summarise(ast, schedule)),
10749
+ styleBlock,
10750
+ chunk3WNW5Y7P_cjs.rect({ x: 0, y: 0, width: totalW, height: totalH, class: "sx-gantt-bg" })
10751
+ ];
10752
+ if (hasTitle) {
10753
+ children.push(chunk3WNW5Y7P_cjs.text({ x: G.PAD, y: G.PAD + 18, class: "sx-gantt-title" }, ast.title));
10754
+ }
10755
+ const bandEls = [];
10756
+ for (const r7 of rows) {
10757
+ if (r7.kind === "section") {
10758
+ bandEls.push(chunk3WNW5Y7P_cjs.rect({ x: G.PAD, y: r7.y, width: totalW - 2 * G.PAD, height: r7.h, class: "sx-gantt-section" }));
10759
+ bandEls.push(chunk3WNW5Y7P_cjs.text({ x: G.PAD + 8, y: r7.y + r7.h / 2 + 4, class: "sx-gantt-section-text" }, r7.label));
10760
+ }
10761
+ }
10762
+ children.push(chunk3WNW5Y7P_cjs.group({ class: "sx-gantt-sections" }, bandEls));
10763
+ const axisEls = [];
10764
+ for (let u = 0; u <= span + 1e-4; u += step) {
10765
+ const x = xAt(u);
10766
+ axisEls.push(chunk3WNW5Y7P_cjs.line({ class: "sx-gantt-grid", x1: x, y1: axisBottom, x2: x, y2: chartBottom }));
10767
+ axisEls.push(chunk3WNW5Y7P_cjs.line({ class: "sx-gantt-axis-tick", x1: x, y1: axisBottom - 5, x2: x, y2: axisBottom }));
10768
+ const cal = offsetToDate(u);
10769
+ const label = cal !== void 0 ? fmtDate(cal) : fmtVal(u);
10770
+ axisEls.push(chunk3WNW5Y7P_cjs.text({ x, y: axisBottom - 9, class: "sx-gantt-axis-text", "text-anchor": "middle" }, label));
10771
+ }
10772
+ axisEls.push(chunk3WNW5Y7P_cjs.line({ class: "sx-gantt-axis-base", x1: chartX, y1: axisBottom, x2: chartX + chartW, y2: axisBottom }));
10773
+ children.push(chunk3WNW5Y7P_cjs.group({ class: "sx-gantt-axis" }, axisEls));
10774
+ const labelEls = [];
10775
+ for (const r7 of rows) {
10776
+ if (r7.kind !== "task" || !r7.task) continue;
10777
+ const c = schedule.computed.get(r7.task.id);
10778
+ const crit = c?.critical ?? false;
10779
+ labelEls.push(
10780
+ chunk3WNW5Y7P_cjs.text(
10781
+ { x: G.PAD + 4, y: r7.y + r7.h / 2 + 4, class: `sx-gantt-rowlabel${crit ? " crit" : ""}` },
10782
+ clip(r7.task.label ?? r7.task.id, Math.floor(labelW / G.CHAR_W))
10783
+ )
10784
+ );
10785
+ }
10786
+ children.push(chunk3WNW5Y7P_cjs.group({ class: "sx-gantt-rowlabels" }, labelEls));
10787
+ const rowOf = /* @__PURE__ */ new Map();
10788
+ for (const r7 of rows) if (r7.kind === "task" && r7.task) rowOf.set(r7.task.id, r7);
10789
+ const depEls = [];
10790
+ for (const t of tasks) {
10791
+ const tr = rowOf.get(t.id);
10792
+ const tc = schedule.computed.get(t.id);
10793
+ if (!tr || !tc) continue;
10794
+ const succMidY = tr.y + tr.h / 2;
10795
+ const succX = xAt(tc.es);
10796
+ for (const dep of t.deps) {
10797
+ const pr = rowOf.get(dep.pred);
10798
+ const pc2 = schedule.computed.get(dep.pred);
10799
+ if (!pr || !pc2) continue;
10800
+ const predMidY = pr.y + pr.h / 2;
10801
+ const predX = xAt(pc2.ef);
10802
+ const midX = Math.max(predX + 8, succX - 10);
10803
+ depEls.push(chunk3WNW5Y7P_cjs.path({
10804
+ class: "sx-gantt-dep",
10805
+ d: `M ${r1(predX)} ${r1(predMidY)} H ${r1(midX)} V ${r1(succMidY)} H ${r1(succX - 3)}`
10806
+ }));
10807
+ }
10808
+ }
10809
+ children.push(chunk3WNW5Y7P_cjs.group({ class: "sx-gantt-deps" }, depEls));
10810
+ const barEls = [];
10811
+ for (const r7 of rows) {
10812
+ if (r7.kind !== "task" || !r7.task) continue;
10813
+ const t = r7.task;
10814
+ const c = schedule.computed.get(t.id);
10815
+ if (!c) continue;
10816
+ const crit = c.critical;
10817
+ const cy = r7.y + r7.h / 2;
10818
+ if (t.milestone || t.duration === 0) {
10819
+ const x2 = xAt(c.es);
10820
+ const s = 7;
10821
+ barEls.push(chunk3WNW5Y7P_cjs.group(
10822
+ { class: "sx-gantt-task", "data-id": t.id, "data-critical": String(crit), "data-es": String(c.es) },
10823
+ [chunk3WNW5Y7P_cjs.polygon({
10824
+ class: "sx-gantt-ms",
10825
+ "data-critical": String(crit),
10826
+ points: `${r1(x2)},${r1(cy - s)} ${r1(x2 + s)},${r1(cy)} ${r1(x2)},${r1(cy + s)} ${r1(x2 - s)},${r1(cy)}`
10827
+ })]
10828
+ ));
10829
+ continue;
10830
+ }
10831
+ const x = xAt(c.es);
10832
+ const w = Math.max(2, (c.ef - c.es) * pxUnit);
10833
+ const by = cy - G.BAR_H / 2;
10834
+ const parts = [
10835
+ chunk3WNW5Y7P_cjs.rect({ x: r1(x), y: r1(by), width: r1(w), height: G.BAR_H, rx: 3, class: "sx-gantt-bar", "data-critical": String(crit) })
10836
+ ];
10837
+ if (t.progress !== void 0 && t.progress > 0) {
10838
+ parts.push(chunk3WNW5Y7P_cjs.rect({
10839
+ x: r1(x),
10840
+ y: r1(by),
10841
+ width: r1(Math.max(2, w * t.progress / 100)),
10842
+ height: G.BAR_H,
10843
+ rx: 3,
10844
+ class: "sx-gantt-done",
10845
+ "data-critical": String(crit)
10846
+ }));
10847
+ }
10848
+ const cap2 = c.slack > 0 ? `${fmtVal(c.ef - c.es)}${unitSuffix2(ast.unit)} \xB7 slack ${fmtVal(c.slack)}` : `${fmtVal(c.ef - c.es)}${unitSuffix2(ast.unit)}`;
10849
+ parts.push(chunk3WNW5Y7P_cjs.text({ x: r1(x + w + 5), y: r1(cy + 3.5), class: "sx-gantt-barlabel" }, cap2));
10850
+ barEls.push(chunk3WNW5Y7P_cjs.group(
10851
+ {
10852
+ class: "sx-gantt-task",
10853
+ "data-id": t.id,
10854
+ "data-critical": String(crit),
10855
+ "data-es": String(c.es),
10856
+ "data-ef": String(c.ef),
10857
+ "data-slack": String(c.slack),
10858
+ ...t.progress !== void 0 ? { "data-progress": String(t.progress) } : {}
10859
+ },
10860
+ parts
10861
+ ));
10862
+ }
10863
+ children.push(chunk3WNW5Y7P_cjs.group({ class: "sx-gantt-bars" }, barEls));
10864
+ if (ast.today && startDays !== void 0) {
10865
+ const todayDays = parseISODays(ast.today);
10866
+ let u;
10867
+ if (ast.calendar === "5day") {
10868
+ u = workingDaysBetween(startDays, todayDays) / unitToWork;
10869
+ } else {
10870
+ u = (todayDays - startDays) / unitToDay;
10871
+ }
10872
+ if (u >= 0 && u <= span) {
10873
+ const x = xAt(u);
10874
+ children.push(chunk3WNW5Y7P_cjs.group({ class: "sx-gantt-today-g" }, [
10875
+ chunk3WNW5Y7P_cjs.line({ class: "sx-gantt-today", x1: x, y1: axisBottom, x2: x, y2: chartBottom }),
10876
+ chunk3WNW5Y7P_cjs.text({ x, y: chartBottom + 12, class: "sx-gantt-today-text", "text-anchor": "middle" }, "today")
10877
+ ]));
10878
+ }
10879
+ }
10880
+ const footer = `${schedule.order.length} tasks \xB7 duration ${fmtVal(schedule.projectDuration)}${unitSuffix2(ast.unit)} \xB7 critical path: ${schedule.criticalPath.join(" \u2192 ") || "\u2014"}`;
10881
+ children.push(chunk3WNW5Y7P_cjs.text({ x: G.PAD, y: totalH - 10, class: "sx-gantt-footer" }, clip(footer, Math.floor((totalW - 2 * G.PAD) / 5.4))));
10882
+ return chunk3WNW5Y7P_cjs.svgRoot(
10883
+ {
10884
+ class: "sx-gantt",
10885
+ role: "img",
10886
+ "aria-label": chunk3WNW5Y7P_cjs.escapeXml(ast.title ?? "Gantt chart"),
10887
+ width: totalW,
10888
+ height: totalH,
10889
+ viewBox: `0 0 ${totalW} ${totalH}`,
10890
+ "data-diagram-type": "pert",
10891
+ "data-layout": "gantt"
10892
+ },
10893
+ children
10894
+ );
10895
+ }
10896
+ function workingDaysBetween(a, b) {
10897
+ if (b < a) return -workingDaysBetween(b, a);
10898
+ let n = 0;
10899
+ for (let d = a; d < b; d++) if (!isWeekend(d)) n++;
10900
+ return n;
10901
+ }
10902
+ function unitSuffix2(unit) {
10903
+ switch (unit) {
10904
+ case "days":
10905
+ return "d";
10906
+ case "weeks":
10907
+ return "w";
10908
+ case "hours":
10909
+ return "h";
10910
+ default:
10911
+ return "";
10912
+ }
10913
+ }
10529
10914
  function fmtVal(n) {
10530
10915
  return String(parseFloat(n.toFixed(2)));
10531
10916
  }
10917
+ function r1(n) {
10918
+ return Math.round(n * 10) / 10;
10919
+ }
10920
+ function clip(s, n) {
10921
+ return s.length <= n ? s : s.slice(0, Math.max(1, n - 1)) + "\u2026";
10922
+ }
10923
+ function summarise(ast, s) {
10924
+ const parts = [`Gantt chart: ${s.order.length} tasks, project duration ${fmtVal(s.projectDuration)}${unitSuffix2(ast.unit)}.`];
10925
+ if (ast.start) parts.push(`Starts ${ast.start} (${ast.calendar === "5day" ? "weekdays only" : "continuous"}).`);
10926
+ if (s.criticalPath.length) parts.push(`Critical path: ${s.criticalPath.join(" \u2192 ")}.`);
10927
+ return parts.join(" ");
10928
+ }
10929
+
10930
+ // src/diagrams/pert/renderer.ts
10931
+ function fmtVal2(n) {
10932
+ return String(parseFloat(n.toFixed(2)));
10933
+ }
10532
10934
  function unitWord(unit) {
10533
10935
  return unit === "abstract" ? "" : unit;
10534
10936
  }
@@ -10632,19 +11034,19 @@ function dataAttrs(b) {
10632
11034
  const attrs = {
10633
11035
  class: `sx-pert-task${c.critical ? " critical" : ""}${b.task.className ? " " + b.task.className : ""}`,
10634
11036
  "data-id": b.id,
10635
- "data-es": fmtVal(c.es),
10636
- "data-ef": fmtVal(c.ef),
10637
- "data-ls": fmtVal(c.ls),
10638
- "data-lf": fmtVal(c.lf),
10639
- "data-slack": fmtVal(c.slack),
10640
- "data-duration": fmtVal(b.task.duration),
11037
+ "data-es": fmtVal2(c.es),
11038
+ "data-ef": fmtVal2(c.ef),
11039
+ "data-ls": fmtVal2(c.ls),
11040
+ "data-lf": fmtVal2(c.lf),
11041
+ "data-slack": fmtVal2(c.slack),
11042
+ "data-duration": fmtVal2(b.task.duration),
10641
11043
  "data-critical": String(c.critical)
10642
11044
  };
10643
11045
  if (b.task.tags.length) attrs["data-tag"] = b.task.tags.join(" ");
10644
11046
  if (b.task.threePoint) {
10645
11047
  const tp = b.task.threePoint;
10646
- attrs["data-pert-triple"] = `${fmtVal(tp.o)}/${fmtVal(tp.m)}/${fmtVal(tp.p)}`;
10647
- if (b.task.variance !== void 0) attrs["data-pert-variance"] = fmtVal(b.task.variance);
11048
+ attrs["data-pert-triple"] = `${fmtVal2(tp.o)}/${fmtVal2(tp.m)}/${fmtVal2(tp.p)}`;
11049
+ if (b.task.variance !== void 0) attrs["data-pert-variance"] = fmtVal2(b.task.variance);
10648
11050
  }
10649
11051
  return attrs;
10650
11052
  }
@@ -10671,16 +11073,16 @@ function renderSixField(b) {
10671
11073
  chunk3WNW5Y7P_cjs.text({ class: "sx-pert-field-label", x: fx, y: y + 9, "text-anchor": "middle" }, label),
10672
11074
  chunk3WNW5Y7P_cjs.text({ class: cls, x: fx, y: y + 19, "text-anchor": "middle" }, value)
10673
11075
  ]);
10674
- parts.push(field(x + col / 2, "ES", fmtVal(c.es)));
10675
- parts.push(field(x + col * 1.5, "DUR", fmtVal(b.task.duration)));
10676
- parts.push(field(x + col * 2.5, "EF", fmtVal(c.ef)));
11076
+ parts.push(field(x + col / 2, "ES", fmtVal2(c.es)));
11077
+ parts.push(field(x + col * 1.5, "DUR", fmtVal2(b.task.duration)));
11078
+ parts.push(field(x + col * 2.5, "EF", fmtVal2(c.ef)));
10677
11079
  const fieldBot = (fx, label, value, cls = "sx-pert-field") => chunk3WNW5Y7P_cjs.group({}, [
10678
11080
  chunk3WNW5Y7P_cjs.text({ class: cls, x: fx, y: yBot + 13, "text-anchor": "middle" }, value),
10679
11081
  chunk3WNW5Y7P_cjs.text({ class: "sx-pert-field-label", x: fx, y: yBot + 21, "text-anchor": "middle" }, label)
10680
11082
  ]);
10681
- parts.push(fieldBot(x + col / 2, "LS", fmtVal(c.ls)));
10682
- parts.push(fieldBot(x + col * 1.5, "SLACK", fmtVal(c.slack), "sx-pert-field slack"));
10683
- parts.push(fieldBot(x + col * 2.5, "LF", fmtVal(c.lf)));
11083
+ parts.push(fieldBot(x + col / 2, "LS", fmtVal2(c.ls)));
11084
+ parts.push(fieldBot(x + col * 1.5, "SLACK", fmtVal2(c.slack), "sx-pert-field slack"));
11085
+ parts.push(fieldBot(x + col * 2.5, "LF", fmtVal2(c.lf)));
10684
11086
  const hasSigma = b.task.variance !== void 0;
10685
11087
  const nameY = hasSigma ? y + topH + 18 : y + topH + 19;
10686
11088
  parts.push(chunk3WNW5Y7P_cjs.text({ class: "sx-pert-name", x: cx, y: nameY, "text-anchor": "middle" }, b.task.label));
@@ -10689,7 +11091,7 @@ function renderSixField(b) {
10689
11091
  parts.push(
10690
11092
  chunk3WNW5Y7P_cjs.text(
10691
11093
  { class: "sx-pert-sigma", x: cx, y: nameY + 27, "text-anchor": "middle" },
10692
- `\u03C3=${fmtVal(Math.sqrt(b.task.variance))}`
11094
+ `\u03C3=${fmtVal2(Math.sqrt(b.task.variance))}`
10693
11095
  )
10694
11096
  );
10695
11097
  }
@@ -10703,7 +11105,7 @@ function renderMilestone(b) {
10703
11105
  const parts = [
10704
11106
  chunk3WNW5Y7P_cjs.polygon({ class: "sx-pert-ms", points: pts }),
10705
11107
  chunk3WNW5Y7P_cjs.text({ class: "sx-pert-name", x: cx, y: cy - 2, "text-anchor": "middle" }, b.task.label),
10706
- chunk3WNW5Y7P_cjs.text({ class: "sx-pert-id", x: cx, y: cy + 12, "text-anchor": "middle" }, `@ ${fmtVal(b.computed.es)}`)
11108
+ chunk3WNW5Y7P_cjs.text({ class: "sx-pert-id", x: cx, y: cy + 12, "text-anchor": "middle" }, `@ ${fmtVal2(b.computed.es)}`)
10707
11109
  ];
10708
11110
  return chunk3WNW5Y7P_cjs.group(dataAttrs(b), parts);
10709
11111
  }
@@ -10716,12 +11118,12 @@ function renderTimescaledBar(b) {
10716
11118
  parts.push(chunk3WNW5Y7P_cjs.text({ class: "sx-pert-id", x: cx, y: y + h / 2 + 4, "text-anchor": "middle" }, b.id));
10717
11119
  const wide = w >= 104;
10718
11120
  if (wide) {
10719
- parts.push(chunk3WNW5Y7P_cjs.text({ class: "sx-pert-field-label", x: x + 7, y: y + 15, "text-anchor": "start" }, `ES ${fmtVal(c.es)}`));
10720
- parts.push(chunk3WNW5Y7P_cjs.text({ class: "sx-pert-field-label", x: x + w - 7, y: y + 15, "text-anchor": "end" }, `EF ${fmtVal(c.ef)}`));
11121
+ parts.push(chunk3WNW5Y7P_cjs.text({ class: "sx-pert-field-label", x: x + 7, y: y + 15, "text-anchor": "start" }, `ES ${fmtVal2(c.es)}`));
11122
+ parts.push(chunk3WNW5Y7P_cjs.text({ class: "sx-pert-field-label", x: x + w - 7, y: y + 15, "text-anchor": "end" }, `EF ${fmtVal2(c.ef)}`));
10721
11123
  parts.push(
10722
11124
  chunk3WNW5Y7P_cjs.text(
10723
11125
  { class: `sx-pert-field-label${c.critical ? " slack" : ""}`, x: cx, y: y + h - 8, "text-anchor": "middle" },
10724
- `slack ${fmtVal(c.slack)}`
11126
+ `slack ${fmtVal2(c.slack)}`
10725
11127
  )
10726
11128
  );
10727
11129
  }
@@ -10806,7 +11208,7 @@ function renderAxis2(axis, gridTop) {
10806
11208
  parts.push(chunk3WNW5Y7P_cjs.line({ x1: tk.pos, y1: axis.baseline, x2: tk.pos, y2: axis.baseline + len }));
10807
11209
  if (tk.major) {
10808
11210
  parts.push(
10809
- chunk3WNW5Y7P_cjs.text({ x: tk.pos, y: axis.baseline + 18, "text-anchor": "middle" }, fmtVal(tk.value))
11211
+ chunk3WNW5Y7P_cjs.text({ x: tk.pos, y: axis.baseline + 18, "text-anchor": "middle" }, fmtVal2(tk.value))
10810
11212
  );
10811
11213
  }
10812
11214
  }
@@ -10832,7 +11234,7 @@ function renderAoa(aoa) {
10832
11234
  );
10833
11235
  if (!a.dummy && a.label) {
10834
11236
  const critCls = a.critical ? " critical" : "";
10835
- const durStr = fmtVal(a.duration ?? 0);
11237
+ const durStr = fmtVal2(a.duration ?? 0);
10836
11238
  const w = Math.max(a.label.length * 6.2, durStr.length * 6) + 8;
10837
11239
  labelEls.push(
10838
11240
  chunk3WNW5Y7P_cjs.rect({ class: "sx-pert-edge-halo", x: a.labelX - w / 2, y: a.labelY - 16, width: w, height: 31, rx: 3, ry: 3 })
@@ -10862,8 +11264,8 @@ function renderAoa(aoa) {
10862
11264
  }
10863
11265
  function summaryText(summary) {
10864
11266
  const u = unitWord(summary.unit);
10865
- const dur = `${fmtVal(summary.projectDuration)}${u ? " " + u : ""}`;
10866
- const sigma = summary.projectStdDev !== void 0 ? ` \xB7 \u03C3 \u2248 ${fmtVal(summary.projectStdDev)}` : "";
11267
+ const dur = `${fmtVal2(summary.projectDuration)}${u ? " " + u : ""}`;
11268
+ const sigma = summary.projectStdDev !== void 0 ? ` \xB7 \u03C3 \u2248 ${fmtVal2(summary.projectStdDev)}` : "";
10867
11269
  const plain = `Project duration ${dur} \xB7 ${summary.taskCount} tasks \xB7 ${summary.depCount} dependencies \xB7 ${summary.criticalCount} critical${sigma}`;
10868
11270
  const critPath = summary.criticalPath.map((id) => id).join(" \u2192 ");
10869
11271
  return { plain, critPath };
@@ -10875,7 +11277,7 @@ function renderPertLayout(layout, config) {
10875
11277
  children.push(chunk3WNW5Y7P_cjs.title(`PERT network${layout.title ? " \u2014 " + layout.title : ""}`));
10876
11278
  children.push(
10877
11279
  chunk3WNW5Y7P_cjs.desc(
10878
- `${layout.summary.taskCount} activities, project duration ${fmtVal(layout.summary.projectDuration)} ${unitWord(layout.unit)}` + (cp.length ? `, critical path ${cp.join(" \u2192 ")}` : "") + "."
11280
+ `${layout.summary.taskCount} activities, project duration ${fmtVal2(layout.summary.projectDuration)} ${unitWord(layout.unit)}` + (cp.length ? `, critical path ${cp.join(" \u2192 ")}` : "") + "."
10879
11281
  )
10880
11282
  );
10881
11283
  children.push(chunk3WNW5Y7P_cjs.el("style", {}, buildCss5(t)));
@@ -10943,6 +11345,7 @@ var PERT_PAD = 24;
10943
11345
  function renderPert(textOrAst, config) {
10944
11346
  const ast = typeof textOrAst === "string" ? parsePert(textOrAst) : textOrAst;
10945
11347
  const schedule = schedulePert(ast);
11348
+ if (ast.layout === "gantt") return renderGantt2(ast, schedule, config);
10946
11349
  const layout = layoutPert(ast, schedule);
10947
11350
  return renderPertLayout(layout, config);
10948
11351
  }
@@ -10955,7 +11358,7 @@ var pert = {
10955
11358
  const t = raw.trim();
10956
11359
  if (!t) continue;
10957
11360
  if (t.startsWith("#") || t.startsWith("//")) continue;
10958
- return /^pert\b/i.test(t);
11361
+ return /^(pert|gantt)\b/i.test(t);
10959
11362
  }
10960
11363
  return false;
10961
11364
  },
@@ -12023,18 +12426,18 @@ function renderFragmentTab(f) {
12023
12426
  });
12024
12427
  return chunk3WNW5Y7P_cjs.group({ class: "sx-seq-fragment-tab-g", "data-op": f.op }, parts);
12025
12428
  }
12026
- function renderRef(r6) {
12429
+ function renderRef(r7) {
12027
12430
  const tabW = 40;
12028
12431
  const tabH = 18;
12029
12432
  const fold = 6;
12030
- const tab = `M ${r6.x} ${r6.y} H ${r6.x + tabW} V ${r6.y + tabH - fold} L ${r6.x + tabW - fold} ${r6.y + tabH} H ${r6.x} Z`;
12433
+ const tab = `M ${r7.x} ${r7.y} H ${r7.x + tabW} V ${r7.y + tabH - fold} L ${r7.x + tabW - fold} ${r7.y + tabH} H ${r7.x} Z`;
12031
12434
  return chunk3WNW5Y7P_cjs.group({ class: "sx-seq-fragment", "data-op": "ref" }, [
12032
- chunk3WNW5Y7P_cjs.rect({ class: "sx-seq-frame", x: r6.x, y: r6.y, width: r6.width, height: r6.height, rx: 2, ry: 2 }),
12435
+ chunk3WNW5Y7P_cjs.rect({ class: "sx-seq-frame", x: r7.x, y: r7.y, width: r7.width, height: r7.height, rx: 2, ry: 2 }),
12033
12436
  chunk3WNW5Y7P_cjs.path({ class: "sx-seq-frame-tab", d: tab }),
12034
- chunk3WNW5Y7P_cjs.text({ class: "sx-seq-frame-op", x: r6.x + 8, y: r6.y + 13 }, "ref"),
12437
+ chunk3WNW5Y7P_cjs.text({ class: "sx-seq-frame-op", x: r7.x + 8, y: r7.y + 13 }, "ref"),
12035
12438
  chunk3WNW5Y7P_cjs.text(
12036
- { class: "sx-seq-ref-name", x: r6.x + r6.width / 2, y: r6.y + r6.height / 2 + 8, "text-anchor": "middle" },
12037
- r6.text
12439
+ { class: "sx-seq-ref-name", x: r7.x + r7.width / 2, y: r7.y + r7.height / 2 + 8, "text-anchor": "middle" },
12440
+ r7.text
12038
12441
  )
12039
12442
  ]);
12040
12443
  }
@@ -12071,10 +12474,10 @@ function renderInvariant(iv) {
12071
12474
  ]);
12072
12475
  }
12073
12476
  function renderDestroy(d) {
12074
- const r6 = 7;
12477
+ const r7 = 7;
12075
12478
  return chunk3WNW5Y7P_cjs.group({ class: "sx-seq-destroy-g" }, [
12076
- chunk3WNW5Y7P_cjs.line({ class: "sx-seq-destroy", x1: d.x - r6, y1: d.y - r6, x2: d.x + r6, y2: d.y + r6 }),
12077
- chunk3WNW5Y7P_cjs.line({ class: "sx-seq-destroy", x1: d.x - r6, y1: d.y + r6, x2: d.x + r6, y2: d.y - r6 })
12479
+ chunk3WNW5Y7P_cjs.line({ class: "sx-seq-destroy", x1: d.x - r7, y1: d.y - r7, x2: d.x + r7, y2: d.y + r7 }),
12480
+ chunk3WNW5Y7P_cjs.line({ class: "sx-seq-destroy", x1: d.x - r7, y1: d.y + r7, x2: d.x + r7, y2: d.y - r7 })
12078
12481
  ]);
12079
12482
  }
12080
12483
  function renderSequenceLayout(layout, config) {
@@ -12917,10 +13320,10 @@ function renderArc2(ag) {
12917
13320
  const dx = last.x - prev.x;
12918
13321
  const dy = last.y - prev.y;
12919
13322
  const len = Math.hypot(dx, dy) || 1;
12920
- const r6 = 4;
12921
- const cx = last.x - dx / len * r6;
12922
- const cy = last.y - dy / len * r6;
12923
- parts.push(chunk3WNW5Y7P_cjs.circle({ class: "sx-petri-inhibitor-dot", cx, cy, r: r6 }));
13323
+ const r7 = 4;
13324
+ const cx = last.x - dx / len * r7;
13325
+ const cy = last.y - dy / len * r7;
13326
+ parts.push(chunk3WNW5Y7P_cjs.circle({ class: "sx-petri-inhibitor-dot", cx, cy, r: r7 }));
12924
13327
  }
12925
13328
  if (ag.weight > 1) {
12926
13329
  parts.push(
@@ -13318,10 +13721,10 @@ function parseNetwork(text2) {
13318
13721
  if (rest[0]) ast.title = rest[0].value;
13319
13722
  break;
13320
13723
  case "spines":
13321
- ast.spines.push(...rest.filter((r6) => !r6.str).map((r6) => r6.value));
13724
+ ast.spines.push(...rest.filter((r7) => !r7.str).map((r7) => r7.value));
13322
13725
  break;
13323
13726
  case "leaves":
13324
- ast.leaves.push(...rest.filter((r6) => !r6.str).map((r6) => r6.value));
13727
+ ast.leaves.push(...rest.filter((r7) => !r7.str).map((r7) => r7.value));
13325
13728
  break;
13326
13729
  case "legend":
13327
13730
  break;
@@ -13891,29 +14294,29 @@ function placeBanded(ast, ranks) {
13891
14294
  const lr = ast.direction === "lr";
13892
14295
  const byRank = /* @__PURE__ */ new Map();
13893
14296
  for (const d of ast.devices) {
13894
- const r6 = ranks.get(d.id) ?? 0;
13895
- if (!byRank.has(r6)) byRank.set(r6, []);
13896
- byRank.get(r6).push(d);
14297
+ const r7 = ranks.get(d.id) ?? 0;
14298
+ if (!byRank.has(r7)) byRank.set(r7, []);
14299
+ byRank.get(r7).push(d);
13897
14300
  }
13898
14301
  const rankValues = [...byRank.keys()].sort((a, b) => a - b);
13899
14302
  const pos = /* @__PURE__ */ new Map();
13900
14303
  let maxRowSpan = 0;
13901
14304
  const rowSpans = /* @__PURE__ */ new Map();
13902
- for (const r6 of rankValues) {
13903
- const devs = byRank.get(r6);
14305
+ for (const r7 of rankValues) {
14306
+ const devs = byRank.get(r7);
13904
14307
  let span = 0;
13905
14308
  devs.forEach((d, i) => {
13906
14309
  const fp = deviceFootprint(d);
13907
14310
  const cross = lr ? fp.h + labelExtra(d) : Math.max(fp.w, labelText(d).length * NET_CONST.CHAR_W + 6);
13908
14311
  span += cross + (i > 0 ? NET_CONST.SIBLING_GAP : 0);
13909
14312
  });
13910
- rowSpans.set(r6, span);
14313
+ rowSpans.set(r7, span);
13911
14314
  maxRowSpan = Math.max(maxRowSpan, span);
13912
14315
  }
13913
- rankValues.forEach((r6, rowIdx) => {
13914
- const devs = byRank.get(r6);
14316
+ rankValues.forEach((r7, rowIdx) => {
14317
+ const devs = byRank.get(r7);
13915
14318
  const along = rowIdx * NET_CONST.TIER_BAND_GAP;
13916
- let cursor = (maxRowSpan - rowSpans.get(r6)) / 2;
14319
+ let cursor = (maxRowSpan - rowSpans.get(r7)) / 2;
13917
14320
  for (const d of devs) {
13918
14321
  const fp = deviceFootprint(d);
13919
14322
  const cross = lr ? fp.h + labelExtra(d) : Math.max(fp.w, labelText(d).length * NET_CONST.CHAR_W + 6);
@@ -13948,8 +14351,8 @@ function tieredRanks(ast, links) {
13948
14351
  if (rank.has(d.id)) continue;
13949
14352
  const known = [];
13950
14353
  for (const n of adj.get(d.id) ?? []) {
13951
- const r6 = rank.get(n);
13952
- if (r6 !== void 0) known.push(r6);
14354
+ const r7 = rank.get(n);
14355
+ if (r7 !== void 0) known.push(r7);
13953
14356
  }
13954
14357
  if (known.length === 0) continue;
13955
14358
  const next = ENDPOINT_KINDS.has(d.kind) ? Math.max(...known) + 1 : Math.min(...known) + 1;
@@ -13983,10 +14386,10 @@ function treeRanks(ast, links) {
13983
14386
  rank.set(root.id, 0);
13984
14387
  while (queue.length) {
13985
14388
  const id = queue.shift();
13986
- const r6 = rank.get(id);
14389
+ const r7 = rank.get(id);
13987
14390
  for (const n of adj.get(id) ?? []) {
13988
14391
  if (!rank.has(n)) {
13989
- rank.set(n, r6 + 1);
14392
+ rank.set(n, r7 + 1);
13990
14393
  queue.push(n);
13991
14394
  }
13992
14395
  }
@@ -14170,11 +14573,11 @@ function layoutNetwork2(ast) {
14170
14573
  };
14171
14574
  const groupsByDepth = [...ast.groups].sort((a, b) => depthOf(b.id) - depthOf(a.id));
14172
14575
  for (const g of groupsByDepth) {
14173
- let l = Infinity, t = Infinity, r6 = -Infinity, bm = -Infinity;
14576
+ let l = Infinity, t = Infinity, r7 = -Infinity, bm = -Infinity;
14174
14577
  const addBox = (e) => {
14175
14578
  l = Math.min(l, e.left);
14176
14579
  t = Math.min(t, e.top);
14177
- r6 = Math.max(r6, e.right);
14580
+ r7 = Math.max(r7, e.right);
14178
14581
  bm = Math.max(bm, e.bottom);
14179
14582
  };
14180
14583
  for (const mid of g.members) {
@@ -14191,7 +14594,7 @@ function layoutNetwork2(ast) {
14191
14594
  groupBoxesRaw.set(g.id, {
14192
14595
  left: l - pad,
14193
14596
  top: t - pad - NET_CONST.GROUP_HEADER,
14194
- right: r6 + pad,
14597
+ right: r7 + pad,
14195
14598
  bottom: bm + pad,
14196
14599
  depth
14197
14600
  });
@@ -14650,10 +15053,10 @@ function parseUmlClass(text2) {
14650
15053
  }
14651
15054
  const rels = tryParseRelationship(t, i + 1);
14652
15055
  if (rels) {
14653
- for (const r6 of rels) {
14654
- ast.relationships.push(r6);
14655
- ensureClassifier(ast, r6.from);
14656
- ensureClassifier(ast, r6.to);
15056
+ for (const r7 of rels) {
15057
+ ast.relationships.push(r7);
15058
+ ensureClassifier(ast, r7.from);
15059
+ ensureClassifier(ast, r7.to);
14657
15060
  }
14658
15061
  i++;
14659
15062
  continue;
@@ -15208,11 +15611,11 @@ function findConnector(line2, glyph) {
15208
15611
  }
15209
15612
  function validateGeneralizationAcyclicity(ast) {
15210
15613
  const adj = /* @__PURE__ */ new Map();
15211
- for (const r6 of ast.relationships) {
15212
- if (r6.kind === "generalization" || r6.kind === "realization") {
15213
- const list = adj.get(r6.from) ?? [];
15214
- list.push(r6.to);
15215
- adj.set(r6.from, list);
15614
+ for (const r7 of ast.relationships) {
15615
+ if (r7.kind === "generalization" || r7.kind === "realization") {
15616
+ const list = adj.get(r7.from) ?? [];
15617
+ list.push(r7.to);
15618
+ adj.set(r7.from, list);
15216
15619
  }
15217
15620
  }
15218
15621
  const WHITE = 0, GREY = 1, BLACK = 2;
@@ -15245,12 +15648,12 @@ function validateGeneralizationAcyclicity(ast) {
15245
15648
  }
15246
15649
  }
15247
15650
  function validateRealizationTargets(ast) {
15248
- for (const r6 of ast.relationships) {
15249
- if (r6.kind !== "realization") continue;
15250
- const target = ast.classifiers.find((c) => c.id === r6.to);
15651
+ for (const r7 of ast.relationships) {
15652
+ if (r7.kind !== "realization") continue;
15653
+ const target = ast.classifiers.find((c) => c.id === r7.to);
15251
15654
  if (target && target.kind !== "interface") {
15252
15655
  ast.warnings.push(
15253
- `Realization target "${r6.to}" is not an \xABinterface\xBB \u2014 consider marking it so.`
15656
+ `Realization target "${r7.to}" is not an \xABinterface\xBB \u2014 consider marking it so.`
15254
15657
  );
15255
15658
  }
15256
15659
  }
@@ -15728,16 +16131,16 @@ function memberLineText(m) {
15728
16131
  const props = m.properties && m.properties.length > 0 ? ` {${m.properties.join(", ")}}` : "";
15729
16132
  return `${v}${m.name}(${params})${ret}${props}`;
15730
16133
  }
15731
- function rankEnds(r6) {
15732
- switch (r6.kind) {
16134
+ function rankEnds(r7) {
16135
+ switch (r7.kind) {
15733
16136
  case "generalization":
15734
16137
  case "realization":
15735
- return { parent: r6.to, child: r6.from };
16138
+ return { parent: r7.to, child: r7.from };
15736
16139
  case "composition":
15737
16140
  case "aggregation":
15738
16141
  case "directed":
15739
16142
  case "dependency":
15740
- return { parent: r6.from, child: r6.to };
16143
+ return { parent: r7.from, child: r7.to };
15741
16144
  case "association":
15742
16145
  return null;
15743
16146
  }
@@ -15745,8 +16148,8 @@ function rankEnds(r6) {
15745
16148
  function computeRanks(ast, boxes) {
15746
16149
  const parentsOf = /* @__PURE__ */ new Map();
15747
16150
  for (const b of boxes) parentsOf.set(b.classifier.id, /* @__PURE__ */ new Set());
15748
- for (const r6 of ast.relationships) {
15749
- const ends = rankEnds(r6);
16151
+ for (const r7 of ast.relationships) {
16152
+ const ends = rankEnds(r7);
15750
16153
  if (ends) parentsOf.get(ends.child)?.add(ends.parent);
15751
16154
  }
15752
16155
  const rank = /* @__PURE__ */ new Map();
@@ -15788,19 +16191,19 @@ function buildLayeredGraph(rels, boxes, rankByID) {
15788
16191
  byID.set(n.id, n);
15789
16192
  }
15790
16193
  const chains = [];
15791
- for (const r6 of rels) {
15792
- const a = byID.get(r6.from);
15793
- const b = byID.get(r6.to);
16194
+ for (const r7 of rels) {
16195
+ const a = byID.get(r7.from);
16196
+ const b = byID.get(r7.to);
15794
16197
  if (!a || !b) continue;
15795
16198
  if (a.rank === b.rank) {
15796
- chains.push({ rel: r6, chain: [a.id, b.id], sameRank: true });
16199
+ chains.push({ rel: r7, chain: [a.id, b.id], sameRank: true });
15797
16200
  continue;
15798
16201
  }
15799
16202
  const lo = a.rank < b.rank ? a : b;
15800
16203
  const hi = a.rank < b.rank ? b : a;
15801
16204
  const diff = hi.rank - lo.rank;
15802
16205
  if (diff === 1) {
15803
- chains.push({ rel: r6, chain: [r6.from, r6.to], sameRank: false });
16206
+ chains.push({ rel: r7, chain: [r7.from, r7.to], sameRank: false });
15804
16207
  continue;
15805
16208
  }
15806
16209
  const innerDummies = [];
@@ -15821,7 +16224,7 @@ function buildLayeredGraph(rels, boxes, rankByID) {
15821
16224
  }
15822
16225
  const lowToHigh = [lo.id, ...innerDummies, hi.id];
15823
16226
  const chain = a.rank < b.rank ? lowToHigh : [...lowToHigh].reverse();
15824
- chains.push({ rel: r6, chain, sameRank: false });
16227
+ chains.push({ rel: r7, chain, sameRank: false });
15825
16228
  }
15826
16229
  return { nodes, chains };
15827
16230
  }
@@ -15861,12 +16264,12 @@ function orderRanks(ranks, chains) {
15861
16264
  for (let iter = 0; iter < UMLCLASS_CONST.ORDER_ITERATIONS; iter++) {
15862
16265
  const downward = iter % 2 === 0;
15863
16266
  if (downward) {
15864
- for (let r6 = 1; r6 < ranks.length; r6++) {
15865
- applyBarycenter(ranks[r6], ranks[r6 - 1], up);
16267
+ for (let r7 = 1; r7 < ranks.length; r7++) {
16268
+ applyBarycenter(ranks[r7], ranks[r7 - 1], up);
15866
16269
  }
15867
16270
  } else {
15868
- for (let r6 = ranks.length - 2; r6 >= 0; r6--) {
15869
- applyBarycenter(ranks[r6], ranks[r6 + 1], down);
16271
+ for (let r7 = ranks.length - 2; r7 >= 0; r7--) {
16272
+ applyBarycenter(ranks[r7], ranks[r7 + 1], down);
15870
16273
  }
15871
16274
  }
15872
16275
  }
@@ -16005,22 +16408,22 @@ function routeEdges(chains, nodes, boxByID, vertical) {
16005
16408
  const handled = /* @__PURE__ */ new Set();
16006
16409
  const groups = /* @__PURE__ */ new Map();
16007
16410
  for (const c of chains) {
16008
- const r6 = c.rel;
16009
- if (r6.kind !== "generalization" && r6.kind !== "realization") continue;
16010
- const k = `${r6.kind}::${r6.to}`;
16011
- if (!groups.has(k)) groups.set(k, { kind: r6.kind, parentId: r6.to, rels: [] });
16012
- groups.get(k).rels.push(r6);
16411
+ const r7 = c.rel;
16412
+ if (r7.kind !== "generalization" && r7.kind !== "realization") continue;
16413
+ const k = `${r7.kind}::${r7.to}`;
16414
+ if (!groups.has(k)) groups.set(k, { kind: r7.kind, parentId: r7.to, rels: [] });
16415
+ groups.get(k).rels.push(r7);
16013
16416
  }
16014
16417
  for (const [, group2] of groups) {
16015
16418
  if (group2.rels.length < UMLCLASS_CONST.TREE_MERGE_THRESHOLD) continue;
16016
16419
  const parent = boxByID.get(group2.parentId);
16017
16420
  if (!parent) continue;
16018
- const children = group2.rels.map((r6) => ({ r: r6, box: boxByID.get(r6.from) })).filter((c) => !!c.box);
16421
+ const children = group2.rels.map((r7) => ({ r: r7, box: boxByID.get(r7.from) })).filter((c) => !!c.box);
16019
16422
  if (children.length < UMLCLASS_CONST.TREE_MERGE_THRESHOLD) continue;
16020
16423
  const tree = buildTree2(group2.kind, parent, children, vertical);
16021
16424
  if (tree) {
16022
16425
  trees.push(tree);
16023
- for (const r6 of group2.rels) handled.add(r6);
16426
+ for (const r7 of group2.rels) handled.add(r7);
16024
16427
  }
16025
16428
  }
16026
16429
  const liftLanes = /* @__PURE__ */ new Map();
@@ -16473,8 +16876,8 @@ function escapeXmlText(s) {
16473
16876
  return s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
16474
16877
  }
16475
16878
  function renderEdge4(e) {
16476
- const r6 = e.rel;
16477
- const dashed = r6.kind === "realization" || r6.kind === "dependency";
16879
+ const r7 = e.rel;
16880
+ const dashed = r7.kind === "realization" || r7.kind === "dependency";
16478
16881
  const parts = [];
16479
16882
  parts.push(
16480
16883
  chunk3WNW5Y7P_cjs.path({
@@ -16483,15 +16886,15 @@ function renderEdge4(e) {
16483
16886
  "data-dashed": dashed ? "true" : void 0
16484
16887
  })
16485
16888
  );
16486
- parts.push(renderTargetAdornment(r6.kind, e.targetEnd));
16487
- if (r6.kind === "composition" || r6.kind === "aggregation") {
16488
- parts.push(renderSourceDiamond(r6.kind, e.sourceEnd));
16489
- }
16490
- if (r6.sourceMult) parts.push(renderEndLabel(e.sourceEnd, r6.sourceMult, false));
16491
- if (r6.targetMult) parts.push(renderEndLabel(e.targetEnd, r6.targetMult, false));
16492
- if (r6.sourceRole) parts.push(renderEndLabel(e.sourceEnd, r6.sourceRole, true));
16493
- if (r6.targetRole) parts.push(renderEndLabel(e.targetEnd, r6.targetRole, true));
16494
- if (r6.label && e.labelAnchor) {
16889
+ parts.push(renderTargetAdornment(r7.kind, e.targetEnd));
16890
+ if (r7.kind === "composition" || r7.kind === "aggregation") {
16891
+ parts.push(renderSourceDiamond(r7.kind, e.sourceEnd));
16892
+ }
16893
+ if (r7.sourceMult) parts.push(renderEndLabel(e.sourceEnd, r7.sourceMult, false));
16894
+ if (r7.targetMult) parts.push(renderEndLabel(e.targetEnd, r7.targetMult, false));
16895
+ if (r7.sourceRole) parts.push(renderEndLabel(e.sourceEnd, r7.sourceRole, true));
16896
+ if (r7.targetRole) parts.push(renderEndLabel(e.targetEnd, r7.targetRole, true));
16897
+ if (r7.label && e.labelAnchor) {
16495
16898
  parts.push(
16496
16899
  chunk3WNW5Y7P_cjs.text(
16497
16900
  {
@@ -16500,7 +16903,7 @@ function renderEdge4(e) {
16500
16903
  class: "sx-umlclass-edge-name sx-umlclass-edge-name-halo",
16501
16904
  "text-anchor": "middle"
16502
16905
  },
16503
- r6.label
16906
+ r7.label
16504
16907
  )
16505
16908
  );
16506
16909
  parts.push(
@@ -16511,19 +16914,19 @@ function renderEdge4(e) {
16511
16914
  class: "sx-umlclass-edge-name",
16512
16915
  "text-anchor": "middle"
16513
16916
  },
16514
- r6.label
16917
+ r7.label
16515
16918
  )
16516
16919
  );
16517
16920
  }
16518
16921
  return chunk3WNW5Y7P_cjs.group(
16519
16922
  {
16520
16923
  class: "sx-umlclass-rel",
16521
- "data-from": r6.from,
16522
- "data-to": r6.to,
16523
- "data-kind": r6.kind,
16524
- "data-source-mult": r6.sourceMult,
16525
- "data-target-mult": r6.targetMult,
16526
- "data-name": r6.label
16924
+ "data-from": r7.from,
16925
+ "data-to": r7.to,
16926
+ "data-kind": r7.kind,
16927
+ "data-source-mult": r7.sourceMult,
16928
+ "data-target-mult": r7.targetMult,
16929
+ "data-name": r7.label
16527
16930
  },
16528
16931
  parts
16529
16932
  );
@@ -16678,8 +17081,8 @@ function summariseDiagram(ast, treeCount) {
16678
17081
  byKind[k] = (byKind[k] ?? 0) + 1;
16679
17082
  }
16680
17083
  const relsByKind = {};
16681
- for (const r6 of ast.relationships) {
16682
- relsByKind[r6.kind] = (relsByKind[r6.kind] ?? 0) + 1;
17084
+ for (const r7 of ast.relationships) {
17085
+ relsByKind[r7.kind] = (relsByKind[r7.kind] ?? 0) + 1;
16683
17086
  }
16684
17087
  const classifierStr = Object.entries(byKind).map(([k, n]) => `${n} ${k}`).join(", ");
16685
17088
  const relStr = Object.entries(relsByKind).map(([k, n]) => `${n} ${k}`).join(", ");
@@ -16911,9 +17314,9 @@ function validate(ast) {
16911
17314
  if (!e.gate) continue;
16912
17315
  const refs = [...e.gate.inputs];
16913
17316
  if (e.gate.condition && isId(e.gate.condition)) refs.push(e.gate.condition);
16914
- for (const r6 of refs) {
16915
- if (!byId.has(r6)) {
16916
- throw new FaultTreeParseError(`gate ${e.id} references undefined event '${r6}'`);
17317
+ for (const r7 of refs) {
17318
+ if (!byId.has(r7)) {
17319
+ throw new FaultTreeParseError(`gate ${e.id} references undefined event '${r7}'`);
16917
17320
  }
16918
17321
  }
16919
17322
  if (e.gate.kind === "voting") {
@@ -16985,9 +17388,9 @@ function parseProb(s, lineNo) {
16985
17388
  return n;
16986
17389
  }
16987
17390
  function splitRefs(s, lineNo) {
16988
- const refs = s.split(",").map((r6) => r6.trim()).filter(Boolean);
16989
- for (const r6 of refs) {
16990
- if (!isId(r6)) throw new FaultTreeParseError(`invalid event reference "${r6}"`, lineNo);
17391
+ const refs = s.split(",").map((r7) => r7.trim()).filter(Boolean);
17392
+ for (const r7 of refs) {
17393
+ if (!isId(r7)) throw new FaultTreeParseError(`invalid event reference "${r7}"`, lineNo);
16991
17394
  }
16992
17395
  if (refs.length === 0) throw new FaultTreeParseError(`empty input list`, lineNo);
16993
17396
  return refs;
@@ -17629,7 +18032,7 @@ function renderFaultTreeLayout(layout, config) {
17629
18032
  const instById = new Map(layout.events.map((e) => [e.instanceId, e]));
17630
18033
  const children = [
17631
18034
  chunk3WNW5Y7P_cjs.title(a11y),
17632
- chunk3WNW5Y7P_cjs.desc(summarise(layout)),
18035
+ chunk3WNW5Y7P_cjs.desc(summarise2(layout)),
17633
18036
  styleBlock,
17634
18037
  chunk3WNW5Y7P_cjs.rect({ x: 0, y: 0, width, height, class: "sx-ft-bg" })
17635
18038
  ];
@@ -17705,10 +18108,10 @@ function renderEvent(e, showProb) {
17705
18108
  parts.push(chunk3WNW5Y7P_cjs.text({ x: e.cx, y: cy + 3, class: "sx-ft-id", "text-anchor": "middle" }, e.event.id));
17706
18109
  parts.push(...leafCaption(e, cy + FAULTTREE_CONST.BASIC_R, label, showProb));
17707
18110
  } else if (e.role === "undeveloped") {
17708
- const r6 = FAULTTREE_CONST.DIAMOND_W / 2;
17709
- parts.push(chunk3WNW5Y7P_cjs.path({ d: `M ${e.cx} ${cy - r6} L ${e.cx + r6} ${cy} L ${e.cx} ${cy + r6} L ${e.cx - r6} ${cy} Z`, class: "sx-ft-undeveloped" }));
18111
+ const r7 = FAULTTREE_CONST.DIAMOND_W / 2;
18112
+ parts.push(chunk3WNW5Y7P_cjs.path({ d: `M ${e.cx} ${cy - r7} L ${e.cx + r7} ${cy} L ${e.cx} ${cy + r7} L ${e.cx - r7} ${cy} Z`, class: "sx-ft-undeveloped" }));
17710
18113
  parts.push(chunk3WNW5Y7P_cjs.text({ x: e.cx, y: cy + 3, class: "sx-ft-id", "text-anchor": "middle" }, e.event.id));
17711
- parts.push(...leafCaption(e, cy + r6, label, showProb));
18114
+ parts.push(...leafCaption(e, cy + r7, label, showProb));
17712
18115
  } else if (e.role === "house") {
17713
18116
  const w = FAULTTREE_CONST.HOUSE_W, h = FAULTTREE_CONST.HOUSE_H, roofH = h * 0.34;
17714
18117
  const top = cy - h / 2, bottom = cy + h / 2, L = e.cx - w / 2, R = e.cx + w / 2;
@@ -17732,7 +18135,7 @@ function leafCaption(e, shapeBottom, label, showProb) {
17732
18135
  const out = [];
17733
18136
  const hasOwnLabel = !!e.event.label && e.event.label !== e.event.id;
17734
18137
  if (hasOwnLabel) {
17735
- out.push(chunk3WNW5Y7P_cjs.text({ x: e.cx, y: shapeBottom + FAULTTREE_CONST.CAP_GAP, class: "sx-ft-cap", "text-anchor": "middle" }, clip(label, 20)));
18138
+ out.push(chunk3WNW5Y7P_cjs.text({ x: e.cx, y: shapeBottom + FAULTTREE_CONST.CAP_GAP, class: "sx-ft-cap", "text-anchor": "middle" }, clip2(label, 20)));
17736
18139
  }
17737
18140
  if (showProb && e.event.prob !== void 0) {
17738
18141
  const y = shapeBottom + (hasOwnLabel ? FAULTTREE_CONST.CAP_GAP + FAULTTREE_CONST.CAP_LINE_H : FAULTTREE_CONST.CAP_GAP);
@@ -17790,7 +18193,7 @@ function topProbLabel(analysis) {
17790
18193
  if (analysis.topProb === void 0) return "P(top) = n/a (missing p)";
17791
18194
  return `P(top) = ${fmtProb(analysis.topProb)} (${analysis.method})`;
17792
18195
  }
17793
- function summarise(layout) {
18196
+ function summarise2(layout) {
17794
18197
  const { ast, analysis } = layout;
17795
18198
  const counts = {};
17796
18199
  for (const e of ast.events) counts[e.kind] = (counts[e.kind] ?? 0) + 1;
@@ -17820,7 +18223,7 @@ function fmtProb(n) {
17820
18223
  if (n >= 1e-3) return String(parseFloat(n.toPrecision(3)));
17821
18224
  return n.toExponential(2);
17822
18225
  }
17823
- function clip(s, n) {
18226
+ function clip2(s, n) {
17824
18227
  return s.length <= n ? s : s.slice(0, n - 1) + "\u2026";
17825
18228
  }
17826
18229
  function wrap2(s, perLine) {
@@ -17838,7 +18241,7 @@ function wrap2(s, perLine) {
17838
18241
  if (cur) lines.push(cur);
17839
18242
  if (lines.length > 2) {
17840
18243
  lines.length = 2;
17841
- lines[1] = clip(lines[1], perLine);
18244
+ lines[1] = clip2(lines[1], perLine);
17842
18245
  }
17843
18246
  return lines.join("<br/>");
17844
18247
  }
@@ -18327,7 +18730,7 @@ function renderBowtieLayout(layout, config) {
18327
18730
  );
18328
18731
  const children = [
18329
18732
  chunk3WNW5Y7P_cjs.title(a11y),
18330
- chunk3WNW5Y7P_cjs.desc(summarise2(layout)),
18733
+ chunk3WNW5Y7P_cjs.desc(summarise3(layout)),
18331
18734
  styleBlock,
18332
18735
  chunk3WNW5Y7P_cjs.rect({ x: 0, y: 0, width, height, class: "sx-bowtie-bg" })
18333
18736
  ];
@@ -18417,7 +18820,7 @@ function renderLegend2(layout, fontFamily) {
18417
18820
  }
18418
18821
  return chunk3WNW5Y7P_cjs.group({ class: "sx-bowtie-legend", "data-role": "legend" }, parts);
18419
18822
  }
18420
- function summarise2(layout) {
18823
+ function summarise3(layout) {
18421
18824
  const { ast } = layout;
18422
18825
  const barrierCount = layout.boxes.filter((b) => b.role === "barrier").length;
18423
18826
  const escCount = layout.boxes.filter((b) => b.role === "escalation").length;
@@ -18445,11 +18848,11 @@ function wrap3(s, perLine, maxLines) {
18445
18848
  }
18446
18849
  }
18447
18850
  if (cur && lines.length < maxLines) lines.push(cur);
18448
- else if (cur && lines.length === maxLines) lines[maxLines - 1] = clip2(`${lines[maxLines - 1]} ${cur}`, perLine);
18851
+ else if (cur && lines.length === maxLines) lines[maxLines - 1] = clip3(`${lines[maxLines - 1]} ${cur}`, perLine);
18449
18852
  if (lines.length === 0) lines.push(s);
18450
18853
  return lines;
18451
18854
  }
18452
- function clip2(s, n) {
18855
+ function clip3(s, n) {
18453
18856
  return s.length <= n ? s : s.slice(0, n - 1) + "\u2026";
18454
18857
  }
18455
18858
  function r4(n) {
@@ -18955,7 +19358,7 @@ function renderEventTreeLayout(layout, config) {
18955
19358
  );
18956
19359
  const children = [
18957
19360
  chunk3WNW5Y7P_cjs.title(a11y),
18958
- chunk3WNW5Y7P_cjs.desc(summarise3(layout)),
19361
+ chunk3WNW5Y7P_cjs.desc(summarise4(layout)),
18959
19362
  styleBlock,
18960
19363
  chunk3WNW5Y7P_cjs.rect({ x: 0, y: 0, width, height, class: "sx-et-bg" })
18961
19364
  ];
@@ -19026,7 +19429,7 @@ function renderEventTreeLayout(layout, config) {
19026
19429
  chunk3WNW5Y7P_cjs.el("circle", { cx: leaf.x, cy: leaf.y, r: 3, class: "sx-et-dot", ...dom }),
19027
19430
  chunk3WNW5Y7P_cjs.text(
19028
19431
  { x: leaf.x + 10, y: leaf.y - 4, class: "sx-et-outcome", ...dom },
19029
- clip3(seq.outcome, 30)
19432
+ clip4(seq.outcome, 30)
19030
19433
  ),
19031
19434
  chunk3WNW5Y7P_cjs.text(
19032
19435
  { x: leaf.x + 10, y: leaf.y + EVENTTREE_CONST.LEAF_LINE_H - 2, class: "sx-et-freq", ...dom },
@@ -19051,7 +19454,7 @@ function renderEventTreeLayout(layout, config) {
19051
19454
  children
19052
19455
  );
19053
19456
  }
19054
- function summarise3(layout) {
19457
+ function summarise4(layout) {
19055
19458
  const { ast, analysis } = layout;
19056
19459
  const parts = [
19057
19460
  `Event tree for "${ast.initiating.label ?? ast.initiating.id}" (f\u2080 = ${fmtFreq(ast.initiating.freq)}): ${ast.functions.length} function${ast.functions.length === 1 ? "" : "s"}, ${analysis.sequences.length} sequence${analysis.sequences.length === 1 ? "" : "s"}.`
@@ -19084,7 +19487,7 @@ function fmtProb2(n) {
19084
19487
  if (n >= 1e-3) return String(parseFloat(n.toPrecision(3)));
19085
19488
  return n.toExponential(2);
19086
19489
  }
19087
- function clip3(s, n) {
19490
+ function clip4(s, n) {
19088
19491
  return s.length <= n ? s : s.slice(0, n - 1) + "\u2026";
19089
19492
  }
19090
19493
 
@@ -19530,7 +19933,7 @@ function analyseFmea(ast) {
19530
19933
  }
19531
19934
  for (const act of ast.actions) {
19532
19935
  const target = flat.find(
19533
- (r6) => r6.mode === act.mode && (act.cause === void 0 || r6.cause === act.cause)
19936
+ (r7) => r7.mode === act.mode && (act.cause === void 0 || r7.cause === act.cause)
19534
19937
  );
19535
19938
  if (!target) {
19536
19939
  notes.push(`Action references unknown mode/cause "${act.mode}"${act.cause ? ` / "${act.cause}"` : ""}.`);
@@ -19553,41 +19956,41 @@ function analyseFmea(ast) {
19553
19956
  rpnDelta: rpn(target.sev, target.occ, target.det) - afterRpn
19554
19957
  };
19555
19958
  }
19556
- const rows = flat.map((r6) => {
19557
- const r0 = rpn(r6.sev, r6.occ, r6.det);
19558
- const ap = actionPriority(r6.sev, r6.occ, r6.det);
19959
+ const rows = flat.map((r7) => {
19960
+ const r0 = rpn(r7.sev, r7.occ, r7.det);
19961
+ const ap = actionPriority(r7.sev, r7.occ, r7.det);
19559
19962
  const flagged = ast.flag ? meetsThreshold(ast.flag, r0, ap) : false;
19560
19963
  return {
19561
19964
  index: 0,
19562
- item: r6.item,
19563
- fn: r6.fn,
19564
- mode: r6.mode,
19565
- effect: r6.effect,
19566
- effects: r6.effects,
19567
- sev: r6.sev,
19568
- cause: r6.cause,
19569
- occ: r6.occ,
19570
- det: r6.det,
19571
- controls: r6.controls,
19965
+ item: r7.item,
19966
+ fn: r7.fn,
19967
+ mode: r7.mode,
19968
+ effect: r7.effect,
19969
+ effects: r7.effects,
19970
+ sev: r7.sev,
19971
+ cause: r7.cause,
19972
+ occ: r7.occ,
19973
+ det: r7.det,
19974
+ controls: r7.controls,
19572
19975
  rpn: r0,
19573
19976
  ap,
19574
19977
  flagged,
19575
- action: r6.action,
19978
+ action: r7.action,
19576
19979
  itemFirst: false,
19577
19980
  itemSpan: 1,
19578
19981
  modeFirst: false,
19579
19982
  modeSpan: 1
19580
19983
  };
19581
19984
  });
19582
- const orig = new Map(rows.map((r6, i) => [r6, i]));
19985
+ const orig = new Map(rows.map((r7, i) => [r7, i]));
19583
19986
  rows.sort((a, b) => compareRows(a, b, ast.rank, orig));
19584
- rows.forEach((r6, i) => {
19585
- r6.index = i + 1;
19987
+ rows.forEach((r7, i) => {
19988
+ r7.index = i + 1;
19586
19989
  });
19587
19990
  computeSpans(rows);
19588
- const flaggedCount = rows.filter((r6) => r6.flagged).length;
19589
- const maxRpn = rows.reduce((m, r6) => Math.max(m, r6.rpn), 0);
19590
- const hasActions = rows.some((r6) => r6.action !== void 0);
19991
+ const flaggedCount = rows.filter((r7) => r7.flagged).length;
19992
+ const maxRpn = rows.reduce((m, r7) => Math.max(m, r7.rpn), 0);
19993
+ const hasActions = rows.some((r7) => r7.action !== void 0);
19591
19994
  return { rank: ast.rank, rows, flaggedCount, maxRpn, hasActions, notes };
19592
19995
  }
19593
19996
  function compareRows(a, b, rank, orig) {
@@ -19651,39 +20054,39 @@ var FMEA_CONST = {
19651
20054
  function buildColumnSpecs(hasActions, rank) {
19652
20055
  const C2 = FMEA_CONST;
19653
20056
  const specs = [
19654
- { key: "no", label: "#", width: 28, align: "middle", numeric: true, field: (r6) => String(r6.index) },
20057
+ { key: "no", label: "#", width: 28, align: "middle", numeric: true, field: (r7) => String(r7.index) },
19655
20058
  {
19656
20059
  key: "item",
19657
20060
  label: "Item / Function",
19658
20061
  width: 130,
19659
20062
  align: "start",
19660
20063
  numeric: false,
19661
- field: (r6) => r6.fn ? `${r6.item}
19662
- \u2014 ${r6.fn}` : r6.item
20064
+ field: (r7) => r7.fn ? `${r7.item}
20065
+ \u2014 ${r7.fn}` : r7.item
19663
20066
  },
19664
- { key: "mode", label: "Failure Mode", width: 120, align: "start", numeric: false, field: (r6) => r6.mode },
20067
+ { key: "mode", label: "Failure Mode", width: 120, align: "start", numeric: false, field: (r7) => r7.mode },
19665
20068
  {
19666
20069
  key: "effect",
19667
20070
  label: "Effect(s)",
19668
20071
  width: 120,
19669
20072
  align: "start",
19670
20073
  numeric: false,
19671
- field: (r6) => r6.effects.length > 1 ? r6.effects.join("; ") : r6.effect
20074
+ field: (r7) => r7.effects.length > 1 ? r7.effects.join("; ") : r7.effect
19672
20075
  },
19673
- { key: "sev", label: "S", width: C2.NUM_COL_W, align: "middle", band: "before", numeric: true, field: (r6) => String(r6.sev) },
19674
- { key: "cause", label: "Cause(s)", width: 120, align: "start", numeric: false, field: (r6) => r6.cause },
19675
- { key: "occ", label: "O", width: C2.NUM_COL_W, align: "middle", band: "before", numeric: true, field: (r6) => String(r6.occ) },
20076
+ { key: "sev", label: "S", width: C2.NUM_COL_W, align: "middle", band: "before", numeric: true, field: (r7) => String(r7.sev) },
20077
+ { key: "cause", label: "Cause(s)", width: 120, align: "start", numeric: false, field: (r7) => r7.cause },
20078
+ { key: "occ", label: "O", width: C2.NUM_COL_W, align: "middle", band: "before", numeric: true, field: (r7) => String(r7.occ) },
19676
20079
  {
19677
20080
  key: "controls",
19678
20081
  label: "Current Controls",
19679
20082
  width: 120,
19680
20083
  align: "start",
19681
20084
  numeric: false,
19682
- field: (r6) => controlsText(r6)
20085
+ field: (r7) => controlsText(r7)
19683
20086
  },
19684
- { key: "det", label: "D", width: C2.NUM_COL_W, align: "middle", band: "before", numeric: true, field: (r6) => String(r6.det) },
19685
- { key: "rpn", label: "RPN", width: C2.RPN_COL_W, align: "middle", band: "before", numeric: true, field: (r6) => String(r6.rpn) },
19686
- { key: "ap", label: "AP", width: C2.AP_COL_W, align: "middle", band: "before", numeric: true, field: (r6) => r6.ap }
20087
+ { key: "det", label: "D", width: C2.NUM_COL_W, align: "middle", band: "before", numeric: true, field: (r7) => String(r7.det) },
20088
+ { key: "rpn", label: "RPN", width: C2.RPN_COL_W, align: "middle", band: "before", numeric: true, field: (r7) => String(r7.rpn) },
20089
+ { key: "ap", label: "AP", width: C2.AP_COL_W, align: "middle", band: "before", numeric: true, field: (r7) => r7.ap }
19687
20090
  ];
19688
20091
  if (hasActions) {
19689
20092
  specs.push(
@@ -19694,7 +20097,7 @@ function buildColumnSpecs(hasActions, rank) {
19694
20097
  align: "start",
19695
20098
  numeric: false,
19696
20099
  afterOnly: true,
19697
- field: (r6) => actionText(r6)
20100
+ field: (r7) => actionText(r7)
19698
20101
  },
19699
20102
  {
19700
20103
  key: "rsev",
@@ -19704,7 +20107,7 @@ function buildColumnSpecs(hasActions, rank) {
19704
20107
  band: "after",
19705
20108
  numeric: true,
19706
20109
  afterOnly: true,
19707
- field: (r6) => r6.action ? String(r6.action.sev) : ""
20110
+ field: (r7) => r7.action ? String(r7.action.sev) : ""
19708
20111
  },
19709
20112
  {
19710
20113
  key: "rocc",
@@ -19714,7 +20117,7 @@ function buildColumnSpecs(hasActions, rank) {
19714
20117
  band: "after",
19715
20118
  numeric: true,
19716
20119
  afterOnly: true,
19717
- field: (r6) => r6.action ? String(r6.action.occ) : ""
20120
+ field: (r7) => r7.action ? String(r7.action.occ) : ""
19718
20121
  },
19719
20122
  {
19720
20123
  key: "rdet",
@@ -19724,7 +20127,7 @@ function buildColumnSpecs(hasActions, rank) {
19724
20127
  band: "after",
19725
20128
  numeric: true,
19726
20129
  afterOnly: true,
19727
- field: (r6) => r6.action ? String(r6.action.det) : ""
20130
+ field: (r7) => r7.action ? String(r7.action.det) : ""
19728
20131
  },
19729
20132
  {
19730
20133
  key: "rrpn",
@@ -19734,7 +20137,7 @@ function buildColumnSpecs(hasActions, rank) {
19734
20137
  band: "after",
19735
20138
  numeric: true,
19736
20139
  afterOnly: true,
19737
- field: (r6) => r6.action ? String(r6.action.rpn) : ""
20140
+ field: (r7) => r7.action ? String(r7.action.rpn) : ""
19738
20141
  },
19739
20142
  {
19740
20143
  key: "rap",
@@ -19744,26 +20147,26 @@ function buildColumnSpecs(hasActions, rank) {
19744
20147
  band: "after",
19745
20148
  numeric: true,
19746
20149
  afterOnly: true,
19747
- field: (r6) => r6.action ? r6.action.ap : ""
20150
+ field: (r7) => r7.action ? r7.action.ap : ""
19748
20151
  }
19749
20152
  );
19750
20153
  }
19751
20154
  return specs;
19752
20155
  }
19753
- function controlsText(r6) {
20156
+ function controlsText(r7) {
19754
20157
  const parts = [];
19755
- if (r6.controls?.prevention) parts.push(`P: ${r6.controls.prevention}`);
19756
- if (r6.controls?.detection) parts.push(`D: ${r6.controls.detection}`);
20158
+ if (r7.controls?.prevention) parts.push(`P: ${r7.controls.prevention}`);
20159
+ if (r7.controls?.detection) parts.push(`D: ${r7.controls.detection}`);
19757
20160
  return parts.join("\n");
19758
20161
  }
19759
- function actionText(r6) {
19760
- if (!r6.action) return "";
20162
+ function actionText(r7) {
20163
+ if (!r7.action) return "";
19761
20164
  const parts = [];
19762
- if (r6.action.recommendation) parts.push(r6.action.recommendation);
20165
+ if (r7.action.recommendation) parts.push(r7.action.recommendation);
19763
20166
  const meta = [];
19764
- if (r6.action.owner) meta.push(r6.action.owner);
19765
- if (r6.action.target) meta.push(r6.action.target);
19766
- if (r6.action.status) meta.push(`[${r6.action.status}]`);
20167
+ if (r7.action.owner) meta.push(r7.action.owner);
20168
+ if (r7.action.target) meta.push(r7.action.target);
20169
+ if (r7.action.status) meta.push(`[${r7.action.status}]`);
19767
20170
  if (meta.length) parts.push(meta.join(" \xB7 "));
19768
20171
  return parts.join("\n");
19769
20172
  }
@@ -20033,7 +20436,7 @@ function renderFmeaLayout(layout, config) {
20033
20436
  const style = chunk3WNW5Y7P_cjs.el("style", {}, buildCss9(p));
20034
20437
  const children = [
20035
20438
  chunk3WNW5Y7P_cjs.title(a11y),
20036
- chunk3WNW5Y7P_cjs.desc(summarise4(layout)),
20439
+ chunk3WNW5Y7P_cjs.desc(summarise5(layout)),
20037
20440
  style,
20038
20441
  chunk3WNW5Y7P_cjs.rect({ x: 0, y: 0, width, height, class: "sx-fmea-bg" })
20039
20442
  ];
@@ -20185,7 +20588,7 @@ function renderHeaderBlock(layout) {
20185
20588
  function capitalise(s) {
20186
20589
  return s.charAt(0).toUpperCase() + s.slice(1);
20187
20590
  }
20188
- function summarise4(layout) {
20591
+ function summarise5(layout) {
20189
20592
  const { ast, analysis } = layout;
20190
20593
  const top = analysis.rows[0];
20191
20594
  const parts = [
@@ -20237,6 +20640,658 @@ var fmea = {
20237
20640
  }
20238
20641
  };
20239
20642
 
20643
+ // src/diagrams/rbd/parser.ts
20644
+ function normalizeQuotes2(text2) {
20645
+ return text2.replace(/[“”„«»「」『』"]/g, '"').replace(/[‘’‚']/g, "'");
20646
+ }
20647
+ var RbdParseError = class extends Error {
20648
+ constructor(message) {
20649
+ super(message);
20650
+ this.name = "RbdParseError";
20651
+ }
20652
+ };
20653
+ var HEADER_RE = /^\s*(rbd|reliability(?:blockdiagram)?|reliability-block-diagram)\b/i;
20654
+ var GROUP_KW = /* @__PURE__ */ new Set(["series", "parallel", "kofn", "k-of-n", "voting"]);
20655
+ function parseRbd(text2) {
20656
+ const normalized = normalizeQuotes2(text2);
20657
+ const lines = normalized.split("\n");
20658
+ let headerIdx = -1;
20659
+ for (let i = 0; i < lines.length; i++) {
20660
+ if (lines[i].trim() === "") continue;
20661
+ if (!HEADER_RE.test(lines[i])) {
20662
+ throw new RbdParseError(
20663
+ `RBD must start with 'rbd' (or 'reliability'). Example: rbd "My System"`
20664
+ );
20665
+ }
20666
+ headerIdx = i;
20667
+ break;
20668
+ }
20669
+ if (headerIdx < 0) throw new RbdParseError("Empty RBD input.");
20670
+ const warnings = [];
20671
+ const metadata = {};
20672
+ const headerRest = lines[headerIdx].replace(HEADER_RE, "").trim();
20673
+ const title2 = extractQuoted(headerRest);
20674
+ const body = lines.slice(headerIdx + 1).join("\n");
20675
+ const tokens = tokenize6(stripBodyDirectives(body, metadata));
20676
+ const seenIds = /* @__PURE__ */ new Set();
20677
+ let pos = 0;
20678
+ const peek = () => tokens[pos];
20679
+ const parseBlock = () => {
20680
+ const idTok = tokens[pos++];
20681
+ if (idTok.t !== "word") throw new RbdParseError("Expected a block id.");
20682
+ const id = idTok.v;
20683
+ if (seenIds.has(id)) warnings.push(`Duplicate block id "${id}" \u2014 later definition rendered, ids should be unique.`);
20684
+ seenIds.add(id);
20685
+ let label;
20686
+ let R;
20687
+ if (peek()?.t === "string") {
20688
+ label = tokens[pos++].v;
20689
+ }
20690
+ while (peek()?.t === "word") {
20691
+ const w = peek().v;
20692
+ const attr = parseAttr(w);
20693
+ if (!attr) break;
20694
+ pos++;
20695
+ if (attr.key === "p") R = clamp01(1 - attr.value, w, warnings);
20696
+ else R = clamp01(attr.value, w, warnings);
20697
+ }
20698
+ return { kind: "block", id, ...label !== void 0 ? { label } : {}, ...R !== void 0 ? { R } : {} };
20699
+ };
20700
+ const parseGroup = (kwRaw) => {
20701
+ const kw = kwRaw.toLowerCase();
20702
+ let k;
20703
+ let n;
20704
+ if (kw === "kofn" || kw === "k-of-n" || kw === "voting") {
20705
+ const spec = peek();
20706
+ if (spec?.t === "word" && /^\d+\s*\/\s*\d+$/.test(spec.v)) {
20707
+ pos++;
20708
+ const [ks, ns] = spec.v.split("/");
20709
+ k = parseInt(ks, 10);
20710
+ n = parseInt(ns, 10);
20711
+ } else {
20712
+ throw new RbdParseError(`'${kwRaw}' needs a k/n threshold, e.g. 'kofn 2/3 { \u2026 }'.`);
20713
+ }
20714
+ }
20715
+ if (peek()?.t !== "lbrace") throw new RbdParseError(`Expected '{' after '${kwRaw}'.`);
20716
+ pos++;
20717
+ const children = parseList();
20718
+ if (peek()?.t !== "rbrace") throw new RbdParseError(`Unclosed '${kwRaw}' group \u2014 missing '}'.`);
20719
+ pos++;
20720
+ if (children.length === 0) warnings.push(`Empty '${kwRaw}' group ignored.`);
20721
+ const kind = kw === "series" ? "series" : "parallel";
20722
+ const isKofn = kw === "kofn" || kw === "k-of-n" || kw === "voting";
20723
+ if (isKofn) {
20724
+ const total = n ?? children.length;
20725
+ let thr = k ?? total;
20726
+ if (thr > total) {
20727
+ warnings.push(`k-of-n threshold k=${thr} exceeds n=${total} \u2014 clamped to ${total}.`);
20728
+ thr = total;
20729
+ }
20730
+ if (thr < 1) {
20731
+ warnings.push(`k-of-n threshold k=${thr} < 1 \u2014 clamped to 1.`);
20732
+ thr = 1;
20733
+ }
20734
+ return { kind: "kofn", k: thr, n: total, children };
20735
+ }
20736
+ return { kind, children };
20737
+ };
20738
+ const parseStructure = () => {
20739
+ const tok = peek();
20740
+ if (!tok) throw new RbdParseError("Unexpected end of input.");
20741
+ if (tok.t === "rbrace") throw new RbdParseError("Unexpected '}'.");
20742
+ if (tok.t === "string") throw new RbdParseError(`Unexpected quoted text "${tok.v}" \u2014 labels attach to a block.`);
20743
+ if (tok.t === "lbrace") throw new RbdParseError("Unexpected '{' \u2014 a group keyword (series/parallel/kofn) must precede it.");
20744
+ const w = tok.v;
20745
+ if (GROUP_KW.has(w.toLowerCase())) {
20746
+ pos++;
20747
+ return parseGroup(w);
20748
+ }
20749
+ if (w.toLowerCase() === "block") {
20750
+ pos++;
20751
+ return parseBlock();
20752
+ }
20753
+ return parseBlock();
20754
+ };
20755
+ function parseList() {
20756
+ const items = [];
20757
+ while (pos < tokens.length && peek()?.t !== "rbrace") {
20758
+ items.push(parseStructure());
20759
+ }
20760
+ return items;
20761
+ }
20762
+ const top = parseList();
20763
+ if (pos < tokens.length) throw new RbdParseError("Unbalanced '}' in RBD body.");
20764
+ let root;
20765
+ if (top.length === 0) {
20766
+ throw new RbdParseError("RBD has no blocks. Add at least one `block ID R=\u2026`.");
20767
+ } else if (top.length === 1 && top[0].kind !== "block") {
20768
+ root = top[0];
20769
+ } else {
20770
+ root = { kind: "series", children: top };
20771
+ }
20772
+ return {
20773
+ type: "rbd",
20774
+ ...title2 ? { title: title2 } : {},
20775
+ root,
20776
+ warnings,
20777
+ ...Object.keys(metadata).length > 0 ? { metadata } : {}
20778
+ };
20779
+ }
20780
+ function tokenize6(src) {
20781
+ const out = [];
20782
+ let i = 0;
20783
+ const n = src.length;
20784
+ const isQuote2 = (c) => c === '"' || c === "'";
20785
+ while (i < n) {
20786
+ const c = src[i];
20787
+ if (c === "#") {
20788
+ while (i < n && src[i] !== "\n") i++;
20789
+ continue;
20790
+ }
20791
+ if (/\s/.test(c)) {
20792
+ i++;
20793
+ continue;
20794
+ }
20795
+ if (c === "{") {
20796
+ out.push({ t: "lbrace" });
20797
+ i++;
20798
+ continue;
20799
+ }
20800
+ if (c === "}") {
20801
+ out.push({ t: "rbrace" });
20802
+ i++;
20803
+ continue;
20804
+ }
20805
+ if (isQuote2(c)) {
20806
+ const close = c;
20807
+ let v2 = "";
20808
+ i++;
20809
+ while (i < n && src[i] !== close) {
20810
+ v2 += src[i];
20811
+ i++;
20812
+ }
20813
+ i++;
20814
+ out.push({ t: "string", v: v2.trim() });
20815
+ continue;
20816
+ }
20817
+ let v = "";
20818
+ while (i < n && !/\s/.test(src[i]) && src[i] !== "{" && src[i] !== "}" && !isQuote2(src[i])) {
20819
+ v += src[i];
20820
+ i++;
20821
+ }
20822
+ out.push({ t: "word", v });
20823
+ }
20824
+ return out;
20825
+ }
20826
+ function stripBodyDirectives(body, metadata) {
20827
+ return body.split("\n").filter((line2) => {
20828
+ const m = line2.match(/^\s*(title|standard|note)\s*:\s*(.+)$/i);
20829
+ if (m) {
20830
+ const key = m[1].toLowerCase();
20831
+ if (key !== "title") metadata[key] = m[2].trim();
20832
+ else metadata.title = m[2].trim();
20833
+ return false;
20834
+ }
20835
+ return true;
20836
+ }).join("\n");
20837
+ }
20838
+ function extractQuoted(s) {
20839
+ const m = s.match(/^["']([^"']*)["']/);
20840
+ if (m) return m[1].trim();
20841
+ return s.length > 0 ? s.trim() : void 0;
20842
+ }
20843
+ function parseAttr(w) {
20844
+ const m = w.match(/^(R|r|p|prob|q)\s*[=:]\s*(.+)$/);
20845
+ if (m) {
20846
+ const key = m[1].toLowerCase();
20847
+ const value = parseNum(m[2]);
20848
+ if (value === void 0) return null;
20849
+ return { key: key === "p" || key === "q" ? "p" : "R", value };
20850
+ }
20851
+ const bare = parseNum(w);
20852
+ if (bare !== void 0) return { key: "R", value: bare };
20853
+ return null;
20854
+ }
20855
+ function parseNum(s) {
20856
+ const t = s.trim();
20857
+ if (/%$/.test(t)) {
20858
+ const v2 = parseFloat(t.slice(0, -1));
20859
+ return Number.isFinite(v2) ? v2 / 100 : void 0;
20860
+ }
20861
+ const v = parseFloat(t);
20862
+ return Number.isFinite(v) ? v : void 0;
20863
+ }
20864
+ function clamp01(v, raw, warnings) {
20865
+ if (v < 0) {
20866
+ warnings.push(`Reliability ${raw} < 0 \u2014 clamped to 0.`);
20867
+ return 0;
20868
+ }
20869
+ if (v > 1) {
20870
+ warnings.push(`Reliability ${raw} > 1 \u2014 clamped to 1.`);
20871
+ return 1;
20872
+ }
20873
+ return v;
20874
+ }
20875
+
20876
+ // src/diagrams/rbd/analysis.ts
20877
+ var KOFN_ENUM_CAP = 18;
20878
+ function analyseRbd(ast) {
20879
+ const notes = [];
20880
+ const warnings = [...ast.warnings];
20881
+ const blocks = [];
20882
+ collectBlocks(ast.root, blocks);
20883
+ const missing = blocks.filter((b) => b.R === void 0).map((b) => b.id);
20884
+ const baseEnv = new Map(blocks.map((b) => [b.id, b.R]));
20885
+ const systemReliability = evalStructure(ast.root, baseEnv, notes);
20886
+ const results = blocks.map((b) => {
20887
+ if (systemReliability === void 0) {
20888
+ return { id: b.id, ...b.R !== void 0 ? { R: b.R } : {}, isSpof: false };
20889
+ }
20890
+ const up = new Map(baseEnv);
20891
+ up.set(b.id, 1);
20892
+ const down = new Map(baseEnv);
20893
+ down.set(b.id, 0);
20894
+ const rUp = evalStructure(ast.root, up, notes);
20895
+ const rDown = evalStructure(ast.root, down, notes);
20896
+ const importance = rUp !== void 0 && rDown !== void 0 ? rUp - rDown : void 0;
20897
+ const isSpof = rDown === 0;
20898
+ return {
20899
+ id: b.id,
20900
+ ...b.R !== void 0 ? { R: b.R } : {},
20901
+ ...importance !== void 0 ? { importance } : {},
20902
+ isSpof
20903
+ };
20904
+ });
20905
+ let criticalBlock;
20906
+ let best = -Infinity;
20907
+ for (const r7 of results) {
20908
+ if (r7.importance !== void 0 && r7.importance > best) {
20909
+ best = r7.importance;
20910
+ criticalBlock = r7.id;
20911
+ }
20912
+ }
20913
+ if (systemReliability !== void 0) {
20914
+ const spofs = results.filter((r7) => r7.isSpof).map((r7) => r7.id);
20915
+ if (spofs.length === 0) notes.push("No single point of failure \u2014 every block has redundancy in the success path.");
20916
+ }
20917
+ return {
20918
+ ...systemReliability !== void 0 ? { systemReliability } : {},
20919
+ blocks: results,
20920
+ missing,
20921
+ ...criticalBlock ? { criticalBlock } : {},
20922
+ warnings,
20923
+ notes
20924
+ };
20925
+ }
20926
+ function collectBlocks(s, out) {
20927
+ if (s.kind === "block") {
20928
+ out.push({ id: s.id, ...s.R !== void 0 ? { R: s.R } : {} });
20929
+ return;
20930
+ }
20931
+ for (const c of s.children) collectBlocks(c, out);
20932
+ }
20933
+ function evalStructure(s, env, notes) {
20934
+ if (s.kind === "block") return env.get(s.id);
20935
+ const childR = s.children.map((c) => evalStructure(c, env, notes));
20936
+ if (childR.some((r7) => r7 === void 0)) return void 0;
20937
+ const rs = childR;
20938
+ if (rs.length === 0) return 1;
20939
+ if (s.kind === "series") {
20940
+ return rs.reduce((p, r7) => p * r7, 1);
20941
+ }
20942
+ if (s.kind === "parallel") {
20943
+ return 1 - rs.reduce((p, r7) => p * (1 - r7), 1);
20944
+ }
20945
+ const n = rs.length;
20946
+ const k = Math.min(Math.max(s.k ?? n, 1), n);
20947
+ if (n > KOFN_ENUM_CAP) {
20948
+ notes.push(`k-of-n group with n=${n} exceeds the exact-enumeration cap (${KOFN_ENUM_CAP}); reported as a parallel bound.`);
20949
+ return 1 - rs.reduce((p, r7) => p * (1 - r7), 1);
20950
+ }
20951
+ return kofnReliability(rs, k);
20952
+ }
20953
+ function kofnReliability(rs, k) {
20954
+ const n = rs.length;
20955
+ let total = 0;
20956
+ for (let mask = 0; mask < 1 << n; mask++) {
20957
+ let working = 0;
20958
+ let prob = 1;
20959
+ for (let i = 0; i < n; i++) {
20960
+ if (mask & 1 << i) {
20961
+ working++;
20962
+ prob *= rs[i];
20963
+ } else prob *= 1 - rs[i];
20964
+ }
20965
+ if (working >= k) total += prob;
20966
+ }
20967
+ return total;
20968
+ }
20969
+
20970
+ // src/diagrams/rbd/layout.ts
20971
+ var RBD_CONST = {
20972
+ BLOCK_H: 46,
20973
+ BLOCK_MIN_W: 96,
20974
+ BLOCK_MAX_W: 200,
20975
+ BLOCK_RX: 5,
20976
+ CHAR_W: 6.9,
20977
+ PAD_X: 14,
20978
+ /** Horizontal wire length between series members. */
20979
+ H_GAP: 44,
20980
+ /** Vertical gap between parallel rails. */
20981
+ V_GAP: 26,
20982
+ /** Fan-out / merge horizontal stub flanking a parallel group. */
20983
+ SPLIT_STUB: 30,
20984
+ NODE_R: 3.5,
20985
+ /** Input/output terminal stub at the network ends. */
20986
+ TERM_STUB: 30,
20987
+ CAP_GAP: 15,
20988
+ CAP_LINE_H: 13,
20989
+ CANVAS_PAD: 28,
20990
+ TITLE_H: 32,
20991
+ HEADER_H: 26
20992
+ };
20993
+ function blockWidth(label) {
20994
+ const C2 = RBD_CONST;
20995
+ return Math.min(C2.BLOCK_MAX_W, Math.max(C2.BLOCK_MIN_W, Math.ceil(label.length * C2.CHAR_W) + 2 * C2.PAD_X));
20996
+ }
20997
+ function layoutRbd(ast) {
20998
+ const C2 = RBD_CONST;
20999
+ const analysis = analyseRbd(ast);
21000
+ const spof = new Set(analysis.blocks.filter((b) => b.isSpof).map((b) => b.id));
21001
+ const rById = new Map(analysis.blocks.map((b) => [b.id, b.R]));
21002
+ const blocks = [];
21003
+ const nodes = [];
21004
+ const wires = [];
21005
+ const marks = [];
21006
+ const measure = (s) => {
21007
+ if (s.kind === "block") {
21008
+ return { s, w: blockWidth(s.label ?? s.id), h: C2.BLOCK_H, children: [] };
21009
+ }
21010
+ const children = s.children.map(measure);
21011
+ if (children.length === 0) return { s, w: C2.BLOCK_MIN_W, h: C2.BLOCK_H, children };
21012
+ if (s.kind === "series") {
21013
+ const w2 = children.reduce((acc, c) => acc + c.w, 0) + C2.H_GAP * (children.length - 1);
21014
+ const h2 = Math.max(...children.map((c) => c.h));
21015
+ return { s, w: w2, h: h2, children };
21016
+ }
21017
+ const innerW = Math.max(...children.map((c) => c.w));
21018
+ const w = innerW + 2 * C2.SPLIT_STUB;
21019
+ const h = children.reduce((acc, c) => acc + c.h, 0) + C2.V_GAP * (children.length - 1);
21020
+ return { s, w, h, children };
21021
+ };
21022
+ const place = (m, x, yc2) => {
21023
+ const s = m.s;
21024
+ if (s.kind === "block") {
21025
+ const r7 = rById.get(s.id);
21026
+ blocks.push({
21027
+ block: s,
21028
+ x,
21029
+ y: yc2 - C2.BLOCK_H / 2,
21030
+ width: m.w,
21031
+ height: C2.BLOCK_H,
21032
+ ...r7 !== void 0 ? { R: r7 } : {},
21033
+ isSpof: spof.has(s.id),
21034
+ critical: analysis.criticalBlock === s.id
21035
+ });
21036
+ return { entryX: x, exitX: x + m.w };
21037
+ }
21038
+ if (s.kind === "series") {
21039
+ let cursor = x;
21040
+ let prevExit = null;
21041
+ let firstEntry = x;
21042
+ let lastExit = x;
21043
+ m.children.forEach((cm, i) => {
21044
+ const ep2 = place(cm, cursor, yc2);
21045
+ if (i === 0) firstEntry = ep2.entryX;
21046
+ if (prevExit !== null) wires.push({ path: `M ${r6(prevExit)} ${r6(yc2)} L ${r6(ep2.entryX)} ${r6(yc2)}` });
21047
+ prevExit = ep2.exitX;
21048
+ lastExit = ep2.exitX;
21049
+ cursor = ep2.exitX + C2.H_GAP;
21050
+ });
21051
+ return { entryX: firstEntry, exitX: lastExit };
21052
+ }
21053
+ const innerW = Math.max(...m.children.map((c) => c.w));
21054
+ const splitX = x + C2.NODE_R;
21055
+ const mergeX = x + m.w - C2.NODE_R;
21056
+ const childBandX = x + C2.SPLIT_STUB;
21057
+ nodes.push({ kind: "split", x: splitX, y: yc2 });
21058
+ nodes.push({ kind: "join", x: mergeX, y: yc2 });
21059
+ let runY = yc2 - m.h / 2;
21060
+ for (const cm of m.children) {
21061
+ const childYc = runY + cm.h / 2;
21062
+ const childStartX = childBandX + (innerW - cm.w) / 2;
21063
+ const ep2 = place(cm, childStartX, childYc);
21064
+ wires.push({ path: `M ${r6(splitX)} ${r6(yc2)} L ${r6(splitX)} ${r6(childYc)} L ${r6(ep2.entryX)} ${r6(childYc)}` });
21065
+ wires.push({ path: `M ${r6(ep2.exitX)} ${r6(childYc)} L ${r6(mergeX)} ${r6(childYc)} L ${r6(mergeX)} ${r6(yc2)}` });
21066
+ runY += cm.h + C2.V_GAP;
21067
+ }
21068
+ if (s.kind === "kofn") {
21069
+ marks.push({ x: mergeX + 6, y: yc2 - m.h / 2 - 6, text: `${s.k}/${s.n ?? m.children.length}` });
21070
+ }
21071
+ return { entryX: splitX, exitX: mergeX };
21072
+ };
21073
+ const rootM = measure(ast.root);
21074
+ const headerH = (ast.title ? C2.TITLE_H : 0) + C2.HEADER_H;
21075
+ const yc = C2.CANVAS_PAD + headerH + rootM.h / 2;
21076
+ const originX = C2.CANVAS_PAD + C2.TERM_STUB;
21077
+ const ep = place(rootM, originX, yc);
21078
+ const inX = C2.CANVAS_PAD;
21079
+ const outX = ep.exitX + C2.TERM_STUB;
21080
+ nodes.push({ kind: "in", x: inX, y: yc });
21081
+ nodes.push({ kind: "out", x: outX, y: yc });
21082
+ wires.push({ path: `M ${r6(inX)} ${r6(yc)} L ${r6(ep.entryX)} ${r6(yc)}` });
21083
+ wires.push({ path: `M ${r6(ep.exitX)} ${r6(yc)} L ${r6(outX)} ${r6(yc)}` });
21084
+ let maxX = outX;
21085
+ let maxY = yc + rootM.h / 2;
21086
+ for (const b of blocks) {
21087
+ maxX = Math.max(maxX, b.x + b.width);
21088
+ const capLines = (b.R !== void 0 ? 1 : 0) + (b.block.label && b.block.label !== b.block.id ? 1 : 0);
21089
+ maxY = Math.max(maxY, b.y + b.height + (capLines > 0 ? C2.CAP_GAP + capLines * C2.CAP_LINE_H : 0));
21090
+ }
21091
+ for (const mk of marks) maxX = Math.max(maxX, mk.x + 24);
21092
+ return {
21093
+ ast,
21094
+ analysis,
21095
+ blocks,
21096
+ nodes,
21097
+ wires,
21098
+ marks,
21099
+ width: Math.ceil(maxX + C2.CANVAS_PAD),
21100
+ height: Math.ceil(maxY + C2.CANVAS_PAD)
21101
+ };
21102
+ }
21103
+ function r6(n) {
21104
+ return Math.round(n * 10) / 10;
21105
+ }
21106
+
21107
+ // src/diagrams/rbd/renderer.ts
21108
+ function renderRbd(text2, config) {
21109
+ const ast = parseRbd(text2);
21110
+ const layout = layoutRbd(ast);
21111
+ return renderRbdLayout(layout, config);
21112
+ }
21113
+ function renderRbdLayout(layout, config) {
21114
+ const theme = chunkENUM7GMZ_cjs.resolveReliabilityTheme(config?.theme ?? "default");
21115
+ const fontFamily = config?.fontFamily ?? chunkENUM7GMZ_cjs.DEFAULT_FONT_FAMILY;
21116
+ const pad = config?.padding ?? 0;
21117
+ const { ast, analysis } = layout;
21118
+ const width = layout.width + pad * 2;
21119
+ const height = layout.height + pad * 2;
21120
+ const a11y = ast.title ?? "Reliability block diagram";
21121
+ const styleBlock = chunk3WNW5Y7P_cjs.el(
21122
+ "style",
21123
+ {},
21124
+ `
21125
+ .sx-rbd-bg { fill: ${theme.bg}; }
21126
+ .sx-rbd-wire { fill: none; stroke: ${theme.edgeStroke}; stroke-width: ${chunkENUM7GMZ_cjs.STROKE_WIDTH.normal}; }
21127
+ .sx-rbd-node { fill: ${theme.edgeStroke}; stroke: none; }
21128
+ .sx-rbd-term { fill: ${theme.eventFill}; stroke: ${theme.eventStroke}; stroke-width: ${chunkENUM7GMZ_cjs.STROKE_WIDTH.normal}; }
21129
+ .sx-rbd-block { fill: ${theme.eventFill}; stroke: ${theme.eventStroke}; stroke-width: ${chunkENUM7GMZ_cjs.STROKE_WIDTH.normal}; }
21130
+ .sx-rbd-block[data-spof="true"] { stroke: ${theme.spofStroke}; stroke-width: ${chunkENUM7GMZ_cjs.STROKE_WIDTH.thick}; }
21131
+ .sx-rbd-block[data-critical="true"] { stroke: ${theme.gateStroke}; stroke-width: 2.25; }
21132
+ .sx-rbd-label { fill: ${theme.eventStroke}; font-size: ${chunkENUM7GMZ_cjs.FONT_SIZE.label}px; font-weight: 600; }
21133
+ .sx-rbd-r { fill: ${theme.probText}; font-size: ${chunkENUM7GMZ_cjs.FONT_SIZE.small}px; font-weight: 600; }
21134
+ .sx-rbd-mark { fill: ${theme.gateStroke}; font-size: ${chunkENUM7GMZ_cjs.FONT_SIZE.small}px; font-weight: 700; }
21135
+ .sx-rbd-rsys { fill: ${theme.probText}; font-size: ${chunkENUM7GMZ_cjs.FONT_SIZE.label + 1}px; font-weight: 700; }
21136
+ .sx-rbd-title { fill: ${theme.eventStroke}; font-size: ${chunkENUM7GMZ_cjs.FONT_SIZE.title}px; font-weight: 700; }
21137
+ `.trim()
21138
+ );
21139
+ const children = [
21140
+ chunk3WNW5Y7P_cjs.title(a11y),
21141
+ chunk3WNW5Y7P_cjs.desc(summarise6(layout)),
21142
+ styleBlock,
21143
+ chunk3WNW5Y7P_cjs.rect({ x: 0, y: 0, width, height, class: "sx-rbd-bg" })
21144
+ ];
21145
+ const inner = [];
21146
+ if (ast.title) {
21147
+ inner.push(
21148
+ chunk3WNW5Y7P_cjs.text(
21149
+ { x: RBD_CONST.CANVAS_PAD, y: 22, class: "sx-rbd-title", "font-family": fontFamily },
21150
+ ast.title
21151
+ )
21152
+ );
21153
+ }
21154
+ inner.push(
21155
+ chunk3WNW5Y7P_cjs.text(
21156
+ {
21157
+ x: layout.width / 2,
21158
+ y: (ast.title ? RBD_CONST.TITLE_H : 0) + 18,
21159
+ class: "sx-rbd-rsys",
21160
+ "text-anchor": "middle"
21161
+ },
21162
+ systemLabel(analysis)
21163
+ )
21164
+ );
21165
+ for (const w of layout.wires) inner.push(chunk3WNW5Y7P_cjs.path({ d: w.path, class: "sx-rbd-wire" }));
21166
+ for (const n of layout.nodes) {
21167
+ if (n.kind === "in" || n.kind === "out") {
21168
+ inner.push(chunk3WNW5Y7P_cjs.circle({ cx: n.x, cy: n.y, r: 6, class: "sx-rbd-term", "data-node": n.kind }));
21169
+ } else {
21170
+ inner.push(chunk3WNW5Y7P_cjs.circle({ cx: n.x, cy: n.y, r: RBD_CONST.NODE_R, class: "sx-rbd-node", "data-node": n.kind }));
21171
+ }
21172
+ }
21173
+ for (const mk of layout.marks) {
21174
+ inner.push(chunk3WNW5Y7P_cjs.text({ x: mk.x, y: mk.y, class: "sx-rbd-mark" }, mk.text));
21175
+ }
21176
+ for (const b of layout.blocks) inner.push(renderBlock(b));
21177
+ children.push(
21178
+ chunk3WNW5Y7P_cjs.group({ transform: pad ? `translate(${pad}, ${pad})` : void 0, "font-family": fontFamily }, inner)
21179
+ );
21180
+ return chunk3WNW5Y7P_cjs.svgRoot(
21181
+ {
21182
+ width,
21183
+ height,
21184
+ viewBox: `0 0 ${width} ${height}`,
21185
+ role: "img",
21186
+ "aria-label": a11y,
21187
+ "data-diagram-type": "rbd"
21188
+ },
21189
+ children
21190
+ );
21191
+ }
21192
+ function renderBlock(b) {
21193
+ const cx = b.x + b.width / 2;
21194
+ const cy = b.y + b.height / 2;
21195
+ const label = b.block.label ?? b.block.id;
21196
+ const parts = [
21197
+ chunk3WNW5Y7P_cjs.rect({
21198
+ x: b.x,
21199
+ y: b.y,
21200
+ width: b.width,
21201
+ height: b.height,
21202
+ rx: RBD_CONST.BLOCK_RX,
21203
+ class: "sx-rbd-block",
21204
+ ...b.isSpof ? { "data-spof": "true" } : {},
21205
+ ...b.critical && !b.isSpof ? { "data-critical": "true" } : {}
21206
+ }),
21207
+ chunk3WNW5Y7P_cjs.multilineText(
21208
+ { x: cx, y: cy, class: "sx-rbd-label", "text-anchor": "middle", "dominant-baseline": "middle" },
21209
+ wrap4(label, 18),
21210
+ 13
21211
+ )
21212
+ ];
21213
+ if (b.R !== void 0) {
21214
+ parts.push(
21215
+ chunk3WNW5Y7P_cjs.text(
21216
+ { x: cx, y: b.y + b.height + RBD_CONST.CAP_GAP, class: "sx-rbd-r", "text-anchor": "middle" },
21217
+ `R=${fmtR(b.R)}`
21218
+ )
21219
+ );
21220
+ }
21221
+ return chunk3WNW5Y7P_cjs.group(
21222
+ {
21223
+ class: "sx-rbd-block-g",
21224
+ "data-id": b.block.id,
21225
+ ...b.R !== void 0 ? { "data-r": String(b.R) } : {},
21226
+ ...b.isSpof ? { "data-spof": "true" } : {},
21227
+ ...b.critical ? { "data-critical": "true" } : {}
21228
+ },
21229
+ parts
21230
+ );
21231
+ }
21232
+ function systemLabel(analysis) {
21233
+ if (analysis.systemReliability === void 0) {
21234
+ const miss = analysis.missing.length > 0 ? ` \u2014 missing R on ${analysis.missing.join(", ")}` : "";
21235
+ return `System reliability: n/a${miss}`;
21236
+ }
21237
+ return `System reliability R = ${fmtR(analysis.systemReliability)}`;
21238
+ }
21239
+ function fmtR(n) {
21240
+ if (n >= 1) return "1";
21241
+ if (n <= 0) return "0";
21242
+ for (let p = 5; p <= 9; p++) {
21243
+ const s = parseFloat(n.toPrecision(p));
21244
+ if (s < 1) return String(s);
21245
+ }
21246
+ return String(parseFloat(n.toPrecision(9)));
21247
+ }
21248
+ function summarise6(layout) {
21249
+ const { analysis } = layout;
21250
+ const n = layout.blocks.length;
21251
+ const parts = [`Reliability block diagram: ${n} block${n === 1 ? "" : "s"}.`];
21252
+ if (analysis.systemReliability !== void 0) {
21253
+ parts.push(`System reliability R = ${fmtR(analysis.systemReliability)}.`);
21254
+ } else if (analysis.missing.length > 0) {
21255
+ parts.push(`System reliability n/a \u2014 missing R on ${analysis.missing.join(", ")}.`);
21256
+ }
21257
+ const spofs = analysis.blocks.filter((b) => b.isSpof).map((b) => b.id);
21258
+ if (spofs.length > 0) parts.push(`Single point${spofs.length > 1 ? "s" : ""} of failure: ${spofs.join(", ")}.`);
21259
+ if (analysis.criticalBlock) parts.push(`Highest reliability-importance block: ${analysis.criticalBlock}.`);
21260
+ for (const note of analysis.notes) parts.push(note);
21261
+ for (const w of analysis.warnings) parts.push(w);
21262
+ return parts.join(" ");
21263
+ }
21264
+ function wrap4(s, perLine) {
21265
+ if (s.length <= perLine) return s;
21266
+ const words = s.split(/\s+/);
21267
+ const lines = [];
21268
+ let cur = "";
21269
+ for (const w of words) {
21270
+ if (cur && cur.length + 1 + w.length > perLine) {
21271
+ lines.push(cur);
21272
+ cur = w;
21273
+ } else cur = cur ? `${cur} ${w}` : w;
21274
+ }
21275
+ if (cur) lines.push(cur);
21276
+ if (lines.length > 2) {
21277
+ lines.length = 2;
21278
+ lines[1] = lines[1].slice(0, perLine - 1) + "\u2026";
21279
+ }
21280
+ return lines.join("<br/>");
21281
+ }
21282
+
21283
+ // src/diagrams/rbd/index.ts
21284
+ var rbd = {
21285
+ type: "rbd",
21286
+ detect(text2) {
21287
+ return /^\s*(rbd|reliability(?:blockdiagram)?|reliability-block-diagram)\b/i.test(text2);
21288
+ },
21289
+ parse: parseRbd,
21290
+ render(text2, config) {
21291
+ return renderRbd(text2, config);
21292
+ }
21293
+ };
21294
+
20240
21295
  // src/diagrams/causalloop/parser.ts
20241
21296
  var CausalLoopParseError = class extends Error {
20242
21297
  constructor(message, line2) {
@@ -20930,7 +21985,7 @@ function renderCausalLoopLayout(layout, config) {
20930
21985
  );
20931
21986
  const children = [
20932
21987
  chunk3WNW5Y7P_cjs.title(a11y),
20933
- chunk3WNW5Y7P_cjs.desc(summarise5(layout)),
21988
+ chunk3WNW5Y7P_cjs.desc(summarise7(layout)),
20934
21989
  styleBlock,
20935
21990
  chunk3WNW5Y7P_cjs.el("rect", { x: 0, y: 0, width, height, class: "sx-cld-bg" })
20936
21991
  ];
@@ -21044,17 +22099,17 @@ function arrowhead(x, y, tx, ty) {
21044
22099
  return chunk3WNW5Y7P_cjs.polygon({ points: `${tip} ${p1} ${p2}`, class: "sx-cld-arrow" });
21045
22100
  }
21046
22101
  function renderGlyph(g) {
21047
- const r6 = g.r;
22102
+ const r7 = g.r;
21048
22103
  const startAng = -Math.PI / 2;
21049
22104
  const sweep = 300 * Math.PI / 180;
21050
22105
  const endAng = g.clockwise ? startAng + sweep : startAng - sweep;
21051
- const sx = g.cx + r6 * Math.cos(startAng);
21052
- const sy = g.cy + r6 * Math.sin(startAng);
21053
- const ex = g.cx + r6 * Math.cos(endAng);
21054
- const ey = g.cy + r6 * Math.sin(endAng);
22106
+ const sx = g.cx + r7 * Math.cos(startAng);
22107
+ const sy = g.cy + r7 * Math.sin(startAng);
22108
+ const ex = g.cx + r7 * Math.cos(endAng);
22109
+ const ey = g.cy + r7 * Math.sin(endAng);
21055
22110
  const largeArc = 1;
21056
22111
  const sweepFlag = g.clockwise ? 1 : 0;
21057
- const arc = `M ${fmt4(sx)} ${fmt4(sy)} A ${r6} ${r6} 0 ${largeArc} ${sweepFlag} ${fmt4(ex)} ${fmt4(ey)}`;
22112
+ const arc = `M ${fmt4(sx)} ${fmt4(sy)} A ${r7} ${r7} 0 ${largeArc} ${sweepFlag} ${fmt4(ex)} ${fmt4(ey)}`;
21058
22113
  const dir = g.clockwise ? 1 : -1;
21059
22114
  const tx = -Math.sin(endAng) * dir;
21060
22115
  const ty = Math.cos(endAng) * dir;
@@ -21099,7 +22154,7 @@ function glyphArrow(x, y, tx, ty) {
21099
22154
  const p2 = `${fmt4(bx - px * wide)},${fmt4(by - py * wide)}`;
21100
22155
  return chunk3WNW5Y7P_cjs.polygon({ points: `${fmt4(x)},${fmt4(y)} ${p1} ${p2}`, class: "sx-cld-glyph-head" });
21101
22156
  }
21102
- function summarise5(layout) {
22157
+ function summarise7(layout) {
21103
22158
  const { ast, analysis } = layout;
21104
22159
  const parts = [
21105
22160
  `Causal loop diagram${ast.title ? ` "${ast.title}"` : ""}: ${ast.variables.length} variable${ast.variables.length === 1 ? "" : "s"}, ${ast.links.length} causal link${ast.links.length === 1 ? "" : "s"}.`
@@ -21148,7 +22203,7 @@ var MarkovParseError = class extends Error {
21148
22203
  };
21149
22204
  var OPENERS2 = ['"', "\u201C", "\u300C", "\u300E", "\xAB"];
21150
22205
  var CLOSERS2 = ['"', "\u201D", "\u300D", "\u300F", "\xBB"];
21151
- function tokenize6(s) {
22206
+ function tokenize7(s) {
21152
22207
  const out = [];
21153
22208
  let i = 0;
21154
22209
  while (i < s.length) {
@@ -21233,7 +22288,7 @@ function parseMarkov(text2) {
21233
22288
  if (trimmed.startsWith("#") || trimmed.startsWith("//")) continue;
21234
22289
  if (!sawHeader && /^(markov|markovchain)\b/i.test(trimmed)) {
21235
22290
  sawHeader = true;
21236
- const toks = tokenize6(trimmed);
22291
+ const toks = tokenize7(trimmed);
21237
22292
  const titleTok = toks.find((t, idx) => idx > 0 && t.quoted);
21238
22293
  if (titleTok) ast.title = titleTok.text;
21239
22294
  else if (toks[1] && !toks[1].quoted) ast.title = toks.slice(1).map((t) => t.text).join(" ");
@@ -21291,7 +22346,7 @@ function parseMarkov(text2) {
21291
22346
  return ast;
21292
22347
  }
21293
22348
  function parseStateDecl(line2, lineNo, ensureState) {
21294
- const toks = tokenize6(normalizeKeyNums2(line2));
22349
+ const toks = tokenize7(normalizeKeyNums2(line2));
21295
22350
  const idTok = toks[1];
21296
22351
  if (!idTok || idTok.quoted) throw new MarkovParseError(`state is missing an id`, lineNo);
21297
22352
  const id = idTok.text;
@@ -21565,22 +22620,22 @@ function computeAbsorbing(P, order, classification) {
21565
22620
  const absorbing = order.filter((id) => absorbingSet.has(id));
21566
22621
  const pos = new Map(order.map((id, i) => [id, i]));
21567
22622
  const t = transient.length;
21568
- const r6 = absorbing.length;
22623
+ const r7 = absorbing.length;
21569
22624
  const Q = Array.from({ length: t }, () => new Array(t).fill(0));
21570
- const R = Array.from({ length: t }, () => new Array(r6).fill(0));
22625
+ const R = Array.from({ length: t }, () => new Array(r7).fill(0));
21571
22626
  for (let a = 0; a < t; a++) {
21572
22627
  const fi = pos.get(transient[a]);
21573
22628
  for (let b = 0; b < t; b++) Q[a][b] = P[fi][pos.get(transient[b])];
21574
- for (let b = 0; b < r6; b++) R[a][b] = P[fi][pos.get(absorbing[b])];
22629
+ for (let b = 0; b < r7; b++) R[a][b] = P[fi][pos.get(absorbing[b])];
21575
22630
  }
21576
22631
  const ImQ = Array.from(
21577
22632
  { length: t },
21578
22633
  (_, a) => Array.from({ length: t }, (_2, b) => (a === b ? 1 : 0) - Q[a][b])
21579
22634
  );
21580
22635
  const N = invert(ImQ);
21581
- const B = Array.from({ length: t }, () => new Array(r6).fill(0));
22636
+ const B = Array.from({ length: t }, () => new Array(r7).fill(0));
21582
22637
  for (let a = 0; a < t; a++) {
21583
- for (let b = 0; b < r6; b++) {
22638
+ for (let b = 0; b < r7; b++) {
21584
22639
  let s = 0;
21585
22640
  for (let c = 0; c < t; c++) s += N[a][c] * R[c][b];
21586
22641
  B[a][b] = s;
@@ -21852,11 +22907,11 @@ function curvedArcGeom(tr, a, b, bow, C2) {
21852
22907
  labelY: mid.y
21853
22908
  };
21854
22909
  }
21855
- function aimToBoundary(centre, target, r6) {
22910
+ function aimToBoundary(centre, target, r7) {
21856
22911
  const dx = target.x - centre.x;
21857
22912
  const dy = target.y - centre.y;
21858
22913
  const len = Math.hypot(dx, dy) || 1;
21859
- return { x: centre.x + dx / len * r6, y: centre.y + dy / len * r6 };
22914
+ return { x: centre.x + dx / len * r7, y: centre.y + dy / len * r7 };
21860
22915
  }
21861
22916
  function selfLoopGeom(tr, c, ringCenter, layout, C2) {
21862
22917
  let ox = c.x - ringCenter.x;
@@ -22090,8 +23145,8 @@ function renderMarkov(textOrAst, config) {
22090
23145
  }
22091
23146
  function fmt5(x) {
22092
23147
  if (!Number.isFinite(x)) return String(x);
22093
- const r6 = Math.round(x * 1e3) / 1e3;
22094
- return String(r6);
23148
+ const r7 = Math.round(x * 1e3) / 1e3;
23149
+ return String(r7);
22095
23150
  }
22096
23151
  function num(x) {
22097
23152
  return Math.round(x * 100) / 100;
@@ -22768,7 +23823,7 @@ function renderGitGraphLayout(layout, config) {
22768
23823
  const styleBlock = buildStyle2(pal, ast.showBranches);
22769
23824
  const children = [
22770
23825
  chunk3WNW5Y7P_cjs.title(a11y),
22771
- chunk3WNW5Y7P_cjs.desc(summarise6(layout)),
23826
+ chunk3WNW5Y7P_cjs.desc(summarise8(layout)),
22772
23827
  styleBlock,
22773
23828
  chunk3WNW5Y7P_cjs.rect({ x: 0, y: 0, width, height, class: "sx-gg-bg" })
22774
23829
  ];
@@ -22891,13 +23946,13 @@ function renderCommit(lc, ast, pal, fontFamily) {
22891
23946
  if (node.commitType !== "NORMAL") dataAttrs2["data-type"] = node.commitType;
22892
23947
  if (node.tag) dataAttrs2["data-tag"] = node.tag;
22893
23948
  if (node.commitType === "HIGHLIGHT") {
22894
- const r6 = GITGRAPH_CONST.SQUARE_R;
23949
+ const r7 = GITGRAPH_CONST.SQUARE_R;
22895
23950
  parts.push(
22896
23951
  chunk3WNW5Y7P_cjs.rect({
22897
- x: x - r6,
22898
- y: y - r6,
22899
- width: r6 * 2,
22900
- height: r6 * 2,
23952
+ x: x - r7,
23953
+ y: y - r7,
23954
+ width: r7 * 2,
23955
+ height: r7 * 2,
22901
23956
  rx: 2,
22902
23957
  class: `sx-gg-node sx-gg-highlight sx-gg-stroke-c${ci}`
22903
23958
  })
@@ -23018,7 +24073,7 @@ ${laneRules}
23018
24073
  function num2(n) {
23019
24074
  return Number.isInteger(n) ? String(n) : n.toFixed(2);
23020
24075
  }
23021
- function summarise6(layout) {
24076
+ function summarise8(layout) {
23022
24077
  const c = layout.replay.commits.length;
23023
24078
  const b = layout.replay.branches.length;
23024
24079
  const merges = layout.replay.commits.filter((n) => n.isMerge).length;
@@ -23575,33 +24630,33 @@ function layoutEpc(ast) {
23575
24630
  const isLR = ast.direction === "lr";
23576
24631
  const layerCenter = [];
23577
24632
  let primary = EPC_CONST.CANVAS_PAD + (ast.title ? EPC_CONST.TITLE_H : 0);
23578
- for (let r6 = 0; r6 <= maxLayer; r6++) {
24633
+ for (let r7 = 0; r7 <= maxLayer; r7++) {
23579
24634
  const bandThickness = Math.max(
23580
24635
  0,
23581
- ...ranks[r6].map((id) => isLR ? sized.get(id).w : sized.get(id).h)
24636
+ ...ranks[r7].map((id) => isLR ? sized.get(id).w : sized.get(id).h)
23582
24637
  );
23583
- layerCenter[r6] = primary + bandThickness / 2;
24638
+ layerCenter[r7] = primary + bandThickness / 2;
23584
24639
  primary += bandThickness + EPC_CONST.LAYER_GAP;
23585
24640
  }
23586
24641
  const primaryExtent = primary - EPC_CONST.LAYER_GAP + EPC_CONST.CANVAS_PAD;
23587
24642
  const crossPos = /* @__PURE__ */ new Map();
23588
24643
  let maxCrossExtent = 0;
23589
24644
  const rankWidths = [];
23590
- for (let r6 = 0; r6 <= maxLayer; r6++) {
24645
+ for (let r7 = 0; r7 <= maxLayer; r7++) {
23591
24646
  let cursor = 0;
23592
- for (const id of ranks[r6]) {
24647
+ for (const id of ranks[r7]) {
23593
24648
  const s = sized.get(id);
23594
24649
  const span = isLR ? s.h : s.w;
23595
24650
  crossPos.set(id, cursor + span / 2);
23596
24651
  cursor += span + EPC_CONST.NODE_GAP;
23597
24652
  }
23598
24653
  const total = Math.max(0, cursor - EPC_CONST.NODE_GAP);
23599
- rankWidths[r6] = total;
24654
+ rankWidths[r7] = total;
23600
24655
  maxCrossExtent = Math.max(maxCrossExtent, total);
23601
24656
  }
23602
- for (let r6 = 0; r6 <= maxLayer; r6++) {
23603
- const shift = (maxCrossExtent - rankWidths[r6]) / 2 + EPC_CONST.CANVAS_PAD;
23604
- for (const id of ranks[r6]) crossPos.set(id, crossPos.get(id) + shift);
24657
+ for (let r7 = 0; r7 <= maxLayer; r7++) {
24658
+ const shift = (maxCrossExtent - rankWidths[r7]) / 2 + EPC_CONST.CANVAS_PAD;
24659
+ for (const id of ranks[r7]) crossPos.set(id, crossPos.get(id) + shift);
23605
24660
  }
23606
24661
  const backMargin = backSet.size > 0 ? EPC_CONST.BACK_MARGIN : 0;
23607
24662
  const crossExtent = maxCrossExtent + EPC_CONST.CANVAS_PAD * 2 + backMargin;
@@ -23679,15 +24734,15 @@ function longestPathLayers(ast, dagOut, dagIn) {
23679
24734
  }
23680
24735
  function orderRanks2(ranks, dagIn, ast) {
23681
24736
  const declIndex = new Map(ast.nodes.map((n, i) => [n.id, i]));
23682
- for (let r6 = 1; r6 < ranks.length; r6++) {
24737
+ for (let r7 = 1; r7 < ranks.length; r7++) {
23683
24738
  const prevIndex = /* @__PURE__ */ new Map();
23684
- ranks[r6 - 1].forEach((id, i) => prevIndex.set(id, i));
24739
+ ranks[r7 - 1].forEach((id, i) => prevIndex.set(id, i));
23685
24740
  const bary = /* @__PURE__ */ new Map();
23686
- for (const id of ranks[r6]) {
24741
+ for (const id of ranks[r7]) {
23687
24742
  const preds = (dagIn.get(id) ?? []).map((p) => prevIndex.get(p)).filter((v) => v !== void 0);
23688
24743
  bary.set(id, preds.length ? preds.reduce((a, b) => a + b, 0) / preds.length : declIndex.get(id) ?? 0);
23689
24744
  }
23690
- ranks[r6].sort((a, b) => {
24745
+ ranks[r7].sort((a, b) => {
23691
24746
  const d = (bary.get(a) ?? 0) - (bary.get(b) ?? 0);
23692
24747
  if (Math.abs(d) > 1e-9) return d;
23693
24748
  return (declIndex.get(a) ?? 0) - (declIndex.get(b) ?? 0);
@@ -23718,7 +24773,7 @@ function detectBackEdges(ast, out) {
23718
24773
  }
23719
24774
  colour.set(id, BLACK);
23720
24775
  };
23721
- for (const r6 of visitOrder) if ((colour.get(r6) ?? WHITE) === WHITE) dfs(r6);
24776
+ for (const r7 of visitOrder) if ((colour.get(r7) ?? WHITE) === WHITE) dfs(r7);
23722
24777
  return back;
23723
24778
  }
23724
24779
  function routeEdge3(e, nodePos, crossExtent, back, isLR) {
@@ -23755,9 +24810,9 @@ function borderPoint(from, to, _isLR) {
23755
24810
  const dx = to.cx - from.cx;
23756
24811
  const dy = to.cy - from.cy;
23757
24812
  if (from.node.kind === "connector") {
23758
- const r6 = EPC_CONST.CONN_R;
24813
+ const r7 = EPC_CONST.CONN_R;
23759
24814
  const len = Math.hypot(dx, dy) || 1;
23760
- return { x: from.cx + dx / len * r6, y: from.cy + dy / len * r6 };
24815
+ return { x: from.cx + dx / len * r7, y: from.cy + dy / len * r7 };
23761
24816
  }
23762
24817
  const hw = from.width / 2;
23763
24818
  const hh = from.height / 2;
@@ -23859,7 +24914,7 @@ function renderEpcLayout(layout, config) {
23859
24914
  );
23860
24915
  const children = [
23861
24916
  chunk3WNW5Y7P_cjs.title(a11y),
23862
- chunk3WNW5Y7P_cjs.desc(summarise7(layout)),
24917
+ chunk3WNW5Y7P_cjs.desc(summarise9(layout)),
23863
24918
  styleBlock,
23864
24919
  chunk3WNW5Y7P_cjs.defs([
23865
24920
  chunk3WNW5Y7P_cjs.el("marker", {
@@ -23912,7 +24967,7 @@ function renderNode3(n) {
23912
24967
  parts.push(hexagon(n.cx, n.cy, n.width, n.height, "sx-epc-event"));
23913
24968
  parts.push(chunk3WNW5Y7P_cjs.multilineText(
23914
24969
  { x: n.cx, y: n.cy, class: "sx-epc-label", "text-anchor": "middle", "dominant-baseline": "middle" },
23915
- wrap4(label, 18),
24970
+ wrap5(label, 18),
23916
24971
  14
23917
24972
  ));
23918
24973
  } else if (node.kind === "function") {
@@ -23927,7 +24982,7 @@ function renderNode3(n) {
23927
24982
  }));
23928
24983
  parts.push(chunk3WNW5Y7P_cjs.multilineText(
23929
24984
  { x: n.cx, y: n.cy, class: "sx-epc-label", "text-anchor": "middle", "dominant-baseline": "middle" },
23930
- wrap4(label, 18),
24985
+ wrap5(label, 18),
23931
24986
  14
23932
24987
  ));
23933
24988
  } else {
@@ -23938,9 +24993,9 @@ function renderNode3(n) {
23938
24993
  ));
23939
24994
  }
23940
24995
  if (n.flagged) {
23941
- const r6 = node.kind === "connector" ? EPC_CONST.CONN_R + 5 : 0;
24996
+ const r7 = node.kind === "connector" ? EPC_CONST.CONN_R + 5 : 0;
23942
24997
  if (node.kind === "connector") {
23943
- parts.push(chunk3WNW5Y7P_cjs.circle({ cx: n.cx, cy: n.cy, r: r6, class: "sx-epc-flagring" }));
24998
+ parts.push(chunk3WNW5Y7P_cjs.circle({ cx: n.cx, cy: n.cy, r: r7, class: "sx-epc-flagring" }));
23944
24999
  } else {
23945
25000
  parts.push(chunk3WNW5Y7P_cjs.rect({
23946
25001
  x: n.cx - n.width / 2 - 5,
@@ -23995,7 +25050,7 @@ function renderEdge6(e) {
23995
25050
  if (e.edge.label) {
23996
25051
  parts.push(chunk3WNW5Y7P_cjs.text(
23997
25052
  { x: e.mid.x, y: e.mid.y - 4, class: "sx-epc-edge-label", "text-anchor": "middle" },
23998
- clip4(e.edge.label, 24)
25053
+ clip5(e.edge.label, 24)
23999
25054
  ));
24000
25055
  }
24001
25056
  return chunk3WNW5Y7P_cjs.group(
@@ -24003,7 +25058,7 @@ function renderEdge6(e) {
24003
25058
  parts
24004
25059
  );
24005
25060
  }
24006
- function summarise7(layout) {
25061
+ function summarise9(layout) {
24007
25062
  const { ast, analysis } = layout;
24008
25063
  const counts = { event: 0, function: 0, connector: 0 };
24009
25064
  for (const n of ast.nodes) counts[n.kind]++;
@@ -24023,10 +25078,10 @@ function describeWellFormed(analysis) {
24023
25078
  if (warns) bits.push(`${warns} warning${warns > 1 ? "s" : ""}`);
24024
25079
  return `${bits.join(", ")}.`;
24025
25080
  }
24026
- function clip4(s, n) {
25081
+ function clip5(s, n) {
24027
25082
  return s.length <= n ? s : s.slice(0, n - 1) + "\u2026";
24028
25083
  }
24029
- function wrap4(s, perLine) {
25084
+ function wrap5(s, perLine) {
24030
25085
  if (s.length <= perLine) return s;
24031
25086
  const words = s.split(/\s+/);
24032
25087
  const lines = [];
@@ -24040,7 +25095,7 @@ function wrap4(s, perLine) {
24040
25095
  if (cur) lines.push(cur);
24041
25096
  if (lines.length > 3) {
24042
25097
  lines.length = 3;
24043
- lines[2] = clip4(lines[2], perLine);
25098
+ lines[2] = clip5(lines[2], perLine);
24044
25099
  }
24045
25100
  return lines.join("<br/>");
24046
25101
  }
@@ -24616,7 +25671,7 @@ function renderIdef0Layout(layout, config) {
24616
25671
  );
24617
25672
  const children = [
24618
25673
  chunk3WNW5Y7P_cjs.title(a11y),
24619
- chunk3WNW5Y7P_cjs.desc(summarise8(layout)),
25674
+ chunk3WNW5Y7P_cjs.desc(summarise10(layout)),
24620
25675
  styleBlock,
24621
25676
  chunk3WNW5Y7P_cjs.rect({ x: 0, y: 0, width, height, class: "sx-idef0-bg" })
24622
25677
  ];
@@ -24667,7 +25722,7 @@ function renderBox5(b) {
24667
25722
  "text-anchor": "middle",
24668
25723
  "dominant-baseline": "middle"
24669
25724
  },
24670
- wrap5(b.box.name, 18),
25725
+ wrap6(b.box.name, 18),
24671
25726
  14
24672
25727
  ),
24673
25728
  // Box number in the lower-right interior corner.
@@ -24770,11 +25825,11 @@ function renderTitleBlock(width, height, node, title2) {
24770
25825
  chunk3WNW5Y7P_cjs.text({ x: x0 + 6, y: y + 13, class: "sx-idef0-tb-key" }, "NODE"),
24771
25826
  chunk3WNW5Y7P_cjs.text({ x: x0 + 6, y: y + 27, class: "sx-idef0-tb-text" }, node),
24772
25827
  chunk3WNW5Y7P_cjs.text({ x: c1 + 6, y: y + 13, class: "sx-idef0-tb-key" }, "TITLE"),
24773
- chunk3WNW5Y7P_cjs.text({ x: c1 + 6, y: y + 27, class: "sx-idef0-tb-text" }, clip5(title2 || "\u2014", 60)),
25828
+ chunk3WNW5Y7P_cjs.text({ x: c1 + 6, y: y + 27, class: "sx-idef0-tb-text" }, clip6(title2 || "\u2014", 60)),
24774
25829
  chunk3WNW5Y7P_cjs.text({ x: c2 + 6, y: y + 13, class: "sx-idef0-tb-key" }, "NUMBER")
24775
25830
  ]);
24776
25831
  }
24777
- function summarise8(layout) {
25832
+ function summarise10(layout) {
24778
25833
  const { ast } = layout;
24779
25834
  const counts = {};
24780
25835
  for (const a of ast.arrows) counts[a.role] = (counts[a.role] ?? 0) + 1;
@@ -24789,10 +25844,10 @@ function summarise8(layout) {
24789
25844
  for (const w of ast.warnings) parts.push(w);
24790
25845
  return parts.join(" ");
24791
25846
  }
24792
- function clip5(s, n) {
25847
+ function clip6(s, n) {
24793
25848
  return s.length <= n ? s : s.slice(0, n - 1) + "\u2026";
24794
25849
  }
24795
- function wrap5(s, perLine) {
25850
+ function wrap6(s, perLine) {
24796
25851
  if (s.length <= perLine) return s;
24797
25852
  const words = s.split(/\s+/);
24798
25853
  const lines = [];
@@ -24808,7 +25863,7 @@ function wrap5(s, perLine) {
24808
25863
  if (cur) lines.push(cur);
24809
25864
  if (lines.length > 3) {
24810
25865
  lines.length = 3;
24811
- lines[2] = clip5(lines[2], perLine);
25866
+ lines[2] = clip6(lines[2], perLine);
24812
25867
  }
24813
25868
  return lines.join("<br/>");
24814
25869
  }
@@ -24839,7 +25894,7 @@ for (const [open, close] of Object.entries(chunkVHDSPI6A_cjs.QUOTE_PAIRS)) {
24839
25894
  QUOTE_FOLD.set(close, '"');
24840
25895
  }
24841
25896
  }
24842
- function normalizeQuotes2(text2) {
25897
+ function normalizeQuotes3(text2) {
24843
25898
  let out = "";
24844
25899
  for (const ch of text2) out += QUOTE_FOLD.get(ch) ?? ch;
24845
25900
  return out;
@@ -24870,7 +25925,7 @@ function parseThreatModel(text2) {
24870
25925
  flows: [],
24871
25926
  boundaries: []
24872
25927
  };
24873
- const rawLines = normalizeQuotes2(text2).split(/\r?\n/);
25928
+ const rawLines = normalizeQuotes3(text2).split(/\r?\n/);
24874
25929
  const byId = /* @__PURE__ */ new Map();
24875
25930
  const declareNode = (id, kind, label, lineNo, logStore) => {
24876
25931
  if (byId.has(id)) {
@@ -25329,13 +26384,13 @@ function layoutThreatModel(ast) {
25329
26384
  }
25330
26385
  const boundaries = [];
25331
26386
  for (const b of ast.boundaries) {
25332
- let l = Infinity, t = Infinity, r6 = -Infinity, bm = -Infinity;
26387
+ let l = Infinity, t = Infinity, r7 = -Infinity, bm = -Infinity;
25333
26388
  for (const m of b.members) {
25334
26389
  const mn = nodeMap.get(m);
25335
26390
  if (!mn) continue;
25336
26391
  l = Math.min(l, mn.x);
25337
26392
  t = Math.min(t, mn.y);
25338
- r6 = Math.max(r6, mn.x + mn.w);
26393
+ r7 = Math.max(r7, mn.x + mn.w);
25339
26394
  bm = Math.max(bm, mn.y + mn.h);
25340
26395
  }
25341
26396
  if (!Number.isFinite(l)) continue;
@@ -25344,7 +26399,7 @@ function layoutThreatModel(ast) {
25344
26399
  name: b.name,
25345
26400
  x: l - p,
25346
26401
  y: t - p - TM_CONST.BOUNDARY_HEADER,
25347
- w: r6 - l + p * 2,
26402
+ w: r7 - l + p * 2,
25348
26403
  h: bm - t + p * 2 + TM_CONST.BOUNDARY_HEADER
25349
26404
  });
25350
26405
  }
@@ -25378,9 +26433,9 @@ function edgePoint2(n, tx, ty) {
25378
26433
  const dy = ty - n.cy;
25379
26434
  if (dx === 0 && dy === 0) return { x: n.cx, y: n.cy };
25380
26435
  if (n.kind === "process") {
25381
- const r6 = TM_CONST.PROCESS_R;
26436
+ const r7 = TM_CONST.PROCESS_R;
25382
26437
  const len = Math.hypot(dx, dy);
25383
- return { x: n.cx + dx / len * r6, y: n.cy + dy / len * r6 };
26438
+ return { x: n.cx + dx / len * r7, y: n.cy + dy / len * r7 };
25384
26439
  }
25385
26440
  const hw = n.w / 2;
25386
26441
  const hh = n.h / 2;
@@ -25435,7 +26490,7 @@ function renderThreatModelLayout(layout, config) {
25435
26490
  ]);
25436
26491
  const children = [
25437
26492
  chunk3WNW5Y7P_cjs.title(a11y),
25438
- chunk3WNW5Y7P_cjs.desc(summarise9(layout)),
26493
+ chunk3WNW5Y7P_cjs.desc(summarise11(layout)),
25439
26494
  styleBlock,
25440
26495
  markerDefs,
25441
26496
  chunk3WNW5Y7P_cjs.rect({ x: 0, y: 0, width, height, class: "sx-tm-bg" })
@@ -25652,7 +26707,7 @@ function arrowMarker2(id, cls, crossing) {
25652
26707
  function round8(n) {
25653
26708
  return Math.round(n * 100) / 100;
25654
26709
  }
25655
- function summarise9(layout) {
26710
+ function summarise11(layout) {
25656
26711
  const a = layout.analysis;
25657
26712
  const counts = {
25658
26713
  external: layout.nodes.filter((n) => n.kind === "external").length,
@@ -26030,9 +27085,9 @@ function weldGlyph(type, cx, y, dir, cls) {
26030
27085
  return [chunk3WNW5Y7P_cjs.path({ d: `M ${round9(cx - rr)} ${round9(y)} A ${round9(rr)} ${round9(rr)} 0 0 ${sweep} ${round9(cx + rr)} ${round9(y)}`, class: cls, fill: "none" })];
26031
27086
  }
26032
27087
  case "surfacing": {
26033
- const r6 = W / 4;
27088
+ const r7 = W / 4;
26034
27089
  const yy = y + dir * 3;
26035
- const bump = (off) => chunk3WNW5Y7P_cjs.path({ d: `M ${round9(cx - W / 2)} ${round9(off)} a ${round9(r6)} ${round9(r6)} 0 0 ${dir > 0 ? 1 : 0} ${round9(W / 2)} 0 a ${round9(r6)} ${round9(r6)} 0 0 ${dir > 0 ? 1 : 0} ${round9(W / 2)} 0`, class: cls, fill: "none" });
27090
+ const bump = (off) => chunk3WNW5Y7P_cjs.path({ d: `M ${round9(cx - W / 2)} ${round9(off)} a ${round9(r7)} ${round9(r7)} 0 0 ${dir > 0 ? 1 : 0} ${round9(W / 2)} 0 a ${round9(r7)} ${round9(r7)} 0 0 ${dir > 0 ? 1 : 0} ${round9(W / 2)} 0`, class: cls, fill: "none" });
26036
27091
  return [bump(y), bump(yy)];
26037
27092
  }
26038
27093
  case "edge":
@@ -26904,7 +27959,7 @@ function computeMaxLW(subtreeRoots, maxLabelWidth) {
26904
27959
  if (maxLW[n.depth] === void 0 || m.width > maxLW[n.depth]) maxLW[n.depth] = m.width;
26905
27960
  for (const c of n.children) walk(c);
26906
27961
  };
26907
- for (const r6 of subtreeRoots) walk(r6);
27962
+ for (const r7 of subtreeRoots) walk(r7);
26908
27963
  return maxLW;
26909
27964
  }
26910
27965
  function buildColumns(maxLW, firstColStartX, rootDepth) {
@@ -27271,9 +28326,9 @@ function renderNode5(n, color, theme, fontFamily, orderClass) {
27271
28326
  for (let i = 0; i < lineCount; i++) {
27272
28327
  const line2 = n.lines[i];
27273
28328
  const cy = topY + (i + 0.5) * lh;
27274
- const r6 = renderLine2(line2, textLeft, cy, fs, fontFamily, weight, theme);
27275
- decorations.push(...r6.decorations);
27276
- children.push(r6.textElement);
28329
+ const r7 = renderLine2(line2, textLeft, cy, fs, fontFamily, weight, theme);
28330
+ decorations.push(...r7.decorations);
28331
+ children.push(r7.textElement);
27277
28332
  }
27278
28333
  const ux1 = n.x - n.labelWidth / 2;
27279
28334
  const ux2 = n.x + n.labelWidth / 2;
@@ -27997,11 +29052,11 @@ function parseMatrix(text2) {
27997
29052
  const gm = v.match(/^(\d+)\s*x\s*(\d+)$/);
27998
29053
  if (gm) {
27999
29054
  const c = Number(gm[1]);
28000
- const r6 = Number(gm[2]);
29055
+ const r7 = Number(gm[2]);
28001
29056
  st.ast.cols = c;
28002
- st.ast.rows = r6;
28003
- if (c === 2 && r6 === 2) st.ast.grid = "2x2";
28004
- else if (c === 3 && r6 === 3) st.ast.grid = "3x3";
29057
+ st.ast.rows = r7;
29058
+ if (c === 2 && r7 === 2) st.ast.grid = "2x2";
29059
+ else if (c === 3 && r7 === 3) st.ast.grid = "3x3";
28005
29060
  else st.ast.grid = "NxM";
28006
29061
  }
28007
29062
  continue;
@@ -28214,11 +29269,11 @@ function punnettFooter(result) {
28214
29269
  }
28215
29270
  function computeQfdImportance(qfd) {
28216
29271
  const raw = qfd.hows.map(() => 0);
28217
- for (const r6 of qfd.relationships) {
28218
- if (r6.how < 0 || r6.how >= qfd.hows.length) continue;
28219
- if (r6.what < 0 || r6.what >= qfd.whats.length) continue;
28220
- const w = qfd.whats[r6.what].weight;
28221
- raw[r6.how] += w * r6.strength;
29272
+ for (const r7 of qfd.relationships) {
29273
+ if (r7.how < 0 || r7.how >= qfd.hows.length) continue;
29274
+ if (r7.what < 0 || r7.what >= qfd.whats.length) continue;
29275
+ const w = qfd.whats[r7.what].weight;
29276
+ raw[r7.how] += w * r7.strength;
28222
29277
  }
28223
29278
  const total = raw.reduce((acc, v) => acc + v, 0);
28224
29279
  return raw.map((importance, how) => ({
@@ -28239,12 +29294,12 @@ function estimateWidth(text2) {
28239
29294
  const cjk = (text2.match(/[\u3000-\u9fff]/g) ?? []).length;
28240
29295
  return (text2.length - cjk) * CHAR_W2 + cjk * 12 + 8;
28241
29296
  }
28242
- function clamp01(v) {
29297
+ function clamp012(v) {
28243
29298
  return Math.max(0.02, Math.min(0.98, v));
28244
29299
  }
28245
29300
  function placePoint(p, plot) {
28246
- const nx = clamp01(p.x);
28247
- const ny = clamp01(p.y);
29301
+ const nx = clamp012(p.x);
29302
+ const ny = clamp012(p.y);
28248
29303
  const px = plot.x0 + nx * plot.w;
28249
29304
  const py = plot.y0 + (1 - ny) * plot.h;
28250
29305
  return { px, py };
@@ -28260,8 +29315,8 @@ function computeRadius(p, maxSize, plot, scale) {
28260
29315
  }
28261
29316
  const maxArea = Math.PI * maxRadius * maxRadius;
28262
29317
  const area = ratio * maxArea;
28263
- const r6 = Math.sqrt(area / Math.PI);
28264
- return Math.max(minRadius, r6);
29318
+ const r7 = Math.sqrt(area / Math.PI);
29319
+ return Math.max(minRadius, r7);
28265
29320
  }
28266
29321
  function resolveLabelCollisions(points, plot, mode) {
28267
29322
  if (mode === "off") {
@@ -28462,20 +29517,20 @@ function layoutMatrix(ast) {
28462
29517
  }
28463
29518
  for (const p of ast.points) {
28464
29519
  const { px, py } = placePoint(p, plot);
28465
- const r6 = computeRadius(p, maxSize, plot, ast.config.bubbleScale);
29520
+ const r7 = computeRadius(p, maxSize, plot, ast.config.bubbleScale);
28466
29521
  const width = estimateWidth(p.label);
28467
29522
  const label = {
28468
29523
  text: p.label,
28469
29524
  ax: px,
28470
29525
  ay: py,
28471
- lx: px + r6 + 4 + width / 2,
28472
- ly: py - r6 - 4,
29526
+ lx: px + r7 + 4 + width / 2,
29527
+ ly: py - r7 - 4,
28473
29528
  width,
28474
29529
  height: LABEL_H,
28475
29530
  external: false,
28476
29531
  textAnchor: "middle"
28477
29532
  };
28478
- points.push({ point: p, px, py, r: r6, label });
29533
+ points.push({ point: p, px, py, r: r7, label });
28479
29534
  if (p.category) categoriesSet.add(p.category);
28480
29535
  }
28481
29536
  resolveLabelCollisions(points, plot, ast.config.labelCollision);
@@ -28625,7 +29680,7 @@ function renderQuadrantBackground(ast, lay) {
28625
29680
  return chunk3WNW5Y7P_cjs.group(
28626
29681
  { id: "sx-matrix-quad-bg" },
28627
29682
  rects.map(
28628
- (r6) => chunk3WNW5Y7P_cjs.rect({ x: r6.x, y: r6.y, width: r6.w, height: r6.h, fill: r6.fill, "fill-opacity": 0.55 })
29683
+ (r7) => chunk3WNW5Y7P_cjs.rect({ x: r7.x, y: r7.y, width: r7.w, height: r7.h, fill: r7.fill, "fill-opacity": 0.55 })
28629
29684
  )
28630
29685
  );
28631
29686
  }
@@ -29277,9 +30332,9 @@ function renderOnePoint(pl2, categories) {
29277
30332
  class: "sx-matrix-bubble"
29278
30333
  });
29279
30334
  } else if (shape === "diamond") {
29280
- const r6 = pl2.r;
30335
+ const r7 = pl2.r;
29281
30336
  shapeEl = chunk3WNW5Y7P_cjs.polygon({
29282
- points: `${pl2.px},${pl2.py - r6} ${pl2.px + r6},${pl2.py} ${pl2.px},${pl2.py + r6} ${pl2.px - r6},${pl2.py}`,
30337
+ points: `${pl2.px},${pl2.py - r7} ${pl2.px + r7},${pl2.py} ${pl2.px},${pl2.py + r7} ${pl2.px - r7},${pl2.py}`,
29283
30338
  fill: color,
29284
30339
  "fill-opacity": fillOpacity,
29285
30340
  stroke,
@@ -29287,9 +30342,9 @@ function renderOnePoint(pl2, categories) {
29287
30342
  class: "sx-matrix-bubble"
29288
30343
  });
29289
30344
  } else {
29290
- const r6 = pl2.r;
30345
+ const r7 = pl2.r;
29291
30346
  shapeEl = chunk3WNW5Y7P_cjs.polygon({
29292
- points: `${pl2.px},${pl2.py - r6} ${pl2.px + r6},${pl2.py + r6 * 0.8} ${pl2.px - r6},${pl2.py + r6 * 0.8}`,
30347
+ points: `${pl2.px},${pl2.py - r7} ${pl2.px + r7},${pl2.py + r7 * 0.8} ${pl2.px - r7},${pl2.py + r7 * 0.8}`,
29293
30348
  fill: color,
29294
30349
  "fill-opacity": fillOpacity,
29295
30350
  stroke,
@@ -29421,15 +30476,15 @@ function renderSipocAST(ast, config) {
29421
30476
  const items = sipoc[def.key];
29422
30477
  const isProcess = def.key === "process";
29423
30478
  const cellNodes = [];
29424
- for (let r6 = 0; r6 < lay.rows; r6++) {
29425
- const cellY = lay.y0 + lay.headerH + r6 * lay.rowH;
29426
- const item = items[r6];
29427
- const cellClass = isProcess ? "sx-sipoc-process" : r6 % 2 === 0 ? "sx-sipoc-cell" : "sx-sipoc-cell-alt";
30479
+ for (let r7 = 0; r7 < lay.rows; r7++) {
30480
+ const cellY = lay.y0 + lay.headerH + r7 * lay.rowH;
30481
+ const item = items[r7];
30482
+ const cellClass = isProcess ? "sx-sipoc-process" : r7 % 2 === 0 ? "sx-sipoc-cell" : "sx-sipoc-cell-alt";
29428
30483
  cellNodes.push(
29429
30484
  chunk3WNW5Y7P_cjs.rect({ x: colX, y: cellY, width: lay.colW, height: lay.rowH, class: cellClass })
29430
30485
  );
29431
30486
  if (item) {
29432
- const label = isProcess ? `${r6 + 1}. ${item}` : item;
30487
+ const label = isProcess ? `${r7 + 1}. ${item}` : item;
29433
30488
  const lines = wrapToLines(label, maxChars, 2);
29434
30489
  const lineH = 14;
29435
30490
  const startY = cellY + lay.rowH / 2 - (lines.length - 1) * lineH / 2;
@@ -29492,17 +30547,17 @@ var CORR_LABEL = {
29492
30547
  "-": "negative",
29493
30548
  "--": "strong negative"
29494
30549
  };
29495
- function renderQfdRelationshipSymbol(strength, cx, cy, r6) {
30550
+ function renderQfdRelationshipSymbol(strength, cx, cy, r7) {
29496
30551
  if (strength === 9) {
29497
30552
  return chunk3WNW5Y7P_cjs.group({}, [
29498
- chunk3WNW5Y7P_cjs.circle({ cx, cy, r: r6, fill: "none", stroke: "#2563eb", "stroke-width": 1.4 }),
29499
- chunk3WNW5Y7P_cjs.circle({ cx, cy, r: r6 * 0.5, class: "sx-qfd-rel-strong" })
30553
+ chunk3WNW5Y7P_cjs.circle({ cx, cy, r: r7, fill: "none", stroke: "#2563eb", "stroke-width": 1.4 }),
30554
+ chunk3WNW5Y7P_cjs.circle({ cx, cy, r: r7 * 0.5, class: "sx-qfd-rel-strong" })
29500
30555
  ]);
29501
30556
  }
29502
30557
  if (strength === 3) {
29503
- return chunk3WNW5Y7P_cjs.circle({ cx, cy, r: r6, class: "sx-qfd-rel-medium" });
30558
+ return chunk3WNW5Y7P_cjs.circle({ cx, cy, r: r7, class: "sx-qfd-rel-medium" });
29504
30559
  }
29505
- const t = r6 * 0.95;
30560
+ const t = r7 * 0.95;
29506
30561
  return chunk3WNW5Y7P_cjs.polygon({
29507
30562
  points: `${cx},${cy - t} ${cx + t},${cy + t * 0.85} ${cx - t},${cy + t * 0.85}`,
29508
30563
  class: "sx-qfd-rel-weak"
@@ -29600,15 +30655,15 @@ function renderQfdAST(ast, config) {
29600
30655
  )
29601
30656
  );
29602
30657
  const gridNodes = [];
29603
- for (let r6 = 0; r6 < lay.rows; r6++) {
29604
- const y = lay.gridY0 + r6 * lay.cellH;
30658
+ for (let r7 = 0; r7 < lay.rows; r7++) {
30659
+ const y = lay.gridY0 + r7 * lay.cellH;
29605
30660
  gridNodes.push(
29606
30661
  chunk3WNW5Y7P_cjs.rect({
29607
30662
  x: lay.gridX0,
29608
30663
  y,
29609
30664
  width: lay.cols * lay.cellW,
29610
30665
  height: lay.cellH,
29611
- class: r6 % 2 === 0 ? "sx-qfd-cellbg" : "sx-qfd-cellbg-alt"
30666
+ class: r7 % 2 === 0 ? "sx-qfd-cellbg" : "sx-qfd-cellbg-alt"
29612
30667
  })
29613
30668
  );
29614
30669
  }
@@ -29786,18 +30841,18 @@ function renderPunnettAST(ast, config) {
29786
30841
  nodes.push(chunk3WNW5Y7P_cjs.rect({ x: cx, y: lay.y0, width: lay.cellW, height: lay.headerH, class: "sx-punnett-header" }));
29787
30842
  nodes.push(chunk3WNW5Y7P_cjs.text({ x: cx + lay.cellW / 2, y: lay.y0 + lay.headerH / 2, class: "sx-punnett-gamete" }, g));
29788
30843
  });
29789
- result.gametes2.forEach((g, r6) => {
29790
- const cy = gy0 + r6 * lay.cellH;
30844
+ result.gametes2.forEach((g, r7) => {
30845
+ const cy = gy0 + r7 * lay.cellH;
29791
30846
  nodes.push(chunk3WNW5Y7P_cjs.rect({ x: lay.x0, y: cy, width: lay.headerW, height: lay.cellH, class: "sx-punnett-header" }));
29792
30847
  nodes.push(chunk3WNW5Y7P_cjs.text({ x: lay.x0 + lay.headerW / 2, y: cy + lay.cellH / 2, class: "sx-punnett-gamete" }, g));
29793
30848
  });
29794
- for (let r6 = 0; r6 < result.grid.length; r6++) {
29795
- const row = result.grid[r6];
30849
+ for (let r7 = 0; r7 < result.grid.length; r7++) {
30850
+ const row = result.grid[r7];
29796
30851
  for (let c = 0; c < row.length; c++) {
29797
30852
  const cell = row[c];
29798
30853
  const color = phenoColor.get(cell.phenotypeKey);
29799
30854
  const cx = gx0 + c * lay.cellW;
29800
- const cy = gy0 + r6 * lay.cellH;
30855
+ const cy = gy0 + r7 * lay.cellH;
29801
30856
  nodes.push(chunk3WNW5Y7P_cjs.rect({ x: cx, y: cy, width: lay.cellW, height: lay.cellH, fill: color.tint, class: "sx-punnett-cell" }));
29802
30857
  nodes.push(chunk3WNW5Y7P_cjs.text({ x: cx + lay.cellW / 2, y: cy + lay.cellH / 2, class: "sx-punnett-genotype" }, cell.genotype));
29803
30858
  }
@@ -30350,12 +31405,12 @@ function buildColumnAssignment(ast) {
30350
31405
  const ids = ast.entities.map((e) => e.id);
30351
31406
  const idToIdx = new Map(ids.map((id, i) => [id, i]));
30352
31407
  const pairs = [];
30353
- for (const r6 of ast.refs) {
30354
- const f = parseRefSide(r6.from);
30355
- const t = parseRefSide(r6.to);
31408
+ for (const r7 of ast.refs) {
31409
+ const f = parseRefSide(r7.from);
31410
+ const t = parseRefSide(r7.to);
30356
31411
  if (idToIdx.has(f.table) && idToIdx.has(t.table)) {
30357
- const oneIsTo = isOne(r6.toCard) && !isOne(r6.fromCard);
30358
- const oneIsFrom = isOne(r6.fromCard) && !isOne(r6.toCard);
31412
+ const oneIsTo = isOne(r7.toCard) && !isOne(r7.fromCard);
31413
+ const oneIsFrom = isOne(r7.fromCard) && !isOne(r7.toCard);
30359
31414
  if (oneIsTo) pairs.push({ from: t.table, to: f.table });
30360
31415
  else if (oneIsFrom) pairs.push({ from: f.table, to: t.table });
30361
31416
  else pairs.push({ from: f.table, to: t.table });
@@ -30390,9 +31445,9 @@ function isOne(c) {
30390
31445
  function reorderByBarycenter(layerToEnts, layers, refs) {
30391
31446
  if (layers.length < 2) return;
30392
31447
  const neighbors = /* @__PURE__ */ new Map();
30393
- for (const r6 of refs) {
30394
- const a = parseRefSide(r6.from).table;
30395
- const b = parseRefSide(r6.to).table;
31448
+ for (const r7 of refs) {
31449
+ const a = parseRefSide(r7.from).table;
31450
+ const b = parseRefSide(r7.to).table;
30396
31451
  if (!neighbors.has(a)) neighbors.set(a, /* @__PURE__ */ new Set());
30397
31452
  if (!neighbors.has(b)) neighbors.set(b, /* @__PURE__ */ new Set());
30398
31453
  neighbors.get(a).add(b);
@@ -30522,9 +31577,9 @@ function layoutErd(ast) {
30522
31577
  const layers = Array.from(layerToEnts.keys()).sort((a, b) => a - b);
30523
31578
  reorderByBarycenter(layerToEnts, layers, ast.refs);
30524
31579
  const neighbors = /* @__PURE__ */ new Map();
30525
- for (const r6 of ast.refs) {
30526
- const a = parseRefSide(r6.from).table;
30527
- const b = parseRefSide(r6.to).table;
31580
+ for (const r7 of ast.refs) {
31581
+ const a = parseRefSide(r7.from).table;
31582
+ const b = parseRefSide(r7.to).table;
30528
31583
  if (!neighbors.has(a)) neighbors.set(a, /* @__PURE__ */ new Set());
30529
31584
  if (!neighbors.has(b)) neighbors.set(b, /* @__PURE__ */ new Set());
30530
31585
  neighbors.get(a).add(b);
@@ -30602,17 +31657,17 @@ function layoutErd(ast) {
30602
31657
  const placedById = new Map(placed.map((p) => [p.entity.id, p]));
30603
31658
  const edges = [];
30604
31659
  const bendBucketUses = /* @__PURE__ */ new Map();
30605
- for (const r6 of ast.refs) {
30606
- const fromTable = parseRefSide(r6.from).table;
30607
- const toTable = parseRefSide(r6.to).table;
31660
+ for (const r7 of ast.refs) {
31661
+ const fromTable = parseRefSide(r7.from).table;
31662
+ const toTable = parseRefSide(r7.to).table;
30608
31663
  const a = placedById.get(fromTable);
30609
31664
  const b = placedById.get(toTable);
30610
31665
  if (!a || !b) continue;
30611
- const fromCol = parseRefSide(r6.from).column;
30612
- const toCol = parseRefSide(r6.to).column;
31666
+ const fromCol = parseRefSide(r7.from).column;
31667
+ const toCol = parseRefSide(r7.to).column;
30613
31668
  const route = routeOrthogonal(a, b, fromCol, toCol, bendBucketUses);
30614
31669
  edges.push({
30615
- ref: r6,
31670
+ ref: r7,
30616
31671
  path: route.path,
30617
31672
  fromAnchor: route.fromAnchor,
30618
31673
  toAnchor: route.toAnchor,
@@ -30629,7 +31684,7 @@ function layoutErd(ast) {
30629
31684
  }
30630
31685
  function rowYByColumn(e, col) {
30631
31686
  if (col) {
30632
- const idx = e.rows.findIndex((r6) => r6.attribute.name.toLowerCase() === col.toLowerCase());
31687
+ const idx = e.rows.findIndex((r7) => r7.attribute.name.toLowerCase() === col.toLowerCase());
30633
31688
  if (idx >= 0) return e.y + e.rows[idx].yCenter;
30634
31689
  }
30635
31690
  return e.y + e.height / 2;
@@ -31409,8 +32464,8 @@ var PITCH = 14;
31409
32464
  function rectShape(x, y, w, h, attrs) {
31410
32465
  return chunk3WNW5Y7P_cjs.el("rect", { x, y, width: w, height: h, ...attrs });
31411
32466
  }
31412
- function circShape(cx, cy, r6, attrs) {
31413
- return chunk3WNW5Y7P_cjs.el("circle", { cx, cy, r: r6, ...attrs });
32467
+ function circShape(cx, cy, r7, attrs) {
32468
+ return chunk3WNW5Y7P_cjs.el("circle", { cx, cy, r: r7, ...attrs });
31414
32469
  }
31415
32470
  function lineShape(x1, y1, x2, y2, attrs) {
31416
32471
  return chunk3WNW5Y7P_cjs.el("line", { x1, y1, x2, y2, ...attrs });
@@ -32131,13 +33186,13 @@ function renderSubstrate(sub) {
32131
33186
  { y: sub.y + BB_CONST.BOARD_PAD_Y, type: "top" },
32132
33187
  { y: sub.y + sub.height - BB_CONST.BOARD_PAD_Y - BB_CONST.RAIL_HEIGHT, type: "bottom" }
32133
33188
  ];
32134
- for (const r6 of rails) {
33189
+ for (const r7 of rails) {
32135
33190
  elements.push(chunk3WNW5Y7P_cjs.path({
32136
- d: `M ${sub.x + BB_CONST.BOARD_PAD_X} ${r6.y + 4} L ${sub.x + sub.width - BB_CONST.BOARD_PAD_X} ${r6.y + 4}`,
33191
+ d: `M ${sub.x + BB_CONST.BOARD_PAD_X} ${r7.y + 4} L ${sub.x + sub.width - BB_CONST.BOARD_PAD_X} ${r7.y + 4}`,
32137
33192
  class: "lt-bb-rail-stripe-pos"
32138
33193
  }));
32139
33194
  elements.push(chunk3WNW5Y7P_cjs.path({
32140
- d: `M ${sub.x + BB_CONST.BOARD_PAD_X} ${r6.y + BB_CONST.RAIL_HEIGHT - 4} L ${sub.x + sub.width - BB_CONST.BOARD_PAD_X} ${r6.y + BB_CONST.RAIL_HEIGHT - 4}`,
33195
+ d: `M ${sub.x + BB_CONST.BOARD_PAD_X} ${r7.y + BB_CONST.RAIL_HEIGHT - 4} L ${sub.x + sub.width - BB_CONST.BOARD_PAD_X} ${r7.y + BB_CONST.RAIL_HEIGHT - 4}`,
32141
33196
  class: "lt-bb-rail-stripe-neg"
32142
33197
  }));
32143
33198
  if (sub.railsBreak) {
@@ -32145,7 +33200,7 @@ function renderSubstrate(sub) {
32145
33200
  const breakX2 = breakX1 + PITCH2;
32146
33201
  elements.push(chunk3WNW5Y7P_cjs.rect({
32147
33202
  x: breakX1,
32148
- y: r6.y,
33203
+ y: r7.y,
32149
33204
  width: breakX2 - breakX1,
32150
33205
  height: BB_CONST.RAIL_HEIGHT,
32151
33206
  fill: "#e7d8b6"
@@ -32153,8 +33208,8 @@ function renderSubstrate(sub) {
32153
33208
  }
32154
33209
  for (let c = 1; c <= sub.cols; c++) {
32155
33210
  const cx = sub.x + BB_CONST.BOARD_PAD_X + BB_CONST.ROW_LABEL_W + PITCH2 / 2 + (c - 1) * PITCH2;
32156
- elements.push(chunk3WNW5Y7P_cjs.circle({ cx, cy: r6.y + 4, r: 1.4, class: "lt-bb-hole-rail" }));
32157
- elements.push(chunk3WNW5Y7P_cjs.circle({ cx, cy: r6.y + BB_CONST.RAIL_HEIGHT - 4, r: 1.4, class: "lt-bb-hole-rail" }));
33211
+ elements.push(chunk3WNW5Y7P_cjs.circle({ cx, cy: r7.y + 4, r: 1.4, class: "lt-bb-hole-rail" }));
33212
+ elements.push(chunk3WNW5Y7P_cjs.circle({ cx, cy: r7.y + BB_CONST.RAIL_HEIGHT - 4, r: 1.4, class: "lt-bb-hole-rail" }));
32158
33213
  }
32159
33214
  }
32160
33215
  }
@@ -32181,10 +33236,10 @@ function renderSubstrate(sub) {
32181
33236
  elements.push(chunk3WNW5Y7P_cjs.text({ x: sub.x + sub.width - BB_CONST.BOARD_PAD_X - 4, y: yBot, class: "lt-bb-row-label" }, rowsBot[i]));
32182
33237
  }
32183
33238
  for (let c = 1; c <= sub.cols; c++) {
32184
- for (let r6 = 0; r6 < 10; r6++) {
33239
+ for (let r7 = 0; r7 < 10; r7++) {
32185
33240
  const cx = sub.x + BB_CONST.BOARD_PAD_X + BB_CONST.ROW_LABEL_W + PITCH2 / 2 + (c - 1) * PITCH2;
32186
- let cy = gridY0 + r6 * PITCH2;
32187
- if (r6 >= 5) cy += BB_CONST.TROUGH;
33241
+ let cy = gridY0 + r7 * PITCH2;
33242
+ if (r7 >= 5) cy += BB_CONST.TROUGH;
32188
33243
  elements.push(chunk3WNW5Y7P_cjs.circle({ cx, cy, r: 1.6, class: "lt-bb-hole" }));
32189
33244
  }
32190
33245
  }
@@ -32686,34 +33741,34 @@ function parseFlowLine(ln, flows, objectOwner, poolByLabel) {
32686
33741
  connectorLen = 3;
32687
33742
  } else if (rest.startsWith("--?")) {
32688
33743
  kind = "conditional";
32689
- let r6 = rest.slice(3).trimStart();
32690
- const q = takeQuoted(r6);
33744
+ let r7 = rest.slice(3).trimStart();
33745
+ const q = takeQuoted(r7);
32691
33746
  if (q) {
32692
33747
  connectorLabel = q.value;
32693
- r6 = q.rest.trimStart();
33748
+ r7 = q.rest.trimStart();
32694
33749
  }
32695
- if (!r6.startsWith("-->")) {
33750
+ if (!r7.startsWith("-->")) {
32696
33751
  throw new BpmnParseError(
32697
- `conditional flow must end with --> (got '${r6.slice(0, 20)}')`,
33752
+ `conditional flow must end with --> (got '${r7.slice(0, 20)}')`,
32698
33753
  ln.no
32699
33754
  );
32700
33755
  }
32701
- connectorLen = rest.length - r6.length + 3;
33756
+ connectorLen = rest.length - r7.length + 3;
32702
33757
  } else if (rest.startsWith("--*")) {
32703
33758
  kind = "default";
32704
- let r6 = rest.slice(3).trimStart();
32705
- const q = takeQuoted(r6);
33759
+ let r7 = rest.slice(3).trimStart();
33760
+ const q = takeQuoted(r7);
32706
33761
  if (q) {
32707
33762
  connectorLabel = q.value;
32708
- r6 = q.rest.trimStart();
33763
+ r7 = q.rest.trimStart();
32709
33764
  }
32710
- if (!r6.startsWith("-->")) {
33765
+ if (!r7.startsWith("-->")) {
32711
33766
  throw new BpmnParseError(
32712
- `default flow must end with --> (got '${r6.slice(0, 20)}')`,
33767
+ `default flow must end with --> (got '${r7.slice(0, 20)}')`,
32713
33768
  ln.no
32714
33769
  );
32715
33770
  }
32716
- connectorLen = rest.length - r6.length + 3;
33771
+ connectorLen = rest.length - r7.length + 3;
32717
33772
  } else if (rest.startsWith("-->")) {
32718
33773
  kind = "sequence";
32719
33774
  connectorLen = 3;
@@ -32806,8 +33861,8 @@ function objBox(o) {
32806
33861
  if ("gatewayKind" in o) {
32807
33862
  return { w: BPMN_CONST.gatewaySize, h: BPMN_CONST.gatewaySize };
32808
33863
  }
32809
- const r6 = BPMN_CONST.eventRadius;
32810
- return { w: r6 * 2, h: r6 * 2 };
33864
+ const r7 = BPMN_CONST.eventRadius;
33865
+ return { w: r7 * 2, h: r7 * 2 };
32811
33866
  }
32812
33867
  function layoutBpmn(ast) {
32813
33868
  const allObjects = [
@@ -33418,11 +34473,11 @@ function renderGateway(ol, t) {
33418
34473
  const g = ol.obj;
33419
34474
  const cx = ol.x + ol.width / 2;
33420
34475
  const cy = ol.y + ol.height / 2;
33421
- const r6 = ol.width / 2;
33422
- const points = `${cx},${cy - r6} ${cx + r6},${cy} ${cx},${cy + r6} ${cx - r6},${cy}`;
34476
+ const r7 = ol.width / 2;
34477
+ const points = `${cx},${cy - r7} ${cx + r7},${cy} ${cx},${cy + r7} ${cx - r7},${cy}`;
33423
34478
  const inner = [];
33424
34479
  if (g.gatewayKind === "xor") {
33425
- const a = r6 * 0.42;
34480
+ const a = r7 * 0.42;
33426
34481
  inner.push(
33427
34482
  chunk3WNW5Y7P_cjs.el("path", {
33428
34483
  d: `M ${cx - a} ${cy - a} L ${cx + a} ${cy + a} M ${cx + a} ${cy - a} L ${cx - a} ${cy + a}`,
@@ -33432,7 +34487,7 @@ function renderGateway(ol, t) {
33432
34487
  })
33433
34488
  );
33434
34489
  } else if (g.gatewayKind === "and") {
33435
- const a = r6 * 0.5;
34490
+ const a = r7 * 0.5;
33436
34491
  inner.push(
33437
34492
  chunk3WNW5Y7P_cjs.el("path", {
33438
34493
  d: `M ${cx - a} ${cy} L ${cx + a} ${cy} M ${cx} ${cy - a} L ${cx} ${cy + a}`,
@@ -33446,7 +34501,7 @@ function renderGateway(ol, t) {
33446
34501
  chunk3WNW5Y7P_cjs.el("circle", {
33447
34502
  cx,
33448
34503
  cy,
33449
- r: r6 * 0.45,
34504
+ r: r7 * 0.45,
33450
34505
  fill: "none",
33451
34506
  stroke: t.gatewayGlyph,
33452
34507
  "stroke-width": 2
@@ -33457,13 +34512,13 @@ function renderGateway(ol, t) {
33457
34512
  chunk3WNW5Y7P_cjs.el("circle", {
33458
34513
  cx,
33459
34514
  cy,
33460
- r: r6 * 0.55,
34515
+ r: r7 * 0.55,
33461
34516
  fill: "none",
33462
34517
  stroke: t.gatewayGlyph,
33463
34518
  "stroke-width": 1
33464
34519
  })
33465
34520
  );
33466
- const pr = r6 * 0.32;
34521
+ const pr = r7 * 0.32;
33467
34522
  const pts = [];
33468
34523
  for (let k = 0; k < 5; k++) {
33469
34524
  const ang = -Math.PI / 2 + k * 2 * Math.PI / 5;
@@ -33505,7 +34560,7 @@ function renderEvent2(ol, t) {
33505
34560
  const e = ol.obj;
33506
34561
  const cx = ol.x + ol.width / 2;
33507
34562
  const cy = ol.y + ol.height / 2;
33508
- const r6 = ol.width / 2;
34563
+ const r7 = ol.width / 2;
33509
34564
  const isEnd = e.kind === "end";
33510
34565
  const isIntermediate = e.kind === "intermediate";
33511
34566
  const strokeW = isEnd ? 3 : 1.2;
@@ -33516,7 +34571,7 @@ function renderEvent2(ol, t) {
33516
34571
  chunk3WNW5Y7P_cjs.el("circle", {
33517
34572
  cx,
33518
34573
  cy,
33519
- r: r6,
34574
+ r: r7,
33520
34575
  fill,
33521
34576
  stroke: ring,
33522
34577
  "stroke-width": strokeW
@@ -33527,7 +34582,7 @@ function renderEvent2(ol, t) {
33527
34582
  chunk3WNW5Y7P_cjs.el("circle", {
33528
34583
  cx,
33529
34584
  cy,
33530
- r: r6 - 3,
34585
+ r: r7 - 3,
33531
34586
  fill: "none",
33532
34587
  stroke: ring,
33533
34588
  "stroke-width": 1.2
@@ -33536,9 +34591,9 @@ function renderEvent2(ol, t) {
33536
34591
  }
33537
34592
  const filled = e.throwCatch === "throw" && (isIntermediate || isEnd);
33538
34593
  if (e.trigger === "message") {
33539
- children.push(messageGlyph(cx, cy, r6 * 0.55, filled, t));
34594
+ children.push(messageGlyph(cx, cy, r7 * 0.55, filled, t));
33540
34595
  } else if (e.trigger === "timer") {
33541
- children.push(timerGlyph(cx, cy, r6 * 0.55, t));
34596
+ children.push(timerGlyph(cx, cy, r7 * 0.55, t));
33542
34597
  }
33543
34598
  if (e.label) {
33544
34599
  children.push(
@@ -33581,22 +34636,22 @@ function messageGlyph(cx, cy, size, filled, t) {
33581
34636
  ]);
33582
34637
  }
33583
34638
  function timerGlyph(cx, cy, size, t) {
33584
- const r6 = size / 2;
34639
+ const r7 = size / 2;
33585
34640
  const ticks = [];
33586
34641
  for (let k = 0; k < 12; k++) {
33587
34642
  const ang = k * Math.PI / 6 - Math.PI / 2;
33588
- const t1x = cx + (r6 - 1.5) * Math.cos(ang);
33589
- const t1y = cy + (r6 - 1.5) * Math.sin(ang);
33590
- const t2x = cx + r6 * Math.cos(ang);
33591
- const t2y = cy + r6 * Math.sin(ang);
34643
+ const t1x = cx + (r7 - 1.5) * Math.cos(ang);
34644
+ const t1y = cy + (r7 - 1.5) * Math.sin(ang);
34645
+ const t2x = cx + r7 * Math.cos(ang);
34646
+ const t2y = cy + r7 * Math.sin(ang);
33592
34647
  ticks.push(`M ${t1x} ${t1y} L ${t2x} ${t2y}`);
33593
34648
  }
33594
34649
  return chunk3WNW5Y7P_cjs.el("g", { class: "trigger-timer" }, [
33595
- chunk3WNW5Y7P_cjs.el("circle", { cx, cy, r: r6, fill: "none", stroke: t.bpmnStroke, "stroke-width": 1 }),
34650
+ chunk3WNW5Y7P_cjs.el("circle", { cx, cy, r: r7, fill: "none", stroke: t.bpmnStroke, "stroke-width": 1 }),
33596
34651
  chunk3WNW5Y7P_cjs.el("path", { d: ticks.join(" "), stroke: t.bpmnStroke, "stroke-width": 0.8 }),
33597
34652
  // Hands
33598
34653
  chunk3WNW5Y7P_cjs.el("path", {
33599
- d: `M ${cx} ${cy} L ${cx} ${cy - r6 * 0.7} M ${cx} ${cy} L ${cx + r6 * 0.5} ${cy}`,
34654
+ d: `M ${cx} ${cy} L ${cx} ${cy - r7 * 0.7} M ${cx} ${cy} L ${cx + r7 * 0.5} ${cy}`,
33600
34655
  stroke: t.bpmnStroke,
33601
34656
  "stroke-width": 1.2,
33602
34657
  "stroke-linecap": "round"
@@ -33667,8 +34722,8 @@ function parseStart(d) {
33667
34722
  if (!m) return null;
33668
34723
  return { x: parseFloat(m[1]), y: parseFloat(m[2]) };
33669
34724
  }
33670
- function diamondPoints(cx, cy, r6) {
33671
- return `${cx - r6},${cy} ${cx},${cy - r6} ${cx + r6},${cy} ${cx},${cy + r6}`;
34725
+ function diamondPoints(cx, cy, r7) {
34726
+ return `${cx - r7},${cy} ${cx},${cy - r7} ${cx + r7},${cy} ${cx},${cy + r7}`;
33672
34727
  }
33673
34728
 
33674
34729
  // src/diagrams/bpmn/index.ts
@@ -34871,7 +35926,7 @@ function wireClass(t) {
34871
35926
  return "lt-fbd-wire-any";
34872
35927
  }
34873
35928
  }
34874
- function renderBlock(lb) {
35929
+ function renderBlock2(lb) {
34875
35930
  const { x, y, width, height, block } = lb;
34876
35931
  const headerH = FBD_CONST.block_header_h;
34877
35932
  const parts = [];
@@ -35007,7 +36062,7 @@ function renderNetwork2(ln) {
35007
36062
  for (const j of ln.junctions) {
35008
36063
  parts.push(chunk3WNW5Y7P_cjs.circle({ class: "lt-fbd-junction", cx: j.x, cy: j.y, r: 3 }));
35009
36064
  }
35010
- for (const b of ln.blocks) parts.push(renderBlock(b));
36065
+ for (const b of ln.blocks) parts.push(renderBlock2(b));
35011
36066
  return chunk3WNW5Y7P_cjs.group({ class: "lt-fbd-network", "data-network": ln.network.index }, parts);
35012
36067
  }
35013
36068
  function renderFbdLayout(layout) {
@@ -36077,14 +37132,14 @@ function roundTable(seats, diaM) {
36077
37132
  draw: (c) => {
36078
37133
  const half = Math.min(c.w, c.h) / 2;
36079
37134
  const ring = Math.min(RING, half * 0.37);
36080
- const r6 = half - ring;
37135
+ const r7 = half - ring;
36081
37136
  const cx = c.w / 2;
36082
37137
  const cy = c.h / 2;
36083
- const parts = [chunk3WNW5Y7P_cjs.circle({ class: "sx-fp-furn", cx: c.px(cx), cy: c.px(cy), r: c.px(r6) })];
37138
+ const parts = [chunk3WNW5Y7P_cjs.circle({ class: "sx-fp-furn", cx: c.px(cx), cy: c.px(cy), r: c.px(r7) })];
36084
37139
  for (let i = 0; i < seats; i++) {
36085
37140
  const a = i / seats * 2 * Math.PI - Math.PI / 2;
36086
- const px0 = cx + (r6 + ring * 0.55) * Math.cos(a);
36087
- const py0 = cy + (r6 + ring * 0.55) * Math.sin(a);
37141
+ const px0 = cx + (r7 + ring * 0.55) * Math.cos(a);
37142
+ const py0 = cy + (r7 + ring * 0.55) * Math.sin(a);
36088
37143
  parts.push(chairAt(c.px, px0, py0, a * 180 / Math.PI + 90));
36089
37144
  }
36090
37145
  return parts.join("");
@@ -36234,11 +37289,11 @@ function uStairs(c) {
36234
37289
  return parts.join("");
36235
37290
  }
36236
37291
  function spiralStairs(c) {
36237
- const r6 = Math.min(c.w, c.h) / 2 - 0.02;
37292
+ const r7 = Math.min(c.w, c.h) / 2 - 0.02;
36238
37293
  const cx = c.w / 2;
36239
37294
  const cy = c.h / 2;
36240
37295
  const parts = [
36241
- chunk3WNW5Y7P_cjs.circle({ class: "sx-fp-furn", cx: c.px(cx), cy: c.px(cy), r: c.px(r6) }),
37296
+ chunk3WNW5Y7P_cjs.circle({ class: "sx-fp-furn", cx: c.px(cx), cy: c.px(cy), r: c.px(r7) }),
36242
37297
  chunk3WNW5Y7P_cjs.circle({ class: "sx-fp-furn-line", cx: c.px(cx), cy: c.px(cy), r: c.px(0.08) })
36243
37298
  ];
36244
37299
  for (let i = 0; i < 12; i++) {
@@ -36248,12 +37303,12 @@ function spiralStairs(c) {
36248
37303
  class: "sx-fp-furn-line",
36249
37304
  x1: c.px(cx + 0.08 * Math.cos(a)),
36250
37305
  y1: c.px(cy + 0.08 * Math.sin(a)),
36251
- x2: c.px(cx + r6 * Math.cos(a)),
36252
- y2: c.px(cy + r6 * Math.sin(a))
37306
+ x2: c.px(cx + r7 * Math.cos(a)),
37307
+ y2: c.px(cy + r7 * Math.sin(a))
36253
37308
  })
36254
37309
  );
36255
37310
  }
36256
- const wr = r6 * 0.62;
37311
+ const wr = r7 * 0.62;
36257
37312
  const a0 = Math.PI * 0.75;
36258
37313
  const a1 = Math.PI * 1.9;
36259
37314
  const steps = 5;
@@ -36325,8 +37380,8 @@ var FLOORPLAN_SYMBOLS = {
36325
37380
  w: 0.5,
36326
37381
  h: 0.5,
36327
37382
  draw: (c) => {
36328
- const r6 = Math.min(c.w, c.h) / 2;
36329
- const parts = [chunk3WNW5Y7P_cjs.circle({ class: "sx-fp-furn", cx: c.px(c.w / 2), cy: c.px(c.h / 2), r: c.px(r6) })];
37383
+ const r7 = Math.min(c.w, c.h) / 2;
37384
+ const parts = [chunk3WNW5Y7P_cjs.circle({ class: "sx-fp-furn", cx: c.px(c.w / 2), cy: c.px(c.h / 2), r: c.px(r7) })];
36330
37385
  for (const a of [0, 60, 120, 180, 240, 300]) {
36331
37386
  const rad = a * Math.PI / 180;
36332
37387
  parts.push(
@@ -36334,8 +37389,8 @@ var FLOORPLAN_SYMBOLS = {
36334
37389
  class: "sx-fp-furn-line",
36335
37390
  x1: c.px(c.w / 2),
36336
37391
  y1: c.px(c.h / 2),
36337
- x2: c.px(c.w / 2 + (r6 - 0.03) * Math.cos(rad)),
36338
- y2: c.px(c.h / 2 + (r6 - 0.03) * Math.sin(rad))
37392
+ x2: c.px(c.w / 2 + (r7 - 0.03) * Math.cos(rad)),
37393
+ y2: c.px(c.h / 2 + (r7 - 0.03) * Math.sin(rad))
36339
37394
  })
36340
37395
  );
36341
37396
  }
@@ -36395,11 +37450,11 @@ var FLOORPLAN_SYMBOLS = {
36395
37450
  w: 0.35,
36396
37451
  h: 0.35,
36397
37452
  draw: (c) => {
36398
- const r6 = Math.min(c.w, c.h) / 2;
37453
+ const r7 = Math.min(c.w, c.h) / 2;
36399
37454
  return [
36400
- chunk3WNW5Y7P_cjs.circle({ class: "sx-fp-furn", cx: c.px(c.w / 2), cy: c.px(c.h / 2), r: c.px(r6) }),
36401
- chunk3WNW5Y7P_cjs.line({ class: "sx-fp-furn-line", x1: c.px(c.w / 2 - r6), y1: c.px(c.h / 2), x2: c.px(c.w / 2 + r6), y2: c.px(c.h / 2) }),
36402
- chunk3WNW5Y7P_cjs.line({ class: "sx-fp-furn-line", x1: c.px(c.w / 2), y1: c.px(c.h / 2 - r6), x2: c.px(c.w / 2), y2: c.px(c.h / 2 + r6) })
37455
+ chunk3WNW5Y7P_cjs.circle({ class: "sx-fp-furn", cx: c.px(c.w / 2), cy: c.px(c.h / 2), r: c.px(r7) }),
37456
+ chunk3WNW5Y7P_cjs.line({ class: "sx-fp-furn-line", x1: c.px(c.w / 2 - r7), y1: c.px(c.h / 2), x2: c.px(c.w / 2 + r7), y2: c.px(c.h / 2) }),
37457
+ chunk3WNW5Y7P_cjs.line({ class: "sx-fp-furn-line", x1: c.px(c.w / 2), y1: c.px(c.h / 2 - r7), x2: c.px(c.w / 2), y2: c.px(c.h / 2 + r7) })
36403
37458
  ].join("");
36404
37459
  }
36405
37460
  },
@@ -36475,23 +37530,23 @@ var FLOORPLAN_SYMBOLS = {
36475
37530
  underlay: true,
36476
37531
  // overhead fixture — never collides with floor furniture
36477
37532
  draw: (c) => {
36478
- const r6 = Math.min(c.w, c.h) / 2;
37533
+ const r7 = Math.min(c.w, c.h) / 2;
36479
37534
  const cx = c.w / 2;
36480
37535
  const cy = c.h / 2;
36481
37536
  const parts = [
36482
- chunk3WNW5Y7P_cjs.circle({ class: "sx-fp-furn-dash", cx: c.px(cx), cy: c.px(cy), r: c.px(r6) }),
36483
- chunk3WNW5Y7P_cjs.circle({ class: "sx-fp-furn", cx: c.px(cx), cy: c.px(cy), r: c.px(r6 * 0.18) })
37537
+ chunk3WNW5Y7P_cjs.circle({ class: "sx-fp-furn-dash", cx: c.px(cx), cy: c.px(cy), r: c.px(r7) }),
37538
+ chunk3WNW5Y7P_cjs.circle({ class: "sx-fp-furn", cx: c.px(cx), cy: c.px(cy), r: c.px(r7 * 0.18) })
36484
37539
  ];
36485
37540
  for (const a of [20, 110, 200, 290]) {
36486
37541
  const rad = a * Math.PI / 180;
36487
37542
  parts.push(
36488
37543
  chunk3WNW5Y7P_cjs.el("ellipse", {
36489
37544
  class: "sx-fp-furn-line",
36490
- cx: c.px(cx + r6 * 0.55 * Math.cos(rad)),
36491
- cy: c.px(cy + r6 * 0.55 * Math.sin(rad)),
36492
- rx: c.px(r6 * 0.42),
36493
- ry: c.px(r6 * 0.15),
36494
- transform: `rotate(${a} ${c.px(cx + r6 * 0.55 * Math.cos(rad))} ${c.px(cy + r6 * 0.55 * Math.sin(rad))})`
37545
+ cx: c.px(cx + r7 * 0.55 * Math.cos(rad)),
37546
+ cy: c.px(cy + r7 * 0.55 * Math.sin(rad)),
37547
+ rx: c.px(r7 * 0.42),
37548
+ ry: c.px(r7 * 0.15),
37549
+ transform: `rotate(${a} ${c.px(cx + r7 * 0.55 * Math.cos(rad))} ${c.px(cy + r7 * 0.55 * Math.sin(rad))})`
36495
37550
  })
36496
37551
  );
36497
37552
  }
@@ -36868,11 +37923,11 @@ var FLOORPLAN_SYMBOLS = {
36868
37923
  w: 1,
36869
37924
  h: 1,
36870
37925
  draw: (c) => {
36871
- const r6 = Math.min(c.w, c.h) / 2;
37926
+ const r7 = Math.min(c.w, c.h) / 2;
36872
37927
  const cx = c.w / 2;
36873
37928
  const cy = c.h / 2;
36874
37929
  const parts = [
36875
- chunk3WNW5Y7P_cjs.circle({ class: "sx-fp-furn-nofill", cx: c.px(cx), cy: c.px(cy), r: c.px(r6) }),
37930
+ chunk3WNW5Y7P_cjs.circle({ class: "sx-fp-furn-nofill", cx: c.px(cx), cy: c.px(cy), r: c.px(r7) }),
36876
37931
  chunk3WNW5Y7P_cjs.circle({ class: "sx-fp-furn-dot", cx: c.px(cx), cy: c.px(cy), r: c.px(0.04) })
36877
37932
  ];
36878
37933
  for (const a of [0, 45, 90, 135, 180, 225, 270, 315]) {
@@ -36880,10 +37935,10 @@ var FLOORPLAN_SYMBOLS = {
36880
37935
  parts.push(
36881
37936
  chunk3WNW5Y7P_cjs.line({
36882
37937
  class: "sx-fp-furn-line",
36883
- x1: c.px(cx + (r6 - 0.09) * Math.cos(rad)),
36884
- y1: c.px(cy + (r6 - 0.09) * Math.sin(rad)),
36885
- x2: c.px(cx + r6 * Math.cos(rad)),
36886
- y2: c.px(cy + r6 * Math.sin(rad))
37938
+ x1: c.px(cx + (r7 - 0.09) * Math.cos(rad)),
37939
+ y1: c.px(cy + (r7 - 0.09) * Math.sin(rad)),
37940
+ x2: c.px(cx + r7 * Math.cos(rad)),
37941
+ y2: c.px(cy + r7 * Math.sin(rad))
36887
37942
  })
36888
37943
  );
36889
37944
  }
@@ -37033,10 +38088,10 @@ var FLOORPLAN_SYMBOLS = {
37033
38088
  w: 2,
37034
38089
  h: 2,
37035
38090
  draw: (c) => {
37036
- const r6 = Math.min(c.w, c.h) / 2;
38091
+ const r7 = Math.min(c.w, c.h) / 2;
37037
38092
  return [
37038
- chunk3WNW5Y7P_cjs.circle({ class: "sx-fp-furn", cx: c.px(c.w / 2), cy: c.px(c.h / 2), r: c.px(r6) }),
37039
- chunk3WNW5Y7P_cjs.circle({ class: "sx-fp-furn-line", cx: c.px(c.w / 2), cy: c.px(c.h / 2), r: c.px(r6 * 0.6) }),
38093
+ chunk3WNW5Y7P_cjs.circle({ class: "sx-fp-furn", cx: c.px(c.w / 2), cy: c.px(c.h / 2), r: c.px(r7) }),
38094
+ chunk3WNW5Y7P_cjs.circle({ class: "sx-fp-furn-line", cx: c.px(c.w / 2), cy: c.px(c.h / 2), r: c.px(r7 * 0.6) }),
37040
38095
  chunk3WNW5Y7P_cjs.circle({ class: "sx-fp-furn-dot", cx: c.px(c.w / 2), cy: c.px(c.h / 2), r: c.px(0.07) })
37041
38096
  ].join("");
37042
38097
  }
@@ -37070,10 +38125,10 @@ var FloorplanParseError = class extends Error {
37070
38125
  };
37071
38126
  var isStr = (t) => t !== void 0 && "str" in t;
37072
38127
  var isWord = (t, w) => t !== void 0 && "word" in t && (w === void 0 || t.word === w);
37073
- function normalizeQuotes3(line2) {
38128
+ function normalizeQuotes4(line2) {
37074
38129
  return line2.replace(/[“”「」『』]/g, '"').replace(/[‘’]/g, "'");
37075
38130
  }
37076
- function tokenize7(line2) {
38131
+ function tokenize8(line2) {
37077
38132
  const out = [];
37078
38133
  const re = /"([^"]*)"|(\S+)/g;
37079
38134
  let m;
@@ -37083,7 +38138,7 @@ function tokenize7(line2) {
37083
38138
  }
37084
38139
  return out;
37085
38140
  }
37086
- function parseNum(t, what, ln) {
38141
+ function parseNum2(t, what, ln) {
37087
38142
  if (!isWord(t)) throw new FloorplanParseError(`expected a number for ${what}`, ln);
37088
38143
  const v = Number(t.word);
37089
38144
  if (!Number.isFinite(v)) throw new FloorplanParseError(`expected a number for ${what}, got "${t.word}"`, ln);
@@ -37136,7 +38191,7 @@ function parseHeader3(tok, ast, ln) {
37136
38191
  }
37137
38192
  function parseRoom(tok, ast, ln) {
37138
38193
  const id = parseId(tok.shift(), "a room id", ln);
37139
- if (ast.rooms.some((r6) => r6.id === id)) {
38194
+ if (ast.rooms.some((r7) => r7.id === id)) {
37140
38195
  throw new FloorplanParseError(`duplicate room id "${id}"`, ln);
37141
38196
  }
37142
38197
  const room = { id, label: id, w: 4, h: 3, line: ln };
@@ -37153,7 +38208,7 @@ function parseRoom(tok, ast, ln) {
37153
38208
  };
37154
38209
  } else if (t.word === "offset") {
37155
38210
  if (!room.rel) throw new FloorplanParseError(`"offset" requires a relative placement (right-of/left-of/above/below)`, ln);
37156
- room.rel.offset = parseNum(tok.shift(), "offset", ln);
38211
+ room.rel.offset = parseNum2(tok.shift(), "offset", ln);
37157
38212
  } else if (t.word === "align") {
37158
38213
  if (!room.rel) throw new FloorplanParseError(`"align" requires a relative placement (right-of/left-of/above/below)`, ln);
37159
38214
  const a = parseId(tok.shift(), "align (start|center|end)", ln);
@@ -37187,7 +38242,7 @@ function parseExtend(tok, ast, ln) {
37187
38242
  };
37188
38243
  } else if (t.word === "offset") {
37189
38244
  if (!ext.rel) throw new FloorplanParseError(`"offset" requires a relative placement (right-of/left-of/above/below)`, ln);
37190
- ext.rel.offset = parseNum(tok.shift(), "offset", ln);
38245
+ ext.rel.offset = parseNum2(tok.shift(), "offset", ln);
37191
38246
  } else if (t.word === "align") {
37192
38247
  if (!ext.rel) throw new FloorplanParseError(`"align" requires a relative placement (right-of/left-of/above/below)`, ln);
37193
38248
  const a = parseId(tok.shift(), "align (start|center|end)", ln);
@@ -37232,7 +38287,7 @@ function parseOpening(kind, tok, ast, ln) {
37232
38287
  const t = tok.shift();
37233
38288
  if (!isWord(t)) throw new FloorplanParseError(`${kind}: unexpected string "${t.str}"`, ln);
37234
38289
  else if (t.word === "at") op.pct = parsePct(tok.shift(), ln);
37235
- else if (t.word === "width") op.width = parseNum(tok.shift(), "width", ln);
38290
+ else if (t.word === "width") op.width = parseNum2(tok.shift(), "width", ln);
37236
38291
  else if (t.word === "hinge") {
37237
38292
  const h = parseId(tok.shift(), "hinge (left|right)", ln);
37238
38293
  if (h !== "left" && h !== "right") throw new FloorplanParseError(`hinge must be left|right, got "${h}"`, ln);
@@ -37273,7 +38328,7 @@ function parseFurniture(tok, ast, ln) {
37273
38328
  f.x = c.x;
37274
38329
  f.y = c.y;
37275
38330
  } else if (t.word === "size") f.size = parseDims(tok.shift(), "size", ln);
37276
- else if (t.word === "rotate") f.rotate = parseNum(tok.shift(), "rotate", ln);
38331
+ else if (t.word === "rotate") f.rotate = parseNum2(tok.shift(), "rotate", ln);
37277
38332
  else throw new FloorplanParseError(`furniture: unexpected token "${t.word}"`, ln);
37278
38333
  }
37279
38334
  ast.furniture.push(f);
@@ -37293,18 +38348,18 @@ function parseArray(mode, tok, ast, ln) {
37293
38348
  const t = tok.shift();
37294
38349
  if (!isWord(t)) throw new FloorplanParseError(`${mode}: unexpected string "${t.str}"`, ln);
37295
38350
  else if (t.word === "in") a.room = parseId(tok.shift(), `a room id after "in"`, ln);
37296
- else if (t.word === "rows") a.rows = parseNum(tok.shift(), "rows", ln);
37297
- else if (t.word === "cols") a.cols = parseNum(tok.shift(), "cols", ln);
37298
- else if (t.word === "count") a.count = parseNum(tok.shift(), "count", ln);
38351
+ else if (t.word === "rows") a.rows = parseNum2(tok.shift(), "rows", ln);
38352
+ else if (t.word === "cols") a.cols = parseNum2(tok.shift(), "cols", ln);
38353
+ else if (t.word === "count") a.count = parseNum2(tok.shift(), "count", ln);
37299
38354
  else if (t.word === "area") {
37300
38355
  a.p1 = parseCoord2(tok.shift(), "area p1", ln);
37301
38356
  a.p2 = parseCoord2(tok.shift(), "area p2", ln);
37302
38357
  } else if (t.word === "itemsize") a.itemsize = parseDims(tok.shift(), "itemsize", ln);
37303
- else if (t.word === "rotate") a.rotate = parseNum(tok.shift(), "rotate", ln);
38358
+ else if (t.word === "rotate") a.rotate = parseNum2(tok.shift(), "rotate", ln);
37304
38359
  else if (t.word === "center") a.center = parseCoord2(tok.shift(), "center", ln);
37305
- else if (t.word === "radius") a.radius = parseNum(tok.shift(), "radius", ln);
37306
- else if (t.word === "from") a.fromDeg = parseNum(tok.shift(), "from", ln);
37307
- else if (t.word === "to") a.toDeg = parseNum(tok.shift(), "to", ln);
38360
+ else if (t.word === "radius") a.radius = parseNum2(tok.shift(), "radius", ln);
38361
+ else if (t.word === "from") a.fromDeg = parseNum2(tok.shift(), "from", ln);
38362
+ else if (t.word === "to") a.toDeg = parseNum2(tok.shift(), "to", ln);
37308
38363
  else throw new FloorplanParseError(`${mode}: unexpected token "${t.word}"`, ln);
37309
38364
  }
37310
38365
  ast.arrays.push(a);
@@ -37324,9 +38379,9 @@ function parseFloorplan(text2) {
37324
38379
  const lines = text2.split(/\r?\n/);
37325
38380
  for (let i = 0; i < lines.length; i++) {
37326
38381
  const ln = i + 1;
37327
- const raw = normalizeQuotes3(lines[i]).trim();
38382
+ const raw = normalizeQuotes4(lines[i]).trim();
37328
38383
  if (!raw) continue;
37329
- const all = tokenize7(raw);
38384
+ const all = tokenize8(raw);
37330
38385
  const tok = [];
37331
38386
  for (let k = 0; k < all.length; k++) {
37332
38387
  const t = all[k];
@@ -37351,7 +38406,7 @@ function parseFloorplan(text2) {
37351
38406
  throw new FloorplanParseError(`the first statement must be the "floorplan" header`, ln);
37352
38407
  } else if (kw === "room") parseRoom(tok, ast, ln);
37353
38408
  else if (kw === "north") {
37354
- ast.north = tok.length ? parseNum(tok.shift(), "north rotation (degrees)", ln) : 0;
38409
+ ast.north = tok.length ? parseNum2(tok.shift(), "north rotation (degrees)", ln) : 0;
37355
38410
  if (tok.length) throw new FloorplanParseError(`north: unexpected trailing tokens`, ln);
37356
38411
  } else if (kw === "extend") parseExtend(tok, ast, ln);
37357
38412
  else if (kw === "door" || kw === "window" || kw === "opening") parseOpening(kw, tok, ast, ln);
@@ -37614,14 +38669,14 @@ function layoutFloorplan(ast) {
37614
38669
  ].sort((a, b) => a.line - b.line);
37615
38670
  for (const stmt of stmts) {
37616
38671
  if (stmt.room) {
37617
- const r6 = stmt.room;
37618
- const w = r6.w * u;
37619
- const h = r6.h * u;
37620
- const pos = resolvePlacement(r6, w, h, byId, rooms, u, `room "${r6.id}"`, errors) ?? { x: 0, y: 0 };
38672
+ const r7 = stmt.room;
38673
+ const w = r7.w * u;
38674
+ const h = r7.h * u;
38675
+ const pos = resolvePlacement(r7, w, h, byId, rooms, u, `room "${r7.id}"`, errors) ?? { x: 0, y: 0 };
37621
38676
  const part = { x: pos.x, y: pos.y, w, h };
37622
38677
  const room = {
37623
- id: r6.id,
37624
- label: r6.label,
38678
+ id: r7.id,
38679
+ label: r7.label,
37625
38680
  x: part.x,
37626
38681
  y: part.y,
37627
38682
  w,
@@ -37629,11 +38684,11 @@ function layoutFloorplan(ast) {
37629
38684
  parts: [part],
37630
38685
  areaM2: 0,
37631
38686
  areaText: "",
37632
- fill: r6.fill,
37633
- nolabel: r6.nolabel ?? false
38687
+ fill: r7.fill,
38688
+ nolabel: r7.nolabel ?? false
37634
38689
  };
37635
38690
  refreshRoomBounds(room, ast.unit);
37636
- byId.set(r6.id, rooms.length);
38691
+ byId.set(r7.id, rooms.length);
37637
38692
  rooms.push(room);
37638
38693
  } else if (stmt.ext) {
37639
38694
  const e = stmt.ext;
@@ -37746,10 +38801,10 @@ function layoutFloorplan(ast) {
37746
38801
  const spanW = p2.x - p1.x;
37747
38802
  const spanH = p2.y - p1.y;
37748
38803
  let placed = 0;
37749
- for (let r6 = 0; r6 < nRows && placed < cap2; r6++) {
38804
+ for (let r7 = 0; r7 < nRows && placed < cap2; r7++) {
37750
38805
  for (let col = 0; col < nCols && placed < cap2; col++) {
37751
38806
  const cx = p1.x + (nCols === 1 ? spanW / 2 : col * spanW / (nCols - 1));
37752
- const cy = p1.y + (nRows === 1 ? spanH / 2 : r6 * spanH / (nRows - 1));
38807
+ const cy = p1.y + (nRows === 1 ? spanH / 2 : r7 * spanH / (nRows - 1));
37753
38808
  place(a.type, idx, cx - iw / 2, cy - ih / 2, iw, ih, a.rotate);
37754
38809
  placed++;
37755
38810
  }
@@ -37770,7 +38825,7 @@ function layoutFloorplan(ast) {
37770
38825
  }
37771
38826
  }
37772
38827
  const roomOf = /* @__PURE__ */ new Map();
37773
- for (const r6 of rooms) roomOf.set(r6.id, r6);
38828
+ for (const r7 of rooms) roomOf.set(r7.id, r7);
37774
38829
  const warnItems = /* @__PURE__ */ new Set();
37775
38830
  for (const it of items) {
37776
38831
  const room = roomOf.get(it.roomId);
@@ -37829,11 +38884,11 @@ function layoutFloorplan(ast) {
37829
38884
  let minY = Infinity;
37830
38885
  let maxX = -Infinity;
37831
38886
  let maxY = -Infinity;
37832
- for (const r6 of rooms) {
37833
- minX = Math.min(minX, r6.x);
37834
- minY = Math.min(minY, r6.y);
37835
- maxX = Math.max(maxX, r6.x + r6.w);
37836
- maxY = Math.max(maxY, r6.y + r6.h);
38887
+ for (const r7 of rooms) {
38888
+ minX = Math.min(minX, r7.x);
38889
+ minY = Math.min(minY, r7.y);
38890
+ maxX = Math.max(maxX, r7.x + r7.w);
38891
+ maxY = Math.max(maxY, r7.y + r7.h);
37837
38892
  }
37838
38893
  if (rooms.length === 0) {
37839
38894
  minX = minY = 0;
@@ -37859,8 +38914,8 @@ function layoutFloorplan(ast) {
37859
38914
  minor: false
37860
38915
  });
37861
38916
  const topSegs = [];
37862
- for (const r6 of rooms) {
37863
- for (const sg of sideSegments(r6, "north")) {
38917
+ for (const r7 of rooms) {
38918
+ for (const sg of sideSegments(r7, "north")) {
37864
38919
  if (Math.abs(sg.along - minY) < 0.01) topSegs.push({ lo: sg.lo, hi: sg.hi });
37865
38920
  }
37866
38921
  }
@@ -37877,8 +38932,8 @@ function layoutFloorplan(ast) {
37877
38932
  }
37878
38933
  }
37879
38934
  const leftSegs = [];
37880
- for (const r6 of rooms) {
37881
- for (const sg of sideSegments(r6, "west")) {
38935
+ for (const r7 of rooms) {
38936
+ for (const sg of sideSegments(r7, "west")) {
37882
38937
  if (Math.abs(sg.along - minX) < 0.01) leftSegs.push({ lo: sg.lo, hi: sg.hi });
37883
38938
  }
37884
38939
  }
@@ -37906,7 +38961,7 @@ function layoutFloorplan(ast) {
37906
38961
  dims,
37907
38962
  bounds: { minX, minY, maxX, maxY },
37908
38963
  wallT: FLOORPLAN_CONST.wallT,
37909
- totalAreaM2: rooms.reduce((s, r6) => s + r6.areaM2, 0),
38964
+ totalAreaM2: rooms.reduce((s, r7) => s + r7.areaM2, 0),
37910
38965
  errors,
37911
38966
  warnings,
37912
38967
  warnItems: [...warnItems]
@@ -37958,11 +39013,11 @@ function resolveOpening(op, rooms, byId, u, unit, errors, warnings) {
37958
39013
  return null;
37959
39014
  }
37960
39015
  owner = idx;
37961
- const r6 = rooms[idx];
39016
+ const r7 = rooms[idx];
37962
39017
  const side = op.side;
37963
- const segs = sideSegments(r6, side);
39018
+ const segs = sideSegments(r7, side);
37964
39019
  if (segs.length === 0) {
37965
- errors.push(`${op.kind} on "${r6.id}" ${side}: that side has no exterior wall segment`);
39020
+ errors.push(`${op.kind} on "${r7.id}" ${side}: that side has no exterior wall segment`);
37966
39021
  return null;
37967
39022
  }
37968
39023
  const total = segs.reduce((s, sg) => s + (sg.hi - sg.lo), 0);
@@ -38303,13 +39358,13 @@ function renderFloorplanLayout(lay, config) {
38303
39358
  const openings = [];
38304
39359
  const labels = [];
38305
39360
  const dims = [];
38306
- for (const r6 of lay.rooms) {
39361
+ for (const r7 of lay.rooms) {
38307
39362
  floors.push(
38308
39363
  chunk3WNW5Y7P_cjs.group(
38309
- { class: "sx-fp-floor", "data-room": r6.id },
38310
- r6.parts.map(
39364
+ { class: "sx-fp-floor", "data-room": r7.id },
39365
+ r7.parts.map(
38311
39366
  (p) => chunk3WNW5Y7P_cjs.rect({
38312
- fill: r6.fill ?? t.floorFill,
39367
+ fill: r7.fill ?? t.floorFill,
38313
39368
  x: X(p.x),
38314
39369
  y: Y(p.y),
38315
39370
  width: px(p.w),
@@ -38318,12 +39373,12 @@ function renderFloorplanLayout(lay, config) {
38318
39373
  )
38319
39374
  )
38320
39375
  );
38321
- if (!r6.nolabel) {
38322
- const main = r6.parts.reduce((a, b) => b.w * b.h > a.w * a.h ? b : a);
39376
+ if (!r7.nolabel) {
39377
+ const main = r7.parts.reduce((a, b) => b.w * b.h > a.w * a.h ? b : a);
38323
39378
  const cx = X(main.x + main.w / 2);
38324
39379
  const cy = Y(main.y + main.h / 2);
38325
- labels.push(chunk3WNW5Y7P_cjs.text({ class: "sx-fp-room-name", x: cx, y: r24(cy - 3), "text-anchor": "middle" }, r6.label));
38326
- labels.push(chunk3WNW5Y7P_cjs.text({ class: "sx-fp-room-area", x: cx, y: r24(cy + 13), "text-anchor": "middle" }, r6.areaText));
39380
+ labels.push(chunk3WNW5Y7P_cjs.text({ class: "sx-fp-room-name", x: cx, y: r24(cy - 3), "text-anchor": "middle" }, r7.label));
39381
+ labels.push(chunk3WNW5Y7P_cjs.text({ class: "sx-fp-room-area", x: cx, y: r24(cy + 13), "text-anchor": "middle" }, r7.areaText));
38327
39382
  }
38328
39383
  }
38329
39384
  const warnSet = new Set(lay.warnItems);
@@ -38353,8 +39408,8 @@ function renderFloorplanLayout(lay, config) {
38353
39408
  }
38354
39409
  });
38355
39410
  const tw = lay.wallT;
38356
- for (const r6 of lay.rooms) {
38357
- for (const p of r6.parts) {
39411
+ for (const r7 of lay.rooms) {
39412
+ for (const p of r7.parts) {
38358
39413
  walls.push(chunk3WNW5Y7P_cjs.rect({ class: "sx-fp-wall", x: r24(X(p.x) - px(tw / 2)), y: r24(Y(p.y) - px(tw / 2)), width: r24(px(p.w + tw)), height: px(tw) }));
38359
39414
  walls.push(chunk3WNW5Y7P_cjs.rect({ class: "sx-fp-wall", x: r24(X(p.x) - px(tw / 2)), y: r24(Y(p.y + p.h) - px(tw / 2)), width: r24(px(p.w + tw)), height: px(tw) }));
38360
39415
  walls.push(chunk3WNW5Y7P_cjs.rect({ class: "sx-fp-wall", x: r24(X(p.x) - px(tw / 2)), y: r24(Y(p.y) - px(tw / 2)), width: px(tw), height: r24(px(p.h + tw)) }));
@@ -38487,8 +39542,8 @@ var PlaybookParseError = class extends Error {
38487
39542
  var isStr2 = (t) => t !== void 0 && "str" in t;
38488
39543
  var isWord2 = (t, w) => t !== void 0 && "word" in t && (w === void 0 || t.word.toLowerCase() === w);
38489
39544
  var tokDisplay = (t) => "word" in t ? t.word : `"${t.str}"`;
38490
- var normalizeQuotes4 = (s) => s.replace(/[“”「」『』]/g, '"').replace(/[‘’]/g, "'");
38491
- function tokenize8(line2) {
39545
+ var normalizeQuotes5 = (s) => s.replace(/[“”「」『』]/g, '"').replace(/[‘’]/g, "'");
39546
+ function tokenize9(line2) {
38492
39547
  const out = [];
38493
39548
  const re = /"([^"]*)"|(\S+)/g;
38494
39549
  let m;
@@ -38498,7 +39553,7 @@ function tokenize8(line2) {
38498
39553
  }
38499
39554
  return out;
38500
39555
  }
38501
- function parseNum2(t, what, ln) {
39556
+ function parseNum3(t, what, ln) {
38502
39557
  if (!isWord2(t)) throw new PlaybookParseError(`expected a number for ${what}`, ln);
38503
39558
  const v = Number(t.word);
38504
39559
  if (!Number.isFinite(v)) throw new PlaybookParseError(`expected a number for ${what}, got "${t.word}"`, ln);
@@ -38605,10 +39660,10 @@ function parseHeader4(tok, ast, ln) {
38605
39660
  function parseField(tok, ast, ln) {
38606
39661
  while (tok.length) {
38607
39662
  const t = tok.shift();
38608
- if (isWord2(t, "down")) ast.down = parseNum2(tok.shift(), "down", ln);
38609
- else if (isWord2(t, "distance") || isWord2(t, "togo")) ast.distance = parseNum2(tok.shift(), "distance", ln);
38610
- else if (isWord2(t, "los") || isWord2(t, "ball")) ast.losYard = parseNum2(tok.shift(), "los", ln);
38611
- else if (isWord2(t, "goal") || isWord2(t, "togoal")) ast.toGoal = parseNum2(tok.shift(), "goal", ln);
39663
+ if (isWord2(t, "down")) ast.down = parseNum3(tok.shift(), "down", ln);
39664
+ else if (isWord2(t, "distance") || isWord2(t, "togo")) ast.distance = parseNum3(tok.shift(), "distance", ln);
39665
+ else if (isWord2(t, "los") || isWord2(t, "ball")) ast.losYard = parseNum3(tok.shift(), "los", ln);
39666
+ else if (isWord2(t, "goal") || isWord2(t, "togoal")) ast.toGoal = parseNum3(tok.shift(), "goal", ln);
38612
39667
  else if (isWord2(t, "view")) {
38613
39668
  const v = parseId2(tok.shift(), "view (full|half)", ln).toLowerCase();
38614
39669
  if (v !== "full" && v !== "half" && v !== "auto") throw new PlaybookParseError(`view must be full|half`, ln);
@@ -38712,7 +39767,7 @@ function parseRouteRun(kind, tok, ast, ln) {
38712
39767
  const t = tok.shift();
38713
39768
  if (isWord2(t) && DIRS.includes(t.word.toLowerCase())) m.dir = t.word.toLowerCase();
38714
39769
  else if (isWord2(t) && Number.isFinite(Number(t.word))) m.depth = Number(t.word);
38715
- else if (isWord2(t, "depth")) m.depth = parseNum2(tok.shift(), "depth", ln);
39770
+ else if (isWord2(t, "depth")) m.depth = parseNum3(tok.shift(), "depth", ln);
38716
39771
  else throw new PlaybookParseError(`${kind}: unexpected token "${tokDisplay(t)}"`, ln);
38717
39772
  }
38718
39773
  ast.moves.push(m);
@@ -38817,9 +39872,9 @@ function parsePlaybook(text2) {
38817
39872
  const lines = text2.split(/\r?\n/);
38818
39873
  for (let i = 0; i < lines.length; i++) {
38819
39874
  const ln = i + 1;
38820
- const raw = normalizeQuotes4(lines[i]).trim();
39875
+ const raw = normalizeQuotes5(lines[i]).trim();
38821
39876
  if (!raw) continue;
38822
- const all = tokenize8(raw);
39877
+ const all = tokenize9(raw);
38823
39878
  const tok = [];
38824
39879
  for (const t of all) {
38825
39880
  if (isWord2(t) && (t.word.startsWith("#") || t.word.startsWith("//"))) break;
@@ -39665,12 +40720,12 @@ function resolveGeneric(m, src, byId, players, mod, sport, warnings) {
39665
40720
  let cur = { x: src.x, y: src.y };
39666
40721
  for (const p of m.points) {
39667
40722
  if (p.ref) {
39668
- const r6 = resolveRef(p.ref, byId, players, mod);
39669
- if (!r6) {
40723
+ const r7 = resolveRef(p.ref, byId, players, mod);
40724
+ if (!r7) {
39670
40725
  warnings.push(`${m.kind} ${m.player}: unknown destination "${p.ref}" \u2014 skipped`);
39671
40726
  return null;
39672
40727
  }
39673
- cur = r6;
40728
+ cur = r7;
39674
40729
  } else if (p.rel) {
39675
40730
  cur = { x: cur.x + (p.x ?? 0), y: cur.y + (p.y ?? 0) };
39676
40731
  } else {
@@ -39813,22 +40868,22 @@ function renderMove(mv, ctx) {
39813
40868
  return chunk3WNW5Y7P_cjs.group({ class: "sx-pb-move-g", "data-kind": mv.kind, "data-player": mv.player }, parts);
39814
40869
  }
39815
40870
  function playerSymbol(p, ctx) {
39816
- const cx = ctx.X(p.x), cy = ctx.Y(p.y), r6 = 10;
40871
+ const cx = ctx.X(p.x), cy = ctx.Y(p.y), r7 = 10;
39817
40872
  const parts = [];
39818
40873
  if (p.side === "defense" || p.pos === "x") {
39819
- const k = r6 * 0.78;
40874
+ const k = r7 * 0.78;
39820
40875
  parts.push(chunk3WNW5Y7P_cjs.line({ class: "sx-pb-x", x1: r28(cx - k), y1: r28(cy - k), x2: r28(cx + k), y2: r28(cy + k) }));
39821
40876
  parts.push(chunk3WNW5Y7P_cjs.line({ class: "sx-pb-x", x1: r28(cx - k), y1: r28(cy + k), x2: r28(cx + k), y2: r28(cy - k) }));
39822
40877
  if (p.label) parts.push(chunk3WNW5Y7P_cjs.text({ class: "sx-pb-x-text", x: r28(cx + k + 5), y: r28(cy - k + 2), "text-anchor": "middle" }, p.label));
39823
40878
  } else if (p.pos === "gk") {
39824
- const h = r6 * 1.15;
40879
+ const h = r7 * 1.15;
39825
40880
  parts.push(chunk3WNW5Y7P_cjs.polygon({ class: "sx-pb-gk", points: `${r28(cx)},${r28(cy - h)} ${r28(cx + h)},${r28(cy + h * 0.8)} ${r28(cx - h)},${r28(cy + h * 0.8)}` }));
39826
40881
  parts.push(chunk3WNW5Y7P_cjs.text({ class: "sx-pb-o-text", x: r28(cx), y: r28(cy + 6), "text-anchor": "middle" }, p.label));
39827
40882
  } else if (p.pos === "c") {
39828
- parts.push(chunk3WNW5Y7P_cjs.rect({ class: "sx-pb-o", x: r28(cx - r6 * 0.82), y: r28(cy - r6 * 0.82), width: r28(r6 * 1.64), height: r28(r6 * 1.64) }));
40883
+ parts.push(chunk3WNW5Y7P_cjs.rect({ class: "sx-pb-o", x: r28(cx - r7 * 0.82), y: r28(cy - r7 * 0.82), width: r28(r7 * 1.64), height: r28(r7 * 1.64) }));
39829
40884
  parts.push(chunk3WNW5Y7P_cjs.text({ class: "sx-pb-o-text", x: r28(cx), y: r28(cy + 3.6), "text-anchor": "middle" }, p.label));
39830
40885
  } else {
39831
- parts.push(chunk3WNW5Y7P_cjs.circle({ class: "sx-pb-o", cx: r28(cx), cy: r28(cy), r: r6 }));
40886
+ parts.push(chunk3WNW5Y7P_cjs.circle({ class: "sx-pb-o", cx: r28(cx), cy: r28(cy), r: r7 }));
39832
40887
  parts.push(chunk3WNW5Y7P_cjs.text({ class: "sx-pb-o-text", x: r28(cx), y: r28(cy + 3.6), "text-anchor": "middle" }, p.label));
39833
40888
  }
39834
40889
  return chunk3WNW5Y7P_cjs.group({ class: "sx-pb-player", "data-side": p.side, "data-id": p.id }, parts);
@@ -39905,7 +40960,7 @@ function renderPlaybookLayout(lay, config) {
39905
40960
  const surfaceBase = chunk3WNW5Y7P_cjs.rect({ class: surfaceCls, x: EDGE, y: r28(fieldTop), width: r28(fieldW), height: r28(fieldH), rx: fieldRx });
39906
40961
  const boundary = chunk3WNW5Y7P_cjs.rect({ class: boundaryCls, x: EDGE, y: r28(fieldTop), width: r28(fieldW), height: r28(fieldH), rx: fieldRx });
39907
40962
  const clipId = "sx-pb-clip";
39908
- const clip6 = chunk3WNW5Y7P_cjs.el("clipPath", { id: clipId }, [chunk3WNW5Y7P_cjs.rect({ x: EDGE, y: r28(fieldTop), width: r28(fieldW), height: r28(fieldH), rx: fieldRx })]);
40963
+ const clip7 = chunk3WNW5Y7P_cjs.el("clipPath", { id: clipId }, [chunk3WNW5Y7P_cjs.rect({ x: EDGE, y: r28(fieldTop), width: r28(fieldW), height: r28(fieldH), rx: fieldRx })]);
39909
40964
  const field = chunk3WNW5Y7P_cjs.group({ "clip-path": `url(#${clipId})` }, [mod.drawField(lay, ctx, t)]);
39910
40965
  const zones = [];
39911
40966
  for (const z of lay.zones) {
@@ -39933,7 +40988,7 @@ function renderPlaybookLayout(lay, config) {
39933
40988
  chunk3WNW5Y7P_cjs.desc(descText),
39934
40989
  chunk3WNW5Y7P_cjs.el("style", {}, buildCss14(t)),
39935
40990
  chunk3WNW5Y7P_cjs.rect({ fill: t.bg, x: 0, y: 0, width: W2, height: H2 }),
39936
- chunk3WNW5Y7P_cjs.el("defs", {}, [clip6]),
40991
+ chunk3WNW5Y7P_cjs.el("defs", {}, [clip7]),
39937
40992
  chunk3WNW5Y7P_cjs.text({ class: "sx-pb-title", x: r28(W2 / 2), y: chunkENUM7GMZ_cjs.TITLE.y, "text-anchor": "middle" }, lay.title),
39938
40993
  ...annoParts,
39939
40994
  surround,
@@ -40007,7 +41062,7 @@ var plugins = [
40007
41062
  chunk4AC6I7KJ_cjs.circuit,
40008
41063
  chunkC4Y24X3U_cjs.blockdiagram,
40009
41064
  chunkINVLJYAE_cjs.ladder,
40010
- chunkWJXLF42K_cjs.sld,
41065
+ chunkN3HU635X_cjs.sld,
40011
41066
  chunkGAQ36VFD_cjs.entity,
40012
41067
  chunk627GHE2N_cjs.fishbone,
40013
41068
  chunkITI3STJ6_cjs.venn,
@@ -40035,6 +41090,7 @@ var plugins = [
40035
41090
  bowtie2,
40036
41091
  eventtree,
40037
41092
  fmea,
41093
+ rbd,
40038
41094
  causalloop,
40039
41095
  markov,
40040
41096
  gitgraph,
@@ -40054,7 +41110,7 @@ function detectPlugin(text2, config) {
40054
41110
  if (plugin.detect(text2)) return plugin;
40055
41111
  }
40056
41112
  throw new Error(
40057
- "Cannot detect diagram type. Start your text with 'genogram', 'ecomap', 'pedigree', 'phylo', 'sociogram', 'timing', 'logic', 'circuit', 'blockdiagram', 'ladder', 'sld', 'entity-structure', 'fishbone', 'venn', 'flowchart', 'mindmap', 'matrix', 'orgchart', 'state', 'pid', 'erd', 'breadboard', 'bpmn', 'fbd', 'sfc', 'prisma', 'usecase', 'pert', 'sequence', 'petri', 'network', 'umlclass', 'faulttree', 'bowtie', 'floorplan', or 'playbook'."
41113
+ "Cannot detect diagram type. Start your text with 'genogram', 'ecomap', 'pedigree', 'phylo', 'sociogram', 'timing', 'logic', 'circuit', 'blockdiagram', 'ladder', 'sld', 'entity-structure', 'fishbone', 'venn', 'flowchart', 'mindmap', 'matrix', 'orgchart', 'state', 'pid', 'erd', 'breadboard', 'bpmn', 'fbd', 'sfc', 'prisma', 'usecase', 'pert', 'sequence', 'petri', 'network', 'umlclass', 'faulttree', 'bowtie', 'rbd', 'floorplan', or 'playbook'."
40058
41114
  );
40059
41115
  }
40060
41116
  function stripCodeFences(text2) {
@@ -40212,6 +41268,7 @@ exports.pert = pert;
40212
41268
  exports.petri = petri;
40213
41269
  exports.pid = pid;
40214
41270
  exports.prisma = prisma;
41271
+ exports.rbd = rbd;
40215
41272
  exports.render = render;
40216
41273
  exports.renderEquip = renderEquip;
40217
41274
  exports.renderPreview = renderPreview;
@@ -40223,5 +41280,5 @@ exports.timeline = timeline;
40223
41280
  exports.umlclass = umlclass;
40224
41281
  exports.usecase = usecase;
40225
41282
  exports.welding = welding;
40226
- //# sourceMappingURL=chunk-GTCAJPQR.cjs.map
40227
- //# sourceMappingURL=chunk-GTCAJPQR.cjs.map
41283
+ //# sourceMappingURL=chunk-KH5GRKUM.cjs.map
41284
+ //# sourceMappingURL=chunk-KH5GRKUM.cjs.map