@zukhruf/diagram 0.3.30 → 0.3.31

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 (92) hide show
  1. package/dist/lib/layouts/graph/areas.d.ts +27 -0
  2. package/dist/lib/layouts/graph/areas.d.ts.map +1 -0
  3. package/dist/lib/layouts/graph/areas.js +187 -0
  4. package/dist/lib/layouts/graph/areas.js.map +1 -0
  5. package/dist/lib/layouts/graph/graph-layout-result.d.ts +95 -0
  6. package/dist/lib/layouts/graph/graph-layout-result.d.ts.map +1 -0
  7. package/dist/lib/layouts/graph/graph-layout-result.js +2 -0
  8. package/dist/lib/layouts/graph/graph-layout-result.js.map +1 -0
  9. package/dist/lib/layouts/graph/graph-layout.d.ts +2 -1
  10. package/dist/lib/layouts/graph/graph-layout.d.ts.map +1 -1
  11. package/dist/lib/layouts/graph/graph-layout.js +5 -3
  12. package/dist/lib/layouts/graph/graph-layout.js.map +1 -1
  13. package/dist/lib/layouts/graph/gutters.d.ts +26 -0
  14. package/dist/lib/layouts/graph/gutters.d.ts.map +1 -0
  15. package/dist/lib/layouts/graph/gutters.js +123 -0
  16. package/dist/lib/layouts/graph/gutters.js.map +1 -0
  17. package/dist/lib/layouts/graph/layout.d.ts +10 -0
  18. package/dist/lib/layouts/graph/layout.d.ts.map +1 -0
  19. package/dist/lib/layouts/graph/layout.js +165 -0
  20. package/dist/lib/layouts/graph/layout.js.map +1 -0
  21. package/dist/lib/layouts/graph/legacy-graph-layout.d.ts +6 -0
  22. package/dist/lib/layouts/graph/legacy-graph-layout.d.ts.map +1 -0
  23. package/dist/lib/layouts/graph/legacy-graph-layout.js +542 -0
  24. package/dist/lib/layouts/graph/legacy-graph-layout.js.map +1 -0
  25. package/dist/lib/layouts/graph/measure.d.ts +44 -0
  26. package/dist/lib/layouts/graph/measure.d.ts.map +1 -0
  27. package/dist/lib/layouts/graph/measure.js +372 -0
  28. package/dist/lib/layouts/graph/measure.js.map +1 -0
  29. package/dist/lib/layouts/graph/node-content.d.ts +16 -0
  30. package/dist/lib/layouts/graph/node-content.d.ts.map +1 -0
  31. package/dist/lib/layouts/graph/node-content.js +323 -0
  32. package/dist/lib/layouts/graph/node-content.js.map +1 -0
  33. package/dist/lib/layouts/graph/text-block.d.ts +19 -0
  34. package/dist/lib/layouts/graph/text-block.d.ts.map +1 -0
  35. package/dist/lib/layouts/graph/text-block.js +86 -0
  36. package/dist/lib/layouts/graph/text-block.js.map +1 -0
  37. package/dist/lib/layouts/graph/tokens.d.ts +58 -0
  38. package/dist/lib/layouts/graph/tokens.d.ts.map +1 -0
  39. package/dist/lib/layouts/graph/tokens.js +108 -0
  40. package/dist/lib/layouts/graph/tokens.js.map +1 -0
  41. package/dist/lib/layouts/graph/tracks.d.ts +20 -0
  42. package/dist/lib/layouts/graph/tracks.d.ts.map +1 -0
  43. package/dist/lib/layouts/graph/tracks.js +47 -0
  44. package/dist/lib/layouts/graph/tracks.js.map +1 -0
  45. package/dist/lib/layouts/text/font-metrics.generated.d.ts +18 -0
  46. package/dist/lib/layouts/text/font-metrics.generated.d.ts.map +1 -0
  47. package/dist/lib/layouts/text/font-metrics.generated.js +1043 -0
  48. package/dist/lib/layouts/text/font-metrics.generated.js.map +1 -0
  49. package/dist/lib/layouts/text/font.d.ts +14 -0
  50. package/dist/lib/layouts/text/font.d.ts.map +1 -0
  51. package/dist/lib/layouts/text/font.js +11 -0
  52. package/dist/lib/layouts/text/font.js.map +1 -0
  53. package/dist/lib/layouts/text/measure-text.d.ts +13 -0
  54. package/dist/lib/layouts/text/measure-text.d.ts.map +1 -0
  55. package/dist/lib/layouts/text/measure-text.js +67 -0
  56. package/dist/lib/layouts/text/measure-text.js.map +1 -0
  57. package/dist/lib/model/diagram-ir.d.ts +14 -1
  58. package/dist/lib/model/diagram-ir.d.ts.map +1 -1
  59. package/dist/lib/model/diagram-ir.js.map +1 -1
  60. package/dist/lib/renderers/canvas/graph-canvas.d.ts.map +1 -1
  61. package/dist/lib/renderers/canvas/graph-canvas.js +148 -138
  62. package/dist/lib/renderers/canvas/graph-canvas.js.map +1 -1
  63. package/dist/lib/renderers/html/graph-html.d.ts.map +1 -1
  64. package/dist/lib/renderers/html/graph-html.js +462 -511
  65. package/dist/lib/renderers/html/graph-html.js.map +1 -1
  66. package/dist/lib/renderers/shared/graph-parts.d.ts +15 -13
  67. package/dist/lib/renderers/shared/graph-parts.d.ts.map +1 -1
  68. package/dist/lib/renderers/shared/graph-parts.js +649 -644
  69. package/dist/lib/renderers/shared/graph-parts.js.map +1 -1
  70. package/dist/lib/renderers/shared/node-parts.d.ts +20 -19
  71. package/dist/lib/renderers/shared/node-parts.d.ts.map +1 -1
  72. package/dist/lib/renderers/shared/node-parts.js +678 -811
  73. package/dist/lib/renderers/shared/node-parts.js.map +1 -1
  74. package/dist/lib/renderers/shared/run-spans.d.ts +8 -0
  75. package/dist/lib/renderers/shared/run-spans.d.ts.map +1 -0
  76. package/dist/lib/renderers/shared/run-spans.js +18 -0
  77. package/dist/lib/renderers/shared/run-spans.js.map +1 -0
  78. package/dist/lib/renderers/shared/text-runs.d.ts +21 -0
  79. package/dist/lib/renderers/shared/text-runs.d.ts.map +1 -0
  80. package/dist/lib/renderers/shared/text-runs.js +44 -0
  81. package/dist/lib/renderers/shared/text-runs.js.map +1 -0
  82. package/dist/lib/renderers/svg/graph-svg.d.ts.map +1 -1
  83. package/dist/lib/renderers/svg/graph-svg.js +304 -465
  84. package/dist/lib/renderers/svg/graph-svg.js.map +1 -1
  85. package/dist/lib/renderers/svg/timeline-svg.d.ts.map +1 -1
  86. package/dist/lib/renderers/svg/timeline-svg.js +10 -5
  87. package/dist/lib/renderers/svg/timeline-svg.js.map +1 -1
  88. package/dist/lib/renderers/webgpu/graph-flow-effects.d.ts +2 -2
  89. package/dist/lib/renderers/webgpu/graph-flow-effects.d.ts.map +1 -1
  90. package/dist/lib/renderers/webgpu/graph-flow-effects.js.map +1 -1
  91. package/package.json +3 -1
  92. package/styles.css +8 -0
@@ -1,18 +1,45 @@
1
1
  import { c as _c } from "react/compiler-runtime";
2
2
  import { motion, useTransform } from 'motion/react';
3
- import { nodeCaptionBounds, nodeCaptionPlacement, nodePortPlacements, nodeStackCount, nodeStackFrameBox } from "../../layouts/graph/graph-layout.js";
4
- import { DIAGRAM_BG, DIAGRAM_DIM, DIAGRAM_NEUTRAL, DIAGRAM_TEXT, resolveDiagramToneFill, resolveDiagramToneStroke, useDiagramTheme } from "../../react/chrome/index.js";
5
- import { DiagramNodeIcon, PortMarkers, labelLineFill, nodeTextFill, textureFill } from "./graph-parts.js";
3
+ import { ANNOTATION_NOTE_PREFIX } from "../../layouts/graph/legacy-graph-layout.js";
4
+ import { FONT_FAMILY } from "../../layouts/text/font.js";
5
+ import { DIAGRAM_BG, DIAGRAM_DIM, DIAGRAM_NEUTRAL, DIAGRAM_TEXT, resolveDiagramToneFill, useDiagramTheme } from "../../react/chrome/index.js";
6
+ import { DiagramNodeIcon, PortMarkers, accentToneStroke, nodeTextFill, textureFill } from "./graph-parts.js";
7
+ import { RunSpans } from "./run-spans.js";
6
8
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
7
9
  export const ANNOTATION_REVEAL_START = 0.85;
8
10
  export function isSpecialNode(node) {
9
11
  return node.kind !== undefined && node.kind !== 'node';
10
12
  }
13
+ function isNote(layout) {
14
+ return layout.node.kind === 'note';
15
+ }
16
+
17
+ /** Splits the graph's own nodes from the notes that stand for annotations. */
18
+ export function splitNotes(nodes) {
19
+ return {
20
+ graphNodes: nodes.filter(layout => !isNote(layout)),
21
+ notes: nodes.filter(isNote)
22
+ };
23
+ }
24
+ function textAttrs(first) {
25
+ return {
26
+ x: first.x,
27
+ y: first.y,
28
+ textAnchor: first.anchor,
29
+ fontFamily: FONT_FAMILY[first.font.face],
30
+ fontSize: first.font.size,
31
+ fontWeight: first.font.weight
32
+ };
33
+ }
34
+ function junctionFillColor(node, themeAccent) {
35
+ if (node.accent) return themeAccent;
36
+ if (node.tone) return resolveDiagramToneFill(node.tone);
37
+ return DIAGRAM_BG;
38
+ }
11
39
  export function SpecialNode(t0) {
12
- const $ = _c(190);
40
+ const $ = _c(177);
13
41
  const {
14
- node,
15
- box,
42
+ layout,
16
43
  progress,
17
44
  start,
18
45
  end
@@ -67,131 +94,110 @@ export function SpecialNode(t0) {
67
94
  t6 = $[9];
68
95
  }
69
96
  const translateY = useTransform(progress, t4, t5, t6);
70
- let centerY;
71
- let cx;
97
+ const {
98
+ node,
99
+ box,
100
+ radius,
101
+ icon,
102
+ text,
103
+ appliance
104
+ } = layout;
72
105
  let fill;
73
- let lineHeight;
74
- let lines;
106
+ let first;
75
107
  let t7;
76
- if ($[10] !== box || $[11] !== ids || $[12] !== node || $[13] !== opacity || $[14] !== themeAccent || $[15] !== translateY) {
108
+ if ($[10] !== appliance || $[11] !== box || $[12] !== icon || $[13] !== ids || $[14] !== layout || $[15] !== node || $[16] !== opacity || $[17] !== radius || $[18] !== text || $[19] !== themeAccent || $[20] !== translateY) {
77
109
  t7 = Symbol.for("react.early_return_sentinel");
78
110
  bb0: {
79
111
  fill = nodeTextFill(node, node.frame ?? "solid", themeAccent);
80
- lines = Array.isArray(node.label) ? node.label : [node.label];
81
- const fontSize = node.fontSize ?? 12;
82
- lineHeight = Math.max(12, fontSize + 2);
83
- centerY = box.y + box.h / 2;
84
- cx = box.x + box.w / 2;
85
- if (node.kind === "appliance") {
112
+ [first] = text;
113
+ if (node.kind === "appliance" && appliance) {
86
114
  let t8;
87
- if ($[22] !== node.accent || $[23] !== node.tone || $[24] !== themeAccent) {
88
- t8 = node.accent ? themeAccent : node.tone ? resolveDiagramToneStroke(node.tone) : DIAGRAM_NEUTRAL;
89
- $[22] = node.accent;
90
- $[23] = node.tone;
91
- $[24] = themeAccent;
92
- $[25] = t8;
115
+ if ($[24] !== node || $[25] !== themeAccent) {
116
+ t8 = accentToneStroke(node, themeAccent, DIAGRAM_NEUTRAL);
117
+ $[24] = node;
118
+ $[25] = themeAccent;
119
+ $[26] = t8;
93
120
  } else {
94
- t8 = $[25];
121
+ t8 = $[26];
95
122
  }
96
123
  const applianceStroke = t8;
97
124
  let t9;
98
- if ($[26] !== node.tone) {
125
+ if ($[27] !== node.tone) {
99
126
  t9 = node.tone ? resolveDiagramToneFill(node.tone) : DIAGRAM_BG;
100
- $[26] = node.tone;
101
- $[27] = t9;
127
+ $[27] = node.tone;
128
+ $[28] = t9;
102
129
  } else {
103
- t9 = $[27];
130
+ t9 = $[28];
104
131
  }
105
132
  const applianceFill = t9;
106
133
  const t10 = node.texture ?? "none";
107
134
  let t11;
108
- if ($[28] !== ids || $[29] !== t10) {
135
+ if ($[29] !== ids || $[30] !== t10) {
109
136
  t11 = textureFill(t10, ids);
110
- $[28] = ids;
111
- $[29] = t10;
112
- $[30] = t11;
137
+ $[29] = ids;
138
+ $[30] = t10;
139
+ $[31] = t11;
113
140
  } else {
114
- t11 = $[30];
141
+ t11 = $[31];
115
142
  }
116
143
  const applianceTexture = t11;
117
- const bodyX = box.x + 4;
118
- const bodyY = box.y + Math.max(12, Math.min(22, box.h * 0.28));
119
- const bodyW = Math.max(36, box.w - 8);
120
- const bodyH = Math.max(24, box.h - (bodyY - box.y) - 12);
121
- const slant = Math.max(4, Math.min(node.slant ?? 16, bodyW * 0.28, bodyH * 0.75));
122
- const t12 = `M ${bodyX + slant} ${bodyY}`;
123
- const t13 = `L ${bodyX + bodyW} ${bodyY + 6}`;
124
- const t14 = `L ${bodyX + bodyW - slant} ${bodyY + bodyH}`;
125
- const t15 = `L ${bodyX} ${bodyY + bodyH - 6}`;
126
- let t16;
127
- if ($[31] !== t12 || $[32] !== t13 || $[33] !== t14 || $[34] !== t15) {
128
- t16 = [t12, t13, t14, t15, "Z"];
129
- $[31] = t12;
130
- $[32] = t13;
131
- $[33] = t14;
132
- $[34] = t15;
133
- $[35] = t16;
144
+ let t12;
145
+ if ($[32] !== appliance.body) {
146
+ t12 = [...appliance.body.map(_temp), "Z"];
147
+ $[32] = appliance.body;
148
+ $[33] = t12;
134
149
  } else {
135
- t16 = $[35];
150
+ t12 = $[33];
136
151
  }
137
- const bodyPath = t16.join(" ");
138
- const showAntenna = node.antenna ?? true;
139
- const visualPortCount = Math.max(0, Math.floor(node.appliancePorts ?? 4));
140
- const portY = bodyY + bodyH - 15;
141
- const portStartX = bodyX + slant + 16;
142
- const portSpacing = Math.min(13, Math.max(8, (bodyW - slant - 42) / Math.max(visualPortCount, 1)));
143
- const labelLines = lines.filter(_temp);
144
- const labelY = bodyY + bodyH + Math.max(12, fontSize + 2);
145
- const t17 = node.id;
146
- let t18;
147
- if ($[36] !== opacity || $[37] !== translateY) {
148
- t18 = {
152
+ const bodyPath = t12.join(" ");
153
+ const [faceFrom, faceTo] = appliance.face;
154
+ const [rod, mast] = appliance.antenna;
155
+ const t13 = node.id;
156
+ let t14;
157
+ if ($[34] !== opacity || $[35] !== translateY) {
158
+ t14 = {
149
159
  opacity,
150
160
  y: translateY
151
161
  };
152
- $[36] = opacity;
153
- $[37] = translateY;
154
- $[38] = t18;
162
+ $[34] = opacity;
163
+ $[35] = translateY;
164
+ $[36] = t14;
155
165
  } else {
156
- t18 = $[38];
166
+ t14 = $[36];
157
167
  }
158
- let t19;
159
- if ($[39] !== applianceStroke || $[40] !== bodyW || $[41] !== bodyX || $[42] !== bodyY || $[43] !== box.y || $[44] !== node.id || $[45] !== showAntenna || $[46] !== slant) {
160
- t19 = showAntenna && /*#__PURE__*/_jsxs("g", {
168
+ let t15;
169
+ if ($[37] !== applianceStroke || $[38] !== mast || $[39] !== node.id || $[40] !== rod) {
170
+ t15 = rod && mast && /*#__PURE__*/_jsxs("g", {
161
171
  "data-diagram-appliance-antenna": node.id,
162
172
  children: [/*#__PURE__*/_jsx("line", {
163
- x1: bodyX + slant + bodyW * 0.18,
164
- y1: bodyY + 1,
165
- x2: bodyX + slant + bodyW * 0.2 - 3,
166
- y2: box.y + 3,
173
+ x1: rod[0].x,
174
+ y1: rod[0].y,
175
+ x2: rod[1].x,
176
+ y2: rod[1].y,
167
177
  stroke: applianceStroke,
168
178
  strokeWidth: 1.5,
169
179
  strokeLinecap: "round"
170
180
  }), /*#__PURE__*/_jsx("line", {
171
- x1: bodyX + slant + bodyW * 0.2 + 1,
172
- y1: bodyY + 2,
173
- x2: bodyX + slant + bodyW * 0.2 + 1,
174
- y2: box.y + 8,
181
+ x1: mast[0].x,
182
+ y1: mast[0].y,
183
+ x2: mast[1].x,
184
+ y2: mast[1].y,
175
185
  stroke: applianceStroke,
176
186
  strokeWidth: 1,
177
187
  strokeLinecap: "round"
178
188
  })]
179
189
  });
180
- $[39] = applianceStroke;
181
- $[40] = bodyW;
182
- $[41] = bodyX;
183
- $[42] = bodyY;
184
- $[43] = box.y;
185
- $[44] = node.id;
186
- $[45] = showAntenna;
187
- $[46] = slant;
188
- $[47] = t19;
190
+ $[37] = applianceStroke;
191
+ $[38] = mast;
192
+ $[39] = node.id;
193
+ $[40] = rod;
194
+ $[41] = t15;
189
195
  } else {
190
- t19 = $[47];
196
+ t15 = $[41];
191
197
  }
192
- let t20;
193
- if ($[48] !== applianceFill || $[49] !== applianceStroke || $[50] !== bodyPath || $[51] !== node.id || $[52] !== node.tone) {
194
- t20 = /*#__PURE__*/_jsx("path", {
198
+ let t16;
199
+ if ($[42] !== applianceFill || $[43] !== applianceStroke || $[44] !== bodyPath || $[45] !== node.id || $[46] !== node.tone) {
200
+ t16 = /*#__PURE__*/_jsx("path", {
195
201
  "data-diagram-node": node.id,
196
202
  "data-diagram-node-tone": node.tone,
197
203
  "data-diagram-appliance-body": node.id,
@@ -201,216 +207,178 @@ export function SpecialNode(t0) {
201
207
  strokeWidth: 1.5,
202
208
  strokeLinejoin: "round"
203
209
  });
204
- $[48] = applianceFill;
205
- $[49] = applianceStroke;
206
- $[50] = bodyPath;
207
- $[51] = node.id;
208
- $[52] = node.tone;
209
- $[53] = t20;
210
+ $[42] = applianceFill;
211
+ $[43] = applianceStroke;
212
+ $[44] = bodyPath;
213
+ $[45] = node.id;
214
+ $[46] = node.tone;
215
+ $[47] = t16;
210
216
  } else {
211
- t20 = $[53];
217
+ t16 = $[47];
212
218
  }
213
- let t21;
214
- if ($[54] !== applianceTexture || $[55] !== bodyPath || $[56] !== node.id || $[57] !== node.texture) {
215
- t21 = applianceTexture && /*#__PURE__*/_jsx("path", {
219
+ let t17;
220
+ if ($[48] !== applianceTexture || $[49] !== bodyPath || $[50] !== node.id || $[51] !== node.texture) {
221
+ t17 = applianceTexture && /*#__PURE__*/_jsx("path", {
216
222
  "data-diagram-node-texture": `${node.id}:${node.texture ?? "none"}`,
217
223
  d: bodyPath,
218
224
  fill: applianceTexture,
219
225
  pointerEvents: "none"
220
226
  });
221
- $[54] = applianceTexture;
222
- $[55] = bodyPath;
223
- $[56] = node.id;
224
- $[57] = node.texture;
225
- $[58] = t21;
227
+ $[48] = applianceTexture;
228
+ $[49] = bodyPath;
229
+ $[50] = node.id;
230
+ $[51] = node.texture;
231
+ $[52] = t17;
226
232
  } else {
227
- t21 = $[58];
233
+ t17 = $[52];
228
234
  }
229
- const t22 = bodyX + slant;
230
- const t23 = bodyY + bodyH - 1;
231
- const t24 = bodyX + bodyW - slant;
232
- const t25 = bodyY + bodyH + 3;
233
- let t26;
234
- if ($[59] !== applianceStroke || $[60] !== node.id || $[61] !== t22 || $[62] !== t23 || $[63] !== t24 || $[64] !== t25) {
235
- t26 = /*#__PURE__*/_jsx("line", {
235
+ let t18;
236
+ if ($[53] !== applianceStroke || $[54] !== faceFrom.x || $[55] !== faceFrom.y || $[56] !== faceTo.x || $[57] !== faceTo.y || $[58] !== node.id) {
237
+ t18 = /*#__PURE__*/_jsx("line", {
236
238
  "data-diagram-appliance-face": node.id,
237
- x1: t22,
238
- y1: t23,
239
- x2: t24,
240
- y2: t25,
239
+ x1: faceFrom.x,
240
+ y1: faceFrom.y,
241
+ x2: faceTo.x,
242
+ y2: faceTo.y,
241
243
  stroke: applianceStroke,
242
244
  strokeWidth: 1,
243
245
  strokeLinecap: "round",
244
246
  opacity: 0.85
245
247
  });
246
- $[59] = applianceStroke;
247
- $[60] = node.id;
248
- $[61] = t22;
249
- $[62] = t23;
250
- $[63] = t24;
251
- $[64] = t25;
252
- $[65] = t26;
248
+ $[53] = applianceStroke;
249
+ $[54] = faceFrom.x;
250
+ $[55] = faceFrom.y;
251
+ $[56] = faceTo.x;
252
+ $[57] = faceTo.y;
253
+ $[58] = node.id;
254
+ $[59] = t18;
253
255
  } else {
254
- t26 = $[65];
256
+ t18 = $[59];
255
257
  }
256
- let t27;
257
- if ($[66] !== applianceStroke || $[67] !== node.id || $[68] !== portSpacing || $[69] !== portStartX || $[70] !== portY || $[71] !== visualPortCount) {
258
- let t28;
259
- if ($[73] !== applianceStroke || $[74] !== node.id || $[75] !== portSpacing || $[76] !== portStartX || $[77] !== portY) {
260
- t28 = (_, i) => /*#__PURE__*/_jsx("rect", {
261
- "data-diagram-appliance-port": `${node.id}:${i}`,
262
- x: portStartX + i * portSpacing,
263
- y: portY,
264
- width: 5,
265
- height: 12,
258
+ let t19;
259
+ if ($[60] !== appliance.jacks || $[61] !== applianceStroke || $[62] !== node.id) {
260
+ let t20;
261
+ if ($[64] !== applianceStroke || $[65] !== node.id) {
262
+ t20 = (jack, i_0) => /*#__PURE__*/_jsx("rect", {
263
+ "data-diagram-appliance-port": `${node.id}:${i_0}`,
264
+ x: jack.x,
265
+ y: jack.y,
266
+ width: jack.w,
267
+ height: jack.h,
266
268
  rx: 1,
267
269
  fill: DIAGRAM_BG,
268
270
  stroke: applianceStroke,
269
271
  strokeWidth: 1
270
- }, i);
271
- $[73] = applianceStroke;
272
- $[74] = node.id;
273
- $[75] = portSpacing;
274
- $[76] = portStartX;
275
- $[77] = portY;
276
- $[78] = t28;
272
+ }, i_0);
273
+ $[64] = applianceStroke;
274
+ $[65] = node.id;
275
+ $[66] = t20;
277
276
  } else {
278
- t28 = $[78];
277
+ t20 = $[66];
279
278
  }
280
- t27 = Array.from({
281
- length: visualPortCount
282
- }, t28);
283
- $[66] = applianceStroke;
284
- $[67] = node.id;
285
- $[68] = portSpacing;
286
- $[69] = portStartX;
287
- $[70] = portY;
288
- $[71] = visualPortCount;
289
- $[72] = t27;
279
+ t19 = appliance.jacks.map(t20);
280
+ $[60] = appliance.jacks;
281
+ $[61] = applianceStroke;
282
+ $[62] = node.id;
283
+ $[63] = t19;
290
284
  } else {
291
- t27 = $[72];
285
+ t19 = $[63];
292
286
  }
293
- const t28 = labelLines.length > 0 && /*#__PURE__*/_jsx("text", {
287
+ const t20 = first && /*#__PURE__*/_jsx("text", {
294
288
  "data-diagram-appliance-label": node.id,
295
- x: cx,
296
- y: labelY,
297
- textAnchor: "middle",
298
- fontFamily: "ui-sans-serif, system-ui, sans-serif",
299
- fontSize: fontSize,
300
- fontWeight: node.fontWeight ?? 600,
289
+ ...textAttrs(first),
301
290
  fill: fill,
302
- children: labelLines.map((line_0, i_0) => {
303
- const lineText = typeof line_0 === "string" ? line_0 : line_0.text;
304
- const lineFill = labelLineFill(line_0, fill, themeAccent);
305
- return /*#__PURE__*/_jsx("tspan", {
306
- x: cx,
307
- dy: i_0 === 0 ? 0 : lineHeight,
308
- fill: lineFill,
309
- fontWeight: typeof line_0 === "string" ? node.fontWeight ?? 600 : line_0.fontWeight ?? node.fontWeight ?? 600,
310
- children: lineText
311
- }, i_0);
291
+ children: /*#__PURE__*/_jsx(RunSpans, {
292
+ runs: text,
293
+ fill: fill,
294
+ accent: themeAccent
312
295
  })
313
296
  });
314
- let t29;
315
- let t30;
316
- if ($[79] !== box || $[80] !== node) {
317
- t29 = /*#__PURE__*/_jsx(NodePorts, {
318
- node: node,
319
- box: box
297
+ let t21;
298
+ let t22;
299
+ if ($[67] !== layout) {
300
+ t21 = /*#__PURE__*/_jsx(NodePorts, {
301
+ layout: layout
320
302
  });
321
- t30 = /*#__PURE__*/_jsx(NodeCaption, {
322
- node: node,
323
- box: box
303
+ t22 = /*#__PURE__*/_jsx(NodeCaption, {
304
+ layout: layout
324
305
  });
325
- $[79] = box;
326
- $[80] = node;
327
- $[81] = t29;
328
- $[82] = t30;
306
+ $[67] = layout;
307
+ $[68] = t21;
308
+ $[69] = t22;
329
309
  } else {
330
- t29 = $[81];
331
- t30 = $[82];
310
+ t21 = $[68];
311
+ t22 = $[69];
332
312
  }
333
- let t31;
334
- if ($[83] !== node.id || $[84] !== t18 || $[85] !== t19 || $[86] !== t20 || $[87] !== t21 || $[88] !== t26 || $[89] !== t27 || $[90] !== t28 || $[91] !== t29 || $[92] !== t30) {
335
- t31 = /*#__PURE__*/_jsxs(motion.g, {
336
- "data-diagram-appliance": t17,
337
- style: t18,
338
- children: [t19, t20, t21, t26, t27, t28, t29, t30]
313
+ let t23;
314
+ if ($[70] !== node.id || $[71] !== t14 || $[72] !== t15 || $[73] !== t16 || $[74] !== t17 || $[75] !== t18 || $[76] !== t19 || $[77] !== t20 || $[78] !== t21 || $[79] !== t22) {
315
+ t23 = /*#__PURE__*/_jsxs(motion.g, {
316
+ "data-diagram-appliance": t13,
317
+ style: t14,
318
+ children: [t15, t16, t17, t18, t19, t20, t21, t22]
339
319
  });
340
- $[83] = node.id;
341
- $[84] = t18;
342
- $[85] = t19;
343
- $[86] = t20;
344
- $[87] = t21;
345
- $[88] = t26;
346
- $[89] = t27;
347
- $[90] = t28;
348
- $[91] = t29;
349
- $[92] = t30;
350
- $[93] = t31;
320
+ $[70] = node.id;
321
+ $[71] = t14;
322
+ $[72] = t15;
323
+ $[73] = t16;
324
+ $[74] = t17;
325
+ $[75] = t18;
326
+ $[76] = t19;
327
+ $[77] = t20;
328
+ $[78] = t21;
329
+ $[79] = t22;
330
+ $[80] = t23;
351
331
  } else {
352
- t31 = $[93];
332
+ t23 = $[80];
353
333
  }
354
- t7 = t31;
334
+ t7 = t23;
355
335
  break bb0;
356
336
  }
357
337
  if (node.kind === "connector") {
358
338
  let t8;
359
- if ($[94] !== node.accent || $[95] !== node.tone || $[96] !== themeAccent) {
360
- t8 = node.accent ? themeAccent : node.tone ? resolveDiagramToneStroke(node.tone) : DIAGRAM_NEUTRAL;
361
- $[94] = node.accent;
362
- $[95] = node.tone;
363
- $[96] = themeAccent;
364
- $[97] = t8;
339
+ if ($[81] !== node || $[82] !== themeAccent) {
340
+ t8 = accentToneStroke(node, themeAccent, DIAGRAM_NEUTRAL);
341
+ $[81] = node;
342
+ $[82] = themeAccent;
343
+ $[83] = t8;
365
344
  } else {
366
- t8 = $[97];
345
+ t8 = $[83];
367
346
  }
368
347
  const connectorStroke = t8;
369
348
  let t9;
370
- if ($[98] !== node.tone) {
349
+ if ($[84] !== node.tone) {
371
350
  t9 = node.tone ? resolveDiagramToneFill(node.tone) : DIAGRAM_BG;
372
- $[98] = node.tone;
373
- $[99] = t9;
351
+ $[84] = node.tone;
352
+ $[85] = t9;
374
353
  } else {
375
- t9 = $[99];
354
+ t9 = $[85];
376
355
  }
377
356
  const connectorFill = t9;
378
357
  const t10 = node.texture ?? (node.tone ? "dots" : "none");
379
358
  let t11;
380
- if ($[100] !== ids || $[101] !== t10) {
359
+ if ($[86] !== ids || $[87] !== t10) {
381
360
  t11 = textureFill(t10, ids);
382
- $[100] = ids;
383
- $[101] = t10;
384
- $[102] = t11;
361
+ $[86] = ids;
362
+ $[87] = t10;
363
+ $[88] = t11;
385
364
  } else {
386
- t11 = $[102];
365
+ t11 = $[88];
387
366
  }
388
367
  const connectorTexture = t11;
389
- const connectorRx = node.rx ?? Math.min(12, box.h / 2);
390
- const connectorIconSize = node.iconSize ?? 18;
391
- const connectorFontSize = node.fontSize ?? 10;
392
- const connectorLineHeight = Math.max(12, connectorFontSize + 2);
393
- const connectorLines = lines.filter(_temp2);
394
- const hasConnectorText = connectorLines.length > 0;
395
- const iconX = box.x + 10;
396
- const iconY = centerY - connectorIconSize / 2;
397
- const textX = node.icon ? iconX + connectorIconSize + 8 : box.x + box.w / 2;
398
- const textAnchor = node.icon ? "start" : "middle";
399
- const textY = centerY - (connectorLines.length - 1) * connectorLineHeight / 2 + connectorFontSize * 0.35;
400
368
  let t12;
401
- if ($[103] !== opacity || $[104] !== translateY) {
369
+ if ($[89] !== opacity || $[90] !== translateY) {
402
370
  t12 = {
403
371
  opacity,
404
372
  y: translateY
405
373
  };
406
- $[103] = opacity;
407
- $[104] = translateY;
408
- $[105] = t12;
374
+ $[89] = opacity;
375
+ $[90] = translateY;
376
+ $[91] = t12;
409
377
  } else {
410
- t12 = $[105];
378
+ t12 = $[91];
411
379
  }
412
380
  let t13;
413
- if ($[106] !== box.h || $[107] !== box.w || $[108] !== box.x || $[109] !== box.y || $[110] !== connectorFill || $[111] !== connectorRx || $[112] !== connectorStroke || $[113] !== node.id || $[114] !== node.tone) {
381
+ if ($[92] !== box.h || $[93] !== box.w || $[94] !== box.x || $[95] !== box.y || $[96] !== connectorFill || $[97] !== connectorStroke || $[98] !== node.id || $[99] !== node.tone || $[100] !== radius) {
414
382
  t13 = /*#__PURE__*/_jsx("rect", {
415
383
  "data-diagram-node": node.id,
416
384
  "data-diagram-connector": node.id,
@@ -419,584 +387,499 @@ export function SpecialNode(t0) {
419
387
  y: box.y,
420
388
  width: box.w,
421
389
  height: box.h,
422
- rx: connectorRx,
390
+ rx: radius,
423
391
  fill: connectorFill,
424
392
  stroke: connectorStroke,
425
393
  strokeWidth: 1.25
426
394
  });
427
- $[106] = box.h;
428
- $[107] = box.w;
429
- $[108] = box.x;
430
- $[109] = box.y;
431
- $[110] = connectorFill;
432
- $[111] = connectorRx;
433
- $[112] = connectorStroke;
434
- $[113] = node.id;
435
- $[114] = node.tone;
436
- $[115] = t13;
395
+ $[92] = box.h;
396
+ $[93] = box.w;
397
+ $[94] = box.x;
398
+ $[95] = box.y;
399
+ $[96] = connectorFill;
400
+ $[97] = connectorStroke;
401
+ $[98] = node.id;
402
+ $[99] = node.tone;
403
+ $[100] = radius;
404
+ $[101] = t13;
437
405
  } else {
438
- t13 = $[115];
406
+ t13 = $[101];
439
407
  }
440
408
  let t14;
441
- if ($[116] !== box.h || $[117] !== box.w || $[118] !== box.x || $[119] !== box.y || $[120] !== connectorRx || $[121] !== connectorTexture || $[122] !== node.id || $[123] !== node.texture) {
409
+ if ($[102] !== box.h || $[103] !== box.w || $[104] !== box.x || $[105] !== box.y || $[106] !== connectorTexture || $[107] !== node.id || $[108] !== node.texture || $[109] !== radius) {
442
410
  t14 = connectorTexture && /*#__PURE__*/_jsx("rect", {
443
411
  "data-diagram-node-texture": `${node.id}:${node.texture ?? "dots"}`,
444
412
  x: box.x,
445
413
  y: box.y,
446
414
  width: box.w,
447
415
  height: box.h,
448
- rx: connectorRx,
416
+ rx: radius,
449
417
  fill: connectorTexture,
450
418
  pointerEvents: "none"
451
419
  });
452
- $[116] = box.h;
453
- $[117] = box.w;
454
- $[118] = box.x;
455
- $[119] = box.y;
456
- $[120] = connectorRx;
457
- $[121] = connectorTexture;
458
- $[122] = node.id;
459
- $[123] = node.texture;
460
- $[124] = t14;
420
+ $[102] = box.h;
421
+ $[103] = box.w;
422
+ $[104] = box.x;
423
+ $[105] = box.y;
424
+ $[106] = connectorTexture;
425
+ $[107] = node.id;
426
+ $[108] = node.texture;
427
+ $[109] = radius;
428
+ $[110] = t14;
461
429
  } else {
462
- t14 = $[124];
430
+ t14 = $[110];
463
431
  }
464
- const t15 = node.icon && /*#__PURE__*/_jsx(DiagramNodeIcon, {
432
+ const t15 = node.icon && icon && /*#__PURE__*/_jsx(DiagramNodeIcon, {
465
433
  icon: node.icon,
466
- x: iconX,
467
- y: iconY,
468
- size: connectorIconSize,
434
+ x: icon.x,
435
+ y: icon.y,
436
+ size: icon.size,
469
437
  color: fill
470
438
  });
471
- const t16 = hasConnectorText && /*#__PURE__*/_jsx("text", {
439
+ const t16 = first && /*#__PURE__*/_jsx("text", {
472
440
  "data-diagram-connector-label": node.id,
473
- x: textX,
474
- y: textY,
475
- textAnchor: textAnchor,
476
- fontFamily: "ui-sans-serif, system-ui, sans-serif",
477
- fontSize: connectorFontSize,
478
- fontWeight: node.fontWeight ?? 700,
441
+ ...textAttrs(first),
479
442
  fill: fill,
480
- children: connectorLines.map((line_2, i_1) => {
481
- const lineText_0 = typeof line_2 === "string" ? line_2 : line_2.text;
482
- const lineFill_0 = labelLineFill(line_2, fill, themeAccent);
483
- return /*#__PURE__*/_jsx("tspan", {
484
- x: textX,
485
- dy: i_1 === 0 ? 0 : connectorLineHeight,
486
- fill: lineFill_0,
487
- fontWeight: typeof line_2 === "string" ? node.fontWeight ?? 700 : line_2.fontWeight ?? node.fontWeight ?? 700,
488
- children: lineText_0
489
- }, i_1);
443
+ children: /*#__PURE__*/_jsx(RunSpans, {
444
+ runs: text,
445
+ fill: fill,
446
+ accent: themeAccent
490
447
  })
491
448
  });
492
449
  let t17;
493
450
  let t18;
494
- if ($[125] !== box || $[126] !== node) {
451
+ if ($[111] !== layout) {
495
452
  t17 = /*#__PURE__*/_jsx(NodePorts, {
496
- node: node,
497
- box: box
453
+ layout: layout
498
454
  });
499
455
  t18 = /*#__PURE__*/_jsx(NodeCaption, {
500
- node: node,
501
- box: box
456
+ layout: layout
502
457
  });
503
- $[125] = box;
504
- $[126] = node;
505
- $[127] = t17;
506
- $[128] = t18;
458
+ $[111] = layout;
459
+ $[112] = t17;
460
+ $[113] = t18;
507
461
  } else {
508
- t17 = $[127];
509
- t18 = $[128];
462
+ t17 = $[112];
463
+ t18 = $[113];
510
464
  }
511
465
  let t19;
512
- if ($[129] !== t12 || $[130] !== t13 || $[131] !== t14 || $[132] !== t15 || $[133] !== t16 || $[134] !== t17 || $[135] !== t18) {
466
+ if ($[114] !== t12 || $[115] !== t13 || $[116] !== t14 || $[117] !== t15 || $[118] !== t16 || $[119] !== t17 || $[120] !== t18) {
513
467
  t19 = /*#__PURE__*/_jsxs(motion.g, {
514
468
  style: t12,
515
469
  children: [t13, t14, t15, t16, t17, t18]
516
470
  });
517
- $[129] = t12;
518
- $[130] = t13;
519
- $[131] = t14;
520
- $[132] = t15;
521
- $[133] = t16;
522
- $[134] = t17;
523
- $[135] = t18;
524
- $[136] = t19;
471
+ $[114] = t12;
472
+ $[115] = t13;
473
+ $[116] = t14;
474
+ $[117] = t15;
475
+ $[118] = t16;
476
+ $[119] = t17;
477
+ $[120] = t18;
478
+ $[121] = t19;
525
479
  } else {
526
- t19 = $[136];
480
+ t19 = $[121];
527
481
  }
528
482
  t7 = t19;
529
483
  break bb0;
530
484
  }
531
- if (node.kind === "marker") {
532
- const markerIconSize = node.iconSize ?? 34;
533
- const markerFontSize = node.fontSize ?? 11;
534
- const markerLineHeight = Math.max(12, markerFontSize + 2);
535
- const markerLines = lines.filter(_temp3);
536
- const labelGap = markerLines.length > 0 ? 8 : 0;
537
- const labelBlockHeight = markerLines.length * markerLineHeight;
538
- const totalHeight = markerIconSize + labelGap + labelBlockHeight;
485
+ if (node.kind === "marker" && icon) {
486
+ const markerStroke = accentToneStroke(node, themeAccent, fill);
539
487
  let t8;
540
- if ($[137] !== cx || $[138] !== markerIconSize) {
541
- t8 = Math.round(cx - markerIconSize / 2);
542
- $[137] = cx;
543
- $[138] = markerIconSize;
544
- $[139] = t8;
545
- } else {
546
- t8 = $[139];
547
- }
548
- const iconX_0 = t8;
549
- const iconY_0 = Math.round(box.y + (box.h - totalHeight) / 2);
550
- const markerLabelY = iconY_0 + markerIconSize + labelGap + markerFontSize;
551
- const markerStroke = node.accent ? themeAccent : node.tone ? resolveDiagramToneStroke(node.tone) : fill;
552
- let t9;
553
- if ($[140] !== opacity || $[141] !== translateY) {
554
- t9 = {
488
+ if ($[122] !== opacity || $[123] !== translateY) {
489
+ t8 = {
555
490
  opacity,
556
491
  y: translateY
557
492
  };
558
- $[140] = opacity;
559
- $[141] = translateY;
560
- $[142] = t9;
493
+ $[122] = opacity;
494
+ $[123] = translateY;
495
+ $[124] = t8;
561
496
  } else {
562
- t9 = $[142];
497
+ t8 = $[124];
563
498
  }
564
- const t10 = node.rx ?? 0;
565
- let t11;
566
- if ($[143] !== box.h || $[144] !== box.w || $[145] !== box.x || $[146] !== box.y || $[147] !== node.id || $[148] !== t10) {
567
- t11 = /*#__PURE__*/_jsx("rect", {
499
+ let t9;
500
+ if ($[125] !== box.h || $[126] !== box.w || $[127] !== box.x || $[128] !== box.y || $[129] !== node.id || $[130] !== radius) {
501
+ t9 = /*#__PURE__*/_jsx("rect", {
568
502
  "data-diagram-node": node.id,
569
503
  "data-diagram-marker-bounds": node.id,
570
504
  x: box.x,
571
505
  y: box.y,
572
506
  width: box.w,
573
507
  height: box.h,
574
- rx: t10,
508
+ rx: radius,
575
509
  fill: "transparent",
576
510
  stroke: "none"
577
511
  });
578
- $[143] = box.h;
579
- $[144] = box.w;
580
- $[145] = box.x;
581
- $[146] = box.y;
582
- $[147] = node.id;
583
- $[148] = t10;
584
- $[149] = t11;
512
+ $[125] = box.h;
513
+ $[126] = box.w;
514
+ $[127] = box.x;
515
+ $[128] = box.y;
516
+ $[129] = node.id;
517
+ $[130] = radius;
518
+ $[131] = t9;
585
519
  } else {
586
- t11 = $[149];
520
+ t9 = $[131];
587
521
  }
588
- let t12;
589
- let t13;
590
- if ($[150] !== box || $[151] !== node) {
591
- t12 = /*#__PURE__*/_jsx(NodePorts, {
592
- node: node,
593
- box: box
594
- });
595
- t13 = /*#__PURE__*/_jsx(NodeCaption, {
596
- node: node,
597
- box: box
522
+ const t10 = node.icon ?? "ellipsis";
523
+ let t11;
524
+ if ($[132] !== icon.size || $[133] !== icon.x || $[134] !== icon.y || $[135] !== markerStroke || $[136] !== t10) {
525
+ t11 = /*#__PURE__*/_jsx(DiagramNodeIcon, {
526
+ icon: t10,
527
+ x: icon.x,
528
+ y: icon.y,
529
+ size: icon.size,
530
+ color: markerStroke
598
531
  });
599
- $[150] = box;
600
- $[151] = node;
601
- $[152] = t12;
602
- $[153] = t13;
532
+ $[132] = icon.size;
533
+ $[133] = icon.x;
534
+ $[134] = icon.y;
535
+ $[135] = markerStroke;
536
+ $[136] = t10;
537
+ $[137] = t11;
603
538
  } else {
604
- t12 = $[152];
605
- t13 = $[153];
539
+ t11 = $[137];
606
540
  }
607
- t7 = /*#__PURE__*/_jsxs(motion.g, {
608
- "data-diagram-marker": node.id,
609
- style: t9,
610
- children: [t11, /*#__PURE__*/_jsx(DiagramNodeIcon, {
611
- icon: node.icon ?? "ellipsis",
612
- x: iconX_0,
613
- y: iconY_0,
614
- size: markerIconSize,
615
- color: markerStroke
616
- }), markerLines.length > 0 && /*#__PURE__*/_jsx("text", {
617
- "data-diagram-marker-label": node.id,
618
- x: cx,
619
- y: markerLabelY,
620
- textAnchor: "middle",
621
- fontFamily: "ui-sans-serif, system-ui, sans-serif",
622
- fontSize: markerFontSize,
623
- fontWeight: node.fontWeight ?? 700,
541
+ const t12 = first && /*#__PURE__*/_jsx("text", {
542
+ "data-diagram-marker-label": node.id,
543
+ ...textAttrs(first),
544
+ fill: fill,
545
+ children: /*#__PURE__*/_jsx(RunSpans, {
546
+ runs: text,
624
547
  fill: fill,
625
- children: markerLines.map((line_4, i_2) => {
626
- const lineText_1 = typeof line_4 === "string" ? line_4 : line_4.text;
627
- const lineFill_1 = labelLineFill(line_4, fill, themeAccent);
628
- return /*#__PURE__*/_jsx("tspan", {
629
- x: cx,
630
- dy: i_2 === 0 ? 0 : markerLineHeight,
631
- fill: lineFill_1,
632
- fontWeight: typeof line_4 === "string" ? node.fontWeight ?? 700 : line_4.fontWeight ?? node.fontWeight ?? 700,
633
- children: lineText_1
634
- }, i_2);
635
- })
636
- }), t12, t13]
548
+ accent: themeAccent
549
+ })
637
550
  });
551
+ let t13;
552
+ let t14;
553
+ if ($[138] !== layout) {
554
+ t13 = /*#__PURE__*/_jsx(NodePorts, {
555
+ layout: layout
556
+ });
557
+ t14 = /*#__PURE__*/_jsx(NodeCaption, {
558
+ layout: layout
559
+ });
560
+ $[138] = layout;
561
+ $[139] = t13;
562
+ $[140] = t14;
563
+ } else {
564
+ t13 = $[139];
565
+ t14 = $[140];
566
+ }
567
+ let t15;
568
+ if ($[141] !== node.id || $[142] !== t11 || $[143] !== t12 || $[144] !== t13 || $[145] !== t14 || $[146] !== t8 || $[147] !== t9) {
569
+ t15 = /*#__PURE__*/_jsxs(motion.g, {
570
+ "data-diagram-marker": node.id,
571
+ style: t8,
572
+ children: [t9, t11, t12, t13, t14]
573
+ });
574
+ $[141] = node.id;
575
+ $[142] = t11;
576
+ $[143] = t12;
577
+ $[144] = t13;
578
+ $[145] = t14;
579
+ $[146] = t8;
580
+ $[147] = t9;
581
+ $[148] = t15;
582
+ } else {
583
+ t15 = $[148];
584
+ }
585
+ t7 = t15;
638
586
  break bb0;
639
587
  }
640
588
  }
641
- $[10] = box;
642
- $[11] = ids;
643
- $[12] = node;
644
- $[13] = opacity;
645
- $[14] = themeAccent;
646
- $[15] = translateY;
647
- $[16] = centerY;
648
- $[17] = cx;
649
- $[18] = fill;
650
- $[19] = lineHeight;
651
- $[20] = lines;
652
- $[21] = t7;
589
+ $[10] = appliance;
590
+ $[11] = box;
591
+ $[12] = icon;
592
+ $[13] = ids;
593
+ $[14] = layout;
594
+ $[15] = node;
595
+ $[16] = opacity;
596
+ $[17] = radius;
597
+ $[18] = text;
598
+ $[19] = themeAccent;
599
+ $[20] = translateY;
600
+ $[21] = fill;
601
+ $[22] = first;
602
+ $[23] = t7;
653
603
  } else {
654
- centerY = $[16];
655
- cx = $[17];
656
- fill = $[18];
657
- lineHeight = $[19];
658
- lines = $[20];
659
- t7 = $[21];
604
+ fill = $[21];
605
+ first = $[22];
606
+ t7 = $[23];
660
607
  }
661
608
  if (t7 !== Symbol.for("react.early_return_sentinel")) {
662
609
  return t7;
663
610
  }
664
611
  if (node.kind === "junction") {
665
612
  let t8;
666
- if ($[154] !== node.accent || $[155] !== node.tone || $[156] !== themeAccent) {
667
- t8 = node.accent ? themeAccent : node.tone ? resolveDiagramToneStroke(node.tone) : DIAGRAM_NEUTRAL;
668
- $[154] = node.accent;
669
- $[155] = node.tone;
670
- $[156] = themeAccent;
671
- $[157] = t8;
613
+ if ($[149] !== node || $[150] !== themeAccent) {
614
+ t8 = accentToneStroke(node, themeAccent, DIAGRAM_NEUTRAL);
615
+ $[149] = node;
616
+ $[150] = themeAccent;
617
+ $[151] = t8;
672
618
  } else {
673
- t8 = $[157];
619
+ t8 = $[151];
674
620
  }
675
621
  const junctionStroke = t8;
676
622
  let t9;
677
- if ($[158] !== node.accent || $[159] !== node.tone || $[160] !== themeAccent) {
678
- t9 = node.accent ? themeAccent : node.tone ? resolveDiagramToneFill(node.tone) : DIAGRAM_BG;
679
- $[158] = node.accent;
680
- $[159] = node.tone;
681
- $[160] = themeAccent;
682
- $[161] = t9;
623
+ if ($[152] !== node || $[153] !== themeAccent) {
624
+ t9 = junctionFillColor(node, themeAccent);
625
+ $[152] = node;
626
+ $[153] = themeAccent;
627
+ $[154] = t9;
683
628
  } else {
684
- t9 = $[161];
629
+ t9 = $[154];
685
630
  }
686
631
  const junctionFill = t9;
687
632
  let t10;
688
- if ($[162] !== opacity || $[163] !== translateY) {
633
+ if ($[155] !== opacity || $[156] !== translateY) {
689
634
  t10 = {
690
635
  opacity,
691
636
  y: translateY
692
637
  };
693
- $[162] = opacity;
694
- $[163] = translateY;
695
- $[164] = t10;
638
+ $[155] = opacity;
639
+ $[156] = translateY;
640
+ $[157] = t10;
696
641
  } else {
697
- t10 = $[164];
642
+ t10 = $[157];
698
643
  }
699
- const t11 = node.id;
700
- const t12 = Math.max(4, Math.min(box.w, box.h) / 2);
644
+ const t11 = box.x + box.w / 2;
645
+ const t12 = box.y + box.h / 2;
701
646
  let t13;
702
- if ($[165] !== centerY || $[166] !== cx || $[167] !== junctionFill || $[168] !== junctionStroke || $[169] !== node.id || $[170] !== t12) {
647
+ if ($[158] !== junctionFill || $[159] !== junctionStroke || $[160] !== node.id || $[161] !== radius || $[162] !== t11 || $[163] !== t12) {
703
648
  t13 = /*#__PURE__*/_jsx("circle", {
704
- "data-diagram-junction": t11,
705
- cx: cx,
706
- cy: centerY,
707
- r: t12,
649
+ "data-diagram-junction": node.id,
650
+ cx: t11,
651
+ cy: t12,
652
+ r: radius,
708
653
  fill: junctionFill,
709
654
  stroke: junctionStroke,
710
655
  strokeWidth: 1.5
711
656
  });
712
- $[165] = centerY;
713
- $[166] = cx;
714
- $[167] = junctionFill;
715
- $[168] = junctionStroke;
716
- $[169] = node.id;
717
- $[170] = t12;
718
- $[171] = t13;
657
+ $[158] = junctionFill;
658
+ $[159] = junctionStroke;
659
+ $[160] = node.id;
660
+ $[161] = radius;
661
+ $[162] = t11;
662
+ $[163] = t12;
663
+ $[164] = t13;
719
664
  } else {
720
- t13 = $[171];
665
+ t13 = $[164];
721
666
  }
722
667
  let t14;
723
- if ($[172] !== box.h || $[173] !== centerY || $[174] !== cx || $[175] !== fill || $[176] !== lineHeight || $[177] !== lines || $[178] !== node.fontSize || $[179] !== node.fontWeight || $[180] !== node.id) {
724
- t14 = lines.some(Boolean) && /*#__PURE__*/_jsx("text", {
668
+ if ($[165] !== fill || $[166] !== first || $[167] !== node.id || $[168] !== text) {
669
+ t14 = first && /*#__PURE__*/_jsx("text", {
725
670
  "data-diagram-junction-label": node.id,
726
- x: cx,
727
- y: centerY - Math.max(8, box.h / 2 + 6),
728
- textAnchor: "middle",
729
- fontFamily: "ui-monospace, 'Geist Mono', monospace",
730
- fontSize: node.fontSize ?? 10,
731
- fontWeight: node.fontWeight ?? 600,
671
+ ...textAttrs(first),
732
672
  fill: fill,
733
- children: lines.map((line_5, i_3) => {
734
- const lineText_2 = typeof line_5 === "string" ? line_5 : line_5.text;
735
- return /*#__PURE__*/_jsx("tspan", {
736
- x: cx,
737
- dy: i_3 === 0 ? 0 : lineHeight,
738
- children: lineText_2
739
- }, i_3);
673
+ children: /*#__PURE__*/_jsx(RunSpans, {
674
+ runs: text
740
675
  })
741
676
  });
742
- $[172] = box.h;
743
- $[173] = centerY;
744
- $[174] = cx;
745
- $[175] = fill;
746
- $[176] = lineHeight;
747
- $[177] = lines;
748
- $[178] = node.fontSize;
749
- $[179] = node.fontWeight;
750
- $[180] = node.id;
751
- $[181] = t14;
677
+ $[165] = fill;
678
+ $[166] = first;
679
+ $[167] = node.id;
680
+ $[168] = text;
681
+ $[169] = t14;
752
682
  } else {
753
- t14 = $[181];
683
+ t14 = $[169];
754
684
  }
755
685
  let t15;
756
- if ($[182] !== box || $[183] !== node) {
686
+ if ($[170] !== layout) {
757
687
  t15 = /*#__PURE__*/_jsx(NodeCaption, {
758
- node: node,
759
- box: box
688
+ layout: layout
760
689
  });
761
- $[182] = box;
762
- $[183] = node;
763
- $[184] = t15;
690
+ $[170] = layout;
691
+ $[171] = t15;
764
692
  } else {
765
- t15 = $[184];
693
+ t15 = $[171];
766
694
  }
767
695
  let t16;
768
- if ($[185] !== t10 || $[186] !== t13 || $[187] !== t14 || $[188] !== t15) {
696
+ if ($[172] !== t10 || $[173] !== t13 || $[174] !== t14 || $[175] !== t15) {
769
697
  t16 = /*#__PURE__*/_jsxs(motion.g, {
770
698
  style: t10,
771
699
  children: [t13, t14, t15]
772
700
  });
773
- $[185] = t10;
774
- $[186] = t13;
775
- $[187] = t14;
776
- $[188] = t15;
777
- $[189] = t16;
701
+ $[172] = t10;
702
+ $[173] = t13;
703
+ $[174] = t14;
704
+ $[175] = t15;
705
+ $[176] = t16;
778
706
  } else {
779
- t16 = $[189];
707
+ t16 = $[176];
780
708
  }
781
709
  return t16;
782
710
  }
783
711
  return null;
784
712
  }
785
- function _temp3(line_3) {
786
- return typeof line_3 === "string" ? line_3.length > 0 : line_3.text.length > 0;
787
- }
788
- function _temp2(line_1) {
789
- return typeof line_1 === "string" ? line_1.length > 0 : line_1.text.length > 0;
790
- }
791
- function _temp(line) {
792
- return typeof line === "string" ? line.length > 0 : line.text.length > 0;
713
+ function _temp(point, i) {
714
+ return `${i === 0 ? "M" : "L"} ${point.x} ${point.y}`;
793
715
  }
794
716
  export function NodeStackFrames({
795
- node,
796
- box,
797
- rx,
717
+ layout,
798
718
  fill,
799
719
  stroke,
800
720
  strokeWidth
801
721
  }) {
802
- const stackCount = nodeStackCount(node);
803
- return Array.from({
804
- length: stackCount - 1
805
- }, (_, i) => {
806
- const level = stackCount - 1 - i;
807
- const stackBox = nodeStackFrameBox(node, box, level);
808
- return /*#__PURE__*/_jsx("rect", {
809
- "data-diagram-node-stack": `${node.id}:${level}`,
810
- x: stackBox.x,
811
- y: stackBox.y,
812
- width: stackBox.w,
813
- height: stackBox.h,
814
- rx: rx,
815
- fill: fill,
816
- stroke: stroke,
817
- strokeWidth: strokeWidth
818
- }, `stack-${level}`);
819
- });
722
+ const {
723
+ node,
724
+ frames,
725
+ radius
726
+ } = layout;
727
+ return frames.map((frame, i) => ({
728
+ frame,
729
+ level: i + 1
730
+ })).reverse().map(({
731
+ frame,
732
+ level
733
+ }) => /*#__PURE__*/_jsx("rect", {
734
+ "data-diagram-node-stack": `${node.id}:${level}`,
735
+ x: frame.x,
736
+ y: frame.y,
737
+ width: frame.w,
738
+ height: frame.h,
739
+ rx: radius,
740
+ fill: fill,
741
+ stroke: stroke,
742
+ strokeWidth: strokeWidth
743
+ }, `stack-${level}`));
820
744
  }
821
745
  export function NodePorts(t0) {
822
- const $ = _c(6);
746
+ const $ = _c(4);
823
747
  const {
824
- node,
825
- box
748
+ layout
826
749
  } = t0;
827
- const t1 = node.id;
828
- let t2;
829
- if ($[0] !== box || $[1] !== node) {
830
- t2 = nodePortPlacements(node, box);
831
- $[0] = box;
832
- $[1] = node;
833
- $[2] = t2;
834
- } else {
835
- t2 = $[2];
836
- }
837
- let t3;
838
- if ($[3] !== node.id || $[4] !== t2) {
839
- t3 = /*#__PURE__*/_jsx(PortMarkers, {
840
- ownerId: t1,
841
- placements: t2
750
+ let t1;
751
+ if ($[0] !== layout.node.id || $[1] !== layout.node.ports || $[2] !== layout.ports) {
752
+ t1 = /*#__PURE__*/_jsx(PortMarkers, {
753
+ ownerId: layout.node.id,
754
+ ports: layout.ports,
755
+ declared: layout.node.ports
842
756
  });
843
- $[3] = node.id;
844
- $[4] = t2;
845
- $[5] = t3;
757
+ $[0] = layout.node.id;
758
+ $[1] = layout.node.ports;
759
+ $[2] = layout.ports;
760
+ $[3] = t1;
846
761
  } else {
847
- t3 = $[5];
762
+ t1 = $[3];
848
763
  }
849
- return t3;
764
+ return t1;
765
+ }
766
+ function textColorFill(color, accent) {
767
+ if (color === 'accent') return accent;
768
+ if (color === 'dim') return DIAGRAM_DIM;
769
+ return DIAGRAM_TEXT;
850
770
  }
851
771
  export function NodeCaption(t0) {
852
- const $ = _c(34);
772
+ const $ = _c(21);
853
773
  const {
854
- node,
855
- box
774
+ layout
856
775
  } = t0;
857
776
  const {
858
777
  accent: themeAccent
859
778
  } = useDiagramTheme();
779
+ const {
780
+ node,
781
+ caption
782
+ } = layout;
860
783
  let t1;
861
- let t10;
862
- let t11;
784
+ if ($[0] !== caption?.text) {
785
+ t1 = caption?.text ?? [];
786
+ $[0] = caption?.text;
787
+ $[1] = t1;
788
+ } else {
789
+ t1 = $[1];
790
+ }
791
+ const [first] = t1;
792
+ if (!caption || !first) {
793
+ return null;
794
+ }
863
795
  let t2;
796
+ if ($[2] !== node.captionColor || $[3] !== themeAccent) {
797
+ t2 = textColorFill(node.captionColor, themeAccent);
798
+ $[2] = node.captionColor;
799
+ $[3] = themeAccent;
800
+ $[4] = t2;
801
+ } else {
802
+ t2 = $[4];
803
+ }
804
+ const fill = t2;
805
+ const frame = caption.framed ? caption.box : null;
864
806
  let t3;
865
- let t4;
807
+ if ($[5] !== fill || $[6] !== frame || $[7] !== node.id) {
808
+ t3 = frame && /*#__PURE__*/_jsx("rect", {
809
+ "data-diagram-node-caption-frame": node.id,
810
+ x: frame.x,
811
+ y: frame.y,
812
+ width: frame.w,
813
+ height: frame.h,
814
+ rx: frame.h / 2,
815
+ fill: DIAGRAM_BG,
816
+ stroke: fill,
817
+ strokeWidth: 1
818
+ });
819
+ $[5] = fill;
820
+ $[6] = frame;
821
+ $[7] = node.id;
822
+ $[8] = t3;
823
+ } else {
824
+ t3 = $[8];
825
+ }
826
+ const t4 = node.id;
866
827
  let t5;
867
- let t6;
868
- let t7;
869
- let t8;
870
- let t9;
871
- if ($[0] !== box || $[1] !== node || $[2] !== themeAccent) {
872
- t11 = Symbol.for("react.early_return_sentinel");
873
- bb0: {
874
- const placement = nodeCaptionPlacement(node, box);
875
- if (!placement) {
876
- t11 = null;
877
- break bb0;
878
- }
879
- const fill = node.captionColor === "accent" ? themeAccent : node.captionColor === "dim" ? DIAGRAM_DIM : DIAGRAM_TEXT;
880
- let t12;
881
- if ($[14] !== box || $[15] !== node) {
882
- t12 = node.captionFrame ? nodeCaptionBounds(node, box) : null;
883
- $[14] = box;
884
- $[15] = node;
885
- $[16] = t12;
886
- } else {
887
- t12 = $[16];
888
- }
889
- const frame = t12;
890
- if ($[17] !== fill || $[18] !== frame || $[19] !== node.id) {
891
- t10 = frame && /*#__PURE__*/_jsx("rect", {
892
- "data-diagram-node-caption-frame": node.id,
893
- x: frame.x,
894
- y: frame.y,
895
- width: frame.w,
896
- height: frame.h,
897
- rx: frame.h / 2,
898
- fill: DIAGRAM_BG,
899
- stroke: fill,
900
- strokeWidth: 1
901
- });
902
- $[17] = fill;
903
- $[18] = frame;
904
- $[19] = node.id;
905
- $[20] = t10;
906
- } else {
907
- t10 = $[20];
908
- }
909
- t1 = node.id;
910
- t2 = placement.x;
911
- t3 = placement.y;
912
- t4 = placement.align;
913
- t5 = "ui-sans-serif, system-ui, sans-serif";
914
- t6 = placement.fontSize;
915
- t7 = node.captionFontWeight ?? 600;
916
- t8 = fill;
917
- t9 = placement.lines.map((line, i) => /*#__PURE__*/_jsx("tspan", {
918
- x: placement.x,
919
- dy: i === 0 ? 0 : placement.lineHeight,
920
- children: line
921
- }, i));
922
- }
923
- $[0] = box;
924
- $[1] = node;
925
- $[2] = themeAccent;
926
- $[3] = t1;
927
- $[4] = t10;
928
- $[5] = t11;
929
- $[6] = t2;
930
- $[7] = t3;
931
- $[8] = t4;
932
- $[9] = t5;
933
- $[10] = t6;
934
- $[11] = t7;
935
- $[12] = t8;
936
- $[13] = t9;
828
+ if ($[9] !== first) {
829
+ t5 = textAttrs(first);
830
+ $[9] = first;
831
+ $[10] = t5;
937
832
  } else {
938
- t1 = $[3];
939
- t10 = $[4];
940
- t11 = $[5];
941
- t2 = $[6];
942
- t3 = $[7];
943
- t4 = $[8];
944
- t5 = $[9];
945
- t6 = $[10];
946
- t7 = $[11];
947
- t8 = $[12];
948
- t9 = $[13];
833
+ t5 = $[10];
949
834
  }
950
- if (t11 !== Symbol.for("react.early_return_sentinel")) {
951
- return t11;
835
+ let t6;
836
+ if ($[11] !== caption.text) {
837
+ t6 = /*#__PURE__*/_jsx(RunSpans, {
838
+ runs: caption.text
839
+ });
840
+ $[11] = caption.text;
841
+ $[12] = t6;
842
+ } else {
843
+ t6 = $[12];
952
844
  }
953
- let t12;
954
- if ($[21] !== t1 || $[22] !== t2 || $[23] !== t3 || $[24] !== t4 || $[25] !== t5 || $[26] !== t6 || $[27] !== t7 || $[28] !== t8 || $[29] !== t9) {
955
- t12 = /*#__PURE__*/_jsx("text", {
956
- "data-diagram-node-caption": t1,
957
- x: t2,
958
- y: t3,
959
- textAnchor: t4,
960
- fontFamily: t5,
961
- fontSize: t6,
962
- fontWeight: t7,
963
- fill: t8,
964
- children: t9
845
+ let t7;
846
+ if ($[13] !== fill || $[14] !== node.id || $[15] !== t5 || $[16] !== t6) {
847
+ t7 = /*#__PURE__*/_jsx("text", {
848
+ "data-diagram-node-caption": t4,
849
+ ...t5,
850
+ fill: fill,
851
+ children: t6
965
852
  });
966
- $[21] = t1;
967
- $[22] = t2;
968
- $[23] = t3;
969
- $[24] = t4;
970
- $[25] = t5;
971
- $[26] = t6;
972
- $[27] = t7;
973
- $[28] = t8;
974
- $[29] = t9;
975
- $[30] = t12;
853
+ $[13] = fill;
854
+ $[14] = node.id;
855
+ $[15] = t5;
856
+ $[16] = t6;
857
+ $[17] = t7;
976
858
  } else {
977
- t12 = $[30];
859
+ t7 = $[17];
978
860
  }
979
- let t13;
980
- if ($[31] !== t10 || $[32] !== t12) {
981
- t13 = /*#__PURE__*/_jsxs(_Fragment, {
982
- children: [t10, t12]
861
+ let t8;
862
+ if ($[18] !== t3 || $[19] !== t7) {
863
+ t8 = /*#__PURE__*/_jsxs(_Fragment, {
864
+ children: [t3, t7]
983
865
  });
984
- $[31] = t10;
985
- $[32] = t12;
986
- $[33] = t13;
866
+ $[18] = t3;
867
+ $[19] = t7;
868
+ $[20] = t8;
987
869
  } else {
988
- t13 = $[33];
870
+ t8 = $[20];
989
871
  }
990
- return t13;
872
+ return t8;
991
873
  }
992
874
  export function AnnotationText(t0) {
993
- const $ = _c(49);
875
+ const $ = _c(46);
994
876
  const {
995
- annotation,
877
+ note,
878
+ annotations,
879
+ leaders,
996
880
  progress,
997
881
  start,
998
- end,
999
- index
882
+ end
1000
883
  } = t0;
1001
884
  const {
1002
885
  accent: themeAccent
@@ -1024,183 +907,167 @@ export function AnnotationText(t0) {
1024
907
  t3 = $[4];
1025
908
  }
1026
909
  const opacity = useTransform(progress, t1, t2, t3);
1027
- const fill = annotation.color === "accent" ? themeAccent : annotation.color === "dim" ? DIAGRAM_DIM : DIAGRAM_TEXT;
1028
- const align = annotation.align ?? "middle";
1029
- const fontSize = annotation.fontSize ?? 11;
1030
- const fontWeight = annotation.fontWeight ?? 500;
1031
- const lineGap = annotation.lineGap ?? 4;
1032
910
  let t4;
1033
- if ($[5] !== annotation.targets) {
1034
- t4 = annotation.targets?.join("+");
1035
- $[5] = annotation.targets;
911
+ if ($[5] !== note.node.id) {
912
+ t4 = note.node.id.slice(ANNOTATION_NOTE_PREFIX.length);
913
+ $[5] = note.node.id;
1036
914
  $[6] = t4;
1037
915
  } else {
1038
916
  t4 = $[6];
1039
917
  }
1040
- const annotationTargets = t4;
1041
- const annotationId = annotation.target || annotationTargets ? `${annotation.target ?? annotationTargets}:${annotation.anchor ?? "top"}` : `free:${index}`;
918
+ const index = Number(t4);
919
+ const annotation = annotations[index];
920
+ if (!annotation) {
921
+ return null;
922
+ }
1042
923
  let t5;
1043
- if ($[7] !== annotation.anchor || $[8] !== annotation.leaderFrom || $[9] !== annotation.leaderTo || $[10] !== annotation.leaders || $[11] !== annotation.target) {
1044
- t5 = annotation.leaders ?? (annotation.leaderFrom && annotation.leaderTo ? [{
1045
- target: annotation.target,
1046
- anchor: annotation.anchor,
1047
- route: "straight",
1048
- from: annotation.leaderFrom,
1049
- to: annotation.leaderTo,
1050
- points: [annotation.leaderFrom, annotation.leaderTo]
1051
- }] : []);
1052
- $[7] = annotation.anchor;
1053
- $[8] = annotation.leaderFrom;
1054
- $[9] = annotation.leaderTo;
1055
- $[10] = annotation.leaders;
1056
- $[11] = annotation.target;
1057
- $[12] = t5;
924
+ if ($[7] !== annotation.color || $[8] !== themeAccent) {
925
+ t5 = textColorFill(annotation.color, themeAccent);
926
+ $[7] = annotation.color;
927
+ $[8] = themeAccent;
928
+ $[9] = t5;
1058
929
  } else {
1059
- t5 = $[12];
930
+ t5 = $[9];
1060
931
  }
1061
- const leaders = t5;
932
+ const fill = t5;
933
+ const anchor = annotation.anchor ?? "top";
934
+ const route = annotation.leaderRoute ?? "straight";
1062
935
  let t6;
1063
- if ($[13] !== opacity) {
1064
- t6 = {
1065
- opacity
1066
- };
1067
- $[13] = opacity;
1068
- $[14] = t6;
936
+ if ($[10] !== annotation.targets) {
937
+ t6 = annotation.targets?.join("+");
938
+ $[10] = annotation.targets;
939
+ $[11] = t6;
1069
940
  } else {
1070
- t6 = $[14];
941
+ t6 = $[11];
1071
942
  }
943
+ const annotationTargets = t6;
944
+ const annotationId = annotation.target || annotationTargets ? `${annotation.target ?? annotationTargets}:${anchor}` : `free:${index}`;
945
+ let T0;
946
+ let first;
1072
947
  let t7;
1073
- if ($[15] !== annotationId || $[16] !== leaders) {
1074
- let t8;
1075
- if ($[18] !== annotationId) {
1076
- t8 = (leader, leaderIndex) => leader.route === "elbow" && leader.points.length > 2 ? /*#__PURE__*/_jsx("path", {
1077
- "data-diagram-annotation-leader": annotationId,
1078
- "data-diagram-annotation-leader-target": leader.target,
1079
- "data-diagram-annotation-leader-anchor": leader.anchor,
1080
- "data-diagram-annotation-leader-index": leaderIndex,
1081
- "data-diagram-annotation-leader-route": leader.route,
1082
- d: annotationLeaderPath(leader.points),
1083
- fill: "none",
1084
- stroke: DIAGRAM_NEUTRAL,
1085
- strokeWidth: 1,
1086
- strokeLinecap: "round",
1087
- strokeLinejoin: "round"
1088
- }, `${leader.target ?? "free"}:${leaderIndex}`) : /*#__PURE__*/_jsx("line", {
1089
- "data-diagram-annotation-leader": annotationId,
1090
- "data-diagram-annotation-leader-target": leader.target,
1091
- "data-diagram-annotation-leader-anchor": leader.anchor,
1092
- "data-diagram-annotation-leader-index": leaderIndex,
1093
- "data-diagram-annotation-leader-route": leader.route,
1094
- x1: leader.from.x,
1095
- y1: leader.from.y,
1096
- x2: leader.to.x,
1097
- y2: leader.to.y,
1098
- stroke: DIAGRAM_NEUTRAL,
1099
- strokeWidth: 1,
1100
- strokeLinecap: "round"
1101
- }, `${leader.target ?? "free"}:${leaderIndex}`);
1102
- $[18] = annotationId;
1103
- $[19] = t8;
948
+ let t8;
949
+ if ($[12] !== anchor || $[13] !== annotationId || $[14] !== leaders || $[15] !== note.node.id || $[16] !== note.text || $[17] !== opacity || $[18] !== route) {
950
+ let t9;
951
+ if ($[23] !== note.node.id) {
952
+ t9 = leader => leader.note === note.node.id;
953
+ $[23] = note.node.id;
954
+ $[24] = t9;
1104
955
  } else {
1105
- t8 = $[19];
956
+ t9 = $[24];
1106
957
  }
1107
- t7 = leaders.map(t8);
1108
- $[15] = annotationId;
1109
- $[16] = leaders;
1110
- $[17] = t7;
1111
- } else {
1112
- t7 = $[17];
1113
- }
1114
- const t8 = annotation.target;
1115
- let t9;
1116
- if ($[20] !== annotation.targets) {
1117
- t9 = annotation.targets?.join(" ");
1118
- $[20] = annotation.targets;
1119
- $[21] = t9;
1120
- } else {
1121
- t9 = $[21];
1122
- }
1123
- const t10 = annotation.anchor;
1124
- const t11 = annotation.guide;
1125
- const t12 = annotation.lineGap;
1126
- const t13 = annotation.x;
1127
- const t14 = annotation.y;
1128
- let t15;
1129
- if ($[22] !== annotation.text || $[23] !== annotation.x || $[24] !== fontSize || $[25] !== lineGap) {
1130
- let t16;
1131
- if ($[27] !== annotation.x || $[28] !== fontSize || $[29] !== lineGap) {
1132
- t16 = (line, i) => /*#__PURE__*/_jsx("tspan", {
1133
- x: annotation.x,
1134
- dy: i === 0 ? 0 : fontSize + lineGap,
1135
- children: line
1136
- }, i);
1137
- $[27] = annotation.x;
1138
- $[28] = fontSize;
1139
- $[29] = lineGap;
1140
- $[30] = t16;
958
+ const noteLeaders = leaders.filter(t9);
959
+ [first] = note.text;
960
+ T0 = motion.g;
961
+ if ($[25] !== opacity) {
962
+ t7 = {
963
+ opacity
964
+ };
965
+ $[25] = opacity;
966
+ $[26] = t7;
967
+ } else {
968
+ t7 = $[26];
969
+ }
970
+ let t10;
971
+ if ($[27] !== anchor || $[28] !== annotationId || $[29] !== route) {
972
+ t10 = (leader_0, leaderIndex) => {
973
+ const attrs = {
974
+ "data-diagram-annotation-leader": annotationId,
975
+ "data-diagram-annotation-leader-target": leader_0.target,
976
+ "data-diagram-annotation-leader-anchor": anchor,
977
+ "data-diagram-annotation-leader-index": leaderIndex,
978
+ "data-diagram-annotation-leader-route": route
979
+ };
980
+ const from = leader_0.points.at(0);
981
+ const to = leader_0.points.at(-1);
982
+ if (leader_0.points.length > 2 || !from || !to) {
983
+ return /*#__PURE__*/_jsx("path", {
984
+ ...attrs,
985
+ d: leader_0.d,
986
+ fill: "none",
987
+ stroke: DIAGRAM_NEUTRAL,
988
+ strokeWidth: 1,
989
+ strokeLinecap: "round",
990
+ strokeLinejoin: "round"
991
+ }, `${leader_0.target}:${leaderIndex}`);
992
+ }
993
+ return /*#__PURE__*/_jsx("line", {
994
+ ...attrs,
995
+ x1: from.x,
996
+ y1: from.y,
997
+ x2: to.x,
998
+ y2: to.y,
999
+ stroke: DIAGRAM_NEUTRAL,
1000
+ strokeWidth: 1,
1001
+ strokeLinecap: "round"
1002
+ }, `${leader_0.target}:${leaderIndex}`);
1003
+ };
1004
+ $[27] = anchor;
1005
+ $[28] = annotationId;
1006
+ $[29] = route;
1007
+ $[30] = t10;
1141
1008
  } else {
1142
- t16 = $[30];
1009
+ t10 = $[30];
1143
1010
  }
1144
- t15 = annotation.text.map(t16);
1145
- $[22] = annotation.text;
1146
- $[23] = annotation.x;
1147
- $[24] = fontSize;
1148
- $[25] = lineGap;
1149
- $[26] = t15;
1011
+ t8 = noteLeaders.map(t10);
1012
+ $[12] = anchor;
1013
+ $[13] = annotationId;
1014
+ $[14] = leaders;
1015
+ $[15] = note.node.id;
1016
+ $[16] = note.text;
1017
+ $[17] = opacity;
1018
+ $[18] = route;
1019
+ $[19] = T0;
1020
+ $[20] = first;
1021
+ $[21] = t7;
1022
+ $[22] = t8;
1150
1023
  } else {
1151
- t15 = $[26];
1024
+ T0 = $[19];
1025
+ first = $[20];
1026
+ t7 = $[21];
1027
+ t8 = $[22];
1152
1028
  }
1153
- let t16;
1154
- if ($[31] !== align || $[32] !== annotation.anchor || $[33] !== annotation.guide || $[34] !== annotation.lineGap || $[35] !== annotation.target || $[36] !== annotation.x || $[37] !== annotation.y || $[38] !== annotationId || $[39] !== fill || $[40] !== fontSize || $[41] !== fontWeight || $[42] !== t15 || $[43] !== t9) {
1155
- t16 = /*#__PURE__*/_jsx("text", {
1029
+ let t9;
1030
+ if ($[31] !== annotation.anchor || $[32] !== annotation.guide || $[33] !== annotation.lineGap || $[34] !== annotation.target || $[35] !== annotation.targets || $[36] !== annotationId || $[37] !== fill || $[38] !== first || $[39] !== note.text) {
1031
+ t9 = first && /*#__PURE__*/_jsx("text", {
1156
1032
  "data-diagram-annotation": annotationId,
1157
- "data-diagram-annotation-target": t8,
1158
- "data-diagram-annotation-targets": t9,
1159
- "data-diagram-annotation-anchor": t10,
1160
- "data-diagram-annotation-guide": t11,
1161
- "data-diagram-annotation-line-gap": t12,
1162
- x: t13,
1163
- y: t14,
1164
- textAnchor: align,
1165
- fontFamily: "ui-sans-serif, system-ui, sans-serif",
1166
- fontSize: fontSize,
1167
- fontWeight: fontWeight,
1033
+ "data-diagram-annotation-target": annotation.target,
1034
+ "data-diagram-annotation-targets": annotation.targets?.join(" "),
1035
+ "data-diagram-annotation-anchor": annotation.anchor,
1036
+ "data-diagram-annotation-guide": annotation.guide,
1037
+ "data-diagram-annotation-line-gap": annotation.lineGap,
1038
+ ...textAttrs(first),
1168
1039
  fill: fill,
1169
- children: t15
1040
+ children: /*#__PURE__*/_jsx(RunSpans, {
1041
+ runs: note.text
1042
+ })
1170
1043
  });
1171
- $[31] = align;
1172
- $[32] = annotation.anchor;
1173
- $[33] = annotation.guide;
1174
- $[34] = annotation.lineGap;
1175
- $[35] = annotation.target;
1176
- $[36] = annotation.x;
1177
- $[37] = annotation.y;
1178
- $[38] = annotationId;
1179
- $[39] = fill;
1180
- $[40] = fontSize;
1181
- $[41] = fontWeight;
1182
- $[42] = t15;
1183
- $[43] = t9;
1184
- $[44] = t16;
1044
+ $[31] = annotation.anchor;
1045
+ $[32] = annotation.guide;
1046
+ $[33] = annotation.lineGap;
1047
+ $[34] = annotation.target;
1048
+ $[35] = annotation.targets;
1049
+ $[36] = annotationId;
1050
+ $[37] = fill;
1051
+ $[38] = first;
1052
+ $[39] = note.text;
1053
+ $[40] = t9;
1185
1054
  } else {
1186
- t16 = $[44];
1055
+ t9 = $[40];
1187
1056
  }
1188
- let t17;
1189
- if ($[45] !== t16 || $[46] !== t6 || $[47] !== t7) {
1190
- t17 = /*#__PURE__*/_jsxs(motion.g, {
1191
- style: t6,
1192
- children: [t7, t16]
1057
+ let t10;
1058
+ if ($[41] !== T0 || $[42] !== t7 || $[43] !== t8 || $[44] !== t9) {
1059
+ t10 = /*#__PURE__*/_jsxs(T0, {
1060
+ style: t7,
1061
+ children: [t8, t9]
1193
1062
  });
1194
- $[45] = t16;
1195
- $[46] = t6;
1196
- $[47] = t7;
1197
- $[48] = t17;
1063
+ $[41] = T0;
1064
+ $[42] = t7;
1065
+ $[43] = t8;
1066
+ $[44] = t9;
1067
+ $[45] = t10;
1198
1068
  } else {
1199
- t17 = $[48];
1069
+ t10 = $[45];
1200
1070
  }
1201
- return t17;
1202
- }
1203
- function annotationLeaderPath(points) {
1204
- return points.map((point, index) => `${index === 0 ? 'M' : 'L'} ${point.x} ${point.y}`).join(' ');
1071
+ return t10;
1205
1072
  }
1206
1073
  //# sourceMappingURL=node-parts.js.map